@dxc-technology/halstack-react 0.0.0-74ba970 → 0.0.0-752ca0a

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 (234) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +1 -1
  3. package/HalstackContext.d.ts +1349 -5
  4. package/HalstackContext.js +117 -77
  5. package/README.md +47 -0
  6. package/accordion/Accordion.d.ts +1 -1
  7. package/accordion/Accordion.js +14 -37
  8. package/accordion/Accordion.stories.tsx +104 -113
  9. package/accordion/Accordion.test.js +1 -1
  10. package/accordion/types.d.ts +2 -13
  11. package/accordion-group/AccordionGroup.d.ts +4 -3
  12. package/accordion-group/AccordionGroup.js +23 -44
  13. package/accordion-group/AccordionGroup.stories.tsx +77 -76
  14. package/accordion-group/AccordionGroup.test.js +7 -17
  15. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  16. package/accordion-group/AccordionGroupAccordion.js +43 -0
  17. package/accordion-group/types.d.ts +2 -13
  18. package/alert/Alert.js +4 -8
  19. package/alert/Alert.stories.tsx +28 -0
  20. package/alert/Alert.test.js +1 -1
  21. package/bleed/Bleed.stories.tsx +1 -0
  22. package/box/Box.d.ts +1 -1
  23. package/box/Box.js +7 -26
  24. package/box/Box.stories.tsx +38 -51
  25. package/box/Box.test.js +1 -1
  26. package/box/types.d.ts +0 -11
  27. package/bulleted-list/BulletedList.js +4 -2
  28. package/bulleted-list/BulletedList.stories.tsx +7 -1
  29. package/bulleted-list/types.d.ts +31 -4
  30. package/button/Button.d.ts +1 -1
  31. package/button/Button.js +48 -60
  32. package/button/Button.stories.tsx +151 -9
  33. package/button/Button.test.js +12 -1
  34. package/button/types.d.ts +7 -3
  35. package/card/Card.d.ts +1 -1
  36. package/card/Card.js +27 -45
  37. package/card/Card.stories.tsx +12 -42
  38. package/card/Card.test.js +1 -1
  39. package/card/types.d.ts +1 -6
  40. package/checkbox/Checkbox.d.ts +2 -2
  41. package/checkbox/Checkbox.js +71 -51
  42. package/checkbox/Checkbox.stories.tsx +146 -58
  43. package/checkbox/Checkbox.test.js +84 -11
  44. package/checkbox/types.d.ts +10 -2
  45. package/chip/Chip.js +28 -49
  46. package/chip/Chip.stories.tsx +121 -26
  47. package/chip/Chip.test.js +3 -5
  48. package/common/OpenSans.css +68 -80
  49. package/common/coreTokens.d.ts +146 -0
  50. package/common/coreTokens.js +167 -0
  51. package/common/utils.d.ts +1 -0
  52. package/common/utils.js +4 -4
  53. package/common/variables.d.ts +1499 -0
  54. package/common/variables.js +1004 -1134
  55. package/date-input/Calendar.d.ts +4 -0
  56. package/date-input/Calendar.js +258 -0
  57. package/date-input/DateInput.js +138 -239
  58. package/date-input/DateInput.stories.tsx +209 -33
  59. package/date-input/DateInput.test.js +519 -149
  60. package/date-input/DatePicker.d.ts +4 -0
  61. package/date-input/DatePicker.js +146 -0
  62. package/date-input/Icons.d.ts +6 -0
  63. package/date-input/Icons.js +75 -0
  64. package/date-input/YearPicker.d.ts +4 -0
  65. package/date-input/YearPicker.js +126 -0
  66. package/date-input/types.d.ts +55 -0
  67. package/dialog/Dialog.d.ts +1 -1
  68. package/dialog/Dialog.js +54 -85
  69. package/dialog/Dialog.stories.tsx +154 -170
  70. package/dialog/Dialog.test.js +302 -3
  71. package/dialog/types.d.ts +0 -12
  72. package/dropdown/Dropdown.js +40 -39
  73. package/dropdown/Dropdown.stories.tsx +210 -84
  74. package/dropdown/Dropdown.test.js +21 -26
  75. package/dropdown/DropdownMenu.js +12 -18
  76. package/dropdown/DropdownMenuItem.js +4 -17
  77. package/dropdown/types.d.ts +3 -3
  78. package/file-input/FileInput.d.ts +2 -2
  79. package/file-input/FileInput.js +174 -220
  80. package/file-input/FileInput.stories.tsx +122 -11
  81. package/file-input/FileInput.test.js +14 -14
  82. package/file-input/FileItem.d.ts +4 -14
  83. package/file-input/FileItem.js +39 -63
  84. package/file-input/types.d.ts +18 -1
  85. package/flex/Flex.d.ts +1 -1
  86. package/flex/Flex.js +33 -19
  87. package/flex/Flex.stories.tsx +35 -26
  88. package/flex/types.d.ts +83 -7
  89. package/footer/Footer.d.ts +1 -1
  90. package/footer/Footer.js +44 -64
  91. package/footer/Footer.stories.tsx +36 -21
  92. package/footer/Footer.test.js +16 -26
  93. package/footer/types.d.ts +10 -11
  94. package/grid/Grid.d.ts +7 -0
  95. package/grid/Grid.js +91 -0
  96. package/grid/Grid.stories.tsx +219 -0
  97. package/grid/types.d.ts +115 -0
  98. package/header/Header.d.ts +4 -3
  99. package/header/Header.js +20 -49
  100. package/header/Header.stories.tsx +115 -36
  101. package/header/Header.test.js +2 -2
  102. package/header/types.d.ts +1 -14
  103. package/heading/Heading.js +1 -1
  104. package/heading/Heading.test.js +1 -1
  105. package/image/Image.d.ts +4 -0
  106. package/image/Image.js +85 -0
  107. package/image/Image.stories.tsx +127 -0
  108. package/image/types.d.ts +72 -0
  109. package/inset/Inset.stories.tsx +2 -1
  110. package/layout/ApplicationLayout.d.ts +5 -5
  111. package/layout/ApplicationLayout.js +15 -12
  112. package/layout/ApplicationLayout.stories.tsx +1 -1
  113. package/layout/Icons.d.ts +7 -4
  114. package/layout/Icons.js +52 -56
  115. package/layout/types.d.ts +2 -3
  116. package/link/Link.js +4 -4
  117. package/link/Link.stories.tsx +60 -0
  118. package/link/Link.test.js +2 -4
  119. package/link/types.d.ts +2 -2
  120. package/main.d.ts +4 -2
  121. package/main.js +17 -1
  122. package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
  123. package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
  124. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +110 -6
  125. package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
  126. package/{tabs-nav → nav-tabs}/Tab.js +48 -32
  127. package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
  128. package/nav-tabs/types.js +5 -0
  129. package/number-input/NumberInput.d.ts +7 -0
  130. package/number-input/NumberInput.js +6 -4
  131. package/number-input/NumberInput.test.js +317 -98
  132. package/package.json +9 -14
  133. package/paginator/Icons.d.ts +5 -0
  134. package/paginator/Icons.js +16 -28
  135. package/paginator/Paginator.js +8 -16
  136. package/paginator/Paginator.stories.tsx +24 -0
  137. package/paginator/Paginator.test.js +58 -48
  138. package/paragraph/Paragraph.d.ts +3 -4
  139. package/paragraph/Paragraph.js +5 -5
  140. package/password-input/Icons.d.ts +6 -0
  141. package/password-input/Icons.js +39 -0
  142. package/password-input/PasswordInput.js +35 -82
  143. package/password-input/PasswordInput.stories.tsx +1 -0
  144. package/password-input/PasswordInput.test.js +34 -40
  145. package/progress-bar/ProgressBar.d.ts +2 -2
  146. package/progress-bar/ProgressBar.js +5 -5
  147. package/progress-bar/ProgressBar.stories.jsx +35 -2
  148. package/progress-bar/ProgressBar.test.js +1 -1
  149. package/progress-bar/types.d.ts +4 -3
  150. package/quick-nav/QuickNav.js +11 -12
  151. package/quick-nav/QuickNav.stories.tsx +111 -19
  152. package/radio-group/Radio.js +10 -10
  153. package/radio-group/RadioGroup.js +15 -13
  154. package/radio-group/RadioGroup.stories.tsx +131 -18
  155. package/radio-group/RadioGroup.test.js +117 -60
  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 +41 -64
  161. package/resultsetTable/types.d.ts +1 -1
  162. package/select/Listbox.d.ts +1 -1
  163. package/select/Listbox.js +5 -34
  164. package/select/Option.js +11 -24
  165. package/select/Select.js +59 -36
  166. package/select/Select.stories.tsx +497 -153
  167. package/select/Select.test.js +345 -292
  168. package/select/types.d.ts +2 -2
  169. package/sidenav/Icons.d.ts +7 -0
  170. package/sidenav/Icons.js +51 -0
  171. package/sidenav/Sidenav.d.ts +2 -2
  172. package/sidenav/Sidenav.js +66 -96
  173. package/sidenav/Sidenav.stories.tsx +165 -63
  174. package/sidenav/types.d.ts +21 -18
  175. package/slider/Slider.d.ts +2 -2
  176. package/slider/Slider.js +17 -14
  177. package/slider/Slider.stories.tsx +57 -0
  178. package/slider/Slider.test.js +1 -1
  179. package/slider/types.d.ts +6 -2
  180. package/spinner/Spinner.js +17 -23
  181. package/spinner/Spinner.stories.jsx +53 -27
  182. package/spinner/Spinner.test.js +1 -1
  183. package/switch/Switch.d.ts +3 -3
  184. package/switch/Switch.js +7 -6
  185. package/switch/Switch.stories.tsx +33 -0
  186. package/switch/Switch.test.js +1 -1
  187. package/switch/types.d.ts +8 -3
  188. package/table/Table.js +3 -3
  189. package/table/Table.stories.jsx +80 -1
  190. package/table/Table.test.js +2 -2
  191. package/tabs/Tab.js +12 -15
  192. package/tabs/Tabs.js +11 -17
  193. package/tabs/Tabs.stories.tsx +45 -5
  194. package/tabs/Tabs.test.js +4 -5
  195. package/tabs/types.d.ts +2 -2
  196. package/tag/Tag.js +7 -9
  197. package/tag/Tag.stories.tsx +14 -1
  198. package/tag/Tag.test.js +1 -1
  199. package/text-input/Suggestion.js +34 -7
  200. package/text-input/TextInput.js +224 -228
  201. package/text-input/TextInput.stories.tsx +132 -5
  202. package/text-input/TextInput.test.js +757 -658
  203. package/text-input/types.d.ts +9 -0
  204. package/textarea/Textarea.js +27 -26
  205. package/textarea/Textarea.stories.jsx +68 -1
  206. package/textarea/Textarea.test.js +61 -19
  207. package/textarea/types.d.ts +4 -0
  208. package/toggle-group/ToggleGroup.d.ts +2 -2
  209. package/toggle-group/ToggleGroup.js +85 -59
  210. package/toggle-group/ToggleGroup.stories.tsx +48 -3
  211. package/toggle-group/ToggleGroup.test.js +38 -24
  212. package/toggle-group/types.d.ts +22 -13
  213. package/typography/Typography.d.ts +2 -2
  214. package/typography/Typography.js +14 -113
  215. package/typography/Typography.stories.tsx +1 -1
  216. package/useTheme.d.ts +1251 -1
  217. package/useTheme.js +1 -1
  218. package/useTranslatedLabels.d.ts +84 -1
  219. package/utils/BaseTypography.d.ts +21 -0
  220. package/utils/BaseTypography.js +108 -0
  221. package/utils/FocusLock.d.ts +13 -0
  222. package/utils/FocusLock.js +138 -0
  223. package/wizard/Wizard.js +2 -2
  224. package/wizard/Wizard.stories.tsx +20 -0
  225. package/wizard/Wizard.test.js +1 -1
  226. package/wizard/types.d.ts +5 -6
  227. package/card/ice-cream.jpg +0 -0
  228. package/common/RequiredComponent.js +0 -32
  229. package/number-input/NumberInputContext.d.ts +0 -4
  230. package/number-input/NumberInputContext.js +0 -19
  231. package/number-input/numberInputContextTypes.d.ts +0 -19
  232. /package/{tabs-nav → grid}/types.js +0 -0
  233. /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
  234. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
