@povio/ui 2.3.0-rc.5 → 2.3.0-rc.7
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 +164 -34
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +16 -12
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +111 -107
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +17 -13
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +384 -116
- 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 +245 -90
- 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/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 +253 -82
- 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 +298 -89
- package/dist/components/inputs/Input/TextInput/TextInput.js +241 -81
- 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.js +65 -14
- 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 +9 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +2 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +107 -27
- package/dist/components/inputs/Selection/Select/Select.js +9 -3
- 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 +334 -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 +34 -34
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +1 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +444 -116
- package/dist/components/inputs/Slider/Slider.js +247 -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 -41
- 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.js +97 -39
- 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 +23 -23
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.js +42 -16
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.js +39 -8
- package/dist/config/uiStyle.context.js +15 -5
- 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/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/package.json +1 -1
|
@@ -64,9 +64,12 @@ var DatePickerBase = (props) => {
|
|
|
64
64
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
65
65
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
66
66
|
} }), []);
|
|
67
|
-
useImperativeHandle(ref, () => ({
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
useImperativeHandle(ref, () => ({
|
|
68
|
+
clear: () => {
|
|
69
|
+
datePickerInputRef.current?.clear();
|
|
70
|
+
},
|
|
71
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
72
|
+
}));
|
|
70
73
|
const handleBlur = (val) => {
|
|
71
74
|
onBlur?.({ target: { value: val } });
|
|
72
75
|
};
|
|
@@ -81,9 +84,9 @@ var DatePickerBase = (props) => {
|
|
|
81
84
|
...rest,
|
|
82
85
|
shouldForceLeadingZeros,
|
|
83
86
|
value,
|
|
84
|
-
onChange: (
|
|
85
|
-
let normalizedValue =
|
|
86
|
-
if (
|
|
87
|
+
onChange: (val_0) => {
|
|
88
|
+
let normalizedValue = val_0;
|
|
89
|
+
if (val_0) normalizedValue = normalizeByGranularity(val_0);
|
|
87
90
|
if (normalizedValue && (rest.minValue && normalizedValue < rest?.minValue || rest?.maxValue && normalizedValue > rest?.maxValue)) {
|
|
88
91
|
state.setValue(state.value);
|
|
89
92
|
return;
|
|
@@ -241,7 +244,8 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
241
244
|
renderInput,
|
|
242
245
|
setRenderInput,
|
|
243
246
|
getFocusTarget: (input) => {
|
|
244
|
-
|
|
247
|
+
const container = input.getContainer?.() ?? input;
|
|
248
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
245
249
|
}
|
|
246
250
|
});
|
|
247
251
|
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
@@ -263,14 +267,14 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
263
267
|
if (calendarDate === null) return null;
|
|
264
268
|
const normalizedDate = normalizeByGranularity(calendarDate);
|
|
265
269
|
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
|
|
266
|
-
const
|
|
267
|
-
return DateTime.fromJSDate(
|
|
270
|
+
const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate);
|
|
271
|
+
return DateTime.fromJSDate(date_0).toISODate();
|
|
268
272
|
};
|
|
269
273
|
const parseCalendarDate = (formattedDate) => {
|
|
270
274
|
if (formattedDate == null) return formattedDate;
|
|
271
275
|
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
272
|
-
const
|
|
273
|
-
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(
|
|
276
|
+
const date_1 = DateTime.fromISO(formattedDate).toJSDate();
|
|
277
|
+
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1)));
|
|
274
278
|
};
|
|
275
279
|
const dateLimits = {
|
|
276
280
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
@@ -347,7 +351,7 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
347
351
|
ref: mergeRefs(props.ref, inputRef),
|
|
348
352
|
granularity,
|
|
349
353
|
value: parseCalendarDate(props.value),
|
|
350
|
-
onChange: (
|
|
354
|
+
onChange: (value_0) => props.onChange?.(formatCalendarDate(value_0))
|
|
351
355
|
});
|
|
352
356
|
};
|
|
353
357
|
//#endregion
|
|
@@ -76,11 +76,14 @@ var DateRangePickerBase = (props) => {
|
|
|
76
76
|
shouldForceLeadingZeros
|
|
77
77
|
}, dialogState, dateRangePickerRef);
|
|
78
78
|
const { locale } = useLocale$1();
|
|
79
|
-
useImperativeHandle(ref, () => ({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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 } });
|
|
84
87
|
};
|
|
85
88
|
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
86
89
|
const formFieldProps = {
|
|
@@ -133,10 +136,10 @@ var DateRangePickerBase = (props) => {
|
|
|
133
136
|
className: headerClassName,
|
|
134
137
|
labelProps
|
|
135
138
|
};
|
|
136
|
-
const isValidRange = useCallback((
|
|
137
|
-
if (
|
|
138
|
-
const startDate =
|
|
139
|
-
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) {
|
|
140
143
|
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
141
144
|
return true;
|
|
142
145
|
}
|
|
@@ -144,20 +147,20 @@ var DateRangePickerBase = (props) => {
|
|
|
144
147
|
} else setValidationRangeError(void 0);
|
|
145
148
|
return false;
|
|
146
149
|
}, [t]);
|
|
147
|
-
const handleCalendarStatesChange = (
|
|
148
|
-
if (
|
|
149
|
-
if (isValidRange(
|
|
150
|
-
dialogState.setValue(
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
leftCalendarState.setFocusedDate(
|
|
154
|
-
if (
|
|
155
|
-
else rightCalendarState.setFocusedDate(
|
|
156
|
-
leftCalendarState.setValue(
|
|
157
|
-
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);
|
|
158
161
|
setRangeSelection({
|
|
159
|
-
start:
|
|
160
|
-
end:
|
|
162
|
+
start: newValue_2.start,
|
|
163
|
+
end: newValue_2.end,
|
|
161
164
|
isSelecting: false
|
|
162
165
|
});
|
|
163
166
|
setHoverDate(null);
|
|
@@ -181,27 +184,27 @@ var DateRangePickerBase = (props) => {
|
|
|
181
184
|
setHoverDate(date);
|
|
182
185
|
});
|
|
183
186
|
}, []);
|
|
184
|
-
const handleDateHover = useCallback((
|
|
185
|
-
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(
|
|
187
|
+
const handleDateHover = useCallback((date_0) => {
|
|
188
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_0);
|
|
186
189
|
}, [
|
|
187
190
|
rangeSelection.isSelecting,
|
|
188
191
|
rangeSelection.start,
|
|
189
192
|
throttledSetHoverDate
|
|
190
193
|
]);
|
|
191
|
-
const handleDateSelection = useCallback((
|
|
194
|
+
const handleDateSelection = useCallback((date_1, calendarSide) => {
|
|
192
195
|
if (calendarSide) {
|
|
193
196
|
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
194
|
-
if (
|
|
195
|
-
leftCalendarState.setFocusedDate(
|
|
196
|
-
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 }));
|
|
197
200
|
} else {
|
|
198
|
-
rightCalendarState.setFocusedDate(
|
|
199
|
-
leftCalendarState.setFocusedDate(
|
|
201
|
+
rightCalendarState.setFocusedDate(date_1);
|
|
202
|
+
leftCalendarState.setFocusedDate(date_1.subtract({ months: 1 }));
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
205
|
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
203
206
|
setRangeSelection({
|
|
204
|
-
start:
|
|
207
|
+
start: date_1,
|
|
205
208
|
end: null,
|
|
206
209
|
isSelecting: true
|
|
207
210
|
});
|
|
@@ -210,7 +213,7 @@ var DateRangePickerBase = (props) => {
|
|
|
210
213
|
rightCalendarState.setValue(null);
|
|
211
214
|
} else {
|
|
212
215
|
const { start } = rangeSelection;
|
|
213
|
-
const end =
|
|
216
|
+
const end = date_1;
|
|
214
217
|
const finalStart = start.compare(end) <= 0 ? start : end;
|
|
215
218
|
const finalEnd = start.compare(end) <= 0 ? end : start;
|
|
216
219
|
const newRange = {
|
|
@@ -234,16 +237,16 @@ var DateRangePickerBase = (props) => {
|
|
|
234
237
|
rightCalendarState,
|
|
235
238
|
dialogState
|
|
236
239
|
]);
|
|
237
|
-
const handleKeyboardNavigation = useCallback((event,
|
|
238
|
-
const
|
|
239
|
-
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;
|
|
240
243
|
let shouldPreventDefault = false;
|
|
241
244
|
switch (event.key) {
|
|
242
245
|
case "ArrowRight": {
|
|
243
|
-
const nextDate =
|
|
244
|
-
const
|
|
245
|
-
const
|
|
246
|
-
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) {
|
|
247
250
|
otherState.setFocusedDate(nextDate);
|
|
248
251
|
shouldPreventDefault = true;
|
|
249
252
|
} else {
|
|
@@ -253,10 +256,10 @@ var DateRangePickerBase = (props) => {
|
|
|
253
256
|
break;
|
|
254
257
|
}
|
|
255
258
|
case "ArrowLeft": {
|
|
256
|
-
const prevDate =
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
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) {
|
|
260
263
|
otherState.setFocusedDate(prevDate);
|
|
261
264
|
shouldPreventDefault = true;
|
|
262
265
|
} else {
|
|
@@ -266,10 +269,10 @@ var DateRangePickerBase = (props) => {
|
|
|
266
269
|
break;
|
|
267
270
|
}
|
|
268
271
|
case "ArrowDown": {
|
|
269
|
-
const nextWeekDate =
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
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) {
|
|
273
276
|
otherState.setFocusedDate(nextWeekDate);
|
|
274
277
|
shouldPreventDefault = true;
|
|
275
278
|
} else {
|
|
@@ -279,10 +282,10 @@ var DateRangePickerBase = (props) => {
|
|
|
279
282
|
break;
|
|
280
283
|
}
|
|
281
284
|
case "ArrowUp": {
|
|
282
|
-
const prevWeekDate =
|
|
283
|
-
const currentMonth =
|
|
285
|
+
const prevWeekDate = date_2.subtract({ weeks: 1 });
|
|
286
|
+
const currentMonth = currentState_0.visibleRange.start;
|
|
284
287
|
const otherMonth = otherState.visibleRange.start;
|
|
285
|
-
if (
|
|
288
|
+
if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
286
289
|
otherState.setFocusedDate(prevWeekDate);
|
|
287
290
|
shouldPreventDefault = true;
|
|
288
291
|
} else {
|
|
@@ -293,7 +296,7 @@ var DateRangePickerBase = (props) => {
|
|
|
293
296
|
}
|
|
294
297
|
case "Enter":
|
|
295
298
|
case " ":
|
|
296
|
-
handleDateSelection(
|
|
299
|
+
handleDateSelection(date_2);
|
|
297
300
|
shouldPreventDefault = true;
|
|
298
301
|
break;
|
|
299
302
|
case "Escape":
|
|
@@ -317,14 +320,14 @@ var DateRangePickerBase = (props) => {
|
|
|
317
320
|
rightCalendarState,
|
|
318
321
|
handleDateSelection
|
|
319
322
|
]);
|
|
320
|
-
const syncCalendarStates = useCallback((
|
|
321
|
-
if (isValidRange(
|
|
322
|
-
leftCalendarState.setValue(
|
|
323
|
-
rightCalendarState.setValue(
|
|
324
|
-
dialogState.setValue(
|
|
325
|
-
if (
|
|
326
|
-
start:
|
|
327
|
-
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,
|
|
328
331
|
isSelecting: false
|
|
329
332
|
});
|
|
330
333
|
else setRangeSelection({
|
|
@@ -366,11 +369,11 @@ var DateRangePickerBase = (props) => {
|
|
|
366
369
|
dialogState.setValue(state.value);
|
|
367
370
|
leftCalendarState.setValue(state.value);
|
|
368
371
|
rightCalendarState.setValue(state.value);
|
|
369
|
-
const
|
|
370
|
-
const
|
|
371
|
-
leftCalendarState.setFocusedDate(
|
|
372
|
-
if (
|
|
373
|
-
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);
|
|
374
377
|
setRangeSelection({
|
|
375
378
|
start: state.value.start,
|
|
376
379
|
end: state.value.end,
|
|
@@ -379,87 +382,87 @@ var DateRangePickerBase = (props) => {
|
|
|
379
382
|
}
|
|
380
383
|
}
|
|
381
384
|
};
|
|
382
|
-
const
|
|
385
|
+
const todayDate_0 = today(getLocalTimeZone());
|
|
383
386
|
const getThisWeekRange = () => {
|
|
384
387
|
return {
|
|
385
|
-
start: startOfWeek(
|
|
386
|
-
end: endOfWeek(
|
|
388
|
+
start: startOfWeek(todayDate_0, locale),
|
|
389
|
+
end: endOfWeek(todayDate_0, locale)
|
|
387
390
|
};
|
|
388
391
|
};
|
|
389
392
|
const getLastWeekRange = () => {
|
|
390
|
-
const thisWeekStart = startOfWeek(
|
|
393
|
+
const thisWeekStart = startOfWeek(todayDate_0, locale);
|
|
391
394
|
return {
|
|
392
395
|
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
393
396
|
end: thisWeekStart.subtract({ days: 1 })
|
|
394
397
|
};
|
|
395
398
|
};
|
|
396
399
|
const getThisAndLastWeekRange = () => {
|
|
397
|
-
const thisWeekEnd = endOfWeek(
|
|
400
|
+
const thisWeekEnd = endOfWeek(todayDate_0, locale);
|
|
398
401
|
return {
|
|
399
|
-
start: startOfWeek(
|
|
402
|
+
start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
|
|
400
403
|
end: thisWeekEnd
|
|
401
404
|
};
|
|
402
405
|
};
|
|
403
406
|
const getThisMonthRange = () => {
|
|
404
407
|
return {
|
|
405
|
-
start: startOfMonth(
|
|
406
|
-
end: endOfMonth(
|
|
408
|
+
start: startOfMonth(todayDate_0),
|
|
409
|
+
end: endOfMonth(todayDate_0)
|
|
407
410
|
};
|
|
408
411
|
};
|
|
409
412
|
const getThisAndLastMonthRange = () => {
|
|
410
|
-
const thisMonthEnd = endOfMonth(
|
|
413
|
+
const thisMonthEnd = endOfMonth(todayDate_0);
|
|
411
414
|
return {
|
|
412
|
-
start: startOfMonth(
|
|
415
|
+
start: startOfMonth(todayDate_0).subtract({ months: 1 }),
|
|
413
416
|
end: thisMonthEnd
|
|
414
417
|
};
|
|
415
418
|
};
|
|
416
419
|
const presets = [
|
|
417
420
|
{
|
|
418
|
-
label: t(($) =>
|
|
421
|
+
label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
419
422
|
getValue: getThisWeekRange
|
|
420
423
|
},
|
|
421
424
|
{
|
|
422
|
-
label: t(($) =>
|
|
425
|
+
label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
423
426
|
getValue: getLastWeekRange
|
|
424
427
|
},
|
|
425
428
|
{
|
|
426
|
-
label: t(($) =>
|
|
429
|
+
label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
427
430
|
getValue: getThisAndLastWeekRange
|
|
428
431
|
},
|
|
429
432
|
{
|
|
430
|
-
label: t(($) =>
|
|
433
|
+
label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
431
434
|
getValue: getThisMonthRange
|
|
432
435
|
},
|
|
433
436
|
{
|
|
434
|
-
label: t(($) =>
|
|
437
|
+
label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
435
438
|
getValue: getThisAndLastMonthRange
|
|
436
439
|
},
|
|
437
440
|
{
|
|
438
|
-
label: t(($) =>
|
|
441
|
+
label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
439
442
|
getValue: () => ({
|
|
440
|
-
start: startOfYear(
|
|
441
|
-
end:
|
|
443
|
+
start: startOfYear(todayDate_0),
|
|
444
|
+
end: todayDate_0
|
|
442
445
|
})
|
|
443
446
|
},
|
|
444
447
|
{
|
|
445
|
-
label: t(($) =>
|
|
448
|
+
label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
446
449
|
getValue: () => ({
|
|
447
|
-
start: startOfYear(
|
|
448
|
-
end: endOfYear(
|
|
450
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
451
|
+
end: endOfYear(todayDate_0.subtract({ years: 1 }))
|
|
449
452
|
})
|
|
450
453
|
},
|
|
451
454
|
{
|
|
452
|
-
label: t(($) =>
|
|
455
|
+
label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
453
456
|
getValue: () => ({
|
|
454
|
-
start: startOfYear(
|
|
455
|
-
end:
|
|
457
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
458
|
+
end: todayDate_0
|
|
456
459
|
})
|
|
457
460
|
},
|
|
458
461
|
{
|
|
459
|
-
label: t(($) =>
|
|
462
|
+
label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
460
463
|
getValue: () => ({
|
|
461
|
-
start: startOfYear(
|
|
462
|
-
end:
|
|
464
|
+
start: startOfYear(todayDate_0),
|
|
465
|
+
end: todayDate_0
|
|
463
466
|
})
|
|
464
467
|
}
|
|
465
468
|
];
|
|
@@ -467,12 +470,12 @@ var DateRangePickerBase = (props) => {
|
|
|
467
470
|
setActivePreset(preset.label);
|
|
468
471
|
const presetValue = preset.getValue();
|
|
469
472
|
syncCalendarStates(presetValue);
|
|
470
|
-
const
|
|
471
|
-
leftCalendarState.setFocusedDate(
|
|
472
|
-
const
|
|
473
|
-
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);
|
|
474
477
|
else {
|
|
475
|
-
const rightCalendarMonth =
|
|
478
|
+
const rightCalendarMonth = startDate_2.add({ months: 1 });
|
|
476
479
|
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
477
480
|
}
|
|
478
481
|
};
|
|
@@ -513,17 +516,17 @@ var DateRangePickerBase = (props) => {
|
|
|
513
516
|
hideSidebar,
|
|
514
517
|
sidebar: /* @__PURE__ */ jsx("div", {
|
|
515
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",
|
|
516
|
-
children: presets.map((
|
|
517
|
-
onClick: () => selectPreset(
|
|
518
|
-
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"),
|
|
519
522
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
520
523
|
size: "label-2",
|
|
521
524
|
sizeMobile: "label-3",
|
|
522
525
|
as: "span",
|
|
523
526
|
className: "whitespace-nowrap",
|
|
524
|
-
children:
|
|
527
|
+
children: preset_0.label
|
|
525
528
|
})
|
|
526
|
-
},
|
|
529
|
+
}, preset_0.label))
|
|
527
530
|
}),
|
|
528
531
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
529
532
|
isDisabled,
|
|
@@ -570,7 +573,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
570
573
|
renderInput,
|
|
571
574
|
setRenderInput,
|
|
572
575
|
getFocusTarget: (input) => {
|
|
573
|
-
|
|
576
|
+
const container = input.getContainer?.() ?? input;
|
|
577
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
574
578
|
}
|
|
575
579
|
});
|
|
576
580
|
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
@@ -599,10 +603,10 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
599
603
|
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
600
604
|
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
601
605
|
};
|
|
602
|
-
const
|
|
603
|
-
const
|
|
604
|
-
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(
|
|
605
|
-
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);
|
|
606
610
|
return {
|
|
607
611
|
start: toCalendarDate(startZonedDateTime),
|
|
608
612
|
end: toCalendarDate(endZonedDateTime)
|
|
@@ -691,7 +695,7 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
691
695
|
...dateLimits,
|
|
692
696
|
ref: mergeRefs(props.ref, inputRef),
|
|
693
697
|
value: parseDateRange(props.value),
|
|
694
|
-
onChange: (
|
|
698
|
+
onChange: (value_0) => props.onChange?.(formatDateRange(value_0))
|
|
695
699
|
});
|
|
696
700
|
};
|
|
697
701
|
//#endregion
|
|
@@ -57,9 +57,12 @@ var DateTimePickerBase = (props) => {
|
|
|
57
57
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
58
58
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
59
59
|
} }), []);
|
|
60
|
-
useImperativeHandle(ref, () => ({
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
useImperativeHandle(ref, () => ({
|
|
61
|
+
clear: () => {
|
|
62
|
+
datePickerInputRef.current?.clear();
|
|
63
|
+
},
|
|
64
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
65
|
+
}));
|
|
63
66
|
const handleBlur = (val) => {
|
|
64
67
|
onBlur?.({ target: { value: val } });
|
|
65
68
|
};
|
|
@@ -79,11 +82,11 @@ var DateTimePickerBase = (props) => {
|
|
|
79
82
|
...rest,
|
|
80
83
|
shouldForceLeadingZeros,
|
|
81
84
|
value,
|
|
82
|
-
onChange: (
|
|
83
|
-
onChange?.(
|
|
84
|
-
dialogState.setValue(
|
|
85
|
-
calendarState.setFocusedDate(
|
|
86
|
-
debouncedBlur(
|
|
85
|
+
onChange: (val_0) => {
|
|
86
|
+
onChange?.(val_0);
|
|
87
|
+
dialogState.setValue(val_0);
|
|
88
|
+
calendarState.setFocusedDate(val_0 || today(getLocalTimeZone()));
|
|
89
|
+
debouncedBlur(val_0);
|
|
87
90
|
},
|
|
88
91
|
shouldCloseOnSelect: false,
|
|
89
92
|
granularity: "minute",
|
|
@@ -178,9 +181,9 @@ var DateTimePickerBase = (props) => {
|
|
|
178
181
|
groupProps,
|
|
179
182
|
fieldProps: {
|
|
180
183
|
...fieldProps,
|
|
181
|
-
onBlur: (
|
|
182
|
-
fieldProps.onBlur?.(
|
|
183
|
-
onInputBlur(
|
|
184
|
+
onBlur: (e_0) => {
|
|
185
|
+
fieldProps.onBlur?.(e_0);
|
|
186
|
+
onInputBlur(e_0);
|
|
184
187
|
}
|
|
185
188
|
},
|
|
186
189
|
buttonProps,
|
|
@@ -243,7 +246,8 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
243
246
|
renderInput,
|
|
244
247
|
setRenderInput,
|
|
245
248
|
getFocusTarget: (input) => {
|
|
246
|
-
|
|
249
|
+
const container = input.getContainer?.() ?? input;
|
|
250
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
247
251
|
}
|
|
248
252
|
});
|
|
249
253
|
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
@@ -332,7 +336,7 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
332
336
|
...props,
|
|
333
337
|
ref: mergeRefs(props.ref, inputRef),
|
|
334
338
|
value: parseDateValue(props.value),
|
|
335
|
-
onChange: (
|
|
339
|
+
onChange: (value_0) => props.onChange?.(formatDateValue(value_0))
|
|
336
340
|
});
|
|
337
341
|
};
|
|
338
342
|
//#endregion
|