@astryxdesign/core 0.7.8 → 0.7.9-canary.07992bb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/dist/AppShell/observeMainOverflow.d.ts.map +1 -1
  2. package/dist/AppShell/observeMainOverflow.js +9 -6
  3. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  4. package/dist/BottomSheet/BottomSheet.js +5 -0
  5. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  6. package/dist/BottomSheet/BottomSheetPanel.js +40 -8
  7. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  8. package/dist/BottomSheet/useSheetGestures.js +61 -21
  9. package/dist/Calendar/Calendar.d.ts +14 -2
  10. package/dist/Calendar/Calendar.d.ts.map +1 -1
  11. package/dist/Calendar/Calendar.js +63 -74
  12. package/dist/Calendar/getInitialFocusDate.d.ts +4 -1
  13. package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -1
  14. package/dist/Calendar/getInitialFocusDate.js +7 -5
  15. package/dist/Calendar/hooks/useCalendarDays.d.ts +19 -2
  16. package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
  17. package/dist/Calendar/hooks/useCalendarDays.js +57 -64
  18. package/dist/Calendar/hooks/useCalendarNavigation.d.ts +28 -3
  19. package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
  20. package/dist/Calendar/hooks/useCalendarNavigation.js +33 -22
  21. package/dist/Calendar/styles.d.ts +1 -1
  22. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  23. package/dist/CheckboxInput/CheckboxInput.js +54 -11
  24. package/dist/ClickableCard/ClickableCard.d.ts +1 -1
  25. package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
  26. package/dist/ClickableCard/ClickableCard.js +5 -1
  27. package/dist/DateInput/DateInput.d.ts.map +1 -1
  28. package/dist/DateInput/DateInput.js +4 -1
  29. package/dist/DateInput/PickerWheel.d.ts.map +1 -1
  30. package/dist/DateInput/PickerWheel.js +7 -1
  31. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  32. package/dist/DateRangeInput/DateRangeInput.js +5 -2
  33. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  34. package/dist/DateTimeInput/DateTimeInput.js +4 -1
  35. package/dist/Dialog/Dialog.d.ts +2 -1
  36. package/dist/Dialog/Dialog.d.ts.map +1 -1
  37. package/dist/Dialog/Dialog.js +12 -1
  38. package/dist/Drawer/useDrawerDialogPresence.d.ts +2 -1
  39. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
  40. package/dist/Drawer/useDrawerDialogPresence.js +11 -2
  41. package/dist/DropdownMenu/DropdownMenu.d.ts +9 -1
  42. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  43. package/dist/DropdownMenu/DropdownMenu.js +9 -4
  44. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
  45. package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -2
  46. package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
  47. package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
  48. package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
  49. package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -2
  50. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  51. package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -2
  52. package/dist/Field/inputDisabledFocus.d.ts +4 -4
  53. package/dist/Field/inputStyles.stylex.d.ts +1 -1
  54. package/dist/FileInput/FileInput.d.ts.map +1 -1
  55. package/dist/FileInput/FileInput.js +16 -2
  56. package/dist/HoverCard/useHoverCard.d.ts +3 -1
  57. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  58. package/dist/Icon/Icon.d.ts +1 -1
  59. package/dist/InfoTip/InfoTip.d.ts +1 -0
  60. package/dist/InfoTip/InfoTip.d.ts.map +1 -1
  61. package/dist/InfoTip/InfoTip.js +1 -0
  62. package/dist/InputGroup/InputGroup.d.ts +4 -3
  63. package/dist/InputGroup/InputGroup.d.ts.map +1 -1
  64. package/dist/InputGroup/InputGroup.js +2 -2
  65. package/dist/InputGroup/groupStyles.d.ts +1 -1
  66. package/dist/InputGroup/groupStyles.d.ts.map +1 -1
  67. package/dist/InputGroup/groupStyles.js +1 -1
  68. package/dist/Item/Item.d.ts +2 -1
  69. package/dist/Item/Item.d.ts.map +1 -1
  70. package/dist/Item/Item.js +29 -6
  71. package/dist/Layer/holdEntranceInput.d.ts +24 -0
  72. package/dist/Layer/holdEntranceInput.d.ts.map +1 -0
  73. package/dist/Layer/holdEntranceInput.js +65 -0
  74. package/dist/Layer/inputHold.d.ts +49 -0
  75. package/dist/Layer/inputHold.d.ts.map +1 -0
  76. package/dist/Layer/inputHold.js +636 -0
  77. package/dist/Layer/preserveAnimations.d.ts +1 -5
  78. package/dist/Layer/preserveAnimations.d.ts.map +1 -1
  79. package/dist/Layer/preserveAnimations.js +12 -214
  80. package/dist/Layer/useLayer.d.ts +3 -1
  81. package/dist/Layer/useLayer.d.ts.map +1 -1
  82. package/dist/Layer/useLayer.js +64 -4
  83. package/dist/Layout/LayoutContent.d.ts +3 -1
  84. package/dist/Layout/LayoutContent.d.ts.map +1 -1
  85. package/dist/Layout/LayoutContent.js +12 -4
  86. package/dist/Layout/LayoutPanel.d.ts +4 -1
  87. package/dist/Layout/LayoutPanel.d.ts.map +1 -1
  88. package/dist/Layout/LayoutPanel.js +13 -4
  89. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  90. package/dist/Lightbox/Lightbox.js +4 -0
  91. package/dist/MetadataList/MetadataList.js +1 -1
  92. package/dist/MobileNav/MobileNav.d.ts +11 -1
  93. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  94. package/dist/MobileNav/MobileNav.js +39 -1
  95. package/dist/MoreMenu/MoreMenu.d.ts +5 -3
  96. package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
  97. package/dist/NumberInput/NumberInput.d.ts +4 -2
  98. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  99. package/dist/NumberInput/NumberInput.js +244 -11
  100. package/dist/Popover/usePopover.d.ts +1 -0
  101. package/dist/Popover/usePopover.d.ts.map +1 -1
  102. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  103. package/dist/PowerSearch/PowerSearch.js +12 -5
  104. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
  105. package/dist/PowerSearch/PowerSearchBottomSheet.js +4 -2
  106. package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
  107. package/dist/PowerSearch/PowerSearchToken.js +3 -1
  108. package/dist/PowerSearch/formatFilterValue.d.ts +9 -3
  109. package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
  110. package/dist/PowerSearch/formatFilterValue.js +14 -11
  111. package/dist/PowerSearch/formatTokenValue.d.ts +6 -2
  112. package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
  113. package/dist/PowerSearch/formatTokenValue.js +6 -3
  114. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  115. package/dist/RadioList/RadioListItem.js +22 -4
  116. package/dist/SelectableCard/SelectableCard.d.ts +1 -1
  117. package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
  118. package/dist/SelectableCard/SelectableCard.js +5 -1
  119. package/dist/Spinner/Spinner.d.ts.map +1 -1
  120. package/dist/Spinner/Spinner.js +14 -71
  121. package/dist/Spinner/index.d.ts +1 -1
  122. package/dist/Spinner/index.d.ts.map +1 -1
  123. package/dist/Spinner/spinnerRotor.d.ts +28 -0
  124. package/dist/Spinner/spinnerRotor.d.ts.map +1 -0
  125. package/dist/Spinner/spinnerRotor.js +98 -0
  126. package/dist/Stack/StackItem.d.ts +8 -4
  127. package/dist/Stack/StackItem.d.ts.map +1 -1
  128. package/dist/Stack/StackItem.js +17 -4
  129. package/dist/Switch/Switch.d.ts.map +1 -1
  130. package/dist/Switch/Switch.js +13 -10
  131. package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
  132. package/dist/Timestamp/Timestamp.d.ts.map +1 -1
  133. package/dist/Timestamp/Timestamp.js +14 -8
  134. package/dist/Timestamp/formatInstant.d.ts +10 -1
  135. package/dist/Timestamp/formatInstant.d.ts.map +1 -1
  136. package/dist/Timestamp/formatInstant.js +13 -27
  137. package/dist/Timestamp/tooltipEntries.d.ts +5 -3
  138. package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
  139. package/dist/Timestamp/tooltipEntries.js +6 -4
  140. package/dist/Token/Token.d.ts.map +1 -1
  141. package/dist/Token/Token.js +9 -0
  142. package/dist/Token/TokenLink.d.ts +1 -1
  143. package/dist/Token/TokenLink.d.ts.map +1 -1
  144. package/dist/Token/TokenLink.js +4 -1
  145. package/dist/Tokenizer/Tokenizer.d.ts +14 -10
  146. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  147. package/dist/Tokenizer/Tokenizer.js +189 -89
  148. package/dist/Tooltip/useTooltip.d.ts +3 -1
  149. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  150. package/dist/Tooltip/useTooltip.js +162 -59
  151. package/dist/TreeList/TreeListItem.d.ts +2 -1
  152. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  153. package/dist/TreeList/TreeListItem.js +27 -3
  154. package/dist/astryx.css +45 -18
  155. package/dist/gestures/GestureHost.d.ts +2 -2
  156. package/dist/gestures/GestureHost.d.ts.map +1 -1
  157. package/dist/gestures/GestureHost.js +21 -6
  158. package/dist/gestures/PanGestureRecognizer.d.ts +11 -1
  159. package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
  160. package/dist/gestures/PanGestureRecognizer.js +15 -1
  161. package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +6 -1
  162. package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
  163. package/dist/gestures/nativeScroll.d.ts +3 -6
  164. package/dist/gestures/nativeScroll.d.ts.map +1 -1
  165. package/dist/gestures/nativeScroll.js +7 -52
  166. package/dist/gestures/wheelSegmenter.d.ts +68 -1
  167. package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
  168. package/dist/gestures/wheelSegmenter.js +199 -10
  169. package/dist/hooks/StackItemScrollRegion.d.ts +31 -0
  170. package/dist/hooks/StackItemScrollRegion.d.ts.map +1 -0
  171. package/dist/hooks/StackItemScrollRegion.js +40 -0
  172. package/dist/hooks/menuPressGesture.d.ts +133 -21
  173. package/dist/hooks/menuPressGesture.d.ts.map +1 -1
  174. package/dist/hooks/menuPressGesture.js +155 -30
  175. package/dist/hooks/menuPressValues.d.ts +16 -0
  176. package/dist/hooks/menuPressValues.d.ts.map +1 -0
  177. package/dist/hooks/menuPressValues.js +18 -0
  178. package/dist/hooks/useClickableContainer.d.ts +27 -5
  179. package/dist/hooks/useClickableContainer.d.ts.map +1 -1
  180. package/dist/hooks/useClickableContainer.js +41 -5
  181. package/dist/hooks/useFocusTrap.d.ts +10 -0
  182. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  183. package/dist/hooks/useFocusTrap.js +225 -132
  184. package/dist/hooks/useMenuPress.d.ts +34 -1
  185. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  186. package/dist/hooks/useMenuPress.js +93 -5
  187. package/dist/hooks/usePressFeedback.d.ts +6 -6
  188. package/dist/hooks/usePressFeedback.js +6 -6
  189. package/dist/hooks/useScrollRegionProps.d.ts +35 -0
  190. package/dist/hooks/useScrollRegionProps.d.ts.map +1 -0
  191. package/dist/hooks/useScrollRegionProps.js +51 -0
  192. package/dist/i18n/InternationalizationContext.d.ts +6 -0
  193. package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
  194. package/dist/i18n/InternationalizationProvider.d.ts +21 -3
  195. package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
  196. package/dist/i18n/InternationalizationProvider.js +8 -3
  197. package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts +8 -0
  198. package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts.map +1 -0
  199. package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.js +12 -0
  200. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  201. package/dist/i18n/generated-locales/en.generated.js +1 -0
  202. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  203. package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
  204. package/dist/i18n/index.d.ts +2 -0
  205. package/dist/i18n/index.d.ts.map +1 -1
  206. package/dist/i18n/index.js +1 -0
  207. package/dist/i18n/useCalendarSystem.d.ts +19 -0
  208. package/dist/i18n/useCalendarSystem.d.ts.map +1 -0
  209. package/dist/i18n/useCalendarSystem.js +61 -0
  210. package/dist/internal/spinner-rotor.d.ts +16 -0
  211. package/dist/internal/spinner-rotor.d.ts.map +1 -0
  212. package/dist/internal/spinner-rotor.js +16 -0
  213. package/dist/internal/touch.d.ts +14 -1
  214. package/dist/internal/touch.d.ts.map +1 -1
  215. package/dist/internal/touch.js +20 -2
  216. package/dist/motion/carryAnimations.d.ts +58 -0
  217. package/dist/motion/carryAnimations.d.ts.map +1 -0
  218. package/dist/motion/carryAnimations.js +305 -0
  219. package/dist/motion/transientCopy.d.ts +4 -2
  220. package/dist/motion/transientCopy.d.ts.map +1 -1
  221. package/dist/motion/transientCopy.js +34 -5
  222. package/dist/motion/uikit/gestures.d.ts +41 -0
  223. package/dist/motion/uikit/gestures.d.ts.map +1 -1
  224. package/dist/motion/uikit/gestures.js +25 -0
  225. package/dist/motion/uikit/index.d.ts +1 -1
  226. package/dist/motion/uikit/index.d.ts.map +1 -1
  227. package/dist/motion/uikit/index.js +1 -1
  228. package/dist/motion/uikit/timing.d.ts +14 -10
  229. package/dist/motion/uikit/timing.d.ts.map +1 -1
  230. package/dist/motion/uikit/timing.js +7 -5
  231. package/dist/privateAttributes/menuPressLit.stylex.d.ts +52 -0
  232. package/dist/privateAttributes/menuPressLit.stylex.d.ts.map +1 -0
  233. package/dist/privateAttributes/menuPressLit.stylex.js +99 -0
  234. package/dist/privateAttributes/press.stylex.d.ts +139 -0
  235. package/dist/privateAttributes/press.stylex.d.ts.map +1 -0
  236. package/dist/privateAttributes/press.stylex.js +97 -0
  237. package/dist/theme/themeMotion.d.ts +3 -2
  238. package/dist/theme/themeMotion.d.ts.map +1 -1
  239. package/dist/theme/themeMotion.js +3 -2
  240. package/dist/theme/tokens.stylex.d.ts +2 -2
  241. package/dist/theme/tokens.stylex.js +1 -1
  242. package/dist/utils/calendarSystem.d.ts +114 -0
  243. package/dist/utils/calendarSystem.d.ts.map +1 -0
  244. package/dist/utils/calendarSystem.js +386 -0
  245. package/dist/utils/flatTree.d.ts +6 -3
  246. package/dist/utils/flatTree.d.ts.map +1 -1
  247. package/dist/utils/flatTree.js +13 -3
  248. package/dist/utils/hitArea.d.ts.map +1 -1
  249. package/dist/utils/hitArea.js +82 -5
  250. package/dist/utils/inputStream.d.ts +14 -1
  251. package/dist/utils/inputStream.d.ts.map +1 -1
  252. package/dist/utils/inputStream.js +40 -9
  253. package/dist/utils/interactionOverlay.stylex.d.ts +5 -9
  254. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  255. package/dist/utils/interactionOverlay.stylex.js +29 -31
  256. package/dist/utils/plainDate.d.ts +23 -7
  257. package/dist/utils/plainDate.d.ts.map +1 -1
  258. package/dist/utils/plainDate.js +57 -18
  259. package/dist/utils/pressFeedback.d.ts +10 -2
  260. package/dist/utils/pressFeedback.d.ts.map +1 -1
  261. package/dist/utils/pressFeedback.js +40 -15
  262. package/dist/utils/pressGesture.d.ts +12 -6
  263. package/dist/utils/pressGesture.d.ts.map +1 -1
  264. package/dist/utils/pressGesture.js +26 -8
  265. package/dist/utils/scrollView.d.ts +25 -0
  266. package/dist/utils/scrollView.d.ts.map +1 -0
  267. package/dist/utils/scrollView.js +108 -0
  268. package/dist/utils/selectionLock.d.ts.map +1 -1
  269. package/dist/utils/selectionLock.js +1 -10
  270. package/dist/utils/touchHitArea.stylex.d.ts +35 -0
  271. package/dist/utils/touchHitArea.stylex.d.ts.map +1 -0
  272. package/dist/utils/touchHitArea.stylex.js +32 -0
  273. package/dist/utils/triggerFocus.d.ts +5 -0
  274. package/dist/utils/triggerFocus.d.ts.map +1 -1
  275. package/dist/utils/triggerFocus.js +9 -2
  276. package/locales/en.json +4 -0
  277. package/locales/pseudo.json +3 -0
  278. package/package.json +10 -4
  279. package/src/AppShell/observeMainOverflow.ts +9 -6
  280. package/src/BottomSheet/BottomSheet.tsx +5 -0
  281. package/src/BottomSheet/BottomSheetPanel.tsx +64 -7
  282. package/src/BottomSheet/useSheetGestures.ts +83 -20
  283. package/src/Calendar/Calendar.doc.mjs +76 -6
  284. package/src/Calendar/Calendar.tsx +123 -104
  285. package/src/Calendar/getInitialFocusDate.ts +22 -8
  286. package/src/Calendar/hooks/useCalendarDays.ts +89 -63
  287. package/src/Calendar/hooks/useCalendarNavigation.ts +68 -26
  288. package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -2
  289. package/src/CheckboxInput/CheckboxInput.tsx +71 -9
  290. package/src/ClickableCard/ClickableCard.tsx +8 -1
  291. package/src/DateInput/DateInput.tsx +2 -0
  292. package/src/DateInput/PickerWheel.tsx +7 -2
  293. package/src/DateRangeInput/DateRangeInput.tsx +3 -1
  294. package/src/DateTimeInput/DateTimeInput.tsx +2 -0
  295. package/src/Dialog/Dialog.doc.mjs +1 -1
  296. package/src/Dialog/Dialog.tsx +12 -1
  297. package/src/Drawer/Drawer.doc.mjs +1 -1
  298. package/src/Drawer/useDrawerDialogPresence.ts +9 -2
  299. package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -2
  300. package/src/DropdownMenu/DropdownMenu.tsx +29 -5
  301. package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -1
  302. package/src/DropdownMenu/DropdownMenuItem.tsx +8 -4
  303. package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -1
  304. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -1
  305. package/src/FileInput/FileInput.tsx +16 -2
  306. package/src/HoverCard/useHoverCard.tsx +3 -1
  307. package/src/InfoTip/InfoTip.doc.mjs +26 -2
  308. package/src/InfoTip/InfoTip.tsx +1 -0
  309. package/src/InputGroup/InputGroup.doc.mjs +4 -3
  310. package/src/InputGroup/InputGroup.tsx +4 -3
  311. package/src/InputGroup/groupStyles.ts +3 -1
  312. package/src/Item/Item.tsx +51 -9
  313. package/src/Layer/holdEntranceInput.ts +84 -0
  314. package/src/Layer/inputHold.ts +734 -0
  315. package/src/Layer/preserveAnimations.ts +12 -275
  316. package/src/Layer/useLayer.tsx +77 -4
  317. package/src/Layout/LayoutContent.doc.mjs +6 -3
  318. package/src/Layout/LayoutContent.tsx +10 -4
  319. package/src/Layout/LayoutPanel.doc.mjs +6 -3
  320. package/src/Layout/LayoutPanel.tsx +11 -4
  321. package/src/Lightbox/Lightbox.tsx +4 -0
  322. package/src/MetadataList/MetadataList.tsx +1 -1
  323. package/src/MobileNav/MobileNav.doc.mjs +3 -3
  324. package/src/MobileNav/MobileNav.tsx +39 -1
  325. package/src/MoreMenu/MoreMenu.doc.mjs +2 -4
  326. package/src/MoreMenu/MoreMenu.tsx +5 -3
  327. package/src/NumberInput/NumberInput.doc.mjs +1 -1
  328. package/src/NumberInput/NumberInput.tsx +259 -11
  329. package/src/Popover/usePopover.tsx +1 -0
  330. package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
  331. package/src/PowerSearch/PowerSearch.tsx +20 -3
  332. package/src/PowerSearch/PowerSearchBottomSheet.tsx +4 -1
  333. package/src/PowerSearch/PowerSearchToken.tsx +3 -0
  334. package/src/PowerSearch/formatFilterValue.ts +21 -11
  335. package/src/PowerSearch/formatTokenValue.ts +7 -1
  336. package/src/RadioList/RadioListItem.doc.mjs +3 -2
  337. package/src/RadioList/RadioListItem.tsx +25 -7
  338. package/src/SelectableCard/SelectableCard.tsx +8 -1
  339. package/src/Spinner/Spinner.tsx +7 -89
  340. package/src/Spinner/index.ts +1 -5
  341. package/src/Spinner/spinnerRotor.ts +113 -0
  342. package/src/Stack/Stack.doc.mjs +1 -1
  343. package/src/Stack/StackItem.tsx +27 -13
  344. package/src/Switch/Switch.tsx +7 -6
  345. package/src/Table/plugins/sortable/useTableSortable.tsx +1 -1
  346. package/src/Timestamp/Timestamp.doc.mjs +3 -3
  347. package/src/Timestamp/Timestamp.tsx +13 -8
  348. package/src/Timestamp/formatInstant.ts +49 -28
  349. package/src/Timestamp/tooltipEntries.ts +7 -3
  350. package/src/Token/Token.tsx +18 -1
  351. package/src/Token/TokenLink.tsx +7 -1
  352. package/src/Tokenizer/Tokenizer.doc.mjs +3 -3
  353. package/src/Tokenizer/Tokenizer.tsx +252 -115
  354. package/src/Tooltip/useTooltip.tsx +178 -80
  355. package/src/TreeList/TreeListItem.tsx +36 -2
  356. package/src/gestures/GestureHost.ts +21 -5
  357. package/src/gestures/PanGestureRecognizer.ts +19 -2
  358. package/src/gestures/README.md +14 -5
  359. package/src/gestures/ScreenEdgePanGestureRecognizer.ts +6 -1
  360. package/src/gestures/nativeScroll.ts +12 -68
  361. package/src/gestures/wheelSegmenter.ts +243 -10
  362. package/src/hooks/StackItemScrollRegion.tsx +57 -0
  363. package/src/hooks/menuPressGesture.ts +244 -38
  364. package/src/hooks/menuPressValues.ts +18 -0
  365. package/src/hooks/useClickableContainer.doc.mjs +8 -2
  366. package/src/hooks/useClickableContainer.ts +72 -6
  367. package/src/hooks/useFocusTrap.ts +268 -151
  368. package/src/hooks/useMenuPress.ts +118 -11
  369. package/src/hooks/usePressFeedback.doc.mjs +3 -3
  370. package/src/hooks/usePressFeedback.ts +6 -6
  371. package/src/hooks/useScrollRegionProps.ts +76 -0
  372. package/src/i18n/InternationalizationContext.ts +6 -0
  373. package/src/i18n/InternationalizationProvider.doc.mjs +29 -1
  374. package/src/i18n/InternationalizationProvider.tsx +33 -3
  375. package/src/i18n/generated-english/hooks/useScrollRegionProps.generated.ts +13 -0
  376. package/src/i18n/generated-locales/en.generated.ts +1 -0
  377. package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
  378. package/src/i18n/index.ts +2 -0
  379. package/src/i18n/useCalendarSystem.ts +95 -0
  380. package/src/internal/spinner-rotor.ts +20 -0
  381. package/src/internal/touch.ts +34 -1
  382. package/src/motion/MEASUREMENTS.md +11 -0
  383. package/src/motion/carryAnimations.ts +389 -0
  384. package/src/motion/transientCopy.ts +45 -5
  385. package/src/motion/uikit/gestures.ts +22 -0
  386. package/src/motion/uikit/index.ts +1 -0
  387. package/src/motion/uikit/timing.ts +7 -5
  388. package/src/privateAttributes/menuPressLit.stylex.ts +104 -0
  389. package/src/privateAttributes/press.stylex.ts +243 -0
  390. package/src/theme/themeMotion.ts +3 -2
  391. package/src/theme/tokens.stylex.ts +1 -1
  392. package/src/utils/calendarSystem.ts +548 -0
  393. package/src/utils/flatTree.ts +15 -3
  394. package/src/utils/hitArea.ts +107 -5
  395. package/src/utils/inputStream.ts +47 -10
  396. package/src/utils/interactionOverlay.stylex.ts +19 -22
  397. package/src/utils/plainDate.ts +84 -19
  398. package/src/utils/pressFeedback.ts +46 -14
  399. package/src/utils/pressGesture.ts +35 -9
  400. package/src/utils/scrollView.ts +135 -0
  401. package/src/utils/selectionLock.ts +5 -10
  402. package/src/utils/touchHitArea.stylex.ts +41 -0
  403. package/src/utils/triggerFocus.ts +17 -4
