@povio/ui 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/AlignCenter.js +26 -11
- package/dist/assets/icons/AlignLeft.js +26 -11
- package/dist/assets/icons/AlignLeftRight.js +26 -11
- package/dist/assets/icons/AlignRight.js +26 -11
- package/dist/assets/icons/ArrowDropDown.js +26 -11
- package/dist/assets/icons/ArrowDropUp.js +26 -11
- package/dist/assets/icons/ArrowLeft.js +26 -11
- package/dist/assets/icons/ArrowRight.js +26 -11
- package/dist/assets/icons/Bold.js +26 -11
- package/dist/assets/icons/BulletedList.js +26 -11
- package/dist/assets/icons/Calendar.js +28 -13
- package/dist/assets/icons/Check.js +28 -13
- package/dist/assets/icons/CheckCircle.js +26 -11
- package/dist/assets/icons/CheckboxCheckmark.js +29 -14
- package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
- package/dist/assets/icons/ChevronDown.js +28 -13
- package/dist/assets/icons/ChevronLeft.js +28 -13
- package/dist/assets/icons/ChevronRight.js +28 -13
- package/dist/assets/icons/ChevronUp.js +28 -13
- package/dist/assets/icons/ChevronsLeft.js +28 -13
- package/dist/assets/icons/ChevronsRight.js +28 -13
- package/dist/assets/icons/Clock.js +26 -11
- package/dist/assets/icons/Close.js +26 -11
- package/dist/assets/icons/DateTime.js +35 -14
- package/dist/assets/icons/DragIndicator.js +26 -11
- package/dist/assets/icons/File.js +28 -13
- package/dist/assets/icons/Highlight.js +26 -11
- package/dist/assets/icons/HighlightOn.js +49 -15
- package/dist/assets/icons/Home.js +26 -11
- package/dist/assets/icons/Info.js +37 -16
- package/dist/assets/icons/Italic.js +26 -11
- package/dist/assets/icons/Link.js +26 -11
- package/dist/assets/icons/Menu.js +26 -11
- package/dist/assets/icons/NumberedList.js +26 -11
- package/dist/assets/icons/PointerHorizontal.js +26 -11
- package/dist/assets/icons/PointerVertical.js +26 -11
- package/dist/assets/icons/Search.js +26 -11
- package/dist/assets/icons/Send.js +28 -13
- package/dist/assets/icons/Strikethrough.js +26 -11
- package/dist/assets/icons/TextColor.js +48 -14
- package/dist/assets/icons/Today.js +26 -11
- package/dist/assets/icons/Underlined.js +28 -13
- package/dist/assets/icons/Upload.js +35 -14
- package/dist/assets/icons/Visibility.js +26 -11
- package/dist/assets/icons/VisibilityOff.js +26 -11
- package/dist/assets/icons/WarningFilled.js +28 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +32 -9
- package/dist/components/Menu/MenuMobile.js +102 -39
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/Button/button.cva.d.ts +3 -3
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
- package/dist/components/buttons/TextButton/TextButton.js +30 -8
- package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
- package/dist/components/buttons/shared/ButtonContent.js +80 -22
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +201 -35
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +380 -75
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +499 -186
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +14 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +280 -46
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +7 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +616 -121
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +342 -119
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +310 -103
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +150 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +233 -98
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +288 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +14 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +359 -129
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +18 -1
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +104 -11
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +83 -28
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
- package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +211 -65
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +5 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +15 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +32 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +41 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +99 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +91 -46
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/index.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +102 -15
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +0 -11
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -18
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +81 -22
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
- package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +13 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +14 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +446 -97
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +571 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +574 -0
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +8 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +305 -90
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +429 -90
- package/dist/components/inputs/Input/shared/InputContent.js +193 -59
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +15 -21
- package/dist/components/inputs/Inputs/InputItem.js +69 -14
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +353 -61
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +45 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +48 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +217 -22
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +107 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +37 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +178 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +227 -18
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -18
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +393 -138
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +397 -116
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +164 -52
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +14 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +43 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +67 -36
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +12 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +8 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +54 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +83 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +612 -0
- package/dist/components/inputs/Slider/Slider.d.ts +2 -1
- package/dist/components/inputs/Slider/Slider.js +265 -76
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -98
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +214 -37
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +21 -11
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +88 -12
- package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
- package/dist/components/inputs/shared/input.cva.d.ts +28 -0
- package/dist/components/inputs/shared/input.cva.js +38 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +8 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +15 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +112 -0
- package/dist/components/navigation/Accordion/Accordion.js +69 -22
- package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
- package/dist/components/navigation/Stepper/Stepper.js +67 -22
- package/dist/components/navigation/Stepper/StepperItem.js +104 -31
- package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
- package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
- package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
- package/dist/components/overlays/Drawer/Drawer.js +62 -20
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +85 -28
- package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/segment/Segment.js +218 -57
- package/dist/components/segment/SegmentItem.js +67 -10
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +28 -14
- package/dist/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +28 -27
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.js +42 -16
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.d.ts +20 -6
- package/dist/config/uiConfig.context.js +68 -14
- package/dist/config/uiOverrides.context.d.ts +30 -11
- package/dist/config/uiOverrides.context.js +54 -14
- package/dist/helpers/dynamicInputs.d.ts +12 -9
- package/dist/helpers/dynamicInputs.js +13 -8
- package/dist/hooks/useAutosave.d.ts +2 -1
- package/dist/hooks/useAutosave.js +12 -4
- package/dist/hooks/useAutosave.spec.d.ts +1 -0
- package/dist/hooks/useBreakpoint.js +16 -3
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useFilters.js +125 -64
- package/dist/hooks/useForm.js +42 -8
- package/dist/hooks/useFormAutosave.d.ts +3 -1
- package/dist/hooks/useFormAutosave.js +122 -30
- package/dist/hooks/useFormAutosave.spec.d.ts +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +91 -24
- package/dist/hooks/useKeyInteractions.d.ts +20 -0
- package/dist/hooks/useKeyInteractions.js +54 -0
- package/dist/hooks/useKeyInteractions.spec.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +43 -10
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.js +49 -19
- package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
- package/dist/hooks/useQueryAutocomplete.js +72 -0
- package/dist/hooks/useScrollableListBox.js +37 -16
- package/dist/hooks/useSorting.js +69 -28
- package/dist/hooks/useStateAndRef.js +21 -7
- package/dist/hooks/useTableColumnConfig.js +124 -31
- package/dist/hooks/useTranslationMemo.js +25 -5
- package/dist/index.d.ts +18 -3
- package/dist/index.js +15 -5
- package/dist/tw-ui-plugin.js +6 -0
- package/dist/utils/date-time.utils.d.ts +38 -10
- package/dist/utils/date-time.utils.js +136 -22
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/dist/utils/zod.utils.d.ts +2 -0
- package/dist/utils/zod.utils.js +5 -0
- package/package.json +2 -2
|
@@ -1,32 +1,41 @@
|
|
|
1
|
-
import { Ref } from 'react';
|
|
1
|
+
import { FocusEvent, 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';
|
|
6
7
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
7
8
|
import { ControlProps } from '../../shared/form.types';
|
|
8
9
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
9
|
-
interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<DateValue>, "granularity" | "shouldCloseOnSelect" | "label"> {
|
|
10
|
+
interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<DateValue>, "granularity" | "shouldCloseOnSelect" | "label" | "onBlur"> {
|
|
10
11
|
ref?: Ref<DatePickerInputHandle & HTMLDivElement>;
|
|
11
12
|
disableDropdown?: boolean;
|
|
12
13
|
isTimeOptional?: boolean;
|
|
13
14
|
isClearable?: boolean;
|
|
14
|
-
todayIcon?:
|
|
15
|
+
todayIcon?: DatePickerTodayIcon;
|
|
16
|
+
todayIconButtonSize?: DatePickerTodayIconButtonSize;
|
|
17
|
+
todayIconButtonComponent?: DatePickerTodayIconButtonComponent;
|
|
18
|
+
todayIconPlacement?: DatePickerTodayIconPlacement;
|
|
15
19
|
isDirty?: boolean;
|
|
16
20
|
disableManualEntry?: boolean;
|
|
21
|
+
autoFixYear?: boolean;
|
|
22
|
+
setDateValueOnDateSelection?: boolean;
|
|
17
23
|
placeholder?: string;
|
|
18
24
|
inputClassName?: string;
|
|
25
|
+
shouldShrinkInput?: boolean;
|
|
19
26
|
shouldUpdateDateOnMonthYearChange?: boolean;
|
|
20
27
|
timeZone?: string;
|
|
21
|
-
autoFixYear?: boolean;
|
|
22
28
|
format?: string;
|
|
29
|
+
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
30
|
+
fireBlurOnChange?: boolean;
|
|
23
31
|
}
|
|
24
32
|
export interface DateTimePickerProps extends Omit<DateTimePickerBaseProps, "value" | "onChange"> {
|
|
25
33
|
value?: string | null;
|
|
26
34
|
onChange?: (value: string | null) => void;
|
|
27
35
|
fullIso?: boolean;
|
|
36
|
+
renderStaticInput?: boolean;
|
|
28
37
|
timeZone?: string;
|
|
29
38
|
}
|
|
30
39
|
export type ControlledDateTimePickerProps<TFieldValues extends FieldValues> = ControlProps<DateTimePickerProps, TFieldValues>;
|
|
31
|
-
export declare const DateTimePicker: <TFieldValues extends FieldValues>({ fullIso, ...props }: ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare const DateTimePicker: <TFieldValues extends FieldValues>({ fullIso, renderStaticInput, ...props }: ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
32
41
|
export {};
|
|
@@ -1,24 +1,49 @@
|
|
|
1
|
+
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
1
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
3
|
import { Calendar } from "../shared/Calendar.js";
|
|
3
4
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
5
|
+
import { datePickerInputContentRowDefinition } from "../shared/datePickerInput.cva.js";
|
|
6
|
+
import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
|
|
4
7
|
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
5
8
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
6
9
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
10
|
+
import { getStaticCalendarDateTimeSegments, getStaticDateTimeFocusTarget } from "../shared/staticDateTimeSegments.js";
|
|
7
11
|
import { FormField } from "../../FormField/FormField.js";
|
|
8
12
|
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";
|
|
9
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import {
|
|
18
|
+
import { clsx } from "clsx";
|
|
19
|
+
import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
11
20
|
import { useDatePicker, useLocale } from "react-aria";
|
|
12
21
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
22
|
import { Controller } from "react-hook-form";
|
|
14
|
-
import { Time, createCalendar, getLocalTimeZone,
|
|
23
|
+
import { Time, createCalendar, getLocalTimeZone, toCalendarDate, toCalendarDateTime, today } from "@internationalized/date";
|
|
15
24
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
16
25
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
17
26
|
var DateTimePickerBase = (props) => {
|
|
18
27
|
const ui = UIConfig.useConfig();
|
|
19
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel
|
|
28
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, shouldShrinkInput, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone: timeZoneProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
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;
|
|
20
45
|
let effectiveTimeZone = getLocalTimeZone();
|
|
21
|
-
if (timeZone) effectiveTimeZone = timeZone;
|
|
46
|
+
if (timeZone !== "clientLocal") effectiveTimeZone = timeZone;
|
|
22
47
|
const formFieldProps = {
|
|
23
48
|
error,
|
|
24
49
|
label,
|
|
@@ -36,12 +61,20 @@ var DateTimePickerBase = (props) => {
|
|
|
36
61
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
37
62
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
38
63
|
} }), []);
|
|
39
|
-
useImperativeHandle(ref, () => ({
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
useImperativeHandle(ref, () => ({
|
|
65
|
+
clear: () => {
|
|
66
|
+
datePickerInputRef.current?.clear();
|
|
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;
|
|
42
75
|
const dialogState = useDatePickerState({
|
|
43
76
|
...rest,
|
|
44
|
-
defaultValue:
|
|
77
|
+
defaultValue: normalizedValue ?? rest.defaultValue ?? null,
|
|
45
78
|
shouldCloseOnSelect: false,
|
|
46
79
|
granularity: "minute",
|
|
47
80
|
hideTimeZone: true,
|
|
@@ -53,11 +86,12 @@ var DateTimePickerBase = (props) => {
|
|
|
53
86
|
const state = useDatePickerState({
|
|
54
87
|
...rest,
|
|
55
88
|
shouldForceLeadingZeros,
|
|
56
|
-
value,
|
|
57
|
-
onChange: (
|
|
58
|
-
onChange?.(
|
|
59
|
-
dialogState.setValue(
|
|
60
|
-
calendarState.setFocusedDate(
|
|
89
|
+
value: normalizedValue,
|
|
90
|
+
onChange: (val_0) => {
|
|
91
|
+
onChange?.(val_0);
|
|
92
|
+
dialogState.setValue(val_0);
|
|
93
|
+
calendarState.setFocusedDate(val_0 || today(effectiveTimeZone));
|
|
94
|
+
if (fireBlurOnChange) debouncedBlur(val_0);
|
|
61
95
|
},
|
|
62
96
|
shouldCloseOnSelect: false,
|
|
63
97
|
granularity: "minute",
|
|
@@ -93,8 +127,10 @@ var DateTimePickerBase = (props) => {
|
|
|
93
127
|
labelProps
|
|
94
128
|
};
|
|
95
129
|
const onApply = () => {
|
|
96
|
-
|
|
130
|
+
const newValue = dialogState.value;
|
|
131
|
+
state.setValue(newValue);
|
|
97
132
|
state.toggle();
|
|
133
|
+
if (fireBlurOnChange) handleBlur(newValue);
|
|
98
134
|
};
|
|
99
135
|
const onMonthYearChange = (selectedDate) => {
|
|
100
136
|
if (!shouldUpdateDateOnMonthYearChange) return;
|
|
@@ -112,8 +148,14 @@ var DateTimePickerBase = (props) => {
|
|
|
112
148
|
calendarState.setFocusedDate(selectedDate);
|
|
113
149
|
};
|
|
114
150
|
const onTodayPress = () => {
|
|
115
|
-
|
|
116
|
-
|
|
151
|
+
const currentValue = DateTimeUtils.getCurrentWallClockCalendarDateTime();
|
|
152
|
+
dialogState.setValue(currentValue);
|
|
153
|
+
calendarState.setFocusedDate(toCalendarDate(currentValue));
|
|
154
|
+
};
|
|
155
|
+
const onInputClear = () => {
|
|
156
|
+
onChange?.(null);
|
|
157
|
+
dialogState.setValue(null);
|
|
158
|
+
if (fireBlurOnChange) handleBlur(null);
|
|
117
159
|
};
|
|
118
160
|
const onOpenChange = (isOpen) => {
|
|
119
161
|
state.toggle();
|
|
@@ -126,7 +168,7 @@ var DateTimePickerBase = (props) => {
|
|
|
126
168
|
dialogState.setValue(state.value);
|
|
127
169
|
return;
|
|
128
170
|
}
|
|
129
|
-
const textValue = e
|
|
171
|
+
const textValue = e?.currentTarget?.textContent ?? null;
|
|
130
172
|
const dateTimeValue = DateTimeUtils.formatTextDateToCalendarDateTime(textValue, effectiveTimeZone, locale);
|
|
131
173
|
if (dateTimeValue) {
|
|
132
174
|
state.setValue(dateTimeValue);
|
|
@@ -150,11 +192,15 @@ var DateTimePickerBase = (props) => {
|
|
|
150
192
|
groupProps,
|
|
151
193
|
fieldProps: {
|
|
152
194
|
...fieldProps,
|
|
153
|
-
onBlur: (
|
|
154
|
-
fieldProps.onBlur?.(
|
|
155
|
-
|
|
195
|
+
onBlur: (e_0) => {
|
|
196
|
+
fieldProps.onBlur?.(e_0);
|
|
197
|
+
handleBlur(state.value);
|
|
198
|
+
onInputBlur(e_0);
|
|
156
199
|
}
|
|
157
200
|
},
|
|
201
|
+
fieldValue: normalizedValue,
|
|
202
|
+
isValueControlled: true,
|
|
203
|
+
hasValue: normalizedValue != null,
|
|
158
204
|
buttonProps,
|
|
159
205
|
isDirty,
|
|
160
206
|
isDisabled,
|
|
@@ -163,18 +209,24 @@ var DateTimePickerBase = (props) => {
|
|
|
163
209
|
variant,
|
|
164
210
|
size,
|
|
165
211
|
isDateTime: true,
|
|
212
|
+
shouldShrinkInput,
|
|
166
213
|
isClearable,
|
|
167
214
|
headerProps,
|
|
168
215
|
todayIcon,
|
|
216
|
+
todayIconButtonSize,
|
|
217
|
+
todayIconButtonComponent,
|
|
218
|
+
todayIconPlacement,
|
|
169
219
|
isRequired,
|
|
170
220
|
disableManualEntry,
|
|
221
|
+
autoFixYear,
|
|
171
222
|
placeholder,
|
|
172
223
|
onOpenDropdown: () => state.toggle(),
|
|
173
224
|
className: inputClassName,
|
|
174
225
|
timeZone: effectiveTimeZone,
|
|
175
|
-
autoFixYear,
|
|
176
226
|
isTimeOptional,
|
|
177
|
-
format
|
|
227
|
+
format,
|
|
228
|
+
fireBlurOnChange,
|
|
229
|
+
onClear: onInputClear
|
|
178
230
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
179
231
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
180
232
|
isDisabled,
|
|
@@ -195,46 +247,228 @@ var DateTimePickerBase = (props) => {
|
|
|
195
247
|
onApply,
|
|
196
248
|
onMonthYearChange,
|
|
197
249
|
granularity: "day",
|
|
250
|
+
setDateValueOnDateSelection,
|
|
198
251
|
isTimeOptional
|
|
199
252
|
})
|
|
200
253
|
})]
|
|
201
254
|
})
|
|
202
255
|
});
|
|
203
256
|
};
|
|
204
|
-
var
|
|
257
|
+
var DateTimePickerInner = (t0) => {
|
|
258
|
+
const $ = c(9);
|
|
259
|
+
const { fullIso: t1, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
260
|
+
const ui = UIConfig.useConfig();
|
|
261
|
+
const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
|
|
262
|
+
const { locale } = useLocale();
|
|
263
|
+
const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
|
|
264
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
265
|
+
const inputRef = useRef(null);
|
|
266
|
+
const { renderRealInput, replayStaticInputPress } = useStaticInputHandoff({
|
|
267
|
+
inputRef,
|
|
268
|
+
renderInput,
|
|
269
|
+
setRenderInput,
|
|
270
|
+
getFocusTarget: _temp,
|
|
271
|
+
getPressTarget: _temp2
|
|
272
|
+
});
|
|
273
|
+
const normalizedValue = props.value ?? null;
|
|
274
|
+
const timeZone = props.timeZone ?? ui.dateInput.timeZone;
|
|
205
275
|
let effectiveTimeZone = getLocalTimeZone();
|
|
206
|
-
if (
|
|
276
|
+
if (timeZone !== "clientLocal") effectiveTimeZone = timeZone;
|
|
207
277
|
const formatDateValue = (dateValue) => {
|
|
208
278
|
if (dateValue === null) return null;
|
|
209
|
-
if (fullIso) return DateTimeUtils.fromDateValueToISO(dateValue, effectiveTimeZone);
|
|
210
279
|
return DateTimeUtils.fromDateValueToISO(dateValue, effectiveTimeZone);
|
|
211
280
|
};
|
|
212
281
|
const parseDateValue = (isoString) => {
|
|
213
|
-
if (isoString == null) return
|
|
282
|
+
if (isoString == null) return null;
|
|
214
283
|
return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, effectiveTimeZone);
|
|
215
284
|
};
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
285
|
+
if (!renderInput) {
|
|
286
|
+
const dateTimeValue = normalizedValue ? parseDateValue(normalizedValue) : null;
|
|
287
|
+
const as = props.as ?? ui.input.as;
|
|
288
|
+
const size = props.size ?? ui.input.size;
|
|
289
|
+
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
290
|
+
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
291
|
+
const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
|
|
292
|
+
const todayIconButtonComponent = props.todayIconButtonComponent ?? ui.dateInput.todayIconButtonComponent;
|
|
293
|
+
const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
|
|
294
|
+
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, {
|
|
295
|
+
isDisabled,
|
|
296
|
+
renderStatic: true,
|
|
297
|
+
size: todayIconButtonSize,
|
|
298
|
+
todayIconButtonComponent
|
|
299
|
+
});
|
|
300
|
+
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
301
|
+
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
302
|
+
const staticSegments = getStaticCalendarDateTimeSegments({
|
|
303
|
+
value: dateTimeValue,
|
|
304
|
+
locale,
|
|
305
|
+
shouldForceLeadingZeros,
|
|
306
|
+
isDisabled,
|
|
307
|
+
hidePlaceholder: as === "floating" && !dateTimeValue,
|
|
308
|
+
disableManualEntry,
|
|
309
|
+
placeholder: props.placeholder
|
|
310
|
+
});
|
|
311
|
+
return /* @__PURE__ */ jsx(InputFrame, {
|
|
312
|
+
...props,
|
|
313
|
+
isDisabled,
|
|
314
|
+
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
315
|
+
inputClassName: clsx(props.shouldShrinkInput ? "min-w-0" : "min-w-input-width-min-width", props.inputClassName),
|
|
316
|
+
contentClassName: "pr-0!",
|
|
317
|
+
contentWrapperClassName: datePickerInputContentRowCva({ size }),
|
|
318
|
+
contentGroup: "date-picker",
|
|
319
|
+
labelPlacement: "content-row",
|
|
320
|
+
dataAttributes: {
|
|
321
|
+
dataIsEmpty: dateTimeValue == null,
|
|
322
|
+
dataIsFilled: dateTimeValue != null,
|
|
323
|
+
dataIsDirty: props.isDirty,
|
|
324
|
+
dataIsRequired: props.isRequired,
|
|
325
|
+
dataIsDisabled: isDisabled,
|
|
326
|
+
dataDisabled: isDisabled,
|
|
327
|
+
dataInvalid: !!props.error,
|
|
328
|
+
dataHasSelection: dateTimeValue != null
|
|
329
|
+
},
|
|
330
|
+
onStaticInteract: renderRealInput,
|
|
331
|
+
onStaticPress: replayStaticInputPress,
|
|
332
|
+
staticPressTarget: "action",
|
|
333
|
+
actionContent: staticTodayIcon,
|
|
334
|
+
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
335
|
+
showClear: dateTimeValue != null,
|
|
336
|
+
wrapContentAndTrailing: true,
|
|
337
|
+
contentAndTrailingClassName: "gap-2!",
|
|
338
|
+
trailingClassName: "py-0! pl-0!",
|
|
339
|
+
action: showDropdown ? {
|
|
340
|
+
icon: ui.dateInput.dateTimeIcon,
|
|
341
|
+
onClick: _temp3,
|
|
342
|
+
altText: ""
|
|
343
|
+
} : void 0,
|
|
344
|
+
children: staticSegments
|
|
231
345
|
});
|
|
232
346
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
347
|
+
const T0 = DateTimePickerBase;
|
|
348
|
+
const t2 = mergeRefs(props.ref, inputRef);
|
|
349
|
+
const t3 = parseDateValue(normalizedValue);
|
|
350
|
+
let t4;
|
|
351
|
+
if ($[0] !== formatDateValue || $[1] !== props) {
|
|
352
|
+
t4 = (value) => props.onChange?.(formatDateValue(value));
|
|
353
|
+
$[0] = formatDateValue;
|
|
354
|
+
$[1] = props;
|
|
355
|
+
$[2] = t4;
|
|
356
|
+
} else t4 = $[2];
|
|
357
|
+
let t5;
|
|
358
|
+
if ($[3] !== T0 || $[4] !== props || $[5] !== t2 || $[6] !== t3 || $[7] !== t4) {
|
|
359
|
+
t5 = /* @__PURE__ */ jsx(T0, {
|
|
360
|
+
...props,
|
|
361
|
+
ref: t2,
|
|
362
|
+
value: t3,
|
|
363
|
+
onChange: t4
|
|
364
|
+
});
|
|
365
|
+
$[3] = T0;
|
|
366
|
+
$[4] = props;
|
|
367
|
+
$[5] = t2;
|
|
368
|
+
$[6] = t3;
|
|
369
|
+
$[7] = t4;
|
|
370
|
+
$[8] = t5;
|
|
371
|
+
} else t5 = $[8];
|
|
372
|
+
return t5;
|
|
373
|
+
};
|
|
374
|
+
var DateTimePicker = (t0) => {
|
|
375
|
+
const $ = c(24);
|
|
376
|
+
let props;
|
|
377
|
+
let renderStaticInput;
|
|
378
|
+
let t1;
|
|
379
|
+
if ($[0] !== t0) {
|
|
380
|
+
({fullIso: t1, renderStaticInput, ...props} = t0);
|
|
381
|
+
$[0] = t0;
|
|
382
|
+
$[1] = props;
|
|
383
|
+
$[2] = renderStaticInput;
|
|
384
|
+
$[3] = t1;
|
|
385
|
+
} else {
|
|
386
|
+
props = $[1];
|
|
387
|
+
renderStaticInput = $[2];
|
|
388
|
+
t1 = $[3];
|
|
389
|
+
}
|
|
390
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
391
|
+
if ("formControl" in props && props.formControl) {
|
|
392
|
+
let formControl;
|
|
393
|
+
let innerProps;
|
|
394
|
+
let ref;
|
|
395
|
+
if ($[4] !== props) {
|
|
396
|
+
({formControl, ref, ...innerProps} = props);
|
|
397
|
+
$[4] = props;
|
|
398
|
+
$[5] = formControl;
|
|
399
|
+
$[6] = innerProps;
|
|
400
|
+
$[7] = ref;
|
|
401
|
+
} else {
|
|
402
|
+
formControl = $[5];
|
|
403
|
+
innerProps = $[6];
|
|
404
|
+
ref = $[7];
|
|
405
|
+
}
|
|
406
|
+
const controlWithOptions = formControl.control;
|
|
407
|
+
let t2;
|
|
408
|
+
if ($[8] !== controlWithOptions._options?.disabled || $[9] !== fullIso || $[10] !== innerProps || $[11] !== props.error || $[12] !== props.isDisabled || $[13] !== ref || $[14] !== renderStaticInput) {
|
|
409
|
+
t2 = (t3) => {
|
|
410
|
+
const { field, fieldState: t4 } = t3;
|
|
411
|
+
const { error, isDirty } = t4;
|
|
412
|
+
return /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
413
|
+
...innerProps,
|
|
414
|
+
ref: mergeRefs(ref, field.ref),
|
|
415
|
+
value: field.value ?? null,
|
|
416
|
+
onChange: field.onChange,
|
|
417
|
+
onBlur: field.onBlur,
|
|
418
|
+
isDirty,
|
|
419
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
420
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
421
|
+
error: props.error ?? error?.message,
|
|
422
|
+
fullIso,
|
|
423
|
+
renderStaticInput
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
$[8] = controlWithOptions._options?.disabled;
|
|
427
|
+
$[9] = fullIso;
|
|
428
|
+
$[10] = innerProps;
|
|
429
|
+
$[11] = props.error;
|
|
430
|
+
$[12] = props.isDisabled;
|
|
431
|
+
$[13] = ref;
|
|
432
|
+
$[14] = renderStaticInput;
|
|
433
|
+
$[15] = t2;
|
|
434
|
+
} else t2 = $[15];
|
|
435
|
+
let t3;
|
|
436
|
+
if ($[16] !== formControl.control || $[17] !== formControl.name || $[18] !== t2) {
|
|
437
|
+
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
438
|
+
control: formControl.control,
|
|
439
|
+
name: formControl.name,
|
|
440
|
+
render: t2
|
|
441
|
+
});
|
|
442
|
+
$[16] = formControl.control;
|
|
443
|
+
$[17] = formControl.name;
|
|
444
|
+
$[18] = t2;
|
|
445
|
+
$[19] = t3;
|
|
446
|
+
} else t3 = $[19];
|
|
447
|
+
return t3;
|
|
448
|
+
}
|
|
449
|
+
let t2;
|
|
450
|
+
if ($[20] !== fullIso || $[21] !== props || $[22] !== renderStaticInput) {
|
|
451
|
+
t2 = /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
452
|
+
...props,
|
|
453
|
+
fullIso,
|
|
454
|
+
renderStaticInput
|
|
455
|
+
});
|
|
456
|
+
$[20] = fullIso;
|
|
457
|
+
$[21] = props;
|
|
458
|
+
$[22] = renderStaticInput;
|
|
459
|
+
$[23] = t2;
|
|
460
|
+
} else t2 = $[23];
|
|
461
|
+
return t2;
|
|
238
462
|
};
|
|
463
|
+
function _temp(input, staticTarget) {
|
|
464
|
+
const container = input.getContainer?.() ?? input;
|
|
465
|
+
return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
|
|
466
|
+
}
|
|
467
|
+
function _temp2(input_0) {
|
|
468
|
+
const container_0 = input_0.getContainer?.() ?? input_0;
|
|
469
|
+
if (!(container_0 instanceof HTMLElement)) return null;
|
|
470
|
+
return container_0.querySelector("[data-static-press-action]");
|
|
471
|
+
}
|
|
472
|
+
function _temp3() {}
|
|
239
473
|
//#endregion
|
|
240
474
|
export { DateTimePicker };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Ref } from 'react';
|
|
1
|
+
import { Ref, FocusEvent } 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" | "onBlur"> {
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
9
|
disableDropdown?: boolean;
|
|
10
10
|
date?: string | null;
|
|
@@ -13,13 +13,17 @@ 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;
|
|
16
19
|
}
|
|
17
20
|
export interface TimePickerProps extends Omit<TimePickerBaseProps, "value" | "onChange"> {
|
|
18
21
|
value?: string | null;
|
|
19
22
|
onChange?: (value: string | null) => void;
|
|
20
23
|
fullIso?: boolean;
|
|
21
24
|
timeZone?: string;
|
|
25
|
+
renderStaticInput?: boolean;
|
|
22
26
|
}
|
|
23
27
|
export type ControlledTimePickerProps<TFieldValues extends FieldValues> = ControlProps<TimePickerProps, TFieldValues>;
|
|
24
|
-
export declare const TimePicker: <TFieldValues extends FieldValues>(props: ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const TimePicker: <TFieldValues extends FieldValues>({ renderStaticInput, ...props }: ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
25
29
|
export {};
|