@dxc-technology/halstack-react 0.0.0-59b9187 → 0.0.0-5a4d834

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 (328) hide show
  1. package/BackgroundColorContext.js +1 -1
  2. package/HalstackContext.d.ts +41 -3
  3. package/HalstackContext.js +28 -18
  4. package/accordion/Accordion.accessibility.test.d.ts +1 -0
  5. package/accordion/Accordion.accessibility.test.js +4 -4
  6. package/accordion/Accordion.js +6 -9
  7. package/accordion/Accordion.stories.tsx +4 -14
  8. package/accordion/Accordion.test.d.ts +1 -0
  9. package/accordion/Accordion.test.js +3 -3
  10. package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
  11. package/accordion-group/AccordionGroup.accessibility.test.js +11 -17
  12. package/accordion-group/AccordionGroup.js +1 -1
  13. package/accordion-group/AccordionGroup.stories.tsx +23 -23
  14. package/accordion-group/AccordionGroup.test.d.ts +1 -0
  15. package/accordion-group/AccordionGroup.test.js +5 -9
  16. package/accordion-group/AccordionGroupAccordion.js +1 -1
  17. package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
  18. package/action-icon/ActionIcon.accessibility.test.js +4 -4
  19. package/action-icon/ActionIcon.test.d.ts +1 -0
  20. package/action-icon/ActionIcon.test.js +1 -1
  21. package/alert/Alert.accessibility.test.d.ts +1 -0
  22. package/alert/Alert.accessibility.test.js +6 -6
  23. package/alert/Alert.js +7 -4
  24. package/alert/Alert.test.d.ts +1 -0
  25. package/alert/Alert.test.js +1 -1
  26. package/badge/Badge.accessibility.test.d.ts +1 -0
  27. package/badge/Badge.accessibility.test.js +5 -5
  28. package/badge/Badge.test.d.ts +1 -0
  29. package/badge/Badge.test.js +2 -2
  30. package/bar-chart/BarChart.d.ts +4 -0
  31. package/bar-chart/BarChart.js +152 -0
  32. package/bar-chart/BarChart.stories.tsx +281 -0
  33. package/bar-chart/BarChart.test.d.ts +1 -0
  34. package/bar-chart/BarChart.test.js +194 -0
  35. package/bar-chart/theme.d.ts +3 -0
  36. package/bar-chart/theme.js +31 -0
  37. package/bar-chart/types.d.ts +137 -0
  38. package/bar-chart/types.js +5 -0
  39. package/bleed/Bleed.stories.tsx +0 -1
  40. package/box/Box.accessibility.test.d.ts +1 -0
  41. package/box/Box.accessibility.test.js +3 -3
  42. package/box/Box.js +1 -1
  43. package/box/Box.test.d.ts +1 -0
  44. package/box/Box.test.js +1 -1
  45. package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
  46. package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
  47. package/breadcrumbs/Breadcrumbs.d.ts +4 -0
  48. package/breadcrumbs/Breadcrumbs.js +79 -0
  49. package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
  50. package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
  51. package/breadcrumbs/Breadcrumbs.test.js +168 -0
  52. package/breadcrumbs/Item.d.ts +4 -0
  53. package/breadcrumbs/Item.js +52 -0
  54. package/breadcrumbs/dropdownTheme.d.ts +53 -0
  55. package/breadcrumbs/dropdownTheme.js +62 -0
  56. package/breadcrumbs/types.d.ts +40 -0
  57. package/breadcrumbs/types.js +5 -0
  58. package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
  59. package/bulleted-list/BulletedList.accessibility.test.js +18 -6
  60. package/bulleted-list/BulletedList.js +1 -1
  61. package/button/Button.accessibility.test.d.ts +1 -0
  62. package/button/Button.accessibility.test.js +6 -6
  63. package/button/Button.js +1 -1
  64. package/button/Button.stories.tsx +3 -3
  65. package/button/Button.test.d.ts +1 -0
  66. package/button/Button.test.js +1 -1
  67. package/card/Card.accessibility.test.d.ts +1 -0
  68. package/card/Card.accessibility.test.js +3 -3
  69. package/card/Card.js +3 -2
  70. package/card/Card.stories.tsx +1 -1
  71. package/card/Card.test.d.ts +1 -0
  72. package/card/Card.test.js +1 -1
  73. package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
  74. package/checkbox/Checkbox.accessibility.test.js +5 -5
  75. package/checkbox/Checkbox.js +10 -13
  76. package/checkbox/Checkbox.test.d.ts +1 -0
  77. package/checkbox/Checkbox.test.js +1 -1
  78. package/chip/Chip.accessibility.test.d.ts +1 -0
  79. package/chip/Chip.accessibility.test.js +4 -4
  80. package/chip/Chip.js +3 -1
  81. package/chip/Chip.stories.tsx +1 -1
  82. package/chip/Chip.test.d.ts +1 -0
  83. package/chip/Chip.test.js +1 -1
  84. package/common/coreTokens.d.ts +0 -1
  85. package/common/coreTokens.js +3 -4
  86. package/common/variables.d.ts +47 -3
  87. package/common/variables.js +109 -71
  88. package/container/Container.stories.tsx +3 -3
  89. package/container/types.d.ts +113 -11
  90. package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
  91. package/contextual-menu/ContextualMenu.accessibility.test.js +15 -3
  92. package/contextual-menu/ContextualMenu.d.ts +3 -5
  93. package/contextual-menu/ContextualMenu.js +118 -53
  94. package/contextual-menu/ContextualMenu.stories.tsx +124 -75
  95. package/contextual-menu/ContextualMenu.test.d.ts +1 -0
  96. package/contextual-menu/ContextualMenu.test.js +200 -24
  97. package/contextual-menu/GroupItem.d.ts +4 -0
  98. package/contextual-menu/GroupItem.js +67 -0
  99. package/contextual-menu/ItemAction.d.ts +4 -0
  100. package/contextual-menu/ItemAction.js +88 -0
  101. package/contextual-menu/MenuItem.d.ts +4 -0
  102. package/contextual-menu/MenuItem.js +29 -0
  103. package/contextual-menu/SingleItem.d.ts +4 -0
  104. package/contextual-menu/SingleItem.js +38 -0
  105. package/contextual-menu/types.d.ts +54 -11
  106. package/date-input/Calendar.js +47 -31
  107. package/date-input/DateInput.accessibility.test.d.ts +1 -0
  108. package/date-input/DateInput.accessibility.test.js +24 -11
  109. package/date-input/DateInput.js +27 -21
  110. package/date-input/DateInput.stories.tsx +18 -12
  111. package/date-input/DateInput.test.d.ts +1 -0
  112. package/date-input/DateInput.test.js +39 -39
  113. package/date-input/DatePicker.js +1 -1
  114. package/date-input/YearPicker.js +10 -5
  115. package/dialog/Dialog.accessibility.test.d.ts +1 -0
  116. package/dialog/Dialog.accessibility.test.js +5 -5
  117. package/dialog/Dialog.js +3 -2
  118. package/dialog/Dialog.stories.tsx +8 -4
  119. package/dialog/Dialog.test.d.ts +1 -0
  120. package/dialog/Dialog.test.js +111 -48
  121. package/divider/Divider.accessibility.test.d.ts +1 -0
  122. package/divider/Divider.accessibility.test.js +2 -2
  123. package/divider/Divider.stories.tsx +2 -1
  124. package/divider/Divider.test.d.ts +1 -0
  125. package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
  126. package/dropdown/Dropdown.accessibility.test.js +12 -9
  127. package/dropdown/Dropdown.js +19 -37
  128. package/dropdown/Dropdown.stories.tsx +11 -11
  129. package/dropdown/Dropdown.test.d.ts +1 -0
  130. package/dropdown/Dropdown.test.js +101 -72
  131. package/dropdown/DropdownMenu.js +4 -4
  132. package/dropdown/DropdownMenuItem.js +2 -1
  133. package/file-input/FileInput.accessibility.test.d.ts +1 -0
  134. package/file-input/FileInput.accessibility.test.js +30 -23
  135. package/file-input/FileInput.js +3 -8
  136. package/file-input/FileInput.test.d.ts +1 -0
  137. package/file-input/FileInput.test.js +44 -22
  138. package/file-input/FileItem.js +7 -3
  139. package/file-input/types.d.ts +0 -4
  140. package/footer/Footer.accessibility.test.d.ts +1 -0
  141. package/footer/Footer.accessibility.test.js +13 -5
  142. package/footer/Footer.js +1 -1
  143. package/footer/Footer.stories.tsx +12 -0
  144. package/footer/Footer.test.d.ts +1 -0
  145. package/footer/Footer.test.js +1 -1
  146. package/footer/Icons.js +2 -30
  147. package/grid/Grid.stories.tsx +3 -1
  148. package/header/Header.accessibility.test.d.ts +1 -0
  149. package/header/Header.accessibility.test.js +16 -6
  150. package/header/Header.js +3 -2
  151. package/header/Header.stories.tsx +17 -1
  152. package/header/Header.test.d.ts +1 -0
  153. package/header/Header.test.js +1 -1
  154. package/header/Icons.js +1 -6
  155. package/heading/Heading.accessibility.test.d.ts +1 -0
  156. package/heading/Heading.accessibility.test.js +3 -3
  157. package/heading/Heading.js +1 -1
  158. package/heading/Heading.test.d.ts +1 -0
  159. package/heading/Heading.test.js +1 -14
  160. package/icon/Icon.accessibility.test.d.ts +1 -0
  161. package/icon/Icon.accessibility.test.js +2 -2
  162. package/icon/Icon.js +1 -1
  163. package/icon/Icon.stories.tsx +1 -1
  164. package/image/Image.accessibility.test.d.ts +1 -0
  165. package/image/Image.accessibility.test.js +3 -3
  166. package/image/Image.js +1 -1
  167. package/layout/ApplicationLayout.js +4 -4
  168. package/link/Link.accessibility.test.d.ts +1 -0
  169. package/link/Link.accessibility.test.js +8 -12
  170. package/link/Link.js +1 -1
  171. package/link/Link.stories.tsx +2 -2
  172. package/link/Link.test.d.ts +1 -0
  173. package/link/Link.test.js +1 -1
  174. package/main.d.ts +3 -1
  175. package/main.js +15 -1
  176. package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
  177. package/nav-tabs/NavTabs.accessibility.test.js +3 -3
  178. package/nav-tabs/NavTabs.js +19 -4
  179. package/nav-tabs/NavTabs.stories.tsx +18 -3
  180. package/nav-tabs/NavTabs.test.d.ts +1 -0
  181. package/nav-tabs/NavTabs.test.js +9 -7
  182. package/nav-tabs/Tab.js +7 -7
  183. package/number-input/NumberInput.accessibility.test.d.ts +1 -0
  184. package/number-input/NumberInput.accessibility.test.js +9 -10
  185. package/number-input/NumberInput.js +6 -3
  186. package/number-input/NumberInput.stories.tsx +11 -16
  187. package/number-input/NumberInput.test.d.ts +1 -0
  188. package/number-input/NumberInput.test.js +6 -7
  189. package/package.json +27 -21
  190. package/paginator/Paginator.accessibility.test.d.ts +1 -0
  191. package/paginator/Paginator.accessibility.test.js +4 -5
  192. package/paginator/Paginator.js +9 -5
  193. package/paginator/Paginator.test.d.ts +1 -0
  194. package/paginator/Paginator.test.js +2 -3
  195. package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
  196. package/paragraph/Paragraph.accessibility.test.js +2 -2
  197. package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
  198. package/password-input/PasswordInput.accessibility.test.js +7 -8
  199. package/password-input/PasswordInput.js +11 -7
  200. package/password-input/PasswordInput.stories.tsx +10 -1
  201. package/password-input/PasswordInput.test.d.ts +1 -0
  202. package/password-input/PasswordInput.test.js +6 -7
  203. package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
  204. package/progress-bar/ProgressBar.accessibility.test.js +3 -3
  205. package/progress-bar/ProgressBar.js +6 -4
  206. package/progress-bar/ProgressBar.test.d.ts +1 -0
  207. package/progress-bar/ProgressBar.test.js +1 -1
  208. package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
  209. package/quick-nav/QuickNav.accessibility.test.js +2 -2
  210. package/quick-nav/QuickNav.js +1 -1
  211. package/radio-group/Radio.js +6 -9
  212. package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
  213. package/radio-group/RadioGroup.accessibility.test.js +4 -4
  214. package/radio-group/RadioGroup.js +14 -16
  215. package/radio-group/RadioGroup.test.d.ts +1 -0
  216. package/radio-group/RadioGroup.test.js +3 -5
  217. package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
  218. package/resultset-table/ResultsetTable.accessibility.test.js +16 -6
  219. package/resultset-table/ResultsetTable.js +41 -13
  220. package/resultset-table/ResultsetTable.stories.tsx +14 -2
  221. package/resultset-table/ResultsetTable.test.d.ts +1 -0
  222. package/resultset-table/ResultsetTable.test.js +103 -34
  223. package/resultset-table/types.d.ts +4 -3
  224. package/select/Listbox.d.ts +3 -3
  225. package/select/Listbox.js +29 -27
  226. package/select/Option.d.ts +3 -3
  227. package/select/Option.js +13 -8
  228. package/select/Select.accessibility.test.d.ts +1 -0
  229. package/select/Select.accessibility.test.js +18 -8
  230. package/select/Select.js +75 -190
  231. package/select/Select.stories.tsx +41 -20
  232. package/select/Select.test.d.ts +1 -0
  233. package/select/Select.test.js +42 -150
  234. package/select/selectUtils.d.ts +41 -0
  235. package/select/selectUtils.js +129 -0
  236. package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
  237. package/sidenav/Sidenav.accessibility.test.js +3 -3
  238. package/sidenav/Sidenav.js +1 -1
  239. package/sidenav/Sidenav.stories.tsx +1 -1
  240. package/sidenav/Sidenav.test.d.ts +1 -0
  241. package/sidenav/Sidenav.test.js +1 -1
  242. package/slider/Slider.accessibility.test.d.ts +1 -0
  243. package/slider/Slider.accessibility.test.js +5 -6
  244. package/slider/Slider.js +11 -13
  245. package/slider/Slider.stories.tsx +180 -0
  246. package/slider/Slider.test.d.ts +1 -0
  247. package/slider/Slider.test.js +13 -11
  248. package/spinner/Spinner.accessibility.test.d.ts +1 -0
  249. package/spinner/Spinner.accessibility.test.js +6 -6
  250. package/spinner/Spinner.d.ts +1 -1
  251. package/spinner/Spinner.js +32 -47
  252. package/spinner/Spinner.test.d.ts +1 -0
  253. package/spinner/Spinner.test.js +1 -1
  254. package/status-light/StatusLight.accessibility.test.d.ts +1 -0
  255. package/status-light/StatusLight.accessibility.test.js +8 -8
  256. package/status-light/StatusLight.test.d.ts +1 -0
  257. package/status-light/StatusLight.test.js +1 -1
  258. package/switch/Switch.accessibility.test.d.ts +1 -0
  259. package/switch/Switch.accessibility.test.js +14 -5
  260. package/switch/Switch.js +6 -9
  261. package/switch/Switch.stories.tsx +12 -0
  262. package/switch/Switch.test.d.ts +1 -0
  263. package/switch/Switch.test.js +1 -1
  264. package/table/Table.accessibility.test.d.ts +1 -0
  265. package/table/Table.accessibility.test.js +16 -6
  266. package/table/Table.js +1 -1
  267. package/table/Table.stories.tsx +13 -1
  268. package/table/Table.test.d.ts +1 -0
  269. package/table/Table.test.js +2 -4
  270. package/tabs/Tab.js +1 -1
  271. package/tabs/Tabs.accessibility.test.d.ts +1 -0
  272. package/tabs/Tabs.accessibility.test.js +3 -3
  273. package/tabs/Tabs.js +1 -1
  274. package/tabs/Tabs.stories.tsx +7 -1
  275. package/tabs/Tabs.test.d.ts +1 -0
  276. package/tabs/Tabs.test.js +1 -1
  277. package/tag/Tag.accessibility.test.d.ts +1 -0
  278. package/tag/Tag.accessibility.test.js +4 -4
  279. package/tag/Tag.js +1 -1
  280. package/tag/Tag.stories.tsx +1 -1
  281. package/tag/Tag.test.d.ts +1 -0
  282. package/tag/Tag.test.js +1 -1
  283. package/text-input/Suggestion.js +1 -1
  284. package/text-input/Suggestions.js +14 -6
  285. package/text-input/TextInput.accessibility.test.d.ts +1 -0
  286. package/text-input/TextInput.accessibility.test.js +11 -12
  287. package/text-input/TextInput.js +49 -68
  288. package/text-input/TextInput.stories.tsx +19 -7
  289. package/text-input/TextInput.test.d.ts +1 -0
  290. package/text-input/TextInput.test.js +2 -3
  291. package/textarea/Textarea.accessibility.test.d.ts +1 -0
  292. package/textarea/Textarea.accessibility.test.js +7 -7
  293. package/textarea/Textarea.js +14 -13
  294. package/textarea/Textarea.test.d.ts +1 -0
  295. package/textarea/Textarea.test.js +1 -1
  296. package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
  297. package/toggle-group/ToggleGroup.accessibility.test.js +5 -5
  298. package/toggle-group/ToggleGroup.js +6 -9
  299. package/toggle-group/ToggleGroup.stories.tsx +1 -1
  300. package/toggle-group/ToggleGroup.test.d.ts +1 -0
  301. package/toggle-group/ToggleGroup.test.js +1 -1
  302. package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
  303. package/tooltip/Tooltip.accessibility.test.js +144 -0
  304. package/tooltip/Tooltip.d.ts +4 -0
  305. package/tooltip/Tooltip.js +50 -0
  306. package/tooltip/Tooltip.stories.tsx +111 -0
  307. package/tooltip/Tooltip.test.d.ts +1 -0
  308. package/tooltip/Tooltip.test.js +112 -0
  309. package/tooltip/types.d.ts +16 -0
  310. package/tooltip/types.js +5 -0
  311. package/typography/Typography.accessibility.test.d.ts +1 -0
  312. package/typography/Typography.accessibility.test.js +12 -12
  313. package/typography/Typography.stories.tsx +1 -3
  314. package/typography/Typography.test.js +23 -0
  315. package/useTheme.d.ts +30 -3
  316. package/useTranslatedLabels.d.ts +11 -0
  317. package/utils/BaseTypography.js +45 -41
  318. package/utils/FocusLock.js +3 -2
  319. package/utils/useWidth.d.ts +2 -0
  320. package/utils/useWidth.js +30 -0
  321. package/wizard/Wizard.accessibility.test.d.ts +1 -0
  322. package/wizard/Wizard.accessibility.test.js +3 -3
  323. package/wizard/Wizard.js +1 -9
  324. package/wizard/Wizard.stories.tsx +1 -1
  325. package/wizard/Wizard.test.d.ts +1 -0
  326. package/wizard/Wizard.test.js +1 -1
  327. package/contextual-menu/MenuItemAction.d.ts +0 -4
  328. package/contextual-menu/MenuItemAction.js +0 -46
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { userEvent, within } from "@storybook/testing-library";
2
+ import { userEvent, within } from "@storybook/test";
3
3
  import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