@@ -6,7 +6,8 @@
6
6
  * @file useMenuPress.ts
7
7
  * @input The menu root, its trigger, the enabled-row selector, and callbacks
8
8
  * for opening, highlighting, activating and dismissing
9
- * @output useMenuPress, the marker attributes, and the activation mark
9
+ * @output useMenuPress, the marker attributes, the activation mark, and the
10
+ * internal useDropdownMenuPress entry with its touch model
10
11
  * @position Core hook for DropdownMenu, ContextMenu, DropdownMenuSubMenu,
11
12
  * Selector and MenuBottomSheetActionList. The transition table lives in
12
13
  * menuPressGesture.ts.
@@ -19,13 +20,14 @@
19
20
  */
20
21
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
21
22
  import { currentGesture } from "../Layer/gestureCounter.js";
22
- import { IDLE_MENU_PRESS, menuPressStep } from "./menuPressGesture.js";
23
+ import { IDLE_MENU_PRESS, menuPressTransition } from "./menuPressGesture.js";
23
24
  import { MENU_PRESS_MARKER } from "./menuPressMarker.js";
24
25
  import { useLongPressDetector } from "./useLongPress.js";
25
26
  import { edgeAutoscroll } from "../utils/edgeAutoscroll.js";
26
27
  import { focusForLastInput } from "../utils/focusReturn.js";
