@povio/ui 2.3.0-rc.9 → 2.3.1
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 +11 -26
- package/dist/assets/icons/AlignLeft.js +11 -26
- package/dist/assets/icons/AlignLeftRight.js +11 -26
- package/dist/assets/icons/AlignRight.js +11 -26
- package/dist/assets/icons/ArrowDropDown.js +11 -26
- package/dist/assets/icons/ArrowDropUp.js +11 -26
- package/dist/assets/icons/ArrowLeft.js +11 -26
- package/dist/assets/icons/ArrowRight.js +11 -26
- package/dist/assets/icons/Bold.js +11 -26
- package/dist/assets/icons/BulletedList.js +11 -26
- package/dist/assets/icons/Calendar.js +13 -28
- package/dist/assets/icons/Check.js +13 -28
- package/dist/assets/icons/CheckCircle.js +11 -26
- package/dist/assets/icons/CheckboxCheckmark.js +14 -29
- package/dist/assets/icons/CheckboxIndeterminate.js +14 -29
- package/dist/assets/icons/ChevronDown.js +13 -28
- package/dist/assets/icons/ChevronLeft.js +13 -28
- package/dist/assets/icons/ChevronRight.js +13 -28
- package/dist/assets/icons/ChevronUp.js +13 -28
- package/dist/assets/icons/ChevronsLeft.js +13 -28
- package/dist/assets/icons/ChevronsRight.js +13 -28
- package/dist/assets/icons/Clock.js +11 -26
- package/dist/assets/icons/Close.js +11 -26
- package/dist/assets/icons/DateTime.js +14 -35
- package/dist/assets/icons/DragIndicator.js +11 -26
- package/dist/assets/icons/File.js +13 -28
- package/dist/assets/icons/Highlight.js +11 -26
- package/dist/assets/icons/HighlightOn.js +15 -49
- package/dist/assets/icons/Home.js +11 -26
- package/dist/assets/icons/Info.js +16 -37
- package/dist/assets/icons/Italic.js +11 -26
- package/dist/assets/icons/Link.js +11 -26
- package/dist/assets/icons/Menu.js +11 -26
- package/dist/assets/icons/NumberedList.js +11 -26
- package/dist/assets/icons/PointerHorizontal.js +11 -26
- package/dist/assets/icons/PointerVertical.js +11 -26
- package/dist/assets/icons/Search.js +11 -26
- package/dist/assets/icons/Send.js +13 -28
- package/dist/assets/icons/Strikethrough.js +11 -26
- package/dist/assets/icons/TextColor.js +14 -48
- package/dist/assets/icons/Today.js +11 -26
- package/dist/assets/icons/Underlined.js +13 -28
- package/dist/assets/icons/Upload.js +14 -35
- package/dist/assets/icons/Visibility.js +11 -26
- package/dist/assets/icons/VisibilityOff.js +11 -26
- package/dist/assets/icons/WarningFilled.js +13 -28
- package/dist/components/Breadcrumbs/Breadcrumbs.js +56 -207
- package/dist/components/Menu/Menu.js +2 -18
- package/dist/components/Menu/MenuDesktop.js +7 -41
- package/dist/components/Menu/MenuItem.js +9 -32
- package/dist/components/Menu/MenuMobile.js +38 -97
- package/dist/components/Menu/MenuPopover.js +29 -105
- package/dist/components/buttons/IconButton/IconButton.js +8 -40
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -2
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
- package/dist/components/buttons/PillButton/PillButton.js +17 -55
- package/dist/components/buttons/SplitButton/SplitButton.js +18 -103
- package/dist/components/buttons/TextButton/TextButton.js +8 -30
- package/dist/components/buttons/ToggleButton/ToggleButton.js +8 -28
- package/dist/components/buttons/shared/ButtonContent.js +22 -80
- package/dist/components/inputs/Checkbox/Checkbox.js +35 -172
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +0 -3
- package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -2
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +5 -10
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +20 -121
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -10
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +111 -215
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -11
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +19 -123
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -5
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +104 -448
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +2 -5
- package/dist/components/inputs/DateTime/shared/Calendar.js +119 -330
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +102 -283
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +33 -142
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +93 -249
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +137 -318
- package/dist/components/inputs/DateTime/shared/DateField.js +112 -296
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -6
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +136 -355
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -14
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +11 -97
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +27 -81
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +58 -103
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
- package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +110 -279
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +65 -207
- package/dist/components/inputs/DateTime/shared/YearPicker.js +68 -119
- package/dist/components/inputs/File/FileUpload.js +44 -87
- package/dist/components/inputs/File/FileUploadContainer.js +7 -15
- package/dist/components/inputs/File/InputUpload.js +79 -317
- package/dist/components/inputs/File/shared/FileCard.js +41 -104
- package/dist/components/inputs/File/shared/FileCardList.js +12 -47
- package/dist/components/inputs/File/shared/FileUploadContent.js +44 -175
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +46 -149
- package/dist/components/inputs/File/shared/FileUploadContentError.js +93 -234
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +97 -230
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +55 -199
- package/dist/components/inputs/File/shared/InputUploadContent.js +34 -148
- package/dist/components/inputs/File/shared/InputUploadFilled.js +8 -49
- package/dist/components/inputs/File/shared/ProgressBar.js +9 -48
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +37 -119
- package/dist/components/inputs/FormField/FormFieldError.js +5 -25
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +22 -81
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
- package/dist/components/inputs/FormField/FormFieldHelper.js +6 -26
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +2 -5
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +88 -334
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +9 -48
- package/dist/components/inputs/Input/TextArea/TextArea.js +90 -305
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -3
- package/dist/components/inputs/Input/TextInput/TextInput.js +79 -319
- package/dist/components/inputs/Input/shared/InputContent.js +59 -192
- package/dist/components/inputs/Inputs/Form.js +11 -40
- package/dist/components/inputs/Inputs/InputItem.d.ts +21 -16
- package/dist/components/inputs/Inputs/InputItem.js +14 -71
- package/dist/components/inputs/Inputs/Inputs.js +11 -37
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.js +60 -352
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -17
- package/dist/components/inputs/RadioGroup/radio.cva.js +1 -42
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +2 -6
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +7 -109
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +8 -34
- package/dist/components/inputs/Selection/Select/Select.d.ts +3 -7
- package/dist/components/inputs/Selection/Select/Select.js +5 -132
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +1 -8
- package/dist/components/inputs/Selection/shared/SelectBase.js +18 -69
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +138 -393
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +116 -338
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +25 -99
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +52 -164
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +21 -70
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +9 -58
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +3 -9
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
- package/dist/components/inputs/Selection/shared/select.context.js +34 -57
- package/dist/components/inputs/Selection/shared/select.types.d.ts +2 -3
- package/dist/components/inputs/Selection/shared/useSelectItems.js +49 -109
- package/dist/components/inputs/Slider/Slider.js +74 -250
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +0 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +98 -447
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +30 -102
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +45 -194
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +32 -92
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +54 -126
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +38 -141
- package/dist/components/inputs/Toggle/Toggle.js +37 -189
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +0 -3
- package/dist/components/inputs/Toggle/toggle.cva.js +1 -2
- package/dist/components/inputs/shared/CheckContent.d.ts +1 -2
- package/dist/components/inputs/shared/CheckContent.js +11 -21
- package/dist/components/inputs/shared/InputClear.d.ts +1 -2
- package/dist/components/inputs/shared/InputClear.js +13 -79
- package/dist/components/inputs/shared/TooltipWrapper.js +11 -50
- package/dist/components/inputs/shared/input.cva.d.ts +0 -10
- package/dist/components/inputs/shared/input.cva.js +4 -32
- package/dist/components/navigation/Accordion/Accordion.js +22 -69
- package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
- package/dist/components/navigation/Stepper/Stepper.js +22 -67
- package/dist/components/navigation/Stepper/StepperItem.js +31 -104
- package/dist/components/navigation/Stepper/StepperSeparator.js +5 -23
- package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
- package/dist/components/overlays/BottomSheet/BottomSheet.js +49 -98
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +8 -48
- package/dist/components/overlays/Drawer/Drawer.js +20 -62
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +27 -83
- package/dist/components/overlays/Tooltip/Tooltip.js +28 -137
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +12 -37
- package/dist/components/segment/Segment.js +57 -218
- package/dist/components/segment/SegmentItem.js +10 -67
- package/dist/components/shared/pagination/Pagination.js +22 -108
- package/dist/components/shared/pagination/PaginationList.js +64 -167
- package/dist/components/status/Alert/Alert.js +30 -97
- package/dist/components/status/Loader/Loader.js +22 -77
- package/dist/components/status/Toast/Toast.js +13 -21
- package/dist/components/status/Toast/useToast.js +57 -62
- package/dist/components/table/ColumnConfig.js +54 -158
- package/dist/components/table/InfiniteTable.js +16 -67
- package/dist/components/table/PaginatedTable.js +18 -84
- package/dist/components/table/Table.js +27 -28
- package/dist/components/text/Link/Link.js +7 -19
- package/dist/components/text/Typography/Typography.js +8 -23
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +9 -23
- package/dist/config/router.context.js +16 -42
- package/dist/config/theme.context.js +45 -98
- package/dist/config/uiConfig.context.d.ts +6 -16
- package/dist/config/uiConfig.context.js +13 -56
- package/dist/config/uiStyle.context.d.ts +4 -27
- package/dist/config/uiStyle.context.js +5 -15
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +0 -3
- package/dist/hooks/useBreakpoint.js +3 -16
- package/dist/hooks/useDebounceCallback.js +17 -51
- package/dist/hooks/useFilters.js +64 -125
- package/dist/hooks/useForm.js +8 -42
- package/dist/hooks/useFormAutosave.js +30 -101
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +24 -91
- package/dist/hooks/useLocalStorage.js +10 -43
- package/dist/hooks/useLongPressRepeat.js +20 -55
- package/dist/hooks/usePagination.js +19 -49
- package/dist/hooks/useScrollableListBox.js +16 -37
- package/dist/hooks/useSorting.js +28 -69
- package/dist/hooks/useStateAndRef.js +7 -21
- package/dist/hooks/useTableColumnConfig.js +31 -124
- package/dist/hooks/useTranslationMemo.js +5 -25
- package/dist/index.d.ts +0 -7
- package/dist/index.js +3 -5
- package/dist/tw-ui-plugin.js +0 -2
- package/dist/utils/date-time.utils.d.ts +10 -31
- package/dist/utils/date-time.utils.js +22 -123
- package/dist/utils/dom.utils.js +1 -1
- package/package.json +1 -1
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -4
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +0 -7
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +0 -13
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -6
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +0 -21
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -31
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +0 -80
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -6
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -11
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +0 -45
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +0 -571
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -35
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -479
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +0 -4
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +0 -5
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +0 -7
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +0 -36
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
- package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -122
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +0 -47
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -6
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -13
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +0 -3
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +0 -5
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +0 -5
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +0 -5
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +0 -37
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -79
- package/dist/components/inputs/Skeleton/InputFrame.js +0 -526
- package/dist/components/inputs/shared/StaticInput.d.ts +0 -38
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +0 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +0 -5
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -14
- package/dist/components/inputs/shared/useStaticInputHandoff.js +0 -100
- package/dist/hooks/useQueryAutocomplete.d.ts +0 -14
- package/dist/hooks/useQueryAutocomplete.js +0 -57
- package/dist/utils/query.utils.d.ts +0 -4
- package/dist/utils/query.utils.js +0 -8
|
@@ -1,315 +1,131 @@
|
|
|
1
1
|
import { DateSegmentItem } from "./DateSegmentItem.js";
|
|
2
2
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
3
|
-
import { c } from "react/compiler-runtime";
|
|
4
3
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
4
|
import { clsx } from "clsx";
|
|
6
|
-
import { useEffect, useImperativeHandle, useRef } from "react";
|
|
5
|
+
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
7
6
|
import { useDateField, useLocale } from "react-aria";
|
|
8
7
|
import { createCalendar } from "@internationalized/date";
|
|
9
8
|
import { DateTime } from "luxon";
|
|
10
9
|
import { useDateFieldState } from "react-stately";
|
|
11
10
|
//#region src/components/inputs/DateTime/shared/DateField.tsx
|
|
12
|
-
var DateField = (
|
|
13
|
-
const $ = c(65);
|
|
14
|
-
let disableManualEntry;
|
|
15
|
-
let format;
|
|
16
|
-
let hidePlaceholder;
|
|
17
|
-
let isDisabled;
|
|
18
|
-
let onClearChange;
|
|
19
|
-
let props;
|
|
20
|
-
let ref;
|
|
21
|
-
let t1;
|
|
22
|
-
let t2;
|
|
23
|
-
let timeZone;
|
|
24
|
-
if ($[0] !== t0) {
|
|
25
|
-
({ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity: t1, isTimeOptional: t2, format, timeZone, ...props} = t0);
|
|
26
|
-
$[0] = t0;
|
|
27
|
-
$[1] = disableManualEntry;
|
|
28
|
-
$[2] = format;
|
|
29
|
-
$[3] = hidePlaceholder;
|
|
30
|
-
$[4] = isDisabled;
|
|
31
|
-
$[5] = onClearChange;
|
|
32
|
-
$[6] = props;
|
|
33
|
-
$[7] = ref;
|
|
34
|
-
$[8] = t1;
|
|
35
|
-
$[9] = t2;
|
|
36
|
-
$[10] = timeZone;
|
|
37
|
-
} else {
|
|
38
|
-
disableManualEntry = $[1];
|
|
39
|
-
format = $[2];
|
|
40
|
-
hidePlaceholder = $[3];
|
|
41
|
-
isDisabled = $[4];
|
|
42
|
-
onClearChange = $[5];
|
|
43
|
-
props = $[6];
|
|
44
|
-
ref = $[7];
|
|
45
|
-
t1 = $[8];
|
|
46
|
-
t2 = $[9];
|
|
47
|
-
timeZone = $[10];
|
|
48
|
-
}
|
|
49
|
-
const dateGranularity = t1 === void 0 ? "day" : t1;
|
|
50
|
-
const isTimeOptional = t2 === void 0 ? false : t2;
|
|
11
|
+
var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, ...props }) => {
|
|
51
12
|
const { locale } = useLocale();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
createCalendar
|
|
60
|
-
};
|
|
61
|
-
$[11] = disableManualEntry;
|
|
62
|
-
$[12] = isDisabled;
|
|
63
|
-
$[13] = locale;
|
|
64
|
-
$[14] = props;
|
|
65
|
-
$[15] = t3;
|
|
66
|
-
} else t3 = $[15];
|
|
67
|
-
const state = useDateFieldState(t3);
|
|
13
|
+
const state = useDateFieldState({
|
|
14
|
+
...props,
|
|
15
|
+
isDisabled,
|
|
16
|
+
isReadOnly: disableManualEntry,
|
|
17
|
+
locale,
|
|
18
|
+
createCalendar
|
|
19
|
+
});
|
|
68
20
|
const dataFieldRef = useRef(null);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} else t6 = $[24];
|
|
107
|
-
const getSegmentsToRender = t6;
|
|
108
|
-
let t7;
|
|
109
|
-
if ($[25] !== getSegmentsToRender) {
|
|
110
|
-
t7 = getSegmentsToRender();
|
|
111
|
-
$[25] = getSegmentsToRender;
|
|
112
|
-
$[26] = t7;
|
|
113
|
-
} else t7 = $[26];
|
|
114
|
-
const segmentsToRender = t7;
|
|
115
|
-
let t8;
|
|
116
|
-
if ($[27] !== isTimeOptional || $[28] !== state) {
|
|
117
|
-
t8 = () => {
|
|
118
|
-
const monthSegment = state.segments.find(_temp);
|
|
119
|
-
const daySegment = state.segments.find(_temp2);
|
|
120
|
-
const yearSegment = state.segments.find(_temp3);
|
|
121
|
-
const hourSegment = state.segments.find(_temp4);
|
|
122
|
-
const minuteSegment = state.segments.find(_temp5);
|
|
123
|
-
const isMonthFilled = monthSegment && !monthSegment.isPlaceholder;
|
|
124
|
-
const isDayFilled = daySegment && !daySegment.isPlaceholder;
|
|
125
|
-
const isYearFilled = yearSegment && !yearSegment.isPlaceholder && yearSegment.text?.length > 0;
|
|
126
|
-
const isYearEmpty = yearSegment && !(parseInt(yearSegment.text) && yearSegment.text?.length === 4);
|
|
127
|
-
const isDateFilled = isMonthFilled && isDayFilled && isYearFilled;
|
|
128
|
-
const isHourEmpty = hourSegment && (hourSegment.isPlaceholder || Number.isNaN(parseInt(hourSegment.text ?? "", 10)));
|
|
129
|
-
const isMinuteEmpty = minuteSegment && (minuteSegment.isPlaceholder || Number.isNaN(parseInt(minuteSegment.text ?? "", 10)));
|
|
130
|
-
if (!isTimeOptional && isDateFilled && minuteSegment && isMinuteEmpty) {
|
|
131
|
-
let minute = minuteSegment?.value || 0;
|
|
132
|
-
if (minuteSegment?.text?.length && minuteSegment?.text?.length > 0) {
|
|
133
|
-
minute = parseInt(minuteSegment?.text ?? "00");
|
|
134
|
-
if (isNaN(minute)) minute = 0;
|
|
135
|
-
}
|
|
136
|
-
state.setSegment("minute", minute);
|
|
21
|
+
const { fieldProps } = useDateField({
|
|
22
|
+
...props,
|
|
23
|
+
isDisabled,
|
|
24
|
+
isReadOnly: disableManualEntry
|
|
25
|
+
}, state, dataFieldRef);
|
|
26
|
+
const isSegmentVisible = useCallback((segmentType) => {
|
|
27
|
+
if (dateGranularity === "day") return true;
|
|
28
|
+
if (dateGranularity === "month") return segmentType !== "day";
|
|
29
|
+
if (dateGranularity === "year") return segmentType === "year";
|
|
30
|
+
return true;
|
|
31
|
+
}, [dateGranularity]);
|
|
32
|
+
const getSegmentsToRender = useCallback(() => {
|
|
33
|
+
const segments = [];
|
|
34
|
+
for (const segment of state.segments) if (segment.type !== "literal") {
|
|
35
|
+
if (isSegmentVisible(segment.type)) segments.push(segment);
|
|
36
|
+
} else if (segments.length > 0 && segments.at(-1)?.type !== "literal") segments.push(segment);
|
|
37
|
+
return segments;
|
|
38
|
+
}, [state.segments, isSegmentVisible]);
|
|
39
|
+
const segmentsToRender = useMemo(() => getSegmentsToRender(), [getSegmentsToRender]);
|
|
40
|
+
const autoFixYear = () => {
|
|
41
|
+
const monthSegment = state.segments.find((segment) => segment.type === "month");
|
|
42
|
+
const daySegment = state.segments.find((segment) => segment.type === "day");
|
|
43
|
+
const yearSegment = state.segments.find((segment) => segment.type === "year");
|
|
44
|
+
const hourSegment = state.segments.find((segment) => segment.type === "hour");
|
|
45
|
+
const minuteSegment = state.segments.find((segment) => segment.type === "minute");
|
|
46
|
+
const isMonthFilled = monthSegment && !monthSegment.isPlaceholder;
|
|
47
|
+
const isDayFilled = daySegment && !daySegment.isPlaceholder;
|
|
48
|
+
const isYearFilled = yearSegment && !yearSegment.isPlaceholder && yearSegment.text?.length > 0;
|
|
49
|
+
const isYearEmpty = yearSegment && !(parseInt(yearSegment.text) && yearSegment.text?.length === 4);
|
|
50
|
+
const isDateFilled = isMonthFilled && isDayFilled && isYearFilled;
|
|
51
|
+
const isHourEmpty = hourSegment && (hourSegment.isPlaceholder || Number.isNaN(parseInt(hourSegment.text ?? "", 10)));
|
|
52
|
+
const isMinuteEmpty = minuteSegment && (minuteSegment.isPlaceholder || Number.isNaN(parseInt(minuteSegment.text ?? "", 10)));
|
|
53
|
+
if (!isTimeOptional && isDateFilled && minuteSegment && isMinuteEmpty) {
|
|
54
|
+
let minute = minuteSegment?.value || 0;
|
|
55
|
+
if (minuteSegment?.text?.length && minuteSegment?.text?.length > 0) {
|
|
56
|
+
minute = parseInt(minuteSegment?.text ?? "00");
|
|
57
|
+
if (isNaN(minute)) minute = 0;
|
|
137
58
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
59
|
+
state.setSegment("minute", minute);
|
|
60
|
+
}
|
|
61
|
+
if (!isTimeOptional && isDateFilled && hourSegment && isHourEmpty) {
|
|
62
|
+
let hour = hourSegment?.value || 0;
|
|
63
|
+
if (hourSegment?.text?.length && hourSegment?.text?.length > 0) {
|
|
64
|
+
hour = parseInt(hourSegment?.text ?? "00");
|
|
65
|
+
if (isNaN(hour)) hour = 0;
|
|
145
66
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
67
|
+
state.setSegment("hour", hour);
|
|
68
|
+
}
|
|
69
|
+
if (isMonthFilled && isDayFilled && isYearEmpty) {
|
|
70
|
+
let year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
71
|
+
if (yearSegment?.text?.length && yearSegment?.text?.length === 2) year = parseInt(`20${yearSegment?.text}`);
|
|
72
|
+
state.setSegment("year", year);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const handleBlur = (e) => {
|
|
76
|
+
fieldProps.onBlur?.(e);
|
|
77
|
+
if (!state.value) return;
|
|
78
|
+
const currentValue = state.value;
|
|
79
|
+
const { year } = currentValue;
|
|
80
|
+
if (year >= 0 && year <= 99) {
|
|
81
|
+
const correctedYear = year <= 50 ? 2e3 + year : 1900 + year;
|
|
82
|
+
const correctedDate = currentValue.set({ year: correctedYear });
|
|
83
|
+
if (correctedDate) {
|
|
84
|
+
state.setValue(correctedDate);
|
|
85
|
+
props.onChange?.(correctedDate);
|
|
150
86
|
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
$[35] = state;
|
|
190
|
-
$[36] = t10;
|
|
191
|
-
} else t10 = $[36];
|
|
192
|
-
useImperativeHandle(ref, t10);
|
|
193
|
-
let t11;
|
|
194
|
-
let t12;
|
|
195
|
-
if ($[37] !== onClearChange || $[38] !== state.segments) {
|
|
196
|
-
t11 = () => {
|
|
197
|
-
onClearChange?.(state.segments.some(_temp6));
|
|
198
|
-
};
|
|
199
|
-
t12 = [state.segments, onClearChange];
|
|
200
|
-
$[37] = onClearChange;
|
|
201
|
-
$[38] = state.segments;
|
|
202
|
-
$[39] = t11;
|
|
203
|
-
$[40] = t12;
|
|
204
|
-
} else {
|
|
205
|
-
t11 = $[39];
|
|
206
|
-
t12 = $[40];
|
|
207
|
-
}
|
|
208
|
-
useEffect(t11, t12);
|
|
209
|
-
let t13;
|
|
210
|
-
if ($[41] !== disableManualEntry || $[42] !== format || $[43] !== state.value || $[44] !== timeZone) {
|
|
211
|
-
const getFormattedDisplayValue = () => {
|
|
212
|
-
if (!disableManualEntry) return null;
|
|
213
|
-
if (!format) return null;
|
|
214
|
-
if (!state.value) return null;
|
|
215
|
-
const jsDate = DateTimeUtils.fromDateValueToLocal(state.value, timeZone);
|
|
216
|
-
const formattedDate = DateTime.fromJSDate(jsDate);
|
|
217
|
-
if (!formattedDate.isValid) return null;
|
|
218
|
-
return formattedDate.toFormat(format);
|
|
219
|
-
};
|
|
220
|
-
t13 = getFormattedDisplayValue();
|
|
221
|
-
$[41] = disableManualEntry;
|
|
222
|
-
$[42] = format;
|
|
223
|
-
$[43] = state.value;
|
|
224
|
-
$[44] = timeZone;
|
|
225
|
-
$[45] = t13;
|
|
226
|
-
} else t13 = $[45];
|
|
227
|
-
const formattedDisplayValue = t13;
|
|
228
|
-
let t14;
|
|
229
|
-
if ($[46] !== hidePlaceholder || $[47] !== isDisabled || $[48] !== segmentsToRender || $[49] !== state) {
|
|
230
|
-
t14 = /* @__PURE__ */ jsx(Fragment, { children: segmentsToRender.map((segment_7, i) => /* @__PURE__ */ jsx(DateSegmentItem, {
|
|
231
|
-
segment: segment_7,
|
|
232
|
-
state,
|
|
233
|
-
isDisabled,
|
|
234
|
-
hidePlaceholder
|
|
235
|
-
}, i)) });
|
|
236
|
-
$[46] = hidePlaceholder;
|
|
237
|
-
$[47] = isDisabled;
|
|
238
|
-
$[48] = segmentsToRender;
|
|
239
|
-
$[49] = state;
|
|
240
|
-
$[50] = t14;
|
|
241
|
-
} else t14 = $[50];
|
|
242
|
-
let fieldContent = t14;
|
|
243
|
-
if (formattedDisplayValue) {
|
|
244
|
-
const t15 = isDisabled && "text-interactive-text-secondary-disabled";
|
|
245
|
-
let t16;
|
|
246
|
-
if ($[51] !== t15) {
|
|
247
|
-
t16 = clsx("select-none", t15);
|
|
248
|
-
$[51] = t15;
|
|
249
|
-
$[52] = t16;
|
|
250
|
-
} else t16 = $[52];
|
|
251
|
-
let t17;
|
|
252
|
-
if ($[53] !== formattedDisplayValue || $[54] !== t16) {
|
|
253
|
-
t17 = /* @__PURE__ */ jsx("span", {
|
|
254
|
-
className: t16,
|
|
255
|
-
children: formattedDisplayValue
|
|
256
|
-
});
|
|
257
|
-
$[53] = formattedDisplayValue;
|
|
258
|
-
$[54] = t16;
|
|
259
|
-
$[55] = t17;
|
|
260
|
-
} else t17 = $[55];
|
|
261
|
-
fieldContent = t17;
|
|
262
|
-
}
|
|
263
|
-
const t15 = disableManualEntry && "pointer-events-none";
|
|
264
|
-
let t16;
|
|
265
|
-
if ($[56] !== t15) {
|
|
266
|
-
t16 = clsx("relative w-full", t15);
|
|
267
|
-
$[56] = t15;
|
|
268
|
-
$[57] = t16;
|
|
269
|
-
} else t16 = $[57];
|
|
270
|
-
let t17;
|
|
271
|
-
if ($[58] !== fieldContent) {
|
|
272
|
-
t17 = /* @__PURE__ */ jsx("div", {
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
useImperativeHandle(ref, () => ({
|
|
90
|
+
clearField: () => {
|
|
91
|
+
state.setValue(null);
|
|
92
|
+
for (const segment of state.segments) if (segment.type !== "literal") state.clearSegment(segment.type);
|
|
93
|
+
},
|
|
94
|
+
autoFixYear
|
|
95
|
+
}));
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
onClearChange?.(state.segments.some((segment) => segment.type !== "literal" && segment.isPlaceholder === false));
|
|
98
|
+
}, [state.segments, onClearChange]);
|
|
99
|
+
const getFormattedDisplayValue = () => {
|
|
100
|
+
if (!disableManualEntry) return null;
|
|
101
|
+
if (!format) return null;
|
|
102
|
+
if (!state.value) return null;
|
|
103
|
+
const jsDate = DateTimeUtils.fromDateValueToLocal(state.value, timeZone);
|
|
104
|
+
const formattedDate = DateTime.fromJSDate(jsDate);
|
|
105
|
+
if (!formattedDate.isValid) return null;
|
|
106
|
+
return formattedDate.toFormat(format);
|
|
107
|
+
};
|
|
108
|
+
const formattedDisplayValue = getFormattedDisplayValue();
|
|
109
|
+
let fieldContent = /* @__PURE__ */ jsx(Fragment, { children: segmentsToRender.map((segment, i) => /* @__PURE__ */ jsx(DateSegmentItem, {
|
|
110
|
+
segment,
|
|
111
|
+
state,
|
|
112
|
+
isDisabled,
|
|
113
|
+
hidePlaceholder
|
|
114
|
+
}, i)) });
|
|
115
|
+
if (formattedDisplayValue) fieldContent = /* @__PURE__ */ jsx("span", {
|
|
116
|
+
className: clsx("select-none", isDisabled && "text-interactive-text-secondary-disabled"),
|
|
117
|
+
children: formattedDisplayValue
|
|
118
|
+
});
|
|
119
|
+
return /* @__PURE__ */ jsx("div", {
|
|
120
|
+
...fieldProps,
|
|
121
|
+
ref: dataFieldRef,
|
|
122
|
+
onBlur: handleBlur,
|
|
123
|
+
className: clsx("relative w-full", disableManualEntry && "pointer-events-none"),
|
|
124
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
273
125
|
className: "flex",
|
|
274
126
|
children: fieldContent
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
$[59] = t17;
|
|
278
|
-
} else t17 = $[59];
|
|
279
|
-
let t18;
|
|
280
|
-
if ($[60] !== fieldProps || $[61] !== handleBlur || $[62] !== t16 || $[63] !== t17) {
|
|
281
|
-
t18 = /* @__PURE__ */ jsx("div", {
|
|
282
|
-
...fieldProps,
|
|
283
|
-
ref: dataFieldRef,
|
|
284
|
-
onBlur: handleBlur,
|
|
285
|
-
className: t16,
|
|
286
|
-
children: t17
|
|
287
|
-
});
|
|
288
|
-
$[60] = fieldProps;
|
|
289
|
-
$[61] = handleBlur;
|
|
290
|
-
$[62] = t16;
|
|
291
|
-
$[63] = t17;
|
|
292
|
-
$[64] = t18;
|
|
293
|
-
} else t18 = $[64];
|
|
294
|
-
return t18;
|
|
127
|
+
})
|
|
128
|
+
});
|
|
295
129
|
};
|
|
296
|
-
function _temp(segment_0) {
|
|
297
|
-
return segment_0.type === "month";
|
|
298
|
-
}
|
|
299
|
-
function _temp2(segment_1) {
|
|
300
|
-
return segment_1.type === "day";
|
|
301
|
-
}
|
|
302
|
-
function _temp3(segment_2) {
|
|
303
|
-
return segment_2.type === "year";
|
|
304
|
-
}
|
|
305
|
-
function _temp4(segment_3) {
|
|
306
|
-
return segment_3.type === "hour";
|
|
307
|
-
}
|
|
308
|
-
function _temp5(segment_4) {
|
|
309
|
-
return segment_4.type === "minute";
|
|
310
|
-
}
|
|
311
|
-
function _temp6(segment_6) {
|
|
312
|
-
return segment_6.type !== "literal" && segment_6.isPlaceholder === false;
|
|
313
|
-
}
|
|
314
130
|
//#endregion
|
|
315
131
|
export { DateField };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { DatePickerAria } from 'react-aria';
|
|
3
|
-
import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from './datePicker.types';
|
|
4
3
|
import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
|
|
5
4
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
6
5
|
export interface DatePickerInputHandle {
|
|
@@ -19,20 +18,18 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
19
18
|
isDateTime?: boolean;
|
|
20
19
|
isClearable?: boolean;
|
|
21
20
|
headerProps?: FormFieldHeaderProps;
|
|
22
|
-
todayIcon?:
|
|
23
|
-
todayIconButtonSize?: DatePickerTodayIconButtonSize;
|
|
24
|
-
todayIconPlacement?: DatePickerTodayIconPlacement;
|
|
21
|
+
todayIcon?: boolean;
|
|
25
22
|
isDirty?: boolean;
|
|
26
23
|
isRequired?: boolean;
|
|
27
24
|
disableManualEntry?: boolean;
|
|
28
|
-
autoFixYear?: boolean;
|
|
29
25
|
placeholder?: string;
|
|
30
26
|
className?: string;
|
|
31
27
|
onOpenDropdown?: () => void;
|
|
32
28
|
dateGranularity?: "day" | "month" | "year";
|
|
33
29
|
timeZone?: string;
|
|
30
|
+
autoFixYear?: boolean;
|
|
34
31
|
isTimeOptional?: boolean;
|
|
35
32
|
format?: string;
|
|
36
33
|
}
|
|
37
|
-
export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon,
|
|
34
|
+
export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, isDirty, isRequired, disableManualEntry, placeholder, className, onOpenDropdown, dateGranularity, timeZone, autoFixYear, isTimeOptional, format, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
35
|
export {};
|