@dxc-technology/halstack-react 0.0.0-efa7c74 → 0.0.0-f00a97a

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 (268) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -4
  3. package/HalstackContext.d.ts +12 -0
  4. package/HalstackContext.js +295 -0
  5. package/accordion/Accordion.d.ts +1 -1
  6. package/accordion/Accordion.js +15 -47
  7. package/accordion/Accordion.stories.tsx +307 -0
  8. package/accordion/Accordion.test.js +72 -0
  9. package/accordion/types.d.ts +8 -8
  10. package/accordion-group/AccordionGroup.d.ts +1 -1
  11. package/accordion-group/AccordionGroup.js +16 -17
  12. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  13. package/accordion-group/AccordionGroup.test.js +151 -0
  14. package/accordion-group/types.d.ts +8 -8
  15. package/alert/Alert.js +6 -3
  16. package/alert/Alert.test.js +92 -0
  17. package/badge/Badge.d.ts +4 -0
  18. package/badge/Badge.js +6 -4
  19. package/badge/types.d.ts +5 -0
  20. package/{radio → badge}/types.js +0 -0
  21. package/bleed/Bleed.d.ts +3 -0
  22. package/bleed/Bleed.js +51 -0
  23. package/bleed/Bleed.stories.tsx +341 -0
  24. package/bleed/types.d.ts +37 -0
  25. package/bleed/types.js +5 -0
  26. package/box/Box.js +24 -34
  27. package/box/Box.test.js +18 -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/bulleted-list/types.js +5 -0
  33. package/button/Button.d.ts +1 -1
  34. package/button/Button.js +59 -82
  35. package/button/Button.stories.tsx +15 -8
  36. package/button/Button.test.js +35 -0
  37. package/button/types.d.ts +8 -12
  38. package/card/Card.js +25 -28
  39. package/card/Card.stories.tsx +1 -1
  40. package/card/Card.test.js +50 -0
  41. package/checkbox/Checkbox.d.ts +1 -1
  42. package/checkbox/Checkbox.js +45 -41
  43. package/checkbox/Checkbox.stories.tsx +124 -128
  44. package/checkbox/Checkbox.test.js +78 -0
  45. package/checkbox/types.d.ts +8 -4
  46. package/chip/Chip.d.ts +4 -0
  47. package/chip/Chip.js +16 -76
  48. package/chip/Chip.stories.tsx +6 -8
  49. package/chip/Chip.test.js +56 -0
  50. package/chip/types.d.ts +45 -0
  51. package/chip/types.js +5 -0
  52. package/common/variables.js +282 -355
  53. package/date-input/DateInput.js +66 -55
  54. package/date-input/DateInput.stories.tsx +7 -7
  55. package/date-input/DateInput.test.js +479 -0
  56. package/date-input/types.d.ts +16 -9
  57. package/dialog/Dialog.js +50 -53
  58. package/dialog/Dialog.stories.tsx +1 -2
  59. package/dialog/Dialog.test.js +70 -0
  60. package/dialog/types.d.ts +2 -2
  61. package/dropdown/Dropdown.d.ts +1 -1
  62. package/dropdown/Dropdown.js +242 -272
  63. package/dropdown/Dropdown.stories.tsx +312 -0
  64. package/dropdown/Dropdown.test.js +591 -0
  65. package/dropdown/DropdownMenu.d.ts +4 -0
  66. package/dropdown/DropdownMenu.js +80 -0
  67. package/dropdown/DropdownMenuItem.d.ts +4 -0
  68. package/dropdown/DropdownMenuItem.js +92 -0
  69. package/dropdown/types.d.ts +30 -19
  70. package/file-input/FileInput.d.ts +1 -1
  71. package/file-input/FileInput.js +165 -83
  72. package/file-input/FileInput.stories.tsx +507 -0
  73. package/file-input/FileInput.test.js +457 -0
  74. package/file-input/FileItem.js +12 -8
  75. package/file-input/types.d.ts +32 -7
  76. package/flex/Flex.d.ts +4 -0
  77. package/flex/Flex.js +57 -0
  78. package/flex/Flex.stories.tsx +103 -0
  79. package/flex/types.d.ts +21 -0
  80. package/flex/types.js +5 -0
  81. package/footer/Footer.d.ts +1 -1
  82. package/footer/Footer.js +32 -113
  83. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  84. package/footer/Footer.test.js +109 -0
  85. package/footer/Icons.d.ts +2 -0
  86. package/footer/Icons.js +4 -4
  87. package/footer/types.d.ts +21 -17
  88. package/header/Header.js +97 -116
  89. package/header/Header.stories.tsx +46 -36
  90. package/header/Header.test.js +79 -0
  91. package/header/Icons.d.ts +2 -0
  92. package/header/Icons.js +2 -2
  93. package/header/types.d.ts +2 -2
  94. package/heading/Heading.js +1 -1
  95. package/heading/Heading.stories.tsx +3 -2
  96. package/heading/Heading.test.js +186 -0
  97. package/inset/Inset.d.ts +3 -0
  98. package/inset/Inset.js +51 -0
  99. package/inset/Inset.stories.tsx +229 -0
  100. package/inset/types.d.ts +37 -0
  101. package/inset/types.js +5 -0
  102. package/layout/ApplicationLayout.d.ts +20 -0
  103. package/layout/ApplicationLayout.js +71 -135
  104. package/layout/ApplicationLayout.stories.tsx +161 -0
  105. package/layout/Icons.d.ts +5 -0
  106. package/layout/Icons.js +13 -2
  107. package/layout/SidenavContext.d.ts +5 -0
  108. package/layout/SidenavContext.js +19 -0
  109. package/layout/types.d.ts +42 -0
  110. package/layout/types.js +5 -0
  111. package/link/Link.d.ts +3 -2
  112. package/link/Link.js +61 -86
  113. package/link/Link.stories.tsx +99 -52
  114. package/link/Link.test.js +83 -0
  115. package/link/types.d.ts +9 -29
  116. package/main.d.ts +12 -12
  117. package/main.js +64 -58
  118. package/number-input/NumberInput.js +14 -24
  119. package/number-input/NumberInput.stories.tsx +5 -5
  120. package/number-input/NumberInput.test.js +506 -0
  121. package/number-input/types.d.ts +17 -10
  122. package/package.json +14 -10
  123. package/paginator/Paginator.js +19 -46
  124. package/paginator/Paginator.test.js +308 -0
  125. package/paragraph/Paragraph.d.ts +6 -0
  126. package/paragraph/Paragraph.js +38 -0
  127. package/paragraph/Paragraph.stories.tsx +44 -0
  128. package/password-input/PasswordInput.js +23 -19
  129. package/password-input/PasswordInput.stories.tsx +3 -3
  130. package/password-input/PasswordInput.test.js +180 -0
  131. package/password-input/types.d.ts +26 -21
  132. package/progress-bar/ProgressBar.d.ts +2 -2
  133. package/progress-bar/ProgressBar.js +59 -53
  134. package/progress-bar/ProgressBar.stories.jsx +13 -11
  135. package/progress-bar/ProgressBar.test.js +110 -0
  136. package/progress-bar/types.d.ts +3 -4
  137. package/quick-nav/QuickNav.d.ts +4 -0
  138. package/quick-nav/QuickNav.js +118 -0
  139. package/quick-nav/QuickNav.stories.tsx +264 -0
  140. package/quick-nav/types.d.ts +21 -0
  141. package/quick-nav/types.js +5 -0
  142. package/radio-group/Radio.d.ts +4 -0
  143. package/radio-group/Radio.js +141 -0
  144. package/radio-group/RadioGroup.d.ts +4 -0
  145. package/radio-group/RadioGroup.js +281 -0
  146. package/radio-group/RadioGroup.stories.tsx +100 -0
  147. package/radio-group/RadioGroup.test.js +695 -0
  148. package/radio-group/types.d.ts +114 -0
  149. package/radio-group/types.js +5 -0
  150. package/resultsetTable/ResultsetTable.d.ts +1 -1
  151. package/resultsetTable/ResultsetTable.js +9 -4
  152. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  153. package/resultsetTable/ResultsetTable.test.js +348 -0
  154. package/resultsetTable/types.d.ts +6 -2
  155. package/select/Icons.d.ts +10 -0
  156. package/select/Icons.js +93 -0
  157. package/select/Listbox.d.ts +4 -0
  158. package/select/Listbox.js +199 -0
  159. package/select/Option.d.ts +4 -0
  160. package/select/Option.js +110 -0
  161. package/select/Select.d.ts +4 -0
  162. package/select/Select.js +158 -380
  163. package/select/Select.stories.tsx +231 -176
  164. package/select/Select.test.js +2175 -0
  165. package/select/types.d.ts +210 -0
  166. package/select/types.js +5 -0
  167. package/sidenav/Sidenav.d.ts +6 -5
  168. package/sidenav/Sidenav.js +186 -54
  169. package/sidenav/Sidenav.stories.tsx +154 -139
  170. package/sidenav/Sidenav.test.js +44 -0
  171. package/sidenav/types.d.ts +50 -27
  172. package/slider/Slider.d.ts +1 -1
  173. package/slider/Slider.js +7 -6
  174. package/slider/Slider.stories.tsx +8 -8
  175. package/slider/Slider.test.js +187 -0
  176. package/slider/types.d.ts +4 -0
  177. package/spinner/Spinner.js +3 -3
  178. package/spinner/Spinner.stories.jsx +1 -0
  179. package/spinner/Spinner.test.js +64 -0
  180. package/switch/Switch.d.ts +2 -2
  181. package/switch/Switch.js +129 -57
  182. package/switch/Switch.stories.tsx +21 -43
  183. package/switch/Switch.test.js +212 -0
  184. package/switch/types.d.ts +9 -6
  185. package/table/Table.js +2 -2
  186. package/table/Table.stories.jsx +2 -1
  187. package/table/Table.test.js +26 -0
  188. package/tabs/Tabs.d.ts +1 -1
  189. package/tabs/Tabs.js +17 -19
  190. package/tabs/Tabs.stories.tsx +7 -16
  191. package/tabs/Tabs.test.js +140 -0
  192. package/tabs/types.d.ts +27 -15
  193. package/tabs-nav/NavTabs.d.ts +8 -0
  194. package/tabs-nav/NavTabs.js +125 -0
  195. package/tabs-nav/NavTabs.stories.tsx +170 -0
  196. package/tabs-nav/NavTabs.test.js +82 -0
  197. package/tabs-nav/Tab.d.ts +4 -0
  198. package/tabs-nav/Tab.js +130 -0
  199. package/tabs-nav/types.d.ts +53 -0
  200. package/tabs-nav/types.js +5 -0
  201. package/tag/Tag.d.ts +1 -1
  202. package/tag/Tag.js +18 -28
  203. package/tag/Tag.stories.tsx +26 -29
  204. package/tag/Tag.test.js +60 -0
  205. package/tag/types.d.ts +23 -14
  206. package/text-input/Suggestion.d.ts +4 -0
  207. package/text-input/Suggestion.js +55 -0
  208. package/text-input/TextInput.js +100 -124
  209. package/text-input/TextInput.stories.tsx +473 -0
  210. package/text-input/TextInput.test.js +1712 -0
  211. package/text-input/types.d.ts +44 -23
  212. package/textarea/Textarea.d.ts +4 -0
  213. package/textarea/Textarea.js +39 -79
  214. package/textarea/Textarea.stories.jsx +37 -15
  215. package/textarea/Textarea.test.js +437 -0
  216. package/textarea/types.d.ts +137 -0
  217. package/textarea/types.js +5 -0
  218. package/toggle-group/ToggleGroup.d.ts +1 -1
  219. package/toggle-group/ToggleGroup.js +15 -17
  220. package/toggle-group/ToggleGroup.stories.tsx +27 -32
  221. package/toggle-group/ToggleGroup.test.js +156 -0
  222. package/toggle-group/types.d.ts +47 -26
  223. package/typography/Typography.d.ts +4 -0
  224. package/typography/Typography.js +131 -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 +2 -0
  229. package/useTheme.js +2 -2
  230. package/useTranslatedLabels.d.ts +2 -0
  231. package/useTranslatedLabels.js +20 -0
  232. package/wizard/Wizard.d.ts +1 -1
  233. package/wizard/Wizard.js +112 -58
  234. package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +33 -24
  235. package/wizard/Wizard.test.js +141 -0
  236. package/wizard/types.d.ts +13 -12
  237. package/ThemeContext.js +0 -246
  238. package/V3Select/V3Select.js +0 -455
  239. package/V3Select/index.d.ts +0 -27
  240. package/V3Textarea/V3Textarea.js +0 -260
  241. package/V3Textarea/index.d.ts +0 -27
  242. package/chip/index.d.ts +0 -22
  243. package/date/Date.js +0 -373
  244. package/date/index.d.ts +0 -27
  245. package/input-text/Icons.js +0 -22
  246. package/input-text/InputText.js +0 -611
  247. package/input-text/index.d.ts +0 -36
  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/types.d.ts +0 -54
  252. package/select/index.d.ts +0 -131
  253. package/textarea/index.d.ts +0 -117
  254. package/toggle/Toggle.js +0 -186
  255. package/toggle/index.d.ts +0 -21
  256. package/upload/Upload.js +0 -201
  257. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  258. package/upload/buttons-upload/Icons.js +0 -40
  259. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  260. package/upload/dragAndDropArea/Icons.js +0 -39
  261. package/upload/file-upload/FileToUpload.js +0 -115
  262. package/upload/file-upload/Icons.js +0 -66
  263. package/upload/files-upload/FilesToUpload.js +0 -109
  264. package/upload/index.d.ts +0 -15
  265. package/upload/transaction/Icons.js +0 -160
  266. package/upload/transaction/Transaction.js +0 -104
  267. package/upload/transactions/Transactions.js +0 -94
  268. package/wizard/Icons.js +0 -65
