@dxc-technology/halstack-react 0.0.0-dcd93c4 → 0.0.0-dcee34a

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 (200) hide show
  1. package/HalstackContext.js +98 -50
  2. package/accordion/Accordion.js +117 -104
  3. package/accordion/Accordion.stories.tsx +103 -15
  4. package/accordion/Accordion.test.js +9 -10
  5. package/accordion/types.d.ts +5 -4
  6. package/accordion-group/AccordionGroup.js +1 -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/alert/Alert.stories.tsx +28 -0
  12. package/bleed/Bleed.stories.tsx +63 -63
  13. package/box/Box.js +1 -1
  14. package/box/Box.stories.tsx +15 -0
  15. package/box/types.d.ts +1 -0
  16. package/bulleted-list/BulletedList.d.ts +7 -0
  17. package/bulleted-list/BulletedList.js +123 -0
  18. package/bulleted-list/BulletedList.stories.tsx +200 -0
  19. package/bulleted-list/types.d.ts +11 -0
  20. package/button/Button.js +50 -70
  21. package/button/Button.stories.tsx +159 -8
  22. package/button/types.d.ts +7 -7
  23. package/card/types.d.ts +1 -0
  24. package/checkbox/Checkbox.d.ts +2 -2
  25. package/checkbox/Checkbox.js +92 -99
  26. package/checkbox/Checkbox.stories.tsx +131 -59
  27. package/checkbox/Checkbox.test.js +93 -16
  28. package/checkbox/types.d.ts +6 -2
  29. package/chip/Chip.js +16 -22
  30. package/chip/Chip.stories.tsx +96 -9
  31. package/chip/types.d.ts +1 -1
  32. package/common/variables.js +328 -260
  33. package/date-input/Calendar.d.ts +4 -0
  34. package/date-input/Calendar.js +258 -0
  35. package/date-input/DateInput.js +134 -237
  36. package/date-input/DateInput.stories.tsx +199 -33
  37. package/date-input/DateInput.test.js +494 -138
  38. package/date-input/DatePicker.d.ts +4 -0
  39. package/date-input/DatePicker.js +146 -0
  40. package/date-input/Icons.d.ts +6 -0
  41. package/date-input/Icons.js +75 -0
  42. package/date-input/YearPicker.d.ts +4 -0
  43. package/date-input/YearPicker.js +126 -0
  44. package/date-input/types.d.ts +51 -0
  45. package/dialog/Dialog.js +50 -28
  46. package/dialog/Dialog.stories.tsx +99 -22
  47. package/dialog/Dialog.test.js +34 -4
  48. package/dialog/types.d.ts +3 -2
  49. package/dropdown/Dropdown.d.ts +1 -1
  50. package/dropdown/Dropdown.js +246 -249
  51. package/dropdown/Dropdown.stories.tsx +245 -56
  52. package/dropdown/Dropdown.test.js +504 -108
  53. package/dropdown/DropdownMenu.d.ts +4 -0
  54. package/dropdown/DropdownMenu.js +70 -0
  55. package/dropdown/DropdownMenuItem.d.ts +4 -0
  56. package/dropdown/DropdownMenuItem.js +81 -0
  57. package/dropdown/types.d.ts +25 -5
  58. package/file-input/FileInput.d.ts +2 -2
  59. package/file-input/FileInput.js +177 -219
  60. package/file-input/FileInput.stories.tsx +122 -11
  61. package/file-input/FileInput.test.js +53 -12
  62. package/file-input/FileItem.d.ts +4 -14
  63. package/file-input/FileItem.js +38 -63
  64. package/file-input/types.d.ts +17 -0
  65. package/flex/Flex.d.ts +4 -0
  66. package/flex/Flex.js +69 -0
  67. package/flex/Flex.stories.tsx +103 -0
  68. package/flex/types.d.ts +32 -0
  69. package/footer/Footer.stories.tsx +99 -1
  70. package/footer/types.d.ts +2 -1
  71. package/header/Header.js +87 -87
  72. package/header/Header.stories.tsx +152 -9
  73. package/header/Icons.js +2 -2
  74. package/header/types.d.ts +3 -2
  75. package/inset/Inset.stories.tsx +4 -4
  76. package/layout/ApplicationLayout.d.ts +15 -6
  77. package/layout/ApplicationLayout.js +36 -64
  78. package/layout/ApplicationLayout.stories.tsx +80 -44
  79. package/layout/types.d.ts +17 -27
  80. package/link/Link.js +2 -2
  81. package/link/Link.stories.tsx +72 -5
  82. package/link/types.d.ts +1 -1
  83. package/main.d.ts +6 -10
  84. package/main.js +28 -60
  85. package/{tabs-nav → nav-tabs}/NavTabs.js +6 -6
  86. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  87. package/{tabs-nav → nav-tabs}/Tab.js +37 -20
  88. package/{tabs-nav → nav-tabs}/types.d.ts +1 -1
  89. package/number-input/NumberInput.test.js +43 -7
  90. package/package.json +16 -21
  91. package/paginator/Icons.d.ts +5 -0
  92. package/paginator/Icons.js +16 -28
  93. package/paginator/Paginator.js +6 -12
  94. package/paginator/Paginator.stories.tsx +24 -0
  95. package/paginator/Paginator.test.js +18 -11
  96. package/paragraph/Paragraph.d.ts +6 -0
  97. package/paragraph/Paragraph.js +38 -0
  98. package/paragraph/Paragraph.stories.tsx +44 -0
  99. package/password-input/PasswordInput.test.js +13 -12
  100. package/progress-bar/ProgressBar.d.ts +2 -2
  101. package/progress-bar/ProgressBar.js +59 -53
  102. package/progress-bar/ProgressBar.stories.jsx +38 -3
  103. package/progress-bar/ProgressBar.test.js +67 -22
  104. package/progress-bar/types.d.ts +3 -4
  105. package/quick-nav/QuickNav.js +18 -17
  106. package/quick-nav/QuickNav.stories.tsx +145 -26
  107. package/radio-group/Radio.d.ts +1 -1
  108. package/radio-group/Radio.js +43 -28
  109. package/radio-group/RadioGroup.js +24 -24
  110. package/radio-group/RadioGroup.stories.tsx +132 -18
  111. package/radio-group/RadioGroup.test.js +123 -96
  112. package/radio-group/types.d.ts +2 -2
  113. package/resultsetTable/Icons.d.ts +7 -0
  114. package/resultsetTable/Icons.js +51 -0
  115. package/resultsetTable/ResultsetTable.js +48 -107
  116. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  117. package/resultsetTable/ResultsetTable.test.js +40 -63
  118. package/resultsetTable/types.d.ts +2 -2
  119. package/select/Listbox.js +4 -10
  120. package/select/Option.js +11 -24
  121. package/select/Select.js +54 -50
  122. package/select/Select.stories.tsx +494 -149
  123. package/select/Select.test.js +338 -272
  124. package/select/types.d.ts +3 -5
  125. package/sidenav/Sidenav.d.ts +6 -5
  126. package/sidenav/Sidenav.js +174 -55
  127. package/sidenav/Sidenav.stories.tsx +249 -149
  128. package/sidenav/Sidenav.test.js +25 -37
  129. package/sidenav/types.d.ts +50 -27
  130. package/slider/Slider.d.ts +2 -2
  131. package/slider/Slider.js +120 -95
  132. package/slider/Slider.stories.tsx +64 -1
  133. package/slider/Slider.test.js +121 -21
  134. package/slider/types.d.ts +6 -2
  135. package/spinner/Spinner.js +2 -2
  136. package/spinner/Spinner.stories.jsx +27 -1
  137. package/switch/Switch.d.ts +2 -2
  138. package/switch/Switch.js +135 -68
  139. package/switch/Switch.stories.tsx +41 -30
  140. package/switch/Switch.test.js +144 -17
  141. package/switch/types.d.ts +6 -2
  142. package/table/Table.js +1 -1
  143. package/table/Table.stories.jsx +80 -1
  144. package/table/Table.test.js +1 -1
  145. package/tabs/Tab.d.ts +4 -0
  146. package/tabs/Tab.js +133 -0
  147. package/tabs/Tabs.js +360 -104
  148. package/tabs/Tabs.stories.tsx +119 -5
  149. package/tabs/Tabs.test.js +217 -6
  150. package/tabs/types.d.ts +15 -5
  151. package/tag/Tag.js +1 -1
  152. package/tag/Tag.stories.tsx +14 -1
  153. package/tag/types.d.ts +1 -1
  154. package/text-input/Icons.d.ts +8 -0
  155. package/text-input/Icons.js +60 -0
  156. package/text-input/Suggestion.js +38 -9
  157. package/text-input/Suggestions.d.ts +4 -0
  158. package/text-input/Suggestions.js +134 -0
  159. package/text-input/TextInput.js +195 -292
  160. package/text-input/TextInput.stories.tsx +280 -185
  161. package/text-input/TextInput.test.js +737 -725
  162. package/text-input/types.d.ts +22 -3
  163. package/textarea/Textarea.stories.jsx +60 -1
  164. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  165. package/toggle-group/types.d.ts +1 -1
  166. package/typography/Typography.d.ts +4 -0
  167. package/typography/Typography.js +131 -0
  168. package/typography/Typography.stories.tsx +198 -0
  169. package/typography/types.d.ts +18 -0
  170. package/wizard/Wizard.js +9 -16
  171. package/wizard/Wizard.stories.tsx +40 -1
  172. package/wizard/types.d.ts +5 -4
  173. package/common/RequiredComponent.js +0 -32
  174. package/inline/Inline.d.ts +0 -4
  175. package/inline/Inline.js +0 -60
  176. package/inline/Inline.stories.tsx +0 -319
  177. package/inline/types.d.ts +0 -36
  178. package/list/List.d.ts +0 -4
  179. package/list/List.js +0 -47
  180. package/list/List.stories.tsx +0 -89
  181. package/list/types.d.ts +0 -7
  182. package/row/Row.d.ts +0 -3
  183. package/row/Row.js +0 -127
  184. package/row/Row.stories.tsx +0 -237
  185. package/row/types.d.ts +0 -28
  186. package/stack/Stack.d.ts +0 -4
  187. package/stack/Stack.js +0 -56
  188. package/stack/Stack.stories.tsx +0 -263
  189. package/stack/types.d.ts +0 -32
  190. package/tabs-nav/types.js +0 -5
  191. package/text/Text.d.ts +0 -7
  192. package/text/Text.js +0 -30
  193. package/text/Text.stories.tsx +0 -19
  194. /package/{inline → bulleted-list}/types.js +0 -0
  195. /package/{list → flex}/types.js +0 -0
  196. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  197. /package/{tabs-nav → nav-tabs}/NavTabs.test.js +0 -0
  198. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  199. /package/{row → nav-tabs}/types.js +0 -0
  200. /package/{stack → typography}/types.js +0 -0
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
- import { userEvent, within, waitFor } from "@storybook/testing-library";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
3
  import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
