@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.
Files changed (353) hide show
  1. package/dist/BottomSheet/BottomSheet.d.ts +3 -51
  2. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  3. package/dist/BottomSheet/BottomSheet.js +69 -96
  4. package/dist/BottomSheet/BottomSheetEdgeTint.d.ts.map +1 -1
  5. package/dist/BottomSheet/BottomSheetEdgeTint.js +10 -21
  6. package/dist/BottomSheet/BottomSheetHostContext.d.ts.map +1 -1
  7. package/dist/BottomSheet/BottomSheetHostContext.js +6 -10
  8. package/dist/BottomSheet/BottomSheetPanel.d.ts +4 -8
  9. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  10. package/dist/BottomSheet/BottomSheetPanel.js +32 -49
  11. package/dist/BottomSheet/BottomSheetSwitcher.d.ts +7 -56
  12. package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
  13. package/dist/BottomSheet/BottomSheetSwitcher.js +36 -71
  14. package/dist/BottomSheet/bottomSheetEscape.js +3 -3
  15. package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
  16. package/dist/BottomSheet/bottomSheetStack.js +42 -96
  17. package/dist/BottomSheet/useMobileKeyboard.d.ts +0 -14
  18. package/dist/BottomSheet/useMobileKeyboard.d.ts.map +1 -1
  19. package/dist/BottomSheet/useMobileKeyboard.js +12 -14
  20. package/dist/BottomSheet/useSheetGestures.d.ts +12 -76
  21. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  22. package/dist/BottomSheet/useSheetGestures.js +58 -104
  23. package/dist/Chat/ChatComposer.d.ts.map +1 -1
  24. package/dist/Chat/ChatComposer.js +1 -5
  25. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  26. package/dist/Chat/ChatComposerInput.js +9 -0
  27. package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
  28. package/dist/Chat/useTriggerMenu.js +18 -4
  29. package/dist/DateInput/DateInput.d.ts.map +1 -1
  30. package/dist/DateInput/DateInput.js +53 -7
  31. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  32. package/dist/DateTimeInput/DateTimeInput.js +4 -10
  33. package/dist/Dialog/Dialog.d.ts.map +1 -1
  34. package/dist/Dialog/Dialog.js +5 -1
  35. package/dist/Drawer/Drawer.d.ts.map +1 -1
  36. package/dist/Drawer/Drawer.js +5 -1
  37. package/dist/Field/index.d.ts +3 -1
  38. package/dist/Field/index.d.ts.map +1 -1
  39. package/dist/Field/index.js +2 -1
  40. package/dist/Field/textEntryTraits.d.ts +86 -0
  41. package/dist/Field/textEntryTraits.d.ts.map +1 -0
  42. package/dist/Field/textEntryTraits.js +81 -0
  43. package/dist/HStack/HStack.d.ts +2 -1
  44. package/dist/HStack/HStack.d.ts.map +1 -1
  45. package/dist/HStack/HStack.js +2 -1
  46. package/dist/HoverCard/HoverCard.d.ts +8 -5
  47. package/dist/HoverCard/HoverCard.d.ts.map +1 -1
  48. package/dist/HoverCard/HoverCard.js +1 -0
  49. package/dist/HoverCard/useHoverCard.d.ts +3 -2
  50. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  51. package/dist/Item/Item.d.ts.map +1 -1
  52. package/dist/Item/Item.js +2 -6
  53. package/dist/Layer/layerClickBoundary.d.ts +35 -0
  54. package/dist/Layer/layerClickBoundary.d.ts.map +1 -0
  55. package/dist/Layer/layerClickBoundary.js +61 -0
  56. package/dist/Layer/layerSurfacePress.d.ts.map +1 -1
  57. package/dist/Layer/layerSurfacePress.js +5 -9
  58. package/dist/Layer/outsidePress.d.ts +20 -0
  59. package/dist/Layer/outsidePress.d.ts.map +1 -1
  60. package/dist/Layer/outsidePress.js +52 -1
  61. package/dist/Layer/useLayer.d.ts.map +1 -1
  62. package/dist/Layer/useLayer.js +11 -2
  63. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  64. package/dist/Lightbox/Lightbox.js +8 -4
  65. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  66. package/dist/MobileNav/MobileNav.js +9 -2
  67. package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
  68. package/dist/NavMenu/NavHeadingMenuItem.js +2 -1
  69. package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
  70. package/dist/SelectableCard/SelectableCard.js +59 -0
  71. package/dist/SideNav/SideNav.d.ts.map +1 -1
  72. package/dist/SideNav/SideNav.js +9 -6
  73. package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
  74. package/dist/SideNav/SideNavHeading.js +15 -12
  75. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  76. package/dist/SideNav/SideNavItem.js +2 -1
  77. package/dist/SideNav/SideNavSection.d.ts.map +1 -1
  78. package/dist/SideNav/SideNavSection.js +2 -1
  79. package/dist/Stack/Stack.d.ts +1 -1
  80. package/dist/Stack/stack.stylex.d.ts +1 -1
  81. package/dist/Stack/stack.stylex.js +1 -1
  82. package/dist/TextArea/TextArea.d.ts +5 -3
  83. package/dist/TextArea/TextArea.d.ts.map +1 -1
  84. package/dist/TextArea/TextArea.js +14 -3
  85. package/dist/TextInput/TextInput.d.ts +20 -6
  86. package/dist/TextInput/TextInput.d.ts.map +1 -1
  87. package/dist/TextInput/TextInput.js +24 -2
  88. package/dist/Toast/ToastViewport.d.ts.map +1 -1
  89. package/dist/Toast/ToastViewport.js +2 -0
  90. package/dist/Token/Token.d.ts.map +1 -1
  91. package/dist/Token/Token.js +1 -6
  92. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  93. package/dist/Tokenizer/Tokenizer.js +67 -52
  94. package/dist/TopNav/TopNav.d.ts.map +1 -1
  95. package/dist/TopNav/TopNav.js +14 -10
  96. package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
  97. package/dist/TopNav/TopNavHeading.js +9 -8
  98. package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
  99. package/dist/TopNav/TopNavMegaMenuItem.js +3 -2
  100. package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
  101. package/dist/TopNav/TopNavMenu.js +2 -1
  102. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  103. package/dist/Typeahead/BaseTypeahead.js +117 -20
  104. package/dist/Typeahead/committedChoicesKey.d.ts +12 -0
  105. package/dist/Typeahead/committedChoicesKey.d.ts.map +1 -0
  106. package/dist/Typeahead/committedChoicesKey.js +24 -0
  107. package/dist/hooks/ModalAnnounceProvider.d.ts +3 -4
  108. package/dist/hooks/ModalAnnounceProvider.d.ts.map +1 -1
  109. package/dist/hooks/ModalAnnounceProvider.js +4 -6
  110. package/dist/hooks/actionGroupTracker.d.ts +12 -0
  111. package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
  112. package/dist/hooks/actionGroupTracker.js +23 -55
  113. package/dist/hooks/menuPressGesture.d.ts +21 -26
  114. package/dist/hooks/menuPressGesture.d.ts.map +1 -1
  115. package/dist/hooks/menuPressGesture.js +25 -30
  116. package/dist/hooks/menuPressOnItems.d.ts +2 -9
  117. package/dist/hooks/menuPressOnItems.d.ts.map +1 -1
  118. package/dist/hooks/menuPressOnItems.js +7 -9
  119. package/dist/hooks/modalAnnounce.d.ts +1 -1
  120. package/dist/hooks/modalAnnounce.d.ts.map +1 -1
  121. package/dist/hooks/modalAnnounce.js +20 -39
  122. package/dist/hooks/scrollbarGutter.d.ts.map +1 -1
  123. package/dist/hooks/scrollbarGutter.js +9 -16
  124. package/dist/hooks/useAnimatedLayout.d.ts +2 -3
  125. package/dist/hooks/useAnimatedLayout.d.ts.map +1 -1
  126. package/dist/hooks/useAnimatedLayout.js +2 -3
  127. package/dist/hooks/useAnnounce.d.ts +16 -37
  128. package/dist/hooks/useAnnounce.d.ts.map +1 -1
  129. package/dist/hooks/useAnnounce.js +56 -92
  130. package/dist/hooks/useAnnounceRenderedText.d.ts +17 -48
  131. package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
  132. package/dist/hooks/useAnnounceRenderedText.js +22 -42
  133. package/dist/hooks/useAutoMediaMode.d.ts.map +1 -1
  134. package/dist/hooks/useAutoMediaMode.js +29 -54
  135. package/dist/hooks/useBusyAnnouncement.d.ts +2 -16
  136. package/dist/hooks/useBusyAnnouncement.d.ts.map +1 -1
  137. package/dist/hooks/useBusyAnnouncement.js +13 -20
  138. package/dist/hooks/useClickableContainer.d.ts +3 -9
  139. package/dist/hooks/useClickableContainer.d.ts.map +1 -1
  140. package/dist/hooks/useClickableContainer.js +10 -22
  141. package/dist/hooks/useContainerReveal.d.ts +9 -36
  142. package/dist/hooks/useContainerReveal.d.ts.map +1 -1
  143. package/dist/hooks/useContainerReveal.js +9 -36
  144. package/dist/hooks/useDevWarning.d.ts.map +1 -1
  145. package/dist/hooks/useDevWarning.js +3 -8
  146. package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
  147. package/dist/hooks/useEntryAnimation.js +1 -3
  148. package/dist/hooks/useHighlightedOptionScroll.d.ts +2 -4
  149. package/dist/hooks/useHighlightedOptionScroll.d.ts.map +1 -1
  150. package/dist/hooks/useHighlightedOptionScroll.js +1 -1
  151. package/dist/hooks/useHotkeys.d.ts.map +1 -1
  152. package/dist/hooks/useHotkeys.js +4 -16
  153. package/dist/hooks/useImageMode.d.ts.map +1 -1
  154. package/dist/hooks/useImageMode.js +6 -45
  155. package/dist/hooks/useIndicatorFocusRing.d.ts.map +1 -1
  156. package/dist/hooks/useIndicatorFocusRing.js +13 -38
  157. package/dist/hooks/useInputStatusIcon.d.ts +9 -1
  158. package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
  159. package/dist/hooks/useInputStatusIcon.js +16 -32
  160. package/dist/hooks/useInteractiveRole.d.ts.map +1 -1
  161. package/dist/hooks/useInteractiveRole.js +6 -24
  162. package/dist/hooks/useListFocus.d.ts +4 -5
  163. package/dist/hooks/useListFocus.d.ts.map +1 -1
  164. package/dist/hooks/useLongPress.d.ts.map +1 -1
  165. package/dist/hooks/useLongPress.js +17 -31
  166. package/dist/hooks/useMenuHover.d.ts.map +1 -1
  167. package/dist/hooks/useMenuHover.js +38 -52
  168. package/dist/hooks/useMenuPress.d.ts +22 -39
  169. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  170. package/dist/hooks/useMenuPress.js +46 -99
  171. package/dist/hooks/useOverflow.d.ts.map +1 -1
  172. package/dist/hooks/useOverflow.js +3 -8
  173. package/dist/hooks/useRenamedProp.d.ts.map +1 -1
  174. package/dist/hooks/useRenamedProp.js +8 -17
  175. package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
  176. package/dist/hooks/useScrollOverflow.js +9 -27
  177. package/dist/hooks/useScrollableArea.d.ts +2 -4
  178. package/dist/hooks/useScrollableArea.d.ts.map +1 -1
  179. package/dist/hooks/useScrollableArea.js +14 -21
  180. package/dist/hooks/useStreamingText.d.ts.map +1 -1
  181. package/dist/hooks/useStreamingText.js +14 -36
  182. package/dist/hooks/useTreeFocus.d.ts +1 -1
  183. package/dist/hooks/useTreeFocus.js +2 -2
  184. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  185. package/dist/i18n/generated-locales/en.generated.js +3 -0
  186. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  187. package/dist/i18n/generated-locales/pseudo.generated.js +3 -0
  188. package/dist/privateAttributes/layerRoot.stylex.d.ts +9 -0
  189. package/dist/privateAttributes/layerRoot.stylex.d.ts.map +1 -0
  190. package/dist/privateAttributes/layerRoot.stylex.js +28 -0
  191. package/dist/utils/clickGuard.d.ts +1 -2
  192. package/dist/utils/clickGuard.d.ts.map +1 -1
  193. package/dist/utils/clickGuard.js +18 -27
  194. package/dist/utils/coarsePointer.d.ts.map +1 -1
  195. package/dist/utils/coarsePointer.js +5 -7
  196. package/dist/utils/devWarning.d.ts.map +1 -1
  197. package/dist/utils/devWarning.js +4 -9
  198. package/dist/utils/focusOutline.stylex.d.ts +0 -16
  199. package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
  200. package/dist/utils/focusOutline.stylex.js +7 -16
  201. package/dist/utils/focusReturn.d.ts +2 -3
  202. package/dist/utils/focusReturn.d.ts.map +1 -1
  203. package/dist/utils/focusReturn.js +2 -3
  204. package/dist/utils/hitArea.d.ts.map +1 -1
  205. package/dist/utils/hitArea.js +14 -17
  206. package/dist/utils/ime.d.ts.map +1 -1
  207. package/dist/utils/ime.js +23 -51
  208. package/dist/utils/inputPresentation.d.ts +5 -5
  209. package/dist/utils/inputPresentation.d.ts.map +1 -1
  210. package/dist/utils/inputPresentation.js +5 -5
  211. package/dist/utils/inputStream.d.ts.map +1 -1
  212. package/dist/utils/inputStream.js +18 -31
  213. package/dist/utils/interactionModality.d.ts +8 -37
  214. package/dist/utils/interactionModality.d.ts.map +1 -1
  215. package/dist/utils/interactionModality.js +20 -36
  216. package/dist/utils/interactionOverlay.stylex.d.ts +26 -92
  217. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  218. package/dist/utils/interactionOverlay.stylex.js +58 -85
  219. package/dist/utils/plainDate.js +1 -1
  220. package/dist/utils/presentation.d.ts +3 -4
  221. package/dist/utils/presentation.d.ts.map +1 -1
  222. package/dist/utils/presentation.js +30 -45
  223. package/dist/utils/pressFeedback.d.ts.map +1 -1
  224. package/dist/utils/pressFeedback.js +50 -92
  225. package/dist/utils/pressGesture.d.ts.map +1 -1
  226. package/dist/utils/pressGesture.js +11 -21
  227. package/dist/utils/rtlStyles.d.ts +0 -24
  228. package/dist/utils/rtlStyles.d.ts.map +1 -1
  229. package/dist/utils/rtlStyles.js +13 -24
  230. package/dist/utils/selectionLock.d.ts +1 -2
  231. package/dist/utils/selectionLock.d.ts.map +1 -1
  232. package/dist/utils/selectionLock.js +20 -25
  233. package/dist/utils/timeFormat.d.ts +5 -13
  234. package/dist/utils/timeFormat.d.ts.map +1 -1
  235. package/dist/utils/timeFormat.js +5 -13
  236. package/dist/utils/touchPresentation.d.ts +4 -4
  237. package/dist/utils/touchPresentation.d.ts.map +1 -1
  238. package/dist/utils/touchPresentation.js +33 -55
  239. package/dist/utils/touchPresentation.stylex.d.ts +1 -1
  240. package/dist/utils/touchPresentation.stylex.d.ts.map +1 -1
  241. package/dist/utils/touchPresentation.stylex.js +7 -13
  242. package/dist/utils/typeaheadMatch.d.ts +1 -1
  243. package/dist/utils/typeaheadMatch.d.ts.map +1 -1
  244. package/dist/utils/typeaheadMatch.js +7 -6
  245. package/locales/en.json +12 -0
  246. package/locales/pseudo.json +9 -0
  247. package/package.json +4 -4
  248. package/src/BottomSheet/BottomSheet.tsx +77 -114
  249. package/src/BottomSheet/BottomSheetEdgeTint.tsx +10 -21
  250. package/src/BottomSheet/BottomSheetHostContext.ts +6 -10
  251. package/src/BottomSheet/BottomSheetPanel.tsx +55 -88
  252. package/src/BottomSheet/BottomSheetSwitcher.tsx +41 -78
  253. package/src/BottomSheet/bottomSheetEscape.ts +3 -3
  254. package/src/BottomSheet/bottomSheetStack.ts +42 -96
  255. package/src/BottomSheet/useMobileKeyboard.ts +12 -14
  256. package/src/BottomSheet/useSheetGestures.ts +60 -107
  257. package/src/Chat/ChatComposer.tsx +1 -6
  258. package/src/Chat/ChatComposerInput.tsx +9 -0
  259. package/src/Chat/useTriggerMenu.tsx +21 -4
  260. package/src/DateInput/DateInput.tsx +73 -7
  261. package/src/DateTimeInput/DateTimeInput.tsx +15 -20
  262. package/src/Dialog/Dialog.tsx +7 -1
  263. package/src/Drawer/Drawer.tsx +7 -1
  264. package/src/Field/index.ts +3 -1
  265. package/src/Field/textEntryTraits.ts +116 -0
  266. package/src/HStack/HStack.tsx +2 -1
  267. package/src/HoverCard/HoverCard.doc.mjs +58 -7
  268. package/src/HoverCard/HoverCard.tsx +8 -5
  269. package/src/HoverCard/useHoverCard.tsx +3 -2
  270. package/src/Item/Item.tsx +2 -11
  271. package/src/Layer/layerClickBoundary.ts +97 -0
  272. package/src/Layer/layerSurfacePress.ts +5 -9
  273. package/src/Layer/outsidePress.ts +81 -1
  274. package/src/Layer/useLayer.tsx +9 -2
  275. package/src/Lightbox/Lightbox.tsx +11 -5
  276. package/src/MobileNav/MobileNav.tsx +7 -1
  277. package/src/NavMenu/NavHeadingMenuItem.tsx +2 -1
  278. package/src/SelectableCard/SelectableCard.tsx +66 -1
  279. package/src/SideNav/SideNav.tsx +9 -6
  280. package/src/SideNav/SideNavHeading.tsx +23 -12
  281. package/src/SideNav/SideNavItem.tsx +2 -1
  282. package/src/SideNav/SideNavSection.tsx +2 -1
  283. package/src/Stack/Stack.doc.mjs +83 -11
  284. package/src/Stack/Stack.tsx +1 -1
  285. package/src/Stack/stack.stylex.ts +1 -1
  286. package/src/TextArea/TextArea.doc.mjs +65 -1
  287. package/src/TextArea/TextArea.tsx +20 -5
  288. package/src/TextInput/TextInput.doc.mjs +70 -6
  289. package/src/TextInput/TextInput.tsx +39 -8
  290. package/src/Toast/ToastViewport.tsx +4 -1
  291. package/src/Token/Token.tsx +1 -8
  292. package/src/Tokenizer/Tokenizer.tsx +81 -65
  293. package/src/TopNav/TopNav.tsx +16 -11
  294. package/src/TopNav/TopNavHeading.tsx +15 -8
  295. package/src/TopNav/TopNavMegaMenuItem.tsx +7 -2
  296. package/src/TopNav/TopNavMenu.tsx +2 -1
  297. package/src/Typeahead/BaseTypeahead.tsx +153 -22
  298. package/src/Typeahead/committedChoicesKey.tsx +37 -0
  299. package/src/hooks/ModalAnnounceProvider.tsx +7 -10
  300. package/src/hooks/actionGroupTracker.ts +23 -55
  301. package/src/hooks/menuPressGesture.ts +25 -30
  302. package/src/hooks/menuPressOnItems.ts +7 -9
  303. package/src/hooks/modalAnnounce.ts +20 -39
  304. package/src/hooks/scrollbarGutter.ts +9 -16
  305. package/src/hooks/useAnimatedLayout.ts +2 -3
  306. package/src/hooks/useAnnounce.ts +65 -106
  307. package/src/hooks/useAnnounceRenderedText.ts +32 -53
  308. package/src/hooks/useAutoMediaMode.ts +29 -54
  309. package/src/hooks/useBusyAnnouncement.ts +13 -20
  310. package/src/hooks/useClickableContainer.ts +10 -19
  311. package/src/hooks/useContainerReveal.ts +9 -36
  312. package/src/hooks/useDevWarning.ts +3 -8
  313. package/src/hooks/useEntryAnimation.ts +1 -3
  314. package/src/hooks/useHighlightedOptionScroll.ts +2 -4
  315. package/src/hooks/useHotkeys.ts +4 -16
  316. package/src/hooks/useImageMode.ts +6 -43
  317. package/src/hooks/useIndicatorFocusRing.tsx +13 -38
  318. package/src/hooks/useInputStatusIcon.tsx +19 -38
  319. package/src/hooks/useInteractiveRole.ts +6 -22
  320. package/src/hooks/useListFocus.ts +4 -5
  321. package/src/hooks/useLongPress.ts +17 -30
  322. package/src/hooks/useMenuHover.ts +38 -52
  323. package/src/hooks/useMenuPress.ts +46 -93
  324. package/src/hooks/useOverflow.ts +3 -8
  325. package/src/hooks/useRenamedProp.ts +8 -17
  326. package/src/hooks/useScrollOverflow.ts +9 -27
  327. package/src/hooks/useScrollableArea.ts +14 -21
  328. package/src/hooks/useStreamingText.ts +14 -33
  329. package/src/hooks/useTreeFocus.ts +3 -3
  330. package/src/i18n/generated-locales/en.generated.ts +4 -0
  331. package/src/i18n/generated-locales/pseudo.generated.ts +4 -0
  332. package/src/privateAttributes/layerRoot.stylex.ts +28 -0
  333. package/src/utils/clickGuard.ts +19 -29
  334. package/src/utils/coarsePointer.ts +5 -7
  335. package/src/utils/devWarning.ts +4 -9
  336. package/src/utils/focusOutline.stylex.ts +9 -19
  337. package/src/utils/focusReturn.ts +2 -3
  338. package/src/utils/hitArea.ts +14 -17
  339. package/src/utils/ime.ts +23 -51
  340. package/src/utils/inputPresentation.ts +5 -5
  341. package/src/utils/inputStream.ts +18 -31
  342. package/src/utils/interactionModality.ts +21 -37
  343. package/src/utils/interactionOverlay.stylex.ts +72 -88
  344. package/src/utils/plainDate.ts +1 -1
  345. package/src/utils/presentation.ts +31 -47
  346. package/src/utils/pressFeedback.ts +50 -92
  347. package/src/utils/pressGesture.ts +11 -21
  348. package/src/utils/rtlStyles.ts +13 -24
  349. package/src/utils/selectionLock.ts +20 -25
  350. package/src/utils/timeFormat.ts +5 -13
  351. package/src/utils/touchPresentation.stylex.ts +8 -14
  352. package/src/utils/touchPresentation.ts +33 -55
  353. package/src/utils/typeaheadMatch.ts +7 -6
