@dxc-technology/halstack-react 0.0.0-dfcca07 → 0.0.0-e01c6f9

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 (346) hide show
  1. package/BackgroundColorContext.d.ts +1 -0
  2. package/BackgroundColorContext.js +6 -26
  3. package/HalstackContext.d.ts +1235 -0
  4. package/HalstackContext.js +310 -0
  5. package/README.md +47 -0
  6. package/accordion/Accordion.d.ts +1 -1
  7. package/accordion/Accordion.js +118 -194
  8. package/accordion/Accordion.stories.tsx +283 -0
  9. package/accordion/Accordion.test.js +56 -0
  10. package/accordion/types.d.ts +12 -23
  11. package/accordion-group/AccordionGroup.d.ts +5 -4
  12. package/accordion-group/AccordionGroup.js +39 -108
  13. package/accordion-group/AccordionGroup.stories.tsx +95 -68
  14. package/accordion-group/AccordionGroup.test.js +98 -0
  15. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  16. package/accordion-group/AccordionGroupAccordion.js +31 -0
  17. package/accordion-group/types.d.ts +18 -23
  18. package/action-icon/ActionIcon.d.ts +4 -0
  19. package/action-icon/ActionIcon.js +43 -0
  20. package/action-icon/types.d.ts +26 -0
  21. package/alert/Alert.js +24 -60
  22. package/alert/Alert.stories.tsx +28 -0
  23. package/alert/Alert.test.js +75 -0
  24. package/alert/types.d.ts +5 -5
  25. package/badge/Badge.d.ts +4 -0
  26. package/badge/Badge.js +9 -20
  27. package/badge/types.d.ts +5 -0
  28. package/bleed/Bleed.d.ts +3 -0
  29. package/bleed/Bleed.js +43 -0
  30. package/bleed/Bleed.stories.tsx +342 -0
  31. package/bleed/types.d.ts +37 -0
  32. package/box/Box.d.ts +1 -1
  33. package/box/Box.js +31 -82
  34. package/box/Box.stories.tsx +38 -51
  35. package/box/Box.test.js +13 -0
  36. package/box/types.d.ts +3 -14
  37. package/bulleted-list/BulletedList.d.ts +7 -0
  38. package/bulleted-list/BulletedList.js +89 -0
  39. package/bulleted-list/BulletedList.stories.tsx +115 -0
  40. package/bulleted-list/types.d.ts +38 -0
  41. package/bulleted-list/types.js +5 -0
  42. package/button/Button.d.ts +1 -1
  43. package/button/Button.js +64 -123
  44. package/button/Button.stories.tsx +164 -96
  45. package/button/Button.test.js +36 -0
  46. package/button/types.d.ts +12 -12
  47. package/card/Card.d.ts +1 -1
  48. package/card/Card.js +59 -103
  49. package/card/Card.stories.tsx +13 -43
  50. package/card/Card.test.js +39 -0
  51. package/card/types.d.ts +6 -11
  52. package/checkbox/Checkbox.d.ts +2 -2
  53. package/checkbox/Checkbox.js +145 -183
  54. package/checkbox/Checkbox.stories.tsx +166 -136
  55. package/checkbox/Checkbox.test.js +199 -0
  56. package/checkbox/types.d.ts +19 -7
  57. package/chip/Chip.d.ts +4 -0
  58. package/chip/Chip.js +48 -148
  59. package/chip/Chip.stories.tsx +123 -30
  60. package/chip/Chip.test.js +41 -0
  61. package/chip/types.d.ts +45 -0
  62. package/chip/types.js +5 -0
  63. package/common/OpenSans.css +68 -80
  64. package/common/coreTokens.d.ts +237 -0
  65. package/common/coreTokens.js +184 -0
  66. package/common/utils.d.ts +1 -0
  67. package/common/utils.js +6 -12
  68. package/common/variables.d.ts +1381 -0
  69. package/common/variables.js +1006 -1331
  70. package/container/Container.d.ts +4 -0
  71. package/container/Container.js +194 -0
  72. package/container/Container.stories.tsx +214 -0
  73. package/container/types.d.ts +74 -0
  74. package/container/types.js +5 -0
  75. package/date-input/Calendar.d.ts +4 -0
  76. package/date-input/Calendar.js +214 -0
  77. package/date-input/DateInput.js +175 -313
  78. package/date-input/DateInput.stories.tsx +203 -56
  79. package/date-input/DateInput.test.js +808 -0
  80. package/date-input/DatePicker.d.ts +4 -0
  81. package/date-input/DatePicker.js +115 -0
  82. package/date-input/Icons.d.ts +6 -0
  83. package/date-input/Icons.js +58 -0
  84. package/date-input/YearPicker.d.ts +4 -0
  85. package/date-input/YearPicker.js +100 -0
  86. package/date-input/types.d.ts +86 -22
  87. package/dialog/Dialog.d.ts +1 -1
  88. package/dialog/Dialog.js +69 -130
  89. package/dialog/Dialog.stories.tsx +320 -167
  90. package/dialog/Dialog.test.js +307 -0
  91. package/dialog/types.d.ts +18 -25
  92. package/dropdown/Dropdown.d.ts +1 -1
  93. package/dropdown/Dropdown.js +245 -328
  94. package/dropdown/Dropdown.stories.tsx +438 -0
  95. package/dropdown/Dropdown.test.js +599 -0
  96. package/dropdown/DropdownMenu.d.ts +4 -0
  97. package/dropdown/DropdownMenu.js +63 -0
  98. package/dropdown/DropdownMenuItem.d.ts +4 -0
  99. package/dropdown/DropdownMenuItem.js +67 -0
  100. package/dropdown/types.d.ts +36 -27
  101. package/file-input/FileInput.d.ts +2 -2
  102. package/file-input/FileInput.js +267 -299
  103. package/file-input/FileInput.stories.tsx +618 -0
  104. package/file-input/FileInput.test.js +459 -0
  105. package/file-input/FileItem.d.ts +4 -14
  106. package/file-input/FileItem.js +52 -101
  107. package/file-input/types.d.ts +53 -11
  108. package/flex/Flex.d.ts +4 -0
  109. package/flex/Flex.js +57 -0
  110. package/flex/Flex.stories.tsx +112 -0
  111. package/flex/types.d.ts +97 -0
  112. package/flex/types.js +5 -0
  113. package/footer/Footer.d.ts +1 -1
  114. package/footer/Footer.js +60 -201
  115. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +38 -37
  116. package/footer/Footer.test.js +85 -0
  117. package/footer/Icons.d.ts +2 -0
  118. package/footer/Icons.js +4 -9
  119. package/footer/types.d.ts +22 -33
  120. package/grid/Grid.d.ts +7 -0
  121. package/grid/Grid.js +76 -0
  122. package/grid/Grid.stories.tsx +219 -0
  123. package/grid/types.d.ts +115 -0
  124. package/grid/types.js +5 -0
  125. package/header/Header.d.ts +4 -3
  126. package/header/Header.js +100 -204
  127. package/header/Header.stories.tsx +152 -63
  128. package/header/Header.test.js +66 -0
  129. package/header/Icons.d.ts +2 -0
  130. package/header/Icons.js +4 -9
  131. package/header/types.d.ts +5 -19
  132. package/heading/Heading.js +11 -33
  133. package/heading/Heading.stories.tsx +3 -2
  134. package/heading/Heading.test.js +169 -0
  135. package/heading/types.d.ts +7 -7
  136. package/image/Image.d.ts +4 -0
  137. package/image/Image.js +70 -0
  138. package/image/Image.stories.tsx +127 -0
  139. package/image/types.d.ts +72 -0
  140. package/image/types.js +5 -0
  141. package/inset/Inset.d.ts +3 -0
  142. package/inset/Inset.js +43 -0
  143. package/inset/Inset.stories.tsx +230 -0
  144. package/inset/types.d.ts +37 -0
  145. package/inset/types.js +5 -0
  146. package/layout/ApplicationLayout.d.ts +20 -0
  147. package/layout/ApplicationLayout.js +83 -184
  148. package/layout/ApplicationLayout.stories.tsx +162 -0
  149. package/layout/Icons.d.ts +8 -0
  150. package/layout/Icons.js +51 -48
  151. package/layout/SidenavContext.d.ts +5 -0
  152. package/layout/SidenavContext.js +13 -0
  153. package/layout/types.d.ts +41 -0
  154. package/layout/types.js +5 -0
  155. package/link/Link.d.ts +3 -2
  156. package/link/Link.js +65 -111
  157. package/link/Link.stories.tsx +159 -52
  158. package/link/Link.test.js +63 -0
  159. package/link/types.d.ts +15 -35
  160. package/main.d.ts +15 -13
  161. package/main.js +70 -97
  162. package/nav-tabs/NavTabs.d.ts +8 -0
  163. package/nav-tabs/NavTabs.js +90 -0
  164. package/nav-tabs/NavTabs.stories.tsx +274 -0
  165. package/nav-tabs/NavTabs.test.js +75 -0
  166. package/nav-tabs/Tab.d.ts +4 -0
  167. package/nav-tabs/Tab.js +117 -0
  168. package/nav-tabs/types.d.ts +52 -0
  169. package/nav-tabs/types.js +5 -0
  170. package/number-input/NumberInput.d.ts +7 -0
  171. package/number-input/NumberInput.js +28 -47
  172. package/number-input/NumberInput.stories.tsx +44 -28
  173. package/number-input/NumberInput.test.js +830 -0
  174. package/number-input/types.d.ts +28 -15
  175. package/package.json +46 -45
  176. package/paginator/Icons.d.ts +5 -0
  177. package/paginator/Icons.js +21 -47
  178. package/paginator/Paginator.js +35 -98
  179. package/paginator/Paginator.stories.tsx +24 -0
  180. package/paginator/Paginator.test.js +335 -0
  181. package/paginator/types.d.ts +3 -3
  182. package/paragraph/Paragraph.d.ts +5 -0
  183. package/paragraph/Paragraph.js +22 -0
  184. package/paragraph/Paragraph.stories.tsx +27 -0
  185. package/password-input/Icons.d.ts +6 -0
  186. package/password-input/Icons.js +35 -0
  187. package/password-input/PasswordInput.js +58 -125
  188. package/password-input/PasswordInput.stories.tsx +3 -35
  189. package/password-input/PasswordInput.test.js +198 -0
  190. package/password-input/types.d.ts +21 -17
  191. package/progress-bar/ProgressBar.js +66 -92
  192. package/progress-bar/ProgressBar.stories.tsx +93 -0
  193. package/progress-bar/ProgressBar.test.js +93 -0
  194. package/progress-bar/types.d.ts +3 -3
  195. package/quick-nav/QuickNav.d.ts +4 -0
  196. package/quick-nav/QuickNav.js +94 -0
  197. package/quick-nav/QuickNav.stories.tsx +356 -0
  198. package/quick-nav/types.d.ts +21 -0
  199. package/quick-nav/types.js +5 -0
  200. package/radio-group/Radio.d.ts +4 -0
  201. package/radio-group/Radio.js +124 -0
  202. package/radio-group/RadioGroup.d.ts +4 -0
  203. package/radio-group/RadioGroup.js +235 -0
  204. package/radio-group/RadioGroup.stories.tsx +214 -0
  205. package/radio-group/RadioGroup.test.js +756 -0
  206. package/radio-group/types.d.ts +114 -0
  207. package/radio-group/types.js +5 -0
  208. package/resultset-table/Icons.d.ts +7 -0
  209. package/resultset-table/Icons.js +47 -0
  210. package/resultset-table/ResultsetTable.js +159 -0
  211. package/resultset-table/ResultsetTable.stories.tsx +300 -0
  212. package/resultset-table/ResultsetTable.test.js +305 -0
  213. package/{resultsetTable → resultset-table}/types.d.ts +8 -8
  214. package/resultset-table/types.js +5 -0
  215. package/select/Icons.d.ts +10 -0
  216. package/select/Icons.js +89 -0
  217. package/select/Listbox.d.ts +4 -0
  218. package/select/Listbox.js +143 -0
  219. package/select/Option.d.ts +4 -0
  220. package/select/Option.js +80 -0
  221. package/select/Select.d.ts +4 -0
  222. package/select/Select.js +227 -511
  223. package/select/Select.stories.tsx +603 -204
  224. package/select/Select.test.js +2370 -0
  225. package/select/types.d.ts +209 -0
  226. package/select/types.js +5 -0
  227. package/sidenav/Icons.d.ts +7 -0
  228. package/sidenav/Icons.js +47 -0
  229. package/sidenav/Sidenav.d.ts +6 -5
  230. package/sidenav/Sidenav.js +132 -72
  231. package/sidenav/Sidenav.stories.tsx +251 -134
  232. package/sidenav/Sidenav.test.js +37 -0
  233. package/sidenav/types.d.ts +52 -26
  234. package/slider/Slider.d.ts +2 -2
  235. package/slider/Slider.js +149 -181
  236. package/slider/Slider.test.js +254 -0
  237. package/slider/types.d.ts +11 -3
  238. package/spinner/Spinner.js +32 -76
  239. package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -26
  240. package/spinner/Spinner.test.js +55 -0
  241. package/spinner/types.d.ts +3 -3
  242. package/switch/Switch.d.ts +2 -2
  243. package/switch/Switch.js +150 -115
  244. package/switch/Switch.stories.tsx +45 -68
  245. package/switch/Switch.test.js +180 -0
  246. package/switch/types.d.ts +13 -5
  247. package/table/Table.js +9 -31
  248. package/table/{Table.stories.jsx → Table.stories.tsx} +81 -1
  249. package/table/Table.test.js +21 -0
  250. package/table/types.d.ts +8 -8
  251. package/tabs/Tab.d.ts +4 -0
  252. package/tabs/Tab.js +113 -0
  253. package/tabs/Tabs.d.ts +1 -1
  254. package/tabs/Tabs.js +318 -147
  255. package/tabs/Tabs.stories.tsx +122 -17
  256. package/tabs/Tabs.test.js +294 -0
  257. package/tabs/types.d.ts +46 -24
  258. package/tag/Tag.d.ts +1 -1
  259. package/tag/Tag.js +44 -86
  260. package/tag/Tag.stories.tsx +38 -28
  261. package/tag/Tag.test.js +49 -0
  262. package/tag/types.d.ts +25 -16
  263. package/text-input/Icons.d.ts +8 -0
  264. package/text-input/Icons.js +56 -0
  265. package/text-input/Suggestion.d.ts +4 -0
  266. package/text-input/Suggestion.js +67 -0
  267. package/text-input/Suggestions.d.ts +4 -0
  268. package/text-input/Suggestions.js +84 -0
  269. package/text-input/TextInput.js +330 -544
  270. package/text-input/TextInput.stories.tsx +280 -271
  271. package/text-input/TextInput.test.js +1739 -0
  272. package/text-input/types.d.ts +71 -25
  273. package/textarea/Textarea.d.ts +4 -0
  274. package/textarea/Textarea.js +95 -177
  275. package/textarea/Textarea.stories.tsx +174 -0
  276. package/textarea/Textarea.test.js +406 -0
  277. package/textarea/types.d.ts +141 -0
  278. package/textarea/types.js +5 -0
  279. package/toggle-group/ToggleGroup.d.ts +2 -2
  280. package/toggle-group/ToggleGroup.js +97 -113
  281. package/toggle-group/ToggleGroup.stories.tsx +76 -36
  282. package/toggle-group/ToggleGroup.test.js +137 -0
  283. package/toggle-group/types.d.ts +66 -36
  284. package/typography/Typography.d.ts +4 -0
  285. package/typography/Typography.js +23 -0
  286. package/typography/Typography.stories.tsx +198 -0
  287. package/typography/types.d.ts +18 -0
  288. package/typography/types.js +5 -0
  289. package/useTheme.d.ts +1134 -0
  290. package/useTheme.js +4 -11
  291. package/useTranslatedLabels.d.ts +85 -0
  292. package/useTranslatedLabels.js +14 -0
  293. package/utils/BaseTypography.d.ts +21 -0
  294. package/utils/BaseTypography.js +94 -0
  295. package/utils/FocusLock.d.ts +13 -0
  296. package/utils/FocusLock.js +121 -0
  297. package/wizard/Wizard.d.ts +1 -1
  298. package/wizard/Wizard.js +123 -104
  299. package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +48 -19
  300. package/wizard/Wizard.test.js +114 -0
  301. package/wizard/types.d.ts +14 -14
  302. package/ThemeContext.js +0 -246
  303. package/V3Select/V3Select.js +0 -455
  304. package/V3Select/index.d.ts +0 -27
  305. package/V3Textarea/V3Textarea.js +0 -260
  306. package/V3Textarea/index.d.ts +0 -27
  307. package/card/ice-cream.jpg +0 -0
  308. package/chip/index.d.ts +0 -22
  309. package/common/RequiredComponent.js +0 -32
  310. package/date/Date.js +0 -373
  311. package/date/index.d.ts +0 -27
  312. package/input-text/Icons.js +0 -22
  313. package/input-text/InputText.js +0 -611
  314. package/input-text/index.d.ts +0 -36
  315. package/number-input/NumberInputContext.d.ts +0 -4
  316. package/number-input/NumberInputContext.js +0 -19
  317. package/number-input/numberInputContextTypes.d.ts +0 -19
  318. package/progress-bar/ProgressBar.stories.jsx +0 -58
  319. package/radio/Radio.d.ts +0 -4
  320. package/radio/Radio.js +0 -174
  321. package/radio/Radio.stories.tsx +0 -192
  322. package/radio/types.d.ts +0 -54
  323. package/resultsetTable/ResultsetTable.js +0 -251
  324. package/select/index.d.ts +0 -131
  325. package/slider/Slider.stories.tsx +0 -177
  326. package/textarea/Textarea.stories.jsx +0 -135
  327. package/textarea/index.d.ts +0 -127
  328. package/toggle/Toggle.js +0 -186
  329. package/toggle/index.d.ts +0 -21
  330. package/upload/Upload.js +0 -201
  331. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  332. package/upload/buttons-upload/Icons.js +0 -40
  333. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  334. package/upload/dragAndDropArea/Icons.js +0 -39
  335. package/upload/file-upload/FileToUpload.js +0 -115
  336. package/upload/file-upload/Icons.js +0 -66
  337. package/upload/files-upload/FilesToUpload.js +0 -109
  338. package/upload/index.d.ts +0 -15
  339. package/upload/transaction/Icons.js +0 -160
  340. package/upload/transaction/Transaction.js +0 -104
  341. package/upload/transactions/Transactions.js +0 -94
  342. package/wizard/Icons.js +0 -65
  343. /package/{radio → action-icon}/types.js +0 -0
  344. /package/{resultsetTable → badge}/types.js +0 -0
  345. /package/{number-input/numberInputContextTypes.js → bleed/types.js} +0 -0
  346. /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
