@dxc-technology/halstack-react 0.0.0-7da4003 → 0.0.0-7dc5422

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 (359) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +47 -0
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +243 -0
  5. package/{dist/select/Select.js → V3Select/V3Select.js} +40 -134
  6. package/V3Select/index.d.ts +27 -0
  7. package/{dist/V3Textarea → V3Textarea}/V3Textarea.js +12 -16
  8. package/V3Textarea/index.d.ts +27 -0
  9. package/accordion/Accordion.d.ts +4 -0
  10. package/{dist/accordion → accordion}/Accordion.js +37 -132
  11. package/accordion/Accordion.stories.tsx +307 -0
  12. package/accordion/types.d.ts +68 -0
  13. package/accordion/types.js +5 -0
  14. package/accordion-group/AccordionGroup.d.ts +7 -0
  15. package/accordion-group/AccordionGroup.js +170 -0
  16. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  17. package/accordion-group/types.d.ts +72 -0
  18. package/accordion-group/types.js +5 -0
  19. package/alert/Alert.d.ts +4 -0
  20. package/{dist/alert → alert}/Alert.js +40 -153
  21. package/alert/Alert.stories.tsx +170 -0
  22. package/alert/types.d.ts +49 -0
  23. package/alert/types.js +5 -0
  24. package/badge/Badge.js +59 -0
  25. package/bleed/Bleed.d.ts +3 -0
  26. package/bleed/Bleed.js +84 -0
  27. package/bleed/Bleed.stories.tsx +342 -0
  28. package/bleed/types.d.ts +13 -0
  29. package/bleed/types.js +5 -0
  30. package/box/Box.d.ts +4 -0
  31. package/{dist/box → box}/Box.js +15 -45
  32. package/box/Box.stories.tsx +132 -0
  33. package/box/types.d.ts +43 -0
  34. package/box/types.js +5 -0
  35. package/button/Button.d.ts +4 -0
  36. package/{dist/button → button}/Button.js +27 -94
  37. package/button/Button.stories.tsx +274 -0
  38. package/button/types.d.ts +53 -0
  39. package/button/types.js +5 -0
  40. package/card/Card.d.ts +4 -0
  41. package/{dist/card → card}/Card.js +34 -124
  42. package/card/Card.stories.tsx +201 -0
  43. package/card/ice-cream.jpg +0 -0
  44. package/card/types.d.ts +67 -0
  45. package/card/types.js +5 -0
  46. package/checkbox/Checkbox.d.ts +4 -0
  47. package/{dist/checkbox → checkbox}/Checkbox.js +18 -65
  48. package/checkbox/Checkbox.stories.tsx +192 -0
  49. package/checkbox/types.d.ts +60 -0
  50. package/checkbox/types.js +5 -0
  51. package/chip/Chip.d.ts +4 -0
  52. package/{dist/chip → chip}/Chip.js +22 -88
  53. package/chip/Chip.stories.tsx +121 -0
  54. package/chip/types.d.ts +53 -0
  55. package/chip/types.js +5 -0
  56. package/{dist/common → common}/OpenSans.css +0 -0
  57. package/{dist/common → common}/RequiredComponent.js +3 -11
  58. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  59. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  60. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  61. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  62. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  63. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  64. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  65. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  66. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  67. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  68. package/{dist/common → common}/utils.js +0 -0
  69. package/{dist/common → common}/variables.js +213 -170
  70. package/{dist/date → date}/Date.js +22 -28
  71. package/date/index.d.ts +27 -0
  72. package/date-input/DateInput.d.ts +4 -0
  73. package/{dist/date-input → date-input}/DateInput.js +32 -74
  74. package/date-input/DateInput.stories.tsx +138 -0
  75. package/date-input/types.d.ts +100 -0
  76. package/date-input/types.js +5 -0
  77. package/dialog/Dialog.d.ts +4 -0
  78. package/{dist/dialog → dialog}/Dialog.js +24 -76
  79. package/dialog/Dialog.stories.tsx +212 -0
  80. package/dialog/types.d.ts +43 -0
  81. package/dialog/types.js +5 -0
  82. package/dropdown/Dropdown.d.ts +4 -0
  83. package/{dist/dropdown → dropdown}/Dropdown.js +45 -172
  84. package/dropdown/Dropdown.stories.tsx +247 -0
  85. package/dropdown/types.d.ts +89 -0
  86. package/dropdown/types.js +5 -0
  87. package/file-input/FileInput.d.ts +4 -0
  88. package/file-input/FileInput.js +590 -0
  89. package/file-input/FileInput.stories.tsx +507 -0
  90. package/file-input/FileItem.d.ts +14 -0
  91. package/file-input/FileItem.js +184 -0
  92. package/file-input/types.d.ts +112 -0
  93. package/file-input/types.js +5 -0
  94. package/footer/Footer.d.ts +4 -0
  95. package/footer/Footer.js +260 -0
  96. package/footer/Footer.stories.tsx +130 -0
  97. package/footer/Icons.d.ts +2 -0
  98. package/{dist/footer → footer}/Icons.js +15 -15
  99. package/footer/types.d.ts +65 -0
  100. package/footer/types.js +5 -0
  101. package/header/Header.d.ts +7 -0
  102. package/header/Header.js +324 -0
  103. package/header/Header.stories.tsx +162 -0
  104. package/header/Icons.d.ts +2 -0
  105. package/{dist/header → header}/Icons.js +7 -32
  106. package/header/types.d.ts +47 -0
  107. package/header/types.js +5 -0
  108. package/heading/Heading.d.ts +4 -0
  109. package/{dist/heading → heading}/Heading.js +31 -90
  110. package/heading/Heading.stories.tsx +54 -0
  111. package/heading/types.d.ts +33 -0
  112. package/heading/types.js +5 -0
  113. package/{dist/input-text → input-text}/Icons.js +2 -2
  114. package/{dist/input-text → input-text}/InputText.js +38 -132
  115. package/input-text/index.d.ts +36 -0
  116. package/inset/Inset.d.ts +3 -0
  117. package/inset/Inset.js +84 -0
  118. package/inset/Inset.stories.tsx +229 -0
  119. package/inset/types.d.ts +13 -0
  120. package/inset/types.js +5 -0
  121. package/layout/ApplicationLayout.d.ts +10 -0
  122. package/{dist/layout → layout}/ApplicationLayout.js +39 -141
  123. package/layout/ApplicationLayout.stories.tsx +171 -0
  124. package/{dist/layout → layout}/Icons.js +7 -7
  125. package/layout/types.d.ts +57 -0
  126. package/layout/types.js +5 -0
  127. package/link/Link.d.ts +3 -0
  128. package/{dist/link → link}/Link.js +19 -95
  129. package/link/Link.stories.tsx +146 -0
  130. package/link/types.d.ts +74 -0
  131. package/link/types.js +5 -0
  132. package/list/List.d.ts +8 -0
  133. package/list/List.js +47 -0
  134. package/list/List.stories.tsx +95 -0
  135. package/main.d.ts +48 -0
  136. package/{dist/main.js → main.js} +116 -88
  137. package/number-input/NumberInput.d.ts +4 -0
  138. package/number-input/NumberInput.js +83 -0
  139. package/number-input/NumberInput.stories.tsx +115 -0
  140. package/number-input/NumberInputContext.d.ts +4 -0
  141. package/{dist/number-input → number-input}/NumberInputContext.js +5 -2
  142. package/number-input/numberInputContextTypes.d.ts +19 -0
  143. package/number-input/numberInputContextTypes.js +5 -0
  144. package/number-input/types.d.ts +117 -0
  145. package/number-input/types.js +5 -0
  146. package/package.json +34 -25
  147. package/{dist/paginator → paginator}/Icons.js +9 -9
  148. package/paginator/Paginator.d.ts +4 -0
  149. package/paginator/Paginator.js +192 -0
  150. package/paginator/Paginator.stories.tsx +63 -0
  151. package/paginator/types.d.ts +38 -0
  152. package/paginator/types.js +5 -0
  153. package/password-input/PasswordInput.d.ts +4 -0
  154. package/{dist/password-input → password-input}/PasswordInput.js +43 -78
  155. package/password-input/PasswordInput.stories.tsx +131 -0
  156. package/password-input/types.d.ts +107 -0
  157. package/password-input/types.js +5 -0
  158. package/progress-bar/ProgressBar.d.ts +4 -0
  159. package/{dist/progress-bar → progress-bar}/ProgressBar.js +22 -94
  160. package/progress-bar/ProgressBar.stories.jsx +58 -0
  161. package/progress-bar/types.d.ts +37 -0
  162. package/progress-bar/types.js +5 -0
  163. package/radio/Radio.d.ts +4 -0
  164. package/{dist/radio → radio}/Radio.js +17 -52
  165. package/radio/Radio.stories.tsx +192 -0
  166. package/radio/types.d.ts +54 -0
  167. package/radio/types.js +5 -0
  168. package/radio-group/Radio.d.ts +4 -0
  169. package/radio-group/Radio.js +130 -0
  170. package/radio-group/RadioGroup.d.ts +4 -0
  171. package/radio-group/RadioGroup.js +268 -0
  172. package/radio-group/RadioGroup.stories.tsx +79 -0
  173. package/radio-group/types.d.ts +36 -0
  174. package/radio-group/types.js +5 -0
  175. package/resultsetTable/ResultsetTable.d.ts +4 -0
  176. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +39 -146
  177. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  178. package/resultsetTable/types.d.ts +67 -0
  179. package/resultsetTable/types.js +5 -0
  180. package/row/Row.d.ts +11 -0
  181. package/row/Row.js +127 -0
  182. package/row/Row.stories.tsx +239 -0
  183. package/select/Select.d.ts +4 -0
  184. package/select/Select.js +863 -0
  185. package/select/Select.stories.tsx +572 -0
  186. package/select/types.d.ts +170 -0
  187. package/select/types.js +5 -0
  188. package/sidenav/Sidenav.d.ts +9 -0
  189. package/{dist/sidenav → sidenav}/Sidenav.js +21 -64
  190. package/sidenav/Sidenav.stories.tsx +182 -0
  191. package/sidenav/types.d.ts +50 -0
  192. package/sidenav/types.js +5 -0
  193. package/slider/Slider.d.ts +4 -0
  194. package/{dist/slider → slider}/Slider.js +74 -161
  195. package/slider/Slider.stories.tsx +177 -0
  196. package/slider/types.d.ts +78 -0
  197. package/slider/types.js +5 -0
  198. package/spinner/Spinner.d.ts +4 -0
  199. package/spinner/Spinner.js +250 -0
  200. package/spinner/Spinner.stories.jsx +103 -0
  201. package/spinner/types.d.ts +32 -0
  202. package/spinner/types.js +5 -0
  203. package/stack/Stack.d.ts +10 -0
  204. package/stack/Stack.js +97 -0
  205. package/stack/Stack.stories.tsx +166 -0
  206. package/switch/Switch.d.ts +4 -0
  207. package/{dist/switch → switch}/Switch.js +28 -71
  208. package/switch/Switch.stories.tsx +160 -0
  209. package/switch/types.d.ts +58 -0
  210. package/switch/types.js +5 -0
  211. package/table/Table.d.ts +4 -0
  212. package/{dist/table → table}/Table.js +12 -26
  213. package/table/Table.stories.jsx +277 -0
  214. package/table/types.d.ts +21 -0
  215. package/table/types.js +5 -0
  216. package/tabs/Tabs.d.ts +4 -0
  217. package/tabs/Tabs.js +213 -0
  218. package/tabs/Tabs.stories.tsx +122 -0
  219. package/tabs/types.d.ts +70 -0
  220. package/tabs/types.js +5 -0
  221. package/tag/Tag.d.ts +4 -0
  222. package/tag/Tag.js +193 -0
  223. package/tag/Tag.stories.tsx +145 -0
  224. package/tag/types.d.ts +60 -0
  225. package/tag/types.js +5 -0
  226. package/text/Text.d.ts +7 -0
  227. package/text/Text.js +30 -0
  228. package/text/Text.stories.tsx +19 -0
  229. package/text-input/TextInput.d.ts +4 -0
  230. package/{dist/text-input → text-input}/TextInput.js +279 -456
  231. package/text-input/TextInput.stories.tsx +456 -0
  232. package/text-input/types.d.ts +159 -0
  233. package/text-input/types.js +5 -0
  234. package/textarea/Textarea.d.ts +4 -0
  235. package/{dist/textarea → textarea}/Textarea.js +38 -123
  236. package/textarea/Textarea.stories.jsx +136 -0
  237. package/textarea/types.d.ts +130 -0
  238. package/textarea/types.js +5 -0
  239. package/{dist/toggle → toggle}/Toggle.js +16 -50
  240. package/toggle/index.d.ts +21 -0
  241. package/toggle-group/ToggleGroup.d.ts +4 -0
  242. package/{dist/toggle-group → toggle-group}/ToggleGroup.js +35 -148
  243. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  244. package/toggle-group/types.d.ts +97 -0
  245. package/toggle-group/types.js +5 -0
  246. package/{dist/upload → upload}/Upload.js +14 -18
  247. package/upload/buttons-upload/ButtonsUpload.js +111 -0
  248. package/{dist/upload → upload}/buttons-upload/Icons.js +7 -7
  249. package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
  250. package/{dist/upload → upload}/dragAndDropArea/Icons.js +6 -6
  251. package/upload/file-upload/FileToUpload.js +115 -0
  252. package/{dist/upload → upload}/file-upload/Icons.js +13 -13
  253. package/{dist/upload → upload}/files-upload/FilesToUpload.js +13 -27
  254. package/upload/index.d.ts +15 -0
  255. package/{dist/upload → upload}/transaction/Icons.js +31 -31
  256. package/upload/transaction/Transaction.js +104 -0
  257. package/upload/transactions/Transactions.js +94 -0
  258. package/useTheme.d.ts +2 -0
  259. package/{dist/useTheme.js → useTheme.js} +1 -1
  260. package/wizard/Wizard.d.ts +4 -0
  261. package/wizard/Wizard.js +281 -0
  262. package/wizard/Wizard.stories.tsx +224 -0
  263. package/wizard/types.d.ts +60 -0
  264. package/wizard/types.js +5 -0
  265. package/README.md +0 -66
  266. package/babel.config.js +0 -8
  267. package/dist/BackgroundColorContext.js +0 -46
  268. package/dist/ThemeContext.js +0 -248
  269. package/dist/accordion-group/AccordionGroup.js +0 -186
  270. package/dist/alert/index.d.ts +0 -51
  271. package/dist/badge/Badge.js +0 -63
  272. package/dist/checkbox/Checkbox.stories.js +0 -144
  273. package/dist/checkbox/readme.md +0 -116
  274. package/dist/date/Date.stories.js +0 -205
  275. package/dist/date/readme.md +0 -73
  276. package/dist/date-input/index.d.ts +0 -95
  277. package/dist/file-input/FileInput.js +0 -644
  278. package/dist/file-input/FileItem.js +0 -280
  279. package/dist/file-input/index.d.ts +0 -81
  280. package/dist/footer/Footer.js +0 -421
  281. package/dist/header/Header.js +0 -434
  282. package/dist/link/readme.md +0 -51
  283. package/dist/main.d.ts +0 -8
  284. package/dist/new-select/NewSelect.js +0 -836
  285. package/dist/new-select/index.d.ts +0 -53
  286. package/dist/number-input/NumberInput.js +0 -136
  287. package/dist/number-input/index.d.ts +0 -113
  288. package/dist/paginator/Paginator.js +0 -283
  289. package/dist/password-input/index.d.ts +0 -94
  290. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  291. package/dist/progress-bar/readme.md +0 -63
  292. package/dist/radio/Radio.stories.js +0 -166
  293. package/dist/radio/readme.md +0 -70
  294. package/dist/slider/readme.md +0 -64
  295. package/dist/spinner/Spinner.js +0 -381
  296. package/dist/spinner/Spinner.stories.js +0 -183
  297. package/dist/spinner/readme.md +0 -65
  298. package/dist/switch/Switch.stories.js +0 -134
  299. package/dist/switch/readme.md +0 -133
  300. package/dist/tabs/Tabs.js +0 -343
  301. package/dist/tabs/Tabs.stories.js +0 -130
  302. package/dist/tabs/readme.md +0 -78
  303. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  304. package/dist/tabs-for-sections/readme.md +0 -78
  305. package/dist/tag/Tag.js +0 -282
  306. package/dist/text-input/index.d.ts +0 -135
  307. package/dist/textarea/index.d.ts +0 -117
  308. package/dist/toggle/Toggle.stories.js +0 -297
  309. package/dist/toggle/readme.md +0 -80
  310. package/dist/upload/Upload.stories.js +0 -72
  311. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
  312. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  313. package/dist/upload/file-upload/FileToUpload.js +0 -189
  314. package/dist/upload/readme.md +0 -37
  315. package/dist/upload/transaction/Transaction.js +0 -148
  316. package/dist/upload/transactions/Transactions.js +0 -138
  317. package/dist/wizard/Icons.js +0 -65
  318. package/dist/wizard/Wizard.js +0 -405
  319. package/test/Accordion.test.js +0 -33
  320. package/test/AccordionGroup.test.js +0 -125
  321. package/test/Alert.test.js +0 -53
  322. package/test/Box.test.js +0 -10
  323. package/test/Button.test.js +0 -18
  324. package/test/Card.test.js +0 -30
  325. package/test/Checkbox.test.js +0 -45
  326. package/test/Chip.test.js +0 -25
  327. package/test/Date.test.js +0 -397
  328. package/test/DateInput.test.js +0 -242
  329. package/test/Dialog.test.js +0 -23
  330. package/test/Dropdown.test.js +0 -145
  331. package/test/FileInput.test.js +0 -201
  332. package/test/Footer.test.js +0 -94
  333. package/test/Header.test.js +0 -34
  334. package/test/Heading.test.js +0 -35
  335. package/test/InputText.test.js +0 -248
  336. package/test/Link.test.js +0 -43
  337. package/test/NumberInput.test.js +0 -259
  338. package/test/Paginator.test.js +0 -177
  339. package/test/PasswordInput.test.js +0 -83
  340. package/test/ProgressBar.test.js +0 -35
  341. package/test/Radio.test.js +0 -37
  342. package/test/ResultsetTable.test.js +0 -329
  343. package/test/Select.test.js +0 -212
  344. package/test/Sidenav.test.js +0 -45
  345. package/test/Slider.test.js +0 -74
  346. package/test/Spinner.test.js +0 -32
  347. package/test/Switch.test.js +0 -45
  348. package/test/Table.test.js +0 -36
  349. package/test/Tabs.test.js +0 -109
  350. package/test/TabsForSections.test.js +0 -34
  351. package/test/Tag.test.js +0 -32
  352. package/test/TextInput.test.js +0 -732
  353. package/test/Textarea.test.js +0 -193
  354. package/test/ToggleGroup.test.js +0 -85
  355. package/test/Upload.test.js +0 -60
  356. package/test/V3TextArea.test.js +0 -51
  357. package/test/Wizard.test.js +0 -130
  358. package/test/mocks/pngMock.js +0 -1
  359. package/test/mocks/svgMock.js +0 -1
