@povio/ui 3.0.0-rc.3 → 3.1.0

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 (309) hide show
  1. package/README.md +39 -0
  2. package/dist/assets/icons/AlignCenter.js +11 -26
  3. package/dist/assets/icons/AlignLeft.js +11 -26
  4. package/dist/assets/icons/AlignLeftRight.js +11 -26
  5. package/dist/assets/icons/AlignRight.js +11 -26
  6. package/dist/assets/icons/ArrowDropDown.js +11 -26
  7. package/dist/assets/icons/ArrowDropUp.js +11 -26
  8. package/dist/assets/icons/ArrowLeft.js +11 -26
  9. package/dist/assets/icons/ArrowRight.js +11 -26
  10. package/dist/assets/icons/Bold.js +11 -26
  11. package/dist/assets/icons/BulletedList.js +11 -26
  12. package/dist/assets/icons/Calendar.js +13 -28
  13. package/dist/assets/icons/Check.js +13 -28
  14. package/dist/assets/icons/CheckCircle.js +11 -26
  15. package/dist/assets/icons/CheckboxCheckmark.js +14 -29
  16. package/dist/assets/icons/CheckboxIndeterminate.js +14 -29
  17. package/dist/assets/icons/ChevronDown.js +13 -28
  18. package/dist/assets/icons/ChevronLeft.js +13 -28
  19. package/dist/assets/icons/ChevronRight.js +13 -28
  20. package/dist/assets/icons/ChevronUp.js +13 -28
  21. package/dist/assets/icons/ChevronsLeft.js +13 -28
  22. package/dist/assets/icons/ChevronsRight.js +13 -28
  23. package/dist/assets/icons/Clock.js +11 -26
  24. package/dist/assets/icons/Close.js +11 -26
  25. package/dist/assets/icons/DateTime.js +14 -35
  26. package/dist/assets/icons/DragIndicator.js +11 -26
  27. package/dist/assets/icons/File.js +13 -28
  28. package/dist/assets/icons/Highlight.js +11 -26
  29. package/dist/assets/icons/HighlightOn.js +15 -49
  30. package/dist/assets/icons/Home.js +11 -26
  31. package/dist/assets/icons/Info.js +16 -37
  32. package/dist/assets/icons/Italic.js +11 -26
  33. package/dist/assets/icons/Link.js +11 -26
  34. package/dist/assets/icons/Menu.js +11 -26
  35. package/dist/assets/icons/NumberedList.js +11 -26
  36. package/dist/assets/icons/PointerHorizontal.js +11 -26
  37. package/dist/assets/icons/PointerVertical.js +11 -26
  38. package/dist/assets/icons/Search.js +11 -26
  39. package/dist/assets/icons/Send.js +13 -28
  40. package/dist/assets/icons/Strikethrough.js +11 -26
  41. package/dist/assets/icons/TextColor.js +14 -48
  42. package/dist/assets/icons/Today.js +11 -26
  43. package/dist/assets/icons/Underlined.js +13 -28
  44. package/dist/assets/icons/Upload.js +14 -35
  45. package/dist/assets/icons/Visibility.js +11 -26
  46. package/dist/assets/icons/VisibilityOff.js +11 -26
  47. package/dist/assets/icons/WarningFilled.js +13 -28
  48. package/dist/components/Breadcrumbs/Breadcrumbs.js +56 -207
  49. package/dist/components/Menu/Menu.d.ts +4 -0
  50. package/dist/components/Menu/Menu.js +2 -18
  51. package/dist/components/Menu/MenuDesktop.js +7 -41
  52. package/dist/components/Menu/MenuItem.js +9 -32
  53. package/dist/components/Menu/MenuMobile.d.ts +1 -1
  54. package/dist/components/Menu/MenuMobile.js +39 -97
  55. package/dist/components/Menu/MenuPopover.js +29 -105
  56. package/dist/components/buttons/IconButton/IconButton.js +8 -40
  57. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -2
  58. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
  59. package/dist/components/buttons/PillButton/PillButton.js +17 -55
  60. package/dist/components/buttons/SplitButton/SplitButton.js +18 -103
  61. package/dist/components/buttons/TextButton/TextButton.js +8 -30
  62. package/dist/components/buttons/ToggleButton/ToggleButton.js +8 -28
  63. package/dist/components/buttons/shared/ButtonContent.js +22 -80
  64. package/dist/components/inputs/Checkbox/Checkbox.d.ts +0 -1
  65. package/dist/components/inputs/Checkbox/Checkbox.js +35 -201
  66. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
  67. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +0 -3
  68. package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -2
  69. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +5 -12
  70. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +75 -373
  71. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -12
  72. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +186 -492
  73. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -14
  74. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +47 -273
  75. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -7
  76. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +121 -611
  77. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +3 -5
  78. package/dist/components/inputs/DateTime/shared/Calendar.js +120 -338
  79. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -4
  80. package/dist/components/inputs/DateTime/shared/CalendarCell.js +103 -310
  81. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -4
  82. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +33 -150
  83. package/dist/components/inputs/DateTime/shared/CalendarHeader.d.ts +2 -1
  84. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +98 -249
  85. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +137 -318
  86. package/dist/components/inputs/DateTime/shared/DateField.js +112 -286
  87. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -14
  88. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +129 -356
  89. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -15
  90. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +11 -96
  91. package/dist/components/inputs/DateTime/shared/DateTimeDialog.d.ts +4 -1
  92. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +28 -81
  93. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
  94. package/dist/components/inputs/DateTime/shared/MonthPicker.js +58 -103
  95. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
  96. package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
  97. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +110 -279
  98. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -4
  99. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +65 -210
  100. package/dist/components/inputs/DateTime/shared/YearPicker.js +68 -119
  101. package/dist/components/inputs/File/FileUpload.js +45 -88
  102. package/dist/components/inputs/File/FileUploadContainer.js +7 -15
  103. package/dist/components/inputs/File/InputUpload.js +79 -317
  104. package/dist/components/inputs/File/shared/FileCard.js +41 -104
  105. package/dist/components/inputs/File/shared/FileCardList.js +12 -47
  106. package/dist/components/inputs/File/shared/FileUploadContent.js +44 -175
  107. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +46 -149
  108. package/dist/components/inputs/File/shared/FileUploadContentError.js +93 -234
  109. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +97 -230
  110. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +55 -199
  111. package/dist/components/inputs/File/shared/InputUploadContent.js +34 -148
  112. package/dist/components/inputs/File/shared/InputUploadFilled.js +8 -49
  113. package/dist/components/inputs/File/shared/ProgressBar.d.ts +2 -2
  114. package/dist/components/inputs/File/shared/ProgressBar.js +20 -53
  115. package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +1 -1
  116. package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -1
  117. package/dist/components/inputs/File/shared/progressBar.cva.d.ts +38 -0
  118. package/dist/components/inputs/File/shared/progressBar.cva.js +28 -0
  119. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  120. package/dist/components/inputs/FormField/FormField.js +37 -119
  121. package/dist/components/inputs/FormField/FormFieldError.js +5 -25
  122. package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
  123. package/dist/components/inputs/FormField/FormFieldHeader.js +22 -81
  124. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
  125. package/dist/components/inputs/FormField/FormFieldHelper.js +6 -26
  126. package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
  127. package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
  128. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +2 -5
  129. package/dist/components/inputs/Input/NumberInput/NumberInput.js +97 -447
  130. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +9 -48
  131. package/dist/components/inputs/Input/TextArea/TextArea.js +90 -305
  132. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -3
  133. package/dist/components/inputs/Input/TextInput/TextInput.js +90 -419
  134. package/dist/components/inputs/Input/shared/InputContent.js +59 -192
  135. package/dist/components/inputs/Inputs/Form.js +11 -40
  136. package/dist/components/inputs/Inputs/InputItem.d.ts +21 -15
  137. package/dist/components/inputs/Inputs/InputItem.js +14 -69
  138. package/dist/components/inputs/Inputs/Inputs.js +11 -37
  139. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -3
  140. package/dist/components/inputs/RadioGroup/RadioGroup.js +61 -353
  141. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -45
  142. package/dist/components/inputs/RadioGroup/radio.cva.js +1 -48
  143. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +2 -6
  144. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +22 -217
  145. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
  146. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +8 -107
  147. package/dist/components/inputs/Selection/Select/Select.d.ts +3 -7
  148. package/dist/components/inputs/Selection/Select/Select.js +18 -227
  149. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +3 -8
  150. package/dist/components/inputs/Selection/shared/SelectBase.js +18 -69
  151. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  152. package/dist/components/inputs/Selection/shared/SelectDesktop.js +138 -393
  153. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  154. package/dist/components/inputs/Selection/shared/SelectInput.js +116 -397
  155. package/dist/components/inputs/Selection/shared/SelectInputTags.js +25 -99
  156. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  157. package/dist/components/inputs/Selection/shared/SelectListBox.js +52 -164
  158. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
  159. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
  160. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +21 -70
  161. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +9 -58
  162. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  163. package/dist/components/inputs/Selection/shared/SelectMobile.js +6 -11
  164. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
  165. package/dist/components/inputs/Selection/shared/select.context.js +36 -67
  166. package/dist/components/inputs/Selection/shared/select.types.d.ts +2 -3
  167. package/dist/components/inputs/Selection/shared/useSelectItems.js +49 -109
  168. package/dist/components/inputs/Slider/Slider.d.ts +1 -2
  169. package/dist/components/inputs/Slider/Slider.js +76 -265
  170. package/dist/components/inputs/TextEditor/TextEditor.d.ts +0 -1
  171. package/dist/components/inputs/TextEditor/TextEditor.js +98 -447
  172. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
  173. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +30 -102
  174. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +45 -194
  175. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
  176. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
  177. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
  178. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
  179. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +32 -92
  180. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +54 -126
  181. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +38 -141
  182. package/dist/components/inputs/Toggle/Toggle.d.ts +0 -1
  183. package/dist/components/inputs/Toggle/Toggle.js +37 -214
  184. package/dist/components/inputs/Toggle/toggle.cva.d.ts +0 -3
  185. package/dist/components/inputs/Toggle/toggle.cva.js +1 -2
  186. package/dist/components/inputs/shared/CheckContent.d.ts +1 -2
  187. package/dist/components/inputs/shared/CheckContent.js +11 -21
  188. package/dist/components/inputs/shared/InputClear.d.ts +1 -2
  189. package/dist/components/inputs/shared/InputClear.js +12 -88
  190. package/dist/components/inputs/shared/TooltipWrapper.js +11 -50
  191. package/dist/components/inputs/shared/input.cva.d.ts +0 -28
  192. package/dist/components/inputs/shared/input.cva.js +4 -38
  193. package/dist/components/navigation/Accordion/Accordion.js +22 -69
  194. package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
  195. package/dist/components/navigation/Stepper/Stepper.js +22 -67
  196. package/dist/components/navigation/Stepper/StepperItem.js +31 -104
  197. package/dist/components/navigation/Stepper/StepperSeparator.js +5 -23
  198. package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
  199. package/dist/components/overlays/BottomSheet/BottomSheet.js +25 -98
  200. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +8 -48
  201. package/dist/components/overlays/Drawer/Drawer.js +22 -64
  202. package/dist/components/overlays/Modal/modal.cva.js +1 -1
  203. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +5 -1
  204. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +28 -83
  205. package/dist/components/overlays/Tooltip/Tooltip.js +28 -137
  206. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +12 -37
  207. package/dist/components/segment/Segment.js +57 -218
  208. package/dist/components/segment/SegmentItem.js +10 -67
  209. package/dist/components/shared/pagination/Pagination.js +22 -108
  210. package/dist/components/shared/pagination/PaginationList.js +64 -167
  211. package/dist/components/status/Alert/Alert.js +30 -97
  212. package/dist/components/status/Loader/Loader.js +22 -77
  213. package/dist/components/status/Toast/Toast.js +17 -22
  214. package/dist/components/status/Toast/toast.cva.d.ts +14 -3
  215. package/dist/components/status/Toast/toast.cva.js +12 -10
  216. package/dist/components/status/Toast/useToast.js +57 -62
  217. package/dist/components/table/ColumnConfig.js +54 -158
  218. package/dist/components/table/InfiniteTable.js +16 -67
  219. package/dist/components/table/PaginatedTable.js +18 -84
  220. package/dist/components/table/Table.js +30 -30
  221. package/dist/components/table/table.cva.d.ts +7 -0
  222. package/dist/components/table/table.cva.js +2 -1
  223. package/dist/components/text/Link/Link.js +7 -19
  224. package/dist/components/text/Pill/Pill.d.ts +15 -0
  225. package/dist/components/text/Pill/Pill.js +44 -0
  226. package/dist/components/text/Typography/Typography.js +8 -23
  227. package/dist/config/confirmation.context.js +1 -1
  228. package/dist/config/link.context.js +9 -23
  229. package/dist/config/router.context.js +16 -42
  230. package/dist/config/theme.context.js +45 -98
  231. package/dist/config/uiConfig.context.d.ts +10 -21
  232. package/dist/config/uiConfig.context.js +18 -69
  233. package/dist/config/uiOverrides.context.d.ts +10 -20
  234. package/dist/config/uiOverrides.context.js +14 -54
  235. package/dist/helpers/dynamicInputs.d.ts +5 -5
  236. package/dist/helpers/dynamicInputs.js +0 -3
  237. package/dist/hooks/useAutosave.d.ts +1 -2
  238. package/dist/hooks/useAutosave.js +4 -12
  239. package/dist/hooks/useBreakpoint.js +3 -16
  240. package/dist/hooks/useDebounceCallback.js +17 -51
  241. package/dist/hooks/useFilters.js +64 -125
  242. package/dist/hooks/useForm.js +8 -42
  243. package/dist/hooks/useFormAutosave.d.ts +1 -3
  244. package/dist/hooks/useFormAutosave.js +30 -122
  245. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  246. package/dist/hooks/useIntersectionObserver.js +24 -91
  247. package/dist/hooks/useLocalStorage.js +10 -43
  248. package/dist/hooks/useLongPressRepeat.js +20 -55
  249. package/dist/hooks/usePagination.js +19 -49
  250. package/dist/hooks/useScrollableListBox.js +16 -37
  251. package/dist/hooks/useSorting.js +28 -69
  252. package/dist/hooks/useStateAndRef.js +7 -21
  253. package/dist/hooks/useTableColumnConfig.js +31 -124
  254. package/dist/hooks/useTranslationMemo.js +5 -25
  255. package/dist/index.d.ts +7 -16
  256. package/dist/index.js +6 -13
  257. package/dist/tw-ui-plugin.js +0 -6
  258. package/dist/utils/date-time.utils.d.ts +10 -38
  259. package/dist/utils/date-time.utils.js +22 -136
  260. package/package.json +1 -1
  261. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -5
  262. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +0 -16
  263. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +0 -16
  264. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -15
  265. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +0 -32
  266. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
  267. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
  268. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -40
  269. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +0 -85
  270. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
  271. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -13
  272. package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -14
  273. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +0 -45
  274. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +0 -571
  275. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -35
  276. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -575
  277. package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +0 -8
  278. package/dist/components/inputs/Input/TextArea/TextArea.cva.js +0 -5
  279. package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
  280. package/dist/components/inputs/Input/shared/numberStatic.utils.js +0 -7
  281. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +0 -37
  282. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
  283. package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -178
  284. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
  285. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +0 -47
  286. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -14
  287. package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -43
  288. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +0 -6
  289. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +0 -5
  290. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +0 -12
  291. package/dist/components/inputs/Selection/shared/selectInput.cva.js +0 -8
  292. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
  293. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +0 -54
  294. package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
  295. package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -82
  296. package/dist/components/inputs/Skeleton/InputFrame.js +0 -548
  297. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +0 -8
  298. package/dist/components/inputs/shared/tooltipWrapper.cva.js +0 -5
  299. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -14
  300. package/dist/components/inputs/shared/useStaticInputHandoff.js +0 -100
  301. package/dist/hooks/useAutosave.spec.d.ts +0 -1
  302. package/dist/hooks/useFormAutosave.spec.d.ts +0 -1
  303. package/dist/hooks/useKeyInteractions.d.ts +0 -20
  304. package/dist/hooks/useKeyInteractions.js +0 -54
  305. package/dist/hooks/useKeyInteractions.spec.d.ts +0 -1
  306. package/dist/hooks/useQueryAutocomplete.d.ts +0 -14
  307. package/dist/hooks/useQueryAutocomplete.js +0 -72
  308. package/dist/utils/query.utils.d.ts +0 -4
  309. package/dist/utils/query.utils.js +0 -8
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, ReactElement } from 'react';
1
+ import { PropsWithChildren } from 'react';
2
2
  import { ButtonProps } from '../components/buttons/Button/Button';