5
  import DxcSelect from "./Select";
6
6
  import Listbox from "./Listbox";
7
- import DxcButton from "../button/Button";
8
- import DxcCheckbox from "../checkbox/Checkbox";
7
+ import { ThemeProvider } from "styled-components";
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",
@@ -189,7 +195,29 @@ const url_options = [
189
195
  {
190
196
  label: "Facebook",
191
197
  value: "facebook",
192
- icon: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b8/2021_Facebook_icon.svg/2048px-2021_Facebook_icon.svg.png",
198
+ icon: (
199
+ <svg
200
+ version="1.1"
201
+ id="Capa_1"
202
+ x="0px"
203
+ y="0px"
204
+ width="438.536px"
205
+ height="438.536px"
206
+ viewBox="0 0 438.536 438.536"
207
+ fill="#4267B2"
208
+ >
209
+ <g>
210
+ <path
211
+ 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
212
+ 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
213
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
214
+ 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
215
+ 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
216
+ 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"
217
+ />
218
+ </g>
219
+ </svg>
220
+ ),
193
221
  },
194
222
  {
195
223
  label: "Pinterest",
@@ -219,13 +247,22 @@ const url_options = [
219
247
  ],
220
248
  },
221
249
  ];
250
+
222
251
  const optionsWithEllipsisMedium = [
223
252
  { label: "Optiond1234567890123456789012345678901234", value: "1" },
224
253
  { label: "Optiond12345678901234567890123456789012345", value: "2" },
225
254
  { label: "Option 031111111111111111111111111111222", value: "3" },
226
- { label: "Option 03111111111111111111111111111222", value: "4" },
227
255
  ];
