@povio/ui 2.3.0-rc.4 → 2.3.0-rc.40
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 +97 -38
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- 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 +193 -34
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +289 -93
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +376 -189
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +189 -75
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +559 -159
- package/dist/components/inputs/DateTime/shared/Calendar.js +333 -137
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +301 -102
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +146 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +245 -90
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.js +311 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +7 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +374 -147
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +3 -2
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +93 -21
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
- 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 +3 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +208 -70
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +9 -1
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +43 -7
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +16 -8
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +46 -41
- package/dist/components/inputs/File/FileUpload.js +86 -44
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -35
- package/dist/components/inputs/File/shared/InputUploadFilled.js +50 -9
- package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.js +79 -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.js +40 -9
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +400 -125
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +486 -146
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.js +298 -89
- package/dist/components/inputs/Input/TextInput/TextInput.js +370 -121
- package/dist/components/inputs/Input/shared/InputContent.js +190 -58
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +0 -1
- package/dist/components/inputs/Inputs/InputItem.js +65 -16
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.js +320 -108
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +146 -50
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +4 -4
- package/dist/components/inputs/Selection/Select/QuerySelect.js +90 -28
- package/dist/components/inputs/Selection/Select/Select.js +140 -45
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +328 -137
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
- 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.js +3 -2
- 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 +1 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +12 -1
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +47 -39
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +3 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +445 -117
- package/dist/components/inputs/Slider/Slider.d.ts +2 -1
- package/dist/components/inputs/Slider/Slider.js +265 -78
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
- 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 +212 -41
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.js +21 -10
- package/dist/components/inputs/shared/InputClear.js +88 -21
- package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
- package/dist/components/inputs/shared/input.cva.js +35 -13
- package/dist/components/inputs/shared/label.cva.js +2 -2
- package/dist/components/inputs/shared/useStaticInputHandoff.js +83 -40
- 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 +122 -25
- 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 +83 -27
- 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/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +21 -13
- 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 +23 -23
- 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 +7 -5
- package/dist/config/uiConfig.context.js +52 -12
- package/dist/config/uiStyle.context.js +15 -5
- package/dist/helpers/dynamicInputs.d.ts +1 -1
- 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.js +101 -30
- package/dist/hooks/useIntersectionObserver.js +86 -32
- 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.js +1 -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.js +2 -2
- package/dist/tw-ui-plugin.js +6 -1
- package/dist/utils/date-time.utils.d.ts +7 -0
- package/dist/utils/date-time.utils.js +34 -23
- package/dist/utils/dom.utils.js +1 -1
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omi
|
|
|
25
25
|
timeZone?: string;
|
|
26
26
|
format?: string;
|
|
27
27
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
28
|
+
fireBlurOnChange?: boolean;
|
|
28
29
|
}
|
|
29
30
|
export interface DateTimePickerProps extends Omit<DateTimePickerBaseProps, "value" | "onChange"> {
|
|
30
31
|
value?: string | null;
|
|
@@ -13,18 +13,19 @@ import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
|
13
13
|
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
14
14
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
15
15
|
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
16
|
+
import { c } from "react/compiler-runtime";
|
|
16
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
18
|
import { clsx } from "clsx";
|
|
18
19
|
import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
19
20
|
import { useDatePicker, useLocale } from "react-aria";
|
|
20
21
|
import { mergeRefs } from "@react-aria/utils";
|
|
21
|
-
import { Controller
|
|
22
|
-
import { Time, createCalendar,
|
|
22
|
+
import { Controller } from "react-hook-form";
|
|
23
|
+
import { Time, createCalendar, toCalendarDate, toCalendarDateTime, today } from "@internationalized/date";
|
|
23
24
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
24
25
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
25
26
|
var DateTimePickerBase = (props) => {
|
|
26
27
|
const ui = UIConfig.useConfig();
|
|
27
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone, autoFixYear: autoFixYearProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
28
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone: _timeZone, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
28
29
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
29
30
|
const variant = variantProp ?? ui.input.variant;
|
|
30
31
|
const as = asProp ?? ui.input.as;
|
|
@@ -37,9 +38,9 @@ var DateTimePickerBase = (props) => {
|
|
|
37
38
|
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
38
39
|
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
39
40
|
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
41
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
40
42
|
const setDateValueOnDateSelection = setDateValueOnDateSelectionProp ?? ui.dateInput.setDateValueOnDateSelection;
|
|
41
|
-
|
|
42
|
-
if (timeZone) effectiveTimeZone = timeZone;
|
|
43
|
+
const effectiveTimeZone = "UTC";
|
|
43
44
|
const formFieldProps = {
|
|
44
45
|
error,
|
|
45
46
|
label,
|
|
@@ -57,16 +58,20 @@ var DateTimePickerBase = (props) => {
|
|
|
57
58
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
58
59
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
59
60
|
} }), []);
|
|
60
|
-
useImperativeHandle(ref, () => ({
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
useImperativeHandle(ref, () => ({
|
|
62
|
+
clear: () => {
|
|
63
|
+
datePickerInputRef.current?.clear();
|
|
64
|
+
},
|
|
65
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
66
|
+
}));
|
|
63
67
|
const handleBlur = (val) => {
|
|
64
68
|
onBlur?.({ target: { value: val } });
|
|
65
69
|
};
|
|
66
70
|
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
71
|
+
const normalizedValue = value ?? null;
|
|
67
72
|
const dialogState = useDatePickerState({
|
|
68
73
|
...rest,
|
|
69
|
-
defaultValue:
|
|
74
|
+
defaultValue: normalizedValue ?? rest.defaultValue ?? null,
|
|
70
75
|
shouldCloseOnSelect: false,
|
|
71
76
|
granularity: "minute",
|
|
72
77
|
hideTimeZone: true,
|
|
@@ -78,12 +83,12 @@ var DateTimePickerBase = (props) => {
|
|
|
78
83
|
const state = useDatePickerState({
|
|
79
84
|
...rest,
|
|
80
85
|
shouldForceLeadingZeros,
|
|
81
|
-
value,
|
|
82
|
-
onChange: (
|
|
83
|
-
onChange?.(
|
|
84
|
-
dialogState.setValue(
|
|
85
|
-
calendarState.setFocusedDate(
|
|
86
|
-
debouncedBlur(
|
|
86
|
+
value: normalizedValue,
|
|
87
|
+
onChange: (val_0) => {
|
|
88
|
+
onChange?.(val_0);
|
|
89
|
+
dialogState.setValue(val_0);
|
|
90
|
+
calendarState.setFocusedDate(val_0 || today(effectiveTimeZone));
|
|
91
|
+
if (fireBlurOnChange) debouncedBlur(val_0);
|
|
87
92
|
},
|
|
88
93
|
shouldCloseOnSelect: false,
|
|
89
94
|
granularity: "minute",
|
|
@@ -122,7 +127,7 @@ var DateTimePickerBase = (props) => {
|
|
|
122
127
|
const newValue = dialogState.value;
|
|
123
128
|
state.setValue(newValue);
|
|
124
129
|
state.toggle();
|
|
125
|
-
handleBlur(newValue);
|
|
130
|
+
if (fireBlurOnChange) handleBlur(newValue);
|
|
126
131
|
};
|
|
127
132
|
const onMonthYearChange = (selectedDate) => {
|
|
128
133
|
if (!shouldUpdateDateOnMonthYearChange) return;
|
|
@@ -140,8 +145,9 @@ var DateTimePickerBase = (props) => {
|
|
|
140
145
|
calendarState.setFocusedDate(selectedDate);
|
|
141
146
|
};
|
|
142
147
|
const onTodayPress = () => {
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
const currentValue = DateTimeUtils.getCurrentWallClockCalendarDateTime();
|
|
149
|
+
dialogState.setValue(currentValue);
|
|
150
|
+
calendarState.setFocusedDate(toCalendarDate(currentValue));
|
|
145
151
|
};
|
|
146
152
|
const onOpenChange = (isOpen) => {
|
|
147
153
|
state.toggle();
|
|
@@ -154,7 +160,7 @@ var DateTimePickerBase = (props) => {
|
|
|
154
160
|
dialogState.setValue(state.value);
|
|
155
161
|
return;
|
|
156
162
|
}
|
|
157
|
-
const textValue = e
|
|
163
|
+
const textValue = e?.currentTarget?.textContent ?? null;
|
|
158
164
|
const dateTimeValue = DateTimeUtils.formatTextDateToCalendarDateTime(textValue, effectiveTimeZone, locale);
|
|
159
165
|
if (dateTimeValue) {
|
|
160
166
|
state.setValue(dateTimeValue);
|
|
@@ -170,7 +176,7 @@ var DateTimePickerBase = (props) => {
|
|
|
170
176
|
...formFieldProps,
|
|
171
177
|
as,
|
|
172
178
|
labelProps,
|
|
173
|
-
className: "relative inline-flex w-full flex-col text-left",
|
|
179
|
+
className: "group relative inline-flex w-full flex-col text-left",
|
|
174
180
|
tabIndex: as === "inline" ? -1 : void 0,
|
|
175
181
|
children: [/* @__PURE__ */ jsx(DatePickerInput, {
|
|
176
182
|
ref: mergeRefs(ref, datePickerInputRef),
|
|
@@ -178,11 +184,15 @@ var DateTimePickerBase = (props) => {
|
|
|
178
184
|
groupProps,
|
|
179
185
|
fieldProps: {
|
|
180
186
|
...fieldProps,
|
|
181
|
-
onBlur: (
|
|
182
|
-
fieldProps.onBlur?.(
|
|
183
|
-
|
|
187
|
+
onBlur: (e_0) => {
|
|
188
|
+
fieldProps.onBlur?.(e_0);
|
|
189
|
+
handleBlur(state.value);
|
|
190
|
+
onInputBlur(e_0);
|
|
184
191
|
}
|
|
185
192
|
},
|
|
193
|
+
fieldValue: normalizedValue,
|
|
194
|
+
isValueControlled: true,
|
|
195
|
+
hasValue: normalizedValue != null,
|
|
186
196
|
buttonProps,
|
|
187
197
|
isDirty,
|
|
188
198
|
isDisabled,
|
|
@@ -204,7 +214,8 @@ var DateTimePickerBase = (props) => {
|
|
|
204
214
|
className: inputClassName,
|
|
205
215
|
timeZone: effectiveTimeZone,
|
|
206
216
|
isTimeOptional,
|
|
207
|
-
format
|
|
217
|
+
format,
|
|
218
|
+
fireBlurOnChange
|
|
208
219
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
209
220
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
210
221
|
isDisabled,
|
|
@@ -231,7 +242,9 @@ var DateTimePickerBase = (props) => {
|
|
|
231
242
|
})
|
|
232
243
|
});
|
|
233
244
|
};
|
|
234
|
-
var
|
|
245
|
+
var DateTimePickerInner = (t0) => {
|
|
246
|
+
const $ = c(9);
|
|
247
|
+
const { fullIso: t1, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
235
248
|
const ui = UIConfig.useConfig();
|
|
236
249
|
const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
|
|
237
250
|
const { locale } = useLocale();
|
|
@@ -242,37 +255,24 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
242
255
|
inputRef,
|
|
243
256
|
renderInput,
|
|
244
257
|
setRenderInput,
|
|
245
|
-
getFocusTarget:
|
|
246
|
-
return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
|
|
247
|
-
}
|
|
258
|
+
getFocusTarget: _temp
|
|
248
259
|
});
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}) : props.value;
|
|
253
|
-
let isFormControlDisabled = false;
|
|
254
|
-
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
255
|
-
const rawValue = watchedValue ?? props.value ?? null;
|
|
256
|
-
let effectiveTimeZone = getLocalTimeZone();
|
|
257
|
-
if (props.timeZone) effectiveTimeZone = props.timeZone;
|
|
258
|
-
const formatDateValue = (dateValue) => {
|
|
259
|
-
if (dateValue === null) return null;
|
|
260
|
-
if (fullIso) return DateTimeUtils.fromDateValueToISO(dateValue, effectiveTimeZone);
|
|
261
|
-
return DateTimeUtils.fromDateValueToISO(dateValue, effectiveTimeZone);
|
|
262
|
-
};
|
|
263
|
-
const parseDateValue = (isoString) => {
|
|
264
|
-
if (isoString == null) return isoString;
|
|
265
|
-
return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, effectiveTimeZone);
|
|
266
|
-
};
|
|
260
|
+
const normalizedValue = props.value ?? null;
|
|
261
|
+
const formatDateValue = _temp2;
|
|
262
|
+
const parseDateValue = _temp3;
|
|
267
263
|
if (!renderInput) {
|
|
268
|
-
const dateTimeValue =
|
|
264
|
+
const dateTimeValue = normalizedValue ? parseDateValue(normalizedValue) : null;
|
|
269
265
|
const as = props.as ?? ui.input.as;
|
|
270
266
|
const size = props.size ?? ui.input.size;
|
|
271
267
|
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
272
268
|
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
273
269
|
const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
|
|
274
270
|
const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
|
|
275
|
-
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon,
|
|
271
|
+
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, {
|
|
272
|
+
isDisabled,
|
|
273
|
+
renderStatic: true,
|
|
274
|
+
size: todayIconButtonSize
|
|
275
|
+
});
|
|
276
276
|
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
277
277
|
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
278
278
|
const staticSegments = getStaticCalendarDateTimeSegments({
|
|
@@ -280,58 +280,172 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
280
280
|
locale,
|
|
281
281
|
shouldForceLeadingZeros,
|
|
282
282
|
isDisabled,
|
|
283
|
-
hidePlaceholder: as === "floating" && !dateTimeValue
|
|
283
|
+
hidePlaceholder: as === "floating" && !dateTimeValue,
|
|
284
|
+
disableManualEntry,
|
|
285
|
+
placeholder: props.placeholder
|
|
284
286
|
});
|
|
285
287
|
return /* @__PURE__ */ jsx(InputFrame, {
|
|
286
288
|
...props,
|
|
287
289
|
isDisabled,
|
|
288
|
-
className: clsx("relative inline-flex w-full flex-col text-left", props.className),
|
|
290
|
+
className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
|
|
289
291
|
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
290
292
|
contentClassName: "pr-0!",
|
|
291
293
|
contentWrapperClassName: datePickerInputContentRowCva({ size }),
|
|
292
294
|
labelPlacement: "content-row",
|
|
293
295
|
dataAttributes: {
|
|
294
|
-
dataIsEmpty: dateTimeValue
|
|
295
|
-
dataIsFilled: dateTimeValue
|
|
296
|
+
dataIsEmpty: dateTimeValue == null,
|
|
297
|
+
dataIsFilled: dateTimeValue != null,
|
|
296
298
|
dataIsDirty: props.isDirty,
|
|
297
299
|
dataIsRequired: props.isRequired,
|
|
298
300
|
dataIsDisabled: isDisabled,
|
|
299
301
|
dataDisabled: isDisabled,
|
|
300
302
|
dataInvalid: !!props.error,
|
|
301
|
-
dataHasSelection: dateTimeValue
|
|
303
|
+
dataHasSelection: dateTimeValue != null
|
|
302
304
|
},
|
|
303
305
|
renderStatic: true,
|
|
304
306
|
onStaticInteract: renderRealInput,
|
|
305
307
|
actionContent: staticTodayIcon,
|
|
306
308
|
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
309
|
+
showClear: dateTimeValue != null,
|
|
310
|
+
wrapContentAndTrailing: true,
|
|
311
|
+
contentAndTrailingClassName: "gap-2!",
|
|
307
312
|
trailingClassName: "py-0! pl-0!",
|
|
308
|
-
|
|
313
|
+
action: showDropdown ? {
|
|
314
|
+
icon: ui.dateInput.dateTimeIcon,
|
|
315
|
+
onClick: _temp4,
|
|
316
|
+
altText: ""
|
|
317
|
+
} : void 0,
|
|
309
318
|
children: staticSegments
|
|
310
319
|
});
|
|
311
320
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
const T0 = DateTimePickerBase;
|
|
322
|
+
const t2 = mergeRefs(props.ref, inputRef);
|
|
323
|
+
const t3 = parseDateValue(normalizedValue);
|
|
324
|
+
let t4;
|
|
325
|
+
if ($[0] !== formatDateValue || $[1] !== props) {
|
|
326
|
+
t4 = (value) => props.onChange?.(formatDateValue(value));
|
|
327
|
+
$[0] = formatDateValue;
|
|
328
|
+
$[1] = props;
|
|
329
|
+
$[2] = t4;
|
|
330
|
+
} else t4 = $[2];
|
|
331
|
+
let t5;
|
|
332
|
+
if ($[3] !== T0 || $[4] !== props || $[5] !== t2 || $[6] !== t3 || $[7] !== t4) {
|
|
333
|
+
t5 = /* @__PURE__ */ jsx(T0, {
|
|
334
|
+
...props,
|
|
335
|
+
ref: t2,
|
|
336
|
+
value: t3,
|
|
337
|
+
onChange: t4
|
|
327
338
|
});
|
|
339
|
+
$[3] = T0;
|
|
340
|
+
$[4] = props;
|
|
341
|
+
$[5] = t2;
|
|
342
|
+
$[6] = t3;
|
|
343
|
+
$[7] = t4;
|
|
344
|
+
$[8] = t5;
|
|
345
|
+
} else t5 = $[8];
|
|
346
|
+
return t5;
|
|
347
|
+
};
|
|
348
|
+
var DateTimePicker = (t0) => {
|
|
349
|
+
const $ = c(24);
|
|
350
|
+
let props;
|
|
351
|
+
let renderStaticInput;
|
|
352
|
+
let t1;
|
|
353
|
+
if ($[0] !== t0) {
|
|
354
|
+
({fullIso: t1, renderStaticInput, ...props} = t0);
|
|
355
|
+
$[0] = t0;
|
|
356
|
+
$[1] = props;
|
|
357
|
+
$[2] = renderStaticInput;
|
|
358
|
+
$[3] = t1;
|
|
359
|
+
} else {
|
|
360
|
+
props = $[1];
|
|
361
|
+
renderStaticInput = $[2];
|
|
362
|
+
t1 = $[3];
|
|
328
363
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
364
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
365
|
+
if ("formControl" in props && props.formControl) {
|
|
366
|
+
let formControl;
|
|
367
|
+
let innerProps;
|
|
368
|
+
let ref;
|
|
369
|
+
if ($[4] !== props) {
|
|
370
|
+
({formControl, ref, ...innerProps} = props);
|
|
371
|
+
$[4] = props;
|
|
372
|
+
$[5] = formControl;
|
|
373
|
+
$[6] = innerProps;
|
|
374
|
+
$[7] = ref;
|
|
375
|
+
} else {
|
|
376
|
+
formControl = $[5];
|
|
377
|
+
innerProps = $[6];
|
|
378
|
+
ref = $[7];
|
|
379
|
+
}
|
|
380
|
+
const controlWithOptions = formControl.control;
|
|
381
|
+
let t2;
|
|
382
|
+
if ($[8] !== controlWithOptions._options?.disabled || $[9] !== fullIso || $[10] !== innerProps || $[11] !== props.error || $[12] !== props.isDisabled || $[13] !== ref || $[14] !== renderStaticInput) {
|
|
383
|
+
t2 = (t3) => {
|
|
384
|
+
const { field, fieldState: t4 } = t3;
|
|
385
|
+
const { error, isDirty } = t4;
|
|
386
|
+
return /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
387
|
+
...innerProps,
|
|
388
|
+
ref: mergeRefs(ref, field.ref),
|
|
389
|
+
value: field.value ?? null,
|
|
390
|
+
onChange: field.onChange,
|
|
391
|
+
onBlur: field.onBlur,
|
|
392
|
+
isDirty,
|
|
393
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
394
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
395
|
+
error: props.error ?? error?.message,
|
|
396
|
+
fullIso,
|
|
397
|
+
renderStaticInput
|
|
398
|
+
});
|
|
399
|
+
};
|
|
400
|
+
$[8] = controlWithOptions._options?.disabled;
|
|
401
|
+
$[9] = fullIso;
|
|
402
|
+
$[10] = innerProps;
|
|
403
|
+
$[11] = props.error;
|
|
404
|
+
$[12] = props.isDisabled;
|
|
405
|
+
$[13] = ref;
|
|
406
|
+
$[14] = renderStaticInput;
|
|
407
|
+
$[15] = t2;
|
|
408
|
+
} else t2 = $[15];
|
|
409
|
+
let t3;
|
|
410
|
+
if ($[16] !== formControl.control || $[17] !== formControl.name || $[18] !== t2) {
|
|
411
|
+
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
412
|
+
control: formControl.control,
|
|
413
|
+
name: formControl.name,
|
|
414
|
+
render: t2
|
|
415
|
+
});
|
|
416
|
+
$[16] = formControl.control;
|
|
417
|
+
$[17] = formControl.name;
|
|
418
|
+
$[18] = t2;
|
|
419
|
+
$[19] = t3;
|
|
420
|
+
} else t3 = $[19];
|
|
421
|
+
return t3;
|
|
422
|
+
}
|
|
423
|
+
let t2;
|
|
424
|
+
if ($[20] !== fullIso || $[21] !== props || $[22] !== renderStaticInput) {
|
|
425
|
+
t2 = /* @__PURE__ */ jsx(DateTimePickerInner, {
|
|
426
|
+
...props,
|
|
427
|
+
fullIso,
|
|
428
|
+
renderStaticInput
|
|
429
|
+
});
|
|
430
|
+
$[20] = fullIso;
|
|
431
|
+
$[21] = props;
|
|
432
|
+
$[22] = renderStaticInput;
|
|
433
|
+
$[23] = t2;
|
|
434
|
+
} else t2 = $[23];
|
|
435
|
+
return t2;
|
|
335
436
|
};
|
|
437
|
+
function _temp(input) {
|
|
438
|
+
const container = input.getContainer?.() ?? input;
|
|
439
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
440
|
+
}
|
|
441
|
+
function _temp2(dateValue) {
|
|
442
|
+
if (dateValue === null) return null;
|
|
443
|
+
return DateTimeUtils.fromDateValueFieldsToUTCISO(dateValue);
|
|
444
|
+
}
|
|
445
|
+
function _temp3(isoString) {
|
|
446
|
+
if (isoString == null) return null;
|
|
447
|
+
return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, "UTC");
|
|
448
|
+
}
|
|
449
|
+
function _temp4() {}
|
|
336
450
|
//#endregion
|
|
337
451
|
export { DateTimePicker };
|
|
@@ -14,6 +14,7 @@ interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Ar
|
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
inputClassName?: string;
|
|
16
16
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
17
|
+
fireBlurOnChange?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export interface TimePickerProps extends Omit<TimePickerBaseProps, "value" | "onChange"> {
|
|
19
20
|
value?: string | null;
|