@astryxdesign/core 0.7.7-canary.c0929c8 → 0.7.7-canary.c19ca12

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 (472) hide show
  1. package/dist/AlertDialog/AlertDialog.d.ts +4 -1
  2. package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
  3. package/dist/AlertDialog/AlertDialog.js +36 -6
  4. package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts +13 -0
  5. package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts.map +1 -0
  6. package/dist/AppShell/useCloseMobileDrawerOnActivate.js +45 -0
  7. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  8. package/dist/BottomSheet/BottomSheet.js +79 -9
  9. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  10. package/dist/BottomSheet/BottomSheetPanel.js +23 -4
  11. package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
  12. package/dist/BottomSheet/bottomSheetStack.js +5 -4
  13. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  14. package/dist/BottomSheet/useSheetGestures.js +3 -1
  15. package/dist/Breadcrumbs/BreadcrumbItem.d.ts +2 -1
  16. package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
  17. package/dist/Breadcrumbs/BreadcrumbItem.js +7 -3
  18. package/dist/Button/Button.d.ts.map +1 -1
  19. package/dist/Button/Button.js +47 -3
  20. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  21. package/dist/CheckboxInput/CheckboxInput.js +13 -2
  22. package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
  23. package/dist/CheckboxList/CheckboxList.js +7 -1
  24. package/dist/CheckboxList/CheckboxListContext.d.ts +6 -0
  25. package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
  26. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  27. package/dist/CheckboxList/CheckboxListItem.js +10 -2
  28. package/dist/ComplexSelector/ComplexSelector.d.ts +4 -1
  29. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  30. package/dist/ComplexSelector/ComplexSelector.js +14 -4
  31. package/dist/ContextMenu/ContextMenu.js +2 -2
  32. package/dist/DateInput/DateInput.d.ts.map +1 -1
  33. package/dist/DateInput/DateInput.js +5 -2
  34. package/dist/DateInput/MonthScroller.d.ts.map +1 -1
  35. package/dist/DateInput/MonthScroller.js +13 -27
  36. package/dist/DateInput/Wheel.d.ts.map +1 -1
  37. package/dist/DateInput/Wheel.js +22 -41
  38. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  39. package/dist/DateTimeInput/DateTimeInput.js +5 -2
  40. package/dist/Dialog/Dialog.d.ts.map +1 -1
  41. package/dist/Dialog/Dialog.js +23 -45
  42. package/dist/Drawer/Drawer.d.ts.map +1 -1
  43. package/dist/Drawer/Drawer.js +15 -11
  44. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
  45. package/dist/Drawer/useDrawerDialogPresence.js +5 -1
  46. package/dist/Field/Field.js +2 -2
  47. package/dist/Field/PanelSearchInput.d.ts +9 -1
  48. package/dist/Field/PanelSearchInput.d.ts.map +1 -1
  49. package/dist/Field/PanelSearchInput.js +3 -1
  50. package/dist/HoverCard/HoverCard.d.ts +4 -3
  51. package/dist/HoverCard/HoverCard.d.ts.map +1 -1
  52. package/dist/HoverCard/HoverCard.js +27 -2
  53. package/dist/HoverCard/useHoverCard.d.ts +5 -4
  54. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  55. package/dist/HoverCard/useHoverCard.js +17 -31
  56. package/dist/Icon/Icon.d.ts +5 -1
  57. package/dist/Icon/Icon.d.ts.map +1 -1
  58. package/dist/Icon/Icon.js +5 -2
  59. package/dist/InfoTip/InfoTip.d.ts +63 -0
  60. package/dist/InfoTip/InfoTip.d.ts.map +1 -0
  61. package/dist/InfoTip/InfoTip.js +126 -0
  62. package/dist/InfoTip/index.d.ts +10 -0
  63. package/dist/InfoTip/index.d.ts.map +1 -0
  64. package/dist/InfoTip/index.js +12 -0
  65. package/dist/Layer/layerAnimations.stylex.d.ts +7 -8
  66. package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
  67. package/dist/Layer/layerAnimations.stylex.js +25 -20
  68. package/dist/Layer/useBackdropPress.d.ts +27 -0
  69. package/dist/Layer/useBackdropPress.d.ts.map +1 -0
  70. package/dist/Layer/useBackdropPress.js +53 -0
  71. package/dist/Layer/usePressPin.d.ts +20 -10
  72. package/dist/Layer/usePressPin.d.ts.map +1 -1
  73. package/dist/Layer/usePressPin.js +66 -18
  74. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  75. package/dist/Lightbox/Lightbox.js +18 -0
  76. package/dist/MobileNav/MobileNav.js +0 -1
  77. package/dist/MultiSelector/hooks.d.ts.map +1 -1
  78. package/dist/MultiSelector/hooks.js +2 -4
  79. package/dist/Outline/Outline.d.ts +2 -4
  80. package/dist/Outline/Outline.d.ts.map +1 -1
  81. package/dist/Outline/Outline.js +4 -52
  82. package/dist/Outline/useOutlineFromMarkdown.d.ts.map +1 -1
  83. package/dist/Outline/useOutlineFromMarkdown.js +1 -0
  84. package/dist/Outline/useScrollSpy.js +3 -3
  85. package/dist/PowerSearch/PowerSearch.d.ts +36 -3
  86. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  87. package/dist/PowerSearch/PowerSearch.js +571 -302
  88. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +100 -0
  89. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
  90. package/dist/PowerSearch/PowerSearchBottomSheet.js +1913 -0
  91. package/dist/PowerSearch/PowerSearchEditPopover.d.ts +32 -1
  92. package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
  93. package/dist/PowerSearch/PowerSearchEditPopover.js +17 -6
  94. package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
  95. package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
  96. package/dist/PowerSearch/PowerSearchValueEditor.js +170 -61
  97. package/dist/PowerSearch/formatFilterValue.d.ts +7 -0
  98. package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
  99. package/dist/PowerSearch/formatFilterValue.js +11 -1
  100. package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
  101. package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
  102. package/dist/PowerSearch/formatTokenValue.js +160 -0
  103. package/dist/PowerSearch/powerSearchSheetUtils.d.ts +65 -0
  104. package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +1 -0
  105. package/dist/PowerSearch/powerSearchSheetUtils.js +168 -0
  106. package/dist/RadioList/RadioList.d.ts.map +1 -1
  107. package/dist/RadioList/RadioList.js +8 -2
  108. package/dist/RadioList/RadioListItem.d.ts +1 -1
  109. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  110. package/dist/RadioList/RadioListItem.js +5 -3
  111. package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
  112. package/dist/Resizable/ResizeHandle.js +118 -260
  113. package/dist/Resizable/resizeGesture.d.ts +91 -0
  114. package/dist/Resizable/resizeGesture.d.ts.map +1 -0
  115. package/dist/Resizable/resizeGesture.js +251 -0
  116. package/dist/SegmentedControl/SegmentedControl.d.ts +3 -1
  117. package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  118. package/dist/SegmentedControl/SegmentedControl.js +115 -8
  119. package/dist/SegmentedControl/SegmentedControlContext.d.ts +6 -0
  120. package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
  121. package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -0
  122. package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
  123. package/dist/SegmentedControl/SegmentedControlItem.js +8 -1
  124. package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts +357 -0
  125. package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -0
  126. package/dist/SegmentedControl/useSegmentedSelectionMotion.js +1349 -0
  127. package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts +70 -0
  128. package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -0
  129. package/dist/SegmentedControl/useSegmentedTouchTracking.js +264 -0
  130. package/dist/Selector/Selector.d.ts.map +1 -1
  131. package/dist/Selector/Selector.js +96 -67
  132. package/dist/Selector/optionShape.d.ts +24 -0
  133. package/dist/Selector/optionShape.d.ts.map +1 -0
  134. package/dist/Selector/optionShape.js +48 -0
  135. package/dist/Selector/selectableOptionEntries.d.ts +20 -0
  136. package/dist/Selector/selectableOptionEntries.d.ts.map +1 -0
  137. package/dist/Selector/selectableOptionEntries.js +38 -0
  138. package/dist/Selector/utils.d.ts +2 -17
  139. package/dist/Selector/utils.d.ts.map +1 -1
  140. package/dist/Selector/utils.js +3 -51
  141. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  142. package/dist/SideNav/SideNavItem.js +3 -9
  143. package/dist/Slider/sliderTouchController.js +2 -2
  144. package/dist/Spinner/Spinner.d.ts +1 -1
  145. package/dist/Spinner/Spinner.d.ts.map +1 -1
  146. package/dist/Spinner/Spinner.js +60 -58
  147. package/dist/Switch/switchTouch.d.ts +0 -7
  148. package/dist/Switch/switchTouch.d.ts.map +1 -1
  149. package/dist/Switch/switchTouch.js +2 -10
  150. package/dist/Switch/useSwitchTouch.d.ts +2 -11
  151. package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
  152. package/dist/Switch/useSwitchTouch.js +35 -93
  153. package/dist/Table/BaseTable.d.ts.map +1 -1
  154. package/dist/Table/BaseTable.js +29 -8
  155. package/dist/TextInput/TextInput.d.ts +2 -2
  156. package/dist/TextInput/TextInput.d.ts.map +1 -1
  157. package/dist/TextInput/TextInput.js +10 -7
  158. package/dist/Toast/Toast.d.ts +11 -1
  159. package/dist/Toast/Toast.d.ts.map +1 -1
  160. package/dist/Toast/Toast.js +30 -15
  161. package/dist/Toast/ToastViewport.d.ts.map +1 -1
  162. package/dist/Toast/ToastViewport.js +94 -34
  163. package/dist/Toast/types.d.ts +9 -3
  164. package/dist/Toast/types.d.ts.map +1 -1
  165. package/dist/Token/Token.d.ts +2 -2
  166. package/dist/Token/Token.d.ts.map +1 -1
  167. package/dist/Token/Token.js +13 -4
  168. package/dist/Token/TokenNamingContext.d.ts +14 -0
  169. package/dist/Token/TokenNamingContext.d.ts.map +1 -0
  170. package/dist/Token/TokenNamingContext.js +23 -0
  171. package/dist/Tokenizer/Tokenizer.d.ts +46 -59
  172. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  173. package/dist/Tokenizer/Tokenizer.js +40 -57
  174. package/dist/Tokenizer/TokenizerBottomSheet.d.ts +25 -28
  175. package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -1
  176. package/dist/Tokenizer/TokenizerBottomSheet.js +157 -54
  177. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +3 -0
  178. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -0
  179. package/dist/Tokenizer/TokenizerItemRemovableContext.js +19 -0
  180. package/dist/Tooltip/Tooltip.d.ts +25 -30
  181. package/dist/Tooltip/Tooltip.d.ts.map +1 -1
  182. package/dist/Tooltip/Tooltip.js +24 -5
  183. package/dist/Tooltip/index.d.ts +1 -1
  184. package/dist/Tooltip/index.d.ts.map +1 -1
  185. package/dist/Tooltip/useTooltip.d.ts +45 -28
  186. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  187. package/dist/Tooltip/useTooltip.js +52 -59
  188. package/dist/TopNav/TopNavItem.d.ts.map +1 -1
  189. package/dist/TopNav/TopNavItem.js +4 -7
  190. package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
  191. package/dist/TopNav/TopNavMegaMenuItem.js +4 -7
  192. package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
  193. package/dist/TopNav/TopNavMenu.js +4 -7
  194. package/dist/Typeahead/TypeaheadItem.d.ts +2 -1
  195. package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
  196. package/dist/animator/createAnimator.d.ts +98 -0
  197. package/dist/animator/createAnimator.d.ts.map +1 -0
  198. package/dist/animator/createAnimator.js +259 -0
  199. package/dist/astryx.css +96 -7
  200. package/dist/gestures/GestureHost.d.ts +27 -1
  201. package/dist/gestures/GestureHost.d.ts.map +1 -1
  202. package/dist/gestures/GestureHost.js +157 -21
  203. package/dist/gestures/PressTracker.d.ts.map +1 -1
  204. package/dist/gestures/PressTracker.js +4 -3
  205. package/dist/hooks/actionGroupTracker.d.ts +7 -4
  206. package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
  207. package/dist/hooks/actionGroupTracker.js +19 -56
  208. package/dist/hooks/index.d.ts +1 -0
  209. package/dist/hooks/index.d.ts.map +1 -1
  210. package/dist/hooks/index.js +1 -0
  211. package/dist/hooks/pressGroupContext.d.ts +6 -0
  212. package/dist/hooks/pressGroupContext.d.ts.map +1 -0
  213. package/dist/hooks/pressGroupContext.js +20 -0
  214. package/dist/hooks/useActionGroupTracking.d.ts +53 -0
  215. package/dist/hooks/useActionGroupTracking.d.ts.map +1 -0
  216. package/dist/hooks/useActionGroupTracking.js +174 -0
  217. package/dist/hooks/useAnimator.d.ts +41 -0
  218. package/dist/hooks/useAnimator.d.ts.map +1 -0
  219. package/dist/hooks/useAnimator.js +70 -0
  220. package/dist/hooks/useAttachment.d.ts +1 -1
  221. package/dist/hooks/useAttachment.js +1 -1
  222. package/dist/hooks/useHighlightedOptionScroll.d.ts +11 -1
  223. package/dist/hooks/useHighlightedOptionScroll.d.ts.map +1 -1
  224. package/dist/hooks/useHighlightedOptionScroll.js +112 -11
  225. package/dist/hooks/useInputStatusIcon.d.ts +1 -1
  226. package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
  227. package/dist/hooks/useInputStatusIcon.js +2 -2
  228. package/dist/hooks/useLongPress.d.ts +6 -2
  229. package/dist/hooks/useLongPress.d.ts.map +1 -1
  230. package/dist/hooks/useLongPress.js +95 -15
  231. package/dist/hooks/useMediaQuery.d.ts +2 -1
  232. package/dist/hooks/useMediaQuery.d.ts.map +1 -1
  233. package/dist/hooks/useMediaQuery.js +7 -4
  234. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  235. package/dist/hooks/useMenuPress.js +4 -2
  236. package/dist/i18n/generated-english/InfoTip/InfoTip.generated.d.ts +8 -0
  237. package/dist/i18n/generated-english/InfoTip/InfoTip.generated.d.ts.map +1 -0
  238. package/dist/i18n/generated-english/InfoTip/InfoTip.generated.js +12 -0
  239. package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.d.ts.map +1 -1
  240. package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.js +1 -0
  241. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +8 -0
  242. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -0
  243. package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +42 -0
  244. package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
  245. package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +6 -0
  246. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +8 -0
  247. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +1 -0
  248. package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +14 -0
  249. package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.d.ts.map +1 -1
  250. package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.js +7 -1
  251. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  252. package/dist/i18n/generated-locales/en.generated.js +33 -1
  253. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  254. package/dist/i18n/generated-locales/pseudo.generated.js +33 -1
  255. package/dist/index.d.ts +2 -0
  256. package/dist/index.d.ts.map +1 -1
  257. package/dist/index.js +5 -0
  258. package/dist/internal/SheetConfirmation.d.ts +11 -0
  259. package/dist/internal/SheetConfirmation.d.ts.map +1 -0
  260. package/dist/internal/SheetConfirmation.js +92 -0
  261. package/dist/internal/indicatorPress.stylex.d.ts +20 -0
  262. package/dist/internal/indicatorPress.stylex.d.ts.map +1 -0
  263. package/dist/internal/indicatorPress.stylex.js +26 -0
  264. package/dist/internal/sheetDraft.d.ts +35 -0
  265. package/dist/internal/sheetDraft.d.ts.map +1 -0
  266. package/dist/internal/sheetDraft.js +65 -0
  267. package/dist/internal/touch-sheet.d.ts +21 -0
  268. package/dist/internal/touch-sheet.d.ts.map +1 -0
  269. package/dist/internal/touch-sheet.js +19 -0
  270. package/dist/internal/useDismissSearchOnTouchDrag.d.ts +24 -0
  271. package/dist/internal/useDismissSearchOnTouchDrag.d.ts.map +1 -0
  272. package/dist/internal/useDismissSearchOnTouchDrag.js +56 -0
  273. package/dist/motion/animator.d.ts +14 -14
  274. package/dist/motion/animator.d.ts.map +1 -1
  275. package/dist/motion/animator.js +41 -18
  276. package/dist/motion/reducedMotion.d.ts +24 -0
  277. package/dist/motion/reducedMotion.d.ts.map +1 -1
  278. package/dist/motion/reducedMotion.js +78 -1
  279. package/dist/motion/roles.d.ts +7 -1
  280. package/dist/motion/roles.d.ts.map +1 -1
  281. package/dist/motion/roles.js +20 -1
  282. package/dist/motion/uikit/alert.d.ts +41 -0
  283. package/dist/motion/uikit/alert.d.ts.map +1 -0
  284. package/dist/motion/uikit/alert.js +43 -0
  285. package/dist/motion/uikit/index.d.ts +6 -5
  286. package/dist/motion/uikit/index.d.ts.map +1 -1
  287. package/dist/motion/uikit/index.js +6 -5
  288. package/dist/motion/uikit/segmented.d.ts +55 -0
  289. package/dist/motion/uikit/segmented.d.ts.map +1 -0
  290. package/dist/motion/uikit/segmented.js +77 -0
  291. package/dist/motion/uikit/springs.d.ts +0 -18
  292. package/dist/motion/uikit/springs.d.ts.map +1 -1
  293. package/dist/motion/uikit/springs.js +5 -21
  294. package/dist/privateAttributes/pressGroupItem.stylex.d.ts +15 -0
  295. package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -0
  296. package/dist/privateAttributes/pressGroupItem.stylex.js +23 -0
  297. package/dist/privateAttributes/segmentTitle.stylex.d.ts +5 -0
  298. package/dist/privateAttributes/segmentTitle.stylex.d.ts.map +1 -0
  299. package/dist/privateAttributes/segmentTitle.stylex.js +22 -0
  300. package/dist/utils/browserClickWait.d.ts +35 -0
  301. package/dist/utils/browserClickWait.d.ts.map +1 -0
  302. package/dist/utils/browserClickWait.js +123 -0
  303. package/dist/utils/clickGuard.d.ts +14 -1
  304. package/dist/utils/clickGuard.d.ts.map +1 -1
  305. package/dist/utils/clickGuard.js +46 -1
  306. package/dist/utils/dateParser.d.ts.map +1 -1
  307. package/dist/utils/dateParser.js +12 -0
  308. package/dist/utils/focusReturn.d.ts +15 -0
  309. package/dist/utils/focusReturn.d.ts.map +1 -1
  310. package/dist/utils/focusReturn.js +28 -0
  311. package/dist/utils/interactionOverlay.stylex.d.ts +3 -2
  312. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  313. package/dist/utils/interactionOverlay.stylex.js +3 -2
  314. package/dist/utils/pressFeedback.d.ts.map +1 -1
  315. package/dist/utils/pressFeedback.js +19 -6
  316. package/dist/utils/triggerFocus.d.ts +36 -0
  317. package/dist/utils/triggerFocus.d.ts.map +1 -0
  318. package/dist/utils/triggerFocus.js +65 -0
  319. package/locales/en.json +128 -0
  320. package/locales/pseudo.json +96 -0
  321. package/package.json +18 -8
  322. package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
  323. package/src/AlertDialog/AlertDialog.tsx +37 -5
  324. package/src/AppShell/useCloseMobileDrawerOnActivate.ts +52 -0
  325. package/src/BottomSheet/BottomSheet.tsx +95 -10
  326. package/src/BottomSheet/BottomSheetPanel.tsx +40 -5
  327. package/src/BottomSheet/bottomSheetStack.ts +8 -4
  328. package/src/BottomSheet/useSheetGestures.ts +3 -1
  329. package/src/Breadcrumbs/BreadcrumbItem.tsx +13 -3
  330. package/src/Button/Button.tsx +63 -5
  331. package/src/CheckboxInput/CheckboxInput.doc.mjs +18 -0
  332. package/src/CheckboxInput/CheckboxInput.tsx +36 -9
  333. package/src/CheckboxList/CheckboxList.doc.mjs +4 -2
  334. package/src/CheckboxList/CheckboxList.tsx +6 -0
  335. package/src/CheckboxList/CheckboxListContext.tsx +6 -0
  336. package/src/CheckboxList/CheckboxListItem.tsx +11 -2
  337. package/src/ComplexSelector/ComplexSelector.tsx +20 -5
  338. package/src/ContextMenu/ContextMenu.tsx +2 -2
  339. package/src/DateInput/DateInput.tsx +8 -2
  340. package/src/DateInput/MonthScroller.tsx +18 -22
  341. package/src/DateInput/Wheel.tsx +30 -32
  342. package/src/DateTimeInput/DateTimeInput.tsx +8 -2
  343. package/src/Dialog/Dialog.tsx +54 -45
  344. package/src/Drawer/Drawer.tsx +28 -11
  345. package/src/Drawer/useDrawerDialogPresence.ts +5 -1
  346. package/src/Field/Field.tsx +2 -2
  347. package/src/Field/PanelSearchInput.tsx +11 -0
  348. package/src/HoverCard/HoverCard.doc.mjs +4 -2
  349. package/src/HoverCard/HoverCard.tsx +35 -4
  350. package/src/HoverCard/useHoverCard.doc.mjs +178 -36
  351. package/src/HoverCard/useHoverCard.tsx +46 -52
  352. package/src/Icon/Icon.doc.mjs +49 -8
  353. package/src/Icon/Icon.tsx +15 -7
  354. package/src/InfoTip/InfoTip.doc.mjs +192 -0
  355. package/src/InfoTip/InfoTip.tsx +186 -0
  356. package/src/InfoTip/index.ts +14 -0
  357. package/src/Layer/layerAnimations.stylex.ts +24 -16
  358. package/src/Layer/useBackdropPress.ts +81 -0
  359. package/src/Layer/usePressPin.ts +86 -26
  360. package/src/Lightbox/Lightbox.tsx +18 -0
  361. package/src/MobileNav/MobileNav.tsx +1 -1
  362. package/src/MultiSelector/hooks.ts +2 -4
  363. package/src/Outline/Outline.doc.mjs +177 -51
  364. package/src/Outline/Outline.tsx +5 -57
  365. package/src/Outline/useOutlineFromMarkdown.doc.mjs +157 -0
  366. package/src/Outline/useOutlineFromMarkdown.ts +1 -0
  367. package/src/Outline/useScrollSpy.ts +3 -3
  368. package/src/PowerSearch/PowerSearch.doc.mjs +55 -6
  369. package/src/PowerSearch/PowerSearch.tsx +798 -324
  370. package/src/PowerSearch/PowerSearchBottomSheet.tsx +2515 -0
  371. package/src/PowerSearch/PowerSearchEditPopover.tsx +28 -6
  372. package/src/PowerSearch/PowerSearchValueEditor.tsx +203 -38
  373. package/src/PowerSearch/formatFilterValue.ts +18 -1
  374. package/src/PowerSearch/formatTokenValue.ts +215 -0
  375. package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
  376. package/src/RadioList/RadioList.doc.mjs +4 -2
  377. package/src/RadioList/RadioList.tsx +7 -2
  378. package/src/RadioList/RadioListItem.tsx +5 -3
  379. package/src/Resizable/ResizeHandle.tsx +133 -328
  380. package/src/Resizable/resizeGesture.ts +368 -0
  381. package/src/SegmentedControl/SegmentedControl.doc.mjs +3 -3
  382. package/src/SegmentedControl/SegmentedControl.tsx +179 -5
  383. package/src/SegmentedControl/SegmentedControlContext.ts +6 -0
  384. package/src/SegmentedControl/SegmentedControlItem.tsx +12 -1
  385. package/src/SegmentedControl/useSegmentedSelectionMotion.ts +1640 -0
  386. package/src/SegmentedControl/useSegmentedTouchTracking.ts +308 -0
  387. package/src/Selector/Selector.tsx +136 -89
  388. package/src/Selector/optionShape.ts +64 -0
  389. package/src/Selector/selectableOptionEntries.ts +39 -0
  390. package/src/Selector/utils.ts +9 -68
  391. package/src/SideNav/SideNavItem.tsx +3 -7
  392. package/src/Slider/sliderTouchController.ts +2 -2
  393. package/src/Spinner/Spinner.tsx +77 -63
  394. package/src/Switch/switchTouch.ts +2 -10
  395. package/src/Switch/useSwitchTouch.ts +38 -104
  396. package/src/Table/BaseTable.tsx +46 -12
  397. package/src/TextInput/TextInput.tsx +11 -10
  398. package/src/Toast/Toast.doc.mjs +4 -3
  399. package/src/Toast/Toast.tsx +57 -32
  400. package/src/Toast/ToastViewport.tsx +121 -35
  401. package/src/Toast/types.ts +9 -3
  402. package/src/Token/Token.tsx +15 -4
  403. package/src/Token/TokenNamingContext.ts +28 -0
  404. package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
  405. package/src/Tokenizer/Tokenizer.tsx +89 -85
  406. package/src/Tokenizer/TokenizerBottomSheet.tsx +219 -93
  407. package/src/Tokenizer/TokenizerItemRemovableContext.ts +24 -0
  408. package/src/Tooltip/Tooltip.doc.mjs +123 -54
  409. package/src/Tooltip/Tooltip.tsx +36 -39
  410. package/src/Tooltip/index.ts +0 -1
  411. package/src/Tooltip/useTooltip.doc.mjs +171 -33
  412. package/src/Tooltip/useTooltip.tsx +98 -86
  413. package/src/TopNav/TopNavItem.tsx +6 -5
  414. package/src/TopNav/TopNavMegaMenuItem.tsx +6 -5
  415. package/src/TopNav/TopNavMenu.tsx +6 -5
  416. package/src/Typeahead/TypeaheadItem.doc.mjs +6 -3
  417. package/src/Typeahead/TypeaheadItem.tsx +2 -1
  418. package/src/animator/createAnimator.doc.mjs +153 -0
  419. package/src/animator/createAnimator.ts +324 -0
  420. package/src/gestures/GestureHost.ts +198 -20
  421. package/src/gestures/PressTracker.ts +4 -3
  422. package/src/gestures/README.md +7 -1
  423. package/src/hooks/actionGroupTracker.ts +32 -61
  424. package/src/hooks/index.ts +2 -0
  425. package/src/hooks/pressGroupContext.ts +21 -0
  426. package/src/hooks/useActionGroupTracking.ts +224 -0
  427. package/src/hooks/useAnimator.doc.mjs +109 -0
  428. package/src/hooks/useAnimator.ts +67 -0
  429. package/src/hooks/useAttachment.ts +1 -1
  430. package/src/hooks/useHighlightedOptionScroll.ts +123 -15
  431. package/src/hooks/useInputStatusIcon.tsx +3 -2
  432. package/src/hooks/useLongPress.doc.mjs +2 -2
  433. package/src/hooks/useLongPress.ts +136 -15
  434. package/src/hooks/useMediaQuery.doc.mjs +2 -2
  435. package/src/hooks/useMediaQuery.ts +13 -4
  436. package/src/hooks/useMenuPress.ts +8 -2
  437. package/src/i18n/generated-english/InfoTip/InfoTip.generated.ts +13 -0
  438. package/src/i18n/generated-english/PowerSearch/PowerSearch.generated.ts +1 -0
  439. package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +43 -0
  440. package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +6 -0
  441. package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +15 -0
  442. package/src/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.ts +7 -1
  443. package/src/i18n/generated-locales/en.generated.ts +43 -0
  444. package/src/i18n/generated-locales/pseudo.generated.ts +44 -0
  445. package/src/index.ts +14 -0
  446. package/src/internal/SheetConfirmation.tsx +101 -0
  447. package/src/internal/indicatorPress.stylex.ts +24 -0
  448. package/src/internal/sheetDraft.ts +80 -0
  449. package/src/internal/touch-sheet.ts +21 -0
  450. package/src/internal/useDismissSearchOnTouchDrag.ts +69 -0
  451. package/src/motion/MEASUREMENTS.md +7 -0
  452. package/src/motion/README.md +9 -5
  453. package/src/motion/animator.ts +61 -29
  454. package/src/motion/reducedMotion.ts +79 -1
  455. package/src/motion/roles.ts +20 -1
  456. package/src/motion/uikit/alert.ts +43 -0
  457. package/src/motion/uikit/index.ts +5 -5
  458. package/src/motion/uikit/segmented.ts +74 -0
  459. package/src/motion/uikit/springs.ts +5 -21
  460. package/src/privateAttributes/pressGroupItem.stylex.ts +23 -0
  461. package/src/privateAttributes/segmentTitle.stylex.ts +22 -0
  462. package/src/utils/browserClickWait.ts +133 -0
  463. package/src/utils/clickGuard.ts +64 -1
  464. package/src/utils/dateParser.ts +16 -0
  465. package/src/utils/focusReturn.ts +30 -0
  466. package/src/utils/interactionOverlay.stylex.ts +3 -2
  467. package/src/utils/pressFeedback.ts +19 -6
  468. package/src/utils/triggerFocus.ts +80 -0
  469. package/dist/internal/tokenizer-presentation.d.ts +0 -21
  470. package/dist/internal/tokenizer-presentation.d.ts.map +0 -1
  471. package/dist/internal/tokenizer-presentation.js +0 -21
  472. package/src/internal/tokenizer-presentation.ts +0 -25
