@povio/ui 0.0.8 → 0.0.9
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 +21 -0
- package/dist/assets/icons/AlignLeft.js +21 -0
- package/dist/assets/icons/AlignLeftRight.js +21 -0
- package/dist/assets/icons/AlignRight.js +21 -0
- package/dist/assets/icons/ArrowDropDown.js +21 -0
- package/dist/assets/icons/ArrowDropUp.js +21 -0
- package/dist/assets/icons/ArrowLeft.js +21 -0
- package/dist/assets/icons/ArrowRight.js +21 -0
- package/dist/assets/icons/Bold.js +21 -0
- package/dist/assets/icons/BulletedList.js +21 -0
- package/dist/assets/icons/Calendar.js +23 -0
- package/dist/assets/icons/Check.js +23 -0
- package/dist/assets/icons/CheckCircle.js +21 -0
- package/dist/assets/icons/CheckboxCheckmark.js +24 -0
- package/dist/assets/icons/CheckboxIndeterminate.js +24 -0
- package/dist/assets/icons/ChevronDown.js +23 -0
- package/dist/assets/icons/ChevronLeft.js +23 -0
- package/dist/assets/icons/ChevronRight.js +23 -0
- package/dist/assets/icons/ChevronUp.js +23 -0
- package/dist/assets/icons/ChevronsLeft.js +23 -0
- package/dist/assets/icons/ChevronsRight.js +23 -0
- package/dist/assets/icons/Clock.js +21 -0
- package/dist/assets/icons/Close.js +21 -0
- package/dist/assets/icons/DateTime.js +32 -0
- package/dist/assets/icons/Drag.js +21 -0
- package/dist/assets/icons/File.js +23 -0
- package/dist/assets/icons/Highlight.js +21 -0
- package/dist/assets/icons/HighlightOn.js +30 -0
- package/dist/assets/icons/Info.js +32 -0
- package/dist/assets/icons/Italic.js +21 -0
- package/dist/assets/icons/Link.js +21 -0
- package/dist/assets/icons/Menu.js +21 -0
- package/dist/assets/icons/NumberedList.js +21 -0
- package/dist/assets/icons/PointerHorizontal.js +21 -0
- package/dist/assets/icons/PointerVertical.js +21 -0
- package/dist/assets/icons/Send.js +23 -0
- package/dist/assets/icons/Strikethrough.js +21 -0
- package/dist/assets/icons/TextColor.js +30 -0
- package/dist/assets/icons/Today.js +21 -0
- package/dist/assets/icons/Underlined.js +23 -0
- package/dist/assets/icons/Upload.js +30 -0
- package/dist/assets/icons/View.js +18 -0
- package/dist/assets/icons/ViewOff.js +18 -0
- package/dist/assets/icons/WarningFilled.js +23 -0
- package/dist/assets/locales/en/translation.json.js +14 -0
- package/dist/assets/locales/sl/translation.json.js +14 -0
- package/dist/components/Menu/Menu.js +14 -0
- package/{src → dist}/components/Menu/MenuDesktop.d.ts +1 -1
- package/dist/components/Menu/MenuDesktop.js +68 -0
- package/{src → dist}/components/Menu/MenuItem.d.ts +1 -1
- package/dist/components/Menu/MenuItem.js +33 -0
- package/{src → dist}/components/Menu/MenuMobile.d.ts +1 -1
- package/dist/components/Menu/MenuMobile.js +78 -0
- package/{src → dist}/components/Menu/MenuPopover.d.ts +1 -1
- package/dist/components/Menu/MenuPopover.js +38 -0
- package/{src → dist}/components/buttons/Button/Button.d.ts +1 -1
- package/dist/components/buttons/Button/Button.js +68 -0
- package/{src → dist}/components/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/buttons/Button/button.cva.js +672 -0
- package/{src → dist}/components/buttons/IconButton/IconButton.d.ts +1 -1
- package/dist/components/buttons/IconButton/IconButton.js +17 -0
- package/{src → dist}/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +18 -0
- package/{src → dist}/components/buttons/PillButton/PillButton.d.ts +2 -2
- package/dist/components/buttons/PillButton/PillButton.js +44 -0
- package/{src → dist}/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/PillButton/pillButton.cva.js +86 -0
- package/{src → dist}/components/buttons/SplitButton/SplitButton.d.ts +2 -2
- package/dist/components/buttons/SplitButton/SplitButton.js +62 -0
- package/{src → dist}/components/buttons/TextButton/TextButton.d.ts +3 -3
- package/dist/components/buttons/TextButton/TextButton.js +18 -0
- package/{src → dist}/components/buttons/ToggleButton/ToggleButton.d.ts +3 -3
- package/dist/components/buttons/ToggleButton/ToggleButton.js +21 -0
- package/{src → dist}/components/buttons/shared/ButtonContent.d.ts +3 -3
- package/dist/components/buttons/shared/ButtonContent.js +53 -0
- package/dist/components/buttons/shared/buttonContent.cva.js +16 -0
- package/{src → dist}/components/inputs/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/inputs/Checkbox/Checkbox.js +81 -0
- package/{src → dist}/components/inputs/Checkbox/CheckboxCheckmark.d.ts +1 -1
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +49 -0
- package/{src → dist}/components/inputs/Checkbox/checkbox.cva.d.ts +1 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.js +47 -0
- package/{src → dist}/components/inputs/DateTime/DatePicker/DatePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +237 -0
- package/{src → dist}/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +674 -0
- package/{src → dist}/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +251 -0
- package/{src → dist}/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +224 -0
- package/dist/components/inputs/DateTime/shared/Calendar.js +85 -0
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +160 -0
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +67 -0
- package/{src → dist}/components/inputs/DateTime/shared/CalendarHeader.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +89 -0
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +203 -0
- package/dist/components/inputs/DateTime/shared/DateField.js +62 -0
- package/{src → dist}/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -2
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +174 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +55 -0
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +76 -0
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +41 -0
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +82 -0
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +131 -0
- package/dist/components/inputs/DateTime/shared/TimeField.js +26 -0
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +186 -0
- package/{src → dist}/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +114 -0
- package/dist/components/inputs/DateTime/shared/YearPicker.js +89 -0
- package/dist/components/inputs/File/FileUpload.js +254 -0
- package/dist/components/inputs/File/FileUploadContainer.js +17 -0
- package/dist/components/inputs/File/InputUpload.js +176 -0
- package/{src → dist}/components/inputs/File/fileUpload.types.d.ts +3 -3
- package/{src → dist}/components/inputs/File/inputUpload.types.d.ts +2 -2
- package/{src → dist}/components/inputs/File/shared/FileCard.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +67 -0
- package/{src → dist}/components/inputs/File/shared/FileCardList.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCardList.js +20 -0
- package/dist/components/inputs/File/shared/FileProgressBar.js +32 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContent.js +92 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentEmpty.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +92 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentError.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentError.js +167 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentFilled.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +176 -0
- package/{src → dist}/components/inputs/File/shared/FileUploadContentLoading.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +128 -0
- package/{src → dist}/components/inputs/File/shared/InputUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/InputUploadContent.js +74 -0
- package/dist/components/inputs/File/shared/InputUploadFilled.js +45 -0
- package/dist/components/inputs/File/shared/fileUpload.cva.js +58 -0
- package/dist/components/inputs/File/shared/inputUploadButton.cva.js +49 -0
- package/{src → dist}/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +54 -0
- package/dist/components/inputs/FormField/FormFieldError.js +16 -0
- package/dist/components/inputs/FormField/FormFieldHeader.js +57 -0
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +20 -0
- package/{src → dist}/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +37 -0
- package/{src → dist}/components/inputs/Input/NumberInput/NumberInput.d.ts +4 -4
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +157 -0
- package/{src → dist}/components/inputs/Input/PasswordInput/PasswordInput.d.ts +2 -2
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +26 -0
- package/{src → dist}/components/inputs/Input/TextArea/TextArea.d.ts +3 -3
- package/dist/components/inputs/Input/TextArea/TextArea.js +146 -0
- package/{src → dist}/components/inputs/Input/TextInput/TextInput.d.ts +4 -4
- package/dist/components/inputs/Input/TextInput/TextInput.js +170 -0
- package/{src → dist}/components/inputs/Input/shared/InputContent.d.ts +3 -3
- package/dist/components/inputs/Input/shared/InputContent.js +114 -0
- package/{src → dist}/components/inputs/Inputs/Form.d.ts +2 -2
- package/dist/components/inputs/Inputs/Form.js +68 -0
- package/{src → dist}/components/inputs/Inputs/InputItem.d.ts +16 -16
- package/dist/components/inputs/Inputs/InputItem.js +63 -0
- package/dist/components/inputs/Inputs/Inputs.js +32 -0
- package/{src → dist}/components/inputs/RadioGroup/RadioGroup.d.ts +3 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.js +113 -0
- package/{src → dist}/components/inputs/RadioGroup/radio.cva.d.ts +1 -1
- package/dist/components/inputs/RadioGroup/radio.cva.js +47 -0
- package/{src → dist}/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +3 -3
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +39 -0
- package/{src → dist}/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +25 -0
- package/{src → dist}/components/inputs/Selection/Select/Select.d.ts +3 -3
- package/dist/components/inputs/Selection/Select/Select.js +32 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectBase.d.ts +3 -3
- package/dist/components/inputs/Selection/shared/SelectBase.js +25 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +211 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectInput.d.ts +4 -4
- package/dist/components/inputs/Selection/shared/SelectInput.js +231 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectInputTags.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +22 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +108 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxItem.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +78 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxItemSelectAll.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +45 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectListBoxLoadingItem.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +47 -0
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +42 -0
- package/{src → dist}/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +161 -0
- package/{src → dist}/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +244 -0
- package/{src → dist}/components/inputs/Selection/shared/select.types.d.ts +1 -1
- package/{src → dist}/components/inputs/Selection/shared/useSelectItems.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/useSelectItems.js +94 -0
- package/{src → dist}/components/inputs/Slider/Slider.d.ts +2 -2
- package/dist/components/inputs/Slider/Slider.js +137 -0
- package/{src → dist}/components/inputs/TextEditor/TextEditor.d.ts +2 -2
- package/dist/components/inputs/TextEditor/TextEditor.js +223 -0
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +34 -0
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +80 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/HyperlinkAction.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +92 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextAlignSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +56 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextColorSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +33 -0
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +31 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextHighlightSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +37 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextListActions.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +51 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextMarksActions.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +73 -0
- package/{src → dist}/components/inputs/TextEditor/Toolbar/TextStyleSelect.d.ts +1 -1
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +61 -0
- package/dist/components/inputs/TextEditor/textEditor.types.js +40 -0
- package/{src → dist}/components/inputs/Toggle/Toggle.d.ts +3 -3
- package/dist/components/inputs/Toggle/Toggle.js +65 -0
- package/{src → dist}/components/inputs/Toggle/toggle.cva.d.ts +1 -1
- package/dist/components/inputs/Toggle/toggle.cva.js +44 -0
- package/{src → dist}/components/inputs/shared/CheckContent.d.ts +1 -1
- package/dist/components/inputs/shared/CheckContent.js +22 -0
- package/dist/components/inputs/shared/InputClear.js +27 -0
- package/dist/components/inputs/shared/input.cva.js +168 -0
- package/{src → dist}/components/inputs/shared/label.cva.d.ts +1 -1
- package/dist/components/inputs/shared/label.cva.js +133 -0
- package/dist/components/outline.clsx.js +11 -0
- package/{src → dist}/components/overlays/ActionModal/ActionModal.d.ts +2 -2
- package/dist/components/overlays/ActionModal/ActionModal.js +80 -0
- package/dist/components/overlays/BottomSheet/BottomSheet.js +261 -0
- package/dist/components/overlays/Drawer/Drawer.js +84 -0
- package/{src → dist}/components/overlays/Modal/Modal.d.ts +1 -1
- package/dist/components/overlays/Modal/Modal.js +53 -0
- package/dist/components/overlays/Modal/modal.cva.js +53 -0
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +71 -0
- package/{src → dist}/components/overlays/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +70 -0
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +27 -0
- package/dist/components/overlays/Tooltip/tooltip.cva.js +60 -0
- package/dist/components/segment/Segment.js +119 -0
- package/dist/components/segment/SegmentItem.js +43 -0
- package/{src → dist}/components/segment/segment.types.d.ts +1 -1
- package/dist/components/shared/pagination/Pagination.js +75 -0
- package/{src → dist}/components/shared/pagination/PaginationList.d.ts +1 -1
- package/dist/components/shared/pagination/PaginationList.js +145 -0
- package/dist/components/shared/pagination/minWidth.cva.js +15 -0
- package/{src → dist}/components/status/Alert/Alert.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +41 -0
- package/dist/components/status/Alert/alert.cva.js +64 -0
- package/{src → dist}/components/status/Loader/Loader.d.ts +1 -1
- package/dist/components/status/Loader/Loader.js +37 -0
- package/dist/components/status/Loader/loader.cva.js +27 -0
- package/{src → dist}/components/status/Toast/Toast.d.ts +1 -1
- package/dist/components/status/Toast/Toast.js +64 -0
- package/{src → dist}/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/toast.cva.js +150 -0
- package/dist/components/status/Toast/useToast.js +83 -0
- package/dist/components/status/shared/status.cva.js +62 -0
- package/dist/components/table/CellText.js +18 -0
- package/dist/components/table/ColumnConfig.js +124 -0
- package/dist/components/table/HeaderText.js +15 -0
- package/dist/components/table/InfiniteTable.js +40 -0
- package/dist/components/table/PaginatedTable.js +33 -0
- package/dist/components/table/Table.js +370 -0
- package/dist/components/table/table.cva.js +63 -0
- package/{src → dist}/components/text/Link/Link.d.ts +1 -1
- package/dist/components/text/Link/Link.js +18 -0
- package/dist/components/text/Link/link.cva.js +18 -0
- package/{src → dist}/components/text/Tag/Tag.d.ts +1 -1
- package/dist/components/text/Tag/Tag.js +49 -0
- package/dist/components/text/Tag/tag.cva.js +59 -0
- package/{src → dist}/components/text/Typography/Typography.d.ts +1 -1
- package/dist/components/text/Typography/Typography.js +22 -0
- package/dist/components/text/Typography/typography.cva.js +100 -0
- package/{src → dist}/config/confirmation.context.d.ts +1 -1
- package/dist/config/confirmation.context.js +107 -0
- package/dist/config/i18n.js +15 -0
- package/dist/config/router.context.js +43 -0
- package/{src → dist}/config/uiConfig.context.d.ts +8 -8
- package/dist/config/uiConfig.context.js +67 -0
- package/{src → dist}/config/uiStyle.context.d.ts +14 -14
- package/dist/config/uiStyle.context.js +16 -0
- package/dist/helpers/dynamicColumns.js +359 -0
- package/{src → dist}/helpers/dynamicInputs.d.ts +2 -2
- package/dist/helpers/dynamicInputs.js +216 -0
- package/dist/hooks/useAutosave.js +83 -0
- package/dist/hooks/useBreakpoint.js +20 -0
- package/dist/hooks/useDebounceCallback.js +29 -0
- package/dist/hooks/useDeepCompare.js +25 -0
- package/dist/hooks/useFilters.js +120 -0
- package/dist/hooks/useForm.js +22 -0
- package/{src → dist}/hooks/useFormAutosave.d.ts +2 -2
- package/dist/hooks/useFormAutosave.js +67 -0
- package/dist/hooks/useIntersectionObserver.js +27 -0
- package/dist/hooks/useLocalStorage.js +63 -0
- package/dist/hooks/useLongPressRepeat.js +33 -0
- package/dist/hooks/usePagination.js +35 -0
- package/dist/hooks/useScrollableListBox.js +30 -0
- package/dist/hooks/useSorting.js +30 -0
- package/dist/hooks/useStateAndRef.js +17 -0
- package/dist/hooks/useTableColumnConfig.js +63 -0
- package/dist/hooks/useTableNav.js +409 -0
- package/dist/hooks/useTranslationMemo.js +14 -0
- package/dist/index.js +284 -0
- package/{src → dist}/types/react-query.d.ts +1 -1
- package/dist/utils/array.utils.js +12 -0
- package/dist/utils/compoundMapper.js +14 -0
- package/dist/utils/date-time.utils.js +77 -0
- package/dist/utils/date.utils.js +12 -0
- package/dist/utils/dom.utils.js +13 -0
- package/dist/utils/file.utils.js +63 -0
- package/dist/utils/isEqual.js +95 -0
- package/dist/utils/logger.js +19 -0
- package/dist/utils/object.utils.js +53 -0
- package/dist/utils/queries.utils.js +9 -0
- package/dist/utils/rest.utils.js +51 -0
- package/dist/utils/routing.utils.js +15 -0
- package/dist/utils/string.utils.js +12 -0
- package/{src → dist}/utils/vendor/acl/AclGuard.d.ts +1 -1
- package/dist/utils/vendor/acl/AclGuard.js +15 -0
- package/dist/utils/vendor/acl/Can.js +18 -0
- package/dist/utils/vendor/acl/ability.context.js +37 -0
- package/dist/utils/vendor/auth/AuthGuard.js +26 -0
- package/dist/utils/vendor/auth/auth.context.js +36 -0
- package/{src → dist}/utils/vendor/auth/withPrivateAuthGuard.d.ts +1 -1
- package/dist/utils/vendor/auth/withPrivateAuthGuard.js +17 -0
- package/dist/utils/vendor/error-handling.js +119 -0
- package/dist/utils/vendor/rest-interceptor.js +21 -0
- package/dist/utils/zod.utils.js +25 -0
- package/package.json +57 -5
- package/index.js +0 -62585
- package/povio-ui-0.0.8.tgz +0 -0
- package/vite.config.d.ts +0 -2
- /package/{src → dist}/assets/icons/AlignCenter.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignLeftRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/AlignRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowDropDown.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowDropUp.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ArrowRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/Bold.d.ts +0 -0
- /package/{src → dist}/assets/icons/BulletedList.d.ts +0 -0
- /package/{src → dist}/assets/icons/Calendar.d.ts +0 -0
- /package/{src → dist}/assets/icons/Check.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckCircle.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckboxCheckmark.d.ts +0 -0
- /package/{src → dist}/assets/icons/CheckboxIndeterminate.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronDown.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronUp.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronsLeft.d.ts +0 -0
- /package/{src → dist}/assets/icons/ChevronsRight.d.ts +0 -0
- /package/{src → dist}/assets/icons/Clock.d.ts +0 -0
- /package/{src → dist}/assets/icons/Close.d.ts +0 -0
- /package/{src → dist}/assets/icons/DateTime.d.ts +0 -0
- /package/{src → dist}/assets/icons/Drag.d.ts +0 -0
- /package/{src → dist}/assets/icons/File.d.ts +0 -0
- /package/{src → dist}/assets/icons/Highlight.d.ts +0 -0
- /package/{src → dist}/assets/icons/HighlightOn.d.ts +0 -0
- /package/{src → dist}/assets/icons/Info.d.ts +0 -0
- /package/{src → dist}/assets/icons/Italic.d.ts +0 -0
- /package/{src → dist}/assets/icons/Link.d.ts +0 -0
- /package/{src → dist}/assets/icons/Menu.d.ts +0 -0
- /package/{src → dist}/assets/icons/NumberedList.d.ts +0 -0
- /package/{src → dist}/assets/icons/PointerHorizontal.d.ts +0 -0
- /package/{src → dist}/assets/icons/PointerVertical.d.ts +0 -0
- /package/{src → dist}/assets/icons/Send.d.ts +0 -0
- /package/{src → dist}/assets/icons/Strikethrough.d.ts +0 -0
- /package/{src → dist}/assets/icons/TextColor.d.ts +0 -0
- /package/{src → dist}/assets/icons/Today.d.ts +0 -0
- /package/{src → dist}/assets/icons/Underlined.d.ts +0 -0
- /package/{src → dist}/assets/icons/Upload.d.ts +0 -0
- /package/{src → dist}/assets/icons/View.d.ts +0 -0
- /package/{src → dist}/assets/icons/ViewOff.d.ts +0 -0
- /package/{src → dist}/assets/icons/WarningFilled.d.ts +0 -0
- /package/{src → dist}/components/Menu/Menu.d.ts +0 -0
- /package/{src → dist}/components/buttons/shared/buttonContent.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/Calendar.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarCell.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarGrid.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/CalendarSelectHeader.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateField.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateTimeDialog.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/DateTimeDialogFooter.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/MonthPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/RangeCalendar.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/TimeField.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/TimePickerForm.d.ts +0 -0
- /package/{src → dist}/components/inputs/DateTime/shared/YearPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/FileUpload.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/FileUploadContainer.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/InputUpload.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/index.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/FileProgressBar.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/InputUploadFilled.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/fileUpload.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/File/shared/inputUploadButton.cva.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldError.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldHeader.d.ts +0 -0
- /package/{src → dist}/components/inputs/FormField/FormFieldHeaderClose.d.ts +0 -0
- /package/{src → dist}/components/inputs/Inputs/Inputs.d.ts +0 -0
- /package/{src → dist}/components/inputs/Selection/shared/SelectListBoxSelectionBar.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/ColorPicker.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/Toolbar/TextEditorToolbar.d.ts +0 -0
- /package/{src → dist}/components/inputs/TextEditor/textEditor.types.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/InputClear.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/form.types.d.ts +0 -0
- /package/{src → dist}/components/inputs/shared/input.cva.d.ts +0 -0
- /package/{src → dist}/components/outline.clsx.d.ts +0 -0
- /package/{src → dist}/components/overlays/BottomSheet/BottomSheet.d.ts +0 -0
- /package/{src → dist}/components/overlays/Drawer/Drawer.d.ts +0 -0
- /package/{src → dist}/components/overlays/Modal/modal.cva.d.ts +0 -0
- /package/{src → dist}/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +0 -0
- /package/{src → dist}/components/overlays/Tooltip/TooltipEllipsis.d.ts +0 -0
- /package/{src → dist}/components/overlays/Tooltip/tooltip.cva.d.ts +0 -0
- /package/{src → dist}/components/segment/Segment.d.ts +0 -0
- /package/{src → dist}/components/segment/SegmentItem.d.ts +0 -0
- /package/{src → dist}/components/shared/pagination/Pagination.d.ts +0 -0
- /package/{src → dist}/components/shared/pagination/minWidth.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Alert/alert.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Loader/loader.cva.d.ts +0 -0
- /package/{src → dist}/components/status/Toast/useToast.d.ts +0 -0
- /package/{src → dist}/components/status/shared/status.cva.d.ts +0 -0
- /package/{src → dist}/components/table/CellText.d.ts +0 -0
- /package/{src → dist}/components/table/ColumnConfig.d.ts +0 -0
- /package/{src → dist}/components/table/HeaderText.d.ts +0 -0
- /package/{src → dist}/components/table/InfiniteTable.d.ts +0 -0
- /package/{src → dist}/components/table/PaginatedTable.d.ts +0 -0
- /package/{src → dist}/components/table/Table.d.ts +0 -0
- /package/{src → dist}/components/table/table.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Link/link.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Tag/tag.cva.d.ts +0 -0
- /package/{src → dist}/components/text/Typography/typography.cva.d.ts +0 -0
- /package/{src → dist}/config/i18n.d.ts +0 -0
- /package/{src → dist}/config/router.context.d.ts +0 -0
- /package/{src → dist}/helpers/dynamicColumns.d.ts +0 -0
- /package/{src → dist}/hooks/useAutosave.d.ts +0 -0
- /package/{src → dist}/hooks/useBreakpoint.d.ts +0 -0
- /package/{src → dist}/hooks/useDebounceCallback.d.ts +0 -0
- /package/{src → dist}/hooks/useDeepCompare.d.ts +0 -0
- /package/{src → dist}/hooks/useFilters.d.ts +0 -0
- /package/{src → dist}/hooks/useForm.d.ts +0 -0
- /package/{src → dist}/hooks/useIntersectionObserver.d.ts +0 -0
- /package/{src → dist}/hooks/useLocalStorage.d.ts +0 -0
- /package/{src → dist}/hooks/useLongPressRepeat.d.ts +0 -0
- /package/{src → dist}/hooks/usePagination.d.ts +0 -0
- /package/{src → dist}/hooks/useScrollableListBox.d.ts +0 -0
- /package/{src → dist}/hooks/useSorting.d.ts +0 -0
- /package/{src → dist}/hooks/useStateAndRef.d.ts +0 -0
- /package/{src → dist}/hooks/useTableColumnConfig.d.ts +0 -0
- /package/{src → dist}/hooks/useTableNav.d.ts +0 -0
- /package/{src → dist}/hooks/useTranslationMemo.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{styles → dist/styles}/editor.css +0 -0
- /package/{styles → dist/styles}/index.css +0 -0
- /package/{src → dist}/types/common.d.ts +0 -0
- /package/{src → dist}/utils/array.utils.d.ts +0 -0
- /package/{src → dist}/utils/array.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/compoundMapper.d.ts +0 -0
- /package/{src → dist}/utils/compoundMapper.spec.d.ts +0 -0
- /package/{src → dist}/utils/date-time.utils.d.ts +0 -0
- /package/{src → dist}/utils/date-time.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/date.utils.d.ts +0 -0
- /package/{src → dist}/utils/date.utils.spec.d.ts +0 -0
- /package/{src → dist}/utils/dom.utils.d.ts +0 -0
- /package/{src → dist}/utils/file.utils.d.ts +0 -0
- /package/{src → dist}/utils/isEqual.d.ts +0 -0
- /package/{src → dist}/utils/logger.d.ts +0 -0
- /package/{src → dist}/utils/object.utils.d.ts +0 -0
- /package/{src → dist}/utils/queries.utils.d.ts +0 -0
- /package/{src → dist}/utils/rest.utils.d.ts +0 -0
- /package/{src → dist}/utils/routing.utils.d.ts +0 -0
- /package/{src → dist}/utils/string.utils.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/Can.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/ability.context.d.ts +0 -0
- /package/{src → dist}/utils/vendor/acl/appAbility.types.d.ts +0 -0
- /package/{src → dist}/utils/vendor/auth/AuthGuard.d.ts +0 -0
- /package/{src → dist}/utils/vendor/auth/auth.context.d.ts +0 -0
- /package/{src → dist}/utils/vendor/error-handling.d.ts +0 -0
- /package/{src → dist}/utils/vendor/rest-client.types.d.ts +0 -0
- /package/{src → dist}/utils/vendor/rest-interceptor.d.ts +0 -0
- /package/{src → dist}/utils/zod.utils.d.ts +0 -0
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { toCalendarDate, createCalendar, today, getLocalTimeZone, startOfYear, endOfYear, CalendarDate, startOfWeek, endOfWeek, startOfMonth, endOfMonth } from "@internationalized/date";
|
|
3
|
+
import { mergeRefs } from "@react-aria/utils";
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { DateTime } from "luxon";
|
|
6
|
+
import { useState, useCallback, useRef } from "react";
|
|
7
|
+
import { useDateRangePicker, useLocale } from "react-aria";
|
|
8
|
+
import { Button } from "react-aria-components";
|
|
9
|
+
import { Controller } from "react-hook-form";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
12
|
+
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
13
|
+
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
14
|
+
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
15
|
+
import { RangeCalendar } from "../shared/RangeCalendar.js";
|
|
16
|
+
import { FormField } from "../../FormField/FormField.js";
|
|
17
|
+
import { Typography } from "../../../text/Typography/Typography.js";
|
|
18
|
+
import { ns } from "../../../../config/i18n.js";
|
|
19
|
+
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
20
|
+
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
21
|
+
const PLACEHOLDER_VALUE = new CalendarDate(2024, 1, 1);
|
|
22
|
+
const DateRangePickerBase = (props) => {
|
|
23
|
+
const ui = UIConfig.useConfig();
|
|
24
|
+
const { t } = useTranslation();
|
|
25
|
+
const {
|
|
26
|
+
ref,
|
|
27
|
+
label,
|
|
28
|
+
tooltipText,
|
|
29
|
+
helperText,
|
|
30
|
+
isRequired,
|
|
31
|
+
rightContent,
|
|
32
|
+
isDisabled,
|
|
33
|
+
headerClassName,
|
|
34
|
+
errorClassName,
|
|
35
|
+
isHeaderHidden,
|
|
36
|
+
error,
|
|
37
|
+
onChange,
|
|
38
|
+
value,
|
|
39
|
+
disableDropdown,
|
|
40
|
+
className,
|
|
41
|
+
hideSidebar,
|
|
42
|
+
hideLabel = ui.input.hideLabel,
|
|
43
|
+
variant = ui.input.variant,
|
|
44
|
+
as = ui.input.as,
|
|
45
|
+
size = ui.input.size,
|
|
46
|
+
isClearable = ui.input.isClearable,
|
|
47
|
+
todayIcon = ui.dateInput.todayIcon,
|
|
48
|
+
shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros,
|
|
49
|
+
...rest
|
|
50
|
+
} = props;
|
|
51
|
+
const [validationRangeError, setValidationRangeError] = useState();
|
|
52
|
+
const dialogState = useDateRangePickerState({ ...rest, value, shouldCloseOnSelect: false, shouldForceLeadingZeros });
|
|
53
|
+
const state = useDateRangePickerState({
|
|
54
|
+
...rest,
|
|
55
|
+
shouldForceLeadingZeros,
|
|
56
|
+
value,
|
|
57
|
+
onChange: (newValue) => {
|
|
58
|
+
if (isValidRange(newValue)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
onChange?.(newValue);
|
|
62
|
+
handleCalendarStatesChange(newValue);
|
|
63
|
+
},
|
|
64
|
+
shouldCloseOnSelect: false
|
|
65
|
+
});
|
|
66
|
+
const dateRangePickerRef = useRef(null);
|
|
67
|
+
const { groupProps, labelProps, startFieldProps, endFieldProps, buttonProps, dialogProps } = useDateRangePicker(
|
|
68
|
+
{ ...rest, label, shouldForceLeadingZeros },
|
|
69
|
+
state,
|
|
70
|
+
dateRangePickerRef
|
|
71
|
+
);
|
|
72
|
+
const { calendarProps } = useDateRangePicker(
|
|
73
|
+
{ ...rest, label, shouldForceLeadingZeros },
|
|
74
|
+
dialogState,
|
|
75
|
+
dateRangePickerRef
|
|
76
|
+
);
|
|
77
|
+
const { locale } = useLocale();
|
|
78
|
+
const formFieldProps = {
|
|
79
|
+
error: error || validationRangeError,
|
|
80
|
+
label,
|
|
81
|
+
tooltipText,
|
|
82
|
+
helperText,
|
|
83
|
+
isRequired,
|
|
84
|
+
rightContent,
|
|
85
|
+
isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
|
|
86
|
+
hideLabel,
|
|
87
|
+
isDisabled,
|
|
88
|
+
headerClassName,
|
|
89
|
+
errorClassName
|
|
90
|
+
};
|
|
91
|
+
const leftCalendarState = useRangeCalendarState({
|
|
92
|
+
...calendarProps,
|
|
93
|
+
locale,
|
|
94
|
+
createCalendar,
|
|
95
|
+
pageBehavior: "single",
|
|
96
|
+
visibleDuration: { months: 1 },
|
|
97
|
+
minValue: void 0,
|
|
98
|
+
maxValue: void 0
|
|
99
|
+
});
|
|
100
|
+
const rightCalendarState = useRangeCalendarState({
|
|
101
|
+
...calendarProps,
|
|
102
|
+
locale,
|
|
103
|
+
createCalendar,
|
|
104
|
+
pageBehavior: "single",
|
|
105
|
+
visibleDuration: { months: 1 },
|
|
106
|
+
defaultFocusedValue: today(getLocalTimeZone()).add({ months: 1 }),
|
|
107
|
+
minValue: void 0,
|
|
108
|
+
maxValue: void 0
|
|
109
|
+
});
|
|
110
|
+
const [activePreset, setActivePreset] = useState(null);
|
|
111
|
+
const [rangeSelection, setRangeSelection] = useState({
|
|
112
|
+
start: value?.start || null,
|
|
113
|
+
end: value?.end || null,
|
|
114
|
+
isSelecting: false
|
|
115
|
+
});
|
|
116
|
+
const [hoverDate, setHoverDate] = useState(null);
|
|
117
|
+
const headerProps = {
|
|
118
|
+
label,
|
|
119
|
+
tooltipText,
|
|
120
|
+
helperText,
|
|
121
|
+
isRequired,
|
|
122
|
+
rightContent,
|
|
123
|
+
isHeaderHidden: hideLabel || isHeaderHidden,
|
|
124
|
+
isDisabled,
|
|
125
|
+
className: headerClassName,
|
|
126
|
+
labelProps
|
|
127
|
+
};
|
|
128
|
+
const isValidRange = useCallback(
|
|
129
|
+
(newValue) => {
|
|
130
|
+
if (newValue?.start && newValue?.end) {
|
|
131
|
+
const startDate = newValue.start;
|
|
132
|
+
const endDate = newValue.end;
|
|
133
|
+
if (endDate.compare(startDate) < 0) {
|
|
134
|
+
setValidationRangeError(
|
|
135
|
+
t(($) => $.ui.datePicker.errors.endDateBeforeStart, {
|
|
136
|
+
ns
|
|
137
|
+
})
|
|
138
|
+
);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
setValidationRangeError(void 0);
|
|
142
|
+
} else {
|
|
143
|
+
setValidationRangeError(void 0);
|
|
144
|
+
}
|
|
145
|
+
return false;
|
|
146
|
+
},
|
|
147
|
+
[t]
|
|
148
|
+
);
|
|
149
|
+
const handleCalendarStatesChange = (newValue) => {
|
|
150
|
+
if (newValue) {
|
|
151
|
+
if (isValidRange(newValue)) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
dialogState.setValue(newValue);
|
|
155
|
+
const startDate = newValue.start;
|
|
156
|
+
const endDate = newValue.end;
|
|
157
|
+
leftCalendarState.setFocusedDate(startDate);
|
|
158
|
+
if (startDate.year === endDate.year && startDate.month === endDate.month) {
|
|
159
|
+
rightCalendarState.setFocusedDate(startDate.add({ months: 1 }));
|
|
160
|
+
} else {
|
|
161
|
+
rightCalendarState.setFocusedDate(endDate);
|
|
162
|
+
}
|
|
163
|
+
leftCalendarState.setValue(newValue);
|
|
164
|
+
rightCalendarState.setValue(newValue);
|
|
165
|
+
setRangeSelection({
|
|
166
|
+
start: newValue.start,
|
|
167
|
+
end: newValue.end,
|
|
168
|
+
isSelecting: false
|
|
169
|
+
});
|
|
170
|
+
setHoverDate(null);
|
|
171
|
+
setActivePreset(null);
|
|
172
|
+
} else {
|
|
173
|
+
setValidationRangeError(void 0);
|
|
174
|
+
dialogState.setValue(null);
|
|
175
|
+
leftCalendarState.setValue(null);
|
|
176
|
+
rightCalendarState.setValue(null);
|
|
177
|
+
setRangeSelection({
|
|
178
|
+
start: null,
|
|
179
|
+
end: null,
|
|
180
|
+
isSelecting: false
|
|
181
|
+
});
|
|
182
|
+
setHoverDate(null);
|
|
183
|
+
setActivePreset(null);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const throttledSetHoverDate = useCallback((date) => {
|
|
187
|
+
requestAnimationFrame(() => {
|
|
188
|
+
setHoverDate(date);
|
|
189
|
+
});
|
|
190
|
+
}, []);
|
|
191
|
+
const handleDateHover = useCallback(
|
|
192
|
+
(date) => {
|
|
193
|
+
if (rangeSelection.isSelecting && rangeSelection.start) {
|
|
194
|
+
throttledSetHoverDate(date);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
[rangeSelection.isSelecting, rangeSelection.start, throttledSetHoverDate]
|
|
198
|
+
);
|
|
199
|
+
const handleDateSelection = useCallback(
|
|
200
|
+
(date, calendarSide) => {
|
|
201
|
+
if (calendarSide) {
|
|
202
|
+
const currentState = calendarSide === "left" ? leftCalendarState : rightCalendarState;
|
|
203
|
+
const currentVisibleMonth = currentState.visibleRange.start;
|
|
204
|
+
if (date.month !== currentVisibleMonth.month || date.year !== currentVisibleMonth.year) {
|
|
205
|
+
if (calendarSide === "left") {
|
|
206
|
+
leftCalendarState.setFocusedDate(date);
|
|
207
|
+
rightCalendarState.setFocusedDate(date.add({ months: 1 }));
|
|
208
|
+
} else {
|
|
209
|
+
rightCalendarState.setFocusedDate(date);
|
|
210
|
+
leftCalendarState.setFocusedDate(date.subtract({ months: 1 }));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
215
|
+
setRangeSelection({
|
|
216
|
+
start: date,
|
|
217
|
+
end: null,
|
|
218
|
+
isSelecting: true
|
|
219
|
+
});
|
|
220
|
+
setHoverDate(null);
|
|
221
|
+
leftCalendarState.setValue(null);
|
|
222
|
+
rightCalendarState.setValue(null);
|
|
223
|
+
} else {
|
|
224
|
+
const { start } = rangeSelection;
|
|
225
|
+
const end = date;
|
|
226
|
+
const finalStart = start.compare(end) <= 0 ? start : end;
|
|
227
|
+
const finalEnd = start.compare(end) <= 0 ? end : start;
|
|
228
|
+
const newRange = { start: finalStart, end: finalEnd };
|
|
229
|
+
leftCalendarState.setValue(newRange);
|
|
230
|
+
rightCalendarState.setValue(newRange);
|
|
231
|
+
dialogState.setValue(newRange);
|
|
232
|
+
setRangeSelection({
|
|
233
|
+
start: finalStart,
|
|
234
|
+
end: finalEnd,
|
|
235
|
+
isSelecting: false
|
|
236
|
+
});
|
|
237
|
+
setHoverDate(null);
|
|
238
|
+
setActivePreset(null);
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
[rangeSelection, leftCalendarState, rightCalendarState, dialogState]
|
|
242
|
+
);
|
|
243
|
+
const handleKeyboardNavigation = useCallback(
|
|
244
|
+
(event, date, calendarSide) => {
|
|
245
|
+
const currentState = calendarSide === "left" ? leftCalendarState : rightCalendarState;
|
|
246
|
+
const otherState = calendarSide === "left" ? rightCalendarState : leftCalendarState;
|
|
247
|
+
let shouldPreventDefault = false;
|
|
248
|
+
switch (event.key) {
|
|
249
|
+
case "ArrowRight": {
|
|
250
|
+
const nextDate = date.add({ days: 1 });
|
|
251
|
+
const currentMonth = currentState.visibleRange.start;
|
|
252
|
+
const otherMonth = otherState.visibleRange.start;
|
|
253
|
+
if (calendarSide === "left" && nextDate.month !== currentMonth.month) {
|
|
254
|
+
if (nextDate.year === otherMonth.year && nextDate.month === otherMonth.month) {
|
|
255
|
+
otherState.setFocusedDate(nextDate);
|
|
256
|
+
shouldPreventDefault = true;
|
|
257
|
+
} else {
|
|
258
|
+
rightCalendarState.setFocusedDate(nextDate);
|
|
259
|
+
shouldPreventDefault = true;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
case "ArrowLeft": {
|
|
265
|
+
const prevDate = date.subtract({ days: 1 });
|
|
266
|
+
const currentMonth = currentState.visibleRange.start;
|
|
267
|
+
const otherMonth = otherState.visibleRange.start;
|
|
268
|
+
if (calendarSide === "right" && prevDate.month !== currentMonth.month) {
|
|
269
|
+
if (prevDate.year === otherMonth.year && prevDate.month === otherMonth.month) {
|
|
270
|
+
otherState.setFocusedDate(prevDate);
|
|
271
|
+
shouldPreventDefault = true;
|
|
272
|
+
} else {
|
|
273
|
+
leftCalendarState.setFocusedDate(prevDate);
|
|
274
|
+
shouldPreventDefault = true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case "ArrowDown": {
|
|
280
|
+
const nextWeekDate = date.add({ weeks: 1 });
|
|
281
|
+
const currentMonth = currentState.visibleRange.start;
|
|
282
|
+
const otherMonth = otherState.visibleRange.start;
|
|
283
|
+
if (calendarSide === "left" && nextWeekDate.month !== currentMonth.month) {
|
|
284
|
+
if (nextWeekDate.year === otherMonth.year && nextWeekDate.month === otherMonth.month) {
|
|
285
|
+
otherState.setFocusedDate(nextWeekDate);
|
|
286
|
+
shouldPreventDefault = true;
|
|
287
|
+
} else {
|
|
288
|
+
rightCalendarState.setFocusedDate(nextWeekDate);
|
|
289
|
+
shouldPreventDefault = true;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case "ArrowUp": {
|
|
295
|
+
const prevWeekDate = date.subtract({ weeks: 1 });
|
|
296
|
+
const currentMonth = currentState.visibleRange.start;
|
|
297
|
+
const otherMonth = otherState.visibleRange.start;
|
|
298
|
+
if (calendarSide === "right" && prevWeekDate.month !== currentMonth.month) {
|
|
299
|
+
if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
300
|
+
otherState.setFocusedDate(prevWeekDate);
|
|
301
|
+
shouldPreventDefault = true;
|
|
302
|
+
} else {
|
|
303
|
+
leftCalendarState.setFocusedDate(prevWeekDate);
|
|
304
|
+
shouldPreventDefault = true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
case "Enter":
|
|
310
|
+
case " ": {
|
|
311
|
+
handleDateSelection(date);
|
|
312
|
+
shouldPreventDefault = true;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
case "Escape": {
|
|
316
|
+
setRangeSelection({
|
|
317
|
+
start: null,
|
|
318
|
+
end: null,
|
|
319
|
+
isSelecting: false
|
|
320
|
+
});
|
|
321
|
+
setHoverDate(null);
|
|
322
|
+
shouldPreventDefault = true;
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (shouldPreventDefault) {
|
|
327
|
+
event.preventDefault();
|
|
328
|
+
event.stopPropagation();
|
|
329
|
+
}
|
|
330
|
+
return shouldPreventDefault;
|
|
331
|
+
},
|
|
332
|
+
[leftCalendarState, rightCalendarState, handleDateSelection]
|
|
333
|
+
);
|
|
334
|
+
const syncCalendarStates = useCallback(
|
|
335
|
+
(newValue) => {
|
|
336
|
+
if (isValidRange(newValue)) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
leftCalendarState.setValue(newValue);
|
|
340
|
+
rightCalendarState.setValue(newValue);
|
|
341
|
+
dialogState.setValue(newValue);
|
|
342
|
+
if (newValue) {
|
|
343
|
+
setRangeSelection({
|
|
344
|
+
start: newValue.start,
|
|
345
|
+
end: newValue.end,
|
|
346
|
+
isSelecting: false
|
|
347
|
+
});
|
|
348
|
+
} else {
|
|
349
|
+
setRangeSelection({
|
|
350
|
+
start: null,
|
|
351
|
+
end: null,
|
|
352
|
+
isSelecting: false
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
setHoverDate(null);
|
|
356
|
+
},
|
|
357
|
+
[isValidRange, leftCalendarState, rightCalendarState, dialogState]
|
|
358
|
+
);
|
|
359
|
+
const onApply = () => {
|
|
360
|
+
const valueToApply = rangeSelection.start && rangeSelection.end ? { start: rangeSelection.start, end: rangeSelection.end } : dialogState.value;
|
|
361
|
+
if (valueToApply) {
|
|
362
|
+
state.setValue(valueToApply);
|
|
363
|
+
}
|
|
364
|
+
state.toggle();
|
|
365
|
+
};
|
|
366
|
+
const onTodayPress = () => {
|
|
367
|
+
const todayDate2 = today(getLocalTimeZone());
|
|
368
|
+
leftCalendarState.setFocusedDate(todayDate2);
|
|
369
|
+
rightCalendarState.setFocusedDate(todayDate2.add({ months: 1 }));
|
|
370
|
+
};
|
|
371
|
+
const onOpenChange = (isOpen) => {
|
|
372
|
+
state.toggle();
|
|
373
|
+
if (!isOpen) {
|
|
374
|
+
if (state.value) {
|
|
375
|
+
dialogState.setValue(state.value);
|
|
376
|
+
leftCalendarState.setValue(state.value);
|
|
377
|
+
rightCalendarState.setValue(state.value);
|
|
378
|
+
const startDate = state.value.start || today(getLocalTimeZone());
|
|
379
|
+
const endDate = state.value.end || today(getLocalTimeZone()).add({ months: 1 });
|
|
380
|
+
leftCalendarState.setFocusedDate(startDate);
|
|
381
|
+
if (startDate.year === endDate.year && startDate.month === endDate.month) {
|
|
382
|
+
rightCalendarState.setFocusedDate(startDate.add({ months: 1 }));
|
|
383
|
+
} else {
|
|
384
|
+
rightCalendarState.setFocusedDate(endDate);
|
|
385
|
+
}
|
|
386
|
+
setRangeSelection({
|
|
387
|
+
start: state.value.start,
|
|
388
|
+
end: state.value.end,
|
|
389
|
+
isSelecting: false
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
const todayDate = today(getLocalTimeZone());
|
|
395
|
+
const getThisWeekRange = () => {
|
|
396
|
+
const start = startOfWeek(todayDate, locale);
|
|
397
|
+
const end = endOfWeek(todayDate, locale);
|
|
398
|
+
return { start, end };
|
|
399
|
+
};
|
|
400
|
+
const getLastWeekRange = () => {
|
|
401
|
+
const thisWeekStart = startOfWeek(todayDate, locale);
|
|
402
|
+
const lastWeekStart = thisWeekStart.subtract({ weeks: 1 });
|
|
403
|
+
const lastWeekEnd = thisWeekStart.subtract({ days: 1 });
|
|
404
|
+
return { start: lastWeekStart, end: lastWeekEnd };
|
|
405
|
+
};
|
|
406
|
+
const getThisAndLastWeekRange = () => {
|
|
407
|
+
const thisWeekEnd = endOfWeek(todayDate, locale);
|
|
408
|
+
const lastWeekStart = startOfWeek(todayDate, locale).subtract({ weeks: 1 });
|
|
409
|
+
return { start: lastWeekStart, end: thisWeekEnd };
|
|
410
|
+
};
|
|
411
|
+
const getThisMonthRange = () => {
|
|
412
|
+
const start = startOfMonth(todayDate);
|
|
413
|
+
const end = endOfMonth(todayDate);
|
|
414
|
+
return { start, end };
|
|
415
|
+
};
|
|
416
|
+
const getThisAndLastMonthRange = () => {
|
|
417
|
+
const thisMonthEnd = endOfMonth(todayDate);
|
|
418
|
+
const lastMonthStart = startOfMonth(todayDate).subtract({ months: 1 });
|
|
419
|
+
return { start: lastMonthStart, end: thisMonthEnd };
|
|
420
|
+
};
|
|
421
|
+
const presets = [
|
|
422
|
+
{
|
|
423
|
+
label: t(($) => $.ui.datePicker.presets.thisWeek, {
|
|
424
|
+
ns
|
|
425
|
+
}),
|
|
426
|
+
getValue: getThisWeekRange
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
label: t(($) => $.ui.datePicker.presets.lastWeek, {
|
|
430
|
+
ns
|
|
431
|
+
}),
|
|
432
|
+
getValue: getLastWeekRange
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
label: t(($) => $.ui.datePicker.presets.thisAndLastWeek, {
|
|
436
|
+
ns
|
|
437
|
+
}),
|
|
438
|
+
getValue: getThisAndLastWeekRange
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
label: t(($) => $.ui.datePicker.presets.thisMonth, {
|
|
442
|
+
ns
|
|
443
|
+
}),
|
|
444
|
+
getValue: getThisMonthRange
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
label: t(($) => $.ui.datePicker.presets.thisAndLastMonth, {
|
|
448
|
+
ns
|
|
449
|
+
}),
|
|
450
|
+
getValue: getThisAndLastMonthRange
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
label: t(($) => $.ui.datePicker.presets.thisYear, {
|
|
454
|
+
ns
|
|
455
|
+
}),
|
|
456
|
+
getValue: () => ({ start: startOfYear(todayDate), end: todayDate })
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
label: t(($) => $.ui.datePicker.presets.lastYear, {
|
|
460
|
+
ns
|
|
461
|
+
}),
|
|
462
|
+
getValue: () => ({
|
|
463
|
+
start: startOfYear(todayDate.subtract({ years: 1 })),
|
|
464
|
+
end: endOfYear(todayDate.subtract({ years: 1 }))
|
|
465
|
+
})
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
label: t(($) => $.ui.datePicker.presets.thisAndLastYear, {
|
|
469
|
+
ns
|
|
470
|
+
}),
|
|
471
|
+
getValue: () => ({ start: startOfYear(todayDate.subtract({ years: 1 })), end: todayDate })
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
label: t(($) => $.ui.datePicker.presets.soFar, {
|
|
475
|
+
ns
|
|
476
|
+
}),
|
|
477
|
+
getValue: () => ({ start: startOfYear(todayDate), end: todayDate })
|
|
478
|
+
}
|
|
479
|
+
];
|
|
480
|
+
const selectPreset = (preset) => {
|
|
481
|
+
setActivePreset(preset.label);
|
|
482
|
+
const presetValue = preset.getValue();
|
|
483
|
+
syncCalendarStates(presetValue);
|
|
484
|
+
const startDate = presetValue.start;
|
|
485
|
+
leftCalendarState.setFocusedDate(startDate);
|
|
486
|
+
const endDate = presetValue.end;
|
|
487
|
+
const monthsDifference = (endDate.year - startDate.year) * 12 + (endDate.month - startDate.month);
|
|
488
|
+
if (monthsDifference > 2) {
|
|
489
|
+
rightCalendarState.setFocusedDate(endDate);
|
|
490
|
+
} else {
|
|
491
|
+
const rightCalendarMonth = startDate.add({ months: 1 });
|
|
492
|
+
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
return /* @__PURE__ */ jsxs(
|
|
496
|
+
FormField,
|
|
497
|
+
{
|
|
498
|
+
...formFieldProps,
|
|
499
|
+
as,
|
|
500
|
+
labelProps,
|
|
501
|
+
className: clsx("relative inline-flex w-full flex-col text-left", className),
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ jsx(
|
|
504
|
+
DatePickerInput,
|
|
505
|
+
{
|
|
506
|
+
ref: mergeRefs(ref, dateRangePickerRef),
|
|
507
|
+
as,
|
|
508
|
+
groupProps,
|
|
509
|
+
fieldProps: { ...startFieldProps, placeholderValue: PLACEHOLDER_VALUE },
|
|
510
|
+
endFieldProps: { ...endFieldProps, placeholderValue: PLACEHOLDER_VALUE },
|
|
511
|
+
buttonProps,
|
|
512
|
+
isDisabled,
|
|
513
|
+
isInvalid: !!error,
|
|
514
|
+
disableDropdown,
|
|
515
|
+
variant,
|
|
516
|
+
size,
|
|
517
|
+
isClearable,
|
|
518
|
+
headerProps,
|
|
519
|
+
todayIcon
|
|
520
|
+
}
|
|
521
|
+
),
|
|
522
|
+
/* @__PURE__ */ jsx(
|
|
523
|
+
DateTimeDialog,
|
|
524
|
+
{
|
|
525
|
+
hideSidebar,
|
|
526
|
+
sidebar: /* @__PURE__ */ jsx("div", { 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", children: presets.map((preset) => /* @__PURE__ */ jsx(
|
|
527
|
+
Button,
|
|
528
|
+
{
|
|
529
|
+
onClick: () => selectPreset(preset),
|
|
530
|
+
className: clsx(
|
|
531
|
+
"w-full px-2 py-1 text-left md:px-list-side-item md:py-list-height-item",
|
|
532
|
+
activePreset !== preset.label && "text-interactive-text-secondary-idle hover:text-interactive-text-secondary-hover",
|
|
533
|
+
activePreset === preset.label && "bg-interactive-contained-primary-idle text-interactive-text-secondary-idle-inverted"
|
|
534
|
+
),
|
|
535
|
+
children: /* @__PURE__ */ jsx(
|
|
536
|
+
Typography,
|
|
537
|
+
{
|
|
538
|
+
size: "label-2",
|
|
539
|
+
sizeMobile: "label-3",
|
|
540
|
+
as: "span",
|
|
541
|
+
className: "whitespace-nowrap",
|
|
542
|
+
children: preset.label
|
|
543
|
+
}
|
|
544
|
+
)
|
|
545
|
+
},
|
|
546
|
+
preset.label
|
|
547
|
+
)) }),
|
|
548
|
+
footer: /* @__PURE__ */ jsx(
|
|
549
|
+
DateTimeDialogFooter,
|
|
550
|
+
{
|
|
551
|
+
isValid: !dialogState.isInvalid && !!dialogState.value,
|
|
552
|
+
onTodayPress,
|
|
553
|
+
onApply
|
|
554
|
+
}
|
|
555
|
+
),
|
|
556
|
+
label,
|
|
557
|
+
triggerRef: dateRangePickerRef,
|
|
558
|
+
dialogProps,
|
|
559
|
+
isOpen: state.isOpen,
|
|
560
|
+
onOpenChange,
|
|
561
|
+
children: /* @__PURE__ */ jsx("div", { className: "mb-4 flex max-w-[804px] md:mb-0", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ jsx(
|
|
562
|
+
RangeCalendar,
|
|
563
|
+
{
|
|
564
|
+
leftCalendarState,
|
|
565
|
+
rightCalendarState,
|
|
566
|
+
calendarProps,
|
|
567
|
+
onApply,
|
|
568
|
+
onRangeChange: syncCalendarStates,
|
|
569
|
+
onDateSelection: handleDateSelection,
|
|
570
|
+
onDateHover: handleDateHover,
|
|
571
|
+
rangeSelection,
|
|
572
|
+
hoverDate,
|
|
573
|
+
onKeyboardNavigation: handleKeyboardNavigation
|
|
574
|
+
}
|
|
575
|
+
) }) })
|
|
576
|
+
}
|
|
577
|
+
)
|
|
578
|
+
]
|
|
579
|
+
}
|
|
580
|
+
);
|
|
581
|
+
};
|
|
582
|
+
const DateRangePicker = ({
|
|
583
|
+
fullIso = true,
|
|
584
|
+
minValue,
|
|
585
|
+
maxValue,
|
|
586
|
+
...props
|
|
587
|
+
}) => {
|
|
588
|
+
const formatDateRange = (range) => {
|
|
589
|
+
if (!range?.start || !range?.end) {
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
if (fullIso) {
|
|
593
|
+
return {
|
|
594
|
+
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
595
|
+
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start);
|
|
599
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end);
|
|
600
|
+
return {
|
|
601
|
+
start: DateTime.fromJSDate(startDate).toISODate(),
|
|
602
|
+
end: DateTime.fromJSDate(endDate).toISODate()
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
const parseDateRange = (formattedRange) => {
|
|
606
|
+
if (!formattedRange?.start || !formattedRange?.end) {
|
|
607
|
+
return formattedRange;
|
|
608
|
+
}
|
|
609
|
+
if (fullIso) {
|
|
610
|
+
return {
|
|
611
|
+
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
612
|
+
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
const startDate = DateTime.fromISO(formattedRange.start).toJSDate();
|
|
616
|
+
const endDate = DateTime.fromISO(formattedRange.end).toJSDate();
|
|
617
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate);
|
|
618
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate);
|
|
619
|
+
return {
|
|
620
|
+
start: toCalendarDate(startZonedDateTime),
|
|
621
|
+
end: toCalendarDate(endZonedDateTime)
|
|
622
|
+
};
|
|
623
|
+
};
|
|
624
|
+
const parseCalendarDate = (formattedDate) => {
|
|
625
|
+
if (formattedDate == null) {
|
|
626
|
+
return formattedDate;
|
|
627
|
+
}
|
|
628
|
+
if (fullIso) {
|
|
629
|
+
return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
630
|
+
}
|
|
631
|
+
const date = DateTime.fromISO(formattedDate).toJSDate();
|
|
632
|
+
const zonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(date);
|
|
633
|
+
return toCalendarDate(zonedDateTime);
|
|
634
|
+
};
|
|
635
|
+
const dateLimits = {
|
|
636
|
+
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
637
|
+
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
638
|
+
};
|
|
639
|
+
if ("formControl" in props && props.formControl) {
|
|
640
|
+
const { formControl, ref, ...innerProps } = props;
|
|
641
|
+
return /* @__PURE__ */ jsx(
|
|
642
|
+
Controller,
|
|
643
|
+
{
|
|
644
|
+
control: formControl.control,
|
|
645
|
+
name: formControl.name,
|
|
646
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(
|
|
647
|
+
DateRangePickerBase,
|
|
648
|
+
{
|
|
649
|
+
...innerProps,
|
|
650
|
+
...dateLimits,
|
|
651
|
+
ref: mergeRefs(ref, field.ref),
|
|
652
|
+
value: parseDateRange(field.value),
|
|
653
|
+
onChange: (value) => field.onChange(formatDateRange(value)),
|
|
654
|
+
onBlur: field.onBlur,
|
|
655
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
656
|
+
error: props.error ?? error?.message
|
|
657
|
+
}
|
|
658
|
+
)
|
|
659
|
+
}
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
return /* @__PURE__ */ jsx(
|
|
663
|
+
DateRangePickerBase,
|
|
664
|
+
{
|
|
665
|
+
...props,
|
|
666
|
+
...dateLimits,
|
|
667
|
+
value: parseDateRange(props.value),
|
|
668
|
+
onChange: (value) => props.onChange?.(formatDateRange(value))
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
};
|
|
672
|
+
export {
|
|
673
|
+
DateRangePicker
|
|
674
|
+
};
|
|
@@ -2,9 +2,9 @@ import { Ref } from 'react';
|
|
|
2
2
|
import { DateValue } from 'react-aria';
|
|
3
3
|
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { DatePickerStateOptions } from 'react-stately';
|
|
5
|
-
import { FormFieldProps } from '
|
|
6
|
-
import { ControlProps } from '
|
|
7
|
-
import { InputVariantProps } from '
|
|
5
|
+
import { FormFieldProps } from '../../FormField/FormField';
|
|
6
|
+
import { ControlProps } from '../../shared/form.types';
|
|
7
|
+
import { InputVariantProps } from '../../shared/input.cva';
|
|
8
8
|
interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<DateValue>, "granularity" | "shouldCloseOnSelect" | "label"> {
|
|
9
9
|
ref?: Ref<HTMLDivElement>;
|
|
10
10
|
disableDropdown?: boolean;
|