@dxc-technology/halstack-react 0.0.0-ecc45e2 → 0.0.0-ede733c

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 (216) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +1 -1
  3. package/HalstackContext.d.ts +1329 -5
  4. package/HalstackContext.js +117 -77
  5. package/accordion/Accordion.js +118 -110
  6. package/accordion/Accordion.stories.tsx +103 -15
  7. package/accordion/Accordion.test.js +10 -11
  8. package/accordion/types.d.ts +1 -0
  9. package/accordion-group/AccordionGroup.d.ts +4 -3
  10. package/accordion-group/AccordionGroup.js +24 -65
  11. package/accordion-group/AccordionGroup.stories.tsx +27 -1
  12. package/accordion-group/AccordionGroup.test.js +21 -46
  13. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  14. package/accordion-group/AccordionGroupAccordion.js +43 -0
  15. package/accordion-group/types.d.ts +7 -0
  16. package/alert/Alert.js +5 -9
  17. package/alert/Alert.stories.tsx +28 -0
  18. package/alert/Alert.test.js +1 -1
  19. package/bleed/Bleed.stories.tsx +1 -0
  20. package/box/Box.js +4 -6
  21. package/box/Box.stories.tsx +15 -0
  22. package/box/Box.test.js +1 -1
  23. package/box/types.d.ts +1 -0
  24. package/bulleted-list/BulletedList.js +4 -2
  25. package/bulleted-list/BulletedList.stories.tsx +7 -1
  26. package/bulleted-list/types.d.ts +31 -4
  27. package/button/Button.js +13 -16
  28. package/button/Button.stories.tsx +151 -9
  29. package/button/Button.test.js +1 -1
  30. package/button/types.d.ts +3 -3
  31. package/card/Card.js +12 -13
  32. package/card/Card.stories.tsx +12 -13
  33. package/card/Card.test.js +1 -1
  34. package/card/types.d.ts +1 -0
  35. package/checkbox/Checkbox.d.ts +2 -2
  36. package/checkbox/Checkbox.js +94 -101
  37. package/checkbox/Checkbox.stories.tsx +131 -59
  38. package/checkbox/Checkbox.test.js +94 -17
  39. package/checkbox/types.d.ts +4 -0
  40. package/chip/Chip.js +28 -49
  41. package/chip/Chip.stories.tsx +121 -26
  42. package/chip/Chip.test.js +3 -5
  43. package/common/OpenSans.css +68 -80
  44. package/common/coreTokens.d.ts +146 -0
  45. package/common/coreTokens.js +167 -0
  46. package/common/utils.d.ts +1 -0
  47. package/common/utils.js +4 -4
  48. package/common/variables.d.ts +1482 -0
  49. package/common/variables.js +994 -1137
  50. package/date-input/Calendar.d.ts +4 -0
  51. package/date-input/Calendar.js +258 -0
  52. package/date-input/DateInput.js +134 -237
  53. package/date-input/DateInput.stories.tsx +199 -33
  54. package/date-input/DateInput.test.js +494 -138
  55. package/date-input/DatePicker.d.ts +4 -0
  56. package/date-input/DatePicker.js +146 -0
  57. package/date-input/Icons.d.ts +6 -0
  58. package/date-input/Icons.js +75 -0
  59. package/date-input/YearPicker.d.ts +4 -0
  60. package/date-input/YearPicker.js +126 -0
  61. package/date-input/types.d.ts +51 -0
  62. package/dialog/Dialog.js +60 -73
  63. package/dialog/Dialog.stories.tsx +229 -121
  64. package/dialog/Dialog.test.js +302 -3
  65. package/dialog/types.d.ts +3 -2
  66. package/dropdown/Dropdown.js +43 -42
  67. package/dropdown/Dropdown.stories.tsx +210 -84
  68. package/dropdown/Dropdown.test.js +22 -27
  69. package/dropdown/DropdownMenu.js +12 -18
  70. package/dropdown/DropdownMenuItem.js +5 -18
  71. package/dropdown/types.d.ts +3 -3
  72. package/file-input/FileInput.d.ts +2 -2
  73. package/file-input/FileInput.js +174 -220
  74. package/file-input/FileInput.stories.tsx +122 -11
  75. package/file-input/FileInput.test.js +14 -14
  76. package/file-input/FileItem.d.ts +4 -14
  77. package/file-input/FileItem.js +39 -63
  78. package/file-input/types.d.ts +17 -0
  79. package/flex/Flex.d.ts +1 -1
  80. package/flex/Flex.js +33 -19
  81. package/flex/Flex.stories.tsx +35 -26
  82. package/flex/types.d.ts +83 -7
  83. package/footer/Footer.js +6 -8
  84. package/footer/Footer.stories.tsx +99 -1
  85. package/footer/Footer.test.js +14 -26
  86. package/footer/types.d.ts +1 -0
  87. package/grid/Grid.d.ts +7 -0
  88. package/grid/Grid.js +91 -0
  89. package/grid/Grid.stories.tsx +219 -0
  90. package/grid/types.d.ts +115 -0
  91. package/header/Header.d.ts +3 -2
  92. package/header/Header.js +21 -23
  93. package/header/Header.stories.tsx +152 -9
  94. package/header/Header.test.js +2 -2
  95. package/header/types.d.ts +3 -2
  96. package/heading/Heading.js +1 -1
  97. package/heading/Heading.test.js +1 -1
  98. package/inset/Inset.stories.tsx +2 -1
  99. package/layout/ApplicationLayout.d.ts +3 -3
  100. package/layout/ApplicationLayout.js +1 -1
  101. package/layout/ApplicationLayout.stories.tsx +1 -0
  102. package/layout/types.d.ts +2 -3
  103. package/link/Link.js +4 -4
  104. package/link/Link.stories.tsx +60 -0
  105. package/link/Link.test.js +2 -4
  106. package/link/types.d.ts +2 -2
  107. package/main.d.ts +3 -2
  108. package/main.js +9 -1
  109. package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
  110. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  111. package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
  112. package/{tabs-nav → nav-tabs}/Tab.js +38 -18
  113. package/nav-tabs/types.js +5 -0
  114. package/number-input/NumberInput.test.js +44 -8
  115. package/package.json +15 -20
  116. package/paginator/Icons.d.ts +5 -0
  117. package/paginator/Icons.js +16 -28
  118. package/paginator/Paginator.js +7 -15
  119. package/paginator/Paginator.stories.tsx +24 -0
  120. package/paginator/Paginator.test.js +45 -48
  121. package/paragraph/Paragraph.d.ts +3 -4
  122. package/paragraph/Paragraph.js +5 -5
  123. package/password-input/PasswordInput.test.js +14 -13
  124. package/progress-bar/ProgressBar.d.ts +2 -2
  125. package/progress-bar/ProgressBar.js +5 -5
  126. package/progress-bar/ProgressBar.stories.jsx +35 -2
  127. package/progress-bar/ProgressBar.test.js +1 -1
  128. package/progress-bar/types.d.ts +4 -3
  129. package/quick-nav/QuickNav.js +11 -12
  130. package/quick-nav/QuickNav.stories.tsx +111 -19
  131. package/radio-group/Radio.d.ts +1 -1
  132. package/radio-group/Radio.js +43 -28
  133. package/radio-group/RadioGroup.js +15 -13
  134. package/radio-group/RadioGroup.stories.tsx +132 -18
  135. package/radio-group/RadioGroup.test.js +124 -97
  136. package/radio-group/types.d.ts +2 -2
  137. package/resultsetTable/Icons.d.ts +7 -0
  138. package/resultsetTable/Icons.js +51 -0
  139. package/resultsetTable/ResultsetTable.js +49 -108
  140. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  141. package/resultsetTable/ResultsetTable.test.js +41 -64
  142. package/resultsetTable/types.d.ts +1 -1
  143. package/select/Listbox.d.ts +1 -1
  144. package/select/Listbox.js +5 -35
  145. package/select/Option.js +11 -24
  146. package/select/Select.js +59 -36
  147. package/select/Select.stories.tsx +494 -150
  148. package/select/Select.test.js +341 -288
  149. package/select/types.d.ts +2 -2
  150. package/sidenav/Icons.d.ts +7 -0
  151. package/sidenav/Icons.js +51 -0
  152. package/sidenav/Sidenav.d.ts +2 -2
  153. package/sidenav/Sidenav.js +66 -96
  154. package/sidenav/Sidenav.stories.tsx +165 -63
  155. package/sidenav/types.d.ts +21 -18
  156. package/slider/Slider.d.ts +2 -2
  157. package/slider/Slider.js +119 -95
  158. package/slider/Slider.stories.tsx +64 -1
  159. package/slider/Slider.test.js +88 -25
  160. package/slider/types.d.ts +4 -0
  161. package/spinner/Spinner.js +17 -23
  162. package/spinner/Spinner.stories.jsx +53 -27
  163. package/spinner/Spinner.test.js +1 -1
  164. package/switch/Switch.d.ts +3 -3
  165. package/switch/Switch.js +96 -85
  166. package/switch/Switch.stories.tsx +33 -0
  167. package/switch/Switch.test.js +27 -14
  168. package/switch/types.d.ts +8 -3
  169. package/table/Table.js +3 -3
  170. package/table/Table.stories.jsx +80 -1
  171. package/table/Table.test.js +2 -2
  172. package/tabs/Tab.d.ts +4 -0
  173. package/tabs/Tab.js +132 -0
  174. package/tabs/Tabs.js +358 -108
  175. package/tabs/Tabs.stories.tsx +119 -5
  176. package/tabs/Tabs.test.js +220 -10
  177. package/tabs/types.d.ts +12 -2
  178. package/tag/Tag.js +8 -10
  179. package/tag/Tag.stories.tsx +14 -1
  180. package/tag/Tag.test.js +1 -1
  181. package/text-input/Icons.d.ts +8 -0
  182. package/text-input/Icons.js +60 -0
  183. package/text-input/Suggestion.js +40 -11
  184. package/text-input/Suggestions.d.ts +4 -0
  185. package/text-input/Suggestions.js +134 -0
  186. package/text-input/TextInput.js +189 -277
  187. package/text-input/TextInput.stories.tsx +280 -184
  188. package/text-input/TextInput.test.js +736 -725
  189. package/text-input/types.d.ts +21 -2
  190. package/textarea/Textarea.js +3 -4
  191. package/textarea/Textarea.stories.jsx +60 -1
  192. package/textarea/Textarea.test.js +2 -4
  193. package/toggle-group/ToggleGroup.d.ts +2 -2
  194. package/toggle-group/ToggleGroup.js +7 -4
  195. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  196. package/toggle-group/ToggleGroup.test.js +1 -1
  197. package/toggle-group/types.d.ts +1 -1
  198. package/typography/Typography.d.ts +2 -2
  199. package/typography/Typography.js +14 -113
  200. package/typography/Typography.stories.tsx +1 -1
  201. package/useTheme.d.ts +1234 -1
  202. package/useTheme.js +1 -1
  203. package/useTranslatedLabels.d.ts +84 -1
  204. package/utils/BaseTypography.d.ts +21 -0
  205. package/utils/BaseTypography.js +108 -0
  206. package/utils/FocusLock.d.ts +13 -0
  207. package/utils/FocusLock.js +138 -0
  208. package/wizard/Wizard.js +2 -2
  209. package/wizard/Wizard.stories.tsx +20 -0
  210. package/wizard/Wizard.test.js +1 -1
  211. package/wizard/types.d.ts +5 -6
  212. package/common/RequiredComponent.js +0 -32
  213. /package/{tabs-nav → grid}/types.js +0 -0
  214. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  215. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  216. /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
