@dxc-technology/halstack-react 0.0.0-d3554d7 → 0.0.0-d3ac293

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 (267) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +1 -1
  3. package/HalstackContext.d.ts +1336 -0
  4. package/HalstackContext.js +335 -0
  5. package/accordion/Accordion.d.ts +1 -1
  6. package/accordion/Accordion.js +118 -126
  7. package/accordion/Accordion.stories.tsx +115 -27
  8. package/accordion/Accordion.test.js +26 -12
  9. package/accordion/types.d.ts +9 -4
  10. package/accordion-group/AccordionGroup.d.ts +1 -1
  11. package/accordion-group/AccordionGroup.js +17 -38
  12. package/accordion-group/AccordionGroup.stories.tsx +28 -2
  13. package/accordion-group/AccordionGroup.test.js +31 -38
  14. package/accordion-group/types.d.ts +14 -3
  15. package/alert/Alert.js +7 -4
  16. package/alert/Alert.stories.tsx +28 -0
  17. package/alert/Alert.test.js +1 -1
  18. package/badge/Badge.d.ts +1 -1
  19. package/badge/Badge.js +5 -3
  20. package/badge/types.d.ts +1 -0
  21. package/bleed/Bleed.js +1 -34
  22. package/bleed/Bleed.stories.tsx +94 -95
  23. package/bleed/types.d.ts +25 -1
  24. package/box/Box.js +25 -37
  25. package/box/Box.stories.tsx +15 -0
  26. package/box/Box.test.js +1 -1
  27. package/box/types.d.ts +1 -0
  28. package/bulleted-list/BulletedList.d.ts +7 -0
  29. package/bulleted-list/BulletedList.js +123 -0
  30. package/bulleted-list/BulletedList.stories.tsx +200 -0
  31. package/bulleted-list/types.d.ts +11 -0
  32. package/button/Button.js +52 -69
  33. package/button/Button.stories.tsx +159 -8
  34. package/button/Button.test.js +1 -1
  35. package/button/types.d.ts +7 -7
  36. package/card/Card.js +25 -28
  37. package/card/Card.test.js +1 -1
  38. package/card/types.d.ts +1 -0
  39. package/checkbox/Checkbox.d.ts +2 -2
  40. package/checkbox/Checkbox.js +107 -110
  41. package/checkbox/Checkbox.stories.tsx +198 -130
  42. package/checkbox/Checkbox.test.js +101 -11
  43. package/checkbox/types.d.ts +13 -5
  44. package/chip/Chip.js +18 -24
  45. package/chip/Chip.stories.tsx +96 -9
  46. package/chip/Chip.test.js +3 -5
  47. package/chip/types.d.ts +1 -1
  48. package/common/utils.d.ts +1 -0
  49. package/common/utils.js +4 -4
  50. package/common/variables.d.ts +1625 -0
  51. package/common/variables.js +483 -352
  52. package/date-input/Calendar.d.ts +4 -0
  53. package/date-input/Calendar.js +258 -0
  54. package/date-input/DateInput.js +169 -258
  55. package/date-input/DateInput.stories.tsx +199 -33
  56. package/date-input/DateInput.test.js +521 -155
  57. package/date-input/DatePicker.d.ts +4 -0
  58. package/date-input/DatePicker.js +146 -0
  59. package/date-input/Icons.d.ts +6 -0
  60. package/date-input/Icons.js +75 -0
  61. package/date-input/YearPicker.d.ts +4 -0
  62. package/date-input/YearPicker.js +126 -0
  63. package/date-input/types.d.ts +67 -9
  64. package/dialog/Dialog.js +76 -93
  65. package/dialog/Dialog.stories.tsx +230 -123
  66. package/dialog/Dialog.test.js +334 -5
  67. package/dialog/types.d.ts +3 -2
  68. package/dropdown/Dropdown.d.ts +1 -1
  69. package/dropdown/Dropdown.js +246 -253
  70. package/dropdown/Dropdown.stories.tsx +245 -56
  71. package/dropdown/Dropdown.test.js +507 -110
  72. package/dropdown/DropdownMenu.d.ts +4 -0
  73. package/dropdown/DropdownMenu.js +70 -0
  74. package/dropdown/DropdownMenuItem.d.ts +4 -0
  75. package/dropdown/DropdownMenuItem.js +81 -0
  76. package/dropdown/types.d.ts +25 -5
  77. package/file-input/FileInput.d.ts +2 -2
  78. package/file-input/FileInput.js +181 -223
  79. package/file-input/FileInput.stories.tsx +122 -11
  80. package/file-input/FileInput.test.js +14 -14
  81. package/file-input/FileItem.d.ts +4 -14
  82. package/file-input/FileItem.js +44 -66
  83. package/file-input/types.d.ts +17 -0
  84. package/flex/Flex.d.ts +4 -0
  85. package/flex/Flex.js +69 -0
  86. package/flex/Flex.stories.tsx +103 -0
  87. package/flex/types.d.ts +32 -0
  88. package/footer/Footer.js +16 -89
  89. package/footer/Footer.stories.tsx +99 -1
  90. package/footer/Footer.test.js +14 -26
  91. package/footer/Icons.js +1 -1
  92. package/footer/types.d.ts +2 -1
  93. package/header/Header.js +108 -129
  94. package/header/Header.stories.tsx +189 -36
  95. package/header/Header.test.js +20 -4
  96. package/header/Icons.js +2 -2
  97. package/header/types.d.ts +3 -2
  98. package/heading/Heading.js +1 -1
  99. package/heading/Heading.test.js +1 -1
  100. package/inset/Inset.js +1 -34
  101. package/inset/Inset.stories.tsx +36 -36
  102. package/inset/types.d.ts +25 -1
  103. package/layout/ApplicationLayout.d.ts +16 -6
  104. package/layout/ApplicationLayout.js +72 -132
  105. package/layout/ApplicationLayout.stories.tsx +84 -93
  106. package/layout/Icons.d.ts +5 -0
  107. package/layout/Icons.js +13 -2
  108. package/layout/SidenavContext.d.ts +5 -0
  109. package/layout/SidenavContext.js +19 -0
  110. package/layout/types.d.ts +18 -33
  111. package/link/Link.d.ts +3 -2
  112. package/link/Link.js +59 -76
  113. package/link/Link.stories.tsx +155 -53
  114. package/link/Link.test.js +9 -19
  115. package/link/types.d.ts +7 -23
  116. package/main.d.ts +8 -10
  117. package/main.js +46 -56
  118. package/nav-tabs/NavTabs.d.ts +8 -0
  119. package/nav-tabs/NavTabs.js +125 -0
  120. package/nav-tabs/NavTabs.stories.tsx +260 -0
  121. package/nav-tabs/NavTabs.test.js +82 -0
  122. package/nav-tabs/Tab.d.ts +4 -0
  123. package/nav-tabs/Tab.js +150 -0
  124. package/nav-tabs/types.d.ts +53 -0
  125. package/number-input/NumberInput.js +11 -18
  126. package/number-input/NumberInput.stories.tsx +5 -5
  127. package/number-input/NumberInput.test.js +46 -12
  128. package/number-input/types.d.ts +17 -10
  129. package/package.json +20 -23
  130. package/paginator/Icons.d.ts +5 -0
  131. package/paginator/Icons.js +16 -28
  132. package/paginator/Paginator.js +19 -46
  133. package/paginator/Paginator.stories.tsx +24 -0
  134. package/paginator/Paginator.test.js +78 -39
  135. package/paragraph/Paragraph.d.ts +6 -0
  136. package/paragraph/Paragraph.js +38 -0
  137. package/paragraph/Paragraph.stories.tsx +44 -0
  138. package/password-input/PasswordInput.js +7 -4
  139. package/password-input/PasswordInput.test.js +17 -19
  140. package/password-input/types.d.ts +14 -11
  141. package/progress-bar/ProgressBar.d.ts +2 -2
  142. package/progress-bar/ProgressBar.js +61 -55
  143. package/progress-bar/ProgressBar.stories.jsx +47 -12
  144. package/progress-bar/ProgressBar.test.js +68 -23
  145. package/progress-bar/types.d.ts +3 -4
  146. package/quick-nav/QuickNav.d.ts +4 -0
  147. package/quick-nav/QuickNav.js +117 -0
  148. package/quick-nav/QuickNav.stories.tsx +356 -0
  149. package/quick-nav/types.d.ts +21 -0
  150. package/radio-group/Radio.d.ts +1 -1
  151. package/radio-group/Radio.js +43 -28
  152. package/radio-group/RadioGroup.js +32 -28
  153. package/radio-group/RadioGroup.stories.tsx +135 -17
  154. package/radio-group/RadioGroup.test.js +145 -117
  155. package/radio-group/types.d.ts +79 -2
  156. package/resultsetTable/Icons.d.ts +7 -0
  157. package/resultsetTable/Icons.js +51 -0
  158. package/resultsetTable/ResultsetTable.js +49 -108
  159. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  160. package/resultsetTable/ResultsetTable.test.js +61 -42
  161. package/resultsetTable/types.d.ts +2 -2
  162. package/select/Icons.d.ts +10 -0
  163. package/select/Icons.js +93 -0
  164. package/select/Listbox.d.ts +4 -0
  165. package/select/Listbox.js +169 -0
  166. package/select/Option.d.ts +4 -0
  167. package/select/Option.js +97 -0
  168. package/select/Select.js +179 -384
  169. package/select/Select.stories.tsx +531 -142
  170. package/select/Select.test.js +652 -324
  171. package/select/types.d.ts +53 -13
  172. package/sidenav/Sidenav.d.ts +6 -5
  173. package/sidenav/Sidenav.js +183 -53
  174. package/sidenav/Sidenav.stories.tsx +249 -149
  175. package/sidenav/Sidenav.test.js +25 -37
  176. package/sidenav/types.d.ts +50 -27
  177. package/slider/Slider.d.ts +2 -2
  178. package/slider/Slider.js +124 -98
  179. package/slider/Slider.stories.tsx +72 -9
  180. package/slider/Slider.test.js +143 -22
  181. package/slider/types.d.ts +10 -2
  182. package/spinner/Spinner.js +4 -4
  183. package/spinner/Spinner.stories.jsx +27 -1
  184. package/spinner/Spinner.test.js +1 -1
  185. package/switch/Switch.d.ts +2 -2
  186. package/switch/Switch.js +152 -69
  187. package/switch/Switch.stories.tsx +53 -42
  188. package/switch/Switch.test.js +156 -4
  189. package/switch/types.d.ts +12 -4
  190. package/table/Table.js +3 -3
  191. package/table/Table.stories.jsx +80 -1
  192. package/table/Table.test.js +2 -2
  193. package/tabs/Tab.d.ts +4 -0
  194. package/tabs/Tab.js +133 -0
  195. package/tabs/Tabs.d.ts +1 -1
  196. package/tabs/Tabs.js +363 -109
  197. package/tabs/Tabs.stories.tsx +119 -13
  198. package/tabs/Tabs.test.js +241 -14
  199. package/tabs/types.d.ts +19 -5
  200. package/tag/Tag.js +17 -22
  201. package/tag/Tag.stories.tsx +25 -8
  202. package/tag/Tag.test.js +1 -1
  203. package/tag/types.d.ts +1 -1
  204. package/text-input/Icons.d.ts +8 -0
  205. package/text-input/Icons.js +60 -0
  206. package/text-input/Suggestion.d.ts +4 -0
  207. package/text-input/Suggestion.js +84 -0
  208. package/text-input/Suggestions.d.ts +4 -0
  209. package/text-input/Suggestions.js +134 -0
  210. package/text-input/TextInput.js +221 -344
  211. package/text-input/TextInput.stories.tsx +290 -195
  212. package/text-input/TextInput.test.js +763 -731
  213. package/text-input/types.d.ts +50 -12
  214. package/textarea/Textarea.js +17 -26
  215. package/textarea/Textarea.stories.jsx +65 -6
  216. package/textarea/Textarea.test.js +38 -37
  217. package/textarea/types.d.ts +18 -11
  218. package/toggle-group/ToggleGroup.d.ts +1 -1
  219. package/toggle-group/ToggleGroup.js +6 -5
  220. package/toggle-group/ToggleGroup.stories.tsx +46 -4
  221. package/toggle-group/ToggleGroup.test.js +36 -5
  222. package/toggle-group/types.d.ts +9 -1
  223. package/typography/Typography.d.ts +4 -0
  224. package/typography/Typography.js +32 -0
  225. package/typography/Typography.stories.tsx +198 -0
  226. package/typography/types.d.ts +18 -0
  227. package/typography/types.js +5 -0
  228. package/useTheme.d.ts +1234 -1
  229. package/useTheme.js +3 -3
  230. package/useTranslatedLabels.d.ts +85 -0
  231. package/useTranslatedLabels.js +20 -0
  232. package/utils/BaseTypography.d.ts +21 -0
  233. package/utils/BaseTypography.js +108 -0
  234. package/utils/FocusLock.d.ts +13 -0
  235. package/utils/FocusLock.js +139 -0
  236. package/wizard/Wizard.d.ts +1 -1
  237. package/wizard/Wizard.js +59 -55
  238. package/wizard/Wizard.stories.tsx +48 -19
  239. package/wizard/Wizard.test.js +37 -24
  240. package/wizard/types.d.ts +10 -5
  241. package/ThemeContext.d.ts +0 -10
  242. package/ThemeContext.js +0 -243
  243. package/common/RequiredComponent.js +0 -32
  244. package/list/List.d.ts +0 -4
  245. package/list/List.js +0 -47
  246. package/list/List.stories.tsx +0 -95
  247. package/list/types.d.ts +0 -7
  248. package/radio/Radio.d.ts +0 -4
  249. package/radio/Radio.js +0 -174
  250. package/radio/Radio.stories.tsx +0 -192
  251. package/radio/Radio.test.js +0 -71
  252. package/radio/types.d.ts +0 -54
  253. package/row/Row.d.ts +0 -3
  254. package/row/Row.js +0 -127
  255. package/row/Row.stories.tsx +0 -237
  256. package/row/types.d.ts +0 -10
  257. package/stack/Stack.d.ts +0 -3
  258. package/stack/Stack.js +0 -97
  259. package/stack/Stack.stories.tsx +0 -164
  260. package/stack/types.d.ts +0 -9
  261. package/text/Text.d.ts +0 -7
  262. package/text/Text.js +0 -30
  263. package/text/Text.stories.tsx +0 -19
  264. /package/{list → bulleted-list}/types.js +0 -0
  265. /package/{radio → flex}/types.js +0 -0
  266. /package/{row → nav-tabs}/types.js +0 -0
  267. /package/{stack → quick-nav}/types.js +0 -0