@@ -2,6 +2,8 @@
2
2
  * @file useTooltip.tsx
3
3
  * @input Uses useLayer, usePressPin, React hooks
4
4
  * @output Exports useTooltip hook with stable trigger refs for hover/focus/tap tooltips
5
+ * and imperative show() and hide() for an app-built toggle trigger,
6
+ * and the module-only useTooltipWithTriggerBehavior that InfoTip's press-to-pin uses
5
7
  * @position Layer hook; builds on useLayer for tooltip behavior
6
8
  *
7
9
  * SYNC: When modified, update:
@@ -10,6 +12,7 @@
10
12
  import { type ReactNode, type RefCallback } from 'react';
11
13
  import { type ContextRenderProps, type LayerAlignment, type LayerPlacement } from '../Layer/useLayer.js';
12
14
  import type { LayerTouchTrigger } from '../Layer/useTouchTrigger.js';
15
+ import { type LayerTriggerBehavior } from '../Layer/usePressPin.js';
13
16
  /**
14
17
  * Focus trigger behavior for tooltips
15
18
  */
@@ -18,13 +21,6 @@ export type TooltipFocusTrigger = 'auto' | 'always' | 'never';
18
21
  * Touch trigger behavior for tooltips
19
22
  */
20
23
  export type TooltipTouchTrigger = LayerTouchTrigger;
