@dxc-technology/halstack-react 0.0.0-0a9608a → 0.0.0-0ab346a

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 (365) hide show
  1. package/BackgroundColorContext.d.ts +1 -10
  2. package/BackgroundColorContext.js +5 -22
  3. package/HalstackContext.d.ts +1243 -6
  4. package/HalstackContext.js +122 -106
  5. package/README.md +47 -0
  6. package/accordion/Accordion.accessibility.test.js +71 -0
  7. package/accordion/Accordion.d.ts +1 -1
  8. package/accordion/Accordion.js +39 -109
  9. package/accordion/Accordion.stories.tsx +53 -148
  10. package/accordion/Accordion.test.js +19 -34
  11. package/accordion/types.d.ts +6 -18
  12. package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
  13. package/accordion-group/AccordionGroup.d.ts +2 -2
  14. package/accordion-group/AccordionGroup.js +29 -77
  15. package/accordion-group/AccordionGroup.stories.tsx +78 -77
  16. package/accordion-group/AccordionGroup.test.js +44 -72
  17. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  18. package/accordion-group/AccordionGroupAccordion.js +31 -0
  19. package/accordion-group/AccordionGroupContext.d.ts +3 -0
  20. package/accordion-group/AccordionGroupContext.js +8 -0
  21. package/accordion-group/types.d.ts +7 -19
  22. package/action-icon/ActionIcon.accessibility.test.js +63 -0
  23. package/action-icon/ActionIcon.d.ts +4 -0
  24. package/action-icon/ActionIcon.js +48 -0
  25. package/action-icon/ActionIcon.stories.tsx +41 -0
  26. package/action-icon/ActionIcon.test.js +64 -0
  27. package/action-icon/types.d.ts +26 -0
  28. package/alert/Alert.accessibility.test.js +95 -0
  29. package/alert/Alert.js +31 -124
  30. package/alert/Alert.stories.tsx +28 -0
  31. package/alert/Alert.test.js +29 -46
  32. package/alert/types.d.ts +5 -5
  33. package/badge/Badge.accessibility.test.js +129 -0
  34. package/badge/Badge.d.ts +1 -1
  35. package/badge/Badge.js +142 -42
  36. package/badge/Badge.stories.tsx +210 -0
  37. package/badge/Badge.test.js +30 -0
  38. package/badge/types.d.ts +52 -3
  39. package/bleed/Bleed.js +13 -21
  40. package/bleed/Bleed.stories.tsx +1 -0
  41. package/bleed/types.d.ts +2 -2
  42. package/box/Box.accessibility.test.js +33 -0
  43. package/box/Box.d.ts +1 -1
  44. package/box/Box.js +18 -59
  45. package/box/Box.stories.tsx +38 -51
  46. package/box/Box.test.js +2 -7
  47. package/box/types.d.ts +3 -15
  48. package/bulleted-list/BulletedList.accessibility.test.js +107 -0
  49. package/bulleted-list/BulletedList.js +22 -53
  50. package/bulleted-list/BulletedList.stories.tsx +8 -93
  51. package/bulleted-list/types.d.ts +32 -5
  52. package/button/Button.accessibility.test.js +127 -0
  53. package/button/Button.d.ts +1 -1
  54. package/button/Button.js +70 -103
  55. package/button/Button.stories.tsx +104 -119
  56. package/button/Button.test.js +20 -17
  57. package/button/types.d.ts +9 -5
  58. package/card/Card.accessibility.test.js +36 -0
  59. package/card/Card.d.ts +1 -1
  60. package/card/Card.js +48 -89
  61. package/card/Card.stories.tsx +12 -42
  62. package/card/Card.test.js +11 -22
  63. package/card/types.d.ts +6 -12
  64. package/checkbox/Checkbox.accessibility.test.js +87 -0
  65. package/checkbox/Checkbox.js +87 -122
  66. package/checkbox/Checkbox.stories.tsx +68 -54
  67. package/checkbox/Checkbox.test.js +108 -64
  68. package/checkbox/types.d.ts +8 -4
  69. package/chip/Chip.accessibility.test.js +67 -0
  70. package/chip/Chip.js +42 -67
  71. package/chip/Chip.stories.tsx +73 -29
  72. package/chip/Chip.test.js +18 -33
  73. package/chip/types.d.ts +4 -4
  74. package/common/coreTokens.d.ts +237 -0
  75. package/common/coreTokens.js +184 -0
  76. package/common/utils.d.ts +1 -0
  77. package/common/utils.js +6 -12
  78. package/common/variables.d.ts +1395 -0
  79. package/common/variables.js +898 -1143
  80. package/container/Container.d.ts +4 -0
  81. package/container/Container.js +194 -0
  82. package/container/Container.stories.tsx +214 -0
  83. package/container/types.d.ts +74 -0
  84. package/contextual-menu/ContextualMenu.accessibility.test.js +86 -0
  85. package/contextual-menu/ContextualMenu.d.ts +7 -0
  86. package/contextual-menu/ContextualMenu.js +71 -0
  87. package/contextual-menu/ContextualMenu.stories.tsx +182 -0
  88. package/contextual-menu/ContextualMenu.test.js +71 -0
  89. package/contextual-menu/MenuItemAction.d.ts +4 -0
  90. package/contextual-menu/MenuItemAction.js +46 -0
  91. package/contextual-menu/types.d.ts +22 -0
  92. package/date-input/Calendar.js +38 -70
  93. package/date-input/DateInput.accessibility.test.js +216 -0
  94. package/date-input/DateInput.js +50 -96
  95. package/date-input/DateInput.stories.tsx +78 -30
  96. package/date-input/DateInput.test.js +674 -701
  97. package/date-input/DatePicker.js +36 -53
  98. package/date-input/Icons.d.ts +6 -6
  99. package/date-input/Icons.js +6 -23
  100. package/date-input/YearPicker.js +28 -44
  101. package/date-input/types.d.ts +28 -22
  102. package/dialog/Dialog.accessibility.test.js +69 -0
  103. package/dialog/Dialog.d.ts +1 -1
  104. package/dialog/Dialog.js +61 -119
  105. package/dialog/Dialog.stories.tsx +310 -212
  106. package/dialog/Dialog.test.js +270 -33
  107. package/dialog/types.d.ts +18 -26
  108. package/divider/Divider.accessibility.test.js +33 -0
  109. package/divider/Divider.d.ts +4 -0
  110. package/divider/Divider.js +36 -0
  111. package/divider/Divider.stories.tsx +223 -0
  112. package/divider/Divider.test.js +38 -0
  113. package/divider/types.d.ts +21 -0
  114. package/divider/types.js +5 -0
  115. package/dropdown/Dropdown.accessibility.test.js +180 -0
  116. package/dropdown/Dropdown.js +61 -130
  117. package/dropdown/Dropdown.stories.tsx +51 -17
  118. package/dropdown/Dropdown.test.js +393 -379
  119. package/dropdown/DropdownMenu.js +13 -20
  120. package/dropdown/DropdownMenuItem.js +11 -22
  121. package/dropdown/types.d.ts +20 -24
  122. package/file-input/FileInput.accessibility.test.js +160 -0
  123. package/file-input/FileInput.js +184 -292
  124. package/file-input/FileInput.stories.tsx +86 -3
  125. package/file-input/FileInput.test.js +279 -395
  126. package/file-input/FileItem.js +27 -67
  127. package/file-input/types.d.ts +10 -10
  128. package/flex/Flex.js +27 -39
  129. package/flex/Flex.stories.tsx +35 -26
  130. package/flex/types.d.ts +74 -9
  131. package/footer/Footer.accessibility.test.js +117 -0
  132. package/footer/Footer.d.ts +1 -1
  133. package/footer/Footer.js +73 -118
  134. package/footer/Footer.stories.tsx +82 -23
  135. package/footer/Footer.test.js +33 -57
  136. package/footer/Icons.d.ts +3 -2
  137. package/footer/Icons.js +66 -7
  138. package/footer/types.d.ts +26 -28
  139. package/grid/Grid.d.ts +7 -0
  140. package/grid/Grid.js +76 -0
  141. package/grid/Grid.stories.tsx +219 -0
  142. package/grid/types.d.ts +115 -0
  143. package/grid/types.js +5 -0
  144. package/header/Header.accessibility.test.js +84 -0
  145. package/header/Header.d.ts +4 -3
  146. package/header/Header.js +42 -136
  147. package/header/Header.stories.tsx +81 -35
  148. package/header/Header.test.js +13 -26
  149. package/header/Icons.d.ts +2 -2
  150. package/header/Icons.js +2 -7
  151. package/header/types.d.ts +7 -22
  152. package/heading/Heading.accessibility.test.js +33 -0
  153. package/heading/Heading.js +10 -32
  154. package/heading/Heading.test.js +71 -88
  155. package/heading/types.d.ts +7 -7
  156. package/icon/Icon.accessibility.test.js +30 -0
  157. package/icon/Icon.d.ts +4 -0
  158. package/icon/Icon.js +33 -0
  159. package/icon/Icon.stories.tsx +28 -0
  160. package/icon/types.d.ts +4 -0
  161. package/icon/types.js +5 -0
  162. package/image/Image.accessibility.test.js +56 -0
  163. package/image/Image.d.ts +4 -0
  164. package/image/Image.js +70 -0
  165. package/image/Image.stories.tsx +129 -0
  166. package/image/types.d.ts +72 -0
  167. package/image/types.js +5 -0
  168. package/inset/Inset.js +13 -21
  169. package/inset/Inset.stories.tsx +2 -1
  170. package/inset/types.d.ts +2 -2
  171. package/layout/ApplicationLayout.d.ts +5 -5
  172. package/layout/ApplicationLayout.js +30 -67
  173. package/layout/ApplicationLayout.stories.tsx +1 -1
  174. package/layout/Icons.d.ts +8 -5
  175. package/layout/Icons.js +49 -59
  176. package/layout/types.d.ts +5 -6
  177. package/link/Link.accessibility.test.js +112 -0
  178. package/link/Link.js +31 -50
  179. package/link/Link.stories.tsx +62 -2
  180. package/link/Link.test.js +24 -44
  181. package/link/types.d.ts +14 -14
  182. package/main.d.ts +10 -5
  183. package/main.js +47 -59
  184. package/nav-tabs/NavTabs.accessibility.test.js +44 -0
  185. package/nav-tabs/NavTabs.d.ts +7 -0
  186. package/{tabs-nav → nav-tabs}/NavTabs.js +25 -57
  187. package/nav-tabs/NavTabs.stories.tsx +279 -0
  188. package/{tabs-nav → nav-tabs}/NavTabs.test.js +39 -46
  189. package/nav-tabs/NavTabsContext.d.ts +3 -0
  190. package/nav-tabs/NavTabsContext.js +8 -0
  191. package/nav-tabs/Tab.js +117 -0
  192. package/{tabs-nav → nav-tabs}/types.d.ts +15 -16
  193. package/nav-tabs/types.js +5 -0
  194. package/number-input/NumberInput.accessibility.test.js +228 -0
  195. package/number-input/NumberInput.js +46 -36
  196. package/number-input/NumberInput.stories.tsx +42 -26
  197. package/number-input/NumberInput.test.js +860 -413
  198. package/number-input/NumberInputContext.d.ts +3 -4
  199. package/number-input/NumberInputContext.js +3 -14
  200. package/number-input/types.d.ts +17 -5
  201. package/package.json +41 -39
  202. package/paginator/Icons.d.ts +5 -5
  203. package/paginator/Icons.js +5 -19
  204. package/paginator/Paginator.accessibility.test.js +79 -0
  205. package/paginator/Paginator.js +17 -47
  206. package/paginator/Paginator.stories.tsx +24 -0
  207. package/paginator/Paginator.test.js +235 -215
  208. package/paginator/types.d.ts +3 -3
  209. package/paragraph/Paragraph.accessibility.test.js +28 -0
  210. package/paragraph/Paragraph.d.ts +3 -4
  211. package/paragraph/Paragraph.js +6 -22
  212. package/paragraph/Paragraph.stories.tsx +0 -17
  213. package/password-input/Icons.d.ts +6 -0
  214. package/password-input/Icons.js +35 -0
  215. package/password-input/PasswordInput.accessibility.test.js +153 -0
  216. package/password-input/PasswordInput.js +57 -126
  217. package/password-input/PasswordInput.stories.tsx +1 -33
  218. package/password-input/PasswordInput.test.js +158 -141
  219. package/password-input/types.d.ts +8 -7
  220. package/progress-bar/ProgressBar.accessibility.test.js +35 -0
  221. package/progress-bar/ProgressBar.d.ts +2 -2
  222. package/progress-bar/ProgressBar.js +23 -55
  223. package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +36 -3
  224. package/progress-bar/ProgressBar.test.js +36 -53
  225. package/progress-bar/types.d.ts +4 -3
  226. package/quick-nav/QuickNav.accessibility.test.js +57 -0
  227. package/quick-nav/QuickNav.js +4 -27
  228. package/quick-nav/QuickNav.stories.tsx +15 -1
  229. package/quick-nav/types.d.ts +10 -10
  230. package/radio-group/Radio.d.ts +1 -1
  231. package/radio-group/Radio.js +31 -63
  232. package/radio-group/RadioGroup.accessibility.test.js +97 -0
  233. package/radio-group/RadioGroup.js +45 -93
  234. package/radio-group/RadioGroup.stories.tsx +131 -18
  235. package/radio-group/RadioGroup.test.js +505 -471
  236. package/radio-group/types.d.ts +8 -8
  237. package/resultset-table/Icons.d.ts +7 -0
  238. package/{resultsetTable → resultset-table}/Icons.js +1 -5
  239. package/resultset-table/ResultsetTable.accessibility.test.js +274 -0
  240. package/resultset-table/ResultsetTable.d.ts +7 -0
  241. package/{resultsetTable → resultset-table}/ResultsetTable.js +46 -71
  242. package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +106 -5
  243. package/{resultsetTable → resultset-table}/ResultsetTable.test.js +149 -93
  244. package/{resultsetTable → resultset-table}/types.d.ts +44 -11
  245. package/resultset-table/types.js +5 -0
  246. package/select/Icons.d.ts +7 -7
  247. package/select/Icons.js +1 -5
  248. package/select/Listbox.js +13 -39
  249. package/select/Option.js +17 -27
  250. package/select/Select.accessibility.test.js +217 -0
  251. package/select/Select.js +94 -168
  252. package/select/Select.stories.tsx +480 -179
  253. package/select/Select.test.js +1952 -1810
  254. package/select/types.d.ts +14 -15
  255. package/sidenav/Sidenav.accessibility.test.js +59 -0
  256. package/sidenav/Sidenav.d.ts +2 -2
  257. package/sidenav/Sidenav.js +90 -155
  258. package/sidenav/Sidenav.stories.tsx +113 -25
  259. package/sidenav/Sidenav.test.js +3 -10
  260. package/{layout → sidenav}/SidenavContext.d.ts +1 -1
  261. package/{layout → sidenav}/SidenavContext.js +3 -9
  262. package/sidenav/types.d.ts +33 -30
  263. package/slider/Slider.accessibility.test.js +104 -0
  264. package/slider/Slider.js +70 -128
  265. package/slider/Slider.test.js +108 -104
  266. package/slider/types.d.ts +4 -4
  267. package/spinner/Spinner.accessibility.test.js +96 -0
  268. package/spinner/Spinner.js +29 -73
  269. package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
  270. package/spinner/Spinner.test.js +26 -35
  271. package/spinner/types.d.ts +3 -3
  272. package/status-light/StatusLight.accessibility.test.js +157 -0
  273. package/status-light/StatusLight.d.ts +4 -0
  274. package/status-light/StatusLight.js +51 -0
  275. package/status-light/StatusLight.stories.tsx +74 -0
  276. package/status-light/StatusLight.test.js +25 -0
  277. package/status-light/types.d.ts +17 -0
  278. package/status-light/types.js +5 -0
  279. package/switch/Switch.accessibility.test.js +89 -0
  280. package/switch/Switch.js +51 -99
  281. package/switch/Switch.stories.tsx +33 -34
  282. package/switch/Switch.test.js +52 -97
  283. package/switch/types.d.ts +4 -4
  284. package/table/DropdownTheme.js +62 -0
  285. package/table/Table.accessibility.test.js +82 -0
  286. package/table/Table.d.ts +6 -2
  287. package/table/Table.js +78 -35
  288. package/table/Table.stories.tsx +651 -0
  289. package/table/Table.test.js +94 -7
  290. package/table/types.d.ts +34 -6
  291. package/tabs/Tab.js +23 -40
  292. package/tabs/Tabs.accessibility.test.js +56 -0
  293. package/tabs/Tabs.js +62 -145
  294. package/tabs/Tabs.stories.tsx +39 -1
  295. package/tabs/Tabs.test.js +66 -123
  296. package/tabs/types.d.ts +19 -19
  297. package/tag/Tag.accessibility.test.js +69 -0
  298. package/tag/Tag.js +34 -66
  299. package/tag/Tag.stories.tsx +18 -8
  300. package/tag/Tag.test.js +18 -37
  301. package/tag/types.d.ts +9 -9
  302. package/text-input/Suggestion.js +11 -28
  303. package/text-input/Suggestions.d.ts +1 -1
  304. package/text-input/Suggestions.js +19 -67
  305. package/text-input/TextInput.accessibility.test.js +321 -0
  306. package/text-input/TextInput.js +223 -329
  307. package/text-input/TextInput.stories.tsx +117 -153
  308. package/text-input/TextInput.test.js +1228 -1196
  309. package/text-input/types.d.ts +25 -17
  310. package/textarea/Textarea.accessibility.test.js +155 -0
  311. package/textarea/Textarea.js +70 -113
  312. package/textarea/Textarea.stories.tsx +174 -0
  313. package/textarea/Textarea.test.js +152 -183
  314. package/textarea/types.d.ts +9 -5
  315. package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
  316. package/toggle-group/ToggleGroup.d.ts +2 -2
  317. package/toggle-group/ToggleGroup.js +94 -107
  318. package/toggle-group/ToggleGroup.stories.tsx +52 -7
  319. package/toggle-group/ToggleGroup.test.js +69 -88
  320. package/toggle-group/types.d.ts +28 -19
  321. package/typography/Typography.accessibility.test.js +339 -0
  322. package/typography/Typography.d.ts +2 -2
  323. package/typography/Typography.js +15 -123
  324. package/typography/Typography.stories.tsx +1 -1
  325. package/typography/types.d.ts +1 -1
  326. package/useTheme.d.ts +1147 -1
  327. package/useTheme.js +2 -9
  328. package/useTranslatedLabels.d.ts +84 -1
  329. package/useTranslatedLabels.js +1 -7
  330. package/utils/BaseTypography.d.ts +21 -0
  331. package/utils/BaseTypography.js +94 -0
  332. package/utils/FocusLock.d.ts +13 -0
  333. package/utils/FocusLock.js +124 -0
  334. package/wizard/Wizard.accessibility.test.js +55 -0
  335. package/wizard/Wizard.js +16 -51
  336. package/wizard/Wizard.stories.tsx +20 -0
  337. package/wizard/Wizard.test.js +54 -81
  338. package/wizard/types.d.ts +9 -10
  339. package/card/ice-cream.jpg +0 -0
  340. package/common/OpenSans.css +0 -81
  341. package/common/fonts/OpenSans-Bold.ttf +0 -0
  342. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  343. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  344. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  345. package/common/fonts/OpenSans-Italic.ttf +0 -0
  346. package/common/fonts/OpenSans-Light.ttf +0 -0
  347. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  348. package/common/fonts/OpenSans-Regular.ttf +0 -0
  349. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  350. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  351. package/number-input/numberInputContextTypes.d.ts +0 -19
  352. package/resultsetTable/Icons.d.ts +0 -7
  353. package/resultsetTable/ResultsetTable.d.ts +0 -4
  354. package/slider/Slider.stories.tsx +0 -183
  355. package/table/Table.stories.jsx +0 -277
  356. package/tabs-nav/NavTabs.d.ts +0 -8
  357. package/tabs-nav/NavTabs.stories.tsx +0 -172
  358. package/tabs-nav/Tab.js +0 -128
  359. package/text-input/Icons.d.ts +0 -8
  360. package/text-input/Icons.js +0 -60
  361. package/textarea/Textarea.stories.jsx +0 -157
  362. /package/{resultsetTable → action-icon}/types.js +0 -0
  363. /package/{tabs-nav → container}/types.js +0 -0
  364. /package/{number-input/numberInputContextTypes.js → contextual-menu/types.js} +0 -0
  365. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
