@povio/ui 2.3.0-rc.2 → 2.3.0-rc.20
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 +190 -34
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +47 -21
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +141 -120
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +45 -26
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +401 -119
- 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 +249 -93
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.js +296 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +352 -145
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +94 -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 +2 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +206 -70
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- 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 +49 -8
- 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 +266 -84
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +321 -77
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.js +303 -90
- package/dist/components/inputs/Input/TextInput/TextInput.js +252 -84
- 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 +1 -2
- 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 +333 -107
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +12 -5
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +3 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +107 -27
- package/dist/components/inputs/Selection/Select/Select.js +25 -8
- 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 +326 -136
- 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/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +44 -38
- 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 +2 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +442 -116
- package/dist/components/inputs/Slider/Slider.js +250 -74
- 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 +206 -40
- package/dist/components/inputs/shared/CheckContent.js +21 -10
- package/dist/components/inputs/shared/InputClear.js +78 -21
- package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
- package/dist/components/inputs/shared/input.cva.js +13 -3
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +1 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +87 -34
- 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 +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 +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 +4 -4
- package/dist/config/uiConfig.context.js +50 -11
- 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/utils/date-time.utils.d.ts +2 -0
- package/dist/utils/date-time.utils.js +17 -13
- package/package.json +1 -1
|
@@ -12,19 +12,35 @@ import { FormField } from "../../FormField/FormField.js";
|
|
|
12
12
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
13
13
|
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
14
14
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
15
|
+
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
15
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
17
|
import { clsx } from "clsx";
|
|
17
18
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
18
19
|
import { useDatePicker, useLocale } from "react-aria";
|
|
19
20
|
import { mergeRefs } from "@react-aria/utils";
|
|
20
21
|
import { Controller, useWatch } from "react-hook-form";
|
|
21
|
-
import { createCalendar,
|
|
22
|
+
import { createCalendar, toCalendarDate, today } from "@internationalized/date";
|
|
22
23
|
import { DateTime } from "luxon";
|
|
23
24
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
24
25
|
//#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
|
|
26
|
+
var DATE_PICKER_TIME_ZONE = "UTC";
|
|
25
27
|
var DatePickerBase = (props) => {
|
|
26
28
|
const ui = UIConfig.useConfig();
|
|
27
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, placeholder, inputClassName, as
|
|
29
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, placeholder, inputClassName, as: asProp, hideLabel: hideLabelProp, variant: variantProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, granularity: granularityProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, format, ...rest } = props;
|
|
30
|
+
const as = asProp ?? ui.input.as;
|
|
31
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
32
|
+
const variant = variantProp ?? ui.input.variant;
|
|
33
|
+
const size = sizeProp ?? ui.input.size;
|
|
34
|
+
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
35
|
+
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
36
|
+
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
37
|
+
const 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 granularity = granularityProp ?? ui.dateInput.granularity;
|
|
42
|
+
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
43
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
28
44
|
const normalizeByGranularity = useCallback((date) => {
|
|
29
45
|
if (granularity === "year") return date.set({
|
|
30
46
|
month: 1,
|
|
@@ -50,12 +66,16 @@ var DatePickerBase = (props) => {
|
|
|
50
66
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
51
67
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
52
68
|
} }), []);
|
|
53
|
-
useImperativeHandle(ref, () => ({
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
useImperativeHandle(ref, () => ({
|
|
70
|
+
clear: () => {
|
|
71
|
+
datePickerInputRef.current?.clear();
|
|
72
|
+
},
|
|
73
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
74
|
+
}));
|
|
56
75
|
const handleBlur = (val) => {
|
|
57
76
|
onBlur?.({ target: { value: val } });
|
|
58
77
|
};
|
|
78
|
+
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
59
79
|
const dialogState = useDatePickerState({
|
|
60
80
|
...rest,
|
|
61
81
|
defaultValue: value || rest.defaultValue,
|
|
@@ -66,20 +86,21 @@ var DatePickerBase = (props) => {
|
|
|
66
86
|
...rest,
|
|
67
87
|
shouldForceLeadingZeros,
|
|
68
88
|
value,
|
|
69
|
-
onChange: (
|
|
70
|
-
let normalizedValue =
|
|
71
|
-
if (
|
|
89
|
+
onChange: (val_0) => {
|
|
90
|
+
let normalizedValue = val_0;
|
|
91
|
+
if (val_0) normalizedValue = normalizeByGranularity(val_0);
|
|
72
92
|
if (normalizedValue && (rest.minValue && normalizedValue < rest?.minValue || rest?.maxValue && normalizedValue > rest?.maxValue)) {
|
|
73
93
|
state.setValue(state.value);
|
|
74
94
|
return;
|
|
75
95
|
}
|
|
76
96
|
onChange?.(normalizedValue);
|
|
77
97
|
dialogState.setValue(normalizedValue);
|
|
98
|
+
if (fireBlurOnChange) debouncedBlur(normalizedValue);
|
|
78
99
|
if (normalizedValue) {
|
|
79
100
|
calendarState.setFocusedDate(normalizedValue);
|
|
80
101
|
return;
|
|
81
102
|
}
|
|
82
|
-
calendarState.setFocusedDate(today(
|
|
103
|
+
calendarState.setFocusedDate(today(DATE_PICKER_TIME_ZONE));
|
|
83
104
|
},
|
|
84
105
|
shouldCloseOnSelect: false
|
|
85
106
|
});
|
|
@@ -114,11 +135,11 @@ var DatePickerBase = (props) => {
|
|
|
114
135
|
const newValue = dialogState.value ? normalizeByGranularity(dialogState.value) : dialogState.value;
|
|
115
136
|
state.setValue(newValue);
|
|
116
137
|
state.toggle();
|
|
117
|
-
handleBlur(newValue);
|
|
138
|
+
if (fireBlurOnChange) handleBlur(newValue);
|
|
118
139
|
};
|
|
119
140
|
const onMonthYearChange = (selectedDate) => {
|
|
120
141
|
if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
|
|
121
|
-
const updatedDate = normalizeByGranularity((dialogState.value || state.value || today(
|
|
142
|
+
const updatedDate = normalizeByGranularity((dialogState.value || state.value || today(DATE_PICKER_TIME_ZONE)).set({
|
|
122
143
|
year: selectedDate.year,
|
|
123
144
|
month: selectedDate.month
|
|
124
145
|
}));
|
|
@@ -129,7 +150,7 @@ var DatePickerBase = (props) => {
|
|
|
129
150
|
onApply();
|
|
130
151
|
};
|
|
131
152
|
const onTodayPress = () => {
|
|
132
|
-
const todayValue = normalizeByGranularity(today(
|
|
153
|
+
const todayValue = normalizeByGranularity(today(DATE_PICKER_TIME_ZONE));
|
|
133
154
|
dialogState.setValue(todayValue);
|
|
134
155
|
calendarState.setFocusedDate(todayValue);
|
|
135
156
|
};
|
|
@@ -137,7 +158,7 @@ var DatePickerBase = (props) => {
|
|
|
137
158
|
if (!state.isOpen) return;
|
|
138
159
|
if (granularity !== "year") return;
|
|
139
160
|
if (dialogState.value) return;
|
|
140
|
-
const defaultYearValue = normalizeByGranularity(today(
|
|
161
|
+
const defaultYearValue = normalizeByGranularity(today(DATE_PICKER_TIME_ZONE));
|
|
141
162
|
dialogState.setValue(defaultYearValue);
|
|
142
163
|
calendarState.setFocusedDate(defaultYearValue);
|
|
143
164
|
}, [
|
|
@@ -151,7 +172,7 @@ var DatePickerBase = (props) => {
|
|
|
151
172
|
const onOpenChange = (isOpen) => {
|
|
152
173
|
state.toggle();
|
|
153
174
|
if (state.value) calendarState.setFocusedDate(normalizeByGranularity(state.value));
|
|
154
|
-
if (!state.value) calendarState.setFocusedDate(today(
|
|
175
|
+
if (!state.value) calendarState.setFocusedDate(today(DATE_PICKER_TIME_ZONE));
|
|
155
176
|
if (!isOpen) dialogState.setValue(state.value);
|
|
156
177
|
};
|
|
157
178
|
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
@@ -187,7 +208,9 @@ var DatePickerBase = (props) => {
|
|
|
187
208
|
placeholder,
|
|
188
209
|
className: inputClassName,
|
|
189
210
|
dateGranularity: granularity,
|
|
190
|
-
format
|
|
211
|
+
format,
|
|
212
|
+
timeZone: DATE_PICKER_TIME_ZONE,
|
|
213
|
+
fireBlurOnChange
|
|
191
214
|
}), (!disableDropdown || disableManualEntry) && state.isOpen && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
192
215
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
193
216
|
isDisabled,
|
|
@@ -225,7 +248,8 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
225
248
|
renderInput,
|
|
226
249
|
setRenderInput,
|
|
227
250
|
getFocusTarget: (input) => {
|
|
228
|
-
|
|
251
|
+
const container = input.getContainer?.() ?? input;
|
|
252
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
229
253
|
}
|
|
230
254
|
});
|
|
231
255
|
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
@@ -247,14 +271,14 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
247
271
|
if (calendarDate === null) return null;
|
|
248
272
|
const normalizedDate = normalizeByGranularity(calendarDate);
|
|
249
273
|
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
|
|
250
|
-
const
|
|
251
|
-
return DateTime.fromJSDate(
|
|
274
|
+
const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
|
|
275
|
+
return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
|
|
252
276
|
};
|
|
253
277
|
const parseCalendarDate = (formattedDate) => {
|
|
254
278
|
if (formattedDate == null) return formattedDate;
|
|
255
279
|
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
256
|
-
const
|
|
257
|
-
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(
|
|
280
|
+
const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
281
|
+
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
|
|
258
282
|
};
|
|
259
283
|
const dateLimits = {
|
|
260
284
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
@@ -300,6 +324,8 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
300
324
|
onStaticInteract: renderRealInput,
|
|
301
325
|
actionContent: staticTodayIcon,
|
|
302
326
|
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
327
|
+
wrapContentAndTrailing: true,
|
|
328
|
+
contentAndTrailingClassName: "gap-2!",
|
|
303
329
|
trailingClassName: "py-0! pl-0!",
|
|
304
330
|
trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
|
|
305
331
|
children: staticSegments
|
|
@@ -329,7 +355,7 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
329
355
|
ref: mergeRefs(props.ref, inputRef),
|
|
330
356
|
granularity,
|
|
331
357
|
value: parseCalendarDate(props.value),
|
|
332
|
-
onChange: (
|
|
358
|
+
onChange: (value_0) => props.onChange?.(formatCalendarDate(value_0))
|
|
333
359
|
});
|
|
334
360
|
};
|
|
335
361
|
//#endregion
|
|
@@ -23,6 +23,7 @@ interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Om
|
|
|
23
23
|
placeholder?: string;
|
|
24
24
|
inputClassName?: string;
|
|
25
25
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
26
|
+
fireBlurOnChange?: boolean;
|
|
26
27
|
}
|
|
27
28
|
export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
|
|
28
29
|
value?: {
|