21
- /**
22
- * How the trigger opens the tooltip. `adaptive`, the default, previews it on
23
- * hover and focus, and a tap opens it unless the trigger acts. `hover`
24
- * previews it on hover and focus, and no touch or pen tap opens it. `toggle`
25
- * pins it on a click, tap, Enter, or Space on a button trigger.
26
- */
27
- export type TooltipTriggerBehavior = 'adaptive' | 'hover' | 'toggle';
28
24
  export interface TooltipOptions {
29
25
  /**
30
26
  * Position placement relative to anchor
@@ -64,30 +60,9 @@ export interface TooltipOptions {
64
60
  * - `tap`: tap always opens the tooltip, even on a trigger that acts
65
61
  * - `none`: touch never opens the tooltip
66
62
  *
67
- * It decides only under `triggerBehavior="adaptive"`, the default.
68
- *
69
63
  * @default 'auto'
70
64
  */
71
65
  touchTrigger?: TooltipTouchTrigger;
72
- /**
73
- * How the trigger opens the tooltip:
74
- * - `adaptive` (the default): hover and focus preview it. A tap opens it
75
- * unless the trigger performs an action of its own. While `touchTrigger`
76
- * remains, it decides those taps.
77
- * - `hover`: hover and focus preview it; no touch or pen tap opens it.
78
- * - `toggle`: on a button trigger, a click, a tap, Enter, or Space pins the
79
- * tooltip open, and the same press closes it. Hover and keyboard focus
80
- * still preview it. A pinned tooltip stays until Escape, a second press,
81
- * a press outside, or focus leaving. Astryx clickable rows and cards
82
- * ignore the pinning press, except an Item row on a trigger that is not
83
- * a native button. The `Tooltip` component also stops it at a child
84
- * trigger. A hook caller stops a plain `onClick` ancestor itself. The
85
- * trigger reports `aria-expanded` and `aria-controls`, and the tooltip's
86
- * text is announced once when it pins. `touchTrigger` is ignored.
87
- *
88
- * @default 'adaptive'
89
- */
90
- triggerBehavior?: TooltipTriggerBehavior;
91
66
  /**
92
67
  * Whether the tooltip is enabled.
93
68
  * When false, hover/focus triggers are disabled.
@@ -159,6 +134,23 @@ export interface TooltipReturn {
159
134
  * silent no-op.
160
135
  */
161
136
  renderTooltip: (children: ReactNode, props?: Omit<ContextRenderProps, 'positioning'>) => ReactNode;
137
+ /**
138
+ * Opens the tooltip now and keeps it open until `hide()`, Escape, a press
139
+ * outside, or focus leaving its trigger, as a pinned tooltip does. Its text
140
+ * is announced once. Reports through `onShow`. Under a controlled `isOpen`,
141
+ * it calls `onShow` and does not change `isOpen`. Does nothing while
142
+ * `isEnabled` is false.
143
+ *
144
+ * Use `show()` and `hide()` to build a toggle-style trigger: your own button
145
+ * calls them, sets `aria-describedby` and `aria-controls` to `describedBy`
146
+ * and `aria-expanded` (true while shown), and keeps its own accessible name.
147
+ */
148
+ show: () => void;
149
+ /**
150
+ * Closes the tooltip now. Reports through `onHide`. Under a controlled
151
+ * `isOpen`, it calls `onHide` and does not change `isOpen`.
152
+ */
153
+ hide: () => void;
162
154
  }
