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