@dxc-technology/halstack-react 0.0.0-f94f280 → 0.0.0-f965966

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 (435) hide show
  1. package/README.md +1 -2
  2. package/dist/index.d.mts +6529 -0
  3. package/dist/index.d.ts +6529 -0
  4. package/dist/index.js +14610 -0
  5. package/dist/index.mjs +14522 -0
  6. package/package.json +71 -66
  7. package/BackgroundColorContext.d.ts +0 -1
  8. package/BackgroundColorContext.js +0 -30
  9. package/HalstackContext.d.ts +0 -1246
  10. package/HalstackContext.js +0 -310
  11. package/accordion/Accordion.accessibility.test.js +0 -71
  12. package/accordion/Accordion.d.ts +0 -4
  13. package/accordion/Accordion.js +0 -171
  14. package/accordion/Accordion.stories.tsx +0 -241
  15. package/accordion/Accordion.test.js +0 -56
  16. package/accordion/types.d.ts +0 -57
  17. package/accordion/types.js +0 -5
  18. package/accordion-group/AccordionGroup.accessibility.test.js +0 -88
  19. package/accordion-group/AccordionGroup.d.ts +0 -7
  20. package/accordion-group/AccordionGroup.js +0 -101
  21. package/accordion-group/AccordionGroup.stories.tsx +0 -252
  22. package/accordion-group/AccordionGroup.test.js +0 -98
  23. package/accordion-group/AccordionGroupAccordion.d.ts +0 -4
  24. package/accordion-group/AccordionGroupAccordion.js +0 -31
  25. package/accordion-group/AccordionGroupContext.d.ts +0 -3
  26. package/accordion-group/AccordionGroupContext.js +0 -8
  27. package/accordion-group/types.d.ts +0 -67
  28. package/accordion-group/types.js +0 -5
  29. package/action-icon/ActionIcon.accessibility.test.js +0 -63
  30. package/action-icon/ActionIcon.d.ts +0 -4
  31. package/action-icon/ActionIcon.js +0 -48
  32. package/action-icon/ActionIcon.stories.tsx +0 -41
  33. package/action-icon/ActionIcon.test.js +0 -64
  34. package/action-icon/types.d.ts +0 -26
  35. package/action-icon/types.js +0 -5
  36. package/alert/Alert.accessibility.test.js +0 -95
  37. package/alert/Alert.d.ts +0 -4
  38. package/alert/Alert.js +0 -203
  39. package/alert/Alert.stories.tsx +0 -198
  40. package/alert/Alert.test.js +0 -75
  41. package/alert/types.d.ts +0 -49
  42. package/alert/types.js +0 -5
  43. package/badge/Badge.accessibility.test.js +0 -129
  44. package/badge/Badge.d.ts +0 -4
  45. package/badge/Badge.js +0 -161
  46. package/badge/Badge.stories.tsx +0 -210
  47. package/badge/Badge.test.js +0 -30
  48. package/badge/types.d.ts +0 -54
  49. package/badge/types.js +0 -5
  50. package/bleed/Bleed.d.ts +0 -3
  51. package/bleed/Bleed.js +0 -43
  52. package/bleed/Bleed.stories.tsx +0 -342
  53. package/bleed/types.d.ts +0 -37
  54. package/bleed/types.js +0 -5
  55. package/box/Box.accessibility.test.js +0 -33
  56. package/box/Box.d.ts +0 -4
  57. package/box/Box.js +0 -75
  58. package/box/Box.stories.tsx +0 -119
  59. package/box/Box.test.js +0 -13
  60. package/box/types.d.ts +0 -32
  61. package/box/types.js +0 -5
  62. package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +0 -1
  63. package/breadcrumbs/Breadcrumbs.accessibility.test.js +0 -96
  64. package/breadcrumbs/Breadcrumbs.d.ts +0 -4
  65. package/breadcrumbs/Breadcrumbs.js +0 -79
  66. package/breadcrumbs/Breadcrumbs.stories.tsx +0 -194
  67. package/breadcrumbs/Breadcrumbs.test.d.ts +0 -1
  68. package/breadcrumbs/Breadcrumbs.test.js +0 -169
  69. package/breadcrumbs/Item.d.ts +0 -4
  70. package/breadcrumbs/Item.js +0 -52
  71. package/breadcrumbs/dropdownTheme.d.ts +0 -53
  72. package/breadcrumbs/dropdownTheme.js +0 -62
  73. package/breadcrumbs/types.d.ts +0 -16
  74. package/breadcrumbs/types.js +0 -5
  75. package/bulleted-list/BulletedList.accessibility.test.js +0 -119
  76. package/bulleted-list/BulletedList.d.ts +0 -7
  77. package/bulleted-list/BulletedList.js +0 -92
  78. package/bulleted-list/BulletedList.stories.tsx +0 -115
  79. package/bulleted-list/types.d.ts +0 -38
  80. package/bulleted-list/types.js +0 -5
  81. package/button/Button.accessibility.test.js +0 -127
  82. package/button/Button.d.ts +0 -4
  83. package/button/Button.js +0 -121
  84. package/button/Button.stories.tsx +0 -325
  85. package/button/Button.test.js +0 -38
  86. package/button/types.d.ts +0 -57
  87. package/button/types.js +0 -5
  88. package/card/Card.accessibility.test.js +0 -36
  89. package/card/Card.d.ts +0 -4
  90. package/card/Card.js +0 -121
  91. package/card/Card.stories.tsx +0 -171
  92. package/card/Card.test.js +0 -39
  93. package/card/types.d.ts +0 -62
  94. package/card/types.js +0 -5
  95. package/checkbox/Checkbox.accessibility.test.js +0 -87
  96. package/checkbox/Checkbox.d.ts +0 -4
  97. package/checkbox/Checkbox.js +0 -215
  98. package/checkbox/Checkbox.stories.tsx +0 -222
  99. package/checkbox/Checkbox.test.js +0 -199
  100. package/checkbox/types.d.ts +0 -72
  101. package/checkbox/types.js +0 -5
  102. package/chip/Chip.accessibility.test.js +0 -67
  103. package/chip/Chip.d.ts +0 -4
  104. package/chip/Chip.js +0 -126
  105. package/chip/Chip.stories.tsx +0 -199
  106. package/chip/Chip.test.js +0 -41
  107. package/chip/types.d.ts +0 -45
  108. package/chip/types.js +0 -5
  109. package/common/coreTokens.d.ts +0 -237
  110. package/common/coreTokens.js +0 -184
  111. package/common/utils.d.ts +0 -1
  112. package/common/utils.js +0 -16
  113. package/common/variables.d.ts +0 -1392
  114. package/common/variables.js +0 -1264
  115. package/container/Container.d.ts +0 -4
  116. package/container/Container.js +0 -194
  117. package/container/Container.stories.tsx +0 -214
  118. package/container/types.d.ts +0 -74
  119. package/container/types.js +0 -5
  120. package/contextual-menu/ContextualMenu.accessibility.test.js +0 -97
  121. package/contextual-menu/ContextualMenu.d.ts +0 -5
  122. package/contextual-menu/ContextualMenu.js +0 -88
  123. package/contextual-menu/ContextualMenu.stories.tsx +0 -232
  124. package/contextual-menu/ContextualMenu.test.js +0 -205
  125. package/contextual-menu/GroupItem.d.ts +0 -4
  126. package/contextual-menu/GroupItem.js +0 -67
  127. package/contextual-menu/ItemAction.d.ts +0 -4
  128. package/contextual-menu/ItemAction.js +0 -51
  129. package/contextual-menu/MenuItem.d.ts +0 -4
  130. package/contextual-menu/MenuItem.js +0 -29
  131. package/contextual-menu/SingleItem.d.ts +0 -4
  132. package/contextual-menu/SingleItem.js +0 -38
  133. package/contextual-menu/types.d.ts +0 -58
  134. package/contextual-menu/types.js +0 -5
  135. package/date-input/Calendar.d.ts +0 -4
  136. package/date-input/Calendar.js +0 -214
  137. package/date-input/DateInput.accessibility.test.js +0 -228
  138. package/date-input/DateInput.d.ts +0 -4
  139. package/date-input/DateInput.js +0 -222
  140. package/date-input/DateInput.stories.tsx +0 -292
  141. package/date-input/DateInput.test.js +0 -808
  142. package/date-input/DatePicker.d.ts +0 -4
  143. package/date-input/DatePicker.js +0 -121
  144. package/date-input/YearPicker.d.ts +0 -4
  145. package/date-input/YearPicker.js +0 -100
  146. package/date-input/types.d.ts +0 -164
  147. package/date-input/types.js +0 -5
  148. package/dialog/Dialog.accessibility.test.js +0 -69
  149. package/dialog/Dialog.d.ts +0 -4
  150. package/dialog/Dialog.js +0 -93
  151. package/dialog/Dialog.stories.tsx +0 -371
  152. package/dialog/Dialog.test.js +0 -307
  153. package/dialog/types.d.ts +0 -36
  154. package/dialog/types.js +0 -5
  155. package/divider/Divider.accessibility.test.js +0 -33
  156. package/divider/Divider.d.ts +0 -4
  157. package/divider/Divider.js +0 -36
  158. package/divider/Divider.stories.tsx +0 -223
  159. package/divider/Divider.test.js +0 -38
  160. package/divider/types.d.ts +0 -21
  161. package/divider/types.js +0 -5
  162. package/dropdown/Dropdown.accessibility.test.js +0 -180
  163. package/dropdown/Dropdown.d.ts +0 -4
  164. package/dropdown/Dropdown.js +0 -321
  165. package/dropdown/Dropdown.stories.tsx +0 -427
  166. package/dropdown/Dropdown.test.js +0 -599
  167. package/dropdown/DropdownMenu.d.ts +0 -4
  168. package/dropdown/DropdownMenu.js +0 -63
  169. package/dropdown/DropdownMenuItem.d.ts +0 -4
  170. package/dropdown/DropdownMenuItem.js +0 -71
  171. package/dropdown/types.d.ts +0 -96
  172. package/dropdown/types.js +0 -5
  173. package/file-input/FileInput.accessibility.test.js +0 -160
  174. package/file-input/FileInput.d.ts +0 -4
  175. package/file-input/FileInput.js +0 -443
  176. package/file-input/FileInput.stories.tsx +0 -618
  177. package/file-input/FileInput.test.js +0 -382
  178. package/file-input/FileItem.d.ts +0 -4
  179. package/file-input/FileItem.js +0 -125
  180. package/file-input/types.d.ts +0 -129
  181. package/file-input/types.js +0 -5
  182. package/flex/Flex.d.ts +0 -4
  183. package/flex/Flex.js +0 -57
  184. package/flex/Flex.stories.tsx +0 -112
  185. package/flex/types.d.ts +0 -97
  186. package/flex/types.js +0 -5
  187. package/footer/Footer.accessibility.test.js +0 -125
  188. package/footer/Footer.d.ts +0 -4
  189. package/footer/Footer.js +0 -140
  190. package/footer/Footer.stories.tsx +0 -208
  191. package/footer/Footer.test.js +0 -85
  192. package/footer/Icons.d.ts +0 -3
  193. package/footer/Icons.js +0 -108
  194. package/footer/types.d.ts +0 -64
  195. package/footer/types.js +0 -5
  196. package/grid/Grid.d.ts +0 -7
  197. package/grid/Grid.js +0 -76
  198. package/grid/Grid.stories.tsx +0 -219
  199. package/grid/types.d.ts +0 -115
  200. package/grid/types.js +0 -5
  201. package/header/Header.accessibility.test.js +0 -93
  202. package/header/Header.d.ts +0 -8
  203. package/header/Header.js +0 -210
  204. package/header/Header.stories.tsx +0 -267
  205. package/header/Header.test.js +0 -66
  206. package/header/Icons.d.ts +0 -2
  207. package/header/Icons.js +0 -24
  208. package/header/types.d.ts +0 -33
  209. package/header/types.js +0 -5
  210. package/heading/Heading.accessibility.test.js +0 -33
  211. package/heading/Heading.d.ts +0 -4
  212. package/heading/Heading.js +0 -137
  213. package/heading/Heading.stories.tsx +0 -54
  214. package/heading/Heading.test.js +0 -169
  215. package/heading/types.d.ts +0 -33
  216. package/heading/types.js +0 -5
  217. package/icon/Icon.accessibility.test.js +0 -30
  218. package/icon/Icon.d.ts +0 -4
  219. package/icon/Icon.js +0 -33
  220. package/icon/Icon.stories.tsx +0 -28
  221. package/icon/types.d.ts +0 -4
  222. package/icon/types.js +0 -5
  223. package/image/Image.accessibility.test.js +0 -56
  224. package/image/Image.d.ts +0 -4
  225. package/image/Image.js +0 -70
  226. package/image/Image.stories.tsx +0 -129
  227. package/image/types.d.ts +0 -72
  228. package/image/types.js +0 -5
  229. package/inset/Inset.d.ts +0 -3
  230. package/inset/Inset.js +0 -43
  231. package/inset/Inset.stories.tsx +0 -230
  232. package/inset/types.d.ts +0 -37
  233. package/inset/types.js +0 -5
  234. package/layout/ApplicationLayout.d.ts +0 -20
  235. package/layout/ApplicationLayout.js +0 -137
  236. package/layout/ApplicationLayout.stories.tsx +0 -162
  237. package/layout/Icons.d.ts +0 -7
  238. package/layout/Icons.js +0 -48
  239. package/layout/types.d.ts +0 -41
  240. package/layout/types.js +0 -5
  241. package/link/Link.accessibility.test.js +0 -108
  242. package/link/Link.d.ts +0 -4
  243. package/link/Link.js +0 -117
  244. package/link/Link.stories.tsx +0 -253
  245. package/link/Link.test.js +0 -63
  246. package/link/types.d.ts +0 -54
  247. package/link/types.js +0 -5
  248. package/main.d.ts +0 -50
  249. package/main.js +0 -364
  250. package/nav-tabs/NavTabs.accessibility.test.js +0 -44
  251. package/nav-tabs/NavTabs.d.ts +0 -7
  252. package/nav-tabs/NavTabs.js +0 -93
  253. package/nav-tabs/NavTabs.stories.tsx +0 -279
  254. package/nav-tabs/NavTabs.test.js +0 -77
  255. package/nav-tabs/NavTabsContext.d.ts +0 -3
  256. package/nav-tabs/NavTabsContext.js +0 -8
  257. package/nav-tabs/Tab.d.ts +0 -4
  258. package/nav-tabs/Tab.js +0 -117
  259. package/nav-tabs/types.d.ts +0 -52
  260. package/nav-tabs/types.js +0 -5
  261. package/number-input/NumberInput.accessibility.test.js +0 -228
  262. package/number-input/NumberInput.d.ts +0 -4
  263. package/number-input/NumberInput.js +0 -86
  264. package/number-input/NumberInput.stories.tsx +0 -131
  265. package/number-input/NumberInput.test.js +0 -989
  266. package/number-input/NumberInputContext.d.ts +0 -3
  267. package/number-input/NumberInputContext.js +0 -8
  268. package/number-input/types.d.ts +0 -136
  269. package/number-input/types.js +0 -5
  270. package/paginator/Paginator.accessibility.test.js +0 -79
  271. package/paginator/Paginator.d.ts +0 -4
  272. package/paginator/Paginator.js +0 -138
  273. package/paginator/Paginator.stories.tsx +0 -87
  274. package/paginator/Paginator.test.js +0 -335
  275. package/paginator/types.d.ts +0 -38
  276. package/paginator/types.js +0 -5
  277. package/paragraph/Paragraph.accessibility.test.js +0 -28
  278. package/paragraph/Paragraph.d.ts +0 -5
  279. package/paragraph/Paragraph.js +0 -22
  280. package/paragraph/Paragraph.stories.tsx +0 -27
  281. package/password-input/PasswordInput.accessibility.test.js +0 -153
  282. package/password-input/PasswordInput.d.ts +0 -4
  283. package/password-input/PasswordInput.js +0 -97
  284. package/password-input/PasswordInput.stories.tsx +0 -99
  285. package/password-input/PasswordInput.test.js +0 -198
  286. package/password-input/types.d.ts +0 -111
  287. package/password-input/types.js +0 -5
  288. package/progress-bar/ProgressBar.accessibility.test.js +0 -35
  289. package/progress-bar/ProgressBar.d.ts +0 -4
  290. package/progress-bar/ProgressBar.js +0 -146
  291. package/progress-bar/ProgressBar.stories.tsx +0 -93
  292. package/progress-bar/ProgressBar.test.js +0 -93
  293. package/progress-bar/types.d.ts +0 -37
  294. package/progress-bar/types.js +0 -5
  295. package/quick-nav/QuickNav.accessibility.test.js +0 -57
  296. package/quick-nav/QuickNav.d.ts +0 -4
  297. package/quick-nav/QuickNav.js +0 -94
  298. package/quick-nav/QuickNav.stories.tsx +0 -356
  299. package/quick-nav/types.d.ts +0 -21
  300. package/quick-nav/types.js +0 -5
  301. package/radio-group/Radio.d.ts +0 -4
  302. package/radio-group/Radio.js +0 -124
  303. package/radio-group/RadioGroup.accessibility.test.js +0 -97
  304. package/radio-group/RadioGroup.d.ts +0 -4
  305. package/radio-group/RadioGroup.js +0 -236
  306. package/radio-group/RadioGroup.stories.tsx +0 -214
  307. package/radio-group/RadioGroup.test.js +0 -756
  308. package/radio-group/types.d.ts +0 -114
  309. package/radio-group/types.js +0 -5
  310. package/resultset-table/Icons.d.ts +0 -7
  311. package/resultset-table/Icons.js +0 -47
  312. package/resultset-table/ResultsetTable.accessibility.test.js +0 -285
  313. package/resultset-table/ResultsetTable.d.ts +0 -7
  314. package/resultset-table/ResultsetTable.js +0 -171
  315. package/resultset-table/ResultsetTable.stories.tsx +0 -413
  316. package/resultset-table/ResultsetTable.test.js +0 -381
  317. package/resultset-table/types.d.ts +0 -100
  318. package/resultset-table/types.js +0 -5
  319. package/select/Listbox.d.ts +0 -4
  320. package/select/Listbox.js +0 -155
  321. package/select/Option.d.ts +0 -4
  322. package/select/Option.js +0 -89
  323. package/select/Select.accessibility.test.js +0 -228
  324. package/select/Select.d.ts +0 -4
  325. package/select/Select.js +0 -602
  326. package/select/Select.stories.tsx +0 -919
  327. package/select/Select.test.js +0 -2265
  328. package/select/types.d.ts +0 -209
  329. package/select/types.js +0 -5
  330. package/sidenav/Sidenav.accessibility.test.js +0 -59
  331. package/sidenav/Sidenav.d.ts +0 -10
  332. package/sidenav/Sidenav.js +0 -201
  333. package/sidenav/Sidenav.stories.tsx +0 -277
  334. package/sidenav/Sidenav.test.js +0 -37
  335. package/sidenav/SidenavContext.d.ts +0 -5
  336. package/sidenav/SidenavContext.js +0 -13
  337. package/sidenav/types.d.ts +0 -76
  338. package/sidenav/types.js +0 -5
  339. package/slider/Slider.accessibility.test.js +0 -104
  340. package/slider/Slider.d.ts +0 -4
  341. package/slider/Slider.js +0 -286
  342. package/slider/Slider.test.js +0 -254
  343. package/slider/types.d.ts +0 -86
  344. package/slider/types.js +0 -5
  345. package/spinner/Spinner.accessibility.test.js +0 -96
  346. package/spinner/Spinner.d.ts +0 -4
  347. package/spinner/Spinner.js +0 -210
  348. package/spinner/Spinner.stories.tsx +0 -129
  349. package/spinner/Spinner.test.js +0 -55
  350. package/spinner/types.d.ts +0 -32
  351. package/spinner/types.js +0 -5
  352. package/status-light/StatusLight.accessibility.test.js +0 -157
  353. package/status-light/StatusLight.d.ts +0 -4
  354. package/status-light/StatusLight.js +0 -51
  355. package/status-light/StatusLight.stories.tsx +0 -74
  356. package/status-light/StatusLight.test.js +0 -25
  357. package/status-light/types.d.ts +0 -17
  358. package/status-light/types.js +0 -5
  359. package/switch/Switch.accessibility.test.js +0 -98
  360. package/switch/Switch.d.ts +0 -4
  361. package/switch/Switch.js +0 -214
  362. package/switch/Switch.stories.tsx +0 -149
  363. package/switch/Switch.test.js +0 -180
  364. package/switch/types.d.ts +0 -66
  365. package/switch/types.js +0 -5
  366. package/table/DropdownTheme.js +0 -62
  367. package/table/Table.accessibility.test.js +0 -93
  368. package/table/Table.d.ts +0 -8
  369. package/table/Table.js +0 -161
  370. package/table/Table.stories.tsx +0 -663
  371. package/table/Table.test.js +0 -113
  372. package/table/types.d.ts +0 -49
  373. package/table/types.js +0 -5
  374. package/tabs/Tab.d.ts +0 -4
  375. package/tabs/Tab.js +0 -117
  376. package/tabs/Tabs.accessibility.test.js +0 -56
  377. package/tabs/Tabs.d.ts +0 -4
  378. package/tabs/Tabs.js +0 -373
  379. package/tabs/Tabs.stories.tsx +0 -230
  380. package/tabs/Tabs.test.js +0 -276
  381. package/tabs/types.d.ts +0 -92
  382. package/tabs/types.js +0 -5
  383. package/tag/Tag.accessibility.test.js +0 -69
  384. package/tag/Tag.d.ts +0 -4
  385. package/tag/Tag.js +0 -151
  386. package/tag/Tag.stories.tsx +0 -152
  387. package/tag/Tag.test.js +0 -41
  388. package/tag/types.d.ts +0 -69
  389. package/tag/types.js +0 -5
  390. package/text-input/Suggestion.d.ts +0 -4
  391. package/text-input/Suggestion.js +0 -67
  392. package/text-input/Suggestions.d.ts +0 -4
  393. package/text-input/Suggestions.js +0 -94
  394. package/text-input/TextInput.accessibility.test.js +0 -321
  395. package/text-input/TextInput.d.ts +0 -4
  396. package/text-input/TextInput.js +0 -571
  397. package/text-input/TextInput.stories.tsx +0 -474
  398. package/text-input/TextInput.test.js +0 -1756
  399. package/text-input/types.d.ts +0 -205
  400. package/text-input/types.js +0 -5
  401. package/textarea/Textarea.accessibility.test.js +0 -155
  402. package/textarea/Textarea.d.ts +0 -4
  403. package/textarea/Textarea.js +0 -235
  404. package/textarea/Textarea.stories.tsx +0 -174
  405. package/textarea/Textarea.test.js +0 -406
  406. package/textarea/types.d.ts +0 -141
  407. package/textarea/types.js +0 -5
  408. package/toggle-group/ToggleGroup.accessibility.test.js +0 -107
  409. package/toggle-group/ToggleGroup.d.ts +0 -4
  410. package/toggle-group/ToggleGroup.js +0 -202
  411. package/toggle-group/ToggleGroup.stories.tsx +0 -218
  412. package/toggle-group/ToggleGroup.test.js +0 -137
  413. package/toggle-group/types.d.ts +0 -114
  414. package/toggle-group/types.js +0 -5
  415. package/typography/Typography.accessibility.test.js +0 -339
  416. package/typography/Typography.d.ts +0 -4
  417. package/typography/Typography.js +0 -23
  418. package/typography/Typography.stories.tsx +0 -198
  419. package/typography/types.d.ts +0 -18
  420. package/typography/types.js +0 -5
  421. package/useTheme.d.ts +0 -1145
  422. package/useTheme.js +0 -15
  423. package/useTranslatedLabels.d.ts +0 -85
  424. package/useTranslatedLabels.js +0 -14
  425. package/utils/BaseTypography.d.ts +0 -21
  426. package/utils/BaseTypography.js +0 -94
  427. package/utils/FocusLock.d.ts +0 -13
  428. package/utils/FocusLock.js +0 -124
  429. package/wizard/Wizard.accessibility.test.js +0 -55
  430. package/wizard/Wizard.d.ts +0 -4
  431. package/wizard/Wizard.js +0 -239
  432. package/wizard/Wizard.stories.tsx +0 -272
  433. package/wizard/Wizard.test.js +0 -114
  434. package/wizard/types.d.ts +0 -64
  435. package/wizard/types.js +0 -5
