@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
|
@@ -67,6 +67,7 @@ import {usePopover} from '../Popover';
|
|
|
67
67
|
import {
|
|
68
68
|
isFocusInsideOwnedLayer,
|
|
69
69
|
isPressInsideOwnedLayer,
|
|
70
|
+
noteOutsideDismissal,
|
|
70
71
|
useOutsidePress,
|
|
71
72
|
} from '../Layer/outsidePress';
|
|
72
73
|
import {useTooltip} from '../Tooltip';
|
|
@@ -75,7 +76,6 @@ import {useBusyAnnouncement} from '../hooks/useBusyAnnouncement';
|
|
|
75
76
|
import {useInputStatusIcon} from '../hooks/useInputStatusIcon';
|
|
76
77
|
import {
|
|
77
78
|
type ISOTimeString,
|
|
78
|
-
parseDateInput,
|
|
79
79
|
parseISOTime,
|
|
80
80
|
formatISOTime,
|
|
81
81
|
isTimeInRange,
|
|
@@ -86,12 +86,9 @@ import {
|
|
|
86
86
|
} from '../utils';
|
|
87
87
|
import {chainEventHandlers} from '../utils/chainEventHandlers';
|
|
88
88
|
import {joinAriaIDs} from '../utils/inputAria';
|
|
89
|
-
import {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
plainDateFormat,
|
|
93
|
-
DATE_FORMAT_LONG,
|
|
94
|
-
} from '../utils/plainDate';
|
|
89
|
+
import type {CalendarSystem} from '../utils/calendarSystem';
|
|
90
|
+
import {isRenderable} from '../utils/isRenderable';
|
|
91
|
+
import {useTypedDateField} from '../DateInput/useTypedDate';
|
|
95
92
|
|
|
96
93
|
import {
|
|
97
94
|
useFieldInputStyling,
|
|
@@ -117,10 +114,10 @@ import {NativeDateSegment} from './NativeDateSegment';
|
|
|
117
114
|
import {NativeTimeSegment} from './NativeTimeSegment';
|
|
118
115
|
import {TouchDateTimeField} from './TouchDateTimeField';
|
|
119
116
|
import {
|
|
120
|
-
effectivePickerPresentation,
|
|
121
117
|
resolvePickerPresentation,
|
|
122
118
|
type PickerPresentation,
|
|
123
119
|
} from '../utils/inputPresentation';
|
|
120
|
+
import {useCalendarPresentation} from '../DateInput/useCalendarPresentation';
|
|
124
121
|
import {useDevWarning} from '../hooks/useDevWarning';
|
|
125
122
|
import {
|
|
126
123
|
registerEnglishFallback,
|
|
@@ -457,11 +454,27 @@ export interface DateTimeInputProps extends Omit<
|
|
|
457
454
|
hasClear?: boolean;
|
|
458
455
|
|
|
459
456
|
/**
|
|
460
|
-
* Placeholder text shown in the date portion when no date is selected.
|
|
457
|
+
* Placeholder text shown in the date portion when no date is selected. A
|
|
458
|
+
* caller placeholder replaces the calendar format hint.
|
|
461
459
|
* @default "Select a date"
|
|
462
460
|
*/
|
|
463
461
|
placeholder?: string;
|
|
464
462
|
|
|
463
|
+
/**
|
|
464
|
+
* The calendar the date field reads and writes typed dates in, such as
|
|
465
|
+
* `'persian'`, `'hebrew'`, or `'buddhist'`. `value`, `onChange`, `min`, and
|
|
466
|
+
* `max` stay Gregorian ISO datetimes in every calendar. People type a date
|
|
467
|
+
* the way the locale writes it in this calendar, and the committed date
|
|
468
|
+
* text uses it. Years are years of this calendar, so set `min` and `max` to
|
|
469
|
+
* catch a year typed in the wrong calendar. Calendars other than `gregory`,
|
|
470
|
+
* `iso8601`, `buddhist`, `roc`, and `japanese` need `Temporal`, native or a
|
|
471
|
+
* polyfill the application loads; without it the field uses the Gregorian
|
|
472
|
+
* calendar.
|
|
473
|
+
*
|
|
474
|
+
* @default the InternationalizationProvider's calendar, else `'gregory'`
|
|
475
|
+
*/
|
|
476
|
+
calendar?: CalendarSystem;
|
|
477
|
+
|
|
465
478
|
/**
|
|
466
479
|
* Placeholder text shown in the time portion when no time is selected.
|
|
467
480
|
* On touch, this appears in the closed time segment before a time is chosen.
|
|
@@ -534,6 +547,10 @@ export interface DateTimeInputProps extends Omit<
|
|
|
534
547
|
* JavaScript. `hourFormat` formats the closed value; the OS picker follows the
|
|
535
548
|
* user's locale.
|
|
536
549
|
*
|
|
550
|
+
* In a calendar other than `gregory` or `iso8601`, `'touch'` and `'always'`
|
|
551
|
+
* use Astryx's popovers on a fine pointer and the bottom sheet on a coarse
|
|
552
|
+
* pointer.
|
|
553
|
+
*
|
|
537
554
|
* @default 'touch'
|
|
538
555
|
* @deprecated Use `presentation` (`spec:AST-043` FR3):
|
|
539
556
|
* `'touch'` → `'adaptive-native'`, `'always'` → `'native'`,
|
|
@@ -550,13 +567,16 @@ export interface DateTimeInputProps extends Omit<
|
|
|
550
567
|
* - `'popover'`: Astryx's typed fields + popovers on every pointer
|
|
551
568
|
* - `'bottom-sheet'`: Astryx's bottom-sheet date/time wheels on every pointer
|
|
552
569
|
* - `'native'`: browser/OS date and time pickers on every pointer, with no
|
|
553
|
-
* Astryx fallback (FR2)
|
|
570
|
+
* Astryx fallback (FR2), except in a calendar other than `gregory` or
|
|
571
|
+
* `iso8601`, where it is `'adaptive-bottom-sheet'` and warns in
|
|
572
|
+
* development
|
|
554
573
|
* - `'adaptive-bottom-sheet'`: popovers on a fine pointer, bottom sheet on
|
|
555
574
|
* a coarse pointer
|
|
556
575
|
* - `'adaptive-native'` (default): popovers on a fine pointer, browser/OS
|
|
557
576
|
* pickers on a coarse pointer, keeping the released per-segment Astryx
|
|
558
577
|
* fallbacks (seconds, non-default `timeIncrement`, `timeOptionInterval`)
|
|
559
|
-
* where a native control cannot express the value (FR2)
|
|
578
|
+
* where a native control cannot express the value (FR2), and the bottom
|
|
579
|
+
* sheet in a calendar other than `gregory` or `iso8601`
|
|
560
580
|
*
|
|
561
581
|
* @default 'adaptive-native'
|
|
562
582
|
*/
|
|
@@ -635,6 +655,7 @@ function PointerDateTimeField({
|
|
|
635
655
|
timeOptionInterval,
|
|
636
656
|
hasClear = false,
|
|
637
657
|
placeholder: placeholderFromProps,
|
|
658
|
+
calendar,
|
|
638
659
|
timePlaceholder: timePlaceholderFromProps,
|
|
639
660
|
timeLabel,
|
|
640
661
|
size: sizeProp,
|
|
@@ -666,6 +687,7 @@ function PointerDateTimeField({
|
|
|
666
687
|
'aria-labelledby': ariaLabelledByProp,
|
|
667
688
|
onBlur: onBlurProp,
|
|
668
689
|
onClick: onClickProp,
|
|
690
|
+
onFocus: onFocusProp,
|
|
669
691
|
onKeyDown: onKeyDownProp,
|
|
670
692
|
...controlProps
|
|
671
693
|
} = rest;
|
|
@@ -705,12 +727,12 @@ function PointerDateTimeField({
|
|
|
705
727
|
const timeInputId = useId();
|
|
706
728
|
const descriptionID = useId();
|
|
707
729
|
const statusMessageID = useId();
|
|
730
|
+
const calendarDescriptionID = useId();
|
|
708
731
|
const dateInputRef = useRef<HTMLInputElement | null>(null);
|
|
709
732
|
const mergedDateInputRef = useMergedRefs(ref, dateInputRef);
|
|
710
733
|
const timeInputRef = useRef<HTMLInputElement | null>(null);
|
|
711
734
|
const timeContainerRef = useRef<HTMLDivElement | null>(null);
|
|
712
735
|
const calendarRef = useRef<CalendarHandle | null>(null);
|
|
713
|
-
const lastFiredDateRef = useRef<ISODateString | undefined>(undefined);
|
|
714
736
|
|
|
715
737
|
const [, startTransition] = useTransition();
|
|
716
738
|
const [optimisticValue, setOptimisticValue] = useOptimistic(value);
|
|
@@ -742,27 +764,6 @@ function PointerDateTimeField({
|
|
|
742
764
|
isEnabled: showsDisabledMessage,
|
|
743
765
|
});
|
|
744
766
|
|
|
745
|
-
// DateTimeInput fixes its status presentation to the detached message box,
|
|
746
|
-
// so the shared helper suppresses the on-field icon (the message box carries
|
|
747
|
-
// its own leading glyph). Routed through the helper for consistency with the
|
|
748
|
-
// rest of the bordered input family.
|
|
749
|
-
const {statusIcon, describedBy: statusTooltipDescribedBy} =
|
|
750
|
-
useInputStatusIcon({
|
|
751
|
-
status,
|
|
752
|
-
statusVariant: 'detached',
|
|
753
|
-
});
|
|
754
|
-
|
|
755
|
-
const ariaDescribedBy =
|
|
756
|
-
[
|
|
757
|
-
description ? descriptionID : null,
|
|
758
|
-
status?.message ? statusMessageID : null,
|
|
759
|
-
statusTooltipDescribedBy,
|
|
760
|
-
showsDisabledMessage ? disabledMessageTooltip.describedBy : null,
|
|
761
|
-
ariaDescribedByProp,
|
|
762
|
-
]
|
|
763
|
-
.filter(Boolean)
|
|
764
|
-
.join(' ') || undefined;
|
|
765
|
-
|
|
766
767
|
// Split min/max and current value
|
|
767
768
|
const minParts = useMemo(() => splitDateTime(min), [min]);
|
|
768
769
|
const maxParts = useMemo(() => splitDateTime(max), [max]);
|
|
@@ -795,36 +796,6 @@ function PointerDateTimeField({
|
|
|
795
796
|
return valueParts.date === maxParts.date ? maxParts.time : undefined;
|
|
796
797
|
}, [maxParts.date, maxParts.time, valueParts.date]);
|
|
797
798
|
|
|
798
|
-
// --- Date input state ---
|
|
799
|
-
const [datePendingInput, setDatePendingInput] = useState<string | null>(null);
|
|
800
|
-
|
|
801
|
-
const prevDateRef = useRef(valueParts.date);
|
|
802
|
-
if (valueParts.date !== prevDateRef.current) {
|
|
803
|
-
prevDateRef.current = valueParts.date;
|
|
804
|
-
if (valueParts.date !== lastFiredDateRef.current) {
|
|
805
|
-
lastFiredDateRef.current = undefined;
|
|
806
|
-
if (datePendingInput !== null) {
|
|
807
|
-
setDatePendingInput(null);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
const dateDisplayValue =
|
|
813
|
-
datePendingInput !== null
|
|
814
|
-
? datePendingInput
|
|
815
|
-
: valueParts.date && /^\d{4}-\d{2}-\d{2}$/.test(valueParts.date)
|
|
816
|
-
? plainDateFormat(
|
|
817
|
-
plainDateFromISO(valueParts.date),
|
|
818
|
-
DATE_FORMAT_LONG,
|
|
819
|
-
locale,
|
|
820
|
-
)
|
|
821
|
-
: '';
|
|
822
|
-
|
|
823
|
-
const isDateInputValid =
|
|
824
|
-
datePendingInput === null || !datePendingInput.trim()
|
|
825
|
-
? true
|
|
826
|
-
: parseDateInput(datePendingInput, locale) !== null;
|
|
827
|
-
|
|
828
799
|
// --- Time input state ---
|
|
829
800
|
const [timePendingInput, setTimePendingInput] = useState<string | null>(null);
|
|
830
801
|
const [isTimeFocused, setIsTimeFocused] = useState(false);
|
|
@@ -1005,7 +976,6 @@ function PointerDateTimeField({
|
|
|
1005
976
|
fireChange(combined);
|
|
1006
977
|
}
|
|
1007
978
|
if (source === 'calendar') {
|
|
1008
|
-
setDatePendingInput(null);
|
|
1009
979
|
popover.hide();
|
|
1010
980
|
}
|
|
1011
981
|
},
|
|
@@ -1020,6 +990,71 @@ function PointerDateTimeField({
|
|
|
1020
990
|
],
|
|
1021
991
|
);
|
|
1022
992
|
|
|
993
|
+
const handleTypedDateChange = useCallback(
|
|
994
|
+
(date: ISODateString) => handleDateChange(date, 'input'),
|
|
995
|
+
[handleDateChange],
|
|
996
|
+
);
|
|
997
|
+
const clearTypedDate = useCallback(() => {
|
|
998
|
+
if (value !== undefined) {
|
|
999
|
+
fireChange(undefined);
|
|
1000
|
+
}
|
|
1001
|
+
}, [value, fireChange]);
|
|
1002
|
+
const navigateToTypedDate = useCallback((date: ISODateString) => {
|
|
1003
|
+
calendarRef.current?.navigateTo(date);
|
|
1004
|
+
}, []);
|
|
1005
|
+
const {
|
|
1006
|
+
typedDate,
|
|
1007
|
+
displayValue: dateDisplayValue,
|
|
1008
|
+
formatHint: dateFormatHint,
|
|
1009
|
+
isPending: isDatePending,
|
|
1010
|
+
isInvalid: isDateInvalid,
|
|
1011
|
+
fieldStatus,
|
|
1012
|
+
alertMessage: dateAlertMessage,
|
|
1013
|
+
handleChange: handleTypedDateInput,
|
|
1014
|
+
commit: commitDatePendingInput,
|
|
1015
|
+
handleFocus: handleDateFocus,
|
|
1016
|
+
handleBlur: handleDateBlur,
|
|
1017
|
+
reset: resetTypedDate,
|
|
1018
|
+
} = useTypedDateField({
|
|
1019
|
+
source: 'DateTimeInput',
|
|
1020
|
+
calendar,
|
|
1021
|
+
format: 'date_long',
|
|
1022
|
+
min: calendarMin,
|
|
1023
|
+
max: calendarMax,
|
|
1024
|
+
isDateDisabled,
|
|
1025
|
+
value: splitDateTime(value).date,
|
|
1026
|
+
shownValue: valueParts.date,
|
|
1027
|
+
onChange: handleTypedDateChange,
|
|
1028
|
+
onClear: clearTypedDate,
|
|
1029
|
+
onTypedDate: navigateToTypedDate,
|
|
1030
|
+
isDisabled: isEffectivelyDisabled,
|
|
1031
|
+
status,
|
|
1032
|
+
isStatusAnnounced: true,
|
|
1033
|
+
hasPlaceholder: placeholderFromProps != null,
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
// The detached message box carries its own glyph, so the helper shows no
|
|
1037
|
+
// on-field icon.
|
|
1038
|
+
const {statusIcon, describedBy: statusTooltipDescribedBy} =
|
|
1039
|
+
useInputStatusIcon({
|
|
1040
|
+
status: fieldStatus,
|
|
1041
|
+
statusVariant: 'detached',
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
const ariaDescribedBy =
|
|
1045
|
+
[
|
|
1046
|
+
description ? descriptionID : null,
|
|
1047
|
+
!usesNativePicker && typedDate.calendarDescription != null
|
|
1048
|
+
? calendarDescriptionID
|
|
1049
|
+
: null,
|
|
1050
|
+
fieldStatus?.message ? statusMessageID : null,
|
|
1051
|
+
statusTooltipDescribedBy,
|
|
1052
|
+
showsDisabledMessage ? disabledMessageTooltip.describedBy : null,
|
|
1053
|
+
ariaDescribedByProp,
|
|
1054
|
+
]
|
|
1055
|
+
.filter(Boolean)
|
|
1056
|
+
.join(' ') || undefined;
|
|
1057
|
+
|
|
1023
1058
|
const handleNativeDateChange = useCallback(
|
|
1024
1059
|
(newDate: ISODateString | undefined) => {
|
|
1025
1060
|
if (newDate === undefined) {
|
|
@@ -1057,70 +1092,11 @@ function PointerDateTimeField({
|
|
|
1057
1092
|
|
|
1058
1093
|
const handleDateInputChange = useCallback(
|
|
1059
1094
|
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
1060
|
-
|
|
1061
|
-
// guard value mutation explicitly (readOnly also blocks typing).
|
|
1062
|
-
if (isEffectivelyDisabled) {
|
|
1063
|
-
return;
|
|
1064
|
-
}
|
|
1065
|
-
const text = e.target.value;
|
|
1066
|
-
setDatePendingInput(text);
|
|
1067
|
-
|
|
1068
|
-
const parsed = parseDateInput(text, locale);
|
|
1069
|
-
if (
|
|
1070
|
-
parsed &&
|
|
1071
|
-
plainDateToISO(parsed) !== valueParts.date &&
|
|
1072
|
-
!isDateDisabled(parsed)
|
|
1073
|
-
) {
|
|
1074
|
-
const parsedISO = plainDateToISO(parsed);
|
|
1075
|
-
lastFiredDateRef.current = parsedISO;
|
|
1076
|
-
handleDateChange(parsedISO, 'input');
|
|
1077
|
-
calendarRef.current?.navigateTo(parsedISO);
|
|
1078
|
-
}
|
|
1095
|
+
handleTypedDateInput(e.target.value);
|
|
1079
1096
|
},
|
|
1080
|
-
[
|
|
1081
|
-
valueParts.date,
|
|
1082
|
-
isDateDisabled,
|
|
1083
|
-
handleDateChange,
|
|
1084
|
-
isEffectivelyDisabled,
|
|
1085
|
-
locale,
|
|
1086
|
-
],
|
|
1097
|
+
[handleTypedDateInput],
|
|
1087
1098
|
);
|
|
1088
1099
|
|
|
1089
|
-
const commitDatePendingInput = useCallback(() => {
|
|
1090
|
-
if (datePendingInput === null) {
|
|
1091
|
-
return;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
if (!datePendingInput.trim()) {
|
|
1095
|
-
if (value !== undefined) {
|
|
1096
|
-
fireChange(undefined);
|
|
1097
|
-
}
|
|
1098
|
-
setDatePendingInput(null);
|
|
1099
|
-
return;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
const parsed = parseDateInput(datePendingInput, locale);
|
|
1103
|
-
if (parsed && !isDateDisabled(parsed)) {
|
|
1104
|
-
const parsedISO = plainDateToISO(parsed);
|
|
1105
|
-
if (parsedISO !== valueParts.date) {
|
|
1106
|
-
handleDateChange(parsedISO, 'input');
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
setDatePendingInput(null);
|
|
1110
|
-
}, [
|
|
1111
|
-
datePendingInput,
|
|
1112
|
-
value,
|
|
1113
|
-
valueParts.date,
|
|
1114
|
-
fireChange,
|
|
1115
|
-
isDateDisabled,
|
|
1116
|
-
handleDateChange,
|
|
1117
|
-
locale,
|
|
1118
|
-
]);
|
|
1119
|
-
|
|
1120
|
-
const handleDateBlur = useCallback(() => {
|
|
1121
|
-
commitDatePendingInput();
|
|
1122
|
-
}, [commitDatePendingInput]);
|
|
1123
|
-
|
|
1124
1100
|
const handleDateKeyDown = useCallback(
|
|
1125
1101
|
(e: React.KeyboardEvent) => {
|
|
1126
1102
|
// Guard the composing keydown (fires before compositionend): an IME uses
|
|
@@ -1145,7 +1121,7 @@ function PointerDateTimeField({
|
|
|
1145
1121
|
}
|
|
1146
1122
|
} else if (
|
|
1147
1123
|
e.key === 'Enter' &&
|
|
1148
|
-
(
|
|
1124
|
+
(isDatePending || isEffectivelyDisabled)
|
|
1149
1125
|
) {
|
|
1150
1126
|
// Typed text holds Enter back, or a form would submit the value from
|
|
1151
1127
|
// before the commit. A disabled or busy field must not submit its
|
|
@@ -1154,7 +1130,7 @@ function PointerDateTimeField({
|
|
|
1154
1130
|
commitDatePendingInput();
|
|
1155
1131
|
}
|
|
1156
1132
|
},
|
|
1157
|
-
[popover, commitDatePendingInput, isEffectivelyDisabled,
|
|
1133
|
+
[popover, commitDatePendingInput, isEffectivelyDisabled, isDatePending],
|
|
1158
1134
|
);
|
|
1159
1135
|
|
|
1160
1136
|
// --- Time-option popover (#2727) ---
|
|
@@ -1460,6 +1436,7 @@ function PointerDateTimeField({
|
|
|
1460
1436
|
timePopover.id,
|
|
1461
1437
|
)
|
|
1462
1438
|
) {
|
|
1439
|
+
noteOutsideDismissal(e.currentTarget.ownerDocument);
|
|
1463
1440
|
timePopover.hide();
|
|
1464
1441
|
}
|
|
1465
1442
|
|
|
@@ -1676,11 +1653,11 @@ function PointerDateTimeField({
|
|
|
1676
1653
|
isRequired={isRequired}
|
|
1677
1654
|
isDisabled={isDisabled}
|
|
1678
1655
|
status={
|
|
1679
|
-
|
|
1656
|
+
fieldStatus
|
|
1680
1657
|
? {
|
|
1681
|
-
type:
|
|
1682
|
-
message:
|
|
1683
|
-
messageID:
|
|
1658
|
+
type: fieldStatus.type,
|
|
1659
|
+
message: fieldStatus.message,
|
|
1660
|
+
messageID: fieldStatus.message ? statusMessageID : undefined,
|
|
1684
1661
|
}
|
|
1685
1662
|
: undefined
|
|
1686
1663
|
}
|
|
@@ -1692,7 +1669,7 @@ function PointerDateTimeField({
|
|
|
1692
1669
|
{...mergeProps(
|
|
1693
1670
|
themeProps('date-time-input', {
|
|
1694
1671
|
size,
|
|
1695
|
-
status:
|
|
1672
|
+
status: fieldStatus?.type ?? null,
|
|
1696
1673
|
disabled: isDisabled ? 'disabled' : null,
|
|
1697
1674
|
}),
|
|
1698
1675
|
stylex.props(
|
|
@@ -1709,7 +1686,7 @@ function PointerDateTimeField({
|
|
|
1709
1686
|
{...mergeProps(
|
|
1710
1687
|
themeProps('date-time-input-date-segment', {
|
|
1711
1688
|
size,
|
|
1712
|
-
status:
|
|
1689
|
+
status: fieldStatus?.type ?? null,
|
|
1713
1690
|
}),
|
|
1714
1691
|
stylex.props(
|
|
1715
1692
|
inputWrapperStyles.base,
|
|
@@ -1717,11 +1694,11 @@ function PointerDateTimeField({
|
|
|
1717
1694
|
styles.dateWrapper,
|
|
1718
1695
|
isEffectivelyDisabled && inputWrapperStyles.disabled,
|
|
1719
1696
|
isEffectivelyDisabled && inputDisabledFocusStyles.withinRing,
|
|
1720
|
-
|
|
1721
|
-
|
|
1697
|
+
fieldStatus && inputStatusBorderStyles[fieldStatus.type],
|
|
1698
|
+
fieldStatus &&
|
|
1722
1699
|
!isEffectivelyDisabled &&
|
|
1723
|
-
inputStatusHoverShadowStyles[
|
|
1724
|
-
|
|
1700
|
+
inputStatusHoverShadowStyles[fieldStatus.type],
|
|
1701
|
+
fieldStatus && inputStatusFocusWithinStyles[fieldStatus.type],
|
|
1725
1702
|
),
|
|
1726
1703
|
)}>
|
|
1727
1704
|
{usesNativePicker ? (
|
|
@@ -1744,6 +1721,7 @@ function PointerDateTimeField({
|
|
|
1744
1721
|
...controlProps,
|
|
1745
1722
|
'aria-labelledby': controlLabelledBy,
|
|
1746
1723
|
onBlur: onBlurProp,
|
|
1724
|
+
onFocus: onFocusProp,
|
|
1747
1725
|
onClick: isEffectivelyDisabled ? undefined : onClickProp,
|
|
1748
1726
|
onKeyDown: onKeyDownProp,
|
|
1749
1727
|
}}
|
|
@@ -1794,6 +1772,7 @@ function PointerDateTimeField({
|
|
|
1794
1772
|
value={dateDisplayValue}
|
|
1795
1773
|
onChange={handleDateInputChange}
|
|
1796
1774
|
onBlur={chainEventHandlers(handleDateBlur, onBlurProp)}
|
|
1775
|
+
onFocus={chainEventHandlers(handleDateFocus, onFocusProp)}
|
|
1797
1776
|
onClick={
|
|
1798
1777
|
isEffectivelyDisabled
|
|
1799
1778
|
? undefined
|
|
@@ -1801,13 +1780,13 @@ function PointerDateTimeField({
|
|
|
1801
1780
|
}
|
|
1802
1781
|
onKeyDown={chainEventHandlers(handleDateKeyDown, onKeyDownProp)}
|
|
1803
1782
|
aria-labelledby={controlLabelledBy}
|
|
1804
|
-
placeholder={placeholder}
|
|
1783
|
+
placeholder={dateFormatHint ?? placeholder}
|
|
1805
1784
|
aria-disabled={isEffectivelyDisabled ? 'true' : undefined}
|
|
1806
1785
|
readOnly={isEffectivelyDisabled || undefined}
|
|
1807
1786
|
aria-describedby={ariaDescribedBy}
|
|
1808
1787
|
aria-required={isEffectivelyRequired ? 'true' : undefined}
|
|
1809
1788
|
aria-invalid={
|
|
1810
|
-
|
|
1789
|
+
fieldStatus?.type === 'error' || isDateInvalid
|
|
1811
1790
|
? 'true'
|
|
1812
1791
|
: undefined
|
|
1813
1792
|
}
|
|
@@ -1820,18 +1799,21 @@ function PointerDateTimeField({
|
|
|
1820
1799
|
{...stylex.props(
|
|
1821
1800
|
styles.input,
|
|
1822
1801
|
isEffectivelyDisabled && styles.inputDisabled,
|
|
1823
|
-
|
|
1802
|
+
isDateInvalid && styles.inputInvalid,
|
|
1824
1803
|
)}
|
|
1825
1804
|
/>
|
|
1826
1805
|
{/*
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
screen-reader user would get no feedback that their entry was
|
|
1830
|
-
rejected (WCAG 3.3.1).
|
|
1806
|
+
Announces a typed date rejection that the field status does not
|
|
1807
|
+
announce. The field status announces the rest.
|
|
1831
1808
|
*/}
|
|
1832
1809
|
<VisuallyHidden as="div" role="alert" aria-live="assertive">
|
|
1833
|
-
{
|
|
1810
|
+
{dateAlertMessage}
|
|
1834
1811
|
</VisuallyHidden>
|
|
1812
|
+
{isRenderable(typedDate.calendarDescription) && (
|
|
1813
|
+
<VisuallyHidden id={calendarDescriptionID}>
|
|
1814
|
+
{typedDate.calendarDescription}
|
|
1815
|
+
</VisuallyHidden>
|
|
1816
|
+
)}
|
|
1835
1817
|
</>
|
|
1836
1818
|
)}
|
|
1837
1819
|
{hasClear && value !== undefined && !isEffectivelyDisabled && (
|
|
@@ -1977,9 +1959,13 @@ function PointerDateTimeField({
|
|
|
1977
1959
|
!popover.isOpen ? null : (
|
|
1978
1960
|
<Calendar
|
|
1979
1961
|
handleRef={calendarRef}
|
|
1962
|
+
calendar={typedDate.calendar}
|
|
1980
1963
|
mode="single"
|
|
1981
1964
|
value={valueParts.date ?? null}
|
|
1982
|
-
onChange={(d: ISODateString) =>
|
|
1965
|
+
onChange={(d: ISODateString) => {
|
|
1966
|
+
handleDateChange(d, 'calendar');
|
|
1967
|
+
resetTypedDate();
|
|
1968
|
+
}}
|
|
1983
1969
|
min={calendarMin}
|
|
1984
1970
|
max={calendarMax}
|
|
1985
1971
|
dateConstraints={dateConstraints}
|
|
@@ -2065,7 +2051,9 @@ export function DateTimeInput(props: DateTimeInputProps) {
|
|
|
2065
2051
|
'`nativePicker` is deprecated; use `presentation` instead (`touch` → `adaptive-native`, `always` → `native`, `never` → `adaptive-bottom-sheet`). `presentation` wins when both are set.',
|
|
2066
2052
|
props.nativePicker !== undefined,
|
|
2067
2053
|
);
|
|
2068
|
-
const effective =
|
|
2054
|
+
const {calendar, presentation: effective} = useCalendarPresentation(
|
|
2055
|
+
'DateTimeInput',
|
|
2056
|
+
props.calendar,
|
|
2069
2057
|
props.presentation,
|
|
2070
2058
|
props.nativePicker,
|
|
2071
2059
|
);
|
|
@@ -2079,6 +2067,7 @@ export function DateTimeInput(props: DateTimeInputProps) {
|
|
|
2079
2067
|
// field's resting text, preset times, and the sheet wheels agree.
|
|
2080
2068
|
const rest = {
|
|
2081
2069
|
...surfaceProps,
|
|
2070
|
+
calendar,
|
|
2082
2071
|
hourFormat: resolveHourFormat(locale, props.hourFormat),
|
|
2083
2072
|
};
|
|
2084
2073
|
if (effective === 'native') {
|
|
@@ -2098,7 +2087,8 @@ export function DateTimeInput(props: DateTimeInputProps) {
|
|
|
2098
2087
|
// Only `adaptive-native` on a coarse pointer resolves here (FR2).
|
|
2099
2088
|
return <PointerDateTimeField {...rest} nativeMode="adaptive" />;
|
|
2100
2089
|
case 'sheet':
|
|
2101
|
-
|
|
2090
|
+
// Month indexes depend on the calendar. A new calendar remounts the sheet.
|
|
2091
|
+
return <TouchDateTimeField key={calendar} {...rest} />;
|
|
2102
2092
|
case 'desktop':
|
|
2103
2093
|
return <PointerDateTimeField {...rest} />;
|
|
2104
2094
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file TouchDateTimeField.tsx
|
|
7
|
-
* @input Uses React, Field, BottomSheet, SegmentedControl, DateInput month picker primitives, Wheel and the pickers' touch layer (TimeWheels), the touch presentation, StyleX intrinsic flex layout
|
|
7
|
+
* @input Uses React, Field, BottomSheet, SegmentedControl, DateInput month picker primitives, the resolved calendar, Wheel and the pickers' touch layer (TimeWheels), the touch presentation, StyleX intrinsic flex layout
|
|
8
8
|
* @output Exports TouchDateTimeField — the coarse-pointer surface behind DateTimeInput
|
|
9
9
|
* @position Internal component; consumed by DateTimeInput.tsx
|
|
10
10
|
*
|
|
@@ -83,13 +83,16 @@ import {
|
|
|
83
83
|
import {chainEventHandlers} from '../utils/chainEventHandlers';
|
|
84
84
|
import {joinAriaIDs} from '../utils/inputAria';
|
|
85
85
|
import {
|
|
86
|
-
DATE_FORMAT_LONG,
|
|
87
|
-
plainDateFormat,
|
|
88
86
|
plainDateFromISO,
|
|
89
87
|
plainDateToday,
|
|
90
88
|
type PlainDate,
|
|
91
89
|
} from '../utils/plainDate';
|
|
92
|
-
import {
|
|
90
|
+
import {
|
|
91
|
+
calendarDayOfMonth,
|
|
92
|
+
formatCalendarMonthLabel,
|
|
93
|
+
} from '../utils/calendarSystem';
|
|
94
|
+
import {formatCalendarDateText} from '../utils/calendarDateParser';
|
|
95
|
+
import {useCalendarSystem} from '../i18n/useCalendarSystem';
|
|
93
96
|
import {
|
|
94
97
|
MonthScroller,
|
|
95
98
|
type MonthScrollerHandle,
|
|
@@ -114,8 +117,7 @@ import {
|
|
|
114
117
|
import {
|
|
115
118
|
DEFAULT_MONTH_REACH,
|
|
116
119
|
clampIndex,
|
|
117
|
-
|
|
118
|
-
monthIndexOf,
|
|
120
|
+
createMonthModel,
|
|
119
121
|
} from '../DateInput/monthGeometry';
|
|
120
122
|
import type {DateTimeInputProps, ISODateTimeString} from './DateTimeInput';
|
|
121
123
|
import {
|
|
@@ -448,6 +450,7 @@ export function TouchDateTimeField({
|
|
|
448
450
|
// Desktop-only: the touch Date panel shows one swipe-paged month at a time.
|
|
449
451
|
numberOfMonths: _numberOfMonths,
|
|
450
452
|
weekStartsOn: weekStartsOnProp = 0,
|
|
453
|
+
calendar: calendarProp,
|
|
451
454
|
width,
|
|
452
455
|
containerXstyle,
|
|
453
456
|
containerClassName,
|
|
@@ -578,6 +581,8 @@ export function TouchDateTimeField({
|
|
|
578
581
|
[timeForWheels],
|
|
579
582
|
);
|
|
580
583
|
const weekStartsOn = normalizeDayOfWeek(weekStartsOnProp);
|
|
584
|
+
const calendar = useCalendarSystem(calendarProp, 'DateTimeInput');
|
|
585
|
+
const monthModel = useMemo(() => createMonthModel(calendar), [calendar]);
|
|
581
586
|
|
|
582
587
|
// The draft follows the controlled time, and an external clear resets it.
|
|
583
588
|
// Adjusted during render when the value changes, so no commit paints the
|
|
@@ -599,16 +604,18 @@ export function TouchDateTimeField({
|
|
|
599
604
|
}
|
|
600
605
|
}
|
|
601
606
|
|
|
607
|
+
// Indexes belong to the calendar, so DateTimeInput remounts this surface
|
|
608
|
+
// when the calendar changes.
|
|
602
609
|
const [anchorMonthIndex] = useState(() =>
|
|
603
|
-
|
|
610
|
+
monthModel.indexOf(selectedDate ?? plainDateToday()),
|
|
604
611
|
);
|
|
605
612
|
const minMonthIndex =
|
|
606
613
|
calendarMin != null
|
|
607
|
-
?
|
|
614
|
+
? monthModel.indexOf(plainDateFromISO(calendarMin))
|
|
608
615
|
: anchorMonthIndex - DEFAULT_MONTH_REACH;
|
|
609
616
|
const maxMonthIndex =
|
|
610
617
|
calendarMax != null
|
|
611
|
-
?
|
|
618
|
+
? monthModel.indexOf(plainDateFromISO(calendarMax))
|
|
612
619
|
: anchorMonthIndex + DEFAULT_MONTH_REACH;
|
|
613
620
|
const [monthIndex, setMonthIndex] = useState(() =>
|
|
614
621
|
clampIndex(anchorMonthIndex, minMonthIndex, maxMonthIndex),
|
|
@@ -626,7 +633,6 @@ export function TouchDateTimeField({
|
|
|
626
633
|
if (!Object.is(clampedMonthIndex, monthIndex)) {
|
|
627
634
|
setMonthIndex(clampedMonthIndex);
|
|
628
635
|
}
|
|
629
|
-
const {year, month} = fromMonthIndex(monthIndex);
|
|
630
636
|
const canStepBack = monthIndex > minMonthIndex;
|
|
631
637
|
const canStepForward = monthIndex < maxMonthIndex;
|
|
632
638
|
|
|
@@ -634,17 +640,23 @@ export function TouchDateTimeField({
|
|
|
634
640
|
() => getWeekdayHeaders(locale, weekStartsOn),
|
|
635
641
|
[locale, weekStartsOn],
|
|
636
642
|
);
|
|
637
|
-
|
|
638
|
-
|
|
643
|
+
// The day the picker keeps: the selected date's day of its month. A month
|
|
644
|
+
// with an era change takes its heading era from this day.
|
|
645
|
+
const keptDay =
|
|
646
|
+
selectedDate == null ? 1 : calendarDayOfMonth(calendar, selectedDate);
|
|
647
|
+
const monthYearLabel = formatCalendarMonthLabel(
|
|
648
|
+
calendar,
|
|
649
|
+
monthModel.monthAt(monthIndex),
|
|
639
650
|
locale,
|
|
651
|
+
keptDay,
|
|
640
652
|
);
|
|
641
653
|
|
|
642
654
|
const dateDisplayValue = useMemo(() => {
|
|
643
655
|
if (selectedDate == null) {
|
|
644
656
|
return '';
|
|
645
657
|
}
|
|
646
|
-
return
|
|
647
|
-
}, [selectedDate, locale]);
|
|
658
|
+
return formatCalendarDateText(selectedDate, 'date_long', locale, calendar);
|
|
659
|
+
}, [calendar, selectedDate, locale]);
|
|
648
660
|
|
|
649
661
|
const timeDisplayValue = useMemo(() => {
|
|
650
662
|
const displayTime = normalizedValueTime ?? draftTime;
|
|
@@ -753,13 +765,13 @@ export function TouchDateTimeField({
|
|
|
753
765
|
const handleResetInSheet = useCallback(() => {
|
|
754
766
|
fireChange(undefined);
|
|
755
767
|
setDraftTime(undefined);
|
|
756
|
-
const currentMonth =
|
|
768
|
+
const currentMonth = monthModel.indexOf(today);
|
|
757
769
|
if (currentMonth < minMonthIndex || currentMonth > maxMonthIndex) {
|
|
758
770
|
return;
|
|
759
771
|
}
|
|
760
772
|
setMonthIndex(currentMonth);
|
|
761
773
|
scrollerHandleRef.current?.scrollToMonth(currentMonth, 'smooth');
|
|
762
|
-
}, [fireChange, today, minMonthIndex, maxMonthIndex]);
|
|
774
|
+
}, [fireChange, monthModel, today, minMonthIndex, maxMonthIndex]);
|
|
763
775
|
|
|
764
776
|
const handleDateSelect = useCallback(
|
|
765
777
|
(nextDate: ISODateString) => {
|
|
@@ -1041,6 +1053,7 @@ export function TouchDateTimeField({
|
|
|
1041
1053
|
<MonthScroller
|
|
1042
1054
|
key={`${minMonthIndex}:${maxMonthIndex}`}
|
|
1043
1055
|
handleRef={scrollerHandleRef}
|
|
1056
|
+
monthModel={monthModel}
|
|
1044
1057
|
minMonthIndex={minMonthIndex}
|
|
1045
1058
|
maxMonthIndex={maxMonthIndex}
|
|
1046
1059
|
initialMonthIndex={monthIndex}
|
|
@@ -1086,7 +1099,9 @@ export function TouchDateTimeField({
|
|
|
1086
1099
|
{...stylex.props(styles.touchWheelSpacer)}
|
|
1087
1100
|
/>
|
|
1088
1101
|
<MonthYearWheels
|
|
1102
|
+
monthModel={monthModel}
|
|
1089
1103
|
monthIndex={monthIndex}
|
|
1104
|
+
keptDay={keptDay}
|
|
1090
1105
|
minMonthIndex={minMonthIndex}
|
|
1091
1106
|
maxMonthIndex={maxMonthIndex}
|
|
1092
1107
|
onChange={next => {
|
|
@@ -69,7 +69,7 @@ export const docs = {
|
|
|
69
69
|
],
|
|
70
70
|
},
|
|
71
71
|
description:
|
|
72
|
-
'Modal dialog using the native <dialog> element. Modal and inline content starts with theme body text defaults. Ancestor surface/group membership ends as a whole, including group-owned state. Explicit props and unrelated contexts remain unchanged. Place intentional groups and complete required providers inside the dialog. With reduced motion the dialog never slides or scales in: on a touch screen it fades in, in 200 ms or less, and with a mouse it appears at once.',
|
|
72
|
+
'Modal dialog using the native <dialog> element. Modal and inline content starts with theme body text defaults. Ancestor surface/group membership ends as a whole, including group-owned state. Explicit props and unrelated contexts remain unchanged. Place intentional groups and complete required providers inside the dialog. With reduced motion the dialog never slides or scales in: on a touch screen it fades in, in 200 ms or less, and with a mouse it appears at once. On a phone or tablet (a coarse primary pointer), a tap or a drag that lands while the dialog is still entering reaches nothing, and the dialog finishes entering; keys and assistive technology stay live, and a mouse or a trackpad still clicks: at once when it was the last pointer used, otherwise once it moves.',
|
|
73
73
|
props: [
|
|
74
74
|
{
|
|
75
75
|
name: 'isOpen',
|