27
28
  import { useInteractionModalityTrackingFor } from "../utils/interactionModality.js";
28
29
  import { LONG_PRESS_DURATION_MS } from "../motion/uikit/longPress.js";
30
+ import { clearMenuPressLit, holdMenuPressPaint, markMenuPressLit, releaseMenuPressPaint } from "../privateAttributes/menuPressLit.stylex.js";
29
31
  import { __resetClickGuardForTest, armClickGuard, CLICK_GUARD_WINDOW_MS, withoutClickGuard } from "../utils/clickGuard.js";
30
32
  export { MENU_PRESS_MARKER };
31
33
  const MENU_PRESS_ROOT_SELECTOR = `[${MENU_PRESS_MARKER}]`;
@@ -124,6 +126,34 @@ function isInMenuTree(element, root) {
124
126
  const owner = element.closest(MENU_PRESS_ROOT_SELECTOR);
125
127
  return owner != null && getOutermostRoot(owner) === root;
126
128
  }
129
+
130
+ /**
131
+ * DropdownMenu's options for the press model: everything the public hook
132
+ * takes, plus its touch model. DropdownMenu reaches the touch model through
133
+ * its `presentation`, so the public hook has no such option.
134
+ *
135
+ * @internal
136
+ */
137
+
138
+ /**
139
+ * What core's own menus get from {@link useDropdownMenuPress}: the public
140
+ * return. Not exported from the hooks entry point.
141
+ *
142
+ * @internal
143
+ */
144
+
145
+ /**
146
+ * Where a pointer is, for a finger's handoff distance. Positions reach the
147
+ * machine only under `touchModel: 'uikit'`. Without them, it keeps the settle
148
+ * rule.
149
+ */
150
+ function handoffPosition(event, hasHandoff) {
151
+ return hasHandoff ? {
152
+ x: event.clientX,
153
+ y: event.clientY
154
+ } : {};
155
+ }
156
+
127
157
  /**
128
158
  * The press model for a menu: the row under the release acts, the highlight
129
159
  * follows a held pointer, and a mouse opens the menu on press.
@@ -160,6 +190,26 @@ function isInMenuTree(element, root) {
160
190
  * ```
161
191
  */
