@dxc-technology/halstack-react 0.0.0-ee92231 → 0.0.0-efa7c74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +1 -1
- package/box/Box.d.ts +1 -1
- package/box/Box.js +2 -5
- package/box/types.d.ts +0 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +4 -2
- package/button/Button.stories.tsx +216 -233
- package/button/types.d.ts +2 -2
- package/card/Card.js +4 -5
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.stories.tsx +121 -0
- package/common/variables.js +13 -5
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.stories.tsx +212 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +7 -28
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +4 -15
- package/file-input/types.d.ts +87 -0
- package/file-input/types.js +5 -0
- package/footer/types.d.ts +1 -1
- package/header/Header.stories.tsx +162 -0
- package/header/types.d.ts +4 -2
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +6 -23
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/link/Link.js +2 -2
- package/link/Link.stories.tsx +146 -0
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +2 -44
- package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +1 -1
- package/password-input/types.d.ts +13 -8
- package/radio/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +0 -25
- package/resultsetTable/types.d.ts +63 -0
- package/resultsetTable/types.js +5 -0
- package/select/Select.stories.tsx +572 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +4 -13
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +41 -30
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +2 -7
- package/table/Table.js +1 -1
- package/tabs/Tabs.js +3 -1
- package/tabs/Tabs.stories.tsx +121 -0
- package/tabs/types.d.ts +2 -3
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +3 -24
- package/tag/{Tag.stories.jsx → Tag.stories.tsx} +0 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +4 -44
- package/text-input/types.d.ts +157 -0
- package/text-input/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +5 -31
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/toggle-group/types.d.ts +84 -0
- package/toggle-group/types.js +5 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +11 -51
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/file-input/index.d.ts +0 -81
- package/heading/index.d.ts +0 -17
- package/number-input/index.d.ts +0 -113
- package/resultsetTable/index.d.ts +0 -19
- package/sidenav/index.d.ts +0 -13
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/toggle-group/index.d.ts +0 -21
- package/wizard/index.d.ts +0 -18
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
+
import DxcCard from "./Card";
|
|
5
|
+
import imagePath from "./ice-cream.jpg";
|
|
6
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Card",
|
|
10
|
+
component: DxcCard,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Card = () => (
|
|
14
|
+
<>
|
|
15
|
+
<Title title="Default" theme="light" level={4} />
|
|
16
|
+
<ExampleContainer>
|
|
17
|
+
<DxcCard>Default</DxcCard>
|
|
18
|
+
</ExampleContainer>
|
|
19
|
+
<Title title="Not outlined" theme="light" level={4} />
|
|
20
|
+
<ExampleContainer>
|
|
21
|
+
<DxcCard outlined={false}>Not outlined</DxcCard>
|
|
22
|
+
</ExampleContainer>
|
|
23
|
+
<Title title="Default with link" theme="light" level={4} />
|
|
24
|
+
<ExampleContainer>
|
|
25
|
+
<DxcCard linkHref="https://www.dxc.com">Default with link</DxcCard>
|
|
26
|
+
</ExampleContainer>
|
|
27
|
+
<Title title="Focused default with link" theme="light" level={4} />
|
|
28
|
+
<ExampleContainer>
|
|
29
|
+
<DxcCard linkHref="https://www.dxc.com">Focused default with link</DxcCard>
|
|
30
|
+
</ExampleContainer>
|
|
31
|
+
<Title title="Hovered default with link" theme="light" level={4} />
|
|
32
|
+
<ExampleContainer>
|
|
33
|
+
<DxcCard linkHref="https://www.dxc.com">Hovered default with link</DxcCard>
|
|
34
|
+
</ExampleContainer>
|
|
35
|
+
<Title title="Default with action" theme="light" level={4} />
|
|
36
|
+
<ExampleContainer>
|
|
37
|
+
<DxcCard onClick={() => {}}>Default with action</DxcCard>
|
|
38
|
+
</ExampleContainer>
|
|
39
|
+
<Title title="Default with image" theme="light" level={4} />
|
|
40
|
+
<ExampleContainer>
|
|
41
|
+
<DxcCard imageSrc={imagePath}>Default</DxcCard>
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<Title title="Default image with background color" theme="light" level={4} />
|
|
44
|
+
<ExampleContainer>
|
|
45
|
+
<DxcCard imageSrc={imagePath} imageBgColor="yellow">
|
|
46
|
+
Background color
|
|
47
|
+
</DxcCard>
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<Title title="Default image with position after" theme="light" level={4} />
|
|
50
|
+
<ExampleContainer>
|
|
51
|
+
<DxcCard imageSrc={imagePath} imagePosition="after">
|
|
52
|
+
Position after
|
|
53
|
+
</DxcCard>
|
|
54
|
+
</ExampleContainer>
|
|
55
|
+
<Title title="Image cover" theme="light" level={4} />
|
|
56
|
+
<ExampleContainer>
|
|
57
|
+
<DxcCard imageSrc={imagePath} imageCover>
|
|
58
|
+
Image cover
|
|
59
|
+
</DxcCard>
|
|
60
|
+
</ExampleContainer>
|
|
61
|
+
<Title title="Image cover with position after" theme="light" level={4} />
|
|
62
|
+
<ExampleContainer>
|
|
63
|
+
<DxcCard imageSrc={imagePath} imageCover imagePosition="after">
|
|
64
|
+
Image cover with position after
|
|
65
|
+
</DxcCard>
|
|
66
|
+
</ExampleContainer>
|
|
67
|
+
<Title title="Image padding" theme="light" level={2} />
|
|
68
|
+
<ExampleContainer>
|
|
69
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
70
|
+
<DxcCard imageSrc={imagePath} imagePadding="xxsmall" imageCover>
|
|
71
|
+
Xxsmall
|
|
72
|
+
</DxcCard>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
76
|
+
<DxcCard imageSrc={imagePath} imagePadding="xsmall" imageCover>
|
|
77
|
+
Xsmall
|
|
78
|
+
</DxcCard>
|
|
79
|
+
</ExampleContainer>
|
|
80
|
+
<ExampleContainer>
|
|
81
|
+
<Title title="Small" theme="light" level={4} />
|
|
82
|
+
<DxcCard imageSrc={imagePath} imagePadding="small" imageCover>
|
|
83
|
+
Small
|
|
84
|
+
</DxcCard>
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Medium" theme="light" level={4} />
|
|
88
|
+
<DxcCard imageSrc={imagePath} imagePadding="medium" imageCover>
|
|
89
|
+
Medium
|
|
90
|
+
</DxcCard>
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer>
|
|
93
|
+
<Title title="Large" theme="light" level={4} />
|
|
94
|
+
<DxcCard imageSrc={imagePath} imagePadding="large" imageCover>
|
|
95
|
+
Large
|
|
96
|
+
</DxcCard>
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
<ExampleContainer>
|
|
99
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
100
|
+
<DxcCard imageSrc={imagePath} imagePadding="xlarge" imageCover>
|
|
101
|
+
Xlarge
|
|
102
|
+
</DxcCard>
|
|
103
|
+
</ExampleContainer>
|
|
104
|
+
<ExampleContainer>
|
|
105
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
106
|
+
<DxcCard imageSrc={imagePath} imagePadding="xxlarge" imageCover>
|
|
107
|
+
Xxlarge
|
|
108
|
+
</DxcCard>
|
|
109
|
+
</ExampleContainer>
|
|
110
|
+
<Title title="Content padding" theme="light" level={2} />
|
|
111
|
+
<ExampleContainer>
|
|
112
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
113
|
+
<DxcCard contentPadding="xxsmall">Xxsmall</DxcCard>
|
|
114
|
+
</ExampleContainer>
|
|
115
|
+
<ExampleContainer>
|
|
116
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
117
|
+
<DxcCard contentPadding="xsmall">Xsmall</DxcCard>
|
|
118
|
+
</ExampleContainer>
|
|
119
|
+
<ExampleContainer>
|
|
120
|
+
<Title title="Small" theme="light" level={4} />
|
|
121
|
+
<DxcCard contentPadding="small">Small</DxcCard>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="Medium" theme="light" level={4} />
|
|
125
|
+
<DxcCard contentPadding="medium">Medium</DxcCard>
|
|
126
|
+
</ExampleContainer>
|
|
127
|
+
<ExampleContainer>
|
|
128
|
+
<Title title="Large" theme="light" level={4} />
|
|
129
|
+
<DxcCard contentPadding="large">Large</DxcCard>
|
|
130
|
+
</ExampleContainer>
|
|
131
|
+
<ExampleContainer>
|
|
132
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
133
|
+
<DxcCard contentPadding="xlarge">Xlarge</DxcCard>
|
|
134
|
+
</ExampleContainer>
|
|
135
|
+
<ExampleContainer>
|
|
136
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
137
|
+
<DxcCard contentPadding="xxlarge">Xxlarge</DxcCard>
|
|
138
|
+
</ExampleContainer>
|
|
139
|
+
<Title title="Margin" theme="light" level={2} />
|
|
140
|
+
<ExampleContainer>
|
|
141
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
142
|
+
<DxcCard margin="xxsmall">Xxsmall</DxcCard>
|
|
143
|
+
</ExampleContainer>
|
|
144
|
+
<ExampleContainer>
|
|
145
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
146
|
+
<DxcCard margin="xsmall">Xsmall</DxcCard>
|
|
147
|
+
</ExampleContainer>
|
|
148
|
+
<ExampleContainer>
|
|
149
|
+
<Title title="Small" theme="light" level={4} />
|
|
150
|
+
<DxcCard margin="small">Small</DxcCard>
|
|
151
|
+
</ExampleContainer>
|
|
152
|
+
<ExampleContainer>
|
|
153
|
+
<Title title="Medium" theme="light" level={4} />
|
|
154
|
+
<DxcCard margin="medium">Medium</DxcCard>
|
|
155
|
+
</ExampleContainer>
|
|
156
|
+
<ExampleContainer>
|
|
157
|
+
<Title title="Large" theme="light" level={4} />
|
|
158
|
+
<DxcCard margin="large">Large</DxcCard>
|
|
159
|
+
</ExampleContainer>
|
|
160
|
+
<ExampleContainer>
|
|
161
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
162
|
+
<DxcCard margin="xlarge">Xlarge</DxcCard>
|
|
163
|
+
</ExampleContainer>
|
|
164
|
+
<ExampleContainer>
|
|
165
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
166
|
+
<DxcCard margin="xxlarge">Xxlarge</DxcCard>
|
|
167
|
+
</ExampleContainer>
|
|
168
|
+
</>
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const actionCard = () => (
|
|
172
|
+
<>
|
|
173
|
+
<ExampleContainer>
|
|
174
|
+
<Title title="Focused default with action" theme="light" level={4} />
|
|
175
|
+
<DxcCard onClick={() => {}}>Focused default with action</DxcCard>
|
|
176
|
+
</ExampleContainer>
|
|
177
|
+
<ExampleContainer>
|
|
178
|
+
<Title title="Hovered default with action" theme="light" level={4} />
|
|
179
|
+
<DxcCard onClick={() => {}}>Hovered default with action</DxcCard>
|
|
180
|
+
</ExampleContainer>
|
|
181
|
+
</>
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const linkStates = async (focusCard, hoverCard) => {
|
|
185
|
+
await focusCard.focus();
|
|
186
|
+
await userEvent.hover(hoverCard);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const ActionCardStates = actionCard.bind({});
|
|
190
|
+
ActionCardStates.play = async ({ canvasElement }) => {
|
|
191
|
+
const canvas = within(canvasElement);
|
|
192
|
+
await userEvent.tab();
|
|
193
|
+
await userEvent.hover(canvas.getAllByText("Hovered default with action")[1]);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const Chromatic = Card.bind({});
|
|
197
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
198
|
+
const canvas = within(canvasElement);
|
|
199
|
+
const linkCards = canvas.getAllByRole("link");
|
|
200
|
+
await linkStates(linkCards[1], linkCards[2]);
|
|
201
|
+
};
|
|
Binary file
|
package/card/types.d.ts
CHANGED
|
@@ -42,15 +42,13 @@ declare type Props = {
|
|
|
42
42
|
*/
|
|
43
43
|
imageCover?: boolean;
|
|
44
44
|
/**
|
|
45
|
-
* Size of the margin to be applied to the component
|
|
46
|
-
* an object with 'top', 'bottom', 'left' and 'right' properties
|
|
47
|
-
* in order to specify different margin sizes.
|
|
45
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
46
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
48
47
|
*/
|
|
49
48
|
margin?: Space | Size;
|
|
50
49
|
/**
|
|
51
|
-
* Size of the padding to be applied to the content area
|
|
52
|
-
* an object with 'top', 'bottom', 'left' and 'right' properties in
|
|
53
|
-
* order to specify different padding sizes.
|
|
50
|
+
* Size of the padding to be applied to the content area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
51
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
54
52
|
*/
|
|
55
53
|
contentPadding?: Space | Size;
|
|
56
54
|
/**
|
package/checkbox/types.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ declare type Props = {
|
|
|
49
49
|
*/
|
|
50
50
|
margin?: Space | Margin;
|
|
51
51
|
/**
|
|
52
|
-
* Size of the component
|
|
52
|
+
* Size of the component.
|
|
53
53
|
*/
|
|
54
54
|
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
55
55
|
/**
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import DxcChip from "./Chip";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Chip",
|
|
9
|
+
component: DxcChip,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const iconSVG = () => {
|
|
13
|
+
return (
|
|
14
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
15
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
16
|
+
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Chromatic = () => (
|
|
22
|
+
<>
|
|
23
|
+
<ExampleContainer>
|
|
24
|
+
<Title title="Basic chip" theme="light" level={4} />
|
|
25
|
+
<DxcChip label="Default Chip" />
|
|
26
|
+
</ExampleContainer>
|
|
27
|
+
<ExampleContainer>
|
|
28
|
+
<Title title="Chip with prefix" theme="light" level={4} />
|
|
29
|
+
<DxcChip label="Chip with prefix" prefixIcon={iconSVG} />
|
|
30
|
+
</ExampleContainer>
|
|
31
|
+
<ExampleContainer>
|
|
32
|
+
<Title title="Chip with suffix" theme="light" level={4} />
|
|
33
|
+
<DxcChip label="Chip with suffix" suffixIcon={iconSVG} />
|
|
34
|
+
</ExampleContainer>
|
|
35
|
+
<ExampleContainer>
|
|
36
|
+
<Title title="Chip with prefix and suffix" theme="light" level={4} />
|
|
37
|
+
<DxcChip label="Chip with prefix and suffix" prefixIcon={iconSVG} suffixIcon={iconSVG} />
|
|
38
|
+
</ExampleContainer>
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Disabled chip" theme="light" level={4} />
|
|
41
|
+
<DxcChip label="Disabled" disabled prefixIcon={iconSVG} suffixIcon={iconSVG} />
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="Chip with ellipsis" theme="light" level={4} />
|
|
45
|
+
<DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="Chip with ellipsis and suffix" theme="light" level={4} />
|
|
49
|
+
<DxcChip
|
|
50
|
+
suffixIcon={iconSVG}
|
|
51
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
52
|
+
/>
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Chip with ellipsis and prefix" theme="light" level={4} />
|
|
56
|
+
<DxcChip
|
|
57
|
+
prefixIcon={iconSVG}
|
|
58
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
59
|
+
/>
|
|
60
|
+
</ExampleContainer>
|
|
61
|
+
<ExampleContainer>
|
|
62
|
+
<Title title="Chip with ellipsis, suffix and prefix" theme="light" level={4} />
|
|
63
|
+
<DxcChip
|
|
64
|
+
prefixIcon={iconSVG}
|
|
65
|
+
suffixIcon={iconSVG}
|
|
66
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
|
|
67
|
+
/>
|
|
68
|
+
</ExampleContainer>
|
|
69
|
+
<Title title="Margins" theme="light" level={2} />
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
72
|
+
<DxcChip label="xxsmall" margin="xxsmall" />
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
76
|
+
<DxcChip label="xsmall" margin="xsmall" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
80
|
+
<DxcChip label="small" margin="small" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<ExampleContainer>
|
|
83
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
84
|
+
<DxcChip label="medium" margin="medium" />
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
88
|
+
<DxcChip label="large" margin="large" />
|
|
89
|
+
</ExampleContainer>
|
|
90
|
+
<ExampleContainer>
|
|
91
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
92
|
+
<DxcChip label="xlarge" margin="xlarge" />
|
|
93
|
+
</ExampleContainer>
|
|
94
|
+
<ExampleContainer>
|
|
95
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
96
|
+
<DxcChip label="xxlarge" margin="xxlarge" />
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
</>
|
|
99
|
+
);
|
|
100
|
+
const ChipPrefixFocused = () => (
|
|
101
|
+
<ExampleContainer>
|
|
102
|
+
<Title title="Chip with prefix" theme="light" level={4} />
|
|
103
|
+
<DxcChip label="Chip with prefix" prefixIcon={iconSVG} onClickPrefix={() => {}} />
|
|
104
|
+
</ExampleContainer>
|
|
105
|
+
);
|
|
106
|
+
const ChipSuffixFocused = () => (
|
|
107
|
+
<ExampleContainer>
|
|
108
|
+
<Title title="Chip with suffix" theme="light" level={4} />
|
|
109
|
+
<DxcChip label="Chip with suffix" suffixIcon={iconSVG} onClickSuffix={() => {}} />
|
|
110
|
+
</ExampleContainer>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
export const PrefixFocused = ChipPrefixFocused.bind({});
|
|
114
|
+
PrefixFocused.play = async ({ canvasElement }) => {
|
|
115
|
+
await userEvent.tab();
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const SuffixFocused = ChipSuffixFocused.bind({});
|
|
119
|
+
SuffixFocused.play = async ({ canvasElement }) => {
|
|
120
|
+
await userEvent.tab();
|
|
121
|
+
};
|
package/common/variables.js
CHANGED
|
@@ -1042,9 +1042,13 @@ var componentTokens = {
|
|
|
1042
1042
|
},
|
|
1043
1043
|
slider: {
|
|
1044
1044
|
fontFamily: globalTokens.type_sans,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1045
|
+
limitValuesFontColor: globalTokens.hal_black,
|
|
1046
|
+
limitValuesFontColorOnDark: globalTokens.hal_white,
|
|
1047
|
+
limitValuesFontSize: globalTokens.type_scale_03,
|
|
1048
|
+
limitValuesFontStyle: globalTokens.type_normal,
|
|
1049
|
+
limitValuesFontWeight: globalTokens.type_regular,
|
|
1050
|
+
limitValuesFontLetterSpacing: globalTokens.type_spacing_normal,
|
|
1051
|
+
disabledLimitValuesFontColor: globalTokens.hal_grey_l_60,
|
|
1048
1052
|
labelFontFamily: globalTokens.type_sans,
|
|
1049
1053
|
labelFontSize: globalTokens.type_scale_02,
|
|
1050
1054
|
labelFontStyle: globalTokens.type_normal,
|
|
@@ -1058,9 +1062,13 @@ var componentTokens = {
|
|
|
1058
1062
|
fontColor: globalTokens.hal_black,
|
|
1059
1063
|
fontColorOnDark: globalTokens.hal_white,
|
|
1060
1064
|
labelFontColor: globalTokens.hal_black,
|
|
1065
|
+
labelFontColorOnDark: globalTokens.hal_white,
|
|
1061
1066
|
helperTextFontColor: globalTokens.hal_black,
|
|
1062
|
-
|
|
1063
|
-
|
|
1067
|
+
helperTextFontColorOnDark: globalTokens.hal_white,
|
|
1068
|
+
disabledLabelFontColor: globalTokens.hal_grey_l_60,
|
|
1069
|
+
disabledLabelFontColorOnDark: globalTokens.hal_grey_l_60,
|
|
1070
|
+
disabledHelperTextFontColor: globalTokens.hal_grey_l_60,
|
|
1071
|
+
disabledHelperTextFontColorOnDark: globalTokens.hal_grey_l_60,
|
|
1064
1072
|
thumbHeight: "12px",
|
|
1065
1073
|
thumbWidth: "12px",
|
|
1066
1074
|
hoverThumbHeight: "14px",
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within, fireEvent, screen } from "@storybook/testing-library";
|
|
3
|
+
import DxcDateInput from "./DateInput";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
7
|
+
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Date input",
|
|
11
|
+
component: DxcDateInput,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Chromatic = () => (
|
|
15
|
+
<>
|
|
16
|
+
<ExampleContainer>
|
|
17
|
+
<Title title="Complete date input" theme="light" level={4} />
|
|
18
|
+
<DxcDateInput label="Date input" helperText="Help message" format="dd/mm/yy" placeholder optional />
|
|
19
|
+
</ExampleContainer>
|
|
20
|
+
<ExampleContainer>
|
|
21
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
22
|
+
<DxcDateInput label="Disabled date input" helperText="Help message" value="06-04-2027" clearable disabled />
|
|
23
|
+
</ExampleContainer>
|
|
24
|
+
<ExampleContainer>
|
|
25
|
+
<Title title="Invalid" theme="light" level={4} />
|
|
26
|
+
<DxcDateInput label="Error date input" error="Error message." placeholder />
|
|
27
|
+
</ExampleContainer>
|
|
28
|
+
<ExampleContainer>
|
|
29
|
+
<Title title="Relation between icons" theme="light" level={4} />
|
|
30
|
+
<DxcDateInput label="Error date input" error="Error message." value="06-04-2027" clearable />
|
|
31
|
+
</ExampleContainer>
|
|
32
|
+
<BackgroundColorProvider color="#333333">
|
|
33
|
+
<DarkContainer>
|
|
34
|
+
<Title title="Dark" theme="dark" level={2} />
|
|
35
|
+
<ExampleContainer>
|
|
36
|
+
<Title title="Complete date input" theme="dark" level={4} />
|
|
37
|
+
<DxcDateInput label="Date input" helperText="Help message" format="yyyy/dd/mm" placeholder optional />
|
|
38
|
+
</ExampleContainer>
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Disabled" theme="dark" level={4} />
|
|
41
|
+
<DxcDateInput label="Disabled Date input" helperText="Help message" value="06-04-2027" clearable disabled />
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="Invalid" theme="dark" level={4} />
|
|
45
|
+
<DxcDateInput label="Error date input" error="Error message." placeholder />
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="Relation between icons" theme="dark" level={4} />
|
|
49
|
+
<DxcDateInput label="Error date input" value="06-04-2027" error="Error message." clearable />
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
</DarkContainer>
|
|
52
|
+
</BackgroundColorProvider>
|
|
53
|
+
<Title title="Margins" theme="light" level={2} />
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
56
|
+
<DxcDateInput label="Xxsmall" margin="xxsmall" />
|
|
57
|
+
</ExampleContainer>
|
|
58
|
+
<ExampleContainer>
|
|
59
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
60
|
+
<DxcDateInput label="Xsmall" margin="xsmall" />
|
|
61
|
+
</ExampleContainer>
|
|
62
|
+
<ExampleContainer>
|
|
63
|
+
<Title title="Small" theme="light" level={4} />
|
|
64
|
+
<DxcDateInput label="Small" margin="small" />
|
|
65
|
+
</ExampleContainer>
|
|
66
|
+
<ExampleContainer>
|
|
67
|
+
<Title title="Medium" theme="light" level={4} />
|
|
68
|
+
<DxcDateInput label="Medium" margin="medium" />
|
|
69
|
+
</ExampleContainer>
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Large" theme="light" level={4} />
|
|
72
|
+
<DxcDateInput label="Large" margin="large" />
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
76
|
+
<DxcDateInput label="Xlarge" margin="xlarge" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
80
|
+
<DxcDateInput label="Xxlarge" margin="xxlarge" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
83
|
+
<ExampleContainer>
|
|
84
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
85
|
+
<DxcDateInput label="Medium" size="medium" />
|
|
86
|
+
</ExampleContainer>
|
|
87
|
+
<ExampleContainer>
|
|
88
|
+
<Title title="Large size" theme="light" level={4} />
|
|
89
|
+
<DxcDateInput label="Large" size="large" />
|
|
90
|
+
</ExampleContainer>
|
|
91
|
+
<ExampleContainer>
|
|
92
|
+
<Title title="FillParent size" theme="light" level={4} />
|
|
93
|
+
<DxcDateInput label="FillParent" size="fillParent" />
|
|
94
|
+
</ExampleContainer>
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const DatePicker = () => (
|
|
99
|
+
<ExampleContainer expanded>
|
|
100
|
+
<Title title="Show date input" theme="light" level={4} />
|
|
101
|
+
<DxcDateInput label="Date input" value="10-06-2023" />
|
|
102
|
+
</ExampleContainer>
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
export const ShowDatePicker = DatePicker.bind({});
|
|
106
|
+
ShowDatePicker.play = async ({ canvasElement }) => {
|
|
107
|
+
const canvas = within(canvasElement);
|
|
108
|
+
const dateBtn = canvas.getByRole("button");
|
|
109
|
+
await userEvent.click(dateBtn);
|
|
110
|
+
await userEvent.tab();
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const YearPicker = () => (
|
|
114
|
+
<ExampleContainer expanded>
|
|
115
|
+
<Title title="Show date input" theme="light" level={4} />
|
|
116
|
+
<DxcDateInput label="Date input" value="10-06-2023" />
|
|
117
|
+
</ExampleContainer>
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export const ShowYearPicker = YearPicker.bind({});
|
|
121
|
+
ShowYearPicker.play = async () => {
|
|
122
|
+
await fireEvent.click(screen.getByRole("button"));
|
|
123
|
+
await fireEvent.click(screen.getByText("2023"));
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const YearPickerFocus = () => (
|
|
127
|
+
<ExampleContainer expanded>
|
|
128
|
+
<Title title="Show date input" theme="light" level={4} />
|
|
129
|
+
<DxcDateInput label="Date input" value="10-06-2023" />
|
|
130
|
+
</ExampleContainer>
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
export const ShowYearPickerFocus = YearPickerFocus.bind({});
|
|
134
|
+
ShowYearPickerFocus.play = async () => {
|
|
135
|
+
await fireEvent.click(screen.getByRole("button"));
|
|
136
|
+
await fireEvent.click(screen.getByText("2023"));
|
|
137
|
+
await screen.getByText("2021").focus();
|
|
138
|
+
};
|