@@ -3,6 +3,7 @@ import DxcWizard from "./Wizard";
3
3
  import Title from "../../.storybook/components/Title";
4
4
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
5
  import { userEvent, within } from "@storybook/testing-library";
6
+ import { HalstackProvider } from "../HalstackContext";
6
7
 
7
8
  export default {
8
9
  title: "Wizard",
@@ -36,6 +37,7 @@ const stepWithLabel = [
36
37
  label: "Forth step",
37
38
  },
38
39
  ];
40
+
39
41
  const stepWithLabelDescription = [
40
42
  {
41
43
  label: "First step",
@@ -56,6 +58,7 @@ const stepWithLabelDescription = [
56
58
  valid: false,
57
59
  },
58
60
  ];
61
+
59
62
  const stepWithLongDescription = [
60
63
  {
61
64
  label: "First step",
@@ -73,6 +76,7 @@ const stepWithLongDescription = [
73
76
  "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ",
74
77
  },
75
78
  ];
79
+
76
80
  const stepDisabled = [
77
81
  {
78
82
  label: "First step",
@@ -98,6 +102,7 @@ const stepDisabled = [
98
102
  disabled: true,
99
103
  },
100
104
  ];
105
+
101
106
  const stepIcons = [
102
107
  {
103
108
  label: "First step",
@@ -112,6 +117,7 @@ const stepIcons = [
112
117
  icon: favoriteSVG,
113
118
  },
114
119
  ];
120
+
115
121
  const stepLargeIcons = [
116
122
  {
117
123
  label: "First step",
@@ -127,6 +133,14 @@ const stepLargeIcons = [
127
133
  },
128
134
  ];
129
135
 
136
+ const opinionatedTheme = {
137
+ wizard: {
138
+ baseColor: "#5f249f",
139
+ fontColor: "#000000",
140
+ selectedStepFontColor: "#ffffff",
141
+ },
142
+ };
143
+
130
144
  export const Chromatic = () => (
131
145
  <>
132
146
  <ExampleContainer>
@@ -215,6 +229,12 @@ export const Chromatic = () => (
215
229
  <Title title="Xxlarge margin" theme="light" level={4} />
216
230
  <DxcWizard mode="vertical" margin="xxlarge" steps={stepWithLabel}></DxcWizard>
217
231
  </ExampleContainer>
232
+ <Title title="Opinionated theme" theme="light" level={2} />
233
+ <ExampleContainer>
234
+ <HalstackProvider theme={opinionatedTheme}>
235
+ <DxcWizard defaultCurrentStep={2} steps={stepWithLabelDescription}></DxcWizard>
236
+ </HalstackProvider>
237
+ </ExampleContainer>
218
238
  </>
219
239
  );
220
240
 
@@ -1,25 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _react = _interopRequireDefault(require("react"));
6
-
7
5
  var _react2 = require("@testing-library/react");
8
-
9
- var _Wizard = _interopRequireDefault(require("./Wizard"));
10
-
6
+ var _Wizard = _interopRequireDefault(require("./Wizard.tsx"));
11
7
  describe("Wizard components tests", function () {
12
8
  test("Wizard renders with correct steps", function () {
13
9
  var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
14
- steps: [{
15
- label: "first-step"
16
- }, {
17
- label: "second-step"
18
- }]
19
- })),
20
- getByText = _render.getByText,
21
- getAllByRole = _render.getAllByRole;
22
-
10
+ steps: [{
11
+ label: "first-step"
12
+ }, {
13
+ label: "second-step"
14
+ }]
15
+ })),
16
+ getByText = _render.getByText,
17
+ getAllByRole = _render.getAllByRole;
23
18
  var steps = getAllByRole("button");
24
19
  expect(getByText("first-step")).toBeTruthy();
25
20
  expect(getByText("second-step")).toBeTruthy();
@@ -28,112 +23,90 @@ describe("Wizard components tests", function () {
28
23
  });
29
24
  test("Wizard renders with initially selected step", function () {
30
25
  var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
31
- defaultCurrentStep: 1,
32
- steps: [{
33
- label: "first-step"
34
- }, {
35
- label: "second-step"
36
- }]
37
- })),
38
- getAllByRole = _render2.getAllByRole;
39
-
26
+ defaultCurrentStep: 1,
27
+ steps: [{
28
+ label: "first-step"
29
+ }, {
30
+ label: "second-step"
31
+ }]
32
+ })),
33
+ getAllByRole = _render2.getAllByRole;
40
34
  var steps = getAllByRole("button");
