@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,41 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
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
5
|
import { DatePickerInputHandle } from '../shared/DatePickerInput';
|
|
6
|
-
import { DatePickerTodayIcon, DatePickerTodayIconButtonComponent, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
|
|
7
6
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
8
7
|
import { ControlProps } from '../../shared/form.types';
|
|
9
8
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
10
|
-
interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<DateValue>, "granularity" | "shouldCloseOnSelect" | "label"
|
|
9
|
+
interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<DateValue>, "granularity" | "shouldCloseOnSelect" | "label"> {
|
|
11
10
|
ref?: Ref<DatePickerInputHandle & HTMLDivElement>;
|
|
12
11
|
disableDropdown?: boolean;
|
|
13
12
|
isTimeOptional?: boolean;
|
|
14
13
|
isClearable?: boolean;
|
|
15
|
-
todayIcon?:
|
|
16
|
-
todayIconButtonSize?: DatePickerTodayIconButtonSize;
|
|
17
|
-
todayIconButtonComponent?: DatePickerTodayIconButtonComponent;
|
|
18
|
-
todayIconPlacement?: DatePickerTodayIconPlacement;
|
|
14
|
+
todayIcon?: boolean;
|
|
19
15
|
isDirty?: boolean;
|
|
20
16
|
disableManualEntry?: boolean;
|
|
21
|
-
autoFixYear?: boolean;
|
|
22
|
-
setDateValueOnDateSelection?: boolean;
|
|
23
17
|
placeholder?: string;
|
|
24
18
|
inputClassName?: string;
|
|
25
|
-
shouldShrinkInput?: boolean;
|
|
26
19
|
shouldUpdateDateOnMonthYearChange?: boolean;
|
|
27
20
|
timeZone?: string;
|
|
21
|
+
autoFixYear?: boolean;
|
|
28
22
|
format?: string;
|
|
29
|
-
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
30
|
-
fireBlurOnChange?: boolean;
|
|
31
23
|
}
|
|
32
24
|
export interface DateTimePickerProps extends Omit<DateTimePickerBaseProps, "value" | "onChange"> {
|
|
33
25
|
value?: string | null;
|
|
34
26
|
onChange?: (value: string | null) => void;
|
|
35
27
|
fullIso?: boolean;
|
|
36
|
-
renderStaticInput?: boolean;
|
|
37
28
|
timeZone?: string;
|
|
38
29
|
}
|
|
39
30
|
export type ControlledDateTimePickerProps<TFieldValues extends FieldValues> = ControlProps<DateTimePickerProps, TFieldValues>;
|
|
40
|
-
export declare const DateTimePicker: <TFieldValues extends FieldValues>({ fullIso,
|
|
31
|
+
export declare const DateTimePicker: <TFieldValues extends FieldValues>({ fullIso, ...props }: ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
41
32
|
export {};
|
|
@@ -1,49 +1,24 @@
|
|
|
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 { getStaticCalendarDateTimeSegments } 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
|
-
import {
|
|
19
|
-
import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
20
11
|
import { useDatePicker, useLocale } from "react-aria";
|
|
21
12
|
import { mergeRefs } from "@react-aria/utils";
|
|
22
13
|
import { Controller } from "react-hook-form";
|
|
23
|
-
import { Time, createCalendar, getLocalTimeZone,
|
|
14
|
+
import { Time, createCalendar, getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
24
15
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
25
16
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
26
17
|
var DateTimePickerBase = (props) => {
|
|
27
18
|
const ui = UIConfig.useConfig();
|
|
28
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange,
|
|
29
|
-
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
30
|
-
const variant = variantProp ?? ui.input.variant;
|
|
31
|
-
const as = asProp ?? ui.input.as;
|
|
32
|
-
const size = sizeProp ?? ui.input.size;
|
|
33
|
-
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
34
|
-
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
35
|
-
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
36
|
-
const todayIconButtonComponent = todayIconButtonComponentProp ?? ui.dateInput.todayIconButtonComponent;
|
|
37
|
-
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
38
|
-
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
39
|
-
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
40
|
-
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
41
|
-
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
42
|
-
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
43
|
-
const setDateValueOnDateSelection = setDateValueOnDateSelectionProp ?? ui.dateInput.setDateValueOnDateSelection;
|
|
44
|
-
const timeZone = timeZoneProp ?? ui.dateInput.timeZone;
|
|
19
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, shouldUpdateDateOnMonthYearChange = ui.dateInput.shouldUpdateDateOnMonthYearChange, timeZone, autoFixYear = ui.dateInput.autoFixYear, format, ...rest } = props;
|
|
45
20
|
let effectiveTimeZone = getLocalTimeZone();
|
|
46
|
-
if (timeZone
|
|
21
|
+
if (timeZone) effectiveTimeZone = timeZone;
|
|
47
22
|
const formFieldProps = {
|
|
48
23
|
error,
|
|
49
24
|
label,
|
|
@@ -61,20 +36,12 @@ var DateTimePickerBase = (props) => {
|
|
|
61
36
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
62
37
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
63
38
|
} }), []);
|
|
64
|
-
useImperativeHandle(ref, () => ({
|
|
65
|
-
clear
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
69
|
-
}));
|
|
70
|
-
const handleBlur = (val) => {
|
|
71
|
-
onBlur?.({ target: { value: val } });
|
|
72
|
-
};
|
|
73
|
-
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
74
|
-
const normalizedValue = value ?? null;
|
|
39
|
+
useImperativeHandle(ref, () => ({ clear: () => {
|
|
40
|
+
datePickerInputRef.current?.clear();
|
|
41
|
+
} }));
|
|
75
42
|
const dialogState = useDatePickerState({
|
|
76
43
|
...rest,
|
|
77
|
-
defaultValue:
|
|
44
|
+
defaultValue: value || rest.defaultValue,
|
|
78
45
|
shouldCloseOnSelect: false,
|
|
79
46
|
granularity: "minute",
|
|
80
47
|
hideTimeZone: true,
|
|
@@ -86,12 +53,11 @@ var DateTimePickerBase = (props) => {
|
|
|
86
53
|
const state = useDatePickerState({
|
|
87
54
|
...rest,
|
|
88
55
|
shouldForceLeadingZeros,
|
|
89
|
-
value
|
|
90
|
-
onChange: (
|
|
91
|
-
onChange?.(
|
|
92
|
-
dialogState.setValue(
|
|
93
|
-
calendarState.setFocusedDate(
|
|
94
|
-
if (fireBlurOnChange) debouncedBlur(val_0);
|
|
56
|
+
value,
|
|
57
|
+
onChange: (val) => {
|
|
58
|
+
onChange?.(val);
|
|
59
|
+
dialogState.setValue(val);
|
|
60
|
+
calendarState.setFocusedDate(val || today(effectiveTimeZone));
|
|
95
61
|
},
|
|
96
62
|
shouldCloseOnSelect: false,
|
|
97
63
|
granularity: "minute",
|
|
@@ -127,10 +93,8 @@ var DateTimePickerBase = (props) => {
|
|
|
127
93
|
labelProps
|
|
128
94
|
};
|
|
129
95
|
const onApply = () => {
|
|
130
|
-
|
|
131
|
-
state.setValue(newValue);
|
|
96
|
+
state.setValue(dialogState.value);
|
|
132
97
|
state.toggle();
|
|
133
|
-
if (fireBlurOnChange) handleBlur(newValue);
|
|
134
98
|
};
|
|
135
99
|
const onMonthYearChange = (selectedDate) => {
|
|
136
100
|
if (!shouldUpdateDateOnMonthYearChange) return;
|
|
@@ -148,14 +112,8 @@ var DateTimePickerBase = (props) => {
|
|
|
148
112
|
calendarState.setFocusedDate(selectedDate);
|
|
149
113
|
};
|
|
150
114
|
const onTodayPress = () => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
calendarState.setFocusedDate(toCalendarDate(currentValue));
|
|
154
|
-
};
|
|
155
|
-
const onInputClear = () => {
|
|
156
|
-
onChange?.(null);
|
|
157
|
-
dialogState.setValue(null);
|
|
158
|
-
if (fireBlurOnChange) handleBlur(null);
|
|
115
|
+
dialogState.setValue(toCalendarDateTime(now(effectiveTimeZone)));
|
|
116
|
+
calendarState.setFocusedDate(today(effectiveTimeZone));
|
|
159
117
|
};
|
|
160
118
|
const onOpenChange = (isOpen) => {
|
|
161
119
|
state.toggle();
|
|
@@ -168,7 +126,7 @@ var DateTimePickerBase = (props) => {
|
|
|
168
126
|
dialogState.setValue(state.value);
|
|
169
127
|
return;
|
|
170
128
|
}
|
|
171
|
-
const textValue = e
|
|
129
|
+
const textValue = e.currentTarget.textContent;
|
|
172
130
|
const dateTimeValue = DateTimeUtils.formatTextDateToCalendarDateTime(textValue, effectiveTimeZone, locale);
|
|
173
131
|
if (dateTimeValue) {
|
|
174
132
|
state.setValue(dateTimeValue);
|
|
@@ -192,15 +150,11 @@ var DateTimePickerBase = (props) => {
|
|
|
192
150
|
groupProps,
|
|
193
151
|
fieldProps: {
|
|
194
152
|
...fieldProps,
|
|
195
|
-
onBlur: (
|
|
196
|
-
fieldProps.onBlur?.(
|
|
197
|
-
|
|
198
|
-
onInputBlur(e_0);
|
|
153
|
+
onBlur: (e) => {
|
|
154
|
+
fieldProps.onBlur?.(e);
|
|
155
|
+
onInputBlur(e);
|
|
199
156
|
}
|
|
200
157
|
},
|
|
201
|
-
fieldValue: normalizedValue,
|
|
202
|
-
isValueControlled: true,
|
|
203
|
-
hasValue: normalizedValue != null,
|
|
204
158
|
buttonProps,
|
|
205
159
|
isDirty,
|
|
206
160
|
isDisabled,
|
|
@@ -209,24 +163,18 @@ var DateTimePickerBase = (props) => {
|
|
|
209
163
|
variant,
|
|
210
164
|
size,
|
|
211
165
|
isDateTime: true,
|
|
212
|
-
shouldShrinkInput,
|
|
213
166
|
isClearable,
|
|
214
167
|
headerProps,
|
|
215
168
|
todayIcon,
|
|
216
|
-
todayIconButtonSize,
|
|
217
|
-
todayIconButtonComponent,
|
|
218
|
-
todayIconPlacement,
|
|
219
169
|
isRequired,
|
|
220
170
|
disableManualEntry,
|
|
221
|
-
autoFixYear,
|
|
222
171
|
placeholder,
|
|
223
172
|
onOpenDropdown: () => state.toggle(),
|
|
224
173
|
className: inputClassName,
|
|
225
174
|
timeZone: effectiveTimeZone,
|
|
175
|
+
autoFixYear,
|
|
226
176
|
isTimeOptional,
|
|
227
|
-
format
|
|
228
|
-
fireBlurOnChange,
|
|
229
|
-
onClear: onInputClear
|
|
177
|
+
format
|
|
230
178
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
231
179
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
232
180
|
isDisabled,
|
|
@@ -247,220 +195,46 @@ var DateTimePickerBase = (props) => {
|
|
|
247
195
|
onApply,
|
|
248
196
|
onMonthYearChange,
|
|
249
197
|
granularity: "day",
|
|
250
|
-
|
|
198
|
+
isTimeOptional
|
|
251
199
|
})
|
|
252
200
|
})]
|
|
253
201
|
})
|
|
254
202
|
});
|
|
255
203
|
};
|
|
256
|
-
var
|
|
257
|
-
const $ = c(9);
|
|
258
|
-
const { fullIso: t1, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
259
|
-
const ui = UIConfig.useConfig();
|
|
260
|
-
const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
|
|
261
|
-
const { locale } = useLocale();
|
|
262
|
-
const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
|
|
263
|
-
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
264
|
-
const inputRef = useRef(null);
|
|
265
|
-
const { renderRealInput } = useStaticInputHandoff({
|
|
266
|
-
inputRef,
|
|
267
|
-
renderInput,
|
|
268
|
-
setRenderInput,
|
|
269
|
-
getFocusTarget: _temp
|
|
270
|
-
});
|
|
271
|
-
const normalizedValue = props.value ?? null;
|
|
272
|
-
const timeZone = props.timeZone ?? ui.dateInput.timeZone;
|
|
204
|
+
var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
273
205
|
let effectiveTimeZone = getLocalTimeZone();
|
|
274
|
-
if (timeZone
|
|
206
|
+
if (props.timeZone) effectiveTimeZone = props.timeZone;
|
|
275
207
|
const formatDateValue = (dateValue) => {
|
|
276
208
|
if (dateValue === null) return null;
|
|
209
|
+
if (fullIso) return DateTimeUtils.fromDateValueToISO(dateValue, effectiveTimeZone);
|
|
277
210
|
return DateTimeUtils.fromDateValueToISO(dateValue, effectiveTimeZone);
|
|
278
211
|
};
|
|
279
212
|
const parseDateValue = (isoString) => {
|
|
280
|
-
if (isoString == null) return
|
|
213
|
+
if (isoString == null) return isoString;
|
|
281
214
|
return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, effectiveTimeZone);
|
|
282
215
|
};
|
|
283
|
-
if (!renderInput) {
|
|
284
|
-
const dateTimeValue = normalizedValue ? parseDateValue(normalizedValue) : null;
|
|
285
|
-
const as = props.as ?? ui.input.as;
|
|
286
|
-
const size = props.size ?? ui.input.size;
|
|
287
|
-
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
288
|
-
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
289
|
-
const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
|
|
290
|
-
const todayIconButtonComponent = props.todayIconButtonComponent ?? ui.dateInput.todayIconButtonComponent;
|
|
291
|
-
const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
|
|
292
|
-
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, {
|
|
293
|
-
isDisabled,
|
|
294
|
-
renderStatic: true,
|
|
295
|
-
size: todayIconButtonSize,
|
|
296
|
-
todayIconButtonComponent
|
|
297
|
-
});
|
|
298
|
-
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
299
|
-
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
300
|
-
const staticSegments = getStaticCalendarDateTimeSegments({
|
|
301
|
-
value: dateTimeValue,
|
|
302
|
-
locale,
|
|
303
|
-
shouldForceLeadingZeros,
|
|
304
|
-
isDisabled,
|
|
305
|
-
hidePlaceholder: as === "floating" && !dateTimeValue,
|
|
306
|
-
disableManualEntry,
|
|
307
|
-
placeholder: props.placeholder
|
|
308
|
-
});
|
|
309
|
-
return /* @__PURE__ */ jsx(InputFrame, {
|
|
310
|
-
...props,
|
|
311
|
-
isDisabled,
|
|
312
|
-
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
313
|
-
inputClassName: clsx(props.shouldShrinkInput ? "min-w-0" : "min-w-input-width-min-width", props.inputClassName),
|
|
314
|
-
contentClassName: "pr-0!",
|
|
315
|
-
contentWrapperClassName: datePickerInputContentRowCva({ size }),
|
|
316
|
-
contentGroup: "date-picker",
|
|
317
|
-
labelPlacement: "content-row",
|
|
318
|
-
dataAttributes: {
|
|
319
|
-
dataIsEmpty: dateTimeValue == null,
|
|
320
|
-
dataIsFilled: dateTimeValue != null,
|
|
321
|
-
dataIsDirty: props.isDirty,
|
|
322
|
-
dataIsRequired: props.isRequired,
|
|
323
|
-
dataIsDisabled: isDisabled,
|
|
324
|
-
dataDisabled: isDisabled,
|
|
325
|
-
dataInvalid: !!props.error,
|
|
326
|
-
dataHasSelection: dateTimeValue != null
|
|
327
|
-
},
|
|
328
|
-
renderStatic: true,
|
|
329
|
-
onStaticInteract: renderRealInput,
|
|
330
|
-
actionContent: staticTodayIcon,
|
|
331
|
-
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
332
|
-
showClear: dateTimeValue != null,
|
|
333
|
-
wrapContentAndTrailing: true,
|
|
334
|
-
contentAndTrailingClassName: "gap-2!",
|
|
335
|
-
trailingClassName: "py-0! pl-0!",
|
|
336
|
-
action: showDropdown ? {
|
|
337
|
-
icon: ui.dateInput.dateTimeIcon,
|
|
338
|
-
onClick: _temp2,
|
|
339
|
-
altText: ""
|
|
340
|
-
} : void 0,
|
|
341
|
-
children: staticSegments
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
const T0 = DateTimePickerBase;
|
|
345
|
-
const t2 = mergeRefs(props.ref, inputRef);
|
|
346
|
-
const t3 = parseDateValue(normalizedValue);
|
|
347
|
-
let t4;
|
|
348
|
-
if ($[0] !== formatDateValue || $[1] !== props) {
|
|
349
|
-
t4 = (value) => props.onChange?.(formatDateValue(value));
|
|
350
|
-
$[0] = formatDateValue;
|
|
351
|
-
$[1] = props;
|
|
352
|
-
$[2] = t4;
|
|
353
|
-
} else t4 = $[2];
|
|
354
|
-
let t5;
|
|
355
|
-
if ($[3] !== T0 || $[4] !== props || $[5] !== t2 || $[6] !== t3 || $[7] !== t4) {
|
|
356
|
-
t5 = /* @__PURE__ */ jsx(T0, {
|
|
357
|
-
...props,
|
|
358
|
-
ref: t2,
|
|
359
|
-
value: t3,
|
|
360
|
-
onChange: t4
|
|
361
|
-
});
|
|
362
|
-
$[3] = T0;
|
|
363
|
-
$[4] = props;
|
|
364
|
-
$[5] = t2;
|
|
365
|
-
$[6] = t3;
|
|
366
|
-
$[7] = t4;
|
|
367
|
-
$[8] = t5;
|
|
368
|
-
} else t5 = $[8];
|
|
369
|
-
return t5;
|
|
370
|
-
};
|
|
371
|
-
var DateTimePicker = (t0) => {
|
|
372
|
-
const $ = c(24);
|
|
373
|
-
let props;
|
|
374
|
-
let renderStaticInput;
|
|
375
|
-
let t1;
|
|
376
|
-
if ($[0] !== t0) {
|
|
377
|
-
({fullIso: t1, renderStaticInput, ...props} = t0);
|
|
378
|
-
$[0] = t0;
|
|
379
|
-
$[1] = props;
|
|
380
|
-
$[2] = renderStaticInput;
|
|
381
|
-
$[3] = t1;
|
|
382
|
-
} else {
|
|
383
|
-
props = $[1];
|
|
384
|
-
renderStaticInput = $[2];
|
|
385
|
-
t1 = $[3];
|
|
386
|
-
}
|
|
387
|
-
const fullIso = t1 === void 0 ? true : t1;
|
|
388
216
|
if ("formControl" in props && props.formControl) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
({
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
const controlWithOptions = formControl.control;
|
|
404
|
-
let t2;
|
|
405
|
-
if ($[8] !== controlWithOptions._options?.disabled || $[9] !== fullIso || $[10] !== innerProps || $[11] !== props.error || $[12] !== props.isDisabled || $[13] !== ref || $[14] !== renderStaticInput) {
|
|
406
|
-
t2 = (t3) => {
|
|
407
|
-
const { field, fieldState: t4 } = t3;
|
|
408
|
-
const { error, isDirty } = t4;
|
|
409
|
-
return /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
410
|
-
...innerProps,
|
|
411
|
-
ref: mergeRefs(ref, field.ref),
|
|
412
|
-
value: field.value ?? null,
|
|
413
|
-
onChange: field.onChange,
|
|
414
|
-
onBlur: field.onBlur,
|
|
415
|
-
isDirty,
|
|
416
|
-
isDisabled: field.disabled || props.isDisabled,
|
|
417
|
-
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
418
|
-
error: props.error ?? error?.message,
|
|
419
|
-
fullIso,
|
|
420
|
-
renderStaticInput
|
|
421
|
-
});
|
|
422
|
-
};
|
|
423
|
-
$[8] = controlWithOptions._options?.disabled;
|
|
424
|
-
$[9] = fullIso;
|
|
425
|
-
$[10] = innerProps;
|
|
426
|
-
$[11] = props.error;
|
|
427
|
-
$[12] = props.isDisabled;
|
|
428
|
-
$[13] = ref;
|
|
429
|
-
$[14] = renderStaticInput;
|
|
430
|
-
$[15] = t2;
|
|
431
|
-
} else t2 = $[15];
|
|
432
|
-
let t3;
|
|
433
|
-
if ($[16] !== formControl.control || $[17] !== formControl.name || $[18] !== t2) {
|
|
434
|
-
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
435
|
-
control: formControl.control,
|
|
436
|
-
name: formControl.name,
|
|
437
|
-
render: t2
|
|
438
|
-
});
|
|
439
|
-
$[16] = formControl.control;
|
|
440
|
-
$[17] = formControl.name;
|
|
441
|
-
$[18] = t2;
|
|
442
|
-
$[19] = t3;
|
|
443
|
-
} else t3 = $[19];
|
|
444
|
-
return t3;
|
|
445
|
-
}
|
|
446
|
-
let t2;
|
|
447
|
-
if ($[20] !== fullIso || $[21] !== props || $[22] !== renderStaticInput) {
|
|
448
|
-
t2 = /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
449
|
-
...props,
|
|
450
|
-
fullIso,
|
|
451
|
-
renderStaticInput
|
|
217
|
+
const { formControl, ref, ...innerProps } = props;
|
|
218
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
219
|
+
control: formControl.control,
|
|
220
|
+
name: formControl.name,
|
|
221
|
+
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
222
|
+
...innerProps,
|
|
223
|
+
ref: mergeRefs(ref, field.ref),
|
|
224
|
+
value: parseDateValue(field.value),
|
|
225
|
+
onChange: (value) => field.onChange(formatDateValue(value)),
|
|
226
|
+
onBlur: field.onBlur,
|
|
227
|
+
isDirty,
|
|
228
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
229
|
+
error: props.error ?? error?.message
|
|
230
|
+
})
|
|
452
231
|
});
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
232
|
+
}
|
|
233
|
+
return /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
234
|
+
...props,
|
|
235
|
+
value: parseDateValue(props.value),
|
|
236
|
+
onChange: (value) => props.onChange?.(formatDateValue(value))
|
|
237
|
+
});
|
|
459
238
|
};
|
|
460
|
-
function _temp(input) {
|
|
461
|
-
const container = input.getContainer?.() ?? input;
|
|
462
|
-
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
463
|
-
}
|
|
464
|
-
function _temp2() {}
|
|
465
239
|
//#endregion
|
|
466
240
|
export { DateTimePicker };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Ref
|
|
1
|
+
import { Ref } from 'react';
|
|
2
2
|
import { AriaTimeFieldProps, TimeValue } from 'react-aria';
|
|
3
3
|
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
5
5
|
import { ControlProps } from '../../shared/form.types';
|
|
6
6
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
7
|
-
interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<AriaTimeFieldProps<TimeValue>, "label"
|
|
7
|
+
interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<AriaTimeFieldProps<TimeValue>, "label"> {
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
9
|
disableDropdown?: boolean;
|
|
10
10
|
date?: string | null;
|
|
@@ -13,17 +13,13 @@ interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Ar
|
|
|
13
13
|
disableManualEntry?: boolean;
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
inputClassName?: string;
|
|
16
|
-
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
17
|
-
fireBlurOnChange?: boolean;
|
|
18
|
-
shouldForceLeadingZeros?: boolean;
|
|
19
16
|
}
|
|
20
17
|
export interface TimePickerProps extends Omit<TimePickerBaseProps, "value" | "onChange"> {
|
|
21
18
|
value?: string | null;
|
|
22
19
|
onChange?: (value: string | null) => void;
|
|
23
20
|
fullIso?: boolean;
|
|
24
21
|
timeZone?: string;
|
|
25
|
-
renderStaticInput?: boolean;
|
|
26
22
|
}
|
|
27
23
|
export type ControlledTimePickerProps<TFieldValues extends FieldValues> = ControlProps<TimePickerProps, TFieldValues>;
|
|
28
|
-
export declare const TimePicker: <TFieldValues extends FieldValues>(
|
|
24
|
+
export declare const TimePicker: <TFieldValues extends FieldValues>(props: ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
29
25
|
export {};
|