@ultraviolet/ui 1.51.0 → 1.51.2

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 (440) hide show
  1. package/dist/components/ActionBar/index.d.ts +20 -0
  2. package/dist/components/ActionBar/index.js +40 -0
  3. package/dist/components/Alert/index.d.ts +27 -0
  4. package/dist/components/Alert/index.js +126 -0
  5. package/dist/components/Avatar/index.d.ts +43 -0
  6. package/dist/components/Avatar/index.js +54 -0
  7. package/dist/components/Badge/index.d.ts +31 -0
  8. package/dist/components/Badge/index.js +115 -0
  9. package/dist/components/Banner/assets/default-image-small.svg.js +4 -0
  10. package/dist/components/Banner/assets/default-image.svg.js +4 -0
  11. package/dist/components/Banner/index.d.ts +24 -0
  12. package/dist/components/Banner/index.js +191 -0
  13. package/dist/components/BarChart/Tooltip.d.ts +9 -0
  14. package/dist/components/BarChart/Tooltip.js +36 -0
  15. package/dist/components/BarChart/index.d.ts +27 -0
  16. package/dist/components/BarChart/index.js +82 -0
  17. package/dist/components/BarStack/index.d.ts +36 -0
  18. package/dist/components/BarStack/index.js +188 -0
  19. package/dist/components/Breadcrumbs/index.d.ts +30 -0
  20. package/dist/components/Breadcrumbs/index.js +76 -0
  21. package/dist/components/Bullet/index.d.ts +39 -0
  22. package/dist/components/Bullet/index.js +88 -0
  23. package/dist/components/Button/index.d.ts +120 -0
  24. package/dist/components/Button/index.js +291 -0
  25. package/dist/components/Card/index.d.ts +20 -0
  26. package/dist/components/Card/index.js +59 -0
  27. package/dist/components/Carousel/index.d.ts +19 -0
  28. package/dist/components/Carousel/index.js +147 -0
  29. package/dist/components/Checkbox/index.d.ts +36 -0
  30. package/dist/components/Checkbox/index.js +359 -0
  31. package/dist/components/CheckboxGroup/index.d.ts +24 -0
  32. package/dist/components/CheckboxGroup/index.js +112 -0
  33. package/dist/components/CopyButton/index.d.ts +19 -0
  34. package/dist/components/CopyButton/index.js +37 -0
  35. package/dist/components/DateInput/datepicker.css.js +4 -0
  36. package/dist/components/DateInput/index.d.ts +38 -0
  37. package/dist/components/DateInput/index.js +301 -0
  38. package/dist/components/Dialog/Context.d.ts +7 -0
  39. package/dist/components/Dialog/Context.js +15 -0
  40. package/dist/components/Dialog/constants.d.ts +2 -0
  41. package/dist/components/Dialog/index.d.ts +87 -0
  42. package/dist/components/Dialog/index.js +87 -0
  43. package/dist/components/Dialog/subComponents/Button.d.ts +7 -0
  44. package/dist/components/Dialog/subComponents/Button.js +24 -0
  45. package/dist/components/Dialog/subComponents/Buttons.d.ts +7 -0
  46. package/dist/components/Dialog/subComponents/Buttons.js +12 -0
  47. package/dist/components/Dialog/subComponents/CancelButton.d.ts +8 -0
  48. package/dist/components/Dialog/subComponents/CancelButton.js +9 -0
  49. package/dist/components/Dialog/subComponents/Stack.d.ts +6 -0
  50. package/dist/components/Dialog/subComponents/Stack.js +6 -0
  51. package/dist/components/Dialog/subComponents/Text.d.ts +6 -0
  52. package/dist/components/Dialog/subComponents/Text.js +6 -0
  53. package/dist/components/EmptyState/index.d.ts +38 -0
  54. package/dist/components/EmptyState/index.js +82 -0
  55. package/dist/components/Expandable/index.d.ts +33 -0
  56. package/dist/components/Expandable/index.js +79 -0
  57. package/dist/components/GlobalAlert/GlobalAlertLink.d.ts +3 -0
  58. package/dist/components/GlobalAlert/GlobalAlertLink.js +39 -0
  59. package/dist/components/GlobalAlert/index.d.ts +40 -0
  60. package/dist/components/GlobalAlert/index.js +112 -0
  61. package/dist/components/LineChart/CustomLegend.d.ts +13 -0
  62. package/dist/components/LineChart/CustomLegend.js +109 -0
  63. package/dist/components/LineChart/Tooltip.d.ts +6 -0
  64. package/dist/components/LineChart/Tooltip.js +46 -0
  65. package/dist/components/LineChart/helpers.d.ts +8 -0
  66. package/dist/components/LineChart/helpers.js +50 -0
  67. package/dist/components/LineChart/index.d.ts +25 -0
  68. package/dist/components/LineChart/index.js +118 -0
  69. package/dist/components/Link/index.d.ts +33 -0
  70. package/dist/components/Link/index.js +167 -0
  71. package/dist/components/List/Body.d.ts +6 -0
  72. package/dist/components/List/Body.js +11 -0
  73. package/dist/components/List/Cell.d.ts +12 -0
  74. package/dist/components/List/Cell.js +38 -0
  75. package/dist/components/List/HeaderCell.d.ts +11 -0
  76. package/dist/components/List/HeaderCell.js +96 -0
  77. package/dist/components/List/HeaderRow.d.ts +7 -0
  78. package/dist/components/List/HeaderRow.js +38 -0
  79. package/dist/components/List/ListContext.d.ts +34 -0
  80. package/dist/components/List/ListContext.js +155 -0
  81. package/dist/components/List/Row.d.ts +23 -0
  82. package/dist/components/List/Row.js +194 -0
  83. package/dist/components/List/SelectBar.d.ts +15 -0
  84. package/dist/components/List/SelectBar.js +35 -0
  85. package/dist/components/List/SkeletonRows.d.ts +7 -0
  86. package/dist/components/List/SkeletonRows.js +36 -0
  87. package/dist/components/List/constants.d.ts +2 -0
  88. package/dist/{src/components → components}/List/constants.js +4 -2
  89. package/dist/components/List/index.d.ts +68 -0
  90. package/dist/components/List/index.js +80 -0
  91. package/dist/components/Loader/index.d.ts +22 -0
  92. package/dist/components/Loader/index.js +98 -0
  93. package/dist/components/Menu/Item.d.ts +15 -0
  94. package/dist/components/Menu/Item.js +101 -0
  95. package/dist/components/Menu/index.d.ts +49 -0
  96. package/dist/components/Menu/index.js +182 -0
  97. package/dist/components/MenuV2/Group.d.ts +7 -0
  98. package/dist/components/MenuV2/Group.js +23 -0
  99. package/dist/components/MenuV2/Item.d.ts +16 -0
  100. package/dist/components/MenuV2/Item.js +120 -0
  101. package/dist/components/MenuV2/index.d.ts +90 -0
  102. package/dist/components/MenuV2/index.js +124 -0
  103. package/dist/components/Meter/index.d.ts +26 -0
  104. package/dist/components/Meter/index.js +76 -0
  105. package/dist/components/Modal/Dialog.d.ts +3 -0
  106. package/dist/components/Modal/Dialog.js +197 -0
  107. package/dist/components/Modal/Disclosure.d.ts +3 -0
  108. package/dist/{src/components → components}/Modal/Disclosure.js +12 -12
  109. package/dist/components/Modal/constants.d.ts +3 -0
  110. package/dist/{src/components → components}/Modal/constants.js +8 -6
  111. package/dist/components/Modal/index.d.ts +42 -0
  112. package/dist/components/Modal/index.js +114 -0
  113. package/dist/components/Modal/types.d.ts +48 -0
  114. package/dist/components/Notice/index.d.ts +11 -0
  115. package/dist/components/Notice/index.js +39 -0
  116. package/dist/components/Notification/index.d.ts +36 -0
  117. package/dist/components/Notification/index.js +88 -0
  118. package/dist/components/Notification/react-toastify.css.js +4 -0
  119. package/dist/components/NumberInput/helpers.d.ts +4 -0
  120. package/dist/{src/components → components}/NumberInput/helpers.js +6 -2
  121. package/dist/components/NumberInput/index.d.ts +41 -0
  122. package/dist/components/NumberInput/index.js +349 -0
  123. package/dist/components/NumberInputV2/index.d.ts +27 -0
  124. package/dist/components/NumberInputV2/index.js +370 -0
  125. package/dist/components/Pagination/getPageNumbers.d.ts +8 -0
  126. package/dist/{src/components → components}/Pagination/getPageNumbers.js +4 -12
  127. package/dist/components/Pagination/index.d.ts +30 -0
  128. package/dist/components/Pagination/index.js +124 -0
  129. package/dist/components/PasswordCheck/index.d.ts +20 -0
  130. package/dist/components/PasswordCheck/index.js +29 -0
  131. package/dist/components/PasswordStrengthMeter/index.d.ts +39 -0
  132. package/dist/components/PasswordStrengthMeter/index.js +98 -0
  133. package/dist/components/PieChart/Legends.d.ts +9 -0
  134. package/dist/components/PieChart/Legends.js +120 -0
  135. package/dist/components/PieChart/Tooltip.d.ts +12 -0
  136. package/dist/components/PieChart/Tooltip.js +29 -0
  137. package/dist/components/PieChart/index.d.ts +20 -0
  138. package/dist/components/PieChart/index.js +120 -0
  139. package/dist/components/PieChart/types.d.ts +7 -0
  140. package/dist/components/Popover/index.d.ts +55 -0
  141. package/dist/components/Popover/index.js +149 -0
  142. package/dist/components/Popup/animations.d.ts +11 -0
  143. package/dist/{src/components → components}/Popup/animations.js +7 -6
  144. package/dist/components/Popup/helpers.d.ts +31 -0
  145. package/dist/components/Popup/helpers.js +204 -0
  146. package/dist/components/Popup/index.d.ts +72 -0
  147. package/dist/components/Popup/index.js +385 -0
  148. package/dist/components/ProgressBar/index.d.ts +14 -0
  149. package/dist/components/ProgressBar/index.js +71 -0
  150. package/dist/components/Radio/index.d.ts +21 -0
  151. package/dist/components/Radio/index.js +202 -0
  152. package/dist/components/RadioGroup/index.d.ts +25 -0
  153. package/dist/components/RadioGroup/index.js +104 -0
  154. package/dist/components/Row/index.d.ts +22 -0
  155. package/dist/components/Row/index.js +43 -0
  156. package/dist/components/SelectInput/index.d.ts +75 -0
  157. package/dist/components/SelectInput/index.js +563 -0
  158. package/dist/components/SelectInputV2/Dropdown.d.ts +23 -0
  159. package/dist/components/SelectInputV2/Dropdown.js +669 -0
  160. package/dist/components/SelectInputV2/DropdownOption.d.ts +8 -0
  161. package/dist/components/SelectInputV2/DropdownOption.js +133 -0
  162. package/dist/components/SelectInputV2/SearchBarDropdown.d.ts +9 -0
  163. package/dist/components/SelectInputV2/SearchBarDropdown.js +123 -0
  164. package/dist/components/SelectInputV2/SelectBar.d.ts +14 -0
  165. package/dist/components/SelectInputV2/SelectBar.js +327 -0
  166. package/dist/components/SelectInputV2/SelectInputProvider.d.ts +41 -0
  167. package/dist/components/SelectInputV2/SelectInputProvider.js +203 -0
  168. package/dist/components/SelectInputV2/findOptionInOptions.d.ts +2 -0
  169. package/dist/components/SelectInputV2/findOptionInOptions.js +12 -0
  170. package/dist/components/SelectInputV2/index.d.ts +115 -0
  171. package/dist/components/SelectInputV2/index.js +146 -0
  172. package/dist/components/SelectInputV2/types.d.ts +38 -0
  173. package/dist/{src/components → components}/SelectInputV2/types.js +4 -2
  174. package/dist/components/SelectableCard/index.d.ts +25 -0
  175. package/dist/components/SelectableCard/index.js +193 -0
  176. package/dist/components/SelectableCardGroup/index.d.ts +23 -0
  177. package/dist/components/SelectableCardGroup/index.js +112 -0
  178. package/dist/components/Separator/index.d.ts +17 -0
  179. package/dist/components/Separator/index.js +76 -0
  180. package/dist/components/Skeleton/Block.d.ts +3 -0
  181. package/dist/components/Skeleton/Block.js +30 -0
  182. package/dist/components/Skeleton/Blocks.d.ts +4 -0
  183. package/dist/components/Skeleton/Blocks.js +28 -0
  184. package/dist/components/Skeleton/BoxWithIcon.d.ts +4 -0
  185. package/dist/components/Skeleton/BoxWithIcon.js +29 -0
  186. package/dist/components/Skeleton/Donut.d.ts +1 -0
  187. package/dist/components/Skeleton/Donut.js +36 -0
  188. package/dist/components/Skeleton/IconSkeleton.d.ts +5 -0
  189. package/dist/components/Skeleton/IconSkeleton.js +12 -0
  190. package/dist/components/Skeleton/Line.d.ts +5 -0
  191. package/dist/components/Skeleton/Line.js +13 -0
  192. package/dist/components/Skeleton/List.d.ts +4 -0
  193. package/dist/components/Skeleton/List.js +29 -0
  194. package/dist/components/Skeleton/Slider.d.ts +3 -0
  195. package/dist/components/Skeleton/Slider.js +26 -0
  196. package/dist/components/Skeleton/Square.d.ts +5 -0
  197. package/dist/components/Skeleton/Square.js +10 -0
  198. package/dist/components/Skeleton/index.d.ts +47 -0
  199. package/dist/components/Skeleton/index.js +86 -0
  200. package/dist/components/Snippet/index.d.ts +23 -0
  201. package/dist/components/Snippet/index.js +171 -0
  202. package/dist/components/Stack/index.d.ts +23 -0
  203. package/dist/components/Stack/index.js +36 -0
  204. package/dist/components/Status/index.d.ts +32 -0
  205. package/dist/components/Status/index.js +57 -0
  206. package/dist/components/StepList/index.d.ts +33 -0
  207. package/dist/components/StepList/index.js +69 -0
  208. package/dist/components/Stepper/index.d.ts +15 -0
  209. package/dist/components/Stepper/index.js +153 -0
  210. package/dist/components/SwitchButton/FocusOverlay.d.ts +8 -0
  211. package/dist/components/SwitchButton/FocusOverlay.js +47 -0
  212. package/dist/components/SwitchButton/index.d.ts +26 -0
  213. package/dist/components/SwitchButton/index.js +140 -0
  214. package/dist/components/Table/Body.d.ts +6 -0
  215. package/dist/components/Table/Body.js +5 -0
  216. package/dist/components/Table/Cell.d.ts +9 -0
  217. package/dist/components/Table/Cell.js +10 -0
  218. package/dist/components/Table/Header.d.ts +6 -0
  219. package/dist/components/Table/Header.js +9 -0
  220. package/dist/components/Table/HeaderCell.d.ts +14 -0
  221. package/dist/components/Table/HeaderCell.js +123 -0
  222. package/dist/components/Table/HeaderRow.d.ts +7 -0
  223. package/dist/components/Table/HeaderRow.js +25 -0
  224. package/dist/components/Table/Row.d.ts +14 -0
  225. package/dist/components/Table/Row.js +85 -0
  226. package/dist/components/Table/SelectBar.d.ts +15 -0
  227. package/dist/components/Table/SelectBar.js +35 -0
  228. package/dist/components/Table/SkeletonRows.d.ts +7 -0
  229. package/dist/components/Table/SkeletonRows.js +22 -0
  230. package/dist/components/Table/TableContext.d.ts +27 -0
  231. package/dist/components/Table/TableContext.js +103 -0
  232. package/dist/components/Table/index.d.ts +60 -0
  233. package/dist/components/Table/index.js +81 -0
  234. package/dist/components/Tabs/Tab.d.ts +20 -0
  235. package/dist/components/Tabs/Tab.js +170 -0
  236. package/dist/components/Tabs/TabMenu.d.ts +8 -0
  237. package/dist/components/Tabs/TabMenu.js +63 -0
  238. package/dist/components/Tabs/TabMenuItem.d.ts +20 -0
  239. package/dist/components/Tabs/TabMenuItem.js +39 -0
  240. package/dist/components/Tabs/TabsContext.d.ts +8 -0
  241. package/dist/components/Tabs/TabsContext.js +9 -0
  242. package/dist/components/Tabs/index.d.ts +50 -0
  243. package/dist/components/Tabs/index.js +137 -0
  244. package/dist/components/Tag/index.d.ts +26 -0
  245. package/dist/components/Tag/index.js +153 -0
  246. package/dist/components/TagInput/index.d.ts +55 -0
  247. package/dist/components/TagInput/index.js +316 -0
  248. package/dist/components/TagList/index.d.ts +37 -0
  249. package/dist/components/TagList/index.js +103 -0
  250. package/dist/components/Text/index.d.ts +40 -0
  251. package/dist/components/Text/index.js +107 -0
  252. package/dist/components/TextArea/index.d.ts +50 -0
  253. package/dist/components/TextArea/index.js +226 -0
  254. package/dist/components/TextInput/index.d.ts +75 -0
  255. package/dist/components/TextInput/index.js +472 -0
  256. package/dist/components/TextInputV2/index.d.ts +30 -0
  257. package/dist/components/TextInputV2/index.js +314 -0
  258. package/dist/components/TimeInput/index.d.ts +25 -0
  259. package/dist/components/TimeInput/index.js +199 -0
  260. package/dist/components/Toaster/index.d.ts +46 -0
  261. package/dist/components/Toaster/index.js +131 -0
  262. package/dist/components/Toaster/react-toastify.css.js +4 -0
  263. package/dist/components/Toggle/index.d.ts +34 -0
  264. package/dist/components/Toggle/index.js +196 -0
  265. package/dist/components/ToggleGroup/index.d.ts +24 -0
  266. package/dist/components/ToggleGroup/index.js +87 -0
  267. package/dist/components/Tooltip/index.d.ts +9 -0
  268. package/dist/components/Tooltip/index.js +47 -0
  269. package/dist/components/VerificationCode/index.d.ts +36 -0
  270. package/dist/components/VerificationCode/index.js +222 -0
  271. package/dist/components/index.d.ts +75 -0
  272. package/dist/helpers/isJSON.d.ts +2 -0
  273. package/dist/{src/helpers → helpers}/isJSON.js +4 -3
  274. package/dist/helpers/jestMockMatchMedia.d.ts +6 -0
  275. package/dist/helpers/keycode.d.ts +3 -0
  276. package/dist/helpers/legend.d.ts +2 -0
  277. package/dist/helpers/legend.js +14 -0
  278. package/dist/helpers/numbers.d.ts +2 -0
  279. package/dist/helpers/recursivelyGetChildrenString.d.ts +3 -0
  280. package/dist/helpers/recursivelyGetChildrenString.js +15 -0
  281. package/dist/hooks/useIsOverflowing.d.ts +5 -0
  282. package/dist/hooks/useIsOverflowing.js +23 -0
  283. package/dist/index.d.ts +4 -3693
  284. package/dist/index.js +187 -0
  285. package/dist/mocks/list.d.ts +12 -0
  286. package/dist/theme/index.d.ts +1573 -0
  287. package/dist/theme/index.js +30 -0
  288. package/dist/types.d.ts +6 -0
  289. package/dist/utils/animations.d.ts +27 -0
  290. package/dist/{src/utils → utils}/animations.js +30 -4
  291. package/dist/utils/capitalize.d.ts +2 -0
  292. package/dist/utils/capitalize.js +4 -0
  293. package/dist/utils/ids.d.ts +1 -0
  294. package/dist/utils/ids.js +6 -0
  295. package/dist/utils/index.d.ts +6 -0
  296. package/dist/utils/normalize.d.ts +2 -0
  297. package/dist/{src/utils → utils}/normalize.js +4 -3
  298. package/dist/utils/orderBy.d.ts +2 -0
  299. package/dist/utils/responsive/Breakpoint.d.ts +9 -0
  300. package/dist/utils/responsive/Breakpoint.js +13 -0
  301. package/dist/utils/responsive/index.d.ts +2 -0
  302. package/dist/utils/responsive/utilities.d.ts +3 -0
  303. package/dist/{src/utils → utils}/responsive/utilities.js +9 -6
  304. package/package.json +23 -13
  305. package/dist/react-datepicker/dist/react-datepicker.min.css.js +0 -3
  306. package/dist/react-toastify/dist/ReactToastify.min.css.js +0 -3
  307. package/dist/src/components/ActionBar/index.js +0 -40
  308. package/dist/src/components/Alert/index.js +0 -133
  309. package/dist/src/components/Avatar/index.js +0 -74
  310. package/dist/src/components/Badge/index.js +0 -116
  311. package/dist/src/components/Banner/assets/default-image-small.svg.js +0 -5
  312. package/dist/src/components/Banner/assets/default-image.svg.js +0 -5
  313. package/dist/src/components/Banner/index.js +0 -159
  314. package/dist/src/components/BarChart/Tooltip.js +0 -48
  315. package/dist/src/components/BarChart/index.js +0 -95
  316. package/dist/src/components/BarStack/index.js +0 -136
  317. package/dist/src/components/Breadcrumbs/index.js +0 -82
  318. package/dist/src/components/Bullet/index.js +0 -98
  319. package/dist/src/components/Button/index.js +0 -311
  320. package/dist/src/components/Card/index.js +0 -67
  321. package/dist/src/components/Carousel/index.js +0 -128
  322. package/dist/src/components/Checkbox/index.js +0 -316
  323. package/dist/src/components/CheckboxGroup/index.js +0 -143
  324. package/dist/src/components/CopyButton/index.js +0 -37
  325. package/dist/src/components/DateInput/index.js +0 -242
  326. package/dist/src/components/Dialog/Context.js +0 -12
  327. package/dist/src/components/Dialog/index.js +0 -88
  328. package/dist/src/components/Dialog/subComponents/Button.js +0 -21
  329. package/dist/src/components/Dialog/subComponents/Buttons.js +0 -14
  330. package/dist/src/components/Dialog/subComponents/CancelButton.js +0 -14
  331. package/dist/src/components/Dialog/subComponents/Stack.js +0 -11
  332. package/dist/src/components/Dialog/subComponents/Text.js +0 -12
  333. package/dist/src/components/EmptyState/index.js +0 -112
  334. package/dist/src/components/Expandable/index.js +0 -96
  335. package/dist/src/components/GlobalAlert/GlobalAlertLink.js +0 -38
  336. package/dist/src/components/GlobalAlert/index.js +0 -82
  337. package/dist/src/components/LineChart/CustomLegend.js +0 -138
  338. package/dist/src/components/LineChart/Tooltip.js +0 -43
  339. package/dist/src/components/LineChart/helpers.js +0 -40
  340. package/dist/src/components/LineChart/index.js +0 -131
  341. package/dist/src/components/Link/index.js +0 -147
  342. package/dist/src/components/List/Body.js +0 -16
  343. package/dist/src/components/List/Cell.js +0 -43
  344. package/dist/src/components/List/HeaderCell.js +0 -90
  345. package/dist/src/components/List/HeaderRow.js +0 -43
  346. package/dist/src/components/List/ListContext.js +0 -138
  347. package/dist/src/components/List/Row.js +0 -185
  348. package/dist/src/components/List/SelectBar.js +0 -48
  349. package/dist/src/components/List/SkeletonRows.js +0 -53
  350. package/dist/src/components/List/index.js +0 -75
  351. package/dist/src/components/Loader/index.js +0 -100
  352. package/dist/src/components/Menu/Item.js +0 -112
  353. package/dist/src/components/Menu/index.js +0 -129
  354. package/dist/src/components/MenuV2/Group.js +0 -25
  355. package/dist/src/components/MenuV2/Item.js +0 -139
  356. package/dist/src/components/MenuV2/index.js +0 -116
  357. package/dist/src/components/Meter/index.js +0 -76
  358. package/dist/src/components/Modal/Dialog.js +0 -182
  359. package/dist/src/components/Modal/index.js +0 -113
  360. package/dist/src/components/Notice/index.js +0 -34
  361. package/dist/src/components/Notification/index.js +0 -77
  362. package/dist/src/components/NumberInput/index.js +0 -299
  363. package/dist/src/components/NumberInputV2/index.js +0 -284
  364. package/dist/src/components/Pagination/index.js +0 -117
  365. package/dist/src/components/PasswordCheck/index.js +0 -41
  366. package/dist/src/components/PasswordStrengthMeter/index.js +0 -102
  367. package/dist/src/components/PieChart/Legends.js +0 -138
  368. package/dist/src/components/PieChart/Tooltip.js +0 -61
  369. package/dist/src/components/PieChart/index.js +0 -125
  370. package/dist/src/components/Popover/index.js +0 -144
  371. package/dist/src/components/Popup/helpers.js +0 -252
  372. package/dist/src/components/Popup/index.js +0 -363
  373. package/dist/src/components/ProgressBar/index.js +0 -57
  374. package/dist/src/components/Radio/index.js +0 -157
  375. package/dist/src/components/RadioGroup/index.js +0 -131
  376. package/dist/src/components/Row/index.js +0 -41
  377. package/dist/src/components/SelectInput/index.js +0 -610
  378. package/dist/src/components/SelectInputV2/Dropdown.js +0 -594
  379. package/dist/src/components/SelectInputV2/DropdownOption.js +0 -130
  380. package/dist/src/components/SelectInputV2/SearchBarDropdown.js +0 -128
  381. package/dist/src/components/SelectInputV2/SelectBar.js +0 -282
  382. package/dist/src/components/SelectInputV2/SelectInputProvider.js +0 -169
  383. package/dist/src/components/SelectInputV2/findOptionInOptions.js +0 -11
  384. package/dist/src/components/SelectInputV2/index.js +0 -137
  385. package/dist/src/components/SelectableCard/index.js +0 -175
  386. package/dist/src/components/SelectableCardGroup/index.js +0 -141
  387. package/dist/src/components/Separator/index.js +0 -73
  388. package/dist/src/components/Skeleton/Block.js +0 -35
  389. package/dist/src/components/Skeleton/Blocks.js +0 -34
  390. package/dist/src/components/Skeleton/BoxWithIcon.js +0 -32
  391. package/dist/src/components/Skeleton/Donut.js +0 -55
  392. package/dist/src/components/Skeleton/IconSkeleton.js +0 -19
  393. package/dist/src/components/Skeleton/Line.js +0 -13
  394. package/dist/src/components/Skeleton/List.js +0 -51
  395. package/dist/src/components/Skeleton/Slider.js +0 -36
  396. package/dist/src/components/Skeleton/Square.js +0 -9
  397. package/dist/src/components/Skeleton/index.js +0 -82
  398. package/dist/src/components/Snippet/index.js +0 -200
  399. package/dist/src/components/Stack/index.js +0 -29
  400. package/dist/src/components/Status/index.js +0 -74
  401. package/dist/src/components/StepList/index.js +0 -69
  402. package/dist/src/components/Stepper/index.js +0 -150
  403. package/dist/src/components/SwitchButton/FocusOverlay.js +0 -37
  404. package/dist/src/components/SwitchButton/index.js +0 -108
  405. package/dist/src/components/Table/Body.js +0 -9
  406. package/dist/src/components/Table/Cell.js +0 -21
  407. package/dist/src/components/Table/Header.js +0 -15
  408. package/dist/src/components/Table/HeaderCell.js +0 -103
  409. package/dist/src/components/Table/HeaderRow.js +0 -32
  410. package/dist/src/components/Table/Row.js +0 -89
  411. package/dist/src/components/Table/SelectBar.js +0 -48
  412. package/dist/src/components/Table/SkeletonRows.js +0 -51
  413. package/dist/src/components/Table/TableContext.js +0 -90
  414. package/dist/src/components/Table/index.js +0 -82
  415. package/dist/src/components/Tabs/Tab.js +0 -138
  416. package/dist/src/components/Tabs/TabMenu.js +0 -59
  417. package/dist/src/components/Tabs/TabMenuItem.js +0 -36
  418. package/dist/src/components/Tabs/TabsContext.js +0 -6
  419. package/dist/src/components/Tabs/index.js +0 -117
  420. package/dist/src/components/Tag/index.js +0 -169
  421. package/dist/src/components/TagInput/index.js +0 -309
  422. package/dist/src/components/TagList/index.js +0 -106
  423. package/dist/src/components/Text/index.js +0 -107
  424. package/dist/src/components/TextArea/index.js +0 -210
  425. package/dist/src/components/TextInput/index.js +0 -451
  426. package/dist/src/components/TextInputV2/index.js +0 -289
  427. package/dist/src/components/TimeInput/index.js +0 -37
  428. package/dist/src/components/Toaster/index.js +0 -131
  429. package/dist/src/components/Toggle/index.js +0 -160
  430. package/dist/src/components/ToggleGroup/index.js +0 -122
  431. package/dist/src/components/Tooltip/index.js +0 -55
  432. package/dist/src/components/VerificationCode/index.js +0 -222
  433. package/dist/src/helpers/legend.js +0 -13
  434. package/dist/src/helpers/recursivelyGetChildrenString.js +0 -11
  435. package/dist/src/hooks/useIsOverflowing.js +0 -34
  436. package/dist/src/index.js +0 -77
  437. package/dist/src/theme/index.js +0 -29
  438. package/dist/src/utils/capitalize.js +0 -3
  439. package/dist/src/utils/ids.js +0 -7
  440. package/dist/src/utils/responsive/Breakpoint.js +0 -12