5
  import DxcSelect from "./Select";
@@ -7,10 +7,23 @@ import Listbox from "./Listbox";
7
7
  import { ThemeProvider } from "styled-components";
8
8
  import useTheme from "../useTheme";
9
9
  import { HalstackProvider } from "../HalstackContext";
10
+ import { disabledRules } from "../../test/accessibility/rules/specific/select/disabledRules";
11
+ import preview from "../../.storybook/preview";
12
+ import DxcFlex from "../flex/Flex";
10
13
 
11
14
  export default {
12
15
  title: "Select",
13
16
  component: DxcSelect,
17
+ parameters: {
18
+ a11y: {
19
+ config: {
20
+ rules: [
21
+ ...disabledRules.map((ruleId) => ({ id: ruleId, reviewOnFail: true })),
22
+ ...preview?.parameters?.a11y?.config?.rules,
23
+ ],
24
+ },
25
+ },
26
+ },
14
27
  };
15
28
 
16
29
  const one_option = [{ label: "Option 01", value: "1" }];
@@ -293,6 +306,14 @@ const Select = () => (
293
306
  <Title title="Fillparent size" theme="light" level={4} />
294
307
  <DxcSelect label="Fillparent" options={single_options} size="fillParent" />
295
308
  </ExampleContainer>
309
+ <ExampleContainer>
310
+ <Title title="Different sizes inside a flex" theme="light" level={4} />
311
+ <DxcFlex justifyContent="space-between" gap="1rem">
312
+ <DxcSelect label="fillParent" size="fillParent" options={single_options} />
313
+ <DxcSelect label="medium" size="medium" options={single_options} />
314
+ <DxcSelect label="large" size="large" options={single_options} />
315
+ </DxcFlex>
316
+ </ExampleContainer>
296
317
  <Title title="Margins" theme="light" level={2} />
297
318
  <ExampleContainer>
298
319
  <Title title="xxsmall margin" theme="light" level={4} />
@@ -390,7 +411,7 @@ const Select = () => (
390
411
  );
391
412
 
392
413
  const SelectListbox = () => {
393
- const colorsTheme: any = useTheme();
414
+ const colorsTheme = useTheme();
394
415
 
395
416
  return (
396
417
  <>
@@ -426,7 +447,7 @@ const SelectListbox = () => {
426
447
  <ExampleContainer pseudoState="pseudo-hover">
427
448
  <Title title="Hovered option" theme="light" level={4} />
428
449
  <Listbox
429
- id="x"
450
+ id="x8"
430
451
  currentValue=""
431
452
  options={one_option}
432
453
  visualFocusIndex={-1}
@@ -442,7 +463,7 @@ const SelectListbox = () => {
442
463
  <ExampleContainer pseudoState="pseudo-active">
443
464
  <Title title="Active option" theme="light" level={4} />
444
465
  <Listbox
445
- id="x"
466
+ id="x9"
446
467
  currentValue=""
447
468
  options={one_option}
448
469
  visualFocusIndex={-1}
@@ -458,7 +479,7 @@ const SelectListbox = () => {
458
479
  <ExampleContainer>
459
480
  <Title title="Focused option" theme="light" level={4} />
460
481
  <Listbox
461
- id="x"
482
+ id="x10"
462
483
  currentValue=""
463
484
  options={one_option}
464
485
  visualFocusIndex={0}
@@ -474,7 +495,7 @@ const SelectListbox = () => {
474
495
  <ExampleContainer pseudoState="pseudo-hover">
475
496
  <Title title="Hovered selected option" theme="light" level={4} />
476
497
  <Listbox
477
- id="x"
498
+ id="x11"
478
499
  currentValue="1"
479
500
  options={single_options}
480
501
  visualFocusIndex={-1}
@@ -490,7 +511,7 @@ const SelectListbox = () => {
490
511
  <ExampleContainer pseudoState="pseudo-active">
491
512
  <Title title="Active selected option" theme="light" level={4} />
492
513
  <Listbox
493
- id="x"
514
+ id="x12"
494
515
  currentValue="2"
495
516
  options={single_options}
496
517
  visualFocusIndex={0}
@@ -507,7 +528,7 @@ const SelectListbox = () => {
507
528
  <ExampleContainer>
508
529
  <Title title="Icons (SVGs)" theme="light" level={4} />
509
530
  <Listbox
510
- id="x"
531
+ id="x13"
511
532
  currentValue="3"
512
533
  options={icon_options}
513
534
  visualFocusIndex={-1}
@@ -523,8 +544,8 @@ const SelectListbox = () => {
523
544
  <ExampleContainer>
524
545
  <Title title="Grouped icons (Material Symbols)" theme="light" level={4} />
525
546
  <Listbox
526
- id="x"
527
- currentValue={["0", "3"]}
547
+ id="x14"
548
+ currentValue={"4"}
528
549
  options={icon_options_grouped_material}
529
550
  visualFocusIndex={-1}
530
551
  lastOptionIndex={3}
@@ -539,8 +560,8 @@ const SelectListbox = () => {
539
560
  <ExampleContainer>
540
561
  <Title title="Grouped icons (Material)" theme="light" level={4} />
541
562
  <Listbox
542
- id="x"
543
- currentValue={["facebook", "figma"]}
563
+ id="x15"
564
+ currentValue={["car", "motorcycle", "train"]}
544
565
  options={options_material}
545
566
  visualFocusIndex={-1}
546
567
  lastOptionIndex={6}
@@ -559,7 +580,7 @@ const SelectListbox = () => {
559
580
  <Title title="Hovered option" theme="light" level={4} />
560
581
  <HalstackProvider theme={opinionatedTheme}>
561
582
  <Listbox
562
- id="x"
583
+ id="x16"
563
584
  currentValue=""
564
585
  options={one_option}
565
586
  visualFocusIndex={-1}
@@ -577,7 +598,7 @@ const SelectListbox = () => {
577
598
  <Title title="Active option" theme="light" level={4} />{" "}
578
599
  <HalstackProvider theme={opinionatedTheme}>
579
600
  <Listbox
580
- id="x"
601
+ id="x17"
581
602
  currentValue=""
582
603
  options={one_option}
583
604
  visualFocusIndex={-1}
@@ -595,7 +616,7 @@ const SelectListbox = () => {
595
616
  <Title title="Focused option" theme="light" level={4} />{" "}
596
617
  <HalstackProvider theme={opinionatedTheme}>
597
618
  <Listbox
598
- id="x"
619
+ id="x18"
599
620
  currentValue=""
600
621
  options={one_option}
601
622
  visualFocusIndex={0}
@@ -613,7 +634,7 @@ const SelectListbox = () => {
613
634
  <Title title="Hovered selected option" theme="light" level={4} />{" "}
614
635
  <HalstackProvider theme={opinionatedTheme}>
615
636
  <Listbox
616
- id="x"
637
+ id="x19"
617
638
  currentValue="1"
618
639
  options={single_options}
619
640
  visualFocusIndex={-1}
@@ -631,7 +652,7 @@ const SelectListbox = () => {
631
652
  <Title title="Active selected option" theme="light" level={4} />{" "}
632
653
  <HalstackProvider theme={opinionatedTheme}>
633
654
  <Listbox
634
- id="x"
655
+ id="x20"
635
656
  currentValue="2"
636
657
  options={single_options}
637
658
  visualFocusIndex={0}
@@ -650,7 +671,7 @@ const SelectListbox = () => {
650
671
  <Title title="Icons (SVGs)" theme="light" level={4} />{" "}
651
672
  <HalstackProvider theme={opinionatedTheme}>
652
673
  <Listbox
653
- id="x"
674
+ id="x21"
654
675
  currentValue="3"
655
676
  options={icon_options}
656
677
  visualFocusIndex={-1}
@@ -728,7 +749,7 @@ const MultipleSelect = () => (
728
749
  </>
729
750
  );
730
751
 
731
- const MultipleSelectOpinioated = () => (
752
+ const MultipleSelectOpinionated = () => (
732
753
  <ExampleContainer expanded>
733
754
  <Title title="Multiple select" theme="light" level={4} />
734
755
  <HalstackProvider theme={opinionatedTheme}>
@@ -886,7 +907,7 @@ MultipleOptionsDisplayed.play = async ({ canvasElement }) => {
886
907
  await userEvent.click(canvas.getAllByRole("combobox")[0]);
887
908
  };
888
909
 
889
- export const MultipleOptionsDisplayedOpinionated = MultipleSelectOpinioated.bind({});
910
+ export const MultipleOptionsDisplayedOpinionated = MultipleSelectOpinionated.bind({});
890
911
  MultipleOptionsDisplayedOpinionated.play = async ({ canvasElement }) => {
891
912
  const canvas = within(canvasElement);
892
913
  await userEvent.click(canvas.getAllByRole("combobox")[0]);
@@ -0,0 +1 @@
1
+ export {};
@@ -8,7 +8,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@testing-library/react");
10
10
  var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
11
- var _Select = _interopRequireDefault(require("./Select.tsx"));
11
+ var _Select = _interopRequireDefault(require("./Select"));
12
12
  // Mocking DOMRect for Radix Primitive Popover
13
13
  global.globalThis = global;
14
14
  global.DOMRect = {
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
27
27
  function ResizeObserver() {
28
28
  (0, _classCallCheck2["default"])(this, ResizeObserver);
29
29
  }
30
- (0, _createClass2["default"])(ResizeObserver, [{
30
+ return (0, _createClass2["default"])(ResizeObserver, [{
31
31
  key: "observe",
32
32
  value: function observe() {}
33
33
  }, {
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
37
37
  key: "disconnect",
38
38
  value: function disconnect() {}
39
39
  }]);
40
- return ResizeObserver;
41
40
  }();
42
41
  var singleOptions = [{
43
42
  label: "Option 01",
@@ -100,70 +99,6 @@ var singleOptions = [{
100
99
  label: "Option 20",
101
100
  value: "20"
102
101
  }];
103
- var svgIconOptions = [{
104
- label: "3G Mobile",
105
- value: "1",
106
- icon: /*#__PURE__*/_react["default"].createElement("svg", {
107
- xmlns: "http://www.w3.org/2000/svg",
108
- height: "24px",
109
- viewBox: "0 0 24 24",
110
- width: "24px",
111
- fill: "currentColor"
112
- }, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
113
- d: "M0,0h24v24H0V0z",
114
- fill: "none"
115
- })), /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
116
- d: "M3,7v2h5v2H4v2h4v2H3v2h5c1.1,0,2-0.9,2-2v-1.5c0-0.83-0.67-1.5-1.5-1.5c0.83,0,1.5-0.67,1.5-1.5V9c0-1.1-0.9-2-2-2H3z M21,11v4c0,1.1-0.9,2-2,2h-5c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h5c1.1,0,2,0.9,2,2h-7v6h5v-2h-2.5v-2H21z"
117
- }))))
118
- }, {
119
- label: "Ethernet",
120
- value: "2",
121
- icon: /*#__PURE__*/_react["default"].createElement("svg", {
122
- xmlns: "http://www.w3.org/2000/svg",
123
- height: "24px",
124
- viewBox: "0 0 24 24",
125
- width: "24px",
126
- fill: "currentColor"
127
- }, /*#__PURE__*/_react["default"].createElement("path", {
128
- d: "M0 0h24v24H0V0z",
129
- fill: "none"
130
- }), /*#__PURE__*/_react["default"].createElement("path", {
131
- d: "M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z"
132
- }))
133
- }, {
134
- label: "Wi-fi",
135
- value: "3",
136
- icon: /*#__PURE__*/_react["default"].createElement("svg", {
137
- xmlns: "http://www.w3.org/2000/svg",
138
- height: "24px",
139
- viewBox: "0 0 24 24",
140
- width: "24px",
141
- fill: "currentColor"
142
- }, /*#__PURE__*/_react["default"].createElement("path", {
143
- d: "M0 0h24v24H0V0zm0 0h24v24H0V0z",
144
- fill: "none"
145
- }), /*#__PURE__*/_react["default"].createElement("path", {
146
- d: "M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z"
147
- }))
148
- }, {
149
- label: "Settings backup restore (just for previous configuration)",
150
- value: "4",
151
- icon: /*#__PURE__*/_react["default"].createElement("svg", {
152
- xmlns: "http://www.w3.org/2000/svg",
153
- height: "24px",
154
- viewBox: "0 0 24 24",
155
- width: "24px",
156
- fill: "currentColor"
157
- }, /*#__PURE__*/_react["default"].createElement("path", {
158
- d: "M0 0h24v24H0V0z",
159
- fill: "none"
160
- }), /*#__PURE__*/_react["default"].createElement("path", {
161
- d: "M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9z"
162
- }))
163
- }, {
164
- label: "Regular",
165
- value: "Regular"
166
- }];
167
102
  var groupOptions = [{
168
103
  label: "Colores",
169
104
  options: [{
@@ -228,41 +163,6 @@ var groupOptions = [{
228
163
  value: "ebro"
229
164
  }]
230
165
  }];
231
- var groupedIconOptions = [{
232
- label: "Transport",
233
- options: [{
234
- label: "Electric Car",
235
- value: "car",
236
- icon: "electric_car"
237
- }, {
238
- label: "Motorcycle",
239
- value: "motorcycle",
240
- icon: "Motorcycle"
241
- }, {
242
- label: "Train",
243
- value: "train",
244
- icon: "train"
245
- }, {
246
- label: "Bike",
247
- value: "bike",
248
- icon: "pedal_bike"
249
- }]
250
- }, {
251
- label: "Entertainment",
252
- options: [{
253
- label: "Movie",
254
- value: "movie",
255
- icon: "movie"
256
- }, {
257
- label: "Music",
258
- value: "music",
259
- icon: "music_note"
260
- }, {
261
- label: "Games",
262
- value: "games",
263
- icon: "joystick"
264
- }]
265
- }];
266
166
  describe("Select component tests", function () {
267
167
  test("When clicking the label, the focus goes to the select", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
268
168
  var _render, getByText, getByRole, select, label;
@@ -272,7 +172,8 @@ describe("Select component tests", function () {
272
172
  _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Select["default"], {
273
173
  label: "test-select-label",
274
174
  helperText: "test-select-helper-text",
275
- placeholder: "Example text"
175
+ placeholder: "Example text",
176
+ options: singleOptions
276
177
  })), getByText = _render.getByText, getByRole = _render.getByRole;
277
178
  select = getByRole("combobox");
278
179
  label = getByText("test-select-label");
@@ -289,7 +190,8 @@ describe("Select component tests", function () {
289
190
  test("Renders with correct aria attributes when is in error state", function () {
290
191
  var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Select["default"], {
291
192
  label: "Error label",
292
- error: "Error message."
193
+ error: "Error message.",
194
+ options: singleOptions
293
195
  })),
294
196
  getByText = _render2.getByText,
295
197
  getByRole = _render2.getByRole;
@@ -382,15 +284,12 @@ describe("Select component tests", function () {
382
284
  _context4.next = 8;
383
285
  return _userEvent["default"].click(select);
384
286
  case 8:
385
- expect(getAllByRole("option")[3].getAttribute("aria-selected")).toBe("true");
386
- expect(getAllByRole("option")[1].getAttribute("aria-selected")).toBe("true");
387
- expect(getAllByRole("option")[5].getAttribute("aria-selected")).toBe("true");
388
- _context4.next = 13;
287
+ _context4.next = 10;
389
288
  return _userEvent["default"].click(getAllByRole("option")[2]);
390
- case 13:
289
+ case 10:
391
290
  expect(getByText("Option 02, Option 03, Option 04, Option 06")).toBeTruthy();
392
291
  expect(submitInput.value).toBe("4,2,6,3");
393
- case 15:
292
+ case 12:
394
293
  case "end":
395
294
  return _context4.stop();
396
295
  }
@@ -481,6 +380,7 @@ describe("Select component tests", function () {
481
380
  label: "test-select-label",
482
381
  value: ["1", "2"],
483
382
  options: singleOptions,
383
+ multiple: true,
484
384
  disabled: true
485
385
  })), getByRole = _render8.getByRole, queryByRole = _render8.queryByRole;
486
386
  select = getByRole("combobox");
@@ -1320,10 +1220,8 @@ describe("Select component tests", function () {
1320
1220
  });
1321
1221
  expect(queryByRole("listbox")).toBeTruthy();
1322
1222
  expect(getByText("Option 11, Option 19")).toBeTruthy();
1323
- expect(getAllByRole("option")[10].getAttribute("aria-selected")).toBe("true");
1324
- expect(getAllByRole("option")[18].getAttribute("aria-selected")).toBe("true");
1325
1223
  expect(submitInput.value).toBe("11,19");
1326
- case 21:
1224
+ case 19:
1327
1225
  case "end":
1328
1226
  return _context30.stop();
1329
1227
  }
@@ -1399,15 +1297,14 @@ describe("Select component tests", function () {
1399
1297
  return _userEvent["default"].click(select);
1400
1298
  case 6:
1401
1299
  expect(getAllByText("Choose an option").length).toBe(1);
1402
- expect(getAllByRole("option")[0].getAttribute("aria-selected")).toBe("false");
1403
- _context32.next = 10;
1300
+ _context32.next = 9;
1404
1301
  return _userEvent["default"].click(getAllByRole("option")[0]);
1405
- case 10:
1302
+ case 9:
1406
1303
  expect(onChange).toHaveBeenCalledWith({
1407
1304
  value: ["1"]
1408
1305
  });
1409
1306
  expect(getAllByText("Option 01").length).toBe(2);
1410
- case 12:
1307
+ case 11:
1411
1308
  case "end":
1412
1309
  return _context32.stop();
1413
1310
  }
@@ -1566,7 +1463,7 @@ describe("Select component tests", function () {
1566
1463
  _context35.next = 4;
1567
1464
  return _userEvent["default"].click(select);
1568
1465
  case 4:
1569
- listbox = getByRole("listbox");
1466
+ listbox = getByRole("list");
1570
1467
  expect(listbox).toBeTruthy();
1571
1468
  expect(select.getAttribute("aria-expanded")).toBe("true");
1572
1469
  expect(getByText("Colores")).toBeTruthy();
@@ -1574,7 +1471,7 @@ describe("Select component tests", function () {
1574
1471
  expect(getByText("Negro")).toBeTruthy();
1575
1472
  expect(getByText("Ciudades españolas")).toBeTruthy();
1576
1473
  expect(getByText("Madrid")).toBeTruthy();
1577
- groups = getAllByRole("group");
1474
+ groups = getAllByRole("listbox");
1578
1475
  expect(groups.length).toBe(3);
1579
1476
  groupLabels = getAllByRole("presentation");
1580
1477
  expect(groups[0].getAttribute("aria-labelledby")).toBe(groupLabels[0].id);
@@ -1584,7 +1481,7 @@ describe("Select component tests", function () {
1584
1481
  _context35.next = 21;
1585
1482
  return _userEvent["default"].click(select);
1586
1483
  case 21:
1587
- expect(queryByRole("listbox")).toBeFalsy();
1484
+ expect(queryByRole("list")).toBeFalsy();
1588
1485
  expect(select.getAttribute("aria-expanded")).toBe("false");
1589
1486
  case 23:
1590
1487
  case "end":
@@ -1608,7 +1505,7 @@ describe("Select component tests", function () {
1608
1505
  _context36.next = 4;
1609
1506
  return _userEvent["default"].click(select);
1610
1507
  case 4:
1611
- expect(queryByRole("listbox")).toBeFalsy();
1508
+ expect(queryByRole("list")).toBeFalsy();
1612
1509
  expect(select.getAttribute("aria-expanded")).toBe("false");
1613
1510
  case 6:
1614
1511
  case "end":
@@ -1639,7 +1536,7 @@ describe("Select component tests", function () {
1639
1536
  expect(onChange).toHaveBeenCalledWith({
1640
1537
  value: "oviedo"
1641
1538
  });
1642
- expect(queryByRole("listbox")).toBeFalsy();
1539
+ expect(queryByRole("list")).toBeFalsy();
1643
1540
  expect(getByText("Oviedo")).toBeTruthy();
1644
1541
  _context37.next = 13;
1645
1542
  return _userEvent["default"].click(select);
@@ -1755,7 +1652,7 @@ describe("Select component tests", function () {
1755
1652
  keyCode: 38,
1756
1653
  charCode: 38
1757
1654
  });
1758
- expect(queryByRole("listbox")).toBeTruthy();
1655
+ expect(queryByRole("list")).toBeTruthy();
1759
1656
  expect(select.getAttribute("aria-activedescendant")).toBe("option-17");
1760
1657
  });
1761
1658
  test("Grouped Options: Arrow up key - Puts the focus in last option when the first one is visually focused", function () {
@@ -1778,7 +1675,7 @@ describe("Select component tests", function () {
1778
1675
  keyCode: 38,
1779
1676
  charCode: 38
1780
1677
  });
1781
- expect(queryByRole("listbox")).toBeTruthy();
1678
+ expect(queryByRole("list")).toBeTruthy();
1782
1679
  expect(select.getAttribute("aria-activedescendant")).toBe("option-17");
1783
1680
  });
1784
1681
  test("Grouped Options: Arrow down key - Opens the listbox and visually focus the first option", function () {
@@ -1795,7 +1692,7 @@ describe("Select component tests", function () {
1795
1692
  keyCode: 40,
1796
1693
  charCode: 40
1797
1694
  });
1798
- expect(queryByRole("listbox")).toBeTruthy();
1695
+ expect(queryByRole("list")).toBeTruthy();
1799
1696
  expect(select.getAttribute("aria-activedescendant")).toBe("option-0");
1800
1697
  });
1801
1698
  test("Grouped Options: Arrow down key - Puts the focus in the first option when the last one is visually focused", function () {
@@ -1818,7 +1715,7 @@ describe("Select component tests", function () {
1818
1715
  keyCode: 40,
1819
1716
  charCode: 40
1820
1717
  });
1821
- expect(queryByRole("listbox")).toBeTruthy();
1718
+ expect(queryByRole("list")).toBeTruthy();
1822
1719
  expect(select.getAttribute("aria-activedescendant")).toBe("option-0");
1823
1720
  });
1824
1721
  test("Grouped Options: Enter key - Selects the visually focused option and closes the listbox", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee40() {
@@ -1867,7 +1764,7 @@ describe("Select component tests", function () {
1867
1764
  expect(onChange).toHaveBeenCalledWith({
1868
1765
  value: "ebro"
1869
1766
  });
1870
- expect(queryByRole("listbox")).toBeFalsy();
1767
+ expect(queryByRole("list")).toBeFalsy();
1871
1768
  expect(getByText("Ebro")).toBeTruthy();
1872
1769
  _context40.next = 13;
1873
1770
  return _userEvent["default"].click(select);
@@ -1896,29 +1793,28 @@ describe("Select component tests", function () {
1896
1793
  _context41.next = 6;
1897
1794
  return _userEvent["default"].click(select);
1898
1795
  case 6:
1899
- expect(getByRole("listbox")).toBeTruthy();
1796
+ expect(getByRole("list")).toBeTruthy();
1900
1797
  _context41.next = 9;
1901
1798
  return _userEvent["default"].type(searchInput, "ro");
1902
1799
  case 9:
1903
- expect(getAllByRole("group").length).toBe(2);
1904
1800
  expect(getAllByRole("presentation").length).toBe(2);
1905
1801
  expect(getAllByRole("option").length).toBe(5);
1906
1802
  expect(getByText("Colores")).toBeTruthy();
1907
1803
  expect(getByText("Ríos españoles")).toBeTruthy();
1908
- _context41.next = 16;
1804
+ _context41.next = 15;
1909
1805
  return _userEvent["default"].click(getAllByRole("option")[4]);
1910
- case 16:
1806
+ case 15:
1911
1807
  expect(onChange).toHaveBeenCalledWith({
1912
1808
  value: "ebro"
1913
1809
  });
1914
- expect(queryByRole("listbox")).toBeFalsy();
1810
+ expect(queryByRole("list")).toBeFalsy();
1915
1811
  expect(getByText("Ebro")).toBeTruthy();
1916
1812
  expect(searchInput.value).toBe("");
1917
- _context41.next = 22;
1813
+ _context41.next = 21;
1918
1814
  return _userEvent["default"].click(select);
1919
- case 22:
1815
+ case 21:
1920
1816
  expect(getAllByRole("option")[17].getAttribute("aria-selected")).toBe("true");
1921
- case 23:
1817
+ case 22:
1922
1818
  case "end":
1923
1819
  return _context41.stop();
1924
1820
  }
@@ -1941,7 +1837,7 @@ describe("Select component tests", function () {
1941
1837
  _context42.next = 6;
1942
1838
  return _userEvent["default"].click(select);
1943
1839
  case 6:
1944
- expect(getByRole("listbox")).toBeTruthy();
1840
+ expect(getByRole("list")).toBeTruthy();
1945
1841
  _context42.next = 9;
1946
1842
  return _userEvent["default"].type(searchInput, "very long string");
1947
1843
  case 9:
@@ -1970,14 +1866,13 @@ describe("Select component tests", function () {
1970
1866
  _context43.next = 6;
1971
1867
  return _userEvent["default"].click(select);
1972
1868
  case 6:
1973
- expect(getByRole("listbox").getAttribute("aria-multiselectable")).toBe("true");
1974
- _context43.next = 9;
1869
+ _context43.next = 8;
1975
1870
  return _userEvent["default"].click(getAllByRole("option")[10]);
1976
- case 9:
1871
+ case 8:
1977
1872
  expect(onChange).toHaveBeenCalledWith({
1978
1873
  value: ["bilbao"]
1979
1874
  });
1980
- expect(queryByRole("listbox")).toBeTruthy();
1875
+ expect(queryByRole("list")).toBeTruthy();
1981
1876
  expect(getAllByText("Bilbao").length).toBe(2);
1982
1877
  _react2.fireEvent.keyDown(select, {
1983
1878
  key: "ArrowUp",
@@ -2000,12 +1895,10 @@ describe("Select component tests", function () {
2000
1895
  expect(onChange).toHaveBeenCalledWith({
2001
1896
  value: ["bilbao", "guadalquivir"]
2002
1897
  });
2003
- expect(queryByRole("listbox")).toBeTruthy();
1898
+ expect(queryByRole("list")).toBeTruthy();
2004
1899
  expect(getByText("Bilbao, Guadalquivir")).toBeTruthy();
2005
- expect(getAllByRole("option")[10].getAttribute("aria-selected")).toBe("true");
2006
- expect(getAllByRole("option")[16].getAttribute("aria-selected")).toBe("true");
2007
1900
  expect(submitInput.value).toBe("bilbao,guadalquivir");
2008
- case 21:
1901
+ case 18:
2009
1902
  case "end":
2010
1903
  return _context43.stop();
2011
1904
  }
@@ -2042,7 +1935,7 @@ describe("Select component tests", function () {
2042
1935
  expect(onChange).toHaveBeenCalledWith({
2043
1936
  value: ["blanco", "oviedo", "duero", "ebro"]
2044
1937
  });
2045
- expect(queryByRole("listbox")).toBeTruthy();
1938
+ expect(queryByRole("list")).toBeTruthy();
2046
1939
  expect(getByText("Blanco, Oviedo, Duero, Ebro")).toBeTruthy();
2047
1940
  expect(getByText("4", {
2048
1941
  exact: true
@@ -2050,7 +1943,7 @@ describe("Select component tests", function () {
2050
1943
  _context44.next = 19;
2051
1944
  return _userEvent["default"].click(getByTitle("Clear selection"));
2052
1945
  case 19:
2053
- expect(queryByRole("listbox")).toBeTruthy();
1946
+ expect(queryByRole("list")).toBeTruthy();
2054
1947
  expect(queryByText("Blanco, Oviedo, Duero, Ebro")).toBeFalsy();
2055
1948
  expect(queryByText("4")).toBeFalsy();
2056
1949
  expect(queryByTitle("Clear selection")).toBeFalsy();
@@ -2080,15 +1973,14 @@ describe("Select component tests", function () {
2080
1973
  return _userEvent["default"].click(select);
2081
1974
  case 6:
2082
1975
  expect(getAllByText("Choose an option").length).toBe(1);
2083
- expect(getAllByRole("option")[0].getAttribute("aria-selected")).toBe("false");
2084
- _context45.next = 10;
1976
+ _context45.next = 9;
2085
1977
  return _userEvent["default"].click(getAllByRole("option")[0]);
2086
- case 10:
1978
+ case 9:
2087
1979
  expect(onChange).toHaveBeenCalledWith({
2088
1980
  value: ["azul"]
2089
1981
  });
2090
1982
  expect(getAllByText("Azul").length).toBe(2);
2091
- case 12:
1983
+ case 11:
2092
1984
  case "end":
2093
1985
  return _context45.stop();
2094
1986
  }
@@ -0,0 +1,41 @@
1
+ import { Option, OptionGroup } from "./types";
2
+ /**
3
+ * Check if the value is not optional and is empty.
4
+ */
5
+ declare const notOptionalCheck: (value: string | string[], multiple: boolean, optional: boolean) => boolean;
6
+ /**
7
+ * Checks if the option is a group.
8
+ */
9
+ declare const isOptionGroup: (option: Option | OptionGroup) => option is OptionGroup;
10
+ /**
11
+ * Checks if the options are an array of groups.
12
+ */
13
+ declare const isArrayOfOptionGroups: (options: Option[] | OptionGroup[]) => options is OptionGroup[];
14
+ /**
15
+ * Checks if the groups have options.
16
+ */
17
+ declare const groupsHaveOptions: (options: Option[] | OptionGroup[]) => boolean;
18
+ /**
19
+ * Checks if the listbox can be opened.
20
+ */
21
+ declare const canOpenListbox: (options: Option[] | OptionGroup[], disabled: boolean) => boolean;
22
+ /**
23
+ * Filters the options by the search value.
24
+ */
25
+ declare const filterOptionsBySearchValue: (options: Option[] | OptionGroup[], searchValue: string) => Option[] | OptionGroup[];
26
+ /**
27
+ * Returns the index of the last option, depending on several conditions.
28
+ */
29
+ declare const getLastOptionIndex: (options: Option[] | OptionGroup[], filteredOptions: Option[] | OptionGroup[], searchable: boolean, optional: boolean, multiple: boolean) => number;
30
+ /**
31
+ * Return the current selection.
32
+ */
33
+ declare const getSelectedOption: (value: string | string[], options: Option[] | OptionGroup[], multiple: boolean, optional: boolean, optionalItem: Option) => {
34
+ selectedOption: Option | Option[];
35
+ singleSelectionIndex: number;
36
+ };
37
+ /**
38
+ * Return the label or labels of the selected option(s) for the internal input.
39
+ */
40
+ declare const getSelectedOptionLabel: (placeholder: string, selectedOption: Option | Option[]) => string;
41
+ export { isOptionGroup, isArrayOfOptionGroups, notOptionalCheck, groupsHaveOptions, canOpenListbox as canOpenOptions, filterOptionsBySearchValue, getLastOptionIndex, getSelectedOption, getSelectedOptionLabel, };