@povio/ui 2.3.0-rc.3 → 2.3.0-rc.33
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 +97 -38
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- 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 +188 -34
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +268 -87
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +348 -182
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +178 -69
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +530 -157
- package/dist/components/inputs/DateTime/shared/Calendar.js +333 -137
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +301 -102
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +146 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +245 -90
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.js +311 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +7 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +376 -146
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +94 -21
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
- 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 +3 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +208 -70
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/File/FileUpload.js +86 -44
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- 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 -35
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.js +79 -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.js +40 -9
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +392 -123
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +463 -146
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.js +298 -89
- package/dist/components/inputs/Input/TextInput/TextInput.js +370 -121
- package/dist/components/inputs/Input/shared/InputContent.js +190 -58
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +0 -1
- package/dist/components/inputs/Inputs/InputItem.js +65 -16
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.js +333 -107
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +145 -50
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +3 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +107 -27
- package/dist/components/inputs/Selection/Select/Select.js +139 -44
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +326 -136
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
- 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/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +44 -38
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +2 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +444 -124
- package/dist/components/inputs/Slider/Slider.js +247 -74
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
- 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 +206 -41
- package/dist/components/inputs/shared/CheckContent.js +21 -10
- package/dist/components/inputs/shared/InputClear.js +78 -21
- package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
- package/dist/components/inputs/shared/input.cva.js +13 -3
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +1 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +87 -34
- 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 +83 -27
- 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/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +21 -13
- 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 +4 -4
- package/dist/config/uiConfig.context.js +50 -11
- package/dist/config/uiStyle.context.js +15 -5
- package/dist/helpers/dynamicInputs.d.ts +1 -1
- 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.js +101 -30
- package/dist/hooks/useIntersectionObserver.js +86 -32
- 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.js +1 -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.js +2 -2
- package/dist/utils/date-time.utils.d.ts +2 -0
- package/dist/utils/date-time.utils.js +17 -13
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
|
15
15
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
16
16
|
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
17
17
|
import { RangeCalendar } from "../shared/RangeCalendar.js";
|
|
18
|
+
import { c } from "react/compiler-runtime";
|
|
18
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
20
|
import { clsx } from "clsx";
|
|
20
21
|
import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
@@ -22,15 +23,16 @@ import { Button } from "react-aria-components";
|
|
|
22
23
|
import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
|
|
23
24
|
import { mergeRefs } from "@react-aria/utils";
|
|
24
25
|
import { useTranslation } from "react-i18next";
|
|
25
|
-
import { Controller
|
|
26
|
-
import { createCalendar, endOfMonth, endOfWeek, endOfYear,
|
|
26
|
+
import { Controller } from "react-hook-form";
|
|
27
|
+
import { createCalendar, endOfMonth, endOfWeek, endOfYear, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
|
|
27
28
|
import { DateTime } from "luxon";
|
|
28
29
|
import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
29
30
|
//#region src/components/inputs/DateTime/DateRangePicker/DateRangePicker.tsx
|
|
31
|
+
var DATE_PICKER_TIME_ZONE = "UTC";
|
|
30
32
|
var DateRangePickerBase = (props) => {
|
|
31
33
|
const ui = UIConfig.useConfig();
|
|
32
34
|
const { t } = useTranslation();
|
|
33
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, ...rest } = props;
|
|
35
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, ...rest } = props;
|
|
34
36
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
35
37
|
const variant = variantProp ?? ui.input.variant;
|
|
36
38
|
const as = asProp ?? ui.input.as;
|
|
@@ -42,26 +44,28 @@ var DateRangePickerBase = (props) => {
|
|
|
42
44
|
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
43
45
|
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
44
46
|
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
47
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
45
48
|
const [validationRangeError, setValidationRangeError] = useState();
|
|
46
49
|
const datePickerInputRef = useRef(null);
|
|
47
50
|
const dateRangePickerRef = useMemo(() => ({ get current() {
|
|
48
51
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
49
52
|
} }), []);
|
|
53
|
+
const normalizedValue = value ?? null;
|
|
50
54
|
const dialogState = useDateRangePickerState({
|
|
51
55
|
...rest,
|
|
52
|
-
value,
|
|
56
|
+
value: normalizedValue,
|
|
53
57
|
shouldCloseOnSelect: false,
|
|
54
58
|
shouldForceLeadingZeros
|
|
55
59
|
});
|
|
56
60
|
const state = useDateRangePickerState({
|
|
57
61
|
...rest,
|
|
58
62
|
shouldForceLeadingZeros,
|
|
59
|
-
value,
|
|
63
|
+
value: normalizedValue,
|
|
60
64
|
onChange: (newValue) => {
|
|
61
65
|
if (isValidRange(newValue)) return;
|
|
62
66
|
onChange?.(newValue);
|
|
63
67
|
handleCalendarStatesChange(newValue);
|
|
64
|
-
debouncedBlur(newValue);
|
|
68
|
+
if (fireBlurOnChange) debouncedBlur(newValue);
|
|
65
69
|
},
|
|
66
70
|
shouldCloseOnSelect: false
|
|
67
71
|
});
|
|
@@ -76,11 +80,14 @@ var DateRangePickerBase = (props) => {
|
|
|
76
80
|
shouldForceLeadingZeros
|
|
77
81
|
}, dialogState, dateRangePickerRef);
|
|
78
82
|
const { locale } = useLocale$1();
|
|
79
|
-
useImperativeHandle(ref, () => ({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
useImperativeHandle(ref, () => ({
|
|
84
|
+
clear: () => {
|
|
85
|
+
datePickerInputRef.current?.clear();
|
|
86
|
+
},
|
|
87
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
88
|
+
}));
|
|
89
|
+
const handleBlur = (newValue_0) => {
|
|
90
|
+
onBlur?.({ target: { value: newValue_0 } });
|
|
84
91
|
};
|
|
85
92
|
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
86
93
|
const formFieldProps = {
|
|
@@ -111,7 +118,7 @@ var DateRangePickerBase = (props) => {
|
|
|
111
118
|
createCalendar,
|
|
112
119
|
pageBehavior: "single",
|
|
113
120
|
visibleDuration: { months: 1 },
|
|
114
|
-
defaultFocusedValue: today(
|
|
121
|
+
defaultFocusedValue: today(DATE_PICKER_TIME_ZONE).add({ months: 1 }),
|
|
115
122
|
minValue: void 0,
|
|
116
123
|
maxValue: void 0
|
|
117
124
|
});
|
|
@@ -133,10 +140,10 @@ var DateRangePickerBase = (props) => {
|
|
|
133
140
|
className: headerClassName,
|
|
134
141
|
labelProps
|
|
135
142
|
};
|
|
136
|
-
const isValidRange = useCallback((
|
|
137
|
-
if (
|
|
138
|
-
const startDate =
|
|
139
|
-
if (
|
|
143
|
+
const isValidRange = useCallback((newValue_1) => {
|
|
144
|
+
if (newValue_1?.start && newValue_1?.end) {
|
|
145
|
+
const startDate = newValue_1.start;
|
|
146
|
+
if (newValue_1.end.compare(startDate) < 0) {
|
|
140
147
|
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
141
148
|
return true;
|
|
142
149
|
}
|
|
@@ -144,20 +151,20 @@ var DateRangePickerBase = (props) => {
|
|
|
144
151
|
} else setValidationRangeError(void 0);
|
|
145
152
|
return false;
|
|
146
153
|
}, [t]);
|
|
147
|
-
const handleCalendarStatesChange = (
|
|
148
|
-
if (
|
|
149
|
-
if (isValidRange(
|
|
150
|
-
dialogState.setValue(
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
leftCalendarState.setFocusedDate(
|
|
154
|
-
if (
|
|
155
|
-
else rightCalendarState.setFocusedDate(
|
|
156
|
-
leftCalendarState.setValue(
|
|
157
|
-
rightCalendarState.setValue(
|
|
154
|
+
const handleCalendarStatesChange = (newValue_2) => {
|
|
155
|
+
if (newValue_2) {
|
|
156
|
+
if (isValidRange(newValue_2)) return;
|
|
157
|
+
dialogState.setValue(newValue_2);
|
|
158
|
+
const startDate_0 = newValue_2.start;
|
|
159
|
+
const endDate_0 = newValue_2.end;
|
|
160
|
+
leftCalendarState.setFocusedDate(startDate_0);
|
|
161
|
+
if (startDate_0.year === endDate_0.year && startDate_0.month === endDate_0.month) rightCalendarState.setFocusedDate(startDate_0.add({ months: 1 }));
|
|
162
|
+
else rightCalendarState.setFocusedDate(endDate_0);
|
|
163
|
+
leftCalendarState.setValue(newValue_2);
|
|
164
|
+
rightCalendarState.setValue(newValue_2);
|
|
158
165
|
setRangeSelection({
|
|
159
|
-
start:
|
|
160
|
-
end:
|
|
166
|
+
start: newValue_2.start,
|
|
167
|
+
end: newValue_2.end,
|
|
161
168
|
isSelecting: false
|
|
162
169
|
});
|
|
163
170
|
setHoverDate(null);
|
|
@@ -181,27 +188,27 @@ var DateRangePickerBase = (props) => {
|
|
|
181
188
|
setHoverDate(date);
|
|
182
189
|
});
|
|
183
190
|
}, []);
|
|
184
|
-
const handleDateHover = useCallback((
|
|
185
|
-
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(
|
|
191
|
+
const handleDateHover = useCallback((date_0) => {
|
|
192
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_0);
|
|
186
193
|
}, [
|
|
187
194
|
rangeSelection.isSelecting,
|
|
188
195
|
rangeSelection.start,
|
|
189
196
|
throttledSetHoverDate
|
|
190
197
|
]);
|
|
191
|
-
const handleDateSelection = useCallback((
|
|
198
|
+
const handleDateSelection = useCallback((date_1, calendarSide) => {
|
|
192
199
|
if (calendarSide) {
|
|
193
200
|
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
194
|
-
if (
|
|
195
|
-
leftCalendarState.setFocusedDate(
|
|
196
|
-
rightCalendarState.setFocusedDate(
|
|
201
|
+
if (date_1.month !== currentVisibleMonth.month || date_1.year !== currentVisibleMonth.year) if (calendarSide === "left") {
|
|
202
|
+
leftCalendarState.setFocusedDate(date_1);
|
|
203
|
+
rightCalendarState.setFocusedDate(date_1.add({ months: 1 }));
|
|
197
204
|
} else {
|
|
198
|
-
rightCalendarState.setFocusedDate(
|
|
199
|
-
leftCalendarState.setFocusedDate(
|
|
205
|
+
rightCalendarState.setFocusedDate(date_1);
|
|
206
|
+
leftCalendarState.setFocusedDate(date_1.subtract({ months: 1 }));
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
209
|
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
203
210
|
setRangeSelection({
|
|
204
|
-
start:
|
|
211
|
+
start: date_1,
|
|
205
212
|
end: null,
|
|
206
213
|
isSelecting: true
|
|
207
214
|
});
|
|
@@ -210,7 +217,7 @@ var DateRangePickerBase = (props) => {
|
|
|
210
217
|
rightCalendarState.setValue(null);
|
|
211
218
|
} else {
|
|
212
219
|
const { start } = rangeSelection;
|
|
213
|
-
const end =
|
|
220
|
+
const end = date_1;
|
|
214
221
|
const finalStart = start.compare(end) <= 0 ? start : end;
|
|
215
222
|
const finalEnd = start.compare(end) <= 0 ? end : start;
|
|
216
223
|
const newRange = {
|
|
@@ -234,16 +241,16 @@ var DateRangePickerBase = (props) => {
|
|
|
234
241
|
rightCalendarState,
|
|
235
242
|
dialogState
|
|
236
243
|
]);
|
|
237
|
-
const handleKeyboardNavigation = useCallback((event,
|
|
238
|
-
const
|
|
239
|
-
const otherState =
|
|
244
|
+
const handleKeyboardNavigation = useCallback((event, date_2, calendarSide_0) => {
|
|
245
|
+
const currentState_0 = calendarSide_0 === "left" ? leftCalendarState : rightCalendarState;
|
|
246
|
+
const otherState = calendarSide_0 === "left" ? rightCalendarState : leftCalendarState;
|
|
240
247
|
let shouldPreventDefault = false;
|
|
241
248
|
switch (event.key) {
|
|
242
249
|
case "ArrowRight": {
|
|
243
|
-
const nextDate =
|
|
244
|
-
const
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
250
|
+
const nextDate = date_2.add({ days: 1 });
|
|
251
|
+
const currentMonth_2 = currentState_0.visibleRange.start;
|
|
252
|
+
const otherMonth_2 = otherState.visibleRange.start;
|
|
253
|
+
if (calendarSide_0 === "left" && nextDate.month !== currentMonth_2.month) if (nextDate.year === otherMonth_2.year && nextDate.month === otherMonth_2.month) {
|
|
247
254
|
otherState.setFocusedDate(nextDate);
|
|
248
255
|
shouldPreventDefault = true;
|
|
249
256
|
} else {
|
|
@@ -253,10 +260,10 @@ var DateRangePickerBase = (props) => {
|
|
|
253
260
|
break;
|
|
254
261
|
}
|
|
255
262
|
case "ArrowLeft": {
|
|
256
|
-
const prevDate =
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
263
|
+
const prevDate = date_2.subtract({ days: 1 });
|
|
264
|
+
const currentMonth_1 = currentState_0.visibleRange.start;
|
|
265
|
+
const otherMonth_1 = otherState.visibleRange.start;
|
|
266
|
+
if (calendarSide_0 === "right" && prevDate.month !== currentMonth_1.month) if (prevDate.year === otherMonth_1.year && prevDate.month === otherMonth_1.month) {
|
|
260
267
|
otherState.setFocusedDate(prevDate);
|
|
261
268
|
shouldPreventDefault = true;
|
|
262
269
|
} else {
|
|
@@ -266,10 +273,10 @@ var DateRangePickerBase = (props) => {
|
|
|
266
273
|
break;
|
|
267
274
|
}
|
|
268
275
|
case "ArrowDown": {
|
|
269
|
-
const nextWeekDate =
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
276
|
+
const nextWeekDate = date_2.add({ weeks: 1 });
|
|
277
|
+
const currentMonth_0 = currentState_0.visibleRange.start;
|
|
278
|
+
const otherMonth_0 = otherState.visibleRange.start;
|
|
279
|
+
if (calendarSide_0 === "left" && nextWeekDate.month !== currentMonth_0.month) if (nextWeekDate.year === otherMonth_0.year && nextWeekDate.month === otherMonth_0.month) {
|
|
273
280
|
otherState.setFocusedDate(nextWeekDate);
|
|
274
281
|
shouldPreventDefault = true;
|
|
275
282
|
} else {
|
|
@@ -279,10 +286,10 @@ var DateRangePickerBase = (props) => {
|
|
|
279
286
|
break;
|
|
280
287
|
}
|
|
281
288
|
case "ArrowUp": {
|
|
282
|
-
const prevWeekDate =
|
|
283
|
-
const currentMonth =
|
|
289
|
+
const prevWeekDate = date_2.subtract({ weeks: 1 });
|
|
290
|
+
const currentMonth = currentState_0.visibleRange.start;
|
|
284
291
|
const otherMonth = otherState.visibleRange.start;
|
|
285
|
-
if (
|
|
292
|
+
if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
286
293
|
otherState.setFocusedDate(prevWeekDate);
|
|
287
294
|
shouldPreventDefault = true;
|
|
288
295
|
} else {
|
|
@@ -293,7 +300,7 @@ var DateRangePickerBase = (props) => {
|
|
|
293
300
|
}
|
|
294
301
|
case "Enter":
|
|
295
302
|
case " ":
|
|
296
|
-
handleDateSelection(
|
|
303
|
+
handleDateSelection(date_2);
|
|
297
304
|
shouldPreventDefault = true;
|
|
298
305
|
break;
|
|
299
306
|
case "Escape":
|
|
@@ -317,14 +324,14 @@ var DateRangePickerBase = (props) => {
|
|
|
317
324
|
rightCalendarState,
|
|
318
325
|
handleDateSelection
|
|
319
326
|
]);
|
|
320
|
-
const syncCalendarStates = useCallback((
|
|
321
|
-
if (isValidRange(
|
|
322
|
-
leftCalendarState.setValue(
|
|
323
|
-
rightCalendarState.setValue(
|
|
324
|
-
dialogState.setValue(
|
|
325
|
-
if (
|
|
326
|
-
start:
|
|
327
|
-
end:
|
|
327
|
+
const syncCalendarStates = useCallback((newValue_3) => {
|
|
328
|
+
if (isValidRange(newValue_3)) return;
|
|
329
|
+
leftCalendarState.setValue(newValue_3);
|
|
330
|
+
rightCalendarState.setValue(newValue_3);
|
|
331
|
+
dialogState.setValue(newValue_3);
|
|
332
|
+
if (newValue_3) setRangeSelection({
|
|
333
|
+
start: newValue_3.start,
|
|
334
|
+
end: newValue_3.end,
|
|
328
335
|
isSelecting: false
|
|
329
336
|
});
|
|
330
337
|
else setRangeSelection({
|
|
@@ -346,12 +353,12 @@ var DateRangePickerBase = (props) => {
|
|
|
346
353
|
} : dialogState.value;
|
|
347
354
|
if (valueToApply) {
|
|
348
355
|
state.setValue(valueToApply);
|
|
349
|
-
handleBlur(valueToApply);
|
|
356
|
+
if (fireBlurOnChange) handleBlur(valueToApply);
|
|
350
357
|
}
|
|
351
358
|
state.toggle();
|
|
352
359
|
};
|
|
353
360
|
const onTodayPress = () => {
|
|
354
|
-
const todayDate = today(
|
|
361
|
+
const todayDate = today(DATE_PICKER_TIME_ZONE);
|
|
355
362
|
leftCalendarState.setFocusedDate(todayDate);
|
|
356
363
|
rightCalendarState.setFocusedDate(todayDate.add({ months: 1 }));
|
|
357
364
|
syncCalendarStates({
|
|
@@ -359,6 +366,12 @@ var DateRangePickerBase = (props) => {
|
|
|
359
366
|
end: todayDate
|
|
360
367
|
});
|
|
361
368
|
};
|
|
369
|
+
const onInputClear = () => {
|
|
370
|
+
onChange?.(null);
|
|
371
|
+
state.setValue(null);
|
|
372
|
+
handleCalendarStatesChange(null);
|
|
373
|
+
if (fireBlurOnChange) handleBlur(null);
|
|
374
|
+
};
|
|
362
375
|
const onOpenChange = (isOpen) => {
|
|
363
376
|
state.toggle();
|
|
364
377
|
if (!isOpen) {
|
|
@@ -366,11 +379,11 @@ var DateRangePickerBase = (props) => {
|
|
|
366
379
|
dialogState.setValue(state.value);
|
|
367
380
|
leftCalendarState.setValue(state.value);
|
|
368
381
|
rightCalendarState.setValue(state.value);
|
|
369
|
-
const
|
|
370
|
-
const
|
|
371
|
-
leftCalendarState.setFocusedDate(
|
|
372
|
-
if (
|
|
373
|
-
else rightCalendarState.setFocusedDate(
|
|
382
|
+
const startDate_1 = state.value.start || today(DATE_PICKER_TIME_ZONE);
|
|
383
|
+
const endDate_1 = state.value.end || today(DATE_PICKER_TIME_ZONE).add({ months: 1 });
|
|
384
|
+
leftCalendarState.setFocusedDate(startDate_1);
|
|
385
|
+
if (startDate_1.year === endDate_1.year && startDate_1.month === endDate_1.month) rightCalendarState.setFocusedDate(startDate_1.add({ months: 1 }));
|
|
386
|
+
else rightCalendarState.setFocusedDate(endDate_1);
|
|
374
387
|
setRangeSelection({
|
|
375
388
|
start: state.value.start,
|
|
376
389
|
end: state.value.end,
|
|
@@ -379,87 +392,87 @@ var DateRangePickerBase = (props) => {
|
|
|
379
392
|
}
|
|
380
393
|
}
|
|
381
394
|
};
|
|
382
|
-
const
|
|
395
|
+
const todayDate_0 = today(DATE_PICKER_TIME_ZONE);
|
|
383
396
|
const getThisWeekRange = () => {
|
|
384
397
|
return {
|
|
385
|
-
start: startOfWeek(
|
|
386
|
-
end: endOfWeek(
|
|
398
|
+
start: startOfWeek(todayDate_0, locale),
|
|
399
|
+
end: endOfWeek(todayDate_0, locale)
|
|
387
400
|
};
|
|
388
401
|
};
|
|
389
402
|
const getLastWeekRange = () => {
|
|
390
|
-
const thisWeekStart = startOfWeek(
|
|
403
|
+
const thisWeekStart = startOfWeek(todayDate_0, locale);
|
|
391
404
|
return {
|
|
392
405
|
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
393
406
|
end: thisWeekStart.subtract({ days: 1 })
|
|
394
407
|
};
|
|
395
408
|
};
|
|
396
409
|
const getThisAndLastWeekRange = () => {
|
|
397
|
-
const thisWeekEnd = endOfWeek(
|
|
410
|
+
const thisWeekEnd = endOfWeek(todayDate_0, locale);
|
|
398
411
|
return {
|
|
399
|
-
start: startOfWeek(
|
|
412
|
+
start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
|
|
400
413
|
end: thisWeekEnd
|
|
401
414
|
};
|
|
402
415
|
};
|
|
403
416
|
const getThisMonthRange = () => {
|
|
404
417
|
return {
|
|
405
|
-
start: startOfMonth(
|
|
406
|
-
end: endOfMonth(
|
|
418
|
+
start: startOfMonth(todayDate_0),
|
|
419
|
+
end: endOfMonth(todayDate_0)
|
|
407
420
|
};
|
|
408
421
|
};
|
|
409
422
|
const getThisAndLastMonthRange = () => {
|
|
410
|
-
const thisMonthEnd = endOfMonth(
|
|
423
|
+
const thisMonthEnd = endOfMonth(todayDate_0);
|
|
411
424
|
return {
|
|
412
|
-
start: startOfMonth(
|
|
425
|
+
start: startOfMonth(todayDate_0).subtract({ months: 1 }),
|
|
413
426
|
end: thisMonthEnd
|
|
414
427
|
};
|
|
415
428
|
};
|
|
416
429
|
const presets = [
|
|
417
430
|
{
|
|
418
|
-
label: t(($) =>
|
|
431
|
+
label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
419
432
|
getValue: getThisWeekRange
|
|
420
433
|
},
|
|
421
434
|
{
|
|
422
|
-
label: t(($) =>
|
|
435
|
+
label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
423
436
|
getValue: getLastWeekRange
|
|
424
437
|
},
|
|
425
438
|
{
|
|
426
|
-
label: t(($) =>
|
|
439
|
+
label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
427
440
|
getValue: getThisAndLastWeekRange
|
|
428
441
|
},
|
|
429
442
|
{
|
|
430
|
-
label: t(($) =>
|
|
443
|
+
label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
431
444
|
getValue: getThisMonthRange
|
|
432
445
|
},
|
|
433
446
|
{
|
|
434
|
-
label: t(($) =>
|
|
447
|
+
label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
435
448
|
getValue: getThisAndLastMonthRange
|
|
436
449
|
},
|
|
437
450
|
{
|
|
438
|
-
label: t(($) =>
|
|
451
|
+
label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
439
452
|
getValue: () => ({
|
|
440
|
-
start: startOfYear(
|
|
441
|
-
end:
|
|
453
|
+
start: startOfYear(todayDate_0),
|
|
454
|
+
end: todayDate_0
|
|
442
455
|
})
|
|
443
456
|
},
|
|
444
457
|
{
|
|
445
|
-
label: t(($) =>
|
|
458
|
+
label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
446
459
|
getValue: () => ({
|
|
447
|
-
start: startOfYear(
|
|
448
|
-
end: endOfYear(
|
|
460
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
461
|
+
end: endOfYear(todayDate_0.subtract({ years: 1 }))
|
|
449
462
|
})
|
|
450
463
|
},
|
|
451
464
|
{
|
|
452
|
-
label: t(($) =>
|
|
465
|
+
label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
453
466
|
getValue: () => ({
|
|
454
|
-
start: startOfYear(
|
|
455
|
-
end:
|
|
467
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
468
|
+
end: todayDate_0
|
|
456
469
|
})
|
|
457
470
|
},
|
|
458
471
|
{
|
|
459
|
-
label: t(($) =>
|
|
472
|
+
label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
460
473
|
getValue: () => ({
|
|
461
|
-
start: startOfYear(
|
|
462
|
-
end:
|
|
474
|
+
start: startOfYear(todayDate_0),
|
|
475
|
+
end: todayDate_0
|
|
463
476
|
})
|
|
464
477
|
}
|
|
465
478
|
];
|
|
@@ -467,12 +480,12 @@ var DateRangePickerBase = (props) => {
|
|
|
467
480
|
setActivePreset(preset.label);
|
|
468
481
|
const presetValue = preset.getValue();
|
|
469
482
|
syncCalendarStates(presetValue);
|
|
470
|
-
const
|
|
471
|
-
leftCalendarState.setFocusedDate(
|
|
472
|
-
const
|
|
473
|
-
if ((
|
|
483
|
+
const startDate_2 = presetValue.start;
|
|
484
|
+
leftCalendarState.setFocusedDate(startDate_2);
|
|
485
|
+
const endDate_2 = presetValue.end;
|
|
486
|
+
if ((endDate_2.year - startDate_2.year) * 12 + (endDate_2.month - startDate_2.month) > 2) rightCalendarState.setFocusedDate(endDate_2);
|
|
474
487
|
else {
|
|
475
|
-
const rightCalendarMonth =
|
|
488
|
+
const rightCalendarMonth = startDate_2.add({ months: 1 });
|
|
476
489
|
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
477
490
|
}
|
|
478
491
|
};
|
|
@@ -492,6 +505,10 @@ var DateRangePickerBase = (props) => {
|
|
|
492
505
|
groupProps,
|
|
493
506
|
fieldProps: startFieldProps,
|
|
494
507
|
endFieldProps,
|
|
508
|
+
fieldValue: normalizedValue?.start ?? null,
|
|
509
|
+
endFieldValue: normalizedValue?.end ?? null,
|
|
510
|
+
isValueControlled: true,
|
|
511
|
+
hasValue: normalizedValue?.start != null || normalizedValue?.end != null,
|
|
495
512
|
buttonProps,
|
|
496
513
|
isDisabled,
|
|
497
514
|
isInvalid: !!error,
|
|
@@ -508,22 +525,25 @@ var DateRangePickerBase = (props) => {
|
|
|
508
525
|
autoFixYear,
|
|
509
526
|
placeholder,
|
|
510
527
|
className: inputClassName,
|
|
511
|
-
onOpenDropdown: () => state.toggle()
|
|
528
|
+
onOpenDropdown: () => state.toggle(),
|
|
529
|
+
timeZone: DATE_PICKER_TIME_ZONE,
|
|
530
|
+
fireBlurOnChange,
|
|
531
|
+
onClear: onInputClear
|
|
512
532
|
}), /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
513
533
|
hideSidebar,
|
|
514
534
|
sidebar: /* @__PURE__ */ jsx("div", {
|
|
515
535
|
className: "flex w-full flex-row overflow-auto border-elevation-outline-default-1 border-solid [-ms-overflow-style:none] [scrollbar-width:none] md:w-[156px] md:flex-col md:border-r [&::-webkit-scrollbar]:hidden",
|
|
516
|
-
children: presets.map((
|
|
517
|
-
onClick: () => selectPreset(
|
|
518
|
-
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !==
|
|
536
|
+
children: presets.map((preset_0) => /* @__PURE__ */ jsx(Button, {
|
|
537
|
+
onClick: () => selectPreset(preset_0),
|
|
538
|
+
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !== preset_0.label && "text-interactive-text-secondary-idle hover:text-interactive-text-secondary-hover", activePreset === preset_0.label && "bg-interactive-contained-primary-idle text-interactive-text-secondary-idle-inverted"),
|
|
519
539
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
520
540
|
size: "label-2",
|
|
521
541
|
sizeMobile: "label-3",
|
|
522
542
|
as: "span",
|
|
523
543
|
className: "whitespace-nowrap",
|
|
524
|
-
children:
|
|
544
|
+
children: preset_0.label
|
|
525
545
|
})
|
|
526
|
-
},
|
|
546
|
+
}, preset_0.label))
|
|
527
547
|
}),
|
|
528
548
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
529
549
|
isDisabled,
|
|
@@ -558,7 +578,10 @@ var DateRangePickerBase = (props) => {
|
|
|
558
578
|
})
|
|
559
579
|
});
|
|
560
580
|
};
|
|
561
|
-
var
|
|
581
|
+
var DateRangePickerInner = (t0) => {
|
|
582
|
+
const $ = c(25);
|
|
583
|
+
const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
584
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
562
585
|
const ui = UIConfig.useConfig();
|
|
563
586
|
const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
|
|
564
587
|
const { locale } = useLocale$1();
|
|
@@ -569,59 +592,90 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
569
592
|
inputRef,
|
|
570
593
|
renderInput,
|
|
571
594
|
setRenderInput,
|
|
572
|
-
getFocusTarget:
|
|
573
|
-
return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
|
|
574
|
-
}
|
|
595
|
+
getFocusTarget: _temp
|
|
575
596
|
});
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
597
|
+
const normalizedValue = props.value ?? null;
|
|
598
|
+
let t2;
|
|
599
|
+
if ($[0] !== fullIso) {
|
|
600
|
+
t2 = (range) => {
|
|
601
|
+
if (!range?.start || !range?.end) return null;
|
|
602
|
+
if (fullIso) return {
|
|
603
|
+
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
604
|
+
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
605
|
+
};
|
|
606
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
607
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
608
|
+
return {
|
|
609
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
610
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
611
|
+
};
|
|
588
612
|
};
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
613
|
+
$[0] = fullIso;
|
|
614
|
+
$[1] = t2;
|
|
615
|
+
} else t2 = $[1];
|
|
616
|
+
const formatDateRange = t2;
|
|
617
|
+
let t3;
|
|
618
|
+
if ($[2] !== fullIso) {
|
|
619
|
+
t3 = (formattedRange) => {
|
|
620
|
+
if (!formattedRange?.start || !formattedRange?.end) return formattedRange;
|
|
621
|
+
if (fullIso) return {
|
|
622
|
+
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
623
|
+
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
624
|
+
};
|
|
625
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
626
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
627
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
628
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
629
|
+
return {
|
|
630
|
+
start: toCalendarDate(startZonedDateTime),
|
|
631
|
+
end: toCalendarDate(endZonedDateTime)
|
|
632
|
+
};
|
|
594
633
|
};
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
634
|
+
$[2] = fullIso;
|
|
635
|
+
$[3] = t3;
|
|
636
|
+
} else t3 = $[3];
|
|
637
|
+
const parseDateRange = t3;
|
|
638
|
+
let t4;
|
|
639
|
+
if ($[4] !== fullIso) {
|
|
640
|
+
t4 = (formattedDate) => {
|
|
641
|
+
if (formattedDate == null) return formattedDate;
|
|
642
|
+
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
643
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
644
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
601
645
|
};
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
646
|
+
$[4] = fullIso;
|
|
647
|
+
$[5] = t4;
|
|
648
|
+
} else t4 = $[5];
|
|
649
|
+
const parseCalendarDate = t4;
|
|
650
|
+
let t5;
|
|
651
|
+
if ($[6] !== minValue || $[7] !== parseCalendarDate) {
|
|
652
|
+
t5 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
|
|
653
|
+
$[6] = minValue;
|
|
654
|
+
$[7] = parseCalendarDate;
|
|
655
|
+
$[8] = t5;
|
|
656
|
+
} else t5 = $[8];
|
|
657
|
+
let t6;
|
|
658
|
+
if ($[9] !== maxValue || $[10] !== parseCalendarDate) {
|
|
659
|
+
t6 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
|
|
660
|
+
$[9] = maxValue;
|
|
661
|
+
$[10] = parseCalendarDate;
|
|
662
|
+
$[11] = t6;
|
|
663
|
+
} else t6 = $[11];
|
|
664
|
+
let t7;
|
|
665
|
+
if ($[12] !== t5 || $[13] !== t6) {
|
|
666
|
+
t7 = {
|
|
667
|
+
minValue: t5,
|
|
668
|
+
maxValue: t6
|
|
609
669
|
};
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date));
|
|
616
|
-
};
|
|
617
|
-
const dateLimits = {
|
|
618
|
-
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
619
|
-
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
620
|
-
};
|
|
670
|
+
$[12] = t5;
|
|
671
|
+
$[13] = t6;
|
|
672
|
+
$[14] = t7;
|
|
673
|
+
} else t7 = $[14];
|
|
674
|
+
const dateLimits = t7;
|
|
621
675
|
if (!renderInput) {
|
|
622
|
-
const startDateValue = parseCalendarDate(
|
|
623
|
-
const endDateValue = parseCalendarDate(
|
|
624
|
-
const hasProvidedRangeValue = !!(
|
|
676
|
+
const startDateValue = parseCalendarDate(normalizedValue?.start ?? null);
|
|
677
|
+
const endDateValue = parseCalendarDate(normalizedValue?.end ?? null);
|
|
678
|
+
const hasProvidedRangeValue = !!(normalizedValue?.start || normalizedValue?.end);
|
|
625
679
|
const as = props.as ?? ui.input.as;
|
|
626
680
|
const size = props.size ?? ui.input.size;
|
|
627
681
|
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
@@ -661,36 +715,148 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
661
715
|
onStaticInteract: renderRealInput,
|
|
662
716
|
actionContent: staticTodayIcon,
|
|
663
717
|
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
718
|
+
wrapContentAndTrailing: true,
|
|
719
|
+
contentAndTrailingClassName: "gap-2!",
|
|
664
720
|
trailingClassName: "py-0! pl-0!",
|
|
665
721
|
trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
|
|
666
722
|
children: staticSegments
|
|
667
723
|
});
|
|
668
724
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
725
|
+
const T0 = DateRangePickerBase;
|
|
726
|
+
const t8 = mergeRefs(props.ref, inputRef);
|
|
727
|
+
const t9 = parseDateRange(normalizedValue);
|
|
728
|
+
let t10;
|
|
729
|
+
if ($[15] !== formatDateRange || $[16] !== props) {
|
|
730
|
+
t10 = (value) => props.onChange?.(formatDateRange(value));
|
|
731
|
+
$[15] = formatDateRange;
|
|
732
|
+
$[16] = props;
|
|
733
|
+
$[17] = t10;
|
|
734
|
+
} else t10 = $[17];
|
|
735
|
+
let t11;
|
|
736
|
+
if ($[18] !== T0 || $[19] !== dateLimits || $[20] !== props || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
|
|
737
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
738
|
+
...props,
|
|
739
|
+
...dateLimits,
|
|
740
|
+
ref: t8,
|
|
741
|
+
value: t9,
|
|
742
|
+
onChange: t10
|
|
685
743
|
});
|
|
744
|
+
$[18] = T0;
|
|
745
|
+
$[19] = dateLimits;
|
|
746
|
+
$[20] = props;
|
|
747
|
+
$[21] = t10;
|
|
748
|
+
$[22] = t8;
|
|
749
|
+
$[23] = t9;
|
|
750
|
+
$[24] = t11;
|
|
751
|
+
} else t11 = $[24];
|
|
752
|
+
return t11;
|
|
753
|
+
};
|
|
754
|
+
var DateRangePicker = (t0) => {
|
|
755
|
+
const $ = c(30);
|
|
756
|
+
let maxValue;
|
|
757
|
+
let minValue;
|
|
758
|
+
let props;
|
|
759
|
+
let renderStaticInput;
|
|
760
|
+
let t1;
|
|
761
|
+
if ($[0] !== t0) {
|
|
762
|
+
({fullIso: t1, minValue, maxValue, renderStaticInput, ...props} = t0);
|
|
763
|
+
$[0] = t0;
|
|
764
|
+
$[1] = maxValue;
|
|
765
|
+
$[2] = minValue;
|
|
766
|
+
$[3] = props;
|
|
767
|
+
$[4] = renderStaticInput;
|
|
768
|
+
$[5] = t1;
|
|
769
|
+
} else {
|
|
770
|
+
maxValue = $[1];
|
|
771
|
+
minValue = $[2];
|
|
772
|
+
props = $[3];
|
|
773
|
+
renderStaticInput = $[4];
|
|
774
|
+
t1 = $[5];
|
|
686
775
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
776
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
777
|
+
if ("formControl" in props && props.formControl) {
|
|
778
|
+
let formControl;
|
|
779
|
+
let innerProps;
|
|
780
|
+
let ref;
|
|
781
|
+
if ($[6] !== props) {
|
|
782
|
+
({formControl, ref, ...innerProps} = props);
|
|
783
|
+
$[6] = props;
|
|
784
|
+
$[7] = formControl;
|
|
785
|
+
$[8] = innerProps;
|
|
786
|
+
$[9] = ref;
|
|
787
|
+
} else {
|
|
788
|
+
formControl = $[7];
|
|
789
|
+
innerProps = $[8];
|
|
790
|
+
ref = $[9];
|
|
791
|
+
}
|
|
792
|
+
const controlWithOptions = formControl.control;
|
|
793
|
+
let t2;
|
|
794
|
+
if ($[10] !== controlWithOptions._options?.disabled || $[11] !== fullIso || $[12] !== innerProps || $[13] !== maxValue || $[14] !== minValue || $[15] !== props.error || $[16] !== props.isDisabled || $[17] !== ref || $[18] !== renderStaticInput) {
|
|
795
|
+
t2 = (t3) => {
|
|
796
|
+
const { field, fieldState: t4 } = t3;
|
|
797
|
+
const { error, isDirty } = t4;
|
|
798
|
+
return /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
799
|
+
...innerProps,
|
|
800
|
+
ref: mergeRefs(ref, field.ref),
|
|
801
|
+
value: field.value,
|
|
802
|
+
onChange: field.onChange,
|
|
803
|
+
onBlur: field.onBlur,
|
|
804
|
+
isDirty,
|
|
805
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
806
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
807
|
+
error: props.error ?? error?.message,
|
|
808
|
+
fullIso,
|
|
809
|
+
minValue,
|
|
810
|
+
maxValue,
|
|
811
|
+
renderStaticInput
|
|
812
|
+
});
|
|
813
|
+
};
|
|
814
|
+
$[10] = controlWithOptions._options?.disabled;
|
|
815
|
+
$[11] = fullIso;
|
|
816
|
+
$[12] = innerProps;
|
|
817
|
+
$[13] = maxValue;
|
|
818
|
+
$[14] = minValue;
|
|
819
|
+
$[15] = props.error;
|
|
820
|
+
$[16] = props.isDisabled;
|
|
821
|
+
$[17] = ref;
|
|
822
|
+
$[18] = renderStaticInput;
|
|
823
|
+
$[19] = t2;
|
|
824
|
+
} else t2 = $[19];
|
|
825
|
+
let t3;
|
|
826
|
+
if ($[20] !== formControl.control || $[21] !== formControl.name || $[22] !== t2) {
|
|
827
|
+
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
828
|
+
control: formControl.control,
|
|
829
|
+
name: formControl.name,
|
|
830
|
+
render: t2
|
|
831
|
+
});
|
|
832
|
+
$[20] = formControl.control;
|
|
833
|
+
$[21] = formControl.name;
|
|
834
|
+
$[22] = t2;
|
|
835
|
+
$[23] = t3;
|
|
836
|
+
} else t3 = $[23];
|
|
837
|
+
return t3;
|
|
838
|
+
}
|
|
839
|
+
let t2;
|
|
840
|
+
if ($[24] !== fullIso || $[25] !== maxValue || $[26] !== minValue || $[27] !== props || $[28] !== renderStaticInput) {
|
|
841
|
+
t2 = /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
842
|
+
...props,
|
|
843
|
+
fullIso,
|
|
844
|
+
minValue,
|
|
845
|
+
maxValue,
|
|
846
|
+
renderStaticInput
|
|
847
|
+
});
|
|
848
|
+
$[24] = fullIso;
|
|
849
|
+
$[25] = maxValue;
|
|
850
|
+
$[26] = minValue;
|
|
851
|
+
$[27] = props;
|
|
852
|
+
$[28] = renderStaticInput;
|
|
853
|
+
$[29] = t2;
|
|
854
|
+
} else t2 = $[29];
|
|
855
|
+
return t2;
|
|
694
856
|
};
|
|
857
|
+
function _temp(input) {
|
|
858
|
+
const container = input.getContainer?.() ?? input;
|
|
859
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
860
|
+
}
|
|
695
861
|
//#endregion
|
|
696
862
|
export { DateRangePicker };
|