@povio/ui 5.0.0-rc.3 → 5.0.0-rc.4
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/README.md +6 -2
- package/dist/{Breadcrumbs-CbKzAq1v.js → Breadcrumbs-FF8hMfXd.js} +1 -1
- package/dist/{Calendar-CVSQH-rC.js → Calendar-BTjajO6i.js} +6 -136
- package/dist/{Checkbox-BU0d702K.js → Checkbox-CV1ILXXO.js} +1 -1
- package/dist/{CheckboxCheckmark-usHsolNj.js → CheckboxCheckmark-CpC3wlMs.js} +1 -1
- package/dist/{ComponentGallery-DIFeJqGx.js → ComponentGallery-BWiPGUL8.js} +1343 -206
- package/dist/{DatePicker-D95gDPhg.js → DatePicker-DOLL7mkc.js} +12 -12
- package/dist/{DatePickerInput-CX6NYim4.js → DatePickerInput-BLBcySA2.js} +8 -7
- package/dist/{DateRangePicker-_uTQk_ae.js → DateRangePicker-BF-1CztH.js} +13 -185
- package/dist/{DateTimePicker-BB058Z34.js → DateTimePicker-Cj0qvJUz.js} +12 -12
- package/dist/{FileInput-C0-6bw4w.js → FileInput-Br5DQaGQ.js} +3 -2
- package/dist/{FileTrigger-CDXcQthK.js → FileTrigger-Cthk5_Wp.js} +1 -30
- package/dist/{FileUpload-DDpYMn8f.js → FileUpload--7ub3EZO.js} +3 -2
- package/dist/{FormField-U_-d4V_g.js → FormField-B99dLt8o.js} +1 -1
- package/dist/{FormFieldHeaderTooltip-DXbuu88v.js → FormFieldHeaderTooltip-BV2Ju4oB.js} +1 -1
- package/dist/{InlineTooltipWrapper-Bpmd--e7.js → InlineTooltipWrapper-BpApaGXV.js} +1 -1
- package/dist/{InputItem-D-KuiNSc.js → InputItem-CIxbTxZu.js} +10 -10
- package/dist/{Inputs-j3JmcLWR.js → Inputs-DJSKiaWY.js} +1 -1
- package/dist/NumberFormatter-CLDS_LRZ.js +265 -0
- package/dist/{NumberRangeInput-C-8U05wF.js → NumberRangeInput-B8-LHfg3.js} +6 -5
- package/dist/{RadioGroup-B7_pNwn9.js → RadioGroup-DOw3PRoX.js} +1 -1
- package/dist/{RichTextEditor-D9-B1Cze.js → RichTextEditor-D4yN7Wj7.js} +2 -2
- package/dist/{Select-CkujlTjm.js → Select-UR0ec2Ux.js} +2 -2
- package/dist/{Slider-BHPl0OPy.js → Slider-CzEmKYBF.js} +1 -1
- package/dist/{Table-BDNSuEWc.js → Table-piX1SWvN.js} +1 -1
- package/dist/{TextArea-DqHDiRGJ.js → TextArea-D8WkKsGn.js} +3 -3
- package/dist/{TimePicker-DQ6JCkGB.js → TimePicker-C4taAOFQ.js} +10 -9
- package/dist/{ToggleGroup-DX0VYXwP.js → ToggleGroup-DOk27fgI.js} +5 -66
- package/dist/{Tooltip-B9DKcYvr.js → Tooltip-CpG1nz7Y.js} +2 -2
- package/dist/{TooltipWrapper-DznDgVJB.js → TooltipWrapper-3jyN0Wss.js} +1 -1
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-time-picker.js +1 -1
- package/dist/components/file-input.js +1 -1
- package/dist/components/file-upload-container.js +1 -1
- package/dist/components/file-upload.js +1 -1
- package/dist/components/form-field.js +1 -1
- package/dist/components/icon-button.js +1 -1
- package/dist/components/input.js +4 -4
- package/dist/components/number-field.js +7 -6
- package/dist/components/number-range-input.js +1 -1
- package/dist/components/pagination.js +32 -28
- package/dist/components/query-autocomplete.js +1 -1
- package/dist/components/query-select.js +2 -2
- package/dist/components/radio-group.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/text-area.js +1 -1
- package/dist/components/time-picker.js +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/tooltip-ellipsis.js +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/config/ui-configurator-theme.js +1 -1
- package/dist/config/ui-configurator.js +1081 -257
- package/dist/config/ui-router.js +1 -1
- package/dist/{datePickerValue.utils-CUzkWie8.js → datePickerValue.utils-DCgoSrP3.js} +5 -5
- package/dist/hooks/use-filters.js +1 -1
- package/dist/index.js +15 -15
- package/dist/numberStatic.utils-BX50PSee.js +421 -0
- package/dist/rhf/checkbox.js +1 -1
- package/dist/rhf/date-picker.js +1 -1
- package/dist/rhf/date-range-picker.js +1 -1
- package/dist/rhf/date-time-picker.js +1 -1
- package/dist/rhf/file-input.js +1 -1
- package/dist/rhf/file-upload.js +1 -1
- package/dist/rhf/number-range-input.js +1 -1
- package/dist/rhf/radio-group.js +1 -1
- package/dist/rhf/rich-text-editor.js +1 -1
- package/dist/rhf/select.js +1 -1
- package/dist/rhf/slider.js +1 -1
- package/dist/rhf/text-area.js +1 -1
- package/dist/rhf/time-picker.js +1 -1
- package/dist/rhf/toggle-group.js +1 -1
- package/dist/rhf.js +15 -15
- package/dist/rich-text-editor.js +1 -1
- package/dist/{router.context-B0jTMtE0.js → router.context-B4FvsTim.js} +2 -2
- package/dist/staticDateTimeSegments-DtU63_dw.js +1764 -0
- package/dist/{staticSelect.utils-BemUyaaA.js → staticSelect.utils-uHa8f_c6.js} +5 -144
- package/dist/styles/configurator.css +731 -218
- package/dist/{table.cva-BikE8qJH.js → table.cva-DlMT-zLD.js} +2 -3
- package/dist/tanstack/checkbox.js +1 -1
- package/dist/tanstack/date-picker.js +1 -1
- package/dist/tanstack/date-range-picker.js +1 -1
- package/dist/tanstack/date-time-picker.js +1 -1
- package/dist/tanstack/file-input.js +1 -1
- package/dist/tanstack/file-upload.js +1 -1
- package/dist/tanstack/form.js +1 -1
- package/dist/tanstack/inputs.js +1 -1
- package/dist/tanstack/number-range-input.js +1 -1
- package/dist/tanstack/radio-group.js +1 -1
- package/dist/tanstack/rich-text-editor.js +1 -1
- package/dist/tanstack/select.js +1 -1
- package/dist/tanstack/slider.js +1 -1
- package/dist/tanstack/table.js +2 -2
- package/dist/tanstack/text-area.js +1 -1
- package/dist/tanstack/time-picker.js +1 -1
- package/dist/tanstack/toggle-group.js +1 -1
- package/dist/tanstack.js +27 -27
- package/dist/theme-model-DtYPxNvH.js +406 -0
- package/dist/upload-CXU83BJ4.js +30 -0
- package/dist/useControlledState-CzXkZCX8.js +30 -0
- package/dist/{useFieldAccessibility-B4MVL6fz.js → useFieldAccessibility-ScC6Mtd5.js} +2 -2
- package/dist/{useFilters-kkEUFKmQ.js → useFilters-XNH27Md2.js} +1 -1
- package/dist/{useFormAutosave-Mg-tdwMh.js → useFormAutosave-DfuP7drj.js} +1 -1
- package/dist/{useStaticInputHandoff-CvSBPUB3.js → useStaticInputHandoff-NeZVnci-.js} +3 -3
- package/dist/{useTableColumnConfig-gfVame8v.js → useTableColumnConfig-BTGZiluz.js} +3 -3
- package/package.json +1 -1
- package/src/configurator/README.md +3 -3
- package/dist/FocusScope-CO9oJ1sc.js +0 -343
- package/dist/chain-DIXr2VAT.js +0 -10
- package/dist/focusSafely-DCGrr2bb.js +0 -447
- package/dist/getScrollParent-kSR7EtoT.js +0 -47
- package/dist/numberStatic.utils-BMgRzyd3.js +0 -902
- package/dist/openLink-CQhMhfzO.js +0 -121
- package/dist/platform-BXNIIAfU.js +0 -42
- package/dist/staticDateTimeSegments-CsCE9Buo.js +0 -3604
- package/dist/theme-model-C-QMCksE.js +0 -136
- package/dist/useControlledState-DQxX6LMN.js +0 -189
- package/dist/useFocusable-Bd0UsrQ7.js +0 -63
- package/dist/useFormValidationState-D3z-gafz.js +0 -1341
- package/dist/useLayoutEffect-B2-1tbPJ.js +0 -83
- package/dist/useSyncRef-RGMv0rXK.js +0 -338
package/dist/config/ui-router.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as UIRouter } from "../router.context-
|
|
1
|
+
import { t as UIRouter } from "../router.context-B4FvsTim.js";
|
|
2
2
|
export { UIRouter };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
|
|
2
2
|
import { t as ChevronUp } from "./chevron-up-D_Gqpb5M.js";
|
|
3
3
|
import { t as clsx } from "./clsx-CnD0nOiA.js";
|
|
4
|
-
import { r as $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7 } from "./useControlledState-DQxX6LMN.js";
|
|
5
|
-
import { _ as $d51706f903be7eab$export$1315d136e6f7581, u as getPlaceholder, y as $7541913c0284d84b$export$4c842f6a241dc825 } from "./staticDateTimeSegments-CsCE9Buo.js";
|
|
6
4
|
import { t as Typography } from "./Typography-LU4z2pR1.js";
|
|
7
5
|
import { InlineIconButton } from "./components/inline-icon-button.js";
|
|
8
6
|
import { t as useBreakpoint } from "./useBreakpoint-DQoMN-BG.js";
|
|
7
|
+
import { u as getPlaceholder } from "./staticDateTimeSegments-DtU63_dw.js";
|
|
9
8
|
import { useEffect, useRef } from "react";
|
|
10
9
|
import { c } from "react/compiler-runtime";
|
|
11
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
11
|
import { Time } from "@internationalized/date";
|
|
12
|
+
import { useDateSegment, useLocale, useTimeField } from "react-aria";
|
|
13
13
|
import { useTimeFieldState } from "@react-stately/datepicker";
|
|
14
14
|
//#region src/hooks/useLongPressRepeat.ts
|
|
15
15
|
const useLongPressRepeat = (t0) => {
|
|
@@ -76,7 +76,7 @@ const useLongPressRepeat = (t0) => {
|
|
|
76
76
|
const INCREMENT_STEP_SIZE = 5;
|
|
77
77
|
const TimePickerForm = ({ state, datePickerState }) => {
|
|
78
78
|
const isDesktop = useBreakpoint("md");
|
|
79
|
-
const { locale } =
|
|
79
|
+
const { locale } = useLocale();
|
|
80
80
|
const fieldState = useTimeFieldState({
|
|
81
81
|
locale,
|
|
82
82
|
defaultValue: datePickerState?.timeValue,
|
|
@@ -87,7 +87,7 @@ const TimePickerForm = ({ state, datePickerState }) => {
|
|
|
87
87
|
});
|
|
88
88
|
const ref = useRef(null);
|
|
89
89
|
const innerState = state ?? fieldState;
|
|
90
|
-
const { fieldProps } =
|
|
90
|
+
const { fieldProps } = useTimeField({ "aria-label": "Time Picker" }, innerState, ref);
|
|
91
91
|
const getAutoFocus = (index) => {
|
|
92
92
|
if (!isDesktop) return false;
|
|
93
93
|
return index === innerState.segments.findIndex(({ type }) => [
|
|
@@ -130,7 +130,7 @@ const TimePickerForm = ({ state, datePickerState }) => {
|
|
|
130
130
|
};
|
|
131
131
|
const TimeSegmentInput = ({ segment, state, autoFocus }) => {
|
|
132
132
|
const ref = useRef(null);
|
|
133
|
-
const { segmentProps } =
|
|
133
|
+
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
134
134
|
const isDesktop = useBreakpoint("md");
|
|
135
135
|
useEffect(() => {
|
|
136
136
|
if (autoFocus) ref.current?.focus();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as useFilters } from "../useFilters-
|
|
1
|
+
import { t as useFilters } from "../useFilters-XNH27Md2.js";
|
|
2
2
|
export { useFilters };
|
package/dist/index.js
CHANGED
|
@@ -2,22 +2,21 @@ import { t as logger } from "./logger-CqZjM-sn.js";
|
|
|
2
2
|
import { t as DropdownMenu } from "./DropdownMenu-5jmtgLXd.js";
|
|
3
3
|
import { n as MenuPopover, r as MenuItem } from "./DropdownMenuDesktop-Cl9gZVq0.js";
|
|
4
4
|
import { a as isEqual, i as useDeepCompareMemo, n as useDeepCompareEffect, o as ObjectUtils, r as useDeepCompareLayoutEffect, t as UIConfig } from "./uiConfig.context-BS3r_kTS.js";
|
|
5
|
-
import { i as CellText, n as useTableNav, r as HeaderText, t as Table } from "./Table-
|
|
6
|
-
import { a as checkboxDefinition, i as checkboxContentWrapperDefinition, o as checkboxGroupLabelDefinition, r as checkboxContentRowDefinition, s as checkboxIconDefinition } from "./CheckboxCheckmark-
|
|
5
|
+
import { i as CellText, n as useTableNav, r as HeaderText, t as Table } from "./Table-piX1SWvN.js";
|
|
6
|
+
import { a as checkboxDefinition, i as checkboxContentWrapperDefinition, o as checkboxGroupLabelDefinition, r as checkboxContentRowDefinition, s as checkboxIconDefinition } from "./CheckboxCheckmark-CpC3wlMs.js";
|
|
7
7
|
import { n as selectListBoxItemDefinition, r as selectInputTagsContentWrapperDefinition, t as selectPopoverDefinition } from "./selectDesktop.cva-CHAMxhfO.js";
|
|
8
8
|
import { t as X } from "./x-B6vfz8Ps.js";
|
|
9
9
|
import { t as UIOverrides } from "./uiOverrides.context-BTCH9y5a.js";
|
|
10
10
|
import { n as iconSlotDefinition, t as IconSlot } from "./IconSlot-DSK7qNxc.js";
|
|
11
|
-
import { t as Breadcrumbs } from "./Breadcrumbs-
|
|
12
|
-
import { a as getKeyInteractionAction, i as createKeyInteractionsHandler, o as useKeyInteractions, s as useDebounceCallback } from "./staticSelect.utils-
|
|
11
|
+
import { t as Breadcrumbs } from "./Breadcrumbs-FF8hMfXd.js";
|
|
12
|
+
import { a as getKeyInteractionAction, i as createKeyInteractionsHandler, o as useKeyInteractions, s as useDebounceCallback } from "./staticSelect.utils-uHa8f_c6.js";
|
|
13
13
|
import { t as Accordion } from "./Accordion-BzwO4_ml.js";
|
|
14
|
-
import { i as radioDefinition, n as radioContentRowDefinition, r as radioContentWrapperDefinition } from "./RadioGroup-
|
|
14
|
+
import { i as radioDefinition, n as radioContentRowDefinition, r as radioContentWrapperDefinition } from "./RadioGroup-DOw3PRoX.js";
|
|
15
15
|
import { n as switchDefinition } from "./Switch-CqnGEdeD.js";
|
|
16
|
-
import { n as textAreaWrapperDefinition } from "./TextArea-
|
|
17
|
-
import { t as Tooltip } from "./Tooltip-
|
|
16
|
+
import { n as textAreaWrapperDefinition } from "./TextArea-D8WkKsGn.js";
|
|
17
|
+
import { t as Tooltip } from "./Tooltip-CpG1nz7Y.js";
|
|
18
18
|
import { a as breadcrumbsDefinition, i as breadcrumbSegmentDefinition, n as breadcrumbIconDefinition, r as breadcrumbItemDefinition, t as breadcrumbChevronDefinition } from "./breadcrumbs.cva-7zzdDhVR.js";
|
|
19
19
|
import { i as menuPopoverWrapperDefinition, n as menuItemDefinition, r as menuPopoverDefinition, t as dropdownMenuDefinition } from "./dropdownMenu.cva-DvEmX0bs.js";
|
|
20
|
-
import { n as useScrollableListBox } from "./Calendar-CVSQH-rC.js";
|
|
21
20
|
import { i as tooltipTextDefinition, n as tooltipPointerHorizontalDefinition, r as tooltipPointerVerticalDefinition, t as tooltipDefinition } from "./tooltip.cva-BIzlOXHH.js";
|
|
22
21
|
import { t as typographyDefinition } from "./typography.cva-iD15k56p.js";
|
|
23
22
|
import { t as Typography } from "./Typography-LU4z2pR1.js";
|
|
@@ -36,7 +35,7 @@ import { SplitButton } from "./components/split-button.js";
|
|
|
36
35
|
import { TextButton } from "./components/text-button.js";
|
|
37
36
|
import { ToggleButton } from "./components/toggle-button.js";
|
|
38
37
|
import { n as formFieldErrorDefinition } from "./FormFieldError-DeOHHLo2.js";
|
|
39
|
-
import { a as formFieldHeaderDefinition, i as labelDefinition, n as formFieldHelperDefinition, t as FormField } from "./FormField-
|
|
38
|
+
import { a as formFieldHeaderDefinition, i as labelDefinition, n as formFieldHelperDefinition, t as FormField } from "./FormField-B99dLt8o.js";
|
|
40
39
|
import { n as tagDefinition, t as Tag } from "./Tag-DPg5sL1Z.js";
|
|
41
40
|
import { n as resources, t as ns } from "./i18n-CX2EjhJI.js";
|
|
42
41
|
import { a as inputSizeDefinition, i as inputSideDefinition, n as inputClearClassDefinition, r as inputContentWrapperDefinition, t as inputBaseDefinition } from "./input.cva-DJA8ovm_.js";
|
|
@@ -45,7 +44,8 @@ import { t as popoverDefinition } from "./popover.cva-Bhud1wnp.js";
|
|
|
45
44
|
import { Autocomplete } from "./rhf/autocomplete.js";
|
|
46
45
|
import { Checkbox } from "./rhf/checkbox.js";
|
|
47
46
|
import { CheckboxGroup } from "./rhf/checkbox-group.js";
|
|
48
|
-
import {
|
|
47
|
+
import { n as useScrollableListBox } from "./Calendar-BTjajO6i.js";
|
|
48
|
+
import { r as useLongPressRepeat } from "./datePickerValue.utils-DCgoSrP3.js";
|
|
49
49
|
import { t as IntlUtils } from "./intl.utils-zwAFoZ0U.js";
|
|
50
50
|
import { t as DateTimeUtils } from "./date-time.utils-0F9qduim.js";
|
|
51
51
|
import { t as DateUtils } from "./date.utils-B8_QF9y6.js";
|
|
@@ -57,7 +57,7 @@ import { t as FileUtils } from "./file.utils-DqQxnuAm.js";
|
|
|
57
57
|
import { a as progressTrackWrapperDefinition, i as progressTrackDefinition, n as progressDefinition, o as progressValueDefinition, r as progressFillDefinition, t as Progress } from "./Progress-B3mY9rIP.js";
|
|
58
58
|
import { t as fileUploadDropZoneDefinition } from "./fileUpload.cva-ujmStxB1.js";
|
|
59
59
|
import { FileUpload } from "./rhf/file-upload.js";
|
|
60
|
-
import { n as fileInputButtonDefinition, r as fileInputDropZoneDefinition } from "./FileInput-
|
|
60
|
+
import { n as fileInputButtonDefinition, r as fileInputDropZoneDefinition } from "./FileInput-Br5DQaGQ.js";
|
|
61
61
|
import { FileInput } from "./rhf/file-input.js";
|
|
62
62
|
import { NumberField } from "./rhf/number-field.js";
|
|
63
63
|
import { NumberRangeInput } from "./rhf/number-range-input.js";
|
|
@@ -93,20 +93,20 @@ import { a as toastDefinition, n as statusIconDefinition$1, r as statusSeparator
|
|
|
93
93
|
import { t as Toast } from "./Toast-DtG3pA61.js";
|
|
94
94
|
import { n as ToastProvider, t as ToastContainer } from "./ToastContainer-qgpzMFD4.js";
|
|
95
95
|
import { useToast } from "./components/use-toast.js";
|
|
96
|
-
import { a as tableHeaderTextDefinition, i as tableHeadRowDefinition, n as tableDataDefinition, o as tableRowDefinition, r as tableHeadDataDefinition, t as tableCellTextDefinition } from "./table.cva-
|
|
96
|
+
import { a as tableHeaderTextDefinition, i as tableHeadRowDefinition, n as tableDataDefinition, o as tableRowDefinition, r as tableHeadDataDefinition, t as tableCellTextDefinition } from "./table.cva-DlMT-zLD.js";
|
|
97
97
|
import { t as useTranslationMemo } from "./useTranslationMemo-CrZbeyBv.js";
|
|
98
|
-
import { a as PaginatedTable, i as dynamicColumns, n as useSorting, o as InfiniteTable, r as usePagination, s as ColumnConfigModal, t as useTableColumnConfig } from "./useTableColumnConfig-
|
|
98
|
+
import { a as PaginatedTable, i as dynamicColumns, n as useSorting, o as InfiniteTable, r as usePagination, s as ColumnConfigModal, t as useTableColumnConfig } from "./useTableColumnConfig-BTGZiluz.js";
|
|
99
99
|
import { t as linkDefinition } from "./link.cva-DMTHZiJG.js";
|
|
100
100
|
import { Link } from "./components/link.js";
|
|
101
101
|
import { Badge } from "./components/badge.js";
|
|
102
102
|
import { t as Confirmation } from "./confirmation.context-BuzgCfYl.js";
|
|
103
|
-
import { t as UIRouter } from "./router.context-
|
|
103
|
+
import { t as UIRouter } from "./router.context-B4FvsTim.js";
|
|
104
104
|
import { t as useLocalStorage } from "./useLocalStorage-PlcaJ1tP.js";
|
|
105
105
|
import { t as ThemeContext } from "./theme.context-B3wQDJ-i.js";
|
|
106
106
|
import { t as tooltipWrapperTriggerDefinition } from "./tooltipWrapper.cva-BBQ4ic3D.js";
|
|
107
107
|
import { n as useForm, r as useAutosave, t as useFormAutosave } from "./rhf-t348TCCL.js";
|
|
108
108
|
import { t as RoutingUtils } from "./routing.utils-UTQonIhB.js";
|
|
109
|
-
import { t as useFilters } from "./useFilters-
|
|
109
|
+
import { t as useFilters } from "./useFilters-XNH27Md2.js";
|
|
110
110
|
import { n as useStateAndRef, t as DomUtils } from "./dom.utils-D1AopHx9.js";
|
|
111
111
|
import { n as ArrayUtils, t as QueriesUtils } from "./queries.utils-CmbhAoHU.js";
|
|
112
112
|
//#region src/utils/serviceWorker.utils.ts
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { t as $3e6197669829fe11$export$40bfa8c7b0832715 } from "./useControlledState-CzXkZCX8.js";
|
|
2
|
+
import { i as $fd2148440a13ec26$export$fc1a364ae1f3ff10, t as $1dfb119a85e764e5$export$cc77c4ff7e8673c5 } from "./NumberFormatter-CLDS_LRZ.js";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
//#region ../../node_modules/.bun/react-stately@3.50.0+83d5fd7b249dbeef/node_modules/react-stately/dist/private/utils/number.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Takes a value and forces it to the closest min/max if it's outside. Also forces it to the closest
|
|
7
|
+
* valid step.
|
|
8
|
+
*/ function $240e9101ba2842f5$export$7d15b64cf5a3a4c4(value, min = -Infinity, max = Infinity) {
|
|
9
|
+
return Math.min(Math.max(value, min), max);
|
|
10
|
+
}
|
|
11
|
+
function $240e9101ba2842f5$export$e1a7b8e69ef6c52f(value, step) {
|
|
12
|
+
let roundedValue = value;
|
|
13
|
+
let precision = 0;
|
|
14
|
+
let stepString = step.toString();
|
|
15
|
+
let eIndex = stepString.toLowerCase().indexOf("e-");
|
|
16
|
+
if (eIndex > 0) precision = Math.abs(Math.floor(Math.log10(Math.abs(step)))) + eIndex;
|
|
17
|
+
else {
|
|
18
|
+
let pointIndex = stepString.indexOf(".");
|
|
19
|
+
if (pointIndex >= 0) precision = stepString.length - pointIndex;
|
|
20
|
+
}
|
|
21
|
+
if (precision > 0) {
|
|
22
|
+
let pow = Math.pow(10, precision);
|
|
23
|
+
roundedValue = Math.round(roundedValue * pow) / pow;
|
|
24
|
+
}
|
|
25
|
+
return roundedValue;
|
|
26
|
+
}
|
|
27
|
+
function $240e9101ba2842f5$export$cb6e0bb50bc19463(value, min, max, step) {
|
|
28
|
+
min = Number(min);
|
|
29
|
+
max = Number(max);
|
|
30
|
+
let remainder = (value - (isNaN(min) ? 0 : min)) % step;
|
|
31
|
+
let snappedValue = $240e9101ba2842f5$export$e1a7b8e69ef6c52f(Math.abs(remainder) * 2 >= step ? value + Math.sign(remainder) * (step - Math.abs(remainder)) : value - remainder, step);
|
|
32
|
+
if (!isNaN(min)) {
|
|
33
|
+
if (snappedValue < min) snappedValue = min;
|
|
34
|
+
else if (!isNaN(max) && snappedValue > max) snappedValue = min + Math.floor($240e9101ba2842f5$export$e1a7b8e69ef6c52f((max - min) / step, step)) * step;
|
|
35
|
+
} else if (!isNaN(max) && snappedValue > max) snappedValue = Math.floor($240e9101ba2842f5$export$e1a7b8e69ef6c52f(max / step, step)) * step;
|
|
36
|
+
snappedValue = $240e9101ba2842f5$export$e1a7b8e69ef6c52f(snappedValue, step);
|
|
37
|
+
return snappedValue;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region ../../node_modules/.bun/@internationalized+number@3.6.8/node_modules/@internationalized/number/dist/private/NumberParser.mjs
|
|
41
|
+
const $eb76cf4feb040f77$var$CURRENCY_SIGN_REGEX = /* @__PURE__ */ new RegExp("^.*\\(.*\\).*$");
|
|
42
|
+
const $eb76cf4feb040f77$var$NUMBERING_SYSTEMS = [
|
|
43
|
+
"latn",
|
|
44
|
+
"arab",
|
|
45
|
+
"hanidec",
|
|
46
|
+
"deva",
|
|
47
|
+
"beng",
|
|
48
|
+
"fullwide"
|
|
49
|
+
];
|
|
50
|
+
var $eb76cf4feb040f77$export$cd11ab140839f11d = class {
|
|
51
|
+
constructor(locale, options = {}) {
|
|
52
|
+
this.locale = locale;
|
|
53
|
+
this.options = options;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parses the given string to a number. Returns NaN if a valid number could not be parsed.
|
|
57
|
+
*/ parse(value) {
|
|
58
|
+
return $eb76cf4feb040f77$var$getNumberParserImpl(this.locale, this.options, value).parse(value);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Returns whether the given string could potentially be a valid number. This should be used to
|
|
62
|
+
* validate user input as the user types. If a `minValue` or `maxValue` is provided, the validity
|
|
63
|
+
* of the minus/plus sign characters can be checked.
|
|
64
|
+
*/ isValidPartialNumber(value, minValue, maxValue) {
|
|
65
|
+
return $eb76cf4feb040f77$var$getNumberParserImpl(this.locale, this.options, value).isValidPartialNumber(value, minValue, maxValue);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns a numbering system for which the given string is valid in the current locale.
|
|
69
|
+
* If no numbering system could be detected, the default numbering system for the current
|
|
70
|
+
* locale is returned.
|
|
71
|
+
*/ getNumberingSystem(value) {
|
|
72
|
+
return $eb76cf4feb040f77$var$getNumberParserImpl(this.locale, this.options, value).options.numberingSystem;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const $eb76cf4feb040f77$var$numberParserCache = /* @__PURE__ */ new Map();
|
|
76
|
+
function $eb76cf4feb040f77$var$getNumberParserImpl(locale, options, value) {
|
|
77
|
+
let defaultParser = $eb76cf4feb040f77$var$getCachedNumberParser(locale, options);
|
|
78
|
+
if (!locale.includes("-nu-") && !defaultParser.isValidPartialNumber(value)) {
|
|
79
|
+
for (let numberingSystem of $eb76cf4feb040f77$var$NUMBERING_SYSTEMS) if (numberingSystem !== defaultParser.options.numberingSystem) {
|
|
80
|
+
let parser = $eb76cf4feb040f77$var$getCachedNumberParser(locale + (locale.includes("-u-") ? "-nu-" : "-u-nu-") + numberingSystem, options);
|
|
81
|
+
if (parser.isValidPartialNumber(value)) return parser;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return defaultParser;
|
|
85
|
+
}
|
|
86
|
+
function $eb76cf4feb040f77$var$getCachedNumberParser(locale, options) {
|
|
87
|
+
let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
|
|
88
|
+
let parser = $eb76cf4feb040f77$var$numberParserCache.get(cacheKey);
|
|
89
|
+
if (!parser) {
|
|
90
|
+
parser = new $eb76cf4feb040f77$var$NumberParserImpl(locale, options);
|
|
91
|
+
$eb76cf4feb040f77$var$numberParserCache.set(cacheKey, parser);
|
|
92
|
+
}
|
|
93
|
+
return parser;
|
|
94
|
+
}
|
|
95
|
+
var $eb76cf4feb040f77$var$NumberParserImpl = class {
|
|
96
|
+
constructor(locale, options = {}) {
|
|
97
|
+
this.locale = locale;
|
|
98
|
+
if (options.roundingIncrement !== 1 && options.roundingIncrement != null) {
|
|
99
|
+
if (options.maximumFractionDigits == null && options.minimumFractionDigits == null) {
|
|
100
|
+
options.maximumFractionDigits = 0;
|
|
101
|
+
options.minimumFractionDigits = 0;
|
|
102
|
+
} else if (options.maximumFractionDigits == null) options.maximumFractionDigits = options.minimumFractionDigits;
|
|
103
|
+
else if (options.minimumFractionDigits == null) options.minimumFractionDigits = options.maximumFractionDigits;
|
|
104
|
+
}
|
|
105
|
+
this.formatter = new Intl.NumberFormat(locale, options);
|
|
106
|
+
this.options = this.formatter.resolvedOptions();
|
|
107
|
+
this.symbols = $eb76cf4feb040f77$var$getSymbols(locale, this.formatter, this.options, options);
|
|
108
|
+
if (this.options.style === "percent" && ((this.options.minimumFractionDigits ?? 0) > 18 || (this.options.maximumFractionDigits ?? 0) > 18)) console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.");
|
|
109
|
+
}
|
|
110
|
+
parse(value) {
|
|
111
|
+
let isGroupSymbolAllowed = this.formatter.resolvedOptions().useGrouping;
|
|
112
|
+
let fullySanitizedValue = this.sanitize(value);
|
|
113
|
+
if (!isGroupSymbolAllowed && this.symbols.group && fullySanitizedValue.includes(this.symbols.group)) return NaN;
|
|
114
|
+
else if (this.symbols.group) fullySanitizedValue = fullySanitizedValue.replaceAll(this.symbols.group, "");
|
|
115
|
+
if (this.symbols.decimal) fullySanitizedValue = fullySanitizedValue.replace(this.symbols.decimal, ".");
|
|
116
|
+
if (this.symbols.minusSign) fullySanitizedValue = fullySanitizedValue.replace(this.symbols.minusSign, "-");
|
|
117
|
+
fullySanitizedValue = fullySanitizedValue.replace(this.symbols.numeral, this.symbols.index);
|
|
118
|
+
if (this.options.style === "percent") {
|
|
119
|
+
let isNegative = fullySanitizedValue.indexOf("-");
|
|
120
|
+
fullySanitizedValue = fullySanitizedValue.replace("-", "");
|
|
121
|
+
fullySanitizedValue = fullySanitizedValue.replace("+", "");
|
|
122
|
+
let index = fullySanitizedValue.indexOf(".");
|
|
123
|
+
if (index === -1) index = fullySanitizedValue.length;
|
|
124
|
+
fullySanitizedValue = fullySanitizedValue.replace(".", "");
|
|
125
|
+
if (index - 2 === 0) fullySanitizedValue = `0.${fullySanitizedValue}`;
|
|
126
|
+
else if (index - 2 === -1) fullySanitizedValue = `0.0${fullySanitizedValue}`;
|
|
127
|
+
else if (index - 2 === -2) fullySanitizedValue = "0.00";
|
|
128
|
+
else fullySanitizedValue = `${fullySanitizedValue.slice(0, index - 2)}.${fullySanitizedValue.slice(index - 2)}`;
|
|
129
|
+
if (isNegative > -1) fullySanitizedValue = `-${fullySanitizedValue}`;
|
|
130
|
+
}
|
|
131
|
+
let newValue = fullySanitizedValue ? +fullySanitizedValue : NaN;
|
|
132
|
+
if (isNaN(newValue)) return NaN;
|
|
133
|
+
if (this.options.style === "percent") {
|
|
134
|
+
let options = {
|
|
135
|
+
...this.options,
|
|
136
|
+
style: "decimal",
|
|
137
|
+
minimumFractionDigits: Math.min((this.options.minimumFractionDigits ?? 0) + 2, 20),
|
|
138
|
+
maximumFractionDigits: Math.min((this.options.maximumFractionDigits ?? 0) + 2, 20)
|
|
139
|
+
};
|
|
140
|
+
return new $eb76cf4feb040f77$export$cd11ab140839f11d(this.locale, options).parse(new $1dfb119a85e764e5$export$cc77c4ff7e8673c5(this.locale, options).format(newValue));
|
|
141
|
+
}
|
|
142
|
+
if (this.options.currencySign === "accounting" && $eb76cf4feb040f77$var$CURRENCY_SIGN_REGEX.test(value)) newValue = -1 * newValue;
|
|
143
|
+
return newValue;
|
|
144
|
+
}
|
|
145
|
+
sanitize(value) {
|
|
146
|
+
let isGroupSymbolAllowed = this.formatter.resolvedOptions().useGrouping;
|
|
147
|
+
if (this.symbols.noNumeralUnits.length > 0 && this.symbols.noNumeralUnits.find((obj) => obj.unit === value)) return this.symbols.noNumeralUnits.find((obj) => obj.unit === value).value.toString();
|
|
148
|
+
value = value.replace(this.symbols.literals, "");
|
|
149
|
+
if (this.symbols.minusSign) value = value.replace("-", this.symbols.minusSign);
|
|
150
|
+
if (this.options.numberingSystem === "arab") {
|
|
151
|
+
if (this.symbols.decimal) {
|
|
152
|
+
value = $eb76cf4feb040f77$var$replaceAll(value, ",", this.symbols.decimal);
|
|
153
|
+
value = $eb76cf4feb040f77$var$replaceAll(value, String.fromCharCode(1548), this.symbols.decimal);
|
|
154
|
+
}
|
|
155
|
+
if (this.symbols.group && isGroupSymbolAllowed) value = $eb76cf4feb040f77$var$replaceAll(value, ".", this.symbols.group);
|
|
156
|
+
}
|
|
157
|
+
if (this.symbols.group === "’" && value.includes("'") && isGroupSymbolAllowed) value = $eb76cf4feb040f77$var$replaceAll(value, "'", this.symbols.group);
|
|
158
|
+
if (this.symbols.group === "'" && value.includes("’") && isGroupSymbolAllowed) value = $eb76cf4feb040f77$var$replaceAll(value, "’", this.symbols.group);
|
|
159
|
+
if (this.options.locale === "fr-FR" && this.symbols.group && isGroupSymbolAllowed) {
|
|
160
|
+
value = $eb76cf4feb040f77$var$replaceAll(value, " ", this.symbols.group);
|
|
161
|
+
value = $eb76cf4feb040f77$var$replaceAll(value, /\u00A0/g, this.symbols.group);
|
|
162
|
+
}
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
isValidPartialNumber(value, minValue = -Infinity, maxValue = Infinity) {
|
|
166
|
+
let isGroupSymbolAllowed = this.formatter.resolvedOptions().useGrouping;
|
|
167
|
+
value = this.sanitize(value);
|
|
168
|
+
if (this.symbols.minusSign && value.startsWith(this.symbols.minusSign) && minValue < 0) value = value.slice(this.symbols.minusSign.length);
|
|
169
|
+
else if (this.symbols.plusSign && value.startsWith(this.symbols.plusSign) && maxValue > 0) value = value.slice(this.symbols.plusSign.length);
|
|
170
|
+
if (this.symbols.decimal && value.indexOf(this.symbols.decimal) > -1 && this.options.maximumFractionDigits === 0) return false;
|
|
171
|
+
if (this.symbols.group && isGroupSymbolAllowed) value = $eb76cf4feb040f77$var$replaceAll(value, this.symbols.group, "");
|
|
172
|
+
value = value.replace(this.symbols.numeral, "");
|
|
173
|
+
if (this.symbols.decimal) value = value.replace(this.symbols.decimal, "");
|
|
174
|
+
return value.length === 0;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const $eb76cf4feb040f77$var$nonLiteralParts = /* @__PURE__ */ new Set([
|
|
178
|
+
"decimal",
|
|
179
|
+
"fraction",
|
|
180
|
+
"integer",
|
|
181
|
+
"minusSign",
|
|
182
|
+
"plusSign",
|
|
183
|
+
"group"
|
|
184
|
+
]);
|
|
185
|
+
const $eb76cf4feb040f77$var$pluralNumbers = [
|
|
186
|
+
0,
|
|
187
|
+
4,
|
|
188
|
+
2,
|
|
189
|
+
1,
|
|
190
|
+
11,
|
|
191
|
+
20,
|
|
192
|
+
3,
|
|
193
|
+
7,
|
|
194
|
+
100,
|
|
195
|
+
21,
|
|
196
|
+
.1,
|
|
197
|
+
1.1
|
|
198
|
+
];
|
|
199
|
+
function $eb76cf4feb040f77$var$getSymbols(locale, formatter, intlOptions, originalOptions) {
|
|
200
|
+
let symbolFormatter = new Intl.NumberFormat(locale, {
|
|
201
|
+
...intlOptions,
|
|
202
|
+
minimumSignificantDigits: 1,
|
|
203
|
+
maximumSignificantDigits: 21,
|
|
204
|
+
roundingIncrement: 1,
|
|
205
|
+
roundingPriority: "auto",
|
|
206
|
+
roundingMode: "halfExpand",
|
|
207
|
+
useGrouping: true
|
|
208
|
+
});
|
|
209
|
+
let allParts = symbolFormatter.formatToParts(-10000.111);
|
|
210
|
+
let posAllParts = symbolFormatter.formatToParts(10000.111);
|
|
211
|
+
let pluralParts = $eb76cf4feb040f77$var$pluralNumbers.map((n) => symbolFormatter.formatToParts(n));
|
|
212
|
+
let noNumeralUnits = pluralParts.map((p, i) => {
|
|
213
|
+
let unit = p.find((p) => p.type === "unit");
|
|
214
|
+
if (unit && !p.some((p) => p.type === "integer" || p.type === "fraction")) return {
|
|
215
|
+
unit: unit.value,
|
|
216
|
+
value: $eb76cf4feb040f77$var$pluralNumbers[i]
|
|
217
|
+
};
|
|
218
|
+
return null;
|
|
219
|
+
}).filter((p) => !!p);
|
|
220
|
+
let minusSign = allParts.find((p) => p.type === "minusSign")?.value ?? "-";
|
|
221
|
+
let plusSign = posAllParts.find((p) => p.type === "plusSign")?.value;
|
|
222
|
+
if (!plusSign && (originalOptions?.signDisplay === "exceptZero" || originalOptions?.signDisplay === "always")) plusSign = "+";
|
|
223
|
+
let decimal = new Intl.NumberFormat(locale, {
|
|
224
|
+
...intlOptions,
|
|
225
|
+
minimumFractionDigits: 2,
|
|
226
|
+
maximumFractionDigits: 2
|
|
227
|
+
}).formatToParts(.001).find((p) => p.type === "decimal")?.value;
|
|
228
|
+
let group = allParts.find((p) => p.type === "group")?.value;
|
|
229
|
+
let allPartsLiterals = allParts.filter((p) => !$eb76cf4feb040f77$var$nonLiteralParts.has(p.type)).map((p) => $eb76cf4feb040f77$var$escapeRegex(p.value));
|
|
230
|
+
let pluralPartsLiterals = pluralParts.flatMap((p) => p.filter((p) => !$eb76cf4feb040f77$var$nonLiteralParts.has(p.type)).map((p) => $eb76cf4feb040f77$var$escapeRegex(p.value)));
|
|
231
|
+
let sortedLiterals = [.../* @__PURE__ */ new Set([...allPartsLiterals, ...pluralPartsLiterals])].sort((a, b) => b.length - a.length);
|
|
232
|
+
let literals = sortedLiterals.length === 0 ? /* @__PURE__ */ new RegExp("\\p{White_Space}|\\p{Cf}", "gu") : new RegExp(`${sortedLiterals.join("|")}|\\p{White_Space}|\\p{Cf}`, "gu");
|
|
233
|
+
let numerals = [...new Intl.NumberFormat(intlOptions.locale, { useGrouping: false }).format(9876543210)].reverse();
|
|
234
|
+
let indexes = new Map(numerals.map((d, i) => [d, i]));
|
|
235
|
+
let numeral = new RegExp(`[${numerals.join("")}]`, "g");
|
|
236
|
+
let index = (d) => String(indexes.get(d));
|
|
237
|
+
return {
|
|
238
|
+
minusSign,
|
|
239
|
+
plusSign,
|
|
240
|
+
decimal,
|
|
241
|
+
group,
|
|
242
|
+
literals,
|
|
243
|
+
numeral,
|
|
244
|
+
numerals,
|
|
245
|
+
index,
|
|
246
|
+
noNumeralUnits
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function $eb76cf4feb040f77$var$replaceAll(str, find, replace) {
|
|
250
|
+
if (str.replaceAll) return str.replaceAll(find, replace);
|
|
251
|
+
return str.split(find).join(replace);
|
|
252
|
+
}
|
|
253
|
+
function $eb76cf4feb040f77$var$escapeRegex(string) {
|
|
254
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region ../../node_modules/.bun/react-stately@3.50.0+83d5fd7b249dbeef/node_modules/react-stately/dist/private/numberfield/useNumberFieldState.mjs
|
|
258
|
+
function $3d0ee518c6f3d04f$export$7f629e9dc1ecf37c(props) {
|
|
259
|
+
let { minValue, maxValue, step, formatOptions, value, defaultValue = NaN, onChange, locale, isDisabled, isReadOnly, commitBehavior = "snap" } = props;
|
|
260
|
+
if (value === null) value = NaN;
|
|
261
|
+
let snapValue = useCallback((value) => {
|
|
262
|
+
return step === void 0 || isNaN(step) ? $240e9101ba2842f5$export$7d15b64cf5a3a4c4(value, minValue, maxValue) : $240e9101ba2842f5$export$cb6e0bb50bc19463(value, minValue, maxValue, step);
|
|
263
|
+
}, [
|
|
264
|
+
step,
|
|
265
|
+
minValue,
|
|
266
|
+
maxValue
|
|
267
|
+
]);
|
|
268
|
+
if (value !== void 0 && !isNaN(value) && commitBehavior === "snap") value = snapValue(value);
|
|
269
|
+
if (!isNaN(defaultValue) && commitBehavior === "snap") defaultValue = snapValue(defaultValue);
|
|
270
|
+
let [numberValue, setNumberValue] = $3e6197669829fe11$export$40bfa8c7b0832715(value, isNaN(defaultValue) ? NaN : defaultValue, onChange);
|
|
271
|
+
let [initialValue] = useState(numberValue);
|
|
272
|
+
let [inputValue, setInputValue] = useState(() => isNaN(numberValue) ? "" : new $1dfb119a85e764e5$export$cc77c4ff7e8673c5(locale, formatOptions).format(numberValue));
|
|
273
|
+
let numberParser = useMemo(() => new $eb76cf4feb040f77$export$cd11ab140839f11d(locale, formatOptions), [locale, formatOptions]);
|
|
274
|
+
let numberingSystem = useMemo(() => numberParser.getNumberingSystem(inputValue), [numberParser, inputValue]);
|
|
275
|
+
let formatter = useMemo(() => new $1dfb119a85e764e5$export$cc77c4ff7e8673c5(locale, {
|
|
276
|
+
...formatOptions,
|
|
277
|
+
numberingSystem
|
|
278
|
+
}), [
|
|
279
|
+
locale,
|
|
280
|
+
formatOptions,
|
|
281
|
+
numberingSystem
|
|
282
|
+
]);
|
|
283
|
+
let intlOptions = useMemo(() => formatter.resolvedOptions(), [formatter]);
|
|
284
|
+
let format = useCallback((value) => isNaN(value) || value === null ? "" : formatter.format(value), [formatter]);
|
|
285
|
+
let validation = $fd2148440a13ec26$export$fc1a364ae1f3ff10({
|
|
286
|
+
...props,
|
|
287
|
+
value: numberValue
|
|
288
|
+
});
|
|
289
|
+
let clampStep = step !== void 0 && !isNaN(step) ? step : 1;
|
|
290
|
+
if (intlOptions.style === "percent" && (step === void 0 || isNaN(step))) clampStep = .01;
|
|
291
|
+
let [prevValue, setPrevValue] = useState(numberValue);
|
|
292
|
+
let [prevLocale, setPrevLocale] = useState(locale);
|
|
293
|
+
let [prevFormatOptions, setPrevFormatOptions] = useState(formatOptions);
|
|
294
|
+
if (!Object.is(numberValue, prevValue) || locale !== prevLocale || !$3d0ee518c6f3d04f$var$isEqualFormatOptions(formatOptions, prevFormatOptions)) {
|
|
295
|
+
setInputValue(format(numberValue));
|
|
296
|
+
setPrevValue(numberValue);
|
|
297
|
+
setPrevLocale(locale);
|
|
298
|
+
setPrevFormatOptions(formatOptions);
|
|
299
|
+
}
|
|
300
|
+
let parsedValue = useMemo(() => numberParser.parse(inputValue), [numberParser, inputValue]);
|
|
301
|
+
let commit = (overrideValue) => {
|
|
302
|
+
let newInputValue = overrideValue === void 0 ? inputValue : overrideValue;
|
|
303
|
+
let newParsedValue = parsedValue;
|
|
304
|
+
if (overrideValue !== void 0) newParsedValue = numberParser.parse(newInputValue);
|
|
305
|
+
if (!newInputValue.length) {
|
|
306
|
+
setNumberValue(NaN);
|
|
307
|
+
setInputValue(value === void 0 ? "" : format(numberValue));
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
if (isNaN(newParsedValue)) {
|
|
311
|
+
setInputValue(format(numberValue));
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
let clampedValue = commitBehavior === "snap" ? snapValue(newParsedValue) : newParsedValue;
|
|
315
|
+
clampedValue = numberParser.parse(format(clampedValue));
|
|
316
|
+
let shouldValidate = clampedValue !== numberValue;
|
|
317
|
+
setNumberValue(clampedValue);
|
|
318
|
+
setInputValue(format(value === void 0 ? clampedValue : numberValue));
|
|
319
|
+
if (shouldValidate) validation.commitValidation();
|
|
320
|
+
};
|
|
321
|
+
let safeNextStep = (operation, minMax = 0) => {
|
|
322
|
+
let prev = parsedValue;
|
|
323
|
+
if (isNaN(prev)) return $240e9101ba2842f5$export$cb6e0bb50bc19463(isNaN(minMax) ? 0 : minMax, minValue, maxValue, clampStep);
|
|
324
|
+
else {
|
|
325
|
+
let newValue = $240e9101ba2842f5$export$cb6e0bb50bc19463(prev, minValue, maxValue, clampStep);
|
|
326
|
+
if (operation === "+" && newValue > prev || operation === "-" && newValue < prev) return newValue;
|
|
327
|
+
return $240e9101ba2842f5$export$cb6e0bb50bc19463($3d0ee518c6f3d04f$var$handleDecimalOperation(operation, prev, clampStep), minValue, maxValue, clampStep);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
let increment = () => {
|
|
331
|
+
let newValue = safeNextStep("+", minValue);
|
|
332
|
+
if (newValue === numberValue) setInputValue(format(newValue));
|
|
333
|
+
setNumberValue(newValue);
|
|
334
|
+
validation.commitValidation();
|
|
335
|
+
};
|
|
336
|
+
let decrement = () => {
|
|
337
|
+
let newValue = safeNextStep("-", maxValue);
|
|
338
|
+
if (newValue === numberValue) setInputValue(format(newValue));
|
|
339
|
+
setNumberValue(newValue);
|
|
340
|
+
validation.commitValidation();
|
|
341
|
+
};
|
|
342
|
+
let incrementToMax = () => {
|
|
343
|
+
if (maxValue != null) {
|
|
344
|
+
setNumberValue($240e9101ba2842f5$export$cb6e0bb50bc19463(maxValue, minValue, maxValue, clampStep));
|
|
345
|
+
validation.commitValidation();
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
let decrementToMin = () => {
|
|
349
|
+
if (minValue != null) {
|
|
350
|
+
setNumberValue(minValue);
|
|
351
|
+
validation.commitValidation();
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
let canIncrement = useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || maxValue === void 0 || isNaN(maxValue) || $240e9101ba2842f5$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) > parsedValue || $3d0ee518c6f3d04f$var$handleDecimalOperation("+", parsedValue, clampStep) <= maxValue), [
|
|
355
|
+
isDisabled,
|
|
356
|
+
isReadOnly,
|
|
357
|
+
minValue,
|
|
358
|
+
maxValue,
|
|
359
|
+
clampStep,
|
|
360
|
+
parsedValue
|
|
361
|
+
]);
|
|
362
|
+
let canDecrement = useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || minValue === void 0 || isNaN(minValue) || $240e9101ba2842f5$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) < parsedValue || $3d0ee518c6f3d04f$var$handleDecimalOperation("-", parsedValue, clampStep) >= minValue), [
|
|
363
|
+
isDisabled,
|
|
364
|
+
isReadOnly,
|
|
365
|
+
minValue,
|
|
366
|
+
maxValue,
|
|
367
|
+
clampStep,
|
|
368
|
+
parsedValue
|
|
369
|
+
]);
|
|
370
|
+
let validate = (value) => numberParser.isValidPartialNumber(value, minValue, maxValue);
|
|
371
|
+
return {
|
|
372
|
+
...validation,
|
|
373
|
+
validate,
|
|
374
|
+
increment,
|
|
375
|
+
incrementToMax,
|
|
376
|
+
decrement,
|
|
377
|
+
decrementToMin,
|
|
378
|
+
canIncrement,
|
|
379
|
+
canDecrement,
|
|
380
|
+
minValue,
|
|
381
|
+
maxValue,
|
|
382
|
+
numberValue: parsedValue,
|
|
383
|
+
defaultNumberValue: isNaN(defaultValue) ? initialValue : defaultValue,
|
|
384
|
+
setNumberValue,
|
|
385
|
+
setInputValue,
|
|
386
|
+
inputValue,
|
|
387
|
+
commit
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
function $3d0ee518c6f3d04f$var$isEqualFormatOptions(a, b) {
|
|
391
|
+
if (a === b) return true;
|
|
392
|
+
if (!a || !b) return false;
|
|
393
|
+
let aKeys = Object.keys(a);
|
|
394
|
+
let bKeys = Object.keys(b);
|
|
395
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
396
|
+
for (let key of aKeys) if (b[key] !== a[key]) return false;
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
function $3d0ee518c6f3d04f$var$handleDecimalOperation(operator, value1, value2) {
|
|
400
|
+
let result = operator === "+" ? value1 + value2 : value1 - value2;
|
|
401
|
+
if (value1 % 1 !== 0 || value2 % 1 !== 0) {
|
|
402
|
+
const value1Decimal = value1.toString().split(".");
|
|
403
|
+
const value2Decimal = value2.toString().split(".");
|
|
404
|
+
const value1DecimalLength = value1Decimal[1] && value1Decimal[1].length || 0;
|
|
405
|
+
const value2DecimalLength = value2Decimal[1] && value2Decimal[1].length || 0;
|
|
406
|
+
const multiplier = Math.pow(10, Math.max(value1DecimalLength, value2DecimalLength));
|
|
407
|
+
value1 = Math.round(value1 * multiplier);
|
|
408
|
+
value2 = Math.round(value2 * multiplier);
|
|
409
|
+
result = operator === "+" ? value1 + value2 : value1 - value2;
|
|
410
|
+
result /= multiplier;
|
|
411
|
+
}
|
|
412
|
+
return result;
|
|
413
|
+
}
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/components/inputs/Input/shared/numberStatic.utils.ts
|
|
416
|
+
const getStaticNumberDisplayValue = (value, formatter) => {
|
|
417
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
418
|
+
return formatter.format(value);
|
|
419
|
+
};
|
|
420
|
+
//#endregion
|
|
421
|
+
export { $3d0ee518c6f3d04f$export$7f629e9dc1ecf37c as n, getStaticNumberDisplayValue as t };
|
package/dist/rhf/checkbox.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Checkbox$1 } from "../Checkbox-
|
|
1
|
+
import { t as Checkbox$1 } from "../Checkbox-CV1ILXXO.js";
|
|
2
2
|
import { n as runtime, r as useFireBlurOnChange, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
3
3
|
//#region src/entries/rhf/checkbox.ts
|
|
4
4
|
const Checkbox = (props) => {
|
package/dist/rhf/date-picker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as runtime, r as useFireBlurOnChange, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
2
|
-
import { t as DatePicker$1 } from "../DatePicker-
|
|
2
|
+
import { t as DatePicker$1 } from "../DatePicker-DOLL7mkc.js";
|
|
3
3
|
import { t as toCalendarDate } from "../date.transforms-DLg-eFcE.js";
|
|
4
4
|
//#region src/entries/rhf/date-picker.ts
|
|
5
5
|
const DatePicker = (props) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as DateRangePicker$1 } from "../DateRangePicker-_uTQk_ae.js";
|
|
2
1
|
import { n as runtime, r as useFireBlurOnChange, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
2
|
+
import { t as DateRangePicker$1 } from "../DateRangePicker-BF-1CztH.js";
|
|
3
3
|
import { n as toCalendarDateRange } from "../date.transforms-DLg-eFcE.js";
|
|
4
4
|
//#region src/entries/rhf/date-range-picker.ts
|
|
5
5
|
const DateRangePicker = (props) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as runtime, r as useFireBlurOnChange, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
2
2
|
import { r as toCalendarDateTime } from "../date.transforms-DLg-eFcE.js";
|
|
3
|
-
import { t as DateTimePicker$1 } from "../DateTimePicker-
|
|
3
|
+
import { t as DateTimePicker$1 } from "../DateTimePicker-Cj0qvJUz.js";
|
|
4
4
|
//#region src/entries/rhf/date-time-picker.ts
|
|
5
5
|
const DateTimePicker = (props) => {
|
|
6
6
|
return renderRHFField(runtime(DateTimePicker$1), useFireBlurOnChange(props, "dateInput"), "value", toCalendarDateTime);
|
package/dist/rhf/file-input.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as runtime, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
2
|
-
import { t as FileInput$1 } from "../FileInput-
|
|
2
|
+
import { t as FileInput$1 } from "../FileInput-Br5DQaGQ.js";
|
|
3
3
|
//#region src/entries/rhf/file-input.ts
|
|
4
4
|
const FileInput = (props) => renderRHFField(runtime(FileInput$1), props);
|
|
5
5
|
//#endregion
|
package/dist/rhf/file-upload.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as FileUpload$1 } from "../FileUpload
|
|
1
|
+
import { t as FileUpload$1 } from "../FileUpload--7ub3EZO.js";
|
|
2
2
|
import { n as runtime, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
3
3
|
//#region src/entries/rhf/file-upload.ts
|
|
4
4
|
const FileUpload = (props) => renderRHFField(runtime(FileUpload$1), props);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as runtime, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
2
|
-
import { t as NumberRangeInput$1 } from "../NumberRangeInput-
|
|
2
|
+
import { t as NumberRangeInput$1 } from "../NumberRangeInput-B8-LHfg3.js";
|
|
3
3
|
//#region src/entries/rhf/number-range-input.ts
|
|
4
4
|
const NumberRangeInput = (props) => renderRHFField(runtime(NumberRangeInput$1), props);
|
|
5
5
|
//#endregion
|
package/dist/rhf/radio-group.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RadioGroup$1 } from "../RadioGroup-
|
|
1
|
+
import { t as RadioGroup$1 } from "../RadioGroup-DOw3PRoX.js";
|
|
2
2
|
import { n as runtime, r as useFireBlurOnChange, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
3
3
|
//#region src/entries/rhf/radio-group.ts
|
|
4
4
|
const RadioGroup = (props) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RichTextEditor$1 } from "../RichTextEditor-
|
|
1
|
+
import { t as RichTextEditor$1 } from "../RichTextEditor-D4yN7Wj7.js";
|
|
2
2
|
import { n as runtime, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
3
3
|
//#region src/entries/rhf/rich-text-editor.ts
|
|
4
4
|
const RichTextEditor = (props) => renderRHFField(runtime(RichTextEditor$1), props);
|
package/dist/rhf/select.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as runtime, r as useFireBlurOnChange, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
2
|
-
import { t as Select$1 } from "../Select-
|
|
2
|
+
import { t as Select$1 } from "../Select-UR0ec2Ux.js";
|
|
3
3
|
//#region src/entries/rhf/select.ts
|
|
4
4
|
const Select = (props) => {
|
|
5
5
|
return renderRHFField(runtime(Select$1), useFireBlurOnChange(props, "select"));
|
package/dist/rhf/slider.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Slider$1 } from "../Slider-
|
|
1
|
+
import { t as Slider$1 } from "../Slider-CzEmKYBF.js";
|
|
2
2
|
import { n as runtime, t as renderRHFField } from "../fieldAdapter-DjYls12j.js";
|
|
3
3
|
//#region src/entries/rhf/slider.ts
|
|
4
4
|
const Slider = (props) => renderRHFField(runtime(Slider$1), props);
|