@@ -1,182 +0,0 @@
1
- import _styled from '@emotion/styled/base';
2
- import { useRef, useEffect, useCallback } from 'react';
3
- import { createPortal } from 'react-dom';
4
- import { MODAL_WIDTH, MODAL_PLACEMENT } from './constants.js';
5
- import { jsx } from '@emotion/react/jsx-runtime';
6
-
7
- const StyledBackdrop = /*#__PURE__*/_styled("div", {
8
- target: "e1cqen9h1"
9
- })("position:fixed;top:0;right:0;height:0;width:0;overflow:hidden;background-color:", ({
10
- theme
11
- }) => theme.colors.overlay, ";z-index:1;&[data-open='true']{padding:", ({
12
- theme
13
- }) => theme.space['2'], ";overflow:auto;display:flex;bottom:0;left:0;height:100%;width:100%;}");
14
- const StyledDialog = /*#__PURE__*/_styled("dialog", {
15
- target: "e1cqen9h0"
16
- })("background-color:", ({
17
- theme
18
- }) => theme.colors.neutral.backgroundWeakElevated, ";position:relative;border-radius:", ({
19
- theme
20
- }) => theme.radii.default, ";border:0;padding:", ({
21
- theme
22
- }) => theme.space['3'], ";width:", MODAL_WIDTH.medium, "px;box-shadow:", ({
23
- theme
24
- }) => theme.shadows.modal, ";", /*#__PURE__*/Object.entries(MODAL_WIDTH).map(([size, value]) => `
25
- &[data-size="${size}"] {
26
- width: ${value}px;
27
- }
28
- `), " ", /*#__PURE__*/Object.entries(MODAL_PLACEMENT).map(([placement, value]) => `
29
- &[data-placement="${placement}"] {
30
- ${value}
31
- }
32
- `), ";");
33
- const Dialog = ({
34
- children,
35
- open,
36
- placement,
37
- onClose,
38
- hideOnClickOutside,
39
- size,
40
- id,
41
- ariaLabel,
42
- className,
43
- 'data-testid': dataTestId,
44
- preventBodyScroll,
45
- hideOnEsc,
46
- backdropClassName,
47
- dialogCss,
48
- backdropCss
49
- }) => {
50
- const containerRef = useRef(document.createElement('div'));
51
- const dialogRef = useRef(null);
52
- const onCloseRef = useRef(onClose);
53
-
54
- // Portal to put the modal in
55
- useEffect(() => {
56
- const element = containerRef.current;
57
- if (open) {
58
- document.body.appendChild(element);
59
- }
60
- return () => {
61
- if (document.body.contains(element)) {
62
- document.body.removeChild(element);
63
- }
64
- };
65
- }, [open]);
66
-
67
- // Save the reassignment of eventHandler in the useEffect below
68
- useEffect(() => {
69
- onCloseRef.current = onClose;
70
- }, [onClose]);
71
-
72
- // On open focus the modal
73
- useEffect(() => {
74
- if (open) {
75
- dialogRef.current?.focus();
76
- }
77
- }, [open]);
78
-
79
- // Handle body scroll
80
- useEffect(() => {
81
- const previousOverflow = document.body.style.overflow;
82
- if (open && preventBodyScroll) {
83
- document.body.style.overflow = 'hidden';
84
- }
85
- return () => {
86
- document.body.style.overflow = previousOverflow;
87
- };
88
- }, [preventBodyScroll, open]);
89
-
90
- // Stop focus to prevent unexpected body loose focus
91
- const stopFocus = useCallback(event => {
92
- event.stopPropagation();
93
- }, []);
94
-
95
- // Stop click to prevent unexpected dialog close
96
- const stopClick = useCallback(event => {
97
- event.stopPropagation();
98
- }, []);
99
-
100
- // handle key up : used when having inputs in modals - useful for hideOnEsc
101
- const handleKeyUp = useCallback(event => {
102
- event.stopPropagation();
103
- if (event.key === 'Escape' && hideOnEsc) {
104
- event.preventDefault();
105
- onCloseRef.current();
106
- }
107
- }, [hideOnEsc]);
108
- const handleClose = useCallback(event => {
109
- event.stopPropagation();
110
- if (hideOnClickOutside) {
111
- onCloseRef.current();
112
- } else {
113
- // Because overlay is not focusable we can't handle hideOnEsc properly
114
- dialogRef.current?.focus();
115
- }
116
- }, [hideOnClickOutside]);
117
-
118
- // Enable focus trap inside the modal
119
- const handleFocusTrap = useCallback(event => {
120
- event.stopPropagation();
121
- if (event.key === 'Escape') {
122
- event.preventDefault();
123
- return;
124
- }
125
- const isTabPressed = event.key === 'Tab';
126
- if (!isTabPressed) {
127
- return;
128
- }
129
- const focusableEls = dialogRef.current?.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled])') ?? [];
130
-
131
- // Handle case when no interactive element are within the modal (including close icon)
132
- if (focusableEls.length === 0) {
133
- event.preventDefault();
134
- }
135
- const firstFocusableEl = focusableEls[0];
136
- const lastFocusableEl = focusableEls[focusableEls.length - 1];
137
- if (event.shiftKey) {
138
- if (document.activeElement === firstFocusableEl || document.activeElement === dialogRef.current) {
139
- lastFocusableEl.focus();
140
- event.preventDefault();
141
- }
142
- } else if (document.activeElement === lastFocusableEl || document.activeElement === dialogRef.current) {
143
- firstFocusableEl.focus();
144
- event.preventDefault();
145
- }
146
- }, []);
147
-
148
- // Prevent default behaviour on Escape
149
- const stopCancel = event => {
150
- event.preventDefault();
151
- event.stopPropagation();
152
- };
153
- return open ? /*#__PURE__*/createPortal(jsx(StyledBackdrop, {
154
- "data-open": open,
155
- onClick: handleClose,
156
- className: backdropClassName,
157
- css: backdropCss,
158
- "data-testid": dataTestId ? `${dataTestId}-backdrop` : undefined,
159
- onFocus: stopFocus,
160
- children: jsx(StyledDialog, {
161
- css: dialogCss,
162
- onKeyUp: handleKeyUp,
163
- onKeyDown: handleFocusTrap,
164
- className: className,
165
- id: id,
166
- "data-testid": dataTestId,
167
- "aria-label": ariaLabel,
168
- "data-placement": placement,
169
- "data-size": size,
170
- open: open,
171
- onClick: stopClick,
172
- onCancel: stopCancel,
173
- onClose: stopCancel,
174
- "aria-modal": true,
175
- ref: dialogRef,
176
- tabIndex: 0,
177
- children: open ? children : null
178
- })
179
- }), containerRef.current) : null;
180
- };
181
-
182
- export { Dialog };
@@ -1,113 +0,0 @@
1
- import _styled from '@emotion/styled/base';
2
- import { useState, useId, useCallback } from 'react';
3
- import { Button } from '../Button/index.js';
4
- import { Dialog } from './Dialog.js';
5
- import { Disclosure } from './Disclosure.js';
6
- import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
7
-
8
- const StyledContainer = /*#__PURE__*/_styled("div", {
9
- target: "ebywm9u0"
10
- })("position:absolute;top:", ({
11
- theme
12
- }) => theme.space['2'], ";right:", ({
13
- theme
14
- }) => theme.space['2'], ";");
15
-
16
- /**
17
- * Modal is a component that allows you to display content on top of other content.
18
- * It is often used to display a dialog with additional information or to ask for a confirmation.
19
- */
20
- const Modal = ({
21
- ariaLabel = 'modal',
22
- id,
23
- children,
24
- disclosure,
25
- hideOnClickOutside = true,
26
- hideOnEsc = true,
27
- isClosable = true,
28
- onClose,
29
- onBeforeClose,
30
- open = false,
31
- opened = false,
32
- placement = 'center',
33
- preventBodyScroll = true,
34
- size,
35
- className,
36
- 'data-testid': dataTestId,
37
- backdropClassName,
38
- width = 'small',
39
- customDialogStyles,
40
- customDialogBackdropStyles
41
- }) => {
42
- // Used for disclosure usage only
43
- const [visible, setVisible] = useState(false);
44
- const controlId = useId();
45
- const handleOpen = useCallback(() => {
46
- setVisible(true);
47
- }, []);
48
- const handleClose = useCallback(() => {
49
- if (onClose) {
50
- onClose();
51
- } else {
52
- const promise = onBeforeClose?.();
53
- if (promise && 'catch' in promise) {
54
- promise.catch(() => null);
55
- }
56
- setVisible(false);
57
- }
58
- }, [onBeforeClose, onClose]);
59
- const handleToggle = useCallback(() => {
60
- setVisible(current => !current);
61
- }, []);
62
- const finalId = id ?? controlId;
63
- const finalSize = size ?? width;
64
- return jsxs(Fragment, {
65
- children: [disclosure ? jsx(Disclosure, {
66
- id: finalId,
67
- handleOpen: handleOpen,
68
- disclosure: disclosure,
69
- handleClose: handleClose,
70
- visible: visible,
71
- toggle: handleToggle
72
- }) : null, jsx(Dialog, {
73
- open: visible || open || opened,
74
- placement: placement,
75
- size: finalSize,
76
- ariaLabel: ariaLabel,
77
- hideOnClickOutside: hideOnClickOutside,
78
- hideOnEsc: hideOnEsc,
79
- preventBodyScroll: preventBodyScroll,
80
- onClose: handleClose,
81
- className: className,
82
- backdropClassName: backdropClassName,
83
- "data-testid": dataTestId,
84
- id: finalId,
85
- dialogCss: customDialogStyles,
86
- backdropCss: customDialogBackdropStyles,
87
- children: jsxs(Fragment, {
88
- children: [typeof children === 'function' ? children({
89
- visible,
90
- onClose: handleClose,
91
- onOpen: handleOpen,
92
- toggle: handleToggle,
93
- modalId: finalId,
94
- hide: handleClose,
95
- close: handleClose,
96
- show: handleOpen
97
- }) : children, jsx(StyledContainer, {
98
- children: isClosable ? jsx(Button, {
99
- "data-testid": dataTestId ? `${dataTestId}-close-button` : undefined,
100
- onClick: handleClose,
101
- variant: "ghost",
102
- size: "small",
103
- icon: "close",
104
- sentiment: "neutral",
105
- "aria-label": "close"
106
- }) : null
107
- })]
108
- })
109
- })]
110
- });
111
- };
112
-
113
- export { Modal };
@@ -1,34 +0,0 @@
1
- import _styled from '@emotion/styled/base';
2
- import { Icon } from '@ultraviolet/icons';
3
- import { Text } from '../Text/index.js';
4
- import { jsxs, jsx } from '@emotion/react/jsx-runtime';
5
-
6
- const StyledSpan = /*#__PURE__*/_styled(Text, {
7
- target: "e19pqvs30"
8
- })("display:flex;align-items:center;gap:", ({
9
- theme
10
- }) => theme.space['1'], ";");
11
-
12
- /**
13
- * A Notice is used to display a short message to the user.
14
- */
15
- const Notice = ({
16
- children,
17
- className,
18
- 'data-testid': dataTestId
19
- }) => jsxs(StyledSpan, {
20
- as: "span",
21
- variant: "caption",
22
- sentiment: "neutral",
23
- prominence: "weak",
24
- "data-testid": dataTestId,
25
- className: className,
26
- children: [jsx(Icon, {
27
- name: "information-outline",
28
- size: 16,
29
- color: "neutral",
30
- prominence: "weak"
31
- }), children]
32
- });
33
-
34
- export { Notice };
@@ -1,77 +0,0 @@
1
- import { useTheme, Global, ClassNames, css } from '@emotion/react';
2
- import { toast, ToastContainer, Slide } from 'react-toastify';
3
- import css_248z from '../../../react-toastify/dist/ReactToastify.min.css.js';
4
- import { Button } from '../Button/index.js';
5
- import { Stack } from '../Stack/index.js';
6
- import { Text } from '../Text/index.js';
7
- import { jsxs, jsx, Fragment } from '@emotion/react/jsx-runtime';
8
-
9
- const PREFIX = '.Toastify';
10
- const styles = {
11
- toast: ({
12
- theme
13
- }) => /*#__PURE__*/css("border-radius:", theme.radii.default, ";&", PREFIX, "__toast{background-color:", theme.colors.neutral.background, ";color:", theme.colors.neutral.text, ";padding:", theme.space['2'], ";box-shadow:", theme.shadows.defaultShadow, ";}&", PREFIX, "__toast-container{width:312px;}", PREFIX, "__toast-body{margin:0;padding:0;display:none;}")
14
- };
15
- const closeButton = props => jsx(Button, {
16
- "aria-label": "close",
17
- icon: "close",
18
- sentiment: "neutral",
19
- variant: "ghost",
20
- onClick: props.closeToast,
21
- size: "xsmall"
22
- });
23
- const notification = (children, title, icon, isClosable, containerId, options) => toast('', {
24
- ...options,
25
- closeButton: props => jsxs(Stack, {
26
- direction: "row",
27
- gap: 2,
28
- children: [jsx("div", {
29
- children: icon
30
- }), jsxs(Stack, {
31
- direction: "column",
32
- children: [jsx(Text, {
33
- as: "h3",
34
- variant: "bodySmallStronger",
35
- children: title
36
- }), typeof children === 'function' ? children(props) : children]
37
- }), isClosable ? closeButton(props) : null]
38
- }),
39
- containerId: containerId ?? 'notification'
40
- });
41
- const NotificationContainer = ({
42
- newestOnTop,
43
- limit,
44
- autoClose = false,
45
- position = 'top-right',
46
- 'data-testid': dataTestId,
47
- className,
48
- containerId = 'notification'
49
- }) => {
50
- const theme = useTheme();
51
- return jsxs(Fragment, {
52
- children: [jsx(Global, {
53
- styles: css_248z
54
- }), jsx(ClassNames, {
55
- children: ({
56
- css: localCss
57
- }) => jsx(ToastContainer, {
58
- "data-testid": dataTestId,
59
- toastClassName: localCss(styles.toast({
60
- theme
61
- })),
62
- icon: false,
63
- autoClose: autoClose,
64
- newestOnTop: newestOnTop,
65
- limit: limit,
66
- position: position,
67
- hideProgressBar: true,
68
- draggable: false,
69
- transition: Slide,
70
- className: className,
71
- containerId: containerId
72
- })
73
- })]
74
- });
75
- };
76
-
77
- export { NotificationContainer, notification };
@@ -1,299 +0,0 @@
1
- import _styled from '@emotion/styled/base';
2
- import { Icon } from '@ultraviolet/icons';
3
- import { useRef, useId, useState, useMemo } from 'react';
4
- import { Button } from '../Button/index.js';
5
- import { Stack } from '../Stack/index.js';
6
- import { Text } from '../Text/index.js';
7
- import { Tooltip } from '../Tooltip/index.js';
8
- import { getMinusRoundedValue, getPlusRoundedValue, roundStep, bounded } from './helpers.js';
9
- import { jsxs, jsx } from '@emotion/react/jsx-runtime';
10
-
11
- const containerSizes = {
12
- large: 48,
13
- medium: 40,
14
- small: 32
15
- };
16
- const iconSizes = {
17
- large: 26,
18
- medium: 24,
19
- small: 22
20
- };
21
- const BASE_INPUT_WIDTH = 34;
22
- const StyledSelectButton = /*#__PURE__*/_styled(Button, {
23
- target: "exvap484"
24
- })("margin:0 ", ({
25
- theme
26
- }) => theme.space['1'], ";width:32px;height:32px;");
27
- const StyledCenterBox = /*#__PURE__*/_styled('div', {
28
- shouldForwardProp: prop => !['size'].includes(prop),
29
- target: "exvap483"
30
- })("display:flex;flex:1;flex-direction:row;height:", ({
31
- size
32
- }) => size === 'small' ? '24px' : '32px', ";align-items:center;outline:none;justify-content:center;border-radius:", ({
33
- theme
34
- }) => theme.radii.default, ";border:1px solid transparent;max-width:100%;");
35
- const StyledInput = /*#__PURE__*/_styled("input", {
36
- target: "exvap482"
37
- })("color:", ({
38
- theme
39
- }) => theme.colors.neutral.text, ";background-color:transparent;font-size:", ({
40
- theme
41
- }) => theme.typography.bodyStrong.fontSize, ";border:none;outline:none;position:relative;margin-right:", ({
42
- theme
43
- }) => theme.space['0.5'], ";max-width:100%;font-weight:", ({
44
- theme
45
- }) => theme.typography.bodyStrong.weight, ";text-align:center;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}::placeholder{color:", ({
46
- theme
47
- }) => theme.colors.neutral.textWeak, ";}-moz-appearance:textfield;&[disabled]{color:", ({
48
- theme
49
- }) => theme.colors.neutral.textDisabled, ";cursor:not-allowed;}");
50
- const StyledText = /*#__PURE__*/_styled('span', {
51
- shouldForwardProp: prop => !['disabled'].includes(prop),
52
- target: "exvap481"
53
- })("color:", ({
54
- theme,
55
- disabled
56
- }) => disabled ? theme.colors.neutral.textDisabled : theme.colors.neutral.text, ";user-select:none;margin-right:", ({
57
- theme
58
- }) => theme.space['1'], ";");
59
- const StyledContainer = /*#__PURE__*/_styled('div', {
60
- shouldForwardProp: prop => !['size'].includes(prop),
61
- target: "exvap480"
62
- })("background-color:", ({
63
- theme
64
- }) => theme.colors.neutral.background, ";display:flex;flex-direction:row;align-items:center;align-self:stretch;font-weight:500;height:", ({
65
- size
66
- }) => containerSizes[size], "px;border:1px solid ", ({
67
- theme
68
- }) => theme.colors.neutral.border, ";border-radius:", ({
69
- theme
70
- }) => theme.radii.default, ";&[data-error='true']{border:1px solid ", ({
71
- theme
72
- }) => theme.colors.danger.border, ";}&[aria-disabled='true']{background:", ({
73
- theme
74
- }) => theme.colors.neutral.backgroundDisabled, ";cursor:not-allowed;}&:not([aria-disabled='true']){", StyledCenterBox, ":hover,", StyledCenterBox, ":focus{border:1px solid ", ({
75
- theme
76
- }) => theme.colors.primary.borderHover, ";}", StyledCenterBox, ":focus-within{box-shadow:", ({
77
- theme
78
- }) => theme.shadows.focusPrimary, ";border:1px solid ", ({
79
- theme
80
- }) => theme.colors.primary.borderHover, ";}}");
81
- /**
82
- * @deprecated This component is deprecated. Please use `NumberInputV2` instead.
83
- */
84
- const NumberInput = ({
85
- disabled = false,
86
- maxValue,
87
- minValue = 0,
88
- name = 'numberinput',
89
- onChange,
90
- onFocus,
91
- onBlur,
92
- onMaxCrossed,
93
- onMinCrossed,
94
- size = 'large',
95
- step = 1,
96
- text,
97
- defaultValue,
98
- value,
99
- disabledTooltip,
100
- className,
101
- label,
102
- id,
103
- placeholder,
104
- error,
105
- 'aria-label': ariaLabel,
106
- 'aria-describedby': ariaDescribedBy,
107
- 'data-testid': dataTestId
108
- }) => {
109
- const inputRef = useRef();
110
- const uniqueId = useId();
111
-
112
- // local state used if component is not controlled (no value prop provided)
113
- const [inputValue, setInputValue] = useState(() => {
114
- if (defaultValue && minValue && defaultValue < minValue) {
115
- return minValue;
116
- }
117
- if (defaultValue && maxValue && defaultValue > maxValue) {
118
- return maxValue;
119
- }
120
- return defaultValue;
121
- });
122
- const currentValue = value !== undefined && value !== null ? value : inputValue;
123
- const setValue = (newValue,
124
- /**
125
- * If true, will check if newValue is between minValue and maxValue and set it to minValue or maxValue if it's not.
126
- */
127
- hasMinMaxVerification = true) => {
128
- let nextValue = newValue;
129
- if (value === undefined && hasMinMaxVerification) {
130
- if (newValue !== undefined && newValue < minValue) {
131
- nextValue = minValue;
132
- }
133
- if (newValue !== undefined && maxValue !== undefined && newValue > maxValue) {
134
- nextValue = maxValue;
135
- }
136
- }
137
- setInputValue(nextValue);
138
- onChange?.(nextValue);
139
- };
140
- const offsetFn = direction => () => {
141
- const localValue = currentValue ?? 0;
142
- const newValue = localValue % step === 0 ? localValue + step * direction : localValue;
143
- const roundedValue = roundStep(newValue, step, direction);
144
- setValue(roundedValue);
145
- };
146
- const handleChange = event => {
147
- setValue(event.currentTarget.value ? Number(event.currentTarget.value) : undefined, false);
148
- };
149
- const handleOnBlur = event => {
150
- if (currentValue) {
151
- const boundedValue = bounded(currentValue, minValue ?? currentValue, maxValue ?? currentValue);
152
- if (maxValue && currentValue > maxValue) onMaxCrossed?.();
153
- if (minValue && currentValue < minValue) onMinCrossed?.();
154
- setValue(boundedValue);
155
- onBlur?.(event);
156
- }
157
- };
158
- const onKeyDown = event => {
159
- if (event.key === 'ArrowUp') {
160
- event.stopPropagation();
161
- event.preventDefault();
162
- const direction = 1;
163
- const localValue = currentValue ?? 0;
164
- const newValue = localValue % step === 0 ? localValue + step * direction : localValue;
165
- const roundedValue = roundStep(newValue, step, direction);
166
- if (maxValue === undefined) {
167
- setValue(roundedValue);
168
- return;
169
- }
170
- setValue(Math.min(roundedValue, maxValue));
171
- }
172
- if (event.key === 'ArrowDown') {
173
- event.stopPropagation();
174
- event.preventDefault();
175
- const direction = -1;
176
- const localValue = currentValue ?? 0;
177
- const newValue = localValue % step === 0 ? localValue + step * direction : localValue;
178
- const roundedValue = roundStep(newValue, step, direction);
179
- setValue(Math.max(roundedValue, minValue));
180
- }
181
- };
182
- const isMinusDisabled = useMemo(() => {
183
- if (disabled) return true;
184
- if (currentValue === undefined) return false;
185
- if (getMinusRoundedValue(currentValue, step) < minValue) {
186
- return true;
187
- }
188
- return disabled;
189
- }, [currentValue, disabled, minValue, step]);
190
- const isPlusDisabled = useMemo(() => {
191
- if (disabled) return true;
192
- if (currentValue === undefined) return false;
193
- if (maxValue && getPlusRoundedValue(currentValue, step) > maxValue) {
194
- return true;
195
- }
196
- return disabled;
197
- }, [currentValue, disabled, maxValue, step]);
198
- const inputWidth = useMemo(() => {
199
- if (placeholder && currentValue === undefined) {
200
- return placeholder.length * 12;
201
- }
202
- if (currentValue !== undefined) {
203
- return currentValue.toString().length * 16;
204
- }
205
- return BASE_INPUT_WIDTH;
206
- }, [currentValue, placeholder]);
207
- return jsxs(Stack, {
208
- gap: 1,
209
- children: [label ? jsx(Text, {
210
- variant: "bodyStrong",
211
- as: "label",
212
- htmlFor: id || uniqueId,
213
- children: label
214
- }) : null, jsxs(Stack, {
215
- gap: 0.5,
216
- children: [jsxs(StyledContainer, {
217
- "aria-disabled": disabled,
218
- "data-error": !!error,
219
- size: size,
220
- className: className,
221
- "data-testid": dataTestId,
222
- children: [jsx(Tooltip, {
223
- text: isMinusDisabled && disabledTooltip,
224
- children: jsx(StyledSelectButton, {
225
- onClick: offsetFn(-1),
226
- disabled: isMinusDisabled,
227
- "aria-label": "Minus",
228
- type: "button",
229
- variant: "ghost",
230
- sentiment: "primary",
231
- size: "small",
232
- children: jsx(Icon, {
233
- name: "minus",
234
- size: iconSizes[size],
235
- color: "primary",
236
- disabled: isMinusDisabled
237
- })
238
- })
239
- }), jsxs(StyledCenterBox, {
240
- size: size,
241
- onClick: () => {
242
- if (inputRef?.current) {
243
- inputRef.current.focus();
244
- }
245
- },
246
- "aria-live": "assertive",
247
- role: "status",
248
- children: [jsx(StyledInput, {
249
- disabled: disabled,
250
- name: name,
251
- onBlur: handleOnBlur,
252
- onChange: handleChange,
253
- onFocus: onFocus,
254
- onKeyDown: onKeyDown,
255
- ref: inputRef,
256
- style: {
257
- width: inputWidth
258
- },
259
- value: currentValue !== undefined ? currentValue.toString() : '' // A dom element can only have string attributes.
260
- ,
261
- type: "number",
262
- id: id || uniqueId,
263
- "aria-label": !label && !ariaLabel ? 'Number Input' : ariaLabel,
264
- "aria-describedby": ariaDescribedBy,
265
- placeholder: placeholder
266
- }), currentValue !== undefined ? jsx(StyledText, {
267
- disabled: disabled,
268
- children: text
269
- }) : null]
270
- }), jsx(Tooltip, {
271
- text: isPlusDisabled && disabledTooltip,
272
- children: jsx(StyledSelectButton, {
273
- onClick: offsetFn(1),
274
- disabled: isPlusDisabled,
275
- "aria-label": "Plus",
276
- type: "button",
277
- variant: "ghost",
278
- sentiment: "primary",
279
- size: "small",
280
- children: jsx(Icon, {
281
- name: "plus",
282
- size: iconSizes[size],
283
- color: "primary",
284
- disabled: isPlusDisabled
285
- })
286
- })
287
- })]
288
- }), typeof error === 'string' ? jsx(Text, {
289
- as: "span",
290
- variant: "bodySmall",
291
- sentiment: "danger",
292
- prominence: "weak",
293
- children: error
294
- }) : null]
295
- })]
296
- });
297
- };
298
-
299
- export { NumberInput };