@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
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file spinnerRotor.ts
|
|
7
|
+
* @input StyleX keyframes and the slow-min duration token
|
|
8
|
+
* @output The one turning arc: SPINNER_ARC_FRACTION, spinnerRotorStyles.turn
|
|
9
|
+
* and syncRotationPhase
|
|
10
|
+
* @position Spinner's rotor, shared by Spinner and Lab's indeterminate
|
|
11
|
+
* CircularProgress (through `@astryxdesign/core/internal/spinner-rotor`), so
|
|
12
|
+
* both rings turn the same way on the compositor.
|
|
13
|
+
*/
|
|
14
|
+
import * as stylex from '@stylexjs/stylex';
|
|
15
|
+
import "../theme/tokens.stylex.js";
|
|
16
|
+
import { durationVars } from "../theme/tokens.stylex.js";
|
|
17
|
+
|
|
18
|
+
/** The fraction of the ring the arc covers: 135°. */
|
|
19
|
+
export const SPINNER_ARC_FRACTION = 0.375;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Full turns in one iteration of the rotation.
|
|
23
|
+
*
|
|
24
|
+
* Chromium wakes the main thread at each iteration boundary while the
|
|
25
|
+
* document listens for `animationiteration`. React listens for it on every
|
|
26
|
+
* root. One iteration holds 100 turns, so the wake comes once in 100 turns.
|
|
27
|
+
* Each turn is 360 degrees, so the ring looks the same.
|
|
28
|
+
*/
|
|
29
|
+
const TURNS_PER_ITERATION = 100;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A `transform` animation runs on the compositor, so the ring keeps turning
|
|
33
|
+
* while a script runs. A `stroke-dashoffset` animation would repaint the arc
|
|
34
|
+
* on the main thread every frame, so it would stop while a script runs.
|
|
35
|
+
*/
|
|
36
|
+
const rotation = "x11cqc53-B";
|
|
37
|
+
export const spinnerRotorStyles = {
|
|
38
|
+
turn: {
|
|
39
|
+
k6sLGO: "x1so62im",
|
|
40
|
+
k44tkh: "xidn0ey x14hxw50",
|
|
41
|
+
ko0y90: "xa4qsjk",
|
|
42
|
+
kKVMdj: "x129v4ae",
|
|
43
|
+
kyAemX: "x1esw782",
|
|
44
|
+
$$css: true
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Pin every ring's rotation to the document timeline's origin instead of its
|
|
50
|
+
* own start time, so spinners mounted seconds apart stay in phase.
|
|
51
|
+
*
|
|
52
|
+
* Setting `startTime` is exact where arithmetic on a clock read is not. A
|
|
53
|
+
* negative `animation-delay` computed at mount is only as good as the gap
|
|
54
|
+
* between the clock read and the frame the animation starts in. At 10x CPU
|
|
55
|
+
* throttling that gap measured 116 degrees of drift.
|
|
56
|
+
*
|
|
57
|
+
* Rotors are collected and pinned in one frame. `getAnimations()` resolves
|
|
58
|
+
* style, and `startTime` dirties it again. So pinning them one at a time makes
|
|
59
|
+
* each mount re-force what the previous one invalidated: 53 style recalcs for
|
|
60
|
+
* 38 spinners, against 19 batched.
|
|
61
|
+
*/
|
|
62
|
+
const pendingRotors = new Set();
|
|
63
|
+
let flushScheduled = false;
|
|
64
|
+
function pinRotorsToTimelineOrigin() {
|
|
65
|
+
flushScheduled = false;
|
|
66
|
+
const animations = [];
|
|
67
|
+
for (const rotor of pendingRotors) {
|
|
68
|
+
animations.push(...rotor.getAnimations());
|
|
69
|
+
}
|
|
70
|
+
pendingRotors.clear();
|
|
71
|
+
for (const animation of animations) {
|
|
72
|
+
animation.startTime = 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Ref callback for a rotor: the one place a mounted ring touches the DOM.
|
|
78
|
+
*
|
|
79
|
+
* It reads nothing back — the geometry is resolved by the cascade, not in JS.
|
|
80
|
+
*/
|
|
81
|
+
export function syncRotationPhase(rotor) {
|
|
82
|
+
if (rotor == null) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
// jsdom implements no Web Animations, and this runs in every consumer's
|
|
86
|
+
// component tests.
|
|
87
|
+
if (typeof rotor.getAnimations !== 'function') {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
pendingRotors.add(rotor);
|
|
91
|
+
if (!flushScheduled) {
|
|
92
|
+
flushScheduled = true;
|
|
93
|
+
requestAnimationFrame(pinRotorsToTimelineOrigin);
|
|
94
|
+
}
|
|
95
|
+
return () => {
|
|
96
|
+
pendingRotors.delete(rotor);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file StackItem.tsx
|
|
3
|
-
* @input Uses React, ElementType, stackItem utility
|
|
3
|
+
* @input Uses React, ElementType, stackItem utility, StackItemScrollRegion
|
|
4
4
|
* @output Exports StackItem polymorphic component and StackItemProps
|
|
5
|
-
* @position Layout/Stack component; uses stackItem.stylex.ts
|
|
5
|
+
* @position Layout/Stack component; uses stackItem.stylex.ts. A scrollable
|
|
6
|
+
* `div` or `span` item renders through StackItemScrollRegion, which names
|
|
7
|
+
* it while it scrolls.
|
|
6
8
|
*
|
|
7
9
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
10
|
* - /packages/core/src/Stack/Stack.doc.mjs
|
|
@@ -34,7 +36,9 @@ export interface StackItemProps extends BaseProps<HTMLElement> {
|
|
|
34
36
|
* reset, so `<StackItem size="fill" isScrollable>` is a complete scroll
|
|
35
37
|
* region — it grows to fill the stack and scrolls its own overflow with
|
|
36
38
|
* no extra style plumbing. Matches `isScrollable` on `LayoutContent`
|
|
37
|
-
* and `LayoutPanel`.
|
|
39
|
+
* and `LayoutPanel`. While its content overflows, a `div` or `span` item
|
|
40
|
+
* is a group named by the caller's `aria-label`, or by a translated
|
|
41
|
+
* "Content". Another element keeps its own role.
|
|
38
42
|
* @default false
|
|
39
43
|
*/
|
|
40
44
|
isScrollable?: boolean;
|
|
@@ -62,7 +66,7 @@ export interface StackItemProps extends BaseProps<HTMLElement> {
|
|
|
62
66
|
* </HStack>
|
|
63
67
|
* ```
|
|
64
68
|
*/
|
|
65
|
-
export declare function StackItem({ crossAlignSelf, size, isScrollable, as: element, xstyle, className, style, children, ref, ...props }: StackItemProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any
|
|
69
|
+
export declare function StackItem({ crossAlignSelf, size, isScrollable, as: element, xstyle, className, style, children, ref, ...props }: StackItemProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").FunctionComponentElement<import("../hooks/StackItemScrollRegion.js").StackItemScrollRegionProps>;
|
|
66
70
|
export declare namespace StackItem {
|
|
67
71
|
var displayName: string;
|
|
68
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackItem.d.ts","sourceRoot":"","sources":["../../src/Stack/StackItem.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"StackItem.d.ts","sourceRoot":"","sources":["../../src/Stack/StackItem.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAW5B,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC5D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;OAGG;IACH,cAAc,CAAC,EAAE,uBAAuB,CAAC;IAEzC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,EACxB,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,EAAE,EAAE,OAAe,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACT,EAAE,cAAc,0MA8BhB;yBAzCe,SAAS"}
|
package/dist/Stack/StackItem.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file StackItem.tsx
|
|
5
|
-
* @input Uses React, ElementType, stackItem utility
|
|
5
|
+
* @input Uses React, ElementType, stackItem utility, StackItemScrollRegion
|
|
6
6
|
* @output Exports StackItem polymorphic component and StackItemProps
|
|
7
|
-
* @position Layout/Stack component; uses stackItem.stylex.ts
|
|
7
|
+
* @position Layout/Stack component; uses stackItem.stylex.ts. A scrollable
|
|
8
|
+
* `div` or `span` item renders through StackItemScrollRegion, which names
|
|
9
|
+
* it while it scrolls.
|
|
8
10
|
*
|
|
9
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
10
12
|
* - /packages/core/src/Stack/Stack.doc.mjs
|
|
@@ -16,6 +18,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
16
18
|
import { stackItem } from "./stackItem.stylex.js";
|
|
17
19
|
import { mergeProps } from "../utils/mergeProps.js";
|
|
18
20
|
import { themeProps } from "../utils/themeProps.js";
|
|
21
|
+
import { StackItemScrollRegion } from "../hooks/StackItemScrollRegion.js";
|
|
19
22
|
const overflowStyles = {
|
|
20
23
|
scrollable: {
|
|
21
24
|
kVQacm: "xysyzu8",
|
|
@@ -52,12 +55,22 @@ export function StackItem({
|
|
|
52
55
|
crossAlignSelf,
|
|
53
56
|
size
|
|
54
57
|
}), isScrollable && overflowStyles.scrollable, xstyle);
|
|
55
|
-
|
|
56
|
-
ref: ref,
|
|
58
|
+
const elementProps = {
|
|
57
59
|
...mergeProps(themeProps('stack-item', {
|
|
58
60
|
size
|
|
59
61
|
}), stylexProps, className, style),
|
|
60
62
|
...props
|
|
63
|
+
};
|
|
64
|
+
if (isScrollable && (element === 'div' || element === 'span')) {
|
|
65
|
+
return /*#__PURE__*/createElement(StackItemScrollRegion, {
|
|
66
|
+
as: element,
|
|
67
|
+
ref,
|
|
68
|
+
elementProps
|
|
69
|
+
}, children);
|
|
70
|
+
}
|
|
71
|
+
return /*#__PURE__*/createElement(element, {
|
|
72
|
+
ref: ref,
|
|
73
|
+
...elementProps
|
|
61
74
|
}, children);
|
|
62
75
|
}
|
|
63
76
|
StackItem.displayName = 'StackItem';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAQL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAQL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAinB9C,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,CACb,OAAO,EAAE,OAAO,EAChB,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAC7B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,QAAQ,EACR,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,OAAO,EACP,MAAM,EACN,SAAS,EACT,YAAY,EACZ,aAAqB,EACrB,YAAoB,EACpB,MAAM,EACN,IAAW,EACX,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,kBAAkB,EAAE,mBAAmB,EACvC,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,IAAI,EACR,EAAE,WAAW,+BA4Rb;yBAzTe,MAAM"}
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -33,8 +33,10 @@ import { usePressFeedback } from "../hooks/usePressFeedback.js";
|
|
|
33
33
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
34
34
|
import english from "../i18n/generated-english/Switch/Switch.generated.js";
|
|
35
35
|
registerEnglishFallback(english);
|
|
36
|
+
import "../motion/reducedMotion.stylex.js";
|
|
37
|
+
import { reducedMotionFadeConsts } from "../motion/reducedMotion.stylex.js";
|
|
36
38
|
import "../utils/interactionOverlay.stylex.js";
|
|
37
|
-
import { interactionOverlayStyles,
|
|
39
|
+
import { interactionOverlayStyles, pressVars } from "../utils/interactionOverlay.stylex.js";
|
|
38
40
|
import { pressHoldsDragProps } from "../privateAttributes/pressHoldsDrag.stylex.js";
|
|
39
41
|
import { useSwitchTouch } from "./useSwitchTouch.js";
|
|
40
42
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
@@ -65,14 +67,15 @@ const PRESS_FADING = '[data-astryx-press="fading"]';
|
|
|
65
67
|
|
|
66
68
|
/**
|
|
67
69
|
* The shared press release, for the press layers the switch fades on the
|
|
68
|
-
* compositor
|
|
69
|
-
*
|
|
70
|
+
* compositor: the theme's exit motion tokens, no longer than the Reduce
|
|
71
|
+
* Motion fade under Reduce Motion. Switch.test.tsx compares them with
|
|
72
|
+
* the overlay's.
|
|
70
73
|
* SYNC: utils/interactionOverlay.stylex.ts PRESS_RELEASE_DURATION,
|
|
71
74
|
* PRESS_RELEASE_DURATION_REDUCED and RELEASE_EASE.
|
|
72
75
|
*/
|
|
73
|
-
const PRESS_RELEASE_DURATION =
|
|
74
|
-
const PRESS_RELEASE_DURATION_REDUCED = `min(${
|
|
75
|
-
const PRESS_RELEASE_EASE = '
|
|
76
|
+
const PRESS_RELEASE_DURATION = durationVars['--duration-exit'];
|
|
77
|
+
const PRESS_RELEASE_DURATION_REDUCED = `min(${durationVars['--duration-exit']}, ${reducedMotionFadeConsts.duration})`;
|
|
78
|
+
const PRESS_RELEASE_EASE = easeVars['--ease-exit'];
|
|
76
79
|
|
|
77
80
|
// The measured hit insets (utils/hitArea), 0 until measured.
|
|
78
81
|
const HIT_TOP = 'var(--astryx-hit-inset-top, 0px)';
|
|
@@ -262,8 +265,8 @@ const styles = {
|
|
|
262
265
|
kLkRvE: "x1my3e5g",
|
|
263
266
|
k5QlbN: "x2huugr x1ccaw7f",
|
|
264
267
|
k7EzDT: "xxhzo2e",
|
|
265
|
-
kQZAMR: "
|
|
266
|
-
kZiNAr: "
|
|
268
|
+
kQZAMR: "xs8z9ty x1e7l4zx",
|
|
269
|
+
kZiNAr: "x15baseh",
|
|
267
270
|
k8Tatv: "xq2jpp1",
|
|
268
271
|
k5JduY: "x1s928wv",
|
|
269
272
|
kc3QkE: "x1h1zc6f x1ep27e9",
|
|
@@ -320,8 +323,8 @@ const styles = {
|
|
|
320
323
|
kLkRvE: "x1my3e5g",
|
|
321
324
|
k5QlbN: "x2huugr x1ccaw7f",
|
|
322
325
|
k7EzDT: "xxhzo2e",
|
|
323
|
-
kQZAMR: "
|
|
324
|
-
kZiNAr: "
|
|
326
|
+
kQZAMR: "xs8z9ty x1e7l4zx",
|
|
327
|
+
kZiNAr: "x15baseh",
|
|
325
328
|
k8Tatv: "xq2jpp1",
|
|
326
329
|
k5JduY: "x1s928wv",
|
|
327
330
|
kc3QkE: "x1h1zc6f x1ep27e9",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timestamp.d.ts","sourceRoot":"","sources":["../../src/Timestamp/Timestamp.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Timestamp.d.ts","sourceRoot":"","sources":["../../src/Timestamp/Timestamp.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAK9E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAK5C,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAmB1B,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,gBAAgB,GAChB,MAAM,GACN,MAAM,GACN,WAAW,GACX,cAAc,GACd,WAAW,GACX,MAAM,GACN,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,cAAc,CAAC;AAEnB,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,eAAe,CAAC;IAChE,kDAAkD;IAClD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACjC,uFAAuF;IACvF,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IACtD;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAsFD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,MAAe,EACf,aAAsC,EACtC,UAAiB,EACjB,cAAc,EACd,eAAuB,EACvB,MAAc,EACd,IAAmB,EACnB,IAAI,EACJ,KAAmB,EACnB,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,cAAc,sCA4MhB;yBA9Ne,SAAS"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Timestamp.tsx
|
|
7
|
-
* @input Uses React, Text, provider locale, and Timestamp formatters
|
|
7
|
+
* @input Uses React, Text, provider locale and calendar, and Timestamp formatters
|
|
8
8
|
* @output Exports Timestamp component and related types
|
|
9
9
|
* @position Core implementation; renders formatted timestamps
|
|
10
10
|
*
|
|
@@ -22,6 +22,7 @@ import { Text } from "../Text/index.js";
|
|
|
22
22
|
import { mergeProps } from "../utils/index.js";
|
|
23
23
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
24
24
|
import { useLocale } from "../i18n/useLocale.js";
|
|
25
|
+
import { useCalendarSystem } from "../i18n/useCalendarSystem.js";
|
|
25
26
|
import { themeProps } from "../utils/themeProps.js";
|
|
26
27
|
import { formatInstant } from "./formatInstant.js";
|
|
27
28
|
import { formatRelativeTime } from "./formatRelativeTime.js";
|
|
@@ -141,6 +142,7 @@ export function Timestamp({
|
|
|
141
142
|
}) {
|
|
142
143
|
const t = useComponentTranslator();
|
|
143
144
|
const locale = useLocale();
|
|
145
|
+
const calendar = useCalendarSystem(undefined, 'Timestamp');
|
|
144
146
|
const timeRef = useRef(null);
|
|
145
147
|
const mergedTimeRef = useMergedRefs(ref, timeRef);
|
|
146
148
|
// Only relative and auto formats depend on the current time. Absolute
|
|
@@ -178,23 +180,27 @@ export function Timestamp({
|
|
|
178
180
|
// others. The one exception is the pre-hydration placeholder, written in
|
|
179
181
|
// UTC with its label so every zone produces the same markup.
|
|
180
182
|
const displayText = !isValidDate ? '' : effectiveFormat === 'relative' ? formatRelativeTime(date, now ?? date, locale, 'long') : effectiveFormat === 'relative_short' ? formatRelativeTime(date, now ?? date, locale, 'narrow') : isAbsoluteFormat(effectiveFormat) ? formatInstant(date, effectiveFormat, locale,
|
|
181
|
-
// The
|
|
182
|
-
//
|
|
183
|
-
//
|
|
183
|
+
// The placeholder before hydration is Gregorian and in UTC, with
|
|
184
|
+
// its zone. The server and the client then write the same text,
|
|
185
|
+
// with or without Temporal.
|
|
184
186
|
isClockPending ? {
|
|
185
187
|
timeZone: 'UTC',
|
|
186
188
|
isTimezoneShown: true
|
|
187
189
|
} : {
|
|
188
|
-
isTimezoneShown
|
|
190
|
+
isTimezoneShown,
|
|
191
|
+
calendar
|
|
189
192
|
}) : '';
|
|
190
193
|
|
|
191
194
|
// Full absolute text for the tooltip (visible — keeps the compact timezone
|
|
192
195
|
// abbreviation) and for the AT-facing aria-label, which spells the timezone
|
|
193
196
|
// out in full: abbreviations like "PST" or "GMT+2" are unexpanded
|
|
194
197
|
// abbreviations to a screen-reader user (WCAG 3.1.4).
|
|
195
|
-
const fullAbsoluteText = isValidDate ? formatInstant(date, 'full', locale
|
|
198
|
+
const fullAbsoluteText = isValidDate ? formatInstant(date, 'full', locale, {
|
|
199
|
+
calendar
|
|
200
|
+
}) : '';
|
|
196
201
|
const ariaLabelText = isValidDate ? formatInstant(date, 'full', locale, {
|
|
197
|
-
timeZoneNameStyle: 'long'
|
|
202
|
+
timeZoneNameStyle: 'long',
|
|
203
|
+
calendar
|
|
198
204
|
}) : '';
|
|
199
205
|
|
|
200
206
|
// Syncs the relative time with an interval timer while the timestamp is live.
|
|
@@ -232,7 +238,7 @@ export function Timestamp({
|
|
|
232
238
|
const lines = entries === undefined ? [{
|
|
233
239
|
value: fullAbsoluteText,
|
|
234
240
|
isCopyable: true
|
|
235
|
-
}] : formatTooltipLines(date, entries, locale);
|
|
241
|
+
}] : formatTooltipLines(date, entries, locale, calendar);
|
|
236
242
|
const timestampProps = mergeProps(themeProps('timestamp', {
|
|
237
243
|
format: effectiveFormat
|
|
238
244
|
}), {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CalendarSystem } from '../utils/calendarSystem.js';
|
|
1
2
|
import type { Locale } from '../i18n/types.js';
|
|
2
3
|
import type { TimestampFormat } from './Timestamp.js';
|
|
3
4
|
/**
|
|
@@ -41,6 +42,14 @@ export interface FormatInstantOptions {
|
|
|
41
42
|
* @default 'short'
|
|
42
43
|
*/
|
|
43
44
|
timeZoneNameStyle?: 'short' | 'long';
|
|
45
|
+
/**
|
|
46
|
+
* The calendar that date-bearing formats write the date in. Timestamp
|
|
47
|
+
* passes its resolved calendar. `time` has no date, and the `system_*`
|
|
48
|
+
* shapes and `unix_seconds` stay Gregorian ISO or calendar-neutral in every
|
|
49
|
+
* calendar.
|
|
50
|
+
* @default 'gregory'
|
|
51
|
+
*/
|
|
52
|
+
calendar?: CalendarSystem;
|
|
44
53
|
}
|
|
45
54
|
/**
|
|
46
55
|
* Renders one instant in one absolute format.
|
|
@@ -48,5 +57,5 @@ export interface FormatInstantOptions {
|
|
|
48
57
|
* Pure: the same arguments always produce the same string for the requested
|
|
49
58
|
* locale (and, when no `timeZone` is given, host zone).
|
|
50
59
|
*/
|
|
51
|
-
export declare function formatInstant(date: Date, format: InstantFormat, locale: Locale, { timeZone, isTimezoneShown, timeZoneNameStyle, }?: FormatInstantOptions): string;
|
|
60
|
+
export declare function formatInstant(date: Date, format: InstantFormat, locale: Locale, { timeZone, isTimezoneShown, timeZoneNameStyle, calendar, }?: FormatInstantOptions): string;
|
|
52
61
|
//# sourceMappingURL=formatInstant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatInstant.d.ts","sourceRoot":"","sources":["../../src/Timestamp/formatInstant.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAMjD;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GACvB,OAAO,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AAE5E,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"formatInstant.d.ts","sourceRoot":"","sources":["../../src/Timestamp/formatInstant.ts"],"names":[],"mappings":"AAgCA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAMjD;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GACvB,OAAO,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AAE5E,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AA6CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,EACE,QAAQ,EACR,eAAuB,EACvB,iBAA2B,EAC3B,QAAoB,GACrB,GAAE,oBAAyB,GAC3B,MAAM,CA8ER"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file formatInstant.ts
|
|
5
|
-
* @input A Date, one absolute format name,
|
|
5
|
+
* @input A Date, one absolute format name, an optional time zone and calendar
|
|
6
6
|
* @output That instant rendered as a string
|
|
7
7
|
* @position Leaf shared by Timestamp's visible text and each of its tooltip
|
|
8
8
|
* lines; owns every absolute format Timestamp can produce
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
import { SHARED_DATE_FORMAT_OPTIONS, getWallClock } from "../utils/plainDate.js";
|
|
33
|
+
import { formatCalendarInstant } from "../utils/calendarSystem.js";
|
|
33
34
|
|
|
34
35
|
// =============================================================================
|
|
35
36
|
// Types
|
|
@@ -96,7 +97,8 @@ function pad(n) {
|
|
|
96
97
|
export function formatInstant(date, format, locale, {
|
|
97
98
|
timeZone,
|
|
98
99
|
isTimezoneShown = false,
|
|
99
|
-
timeZoneNameStyle = 'short'
|
|
100
|
+
timeZoneNameStyle = 'short',
|
|
101
|
+
calendar = 'gregory'
|
|
100
102
|
} = {}) {
|
|
101
103
|
const zone = timeZone === undefined ? {} : {
|
|
102
104
|
timeZone
|
|
@@ -106,37 +108,21 @@ export function formatInstant(date, format, locale, {
|
|
|
106
108
|
} : {};
|
|
107
109
|
switch (format) {
|
|
108
110
|
case 'full':
|
|
109
|
-
return
|
|
111
|
+
return formatCalendarInstant(calendar, date, {
|
|
110
112
|
...FULL_OPTIONS,
|
|
111
|
-
timeZoneName: timeZoneNameStyle
|
|
112
|
-
|
|
113
|
-
calendar: 'gregory'
|
|
114
|
-
}).format(date);
|
|
113
|
+
timeZoneName: timeZoneNameStyle
|
|
114
|
+
}, locale, timeZone);
|
|
115
115
|
case 'date':
|
|
116
|
-
return
|
|
117
|
-
...SHARED_DATE_FORMAT_OPTIONS.date,
|
|
118
|
-
...zone,
|
|
119
|
-
calendar: 'gregory'
|
|
120
|
-
}).format(date);
|
|
116
|
+
return formatCalendarInstant(calendar, date, SHARED_DATE_FORMAT_OPTIONS.date, locale, timeZone);
|
|
121
117
|
case 'date_long':
|
|
122
|
-
return
|
|
123
|
-
...SHARED_DATE_FORMAT_OPTIONS.date_long,
|
|
124
|
-
...zone,
|
|
125
|
-
calendar: 'gregory'
|
|
126
|
-
}).format(date);
|
|
118
|
+
return formatCalendarInstant(calendar, date, SHARED_DATE_FORMAT_OPTIONS.date_long, locale, timeZone);
|
|
127
119
|
case 'date_weekday':
|
|
128
|
-
return
|
|
129
|
-
...SHARED_DATE_FORMAT_OPTIONS.date_weekday,
|
|
130
|
-
...zone,
|
|
131
|
-
calendar: 'gregory'
|
|
132
|
-
}).format(date);
|
|
120
|
+
return formatCalendarInstant(calendar, date, SHARED_DATE_FORMAT_OPTIONS.date_weekday, locale, timeZone);
|
|
133
121
|
case 'date_time':
|
|
134
|
-
return
|
|
122
|
+
return formatCalendarInstant(calendar, date, {
|
|
135
123
|
...DATE_TIME_OPTIONS,
|
|
136
|
-
...zoneName
|
|
137
|
-
|
|
138
|
-
calendar: 'gregory'
|
|
139
|
-
}).format(date);
|
|
124
|
+
...zoneName
|
|
125
|
+
}, locale, timeZone);
|
|
140
126
|
case 'time':
|
|
141
127
|
return new Intl.DateTimeFormat(locale, {
|
|
142
128
|
...TIME_OPTIONS,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InstantFormat } from './formatInstant.js';
|
|
2
2
|
import type { Locale } from '../i18n/types.js';
|
|
3
|
+
import type { CalendarSystem } from '../utils/calendarSystem.js';
|
|
3
4
|
/**
|
|
4
5
|
* Formats available to a tooltip line.
|
|
5
6
|
*
|
|
@@ -63,10 +64,11 @@ export interface TimestampTooltipLine {
|
|
|
63
64
|
isCopyable: boolean;
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
66
|
-
* Renders one tooltip line per entry, in the order given
|
|
67
|
+
* Renders one tooltip line per entry, in the order given, with dates in
|
|
68
|
+
* `calendar`.
|
|
67
69
|
*
|
|
68
70
|
* Pure: the same `date` and `entries` always produce the same lines for a given
|
|
69
|
-
* host zone and
|
|
71
|
+
* host zone, locale, and calendar.
|
|
70
72
|
*/
|
|
71
|
-
export declare function formatTooltipLines(date: Date, entries: ReadonlyArray<TimestampTooltipEntry>, locale: Locale): ReadonlyArray<TimestampTooltipLine>;
|
|
73
|
+
export declare function formatTooltipLines(date: Date, entries: ReadonlyArray<TimestampTooltipEntry>, locale: Locale, calendar?: CalendarSystem): ReadonlyArray<TimestampTooltipLine>;
|
|
72
74
|
//# sourceMappingURL=tooltipEntries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltipEntries.d.ts","sourceRoot":"","sources":["../../src/Timestamp/tooltipEntries.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tooltipEntries.d.ts","sourceRoot":"","sources":["../../src/Timestamp/tooltipEntries.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAM5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,yCAAyC;AACzC,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,+BAA+B;AAC/B,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;CACrB;AAuGD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,EAC7C,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,cAA0B,GACnC,aAAa,CAAC,oBAAoB,CAAC,CAsBrC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file tooltipEntries.ts
|
|
5
|
-
* @input A Date
|
|
5
|
+
* @input A Date, the consumer's tooltip entry list, a locale and a calendar
|
|
6
6
|
* @output Pure formatting of one tooltip line per entry, plus the entry types
|
|
7
7
|
* @position Leaf module; owns which zone each tooltip line names and whether
|
|
8
8
|
* it needs a zone abbreviation, then defers to formatInstant to render it
|
|
@@ -142,12 +142,13 @@ function shouldShowZoneName(format, hasMultipleZones, isNamedZone) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
* Renders one tooltip line per entry, in the order given
|
|
145
|
+
* Renders one tooltip line per entry, in the order given, with dates in
|
|
146
|
+
* `calendar`.
|
|
146
147
|
*
|
|
147
148
|
* Pure: the same `date` and `entries` always produce the same lines for a given
|
|
148
|
-
* host zone and
|
|
149
|
+
* host zone, locale, and calendar.
|
|
149
150
|
*/
|
|
150
|
-
export function formatTooltipLines(date, entries, locale) {
|
|
151
|
+
export function formatTooltipLines(date, entries, locale, calendar = 'gregory') {
|
|
151
152
|
const resolved = entries.map(entry => resolveTimezoneID(entry.timezoneID));
|
|
152
153
|
const hasMultipleZones = new Set(resolved.map(zoneKey)).size > 1;
|
|
153
154
|
return entries.map((entry, index) => {
|
|
@@ -160,6 +161,7 @@ export function formatTooltipLines(date, entries, locale) {
|
|
|
160
161
|
isCopyable: entry.isCopyable ?? false,
|
|
161
162
|
value: formatInstant(date, format, locale, {
|
|
162
163
|
timeZone,
|
|
164
|
+
calendar,
|
|
163
165
|
isTimezoneShown: shouldShowZoneName(format, hasMultipleZones, timeZone !== undefined)
|
|
164
166
|
})
|
|
165
167
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../src/Token/Token.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAM,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAiB1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../src/Token/Token.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAM,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAiB1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAM5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAe3C;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,WAAW,CAAC;IACxD,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA6JD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAW,EACX,KAAiB,EACjB,IAAI,EACJ,UAAkB,EAClB,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,WAAW,EACX,UAAU,EACV,aAAqB,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,YAAY,EAC7B,GAAG,EACH,GAAG,IAAI,EACR,EAAE,UAAU,+BA8RZ;yBApTe,KAAK"}
|
package/dist/Token/Token.js
CHANGED
|
@@ -29,6 +29,7 @@ import { themeProps } from "../utils/themeProps.js";
|
|
|
29
29
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
30
30
|
import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
|
|
31
31
|
import { usePressFeedback } from "../hooks/usePressFeedback.js";
|
|
32
|
+
import { cancelNestedTouchPress } from "../hooks/useClickableContainer.js";
|
|
32
33
|
import { disabledInteractionProps } from "../utils/disabledInteraction.js";
|
|
33
34
|
import { TokenNamingContext } from "./TokenNamingContext.js";
|
|
34
35
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
@@ -391,6 +392,13 @@ export function Token({
|
|
|
391
392
|
}
|
|
392
393
|
effectiveOnClick(e);
|
|
393
394
|
};
|
|
395
|
+
// A finger press on Remove or a control in end content does not run the
|
|
396
|
+
// token's action, so the token shows no press for it. The inner button,
|
|
397
|
+
// the first button child, is the token's own action.
|
|
398
|
+
const handleContainerPointerDown = e => {
|
|
399
|
+
rest.onPointerDown?.(e);
|
|
400
|
+
cancelNestedTouchPress(e, e.currentTarget, e.currentTarget.querySelector(':scope > button'));
|
|
401
|
+
};
|
|
394
402
|
return /*#__PURE__*/_jsxs("span", {
|
|
395
403
|
ref: ref,
|
|
396
404
|
onClick: isDisabled ? undefined : handleContainerClick,
|
|
@@ -402,6 +410,7 @@ export function Token({
|
|
|
402
410
|
}), focusOutlineProps.focusWithin(styles.base, sizeStyles[size], colorStyles[color], styles.interactive, interactionOverlayStyles.backgroundImage, isDisabled && styles.disabled, xstyle), className, style),
|
|
403
411
|
...rest,
|
|
404
412
|
...sharedProps,
|
|
413
|
+
onPointerDown: isDisabled ? rest.onPointerDown : handleContainerPointerDown,
|
|
405
414
|
children: [icon, /*#__PURE__*/_jsx("button", {
|
|
406
415
|
type: "button",
|
|
407
416
|
onClick: effectiveOnClick,
|
|
@@ -62,7 +62,7 @@ export interface TokenLinkProps extends HTMLAttributes<HTMLElement> {
|
|
|
62
62
|
* (including middle-click / cmd+click to open in a new tab) while the remove
|
|
63
63
|
* button keeps handling its own clicks.
|
|
64
64
|
*/
|
|
65
|
-
export declare function TokenLink({ ref, href, isDisabled, onLinkClick, LinkComponent, linkStyleProps, labelContent, icon, endContent, removeButton, onClick: onClickProp, onMouseUp: onMouseUpProp, ...containerProps }: TokenLinkProps): import("react").JSX.Element;
|
|
65
|
+
export declare function TokenLink({ ref, href, isDisabled, onLinkClick, LinkComponent, linkStyleProps, labelContent, icon, endContent, removeButton, onClick: onClickProp, onMouseUp: onMouseUpProp, onPointerDown: onPointerDownProp, ...containerProps }: TokenLinkProps): import("react").JSX.Element;
|
|
66
66
|
export declare namespace TokenLink {
|
|
67
67
|
var displayName: string;
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenLink.d.ts","sourceRoot":"","sources":["../../src/Token/TokenLink.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,GAAG,EACH,cAAc,EACd,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,WAAW,CAAC;IACjE,8CAA8C;IAC9C,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACvB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC7C,+DAA+D;IAC/D,aAAa,EAAE,iBAAiB,CAAC;IACjC,mEAAmE;IACnE,cAAc,EAAE;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,aAAa,CAAA;KAAC,CAAC;IAC5D,wEAAwE;IACxE,YAAY,EAAE,SAAS,CAAC;IACxB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iEAAiE;IACjE,YAAY,EAAE,SAAS,CAAC;IACxB,kFAAkF;IAClF,CAAC,QAAQ,EAAE,QAAQ,MAAM,EAAE,GAAG,OAAO,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EACxB,GAAG,EACH,IAAI,EACJ,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,GAAG,cAAc,EAClB,EAAE,cAAc,+
|
|
1
|
+
{"version":3,"file":"TokenLink.d.ts","sourceRoot":"","sources":["../../src/Token/TokenLink.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,GAAG,EACH,cAAc,EACd,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,WAAW,CAAC;IACjE,8CAA8C;IAC9C,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACvB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC7C,+DAA+D;IAC/D,aAAa,EAAE,iBAAiB,CAAC;IACjC,mEAAmE;IACnE,cAAc,EAAE;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,aAAa,CAAA;KAAC,CAAC;IAC5D,wEAAwE;IACxE,YAAY,EAAE,SAAS,CAAC;IACxB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iEAAiE;IACjE,YAAY,EAAE,SAAS,CAAC;IACxB,kFAAkF;IAClF,CAAC,QAAQ,EAAE,QAAQ,MAAM,EAAE,GAAG,OAAO,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EACxB,GAAG,EACH,IAAI,EACJ,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,aAAa,EAAE,iBAAiB,EAChC,GAAG,cAAc,EAClB,EAAE,cAAc,+BAsDhB;yBArEe,SAAS"}
|
package/dist/Token/TokenLink.js
CHANGED
|
@@ -51,13 +51,15 @@ export function TokenLink({
|
|
|
51
51
|
removeButton,
|
|
52
52
|
onClick: onClickProp,
|
|
53
53
|
onMouseUp: onMouseUpProp,
|
|
54
|
+
onPointerDown: onPointerDownProp,
|
|
54
55
|
...containerProps
|
|
55
56
|
}) {
|
|
56
57
|
const containerRef = useRef(null);
|
|
57
58
|
const linkRef = useRef(null);
|
|
58
59
|
const {
|
|
59
60
|
onClick,
|
|
60
|
-
onMouseUp
|
|
61
|
+
onMouseUp,
|
|
62
|
+
onPointerDown
|
|
61
63
|
} = useClickableContainer({
|
|
62
64
|
containerRef,
|
|
63
65
|
interactiveRef: linkRef,
|
|
@@ -69,6 +71,7 @@ export function TokenLink({
|
|
|
69
71
|
...containerProps,
|
|
70
72
|
onClick: isDisabled ? onClickProp : composeEventHandlers(onClickProp, onClick),
|
|
71
73
|
onMouseUp: isDisabled ? onMouseUpProp : composeEventHandlers(onMouseUpProp, onMouseUp),
|
|
74
|
+
onPointerDown: isDisabled ? onPointerDownProp : composeEventHandlers(onPointerDownProp, onPointerDown),
|
|
72
75
|
children: [icon, isDisabled ?
|
|
73
76
|
/*#__PURE__*/
|
|
74
77
|
// A disabled link stays a focusable link with no destination, as a
|