@@ -1,17 +1,18 @@
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 { ThemeProvider } from "styled-components";
8
+ import useTheme from "../useTheme";
9
+ import { HalstackProvider } from "../HalstackContext";
10
10
 
11
11
  export default {
12
12
  title: "Select",
13
13
  component: DxcSelect,
14
14
  };
15
+
15
16
  const one_option = [{ label: "Option 01", value: "1" }];
16
17
 
17
18
  const single_options = [
@@ -20,6 +21,7 @@ const single_options = [
20
21
  { label: "Option 03", value: "3" },
21
22
  { label: "Option 04", value: "4" },
22
23
  ];
24
+
23
25
  const group_options = [
24
26
  {
25
27
  label: "Group 001",
@@ -62,6 +64,7 @@ const group_options = [
62
64
  ],
63
65
  },
64
66
  ];
67
+
65
68
  const icon_options_grouped = [
66
69
  {
67
70
  label: "Group 001",
@@ -125,6 +128,7 @@ const icon_options_grouped = [
125
128
  ],
126
129
  },
127
130
  ];
131
+
128
132
  const icon_options = [
129
133
  {
130
134
  label: "3G Mobile",
@@ -173,6 +177,7 @@ const icon_options = [
173
177
  ),
174
178
  },
175
179
  ];
180
+
176
181
  const url_options = [
177
182
  {
178
183
  label: "Social Media",
@@ -183,14 +188,36 @@ const url_options = [
183
188
  icon: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Instagram_logo_2016.svg/800px-Instagram_logo_2016.svg.png",
184
189
  },
185
190
  {
186
- label: "Twitter",
187
- value: "twitter",
188
- icon: "https://cdn.computerhoy.com/sites/navi.axelspringer.es/public/styles/480/public/media/image/2013/08/17981-logo-twitter.png?itok=dElA6iAV",
191
+ label: "X",
192
+ value: "x",
193
+ icon: "https://static.dezeen.com/uploads/2023/07/x-logo-twitter-elon-musk_dezeen_2364_col_0.jpg",
189
194
  },
190
195
  {
191
196
  label: "Facebook",
192
197
  value: "facebook",
193
- 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
+ ),
194
221
  },
195
222
  {
196
223
  label: "Pinterest",
@@ -220,14 +247,25 @@ const url_options = [
220
247
  ],
221
248
  },
222
249
  ];
250
+
223
251
  const optionsWithEllipsisMedium = [
224
252
  { label: "Optiond1234567890123456789012345678901234", value: "1" },
225
253
  { label: "Optiond12345678901234567890123456789012345", value: "2" },
226
254
  { label: "Option 031111111111111111111111111111222", value: "3" },
227
- { label: "Option 03111111111111111111111111111122", value: "4" },
228
255
  ];
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
  <>
268
+ <Title title="States" theme="light" level={2} />
231
269
  <ExampleContainer pseudoState="pseudo-hover">
232
270
  <Title title="Hovered" theme="light" level={4} />
233
271
  <DxcSelect label="Hovered" options={single_options} />
@@ -242,126 +280,500 @@ const Select = () => (
242
280
  </ExampleContainer>
243
281
  <ExampleContainer>
244
282
  <Title title="Disabled with value" theme="light" level={4} />
245
- <DxcSelect label="Disabled with value" disabled options={single_options} value="1" />
283
+ <DxcSelect label="Disabled with value" disabled options={single_options} defaultValue="1" />
246
284
  </ExampleContainer>
247
285
  <ExampleContainer>
248
- <Title title="With label" theme="light" level={4} />
249
- <DxcSelect label="Label" options={single_options} />
250
- <Title title="Label and placeholder" theme="light" level={4} />
251
- <DxcSelect label="Label" options={single_options} placeholder="Placeholder" />
252
- <Title title="Label, placeholder and helper text" theme="light" level={4} />
253
- <DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
254
286
  <Title title="Error" theme="light" level={4} />
255
287
  <DxcSelect
256
288
  label="Label"
257
289
  options={single_options}
258
- error="Error message"
290
+ error="Error message."
259
291
  helperText="Helper text"
260
292
  placeholder="Placeholder"
261
293
  />
294
+ </ExampleContainer>
295
+ <ExampleContainer pseudoState="pseudo-hover">
296
+ <Title title="Hovered error" theme="light" level={4} />
297
+ <DxcSelect
298
+ label="Label"
299
+ options={single_options}
300
+ error="Error message."
301
+ helperText="Helper text"
302
+ placeholder="Placeholder"
303
+ />
304
+ </ExampleContainer>
305
+ <Title title="Anatomy" theme="light" level={2} />
306
+ <ExampleContainer>
307
+ <Title title="Label, placeholder and helper text" theme="light" level={4} />
308
+ <DxcSelect label="Label" options={single_options} helperText="Helper text" placeholder="Placeholder" />
309
+ </ExampleContainer>
310
+ <Title title="Variants" theme="light" level={2} />
311
+ <ExampleContainer>
262
312
  <Title title="Simple selection" theme="light" level={4} />
263
- <DxcSelect label="Simple selection" searchable options={single_options} value="2" />
313
+ <DxcSelect label="Simple selection" searchable options={single_options} defaultValue="2" />
314
+ </ExampleContainer>
315
+ <ExampleContainer>
264
316
  <Title title="Multiple selection" theme="light" level={4} />
265
- <DxcSelect label="Multiple select" searchable options={single_options} multiple value={["1", "2"]} />
317
+ <DxcSelect label="Multiple select" searchable options={single_options} multiple defaultValue={["1", "2"]} />
266
318
  </ExampleContainer>
267
-
268
319
  <ExampleContainer pseudoState="pseudo-hover">
269
320
  <Title title="Multiple clear hovered" theme="light" level={4} />
270
- <DxcSelect label="Multiple select" options={single_options} multiple value={["1", "2"]} />
321
+ <DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
271
322
  </ExampleContainer>
272
-
273
323
  <ExampleContainer pseudoState="pseudo-active">
274
324
  <Title title="Multiple clear actived" theme="light" level={4} />
275
- <DxcSelect label="Multiple select" options={single_options} multiple value={["1", "2"]} />
325
+ <DxcSelect label="Multiple select" options={single_options} multiple defaultValue={["1", "2"]} />
326
+ </ExampleContainer>
327
+ <Title title="Sizes" theme="light" level={2} />
328
+ <ExampleContainer>
329
+ <Title title="Small size" theme="light" level={4} />
330
+ <DxcSelect label="Small" options={single_options} size="small" />
331
+ </ExampleContainer>
332
+ <ExampleContainer>
333
+ <Title title="Medium size" theme="light" level={4} />
334
+ <DxcSelect label="Medium" options={single_options} size="medium" />
335
+ </ExampleContainer>
336
+ <ExampleContainer>
337
+ <Title title="Large size" theme="light" level={4} />
338
+ <DxcSelect label="Large" options={single_options} size="large" />
339
+ </ExampleContainer>
340
+ <ExampleContainer>
341
+ <Title title="Fillparent size" theme="light" level={4} />
342
+ <DxcSelect label="Fillparent" options={single_options} size="fillParent" />
343
+ </ExampleContainer>
344
+ <Title title="Margins" theme="light" level={2} />
345
+ <ExampleContainer>
346
+ <Title title="xxsmall margin" theme="light" level={4} />
347
+ <DxcSelect label="xxSmall" options={single_options} margin="xxsmall" />
348
+ </ExampleContainer>
349
+ <ExampleContainer>
350
+ <Title title="xsmall margin" theme="light" level={4} />
351
+ <DxcSelect label="xSmall" options={single_options} margin="xsmall" />
352
+ </ExampleContainer>
353
+ <ExampleContainer>
354
+ <Title title="small margin" theme="light" level={4} />
355
+ <DxcSelect label="Small" options={single_options} margin="small" />
356
+ </ExampleContainer>
357
+ <ExampleContainer>
358
+ <Title title="medium margin" theme="light" level={4} />
359
+ <DxcSelect label="Medium" options={single_options} margin="medium" />
360
+ </ExampleContainer>
361
+ <ExampleContainer>
362
+ <Title title="large margin" theme="light" level={4} />
363
+ <DxcSelect label="Large" options={single_options} margin="large" />
364
+ </ExampleContainer>
365
+ <ExampleContainer>
366
+ <Title title="xlarge margin" theme="light" level={4} />
367
+ <DxcSelect label="xLarge" options={single_options} margin="xlarge" />
368
+ </ExampleContainer>
369
+ <ExampleContainer>
370
+ <Title title="xxlarge margin" theme="light" level={4} />
371
+ <DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
276
372
  </ExampleContainer>
277
- <>
278
- <Title title="Sizes" theme="light" level={2} />
279
- <ExampleContainer>
280
- <Title title="Small size" theme="light" level={4} />
281
- <DxcSelect label="Small" options={single_options} size="small" />
282
- </ExampleContainer>
283
- <ExampleContainer>
284
- <Title title="Medium size" theme="light" level={4} />
285
- <DxcSelect label="Medium" options={single_options} size="medium" />
286
- </ExampleContainer>
287
- <ExampleContainer>
288
- <Title title="Large size" theme="light" level={4} />
289
- <DxcSelect label="Large" options={single_options} size="large" />
290
- </ExampleContainer>
291
- <ExampleContainer>
292
- <Title title="Fillparent size" theme="light" level={4} />
293
- <DxcSelect label="Fillparent" options={single_options} size="fillParent" />
294
- </ExampleContainer>
295
- </>
296
- <>
297
- <Title title="Margins" theme="light" level={2} />
298
- <ExampleContainer>
299
- <Title title="xxsmall margin" theme="light" level={4} />
300
- <DxcSelect label="xxSmall" options={single_options} margin="xxsmall" />
301
- </ExampleContainer>
302
- <ExampleContainer>
303
- <Title title="xsmall margin" theme="light" level={4} />
304
- <DxcSelect label="xSmall" options={single_options} margin="xsmall" />
305
- </ExampleContainer>
306
- <ExampleContainer>
307
- <Title title="small margin" theme="light" level={4} />
308
- <DxcSelect label="Small" options={single_options} margin="small" />
309
- </ExampleContainer>
310
- <ExampleContainer>
311
- <Title title="medium margin" theme="light" level={4} />
312
- <DxcSelect label="Medium" options={single_options} margin="medium" />
313
- </ExampleContainer>
314
- <ExampleContainer>
315
- <Title title="large margin" theme="light" level={4} />
316
- <DxcSelect label="Large" options={single_options} margin="large" />
317
- </ExampleContainer>
318
- <ExampleContainer>
319
- <Title title="xlarge margin" theme="light" level={4} />
320
- <DxcSelect label="xLarge" options={single_options} margin="xlarge" />
321
- </ExampleContainer>
322
- <ExampleContainer>
323
- <Title title="xxlarge margin" theme="light" level={4} />
324
- <DxcSelect label="xxLarge" options={single_options} margin="xxlarge" />
325
- </ExampleContainer>
326
- </>
327
373
  <ExampleContainer expanded>
328
374
  <Title title="Ellipsis" theme="light" level={2} />
329
375
  <Title title="Multiple selection with ellipsis" theme="light" level={4} />
330
- <DxcSelect label="Label" options={single_options} multiple value={["1", "2", "3", "4"]} />
376
+ <DxcSelect label="Label" options={single_options} multiple defaultValue={["1", "2", "3", "4"]} />
331
377
  <Title title="Value with ellipsis" theme="light" level={4} />
332
- <DxcSelect label="Label" options={optionsWithEllipsisMedium} value="1" size="medium" />
333
- <Title title="Option with ellipsis" theme="light" level={4} />
378
+ <DxcSelect label="Label" options={optionsWithEllipsisMedium} defaultValue="1" />
379
+ <Title title="Options with ellipsis" theme="light" level={4} />
334
380
  <DxcSelect
335
381
  label="Label"
336
382
  placeholder="Choose an option"
337
- value="1"
383
+ defaultValue="1"
338
384
  options={optionsWithEllipsisMedium}
339
- size="medium"
385
+ margin={{ top: "xxlarge" }}
340
386
  />
341
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>
342
437
  </>
343
438
  );
344
- export const Chromatic = Select.bind({});
345
- Chromatic.play = async ({ canvasElement }) => {
346
- const canvas = within(canvasElement);
347
- await userEvent.click(canvas.getAllByRole("combobox")[25]);
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
+ );
348
734
  };
