@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.
Files changed (205) hide show
  1. package/HalstackContext.js +7 -11
  2. package/accordion/Accordion.js +117 -104
  3. package/accordion/Accordion.stories.tsx +54 -15
  4. package/accordion/Accordion.test.js +9 -10
  5. package/accordion/types.d.ts +5 -4
  6. package/accordion-group/AccordionGroup.js +2 -21
  7. package/accordion-group/AccordionGroup.stories.tsx +27 -1
  8. package/accordion-group/AccordionGroup.test.js +20 -45
  9. package/accordion-group/types.d.ts +10 -3
  10. package/alert/Alert.js +1 -1
  11. package/badge/Badge.d.ts +1 -1
  12. package/badge/Badge.js +5 -3
  13. package/badge/types.d.ts +1 -0
  14. package/bleed/Bleed.js +1 -34
  15. package/bleed/Bleed.stories.tsx +94 -95
  16. package/bleed/types.d.ts +1 -1
  17. package/box/Box.js +23 -33
  18. package/box/types.d.ts +1 -0
  19. package/bulleted-list/BulletedList.d.ts +7 -0
  20. package/bulleted-list/BulletedList.js +123 -0
  21. package/bulleted-list/BulletedList.stories.tsx +200 -0
  22. package/bulleted-list/types.d.ts +11 -0
  23. package/{list → bulleted-list}/types.js +0 -0
  24. package/button/Button.js +50 -70
  25. package/button/Button.stories.tsx +61 -1
  26. package/button/types.d.ts +7 -7
  27. package/card/Card.js +34 -36
  28. package/card/types.d.ts +1 -0
  29. package/checkbox/Checkbox.d.ts +2 -2
  30. package/checkbox/Checkbox.js +92 -99
  31. package/checkbox/Checkbox.stories.tsx +79 -59
  32. package/checkbox/Checkbox.test.js +93 -16
  33. package/checkbox/types.d.ts +6 -2
  34. package/chip/Chip.js +11 -23
  35. package/chip/Chip.stories.tsx +41 -9
  36. package/chip/types.d.ts +1 -1
  37. package/common/variables.js +186 -158
  38. package/date-input/Calendar.d.ts +4 -0
  39. package/date-input/Calendar.js +258 -0
  40. package/date-input/DateInput.js +77 -222
  41. package/date-input/DateInput.stories.tsx +30 -17
  42. package/date-input/DateInput.test.js +411 -138
  43. package/date-input/DatePicker.d.ts +4 -0
  44. package/date-input/DatePicker.js +160 -0
  45. package/date-input/YearPicker.d.ts +4 -0
  46. package/date-input/YearPicker.js +115 -0
  47. package/date-input/types.d.ts +53 -0
  48. package/dialog/Dialog.js +52 -28
  49. package/dialog/Dialog.stories.tsx +57 -2
  50. package/dialog/Dialog.test.js +34 -4
  51. package/dialog/types.d.ts +3 -2
  52. package/dropdown/Dropdown.d.ts +1 -1
  53. package/dropdown/Dropdown.js +247 -249
  54. package/dropdown/Dropdown.stories.tsx +135 -64
  55. package/dropdown/Dropdown.test.js +504 -108
  56. package/dropdown/DropdownMenu.d.ts +4 -0
  57. package/dropdown/DropdownMenu.js +80 -0
  58. package/dropdown/DropdownMenuItem.d.ts +4 -0
  59. package/dropdown/DropdownMenuItem.js +92 -0
  60. package/dropdown/types.d.ts +25 -5
  61. package/file-input/FileInput.d.ts +2 -2
  62. package/file-input/FileInput.js +177 -219
  63. package/file-input/FileInput.stories.tsx +38 -10
  64. package/file-input/FileInput.test.js +53 -12
  65. package/file-input/FileItem.d.ts +4 -14
  66. package/file-input/FileItem.js +38 -63
  67. package/file-input/types.d.ts +17 -0
  68. package/flex/Flex.d.ts +4 -0
  69. package/flex/Flex.js +69 -0
  70. package/flex/Flex.stories.tsx +103 -0
  71. package/flex/types.d.ts +32 -0
  72. package/{radio → flex}/types.js +0 -0
  73. package/footer/Footer.stories.tsx +8 -1
  74. package/footer/Icons.js +1 -1
  75. package/footer/types.d.ts +2 -1
  76. package/header/Header.js +74 -72
  77. package/header/Header.stories.tsx +4 -4
  78. package/header/Icons.js +2 -2
  79. package/header/types.d.ts +3 -2
  80. package/inset/Inset.js +1 -34
  81. package/inset/Inset.stories.tsx +36 -36
  82. package/inset/types.d.ts +1 -1
  83. package/layout/ApplicationLayout.d.ts +16 -6
  84. package/layout/ApplicationLayout.js +70 -117
  85. package/layout/ApplicationLayout.stories.tsx +84 -93
  86. package/layout/Icons.d.ts +5 -0
  87. package/layout/Icons.js +13 -2
  88. package/layout/SidenavContext.d.ts +5 -0
  89. package/layout/SidenavContext.js +19 -0
  90. package/layout/types.d.ts +18 -33
  91. package/link/Link.d.ts +2 -2
  92. package/link/Link.js +24 -50
  93. package/link/Link.stories.tsx +13 -6
  94. package/link/types.d.ts +3 -4
  95. package/main.d.ts +6 -9
  96. package/main.js +32 -56
  97. package/number-input/NumberInput.test.js +43 -7
  98. package/package.json +16 -20
  99. package/paginator/Icons.d.ts +5 -0
  100. package/paginator/Icons.js +16 -28
  101. package/paginator/Paginator.js +6 -12
  102. package/paginator/Paginator.test.js +43 -1
  103. package/paragraph/Paragraph.d.ts +6 -0
  104. package/paragraph/Paragraph.js +38 -0
  105. package/paragraph/Paragraph.stories.tsx +44 -0
  106. package/password-input/PasswordInput.test.js +13 -12
  107. package/progress-bar/ProgressBar.d.ts +2 -2
  108. package/progress-bar/ProgressBar.js +56 -50
  109. package/progress-bar/ProgressBar.stories.jsx +3 -1
  110. package/progress-bar/ProgressBar.test.js +67 -22
  111. package/progress-bar/types.d.ts +3 -4
  112. package/quick-nav/QuickNav.js +25 -20
  113. package/quick-nav/QuickNav.stories.tsx +131 -26
  114. package/radio-group/Radio.d.ts +1 -1
  115. package/radio-group/Radio.js +43 -28
  116. package/radio-group/RadioGroup.js +23 -22
  117. package/radio-group/RadioGroup.stories.tsx +1 -0
  118. package/radio-group/RadioGroup.test.js +123 -96
  119. package/radio-group/types.d.ts +2 -2
  120. package/resultsetTable/Icons.d.ts +7 -0
  121. package/resultsetTable/Icons.js +51 -0
  122. package/resultsetTable/ResultsetTable.js +48 -107
  123. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  124. package/resultsetTable/ResultsetTable.test.js +65 -41
  125. package/resultsetTable/types.d.ts +2 -2
  126. package/select/Listbox.d.ts +1 -1
  127. package/select/Listbox.js +53 -7
  128. package/select/Option.js +8 -10
  129. package/select/Select.js +43 -43
  130. package/select/Select.stories.tsx +225 -136
  131. package/select/Select.test.js +363 -250
  132. package/select/types.d.ts +2 -5
  133. package/sidenav/Sidenav.d.ts +6 -5
  134. package/sidenav/Sidenav.js +182 -52
  135. package/sidenav/Sidenav.stories.tsx +163 -156
  136. package/sidenav/Sidenav.test.js +25 -37
  137. package/sidenav/types.d.ts +50 -27
  138. package/slider/Slider.d.ts +2 -2
  139. package/slider/Slider.js +120 -95
  140. package/slider/Slider.stories.tsx +7 -1
  141. package/slider/Slider.test.js +121 -21
  142. package/slider/types.d.ts +6 -2
  143. package/spinner/Spinner.js +2 -2
  144. package/switch/Switch.d.ts +2 -2
  145. package/switch/Switch.js +135 -68
  146. package/switch/Switch.stories.tsx +8 -30
  147. package/switch/Switch.test.js +144 -17
  148. package/switch/types.d.ts +6 -2
  149. package/table/Table.js +1 -1
  150. package/table/Table.test.js +1 -1
  151. package/tabs/Tab.d.ts +4 -0
  152. package/tabs/Tab.js +133 -0
  153. package/tabs/Tabs.js +360 -104
  154. package/tabs/Tabs.stories.tsx +81 -5
  155. package/tabs/Tabs.test.js +217 -6
  156. package/tabs/types.d.ts +15 -5
  157. package/tabs-nav/NavTabs.d.ts +8 -0
  158. package/tabs-nav/NavTabs.js +125 -0
  159. package/tabs-nav/NavTabs.stories.tsx +172 -0
  160. package/tabs-nav/NavTabs.test.js +82 -0
  161. package/tabs-nav/Tab.d.ts +4 -0
  162. package/tabs-nav/Tab.js +128 -0
  163. package/tabs-nav/types.d.ts +53 -0
  164. package/{row → tabs-nav}/types.js +0 -0
  165. package/tag/Tag.js +1 -1
  166. package/tag/types.d.ts +1 -1
  167. package/text-input/Icons.d.ts +8 -0
  168. package/text-input/Icons.js +60 -0
  169. package/text-input/Suggestion.js +38 -9
  170. package/text-input/Suggestions.d.ts +4 -0
  171. package/text-input/Suggestions.js +134 -0
  172. package/text-input/TextInput.js +195 -292
  173. package/text-input/TextInput.stories.tsx +211 -185
  174. package/text-input/TextInput.test.js +737 -725
  175. package/text-input/types.d.ts +22 -3
  176. package/toggle-group/types.d.ts +1 -1
  177. package/typography/Typography.d.ts +4 -0
  178. package/typography/Typography.js +131 -0
  179. package/typography/Typography.stories.tsx +198 -0
  180. package/typography/types.d.ts +18 -0
  181. package/{stack → typography}/types.js +0 -0
  182. package/wizard/Wizard.js +9 -16
  183. package/wizard/Wizard.stories.tsx +20 -1
  184. package/wizard/types.d.ts +5 -4
  185. package/common/RequiredComponent.js +0 -32
  186. package/list/List.d.ts +0 -4
  187. package/list/List.js +0 -47
  188. package/list/List.stories.tsx +0 -95
  189. package/list/types.d.ts +0 -7
  190. package/radio/Radio.d.ts +0 -4
  191. package/radio/Radio.js +0 -173
  192. package/radio/Radio.stories.tsx +0 -192
  193. package/radio/Radio.test.js +0 -71
  194. package/radio/types.d.ts +0 -54
  195. package/row/Row.d.ts +0 -3
  196. package/row/Row.js +0 -127
  197. package/row/Row.stories.tsx +0 -237
  198. package/row/types.d.ts +0 -28
  199. package/stack/Stack.d.ts +0 -3
  200. package/stack/Stack.js +0 -97
  201. package/stack/Stack.stories.tsx +0 -164
  202. package/stack/types.d.ts +0 -24
  203. package/text/Text.d.ts +0 -7
  204. package/text/Text.js +0 -30
  205. package/text/Text.stories.tsx +0 -19
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
-
3
- import { userEvent, within, waitFor } from "@storybook/testing-library";
4
- import { fireEvent } from "@testing-library/react";
5
-
2
+ import { userEvent, within } from "@storybook/testing-library";
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",
@@ -190,7 +189,29 @@ const url_options = [
190
189
  {
191
190
  label: "Facebook",
192
191
  value: "facebook",
193
- icon: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b8/2021_Facebook_icon.svg/2048px-2021_Facebook_icon.svg.png",
192
+ icon: (
193
+ <svg
194
+ version="1.1"
195
+ id="Capa_1"
196
+ x="0px"
197
+ y="0px"
198
+ width="438.536px"
199
+ height="438.536px"
200
+ viewBox="0 0 438.536 438.536"
201
+ fill="#4267B2"
202
+ >
203
+ <g>
204
+ <path
205
+ d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
206
+ C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
207
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
208
+ C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
209
+ c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
210
+ c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
211
+ />
212
+ </g>
213
+ </svg>
214
+ ),
194
215
  },
195
216
  {
196
217
  label: "Pinterest",
@@ -340,7 +361,7 @@ const Select = () => (
340
361
  <DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
341
362
  <Title title="Value with ellipsis" theme="light" level={4} />
342
363
  <DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" size="medium" />
343
- <Title title="Option with ellipsis" theme="light" level={4} />
364
+ <Title title="Options with ellipsis" theme="light" level={4} />
344
365
  <DxcSelect
345
366
  label="Label"
346
367
  placeholder="Choose an option"
@@ -351,16 +372,181 @@ const Select = () => (
351
372
  </ExampleContainer>
352
373
  </>
353
374
  );
354
- export const Chromatic = Select.bind({});
355
- Chromatic.play = async ({ canvasElement }) => {
356
- const canvas = within(canvasElement);
357
- await userEvent.click(canvas.getAllByRole("combobox")[24]);
358
- };
359
- const DefaultSelect = () => (
360
- <ExampleContainer expanded>
361
- <Title title="Default select" theme="light" level={4} />
362
- <DxcSelect label="Select label" options={single_options} optional placeholder="Choose an option" />
363
- </ExampleContainer>
375
+ const SelectListbox = () => (
376
+ <>
377
+ <Title title="Listbox" theme="light" level={2} />
378
+ <ExampleContainer>
379
+ <Title
380
+ title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
381
+ theme="light"
382
+ level={3}
383
+ />
384
+ <div
385
+ style={{
386
+ display: "flex",
387
+ flexDirection: "column",
388
+ gap: "20px",
389
+ height: "150px",
390
+ width: "min-content",
391
+ marginBottom: "100px",
392
+ padding: "20px",
393
+ border: "1px solid black",
394
+ borderRadius: "4px",
395
+ overflow: "auto",
396
+ zIndex: "1300",
397
+ }}
398
+ >
399
+ <DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
400
+ <button style={{ zIndex: "1", width: "100px" }}>Submit</button>
401
+ </div>
402
+ </ExampleContainer>
403
+ <Title title="Listbox option states" theme="light" level={3} />
404
+ <ExampleContainer pseudoState="pseudo-hover">
405
+ <Title title="Hovered option" theme="light" level={4} />
406
+ <Listbox
407
+ id="x"
408
+ currentValue=""
409
+ options={one_option}
410
+ visualFocusIndex={-1}
411
+ lastOptionIndex={0}
412
+ multiple={false}
413
+ optional={false}
414
+ optionalItem={{ label: "Empty", value: "" }}
415
+ searchable={false}
416
+ handleOptionOnClick={() => {}}
417
+ getSelectWidth={() => 360}
418
+ />
419
+ </ExampleContainer>
420
+ <ExampleContainer pseudoState="pseudo-active">
421
+ <Title title="Active option" theme="light" level={4} />
422
+ <Listbox
423
+ id="x"
424
+ currentValue=""
425
+ options={one_option}
426
+ visualFocusIndex={-1}
427
+ lastOptionIndex={0}
428
+ multiple={false}
429
+ optional={false}
430
+ optionalItem={{ label: "Empty", value: "" }}
431
+ searchable={false}
432
+ handleOptionOnClick={() => {}}
433
+ getSelectWidth={() => 360}
434
+ />
435
+ </ExampleContainer>
436
+ <ExampleContainer>
437
+ <Title title="Focused option" theme="light" level={4} />
438
+ <Listbox
439
+ id="x"
440
+ currentValue=""
441
+ options={one_option}
442
+ visualFocusIndex={0}
443
+ lastOptionIndex={0}
444
+ multiple={false}
445
+ optional={false}
446
+ optionalItem={{ label: "Empty", value: "" }}
447
+ searchable={false}
448
+ handleOptionOnClick={() => {}}
449
+ getSelectWidth={() => 360}
450
+ />
451
+ </ExampleContainer>
452
+ <ExampleContainer pseudoState="pseudo-hover">
453
+ <Title title="Hovered selected option" theme="light" level={4} />
454
+ <Listbox
455
+ id="x"
456
+ currentValue="1"
457
+ options={single_options}
458
+ visualFocusIndex={-1}
459
+ lastOptionIndex={3}
460
+ multiple={false}
461
+ optional={false}
462
+ optionalItem={{ label: "Empty", value: "" }}
463
+ searchable={false}
464
+ handleOptionOnClick={() => {}}
465
+ getSelectWidth={() => 360}
466
+ />
467
+ </ExampleContainer>
468
+ <ExampleContainer pseudoState="pseudo-active">
469
+ <Title title="Active selected option" theme="light" level={4} />
470
+ <Listbox
471
+ id="x"
472
+ currentValue="2"
473
+ options={single_options}
474
+ visualFocusIndex={0}
475
+ lastOptionIndex={3}
476
+ multiple={false}
477
+ optional={false}
478
+ optionalItem={{ label: "Empty", value: "" }}
479
+ searchable={false}
480
+ handleOptionOnClick={() => {}}
481
+ getSelectWidth={() => 360}
482
+ />
483
+ </ExampleContainer>
484
+ <Title title="Listbox with icons" theme="light" level={3} />
485
+ <ExampleContainer>
486
+ <Title title="Icons (SVGs)" theme="light" level={4} />
487
+ <Listbox
488
+ id="x"
489
+ currentValue="3"
490
+ options={icon_options}
491
+ visualFocusIndex={-1}
492
+ lastOptionIndex={3}
493
+ multiple={false}
494
+ optional={false}
495
+ optionalItem={{ label: "Empty", value: "" }}
496
+ searchable={false}
497
+ handleOptionOnClick={() => {}}
498
+ getSelectWidth={() => 360}
499
+ />
500
+ </ExampleContainer>
501
+ <ExampleContainer>
502
+ <Title title="Icons (Images)" theme="light" level={4} />
503
+ <Listbox
504
+ id="x"
505
+ currentValue="facebook"
506
+ options={url_options}
507
+ visualFocusIndex={-1}
508
+ lastOptionIndex={6}
509
+ multiple={false}
510
+ optional={false}
511
+ optionalItem={{ label: "Empty", value: "" }}
512
+ searchable={false}
513
+ handleOptionOnClick={() => {}}
514
+ getSelectWidth={() => 360}
515
+ />
516
+ </ExampleContainer>
517
+ <ExampleContainer>
518
+ <Title title="Grouped icons (SVGs)" theme="light" level={4} />
519
+ <Listbox
520
+ id="x"
521
+ currentValue={["0", "3"]}
522
+ options={icon_options_grouped}
523
+ visualFocusIndex={-1}
524
+ lastOptionIndex={3}
525
+ multiple={false}
526
+ optional={false}
527
+ optionalItem={{ label: "Empty", value: "" }}
528
+ searchable={false}
529
+ handleOptionOnClick={() => {}}
530
+ getSelectWidth={() => 360}
531
+ />
532
+ </ExampleContainer>
533
+ <ExampleContainer>
534
+ <Title title="Grouped icons (Images)" theme="light" level={4} />
535
+ <Listbox
536
+ id="x"
537
+ currentValue={["facebook", "figma"]}
538
+ options={url_options}
539
+ visualFocusIndex={-1}
540
+ lastOptionIndex={6}
541
+ multiple={true}
542
+ optional={false}
543
+ optionalItem={{ label: "Empty", value: "" }}
544
+ searchable={false}
545
+ handleOptionOnClick={() => {}}
546
+ getSelectWidth={() => 360}
547
+ />
548
+ </ExampleContainer>
549
+ </>
364
550
  );
365
551
  const SearchableSelect = () => (
366
552
  <ExampleContainer expanded>
@@ -368,7 +554,7 @@ const SearchableSelect = () => (
368
554
  <DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
369
555
  </ExampleContainer>
370
556
  );
371
- const SearchableWithValue = () => (
557
+ const SearchValue = () => (
372
558
  <ExampleContainer expanded>
373
559
  <Title title="Searchable select with value" theme="light" level={4} />
374
560
  <DxcSelect
@@ -380,7 +566,6 @@ const SearchableWithValue = () => (
380
566
  />
381
567
  </ExampleContainer>
382
568
  );
383
-
384
569
  const MultipleSelect = () => (
385
570
  <>
386
571
  <ExampleContainer expanded>
@@ -413,18 +598,6 @@ const MultipleGroupedOptionsSelect = () => (
413
598
  />
414
599
  </ExampleContainer>
415
600
  );
416
- const RescaledIcons = () => (
417
- <ExampleContainer expanded>
418
- <Title title="Rescaled icons displayed" theme="light" level={4} />
419
- <DxcSelect label="Label" options={url_options} defaultValue="facebook" placeholder="Choose an option" />
420
- </ExampleContainer>
421
- );
422
- const SelectWithIcons = () => (
423
- <ExampleContainer expanded>
424
- <Title title="Normal icons displayed" theme="light" level={4} />
425
- <DxcSelect label="Label" options={icon_options} defaultValue="3" placeholder="Choose an option" />
426
- </ExampleContainer>
427
- );
428
601
  const SelectMultipleWithIcons = () => (
429
602
  <ExampleContainer expanded>
430
603
  <Title title="Multiple select with icons" theme="light" level={4} />
@@ -443,36 +616,7 @@ const MultipleGroupedOptionsSelectWithIcons = () => (
443
616
  />
444
617
  </ExampleContainer>
445
618
  );
446
- const OnlyOneOptionHovered = () => (
447
- <ExampleContainer pseudoState="pseudo-hover" expanded>
448
- <Title title="Hovered Option" theme="light" level={4} />
449
- <DxcSelect label="Hovered" options={one_option} placeholder="Choose an option" />
450
- </ExampleContainer>
451
- );
452
- const OnlyOneOptionFocused = () => (
453
- <ExampleContainer pseudoState="pseudo-focus" expanded>
454
- <Title title="Focused Option" theme="light" level={4} />
455
- <DxcSelect label="Focused" options={one_option} placeholder="Choose an option" />
456
- </ExampleContainer>
457
- );
458
- const OnlyOneOptionActived = () => (
459
- <ExampleContainer pseudoState="pseudo-active" expanded>
460
- <Title title="Actived Option" theme="light" level={4} />
461
- <DxcSelect label="Actived" options={one_option} placeholder="Choose an option" />
462
- </ExampleContainer>
463
- );
464
- const SelectedOptionHovered = () => (
465
- <ExampleContainer pseudoState="pseudo-hover" expanded>
466
- <Title title="Hovered Selected Option" theme="light" level={4} />
467
- <DxcSelect label="Hovered" defaultValue="1" options={one_option} placeholder="Choose an option" />
468
- </ExampleContainer>
469
- );
470
- const SelectedOptionActived = () => (
471
- <ExampleContainer pseudoState="pseudo-active" expanded>
472
- <Title title="Actived Selected Option" theme="light" level={4} />
473
- <DxcSelect label="Actived" defaultValue="1" options={one_option} placeholder="Choose an option" />
474
- </ExampleContainer>
475
- );
619
+
476
620
  const MultipleSearchable = () => (
477
621
  <ExampleContainer expanded>
478
622
  <Title title="Searchable multiple select with value" theme="light" level={4} />
@@ -486,28 +630,34 @@ const MultipleSearchable = () => (
486
630
  />
487
631
  </ExampleContainer>
488
632
  );
489
- export const OptionsDisplayed = DefaultSelect.bind({});
490
- OptionsDisplayed.play = async ({ canvasElement }) => {
633
+
634
+ export const Chromatic = Select.bind({});
635
+ Chromatic.play = async ({ canvasElement }) => {
636
+ const canvas = within(canvasElement);
637
+ await userEvent.click(canvas.getAllByRole("combobox")[24]);
638
+ };
639
+
640
+ export const ListboxStates = SelectListbox.bind({});
641
+ ListboxStates.play = async ({ canvasElement }) => {
491
642
  const canvas = within(canvasElement);
492
643
  const select = canvas.getByRole("combobox");
493
644
  await userEvent.click(select);
494
645
  };
646
+
495
647
  export const Searchable = SearchableSelect.bind({});
496
648
  Searchable.play = async ({ canvasElement }) => {
497
649
  const canvas = within(canvasElement);
498
- await userEvent.click(canvas.getByRole("combobox"));
499
- await waitFor(async () => {
500
- userEvent.type(canvas.getByRole("combobox"), "r");
501
- });
650
+ await userEvent.type(canvas.getByRole("combobox"), "r");
502
651
  };
503
- export const SelectSearchableWithValue = SearchableWithValue.bind({});
504
- SelectSearchableWithValue.play = async ({ canvasElement }) => {
652
+
653
+ export const SearchableWithValue = SearchValue.bind({});
654
+ SearchableWithValue.play = async ({ canvasElement }) => {
505
655
  const canvas = within(canvasElement);
506
656
  await userEvent.click(canvas.getByRole("combobox"));
507
657
  };
508
658
 
509
- export const SelectMultipleSearchableWithValue = MultipleSearchable.bind({});
510
- SelectMultipleSearchableWithValue.play = async ({ canvasElement }) => {
659
+ export const MultipleSearchableWithValue = MultipleSearchable.bind({});
660
+ MultipleSearchableWithValue.play = async ({ canvasElement }) => {
511
661
  const canvas = within(canvasElement);
512
662
  await userEvent.click(canvas.getAllByRole("combobox")[0]);
513
663
  };
@@ -519,75 +669,14 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
519
669
  await userEvent.click(select);
520
670
  };
521
671
 
522
- export const SelectMultipleOptionsDisplayed = MultipleSelect.bind({});
523
- SelectMultipleOptionsDisplayed.play = async ({ canvasElement }) => {
672
+ export const MultipleOptionsDisplayed = MultipleSelect.bind({});
673
+ MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
524
674
  const canvas = within(canvasElement);
525
675
  await userEvent.click(canvas.getAllByRole("combobox")[0]);
526
676
  };
527
677
 
528
- export const SelectMultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
529
- SelectMultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
530
- const canvas = within(canvasElement);
531
- const select = canvas.getByRole("combobox");
532
- await userEvent.click(select);
533
- };
534
- export const SelectWithIconsDisplayed = SelectWithIcons.bind({});
535
- SelectWithIconsDisplayed.play = async ({ canvasElement }) => {
536
- const canvas = within(canvasElement);
537
- const select = canvas.getByRole("combobox");
538
- await userEvent.click(select);
539
- };
540
-
541
- export const SelectWithRescaledIconsDisplayed = RescaledIcons.bind({});
542
- SelectWithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
543
- const canvas = within(canvasElement);
544
- const select = canvas.getByRole("combobox");
545
- await userEvent.click(select);
546
- };
547
- export const SelectMultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
548
- SelectMultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
549
- const canvas = within(canvasElement);
550
- const select = canvas.getByRole("combobox");
551
- await userEvent.click(select);
552
- };
553
-
554
- export const SelectMultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
555
- SelectMultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
556
- const canvas = within(canvasElement);
557
- const select = canvas.getByRole("combobox");
558
- await userEvent.click(select);
559
- };
560
-
561
- export const OptionHovered = OnlyOneOptionHovered.bind({});
562
- OptionHovered.play = async ({ canvasElement }) => {
563
- const canvas = within(canvasElement);
564
- const select = canvas.getByRole("combobox");
565
- await userEvent.click(select);
566
- };
567
-
568
- export const OptionFocused = OnlyOneOptionFocused.bind({});
569
- OptionFocused.play = async ({ canvasElement }) => {
570
- const canvas = within(canvasElement);
571
- const select = canvas.getByRole("combobox");
572
- await userEvent.click(select);
573
- await waitFor(async () => {
574
- fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
575
- });
576
- };
577
- export const OptionActived = OnlyOneOptionActived.bind({});
578
- OptionActived.play = async ({ canvasElement }) => {
579
- const canvas = within(canvasElement);
580
- const select = canvas.getByRole("combobox");
581
- await userEvent.click(select);
582
- };
583
- export const OptionSelectedHovered = SelectedOptionHovered.bind({});
584
- OptionSelectedHovered.play = async ({ canvasElement }) => {
585
- const canvas = within(canvasElement);
586
- const select = canvas.getByRole("combobox");
587
- await userEvent.click(select);
588
- };
589
- export const OptionSelectedActived = SelectedOptionActived.bind({});
590
- OptionSelectedActived.play = async ({ canvasElement }) => {
678
+ export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
679
+ MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
591
680
  const canvas = within(canvasElement);
592
681
  const select = canvas.getByRole("combobox");
593
682
  await userEvent.click(select);