@povio/ui 3.1.0 → 3.2.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.
- package/dist/assets/icons/AlignCenter.js +26 -11
- package/dist/assets/icons/AlignLeft.js +26 -11
- package/dist/assets/icons/AlignLeftRight.js +26 -11
- package/dist/assets/icons/AlignRight.js +26 -11
- package/dist/assets/icons/ArrowDropDown.js +26 -11
- package/dist/assets/icons/ArrowDropUp.js +26 -11
- package/dist/assets/icons/ArrowLeft.js +26 -11
- package/dist/assets/icons/ArrowRight.js +26 -11
- package/dist/assets/icons/Bold.js +26 -11
- package/dist/assets/icons/BulletedList.js +26 -11
- package/dist/assets/icons/Calendar.js +28 -13
- package/dist/assets/icons/Check.js +28 -13
- package/dist/assets/icons/CheckCircle.js +26 -11
- package/dist/assets/icons/CheckboxCheckmark.js +29 -14
- package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
- package/dist/assets/icons/ChevronDown.js +28 -13
- package/dist/assets/icons/ChevronLeft.js +28 -13
- package/dist/assets/icons/ChevronRight.js +28 -13
- package/dist/assets/icons/ChevronUp.js +28 -13
- package/dist/assets/icons/ChevronsLeft.js +28 -13
- package/dist/assets/icons/ChevronsRight.js +28 -13
- package/dist/assets/icons/Clock.js +26 -11
- package/dist/assets/icons/Close.js +26 -11
- package/dist/assets/icons/DateTime.js +35 -14
- package/dist/assets/icons/DragIndicator.js +26 -11
- package/dist/assets/icons/File.js +28 -13
- package/dist/assets/icons/Highlight.js +26 -11
- package/dist/assets/icons/HighlightOn.js +49 -15
- package/dist/assets/icons/Home.js +26 -11
- package/dist/assets/icons/Info.js +37 -16
- package/dist/assets/icons/Italic.js +26 -11
- package/dist/assets/icons/Link.js +26 -11
- package/dist/assets/icons/Menu.js +26 -11
- package/dist/assets/icons/NumberedList.js +26 -11
- package/dist/assets/icons/PointerHorizontal.js +26 -11
- package/dist/assets/icons/PointerVertical.js +26 -11
- package/dist/assets/icons/Search.js +26 -11
- package/dist/assets/icons/Send.js +28 -13
- package/dist/assets/icons/Strikethrough.js +26 -11
- package/dist/assets/icons/TextColor.js +48 -14
- package/dist/assets/icons/Today.js +26 -11
- package/dist/assets/icons/Underlined.js +28 -13
- package/dist/assets/icons/Upload.js +35 -14
- package/dist/assets/icons/Visibility.js +26 -11
- package/dist/assets/icons/VisibilityOff.js +26 -11
- package/dist/assets/icons/WarningFilled.js +28 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +32 -9
- package/dist/components/Menu/MenuMobile.js +102 -39
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/Button/button.cva.d.ts +3 -3
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
- package/dist/components/buttons/TextButton/TextButton.js +30 -8
- package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
- package/dist/components/buttons/shared/ButtonContent.js +80 -22
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +201 -35
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +380 -75
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +499 -186
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +14 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +280 -46
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +7 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +616 -121
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +342 -119
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +310 -103
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +150 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +233 -98
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +288 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +14 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +359 -129
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +18 -1
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +104 -11
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +83 -28
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
- package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +211 -65
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +5 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +15 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +32 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +41 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +99 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +91 -46
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/index.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +102 -15
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +0 -11
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -18
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +81 -22
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
- package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +13 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +14 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +446 -97
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +571 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +574 -0
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +8 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +305 -90
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +429 -90
- package/dist/components/inputs/Input/shared/InputContent.js +193 -59
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +15 -21
- package/dist/components/inputs/Inputs/InputItem.js +69 -14
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +353 -61
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +45 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +48 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +217 -22
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +107 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +37 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +178 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +227 -18
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -18
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +393 -138
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +397 -116
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +164 -52
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +14 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +43 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +67 -36
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +12 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +8 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +54 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +83 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +612 -0
- package/dist/components/inputs/Slider/Slider.d.ts +2 -1
- package/dist/components/inputs/Slider/Slider.js +265 -76
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -98
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +214 -37
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +21 -11
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +88 -12
- package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
- package/dist/components/inputs/shared/input.cva.d.ts +28 -0
- package/dist/components/inputs/shared/input.cva.js +38 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +8 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +15 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +112 -0
- package/dist/components/navigation/Accordion/Accordion.js +69 -22
- package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
- package/dist/components/navigation/Stepper/Stepper.js +67 -22
- package/dist/components/navigation/Stepper/StepperItem.js +104 -31
- package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
- package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
- package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
- package/dist/components/overlays/Drawer/Drawer.js +62 -20
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +85 -28
- package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/segment/Segment.js +218 -57
- package/dist/components/segment/SegmentItem.js +67 -10
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +28 -14
- package/dist/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +28 -27
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.js +42 -16
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.d.ts +20 -6
- package/dist/config/uiConfig.context.js +68 -14
- package/dist/config/uiOverrides.context.d.ts +30 -11
- package/dist/config/uiOverrides.context.js +54 -14
- package/dist/helpers/dynamicInputs.d.ts +12 -9
- package/dist/helpers/dynamicInputs.js +13 -8
- package/dist/hooks/useAutosave.d.ts +2 -1
- package/dist/hooks/useAutosave.js +12 -4
- package/dist/hooks/useAutosave.spec.d.ts +1 -0
- package/dist/hooks/useBreakpoint.js +16 -3
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useFilters.js +125 -64
- package/dist/hooks/useForm.js +42 -8
- package/dist/hooks/useFormAutosave.d.ts +3 -1
- package/dist/hooks/useFormAutosave.js +122 -30
- package/dist/hooks/useFormAutosave.spec.d.ts +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +91 -24
- package/dist/hooks/useKeyInteractions.d.ts +20 -0
- package/dist/hooks/useKeyInteractions.js +54 -0
- package/dist/hooks/useKeyInteractions.spec.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +43 -10
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.js +49 -19
- package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
- package/dist/hooks/useQueryAutocomplete.js +72 -0
- package/dist/hooks/useScrollableListBox.js +37 -16
- package/dist/hooks/useSorting.js +69 -28
- package/dist/hooks/useStateAndRef.js +21 -7
- package/dist/hooks/useTableColumnConfig.js +124 -31
- package/dist/hooks/useTranslationMemo.js +25 -5
- package/dist/index.d.ts +18 -3
- package/dist/index.js +15 -5
- package/dist/tw-ui-plugin.js +6 -0
- package/dist/utils/date-time.utils.d.ts +38 -10
- package/dist/utils/date-time.utils.js +136 -22
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/dist/utils/zod.utils.d.ts +2 -0
- package/dist/utils/zod.utils.js +5 -0
- package/package.json +2 -2
package/dist/hooks/useForm.js
CHANGED
|
@@ -1,14 +1,48 @@
|
|
|
1
|
-
import {
|
|
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(
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 };
|
|
@@ -5,9 +5,11 @@ import { UseFormProps, UseFormResolverProps } from './useForm';
|
|
|
5
5
|
export type UseFormAutosaveProps<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues, TResponse = unknown> = Omit<UseFormProps<TFieldValues, TContext, TTransformedValues>, "defaultValues"> & UseFormResolverProps<TFieldValues, TTransformedValues> & {
|
|
6
6
|
autosaveDelay?: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>["delay"];
|
|
7
7
|
enableAutosave?: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>["enabled"];
|
|
8
|
+
autosaveOn?: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>["trigger"];
|
|
9
|
+
normalizeAutosaveData?: (data: Partial<TTransformedValues>) => Partial<TTransformedValues> | undefined;
|
|
8
10
|
onAutosave: UseAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>["onSave"];
|
|
9
11
|
getResetValues: () => UseFormProps<TFieldValues, TContext, TTransformedValues>["defaultValues"];
|
|
10
12
|
resetDeps: DependencyList;
|
|
11
13
|
resetTimeout?: number;
|
|
12
14
|
};
|
|
13
|
-
export declare function useFormAutosave<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues, TResponse = any>({ autosaveDelay, enableAutosave, onAutosave, getResetValues, resetDeps, resetTimeout, ...props }: UseFormAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>): import('react-hook-form').UseFormReturn<TFieldValues, TContext, TTransformedValues>;
|
|
15
|
+
export declare function useFormAutosave<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues, TResponse = any>({ autosaveDelay, enableAutosave, autosaveOn, normalizeAutosaveData, onAutosave, getResetValues, resetDeps, resetTimeout, ...props }: UseFormAutosaveProps<TFieldValues, TContext, TTransformedValues, TResponse>): import('react-hook-form').UseFormReturn<TFieldValues, TContext, TTransformedValues>;
|
|
@@ -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,130 @@ 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(
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
function useFormAutosave(t0) {
|
|
20
|
+
const $ = c(32);
|
|
21
|
+
let autosaveDelay;
|
|
22
|
+
let enableAutosave;
|
|
23
|
+
let getResetValues;
|
|
24
|
+
let normalizeAutosaveData;
|
|
25
|
+
let onAutosave;
|
|
26
|
+
let props;
|
|
27
|
+
let resetDeps;
|
|
28
|
+
let t1;
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[0] !== t0) {
|
|
31
|
+
({autosaveDelay, enableAutosave, autosaveOn: t1, normalizeAutosaveData, onAutosave, getResetValues, resetDeps, resetTimeout: t2, ...props} = t0);
|
|
32
|
+
$[0] = t0;
|
|
33
|
+
$[1] = autosaveDelay;
|
|
34
|
+
$[2] = enableAutosave;
|
|
35
|
+
$[3] = getResetValues;
|
|
36
|
+
$[4] = normalizeAutosaveData;
|
|
37
|
+
$[5] = onAutosave;
|
|
38
|
+
$[6] = props;
|
|
39
|
+
$[7] = resetDeps;
|
|
40
|
+
$[8] = t1;
|
|
41
|
+
$[9] = t2;
|
|
42
|
+
} else {
|
|
43
|
+
autosaveDelay = $[1];
|
|
44
|
+
enableAutosave = $[2];
|
|
45
|
+
getResetValues = $[3];
|
|
46
|
+
normalizeAutosaveData = $[4];
|
|
47
|
+
onAutosave = $[5];
|
|
48
|
+
props = $[6];
|
|
49
|
+
resetDeps = $[7];
|
|
50
|
+
t1 = $[8];
|
|
51
|
+
t2 = $[9];
|
|
52
|
+
}
|
|
53
|
+
const autosaveOn = t1 === void 0 ? "change" : t1;
|
|
54
|
+
const resetTimeout = t2 === void 0 ? 5e3 : t2;
|
|
55
|
+
let t3;
|
|
56
|
+
if ($[10] !== getResetValues) {
|
|
57
|
+
t3 = getResetValues();
|
|
58
|
+
$[10] = getResetValues;
|
|
59
|
+
$[11] = t3;
|
|
60
|
+
} else t3 = $[11];
|
|
61
|
+
let t4;
|
|
62
|
+
if ($[12] !== props || $[13] !== t3) {
|
|
63
|
+
t4 = {
|
|
64
|
+
...props,
|
|
65
|
+
defaultValues: t3
|
|
66
|
+
};
|
|
67
|
+
$[12] = props;
|
|
68
|
+
$[13] = t3;
|
|
69
|
+
$[14] = t4;
|
|
70
|
+
} else t4 = $[14];
|
|
71
|
+
const form = useForm(t4);
|
|
23
72
|
const shouldResetFormValuesRef = useRef(false);
|
|
24
73
|
const resetFormValuesTimeoutRef = useRef(void 0);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
74
|
+
let t5;
|
|
75
|
+
if ($[15] !== form || $[16] !== getResetValues) {
|
|
76
|
+
t5 = () => {
|
|
77
|
+
const resetValues = getResetValues();
|
|
78
|
+
if (resetValues === void 0) return;
|
|
79
|
+
const resetFormValues = async () => {
|
|
80
|
+
const keepStateOptions = shouldResetFormValuesRef.current ? { keepDirtyValues: true } : void 0;
|
|
81
|
+
shouldResetFormValuesRef.current = false;
|
|
82
|
+
let values = resetValues;
|
|
83
|
+
if (ObjectUtils.isFunction(resetValues)) values = await resetValues();
|
|
84
|
+
form.reset(values, keepStateOptions);
|
|
85
|
+
};
|
|
86
|
+
resetFormValues();
|
|
87
|
+
};
|
|
88
|
+
$[15] = form;
|
|
89
|
+
$[16] = getResetValues;
|
|
90
|
+
$[17] = t5;
|
|
91
|
+
} else t5 = $[17];
|
|
92
|
+
let t6;
|
|
93
|
+
if ($[18] !== resetDeps) {
|
|
94
|
+
t6 = [...resetDeps];
|
|
95
|
+
$[18] = resetDeps;
|
|
96
|
+
$[19] = t6;
|
|
97
|
+
} else t6 = $[19];
|
|
98
|
+
useEffect(t5, t6);
|
|
99
|
+
let t7;
|
|
100
|
+
if ($[20] !== resetTimeout) {
|
|
101
|
+
t7 = () => {
|
|
102
|
+
shouldResetFormValuesRef.current = true;
|
|
103
|
+
if (resetFormValuesTimeoutRef.current) clearTimeout(resetFormValuesTimeoutRef.current);
|
|
104
|
+
resetFormValuesTimeoutRef.current = setTimeout(() => {
|
|
105
|
+
if (shouldResetFormValuesRef.current) throw new Error(getResetTimeoutErrorMessage(resetTimeout));
|
|
106
|
+
}, resetTimeout);
|
|
107
|
+
};
|
|
108
|
+
$[20] = resetTimeout;
|
|
109
|
+
$[21] = t7;
|
|
110
|
+
} else t7 = $[21];
|
|
111
|
+
const onSaveSuccess = t7;
|
|
112
|
+
let t8;
|
|
113
|
+
if ($[22] !== normalizeAutosaveData || $[23] !== onAutosave) {
|
|
114
|
+
t8 = (data) => {
|
|
115
|
+
const normalizedData = normalizeAutosaveData ? normalizeAutosaveData(data) : data;
|
|
116
|
+
if (!normalizedData || ObjectUtils.isEmpty(normalizedData)) return Promise.resolve(void 0);
|
|
117
|
+
return onAutosave(normalizedData);
|
|
118
|
+
};
|
|
119
|
+
$[22] = normalizeAutosaveData;
|
|
120
|
+
$[23] = onAutosave;
|
|
121
|
+
$[24] = t8;
|
|
122
|
+
} else t8 = $[24];
|
|
123
|
+
const onSave = t8;
|
|
124
|
+
let t9;
|
|
125
|
+
if ($[25] !== autosaveDelay || $[26] !== autosaveOn || $[27] !== enableAutosave || $[28] !== form || $[29] !== onSave || $[30] !== onSaveSuccess) {
|
|
126
|
+
t9 = {
|
|
127
|
+
form,
|
|
128
|
+
delay: autosaveDelay,
|
|
129
|
+
enabled: enableAutosave,
|
|
130
|
+
trigger: autosaveOn,
|
|
131
|
+
onSave,
|
|
132
|
+
onSaveSuccess
|
|
34
133
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
useAutosave({
|
|
45
|
-
form,
|
|
46
|
-
delay: autosaveDelay,
|
|
47
|
-
enabled: enableAutosave,
|
|
48
|
-
onSave: onAutosave,
|
|
49
|
-
onSaveSuccess
|
|
50
|
-
});
|
|
134
|
+
$[25] = autosaveDelay;
|
|
135
|
+
$[26] = autosaveOn;
|
|
136
|
+
$[27] = enableAutosave;
|
|
137
|
+
$[28] = form;
|
|
138
|
+
$[29] = onSave;
|
|
139
|
+
$[30] = onSaveSuccess;
|
|
140
|
+
$[31] = t9;
|
|
141
|
+
} else t9 = $[31];
|
|
142
|
+
useAutosave(t9);
|
|
51
143
|
return form;
|
|
52
144
|
}
|
|
53
145
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,6 @@ type UseIntersectionObserverProps = {
|
|
|
3
3
|
onIntersectionChange?: (entry: IntersectionObserverEntry) => void;
|
|
4
4
|
} & IntersectionObserverInit;
|
|
5
5
|
export declare const useIntersectionObserver: <T extends HTMLElement>({ onIntersection, onIntersectionChange, root, rootMargin, threshold, }: UseIntersectionObserverProps) => {
|
|
6
|
-
ref: (
|
|
6
|
+
ref: (element: T | null) => void;
|
|
7
7
|
};
|
|
8
8
|
export {};
|
|
@@ -1,31 +1,98 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
2
3
|
//#region src/hooks/useIntersectionObserver.ts
|
|
3
|
-
var useIntersectionObserver = (
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
var useIntersectionObserver = (t0) => {
|
|
5
|
+
const $ = c(13);
|
|
6
|
+
const { onIntersection, onIntersectionChange, root, rootMargin, threshold } = t0;
|
|
7
|
+
const elementRef = useRef(null);
|
|
8
|
+
const observerRef = useRef(null);
|
|
9
|
+
const onIntersectionRef = useRef(onIntersection);
|
|
10
|
+
const onIntersectionChangeRef = useRef(onIntersectionChange);
|
|
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 = [
|
|
14
62
|
root,
|
|
15
63
|
rootMargin,
|
|
16
64
|
threshold
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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);
|
|
83
|
+
};
|
|
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;
|
|
29
93
|
};
|
|
94
|
+
function _temp(entry) {
|
|
95
|
+
return entry.isIntersecting;
|
|
96
|
+
}
|
|
30
97
|
//#endregion
|
|
31
98
|
export { useIntersectionObserver };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
export type KeyInteractionAction = "up" | "down" | "left" | "right" | "space" | "escape" | "enter" | "backspace";
|
|
3
|
+
export type KeyInteractionCallback<TElement extends HTMLElement = HTMLElement> = (event: KeyboardEvent<TElement>) => void;
|
|
4
|
+
export interface KeyInteraction<TElement extends HTMLElement = HTMLElement> {
|
|
5
|
+
callback: KeyInteractionCallback<TElement>;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
preventDefault?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface KeyInteractionGroup<TElement extends HTMLElement = HTMLElement> extends KeyInteraction<TElement> {
|
|
10
|
+
actions: KeyInteractionAction[];
|
|
11
|
+
}
|
|
12
|
+
export type KeyInteractions<TElement extends HTMLElement = HTMLElement> = Partial<Record<KeyInteractionAction, KeyInteraction<TElement>>> & {
|
|
13
|
+
interactions?: KeyInteractionGroup<TElement>[];
|
|
14
|
+
};
|
|
15
|
+
export interface UseKeyInteractionsResult<TElement extends HTMLElement = HTMLElement> {
|
|
16
|
+
onKeyDown: (event: KeyboardEvent<TElement>) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const getKeyInteractionAction: (event: Pick<KeyboardEvent, "code" | "key">) => KeyInteractionAction | undefined;
|
|
19
|
+
export declare const createKeyInteractionsHandler: <TElement extends HTMLElement = HTMLElement>(interactions: KeyInteractions<TElement>) => (event: KeyboardEvent<TElement>) => void;
|
|
20
|
+
export declare const useKeyInteractions: <TElement extends HTMLElement = HTMLElement>(interactions: KeyInteractions<TElement>) => UseKeyInteractionsResult<TElement>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
//#region src/hooks/useKeyInteractions.ts
|
|
3
|
+
var KEY_TO_ACTION = {
|
|
4
|
+
ArrowUp: "up",
|
|
5
|
+
ArrowDown: "down",
|
|
6
|
+
ArrowLeft: "left",
|
|
7
|
+
ArrowRight: "right",
|
|
8
|
+
" ": "space",
|
|
9
|
+
Spacebar: "space",
|
|
10
|
+
Escape: "escape",
|
|
11
|
+
Enter: "enter",
|
|
12
|
+
Backspace: "backspace"
|
|
13
|
+
};
|
|
14
|
+
var getKeyInteractionAction = (event) => {
|
|
15
|
+
return KEY_TO_ACTION[event.key] ?? (event.code === "Space" ? "space" : void 0);
|
|
16
|
+
};
|
|
17
|
+
var createKeyInteractionsHandler = (interactions) => {
|
|
18
|
+
return (event) => handleKeyInteraction({
|
|
19
|
+
event,
|
|
20
|
+
interactions
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var useKeyInteractions = (interactions) => {
|
|
24
|
+
const $ = c(4);
|
|
25
|
+
let t0;
|
|
26
|
+
if ($[0] !== interactions) {
|
|
27
|
+
t0 = (event) => handleKeyInteraction({
|
|
28
|
+
event,
|
|
29
|
+
interactions
|
|
30
|
+
});
|
|
31
|
+
$[0] = interactions;
|
|
32
|
+
$[1] = t0;
|
|
33
|
+
} else t0 = $[1];
|
|
34
|
+
const onKeyDown = t0;
|
|
35
|
+
let t1;
|
|
36
|
+
if ($[2] !== onKeyDown) {
|
|
37
|
+
t1 = { onKeyDown };
|
|
38
|
+
$[2] = onKeyDown;
|
|
39
|
+
$[3] = t1;
|
|
40
|
+
} else t1 = $[3];
|
|
41
|
+
return t1;
|
|
42
|
+
};
|
|
43
|
+
var handleKeyInteraction = ({ event, interactions }) => {
|
|
44
|
+
const action = getKeyInteractionAction(event);
|
|
45
|
+
if (!action) return;
|
|
46
|
+
const interaction = interactions[action];
|
|
47
|
+
const groupInteraction = interactions.interactions?.find((group) => group.actions.includes(action));
|
|
48
|
+
const selectedInteraction = interaction ?? groupInteraction;
|
|
49
|
+
if (!selectedInteraction || selectedInteraction.enabled === false) return;
|
|
50
|
+
if (selectedInteraction.preventDefault) event.preventDefault();
|
|
51
|
+
selectedInteraction.callback(event);
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { createKeyInteractionsHandler, getKeyInteractionAction, useKeyInteractions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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 = (
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
}
|
|
29
|
-
|
|
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
|
-
}
|
|
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 };
|
|
@@ -1,29 +1,64 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
1
2
|
import { useEffect, useRef } from "react";
|
|
2
3
|
//#region src/hooks/useLongPressRepeat.ts
|
|
3
|
-
var useLongPressRepeat = (
|
|
4
|
+
var useLongPressRepeat = (t0) => {
|
|
5
|
+
const $ = c(10);
|
|
6
|
+
const { onPress, enabled: t1, interval: t2, timeout: t3 } = t0;
|
|
7
|
+
const enabled = t1 === void 0 ? true : t1;
|
|
8
|
+
const interval = t2 === void 0 ? 85 : t2;
|
|
9
|
+
const timeout = t3 === void 0 ? 500 : t3;
|
|
4
10
|
const intervalRef = useRef(void 0);
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
let t4;
|
|
12
|
+
let t5;
|
|
13
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
14
|
+
t4 = () => () => {
|
|
7
15
|
clearInterval(intervalRef.current);
|
|
8
16
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
t5 = [];
|
|
18
|
+
$[0] = t4;
|
|
19
|
+
$[1] = t5;
|
|
20
|
+
} else {
|
|
21
|
+
t4 = $[0];
|
|
22
|
+
t5 = $[1];
|
|
23
|
+
}
|
|
24
|
+
useEffect(t4, t5);
|
|
25
|
+
let t6;
|
|
26
|
+
if ($[2] !== enabled || $[3] !== interval || $[4] !== onPress || $[5] !== timeout) {
|
|
27
|
+
t6 = () => {
|
|
28
|
+
onPress(false);
|
|
29
|
+
if (!enabled) return;
|
|
30
|
+
intervalRef.current = setTimeout(() => {
|
|
16
31
|
onPress(true);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
intervalRef.current = setInterval(() => {
|
|
33
|
+
onPress(true);
|
|
34
|
+
}, interval);
|
|
35
|
+
}, timeout);
|
|
36
|
+
};
|
|
37
|
+
$[2] = enabled;
|
|
38
|
+
$[3] = interval;
|
|
39
|
+
$[4] = onPress;
|
|
40
|
+
$[5] = timeout;
|
|
41
|
+
$[6] = t6;
|
|
42
|
+
} else t6 = $[6];
|
|
43
|
+
const onPressStart = t6;
|
|
44
|
+
let t7;
|
|
45
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
46
|
+
t7 = () => {
|
|
47
|
+
clearInterval(intervalRef.current);
|
|
48
|
+
};
|
|
49
|
+
$[7] = t7;
|
|
50
|
+
} else t7 = $[7];
|
|
51
|
+
const onPressEnd = t7;
|
|
52
|
+
let t8;
|
|
53
|
+
if ($[8] !== onPressStart) {
|
|
54
|
+
t8 = {
|
|
55
|
+
onPressStart,
|
|
56
|
+
onPressEnd
|
|
57
|
+
};
|
|
58
|
+
$[8] = onPressStart;
|
|
59
|
+
$[9] = t8;
|
|
60
|
+
} else t8 = $[9];
|
|
61
|
+
return t8;
|
|
27
62
|
};
|
|
28
63
|
//#endregion
|
|
29
64
|
export { useLongPressRepeat };
|