@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
|
@@ -23,14 +23,27 @@ import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
|
|
|
23
23
|
import { mergeRefs } from "@react-aria/utils";
|
|
24
24
|
import { useTranslation } from "react-i18next";
|
|
25
25
|
import { Controller, useWatch } from "react-hook-form";
|
|
26
|
-
import { createCalendar, endOfMonth, endOfWeek, endOfYear,
|
|
26
|
+
import { createCalendar, endOfMonth, endOfWeek, endOfYear, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
|
|
27
27
|
import { DateTime } from "luxon";
|
|
28
28
|
import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
29
29
|
//#region src/components/inputs/DateTime/DateRangePicker/DateRangePicker.tsx
|
|
30
|
+
var DATE_PICKER_TIME_ZONE = "UTC";
|
|
30
31
|
var DateRangePickerBase = (props) => {
|
|
31
32
|
const ui = UIConfig.useConfig();
|
|
32
33
|
const { t } = useTranslation();
|
|
33
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel
|
|
34
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, ...rest } = props;
|
|
35
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
36
|
+
const variant = variantProp ?? ui.input.variant;
|
|
37
|
+
const as = asProp ?? ui.input.as;
|
|
38
|
+
const size = sizeProp ?? ui.input.size;
|
|
39
|
+
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
40
|
+
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
41
|
+
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
42
|
+
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
43
|
+
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
44
|
+
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
45
|
+
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
46
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
34
47
|
const [validationRangeError, setValidationRangeError] = useState();
|
|
35
48
|
const datePickerInputRef = useRef(null);
|
|
36
49
|
const dateRangePickerRef = useMemo(() => ({ get current() {
|
|
@@ -50,7 +63,7 @@ var DateRangePickerBase = (props) => {
|
|
|
50
63
|
if (isValidRange(newValue)) return;
|
|
51
64
|
onChange?.(newValue);
|
|
52
65
|
handleCalendarStatesChange(newValue);
|
|
53
|
-
debouncedBlur(newValue);
|
|
66
|
+
if (fireBlurOnChange) debouncedBlur(newValue);
|
|
54
67
|
},
|
|
55
68
|
shouldCloseOnSelect: false
|
|
56
69
|
});
|
|
@@ -65,11 +78,14 @@ var DateRangePickerBase = (props) => {
|
|
|
65
78
|
shouldForceLeadingZeros
|
|
66
79
|
}, dialogState, dateRangePickerRef);
|
|
67
80
|
const { locale } = useLocale$1();
|
|
68
|
-
useImperativeHandle(ref, () => ({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
useImperativeHandle(ref, () => ({
|
|
82
|
+
clear: () => {
|
|
83
|
+
datePickerInputRef.current?.clear();
|
|
84
|
+
},
|
|
85
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
86
|
+
}));
|
|
87
|
+
const handleBlur = (newValue_0) => {
|
|
88
|
+
onBlur?.({ target: { value: newValue_0 } });
|
|
73
89
|
};
|
|
74
90
|
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
75
91
|
const formFieldProps = {
|
|
@@ -100,7 +116,7 @@ var DateRangePickerBase = (props) => {
|
|
|
100
116
|
createCalendar,
|
|
101
117
|
pageBehavior: "single",
|
|
102
118
|
visibleDuration: { months: 1 },
|
|
103
|
-
defaultFocusedValue: today(
|
|
119
|
+
defaultFocusedValue: today(DATE_PICKER_TIME_ZONE).add({ months: 1 }),
|
|
104
120
|
minValue: void 0,
|
|
105
121
|
maxValue: void 0
|
|
106
122
|
});
|
|
@@ -122,10 +138,10 @@ var DateRangePickerBase = (props) => {
|
|
|
122
138
|
className: headerClassName,
|
|
123
139
|
labelProps
|
|
124
140
|
};
|
|
125
|
-
const isValidRange = useCallback((
|
|
126
|
-
if (
|
|
127
|
-
const startDate =
|
|
128
|
-
if (
|
|
141
|
+
const isValidRange = useCallback((newValue_1) => {
|
|
142
|
+
if (newValue_1?.start && newValue_1?.end) {
|
|
143
|
+
const startDate = newValue_1.start;
|
|
144
|
+
if (newValue_1.end.compare(startDate) < 0) {
|
|
129
145
|
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
130
146
|
return true;
|
|
131
147
|
}
|
|
@@ -133,20 +149,20 @@ var DateRangePickerBase = (props) => {
|
|
|
133
149
|
} else setValidationRangeError(void 0);
|
|
134
150
|
return false;
|
|
135
151
|
}, [t]);
|
|
136
|
-
const handleCalendarStatesChange = (
|
|
137
|
-
if (
|
|
138
|
-
if (isValidRange(
|
|
139
|
-
dialogState.setValue(
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
leftCalendarState.setFocusedDate(
|
|
143
|
-
if (
|
|
144
|
-
else rightCalendarState.setFocusedDate(
|
|
145
|
-
leftCalendarState.setValue(
|
|
146
|
-
rightCalendarState.setValue(
|
|
152
|
+
const handleCalendarStatesChange = (newValue_2) => {
|
|
153
|
+
if (newValue_2) {
|
|
154
|
+
if (isValidRange(newValue_2)) return;
|
|
155
|
+
dialogState.setValue(newValue_2);
|
|
156
|
+
const startDate_0 = newValue_2.start;
|
|
157
|
+
const endDate_0 = newValue_2.end;
|
|
158
|
+
leftCalendarState.setFocusedDate(startDate_0);
|
|
159
|
+
if (startDate_0.year === endDate_0.year && startDate_0.month === endDate_0.month) rightCalendarState.setFocusedDate(startDate_0.add({ months: 1 }));
|
|
160
|
+
else rightCalendarState.setFocusedDate(endDate_0);
|
|
161
|
+
leftCalendarState.setValue(newValue_2);
|
|
162
|
+
rightCalendarState.setValue(newValue_2);
|
|
147
163
|
setRangeSelection({
|
|
148
|
-
start:
|
|
149
|
-
end:
|
|
164
|
+
start: newValue_2.start,
|
|
165
|
+
end: newValue_2.end,
|
|
150
166
|
isSelecting: false
|
|
151
167
|
});
|
|
152
168
|
setHoverDate(null);
|
|
@@ -170,27 +186,27 @@ var DateRangePickerBase = (props) => {
|
|
|
170
186
|
setHoverDate(date);
|
|
171
187
|
});
|
|
172
188
|
}, []);
|
|
173
|
-
const handleDateHover = useCallback((
|
|
174
|
-
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(
|
|
189
|
+
const handleDateHover = useCallback((date_0) => {
|
|
190
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_0);
|
|
175
191
|
}, [
|
|
176
192
|
rangeSelection.isSelecting,
|
|
177
193
|
rangeSelection.start,
|
|
178
194
|
throttledSetHoverDate
|
|
179
195
|
]);
|
|
180
|
-
const handleDateSelection = useCallback((
|
|
196
|
+
const handleDateSelection = useCallback((date_1, calendarSide) => {
|
|
181
197
|
if (calendarSide) {
|
|
182
198
|
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
183
|
-
if (
|
|
184
|
-
leftCalendarState.setFocusedDate(
|
|
185
|
-
rightCalendarState.setFocusedDate(
|
|
199
|
+
if (date_1.month !== currentVisibleMonth.month || date_1.year !== currentVisibleMonth.year) if (calendarSide === "left") {
|
|
200
|
+
leftCalendarState.setFocusedDate(date_1);
|
|
201
|
+
rightCalendarState.setFocusedDate(date_1.add({ months: 1 }));
|
|
186
202
|
} else {
|
|
187
|
-
rightCalendarState.setFocusedDate(
|
|
188
|
-
leftCalendarState.setFocusedDate(
|
|
203
|
+
rightCalendarState.setFocusedDate(date_1);
|
|
204
|
+
leftCalendarState.setFocusedDate(date_1.subtract({ months: 1 }));
|
|
189
205
|
}
|
|
190
206
|
}
|
|
191
207
|
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
192
208
|
setRangeSelection({
|
|
193
|
-
start:
|
|
209
|
+
start: date_1,
|
|
194
210
|
end: null,
|
|
195
211
|
isSelecting: true
|
|
196
212
|
});
|
|
@@ -199,7 +215,7 @@ var DateRangePickerBase = (props) => {
|
|
|
199
215
|
rightCalendarState.setValue(null);
|
|
200
216
|
} else {
|
|
201
217
|
const { start } = rangeSelection;
|
|
202
|
-
const end =
|
|
218
|
+
const end = date_1;
|
|
203
219
|
const finalStart = start.compare(end) <= 0 ? start : end;
|
|
204
220
|
const finalEnd = start.compare(end) <= 0 ? end : start;
|
|
205
221
|
const newRange = {
|
|
@@ -223,16 +239,16 @@ var DateRangePickerBase = (props) => {
|
|
|
223
239
|
rightCalendarState,
|
|
224
240
|
dialogState
|
|
225
241
|
]);
|
|
226
|
-
const handleKeyboardNavigation = useCallback((event,
|
|
227
|
-
const
|
|
228
|
-
const otherState =
|
|
242
|
+
const handleKeyboardNavigation = useCallback((event, date_2, calendarSide_0) => {
|
|
243
|
+
const currentState_0 = calendarSide_0 === "left" ? leftCalendarState : rightCalendarState;
|
|
244
|
+
const otherState = calendarSide_0 === "left" ? rightCalendarState : leftCalendarState;
|
|
229
245
|
let shouldPreventDefault = false;
|
|
230
246
|
switch (event.key) {
|
|
231
247
|
case "ArrowRight": {
|
|
232
|
-
const nextDate =
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
248
|
+
const nextDate = date_2.add({ days: 1 });
|
|
249
|
+
const currentMonth_2 = currentState_0.visibleRange.start;
|
|
250
|
+
const otherMonth_2 = otherState.visibleRange.start;
|
|
251
|
+
if (calendarSide_0 === "left" && nextDate.month !== currentMonth_2.month) if (nextDate.year === otherMonth_2.year && nextDate.month === otherMonth_2.month) {
|
|
236
252
|
otherState.setFocusedDate(nextDate);
|
|
237
253
|
shouldPreventDefault = true;
|
|
238
254
|
} else {
|
|
@@ -242,10 +258,10 @@ var DateRangePickerBase = (props) => {
|
|
|
242
258
|
break;
|
|
243
259
|
}
|
|
244
260
|
case "ArrowLeft": {
|
|
245
|
-
const prevDate =
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
261
|
+
const prevDate = date_2.subtract({ days: 1 });
|
|
262
|
+
const currentMonth_1 = currentState_0.visibleRange.start;
|
|
263
|
+
const otherMonth_1 = otherState.visibleRange.start;
|
|
264
|
+
if (calendarSide_0 === "right" && prevDate.month !== currentMonth_1.month) if (prevDate.year === otherMonth_1.year && prevDate.month === otherMonth_1.month) {
|
|
249
265
|
otherState.setFocusedDate(prevDate);
|
|
250
266
|
shouldPreventDefault = true;
|
|
251
267
|
} else {
|
|
@@ -255,10 +271,10 @@ var DateRangePickerBase = (props) => {
|
|
|
255
271
|
break;
|
|
256
272
|
}
|
|
257
273
|
case "ArrowDown": {
|
|
258
|
-
const nextWeekDate =
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
274
|
+
const nextWeekDate = date_2.add({ weeks: 1 });
|
|
275
|
+
const currentMonth_0 = currentState_0.visibleRange.start;
|
|
276
|
+
const otherMonth_0 = otherState.visibleRange.start;
|
|
277
|
+
if (calendarSide_0 === "left" && nextWeekDate.month !== currentMonth_0.month) if (nextWeekDate.year === otherMonth_0.year && nextWeekDate.month === otherMonth_0.month) {
|
|
262
278
|
otherState.setFocusedDate(nextWeekDate);
|
|
263
279
|
shouldPreventDefault = true;
|
|
264
280
|
} else {
|
|
@@ -268,10 +284,10 @@ var DateRangePickerBase = (props) => {
|
|
|
268
284
|
break;
|
|
269
285
|
}
|
|
270
286
|
case "ArrowUp": {
|
|
271
|
-
const prevWeekDate =
|
|
272
|
-
const currentMonth =
|
|
287
|
+
const prevWeekDate = date_2.subtract({ weeks: 1 });
|
|
288
|
+
const currentMonth = currentState_0.visibleRange.start;
|
|
273
289
|
const otherMonth = otherState.visibleRange.start;
|
|
274
|
-
if (
|
|
290
|
+
if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
275
291
|
otherState.setFocusedDate(prevWeekDate);
|
|
276
292
|
shouldPreventDefault = true;
|
|
277
293
|
} else {
|
|
@@ -282,7 +298,7 @@ var DateRangePickerBase = (props) => {
|
|
|
282
298
|
}
|
|
283
299
|
case "Enter":
|
|
284
300
|
case " ":
|
|
285
|
-
handleDateSelection(
|
|
301
|
+
handleDateSelection(date_2);
|
|
286
302
|
shouldPreventDefault = true;
|
|
287
303
|
break;
|
|
288
304
|
case "Escape":
|
|
@@ -306,14 +322,14 @@ var DateRangePickerBase = (props) => {
|
|
|
306
322
|
rightCalendarState,
|
|
307
323
|
handleDateSelection
|
|
308
324
|
]);
|
|
309
|
-
const syncCalendarStates = useCallback((
|
|
310
|
-
if (isValidRange(
|
|
311
|
-
leftCalendarState.setValue(
|
|
312
|
-
rightCalendarState.setValue(
|
|
313
|
-
dialogState.setValue(
|
|
314
|
-
if (
|
|
315
|
-
start:
|
|
316
|
-
end:
|
|
325
|
+
const syncCalendarStates = useCallback((newValue_3) => {
|
|
326
|
+
if (isValidRange(newValue_3)) return;
|
|
327
|
+
leftCalendarState.setValue(newValue_3);
|
|
328
|
+
rightCalendarState.setValue(newValue_3);
|
|
329
|
+
dialogState.setValue(newValue_3);
|
|
330
|
+
if (newValue_3) setRangeSelection({
|
|
331
|
+
start: newValue_3.start,
|
|
332
|
+
end: newValue_3.end,
|
|
317
333
|
isSelecting: false
|
|
318
334
|
});
|
|
319
335
|
else setRangeSelection({
|
|
@@ -335,12 +351,12 @@ var DateRangePickerBase = (props) => {
|
|
|
335
351
|
} : dialogState.value;
|
|
336
352
|
if (valueToApply) {
|
|
337
353
|
state.setValue(valueToApply);
|
|
338
|
-
handleBlur(valueToApply);
|
|
354
|
+
if (fireBlurOnChange) handleBlur(valueToApply);
|
|
339
355
|
}
|
|
340
356
|
state.toggle();
|
|
341
357
|
};
|
|
342
358
|
const onTodayPress = () => {
|
|
343
|
-
const todayDate = today(
|
|
359
|
+
const todayDate = today(DATE_PICKER_TIME_ZONE);
|
|
344
360
|
leftCalendarState.setFocusedDate(todayDate);
|
|
345
361
|
rightCalendarState.setFocusedDate(todayDate.add({ months: 1 }));
|
|
346
362
|
syncCalendarStates({
|
|
@@ -355,11 +371,11 @@ var DateRangePickerBase = (props) => {
|
|
|
355
371
|
dialogState.setValue(state.value);
|
|
356
372
|
leftCalendarState.setValue(state.value);
|
|
357
373
|
rightCalendarState.setValue(state.value);
|
|
358
|
-
const
|
|
359
|
-
const
|
|
360
|
-
leftCalendarState.setFocusedDate(
|
|
361
|
-
if (
|
|
362
|
-
else rightCalendarState.setFocusedDate(
|
|
374
|
+
const startDate_1 = state.value.start || today(DATE_PICKER_TIME_ZONE);
|
|
375
|
+
const endDate_1 = state.value.end || today(DATE_PICKER_TIME_ZONE).add({ months: 1 });
|
|
376
|
+
leftCalendarState.setFocusedDate(startDate_1);
|
|
377
|
+
if (startDate_1.year === endDate_1.year && startDate_1.month === endDate_1.month) rightCalendarState.setFocusedDate(startDate_1.add({ months: 1 }));
|
|
378
|
+
else rightCalendarState.setFocusedDate(endDate_1);
|
|
363
379
|
setRangeSelection({
|
|
364
380
|
start: state.value.start,
|
|
365
381
|
end: state.value.end,
|
|
@@ -368,87 +384,87 @@ var DateRangePickerBase = (props) => {
|
|
|
368
384
|
}
|
|
369
385
|
}
|
|
370
386
|
};
|
|
371
|
-
const
|
|
387
|
+
const todayDate_0 = today(DATE_PICKER_TIME_ZONE);
|
|
372
388
|
const getThisWeekRange = () => {
|
|
373
389
|
return {
|
|
374
|
-
start: startOfWeek(
|
|
375
|
-
end: endOfWeek(
|
|
390
|
+
start: startOfWeek(todayDate_0, locale),
|
|
391
|
+
end: endOfWeek(todayDate_0, locale)
|
|
376
392
|
};
|
|
377
393
|
};
|
|
378
394
|
const getLastWeekRange = () => {
|
|
379
|
-
const thisWeekStart = startOfWeek(
|
|
395
|
+
const thisWeekStart = startOfWeek(todayDate_0, locale);
|
|
380
396
|
return {
|
|
381
397
|
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
382
398
|
end: thisWeekStart.subtract({ days: 1 })
|
|
383
399
|
};
|
|
384
400
|
};
|
|
385
401
|
const getThisAndLastWeekRange = () => {
|
|
386
|
-
const thisWeekEnd = endOfWeek(
|
|
402
|
+
const thisWeekEnd = endOfWeek(todayDate_0, locale);
|
|
387
403
|
return {
|
|
388
|
-
start: startOfWeek(
|
|
404
|
+
start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
|
|
389
405
|
end: thisWeekEnd
|
|
390
406
|
};
|
|
391
407
|
};
|
|
392
408
|
const getThisMonthRange = () => {
|
|
393
409
|
return {
|
|
394
|
-
start: startOfMonth(
|
|
395
|
-
end: endOfMonth(
|
|
410
|
+
start: startOfMonth(todayDate_0),
|
|
411
|
+
end: endOfMonth(todayDate_0)
|
|
396
412
|
};
|
|
397
413
|
};
|
|
398
414
|
const getThisAndLastMonthRange = () => {
|
|
399
|
-
const thisMonthEnd = endOfMonth(
|
|
415
|
+
const thisMonthEnd = endOfMonth(todayDate_0);
|
|
400
416
|
return {
|
|
401
|
-
start: startOfMonth(
|
|
417
|
+
start: startOfMonth(todayDate_0).subtract({ months: 1 }),
|
|
402
418
|
end: thisMonthEnd
|
|
403
419
|
};
|
|
404
420
|
};
|
|
405
421
|
const presets = [
|
|
406
422
|
{
|
|
407
|
-
label: t(($) =>
|
|
423
|
+
label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
408
424
|
getValue: getThisWeekRange
|
|
409
425
|
},
|
|
410
426
|
{
|
|
411
|
-
label: t(($) =>
|
|
427
|
+
label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
412
428
|
getValue: getLastWeekRange
|
|
413
429
|
},
|
|
414
430
|
{
|
|
415
|
-
label: t(($) =>
|
|
431
|
+
label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
416
432
|
getValue: getThisAndLastWeekRange
|
|
417
433
|
},
|
|
418
434
|
{
|
|
419
|
-
label: t(($) =>
|
|
435
|
+
label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
420
436
|
getValue: getThisMonthRange
|
|
421
437
|
},
|
|
422
438
|
{
|
|
423
|
-
label: t(($) =>
|
|
439
|
+
label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
424
440
|
getValue: getThisAndLastMonthRange
|
|
425
441
|
},
|
|
426
442
|
{
|
|
427
|
-
label: t(($) =>
|
|
443
|
+
label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
428
444
|
getValue: () => ({
|
|
429
|
-
start: startOfYear(
|
|
430
|
-
end:
|
|
445
|
+
start: startOfYear(todayDate_0),
|
|
446
|
+
end: todayDate_0
|
|
431
447
|
})
|
|
432
448
|
},
|
|
433
449
|
{
|
|
434
|
-
label: t(($) =>
|
|
450
|
+
label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
435
451
|
getValue: () => ({
|
|
436
|
-
start: startOfYear(
|
|
437
|
-
end: endOfYear(
|
|
452
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
453
|
+
end: endOfYear(todayDate_0.subtract({ years: 1 }))
|
|
438
454
|
})
|
|
439
455
|
},
|
|
440
456
|
{
|
|
441
|
-
label: t(($) =>
|
|
457
|
+
label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
442
458
|
getValue: () => ({
|
|
443
|
-
start: startOfYear(
|
|
444
|
-
end:
|
|
459
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
460
|
+
end: todayDate_0
|
|
445
461
|
})
|
|
446
462
|
},
|
|
447
463
|
{
|
|
448
|
-
label: t(($) =>
|
|
464
|
+
label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
449
465
|
getValue: () => ({
|
|
450
|
-
start: startOfYear(
|
|
451
|
-
end:
|
|
466
|
+
start: startOfYear(todayDate_0),
|
|
467
|
+
end: todayDate_0
|
|
452
468
|
})
|
|
453
469
|
}
|
|
454
470
|
];
|
|
@@ -456,12 +472,12 @@ var DateRangePickerBase = (props) => {
|
|
|
456
472
|
setActivePreset(preset.label);
|
|
457
473
|
const presetValue = preset.getValue();
|
|
458
474
|
syncCalendarStates(presetValue);
|
|
459
|
-
const
|
|
460
|
-
leftCalendarState.setFocusedDate(
|
|
461
|
-
const
|
|
462
|
-
if ((
|
|
475
|
+
const startDate_2 = presetValue.start;
|
|
476
|
+
leftCalendarState.setFocusedDate(startDate_2);
|
|
477
|
+
const endDate_2 = presetValue.end;
|
|
478
|
+
if ((endDate_2.year - startDate_2.year) * 12 + (endDate_2.month - startDate_2.month) > 2) rightCalendarState.setFocusedDate(endDate_2);
|
|
463
479
|
else {
|
|
464
|
-
const rightCalendarMonth =
|
|
480
|
+
const rightCalendarMonth = startDate_2.add({ months: 1 });
|
|
465
481
|
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
466
482
|
}
|
|
467
483
|
};
|
|
@@ -497,22 +513,24 @@ var DateRangePickerBase = (props) => {
|
|
|
497
513
|
autoFixYear,
|
|
498
514
|
placeholder,
|
|
499
515
|
className: inputClassName,
|
|
500
|
-
onOpenDropdown: () => state.toggle()
|
|
516
|
+
onOpenDropdown: () => state.toggle(),
|
|
517
|
+
timeZone: DATE_PICKER_TIME_ZONE,
|
|
518
|
+
fireBlurOnChange
|
|
501
519
|
}), /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
502
520
|
hideSidebar,
|
|
503
521
|
sidebar: /* @__PURE__ */ jsx("div", {
|
|
504
522
|
className: "flex w-full flex-row overflow-auto border-elevation-outline-default-1 border-solid [-ms-overflow-style:none] [scrollbar-width:none] md:w-[156px] md:flex-col md:border-r [&::-webkit-scrollbar]:hidden",
|
|
505
|
-
children: presets.map((
|
|
506
|
-
onClick: () => selectPreset(
|
|
507
|
-
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !==
|
|
523
|
+
children: presets.map((preset_0) => /* @__PURE__ */ jsx(Button, {
|
|
524
|
+
onClick: () => selectPreset(preset_0),
|
|
525
|
+
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !== preset_0.label && "text-interactive-text-secondary-idle hover:text-interactive-text-secondary-hover", activePreset === preset_0.label && "bg-interactive-contained-primary-idle text-interactive-text-secondary-idle-inverted"),
|
|
508
526
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
509
527
|
size: "label-2",
|
|
510
528
|
sizeMobile: "label-3",
|
|
511
529
|
as: "span",
|
|
512
530
|
className: "whitespace-nowrap",
|
|
513
|
-
children:
|
|
531
|
+
children: preset_0.label
|
|
514
532
|
})
|
|
515
|
-
},
|
|
533
|
+
}, preset_0.label))
|
|
516
534
|
}),
|
|
517
535
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
518
536
|
isDisabled,
|
|
@@ -559,7 +577,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
559
577
|
renderInput,
|
|
560
578
|
setRenderInput,
|
|
561
579
|
getFocusTarget: (input) => {
|
|
562
|
-
|
|
580
|
+
const container = input.getContainer?.() ?? input;
|
|
581
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
563
582
|
}
|
|
564
583
|
});
|
|
565
584
|
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
@@ -575,11 +594,11 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
575
594
|
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
576
595
|
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
577
596
|
};
|
|
578
|
-
const startDate = DateTimeUtils.fromDateValueToLocal(range.start);
|
|
579
|
-
const endDate = DateTimeUtils.fromDateValueToLocal(range.end);
|
|
597
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
598
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
580
599
|
return {
|
|
581
|
-
start: DateTime.fromJSDate(startDate).toISODate(),
|
|
582
|
-
end: DateTime.fromJSDate(endDate).toISODate()
|
|
600
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
601
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
583
602
|
};
|
|
584
603
|
};
|
|
585
604
|
const parseDateRange = (formattedRange) => {
|
|
@@ -588,10 +607,10 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
588
607
|
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
589
608
|
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
590
609
|
};
|
|
591
|
-
const
|
|
592
|
-
const
|
|
593
|
-
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(
|
|
594
|
-
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(
|
|
610
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
611
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
612
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
613
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
595
614
|
return {
|
|
596
615
|
start: toCalendarDate(startZonedDateTime),
|
|
597
616
|
end: toCalendarDate(endZonedDateTime)
|
|
@@ -600,8 +619,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
600
619
|
const parseCalendarDate = (formattedDate) => {
|
|
601
620
|
if (formattedDate == null) return formattedDate;
|
|
602
621
|
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
603
|
-
const date = DateTime.fromISO(formattedDate).toJSDate();
|
|
604
|
-
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date));
|
|
622
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
623
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
605
624
|
};
|
|
606
625
|
const dateLimits = {
|
|
607
626
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
@@ -650,6 +669,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
650
669
|
onStaticInteract: renderRealInput,
|
|
651
670
|
actionContent: staticTodayIcon,
|
|
652
671
|
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
672
|
+
wrapContentAndTrailing: true,
|
|
673
|
+
contentAndTrailingClassName: "gap-2!",
|
|
653
674
|
trailingClassName: "py-0! pl-0!",
|
|
654
675
|
trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
|
|
655
676
|
children: staticSegments
|
|
@@ -678,7 +699,7 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
678
699
|
...dateLimits,
|
|
679
700
|
ref: mergeRefs(props.ref, inputRef),
|
|
680
701
|
value: parseDateRange(props.value),
|
|
681
|
-
onChange: (
|
|
702
|
+
onChange: (value_0) => props.onChange?.(formatDateRange(value_0))
|
|
682
703
|
});
|
|
683
704
|
};
|
|
684
705
|
//#endregion
|
|
@@ -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;
|
|
@@ -34,5 +35,5 @@ export interface DateTimePickerProps extends Omit<DateTimePickerBaseProps, "valu
|
|
|
34
35
|
timeZone?: string;
|
|
35
36
|
}
|
|
36
37
|
export type ControlledDateTimePickerProps<TFieldValues extends FieldValues> = ControlProps<DateTimePickerProps, TFieldValues>;
|
|
37
|
-
export declare const DateTimePicker: <TFieldValues extends FieldValues>({ fullIso, renderStaticInput, ...props }: ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare const DateTimePicker: <TFieldValues extends FieldValues>({ fullIso: _fullIso, renderStaticInput, ...props }: ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
38
39
|
export {};
|