349
- const DefaultSelect = () => (
735
+
736
+ const SearchableSelect = () => (
350
737
  <ExampleContainer expanded>
351
- <Title title="Default select" theme="light" level={4} />
352
- <DxcSelect label="Select label" options={single_options} optional placeholder="Choose an option" />
738
+ <Title title="Searchable select" theme="light" level={4} />
739
+ <DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
353
740
  </ExampleContainer>
354
741
  );
355
- const SearchableSelect = () => (
742
+
743
+ const SearchableSelectOpinionated = () => (
356
744
  <ExampleContainer expanded>
357
745
  <Title title="Searchable select" theme="light" level={4} />
358
- <DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
746
+ <HalstackProvider theme={opinionatedTheme}>
747
+ <DxcSelect label="Select Label" searchable options={single_options} placeholder="Choose an option" />
748
+ </HalstackProvider>
359
749
  </ExampleContainer>
360
750
  );
361
- const SearchableWithValue = () => (
751
+
752
+ const SearchValue = () => (
362
753
  <ExampleContainer expanded>
363
754
  <Title title="Searchable select with value" theme="light" level={4} />
364
- <DxcSelect label="Select Label" searchable value="1" options={single_options} placeholder="Choose an option" />
755
+ <DxcSelect
756
+ label="Select Label"
757
+ searchable
758
+ defaultValue="1"
759
+ options={single_options}
760
+ placeholder="Choose an option"
761
+ />
762
+ </ExampleContainer>
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>
365
777
  </ExampleContainer>
366
778
  );
367
779
 
@@ -372,85 +784,73 @@ const MultipleSelect = () => (
372
784
  <DxcSelect
373
785
  label="Select label"
374
786
  options={single_options}
375
- value={["1", "4"]}
787
+ defaultValue={["1", "4"]}
376
788
  multiple
377
789
  placeholder="Choose an option"
378
790
  />
379
791
  </ExampleContainer>
380
792
  </>
381
793
  );
382
- const DefaultGroupedOptionsSelect = () => (
383
- <ExampleContainer expanded>
384
- <Title title="Grouped options simple select" theme="light" level={4} />
385
- <DxcSelect label="Label" options={group_options} value="9" placeholder="Choose an option" />
386
- </ExampleContainer>
387
- );
388
- const MultipleGroupedOptionsSelect = () => (
389
- <ExampleContainer expanded>
390
- <Title title="Grouped options multiple select" theme="light" level={4} />
391
- <DxcSelect label="Label" options={group_options} value={["0", "2"]} multiple placeholder="Choose an option" />
392
- </ExampleContainer>
393
- );
394
- const RescaledIcons = () => (
794
+
795
+ const MultipleSelectOpinioated = () => (
395
796
  <ExampleContainer expanded>
396
- <Title title="Rescaled icons displayed" theme="light" level={4} />
397
- <DxcSelect label="Label" options={url_options} value="facebook" placeholder="Choose an option" />
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>
398
807
  </ExampleContainer>
399
808
  );
400
- const SelectWithIcons = () => (
809
+
810
+ const DefaultGroupedOptionsSelect = () => (
401
811
  <ExampleContainer expanded>
402
- <Title title="Normal icons displayed" theme="light" level={4} />
403
- <DxcSelect label="Label" options={icon_options} value="3" placeholder="Choose an option" />
812
+ <Title title="Grouped options simple select" theme="light" level={4} />
813
+ <DxcSelect label="Label" options={group_options} defaultValue="9" placeholder="Choose an option" />
404
814
  </ExampleContainer>
405
815
  );
406
- const SelectMultipleWithIcons = () => (
816
+
817
+ const DefaultGroupedOptionsSelectOpinionated = () => (
407
818
  <ExampleContainer expanded>
408
- <Title title="Multiple select with icons" theme="light" level={4} />
409
- <DxcSelect label="Label" options={icon_options} multiple value={["1", "3"]} placeholder="Choose an option" />
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>
410
823
  </ExampleContainer>
411
824
  );
412
- const MultipleGroupedOptionsSelectWithIcons = () => (
825
+
826
+ const MultipleGroupedOptionsSelect = () => (
413
827
  <ExampleContainer expanded>
414
- <Title title="Multiple grouped options with icons" theme="light" level={4} />
828
+ <Title title="Grouped options multiple select" theme="light" level={4} />
415
829
  <DxcSelect
416
830
  label="Label"
417
- options={icon_options_grouped}
831
+ options={group_options}
832
+ defaultValue={["0", "2"]}
418
833
  multiple
419
- value={["3", "2"]}
420
834
  placeholder="Choose an option"
421
835
  />
422
836
  </ExampleContainer>
423
837
  );
424
- const OnlyOneOptionHovered = () => (
425
- <ExampleContainer pseudoState="pseudo-hover" expanded>
426
- <Title title="Hovered Option" theme="light" level={4} />
427
- <DxcSelect label="Hovered" options={one_option} placeholder="Choose an option" />
428
- </ExampleContainer>
429
- );
430
- const OnlyOneOptionFocused = () => (
431
- <ExampleContainer pseudoState="pseudo-focus" expanded>
432
- <Title title="Focused Option" theme="light" level={4} />
433
- <DxcSelect label="Focused" options={one_option} placeholder="Choose an option" />
434
- </ExampleContainer>
435
- );
436
- const OnlyOneOptionActived = () => (
437
- <ExampleContainer pseudoState="pseudo-active" expanded>
438
- <Title title="Actived Option" theme="light" level={4} />
439
- <DxcSelect label="Actived" options={one_option} placeholder="Choose an option" />
440
- </ExampleContainer>
441
- );
442
- const SelectedOptionHovered = () => (
443
- <ExampleContainer pseudoState="pseudo-hover" expanded>
444
- <Title title="Hovered Selected Option" theme="light" level={4} />
445
- <DxcSelect label="Hovered" value="1" options={one_option} placeholder="Choose an option" />
446
- </ExampleContainer>
447
- );
448
- const SelectedOptionActived = () => (
449
- <ExampleContainer pseudoState="pseudo-active" expanded>
450
- <Title title="Actived Selected Option" theme="light" level={4} />
451
- <DxcSelect label="Actived" value="1" options={one_option} placeholder="Choose an option" />
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>
452
851
  </ExampleContainer>
453
852
  );
853
+
454
854
  const MultipleSearchable = () => (
455
855
  <ExampleContainer expanded>
456
856
  <Title title="Searchable multiple select with value" theme="light" level={4} />
@@ -458,114 +858,113 @@ const MultipleSearchable = () => (
458
858
  label="Select Label"
459
859
  searchable
460
860
  multiple
461
- value={["1", "4"]}
861
+ defaultValue={["1", "4"]}
462
862
  options={single_options}
463
863
  placeholder="Choose an option"
464
864
  />
465
865
  </ExampleContainer>
466
866
  );
467
- export const OptionsDisplayed = DefaultSelect.bind({});
468
- OptionsDisplayed.play = async ({ canvasElement }) => {
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
+
884
+ export const Chromatic = Select.bind({});
885
+ Chromatic.play = async ({ canvasElement }) => {
886
+ const canvas = within(canvasElement);
887
+ await userEvent.click(canvas.getAllByRole("combobox")[24]);
888
+ };
889
+
890
+ export const ListboxStates = SelectListbox.bind({});
891
+ ListboxStates.play = async ({ canvasElement }) => {
469
892
  const canvas = within(canvasElement);
470
893
  const select = canvas.getByRole("combobox");
471
894
  await userEvent.click(select);
472
895
  };
896
+
473
897
  export const Searchable = SearchableSelect.bind({});
474
898
  Searchable.play = async ({ canvasElement }) => {
475
899
  const canvas = within(canvasElement);
476
- await userEvent.click(canvas.getByRole("combobox"));
477
- await waitFor(async () => {
478
- userEvent.type(canvas.getByRole("combobox"), "r");
479
- });
900
+ await userEvent.type(canvas.getByRole("combobox"), "r");
480
901
  };
481
- export const SelectSearchableWithValue = SearchableWithValue.bind({});
482
- SelectSearchableWithValue.play = async ({ canvasElement }) => {
902
+
903
+ export const SearchableOpinionated = SearchableSelectOpinionated.bind({});
904
+ SearchableOpinionated.play = async ({ canvasElement }) => {
483
905
  const canvas = within(canvasElement);
484
- await userEvent.click(canvas.getByRole("combobox"));
906
+ await userEvent.type(canvas.getByRole("combobox"), "r");
485
907
  };
486
908
 
487
- export const SelectMultipleSearchableWithValue = MultipleSearchable.bind({});
488
- SelectMultipleSearchableWithValue.play = async ({ canvasElement }) => {
909
+ export const SearchableWithValue = SearchValue.bind({});
910
+ SearchableWithValue.play = async ({ canvasElement }) => {
489
911
  const canvas = within(canvasElement);
490
- await userEvent.click(canvas.getAllByRole("combobox")[0]);
912
+ await userEvent.click(canvas.getByRole("combobox"));
491
913
  };
492
914
 
493
- export const GroupOptionsDisplayed = DefaultGroupedOptionsSelect.bind({});
494
- GroupOptionsDisplayed.play = async ({ canvasElement }) => {
915
+ export const SearchableWithValueOpinionated = SearchValueOpinionated.bind({});
916
+ SearchableWithValueOpinionated.play = async ({ canvasElement }) => {
495
917
  const canvas = within(canvasElement);
496
- const select = canvas.getByRole("combobox");
497
- await userEvent.click(select);
918
+ await userEvent.click(canvas.getByRole("combobox"));
498
919
  };
499
920
 
500
- export const SelectMultipleOptionsDisplayed = MultipleSelect.bind({});
501
- SelectMultipleOptionsDisplayed.play = async ({ canvasElement }) => {
921
+ export const MultipleSearchableWithValue = MultipleSearchable.bind({});
922
+ MultipleSearchableWithValue.play = async ({ canvasElement }) => {
502
923
  const canvas = within(canvasElement);
503
924
  await userEvent.click(canvas.getAllByRole("combobox")[0]);
504
925
  };
505
926
 
506
- export const SelectMultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
507
- SelectMultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
927
+ export const MultipleSearchableWithValueOpinionated = MultipleSearchableOpinionated.bind({});
928
+ MultipleSearchableWithValueOpinionated.play = async ({ canvasElement }) => {
508
929
  const canvas = within(canvasElement);
509
- const select = canvas.getByRole("combobox");
510
- await userEvent.click(select);
511
- };
512
- export const SelectWithIconsDisplayed = SelectWithIcons.bind({});
513
- SelectWithIconsDisplayed.play = async ({ canvasElement }) => {
514
- const canvas = within(canvasElement);
515
- const select = canvas.getByRole("combobox");
516
- await userEvent.click(select);
930
+ await userEvent.click(canvas.getAllByRole("combobox")[0]);
517
931
  };
518
932
 
519
- export const SelectWithRescaledIconsDisplayed = RescaledIcons.bind({});
520
- SelectWithRescaledIconsDisplayed.play = async ({ canvasElement }) => {
521
- const canvas = within(canvasElement);
522
- const select = canvas.getByRole("combobox");
523
- await userEvent.click(select);
524
- };
525
- export const SelectMultipleWithIconsDisplayed = SelectMultipleWithIcons.bind({});
526
- SelectMultipleWithIconsDisplayed.play = async ({ canvasElement }) => {
933
+ export const GroupOptionsDisplayed = DefaultGroupedOptionsSelect.bind({});
934
+ GroupOptionsDisplayed.play = async ({ canvasElement }) => {
527
935
  const canvas = within(canvasElement);
528
936
  const select = canvas.getByRole("combobox");
529
937
  await userEvent.click(select);
530
938
  };
531
939
 
532
- export const SelectMultipleGroupedWithIconsDisplayed = MultipleGroupedOptionsSelectWithIcons.bind({});
533
- SelectMultipleGroupedWithIconsDisplayed.play = async ({ canvasElement }) => {
940
+ export const GroupOptionsDisplayedOpinionated = DefaultGroupedOptionsSelectOpinionated.bind({});
941
+ GroupOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
534
942
  const canvas = within(canvasElement);
535
943
  const select = canvas.getByRole("combobox");
536
944
  await userEvent.click(select);
537
945
  };
538
946
 
539
- export const OptionHovered = OnlyOneOptionHovered.bind({});
540
- OptionHovered.play = async ({ canvasElement }) => {
947
+ export const MultipleOptionsDisplayed = MultipleSelect.bind({});
948
+ MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
541
949
  const canvas = within(canvasElement);
542
- const select = canvas.getByRole("combobox");
543
- await userEvent.click(select);
950
+ await userEvent.click(canvas.getAllByRole("combobox")[0]);
544
951
  };
545
952
 
546
- export const OptionFocused = OnlyOneOptionFocused.bind({});
547
- OptionFocused.play = async ({ canvasElement }) => {
548
- const canvas = within(canvasElement);
549
- const select = canvas.getByRole("combobox");
550
- await userEvent.click(select);
551
- await waitFor(async () => {
552
- fireEvent.keyDown(select, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
553
- });
554
- };
555
- export const OptionActived = OnlyOneOptionActived.bind({});
556
- OptionActived.play = async ({ canvasElement }) => {
953
+ export const MultipleOptionsDisplayedOpinionated = MultipleSelectOpinioated.bind({});
954
+ MultipleOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
557
955
  const canvas = within(canvasElement);
558
- const select = canvas.getByRole("combobox");
559
- await userEvent.click(select);
956
+ await userEvent.click(canvas.getAllByRole("combobox")[0]);
560
957
  };
561
- export const OptionSelectedHovered = SelectedOptionHovered.bind({});
562
- OptionSelectedHovered.play = async ({ canvasElement }) => {
958
+
959
+ export const MultipleGroupedOptionsDisplayed = MultipleGroupedOptionsSelect.bind({});
960
+ MultipleGroupedOptionsDisplayed.play = async ({ canvasElement }) => {
563
961
  const canvas = within(canvasElement);
564
962
  const select = canvas.getByRole("combobox");
565
963
  await userEvent.click(select);
566
964
  };
567
- export const OptionSelectedActived = SelectedOptionActived.bind({});
568
- OptionSelectedActived.play = async ({ canvasElement }) => {
965
+
966
+ export const MultipleGroupedOptionsDisplayedOpinionated = MultipleGroupedOptionsSelectOpinionated.bind({});
967
+ MultipleGroupedOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
569
968
  const canvas = within(canvasElement);
570
969
  const select = canvas.getByRole("combobox");
571
970
  await userEvent.click(select);