@povio/ui 2.3.0-rc.5 → 2.3.0-rc.7

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 (195) hide show
  1. package/dist/assets/icons/AlignCenter.js +26 -11
  2. package/dist/assets/icons/AlignLeft.js +26 -11
  3. package/dist/assets/icons/AlignLeftRight.js +26 -11
  4. package/dist/assets/icons/AlignRight.js +26 -11
  5. package/dist/assets/icons/ArrowDropDown.js +26 -11
  6. package/dist/assets/icons/ArrowDropUp.js +26 -11
  7. package/dist/assets/icons/ArrowLeft.js +26 -11
  8. package/dist/assets/icons/ArrowRight.js +26 -11
  9. package/dist/assets/icons/Bold.js +26 -11
  10. package/dist/assets/icons/BulletedList.js +26 -11
  11. package/dist/assets/icons/Calendar.js +28 -13
  12. package/dist/assets/icons/Check.js +28 -13
  13. package/dist/assets/icons/CheckCircle.js +26 -11
  14. package/dist/assets/icons/CheckboxCheckmark.js +29 -14
  15. package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
  16. package/dist/assets/icons/ChevronDown.js +28 -13
  17. package/dist/assets/icons/ChevronLeft.js +28 -13
  18. package/dist/assets/icons/ChevronRight.js +28 -13
  19. package/dist/assets/icons/ChevronUp.js +28 -13
  20. package/dist/assets/icons/ChevronsLeft.js +28 -13
  21. package/dist/assets/icons/ChevronsRight.js +28 -13
  22. package/dist/assets/icons/Clock.js +26 -11
  23. package/dist/assets/icons/Close.js +26 -11
  24. package/dist/assets/icons/DateTime.js +35 -14
  25. package/dist/assets/icons/DragIndicator.js +26 -11
  26. package/dist/assets/icons/File.js +28 -13
  27. package/dist/assets/icons/Highlight.js +26 -11
  28. package/dist/assets/icons/HighlightOn.js +49 -15
  29. package/dist/assets/icons/Home.js +26 -11
  30. package/dist/assets/icons/Info.js +37 -16
  31. package/dist/assets/icons/Italic.js +26 -11
  32. package/dist/assets/icons/Link.js +26 -11
  33. package/dist/assets/icons/Menu.js +26 -11
  34. package/dist/assets/icons/NumberedList.js +26 -11
  35. package/dist/assets/icons/PointerHorizontal.js +26 -11
  36. package/dist/assets/icons/PointerVertical.js +26 -11
  37. package/dist/assets/icons/Search.js +26 -11
  38. package/dist/assets/icons/Send.js +28 -13
  39. package/dist/assets/icons/Strikethrough.js +26 -11
  40. package/dist/assets/icons/TextColor.js +48 -14
  41. package/dist/assets/icons/Today.js +26 -11
  42. package/dist/assets/icons/Underlined.js +28 -13
  43. package/dist/assets/icons/Upload.js +35 -14
  44. package/dist/assets/icons/Visibility.js +26 -11
  45. package/dist/assets/icons/VisibilityOff.js +26 -11
  46. package/dist/assets/icons/WarningFilled.js +28 -13
  47. package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
  48. package/dist/components/Menu/Menu.js +18 -2
  49. package/dist/components/Menu/MenuDesktop.js +41 -7
  50. package/dist/components/Menu/MenuItem.js +32 -9
  51. package/dist/components/Menu/MenuMobile.js +97 -38
  52. package/dist/components/Menu/MenuPopover.js +105 -29
  53. package/dist/components/buttons/IconButton/IconButton.js +40 -8
  54. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
  55. package/dist/components/buttons/PillButton/PillButton.js +55 -17
  56. package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
  57. package/dist/components/buttons/TextButton/TextButton.js +30 -8
  58. package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
  59. package/dist/components/buttons/shared/ButtonContent.js +80 -22
  60. package/dist/components/inputs/Checkbox/Checkbox.js +164 -34
  61. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
  62. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +16 -12
  63. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +111 -107
  64. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +17 -13
  65. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +384 -116
  66. package/dist/components/inputs/DateTime/shared/Calendar.js +331 -137
  67. package/dist/components/inputs/DateTime/shared/CalendarCell.js +283 -102
  68. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +142 -33
  69. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +245 -90
  70. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  71. package/dist/components/inputs/DateTime/shared/DateField.js +296 -112
  72. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +345 -142
  73. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +94 -21
  74. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
  75. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
  76. package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
  77. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
  78. package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
  79. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
  80. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +205 -70
  81. package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
  82. package/dist/components/inputs/File/FileUpload.js +86 -44
  83. package/dist/components/inputs/File/FileUploadContainer.js +15 -7
  84. package/dist/components/inputs/File/InputUpload.js +317 -79
  85. package/dist/components/inputs/File/shared/FileCard.js +104 -41
  86. package/dist/components/inputs/File/shared/FileCardList.js +47 -12
  87. package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
  88. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
  89. package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
  90. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
  91. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
  92. package/dist/components/inputs/File/shared/InputUploadContent.js +148 -35
  93. package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
  94. package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
  95. package/dist/components/inputs/FormField/FormField.js +119 -37
  96. package/dist/components/inputs/FormField/FormFieldError.js +25 -5
  97. package/dist/components/inputs/FormField/FormFieldHeader.js +79 -22
  98. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
  99. package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
  100. package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
  101. package/dist/components/inputs/Input/NumberInput/NumberInput.js +253 -82
  102. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
  103. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +321 -77
  104. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
  105. package/dist/components/inputs/Input/TextArea/TextArea.js +298 -89
  106. package/dist/components/inputs/Input/TextInput/TextInput.js +241 -81
  107. package/dist/components/inputs/Input/shared/InputContent.js +190 -58
  108. package/dist/components/inputs/Inputs/Form.js +40 -11
  109. package/dist/components/inputs/Inputs/InputItem.js +65 -14
  110. package/dist/components/inputs/Inputs/Inputs.js +37 -11
  111. package/dist/components/inputs/RadioGroup/RadioGroup.js +317 -106
  112. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +9 -3
  113. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +2 -2
  114. package/dist/components/inputs/Selection/Select/QuerySelect.js +107 -27
  115. package/dist/components/inputs/Selection/Select/Select.js +9 -3
  116. package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
  117. package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
  118. package/dist/components/inputs/Selection/shared/SelectInput.js +334 -136
  119. package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
  120. package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
  121. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
  122. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
  123. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
  124. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
  125. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
  126. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
  127. package/dist/components/inputs/Selection/shared/select.context.js +34 -34
  128. package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
  129. package/dist/components/inputs/Skeleton/InputFrame.d.ts +1 -0
  130. package/dist/components/inputs/Skeleton/InputFrame.js +444 -116
  131. package/dist/components/inputs/Slider/Slider.js +247 -74
  132. package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
  133. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
  134. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
  135. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
  136. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
  137. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
  138. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
  139. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
  140. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
  141. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
  142. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
  143. package/dist/components/inputs/Toggle/Toggle.js +187 -41
  144. package/dist/components/inputs/shared/CheckContent.js +21 -10
  145. package/dist/components/inputs/shared/InputClear.js +78 -21
  146. package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
  147. package/dist/components/inputs/shared/input.cva.js +13 -3
  148. package/dist/components/inputs/shared/useStaticInputHandoff.js +97 -39
  149. package/dist/components/navigation/Accordion/Accordion.js +69 -22
  150. package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
  151. package/dist/components/navigation/Stepper/Stepper.js +67 -22
  152. package/dist/components/navigation/Stepper/StepperItem.js +104 -31
  153. package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
  154. package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
  155. package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
  156. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
  157. package/dist/components/overlays/Drawer/Drawer.js +62 -20
  158. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
  159. package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
  160. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
  161. package/dist/components/segment/Segment.js +218 -57
  162. package/dist/components/segment/SegmentItem.js +67 -10
  163. package/dist/components/shared/pagination/Pagination.js +108 -22
  164. package/dist/components/shared/pagination/PaginationList.js +167 -64
  165. package/dist/components/status/Alert/Alert.js +97 -30
  166. package/dist/components/status/Loader/Loader.js +77 -22
  167. package/dist/components/status/Toast/Toast.js +21 -13
  168. package/dist/components/status/Toast/useToast.js +62 -57
  169. package/dist/components/table/ColumnConfig.js +158 -54
  170. package/dist/components/table/InfiniteTable.js +67 -16
  171. package/dist/components/table/PaginatedTable.js +84 -18
  172. package/dist/components/table/Table.js +23 -23
  173. package/dist/components/text/Link/Link.js +19 -7
  174. package/dist/components/text/Typography/Typography.js +23 -8
  175. package/dist/config/confirmation.context.js +1 -1
  176. package/dist/config/link.context.js +23 -9
  177. package/dist/config/router.context.js +42 -16
  178. package/dist/config/theme.context.js +98 -45
  179. package/dist/config/uiConfig.context.js +39 -8
  180. package/dist/config/uiStyle.context.js +15 -5
  181. package/dist/hooks/useBreakpoint.js +16 -3
  182. package/dist/hooks/useDebounceCallback.js +51 -17
  183. package/dist/hooks/useFilters.js +125 -64
  184. package/dist/hooks/useForm.js +42 -8
  185. package/dist/hooks/useFormAutosave.js +101 -30
  186. package/dist/hooks/useIntersectionObserver.js +86 -32
  187. package/dist/hooks/useLocalStorage.js +43 -10
  188. package/dist/hooks/useLongPressRepeat.js +55 -20
  189. package/dist/hooks/usePagination.js +49 -19
  190. package/dist/hooks/useScrollableListBox.js +37 -16
  191. package/dist/hooks/useSorting.js +69 -28
  192. package/dist/hooks/useStateAndRef.js +21 -7
  193. package/dist/hooks/useTableColumnConfig.js +124 -31
  194. package/dist/hooks/useTranslationMemo.js +25 -5
  195. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { UIRouter } from "../config/router.context.js";