228
256
 
257
+ const opinionatedTheme = {
258
+ select: {
259
+ selectedOptionBackgroundColor: "#e6f4ff",
260
+ fontColor: "#000000",
261
+ optionFontColor: "#000000",
262
+ hoverBorderColor: "#a46ede",
263
+ },
264
+ };
265
+
229
266
  const Select = () => (
230
267
  <>
231
268
  <Title title="States" theme="light" level={2} />
@@ -338,122 +375,380 @@ const Select = () => (
338
375
  <Title title="Multiple selection with ellipsis" theme="light" level={4} />
339
376
  <DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
340
377
  <Title title="Value with ellipsis" theme="light" level={4} />
341
- <DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" size="medium" />
378
+ <DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" />
342
379
  <Title title="Options with ellipsis" theme="light" level={4} />
343
380
  <DxcSelect
344
381
  label="Label"
345
382
  placeholder="Choose an option"
346
383
  defaultValue="1"
347
384
  options={optionsWithEllipsisMedium}
348
- size="medium"
385
+ margin={{ top: "xxlarge" }}
349
386
  />
350
387
  </ExampleContainer>
351
- </>
352
- );
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} />
388
+ <Title title="Opinionated theme" theme="light" level={2} />
369
389
  <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
- styles={{ width: 360 }}
383
- />
390
+ <Title title="Hovered" theme="light" level={4} />
391
+ <HalstackProvider theme={opinionatedTheme}>
392
+ <DxcSelect label="Hovered" options={single_options} />
393
+ </HalstackProvider>
384
394
  </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