@@ -1,11 +1,17 @@
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";
14
+ import { HalstackProvider } from "../HalstackContext";
9
15
 
10
16
  export default {
11
17
  title: "Text input",
@@ -22,7 +28,7 @@ const action = {
22
28
  ),
23
29
  };
24
30
 
25
- const actionLargeIcon = {
31
+ const actionLargeIconSVG = {
26
32
  onClick: () => {},
27
33
  icon: (
28
34
  <svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
@@ -32,6 +38,11 @@ const actionLargeIcon = {
32
38
  ),
33
39
  };
34
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
+
35
46
  const country = ["Afghanistan"];
36
47
  const countries = [
37
48
  "Afghanistan",
@@ -56,8 +67,16 @@ const countries = [
56
67
  "Dominica",
57
68
  "Denmark",
58
69
  "Djibouti",
70
+ "*",
59
71
  ];
60
72
 
73
+ const opinionatedTheme = {
74
+ textInput: {
75
+ fontColor: "#000000",
76
+ hoverBorderColor: "#a46ede",
77
+ },
78
+ };
79
+
61
80
  export const Chromatic = () => (
62
81
  <>
63
82
  <ExampleContainer pseudoState="pseudo-hover">
@@ -70,7 +89,15 @@ export const Chromatic = () => (
70
89
  </ExampleContainer>
71
90
  <ExampleContainer pseudoState="pseudo-hover">
72
91
  <Title title="Hovered action" theme="light" level={4} />
73
- <DxcTextInput label="Text input" value="Text" clearable />
92
+ <DxcTextInput label="Text input" defaultValue="Text" clearable />
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 />
74
101
  </ExampleContainer>
75
102
  <ExampleContainer>
76
103
  <Title title="Without label" theme="light" level={4} />
@@ -82,15 +109,24 @@ export const Chromatic = () => (
82
109
  </ExampleContainer>
83
110
  <ExampleContainer>
84
111
  <Title title="Helper text, optional, and clearable" theme="light" level={4} />
85
- <DxcTextInput label="Text input" clearable value="Text" helperText="Help message" optional />
112
+ <DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
86
113
  </ExampleContainer>
87
114
  <ExampleContainer>
88
- <Title title="Clearable and large icon action" theme="light" level={4} />
115
+ <Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
89
116
  <DxcTextInput
90
117
  label="Text input"
91
- value="Text text text text text text text text text text"
118
+ defaultValue="Text text text text text text text text text text"
92
119
  clearable
93
- 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}
94
130
  />
95
131
  </ExampleContainer>
96
132
  <ExampleContainer>
@@ -107,7 +143,7 @@ export const Chromatic = () => (
107
143
  label="Error text input"
108
144
  helperText="Help message"
109
145
  error="Error message."
110
- value="Text"
146
+ defaultValue="Text"
111
147
  clearable
112
148
  optional
113
149
  action={action}
@@ -133,7 +169,7 @@ export const Chromatic = () => (
133
169
  helperText="Help message"
134
170
  disabled
135
171
  optional
136
- value="Text"
172
+ defaultValue="Text"
137
173
  action={action}
138
174
  />
139
175
  </ExampleContainer>
@@ -146,13 +182,13 @@ export const Chromatic = () => (
146
182
  optional
147
183
  prefix="+34"
148
184
  suffix="USD"
149
- value="Text"
185
+ defaultValue="Text"
150
186
  action={action}
151
187
  />
152
188
  </ExampleContainer>
153
189
  <BackgroundColorProvider color="#333333">
154
190
  <DarkContainer>
155
- <Title title="Dark" theme="dark" level={2} />
191
+ <Title title="Dark theme" theme="dark" level={2} />
156
192
  <ExampleContainer pseudoState="pseudo-hover">
157
193
  <Title title="Hovered" theme="dark" level={4} />
158
194
  <DxcTextInput label="Text input" />
@@ -163,7 +199,15 @@ export const Chromatic = () => (
163
199
  </ExampleContainer>
164
200
  <ExampleContainer pseudoState="pseudo-hover">
165
201
  <Title title="Hovered action" theme="dark" level={4} />
166
- <DxcTextInput label="Text input" value="Text" clearable />
202
+ <DxcTextInput label="Text input" defaultValue="Text" clearable />
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 />
167
211
  </ExampleContainer>
168
212
  <ExampleContainer>
169
213
  <Title title="Helper text, placeholder, optional and action" theme="dark" level={4} />
@@ -182,7 +226,7 @@ export const Chromatic = () => (
182
226
  label="Error text input"
183
227
  helperText="Help message"
184
228
  error="Error message."
185
- value="Text"
229
+ defaultValue="Text"
186
230
  clearable
187
231
  action={action}
188
232
  />
@@ -211,7 +255,7 @@ export const Chromatic = () => (
211
255
  helperText="Help message"
212
256
  disabled
213
257
  optional
214
- value="Text"
258
+ defaultValue="Text"
215
259
  action={action}
216
260
  />
217
261
  </ExampleContainer>
@@ -224,7 +268,7 @@ export const Chromatic = () => (
224
268
  optional
225
269
  prefix="+34"
226
270
  suffix="USD"
227
- value="Text"
271
+ defaultValue="Text"
228
272
  action={action}
229
273
  />
230
274
  </ExampleContainer>
@@ -276,199 +320,250 @@ export const Chromatic = () => (
276
320
  <Title title="FillParent size" theme="light" level={4} />
277
321
  <DxcTextInput label="FillParent" size="fillParent" />
278
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>
279
383
  </>
280
384
  );
281
385
 
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
- );
386
+ const AutosuggestListbox = () => {
387
+ const colorsTheme: any = useTheme();
302
388
 
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
- );
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 />
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>
352
482
  </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 />
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
+ />
363
496
  </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 />
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
+ />
374
510
  </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 />
385
- </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);
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();
511
+ </ThemeProvider>
512
+ );
438
513
  };
439
514
 
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
- };
515
+ const DarkAutosuggestListbox = () => {
516
+ const colorsTheme: any = useTheme();
446
517
 
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);
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="80px">
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
+ );
459
555
  };
460
556
 
461
- export const FocusedOptionOnDark = FocusedOptionAutosuggestOnDark.bind({});
462
- FocusedOptionOnDark.play = async ({ canvasElement }) => {
557
+ export const AutosuggestListboxStates = AutosuggestListbox.bind({});
558
+ AutosuggestListboxStates.play = async ({ canvasElement }) => {
463
559
  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 });
560
+ const select = canvas.getByRole("combobox");
561
+ await userEvent.click(select);
467
562
  };
468
563
 
469
- export const ActivedOptionOnDark = ActivedOptionAutosuggestOnDark.bind({});
470
- ActivedOptionOnDark.play = async ({ canvasElement }) => {
564
+ export const AutosuggestListboxOnDark = DarkAutosuggestListbox.bind({});
565
+ AutosuggestListboxOnDark.play = async ({ canvasElement }) => {
471
566
  const canvas = within(canvasElement);
472
- const autosuggest = canvas.getByRole("combobox");
473
- await userEvent.click(autosuggest);
567
+ const select = canvas.getByRole("combobox");
568
+ await userEvent.click(select);
474
569
  };