@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,29 +1,25 @@
|
|
|
1
1
|
import { CalendarDate, DateValue } from '@internationalized/date';
|
|
2
|
-
import {
|
|
2
|
+
import { Ref } from 'react';
|
|
3
3
|
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { DatePickerStateOptions } from 'react-stately';
|
|
5
5
|
import { DatePickerInputHandle } from '../shared/DatePickerInput';
|
|
6
|
-
import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
|
|
7
6
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
8
7
|
import { ControlProps } from '../../shared/form.types';
|
|
9
8
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
10
9
|
type DatePickerGranularity = "day" | "month" | "year";
|
|
11
|
-
interface DatePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label"
|
|
10
|
+
interface DatePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label"> {
|
|
12
11
|
ref?: Ref<DatePickerInputHandle & HTMLDivElement>;
|
|
13
12
|
disableDropdown?: boolean;
|
|
14
13
|
isClearable?: boolean;
|
|
15
14
|
className?: string;
|
|
16
|
-
todayIcon?:
|
|
17
|
-
todayIconButtonSize?: DatePickerTodayIconButtonSize;
|
|
18
|
-
todayIconPlacement?: DatePickerTodayIconPlacement;
|
|
15
|
+
todayIcon?: boolean;
|
|
19
16
|
isDirty?: boolean;
|
|
20
17
|
disableManualEntry?: boolean;
|
|
21
|
-
autoFixYear?: boolean;
|
|
22
18
|
placeholder?: string;
|
|
23
19
|
inputClassName?: string;
|
|
24
|
-
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
25
20
|
shouldUpdateDateOnMonthYearChange?: boolean;
|
|
26
21
|
granularity?: DatePickerGranularity;
|
|
22
|
+
autoFixYear?: boolean;
|
|
27
23
|
format?: string;
|
|
28
24
|
}
|
|
29
25
|
export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
|
|
@@ -32,8 +28,7 @@ export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "on
|
|
|
32
28
|
fullIso?: boolean;
|
|
33
29
|
minValue?: DateValue | string;
|
|
34
30
|
maxValue?: DateValue | string;
|
|
35
|
-
renderStaticInput?: boolean;
|
|
36
31
|
}
|
|
37
32
|
export type ControlledDatePickerProps<TFieldValues extends FieldValues> = ControlProps<DatePickerProps, TFieldValues>;
|
|
38
|
-
export declare const DatePicker: <TFieldValues extends FieldValues>({ fullIso, granularity, minValue, maxValue,
|
|
33
|
+
export declare const DatePicker: <TFieldValues extends FieldValues>({ fullIso, granularity, minValue, maxValue, ...props }: ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
39
34
|
export {};
|
|
@@ -1,44 +1,24 @@
|
|
|
1
|
-
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
1
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
2
|
import { Calendar } from "../shared/Calendar.js";
|
|
4
3
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
5
|
-
import { datePickerInputContentRow } from "../shared/datePickerInput.cva.js";
|
|
6
|
-
import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
|
|
7
4
|
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
8
5
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
9
6
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
10
|
-
import { getStaticCalendarDateSegments } from "../shared/staticDateTimeSegments.js";
|
|
11
7
|
import { FormField } from "../../FormField/FormField.js";
|
|
12
8
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
13
|
-
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
14
|
-
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
15
|
-
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
16
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
10
|
import { clsx } from "clsx";
|
|
18
|
-
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef
|
|
11
|
+
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
19
12
|
import { useDatePicker, useLocale } from "react-aria";
|
|
20
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
21
|
-
import { Controller
|
|
14
|
+
import { Controller } from "react-hook-form";
|
|
22
15
|
import { createCalendar, getLocalTimeZone, toCalendarDate, today } from "@internationalized/date";
|
|
23
16
|
import { DateTime } from "luxon";
|
|
24
17
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
25
18
|
//#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
|
|
26
19
|
var DatePickerBase = (props) => {
|
|
27
20
|
const ui = UIConfig.useConfig();
|
|
28
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange,
|
|
29
|
-
const as = asProp ?? ui.input.as;
|
|
30
|
-
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
31
|
-
const variant = variantProp ?? ui.input.variant;
|
|
32
|
-
const size = sizeProp ?? ui.input.size;
|
|
33
|
-
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
34
|
-
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
35
|
-
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
36
|
-
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
37
|
-
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
38
|
-
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
39
|
-
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
40
|
-
const granularity = granularityProp ?? ui.dateInput.granularity;
|
|
41
|
-
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
21
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, className, placeholder, inputClassName, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, shouldUpdateDateOnMonthYearChange = ui.dateInput.shouldUpdateDateOnMonthYearChange, granularity = ui.dateInput.granularity, autoFixYear = ui.dateInput.autoFixYear, format, ...rest } = props;
|
|
42
22
|
const normalizeByGranularity = useCallback((date) => {
|
|
43
23
|
if (granularity === "year") return date.set({
|
|
44
24
|
month: 1,
|
|
@@ -64,16 +44,9 @@ var DatePickerBase = (props) => {
|
|
|
64
44
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
65
45
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
66
46
|
} }), []);
|
|
67
|
-
useImperativeHandle(ref, () => ({
|
|
68
|
-
clear
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
72
|
-
}));
|
|
73
|
-
const handleBlur = (val) => {
|
|
74
|
-
onBlur?.({ target: { value: val } });
|
|
75
|
-
};
|
|
76
|
-
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
47
|
+
useImperativeHandle(ref, () => ({ clear: () => {
|
|
48
|
+
datePickerInputRef.current?.clear();
|
|
49
|
+
} }));
|
|
77
50
|
const dialogState = useDatePickerState({
|
|
78
51
|
...rest,
|
|
79
52
|
defaultValue: value || rest.defaultValue,
|
|
@@ -84,16 +57,15 @@ var DatePickerBase = (props) => {
|
|
|
84
57
|
...rest,
|
|
85
58
|
shouldForceLeadingZeros,
|
|
86
59
|
value,
|
|
87
|
-
onChange: (
|
|
88
|
-
let normalizedValue =
|
|
89
|
-
if (
|
|
60
|
+
onChange: (val) => {
|
|
61
|
+
let normalizedValue = val;
|
|
62
|
+
if (val) normalizedValue = normalizeByGranularity(val);
|
|
90
63
|
if (normalizedValue && (rest.minValue && normalizedValue < rest?.minValue || rest?.maxValue && normalizedValue > rest?.maxValue)) {
|
|
91
64
|
state.setValue(state.value);
|
|
92
65
|
return;
|
|
93
66
|
}
|
|
94
67
|
onChange?.(normalizedValue);
|
|
95
68
|
dialogState.setValue(normalizedValue);
|
|
96
|
-
debouncedBlur(normalizedValue);
|
|
97
69
|
if (normalizedValue) {
|
|
98
70
|
calendarState.setFocusedDate(normalizedValue);
|
|
99
71
|
return;
|
|
@@ -130,10 +102,9 @@ var DatePickerBase = (props) => {
|
|
|
130
102
|
labelProps
|
|
131
103
|
};
|
|
132
104
|
const onApply = () => {
|
|
133
|
-
|
|
134
|
-
state.setValue(
|
|
105
|
+
if (dialogState.value) state.setValue(normalizeByGranularity(dialogState.value));
|
|
106
|
+
if (!dialogState.value) state.setValue(dialogState.value);
|
|
135
107
|
state.toggle();
|
|
136
|
-
handleBlur(newValue);
|
|
137
108
|
};
|
|
138
109
|
const onMonthYearChange = (selectedDate) => {
|
|
139
110
|
if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
|
|
@@ -192,7 +163,6 @@ var DatePickerBase = (props) => {
|
|
|
192
163
|
isDirty,
|
|
193
164
|
isDisabled,
|
|
194
165
|
disableManualEntry,
|
|
195
|
-
autoFixYear,
|
|
196
166
|
isInvalid: !!error,
|
|
197
167
|
disableDropdown,
|
|
198
168
|
variant,
|
|
@@ -200,14 +170,13 @@ var DatePickerBase = (props) => {
|
|
|
200
170
|
isClearable,
|
|
201
171
|
headerProps,
|
|
202
172
|
todayIcon,
|
|
203
|
-
todayIconButtonSize,
|
|
204
|
-
todayIconPlacement,
|
|
205
173
|
onOpenDropdown: () => state.toggle(),
|
|
206
174
|
placeholder,
|
|
207
175
|
className: inputClassName,
|
|
208
176
|
dateGranularity: granularity,
|
|
177
|
+
autoFixYear,
|
|
209
178
|
format
|
|
210
|
-
}), (!disableDropdown || disableManualEntry) &&
|
|
179
|
+
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
211
180
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
212
181
|
isDisabled,
|
|
213
182
|
isValid: !dialogState.isInvalid && !!dialogState.value,
|
|
@@ -232,29 +201,7 @@ var DatePickerBase = (props) => {
|
|
|
232
201
|
})
|
|
233
202
|
});
|
|
234
203
|
};
|
|
235
|
-
var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue,
|
|
236
|
-
const ui = UIConfig.useConfig();
|
|
237
|
-
const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
|
|
238
|
-
const { locale } = useLocale();
|
|
239
|
-
const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
|
|
240
|
-
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
241
|
-
const inputRef = useRef(null);
|
|
242
|
-
const { renderRealInput } = useStaticInputHandoff({
|
|
243
|
-
inputRef,
|
|
244
|
-
renderInput,
|
|
245
|
-
setRenderInput,
|
|
246
|
-
getFocusTarget: (input) => {
|
|
247
|
-
const container = input.getContainer?.() ?? input;
|
|
248
|
-
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
252
|
-
control: props.formControl.control,
|
|
253
|
-
name: props.formControl.name
|
|
254
|
-
}) : props.value;
|
|
255
|
-
let isFormControlDisabled = false;
|
|
256
|
-
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
257
|
-
const rawValue = watchedValue ?? props.value ?? null;
|
|
204
|
+
var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ...props }) => {
|
|
258
205
|
const normalizeByGranularity = (date) => {
|
|
259
206
|
if (granularity === "year") return date.set({
|
|
260
207
|
month: 1,
|
|
@@ -267,66 +214,19 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
267
214
|
if (calendarDate === null) return null;
|
|
268
215
|
const normalizedDate = normalizeByGranularity(calendarDate);
|
|
269
216
|
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
|
|
270
|
-
const
|
|
271
|
-
return DateTime.fromJSDate(
|
|
217
|
+
const date = DateTimeUtils.fromDateValueToLocal(normalizedDate);
|
|
218
|
+
return DateTime.fromJSDate(date).toISODate();
|
|
272
219
|
};
|
|
273
220
|
const parseCalendarDate = (formattedDate) => {
|
|
274
221
|
if (formattedDate == null) return formattedDate;
|
|
275
222
|
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
276
|
-
const
|
|
277
|
-
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(
|
|
223
|
+
const date = DateTime.fromISO(formattedDate).toJSDate();
|
|
224
|
+
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date)));
|
|
278
225
|
};
|
|
279
226
|
const dateLimits = {
|
|
280
227
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
281
228
|
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
282
229
|
};
|
|
283
|
-
if (!renderInput) {
|
|
284
|
-
const dateValue = rawValue ? parseCalendarDate(rawValue) : null;
|
|
285
|
-
const as = props.as ?? ui.input.as;
|
|
286
|
-
const size = props.size ?? ui.input.size;
|
|
287
|
-
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
288
|
-
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
289
|
-
const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
|
|
290
|
-
const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
|
|
291
|
-
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, todayIconButtonSize);
|
|
292
|
-
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
293
|
-
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
294
|
-
const staticSegments = getStaticCalendarDateSegments({
|
|
295
|
-
value: dateValue,
|
|
296
|
-
locale,
|
|
297
|
-
shouldForceLeadingZeros,
|
|
298
|
-
isDisabled,
|
|
299
|
-
hidePlaceholder: as === "floating" && !dateValue
|
|
300
|
-
});
|
|
301
|
-
return /* @__PURE__ */ jsx(InputFrame, {
|
|
302
|
-
...props,
|
|
303
|
-
isDisabled,
|
|
304
|
-
className: clsx("relative inline-flex w-full flex-col text-left", props.className),
|
|
305
|
-
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
306
|
-
contentClassName: "pr-0!",
|
|
307
|
-
contentWrapperClassName: datePickerInputContentRowCva({ size }),
|
|
308
|
-
labelPlacement: "content-row",
|
|
309
|
-
dataAttributes: {
|
|
310
|
-
dataIsEmpty: dateValue === null,
|
|
311
|
-
dataIsFilled: dateValue !== null,
|
|
312
|
-
dataIsDirty: props.isDirty,
|
|
313
|
-
dataIsRequired: props.isRequired,
|
|
314
|
-
dataIsDisabled: isDisabled,
|
|
315
|
-
dataDisabled: isDisabled,
|
|
316
|
-
dataInvalid: !!props.error,
|
|
317
|
-
dataHasSelection: dateValue !== null
|
|
318
|
-
},
|
|
319
|
-
renderStatic: true,
|
|
320
|
-
onStaticInteract: renderRealInput,
|
|
321
|
-
actionContent: staticTodayIcon,
|
|
322
|
-
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
323
|
-
wrapContentAndTrailing: true,
|
|
324
|
-
contentAndTrailingClassName: "gap-2!",
|
|
325
|
-
trailingClassName: "py-0! pl-0!",
|
|
326
|
-
trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
|
|
327
|
-
children: staticSegments
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
230
|
if ("formControl" in props && props.formControl) {
|
|
331
231
|
const { formControl, ref, ...innerProps } = props;
|
|
332
232
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -335,7 +235,7 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
335
235
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DatePickerBase, {
|
|
336
236
|
...innerProps,
|
|
337
237
|
...dateLimits,
|
|
338
|
-
ref: mergeRefs(ref, field.ref
|
|
238
|
+
ref: mergeRefs(ref, field.ref),
|
|
339
239
|
value: parseCalendarDate(field.value),
|
|
340
240
|
onChange: (value) => field.onChange(formatCalendarDate(value)),
|
|
341
241
|
onBlur: field.onBlur,
|
|
@@ -348,10 +248,9 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
348
248
|
return /* @__PURE__ */ jsx(DatePickerBase, {
|
|
349
249
|
...props,
|
|
350
250
|
...dateLimits,
|
|
351
|
-
ref: mergeRefs(props.ref, inputRef),
|
|
352
251
|
granularity,
|
|
353
252
|
value: parseCalendarDate(props.value),
|
|
354
|
-
onChange: (
|
|
253
|
+
onChange: (value) => props.onChange?.(formatCalendarDate(value))
|
|
355
254
|
});
|
|
356
255
|
};
|
|
357
256
|
//#endregion
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { CalendarDate } from '@internationalized/date';
|
|
2
|
-
import {
|
|
2
|
+
import { Ref } from 'react';
|
|
3
3
|
import { DateValue } from 'react-aria';
|
|
4
4
|
import { FieldValues } from 'react-hook-form';
|
|
5
5
|
import { DateRangePickerStateOptions } from 'react-stately';
|
|
6
6
|
import { DatePickerInputHandle } from '../shared/DatePickerInput';
|
|
7
|
-
import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
|
|
8
7
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
9
8
|
import { ControlProps } from '../../shared/form.types';
|
|
10
9
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
11
|
-
interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DateRangePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label"
|
|
10
|
+
interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DateRangePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label"> {
|
|
12
11
|
ref?: Ref<DatePickerInputHandle & HTMLDivElement>;
|
|
13
12
|
disableDropdown?: boolean;
|
|
14
13
|
isClearable?: boolean;
|
|
15
14
|
hideSidebar?: boolean;
|
|
16
15
|
className?: string;
|
|
17
|
-
todayIcon?:
|
|
18
|
-
todayIconButtonSize?: DatePickerTodayIconButtonSize;
|
|
19
|
-
todayIconPlacement?: DatePickerTodayIconPlacement;
|
|
16
|
+
todayIcon?: boolean;
|
|
20
17
|
isDirty?: boolean;
|
|
21
18
|
disableManualEntry?: boolean;
|
|
22
|
-
autoFixYear?: boolean;
|
|
23
19
|
placeholder?: string;
|
|
24
20
|
inputClassName?: string;
|
|
25
|
-
|
|
21
|
+
autoFixYear?: boolean;
|
|
26
22
|
}
|
|
27
23
|
export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
|
|
28
24
|
value?: {
|
|
@@ -36,8 +32,7 @@ export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "va
|
|
|
36
32
|
fullIso?: boolean;
|
|
37
33
|
minValue?: DateValue | string;
|
|
38
34
|
maxValue?: DateValue | string;
|
|
39
|
-
renderStaticInput?: boolean;
|
|
40
35
|
}
|
|
41
36
|
export type ControlledDateRangePickerProps<TFieldValues extends FieldValues> = ControlProps<DateRangePickerProps, TFieldValues>;
|
|
42
|
-
export declare const DateRangePicker: <TFieldValues extends FieldValues>({ fullIso, minValue, maxValue,
|
|
37
|
+
export declare const DateRangePicker: <TFieldValues extends FieldValues>({ fullIso, minValue, maxValue, ...props }: ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
43
38
|
export {};
|