@@ -11,6 +11,7 @@ import DxcFlex from "../flex/Flex";
11
11
  import Suggestions from "./Suggestions";
12
12
  import { ThemeProvider } from "styled-components";
13
13
  import useTheme from "../useTheme";
14
+ import { HalstackProvider } from "../HalstackContext";
14
15
 
15
16
  export default {
16
17
  title: "Text input",
@@ -27,7 +28,7 @@ const action = {
27
28
  ),
28
29
  };
29
30
 
30
- const actionLargeIcon = {
31
+ const actionLargeIconSVG = {
31
32
  onClick: () => {},
32
33
  icon: (
33
34
  <svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
@@ -37,6 +38,11 @@ const actionLargeIcon = {
37
38
  ),
38
39
  };
39
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
+
40
46
  const country = ["Afghanistan"];
41
47
  const countries = [
42
48
  "Afghanistan",
@@ -61,8 +67,16 @@ const countries = [
61
67
  "Dominica",
62
68
  "Denmark",
63
69
  "Djibouti",
70
+ "*",
64
71
  ];
65
72
 
73
+ const opinionatedTheme = {
74
+ textInput: {
75
+ fontColor: "#000000",
76
+ hoverBorderColor: "#a46ede",
77
+ },
78
+ };
79
+
66
80
  export const Chromatic = () => (
67
81
  <>
68
82
  <ExampleContainer pseudoState="pseudo-hover">
@@ -98,12 +112,21 @@ export const Chromatic = () => (
98
112
  <DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
99
113
  </ExampleContainer>
100
114
  <ExampleContainer>
101
- <Title title="Clearable and large icon action" theme="light" level={4} />
115
+ <Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
102
116
  <DxcTextInput
103
117
  label="Text input"
104
118
  defaultValue="Text text text text text text text text text text"
105
119
  clearable
106
- 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}
107
130
  />
108
131
  </ExampleContainer>
109
132
  <ExampleContainer>
@@ -163,6 +186,45 @@ export const Chromatic = () => (
163
186
  action={action}
164
187
  />
165
188
  </ExampleContainer>
189
+ <ExampleContainer>
190
+ <Title title="Read only" theme="light" level={4} />
191
+ <DxcTextInput
192
+ label="Example label"
193
+ helperText="Help message"
194
+ clearable
195
+ readOnly
196
+ optional
197
+ prefix="+34"
198
+ defaultValue="Text"
199
+ action={action}
200
+ />
201
+ </ExampleContainer>
202
+ <ExampleContainer pseudoState="pseudo-hover">
203
+ <Title title="Hovered read only" theme="light" level={4} />
204
+ <DxcTextInput
205
+ label="Example label"
206
+ helperText="Help message"
207
+ clearable
208
+ readOnly
209
+ optional
210
+ prefix="+34"
211
+ defaultValue="Text"
212
+ action={action}
213
+ />
214
+ </ExampleContainer>
215
+ <ExampleContainer pseudoState="pseudo-active">
216
+ <Title title="Active read only" theme="light" level={4} />
217
+ <DxcTextInput
218
+ label="Example label"
219
+ helperText="Help message"
220
+ clearable
221
+ readOnly
222
+ optional
223
+ prefix="+34"
224
+ defaultValue="Text"
225
+ action={action}
226
+ />
227
+ </ExampleContainer>
166
228
  <BackgroundColorProvider color="#333333">
167
229
  <DarkContainer>
168
230
  <Title title="Dark theme" theme="dark" level={2} />
@@ -297,6 +359,66 @@ export const Chromatic = () => (
297
359
  <Title title="FillParent size" theme="light" level={4} />
298
360
  <DxcTextInput label="FillParent" size="fillParent" />
299
361
  </ExampleContainer>
362
+ <Title title="Opinionated theme" theme="light" level={2} />
363
+ <ExampleContainer>
364
+ <HalstackProvider theme={opinionatedTheme}>
365
+ <ExampleContainer pseudoState="pseudo-hover">
366
+ <Title title="Hovered input" theme="light" level={4} />
367
+ <DxcTextInput label="Text input" helperText="Help message" />
368
+ </ExampleContainer>
369
+ <ExampleContainer pseudoState="pseudo-focus-within">
370
+ <Title title="Focused input" theme="light" level={4} />
371
+ <DxcTextInput label="Text input" helperText="Help message" />
372
+ </ExampleContainer>
373
+ <ExampleContainer pseudoState="pseudo-hover">
374
+ <Title title="Hovered action" theme="light" level={4} />
375
+ <DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
376
+ </ExampleContainer>
377
+ <ExampleContainer pseudoState="pseudo-active">
378
+ <Title title="Actived action" theme="light" level={4} />
379
+ <DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
380
+ </ExampleContainer>
381
+ <ExampleContainer pseudoState="pseudo-focus">
382
+ <Title title="Focused action" theme="light" level={4} />
383
+ <DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
384
+ </ExampleContainer>
385
+ <ExampleContainer>
386
+ <Title title="Prefix" theme="light" level={4} />
387
+ <DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
388
+ </ExampleContainer>
389
+ <ExampleContainer>
390
+ <Title title="Suffix and action" theme="light" level={4} />
391
+ <DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
392
+ </ExampleContainer>
393
+ <ExampleContainer>
394
+ <Title title="Invalid" theme="light" level={4} />
395
+ <DxcTextInput
396
+ label="Error text input"
397
+ helperText="Help message"
398
+ error="Error message."
399
+ defaultValue="Text"
400
+ clearable
401
+ optional
402
+ action={action}
403
+ />
404
+ </ExampleContainer>
405
+ <ExampleContainer>
406
+ <Title title="Disabled and placeholder" theme="light" level={4} />
407
+ <DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
408
+ </ExampleContainer>
409
+ <ExampleContainer>
410
+ <Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
411
+ <DxcTextInput
412
+ label="Disabled text input"
413
+ helperText="Help message"
414
+ disabled
415
+ optional
416
+ defaultValue="Text"
417
+ action={action}
418
+ />
419
+ </ExampleContainer>
420
+ </HalstackProvider>
421
+ </ExampleContainer>
300
422
  </>
301
423
  );
302
424
 
@@ -308,7 +430,11 @@ const AutosuggestListbox = () => {
308
430
  <ExampleContainer>
309
431
  <Title title="Autosuggest listbox" theme="light" level={2} />
310
432
  <ExampleContainer>
311
- <Title title="List dialog uses a Radix Popover to appear over elements with a certain z-index" theme="light" level={3} />
433
+ <Title
434
+ title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
435
+ theme="light"
436
+ level={3}
437
+ />
312
438
  <div
313
439
  style={{
314
440
  display: "flex",
@@ -322,6 +448,7 @@ const AutosuggestListbox = () => {
322
448
  borderRadius: "4px",
323
449
  overflow: "auto",
324
450
  zIndex: "1300",
451
+ position: "relative",
325
452
  }}
326
453
  >
327
454
  <DxcTextInput
@@ -434,7 +561,7 @@ const DarkAutosuggestListbox = () => {
434
561
  <Title title="Dark theme" theme="dark" level={2} />
435
562
  <ExampleContainer>
436
563
  <Title title="Default with opened suggestions" theme="dark" level={3} />
437
- <DxcFlex direction="column" gap="80px">
564
+ <DxcFlex direction="column" gap="5rem">
438
565
  <DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
439
566
  <DxcCheckbox
440
567
  label="You understand the selection and give your consent"