@dxc-technology/halstack-react 0.0.0-8b5e703 → 0.0.0-8b61ced

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 (193) hide show
  1. package/HalstackContext.js +7 -11
  2. package/accordion/Accordion.js +122 -103
  3. package/accordion/Accordion.stories.tsx +2 -3
  4. package/accordion/Accordion.test.js +9 -10
  5. package/accordion/types.d.ts +5 -4
  6. package/accordion-group/AccordionGroup.js +2 -21
  7. package/accordion-group/AccordionGroup.stories.tsx +27 -1
  8. package/accordion-group/AccordionGroup.test.js +20 -45
  9. package/accordion-group/types.d.ts +10 -3
  10. package/alert/Alert.js +1 -1
  11. package/bleed/Bleed.js +1 -34
  12. package/bleed/Bleed.stories.tsx +94 -95
  13. package/bleed/types.d.ts +1 -1
  14. package/box/Box.js +23 -33
  15. package/box/types.d.ts +1 -0
  16. package/bulleted-list/BulletedList.d.ts +7 -0
  17. package/bulleted-list/BulletedList.js +123 -0
  18. package/bulleted-list/BulletedList.stories.tsx +200 -0
  19. package/bulleted-list/types.d.ts +11 -0
  20. package/{list → bulleted-list}/types.js +0 -0
  21. package/button/Button.js +43 -61
  22. package/button/Button.stories.tsx +9 -0
  23. package/button/types.d.ts +7 -7
  24. package/card/Card.js +34 -36
  25. package/card/types.d.ts +1 -0
  26. package/checkbox/Checkbox.d.ts +2 -2
  27. package/checkbox/Checkbox.js +92 -99
  28. package/checkbox/Checkbox.stories.tsx +79 -59
  29. package/checkbox/Checkbox.test.js +93 -16
  30. package/checkbox/types.d.ts +6 -2
  31. package/chip/types.d.ts +1 -1
  32. package/common/variables.js +75 -48
  33. package/date-input/Calendar.d.ts +4 -0
  34. package/date-input/Calendar.js +258 -0
  35. package/date-input/DateInput.js +77 -222
  36. package/date-input/DateInput.stories.tsx +30 -17
  37. package/date-input/DateInput.test.js +411 -138
  38. package/date-input/DatePicker.d.ts +4 -0
  39. package/date-input/DatePicker.js +160 -0
  40. package/date-input/YearPicker.d.ts +4 -0
  41. package/date-input/YearPicker.js +115 -0
  42. package/date-input/types.d.ts +53 -0
  43. package/dialog/Dialog.js +52 -28
  44. package/dialog/Dialog.stories.tsx +57 -2
  45. package/dialog/Dialog.test.js +34 -4
  46. package/dialog/types.d.ts +3 -2
  47. package/dropdown/Dropdown.d.ts +1 -1
  48. package/dropdown/Dropdown.js +247 -247
  49. package/dropdown/Dropdown.stories.tsx +126 -63
  50. package/dropdown/Dropdown.test.js +504 -108
  51. package/dropdown/DropdownMenu.d.ts +4 -0
  52. package/dropdown/DropdownMenu.js +80 -0
  53. package/dropdown/DropdownMenuItem.d.ts +4 -0
  54. package/dropdown/DropdownMenuItem.js +92 -0
  55. package/dropdown/types.d.ts +25 -5
  56. package/file-input/FileInput.d.ts +2 -2
  57. package/file-input/FileInput.js +177 -219
  58. package/file-input/FileInput.stories.tsx +38 -10
  59. package/file-input/FileInput.test.js +53 -12
  60. package/file-input/FileItem.d.ts +4 -14
  61. package/file-input/FileItem.js +38 -63
  62. package/file-input/types.d.ts +17 -0
  63. package/flex/Flex.d.ts +4 -0
  64. package/flex/Flex.js +69 -0
  65. package/flex/Flex.stories.tsx +103 -0
  66. package/flex/types.d.ts +32 -0
  67. package/{radio → flex}/types.js +0 -0
  68. package/footer/Footer.stories.tsx +8 -1
  69. package/footer/Icons.js +1 -1
  70. package/footer/types.d.ts +2 -1
  71. package/header/Header.js +74 -72
  72. package/header/Header.stories.tsx +4 -4
  73. package/header/Icons.js +2 -2
  74. package/header/types.d.ts +3 -2
  75. package/inset/Inset.js +1 -34
  76. package/inset/Inset.stories.tsx +36 -36
  77. package/inset/types.d.ts +1 -1
  78. package/layout/ApplicationLayout.d.ts +16 -6
  79. package/layout/ApplicationLayout.js +70 -117
  80. package/layout/ApplicationLayout.stories.tsx +84 -93
  81. package/layout/Icons.d.ts +5 -0
  82. package/layout/Icons.js +13 -2
  83. package/layout/SidenavContext.d.ts +5 -0
  84. package/layout/SidenavContext.js +19 -0
  85. package/layout/types.d.ts +18 -33
  86. package/link/Link.js +12 -5
  87. package/link/Link.stories.tsx +13 -6
  88. package/link/types.d.ts +1 -1
  89. package/main.d.ts +5 -9
  90. package/main.js +28 -60
  91. package/number-input/NumberInput.test.js +43 -7
  92. package/package.json +16 -20
  93. package/paginator/Paginator.js +2 -2
  94. package/paginator/Paginator.test.js +43 -1
  95. package/paragraph/Paragraph.d.ts +6 -0
  96. package/paragraph/Paragraph.js +38 -0
  97. package/paragraph/Paragraph.stories.tsx +44 -0
  98. package/password-input/PasswordInput.test.js +13 -12
  99. package/progress-bar/ProgressBar.d.ts +2 -2
  100. package/progress-bar/ProgressBar.js +56 -50
  101. package/progress-bar/ProgressBar.stories.jsx +3 -1
  102. package/progress-bar/ProgressBar.test.js +67 -22
  103. package/progress-bar/types.d.ts +3 -4
  104. package/quick-nav/QuickNav.js +25 -20
  105. package/quick-nav/QuickNav.stories.tsx +131 -26
  106. package/radio-group/Radio.d.ts +1 -1
  107. package/radio-group/Radio.js +43 -28
  108. package/radio-group/RadioGroup.js +23 -22
  109. package/radio-group/RadioGroup.stories.tsx +1 -0
  110. package/radio-group/RadioGroup.test.js +123 -96
  111. package/radio-group/types.d.ts +2 -2
  112. package/resultsetTable/Icons.d.ts +7 -0
  113. package/resultsetTable/Icons.js +51 -0
  114. package/resultsetTable/ResultsetTable.js +48 -107
  115. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  116. package/resultsetTable/ResultsetTable.test.js +65 -41
  117. package/resultsetTable/types.d.ts +2 -2
  118. package/select/Listbox.d.ts +1 -1
  119. package/select/Listbox.js +53 -7
  120. package/select/Select.js +43 -43
  121. package/select/Select.stories.tsx +133 -103
  122. package/select/Select.test.js +363 -250
  123. package/select/types.d.ts +2 -5
  124. package/sidenav/Sidenav.d.ts +6 -5
  125. package/sidenav/Sidenav.js +184 -52
  126. package/sidenav/Sidenav.stories.tsx +154 -156
  127. package/sidenav/Sidenav.test.js +25 -37
  128. package/sidenav/types.d.ts +50 -27
  129. package/slider/Slider.d.ts +2 -2
  130. package/slider/Slider.js +120 -95
  131. package/slider/Slider.stories.tsx +7 -1
  132. package/slider/Slider.test.js +121 -21
  133. package/slider/types.d.ts +6 -2
  134. package/spinner/Spinner.js +2 -2
  135. package/switch/Switch.d.ts +2 -2
  136. package/switch/Switch.js +135 -68
  137. package/switch/Switch.stories.tsx +8 -30
  138. package/switch/Switch.test.js +144 -17
  139. package/switch/types.d.ts +6 -2
  140. package/table/Table.js +1 -1
  141. package/table/Table.test.js +1 -1
  142. package/tabs/Tab.d.ts +4 -0
  143. package/tabs/Tab.js +135 -0
  144. package/tabs/Tabs.js +360 -104
  145. package/tabs/Tabs.stories.tsx +74 -1
  146. package/tabs/Tabs.test.js +217 -6
  147. package/tabs/types.d.ts +15 -5
  148. package/tabs-nav/NavTabs.d.ts +2 -1
  149. package/tabs-nav/NavTabs.js +40 -21
  150. package/tabs-nav/Tab.js +29 -16
  151. package/tabs-nav/types.d.ts +7 -5
  152. package/tag/Tag.js +1 -1
  153. package/tag/types.d.ts +1 -1
  154. package/text-input/Icons.d.ts +8 -0
  155. package/text-input/Icons.js +60 -0
  156. package/text-input/Suggestion.js +38 -9
  157. package/text-input/Suggestions.d.ts +4 -0
  158. package/text-input/Suggestions.js +134 -0
  159. package/text-input/TextInput.js +189 -282
  160. package/text-input/TextInput.stories.tsx +194 -182
  161. package/text-input/TextInput.test.js +737 -725
  162. package/text-input/types.d.ts +22 -3
  163. package/toggle-group/types.d.ts +1 -1
  164. package/typography/Typography.d.ts +4 -0
  165. package/typography/Typography.js +131 -0
  166. package/typography/Typography.stories.tsx +198 -0
  167. package/typography/types.d.ts +18 -0
  168. package/{row → typography}/types.js +0 -0
  169. package/wizard/Wizard.js +9 -16
  170. package/wizard/Wizard.stories.tsx +20 -1
  171. package/wizard/types.d.ts +5 -4
  172. package/common/RequiredComponent.js +0 -32
  173. package/list/List.d.ts +0 -4
  174. package/list/List.js +0 -47
  175. package/list/List.stories.tsx +0 -95
  176. package/list/types.d.ts +0 -7
  177. package/radio/Radio.d.ts +0 -4
  178. package/radio/Radio.js +0 -173
  179. package/radio/Radio.stories.tsx +0 -192
  180. package/radio/Radio.test.js +0 -71
  181. package/radio/types.d.ts +0 -54
  182. package/row/Row.d.ts +0 -3
  183. package/row/Row.js +0 -127
  184. package/row/Row.stories.tsx +0 -237
  185. package/row/types.d.ts +0 -28
  186. package/stack/Stack.d.ts +0 -3
  187. package/stack/Stack.js +0 -97
  188. package/stack/Stack.stories.tsx +0 -164
  189. package/stack/types.d.ts +0 -24
  190. package/stack/types.js +0 -5
  191. package/text/Text.d.ts +0 -7
  192. package/text/Text.js +0 -30
  193. package/text/Text.stories.tsx +0 -19
@@ -1,11 +1,16 @@
1
1
  import React from "react";
2
- import { userEvent, within, waitFor } from "@storybook/testing-library";
3
- import { fireEvent } from "@testing-library/react";
2
+ import { userEvent, within } from "@storybook/testing-library";
4
3
  import { BackgroundColorProvider } from "../BackgroundColorContext";
5
4
  import Title from "../../.storybook/components/Title";
6
5
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
7
6
  import DarkContainer from "../../.storybook/components/DarkSection";
8
7
  import DxcTextInput from "./TextInput";
8
+ import DxcButton from "../button/Button";
9
+ import DxcCheckbox from "../checkbox/Checkbox";
10
+ import DxcFlex from "../flex/Flex";
11
+ import Suggestions from "./Suggestions";
12
+ import { ThemeProvider } from "styled-components";
13
+ import useTheme from "../useTheme";
9
14
 
10
15
  export default {
11
16
  title: "Text input",
@@ -56,6 +61,7 @@ const countries = [
56
61
  "Dominica",
57
62
  "Denmark",
58
63
  "Djibouti",
64
+ "*",
59
65
  ];
60
66
 
61
67
  export const Chromatic = () => (
@@ -72,6 +78,14 @@ export const Chromatic = () => (
72
78
  <Title title="Hovered action" theme="light" level={4} />
73
79
  <DxcTextInput label="Text input" defaultValue="Text" clearable />
74
80
  </ExampleContainer>
81
+ <ExampleContainer pseudoState="pseudo-active">
82
+ <Title title="Actived action" theme="light" level={4} />
83
+ <DxcTextInput label="Text input" action={action} clearable />
84
+ </ExampleContainer>
85
+ <ExampleContainer pseudoState="pseudo-focus">
86
+ <Title title="Focused action" theme="light" level={4} />
87
+ <DxcTextInput label="Text input" action={action} clearable />
88
+ </ExampleContainer>
75
89
  <ExampleContainer>
76
90
  <Title title="Without label" theme="light" level={4} />
77
91
  <DxcTextInput />
@@ -152,7 +166,7 @@ export const Chromatic = () => (
152
166
  </ExampleContainer>
153
167
  <BackgroundColorProvider color="#333333">
154
168
  <DarkContainer>
155
- <Title title="Dark" theme="dark" level={2} />
169
+ <Title title="Dark theme" theme="dark" level={2} />
156
170
  <ExampleContainer pseudoState="pseudo-hover">
157
171
  <Title title="Hovered" theme="dark" level={4} />
158
172
  <DxcTextInput label="Text input" />
@@ -165,6 +179,14 @@ export const Chromatic = () => (
165
179
  <Title title="Hovered action" theme="dark" level={4} />
166
180
  <DxcTextInput label="Text input" defaultValue="Text" clearable />
167
181
  </ExampleContainer>
182
+ <ExampleContainer pseudoState="pseudo-active">
183
+ <Title title="Actived action" theme="dark" level={4} />
184
+ <DxcTextInput label="Text input" action={action} clearable />
185
+ </ExampleContainer>
186
+ <ExampleContainer pseudoState="pseudo-focus">
187
+ <Title title="Focused action" theme="dark" level={4} />
188
+ <DxcTextInput label="Text input" action={action} clearable />
189
+ </ExampleContainer>
168
190
  <ExampleContainer>
169
191
  <Title title="Helper text, placeholder, optional and action" theme="dark" level={4} />
170
192
  <DxcTextInput
@@ -279,196 +301,186 @@ export const Chromatic = () => (
279
301
  </>
280
302
  );
281
303
 
282
- const FocusedActionTextInput = () => (
283
- <ExampleContainer expanded>
284
- <Title title="Focused action" theme="light" level={4} />
285
- <DxcTextInput label="Text input" action={action} clearable />
286
- </ExampleContainer>
287
- );
288
-
289
- const ActivedActionTextInput = () => (
290
- <ExampleContainer pseudoState="pseudo-active" expanded>
291
- <Title title="Actived action" theme="light" level={4} />
292
- <DxcTextInput label="Text input" action={action} clearable />
293
- </ExampleContainer>
294
- );
295
-
296
- const ShowOptionsAutosuggest = () => (
297
- <ExampleContainer expanded>
298
- <Title title="Show options" theme="light" level={4} />
299
- <DxcTextInput label="Text input" suggestions={countries} clearable />
300
- </ExampleContainer>
301
- );
302
-
303
- const HoveredOptionAutosuggest = () => (
304
- <ExampleContainer expanded pseudoState="pseudo-hover">
305
- <Title title="Hovered option" theme="light" level={4} />
306
- <DxcTextInput label="Text input" suggestions={country} clearable />
307
- </ExampleContainer>
308
- );
309
-
310
- const FocusedOptionAutosuggest = () => (
311
- <ExampleContainer expanded>
312
- <Title title="Focused option" theme="light" level={4} />
313
- <DxcTextInput label="Text input" suggestions={country} clearable />
314
- </ExampleContainer>
315
- );
316
-
317
- const ActivedOptionAutosuggest = () => (
318
- <ExampleContainer expanded pseudoState="pseudo-active">
319
- <Title title="Actived option" theme="light" level={4} />
320
- <DxcTextInput label="Text input" suggestions={country} clearable />
321
- </ExampleContainer>
322
- );
323
-
324
- const FocusedActionTextInputOnDark = () => (
325
- <BackgroundColorProvider color="#333333">
326
- <DarkContainer>
327
- <ExampleContainer expanded>
328
- <Title title="Focused action" theme="dark" level={4} />
329
- <DxcTextInput label="Text input" action={action} clearable />
330
- </ExampleContainer>
331
- </DarkContainer>
332
- </BackgroundColorProvider>
333
- );
304
+ const AutosuggestListbox = () => {
305
+ const colorsTheme: any = useTheme();
334
306
 
335
- const ActivedActionTextInputOnDark = () => (
336
- <BackgroundColorProvider color="#333333">
337
- <DarkContainer>
338
- <ExampleContainer pseudoState="pseudo-active" expanded>
339
- <Title title="Actived action" theme="dark" level={4} />
340
- <DxcTextInput label="Text input" action={action} clearable />
341
- </ExampleContainer>
342
- </DarkContainer>
343
- </BackgroundColorProvider>
344
- );
345
-
346
- const ShowOptionsAutosuggestOnDark = () => (
347
- <BackgroundColorProvider color="#333333">
348
- <DarkContainer>
349
- <ExampleContainer expanded>
350
- <Title title="Show options" theme="dark" level={4} />
351
- <DxcTextInput label="Text input" suggestions={countries} clearable />
352
- </ExampleContainer>
353
- </DarkContainer>
354
- </BackgroundColorProvider>
355
- );
356
-
357
- const HoveredActionAutosuggestOnDark = () => (
358
- <BackgroundColorProvider color="#333333">
359
- <DarkContainer>
360
- <ExampleContainer expanded pseudoState="pseudo-hover">
361
- <Title title="Hovered option" theme="dark" level={4} />
362
- <DxcTextInput label="Text input" suggestions={country} clearable />
307
+ return (
308
+ <ThemeProvider theme={colorsTheme.textInput}>
309
+ <ExampleContainer>
310
+ <Title title="Autosuggest listbox" theme="light" level={2} />
311
+ <ExampleContainer>
312
+ <Title
313
+ title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
314
+ theme="light"
315
+ level={3}
316
+ />
317
+ <div
318
+ style={{
319
+ display: "flex",
320
+ flexDirection: "column",
321
+ gap: "20px",
322
+ height: "150px",
323
+ width: "500px",
324
+ marginBottom: "250px",
325
+ padding: "20px",
326
+ border: "1px solid black",
327
+ borderRadius: "4px",
328
+ overflow: "auto",
329
+ zIndex: "1300",
330
+ }}
331
+ >
332
+ <DxcTextInput
333
+ label="Label"
334
+ suggestions={countries}
335
+ optional
336
+ placeholder="Choose an option"
337
+ size="fillParent"
338
+ />
339
+ <button style={{ zIndex: "1", width: "100px" }}>Submit</button>
340
+ </div>
341
+ </ExampleContainer>
342
+ <Title title="Listbox suggestion states" theme="light" level={3} />
343
+ <ExampleContainer pseudoState="pseudo-hover">
344
+ <Title title="Hovered suggestion" theme="light" level={4} />
345
+ <Suggestions
346
+ id="x"
347
+ value=""
348
+ suggestions={country}
349
+ visualFocusIndex={-1}
350
+ highlightedSuggestions={false}
351
+ searchHasErrors={false}
352
+ isSearching={false}
353
+ suggestionOnClick={() => {}}
354
+ getTextInputWidth={() => 350}
355
+ />
356
+ </ExampleContainer>
357
+ <ExampleContainer pseudoState="pseudo-active">
358
+ <Title title="Active suggestion" theme="light" level={4} />
359
+ <Suggestions
360
+ id="x"
361
+ value=""
362
+ suggestions={country}
363
+ visualFocusIndex={-1}
364
+ highlightedSuggestions={false}
365
+ searchHasErrors={false}
366
+ isSearching={false}
367
+ suggestionOnClick={(suggestion) => {}}
368
+ getTextInputWidth={() => 350}
369
+ />
370
+ </ExampleContainer>
371
+ <ExampleContainer>
372
+ <Title title="Focused suggestion" theme="light" level={4} />
373
+ <Suggestions
374
+ id="x"
375
+ value=""
376
+ suggestions={country}
377
+ visualFocusIndex={0}
378
+ highlightedSuggestions={false}
379
+ searchHasErrors={false}
380
+ isSearching={false}
381
+ suggestionOnClick={(suggestion) => {}}
382
+ getTextInputWidth={() => 350}
383
+ />
384
+ </ExampleContainer>
385
+ <ExampleContainer>
386
+ <Title title="Highlighted suggestion" theme="light" level={4} />
387
+ <Suggestions
388
+ id="x"
389
+ value="Afgh"
390
+ suggestions={country}
391
+ visualFocusIndex={-1}
392
+ highlightedSuggestions={true}
393
+ searchHasErrors={false}
394
+ isSearching={false}
395
+ suggestionOnClick={(suggestion) => {}}
396
+ getTextInputWidth={() => 350}
397
+ />
398
+ </ExampleContainer>
363
399
  </ExampleContainer>
364
- </DarkContainer>
365
- </BackgroundColorProvider>
366
- );
367
-
368
- const FocusedOptionAutosuggestOnDark = () => (
369
- <BackgroundColorProvider color="#333333">
370
- <DarkContainer>
371
- <ExampleContainer expanded>
372
- <Title title="Focused option" theme="dark" level={4} />
373
- <DxcTextInput label="Text input" suggestions={country} clearable />
400
+ <ExampleContainer>
401
+ <Title title="Autosuggest Error" theme="light" level={3} />
402
+ <Suggestions
403
+ id="x"
404
+ value=""
405
+ suggestions={country}
406
+ visualFocusIndex={-1}
407
+ highlightedSuggestions={false}
408
+ searchHasErrors={true}
409
+ isSearching={false}
410
+ suggestionOnClick={(suggestion) => {}}
411
+ getTextInputWidth={() => 350}
412
+ />
374
413
  </ExampleContainer>
375
- </DarkContainer>
376
- </BackgroundColorProvider>
377
- );
378
-
379
- const ActivedOptionAutosuggestOnDark = () => (
380
- <BackgroundColorProvider color="#333333">
381
- <DarkContainer>
382
- <ExampleContainer expanded pseudoState="pseudo-active">
383
- <Title title="Actived option" theme="dark" level={4} />
384
- <DxcTextInput label="Text input" suggestions={country} clearable />
414
+ <ExampleContainer>
415
+ <Title title="Autosuggest Searching message" theme="light" level={3} />
416
+ <Suggestions
417
+ id="x"
418
+ value=""
419
+ suggestions={country}
420
+ visualFocusIndex={-1}
421
+ highlightedSuggestions={false}
422
+ searchHasErrors={false}
423
+ isSearching={true}
424
+ suggestionOnClick={(suggestion) => {}}
425
+ getTextInputWidth={() => 350}
426
+ />
385
427
  </ExampleContainer>
386
- </DarkContainer>
387
- </BackgroundColorProvider>
388
- );
389
-
390
- export const FocusedAction = FocusedActionTextInput.bind({});
391
- FocusedAction.play = async ({ canvasElement }) => {
392
- const canvas = within(canvasElement);
393
- const action = canvas.getByRole("button");
394
- await action.focus();
395
- };
396
-
397
- export const ActivedAction = ActivedActionTextInput.bind({});
398
- ActivedAction.play = async ({ canvasElement }) => {
399
- const canvas = within(canvasElement);
400
- const action = canvas.getByRole("button");
401
- await userEvent.click(action);
402
- };
403
-
404
- export const ShowOptions = ShowOptionsAutosuggest.bind({});
405
- ShowOptions.play = async ({ canvasElement }) => {
406
- const canvas = within(canvasElement);
407
- const autosuggest = canvas.getByRole("combobox");
408
- await userEvent.click(autosuggest);
409
- };
410
-
411
- export const HoveredOption = HoveredOptionAutosuggest.bind({});
412
- HoveredOption.play = async ({ canvasElement }) => {
413
- const canvas = within(canvasElement);
414
- const autosuggest = canvas.getByRole("combobox");
415
- await userEvent.click(autosuggest);
428
+ </ThemeProvider>
429
+ );
416
430
  };
417
431
 
418
- export const FocusedOption = FocusedOptionAutosuggest.bind({});
419
- FocusedOption.play = async ({ canvasElement }) => {
420
- const canvas = within(canvasElement);
421
- const autosuggest = canvas.getByRole("combobox");
422
- await userEvent.click(autosuggest);
423
- fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
424
- };
432
+ const DarkAutosuggestListbox = () => {
433
+ const colorsTheme: any = useTheme();
425
434
 
426
- export const ActivedOption = ActivedOptionAutosuggest.bind({});
427
- ActivedOption.play = async ({ canvasElement }) => {
428
- const canvas = within(canvasElement);
429
- const autosuggest = canvas.getByRole("combobox");
430
- await userEvent.click(autosuggest);
431
- };
432
-
433
- export const FocusedActionOnDark = FocusedActionTextInputOnDark.bind({});
434
- FocusedActionOnDark.play = async ({ canvasElement }) => {
435
- const canvas = within(canvasElement);
436
- const action = canvas.getByRole("button");
437
- await action.focus();
438
- };
439
-
440
- export const ActivedActionOnDark = ActivedActionTextInputOnDark.bind({});
441
- ActivedActionOnDark.play = async ({ canvasElement }) => {
442
- const canvas = within(canvasElement);
443
- const action = canvas.getByRole("button");
444
- await userEvent.click(action);
445
- };
446
-
447
- export const ShowOptionsOnDark = ShowOptionsAutosuggestOnDark.bind({});
448
- ShowOptionsOnDark.play = async ({ canvasElement }) => {
449
- const canvas = within(canvasElement);
450
- const autosuggest = canvas.getByRole("combobox");
451
- await userEvent.click(autosuggest);
452
- };
453
-
454
- export const HoveredActionOnDark = HoveredActionAutosuggestOnDark.bind({});
455
- HoveredActionOnDark.play = async ({ canvasElement }) => {
456
- const canvas = within(canvasElement);
457
- const autosuggest = canvas.getByRole("combobox");
458
- await userEvent.click(autosuggest);
435
+ return (
436
+ <ThemeProvider theme={colorsTheme.textInput}>
437
+ <BackgroundColorProvider color="#333333">
438
+ <DarkContainer>
439
+ <Title title="Dark theme" theme="dark" level={2} />
440
+ <ExampleContainer>
441
+ <Title title="Default with opened suggestions" theme="dark" level={3} />
442
+ <DxcFlex direction="column" gap="80px">
443
+ <DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
444
+ <DxcCheckbox
445
+ label="You understand the selection and give your consent"
446
+ onChange={() => {}}
447
+ labelPosition="after"
448
+ />
449
+ <DxcButton label="Submit" onClick={() => {}} size="medium" margin={{ bottom: "xxlarge" }} />
450
+ </DxcFlex>
451
+ </ExampleContainer>
452
+ <ExampleContainer>
453
+ <Title title="Autosuggest Error" theme="dark" level={3} />
454
+ <div style={{ height: "100px" }}>
455
+ <Suggestions
456
+ id="x"
457
+ value=""
458
+ suggestions={country}
459
+ visualFocusIndex={-1}
460
+ highlightedSuggestions={false}
461
+ searchHasErrors={true}
462
+ isSearching={false}
463
+ suggestionOnClick={(suggestion) => {}}
464
+ getTextInputWidth={() => 350}
465
+ />
466
+ </div>
467
+ </ExampleContainer>
468
+ </DarkContainer>
469
+ </BackgroundColorProvider>
470
+ </ThemeProvider>
471
+ );
459
472
  };
460
473
 
461
- export const FocusedOptionOnDark = FocusedOptionAutosuggestOnDark.bind({});
462
- FocusedOptionOnDark.play = async ({ canvasElement }) => {
474
+ export const AutosuggestListboxStates = AutosuggestListbox.bind({});
475
+ AutosuggestListboxStates.play = async ({ canvasElement }) => {
463
476
  const canvas = within(canvasElement);
464
- const autosuggest = canvas.getByRole("combobox");
465
- await userEvent.click(autosuggest);
466
- fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
477
+ const select = canvas.getByRole("combobox");
478
+ await userEvent.click(select);
467
479
  };
468
480
 
469
- export const ActivedOptionOnDark = ActivedOptionAutosuggestOnDark.bind({});
470
- ActivedOptionOnDark.play = async ({ canvasElement }) => {
481
+ export const AutosuggestListboxOnDark = DarkAutosuggestListbox.bind({});
482
+ AutosuggestListboxOnDark.play = async ({ canvasElement }) => {
471
483
  const canvas = within(canvasElement);
472
- const autosuggest = canvas.getByRole("combobox");
473
- await userEvent.click(autosuggest);
484
+ const select = canvas.getByRole("combobox");
485
+ await userEvent.click(select);
474
486
  };