@povio/ui 3.0.0-rc.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- 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.d.ts +4 -0
- 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.d.ts +1 -1
- package/dist/components/Menu/MenuMobile.js +39 -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.d.ts +0 -1
- package/dist/components/inputs/Checkbox/Checkbox.js +35 -201
- 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 -12
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +75 -373
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -12
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +186 -492
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -14
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +47 -273
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +121 -611
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +3 -5
- package/dist/components/inputs/DateTime/shared/Calendar.js +120 -338
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -4
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +103 -310
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -4
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +33 -150
- package/dist/components/inputs/DateTime/shared/CalendarHeader.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +98 -249
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +137 -318
- package/dist/components/inputs/DateTime/shared/DateField.js +112 -286
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -14
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +129 -356
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -15
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +11 -96
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +28 -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 -4
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +65 -210
- package/dist/components/inputs/DateTime/shared/YearPicker.js +68 -119
- package/dist/components/inputs/File/FileUpload.js +45 -88
- 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.d.ts +2 -2
- package/dist/components/inputs/File/shared/ProgressBar.js +20 -53
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +1 -1
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -1
- package/dist/components/inputs/File/shared/progressBar.cva.d.ts +38 -0
- package/dist/components/inputs/File/shared/progressBar.cva.js +28 -0
- 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 +97 -447
- 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 +90 -419
- 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 -15
- package/dist/components/inputs/Inputs/InputItem.js +14 -69
- package/dist/components/inputs/Inputs/Inputs.js +11 -37
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -3
- package/dist/components/inputs/RadioGroup/RadioGroup.js +61 -353
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -45
- package/dist/components/inputs/RadioGroup/radio.cva.js +1 -48
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +2 -6
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +22 -217
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +8 -107
- package/dist/components/inputs/Selection/Select/Select.d.ts +3 -7
- package/dist/components/inputs/Selection/Select/Select.js +18 -227
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +3 -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 -397
- 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 +6 -11
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
- package/dist/components/inputs/Selection/shared/select.context.js +36 -67
- 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.d.ts +1 -2
- package/dist/components/inputs/Slider/Slider.js +76 -265
- 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.d.ts +0 -1
- package/dist/components/inputs/Toggle/Toggle.js +37 -214
- 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 +12 -88
- package/dist/components/inputs/shared/TooltipWrapper.js +11 -50
- package/dist/components/inputs/shared/input.cva.d.ts +0 -28
- package/dist/components/inputs/shared/input.cva.js +4 -38
- 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 +25 -98
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +8 -48
- package/dist/components/overlays/Drawer/Drawer.js +22 -64
- package/dist/components/overlays/Modal/modal.cva.js +1 -1
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +5 -1
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +28 -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 +17 -22
- package/dist/components/status/Toast/toast.cva.d.ts +14 -3
- package/dist/components/status/Toast/toast.cva.js +12 -10
- 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 +30 -30
- package/dist/components/table/table.cva.d.ts +7 -0
- package/dist/components/table/table.cva.js +2 -1
- package/dist/components/text/Link/Link.js +7 -19
- package/dist/components/text/Pill/Pill.d.ts +15 -0
- package/dist/components/text/Pill/Pill.js +44 -0
- 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 +10 -21
- package/dist/config/uiConfig.context.js +18 -69
- package/dist/config/uiOverrides.context.d.ts +10 -20
- package/dist/config/uiOverrides.context.js +14 -54
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +0 -3
- package/dist/hooks/useAutosave.d.ts +1 -2
- package/dist/hooks/useAutosave.js +4 -12
- 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.d.ts +1 -3
- package/dist/hooks/useFormAutosave.js +30 -122
- 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 +7 -16
- package/dist/index.js +6 -13
- package/dist/tw-ui-plugin.js +0 -6
- package/dist/utils/date-time.utils.d.ts +10 -38
- package/dist/utils/date-time.utils.js +22 -136
- package/package.json +1 -1
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -5
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +0 -16
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +0 -16
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -15
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +0 -32
- 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 -40
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +0 -85
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -13
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -14
- 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 -575
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +0 -8
- 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 -37
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
- package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -178
- 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 -14
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -43
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +0 -6
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +0 -5
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +0 -12
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +0 -8
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +0 -54
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -82
- package/dist/components/inputs/Skeleton/InputFrame.js +0 -548
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +0 -8
- 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/useAutosave.spec.d.ts +0 -1
- package/dist/hooks/useFormAutosave.spec.d.ts +0 -1
- package/dist/hooks/useKeyInteractions.d.ts +0 -20
- package/dist/hooks/useKeyInteractions.js +0 -54
- package/dist/hooks/useKeyInteractions.spec.d.ts +0 -1
- package/dist/hooks/useQueryAutocomplete.d.ts +0 -14
- package/dist/hooks/useQueryAutocomplete.js +0 -72
- package/dist/utils/query.utils.d.ts +0 -4
- package/dist/utils/query.utils.js +0 -8
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { clsx } from "clsx";
|
|
5
|
-
import { useRef } from "react";
|
|
4
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
6
5
|
import { mergeProps } from "@react-aria/utils";
|
|
7
6
|
import { isSameDay } from "@internationalized/date";
|
|
8
7
|
import { useCalendarCell } from "@react-aria/calendar";
|
|
@@ -11,172 +10,63 @@ import { useFocusRing } from "@react-aria/focus";
|
|
|
11
10
|
var isRange = (state) => {
|
|
12
11
|
return "highlightedRange" in state;
|
|
13
12
|
};
|
|
14
|
-
var CalendarCell = (
|
|
15
|
-
const $ = c(108);
|
|
16
|
-
let hoverDate;
|
|
17
|
-
let onApply;
|
|
18
|
-
let onDateHover;
|
|
19
|
-
let onDateSelection;
|
|
20
|
-
let onDoubleClickApply;
|
|
21
|
-
let onKeyboardNavigation;
|
|
22
|
-
let props;
|
|
23
|
-
let rangeSelection;
|
|
24
|
-
let state;
|
|
25
|
-
let t1;
|
|
26
|
-
let t2;
|
|
27
|
-
if ($[0] !== t0) {
|
|
28
|
-
({state, onApply, onDoubleClickApply, shouldApplyOnDateSelection: t1, shouldCloseOnSelect: t2, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, ...props} = t0);
|
|
29
|
-
$[0] = t0;
|
|
30
|
-
$[1] = hoverDate;
|
|
31
|
-
$[2] = onApply;
|
|
32
|
-
$[3] = onDateHover;
|
|
33
|
-
$[4] = onDateSelection;
|
|
34
|
-
$[5] = onDoubleClickApply;
|
|
35
|
-
$[6] = onKeyboardNavigation;
|
|
36
|
-
$[7] = props;
|
|
37
|
-
$[8] = rangeSelection;
|
|
38
|
-
$[9] = state;
|
|
39
|
-
$[10] = t1;
|
|
40
|
-
$[11] = t2;
|
|
41
|
-
} else {
|
|
42
|
-
hoverDate = $[1];
|
|
43
|
-
onApply = $[2];
|
|
44
|
-
onDateHover = $[3];
|
|
45
|
-
onDateSelection = $[4];
|
|
46
|
-
onDoubleClickApply = $[5];
|
|
47
|
-
onKeyboardNavigation = $[6];
|
|
48
|
-
props = $[7];
|
|
49
|
-
rangeSelection = $[8];
|
|
50
|
-
state = $[9];
|
|
51
|
-
t1 = $[10];
|
|
52
|
-
t2 = $[11];
|
|
53
|
-
}
|
|
54
|
-
const shouldApplyOnDateSelection = t1 === void 0 ? true : t1;
|
|
55
|
-
const shouldCloseOnSelect = t2 === void 0 ? true : t2;
|
|
13
|
+
var CalendarCell = ({ state, onApply, shouldCloseOnSelect = true, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, ...props }) => {
|
|
56
14
|
const ref = useRef(null);
|
|
57
|
-
const { cellProps, buttonProps, formattedDate, isSelected, isDisabled, isOutsideVisibleRange
|
|
15
|
+
const { cellProps, buttonProps, formattedDate, isSelected, isDisabled, isOutsideVisibleRange } = useCalendarCell(props, state, ref);
|
|
58
16
|
const { focusProps } = useFocusRing();
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
$[30] = t6;
|
|
111
|
-
} else t6 = $[30];
|
|
112
|
-
isSelectionEnd = t6;
|
|
113
|
-
isSelectedCell = isSelectionStart || isSelectionEnd;
|
|
114
|
-
isSelectingMode = rangeSelection.isSelecting && !rangeSelection.end;
|
|
115
|
-
if (rangeSelection.start && rangeSelection.end) {
|
|
116
|
-
const dateValue = props.date;
|
|
117
|
-
const isAfterStart = dateValue.compare(rangeSelection.start) > 0;
|
|
118
|
-
const isBeforeEnd = dateValue.compare(rangeSelection.end) < 0;
|
|
119
|
-
isInRange = isAfterStart && isBeforeEnd;
|
|
120
|
-
}
|
|
121
|
-
if (rangeSelection.isSelecting && rangeSelection.start && hoverDate && !rangeSelection.end) {
|
|
122
|
-
const dateValue_0 = props.date;
|
|
123
|
-
const { start } = rangeSelection;
|
|
124
|
-
const end = hoverDate;
|
|
125
|
-
const earlierDate = start.compare(end) <= 0 ? start : end;
|
|
126
|
-
const laterDate = start.compare(end) <= 0 ? end : start;
|
|
127
|
-
const isAfterStart_0 = dateValue_0.compare(earlierDate) > 0;
|
|
128
|
-
const isBeforeEnd_0 = dateValue_0.compare(laterDate) < 0;
|
|
129
|
-
isHoverRange = isAfterStart_0 && isBeforeEnd_0;
|
|
130
|
-
}
|
|
131
|
-
} else {
|
|
132
|
-
let t5;
|
|
133
|
-
if ($[31] !== isSelected || $[32] !== props.date || $[33] !== state) {
|
|
134
|
-
t5 = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.start) : isSelected;
|
|
135
|
-
$[31] = isSelected;
|
|
136
|
-
$[32] = props.date;
|
|
137
|
-
$[33] = state;
|
|
138
|
-
$[34] = t5;
|
|
139
|
-
} else t5 = $[34];
|
|
140
|
-
isSelectionStart = t5;
|
|
141
|
-
let t6;
|
|
142
|
-
if ($[35] !== isSelected || $[36] !== props.date || $[37] !== state) {
|
|
143
|
-
t6 = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.end) : isSelected;
|
|
144
|
-
$[35] = isSelected;
|
|
145
|
-
$[36] = props.date;
|
|
146
|
-
$[37] = state;
|
|
147
|
-
$[38] = t6;
|
|
148
|
-
} else t6 = $[38];
|
|
149
|
-
isSelectionEnd = t6;
|
|
150
|
-
let t7;
|
|
151
|
-
if ($[39] !== isSelected || $[40] !== isSelectionEnd || $[41] !== isSelectionStart || $[42] !== state) {
|
|
152
|
-
t7 = isSelectionStart || isSelectionEnd || !isRange(state) && isSelected;
|
|
153
|
-
$[39] = isSelected;
|
|
154
|
-
$[40] = isSelectionEnd;
|
|
155
|
-
$[41] = isSelectionStart;
|
|
156
|
-
$[42] = state;
|
|
157
|
-
$[43] = t7;
|
|
158
|
-
} else t7 = $[43];
|
|
159
|
-
isSelectedCell = t7;
|
|
160
|
-
let t8;
|
|
161
|
-
if ($[44] !== isSelected || $[45] !== isSelectionEnd || $[46] !== isSelectionStart || $[47] !== state) {
|
|
162
|
-
t8 = isRange(state) && isSelected && !isSelectionStart && !isSelectionEnd;
|
|
163
|
-
$[44] = isSelected;
|
|
164
|
-
$[45] = isSelectionEnd;
|
|
165
|
-
$[46] = isSelectionStart;
|
|
166
|
-
$[47] = state;
|
|
167
|
-
$[48] = t8;
|
|
168
|
-
} else t8 = $[48];
|
|
169
|
-
isInRange = t8;
|
|
170
|
-
if (isRange(state) && state.highlightedRange && !isSelected) {
|
|
171
|
-
const dateValue_1 = props.date;
|
|
172
|
-
const isAfterStart_1 = dateValue_1.compare(state.highlightedRange.start) > 0;
|
|
173
|
-
const isBeforeEnd_1 = dateValue_1.compare(state.highlightedRange.end) < 0;
|
|
174
|
-
isHoverRange = isAfterStart_1 && isBeforeEnd_1;
|
|
17
|
+
const onClick = useCallback((event) => {
|
|
18
|
+
buttonProps.onClick?.(event);
|
|
19
|
+
if (onDateSelection) onDateSelection(props.date);
|
|
20
|
+
if (isSelected && shouldCloseOnSelect) onApply?.();
|
|
21
|
+
}, [
|
|
22
|
+
buttonProps,
|
|
23
|
+
onDateSelection,
|
|
24
|
+
props.date,
|
|
25
|
+
isSelected,
|
|
26
|
+
shouldCloseOnSelect,
|
|
27
|
+
onApply
|
|
28
|
+
]);
|
|
29
|
+
const selectionState = useMemo(() => {
|
|
30
|
+
let isSelectionStart = false;
|
|
31
|
+
let isSelectionEnd = false;
|
|
32
|
+
let isSelectedCell = false;
|
|
33
|
+
let isInRange = false;
|
|
34
|
+
let isHoverRange = false;
|
|
35
|
+
let isSelectingMode = false;
|
|
36
|
+
if (rangeSelection?.start) {
|
|
37
|
+
isSelectionStart = isSameDay(props.date, rangeSelection.start);
|
|
38
|
+
isSelectionEnd = rangeSelection.end ? isSameDay(props.date, rangeSelection.end) : false;
|
|
39
|
+
isSelectedCell = isSelectionStart || isSelectionEnd;
|
|
40
|
+
isSelectingMode = rangeSelection.isSelecting && !rangeSelection.end;
|
|
41
|
+
if (rangeSelection.start && rangeSelection.end) {
|
|
42
|
+
const dateValue = props.date;
|
|
43
|
+
const isAfterStart = dateValue.compare(rangeSelection.start) > 0;
|
|
44
|
+
const isBeforeEnd = dateValue.compare(rangeSelection.end) < 0;
|
|
45
|
+
isInRange = isAfterStart && isBeforeEnd;
|
|
46
|
+
}
|
|
47
|
+
if (rangeSelection.isSelecting && rangeSelection.start && hoverDate && !rangeSelection.end) {
|
|
48
|
+
const dateValue = props.date;
|
|
49
|
+
const { start } = rangeSelection;
|
|
50
|
+
const end = hoverDate;
|
|
51
|
+
const earlierDate = start.compare(end) <= 0 ? start : end;
|
|
52
|
+
const laterDate = start.compare(end) <= 0 ? end : start;
|
|
53
|
+
const isAfterStart = dateValue.compare(earlierDate) > 0;
|
|
54
|
+
const isBeforeEnd = dateValue.compare(laterDate) < 0;
|
|
55
|
+
isHoverRange = isAfterStart && isBeforeEnd;
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
isSelectionStart = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.start) : isSelected;
|
|
59
|
+
isSelectionEnd = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.end) : isSelected;
|
|
60
|
+
isSelectedCell = isSelectionStart || isSelectionEnd || !isRange(state) && isSelected;
|
|
61
|
+
isInRange = isRange(state) && isSelected && !isSelectionStart && !isSelectionEnd;
|
|
62
|
+
if (isRange(state) && state.highlightedRange && !isSelected) {
|
|
63
|
+
const dateValue = props.date;
|
|
64
|
+
const isAfterStart = dateValue.compare(state.highlightedRange.start) > 0;
|
|
65
|
+
const isBeforeEnd = dateValue.compare(state.highlightedRange.end) < 0;
|
|
66
|
+
isHoverRange = isAfterStart && isBeforeEnd;
|
|
67
|
+
}
|
|
175
68
|
}
|
|
176
|
-
|
|
177
|
-
let t5;
|
|
178
|
-
if ($[49] !== isHoverRange || $[50] !== isInRange || $[51] !== isSelectedCell || $[52] !== isSelectingMode || $[53] !== isSelectionEnd || $[54] !== isSelectionStart) {
|
|
179
|
-
t5 = {
|
|
69
|
+
return {
|
|
180
70
|
isSelectionStart,
|
|
181
71
|
isSelectionEnd,
|
|
182
72
|
isSelectedCell,
|
|
@@ -184,156 +74,59 @@ var CalendarCell = (t0) => {
|
|
|
184
74
|
isHoverRange,
|
|
185
75
|
isSelectingMode
|
|
186
76
|
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
} else t7 = $[66];
|
|
225
|
-
const onMouseEnter = t7;
|
|
226
|
-
let t8;
|
|
227
|
-
if ($[67] !== onDateHover || $[68] !== selectionState.isSelectingMode) {
|
|
228
|
-
t8 = () => {
|
|
229
|
-
if (onDateHover && selectionState.isSelectingMode) onDateHover(null);
|
|
230
|
-
};
|
|
231
|
-
$[67] = onDateHover;
|
|
232
|
-
$[68] = selectionState.isSelectingMode;
|
|
233
|
-
$[69] = t8;
|
|
234
|
-
} else t8 = $[69];
|
|
235
|
-
const onMouseLeave = t8;
|
|
236
|
-
const { isSelectedCell: isSelectedCell_0, isInRange: isInRange_0, isHoverRange: isHoverRange_0, isSelectingMode: isSelectingMode_0, isSelectionStart: isSelectionStart_0, isSelectionEnd: isSelectionEnd_0 } = selectionState;
|
|
237
|
-
const t9 = !isSelectedCell_0 && !isOutsideVisibleRange && "bg-elevation-fill-default-1 text-interactive-text-secondary-idle";
|
|
238
|
-
const t10 = !isSelectedCell_0 && isOutsideVisibleRange && "bg-elevation-fill-default-1 text-interactive-text-secondary-disabled";
|
|
239
|
-
const t11 = isSelectedCell_0 && !isOutsideVisibleRange && "bg-interactive-contained-primary-idle text-interactive-contained-primary-on-idle";
|
|
240
|
-
const t12 = isSelectedCell_0 && !isOutsideVisibleRange && rangeSelection && !rangeSelection.isSelecting && isSelectionStart_0 && !isSelectionEnd_0 && "rounded-r-none";
|
|
241
|
-
const t13 = isSelectedCell_0 && !isOutsideVisibleRange && rangeSelection && !rangeSelection.isSelecting && isSelectionEnd_0 && !isSelectionStart_0 && "rounded-l-none";
|
|
242
|
-
const t14 = isDisabled && !isOutsideVisibleRange && "cursor-default";
|
|
243
|
-
const t15 = isDisabled && "opacity-20";
|
|
244
|
-
const t16 = !isSelectedCell_0 && !isInRange_0 && !isHoverRange_0 && !isSelectingMode_0 && !isDisabled && !isOutsideVisibleRange && "[@media(pointer:fine)]:hover:border-elevation-outline-default-1 [@media(pointer:fine)]:hover:text-interactive-text-secondary-hover";
|
|
245
|
-
const t17 = isInRange_0 && !isOutsideVisibleRange && "!rounded-none !bg-elevation-fill-default-2 text-interactive-text-secondary-hover";
|
|
246
|
-
const t18 = isHoverRange_0 && !isOutsideVisibleRange && "!rounded-none !bg-elevation-fill-default-2 text-interactive-text-secondary-hover";
|
|
247
|
-
const t19 = !isInRange_0 && !isSelectedCell_0 && isSelectingMode_0 && "hover:bg-interactive-contained-primary-idle hover:text-interactive-text-primary-idle-inverted";
|
|
248
|
-
const t20 = isSelectingMode_0 && !isSelectedCell_0 && !isInRange_0 && !isHoverRange_0 && !isDisabled && !isOutsideVisibleRange && "transition-all duration-75 hover:border-elevation-outline-default-1";
|
|
249
|
-
const t21 = isFocused && !isSelectedCell_0 && !isDisabled && !isOutsideVisibleRange && "ring-2 ring-inset ring-interactive-contained-primary-focus";
|
|
250
|
-
let t22;
|
|
251
|
-
if ($[70] !== t10 || $[71] !== t11 || $[72] !== t12 || $[73] !== t13 || $[74] !== t14 || $[75] !== t15 || $[76] !== t16 || $[77] !== t17 || $[78] !== t18 || $[79] !== t19 || $[80] !== t20 || $[81] !== t21 || $[82] !== t9) {
|
|
252
|
-
t22 = clsx("mx-auto flex h-10 w-full max-w-10 items-center justify-center rounded-button-rounding-m p-2", "focus:outline-none focus-visible:outline-1 focus-visible:outline-interactive-contained-primary-focus focus-visible:outline-offset-1", "border border-transparent border-solid", t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21);
|
|
253
|
-
$[70] = t10;
|
|
254
|
-
$[71] = t11;
|
|
255
|
-
$[72] = t12;
|
|
256
|
-
$[73] = t13;
|
|
257
|
-
$[74] = t14;
|
|
258
|
-
$[75] = t15;
|
|
259
|
-
$[76] = t16;
|
|
260
|
-
$[77] = t17;
|
|
261
|
-
$[78] = t18;
|
|
262
|
-
$[79] = t19;
|
|
263
|
-
$[80] = t20;
|
|
264
|
-
$[81] = t21;
|
|
265
|
-
$[82] = t9;
|
|
266
|
-
$[83] = t22;
|
|
267
|
-
} else t22 = $[83];
|
|
268
|
-
const cellClassName = t22;
|
|
269
|
-
let t23;
|
|
270
|
-
if ($[84] !== buttonProps || $[85] !== focusProps) {
|
|
271
|
-
t23 = mergeProps(buttonProps, focusProps);
|
|
272
|
-
$[84] = buttonProps;
|
|
273
|
-
$[85] = focusProps;
|
|
274
|
-
$[86] = t23;
|
|
275
|
-
} else t23 = $[86];
|
|
276
|
-
let t24;
|
|
277
|
-
if ($[87] !== handleEvent || $[88] !== onClick) {
|
|
278
|
-
t24 = (e) => handleEvent(e, onClick);
|
|
279
|
-
$[87] = handleEvent;
|
|
280
|
-
$[88] = onClick;
|
|
281
|
-
$[89] = t24;
|
|
282
|
-
} else t24 = $[89];
|
|
283
|
-
let t25;
|
|
284
|
-
if ($[90] !== handleEvent || $[91] !== onKeyboardNavigation || $[92] !== props.date) {
|
|
285
|
-
t25 = (e_0) => handleEvent(e_0, () => onKeyboardNavigation?.(e_0, props.date));
|
|
286
|
-
$[90] = handleEvent;
|
|
287
|
-
$[91] = onKeyboardNavigation;
|
|
288
|
-
$[92] = props.date;
|
|
289
|
-
$[93] = t25;
|
|
290
|
-
} else t25 = $[93];
|
|
291
|
-
let t26;
|
|
292
|
-
if ($[94] !== formattedDate) {
|
|
293
|
-
t26 = /* @__PURE__ */ jsx(Typography, {
|
|
294
|
-
as: "span",
|
|
295
|
-
size: "label-2",
|
|
296
|
-
className: "block w-6 overflow-hidden text-ellipsis text-center",
|
|
297
|
-
children: formattedDate
|
|
298
|
-
});
|
|
299
|
-
$[94] = formattedDate;
|
|
300
|
-
$[95] = t26;
|
|
301
|
-
} else t26 = $[95];
|
|
302
|
-
let t27;
|
|
303
|
-
if ($[96] !== cellClassName || $[97] !== onDoubleClick || $[98] !== onMouseEnter || $[99] !== onMouseLeave || $[100] !== t23 || $[101] !== t24 || $[102] !== t25 || $[103] !== t26) {
|
|
304
|
-
t27 = /* @__PURE__ */ jsx("div", {
|
|
77
|
+
}, [
|
|
78
|
+
props.date,
|
|
79
|
+
rangeSelection,
|
|
80
|
+
state,
|
|
81
|
+
isSelected,
|
|
82
|
+
hoverDate
|
|
83
|
+
]);
|
|
84
|
+
const handleEvent = (event, eventHandler) => {
|
|
85
|
+
if (isOutsideVisibleRange) {
|
|
86
|
+
state.selectDate(props.date);
|
|
87
|
+
state.setFocusedDate(props.date);
|
|
88
|
+
}
|
|
89
|
+
eventHandler?.(event);
|
|
90
|
+
if (isSelected && shouldCloseOnSelect) onApply?.();
|
|
91
|
+
};
|
|
92
|
+
const onMouseEnter = useCallback(() => {
|
|
93
|
+
if (onDateHover && selectionState.isSelectingMode) onDateHover(props.date);
|
|
94
|
+
}, [
|
|
95
|
+
onDateHover,
|
|
96
|
+
selectionState.isSelectingMode,
|
|
97
|
+
props.date
|
|
98
|
+
]);
|
|
99
|
+
const onMouseLeave = useCallback(() => {
|
|
100
|
+
if (onDateHover && selectionState.isSelectingMode) onDateHover(null);
|
|
101
|
+
}, [onDateHover, selectionState.isSelectingMode]);
|
|
102
|
+
const cellClassName = useMemo(() => {
|
|
103
|
+
const { isSelectedCell, isInRange, isHoverRange, isSelectingMode, isSelectionStart, isSelectionEnd } = selectionState;
|
|
104
|
+
return clsx("mx-auto flex h-10 w-full max-w-10 items-center justify-center rounded-button-rounding-m p-2", "focus:outline-none focus-visible:outline-1 focus-visible:outline-interactive-contained-primary-focus focus-visible:outline-offset-1", "border border-transparent border-solid", !isSelectedCell && !isOutsideVisibleRange && "bg-elevation-fill-default-1 text-interactive-text-secondary-idle", !isSelectedCell && isOutsideVisibleRange && "bg-elevation-fill-default-1 text-interactive-text-secondary-disabled", isSelectedCell && !isOutsideVisibleRange && "bg-interactive-contained-primary-idle text-interactive-contained-primary-on-idle", isSelectedCell && !isOutsideVisibleRange && rangeSelection && !rangeSelection.isSelecting && isSelectionStart && !isSelectionEnd && "rounded-r-none", isSelectedCell && !isOutsideVisibleRange && rangeSelection && !rangeSelection.isSelecting && isSelectionEnd && !isSelectionStart && "rounded-l-none", isDisabled && !isOutsideVisibleRange && "cursor-default", isDisabled && "opacity-20", !isSelectedCell && !isInRange && !isHoverRange && !isSelectingMode && !isDisabled && !isOutsideVisibleRange && "[@media(pointer:fine)]:hover:border-elevation-outline-default-1 [@media(pointer:fine)]:hover:text-interactive-text-secondary-hover", isInRange && !isOutsideVisibleRange && "!rounded-none !bg-elevation-fill-default-2 text-interactive-text-secondary-hover", isHoverRange && !isOutsideVisibleRange && "!rounded-none !bg-elevation-fill-default-2 text-interactive-text-secondary-hover", !isInRange && !isSelectedCell && isSelectingMode && "hover:bg-interactive-contained-primary-idle hover:text-interactive-text-primary-idle-inverted", isSelectingMode && !isSelectedCell && !isInRange && !isHoverRange && !isDisabled && !isOutsideVisibleRange && "transition-all duration-75 hover:border-elevation-outline-default-1");
|
|
105
|
+
}, [
|
|
106
|
+
selectionState,
|
|
107
|
+
isOutsideVisibleRange,
|
|
108
|
+
rangeSelection,
|
|
109
|
+
isDisabled
|
|
110
|
+
]);
|
|
111
|
+
return /* @__PURE__ */ jsx("td", {
|
|
112
|
+
...cellProps,
|
|
113
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
305
114
|
ref,
|
|
306
|
-
...
|
|
115
|
+
...mergeProps(buttonProps, focusProps),
|
|
307
116
|
"aria-disabled": void 0,
|
|
308
117
|
onMouseEnter,
|
|
309
118
|
onMouseLeave,
|
|
310
119
|
className: cellClassName,
|
|
311
|
-
onClick:
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
$[101] = t24;
|
|
322
|
-
$[102] = t25;
|
|
323
|
-
$[103] = t26;
|
|
324
|
-
$[104] = t27;
|
|
325
|
-
} else t27 = $[104];
|
|
326
|
-
let t28;
|
|
327
|
-
if ($[105] !== cellProps || $[106] !== t27) {
|
|
328
|
-
t28 = /* @__PURE__ */ jsx("td", {
|
|
329
|
-
...cellProps,
|
|
330
|
-
children: t27
|
|
331
|
-
});
|
|
332
|
-
$[105] = cellProps;
|
|
333
|
-
$[106] = t27;
|
|
334
|
-
$[107] = t28;
|
|
335
|
-
} else t28 = $[107];
|
|
336
|
-
return t28;
|
|
120
|
+
onClick: (e) => handleEvent(e, onClick),
|
|
121
|
+
onKeyDown: (e) => handleEvent(e, () => onKeyboardNavigation?.(e, props.date)),
|
|
122
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
123
|
+
as: "span",
|
|
124
|
+
size: "label-2",
|
|
125
|
+
className: "block w-6 overflow-hidden text-ellipsis text-center",
|
|
126
|
+
children: formattedDate
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
});
|
|
337
130
|
};
|
|
338
131
|
//#endregion
|
|
339
132
|
export { CalendarCell };
|
|
@@ -4,9 +4,7 @@ import { KeyboardEvent } from 'react';
|
|
|
4
4
|
import { DateValue } from 'react-aria';
|
|
5
5
|
interface CalendarGridProps extends AriaCalendarGridProps {
|
|
6
6
|
state: CalendarState | RangeCalendarState;
|
|
7
|
-
onApply?: (
|
|
8
|
-
onDoubleClickApply?: (selectedDate?: DateValue) => void;
|
|
9
|
-
shouldApplyOnDateSelection?: boolean;
|
|
7
|
+
onApply?: () => void;
|
|
10
8
|
offset?: {
|
|
11
9
|
months?: number;
|
|
12
10
|
};
|
|
@@ -23,5 +21,5 @@ interface CalendarGridProps extends AriaCalendarGridProps {
|
|
|
23
21
|
onKeyboardNavigation?: (event: KeyboardEvent, date: DateValue) => boolean;
|
|
24
22
|
calendarSide?: "left" | "right";
|
|
25
23
|
}
|
|
26
|
-
export declare const CalendarGrid: ({ state, onApply,
|
|
24
|
+
export declare const CalendarGrid: ({ state, onApply, shouldCloseOnSelect, offset, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, className, calendarSide, ...props }: CalendarGridProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
25
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
2
2
|
import { CalendarCell } from "./CalendarCell.js";
|
|
3
|
-
import { c } from "react/compiler-runtime";
|
|
4
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import { clsx } from "clsx";
|
|
6
5
|
import { useCalendarGrid } from "@react-aria/calendar";
|
|
@@ -13,157 +12,41 @@ var WEEK_INDICES = [
|
|
|
13
12
|
4,
|
|
14
13
|
5
|
|
15
14
|
];
|
|
16
|
-
var CalendarGrid = (
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let onApply;
|
|
22
|
-
let onDateHover;
|
|
23
|
-
let onDateSelection;
|
|
24
|
-
let onDoubleClickApply;
|
|
25
|
-
let onKeyboardNavigation;
|
|
26
|
-
let props;
|
|
27
|
-
let rangeSelection;
|
|
28
|
-
let shouldApplyOnDateSelection;
|
|
29
|
-
let shouldCloseOnSelect;
|
|
30
|
-
let state;
|
|
31
|
-
let t1;
|
|
32
|
-
if ($[0] !== t0) {
|
|
33
|
-
({state, onApply, onDoubleClickApply, shouldApplyOnDateSelection, shouldCloseOnSelect, offset: t1, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, className, calendarSide, ...props} = t0);
|
|
34
|
-
$[0] = t0;
|
|
35
|
-
$[1] = calendarSide;
|
|
36
|
-
$[2] = className;
|
|
37
|
-
$[3] = hoverDate;
|
|
38
|
-
$[4] = onApply;
|
|
39
|
-
$[5] = onDateHover;
|
|
40
|
-
$[6] = onDateSelection;
|
|
41
|
-
$[7] = onDoubleClickApply;
|
|
42
|
-
$[8] = onKeyboardNavigation;
|
|
43
|
-
$[9] = props;
|
|
44
|
-
$[10] = rangeSelection;
|
|
45
|
-
$[11] = shouldApplyOnDateSelection;
|
|
46
|
-
$[12] = shouldCloseOnSelect;
|
|
47
|
-
$[13] = state;
|
|
48
|
-
$[14] = t1;
|
|
49
|
-
} else {
|
|
50
|
-
calendarSide = $[1];
|
|
51
|
-
className = $[2];
|
|
52
|
-
hoverDate = $[3];
|
|
53
|
-
onApply = $[4];
|
|
54
|
-
onDateHover = $[5];
|
|
55
|
-
onDateSelection = $[6];
|
|
56
|
-
onDoubleClickApply = $[7];
|
|
57
|
-
onKeyboardNavigation = $[8];
|
|
58
|
-
props = $[9];
|
|
59
|
-
rangeSelection = $[10];
|
|
60
|
-
shouldApplyOnDateSelection = $[11];
|
|
61
|
-
shouldCloseOnSelect = $[12];
|
|
62
|
-
state = $[13];
|
|
63
|
-
t1 = $[14];
|
|
64
|
-
}
|
|
65
|
-
const offset = t1 === void 0 ? {} : t1;
|
|
66
|
-
let t2;
|
|
67
|
-
if ($[15] !== props) {
|
|
68
|
-
t2 = {
|
|
69
|
-
...props,
|
|
70
|
-
weekdayStyle: "short"
|
|
71
|
-
};
|
|
72
|
-
$[15] = props;
|
|
73
|
-
$[16] = t2;
|
|
74
|
-
} else t2 = $[16];
|
|
75
|
-
const { gridProps, headerProps, weekDays } = useCalendarGrid(t2, state);
|
|
15
|
+
var CalendarGrid = ({ state, onApply, shouldCloseOnSelect, offset = {}, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, className, calendarSide, ...props }) => {
|
|
16
|
+
const { gridProps, headerProps, weekDays } = useCalendarGrid({
|
|
17
|
+
...props,
|
|
18
|
+
weekdayStyle: "short"
|
|
19
|
+
}, state);
|
|
76
20
|
const startDate = state.visibleRange.start.add(offset);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
$[18] = onDateSelection;
|
|
84
|
-
$[19] = t3;
|
|
85
|
-
} else t3 = $[19];
|
|
86
|
-
const handleDateSelection = t3;
|
|
87
|
-
let t4;
|
|
88
|
-
if ($[20] !== className) {
|
|
89
|
-
t4 = clsx("h-72 w-full px-3 py-1 md:w-80", className);
|
|
90
|
-
$[20] = className;
|
|
91
|
-
$[21] = t4;
|
|
92
|
-
} else t4 = $[21];
|
|
93
|
-
const t5 = "0";
|
|
94
|
-
const t6 = "w-full";
|
|
95
|
-
let t7;
|
|
96
|
-
if ($[22] !== weekDays) {
|
|
97
|
-
t7 = weekDays.map(_temp);
|
|
98
|
-
$[22] = weekDays;
|
|
99
|
-
$[23] = t7;
|
|
100
|
-
} else t7 = $[23];
|
|
101
|
-
let t8;
|
|
102
|
-
if ($[24] !== t7) {
|
|
103
|
-
t8 = /* @__PURE__ */ jsx("tr", { children: t7 });
|
|
104
|
-
$[24] = t7;
|
|
105
|
-
$[25] = t8;
|
|
106
|
-
} else t8 = $[25];
|
|
107
|
-
let t9;
|
|
108
|
-
if ($[26] !== headerProps || $[27] !== t8) {
|
|
109
|
-
t9 = /* @__PURE__ */ jsx("thead", {
|
|
110
|
-
...headerProps,
|
|
111
|
-
children: t8
|
|
112
|
-
});
|
|
113
|
-
$[26] = headerProps;
|
|
114
|
-
$[27] = t8;
|
|
115
|
-
$[28] = t9;
|
|
116
|
-
} else t9 = $[28];
|
|
117
|
-
const t10 = WEEK_INDICES.map((weekIndex) => /* @__PURE__ */ jsx("tr", { children: state.getDatesInWeek(weekIndex, startDate).map((date_0, i) => date_0 ? /* @__PURE__ */ jsx(CalendarCell, {
|
|
118
|
-
state,
|
|
119
|
-
date: date_0,
|
|
120
|
-
onApply,
|
|
121
|
-
onDoubleClickApply,
|
|
122
|
-
shouldApplyOnDateSelection,
|
|
123
|
-
shouldCloseOnSelect,
|
|
124
|
-
onDateSelection: handleDateSelection,
|
|
125
|
-
onDateHover,
|
|
126
|
-
rangeSelection,
|
|
127
|
-
hoverDate,
|
|
128
|
-
onKeyboardNavigation
|
|
129
|
-
}, i) : /* @__PURE__ */ jsx("td", {}, i)) }, weekIndex));
|
|
130
|
-
let t11;
|
|
131
|
-
if ($[29] !== t10) {
|
|
132
|
-
t11 = /* @__PURE__ */ jsx("tbody", { children: t10 });
|
|
133
|
-
$[29] = t10;
|
|
134
|
-
$[30] = t11;
|
|
135
|
-
} else t11 = $[30];
|
|
136
|
-
let t12;
|
|
137
|
-
if ($[31] !== gridProps || $[32] !== t11 || $[33] !== t9) {
|
|
138
|
-
t12 = /* @__PURE__ */ jsxs("table", {
|
|
21
|
+
const handleDateSelection = (date) => {
|
|
22
|
+
onDateSelection?.(date, calendarSide);
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: clsx("h-72 w-full px-3 py-1 md:w-80", className),
|
|
26
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
139
27
|
...gridProps,
|
|
140
|
-
cellPadding:
|
|
141
|
-
className:
|
|
142
|
-
children: [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
28
|
+
cellPadding: "0",
|
|
29
|
+
className: "w-full",
|
|
30
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
31
|
+
...headerProps,
|
|
32
|
+
children: /* @__PURE__ */ jsx("tr", { children: weekDays.map((day) => /* @__PURE__ */ jsx("th", { children: /* @__PURE__ */ jsx(Typography, {
|
|
33
|
+
size: "label-2",
|
|
34
|
+
className: "bg-elevation-fill-default-1 py-2 text-interactive-text-secondary-idle",
|
|
35
|
+
children: day.substring(0, 2)
|
|
36
|
+
}) }, day)) })
|
|
37
|
+
}), /* @__PURE__ */ jsx("tbody", { children: WEEK_INDICES.map((weekIndex) => /* @__PURE__ */ jsx("tr", { children: state.getDatesInWeek(weekIndex, startDate).map((date, i) => date ? /* @__PURE__ */ jsx(CalendarCell, {
|
|
38
|
+
state,
|
|
39
|
+
date,
|
|
40
|
+
onApply,
|
|
41
|
+
shouldCloseOnSelect,
|
|
42
|
+
onDateSelection: handleDateSelection,
|
|
43
|
+
onDateHover,
|
|
44
|
+
rangeSelection,
|
|
45
|
+
hoverDate,
|
|
46
|
+
onKeyboardNavigation
|
|
47
|
+
}, i) : /* @__PURE__ */ jsx("td", {}, i)) }, weekIndex)) })]
|
|
48
|
+
})
|
|
49
|
+
});
|
|
160
50
|
};
|
|
161
|
-
function _temp(day) {
|
|
162
|
-
return /* @__PURE__ */ jsx("th", { children: /* @__PURE__ */ jsx(Typography, {
|
|
163
|
-
size: "label-2",
|
|
164
|
-
className: "bg-elevation-fill-default-1 py-2 text-interactive-text-secondary-idle",
|
|
165
|
-
children: day.substring(0, 2)
|
|
166
|
-
}) }, day);
|
|
167
|
-
}
|
|
168
51
|
//#endregion
|
|
169
52
|
export { CalendarGrid };
|