@@ -1,59 +1,11 @@
1
1
  /**
2
2
  * @file BottomSheet.tsx
3
- * @input Uses React, StyleX, core hooks, shared layer dismissal, the modal outlet registry, the shared interaction modality, named BottomSheetPanel, BottomSheetSwitcherContext, BottomSheetHostContext, the private bottom-sheet stack registry
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAEH,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,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AAK,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 Uses React, StyleX, core hooks, shared layer dismissal, the modal outlet registry, the shared interaction modality, named BottomSheetPanel, BottomSheetSwitcherContext, BottomSheetHostContext, the private bottom-sheet stack registry
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, and opens in
282
- // the render after it, the first one that can enter its native host: a
283
- // <dialog> painted open with aria-modal before it is modal claims a state it
284
- // does not have (FR17).
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 was present on page load, so it opens settled,
288
- // with no rise or fade-in; its later opens and closes animate as usual
289
- // (spec:AST-013 FR13). It latches on its own request, not its host's state:
290
- // a host sheet hydrating reads as closed to the sheets inside it.
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
- // Whether a replace pairs this close is known only once every sheet of the
316
- // commit has reported to the registry, in the layout phase. Until the
317
- // registry has answered (a synchronous re-render later, before paint) the
318
- // panel holds its open pose: an exit pose rendered first and read back by
319
- // the panel's own style query would start the exit transition, and the
320
- // reversal into the retained pose would then snap the panel to rest. The
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
- // Host app-global surfaces (toasts) inside this sheet while it is an open
459
- // modal, so they stay visible and operable above it. Every open scrim sheet
460
- // supplies an outlet (each is an active native modal); the latest outlet —
461
- // the one global hosts render into — follows the sheet stack's order among
462
- // sheets rather than the order the sheets were supplied in, so a toast lands
463
- // in the top sheet, and when that sheet closes the sheet it reveals becomes
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 returned focus shows the focus-visible ring only after keyboard
525
- // input (`architecture:interaction-modality` INV1). The native close
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
- // With a sheet still open beneath this one, focus returns into that
530
- // sheet: to the opener when it is there, else to the sheet's panel.
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
- // An explicit `finalFocusRef` always receives focus, as released. The
533
- // recorded opener of a non-modal sheet does so only if the person was
534
- // still in the sheet when it closed (`hidePopover()` never moves
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
- onClick: handleClick,
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 (spec:AST-013 FR13).
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
- onClick: onDialogClick,
878
- onKeyDown: onDialogKeyDown,
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":"AAkEA;;;GAGG;AACH,wBAAgB,mBAAmB,gCAQlC"}
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 Uses StyleX and core color tokens
8
- * @output Exports BottomSheetEdgeTint, an internal decorative element
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":"AA6BA,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"}
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 BottomSheets
6
- *
7
- * This component owns everything intrinsic to a sheet surface: height budgets,
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 (spec:AST-013 FR13).
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;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA+B5C,OAAO,KAAK,EAA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M,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 BottomSheets
10
- *
11
- * This component owns everything intrinsic to a sheet surface: height budgets,
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 same viewport the height budgets are written against. Those are
60
- // `dvh`, which the virtual keyboard does not shrink, so reading
61
- // `visualViewport` here would make the two disagree by exactly the keyboard's
62
- // height: every detent would move while the sheet it measures did not. A
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 queries `design:reduced-motion` names: reduced motion with a coarse
87
- * primary pointer cross-fades (DR2); reduced motion otherwise changes at once
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 (component:Popover PR1, FR5): the scroll
189
- * area's measuring ref attaches as the sheet presents and detaches once it is
190
- * hidden again, so a closed sheet that stays mounted holds no resize,
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: that is travel (design:reduced-motion DR1). It fades where
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
- // design:reduced-motion DR2: the cross-fade applies on a coarse pointer, and
448
- // to a transition the release of a touch drag started — a finger's swipe
449
- // dismissal fades out in place on every pointer. A mouse or pen drag is not
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; the entrance, alignment and
464
- // exit are transforms — except that under the reduced-motion cross-fade
465
- // (DR2) an exit fades out where it is and its dialog may close only once
466
- // the fade has ended, so it waits on opacity. The entrance keeps waiting
467
- // on its (instant) transform, so the retained sheet's fade starts at once
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 rendered through the
547
- // style prop. A drag writes it straight to the element once per input
548
- // sample (useSheetGestures) and renders nothing in between, so React never
549
- // sees those writes; rendered through the prop, the resting value would be
550
- // skipped as "unchanged" when the drag ends and the sheet would stay where
551
- // the finger left it. Written after every commit instead, outside a drag,
552
- // the resting value lands in the same style update as the restored
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
- // The height and the scrolling area's end inset are rendered through props,
556
- // but a drag that crosses its base detent writes them to the elements too.
557
- // When the release is processed before that move's render commits, React
558
- // compares the resting values with the ones it committed before the drag,
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;