@dxc-technology/halstack-react 0.0.0-59568e7 → 0.0.0-5aa300b
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/HalstackContext.js +7 -11
- package/accordion/Accordion.js +117 -104
- package/accordion/Accordion.stories.tsx +54 -15
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +2 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +23 -33
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +50 -70
- package/button/Button.stories.tsx +61 -1
- package/button/types.d.ts +7 -7
- package/card/Card.js +34 -36
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/Chip.js +11 -23
- package/chip/Chip.stories.tsx +41 -9
- package/chip/types.d.ts +1 -1
- package/common/variables.js +186 -158
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +77 -222
- package/date-input/DateInput.stories.tsx +30 -17
- package/date-input/DateInput.test.js +411 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +53 -0
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +247 -249
- package/dropdown/Dropdown.stories.tsx +135 -64
- package/dropdown/Dropdown.test.js +504 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +38 -10
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/{radio → flex}/types.js +0 -0
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +70 -117
- package/layout/ApplicationLayout.stories.tsx +84 -93
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +18 -33
- package/link/Link.d.ts +2 -2
- package/link/Link.js +24 -50
- package/link/Link.stories.tsx +13 -6
- package/link/types.d.ts +3 -4
- package/main.d.ts +6 -9
- package/main.js +32 -56
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -20
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +6 -12
- package/paginator/Paginator.test.js +43 -1
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +25 -20
- package/quick-nav/QuickNav.stories.tsx +131 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +23 -22
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +65 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +53 -7
- package/select/Option.js +8 -10
- package/select/Select.js +43 -43
- package/select/Select.stories.tsx +225 -136
- package/select/Select.test.js +363 -250
- package/select/types.d.ts +2 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +182 -52
- package/sidenav/Sidenav.stories.tsx +163 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +2 -2
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +133 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +81 -5
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +172 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +128 -0
- package/tabs-nav/types.d.ts +53 -0
- package/{row → tabs-nav}/types.js +0 -0
- package/tag/Tag.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +38 -9
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +195 -292
- package/text-input/TextInput.stories.tsx +211 -185
- package/text-input/TextInput.test.js +737 -725
- package/text-input/types.d.ts +22 -3
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/{stack → typography}/types.js +0 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
|
@@ -3,21 +3,29 @@ import { userEvent, within } from "@storybook/testing-library";
|
|
|
3
3
|
import DxcDropdown from "./Dropdown";
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import DropdownMenu from "./DropdownMenu";
|
|
7
|
+
import DxcCheckbox from "../checkbox/Checkbox";
|
|
8
|
+
import DxcTextInput from "../text-input/TextInput";
|
|
9
|
+
import { Option } from "./types";
|
|
6
10
|
|
|
7
11
|
export default {
|
|
8
12
|
title: "Dropdown",
|
|
9
13
|
component: DxcDropdown,
|
|
10
14
|
};
|
|
11
15
|
|
|
16
|
+
const hamburguerIcon = (
|
|
17
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20">
|
|
18
|
+
<path d="M3 14.5V13h14v1.5Zm0-3.75v-1.5h14v1.5ZM3 7V5.5h14V7Z" />
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
12
21
|
const iconSVG = (
|
|
13
22
|
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
14
23
|
<path d="M0 0h24v24H0z" fill="none" />
|
|
15
24
|
<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" />
|
|
16
25
|
</svg>
|
|
17
26
|
);
|
|
18
|
-
|
|
19
27
|
const iconSVGLarge = (
|
|
20
|
-
<svg
|
|
28
|
+
<svg enableBackground="new 0 0 24 24" height="48" viewBox="0 0 24 24" width="48" fill="currentColor">
|
|
21
29
|
<g>
|
|
22
30
|
<path d="M0,0h24v24H0V0z" fill="none" />
|
|
23
31
|
<path d="M0,0h24v24H0V0z" fill="none" />
|
|
@@ -27,11 +35,13 @@ const iconSVGLarge = (
|
|
|
27
35
|
</g>
|
|
28
36
|
</svg>
|
|
29
37
|
);
|
|
38
|
+
const iconUrl = "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png";
|
|
39
|
+
const icons = [iconSVG, iconSVGLarge, iconUrl];
|
|
30
40
|
|
|
31
|
-
const
|
|
41
|
+
const defaultOptions: Option[] = [
|
|
32
42
|
{
|
|
33
43
|
value: "1",
|
|
34
|
-
label: "Amazon
|
|
44
|
+
label: "Amazon",
|
|
35
45
|
},
|
|
36
46
|
{
|
|
37
47
|
value: "2",
|
|
@@ -41,19 +51,35 @@ const options: any = [
|
|
|
41
51
|
value: "3",
|
|
42
52
|
label: "Apple",
|
|
43
53
|
},
|
|
54
|
+
{
|
|
55
|
+
value: "4",
|
|
56
|
+
label: "Wallapop",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: "5",
|
|
60
|
+
label: "Aliexpress",
|
|
61
|
+
},
|
|
44
62
|
];
|
|
45
|
-
|
|
46
|
-
const option: any = [
|
|
63
|
+
const options: Option[] = [
|
|
47
64
|
{
|
|
48
65
|
value: "1",
|
|
66
|
+
label: "Amazon with a very long text",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: "2",
|
|
49
70
|
label: "Ebay",
|
|
50
71
|
},
|
|
72
|
+
{
|
|
73
|
+
value: "3",
|
|
74
|
+
label: "Apple",
|
|
75
|
+
},
|
|
51
76
|
];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
77
|
+
const optionWithIcon: Option[] = [
|
|
78
|
+
{
|
|
79
|
+
value: "1",
|
|
80
|
+
label: "Ebay",
|
|
81
|
+
icon: iconUrl,
|
|
82
|
+
},
|
|
57
83
|
];
|
|
58
84
|
|
|
59
85
|
const optionsIcon: any = options.map((op, i) => ({ ...op, icon: icons[i] }));
|
|
@@ -68,7 +94,7 @@ export const Chromatic = () => (
|
|
|
68
94
|
<Title title="Hovered" theme="light" level={4} />
|
|
69
95
|
<DxcDropdown label="Hovered" options={options} onSelectOption={(value) => {}} />
|
|
70
96
|
</ExampleContainer>
|
|
71
|
-
<ExampleContainer pseudoState="pseudo-focus
|
|
97
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
72
98
|
<Title title="Focused" theme="light" level={4} />
|
|
73
99
|
<DxcDropdown label="Focused" options={options} onSelectOption={(value) => {}} />
|
|
74
100
|
</ExampleContainer>
|
|
@@ -103,9 +129,22 @@ export const Chromatic = () => (
|
|
|
103
129
|
<DxcDropdown options={options} onSelectOption={(value) => {}} icon={iconSVG} />
|
|
104
130
|
</ExampleContainer>
|
|
105
131
|
<ExampleContainer>
|
|
106
|
-
<Title title="
|
|
132
|
+
<Title title="Only icon without caret" theme="light" level={4} />
|
|
133
|
+
<DxcDropdown options={options} onSelectOption={(value) => {}} icon={hamburguerIcon} caretHidden />
|
|
134
|
+
</ExampleContainer>
|
|
135
|
+
<ExampleContainer>
|
|
136
|
+
<Title title="Large icon (SVG)" theme="light" level={4} />
|
|
107
137
|
<DxcDropdown label="Large icon" options={options} onSelectOption={(value) => {}} icon={iconSVGLarge} />
|
|
108
138
|
</ExampleContainer>
|
|
139
|
+
<ExampleContainer>
|
|
140
|
+
<Title title="Large icon (image)" theme="light" level={4} />
|
|
141
|
+
<DxcDropdown
|
|
142
|
+
label="Large icon"
|
|
143
|
+
options={options}
|
|
144
|
+
onSelectOption={(value) => {}}
|
|
145
|
+
icon="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/2048px-Hamburger_icon.svg.png"
|
|
146
|
+
/>
|
|
147
|
+
</ExampleContainer>
|
|
109
148
|
<ExampleContainer>
|
|
110
149
|
<Title title="Disabled with icon" theme="light" level={4} />
|
|
111
150
|
<DxcDropdown
|
|
@@ -191,59 +230,91 @@ export const Chromatic = () => (
|
|
|
191
230
|
</>
|
|
192
231
|
);
|
|
193
232
|
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
<Title title="
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
233
|
+
const DropdownListStates = () => (
|
|
234
|
+
<>
|
|
235
|
+
<Title title="Dropdown Menu" theme="light" level={2} />
|
|
236
|
+
<Title title="Default with opened menu" theme="light" level={3} />
|
|
237
|
+
<ExampleContainer>
|
|
238
|
+
<div style={{ display: "flex", gap: "30px", flexDirection: "column", marginBottom: "80px" }}>
|
|
239
|
+
<DxcDropdown label="Select a platform" options={defaultOptions} onSelectOption={(option) => {}} size="medium" />
|
|
240
|
+
<DxcTextInput label="Your name" onChange={() => {}} />
|
|
241
|
+
<DxcCheckbox
|
|
242
|
+
label="You understand the selection and give your consent"
|
|
243
|
+
onChange={() => {}}
|
|
244
|
+
labelPosition="after"
|
|
245
|
+
/>
|
|
246
|
+
</div>
|
|
247
|
+
</ExampleContainer>
|
|
248
|
+
<Title title="Option states" theme="light" level={3} />
|
|
249
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
250
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
251
|
+
<DropdownMenu
|
|
252
|
+
id="x"
|
|
253
|
+
dropdownTriggerId="dtx"
|
|
254
|
+
iconsPosition="before"
|
|
255
|
+
visualFocusIndex={-1}
|
|
256
|
+
menuItemOnClick={(value) => {}}
|
|
257
|
+
onKeyDown={(e) => {}}
|
|
258
|
+
options={optionWithIcon}
|
|
259
|
+
styles={{ width: 240 }}
|
|
260
|
+
/>
|
|
261
|
+
</ExampleContainer>
|
|
262
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
263
|
+
<Title title="Active option" theme="light" level={4} />
|
|
264
|
+
<DropdownMenu
|
|
265
|
+
id="x"
|
|
266
|
+
dropdownTriggerId="dtx"
|
|
267
|
+
iconsPosition="before"
|
|
268
|
+
visualFocusIndex={-1}
|
|
269
|
+
menuItemOnClick={(value) => {}}
|
|
270
|
+
onKeyDown={(e) => {}}
|
|
271
|
+
options={optionWithIcon}
|
|
272
|
+
styles={{ width: 240 }}
|
|
273
|
+
/>
|
|
274
|
+
</ExampleContainer>
|
|
275
|
+
<ExampleContainer>
|
|
276
|
+
<Title title="Focused option" theme="light" level={4} />
|
|
277
|
+
<DropdownMenu
|
|
278
|
+
id="x"
|
|
279
|
+
dropdownTriggerId="dtx"
|
|
280
|
+
iconsPosition="before"
|
|
281
|
+
visualFocusIndex={0}
|
|
282
|
+
menuItemOnClick={(value) => {}}
|
|
283
|
+
onKeyDown={(e) => {}}
|
|
284
|
+
options={options}
|
|
285
|
+
styles={{ width: 240 }}
|
|
286
|
+
/>
|
|
287
|
+
</ExampleContainer>
|
|
288
|
+
<Title title="Icons" theme="light" level={3} />
|
|
289
|
+
<ExampleContainer>
|
|
290
|
+
<Title title="Before" theme="light" level={4} />
|
|
291
|
+
<DropdownMenu
|
|
292
|
+
id="x"
|
|
293
|
+
dropdownTriggerId="dtx"
|
|
294
|
+
iconsPosition="before"
|
|
295
|
+
visualFocusIndex={-1}
|
|
296
|
+
menuItemOnClick={(value) => {}}
|
|
297
|
+
onKeyDown={(e) => {}}
|
|
298
|
+
options={optionsIcon}
|
|
299
|
+
styles={{ width: 240 }}
|
|
300
|
+
/>
|
|
301
|
+
<Title title="After" theme="light" level={4} />
|
|
302
|
+
<DropdownMenu
|
|
303
|
+
id="x"
|
|
304
|
+
dropdownTriggerId="dtx"
|
|
305
|
+
iconsPosition="after"
|
|
306
|
+
visualFocusIndex={-1}
|
|
307
|
+
menuItemOnClick={(value) => {}}
|
|
308
|
+
onKeyDown={(e) => {}}
|
|
309
|
+
options={optionsIcon}
|
|
310
|
+
styles={{ width: 240 }}
|
|
311
|
+
/>
|
|
312
|
+
</ExampleContainer>
|
|
313
|
+
</>
|
|
225
314
|
);
|
|
226
315
|
|
|
227
|
-
export const
|
|
228
|
-
|
|
229
|
-
const canvas = within(canvasElement);
|
|
230
|
-
await userEvent.click(canvas.getByRole("button"));
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export const DropdownHoveredOption = DropdownHoverOption.bind({});
|
|
234
|
-
DropdownHoveredOption.play = async ({ canvasElement }) => {
|
|
235
|
-
const canvas = within(canvasElement);
|
|
236
|
-
await userEvent.click(canvas.getByRole("button"));
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
export const DropdownActivedOption = DropdownActiveOption.bind({});
|
|
240
|
-
DropdownActivedOption.play = async ({ canvasElement }) => {
|
|
241
|
-
const canvas = within(canvasElement);
|
|
242
|
-
await userEvent.click(canvas.getByRole("button"));
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
export const DropdownOptionsIconAfter = DropdownWithOptionsIconAfter.bind({});
|
|
246
|
-
DropdownOptionsIconAfter.play = async ({ canvasElement }) => {
|
|
316
|
+
export const DropdownMenuStates = DropdownListStates.bind({});
|
|
317
|
+
DropdownMenuStates.play = async ({ canvasElement }) => {
|
|
247
318
|
const canvas = within(canvasElement);
|
|
248
319
|
await userEvent.click(canvas.getByRole("button"));
|
|
249
320
|
};
|