- styles={{ width: 360 }}
399
- />
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
400
  </ExampleContainer>
401
401
  <ExampleContainer>
402
- <Title title="Focused option" theme="light" level={4} />
403
- <Listbox
404
- id="x"
405
- currentValue=""
406
- options={one_option}
407
- visualFocusIndex={0}
408
- lastOptionIndex={0}
409
- multiple={false}
410
- optional={false}
411
- optionalItem={{ label: "Empty", value: "" }}
412
- searchable={false}
413
- handleOptionOnClick={() => {}}
414
- styles={{ width: 360 }}
415
- />
402
+ <Title title="Disabled" theme="light" level={4} />
403
+ <HalstackProvider theme={opinionatedTheme}>
404
+ <DxcSelect label="Disabled" placeholder="Placeholder" disabled options={single_options} />
405
+ </HalstackProvider>
416
406
  </ExampleContainer>
417
- <ExampleContainer pseudoState="pseudo-hover">
418
- <Title title="Hovered selected option" theme="light" level={4} />
419
- <Listbox
420
- id="x"
421
- currentValue="1"
422
- options={single_options}
423
- visualFocusIndex={-1}
424
- lastOptionIndex={3}
425
- multiple={false}
426
- optional={false}
427
- optionalItem={{ label: "Empty", value: "" }}
428
- searchable={false}
429
- handleOptionOnClick={() => {}}
430
- styles={{ width: 360 }}
431
- />
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>
432
412
  </ExampleContainer>
