@astryxdesign/core 0.7.6-canary.fc44bc3 → 0.7.6-canary.fda92ac
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/BottomSheet/BottomSheet.d.ts +3 -51
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +69 -96
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetEdgeTint.js +10 -21
- package/dist/BottomSheet/BottomSheetHostContext.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetHostContext.js +6 -10
- package/dist/BottomSheet/BottomSheetPanel.d.ts +4 -8
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +32 -49
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts +7 -56
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +36 -71
- package/dist/BottomSheet/bottomSheetEscape.js +3 -3
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +42 -96
- package/dist/BottomSheet/useMobileKeyboard.d.ts +0 -14
- package/dist/BottomSheet/useMobileKeyboard.d.ts.map +1 -1
- package/dist/BottomSheet/useMobileKeyboard.js +12 -14
- package/dist/BottomSheet/useSheetGestures.d.ts +12 -76
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +58 -104
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +1 -5
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +9 -0
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +18 -4
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +53 -7
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +4 -10
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +5 -1
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +5 -1
- package/dist/Field/index.d.ts +3 -1
- package/dist/Field/index.d.ts.map +1 -1
- package/dist/Field/index.js +2 -1
- package/dist/Field/textEntryTraits.d.ts +86 -0
- package/dist/Field/textEntryTraits.d.ts.map +1 -0
- package/dist/Field/textEntryTraits.js +81 -0
- package/dist/HStack/HStack.d.ts +2 -1
- package/dist/HStack/HStack.d.ts.map +1 -1
- package/dist/HStack/HStack.js +2 -1
- package/dist/HoverCard/HoverCard.d.ts +8 -5
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +1 -0
- package/dist/HoverCard/useHoverCard.d.ts +3 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +2 -6
- package/dist/Layer/layerClickBoundary.d.ts +35 -0
- package/dist/Layer/layerClickBoundary.d.ts.map +1 -0
- package/dist/Layer/layerClickBoundary.js +61 -0
- package/dist/Layer/layerSurfacePress.d.ts.map +1 -1
- package/dist/Layer/layerSurfacePress.js +5 -9
- package/dist/Layer/outsidePress.d.ts +20 -0
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +52 -1
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +11 -2
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +8 -4
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +9 -2
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +2 -1
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +59 -0
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +9 -6
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +15 -12
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +2 -1
- package/dist/SideNav/SideNavSection.d.ts.map +1 -1
- package/dist/SideNav/SideNavSection.js +2 -1
- package/dist/Stack/Stack.d.ts +1 -1
- package/dist/Stack/stack.stylex.d.ts +1 -1
- package/dist/Stack/stack.stylex.js +1 -1
- package/dist/TextArea/TextArea.d.ts +5 -3
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +14 -3
- package/dist/TextInput/TextInput.d.ts +20 -6
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +24 -2
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +2 -0
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +1 -6
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +67 -52
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +14 -10
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +9 -8
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +3 -2
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +2 -1
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +117 -20
- package/dist/Typeahead/committedChoicesKey.d.ts +12 -0
- package/dist/Typeahead/committedChoicesKey.d.ts.map +1 -0
- package/dist/Typeahead/committedChoicesKey.js +24 -0
- package/dist/hooks/ModalAnnounceProvider.d.ts +3 -4
- package/dist/hooks/ModalAnnounceProvider.d.ts.map +1 -1
- package/dist/hooks/ModalAnnounceProvider.js +4 -6
- package/dist/hooks/actionGroupTracker.d.ts +12 -0
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +23 -55
- package/dist/hooks/menuPressGesture.d.ts +21 -26
- package/dist/hooks/menuPressGesture.d.ts.map +1 -1
- package/dist/hooks/menuPressGesture.js +25 -30
- package/dist/hooks/menuPressOnItems.d.ts +2 -9
- package/dist/hooks/menuPressOnItems.d.ts.map +1 -1
- package/dist/hooks/menuPressOnItems.js +7 -9
- package/dist/hooks/modalAnnounce.d.ts +1 -1
- package/dist/hooks/modalAnnounce.d.ts.map +1 -1
- package/dist/hooks/modalAnnounce.js +20 -39
- package/dist/hooks/scrollbarGutter.d.ts.map +1 -1
- package/dist/hooks/scrollbarGutter.js +9 -16
- package/dist/hooks/useAnimatedLayout.d.ts +2 -3
- package/dist/hooks/useAnimatedLayout.d.ts.map +1 -1
- package/dist/hooks/useAnimatedLayout.js +2 -3
- package/dist/hooks/useAnnounce.d.ts +16 -37
- package/dist/hooks/useAnnounce.d.ts.map +1 -1
- package/dist/hooks/useAnnounce.js +56 -92
- package/dist/hooks/useAnnounceRenderedText.d.ts +17 -48
- package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +22 -42
- package/dist/hooks/useAutoMediaMode.d.ts.map +1 -1
- package/dist/hooks/useAutoMediaMode.js +29 -54
- package/dist/hooks/useBusyAnnouncement.d.ts +2 -16
- package/dist/hooks/useBusyAnnouncement.d.ts.map +1 -1
- package/dist/hooks/useBusyAnnouncement.js +13 -20
- package/dist/hooks/useClickableContainer.d.ts +3 -9
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +10 -22
- package/dist/hooks/useContainerReveal.d.ts +9 -36
- package/dist/hooks/useContainerReveal.d.ts.map +1 -1
- package/dist/hooks/useContainerReveal.js +9 -36
- package/dist/hooks/useDevWarning.d.ts.map +1 -1
- package/dist/hooks/useDevWarning.js +3 -8
- package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
- package/dist/hooks/useEntryAnimation.js +1 -3
- package/dist/hooks/useHighlightedOptionScroll.d.ts +2 -4
- package/dist/hooks/useHighlightedOptionScroll.d.ts.map +1 -1
- package/dist/hooks/useHighlightedOptionScroll.js +1 -1
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +4 -16
- package/dist/hooks/useImageMode.d.ts.map +1 -1
- package/dist/hooks/useImageMode.js +6 -45
- package/dist/hooks/useIndicatorFocusRing.d.ts.map +1 -1
- package/dist/hooks/useIndicatorFocusRing.js +13 -38
- package/dist/hooks/useInputStatusIcon.d.ts +9 -1
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +16 -32
- package/dist/hooks/useInteractiveRole.d.ts.map +1 -1
- package/dist/hooks/useInteractiveRole.js +6 -24
- package/dist/hooks/useListFocus.d.ts +4 -5
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +17 -31
- package/dist/hooks/useMenuHover.d.ts.map +1 -1
- package/dist/hooks/useMenuHover.js +38 -52
- package/dist/hooks/useMenuPress.d.ts +22 -39
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +46 -99
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +3 -8
- package/dist/hooks/useRenamedProp.d.ts.map +1 -1
- package/dist/hooks/useRenamedProp.js +8 -17
- package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
- package/dist/hooks/useScrollOverflow.js +9 -27
- package/dist/hooks/useScrollableArea.d.ts +2 -4
- package/dist/hooks/useScrollableArea.d.ts.map +1 -1
- package/dist/hooks/useScrollableArea.js +14 -21
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +14 -36
- package/dist/hooks/useTreeFocus.d.ts +1 -1
- package/dist/hooks/useTreeFocus.js +2 -2
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +3 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +3 -0
- package/dist/privateAttributes/layerRoot.stylex.d.ts +9 -0
- package/dist/privateAttributes/layerRoot.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/layerRoot.stylex.js +28 -0
- package/dist/utils/clickGuard.d.ts +1 -2
- package/dist/utils/clickGuard.d.ts.map +1 -1
- package/dist/utils/clickGuard.js +18 -27
- package/dist/utils/coarsePointer.d.ts.map +1 -1
- package/dist/utils/coarsePointer.js +5 -7
- package/dist/utils/devWarning.d.ts.map +1 -1
- package/dist/utils/devWarning.js +4 -9
- package/dist/utils/focusOutline.stylex.d.ts +0 -16
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +7 -16
- package/dist/utils/focusReturn.d.ts +2 -3
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +2 -3
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +14 -17
- package/dist/utils/ime.d.ts.map +1 -1
- package/dist/utils/ime.js +23 -51
- package/dist/utils/inputPresentation.d.ts +5 -5
- package/dist/utils/inputPresentation.d.ts.map +1 -1
- package/dist/utils/inputPresentation.js +5 -5
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +18 -31
- package/dist/utils/interactionModality.d.ts +8 -37
- package/dist/utils/interactionModality.d.ts.map +1 -1
- package/dist/utils/interactionModality.js +20 -36
- package/dist/utils/interactionOverlay.stylex.d.ts +26 -92
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +58 -85
- package/dist/utils/plainDate.js +1 -1
- package/dist/utils/presentation.d.ts +3 -4
- package/dist/utils/presentation.d.ts.map +1 -1
- package/dist/utils/presentation.js +30 -45
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +50 -92
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +11 -21
- package/dist/utils/rtlStyles.d.ts +0 -24
- package/dist/utils/rtlStyles.d.ts.map +1 -1
- package/dist/utils/rtlStyles.js +13 -24
- package/dist/utils/selectionLock.d.ts +1 -2
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +20 -25
- package/dist/utils/timeFormat.d.ts +5 -13
- package/dist/utils/timeFormat.d.ts.map +1 -1
- package/dist/utils/timeFormat.js +5 -13
- package/dist/utils/touchPresentation.d.ts +4 -4
- package/dist/utils/touchPresentation.d.ts.map +1 -1
- package/dist/utils/touchPresentation.js +33 -55
- package/dist/utils/touchPresentation.stylex.d.ts +1 -1
- package/dist/utils/touchPresentation.stylex.d.ts.map +1 -1
- package/dist/utils/touchPresentation.stylex.js +7 -13
- package/dist/utils/typeaheadMatch.d.ts +1 -1
- package/dist/utils/typeaheadMatch.d.ts.map +1 -1
- package/dist/utils/typeaheadMatch.js +7 -6
- package/locales/en.json +12 -0
- package/locales/pseudo.json +9 -0
- package/package.json +4 -4
- package/src/BottomSheet/BottomSheet.tsx +77 -114
- package/src/BottomSheet/BottomSheetEdgeTint.tsx +10 -21
- package/src/BottomSheet/BottomSheetHostContext.ts +6 -10
- package/src/BottomSheet/BottomSheetPanel.tsx +55 -88
- package/src/BottomSheet/BottomSheetSwitcher.tsx +41 -78
- package/src/BottomSheet/bottomSheetEscape.ts +3 -3
- package/src/BottomSheet/bottomSheetStack.ts +42 -96
- package/src/BottomSheet/useMobileKeyboard.ts +12 -14
- package/src/BottomSheet/useSheetGestures.ts +60 -107
- package/src/Chat/ChatComposer.tsx +1 -6
- package/src/Chat/ChatComposerInput.tsx +9 -0
- package/src/Chat/useTriggerMenu.tsx +21 -4
- package/src/DateInput/DateInput.tsx +73 -7
- package/src/DateTimeInput/DateTimeInput.tsx +15 -20
- package/src/Dialog/Dialog.tsx +7 -1
- package/src/Drawer/Drawer.tsx +7 -1
- package/src/Field/index.ts +3 -1
- package/src/Field/textEntryTraits.ts +116 -0
- package/src/HStack/HStack.tsx +2 -1
- package/src/HoverCard/HoverCard.doc.mjs +58 -7
- package/src/HoverCard/HoverCard.tsx +8 -5
- package/src/HoverCard/useHoverCard.tsx +3 -2
- package/src/Item/Item.tsx +2 -11
- package/src/Layer/layerClickBoundary.ts +97 -0
- package/src/Layer/layerSurfacePress.ts +5 -9
- package/src/Layer/outsidePress.ts +81 -1
- package/src/Layer/useLayer.tsx +9 -2
- package/src/Lightbox/Lightbox.tsx +11 -5
- package/src/MobileNav/MobileNav.tsx +7 -1
- package/src/NavMenu/NavHeadingMenuItem.tsx +2 -1
- package/src/SelectableCard/SelectableCard.tsx +66 -1
- package/src/SideNav/SideNav.tsx +9 -6
- package/src/SideNav/SideNavHeading.tsx +23 -12
- package/src/SideNav/SideNavItem.tsx +2 -1
- package/src/SideNav/SideNavSection.tsx +2 -1
- package/src/Stack/Stack.doc.mjs +83 -11
- package/src/Stack/Stack.tsx +1 -1
- package/src/Stack/stack.stylex.ts +1 -1
- package/src/TextArea/TextArea.doc.mjs +65 -1
- package/src/TextArea/TextArea.tsx +20 -5
- package/src/TextInput/TextInput.doc.mjs +70 -6
- package/src/TextInput/TextInput.tsx +39 -8
- package/src/Toast/ToastViewport.tsx +4 -1
- package/src/Token/Token.tsx +1 -8
- package/src/Tokenizer/Tokenizer.tsx +81 -65
- package/src/TopNav/TopNav.tsx +16 -11
- package/src/TopNav/TopNavHeading.tsx +15 -8
- package/src/TopNav/TopNavMegaMenuItem.tsx +7 -2
- package/src/TopNav/TopNavMenu.tsx +2 -1
- package/src/Typeahead/BaseTypeahead.tsx +153 -22
- package/src/Typeahead/committedChoicesKey.tsx +37 -0
- package/src/hooks/ModalAnnounceProvider.tsx +7 -10
- package/src/hooks/actionGroupTracker.ts +23 -55
- package/src/hooks/menuPressGesture.ts +25 -30
- package/src/hooks/menuPressOnItems.ts +7 -9
- package/src/hooks/modalAnnounce.ts +20 -39
- package/src/hooks/scrollbarGutter.ts +9 -16
- package/src/hooks/useAnimatedLayout.ts +2 -3
- package/src/hooks/useAnnounce.ts +65 -106
- package/src/hooks/useAnnounceRenderedText.ts +32 -53
- package/src/hooks/useAutoMediaMode.ts +29 -54
- package/src/hooks/useBusyAnnouncement.ts +13 -20
- package/src/hooks/useClickableContainer.ts +10 -19
- package/src/hooks/useContainerReveal.ts +9 -36
- package/src/hooks/useDevWarning.ts +3 -8
- package/src/hooks/useEntryAnimation.ts +1 -3
- package/src/hooks/useHighlightedOptionScroll.ts +2 -4
- package/src/hooks/useHotkeys.ts +4 -16
- package/src/hooks/useImageMode.ts +6 -43
- package/src/hooks/useIndicatorFocusRing.tsx +13 -38
- package/src/hooks/useInputStatusIcon.tsx +19 -38
- package/src/hooks/useInteractiveRole.ts +6 -22
- package/src/hooks/useListFocus.ts +4 -5
- package/src/hooks/useLongPress.ts +17 -30
- package/src/hooks/useMenuHover.ts +38 -52
- package/src/hooks/useMenuPress.ts +46 -93
- package/src/hooks/useOverflow.ts +3 -8
- package/src/hooks/useRenamedProp.ts +8 -17
- package/src/hooks/useScrollOverflow.ts +9 -27
- package/src/hooks/useScrollableArea.ts +14 -21
- package/src/hooks/useStreamingText.ts +14 -33
- package/src/hooks/useTreeFocus.ts +3 -3
- package/src/i18n/generated-locales/en.generated.ts +4 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +4 -0
- package/src/privateAttributes/layerRoot.stylex.ts +28 -0
- package/src/utils/clickGuard.ts +19 -29
- package/src/utils/coarsePointer.ts +5 -7
- package/src/utils/devWarning.ts +4 -9
- package/src/utils/focusOutline.stylex.ts +9 -19
- package/src/utils/focusReturn.ts +2 -3
- package/src/utils/hitArea.ts +14 -17
- package/src/utils/ime.ts +23 -51
- package/src/utils/inputPresentation.ts +5 -5
- package/src/utils/inputStream.ts +18 -31
- package/src/utils/interactionModality.ts +21 -37
- package/src/utils/interactionOverlay.stylex.ts +72 -88
- package/src/utils/plainDate.ts +1 -1
- package/src/utils/presentation.ts +31 -47
- package/src/utils/pressFeedback.ts +50 -92
- package/src/utils/pressGesture.ts +11 -21
- package/src/utils/rtlStyles.ts +13 -24
- package/src/utils/selectionLock.ts +20 -25
- package/src/utils/timeFormat.ts +5 -13
- package/src/utils/touchPresentation.stylex.ts +8 -14
- package/src/utils/touchPresentation.ts +33 -55
- package/src/utils/typeaheadMatch.ts +7 -6
|
@@ -1,59 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file BottomSheet.tsx
|
|
3
|
-
* @input
|
|
3
|
+
* @input React, StyleX, core hooks, shared layer dismissal, the modal outlet
|
|
4
|
+
* registry, interaction modality, BottomSheetPanel, the switcher and host
|
|
5
|
+
* contexts, and the private bottom-sheet stack registry
|
|
4
6
|
* @output Exports BottomSheet component and BottomSheetProps
|
|
5
7
|
* @position Public BottomSheet router plus private standalone/switcher hosts
|
|
6
8
|
*
|
|
7
|
-
* BottomSheet selects one of two focused hosts. A standalone host owns its
|
|
8
|
-
* native dialog lifecycle and joins the shared layer dismissal stack; a
|
|
9
|
-
* switcher item owns a native dialog of its own too, but hands its lifecycle
|
|
10
|
-
* to the parent's transition state machine, scrim ownership, and dismissal
|
|
11
|
-
* registration. Both render the same BottomSheetPanel, which owns sheet
|
|
12
|
-
* presentation, content padding, gestures, mobile-keyboard accommodation,
|
|
13
|
-
* and motion completion.
|
|
14
|
-
*
|
|
15
|
-
* Every sheet dialog is native first. A scrim-backed sheet is presented with
|
|
16
|
-
* showModal(): the browser makes the page inert and keeps focus inside the
|
|
17
|
-
* dialog, delivers Escape and the platform close as `cancel`, paints the
|
|
18
|
-
* scrim as `::backdrop`, and returns focus to the opener on close(). Page
|
|
19
|
-
* scroll is locked by the shared useScrollLock hook, as for Dialog: a
|
|
20
|
-
* standalone sheet holds it while presented, a switcher holds one for the
|
|
21
|
-
* whole modal flow. The remaining script is what no single dialog can
|
|
22
|
-
* decide: gating `cancel` by `purpose` and the shared dismissal stack, the
|
|
23
|
-
* stack of sheets below, and, in a switcher, handing one scrim between two
|
|
24
|
-
* dialogs and keeping focus in the active sheet when a retained dialog
|
|
25
|
-
* closes.
|
|
26
|
-
*
|
|
27
|
-
* A standalone sheet also joins the private bottom-sheet stack
|
|
28
|
-
* (bottomSheetStack.ts) while it is presented. The stack is behaviour, not
|
|
29
|
-
* API: a modal sheet opened while another modal sheet is open stacks on top
|
|
30
|
-
* of it, the covered sheet recedes and is blocked, one scrim stays visible,
|
|
31
|
-
* and the native top layer is kept in open order even when several sheets
|
|
32
|
-
* open in one commit. A sheet rendered in another sheet's content leaves
|
|
33
|
-
* with its host and returns with it while its own `isOpen` is still true;
|
|
34
|
-
* its state is never written for it. A modal sheet on its own never
|
|
35
|
-
* notices the stack; when every sheet of a stack closes in one update, the
|
|
36
|
-
* registry returns focus once, to the bottom sheet's target, after the last
|
|
37
|
-
* dialog has closed.
|
|
38
|
-
*
|
|
39
|
-
* A standalone sheet closing in the same update as another standalone sheet
|
|
40
|
-
* opens, at the same level and from a control inside the closing sheet, is
|
|
41
|
-
* replaced by it: the two run the handoff a BottomSheetSwitcher runs between
|
|
42
|
-
* its steps (entering sheet above, retained sheet aligning down then fading,
|
|
43
|
-
* one steady scrim, focus into the new sheet and back to the flow's opener
|
|
44
|
-
* on close). The registry pairs them and drives the handoff; this host
|
|
45
|
-
* renders the retained panel state it reports, and reports its panel's
|
|
46
|
-
* motions back. Non-modal sheets (`hasScrim={false}`) are hosted as manual
|
|
47
|
-
* popovers so the top layer orders them, with `show()` below the Popover API
|
|
48
|
-
* floor; they never stack, but they replace each other the same way, and
|
|
49
|
-
* return focus to their opener on close only while the person is still in
|
|
50
|
-
* them.
|
|
51
|
-
*
|
|
52
|
-
* Every open standalone modal sheet supplies its dialog as an outlet for
|
|
53
|
-
* app-global surfaces (toasts) (Layer/modalOutlet.ts); the latest outlet,
|
|
54
|
-
* the one they render into, follows the sheet stack's order, so toasts land
|
|
55
|
-
* in the top sheet and return to the sheet beneath when it closes.
|
|
56
|
-
*
|
|
57
9
|
* SYNC: When modified, update these files to stay in sync:
|
|
58
10
|
* - /packages/core/src/BottomSheet/BottomSheetPanel.tsx
|
|
59
11
|
* - /packages/core/src/BottomSheet/BottomSheetEdgeTint.tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAuBH,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAuDhD,YAAY,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAwJhF,UAAU,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,qDAAqD;IACrD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IAEd,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,wGAAwG;IACxG,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;IAE7C;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,UAAU,wBAAyB,SAAQ,sBAAsB;IAC/D;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAC1B,0BAA0B,GAAG,wBAAwB,CAAC;AA21BxD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA6BlD;yBA7Be,WAAW"}
|
|
@@ -4,60 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file BottomSheet.tsx
|
|
7
|
-
* @input
|
|
7
|
+
* @input React, StyleX, core hooks, shared layer dismissal, the modal outlet
|
|
8
|
+
* registry, interaction modality, BottomSheetPanel, the switcher and host
|
|
9
|
+
* contexts, and the private bottom-sheet stack registry
|
|
8
10
|
* @output Exports BottomSheet component and BottomSheetProps
|
|
9
11
|
* @position Public BottomSheet router plus private standalone/switcher hosts
|
|
10
12
|
*
|
|
11
|
-
* BottomSheet selects one of two focused hosts. A standalone host owns its
|
|
12
|
-
* native dialog lifecycle and joins the shared layer dismissal stack; a
|
|
13
|
-
* switcher item owns a native dialog of its own too, but hands its lifecycle
|
|
14
|
-
* to the parent's transition state machine, scrim ownership, and dismissal
|
|
15
|
-
* registration. Both render the same BottomSheetPanel, which owns sheet
|
|
16
|
-
* presentation, content padding, gestures, mobile-keyboard accommodation,
|
|
17
|
-
* and motion completion.
|
|
18
|
-
*
|
|
19
|
-
* Every sheet dialog is native first. A scrim-backed sheet is presented with
|
|
20
|
-
* showModal(): the browser makes the page inert and keeps focus inside the
|
|
21
|
-
* dialog, delivers Escape and the platform close as `cancel`, paints the
|
|
22
|
-
* scrim as `::backdrop`, and returns focus to the opener on close(). Page
|
|
23
|
-
* scroll is locked by the shared useScrollLock hook, as for Dialog: a
|
|
24
|
-
* standalone sheet holds it while presented, a switcher holds one for the
|
|
25
|
-
* whole modal flow. The remaining script is what no single dialog can
|
|
26
|
-
* decide: gating `cancel` by `purpose` and the shared dismissal stack, the
|
|
27
|
-
* stack of sheets below, and, in a switcher, handing one scrim between two
|
|
28
|
-
* dialogs and keeping focus in the active sheet when a retained dialog
|
|
29
|
-
* closes.
|
|
30
|
-
*
|
|
31
|
-
* A standalone sheet also joins the private bottom-sheet stack
|
|
32
|
-
* (bottomSheetStack.ts) while it is presented. The stack is behaviour, not
|
|
33
|
-
* API: a modal sheet opened while another modal sheet is open stacks on top
|
|
34
|
-
* of it, the covered sheet recedes and is blocked, one scrim stays visible,
|
|
35
|
-
* and the native top layer is kept in open order even when several sheets
|
|
36
|
-
* open in one commit. A sheet rendered in another sheet's content leaves
|
|
37
|
-
* with its host and returns with it while its own `isOpen` is still true;
|
|
38
|
-
* its state is never written for it. A modal sheet on its own never
|
|
39
|
-
* notices the stack; when every sheet of a stack closes in one update, the
|
|
40
|
-
* registry returns focus once, to the bottom sheet's target, after the last
|
|
41
|
-
* dialog has closed.
|
|
42
|
-
*
|
|
43
|
-
* A standalone sheet closing in the same update as another standalone sheet
|
|
44
|
-
* opens, at the same level and from a control inside the closing sheet, is
|
|
45
|
-
* replaced by it: the two run the handoff a BottomSheetSwitcher runs between
|
|
46
|
-
* its steps (entering sheet above, retained sheet aligning down then fading,
|
|
47
|
-
* one steady scrim, focus into the new sheet and back to the flow's opener
|
|
48
|
-
* on close). The registry pairs them and drives the handoff; this host
|
|
49
|
-
* renders the retained panel state it reports, and reports its panel's
|
|
50
|
-
* motions back. Non-modal sheets (`hasScrim={false}`) are hosted as manual
|
|
51
|
-
* popovers so the top layer orders them, with `show()` below the Popover API
|
|
52
|
-
* floor; they never stack, but they replace each other the same way, and
|
|
53
|
-
* return focus to their opener on close only while the person is still in
|
|
54
|
-
* them.
|
|
55
|
-
*
|
|
56
|
-
* Every open standalone modal sheet supplies its dialog as an outlet for
|
|
57
|
-
* app-global surfaces (toasts) (Layer/modalOutlet.ts); the latest outlet,
|
|
58
|
-
* the one they render into, follows the sheet stack's order, so toasts land
|
|
59
|
-
* in the top sheet and return to the sheet beneath when it closes.
|
|
60
|
-
*
|
|
61
13
|
* SYNC: When modified, update these files to stay in sync:
|
|
62
14
|
* - /packages/core/src/BottomSheet/BottomSheetPanel.tsx
|
|
63
15
|
* - /packages/core/src/BottomSheet/BottomSheetEdgeTint.tsx
|
|
@@ -76,6 +28,27 @@
|
|
|
76
28
|
* - /apps/storybook/stories/BottomSheetReplace.stories.tsx
|
|
77
29
|
* - /packages/cli/assets/templates/blocks/components/BottomSheet/BottomSheetShowcase.tsx
|
|
78
30
|
*/
|
|
31
|
+
|
|
32
|
+
// BottomSheet picks one of two hosts. A standalone host owns its native
|
|
33
|
+
// dialog and joins the shared layer dismissal stack. A switcher item also
|
|
34
|
+
// owns a native dialog, but its parent switcher owns the lifecycle, the scrim
|
|
35
|
+
// and dismissal. Both render BottomSheetPanel, which owns presentation,
|
|
36
|
+
// padding, gestures, the mobile keyboard and motion.
|
|
37
|
+
//
|
|
38
|
+
// A scrim sheet uses showModal(), so the browser makes the page inert, keeps
|
|
39
|
+
// focus in the dialog, sends Escape as `cancel`, paints `::backdrop`, and
|
|
40
|
+
// returns focus on close(). Script does only what one dialog cannot: it gates
|
|
41
|
+
// `cancel` by `purpose`, orders the stack of sheets, and hands one scrim
|
|
42
|
+
// between dialogs.
|
|
43
|
+
//
|
|
44
|
+
// A standalone sheet joins the private sheet stack (bottomSheetStack.ts)
|
|
45
|
+
// while it is presented. A modal sheet opened over another stacks on top, and
|
|
46
|
+
// the covered sheet recedes. The stack keeps the top layer in open order,
|
|
47
|
+
// also when several sheets open in one commit. A sheet that closes as another
|
|
48
|
+
// opens, from a control inside it, is replaced with the switcher's handoff.
|
|
49
|
+
// Non-modal sheets (`hasScrim={false}`) are manual popovers. They never
|
|
50
|
+
// stack, but they replace each other. Each open modal sheet is an outlet for
|
|
51
|
+
// toasts (Layer/modalOutlet.ts), in stack order.
|
|
79
52
|
import { use, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
80
53
|
import { useIsHydrating } from "../hooks/useIsHydrating.js";
|
|
81
54
|
import { useSettledOpen } from "../hooks/useSettledOpen.js";
|
|
@@ -98,6 +71,7 @@ import { BottomSheetHostContext, CLOSED_BOTTOM_SHEET_HOST, OPEN_BOTTOM_SHEET_HOS
|
|
|
98
71
|
import { BOTTOM_SHEET_STACK_DEFAULT_VIEW, cancelScrimWrite, closeDialogKeepingFocus, focusSheetPanel, getBottomSheetBeneath, hideSheetHost, isClosingTogether, isSheetHostPresented, presentStepModally, presentWithClearScrim, registerBottomSheet, reportBottomSheetMotion, reportClosedTogether, sealBottomSheetBatch, setBottomSheetOpen, showSheetHostNonModal, writeScrimOpacity } from "./bottomSheetStack.js";
|
|
99
72
|
import { BottomSheetSwitcherContext } from "./BottomSheetSwitcherContext.js";
|
|
100
73
|
import { BottomSheetEscapeContext } from "./bottomSheetEscape.js";
|
|
74
|
+
import { layerClickBoundary } from "../Layer/layerClickBoundary.js";
|
|
101
75
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
102
76
|
const styles = {
|
|
103
77
|
dialog: {
|
|
@@ -278,18 +252,16 @@ function StandaloneBottomSheet({
|
|
|
278
252
|
// state stays the consumer's; nothing here writes it.
|
|
279
253
|
const host = use(BottomSheetHostContext);
|
|
280
254
|
const isHostOpen = host?.isOpen ?? true;
|
|
281
|
-
// A sheet open on the server renders closed until hydration
|
|
282
|
-
// the render
|
|
283
|
-
// <dialog> painted open with aria-modal before it is modal claims a state
|
|
284
|
-
// does not have
|
|
255
|
+
// A sheet open on the server renders closed until hydration. It opens in
|
|
256
|
+
// the next render, the first one that can enter its native host. A
|
|
257
|
+
// <dialog> painted open with aria-modal before it is modal claims a state
|
|
258
|
+
// it does not have.
|
|
285
259
|
const isHydrating = useIsHydrating();
|
|
286
260
|
const isOpen = isOpenProp && isHostOpen && !isHydrating;
|
|
287
|
-
// A sheet open on the server
|
|
288
|
-
//
|
|
289
|
-
//
|
|
290
|
-
//
|
|
291
|
-
// The latch is released when the settled entry's transition ends, so a
|
|
292
|
-
// drag's settle later in the same open glides as usual.
|
|
261
|
+
// A sheet open on the server opens settled, with no rise or fade-in. Later
|
|
262
|
+
// opens and closes animate. It latches on its own request, not its host's
|
|
263
|
+
// state, because a hydrating host reads as closed. The latch ends when the
|
|
264
|
+
// settled entry's transition ends, so a later drag settle glides.
|
|
293
265
|
const [settledOpen, releaseSettledOpen] = useSettledOpen(isOpenProp, isOpen, false);
|
|
294
266
|
const isEntrySettled = settledOpen && isOpen;
|
|
295
267
|
// Presentation outlives the controlled prop: a closing sheet stays mounted
|
|
@@ -312,14 +284,12 @@ function StandaloneBottomSheet({
|
|
|
312
284
|
// Closed and being replaced by the sheet that opened in the same update:
|
|
313
285
|
// the panel is retained (stays, aligns, fades) instead of sliding out.
|
|
314
286
|
const isReplaced = !isOpen && isPresented && stackView.replacedMotion != null;
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
// flag is keyed to the close it settles: every change of `isOpen` starts
|
|
322
|
-
// it over, during render, and the layout effect below settles a close.
|
|
287
|
+
// Only the layout phase knows if a replace pairs this close. Until the
|
|
288
|
+
// registry answers (a synchronous re-render before paint), the panel holds
|
|
289
|
+
// its open pose. An exit pose rendered first would start the exit
|
|
290
|
+
// transition, and the reversal would snap the panel to rest. Each change of
|
|
291
|
+
// `isOpen` restarts the flag during render, and the layout effect below
|
|
292
|
+
// settles a close.
|
|
323
293
|
const [isCloseSettled, setIsCloseSettled] = useState(false);
|
|
324
294
|
const [settledIsOpen, setSettledIsOpen] = useState(isOpen);
|
|
325
295
|
if (settledIsOpen !== isOpen) {
|
|
@@ -455,17 +425,12 @@ function StandaloneBottomSheet({
|
|
|
455
425
|
}
|
|
456
426
|
}, [hasScrim, isOpen, shouldPresent]);
|
|
457
427
|
|
|
458
|
-
//
|
|
459
|
-
//
|
|
460
|
-
//
|
|
461
|
-
//
|
|
462
|
-
//
|
|
463
|
-
//
|
|
464
|
-
// the latest sheet again and takes the toasts back; a Dialog opened from a
|
|
465
|
-
// sheet is supplied later and stays above every sheet. A closing sheet stays modal through its
|
|
466
|
-
// exit animation, but inert and hidden, so it stops supplying as soon as it
|
|
467
|
-
// starts closing. The registry reports a lone open sheet as the top one.
|
|
468
|
-
// Passive: it runs after the layout effects that present.
|
|
428
|
+
// An open modal sheet hosts app-global surfaces (toasts), so they stay
|
|
429
|
+
// visible above it. The latest outlet follows the sheet stack's order, so a
|
|
430
|
+
// toast lands in the top sheet and goes back to the revealed sheet when the
|
|
431
|
+
// top one closes. A Dialog opened from a sheet stays above every sheet. A
|
|
432
|
+
// closing sheet stops supplying when it starts to close. Passive: it runs
|
|
433
|
+
// after the layout effects that present.
|
|
469
434
|
useModalOutlet(dialogRef, isOpen && hasScrim, stackView.isTop, 'bottom-sheet');
|
|
470
435
|
// Closes a batch of same-commit opens; see sealBottomSheetBatch.
|
|
471
436
|
useEffect(() => {
|
|
@@ -521,19 +486,15 @@ function StandaloneBottomSheet({
|
|
|
521
486
|
hideSheetHost(dialog);
|
|
522
487
|
}
|
|
523
488
|
setIsPresented(false);
|
|
524
|
-
// The
|
|
525
|
-
//
|
|
526
|
-
// may already have restored focus to the target with a ring; the helper
|
|
527
|
-
// clears it first.
|
|
489
|
+
// The native close can show a focus ring on the target. Clear it. The
|
|
490
|
+
// ring shows only after keyboard input.
|
|
528
491
|
//
|
|
529
|
-
//
|
|
530
|
-
//
|
|
492
|
+
// If a sheet is open below, focus goes to this sheet's opener when it is
|
|
493
|
+
// in that sheet, else to that sheet's panel.
|
|
531
494
|
//
|
|
532
|
-
//
|
|
533
|
-
//
|
|
534
|
-
//
|
|
535
|
-
// focus, and the page behind it was live, so focus the person took
|
|
536
|
-
// elsewhere stays there).
|
|
495
|
+
// A non-modal sheet returns focus to its opener only if focus was still
|
|
496
|
+
// in the sheet. The page behind it stays live, so the person can move
|
|
497
|
+
// focus away first.
|
|
537
498
|
const revealed = hasScrim ? getBottomSheetBeneath(stackKeyRef.current) : null;
|
|
538
499
|
const returnTarget = finalFocusRef?.current ?? (hasScrim || hadFocusAtCloseRef.current ? triggerRef.current : null);
|
|
539
500
|
if (revealed != null && (returnTarget == null || !revealed.element.contains(returnTarget))) {
|
|
@@ -624,8 +585,13 @@ function StandaloneBottomSheet({
|
|
|
624
585
|
inert: isInert ? true : undefined,
|
|
625
586
|
"data-sheet-stack": hasScrim ? stackStateAttribute(stackView, isOpen) : undefined,
|
|
626
587
|
"data-sheet-stack-depth": hasScrim && stackView.depth > 0 ? stackView.depth : undefined,
|
|
627
|
-
onCancel: handleCancel
|
|
628
|
-
|
|
588
|
+
onCancel: handleCancel
|
|
589
|
+
// Presses inside the sheet do not reach handlers around where it is
|
|
590
|
+
// written. The dialog, not the panel, is the root, as in a switcher.
|
|
591
|
+
,
|
|
592
|
+
...layerClickBoundary({
|
|
593
|
+
onClick: handleClick
|
|
594
|
+
}),
|
|
629
595
|
children: [/*#__PURE__*/_jsx(BottomSheetPanel, {
|
|
630
596
|
...props,
|
|
631
597
|
ref: ref,
|
|
@@ -704,7 +670,7 @@ function SwitcherBottomSheetItem({
|
|
|
704
670
|
const isInteractive = phase === 'active' || phase === 'entering';
|
|
705
671
|
const isInactive = phase === 'covered' || phase === 'aligning' || phase === 'fading' || phase === 'exiting';
|
|
706
672
|
const isPresented = phase !== 'hidden';
|
|
707
|
-
// The step open on the server opens settled
|
|
673
|
+
// The step open on the server opens settled.
|
|
708
674
|
const isEntrySettled = hasValidSheetId && isPresented && settledSheet === sheetId;
|
|
709
675
|
const isTopSheet = phase === 'active' || phase === 'entering';
|
|
710
676
|
const ownsScrim = hasValidSheetId && isScrimOwner(sheetId);
|
|
@@ -874,8 +840,15 @@ function SwitcherBottomSheetItem({
|
|
|
874
840
|
"data-sheet-stack-depth": hasScrim && isPresented && stackView.depth > 0 ? stackView.depth : undefined,
|
|
875
841
|
role: purpose === 'required' ? 'alertdialog' : switcherDialogProps.role,
|
|
876
842
|
onCancel: onDialogCancel,
|
|
877
|
-
|
|
878
|
-
|
|
843
|
+
onKeyDown: onDialogKeyDown
|
|
844
|
+
// Presses inside the sheet do not reach handlers around where it is
|
|
845
|
+
// written. The step's dialog, not the panel, is the root, because the
|
|
846
|
+
// switcher's handlers sit here and must still run.
|
|
847
|
+
,
|
|
848
|
+
...layerClickBoundary({
|
|
849
|
+
...switcherDialogProps,
|
|
850
|
+
onClick: onDialogClick
|
|
851
|
+
}),
|
|
879
852
|
children: [/*#__PURE__*/_jsx("div", {
|
|
880
853
|
...stylex.props(styles.positioner, !isPresented && styles.positionerHidden, isTopSheet && styles.positionerTop, ...(hasScrim ? stackPositionerStyles(stackView) : [])),
|
|
881
854
|
hidden: !isPresented,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetEdgeTint.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetEdgeTint.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomSheetEdgeTint.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetEdgeTint.tsx"],"names":[],"mappings":"AAuDA;;;GAGG;AACH,wBAAgB,mBAAmB,gCAQlC"}
|
|
@@ -4,34 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file BottomSheetEdgeTint.tsx
|
|
7
|
-
* @input
|
|
8
|
-
* @output
|
|
7
|
+
* @input StyleX and core color tokens
|
|
8
|
+
* @output BottomSheetEdgeTint, an internal decorative element
|
|
9
9
|
* @position Private helper rendered inside every BottomSheet dialog
|
|
10
10
|
*
|
|
11
|
-
* iOS 26 Safari dropped `<meta name="theme-color">` and instead derives the
|
|
12
|
-
* colour it paints behind its translucent toolbars by sampling the page: it
|
|
13
|
-
* hit tests a point just inside each viewport edge, walks up to the nearest
|
|
14
|
-
* `fixed`/`sticky` ancestor, and extends that element's declared
|
|
15
|
-
* `background-color` into the browser chrome.
|
|
16
|
-
*
|
|
17
|
-
* WebKit may otherwise extend either the dialog backdrop or the host page into
|
|
18
|
-
* the browser chrome. Which one wins varies with dialog mode and the page's
|
|
19
|
-
* own fixed or sticky edge content, so relying on the backdrop makes otherwise
|
|
20
|
-
* identical BottomSheets produce different toolbar colours.
|
|
21
|
-
*
|
|
22
|
-
* This element gives the heuristic something unambiguous to sample: fixed,
|
|
23
|
-
* full width, flush with the bottom edge, taller than WebKit's 10px minimum
|
|
24
|
-
* for reading a declared colour, and painted in the sheet's own surface
|
|
25
|
-
* colour. It is masked out so it never renders for the user; Safari reads the
|
|
26
|
-
* computed style, not the painted pixels.
|
|
27
|
-
*
|
|
28
|
-
* Everywhere else it is inert decoration.
|
|
29
|
-
*
|
|
30
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
31
12
|
* - /packages/core/src/BottomSheet/BottomSheet.tsx
|
|
32
13
|
* - /packages/core/src/BottomSheet/BottomSheetSwitcher.tsx
|
|
33
14
|
* - /packages/core/src/BottomSheet/BottomSheetEdgeTint.test.tsx
|
|
34
15
|
*/
|
|
16
|
+
|
|
17
|
+
// iOS Safari colors its translucent toolbars by sampling the page. It hit
|
|
18
|
+
// tests a point inside each viewport edge, finds the nearest fixed or sticky
|
|
19
|
+
// ancestor, and extends its `background-color`. Without this element, WebKit
|
|
20
|
+
// can pick the dialog backdrop or the page, so equal sheets get different
|
|
21
|
+
// toolbar colors. This element is fixed, full width, at the bottom edge,
|
|
22
|
+
// taller than WebKit's 10px minimum, and in the sheet's surface color. It is
|
|
23
|
+
// masked out: Safari reads the computed style, not the pixels.
|
|
35
24
|
import * as stylex from '@stylexjs/stylex';
|
|
36
25
|
import "../theme/tokens.stylex.js";
|
|
37
26
|
import { colorVars } from "../theme/tokens.stylex.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetHostContext.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetHostContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomSheetHostContext.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetHostContext.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,2BAA2B;IAC1C,0EAA0E;IAC1E,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,sBAAsB,6DACsB,CAAC;AAG1D,eAAO,MAAM,sBAAsB,EAAE,2BAEpC,CAAC;AACF,eAAO,MAAM,wBAAwB,EAAE,2BAEtC,CAAC"}
|
|
@@ -13,17 +13,13 @@
|
|
|
13
13
|
* - /packages/core/src/BottomSheet/BottomSheet.tsx
|
|
14
14
|
* - /packages/core/src/BottomSheet/BottomSheetSwitcher.tsx
|
|
15
15
|
* - /packages/core/src/BottomSheet/BottomSheetStacking.test.tsx
|
|
16
|
-
*
|
|
17
|
-
* A sheet rendered in another sheet's content is part of that sheet: it is
|
|
18
|
-
* presented only while its host is open, leaves with it, and comes back with
|
|
19
|
-
* it if its own `isOpen` is still true. Without this a host closing from code
|
|
20
|
-
* would leave the inner dialog open in the top layer with no box to paint —
|
|
21
|
-
* an invisible modal blocking the page. The inner sheet's state is never
|
|
22
|
-
* written by the host: it stays the consumer's, as with a Dialog rendered in
|
|
23
|
-
* a closed Dialog. The context is provided by every host (standalone, modal
|
|
24
|
-
* or not, and each switcher step) and read by every standalone sheet and
|
|
25
|
-
* every switcher flow; at the root it is null, which reads as "open".
|
|
26
16
|
*/
|
|
17
|
+
|
|
18
|
+
// A sheet rendered in another sheet's content is presented only while its
|
|
19
|
+
// host is open. Without this, a host that closes from code would leave the
|
|
20
|
+
// inner dialog open in the top layer with no box: an invisible modal that
|
|
21
|
+
// blocks the page. The host never writes the inner sheet's state. At the
|
|
22
|
+
// root the context is null, which reads as open.
|
|
27
23
|
import { createContext } from 'react';
|
|
28
24
|
export const BottomSheetHostContext = /*#__PURE__*/createContext(null);
|
|
29
25
|
BottomSheetHostContext.displayName = 'BottomSheetHostContext';
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
* @file BottomSheetPanel.tsx
|
|
3
3
|
* @input Uses React, StyleX, theme tokens, text/provider boundaries, container padding, sheet gestures, shared scroll behavior, and the host label
|
|
4
4
|
* @output Internal BottomSheetPanel with a keyboard-reachable scrolling body and motion-state types
|
|
5
|
-
* @position Shared presentation layer for standalone and switcher
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* drag and snap gestures, the handle and scrolling body, the content box's
|
|
9
|
-
* container padding, motion styles, and transition completion. It owns the
|
|
10
|
-
* body's keyboard access; dialog focus entry/return, inert state, and switcher
|
|
11
|
-
* registration belong to the host.
|
|
5
|
+
* @position Shared presentation layer for standalone and switcher
|
|
6
|
+
* BottomSheets. It owns the sheet surface and the body's keyboard access.
|
|
7
|
+
* The host owns dialog focus, inert state and switcher registration.
|
|
12
8
|
*
|
|
13
9
|
* SYNC: When modified, update these files to stay in sync:
|
|
14
10
|
* - /packages/core/src/BottomSheet/BottomSheet.tsx
|
|
@@ -49,7 +45,7 @@ interface BottomSheetPanelProps extends BaseProps<HTMLDivElement> {
|
|
|
49
45
|
state: BottomSheetPanelState;
|
|
50
46
|
/**
|
|
51
47
|
* Whether the sheet was open on page load: it then opens where it rests,
|
|
52
|
-
* with no entry motion
|
|
48
|
+
* with no entry motion.
|
|
53
49
|
*/
|
|
54
50
|
isEntrySettled?: boolean;
|
|
55
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA+B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAQvB,QAAA,MAAM,cAAc;;;;CAIV,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,cAAc,CAAC;AAC5D,YAAY,EAAC,oBAAoB,EAAC,CAAC;AA4CnC,eAAO,MAAM,2BAA2B,2DACkB,CAAC;AAsM3D,MAAM,MAAM,sBAAsB,GAChC,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,qBAAqB,GAC7B;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAChB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,GACjC;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;CACzB,GACD;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC;AAEtB,UAAU,qBAAsB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC/D,+CAA+C;IAC/C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,KAAK,EAAE,qBAAqB,CAAC;IAC7B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5C,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,UAAU,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IACjD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACzD,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC7D;AA2HD,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,KAAK,EACL,eAAe,EACf,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,EACR,MAAM,EACN,cAAsB,EACtB,cAAc,EACd,eAAe,EACf,qBAA4B,EAC5B,kBAA0B,EAC1B,SAAS,EACT,cAAc,EACd,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,qBAAqB,+BAkZvB;yBA1ae,gBAAgB"}
|
|
@@ -6,13 +6,9 @@
|
|
|
6
6
|
* @file BottomSheetPanel.tsx
|
|
7
7
|
* @input Uses React, StyleX, theme tokens, text/provider boundaries, container padding, sheet gestures, shared scroll behavior, and the host label
|
|
8
8
|
* @output Internal BottomSheetPanel with a keyboard-reachable scrolling body and motion-state types
|
|
9
|
-
* @position Shared presentation layer for standalone and switcher
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* drag and snap gestures, the handle and scrolling body, the content box's
|
|
13
|
-
* container padding, motion styles, and transition completion. It owns the
|
|
14
|
-
* body's keyboard access; dialog focus entry/return, inert state, and switcher
|
|
15
|
-
* registration belong to the host.
|
|
9
|
+
* @position Shared presentation layer for standalone and switcher
|
|
10
|
+
* BottomSheets. It owns the sheet surface and the body's keyboard access.
|
|
11
|
+
* The host owns dialog focus, inert state and switcher registration.
|
|
16
12
|
*
|
|
17
13
|
* SYNC: When modified, update these files to stay in sync:
|
|
18
14
|
* - /packages/core/src/BottomSheet/BottomSheet.tsx
|
|
@@ -56,12 +52,10 @@ const TRANSITION_BACKSTOP_BUFFER_MS = 50;
|
|
|
56
52
|
// padding already provides.
|
|
57
53
|
const HANDLE_BAR_HEIGHT = spacingVars['--spacing-6'];
|
|
58
54
|
|
|
59
|
-
// Measure the
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
// keyboard is `useMobileKeyboard`'s business — it holds the sheet still and
|
|
64
|
-
// scrolls the body — and it does not redefine the sheet's detents.
|
|
55
|
+
// Measure the viewport that the height budgets use. They are `dvh`, which
|
|
56
|
+
// the virtual keyboard does not shrink, so `visualViewport` would differ by
|
|
57
|
+
// the keyboard's height. `useMobileKeyboard` handles the keyboard and does
|
|
58
|
+
// not change the detents.
|
|
65
59
|
function layoutViewportHeight() {
|
|
66
60
|
return typeof window === 'undefined' ? 0 : window.innerHeight;
|
|
67
61
|
}
|
|
@@ -83,9 +77,8 @@ function snapPointsKeyFor(points) {
|
|
|
83
77
|
}
|
|
84
78
|
|
|
85
79
|
/**
|
|
86
|
-
* The
|
|
87
|
-
*
|
|
88
|
-
* (DR3). The cross-fade's ceiling is the record's 200 ms.
|
|
80
|
+
* The reduced-motion queries. With a coarse primary pointer the sheet
|
|
81
|
+
* cross-fades, else it changes at once. The cross-fade lasts at most 200 ms.
|
|
89
82
|
*/
|
|
90
83
|
const REDUCED_MOTION_COARSE = '@media (prefers-reduced-motion: reduce) and (pointer: coarse)';
|
|
91
84
|
export const REDUCED_MOTION_COARSE_QUERY = '(prefers-reduced-motion: reduce) and (pointer: coarse)';
|
|
@@ -185,10 +178,9 @@ const styles = {
|
|
|
185
178
|
}
|
|
186
179
|
};
|
|
187
180
|
/**
|
|
188
|
-
* A hidden sheet observes nothing
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* mutation or viewport observers.
|
|
181
|
+
* A hidden sheet observes nothing. The scroll area's measuring ref attaches
|
|
182
|
+
* as the sheet presents and detaches when it is hidden, so a closed sheet
|
|
183
|
+
* that stays mounted holds no resize, mutation or viewport observers.
|
|
192
184
|
*/
|
|
193
185
|
function whilePresented(isPresented, props) {
|
|
194
186
|
return isPresented ? props : {
|
|
@@ -336,8 +328,7 @@ export function BottomSheetPanel({
|
|
|
336
328
|
const isClosing = state.kind === 'exiting';
|
|
337
329
|
const isFading = isRetained && state.motion === 'fading';
|
|
338
330
|
// Under reduced motion a retained sheet does not align down to a shorter
|
|
339
|
-
// entering sheet
|
|
340
|
-
// it is.
|
|
331
|
+
// entering sheet, because that is travel. It fades where it is.
|
|
341
332
|
const isReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
|
|
342
333
|
const alignmentOffset = isRetained && !isReducedMotion ? state.alignmentOffset : 0;
|
|
343
334
|
|
|
@@ -444,10 +435,9 @@ export function BottomSheetPanel({
|
|
|
444
435
|
// could be mistaken for the panel unmounting and cancel a sheet handoff.
|
|
445
436
|
useImperativeHandle(ref, () => elementRef.current, []);
|
|
446
437
|
const motion = motionForState(state);
|
|
447
|
-
//
|
|
448
|
-
//
|
|
449
|
-
//
|
|
450
|
-
// a touch drag; DR3 covers it and the rest.
|
|
438
|
+
// The cross-fade applies on a coarse pointer, and to a transition that a
|
|
439
|
+
// touch drag's release started: a finger's swipe dismissal fades in place on
|
|
440
|
+
// every pointer. A mouse or pen drag is not a touch drag.
|
|
451
441
|
const isCoarseCrossFade = useMediaQuery(REDUCED_MOTION_COARSE_QUERY);
|
|
452
442
|
const isCrossFade = isCoarseCrossFade || isReducedMotion && isDismissedByTouchDrag;
|
|
453
443
|
useLayoutEffect(() => {
|
|
@@ -460,12 +450,11 @@ export function BottomSheetPanel({
|
|
|
460
450
|
pendingMotionCompleteRef.current = motion;
|
|
461
451
|
return;
|
|
462
452
|
}
|
|
463
|
-
// What ends a motion: the fade is opacity
|
|
464
|
-
// exit are transforms
|
|
465
|
-
//
|
|
466
|
-
//
|
|
467
|
-
//
|
|
468
|
-
// and the two fades cross; the alignment is instant.
|
|
453
|
+
// What ends a motion: the fade is opacity, and the entrance, alignment and
|
|
454
|
+
// exit are transforms. Under the reduced-motion cross-fade an exit fades
|
|
455
|
+
// where it is, and its dialog closes only after the fade, so it waits on
|
|
456
|
+
// opacity. The entrance still waits on its instant transform, so the
|
|
457
|
+
// retained sheet's fade starts at once and the two fades cross.
|
|
469
458
|
const crossFadeMotion = isCrossFade && motion === 'exiting';
|
|
470
459
|
return waitForTransition(elementRef.current, motion === 'fading' || crossFadeMotion ? 'opacity' : 'transform', () => {
|
|
471
460
|
if (startedMotionRef.current === motion) {
|
|
@@ -543,24 +532,18 @@ export function BottomSheetPanel({
|
|
|
543
532
|
const consumerTransform = style?.transform;
|
|
544
533
|
const hostHeight = isInteractive || isRetained || isClosing ? resizedHeight : undefined;
|
|
545
534
|
const bodyEndPadding = scrollPreservationPadding(scrollPreservationInset);
|
|
546
|
-
// The transform is written to the element here, not
|
|
547
|
-
//
|
|
548
|
-
//
|
|
549
|
-
//
|
|
550
|
-
//
|
|
551
|
-
//
|
|
552
|
-
//
|
|
553
|
-
// transition, so a settle or a dismissal animates from the live position.
|
|
535
|
+
// The transform is written to the element here, not through the style
|
|
536
|
+
// prop. A drag writes it straight to the element and renders nothing, so
|
|
537
|
+
// React never sees those writes. Through the prop, React would skip the
|
|
538
|
+
// resting value as unchanged, and the sheet would stay where the finger
|
|
539
|
+
// left it. Written after each commit outside a drag, the resting value
|
|
540
|
+
// lands with the restored transition, so a settle animates from the live
|
|
541
|
+
// position.
|
|
554
542
|
//
|
|
555
|
-
//
|
|
556
|
-
//
|
|
557
|
-
//
|
|
558
|
-
//
|
|
559
|
-
// finds them unchanged and writes nothing, so the sheet would stay drawn at
|
|
560
|
-
// the drag's height. They are written here after every commit, outside a
|
|
561
|
-
// drag, for the same reason as the transform. A caller's height is left to
|
|
562
|
-
// the style prop: the drag does not write over it, so there is nothing to
|
|
563
|
-
// restore.
|
|
543
|
+
// A drag that crosses its base detent also writes the height and the end
|
|
544
|
+
// inset. If the release runs before that move's render commits, React sees
|
|
545
|
+
// no change and writes nothing, so these are written here too. A caller's
|
|
546
|
+
// height stays in the style prop, because the drag does not write it.
|
|
564
547
|
useLayoutEffect(() => {
|
|
565
548
|
if (isDragging) {
|
|
566
549
|
return;
|