41
35
  expect(steps[1].getAttribute("aria-current")).toBe("step");
42
36
  });
43
37
  test("Click on step text", function () {
44
38
  var onClick = jest.fn();
45
-
46
39
  var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
47
- onStepClick: onClick,
48
- steps: [{
49
- label: "first-step"
50
- }]
51
- })),
52
- getByText = _render3.getByText;
53
-
40
+ onStepClick: onClick,
41
+ steps: [{
42
+ label: "first-step"
43
+ }]
44
+ })),
45
+ getByText = _render3.getByText;
54
46
  var step = getByText("first-step");
55
-
56
47
  _react2.fireEvent.click(step);
57
-
58
48
  expect(onClick).toHaveBeenCalled();
59
49
  });
60
50
  test("Click on step description", function () {
61
51
  var onClick = jest.fn();
62
-
63
52
  var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
64
- onStepClick: onClick,
65
- steps: [{
66
- label: "first-step",
67
- description: "step-description"
68
- }]
69
- })),
70
- getByText = _render4.getByText;
71
-
53
+ onStepClick: onClick,
54
+ steps: [{
55
+ label: "first-step",
56
+ description: "step-description"
57
+ }]
58
+ })),
59
+ getByText = _render4.getByText;
72
60
  var step = getByText("step-description");
73
-
74
61
  _react2.fireEvent.click(step);
75
-
76
62
  expect(onClick).toHaveBeenCalled();
77
63
  });
78
64
  test("Click on step number", function () {
79
65
  var onClick = jest.fn();
80
-
81
66
  var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
82
- onStepClick: onClick,
83
- steps: [{
84
- label: "first-step"
85
- }]
86
- })),
87
- getByText = _render5.getByText;
88
-
67
+ onStepClick: onClick,
68
+ steps: [{
69
+ label: "first-step"
70
+ }]
71
+ })),
72
+ getByText = _render5.getByText;
89
73
  var step = getByText("1");
90
-
91
74
  _react2.fireEvent.click(step);
92
-
93
75
  expect(onClick).toHaveBeenCalled();
94
76
  });
95
77
  test("Click on disable step", function () {
96
78
  var onClick = jest.fn();
97
-
98
79
  var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
99
- onStepClick: onClick,
100
- steps: [{
101
- label: "first-step"
102
- }, {
103
- label: "second-step",
104
- disabled: true
105
- }]
106
- })),
107
- getByText = _render6.getByText;
108
-
80
+ onStepClick: onClick,
81
+ steps: [{
82
+ label: "first-step"
83
+ }, {
84
+ label: "second-step",
85
+ disabled: true
86
+ }]
87
+ })),
88
+ getByText = _render6.getByText;
109
89
  var step = getByText("second-step");
