@astryxdesign/core 0.7.8 → 0.7.9-canary.07992bb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppShell/observeMainOverflow.d.ts.map +1 -1
- package/dist/AppShell/observeMainOverflow.js +9 -6
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +5 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +40 -8
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +61 -21
- package/dist/Calendar/Calendar.d.ts +14 -2
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +63 -74
- package/dist/Calendar/getInitialFocusDate.d.ts +4 -1
- package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -1
- package/dist/Calendar/getInitialFocusDate.js +7 -5
- package/dist/Calendar/hooks/useCalendarDays.d.ts +19 -2
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +57 -64
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts +28 -3
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +33 -22
- package/dist/Calendar/styles.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +54 -11
- package/dist/ClickableCard/ClickableCard.d.ts +1 -1
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +5 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +4 -1
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +7 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +5 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +4 -1
- package/dist/Dialog/Dialog.d.ts +2 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +12 -1
- package/dist/Drawer/useDrawerDialogPresence.d.ts +2 -1
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +11 -2
- package/dist/DropdownMenu/DropdownMenu.d.ts +9 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +9 -4
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -2
- package/dist/Field/inputDisabledFocus.d.ts +4 -4
- package/dist/Field/inputStyles.stylex.d.ts +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +16 -2
- package/dist/HoverCard/useHoverCard.d.ts +3 -1
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/Icon/Icon.d.ts +1 -1
- package/dist/InfoTip/InfoTip.d.ts +1 -0
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +1 -0
- package/dist/InputGroup/InputGroup.d.ts +4 -3
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +2 -2
- package/dist/InputGroup/groupStyles.d.ts +1 -1
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +1 -1
- package/dist/Item/Item.d.ts +2 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +29 -6
- package/dist/Layer/holdEntranceInput.d.ts +24 -0
- package/dist/Layer/holdEntranceInput.d.ts.map +1 -0
- package/dist/Layer/holdEntranceInput.js +65 -0
- package/dist/Layer/inputHold.d.ts +49 -0
- package/dist/Layer/inputHold.d.ts.map +1 -0
- package/dist/Layer/inputHold.js +636 -0
- package/dist/Layer/preserveAnimations.d.ts +1 -5
- package/dist/Layer/preserveAnimations.d.ts.map +1 -1
- package/dist/Layer/preserveAnimations.js +12 -214
- package/dist/Layer/useLayer.d.ts +3 -1
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +64 -4
- package/dist/Layout/LayoutContent.d.ts +3 -1
- package/dist/Layout/LayoutContent.d.ts.map +1 -1
- package/dist/Layout/LayoutContent.js +12 -4
- package/dist/Layout/LayoutPanel.d.ts +4 -1
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.js +13 -4
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +4 -0
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/MobileNav/MobileNav.d.ts +11 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +39 -1
- package/dist/MoreMenu/MoreMenu.d.ts +5 -3
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.d.ts +4 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +244 -11
- package/dist/Popover/usePopover.d.ts +1 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +12 -5
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +4 -2
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +9 -3
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +14 -11
- package/dist/PowerSearch/formatTokenValue.d.ts +6 -2
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatTokenValue.js +6 -3
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +22 -4
- package/dist/SelectableCard/SelectableCard.d.ts +1 -1
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +5 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +14 -71
- package/dist/Spinner/index.d.ts +1 -1
- package/dist/Spinner/index.d.ts.map +1 -1
- package/dist/Spinner/spinnerRotor.d.ts +28 -0
- package/dist/Spinner/spinnerRotor.d.ts.map +1 -0
- package/dist/Spinner/spinnerRotor.js +98 -0
- package/dist/Stack/StackItem.d.ts +8 -4
- package/dist/Stack/StackItem.d.ts.map +1 -1
- package/dist/Stack/StackItem.js +17 -4
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +13 -10
- package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +14 -8
- package/dist/Timestamp/formatInstant.d.ts +10 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +13 -27
- package/dist/Timestamp/tooltipEntries.d.ts +5 -3
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +6 -4
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +9 -0
- package/dist/Token/TokenLink.d.ts +1 -1
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +4 -1
- package/dist/Tokenizer/Tokenizer.d.ts +14 -10
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +189 -89
- package/dist/Tooltip/useTooltip.d.ts +3 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +162 -59
- package/dist/TreeList/TreeListItem.d.ts +2 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +27 -3
- package/dist/astryx.css +45 -18
- package/dist/gestures/GestureHost.d.ts +2 -2
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +21 -6
- package/dist/gestures/PanGestureRecognizer.d.ts +11 -1
- package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PanGestureRecognizer.js +15 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +6 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.d.ts +3 -6
- package/dist/gestures/nativeScroll.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.js +7 -52
- package/dist/gestures/wheelSegmenter.d.ts +68 -1
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
- package/dist/gestures/wheelSegmenter.js +199 -10
- package/dist/hooks/StackItemScrollRegion.d.ts +31 -0
- package/dist/hooks/StackItemScrollRegion.d.ts.map +1 -0
- package/dist/hooks/StackItemScrollRegion.js +40 -0
- package/dist/hooks/menuPressGesture.d.ts +133 -21
- package/dist/hooks/menuPressGesture.d.ts.map +1 -1
- package/dist/hooks/menuPressGesture.js +155 -30
- package/dist/hooks/menuPressValues.d.ts +16 -0
- package/dist/hooks/menuPressValues.d.ts.map +1 -0
- package/dist/hooks/menuPressValues.js +18 -0
- package/dist/hooks/useClickableContainer.d.ts +27 -5
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +41 -5
- package/dist/hooks/useFocusTrap.d.ts +10 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +225 -132
- package/dist/hooks/useMenuPress.d.ts +34 -1
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +93 -5
- package/dist/hooks/usePressFeedback.d.ts +6 -6
- package/dist/hooks/usePressFeedback.js +6 -6
- package/dist/hooks/useScrollRegionProps.d.ts +35 -0
- package/dist/hooks/useScrollRegionProps.d.ts.map +1 -0
- package/dist/hooks/useScrollRegionProps.js +51 -0
- package/dist/i18n/InternationalizationContext.d.ts +6 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.d.ts +21 -3
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +8 -3
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts +8 -0
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.js +12 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/useCalendarSystem.d.ts +19 -0
- package/dist/i18n/useCalendarSystem.d.ts.map +1 -0
- package/dist/i18n/useCalendarSystem.js +61 -0
- package/dist/internal/spinner-rotor.d.ts +16 -0
- package/dist/internal/spinner-rotor.d.ts.map +1 -0
- package/dist/internal/spinner-rotor.js +16 -0
- package/dist/internal/touch.d.ts +14 -1
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +20 -2
- package/dist/motion/carryAnimations.d.ts +58 -0
- package/dist/motion/carryAnimations.d.ts.map +1 -0
- package/dist/motion/carryAnimations.js +305 -0
- package/dist/motion/transientCopy.d.ts +4 -2
- package/dist/motion/transientCopy.d.ts.map +1 -1
- package/dist/motion/transientCopy.js +34 -5
- package/dist/motion/uikit/gestures.d.ts +41 -0
- package/dist/motion/uikit/gestures.d.ts.map +1 -1
- package/dist/motion/uikit/gestures.js +25 -0
- package/dist/motion/uikit/index.d.ts +1 -1
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +1 -1
- package/dist/motion/uikit/timing.d.ts +14 -10
- package/dist/motion/uikit/timing.d.ts.map +1 -1
- package/dist/motion/uikit/timing.js +7 -5
- package/dist/privateAttributes/menuPressLit.stylex.d.ts +52 -0
- package/dist/privateAttributes/menuPressLit.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/menuPressLit.stylex.js +99 -0
- package/dist/privateAttributes/press.stylex.d.ts +139 -0
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/press.stylex.js +97 -0
- package/dist/theme/themeMotion.d.ts +3 -2
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +3 -2
- package/dist/theme/tokens.stylex.d.ts +2 -2
- package/dist/theme/tokens.stylex.js +1 -1
- package/dist/utils/calendarSystem.d.ts +114 -0
- package/dist/utils/calendarSystem.d.ts.map +1 -0
- package/dist/utils/calendarSystem.js +386 -0
- package/dist/utils/flatTree.d.ts +6 -3
- package/dist/utils/flatTree.d.ts.map +1 -1
- package/dist/utils/flatTree.js +13 -3
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +82 -5
- package/dist/utils/inputStream.d.ts +14 -1
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +40 -9
- package/dist/utils/interactionOverlay.stylex.d.ts +5 -9
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +29 -31
- package/dist/utils/plainDate.d.ts +23 -7
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +57 -18
- package/dist/utils/pressFeedback.d.ts +10 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +40 -15
- package/dist/utils/pressGesture.d.ts +12 -6
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +26 -8
- package/dist/utils/scrollView.d.ts +25 -0
- package/dist/utils/scrollView.d.ts.map +1 -0
- package/dist/utils/scrollView.js +108 -0
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +1 -10
- package/dist/utils/touchHitArea.stylex.d.ts +35 -0
- package/dist/utils/touchHitArea.stylex.d.ts.map +1 -0
- package/dist/utils/touchHitArea.stylex.js +32 -0
- package/dist/utils/triggerFocus.d.ts +5 -0
- package/dist/utils/triggerFocus.d.ts.map +1 -1
- package/dist/utils/triggerFocus.js +9 -2
- package/locales/en.json +4 -0
- package/locales/pseudo.json +3 -0
- package/package.json +10 -4
- package/src/AppShell/observeMainOverflow.ts +9 -6
- package/src/BottomSheet/BottomSheet.tsx +5 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +64 -7
- package/src/BottomSheet/useSheetGestures.ts +83 -20
- package/src/Calendar/Calendar.doc.mjs +76 -6
- package/src/Calendar/Calendar.tsx +123 -104
- package/src/Calendar/getInitialFocusDate.ts +22 -8
- package/src/Calendar/hooks/useCalendarDays.ts +89 -63
- package/src/Calendar/hooks/useCalendarNavigation.ts +68 -26
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -2
- package/src/CheckboxInput/CheckboxInput.tsx +71 -9
- package/src/ClickableCard/ClickableCard.tsx +8 -1
- package/src/DateInput/DateInput.tsx +2 -0
- package/src/DateInput/PickerWheel.tsx +7 -2
- package/src/DateRangeInput/DateRangeInput.tsx +3 -1
- package/src/DateTimeInput/DateTimeInput.tsx +2 -0
- package/src/Dialog/Dialog.doc.mjs +1 -1
- package/src/Dialog/Dialog.tsx +12 -1
- package/src/Drawer/Drawer.doc.mjs +1 -1
- package/src/Drawer/useDrawerDialogPresence.ts +9 -2
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -2
- package/src/DropdownMenu/DropdownMenu.tsx +29 -5
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -1
- package/src/DropdownMenu/DropdownMenuItem.tsx +8 -4
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -1
- package/src/FileInput/FileInput.tsx +16 -2
- package/src/HoverCard/useHoverCard.tsx +3 -1
- package/src/InfoTip/InfoTip.doc.mjs +26 -2
- package/src/InfoTip/InfoTip.tsx +1 -0
- package/src/InputGroup/InputGroup.doc.mjs +4 -3
- package/src/InputGroup/InputGroup.tsx +4 -3
- package/src/InputGroup/groupStyles.ts +3 -1
- package/src/Item/Item.tsx +51 -9
- package/src/Layer/holdEntranceInput.ts +84 -0
- package/src/Layer/inputHold.ts +734 -0
- package/src/Layer/preserveAnimations.ts +12 -275
- package/src/Layer/useLayer.tsx +77 -4
- package/src/Layout/LayoutContent.doc.mjs +6 -3
- package/src/Layout/LayoutContent.tsx +10 -4
- package/src/Layout/LayoutPanel.doc.mjs +6 -3
- package/src/Layout/LayoutPanel.tsx +11 -4
- package/src/Lightbox/Lightbox.tsx +4 -0
- package/src/MetadataList/MetadataList.tsx +1 -1
- package/src/MobileNav/MobileNav.doc.mjs +3 -3
- package/src/MobileNav/MobileNav.tsx +39 -1
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -4
- package/src/MoreMenu/MoreMenu.tsx +5 -3
- package/src/NumberInput/NumberInput.doc.mjs +1 -1
- package/src/NumberInput/NumberInput.tsx +259 -11
- package/src/Popover/usePopover.tsx +1 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
- package/src/PowerSearch/PowerSearch.tsx +20 -3
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +4 -1
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -11
- package/src/PowerSearch/formatTokenValue.ts +7 -1
- package/src/RadioList/RadioListItem.doc.mjs +3 -2
- package/src/RadioList/RadioListItem.tsx +25 -7
- package/src/SelectableCard/SelectableCard.tsx +8 -1
- package/src/Spinner/Spinner.tsx +7 -89
- package/src/Spinner/index.ts +1 -5
- package/src/Spinner/spinnerRotor.ts +113 -0
- package/src/Stack/Stack.doc.mjs +1 -1
- package/src/Stack/StackItem.tsx +27 -13
- package/src/Switch/Switch.tsx +7 -6
- package/src/Table/plugins/sortable/useTableSortable.tsx +1 -1
- package/src/Timestamp/Timestamp.doc.mjs +3 -3
- package/src/Timestamp/Timestamp.tsx +13 -8
- package/src/Timestamp/formatInstant.ts +49 -28
- package/src/Timestamp/tooltipEntries.ts +7 -3
- package/src/Token/Token.tsx +18 -1
- package/src/Token/TokenLink.tsx +7 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +3 -3
- package/src/Tokenizer/Tokenizer.tsx +252 -115
- package/src/Tooltip/useTooltip.tsx +178 -80
- package/src/TreeList/TreeListItem.tsx +36 -2
- package/src/gestures/GestureHost.ts +21 -5
- package/src/gestures/PanGestureRecognizer.ts +19 -2
- package/src/gestures/README.md +14 -5
- package/src/gestures/ScreenEdgePanGestureRecognizer.ts +6 -1
- package/src/gestures/nativeScroll.ts +12 -68
- package/src/gestures/wheelSegmenter.ts +243 -10
- package/src/hooks/StackItemScrollRegion.tsx +57 -0
- package/src/hooks/menuPressGesture.ts +244 -38
- package/src/hooks/menuPressValues.ts +18 -0
- package/src/hooks/useClickableContainer.doc.mjs +8 -2
- package/src/hooks/useClickableContainer.ts +72 -6
- package/src/hooks/useFocusTrap.ts +268 -151
- package/src/hooks/useMenuPress.ts +118 -11
- package/src/hooks/usePressFeedback.doc.mjs +3 -3
- package/src/hooks/usePressFeedback.ts +6 -6
- package/src/hooks/useScrollRegionProps.ts +76 -0
- package/src/i18n/InternationalizationContext.ts +6 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +29 -1
- package/src/i18n/InternationalizationProvider.tsx +33 -3
- package/src/i18n/generated-english/hooks/useScrollRegionProps.generated.ts +13 -0
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/useCalendarSystem.ts +95 -0
- package/src/internal/spinner-rotor.ts +20 -0
- package/src/internal/touch.ts +34 -1
- package/src/motion/MEASUREMENTS.md +11 -0
- package/src/motion/carryAnimations.ts +389 -0
- package/src/motion/transientCopy.ts +45 -5
- package/src/motion/uikit/gestures.ts +22 -0
- package/src/motion/uikit/index.ts +1 -0
- package/src/motion/uikit/timing.ts +7 -5
- package/src/privateAttributes/menuPressLit.stylex.ts +104 -0
- package/src/privateAttributes/press.stylex.ts +243 -0
- package/src/theme/themeMotion.ts +3 -2
- package/src/theme/tokens.stylex.ts +1 -1
- package/src/utils/calendarSystem.ts +548 -0
- package/src/utils/flatTree.ts +15 -3
- package/src/utils/hitArea.ts +107 -5
- package/src/utils/inputStream.ts +47 -10
- package/src/utils/interactionOverlay.stylex.ts +19 -22
- package/src/utils/plainDate.ts +84 -19
- package/src/utils/pressFeedback.ts +46 -14
- package/src/utils/pressGesture.ts +35 -9
- package/src/utils/scrollView.ts +135 -0
- package/src/utils/selectionLock.ts +5 -10
- package/src/utils/touchHitArea.stylex.ts +41 -0
- package/src/utils/triggerFocus.ts +17 -4
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useCalendarDays.ts
|
|
7
|
-
* @input Uses React useMemo, useLocale, PlainDate
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
7
|
+
* @input Uses React useMemo, useLocale, PlainDate and calendar-system
|
|
8
|
+
* utilities, generated CLDR weekday data
|
|
9
|
+
* @output Exports useCalendarDays, the day grid of one month of any calendar
|
|
10
|
+
* system (Gregorian by default)
|
|
11
|
+
* @position Calendar-specific hook; used by Calendar and MonthScroller
|
|
10
12
|
*
|
|
11
13
|
* SYNC: When modified, update:
|
|
12
14
|
* - /packages/core/src/Calendar/hooks/index.ts
|
|
@@ -17,12 +19,17 @@ import type {DayOfWeek, ISODateString} from '../../utils/dateTypes';
|
|
|
17
19
|
import {
|
|
18
20
|
type PlainDate,
|
|
19
21
|
plainDateToISO,
|
|
20
|
-
getDaysInMonth,
|
|
21
22
|
plainDateDayOfWeek,
|
|
22
23
|
plainDateAddDays,
|
|
23
24
|
} from '../../utils/plainDate';
|
|
24
25
|
import {useLocale} from '../../i18n';
|
|
25
26
|
import {getWeekdayHeaderNames} from '../getWeekdayHeaderNames';
|
|
27
|
+
import {
|
|
28
|
+
type CalendarSystem,
|
|
29
|
+
calendarDayOfMonth,
|
|
30
|
+
calendarMonthFromYearMonth,
|
|
31
|
+
} from '../../utils/calendarSystem';
|
|
32
|
+
import {resolveShownCalendar} from '../../i18n/useCalendarSystem';
|
|
26
33
|
|
|
27
34
|
/**
|
|
28
35
|
* Represents a single day in the calendar grid.
|
|
@@ -42,14 +49,27 @@ export interface CalendarDay {
|
|
|
42
49
|
* Configuration for calendar days generation
|
|
43
50
|
*/
|
|
44
51
|
export interface UseCalendarDaysOptions {
|
|
45
|
-
/** The year to generate days for */
|
|
52
|
+
/** The year to generate days for, in `calendar`'s numbering */
|
|
46
53
|
year: number;
|
|
47
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* The month's position in its year (1-based). In the Gregorian calendar,
|
|
56
|
+
* 1 is January and 12 is December. In other calendars it is numbered as
|
|
57
|
+
* `Temporal.PlainDate` numbers it: 1 through 13 in a Hebrew leap year.
|
|
58
|
+
*/
|
|
48
59
|
month: number;
|
|
49
60
|
/** First day of week (0=Sunday through 6=Saturday) */
|
|
50
61
|
weekStartsOn?: DayOfWeek;
|
|
51
62
|
/** Use variable rows per month vs. fixed 6-row grid */
|
|
52
63
|
hasVariableRowCount?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The calendar system that numbers `year`, `month`, and each `dayNumber`.
|
|
66
|
+
* Each day keeps its Gregorian `date` and `iso`. The hook never reads the
|
|
67
|
+
* InternationalizationProvider calendar. Calendars other than gregory,
|
|
68
|
+
* iso8601, buddhist, roc, and japanese need Temporal; without it, the hook
|
|
69
|
+
* reads Gregorian numbers and warns once in development.
|
|
70
|
+
* @default 'gregory'
|
|
71
|
+
*/
|
|
72
|
+
calendar?: CalendarSystem;
|
|
53
73
|
}
|
|
54
74
|
|
|
55
75
|
/**
|
|
@@ -80,71 +100,82 @@ export interface UseCalendarDaysReturn {
|
|
|
80
100
|
* weekStartsOn: 0, // Sunday
|
|
81
101
|
* });
|
|
82
102
|
* // days[i].date is a PlainDate { year, month (1-based), day }
|
|
103
|
+
*
|
|
104
|
+
* // Aban 1405 in the Persian calendar; dates stay Gregorian
|
|
105
|
+
* useCalendarDays({year: 1405, month: 8, calendar: 'persian'});
|
|
83
106
|
* ```
|
|
84
107
|
*/
|
|
85
108
|
export function useCalendarDays(
|
|
86
109
|
options: UseCalendarDaysOptions,
|
|
87
110
|
): UseCalendarDaysReturn {
|
|
88
|
-
const {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
111
|
+
const {
|
|
112
|
+
year,
|
|
113
|
+
month,
|
|
114
|
+
weekStartsOn = 0,
|
|
115
|
+
hasVariableRowCount = false,
|
|
116
|
+
calendar: calendarOption = 'gregory',
|
|
117
|
+
} = options;
|
|
118
|
+
const calendar = resolveShownCalendar(calendarOption, 'useCalendarDays');
|
|
119
|
+
const days = useMemo(() => {
|
|
120
|
+
const calendarMonth = calendarMonthFromYearMonth(calendar, {year, month});
|
|
121
|
+
return layOutMonthDays({
|
|
122
|
+
first: calendarMonth.start,
|
|
123
|
+
length: calendarMonth.length,
|
|
124
|
+
weekStartsOn,
|
|
125
|
+
hasVariableRowCount,
|
|
126
|
+
dayNumberOf: (pd, offset) =>
|
|
127
|
+
offset >= 0 && offset < calendarMonth.length
|
|
128
|
+
? offset + 1
|
|
129
|
+
: calendarDayOfMonth(calendar, pd),
|
|
130
|
+
});
|
|
131
|
+
}, [year, month, calendar, weekStartsOn, hasVariableRowCount]);
|
|
132
|
+
return useMonthGrid(days, weekStartsOn);
|
|
133
|
+
}
|
|
94
134
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
135
|
+
interface MonthLayout {
|
|
136
|
+
first: PlainDate;
|
|
137
|
+
length: number;
|
|
138
|
+
weekStartsOn: DayOfWeek;
|
|
139
|
+
hasVariableRowCount: boolean;
|
|
140
|
+
/** The day number of a grid day, given its offset from the month's first day. */
|
|
141
|
+
dayNumberOf: (pd: PlainDate, offset: number) => number;
|
|
142
|
+
}
|
|
101
143
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
144
|
+
function layOutMonthDays(layout: MonthLayout): CalendarDay[] {
|
|
145
|
+
const {first, length, weekStartsOn, hasVariableRowCount, dayNumberOf} =
|
|
146
|
+
layout;
|
|
147
|
+
let startingDayOfWeek = plainDateDayOfWeek(first) - weekStartsOn;
|
|
148
|
+
if (startingDayOfWeek < 0) {
|
|
149
|
+
startingDayOfWeek += 7;
|
|
150
|
+
}
|
|
151
|
+
const totalRows = hasVariableRowCount
|
|
152
|
+
? Math.ceil((length + startingDayOfWeek) / 7)
|
|
153
|
+
: 6;
|
|
154
|
+
const result: CalendarDay[] = [];
|
|
155
|
+
for (let i = 0; i < totalRows * 7; i++) {
|
|
156
|
+
const offset = i - startingDayOfWeek;
|
|
157
|
+
const pd = plainDateAddDays(first, offset);
|
|
158
|
+
result.push({
|
|
159
|
+
date: pd,
|
|
160
|
+
iso: plainDateToISO(pd),
|
|
161
|
+
isOutside: offset < 0 || offset >= length,
|
|
162
|
+
dayNumber: dayNumberOf(pd, offset),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
106
167
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}, [year, month, weekStartsOn, hasVariableRowCount]);
|
|
168
|
+
function useMonthGrid(
|
|
169
|
+
days: CalendarDay[],
|
|
170
|
+
weekStartsOn: DayOfWeek,
|
|
171
|
+
): UseCalendarDaysReturn {
|
|
172
|
+
const locale = useLocale();
|
|
113
173
|
|
|
114
174
|
const dayNames = useMemo(
|
|
115
175
|
() => getWeekdayHeaderNames(locale, weekStartsOn),
|
|
116
176
|
[locale, weekStartsOn],
|
|
117
177
|
);
|
|
118
178
|
|
|
119
|
-
// Generate days array
|
|
120
|
-
const days = useMemo(() => {
|
|
121
|
-
const {
|
|
122
|
-
daysInMonth: totalDaysInMonth,
|
|
123
|
-
startingDayOfWeek,
|
|
124
|
-
totalCells,
|
|
125
|
-
} = gridInfo;
|
|
126
|
-
const firstOfMonth: PlainDate = {year, month, day: 1};
|
|
127
|
-
const result: CalendarDay[] = [];
|
|
128
|
-
|
|
129
|
-
for (let i = 0; i < totalCells; i++) {
|
|
130
|
-
const dayOffset = i - startingDayOfWeek + 1;
|
|
131
|
-
const isOutside = dayOffset < 1 || dayOffset > totalDaysInMonth;
|
|
132
|
-
const pd: PlainDate = isOutside
|
|
133
|
-
? plainDateAddDays(firstOfMonth, dayOffset - 1)
|
|
134
|
-
: {year, month, day: dayOffset};
|
|
135
|
-
|
|
136
|
-
result.push({
|
|
137
|
-
date: pd,
|
|
138
|
-
iso: plainDateToISO(pd),
|
|
139
|
-
isOutside,
|
|
140
|
-
dayNumber: pd.day,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return result;
|
|
145
|
-
}, [year, month, gridInfo]);
|
|
146
|
-
|
|
147
|
-
// Group days into weeks
|
|
148
179
|
const weeks = useMemo(() => {
|
|
149
180
|
const result: CalendarDay[][] = [];
|
|
150
181
|
for (let i = 0; i < days.length; i += 7) {
|
|
@@ -153,10 +184,5 @@ export function useCalendarDays(
|
|
|
153
184
|
return result;
|
|
154
185
|
}, [days]);
|
|
155
186
|
|
|
156
|
-
return {
|
|
157
|
-
days,
|
|
158
|
-
weeks,
|
|
159
|
-
dayNames,
|
|
160
|
-
totalCells: gridInfo.totalCells,
|
|
161
|
-
};
|
|
187
|
+
return {days, weeks, dayNames, totalCells: days.length};
|
|
162
188
|
}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useCalendarNavigation.ts
|
|
7
|
-
* @input Uses React useState, useMemo, useCallback, useLocale, PlainDate
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
7
|
+
* @input Uses React useState, useMemo, useCallback, useLocale, PlainDate and
|
|
8
|
+
* calendar-system utilities
|
|
9
|
+
* @output Exports useCalendarNavigation hook for month navigation in any
|
|
10
|
+
* calendar system (Gregorian by default)
|
|
11
|
+
* @position Calendar-specific public hook
|
|
10
12
|
*
|
|
11
13
|
* SYNC: When modified, update:
|
|
12
14
|
* - /packages/core/src/Calendar/hooks/index.ts
|
|
@@ -19,12 +21,17 @@ import {
|
|
|
19
21
|
plainDateFromISO,
|
|
20
22
|
plainDateToISO,
|
|
21
23
|
plainDateToday,
|
|
22
|
-
plainDateSetFirstOfMonth,
|
|
23
|
-
plainDateAddMonths,
|
|
24
24
|
plainDateAddDays,
|
|
25
25
|
} from '../../utils/plainDate';
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
type CalendarSystem,
|
|
28
|
+
calendarAddMonths,
|
|
29
|
+
calendarMonthOf,
|
|
30
|
+
calendarYearMonthOf,
|
|
31
|
+
formatCalendarMonthLabel,
|
|
32
|
+
} from '../../utils/calendarSystem';
|
|
27
33
|
import {useLocale} from '../../i18n';
|
|
34
|
+
import {resolveShownCalendar} from '../../i18n/useCalendarSystem';
|
|
28
35
|
|
|
29
36
|
/**
|
|
30
37
|
* Configuration for calendar navigation
|
|
@@ -38,17 +45,31 @@ export interface UseCalendarNavigationOptions {
|
|
|
38
45
|
onFocusDateChange?: (focusDate: ISODateString) => void;
|
|
39
46
|
/** Number of months to display */
|
|
40
47
|
numberOfMonths?: 1 | 2;
|
|
48
|
+
/**
|
|
49
|
+
* The calendar system whose months the hook steps and labels. Dates stay
|
|
50
|
+
* Gregorian ISO. The hook never reads the InternationalizationProvider
|
|
51
|
+
* calendar. Calendars other than gregory, iso8601, buddhist, roc, and
|
|
52
|
+
* japanese need Temporal; without it, the hook steps Gregorian months and
|
|
53
|
+
* warns once in development.
|
|
54
|
+
* @default 'gregory'
|
|
55
|
+
*/
|
|
56
|
+
calendar?: CalendarSystem;
|
|
41
57
|
}
|
|
42
58
|
|
|
43
59
|
/**
|
|
44
60
|
* Return type for useCalendarNavigation hook
|
|
45
61
|
*/
|
|
46
62
|
export interface UseCalendarNavigationReturn {
|
|
47
|
-
/** The
|
|
63
|
+
/** The Gregorian first day of the focus month */
|
|
48
64
|
baseMonth: PlainDate;
|
|
49
|
-
/**
|
|
65
|
+
/** The Gregorian first day of each visible month */
|
|
50
66
|
visibleMonths: PlainDate[];
|
|
51
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* The year and month numbers of each visible month in `calendar`, as
|
|
69
|
+
* `useCalendarDays` reads them with the same `calendar`
|
|
70
|
+
*/
|
|
71
|
+
visibleCalendarMonths: {year: number; month: number}[];
|
|
72
|
+
/** Formatted label for the month header, in `calendar` */
|
|
52
73
|
monthYearLabel: string;
|
|
53
74
|
/** Navigate to previous/next month */
|
|
54
75
|
navigateMonth: (
|
|
@@ -87,6 +108,13 @@ export interface UseCalendarNavigationReturn {
|
|
|
87
108
|
* // Navigate from arrow key (with focus tracking)
|
|
88
109
|
* navigateMonth(1, focusedDate, 1); // horizontal offset
|
|
89
110
|
* navigateMonth(1, focusedDate, 7); // vertical offset
|
|
111
|
+
*
|
|
112
|
+
* // Persian months, laid out by useCalendarDays
|
|
113
|
+
* const nav = useCalendarNavigation({initialValue, calendar: 'persian'});
|
|
114
|
+
* const {weeks} = useCalendarDays({
|
|
115
|
+
* ...nav.visibleCalendarMonths[0],
|
|
116
|
+
* calendar: 'persian',
|
|
117
|
+
* });
|
|
90
118
|
* ```
|
|
91
119
|
*/
|
|
92
120
|
export function useCalendarNavigation(
|
|
@@ -97,8 +125,13 @@ export function useCalendarNavigation(
|
|
|
97
125
|
focusDate: focusDateProp,
|
|
98
126
|
onFocusDateChange,
|
|
99
127
|
numberOfMonths = 1,
|
|
128
|
+
calendar: calendarOption = 'gregory',
|
|
100
129
|
} = options;
|
|
101
130
|
const locale = useLocale();
|
|
131
|
+
const calendar = resolveShownCalendar(
|
|
132
|
+
calendarOption,
|
|
133
|
+
'useCalendarNavigation',
|
|
134
|
+
);
|
|
102
135
|
|
|
103
136
|
// Pending focus target after month navigation
|
|
104
137
|
const [pendingFocus, setPendingFocus] = useState<ISODateString | null>(null);
|
|
@@ -121,32 +154,40 @@ export function useCalendarNavigation(
|
|
|
121
154
|
? plainDateFromISO(focusDateProp)
|
|
122
155
|
: internalFocusDate;
|
|
123
156
|
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
157
|
+
// A controlled focus date is a new object on each render. Key the memo on
|
|
158
|
+
// its ISO string.
|
|
159
|
+
const focusIso = plainDateToISO(focusDate);
|
|
160
|
+
const shownMonths = useMemo(() => {
|
|
161
|
+
const first = calendarMonthOf(calendar, plainDateFromISO(focusIso));
|
|
162
|
+
return Array.from({length: numberOfMonths}, (_, i) =>
|
|
163
|
+
calendarAddMonths(calendar, first, i),
|
|
164
|
+
);
|
|
165
|
+
}, [calendar, focusIso, numberOfMonths]);
|
|
166
|
+
|
|
167
|
+
const visibleMonths = useMemo(
|
|
168
|
+
() => shownMonths.map(month => month.start),
|
|
169
|
+
[shownMonths],
|
|
170
|
+
);
|
|
171
|
+
const baseMonth = visibleMonths[0];
|
|
128
172
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
}, [baseMonth, numberOfMonths]);
|
|
173
|
+
const visibleCalendarMonths = useMemo(
|
|
174
|
+
() => shownMonths.map(month => calendarYearMonthOf(calendar, month)),
|
|
175
|
+
[calendar, shownMonths],
|
|
176
|
+
);
|
|
135
177
|
|
|
136
|
-
//
|
|
137
|
-
// Each month is its own stand-alone label (Calendar FR1).
|
|
178
|
+
// Each month is its own stand-alone label.
|
|
138
179
|
const monthYearLabel = useMemo(
|
|
139
180
|
() =>
|
|
140
|
-
|
|
141
|
-
.map(
|
|
181
|
+
shownMonths
|
|
182
|
+
.map(month => formatCalendarMonthLabel(calendar, month, locale))
|
|
142
183
|
.join(' – '),
|
|
143
|
-
[
|
|
184
|
+
[calendar, shownMonths, locale],
|
|
144
185
|
);
|
|
145
186
|
|
|
146
187
|
// Navigate to previous/next month
|
|
147
188
|
const navigateMonth = useCallback(
|
|
148
189
|
(delta: number, focusedDate?: ISODateString, offset?: number) => {
|
|
149
|
-
const newMonth =
|
|
190
|
+
const newMonth = calendarAddMonths(calendar, shownMonths[0], delta).start;
|
|
150
191
|
const newISO = plainDateToISO(newMonth);
|
|
151
192
|
|
|
152
193
|
// Calculate target focus date if provided
|
|
@@ -164,7 +205,7 @@ export function useCalendarNavigation(
|
|
|
164
205
|
setInternalFocusDate(newMonth);
|
|
165
206
|
}
|
|
166
207
|
},
|
|
167
|
-
[
|
|
208
|
+
[calendar, shownMonths, onFocusDateChange],
|
|
168
209
|
);
|
|
169
210
|
|
|
170
211
|
// Clear pending focus
|
|
@@ -175,6 +216,7 @@ export function useCalendarNavigation(
|
|
|
175
216
|
return {
|
|
176
217
|
baseMonth,
|
|
177
218
|
visibleMonths,
|
|
219
|
+
visibleCalendarMonths,
|
|
178
220
|
monthYearLabel,
|
|
179
221
|
navigateMonth,
|
|
180
222
|
pendingFocus,
|
|
@@ -109,7 +109,7 @@ export const docs = {
|
|
|
109
109
|
name: 'size',
|
|
110
110
|
type: "'sm' | 'md'",
|
|
111
111
|
description:
|
|
112
|
-
'The size of the checkbox. sm for compact layouts, md for default.',
|
|
112
|
+
'The size of the checkbox. sm for compact layouts, md for default. Under a coarse pointer a labelled checkbox’s target grows toward 44 px through an invisible hit area. It never shrinks below the row and stops at half the gap to a closer neighbour; nothing changes size.',
|
|
113
113
|
default: "'md'",
|
|
114
114
|
},
|
|
115
115
|
{
|
|
@@ -361,7 +361,8 @@ export const docsZh = {
|
|
|
361
361
|
{
|
|
362
362
|
name: 'size',
|
|
363
363
|
type: "'sm' | 'md'",
|
|
364
|
-
description:
|
|
364
|
+
description:
|
|
365
|
+
'复选框尺寸。sm 用于紧凑布局,md 为默认。在粗指针(触摸)下,带可见标签的复选框的目标通过不可见的点击区域向 44 px 扩展。它不小于所在行,与相邻控件较近时止于间距的一半;尺寸不变。',
|
|
365
366
|
default: "'md'",
|
|
366
367
|
},
|
|
367
368
|
{
|
|
@@ -24,6 +24,8 @@ import {
|
|
|
24
24
|
useTransition,
|
|
25
25
|
type ChangeEvent,
|
|
26
26
|
type FocusEvent,
|
|
27
|
+
type MouseEvent as ReactMouseEvent,
|
|
28
|
+
type PointerEvent as ReactPointerEvent,
|
|
27
29
|
type ReactNode,
|
|
28
30
|
} from 'react';
|
|
29
31
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -55,6 +57,8 @@ import {useIndicator} from '../Indicator/useIndicator';
|
|
|
55
57
|
import {themeProps} from '../utils/themeProps';
|
|
56
58
|
|
|
57
59
|
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
60
|
+
import {watchHitArea, writeHitInsets} from '../utils/hitArea';
|
|
61
|
+
import {touchHitAreaStyles} from '../utils/touchHitArea.stylex';
|
|
58
62
|
import {
|
|
59
63
|
registerEnglishFallback,
|
|
60
64
|
useComponentTranslator,
|
|
@@ -83,6 +87,10 @@ const styles = stylex.create({
|
|
|
83
87
|
containerLabelHidden: {
|
|
84
88
|
gap: 0,
|
|
85
89
|
},
|
|
90
|
+
// Under a coarse pointer the row contains its hit band.
|
|
91
|
+
hitAreaHost: {
|
|
92
|
+
position: {default: null, '@media (pointer: coarse)': 'relative'},
|
|
93
|
+
},
|
|
86
94
|
// An indicator in another package may not name this row's private press
|
|
87
95
|
// attribute. So the row hands its touch press image down to an indicator
|
|
88
96
|
// that paints its own press, but only in its own press states. A pressed
|
|
@@ -407,6 +415,63 @@ export function CheckboxInput({
|
|
|
407
415
|
useBusyAnnouncement(isBusy, t('@astryx.spinner.loading'), indicatorRef);
|
|
408
416
|
const {focusProps} = useIndicatorFocusRing(indicatorRef);
|
|
409
417
|
|
|
418
|
+
// Under a coarse pointer a labelled checkbox's row grows toward 44 px
|
|
419
|
+
// through an invisible band, and nothing changes size. A label-hidden
|
|
420
|
+
// checkbox is a marker in another component's row, which keeps its target.
|
|
421
|
+
const hasHitArea = !isLabelHidden && !isDisabled && !isReadOnly;
|
|
422
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
423
|
+
// The watch lives as long as the row is attached: the ref's cleanup stops
|
|
424
|
+
// it, and a replaced row starts its own.
|
|
425
|
+
const watchRowHitArea = useCallback(
|
|
426
|
+
(row: HTMLDivElement | null) => {
|
|
427
|
+
if (row == null || !hasHitArea) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
return watchHitArea(row, insets => writeHitInsets(row, insets));
|
|
431
|
+
},
|
|
432
|
+
[hasHitArea],
|
|
433
|
+
);
|
|
434
|
+
// The disabled-message tooltip listens for hover and focus on the whole
|
|
435
|
+
// row, a larger trigger. It anchors on the checkbox itself (below), so it
|
|
436
|
+
// shows next to the control. Its handlers check isEnabled, so the row
|
|
437
|
+
// always attaches them.
|
|
438
|
+
const rowRef = useMergedRefs(
|
|
439
|
+
disabledMessageTooltip.interactionRef,
|
|
440
|
+
watchRowHitArea,
|
|
441
|
+
);
|
|
442
|
+
// Where a press on the row itself began. A browser can move a tap's click
|
|
443
|
+
// onto the row's edge, so the band is judged from the press.
|
|
444
|
+
const pressPointRef = useRef<{x: number; y: number} | null>(null);
|
|
445
|
+
const handleRowPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {
|
|
446
|
+
pressPointRef.current =
|
|
447
|
+
event.target === event.currentTarget
|
|
448
|
+
? {x: event.clientX, y: event.clientY}
|
|
449
|
+
: null;
|
|
450
|
+
};
|
|
451
|
+
// A press that began on the band, outside the row's box, toggles the
|
|
452
|
+
// checkbox, as a tap on the box does. A click from code has no press count
|
|
453
|
+
// (`detail` is 0), so it never toggles from here.
|
|
454
|
+
const handleRowClick = (event: ReactMouseEvent<HTMLDivElement>) => {
|
|
455
|
+
const press = pressPointRef.current;
|
|
456
|
+
pressPointRef.current = null;
|
|
457
|
+
if (
|
|
458
|
+
press == null ||
|
|
459
|
+
event.detail === 0 ||
|
|
460
|
+
event.target !== event.currentTarget
|
|
461
|
+
) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
465
|
+
const isOnBand =
|
|
466
|
+
press.x < box.left ||
|
|
467
|
+
press.x > box.right ||
|
|
468
|
+
press.y < box.top ||
|
|
469
|
+
press.y > box.bottom;
|
|
470
|
+
if (isOnBand) {
|
|
471
|
+
inputRef.current?.click();
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
|
|
410
475
|
const isIndeterminate = optimisticValue === 'indeterminate';
|
|
411
476
|
const isChecked = optimisticValue === true;
|
|
412
477
|
|
|
@@ -455,19 +520,15 @@ export function CheckboxInput({
|
|
|
455
520
|
style,
|
|
456
521
|
)}>
|
|
457
522
|
<div
|
|
458
|
-
ref={
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
// positioning anchors on the checkbox itself (below) so the tooltip
|
|
462
|
-
// appears next to the control, not the far edge of the row.
|
|
463
|
-
// Handlers are gated internally by isEnabled, so attaching
|
|
464
|
-
// unconditionally is safe.
|
|
465
|
-
disabledMessageTooltip.interactionRef(el);
|
|
466
|
-
}}
|
|
523
|
+
ref={rowRef}
|
|
524
|
+
onPointerDown={hasHitArea ? handleRowPointerDown : undefined}
|
|
525
|
+
onClick={hasHitArea ? handleRowClick : undefined}
|
|
467
526
|
{...(isDisabled ? undefined : pressable)}
|
|
468
527
|
{...stylex.props(
|
|
469
528
|
styles.container,
|
|
470
529
|
isLabelHidden && styles.containerLabelHidden,
|
|
530
|
+
hasHitArea && styles.hitAreaHost,
|
|
531
|
+
hasHitArea && touchHitAreaStyles.layer,
|
|
471
532
|
// Hover and focus reach the checkbox visual through this ancestor
|
|
472
533
|
// marker rather than props, so the whole row drives it.
|
|
473
534
|
!isDisabled && indicatorScope,
|
|
@@ -490,6 +551,7 @@ export function CheckboxInput({
|
|
|
490
551
|
ref,
|
|
491
552
|
indeterminateRef,
|
|
492
553
|
disabledMessageTooltip.positionRef,
|
|
554
|
+
inputRef,
|
|
493
555
|
)}
|
|
494
556
|
id={id}
|
|
495
557
|
type="checkbox"
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
} from '../theme/tokens.stylex';
|
|
47
47
|
import type {SizeValue, SpacingStep, Elevation} from '../utils/types';
|
|
48
48
|
import {mergeProps} from '../utils';
|
|
49
|
+
import {chainEventHandlers} from '../utils/chainEventHandlers';
|
|
49
50
|
import {Card} from '../Card/Card';
|
|
50
51
|
import type {CardVariant} from '../Card/Card';
|
|
51
52
|
import {useClickableContainer} from '../hooks/useClickableContainer';
|
|
@@ -314,6 +315,7 @@ export function ClickableCard({
|
|
|
314
315
|
label,
|
|
315
316
|
onClick: onClickProp,
|
|
316
317
|
onMouseUp: onMouseUpProp,
|
|
318
|
+
onPointerDown: onPointerDownProp,
|
|
317
319
|
href,
|
|
318
320
|
target,
|
|
319
321
|
isDisabled = false,
|
|
@@ -370,7 +372,7 @@ export function ClickableCard({
|
|
|
370
372
|
|
|
371
373
|
const LinkComponent = useLinkComponent();
|
|
372
374
|
|
|
373
|
-
const {onClick, onMouseUp} = useClickableContainer({
|
|
375
|
+
const {onClick, onMouseUp, onPointerDown} = useClickableContainer({
|
|
374
376
|
containerRef,
|
|
375
377
|
interactiveRef,
|
|
376
378
|
onClick: onClickProp,
|
|
@@ -427,6 +429,11 @@ export function ClickableCard({
|
|
|
427
429
|
}
|
|
428
430
|
onClick={!isDisabled ? onClick : undefined}
|
|
429
431
|
onMouseUp={!isDisabled ? handleMouseUp : undefined}
|
|
432
|
+
onPointerDown={
|
|
433
|
+
!isDisabled
|
|
434
|
+
? chainEventHandlers(onPointerDown, onPointerDownProp)
|
|
435
|
+
: onPointerDownProp
|
|
436
|
+
}
|
|
430
437
|
{...props}>
|
|
431
438
|
{isLink ? (
|
|
432
439
|
<LinkRoot
|
|
@@ -1030,6 +1030,8 @@ function PointerDateField({
|
|
|
1030
1030
|
// calendar only while it is open; it opens on the current value.
|
|
1031
1031
|
!popover.isOpen ? null : (
|
|
1032
1032
|
<Calendar
|
|
1033
|
+
// The field text is Gregorian, so the popover calendar is too.
|
|
1034
|
+
calendar="gregory"
|
|
1033
1035
|
handleRef={calendarRef}
|
|
1034
1036
|
mode="single"
|
|
1035
1037
|
value={optimisticValue ?? null}
|
|
@@ -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.
|
|
@@ -238,7 +238,7 @@ const styles = stylex.create({
|
|
|
238
238
|
},
|
|
239
239
|
presetButtonActive: {
|
|
240
240
|
backgroundColor: colorVars['--color-accent-muted'],
|
|
241
|
-
color: colorVars['--color-accent'],
|
|
241
|
+
color: colorVars['--color-text-accent'],
|
|
242
242
|
},
|
|
243
243
|
presetButtonDisabled: {
|
|
244
244
|
color: colorVars['--color-text-disabled'],
|
|
@@ -910,6 +910,8 @@ export function DateRangeInput({
|
|
|
910
910
|
calendar only while it is open. */}
|
|
911
911
|
{popover.isOpen && (
|
|
912
912
|
<Calendar
|
|
913
|
+
// The field text is Gregorian, so the popover calendar is too.
|
|
914
|
+
calendar="gregory"
|
|
913
915
|
mode="range"
|
|
914
916
|
value={optimisticValue}
|
|
915
917
|
onChange={handleRangeSelect}
|
|
@@ -1976,6 +1976,8 @@ function PointerDateTimeField({
|
|
|
1976
1976
|
// opens on the current value.
|
|
1977
1977
|
!popover.isOpen ? null : (
|
|
1978
1978
|
<Calendar
|
|
1979
|
+
// The field text is Gregorian, so the popover calendar is too.
|
|
1980
|
+
calendar="gregory"
|
|
1979
1981
|
handleRef={calendarRef}
|
|
1980
1982
|
mode="single"
|
|
1981
1983
|
value={valueParts.date ?? null}
|
|
@@ -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',
|