@povio/ui 2.2.12 → 2.3.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/AlignCenter.js +26 -11
- package/dist/assets/icons/AlignLeft.js +26 -11
- package/dist/assets/icons/AlignLeftRight.js +26 -11
- package/dist/assets/icons/AlignRight.js +26 -11
- package/dist/assets/icons/ArrowDropDown.js +26 -11
- package/dist/assets/icons/ArrowDropUp.js +26 -11
- package/dist/assets/icons/ArrowLeft.js +26 -11
- package/dist/assets/icons/ArrowRight.js +26 -11
- package/dist/assets/icons/Bold.js +26 -11
- package/dist/assets/icons/BulletedList.js +26 -11
- package/dist/assets/icons/Calendar.js +28 -13
- package/dist/assets/icons/Check.js +28 -13
- package/dist/assets/icons/CheckCircle.js +26 -11
- package/dist/assets/icons/CheckboxCheckmark.js +29 -14
- package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
- package/dist/assets/icons/ChevronDown.js +28 -13
- package/dist/assets/icons/ChevronLeft.js +28 -13
- package/dist/assets/icons/ChevronRight.js +28 -13
- package/dist/assets/icons/ChevronUp.js +28 -13
- package/dist/assets/icons/ChevronsLeft.js +28 -13
- package/dist/assets/icons/ChevronsRight.js +28 -13
- package/dist/assets/icons/Clock.js +26 -11
- package/dist/assets/icons/Close.js +26 -11
- package/dist/assets/icons/DateTime.js +35 -14
- package/dist/assets/icons/DragIndicator.js +26 -11
- package/dist/assets/icons/File.js +28 -13
- package/dist/assets/icons/Highlight.js +26 -11
- package/dist/assets/icons/HighlightOn.js +49 -15
- package/dist/assets/icons/Home.js +26 -11
- package/dist/assets/icons/Info.js +37 -16
- package/dist/assets/icons/Italic.js +26 -11
- package/dist/assets/icons/Link.js +26 -11
- package/dist/assets/icons/Menu.js +26 -11
- package/dist/assets/icons/NumberedList.js +26 -11
- package/dist/assets/icons/PointerHorizontal.js +26 -11
- package/dist/assets/icons/PointerVertical.js +26 -11
- package/dist/assets/icons/Search.js +26 -11
- package/dist/assets/icons/Send.js +28 -13
- package/dist/assets/icons/Strikethrough.js +26 -11
- package/dist/assets/icons/TextColor.js +48 -14
- package/dist/assets/icons/Today.js +26 -11
- package/dist/assets/icons/Underlined.js +28 -13
- package/dist/assets/icons/Upload.js +35 -14
- package/dist/assets/icons/Visibility.js +26 -11
- package/dist/assets/icons/VisibilityOff.js +26 -11
- package/dist/assets/icons/WarningFilled.js +28 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +32 -9
- package/dist/components/Menu/MenuMobile.js +97 -38
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.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/SplitButton/SplitButton.js +103 -18
- package/dist/components/buttons/TextButton/TextButton.js +30 -8
- package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
- package/dist/components/buttons/shared/ButtonContent.js +80 -22
- package/dist/components/inputs/Checkbox/Checkbox.js +172 -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 +10 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +121 -20
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +10 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +215 -111
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +11 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +123 -19
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +5 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +448 -104
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +330 -119
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +283 -102
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +142 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +249 -93
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.js +296 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +355 -135
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +97 -11
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
- package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +207 -65
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -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 +31 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +87 -44
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
- package/dist/components/inputs/FormField/FormField.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 +6 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +332 -81
- 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 +479 -0
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +4 -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 +321 -80
- package/dist/components/inputs/Input/shared/InputContent.js +192 -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 +2 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +352 -60
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +17 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +42 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +109 -7
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +34 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +36 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +122 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +132 -5
- 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 +337 -115
- 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 +6 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +13 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +57 -34
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -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 +79 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +526 -0
- package/dist/components/inputs/Slider/Slider.js +250 -74
- 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.js +189 -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 +79 -10
- package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
- package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
- package/dist/components/inputs/shared/input.cva.d.ts +10 -0
- package/dist/components/inputs/shared/input.cva.js +32 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +14 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +100 -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 +83 -27
- package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/segment/Segment.js +218 -57
- package/dist/components/segment/SegmentItem.js +67 -10
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +21 -13
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +28 -27
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.d.ts +3 -4
- package/dist/config/router.context.js +42 -18
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.d.ts +15 -3
- package/dist/config/uiConfig.context.js +55 -11
- package/dist/config/uiStyle.context.d.ts +27 -4
- package/dist/config/uiStyle.context.js +15 -5
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +3 -0
- package/dist/hooks/useBreakpoint.js +16 -3
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useFilters.js +145 -80
- package/dist/hooks/useForm.js +42 -8
- package/dist/hooks/useFormAutosave.js +101 -30
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +91 -24
- package/dist/hooks/useLocalStorage.js +43 -10
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.js +51 -17
- package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
- package/dist/hooks/useQueryAutocomplete.js +57 -0
- package/dist/hooks/useScrollableListBox.js +37 -16
- package/dist/hooks/useSorting.js +71 -27
- 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 +7 -0
- package/dist/index.js +5 -3
- package/dist/tw-ui-plugin.js +2 -0
- package/dist/utils/date-time.utils.d.ts +31 -10
- package/dist/utils/date-time.utils.js +117 -22
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/dist/utils/routing.utils.d.ts +1 -0
- package/dist/utils/routing.utils.js +14 -0
- package/package.json +2 -2
|
@@ -1,22 +1,43 @@
|
|
|
1
|
+
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
1
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
3
|
import { Calendar } from "../shared/Calendar.js";
|
|
3
4
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
5
|
+
import { datePickerInputContentRow } from "../shared/datePickerInput.cva.js";
|
|
6
|
+
import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
|
|
4
7
|
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
5
8
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
6
9
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
10
|
+
import { getStaticCalendarDateTimeSegments } from "../shared/staticDateTimeSegments.js";
|
|
7
11
|
import { FormField } from "../../FormField/FormField.js";
|
|
8
12
|
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";
|
|
9
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import {
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
11
19
|
import { useDatePicker, useLocale } from "react-aria";
|
|
12
20
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
|
-
import { Controller } from "react-hook-form";
|
|
21
|
+
import { Controller, useWatch } from "react-hook-form";
|
|
14
22
|
import { Time, createCalendar, getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
15
23
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
16
24
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
17
25
|
var DateTimePickerBase = (props) => {
|
|
18
26
|
const ui = UIConfig.useConfig();
|
|
19
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel
|
|
27
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone, autoFixYear: autoFixYearProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
28
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
29
|
+
const variant = variantProp ?? ui.input.variant;
|
|
30
|
+
const as = asProp ?? ui.input.as;
|
|
31
|
+
const size = sizeProp ?? ui.input.size;
|
|
32
|
+
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
33
|
+
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
34
|
+
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
35
|
+
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
36
|
+
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
37
|
+
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
38
|
+
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
39
|
+
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
40
|
+
const setDateValueOnDateSelection = setDateValueOnDateSelectionProp ?? ui.dateInput.setDateValueOnDateSelection;
|
|
20
41
|
let effectiveTimeZone = getLocalTimeZone();
|
|
21
42
|
if (timeZone) effectiveTimeZone = timeZone;
|
|
22
43
|
const formFieldProps = {
|
|
@@ -36,9 +57,16 @@ var DateTimePickerBase = (props) => {
|
|
|
36
57
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
37
58
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
38
59
|
} }), []);
|
|
39
|
-
useImperativeHandle(ref, () => ({
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
useImperativeHandle(ref, () => ({
|
|
61
|
+
clear: () => {
|
|
62
|
+
datePickerInputRef.current?.clear();
|
|
63
|
+
},
|
|
64
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
65
|
+
}));
|
|
66
|
+
const handleBlur = (val) => {
|
|
67
|
+
onBlur?.({ target: { value: val } });
|
|
68
|
+
};
|
|
69
|
+
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
42
70
|
const dialogState = useDatePickerState({
|
|
43
71
|
...rest,
|
|
44
72
|
defaultValue: value || rest.defaultValue,
|
|
@@ -54,10 +82,11 @@ var DateTimePickerBase = (props) => {
|
|
|
54
82
|
...rest,
|
|
55
83
|
shouldForceLeadingZeros,
|
|
56
84
|
value,
|
|
57
|
-
onChange: (
|
|
58
|
-
onChange?.(
|
|
59
|
-
dialogState.setValue(
|
|
60
|
-
calendarState.setFocusedDate(
|
|
85
|
+
onChange: (val_0) => {
|
|
86
|
+
onChange?.(val_0);
|
|
87
|
+
dialogState.setValue(val_0);
|
|
88
|
+
calendarState.setFocusedDate(val_0 || today(getLocalTimeZone()));
|
|
89
|
+
debouncedBlur(val_0);
|
|
61
90
|
},
|
|
62
91
|
shouldCloseOnSelect: false,
|
|
63
92
|
granularity: "minute",
|
|
@@ -93,8 +122,10 @@ var DateTimePickerBase = (props) => {
|
|
|
93
122
|
labelProps
|
|
94
123
|
};
|
|
95
124
|
const onApply = () => {
|
|
96
|
-
|
|
125
|
+
const newValue = dialogState.value;
|
|
126
|
+
state.setValue(newValue);
|
|
97
127
|
state.toggle();
|
|
128
|
+
handleBlur(newValue);
|
|
98
129
|
};
|
|
99
130
|
const onMonthYearChange = (selectedDate) => {
|
|
100
131
|
if (!shouldUpdateDateOnMonthYearChange) return;
|
|
@@ -150,9 +181,9 @@ var DateTimePickerBase = (props) => {
|
|
|
150
181
|
groupProps,
|
|
151
182
|
fieldProps: {
|
|
152
183
|
...fieldProps,
|
|
153
|
-
onBlur: (
|
|
154
|
-
fieldProps.onBlur?.(
|
|
155
|
-
onInputBlur(
|
|
184
|
+
onBlur: (e_0) => {
|
|
185
|
+
fieldProps.onBlur?.(e_0);
|
|
186
|
+
onInputBlur(e_0);
|
|
156
187
|
}
|
|
157
188
|
},
|
|
158
189
|
buttonProps,
|
|
@@ -166,13 +197,15 @@ var DateTimePickerBase = (props) => {
|
|
|
166
197
|
isClearable,
|
|
167
198
|
headerProps,
|
|
168
199
|
todayIcon,
|
|
200
|
+
todayIconButtonSize,
|
|
201
|
+
todayIconPlacement,
|
|
169
202
|
isRequired,
|
|
170
203
|
disableManualEntry,
|
|
204
|
+
autoFixYear,
|
|
171
205
|
placeholder,
|
|
172
206
|
onOpenDropdown: () => state.toggle(),
|
|
173
207
|
className: inputClassName,
|
|
174
208
|
timeZone: effectiveTimeZone,
|
|
175
|
-
autoFixYear,
|
|
176
209
|
isTimeOptional,
|
|
177
210
|
format
|
|
178
211
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
@@ -194,13 +227,36 @@ var DateTimePickerBase = (props) => {
|
|
|
194
227
|
datePickerState: dialogState,
|
|
195
228
|
onApply,
|
|
196
229
|
onMonthYearChange,
|
|
197
|
-
granularity: "day"
|
|
230
|
+
granularity: "day",
|
|
231
|
+
setDateValueOnDateSelection
|
|
198
232
|
})
|
|
199
233
|
})]
|
|
200
234
|
})
|
|
201
235
|
});
|
|
202
236
|
};
|
|
203
|
-
var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
237
|
+
var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
238
|
+
const ui = UIConfig.useConfig();
|
|
239
|
+
const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
|
|
240
|
+
const { locale } = useLocale();
|
|
241
|
+
const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
|
|
242
|
+
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
243
|
+
const inputRef = useRef(null);
|
|
244
|
+
const { renderRealInput } = useStaticInputHandoff({
|
|
245
|
+
inputRef,
|
|
246
|
+
renderInput,
|
|
247
|
+
setRenderInput,
|
|
248
|
+
getFocusTarget: (input) => {
|
|
249
|
+
const container = input.getContainer?.() ?? input;
|
|
250
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
254
|
+
control: props.formControl.control,
|
|
255
|
+
name: props.formControl.name
|
|
256
|
+
}) : props.value;
|
|
257
|
+
let isFormControlDisabled = false;
|
|
258
|
+
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
259
|
+
const rawValue = watchedValue ?? props.value ?? null;
|
|
204
260
|
let effectiveTimeZone = getLocalTimeZone();
|
|
205
261
|
if (props.timeZone) effectiveTimeZone = props.timeZone;
|
|
206
262
|
const formatDateValue = (dateValue) => {
|
|
@@ -212,6 +268,53 @@ var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
|
212
268
|
if (isoString == null) return isoString;
|
|
213
269
|
return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, effectiveTimeZone);
|
|
214
270
|
};
|
|
271
|
+
if (!renderInput) {
|
|
272
|
+
const dateTimeValue = rawValue ? parseDateValue(rawValue) : null;
|
|
273
|
+
const as = props.as ?? ui.input.as;
|
|
274
|
+
const size = props.size ?? ui.input.size;
|
|
275
|
+
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
276
|
+
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
277
|
+
const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
|
|
278
|
+
const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
|
|
279
|
+
const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, todayIconButtonSize);
|
|
280
|
+
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
281
|
+
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
282
|
+
const staticSegments = getStaticCalendarDateTimeSegments({
|
|
283
|
+
value: dateTimeValue,
|
|
284
|
+
locale,
|
|
285
|
+
shouldForceLeadingZeros,
|
|
286
|
+
isDisabled,
|
|
287
|
+
hidePlaceholder: as === "floating" && !dateTimeValue
|
|
288
|
+
});
|
|
289
|
+
return /* @__PURE__ */ jsx(InputFrame, {
|
|
290
|
+
...props,
|
|
291
|
+
isDisabled,
|
|
292
|
+
className: clsx("relative inline-flex w-full flex-col text-left", props.className),
|
|
293
|
+
inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
|
|
294
|
+
contentClassName: "pr-0!",
|
|
295
|
+
contentWrapperClassName: datePickerInputContentRowCva({ size }),
|
|
296
|
+
labelPlacement: "content-row",
|
|
297
|
+
dataAttributes: {
|
|
298
|
+
dataIsEmpty: dateTimeValue === null,
|
|
299
|
+
dataIsFilled: dateTimeValue !== null,
|
|
300
|
+
dataIsDirty: props.isDirty,
|
|
301
|
+
dataIsRequired: props.isRequired,
|
|
302
|
+
dataIsDisabled: isDisabled,
|
|
303
|
+
dataDisabled: isDisabled,
|
|
304
|
+
dataInvalid: !!props.error,
|
|
305
|
+
dataHasSelection: dateTimeValue !== null
|
|
306
|
+
},
|
|
307
|
+
renderStatic: true,
|
|
308
|
+
onStaticInteract: renderRealInput,
|
|
309
|
+
actionContent: staticTodayIcon,
|
|
310
|
+
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
311
|
+
wrapContentAndTrailing: true,
|
|
312
|
+
contentAndTrailingClassName: "gap-2!",
|
|
313
|
+
trailingClassName: "py-0! pl-0!",
|
|
314
|
+
trailingContent: showDropdown ? ui.dateInput.dateTimeIcon : void 0,
|
|
315
|
+
children: staticSegments
|
|
316
|
+
});
|
|
317
|
+
}
|
|
215
318
|
if ("formControl" in props && props.formControl) {
|
|
216
319
|
const { formControl, ref, ...innerProps } = props;
|
|
217
320
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -219,7 +322,7 @@ var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
|
219
322
|
name: formControl.name,
|
|
220
323
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
221
324
|
...innerProps,
|
|
222
|
-
ref: mergeRefs(ref, field.ref),
|
|
325
|
+
ref: mergeRefs(ref, field.ref, inputRef),
|
|
223
326
|
value: parseDateValue(field.value),
|
|
224
327
|
onChange: (value) => field.onChange(formatDateValue(value)),
|
|
225
328
|
onBlur: field.onBlur,
|
|
@@ -231,8 +334,9 @@ var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
|
231
334
|
}
|
|
232
335
|
return /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
233
336
|
...props,
|
|
337
|
+
ref: mergeRefs(props.ref, inputRef),
|
|
234
338
|
value: parseDateValue(props.value),
|
|
235
|
-
onChange: (
|
|
339
|
+
onChange: (value_0) => props.onChange?.(formatDateValue(value_0))
|
|
236
340
|
});
|
|
237
341
|
};
|
|
238
342
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Ref } from 'react';
|
|
1
|
+
import { Ref, FocusEvent } from 'react';
|
|
2
2
|
import { AriaTimeFieldProps, TimeValue } from 'react-aria';
|
|
3
3
|
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { FormFieldProps } from '../../FormField/FormField';
|
|
5
5
|
import { ControlProps } from '../../shared/form.types';
|
|
6
6
|
import { InputVariantProps } from '../../shared/input.cva';
|
|
7
|
-
interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<AriaTimeFieldProps<TimeValue>, "label"> {
|
|
7
|
+
interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<AriaTimeFieldProps<TimeValue>, "label" | "onBlur"> {
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
9
|
disableDropdown?: boolean;
|
|
10
10
|
date?: string | null;
|
|
@@ -13,13 +13,15 @@ interface TimePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Ar
|
|
|
13
13
|
disableManualEntry?: boolean;
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
inputClassName?: string;
|
|
16
|
+
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
16
17
|
}
|
|
17
18
|
export interface TimePickerProps extends Omit<TimePickerBaseProps, "value" | "onChange"> {
|
|
18
19
|
value?: string | null;
|
|
19
20
|
onChange?: (value: string | null) => void;
|
|
20
21
|
fullIso?: boolean;
|
|
21
22
|
timeZone?: string;
|
|
23
|
+
renderStaticInput?: boolean;
|
|
22
24
|
}
|
|
23
25
|
export type ControlledTimePickerProps<TFieldValues extends FieldValues> = ControlProps<TimePickerProps, TFieldValues>;
|
|
24
|
-
export declare const TimePicker: <TFieldValues extends FieldValues>(props: ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare const TimePicker: <TFieldValues extends FieldValues>({ renderStaticInput, ...props }: ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
25
27
|
export {};
|