@dxc-technology/halstack-react 0.0.0-49c38a4 → 0.0.0-4a67e25
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.d.ts +12 -0
- package/HalstackContext.js +294 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +121 -123
- package/accordion/Accordion.stories.tsx +13 -14
- package/accordion/Accordion.test.js +25 -11
- package/accordion/types.d.ts +9 -4
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +15 -36
- package/accordion-group/AccordionGroup.stories.tsx +28 -2
- package/accordion-group/AccordionGroup.test.js +30 -37
- package/accordion-group/types.d.ts +14 -3
- package/alert/Alert.js +5 -2
- 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 +25 -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 +53 -68
- package/button/Button.stories.tsx +9 -0
- package/button/types.d.ts +7 -7
- package/card/Card.js +24 -27
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +106 -109
- package/checkbox/Checkbox.stories.tsx +146 -130
- package/checkbox/Checkbox.test.js +100 -10
- package/checkbox/types.d.ts +13 -5
- package/chip/types.d.ts +1 -1
- package/common/variables.js +236 -106
- package/date-input/DateInput.js +56 -42
- package/date-input/DateInput.stories.tsx +19 -8
- package/date-input/DateInput.test.js +161 -87
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +46 -50
- 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 -251
- package/dropdown/Dropdown.stories.tsx +126 -63
- 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 +183 -222
- 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 +43 -66
- 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.js +15 -88
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +95 -114
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +18 -2
- 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 +25 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +71 -131
- 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 +3 -2
- package/link/Link.js +58 -75
- package/link/Link.stories.tsx +95 -53
- package/link/Link.test.js +7 -15
- package/link/types.d.ts +7 -23
- package/main.d.ts +8 -10
- package/main.js +46 -56
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +45 -11
- package/number-input/types.d.ts +17 -10
- package/package.json +20 -16
- package/paginator/Paginator.js +17 -38
- 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.js +7 -4
- package/password-input/PasswordInput.test.js +16 -18
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +57 -51
- package/progress-bar/ProgressBar.stories.jsx +13 -11
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +117 -0
- package/quick-nav/QuickNav.stories.tsx +342 -0
- package/quick-nav/types.d.ts +21 -0
- package/{row → quick-nav}/types.js +0 -0
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +32 -28
- package/radio-group/RadioGroup.stories.tsx +5 -0
- package/radio-group/RadioGroup.test.js +144 -116
- package/radio-group/types.d.ts +79 -2
- package/resultsetTable/ResultsetTable.js +1 -3
- package/resultsetTable/ResultsetTable.test.js +42 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +198 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.js +141 -365
- package/select/Select.stories.tsx +160 -115
- package/select/Select.test.js +609 -276
- package/select/types.d.ts +52 -12
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +184 -52
- package/sidenav/Sidenav.stories.tsx +154 -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 +122 -96
- package/slider/Slider.stories.tsx +15 -9
- package/slider/Slider.test.js +142 -21
- package/slider/types.d.ts +10 -2
- package/spinner/Spinner.js +1 -1
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +150 -67
- package/switch/Switch.stories.tsx +20 -42
- package/switch/Switch.test.js +155 -3
- package/switch/types.d.ts +12 -4
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +135 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +362 -108
- package/tabs/Tabs.stories.tsx +74 -8
- package/tabs/Tabs.test.js +241 -13
- package/tabs/types.d.ts +19 -5
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +130 -0
- package/tabs-nav/types.d.ts +53 -0
- package/{stack → tabs-nav}/types.js +0 -0
- package/tag/Tag.js +15 -20
- package/tag/Tag.stories.tsx +12 -8
- 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.d.ts +4 -0
- package/text-input/Suggestion.js +57 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +214 -333
- package/text-input/TextInput.stories.tsx +199 -192
- package/text-input/TextInput.test.js +686 -753
- package/text-input/types.d.ts +50 -12
- package/textarea/Textarea.js +15 -24
- package/textarea/Textarea.stories.jsx +5 -5
- package/textarea/Textarea.test.js +37 -36
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +35 -4
- package/toggle-group/types.d.ts +9 -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/typography/types.js +5 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +58 -54
- package/wizard/Wizard.stories.tsx +33 -24
- package/wizard/Wizard.test.js +36 -23
- package/wizard/types.d.ts +10 -5
- package/ThemeContext.d.ts +0 -15
- package/ThemeContext.js +0 -235
- 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 -174
- 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 -10
- 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 -9
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
2
|
import { userEvent, within, waitFor } from "@storybook/testing-library";
|
|
4
|
-
import { fireEvent } from "@testing-library/react";
|
|
5
|
-
|
|
6
3
|
import Title from "../../.storybook/components/Title";
|
|
7
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
8
|
-
|
|
9
5
|
import DxcSelect from "./Select";
|
|
6
|
+
import Listbox from "./Listbox";
|
|
7
|
+
import DxcButton from "../button/Button";
|
|
8
|
+
import DxcCheckbox from "../checkbox/Checkbox";
|
|
10
9
|
|
|
11
10
|
export default {
|
|
12
11
|
title: "Select",
|
|
@@ -244,7 +243,7 @@ const Select = () => (
|
|
|
244
243
|
</ExampleContainer>
|
|
245
244
|
<ExampleContainer>
|
|
246
245
|
<Title title="Disabled with value" theme="light" level={4} />
|
|
247
|
-
<DxcSelect label="Disabled with value" disabled options={single_options}
|
|
246
|
+
<DxcSelect label="Disabled with value" disabled options={single_options} defaultValue="1" />
|
|
248
247
|
</ExampleContainer>
|
|
249
248
|
<ExampleContainer>
|
|
250
249
|
<Title title="Error" theme="light" level={4} />
|
|
@@ -274,19 +273,19 @@ const Select = () => (
|
|
|
274
273
|
<Title title="Variants" theme="light" level={2} />
|
|
275
274
|
<ExampleContainer>
|
|
276
275
|
<Title title="Simple selection" theme="light" level={4} />
|
|
277
|
-
<DxcSelect label="Simple selection" searchable options={single_options}
|
|
276
|
+
<DxcSelect label="Simple selection" searchable options={single_options} defaultValue="2" />
|
|
278
277
|
</ExampleContainer>
|
|
279
278
|
<ExampleContainer>
|
|
280
279
|
<Title title="Multiple selection" theme="light" level={4} />
|
|
281
|
-
<DxcSelect label="Multiple select" searchable options={single_options} multiple
|
|
280
|
+
<DxcSelect label="Multiple select" searchable options={single_options} multiple defaultValue={["1", "2"]} />
|
|
282
281
|
</ExampleContainer>
|
|
283
282
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
284
283
|
<Title title="Multiple clear hovered" theme="light" level={4} />
|
|
285
|
-
<DxcSelect label="Multiple select" options={single_options} multiple
|
|
284
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
286
285
|
</ExampleContainer>
|
|
287
286
|
<ExampleContainer pseudoState="pseudo-active">
|
|
288
287
|
<Title title="Multiple clear actived" theme="light" level={4} />
|
|
289
|
-
<DxcSelect label="Multiple select" options={single_options} multiple
|
|
288
|
+
<DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
|
|
290
289
|
</ExampleContainer>
|
|
291
290
|
<Title title="Sizes" theme="light" level={2} />
|
|
292
291
|
<ExampleContainer>
|
|
@@ -337,30 +336,118 @@ const Select = () => (
|
|
|
337
336
|
<ExampleContainer expanded>
|
|
338
337
|
<Title title="Ellipsis" theme="light" level={2} />
|
|
339
338
|
<Title title="Multiple selection with ellipsis" theme="light" level={4} />
|
|
340
|
-
<DxcSelect label="Label" options={single_options} multiple
|
|
339
|
+
<DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
|
|
341
340
|
<Title title="Value with ellipsis" theme="light" level={4} />
|
|
342
|
-
<DxcSelect label="Label" options={optionsWithEllipsisMedium}
|
|
343
|
-
<Title title="
|
|
341
|
+
<DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" size="medium" />
|
|
342
|
+
<Title title="Options with ellipsis" theme="light" level={4} />
|
|
344
343
|
<DxcSelect
|
|
345
344
|
label="Label"
|
|
346
345
|
placeholder="Choose an option"
|
|
347
|
-
|
|
346
|
+
defaultValue="1"
|
|
348
347
|
options={optionsWithEllipsisMedium}
|
|
349
348
|
size="medium"
|
|
350
349
|
/>
|
|
351
350
|
</ExampleContainer>
|
|
352
351
|
</>
|
|
353
352
|
);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
353
|
+
const SelectListbox = () => (
|
|
354
|
+
<>
|
|
355
|
+
<Title title="Listbox" theme="light" level={2} />
|
|
356
|
+
<Title title="Default with opened listbox" theme="light" level={3} />
|
|
357
|
+
<ExampleContainer>
|
|
358
|
+
<div style={{ display: "flex", gap: "30px", flexDirection: "column", marginBottom: "80px" }}>
|
|
359
|
+
<DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
|
|
360
|
+
<DxcCheckbox
|
|
361
|
+
label="You understand the selection and give your consent"
|
|
362
|
+
onChange={() => {}}
|
|
363
|
+
labelPosition="after"
|
|
364
|
+
/>
|
|
365
|
+
<DxcButton label="Submit" onClick={() => {}} size="medium" />
|
|
366
|
+
</div>
|
|
367
|
+
</ExampleContainer>
|
|
368
|
+
<Title title="Listbox option states" theme="light" level={3} />
|
|
369
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
370
|
+
<Title title="Hovered option" theme="light" level={4} />
|
|
371
|
+
<Listbox
|
|
372
|
+
id="x"
|
|
373
|
+
currentValue=""
|
|
374
|
+
options={one_option}
|
|
375
|
+
visualFocusIndex={-1}
|
|
376
|
+
lastOptionIndex={0}
|
|
377
|
+
multiple={false}
|
|
378
|
+
optional={false}
|
|
379
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
380
|
+
searchable={false}
|
|
381
|
+
handleOptionOnClick={() => {}}
|
|
382
|
+
getSelectWidth={() => 360}
|
|
383
|
+
/>
|
|
384
|
+
</ExampleContainer>
|
|
385
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
386
|
+
<Title title="Active option" theme="light" level={4} />
|
|
387
|
+
<Listbox
|
|
388
|
+
id="x"
|
|
389
|
+
currentValue=""
|
|
390
|
+
options={one_option}
|
|
391
|
+
visualFocusIndex={-1}
|
|
392
|
+
lastOptionIndex={0}
|
|
393
|
+
multiple={false}
|
|
394
|
+
optional={false}
|
|
395
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
396
|
+
searchable={false}
|
|
397
|
+
handleOptionOnClick={() => {}}
|
|
398
|
+
getSelectWidth={() => 360}
|
|
399
|
+
|
|
400
|
+
/>
|
|
401
|
+
</ExampleContainer>
|
|
402
|
+
<ExampleContainer>
|
|
403
|
+
<Title title="Focused option" theme="light" level={4} />
|
|
404
|
+
<Listbox
|
|
405
|
+
id="x"
|
|
406
|
+
currentValue=""
|
|
407
|
+
options={one_option}
|
|
408
|
+
visualFocusIndex={0}
|
|
409
|
+
lastOptionIndex={0}
|
|
410
|
+
multiple={false}
|
|
411
|
+
optional={false}
|
|
412
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
413
|
+
searchable={false}
|
|
414
|
+
handleOptionOnClick={() => {}}
|
|
415
|
+
getSelectWidth={() => 360}
|
|
416
|
+
/>
|
|
417
|
+
</ExampleContainer>
|
|
418
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
419
|
+
<Title title="Hovered selected option" theme="light" level={4} />
|
|
420
|
+
<Listbox
|
|
421
|
+
id="x"
|
|
422
|
+
currentValue="1"
|
|
423
|
+
options={single_options}
|
|
424
|
+
visualFocusIndex={-1}
|
|
425
|
+
lastOptionIndex={3}
|
|
426
|
+
multiple={false}
|
|
427
|
+
optional={false}
|
|
428
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
429
|
+
searchable={false}
|
|
430
|
+
handleOptionOnClick={() => {}}
|
|
431
|
+
getSelectWidth={() => 360}
|
|
432
|
+
/>
|
|
433
|
+
</ExampleContainer>
|
|
434
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
435
|
+
<Title title="Active selected option" theme="light" level={4} />
|
|
436
|
+
<Listbox
|
|
437
|
+
id="x"
|
|
438
|
+
currentValue="2"
|
|
439
|
+
options={single_options}
|
|
440
|
+
visualFocusIndex={0}
|
|
441
|
+
lastOptionIndex={3}
|
|
442
|
+
multiple={false}
|
|
443
|
+
optional={false}
|
|
444
|
+
optionalItem={{ label: "Empty", value: "" }}
|
|
445
|
+
searchable={false}
|
|
446
|
+
handleOptionOnClick={() => {}}
|
|
447
|
+
getSelectWidth={() => 360}
|
|
448
|
+
/>
|
|
449
|
+
</ExampleContainer>
|
|
450
|
+
</>
|
|
364
451
|
);
|
|
365
452
|
const SearchableSelect = () => (
|
|
366
453
|
<ExampleContainer expanded>
|
|
@@ -368,13 +455,18 @@ const SearchableSelect = () => (
|
|
|
368
455
|
<DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
|
|
369
456
|
</ExampleContainer>
|
|
370
457
|
);
|
|
371
|
-
const
|
|
458
|
+
const SearchValue = () => (
|
|
372
459
|
<ExampleContainer expanded>
|
|
373
460
|
<Title title="Searchable select with value" theme="light" level={4} />
|
|
374
|
-
<DxcSelect
|
|
461
|
+
<DxcSelect
|
|
462
|
+
label="Select Label"
|
|
463
|
+
searchable
|
|
464
|
+
defaultValue="1"
|
|
465
|
+
options={single_options}
|
|
466
|
+
placeholder="Choose an option"
|
|
467
|
+
/>
|
|
375
468
|
</ExampleContainer>
|
|
376
469
|
);
|
|
377
|
-
|
|
378
470
|
const MultipleSelect = () => (
|
|
379
471
|
<>
|
|
380
472
|
<ExampleContainer expanded>
|
|
@@ -382,7 +474,7 @@ const MultipleSelect = () => (
|
|
|
382
474
|
<DxcSelect
|
|
383
475
|
label="Select label"
|
|
384
476
|
options={single_options}
|
|
385
|
-
|
|
477
|
+
defaultValue={["1", "4"]}
|
|
386
478
|
multiple
|
|
387
479
|
placeholder="Choose an option"
|
|
388
480
|
/>
|
|
@@ -392,31 +484,37 @@ const MultipleSelect = () => (
|
|
|
392
484
|
const DefaultGroupedOptionsSelect = () => (
|
|
393
485
|
<ExampleContainer expanded>
|
|
394
486
|
<Title title="Grouped options simple select" theme="light" level={4} />
|
|
395
|
-
<DxcSelect label="Label" options={group_options}
|
|
487
|
+
<DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
|
|
396
488
|
</ExampleContainer>
|
|
397
489
|
);
|
|
398
490
|
const MultipleGroupedOptionsSelect = () => (
|
|
399
491
|
<ExampleContainer expanded>
|
|
400
492
|
<Title title="Grouped options multiple select" theme="light" level={4} />
|
|
401
|
-
<DxcSelect
|
|
493
|
+
<DxcSelect
|
|
494
|
+
label="Label"
|
|
495
|
+
options={group_options}
|
|
496
|
+
defaultValue={["0", "2"]}
|
|
497
|
+
multiple
|
|
498
|
+
placeholder="Choose an option"
|
|
499
|
+
/>
|
|
402
500
|
</ExampleContainer>
|
|
403
501
|
);
|
|
404
502
|
const RescaledIcons = () => (
|
|
405
503
|
<ExampleContainer expanded>
|
|
406
504
|
<Title title="Rescaled icons displayed" theme="light" level={4} />
|
|
407
|
-
<DxcSelect label="Label" options={url_options}
|
|
505
|
+
<DxcSelect label="Label" options={url_options} defaultValue="facebook" placeholder="Choose an option" />
|
|
408
506
|
</ExampleContainer>
|
|
409
507
|
);
|
|
410
508
|
const SelectWithIcons = () => (
|
|
411
509
|
<ExampleContainer expanded>
|
|
412
510
|
<Title title="Normal icons displayed" theme="light" level={4} />
|
|
413
|
-
<DxcSelect label="Label" options={icon_options}
|
|
511
|
+
<DxcSelect label="Label" options={icon_options} defaultValue="3" placeholder="Choose an option" />
|
|
414
512
|
</ExampleContainer>
|
|
415
513
|
);
|
|
416
514
|
const SelectMultipleWithIcons = () => (
|
|
417
515
|
<ExampleContainer expanded>
|
|
418
516
|
<Title title="Multiple select with icons" theme="light" level={4} />
|
|
419
|
-
<DxcSelect label="Label" options={icon_options} multiple
|
|
517
|
+
<DxcSelect label="Label" options={icon_options} multiple defaultValue={["1", "3"]} placeholder="Choose an option" />
|
|
420
518
|
</ExampleContainer>
|
|
421
519
|
);
|
|
422
520
|
const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
@@ -426,41 +524,12 @@ const MultipleGroupedOptionsSelectWithIcons = () => (
|
|
|
426
524
|
label="Label"
|
|
427
525
|
options={icon_options_grouped}
|
|
428
526
|
multiple
|
|
429
|
-
|
|
527
|
+
defaultValue={["3", "2"]}
|
|
430
528
|
placeholder="Choose an option"
|
|
431
529
|
/>
|
|
432
530
|
</ExampleContainer>
|
|
433
531
|
);
|
|
434
|
-
|
|
435
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
436
|
-
<Title title="Hovered Option" theme="light" level={4} />
|
|
437
|
-
<DxcSelect label="Hovered" options={one_option} placeholder="Choose an option" />
|
|
438
|
-
</ExampleContainer>
|
|
439
|
-
);
|
|
440
|
-
const OnlyOneOptionFocused = () => (
|
|
441
|
-
<ExampleContainer pseudoState="pseudo-focus" expanded>
|
|
442
|
-
<Title title="Focused Option" theme="light" level={4} />
|
|
443
|
-
<DxcSelect label="Focused" options={one_option} placeholder="Choose an option" />
|
|
444
|
-
</ExampleContainer>
|
|
445
|
-
);
|
|
446
|
-
const OnlyOneOptionActived = () => (
|
|
447
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
448
|
-
<Title title="Actived Option" theme="light" level={4} />
|
|
449
|
-
<DxcSelect label="Actived" options={one_option} placeholder="Choose an option" />
|
|
450
|
-
</ExampleContainer>
|
|
451
|
-
);
|
|
452
|
-
const SelectedOptionHovered = () => (
|
|
453
|
-
<ExampleContainer pseudoState="pseudo-hover" expanded>
|
|
454
|
-
<Title title="Hovered Selected Option" theme="light" level={4} />
|
|
455
|
-
<DxcSelect label="Hovered" value="1" options={one_option} placeholder="Choose an option" />
|
|
456
|
-
</ExampleContainer>
|
|
457
|
-
);
|
|
458
|
-
const SelectedOptionActived = () => (
|
|
459
|
-
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
460
|
-
<Title title="Actived Selected Option" theme="light" level={4} />
|
|
461
|
-
<DxcSelect label="Actived" value="1" options={one_option} placeholder="Choose an option" />
|
|
462
|
-
</ExampleContainer>
|
|
463
|
-
);
|
|
532
|
+
|
|
464
533
|
const MultipleSearchable = () => (
|
|
465
534
|
<ExampleContainer expanded>
|
|
466
535
|
<Title title="Searchable multiple select with value" theme="light" level={4} />
|
|
@@ -468,18 +537,26 @@ const MultipleSearchable = () => (
|
|
|
468
537
|
label="Select Label"
|
|
469
538
|
searchable
|
|
470
539
|
multiple
|
|
471
|
-
|
|
540
|
+
defaultValue={["1", "4"]}
|
|
472
541
|
options={single_options}
|
|
473
542
|
placeholder="Choose an option"
|
|
474
543
|
/>
|
|
475
544
|
</ExampleContainer>
|
|
476
545
|
);
|
|
477
|
-
|
|
478
|
-
|
|
546
|
+
|
|
547
|
+
export const Chromatic = Select.bind({});
|
|
548
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
549
|
+
const canvas = within(canvasElement);
|
|
550
|
+
await userEvent.click(canvas.getAllByRole("combobox")[24]);
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
export const ListboxStates = SelectListbox.bind({});
|
|
554
|
+
ListboxStates.play = async ({ canvasElement }) => {
|
|
479
555
|
const canvas = within(canvasElement);
|
|
480
556
|
const select = canvas.getByRole("combobox");
|
|
481
557
|
await userEvent.click(select);
|
|
482
558
|
};
|
|
559
|
+
|
|
483
560
|
export const Searchable = SearchableSelect.bind({});
|
|
484
561
|
Searchable.play = async ({ canvasElement }) => {
|
|
485
562
|
const canvas = within(canvasElement);
|
|
@@ -488,14 +565,15 @@ Searchable.play = async ({ canvasElement }) => {
|
|
|
488
565
|
userEvent.type(canvas.getByRole("combobox"), "r");
|
|
489
566
|
});
|
|
490
567
|
};
|
|
491
|
-
|
|
492
|
-
|
|
568
|
+
|
|
569
|
+
export const SearchableWithValue = SearchValue.bind({});
|
|
570
|
+
SearchableWithValue.play = async ({ canvasElement }) => {
|
|
493
571
|
const canvas = within(canvasElement);
|
|
494
572
|
await userEvent.click(canvas.getByRole("combobox"));
|
|
495
573
|
};
|
|
496
574
|
|
|
497
|
-
export const
|
|
498
|
-
|
|
575
|
+
export const MultipleSearchableWithValue = MultipleSearchable.bind({});
|
|
576
|
+
MultipleSearchableWithValue.play = async ({ canvasElement }) => {
|
|
499
577
|
const canvas = within(canvasElement);
|
|
500
578
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
501
579
|
};
|
|
@@ -507,75 +585,42 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
|
507
585
|
await userEvent.click(select);
|
|
508
586
|
};
|
|
509
587
|
|
|
510
|
-
export const
|
|
511
|
-
|
|
588
|
+
export const MultipleOptionsDisplayed = MultipleSelect.bind({});
|
|
589
|
+
MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
512
590
|
const canvas = within(canvasElement);
|
|
513
591
|
await userEvent.click(canvas.getAllByRole("combobox")[0]);
|
|
514
592
|
};
|
|
515
593
|
|
|
516
|
-
export const
|
|
517
|
-
|
|
518
|
-
const canvas = within(canvasElement);
|
|
519
|
-
const select = canvas.getByRole("combobox");
|
|
520
|
-
await userEvent.click(select);
|
|
521
|
-
};
|
|
522
|
-
export const SelectWithIconsDisplayed = SelectWithIcons.bind({});
|
|
523
|
-
SelectWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
594
|
+
export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
|
|
595
|
+
MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
|
|
524
596
|
const canvas = within(canvasElement);
|
|
525
597
|
const select = canvas.getByRole("combobox");
|
|
526
598
|
await userEvent.click(select);
|
|
527
599
|
};
|
|
528
600
|
|
|
529
|
-
export const
|
|
530
|
-
|
|
531
|
-
const canvas = within(canvasElement);
|
|
532
|
-
const select = canvas.getByRole("combobox");
|
|
533
|
-
await userEvent.click(select);
|
|
534
|
-
};
|
|
535
|
-
export const SelectMultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
536
|
-
SelectMultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
601
|
+
export const WithIconsDisplayed = SelectWithIcons.bind({});
|
|
602
|
+
WithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
537
603
|
const canvas = within(canvasElement);
|
|
538
604
|
const select = canvas.getByRole("combobox");
|
|
539
605
|
await userEvent.click(select);
|
|
540
606
|
};
|
|
541
607
|
|
|
542
|
-
export const
|
|
543
|
-
|
|
608
|
+
export const WithRescaledIconsDisplayed = RescaledIcons.bind({});
|
|
609
|
+
WithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
|
|
544
610
|
const canvas = within(canvasElement);
|
|
545
611
|
const select = canvas.getByRole("combobox");
|
|
546
612
|
await userEvent.click(select);
|
|
547
613
|
};
|
|
548
614
|
|
|
549
|
-
export const
|
|
550
|
-
|
|
615
|
+
export const MultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
|
|
616
|
+
MultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
551
617
|
const canvas = within(canvasElement);
|
|
552
618
|
const select = canvas.getByRole("combobox");
|
|
553
619
|
await userEvent.click(select);
|
|
554
620
|
};
|
|
555
621
|
|
|
556
|
-
export const
|
|
557
|
-
|
|
558
|
-
const canvas = within(canvasElement);
|
|
559
|
-
const select = canvas.getByRole("combobox");
|
|
560
|
-
await userEvent.click(select);
|
|
561
|
-
await waitFor(async () => {
|
|
562
|
-
fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
|
|
563
|
-
});
|
|
564
|
-
};
|
|
565
|
-
export const OptionActived = OnlyOneOptionActived.bind({});
|
|
566
|
-
OptionActived.play = async ({ canvasElement }) => {
|
|
567
|
-
const canvas = within(canvasElement);
|
|
568
|
-
const select = canvas.getByRole("combobox");
|
|
569
|
-
await userEvent.click(select);
|
|
570
|
-
};
|
|
571
|
-
export const OptionSelectedHovered = SelectedOptionHovered.bind({});
|
|
572
|
-
OptionSelectedHovered.play = async ({ canvasElement }) => {
|
|
573
|
-
const canvas = within(canvasElement);
|
|
574
|
-
const select = canvas.getByRole("combobox");
|
|
575
|
-
await userEvent.click(select);
|
|
576
|
-
};
|
|
577
|
-
export const OptionSelectedActived = SelectedOptionActived.bind({});
|
|
578
|
-
OptionSelectedActived.play = async ({ canvasElement }) => {
|
|
622
|
+
export const MultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
|
|
623
|
+
MultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
|
|
579
624
|
const canvas = within(canvasElement);
|
|
580
625
|
const select = canvas.getByRole("combobox");
|
|
581
626
|
await userEvent.click(select);
|