@astryxdesign/core 0.7.8 → 0.7.9-canary.07992bb
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/AppShell/observeMainOverflow.d.ts.map +1 -1
- package/dist/AppShell/observeMainOverflow.js +9 -6
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +5 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +40 -8
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +61 -21
- package/dist/Calendar/Calendar.d.ts +14 -2
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +63 -74
- package/dist/Calendar/getInitialFocusDate.d.ts +4 -1
- package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -1
- package/dist/Calendar/getInitialFocusDate.js +7 -5
- package/dist/Calendar/hooks/useCalendarDays.d.ts +19 -2
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +57 -64
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts +28 -3
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +33 -22
- package/dist/Calendar/styles.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +54 -11
- package/dist/ClickableCard/ClickableCard.d.ts +1 -1
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +5 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +4 -1
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +7 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +5 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +4 -1
- package/dist/Dialog/Dialog.d.ts +2 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +12 -1
- package/dist/Drawer/useDrawerDialogPresence.d.ts +2 -1
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +11 -2
- package/dist/DropdownMenu/DropdownMenu.d.ts +9 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +9 -4
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -2
- package/dist/Field/inputDisabledFocus.d.ts +4 -4
- package/dist/Field/inputStyles.stylex.d.ts +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +16 -2
- package/dist/HoverCard/useHoverCard.d.ts +3 -1
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/Icon/Icon.d.ts +1 -1
- package/dist/InfoTip/InfoTip.d.ts +1 -0
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +1 -0
- package/dist/InputGroup/InputGroup.d.ts +4 -3
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +2 -2
- package/dist/InputGroup/groupStyles.d.ts +1 -1
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +1 -1
- package/dist/Item/Item.d.ts +2 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +29 -6
- package/dist/Layer/holdEntranceInput.d.ts +24 -0
- package/dist/Layer/holdEntranceInput.d.ts.map +1 -0
- package/dist/Layer/holdEntranceInput.js +65 -0
- package/dist/Layer/inputHold.d.ts +49 -0
- package/dist/Layer/inputHold.d.ts.map +1 -0
- package/dist/Layer/inputHold.js +636 -0
- package/dist/Layer/preserveAnimations.d.ts +1 -5
- package/dist/Layer/preserveAnimations.d.ts.map +1 -1
- package/dist/Layer/preserveAnimations.js +12 -214
- package/dist/Layer/useLayer.d.ts +3 -1
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +64 -4
- package/dist/Layout/LayoutContent.d.ts +3 -1
- package/dist/Layout/LayoutContent.d.ts.map +1 -1
- package/dist/Layout/LayoutContent.js +12 -4
- package/dist/Layout/LayoutPanel.d.ts +4 -1
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.js +13 -4
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +4 -0
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/MobileNav/MobileNav.d.ts +11 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +39 -1
- package/dist/MoreMenu/MoreMenu.d.ts +5 -3
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.d.ts +4 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +244 -11
- package/dist/Popover/usePopover.d.ts +1 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +12 -5
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +4 -2
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +9 -3
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +14 -11
- package/dist/PowerSearch/formatTokenValue.d.ts +6 -2
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatTokenValue.js +6 -3
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +22 -4
- package/dist/SelectableCard/SelectableCard.d.ts +1 -1
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +5 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +14 -71
- package/dist/Spinner/index.d.ts +1 -1
- package/dist/Spinner/index.d.ts.map +1 -1
- package/dist/Spinner/spinnerRotor.d.ts +28 -0
- package/dist/Spinner/spinnerRotor.d.ts.map +1 -0
- package/dist/Spinner/spinnerRotor.js +98 -0
- package/dist/Stack/StackItem.d.ts +8 -4
- package/dist/Stack/StackItem.d.ts.map +1 -1
- package/dist/Stack/StackItem.js +17 -4
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +13 -10
- package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +14 -8
- package/dist/Timestamp/formatInstant.d.ts +10 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +13 -27
- package/dist/Timestamp/tooltipEntries.d.ts +5 -3
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +6 -4
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +9 -0
- package/dist/Token/TokenLink.d.ts +1 -1
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +4 -1
- package/dist/Tokenizer/Tokenizer.d.ts +14 -10
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +189 -89
- package/dist/Tooltip/useTooltip.d.ts +3 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +162 -59
- package/dist/TreeList/TreeListItem.d.ts +2 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +27 -3
- package/dist/astryx.css +45 -18
- package/dist/gestures/GestureHost.d.ts +2 -2
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +21 -6
- package/dist/gestures/PanGestureRecognizer.d.ts +11 -1
- package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PanGestureRecognizer.js +15 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +6 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.d.ts +3 -6
- package/dist/gestures/nativeScroll.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.js +7 -52
- package/dist/gestures/wheelSegmenter.d.ts +68 -1
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
- package/dist/gestures/wheelSegmenter.js +199 -10
- package/dist/hooks/StackItemScrollRegion.d.ts +31 -0
- package/dist/hooks/StackItemScrollRegion.d.ts.map +1 -0
- package/dist/hooks/StackItemScrollRegion.js +40 -0
- package/dist/hooks/menuPressGesture.d.ts +133 -21
- package/dist/hooks/menuPressGesture.d.ts.map +1 -1
- package/dist/hooks/menuPressGesture.js +155 -30
- package/dist/hooks/menuPressValues.d.ts +16 -0
- package/dist/hooks/menuPressValues.d.ts.map +1 -0
- package/dist/hooks/menuPressValues.js +18 -0
- package/dist/hooks/useClickableContainer.d.ts +27 -5
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +41 -5
- package/dist/hooks/useFocusTrap.d.ts +10 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +225 -132
- package/dist/hooks/useMenuPress.d.ts +34 -1
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +93 -5
- package/dist/hooks/usePressFeedback.d.ts +6 -6
- package/dist/hooks/usePressFeedback.js +6 -6
- package/dist/hooks/useScrollRegionProps.d.ts +35 -0
- package/dist/hooks/useScrollRegionProps.d.ts.map +1 -0
- package/dist/hooks/useScrollRegionProps.js +51 -0
- package/dist/i18n/InternationalizationContext.d.ts +6 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.d.ts +21 -3
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +8 -3
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts +8 -0
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.js +12 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/useCalendarSystem.d.ts +19 -0
- package/dist/i18n/useCalendarSystem.d.ts.map +1 -0
- package/dist/i18n/useCalendarSystem.js +61 -0
- package/dist/internal/spinner-rotor.d.ts +16 -0
- package/dist/internal/spinner-rotor.d.ts.map +1 -0
- package/dist/internal/spinner-rotor.js +16 -0
- package/dist/internal/touch.d.ts +14 -1
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +20 -2
- package/dist/motion/carryAnimations.d.ts +58 -0
- package/dist/motion/carryAnimations.d.ts.map +1 -0
- package/dist/motion/carryAnimations.js +305 -0
- package/dist/motion/transientCopy.d.ts +4 -2
- package/dist/motion/transientCopy.d.ts.map +1 -1
- package/dist/motion/transientCopy.js +34 -5
- package/dist/motion/uikit/gestures.d.ts +41 -0
- package/dist/motion/uikit/gestures.d.ts.map +1 -1
- package/dist/motion/uikit/gestures.js +25 -0
- package/dist/motion/uikit/index.d.ts +1 -1
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +1 -1
- package/dist/motion/uikit/timing.d.ts +14 -10
- package/dist/motion/uikit/timing.d.ts.map +1 -1
- package/dist/motion/uikit/timing.js +7 -5
- package/dist/privateAttributes/menuPressLit.stylex.d.ts +52 -0
- package/dist/privateAttributes/menuPressLit.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/menuPressLit.stylex.js +99 -0
- package/dist/privateAttributes/press.stylex.d.ts +139 -0
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/press.stylex.js +97 -0
- package/dist/theme/themeMotion.d.ts +3 -2
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +3 -2
- package/dist/theme/tokens.stylex.d.ts +2 -2
- package/dist/theme/tokens.stylex.js +1 -1
- package/dist/utils/calendarSystem.d.ts +114 -0
- package/dist/utils/calendarSystem.d.ts.map +1 -0
- package/dist/utils/calendarSystem.js +386 -0
- package/dist/utils/flatTree.d.ts +6 -3
- package/dist/utils/flatTree.d.ts.map +1 -1
- package/dist/utils/flatTree.js +13 -3
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +82 -5
- package/dist/utils/inputStream.d.ts +14 -1
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +40 -9
- package/dist/utils/interactionOverlay.stylex.d.ts +5 -9
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +29 -31
- package/dist/utils/plainDate.d.ts +23 -7
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +57 -18
- package/dist/utils/pressFeedback.d.ts +10 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +40 -15
- package/dist/utils/pressGesture.d.ts +12 -6
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +26 -8
- package/dist/utils/scrollView.d.ts +25 -0
- package/dist/utils/scrollView.d.ts.map +1 -0
- package/dist/utils/scrollView.js +108 -0
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +1 -10
- package/dist/utils/touchHitArea.stylex.d.ts +35 -0
- package/dist/utils/touchHitArea.stylex.d.ts.map +1 -0
- package/dist/utils/touchHitArea.stylex.js +32 -0
- package/dist/utils/triggerFocus.d.ts +5 -0
- package/dist/utils/triggerFocus.d.ts.map +1 -1
- package/dist/utils/triggerFocus.js +9 -2
- package/locales/en.json +4 -0
- package/locales/pseudo.json +3 -0
- package/package.json +10 -4
- package/src/AppShell/observeMainOverflow.ts +9 -6
- package/src/BottomSheet/BottomSheet.tsx +5 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +64 -7
- package/src/BottomSheet/useSheetGestures.ts +83 -20
- package/src/Calendar/Calendar.doc.mjs +76 -6
- package/src/Calendar/Calendar.tsx +123 -104
- package/src/Calendar/getInitialFocusDate.ts +22 -8
- package/src/Calendar/hooks/useCalendarDays.ts +89 -63
- package/src/Calendar/hooks/useCalendarNavigation.ts +68 -26
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -2
- package/src/CheckboxInput/CheckboxInput.tsx +71 -9
- package/src/ClickableCard/ClickableCard.tsx +8 -1
- package/src/DateInput/DateInput.tsx +2 -0
- package/src/DateInput/PickerWheel.tsx +7 -2
- package/src/DateRangeInput/DateRangeInput.tsx +3 -1
- package/src/DateTimeInput/DateTimeInput.tsx +2 -0
- package/src/Dialog/Dialog.doc.mjs +1 -1
- package/src/Dialog/Dialog.tsx +12 -1
- package/src/Drawer/Drawer.doc.mjs +1 -1
- package/src/Drawer/useDrawerDialogPresence.ts +9 -2
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -2
- package/src/DropdownMenu/DropdownMenu.tsx +29 -5
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -1
- package/src/DropdownMenu/DropdownMenuItem.tsx +8 -4
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -1
- package/src/FileInput/FileInput.tsx +16 -2
- package/src/HoverCard/useHoverCard.tsx +3 -1
- package/src/InfoTip/InfoTip.doc.mjs +26 -2
- package/src/InfoTip/InfoTip.tsx +1 -0
- package/src/InputGroup/InputGroup.doc.mjs +4 -3
- package/src/InputGroup/InputGroup.tsx +4 -3
- package/src/InputGroup/groupStyles.ts +3 -1
- package/src/Item/Item.tsx +51 -9
- package/src/Layer/holdEntranceInput.ts +84 -0
- package/src/Layer/inputHold.ts +734 -0
- package/src/Layer/preserveAnimations.ts +12 -275
- package/src/Layer/useLayer.tsx +77 -4
- package/src/Layout/LayoutContent.doc.mjs +6 -3
- package/src/Layout/LayoutContent.tsx +10 -4
- package/src/Layout/LayoutPanel.doc.mjs +6 -3
- package/src/Layout/LayoutPanel.tsx +11 -4
- package/src/Lightbox/Lightbox.tsx +4 -0
- package/src/MetadataList/MetadataList.tsx +1 -1
- package/src/MobileNav/MobileNav.doc.mjs +3 -3
- package/src/MobileNav/MobileNav.tsx +39 -1
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -4
- package/src/MoreMenu/MoreMenu.tsx +5 -3
- package/src/NumberInput/NumberInput.doc.mjs +1 -1
- package/src/NumberInput/NumberInput.tsx +259 -11
- package/src/Popover/usePopover.tsx +1 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
- package/src/PowerSearch/PowerSearch.tsx +20 -3
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +4 -1
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -11
- package/src/PowerSearch/formatTokenValue.ts +7 -1
- package/src/RadioList/RadioListItem.doc.mjs +3 -2
- package/src/RadioList/RadioListItem.tsx +25 -7
- package/src/SelectableCard/SelectableCard.tsx +8 -1
- package/src/Spinner/Spinner.tsx +7 -89
- package/src/Spinner/index.ts +1 -5
- package/src/Spinner/spinnerRotor.ts +113 -0
- package/src/Stack/Stack.doc.mjs +1 -1
- package/src/Stack/StackItem.tsx +27 -13
- package/src/Switch/Switch.tsx +7 -6
- package/src/Table/plugins/sortable/useTableSortable.tsx +1 -1
- package/src/Timestamp/Timestamp.doc.mjs +3 -3
- package/src/Timestamp/Timestamp.tsx +13 -8
- package/src/Timestamp/formatInstant.ts +49 -28
- package/src/Timestamp/tooltipEntries.ts +7 -3
- package/src/Token/Token.tsx +18 -1
- package/src/Token/TokenLink.tsx +7 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +3 -3
- package/src/Tokenizer/Tokenizer.tsx +252 -115
- package/src/Tooltip/useTooltip.tsx +178 -80
- package/src/TreeList/TreeListItem.tsx +36 -2
- package/src/gestures/GestureHost.ts +21 -5
- package/src/gestures/PanGestureRecognizer.ts +19 -2
- package/src/gestures/README.md +14 -5
- package/src/gestures/ScreenEdgePanGestureRecognizer.ts +6 -1
- package/src/gestures/nativeScroll.ts +12 -68
- package/src/gestures/wheelSegmenter.ts +243 -10
- package/src/hooks/StackItemScrollRegion.tsx +57 -0
- package/src/hooks/menuPressGesture.ts +244 -38
- package/src/hooks/menuPressValues.ts +18 -0
- package/src/hooks/useClickableContainer.doc.mjs +8 -2
- package/src/hooks/useClickableContainer.ts +72 -6
- package/src/hooks/useFocusTrap.ts +268 -151
- package/src/hooks/useMenuPress.ts +118 -11
- package/src/hooks/usePressFeedback.doc.mjs +3 -3
- package/src/hooks/usePressFeedback.ts +6 -6
- package/src/hooks/useScrollRegionProps.ts +76 -0
- package/src/i18n/InternationalizationContext.ts +6 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +29 -1
- package/src/i18n/InternationalizationProvider.tsx +33 -3
- package/src/i18n/generated-english/hooks/useScrollRegionProps.generated.ts +13 -0
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/useCalendarSystem.ts +95 -0
- package/src/internal/spinner-rotor.ts +20 -0
- package/src/internal/touch.ts +34 -1
- package/src/motion/MEASUREMENTS.md +11 -0
- package/src/motion/carryAnimations.ts +389 -0
- package/src/motion/transientCopy.ts +45 -5
- package/src/motion/uikit/gestures.ts +22 -0
- package/src/motion/uikit/index.ts +1 -0
- package/src/motion/uikit/timing.ts +7 -5
- package/src/privateAttributes/menuPressLit.stylex.ts +104 -0
- package/src/privateAttributes/press.stylex.ts +243 -0
- package/src/theme/themeMotion.ts +3 -2
- package/src/theme/tokens.stylex.ts +1 -1
- package/src/utils/calendarSystem.ts +548 -0
- package/src/utils/flatTree.ts +15 -3
- package/src/utils/hitArea.ts +107 -5
- package/src/utils/inputStream.ts +47 -10
- package/src/utils/interactionOverlay.stylex.ts +19 -22
- package/src/utils/plainDate.ts +84 -19
- package/src/utils/pressFeedback.ts +46 -14
- package/src/utils/pressGesture.ts +35 -9
- package/src/utils/scrollView.ts +135 -0
- package/src/utils/selectionLock.ts +5 -10
- package/src/utils/touchHitArea.stylex.ts +41 -0
- package/src/utils/triggerFocus.ts +17 -4
|
@@ -31,11 +31,8 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
31
31
|
import {Button} from '../Button';
|
|
32
32
|
import {Icon} from '../Icon';
|
|
33
33
|
import {useAnnounce, useGridFocus} from '../hooks';
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
useCalendarConstraints,
|
|
37
|
-
type CalendarDay,
|
|
38
|
-
} from './hooks';
|
|
34
|
+
import {useCalendarConstraints, type CalendarDay} from './hooks';
|
|
35
|
+
import {useCalendarDays} from './hooks/useCalendarDays';
|
|
39
36
|
import {
|
|
40
37
|
calendarStyles,
|
|
41
38
|
monthGridStyles,
|
|
@@ -48,23 +45,28 @@ import {
|
|
|
48
45
|
plainDateToISO,
|
|
49
46
|
plainDateToDate,
|
|
50
47
|
plainDateToday,
|
|
51
|
-
plainDateSetFirstOfMonth,
|
|
52
|
-
plainDateAddMonths,
|
|
53
48
|
plainDateAddDays,
|
|
54
49
|
plainDateDiffDays,
|
|
55
|
-
getDaysInMonth,
|
|
56
50
|
plainDateIsAfter,
|
|
57
51
|
plainDateIsBefore,
|
|
58
52
|
plainDateIsEqual,
|
|
59
53
|
plainDateGetWeekNumber,
|
|
60
|
-
plainDateFormat,
|
|
61
54
|
plainDateWeekFieldName,
|
|
55
|
+
plainDateFormatDayNumber,
|
|
62
56
|
DATE_FORMAT_WITH_WEEKDAY,
|
|
63
57
|
} from '../utils/plainDate';
|
|
64
58
|
import {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
type CalendarMonth,
|
|
60
|
+
type CalendarSystem,
|
|
61
|
+
calendarAddMonths,
|
|
62
|
+
calendarMonthOf,
|
|
63
|
+
calendarShiftMonths,
|
|
64
|
+
calendarShiftYears,
|
|
65
|
+
calendarYearMonthOf,
|
|
66
|
+
formatCalendarDate,
|
|
67
|
+
formatCalendarMonthLabel,
|
|
68
|
+
isInCalendarMonth,
|
|
69
|
+
} from '../utils/calendarSystem';
|
|
68
70
|
import {mergeProps, composeEventHandlers, rtlStyles} from '../utils';
|
|
69
71
|
import {focusOutlineProps} from '../utils/focusOutline.stylex';
|
|
70
72
|
import {interactionOverlayStyles} from '../utils/interactionOverlay.stylex';
|
|
@@ -99,6 +101,7 @@ import type {
|
|
|
99
101
|
import {normalizeDayOfWeek} from '../utils/dateTypes';
|
|
100
102
|
import {themeProps} from '../utils/themeProps';
|
|
101
103
|
import {useLocale} from '../i18n';
|
|
104
|
+
import {useCalendarSystem} from '../i18n/useCalendarSystem';
|
|
102
105
|
import {VisuallyHidden} from '../VisuallyHidden';
|
|
103
106
|
import {
|
|
104
107
|
registerEnglishFallback,
|
|
@@ -108,7 +111,7 @@ import english from '../i18n/generated-english/Calendar/Calendar.generated';
|
|
|
108
111
|
|
|
109
112
|
registerEnglishFallback(english);
|
|
110
113
|
|
|
111
|
-
/** How a month navigation moves the focused day: by its row offset in days, or by whole months or years. */
|
|
114
|
+
/** How a month navigation moves the focused day: by its row offset in days, or by whole calendar months or years. */
|
|
112
115
|
type NavigationUnit = 'days' | 'months' | 'years';
|
|
113
116
|
|
|
114
117
|
/** Imperative handle for Calendar handleRef */
|
|
@@ -181,13 +184,15 @@ interface CalendarBaseProps extends Omit<
|
|
|
181
184
|
hasOutsideDays?: boolean;
|
|
182
185
|
|
|
183
186
|
/**
|
|
184
|
-
* Show ISO week numbers in a side column.
|
|
187
|
+
* Show ISO 8601 week numbers in a side column. They are ISO 8601 week
|
|
188
|
+
* numbers in every calendar system.
|
|
185
189
|
* Default: false
|
|
186
190
|
*/
|
|
187
191
|
hasWeekNumbers?: boolean;
|
|
188
192
|
|
|
189
193
|
/**
|
|
190
|
-
*
|
|
194
|
+
* Give each month only the rows it needs instead of a fixed 6-row grid.
|
|
195
|
+
* The fixed grid keeps the same height from month to month.
|
|
191
196
|
* Default: false (fixed 6 rows for consistent height)
|
|
192
197
|
*/
|
|
193
198
|
hasVariableRowCount?: boolean;
|
|
@@ -198,6 +203,16 @@ interface CalendarBaseProps extends Omit<
|
|
|
198
203
|
* Default: 0 (Sunday)
|
|
199
204
|
*/
|
|
200
205
|
weekStartsOn?: DayOfWeek | DayOfWeekName;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The calendar system the grid shows, such as `'persian'` or `'hebrew'`.
|
|
209
|
+
* It sets the months, their labels, and month and year navigation. `value`,
|
|
210
|
+
* `min`, `max`, `focusDate`, and every callback stay Gregorian ISO dates.
|
|
211
|
+
* Default: the `InternationalizationProvider` calendar, else Gregorian.
|
|
212
|
+
* Calendars other than `gregory`, `iso8601`, `buddhist`, `roc`, and
|
|
213
|
+
* `japanese` need `Temporal`; without it the grid shows Gregorian months.
|
|
214
|
+
*/
|
|
215
|
+
calendar?: CalendarSystem;
|
|
201
216
|
}
|
|
202
217
|
|
|
203
218
|
// ─── Mode-specific Props (discriminated union) ────────────────
|
|
@@ -232,14 +247,12 @@ interface CalendarRangeProps extends CalendarBaseProps {
|
|
|
232
247
|
|
|
233
248
|
export type CalendarProps = CalendarSingleProps | CalendarRangeProps;
|
|
234
249
|
|
|
235
|
-
/** The first day of `month`'s month that `isDisabled` allows, or null. */
|
|
236
250
|
function firstEnabledDayOfMonth(
|
|
237
|
-
month:
|
|
251
|
+
month: CalendarMonth,
|
|
238
252
|
isDisabled: (pd: PlainDate) => boolean,
|
|
239
253
|
): PlainDate | null {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
const pd = {year: month.year, month: month.month, day};
|
|
254
|
+
for (let offset = 0; offset < month.length; offset += 1) {
|
|
255
|
+
const pd = plainDateAddDays(month.start, offset);
|
|
243
256
|
if (!isDisabled(pd)) {
|
|
244
257
|
return pd;
|
|
245
258
|
}
|
|
@@ -247,6 +260,15 @@ function firstEnabledDayOfMonth(
|
|
|
247
260
|
return null;
|
|
248
261
|
}
|
|
249
262
|
|
|
263
|
+
/** A day's full label, such as "Friday, Aban 8, 1405 AP", in the calendar. */
|
|
264
|
+
function formatDateLabel(
|
|
265
|
+
date: PlainDate,
|
|
266
|
+
calendar: CalendarSystem,
|
|
267
|
+
locale: string,
|
|
268
|
+
): string {
|
|
269
|
+
return formatCalendarDate(calendar, date, DATE_FORMAT_WITH_WEEKDAY, locale);
|
|
270
|
+
}
|
|
271
|
+
|
|
250
272
|
// =============================================================================
|
|
251
273
|
// Main Component
|
|
252
274
|
// =============================================================================
|
|
@@ -280,12 +302,14 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
280
302
|
hasWeekNumbers = false,
|
|
281
303
|
hasVariableRowCount = false,
|
|
282
304
|
weekStartsOn: weekStartsOnProp = 0,
|
|
305
|
+
calendar: calendarProp,
|
|
283
306
|
xstyle,
|
|
284
307
|
className,
|
|
285
308
|
style,
|
|
286
309
|
onKeyDown,
|
|
287
310
|
...rest
|
|
288
311
|
} = props;
|
|
312
|
+
const calendar = useCalendarSystem(calendarProp, 'Calendar');
|
|
289
313
|
|
|
290
314
|
// Normalize `weekStartsOn` (number or three-letter day name) to a numeric
|
|
291
315
|
// DayOfWeek so all downstream date math keeps working with an index.
|
|
@@ -329,6 +353,7 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
329
353
|
max,
|
|
330
354
|
numberOfMonths,
|
|
331
355
|
today,
|
|
356
|
+
calendar,
|
|
332
357
|
}),
|
|
333
358
|
);
|
|
334
359
|
|
|
@@ -354,17 +379,21 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
354
379
|
[isControlledFocus, onFocusDateChange],
|
|
355
380
|
);
|
|
356
381
|
|
|
357
|
-
//
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
382
|
+
// A controlled focus date is a new object on each render. Key the memo on
|
|
383
|
+
// its ISO string.
|
|
384
|
+
const focusIso = plainDateToISO(focusDate);
|
|
385
|
+
const baseMonth = useMemo(
|
|
386
|
+
() => calendarMonthOf(calendar, plainDateFromISO(focusIso)),
|
|
387
|
+
[calendar, focusIso],
|
|
388
|
+
);
|
|
361
389
|
|
|
362
390
|
// Generate visible months
|
|
363
391
|
const visibleMonths = useMemo(() => {
|
|
364
392
|
return Array.from({length: numberOfMonths}, (_, i) => {
|
|
365
|
-
return
|
|
393
|
+
return calendarAddMonths(calendar, baseMonth, i);
|
|
366
394
|
});
|
|
367
|
-
}, [baseMonth, numberOfMonths]);
|
|
395
|
+
}, [calendar, baseMonth, numberOfMonths]);
|
|
396
|
+
const lastVisibleMonth = visibleMonths[visibleMonths.length - 1];
|
|
368
397
|
|
|
369
398
|
// A pending target is claimed by the grid that shows its month, or dropped
|
|
370
399
|
// by the next focus move that is not onto the target day: when a controlled
|
|
@@ -378,9 +407,7 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
378
407
|
return null;
|
|
379
408
|
}
|
|
380
409
|
const target = plainDateFromISO(pendingFocus);
|
|
381
|
-
return visibleMonths.some(
|
|
382
|
-
pd => pd.year === target.year && pd.month === target.month,
|
|
383
|
-
)
|
|
410
|
+
return visibleMonths.some(month => isInCalendarMonth(target, month))
|
|
384
411
|
? pendingFocus
|
|
385
412
|
: null;
|
|
386
413
|
}, [pendingFocus, visibleMonths]);
|
|
@@ -405,9 +432,9 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
405
432
|
const monthYearLabel = useMemo(
|
|
406
433
|
() =>
|
|
407
434
|
visibleMonths
|
|
408
|
-
.map(m =>
|
|
435
|
+
.map(m => formatCalendarMonthLabel(calendar, m, locale))
|
|
409
436
|
.join(' – '),
|
|
410
|
-
[visibleMonths, locale],
|
|
437
|
+
[calendar, visibleMonths, locale],
|
|
411
438
|
);
|
|
412
439
|
|
|
413
440
|
// Announce the newly visible month to screen readers whenever it changes.
|
|
@@ -439,31 +466,13 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
439
466
|
[max],
|
|
440
467
|
);
|
|
441
468
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
minDate.year < baseMonth.year ||
|
|
450
|
-
(minDate.year === baseMonth.year && minDate.month < baseMonth.month)
|
|
451
|
-
);
|
|
452
|
-
}, [min, baseMonth]);
|
|
453
|
-
|
|
454
|
-
const canNavigateNext = useMemo(() => {
|
|
455
|
-
if (!max) {
|
|
456
|
-
return true;
|
|
457
|
-
}
|
|
458
|
-
const maxDate = plainDateFromISO(max);
|
|
459
|
-
// Check against the last visible month, not just baseMonth
|
|
460
|
-
const lastVisibleMonth = plainDateAddMonths(baseMonth, numberOfMonths - 1);
|
|
461
|
-
return (
|
|
462
|
-
maxDate.year > lastVisibleMonth.year ||
|
|
463
|
-
(maxDate.year === lastVisibleMonth.year &&
|
|
464
|
-
maxDate.month > lastVisibleMonth.month)
|
|
465
|
-
);
|
|
466
|
-
}, [max, baseMonth, numberOfMonths]);
|
|
469
|
+
// A month button is available while a day past the shown months is in range.
|
|
470
|
+
const canNavigatePrevious =
|
|
471
|
+
minDateForKeys == null ||
|
|
472
|
+
plainDateIsBefore(minDateForKeys, baseMonth.start);
|
|
473
|
+
const canNavigateNext =
|
|
474
|
+
maxDateForKeys == null ||
|
|
475
|
+
plainDateIsAfter(maxDateForKeys, lastVisibleMonth.end);
|
|
467
476
|
|
|
468
477
|
// Navigation handlers
|
|
469
478
|
// The same constraint view the grids use, so a key can resolve its target
|
|
@@ -491,10 +500,6 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
491
500
|
offset?: number,
|
|
492
501
|
unit: NavigationUnit = 'days',
|
|
493
502
|
) => {
|
|
494
|
-
const monthIndex = (pd: PlainDate) => pd.year * 12 + pd.month;
|
|
495
|
-
const firstShown = monthIndex(baseMonth);
|
|
496
|
-
const lastShown = firstShown + numberOfMonths - 1;
|
|
497
|
-
|
|
498
503
|
// The Previous/Next buttons move the month with no focused day.
|
|
499
504
|
if (!focusedDate) {
|
|
500
505
|
if (
|
|
@@ -503,7 +508,7 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
503
508
|
) {
|
|
504
509
|
return;
|
|
505
510
|
}
|
|
506
|
-
const newPd =
|
|
511
|
+
const newPd = calendarAddMonths(calendar, baseMonth, delta).start;
|
|
507
512
|
if (onFocusDateChange) {
|
|
508
513
|
onFocusDateChange(plainDateToISO(newPd));
|
|
509
514
|
} else {
|
|
@@ -523,19 +528,19 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
523
528
|
!(maxDateForKeys && plainDateIsAfter(pd, maxDateForKeys));
|
|
524
529
|
let targetPd: PlainDate;
|
|
525
530
|
if (unit === 'months' || unit === 'years') {
|
|
526
|
-
// A page or a year step keeps the day of the month and clamps
|
|
527
|
-
// target month's length. A month with no enabled day is no
|
|
528
|
-
// same as for an arrow.
|
|
529
|
-
const candidate =
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
531
|
+
// A page or a year step keeps the day of the calendar month and clamps
|
|
532
|
+
// it to the target month's length. A month with no enabled day is no
|
|
533
|
+
// target, the same as for an arrow.
|
|
534
|
+
const candidate =
|
|
535
|
+
unit === 'years'
|
|
536
|
+
? calendarShiftYears(calendar, currentPd, delta)
|
|
537
|
+
: calendarShiftMonths(calendar, currentPd, delta);
|
|
533
538
|
if (!inRange(candidate)) {
|
|
534
539
|
return;
|
|
535
540
|
}
|
|
536
541
|
if (isRootDateDisabled(candidate)) {
|
|
537
542
|
const firstEnabled = firstEnabledDayOfMonth(
|
|
538
|
-
candidate,
|
|
543
|
+
calendarMonthOf(calendar, candidate),
|
|
539
544
|
isRootDateDisabled,
|
|
540
545
|
);
|
|
541
546
|
if (firstEnabled == null) {
|
|
@@ -572,16 +577,15 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
572
577
|
// key's direction, so the target month becomes the first (backwards)
|
|
573
578
|
// or last (forwards) month shown.
|
|
574
579
|
const resolved: PlainDate = targetPd;
|
|
575
|
-
const targetMonth = monthIndex(resolved);
|
|
576
580
|
setPendingFocus(plainDateToISO(resolved));
|
|
577
|
-
|
|
581
|
+
const isBeforeShown = plainDateIsBefore(resolved, baseMonth.start);
|
|
582
|
+
if (!isBeforeShown && !plainDateIsAfter(resolved, lastVisibleMonth.end)) {
|
|
578
583
|
return;
|
|
579
584
|
}
|
|
580
|
-
const
|
|
581
|
-
const newPd =
|
|
582
|
-
targetMonth
|
|
583
|
-
|
|
584
|
-
: plainDateAddMonths(targetFirst, -(numberOfMonths - 1));
|
|
585
|
+
const targetMonth = calendarMonthOf(calendar, resolved);
|
|
586
|
+
const newPd = isBeforeShown
|
|
587
|
+
? targetMonth.start
|
|
588
|
+
: calendarAddMonths(calendar, targetMonth, -(numberOfMonths - 1)).start;
|
|
585
589
|
if (onFocusDateChange) {
|
|
586
590
|
onFocusDateChange(plainDateToISO(newPd));
|
|
587
591
|
} else {
|
|
@@ -590,9 +594,11 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
590
594
|
},
|
|
591
595
|
[
|
|
592
596
|
baseMonth,
|
|
597
|
+
calendar,
|
|
593
598
|
canNavigateNext,
|
|
594
599
|
canNavigatePrevious,
|
|
595
600
|
isRootDateDisabled,
|
|
601
|
+
lastVisibleMonth,
|
|
596
602
|
maxDateForKeys,
|
|
597
603
|
minDateForKeys,
|
|
598
604
|
numberOfMonths,
|
|
@@ -637,7 +643,7 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
637
643
|
setRangeSelectionStart(iso);
|
|
638
644
|
announce(
|
|
639
645
|
t('@astryx.calendar.rangeStartAnnounce', {
|
|
640
|
-
date:
|
|
646
|
+
date: formatDateLabel(date, calendar, locale),
|
|
641
647
|
}),
|
|
642
648
|
);
|
|
643
649
|
} else {
|
|
@@ -653,7 +659,7 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
653
659
|
setRangeSelectionStart(null);
|
|
654
660
|
announce(
|
|
655
661
|
t('@astryx.calendar.rangeClearedAnnounce', {
|
|
656
|
-
date:
|
|
662
|
+
date: formatDateLabel(date, calendar, locale),
|
|
657
663
|
}),
|
|
658
664
|
);
|
|
659
665
|
return;
|
|
@@ -679,22 +685,23 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
679
685
|
// swapped {start, end} above even for a reverse pick).
|
|
680
686
|
announce(
|
|
681
687
|
t('@astryx.calendar.rangeCompleteAnnounce', {
|
|
682
|
-
start:
|
|
683
|
-
|
|
684
|
-
DATE_FORMAT_WITH_WEEKDAY,
|
|
685
|
-
locale,
|
|
686
|
-
),
|
|
687
|
-
end: plainDateFormat(
|
|
688
|
-
plainDateFromISO(end),
|
|
689
|
-
DATE_FORMAT_WITH_WEEKDAY,
|
|
690
|
-
locale,
|
|
691
|
-
),
|
|
688
|
+
start: formatDateLabel(plainDateFromISO(start), calendar, locale),
|
|
689
|
+
end: formatDateLabel(plainDateFromISO(end), calendar, locale),
|
|
692
690
|
}),
|
|
693
691
|
);
|
|
694
692
|
}
|
|
695
693
|
}
|
|
696
694
|
},
|
|
697
|
-
[
|
|
695
|
+
[
|
|
696
|
+
mode,
|
|
697
|
+
onChange,
|
|
698
|
+
rangeSelectionStart,
|
|
699
|
+
minRangeSpan,
|
|
700
|
+
announce,
|
|
701
|
+
t,
|
|
702
|
+
locale,
|
|
703
|
+
calendar,
|
|
704
|
+
],
|
|
698
705
|
);
|
|
699
706
|
|
|
700
707
|
return (
|
|
@@ -756,8 +763,9 @@ export function Calendar({ref, ...props}: CalendarProps) {
|
|
|
756
763
|
<div {...stylex.props(calendarStyles.monthsContainer)}>
|
|
757
764
|
{visibleMonths.map(month => (
|
|
758
765
|
<MonthGrid
|
|
759
|
-
key={
|
|
766
|
+
key={plainDateToISO(month.start)}
|
|
760
767
|
month={month}
|
|
768
|
+
calendar={calendar}
|
|
761
769
|
value={effectiveValue}
|
|
762
770
|
mode={mode}
|
|
763
771
|
rangeSelectionStart={rangeSelectionStart}
|
|
@@ -798,7 +806,8 @@ Calendar.displayName = 'Calendar';
|
|
|
798
806
|
// =============================================================================
|
|
799
807
|
|
|
800
808
|
interface MonthGridProps {
|
|
801
|
-
month:
|
|
809
|
+
month: CalendarMonth;
|
|
810
|
+
calendar: CalendarSystem;
|
|
802
811
|
value: ISODateString | DateRange | undefined;
|
|
803
812
|
mode: 'single' | 'range';
|
|
804
813
|
rangeSelectionStart: ISODateString | null;
|
|
@@ -831,6 +840,7 @@ interface MonthGridProps {
|
|
|
831
840
|
|
|
832
841
|
function MonthGrid({
|
|
833
842
|
month,
|
|
843
|
+
calendar,
|
|
834
844
|
value,
|
|
835
845
|
mode,
|
|
836
846
|
rangeSelectionStart,
|
|
@@ -853,12 +863,16 @@ function MonthGrid({
|
|
|
853
863
|
onPendingFocusHandled,
|
|
854
864
|
}: MonthGridProps) {
|
|
855
865
|
const locale = useLocale();
|
|
856
|
-
const year = month.year;
|
|
857
866
|
|
|
858
867
|
// Use hooks for days generation and constraints
|
|
868
|
+
const yearMonth = useMemo(
|
|
869
|
+
() => calendarYearMonthOf(calendar, month),
|
|
870
|
+
[calendar, month],
|
|
871
|
+
);
|
|
859
872
|
const {days, weeks} = useCalendarDays({
|
|
860
|
-
year,
|
|
861
|
-
month:
|
|
873
|
+
year: yearMonth.year,
|
|
874
|
+
month: yearMonth.month,
|
|
875
|
+
calendar,
|
|
862
876
|
weekStartsOn,
|
|
863
877
|
hasVariableRowCount,
|
|
864
878
|
});
|
|
@@ -899,15 +913,16 @@ function MonthGrid({
|
|
|
899
913
|
// enabled) > today (if visible and enabled) > first enabled in-month day.
|
|
900
914
|
const seedTabbableIso = useMemo((): ISODateString | null => {
|
|
901
915
|
if (selectedDateForTabindex) {
|
|
902
|
-
const isSelectedInMonth =
|
|
903
|
-
selectedDateForTabindex
|
|
904
|
-
|
|
916
|
+
const isSelectedInMonth = isInCalendarMonth(
|
|
917
|
+
selectedDateForTabindex,
|
|
918
|
+
month,
|
|
919
|
+
);
|
|
905
920
|
if (isSelectedInMonth && !isDateDisabled(selectedDateForTabindex)) {
|
|
906
921
|
return plainDateToISO(selectedDateForTabindex);
|
|
907
922
|
}
|
|
908
923
|
}
|
|
909
924
|
|
|
910
|
-
const isTodayInMonth = today
|
|
925
|
+
const isTodayInMonth = isInCalendarMonth(today, month);
|
|
911
926
|
if (isTodayInMonth && !isDateDisabled(today)) {
|
|
912
927
|
return plainDateToISO(today);
|
|
913
928
|
}
|
|
@@ -919,7 +934,7 @@ function MonthGrid({
|
|
|
919
934
|
}
|
|
920
935
|
|
|
921
936
|
return null;
|
|
922
|
-
}, [days, today,
|
|
937
|
+
}, [days, today, month, isDateDisabled, selectedDateForTabindex]);
|
|
923
938
|
|
|
924
939
|
// Helper to get the focused date from the currently focused element.
|
|
925
940
|
// Reads the machine-readable `data-date` (ISO) attribute rather than parsing
|
|
@@ -1028,7 +1043,7 @@ function MonthGrid({
|
|
|
1028
1043
|
}
|
|
1029
1044
|
|
|
1030
1045
|
const targetPd = plainDateFromISO(pendingFocus);
|
|
1031
|
-
if (targetPd
|
|
1046
|
+
if (!isInCalendarMonth(targetPd, month)) {
|
|
1032
1047
|
return;
|
|
1033
1048
|
}
|
|
1034
1049
|
const targetIso = plainDateToISO(targetPd);
|
|
@@ -1063,7 +1078,7 @@ function MonthGrid({
|
|
|
1063
1078
|
targetButton.focus();
|
|
1064
1079
|
}
|
|
1065
1080
|
onPendingFocusHandled?.();
|
|
1066
|
-
}, [pendingFocus, gridRef, month
|
|
1081
|
+
}, [pendingFocus, gridRef, month, onPendingFocusHandled]);
|
|
1067
1082
|
|
|
1068
1083
|
// Parse selection
|
|
1069
1084
|
let selectedDate: PlainDate | null = null;
|
|
@@ -1103,8 +1118,8 @@ function MonthGrid({
|
|
|
1103
1118
|
|
|
1104
1119
|
// Month label for announcements
|
|
1105
1120
|
const monthLabel = useMemo(() => {
|
|
1106
|
-
return
|
|
1107
|
-
}, [month, locale]);
|
|
1121
|
+
return formatCalendarMonthLabel(calendar, month, locale);
|
|
1122
|
+
}, [calendar, month, locale]);
|
|
1108
1123
|
|
|
1109
1124
|
return (
|
|
1110
1125
|
<div {...stylex.props(monthGridStyles.monthGrid)}>
|
|
@@ -1198,6 +1213,7 @@ function MonthGrid({
|
|
|
1198
1213
|
neighbors={neighbors}
|
|
1199
1214
|
isTabbable={day.iso === seedTabbableIso}
|
|
1200
1215
|
isRangeSelectionInProgress={rangeSelectionStart !== null}
|
|
1216
|
+
calendar={calendar}
|
|
1201
1217
|
onDayClick={onDayClick}
|
|
1202
1218
|
onDayHover={onDayHover}
|
|
1203
1219
|
/>
|
|
@@ -1246,6 +1262,8 @@ interface DayCellProps {
|
|
|
1246
1262
|
* "range start and range end" (rangeStart === rangeEnd in both cases).
|
|
1247
1263
|
*/
|
|
1248
1264
|
isRangeSelectionInProgress: boolean;
|
|
1265
|
+
/** The calendar system that writes the day's accessible name. */
|
|
1266
|
+
calendar: CalendarSystem;
|
|
1249
1267
|
onDayClick: (date: PlainDate) => void;
|
|
1250
1268
|
onDayHover: (date: PlainDate | null) => void;
|
|
1251
1269
|
}
|
|
@@ -1265,6 +1283,7 @@ function DayCell({
|
|
|
1265
1283
|
neighbors,
|
|
1266
1284
|
isTabbable: isTabbableDay,
|
|
1267
1285
|
isRangeSelectionInProgress,
|
|
1286
|
+
calendar,
|
|
1268
1287
|
onDayClick,
|
|
1269
1288
|
onDayHover,
|
|
1270
1289
|
}: DayCellProps) {
|
|
@@ -1316,7 +1335,7 @@ function DayCell({
|
|
|
1316
1335
|
// params rather than string concatenation. A mid-flight first pick (where
|
|
1317
1336
|
// rangeStart === rangeEnd) reads as "range start" only; a completed one-day
|
|
1318
1337
|
// range reads as both start and end.
|
|
1319
|
-
const dateLabel =
|
|
1338
|
+
const dateLabel = formatDateLabel(date, calendar, locale);
|
|
1320
1339
|
const dayLabel = state.isSelected
|
|
1321
1340
|
? t('@astryx.calendar.daySelected', {date: dateLabel})
|
|
1322
1341
|
: state.isRangeStart && state.isRangeEnd
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file getInitialFocusDate.ts
|
|
5
|
-
* @input PlainDate utilities, min/max bounds, today
|
|
5
|
+
* @input PlainDate and calendar-system utilities, min/max bounds, today
|
|
6
6
|
* @output Exports getInitialFocusDate — the month Calendar opens on
|
|
7
7
|
* @position Calendar-specific helper; used by Calendar.tsx
|
|
8
8
|
*
|
|
@@ -15,11 +15,14 @@ import type {ISODateString, DateRange} from '../utils/dateTypes';
|
|
|
15
15
|
import {
|
|
16
16
|
type PlainDate,
|
|
17
17
|
plainDateFromISO,
|
|
18
|
-
plainDateSetFirstOfMonth,
|
|
19
|
-
plainDateAddMonths,
|
|
20
18
|
plainDateIsBefore,
|
|
21
19
|
plainDateIsAfter,
|
|
22
20
|
} from '../utils/plainDate';
|
|
21
|
+
import {
|
|
22
|
+
type CalendarSystem,
|
|
23
|
+
calendarAddMonths,
|
|
24
|
+
calendarMonthOf,
|
|
25
|
+
} from '../utils/calendarSystem';
|
|
23
26
|
|
|
24
27
|
export interface InitialFocusDateOptions {
|
|
25
28
|
/** Controlled visible month, if the consumer supplied one. */
|
|
@@ -34,6 +37,8 @@ export interface InitialFocusDateOptions {
|
|
|
34
37
|
numberOfMonths: number;
|
|
35
38
|
/** Today, injected so the caller keeps a single memoized source of "now". */
|
|
36
39
|
today: PlainDate;
|
|
40
|
+
/** The calendar system whose months the panes show. Default: `gregory`. */
|
|
41
|
+
calendar?: CalendarSystem;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
/**
|
|
@@ -57,7 +62,15 @@ export interface InitialFocusDateOptions {
|
|
|
57
62
|
export function getInitialFocusDate(
|
|
58
63
|
options: InitialFocusDateOptions,
|
|
59
64
|
): PlainDate {
|
|
60
|
-
const {
|
|
65
|
+
const {
|
|
66
|
+
focusDate,
|
|
67
|
+
value,
|
|
68
|
+
min,
|
|
69
|
+
max,
|
|
70
|
+
numberOfMonths,
|
|
71
|
+
today,
|
|
72
|
+
calendar = 'gregory',
|
|
73
|
+
} = options;
|
|
61
74
|
|
|
62
75
|
if (focusDate) {
|
|
63
76
|
return plainDateFromISO(focusDate);
|
|
@@ -76,13 +89,14 @@ export function getInitialFocusDate(
|
|
|
76
89
|
|
|
77
90
|
if (maxDate && plainDateIsAfter(today, maxDate)) {
|
|
78
91
|
const lastPaneOffset = Math.max(0, numberOfMonths - 1);
|
|
79
|
-
const shifted =
|
|
80
|
-
|
|
92
|
+
const shifted = calendarAddMonths(
|
|
93
|
+
calendar,
|
|
94
|
+
calendarMonthOf(calendar, maxDate),
|
|
81
95
|
-lastPaneOffset,
|
|
82
|
-
);
|
|
96
|
+
).start;
|
|
83
97
|
if (
|
|
84
98
|
minDate &&
|
|
85
|
-
plainDateIsBefore(shifted,
|
|
99
|
+
plainDateIsBefore(shifted, calendarMonthOf(calendar, minDate).start)
|
|
86
100
|
) {
|
|
87
101
|
return minDate;
|
|
88
102
|
}
|