@majapisoftwares/ui 4.0.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 (436) hide show
  1. package/base.css +359 -0
  2. package/bootstrap/AppProps.d.ts +10 -0
  3. package/bootstrap/AppProps.js +1 -0
  4. package/bootstrap/index.d.ts +1 -0
  5. package/bootstrap/index.js +1 -0
  6. package/bootstrap/modeScript.d.ts +2 -0
  7. package/bootstrap/modeScript.js +35 -0
  8. package/bootstrap/nprogress.d.ts +1 -0
  9. package/bootstrap/nprogress.js +19 -0
  10. package/bootstrap/scrolledScript.d.ts +2 -0
  11. package/bootstrap/scrolledScript.js +27 -0
  12. package/bootstrap/setupFocusManager.d.ts +1 -0
  13. package/bootstrap/setupFocusManager.js +13 -0
  14. package/bootstrap/suppressConsoleLog.d.ts +1 -0
  15. package/bootstrap/suppressConsoleLog.js +8 -0
  16. package/components/Accordion/Accordion.d.ts +19 -0
  17. package/components/Accordion/Accordion.jsx +27 -0
  18. package/components/Accordion/index.d.ts +3 -0
  19. package/components/Accordion/index.jsx +3 -0
  20. package/components/Alert/Alert.d.ts +31 -0
  21. package/components/Alert/Alert.jsx +53 -0
  22. package/components/Alert/index.d.ts +3 -0
  23. package/components/Alert/index.jsx +3 -0
  24. package/components/Aurora/Aurora.d.ts +10 -0
  25. package/components/Aurora/Aurora.jsx +189 -0
  26. package/components/Aurora/index.d.ts +3 -0
  27. package/components/Aurora/index.jsx +3 -0
  28. package/components/Autocomplete/Autocomplete.d.ts +7 -0
  29. package/components/Autocomplete/Autocomplete.jsx +23 -0
  30. package/components/Autocomplete/UnstyledAutocomplete.d.ts +36 -0
  31. package/components/Autocomplete/UnstyledAutocomplete.jsx +73 -0
  32. package/components/Autocomplete/index.d.ts +5 -0
  33. package/components/Autocomplete/index.jsx +5 -0
  34. package/components/BackgroundEffects/BottomBlurryPoint.d.ts +3 -0
  35. package/components/BackgroundEffects/BottomBlurryPoint.jsx +14 -0
  36. package/components/BackgroundEffects/TopBlurryPoint.d.ts +3 -0
  37. package/components/BackgroundEffects/TopBlurryPoint.jsx +14 -0
  38. package/components/Badge/Badge.d.ts +42 -0
  39. package/components/Badge/Badge.jsx +50 -0
  40. package/components/Badge/index.d.ts +3 -0
  41. package/components/Badge/index.jsx +3 -0
  42. package/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
  43. package/components/Breadcrumbs/Breadcrumbs.jsx +42 -0
  44. package/components/Breadcrumbs/index.d.ts +3 -0
  45. package/components/Breadcrumbs/index.jsx +3 -0
  46. package/components/Button/Button.d.ts +111 -0
  47. package/components/Button/Button.jsx +129 -0
  48. package/components/Button/UnstyledButton.d.ts +10 -0
  49. package/components/Button/UnstyledButton.jsx +13 -0
  50. package/components/Button/index.d.ts +3 -0
  51. package/components/Button/index.jsx +3 -0
  52. package/components/Carousel/Carousel.d.ts +19 -0
  53. package/components/Carousel/Carousel.jsx +55 -0
  54. package/components/Carousel/index.d.ts +3 -0
  55. package/components/Carousel/index.jsx +3 -0
  56. package/components/Checkbox/Checkbox.d.ts +14 -0
  57. package/components/Checkbox/Checkbox.jsx +45 -0
  58. package/components/Checkbox/index.d.ts +3 -0
  59. package/components/Checkbox/index.js +3 -0
  60. package/components/Code/Code.d.ts +12 -0
  61. package/components/Code/Code.jsx +25 -0
  62. package/components/Code/Json.d.ts +5 -0
  63. package/components/Code/Json.jsx +7 -0
  64. package/components/Code/index.d.ts +4 -0
  65. package/components/Code/index.jsx +4 -0
  66. package/components/ConfirmationButton/ConfirmationButton.d.ts +17 -0
  67. package/components/ConfirmationButton/ConfirmationButton.jsx +13 -0
  68. package/components/ConfirmationButton/index.d.ts +3 -0
  69. package/components/ConfirmationButton/index.jsx +3 -0
  70. package/components/ContextMenu/ContextMenu.d.ts +28 -0
  71. package/components/ContextMenu/ContextMenu.jsx +70 -0
  72. package/components/ContextMenu/index.d.ts +3 -0
  73. package/components/ContextMenu/index.jsx +3 -0
  74. package/components/CopyButton/CopyButton.d.ts +7 -0
  75. package/components/CopyButton/CopyButton.jsx +29 -0
  76. package/components/CopyButton/index.d.ts +3 -0
  77. package/components/CopyButton/index.jsx +3 -0
  78. package/components/DateInput/DateInput.d.ts +6 -0
  79. package/components/DateInput/DateInput.jsx +19 -0
  80. package/components/DateInput/DateTimeInput.d.ts +3 -0
  81. package/components/DateInput/DateTimeInput.jsx +8 -0
  82. package/components/DateInput/index.d.ts +4 -0
  83. package/components/DateInput/index.jsx +4 -0
  84. package/components/DateInput/useRefValue.d.ts +5 -0
  85. package/components/DateInput/useRefValue.js +48 -0
  86. package/components/DatePicker/DatePicker.d.ts +19 -0
  87. package/components/DatePicker/DatePicker.jsx +55 -0
  88. package/components/DatePicker/index.d.ts +3 -0
  89. package/components/DatePicker/index.jsx +3 -0
  90. package/components/DateRangePicker/DateRangePicker.d.ts +16 -0
  91. package/components/DateRangePicker/DateRangePicker.jsx +56 -0
  92. package/components/DateRangePicker/index.d.ts +3 -0
  93. package/components/DateRangePicker/index.jsx +3 -0
  94. package/components/Dialog/Dialog.d.ts +25 -0
  95. package/components/Dialog/Dialog.jsx +35 -0
  96. package/components/Dialog/Dialogs.d.ts +1 -0
  97. package/components/Dialog/Dialogs.jsx +21 -0
  98. package/components/Dialog/dialogs.state.d.ts +21 -0
  99. package/components/Dialog/dialogs.state.js +40 -0
  100. package/components/Dialog/index.d.ts +6 -0
  101. package/components/Dialog/index.jsx +7 -0
  102. package/components/Drawer/Drawer.d.ts +15 -0
  103. package/components/Drawer/Drawer.jsx +72 -0
  104. package/components/Drawer/index.d.ts +3 -0
  105. package/components/Drawer/index.jsx +3 -0
  106. package/components/DropdownMenu/DropdownMenu.d.ts +33 -0
  107. package/components/DropdownMenu/DropdownMenu.jsx +74 -0
  108. package/components/DropdownMenu/index.d.ts +3 -0
  109. package/components/DropdownMenu/index.jsx +3 -0
  110. package/components/ErrorBoundary/ErrorBoundary.d.ts +18 -0
  111. package/components/ErrorBoundary/ErrorBoundary.jsx +32 -0
  112. package/components/ErrorBoundary/index.d.ts +3 -0
  113. package/components/ErrorBoundary/index.jsx +3 -0
  114. package/components/ErrorPage/Error404Page.d.ts +1 -0
  115. package/components/ErrorPage/Error404Page.jsx +4 -0
  116. package/components/ErrorPage/Error500Page.d.ts +1 -0
  117. package/components/ErrorPage/Error500Page.jsx +4 -0
  118. package/components/ErrorPage/ErrorPage.d.ts +11 -0
  119. package/components/ErrorPage/ErrorPage.jsx +23 -0
  120. package/components/FileInput/FileInput.d.ts +47 -0
  121. package/components/FileInput/FileInput.jsx +144 -0
  122. package/components/FileInput/PreviewFile.d.ts +13 -0
  123. package/components/FileInput/PreviewFile.jsx +55 -0
  124. package/components/FileInput/index.d.ts +3 -0
  125. package/components/FileInput/index.jsx +3 -0
  126. package/components/FileSelect/FileSelect.d.ts +31 -0
  127. package/components/FileSelect/FileSelect.jsx +143 -0
  128. package/components/FileSelect/index.d.ts +3 -0
  129. package/components/FileSelect/index.jsx +3 -0
  130. package/components/Footer/Footer.d.ts +19 -0
  131. package/components/Footer/Footer.jsx +30 -0
  132. package/components/Footer/index.d.ts +3 -0
  133. package/components/Footer/index.jsx +3 -0
  134. package/components/GridPattern/GridPattern.d.ts +2 -0
  135. package/components/GridPattern/GridPattern.jsx +12 -0
  136. package/components/GridPattern/index.d.ts +3 -0
  137. package/components/GridPattern/index.jsx +3 -0
  138. package/components/Group/Group.d.ts +5 -0
  139. package/components/Group/Group.jsx +6 -0
  140. package/components/Group/index.d.ts +3 -0
  141. package/components/Group/index.jsx +3 -0
  142. package/components/Header/Header.d.ts +5 -0
  143. package/components/Header/Header.jsx +19 -0
  144. package/components/Header/index.d.ts +3 -0
  145. package/components/Header/index.jsx +3 -0
  146. package/components/ImageInput/ImageInput.d.ts +4 -0
  147. package/components/ImageInput/ImageInput.jsx +8 -0
  148. package/components/ImageInput/index.d.ts +3 -0
  149. package/components/ImageInput/index.jsx +3 -0
  150. package/components/Input/Input.d.ts +14 -0
  151. package/components/Input/Input.jsx +57 -0
  152. package/components/Input/InputIcon.d.ts +9 -0
  153. package/components/Input/InputIcon.jsx +7 -0
  154. package/components/Input/MultiSelectInput.d.ts +13 -0
  155. package/components/Input/MultiSelectInput.jsx +28 -0
  156. package/components/Input/NumericInput.d.ts +6 -0
  157. package/components/Input/NumericInput.jsx +6 -0
  158. package/components/Input/PatternInput.d.ts +6 -0
  159. package/components/Input/PatternInput.jsx +6 -0
  160. package/components/Input/UnstyledInput.d.ts +22 -0
  161. package/components/Input/UnstyledInput.jsx +28 -0
  162. package/components/Input/index.d.ts +6 -0
  163. package/components/Input/index.jsx +6 -0
  164. package/components/Input2/InputWrapper.d.ts +11 -0
  165. package/components/Input2/InputWrapper.jsx +11 -0
  166. package/components/Link/Link.d.ts +3 -0
  167. package/components/Link/Link.jsx +9 -0
  168. package/components/Link/index.d.ts +3 -0
  169. package/components/Link/index.jsx +3 -0
  170. package/components/Loading/Loading.d.ts +3 -0
  171. package/components/Loading/Loading.jsx +13 -0
  172. package/components/Loading/index.d.ts +3 -0
  173. package/components/Loading/index.jsx +3 -0
  174. package/components/Magnet/Magnet.d.ts +13 -0
  175. package/components/Magnet/Magnet.jsx +50 -0
  176. package/components/Magnet/index.d.ts +3 -0
  177. package/components/Magnet/index.jsx +3 -0
  178. package/components/Markdown/Markdown.d.ts +8 -0
  179. package/components/Markdown/Markdown.jsx +13 -0
  180. package/components/Markdown/index.d.ts +3 -0
  181. package/components/Markdown/index.jsx +3 -0
  182. package/components/Menu/Menu.d.ts +28 -0
  183. package/components/Menu/Menu.jsx +54 -0
  184. package/components/Modal/Modal.d.ts +45 -0
  185. package/components/Modal/Modal.jsx +65 -0
  186. package/components/Modal/index.d.ts +4 -0
  187. package/components/Modal/index.jsx +4 -0
  188. package/components/Modal/useModalState.d.ts +6 -0
  189. package/components/Modal/useModalState.js +16 -0
  190. package/components/ModeToggle/ModeToggle.d.ts +9 -0
  191. package/components/ModeToggle/ModeToggle.jsx +12 -0
  192. package/components/ModeToggle/index.d.ts +4 -0
  193. package/components/ModeToggle/index.jsx +5 -0
  194. package/components/ModeToggle/useModeToggle.d.ts +1 -0
  195. package/components/ModeToggle/useModeToggle.js +21 -0
  196. package/components/MultiSelect/MultiSelect.d.ts +28 -0
  197. package/components/MultiSelect/MultiSelect.jsx +130 -0
  198. package/components/MultiSelect/index.d.ts +3 -0
  199. package/components/MultiSelect/index.jsx +3 -0
  200. package/components/MultiText/MultiText.d.ts +23 -0
  201. package/components/MultiText/MultiText.jsx +119 -0
  202. package/components/MultiText/index.d.ts +3 -0
  203. package/components/MultiText/index.jsx +3 -0
  204. package/components/NavigationDrawer/NavigationDrawer.d.ts +9 -0
  205. package/components/NavigationDrawer/NavigationDrawer.jsx +29 -0
  206. package/components/NavigationDrawer/NavigationItem.d.ts +13 -0
  207. package/components/NavigationDrawer/NavigationItem.jsx +24 -0
  208. package/components/NavigationDrawer/index.d.ts +6 -0
  209. package/components/NavigationDrawer/index.jsx +6 -0
  210. package/components/NavigationDrawer/navigationDrawer.state.d.ts +9 -0
  211. package/components/NavigationDrawer/navigationDrawer.state.js +19 -0
  212. package/components/NoSsr/NoSsr.d.ts +4 -0
  213. package/components/NoSsr/NoSsr.jsx +8 -0
  214. package/components/NoSsr/index.d.ts +3 -0
  215. package/components/NoSsr/index.jsx +3 -0
  216. package/components/Noise/Noise.d.ts +11 -0
  217. package/components/Noise/Noise.jsx +69 -0
  218. package/components/Noise/index.d.ts +3 -0
  219. package/components/Noise/index.jsx +3 -0
  220. package/components/Notifications/Notifications.d.ts +3 -0
  221. package/components/Notifications/Notifications.jsx +60 -0
  222. package/components/Notifications/index.d.ts +5 -0
  223. package/components/Notifications/index.jsx +6 -0
  224. package/components/Notifications/notifications.state.d.ts +24 -0
  225. package/components/Notifications/notifications.state.js +41 -0
  226. package/components/Orb/Orb.d.ts +8 -0
  227. package/components/Orb/Orb.jsx +258 -0
  228. package/components/Orb/index.d.ts +3 -0
  229. package/components/Orb/index.jsx +3 -0
  230. package/components/Pagination/Pagination.d.ts +13 -0
  231. package/components/Pagination/Pagination.jsx +64 -0
  232. package/components/Pagination/index.d.ts +3 -0
  233. package/components/Pagination/index.jsx +3 -0
  234. package/components/Particles/Particles.d.ts +18 -0
  235. package/components/Particles/Particles.jsx +205 -0
  236. package/components/Particles/index.d.ts +3 -0
  237. package/components/Particles/index.jsx +3 -0
  238. package/components/PictureCropInput/PictureCropInput.d.ts +17 -0
  239. package/components/PictureCropInput/PictureCropInput.jsx +153 -0
  240. package/components/PictureCropInput/canvasPreview.d.ts +2 -0
  241. package/components/PictureCropInput/canvasPreview.js +37 -0
  242. package/components/PictureCropInput/index.d.ts +3 -0
  243. package/components/PictureCropInput/index.js +3 -0
  244. package/components/Popover/Popover.d.ts +13 -0
  245. package/components/Popover/Popover.jsx +22 -0
  246. package/components/Popover/index.d.ts +3 -0
  247. package/components/Popover/index.jsx +3 -0
  248. package/components/Resizable/Resizable.d.ts +12 -0
  249. package/components/Resizable/Resizable.jsx +54 -0
  250. package/components/Resizable/index.d.ts +3 -0
  251. package/components/Resizable/index.jsx +3 -0
  252. package/components/ScrollArea/ScrollArea.d.ts +9 -0
  253. package/components/ScrollArea/ScrollArea.jsx +16 -0
  254. package/components/ScrollArea/index.d.ts +3 -0
  255. package/components/ScrollArea/index.jsx +3 -0
  256. package/components/Select/Select.d.ts +24 -0
  257. package/components/Select/Select.jsx +55 -0
  258. package/components/Select/index.d.ts +3 -0
  259. package/components/Select/index.jsx +3 -0
  260. package/components/Skeleton/Skeleton.d.ts +2 -0
  261. package/components/Skeleton/Skeleton.jsx +8 -0
  262. package/components/Skeleton/index.d.ts +3 -0
  263. package/components/Skeleton/index.jsx +3 -0
  264. package/components/Slider/Slider.d.ts +10 -0
  265. package/components/Slider/Slider.jsx +21 -0
  266. package/components/Slider/index.d.ts +3 -0
  267. package/components/Slider/index.jsx +3 -0
  268. package/components/Spotlight/Spotlight.d.ts +30 -0
  269. package/components/Spotlight/Spotlight.jsx +77 -0
  270. package/components/Spotlight/index.d.ts +3 -0
  271. package/components/Spotlight/index.jsx +3 -0
  272. package/components/SpotlightCard/SpotlightCard.d.ts +7 -0
  273. package/components/SpotlightCard/SpotlightCard.jsx +35 -0
  274. package/components/SpotlightCard/index.d.ts +3 -0
  275. package/components/SpotlightCard/index.jsx +3 -0
  276. package/components/Stack/Stack.d.ts +4 -0
  277. package/components/Stack/Stack.jsx +5 -0
  278. package/components/Stack/index.d.ts +3 -0
  279. package/components/Stack/index.jsx +3 -0
  280. package/components/StarBorder/StarBorder.d.ts +11 -0
  281. package/components/StarBorder/StarBorder.jsx +19 -0
  282. package/components/StarBorder/index.d.ts +3 -0
  283. package/components/StarBorder/index.jsx +3 -0
  284. package/components/Switch/Switch.d.ts +16 -0
  285. package/components/Switch/Switch.jsx +24 -0
  286. package/components/Switch/index.d.ts +3 -0
  287. package/components/Switch/index.jsx +3 -0
  288. package/components/Table/DataTable.d.ts +57 -0
  289. package/components/Table/DataTable.jsx +155 -0
  290. package/components/Table/Table.d.ts +27 -0
  291. package/components/Table/Table.jsx +31 -0
  292. package/components/Table/TableActionButton.d.ts +6 -0
  293. package/components/Table/TableActionButton.jsx +20 -0
  294. package/components/Table/TableBody.d.ts +6 -0
  295. package/components/Table/TableBody.jsx +10 -0
  296. package/components/Table/TableCell.d.ts +9 -0
  297. package/components/Table/TableCell.jsx +18 -0
  298. package/components/Table/TableFooter.d.ts +5 -0
  299. package/components/Table/TableFooter.jsx +5 -0
  300. package/components/Table/TableFooterWithPagination.d.ts +13 -0
  301. package/components/Table/TableFooterWithPagination.jsx +57 -0
  302. package/components/Table/TableHead.d.ts +5 -0
  303. package/components/Table/TableHead.jsx +9 -0
  304. package/components/Table/TableHeadContext.d.ts +4 -0
  305. package/components/Table/TableHeadContext.jsx +3 -0
  306. package/components/Table/TableHeader.d.ts +7 -0
  307. package/components/Table/TableHeader.jsx +15 -0
  308. package/components/Table/TableRow.d.ts +8 -0
  309. package/components/Table/TableRow.jsx +9 -0
  310. package/components/Table/index.d.ts +3 -0
  311. package/components/Table/index.jsx +3 -0
  312. package/components/Tabs/Tabs.d.ts +9 -0
  313. package/components/Tabs/Tabs.jsx +13 -0
  314. package/components/Tabs/index.d.ts +3 -0
  315. package/components/Tabs/index.jsx +3 -0
  316. package/components/TabsSwitcher/Tab.d.ts +15 -0
  317. package/components/TabsSwitcher/Tab.jsx +18 -0
  318. package/components/TabsSwitcher/TabsSwitcher.d.ts +22 -0
  319. package/components/TabsSwitcher/TabsSwitcher.jsx +31 -0
  320. package/components/TabsSwitcher/index.d.ts +4 -0
  321. package/components/TabsSwitcher/index.jsx +4 -0
  322. package/components/Text/Text.d.ts +24 -0
  323. package/components/Text/Text.jsx +28 -0
  324. package/components/Text/index.d.ts +3 -0
  325. package/components/Text/index.jsx +3 -0
  326. package/components/Textarea/Textarea.d.ts +5 -0
  327. package/components/Textarea/Textarea.jsx +6 -0
  328. package/components/Textarea/index.d.ts +3 -0
  329. package/components/Textarea/index.js +3 -0
  330. package/components/Threads/Threads.d.ts +9 -0
  331. package/components/Threads/Threads.jsx +203 -0
  332. package/components/Threads/index.d.ts +3 -0
  333. package/components/Threads/index.jsx +3 -0
  334. package/components/Tooltip/Tooltip.d.ts +11 -0
  335. package/components/Tooltip/Tooltip.jsx +21 -0
  336. package/components/Tooltip/index.d.ts +3 -0
  337. package/components/Tooltip/index.jsx +3 -0
  338. package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +7 -0
  339. package/components/VisibilityActivatedButton/VisibilityActivatedButton.jsx +18 -0
  340. package/components/VisibilityActivatedButton/index.d.ts +3 -0
  341. package/components/VisibilityActivatedButton/index.jsx +3 -0
  342. package/form.d.ts +82 -0
  343. package/form.js +113 -0
  344. package/form2.d.ts +15 -0
  345. package/form2.jsx +29 -0
  346. package/hooks/useBeforeUnload.d.ts +1 -0
  347. package/hooks/useBeforeUnload.js +17 -0
  348. package/hooks/useDebounceEffect.d.ts +2 -0
  349. package/hooks/useDebounceEffect.js +14 -0
  350. package/hooks/useDebouncedValue.d.ts +2 -0
  351. package/hooks/useDebouncedValue.js +14 -0
  352. package/hooks/useLagRadar.d.ts +1 -0
  353. package/hooks/useLagRadar.jsx +124 -0
  354. package/hooks/useMediaQuery.d.ts +1 -0
  355. package/hooks/useMediaQuery.js +37 -0
  356. package/hooks/useMutationWindowCloseProtection.d.ts +2 -0
  357. package/hooks/useMutationWindowCloseProtection.js +13 -0
  358. package/hooks/useScroll.d.ts +3 -0
  359. package/hooks/useScroll.js +47 -0
  360. package/hooks/useTranslation.d.ts +4 -0
  361. package/hooks/useTranslation.js +11 -0
  362. package/hooks/useWhyDidYouUpdate.d.ts +3 -0
  363. package/hooks/useWhyDidYouUpdate.js +44 -0
  364. package/imgur.d.ts +1 -0
  365. package/imgur.js +13 -0
  366. package/package.json +9 -0
  367. package/styles/DayPicker.classNames.d.ts +29 -0
  368. package/styles/DayPicker.classNames.js +30 -0
  369. package/styles/DayPicker.classNames.ts +81 -0
  370. package/styles/Dropdown.classNames.d.ts +6 -0
  371. package/styles/Dropdown.classNames.js +7 -0
  372. package/styles/Dropdown.classNames.ts +38 -0
  373. package/styles/Input.css +23 -0
  374. package/styles/Modal.classNames.d.ts +2 -0
  375. package/styles/Modal.classNames.js +3 -0
  376. package/styles/Modal.classNames.ts +15 -0
  377. package/styles/MultiText.css +40 -0
  378. package/styles/Pagination.css +19 -0
  379. package/styles/Tabs.css +23 -0
  380. package/tsconfig.tsbuildinfo +1 -0
  381. package/types.d.ts +6 -0
  382. package/types.js +1 -0
  383. package/utils/UseState.d.ts +3 -0
  384. package/utils/UseState.js +1 -0
  385. package/utils/blobToText.d.ts +1 -0
  386. package/utils/blobToText.js +13 -0
  387. package/utils/capitalize.d.ts +1 -0
  388. package/utils/capitalize.js +6 -0
  389. package/utils/clsx.d.ts +2 -0
  390. package/utils/clsx.js +5 -0
  391. package/utils/copy2DToClipboard.d.ts +1 -0
  392. package/utils/copy2DToClipboard.js +44 -0
  393. package/utils/cpfCpnjUtils.d.ts +3 -0
  394. package/utils/cpfCpnjUtils.js +43 -0
  395. package/utils/createLocalStorageStateHydration.d.ts +1 -0
  396. package/utils/createLocalStorageStateHydration.js +18 -0
  397. package/utils/createStateHydration.d.ts +3 -0
  398. package/utils/createStateHydration.js +49 -0
  399. package/utils/csvBlobToJson.d.ts +2 -0
  400. package/utils/csvBlobToJson.js +60 -0
  401. package/utils/downloadArrayAsCSV.d.ts +1 -0
  402. package/utils/downloadArrayAsCSV.js +34 -0
  403. package/utils/emailRegExp.d.ts +2 -0
  404. package/utils/emailRegExp.js +3 -0
  405. package/utils/fakeArray.d.ts +1 -0
  406. package/utils/fakeArray.js +3 -0
  407. package/utils/filterBoolean.d.ts +1 -0
  408. package/utils/filterBoolean.js +3 -0
  409. package/utils/formatClock.d.ts +1 -0
  410. package/utils/formatClock.js +21 -0
  411. package/utils/formatTime.d.ts +2 -0
  412. package/utils/formatTime.js +40 -0
  413. package/utils/getInitials.d.ts +4 -0
  414. package/utils/getInitials.js +8 -0
  415. package/utils/isBrowser.d.ts +12 -0
  416. package/utils/isBrowser.js +26 -0
  417. package/utils/ms.d.ts +6 -0
  418. package/utils/ms.js +31 -0
  419. package/utils/preventDefault.d.ts +1 -0
  420. package/utils/preventDefault.js +3 -0
  421. package/utils/recursiveChildrenMap.d.ts +2 -0
  422. package/utils/recursiveChildrenMap.js +16 -0
  423. package/utils/setSelectionRange.d.ts +1 -0
  424. package/utils/setSelectionRange.js +55 -0
  425. package/utils/smoothScrollToHref.d.ts +2 -0
  426. package/utils/smoothScrollToHref.js +10 -0
  427. package/utils/stopPropagation.d.ts +2 -0
  428. package/utils/stopPropagation.js +3 -0
  429. package/utils/stripHtml.d.ts +1 -0
  430. package/utils/stripHtml.js +4 -0
  431. package/utils/stripLineBreak.d.ts +1 -0
  432. package/utils/stripLineBreak.js +4 -0
  433. package/utils/stripMarkdown.d.ts +1 -0
  434. package/utils/stripMarkdown.js +28 -0
  435. package/utils/xlsxBlobToJson.d.ts +2 -0
  436. package/utils/xlsxBlobToJson.js +59 -0
