@povio/ui 2.1.14 → 2.1.15

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 (498) hide show
  1. package/README.md +74 -0
  2. package/dist/AclGuard.js +12 -0
  3. package/dist/ActionModal.js +51 -0
  4. package/dist/Alert.js +46 -0
  5. package/dist/AlignCenter.js +13 -0
  6. package/dist/AlignLeft.js +13 -0
  7. package/dist/AlignLeftRight.js +13 -0
  8. package/dist/AlignRight.js +13 -0
  9. package/dist/ArrowDropDown.js +13 -0
  10. package/dist/ArrowDropUp.js +13 -0
  11. package/dist/ArrowLeft.js +13 -0
  12. package/dist/ArrowRight.js +13 -0
  13. package/dist/AuthGuard.js +22 -0
  14. package/dist/Autocomplete.js +28 -0
  15. package/dist/Bold.js +13 -0
  16. package/dist/BottomSheet.js +191 -0
  17. package/dist/BulletedList.js +13 -0
  18. package/dist/Button.js +54 -0
  19. package/dist/ButtonContent.js +28 -0
  20. package/dist/Calendar.js +15 -0
  21. package/dist/Calendar2.js +54 -0
  22. package/dist/CalendarCell.js +130 -0
  23. package/dist/CalendarGrid.js +50 -0
  24. package/dist/CalendarHeader.js +75 -0
  25. package/dist/CalendarSelectHeader.js +170 -0
  26. package/dist/Can.js +13 -0
  27. package/dist/CellText.js +13 -0
  28. package/dist/Check.js +15 -0
  29. package/dist/CheckCircle.js +13 -0
  30. package/dist/CheckContent.js +16 -0
  31. package/dist/Checkbox.js +61 -0
  32. package/dist/CheckboxCheckmark.js +16 -0
  33. package/dist/CheckboxCheckmark2.js +25 -0
  34. package/dist/CheckboxIndeterminate.js +16 -0
  35. package/dist/ChevronDown.js +15 -0
  36. package/dist/ChevronLeft.js +15 -0
  37. package/dist/ChevronRight.js +15 -0
  38. package/dist/ChevronUp.js +15 -0
  39. package/dist/ChevronsLeft.js +15 -0
  40. package/dist/ChevronsRight.js +15 -0
  41. package/dist/Clock.js +13 -0
  42. package/dist/Close.js +13 -0
  43. package/dist/ColorPicker.js +16 -0
  44. package/dist/ColorPickerDropdown.js +51 -0
  45. package/dist/ColumnConfig.js +81 -0
  46. package/dist/DateField.js +89 -0
  47. package/dist/DatePicker.js +191 -0
  48. package/dist/DatePickerInput.js +158 -0
  49. package/dist/DateRangePicker.js +601 -0
  50. package/dist/DateSegmentItem.js +29 -0
  51. package/dist/DateTime.js +18 -0
  52. package/dist/DateTimeDialog.js +49 -0
  53. package/dist/DateTimeDialogFooter.js +25 -0
  54. package/dist/DateTimePicker.js +200 -0
  55. package/dist/Drag.js +13 -0
  56. package/dist/Drawer.js +43 -0
  57. package/dist/File.js +15 -0
  58. package/dist/FileCard.js +50 -0
  59. package/dist/FileCardList.js +17 -0
  60. package/dist/FileUpload.js +189 -0
  61. package/dist/FileUploadContainer.js +12 -0
  62. package/dist/FileUploadContent.js +61 -0
  63. package/dist/FileUploadContentEmpty.js +54 -0
  64. package/dist/FileUploadContentError.js +109 -0
  65. package/dist/FileUploadContentFilled.js +112 -0
  66. package/dist/FileUploadContentLoading.js +76 -0
  67. package/dist/Form.js +42 -0
  68. package/dist/FormField.js +35 -0
  69. package/dist/FormFieldError.js +11 -0
  70. package/dist/FormFieldHeader.js +36 -0
  71. package/dist/FormFieldHeaderClose.js +15 -0
  72. package/dist/FormFieldLabel.js +32 -0
  73. package/dist/HeaderText.js +10 -0
  74. package/dist/Highlight.js +13 -0
  75. package/dist/HighlightOn.js +19 -0
  76. package/dist/HyperlinkAction.js +70 -0
  77. package/dist/IconButton.js +12 -0
  78. package/dist/InfiniteTable.js +31 -0
  79. package/dist/Info.js +18 -0
  80. package/dist/InlineIconButton.js +13 -0
  81. package/dist/InputClear.js +19 -0
  82. package/dist/InputContent.js +94 -0
  83. package/dist/InputItem.js +54 -0
  84. package/dist/InputUpload.js +111 -0
  85. package/dist/InputUploadContent.js +52 -0
  86. package/dist/InputUploadFilled.js +26 -0
  87. package/dist/Inputs.js +15 -0
  88. package/dist/Italic.js +13 -0
  89. package/dist/Link.js +13 -0
  90. package/dist/Link2.js +19 -0
  91. package/dist/Loader.js +32 -0
  92. package/dist/Menu.js +13 -0
  93. package/dist/Menu2.js +9 -0
  94. package/dist/MenuDesktop.js +53 -0
  95. package/dist/MenuItem.js +21 -0
  96. package/dist/MenuMobile.js +64 -0
  97. package/dist/MenuPopover.js +30 -0
  98. package/dist/Modal.js +49 -0
  99. package/dist/MonthPicker.js +56 -0
  100. package/dist/NumberInput.js +132 -0
  101. package/dist/NumberedList.js +13 -0
  102. package/dist/PaginatedTable.js +26 -0
  103. package/dist/Pagination.js +43 -0
  104. package/dist/PaginationList.js +105 -0
  105. package/dist/PasswordInput.js +21 -0
  106. package/dist/PillButton.js +37 -0
  107. package/dist/PointerHorizontal.js +13 -0
  108. package/dist/PointerVertical.js +13 -0
  109. package/dist/ProgressBar.js +25 -0
  110. package/dist/QueryAutocomplete.js +18 -0
  111. package/dist/RadioGroup.js +81 -0
  112. package/dist/RangeCalendar.js +96 -0
  113. package/dist/ResponsivePopover.js +41 -0
  114. package/dist/Segment.js +82 -0
  115. package/dist/SegmentItem.js +23 -0
  116. package/dist/Select.js +24 -0
  117. package/dist/SelectBase.js +28 -0
  118. package/dist/SelectDesktop.js +147 -0
  119. package/dist/SelectInput.js +159 -0
  120. package/dist/SelectInputTags.js +29 -0
  121. package/dist/SelectListBox.js +73 -0
  122. package/dist/SelectListBoxItem.js +48 -0
  123. package/dist/SelectListBoxItemSelectAll.js +31 -0
  124. package/dist/SelectListBoxLoadingItem.js +41 -0
  125. package/dist/SelectListBoxSelectionBar.js +25 -0
  126. package/dist/SelectMobile.js +111 -0
  127. package/dist/Send.js +15 -0
  128. package/dist/Slider.js +93 -0
  129. package/dist/SplitButton.js +36 -0
  130. package/dist/Strikethrough.js +13 -0
  131. package/dist/Table.js +248 -0
  132. package/dist/Tag.js +42 -0
  133. package/dist/TextAlignSelect.js +44 -0
  134. package/dist/TextArea.js +120 -0
  135. package/dist/TextButton.js +13 -0
  136. package/dist/TextColor.js +16 -0
  137. package/dist/TextColorSelect.js +22 -0
  138. package/dist/TextEditor.js +143 -0
  139. package/dist/TextEditorToolbar.js +30 -0
  140. package/dist/TextHighlightSelect.js +24 -0
  141. package/dist/TextInput.js +125 -0
  142. package/dist/TextListActions.js +42 -0
  143. package/dist/TextMarksActions.js +67 -0
  144. package/dist/TextStyleSelect.js +52 -0
  145. package/dist/TimeField.js +17 -0
  146. package/dist/TimePicker.js +158 -0
  147. package/dist/TimePickerForm.js +158 -0
  148. package/dist/TimePickerInput.js +92 -0
  149. package/dist/Toast.js +58 -0
  150. package/dist/Today.js +13 -0
  151. package/dist/Toggle.js +60 -0
  152. package/dist/ToggleButton.js +13 -0
  153. package/dist/Tooltip.js +49 -0
  154. package/dist/TooltipEllipsis.js +18 -0
  155. package/dist/TooltipWrapper.js +19 -0
  156. package/dist/Typography.js +14 -0
  157. package/dist/Underlined.js +15 -0
  158. package/dist/Upload.js +16 -0
  159. package/dist/View.js +13 -0
  160. package/dist/ViewOff.js +13 -0
  161. package/dist/WarningFilled.js +15 -0
  162. package/dist/YearPicker.js +64 -0
  163. package/dist/ability.context.js +35 -0
  164. package/dist/alert.cva.js +62 -0
  165. package/dist/array.utils.js +8 -0
  166. package/dist/auth.context.js +37 -0
  167. package/dist/auth.js +6 -12
  168. package/dist/button.cva.js +656 -0
  169. package/dist/buttonContent.cva.js +10 -0
  170. package/dist/checkbox.cva.js +47 -0
  171. package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
  172. package/dist/components/inputs/Checkbox/CheckboxCheckmark.d.ts +2 -2
  173. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +5 -0
  174. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +3 -1
  175. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +3 -1
  176. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +3 -1
  177. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
  178. package/dist/components/inputs/DateTime/shared/DateField.d.ts +1 -0
  179. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +8 -2
  180. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
  181. package/dist/components/inputs/File/fileUpload.types.d.ts +1 -0
  182. package/dist/components/inputs/FormField/FormField.d.ts +4 -1
  183. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +4 -2
  184. package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -0
  185. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -1
  186. package/dist/components/inputs/Input/shared/InputContent.d.ts +4 -3
  187. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -0
  188. package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
  189. package/dist/components/inputs/Toggle/Toggle.d.ts +2 -0
  190. package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
  191. package/dist/compoundMapper.js +11 -0
  192. package/dist/config/uiStyle.context.d.ts +2 -1
  193. package/dist/confirmation.context.js +78 -0
  194. package/dist/date-time.utils.js +50 -0
  195. package/dist/date.utils.js +17 -0
  196. package/dist/dom.utils.js +17 -0
  197. package/dist/dynamicColumns.js +272 -0
  198. package/dist/dynamicInputs.js +186 -0
  199. package/dist/error-handling.js +87 -0
  200. package/dist/file.utils.js +43 -0
  201. package/dist/fileUpload.cva.js +49 -0
  202. package/dist/i18n.js +8 -0
  203. package/dist/index.js +136 -278
  204. package/dist/input.cva.js +210 -0
  205. package/dist/inputUploadButton.cva.js +27 -0
  206. package/dist/isEqual.js +57 -0
  207. package/dist/label.cva.js +104 -0
  208. package/dist/link.context.js +17 -0
  209. package/dist/link.cva.js +7 -0
  210. package/dist/loader.cva.js +16 -0
  211. package/dist/logger.js +17 -0
  212. package/dist/menu.cva.js +27 -0
  213. package/dist/minWidth.cva.js +9 -0
  214. package/dist/modal.cva.js +31 -0
  215. package/dist/object.utils.js +36 -0
  216. package/dist/outline.clsx.js +4 -0
  217. package/dist/pillButton.cva.js +254 -0
  218. package/dist/queries.utils.js +7 -0
  219. package/dist/radio.cva.js +42 -0
  220. package/dist/react.js +6 -0
  221. package/dist/rest-interceptor.js +22 -0
  222. package/dist/rest.utils.js +31 -0
  223. package/dist/rolldown_runtime.js +16 -0
  224. package/dist/router.context.js +37 -0
  225. package/dist/routing.utils.js +9 -0
  226. package/dist/segment.cva.js +25 -0
  227. package/dist/select.context.js +190 -0
  228. package/dist/status.cva.js +57 -0
  229. package/dist/string.utils.js +10 -0
  230. package/dist/table.cva.js +35 -0
  231. package/dist/tag.cva.js +50 -0
  232. package/dist/text-editor.js +2 -4
  233. package/dist/textEditor.types.js +38 -0
  234. package/dist/theme.context.js +65 -0
  235. package/dist/toast.cva.js +158 -0
  236. package/dist/toggle.cva.js +27 -0
  237. package/dist/tooltip.cva.js +30 -0
  238. package/dist/translation.js +147 -0
  239. package/dist/translation2.js +145 -0
  240. package/dist/typography.cva.js +124 -0
  241. package/dist/uiConfig.context.js +58 -0
  242. package/dist/uiStyle.context.js +16 -0
  243. package/dist/useAutosave.js +62 -0
  244. package/dist/useBreakpoint.js +28 -0
  245. package/dist/useDebounceCallback.js +23 -0
  246. package/dist/useDeepCompare.js +21 -0
  247. package/dist/useFilters.js +121 -0
  248. package/dist/useForm.js +12 -0
  249. package/dist/useFormAutosave.js +52 -0
  250. package/dist/useIntersectionObserver.js +23 -0
  251. package/dist/useLocalStorage.js +35 -0
  252. package/dist/useLongPressRepeat.js +27 -0
  253. package/dist/usePagination.js +26 -0
  254. package/dist/useScrollableListBox.js +24 -0
  255. package/dist/useSelectItems.js +82 -0
  256. package/dist/useSorting.js +34 -0
  257. package/dist/useStateAndRef.js +15 -0
  258. package/dist/useTableColumnConfig.js +38 -0
  259. package/dist/useTableNav.js +279 -0
  260. package/dist/useToast.js +63 -0
  261. package/dist/useTranslationMemo.js +10 -0
  262. package/dist/zod.utils.js +17 -0
  263. package/package.json +14 -14
  264. package/dist/assets/icons/AlignCenter.js +0 -21
  265. package/dist/assets/icons/AlignLeft.js +0 -21
  266. package/dist/assets/icons/AlignLeftRight.js +0 -21
  267. package/dist/assets/icons/AlignRight.js +0 -21
  268. package/dist/assets/icons/ArrowDropDown.js +0 -21
  269. package/dist/assets/icons/ArrowDropUp.js +0 -21
  270. package/dist/assets/icons/ArrowLeft.js +0 -21
  271. package/dist/assets/icons/ArrowRight.js +0 -21
  272. package/dist/assets/icons/Bold.js +0 -21
  273. package/dist/assets/icons/BulletedList.js +0 -21
  274. package/dist/assets/icons/Calendar.js +0 -23
  275. package/dist/assets/icons/Check.js +0 -23
  276. package/dist/assets/icons/CheckCircle.js +0 -21
  277. package/dist/assets/icons/CheckboxCheckmark.js +0 -24
  278. package/dist/assets/icons/CheckboxIndeterminate.js +0 -24
  279. package/dist/assets/icons/ChevronDown.js +0 -23
  280. package/dist/assets/icons/ChevronLeft.js +0 -23
  281. package/dist/assets/icons/ChevronRight.js +0 -23
  282. package/dist/assets/icons/ChevronUp.js +0 -23
  283. package/dist/assets/icons/ChevronsLeft.js +0 -23
  284. package/dist/assets/icons/ChevronsRight.js +0 -23
  285. package/dist/assets/icons/Clock.js +0 -21
  286. package/dist/assets/icons/Close.js +0 -21
  287. package/dist/assets/icons/DateTime.js +0 -32
  288. package/dist/assets/icons/Drag.js +0 -21
  289. package/dist/assets/icons/File.js +0 -23
  290. package/dist/assets/icons/Highlight.js +0 -21
  291. package/dist/assets/icons/HighlightOn.js +0 -30
  292. package/dist/assets/icons/Info.js +0 -32
  293. package/dist/assets/icons/Italic.js +0 -21
  294. package/dist/assets/icons/Link.js +0 -21
  295. package/dist/assets/icons/Menu.js +0 -21
  296. package/dist/assets/icons/NumberedList.js +0 -21
  297. package/dist/assets/icons/PointerHorizontal.js +0 -21
  298. package/dist/assets/icons/PointerVertical.js +0 -21
  299. package/dist/assets/icons/Send.js +0 -23
  300. package/dist/assets/icons/Strikethrough.js +0 -21
  301. package/dist/assets/icons/TextColor.js +0 -30
  302. package/dist/assets/icons/Today.js +0 -21
  303. package/dist/assets/icons/Underlined.js +0 -23
  304. package/dist/assets/icons/Upload.js +0 -30
  305. package/dist/assets/icons/View.js +0 -18
  306. package/dist/assets/icons/ViewOff.js +0 -18
  307. package/dist/assets/icons/WarningFilled.js +0 -23
  308. package/dist/assets/locales/en/translation.json.js +0 -14
  309. package/dist/assets/locales/sl/translation.json.js +0 -14
  310. package/dist/components/Menu/Menu.js +0 -14
  311. package/dist/components/Menu/MenuDesktop.js +0 -74
  312. package/dist/components/Menu/MenuItem.js +0 -27
  313. package/dist/components/Menu/MenuMobile.js +0 -83
  314. package/dist/components/Menu/MenuPopover.js +0 -43
  315. package/dist/components/Menu/menu.cva.js +0 -45
  316. package/dist/components/buttons/Button/Button.js +0 -73
  317. package/dist/components/buttons/Button/button.cva.js +0 -666
  318. package/dist/components/buttons/IconButton/IconButton.js +0 -17
  319. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +0 -18
  320. package/dist/components/buttons/PillButton/PillButton.js +0 -44
  321. package/dist/components/buttons/PillButton/pillButton.cva.js +0 -268
  322. package/dist/components/buttons/SplitButton/SplitButton.js +0 -65
  323. package/dist/components/buttons/TextButton/TextButton.js +0 -18
  324. package/dist/components/buttons/ToggleButton/ToggleButton.js +0 -21
  325. package/dist/components/buttons/shared/ButtonContent.js +0 -53
  326. package/dist/components/buttons/shared/buttonContent.cva.js +0 -16
  327. package/dist/components/inputs/Checkbox/Checkbox.js +0 -81
  328. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +0 -32
  329. package/dist/components/inputs/Checkbox/checkbox.cva.js +0 -51
  330. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +0 -251
  331. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +0 -689
  332. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +0 -265
  333. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +0 -217
  334. package/dist/components/inputs/DateTime/shared/Calendar.js +0 -85
  335. package/dist/components/inputs/DateTime/shared/CalendarCell.js +0 -160
  336. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +0 -67
  337. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +0 -89
  338. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +0 -203
  339. package/dist/components/inputs/DateTime/shared/DateField.js +0 -77
  340. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +0 -206
  341. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +0 -55
  342. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +0 -76
  343. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +0 -47
  344. package/dist/components/inputs/DateTime/shared/MonthPicker.js +0 -82
  345. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +0 -133
  346. package/dist/components/inputs/DateTime/shared/TimeField.js +0 -26
  347. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +0 -186
  348. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +0 -125
  349. package/dist/components/inputs/DateTime/shared/YearPicker.js +0 -89
  350. package/dist/components/inputs/File/FileUpload.js +0 -257
  351. package/dist/components/inputs/File/FileUploadContainer.js +0 -17
  352. package/dist/components/inputs/File/InputUpload.js +0 -174
  353. package/dist/components/inputs/File/shared/FileCard.js +0 -67
  354. package/dist/components/inputs/File/shared/FileCardList.js +0 -20
  355. package/dist/components/inputs/File/shared/FileUploadContent.js +0 -92
  356. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +0 -92
  357. package/dist/components/inputs/File/shared/FileUploadContentError.js +0 -167
  358. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +0 -173
  359. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +0 -128
  360. package/dist/components/inputs/File/shared/InputUploadContent.js +0 -73
  361. package/dist/components/inputs/File/shared/InputUploadFilled.js +0 -45
  362. package/dist/components/inputs/File/shared/ProgressBar.js +0 -42
  363. package/dist/components/inputs/File/shared/fileUpload.cva.js +0 -58
  364. package/dist/components/inputs/File/shared/inputUploadButton.cva.js +0 -49
  365. package/dist/components/inputs/FormField/FormField.js +0 -54
  366. package/dist/components/inputs/FormField/FormFieldError.js +0 -16
  367. package/dist/components/inputs/FormField/FormFieldHeader.js +0 -57
  368. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +0 -20
  369. package/dist/components/inputs/FormField/FormFieldLabel.js +0 -37
  370. package/dist/components/inputs/Input/NumberInput/NumberInput.js +0 -166
  371. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +0 -26
  372. package/dist/components/inputs/Input/TextArea/TextArea.js +0 -155
  373. package/dist/components/inputs/Input/TextInput/TextInput.js +0 -162
  374. package/dist/components/inputs/Input/shared/InputContent.js +0 -114
  375. package/dist/components/inputs/Inputs/Form.js +0 -68
  376. package/dist/components/inputs/Inputs/InputItem.js +0 -61
  377. package/dist/components/inputs/Inputs/Inputs.js +0 -32
  378. package/dist/components/inputs/RadioGroup/RadioGroup.js +0 -103
  379. package/dist/components/inputs/RadioGroup/radio.cva.js +0 -57
  380. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +0 -39
  381. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +0 -25
  382. package/dist/components/inputs/Selection/Select/Select.js +0 -32
  383. package/dist/components/inputs/Selection/shared/SelectBase.js +0 -27
  384. package/dist/components/inputs/Selection/shared/SelectDesktop.js +0 -223
  385. package/dist/components/inputs/Selection/shared/SelectInput.js +0 -234
  386. package/dist/components/inputs/Selection/shared/SelectInputTags.js +0 -49
  387. package/dist/components/inputs/Selection/shared/SelectListBox.js +0 -127
  388. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +0 -78
  389. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +0 -45
  390. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +0 -47
  391. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +0 -42
  392. package/dist/components/inputs/Selection/shared/SelectMobile.js +0 -165
  393. package/dist/components/inputs/Selection/shared/select.context.js +0 -244
  394. package/dist/components/inputs/Selection/shared/useSelectItems.js +0 -94
  395. package/dist/components/inputs/Slider/Slider.js +0 -137
  396. package/dist/components/inputs/TextEditor/TextEditor.js +0 -223
  397. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +0 -34
  398. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +0 -80
  399. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +0 -92
  400. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +0 -56
  401. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +0 -33
  402. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +0 -31
  403. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +0 -37
  404. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +0 -51
  405. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +0 -73
  406. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +0 -61
  407. package/dist/components/inputs/TextEditor/textEditor.types.js +0 -40
  408. package/dist/components/inputs/Toggle/Toggle.js +0 -65
  409. package/dist/components/inputs/Toggle/toggle.cva.js +0 -44
  410. package/dist/components/inputs/shared/CheckContent.js +0 -22
  411. package/dist/components/inputs/shared/InputClear.js +0 -27
  412. package/dist/components/inputs/shared/TooltipWrapper.js +0 -23
  413. package/dist/components/inputs/shared/input.cva.js +0 -174
  414. package/dist/components/inputs/shared/label.cva.js +0 -128
  415. package/dist/components/outline.clsx.js +0 -11
  416. package/dist/components/overlays/ActionModal/ActionModal.js +0 -80
  417. package/dist/components/overlays/BottomSheet/BottomSheet.js +0 -261
  418. package/dist/components/overlays/Drawer/Drawer.js +0 -84
  419. package/dist/components/overlays/Modal/Modal.js +0 -64
  420. package/dist/components/overlays/Modal/modal.cva.js +0 -53
  421. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +0 -71
  422. package/dist/components/overlays/Tooltip/Tooltip.js +0 -92
  423. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +0 -27
  424. package/dist/components/overlays/Tooltip/tooltip.cva.js +0 -60
  425. package/dist/components/segment/Segment.js +0 -118
  426. package/dist/components/segment/SegmentItem.js +0 -35
  427. package/dist/components/segment/segment.cva.js +0 -35
  428. package/dist/components/shared/pagination/Pagination.js +0 -75
  429. package/dist/components/shared/pagination/PaginationList.js +0 -145
  430. package/dist/components/shared/pagination/minWidth.cva.js +0 -15
  431. package/dist/components/status/Alert/Alert.js +0 -41
  432. package/dist/components/status/Alert/alert.cva.js +0 -64
  433. package/dist/components/status/Loader/Loader.js +0 -37
  434. package/dist/components/status/Loader/loader.cva.js +0 -27
  435. package/dist/components/status/Toast/Toast.js +0 -65
  436. package/dist/components/status/Toast/toast.cva.js +0 -150
  437. package/dist/components/status/Toast/useToast.js +0 -94
  438. package/dist/components/status/shared/status.cva.js +0 -62
  439. package/dist/components/table/CellText.js +0 -18
  440. package/dist/components/table/ColumnConfig.js +0 -124
  441. package/dist/components/table/HeaderText.js +0 -15
  442. package/dist/components/table/InfiniteTable.js +0 -40
  443. package/dist/components/table/PaginatedTable.js +0 -33
  444. package/dist/components/table/Table.js +0 -370
  445. package/dist/components/table/table.cva.js +0 -63
  446. package/dist/components/text/Link/Link.js +0 -24
  447. package/dist/components/text/Link/link.cva.js +0 -18
  448. package/dist/components/text/Tag/Tag.js +0 -49
  449. package/dist/components/text/Tag/tag.cva.js +0 -59
  450. package/dist/components/text/Typography/Typography.js +0 -22
  451. package/dist/components/text/Typography/typography.cva.js +0 -100
  452. package/dist/config/confirmation.context.js +0 -107
  453. package/dist/config/i18n.js +0 -15
  454. package/dist/config/link.context.js +0 -19
  455. package/dist/config/router.context.js +0 -39
  456. package/dist/config/theme.context.js +0 -73
  457. package/dist/config/uiConfig.context.js +0 -69
  458. package/dist/config/uiStyle.context.js +0 -16
  459. package/dist/helpers/dynamicColumns.js +0 -359
  460. package/dist/helpers/dynamicInputs.js +0 -212
  461. package/dist/hooks/useAutosave.js +0 -83
  462. package/dist/hooks/useBreakpoint.js +0 -33
  463. package/dist/hooks/useDebounceCallback.js +0 -29
  464. package/dist/hooks/useDeepCompare.js +0 -25
  465. package/dist/hooks/useFilters.js +0 -160
  466. package/dist/hooks/useForm.js +0 -22
  467. package/dist/hooks/useFormAutosave.js +0 -67
  468. package/dist/hooks/useIntersectionObserver.js +0 -27
  469. package/dist/hooks/useLocalStorage.js +0 -54
  470. package/dist/hooks/useLongPressRepeat.js +0 -33
  471. package/dist/hooks/usePagination.js +0 -35
  472. package/dist/hooks/useScrollableListBox.js +0 -30
  473. package/dist/hooks/useSorting.js +0 -32
  474. package/dist/hooks/useStateAndRef.js +0 -17
  475. package/dist/hooks/useTableColumnConfig.js +0 -63
  476. package/dist/hooks/useTableNav.js +0 -394
  477. package/dist/hooks/useTranslationMemo.js +0 -14
  478. package/dist/utils/array.utils.js +0 -12
  479. package/dist/utils/compoundMapper.js +0 -14
  480. package/dist/utils/date-time.utils.js +0 -77
  481. package/dist/utils/date.utils.js +0 -23
  482. package/dist/utils/dom.utils.js +0 -13
  483. package/dist/utils/file.utils.js +0 -63
  484. package/dist/utils/isEqual.js +0 -95
  485. package/dist/utils/logger.js +0 -19
  486. package/dist/utils/object.utils.js +0 -53
  487. package/dist/utils/queries.utils.js +0 -9
  488. package/dist/utils/rest.utils.js +0 -51
  489. package/dist/utils/routing.utils.js +0 -15
  490. package/dist/utils/string.utils.js +0 -12
  491. package/dist/utils/vendor/acl/AclGuard.js +0 -14
  492. package/dist/utils/vendor/acl/Can.js +0 -18
  493. package/dist/utils/vendor/acl/ability.context.js +0 -37
  494. package/dist/utils/vendor/auth/AuthGuard.js +0 -26
  495. package/dist/utils/vendor/auth/auth.context.js +0 -41
  496. package/dist/utils/vendor/error-handling.js +0 -119
  497. package/dist/utils/vendor/rest-interceptor.js +0 -21
  498. package/dist/utils/zod.utils.js +0 -21
