@dxc-technology/halstack-react 0.0.0-64fdce7 → 0.0.0-6501724

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 (175) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +1 -1
  3. package/HalstackContext.d.ts +1329 -5
  4. package/HalstackContext.js +113 -72
  5. package/accordion/Accordion.js +6 -11
  6. package/accordion/Accordion.stories.tsx +52 -3
  7. package/accordion/Accordion.test.js +1 -1
  8. package/accordion/types.d.ts +3 -3
  9. package/accordion-group/AccordionGroup.d.ts +4 -3
  10. package/accordion-group/AccordionGroup.js +23 -44
  11. package/accordion-group/AccordionGroup.test.js +1 -1
  12. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  13. package/accordion-group/AccordionGroupAccordion.js +43 -0
  14. package/accordion-group/types.d.ts +2 -2
  15. package/alert/Alert.js +4 -8
  16. package/alert/Alert.stories.tsx +28 -0
  17. package/alert/Alert.test.js +1 -1
  18. package/bleed/Bleed.stories.tsx +1 -0
  19. package/box/Box.js +3 -5
  20. package/box/Box.stories.tsx +15 -0
  21. package/box/Box.test.js +1 -1
  22. package/bulleted-list/BulletedList.js +4 -2
  23. package/bulleted-list/BulletedList.stories.tsx +7 -1
  24. package/bulleted-list/types.d.ts +31 -4
  25. package/button/Button.js +2 -3
  26. package/button/Button.stories.tsx +95 -10
  27. package/button/Button.test.js +1 -1
  28. package/button/types.d.ts +3 -3
  29. package/card/Card.js +12 -13
  30. package/card/Card.stories.tsx +12 -13
  31. package/card/Card.test.js +1 -1
  32. package/checkbox/Checkbox.js +3 -3
  33. package/checkbox/Checkbox.stories.tsx +52 -0
  34. package/checkbox/Checkbox.test.js +1 -1
  35. package/checkbox/types.d.ts +2 -2
  36. package/chip/Chip.js +25 -34
  37. package/chip/Chip.stories.tsx +80 -17
  38. package/chip/Chip.test.js +3 -5
  39. package/common/OpenSans.css +68 -80
  40. package/common/coreTokens.d.ts +146 -0
  41. package/common/coreTokens.js +167 -0
  42. package/common/utils.d.ts +1 -0
  43. package/common/utils.js +4 -4
  44. package/common/variables.d.ts +1482 -0
  45. package/common/variables.js +962 -1123
  46. package/date-input/DateInput.stories.tsx +67 -0
  47. package/dialog/Dialog.d.ts +1 -1
  48. package/dialog/Dialog.js +55 -86
  49. package/dialog/Dialog.stories.tsx +145 -217
  50. package/dialog/Dialog.test.js +302 -3
  51. package/dialog/types.d.ts +0 -13
  52. package/dropdown/Dropdown.js +2 -2
  53. package/dropdown/Dropdown.stories.tsx +46 -1
  54. package/dropdown/Dropdown.test.js +3 -2
  55. package/dropdown/DropdownMenu.js +5 -1
  56. package/dropdown/DropdownMenuItem.js +0 -2
  57. package/dropdown/types.d.ts +3 -3
  58. package/file-input/FileInput.js +4 -8
  59. package/file-input/FileInput.stories.tsx +85 -2
  60. package/file-input/FileInput.test.js +1 -42
  61. package/file-input/FileItem.js +1 -0
  62. package/flex/Flex.js +4 -2
  63. package/flex/Flex.stories.tsx +35 -26
  64. package/flex/types.d.ts +70 -5
  65. package/footer/Footer.js +6 -8
  66. package/footer/Footer.stories.tsx +91 -0
  67. package/footer/Footer.test.js +14 -26
  68. package/grid/Grid.d.ts +7 -0
  69. package/grid/Grid.js +91 -0
  70. package/grid/Grid.stories.tsx +219 -0
  71. package/grid/types.d.ts +115 -0
  72. package/header/Header.d.ts +3 -2
  73. package/header/Header.js +3 -3
  74. package/header/Header.stories.tsx +115 -5
  75. package/header/Header.test.js +2 -2
  76. package/header/types.d.ts +2 -2
  77. package/heading/Heading.js +1 -1
  78. package/heading/Heading.test.js +1 -1
  79. package/inset/Inset.stories.tsx +2 -1
  80. package/layout/ApplicationLayout.d.ts +3 -3
  81. package/layout/ApplicationLayout.js +1 -1
  82. package/layout/types.d.ts +2 -3
  83. package/link/Link.js +3 -3
  84. package/link/Link.stories.tsx +60 -0
  85. package/link/Link.test.js +2 -4
  86. package/link/types.d.ts +2 -2
  87. package/main.d.ts +3 -2
  88. package/main.js +9 -1
  89. package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
  90. package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
  91. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +103 -1
  92. package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
  93. package/{tabs-nav → nav-tabs}/Tab.js +47 -29
  94. package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
  95. package/nav-tabs/types.js +5 -0
  96. package/number-input/NumberInput.test.js +1 -1
  97. package/package.json +2 -2
  98. package/paginator/Paginator.js +2 -4
  99. package/paginator/Paginator.stories.tsx +24 -0
  100. package/paginator/Paginator.test.js +40 -37
  101. package/paragraph/Paragraph.d.ts +3 -4
  102. package/paragraph/Paragraph.js +5 -5
  103. package/password-input/PasswordInput.test.js +1 -1
  104. package/progress-bar/ProgressBar.d.ts +2 -2
  105. package/progress-bar/ProgressBar.js +5 -5
  106. package/progress-bar/ProgressBar.stories.jsx +35 -2
  107. package/progress-bar/ProgressBar.test.js +1 -1
  108. package/progress-bar/types.d.ts +4 -3
  109. package/quick-nav/QuickNav.stories.tsx +14 -0
  110. package/radio-group/Radio.js +10 -10
  111. package/radio-group/RadioGroup.js +8 -10
  112. package/radio-group/RadioGroup.stories.tsx +131 -18
  113. package/radio-group/RadioGroup.test.js +1 -1
  114. package/resultsetTable/ResultsetTable.js +2 -2
  115. package/resultsetTable/ResultsetTable.test.js +1 -1
  116. package/resultsetTable/types.d.ts +3 -3
  117. package/select/Select.js +13 -11
  118. package/select/Select.stories.tsx +477 -175
  119. package/select/Select.test.js +59 -59
  120. package/sidenav/Icons.d.ts +7 -0
  121. package/sidenav/Icons.js +51 -0
  122. package/sidenav/Sidenav.d.ts +2 -2
  123. package/sidenav/Sidenav.js +66 -94
  124. package/sidenav/Sidenav.stories.tsx +110 -17
  125. package/sidenav/types.d.ts +21 -18
  126. package/slider/Slider.js +2 -3
  127. package/slider/Slider.stories.tsx +57 -0
  128. package/slider/Slider.test.js +1 -1
  129. package/slider/types.d.ts +2 -2
  130. package/spinner/Spinner.js +15 -21
  131. package/spinner/Spinner.stories.jsx +53 -27
  132. package/spinner/Spinner.test.js +1 -1
  133. package/switch/Switch.js +2 -2
  134. package/switch/Switch.stories.tsx +33 -0
  135. package/switch/Switch.test.js +1 -1
  136. package/switch/types.d.ts +2 -2
  137. package/table/Table.js +2 -2
  138. package/table/Table.stories.jsx +80 -1
  139. package/table/Table.test.js +1 -1
  140. package/tabs/Tab.js +9 -10
  141. package/tabs/Tabs.js +11 -17
  142. package/tabs/Tabs.stories.tsx +38 -0
  143. package/tabs/Tabs.test.js +4 -5
  144. package/tabs/types.d.ts +2 -2
  145. package/tag/Tag.js +7 -9
  146. package/tag/Tag.stories.tsx +14 -1
  147. package/tag/Tag.test.js +1 -1
  148. package/text-input/Suggestion.js +2 -2
  149. package/text-input/TextInput.js +4 -4
  150. package/text-input/TextInput.stories.tsx +69 -1
  151. package/text-input/TextInput.test.js +1 -2
  152. package/textarea/Textarea.js +3 -4
  153. package/textarea/Textarea.stories.jsx +60 -1
  154. package/textarea/Textarea.test.js +2 -4
  155. package/toggle-group/ToggleGroup.d.ts +2 -2
  156. package/toggle-group/ToggleGroup.js +7 -4
  157. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  158. package/toggle-group/ToggleGroup.test.js +1 -1
  159. package/toggle-group/types.d.ts +1 -1
  160. package/typography/Typography.d.ts +2 -2
  161. package/typography/Typography.js +14 -113
  162. package/typography/Typography.stories.tsx +1 -1
  163. package/useTheme.d.ts +1234 -1
  164. package/useTheme.js +1 -1
  165. package/useTranslatedLabels.d.ts +84 -1
  166. package/utils/BaseTypography.d.ts +21 -0
  167. package/utils/BaseTypography.js +108 -0
  168. package/utils/FocusLock.d.ts +13 -0
  169. package/utils/FocusLock.js +138 -0
  170. package/wizard/Wizard.js +2 -2
  171. package/wizard/Wizard.stories.tsx +20 -0
  172. package/wizard/Wizard.test.js +1 -1
  173. package/wizard/types.d.ts +5 -6
  174. /package/{tabs-nav → grid}/types.js +0 -0
  175. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
