@astryxdesign/core 0.7.8 → 0.7.9-canary.0200dfe
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 +37 -3
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +40 -8
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +4 -3
- 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 +2 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +74 -18
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts +2 -0
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts.map +1 -0
- package/dist/CheckboxInput/CheckboxRowPressContext.js +20 -0
- package/dist/CheckboxList/CheckboxListItem.d.ts +2 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +40 -14
- 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/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +2 -0
- package/dist/DateInput/DateInput.d.ts +37 -6
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +97 -124
- package/dist/DateInput/MonthScroller.d.ts +5 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +26 -29
- package/dist/DateInput/MonthYearWheels.d.ts +10 -1
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -1
- package/dist/DateInput/MonthYearWheels.js +54 -42
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +7 -1
- package/dist/DateInput/TouchDateField.d.ts +1 -1
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +26 -21
- package/dist/DateInput/monthGeometry.d.ts +42 -8
- package/dist/DateInput/monthGeometry.d.ts.map +1 -1
- package/dist/DateInput/monthGeometry.js +81 -7
- package/dist/DateInput/useCalendarPresentation.d.ts +10 -0
- package/dist/DateInput/useCalendarPresentation.d.ts.map +1 -0
- package/dist/DateInput/useCalendarPresentation.js +32 -0
- package/dist/DateInput/useTypedDate.d.ts +92 -0
- package/dist/DateInput/useTypedDate.d.ts.map +1 -0
- package/dist/DateInput/useTypedDate.js +269 -0
- package/dist/DateInput/wheelStrip.js +2 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts +17 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +15 -8
- package/dist/DateTimeInput/DateTimeInput.d.ts +26 -3
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +92 -88
- package/dist/DateTimeInput/TouchDateTimeField.d.ts +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +26 -20
- package/dist/Dialog/Dialog.d.ts +2 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +14 -3
- 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 +11 -8
- 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 +6 -18
- 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/InputGroupText.d.ts +2 -1
- package/dist/InputGroup/InputGroupText.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupText.js +2 -1
- 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 +20 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +97 -29
- package/dist/Item/ItemListRowContext.d.ts +2 -0
- package/dist/Item/ItemListRowContext.d.ts.map +1 -0
- package/dist/Item/ItemListRowContext.js +16 -0
- 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/outsidePress.d.ts +4 -0
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +18 -1
- 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/useBackdropPress.d.ts +8 -0
- package/dist/Layer/useBackdropPress.d.ts.map +1 -1
- package/dist/Layer/useBackdropPress.js +31 -2
- 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/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +4 -0
- 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 +13 -10
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.js +81 -11
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +4 -0
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +1 -0
- package/dist/List/ListItem.d.ts +5 -4
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +45 -9
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +56 -39
- 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/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +6 -9
- 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/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +7 -2
- 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 +16 -3
- package/dist/Resizable/ResizeHandle.d.ts +5 -5
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +44 -5
- package/dist/Resizable/resizablePane.d.ts +58 -0
- package/dist/Resizable/resizablePane.d.ts.map +1 -0
- package/dist/Resizable/resizablePane.js +137 -0
- package/dist/Resizable/useResizable.d.ts +7 -0
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +13 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- 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/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +51 -10
- package/dist/SideNav/SideNav.d.ts +9 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +45 -10
- package/dist/Slider/sliderTouchController.js +2 -2
- 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/Switch/useSwitchTouch.js +4 -4
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +5 -1
- 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 +164 -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/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +2 -1
- package/dist/animator/createAnimator.js +2 -2
- package/dist/astryx.css +362 -325
- 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/computeOverflow.d.ts +2 -0
- package/dist/hooks/computeOverflow.d.ts.map +1 -1
- package/dist/hooks/computeOverflow.js +1 -1
- 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 +36 -7
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +63 -14
- 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/useKeyboardHighlight.d.ts +17 -0
- package/dist/hooks/useKeyboardHighlight.d.ts.map +1 -0
- package/dist/hooks/useKeyboardHighlight.js +38 -0
- package/dist/hooks/useMediaQuery.d.ts +2 -1
- package/dist/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/hooks/useMediaQuery.js +37 -12
- 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/useOverflow.d.ts +10 -0
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +214 -23
- 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 +23 -3
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +8 -3
- package/dist/i18n/generated-english/DateInput/DateInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateInput/DateInput.generated.js +0 -1
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.d.ts +8 -0
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.js +16 -0
- package/dist/i18n/generated-english/DateTimeInput/DateTimeInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateTimeInput/DateTimeInput.generated.js +0 -1
- 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 +5 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +5 -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/calendar-system.d.ts +18 -0
- package/dist/internal/calendar-system.d.ts.map +1 -0
- package/dist/internal/calendar-system.js +19 -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 +20 -2
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +29 -3
- package/dist/motion/animator.d.ts +5 -5
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +7 -6
- 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 +142 -0
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/press.stylex.js +101 -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/calendarDateParser.d.ts +110 -0
- package/dist/utils/calendarDateParser.d.ts.map +1 -0
- package/dist/utils/calendarDateParser.js +1225 -0
- package/dist/utils/calendarSystem.d.ts +176 -0
- package/dist/utils/calendarSystem.d.ts.map +1 -0
- package/dist/utils/calendarSystem.js +569 -0
- package/dist/utils/coarsePointer.d.ts +5 -0
- package/dist/utils/coarsePointer.d.ts.map +1 -1
- package/dist/utils/coarsePointer.js +22 -13
- 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/focusReturn.d.ts +34 -13
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +64 -17
- package/dist/utils/hitArea.d.ts +8 -1
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +99 -9
- package/dist/utils/inputPresentation.d.ts +9 -1
- package/dist/utils/inputPresentation.d.ts.map +1 -1
- package/dist/utils/inputPresentation.js +15 -1
- 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 +38 -7
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +92 -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.d.ts +30 -0
- package/dist/utils/touchHitArea.d.ts.map +1 -0
- package/dist/utils/touchHitArea.js +167 -0
- package/dist/utils/touchHitArea.stylex.d.ts +38 -0
- package/dist/utils/touchHitArea.stylex.d.ts.map +1 -0
- package/dist/utils/touchHitArea.stylex.js +48 -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 +21 -1
- package/locales/pseudo.json +15 -0
- package/package.json +15 -4
- package/src/AppShell/observeMainOverflow.ts +9 -6
- package/src/BottomSheet/BottomSheet.tsx +45 -3
- package/src/BottomSheet/BottomSheetPanel.tsx +64 -7
- package/src/BottomSheet/bottomSheetStack.ts +4 -3
- 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 +5 -4
- package/src/CheckboxInput/CheckboxInput.tsx +105 -20
- package/src/CheckboxInput/CheckboxRowPressContext.ts +22 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +9 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +3 -3
- package/src/CheckboxList/CheckboxListItem.tsx +35 -14
- package/src/ClickableCard/ClickableCard.tsx +8 -1
- package/src/ContextMenu/ContextMenu.tsx +2 -0
- package/src/DateInput/DateInput.doc.mjs +45 -12
- package/src/DateInput/DateInput.tsx +165 -179
- package/src/DateInput/MonthScroller.tsx +39 -37
- package/src/DateInput/MonthYearWheels.tsx +68 -47
- package/src/DateInput/PickerWheel.tsx +7 -2
- package/src/DateInput/TouchDateField.tsx +45 -17
- package/src/DateInput/monthGeometry.ts +110 -8
- package/src/DateInput/useCalendarPresentation.ts +64 -0
- package/src/DateInput/useTypedDate.ts +469 -0
- package/src/DateInput/wheelStrip.ts +2 -2
- package/src/DateRangeInput/DateRangeInput.doc.mjs +9 -0
- package/src/DateRangeInput/DateRangeInput.tsx +43 -9
- package/src/DateTimeInput/DateTimeInput.doc.mjs +42 -9
- package/src/DateTimeInput/DateTimeInput.tsx +138 -148
- package/src/DateTimeInput/TouchDateTimeField.tsx +31 -16
- package/src/Dialog/Dialog.doc.mjs +1 -1
- package/src/Dialog/Dialog.tsx +14 -2
- 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 +31 -7
- 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/Icon/useIcon.doc.mjs +94 -0
- package/src/InfoTip/InfoTip.doc.mjs +26 -2
- package/src/InfoTip/InfoTip.tsx +6 -27
- package/src/InputGroup/InputGroup.doc.mjs +4 -3
- package/src/InputGroup/InputGroup.tsx +4 -3
- package/src/InputGroup/InputGroupText.doc.mjs +45 -3
- package/src/InputGroup/InputGroupText.tsx +2 -1
- package/src/InputGroup/groupStyles.ts +3 -1
- package/src/Item/Item.tsx +139 -35
- package/src/Item/ItemListRowContext.tsx +18 -0
- package/src/Layer/holdEntranceInput.ts +84 -0
- package/src/Layer/inputHold.ts +734 -0
- package/src/Layer/outsidePress.ts +18 -1
- package/src/Layer/preserveAnimations.ts +12 -275
- package/src/Layer/useBackdropPress.ts +41 -1
- package/src/Layer/useLayer.tsx +77 -4
- package/src/Layer/useTouchTrigger.ts +4 -0
- package/src/Layout/LayoutContent.doc.mjs +6 -3
- package/src/Layout/LayoutContent.tsx +10 -4
- package/src/Layout/LayoutPanel.doc.mjs +14 -11
- package/src/Layout/LayoutPanel.tsx +113 -16
- package/src/Lightbox/Lightbox.tsx +4 -0
- package/src/List/List.doc.mjs +10 -1
- package/src/List/List.tsx +5 -0
- package/src/List/ListItem.tsx +63 -8
- package/src/Markdown/parser.ts +65 -42
- 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/MultiSelector/MultiSelector.tsx +7 -17
- package/src/NumberInput/NumberInput.doc.mjs +1 -1
- package/src/NumberInput/NumberInput.tsx +259 -11
- package/src/OverflowList/OverflowList.tsx +15 -9
- 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 +16 -6
- package/src/Resizable/Resizable.doc.mjs +40 -12
- package/src/Resizable/ResizeHandle.tsx +68 -6
- package/src/Resizable/resizablePane.ts +179 -0
- package/src/Resizable/useResizable.ts +15 -0
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +3 -3
- package/src/SelectableCard/SelectableCard.tsx +8 -1
- package/src/Selector/Selector.tsx +83 -8
- package/src/SideNav/SideNav.doc.mjs +2 -2
- package/src/SideNav/SideNav.tsx +87 -12
- package/src/Slider/sliderTouchController.ts +2 -2
- 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/Switch/useSwitchTouch.ts +4 -4
- package/src/TabList/Tab.tsx +5 -1
- 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 +180 -80
- package/src/TreeList/TreeListItem.tsx +36 -2
- package/src/Typeahead/BaseTypeahead.tsx +2 -0
- package/src/animator/createAnimator.ts +3 -3
- 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/computeOverflow.ts +1 -1
- 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 +93 -15
- package/src/hooks/useFocusTrap.ts +268 -151
- package/src/hooks/useKeyboardHighlight.ts +71 -0
- package/src/hooks/useMediaQuery.ts +41 -12
- package/src/hooks/useMenuPress.ts +118 -11
- package/src/hooks/useOverflow.ts +321 -75
- 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 +35 -3
- package/src/i18n/generated-english/DateInput/DateInput.generated.ts +0 -1
- package/src/i18n/generated-english/DateInput/useTypedDate.generated.ts +17 -0
- package/src/i18n/generated-english/DateTimeInput/DateTimeInput.generated.ts +0 -1
- package/src/i18n/generated-english/hooks/useScrollRegionProps.generated.ts +13 -0
- package/src/i18n/generated-locales/en.generated.ts +7 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +7 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/useCalendarSystem.ts +95 -0
- package/src/internal/calendar-system.ts +26 -0
- package/src/internal/spinner-rotor.ts +20 -0
- package/src/internal/touch.ts +43 -2
- package/src/motion/MEASUREMENTS.md +11 -0
- package/src/motion/README.md +3 -3
- package/src/motion/animator.ts +7 -7
- 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 +261 -0
- package/src/theme/themeMotion.ts +3 -2
- package/src/theme/tokens.stylex.ts +1 -1
- package/src/utils/calendarDateParser.ts +1385 -0
- package/src/utils/calendarSystem.ts +832 -0
- package/src/utils/coarsePointer.ts +27 -14
- package/src/utils/flatTree.ts +15 -3
- package/src/utils/focusReturn.ts +78 -18
- package/src/utils/hitArea.ts +138 -9
- package/src/utils/inputPresentation.ts +21 -1
- package/src/utils/inputStream.ts +47 -10
- package/src/utils/interactionOverlay.stylex.ts +19 -22
- package/src/utils/plainDate.ts +130 -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 +56 -0
- package/src/utils/touchHitArea.ts +177 -0
- package/src/utils/triggerFocus.ts +17 -4
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file MonthScroller.tsx
|
|
7
|
-
* @input
|
|
7
|
+
* @input A calendar's month model, month bounds, selected value, constraints,
|
|
8
|
+
* week start
|
|
8
9
|
* @output Exports MonthScroller and MonthScrollerHandle
|
|
9
10
|
* @position Internal component; consumed by TouchDateField.tsx
|
|
10
11
|
*
|
|
@@ -36,12 +37,14 @@ import {
|
|
|
36
37
|
useImperativeHandle,
|
|
37
38
|
useLayoutEffect,
|
|
38
39
|
useRef,
|
|
40
|
+
useMemo,
|
|
39
41
|
useState,
|
|
40
42
|
} from 'react';
|
|
41
43
|
import {flushSync} from 'react-dom';
|
|
42
44
|
import * as stylex from '@stylexjs/stylex';
|
|
43
|
-
import {useCalendarDays} from '../Calendar';
|
|
44
|
-
import {useDirection
|
|
45
|
+
import {useCalendarDays} from '../Calendar/hooks/useCalendarDays';
|
|
46
|
+
import {useDirection} from '../i18n/useDirection';
|
|
47
|
+
import {useLocale} from '../i18n/useLocale';
|
|
45
48
|
import {
|
|
46
49
|
colorVars,
|
|
47
50
|
radiusVars,
|
|
@@ -50,33 +53,32 @@ import {
|
|
|
50
53
|
durationVars,
|
|
51
54
|
borderVars,
|
|
52
55
|
} from '../theme/tokens.stylex';
|
|
53
|
-
import {focusOutlineStyles} from '../utils';
|
|
56
|
+
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
57
|
+
import type {DayOfWeek, ISODateString, PlainDate} from '../utils/dateTypes';
|
|
54
58
|
import {
|
|
55
|
-
plainDateFormatDayNumber,
|
|
56
|
-
plainDateFormatStandaloneMonthYear,
|
|
57
|
-
} from '../utils/plainDate';
|
|
58
|
-
import {
|
|
59
|
-
type DayOfWeek,
|
|
60
|
-
type ISODateString,
|
|
61
|
-
type PlainDate,
|
|
62
59
|
plainDateAddDays,
|
|
63
60
|
plainDateDayOfWeek,
|
|
64
|
-
|
|
61
|
+
plainDateFormatDayNumber,
|
|
65
62
|
plainDateIsEqual,
|
|
66
63
|
plainDateToISO,
|
|
67
64
|
DATE_FORMAT_WITH_WEEKDAY,
|
|
68
|
-
} from '../utils';
|
|
65
|
+
} from '../utils/plainDate';
|
|
69
66
|
import {
|
|
70
67
|
playReducedMotionDip,
|
|
71
68
|
reducedMotionFade,
|
|
72
69
|
type ReducedMotionDip,
|
|
73
70
|
} from '../motion/reducedMotion';
|
|
71
|
+
import {
|
|
72
|
+
calendarYearMonthOf,
|
|
73
|
+
formatCalendarDate,
|
|
74
|
+
formatCalendarMonthLabel,
|
|
75
|
+
isInCalendarMonth,
|
|
76
|
+
} from '../utils/calendarSystem';
|
|
74
77
|
import {dateInputTouchSizes, dateInputTouchGeometry} from './tokens.stylex';
|
|
75
78
|
import {useOwnScrollGesture} from './useOwnScrollGesture';
|
|
76
79
|
import {useScrollSettle} from './useScrollSettle';
|
|
77
80
|
import {
|
|
78
|
-
|
|
79
|
-
monthIndexOf,
|
|
81
|
+
type MonthModel,
|
|
80
82
|
paneWindow,
|
|
81
83
|
rowAtScrollOffset,
|
|
82
84
|
rowsIn,
|
|
@@ -286,6 +288,8 @@ export interface MonthScrollerHandle {
|
|
|
286
288
|
export interface MonthScrollerProps {
|
|
287
289
|
/** Imperative handle for programmatic navigation (Today, the wheels). */
|
|
288
290
|
handleRef?: React.RefObject<MonthScrollerHandle | null>;
|
|
291
|
+
/** The calendar's months, by index. */
|
|
292
|
+
monthModel: MonthModel;
|
|
289
293
|
/** First reachable month, as a month index. */
|
|
290
294
|
minMonthIndex: number;
|
|
291
295
|
/** Last reachable month, as a month index. */
|
|
@@ -311,6 +315,7 @@ export interface MonthScrollerProps {
|
|
|
311
315
|
*/
|
|
312
316
|
export function MonthScroller({
|
|
313
317
|
handleRef,
|
|
318
|
+
monthModel,
|
|
314
319
|
minMonthIndex,
|
|
315
320
|
maxMonthIndex,
|
|
316
321
|
initialMonthIndex,
|
|
@@ -763,17 +768,17 @@ export function MonthScroller({
|
|
|
763
768
|
const moveFocus = useCallback(
|
|
764
769
|
(from: PlainDate, deltaDays: number) => {
|
|
765
770
|
const next = plainDateAddDays(from, deltaDays);
|
|
766
|
-
const nextIndex =
|
|
771
|
+
const nextIndex = monthModel.indexOf(next);
|
|
767
772
|
if (nextIndex < minMonthIndex || nextIndex > maxMonthIndex) {
|
|
768
773
|
return;
|
|
769
774
|
}
|
|
770
775
|
shouldRestoreFocusRef.current = true;
|
|
771
776
|
setFocusedDate(next);
|
|
772
|
-
if (nextIndex !==
|
|
777
|
+
if (nextIndex !== monthModel.indexOf(from)) {
|
|
773
778
|
scrollToMonth(nextIndex, 'smooth');
|
|
774
779
|
}
|
|
775
780
|
},
|
|
776
|
-
[minMonthIndex, maxMonthIndex, scrollToMonth],
|
|
781
|
+
[monthModel, minMonthIndex, maxMonthIndex, scrollToMonth],
|
|
777
782
|
);
|
|
778
783
|
|
|
779
784
|
const handleKeyDown = useCallback(
|
|
@@ -861,6 +866,7 @@ export function MonthScroller({
|
|
|
861
866
|
rowsIn(visibleRows).map(row => (
|
|
862
867
|
<MonthPane
|
|
863
868
|
key={row}
|
|
869
|
+
monthModel={monthModel}
|
|
864
870
|
monthIndex={minMonthIndex + row}
|
|
865
871
|
insetInlineStart={row * paneSize}
|
|
866
872
|
inlineSize={paneSize}
|
|
@@ -882,6 +888,7 @@ export function MonthScroller({
|
|
|
882
888
|
MonthScroller.displayName = 'MonthScroller';
|
|
883
889
|
|
|
884
890
|
interface MonthPaneProps {
|
|
891
|
+
monthModel: MonthModel;
|
|
885
892
|
monthIndex: number;
|
|
886
893
|
insetInlineStart: number;
|
|
887
894
|
inlineSize: number;
|
|
@@ -903,6 +910,7 @@ interface MonthPaneProps {
|
|
|
903
910
|
* so each day instead carries its weekday in its accessible name.
|
|
904
911
|
*/
|
|
905
912
|
function MonthPane({
|
|
913
|
+
monthModel,
|
|
906
914
|
monthIndex,
|
|
907
915
|
insetInlineStart,
|
|
908
916
|
inlineSize,
|
|
@@ -916,40 +924,33 @@ function MonthPane({
|
|
|
916
924
|
onDayFocus,
|
|
917
925
|
}: MonthPaneProps) {
|
|
918
926
|
const locale = useLocale();
|
|
919
|
-
const {
|
|
927
|
+
const {calendar} = monthModel;
|
|
928
|
+
const month = useMemo(
|
|
929
|
+
() => monthModel.monthAt(monthIndex),
|
|
930
|
+
[monthModel, monthIndex],
|
|
931
|
+
);
|
|
920
932
|
const {weeks} = useCalendarDays({
|
|
921
|
-
|
|
922
|
-
|
|
933
|
+
...calendarYearMonthOf(calendar, month),
|
|
934
|
+
calendar,
|
|
923
935
|
weekStartsOn,
|
|
924
936
|
// Always six rows: a variable grid would make pane heights differ, and
|
|
925
937
|
// with them every snap offset below this month.
|
|
926
938
|
hasVariableRowCount: false,
|
|
927
939
|
});
|
|
928
940
|
|
|
929
|
-
const monthLabel =
|
|
930
|
-
{year, month, day: 1},
|
|
931
|
-
locale,
|
|
932
|
-
);
|
|
941
|
+
const monthLabel = formatCalendarMonthLabel(calendar, month, locale);
|
|
933
942
|
|
|
934
943
|
// Exactly one day per pane is tab-reachable, so Tab moves through the
|
|
935
944
|
// picker rather than through 42 buttons: the focused day if the keyboard
|
|
936
945
|
// owns one, else the selection, else the first of the month.
|
|
937
946
|
const tabbableISO = (() => {
|
|
938
|
-
if (
|
|
939
|
-
focusedDate != null &&
|
|
940
|
-
focusedDate.year === year &&
|
|
941
|
-
focusedDate.month === month
|
|
942
|
-
) {
|
|
947
|
+
if (focusedDate != null && isInCalendarMonth(focusedDate, month)) {
|
|
943
948
|
return plainDateToISO(focusedDate);
|
|
944
949
|
}
|
|
945
|
-
if (
|
|
946
|
-
selectedDate != null &&
|
|
947
|
-
selectedDate.year === year &&
|
|
948
|
-
selectedDate.month === month
|
|
949
|
-
) {
|
|
950
|
+
if (selectedDate != null && isInCalendarMonth(selectedDate, month)) {
|
|
950
951
|
return plainDateToISO(selectedDate);
|
|
951
952
|
}
|
|
952
|
-
return plainDateToISO(
|
|
953
|
+
return plainDateToISO(month.start);
|
|
953
954
|
})();
|
|
954
955
|
|
|
955
956
|
return (
|
|
@@ -987,7 +988,8 @@ function MonthPane({
|
|
|
987
988
|
data-date={day.iso}
|
|
988
989
|
data-outside={day.isOutside ? '' : undefined}
|
|
989
990
|
tabIndex={day.iso === tabbableISO ? 0 : -1}
|
|
990
|
-
aria-label={
|
|
991
|
+
aria-label={formatCalendarDate(
|
|
992
|
+
calendar,
|
|
991
993
|
day.date,
|
|
992
994
|
DATE_FORMAT_WITH_WEEKDAY,
|
|
993
995
|
locale,
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file MonthYearWheels.tsx
|
|
7
|
-
* @input A month index, the reachable month bounds,
|
|
8
|
-
*
|
|
7
|
+
* @input A calendar's month model, a month index, the reachable month bounds,
|
|
8
|
+
* a change callback
|
|
9
|
+
* @output Exports MonthYearWheels — the month wheel of a calendar year and the
|
|
10
|
+
* year wheel with era labels
|
|
9
11
|
* @position Internal component; consumed by TouchDateField.tsx
|
|
10
12
|
*
|
|
11
13
|
* The shortcut out of continuous scrolling. Scrolling is the right gesture for
|
|
@@ -24,12 +26,16 @@
|
|
|
24
26
|
|
|
25
27
|
import {useMemo} from 'react';
|
|
26
28
|
import * as stylex from '@stylexjs/stylex';
|
|
27
|
-
import {useLocale} from '../i18n';
|
|
28
|
-
import {
|
|
29
|
+
import {useLocale} from '../i18n/useLocale';
|
|
30
|
+
import {
|
|
31
|
+
calendarYearSpansEras,
|
|
32
|
+
formatCalendarMonthName,
|
|
33
|
+
formatCalendarYearLabel,
|
|
34
|
+
} from '../utils/calendarSystem';
|
|
29
35
|
import {spacingVars} from '../theme/tokens.stylex';
|
|
30
36
|
import {dateInputTouchGeometry} from './tokens.stylex';
|
|
31
37
|
import {Wheel, type WheelOption} from './Wheel';
|
|
32
|
-
import {
|
|
38
|
+
import {clampIndex, type MonthModel} from './monthGeometry';
|
|
33
39
|
|
|
34
40
|
const styles = stylex.create({
|
|
35
41
|
wheels: {
|
|
@@ -40,6 +46,8 @@ const styles = stylex.create({
|
|
|
40
46
|
});
|
|
41
47
|
|
|
42
48
|
export interface MonthYearWheelsProps {
|
|
49
|
+
/** The calendar's months, by index. */
|
|
50
|
+
monthModel: MonthModel;
|
|
43
51
|
/** The month the wheels currently show. */
|
|
44
52
|
monthIndex: number;
|
|
45
53
|
/** First reachable month. */
|
|
@@ -54,12 +62,19 @@ export interface MonthYearWheelsProps {
|
|
|
54
62
|
yearLabel: string;
|
|
55
63
|
/** False while the panel is hidden. */
|
|
56
64
|
isActive?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The day of the month the picker keeps, such as the selected date's. A year
|
|
67
|
+
* that spans an era change is labeled with the era of this day in the
|
|
68
|
+
* selected month. The first day of the month applies when it is absent.
|
|
69
|
+
*/
|
|
70
|
+
keptDay?: number;
|
|
57
71
|
}
|
|
58
72
|
|
|
59
73
|
/**
|
|
60
74
|
* Month and year wheels, bounded by the same range as the scroller.
|
|
61
75
|
*/
|
|
62
76
|
export function MonthYearWheels({
|
|
77
|
+
monthModel,
|
|
63
78
|
monthIndex,
|
|
64
79
|
minMonthIndex,
|
|
65
80
|
maxMonthIndex,
|
|
@@ -67,60 +82,63 @@ export function MonthYearWheels({
|
|
|
67
82
|
monthLabel,
|
|
68
83
|
yearLabel,
|
|
69
84
|
isActive = true,
|
|
85
|
+
keptDay = 1,
|
|
70
86
|
}: MonthYearWheelsProps) {
|
|
71
87
|
const locale = useLocale();
|
|
72
|
-
const {
|
|
73
|
-
|
|
74
|
-
// Day 15 of a fixed year: no timezone can push it into an adjacent month
|
|
75
|
-
// the way day 1 or day 31 can.
|
|
76
|
-
//
|
|
77
|
-
// `plainDateFormat` rather than a raw `Intl.DateTimeFormat`, which the
|
|
78
|
-
// shared lint rule forbids and which would duplicate the format vocabulary
|
|
79
|
-
// besides. Recompute when the provider locale changes so the wheel labels
|
|
80
|
-
// stay in sync with the field and calendar.
|
|
81
|
-
const monthNames = useMemo(
|
|
82
|
-
() =>
|
|
83
|
-
Array.from({length: 12}, (_, index) =>
|
|
84
|
-
plainDateFormat(
|
|
85
|
-
{year: 2021, month: index + 1, day: 15},
|
|
86
|
-
DATE_FORMAT_MONTH_ONLY,
|
|
87
|
-
locale,
|
|
88
|
-
),
|
|
89
|
-
),
|
|
90
|
-
[locale],
|
|
91
|
-
);
|
|
88
|
+
const {calendar} = monthModel;
|
|
89
|
+
const {year, month} = monthModel.yearMonthAt(monthIndex);
|
|
92
90
|
|
|
93
91
|
// Months outside the range stay on the wheel rather than vanishing: a list
|
|
94
|
-
// whose length
|
|
92
|
+
// whose length changed with the range would jump under the finger. Only the
|
|
93
|
+
// calendar changes its length, for a year with a leap month.
|
|
95
94
|
const monthOptions: WheelOption[] = useMemo(
|
|
96
95
|
() =>
|
|
97
|
-
|
|
98
|
-
const candidate =
|
|
96
|
+
Array.from({length: monthModel.monthsInYear(year)}, (_, index) => {
|
|
97
|
+
const candidate = monthModel.indexOfYearMonth(year, index + 1);
|
|
99
98
|
return {
|
|
100
99
|
value: index + 1,
|
|
101
|
-
label:
|
|
100
|
+
label: formatCalendarMonthName(
|
|
101
|
+
calendar,
|
|
102
|
+
monthModel.monthAt(candidate),
|
|
103
|
+
locale,
|
|
104
|
+
),
|
|
102
105
|
isDisabled: candidate < minMonthIndex || candidate > maxMonthIndex,
|
|
103
106
|
};
|
|
104
107
|
}),
|
|
105
|
-
[
|
|
108
|
+
[monthModel, calendar, year, locale, minMonthIndex, maxMonthIndex],
|
|
106
109
|
);
|
|
107
110
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
111
|
+
// Every listed year holds a reachable month: the list runs from the year of
|
|
112
|
+
// the first reachable month to the year of the last.
|
|
113
|
+
const years = useMemo(() => {
|
|
114
|
+
const first = monthModel.yearMonthAt(minMonthIndex).year;
|
|
115
|
+
const last = monthModel.yearMonthAt(maxMonthIndex).year;
|
|
116
|
+
const result: {value: number; label: string; spansEras: boolean}[] = [];
|
|
112
117
|
for (let candidate = first; candidate <= last; candidate++) {
|
|
113
|
-
|
|
118
|
+
result.push({
|
|
114
119
|
value: candidate,
|
|
115
|
-
label:
|
|
116
|
-
|
|
117
|
-
isDisabled:
|
|
118
|
-
toMonthIndex(candidate, 12) < minMonthIndex ||
|
|
119
|
-
toMonthIndex(candidate, 1) > maxMonthIndex,
|
|
120
|
+
label: formatCalendarYearLabel(calendar, candidate, locale),
|
|
121
|
+
spansEras: calendarYearSpansEras(calendar, candidate, locale),
|
|
120
122
|
});
|
|
121
123
|
}
|
|
122
|
-
return
|
|
123
|
-
}, [minMonthIndex, maxMonthIndex]);
|
|
124
|
+
return result;
|
|
125
|
+
}, [monthModel, calendar, locale, minMonthIndex, maxMonthIndex]);
|
|
126
|
+
|
|
127
|
+
// A year with an era change takes the era of the shown date, as iOS does.
|
|
128
|
+
// Its row text changes as the month turns. Each row keeps one fixed size.
|
|
129
|
+
const yearOptions: WheelOption[] = useMemo(
|
|
130
|
+
() =>
|
|
131
|
+
years.map(({value, label, spansEras}) => ({
|
|
132
|
+
value,
|
|
133
|
+
label: spansEras
|
|
134
|
+
? formatCalendarYearLabel(calendar, value, locale, {
|
|
135
|
+
month,
|
|
136
|
+
day: keptDay,
|
|
137
|
+
})
|
|
138
|
+
: label,
|
|
139
|
+
})),
|
|
140
|
+
[years, calendar, locale, month, keptDay],
|
|
141
|
+
);
|
|
124
142
|
|
|
125
143
|
return (
|
|
126
144
|
<div {...stylex.props(styles.wheels)}>
|
|
@@ -129,7 +147,9 @@ export function MonthYearWheels({
|
|
|
129
147
|
options={monthOptions}
|
|
130
148
|
value={month}
|
|
131
149
|
isActive={isActive}
|
|
132
|
-
onChange={nextMonth =>
|
|
150
|
+
onChange={nextMonth =>
|
|
151
|
+
onChange(monthModel.indexOfYearMonth(year, nextMonth))
|
|
152
|
+
}
|
|
133
153
|
/>
|
|
134
154
|
<Wheel
|
|
135
155
|
label={yearLabel}
|
|
@@ -137,10 +157,11 @@ export function MonthYearWheels({
|
|
|
137
157
|
value={year}
|
|
138
158
|
isActive={isActive}
|
|
139
159
|
onChange={nextYear => {
|
|
140
|
-
//
|
|
141
|
-
// year
|
|
142
|
-
|
|
143
|
-
|
|
160
|
+
// The same month of the new year, or its common counterpart when
|
|
161
|
+
// the new year lacks a leap month (Adar I becomes Adar). A year
|
|
162
|
+
// change can still land outside the range; clamp to it.
|
|
163
|
+
const candidate = monthModel.shiftYears(monthIndex, nextYear - year);
|
|
164
|
+
onChange(clampIndex(candidate, minMonthIndex, maxMonthIndex));
|
|
144
165
|
}}
|
|
145
166
|
/>
|
|
146
167
|
</div>
|
|
@@ -73,6 +73,12 @@ const UIKIT_SCALE = ROW_HEIGHT / picker.geometry.rowHeight;
|
|
|
73
73
|
/** UIKit's rubber band dimension for the picker's table, at that pitch. */
|
|
74
74
|
const RUBBER_BAND_DIMENSION = picker.geometry.rubberBandDimension * UIKIT_SCALE;
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* The rows' opacity at the column's edges. At 0.7 the row four from the band
|
|
78
|
+
* keeps 5:1 or more in every shipped theme, a margin over WCAG AA's 4.5:1.
|
|
79
|
+
*/
|
|
80
|
+
const FADE_FLOOR = 0.7;
|
|
81
|
+
|
|
76
82
|
const styles = stylex.create({
|
|
77
83
|
// The scrolling column's box, band and rows (Wheel.tsx), moved by the
|
|
78
84
|
// gesture system and the compositor instead of a native scroller.
|
|
@@ -92,8 +98,7 @@ const styles = stylex.create({
|
|
|
92
98
|
position: 'absolute',
|
|
93
99
|
inset: 0,
|
|
94
100
|
pointerEvents: 'none',
|
|
95
|
-
maskImage:
|
|
96
|
-
'linear-gradient(to bottom, rgb(0 0 0 / 0.3), rgb(0 0 0) 50%, rgb(0 0 0 / 0.3))',
|
|
101
|
+
maskImage: `linear-gradient(to bottom, rgb(0 0 0 / ${FADE_FLOOR}), rgb(0 0 0) 50%, rgb(0 0 0 / ${FADE_FLOOR}))`,
|
|
97
102
|
},
|
|
98
103
|
/**
|
|
99
104
|
* The selection band: a centred row-height plate behind the rows.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file TouchDateField.tsx
|
|
7
|
-
* @input Uses React, Field, BottomSheet, Button, Icon, Calendar hooks, MonthScroller, MonthYearWheels
|
|
7
|
+
* @input Uses React, Field, BottomSheet, Button, Icon, Calendar hooks, the resolved calendar, MonthScroller, MonthYearWheels
|
|
8
8
|
* @output Exports TouchDateField — the touch surface behind DateInput
|
|
9
9
|
* @position Internal component; consumed by DateInput.tsx
|
|
10
10
|
*
|
|
@@ -105,12 +105,16 @@ import {
|
|
|
105
105
|
mergeProps,
|
|
106
106
|
rtlStyles,
|
|
107
107
|
themeProps,
|
|
108
|
-
formatSharedDate,
|
|
109
108
|
plainDateFromISO,
|
|
110
109
|
plainDateToday,
|
|
111
110
|
type ISODateString,
|
|
112
111
|
} from '../utils';
|
|
113
|
-
import {
|
|
112
|
+
import {useCalendarSystem} from '../i18n/useCalendarSystem';
|
|
113
|
+
import {
|
|
114
|
+
calendarDayOfMonth,
|
|
115
|
+
formatCalendarMonthLabel,
|
|
116
|
+
} from '../utils/calendarSystem';
|
|
117
|
+
import {formatCalendarDateText} from '../utils/calendarDateParser';
|
|
114
118
|
import {chainEventHandlers} from '../utils/chainEventHandlers';
|
|
115
119
|
import {interactionOverlayStyles} from '../utils/interactionOverlay.stylex';
|
|
116
120
|
import {usePressFeedback} from '../hooks/usePressFeedback';
|
|
@@ -121,8 +125,7 @@ import {MonthYearWheels} from './MonthYearWheels';
|
|
|
121
125
|
import {
|
|
122
126
|
DEFAULT_MONTH_REACH,
|
|
123
127
|
clampIndex,
|
|
124
|
-
|
|
125
|
-
monthIndexOf,
|
|
128
|
+
createMonthModel,
|
|
126
129
|
} from './monthGeometry';
|
|
127
130
|
import {dateInputTouchSizes, dateInputTouchGeometry} from './tokens.stylex';
|
|
128
131
|
import {
|
|
@@ -581,6 +584,7 @@ export function TouchDateField({
|
|
|
581
584
|
numberOfMonths: _numberOfMonths,
|
|
582
585
|
weekStartsOn: weekStartsOnProp = 0,
|
|
583
586
|
format = 'date_long',
|
|
587
|
+
calendar: calendarProp,
|
|
584
588
|
width,
|
|
585
589
|
containerXstyle,
|
|
586
590
|
containerClassName,
|
|
@@ -612,6 +616,8 @@ export function TouchDateField({
|
|
|
612
616
|
placeholderFromProps ?? t('@astryx.dateInput.placeholder');
|
|
613
617
|
const size = useSize(sizeProp, 'md');
|
|
614
618
|
const weekStartsOn = normalizeDayOfWeek(weekStartsOnProp);
|
|
619
|
+
const calendar = useCalendarSystem(calendarProp, 'DateInput');
|
|
620
|
+
const monthModel = useMemo(() => createMonthModel(calendar), [calendar]);
|
|
615
621
|
|
|
616
622
|
const generatedID = useId();
|
|
617
623
|
const id = idProp ?? generatedID;
|
|
@@ -698,8 +704,10 @@ export function TouchDateField({
|
|
|
698
704
|
// century in each direction from wherever it opened. Anchored once, in a
|
|
699
705
|
// state initializer: recomputing it as the selection moves would shift every
|
|
700
706
|
// pane's scroll offset under the user mid-gesture.
|
|
707
|
+
// Indexes belong to the calendar, so DateInput remounts this surface when
|
|
708
|
+
// the calendar changes.
|
|
701
709
|
const [anchorMonthIndex] = useState(() =>
|
|
702
|
-
|
|
710
|
+
monthModel.indexOf(
|
|
703
711
|
value != null && /^\d{4}-\d{2}-\d{2}$/.test(value)
|
|
704
712
|
? plainDateFromISO(value)
|
|
705
713
|
: plainDateToday(),
|
|
@@ -707,36 +715,45 @@ export function TouchDateField({
|
|
|
707
715
|
);
|
|
708
716
|
const minMonthIndex =
|
|
709
717
|
min != null
|
|
710
|
-
?
|
|
718
|
+
? monthModel.indexOf(plainDateFromISO(min))
|
|
711
719
|
: anchorMonthIndex - DEFAULT_MONTH_REACH;
|
|
712
720
|
const maxMonthIndex =
|
|
713
721
|
max != null
|
|
714
|
-
?
|
|
722
|
+
? monthModel.indexOf(plainDateFromISO(max))
|
|
715
723
|
: anchorMonthIndex + DEFAULT_MONTH_REACH;
|
|
716
724
|
|
|
717
725
|
const [monthIndex, setMonthIndex] = useState(() =>
|
|
718
726
|
clampIndex(anchorMonthIndex, minMonthIndex, maxMonthIndex),
|
|
719
727
|
);
|
|
720
728
|
|
|
721
|
-
const {year, month} = fromMonthIndex(monthIndex);
|
|
722
|
-
|
|
723
729
|
const weekdayHeaders = useMemo(
|
|
724
730
|
() => getWeekdayHeaders(locale, weekStartsOn),
|
|
725
731
|
[locale, weekStartsOn],
|
|
726
732
|
);
|
|
727
|
-
|
|
728
|
-
|
|
733
|
+
// The day the picker keeps: the selected date's day of its month. A month
|
|
734
|
+
// with an era change takes its heading era from this day.
|
|
735
|
+
const keptDay =
|
|
736
|
+
selectedDate == null ? 1 : calendarDayOfMonth(calendar, selectedDate);
|
|
737
|
+
const monthYearLabel = formatCalendarMonthLabel(
|
|
738
|
+
calendar,
|
|
739
|
+
monthModel.monthAt(monthIndex),
|
|
729
740
|
locale,
|
|
741
|
+
keptDay,
|
|
730
742
|
);
|
|
731
743
|
|
|
732
744
|
// Formats the committed value only. A function format is called with the ISO
|
|
733
|
-
// value; a named one
|
|
734
|
-
//
|
|
745
|
+
// value; a named one writes the date in the calendar exactly as the desktop
|
|
746
|
+
// control commits it.
|
|
735
747
|
const displayValue =
|
|
736
748
|
optimisticValue != null && /^\d{4}-\d{2}-\d{2}$/.test(optimisticValue)
|
|
737
749
|
? typeof format === 'function'
|
|
738
750
|
? format(optimisticValue)
|
|
739
|
-
:
|
|
751
|
+
: formatCalendarDateText(
|
|
752
|
+
plainDateFromISO(optimisticValue),
|
|
753
|
+
format,
|
|
754
|
+
locale,
|
|
755
|
+
calendar,
|
|
756
|
+
)
|
|
740
757
|
: '';
|
|
741
758
|
|
|
742
759
|
const fireChange = useCallback(
|
|
@@ -822,7 +839,7 @@ export function TouchDateField({
|
|
|
822
839
|
return;
|
|
823
840
|
}
|
|
824
841
|
fireChange(undefined);
|
|
825
|
-
const currentMonth =
|
|
842
|
+
const currentMonth = monthModel.indexOf(today);
|
|
826
843
|
if (currentMonth < minMonthIndex || currentMonth > maxMonthIndex) {
|
|
827
844
|
return;
|
|
828
845
|
}
|
|
@@ -831,7 +848,15 @@ export function TouchDateField({
|
|
|
831
848
|
}
|
|
832
849
|
setMonthIndex(currentMonth);
|
|
833
850
|
scrollerHandleRef.current?.scrollToMonth(currentMonth, 'smooth');
|
|
834
|
-
}, [
|
|
851
|
+
}, [
|
|
852
|
+
isDisabled,
|
|
853
|
+
fireChange,
|
|
854
|
+
monthModel,
|
|
855
|
+
today,
|
|
856
|
+
monthIndex,
|
|
857
|
+
minMonthIndex,
|
|
858
|
+
maxMonthIndex,
|
|
859
|
+
]);
|
|
835
860
|
|
|
836
861
|
// Selection commits on the tap and leaves the sheet up, so a mistake can be
|
|
837
862
|
// corrected in place and a nearby date reconsidered without reopening.
|
|
@@ -1104,6 +1129,7 @@ export function TouchDateField({
|
|
|
1104
1129
|
<MonthScroller
|
|
1105
1130
|
key={`${minMonthIndex}:${maxMonthIndex}`}
|
|
1106
1131
|
handleRef={scrollerHandleRef}
|
|
1132
|
+
monthModel={monthModel}
|
|
1107
1133
|
minMonthIndex={minMonthIndex}
|
|
1108
1134
|
maxMonthIndex={maxMonthIndex}
|
|
1109
1135
|
initialMonthIndex={monthIndex}
|
|
@@ -1124,7 +1150,9 @@ export function TouchDateField({
|
|
|
1124
1150
|
!isWheelOpen && styles.panelOverlayHidden,
|
|
1125
1151
|
)}>
|
|
1126
1152
|
<MonthYearWheels
|
|
1153
|
+
monthModel={monthModel}
|
|
1127
1154
|
monthIndex={monthIndex}
|
|
1155
|
+
keptDay={keptDay}
|
|
1128
1156
|
minMonthIndex={minMonthIndex}
|
|
1129
1157
|
maxMonthIndex={maxMonthIndex}
|
|
1130
1158
|
onChange={handleWheelChange}
|