3
3
  import { CheckboxProps } from '../components/inputs/Checkbox/Checkbox';
4
4
  import { DatePickerProps } from '../components/inputs/DateTime/DatePicker/DatePicker';
@@ -11,6 +11,7 @@ import { ToggleProps } from '../components/inputs/Toggle/Toggle';
11
11
  import { ActionModalProps } from '../components/overlays/ActionModal/ActionModal';
12
12
  import { BottomSheetProps } from '../components/overlays/BottomSheet/BottomSheet';
13
13
  import { ToastProps } from '../components/status/Toast/Toast';
14
+ import { ToastPosition } from 'react-toastify';
14
15
  import { CellTextProps } from '../components/table/CellText';
15
16
  import { HeaderTextProps } from '../components/table/HeaderText';
16
17
  import { TagProps } from '../components/text/Tag/Tag';
@@ -19,37 +20,25 @@ export declare namespace UIConfig {
19
20
  [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : Exclude<T[P], null | undefined>;
20
21
  };
21
22
  export interface Options {
22
- renderStaticInput: boolean;
23
23
  input: Pick<TextInputProps, "variant" | "isClearable" | "hideLabel" | "as" | "size"> & {
24
24
  alwaysShowClear?: boolean;
25
25
  };
26
26
  button: Pick<ButtonProps, "variant" | "size">;
27
27
  numberInput: Pick<NumberInputProps, "formatOptions">;
28
- radioGroup: Pick<RadioGroupProps, "variant" | "hideLabel" | "fireBlurOnChange">;
29
- checkbox: Pick<CheckboxProps, "variant" | "fireBlurOnChange">;
30
- select: Pick<SelectBaseProps, "selectionMode" | "isSearchable" | "collapseAfter" | "selectedTagsType" | "hideSearchIcon" | "fireBlurOnChange">;
31
- queryAutocomplete: {
32
- isInitialQueryDisabled?: boolean;
33
- };
34
- querySelect: {
35
- isInitialQueryDisabled?: boolean;
36
- };
37
- toggle: Pick<ToggleProps, "variant" | "fireBlurOnChange">;
28
+ radioGroup: Pick<RadioGroupProps, "variant" | "hideLabel">;
29
+ checkbox: Pick<CheckboxProps, "variant">;
30
+ select: Pick<SelectBaseProps, "selectionMode" | "isSearchable" | "collapseAfter" | "selectedTagsType" | "hideSearchIcon">;
31
+ toggle: Pick<ToggleProps, "variant">;
38
32
  slider: Pick<SliderProps, "minValue" | "maxValue">;
39
- dateInput: Pick<DatePickerProps, "todayIcon" | "todayIconButtonSize" | "todayIconPlacement" | "shouldForceLeadingZeros" | "disableManualEntry" | "shouldUpdateDateOnMonthYearChange" | "granularity" | "autoFixYear" | "fireBlurOnChange"> & {
40
- calendarIcon?: ReactElement;
41
- dateTimeIcon?: ReactElement;
42
- timeIcon?: ReactElement;
43
- setDateValueOnDateSelection?: boolean;
44
- timeZone?: string;
45
- todayIconButtonComponent?: DatePickerProps["todayIconButtonComponent"];
46
- };
33
+ dateInput: Pick<DatePickerProps, "todayIcon" | "shouldForceLeadingZeros" | "disableManualEntry" | "shouldUpdateDateOnMonthYearChange" | "granularity" | "autoFixYear">;
47
34
  actionModal: Pick<ActionModalProps, "titleTypography" | "descriptionTypography">;
48
35
  bottomSheet: Pick<BottomSheetProps, "closeDragThreshold" | "closeVelocityThreshold" | "hideThumb" | "headerTypography">;
49
36
  tableHeaderText: Pick<HeaderTextProps, "variant" | "size">;
50
37
  tableCellText: Pick<CellTextProps, "variant" | "size">;
51
38
  tag: Pick<TagProps, "textVariant" | "textSize">;
52
- toast: Pick<ToastProps, "variant">;
39
+ toast: Pick<ToastProps, "variant"> & {
40
+ position: ToastPosition;
41
+ };
53
42
  }
54
43
  interface ProviderProps {
55
44
  config?: Partial<Options>;
@@ -1,16 +1,11 @@
1
- import { CalendarIcon } from "../assets/icons/Calendar.js";
2
- import { ClockIcon } from "../assets/icons/Clock.js";
3
- import { DateTimeIcon } from "../assets/icons/DateTime.js";
4
1
  import { ObjectUtils } from "../utils/object.utils.js";
5
2
  import { useDeepCompareMemo } from "../hooks/useDeepCompare.js";
6
- import { c } from "react/compiler-runtime";
7
3
  import { jsx } from "react/jsx-runtime";
8
4
  import { createContext, use } from "react";
9
5
  //#region src/config/uiConfig.context.tsx
10
6
  var UIConfig;
11
7
  (function(_UIConfig) {
12
8
  const DEFAULT_CONFIG = {
13
- renderStaticInput: true,
14
9
  input: {
15
10
  variant: "outlined",
16
11
  as: "default",
@@ -29,47 +24,28 @@ var UIConfig;
29
24
  } },
30
25
  radioGroup: {
31
26
  variant: "default",
32
- hideLabel: false,
33
- fireBlurOnChange: false
34
- },
35
- checkbox: {
36
- variant: "default",
37
- fireBlurOnChange: false
27
+ hideLabel: false
38
28
  },
29
+ checkbox: { variant: "default" },
39
30
  select: {
40
31
  selectionMode: "single",
41
32
  isSearchable: false,
42
33
  selectedTagsType: "list",
43
34
  collapseAfter: 3,
44
- hideSearchIcon: false,
45
- fireBlurOnChange: false
46
- },
47
- queryAutocomplete: { isInitialQueryDisabled: false },
48
- querySelect: { isInitialQueryDisabled: false },
49
- toggle: {
50
- variant: "default",
51
- fireBlurOnChange: false
35
+ hideSearchIcon: false
52
36
  },
37
+ toggle: { variant: "default" },
53
38
  slider: {
54
39
  minValue: 0,
55
40
  maxValue: 100
56
41
  },
57
42
  dateInput: {
58
43
  todayIcon: false,
59
- todayIconButtonSize: "none",
60
- todayIconButtonComponent: "iconButton",
61
- todayIconPlacement: "content",
62
44
  shouldForceLeadingZeros: false,
63
45
  disableManualEntry: false,
64
- autoFixYear: false,
65
- fireBlurOnChange: false,
66
- calendarIcon: /* @__PURE__ */ jsx(CalendarIcon, { className: "size-5" }),
67
- dateTimeIcon: /* @__PURE__ */ jsx(DateTimeIcon, { className: "size-5" }),
68
- timeIcon: /* @__PURE__ */ jsx(ClockIcon, { className: "size-6 text-interactive-text-secondary-idle" }),
69
- setDateValueOnDateSelection: false,
70
- timeZone: "clientLocal",
46
+ shouldUpdateDateOnMonthYearChange: false,
71
47
  granularity: "day",
72
- shouldUpdateDateOnMonthYearChange: false
48
+ autoFixYear: false
73
49
  },
74
50
  actionModal: {
75
51
  titleTypography: {
@@ -99,45 +75,21 @@ var UIConfig;
99
75
  textVariant: "default",
100
76
  textSize: "label-2"
101
77
  },
102
- toast: { variant: "outlined" }
78
+ toast: {
79
+ variant: "outlined",
80
+ position: "top-right"
81
+ }
103
82
  };
104
83
  const Context = createContext(DEFAULT_CONFIG);
105
- _UIConfig.Provider = (t0) => {
106
- const $ = c(9);
107
- const { config: t1, children } = t0;
108
- let t2;
109
- if ($[0] !== t1) {
110
- t2 = t1 === void 0 ? {} : t1;
111
- $[0] = t1;
112
- $[1] = t2;
113
- } else t2 = $[1];
114
- const config = t2;
84
+ _UIConfig.Provider = ({ config = {}, children }) => {
115
85
  const parentConfig = use(Context) || DEFAULT_CONFIG;
116
- let t3;
117
- let t4;
118
- if ($[2] !== config || $[3] !== parentConfig) {
119
- t3 = () => ObjectUtils.deepConditionalMerge(parentConfig, config, _temp);
120
- t4 = [config, parentConfig];
121
- $[2] = config;
122
- $[3] = parentConfig;
123
- $[4] = t3;
124
- $[5] = t4;
125
- } else {
126
- t3 = $[4];
127
- t4 = $[5];
128
- }
129
- const value = useDeepCompareMemo(t3, t4);
130
- let t5;
131
- if ($[6] !== children || $[7] !== value) {
132
- t5 = /* @__PURE__ */ jsx(Context.Provider, {
133
- value,
134
- children
135
- });
136
- $[6] = children;
137
- $[7] = value;
138
- $[8] = t5;
139
- } else t5 = $[8];
140
- return t5;
86
+ const value = useDeepCompareMemo(() => {
87
+ return ObjectUtils.deepConditionalMerge(parentConfig, config, (val) => val !== null && val !== void 0);
88
+ }, [config, parentConfig]);
89
+ return /* @__PURE__ */ jsx(Context.Provider, {
90
+ value,
91
+ children
92
+ });
141
93
  };
142
94
  _UIConfig.useConfig = () => {
143
95
  const context = use(Context);
@@ -145,8 +97,5 @@ var UIConfig;
145
97
  return context;
146
98
  };
147
99
  })(UIConfig || (UIConfig = {}));
148
- function _temp(val) {
149
- return val !== null && val !== void 0;
150
- }
151
100
  //#endregion
152
101
  export { UIConfig };
@@ -1,7 +1,7 @@
1
1
  import { ClassProp } from 'class-variance-authority/types';
2
2
  import { PropsWithChildren } from 'react';
3
3
  import { ButtonConfig, ButtonContentConfig, ButtonIconSizeConfig, ButtonSizeConfig } from '../components/buttons/Button/button.cva';
4
- import { StatusIconConfig, StatusSeparatorConfig, ToastConfig } from '../components/status/Toast/toast.cva';
4
+ import { StatusIconConfig, StatusSeparatorConfig, ToastConfig, ToastContainerConfig } from '../components/status/Toast/toast.cva';
5
5
  import { CompoundMapper, ConfigSchema } from '../utils/compoundMapper';
6
6
  import { StyleMergeUtils } from '../utils/style-merge.util';
7
7
  export declare namespace UIOverrides {
@@ -41,14 +41,10 @@ export declare namespace UIOverrides {
41
41
  cva?: GenericCvaOption;
42
42
  iconCva?: GenericCvaOption;
43
43
  typography?: Mapper;
44
- contentClassName?: Mapper;
45
44
  };
46
45
  radio: {
47
46
  cva?: GenericCvaOption;
48
- contentWrapperCva?: GenericCvaOption;
49
- contentRowCva?: GenericCvaOption;
50
47
  typography?: Mapper;
51
- contentClassName?: Mapper;
52
48
  };
53
49
  status: {
54
50
  iconCva?: CvaOption<StatusIconConfig>;
@@ -56,6 +52,7 @@ export declare namespace UIOverrides {
56
52
  };
57
53
  toast: {
58
54
  cva?: CvaOption<ToastConfig>;
55
+ containerCva?: CvaOption<ToastContainerConfig>;
59
56
  buttonColor?: Mapper;
60
57
  };
61
58
  alert: {
@@ -63,20 +60,9 @@ export declare namespace UIOverrides {
63
60
  };
64
61
  input: {
65
62
  baseCva?: GenericCvaOption;
66
- clearClassCva?: GenericCvaOption;
67
- contentWrapperCva?: GenericCvaOption;
68
63
  sizeCva?: GenericCvaOption;
69
64
  sideCva?: GenericCvaOption;
70
65
  };
71
- textArea: {
72
- wrapperCva?: GenericCvaOption;
73
- };
74
- tooltipWrapper: {
75
- triggerCva?: GenericCvaOption;
76
- };
77
- datePickerInput: {
78
- contentRowCva?: GenericCvaOption;
79
- };
80
66
  label: {
81
67
  cva?: GenericCvaOption;
82
68
  typography?: Mapper;
@@ -84,7 +70,6 @@ export declare namespace UIOverrides {
84
70
  toggle: {
85
71
  cva?: GenericCvaOption;
86
72
  typography?: Mapper;
87
- contentClassName?: Mapper;
88
73
  };
89
74
  typography: {
90
75
  cva?: GenericCvaOption;
@@ -96,6 +81,7 @@ export declare namespace UIOverrides {
96
81
  cva?: GenericCvaOption;
97
82
  };
98
83
  table: {
84
+ theadCva?: GenericCvaOption;
99
85
  headRowCva?: GenericCvaOption;
100
86
  headDataCva?: GenericCvaOption;
101
87
  rowCva?: GenericCvaOption;
@@ -156,14 +142,18 @@ export declare namespace UIOverrides {
156
142
  cva?: GenericCvaOption;
157
143
  };
158
144
  formField: {
159
- headerCva?: GenericCvaOption;
160
145
  errorLabelCva?: GenericCvaOption;
161
146
  helperLabelCva?: GenericCvaOption;
162
147
  };
163
148
  select: {
164
149
  listBoxItemCva?: GenericCvaOption;
165
- popoverCva?: GenericCvaOption;
166
- tagsContentWrapperCva?: GenericCvaOption;
150
+ };
151
+ progressBar: {
152
+ cva?: GenericCvaOption;
153
+ trackWrapperCva?: GenericCvaOption;
154
+ trackCva?: GenericCvaOption;
155
+ fillCva?: GenericCvaOption;
156
+ valueCva?: GenericCvaOption;
167
157
  };
168
158
  }
169
159
  export type Config = Partial<Options>;
@@ -1,27 +1,17 @@
1
1
  import { StyleMergeUtils } from "../utils/style-merge.util.js";
2
- import { c } from "react/compiler-runtime";
3
2
  import { jsx } from "react/jsx-runtime";
4
3
  import { clsx } from "clsx";
5
- import { createContext, use } from "react";
4
+ import { createContext, use, useMemo } from "react";
6
5
  import { cva } from "class-variance-authority";
7
6
  //#region src/config/uiOverrides.context.tsx
8
7
  var UIOverrides;
9
8
  (function(_UIOverrides) {
10
9
  const Context = createContext(null);
11
- _UIOverrides.Provider = (t0) => {
12
- const $ = c(3);
13
- const { children, config } = t0;
14
- let t1;
15
- if ($[0] !== children || $[1] !== config) {
16
- t1 = /* @__PURE__ */ jsx(Context.Provider, {
17
- value: config,
18
- children
19
- });
20
- $[0] = children;
21
- $[1] = config;
22
- $[2] = t1;
23
- } else t1 = $[2];
24
- return t1;
10
+ _UIOverrides.Provider = ({ children, config }) => {
11
+ return /* @__PURE__ */ jsx(Context.Provider, {
12
+ value: config,
13
+ children
14
+ });
25
15
  };
26
16
  const useConfig = () => {
27
17
  return use(Context);
@@ -55,51 +45,21 @@ var UIOverrides;
55
45
  return "base" in item;
56
46
  };
57
47
  function useCva(key, fallback) {
58
- const $ = c(6);
59
48
  const override = useCvaOverride(key);
60
- let t0;
61
- bb0: {
62
- if (isCvaFunction(override)) {
63
- t0 = override;
64
- break bb0;
65
- }
66
- if (isCvaFunction(fallback)) {
67
- t0 = fallback;
68
- break bb0;
69
- }
70
- if (!isDefinition(fallback)) {
71
- t0 = _temp;
72
- break bb0;
73
- }
49
+ return useMemo(() => {
50
+ if (isCvaFunction(override)) return override;
51
+ if (isCvaFunction(fallback)) return fallback;
52
+ if (!isDefinition(fallback)) return (() => "");
74
53
  const definition = fallback;
75
54
  const typedOverride = override;
76
55
  if (isCvaOverrideConfig(typedOverride)) {
77
- let t1;
78
- if ($[0] !== definition || $[1] !== typedOverride) {
79
- const mergedDefinition = StyleMergeUtils.mergeCvaDefinition(definition, typedOverride);
80
- t1 = cva(clsx(mergedDefinition.base), mergedDefinition.config);
81
- $[0] = definition;
82
- $[1] = typedOverride;
83
- $[2] = t1;
84
- } else t1 = $[2];
85
- t0 = t1;
86
- break bb0;
56
+ const mergedDefinition = StyleMergeUtils.mergeCvaDefinition(definition, typedOverride);
57
+ return cva(clsx(mergedDefinition.base), mergedDefinition.config);
87
58
  }
88
- let t1;
89
- if ($[3] !== definition.base || $[4] !== definition.config) {
90
- t1 = cva(clsx(definition.base), definition.config);
91
- $[3] = definition.base;
92
- $[4] = definition.config;
93
- $[5] = t1;
94
- } else t1 = $[5];
95
- t0 = t1;
96
- }
97
- return t0;
59
+ return cva(clsx(definition.base), definition.config);
60
+ }, [fallback, override]);
98
61
  }
99
62
  _UIOverrides.useCva = useCva;
100
- function _temp() {
101
- return "";
102
- }
103
63
  _UIOverrides.useMapper = (key, fallback) => {
104
64
  const uiOverrides = useConfig();
105
65
  if (!uiOverrides) return fallback;
@@ -21,14 +21,14 @@ export type AllowedComponentType<TZodType extends z.ZodType> = ZodUtils.ZodTypeS
21
21
  datetime: "datePicker" | "dateTimePicker" | "timePicker";
22
22
  dateRange: "dateRangePicker";
23
23
  boolean: "toggle" | "checkbox";
24
- number: "numberInput" | "slider" | "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
25
- enum: "select" | "querySelect" | "autocomplete" | "segment";
26
- string: "textInput" | "passwordInput" | "textArea" | "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
24
+ number: "numberInput" | "slider" | "select" | "autocomplete" | "queryAutocomplete" | "segment";
25
+ enum: "select" | "autocomplete" | "segment";
26
+ string: "textInput" | "passwordInput" | "textArea" | "select" | "autocomplete" | "queryAutocomplete" | "segment";
27
27
  email: "textInput";
28
- array: "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
28
+ array: "select" | "autocomplete" | "queryAutocomplete" | "segment";
29
29
  object: InputComponentType;
30
30
  unknown: InputComponentType;
31
- uuid: "select" | "querySelect" | "autocomplete" | "queryAutocomplete" | "segment";
31
+ uuid: "select" | "autocomplete" | "queryAutocomplete" | "segment";
32
32
  }>;
33
33
  interface DynamicInputDefBase<TProps> {
34
34
  label?: string;
@@ -81,7 +81,6 @@ var getDefaultProps = (componentType, keyType) => {
81
81
  ].includes(componentType)) props.items = getDefaultSelectionItems(unwrappedType);
82
82
  if ([
83
83
  "select",
84
- "querySelect",
85
84
  "autocomplete",
86
85
  "queryAutocomplete",
87
86
  "segment"
@@ -147,8 +146,6 @@ var populateInputDef = (schema, schemaKey, value, options) => {
147
146
  const inputWrapper = value.inputWrapper ?? options.globalInputWrapper;
148
147
  if ("render" in value) return {
149
148
  name,
150
- label,
151
- placeholder,
152
149
  render: value.render
153
150
  };
154
151
  const schemaKeyType = schema.shape[schemaKey];
@@ -3,8 +3,7 @@ export interface UseAutosaveProps<TFieldValues extends FieldValues = FieldValues
3
3
  form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;
4
4
  delay?: number;
5
5
  enabled?: boolean;
6
- trigger?: "change" | "blur";
7
6
  onSave: (data: Partial<TTransformedValues>) => Promise<TResponse>;
8
7
  onSaveSuccess?: () => void;
9
8
  }
10
- export declare function useAutosave<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues, TResponse = unknown>({ form, delay, enabled, trigger, onSave, onSaveSuccess, }: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>): void;
9
+ export declare function useAutosave<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues, TResponse = unknown>({ form, delay, enabled, onSave, onSaveSuccess, }: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>): void;
@@ -22,19 +22,12 @@ function diffLeftOnly(left, right, shallowKeys) {
22
22
  }, {});
23
23
  return ObjectUtils.isEmpty(result) ? void 0 : result;
24
24
  }
25
- function useAutosave({ form, delay = 500, enabled = true, trigger = "change", onSave, onSaveSuccess }) {
25
+ function useAutosave({ form, delay = 500, enabled = true, onSave, onSaveSuccess }) {
26
26
  const timeoutRef = useRef(void 0);
27
- const previousBlurTriggerFieldsRef = useRef(void 0);
28
27
  const { control, reset, handleSubmit } = form;
29
- const { dirtyFields, touchedFields, defaultValues } = useFormState({ control });
30
- const formData = useWatch({ control });
28
+ const { dirtyFields, defaultValues } = useFormState({ control });
31
29
  useEffect(() => {
32
30
  if (!enabled || Object.keys(dirtyFields).length === 0) return;
33
- if (trigger === "blur") {
34
- const blurTriggerFields = JSON.stringify(touchedFields);
35
- if (Object.keys(touchedFields).length === 0 || previousBlurTriggerFieldsRef.current === blurTriggerFields) return;
36
- previousBlurTriggerFieldsRef.current = blurTriggerFields;
37
- }
38
31
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
39
32
  timeoutRef.current = setTimeout(() => {
40
33
  handleSubmit(async (data) => {
@@ -59,13 +52,12 @@ function useAutosave({ form, delay = 500, enabled = true, trigger = "change", on
59
52
  }, [
60
53
  defaultValues,
61
54
  dirtyFields,
62
- trigger === "change" ? formData : touchedFields,
55
+ useWatch({ control }),
63
56
  delay,
64
57
  onSave,
65
58
  handleSubmit,
66
59
  enabled,
67
- reset,
68
- trigger
60
+ reset
69
61
  ]);
70
62
  }
71
63
  //#endregion
@@ -1,4 +1,4 @@
1
- import { c } from "react/compiler-runtime";
1
+ import { useMemo } from "react";
2
2
  import { useMediaQuery } from "react-responsive";
3
3
  //#region src/hooks/useBreakpoint.ts
4
4
  var breakpoints = null;
@@ -22,22 +22,9 @@ function getBreakpoints() {
22
22
  return breakpoints;
23
23
  }
24
24
  function useBreakpoint(breakpointKey) {
25
- const $ = c(3);
26
- let t0;
27
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
28
- t0 = getBreakpoints();
29
- $[0] = t0;
30
- } else t0 = $[0];
31
- const breakpoints = t0;
25
+ const breakpoints = useMemo(() => getBreakpoints(), []);
32
26
  if (!breakpoints) throw new Error("Tailwind config is missing theme.screens");
33
- const t1 = `(min-width: ${breakpoints[breakpointKey]})`;
34
- let t2;
35
- if ($[1] !== t1) {
36
- t2 = { query: t1 };
37
- $[1] = t1;
38
- $[2] = t2;
39
- } else t2 = $[2];
40
- return useMediaQuery(t2);
27
+ return useMediaQuery({ query: `(min-width: ${breakpoints[breakpointKey]})` });
41
28
  }
42
29
  //#endregion
43
30
  export { useBreakpoint };
@@ -1,59 +1,25 @@
1
- import { c } from "react/compiler-runtime";
2
- import { useEffect, useRef, useState } from "react";
1
+ import { useCallback, useEffect, useRef, useState } from "react";
3
2
  //#region src/hooks/useDebounceCallback.ts
4
- function useDebounceCallback(callback, t0) {
5
- const $ = c(10);
6
- let t1;
7
- if ($[0] !== t0) {
8
- t1 = t0 === void 0 ? {} : t0;
9
- $[0] = t0;
10
- $[1] = t1;
11
- } else t1 = $[1];
12
- const { delay: t2 } = t1;
13
- const delay = t2 === void 0 ? 500 : t2;
3
+ function useDebounceCallback(callback, { delay = 500 } = {}) {
14
4
  const timeoutRef = useRef(null);
15
5
  const [isDebouncing, setIsDebouncing] = useState(false);
16
- let t3;
17
- if ($[2] !== callback || $[3] !== delay) {
18
- t3 = (...t4) => {
19
- const args = t4;
6
+ const debouncedCallback = useCallback((...args) => {
7
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
8
+ setIsDebouncing(true);
9
+ timeoutRef.current = setTimeout(() => {
10
+ setIsDebouncing(false);
11
+ callback?.(...args);
12
+ }, delay);
13
+ }, [callback, delay]);
14
+ useEffect(() => {
15
+ return () => {
20
16
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
21
- setIsDebouncing(true);
22
- timeoutRef.current = setTimeout(() => {
23
- setIsDebouncing(false);
24
- callback?.(...args);
25
- }, delay);
26
17
  };
27
- $[2] = callback;
28
- $[3] = delay;
29
- $[4] = t3;
30
- } else t3 = $[4];
31
- const debouncedCallback = t3;
32
- let t4;
33
- let t5;
34
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
35
- t4 = () => () => {
36
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
37
- };
38
- t5 = [];
39
- $[5] = t4;
40
- $[6] = t5;
41
- } else {
42
- t4 = $[5];
43
- t5 = $[6];
44
- }
45
- useEffect(t4, t5);
46
- let t6;
47
- if ($[7] !== debouncedCallback || $[8] !== isDebouncing) {
48
- t6 = {
49
- callback: debouncedCallback,
50
- isDebouncing
51
- };
52
- $[7] = debouncedCallback;
53
- $[8] = isDebouncing;
54
- $[9] = t6;
55
- } else t6 = $[9];
56
- return t6;
18
+ }, []);
19
+ return {
20
+ callback: debouncedCallback,
21
+ isDebouncing
22
+ };
57
23
  }
58
24
  //#endregion
59
25
  export { useDebounceCallback };