162
192
  export function useMenuPress(options) {
193
+ // The touch model is DropdownMenu's alone; an untyped caller's
194
+ // `touchModel` does not reach the model.
195
+ const {
196
+ touchModel: _touchModel,
197
+ ...publicOptions
198
+ } = options;
199
+ return useDropdownMenuPress({
200
+ ...publicOptions,
201
+ touchModel: 'pointer'
202
+ });
203
+ }
204
+
205
+ /**
206
+ * The press model with DropdownMenu's touch model
207
+ * ({@link DropdownMenuPressOptions.touchModel}). Not exported from the hooks
208
+ * entry point.
209
+ *
210
+ * @internal
211
+ */
212
+ export function useDropdownMenuPress(options) {
163
213
  const optionsRef = useRef(options);
164
214
  optionsRef.current = options;
165
215
  // The highlight, and the hover focus of the rows in this menu, follow the
@@ -247,8 +297,18 @@ export function useMenuPress(options) {
247
297
  autoscroll.stop();
248
298
  autoscrollRef.current = null;
249
299
  }, [autoscroll]);
300
+ const litRowRef = useRef(null);
301
+ const heldMenuRef = useRef(null);
250
302
  const endGesture = useCallback(() => {
251
303
  longPressApiRef.current?.cancel();
304
+ if (litRowRef.current != null) {
305
+ clearMenuPressLit(litRowRef.current);
306
+ litRowRef.current = null;
307
+ }
308
+ if (heldMenuRef.current != null) {
309
+ releaseMenuPressPaint(heldMenuRef.current);
310
+ heldMenuRef.current = null;
311
+ }
252
312
  touchMovePreventerRef.current?.();
253
313
  touchMovePreventerRef.current = null;
254
314
  stopAutoscroll();
@@ -259,10 +319,36 @@ export function useMenuPress(options) {
259
319
  gestureRef.current = IDLE_MENU_PRESS;
260
320
  }, [stopAutoscroll]);
261
321
  const highlight = useCallback(row => {
322
+ // A held finger or pen marks the row it lights, for the row's pressed
323
+ // paint. A held mouse keeps the hover tint, as on a desktop.
324
+ const gesture = gestureRef.current;
325
+ const isHeld = gesture.phase !== 'idle' && gesture.pointerType !== 'mouse';
326
+ const lit = isHeld ? row : null;
327
+ if (litRowRef.current !== lit) {
328
+ if (litRowRef.current != null) {
329
+ clearMenuPressLit(litRowRef.current);
330
+ }
331
+ litRowRef.current = lit;
332
+ if (lit != null) {
333
+ markMenuPressLit(lit);
334
+ }
335
+ }
262
336
  const {
263
337
  onHighlight,
264
338
  menuRef
265
339
  } = optionsRef.current;
340
+ // The row the press began on stays :active where a pointer hovers, so
341
+ // the menu holds every row but the lit one off that paint.
342
+ const held = isHeld ? menuRef.current : null;
343
+ if (heldMenuRef.current !== held) {
344
+ if (heldMenuRef.current != null) {
345
+ releaseMenuPressPaint(heldMenuRef.current);
346
+ }
347
+ heldMenuRef.current = held;
348
+ if (held != null) {
349
+ holdMenuPressPaint(held);
350
+ }
351
+ }
266
352
  if (onHighlight != null) {
267
353
  onHighlight(row);
268
354
  return;
@@ -369,7 +455,7 @@ export function useMenuPress(options) {
369
455
  }
370
456
  }, [activate, endGesture, getDocument, highlight]);
371
457
  const step = useCallback((event, native) => {
372
- const result = menuPressStep(gestureRef.current, event);
458
+ const result = menuPressTransition(gestureRef.current, event);
373
459
  gestureRef.current = result.gesture;
374
460
  applyEffect(result.effect, result.gesture, native);
375
461
  }, [applyEffect]);
@@ -466,7 +552,8 @@ export function useMenuPress(options) {
466
552
  type: 'move',
467
553
  row: point.row,
468
554
  isInMenu: point.isInMenu,
469
- time: Date.now()
555
+ time: Date.now(),
556
+ ...handoffPosition(event, optionsRef.current.touchModel === 'uikit')
470
557
  }, event);
471
558
  updateAutoscroll(event);
472
559
  };
@@ -480,7 +567,8 @@ export function useMenuPress(options) {
480
567
  row: point.row,
481
568
  isInMenu: point.isInMenu,
482
569
  isOnTrigger: point.isOnTrigger,
483
- time: Date.now()
570
+ time: Date.now(),
571
+ ...handoffPosition(event, optionsRef.current.touchModel === 'uikit')
484
572
  }, event);
485
573
  };
486
574
  const onCancel = event => {
@@ -7,11 +7,11 @@ import { pressableProps } from '../utils/pressFeedback.js';
7
7
  * `interactionOverlayStyles` (from `@astryxdesign/core/utils`) on the same
8
8
  * element: `backgroundColor` or `backgroundImage` for a surface whose hover
9
9
  * and press are the system's overlays, `pressedBackgroundColor` for one
10
- * whose hover is its own. The controller writes its attribute on the element
11
- * while a touch press is believed (after the onset delay, cancelled by travel
12
- * or by a scroll) and for the release, and the composed style paints the
13
- * pressed token at the press's strength on the first frame and fades it over
14
- * the release, keeping `:active` for a mouse on a desktop. On a phone or
10
+ * whose hover is its own. Under a finger the controller tracks the press the
11
+ * way UIKit tracks a control and writes its
12
+ * attribute on the element while the press is held and for the release; the
13
+ * composed style paints the pressed token on the first frame and fades it
14
+ * over the release, keeping `:active` for a mouse on a desktop. On a phone or
15
15
  * tablet the stylesheet drops `:active` for every press, so the controller
16
16
  * also paints a mouse, trackpad or Space-key press there, at once. A press is
17
17
  * themed through `--color-overlay-pressed`, which the hold, the flash and the
@@ -27,7 +27,7 @@ import { pressableProps } from '../utils/pressFeedback.js';
27
27
  * @example
28
28
  * ```
29
29
  * const pressable = usePressFeedback();
30
- * return <div role="button" {...pressable} {...stylex.props(styles.row)} />;
30
+ * return <button {...pressable} {...stylex.props(styles.button)} />;
31
31
  * ```
32
32
  */
33
33
  export declare function usePressFeedback(): typeof pressableProps;
@@ -25,11 +25,11 @@ import { installPressFeedback, pressableProps } from "../utils/pressFeedback.js"
25
25
  * `interactionOverlayStyles` (from `@astryxdesign/core/utils`) on the same
26
26
  * element: `backgroundColor` or `backgroundImage` for a surface whose hover
27
27
  * and press are the system's overlays, `pressedBackgroundColor` for one
28
- * whose hover is its own. The controller writes its attribute on the element
29
- * while a touch press is believed (after the onset delay, cancelled by travel
30
- * or by a scroll) and for the release, and the composed style paints the
31
- * pressed token at the press's strength on the first frame and fades it over
32
- * the release, keeping `:active` for a mouse on a desktop. On a phone or
28
+ * whose hover is its own. Under a finger the controller tracks the press the
29
+ * way UIKit tracks a control and writes its
30
+ * attribute on the element while the press is held and for the release; the
31
+ * composed style paints the pressed token on the first frame and fades it
32
+ * over the release, keeping `:active` for a mouse on a desktop. On a phone or
33
33
  * tablet the stylesheet drops `:active` for every press, so the controller
34
34
  * also paints a mouse, trackpad or Space-key press there, at once. A press is
35
35
  * themed through `--color-overlay-pressed`, which the hold, the flash and the
@@ -45,7 +45,7 @@ import { installPressFeedback, pressableProps } from "../utils/pressFeedback.js"
45
45
  * @example
46
46
  * ```
47
47
  * const pressable = usePressFeedback();
48
- * return <div role="button" {...pressable} {...stylex.props(styles.row)} />;
48
+ * return <button {...pressable} {...stylex.props(styles.button)} />;
49
49
  * ```
50
50
  */
51
51
  export function usePressFeedback() {
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @file useScrollRegionProps.ts
3
+ * @input Whether a region may scroll, and the caller's role and label
4
+ * @output useScrollRegionProps: a ref for the region, and the role and
5
+ * accessible name that the region carries while its content overflows
6
+ * @position Internal hook for LayoutContent, LayoutPanel and StackItem.
7
+ *
8
+ * SYNC: When modified, update:
9
+ * - /packages/core/src/hooks/useScrollRegionProps.test.tsx
10
+ * - /packages/core/src/AppShell/observeMainOverflow.ts
11
+ */
12
+ import { type AriaRole, type RefCallback } from 'react';
13
+ export interface ScrollRegionOptions {
14
+ /** Whether the region may scroll at all (`overflow: auto`). */
15
+ isScrollable: boolean;
16
+ /** The caller's role. It always wins, and takes no default name. */
17
+ role?: AriaRole;
18
+ /** The caller's accessible name. It always wins. */
19
+ label?: string;
20
+ }
21
+ export interface ScrollRegionProps {
22
+ ref: RefCallback<HTMLElement>;
23
+ role: AriaRole | undefined;
24
+ 'aria-label': string | undefined;
25
+ }
26
+ /**
27
+ * The region's ref, role and accessible name. While the region may scroll
28
+ * and its content overflows, it is a group named by the caller's `label`, or
29
+ * by the translated "Content". A caller's `role` is kept with only the
30
+ * caller's `label`: a single main landmark relies on its role alone. When
31
+ * the region does not scroll, the caller's own `role` and `label` pass
32
+ * through unchanged.
33
+ */
34
+ export declare function useScrollRegionProps({ isScrollable, role, label, }: ScrollRegionOptions): ScrollRegionProps;
35
+ //# sourceMappingURL=useScrollRegionProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollRegionProps.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollRegionProps.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAwB,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAC,MAAM,OAAO,CAAC;AAU7E,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,YAAY,EAAE,OAAO,CAAC;IACtB,oEAAoE;IACpE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAC9B,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,YAAY,EACZ,IAAI,EACJ,KAAK,GACN,EAAE,mBAAmB,GAAG,iBAAiB,CAsBzC"}
@@ -0,0 +1,51 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file useScrollRegionProps.ts
7
+ * @input Whether a region may scroll, and the caller's role and label
8
+ * @output useScrollRegionProps: a ref for the region, and the role and
9
+ * accessible name that the region carries while its content overflows
10
+ * @position Internal hook for LayoutContent, LayoutPanel and StackItem.
11
+ *
12
+ * SYNC: When modified, update:
13
+ * - /packages/core/src/hooks/useScrollRegionProps.test.tsx
14
+ * - /packages/core/src/AppShell/observeMainOverflow.ts
15
+ */
16
+ import { useCallback, useState } from 'react';
17
+ import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
18
+ import english from "../i18n/generated-english/hooks/useScrollRegionProps.generated.js";
19
+ import { observeMainOverflow } from "../AppShell/observeMainOverflow.js";
20
+ registerEnglishFallback(english);
21
+ /**
22
+ * The region's ref, role and accessible name. While the region may scroll
23
+ * and its content overflows, it is a group named by the caller's `label`, or
24
+ * by the translated "Content". A caller's `role` is kept with only the
25
+ * caller's `label`: a single main landmark relies on its role alone. When
26
+ * the region does not scroll, the caller's own `role` and `label` pass
27
+ * through unchanged.
28
+ */
29
+ export function useScrollRegionProps({
30
+ isScrollable,
31
+ role,
32
+ label
33
+ }) {
34
+ const t = useComponentTranslator();
35
+ const [overflows, setOverflows] = useState(false);
36
+ // A caller's role takes no default name, so its region is not observed.
37
+ const hasRole = role != null;
38
+ const ref = useCallback(element => {
39
+ if (element == null || !isScrollable || hasRole) {
40
+ setOverflows(false);
41
+ return undefined;
42
+ }
43
+ return observeMainOverflow(element, setOverflows);
44
+ }, [hasRole, isScrollable]);
45
+ const isGroup = !hasRole && isScrollable && overflows;
46
+ return {
47
+ ref,
48
+ role: role ?? (isGroup ? 'group' : undefined),
49
+ 'aria-label': label ?? (isGroup ? t('@astryx.scrollRegion.label') : undefined)
50
+ };
51
+ }
@@ -1,8 +1,14 @@
1
1
  import { getResolve } from './resolve.js';
2
2
  import type { Locale, MessagesByLocale, Overrides } from './types.js';
3
+ import type { CalendarSystem } from '../utils/calendarSystem.js';
3
4
  export interface InternationalizationContextValue {
4
5
  locale: Locale;
5
6
  direction: 'ltr' | 'rtl';
7
+ /**
8
+ * The provider's requested calendar system. A context without it means
9
+ * Gregorian dates.
10
+ */
11
+ calendar?: CalendarSystem;
6
12
  messages: MessagesByLocale;
7
13
  overrides?: Overrides;
8
14
  translate: ReturnType<typeof getResolve>;
@@ -1 +1 @@
1
- {"version":3,"file":"InternationalizationContext.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationContext.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAEjE,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IACzB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,2DAMpC,CAAC"}
1
+ {"version":3,"file":"InternationalizationContext.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationContext.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AACjE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAE5D,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,2DAMpC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @file InternationalizationProvider.tsx
3
- * @input React, InternationalizationContext, i18n types
3
+ * @input React, InternationalizationContext, i18n types, calendar resolution
4
4
  * @output Exports InternationalizationProvider component and props type
5
- * @position Provider component for astryx i18n locale + messages
5
+ * @position Provider component for astryx i18n locale, messages, and calendar
6
6
  *
7
7
  * Wraps a subtree with a locale and (optional) additional message catalogs +
8
8
  * overrides. Astryx components inside the subtree resolve their strings via
@@ -15,6 +15,7 @@
15
15
  * - /packages/core/src/i18n/InternationalizationProvider.doc.mjs
16
16
  */
17
17
  import { type ReactNode } from 'react';
18
+ import type { CalendarSystem } from '../utils/calendarSystem.js';
18
19
  import type { Locale, Overrides, ProviderMessagesByLocale } from './types.js';
19
20
  export interface InternationalizationProviderProps {
20
21
  /**
@@ -63,13 +64,30 @@ export interface InternationalizationProviderProps {
63
64
  * in sync (e.g. `dir={getLocaleDirection(locale)}` on both).
64
65
  */
65
66
  dir?: 'ltr' | 'rtl';
67
+ /**
68
+ * The calendar system of this subtree, such as `'persian'` or `'hebrew'`.
69
+ * `Calendar` shows it, and Timestamp and PowerSearch write their dates in it.
70
+ * The date inputs show Gregorian dates. Values stay Gregorian ISO dates. When
71
+ * omitted, the calendar is Gregorian: a locale never selects it, neither by
72
+ * its default calendar nor by a `-u-ca-` keyword. A component's own
73
+ * `calendar` prop takes precedence. Calendars other than `gregory`,
74
+ * `iso8601`, `buddhist`, `roc`, and `japanese` need `Temporal`. The context
75
+ * keeps the requested calendar; where `Temporal` is missing, these components
76
+ * show Gregorian dates and warn once in development.
77
+ *
78
+ * @example
79
+ * ```
80
+ * <InternationalizationProvider locale="fa-IR" calendar="persian">
81
+ * ```
82
+ */
83
+ calendar?: CalendarSystem;
66
84
  children: ReactNode;
67
85
  }
68
86
  /**
69
87
  * Provides locale + additional messages + overrides to all astryx
70
88
  * components in the subtree.
71
89
  */
72
- export declare function InternationalizationProvider({ locale, messages, overrides, dir, children, }: InternationalizationProviderProps): import("react").JSX.Element;
90
+ export declare function InternationalizationProvider({ locale, messages, overrides, dir, calendar: calendarProp, children, }: InternationalizationProviderProps): import("react").JSX.Element;
73
91
  export declare namespace InternationalizationProvider {
74
92
  var displayName: string;
75
93
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InternationalizationProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationProvider.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG9C,OAAO,KAAK,EACV,MAAM,EAEN,SAAS,EACT,wBAAwB,EACzB,MAAM,SAAS,CAAC;AA0BjB,MAAM,WAAW,iCAAiC;IAChD;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,SAAS,EACT,GAAG,EACH,QAAQ,GACT,EAAE,iCAAiC,+BAiBnC;yBAvBe,4BAA4B"}
1
+ {"version":3,"file":"InternationalizationProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationProvider.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI9C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EACV,MAAM,EAEN,SAAS,EACT,wBAAwB,EACzB,MAAM,SAAS,CAAC;AA4BjB,MAAM,WAAW,iCAAiC;IAChD;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,SAAS,EACT,GAAG,EACH,QAAQ,EAAE,YAAY,EACtB,QAAQ,GACT,EAAE,iCAAiC,+BAyBnC;yBAhCe,4BAA4B"}
@@ -4,9 +4,9 @@
4
4
 
5
5
  /**
6
6
  * @file InternationalizationProvider.tsx
7
- * @input React, InternationalizationContext, i18n types
7
+ * @input React, InternationalizationContext, i18n types, calendar resolution
8
8
  * @output Exports InternationalizationProvider component and props type
9
- * @position Provider component for astryx i18n locale + messages
9
+ * @position Provider component for astryx i18n locale, messages, and calendar
10
10
  *
11
11
  * Wraps a subtree with a locale and (optional) additional message catalogs +
12
12
  * overrides. Astryx components inside the subtree resolve their strings via
@@ -21,8 +21,10 @@
21
21
  import { useMemo } from 'react';
22
22
  import { InternationalizationContext } from "./InternationalizationContext.js";
23
23
  import { getLocaleDirection } from "./getLocaleDirection.js";
24
+ import { resolveCalendarSystem } from "./useCalendarSystem.js";
24
25
  import { getResolve } from "./resolve.js";
25
26
  import { jsx as _jsx } from "react/jsx-runtime";
27
+ const PROVIDER_NAME = 'InternationalizationProvider';
26
28
  function normalizeMessages(messages) {
27
29
  const hasRuntimeCatalog = Object.values(messages).some(catalog => Object.values(catalog).some(entry => typeof entry === 'string'));
28
30
  if (!hasRuntimeCatalog) {
@@ -41,19 +43,22 @@ export function InternationalizationProvider({
41
43
  messages,
42
44
  overrides,
43
45
  dir,
46
+ calendar: calendarProp,
44
47
  children
45
48
  }) {
46
49
  const direction = dir ?? getLocaleDirection(locale);
50
+ const calendar = useMemo(() => calendarProp != null ? resolveCalendarSystem(calendarProp, PROVIDER_NAME) : 'gregory', [calendarProp]);
47
51
  const value = useMemo(() => {
48
52
  const providedMessages = messages ?? {};
49
53
  return {
50
54
  locale,
51
55
  direction,
56
+ calendar,
52
57
  messages: normalizeMessages(providedMessages),
53
58
  overrides,
54
59
  translate: getResolve(locale, providedMessages, overrides)
55
60
  };
56
- }, [locale, direction, messages, overrides]);
61
+ }, [locale, direction, calendar, messages, overrides]);
57
62
  return /*#__PURE__*/_jsx(InternationalizationContext, {
58
63
  value: value,
59
64
  children: children
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @generated by scripts/generate-i18n-runtime.mjs from packages/core/locales/en.json,
3
+ * holding the English for the catalog keys named in packages/core/src/hooks/useScrollRegionProps.ts.
4
+ * Do not edit by hand. Run `pnpm generate:i18n-runtime` instead.
5
+ */
6
+ declare const english: Readonly<Record<string, string>>;
7
+ export default english;
8
+ //# sourceMappingURL=useScrollRegionProps.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollRegionProps.generated.d.ts","sourceRoot":"","sources":["../../../../src/i18n/generated-english/hooks/useScrollRegionProps.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE7C,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @generated by scripts/generate-i18n-runtime.mjs from packages/core/locales/en.json,
5
+ * holding the English for the catalog keys named in packages/core/src/hooks/useScrollRegionProps.ts.
6
+ * Do not edit by hand. Run `pnpm generate:i18n-runtime` instead.
7
+ */
8
+
9
+ const english = {
10
+ "@astryx.scrollRegion.label": "Content"
11
+ };
12
+ export default english;
@@ -1 +1 @@
1
- {"version":3,"file":"en.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/en.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmqBpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"en.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/en.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoqBpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -338,6 +338,7 @@ const runtimeCatalog = {
338
338
  '@astryx.banner.expand': 'Expand',
339
339
  '@astryx.button.loading': 'Loading',
340
340
  '@astryx.spinner.loading': 'Loading',
341
+ '@astryx.scrollRegion.label': 'Content',
341
342
  '@astryx.chatComposerDrawer.expand': 'Expand {label}',
342
343
  '@astryx.chatComposerDrawer.collapse': 'Collapse {label}',
343
344
  '@astryx.chatDictationButton.startDictation': 'Start dictation',
@@ -1 +1 @@
1
- {"version":3,"file":"pseudo.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/pseudo.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA+qBpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"pseudo.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/pseudo.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgrBpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -338,6 +338,7 @@ const runtimeCatalog = {
338
338
  '@astryx.banner.expand': '⟦Éẋþàñð⟧',
339
339
  '@astryx.button.loading': '⟦Łóàðíñĝ⟧',
340
340
  '@astryx.spinner.loading': '⟦Łóàðíñĝ⟧',
341
+ '@astryx.scrollRegion.label': '⟦Çóñţéñţ⟧',
341
342
  '@astryx.chatComposerDrawer.expand': '⟦Éẋþàñð {label}⟧',
342
343
  '@astryx.chatComposerDrawer.collapse': '⟦Çółłàþšé {label}⟧',
343
344
  '@astryx.chatDictationButton.startDictation': '⟦Šţàřţ ðíçţàţíóñ⟧',
@@ -13,6 +13,7 @@
13
13
  * - useDirection — hook returning the ambient text direction
14
14
  * - getLocaleDirection — server-safe locale → direction helper
15
15
  * - Translator — interface for consumer-injected runtimes
16
+ * - CalendarSystem — the calendars date components can show
16
17
  *
17
18
  * `useTranslator` and `InternationalizationContext` are the public paths
18
19
  * that resolve any Astryx key, so they register the whole English catalog.
@@ -36,6 +37,7 @@ export { useLocale } from './useLocale.js';
36
37
  export { useCollator } from './useCollator.js';
37
38
  export { useDirection } from './useDirection.js';
38
39
  export { getLocaleDirection } from './getLocaleDirection.js';
40
+ export type { CalendarSystem } from '../utils/calendarSystem.js';
39
41
  export type { Translator } from './translator.js';
40
42
  export type { Locale, Catalog, MessageEntry, RuntimeCatalog, MessagesByLocale, ProviderMessagesByLocale, Overrides, } from './types.js';
41
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAC,4BAA4B,EAAC,MAAM,gCAAgC,CAAC;AAC5E,YAAY,EAAC,iCAAiC,EAAC,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAC,2BAA2B,EAAC,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAC,gCAAgC,EAAC,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,YAAY,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,MAAM,EACN,OAAO,EACP,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,GACV,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAC,4BAA4B,EAAC,MAAM,gCAAgC,CAAC;AAC5E,YAAY,EAAC,iCAAiC,EAAC,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAC,2BAA2B,EAAC,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAC,gCAAgC,EAAC,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,YAAY,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAC7C,YAAY,EACV,MAAM,EACN,OAAO,EACP,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,GACV,MAAM,SAAS,CAAC"}
@@ -15,6 +15,7 @@
15
15
  * - useDirection — hook returning the ambient text direction
16
16
  * - getLocaleDirection — server-safe locale → direction helper
17
17
  * - Translator — interface for consumer-injected runtimes
18
+ * - CalendarSystem — the calendars date components can show
18
19
  *
19
20
  * `useTranslator` and `InternationalizationContext` are the public paths
20
21
  * that resolve any Astryx key, so they register the whole English catalog.
@@ -0,0 +1,19 @@
1
+ import { type CalendarSystem } from '../utils/calendarSystem.js';
2
+ /**
3
+ * Normalizes a calendar identifier. An identifier outside `CalendarSystem`
4
+ * resolves to `gregory` and warns once in development.
5
+ */
6
+ export declare function resolveCalendarSystem(id: string, source: string): CalendarSystem;
7
+ /**
8
+ * The calendar that a caller names, without the provider: an unknown
9
+ * identifier, or one this runtime cannot show, becomes `gregory` and warns
10
+ * once in development.
11
+ */
12
+ export declare function resolveShownCalendar(calendar: string, source: string): CalendarSystem;
13
+ /**
14
+ * The calendar a date component shows: its own `calendar`, else the
15
+ * provider's resolved calendar, else `gregory`. It resolves during render, so
16
+ * the server and the browser agree when both have `Temporal` or both lack it.
17
+ */
18
+ export declare function useCalendarSystem(calendar: CalendarSystem | undefined, source: string): CalendarSystem;
19
+ //# sourceMappingURL=useCalendarSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCalendarSystem.d.ts","sourceRoot":"","sources":["../../src/i18n/useCalendarSystem.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,yBAAyB,CAAC;AAGjC;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACb,cAAc,CAUhB;AAyBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,cAAc,CAKhB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,cAAc,GAAG,SAAS,EACpC,MAAM,EAAE,MAAM,GACb,cAAc,CAMhB"}
@@ -0,0 +1,61 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file useCalendarSystem.ts
7
+ * @input InternationalizationContext, an optional component `calendar`
8
+ * @output The calendar system a date component shows, and the helpers that
9
+ * normalize a calendar identifier
10
+ * @position Internal i18n hook; read by InternationalizationProvider, date
11
+ * components, and the public calendar hooks. Not re-exported from the i18n
12
+ * barrel.
13
+ */
14
+ import { use } from 'react';
15
+ import { InternationalizationContext } from "./InternationalizationContext.js";
16
+ import { isCalendarSystem, isCalendarSystemAvailable } from "../utils/calendarSystem.js";
17
+ import { warnOnce } from "../utils/devWarning.js";
18
+
19
+ /**
20
+ * Normalizes a calendar identifier. An identifier outside `CalendarSystem`
21
+ * resolves to `gregory` and warns once in development.
22
+ */
23
+ export function resolveCalendarSystem(id, source) {
24
+ if (isCalendarSystem(id)) {
25
+ return id;
26
+ }
27
+ warnOnce(`calendar-unsupported:${id}`, source, `The calendar "${id}" is not supported; showing Gregorian dates.`);
28
+ return 'gregory';
29
+ }
30
+
31
+ /**
32
+ * A calendar this runtime can show, else `gregory`. Calendars outside the
33
+ * Gregorian-aligned set need a `Temporal` that supports them. The fallback
34
+ * warns once for each calendar, on the server and in the browser.
35
+ */
36
+ function availableCalendarOrGregorian(calendar, source) {
37
+ if (isCalendarSystemAvailable(calendar)) {
38
+ return calendar;
39
+ }
40
+ warnOnce(`calendar-unavailable:${calendar}`, source, `The "${calendar}" calendar needs a Temporal that supports it, and this ` + 'runtime has none; showing Gregorian dates. Load a Temporal polyfill ' + "with every calendar, such as 'temporal-polyfill/full/global', on the " + 'server and in the browser.');
41
+ return 'gregory';
42
+ }
43
+
44
+ /**
45
+ * The calendar that a caller names, without the provider: an unknown
46
+ * identifier, or one this runtime cannot show, becomes `gregory` and warns
47
+ * once in development.
48
+ */
49
+ export function resolveShownCalendar(calendar, source) {
50
+ return availableCalendarOrGregorian(resolveCalendarSystem(calendar, source), source);
51
+ }
52
+
53
+ /**
54
+ * The calendar a date component shows: its own `calendar`, else the
55
+ * provider's resolved calendar, else `gregory`. It resolves during render, so
56
+ * the server and the browser agree when both have `Temporal` or both lack it.
57
+ */
58
+ export function useCalendarSystem(calendar, source) {
59
+ const context = use(InternationalizationContext);
60
+ return resolveShownCalendar(calendar ?? context.calendar ?? 'gregory', source);
61
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file spinner-rotor.ts
3
+ * @input Spinner's shared rotor
4
+ * @output `@astryxdesign/core/internal/spinner-rotor`: SPINNER_ARC_FRACTION,
5
+ * spinnerRotorStyles and syncRotationPhase, re-exported by name for Lab's
6
+ * indeterminate CircularProgress
7
+ * @position An internal entry reserved for Astryx's own packages. It is
8
+ * undocumented, outside the public API and its compatibility promise, and
9
+ * versioned in lockstep with Core. The `@astryx/no-core-internal-import`
10
+ * lint rule allows it only in Core and Lab. Core components import the
11
+ * same modules by relative path. Named re-exports only.
12
+ *
13
+ * SYNC: When modified, update scripts/sync-exports.js.
14
+ */
15
+ export { SPINNER_ARC_FRACTION, spinnerRotorStyles, syncRotationPhase, } from '../Spinner/spinnerRotor.js';
16
+ //# sourceMappingURL=spinner-rotor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner-rotor.d.ts","sourceRoot":"","sources":["../../src/internal/spinner-rotor.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC"}