110
-
111
90
  _react2.fireEvent.click(step);
112
-
113
91
  expect(onClick).toHaveBeenCalledTimes(0);
114
92
  });
115
93
  test("Controlled wizard function is called", function () {
116
94
  var onClick = jest.fn(function (i) {
117
95
  return i;
118
96
  });
119
-
120
97
  var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Wizard["default"], {
121
- currentStep: 0,
122
- onStepClick: onClick,
123
- steps: [{
124
- label: "first-step"
125
- }, {
126
- label: "second-step"
127
- }]
128
- })),
129
- getAllByRole = _render7.getAllByRole;
130
-
98
+ currentStep: 0,
99
+ onStepClick: onClick,
100
+ steps: [{
101
+ label: "first-step"
102
+ }, {
103
+ label: "second-step"
104
+ }]
105
+ })),
106
+ getAllByRole = _render7.getAllByRole;
131
107
  var steps = getAllByRole("button");
132
-
133
108
  _react2.fireEvent.click(steps[1]);
134
-
135
109
  _react2.fireEvent.click(steps[0]);
136
-
137
110
  expect(onClick).toHaveBeenCalledTimes(2);
138
111
  expect(onClick).toHaveBeenNthCalledWith(1, 1);
139
112
  expect(onClick).toHaveBeenNthCalledWith(2, 0);
