@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,231 +1,89 @@
|
|
|
1
|
+
import { ClockIcon } from "../../../../assets/icons/Clock.js";
|
|
1
2
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
2
3
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
|
-
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
4
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
5
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
6
6
|
import { InputClear } from "../../shared/InputClear.js";
|
|
7
7
|
import { inputBase, inputSize } from "../../shared/input.cva.js";
|
|
8
8
|
import { TimeField } from "./TimeField.js";
|
|
9
|
-
import { c } from "react/compiler-runtime";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { clsx } from "clsx";
|
|
12
11
|
import { useState } from "react";
|
|
13
12
|
import { Button } from "react-aria-components";
|
|
14
13
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
15
14
|
//#region src/components/inputs/DateTime/shared/TimePickerInput.tsx
|
|
16
|
-
var TimePickerInput = (
|
|
17
|
-
const $ = c(65);
|
|
18
|
-
const { ref, as, fieldProps, state, isDisabled, isDirty, isRequired, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props } = t0;
|
|
19
|
-
const uiConfig = UIConfig.useConfig();
|
|
15
|
+
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
|
|
20
16
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
21
17
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
22
|
-
|
|
23
|
-
if ($[0] !== isDisabled) {
|
|
24
|
-
t1 = { isDisabled };
|
|
25
|
-
$[0] = isDisabled;
|
|
26
|
-
$[1] = t1;
|
|
27
|
-
} else t1 = $[1];
|
|
28
|
-
const { hoverProps, isHovered } = useHover(t1);
|
|
18
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
29
19
|
const [isFocused, setIsFocused] = useState(false);
|
|
30
|
-
|
|
31
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
32
|
-
t2 = { onFocusWithinChange: setIsFocused };
|
|
33
|
-
$[2] = t2;
|
|
34
|
-
} else t2 = $[2];
|
|
35
|
-
const { focusWithinProps } = useFocusWithin(t2);
|
|
20
|
+
const { focusWithinProps } = useFocusWithin({ onFocusWithinChange: setIsFocused });
|
|
36
21
|
const { isFocusVisible } = useFocusVisible();
|
|
37
22
|
const hidePlaceholder = as === "floating" && !state.value && !isFocused;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} else t3 = $[4];
|
|
44
|
-
const canClear = t3;
|
|
45
|
-
const t4 = clsx(inputBaseCva({
|
|
46
|
-
variant,
|
|
47
|
-
as,
|
|
48
|
-
...props
|
|
49
|
-
}), "group/date-picker-content relative min-w-input-width-min-width", "flex items-center justify-between gap-input-gap-input-text-to-elements", className);
|
|
50
|
-
const t5 = isHovered || void 0;
|
|
51
|
-
const t6 = isDisabled || void 0;
|
|
52
|
-
const t7 = isDisabled || void 0;
|
|
53
|
-
const t8 = isInvalid || void 0;
|
|
54
|
-
const t9 = state.value === null || void 0;
|
|
55
|
-
const t10 = isFocused || void 0;
|
|
56
|
-
const t11 = isFocused && isFocusVisible || void 0;
|
|
57
|
-
const t12 = state.value !== null || void 0;
|
|
58
|
-
const t13 = isDirty || void 0;
|
|
59
|
-
const t14 = isRequired || void 0;
|
|
60
|
-
const t15 = state.value !== null || void 0;
|
|
61
|
-
let t16;
|
|
62
|
-
if ($[5] !== as || $[6] !== inputSizeCva || $[7] !== size) {
|
|
63
|
-
t16 = clsx(inputSizeCva({
|
|
64
|
-
size,
|
|
65
|
-
as
|
|
66
|
-
}), "flex w-full items-center gap-input-gap-input-text-to-elements pr-0!");
|
|
67
|
-
$[5] = as;
|
|
68
|
-
$[6] = inputSizeCva;
|
|
69
|
-
$[7] = size;
|
|
70
|
-
$[8] = t16;
|
|
71
|
-
} else t16 = $[8];
|
|
72
|
-
let t17;
|
|
73
|
-
if ($[9] !== disableManualEntry || $[10] !== onPress) {
|
|
74
|
-
t17 = disableManualEntry && /* @__PURE__ */ jsx(Button, {
|
|
75
|
-
onPress,
|
|
76
|
-
className: "absolute inset-0 z-0"
|
|
77
|
-
});
|
|
78
|
-
$[9] = disableManualEntry;
|
|
79
|
-
$[10] = onPress;
|
|
80
|
-
$[11] = t17;
|
|
81
|
-
} else t17 = $[11];
|
|
82
|
-
let t18;
|
|
83
|
-
if ($[12] !== as || $[13] !== headerProps) {
|
|
84
|
-
t18 = as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
23
|
+
const canClear = state.segments.some((segment) => segment.type !== "literal" && segment.isPlaceholder === false);
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
25
|
+
ref,
|
|
26
|
+
className: clsx(inputBaseCva({
|
|
27
|
+
variant,
|
|
85
28
|
as,
|
|
86
|
-
...
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
$[17] = hidePlaceholder;
|
|
107
|
-
$[18] = isDisabled;
|
|
108
|
-
$[19] = placeholder;
|
|
109
|
-
$[20] = state;
|
|
110
|
-
$[21] = t19;
|
|
111
|
-
} else t19 = $[21];
|
|
112
|
-
let t20;
|
|
113
|
-
if ($[22] !== t16 || $[23] !== t17 || $[24] !== t18 || $[25] !== t19) {
|
|
114
|
-
t20 = /* @__PURE__ */ jsxs("div", {
|
|
115
|
-
className: t16,
|
|
29
|
+
...props
|
|
30
|
+
}), "group/date-picker-content relative min-w-input-width-min-width", "flex items-center justify-between gap-input-gap-input-text-to-elements", className),
|
|
31
|
+
"data-rac": "",
|
|
32
|
+
"data-datetime-input": "",
|
|
33
|
+
"data-hovered": isHovered || void 0,
|
|
34
|
+
"data-disabled": isDisabled || void 0,
|
|
35
|
+
"data-invalid": isInvalid || void 0,
|
|
36
|
+
"data-is-empty": state.value === null || void 0,
|
|
37
|
+
"data-focus-within": isFocused || void 0,
|
|
38
|
+
"data-focus-visible": isFocused && isFocusVisible || void 0,
|
|
39
|
+
"data-has-selection": state.value !== null || void 0,
|
|
40
|
+
"data-is-dirty": isDirty || void 0,
|
|
41
|
+
...fieldProps,
|
|
42
|
+
...focusWithinProps,
|
|
43
|
+
...hoverProps,
|
|
44
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: clsx(inputSizeCva({
|
|
46
|
+
size,
|
|
47
|
+
as
|
|
48
|
+
}), "flex w-full items-center gap-input-gap-input-text-to-elements pr-0!"),
|
|
116
49
|
children: [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
50
|
+
disableManualEntry && /* @__PURE__ */ jsx(Button, {
|
|
51
|
+
onPress,
|
|
52
|
+
className: "absolute inset-0 z-0"
|
|
53
|
+
}),
|
|
54
|
+
as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
55
|
+
as,
|
|
56
|
+
...headerProps
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx("div", { children: disableManualEntry && placeholder && !state.value ? /* @__PURE__ */ jsx(Typography, {
|
|
59
|
+
size: "label-1",
|
|
60
|
+
className: "text-text-default-3",
|
|
61
|
+
children: placeholder
|
|
62
|
+
}) : /* @__PURE__ */ jsx(TimeField, {
|
|
63
|
+
fieldProps,
|
|
64
|
+
state,
|
|
65
|
+
isDisabled,
|
|
66
|
+
hidePlaceholder
|
|
67
|
+
}) })
|
|
120
68
|
]
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
let t22;
|
|
140
|
-
if ($[31] !== canClear || $[32] !== fieldProps || $[33] !== isClearable || $[34] !== state) {
|
|
141
|
-
t22 = isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
142
|
-
onClear: () => {
|
|
143
|
-
state.setValue(null);
|
|
144
|
-
fieldProps.onBlur?.(null);
|
|
145
|
-
},
|
|
146
|
-
show: canClear
|
|
147
|
-
});
|
|
148
|
-
$[31] = canClear;
|
|
149
|
-
$[32] = fieldProps;
|
|
150
|
-
$[33] = isClearable;
|
|
151
|
-
$[34] = state;
|
|
152
|
-
$[35] = t22;
|
|
153
|
-
} else t22 = $[35];
|
|
154
|
-
let t23;
|
|
155
|
-
if ($[36] !== disableDropdown || $[37] !== disableManualEntry || $[38] !== isDisabled || $[39] !== onPress || $[40] !== uiConfig) {
|
|
156
|
-
t23 = (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
157
|
-
label: "",
|
|
158
|
-
color: "secondary",
|
|
159
|
-
onPress,
|
|
160
|
-
icon: uiConfig.dateInput.timeIcon,
|
|
161
|
-
isDisabled,
|
|
162
|
-
className: "border-0!"
|
|
163
|
-
});
|
|
164
|
-
$[36] = disableDropdown;
|
|
165
|
-
$[37] = disableManualEntry;
|
|
166
|
-
$[38] = isDisabled;
|
|
167
|
-
$[39] = onPress;
|
|
168
|
-
$[40] = uiConfig;
|
|
169
|
-
$[41] = t23;
|
|
170
|
-
} else t23 = $[41];
|
|
171
|
-
let t24;
|
|
172
|
-
if ($[42] !== t21 || $[43] !== t22 || $[44] !== t23) {
|
|
173
|
-
t24 = /* @__PURE__ */ jsxs("div", {
|
|
174
|
-
className: t21,
|
|
175
|
-
children: [t22, t23]
|
|
176
|
-
});
|
|
177
|
-
$[42] = t21;
|
|
178
|
-
$[43] = t22;
|
|
179
|
-
$[44] = t23;
|
|
180
|
-
$[45] = t24;
|
|
181
|
-
} else t24 = $[45];
|
|
182
|
-
let t25;
|
|
183
|
-
if ($[46] !== fieldProps || $[47] !== focusWithinProps || $[48] !== hoverProps || $[49] !== ref || $[50] !== t10 || $[51] !== t11 || $[52] !== t12 || $[53] !== t13 || $[54] !== t14 || $[55] !== t15 || $[56] !== t20 || $[57] !== t24 || $[58] !== t4 || $[59] !== t5 || $[60] !== t6 || $[61] !== t7 || $[62] !== t8 || $[63] !== t9) {
|
|
184
|
-
t25 = /* @__PURE__ */ jsxs("div", {
|
|
185
|
-
ref,
|
|
186
|
-
className: t4,
|
|
187
|
-
"data-rac": "",
|
|
188
|
-
"data-datetime-input": "",
|
|
189
|
-
"data-hovered": t5,
|
|
190
|
-
"data-disabled": t6,
|
|
191
|
-
"data-is-disabled": t7,
|
|
192
|
-
"data-invalid": t8,
|
|
193
|
-
"data-is-empty": t9,
|
|
194
|
-
"data-focus-within": t10,
|
|
195
|
-
"data-focus-visible": t11,
|
|
196
|
-
"data-has-selection": t12,
|
|
197
|
-
"data-is-dirty": t13,
|
|
198
|
-
"data-is-required": t14,
|
|
199
|
-
"data-is-filled": t15,
|
|
200
|
-
...fieldProps,
|
|
201
|
-
...focusWithinProps,
|
|
202
|
-
...hoverProps,
|
|
203
|
-
children: [t20, t24]
|
|
204
|
-
});
|
|
205
|
-
$[46] = fieldProps;
|
|
206
|
-
$[47] = focusWithinProps;
|
|
207
|
-
$[48] = hoverProps;
|
|
208
|
-
$[49] = ref;
|
|
209
|
-
$[50] = t10;
|
|
210
|
-
$[51] = t11;
|
|
211
|
-
$[52] = t12;
|
|
212
|
-
$[53] = t13;
|
|
213
|
-
$[54] = t14;
|
|
214
|
-
$[55] = t15;
|
|
215
|
-
$[56] = t20;
|
|
216
|
-
$[57] = t24;
|
|
217
|
-
$[58] = t4;
|
|
218
|
-
$[59] = t5;
|
|
219
|
-
$[60] = t6;
|
|
220
|
-
$[61] = t7;
|
|
221
|
-
$[62] = t8;
|
|
222
|
-
$[63] = t9;
|
|
223
|
-
$[64] = t25;
|
|
224
|
-
} else t25 = $[64];
|
|
225
|
-
return t25;
|
|
69
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
70
|
+
className: clsx(inputSizeCva({
|
|
71
|
+
size,
|
|
72
|
+
as
|
|
73
|
+
}), "flex items-center gap-input-gap-trailing-elements py-0! pl-0!"),
|
|
74
|
+
children: [isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
75
|
+
onClear: () => state.setValue(null),
|
|
76
|
+
show: canClear
|
|
77
|
+
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
78
|
+
label: "",
|
|
79
|
+
color: "secondary",
|
|
80
|
+
onPress,
|
|
81
|
+
icon: ClockIcon,
|
|
82
|
+
isDisabled,
|
|
83
|
+
className: "border-0!"
|
|
84
|
+
})]
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
226
87
|
};
|
|
227
|
-
function _temp(segment) {
|
|
228
|
-
return segment.type !== "literal" && segment.isPlaceholder === false;
|
|
229
|
-
}
|
|
230
88
|
//#endregion
|
|
231
89
|
export { TimePickerInput };
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
2
2
|
import { useScrollableListBox } from "../../../../hooks/useScrollableListBox.js";
|
|
3
|
-
import { c } from "react/compiler-runtime";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
import { clsx } from "clsx";
|
|
6
|
-
import { useRef } from "react";
|
|
5
|
+
import { useMemo, useRef } from "react";
|
|
7
6
|
import { ListBox, ListBoxItem } from "react-aria-components";
|
|
8
7
|
import { today } from "@internationalized/date";
|
|
9
8
|
import { useDateFormatter } from "@react-aria/i18n";
|
|
10
9
|
//#region src/components/inputs/DateTime/shared/YearPicker.tsx
|
|
11
|
-
var YearPicker = (
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
timeZone: state.timeZone
|
|
19
|
-
};
|
|
20
|
-
$[0] = state.timeZone;
|
|
21
|
-
$[1] = t1;
|
|
22
|
-
} else t1 = $[1];
|
|
23
|
-
const formatter = useDateFormatter(t1);
|
|
24
|
-
let arr;
|
|
25
|
-
if ($[2] !== formatter || $[3] !== state.timeZone) {
|
|
26
|
-
arr = [];
|
|
10
|
+
var YearPicker = ({ state, onSelectionChange, onDateChange, onCommit, selectedDate }) => {
|
|
11
|
+
const formatter = useDateFormatter({
|
|
12
|
+
year: "numeric",
|
|
13
|
+
timeZone: state.timeZone
|
|
14
|
+
});
|
|
15
|
+
const years = useMemo(() => {
|
|
16
|
+
const arr = [];
|
|
27
17
|
for (let i = -100; i <= 100; i++) {
|
|
28
18
|
const date = today(state.timeZone).add({ years: i });
|
|
29
19
|
arr.push({
|
|
@@ -31,121 +21,80 @@ var YearPicker = (t0) => {
|
|
|
31
21
|
formatted: formatter.format(date.toDate(state.timeZone))
|
|
32
22
|
});
|
|
33
23
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
$[4] = arr;
|
|
37
|
-
} else arr = $[4];
|
|
38
|
-
const years = arr;
|
|
24
|
+
return arr;
|
|
25
|
+
}, [state.timeZone, formatter]);
|
|
39
26
|
const isYearDisabled = (year) => {
|
|
40
27
|
if (state.minValue && year < state.minValue.year) return true;
|
|
41
28
|
if (state.maxValue && year > state.maxValue.year) return true;
|
|
42
29
|
return false;
|
|
43
30
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
$[5] = selectedDate;
|
|
56
|
-
$[6] = state.focusedDate;
|
|
57
|
-
$[7] = years;
|
|
58
|
-
$[8] = t2;
|
|
59
|
-
} else t2 = $[8];
|
|
60
|
-
const selectedYearIndex = t2();
|
|
31
|
+
const getSelectedYearIndex = () => {
|
|
32
|
+
if (selectedDate) {
|
|
33
|
+
const selectedIndexFromValue = years.findIndex((year) => year.value === selectedDate.year);
|
|
34
|
+
if (selectedIndexFromValue >= 0) return selectedIndexFromValue;
|
|
35
|
+
}
|
|
36
|
+
const focusedYearIndex = years.findIndex((year) => year.value === state.focusedDate.year);
|
|
37
|
+
if (focusedYearIndex < 0) return null;
|
|
38
|
+
return focusedYearIndex;
|
|
39
|
+
};
|
|
40
|
+
const selectedYearIndex = getSelectedYearIndex();
|
|
61
41
|
const lastPressedYearIndexRef = useRef(null);
|
|
62
|
-
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
42
|
+
const listBoxSelectionProps = {};
|
|
43
|
+
if (selectedYearIndex !== null) listBoxSelectionProps.selectedKeys = [selectedYearIndex];
|
|
44
|
+
const parseYearIndexFromKey = (key) => {
|
|
45
|
+
if (typeof key === "number") return key;
|
|
46
|
+
if (typeof key === "string") {
|
|
47
|
+
const parsedIndex = Number.parseInt(key, 10);
|
|
48
|
+
if (!Number.isNaN(parsedIndex)) return parsedIndex;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
};
|
|
70
52
|
const { ref } = useScrollableListBox();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
const selectedKey = [...
|
|
53
|
+
return /* @__PURE__ */ jsx(ListBox, {
|
|
54
|
+
ref,
|
|
55
|
+
autoFocus: true,
|
|
56
|
+
"aria-label": "Year",
|
|
57
|
+
selectionMode: "single",
|
|
58
|
+
...listBoxSelectionProps,
|
|
59
|
+
onSelectionChange: (key) => {
|
|
60
|
+
if (key === "all") return;
|
|
61
|
+
const selectedKey = [...key][0];
|
|
80
62
|
const selectedYearIndexValue = parseYearIndexFromKey(selectedKey);
|
|
81
63
|
if (selectedYearIndexValue !== null && years[selectedYearIndexValue]) {
|
|
82
64
|
const nextSelectedDate = state.focusedDate.set({ year: years[selectedYearIndexValue].value });
|
|
83
65
|
state.setFocusedDate(nextSelectedDate);
|
|
84
66
|
onDateChange?.(nextSelectedDate);
|
|
85
67
|
}
|
|
86
|
-
onSelectionChange(
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
as: "span",
|
|
116
|
-
size: "label-2",
|
|
117
|
-
children: year_2.formatted
|
|
118
|
-
})
|
|
119
|
-
}, index);
|
|
68
|
+
onSelectionChange(key);
|
|
69
|
+
},
|
|
70
|
+
className: "h-80 max-h-full min-h-0 w-full shrink-0 overflow-y-auto md:h-72 md:w-80",
|
|
71
|
+
children: years.map((year, index) => {
|
|
72
|
+
const isDisabled = isYearDisabled(year.value);
|
|
73
|
+
return /* @__PURE__ */ jsx(ListBoxItem, {
|
|
74
|
+
id: index,
|
|
75
|
+
textValue: year.formatted,
|
|
76
|
+
isDisabled,
|
|
77
|
+
onPress: () => {
|
|
78
|
+
const isSecondConsecutivePress = lastPressedYearIndexRef.current === index;
|
|
79
|
+
lastPressedYearIndexRef.current = index;
|
|
80
|
+
const nextSelectedDate = state.focusedDate.set({ year: year.value });
|
|
81
|
+
state.setFocusedDate(nextSelectedDate);
|
|
82
|
+
onDateChange?.(nextSelectedDate);
|
|
83
|
+
if (!isSecondConsecutivePress) return;
|
|
84
|
+
if (!selectedDate) return;
|
|
85
|
+
if (selectedYearIndex === null) return;
|
|
86
|
+
if (index !== selectedYearIndex) return;
|
|
87
|
+
onCommit?.();
|
|
88
|
+
},
|
|
89
|
+
className: clsx("flex px-4 py-2 text-interactive-text-secondary-idle outline-none", "border-elevation-outline-default-1 border-b border-solid bg-elevation-fill-default-1 last:border-b-0", "hover:text-interactive-text-secondary-hover", "selected:bg-interactive-contained-primary-idle selected:text-interactive-text-secondary-idle-inverted", "focus-visible:bg-interactive-contained-primary-focus focus-visible:text-interactive-text-secondary-idle-inverted", isDisabled ? "cursor-default opacity-50" : "cursor-pointer"),
|
|
90
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
91
|
+
as: "span",
|
|
92
|
+
size: "label-2",
|
|
93
|
+
children: year.formatted
|
|
94
|
+
})
|
|
95
|
+
}, index);
|
|
96
|
+
})
|
|
120
97
|
});
|
|
121
|
-
let t9;
|
|
122
|
-
if ($[16] !== T0 || $[17] !== listBoxSelectionProps || $[18] !== ref || $[19] !== t6 || $[20] !== t8) {
|
|
123
|
-
t9 = /* @__PURE__ */ jsx(T0, {
|
|
124
|
-
ref,
|
|
125
|
-
autoFocus: t3,
|
|
126
|
-
"aria-label": t4,
|
|
127
|
-
selectionMode: t5,
|
|
128
|
-
...listBoxSelectionProps,
|
|
129
|
-
onSelectionChange: t6,
|
|
130
|
-
className: t7,
|
|
131
|
-
children: t8
|
|
132
|
-
});
|
|
133
|
-
$[16] = T0;
|
|
134
|
-
$[17] = listBoxSelectionProps;
|
|
135
|
-
$[18] = ref;
|
|
136
|
-
$[19] = t6;
|
|
137
|
-
$[20] = t8;
|
|
138
|
-
$[21] = t9;
|
|
139
|
-
} else t9 = $[21];
|
|
140
|
-
return t9;
|
|
141
98
|
};
|
|
142
|
-
function _temp(key) {
|
|
143
|
-
if (typeof key === "number") return key;
|
|
144
|
-
if (typeof key === "string") {
|
|
145
|
-
const parsedIndex = Number.parseInt(key, 10);
|
|
146
|
-
if (!Number.isNaN(parsedIndex)) return parsedIndex;
|
|
147
|
-
}
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
99
|
//#endregion
|
|
151
100
|
export { YearPicker };
|