@@ -1,10 +1,17 @@
1
1
  import React from "react";
2
- import { userEvent, within, fireEvent } from "@storybook/testing-library";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
3
  import { BackgroundColorProvider } from "../BackgroundColorContext";
4
4
  import Title from "../../.storybook/components/Title";
5
5
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
6
  import DarkContainer from "../../.storybook/components/DarkSection";
7
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";
14
+ import { HalstackProvider } from "../HalstackContext";
8
15
 
9
16
  export default {
10
17
  title: "Text input",
@@ -21,7 +28,7 @@ const action = {
21
28
  ),
22
29
  };
23
30
 
24
- const actionLargeIcon = {
31
+ const actionLargeIconSVG = {
25
32
  onClick: () => {},
26
33
  icon: (
27
34
  <svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
@@ -31,6 +38,11 @@ const actionLargeIcon = {
31
38
  ),
32
39
  };
33
40
 
41
+ const actionLargeIconURL = {
42
+ onClick: () => {},
43
+ icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
44
+ };
45
+
34
46
  const country = ["Afghanistan"];
35
47
  const countries = [
36
48
  "Afghanistan",
@@ -55,8 +67,16 @@ const countries = [
55
67
  "Dominica",
56
68
  "Denmark",
57
69
  "Djibouti",
70
+ "*",
58
71
  ];
59
72
 
73
+ const opinionatedTheme = {
74
+ textInput: {
75
+ fontColor: "#000000",
76
+ hoverBorderColor: "#a46ede",
77
+ },
78
+ };
79
+
60
80
  export const Chromatic = () => (
61
81
  <>
62
82
  <ExampleContainer pseudoState="pseudo-hover">
@@ -71,6 +91,14 @@ export const Chromatic = () => (
71
91
  <Title title="Hovered action" theme="light" level={4} />
72
92
  <DxcTextInput label="Text input" defaultValue="Text" clearable />
73
93
  </ExampleContainer>
94
+ <ExampleContainer pseudoState="pseudo-active">
95
+ <Title title="Actived action" theme="light" level={4} />
96
+ <DxcTextInput label="Text input" action={action} clearable />
97
+ </ExampleContainer>
98
+ <ExampleContainer pseudoState="pseudo-focus">
99
+ <Title title="Focused action" theme="light" level={4} />
100
+ <DxcTextInput label="Text input" action={action} clearable />
101
+ </ExampleContainer>
74
102
  <ExampleContainer>
75
103
  <Title title="Without label" theme="light" level={4} />
76
104
  <DxcTextInput />
@@ -84,12 +112,21 @@ export const Chromatic = () => (
84
112
  <DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
85
113
  </ExampleContainer>
86
114
  <ExampleContainer>
87
- <Title title="Clearable and large icon action" theme="light" level={4} />
115
+ <Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
88
116
  <DxcTextInput
89
117
  label="Text input"
90
118
  defaultValue="Text text text text text text text text text text"
91
119
  clearable
92
- action={actionLargeIcon}
120
+ action={actionLargeIconSVG}
121
+ />
122
+ </ExampleContainer>
123
+ <ExampleContainer>
124
+ <Title title="Clearable and large icon action (URL)" theme="light" level={4} />
125
+ <DxcTextInput
126
+ label="Text input"
127
+ defaultValue="Text text text text text text text text text text"
128
+ clearable
129
+ action={actionLargeIconURL}
93
130
  />
94
131
  </ExampleContainer>
95
132
  <ExampleContainer>
@@ -151,7 +188,7 @@ export const Chromatic = () => (
151
188
  </ExampleContainer>
152
189
  <BackgroundColorProvider color="#333333">
153
190
  <DarkContainer>
154
- <Title title="Dark" theme="dark" level={2} />
191
+ <Title title="Dark theme" theme="dark" level={2} />
155
192
  <ExampleContainer pseudoState="pseudo-hover">
156
193
  <Title title="Hovered" theme="dark" level={4} />
157
194
  <DxcTextInput label="Text input" />
@@ -164,6 +201,14 @@ export const Chromatic = () => (
164
201
  <Title title="Hovered action" theme="dark" level={4} />
165
202
  <DxcTextInput label="Text input" defaultValue="Text" clearable />
166
203
  </ExampleContainer>
204
+ <ExampleContainer pseudoState="pseudo-active">
205
+ <Title title="Actived action" theme="dark" level={4} />
206
+ <DxcTextInput label="Text input" action={action} clearable />
207
+ </ExampleContainer>
208
+ <ExampleContainer pseudoState="pseudo-focus">
209
+ <Title title="Focused action" theme="dark" level={4} />
210
+ <DxcTextInput label="Text input" action={action} clearable />
211
+ </ExampleContainer>
167
212
  <ExampleContainer>
168
213
  <Title title="Helper text, placeholder, optional and action" theme="dark" level={4} />
169
214
  <DxcTextInput
@@ -275,199 +320,250 @@ export const Chromatic = () => (
275
320
  <Title title="FillParent size" theme="light" level={4} />
276
321
  <DxcTextInput label="FillParent" size="fillParent" />
277
322
  </ExampleContainer>
323
+ <Title title="Opinionated theme" theme="light" level={2} />
324
+ <ExampleContainer>
325
+ <HalstackProvider theme={opinionatedTheme}>
326
+ <ExampleContainer pseudoState="pseudo-hover">
327
+ <Title title="Hovered input" theme="light" level={4} />
328
+ <DxcTextInput label="Text input" helperText="Help message" />
329
+ </ExampleContainer>
330
+ <ExampleContainer pseudoState="pseudo-focus-within">
331
+ <Title title="Focused input" theme="light" level={4} />
332
+ <DxcTextInput label="Text input" helperText="Help message" />
333
+ </ExampleContainer>
334
+ <ExampleContainer pseudoState="pseudo-hover">
335
+ <Title title="Hovered action" theme="light" level={4} />
336
+ <DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
337
+ </ExampleContainer>
338
+ <ExampleContainer pseudoState="pseudo-active">
339
+ <Title title="Actived action" theme="light" level={4} />
340
+ <DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
341
+ </ExampleContainer>
342
+ <ExampleContainer pseudoState="pseudo-focus">
343
+ <Title title="Focused action" theme="light" level={4} />
344
+ <DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
345
+ </ExampleContainer>
346
+ <ExampleContainer>
347
+ <Title title="Prefix" theme="light" level={4} />
348
+ <DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
349
+ </ExampleContainer>
350
+ <ExampleContainer>
351
+ <Title title="Suffix and action" theme="light" level={4} />
352
+ <DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
353
+ </ExampleContainer>
354
+ <ExampleContainer>
355
+ <Title title="Invalid" theme="light" level={4} />
356
+ <DxcTextInput
357
+ label="Error text input"
358
+ helperText="Help message"
359
+ error="Error message."
360
+ defaultValue="Text"
361
+ clearable
362
+ optional
363
+ action={action}
364
+ />
365
+ </ExampleContainer>
366
+ <ExampleContainer>
367
+ <Title title="Disabled and placeholder" theme="light" level={4} />
368
+ <DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
369
+ </ExampleContainer>
370
+ <ExampleContainer>
371
+ <Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
372
+ <DxcTextInput
373
+ label="Disabled text input"
374
+ helperText="Help message"
375
+ disabled
376
+ optional
377
+ defaultValue="Text"
378
+ action={action}
379
+ />
380
+ </ExampleContainer>
381
+ </HalstackProvider>
382
+ </ExampleContainer>
278
383
  </>
279
384
  );
280
385
 
281
- const FocusedActionTextInput = () => (
282
- <ExampleContainer expanded>
283
- <Title title="Focused action" theme="light" level={4} />
284
- <DxcTextInput label="Text input" action={action} clearable />
285
- </ExampleContainer>
286
- );
287
-
288
- const ActivedActionTextInput = () => (
289
- <ExampleContainer pseudoState="pseudo-active" expanded>
290
- <Title title="Actived action" theme="light" level={4} />
291
- <DxcTextInput label="Text input" action={action} clearable />
292
- </ExampleContainer>
293
- );
294
-
295
- const ShowOptionsAutosuggest = () => (
296
- <ExampleContainer expanded>
297
- <Title title="Show options" theme="light" level={4} />
298
- <DxcTextInput label="Text input" suggestions={countries} clearable />
299
- </ExampleContainer>
300
- );
301
-
302
- const HoveredOptionAutosuggest = () => (
303
- <ExampleContainer expanded pseudoState="pseudo-hover">
304
- <Title title="Hovered option" theme="light" level={4} />
305
- <DxcTextInput label="Text input" suggestions={country} clearable />
306
- </ExampleContainer>
307
- );
308
-
309
- const FocusedOptionAutosuggest = () => (
310
- <ExampleContainer expanded>
311
- <Title title="Focused option" theme="light" level={4} />
312
- <DxcTextInput label="Text input" suggestions={country} clearable />
313
- </ExampleContainer>
314
- );
315
-
316
- const ActivedOptionAutosuggest = () => (
317
- <ExampleContainer expanded pseudoState="pseudo-active">
318
- <Title title="Actived option" theme="light" level={4} />
319
- <DxcTextInput label="Text input" suggestions={country} clearable />
320
- </ExampleContainer>
321
- );
322
-
323
- const FocusedActionTextInputOnDark = () => (
324
- <BackgroundColorProvider color="#333333">
325
- <DarkContainer>
326
- <ExampleContainer expanded>
327
- <Title title="Focused action" theme="dark" level={4} />
328
- <DxcTextInput label="Text input" action={action} clearable />
329
- </ExampleContainer>
330
- </DarkContainer>
331
- </BackgroundColorProvider>
332
- );
386
+ const AutosuggestListbox = () => {
387
+ const colorsTheme: any = useTheme();
333
388
 
334
- const ActivedActionTextInputOnDark = () => (
335
- <BackgroundColorProvider color="#333333">
336
- <DarkContainer>
337
- <ExampleContainer pseudoState="pseudo-active" expanded>
338
- <Title title="Actived action" theme="dark" level={4} />
339
- <DxcTextInput label="Text input" action={action} clearable />
340
- </ExampleContainer>
341
- </DarkContainer>
342
- </BackgroundColorProvider>
343
- );
344
-
345
- const ShowOptionsAutosuggestOnDark = () => (
346
- <BackgroundColorProvider color="#333333">
347
- <DarkContainer>
348
- <ExampleContainer expanded>
349
- <Title title="Show options" theme="dark" level={4} />
350
- <DxcTextInput label="Text input" suggestions={countries} clearable />
389
+ return (
390
+ <ThemeProvider theme={colorsTheme.textInput}>
391
+ <ExampleContainer>
392
+ <Title title="Autosuggest listbox" theme="light" level={2} />
393
+ <ExampleContainer>
394
+ <Title
395
+ title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
396
+ theme="light"
397
+ level={3}
398
+ />
399
+ <div
400
+ style={{
401
+ display: "flex",
402
+ flexDirection: "column",
403
+ gap: "20px",
404
+ height: "150px",
405
+ width: "500px",
406
+ marginBottom: "250px",
407
+ padding: "20px",
408
+ border: "1px solid black",
409
+ borderRadius: "4px",
410
+ overflow: "auto",
411
+ zIndex: "1300",
412
+ position: "relative",
413
+ }}
414
+ >
415
+ <DxcTextInput
416
+ label="Label"
417
+ suggestions={countries}
418
+ optional
419
+ placeholder="Choose an option"
420
+ size="fillParent"
421
+ />
422
+ <button style={{ zIndex: "1", width: "100px" }}>Submit</button>
423
+ </div>
424
+ </ExampleContainer>
425
+ <Title title="Listbox suggestion states" theme="light" level={3} />
426
+ <ExampleContainer pseudoState="pseudo-hover">
427
+ <Title title="Hovered suggestion" theme="light" level={4} />
428
+ <Suggestions
429
+ id="x"
430
+ value=""
431
+ suggestions={country}
432
+ visualFocusIndex={-1}
433
+ highlightedSuggestions={false}
434
+ searchHasErrors={false}
435
+ isSearching={false}
436
+ suggestionOnClick={() => {}}
437
+ getTextInputWidth={() => 350}
438
+ />
439
+ </ExampleContainer>
440
+ <ExampleContainer pseudoState="pseudo-active">
441
+ <Title title="Active suggestion" theme="light" level={4} />
442
+ <Suggestions
443
+ id="x"
444
+ value=""
445
+ suggestions={country}
446
+ visualFocusIndex={-1}
447
+ highlightedSuggestions={false}
448
+ searchHasErrors={false}
449
+ isSearching={false}
450
+ suggestionOnClick={(suggestion) => {}}
451
+ getTextInputWidth={() => 350}
452
+ />
453
+ </ExampleContainer>
454
+ <ExampleContainer>
455
+ <Title title="Focused suggestion" theme="light" level={4} />
456
+ <Suggestions
457
+ id="x"
458
+ value=""
459
+ suggestions={country}
460
+ visualFocusIndex={0}
461
+ highlightedSuggestions={false}
462
+ searchHasErrors={false}
463
+ isSearching={false}
464
+ suggestionOnClick={(suggestion) => {}}
465
+ getTextInputWidth={() => 350}
466
+ />
467
+ </ExampleContainer>
468
+ <ExampleContainer>
469
+ <Title title="Highlighted suggestion" theme="light" level={4} />
470
+ <Suggestions
471
+ id="x"
472
+ value="Afgh"
473
+ suggestions={country}
474
+ visualFocusIndex={-1}
475
+ highlightedSuggestions={true}
476
+ searchHasErrors={false}
477
+ isSearching={false}
478
+ suggestionOnClick={(suggestion) => {}}
479
+ getTextInputWidth={() => 350}
480
+ />
481
+ </ExampleContainer>
351
482
  </ExampleContainer>
352
- </DarkContainer>
353
- </BackgroundColorProvider>
354
- );
355
-
356
- const HoveredActionAutosuggestOnDark = () => (
357
- <BackgroundColorProvider color="#333333">
358
- <DarkContainer>
359
- <ExampleContainer expanded pseudoState="pseudo-hover">
360
- <Title title="Hovered option" theme="dark" level={4} />
361
- <DxcTextInput label="Text input" suggestions={country} clearable />
483
+ <ExampleContainer>
484
+ <Title title="Autosuggest Error" theme="light" level={3} />
485
+ <Suggestions
486
+ id="x"
487
+ value=""
488
+ suggestions={country}
489
+ visualFocusIndex={-1}
490
+ highlightedSuggestions={false}
491
+ searchHasErrors={true}
492
+ isSearching={false}
493
+ suggestionOnClick={(suggestion) => {}}
494
+ getTextInputWidth={() => 350}
495
+ />
362
496
  </ExampleContainer>
363
- </DarkContainer>
364
- </BackgroundColorProvider>
365
- );
366
-
367
- const FocusedOptionAutosuggestOnDark = () => (
368
- <BackgroundColorProvider color="#333333">
369
- <DarkContainer>
370
- <ExampleContainer expanded>
371
- <Title title="Focused option" theme="dark" level={4} />
372
- <DxcTextInput label="Text input" suggestions={country} clearable />
497
+ <ExampleContainer>
498
+ <Title title="Autosuggest Searching message" theme="light" level={3} />
499
+ <Suggestions
500
+ id="x"
501
+ value=""
502
+ suggestions={country}
503
+ visualFocusIndex={-1}
504
+ highlightedSuggestions={false}
505
+ searchHasErrors={false}
506
+ isSearching={true}
507
+ suggestionOnClick={(suggestion) => {}}
508
+ getTextInputWidth={() => 350}
509
+ />
373
510
  </ExampleContainer>
374
- </DarkContainer>
375
- </BackgroundColorProvider>
376
- );
377
-
378
- const ActivedOptionAutosuggestOnDark = () => (
379
- <BackgroundColorProvider color="#333333">
380
- <DarkContainer>
381
- <ExampleContainer expanded pseudoState="pseudo-active">
382
- <Title title="Actived option" theme="dark" level={4} />
383
- <DxcTextInput label="Text input" suggestions={country} clearable />
384
- </ExampleContainer>
385
- </DarkContainer>
386
- </BackgroundColorProvider>
387
- );
388
-
389
- export const FocusedAction = FocusedActionTextInput.bind({});
390
- FocusedAction.play = async ({ canvasElement }) => {
391
- const canvas = within(canvasElement);
392
- const action = canvas.getByRole("button");
393
- await action.focus();
511
+ </ThemeProvider>
512
+ );
394
513
  };
395
514
 
396
- export const ActivedAction = ActivedActionTextInput.bind({});
397
- ActivedAction.play = async ({ canvasElement }) => {
398
- const canvas = within(canvasElement);
399
- const action = canvas.getByRole("button");
400
- await userEvent.click(action);
401
- };
515
+ const DarkAutosuggestListbox = () => {
516
+ const colorsTheme: any = useTheme();
402
517
 
403
- export const ShowOptions = ShowOptionsAutosuggest.bind({});
404
- ShowOptions.play = async ({ canvasElement }) => {
405
- const canvas = within(canvasElement);
406
- const autosuggest = canvas.getByRole("combobox");
407
- await userEvent.click(autosuggest);
408
- };
409
-
410
- export const HoveredOption = HoveredOptionAutosuggest.bind({});
411
- HoveredOption.play = async ({ canvasElement }) => {
412
- const canvas = within(canvasElement);
413
- const autosuggest = canvas.getByRole("combobox");
414
- await userEvent.click(autosuggest);
415
- };
416
-
417
- export const FocusedOption = FocusedOptionAutosuggest.bind({});
418
- FocusedOption.play = async ({ canvasElement }) => {
419
- const canvas = within(canvasElement);
420
- const autosuggest = canvas.getByRole("combobox");
421
- await userEvent.click(autosuggest);
422
- fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
423
- };
424
-
425
- export const ActivedOption = ActivedOptionAutosuggest.bind({});
426
- ActivedOption.play = async ({ canvasElement }) => {
427
- const canvas = within(canvasElement);
428
- const autosuggest = canvas.getByRole("combobox");
429
- await userEvent.click(autosuggest);
430
- };
431
-
432
- export const FocusedActionOnDark = FocusedActionTextInputOnDark.bind({});
433
- FocusedActionOnDark.play = async ({ canvasElement }) => {
434
- const canvas = within(canvasElement);
435
- const action = canvas.getByRole("button");
436
- await action.focus();
437
- };
438
-
439
- export const ActivedActionOnDark = ActivedActionTextInputOnDark.bind({});
440
- ActivedActionOnDark.play = async ({ canvasElement }) => {
441
- const canvas = within(canvasElement);
442
- const action = canvas.getByRole("button");
443
- await userEvent.click(action);
444
- };
445
-
446
- export const ShowOptionsOnDark = ShowOptionsAutosuggestOnDark.bind({});
447
- ShowOptionsOnDark.play = async ({ canvasElement }) => {
448
- const canvas = within(canvasElement);
449
- const autosuggest = canvas.getByRole("combobox");
450
- await userEvent.click(autosuggest);
451
- };
452
-
453
- export const HoveredActionOnDark = HoveredActionAutosuggestOnDark.bind({});
454
- HoveredActionOnDark.play = async ({ canvasElement }) => {
455
- const canvas = within(canvasElement);
456
- const autosuggest = canvas.getByRole("combobox");
457
- await userEvent.click(autosuggest);
518
+ return (
519
+ <ThemeProvider theme={colorsTheme.textInput}>
520
+ <BackgroundColorProvider color="#333333">
521
+ <DarkContainer>
522
+ <Title title="Dark theme" theme="dark" level={2} />
523
+ <ExampleContainer>
524
+ <Title title="Default with opened suggestions" theme="dark" level={3} />
525
+ <DxcFlex direction="column" gap="5rem">
526
+ <DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
527
+ <DxcCheckbox
528
+ label="You understand the selection and give your consent"
529
+ onChange={() => {}}
530
+ labelPosition="after"
531
+ />
532
+ <DxcButton label="Submit" onClick={() => {}} size="medium" margin={{ bottom: "xxlarge" }} />
533
+ </DxcFlex>
534
+ </ExampleContainer>
535
+ <ExampleContainer>
536
+ <Title title="Autosuggest Error" theme="dark" level={3} />
537
+ <div style={{ height: "100px" }}>
538
+ <Suggestions
539
+ id="x"
540
+ value=""
541
+ suggestions={country}
542
+ visualFocusIndex={-1}
543
+ highlightedSuggestions={false}
544
+ searchHasErrors={true}
545
+ isSearching={false}
546
+ suggestionOnClick={(suggestion) => {}}
547
+ getTextInputWidth={() => 350}
548
+ />
549
+ </div>
550
+ </ExampleContainer>
551
+ </DarkContainer>
552
+ </BackgroundColorProvider>
553
+ </ThemeProvider>
554
+ );
458
555
  };
459
556
 
460
- export const FocusedOptionOnDark = FocusedOptionAutosuggestOnDark.bind({});
461
- FocusedOptionOnDark.play = async ({ canvasElement }) => {
557
+ export const AutosuggestListboxStates = AutosuggestListbox.bind({});
558
+ AutosuggestListboxStates.play = async ({ canvasElement }) => {
462
559
  const canvas = within(canvasElement);
463
- const autosuggest = canvas.getByRole("combobox");
464
- await userEvent.click(autosuggest);
465
- fireEvent.keyDown(autosuggest, { key: "ArrowDown", code: "ArrowDown", keyCode: 40, charCode: 40 });
560
+ const select = canvas.getByRole("combobox");
561
+ await userEvent.click(select);
466
562
  };
467
563
 
468
- export const ActivedOptionOnDark = ActivedOptionAutosuggestOnDark.bind({});
469
- ActivedOptionOnDark.play = async ({ canvasElement }) => {
564
+ export const AutosuggestListboxOnDark = DarkAutosuggestListbox.bind({});
565
+ AutosuggestListboxOnDark.play = async ({ canvasElement }) => {
470
566
  const canvas = within(canvasElement);
471
- const autosuggest = canvas.getByRole("combobox");
472
- await userEvent.click(autosuggest);
567
+ const select = canvas.getByRole("combobox");
568
+ await userEvent.click(select);
473
569
  };