@povio/ui 3.0.0-rc.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/assets/icons/AlignCenter.js +11 -26
- package/dist/assets/icons/AlignLeft.js +11 -26
- package/dist/assets/icons/AlignLeftRight.js +11 -26
- package/dist/assets/icons/AlignRight.js +11 -26
- package/dist/assets/icons/ArrowDropDown.js +11 -26
- package/dist/assets/icons/ArrowDropUp.js +11 -26
- package/dist/assets/icons/ArrowLeft.js +11 -26
- package/dist/assets/icons/ArrowRight.js +11 -26
- package/dist/assets/icons/Bold.js +11 -26
- package/dist/assets/icons/BulletedList.js +11 -26
- package/dist/assets/icons/Calendar.js +13 -28
- package/dist/assets/icons/Check.js +13 -28
- package/dist/assets/icons/CheckCircle.js +11 -26
- package/dist/assets/icons/CheckboxCheckmark.js +14 -29
- package/dist/assets/icons/CheckboxIndeterminate.js +14 -29
- package/dist/assets/icons/ChevronDown.js +13 -28
- package/dist/assets/icons/ChevronLeft.js +13 -28
- package/dist/assets/icons/ChevronRight.js +13 -28
- package/dist/assets/icons/ChevronUp.js +13 -28
- package/dist/assets/icons/ChevronsLeft.js +13 -28
- package/dist/assets/icons/ChevronsRight.js +13 -28
- package/dist/assets/icons/Clock.js +11 -26
- package/dist/assets/icons/Close.js +11 -26
- package/dist/assets/icons/DateTime.js +14 -35
- package/dist/assets/icons/DragIndicator.js +11 -26
- package/dist/assets/icons/File.js +13 -28
- package/dist/assets/icons/Highlight.js +11 -26
- package/dist/assets/icons/HighlightOn.js +15 -49
- package/dist/assets/icons/Home.js +11 -26
- package/dist/assets/icons/Info.js +16 -37
- package/dist/assets/icons/Italic.js +11 -26
- package/dist/assets/icons/Link.js +11 -26
- package/dist/assets/icons/Menu.js +11 -26
- package/dist/assets/icons/NumberedList.js +11 -26
- package/dist/assets/icons/PointerHorizontal.js +11 -26
- package/dist/assets/icons/PointerVertical.js +11 -26
- package/dist/assets/icons/Search.js +11 -26
- package/dist/assets/icons/Send.js +13 -28
- package/dist/assets/icons/Strikethrough.js +11 -26
- package/dist/assets/icons/TextColor.js +14 -48
- package/dist/assets/icons/Today.js +11 -26
- package/dist/assets/icons/Underlined.js +13 -28
- package/dist/assets/icons/Upload.js +14 -35
- package/dist/assets/icons/Visibility.js +11 -26
- package/dist/assets/icons/VisibilityOff.js +11 -26
- package/dist/assets/icons/WarningFilled.js +13 -28
- package/dist/components/Breadcrumbs/Breadcrumbs.js +56 -207
- package/dist/components/Menu/Menu.d.ts +4 -0
- package/dist/components/Menu/Menu.js +2 -18
- package/dist/components/Menu/MenuDesktop.js +7 -41
- package/dist/components/Menu/MenuItem.js +9 -32
- package/dist/components/Menu/MenuMobile.d.ts +1 -1
- package/dist/components/Menu/MenuMobile.js +39 -97
- package/dist/components/Menu/MenuPopover.js +29 -105
- package/dist/components/buttons/IconButton/IconButton.js +8 -40
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -2
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
- package/dist/components/buttons/PillButton/PillButton.js +17 -55
- package/dist/components/buttons/SplitButton/SplitButton.js +18 -103
- package/dist/components/buttons/TextButton/TextButton.js +8 -30
- package/dist/components/buttons/ToggleButton/ToggleButton.js +8 -28
- package/dist/components/buttons/shared/ButtonContent.js +22 -80
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +0 -1
- package/dist/components/inputs/Checkbox/Checkbox.js +35 -201
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +0 -3
- package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -2
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +5 -12
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +75 -373
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -12
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +186 -492
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -14
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +47 -273
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +121 -611
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +3 -5
- package/dist/components/inputs/DateTime/shared/Calendar.js +120 -338
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -4
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +103 -310
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -4
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +33 -150
- package/dist/components/inputs/DateTime/shared/CalendarHeader.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +98 -249
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +137 -318
- package/dist/components/inputs/DateTime/shared/DateField.js +112 -286
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -14
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +129 -356
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -15
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +11 -96
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +28 -81
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +58 -103
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
- package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +110 -279
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -4
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +65 -210
- package/dist/components/inputs/DateTime/shared/YearPicker.js +68 -119
- package/dist/components/inputs/File/FileUpload.js +45 -88
- package/dist/components/inputs/File/FileUploadContainer.js +7 -15
- package/dist/components/inputs/File/InputUpload.js +79 -317
- package/dist/components/inputs/File/shared/FileCard.js +41 -104
- package/dist/components/inputs/File/shared/FileCardList.js +12 -47
- package/dist/components/inputs/File/shared/FileUploadContent.js +44 -175
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +46 -149
- package/dist/components/inputs/File/shared/FileUploadContentError.js +93 -234
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +97 -230
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +55 -199
- package/dist/components/inputs/File/shared/InputUploadContent.js +34 -148
- package/dist/components/inputs/File/shared/InputUploadFilled.js +8 -49
- package/dist/components/inputs/File/shared/ProgressBar.d.ts +2 -2
- package/dist/components/inputs/File/shared/ProgressBar.js +20 -53
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +1 -1
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -1
- package/dist/components/inputs/File/shared/progressBar.cva.d.ts +38 -0
- package/dist/components/inputs/File/shared/progressBar.cva.js +28 -0
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +37 -119
- package/dist/components/inputs/FormField/FormFieldError.js +5 -25
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +22 -81
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
- package/dist/components/inputs/FormField/FormFieldHelper.js +6 -26
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +2 -5
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +97 -447
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +9 -48
- package/dist/components/inputs/Input/TextArea/TextArea.js +90 -305
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -3
- package/dist/components/inputs/Input/TextInput/TextInput.js +90 -419
- package/dist/components/inputs/Input/shared/InputContent.js +59 -192
- package/dist/components/inputs/Inputs/Form.js +11 -40
- package/dist/components/inputs/Inputs/InputItem.d.ts +21 -15
- package/dist/components/inputs/Inputs/InputItem.js +14 -69
- package/dist/components/inputs/Inputs/Inputs.js +11 -37
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.js +61 -353
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -45
- package/dist/components/inputs/RadioGroup/radio.cva.js +1 -48
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +2 -6
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +22 -217
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +8 -107
- package/dist/components/inputs/Selection/Select/Select.d.ts +3 -7
- package/dist/components/inputs/Selection/Select/Select.js +18 -227
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +3 -8
- package/dist/components/inputs/Selection/shared/SelectBase.js +18 -69
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +138 -393
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +116 -397
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +25 -99
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +52 -164
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +21 -70
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +9 -58
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +6 -11
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
- package/dist/components/inputs/Selection/shared/select.context.js +36 -67
- package/dist/components/inputs/Selection/shared/select.types.d.ts +2 -3
- package/dist/components/inputs/Selection/shared/useSelectItems.js +49 -109
- package/dist/components/inputs/Slider/Slider.d.ts +1 -2
- package/dist/components/inputs/Slider/Slider.js +76 -265
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +0 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +98 -447
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +30 -102
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +45 -194
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +32 -92
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +54 -126
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +38 -141
- package/dist/components/inputs/Toggle/Toggle.d.ts +0 -1
- package/dist/components/inputs/Toggle/Toggle.js +37 -214
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +0 -3
- package/dist/components/inputs/Toggle/toggle.cva.js +1 -2
- package/dist/components/inputs/shared/CheckContent.d.ts +1 -2
- package/dist/components/inputs/shared/CheckContent.js +11 -21
- package/dist/components/inputs/shared/InputClear.d.ts +1 -2
- package/dist/components/inputs/shared/InputClear.js +12 -88
- package/dist/components/inputs/shared/TooltipWrapper.js +11 -50
- package/dist/components/inputs/shared/input.cva.d.ts +0 -28
- package/dist/components/inputs/shared/input.cva.js +4 -38
- package/dist/components/navigation/Accordion/Accordion.js +22 -69
- package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
- package/dist/components/navigation/Stepper/Stepper.js +22 -67
- package/dist/components/navigation/Stepper/StepperItem.js +31 -104
- package/dist/components/navigation/Stepper/StepperSeparator.js +5 -23
- package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
- package/dist/components/overlays/BottomSheet/BottomSheet.js +25 -98
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +8 -48
- package/dist/components/overlays/Drawer/Drawer.js +22 -64
- package/dist/components/overlays/Modal/modal.cva.js +1 -1
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +5 -1
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +28 -83
- package/dist/components/overlays/Tooltip/Tooltip.js +28 -137
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +12 -37
- package/dist/components/segment/Segment.js +57 -218
- package/dist/components/segment/SegmentItem.js +10 -67
- package/dist/components/shared/pagination/Pagination.js +22 -108
- package/dist/components/shared/pagination/PaginationList.js +64 -167
- package/dist/components/status/Alert/Alert.js +30 -97
- package/dist/components/status/Loader/Loader.js +22 -77
- package/dist/components/status/Toast/Toast.js +17 -22
- package/dist/components/status/Toast/toast.cva.d.ts +14 -3
- package/dist/components/status/Toast/toast.cva.js +12 -10
- package/dist/components/status/Toast/useToast.js +57 -62
- package/dist/components/table/ColumnConfig.js +54 -158
- package/dist/components/table/InfiniteTable.js +16 -67
- package/dist/components/table/PaginatedTable.js +18 -84
- package/dist/components/table/Table.js +30 -30
- package/dist/components/table/table.cva.d.ts +7 -0
- package/dist/components/table/table.cva.js +2 -1
- package/dist/components/text/Link/Link.js +7 -19
- package/dist/components/text/Pill/Pill.d.ts +15 -0
- package/dist/components/text/Pill/Pill.js +44 -0
- package/dist/components/text/Typography/Typography.js +8 -23
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +9 -23
- package/dist/config/router.context.js +16 -42
- package/dist/config/theme.context.js +45 -98
- package/dist/config/uiConfig.context.d.ts +10 -21
- package/dist/config/uiConfig.context.js +18 -69
- package/dist/config/uiOverrides.context.d.ts +10 -20
- package/dist/config/uiOverrides.context.js +14 -54
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +0 -3
- package/dist/hooks/useAutosave.d.ts +1 -2
- package/dist/hooks/useAutosave.js +4 -12
- package/dist/hooks/useBreakpoint.js +3 -16
- package/dist/hooks/useDebounceCallback.js +17 -51
- package/dist/hooks/useFilters.js +64 -125
- package/dist/hooks/useForm.js +8 -42
- package/dist/hooks/useFormAutosave.d.ts +1 -3
- package/dist/hooks/useFormAutosave.js +30 -122
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +24 -91
- package/dist/hooks/useLocalStorage.js +10 -43
- package/dist/hooks/useLongPressRepeat.js +20 -55
- package/dist/hooks/usePagination.js +19 -49
- package/dist/hooks/useScrollableListBox.js +16 -37
- package/dist/hooks/useSorting.js +28 -69
- package/dist/hooks/useStateAndRef.js +7 -21
- package/dist/hooks/useTableColumnConfig.js +31 -124
- package/dist/hooks/useTranslationMemo.js +5 -25
- package/dist/index.d.ts +7 -16
- package/dist/index.js +6 -13
- package/dist/tw-ui-plugin.js +0 -6
- package/dist/utils/date-time.utils.d.ts +10 -38
- package/dist/utils/date-time.utils.js +22 -136
- package/package.json +1 -1
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -5
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +0 -16
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +0 -16
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -15
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +0 -32
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -40
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +0 -85
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -13
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -14
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +0 -45
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +0 -571
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -35
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -575
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +0 -8
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +0 -5
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +0 -7
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +0 -37
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
- package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -178
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +0 -47
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -14
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -43
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +0 -6
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +0 -5
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +0 -12
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +0 -8
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +0 -54
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -82
- package/dist/components/inputs/Skeleton/InputFrame.js +0 -548
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +0 -8
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +0 -5
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -14
- package/dist/components/inputs/shared/useStaticInputHandoff.js +0 -100
- package/dist/hooks/useAutosave.spec.d.ts +0 -1
- package/dist/hooks/useFormAutosave.spec.d.ts +0 -1
- package/dist/hooks/useKeyInteractions.d.ts +0 -20
- package/dist/hooks/useKeyInteractions.js +0 -54
- package/dist/hooks/useKeyInteractions.spec.d.ts +0 -1
- package/dist/hooks/useQueryAutocomplete.d.ts +0 -14
- package/dist/hooks/useQueryAutocomplete.js +0 -72
- package/dist/utils/query.utils.d.ts +0 -4
- package/dist/utils/query.utils.js +0 -8
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
2
1
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
2
|
import { Calendar } from "../shared/Calendar.js";
|
|
4
3
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
5
|
-
import { datePickerInputContentRowDefinition } from "../shared/datePickerInput.cva.js";
|
|
6
|
-
import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
|
|
7
4
|
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
8
5
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
9
6
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
10
|
-
import { getStaticCalendarDateSegments } from "../shared/staticDateTimeSegments.js";
|
|
11
7
|
import { FormField } from "../../FormField/FormField.js";
|
|
12
8
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
13
|
-
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
14
|
-
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
15
|
-
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
16
|
-
import { c } from "react/compiler-runtime";
|
|
17
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
10
|
import { clsx } from "clsx";
|
|
19
|
-
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef
|
|
11
|
+
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
20
12
|
import { useDatePicker, useLocale } from "react-aria";
|
|
21
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
22
14
|
import { Controller } from "react-hook-form";
|
|
@@ -26,25 +18,7 @@ import { useCalendarState, useDatePickerState } from "react-stately";
|
|
|
26
18
|
//#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
|
|
27
19
|
var DatePickerBase = (props) => {
|
|
28
20
|
const ui = UIConfig.useConfig();
|
|
29
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange,
|
|
30
|
-
const as = asProp ?? ui.input.as;
|
|
31
|
-
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
32
|
-
const variant = variantProp ?? ui.input.variant;
|
|
33
|
-
const size = sizeProp ?? ui.input.size;
|
|
34
|
-
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
35
|
-
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
36
|
-
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
37
|
-
const todayIconButtonComponent = todayIconButtonComponentProp ?? ui.dateInput.todayIconButtonComponent;
|
|
38
|
-
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
39
|
-
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
40
|
-
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
41
|
-
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
42
|
-
const granularity = granularityProp ?? ui.dateInput.granularity;
|
|
43
|
-
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
44
|
-
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
45
|
-
const timeZone = ui.dateInput.timeZone;
|
|
46
|
-
let effectiveTimeZone = getLocalTimeZone();
|
|
47
|
-
if (timeZone !== "clientLocal") effectiveTimeZone = timeZone;
|
|
21
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, className, placeholder, inputClassName, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, shouldUpdateDateOnMonthYearChange = ui.dateInput.shouldUpdateDateOnMonthYearChange, granularity = ui.dateInput.granularity, autoFixYear = ui.dateInput.autoFixYear, format, ...rest } = props;
|
|
48
22
|
const normalizeByGranularity = useCallback((date) => {
|
|
49
23
|
if (granularity === "year") return date.set({
|
|
50
24
|
month: 1,
|
|
@@ -70,42 +44,33 @@ var DatePickerBase = (props) => {
|
|
|
70
44
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
71
45
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
72
46
|
} }), []);
|
|
73
|
-
useImperativeHandle(ref, () => ({
|
|
74
|
-
clear
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
78
|
-
}));
|
|
79
|
-
const handleBlur = (val) => {
|
|
80
|
-
onBlur?.({ target: { value: val } });
|
|
81
|
-
};
|
|
82
|
-
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
83
|
-
const normalizedValue = value ?? null;
|
|
47
|
+
useImperativeHandle(ref, () => ({ clear: () => {
|
|
48
|
+
datePickerInputRef.current?.clear();
|
|
49
|
+
} }));
|
|
84
50
|
const dialogState = useDatePickerState({
|
|
85
51
|
...rest,
|
|
86
|
-
defaultValue:
|
|
52
|
+
defaultValue: value || rest.defaultValue,
|
|
87
53
|
shouldCloseOnSelect: false,
|
|
88
54
|
shouldForceLeadingZeros
|
|
89
55
|
});
|
|
90
56
|
const state = useDatePickerState({
|
|
91
57
|
...rest,
|
|
92
58
|
shouldForceLeadingZeros,
|
|
93
|
-
value
|
|
94
|
-
onChange: (
|
|
95
|
-
let
|
|
96
|
-
if (
|
|
97
|
-
if (
|
|
59
|
+
value,
|
|
60
|
+
onChange: (val) => {
|
|
61
|
+
let normalizedValue = val;
|
|
62
|
+
if (val) normalizedValue = normalizeByGranularity(val);
|
|
63
|
+
if (normalizedValue && (rest.minValue && normalizedValue < rest?.minValue || rest?.maxValue && normalizedValue > rest?.maxValue)) {
|
|
98
64
|
state.setValue(state.value);
|
|
99
65
|
return;
|
|
100
66
|
}
|
|
101
|
-
onChange?.(
|
|
102
|
-
dialogState.setValue(
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
calendarState.setFocusedDate(normalizedValue_0);
|
|
67
|
+
onChange?.(normalizedValue);
|
|
68
|
+
dialogState.setValue(normalizedValue);
|
|
69
|
+
if (normalizedValue) {
|
|
70
|
+
calendarState.setFocusedDate(normalizedValue);
|
|
106
71
|
return;
|
|
107
72
|
}
|
|
108
|
-
calendarState.setFocusedDate(today(
|
|
73
|
+
calendarState.setFocusedDate(today(getLocalTimeZone()));
|
|
109
74
|
},
|
|
110
75
|
shouldCloseOnSelect: false
|
|
111
76
|
});
|
|
@@ -137,14 +102,13 @@ var DatePickerBase = (props) => {
|
|
|
137
102
|
labelProps
|
|
138
103
|
};
|
|
139
104
|
const onApply = () => {
|
|
140
|
-
|
|
141
|
-
state.setValue(
|
|
105
|
+
if (dialogState.value) state.setValue(normalizeByGranularity(dialogState.value));
|
|
106
|
+
if (!dialogState.value) state.setValue(dialogState.value);
|
|
142
107
|
state.toggle();
|
|
143
|
-
if (fireBlurOnChange) handleBlur(newValue);
|
|
144
108
|
};
|
|
145
109
|
const onMonthYearChange = (selectedDate) => {
|
|
146
110
|
if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
|
|
147
|
-
const updatedDate = normalizeByGranularity((dialogState.value || state.value || today(
|
|
111
|
+
const updatedDate = normalizeByGranularity((dialogState.value || state.value || today(getLocalTimeZone())).set({
|
|
148
112
|
year: selectedDate.year,
|
|
149
113
|
month: selectedDate.month
|
|
150
114
|
}));
|
|
@@ -155,20 +119,15 @@ var DatePickerBase = (props) => {
|
|
|
155
119
|
onApply();
|
|
156
120
|
};
|
|
157
121
|
const onTodayPress = () => {
|
|
158
|
-
const todayValue = normalizeByGranularity(today(
|
|
122
|
+
const todayValue = normalizeByGranularity(today(getLocalTimeZone()));
|
|
159
123
|
dialogState.setValue(todayValue);
|
|
160
124
|
calendarState.setFocusedDate(todayValue);
|
|
161
125
|
};
|
|
162
|
-
const onInputClear = () => {
|
|
163
|
-
onChange?.(null);
|
|
164
|
-
dialogState.setValue(null);
|
|
165
|
-
if (fireBlurOnChange) handleBlur(null);
|
|
166
|
-
};
|
|
167
126
|
useEffect(() => {
|
|
168
127
|
if (!state.isOpen) return;
|
|
169
128
|
if (granularity !== "year") return;
|
|
170
129
|
if (dialogState.value) return;
|
|
171
|
-
const defaultYearValue = normalizeByGranularity(today(
|
|
130
|
+
const defaultYearValue = normalizeByGranularity(today(getLocalTimeZone()));
|
|
172
131
|
dialogState.setValue(defaultYearValue);
|
|
173
132
|
calendarState.setFocusedDate(defaultYearValue);
|
|
174
133
|
}, [
|
|
@@ -177,13 +136,12 @@ var DatePickerBase = (props) => {
|
|
|
177
136
|
dialogState.value,
|
|
178
137
|
dialogState,
|
|
179
138
|
calendarState,
|
|
180
|
-
normalizeByGranularity
|
|
181
|
-
effectiveTimeZone
|
|
139
|
+
normalizeByGranularity
|
|
182
140
|
]);
|
|
183
141
|
const onOpenChange = (isOpen) => {
|
|
184
142
|
state.toggle();
|
|
185
143
|
if (state.value) calendarState.setFocusedDate(normalizeByGranularity(state.value));
|
|
186
|
-
if (!state.value) calendarState.setFocusedDate(today(
|
|
144
|
+
if (!state.value) calendarState.setFocusedDate(today(getLocalTimeZone()));
|
|
187
145
|
if (!isOpen) dialogState.setValue(state.value);
|
|
188
146
|
};
|
|
189
147
|
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
@@ -200,21 +158,11 @@ var DatePickerBase = (props) => {
|
|
|
200
158
|
ref: mergeRefs(ref, datePickerInputRef),
|
|
201
159
|
as,
|
|
202
160
|
groupProps,
|
|
203
|
-
fieldProps
|
|
204
|
-
...fieldProps,
|
|
205
|
-
onBlur: (event) => {
|
|
206
|
-
fieldProps.onBlur?.(event);
|
|
207
|
-
handleBlur(state.value);
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
fieldValue: normalizedValue,
|
|
211
|
-
isValueControlled: true,
|
|
212
|
-
hasValue: normalizedValue != null,
|
|
161
|
+
fieldProps,
|
|
213
162
|
buttonProps,
|
|
214
163
|
isDirty,
|
|
215
164
|
isDisabled,
|
|
216
165
|
disableManualEntry,
|
|
217
|
-
autoFixYear,
|
|
218
166
|
isInvalid: !!error,
|
|
219
167
|
disableDropdown,
|
|
220
168
|
variant,
|
|
@@ -222,18 +170,13 @@ var DatePickerBase = (props) => {
|
|
|
222
170
|
isClearable,
|
|
223
171
|
headerProps,
|
|
224
172
|
todayIcon,
|
|
225
|
-
todayIconButtonSize,
|
|
226
|
-
todayIconButtonComponent,
|
|
227
|
-
todayIconPlacement,
|
|
228
173
|
onOpenDropdown: () => state.toggle(),
|
|
229
174
|
placeholder,
|
|
230
175
|
className: inputClassName,
|
|
231
176
|
dateGranularity: granularity,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
onClear: onInputClear
|
|
236
|
-
}), (!disableDropdown || disableManualEntry) && state.isOpen && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
177
|
+
autoFixYear,
|
|
178
|
+
format
|
|
179
|
+
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
237
180
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
238
181
|
isDisabled,
|
|
239
182
|
isValid: !dialogState.isInvalid && !!dialogState.value,
|
|
@@ -258,298 +201,57 @@ var DatePickerBase = (props) => {
|
|
|
258
201
|
})
|
|
259
202
|
});
|
|
260
203
|
};
|
|
261
|
-
var
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const ui = UIConfig.useConfig();
|
|
267
|
-
const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
|
|
268
|
-
const { locale } = useLocale();
|
|
269
|
-
const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
|
|
270
|
-
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
271
|
-
const inputRef = useRef(null);
|
|
272
|
-
const { renderRealInput } = useStaticInputHandoff({
|
|
273
|
-
inputRef,
|
|
274
|
-
renderInput,
|
|
275
|
-
setRenderInput,
|
|
276
|
-
getFocusTarget: _temp
|
|
277
|
-
});
|
|
278
|
-
const normalizedValue = props.value ?? null;
|
|
279
|
-
let t3;
|
|
280
|
-
if ($[0] !== granularity) {
|
|
281
|
-
t3 = (date) => {
|
|
282
|
-
if (granularity === "year") return date.set({
|
|
283
|
-
month: 1,
|
|
284
|
-
day: 1
|
|
285
|
-
});
|
|
286
|
-
if (granularity === "month") return date.set({ day: 1 });
|
|
287
|
-
return date;
|
|
288
|
-
};
|
|
289
|
-
$[0] = granularity;
|
|
290
|
-
$[1] = t3;
|
|
291
|
-
} else t3 = $[1];
|
|
292
|
-
const normalizeByGranularity = t3;
|
|
293
|
-
let t4;
|
|
294
|
-
if ($[2] !== fullIso || $[3] !== normalizeByGranularity) {
|
|
295
|
-
t4 = (calendarDate) => {
|
|
296
|
-
if (calendarDate === null) return null;
|
|
297
|
-
const normalizedDate = normalizeByGranularity(calendarDate);
|
|
298
|
-
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
|
|
299
|
-
const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
|
|
300
|
-
return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
|
|
301
|
-
};
|
|
302
|
-
$[2] = fullIso;
|
|
303
|
-
$[3] = normalizeByGranularity;
|
|
304
|
-
$[4] = t4;
|
|
305
|
-
} else t4 = $[4];
|
|
306
|
-
const formatCalendarDate = t4;
|
|
307
|
-
let t5;
|
|
308
|
-
if ($[5] !== fullIso || $[6] !== normalizeByGranularity) {
|
|
309
|
-
t5 = (formattedDate) => {
|
|
310
|
-
if (formattedDate == null) return null;
|
|
311
|
-
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
312
|
-
const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
313
|
-
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
|
|
314
|
-
};
|
|
315
|
-
$[5] = fullIso;
|
|
316
|
-
$[6] = normalizeByGranularity;
|
|
317
|
-
$[7] = t5;
|
|
318
|
-
} else t5 = $[7];
|
|
319
|
-
const parseCalendarDate = t5;
|
|
320
|
-
let t6;
|
|
321
|
-
if ($[8] !== minValue || $[9] !== parseCalendarDate) {
|
|
322
|
-
t6 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
|
|
323
|
-
$[8] = minValue;
|
|
324
|
-
$[9] = parseCalendarDate;
|
|
325
|
-
$[10] = t6;
|
|
326
|
-
} else t6 = $[10];
|
|
327
|
-
let t7;
|
|
328
|
-
if ($[11] !== maxValue || $[12] !== parseCalendarDate) {
|
|
329
|
-
t7 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
|
|
330
|
-
$[11] = maxValue;
|
|
331
|
-
$[12] = parseCalendarDate;
|
|
332
|
-
$[13] = t7;
|
|
333
|
-
} else t7 = $[13];
|
|
334
|
-
let t8;
|
|
335
|
-
if ($[14] !== t6 || $[15] !== t7) {
|
|
336
|
-
t8 = {
|
|
337
|
-
minValue: t6,
|
|
338
|
-
maxValue: t7
|
|
339
|
-
};
|
|
340
|
-
$[14] = t6;
|
|
341
|
-
$[15] = t7;
|
|
342
|
-
$[16] = t8;
|
|
343
|
-
} else t8 = $[16];
|
|
344
|
-
const dateLimits = t8;
|
|
345
|
-
if (!renderInput) {
|
|
346
|
-
const dateValue = normalizedValue ? parseCalendarDate(normalizedValue) : null;
|
|
347
|
-
const as = props.as ?? ui.input.as;
|
|
348
|
-
const size = props.size ?? ui.input.size;
|
|
349
|
-
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
350
|
-
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
351
|
-
const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
|
|
352
|
-
const todayIconButtonComponent = props.todayIconButtonComponent ?? ui.dateInput.todayIconButtonComponent;
|
|
353
|
-
const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
|
|
354
|
-
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, {
|
|
355
|
-
isDisabled,
|
|
356
|
-
renderStatic: true,
|
|
357
|
-
size: todayIconButtonSize,
|
|
358
|
-
todayIconButtonComponent
|
|
359
|
-
});
|
|
360
|
-
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
361
|
-
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
362
|
-
const staticSegments = getStaticCalendarDateSegments({
|
|
363
|
-
value: dateValue,
|
|
364
|
-
locale,
|
|
365
|
-
shouldForceLeadingZeros,
|
|
366
|
-
isDisabled,
|
|
367
|
-
hidePlaceholder: as === "floating" && !dateValue,
|
|
368
|
-
disableManualEntry,
|
|
369
|
-
placeholder: props.placeholder,
|
|
370
|
-
dateGranularity: granularity
|
|
371
|
-
});
|
|
372
|
-
return /* @__PURE__ */ jsx(InputFrame, {
|
|
373
|
-
...props,
|
|
374
|
-
isDisabled,
|
|
375
|
-
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
376
|
-
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
377
|
-
contentClassName: "pr-0!",
|
|
378
|
-
contentWrapperClassName: datePickerInputContentRowCva({ size }),
|
|
379
|
-
contentGroup: "date-picker",
|
|
380
|
-
labelPlacement: "content-row",
|
|
381
|
-
dataAttributes: {
|
|
382
|
-
dataIsEmpty: dateValue == null,
|
|
383
|
-
dataIsFilled: dateValue != null,
|
|
384
|
-
dataIsDirty: props.isDirty,
|
|
385
|
-
dataIsRequired: props.isRequired,
|
|
386
|
-
dataIsDisabled: isDisabled,
|
|
387
|
-
dataDisabled: isDisabled,
|
|
388
|
-
dataInvalid: !!props.error,
|
|
389
|
-
dataHasSelection: dateValue != null
|
|
390
|
-
},
|
|
391
|
-
renderStatic: true,
|
|
392
|
-
onStaticInteract: renderRealInput,
|
|
393
|
-
actionContent: staticTodayIcon,
|
|
394
|
-
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
395
|
-
showClear: dateValue != null,
|
|
396
|
-
wrapContentAndTrailing: true,
|
|
397
|
-
contentAndTrailingClassName: "gap-2!",
|
|
398
|
-
trailingClassName: "py-0! pl-0!",
|
|
399
|
-
action: showDropdown ? {
|
|
400
|
-
icon: ui.dateInput.calendarIcon,
|
|
401
|
-
onClick: _temp2,
|
|
402
|
-
altText: ""
|
|
403
|
-
} : void 0,
|
|
404
|
-
children: staticSegments
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
const T0 = DatePickerBase;
|
|
408
|
-
const t9 = mergeRefs(props.ref, inputRef);
|
|
409
|
-
const t10 = parseCalendarDate(normalizedValue);
|
|
410
|
-
let t11;
|
|
411
|
-
if ($[17] !== formatCalendarDate || $[18] !== props) {
|
|
412
|
-
t11 = (value) => props.onChange?.(formatCalendarDate(value));
|
|
413
|
-
$[17] = formatCalendarDate;
|
|
414
|
-
$[18] = props;
|
|
415
|
-
$[19] = t11;
|
|
416
|
-
} else t11 = $[19];
|
|
417
|
-
let t12;
|
|
418
|
-
if ($[20] !== T0 || $[21] !== dateLimits || $[22] !== granularity || $[23] !== props || $[24] !== t10 || $[25] !== t11 || $[26] !== t9) {
|
|
419
|
-
t12 = /* @__PURE__ */ jsx(T0, {
|
|
420
|
-
...props,
|
|
421
|
-
...dateLimits,
|
|
422
|
-
ref: t9,
|
|
423
|
-
granularity,
|
|
424
|
-
value: t10,
|
|
425
|
-
onChange: t11
|
|
204
|
+
var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ...props }) => {
|
|
205
|
+
const normalizeByGranularity = (date) => {
|
|
206
|
+
if (granularity === "year") return date.set({
|
|
207
|
+
month: 1,
|
|
208
|
+
day: 1
|
|
426
209
|
});
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
({fullIso: t1, granularity: t2, minValue, maxValue, renderStaticInput, ...props} = t0);
|
|
448
|
-
$[0] = t0;
|
|
449
|
-
$[1] = maxValue;
|
|
450
|
-
$[2] = minValue;
|
|
451
|
-
$[3] = props;
|
|
452
|
-
$[4] = renderStaticInput;
|
|
453
|
-
$[5] = t1;
|
|
454
|
-
$[6] = t2;
|
|
455
|
-
} else {
|
|
456
|
-
maxValue = $[1];
|
|
457
|
-
minValue = $[2];
|
|
458
|
-
props = $[3];
|
|
459
|
-
renderStaticInput = $[4];
|
|
460
|
-
t1 = $[5];
|
|
461
|
-
t2 = $[6];
|
|
462
|
-
}
|
|
463
|
-
const fullIso = t1 === void 0 ? true : t1;
|
|
464
|
-
const granularity = t2 === void 0 ? "day" : t2;
|
|
210
|
+
if (granularity === "month") return date.set({ day: 1 });
|
|
211
|
+
return date;
|
|
212
|
+
};
|
|
213
|
+
const formatCalendarDate = (calendarDate) => {
|
|
214
|
+
if (calendarDate === null) return null;
|
|
215
|
+
const normalizedDate = normalizeByGranularity(calendarDate);
|
|
216
|
+
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
|
|
217
|
+
const date = DateTimeUtils.fromDateValueToLocal(normalizedDate);
|
|
218
|
+
return DateTime.fromJSDate(date).toISODate();
|
|
219
|
+
};
|
|
220
|
+
const parseCalendarDate = (formattedDate) => {
|
|
221
|
+
if (formattedDate == null) return formattedDate;
|
|
222
|
+
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
223
|
+
const date = DateTime.fromISO(formattedDate).toJSDate();
|
|
224
|
+
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date)));
|
|
225
|
+
};
|
|
226
|
+
const dateLimits = {
|
|
227
|
+
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
228
|
+
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
229
|
+
};
|
|
465
230
|
if ("formControl" in props && props.formControl) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
({
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
let t3;
|
|
482
|
-
if ($[11] !== controlWithOptions._options?.disabled || $[12] !== fullIso || $[13] !== granularity || $[14] !== innerProps || $[15] !== maxValue || $[16] !== minValue || $[17] !== props.error || $[18] !== props.isDisabled || $[19] !== ref || $[20] !== renderStaticInput) {
|
|
483
|
-
t3 = (t4) => {
|
|
484
|
-
const { field, fieldState: t5 } = t4;
|
|
485
|
-
const { error, isDirty } = t5;
|
|
486
|
-
return /* @__PURE__ */ jsx(DatePickerInner, {
|
|
487
|
-
...innerProps,
|
|
488
|
-
ref: mergeRefs(ref, field.ref),
|
|
489
|
-
value: field.value ?? null,
|
|
490
|
-
onChange: field.onChange,
|
|
491
|
-
onBlur: field.onBlur,
|
|
492
|
-
isDirty,
|
|
493
|
-
isDisabled: field.disabled || props.isDisabled,
|
|
494
|
-
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
495
|
-
error: props.error ?? error?.message,
|
|
496
|
-
fullIso,
|
|
497
|
-
granularity,
|
|
498
|
-
minValue,
|
|
499
|
-
maxValue,
|
|
500
|
-
renderStaticInput
|
|
501
|
-
});
|
|
502
|
-
};
|
|
503
|
-
$[11] = controlWithOptions._options?.disabled;
|
|
504
|
-
$[12] = fullIso;
|
|
505
|
-
$[13] = granularity;
|
|
506
|
-
$[14] = innerProps;
|
|
507
|
-
$[15] = maxValue;
|
|
508
|
-
$[16] = minValue;
|
|
509
|
-
$[17] = props.error;
|
|
510
|
-
$[18] = props.isDisabled;
|
|
511
|
-
$[19] = ref;
|
|
512
|
-
$[20] = renderStaticInput;
|
|
513
|
-
$[21] = t3;
|
|
514
|
-
} else t3 = $[21];
|
|
515
|
-
let t4;
|
|
516
|
-
if ($[22] !== formControl.control || $[23] !== formControl.name || $[24] !== t3) {
|
|
517
|
-
t4 = /* @__PURE__ */ jsx(Controller, {
|
|
518
|
-
control: formControl.control,
|
|
519
|
-
name: formControl.name,
|
|
520
|
-
render: t3
|
|
521
|
-
});
|
|
522
|
-
$[22] = formControl.control;
|
|
523
|
-
$[23] = formControl.name;
|
|
524
|
-
$[24] = t3;
|
|
525
|
-
$[25] = t4;
|
|
526
|
-
} else t4 = $[25];
|
|
527
|
-
return t4;
|
|
528
|
-
}
|
|
529
|
-
let t3;
|
|
530
|
-
if ($[26] !== fullIso || $[27] !== granularity || $[28] !== maxValue || $[29] !== minValue || $[30] !== props || $[31] !== renderStaticInput) {
|
|
531
|
-
t3 = /* @__PURE__ */ jsx(DatePickerInner, {
|
|
532
|
-
...props,
|
|
533
|
-
fullIso,
|
|
534
|
-
granularity,
|
|
535
|
-
minValue,
|
|
536
|
-
maxValue,
|
|
537
|
-
renderStaticInput
|
|
231
|
+
const { formControl, ref, ...innerProps } = props;
|
|
232
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
233
|
+
control: formControl.control,
|
|
234
|
+
name: formControl.name,
|
|
235
|
+
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DatePickerBase, {
|
|
236
|
+
...innerProps,
|
|
237
|
+
...dateLimits,
|
|
238
|
+
ref: mergeRefs(ref, field.ref),
|
|
239
|
+
value: parseCalendarDate(field.value),
|
|
240
|
+
onChange: (value) => field.onChange(formatCalendarDate(value)),
|
|
241
|
+
onBlur: field.onBlur,
|
|
242
|
+
isDirty,
|
|
243
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
244
|
+
error: props.error ?? error?.message
|
|
245
|
+
})
|
|
538
246
|
});
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
return t3;
|
|
247
|
+
}
|
|
248
|
+
return /* @__PURE__ */ jsx(DatePickerBase, {
|
|
249
|
+
...props,
|
|
250
|
+
...dateLimits,
|
|
251
|
+
granularity,
|
|
252
|
+
value: parseCalendarDate(props.value),
|
|
253
|
+
onChange: (value) => props.onChange?.(formatCalendarDate(value))
|
|
254
|
+
});
|
|
548
255
|
};
|
|
549
|
-
function _temp(input) {
|
|
550
|
-
const container = input.getContainer?.() ?? input;
|
|
551
|
-
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
552
|
-
}
|
|
553
|
-
function _temp2() {}
|
|
554
256
|
//#endregion
|
|
555
257
|
export { DatePicker };
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
import { CalendarDate } from '@internationalized/date';
|
|
2
|
-
import {
|
|
2
|
+
import { Ref } from 'react';
|
|
3
3
|
import { DateValue } from 'react-aria';
|
|
4
4
|
import { FieldValues } from 'react-hook-form';
|
|
5
5
|
import { DateRangePickerStateOptions } from 'react-stately';
|
|
6
6
|
import { DatePickerInputHandle } from '../shared/DatePickerInput';
|
|
7
|
-
import { DatePickerTodayIcon, DatePickerTodayIconButtonComponent, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
|
|
8
7
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
9
8
|
import { ControlProps } from '../../shared/form.types';
|
|
10
9
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
11
|
-
interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DateRangePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label"
|
|
10
|
+
interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DateRangePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label"> {
|
|
12
11
|
ref?: Ref<DatePickerInputHandle & HTMLDivElement>;
|
|
13
12
|
disableDropdown?: boolean;
|
|
14
13
|
isClearable?: boolean;
|
|
15
14
|
hideSidebar?: boolean;
|
|
16
15
|
className?: string;
|
|
17
|
-
todayIcon?:
|
|
18
|
-
todayIconButtonSize?: DatePickerTodayIconButtonSize;
|
|
19
|
-
todayIconButtonComponent?: DatePickerTodayIconButtonComponent;
|
|
20
|
-
todayIconPlacement?: DatePickerTodayIconPlacement;
|
|
16
|
+
todayIcon?: boolean;
|
|
21
17
|
isDirty?: boolean;
|
|
22
18
|
disableManualEntry?: boolean;
|
|
23
|
-
autoFixYear?: boolean;
|
|
24
19
|
placeholder?: string;
|
|
25
20
|
inputClassName?: string;
|
|
26
|
-
|
|
27
|
-
fireBlurOnChange?: boolean;
|
|
21
|
+
autoFixYear?: boolean;
|
|
28
22
|
}
|
|
29
23
|
export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
|
|
30
24
|
value?: {
|
|
@@ -38,8 +32,7 @@ export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "va
|
|
|
38
32
|
fullIso?: boolean;
|
|
39
33
|
minValue?: DateValue | string;
|
|
40
34
|
maxValue?: DateValue | string;
|
|
41
|
-
renderStaticInput?: boolean;
|
|
42
35
|
}
|
|
43
36
|
export type ControlledDateRangePickerProps<TFieldValues extends FieldValues> = ControlProps<DateRangePickerProps, TFieldValues>;
|
|
44
|
-
export declare const DateRangePicker: <TFieldValues extends FieldValues>({ fullIso, minValue, maxValue,
|
|
37
|
+
export declare const DateRangePicker: <TFieldValues extends FieldValues>({ fullIso, minValue, maxValue, ...props }: ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
45
38
|
export {};
|