@@ -0,0 +1,473 @@
1
+ import React from "react";
2
+ import { userEvent, within, fireEvent } from "@storybook/testing-library";
3
+ import { BackgroundColorProvider } from "../BackgroundColorContext";
4
+ import Title from "../../.storybook/components/Title";
5
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+ import DarkContainer from "../../.storybook/components/DarkSection";
7
+ import DxcTextInput from "./TextInput";
8
+
9
+ export default {
10
+ title: "Text input",
11
+ component: DxcTextInput,
12
+ };
13
+
14
+ const action = {
15
+ onClick: () => {},
16
+ icon: (
17
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
18
+ <path d="M0 0h24v24H0V0z" fill="none" />
19
+ <path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" />
20
+ </svg>
21
+ ),
22
+ };
23
+
24
+ const actionLargeIcon = {
25
+ onClick: () => {},
26
+ icon: (
27
+ <svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
28
+ <path d="M0 0h24v24H0V0z" fill="none" />
29
+ <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" />
30
+ </svg>
31
+ ),
32
+ };
33
+
34
+ const country = ["Afghanistan"];
35
+ const countries = [
36
+ "Afghanistan",
37
+ "Albania",
38
+ "Algeria",
39
+ "Andorra Andorra Andorra Andorra Andorra Andorra Andorra Andorra",
40
+ "Angola",
41
+ "Antigua and Barbuda Antigua and Barbuda Antigua and Barbuda",
42
+ "Bahamas",
43
+ "Bahrain",
44
+ "Bangladesh",
45
+ "Barbados",
46
+ "Cabo Verde",
47
+ "Cambodia",
48
+ "Cameroon",
49
+ "Canada",
50
+ "Cayman Islands, The",
51
+ "Central African Republic",
52
+ "Chad",
53
+ "Democratic Republic of the Congo",
54
+ "Dominican Republic",
55
+ "Dominica",
56
+ "Denmark",
57
+ "Djibouti",
58
+ ];
59
+
60
+ export const Chromatic = () => (
61
+ <>
62
+ <ExampleContainer pseudoState="pseudo-hover">
63
+ <Title title="Hovered input" theme="light" level={4} />
64
+ <DxcTextInput label="Text input" />
65
+ </ExampleContainer>
66
+ <ExampleContainer pseudoState="pseudo-focus-within">
67
+ <Title title="Focused input" theme="light" level={4} />
68
+ <DxcTextInput label="Text input" />
69
+ </ExampleContainer>
70
+ <ExampleContainer pseudoState="pseudo-hover">
71
+ <Title title="Hovered action" theme="light" level={4} />
72
+ <DxcTextInput label="Text input" defaultValue="Text" clearable />
73
+ </ExampleContainer>
74
+ <ExampleContainer>
75
+ <Title title="Without label" theme="light" level={4} />
76
+ <DxcTextInput />
77
+ </ExampleContainer>
78
+ <ExampleContainer>
79
+ <Title title="With label and placeholder" theme="light" level={4} />
80
+ <DxcTextInput label="Text input" placeholder="Placeholder" />
81
+ </ExampleContainer>
82
+ <ExampleContainer>
83
+ <Title title="Helper text, optional, and clearable" theme="light" level={4} />
84
+ <DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
85
+ </ExampleContainer>
86
+ <ExampleContainer>
87
+ <Title title="Clearable and large icon action" theme="light" level={4} />
88
+ <DxcTextInput
89
+ label="Text input"
90
+ defaultValue="Text text text text text text text text text text"
91
+ clearable
92
+ action={actionLargeIcon}
93
+ />
94
+ </ExampleContainer>
95
+ <ExampleContainer>
96
+ <Title title="Prefix" theme="light" level={4} />
97
+ <DxcTextInput label="With prefix" prefix="+34" />
98
+ </ExampleContainer>
99
+ <ExampleContainer>
100
+ <Title title="Suffix and action" theme="light" level={4} />
101
+ <DxcTextInput label="With suffix" suffix="USD" action={action} />
102
+ </ExampleContainer>
103
+ <ExampleContainer>
104
+ <Title title="Invalid" theme="light" level={4} />
105
+ <DxcTextInput
106
+ label="Error text input"
107
+ helperText="Help message"
108
+ error="Error message."
109
+ defaultValue="Text"
110
+ clearable
111
+ optional
112
+ action={action}
113
+ />
114
+ </ExampleContainer>
115
+ <ExampleContainer pseudoState="pseudo-hover">
116
+ <Title title="Invalid and hovered" theme="light" level={4} />
117
+ <DxcTextInput
118
+ label="Error text input"
119
+ helperText="Help message"
120
+ placeholder="Placeholder"
121
+ error="Error message."
122
+ />
123
+ </ExampleContainer>
124
+ <ExampleContainer>
125
+ <Title title="Disabled and placeholder" theme="light" level={4} />
126
+ <DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" />
127
+ </ExampleContainer>
128
+ <ExampleContainer>
129
+ <Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
130
+ <DxcTextInput
131
+ label="Disabled text input"
132
+ helperText="Help message"
133
+ disabled
134
+ optional
135
+ defaultValue="Text"
136
+ action={action}
137
+ />
138
+ </ExampleContainer>
139
+ <ExampleContainer>
140
+ <Title title="Disabled with prefix and suffix" theme="light" level={4} />
141
+ <DxcTextInput
142
+ label="Disabled text input"
143
+ helperText="Help message"
144
+ disabled
145
+ optional
146
+ prefix="+34"
147
+ suffix="USD"
148
+ defaultValue="Text"
149
+ action={action}
150
+ />
151
+ </ExampleContainer>
152
+ <BackgroundColorProvider color="#333333">
153
+ <DarkContainer>
154
+ <Title title="Dark" theme="dark" level={2} />
155
+ <ExampleContainer pseudoState="pseudo-hover">
156
+ <Title title="Hovered" theme="dark" level={4} />
157
+ <DxcTextInput label="Text input" />
158
+ </ExampleContainer>
159
+ <ExampleContainer pseudoState="pseudo-focus-within">
160
+ <Title title="Focused" theme="dark" level={4} />
161
+ <DxcTextInput label="Text input" />
162
+ </ExampleContainer>
163
+ <ExampleContainer pseudoState="pseudo-hover">
164
+ <Title title="Hovered action" theme="dark" level={4} />
165
+ <DxcTextInput label="Text input" defaultValue="Text" clearable />
166
+ </ExampleContainer>
167
+ <ExampleContainer>
168
+ <Title title="Helper text, placeholder, optional and action" theme="dark" level={4} />
169
+ <DxcTextInput
170
+ label="Text input"
171
+ helperText="Help message"
172
+ placeholder="Placeholder"
173
+ clearable
174
+ optional
175
+ action={action}
176
+ />
177
+ </ExampleContainer>
178
+ <ExampleContainer>
179
+ <Title title="Invalid" theme="dark" level={4} />
180
+ <DxcTextInput
181
+ label="Error text input"
182
+ helperText="Help message"
183
+ error="Error message."
184
+ defaultValue="Text"
185
+ clearable
186
+ action={action}
187
+ />
188
+ </ExampleContainer>
189
+ <ExampleContainer pseudoState="pseudo-hover">
190
+ <Title title="Invalid and hovered" theme="dark" level={4} />
191
+ <DxcTextInput
192
+ label="Error text input"
193
+ helperText="Help message"
194
+ placeholder="Placeholder"
195
+ error="Error message."
196
+ />
197
+ </ExampleContainer>
198
+ <ExampleContainer>
199
+ <Title title="Prefix and suffix" theme="dark" level={4} />
200
+ <DxcTextInput label="With prefix and suffix" prefix="+34" suffix="USD" />
201
+ </ExampleContainer>
202
+ <ExampleContainer>
203
+ <Title title="Disabled and placeholder" theme="dark" level={4} />
204
+ <DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" />
205
+ </ExampleContainer>
206
+ <ExampleContainer>
207
+ <Title title="Disabled, helper text, optional, value and action" theme="dark" level={4} />
208
+ <DxcTextInput
209
+ label="Disabled text input"
210
+ helperText="Help message"
211
+ disabled
212
+ optional
213
+ defaultValue="Text"
214
+ action={action}
215
+ />
216
+ </ExampleContainer>
217
+ <ExampleContainer>
218
+ <Title title="Disabled with prefix and suffix" theme="dark" level={4} />
219
+ <DxcTextInput
220
+ label="Disabled text input"
221
+ helperText="Help message"
222
+ disabled
223
+ optional
224
+ prefix="+34"
225
+ suffix="USD"
226
+ defaultValue="Text"
227
+ action={action}
228
+ />
229
+ </ExampleContainer>
230
+ </DarkContainer>
231
+ </BackgroundColorProvider>
232
+ <Title title="Margins" theme="light" level={2} />
233
+ <ExampleContainer>
234
+ <Title title="Xxsmall margin" theme="light" level={4} />
235
+ <DxcTextInput label="Xxsmall" margin="xxsmall" />
236
+ </ExampleContainer>
237
+ <ExampleContainer>
238
+ <Title title="Xsmall margin" theme="light" level={4} />
239
+ <DxcTextInput label="Xsmall" margin="xsmall" />
240
+ </ExampleContainer>
241
+ <ExampleContainer>
242
+ <Title title="Small margin" theme="light" level={4} />
243
+ <DxcTextInput label="Small" margin="small" />
244
+ </ExampleContainer>
245
+ <ExampleContainer>
246
+ <Title title="Medium margin" theme="light" level={4} />
247
+ <DxcTextInput label="Medium" margin="medium" />
248
+ </ExampleContainer>
249
+ <ExampleContainer>
250
+ <Title title="Large margin" theme="light" level={4} />
251
+ <DxcTextInput label="Large" margin="large" />
252
+ </ExampleContainer>
253
+ <ExampleContainer>
254
+ <Title title="Xlarge margin" theme="light" level={4} />
255
+ <DxcTextInput label="Xlarge" margin="xlarge" />
256
+ </ExampleContainer>
257
+ <ExampleContainer>
258
+ <Title title="Xxlarge margin" theme="light" level={4} />
259
+ <DxcTextInput label="Xxlarge" margin="xxlarge" />
260
+ </ExampleContainer>
261
+ <Title title="Sizes" theme="light" level={2} />
262
+ <ExampleContainer>
263
+ <Title title="Small size" theme="light" level={4} />
264
+ <DxcTextInput label="Small" size="small" />
265
+ </ExampleContainer>
266
+ <ExampleContainer>
267
+ <Title title="Medium size" theme="light" level={4} />
268
+ <DxcTextInput label="Medium" size="medium" />
269
+ </ExampleContainer>
270
+ <ExampleContainer>
271
+ <Title title="Large size" theme="light" level={4} />
272
+ <DxcTextInput label="Large" size="large" />
273
+ </ExampleContainer>
274
+ <ExampleContainer>
275
+ <Title title="FillParent size" theme="light" level={4} />
276
+ <DxcTextInput label="FillParent" size="fillParent" />
277
+ </ExampleContainer>
278
+ </>
279
+ );
280
+
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
+ );
333
+
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 />
351
+ </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 />
362
+ </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 />
373
+ </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();
394
+ };
395
+
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
+ };
402
+
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);
458
+ };
459
+
460
+ export const FocusedOptionOnDark = FocusedOptionAutosuggestOnDark.bind({});
461
+ FocusedOptionOnDark.play = async ({ canvasElement }) => {
462
+ 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 });
466
+ };
467
+
468
+ export const ActivedOptionOnDark = ActivedOptionAutosuggestOnDark.bind({});
469
+ ActivedOptionOnDark.play = async ({ canvasElement }) => {
470
+ const canvas = within(canvasElement);
471
+ const autosuggest = canvas.getByRole("combobox");
472
+ await userEvent.click(autosuggest);
473
+ };