@@ -1,359 +0,0 @@
1
- import i18next from "i18next";
2
- import { z } from "zod";
3
- import { DateUtils } from "../utils/date.utils.js";
4
- import { StringUtils } from "../utils/string.utils.js";
5
- import { ZodUtils } from "../utils/zod.utils.js";
6
- const DEFAULT_NAMESPACE = "dynamicColumns";
7
- const FORMAT_MAP = {
8
- datetime: (value) => DateUtils.formatDate(new Date(value)),
9
- dateRange: (value) => {
10
- const startDate = DateUtils.formatDate(new Date(value.start));
11
- const endDate = DateUtils.formatDate(new Date(value.end));
12
- return `${startDate} - ${endDate}`;
13
- },
14
- enum: (value) => StringUtils.capitalize(value),
15
- number: (value) => value.toLocaleString(i18next.language),
16
- string: (value) => String(value),
17
- boolean: (value) => {
18
- const key = `${DEFAULT_NAMESPACE}.${value ? "yes" : "no"}`;
19
- if (i18next.exists(key)) {
20
- return String(i18next.t(key));
21
- }
22
- return value ? "Yes" : "No";
23
- }
24
- };
25
- const ZOD_TYPE_FORMAT_MAP = [
26
- [z.ZodEnum, FORMAT_MAP.enum],
27
- [z.ZodNumber, FORMAT_MAP.number],
28
- [z.ZodString, FORMAT_MAP.string],
29
- [z.ZodBoolean, FORMAT_MAP.boolean],
30
- [z.ZodISODateTime, FORMAT_MAP.datetime]
31
- ];
32
- const configValueToColumnDef = (value) => {
33
- if (typeof value === "function" || typeof value === "string") {
34
- return {
35
- cell: value
36
- };
37
- }
38
- if (typeof value === "boolean" || value === void 0) {
39
- return {};
40
- }
41
- return value;
42
- };
43
- const convertEntriesToColumnDefs = (entries) => {
44
- return entries.map(([key, value]) => [key, configValueToColumnDef(value)]);
45
- };
46
- const customConfigValueToColumnDef = (value) => {
47
- if (typeof value === "string") {
48
- return {
49
- accessorKey: value,
50
- cell: value
51
- };
52
- }
53
- if (typeof value === "function") {
54
- return {
55
- cell: value
56
- };
57
- }
58
- return value;
59
- };
60
- const convertCustomEntriesToColumnDefs = (entries) => {
61
- return entries.map(([key, value]) => [key, customConfigValueToColumnDef(value)]);
62
- };
63
- const excludeEntries = (entries) => {
64
- return entries.filter(([, value]) => value !== false && value !== void 0);
65
- };
66
- const sortColumns = (columns, orderKeys) => {
67
- if (!orderKeys) {
68
- return columns;
69
- }
70
- const wildcardIndex = orderKeys.indexOf("*");
71
- if (wildcardIndex === -1) {
72
- return columns.sort((columnA, columnB) => {
73
- const idA = columnA.id;
74
- const idB = columnB.id;
75
- const orderMap = new Map(orderKeys.map((key, index) => [String(key), index]));
76
- const orderA = orderMap.get(String(idA));
77
- const orderB = orderMap.get(String(idB));
78
- if (orderA !== void 0 && orderB !== void 0) {
79
- return orderA - orderB;
80
- }
81
- if (orderA !== void 0 && orderB === void 0) {
82
- return -1;
83
- }
84
- if (orderA === void 0 && orderB !== void 0) {
85
- return 1;
86
- }
87
- return 0;
88
- });
89
- }
90
- const beforeWildcard = orderKeys.slice(0, wildcardIndex);
91
- const afterWildcard = orderKeys.slice(wildcardIndex + 1);
92
- const beforeMap = new Map(beforeWildcard.map((key, index) => [String(key), index]));
93
- const afterMap = new Map(afterWildcard.map((key, index) => [String(key), index]));
94
- const before = [];
95
- const middle = [];
96
- const after = [];
97
- columns.forEach((column) => {
98
- const id = String(column.id);
99
- if (beforeMap.has(id)) {
100
- before.push(column);
101
- } else if (afterMap.has(id)) {
102
- after.push(column);
103
- } else {
104
- middle.push(column);
105
- }
106
- });
107
- before.sort((a, b) => beforeMap.get(String(a.id)) - beforeMap.get(String(b.id)));
108
- after.sort((a, b) => afterMap.get(String(a.id)) - afterMap.get(String(b.id)));
109
- return [...before, ...middle, ...after];
110
- };
111
- const formatValueByType = (value, schemaType) => {
112
- if (value === null || value === void 0) {
113
- return null;
114
- }
115
- if (ZodUtils.isDateRange(schemaType)) {
116
- return FORMAT_MAP.dateRange(value);
117
- }
118
- const unwrappedType = ZodUtils.unwrapZodType(schemaType);
119
- if (unwrappedType instanceof z.ZodArray) {
120
- if (!Array.isArray(value)) {
121
- return null;
122
- }
123
- const elementType = unwrappedType.element;
124
- const formattedElements = value.map((element) => formatValueByType(element, elementType));
125
- return formattedElements.join(", ");
126
- }
127
- const formatFunction = ZOD_TYPE_FORMAT_MAP.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
128
- if (formatFunction) {
129
- return formatFunction(value);
130
- }
131
- return String(value);
132
- };
133
- const getNestedValue = (obj, path) => {
134
- return path.split(".").reduce((current, key) => {
135
- return current && typeof current === "object" ? current[key] : void 0;
136
- }, obj);
137
- };
138
- const getKeyType = (schema, key) => {
139
- const pathParts = key.split(".");
140
- let currentType = schema.shape[pathParts[0]];
141
- for (let i = 1; i < pathParts.length; i++) {
142
- if (currentType instanceof z.ZodObject) {
143
- currentType = currentType.shape[pathParts[i]];
144
- } else {
145
- currentType = schema.shape[key];
146
- break;
147
- }
148
- }
149
- return currentType;
150
- };
151
- const getCellFunction = (schema, schemaKey, columnDef, options) => {
152
- const { cell } = columnDef;
153
- if (typeof cell === "function") {
154
- return cell;
155
- }
156
- return ({ data }) => {
157
- const isCellKeyString = typeof cell === "string";
158
- const key = isCellKeyString ? cell : schemaKey;
159
- const value = getNestedValue(data, key);
160
- const keyType = getKeyType(schema, key);
161
- const shouldFormat = !options.disableFormatting?.includes(key);
162
- const formattedValue = shouldFormat ? formatValueByType(value, keyType) : value;
163
- let finalValue = formattedValue;
164
- if (options.emptyValue && !finalValue) {
165
- finalValue = options.emptyValue;
166
- }
167
- if (options.globalWrapper) {
168
- return options.globalWrapper(finalValue);
169
- }
170
- return finalValue;
171
- };
172
- };
173
- const normalizeSortable = (sortable) => {
174
- if (!sortable) {
175
- return void 0;
176
- }
177
- if (Array.isArray(sortable)) {
178
- return sortable;
179
- }
180
- if (sortable instanceof z.ZodEnum) {
181
- return Object.values(sortable.enum);
182
- }
183
- return void 0;
184
- };
185
- const getDefaultColumnHeader = (key, options) => {
186
- const namespace = options.namespace ?? DEFAULT_NAMESPACE;
187
- const localeKey = `${namespace}.${key}`;
188
- if (i18next.exists(localeKey)) {
189
- return String(i18next.t(localeKey));
190
- }
191
- return StringUtils.capitalize(key);
192
- };
193
- const overridePresetColumnsHeaders = (presetColumns, options) => {
194
- const namespace = options.namespace ?? DEFAULT_NAMESPACE;
195
- return presetColumns.map((columnDef) => {
196
- const localeKey = `${namespace}.${columnDef.id}`;
197
- const header = i18next.exists(localeKey) ? i18next.t(localeKey) : columnDef.header;
198
- return {
199
- ...columnDef,
200
- header: typeof header === "string" ? header : columnDef.header
201
- };
202
- });
203
- };
204
- const populateColumnDef = (schema, key, columnDef, options, sortableKeys) => {
205
- const id = columnDef.id ?? key;
206
- const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
207
- const header = columnDef.header ?? getDefaultColumnHeader(key, options);
208
- const cell = getCellFunction(schema, key, columnDef, options);
209
- return {
210
- ...columnDef,
211
- id,
212
- accessorKey: key,
213
- meta: {
214
- width: "flex-1",
215
- ...options.globalMeta,
216
- ...columnDef.meta
217
- },
218
- header,
219
- enableSorting,
220
- cell
221
- };
222
- };
223
- const populateCustomColumnDef = (schema, key, columnDef, options, sortableKeys) => {
224
- const id = columnDef.id ?? key;
225
- const accessorKey = columnDef.accessorKey ?? id;
226
- const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
227
- const header = columnDef.header ?? getDefaultColumnHeader(key, options);
228
- const cell = getCellFunction(schema, key, columnDef, options);
229
- return {
230
- ...columnDef,
231
- id,
232
- accessorKey,
233
- meta: {
234
- width: "flex-1",
235
- ...options.globalMeta,
236
- ...columnDef.meta
237
- },
238
- header,
239
- enableSorting,
240
- cell
241
- };
242
- };
243
- const addMissingSchemaFields = (schema, existingColumns, options, sortableKeys) => {
244
- const schemaFields = getAllSchemaKeys(schema);
245
- const definedFields = new Set(existingColumns.map((col) => col.id));
246
- const missingFields = schemaFields.filter((field) => !definedFields.has(field));
247
- const additionalColumns = missingFields.map((field) => {
248
- return populateColumnDef(schema, field, {}, options, sortableKeys);
249
- });
250
- return [...existingColumns, ...additionalColumns];
251
- };
252
- const removeOverriddenPresetColumns = (presetColumns, options) => {
253
- if (presetColumns.length === 0) {
254
- return presetColumns;
255
- }
256
- const usedColumnsIds = Object.entries(options.columns ?? {}).map(([key, value]) => {
257
- const columnDef = value;
258
- return columnDef.id ?? key;
259
- });
260
- const usedCustomColumnsIds = Object.entries(options.customColumns ?? {}).map(([key, value]) => {
261
- const columnDef = value;
262
- return columnDef.id ?? key;
263
- });
264
- const usedIds = /* @__PURE__ */ new Set([...usedColumnsIds, ...usedCustomColumnsIds]);
265
- return presetColumns.filter((column) => {
266
- if (!column.id) {
267
- return true;
268
- }
269
- return !usedIds.has(column.id);
270
- });
271
- };
272
- const getAllSchemaKeys = (schema) => {
273
- const keys = [];
274
- const { shape } = schema;
275
- const traverse = (obj, prefix = "") => {
276
- Object.entries(obj).forEach(([key, value]) => {
277
- const currentPath = prefix ? `${prefix}.${key}` : key;
278
- keys.push(currentPath);
279
- if (value instanceof z.ZodObject) {
280
- traverse(value.shape, currentPath);
281
- }
282
- });
283
- };
284
- traverse(shape);
285
- return keys;
286
- };
287
- const validateCustomColumnKeys = (schema, customColumnKeys) => {
288
- const schemaKeys = getAllSchemaKeys(schema);
289
- const invalidCustomColumnKeys = customColumnKeys.filter(
290
- (key) => schemaKeys.includes(key)
291
- );
292
- if (invalidCustomColumnKeys.length > 0) {
293
- throw new Error(
294
- `Invalid custom column keys: [${invalidCustomColumnKeys.join(", ")}]. Custom column keys cannot be part of the schema. Define these columns in the "columns" property instead.`
295
- );
296
- }
297
- };
298
- const validateOptionKeyArray = (usedKeys, optionKeys, optionName) => {
299
- if (!optionKeys) {
300
- return;
301
- }
302
- const extraUnusedKeys = optionKeys.filter((key) => !usedKeys.has(key));
303
- if (extraUnusedKeys.length > 0) {
304
- throw new Error(
305
- `Found unnecessary keys in "${optionName}": [${extraUnusedKeys.join(", ")}].
306
-
307
- All available options are: [${Array.from(usedKeys).join(", ")}].`
308
- );
309
- }
310
- };
311
- const validateParams = (schema, presetColumns, options) => {
312
- const { columns, customColumns, sortable, order, disableFormatting, includeAll } = options;
313
- const columnKeys = Object.keys(columns ?? {});
314
- const customColumnKeys = customColumns ? Object.keys(customColumns) : [];
315
- const usedKeys = /* @__PURE__ */ new Set([...columnKeys, ...customColumnKeys]);
316
- const presetKeys = presetColumns.map((column) => column.id).filter((id) => id !== void 0);
317
- const schemaKeys = includeAll ? getAllSchemaKeys(schema) : [];
318
- const allKeys = /* @__PURE__ */ new Set([...presetKeys, ...usedKeys, ...schemaKeys, "*"]);
319
- if (customColumns) {
320
- validateCustomColumnKeys(schema, customColumnKeys);
321
- }
322
- if (Array.isArray(sortable)) {
323
- validateOptionKeyArray(usedKeys, sortable, "sortable");
324
- }
325
- validateOptionKeyArray(allKeys, order, "order");
326
- validateOptionKeyArray(usedKeys, disableFormatting, "disableFormatting");
327
- };
328
- const dynamicColumns = ({
329
- schema,
330
- preset = [],
331
- options
332
- }) => {
333
- validateParams(schema, preset, options);
334
- const sortableKeys = normalizeSortable(options.sortable);
335
- let entries = Object.entries(options.columns ?? {});
336
- entries = excludeEntries(entries);
337
- entries = convertEntriesToColumnDefs(entries);
338
- const columns = entries.map(([key, value]) => {
339
- const columnDef = value;
340
- return populateColumnDef(schema, key, columnDef, options, sortableKeys);
341
- });
342
- let customEntries = Object.entries(options.customColumns ?? {});
343
- customEntries = convertCustomEntriesToColumnDefs(customEntries);
344
- const customColumns = customEntries.map(([key, value]) => {
345
- const columnDef = value;
346
- return populateCustomColumnDef(schema, key, columnDef, options, sortableKeys);
347
- });
348
- let presetColumns = removeOverriddenPresetColumns(preset, options);
349
- if (options.overridePresetLocales) {
350
- presetColumns = overridePresetColumnsHeaders(presetColumns, options);
351
- }
352
- const mergedColumns = [...presetColumns, ...columns, ...customColumns];
353
- const allColumns = options.includeAll ? addMissingSchemaFields(schema, mergedColumns, options, sortableKeys) : mergedColumns;
354
- return sortColumns(allColumns, options.order);
355
- };
356
- export {
357
- dynamicColumns,
358
- sortColumns
359
- };
@@ -1,212 +0,0 @@
1
- import i18next from "i18next";
2
- import { z } from "zod";
3
- import { StringUtils } from "../utils/string.utils.js";
4
- import { ZodUtils } from "../utils/zod.utils.js";
5
- const defaultComponentTypes = {
6
- datetime: "datePicker",
7
- dateRange: "dateRangePicker",
8
- boolean: "toggle",
9
- number: "numberInput",
10
- enum: "select",
11
- string: "textInput",
12
- email: "textInput",
13
- object: "unknown",
14
- array: "select",
15
- uuid: "select",
16
- unknown: "unknown"
17
- };
18
- const ZOD_TYPE_COMPONENT_TYPE = [
19
- [z.ZodBoolean, defaultComponentTypes.boolean],
20
- [z.ZodNumber, defaultComponentTypes.number],
21
- [z.ZodEnum, defaultComponentTypes.enum],
22
- [z.ZodISODateTime, defaultComponentTypes.datetime],
23
- [z.ZodString, defaultComponentTypes.string],
24
- [z.ZodEmail, defaultComponentTypes.email],
25
- [z.ZodObject, defaultComponentTypes.object],
26
- [z.ZodArray, defaultComponentTypes.array],
27
- [z.ZodUUID, defaultComponentTypes.uuid]
28
- ];
29
- const DEFAULT_NAMESPACE = "dynamicInputs";
30
- const sortInputDefs = (inputDefs, orderKeys) => {
31
- if (!orderKeys) {
32
- return inputDefs;
33
- }
34
- return inputDefs.sort((a, b) => {
35
- const orderMap = new Map(orderKeys.map((key, index) => [key, index]));
36
- const orderA = orderMap.get(a.name);
37
- const orderB = orderMap.get(b.name);
38
- if (orderA !== void 0 && orderB !== void 0) {
39
- return orderA - orderB;
40
- }
41
- if (orderA !== void 0 && orderB === void 0) {
42
- return -1;
43
- }
44
- if (orderA === void 0 && orderB !== void 0) {
45
- return 1;
46
- }
47
- return 0;
48
- });
49
- };
50
- const excludeEntries = (entries) => {
51
- return entries.filter(([, value]) => value !== false && value !== void 0);
52
- };
53
- const inputConfigToObjectDefinition = (value) => {
54
- if (typeof value === "object") {
55
- return value;
56
- }
57
- if (typeof value === "function") {
58
- return { render: value };
59
- }
60
- return {};
61
- };
62
- const convertInputsConfigToObjectDefinitions = (entries) => {
63
- return entries.map(([key, value]) => {
64
- const k = key;
65
- return [k, inputConfigToObjectDefinition(value)];
66
- });
67
- };
68
- const getDefaultInputComponentType = (schemaType) => {
69
- if (ZodUtils.isDateRange(schemaType)) {
70
- return defaultComponentTypes.dateRange;
71
- }
72
- const unwrappedType = ZodUtils.unwrapZodType(schemaType);
73
- const componentType = ZOD_TYPE_COMPONENT_TYPE.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
74
- if (componentType) {
75
- return componentType;
76
- }
77
- return defaultComponentTypes.unknown;
78
- };
79
- const getDefaultSelectionItems = (keyType) => {
80
- const unwrappedType = ZodUtils.unwrapZodType(keyType instanceof z.ZodArray ? keyType.element : keyType);
81
- if (unwrappedType instanceof z.ZodEnum) {
82
- return Object.values(unwrappedType.options).filter((value) => typeof value === "string").map((value) => ({ id: value, label: StringUtils.capitalize(value) }));
83
- }
84
- return [];
85
- };
86
- const getDefaultSelectionMode = (keyType) => {
87
- return keyType instanceof z.ZodArray ? "multiple" : "single";
88
- };
89
- const getDefaultProps = (componentType, keyType) => {
90
- const props = {};
91
- const unwrappedType = ZodUtils.unwrapZodType(keyType);
92
- if (["select", "autocomplete", "segment"].includes(componentType)) {
93
- props.items = getDefaultSelectionItems(unwrappedType);
94
- }
95
- if (["select", "autocomplete", "queryAutocomplete", "segment"].includes(componentType)) {
96
- props.selectionMode = getDefaultSelectionMode(unwrappedType);
97
- }
98
- return props;
99
- };
100
- const getLabelAndPlaceholder = (value, options, schemaKey) => {
101
- const namespace = options.namespace ?? DEFAULT_NAMESPACE;
102
- const stringKey = String(schemaKey);
103
- let { label, placeholder } = value;
104
- if (!label) {
105
- const key = `${namespace}.${stringKey}.label`;
106
- const translation = i18next.exists(key) ? i18next.t(key) : null;
107
- label = typeof translation === "string" ? translation : StringUtils.capitalize(stringKey);
108
- }
109
- if (!placeholder) {
110
- const key = `${namespace}.${stringKey}.placeholder`;
111
- const translation = i18next.exists(key) ? i18next.t(key) : null;
112
- placeholder = typeof translation === "string" ? translation : void 0;
113
- }
114
- return { label, placeholder };
115
- };
116
- const overridePresetLabelsAndPlaceholders = (presetInputDefs, options) => {
117
- const namespace = options.namespace ?? DEFAULT_NAMESPACE;
118
- return presetInputDefs.map((inputDef) => {
119
- const labelName = String(inputDef.name);
120
- const labelKey = `${namespace}.${labelName}.label`;
121
- const placeholderKey = `${namespace}.${labelName}.placeholder`;
122
- const labelTranslation = i18next.exists(labelKey) ? i18next.t(labelKey) : null;
123
- const placeholderTranslation = i18next.exists(placeholderKey) ? i18next.t(placeholderKey) : null;
124
- return {
125
- ...inputDef,
126
- label: typeof labelTranslation === "string" ? labelTranslation : inputDef.label,
127
- placeholder: typeof placeholderTranslation === "string" ? placeholderTranslation : inputDef.placeholder
128
- };
129
- });
130
- };
131
- const removeOverriddenPresetInputs = (presetInputs, options) => {
132
- if (presetInputs.length === 0) {
133
- return presetInputs;
134
- }
135
- const usedKeys = new Set(Object.keys(options.inputs ?? {}).map(String));
136
- return presetInputs.filter((input) => !usedKeys.has(String(input.name)));
137
- };
138
- const validateParams = (schema, presetInputs, options) => {
139
- const { inputs, order, includeAll } = options;
140
- if (!order) {
141
- return;
142
- }
143
- const inputKeys = Object.keys(inputs ?? {});
144
- const presetKeys = presetInputs.map((input) => input.name).filter((name) => name !== void 0);
145
- const schemaKeys = includeAll ? Object.keys(schema.shape) : [];
146
- const allInputKeys = /* @__PURE__ */ new Set([...inputKeys, ...presetKeys, ...schemaKeys]);
147
- const unnecessaryOrderKeys = order.filter((key) => !allInputKeys.has(key));
148
- if (unnecessaryOrderKeys.length > 0) {
149
- throw new Error(
150
- `Found unnecessary keys in "order": [${unnecessaryOrderKeys.join(", ")}]. These keys are not found in any of the input definitions.
151
- All defined input keys are: [${Array.from(allInputKeys).join(", ")}].
152
- In the case of a preset input definition, the key is the name attribute.`
153
- );
154
- }
155
- };
156
- const populateInputDef = (schema, schemaKey, value, options) => {
157
- const name = String(schemaKey);
158
- const { label, placeholder } = getLabelAndPlaceholder(value, options, schemaKey);
159
- const inputWrapper = value.inputWrapper ?? options.globalInputWrapper;
160
- if ("render" in value) {
161
- return {
162
- name,
163
- render: value.render
164
- };
165
- }
166
- const schemaKeyType = schema.shape[schemaKey];
167
- const componentType = "type" in value ? value.type : getDefaultInputComponentType(schemaKeyType);
168
- const defaultProps = componentType ? getDefaultProps(componentType, schemaKeyType) : {};
169
- const props = { ...defaultProps, ...options.globalProps, ...value.props };
170
- return {
171
- type: componentType === "unknown" ? null : componentType,
172
- name,
173
- label,
174
- placeholder,
175
- inputWrapper,
176
- props
177
- };
178
- };
179
- const addMissingSchemaFields = (schema, existingInputDefs, options) => {
180
- const schemaFields = Object.keys(schema.shape);
181
- const definedFields = new Set(existingInputDefs.map((def) => def.name));
182
- const missingFields = schemaFields.filter((field) => !definedFields.has(field));
183
- const additionalInputDefs = missingFields.map((field) => {
184
- return populateInputDef(schema, field, {}, options);
185
- });
186
- return [...existingInputDefs, ...additionalInputDefs];
187
- };
188
- const dynamicInputs = ({
189
- schema,
190
- preset = [],
191
- options
192
- }) => {
193
- validateParams(schema, preset, options);
194
- let entries = Object.entries(options.inputs ?? {});
195
- entries = excludeEntries(entries);
196
- const dynamicInputDefs = convertInputsConfigToObjectDefinitions(entries);
197
- const inputDefs = dynamicInputDefs.map(([key, value]) => {
198
- return populateInputDef(schema, key, value, options);
199
- });
200
- let presetInputDefs = removeOverriddenPresetInputs(preset, options);
201
- if (options.overridePresetLocales) {
202
- presetInputDefs = overridePresetLabelsAndPlaceholders(presetInputDefs, options);
203
- }
204
- const mergedInputDefs = [...presetInputDefs, ...inputDefs];
205
- const allInputDefs = options.includeAll ? addMissingSchemaFields(schema, mergedInputDefs, options) : mergedInputDefs;
206
- return sortInputDefs(allInputDefs, options.order);
207
- };
208
- export {
209
- dynamicInputs,
210
- getDefaultInputComponentType,
211
- getDefaultSelectionMode
212
- };
@@ -1,83 +0,0 @@
1
- import { useRef, useEffect } from "react";
2
- import { useFormState, useWatch } from "react-hook-form";
3
- import { isEqual } from "../utils/isEqual.js";
4
- import { ObjectUtils } from "../utils/object.utils.js";
5
- function isNilOrEqual(left, right) {
6
- if (ObjectUtils.isNil(left) && ObjectUtils.isNil(right)) {
7
- return true;
8
- }
9
- return isEqual(left, right);
10
- }
11
- function diffLeftOnly(left, right, shallowKeys) {
12
- if (!ObjectUtils.isObject(left) || ObjectUtils.isDate(left) || ObjectUtils.isRegExp(left)) {
13
- return !isNilOrEqual(left, right) ? left : void 0;
14
- }
15
- if (Array.isArray(left)) {
16
- return !isNilOrEqual(left, right) ? left : void 0;
17
- }
18
- const result = Object.entries(left).reduce((acc, [key, value]) => {
19
- const shallowSubtree = shallowKeys?.[key];
20
- if (shallowSubtree === true) {
21
- if (!isNilOrEqual(value, right?.[key])) {
22
- acc[key] = value;
23
- }
24
- return acc;
25
- }
26
- const diff = diffLeftOnly(value, right?.[key], shallowSubtree);
27
- if (diff !== void 0 && (!ObjectUtils.isObject(diff) || !ObjectUtils.isEmpty(diff))) {
28
- acc[key] = diff;
29
- }
30
- return acc;
31
- }, {});
32
- return ObjectUtils.isEmpty(result) ? void 0 : result;
33
- }
34
- function useAutosave({
35
- form,
36
- delay = 500,
37
- enabled = true,
38
- onSave,
39
- onSaveSuccess
40
- }) {
41
- const timeoutRef = useRef(void 0);
42
- const { control, reset, handleSubmit } = form;
43
- const { dirtyFields, defaultValues } = useFormState({ control });
44
- const formData = useWatch({ control });
45
- useEffect(() => {
46
- if (!enabled || Object.keys(dirtyFields).length === 0) {
47
- return void 0;
48
- }
49
- if (timeoutRef.current) {
50
- clearTimeout(timeoutRef.current);
51
- }
52
- timeoutRef.current = setTimeout(() => {
53
- handleSubmit(async (data) => {
54
- const dirtyData = Object.entries(dirtyFields).filter(([, value]) => value).reduce((acc, [key]) => {
55
- acc[key] = data[key];
56
- return acc;
57
- }, {});
58
- const changedData = diffLeftOnly(dirtyData, defaultValues, dirtyFields) ?? {};
59
- if (Object.keys(changedData).length === 0) {
60
- return void 0;
61
- }
62
- try {
63
- reset(void 0, { keepValues: true });
64
- await onSave(changedData);
65
- onSaveSuccess?.();
66
- } catch {
67
- reset(defaultValues);
68
- return void 0;
69
- }
70
- return void 0;
71
- })();
72
- return void 0;
73
- }, delay);
74
- return () => {
75
- if (timeoutRef.current) {
76
- clearTimeout(timeoutRef.current);
77
- }
78
- };
79
- }, [defaultValues, dirtyFields, formData, delay, onSave, handleSubmit, enabled, reset]);
80
- }
81
- export {
82
- useAutosave
83
- };
@@ -1,33 +0,0 @@
1
- import { useMemo } from "react";
2
- import { useMediaQuery } from "react-responsive";
3
- let breakpoints = null;
4
- function getBreakpoints() {
5
- if (breakpoints) {
6
- return breakpoints;
7
- }
8
- if (typeof window === "undefined") {
9
- return {
10
- sm: "23.75rem",
11
- md: "37.5rem",
12
- lg: "80rem",
13
- xl: "105rem"
14
- };
15
- }
16
- const cs = getComputedStyle(document.documentElement);
17
- const entries = ["sm", "md", "lg", "xl", "2xl"].map((k) => [k, cs.getPropertyValue(`--breakpoint-${k}`).trim()]).filter(([, v]) => !!v);
18
- breakpoints = Object.fromEntries(entries);
19
- return breakpoints;
20
- }
21
- function useBreakpoint(breakpointKey) {
22
- const breakpoints2 = useMemo(() => getBreakpoints(), []);
23
- if (!breakpoints2) {
24
- throw new Error("Tailwind config is missing theme.screens");
25
- }
26
- const bool = useMediaQuery({
27
- query: `(min-width: ${breakpoints2[breakpointKey]})`
28
- });
29
- return bool;
30
- }
31
- export {
32
- useBreakpoint
33
- };