2
2
  import { RoutingUtils } from "../utils/routing.utils.js";
3
- import { useCallback, useEffect, useMemo, useState } from "react";
3
+ import { c } from "react/compiler-runtime";
4
+ import { useEffect, useState } from "react";
4
5
  import { z } from "zod";
5
6
  //#region src/hooks/useFilters.ts
6
7
  function getFieldType(schema, fieldKey) {
@@ -50,78 +51,138 @@ var parseFilterFromQuery = (searchParams, schema) => {
50
51
  }
51
52
  return filter;
52
53
  };
53
- var useFilters = (defaultFilterValues, prefix = "", schema) => {
54
+ var useFilters = (defaultFilterValues, t0, schema) => {
55
+ const $ = c(33);
56
+ const prefix = t0 === void 0 ? "" : t0;
54
57
  const { searchParams, replace } = UIRouter.useUIRouter();
55
- const [filterData, setFilterData] = useState(() => parseFilterFromQuery(searchParams, schema));
56
- useEffect(() => {
57
- const setUrlToDefaultFilters = () => {
58
- const flatFilterQuery = serializeFiltersToQuery(defaultFilterValues, prefix);
58
+ let t1;
59
+ if ($[0] !== schema || $[1] !== searchParams) {
60
+ t1 = () => parseFilterFromQuery(searchParams, schema);
61
+ $[0] = schema;
62
+ $[1] = searchParams;
63
+ $[2] = t1;
64
+ } else t1 = $[2];
65
+ const [filterData, setFilterData] = useState(t1);
66
+ let t2;
67
+ if ($[3] !== defaultFilterValues || $[4] !== prefix || $[5] !== replace || $[6] !== schema || $[7] !== searchParams) {
68
+ t2 = () => {
69
+ const setUrlToDefaultFilters = () => {
70
+ const flatFilterQuery = serializeFiltersToQuery(defaultFilterValues, prefix);
71
+ replace(".", {
72
+ ...RoutingUtils.toRouterSearch(searchParams),
73
+ ...flatFilterQuery
74
+ });
75
+ };
76
+ const currentFilters = parseFilterFromQuery(searchParams, schema);
77
+ const hasFiltersSet = Object.keys(currentFilters).length > 0;
78
+ if (defaultFilterValues && !hasFiltersSet) setUrlToDefaultFilters();
79
+ };
80
+ $[3] = defaultFilterValues;
81
+ $[4] = prefix;
82
+ $[5] = replace;
83
+ $[6] = schema;
84
+ $[7] = searchParams;
85
+ $[8] = t2;
86
+ } else t2 = $[8];
87
+ let t3;
88
+ if ($[9] !== defaultFilterValues || $[10] !== prefix || $[11] !== schema) {
89
+ t3 = [
90
+ defaultFilterValues,
91
+ prefix,
92
+ schema
93
+ ];
94
+ $[9] = defaultFilterValues;
95
+ $[10] = prefix;
96
+ $[11] = schema;
97
+ $[12] = t3;
98
+ } else t3 = $[12];
99
+ useEffect(t2, t3);
100
+ let t4;
101
+ let t5;
102
+ if ($[13] !== schema || $[14] !== searchParams) {
103
+ t4 = () => {
104
+ setFilterData(parseFilterFromQuery(searchParams, schema));
105
+ };
106
+ t5 = [searchParams, schema];
107
+ $[13] = schema;
108
+ $[14] = searchParams;
109
+ $[15] = t4;
110
+ $[16] = t5;
111
+ } else {
112
+ t4 = $[15];
113
+ t5 = $[16];
114
+ }
115
+ useEffect(t4, t5);
116
+ let t6;
117
+ if ($[17] !== defaultFilterValues || $[18] !== filterData || $[19] !== prefix || $[20] !== replace || $[21] !== searchParams) {
118
+ t6 = (data) => {
119
+ let newFilters = { ...filterData };
120
+ const isReset = Object.keys(data).length === 0;
121
+ if (data === defaultFilterValues) newFilters = { ...defaultFilterValues };
122
+ else if (isReset) newFilters = {};
123
+ else Object.entries(data).forEach((t7) => {
124
+ const [key, value] = t7;
125
+ if (value === void 0) delete newFilters[key];
126
+ else newFilters[key] = value;
127
+ });
128
+ const prefixPart = prefix ? `${prefix}-` : "";
129
+ const cleanedQuery = RoutingUtils.toRouterSearch(searchParams);
130
+ Object.keys(cleanedQuery).forEach((key_0) => {
131
+ if (key_0.startsWith(`filter[${prefixPart}`)) delete cleanedQuery[key_0];
132
+ });
133
+ const flatFilterQuery_0 = serializeFiltersToQuery(newFilters, prefix);
59
134
  replace(".", {
60
- ...RoutingUtils.toRouterSearch(searchParams),
61
- ...flatFilterQuery
135
+ ...cleanedQuery,
136
+ ...flatFilterQuery_0
137
+ });
138
+ setFilterData(newFilters);
139
+ };
140
+ $[17] = defaultFilterValues;
141
+ $[18] = filterData;
142
+ $[19] = prefix;
143
+ $[20] = replace;
144
+ $[21] = searchParams;
145
+ $[22] = t6;
146
+ } else t6 = $[22];
147
+ const setFilterValue = t6;
148
+ let t7;
149
+ if ($[23] !== filterData) {
150
+ t7 = (keys) => {
151
+ const result = {};
152
+ keys.forEach((key_1) => {
153
+ result[key_1] = filterData[key_1];
62
154
  });
155
+ return result;
156
+ };
157
+ $[23] = filterData;
158
+ $[24] = t7;
159
+ } else t7 = $[24];
160
+ const getFilterValue = t7;
161
+ let t8;
162
+ if ($[25] !== defaultFilterValues || $[26] !== setFilterValue) {
163
+ t8 = () => {
164
+ setFilterValue(defaultFilterValues ?? {});
63
165
  };
64
- const currentFilters = parseFilterFromQuery(searchParams, schema);
65
- const hasFiltersSet = Object.keys(currentFilters).length > 0;
66
- if (defaultFilterValues && !hasFiltersSet) setUrlToDefaultFilters();
67
- }, [
68
- defaultFilterValues,
69
- prefix,
70
- schema
71
- ]);
72
- useEffect(() => {
73
- setFilterData(parseFilterFromQuery(searchParams, schema));
74
- }, [searchParams, schema]);
75
- const setFilterValue = useCallback((data) => {
76
- let newFilters = { ...filterData };
77
- const isReset = Object.keys(data).length === 0;
78
- if (data === defaultFilterValues) newFilters = { ...defaultFilterValues };
79
- else if (isReset) newFilters = {};
80
- else Object.entries(data).forEach(([key, value]) => {
81
- if (value === void 0) delete newFilters[key];
82
- else newFilters[key] = value;
83
- });
84
- const prefixPart = prefix ? `${prefix}-` : "";
85
- const cleanedQuery = RoutingUtils.toRouterSearch(searchParams);
86
- Object.keys(cleanedQuery).forEach((key) => {
87
- if (key.startsWith(`filter[${prefixPart}`)) delete cleanedQuery[key];
88
- });
89
- const flatFilterQuery = serializeFiltersToQuery(newFilters, prefix);
90
- replace(".", {
91
- ...cleanedQuery,
92
- ...flatFilterQuery
93
- });
94
- setFilterData(newFilters);
95
- }, [
96
- filterData,
97
- prefix,
98
- replace,
99
- defaultFilterValues,
100
- searchParams
101
- ]);
102
- const getFilterValue = useCallback((keys) => {
103
- const result = {};
104
- keys.forEach((key) => {
105
- result[key] = filterData[key];
106
- });
107
- return result;
108
- }, [filterData]);
109
- const clearAllFilters = useCallback(() => {
110
- setFilterValue(defaultFilterValues ?? {});
111
- }, [defaultFilterValues, setFilterValue]);
112
- return useMemo(() => {
113
- return {
166
+ $[25] = defaultFilterValues;
167
+ $[26] = setFilterValue;
168
+ $[27] = t8;
169
+ } else t8 = $[27];
170
+ const clearAllFilters = t8;
171
+ let t9;
172
+ if ($[28] !== clearAllFilters || $[29] !== filterData || $[30] !== getFilterValue || $[31] !== setFilterValue) {
173
+ t9 = {
114
174
  filterData,
115
175
  setFilterValue,
116
176
  getFilterValue,
117
177
  clearAllFilters
118
178
  };
119
- }, [
120
- filterData,
121
- setFilterValue,
122
- getFilterValue,
123
- clearAllFilters
124
- ]);
179
+ $[28] = clearAllFilters;
180
+ $[29] = filterData;
181
+ $[30] = getFilterValue;
182
+ $[31] = setFilterValue;
183
+ $[32] = t9;
184
+ } else t9 = $[32];
185
+ return t9;
125
186
  };
126
187
  //#endregion
127
188
  export { useFilters };
@@ -1,14 +1,48 @@
1
- import { useMemo } from "react";
1
+ import { c } from "react/compiler-runtime";
2
2
  import { useForm } from "react-hook-form";
3
3
  import { zodResolver } from "@hookform/resolvers/zod";
4
4
  //#region src/hooks/useForm.ts
5
- function useForm$1({ resolver, zodSchema, defaultValues, ...props }) {
6
- const formResolver = useMemo(() => resolver ?? (zodSchema ? zodResolver(zodSchema) : void 0), [resolver, zodSchema]);
7
- return useForm({
8
- ...props,
9
- resolver: formResolver,
10
- defaultValues
11
- });
5
+ function useForm$1(t0) {
6
+ const $ = c(12);
7
+ let defaultValues;
8
+ let props;
9
+ let resolver;
10
+ let zodSchema;
11
+ if ($[0] !== t0) {
12
+ ({resolver, zodSchema, defaultValues, ...props} = t0);
13
+ $[0] = t0;
14
+ $[1] = defaultValues;
15
+ $[2] = props;
16
+ $[3] = resolver;
17
+ $[4] = zodSchema;
18
+ } else {
19
+ defaultValues = $[1];
20
+ props = $[2];
21
+ resolver = $[3];
22
+ zodSchema = $[4];
23
+ }
24
+ let t1;
25
+ if ($[5] !== resolver || $[6] !== zodSchema) {
26
+ t1 = resolver ?? (zodSchema ? zodResolver(zodSchema) : void 0);
27
+ $[5] = resolver;
28
+ $[6] = zodSchema;
29
+ $[7] = t1;
30
+ } else t1 = $[7];
31
+ const formResolver = t1;
32
+ const t2 = defaultValues;
33
+ let t3;
34
+ if ($[8] !== formResolver || $[9] !== props || $[10] !== t2) {
35
+ t3 = {
36
+ ...props,
37
+ resolver: formResolver,
38
+ defaultValues: t2
39
+ };
40
+ $[8] = formResolver;
41
+ $[9] = props;
42
+ $[10] = t2;
43
+ $[11] = t3;
44
+ } else t3 = $[11];
45
+ return useForm(t3);
12
46
  }
13
47
  //#endregion
14
48
  export { useForm$1 as useForm };
@@ -1,6 +1,7 @@
1
1
  import { ObjectUtils } from "../utils/object.utils.js";
2
2
  import { useAutosave } from "./useAutosave.js";
3
3
  import { useForm } from "./useForm.js";
4
+ import { c } from "react/compiler-runtime";
4
5
  import { useEffect, useRef } from "react";
5
6
  //#region src/hooks/useFormAutosave.ts
6
7
  var getResetTimeoutErrorMessage = (resetTimeout) => `Form Reset Timeout (${resetTimeout}ms) - Action Required
@@ -15,39 +16,109 @@ Solutions:
15
16
  1. Ensure reset dependencies include all relevant state variables
16
17
  2. Confirm your submission handler updates state properly (check query invalidation)
17
18
  3. For slower operations, consider increasing the timeout threshold`;
18
- function useFormAutosave({ autosaveDelay, enableAutosave, onAutosave, getResetValues, resetDeps, resetTimeout = 5e3, ...props }) {
19
- const form = useForm({
20
- ...props,
21
- defaultValues: getResetValues()
22
- });
19
+ function useFormAutosave(t0) {
20
+ const $ = c(26);
21
+ let autosaveDelay;
22
+ let enableAutosave;
23
+ let getResetValues;
24
+ let onAutosave;
25
+ let props;
26
+ let resetDeps;
27
+ let t1;
28
+ if ($[0] !== t0) {
29
+ ({autosaveDelay, enableAutosave, onAutosave, getResetValues, resetDeps, resetTimeout: t1, ...props} = t0);
30
+ $[0] = t0;
31
+ $[1] = autosaveDelay;
32
+ $[2] = enableAutosave;
33
+ $[3] = getResetValues;
34
+ $[4] = onAutosave;
35
+ $[5] = props;
36
+ $[6] = resetDeps;
37
+ $[7] = t1;
38
+ } else {
39
+ autosaveDelay = $[1];
40
+ enableAutosave = $[2];
41
+ getResetValues = $[3];
42
+ onAutosave = $[4];
43
+ props = $[5];
44
+ resetDeps = $[6];
45
+ t1 = $[7];
46
+ }
47
+ const resetTimeout = t1 === void 0 ? 5e3 : t1;
48
+ let t2;
49
+ if ($[8] !== getResetValues) {
50
+ t2 = getResetValues();
51
+ $[8] = getResetValues;
52
+ $[9] = t2;
53
+ } else t2 = $[9];
54
+ let t3;
55
+ if ($[10] !== props || $[11] !== t2) {
56
+ t3 = {
57
+ ...props,
58
+ defaultValues: t2
59
+ };
60
+ $[10] = props;
61
+ $[11] = t2;
62
+ $[12] = t3;
63
+ } else t3 = $[12];
64
+ const form = useForm(t3);
23
65
  const shouldResetFormValuesRef = useRef(false);
24
66
  const resetFormValuesTimeoutRef = useRef(void 0);
25
- useEffect(() => {
26
- const resetValues = getResetValues();
27
- if (resetValues === void 0) return;
28
- const resetFormValues = async () => {
29
- const keepStateOptions = shouldResetFormValuesRef.current ? { keepDirtyValues: true } : void 0;
30
- shouldResetFormValuesRef.current = false;
31
- let values = resetValues;
32
- if (ObjectUtils.isFunction(resetValues)) values = await resetValues();
33
- form.reset(values, keepStateOptions);
67
+ let t4;
68
+ if ($[13] !== form || $[14] !== getResetValues) {
69
+ t4 = () => {
70
+ const resetValues = getResetValues();
71
+ if (resetValues === void 0) return;
72
+ const resetFormValues = async () => {
73
+ const keepStateOptions = shouldResetFormValuesRef.current ? { keepDirtyValues: true } : void 0;
74
+ shouldResetFormValuesRef.current = false;
75
+ let values = resetValues;
76
+ if (ObjectUtils.isFunction(resetValues)) values = await resetValues();
77
+ form.reset(values, keepStateOptions);
78
+ };
79
+ resetFormValues();
80
+ };
81
+ $[13] = form;
82
+ $[14] = getResetValues;
83
+ $[15] = t4;
84
+ } else t4 = $[15];
85
+ let t5;
86
+ if ($[16] !== resetDeps) {
87
+ t5 = [...resetDeps];
88
+ $[16] = resetDeps;
89
+ $[17] = t5;
90
+ } else t5 = $[17];
91
+ useEffect(t4, t5);
92
+ let t6;
93
+ if ($[18] !== resetTimeout) {
94
+ t6 = () => {
95
+ shouldResetFormValuesRef.current = true;
96
+ if (resetFormValuesTimeoutRef.current) clearTimeout(resetFormValuesTimeoutRef.current);
97
+ resetFormValuesTimeoutRef.current = setTimeout(() => {
98
+ if (shouldResetFormValuesRef.current) throw new Error(getResetTimeoutErrorMessage(resetTimeout));
99
+ }, resetTimeout);
100
+ };
101
+ $[18] = resetTimeout;
102
+ $[19] = t6;
103
+ } else t6 = $[19];
104
+ const onSaveSuccess = t6;
105
+ let t7;
106
+ if ($[20] !== autosaveDelay || $[21] !== enableAutosave || $[22] !== form || $[23] !== onAutosave || $[24] !== onSaveSuccess) {
107
+ t7 = {
108
+ form,
109
+ delay: autosaveDelay,
110
+ enabled: enableAutosave,
111
+ onSave: onAutosave,
112
+ onSaveSuccess
34
113
  };
35
- resetFormValues();
36
- }, [...resetDeps]);
37
- const onSaveSuccess = () => {
38
- shouldResetFormValuesRef.current = true;
39
- if (resetFormValuesTimeoutRef.current) clearTimeout(resetFormValuesTimeoutRef.current);
40
- resetFormValuesTimeoutRef.current = setTimeout(() => {
41
- if (shouldResetFormValuesRef.current) throw new Error(getResetTimeoutErrorMessage(resetTimeout));
42
- }, resetTimeout);
43
- };
44
- useAutosave({
45
- form,
46
- delay: autosaveDelay,
47
- enabled: enableAutosave,
48
- onSave: onAutosave,
49
- onSaveSuccess
50
- });
114
+ $[20] = autosaveDelay;
115
+ $[21] = enableAutosave;
116
+ $[22] = form;
117
+ $[23] = onAutosave;
118
+ $[24] = onSaveSuccess;
119
+ $[25] = t7;
120
+ } else t7 = $[25];
121
+ useAutosave(t7);
51
122
  return form;
52
123
  }
53
124
  //#endregion
@@ -1,44 +1,98 @@
1
- import { useCallback, useEffect, useMemo, useRef } from "react";
1
+ import { c } from "react/compiler-runtime";
2
+ import { useEffect, useRef } from "react";
2
3
  //#region src/hooks/useIntersectionObserver.ts
3
- var useIntersectionObserver = ({ onIntersection, onIntersectionChange, root, rootMargin, threshold }) => {
4
+ var useIntersectionObserver = (t0) => {
5
+ const $ = c(13);
6
+ const { onIntersection, onIntersectionChange, root, rootMargin, threshold } = t0;
4
7
  const elementRef = useRef(null);
5
8
  const observerRef = useRef(null);
6
9
  const onIntersectionRef = useRef(onIntersection);
7
10
  const onIntersectionChangeRef = useRef(onIntersectionChange);
8
- useEffect(() => {
9
- onIntersectionRef.current = onIntersection;
10
- }, [onIntersection]);
11
- useEffect(() => {
12
- onIntersectionChangeRef.current = onIntersectionChange;
13
- }, [onIntersectionChange]);
14
- useEffect(() => {
15
- const observer = new IntersectionObserver((entries) => {
16
- if (entries.some((entry) => entry.isIntersecting)) onIntersectionRef.current?.();
17
- onIntersectionChangeRef.current?.(entries[0]);
18
- }, {
11
+ let t1;
12
+ let t2;
13
+ if ($[0] !== onIntersection) {
14
+ t1 = () => {
15
+ onIntersectionRef.current = onIntersection;
16
+ };
17
+ t2 = [onIntersection];
18
+ $[0] = onIntersection;
19
+ $[1] = t1;
20
+ $[2] = t2;
21
+ } else {
22
+ t1 = $[1];
23
+ t2 = $[2];
24
+ }
25
+ useEffect(t1, t2);
26
+ let t3;
27
+ let t4;
28
+ if ($[3] !== onIntersectionChange) {
29
+ t3 = () => {
30
+ onIntersectionChangeRef.current = onIntersectionChange;
31
+ };
32
+ t4 = [onIntersectionChange];
33
+ $[3] = onIntersectionChange;
34
+ $[4] = t3;
35
+ $[5] = t4;
36
+ } else {
37
+ t3 = $[4];
38
+ t4 = $[5];
39
+ }
40
+ useEffect(t3, t4);
41
+ let t5;
42
+ let t6;
43
+ if ($[6] !== root || $[7] !== rootMargin || $[8] !== threshold) {
44
+ t5 = () => {
45
+ const observer = new IntersectionObserver((entries) => {
46
+ if (entries.some(_temp)) onIntersectionRef.current?.();
47
+ onIntersectionChangeRef.current?.(entries[0]);
48
+ }, {
49
+ root,
50
+ rootMargin,
51
+ threshold
52
+ });
53
+ observerRef.current = observer;
54
+ if (elementRef.current) observer.observe(elementRef.current);
55
+ return () => {
56
+ if (elementRef.current) observer.unobserve(elementRef.current);
57
+ observer.disconnect();
58
+ observerRef.current = null;
59
+ };
60
+ };
61
+ t6 = [
19
62
  root,
20
63
  rootMargin,
21
64
  threshold
22
- });
23
- observerRef.current = observer;
24
- if (elementRef.current) observer.observe(elementRef.current);
25
- return () => {
26
- if (elementRef.current) observer.unobserve(elementRef.current);
27
- observer.disconnect();
28
- observerRef.current = null;
65
+ ];
66
+ $[6] = root;
67
+ $[7] = rootMargin;
68
+ $[8] = threshold;
69
+ $[9] = t5;
70
+ $[10] = t6;
71
+ } else {
72
+ t5 = $[9];
73
+ t6 = $[10];
74
+ }
75
+ useEffect(t5, t6);
76
+ let t7;
77
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
78
+ t7 = (element) => {
79
+ if (elementRef.current === element) return;
80
+ if (observerRef.current && elementRef.current) observerRef.current.unobserve(elementRef.current);
81
+ elementRef.current = element;
82
+ if (observerRef.current && elementRef.current) observerRef.current.observe(elementRef.current);
29
83
  };
30
- }, [
31
- root,
32
- rootMargin,
33
- threshold
34
- ]);
35
- const ref = useCallback((element) => {
36
- if (elementRef.current === element) return;
37
- if (observerRef.current && elementRef.current) observerRef.current.unobserve(elementRef.current);
38
- elementRef.current = element;
39
- if (observerRef.current && elementRef.current) observerRef.current.observe(elementRef.current);
40
- }, []);
41
- return useMemo(() => ({ ref }), [ref]);
84
+ $[11] = t7;
85
+ } else t7 = $[11];
86
+ const ref = t7;
87
+ let t8;
88
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
89
+ t8 = { ref };
90
+ $[12] = t8;
91
+ } else t8 = $[12];
92
+ return t8;
42
93
  };
94
+ function _temp(entry) {
95
+ return entry.isIntersecting;
96
+ }
43
97
  //#endregion
44
98
  export { useIntersectionObserver };
@@ -1,4 +1,5 @@
1
- import { useCallback, useState } from "react";
1
+ import { c } from "react/compiler-runtime";
2
+ import { useState } from "react";
2
3
  //#region src/hooks/useLocalStorage.ts
3
4
  var getValue = (key, schema) => {
4
5
  if (!localStorage) return null;
@@ -14,24 +15,56 @@ var getValue = (key, schema) => {
14
15
  if (parsedValue.success) return parsedValue.data;
15
16
  else return null;
16
17
  };
17
- var useLocalStorage = ({ key, schema }) => {
18
- const [value, setValue] = useState(() => getValue(key, schema));
19
- return {
20
- value,
21
- set: useCallback((newValue) => {
18
+ var useLocalStorage = (t0) => {
19
+ const $ = c(12);
20
+ const { key, schema } = t0;
21
+ let t1;
22
+ if ($[0] !== key || $[1] !== schema) {
23
+ t1 = () => getValue(key, schema);
24
+ $[0] = key;
25
+ $[1] = schema;
26
+ $[2] = t1;
27
+ } else t1 = $[2];
28
+ const [value, setValue] = useState(t1);
29
+ let t2;
30
+ if ($[3] !== key || $[4] !== schema) {
31
+ t2 = (newValue) => {
22
32
  if (!localStorage) return;
23
33
  const parsedValue = schema.safeParse(newValue);
24
34
  if (!parsedValue.success) return;
25
35
  if (typeof parsedValue.data === "string") localStorage.setItem(key, parsedValue.data);
26
36
  else localStorage.setItem(key, JSON.stringify(parsedValue.data));
27
37
  setValue(parsedValue.data);
28
- }, [key, schema]),
29
- remove: useCallback(() => {
38
+ };
39
+ $[3] = key;
40
+ $[4] = schema;
41
+ $[5] = t2;
42
+ } else t2 = $[5];
43
+ const set = t2;
44
+ let t3;
45
+ if ($[6] !== key) {
46
+ t3 = () => {
30
47
  if (!localStorage) return;
31
48
  localStorage.removeItem(key);
32
49
  setValue(null);
33
- }, [key])
34
- };
50
+ };
51
+ $[6] = key;
52
+ $[7] = t3;
53
+ } else t3 = $[7];
54
+ const remove = t3;
55
+ let t4;
56
+ if ($[8] !== remove || $[9] !== set || $[10] !== value) {
57
+ t4 = {
58
+ value,
59
+ set,
60
+ remove
61
+ };
62
+ $[8] = remove;
63
+ $[9] = set;
64
+ $[10] = value;
65
+ $[11] = t4;
66
+ } else t4 = $[11];
67
+ return t4;
35
68
  };
36
69
  //#endregion
37
70
  export { useLocalStorage };