163
155
  /**
164
156
  * Hook for tooltip behavior with hover/focus triggers.
@@ -185,4 +177,29 @@ export interface TooltipReturn {
185
177
  * ```
186
178
  */
187
179
  export declare function useTooltip(options?: TooltipOptions): TooltipReturn;
180
+ /**
181
+ * Module-only options for `useTooltipWithTriggerBehavior`. Not exported from
182
+ * the package.
183
+ */
184
+ export interface TooltipWithTriggerBehaviorOptions extends TooltipOptions {
185
+ /**
186
+ * How the trigger opens the tooltip:
187
+ * - `adaptive` (the default): hover and focus preview it. `touchTrigger`
188
+ * decides taps.
189
+ * - `toggle`: on a button trigger, a click, a tap, Enter, or Space pins the
190
+ * tooltip open, and the same press closes it. Hover and keyboard focus
191
+ * still preview it. A pinned tooltip stays until Escape, a second press,
192
+ * a press outside, or focus leaving. The trigger reports `aria-expanded`
193
+ * and `aria-controls`, and the tooltip's text is announced once when it
194
+ * pins. `touchTrigger` is ignored. InfoTip uses it.
195
+ *
196
+ * @default 'adaptive'
197
+ */
198
+ triggerBehavior?: LayerTriggerBehavior;
199
+ }
200
+ /**
201
+ * `useTooltip` with a trigger behavior. Module-only: InfoTip's press-to-pin
202
+ * goes through it, and the package does not export it.
203
+ */
204
+ export declare function useTooltipWithTriggerBehavior(options?: TooltipWithTriggerBehaviorOptions): TooltipReturn;
188
205
  //# sourceMappingURL=useTooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/useTooltip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AA+ChE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAEpD;;;;;GAKG;AACH,MA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IAAI,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtC;;;;OAIG;IACH,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEzC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,aAAa,EAAE,CACb,QAAQ,EAAE,SAAS,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,KAC5C,SAAS,CAAC;IAEf;;;;;;;;;;OAUG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB;;;OAGG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,wBAAgB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,aAAa,CAOtE;AAED;;;GAGG;AACH,MAAM,WAAW,iCAAkC,SAAQ,cAAc;IACvE;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,oBAAoB,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,iCAAsC,GAC9C,aAAa,CA2df"}
