@povio/ui 2.3.0-rc.1 → 2.3.0-rc.10
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.js +166 -34
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +35 -14
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +125 -109
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +33 -15
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +391 -117
- package/dist/components/inputs/DateTime/shared/Calendar.js +331 -137
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +283 -102
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +142 -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.js +345 -142
- 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.js +205 -70
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +4 -8
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +8 -8
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- 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 +261 -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 +250 -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 +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.js +317 -106
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +11 -4
- 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 +24 -7
- 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.js +335 -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.js +35 -35
- 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.js +187 -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.js +39 -8
- 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.js +7 -13
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ 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";
|
|
@@ -24,7 +25,20 @@ import { useCalendarState, useDatePickerState } from "react-stately";
|
|
|
24
25
|
//#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
|
|
25
26
|
var DatePickerBase = (props) => {
|
|
26
27
|
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
|
|
28
|
+
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, format, ...rest } = props;
|
|
29
|
+
const as = asProp ?? ui.input.as;
|
|
30
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
31
|
+
const variant = variantProp ?? ui.input.variant;
|
|
32
|
+
const size = sizeProp ?? ui.input.size;
|
|
33
|
+
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
34
|
+
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
35
|
+
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
36
|
+
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
37
|
+
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
38
|
+
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
39
|
+
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
40
|
+
const granularity = granularityProp ?? ui.dateInput.granularity;
|
|
41
|
+
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
28
42
|
const normalizeByGranularity = useCallback((date) => {
|
|
29
43
|
if (granularity === "year") return date.set({
|
|
30
44
|
month: 1,
|
|
@@ -50,12 +64,16 @@ var DatePickerBase = (props) => {
|
|
|
50
64
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
51
65
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
52
66
|
} }), []);
|
|
53
|
-
useImperativeHandle(ref, () => ({
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
useImperativeHandle(ref, () => ({
|
|
68
|
+
clear: () => {
|
|
69
|
+
datePickerInputRef.current?.clear();
|
|
70
|
+
},
|
|
71
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
72
|
+
}));
|
|
56
73
|
const handleBlur = (val) => {
|
|
57
74
|
onBlur?.({ target: { value: val } });
|
|
58
75
|
};
|
|
76
|
+
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
59
77
|
const dialogState = useDatePickerState({
|
|
60
78
|
...rest,
|
|
61
79
|
defaultValue: value || rest.defaultValue,
|
|
@@ -66,15 +84,16 @@ var DatePickerBase = (props) => {
|
|
|
66
84
|
...rest,
|
|
67
85
|
shouldForceLeadingZeros,
|
|
68
86
|
value,
|
|
69
|
-
onChange: (
|
|
70
|
-
let normalizedValue =
|
|
71
|
-
if (
|
|
87
|
+
onChange: (val_0) => {
|
|
88
|
+
let normalizedValue = val_0;
|
|
89
|
+
if (val_0) normalizedValue = normalizeByGranularity(val_0);
|
|
72
90
|
if (normalizedValue && (rest.minValue && normalizedValue < rest?.minValue || rest?.maxValue && normalizedValue > rest?.maxValue)) {
|
|
73
91
|
state.setValue(state.value);
|
|
74
92
|
return;
|
|
75
93
|
}
|
|
76
94
|
onChange?.(normalizedValue);
|
|
77
95
|
dialogState.setValue(normalizedValue);
|
|
96
|
+
debouncedBlur(normalizedValue);
|
|
78
97
|
if (normalizedValue) {
|
|
79
98
|
calendarState.setFocusedDate(normalizedValue);
|
|
80
99
|
return;
|
|
@@ -225,7 +244,8 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
225
244
|
renderInput,
|
|
226
245
|
setRenderInput,
|
|
227
246
|
getFocusTarget: (input) => {
|
|
228
|
-
|
|
247
|
+
const container = input.getContainer?.() ?? input;
|
|
248
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
229
249
|
}
|
|
230
250
|
});
|
|
231
251
|
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
@@ -247,14 +267,14 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
247
267
|
if (calendarDate === null) return null;
|
|
248
268
|
const normalizedDate = normalizeByGranularity(calendarDate);
|
|
249
269
|
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
|
|
250
|
-
const
|
|
251
|
-
return DateTime.fromJSDate(
|
|
270
|
+
const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate);
|
|
271
|
+
return DateTime.fromJSDate(date_0).toISODate();
|
|
252
272
|
};
|
|
253
273
|
const parseCalendarDate = (formattedDate) => {
|
|
254
274
|
if (formattedDate == null) return formattedDate;
|
|
255
275
|
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
256
|
-
const
|
|
257
|
-
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(
|
|
276
|
+
const date_1 = DateTime.fromISO(formattedDate).toJSDate();
|
|
277
|
+
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1)));
|
|
258
278
|
};
|
|
259
279
|
const dateLimits = {
|
|
260
280
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
@@ -274,7 +294,6 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
274
294
|
const staticSegments = getStaticCalendarDateSegments({
|
|
275
295
|
value: dateValue,
|
|
276
296
|
locale,
|
|
277
|
-
placeholder: props.placeholder,
|
|
278
297
|
shouldForceLeadingZeros,
|
|
279
298
|
isDisabled,
|
|
280
299
|
hidePlaceholder: as === "floating" && !dateValue
|
|
@@ -301,6 +320,8 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
301
320
|
onStaticInteract: renderRealInput,
|
|
302
321
|
actionContent: staticTodayIcon,
|
|
303
322
|
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
323
|
+
wrapContentAndTrailing: true,
|
|
324
|
+
contentAndTrailingClassName: "gap-2!",
|
|
304
325
|
trailingClassName: "py-0! pl-0!",
|
|
305
326
|
trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
|
|
306
327
|
children: staticSegments
|
|
@@ -330,7 +351,7 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
330
351
|
ref: mergeRefs(props.ref, inputRef),
|
|
331
352
|
granularity,
|
|
332
353
|
value: parseCalendarDate(props.value),
|
|
333
|
-
onChange: (
|
|
354
|
+
onChange: (value_0) => props.onChange?.(formatCalendarDate(value_0))
|
|
334
355
|
});
|
|
335
356
|
};
|
|
336
357
|
//#endregion
|
|
@@ -30,7 +30,18 @@ import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
|
30
30
|
var DateRangePickerBase = (props) => {
|
|
31
31
|
const ui = UIConfig.useConfig();
|
|
32
32
|
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
|
|
33
|
+
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, ...rest } = props;
|
|
34
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
35
|
+
const variant = variantProp ?? ui.input.variant;
|
|
36
|
+
const as = asProp ?? ui.input.as;
|
|
37
|
+
const size = sizeProp ?? ui.input.size;
|
|
38
|
+
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
39
|
+
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
40
|
+
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
41
|
+
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
42
|
+
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
43
|
+
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
44
|
+
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
34
45
|
const [validationRangeError, setValidationRangeError] = useState();
|
|
35
46
|
const datePickerInputRef = useRef(null);
|
|
36
47
|
const dateRangePickerRef = useMemo(() => ({ get current() {
|
|
@@ -65,11 +76,14 @@ var DateRangePickerBase = (props) => {
|
|
|
65
76
|
shouldForceLeadingZeros
|
|
66
77
|
}, dialogState, dateRangePickerRef);
|
|
67
78
|
const { locale } = useLocale$1();
|
|
68
|
-
useImperativeHandle(ref, () => ({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
useImperativeHandle(ref, () => ({
|
|
80
|
+
clear: () => {
|
|
81
|
+
datePickerInputRef.current?.clear();
|
|
82
|
+
},
|
|
83
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
84
|
+
}));
|
|
85
|
+
const handleBlur = (newValue_0) => {
|
|
86
|
+
onBlur?.({ target: { value: newValue_0 } });
|
|
73
87
|
};
|
|
74
88
|
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
75
89
|
const formFieldProps = {
|
|
@@ -122,10 +136,10 @@ var DateRangePickerBase = (props) => {
|
|
|
122
136
|
className: headerClassName,
|
|
123
137
|
labelProps
|
|
124
138
|
};
|
|
125
|
-
const isValidRange = useCallback((
|
|
126
|
-
if (
|
|
127
|
-
const startDate =
|
|
128
|
-
if (
|
|
139
|
+
const isValidRange = useCallback((newValue_1) => {
|
|
140
|
+
if (newValue_1?.start && newValue_1?.end) {
|
|
141
|
+
const startDate = newValue_1.start;
|
|
142
|
+
if (newValue_1.end.compare(startDate) < 0) {
|
|
129
143
|
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
130
144
|
return true;
|
|
131
145
|
}
|
|
@@ -133,20 +147,20 @@ var DateRangePickerBase = (props) => {
|
|
|
133
147
|
} else setValidationRangeError(void 0);
|
|
134
148
|
return false;
|
|
135
149
|
}, [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(
|
|
150
|
+
const handleCalendarStatesChange = (newValue_2) => {
|
|
151
|
+
if (newValue_2) {
|
|
152
|
+
if (isValidRange(newValue_2)) return;
|
|
153
|
+
dialogState.setValue(newValue_2);
|
|
154
|
+
const startDate_0 = newValue_2.start;
|
|
155
|
+
const endDate_0 = newValue_2.end;
|
|
156
|
+
leftCalendarState.setFocusedDate(startDate_0);
|
|
157
|
+
if (startDate_0.year === endDate_0.year && startDate_0.month === endDate_0.month) rightCalendarState.setFocusedDate(startDate_0.add({ months: 1 }));
|
|
158
|
+
else rightCalendarState.setFocusedDate(endDate_0);
|
|
159
|
+
leftCalendarState.setValue(newValue_2);
|
|
160
|
+
rightCalendarState.setValue(newValue_2);
|
|
147
161
|
setRangeSelection({
|
|
148
|
-
start:
|
|
149
|
-
end:
|
|
162
|
+
start: newValue_2.start,
|
|
163
|
+
end: newValue_2.end,
|
|
150
164
|
isSelecting: false
|
|
151
165
|
});
|
|
152
166
|
setHoverDate(null);
|
|
@@ -170,27 +184,27 @@ var DateRangePickerBase = (props) => {
|
|
|
170
184
|
setHoverDate(date);
|
|
171
185
|
});
|
|
172
186
|
}, []);
|
|
173
|
-
const handleDateHover = useCallback((
|
|
174
|
-
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(
|
|
187
|
+
const handleDateHover = useCallback((date_0) => {
|
|
188
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_0);
|
|
175
189
|
}, [
|
|
176
190
|
rangeSelection.isSelecting,
|
|
177
191
|
rangeSelection.start,
|
|
178
192
|
throttledSetHoverDate
|
|
179
193
|
]);
|
|
180
|
-
const handleDateSelection = useCallback((
|
|
194
|
+
const handleDateSelection = useCallback((date_1, calendarSide) => {
|
|
181
195
|
if (calendarSide) {
|
|
182
196
|
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
183
|
-
if (
|
|
184
|
-
leftCalendarState.setFocusedDate(
|
|
185
|
-
rightCalendarState.setFocusedDate(
|
|
197
|
+
if (date_1.month !== currentVisibleMonth.month || date_1.year !== currentVisibleMonth.year) if (calendarSide === "left") {
|
|
198
|
+
leftCalendarState.setFocusedDate(date_1);
|
|
199
|
+
rightCalendarState.setFocusedDate(date_1.add({ months: 1 }));
|
|
186
200
|
} else {
|
|
187
|
-
rightCalendarState.setFocusedDate(
|
|
188
|
-
leftCalendarState.setFocusedDate(
|
|
201
|
+
rightCalendarState.setFocusedDate(date_1);
|
|
202
|
+
leftCalendarState.setFocusedDate(date_1.subtract({ months: 1 }));
|
|
189
203
|
}
|
|
190
204
|
}
|
|
191
205
|
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
192
206
|
setRangeSelection({
|
|
193
|
-
start:
|
|
207
|
+
start: date_1,
|
|
194
208
|
end: null,
|
|
195
209
|
isSelecting: true
|
|
196
210
|
});
|
|
@@ -199,7 +213,7 @@ var DateRangePickerBase = (props) => {
|
|
|
199
213
|
rightCalendarState.setValue(null);
|
|
200
214
|
} else {
|
|
201
215
|
const { start } = rangeSelection;
|
|
202
|
-
const end =
|
|
216
|
+
const end = date_1;
|
|
203
217
|
const finalStart = start.compare(end) <= 0 ? start : end;
|
|
204
218
|
const finalEnd = start.compare(end) <= 0 ? end : start;
|
|
205
219
|
const newRange = {
|
|
@@ -223,16 +237,16 @@ var DateRangePickerBase = (props) => {
|
|
|
223
237
|
rightCalendarState,
|
|
224
238
|
dialogState
|
|
225
239
|
]);
|
|
226
|
-
const handleKeyboardNavigation = useCallback((event,
|
|
227
|
-
const
|
|
228
|
-
const otherState =
|
|
240
|
+
const handleKeyboardNavigation = useCallback((event, date_2, calendarSide_0) => {
|
|
241
|
+
const currentState_0 = calendarSide_0 === "left" ? leftCalendarState : rightCalendarState;
|
|
242
|
+
const otherState = calendarSide_0 === "left" ? rightCalendarState : leftCalendarState;
|
|
229
243
|
let shouldPreventDefault = false;
|
|
230
244
|
switch (event.key) {
|
|
231
245
|
case "ArrowRight": {
|
|
232
|
-
const nextDate =
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
246
|
+
const nextDate = date_2.add({ days: 1 });
|
|
247
|
+
const currentMonth_2 = currentState_0.visibleRange.start;
|
|
248
|
+
const otherMonth_2 = otherState.visibleRange.start;
|
|
249
|
+
if (calendarSide_0 === "left" && nextDate.month !== currentMonth_2.month) if (nextDate.year === otherMonth_2.year && nextDate.month === otherMonth_2.month) {
|
|
236
250
|
otherState.setFocusedDate(nextDate);
|
|
237
251
|
shouldPreventDefault = true;
|
|
238
252
|
} else {
|
|
@@ -242,10 +256,10 @@ var DateRangePickerBase = (props) => {
|
|
|
242
256
|
break;
|
|
243
257
|
}
|
|
244
258
|
case "ArrowLeft": {
|
|
245
|
-
const prevDate =
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
259
|
+
const prevDate = date_2.subtract({ days: 1 });
|
|
260
|
+
const currentMonth_1 = currentState_0.visibleRange.start;
|
|
261
|
+
const otherMonth_1 = otherState.visibleRange.start;
|
|
262
|
+
if (calendarSide_0 === "right" && prevDate.month !== currentMonth_1.month) if (prevDate.year === otherMonth_1.year && prevDate.month === otherMonth_1.month) {
|
|
249
263
|
otherState.setFocusedDate(prevDate);
|
|
250
264
|
shouldPreventDefault = true;
|
|
251
265
|
} else {
|
|
@@ -255,10 +269,10 @@ var DateRangePickerBase = (props) => {
|
|
|
255
269
|
break;
|
|
256
270
|
}
|
|
257
271
|
case "ArrowDown": {
|
|
258
|
-
const nextWeekDate =
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
272
|
+
const nextWeekDate = date_2.add({ weeks: 1 });
|
|
273
|
+
const currentMonth_0 = currentState_0.visibleRange.start;
|
|
274
|
+
const otherMonth_0 = otherState.visibleRange.start;
|
|
275
|
+
if (calendarSide_0 === "left" && nextWeekDate.month !== currentMonth_0.month) if (nextWeekDate.year === otherMonth_0.year && nextWeekDate.month === otherMonth_0.month) {
|
|
262
276
|
otherState.setFocusedDate(nextWeekDate);
|
|
263
277
|
shouldPreventDefault = true;
|
|
264
278
|
} else {
|
|
@@ -268,10 +282,10 @@ var DateRangePickerBase = (props) => {
|
|
|
268
282
|
break;
|
|
269
283
|
}
|
|
270
284
|
case "ArrowUp": {
|
|
271
|
-
const prevWeekDate =
|
|
272
|
-
const currentMonth =
|
|
285
|
+
const prevWeekDate = date_2.subtract({ weeks: 1 });
|
|
286
|
+
const currentMonth = currentState_0.visibleRange.start;
|
|
273
287
|
const otherMonth = otherState.visibleRange.start;
|
|
274
|
-
if (
|
|
288
|
+
if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
275
289
|
otherState.setFocusedDate(prevWeekDate);
|
|
276
290
|
shouldPreventDefault = true;
|
|
277
291
|
} else {
|
|
@@ -282,7 +296,7 @@ var DateRangePickerBase = (props) => {
|
|
|
282
296
|
}
|
|
283
297
|
case "Enter":
|
|
284
298
|
case " ":
|
|
285
|
-
handleDateSelection(
|
|
299
|
+
handleDateSelection(date_2);
|
|
286
300
|
shouldPreventDefault = true;
|
|
287
301
|
break;
|
|
288
302
|
case "Escape":
|
|
@@ -306,14 +320,14 @@ var DateRangePickerBase = (props) => {
|
|
|
306
320
|
rightCalendarState,
|
|
307
321
|
handleDateSelection
|
|
308
322
|
]);
|
|
309
|
-
const syncCalendarStates = useCallback((
|
|
310
|
-
if (isValidRange(
|
|
311
|
-
leftCalendarState.setValue(
|
|
312
|
-
rightCalendarState.setValue(
|
|
313
|
-
dialogState.setValue(
|
|
314
|
-
if (
|
|
315
|
-
start:
|
|
316
|
-
end:
|
|
323
|
+
const syncCalendarStates = useCallback((newValue_3) => {
|
|
324
|
+
if (isValidRange(newValue_3)) return;
|
|
325
|
+
leftCalendarState.setValue(newValue_3);
|
|
326
|
+
rightCalendarState.setValue(newValue_3);
|
|
327
|
+
dialogState.setValue(newValue_3);
|
|
328
|
+
if (newValue_3) setRangeSelection({
|
|
329
|
+
start: newValue_3.start,
|
|
330
|
+
end: newValue_3.end,
|
|
317
331
|
isSelecting: false
|
|
318
332
|
});
|
|
319
333
|
else setRangeSelection({
|
|
@@ -355,11 +369,11 @@ var DateRangePickerBase = (props) => {
|
|
|
355
369
|
dialogState.setValue(state.value);
|
|
356
370
|
leftCalendarState.setValue(state.value);
|
|
357
371
|
rightCalendarState.setValue(state.value);
|
|
358
|
-
const
|
|
359
|
-
const
|
|
360
|
-
leftCalendarState.setFocusedDate(
|
|
361
|
-
if (
|
|
362
|
-
else rightCalendarState.setFocusedDate(
|
|
372
|
+
const startDate_1 = state.value.start || today(getLocalTimeZone());
|
|
373
|
+
const endDate_1 = state.value.end || today(getLocalTimeZone()).add({ months: 1 });
|
|
374
|
+
leftCalendarState.setFocusedDate(startDate_1);
|
|
375
|
+
if (startDate_1.year === endDate_1.year && startDate_1.month === endDate_1.month) rightCalendarState.setFocusedDate(startDate_1.add({ months: 1 }));
|
|
376
|
+
else rightCalendarState.setFocusedDate(endDate_1);
|
|
363
377
|
setRangeSelection({
|
|
364
378
|
start: state.value.start,
|
|
365
379
|
end: state.value.end,
|
|
@@ -368,87 +382,87 @@ var DateRangePickerBase = (props) => {
|
|
|
368
382
|
}
|
|
369
383
|
}
|
|
370
384
|
};
|
|
371
|
-
const
|
|
385
|
+
const todayDate_0 = today(getLocalTimeZone());
|
|
372
386
|
const getThisWeekRange = () => {
|
|
373
387
|
return {
|
|
374
|
-
start: startOfWeek(
|
|
375
|
-
end: endOfWeek(
|
|
388
|
+
start: startOfWeek(todayDate_0, locale),
|
|
389
|
+
end: endOfWeek(todayDate_0, locale)
|
|
376
390
|
};
|
|
377
391
|
};
|
|
378
392
|
const getLastWeekRange = () => {
|
|
379
|
-
const thisWeekStart = startOfWeek(
|
|
393
|
+
const thisWeekStart = startOfWeek(todayDate_0, locale);
|
|
380
394
|
return {
|
|
381
395
|
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
382
396
|
end: thisWeekStart.subtract({ days: 1 })
|
|
383
397
|
};
|
|
384
398
|
};
|
|
385
399
|
const getThisAndLastWeekRange = () => {
|
|
386
|
-
const thisWeekEnd = endOfWeek(
|
|
400
|
+
const thisWeekEnd = endOfWeek(todayDate_0, locale);
|
|
387
401
|
return {
|
|
388
|
-
start: startOfWeek(
|
|
402
|
+
start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
|
|
389
403
|
end: thisWeekEnd
|
|
390
404
|
};
|
|
391
405
|
};
|
|
392
406
|
const getThisMonthRange = () => {
|
|
393
407
|
return {
|
|
394
|
-
start: startOfMonth(
|
|
395
|
-
end: endOfMonth(
|
|
408
|
+
start: startOfMonth(todayDate_0),
|
|
409
|
+
end: endOfMonth(todayDate_0)
|
|
396
410
|
};
|
|
397
411
|
};
|
|
398
412
|
const getThisAndLastMonthRange = () => {
|
|
399
|
-
const thisMonthEnd = endOfMonth(
|
|
413
|
+
const thisMonthEnd = endOfMonth(todayDate_0);
|
|
400
414
|
return {
|
|
401
|
-
start: startOfMonth(
|
|
415
|
+
start: startOfMonth(todayDate_0).subtract({ months: 1 }),
|
|
402
416
|
end: thisMonthEnd
|
|
403
417
|
};
|
|
404
418
|
};
|
|
405
419
|
const presets = [
|
|
406
420
|
{
|
|
407
|
-
label: t(($) =>
|
|
421
|
+
label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
408
422
|
getValue: getThisWeekRange
|
|
409
423
|
},
|
|
410
424
|
{
|
|
411
|
-
label: t(($) =>
|
|
425
|
+
label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
412
426
|
getValue: getLastWeekRange
|
|
413
427
|
},
|
|
414
428
|
{
|
|
415
|
-
label: t(($) =>
|
|
429
|
+
label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
416
430
|
getValue: getThisAndLastWeekRange
|
|
417
431
|
},
|
|
418
432
|
{
|
|
419
|
-
label: t(($) =>
|
|
433
|
+
label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
420
434
|
getValue: getThisMonthRange
|
|
421
435
|
},
|
|
422
436
|
{
|
|
423
|
-
label: t(($) =>
|
|
437
|
+
label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
424
438
|
getValue: getThisAndLastMonthRange
|
|
425
439
|
},
|
|
426
440
|
{
|
|
427
|
-
label: t(($) =>
|
|
441
|
+
label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
428
442
|
getValue: () => ({
|
|
429
|
-
start: startOfYear(
|
|
430
|
-
end:
|
|
443
|
+
start: startOfYear(todayDate_0),
|
|
444
|
+
end: todayDate_0
|
|
431
445
|
})
|
|
432
446
|
},
|
|
433
447
|
{
|
|
434
|
-
label: t(($) =>
|
|
448
|
+
label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
435
449
|
getValue: () => ({
|
|
436
|
-
start: startOfYear(
|
|
437
|
-
end: endOfYear(
|
|
450
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
451
|
+
end: endOfYear(todayDate_0.subtract({ years: 1 }))
|
|
438
452
|
})
|
|
439
453
|
},
|
|
440
454
|
{
|
|
441
|
-
label: t(($) =>
|
|
455
|
+
label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
442
456
|
getValue: () => ({
|
|
443
|
-
start: startOfYear(
|
|
444
|
-
end:
|
|
457
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
458
|
+
end: todayDate_0
|
|
445
459
|
})
|
|
446
460
|
},
|
|
447
461
|
{
|
|
448
|
-
label: t(($) =>
|
|
462
|
+
label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
449
463
|
getValue: () => ({
|
|
450
|
-
start: startOfYear(
|
|
451
|
-
end:
|
|
464
|
+
start: startOfYear(todayDate_0),
|
|
465
|
+
end: todayDate_0
|
|
452
466
|
})
|
|
453
467
|
}
|
|
454
468
|
];
|
|
@@ -456,12 +470,12 @@ var DateRangePickerBase = (props) => {
|
|
|
456
470
|
setActivePreset(preset.label);
|
|
457
471
|
const presetValue = preset.getValue();
|
|
458
472
|
syncCalendarStates(presetValue);
|
|
459
|
-
const
|
|
460
|
-
leftCalendarState.setFocusedDate(
|
|
461
|
-
const
|
|
462
|
-
if ((
|
|
473
|
+
const startDate_2 = presetValue.start;
|
|
474
|
+
leftCalendarState.setFocusedDate(startDate_2);
|
|
475
|
+
const endDate_2 = presetValue.end;
|
|
476
|
+
if ((endDate_2.year - startDate_2.year) * 12 + (endDate_2.month - startDate_2.month) > 2) rightCalendarState.setFocusedDate(endDate_2);
|
|
463
477
|
else {
|
|
464
|
-
const rightCalendarMonth =
|
|
478
|
+
const rightCalendarMonth = startDate_2.add({ months: 1 });
|
|
465
479
|
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
466
480
|
}
|
|
467
481
|
};
|
|
@@ -502,17 +516,17 @@ var DateRangePickerBase = (props) => {
|
|
|
502
516
|
hideSidebar,
|
|
503
517
|
sidebar: /* @__PURE__ */ jsx("div", {
|
|
504
518
|
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 !==
|
|
519
|
+
children: presets.map((preset_0) => /* @__PURE__ */ jsx(Button, {
|
|
520
|
+
onClick: () => selectPreset(preset_0),
|
|
521
|
+
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
522
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
509
523
|
size: "label-2",
|
|
510
524
|
sizeMobile: "label-3",
|
|
511
525
|
as: "span",
|
|
512
526
|
className: "whitespace-nowrap",
|
|
513
|
-
children:
|
|
527
|
+
children: preset_0.label
|
|
514
528
|
})
|
|
515
|
-
},
|
|
529
|
+
}, preset_0.label))
|
|
516
530
|
}),
|
|
517
531
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
518
532
|
isDisabled,
|
|
@@ -559,7 +573,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
559
573
|
renderInput,
|
|
560
574
|
setRenderInput,
|
|
561
575
|
getFocusTarget: (input) => {
|
|
562
|
-
|
|
576
|
+
const container = input.getContainer?.() ?? input;
|
|
577
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
563
578
|
}
|
|
564
579
|
});
|
|
565
580
|
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
@@ -588,10 +603,10 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
588
603
|
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
589
604
|
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
590
605
|
};
|
|
591
|
-
const
|
|
592
|
-
const
|
|
593
|
-
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(
|
|
594
|
-
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(
|
|
606
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start).toJSDate();
|
|
607
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end).toJSDate();
|
|
608
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0);
|
|
609
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0);
|
|
595
610
|
return {
|
|
596
611
|
start: toCalendarDate(startZonedDateTime),
|
|
597
612
|
end: toCalendarDate(endZonedDateTime)
|
|
@@ -624,7 +639,6 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
624
639
|
start: startDateValue,
|
|
625
640
|
end: endDateValue,
|
|
626
641
|
locale,
|
|
627
|
-
placeholder: props.placeholder,
|
|
628
642
|
shouldForceLeadingZeros,
|
|
629
643
|
isDisabled,
|
|
630
644
|
hidePlaceholder: as === "floating" && !hasProvidedRangeValue
|
|
@@ -651,6 +665,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
651
665
|
onStaticInteract: renderRealInput,
|
|
652
666
|
actionContent: staticTodayIcon,
|
|
653
667
|
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
668
|
+
wrapContentAndTrailing: true,
|
|
669
|
+
contentAndTrailingClassName: "gap-2!",
|
|
654
670
|
trailingClassName: "py-0! pl-0!",
|
|
655
671
|
trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
|
|
656
672
|
children: staticSegments
|
|
@@ -679,7 +695,7 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
679
695
|
...dateLimits,
|
|
680
696
|
ref: mergeRefs(props.ref, inputRef),
|
|
681
697
|
value: parseDateRange(props.value),
|
|
682
|
-
onChange: (
|
|
698
|
+
onChange: (value_0) => props.onChange?.(formatDateRange(value_0))
|
|
683
699
|
});
|
|
684
700
|
};
|
|
685
701
|
//#endregion
|