@povio/ui 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/AlignCenter.js +26 -11
- package/dist/assets/icons/AlignLeft.js +26 -11
- package/dist/assets/icons/AlignLeftRight.js +26 -11
- package/dist/assets/icons/AlignRight.js +26 -11
- package/dist/assets/icons/ArrowDropDown.js +26 -11
- package/dist/assets/icons/ArrowDropUp.js +26 -11
- package/dist/assets/icons/ArrowLeft.js +26 -11
- package/dist/assets/icons/ArrowRight.js +26 -11
- package/dist/assets/icons/Bold.js +26 -11
- package/dist/assets/icons/BulletedList.js +26 -11
- package/dist/assets/icons/Calendar.js +28 -13
- package/dist/assets/icons/Check.js +28 -13
- package/dist/assets/icons/CheckCircle.js +26 -11
- package/dist/assets/icons/CheckboxCheckmark.js +29 -14
- package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
- package/dist/assets/icons/ChevronDown.js +28 -13
- package/dist/assets/icons/ChevronLeft.js +28 -13
- package/dist/assets/icons/ChevronRight.js +28 -13
- package/dist/assets/icons/ChevronUp.js +28 -13
- package/dist/assets/icons/ChevronsLeft.js +28 -13
- package/dist/assets/icons/ChevronsRight.js +28 -13
- package/dist/assets/icons/Clock.js +26 -11
- package/dist/assets/icons/Close.js +26 -11
- package/dist/assets/icons/DateTime.js +35 -14
- package/dist/assets/icons/DragIndicator.js +26 -11
- package/dist/assets/icons/File.js +28 -13
- package/dist/assets/icons/Highlight.js +26 -11
- package/dist/assets/icons/HighlightOn.js +49 -15
- package/dist/assets/icons/Home.js +26 -11
- package/dist/assets/icons/Info.js +37 -16
- package/dist/assets/icons/Italic.js +26 -11
- package/dist/assets/icons/Link.js +26 -11
- package/dist/assets/icons/Menu.js +26 -11
- package/dist/assets/icons/NumberedList.js +26 -11
- package/dist/assets/icons/PointerHorizontal.js +26 -11
- package/dist/assets/icons/PointerVertical.js +26 -11
- package/dist/assets/icons/Search.js +26 -11
- package/dist/assets/icons/Send.js +28 -13
- package/dist/assets/icons/Strikethrough.js +26 -11
- package/dist/assets/icons/TextColor.js +48 -14
- package/dist/assets/icons/Today.js +26 -11
- package/dist/assets/icons/Underlined.js +28 -13
- package/dist/assets/icons/Upload.js +35 -14
- package/dist/assets/icons/Visibility.js +26 -11
- package/dist/assets/icons/VisibilityOff.js +26 -11
- package/dist/assets/icons/WarningFilled.js +28 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +32 -9
- package/dist/components/Menu/MenuMobile.js +102 -39
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/Button/button.cva.d.ts +3 -3
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
- package/dist/components/buttons/TextButton/TextButton.js +30 -8
- package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
- package/dist/components/buttons/shared/ButtonContent.js +80 -22
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +201 -35
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +380 -75
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +499 -186
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +14 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +280 -46
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +7 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +616 -121
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +342 -119
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +310 -103
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +150 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +233 -98
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +288 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +14 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +359 -129
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +18 -1
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +104 -11
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +83 -28
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
- package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +211 -65
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +5 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +15 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +32 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +41 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +99 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +91 -46
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/index.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +102 -15
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +0 -11
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -18
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +81 -22
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
- package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +13 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +14 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +446 -97
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +571 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +574 -0
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +8 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +305 -90
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +429 -90
- package/dist/components/inputs/Input/shared/InputContent.js +193 -59
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +15 -21
- package/dist/components/inputs/Inputs/InputItem.js +69 -14
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +353 -61
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +45 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +48 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +217 -22
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +107 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +37 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +178 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +227 -18
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -18
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +393 -138
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +397 -116
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +164 -52
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +14 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +43 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +67 -36
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +12 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +8 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +54 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +83 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +612 -0
- package/dist/components/inputs/Slider/Slider.d.ts +2 -1
- package/dist/components/inputs/Slider/Slider.js +265 -76
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -98
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +214 -37
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +21 -11
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +88 -12
- package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
- package/dist/components/inputs/shared/input.cva.d.ts +28 -0
- package/dist/components/inputs/shared/input.cva.js +38 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +8 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +15 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +112 -0
- package/dist/components/navigation/Accordion/Accordion.js +69 -22
- package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
- package/dist/components/navigation/Stepper/Stepper.js +67 -22
- package/dist/components/navigation/Stepper/StepperItem.js +104 -31
- package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
- package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
- package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
- package/dist/components/overlays/Drawer/Drawer.js +62 -20
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +85 -28
- package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/segment/Segment.js +218 -57
- package/dist/components/segment/SegmentItem.js +67 -10
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +28 -14
- package/dist/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +28 -27
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.js +42 -16
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.d.ts +20 -6
- package/dist/config/uiConfig.context.js +68 -14
- package/dist/config/uiOverrides.context.d.ts +30 -11
- package/dist/config/uiOverrides.context.js +54 -14
- package/dist/helpers/dynamicInputs.d.ts +12 -9
- package/dist/helpers/dynamicInputs.js +13 -8
- package/dist/hooks/useAutosave.d.ts +2 -1
- package/dist/hooks/useAutosave.js +12 -4
- package/dist/hooks/useAutosave.spec.d.ts +1 -0
- package/dist/hooks/useBreakpoint.js +16 -3
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useFilters.js +125 -64
- package/dist/hooks/useForm.js +42 -8
- package/dist/hooks/useFormAutosave.d.ts +3 -1
- package/dist/hooks/useFormAutosave.js +122 -30
- package/dist/hooks/useFormAutosave.spec.d.ts +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +91 -24
- package/dist/hooks/useKeyInteractions.d.ts +20 -0
- package/dist/hooks/useKeyInteractions.js +54 -0
- package/dist/hooks/useKeyInteractions.spec.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +43 -10
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.js +49 -19
- package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
- package/dist/hooks/useQueryAutocomplete.js +72 -0
- package/dist/hooks/useScrollableListBox.js +37 -16
- package/dist/hooks/useSorting.js +69 -28
- package/dist/hooks/useStateAndRef.js +21 -7
- package/dist/hooks/useTableColumnConfig.js +124 -31
- package/dist/hooks/useTranslationMemo.js +25 -5
- package/dist/index.d.ts +18 -3
- package/dist/index.js +15 -5
- package/dist/tw-ui-plugin.js +6 -0
- package/dist/utils/date-time.utils.d.ts +38 -10
- package/dist/utils/date-time.utils.js +136 -22
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/dist/utils/zod.utils.d.ts +2 -0
- package/dist/utils/zod.utils.js +5 -0
- package/package.json +2 -2
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
1
2
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
2
3
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
4
|
import "../../../../config/i18n.js";
|
|
4
5
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
6
|
+
import { datePickerInputContentRowDefinition } from "../shared/datePickerInput.cva.js";
|
|
7
|
+
import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
|
|
5
8
|
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
6
9
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
7
10
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
11
|
+
import { getStaticDateRangeSegments, getStaticDateTimeFocusTarget } from "../shared/staticDateTimeSegments.js";
|
|
8
12
|
import { FormField } from "../../FormField/FormField.js";
|
|
9
13
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
14
|
+
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
15
|
+
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
16
|
+
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
10
17
|
import { RangeCalendar } from "../shared/RangeCalendar.js";
|
|
18
|
+
import { c } from "react/compiler-runtime";
|
|
11
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
20
|
import { clsx } from "clsx";
|
|
13
21
|
import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
@@ -23,15 +31,32 @@ import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
|
23
31
|
var DateRangePickerBase = (props) => {
|
|
24
32
|
const ui = UIConfig.useConfig();
|
|
25
33
|
const { t } = useTranslation();
|
|
26
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel
|
|
34
|
+
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, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, minValue, maxValue, ...rest } = props;
|
|
35
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
36
|
+
const variant = variantProp ?? ui.input.variant;
|
|
37
|
+
const as = asProp ?? ui.input.as;
|
|
38
|
+
const size = sizeProp ?? ui.input.size;
|
|
39
|
+
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
40
|
+
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
41
|
+
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
42
|
+
const todayIconButtonComponent = todayIconButtonComponentProp ?? ui.dateInput.todayIconButtonComponent;
|
|
43
|
+
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
44
|
+
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
45
|
+
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
46
|
+
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
47
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
48
|
+
const timeZone = ui.dateInput.timeZone;
|
|
49
|
+
let effectiveTimeZone = getLocalTimeZone();
|
|
50
|
+
if (timeZone !== "clientLocal") effectiveTimeZone = timeZone;
|
|
27
51
|
const [validationRangeError, setValidationRangeError] = useState();
|
|
28
52
|
const datePickerInputRef = useRef(null);
|
|
29
53
|
const dateRangePickerRef = useMemo(() => ({ get current() {
|
|
30
54
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
31
55
|
} }), []);
|
|
56
|
+
const normalizedValue = value ?? null;
|
|
32
57
|
const dialogState = useDateRangePickerState({
|
|
33
58
|
...rest,
|
|
34
|
-
value,
|
|
59
|
+
value: normalizedValue,
|
|
35
60
|
shouldCloseOnSelect: false,
|
|
36
61
|
shouldForceLeadingZeros,
|
|
37
62
|
minValue,
|
|
@@ -40,13 +65,15 @@ var DateRangePickerBase = (props) => {
|
|
|
40
65
|
const state = useDateRangePickerState({
|
|
41
66
|
...rest,
|
|
42
67
|
shouldForceLeadingZeros,
|
|
43
|
-
value,
|
|
68
|
+
value: normalizedValue,
|
|
44
69
|
minValue,
|
|
45
70
|
maxValue,
|
|
46
71
|
onChange: (newValue) => {
|
|
47
|
-
|
|
72
|
+
const isInvalidRange = isValidRange(newValue);
|
|
48
73
|
onChange?.(newValue);
|
|
74
|
+
if (isInvalidRange) return;
|
|
49
75
|
handleCalendarStatesChange(newValue);
|
|
76
|
+
if (fireBlurOnChange) debouncedBlur(newValue);
|
|
50
77
|
},
|
|
51
78
|
shouldCloseOnSelect: false
|
|
52
79
|
});
|
|
@@ -65,9 +92,16 @@ var DateRangePickerBase = (props) => {
|
|
|
65
92
|
maxValue
|
|
66
93
|
}, dialogState, dateRangePickerRef);
|
|
67
94
|
const { locale } = useLocale$1();
|
|
68
|
-
useImperativeHandle(ref, () => ({
|
|
69
|
-
|
|
70
|
-
|
|
95
|
+
useImperativeHandle(ref, () => ({
|
|
96
|
+
clear: () => {
|
|
97
|
+
datePickerInputRef.current?.clear();
|
|
98
|
+
},
|
|
99
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
100
|
+
}));
|
|
101
|
+
const handleBlur = (newValue_0) => {
|
|
102
|
+
onBlur?.({ target: { value: newValue_0 } });
|
|
103
|
+
};
|
|
104
|
+
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
71
105
|
const formFieldProps = {
|
|
72
106
|
error: error || validationRangeError,
|
|
73
107
|
label,
|
|
@@ -96,7 +130,7 @@ var DateRangePickerBase = (props) => {
|
|
|
96
130
|
createCalendar,
|
|
97
131
|
pageBehavior: "single",
|
|
98
132
|
visibleDuration: { months: 1 },
|
|
99
|
-
defaultFocusedValue: today(
|
|
133
|
+
defaultFocusedValue: today(effectiveTimeZone).add({ months: 1 }),
|
|
100
134
|
minValue,
|
|
101
135
|
maxValue
|
|
102
136
|
});
|
|
@@ -139,15 +173,15 @@ var DateRangePickerBase = (props) => {
|
|
|
139
173
|
end: endDate
|
|
140
174
|
};
|
|
141
175
|
}, [minValue, maxValue]);
|
|
142
|
-
const isRangeWithinBounds = useCallback((
|
|
143
|
-
if (minValue &&
|
|
144
|
-
if (maxValue &&
|
|
176
|
+
const isRangeWithinBounds = useCallback((range_0) => {
|
|
177
|
+
if (minValue && range_0.start.compare(minValue) < 0) return false;
|
|
178
|
+
if (maxValue && range_0.end.compare(maxValue) > 0) return false;
|
|
145
179
|
return true;
|
|
146
180
|
}, [minValue, maxValue]);
|
|
147
|
-
const isValidRange = useCallback((
|
|
148
|
-
if (
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
181
|
+
const isValidRange = useCallback((newValue_1) => {
|
|
182
|
+
if (newValue_1?.start && newValue_1?.end) {
|
|
183
|
+
const startDate_0 = newValue_1.start;
|
|
184
|
+
if (newValue_1.end.compare(startDate_0) < 0) {
|
|
151
185
|
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
152
186
|
return true;
|
|
153
187
|
}
|
|
@@ -155,17 +189,17 @@ var DateRangePickerBase = (props) => {
|
|
|
155
189
|
} else setValidationRangeError(void 0);
|
|
156
190
|
return false;
|
|
157
191
|
}, [t]);
|
|
158
|
-
const handleCalendarStatesChange = (
|
|
159
|
-
if (
|
|
160
|
-
const clampedValue = clampRangeToBounds(
|
|
192
|
+
const handleCalendarStatesChange = (newValue_2) => {
|
|
193
|
+
if (newValue_2) {
|
|
194
|
+
const clampedValue = clampRangeToBounds(newValue_2);
|
|
161
195
|
if (!clampedValue) return;
|
|
162
196
|
if (isValidRange(clampedValue)) return;
|
|
163
197
|
dialogState.setValue(clampedValue);
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
leftCalendarState.setFocusedDate(
|
|
167
|
-
if (
|
|
168
|
-
else rightCalendarState.setFocusedDate(
|
|
198
|
+
const startDate_1 = clampedValue.start;
|
|
199
|
+
const endDate_1 = clampedValue.end;
|
|
200
|
+
leftCalendarState.setFocusedDate(startDate_1);
|
|
201
|
+
if (startDate_1.year === endDate_1.year && startDate_1.month === endDate_1.month) rightCalendarState.setFocusedDate(startDate_1.add({ months: 1 }));
|
|
202
|
+
else rightCalendarState.setFocusedDate(endDate_1);
|
|
169
203
|
leftCalendarState.setValue(clampedValue);
|
|
170
204
|
rightCalendarState.setValue(clampedValue);
|
|
171
205
|
setRangeSelection({
|
|
@@ -189,33 +223,33 @@ var DateRangePickerBase = (props) => {
|
|
|
189
223
|
setActivePreset(null);
|
|
190
224
|
}
|
|
191
225
|
};
|
|
192
|
-
const throttledSetHoverDate = useCallback((
|
|
226
|
+
const throttledSetHoverDate = useCallback((date_0) => {
|
|
193
227
|
requestAnimationFrame(() => {
|
|
194
|
-
setHoverDate(
|
|
228
|
+
setHoverDate(date_0);
|
|
195
229
|
});
|
|
196
230
|
}, []);
|
|
197
|
-
const handleDateHover = useCallback((
|
|
198
|
-
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(
|
|
231
|
+
const handleDateHover = useCallback((date_1) => {
|
|
232
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_1);
|
|
199
233
|
}, [
|
|
200
234
|
rangeSelection.isSelecting,
|
|
201
235
|
rangeSelection.start,
|
|
202
236
|
throttledSetHoverDate
|
|
203
237
|
]);
|
|
204
|
-
const handleDateSelection = useCallback((
|
|
238
|
+
const handleDateSelection = useCallback((date_2, calendarSide) => {
|
|
205
239
|
if (calendarSide) {
|
|
206
240
|
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
207
|
-
if (
|
|
208
|
-
leftCalendarState.setFocusedDate(
|
|
209
|
-
rightCalendarState.setFocusedDate(
|
|
241
|
+
if (date_2.month !== currentVisibleMonth.month || date_2.year !== currentVisibleMonth.year) if (calendarSide === "left") {
|
|
242
|
+
leftCalendarState.setFocusedDate(date_2);
|
|
243
|
+
rightCalendarState.setFocusedDate(date_2.add({ months: 1 }));
|
|
210
244
|
} else {
|
|
211
|
-
rightCalendarState.setFocusedDate(
|
|
212
|
-
leftCalendarState.setFocusedDate(
|
|
245
|
+
rightCalendarState.setFocusedDate(date_2);
|
|
246
|
+
leftCalendarState.setFocusedDate(date_2.subtract({ months: 1 }));
|
|
213
247
|
}
|
|
214
248
|
}
|
|
215
|
-
if (isDateOutsideBounds(
|
|
249
|
+
if (isDateOutsideBounds(date_2)) return;
|
|
216
250
|
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
217
251
|
setRangeSelection({
|
|
218
|
-
start:
|
|
252
|
+
start: date_2,
|
|
219
253
|
end: null,
|
|
220
254
|
isSelecting: true
|
|
221
255
|
});
|
|
@@ -224,7 +258,7 @@ var DateRangePickerBase = (props) => {
|
|
|
224
258
|
rightCalendarState.setValue(null);
|
|
225
259
|
} else {
|
|
226
260
|
const { start } = rangeSelection;
|
|
227
|
-
const end =
|
|
261
|
+
const end = date_2;
|
|
228
262
|
const clampedRange = clampRangeToBounds({
|
|
229
263
|
start: start.compare(end) <= 0 ? start : end,
|
|
230
264
|
end: start.compare(end) <= 0 ? end : start
|
|
@@ -249,16 +283,16 @@ var DateRangePickerBase = (props) => {
|
|
|
249
283
|
isDateOutsideBounds,
|
|
250
284
|
clampRangeToBounds
|
|
251
285
|
]);
|
|
252
|
-
const handleKeyboardNavigation = useCallback((event,
|
|
253
|
-
const
|
|
254
|
-
const otherState =
|
|
286
|
+
const handleKeyboardNavigation = useCallback((event, date_3, calendarSide_0) => {
|
|
287
|
+
const currentState_0 = calendarSide_0 === "left" ? leftCalendarState : rightCalendarState;
|
|
288
|
+
const otherState = calendarSide_0 === "left" ? rightCalendarState : leftCalendarState;
|
|
255
289
|
let shouldPreventDefault = false;
|
|
256
290
|
switch (event.key) {
|
|
257
291
|
case "ArrowRight": {
|
|
258
|
-
const nextDate =
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
292
|
+
const nextDate = date_3.add({ days: 1 });
|
|
293
|
+
const currentMonth_2 = currentState_0.visibleRange.start;
|
|
294
|
+
const otherMonth_2 = otherState.visibleRange.start;
|
|
295
|
+
if (calendarSide_0 === "left" && nextDate.month !== currentMonth_2.month) if (nextDate.year === otherMonth_2.year && nextDate.month === otherMonth_2.month) {
|
|
262
296
|
otherState.setFocusedDate(nextDate);
|
|
263
297
|
shouldPreventDefault = true;
|
|
264
298
|
} else {
|
|
@@ -268,10 +302,10 @@ var DateRangePickerBase = (props) => {
|
|
|
268
302
|
break;
|
|
269
303
|
}
|
|
270
304
|
case "ArrowLeft": {
|
|
271
|
-
const prevDate =
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
305
|
+
const prevDate = date_3.subtract({ days: 1 });
|
|
306
|
+
const currentMonth_1 = currentState_0.visibleRange.start;
|
|
307
|
+
const otherMonth_1 = otherState.visibleRange.start;
|
|
308
|
+
if (calendarSide_0 === "right" && prevDate.month !== currentMonth_1.month) if (prevDate.year === otherMonth_1.year && prevDate.month === otherMonth_1.month) {
|
|
275
309
|
otherState.setFocusedDate(prevDate);
|
|
276
310
|
shouldPreventDefault = true;
|
|
277
311
|
} else {
|
|
@@ -281,10 +315,10 @@ var DateRangePickerBase = (props) => {
|
|
|
281
315
|
break;
|
|
282
316
|
}
|
|
283
317
|
case "ArrowDown": {
|
|
284
|
-
const nextWeekDate =
|
|
285
|
-
const
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
318
|
+
const nextWeekDate = date_3.add({ weeks: 1 });
|
|
319
|
+
const currentMonth_0 = currentState_0.visibleRange.start;
|
|
320
|
+
const otherMonth_0 = otherState.visibleRange.start;
|
|
321
|
+
if (calendarSide_0 === "left" && nextWeekDate.month !== currentMonth_0.month) if (nextWeekDate.year === otherMonth_0.year && nextWeekDate.month === otherMonth_0.month) {
|
|
288
322
|
otherState.setFocusedDate(nextWeekDate);
|
|
289
323
|
shouldPreventDefault = true;
|
|
290
324
|
} else {
|
|
@@ -294,10 +328,10 @@ var DateRangePickerBase = (props) => {
|
|
|
294
328
|
break;
|
|
295
329
|
}
|
|
296
330
|
case "ArrowUp": {
|
|
297
|
-
const prevWeekDate =
|
|
298
|
-
const currentMonth =
|
|
331
|
+
const prevWeekDate = date_3.subtract({ weeks: 1 });
|
|
332
|
+
const currentMonth = currentState_0.visibleRange.start;
|
|
299
333
|
const otherMonth = otherState.visibleRange.start;
|
|
300
|
-
if (
|
|
334
|
+
if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
301
335
|
otherState.setFocusedDate(prevWeekDate);
|
|
302
336
|
shouldPreventDefault = true;
|
|
303
337
|
} else {
|
|
@@ -308,7 +342,7 @@ var DateRangePickerBase = (props) => {
|
|
|
308
342
|
}
|
|
309
343
|
case "Enter":
|
|
310
344
|
case " ":
|
|
311
|
-
handleDateSelection(
|
|
345
|
+
handleDateSelection(date_3);
|
|
312
346
|
shouldPreventDefault = true;
|
|
313
347
|
break;
|
|
314
348
|
case "Escape":
|
|
@@ -332,8 +366,8 @@ var DateRangePickerBase = (props) => {
|
|
|
332
366
|
rightCalendarState,
|
|
333
367
|
handleDateSelection
|
|
334
368
|
]);
|
|
335
|
-
const syncCalendarStates = useCallback((
|
|
336
|
-
if (
|
|
369
|
+
const syncCalendarStates = useCallback((newValue_3) => {
|
|
370
|
+
if (newValue_3 === null) {
|
|
337
371
|
setValidationRangeError(void 0);
|
|
338
372
|
leftCalendarState.setValue(null);
|
|
339
373
|
rightCalendarState.setValue(null);
|
|
@@ -346,15 +380,15 @@ var DateRangePickerBase = (props) => {
|
|
|
346
380
|
setHoverDate(null);
|
|
347
381
|
return;
|
|
348
382
|
}
|
|
349
|
-
const
|
|
350
|
-
if (!
|
|
351
|
-
if (isValidRange(
|
|
352
|
-
leftCalendarState.setValue(
|
|
353
|
-
rightCalendarState.setValue(
|
|
354
|
-
dialogState.setValue(
|
|
383
|
+
const clampedValue_0 = clampRangeToBounds(newValue_3);
|
|
384
|
+
if (!clampedValue_0) return;
|
|
385
|
+
if (isValidRange(clampedValue_0)) return;
|
|
386
|
+
leftCalendarState.setValue(clampedValue_0);
|
|
387
|
+
rightCalendarState.setValue(clampedValue_0);
|
|
388
|
+
dialogState.setValue(clampedValue_0);
|
|
355
389
|
setRangeSelection({
|
|
356
|
-
start:
|
|
357
|
-
end:
|
|
390
|
+
start: clampedValue_0.start,
|
|
391
|
+
end: clampedValue_0.end,
|
|
358
392
|
isSelecting: false
|
|
359
393
|
});
|
|
360
394
|
setHoverDate(null);
|
|
@@ -371,24 +405,43 @@ var DateRangePickerBase = (props) => {
|
|
|
371
405
|
start: rangeSelection.start,
|
|
372
406
|
end: rangeSelection.end
|
|
373
407
|
};
|
|
374
|
-
|
|
375
|
-
|
|
408
|
+
if (valueToApply) {
|
|
409
|
+
const clampedValue_1 = clampRangeToBounds(valueToApply);
|
|
410
|
+
if (clampedValue_1) {
|
|
411
|
+
valueToApply = clampedValue_1;
|
|
412
|
+
state.setValue(clampedValue_1);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
376
415
|
state.toggle();
|
|
416
|
+
if (fireBlurOnChange) handleBlur(valueToApply);
|
|
377
417
|
};
|
|
378
418
|
const onTodayPress = () => {
|
|
379
|
-
const todayDate = today(
|
|
419
|
+
const todayDate = today(effectiveTimeZone);
|
|
380
420
|
const clampedTodayRange = clampRangeToBounds({
|
|
381
421
|
start: todayDate,
|
|
382
422
|
end: todayDate
|
|
383
423
|
});
|
|
384
424
|
if (!clampedTodayRange) return;
|
|
385
|
-
const
|
|
386
|
-
const
|
|
387
|
-
leftCalendarState.setFocusedDate(
|
|
388
|
-
if (
|
|
389
|
-
else rightCalendarState.setFocusedDate(
|
|
425
|
+
const startDate_2 = clampedTodayRange.start;
|
|
426
|
+
const endDate_2 = clampedTodayRange.end;
|
|
427
|
+
leftCalendarState.setFocusedDate(startDate_2);
|
|
428
|
+
if (startDate_2.year === endDate_2.year && startDate_2.month === endDate_2.month) rightCalendarState.setFocusedDate(startDate_2.add({ months: 1 }));
|
|
429
|
+
else rightCalendarState.setFocusedDate(endDate_2);
|
|
390
430
|
syncCalendarStates(clampedTodayRange);
|
|
391
431
|
};
|
|
432
|
+
const onInputClear = () => {
|
|
433
|
+
onChange?.(null);
|
|
434
|
+
dialogState.setValue(null);
|
|
435
|
+
leftCalendarState.setValue(null);
|
|
436
|
+
rightCalendarState.setValue(null);
|
|
437
|
+
setRangeSelection({
|
|
438
|
+
start: null,
|
|
439
|
+
end: null,
|
|
440
|
+
isSelecting: false
|
|
441
|
+
});
|
|
442
|
+
setHoverDate(null);
|
|
443
|
+
if (fireBlurOnChange) handleBlur(null);
|
|
444
|
+
};
|
|
392
445
|
const onOpenChange = (isOpen) => {
|
|
393
446
|
state.toggle();
|
|
394
447
|
if (!isOpen) {
|
|
@@ -396,11 +449,11 @@ var DateRangePickerBase = (props) => {
|
|
|
396
449
|
dialogState.setValue(state.value);
|
|
397
450
|
leftCalendarState.setValue(state.value);
|
|
398
451
|
rightCalendarState.setValue(state.value);
|
|
399
|
-
const
|
|
400
|
-
const
|
|
401
|
-
leftCalendarState.setFocusedDate(
|
|
402
|
-
if (
|
|
403
|
-
else rightCalendarState.setFocusedDate(
|
|
452
|
+
const startDate_3 = state.value.start || today(effectiveTimeZone);
|
|
453
|
+
const endDate_3 = state.value.end || today(effectiveTimeZone).add({ months: 1 });
|
|
454
|
+
leftCalendarState.setFocusedDate(startDate_3);
|
|
455
|
+
if (startDate_3.year === endDate_3.year && startDate_3.month === endDate_3.month) rightCalendarState.setFocusedDate(startDate_3.add({ months: 1 }));
|
|
456
|
+
else rightCalendarState.setFocusedDate(endDate_3);
|
|
404
457
|
setRangeSelection({
|
|
405
458
|
start: state.value.start,
|
|
406
459
|
end: state.value.end,
|
|
@@ -409,110 +462,110 @@ var DateRangePickerBase = (props) => {
|
|
|
409
462
|
}
|
|
410
463
|
}
|
|
411
464
|
};
|
|
412
|
-
const
|
|
465
|
+
const todayDate_0 = today(effectiveTimeZone);
|
|
413
466
|
const getThisWeekRange = () => {
|
|
414
467
|
return {
|
|
415
|
-
start: startOfWeek(
|
|
416
|
-
end: endOfWeek(
|
|
468
|
+
start: startOfWeek(todayDate_0, locale),
|
|
469
|
+
end: endOfWeek(todayDate_0, locale)
|
|
417
470
|
};
|
|
418
471
|
};
|
|
419
472
|
const getLastWeekRange = () => {
|
|
420
|
-
const thisWeekStart = startOfWeek(
|
|
473
|
+
const thisWeekStart = startOfWeek(todayDate_0, locale);
|
|
421
474
|
return {
|
|
422
475
|
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
423
476
|
end: thisWeekStart.subtract({ days: 1 })
|
|
424
477
|
};
|
|
425
478
|
};
|
|
426
479
|
const getThisAndLastWeekRange = () => {
|
|
427
|
-
const thisWeekEnd = endOfWeek(
|
|
480
|
+
const thisWeekEnd = endOfWeek(todayDate_0, locale);
|
|
428
481
|
return {
|
|
429
|
-
start: startOfWeek(
|
|
482
|
+
start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
|
|
430
483
|
end: thisWeekEnd
|
|
431
484
|
};
|
|
432
485
|
};
|
|
433
486
|
const getThisMonthRange = () => {
|
|
434
487
|
return {
|
|
435
|
-
start: startOfMonth(
|
|
436
|
-
end: endOfMonth(
|
|
488
|
+
start: startOfMonth(todayDate_0),
|
|
489
|
+
end: endOfMonth(todayDate_0)
|
|
437
490
|
};
|
|
438
491
|
};
|
|
439
492
|
const getThisAndLastMonthRange = () => {
|
|
440
|
-
const thisMonthEnd = endOfMonth(
|
|
493
|
+
const thisMonthEnd = endOfMonth(todayDate_0);
|
|
441
494
|
return {
|
|
442
|
-
start: startOfMonth(
|
|
495
|
+
start: startOfMonth(todayDate_0).subtract({ months: 1 }),
|
|
443
496
|
end: thisMonthEnd
|
|
444
497
|
};
|
|
445
498
|
};
|
|
446
499
|
const createPreset = (params) => {
|
|
447
|
-
let
|
|
448
|
-
let
|
|
500
|
+
let clampedValue_2 = clampRangeToBounds(params.getValue());
|
|
501
|
+
let isDisabled_0 = false;
|
|
449
502
|
if (params.keepEnabledUnlessFutureMin) {
|
|
450
503
|
let minDateIsInFuture = false;
|
|
451
|
-
if (minValue && minValue.compare(
|
|
504
|
+
if (minValue && minValue.compare(todayDate_0) > 0) minDateIsInFuture = true;
|
|
452
505
|
if (minDateIsInFuture) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
} else if (!
|
|
506
|
+
isDisabled_0 = true;
|
|
507
|
+
clampedValue_2 = null;
|
|
508
|
+
} else if (!clampedValue_2 && maxValue) clampedValue_2 = {
|
|
456
509
|
start: maxValue,
|
|
457
510
|
end: maxValue
|
|
458
511
|
};
|
|
459
512
|
}
|
|
460
|
-
if (!
|
|
461
|
-
if (
|
|
513
|
+
if (!clampedValue_2) isDisabled_0 = true;
|
|
514
|
+
if (clampedValue_2 && !isRangeWithinBounds(clampedValue_2)) isDisabled_0 = true;
|
|
462
515
|
return {
|
|
463
516
|
label: params.label,
|
|
464
517
|
getValue: params.getValue,
|
|
465
|
-
clampedValue,
|
|
466
|
-
isDisabled
|
|
518
|
+
clampedValue: clampedValue_2,
|
|
519
|
+
isDisabled: isDisabled_0
|
|
467
520
|
};
|
|
468
521
|
};
|
|
469
522
|
const presets = [
|
|
470
523
|
createPreset({
|
|
471
|
-
label: t(($) =>
|
|
524
|
+
label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
472
525
|
getValue: getThisWeekRange
|
|
473
526
|
}),
|
|
474
527
|
createPreset({
|
|
475
|
-
label: t(($) =>
|
|
528
|
+
label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
476
529
|
getValue: getLastWeekRange
|
|
477
530
|
}),
|
|
478
531
|
createPreset({
|
|
479
|
-
label: t(($) =>
|
|
532
|
+
label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
480
533
|
getValue: getThisAndLastWeekRange
|
|
481
534
|
}),
|
|
482
535
|
createPreset({
|
|
483
|
-
label: t(($) =>
|
|
536
|
+
label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
484
537
|
getValue: getThisMonthRange
|
|
485
538
|
}),
|
|
486
539
|
createPreset({
|
|
487
|
-
label: t(($) =>
|
|
540
|
+
label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
488
541
|
getValue: getThisAndLastMonthRange
|
|
489
542
|
}),
|
|
490
543
|
createPreset({
|
|
491
|
-
label: t(($) =>
|
|
544
|
+
label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
492
545
|
getValue: () => ({
|
|
493
|
-
start: startOfYear(
|
|
494
|
-
end:
|
|
546
|
+
start: startOfYear(todayDate_0),
|
|
547
|
+
end: todayDate_0
|
|
495
548
|
})
|
|
496
549
|
}),
|
|
497
550
|
createPreset({
|
|
498
|
-
label: t(($) =>
|
|
551
|
+
label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
499
552
|
getValue: () => ({
|
|
500
|
-
start: startOfYear(
|
|
501
|
-
end: endOfYear(
|
|
553
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
554
|
+
end: endOfYear(todayDate_0.subtract({ years: 1 }))
|
|
502
555
|
})
|
|
503
556
|
}),
|
|
504
557
|
createPreset({
|
|
505
|
-
label: t(($) =>
|
|
558
|
+
label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
506
559
|
getValue: () => ({
|
|
507
|
-
start: startOfYear(
|
|
508
|
-
end:
|
|
560
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
561
|
+
end: todayDate_0
|
|
509
562
|
})
|
|
510
563
|
}),
|
|
511
564
|
createPreset({
|
|
512
|
-
label: t(($) =>
|
|
565
|
+
label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
513
566
|
getValue: () => ({
|
|
514
|
-
start: startOfYear(
|
|
515
|
-
end:
|
|
567
|
+
start: startOfYear(todayDate_0),
|
|
568
|
+
end: todayDate_0
|
|
516
569
|
}),
|
|
517
570
|
keepEnabledUnlessFutureMin: true
|
|
518
571
|
})
|
|
@@ -522,12 +575,12 @@ var DateRangePickerBase = (props) => {
|
|
|
522
575
|
setActivePreset(preset.label);
|
|
523
576
|
const presetValue = preset.clampedValue;
|
|
524
577
|
syncCalendarStates(presetValue);
|
|
525
|
-
const
|
|
526
|
-
leftCalendarState.setFocusedDate(
|
|
527
|
-
const
|
|
528
|
-
if ((
|
|
578
|
+
const startDate_4 = presetValue.start;
|
|
579
|
+
leftCalendarState.setFocusedDate(startDate_4);
|
|
580
|
+
const endDate_4 = presetValue.end;
|
|
581
|
+
if ((endDate_4.year - startDate_4.year) * 12 + (endDate_4.month - startDate_4.month) > 2) rightCalendarState.setFocusedDate(endDate_4);
|
|
529
582
|
else {
|
|
530
|
-
const rightCalendarMonth =
|
|
583
|
+
const rightCalendarMonth = startDate_4.add({ months: 1 });
|
|
531
584
|
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
532
585
|
}
|
|
533
586
|
};
|
|
@@ -545,8 +598,24 @@ var DateRangePickerBase = (props) => {
|
|
|
545
598
|
ref: mergeRefs(ref, datePickerInputRef),
|
|
546
599
|
as,
|
|
547
600
|
groupProps,
|
|
548
|
-
fieldProps:
|
|
549
|
-
|
|
601
|
+
fieldProps: {
|
|
602
|
+
...startFieldProps,
|
|
603
|
+
onBlur: (event_0) => {
|
|
604
|
+
startFieldProps.onBlur?.(event_0);
|
|
605
|
+
handleBlur(state.value);
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
endFieldProps: {
|
|
609
|
+
...endFieldProps,
|
|
610
|
+
onBlur: (event_1) => {
|
|
611
|
+
endFieldProps.onBlur?.(event_1);
|
|
612
|
+
handleBlur(state.value);
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
fieldValue: normalizedValue?.start ?? null,
|
|
616
|
+
endFieldValue: normalizedValue?.end ?? null,
|
|
617
|
+
isValueControlled: true,
|
|
618
|
+
hasValue: normalizedValue?.start != null || normalizedValue?.end != null,
|
|
550
619
|
buttonProps,
|
|
551
620
|
isDisabled,
|
|
552
621
|
isInvalid: !!error,
|
|
@@ -556,28 +625,34 @@ var DateRangePickerBase = (props) => {
|
|
|
556
625
|
isClearable,
|
|
557
626
|
headerProps,
|
|
558
627
|
todayIcon,
|
|
628
|
+
todayIconButtonSize,
|
|
629
|
+
todayIconButtonComponent,
|
|
630
|
+
todayIconPlacement,
|
|
559
631
|
isDirty,
|
|
560
632
|
disableManualEntry,
|
|
633
|
+
autoFixYear,
|
|
561
634
|
placeholder,
|
|
562
635
|
className: inputClassName,
|
|
563
636
|
onOpenDropdown: () => state.toggle(),
|
|
564
|
-
|
|
637
|
+
timeZone: effectiveTimeZone,
|
|
638
|
+
fireBlurOnChange,
|
|
639
|
+
onClear: onInputClear
|
|
565
640
|
}), /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
566
641
|
hideSidebar,
|
|
567
642
|
sidebar: /* @__PURE__ */ jsx("div", {
|
|
568
643
|
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",
|
|
569
|
-
children: presets.map((
|
|
570
|
-
isDisabled:
|
|
571
|
-
onClick: () => selectPreset(
|
|
572
|
-
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item disabled:text-interactive-text-secondary-disabled!", activePreset !==
|
|
644
|
+
children: presets.map((preset_0) => /* @__PURE__ */ jsx(Button, {
|
|
645
|
+
isDisabled: preset_0.isDisabled,
|
|
646
|
+
onClick: () => selectPreset(preset_0),
|
|
647
|
+
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item disabled:text-interactive-text-secondary-disabled!", 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"),
|
|
573
648
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
574
649
|
size: "label-2",
|
|
575
650
|
sizeMobile: "label-3",
|
|
576
651
|
as: "span",
|
|
577
652
|
className: "whitespace-nowrap",
|
|
578
|
-
children:
|
|
653
|
+
children: preset_0.label
|
|
579
654
|
})
|
|
580
|
-
},
|
|
655
|
+
}, preset_0.label))
|
|
581
656
|
}),
|
|
582
657
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
583
658
|
isDisabled,
|
|
@@ -612,69 +687,307 @@ var DateRangePickerBase = (props) => {
|
|
|
612
687
|
})
|
|
613
688
|
});
|
|
614
689
|
};
|
|
615
|
-
var
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
690
|
+
var DateRangePickerInner = (t0) => {
|
|
691
|
+
const $ = c(25);
|
|
692
|
+
const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
693
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
694
|
+
const ui = UIConfig.useConfig();
|
|
695
|
+
const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
|
|
696
|
+
const { locale } = useLocale$1();
|
|
697
|
+
const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
|
|
698
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
699
|
+
const inputRef = useRef(null);
|
|
700
|
+
const { renderRealInput, replayStaticInputPress } = useStaticInputHandoff({
|
|
701
|
+
inputRef,
|
|
702
|
+
renderInput,
|
|
703
|
+
setRenderInput,
|
|
704
|
+
getFocusTarget: _temp,
|
|
705
|
+
getPressTarget: _temp2
|
|
706
|
+
});
|
|
707
|
+
const normalizedValue = props.value ?? null;
|
|
708
|
+
let t2;
|
|
709
|
+
if ($[0] !== fullIso) {
|
|
710
|
+
t2 = (range) => {
|
|
711
|
+
if (!range?.start || !range?.end) return null;
|
|
712
|
+
if (fullIso) return {
|
|
713
|
+
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
714
|
+
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
715
|
+
};
|
|
716
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
717
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
718
|
+
return {
|
|
719
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
720
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
721
|
+
};
|
|
621
722
|
};
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
723
|
+
$[0] = fullIso;
|
|
724
|
+
$[1] = t2;
|
|
725
|
+
} else t2 = $[1];
|
|
726
|
+
const formatDateRange = t2;
|
|
727
|
+
let t3;
|
|
728
|
+
if ($[2] !== fullIso) {
|
|
729
|
+
t3 = (formattedRange) => {
|
|
730
|
+
if (!formattedRange?.start || !formattedRange?.end) return null;
|
|
731
|
+
if (fullIso) return {
|
|
732
|
+
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
733
|
+
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
734
|
+
};
|
|
735
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
736
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
737
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
738
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
739
|
+
return {
|
|
740
|
+
start: toCalendarDate(startZonedDateTime),
|
|
741
|
+
end: toCalendarDate(endZonedDateTime)
|
|
742
|
+
};
|
|
627
743
|
};
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
744
|
+
$[2] = fullIso;
|
|
745
|
+
$[3] = t3;
|
|
746
|
+
} else t3 = $[3];
|
|
747
|
+
const parseDateRange = t3;
|
|
748
|
+
let t4;
|
|
749
|
+
if ($[4] !== fullIso) {
|
|
750
|
+
t4 = (formattedDate) => {
|
|
751
|
+
if (formattedDate == null) return null;
|
|
752
|
+
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
753
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
754
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
634
755
|
};
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
756
|
+
$[4] = fullIso;
|
|
757
|
+
$[5] = t4;
|
|
758
|
+
} else t4 = $[5];
|
|
759
|
+
const parseCalendarDate = t4;
|
|
760
|
+
let t5;
|
|
761
|
+
if ($[6] !== minValue || $[7] !== parseCalendarDate) {
|
|
762
|
+
t5 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
|
|
763
|
+
$[6] = minValue;
|
|
764
|
+
$[7] = parseCalendarDate;
|
|
765
|
+
$[8] = t5;
|
|
766
|
+
} else t5 = $[8];
|
|
767
|
+
let t6;
|
|
768
|
+
if ($[9] !== maxValue || $[10] !== parseCalendarDate) {
|
|
769
|
+
t6 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
|
|
770
|
+
$[9] = maxValue;
|
|
771
|
+
$[10] = parseCalendarDate;
|
|
772
|
+
$[11] = t6;
|
|
773
|
+
} else t6 = $[11];
|
|
774
|
+
let t7;
|
|
775
|
+
if ($[12] !== t5 || $[13] !== t6) {
|
|
776
|
+
t7 = {
|
|
777
|
+
minValue: t5,
|
|
778
|
+
maxValue: t6
|
|
642
779
|
};
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
780
|
+
$[12] = t5;
|
|
781
|
+
$[13] = t6;
|
|
782
|
+
$[14] = t7;
|
|
783
|
+
} else t7 = $[14];
|
|
784
|
+
const dateLimits = t7;
|
|
785
|
+
if (!renderInput) {
|
|
786
|
+
const startDateValue = parseCalendarDate(normalizedValue?.start ?? null);
|
|
787
|
+
const endDateValue = parseCalendarDate(normalizedValue?.end ?? null);
|
|
788
|
+
const hasProvidedRangeValue = !!(normalizedValue?.start || normalizedValue?.end);
|
|
789
|
+
const as = props.as ?? ui.input.as;
|
|
790
|
+
const size = props.size ?? ui.input.size;
|
|
791
|
+
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
792
|
+
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
793
|
+
const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
|
|
794
|
+
const todayIconButtonComponent = props.todayIconButtonComponent ?? ui.dateInput.todayIconButtonComponent;
|
|
795
|
+
const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
|
|
796
|
+
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, {
|
|
797
|
+
isDisabled,
|
|
798
|
+
renderStatic: true,
|
|
799
|
+
size: todayIconButtonSize,
|
|
800
|
+
todayIconButtonComponent
|
|
801
|
+
});
|
|
802
|
+
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
803
|
+
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
804
|
+
const staticSegments = getStaticDateRangeSegments({
|
|
805
|
+
start: startDateValue,
|
|
806
|
+
end: endDateValue,
|
|
807
|
+
locale,
|
|
808
|
+
shouldForceLeadingZeros,
|
|
809
|
+
isDisabled,
|
|
810
|
+
hidePlaceholder: as === "floating" && !hasProvidedRangeValue,
|
|
811
|
+
disableManualEntry,
|
|
812
|
+
placeholder: props.placeholder
|
|
813
|
+
});
|
|
814
|
+
return /* @__PURE__ */ jsx(InputFrame, {
|
|
815
|
+
...props,
|
|
816
|
+
isDisabled,
|
|
817
|
+
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
818
|
+
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
819
|
+
contentClassName: "pr-0!",
|
|
820
|
+
contentWrapperClassName: datePickerInputContentRowCva({ size }),
|
|
821
|
+
contentGroup: "date-picker",
|
|
822
|
+
labelPlacement: "content-row",
|
|
823
|
+
dataAttributes: {
|
|
824
|
+
dataIsEmpty: !hasProvidedRangeValue,
|
|
825
|
+
dataIsFilled: hasProvidedRangeValue,
|
|
826
|
+
dataIsDirty: props.isDirty,
|
|
827
|
+
dataIsRequired: props.isRequired,
|
|
828
|
+
dataIsDisabled: isDisabled,
|
|
829
|
+
dataDisabled: isDisabled,
|
|
830
|
+
dataInvalid: !!props.error,
|
|
831
|
+
dataHasSelection: hasProvidedRangeValue
|
|
832
|
+
},
|
|
833
|
+
onStaticInteract: renderRealInput,
|
|
834
|
+
onStaticPress: replayStaticInputPress,
|
|
835
|
+
staticPressTarget: "action",
|
|
836
|
+
actionContent: staticTodayIcon,
|
|
837
|
+
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
838
|
+
showClear: hasProvidedRangeValue,
|
|
839
|
+
wrapContentAndTrailing: true,
|
|
840
|
+
contentAndTrailingClassName: "gap-2!",
|
|
841
|
+
trailingClassName: "py-0! pl-0!",
|
|
842
|
+
action: showDropdown ? {
|
|
843
|
+
icon: ui.dateInput.calendarIcon,
|
|
844
|
+
onClick: _temp3,
|
|
845
|
+
altText: ""
|
|
846
|
+
} : void 0,
|
|
847
|
+
children: staticSegments
|
|
670
848
|
});
|
|
671
849
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
850
|
+
const T0 = DateRangePickerBase;
|
|
851
|
+
const t8 = mergeRefs(props.ref, inputRef);
|
|
852
|
+
const t9 = parseDateRange(normalizedValue);
|
|
853
|
+
let t10;
|
|
854
|
+
if ($[15] !== formatDateRange || $[16] !== props) {
|
|
855
|
+
t10 = (value) => props.onChange?.(formatDateRange(value));
|
|
856
|
+
$[15] = formatDateRange;
|
|
857
|
+
$[16] = props;
|
|
858
|
+
$[17] = t10;
|
|
859
|
+
} else t10 = $[17];
|
|
860
|
+
let t11;
|
|
861
|
+
if ($[18] !== T0 || $[19] !== dateLimits || $[20] !== props || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
|
|
862
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
863
|
+
...props,
|
|
864
|
+
...dateLimits,
|
|
865
|
+
ref: t8,
|
|
866
|
+
value: t9,
|
|
867
|
+
onChange: t10
|
|
868
|
+
});
|
|
869
|
+
$[18] = T0;
|
|
870
|
+
$[19] = dateLimits;
|
|
871
|
+
$[20] = props;
|
|
872
|
+
$[21] = t10;
|
|
873
|
+
$[22] = t8;
|
|
874
|
+
$[23] = t9;
|
|
875
|
+
$[24] = t11;
|
|
876
|
+
} else t11 = $[24];
|
|
877
|
+
return t11;
|
|
878
|
+
};
|
|
879
|
+
var DateRangePicker = (t0) => {
|
|
880
|
+
const $ = c(30);
|
|
881
|
+
let maxValue;
|
|
882
|
+
let minValue;
|
|
883
|
+
let props;
|
|
884
|
+
let renderStaticInput;
|
|
885
|
+
let t1;
|
|
886
|
+
if ($[0] !== t0) {
|
|
887
|
+
({fullIso: t1, minValue, maxValue, renderStaticInput, ...props} = t0);
|
|
888
|
+
$[0] = t0;
|
|
889
|
+
$[1] = maxValue;
|
|
890
|
+
$[2] = minValue;
|
|
891
|
+
$[3] = props;
|
|
892
|
+
$[4] = renderStaticInput;
|
|
893
|
+
$[5] = t1;
|
|
894
|
+
} else {
|
|
895
|
+
maxValue = $[1];
|
|
896
|
+
minValue = $[2];
|
|
897
|
+
props = $[3];
|
|
898
|
+
renderStaticInput = $[4];
|
|
899
|
+
t1 = $[5];
|
|
900
|
+
}
|
|
901
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
902
|
+
if ("formControl" in props && props.formControl) {
|
|
903
|
+
let formControl;
|
|
904
|
+
let innerProps;
|
|
905
|
+
let ref;
|
|
906
|
+
if ($[6] !== props) {
|
|
907
|
+
({formControl, ref, ...innerProps} = props);
|
|
908
|
+
$[6] = props;
|
|
909
|
+
$[7] = formControl;
|
|
910
|
+
$[8] = innerProps;
|
|
911
|
+
$[9] = ref;
|
|
912
|
+
} else {
|
|
913
|
+
formControl = $[7];
|
|
914
|
+
innerProps = $[8];
|
|
915
|
+
ref = $[9];
|
|
916
|
+
}
|
|
917
|
+
const controlWithOptions = formControl.control;
|
|
918
|
+
let t2;
|
|
919
|
+
if ($[10] !== controlWithOptions._options?.disabled || $[11] !== fullIso || $[12] !== innerProps || $[13] !== maxValue || $[14] !== minValue || $[15] !== props.error || $[16] !== props.isDisabled || $[17] !== ref || $[18] !== renderStaticInput) {
|
|
920
|
+
t2 = (t3) => {
|
|
921
|
+
const { field, fieldState: t4 } = t3;
|
|
922
|
+
const { error, isDirty } = t4;
|
|
923
|
+
return /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
924
|
+
...innerProps,
|
|
925
|
+
ref: mergeRefs(ref, field.ref),
|
|
926
|
+
value: field.value ?? null,
|
|
927
|
+
onChange: field.onChange,
|
|
928
|
+
onBlur: field.onBlur,
|
|
929
|
+
isDirty,
|
|
930
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
931
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
932
|
+
error: props.error ?? error?.message,
|
|
933
|
+
fullIso,
|
|
934
|
+
minValue,
|
|
935
|
+
maxValue,
|
|
936
|
+
renderStaticInput
|
|
937
|
+
});
|
|
938
|
+
};
|
|
939
|
+
$[10] = controlWithOptions._options?.disabled;
|
|
940
|
+
$[11] = fullIso;
|
|
941
|
+
$[12] = innerProps;
|
|
942
|
+
$[13] = maxValue;
|
|
943
|
+
$[14] = minValue;
|
|
944
|
+
$[15] = props.error;
|
|
945
|
+
$[16] = props.isDisabled;
|
|
946
|
+
$[17] = ref;
|
|
947
|
+
$[18] = renderStaticInput;
|
|
948
|
+
$[19] = t2;
|
|
949
|
+
} else t2 = $[19];
|
|
950
|
+
let t3;
|
|
951
|
+
if ($[20] !== formControl.control || $[21] !== formControl.name || $[22] !== t2) {
|
|
952
|
+
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
953
|
+
control: formControl.control,
|
|
954
|
+
name: formControl.name,
|
|
955
|
+
render: t2
|
|
956
|
+
});
|
|
957
|
+
$[20] = formControl.control;
|
|
958
|
+
$[21] = formControl.name;
|
|
959
|
+
$[22] = t2;
|
|
960
|
+
$[23] = t3;
|
|
961
|
+
} else t3 = $[23];
|
|
962
|
+
return t3;
|
|
963
|
+
}
|
|
964
|
+
let t2;
|
|
965
|
+
if ($[24] !== fullIso || $[25] !== maxValue || $[26] !== minValue || $[27] !== props || $[28] !== renderStaticInput) {
|
|
966
|
+
t2 = /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
967
|
+
...props,
|
|
968
|
+
fullIso,
|
|
969
|
+
minValue,
|
|
970
|
+
maxValue,
|
|
971
|
+
renderStaticInput
|
|
972
|
+
});
|
|
973
|
+
$[24] = fullIso;
|
|
974
|
+
$[25] = maxValue;
|
|
975
|
+
$[26] = minValue;
|
|
976
|
+
$[27] = props;
|
|
977
|
+
$[28] = renderStaticInput;
|
|
978
|
+
$[29] = t2;
|
|
979
|
+
} else t2 = $[29];
|
|
980
|
+
return t2;
|
|
678
981
|
};
|
|
982
|
+
function _temp(input, staticTarget) {
|
|
983
|
+
const container = input.getContainer?.() ?? input;
|
|
984
|
+
return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
|
|
985
|
+
}
|
|
986
|
+
function _temp2(input_0) {
|
|
987
|
+
const container_0 = input_0.getContainer?.() ?? input_0;
|
|
988
|
+
if (!(container_0 instanceof HTMLElement)) return null;
|
|
989
|
+
return container_0.querySelector("[data-static-press-action]");
|
|
990
|
+
}
|
|
991
|
+
function _temp3() {}
|
|
679
992
|
//#endregion
|
|
680
993
|
export { DateRangePicker };
|