@@ -6,6 +6,7 @@ import DxcSelect from "./Select";
6
6
  import Listbox from "./Listbox";
7
7
  import { ThemeProvider } from "styled-components";
8
8
  import useTheme from "../useTheme";
9
+ import { HalstackProvider } from "../HalstackContext";
9
10
 
10
11
  export default {
11
12
  title: "Select",
@@ -13,12 +14,14 @@ export default {
13
14
  };
14
15
 
15
16
  const one_option = [{ label: "Option 01", value: "1" }];
17
+
16
18
  const single_options = [
17
19
  { label: "Option 01", value: "1" },
18
20
  { label: "Option 02", value: "2" },
19
21
  { label: "Option 03", value: "3" },
20
22
  { label: "Option 04", value: "4" },
21
23
  ];
24
+
22
25
  const group_options = [
23
26
  {
24
27
  label: "Group 001",
@@ -61,6 +64,7 @@ const group_options = [
61
64
  ],
62
65
  },
63
66
  ];
67
+
64
68
  const icon_options_grouped = [
65
69
  {
66
70
  label: "Group 001",
@@ -124,6 +128,7 @@ const icon_options_grouped = [
124
128
  ],
125
129
  },
126
130
  ];
131
+
127
132
  const icon_options = [
128
133
  {
129
134
  label: "3G Mobile",
@@ -172,6 +177,7 @@ const icon_options = [
172
177
  ),
173
178
  },
174
179
  ];
180
+
175
181
  const url_options = [
176
182
  {
177
183
  label: "Social Media",
@@ -241,12 +247,22 @@ const url_options = [
241
247
  ],
242
248
  },
243
249
  ];
250
+
244
251
  const optionsWithEllipsisMedium = [
245
252
  { label: "Optiond1234567890123456789012345678901234", value: "1" },
246
253
  { label: "Optiond12345678901234567890123456789012345", value: "2" },
247
254
  { label: "Option 031111111111111111111111111111222", value: "3" },
248
255
  ];
249
256
 
257
+ const opinionatedTheme = {
258
+ select: {
259
+ selectedOptionBackgroundColor: "#e6f4ff",
260
+ fontColor: "#000000",
261
+ optionFontColor: "#000000",
262
+ hoverBorderColor: "#a46ede",
263
+ },
264
+ };
265
+
250
266
  const Select = () => (
251
267
  <>
252
268
  <Title title="States" theme="light" level={2} />
@@ -369,187 +385,351 @@ const Select = () => (
369
385
  margin={{ top: "xxlarge" }}
370
386
  />
371
387
  </ExampleContainer>
388
+ <Title title="Opinionated theme" theme="light" level={2} />
389
+ <ExampleContainer pseudoState="pseudo-hover">
390
+ <Title title="Hovered" theme="light" level={4} />
391
+ <HalstackProvider theme={opinionatedTheme}>
392
+ <DxcSelect label="Hovered" options={single_options} />
393
+ </HalstackProvider>
394
+ </ExampleContainer>
395
+ <ExampleContainer pseudoState="pseudo-focus-within">
396
+ <Title title="Focused" theme="light" level={4} />
397
+ <HalstackProvider theme={opinionatedTheme}>
398
+ <DxcSelect label="Focused" options={single_options} />
399
+ </HalstackProvider>
400
+ </ExampleContainer>
401
+ <ExampleContainer>
402
+ <Title title="Disabled" theme="light" level={4} />
403
+ <HalstackProvider theme={opinionatedTheme}>
404
+ <DxcSelect label="Disabled" placeholder="Placeholder" disabled options={single_options} />
405
+ </HalstackProvider>
406
+ </ExampleContainer>
407
+ <ExampleContainer>
408
+ <Title title="Disabled with value" theme="light" level={4} />
409
+ <HalstackProvider theme={opinionatedTheme}>
410
+ <DxcSelect label="Disabled with value" disabled options={single_options} defaultValue="1" />
411
+ </HalstackProvider>
412
+ </ExampleContainer>
413
+ <ExampleContainer>
414
+ <Title title="Error" theme="light" level={4} />
415
+ <HalstackProvider theme={opinionatedTheme}>
416
+ <DxcSelect
417
+ label="Label"
418
+ options={single_options}
419
+ error="Error message."
420
+ helperText="Helper text"
421
+ placeholder="Placeholder"
422
+ />
423
+ <ExampleContainer>
424
+ <Title title="Multiple selection" theme="light" level={4} />
425
+ <DxcSelect label="Multiple select" searchable options={single_options} multiple defaultValue={["1", "2"]} />
426
+ </ExampleContainer>
427
+ <ExampleContainer pseudoState="pseudo-hover">
428
+ <Title title="Multiple clear hovered" theme="light" level={4} />
429
+ <DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
430
+ </ExampleContainer>
431
+ <ExampleContainer pseudoState="pseudo-active">
432
+ <Title title="Multiple clear actived" theme="light" level={4} />
433
+ <DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
434
+ </ExampleContainer>
435
+ </HalstackProvider>
436
+ </ExampleContainer>
372
437
  </>
373
438
  );
439
+
374
440
  const SelectListbox = () => {
375
441
  const colorsTheme: any = useTheme();
376
442
 
377
443
  return (
378
- <ThemeProvider theme={colorsTheme.select}>
379
- <Title title="Listbox" theme="light" level={2} />
380
- <ExampleContainer>
381
- <Title
382
- title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
383
- theme="light"
384
- level={3}
385
- />
386
- <div
387
- style={{
388
- position: "relative",
389
- display: "flex",
390
- flexDirection: "column",
391
- gap: "20px",
392
- height: "150px",
393
- width: "min-content",
394
- marginBottom: "100px",
395
- padding: "20px",
396
- border: "1px solid black",
397
- borderRadius: "4px",
398
- overflow: "auto",
399
- zIndex: "1300",
400
- }}
401
- >
402
- <DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
403
- <button style={{ zIndex: "1", width: "100px" }}>Submit</button>
404
- </div>
405
- </ExampleContainer>
406
- <Title title="Listbox option states" theme="light" level={3} />
407
- <ExampleContainer pseudoState="pseudo-hover">
408
- <Title title="Hovered option" theme="light" level={4} />
409
- <Listbox
410
- id="x"
411
- currentValue=""
412
- options={one_option}
413
- visualFocusIndex={-1}
414
- lastOptionIndex={0}
415
- multiple={false}
416
- optional={false}
417
- optionalItem={{ label: "Empty", value: "" }}
418
- searchable={false}
419
- handleOptionOnClick={() => {}}
420
- styles={{ width: 360 }}
421
- />
422
- </ExampleContainer>
423
- <ExampleContainer pseudoState="pseudo-active">
424
- <Title title="Active option" theme="light" level={4} />
425
- <Listbox
426
- id="x"
427
- currentValue=""
428
- options={one_option}
429
- visualFocusIndex={-1}
430
- lastOptionIndex={0}
431
- multiple={false}
432
- optional={false}
433
- optionalItem={{ label: "Empty", value: "" }}
434
- searchable={false}
435
- handleOptionOnClick={() => {}}
436
- styles={{ width: 360 }}
437
- />
438
- </ExampleContainer>
439
- <ExampleContainer>
440
- <Title title="Focused option" theme="light" level={4} />
441
- <Listbox
442
- id="x"
443
- currentValue=""
444
- options={one_option}
445
- visualFocusIndex={0}
446
- lastOptionIndex={0}
447
- multiple={false}
448
- optional={false}
449
- optionalItem={{ label: "Empty", value: "" }}
450
- searchable={false}
451
- handleOptionOnClick={() => {}}
452
- styles={{ width: 360 }}
453
- />
454
- </ExampleContainer>
455
- <ExampleContainer pseudoState="pseudo-hover">
456
- <Title title="Hovered selected option" theme="light" level={4} />
457
- <Listbox
458
- id="x"
459
- currentValue="1"
460
- options={single_options}
461
- visualFocusIndex={-1}
462
- lastOptionIndex={3}
463
- multiple={false}
464
- optional={false}
465
- optionalItem={{ label: "Empty", value: "" }}
466
- searchable={false}
467
- handleOptionOnClick={() => {}}
468
- styles={{ width: 360 }}
469
- />
470
- </ExampleContainer>
471
- <ExampleContainer pseudoState="pseudo-active">
472
- <Title title="Active selected option" theme="light" level={4} />
473
- <Listbox
474
- id="x"
475
- currentValue="2"
476
- options={single_options}
477
- visualFocusIndex={0}
478
- lastOptionIndex={3}
479
- multiple={false}
480
- optional={false}
481
- optionalItem={{ label: "Empty", value: "" }}
482
- searchable={false}
483
- handleOptionOnClick={() => {}}
484
- styles={{ width: 360 }}
485
- />
486
- </ExampleContainer>
487
- <Title title="Listbox with icons" theme="light" level={3} />
488
- <ExampleContainer>
489
- <Title title="Icons (SVGs)" theme="light" level={4} />
490
- <Listbox
491
- id="x"
492
- currentValue="3"
493
- options={icon_options}
494
- visualFocusIndex={-1}
495
- lastOptionIndex={3}
496
- multiple={false}
497
- optional={false}
498
- optionalItem={{ label: "Empty", value: "" }}
499
- searchable={false}
500
- handleOptionOnClick={() => {}}
501
- styles={{ width: 360 }}
502
- />
503
- </ExampleContainer>
504
- <ExampleContainer>
505
- <Title title="Icons (Images)" theme="light" level={4} />
506
- <Listbox
507
- id="x"
508
- currentValue="facebook"
509
- options={url_options}
510
- visualFocusIndex={-1}
511
- lastOptionIndex={6}
512
- multiple={false}
513
- optional={false}
514
- optionalItem={{ label: "Empty", value: "" }}
515
- searchable={false}
516
- handleOptionOnClick={() => {}}
517
- styles={{ width: 360 }}
518
- />
519
- </ExampleContainer>
520
- <ExampleContainer>
521
- <Title title="Grouped icons (SVGs)" theme="light" level={4} />
522
- <Listbox
523
- id="x"
524
- currentValue={["0", "3"]}
525
- options={icon_options_grouped}
526
- visualFocusIndex={-1}
527
- lastOptionIndex={3}
528
- multiple={false}
529
- optional={false}
530
- optionalItem={{ label: "Empty", value: "" }}
531
- searchable={false}
532
- handleOptionOnClick={() => {}}
533
- styles={{ width: 360 }}
534
- />
535
- </ExampleContainer>
536
- <ExampleContainer>
537
- <Title title="Grouped icons (Images)" theme="light" level={4} />
538
- <Listbox
539
- id="x"
540
- currentValue={["facebook", "figma"]}
541
- options={url_options}
542
- visualFocusIndex={-1}
543
- lastOptionIndex={6}
544
- multiple={true}
545
- optional={false}
546
- optionalItem={{ label: "Empty", value: "" }}
547
- searchable={false}
548
- handleOptionOnClick={() => {}}
549
- styles={{ width: 360 }}
550
- />
551
- </ExampleContainer>
552
- </ThemeProvider>
444
+ <>
445
+ <ThemeProvider theme={colorsTheme.select}>
446
+ <Title title="Listbox" theme="light" level={2} />
447
+ <ExampleContainer>
448
+ <Title
449
+ title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
450
+ theme="light"
451
+ level={3}
452
+ />
453
+ <div
454
+ style={{
455
+ position: "relative",
456
+ display: "flex",
457
+ flexDirection: "column",
458
+ gap: "20px",
459
+ height: "150px",
460
+ width: "min-content",
461
+ marginBottom: "100px",
462
+ padding: "20px",
463
+ border: "1px solid black",
464
+ borderRadius: "4px",
465
+ overflow: "auto",
466
+ zIndex: "1300",
467
+ }}
468
+ >
469
+ <DxcSelect label="Label" options={single_options} optional placeholder="Choose an option" />
470
+ <button style={{ zIndex: "1", width: "100px" }}>Submit</button>
471
+ </div>
472
+ </ExampleContainer>
473
+ <Title title="Listbox option states" theme="light" level={3} />
474
+ <ExampleContainer pseudoState="pseudo-hover">
475
+ <Title title="Hovered option" theme="light" level={4} />
476
+ <Listbox
477
+ id="x"
478
+ currentValue=""
479
+ options={one_option}
480
+ visualFocusIndex={-1}
481
+ lastOptionIndex={0}
482
+ multiple={false}
483
+ optional={false}
484
+ optionalItem={{ label: "Empty", value: "" }}
485
+ searchable={false}
486
+ handleOptionOnClick={() => {}}
487
+ styles={{ width: 360 }}
488
+ />
489
+ </ExampleContainer>
490
+ <ExampleContainer pseudoState="pseudo-active">
491
+ <Title title="Active option" theme="light" level={4} />
492
+ <Listbox
493
+ id="x"
494
+ currentValue=""
495
+ options={one_option}
496
+ visualFocusIndex={-1}
497
+ lastOptionIndex={0}
498
+ multiple={false}
499
+ optional={false}
500
+ optionalItem={{ label: "Empty", value: "" }}
501
+ searchable={false}
502
+ handleOptionOnClick={() => {}}
503
+ styles={{ width: 360 }}
504
+ />
505
+ </ExampleContainer>
506
+ <ExampleContainer>
507
+ <Title title="Focused option" theme="light" level={4} />
508
+ <Listbox
509
+ id="x"
510
+ currentValue=""
511
+ options={one_option}
512
+ visualFocusIndex={0}
513
+ lastOptionIndex={0}
514
+ multiple={false}
515
+ optional={false}
516
+ optionalItem={{ label: "Empty", value: "" }}
517
+ searchable={false}
518
+ handleOptionOnClick={() => {}}
519
+ styles={{ width: 360 }}
520
+ />
521
+ </ExampleContainer>
522
+ <ExampleContainer pseudoState="pseudo-hover">
523
+ <Title title="Hovered selected option" theme="light" level={4} />
524
+ <Listbox
525
+ id="x"
526
+ currentValue="1"
527
+ options={single_options}
528
+ visualFocusIndex={-1}
529
+ lastOptionIndex={3}
530
+ multiple={false}
531
+ optional={false}
532
+ optionalItem={{ label: "Empty", value: "" }}
533
+ searchable={false}
534
+ handleOptionOnClick={() => {}}
535
+ styles={{ width: 360 }}
536
+ />
537
+ </ExampleContainer>
538
+ <ExampleContainer pseudoState="pseudo-active">
539
+ <Title title="Active selected option" theme="light" level={4} />
540
+ <Listbox
541
+ id="x"
542
+ currentValue="2"
543
+ options={single_options}
544
+ visualFocusIndex={0}
545
+ lastOptionIndex={3}
546
+ multiple={false}
547
+ optional={false}
548
+ optionalItem={{ label: "Empty", value: "" }}
549
+ searchable={false}
550
+ handleOptionOnClick={() => {}}
551
+ styles={{ width: 360 }}
552
+ />
553
+ </ExampleContainer>
554
+ <Title title="Listbox with icons" theme="light" level={3} />
555
+ <ExampleContainer>
556
+ <Title title="Icons (SVGs)" theme="light" level={4} />
557
+ <Listbox
558
+ id="x"
559
+ currentValue="3"
560
+ options={icon_options}
561
+ visualFocusIndex={-1}
562
+ lastOptionIndex={3}
563
+ multiple={false}
564
+ optional={false}
565
+ optionalItem={{ label: "Empty", value: "" }}
566
+ searchable={false}
567
+ handleOptionOnClick={() => {}}
568
+ styles={{ width: 360 }}
569
+ />
570
+ </ExampleContainer>
571
+ <ExampleContainer>
572
+ <Title title="Icons (Images)" theme="light" level={4} />
573
+ <Listbox
574
+ id="x"
575
+ currentValue="facebook"
576
+ options={url_options}
577
+ visualFocusIndex={-1}
578
+ lastOptionIndex={6}
579
+ multiple={false}
580
+ optional={false}
581
+ optionalItem={{ label: "Empty", value: "" }}
582
+ searchable={false}
583
+ handleOptionOnClick={() => {}}
584
+ styles={{ width: 360 }}
585
+ />
586
+ </ExampleContainer>
587
+ <ExampleContainer>
588
+ <Title title="Grouped icons (SVGs)" theme="light" level={4} />
589
+ <Listbox
590
+ id="x"
591
+ currentValue={["0", "3"]}
592
+ options={icon_options_grouped}
593
+ visualFocusIndex={-1}
594
+ lastOptionIndex={3}
595
+ multiple={false}
596
+ optional={false}
597
+ optionalItem={{ label: "Empty", value: "" }}
598
+ searchable={false}
599
+ handleOptionOnClick={() => {}}
600
+ styles={{ width: 360 }}
601
+ />
602
+ </ExampleContainer>
603
+ <ExampleContainer>
604
+ <Title title="Grouped icons (Images)" theme="light" level={4} />
605
+ <Listbox
606
+ id="x"
607
+ currentValue={["facebook", "figma"]}
608
+ options={url_options}
609
+ visualFocusIndex={-1}
610
+ lastOptionIndex={6}
611
+ multiple={true}
612
+ optional={false}
613
+ optionalItem={{ label: "Empty", value: "" }}
614
+ searchable={false}
615
+ handleOptionOnClick={() => {}}
616
+ styles={{ width: 360 }}
617
+ />
618
+ </ExampleContainer>
619
+ </ThemeProvider>
620
+ <ThemeProvider theme={colorsTheme.select}>
621
+ <Title title="Opinionated theme" theme="light" level={2} />
622
+ <ExampleContainer pseudoState="pseudo-hover">
623
+ <Title title="Hovered option" theme="light" level={4} />
624
+ <HalstackProvider theme={opinionatedTheme}>
625
+ <Listbox
626
+ id="x"
627
+ currentValue=""
628
+ options={one_option}
629
+ visualFocusIndex={-1}
630
+ lastOptionIndex={0}
631
+ multiple={false}
632
+ optional={false}
633
+ optionalItem={{ label: "Empty", value: "" }}
634
+ searchable={false}
635
+ handleOptionOnClick={() => {}}
636
+ styles={{ width: 360 }}
637
+ />
638
+ </HalstackProvider>
639
+ </ExampleContainer>
640
+ <ExampleContainer pseudoState="pseudo-active">
641
+ <Title title="Active option" theme="light" level={4} />{" "}
642
+ <HalstackProvider theme={opinionatedTheme}>
643
+ <Listbox
644
+ id="x"
645
+ currentValue=""
646
+ options={one_option}
647
+ visualFocusIndex={-1}
648
+ lastOptionIndex={0}
649
+ multiple={false}
650
+ optional={false}
651
+ optionalItem={{ label: "Empty", value: "" }}
652
+ searchable={false}
653
+ handleOptionOnClick={() => {}}
654
+ styles={{ width: 360 }}
655
+ />
656
+ </HalstackProvider>
657
+ </ExampleContainer>
658
+ <ExampleContainer>
659
+ <Title title="Focused option" theme="light" level={4} />{" "}
660
+ <HalstackProvider theme={opinionatedTheme}>
661
+ <Listbox
662
+ id="x"
663
+ currentValue=""
664
+ options={one_option}
665
+ visualFocusIndex={0}
666
+ lastOptionIndex={0}
667
+ multiple={false}
668
+ optional={false}
669
+ optionalItem={{ label: "Empty", value: "" }}
670
+ searchable={false}
671
+ handleOptionOnClick={() => {}}
672
+ styles={{ width: 360 }}
673
+ />
674
+ </HalstackProvider>
675
+ </ExampleContainer>
676
+ <ExampleContainer pseudoState="pseudo-hover">
677
+ <Title title="Hovered selected option" theme="light" level={4} />{" "}
678
+ <HalstackProvider theme={opinionatedTheme}>
679
+ <Listbox
680
+ id="x"
681
+ currentValue="1"
682
+ options={single_options}
683
+ visualFocusIndex={-1}
684
+ lastOptionIndex={3}
685
+ multiple={false}
686
+ optional={false}
687
+ optionalItem={{ label: "Empty", value: "" }}
688
+ searchable={false}
689
+ handleOptionOnClick={() => {}}
690
+ styles={{ width: 360 }}
691
+ />
692
+ </HalstackProvider>
693
+ </ExampleContainer>
694
+ <ExampleContainer pseudoState="pseudo-active">
695
+ <Title title="Active selected option" theme="light" level={4} />{" "}
696
+ <HalstackProvider theme={opinionatedTheme}>
697
+ <Listbox
698
+ id="x"
699
+ currentValue="2"
700
+ options={single_options}
701
+ visualFocusIndex={0}
702
+ lastOptionIndex={3}
703
+ multiple={false}
704
+ optional={false}
705
+ optionalItem={{ label: "Empty", value: "" }}
706
+ searchable={false}
707
+ handleOptionOnClick={() => {}}
708
+ styles={{ width: 360 }}
709
+ />
710
+ </HalstackProvider>
711
+ </ExampleContainer>
712
+ <Title title="Listbox with icons" theme="light" level={3} />
713
+ <ExampleContainer>
714
+ <Title title="Icons (SVGs)" theme="light" level={4} />{" "}
715
+ <HalstackProvider theme={opinionatedTheme}>
716
+ <Listbox
717
+ id="x"
718
+ currentValue="3"
719
+ options={icon_options}
720
+ visualFocusIndex={-1}
721
+ lastOptionIndex={3}
722
+ multiple={false}
723
+ optional={false}
724
+ optionalItem={{ label: "Empty", value: "" }}
725
+ searchable={false}
726
+ handleOptionOnClick={() => {}}
727
+ styles={{ width: 360 }}
728
+ />
729
+ </HalstackProvider>
730
+ </ExampleContainer>
731
+ </ThemeProvider>
732
+ </>
553
733
  );
554
734
  };
555
735
 
@@ -559,6 +739,16 @@ const SearchableSelect = () => (
559
739
  <DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
560
740
  </ExampleContainer>
561
741
  );
742
+
743
+ const SearchableSelectOpinionated = () => (
744
+ <ExampleContainer expanded>
745
+ <Title title="Searchable select" theme="light" level={4} />
746
+ <HalstackProvider theme={opinionatedTheme}>
747
+ <DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
748
+ </HalstackProvider>
749
+ </ExampleContainer>
750
+ );
751
+
562
752
  const SearchValue = () => (
563
753
  <ExampleContainer expanded>
564
754
  <Title title="Searchable select with value" theme="light" level={4} />
@@ -571,6 +761,22 @@ const SearchValue = () => (
571
761
  />
572
762
  </ExampleContainer>
573
763
  );
764
+
765
+ const SearchValueOpinionated = () => (
766
+ <ExampleContainer expanded>
767
+ <Title title="Searchable select with value" theme="light" level={4} />
768
+ <HalstackProvider theme={opinionatedTheme}>
769
+ <DxcSelect
770
+ label="Select Label"
771
+ searchable
772
+ defaultValue="1"
773
+ options={single_options}
774
+ placeholder="Choose an option"
775
+ />
776
+ </HalstackProvider>
777
+ </ExampleContainer>
778
+ );
779
+
574
780
  const MultipleSelect = () => (
575
781
  <>
576
782
  <ExampleContainer expanded>
@@ -585,12 +791,38 @@ const MultipleSelect = () => (
585
791
  </ExampleContainer>
586
792
  </>
587
793
  );
794
+
795
+ const MultipleSelectOpinioated = () => (
796
+ <ExampleContainer expanded>
797
+ <Title title="Multiple select" theme="light" level={4} />
798
+ <HalstackProvider theme={opinionatedTheme}>
799
+ <DxcSelect
800
+ label="Select label"
801
+ options={single_options}
802
+ defaultValue={["1", "4"]}
803
+ multiple
804
+ placeholder="Choose an option"
805
+ />
806
+ </HalstackProvider>
807
+ </ExampleContainer>
808
+ );
809
+
588
810
  const DefaultGroupedOptionsSelect = () => (
589
811
  <ExampleContainer expanded>
590
812
  <Title title="Grouped options simple select" theme="light" level={4} />
591
813
  <DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
592
814
  </ExampleContainer>
593
815
  );
816
+
817
+ const DefaultGroupedOptionsSelectOpinionated = () => (
818
+ <ExampleContainer expanded>
819
+ <Title title="Grouped options simple select" theme="light" level={4} />
820
+ <HalstackProvider theme={opinionatedTheme}>
821
+ <DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
822
+ </HalstackProvider>
823
+ </ExampleContainer>
824
+ );
825
+
594
826
  const MultipleGroupedOptionsSelect = () => (
595
827
  <ExampleContainer expanded>
596
828
  <Title title="Grouped options multiple select" theme="light" level={4} />
@@ -603,6 +835,22 @@ const MultipleGroupedOptionsSelect = () => (
603
835
  />
604
836
  </ExampleContainer>
605
837
  );
838
+
839
+ const MultipleGroupedOptionsSelectOpinionated = () => (
840
+ <ExampleContainer expanded>
841
+ <Title title="Grouped options multiple select" theme="light" level={4} />
842
+ <HalstackProvider theme={opinionatedTheme}>
843
+ <DxcSelect
844
+ label="Label"
845
+ options={group_options}
846
+ defaultValue={["0", "2"]}
847
+ multiple
848
+ placeholder="Choose an option"
849
+ />
850
+ </HalstackProvider>
851
+ </ExampleContainer>
852
+ );
853
+
606
854
  const MultipleSearchable = () => (
607
855
  <ExampleContainer expanded>
608
856
  <Title title="Searchable multiple select with value" theme="light" level={4} />
@@ -617,6 +865,22 @@ const MultipleSearchable = () => (
617
865
  </ExampleContainer>
618
866
  );
619
867
 
868
+ const MultipleSearchableOpinionated = () => (
869
+ <ExampleContainer expanded>
870
+ <Title title="Searchable multiple select with value" theme="light" level={4} />
871
+ <HalstackProvider theme={opinionatedTheme}>
872
+ <DxcSelect
873
+ label="Select Label"
874
+ searchable
875
+ multiple
876
+ defaultValue={["1", "4"]}
877
+ options={single_options}
878
+ placeholder="Choose an option"
879
+ />
880
+ </HalstackProvider>
881
+ </ExampleContainer>
882
+ );
883
+
620
884
  export const Chromatic = Select.bind({});
621
885
  Chromatic.play = async ({ canvasElement }) => {
622
886
  const canvas = within(canvasElement);
@@ -636,18 +900,36 @@ Searchable.play = async ({ canvasElement }) => {
636
900
  await userEvent.type(canvas.getByRole("combobox"), "r");
637
901
  };
638
902
 
903
+ export const SearchableOpinionated = SearchableSelectOpinionated.bind({});
904
+ SearchableOpinionated.play = async ({ canvasElement }) => {
905
+ const canvas = within(canvasElement);
906
+ await userEvent.type(canvas.getByRole("combobox"), "r");
907
+ };
908
+
639
909
  export const SearchableWithValue = SearchValue.bind({});
640
910
  SearchableWithValue.play = async ({ canvasElement }) => {
641
911
  const canvas = within(canvasElement);
642
912
  await userEvent.click(canvas.getByRole("combobox"));
643
913
  };
644
914
 
915
+ export const SearchableWithValueOpinionated = SearchValueOpinionated.bind({});
916
+ SearchableWithValueOpinionated.play = async ({ canvasElement }) => {
917
+ const canvas = within(canvasElement);
918
+ await userEvent.click(canvas.getByRole("combobox"));
919
+ };
920
+
645
921
  export const MultipleSearchableWithValue = MultipleSearchable.bind({});
646
922
  MultipleSearchableWithValue.play = async ({ canvasElement }) => {
647
923
  const canvas = within(canvasElement);
648
924
  await userEvent.click(canvas.getAllByRole("combobox")[0]);
649
925
  };
650
926
 
927
+ export const MultipleSearchableWithValueOpinionated = MultipleSearchableOpinionated.bind({});
928
+ MultipleSearchableWithValueOpinionated.play = async ({ canvasElement }) => {
929
+ const canvas = within(canvasElement);
930
+ await userEvent.click(canvas.getAllByRole("combobox")[0]);
931
+ };
932
+
651
933
  export const GroupOptionsDisplayed = DefaultGroupedOptionsSelect.bind({});
652
934
  GroupOptionsDisplayed.play = async ({ canvasElement }) => {
653
935
  const canvas = within(canvasElement);
@@ -655,15 +937,35 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
655
937
  await userEvent.click(select);
656
938
  };
657
939
 
940
+ export const GroupOptionsDisplayedOpinionated = DefaultGroupedOptionsSelectOpinionated.bind({});
941
+ GroupOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
942
+ const canvas = within(canvasElement);
943
+ const select = canvas.getByRole("combobox");
944
+ await userEvent.click(select);
945
+ };
946
+
658
947
  export const MultipleOptionsDisplayed = MultipleSelect.bind({});
659
948
  MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
660
949
  const canvas = within(canvasElement);
661
950
  await userEvent.click(canvas.getAllByRole("combobox")[0]);
662
951
  };
663
952
 
953
+ export const MultipleOptionsDisplayedOpinionated = MultipleSelectOpinioated.bind({});
954
+ MultipleOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
955
+ const canvas = within(canvasElement);
956
+ await userEvent.click(canvas.getAllByRole("combobox")[0]);
957
+ };
958
+
664
959
  export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
665
960
  MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
666
961
  const canvas = within(canvasElement);
667
962
  const select = canvas.getByRole("combobox");
668
963
  await userEvent.click(select);
669
964
  };
965
+
966
+ export const MultipleGroupedOptionsDisplayedOpinionated = MultipleGroupedOptionsSelectOpinionated.bind({});
967
+ MultipleGroupedOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
968
+ const canvas = within(canvasElement);
969
+ const select = canvas.getByRole("combobox");
970
+ await userEvent.click(select);
971
+ };