package/wizard/types.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
- export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- export declare type Margin = {
2
+ type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ type Margin = {
4
4
  top?: Space;
5
5
  bottom?: Space;
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
- declare type Step = {
9
+ type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
+ export type StepProps = {
11
11
  /**
12
12
  * Step label.
13
13
  */
@@ -29,12 +29,11 @@ declare type Step = {
29
29
  */
30
30
  valid?: boolean;
31
31
  };
32
- export declare type Mode = "horizontal" | "vertical";
33
- declare type Props = {
32
+ type Props = {
34
33
  /**
35
- * The wizard can be showed in horizontal or vertical.
34
+ * The wizard can be shown in horizontal or vertical.
36
35
  */
37
- mode?: Mode;
36
+ mode?: "horizontal" | "vertical";
38
37
  /**
39
38
  * Initially selected step, only when it is uncontrolled.
40
39
  */
@@ -47,11 +46,11 @@ declare type Props = {
47
46
  * This function will be called when the user clicks a step. The step
48
47
  * number will be passed as a parameter.
49
48
  */
50
- onStepClick?: (newCurrentStep: number) => void;
49
+ onStepClick?: (currentStep: number) => void;
51
50
  /**
52
51
  * An array of objects representing the steps.
53
52
  */
54
- steps: Step[];
53
+ steps: StepProps[];
55
54
  /**
56
55
  * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
57
56
  * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
Binary file
@@ -1,81 +0,0 @@
1
-
2
- @font-face {
3
- font-family: 'Open Sans';
4
- src: url('./fonts/OpenSans-Light.ttf')
5
- format('truetype');
6
- font-style: normal;
7
- font-weight: 200;
8
- }
9
-
10
- @font-face {
11
- font-family: 'Open Sans';
12
- src: url('./fonts/OpenSans-Regular.ttf')
13
- format('truetype');
14
- font-style: normal;
15
- font-weight: 400;
16
- }
17
-
18
- @font-face {
19
- font-family: 'Open Sans';
20
- src: url('./fonts/OpenSans-SemiBold.ttf')
21
- format('truetype');
22
- font-style: normal;
23
- font-weight: 600;
24
- }
25
-
26
- @font-face {
27
- font-family: 'Open Sans';
28
- src: url('./fonts/OpenSans-Bold.ttf')
29
- format('truetype');
30
- font-style: normal;
31
- font-weight: 700;
32
- }
33
-
34
- @font-face {
35
- font-family: 'Open Sans';
36
- src: url('./fonts/OpenSans-ExtraBold.ttf')
37
- format('truetype');
38
- font-style: normal;
39
- font-weight: 800;
40
- }
41
-
42
- @font-face {
43
- font-family: 'Open Sans';
44
- src: url('./fonts/OpenSans-LightItalic.ttf')
45
- format('truetype');
46
- font-style: italic;
47
- font-weight: 200;
48
- }
49
-
50
- @font-face {
51
- font-family: 'Open Sans';
52
- src: url('./fonts/OpenSans-Italic.ttf')
53
- format('truetype');
54
- font-style: italic;
55
- font-weight: 400;
56
- }
57
-
58
- @font-face {
59
- font-family: 'Open Sans';
60
- src: url('./fonts/OpenSans-SemiBoldItalic.ttf')
61
- format('truetype');
62
- font-style: italic;
63
- font-weight: 600;
64
- }
65
-
66
- @font-face {
67
- font-family: 'Open Sans';
68
- src: url('./fonts/OpenSans-BoldItalic.ttf')
69
- format('truetype');
70
- font-style: italic;
71
- font-weight: 700;
72
- }
73
-
74
- @font-face {
75
- font-family: 'Open Sans';
76
- src: url('./fonts/OpenSans-ExtraBoldItalic.ttf')
77
- format('truetype');
78
- font-style: italic;
79
- font-weight: 800;
80
- }
81
-
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,19 +0,0 @@
1
- declare type Props = {
2
- /**
3
- * Type of the input.
4
- */
5
- typeNumber?: string;
6
- /**
7
- * Minimum value allowed by the number input.
8
- */
9
- minNumber?: number;
10
- /**
11
- * Maximum value allowed by the number input.
12
- */
13
- maxNumber?: number;
14
- /**
15
- * The step interval to use when using the up and down arrows to adjust the value.
16
- */
17
- stepNumber?: number;
18
- };
19
- export default Props;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- declare const icons: {
3
- arrowUp: JSX.Element;
4
- arrowDown: JSX.Element;
5
- bothArrows: JSX.Element;
6
- };
7
- export default icons;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import ResultsetTablePropsType from "./types";
3
- declare const DxcResultsetTable: ({ columns, rows, showGoToPage, itemsPerPage, itemsPerPageOptions, itemsPerPageFunction, margin, tabIndex, }: ResultsetTablePropsType) => JSX.Element;
4
- export default DxcResultsetTable;
@@ -1,183 +0,0 @@
1
- import React from "react";
2
- import DxcSlider from "./Slider";
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
-
8
- export default {
9
- title: "Slider",
10
- component: DxcSlider,
11
- };
12
-
13
- const labelFormat = (value) => `${value}E100000000000000000000000`;
14
-
15
- export const Chromatic = () => (
16
- <>
17
- <Title title="States" theme="light" level={2} />
18
- <ExampleContainer pseudoState="pseudo-hover">
19
- <Title title="Hovered" theme="light" level={4} />
20
- <DxcSlider label="Slider" helperText="Help message" showLimitsValues />
21
- </ExampleContainer>
22
- <ExampleContainer pseudoState="pseudo-active">
23
- <Title title="Active" theme="light" level={4} />
24
- <DxcSlider label="Slider" helperText="Help message" showLimitsValues />
25
- </ExampleContainer>
26
- <ExampleContainer pseudoState="pseudo-focus">
27
- <Title title="Focused" theme="light" level={4} />
28
- <DxcSlider label="Slider" helperText="Help message" showLimitsValues />
29
- </ExampleContainer>
30
- <ExampleContainer>
31
- <Title title="Disabled" theme="light" level={4} />
32
- <DxcSlider label="Slider" helperText="Help message" disabled showLimitsValues />
33
- </ExampleContainer>
34
- <ExampleContainer>
35
- <Title title="Disabled discrete slider with input" theme="light" level={4} />
36
- <DxcSlider
37
- label="Slider"
38
- helperText="Help message"
39
- disabled
40
- defaultValue={40}
41
- minValue={0}
42
- maxValue={50}
43
- showLimitsValues
44
- showInput
45
- marks
46
- step={10}
47
- />
48
- </ExampleContainer>
49
- <Title title="Variants" theme="light" level={2} />
50
- <ExampleContainer>
51
- <Title title="Continuous slider" theme="light" level={4} />
52
- <DxcSlider defaultValue={65} label="Slider" helperText="Help message" showLimitsValues />
53
- </ExampleContainer>
54
- <ExampleContainer>
55
- <Title title="Discrete slider" theme="light" level={4} />
56
- <DxcSlider defaultValue={20} label="Slider" helperText="Help message" showLimitsValues marks step={5} />
57
- </ExampleContainer>
58
- <ExampleContainer>
59
- <Title title="Discrete slider with input" theme="light" level={4} />
60
- <DxcSlider
61
- defaultValue={20}
62
- minValue={0}
63
- maxValue={50}
64
- label="Slider"
65
- helperText="Help message"
66
- showLimitsValues
67
- showInput
68
- marks
69
- step={10}
70
- />
71
- </ExampleContainer>
72
- <BackgroundColorProvider color="#333333">
73
- <DarkContainer>
74
- <Title title="Dark" theme="dark" level={2} />
75
- <ExampleContainer pseudoState="pseudo-hover">
76
- <Title title="Hovered" theme="dark" level={4} />
77
- <DxcSlider label="Slider" helperText="Help message" showLimitsValues />
78
- </ExampleContainer>
79
- <ExampleContainer pseudoState="pseudo-active">
80
- <Title title="Active" theme="dark" level={4} />
81
- <DxcSlider label="Slider" helperText="Help message" showLimitsValues />
82
- </ExampleContainer>
83
- <ExampleContainer pseudoState="pseudo-focus">
84
- <Title title="Focused" theme="dark" level={4} />
85
- <DxcSlider label="Slider" helperText="Help message" showLimitsValues />
86
- </ExampleContainer>
87
- <ExampleContainer>
88
- <Title title="Disabled" theme="dark" level={4} />
89
- <DxcSlider label="Slider" helperText="Help message" disabled showLimitsValues />
90
- </ExampleContainer>
91
- <ExampleContainer>
92
- <Title title="Disabled discrete slider with input" theme="dark" level={4} />
93
- <DxcSlider
94
- label="Slider"
95
- helperText="Help message"
96
- disabled
97
- defaultValue={40}
98
- minValue={0}
99
- maxValue={50}
100
- showLimitsValues
101
- showInput
102
- marks
103
- step={5}
104
- />
105
- </ExampleContainer>
106
- <ExampleContainer>
107
- <Title title="Continuous slider" theme="dark" level={4} />
108
- <DxcSlider defaultValue={65} label="Slider" helperText="Help message" showLimitsValues />
109
- </ExampleContainer>
110
- <ExampleContainer>
111
- <Title title="Discrete slider" theme="dark" level={4} />
112
- <DxcSlider defaultValue={20} label="Slider" helperText="Help message" showLimitsValues marks step={5} />
113
- </ExampleContainer>
114
- <ExampleContainer>
115
- <Title title="Discrete slider with input" theme="dark" level={4} />
116
- <DxcSlider
117
- defaultValue={20}
118
- minValue={0}
119
- maxValue={50}
120
- label="Slider"
121
- helperText="Help message"
122
- showLimitsValues
123
- showInput
124
- marks
125
- step={10}
126
- />
127
- </ExampleContainer>
128
- </DarkContainer>
129
- </BackgroundColorProvider>
130
- <Title title="Margins" theme="light" level={2} />
131
- <ExampleContainer>
132
- <Title title="Xxsmall" theme="light" level={4} />
133
- <DxcSlider label="Xxsmall" margin="xxsmall" />
134
- </ExampleContainer>
135
- <ExampleContainer>
136
- <Title title="Xsmall" theme="light" level={4} />
137
- <DxcSlider label="Xsmall" margin="xsmall" />
138
- </ExampleContainer>
139
- <ExampleContainer>
140
- <Title title="Small" theme="light" level={4} />
141
- <DxcSlider label="Small" margin="small" />
142
- </ExampleContainer>
143
- <ExampleContainer>
144
- <Title title="Medium" theme="light" level={4} />
145
- <DxcSlider label="Medium" margin="medium" />
146
- </ExampleContainer>
147
- <ExampleContainer>
148
- <Title title="Large" theme="light" level={4} />
149
- <DxcSlider label="Large" margin="large" />
150
- </ExampleContainer>
151
- <ExampleContainer>
152
- <Title title="Xlarge" theme="light" level={4} />
153
- <DxcSlider label="Xlarge" margin="xlarge" />
154
- </ExampleContainer>
155
- <ExampleContainer>
156
- <Title title="Xxlarge" theme="light" level={4} />
157
- <DxcSlider label="Xxlarge" margin="xxlarge" />
158
- </ExampleContainer>
159
- <Title title="Sizes" theme="light" level={2} />
160
- <ExampleContainer>
161
- <Title title="Medium" theme="light" level={4} />
162
- <DxcSlider label="Medium" size="medium" />
163
- </ExampleContainer>
164
- <ExampleContainer>
165
- <Title title="Large" theme="light" level={4} />
166
- <DxcSlider label="Large" size="large" />
167
- </ExampleContainer>
168
- <ExampleContainer>
169
- <Title title="FillParent" theme="light" level={4} />
170
- <DxcSlider label="FillParent" size="fillParent" />
171
- </ExampleContainer>
172
- <ExampleContainer>
173
- <Title title="Large limit values labels" theme="light" level={4} />
174
- <DxcSlider
175
- label="Slider"
176
- helperText="Help message"
177
- showLimitsValues
178
- labelFormatCallback={labelFormat}
179
- size="large"
180
- />
181
- </ExampleContainer>
182
- </>
183
- );