Skip to content

Commit 14a6e40

Browse files
authored
[KLAR-8864] Date picker reflects color mode change (#560)
1 parent d978923 commit 14a6e40

File tree

8 files changed

+50
-32
lines changed

8 files changed

+50
-32
lines changed

nordcloud-gnui-8.0.0.tgz

547 KB
Binary file not shown.

src/components/container/Container.tsx

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { space, SpaceProps } from "styled-system";
44
import theme from "../../theme";
55
import { LengthUnitSuffix, Unit } from "./types";
66

7-
type StyledContainerProps = {
7+
type StyledContainerProps = SpaceProps & {
88
width?: string;
9-
} & SpaceProps;
9+
};
1010

1111
const StyledContainer = styled.div<StyledContainerProps>`
1212
box-sizing: border-box;
@@ -29,12 +29,12 @@ export const Container = React.forwardRef<HTMLDivElement, ContainerProps>(
2929
)
3030
);
3131

32-
type FlexProps = {
32+
type FlexProps = SpaceProps & {
3333
alignItems?: string;
3434
justifyContent?: string;
3535
flexDirection?: string;
3636
margin?: string;
37-
} & SpaceProps;
37+
};
3838

3939
/**
4040
* @deprecated Please use FlexContainer
@@ -53,49 +53,50 @@ export const Flex = styled(Container)<FlexProps>`
5353
`;
5454

5555
// New implementation of FlexContainer to replace Flex in the future.
56-
type FlexContainerProps = {
56+
type FlexContainerProps = SpaceProps & {
5757
alignItems?:
58-
| "stretch"
59-
| "flex-start"
60-
| "flex-end"
61-
| "center"
6258
| "baseline"
59+
| "center"
60+
| "end"
6361
| "first baseline"
62+
| "flex-end"
63+
| "flex-start"
6464
| "last baseline"
65-
| "start"
66-
| "end"
65+
| "self-end"
6766
| "self-start"
68-
| "self-end";
67+
| "start"
68+
| "stretch";
6969
alignContent?:
70-
| "stretch"
71-
| "flex-start"
72-
| "flex-end"
73-
| "center"
7470
| "baseline"
71+
| "center"
72+
| "end"
7573
| "first baseline"
74+
| "flex-end"
75+
| "flex-start"
7676
| "last baseline"
77-
| "start"
78-
| "end"
77+
| "self-end"
7978
| "self-start"
80-
| "self-end";
79+
| "start"
80+
| "stretch";
8181
justifyContent?:
82-
| "flex-start"
83-
| "flex-end"
8482
| "center"
85-
| "space-between"
86-
| "space-around"
87-
| "space-evenly"
88-
| "start"
8983
| "end"
84+
| "flex-end"
85+
| "flex-start"
9086
| "left"
91-
| "right";
87+
| "right"
88+
| "space-around"
89+
| "space-between"
90+
| "space-evenly"
91+
| "start";
9292
grow?: number;
93-
wrap?: "nowrap" | "wrap" | "wrap-reverse";
94-
direction?: "row" | "row-reverse" | "column" | "column-reverse";
93+
wrap?: "nowrap" | "wrap-reverse" | "wrap";
94+
direction?: "column-reverse" | "column" | "row-reverse" | "row";
9595
gap?: Unit<LengthUnitSuffix> | "0" | 0;
9696
columnGap?: Unit<LengthUnitSuffix> | "0" | 0;
9797
rowGap?: Unit<LengthUnitSuffix> | "0" | 0;
98-
} & SpaceProps;
98+
popup?: boolean;
99+
};
99100

100101
function getFlexCss(props: FlexContainerProps) {
101102
return css`

src/components/input/Input.stories.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,14 @@ Placeholder text inside input element
231231
</>
232232
</Story>
233233
</Canvas>
234+
235+
### date
236+
237+
<Canvas>
238+
<Story name="date">
239+
<>
240+
<Label name="Date" htmlFor="date-id" required />
241+
<Input type="date" value={""} placeholder="MM/DD/YYYY" />
242+
</>
243+
</Story>
244+
</Canvas>

src/components/input/styles.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled, { css } from "styled-components";
22
import { space, SpaceProps } from "styled-system";
33
import theme from "../../theme";
4-
import { Flex } from "../container";
4+
import { FlexContainer } from "../container";
55
import { StyledInputGroupProps, StyledInputProps, Status } from "./types";
66

77
export const setStatusColor = (status: Status) => {
@@ -17,7 +17,9 @@ export const setStatusColor = (status: Status) => {
1717
};
1818

1919
/* eslint-disable sonarjs/no-identical-functions */
20-
export const InputGroup = styled(Flex)<StyledInputGroupProps & SpaceProps>`
20+
export const InputGroup = styled(FlexContainer)<
21+
SpaceProps & StyledInputGroupProps
22+
>`
2123
position: relative;
2224
align-items: center;
2325
border: 1px solid ${theme.color.border.input};
@@ -78,6 +80,7 @@ export const StyledInput = styled.input<StyledInputProps>`
7880
margin: 0;
7981
transition: ${theme.transition};
8082
color: ${theme.color.text.text01};
83+
color-scheme: ${theme.color.scheme};
8184
8285
&::placeholder {
8386
color: ${theme.color.text.text03};

src/components/input/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import { SVGIconProps } from "../svgicon";
33

4-
export type Status = "success" | "danger";
4+
export type Status = "danger" | "success";
55

66
export type StyledInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
77
small?: boolean;

src/theme/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const color = {
2+
scheme: "var(--color-scheme)",
23
background: {
34
body: "var(--background-body)",
45
ui01: "var(--background-ui01)",

src/theme/dark.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { palette } from "./palette";
22

33
const DARK_COLORS = [
4+
["--color-scheme", "dark"],
45
["--background-body", palette.darkGrey.darkGrey500],
56
["--background-overlay", palette.black],
67
["--background-ui01", palette.darkGrey.darkGrey300],

src/theme/light.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { palette } from "./palette";
22

33
const LIGHT_COLORS = [
4+
["--color-scheme", "light"],
45
["--background-body", palette.grey.grey300],
56
["--background-overlay", palette.black],
67
["--background-ui01", palette.white],

0 commit comments

Comments
 (0)