@@ -1,135 +0,0 @@
1
- type Size = "small" | "medium" | "large" | "fillParent";
2
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- type Margin = {
4
- top?: Space;
5
- bottom?: Space;
6
- left?: Space;
7
- right?: Space;
8
- };
9
- type SVG = string | (HTMLElement & SVGElement);
10
- type Action = {
11
- onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
12
- icon: SVG;
13
- };
14
-
15
- type Props = {
16
- /**
17
- * Text to be placed above the input. This label will be used as the aria-label attribute of the list of suggestions.
18
- */
19
- label?: string;
20
- /**
21
- * Name attribute of the input element.
22
- */
23
- name?: string;
24
- /**
25
- * Value of the input. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
26
- */
27
- value?: string;
28
- /**
29
- * Helper text to be placed above the input.
30
- */
31
- helperText?: string;
32
- /**
33
- * Text to be put as placeholder of the input.
34
- */
35
- placeholder?: string;
36
- /**
37
- * Action to be shown in the input. This is an object composed of an onClick function and an icon,
38
- * being the latter either an inline svg or a URL to the image.
39
- */
40
- action?: Action;
41
- /**
42
- * If true, the input will have an action to clear the entered value.
43
- */
44
- clearable?: boolean;
45
- /**
46
- * If true, the component will be disabled.
47
- */
48
- disabled?: boolean;
49
- /**
50
- * If true, the input will be optional, showing '(Optional)'
51
- * next to the label. Otherwise, the field will be considered required and an error will be
52
- * passed as a parameter to the OnBlur and onChange functions when it has
53
- * not been filled.
54
- */
55
- optional?: boolean;
56
- /**
57
- * Prefix to be placed before the input value.
58
- */
59
- prefix?: string;
60
- /**
61
- * Suffix to be placed after the input value.
62
- */
63
- suffix?: string;
64
- /**
65
- * This function will be called when the user types within the input
66
- * element of the component. An object including the current value and
67
- * the error (if the value entered is not valid) will be passed to this
68
- * function. If there is no error, error will be null.
69
- */
70
- onChange?: (val: { value: string; error: string }) => void;
71
- /**
72
- * This function will be called when the input element loses the focus.
73
- * An object including the input value and the error (if the value
74
- * entered is not valid) will be passed to this function. If there is no error,
75
- * error will be null.
76
- */
77
- onBlur?: (obj: { value: string; error: string }) => void;
78
- /**
79
- * If it is defined, the component will change its appearance, showing
80
- * the error below the input component. If it is not defined, the error
81
- * messages will be managed internally, but never displayed on its own.
82
- */
83
- error?: string;
84
- /**
85
- * These are the options to be displayed as suggestions. It can be either an array or a function:
86
- * - Array: Array of options that will be filtered by the component.
87
- * - Function: This function will be called when the user changes the value, we will send as a parameter the new value;
88
- * apart from that this function should return one promise on which we should make 'then' to get the suggestions filtered.
89
- */
90
- suggestions?: string[] | (() => void);
91
- /**
92
- * Regular expression that defines the valid format allowed by the input.
93
- * This will be checked both when the input element loses the focus and
94
- * while typing within it. If the string entered does not match the
95
- * pattern, the onBlur and onChange functions will be called with the
96
- * current value and an internal error informing that this value does not
97
- * match the pattern. If the pattern is met, the error parameter of both
98
- * events will be null.
99
- */
100
- pattern?: string;
101
- /**
102
- * Specifies the minimun and maximum length allowed by the input.
103
- * This will be checked both when the input element loses the
104
- * focus and while typing within it. If the string entered does not
105
- * comply the length, the onBlur and onChange functions will be called
106
- * with the current value and an internal error informing that the value
107
- * length does not comply the specified range. If a valid length is
108
- * reached, the error parameter of both events will be null.
109
- */
110
- length?: { min?: number; max?: number };
111
- /**
112
- * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
113
- * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
114
- */
115
- autocomplete?: string;
116
- /**
117
- * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
118
- * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
119
- */
120
- margin?: Space | Margin;
121
- /**
122
- * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
123
- */
124
- size?: Size;
125
- /**
126
- * Value of the tabindex attribute.
127
- */
128
- tabIndex?: number;
129
- /**
130
- * Reference to the component.
131
- */
132
- ref?: React.RefObject<HTMLDivElement>;
133
- };
134
-
135
- export default function DxcTextInput(props: Props): JSX.Element;
@@ -1,117 +0,0 @@
1
- type Size = "small" | "medium" | "large" | "fillParent";
2
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- type Margin = {
4
- top?: Space;
5
- bottom?: Space;
6
- left?: Space;
7
- right?: Space;
8
- };
9
-
10
- type Props = {
11
- /**
12
- * Text to be placed above the textarea.
13
- */
14
- label?: string;
15
- /**
16
- * Name attribute of the textarea element.
17
- */
18
- name?: string;
19
- /**
20
- * Value of the textarea. If undefined, the component will be uncontrolled and the value will be managed internally.
21
- */
22
- value?: string;
23
- /**
24
- * Helper text to be placed above the textarea.
25
- */
26
- helperText?: string;
27
- /**
28
- * Text to be put as placeholder of the textarea.
29
- */
30
- placeholder?: string;
31
- /**
32
- * If true, the component will be disabled.
33
- */
34
- disabled?: boolean;
35
- /**
36
- * If true, the textarea will be optional, showing '(Optional)'
37
- * next to the label. Otherwise, the field will be considered required
38
- * and an error will be passed as a parameter to the OnBlur and onChange functions
39
- * when it has not been filled.
40
- */
41
- optional?: boolean;
42
- /**
43
- * Defines the textarea's ability to resize vertically. It can be:
44
- * - 'auto': The textarea grows or shrinks automatically in order to fit the content.
45
- * - 'manual': The height of the textarea is enabled to be manually modified.
46
- * - 'none': The textarea has a fixed height and can't be modified.
47
- */
48
- verticalGrow?: "auto" | "manual" | "none";
49
- /**
50
- * Number of rows of the textarea.
51
- */
52
- rows?: number;
53
- /**
54
- * This function will be called when the user types within the textarea.
55
- * An object including the current value and the error (if the value
56
- * entered is not valid) will be passed to this function.
57
- * If there is no error, error will be null.
58
- */
59
- onChange?: (val: { value: string; error: string }) => void;
60
- /**
61
- * This function will be called when the textarea loses the focus. An
62
- * object including the textarea value and the error (if the value entered
63
- * is not valid) will be passed to this function. If there is no error,
64
- * error will be null.
65
- */
66
- onBlur?: (val: { value: string; error: string }) => void;
67
- /**
68
- * If it is defined, the component will change its appearance, showing
69
- * the error below the textarea. If it is not defined, the error
70
- * messages will be managed internally, but never displayed on its own.
71
- */
72
- error?: string;
73
- /**
74
- * Regular expression that defines the valid format allowed by the
75
- * textarea. This will be checked both when the textarea loses the focus
76
- * and while typing within it. If the string entered does not match the
77
- * pattern, the onBlur and onChange functions will be called with the
78
- * current value and an internal error informing that this value does not
79
- * match the pattern. If the pattern is met, the error parameter of both
80
- * events will be null.
81
- */
82
- pattern?: string;
83
- /**
84
- * Specifies the minimun and maximum length allowed by the textarea.
85
- * This will be checked both when the textarea loses the
86
- * focus and while typing within it. If the string entered does not
87
- * comply the length, the onBlur and onChange functions will be called
88
- * with the current value and an internal error informing that the value
89
- * length does not comply the specified range. If a valid length is
90
- * reached, the error parameter of both events will be null.
91
- */
92
- length?: { min: number; max: number };
93
- /**
94
- * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the textarea value.
95
- * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
96
- */
97
- autocomplete?: string;
98
- /**
99
- * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
100
- * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
101
- */
102
- margin?: Space | Margin;
103
- /**
104
- * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
105
- */
106
- size?: Size;
107
- /**
108
- * Value of the tabindex attribute.
109
- */
110
- tabIndex?: number;
111
- /**
112
- * Reference to the component.
113
- */
114
- ref?: React.RefObject<HTMLDivElement>;
115
- };
116
-
117
- export default function DxcTextarea(props: Props): JSX.Element;
@@ -1,297 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
-
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
-
11
- var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
12
-
13
- var _react = _interopRequireWildcard(require("react"));
14
-
15
- var _react2 = require("@storybook/react");
16
-
17
- var _addonActions = require("@storybook/addon-actions");
18
-
19
- var _addonKnobs = require("@storybook/addon-knobs");
20
-
21
- var _amazon = _interopRequireDefault(require("../../.storybook/public/amazon.svg"));
22
-
23
- var _Toggle = _interopRequireDefault(require("./Toggle.jsx"));
24
-
25
- var _readme = _interopRequireDefault(require("./readme.md"));
26
-
27
- var onClick = (0, _addonActions.action)("onClick");
28
-
29
- onClick.toString = function () {
30
- return "onClickHandler";
31
- };
32
-
33
- (0, _react2.storiesOf)("Form Components|Toggle", module).add("Types", function () {
34
- var ControlledStory = function ControlledStory(_ref) {
35
- (0, _objectDestructuringEmpty2["default"])(_ref);
36
-
37
- var _useState = (0, _react.useState)(false),
38
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
39
- selected = _useState2[0],
40
- setSelected = _useState2[1];
41
-
42
- var _useState3 = (0, _react.useState)(false),
43
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
44
- selected1 = _useState4[0],
45
- setselected1 = _useState4[1];
46
-
47
- var _useState5 = (0, _react.useState)(false),
48
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
49
- selected2 = _useState6[0],
50
- setselected2 = _useState6[1];
51
-
52
- var _useState7 = (0, _react.useState)(false),
53
- _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
54
- selected3 = _useState8[0],
55
- setselected3 = _useState8[1];
56
-
57
- var _useState9 = (0, _react.useState)(false),
58
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
59
- selected4 = _useState10[0],
60
- setselected4 = _useState10[1];
61
-
62
- var _useState11 = (0, _react.useState)(false),
63
- _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
64
- selected5 = _useState12[0],
65
- setselected5 = _useState12[1];
66
-
67
- var _useState13 = (0, _react.useState)(false),
68
- _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
69
- selected6 = _useState14[0],
70
- setSelected6 = _useState14[1];
71
-
72
- var _useState15 = (0, _react.useState)(false),
73
- _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
74
- selected7 = _useState16[0],
75
- setselected7 = _useState16[1];
76
-
77
- var _useState17 = (0, _react.useState)(false),
78
- _useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
79
- selected8 = _useState18[0],
80
- setselected8 = _useState18[1];
81
-
82
- var _useState19 = (0, _react.useState)(false),
83
- _useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
84
- selected9 = _useState20[0],
85
- setselected9 = _useState20[1];
86
-
87
- var _useState21 = (0, _react.useState)(false),
88
- _useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
89
- selected10 = _useState22[0],
90
- setselected10 = _useState22[1];
91
-
92
- var _useState23 = (0, _react.useState)(false),
93
- _useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
94
- selected11 = _useState24[0],
95
- setselected11 = _useState24[1];
96
-
97
- var click = function click(value) {
98
- setSelected(!value);
99
- };
100
-
101
- var click1 = function click1(value) {
102
- setselected1(!value);
103
- };
104
-
105
- var click2 = function click2(value) {
106
- setselected2(!value);
107
- };
108
-
109
- var click3 = function click3(value) {
110
- setselected3(!value);
111
- };
112
-
113
- var click4 = function click4(value) {
114
- setselected4(!value);
115
- };
116
-
117
- var click5 = function click5(value) {
118
- setselected5(!value);
119
- };
120
-
121
- var click6 = function click6(value) {
122
- setSelected6(!value);
123
- };
124
-
125
- var click7 = function click7(value) {
126
- setselected7(!value);
127
- };
128
-
129
- var click8 = function click8(value) {
130
- setselected8(!value);
131
- };
132
-
133
- var click9 = function click9(value) {
134
- setselected9(!value);
135
- };
136
-
137
- var click10 = function click10(value) {
138
- setselected10(!value);
139
- };
140
-
141
- var click11 = function click11(value) {
142
- setselected11(!value);
143
- };
144
-
145
- return _react["default"].createElement("div", null, _react["default"].createElement("h3", null, "Light"), _react["default"].createElement("div", {
146
- style: {
147
- width: "100%",
148
- display: "inline-flex",
149
- alignItems: "center"
150
- }
151
- }, _react["default"].createElement(_Toggle["default"], {
152
- iconSrc: _amazon["default"],
153
- label: "Toggle 1",
154
- selected: selected,
155
- onClick: click
156
- }), _react["default"].createElement(_Toggle["default"], {
157
- label: "Toggle 2",
158
- selected: true,
159
- disabled: true
160
- }), _react["default"].createElement(_Toggle["default"], {
161
- iconSrc: _amazon["default"],
162
- selected: selected1,
163
- onClick: click1
164
- }), _react["default"].createElement(_Toggle["default"], {
165
- label: "Disabled Ripple",
166
- disableRipple: true,
167
- iconSrc: _amazon["default"],
168
- selected: selected2,
169
- onClick: click2
170
- }), _react["default"].createElement(_Toggle["default"], {
171
- iconSrc: _amazon["default"],
172
- label: "Toggle 1",
173
- mode: "outlined",
174
- selected: false,
175
- disabled: true
176
- }), _react["default"].createElement(_Toggle["default"], {
177
- label: "Toggle 2",
178
- mode: "outlined",
179
- selected: selected3,
180
- onClick: click3
181
- }), _react["default"].createElement(_Toggle["default"], {
182
- iconSrc: _amazon["default"],
183
- mode: "outlined",
184
- selected: selected4,
185
- onClick: click4
186
- }), _react["default"].createElement(_Toggle["default"], {
187
- label: "Disabled Ripple",
188
- disableRipple: true,
189
- iconSrc: _amazon["default"],
190
- mode: "outlined",
191
- selected: selected5,
192
- onClick: click5
193
- })), _react["default"].createElement("h3", null, "Dark"), _react["default"].createElement("div", {
194
- style: {
195
- width: "100%",
196
- display: "inline-flex",
197
- background: "black",
198
- alignItems: "center"
199
- }
200
- }, _react["default"].createElement(_Toggle["default"], {
201
- theme: "dark",
202
- iconSrc: _amazon["default"],
203
- label: "Toggle 1",
204
- selected: selected6,
205
- onClick: click6
206
- }), _react["default"].createElement(_Toggle["default"], {
207
- theme: "dark",
208
- label: "Toggle 2",
209
- selected: false,
210
- disabled: true
211
- }), _react["default"].createElement(_Toggle["default"], {
212
- theme: "dark",
213
- iconSrc: _amazon["default"],
214
- selected: selected7,
215
- onClick: click7
216
- }), _react["default"].createElement(_Toggle["default"], {
217
- label: "Disabled Ripple",
218
- disableRipple: true,
219
- theme: "dark",
220
- iconSrc: _amazon["default"],
221
- selected: selected8,
222
- onClick: click8
223
- }), _react["default"].createElement(_Toggle["default"], {
224
- theme: "dark",
225
- iconSrc: _amazon["default"],
226
- label: "Toggle 1",
227
- mode: "outlined",
228
- selected: true,
229
- disabled: true
230
- }), _react["default"].createElement(_Toggle["default"], {
231
- theme: "dark",
232
- label: "Toggle 2",
233
- mode: "outlined",
234
- selected: selected9,
235
- onClick: click9
236
- }), _react["default"].createElement(_Toggle["default"], {
237
- theme: "dark",
238
- iconSrc: _amazon["default"],
239
- mode: "outlined",
240
- selected: selected10,
241
- onClick: click10
242
- }), _react["default"].createElement(_Toggle["default"], {
243
- label: "Disabled Ripple",
244
- disableRipple: true,
245
- theme: "dark",
246
- iconSrc: _amazon["default"],
247
- mode: "outlined",
248
- selected: selected11,
249
- onClick: click11
250
- })));
251
- };
252
-
253
- return _react["default"].createElement(ControlledStory, null);
254
- }, {
255
- notes: {
256
- markdown: _readme["default"]
257
- }
258
- });
259
-
260
- var knobProps = function knobProps() {
261
- return {
262
- theme: (0, _addonKnobs.select)("Theme", {
263
- light: "light",
264
- dark: "dark"
265
- }, "light"),
266
- iconPosition: (0, _addonKnobs.select)("Icon Position", {
267
- after: "after",
268
- before: "before"
269
- }, "before"),
270
- mode: (0, _addonKnobs.select)("Mode", {
271
- "default": "basic",
272
- alternative: "outlined"
273
- }, "basic"),
274
- disabled: (0, _addonKnobs["boolean"])("Disabled", false),
275
- disableRipple: (0, _addonKnobs["boolean"])("Disable ripple", false),
276
- selected: (0, _addonKnobs["boolean"])("Selected", false),
277
- label: (0, _addonKnobs.text)("Label", "label")
278
- };
279
- };
280
-
281
- (0, _react2.storiesOf)("Form Components|Toggle", module).add("Knobs example", function () {
282
- var props = knobProps();
283
- return _react["default"].createElement("div", {
284
- style: {
285
- background: props.theme === "dark" && "black" || "transparent",
286
- display: "flex",
287
- alignItems: "center",
288
- flexWrap: "wrap"
289
- }
290
- }, _react["default"].createElement(_Toggle["default"], (0, _extends2["default"])({}, props, {
291
- iconSrc: _amazon["default"]
292
- })));
293
- }, {
294
- notes: {
295
- markdown: _readme["default"]
296
- }
297
- });
@@ -1,80 +0,0 @@
1
- # DXC Toggle Component
2
-
3
- ## Usage
4
-
5
- ```js
6
- import { DxcToggle } from "@dxc-technology/halstack-react";
7
-
8
- <DxcToggle onClick={handleClick} label="Test Button" />;
9
- ```
10
-
11
- ## Props
12
-
13
- <table>
14
- <tr style="background-color: grey">
15
- <td>Name</td>
16
- <td>Default</td>
17
- <td>Description</td>
18
- </tr>
19
- <tr>
20
- <td>selected: boolean</td>
21
- <td><code>false</code></td>
22
- <td>If true, the component is selected.</td>
23
- </tr>
24
- <tr>
25
- <td>mode: 'basic' | 'outlined'</td>
26
- <td><code>'basic'</code></td>
27
- <td>Uses on of the available toggle modes.</td>
28
- </tr>
29
- <tr>
30
- <td>iconPosition: 'before' | 'after'</td>
31
- <td><code>'before'</code></td>
32
- <td>Changes the position of the icon.</td>
33
- </tr>
34
- <tr>
35
- <td>theme: 'light' |'dark'</td>
36
- <td><code>'light'</code></td>
37
- <td>Uses one of the available component themes.</td>
38
- </tr>
39
- <tr>
40
- <td>label: string</td>
41
- <td><code>'basic'</code></td>
42
- <td>Text to be placed on the toggle.</td>
43
- </tr>
44
- <tr>
45
- <td>iconSrc: string</td>
46
- <td></td>
47
- <td>URL of the icon that will be placed on the toggle.</td>
48
- </tr>
49
- <tr>
50
- <td>disabled: boolean</td>
51
- <td><code>false</code></td>
52
- <td>If true, the component will be disabled.</td>
53
- </tr>
54
- <tr>
55
- <td>disableRipple: boolean</td>
56
- <td><code>false</code></td>
57
- <td>If true, the ripple effect will be disabled.</td>
58
- </tr>
59
- <tr>
60
- <td>onClick: function</td>
61
- <td></td>
62
- <td>This function will be called when the user clicks the button. The new state will be passed as a parameter.</td>
63
- </tr>
64
-
65
- </table>
66
-
67
- ## Examples
68
-
69
- ```js
70
- import { DxcToggle } from "@dxc-technology/halstack-react";
71
- <DxcToggle
72
- label="Disabled Ripple"
73
- disableRipple={true}
74
- theme="dark"
75
- iconSrc={amazon}
76
- mode="outlined"
77
- selected={selected}
78
- onClick={click}
79
- ></DxcToggle>;
80
- ```
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
6
-
7
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
-
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
-
11
- var _react = _interopRequireDefault(require("react"));
12
-
13
- var _react2 = require("@storybook/react");
14
-
15
- var _readme = _interopRequireDefault(require("./readme.md"));
16
-
17
- var _Upload = _interopRequireDefault(require("./Upload"));
18
-
19
- function callbackFunc() {
20
- return _callbackFunc.apply(this, arguments);
21
- }
22
-
23
- function _callbackFunc() {
24
- _callbackFunc = (0, _asyncToGenerator2["default"])(
25
- /*#__PURE__*/
26
- _regenerator["default"].mark(function _callee() {
27
- return _regenerator["default"].wrap(function _callee$(_context) {
28
- while (1) {
29
- switch (_context.prev = _context.next) {
30
- case 0:
31
- return _context.abrupt("return", new Promise(function (resolve) {
32
- return setTimeout(resolve, 1000);
33
- }));
34
-
35
- case 1:
36
- case "end":
37
- return _context.stop();
38
- }
39
- }
40
- }, _callee);
41
- }));
42
- return _callbackFunc.apply(this, arguments);
43
- }
44
-
45
- (0, _react2.storiesOf)("Form Components|Upload", module).add("Component", function () {
46
- return _react["default"].createElement("div", {
47
- style: {
48
- marginTop: "80px"
49
- }
50
- }, _react["default"].createElement(_Upload["default"], {
51
- callbackUpload: callbackFunc
52
- }));
53
- }, {
54
- notes: {
55
- markdown: _readme["default"]
56
- }
57
- });
58
-
59
- var knobProps = function knobProps() {
60
- return {};
61
- };
62
-
63
- (0, _react2.storiesOf)("Form Components|Upload", module).add("Knobs example", function () {
64
- var props = knobProps();
65
- return _react["default"].createElement(_Upload["default"], (0, _extends2["default"])({}, props, {
66
- callbackUpload: callbackFunc
67
- }));
68
- }, {
69
- notes: {
70
- markdown: _readme["default"]
71
- }
72
- });