@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,43 +1,22 @@
|
|
|
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 { getStaticCalendarDateTimeSegments } 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
|
-
import {
|
|
18
|
-
import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
19
11
|
import { useDatePicker, useLocale } from "react-aria";
|
|
20
12
|
import { mergeRefs } from "@react-aria/utils";
|
|
21
|
-
import { Controller
|
|
13
|
+
import { Controller } from "react-hook-form";
|
|
22
14
|
import { Time, createCalendar, getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
23
15
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
24
16
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
25
17
|
var DateTimePickerBase = (props) => {
|
|
26
18
|
const ui = UIConfig.useConfig();
|
|
27
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange,
|
|
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;
|
|
19
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel = ui.input.hideLabel, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, isClearable = ui.input.isClearable, todayIcon = ui.dateInput.todayIcon, shouldForceLeadingZeros = ui.dateInput.shouldForceLeadingZeros, disableManualEntry = ui.dateInput.disableManualEntry, shouldUpdateDateOnMonthYearChange = ui.dateInput.shouldUpdateDateOnMonthYearChange, timeZone, autoFixYear = ui.dateInput.autoFixYear, format, ...rest } = props;
|
|
41
20
|
let effectiveTimeZone = getLocalTimeZone();
|
|
42
21
|
if (timeZone) effectiveTimeZone = timeZone;
|
|
43
22
|
const formFieldProps = {
|
|
@@ -57,16 +36,9 @@ var DateTimePickerBase = (props) => {
|
|
|
57
36
|
const datePickerRef = useMemo(() => ({ get current() {
|
|
58
37
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
59
38
|
} }), []);
|
|
60
|
-
useImperativeHandle(ref, () => ({
|
|
61
|
-
clear
|
|
62
|
-
|
|
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 });
|
|
39
|
+
useImperativeHandle(ref, () => ({ clear: () => {
|
|
40
|
+
datePickerInputRef.current?.clear();
|
|
41
|
+
} }));
|
|
70
42
|
const dialogState = useDatePickerState({
|
|
71
43
|
...rest,
|
|
72
44
|
defaultValue: value || rest.defaultValue,
|
|
@@ -82,11 +54,10 @@ var DateTimePickerBase = (props) => {
|
|
|
82
54
|
...rest,
|
|
83
55
|
shouldForceLeadingZeros,
|
|
84
56
|
value,
|
|
85
|
-
onChange: (
|
|
86
|
-
onChange?.(
|
|
87
|
-
dialogState.setValue(
|
|
88
|
-
calendarState.setFocusedDate(
|
|
89
|
-
debouncedBlur(val_0);
|
|
57
|
+
onChange: (val) => {
|
|
58
|
+
onChange?.(val);
|
|
59
|
+
dialogState.setValue(val);
|
|
60
|
+
calendarState.setFocusedDate(val || today(effectiveTimeZone));
|
|
90
61
|
},
|
|
91
62
|
shouldCloseOnSelect: false,
|
|
92
63
|
granularity: "minute",
|
|
@@ -122,10 +93,8 @@ var DateTimePickerBase = (props) => {
|
|
|
122
93
|
labelProps
|
|
123
94
|
};
|
|
124
95
|
const onApply = () => {
|
|
125
|
-
|
|
126
|
-
state.setValue(newValue);
|
|
96
|
+
state.setValue(dialogState.value);
|
|
127
97
|
state.toggle();
|
|
128
|
-
handleBlur(newValue);
|
|
129
98
|
};
|
|
130
99
|
const onMonthYearChange = (selectedDate) => {
|
|
131
100
|
if (!shouldUpdateDateOnMonthYearChange) return;
|
|
@@ -181,9 +150,9 @@ var DateTimePickerBase = (props) => {
|
|
|
181
150
|
groupProps,
|
|
182
151
|
fieldProps: {
|
|
183
152
|
...fieldProps,
|
|
184
|
-
onBlur: (
|
|
185
|
-
fieldProps.onBlur?.(
|
|
186
|
-
onInputBlur(
|
|
153
|
+
onBlur: (e) => {
|
|
154
|
+
fieldProps.onBlur?.(e);
|
|
155
|
+
onInputBlur(e);
|
|
187
156
|
}
|
|
188
157
|
},
|
|
189
158
|
buttonProps,
|
|
@@ -197,15 +166,13 @@ var DateTimePickerBase = (props) => {
|
|
|
197
166
|
isClearable,
|
|
198
167
|
headerProps,
|
|
199
168
|
todayIcon,
|
|
200
|
-
todayIconButtonSize,
|
|
201
|
-
todayIconPlacement,
|
|
202
169
|
isRequired,
|
|
203
170
|
disableManualEntry,
|
|
204
|
-
autoFixYear,
|
|
205
171
|
placeholder,
|
|
206
172
|
onOpenDropdown: () => state.toggle(),
|
|
207
173
|
className: inputClassName,
|
|
208
174
|
timeZone: effectiveTimeZone,
|
|
175
|
+
autoFixYear,
|
|
209
176
|
isTimeOptional,
|
|
210
177
|
format
|
|
211
178
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
@@ -227,36 +194,13 @@ var DateTimePickerBase = (props) => {
|
|
|
227
194
|
datePickerState: dialogState,
|
|
228
195
|
onApply,
|
|
229
196
|
onMonthYearChange,
|
|
230
|
-
granularity: "day"
|
|
231
|
-
setDateValueOnDateSelection
|
|
197
|
+
granularity: "day"
|
|
232
198
|
})
|
|
233
199
|
})]
|
|
234
200
|
})
|
|
235
201
|
});
|
|
236
202
|
};
|
|
237
|
-
var DateTimePicker = ({ fullIso = true,
|
|
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;
|
|
203
|
+
var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
260
204
|
let effectiveTimeZone = getLocalTimeZone();
|
|
261
205
|
if (props.timeZone) effectiveTimeZone = props.timeZone;
|
|
262
206
|
const formatDateValue = (dateValue) => {
|
|
@@ -268,53 +212,6 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
268
212
|
if (isoString == null) return isoString;
|
|
269
213
|
return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, effectiveTimeZone);
|
|
270
214
|
};
|
|
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
|
-
}
|
|
318
215
|
if ("formControl" in props && props.formControl) {
|
|
319
216
|
const { formControl, ref, ...innerProps } = props;
|
|
320
217
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -322,7 +219,7 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
322
219
|
name: formControl.name,
|
|
323
220
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
324
221
|
...innerProps,
|
|
325
|
-
ref: mergeRefs(ref, field.ref
|
|
222
|
+
ref: mergeRefs(ref, field.ref),
|
|
326
223
|
value: parseDateValue(field.value),
|
|
327
224
|
onChange: (value) => field.onChange(formatDateValue(value)),
|
|
328
225
|
onBlur: field.onBlur,
|
|
@@ -334,9 +231,8 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
334
231
|
}
|
|
335
232
|
return /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
336
233
|
...props,
|
|
337
|
-
ref: mergeRefs(props.ref, inputRef),
|
|
338
234
|
value: parseDateValue(props.value),
|
|
339
|
-
onChange: (
|
|
235
|
+
onChange: (value) => props.onChange?.(formatDateValue(value))
|
|
340
236
|
});
|
|
341
237
|
};
|
|
342
238
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Ref
|
|
1
|
+
import { Ref } 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"> {
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
9
|
disableDropdown?: boolean;
|
|
10
10
|
date?: string | null;
|
|
@@ -13,15 +13,13 @@ 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;
|
|
17
16
|
}
|
|
18
17
|
export interface TimePickerProps extends Omit<TimePickerBaseProps, "value" | "onChange"> {
|
|
19
18
|
value?: string | null;
|
|
20
19
|
onChange?: (value: string | null) => void;
|
|
21
20
|
fullIso?: boolean;
|
|
22
21
|
timeZone?: string;
|
|
23
|
-
renderStaticInput?: boolean;
|
|
24
22
|
}
|
|
25
23
|
export type ControlledTimePickerProps<TFieldValues extends FieldValues> = ControlProps<TimePickerProps, TFieldValues>;
|
|
26
|
-
export declare const TimePicker: <TFieldValues extends FieldValues>(
|
|
24
|
+
export declare const TimePicker: <TFieldValues extends FieldValues>(props: ControlledTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
27
25
|
export {};
|