@povio/ui 2.3.3 → 3.0.0-rc.1
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 +215 -64
- package/dist/components/Breadcrumbs/breadcrumbs.cva.d.ts +40 -14
- package/dist/components/Breadcrumbs/breadcrumbs.cva.js +21 -18
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +35 -12
- package/dist/components/Menu/MenuMobile.js +103 -44
- package/dist/components/Menu/MenuPopover.js +110 -34
- package/dist/components/Menu/menu.cva.d.ts +35 -13
- package/dist/components/Menu/menu.cva.js +30 -24
- package/dist/components/buttons/Button/Button.js +7 -7
- package/dist/components/buttons/Button/button.cva.d.ts +95 -26
- package/dist/components/buttons/Button/button.cva.js +601 -589
- 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 +59 -21
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +33 -9
- package/dist/components/buttons/PillButton/pillButton.cva.js +247 -239
- 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 +83 -25
- package/dist/components/buttons/shared/buttonContent.cva.d.ts +3 -5
- package/dist/components/buttons/shared/buttonContent.cva.js +1 -8
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +203 -37
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +28 -14
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +26 -10
- package/dist/components/inputs/Checkbox/checkbox.cva.js +47 -40
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +371 -75
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +482 -186
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +13 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +267 -47
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +7 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +611 -121
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +338 -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 +249 -93
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.js +286 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +13 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +387 -143
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +15 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +96 -11
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +84 -30
- 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 +214 -69
- 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 +27 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +15 -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 +40 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +85 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +87 -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 +151 -37
- package/dist/components/inputs/File/shared/InputUploadFilled.js +51 -10
- package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +26 -9
- package/dist/components/inputs/File/shared/fileUpload.cva.js +48 -40
- package/dist/components/inputs/File/shared/inputUploadButton.cva.d.ts +23 -6
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +29 -20
- 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 +27 -7
- 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 +28 -8
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +46 -15
- package/dist/components/inputs/FormField/formFieldError.cva.d.ts +12 -5
- package/dist/components/inputs/FormField/formFieldError.cva.js +11 -8
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +22 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +13 -0
- package/dist/components/inputs/FormField/formFieldHelper.cva.d.ts +12 -5
- package/dist/components/inputs/FormField/formFieldHelper.cva.js +11 -8
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +450 -100
- 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 +575 -0
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +12 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +4 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +309 -94
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +422 -93
- package/dist/components/inputs/Input/shared/InputContent.js +196 -63
- 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 +356 -64
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +101 -6
- package/dist/components/inputs/RadioGroup/radio.cva.js +74 -24
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +214 -22
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +104 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +36 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +173 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +225 -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 +396 -141
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +398 -119
- 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 +88 -38
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +72 -19
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +73 -24
- 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 +12 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +36 -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 +10 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +4 -0
- 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/selectItem.cva.d.ts +16 -6
- package/dist/components/inputs/Selection/shared/selectItem.cva.js +21 -18
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -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 +82 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +548 -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 +450 -101
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +105 -33
- 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 +217 -40
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +15 -6
- package/dist/components/inputs/Toggle/toggle.cva.js +25 -21
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +23 -13
- 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 +137 -16
- package/dist/components/inputs/shared/input.cva.js +317 -273
- package/dist/components/inputs/shared/label.cva.d.ts +15 -6
- package/dist/components/inputs/shared/label.cva.js +28 -25
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +12 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +4 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +14 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +100 -0
- package/dist/components/navigation/Accordion/Accordion.js +71 -24
- package/dist/components/navigation/Accordion/AccordionItem.js +97 -52
- package/dist/components/navigation/Accordion/accordion.cva.d.ts +109 -44
- package/dist/components/navigation/Accordion/accordion.cva.js +114 -84
- package/dist/components/navigation/Stepper/Stepper.js +69 -24
- package/dist/components/navigation/Stepper/StepperItem.js +112 -39
- package/dist/components/navigation/Stepper/StepperSeparator.js +25 -7
- package/dist/components/navigation/Stepper/stepper.cva.d.ts +86 -30
- package/dist/components/navigation/Stepper/stepper.cva.js +104 -83
- 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/Modal/Modal.js +5 -5
- package/dist/components/overlays/Modal/modal.cva.d.ts +34 -9
- package/dist/components/overlays/Modal/modal.cva.js +38 -27
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +86 -30
- package/dist/components/overlays/Tooltip/Tooltip.js +143 -34
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/overlays/Tooltip/tooltip.cva.d.ts +45 -17
- package/dist/components/overlays/Tooltip/tooltip.cva.js +38 -26
- package/dist/components/segment/Segment.js +221 -60
- package/dist/components/segment/SegmentItem.js +70 -13
- package/dist/components/segment/segment.cva.d.ts +18 -7
- package/dist/components/segment/segment.cva.js +24 -21
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/shared/popover.cva.d.ts +7 -3
- package/dist/components/shared/popover.cva.js +3 -3
- package/dist/components/status/Alert/Alert.js +103 -36
- package/dist/components/status/Alert/alert.cva.d.ts +18 -6
- package/dist/components/status/Alert/alert.cva.js +60 -57
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Loader/loader.cva.d.ts +23 -4
- package/dist/components/status/Loader/loader.cva.js +22 -13
- package/dist/components/status/Toast/Toast.js +27 -20
- package/dist/components/status/Toast/toast.cva.d.ts +61 -10
- package/dist/components/status/Toast/toast.cva.js +129 -64
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/status/shared/status.cva.d.ts +30 -8
- package/dist/components/status/shared/status.cva.js +56 -50
- package/dist/components/table/CellText.js +3 -3
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/HeaderText.js +3 -3
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +34 -33
- package/dist/components/table/table.cva.d.ts +52 -19
- package/dist/components/table/table.cva.js +44 -35
- package/dist/components/text/Link/Link.js +22 -10
- package/dist/components/text/Link/link.cva.d.ts +11 -5
- package/dist/components/text/Link/link.cva.js +8 -5
- package/dist/components/text/Tag/Tag.js +3 -3
- package/dist/components/text/Tag/tag.cva.d.ts +15 -5
- package/dist/components/text/Tag/tag.cva.js +51 -48
- package/dist/components/text/Typography/Typography.js +25 -10
- package/dist/components/text/Typography/typography.cva.d.ts +93 -7
- package/dist/components/text/Typography/typography.cva.js +126 -122
- 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 +192 -0
- package/dist/config/uiOverrides.context.js +113 -0
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +3 -0
- 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 +57 -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 +37 -1
- package/dist/index.js +34 -3
- 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/style-merge.util.d.ts +43 -0
- package/dist/utils/style-merge.util.js +233 -0
- package/dist/utils/style-merge.util.spec.d.ts +1 -0
- package/package.json +1 -1
- package/dist/config/uiStyle.context.d.ts +0 -162
- package/dist/config/uiStyle.context.js +0 -30
|
@@ -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 { datePickerInputContentRow } 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 } 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,33 @@ 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
|
+
};
|
|
392
435
|
const onOpenChange = (isOpen) => {
|
|
393
436
|
state.toggle();
|
|
394
437
|
if (!isOpen) {
|
|
@@ -396,11 +439,11 @@ var DateRangePickerBase = (props) => {
|
|
|
396
439
|
dialogState.setValue(state.value);
|
|
397
440
|
leftCalendarState.setValue(state.value);
|
|
398
441
|
rightCalendarState.setValue(state.value);
|
|
399
|
-
const
|
|
400
|
-
const
|
|
401
|
-
leftCalendarState.setFocusedDate(
|
|
402
|
-
if (
|
|
403
|
-
else rightCalendarState.setFocusedDate(
|
|
442
|
+
const startDate_3 = state.value.start || today(effectiveTimeZone);
|
|
443
|
+
const endDate_3 = state.value.end || today(effectiveTimeZone).add({ months: 1 });
|
|
444
|
+
leftCalendarState.setFocusedDate(startDate_3);
|
|
445
|
+
if (startDate_3.year === endDate_3.year && startDate_3.month === endDate_3.month) rightCalendarState.setFocusedDate(startDate_3.add({ months: 1 }));
|
|
446
|
+
else rightCalendarState.setFocusedDate(endDate_3);
|
|
404
447
|
setRangeSelection({
|
|
405
448
|
start: state.value.start,
|
|
406
449
|
end: state.value.end,
|
|
@@ -409,110 +452,110 @@ var DateRangePickerBase = (props) => {
|
|
|
409
452
|
}
|
|
410
453
|
}
|
|
411
454
|
};
|
|
412
|
-
const
|
|
455
|
+
const todayDate_0 = today(effectiveTimeZone);
|
|
413
456
|
const getThisWeekRange = () => {
|
|
414
457
|
return {
|
|
415
|
-
start: startOfWeek(
|
|
416
|
-
end: endOfWeek(
|
|
458
|
+
start: startOfWeek(todayDate_0, locale),
|
|
459
|
+
end: endOfWeek(todayDate_0, locale)
|
|
417
460
|
};
|
|
418
461
|
};
|
|
419
462
|
const getLastWeekRange = () => {
|
|
420
|
-
const thisWeekStart = startOfWeek(
|
|
463
|
+
const thisWeekStart = startOfWeek(todayDate_0, locale);
|
|
421
464
|
return {
|
|
422
465
|
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
423
466
|
end: thisWeekStart.subtract({ days: 1 })
|
|
424
467
|
};
|
|
425
468
|
};
|
|
426
469
|
const getThisAndLastWeekRange = () => {
|
|
427
|
-
const thisWeekEnd = endOfWeek(
|
|
470
|
+
const thisWeekEnd = endOfWeek(todayDate_0, locale);
|
|
428
471
|
return {
|
|
429
|
-
start: startOfWeek(
|
|
472
|
+
start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
|
|
430
473
|
end: thisWeekEnd
|
|
431
474
|
};
|
|
432
475
|
};
|
|
433
476
|
const getThisMonthRange = () => {
|
|
434
477
|
return {
|
|
435
|
-
start: startOfMonth(
|
|
436
|
-
end: endOfMonth(
|
|
478
|
+
start: startOfMonth(todayDate_0),
|
|
479
|
+
end: endOfMonth(todayDate_0)
|
|
437
480
|
};
|
|
438
481
|
};
|
|
439
482
|
const getThisAndLastMonthRange = () => {
|
|
440
|
-
const thisMonthEnd = endOfMonth(
|
|
483
|
+
const thisMonthEnd = endOfMonth(todayDate_0);
|
|
441
484
|
return {
|
|
442
|
-
start: startOfMonth(
|
|
485
|
+
start: startOfMonth(todayDate_0).subtract({ months: 1 }),
|
|
443
486
|
end: thisMonthEnd
|
|
444
487
|
};
|
|
445
488
|
};
|
|
446
489
|
const createPreset = (params) => {
|
|
447
|
-
let
|
|
448
|
-
let
|
|
490
|
+
let clampedValue_2 = clampRangeToBounds(params.getValue());
|
|
491
|
+
let isDisabled_0 = false;
|
|
449
492
|
if (params.keepEnabledUnlessFutureMin) {
|
|
450
493
|
let minDateIsInFuture = false;
|
|
451
|
-
if (minValue && minValue.compare(
|
|
494
|
+
if (minValue && minValue.compare(todayDate_0) > 0) minDateIsInFuture = true;
|
|
452
495
|
if (minDateIsInFuture) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
} else if (!
|
|
496
|
+
isDisabled_0 = true;
|
|
497
|
+
clampedValue_2 = null;
|
|
498
|
+
} else if (!clampedValue_2 && maxValue) clampedValue_2 = {
|
|
456
499
|
start: maxValue,
|
|
457
500
|
end: maxValue
|
|
458
501
|
};
|
|
459
502
|
}
|
|
460
|
-
if (!
|
|
461
|
-
if (
|
|
503
|
+
if (!clampedValue_2) isDisabled_0 = true;
|
|
504
|
+
if (clampedValue_2 && !isRangeWithinBounds(clampedValue_2)) isDisabled_0 = true;
|
|
462
505
|
return {
|
|
463
506
|
label: params.label,
|
|
464
507
|
getValue: params.getValue,
|
|
465
|
-
clampedValue,
|
|
466
|
-
isDisabled
|
|
508
|
+
clampedValue: clampedValue_2,
|
|
509
|
+
isDisabled: isDisabled_0
|
|
467
510
|
};
|
|
468
511
|
};
|
|
469
512
|
const presets = [
|
|
470
513
|
createPreset({
|
|
471
|
-
label: t(($) =>
|
|
514
|
+
label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
472
515
|
getValue: getThisWeekRange
|
|
473
516
|
}),
|
|
474
517
|
createPreset({
|
|
475
|
-
label: t(($) =>
|
|
518
|
+
label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
476
519
|
getValue: getLastWeekRange
|
|
477
520
|
}),
|
|
478
521
|
createPreset({
|
|
479
|
-
label: t(($) =>
|
|
522
|
+
label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
480
523
|
getValue: getThisAndLastWeekRange
|
|
481
524
|
}),
|
|
482
525
|
createPreset({
|
|
483
|
-
label: t(($) =>
|
|
526
|
+
label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
484
527
|
getValue: getThisMonthRange
|
|
485
528
|
}),
|
|
486
529
|
createPreset({
|
|
487
|
-
label: t(($) =>
|
|
530
|
+
label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
488
531
|
getValue: getThisAndLastMonthRange
|
|
489
532
|
}),
|
|
490
533
|
createPreset({
|
|
491
|
-
label: t(($) =>
|
|
534
|
+
label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
492
535
|
getValue: () => ({
|
|
493
|
-
start: startOfYear(
|
|
494
|
-
end:
|
|
536
|
+
start: startOfYear(todayDate_0),
|
|
537
|
+
end: todayDate_0
|
|
495
538
|
})
|
|
496
539
|
}),
|
|
497
540
|
createPreset({
|
|
498
|
-
label: t(($) =>
|
|
541
|
+
label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
499
542
|
getValue: () => ({
|
|
500
|
-
start: startOfYear(
|
|
501
|
-
end: endOfYear(
|
|
543
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
544
|
+
end: endOfYear(todayDate_0.subtract({ years: 1 }))
|
|
502
545
|
})
|
|
503
546
|
}),
|
|
504
547
|
createPreset({
|
|
505
|
-
label: t(($) =>
|
|
548
|
+
label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
506
549
|
getValue: () => ({
|
|
507
|
-
start: startOfYear(
|
|
508
|
-
end:
|
|
550
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
551
|
+
end: todayDate_0
|
|
509
552
|
})
|
|
510
553
|
}),
|
|
511
554
|
createPreset({
|
|
512
|
-
label: t(($) =>
|
|
555
|
+
label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
513
556
|
getValue: () => ({
|
|
514
|
-
start: startOfYear(
|
|
515
|
-
end:
|
|
557
|
+
start: startOfYear(todayDate_0),
|
|
558
|
+
end: todayDate_0
|
|
516
559
|
}),
|
|
517
560
|
keepEnabledUnlessFutureMin: true
|
|
518
561
|
})
|
|
@@ -522,12 +565,12 @@ var DateRangePickerBase = (props) => {
|
|
|
522
565
|
setActivePreset(preset.label);
|
|
523
566
|
const presetValue = preset.clampedValue;
|
|
524
567
|
syncCalendarStates(presetValue);
|
|
525
|
-
const
|
|
526
|
-
leftCalendarState.setFocusedDate(
|
|
527
|
-
const
|
|
528
|
-
if ((
|
|
568
|
+
const startDate_4 = presetValue.start;
|
|
569
|
+
leftCalendarState.setFocusedDate(startDate_4);
|
|
570
|
+
const endDate_4 = presetValue.end;
|
|
571
|
+
if ((endDate_4.year - startDate_4.year) * 12 + (endDate_4.month - startDate_4.month) > 2) rightCalendarState.setFocusedDate(endDate_4);
|
|
529
572
|
else {
|
|
530
|
-
const rightCalendarMonth =
|
|
573
|
+
const rightCalendarMonth = startDate_4.add({ months: 1 });
|
|
531
574
|
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
532
575
|
}
|
|
533
576
|
};
|
|
@@ -545,8 +588,24 @@ var DateRangePickerBase = (props) => {
|
|
|
545
588
|
ref: mergeRefs(ref, datePickerInputRef),
|
|
546
589
|
as,
|
|
547
590
|
groupProps,
|
|
548
|
-
fieldProps:
|
|
549
|
-
|
|
591
|
+
fieldProps: {
|
|
592
|
+
...startFieldProps,
|
|
593
|
+
onBlur: (event_0) => {
|
|
594
|
+
startFieldProps.onBlur?.(event_0);
|
|
595
|
+
handleBlur(state.value);
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
endFieldProps: {
|
|
599
|
+
...endFieldProps,
|
|
600
|
+
onBlur: (event_1) => {
|
|
601
|
+
endFieldProps.onBlur?.(event_1);
|
|
602
|
+
handleBlur(state.value);
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
fieldValue: normalizedValue?.start ?? null,
|
|
606
|
+
endFieldValue: normalizedValue?.end ?? null,
|
|
607
|
+
isValueControlled: true,
|
|
608
|
+
hasValue: normalizedValue?.start != null || normalizedValue?.end != null,
|
|
550
609
|
buttonProps,
|
|
551
610
|
isDisabled,
|
|
552
611
|
isInvalid: !!error,
|
|
@@ -556,28 +615,34 @@ var DateRangePickerBase = (props) => {
|
|
|
556
615
|
isClearable,
|
|
557
616
|
headerProps,
|
|
558
617
|
todayIcon,
|
|
618
|
+
todayIconButtonSize,
|
|
619
|
+
todayIconButtonComponent,
|
|
620
|
+
todayIconPlacement,
|
|
559
621
|
isDirty,
|
|
560
622
|
disableManualEntry,
|
|
623
|
+
autoFixYear,
|
|
561
624
|
placeholder,
|
|
562
625
|
className: inputClassName,
|
|
563
626
|
onOpenDropdown: () => state.toggle(),
|
|
564
|
-
|
|
627
|
+
timeZone: effectiveTimeZone,
|
|
628
|
+
fireBlurOnChange,
|
|
629
|
+
onClear: onInputClear
|
|
565
630
|
}), /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
566
631
|
hideSidebar,
|
|
567
632
|
sidebar: /* @__PURE__ */ jsx("div", {
|
|
568
633
|
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 !==
|
|
634
|
+
children: presets.map((preset_0) => /* @__PURE__ */ jsx(Button, {
|
|
635
|
+
isDisabled: preset_0.isDisabled,
|
|
636
|
+
onClick: () => selectPreset(preset_0),
|
|
637
|
+
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
638
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
574
639
|
size: "label-2",
|
|
575
640
|
sizeMobile: "label-3",
|
|
576
641
|
as: "span",
|
|
577
642
|
className: "whitespace-nowrap",
|
|
578
|
-
children:
|
|
643
|
+
children: preset_0.label
|
|
579
644
|
})
|
|
580
|
-
},
|
|
645
|
+
}, preset_0.label))
|
|
581
646
|
}),
|
|
582
647
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
583
648
|
isDisabled,
|
|
@@ -612,69 +677,300 @@ var DateRangePickerBase = (props) => {
|
|
|
612
677
|
})
|
|
613
678
|
});
|
|
614
679
|
};
|
|
615
|
-
var
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
680
|
+
var DateRangePickerInner = (t0) => {
|
|
681
|
+
const $ = c(25);
|
|
682
|
+
const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
683
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
684
|
+
const ui = UIConfig.useConfig();
|
|
685
|
+
const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
|
|
686
|
+
const { locale } = useLocale$1();
|
|
687
|
+
const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
|
|
688
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
689
|
+
const inputRef = useRef(null);
|
|
690
|
+
const { renderRealInput } = useStaticInputHandoff({
|
|
691
|
+
inputRef,
|
|
692
|
+
renderInput,
|
|
693
|
+
setRenderInput,
|
|
694
|
+
getFocusTarget: _temp
|
|
695
|
+
});
|
|
696
|
+
const normalizedValue = props.value ?? null;
|
|
697
|
+
let t2;
|
|
698
|
+
if ($[0] !== fullIso) {
|
|
699
|
+
t2 = (range) => {
|
|
700
|
+
if (!range?.start || !range?.end) return null;
|
|
701
|
+
if (fullIso) return {
|
|
702
|
+
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
703
|
+
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
704
|
+
};
|
|
705
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
706
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
707
|
+
return {
|
|
708
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
709
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
710
|
+
};
|
|
621
711
|
};
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
712
|
+
$[0] = fullIso;
|
|
713
|
+
$[1] = t2;
|
|
714
|
+
} else t2 = $[1];
|
|
715
|
+
const formatDateRange = t2;
|
|
716
|
+
let t3;
|
|
717
|
+
if ($[2] !== fullIso) {
|
|
718
|
+
t3 = (formattedRange) => {
|
|
719
|
+
if (!formattedRange?.start || !formattedRange?.end) return null;
|
|
720
|
+
if (fullIso) return {
|
|
721
|
+
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
722
|
+
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
723
|
+
};
|
|
724
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
725
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
726
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
727
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
728
|
+
return {
|
|
729
|
+
start: toCalendarDate(startZonedDateTime),
|
|
730
|
+
end: toCalendarDate(endZonedDateTime)
|
|
731
|
+
};
|
|
627
732
|
};
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
733
|
+
$[2] = fullIso;
|
|
734
|
+
$[3] = t3;
|
|
735
|
+
} else t3 = $[3];
|
|
736
|
+
const parseDateRange = t3;
|
|
737
|
+
let t4;
|
|
738
|
+
if ($[4] !== fullIso) {
|
|
739
|
+
t4 = (formattedDate) => {
|
|
740
|
+
if (formattedDate == null) return null;
|
|
741
|
+
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
742
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
743
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
634
744
|
};
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
745
|
+
$[4] = fullIso;
|
|
746
|
+
$[5] = t4;
|
|
747
|
+
} else t4 = $[5];
|
|
748
|
+
const parseCalendarDate = t4;
|
|
749
|
+
let t5;
|
|
750
|
+
if ($[6] !== minValue || $[7] !== parseCalendarDate) {
|
|
751
|
+
t5 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
|
|
752
|
+
$[6] = minValue;
|
|
753
|
+
$[7] = parseCalendarDate;
|
|
754
|
+
$[8] = t5;
|
|
755
|
+
} else t5 = $[8];
|
|
756
|
+
let t6;
|
|
757
|
+
if ($[9] !== maxValue || $[10] !== parseCalendarDate) {
|
|
758
|
+
t6 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
|
|
759
|
+
$[9] = maxValue;
|
|
760
|
+
$[10] = parseCalendarDate;
|
|
761
|
+
$[11] = t6;
|
|
762
|
+
} else t6 = $[11];
|
|
763
|
+
let t7;
|
|
764
|
+
if ($[12] !== t5 || $[13] !== t6) {
|
|
765
|
+
t7 = {
|
|
766
|
+
minValue: t5,
|
|
767
|
+
maxValue: t6
|
|
642
768
|
};
|
|
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
|
-
|
|
769
|
+
$[12] = t5;
|
|
770
|
+
$[13] = t6;
|
|
771
|
+
$[14] = t7;
|
|
772
|
+
} else t7 = $[14];
|
|
773
|
+
const dateLimits = t7;
|
|
774
|
+
if (!renderInput) {
|
|
775
|
+
const startDateValue = parseCalendarDate(normalizedValue?.start ?? null);
|
|
776
|
+
const endDateValue = parseCalendarDate(normalizedValue?.end ?? null);
|
|
777
|
+
const hasProvidedRangeValue = !!(normalizedValue?.start || normalizedValue?.end);
|
|
778
|
+
const as = props.as ?? ui.input.as;
|
|
779
|
+
const size = props.size ?? ui.input.size;
|
|
780
|
+
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
781
|
+
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
782
|
+
const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
|
|
783
|
+
const todayIconButtonComponent = props.todayIconButtonComponent ?? ui.dateInput.todayIconButtonComponent;
|
|
784
|
+
const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
|
|
785
|
+
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, {
|
|
786
|
+
isDisabled,
|
|
787
|
+
renderStatic: true,
|
|
788
|
+
size: todayIconButtonSize,
|
|
789
|
+
todayIconButtonComponent
|
|
790
|
+
});
|
|
791
|
+
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
792
|
+
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
793
|
+
const staticSegments = getStaticDateRangeSegments({
|
|
794
|
+
start: startDateValue,
|
|
795
|
+
end: endDateValue,
|
|
796
|
+
locale,
|
|
797
|
+
shouldForceLeadingZeros,
|
|
798
|
+
isDisabled,
|
|
799
|
+
hidePlaceholder: as === "floating" && !hasProvidedRangeValue,
|
|
800
|
+
disableManualEntry,
|
|
801
|
+
placeholder: props.placeholder
|
|
802
|
+
});
|
|
803
|
+
return /* @__PURE__ */ jsx(InputFrame, {
|
|
804
|
+
...props,
|
|
805
|
+
isDisabled,
|
|
806
|
+
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
807
|
+
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
808
|
+
contentClassName: "pr-0!",
|
|
809
|
+
contentWrapperClassName: datePickerInputContentRowCva({ size }),
|
|
810
|
+
contentGroup: "date-picker",
|
|
811
|
+
labelPlacement: "content-row",
|
|
812
|
+
dataAttributes: {
|
|
813
|
+
dataIsEmpty: !hasProvidedRangeValue,
|
|
814
|
+
dataIsFilled: hasProvidedRangeValue,
|
|
815
|
+
dataIsDirty: props.isDirty,
|
|
816
|
+
dataIsRequired: props.isRequired,
|
|
817
|
+
dataIsDisabled: isDisabled,
|
|
818
|
+
dataDisabled: isDisabled,
|
|
819
|
+
dataInvalid: !!props.error,
|
|
820
|
+
dataHasSelection: hasProvidedRangeValue
|
|
821
|
+
},
|
|
822
|
+
renderStatic: true,
|
|
823
|
+
onStaticInteract: renderRealInput,
|
|
824
|
+
actionContent: staticTodayIcon,
|
|
825
|
+
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
826
|
+
showClear: hasProvidedRangeValue,
|
|
827
|
+
wrapContentAndTrailing: true,
|
|
828
|
+
contentAndTrailingClassName: "gap-2!",
|
|
829
|
+
trailingClassName: "py-0! pl-0!",
|
|
830
|
+
action: showDropdown ? {
|
|
831
|
+
icon: ui.dateInput.calendarIcon,
|
|
832
|
+
onClick: _temp2,
|
|
833
|
+
altText: ""
|
|
834
|
+
} : void 0,
|
|
835
|
+
children: staticSegments
|
|
670
836
|
});
|
|
671
837
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
838
|
+
const T0 = DateRangePickerBase;
|
|
839
|
+
const t8 = mergeRefs(props.ref, inputRef);
|
|
840
|
+
const t9 = parseDateRange(normalizedValue);
|
|
841
|
+
let t10;
|
|
842
|
+
if ($[15] !== formatDateRange || $[16] !== props) {
|
|
843
|
+
t10 = (value) => props.onChange?.(formatDateRange(value));
|
|
844
|
+
$[15] = formatDateRange;
|
|
845
|
+
$[16] = props;
|
|
846
|
+
$[17] = t10;
|
|
847
|
+
} else t10 = $[17];
|
|
848
|
+
let t11;
|
|
849
|
+
if ($[18] !== T0 || $[19] !== dateLimits || $[20] !== props || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
|
|
850
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
851
|
+
...props,
|
|
852
|
+
...dateLimits,
|
|
853
|
+
ref: t8,
|
|
854
|
+
value: t9,
|
|
855
|
+
onChange: t10
|
|
856
|
+
});
|
|
857
|
+
$[18] = T0;
|
|
858
|
+
$[19] = dateLimits;
|
|
859
|
+
$[20] = props;
|
|
860
|
+
$[21] = t10;
|
|
861
|
+
$[22] = t8;
|
|
862
|
+
$[23] = t9;
|
|
863
|
+
$[24] = t11;
|
|
864
|
+
} else t11 = $[24];
|
|
865
|
+
return t11;
|
|
866
|
+
};
|
|
867
|
+
var DateRangePicker = (t0) => {
|
|
868
|
+
const $ = c(30);
|
|
869
|
+
let maxValue;
|
|
870
|
+
let minValue;
|
|
871
|
+
let props;
|
|
872
|
+
let renderStaticInput;
|
|
873
|
+
let t1;
|
|
874
|
+
if ($[0] !== t0) {
|
|
875
|
+
({fullIso: t1, minValue, maxValue, renderStaticInput, ...props} = t0);
|
|
876
|
+
$[0] = t0;
|
|
877
|
+
$[1] = maxValue;
|
|
878
|
+
$[2] = minValue;
|
|
879
|
+
$[3] = props;
|
|
880
|
+
$[4] = renderStaticInput;
|
|
881
|
+
$[5] = t1;
|
|
882
|
+
} else {
|
|
883
|
+
maxValue = $[1];
|
|
884
|
+
minValue = $[2];
|
|
885
|
+
props = $[3];
|
|
886
|
+
renderStaticInput = $[4];
|
|
887
|
+
t1 = $[5];
|
|
888
|
+
}
|
|
889
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
890
|
+
if ("formControl" in props && props.formControl) {
|
|
891
|
+
let formControl;
|
|
892
|
+
let innerProps;
|
|
893
|
+
let ref;
|
|
894
|
+
if ($[6] !== props) {
|
|
895
|
+
({formControl, ref, ...innerProps} = props);
|
|
896
|
+
$[6] = props;
|
|
897
|
+
$[7] = formControl;
|
|
898
|
+
$[8] = innerProps;
|
|
899
|
+
$[9] = ref;
|
|
900
|
+
} else {
|
|
901
|
+
formControl = $[7];
|
|
902
|
+
innerProps = $[8];
|
|
903
|
+
ref = $[9];
|
|
904
|
+
}
|
|
905
|
+
const controlWithOptions = formControl.control;
|
|
906
|
+
let t2;
|
|
907
|
+
if ($[10] !== controlWithOptions._options?.disabled || $[11] !== fullIso || $[12] !== innerProps || $[13] !== maxValue || $[14] !== minValue || $[15] !== props.error || $[16] !== props.isDisabled || $[17] !== ref || $[18] !== renderStaticInput) {
|
|
908
|
+
t2 = (t3) => {
|
|
909
|
+
const { field, fieldState: t4 } = t3;
|
|
910
|
+
const { error, isDirty } = t4;
|
|
911
|
+
return /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
912
|
+
...innerProps,
|
|
913
|
+
ref: mergeRefs(ref, field.ref),
|
|
914
|
+
value: field.value ?? null,
|
|
915
|
+
onChange: field.onChange,
|
|
916
|
+
onBlur: field.onBlur,
|
|
917
|
+
isDirty,
|
|
918
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
919
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
920
|
+
error: props.error ?? error?.message,
|
|
921
|
+
fullIso,
|
|
922
|
+
minValue,
|
|
923
|
+
maxValue,
|
|
924
|
+
renderStaticInput
|
|
925
|
+
});
|
|
926
|
+
};
|
|
927
|
+
$[10] = controlWithOptions._options?.disabled;
|
|
928
|
+
$[11] = fullIso;
|
|
929
|
+
$[12] = innerProps;
|
|
930
|
+
$[13] = maxValue;
|
|
931
|
+
$[14] = minValue;
|
|
932
|
+
$[15] = props.error;
|
|
933
|
+
$[16] = props.isDisabled;
|
|
934
|
+
$[17] = ref;
|
|
935
|
+
$[18] = renderStaticInput;
|
|
936
|
+
$[19] = t2;
|
|
937
|
+
} else t2 = $[19];
|
|
938
|
+
let t3;
|
|
939
|
+
if ($[20] !== formControl.control || $[21] !== formControl.name || $[22] !== t2) {
|
|
940
|
+
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
941
|
+
control: formControl.control,
|
|
942
|
+
name: formControl.name,
|
|
943
|
+
render: t2
|
|
944
|
+
});
|
|
945
|
+
$[20] = formControl.control;
|
|
946
|
+
$[21] = formControl.name;
|
|
947
|
+
$[22] = t2;
|
|
948
|
+
$[23] = t3;
|
|
949
|
+
} else t3 = $[23];
|
|
950
|
+
return t3;
|
|
951
|
+
}
|
|
952
|
+
let t2;
|
|
953
|
+
if ($[24] !== fullIso || $[25] !== maxValue || $[26] !== minValue || $[27] !== props || $[28] !== renderStaticInput) {
|
|
954
|
+
t2 = /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
955
|
+
...props,
|
|
956
|
+
fullIso,
|
|
957
|
+
minValue,
|
|
958
|
+
maxValue,
|
|
959
|
+
renderStaticInput
|
|
960
|
+
});
|
|
961
|
+
$[24] = fullIso;
|
|
962
|
+
$[25] = maxValue;
|
|
963
|
+
$[26] = minValue;
|
|
964
|
+
$[27] = props;
|
|
965
|
+
$[28] = renderStaticInput;
|
|
966
|
+
$[29] = t2;
|
|
967
|
+
} else t2 = $[29];
|
|
968
|
+
return t2;
|
|
678
969
|
};
|
|
970
|
+
function _temp(input) {
|
|
971
|
+
const container = input.getContainer?.() ?? input;
|
|
972
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
973
|
+
}
|
|
974
|
+
function _temp2() {}
|
|
679
975
|
//#endregion
|
|
680
976
|
export { DateRangePicker };
|