package/slider/Slider.js DELETED
@@ -1,286 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof3 = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
- var _react = _interopRequireWildcard(require("react"));
13
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
14
- var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
15
- var _variables = require("../common/variables");
16
- var _utils = require("../common/utils");
17
- var _useTheme = _interopRequireDefault(require("../useTheme"));
18
- var _uuid = require("uuid");
19
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
20
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
22
- var DxcSlider = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
23
- var _navigator;
24
- var _ref$label = _ref.label,
25
- label = _ref$label === void 0 ? "" : _ref$label,
26
- _ref$name = _ref.name,
27
- name = _ref$name === void 0 ? "" : _ref$name,
28
- defaultValue = _ref.defaultValue,
29
- value = _ref.value,
30
- _ref$helperText = _ref.helperText,
31
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
32
- _ref$minValue = _ref.minValue,
33
- minValue = _ref$minValue === void 0 ? 0 : _ref$minValue,
34
- _ref$maxValue = _ref.maxValue,
35
- maxValue = _ref$maxValue === void 0 ? 100 : _ref$maxValue,
36
- _ref$step = _ref.step,
37
- step = _ref$step === void 0 ? 1 : _ref$step,
38
- _ref$showLimitsValues = _ref.showLimitsValues,
39
- showLimitsValues = _ref$showLimitsValues === void 0 ? false : _ref$showLimitsValues,
40
- _ref$showInput = _ref.showInput,
41
- showInput = _ref$showInput === void 0 ? false : _ref$showInput,
42
- _ref$disabled = _ref.disabled,
43
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
44
- _ref$marks = _ref.marks,
45
- marks = _ref$marks === void 0 ? false : _ref$marks,
46
- onChange = _ref.onChange,
47
- onDragEnd = _ref.onDragEnd,
48
- labelFormatCallback = _ref.labelFormatCallback,
49
- margin = _ref.margin,
50
- _ref$size = _ref.size,
51
- size = _ref$size === void 0 ? "fillParent" : _ref$size;
52
- var _useState = (0, _react.useState)("label-".concat((0, _uuid.v4)())),
53
- _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
54
- labelId = _useState2[0];
55
- var _useState3 = (0, _react.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0),
56
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
57
- innerValue = _useState4[0],
58
- setInnerValue = _useState4[1];
59
- var _useState5 = (0, _react.useState)(false),
60
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
61
- dragging = _useState6[0],
62
- setDragging = _useState6[1];
63
- var colorsTheme = (0, _useTheme["default"])();
64
- var isFirefox = ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.userAgent.indexOf("Firefox")) !== -1;
65
- var minLabel = (0, _react.useMemo)(function () {
66
- return labelFormatCallback ? labelFormatCallback(minValue) : minValue;
67
- }, [labelFormatCallback, minValue]);
68
- var maxLabel = (0, _react.useMemo)(function () {
69
- return labelFormatCallback ? labelFormatCallback(maxValue) : maxValue;
70
- }, [labelFormatCallback, maxValue]);
71
- var tickMarks = (0, _react.useMemo)(function () {
72
- var numberOfMarks = Math.floor(maxValue / step - minValue / step);
73
- var range = maxValue - minValue;
74
- var ticks = [];
75
- var index = 0;
76
- if (marks) {
77
- while (index <= numberOfMarks) {
78
- ticks.push( /*#__PURE__*/_react["default"].createElement(TickMark, {
79
- disabled: disabled,
80
- stepPosition: step * index / range,
81
- stepValue: (value !== null && value !== void 0 ? value : innerValue) / maxValue,
82
- key: "tickmark-".concat(index, "-").concat(labelId)
83
- }));
84
- index++;
85
- }
86
- return ticks;
87
- } else return null;
88
- }, [minValue, maxValue, step, value, innerValue]);
89
- var handleSliderChange = function handleSliderChange(event) {
90
- var valueToCheck = event.target.value;
91
- (valueToCheck !== value || valueToCheck !== innerValue) && setInnerValue(valueToCheck);
92
- onChange === null || onChange === void 0 ? void 0 : onChange(valueToCheck);
93
- };
94
- var handleSliderDragging = function handleSliderDragging() {
95
- setDragging(true);
96
- };
97
- var handleSliderOnChangeCommitted = function handleSliderOnChangeCommitted(event) {
98
- if (dragging) {
99
- setDragging(false);
100
- onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(event.target.value);
101
- }
102
- };
103
- var handlerInputChange = function handlerInputChange(event) {
104
- var intValue = parseInt(event.value, 10);
105
- if (value == null) {
106
- if (!Number.isNaN(intValue)) setInnerValue(intValue > maxValue ? maxValue : intValue);
107
- }
108
- if (!Number.isNaN(intValue)) {
109
- onChange === null || onChange === void 0 ? void 0 : onChange(intValue > maxValue ? maxValue : intValue);
110
- }
111
- };
112
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
113
- theme: colorsTheme.slider
114
- }, /*#__PURE__*/_react["default"].createElement(Container, {
115
- margin: margin,
116
- size: size,
117
- ref: ref
118
- }, /*#__PURE__*/_react["default"].createElement(Label, {
119
- id: labelId,
120
- disabled: disabled
121
- }, label), /*#__PURE__*/_react["default"].createElement(HelperText, {
122
- disabled: disabled
123
- }, helperText), /*#__PURE__*/_react["default"].createElement(SliderContainer, null, showLimitsValues && /*#__PURE__*/_react["default"].createElement(MinLabelContainer, {
124
- disabled: disabled
125
- }, minLabel), /*#__PURE__*/_react["default"].createElement(SliderInputContainer, null, /*#__PURE__*/_react["default"].createElement(SliderInput, {
126
- role: "slider",
127
- type: "range",
128
- value: value != null && value >= 0 ? value : innerValue,
129
- min: minValue,
130
- max: maxValue,
131
- step: step,
132
- disabled: disabled,
133
- "aria-labelledby": labelId,
134
- "aria-orientation": "horizontal",
135
- "aria-valuemax": maxValue,
136
- "aria-valuemin": minValue,
137
- "aria-valuenow": value != null && value >= 0 ? value : innerValue,
138
- onChange: handleSliderChange,
139
- onMouseUp: handleSliderOnChangeCommitted,
140
- onMouseDown: handleSliderDragging
141
- }), marks && /*#__PURE__*/_react["default"].createElement(MarksContainer, {
142
- isFirefox: isFirefox
143
- }, tickMarks)), showLimitsValues && /*#__PURE__*/_react["default"].createElement(MaxLabelContainer, {
144
- disabled: disabled,
145
- step: step
146
- }, maxLabel), showInput && /*#__PURE__*/_react["default"].createElement(StyledTextInput, null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
147
- name: name,
148
- value: value != null && value >= 0 ? value.toString() : innerValue.toString(),
149
- disabled: disabled,
150
- onChange: handlerInputChange,
151
- size: "fillParent"
152
- })))));
153
- });
154
- var sizes = {
155
- medium: "360px",
156
- large: "480px",
157
- fillParent: "100%"
158
- };
159
- var calculateWidth = function calculateWidth(margin, size) {
160
- return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
161
- };
162
- var getChromeStyles = function getChromeStyles() {
163
- return "\n width: 100%;\n margin-right: 4px;";
164
- };
165
- var getFireFoxStyles = function getFireFoxStyles() {
166
- return "\n width: calc(100% - 16px);\n margin-right: 3px;";
167
- };
168
- var Container = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: ", ";\n"])), function (props) {
169
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
170
- }, function (props) {
171
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
172
- }, function (props) {
173
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
174
- }, function (props) {
175
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
176
- }, function (props) {
177
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
178
- }, function (props) {
179
- return calculateWidth(props.margin, props.size);
180
- });
181
- var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
182
- return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
183
- }, function (props) {
184
- return props.theme.fontFamily;
185
- }, function (props) {
186
- return props.theme.labelFontSize;
187
- }, function (props) {
188
- return props.theme.labelFontStyle;
189
- }, function (props) {
190
- return props.theme.labelFontWeight;
191
- }, function (props) {
192
- return props.theme.labelLineHeight;
193
- });
194
- var HelperText = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
195
- return props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor;
196
- }, function (props) {
197
- return props.theme.fontFamily;
198
- }, function (props) {
199
- return props.theme.helperTextFontSize;
200
- }, function (props) {
201
- return props.theme.helperTextFontStyle;
202
- }, function (props) {
203
- return props.theme.helperTextFontWeight;
204
- }, function (props) {
205
- return props.theme.helperTextLineHeight;
206
- });
207
- var SliderInput = _styledComponents["default"].input(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n min-width: 240px;\n height: ", ";\n display: inline-block;\n vertical-align: middle;\n -webkit-appearance: none;\n background-color: ", ";\n background-image: ", ";\n background-repeat: no-repeat;\n background-size: ", ";\n border-radius: 5px;\n cursor: ", ";\n &::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n margin: 0px -8px;\n }\n\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: ", ";\n width: ", ";\n border-radius: 25px;\n background: ", ";\n &:active {\n ", "\n }\n &:hover {\n ", "\n }\n }\n &::-moz-range-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n }\n &::-moz-range-thumb {\n -webkit-appearance: none;\n border: none;\n height: ", ";\n width: ", ";\n border-radius: 25px;\n background: ", ";\n &:active {\n background: ", ";\n transform: scale(1.16667);\n }\n &:hover {\n ", "\n }\n }\n &:focus {\n outline: none;\n &::-webkit-slider-thumb {\n outline: ", " auto 1px;\n outline-offset: 2px;\n }\n &::-moz-range-thumb {\n outline: ", " auto 1px;\n outline-offset: 2px;\n }\n }\n"])), function (props) {
208
- return props.theme.trackLineThickness;
209
- }, function (props) {
210
- return props.disabled ? props.theme.disabledTotalLineColor + "61" : props.theme.totalLineColor;
211
- }, function (props) {
212
- return props.disabled ? "linear-gradient(".concat(props.theme.disabledTrackLineColor, ", ").concat(props.theme.disabledTrackLineColor, ")") : "linear-gradient(".concat(props.theme.trackLineColor, ", ").concat(props.theme.trackLineColor, ")");
213
- }, function (props) {
214
- return (props.value - props.min) * 100 / (props.max - props.min) + "% 100%";
215
- }, function (props) {
216
- return props.disabled ? "not-allowed" : "pointer";
217
- }, function (props) {
218
- return props.theme.thumbHeight;
219
- }, function (props) {
220
- return props.theme.thumbWidth;
221
- }, function (props) {
222
- return props.disabled ? props.theme.disabledThumbBackgroundColor : props.theme.thumbBackgroundColor;
223
- }, function (props) {
224
- if (!props.disabled) {
225
- return "\n background: ".concat(props.theme.activeThumbBackgroundColor, ";\n transform: scale(1.16667);");
226
- }
227
- }, function (props) {
228
- if (!props.disabled) {
229
- return "height: ".concat(props.theme.hoverThumbHeight, ";\n width: ").concat(props.theme.hoverThumbWidth, ";\n transform: scale(1.16667);\n transform-origin: center center;\n background: ").concat(props.theme.hoverThumbBackgroundColor, ";");
230
- }
231
- }, function (props) {
232
- return props.theme.thumbHeight;
233
- }, function (props) {
234
- return props.theme.thumbWidth;
235
- }, function (props) {
236
- return props.disabled ? props.theme.disabledThumbBackgroundColor : props.theme.thumbBackgroundColor;
237
- }, function (props) {
238
- return props.theme.activeThumbBackgroundColor;
239
- }, function (props) {
240
- if (!props.disabled) {
241
- return "height: ".concat(props.theme.hoverThumbHeight, ";\n width: ").concat(props.theme.hoverThumbWidth, ";\n transform: scale(1.16667);\n transform-origin: center center;\n background: ").concat(props.theme.hoverThumbBackgroundColor, ";");
242
- }
243
- }, function (props) {
244
- return props.disabled ? props.theme.disabledFocusColor : props.theme.focusColor;
245
- }, function (props) {
246
- return props.disabled ? props.theme.disabledFocusColor : props.theme.focusColor;
247
- });
248
- var SliderContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 48px;\n align-items: center;\n"])));
249
- var LimitLabelContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n white-space: nowrap;\n"])), function (props) {
250
- return props.disabled ? props.theme.disabledLimitValuesFontColor : props.theme.limitValuesFontColor;
251
- }, function (props) {
252
- return props.theme.fontFamily;
253
- }, function (props) {
254
- return props.theme.limitValuesFontSize;
255
- }, function (props) {
256
- return props.theme.limitValuesFontStyle;
257
- }, function (props) {
258
- return props.theme.limitValuesFontWeight;
259
- }, function (props) {
260
- return props.theme.limitValuesFontLetterSpacing;
261
- });
262
- var MinLabelContainer = (0, _styledComponents["default"])(LimitLabelContainer)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: ", ";\n"])), function (props) {
263
- return props.theme.floorLabelMarginRight;
264
- });
265
- var MaxLabelContainer = (0, _styledComponents["default"])(LimitLabelContainer)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n"])), function (props) {
266
- return props.step === 1 ? props.theme.ceilLabelMarginLeft : "1.25rem";
267
- });
268
- var SliderInputContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: -2px;\n padding-top: 1px;\n z-index: 0;\n"])));
269
- var MarksContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n position: absolute;\n pointer-events: none;\n height: 100%;\n display: flex;\n align-items: center;\n"])), function (props) {
270
- return props.isFirefox ? getFireFoxStyles() : getChromeStyles();
271
- });
272
- var TickMark = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n background: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n left: ", ";\n z-index: ", ";\n"])), function (props) {
273
- return props.disabled ? props.theme.disabledTickBackgroundColor : props.theme.tickBackgroundColor;
274
- }, function (props) {
275
- return props.theme.tickHeight;
276
- }, function (props) {
277
- return props.theme.tickWidth;
278
- }, function (props) {
279
- return "calc(".concat(props.stepPosition, " * 100%)");
280
- }, function (props) {
281
- return "".concat(props.stepPosition <= props.stepValue ? "-1" : "0");
282
- });
283
- var StyledTextInput = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n max-width: 70px;\n"])), function (props) {
284
- return props.theme.inputMarginLeft;
285
- });
286
- var _default = exports["default"] = DxcSlider;
@@ -1,254 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
5
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
6
- var _react = _interopRequireDefault(require("react"));
7
- var _react2 = require("@testing-library/react");
8
- var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
9
- var _Slider = _interopRequireDefault(require("./Slider.tsx"));
10
- // Mocking DOMRect for Radix Primitive Popover
11
- global.globalThis = global;
12
- global.DOMRect = {
13
- fromRect: function fromRect() {
14
- return {
15
- top: 0,
16
- left: 0,
17
- bottom: 0,
18
- right: 0,
19
- width: 0,
20
- height: 0
21
- };
22
- }
23
- };
24
- global.ResizeObserver = /*#__PURE__*/function () {
25
- function ResizeObserver() {
26
- (0, _classCallCheck2["default"])(this, ResizeObserver);
27
- }
28
- (0, _createClass2["default"])(ResizeObserver, [{
29
- key: "observe",
30
- value: function observe() {}
31
- }, {
32
- key: "unobserve",
33
- value: function unobserve() {}
34
- }, {
35
- key: "disconnect",
36
- value: function disconnect() {}
37
- }]);
38
- return ResizeObserver;
39
- }();
40
- describe("Slider component tests", function () {
41
- test("Slider renders with correct text and label id", function () {
42
- var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
43
- label: "label",
44
- minValue: 0,
45
- maxValue: 100,
46
- showLimitsValues: true
47
- })),
48
- getByText = _render.getByText,
49
- getByRole = _render.getByRole;
50
- expect(getByText("0")).toBeTruthy();
51
- expect(getByText("100")).toBeTruthy();
52
- var sliderId = getByText("label").getAttribute("id");
53
- expect(getByRole("slider").getAttribute("aria-labelledby")).toBe(sliderId);
54
- expect(getByRole("slider").getAttribute("aria-orientation")).toBe("horizontal");
55
- });
56
- test("Slider renders with correct initial value when it is uncontrolled", function () {
57
- var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
58
- defaultValue: 30,
59
- minValue: 0,
60
- maxValue: 100,
61
- showLimitsValues: true,
62
- showInput: true
63
- })),
64
- getByRole = _render2.getByRole;
65
- var slider = getByRole("slider");
66
- var input = getByRole("textbox");
67
- expect(slider.getAttribute("aria-valuenow")).toBe("30");
68
- expect(input.value).toBe("30");
69
- });
70
- test("Slider correct limit values", function () {
71
- var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
72
- defaultValue: 125,
73
- minValue: 30,
74
- maxValue: 125,
75
- showLimitsValues: true
76
- })),
77
- getByRole = _render3.getByRole,
78
- getByText = _render3.getByText;
79
- var slider = getByRole("slider");
80
- expect(slider.getAttribute("aria-valuemin")).toBe("30");
81
- expect(slider.getAttribute("aria-valuemax")).toBe("125");
82
- _userEvent["default"].tab();
83
- _react2.fireEvent.keyDown(slider, {
84
- key: "ArrowRight",
85
- code: "ArrowRight",
86
- keyCode: 39,
87
- charCode: 39
88
- });
89
- expect(slider.getAttribute("aria-valuenow")).toBe("125");
90
- expect(getByText("30")).toBeTruthy();
91
- expect(getByText("125")).toBeTruthy();
92
- });
93
- test("Calls correct function onChange in controlled slider", function () {
94
- var onChange = jest.fn();
95
- var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
96
- minValue: 0,
97
- maxValue: 100,
98
- onChange: onChange,
99
- showLimitsValues: true,
100
- value: 13,
101
- showInput: true
102
- })),
103
- getByRole = _render4.getByRole;
104
- expect(getByRole("slider").getAttribute("aria-valuenow")).toBe("13");
105
- expect(getByRole("textbox").value).toBe("13");
106
- (0, _react2.act)(function () {
107
- _react2.fireEvent.change(getByRole("textbox"), {
108
- target: {
109
- value: 25
110
- }
111
- });
112
- });
113
- expect(onChange).toHaveBeenCalledWith(25);
114
- expect(getByRole("slider").getAttribute("aria-valuenow")).toBe("13");
115
- expect(getByRole("textbox").value).toBe("13");
116
- });
117
- test("Calls correct function onChange in uncontrolled slider", function () {
118
- var onChange = jest.fn();
119
- var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
120
- minValue: 0,
121
- maxValue: 100,
122
- onChange: onChange,
123
- showLimitsValues: true,
124
- showInput: true
125
- })),
126
- getByRole = _render5.getByRole;
127
- (0, _react2.act)(function () {
128
- _react2.fireEvent.change(getByRole("textbox"), {
129
- target: {
130
- value: 25
131
- }
132
- });
133
- });
134
- expect(onChange).toHaveBeenCalledWith(25);
135
- expect(getByRole("slider").getAttribute("aria-valuenow")).toBe("25");
136
- expect(getByRole("textbox").value).toBe("25");
137
- });
138
- test("Disabled slider have disabled input and slider", function () {
139
- var onChange = jest.fn();
140
- var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
141
- minValue: 0,
142
- maxValue: 100,
143
- onChange: onChange,
144
- showLimitsValues: true,
145
- disabled: true,
146
- showInput: true,
147
- value: 13
148
- })),
149
- getByRole = _render6.getByRole;
150
- (0, _react2.act)(function () {
151
- _react2.fireEvent.change(getByRole("textbox"), {
152
- target: {
153
- value: 25
154
- }
155
- });
156
- });
157
- expect(getByRole("textbox").hasAttribute("disabled")).toBeTruthy();
158
- expect(getByRole("textbox").value).toBe("13");
159
- expect(getByRole("slider").hasAttribute("disabled")).toBeTruthy();
160
- });
161
- test("Calls correct function onDragEnd when it is uncontrolled", function () {
162
- var onDragEnd = jest.fn();
163
- var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
164
- minValue: 0,
165
- maxValue: 150,
166
- onDragEnd: onDragEnd,
167
- showInput: true
168
- })),
169
- getByRole = _render7.getByRole;
170
- var slider = getByRole("slider");
171
- (0, _react2.act)(function () {
172
- _react2.fireEvent.mouseDown(slider);
173
- });
174
- (0, _react2.act)(function () {
175
- _react2.fireEvent.mouseUp(slider, {
176
- target: {
177
- value: 120
178
- }
179
- });
180
- });
181
- expect(onDragEnd).toHaveBeenCalledWith("120");
182
- });
183
- test("Calls correct function onDragEnd when it is controlled", function () {
184
- var onDragEnd = jest.fn();
185
- var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
186
- minValue: 0,
187
- maxValue: 150,
188
- value: 50,
189
- onDragEnd: onDragEnd,
190
- showInput: true
191
- })),
192
- getByRole = _render8.getByRole;
193
- var slider = getByRole("slider");
194
- (0, _react2.act)(function () {
195
- _react2.fireEvent.mouseDown(slider);
196
- });
197
- (0, _react2.act)(function () {
198
- _react2.fireEvent.mouseUp(slider, {
199
- target: {
200
- value: 120
201
- }
202
- });
203
- });
204
- expect(onDragEnd).toHaveBeenCalledWith("120");
205
- expect(slider.getAttribute("aria-valuenow")).toBe("50");
206
- });
207
- test("Calls correct function labelFormatCallback", function () {
208
- var labelFormatCallback = jest.fn(function (x) {
209
- return "".concat(x, "$");
210
- });
211
- var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
212
- minValue: 0,
213
- maxValue: 100,
214
- showLimitsValues: true,
215
- showInput: true,
216
- value: 25,
217
- labelFormatCallback: labelFormatCallback
218
- })),
219
- getByText = _render9.getByText;
220
- expect(getByText("0$")).toBeTruthy();
221
- expect(getByText("100$")).toBeTruthy();
222
- expect(labelFormatCallback).toHaveBeenCalledTimes(2);
223
- });
224
- test("Change value correctly to 0 from external function", function () {
225
- var onChange = jest.fn();
226
- var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
227
- minValue: 0,
228
- maxValue: 100,
229
- onChange: onChange,
230
- showLimitsValues: true,
231
- value: 13,
232
- showInput: true
233
- })),
234
- rerender = _render10.rerender,
235
- getByRole = _render10.getByRole;
236
- var slider = getByRole("slider");
237
- _userEvent["default"].tab();
238
- _react2.fireEvent.keyDown(slider, {
239
- key: "ArrowRight",
240
- code: "ArrowRight",
241
- keyCode: 39,
242
- charCode: 39
243
- });
244
- rerender( /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
245
- minValue: 0,
246
- maxValue: 100,
247
- onChange: onChange,
248
- showLimitsValues: true,
249
- value: 0,
250
- showInput: true
251
- }));
252
- expect(slider.getAttribute("aria-valuenow")).toBe("0");
253
- });
254
- });
package/slider/types.d.ts DELETED
@@ -1,86 +0,0 @@
1
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
- type Margin = {
3
- top?: Space;
4
- bottom?: Space;
5
- left?: Space;
6
- right?: Space;
7
- };
8
- type Props = {
9
- /**
10
- * Text to be placed above the slider.
11
- */
12
- label?: string;
13
- /**
14
- * Name attribute of the input element.
15
- */
16
- name?: string;
17
- /**
18
- * Initial value of the slider, only when it is uncontrolled.
19
- */
20
- defaultValue?: number;
21
- /**
22
- * The selected value. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
23
- */
24
- value?: number;
25
- /**
26
- * Helper text to be placed above the slider.
27
- */
28
- helperText?: string;
29
- /**
30
- * The minimum value available for selection.
31
- */
32
- minValue?: number;
33
- /**
34
- * The maximum value available for selection.
35
- */
36
- maxValue?: number;
37
- /**
38
- * The step interval between values available for selection.
39
- */
40
- step?: number;
41
- /**
42
- * Whether the min/max value labels should be displayed next to the slider
43
- */
44
- showLimitsValues?: boolean;
45
- /**
46
- * Whether the input element for displaying/controlling the slider value should be displayed next to the slider.
47
- */
48
- showInput?: boolean;
49
- /**
50
- * If true, the component will be disabled.
51
- */
52
- disabled?: boolean;
53
- /**
54
- * Whether the marks between each step should be shown or not.
55
- */
56
- marks?: boolean;
57
- /**
58
- * This function will be called when the slider changes its value, as it's being dragged.
59
- * The new value will be passed as a parameter when this function is executed.
60
- */
61
- onChange?: (value: number) => void;
62
- /**
63
- * This function will be called when the slider changes its value, but only when the thumb is released.
64
- * The new value will be passed as a parameter when this function is executed.
65
- */
66
- onDragEnd?: (value: number) => void;
67
- /**
68
- * This function will be used to format the labels displayed next to the slider.
69
- * The value will be passed as parameter and the function must return the formatted value.
70
- */
71
- labelFormatCallback?: (value: number) => string;
72
- /**
73
- * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
74
- * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
75
- */
76
- margin?: Space | Margin;
77
- /**
78
- * Size of the component.
79
- */
80
- size?: "medium" | "large" | "fillParent";
81
- };
82
- /**
83
- * Reference to the component.
84
- */
85
- export type RefType = HTMLDivElement;
86
- export default Props;
package/slider/types.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });