@dxc-technology/halstack-react 0.0.0-59568e7 → 0.0.0-5aa300b

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