@@ -0,0 +1,28 @@
1
+ import { ComponentPropsWithoutRef, ReactElement, ReactNode, Ref } from "react";
2
+ import Button from "../Button/Button";
3
+ import { UnstyledButtonProps } from "../Button/UnstyledButton";
4
+ import { TextProps } from "../Text";
5
+ export declare const defaultMenuItemsClassName = "z-10 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden dark:bg-zinc-800";
6
+ export type MenuProps = {
7
+ className?: string;
8
+ position?: "left" | "right" | "bottom-right" | "bottom-left";
9
+ iconClassName?: string;
10
+ menuItemsClassName?: string;
11
+ buttonProps?: ComponentPropsWithoutRef<typeof Button>;
12
+ label?: ReactNode;
13
+ children?: ReactNode;
14
+ button?: ReactNode;
15
+ unmount?: boolean;
16
+ ref?: Ref<HTMLDivElement>;
17
+ };
18
+ export type MenuItemProps<T extends HTMLElement = HTMLButtonElement> = UnstyledButtonProps<T> & {
19
+ icon?: ReactElement<{
20
+ className?: string;
21
+ }>;
22
+ };
23
+ export type MenuLabelProps = TextProps;
24
+ declare const _default: (({ className, iconClassName, position, children, label, button, buttonProps, unmount, menuItemsClassName, ...props }: MenuProps) => import("react").JSX.Element) & {
25
+ Label: (props: MenuLabelProps) => import("react").JSX.Element;
26
+ Item: <T extends HTMLElement = HTMLButtonElement>({ className, icon, children, ...props }: MenuItemProps<T>) => import("react").JSX.Element;
27
+ };
28
+ export default _default;
@@ -0,0 +1,54 @@
1
+ import { cloneElement, Fragment, } from "react";
2
+ import { Menu as HuiMenu, Transition } from "@headlessui/react";
3
+ import { ChevronDownIcon } from "@heroicons/react/20/solid";
4
+ import clsx from "../../utils/clsx";
5
+ import Button from "../Button/Button";
6
+ import UnstyledButton from "../Button/UnstyledButton";
7
+ import Text from "../Text";
8
+ import { useMount } from "react-use";
9
+ export const defaultMenuItemsClassName = "z-10 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden dark:bg-zinc-800";
10
+ const Item = function MenuItem({ className, icon, children, ...props }) {
11
+ return (<HuiMenu.Item>
12
+ {({ active }) => (<UnstyledButton {...props} type="button" className={clsx("flex w-full items-center text-left", active
13
+ ? "bg-zinc-100 text-zinc-900 dark:bg-zinc-700/50 dark:text-zinc-100"
14
+ : "text-zinc-700 dark:text-zinc-200", "block px-4 py-2 text-sm", className)}>
15
+ {icon &&
16
+ cloneElement(icon, {
17
+ className: clsx("w-5 mr-2", icon.props.className),
18
+ })}
19
+ {children}
20
+ </UnstyledButton>)}
21
+ </HuiMenu.Item>);
22
+ };
23
+ const Label = function MenuLabel(props) {
24
+ return (<Text {...props} variant="label" className={clsx("w-full text-left", "block px-4 py-2 text-sm", props.className)}/>);
25
+ };
26
+ const Menu = function Menu({ className, iconClassName, position = "right", children, label, button, buttonProps, unmount, menuItemsClassName, ...props }) {
27
+ useMount(() => {
28
+ console.warn("<Menu> was deprecated and should be replaced with <DropdownMenu>");
29
+ });
30
+ return (<HuiMenu as="div" className={clsx("relative inline-block text-left", className)} {...props}>
31
+ <div>
32
+ {button ? (<HuiMenu.Button as={Fragment}>{button}</HuiMenu.Button>) : (<HuiMenu.Button
33
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
34
+ as={Button} className={clsx("flex w-full", buttonProps?.className)} trailing={<ChevronDownIcon className={iconClassName}/>} {...buttonProps}>
35
+ {label}
36
+ </HuiMenu.Button>)}
37
+ </div>
38
+
39
+ <Transition as={Fragment} enter="transition ease-out duration-100" enterFrom="transform opacity-0 scale-95" enterTo="transform opacity-100 scale-100" leave="transition ease-in duration-75" leaveFrom="transform opacity-100 scale-100" leaveTo="transform opacity-0 scale-95">
40
+ <HuiMenu.Items unmount={unmount} className={clsx(defaultMenuItemsClassName, "absolute mt-2 min-w-[14rem]", {
41
+ "right-0": position.includes("right"),
42
+ "origin-top-right": position.includes("right") && !position.includes("bottom"),
43
+ "origin-top-left": position.includes("left") && !position.includes("bottom"),
44
+ "origin-bottom-right": position.includes("right") && position.includes("bottom"),
45
+ "origin-bottom-left": position.includes("left") && position.includes("bottom"),
46
+ "left-0": position.includes("left"),
47
+ "bottom-0": position.includes("bottom"),
48
+ }, menuItemsClassName)}>
49
+ <div className="py-1">{children}</div>
50
+ </HuiMenu.Items>
51
+ </Transition>
52
+ </HuiMenu>);
53
+ };
54
+ export default Object.assign(Menu, { Label, Item });
@@ -0,0 +1,45 @@
1
+ import { ComponentPropsWithoutRef, CSSProperties, ReactElement, ReactNode } from "react";
2
+ import Button from "../Button";
3
+ declare function Modal({ open, onClose, children, overlayClassName, panelClassName, dialogClassName, dialogOuterPanelClassName, dialogOverflowClassName, style, }: {
4
+ open?: boolean;
5
+ onClose?: () => void;
6
+ children?: ReactNode;
7
+ overlayClassName?: string;
8
+ panelClassName?: string;
9
+ dialogClassName?: string;
10
+ dialogOuterPanelClassName?: string;
11
+ dialogOverflowClassName?: string;
12
+ style?: CSSProperties;
13
+ }): import("react").JSX.Element;
14
+ declare namespace Modal {
15
+ var Container: typeof ModalContainer;
16
+ var Title: typeof ModalTitle;
17
+ var Content: typeof ModalContent;
18
+ var Actions: typeof ModalActions;
19
+ var Icon: typeof ModalIcon;
20
+ var CloseButton: typeof ModalCloseButton;
21
+ }
22
+ export default Modal;
23
+ declare function ModalContainer({ children, className, }: {
24
+ children?: ReactNode;
25
+ className?: string;
26
+ }): import("react").JSX.Element;
27
+ declare function ModalTitle({ children, className, }: {
28
+ children?: ReactNode;
29
+ className?: string;
30
+ }): import("react").JSX.Element;
31
+ declare function ModalContent({ children, className, }: {
32
+ children?: ReactNode;
33
+ className?: string;
34
+ }): import("react").JSX.Element;
35
+ declare function ModalActions({ children, className, }: {
36
+ children?: ReactNode;
37
+ className?: string;
38
+ }): import("react").JSX.Element;
39
+ declare function ModalIcon({ children, }: {
40
+ children?: ReactElement<{
41
+ className?: string;
42
+ "aria-hidden"?: string;
43
+ }>;
44
+ }): import("react").JSX.Element;
45
+ declare function ModalCloseButton({ className, ...props }: ComponentPropsWithoutRef<typeof Button>): import("react").JSX.Element;
@@ -0,0 +1,65 @@
1
+ import { cloneElement, Fragment, useCallback, } from "react";
2
+ import { Dialog, Transition } from "@headlessui/react";
3
+ import Stack from "../Stack";
4
+ import Group from "../Group";
5
+ import Button from "../Button";
6
+ import { XMarkIcon } from "@heroicons/react/24/solid";
7
+ import clsx from "../../utils/clsx";
8
+ export default function Modal({ open, onClose, children, overlayClassName, panelClassName, dialogClassName, dialogOuterPanelClassName, dialogOverflowClassName, style, }) {
9
+ const handleOnClose = useCallback(() => onClose?.(), [onClose]);
10
+ return (<Transition.Root show={open} as={Fragment}>
11
+ <Dialog as="div" className={clsx("relative z-10", dialogClassName)} onClose={handleOnClose} style={style}>
12
+ <Transition.Child as={Fragment} enter="ease-out duration-300" enterFrom="opacity-0" enterTo="opacity-100" leave="ease-in duration-200" leaveFrom="opacity-100" leaveTo="opacity-0">
13
+ <div className={clsx("fixed inset-0 bg-white/75 transition-opacity dark:bg-black/75", overlayClassName)}/>
14
+ </Transition.Child>
15
+
16
+ <div className={clsx("fixed inset-0 z-10 overflow-y-auto", dialogOverflowClassName)}>
17
+ <div className={clsx("flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", dialogOuterPanelClassName)}>
18
+ <Transition.Child as={Fragment} enter="ease-out duration-300" enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" enterTo="opacity-100 translate-y-0 sm:scale-100" leave="ease-in duration-200" leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
19
+ <Dialog.Panel className={clsx("relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all dark:bg-zinc-900 dark:ring-1 dark:ring-white/5 sm:my-8 sm:w-full sm:max-w-sm", panelClassName)}>
20
+ {children}
21
+ </Dialog.Panel>
22
+ </Transition.Child>
23
+ </div>
24
+ </div>
25
+ </Dialog>
26
+ </Transition.Root>);
27
+ }
28
+ Modal.Container = ModalContainer;
29
+ function ModalContainer({ children, className, }) {
30
+ return (<Stack className={clsx("gap-4! px-4 pb-4 pt-5 sm:p-6", className)}>
31
+ {children}
32
+ </Stack>);
33
+ }
34
+ Modal.Title = ModalTitle;
35
+ function ModalTitle({ children, className, }) {
36
+ return (<Dialog.Title as="h3" className={clsx("text-center text-lg font-medium leading-6 text-zinc-900 dark:text-zinc-100", className)}>
37
+ {children}
38
+ </Dialog.Title>);
39
+ }
40
+ Modal.Content = ModalContent;
41
+ function ModalContent({ children, className, }) {
42
+ return (<div className={clsx("text-center text-sm text-zinc-500 dark:text-zinc-400", className)}>
43
+ {children}
44
+ </div>);
45
+ }
46
+ Modal.Actions = ModalActions;
47
+ function ModalActions({ children, className, }) {
48
+ return <Group className={className}>{children}</Group>;
49
+ }
50
+ Modal.Icon = ModalIcon;
51
+ function ModalIcon({ children, }) {
52
+ return (<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-800">
53
+ {children &&
54
+ cloneElement(children, {
55
+ className: "h-6 w-6 text-green-600 dark:text-green-400",
56
+ "aria-hidden": "true",
57
+ })}
58
+ </div>);
59
+ }
60
+ Modal.CloseButton = ModalCloseButton;
61
+ function ModalCloseButton({ className, ...props }) {
62
+ return (<Button icon className={clsx("absolute right-2 top-2", className)} variant="text" {...props}>
63
+ <XMarkIcon />
64
+ </Button>);
65
+ }
@@ -0,0 +1,4 @@
1
+ import Modal from "./Modal";
2
+ export * from "./Modal";
3
+ export default Modal;
4
+ export { default as useModalState } from "./useModalState";
@@ -0,0 +1,4 @@
1
+ import Modal from "./Modal";
2
+ export * from "./Modal";
3
+ export default Modal;
4
+ export { default as useModalState } from "./useModalState";
@@ -0,0 +1,6 @@
1
+ export default function useModalState(): readonly [boolean, {
2
+ readonly setModalOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
3
+ readonly openModal: () => void;
4
+ readonly closeModal: () => void;
5
+ readonly toggleModal: () => void;
6
+ }];
@@ -0,0 +1,16 @@
1
+ import { useCallback, useMemo, useState } from "react";
2
+ export default function useModalState() {
3
+ const [modalOpen, setModalOpen] = useState(false);
4
+ const handleModalToggle = useCallback(() => setModalOpen((open) => !open), []);
5
+ const handleModalOpen = useCallback(() => setModalOpen(true), []);
6
+ const handleModalClose = useCallback(() => setModalOpen(false), []);
7
+ return useMemo(() => [
8
+ modalOpen,
9
+ {
10
+ setModalOpen,
11
+ openModal: handleModalOpen,
12
+ closeModal: handleModalClose,
13
+ toggleModal: handleModalToggle,
14
+ },
15
+ ], [handleModalClose, handleModalOpen, handleModalToggle, modalOpen]);
16
+ }
@@ -0,0 +1,9 @@
1
+ import { Ref } from "react";
2
+ export interface ModeToggleProps {
3
+ ariaLabel?: string;
4
+ className?: string;
5
+ iconClassName?: string;
6
+ ref?: Ref<HTMLButtonElement>;
7
+ }
8
+ declare const ModeToggle: ({ ariaLabel, className, iconClassName, ref, }: ModeToggleProps) => import("react").JSX.Element;
9
+ export default ModeToggle;
@@ -0,0 +1,12 @@
1
+ import { MoonIcon, SunIcon } from "@heroicons/react/24/outline";
2
+ import Button from "../Button";
3
+ import clsx from "../../utils/clsx";
4
+ import useModeToggle from "./useModeToggle";
5
+ const ModeToggle = function ModeToggle({ ariaLabel = "Toggle dark mode", className, iconClassName, ref, }) {
6
+ const toggleMode = useModeToggle();
7
+ return (<Button ref={ref} icon variant="text" aria-label={ariaLabel} onClick={toggleMode} className={className}>
8
+ <SunIcon className={clsx("dark:hidden", iconClassName)}/>
9
+ <MoonIcon className={clsx("hidden dark:block", iconClassName)}/>
10
+ </Button>);
11
+ };
12
+ export default ModeToggle;
@@ -0,0 +1,4 @@
1
+ import ModeToggle from "./ModeToggle";
2
+ export * from "./ModeToggle";
3
+ export default ModeToggle;
4
+ export { default as useModeToggle } from "./useModeToggle";
@@ -0,0 +1,5 @@
1
+ import ModeToggle from "./ModeToggle";
2
+ export * from "./ModeToggle";
3
+ export default ModeToggle;
4
+ // noinspection JSUnusedGlobalSymbols
5
+ export { default as useModeToggle } from "./useModeToggle";
@@ -0,0 +1 @@
1
+ export default function useModeToggle(): () => void;
@@ -0,0 +1,21 @@
1
+ export default function useModeToggle() {
2
+ function disableTransitionsTemporarily() {
3
+ document.documentElement.classList.add("**:transition-none!");
4
+ window.setTimeout(() => {
5
+ document.documentElement.classList.remove("**:transition-none!");
6
+ }, 0);
7
+ }
8
+ function toggleMode() {
9
+ disableTransitionsTemporarily();
10
+ const darkModeMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
11
+ const isSystemDarkMode = darkModeMediaQuery.matches;
12
+ const isDarkMode = document.documentElement.classList.toggle("dark");
13
+ if (isDarkMode === isSystemDarkMode) {
14
+ delete window.localStorage.isDarkMode;
15
+ }
16
+ else {
17
+ window.localStorage.isDarkMode = isDarkMode;
18
+ }
19
+ }
20
+ return toggleMode;
21
+ }
@@ -0,0 +1,28 @@
1
+ import { ReactNode } from "react";
2
+ import Input, { UnstyledInputProps } from "../Input";
3
+ export interface MultiSelectProps<T extends object | string> extends Omit<UnstyledInputProps<false>, "as" | "onSelect" | "inputClassName" | "innerClassName" | "value" | "onChange"> {
4
+ placeholder?: string;
5
+ emptyText?: string;
6
+ items?: T[];
7
+ filterProperty?: keyof T;
8
+ filterFunction?: (item: T) => boolean;
9
+ onChange?: (items: T[]) => void;
10
+ renderProperty?: keyof T;
11
+ renderFunction?: (item: T) => ReactNode;
12
+ query?: string;
13
+ onChangeQuery?: (query: string) => void;
14
+ loading?: boolean;
15
+ leadingClassName?: string;
16
+ inputInnerClassName?: string;
17
+ inputElementClassName?: string;
18
+ leading?: ReactNode;
19
+ as?: typeof Input;
20
+ static?: boolean;
21
+ displayValue?: (item: T | null) => string;
22
+ value?: T[];
23
+ creatable?: boolean;
24
+ getCreateLabel?: (query: string) => string;
25
+ itemsRenderLimit?: number;
26
+ valueProperty?: string | number;
27
+ }
28
+ export default function MultiSelect<T extends object | string>({ placeholder, emptyText, items, renderProperty, renderFunction, filterProperty, filterFunction, onChange, query: defaultQuery, onChangeQuery, loading, inputInnerClassName, inputElementClassName, as, trailing, trailingClassName, trailingInputClassName, leadingInputClassName, static: isStatic, displayValue, value, labelClassName, creatable, getCreateLabel, itemsRenderLimit, className, valueProperty, label, required, readOnly, ...props }: MultiSelectProps<T>): import("react").JSX.Element;
@@ -0,0 +1,130 @@
1
+ import { Combobox } from "@headlessui/react";
2
+ import Loading from "../Loading";
3
+ import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
4
+ import { defaultInputClassName, defaultLabelClassName, defaultLeadingInputClassName, defaultTrailingClassName, defaultTrailingInputClassName, UnstyledInput, } from "../Input";
5
+ import clsx from "../../utils/clsx";
6
+ import { isEqual, take } from "lodash-es";
7
+ import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/20/solid";
8
+ import Badge from "../Badge";
9
+ import { useDeepCompareEffect } from "react-use";
10
+ const defaultMenuItemsClassName = "z-10 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden dark:bg-zinc-800";
11
+ function getValue(id, item) {
12
+ return typeof item === "string"
13
+ ? item
14
+ : item[id];
15
+ }
16
+ function MultiSelectInput({ className, selectedItems, doRender, removeItem, valueProperty, readOnly, ...props }) {
17
+ const ref = useRef(null);
18
+ return (<div className={clsx("flex flex-wrap border focus-within:border-primary-500 focus-within:ring-1 focus-within:ring-primary-500 dark:focus-within:border-primary-500", className)} onClick={() => ref.current?.focus()}>
19
+ {!!selectedItems.length && (<div className="flex flex-wrap items-center gap-1 p-1.5 pb-0">
20
+ {selectedItems.map((item) => (<Badge key={getValue(valueProperty, item)} onActionClick={!readOnly ? removeItem(item) : undefined}>
21
+ {doRender(item)}
22
+ </Badge>))}
23
+ </div>)}
24
+ {!readOnly && (<Combobox.Input
25
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
26
+ {...props} ref={ref} className="rounded-md border-none ring-transparent! disabled:cursor-not-allowed disabled:text-zinc-500 dark:bg-zinc-800 dark:disabled:bg-zinc-900/90 sm:text-sm" readOnly={readOnly}/>)}
27
+ </div>);
28
+ }
29
+ export default function MultiSelect({ placeholder, emptyText = "No item found.", items = [], renderProperty = "title", renderFunction, filterProperty = "title", filterFunction, onChange, query: defaultQuery = "", onChangeQuery, loading, inputInnerClassName, inputElementClassName, as, trailing, trailingClassName, trailingInputClassName, leadingInputClassName, static: isStatic,
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ displayValue = (item) => item?.[renderProperty] || "", value, labelClassName, creatable, getCreateLabel = (query) => `+ create "${query}"`, itemsRenderLimit, className, valueProperty = "_id", label, required, readOnly, ...props }) {
32
+ const [query, setQuery] = useState(defaultQuery);
33
+ const [selectedItems, setSelectedItems] = useState(value || []);
34
+ // noinspection DuplicatedCode
35
+ useEffect(() => {
36
+ if (query !== defaultQuery) {
37
+ setQuery(defaultQuery);
38
+ }
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ }, [defaultQuery]);
41
+ useEffect(() => {
42
+ if (onChangeQuery && query !== defaultQuery) {
43
+ onChangeQuery(query);
44
+ }
45
+ // eslint-disable-next-line react-hooks/exhaustive-deps
46
+ }, [query]);
47
+ const filteredItems = useMemo(() => query === ""
48
+ ? items
49
+ : items.filter(filterFunction ||
50
+ ((item) => (typeof item === "string"
51
+ ? item
52
+ : item[filterProperty])
53
+ .toLowerCase()
54
+ .includes(query.toLowerCase()))), [filterFunction, filterProperty, items, query]);
55
+ trailing = loading ? (<Loading />) : (trailing ||
56
+ (!readOnly ? (<Combobox.Button className="pointer-events-auto -mr-1 flex items-center">
57
+ <ChevronUpDownIcon className="h-5 w-5 text-zinc-400" aria-hidden="true"/>
58
+ </Combobox.Button>) : undefined));
59
+ const ComponentInput = as || UnstyledInput;
60
+ const doRender = useCallback((item) => renderFunction
61
+ ? renderFunction(item)
62
+ : typeof item === "string"
63
+ ? item
64
+ : item[renderProperty], [renderFunction, renderProperty]);
65
+ useDeepCompareEffect(() => {
66
+ onChange?.(selectedItems);
67
+ // eslint-disable-next-line react-hooks/exhaustive-deps
68
+ }, [selectedItems || {}]);
69
+ useDeepCompareEffect(() => {
70
+ if (!isEqual(selectedItems, value)) {
71
+ setSelectedItems(value || []);
72
+ }
73
+ // eslint-disable-next-line react-hooks/exhaustive-deps
74
+ }, [value || {}]);
75
+ const removeItem = useCallback((item) => () => setSelectedItems((selectedItems) => [
76
+ ...selectedItems.filter((i) => getValue(valueProperty, i) !== getValue(valueProperty, item)),
77
+ ]), [valueProperty]);
78
+ if (label && required) {
79
+ label = (<>
80
+ {label} <span className="text-red-500">*</span>
81
+ </>);
82
+ }
83
+ const renderedItems = itemsRenderLimit
84
+ ? take(filteredItems, itemsRenderLimit)
85
+ : filteredItems;
86
+ return (<div className={clsx("relative", className)}>
87
+ <Combobox
88
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
89
+ onChange={setSelectedItems} value={selectedItems} multiple>
90
+ {({ open }) => (<div>
91
+ <ComponentInput
92
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
93
+ {...props} as={MultiSelectInput} placeholder={!readOnly ? placeholder : undefined} value={query} onChange={(event) => setQuery(event.target.value)} trailing={trailing} trailingClassName={clsx(defaultTrailingClassName, trailingClassName)} inputClassName={clsx(defaultInputClassName, "bg-white dark:bg-zinc-800 pl-0", inputElementClassName, {
94
+ "border-dashed": readOnly,
95
+ })} innerClassName={inputInnerClassName} trailingInputClassName={clsx(defaultTrailingInputClassName, trailingInputClassName)} leadingInputClassName={clsx(defaultLeadingInputClassName, leadingInputClassName)} displayValue={displayValue} labelClassName={clsx(defaultLabelClassName, labelClassName)} selectedItems={selectedItems} doRender={doRender} removeItem={removeItem} required={required && !selectedItems.length} label={label} readOnly={readOnly} valueProperty={valueProperty}/>
96
+
97
+ {!readOnly &&
98
+ ((creatable && query) || filteredItems.length > 0) && (<Combobox.Options static={isStatic} className={clsx(defaultMenuItemsClassName, "absolute z-10 mt-1 max-h-72 w-full scroll-py-2 overflow-y-auto py-2 text-sm text-zinc-800 dark:text-zinc-200")}>
99
+ {!renderedItems.some((item) => getValue(valueProperty, item) === query) &&
100
+ creatable &&
101
+ !!query && (<Combobox.Option value={query} className={({ active }) => clsx("cursor-default select-none px-4 py-2", {
102
+ "bg-primary-600 text-white": active,
103
+ })}>
104
+ {({ selected }) => (<div className="flex">
105
+ {selected && <CheckIcon className="mr-2 w-5"/>}
106
+ {selected ? query : getCreateLabel(query)}
107
+ </div>)}
108
+ </Combobox.Option>)}
109
+ {renderedItems.map((item) => (<Combobox.Option key={getValue(valueProperty, item)} value={item} className={({ active }) => clsx("cursor-default select-none px-4 py-2", {
110
+ "bg-primary-600 text-white": active,
111
+ })}>
112
+ {({ selected }) => (<div className="flex">
113
+ {selected && <CheckIcon className="mr-2 w-5"/>}
114
+ {doRender(item)}
115
+ </div>)}
116
+ </Combobox.Option>))}
117
+ </Combobox.Options>)}
118
+
119
+ {!readOnly &&
120
+ !creatable &&
121
+ open &&
122
+ emptyText &&
123
+ query !== "" &&
124
+ filteredItems.length === 0 && (<p className={clsx(defaultMenuItemsClassName, "absolute mt-1 w-full p-4 text-sm text-zinc-500 dark:text-zinc-400")}>
125
+ {emptyText}
126
+ </p>)}
127
+ </div>)}
128
+ </Combobox>
129
+ </div>);
130
+ }
@@ -0,0 +1,3 @@
1
+ import MultiSelect from "./MultiSelect";
2
+ export * from "./MultiSelect";
3
+ export default MultiSelect;
@@ -0,0 +1,3 @@
1
+ import MultiSelect from "./MultiSelect";
2
+ export * from "./MultiSelect";
3
+ export default MultiSelect;
@@ -0,0 +1,23 @@
1
+ import { ChangeEventHandler, FocusEventHandler, Ref } from "react";
2
+ export interface MultiTextProps {
3
+ value?: string[];
4
+ onChangeValue?: (value: string[]) => void;
5
+ name?: string;
6
+ onChange?: ChangeEventHandler<HTMLInputElement>;
7
+ onBlur?: FocusEventHandler<HTMLInputElement>;
8
+ id?: string;
9
+ className?: string;
10
+ helpText?: string;
11
+ label?: string;
12
+ validate?: (value: string) => boolean;
13
+ invalidHelpText?: string;
14
+ error?: boolean;
15
+ format?: (item: string) => string;
16
+ readOnly?: boolean;
17
+ loading?: boolean;
18
+ type?: string;
19
+ required?: boolean;
20
+ ref?: Ref<HTMLInputElement>;
21
+ }
22
+ declare function MultiText({ value, onChangeValue, onChange, onBlur, name, id, className, helpText, label, validate, invalidHelpText, error, format, readOnly, loading, type, required, ref, }: MultiTextProps): import("react").JSX.Element;
23
+ export default MultiText;
@@ -0,0 +1,119 @@
1
+ import { useEffect, useId, useRef, useState, } from "react";
2
+ import { isEqual, uniq } from "lodash-es";
3
+ import { useDeepCompareEffect } from "react-use";
4
+ import { XMarkIcon } from "@heroicons/react/20/solid";
5
+ import InputWrapper from "../Input2/InputWrapper";
6
+ function defaultFormat(item) {
7
+ return item;
8
+ }
9
+ function MultiText({ value, onChangeValue, onChange, onBlur, name, id, className, helpText, label, validate, invalidHelpText, error, format = defaultFormat, readOnly, loading, type, required, ref, }) {
10
+ const innerId = useId();
11
+ id = id || innerId;
12
+ const inputRef = useRef(null);
13
+ const [innerFocused, setInnerFocused] = useState(false);
14
+ const [innerValue, setInnerValue] = useState(value || []);
15
+ const [inputValue, setInputValue] = useState("");
16
+ const [invalid, setInvalid] = useState(false);
17
+ useDeepCompareEffect(() => {
18
+ if (value && onChangeValue && !isEqual(value, innerValue)) {
19
+ onChangeValue(innerValue);
20
+ }
21
+ }, [innerValue]);
22
+ useDeepCompareEffect(() => {
23
+ if (value && !isEqual(value, innerValue)) {
24
+ setInnerValue(value);
25
+ }
26
+ }, [value || []]);
27
+ const innerRef = useRef({
28
+ get value() {
29
+ return innerValue;
30
+ },
31
+ set value(value) {
32
+ setInnerValue(value);
33
+ },
34
+ });
35
+ useEffect(() => {
36
+ if (ref) {
37
+ if (typeof ref === "function") {
38
+ ref(innerRef.current);
39
+ }
40
+ else {
41
+ try {
42
+ ref.current = innerRef.current;
43
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
+ }
45
+ catch (e) {
46
+ // do nothing
47
+ }
48
+ }
49
+ }
50
+ }, [ref]);
51
+ useDeepCompareEffect(() => {
52
+ if (onChange) {
53
+ onChange({
54
+ target: {
55
+ name,
56
+ value: innerValue,
57
+ },
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ });
60
+ }
61
+ // eslint-disable-next-line react-hooks/exhaustive-deps
62
+ }, [innerValue]);
63
+ return (<InputWrapper id={id} className={className} helpText={(invalid ? invalidHelpText : undefined) || helpText} label={label} error={invalid || error} required={required}>
64
+ <div className="ui-multi-text" onClick={() => inputRef.current?.focus()} data-focused={innerFocused ? "" : undefined} data-error={invalid || error ? "" : undefined} data-loading={loading ? "" : undefined} data-readonly={readOnly ? "" : undefined}>
65
+ {!!innerValue?.length && (<div className="-mx-2 flex w-full flex-wrap gap-0.5">
66
+ {innerValue.map((item, i) => {
67
+ const removeItem = () => {
68
+ const newValue = [...innerValue];
69
+ newValue.splice(i, 1);
70
+ setInnerValue(newValue);
71
+ inputRef.current?.focus();
72
+ };
73
+ return (<span className="ui-multi-text-item" key={i} onClick={(e) => e.stopPropagation()} onDoubleClick={() => {
74
+ setInputValue(item);
75
+ removeItem();
76
+ }}>
77
+ <span className="ui-multi-text-item-content">
78
+ {format(item)}
79
+ </span>
80
+ {!readOnly && (<button className="ui-multi-text-delete-button" onClick={removeItem} type="button">
81
+ <XMarkIcon className="ui-multi-text-delete-icon"/>
82
+ </button>)}
83
+ </span>);
84
+ })}
85
+ </div>)}
86
+ <input id={id} ref={inputRef} type={type || "text"} className="ui-multi-text-input" value={inputValue} onChange={(e) => {
87
+ setInvalid(false);
88
+ setInputValue(e.target.value);
89
+ }} onBlur={(e) => {
90
+ setInnerFocused(false);
91
+ const value = e.currentTarget.value;
92
+ if (value) {
93
+ if (!validate || validate(value)) {
94
+ setInvalid(false);
95
+ setInnerValue(uniq([...(innerValue || []), value]));
96
+ setInputValue("");
97
+ }
98
+ else {
99
+ setInvalid(true);
100
+ }
101
+ }
102
+ onBlur?.(e);
103
+ }} onKeyDown={(e) => {
104
+ const value = e.currentTarget.value;
105
+ if (e.code === "Enter") {
106
+ e.preventDefault();
107
+ if (!validate || validate(value)) {
108
+ setInnerValue(uniq([...(innerValue || []), value]));
109
+ setInputValue("");
110
+ }
111
+ else {
112
+ setInvalid(true);
113
+ }
114
+ }
115
+ }} onFocus={() => setInnerFocused(true)} readOnly={readOnly} required={required && innerValue.length === 0}/>
116
+ </div>
117
+ </InputWrapper>);
118
+ }
119
+ export default MultiText;
@@ -0,0 +1,3 @@
1
+ import MultiText from "./MultiText";
2
+ export * from "./MultiText";
3
+ export default MultiText;
@@ -0,0 +1,3 @@
1
+ import MultiText from "./MultiText";
2
+ export * from "./MultiText";
3
+ export default MultiText;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from "react";
2
+ export default function NavigationDrawer({ children, navigationChildren, position, title, noPadding, panelClassName, }: {
3
+ children: ReactNode;
4
+ navigationChildren: ReactNode;
5
+ position?: "left" | "right";
6
+ title?: ReactNode;
7
+ noPadding?: boolean;
8
+ panelClassName?: string;
9
+ }): import("react").JSX.Element;