@@ -6,12 +6,15 @@
6
6
  * @file useTooltip.tsx
7
7
  * @input Uses useLayer, usePressPin, React hooks
8
8
  * @output Exports useTooltip hook with stable trigger refs for hover/focus/tap tooltips
9
+ * and imperative show() and hide() for an app-built toggle trigger,
10
+ * and the module-only useTooltipWithTriggerBehavior that InfoTip's press-to-pin uses
9
11
  * @position Layer hook; builds on useLayer for tooltip behavior
10
12
  *
11
13
  * SYNC: When modified, update:
12
14
  * - /packages/core/src/Tooltip/index.ts
13
15
  */
14
- import { useCallback, useEffect, useRef } from 'react';
16
+ import { useCallback, useEffect, useRef, useState } from 'react';
17
+ import { createTriggerFocusGate } from "../utils/triggerFocus.js";
15
18
  import * as stylex from '@stylexjs/stylex';
16
19
  import { useLayerInternal } from "../Layer/useLayer.js";
17
20
  import { useAnnounceRenderedText } from "../hooks/useAnnounceRenderedText.js";
@@ -51,35 +54,6 @@ const styles = {
51
54
  * Touch trigger behavior for tooltips
52
55
  */
53
56
 
54
- /**
55
- * How the trigger opens the tooltip. `adaptive`, the default, previews it on
56
- * hover and focus, and a tap opens it unless the trigger acts. `hover`
57
- * previews it on hover and focus, and no touch or pen tap opens it. `toggle`
58
- * pins it on a click, tap, Enter, or Space on a button trigger.
59
- */
60
-
61
- /**
62
- * Check if an element is naturally focusable
63
- */
64
- function isFocusable(element) {
65
- // Elements with explicit tabindex
66
- if (element.hasAttribute('tabindex')) {
67
- return element.tabIndex >= 0;
68
- }
69
-
70
- // Naturally focusable elements
71
- const focusableTags = ['A', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
72
- if (focusableTags.includes(element.tagName)) {
73
- return !element.disabled;
74
- }
75
-
76
- // Elements with contenteditable
77
- if (element.isContentEditable) {
78
- return true;
79
- }
80
- return false;
81
- }
82
-
83
57
  /**
84
58
  * Hook for tooltip behavior with hover/focus triggers.
85
59
  *
@@ -106,6 +80,24 @@ function isFocusable(element) {
106
80
  */
107
81
 
108
82
  export function useTooltip(options = {}) {
83
+ // The option is fixed to `adaptive`, so an options object that carries it at
84
+ // runtime cannot reach the press-to-pin path.
85
+ return useTooltipWithTriggerBehavior({
86
+ ...options,
87
+ triggerBehavior: 'adaptive'
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Module-only options for `useTooltipWithTriggerBehavior`. Not exported from
93
+ * the package.
94
+ */
95
+
96
+ /**
97
+ * `useTooltip` with a trigger behavior. Module-only: InfoTip's press-to-pin
98
+ * goes through it, and the package does not export it.
99
+ */
100
+ export function useTooltipWithTriggerBehavior(options = {}) {
109
101
  const {
110
102
  placement = 'above',
111
103
  alignment = 'center',
@@ -175,6 +167,9 @@ export function useTooltip(options = {}) {
175
167
  isHeldOpen: isPressHeldOpen,
176
168
  attach: attachPressPin,
177
169
  unpin: unpinPress,
170
+ hold: holdPress,
171
+ release: releasePress,
172
+ isAppHeld,
178
173
  isPinShown,
179
174
  touch: {
180
175
  isTouchPointerRef,
@@ -277,25 +272,11 @@ export function useTooltip(options = {}) {
277
272
  scheduleHide();
278
273
  }, [isTouchPointerRef, layerId, scheduleHide]);
279
274
 
280
- // Under `auto`, whether focus counts is decided when it arrives, not when
281
- // the listeners attach: a roving-tabindex member that was `tabindex="-1"`
282
- // then can be the tab stop now. A trigger that receives focus is focusable
283
- // by definition; focus inside it counts only while the trigger is
284
- // focusable too, so a plain wrapper still ignores its children's focus.
285
- const isFocusForTrigger = useCallback(e => {
286
- if (focusTrigger === 'always') {
287
- return true;
288
- }
289
- const triggerEl = e.currentTarget;
290
- return triggerEl != null && (e.target === triggerEl || isFocusable(triggerEl));
291
- }, [focusTrigger]);
292
-
293
- // Whether the trigger's current focus counted when it arrived, so its blur
294
- // hides the tooltip even if the trigger has since left the tab order.
295
- const focusCountedRef = useRef(false);
275
+ // Under `auto`, whether focus counts is decided when it arrives, and a
276
+ // focus that counted still hides on blur (utils/triggerFocus.ts).
277
+ const [focusGate] = useState(createTriggerFocusGate);
296
278
  const handleFocusIn = useCallback(e => {
297
- focusCountedRef.current = isFocusForTrigger(e);
298
- if (!isEnabled || !focusCountedRef.current) {
279
+ if (!focusGate.focusIn(e, focusTrigger) || !isEnabled) {
299
280
  return;
300
281
  }
301
282
  // A tap focuses the trigger it activates, and `:focus-visible` does not
@@ -314,18 +295,17 @@ export function useTooltip(options = {}) {
314
295
  }
315
296
  clearTimeouts();
316
297
  showLayer();
317
- }, [isEnabled, isFocusForTrigger, isTouchInteraction, clearTimeouts, showLayer]);
298
+ }, [focusGate, focusTrigger, isEnabled, isTouchInteraction, clearTimeouts, showLayer]);
318
299
 
319
300
  // A pinned tooltip's focus-leave close is the pin's own: it listens on the
320
301
  // trigger whatever `focusTrigger` is. This schedules the unpinned hide,
321
302
  // which a held tooltip skips.
322
303
  const handleFocusOut = useCallback(e => {
323
- if (!focusCountedRef.current && !isFocusForTrigger(e)) {
304
+ if (!focusGate.focusOut(e, focusTrigger)) {
324
305
  return;
325
306
  }
326
- focusCountedRef.current = false;
327
307
  scheduleHide();
328
- }, [isFocusForTrigger, scheduleHide]);
308
+ }, [focusGate, focusTrigger, scheduleHide]);
329
309
 
330
310
  // Pressing the trigger hides its own tooltip: once the control is activated
331
311
  // the hint has served its purpose, and a tooltip lingering over a
@@ -335,9 +315,10 @@ export function useTooltip(options = {}) {
335
315
  // A touch press is a different gesture (it may be the only way to open the
336
316
  // tooltip at all), so the touch path answers it first.
337
317
  const handlePointerDown = useCallback(event => {
338
- // A press on a toggle trigger pins or closes through its click. It
339
- // neither hides the preview here nor waits for a tap verdict.
340
- if (isToggleTrigger(triggerRef.current)) {
318
+ // A toggle trigger's press pins or closes through its click. The app's
319
+ // hide() closes a held tooltip. Neither path hides here or waits for a
320
+ // tap verdict.
321
+ if (isToggleTrigger(triggerRef.current) || isAppHeld()) {
341
322
  return;
342
323
  }
343
324
  if (handleTouchPointerDown(event)) {
@@ -348,7 +329,7 @@ export function useTooltip(options = {}) {
348
329
  }
349
330
  clearTimeouts();
350
331
  hideLayer();
351
- }, [isToggleTrigger, handleTouchPointerDown, isOpen, clearTimeouts, hideLayer]);
332
+ }, [isToggleTrigger, isAppHeld, handleTouchPointerDown, isOpen, clearTimeouts, hideLayer]);
352
333
 
353
334
  // Interaction ref that handles event listeners only
354
335
  const interactionRef = useCallback(el => {
@@ -372,7 +353,7 @@ export function useTooltip(options = {}) {
372
353
  el.addEventListener('pointerdown', handlePointerDown);
373
354
 
374
355
  // Focus listeners unless focus never opens the tooltip; `auto` decides
375
- // per event (isFocusForTrigger).
356
+ // per event (utils/triggerFocus.ts).
376
357
  if (focusTrigger !== 'never') {
377
358
  el.addEventListener('focusin', handleFocusIn);
378
359
  el.addEventListener('focusout', handleFocusOut);
@@ -413,9 +394,11 @@ export function useTooltip(options = {}) {
413
394
  showLayer();
414
395
  } else {
415
396
  clearTimeouts();
397
+ // A pin or app hold ends when the consumer closes the tooltip.
398
+ unpinPress();
416
399
  hideLayer();
417
400
  }
418
- }, [isOpen, clearTimeouts, showLayer, hideLayer]);
401
+ }, [isOpen, clearTimeouts, showLayer, hideLayer, unpinPress]);
419
402
 
420
403
  // Dismiss on Escape (WCAG 1.4.13 — dismissible) through the shared layer
421
404
  // stack. A visible tip is the top-most layer, so it takes the press and
@@ -495,12 +478,22 @@ export function useTooltip(options = {}) {
495
478
  children: children
496
479
  }), renderProps);
497
480
  }, [renderLayer, placement, alignment, popoverXstyle, cancelHide, scheduleHide, contentRefs]);
481
+ const show = useCallback(() => {
482
+ clearTimeouts();
483
+ holdPress();
484
+ }, [clearTimeouts, holdPress]);
485
+ const hide = useCallback(() => {
486
+ clearTimeouts();
487
+ releasePress();
488
+ }, [clearTimeouts, releasePress]);
498
489
  return {
499
490
  ref,
500
491
  positionRef: layerRef,
501
492
  interactionRef,
502
493
  anchorId: layerAnchorId,
503
494
  describedBy: layerId,
504
- renderTooltip
495
+ renderTooltip,
496
+ show,
497
+ hide
505
498
  };
506
499
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TopNavItem.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNavItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAY5C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAErD,OAAO,EAAgB,KAAK,WAAW,EAAC,MAAM,iCAAiC,CAAC;AA2DhF,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACnE,wCAAwC;IACxC,GAAG,CAA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GjB;yBApHe,UAAU"}
@@ -22,7 +22,7 @@ import { useLinkComponent } from "../Link/useLinkComponent.js";
22
22
  import { useTopNavRenderMode } from "./TopNavRenderContext.js";
23
23
  import { navItemStyles } from "../NavItem/navItemStyles.stylex.js";
24
24
  import { mergeProps } from "../utils/index.js";
25
- import { useAppShellMobile } from "../AppShell/AppShellMobileContext.js";
25
+ import { useCloseMobileDrawerOnActivate } from "../AppShell/useCloseMobileDrawerOnActivate.js";
26
26
  import { themeProps } from "../utils/themeProps.js";
27
27
  import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
28
28
  import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
@@ -112,9 +112,7 @@ export function TopNavItem({
112
112
  const pressable = usePressFeedback();
113
113
  const LinkComponent = useLinkComponent(as);
114
114
  const renderMode = useTopNavRenderMode();
115
- const {
116
- closeMobileNav
117
- } = useAppShellMobile();
115
+ const closeDrawerAfter = useCloseMobileDrawerOnActivate(renderMode === 'drawer');
118
116
 
119
117
  // A disabled item renders as a plain <a> with no href: an href-less anchor
120
118
  // is not focusable and exposes no link affordance, so programmatic focus +
@@ -129,14 +127,13 @@ export function TopNavItem({
129
127
  // Drawer mode — render as a SideNavItem-style vertical list element
130
128
  // =========================================================================
131
129
  if (renderMode === 'drawer') {
130
+ const activate = closeDrawerAfter(onClick);
132
131
  const handleDrawerClick = e => {
133
132
  if (isDisabled) {
134
133
  preventDefaultClick(e);
135
134
  return;
136
135
  }
137
- // Forward the original onClick if present
138
- onClick?.(e);
139
- closeMobileNav();
136
+ activate?.(e);
140
137
  };
141
138
  return /*#__PURE__*/_jsxs(Root, {
142
139
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"file":"TopNavMegaMenuItem.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNavMegaMenuItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAa5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CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,KAAK,EACL,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,EAAE,EACF,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,uBAAuB,qBAuFzB;yBApGe,kBAAkB"}
@@ -22,7 +22,7 @@ import { navItemStyles } from "../NavItem/navItemStyles.stylex.js";
22
22
  import { useLinkComponent } from "../Link/useLinkComponent.js";
23
23
  import { useTopNavRenderMode } from "./TopNavRenderContext.js";
24
24
  import { mergeProps } from "../utils/index.js";
25
- import { useAppShellMobile } from "../AppShell/AppShellMobileContext.js";
25
+ import { useCloseMobileDrawerOnActivate } from "../AppShell/useCloseMobileDrawerOnActivate.js";
26
26
  import { themeProps } from "../utils/themeProps.js";
27
27
  import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
28
28
  import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
@@ -112,9 +112,7 @@ export function TopNavMegaMenuItem({
112
112
  const pressable = usePressFeedback();
113
113
  const renderMode = useTopNavRenderMode();
114
114
  const LinkComponent = useLinkComponent(as);
115
- const {
116
- closeMobileNav
117
- } = useAppShellMobile();
115
+ const closeDrawerAfter = useCloseMobileDrawerOnActivate(renderMode === 'drawer');
118
116
 
119
117
  // =========================================================================
120
118
  // Drawer mode — matches SideNavItem / TopNavMenu drawer appearance
@@ -124,10 +122,9 @@ export function TopNavMegaMenuItem({
124
122
  const elementProps = Element === 'button' ? {
125
123
  type: 'button'
126
124
  } : {};
127
- const handleDrawerClick = () => {
125
+ const handleDrawerClick = closeDrawerAfter(() => {
128
126
  onClick?.();
129
- closeMobileNav();
130
- };
127
+ });
131
128
  return /*#__PURE__*/_jsxs(Element, {
132
129
  ...restProps,
133
130
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"file":"TopNavMenu.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNavMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAqN5C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAMD,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACnE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,wBAAgB,UA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ACN,SAAS,EACT,KAAK,EACL,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EACR,EAAE,eAAe,4BAuSjB;yBApTe,UAAU"}
@@ -31,7 +31,7 @@ import { useMergedRefs } from "../hooks/useMergedRefs.js";
31
31
  import { navItemStyles } from "../NavItem/navItemStyles.stylex.js";
32
32
  import { useTopNavSlot } from "./TopNavContext.js";
33
33
  import { useTopNavRenderMode } from "./TopNavRenderContext.js";
34
- import { useAppShellMobile } from "../AppShell/AppShellMobileContext.js";
34
+ import { useCloseMobileDrawerOnActivate } from "../AppShell/useCloseMobileDrawerOnActivate.js";
35
35
  import { useLinkComponent } from "../Link/useLinkComponent.js";
36
36
  import { isSafeUrl } from "../utils/safeUrl.js";
37
37
  import { themeProps } from "../utils/themeProps.js";
@@ -212,9 +212,7 @@ export function TopNavMenu({
212
212
  }) {
213
213
  const pressable = usePressFeedback();
214
214
  const renderMode = useTopNavRenderMode();
215
- const {
216
- closeMobileNav
217
- } = useAppShellMobile();
215
+ const closeDrawerAfter = useCloseMobileDrawerOnActivate(renderMode === 'drawer');
218
216
  const LinkComponent = useLinkComponent();
219
217
  const [drawerExpanded, setDrawerExpanded] = useState(false);
220
218
  const menuId = useId();
@@ -351,10 +349,9 @@ export function TopNavMenu({
351
349
  children: items.map(item => /*#__PURE__*/_jsxs(LinkComponent, {
352
350
  href: item.href,
353
351
  ...pressable,
354
- onClick: _e => {
352
+ onClick: closeDrawerAfter(_e => {
355
353
  item.onClick?.();
356
- closeMobileNav();
357
- },
354
+ }),
358
355
  ...focusOutlineProps.focusVisible(navItemStyles.item, interactionOverlayStyles.backgroundColor, drawerStyles.item),
359
356
  children: [isRenderable(item.icon) && /*#__PURE__*/_jsx("span", {
360
357
  ...{
@@ -31,7 +31,8 @@ export interface TypeaheadItemProps<T extends SearchableItem = SearchableItem> e
31
31
  */
32
32
  isDisabled?: boolean;
33
33
  /**
34
- * Group label for grouping items visually.
34
+ * This prop has no effect. Set `item.auxiliaryData.group` on search-source
35
+ * items to group results in Typeahead or BaseTypeahead.
35
36
  */
36
37
  group?: string;
37
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TypeaheadItem.d.ts","sourceRoot":"","sources":["../../src/Typeahead/TypeaheadItem.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAQ5C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C,MAAM,WAAW,kBAAkB,CACjC,CAAC,SAAS,cAAc,GAAG,cAAc,CACzC,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA6CD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EAAE,EACtD,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,UAAkB,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,kBAAkB,CAAC,CAAC,CAAC,qBAyBvB;yBApCe,aAAa"}
1
+ {"version":3,"file":"TypeaheadItem.d.ts","sourceRoot":"","sources":["../../src/Typeahead/TypeaheadItem.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAQ5C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C,MAAM,WAAW,kBAAkB,CACjC,CAAC,SAAS,cAAc,GAAG,cAAc,CACzC,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA6CD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EAAE,EACtD,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,UAAkB,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,kBAAkB,CAAC,CAAC,CAAC,qBAyBvB;yBApCe,aAAa"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * A channel the animator drives. `x` and `y` translate the element (px).
3
+ * `scale` scales it about its transform origin (1 is its size). `rotate`
4
+ * turns it (degrees, clockwise), and `opacity` fades it (0 to 1).
5
+ */
6
+ export type AnimatorChannel = 'x' | 'y' | 'scale' | 'rotate' | 'opacity';
7
+ /**
8
+ * Values by channel. A velocity uses the same keys, in units per second:
9
+ * px/s, scale per second, deg/s, opacity per second.
10
+ */
11
+ export type AnimatorValues = Partial<Record<AnimatorChannel, number>>;
12
+ /** Every channel's value (or velocity), as `get` and `getVelocity` read it. */
13
+ export type AnimatorSnapshot = Readonly<Record<AnimatorChannel, number>>;
14
+ /** Options of `AnimatorHandle.animate`. */
15
+ export interface AnimatorAnimateOptions {
16
+ /**
17
+ * Each channel's velocity at the start, such as a drag's release velocity.
18
+ * A channel without one keeps the
19
+ * velocity it has on screen, so an `animate` that interrupts another
20
+ * carries on smoothly.
21
+ */
22
+ velocity?: AnimatorValues;
23
+ }
24
+ /**
25
+ * A release velocity for `AnimatorHandle.decay`, per channel, in its units
26
+ * per second. That is px/s for `x` and `y`, and degrees per second for
27
+ * `rotate`. `scale` and `opacity` take their units per second.
28
+ */
29
+ export type AnimatorDecayVelocity = AnimatorValues;
30
+ /**
31
+ * Animates one element. Each method acts on the channels it is given and
32
+ * leaves the others where they are.
33
+ */
34
+ export interface AnimatorHandle {
35
+ /**
36
+ * Springs the given channels to `target` on the `springs.stateChange`
37
+ * motion role, from wherever they are on screen. The promise resolves when
38
+ * they arrive, or as soon as a later `animate`, `decay`, `set` or `stop`
39
+ * takes any of them over.
40
+ */
41
+ animate(target: AnimatorValues, options?: AnimatorAnimateOptions): Promise<void>;
42
+ /**
43
+ * Coasts the given channels from a release velocity, slowing as a scroll
44
+ * view's momentum does. It resolves when they stop, or when another call
45
+ * takes them over. The distance follows from the velocity alone: there are
46
+ * no bounds, except that opacity stops at 0 or 1.
47
+ */
48
+ decay(velocity: AnimatorDecayVelocity): Promise<void>;
49
+ /**
50
+ * Puts the given channels at these values at once, ending their motion:
51
+ * the per-frame write of a drag.
52
+ */
53
+ set(values: AnimatorValues): void;
54
+ /** Every channel's value on screen now. */
55
+ get(): AnimatorSnapshot;
56
+ /** Every channel's velocity on screen now, in units per second. */
57
+ getVelocity(): AnimatorSnapshot;
58
+ /** Halts every channel where it is on screen. */
59
+ stop(): void;
60
+ }
61
+ /** What `createAnimator` returns: the handle, and `destroy`. */
62
+ export interface Animator extends AnimatorHandle {
63
+ /**
64
+ * Stops every motion and lets go of the element; the element keeps the
65
+ * values it shows. The animator does nothing after this.
66
+ */
67
+ destroy(): void;
68
+ }
69
+ /**
70
+ * An animator whose element is attached later, through `attach`. It is the
71
+ * one construction `createAnimator` and `useAnimator` share, so the hook has
72
+ * no behavior of its own. Not exported from the package.
73
+ */
74
+ export declare function createAttachableAnimator(): {
75
+ readonly animator: Animator;
76
+ readonly attach: (element: HTMLElement | null) => void;
77
+ };
78
+ /**
79
+ * Animates `element` with the motion Core uses. `animate` springs channels to
80
+ * a target on the state-change motion, and `decay` coasts them from a release
81
+ * velocity. `set` jumps them, `get` and `getVelocity` read them, `stop` halts
82
+ * them, and `destroy` lets the element go. Under Reduce Motion every call is
83
+ * planned. A move becomes a short cross-fade on a touch screen, and it lands
84
+ * at once with a mouse.
85
+ *
86
+ * Use one animator per element: two on one element overwrite each other.
87
+ *
88
+ * @example
89
+ * ```
90
+ * const card = document.querySelector('.card');
91
+ * const animator = createAnimator(card);
92
+ * await animator.animate({x: 0, rotate: 0}, {velocity: {x: -900}});
93
+ * animator.decay({x: 2400});
94
+ * animator.destroy();
95
+ * ```
96
+ */
97
+ export declare function createAnimator(element: HTMLElement): Animator;
98
+ //# sourceMappingURL=createAnimator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAnimator.d.ts","sourceRoot":"","sources":["../../src/animator/createAnimator.ts"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtE,+EAA+E;AAC/E,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzE,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,cAAc,CA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