433
- <ExampleContainer pseudoState="pseudo-active">
434
- <Title title="Active selected option" theme="light" level={4} />
435
- <Listbox
436
- id="x"
437
- currentValue="2"
438
- options={single_options}
439
- visualFocusIndex={0}
440
- lastOptionIndex={3}
441
- multiple={false}
442
- optional={false}
443
- optionalItem={{ label: "Empty", value: "" }}
444
- searchable={false}
445
- handleOptionOnClick={() => {}}
446
- styles={{ width: 360 }}
447
- />
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>
448
436
  </ExampleContainer>
449
437
  </>
450
438
  );
439
+
440
+ const SelectListbox = () => {
441
+ const colorsTheme: any = useTheme();
442
+
443
+ return (
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
+ </>
733
+ );
734
+ };
735
+
451
736
  const SearchableSelect = () => (
452
737
  <ExampleContainer expanded>
453
738
  <Title title="Searchable select" theme="light" level={4} />
454
739
  <DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
455
740
  </ExampleContainer>
456
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
+
457
752
  const SearchValue = () => (
458
753
  <ExampleContainer expanded>
459
754
  <Title title="Searchable select with value" theme="light" level={4} />
@@ -466,6 +761,22 @@ const SearchValue = () => (
466
761
  />
467
762
  </ExampleContainer>
468
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
+
469
780
  const MultipleSelect = () => (
470
781
  <>
471
782
  <ExampleContainer expanded>
@@ -480,12 +791,38 @@ const MultipleSelect = () => (
480
791
  </ExampleContainer>
481
792
  </>
482
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
+
483
810
  const DefaultGroupedOptionsSelect = () => (
484
811
  <ExampleContainer expanded>
485
812
  <Title title="Grouped options simple select" theme="light" level={4} />
486
813
  <DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
487
814
  </ExampleContainer>
488
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
+
489
826
  const MultipleGroupedOptionsSelect = () => (
490
827
  <ExampleContainer expanded>
491
828
  <Title title="Grouped options multiple select" theme="light" level={4} />
@@ -498,34 +835,19 @@ const MultipleGroupedOptionsSelect = () => (
498
835
  />
499
836
  </ExampleContainer>
500
837
  );
501
- const RescaledIcons = () => (
502
- <ExampleContainer expanded>
503
- <Title title="Rescaled icons displayed" theme="light" level={4} />
504
- <DxcSelect label="Label" options={url_options} defaultValue="facebook" placeholder="Choose an option" />
505
- </ExampleContainer>
506
- );
507
- const SelectWithIcons = () => (
508
- <ExampleContainer expanded>
509
- <Title title="Normal icons displayed" theme="light" level={4} />
510
- <DxcSelect label="Label" options={icon_options} defaultValue="3" placeholder="Choose an option" />
511
- </ExampleContainer>
512
- );
513
- const SelectMultipleWithIcons = () => (
514
- <ExampleContainer expanded>
515
- <Title title="Multiple select with icons" theme="light" level={4} />
516
- <DxcSelect label="Label" options={icon_options} multiple defaultValue={["1", "3"]} placeholder="Choose an option" />
517
- </ExampleContainer>
518
- );
519
- const MultipleGroupedOptionsSelectWithIcons = () => (
838
+
839
+ const MultipleGroupedOptionsSelectOpinionated = () => (
520
840
  <ExampleContainer expanded>
521
- <Title title="Multiple grouped options with icons" theme="light" level={4} />
522
- <DxcSelect
523
- label="Label"
524
- options={icon_options_grouped}
525
- multiple
526
- defaultValue={["3", "2"]}
527
- placeholder="Choose an option"
528
- />
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>
529
851
  </ExampleContainer>
530
852
  );
531
853
 
@@ -543,6 +865,22 @@ const MultipleSearchable = () => (
543
865
  </ExampleContainer>
544
866
  );
545
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
+
546
884
  export const Chromatic = Select.bind({});
547
885
  Chromatic.play = async ({ canvasElement }) => {
548
886
  const canvas = within(canvasElement);
@@ -559,10 +897,13 @@ ListboxStates.play = async ({ canvasElement }) => {
559
897
  export const Searchable = SearchableSelect.bind({});
560
898
  Searchable.play = async ({ canvasElement }) => {
561
899
  const canvas = within(canvasElement);
562
- await userEvent.click(canvas.getByRole("combobox"));
563
- await waitFor(async () => {
564
- userEvent.type(canvas.getByRole("combobox"), "r");
565
- });
900
+ await userEvent.type(canvas.getByRole("combobox"), "r");
901
+ };
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");
566
907
  };
567
908
 
568
909
  export const SearchableWithValue = SearchValue.bind({});
@@ -571,12 +912,24 @@ SearchableWithValue.play = async ({ canvasElement }) => {
571
912
  await userEvent.click(canvas.getByRole("combobox"));
572
913
  };
573
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
+
574
921
  export const MultipleSearchableWithValue = MultipleSearchable.bind({});
575
922
  MultipleSearchableWithValue.play = async ({ canvasElement }) => {
576
923
  const canvas = within(canvasElement);
577
924
  await userEvent.click(canvas.getAllByRole("combobox")[0]);
578
925
  };
579
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
+
580
933
  export const GroupOptionsDisplayed = DefaultGroupedOptionsSelect.bind({});
581
934
  GroupOptionsDisplayed.play = async ({ canvasElement }) => {
582
935
  const canvas = within(canvasElement);
@@ -584,42 +937,34 @@ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
584
937
  await userEvent.click(select);
585
938
  };
586
939
 
587
- export const MultipleOptionsDisplayed = MultipleSelect.bind({});
588
- MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
589
- const canvas = within(canvasElement);
590
- await userEvent.click(canvas.getAllByRole("combobox")[0]);
591
- };
592
-
593
- export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
594
- MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
940
+ export const GroupOptionsDisplayedOpinionated = DefaultGroupedOptionsSelectOpinionated.bind({});
941
+ GroupOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
595
942
  const canvas = within(canvasElement);
596
943
  const select = canvas.getByRole("combobox");
597
944
  await userEvent.click(select);
598
945
  };
599
946
 
600
- export const WithIconsDisplayed = SelectWithIcons.bind({});
601
- WithIconsDisplayed.play = async ({ canvasElement }) => {
947
+ export const MultipleOptionsDisplayed = MultipleSelect.bind({});
948
+ MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
602
949
  const canvas = within(canvasElement);
603
- const select = canvas.getByRole("combobox");
604
- await userEvent.click(select);
950
+ await userEvent.click(canvas.getAllByRole("combobox")[0]);
605
951
  };
606
952
 
607
- export const WithRescaledIconsDisplayed = RescaledIcons.bind({});
608
- WithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
953
+ export const MultipleOptionsDisplayedOpinionated = MultipleSelectOpinioated.bind({});
954
+ MultipleOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
609
955
  const canvas = within(canvasElement);
610
- const select = canvas.getByRole("combobox");
611
- await userEvent.click(select);
956
+ await userEvent.click(canvas.getAllByRole("combobox")[0]);
612
957
  };
613
958
 
614
- export const MultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
615
- MultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
959
+ export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
960
+ MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
616
961
  const canvas = within(canvasElement);
617
962
  const select = canvas.getByRole("combobox");
618
963
  await userEvent.click(select);
619
964
  };
620
965
 
621
- export const MultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
622
- MultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
966
+ export const MultipleGroupedOptionsDisplayedOpinionated = MultipleGroupedOptionsSelectOpinionated.bind({});
967
+ MultipleGroupedOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
623
968
  const canvas = within(canvasElement);
624
969
  const select = canvas.getByRole("combobox");
625
970
  await userEvent.click(select);