blend-native 0.0.1-beta.0

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 (555) hide show
  1. package/README.md +404 -0
  2. package/lib/commonjs/a11y/announcement.js +42 -0
  3. package/lib/commonjs/a11y/announcement.js.map +1 -0
  4. package/lib/commonjs/a11y/useLiveRegion.js +37 -0
  5. package/lib/commonjs/a11y/useLiveRegion.js.map +1 -0
  6. package/lib/commonjs/adapters/cssStringAdapter.js +363 -0
  7. package/lib/commonjs/adapters/cssStringAdapter.js.map +1 -0
  8. package/lib/commonjs/adapters/optionalGradient.js +33 -0
  9. package/lib/commonjs/adapters/optionalGradient.js.map +1 -0
  10. package/lib/commonjs/adapters/surfaceStyle.js +159 -0
  11. package/lib/commonjs/adapters/surfaceStyle.js.map +1 -0
  12. package/lib/commonjs/components/Alert/Alert.js +130 -0
  13. package/lib/commonjs/components/Alert/Alert.js.map +1 -0
  14. package/lib/commonjs/components/Alert/AlertActions.js +74 -0
  15. package/lib/commonjs/components/Alert/AlertActions.js.map +1 -0
  16. package/lib/commonjs/components/Alert/AlertClose.js +48 -0
  17. package/lib/commonjs/components/Alert/AlertClose.js.map +1 -0
  18. package/lib/commonjs/components/Alert/AlertText.js +49 -0
  19. package/lib/commonjs/components/Alert/AlertText.js.map +1 -0
  20. package/lib/commonjs/components/Alert/alert.tokens.js +6 -0
  21. package/lib/commonjs/components/Alert/alert.tokens.js.map +1 -0
  22. package/lib/commonjs/components/Alert/alert.types.js +6 -0
  23. package/lib/commonjs/components/Alert/alert.types.js.map +1 -0
  24. package/lib/commonjs/components/Alert/alert.utils.js +80 -0
  25. package/lib/commonjs/components/Alert/alert.utils.js.map +1 -0
  26. package/lib/commonjs/components/Alert/index.js +51 -0
  27. package/lib/commonjs/components/Alert/index.js.map +1 -0
  28. package/lib/commonjs/components/Button/Button.js +125 -0
  29. package/lib/commonjs/components/Button/Button.js.map +1 -0
  30. package/lib/commonjs/components/Button/button.types.js +6 -0
  31. package/lib/commonjs/components/Button/button.types.js.map +1 -0
  32. package/lib/commonjs/components/Button/button.utils.js +129 -0
  33. package/lib/commonjs/components/Button/button.utils.js.map +1 -0
  34. package/lib/commonjs/components/Button/index.js +57 -0
  35. package/lib/commonjs/components/Button/index.js.map +1 -0
  36. package/lib/commonjs/components/Skeleton/Skeleton.js +154 -0
  37. package/lib/commonjs/components/Skeleton/Skeleton.js.map +1 -0
  38. package/lib/commonjs/components/Skeleton/index.js +20 -0
  39. package/lib/commonjs/components/Skeleton/index.js.map +1 -0
  40. package/lib/commonjs/components/Skeleton/skeleton.types.js +6 -0
  41. package/lib/commonjs/components/Skeleton/skeleton.types.js.map +1 -0
  42. package/lib/commonjs/components/Skeleton/skeleton.utils.js +45 -0
  43. package/lib/commonjs/components/Skeleton/skeleton.utils.js.map +1 -0
  44. package/lib/commonjs/components/Tag/Tag.js +161 -0
  45. package/lib/commonjs/components/Tag/Tag.js.map +1 -0
  46. package/lib/commonjs/components/Tag/index.js +33 -0
  47. package/lib/commonjs/components/Tag/index.js.map +1 -0
  48. package/lib/commonjs/components/Tag/tag.types.js +6 -0
  49. package/lib/commonjs/components/Tag/tag.types.js.map +1 -0
  50. package/lib/commonjs/components/Tag/tag.utils.js +69 -0
  51. package/lib/commonjs/components/Tag/tag.utils.js.map +1 -0
  52. package/lib/commonjs/components/TextInput/TextInput.js +138 -0
  53. package/lib/commonjs/components/TextInput/TextInput.js.map +1 -0
  54. package/lib/commonjs/components/TextInput/index.js +14 -0
  55. package/lib/commonjs/components/TextInput/index.js.map +1 -0
  56. package/lib/commonjs/components/TextInput/textInput.types.js +6 -0
  57. package/lib/commonjs/components/TextInput/textInput.types.js.map +1 -0
  58. package/lib/commonjs/components/TextInput/textInput.utils.js +40 -0
  59. package/lib/commonjs/components/TextInput/textInput.utils.js.map +1 -0
  60. package/lib/commonjs/components/shared/field/FieldFooter.js +51 -0
  61. package/lib/commonjs/components/shared/field/FieldFooter.js.map +1 -0
  62. package/lib/commonjs/components/shared/field/FieldLabels.js +67 -0
  63. package/lib/commonjs/components/shared/field/FieldLabels.js.map +1 -0
  64. package/lib/commonjs/components/shared/field/fieldState.js +37 -0
  65. package/lib/commonjs/components/shared/field/fieldState.js.map +1 -0
  66. package/lib/commonjs/components/shared/group.js +73 -0
  67. package/lib/commonjs/components/shared/group.js.map +1 -0
  68. package/lib/commonjs/index.js +256 -0
  69. package/lib/commonjs/index.js.map +1 -0
  70. package/lib/commonjs/motion/motion.js +128 -0
  71. package/lib/commonjs/motion/motion.js.map +1 -0
  72. package/lib/commonjs/motion/useReduceMotion.js +37 -0
  73. package/lib/commonjs/motion/useReduceMotion.js.map +1 -0
  74. package/lib/commonjs/overlay/portal.js +110 -0
  75. package/lib/commonjs/overlay/portal.js.map +1 -0
  76. package/lib/commonjs/overlay/positioning.js +122 -0
  77. package/lib/commonjs/overlay/positioning.js.map +1 -0
  78. package/lib/commonjs/overlay/safeAreaInsets.js +30 -0
  79. package/lib/commonjs/overlay/safeAreaInsets.js.map +1 -0
  80. package/lib/commonjs/overlay/sheet/BottomSheet.js +196 -0
  81. package/lib/commonjs/overlay/sheet/BottomSheet.js.map +1 -0
  82. package/lib/commonjs/overlay/sheet/sheetMath.js +60 -0
  83. package/lib/commonjs/overlay/sheet/sheetMath.js.map +1 -0
  84. package/lib/commonjs/overlay/toast/ToastOutlet.js +106 -0
  85. package/lib/commonjs/overlay/toast/ToastOutlet.js.map +1 -0
  86. package/lib/commonjs/overlay/toast/toastStore.js +76 -0
  87. package/lib/commonjs/overlay/toast/toastStore.js.map +1 -0
  88. package/lib/commonjs/overlay/useAnchoredPosition.js +85 -0
  89. package/lib/commonjs/overlay/useAnchoredPosition.js.map +1 -0
  90. package/lib/commonjs/package.json +1 -0
  91. package/lib/commonjs/primitives/Block.js +112 -0
  92. package/lib/commonjs/primitives/Block.js.map +1 -0
  93. package/lib/commonjs/primitives/Pressable.js +348 -0
  94. package/lib/commonjs/primitives/Pressable.js.map +1 -0
  95. package/lib/commonjs/primitives/PrimitiveInput.js +66 -0
  96. package/lib/commonjs/primitives/PrimitiveInput.js.map +1 -0
  97. package/lib/commonjs/primitives/Separator.js +55 -0
  98. package/lib/commonjs/primitives/Separator.js.map +1 -0
  99. package/lib/commonjs/primitives/Slot.js +78 -0
  100. package/lib/commonjs/primitives/Slot.js.map +1 -0
  101. package/lib/commonjs/primitives/Text.js +73 -0
  102. package/lib/commonjs/primitives/Text.js.map +1 -0
  103. package/lib/commonjs/primitives/pressFeedback.js +53 -0
  104. package/lib/commonjs/primitives/pressFeedback.js.map +1 -0
  105. package/lib/commonjs/primitives/textStyle.js +27 -0
  106. package/lib/commonjs/primitives/textStyle.js.map +1 -0
  107. package/lib/commonjs/primitives/tintSlot.js +45 -0
  108. package/lib/commonjs/primitives/tintSlot.js.map +1 -0
  109. package/lib/commonjs/primitives/touchTarget.js +64 -0
  110. package/lib/commonjs/primitives/touchTarget.js.map +1 -0
  111. package/lib/commonjs/theme/BlendNativeProvider.js +90 -0
  112. package/lib/commonjs/theme/BlendNativeProvider.js.map +1 -0
  113. package/lib/commonjs/theme/breakpoint.js +36 -0
  114. package/lib/commonjs/theme/breakpoint.js.map +1 -0
  115. package/lib/commonjs/theme/fonts.js +58 -0
  116. package/lib/commonjs/theme/fonts.js.map +1 -0
  117. package/lib/commonjs/theme/nativeTokenRegistry.js +44 -0
  118. package/lib/commonjs/theme/nativeTokenRegistry.js.map +1 -0
  119. package/lib/commonjs/theme/systemTheme.js +35 -0
  120. package/lib/commonjs/theme/systemTheme.js.map +1 -0
  121. package/lib/commonjs/theme/useNativeBreakpoint.js +33 -0
  122. package/lib/commonjs/theme/useNativeBreakpoint.js.map +1 -0
  123. package/lib/commonjs/theme/useNativeTokens.js +71 -0
  124. package/lib/commonjs/theme/useNativeTokens.js.map +1 -0
  125. package/lib/module/a11y/announcement.js +38 -0
  126. package/lib/module/a11y/announcement.js.map +1 -0
  127. package/lib/module/a11y/useLiveRegion.js +33 -0
  128. package/lib/module/a11y/useLiveRegion.js.map +1 -0
  129. package/lib/module/adapters/cssStringAdapter.js +352 -0
  130. package/lib/module/adapters/cssStringAdapter.js.map +1 -0
  131. package/lib/module/adapters/optionalGradient.js +29 -0
  132. package/lib/module/adapters/optionalGradient.js.map +1 -0
  133. package/lib/module/adapters/surfaceStyle.js +155 -0
  134. package/lib/module/adapters/surfaceStyle.js.map +1 -0
  135. package/lib/module/components/Alert/Alert.js +126 -0
  136. package/lib/module/components/Alert/Alert.js.map +1 -0
  137. package/lib/module/components/Alert/AlertActions.js +70 -0
  138. package/lib/module/components/Alert/AlertActions.js.map +1 -0
  139. package/lib/module/components/Alert/AlertClose.js +44 -0
  140. package/lib/module/components/Alert/AlertClose.js.map +1 -0
  141. package/lib/module/components/Alert/AlertText.js +45 -0
  142. package/lib/module/components/Alert/AlertText.js.map +1 -0
  143. package/lib/module/components/Alert/alert.tokens.js +4 -0
  144. package/lib/module/components/Alert/alert.tokens.js.map +1 -0
  145. package/lib/module/components/Alert/alert.types.js +4 -0
  146. package/lib/module/components/Alert/alert.types.js.map +1 -0
  147. package/lib/module/components/Alert/alert.utils.js +72 -0
  148. package/lib/module/components/Alert/alert.utils.js.map +1 -0
  149. package/lib/module/components/Alert/index.js +6 -0
  150. package/lib/module/components/Alert/index.js.map +1 -0
  151. package/lib/module/components/Button/Button.js +121 -0
  152. package/lib/module/components/Button/Button.js.map +1 -0
  153. package/lib/module/components/Button/button.types.js +4 -0
  154. package/lib/module/components/Button/button.types.js.map +1 -0
  155. package/lib/module/components/Button/button.utils.js +120 -0
  156. package/lib/module/components/Button/button.utils.js.map +1 -0
  157. package/lib/module/components/Button/index.js +5 -0
  158. package/lib/module/components/Button/index.js.map +1 -0
  159. package/lib/module/components/Skeleton/Skeleton.js +149 -0
  160. package/lib/module/components/Skeleton/Skeleton.js.map +1 -0
  161. package/lib/module/components/Skeleton/index.js +4 -0
  162. package/lib/module/components/Skeleton/index.js.map +1 -0
  163. package/lib/module/components/Skeleton/skeleton.types.js +4 -0
  164. package/lib/module/components/Skeleton/skeleton.types.js.map +1 -0
  165. package/lib/module/components/Skeleton/skeleton.utils.js +40 -0
  166. package/lib/module/components/Skeleton/skeleton.utils.js.map +1 -0
  167. package/lib/module/components/Tag/Tag.js +157 -0
  168. package/lib/module/components/Tag/Tag.js.map +1 -0
  169. package/lib/module/components/Tag/index.js +5 -0
  170. package/lib/module/components/Tag/index.js.map +1 -0
  171. package/lib/module/components/Tag/tag.types.js +4 -0
  172. package/lib/module/components/Tag/tag.types.js.map +1 -0
  173. package/lib/module/components/Tag/tag.utils.js +64 -0
  174. package/lib/module/components/Tag/tag.utils.js.map +1 -0
  175. package/lib/module/components/TextInput/TextInput.js +134 -0
  176. package/lib/module/components/TextInput/TextInput.js.map +1 -0
  177. package/lib/module/components/TextInput/index.js +4 -0
  178. package/lib/module/components/TextInput/index.js.map +1 -0
  179. package/lib/module/components/TextInput/textInput.types.js +4 -0
  180. package/lib/module/components/TextInput/textInput.types.js.map +1 -0
  181. package/lib/module/components/TextInput/textInput.utils.js +36 -0
  182. package/lib/module/components/TextInput/textInput.utils.js.map +1 -0
  183. package/lib/module/components/shared/field/FieldFooter.js +47 -0
  184. package/lib/module/components/shared/field/FieldFooter.js.map +1 -0
  185. package/lib/module/components/shared/field/FieldLabels.js +63 -0
  186. package/lib/module/components/shared/field/FieldLabels.js.map +1 -0
  187. package/lib/module/components/shared/field/fieldState.js +33 -0
  188. package/lib/module/components/shared/field/fieldState.js.map +1 -0
  189. package/lib/module/components/shared/group.js +68 -0
  190. package/lib/module/components/shared/group.js.map +1 -0
  191. package/lib/module/index.js +80 -0
  192. package/lib/module/index.js.map +1 -0
  193. package/lib/module/motion/motion.js +123 -0
  194. package/lib/module/motion/motion.js.map +1 -0
  195. package/lib/module/motion/useReduceMotion.js +33 -0
  196. package/lib/module/motion/useReduceMotion.js.map +1 -0
  197. package/lib/module/overlay/portal.js +104 -0
  198. package/lib/module/overlay/portal.js.map +1 -0
  199. package/lib/module/overlay/positioning.js +118 -0
  200. package/lib/module/overlay/positioning.js.map +1 -0
  201. package/lib/module/overlay/safeAreaInsets.js +27 -0
  202. package/lib/module/overlay/safeAreaInsets.js.map +1 -0
  203. package/lib/module/overlay/sheet/BottomSheet.js +190 -0
  204. package/lib/module/overlay/sheet/BottomSheet.js.map +1 -0
  205. package/lib/module/overlay/sheet/sheetMath.js +53 -0
  206. package/lib/module/overlay/sheet/sheetMath.js.map +1 -0
  207. package/lib/module/overlay/toast/ToastOutlet.js +101 -0
  208. package/lib/module/overlay/toast/ToastOutlet.js.map +1 -0
  209. package/lib/module/overlay/toast/toastStore.js +66 -0
  210. package/lib/module/overlay/toast/toastStore.js.map +1 -0
  211. package/lib/module/overlay/useAnchoredPosition.js +82 -0
  212. package/lib/module/overlay/useAnchoredPosition.js.map +1 -0
  213. package/lib/module/package.json +1 -0
  214. package/lib/module/primitives/Block.js +107 -0
  215. package/lib/module/primitives/Block.js.map +1 -0
  216. package/lib/module/primitives/Pressable.js +339 -0
  217. package/lib/module/primitives/Pressable.js.map +1 -0
  218. package/lib/module/primitives/PrimitiveInput.js +62 -0
  219. package/lib/module/primitives/PrimitiveInput.js.map +1 -0
  220. package/lib/module/primitives/Separator.js +50 -0
  221. package/lib/module/primitives/Separator.js.map +1 -0
  222. package/lib/module/primitives/Slot.js +69 -0
  223. package/lib/module/primitives/Slot.js.map +1 -0
  224. package/lib/module/primitives/Text.js +68 -0
  225. package/lib/module/primitives/Text.js.map +1 -0
  226. package/lib/module/primitives/pressFeedback.js +48 -0
  227. package/lib/module/primitives/pressFeedback.js.map +1 -0
  228. package/lib/module/primitives/textStyle.js +23 -0
  229. package/lib/module/primitives/textStyle.js.map +1 -0
  230. package/lib/module/primitives/tintSlot.js +42 -0
  231. package/lib/module/primitives/tintSlot.js.map +1 -0
  232. package/lib/module/primitives/touchTarget.js +58 -0
  233. package/lib/module/primitives/touchTarget.js.map +1 -0
  234. package/lib/module/theme/BlendNativeProvider.js +78 -0
  235. package/lib/module/theme/BlendNativeProvider.js.map +1 -0
  236. package/lib/module/theme/breakpoint.js +33 -0
  237. package/lib/module/theme/breakpoint.js.map +1 -0
  238. package/lib/module/theme/fonts.js +55 -0
  239. package/lib/module/theme/fonts.js.map +1 -0
  240. package/lib/module/theme/nativeTokenRegistry.js +40 -0
  241. package/lib/module/theme/nativeTokenRegistry.js.map +1 -0
  242. package/lib/module/theme/systemTheme.js +31 -0
  243. package/lib/module/theme/systemTheme.js.map +1 -0
  244. package/lib/module/theme/useNativeBreakpoint.js +24 -0
  245. package/lib/module/theme/useNativeBreakpoint.js.map +1 -0
  246. package/lib/module/theme/useNativeTokens.js +67 -0
  247. package/lib/module/theme/useNativeTokens.js.map +1 -0
  248. package/lib/typescript/commonjs/a11y/announcement.d.ts +26 -0
  249. package/lib/typescript/commonjs/a11y/announcement.d.ts.map +1 -0
  250. package/lib/typescript/commonjs/a11y/useLiveRegion.d.ts +17 -0
  251. package/lib/typescript/commonjs/a11y/useLiveRegion.d.ts.map +1 -0
  252. package/lib/typescript/commonjs/adapters/cssStringAdapter.d.ts +119 -0
  253. package/lib/typescript/commonjs/adapters/cssStringAdapter.d.ts.map +1 -0
  254. package/lib/typescript/commonjs/adapters/optionalGradient.d.ts +32 -0
  255. package/lib/typescript/commonjs/adapters/optionalGradient.d.ts.map +1 -0
  256. package/lib/typescript/commonjs/adapters/surfaceStyle.d.ts +75 -0
  257. package/lib/typescript/commonjs/adapters/surfaceStyle.d.ts.map +1 -0
  258. package/lib/typescript/commonjs/components/Alert/Alert.d.ts +14 -0
  259. package/lib/typescript/commonjs/components/Alert/Alert.d.ts.map +1 -0
  260. package/lib/typescript/commonjs/components/Alert/AlertActions.d.ts +13 -0
  261. package/lib/typescript/commonjs/components/Alert/AlertActions.d.ts.map +1 -0
  262. package/lib/typescript/commonjs/components/Alert/AlertClose.d.ts +22 -0
  263. package/lib/typescript/commonjs/components/Alert/AlertClose.d.ts.map +1 -0
  264. package/lib/typescript/commonjs/components/Alert/AlertText.d.ts +19 -0
  265. package/lib/typescript/commonjs/components/Alert/AlertText.d.ts.map +1 -0
  266. package/lib/typescript/commonjs/components/Alert/alert.tokens.d.ts +17 -0
  267. package/lib/typescript/commonjs/components/Alert/alert.tokens.d.ts.map +1 -0
  268. package/lib/typescript/commonjs/components/Alert/alert.types.d.ts +70 -0
  269. package/lib/typescript/commonjs/components/Alert/alert.types.d.ts.map +1 -0
  270. package/lib/typescript/commonjs/components/Alert/alert.utils.d.ts +58 -0
  271. package/lib/typescript/commonjs/components/Alert/alert.utils.d.ts.map +1 -0
  272. package/lib/typescript/commonjs/components/Alert/index.d.ts +7 -0
  273. package/lib/typescript/commonjs/components/Alert/index.d.ts.map +1 -0
  274. package/lib/typescript/commonjs/components/Button/Button.d.ts +22 -0
  275. package/lib/typescript/commonjs/components/Button/Button.d.ts.map +1 -0
  276. package/lib/typescript/commonjs/components/Button/button.types.d.ts +37 -0
  277. package/lib/typescript/commonjs/components/Button/button.types.d.ts.map +1 -0
  278. package/lib/typescript/commonjs/components/Button/button.utils.d.ts +98 -0
  279. package/lib/typescript/commonjs/components/Button/button.utils.d.ts.map +1 -0
  280. package/lib/typescript/commonjs/components/Button/index.d.ts +5 -0
  281. package/lib/typescript/commonjs/components/Button/index.d.ts.map +1 -0
  282. package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +7 -0
  283. package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts.map +1 -0
  284. package/lib/typescript/commonjs/components/Skeleton/index.d.ts +3 -0
  285. package/lib/typescript/commonjs/components/Skeleton/index.d.ts.map +1 -0
  286. package/lib/typescript/commonjs/components/Skeleton/skeleton.types.d.ts +25 -0
  287. package/lib/typescript/commonjs/components/Skeleton/skeleton.types.d.ts.map +1 -0
  288. package/lib/typescript/commonjs/components/Skeleton/skeleton.utils.d.ts +21 -0
  289. package/lib/typescript/commonjs/components/Skeleton/skeleton.utils.d.ts.map +1 -0
  290. package/lib/typescript/commonjs/components/Tag/Tag.d.ts +21 -0
  291. package/lib/typescript/commonjs/components/Tag/Tag.d.ts.map +1 -0
  292. package/lib/typescript/commonjs/components/Tag/index.d.ts +4 -0
  293. package/lib/typescript/commonjs/components/Tag/index.d.ts.map +1 -0
  294. package/lib/typescript/commonjs/components/Tag/tag.types.d.ts +56 -0
  295. package/lib/typescript/commonjs/components/Tag/tag.types.d.ts.map +1 -0
  296. package/lib/typescript/commonjs/components/Tag/tag.utils.d.ts +41 -0
  297. package/lib/typescript/commonjs/components/Tag/tag.utils.d.ts.map +1 -0
  298. package/lib/typescript/commonjs/components/TextInput/TextInput.d.ts +33 -0
  299. package/lib/typescript/commonjs/components/TextInput/TextInput.d.ts.map +1 -0
  300. package/lib/typescript/commonjs/components/TextInput/index.d.ts +3 -0
  301. package/lib/typescript/commonjs/components/TextInput/index.d.ts.map +1 -0
  302. package/lib/typescript/commonjs/components/TextInput/textInput.types.d.ts +45 -0
  303. package/lib/typescript/commonjs/components/TextInput/textInput.types.d.ts.map +1 -0
  304. package/lib/typescript/commonjs/components/TextInput/textInput.utils.d.ts +35 -0
  305. package/lib/typescript/commonjs/components/TextInput/textInput.utils.d.ts.map +1 -0
  306. package/lib/typescript/commonjs/components/shared/field/FieldFooter.d.ts +22 -0
  307. package/lib/typescript/commonjs/components/shared/field/FieldFooter.d.ts.map +1 -0
  308. package/lib/typescript/commonjs/components/shared/field/FieldLabels.d.ts +27 -0
  309. package/lib/typescript/commonjs/components/shared/field/FieldLabels.d.ts.map +1 -0
  310. package/lib/typescript/commonjs/components/shared/field/fieldState.d.ts +23 -0
  311. package/lib/typescript/commonjs/components/shared/field/fieldState.d.ts.map +1 -0
  312. package/lib/typescript/commonjs/components/shared/group.d.ts +50 -0
  313. package/lib/typescript/commonjs/components/shared/group.d.ts.map +1 -0
  314. package/lib/typescript/commonjs/index.d.ts +74 -0
  315. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  316. package/lib/typescript/commonjs/motion/motion.d.ts +121 -0
  317. package/lib/typescript/commonjs/motion/motion.d.ts.map +1 -0
  318. package/lib/typescript/commonjs/motion/useReduceMotion.d.ts +14 -0
  319. package/lib/typescript/commonjs/motion/useReduceMotion.d.ts.map +1 -0
  320. package/lib/typescript/commonjs/overlay/portal.d.ts +20 -0
  321. package/lib/typescript/commonjs/overlay/portal.d.ts.map +1 -0
  322. package/lib/typescript/commonjs/overlay/positioning.d.ts +65 -0
  323. package/lib/typescript/commonjs/overlay/positioning.d.ts.map +1 -0
  324. package/lib/typescript/commonjs/overlay/safeAreaInsets.d.ts +19 -0
  325. package/lib/typescript/commonjs/overlay/safeAreaInsets.d.ts.map +1 -0
  326. package/lib/typescript/commonjs/overlay/sheet/BottomSheet.d.ts +56 -0
  327. package/lib/typescript/commonjs/overlay/sheet/BottomSheet.d.ts.map +1 -0
  328. package/lib/typescript/commonjs/overlay/sheet/sheetMath.d.ts +32 -0
  329. package/lib/typescript/commonjs/overlay/sheet/sheetMath.d.ts.map +1 -0
  330. package/lib/typescript/commonjs/overlay/toast/ToastOutlet.d.ts +17 -0
  331. package/lib/typescript/commonjs/overlay/toast/ToastOutlet.d.ts.map +1 -0
  332. package/lib/typescript/commonjs/overlay/toast/toastStore.d.ts +45 -0
  333. package/lib/typescript/commonjs/overlay/toast/toastStore.d.ts.map +1 -0
  334. package/lib/typescript/commonjs/overlay/useAnchoredPosition.d.ts +40 -0
  335. package/lib/typescript/commonjs/overlay/useAnchoredPosition.d.ts.map +1 -0
  336. package/lib/typescript/commonjs/package.json +1 -0
  337. package/lib/typescript/commonjs/primitives/Block.d.ts +37 -0
  338. package/lib/typescript/commonjs/primitives/Block.d.ts.map +1 -0
  339. package/lib/typescript/commonjs/primitives/Pressable.d.ts +135 -0
  340. package/lib/typescript/commonjs/primitives/Pressable.d.ts.map +1 -0
  341. package/lib/typescript/commonjs/primitives/PrimitiveInput.d.ts +42 -0
  342. package/lib/typescript/commonjs/primitives/PrimitiveInput.d.ts.map +1 -0
  343. package/lib/typescript/commonjs/primitives/Separator.d.ts +28 -0
  344. package/lib/typescript/commonjs/primitives/Separator.d.ts.map +1 -0
  345. package/lib/typescript/commonjs/primitives/Slot.d.ts +48 -0
  346. package/lib/typescript/commonjs/primitives/Slot.d.ts.map +1 -0
  347. package/lib/typescript/commonjs/primitives/Text.d.ts +50 -0
  348. package/lib/typescript/commonjs/primitives/Text.d.ts.map +1 -0
  349. package/lib/typescript/commonjs/primitives/pressFeedback.d.ts +39 -0
  350. package/lib/typescript/commonjs/primitives/pressFeedback.d.ts.map +1 -0
  351. package/lib/typescript/commonjs/primitives/textStyle.d.ts +13 -0
  352. package/lib/typescript/commonjs/primitives/textStyle.d.ts.map +1 -0
  353. package/lib/typescript/commonjs/primitives/tintSlot.d.ts +10 -0
  354. package/lib/typescript/commonjs/primitives/tintSlot.d.ts.map +1 -0
  355. package/lib/typescript/commonjs/primitives/touchTarget.d.ts +43 -0
  356. package/lib/typescript/commonjs/primitives/touchTarget.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/theme/BlendNativeProvider.d.ts +69 -0
  358. package/lib/typescript/commonjs/theme/BlendNativeProvider.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/theme/breakpoint.d.ts +27 -0
  360. package/lib/typescript/commonjs/theme/breakpoint.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/theme/fonts.d.ts +34 -0
  362. package/lib/typescript/commonjs/theme/fonts.d.ts.map +1 -0
  363. package/lib/typescript/commonjs/theme/nativeTokenRegistry.d.ts +34 -0
  364. package/lib/typescript/commonjs/theme/nativeTokenRegistry.d.ts.map +1 -0
  365. package/lib/typescript/commonjs/theme/systemTheme.d.ts +25 -0
  366. package/lib/typescript/commonjs/theme/systemTheme.d.ts.map +1 -0
  367. package/lib/typescript/commonjs/theme/useNativeBreakpoint.d.ts +17 -0
  368. package/lib/typescript/commonjs/theme/useNativeBreakpoint.d.ts.map +1 -0
  369. package/lib/typescript/commonjs/theme/useNativeTokens.d.ts +4 -0
  370. package/lib/typescript/commonjs/theme/useNativeTokens.d.ts.map +1 -0
  371. package/lib/typescript/module/a11y/announcement.d.ts +26 -0
  372. package/lib/typescript/module/a11y/announcement.d.ts.map +1 -0
  373. package/lib/typescript/module/a11y/useLiveRegion.d.ts +17 -0
  374. package/lib/typescript/module/a11y/useLiveRegion.d.ts.map +1 -0
  375. package/lib/typescript/module/adapters/cssStringAdapter.d.ts +119 -0
  376. package/lib/typescript/module/adapters/cssStringAdapter.d.ts.map +1 -0
  377. package/lib/typescript/module/adapters/optionalGradient.d.ts +32 -0
  378. package/lib/typescript/module/adapters/optionalGradient.d.ts.map +1 -0
  379. package/lib/typescript/module/adapters/surfaceStyle.d.ts +75 -0
  380. package/lib/typescript/module/adapters/surfaceStyle.d.ts.map +1 -0
  381. package/lib/typescript/module/components/Alert/Alert.d.ts +14 -0
  382. package/lib/typescript/module/components/Alert/Alert.d.ts.map +1 -0
  383. package/lib/typescript/module/components/Alert/AlertActions.d.ts +13 -0
  384. package/lib/typescript/module/components/Alert/AlertActions.d.ts.map +1 -0
  385. package/lib/typescript/module/components/Alert/AlertClose.d.ts +22 -0
  386. package/lib/typescript/module/components/Alert/AlertClose.d.ts.map +1 -0
  387. package/lib/typescript/module/components/Alert/AlertText.d.ts +19 -0
  388. package/lib/typescript/module/components/Alert/AlertText.d.ts.map +1 -0
  389. package/lib/typescript/module/components/Alert/alert.tokens.d.ts +17 -0
  390. package/lib/typescript/module/components/Alert/alert.tokens.d.ts.map +1 -0
  391. package/lib/typescript/module/components/Alert/alert.types.d.ts +70 -0
  392. package/lib/typescript/module/components/Alert/alert.types.d.ts.map +1 -0
  393. package/lib/typescript/module/components/Alert/alert.utils.d.ts +58 -0
  394. package/lib/typescript/module/components/Alert/alert.utils.d.ts.map +1 -0
  395. package/lib/typescript/module/components/Alert/index.d.ts +7 -0
  396. package/lib/typescript/module/components/Alert/index.d.ts.map +1 -0
  397. package/lib/typescript/module/components/Button/Button.d.ts +22 -0
  398. package/lib/typescript/module/components/Button/Button.d.ts.map +1 -0
  399. package/lib/typescript/module/components/Button/button.types.d.ts +37 -0
  400. package/lib/typescript/module/components/Button/button.types.d.ts.map +1 -0
  401. package/lib/typescript/module/components/Button/button.utils.d.ts +98 -0
  402. package/lib/typescript/module/components/Button/button.utils.d.ts.map +1 -0
  403. package/lib/typescript/module/components/Button/index.d.ts +5 -0
  404. package/lib/typescript/module/components/Button/index.d.ts.map +1 -0
  405. package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +7 -0
  406. package/lib/typescript/module/components/Skeleton/Skeleton.d.ts.map +1 -0
  407. package/lib/typescript/module/components/Skeleton/index.d.ts +3 -0
  408. package/lib/typescript/module/components/Skeleton/index.d.ts.map +1 -0
  409. package/lib/typescript/module/components/Skeleton/skeleton.types.d.ts +25 -0
  410. package/lib/typescript/module/components/Skeleton/skeleton.types.d.ts.map +1 -0
  411. package/lib/typescript/module/components/Skeleton/skeleton.utils.d.ts +21 -0
  412. package/lib/typescript/module/components/Skeleton/skeleton.utils.d.ts.map +1 -0
  413. package/lib/typescript/module/components/Tag/Tag.d.ts +21 -0
  414. package/lib/typescript/module/components/Tag/Tag.d.ts.map +1 -0
  415. package/lib/typescript/module/components/Tag/index.d.ts +4 -0
  416. package/lib/typescript/module/components/Tag/index.d.ts.map +1 -0
  417. package/lib/typescript/module/components/Tag/tag.types.d.ts +56 -0
  418. package/lib/typescript/module/components/Tag/tag.types.d.ts.map +1 -0
  419. package/lib/typescript/module/components/Tag/tag.utils.d.ts +41 -0
  420. package/lib/typescript/module/components/Tag/tag.utils.d.ts.map +1 -0
  421. package/lib/typescript/module/components/TextInput/TextInput.d.ts +33 -0
  422. package/lib/typescript/module/components/TextInput/TextInput.d.ts.map +1 -0
  423. package/lib/typescript/module/components/TextInput/index.d.ts +3 -0
  424. package/lib/typescript/module/components/TextInput/index.d.ts.map +1 -0
  425. package/lib/typescript/module/components/TextInput/textInput.types.d.ts +45 -0
  426. package/lib/typescript/module/components/TextInput/textInput.types.d.ts.map +1 -0
  427. package/lib/typescript/module/components/TextInput/textInput.utils.d.ts +35 -0
  428. package/lib/typescript/module/components/TextInput/textInput.utils.d.ts.map +1 -0
  429. package/lib/typescript/module/components/shared/field/FieldFooter.d.ts +22 -0
  430. package/lib/typescript/module/components/shared/field/FieldFooter.d.ts.map +1 -0
  431. package/lib/typescript/module/components/shared/field/FieldLabels.d.ts +27 -0
  432. package/lib/typescript/module/components/shared/field/FieldLabels.d.ts.map +1 -0
  433. package/lib/typescript/module/components/shared/field/fieldState.d.ts +23 -0
  434. package/lib/typescript/module/components/shared/field/fieldState.d.ts.map +1 -0
  435. package/lib/typescript/module/components/shared/group.d.ts +50 -0
  436. package/lib/typescript/module/components/shared/group.d.ts.map +1 -0
  437. package/lib/typescript/module/index.d.ts +74 -0
  438. package/lib/typescript/module/index.d.ts.map +1 -0
  439. package/lib/typescript/module/motion/motion.d.ts +121 -0
  440. package/lib/typescript/module/motion/motion.d.ts.map +1 -0
  441. package/lib/typescript/module/motion/useReduceMotion.d.ts +14 -0
  442. package/lib/typescript/module/motion/useReduceMotion.d.ts.map +1 -0
  443. package/lib/typescript/module/overlay/portal.d.ts +20 -0
  444. package/lib/typescript/module/overlay/portal.d.ts.map +1 -0
  445. package/lib/typescript/module/overlay/positioning.d.ts +65 -0
  446. package/lib/typescript/module/overlay/positioning.d.ts.map +1 -0
  447. package/lib/typescript/module/overlay/safeAreaInsets.d.ts +19 -0
  448. package/lib/typescript/module/overlay/safeAreaInsets.d.ts.map +1 -0
  449. package/lib/typescript/module/overlay/sheet/BottomSheet.d.ts +56 -0
  450. package/lib/typescript/module/overlay/sheet/BottomSheet.d.ts.map +1 -0
  451. package/lib/typescript/module/overlay/sheet/sheetMath.d.ts +32 -0
  452. package/lib/typescript/module/overlay/sheet/sheetMath.d.ts.map +1 -0
  453. package/lib/typescript/module/overlay/toast/ToastOutlet.d.ts +17 -0
  454. package/lib/typescript/module/overlay/toast/ToastOutlet.d.ts.map +1 -0
  455. package/lib/typescript/module/overlay/toast/toastStore.d.ts +45 -0
  456. package/lib/typescript/module/overlay/toast/toastStore.d.ts.map +1 -0
  457. package/lib/typescript/module/overlay/useAnchoredPosition.d.ts +40 -0
  458. package/lib/typescript/module/overlay/useAnchoredPosition.d.ts.map +1 -0
  459. package/lib/typescript/module/package.json +1 -0
  460. package/lib/typescript/module/primitives/Block.d.ts +37 -0
  461. package/lib/typescript/module/primitives/Block.d.ts.map +1 -0
  462. package/lib/typescript/module/primitives/Pressable.d.ts +135 -0
  463. package/lib/typescript/module/primitives/Pressable.d.ts.map +1 -0
  464. package/lib/typescript/module/primitives/PrimitiveInput.d.ts +42 -0
  465. package/lib/typescript/module/primitives/PrimitiveInput.d.ts.map +1 -0
  466. package/lib/typescript/module/primitives/Separator.d.ts +28 -0
  467. package/lib/typescript/module/primitives/Separator.d.ts.map +1 -0
  468. package/lib/typescript/module/primitives/Slot.d.ts +48 -0
  469. package/lib/typescript/module/primitives/Slot.d.ts.map +1 -0
  470. package/lib/typescript/module/primitives/Text.d.ts +50 -0
  471. package/lib/typescript/module/primitives/Text.d.ts.map +1 -0
  472. package/lib/typescript/module/primitives/pressFeedback.d.ts +39 -0
  473. package/lib/typescript/module/primitives/pressFeedback.d.ts.map +1 -0
  474. package/lib/typescript/module/primitives/textStyle.d.ts +13 -0
  475. package/lib/typescript/module/primitives/textStyle.d.ts.map +1 -0
  476. package/lib/typescript/module/primitives/tintSlot.d.ts +10 -0
  477. package/lib/typescript/module/primitives/tintSlot.d.ts.map +1 -0
  478. package/lib/typescript/module/primitives/touchTarget.d.ts +43 -0
  479. package/lib/typescript/module/primitives/touchTarget.d.ts.map +1 -0
  480. package/lib/typescript/module/theme/BlendNativeProvider.d.ts +69 -0
  481. package/lib/typescript/module/theme/BlendNativeProvider.d.ts.map +1 -0
  482. package/lib/typescript/module/theme/breakpoint.d.ts +27 -0
  483. package/lib/typescript/module/theme/breakpoint.d.ts.map +1 -0
  484. package/lib/typescript/module/theme/fonts.d.ts +34 -0
  485. package/lib/typescript/module/theme/fonts.d.ts.map +1 -0
  486. package/lib/typescript/module/theme/nativeTokenRegistry.d.ts +34 -0
  487. package/lib/typescript/module/theme/nativeTokenRegistry.d.ts.map +1 -0
  488. package/lib/typescript/module/theme/systemTheme.d.ts +25 -0
  489. package/lib/typescript/module/theme/systemTheme.d.ts.map +1 -0
  490. package/lib/typescript/module/theme/useNativeBreakpoint.d.ts +17 -0
  491. package/lib/typescript/module/theme/useNativeBreakpoint.d.ts.map +1 -0
  492. package/lib/typescript/module/theme/useNativeTokens.d.ts +4 -0
  493. package/lib/typescript/module/theme/useNativeTokens.d.ts.map +1 -0
  494. package/package.json +137 -0
  495. package/src/a11y/announcement.ts +41 -0
  496. package/src/a11y/useLiveRegion.ts +36 -0
  497. package/src/adapters/cssStringAdapter.ts +403 -0
  498. package/src/adapters/optionalGradient.ts +39 -0
  499. package/src/adapters/surfaceStyle.ts +209 -0
  500. package/src/components/Alert/Alert.tsx +167 -0
  501. package/src/components/Alert/AlertActions.tsx +98 -0
  502. package/src/components/Alert/AlertClose.tsx +53 -0
  503. package/src/components/Alert/AlertText.tsx +58 -0
  504. package/src/components/Alert/alert.tokens.ts +24 -0
  505. package/src/components/Alert/alert.types.ts +81 -0
  506. package/src/components/Alert/alert.utils.ts +94 -0
  507. package/src/components/Alert/index.ts +21 -0
  508. package/src/components/Button/Button.tsx +180 -0
  509. package/src/components/Button/button.types.ts +44 -0
  510. package/src/components/Button/button.utils.ts +213 -0
  511. package/src/components/Button/index.ts +12 -0
  512. package/src/components/Skeleton/Skeleton.tsx +196 -0
  513. package/src/components/Skeleton/index.ts +2 -0
  514. package/src/components/Skeleton/skeleton.types.ts +28 -0
  515. package/src/components/Skeleton/skeleton.utils.ts +56 -0
  516. package/src/components/Tag/Tag.tsx +204 -0
  517. package/src/components/Tag/index.ts +7 -0
  518. package/src/components/Tag/tag.types.ts +63 -0
  519. package/src/components/Tag/tag.utils.ts +82 -0
  520. package/src/components/TextInput/TextInput.tsx +165 -0
  521. package/src/components/TextInput/index.ts +2 -0
  522. package/src/components/TextInput/textInput.types.ts +54 -0
  523. package/src/components/TextInput/textInput.utils.ts +68 -0
  524. package/src/components/shared/field/FieldFooter.tsx +66 -0
  525. package/src/components/shared/field/FieldLabels.tsx +86 -0
  526. package/src/components/shared/field/fieldState.ts +39 -0
  527. package/src/components/shared/group.ts +72 -0
  528. package/src/index.ts +144 -0
  529. package/src/motion/motion.ts +115 -0
  530. package/src/motion/useReduceMotion.ts +36 -0
  531. package/src/overlay/portal.tsx +122 -0
  532. package/src/overlay/positioning.ts +196 -0
  533. package/src/overlay/safeAreaInsets.ts +36 -0
  534. package/src/overlay/sheet/BottomSheet.tsx +276 -0
  535. package/src/overlay/sheet/sheetMath.ts +58 -0
  536. package/src/overlay/toast/ToastOutlet.tsx +127 -0
  537. package/src/overlay/toast/toastStore.ts +96 -0
  538. package/src/overlay/useAnchoredPosition.ts +92 -0
  539. package/src/primitives/Block.tsx +129 -0
  540. package/src/primitives/Pressable.tsx +528 -0
  541. package/src/primitives/PrimitiveInput.tsx +87 -0
  542. package/src/primitives/Separator.tsx +65 -0
  543. package/src/primitives/Slot.tsx +94 -0
  544. package/src/primitives/Text.tsx +98 -0
  545. package/src/primitives/pressFeedback.ts +78 -0
  546. package/src/primitives/textStyle.ts +24 -0
  547. package/src/primitives/tintSlot.ts +44 -0
  548. package/src/primitives/touchTarget.ts +72 -0
  549. package/src/theme/BlendNativeProvider.tsx +147 -0
  550. package/src/theme/breakpoint.ts +38 -0
  551. package/src/theme/fonts.ts +63 -0
  552. package/src/theme/nativeTokenRegistry.ts +57 -0
  553. package/src/theme/systemTheme.ts +34 -0
  554. package/src/theme/useNativeBreakpoint.ts +27 -0
  555. package/src/theme/useNativeTokens.ts +99 -0
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+
3
+ import React, { useCallback, useContext, useEffect, useState } from 'react';
4
+ import { BackHandler, Pressable, StyleSheet, useWindowDimensions, View } from 'react-native';
5
+ import Animated, { Easing, runOnJS, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
6
+ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
7
+ import { Portal } from "../portal.js";
8
+ import { SafeAreaInsetsContext } from "../safeAreaInsets.js";
9
+ import { MOTION_DURATION, MOTION_EASING } from "../../motion/motion.js";
10
+ import { useReduceMotion } from "../../motion/useReduceMotion.js";
11
+ import { clampSheetDrag, resolveSheetMaxHeight, shouldDismissSheet, SHEET_MAX_HEIGHT_FRACTION } from "./sheetMath.js";
12
+
13
+ /**
14
+ * BottomSheet — the gesture-driven sheet foundation.
15
+ *
16
+ * The native replacement for `vaul` and the phone presentation web already
17
+ * prescribes in its Mobile* variants (mobileModalV2, MobileSingleSelectV2,
18
+ * MobilePopoverV2): DrawerV2 and the phone modes of Select/Menu/Modal
19
+ * compose this primitive and pass their token values in — the sheet itself
20
+ * carries structure and physics, not design decisions, which is why its
21
+ * colour props have plain defaults instead of token lookups.
22
+ *
23
+ * Controlled: `open` drives it; every dismiss route (drag, backdrop, the
24
+ * Android back button) calls `onClose` and the owner flips `open` — the
25
+ * exit animation runs, then the sheet unmounts from the portal layer.
26
+ *
27
+ * Requirements: `react-native-reanimated` and `react-native-gesture-handler`
28
+ * (required peers), and a `GestureHandlerRootView` at the app root — apps
29
+ * using react-navigation already have one. `react-native-safe-area-context`
30
+ * is optional: with it (and its provider) mounted, the sheet pads itself
31
+ * past the home indicator; without it the bottom inset is 0.
32
+ *
33
+ * Reduce-motion: the slide collapses to a fade (`useReduceMotion`).
34
+ */
35
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
36
+ const ENTER = {
37
+ duration: MOTION_DURATION.slow,
38
+ easing: Easing.bezier(...MOTION_EASING.decelerate)
39
+ };
40
+ const EXIT = {
41
+ duration: MOTION_DURATION.normal,
42
+ easing: Easing.bezier(...MOTION_EASING.accelerate)
43
+ };
44
+ export function BottomSheet({
45
+ open,
46
+ onClose,
47
+ children,
48
+ maxHeightFraction = SHEET_MAX_HEIGHT_FRACTION,
49
+ backdropColor = 'rgba(0, 0, 0, 0.5)',
50
+ backgroundColor = '#FFFFFF',
51
+ topRadius = 16,
52
+ showHandle = true,
53
+ handleColor = 'rgba(0, 0, 0, 0.2)',
54
+ dragToDismiss = true,
55
+ dismissOnBackdropPress = true,
56
+ accessibilityLabel,
57
+ testID,
58
+ style
59
+ }) {
60
+ // Mounted outlives `open` by one exit animation.
61
+ const [mounted, setMounted] = useState(open);
62
+ const progress = useSharedValue(0);
63
+ const dragY = useSharedValue(0);
64
+ const sheetHeight = useSharedValue(0);
65
+ const window = useWindowDimensions();
66
+ const insets = useContext(SafeAreaInsetsContext);
67
+ const reduceMotion = useReduceMotion();
68
+ const unmount = useCallback(() => setMounted(false), []);
69
+ useEffect(() => {
70
+ if (open) {
71
+ setMounted(true);
72
+ progress.value = withTiming(1, ENTER);
73
+ } else {
74
+ // Drag offset folds into the exit so a gesture-dismissed sheet
75
+ // continues downward from wherever the finger left it.
76
+ dragY.value = withTiming(0, EXIT);
77
+ progress.value = withTiming(0, EXIT, finished => {
78
+ if (finished) runOnJS(unmount)();
79
+ });
80
+ }
81
+ }, [open, progress, dragY, unmount]);
82
+
83
+ // Android hardware back closes the sheet instead of the screen.
84
+ useEffect(() => {
85
+ if (!open) return;
86
+ const subscription = BackHandler.addEventListener('hardwareBackPress', () => {
87
+ onClose();
88
+ return true;
89
+ });
90
+ return () => subscription.remove();
91
+ }, [open, onClose]);
92
+ const onSheetLayout = useCallback(event => {
93
+ sheetHeight.value = event.nativeEvent.layout.height;
94
+ }, [sheetHeight]);
95
+ const pan = Gesture.Pan().enabled(dragToDismiss).onChange(event => {
96
+ dragY.value = clampSheetDrag(event.translationY);
97
+ }).onEnd(event => {
98
+ if (shouldDismissSheet(event.translationY, event.velocityY, sheetHeight.value)) {
99
+ runOnJS(onClose)();
100
+ } else {
101
+ dragY.value = withSpring(0, {
102
+ damping: 22,
103
+ stiffness: 320
104
+ });
105
+ }
106
+ });
107
+ const windowHeight = window.height;
108
+ const sheetStyle = useAnimatedStyle(() => {
109
+ if (reduceMotion) {
110
+ return {
111
+ opacity: progress.value,
112
+ transform: [{
113
+ translateY: dragY.value
114
+ }]
115
+ };
116
+ }
117
+ // Until the first layout lands, the full window height keeps the
118
+ // sheet parked off-screen instead of flashing in place.
119
+ const height = sheetHeight.value || windowHeight;
120
+ return {
121
+ opacity: 1,
122
+ transform: [{
123
+ translateY: (1 - progress.value) * height + dragY.value
124
+ }]
125
+ };
126
+ }, [reduceMotion, windowHeight]);
127
+ const backdropStyle = useAnimatedStyle(() => ({
128
+ opacity: progress.value
129
+ }));
130
+ if (!mounted) return null;
131
+ const maxHeight = resolveSheetMaxHeight(windowHeight, insets?.top ?? 0, maxHeightFraction);
132
+ return /*#__PURE__*/_jsxs(Portal, {
133
+ children: [/*#__PURE__*/_jsx(Animated.View, {
134
+ style: [StyleSheet.absoluteFill, {
135
+ backgroundColor: backdropColor
136
+ }, backdropStyle],
137
+ testID: testID ? `${testID}-backdrop` : undefined
138
+ // The sheet is the modal surface; VoiceOver skips the
139
+ // backdrop (it could not reach it past
140
+ // accessibilityViewIsModal anyway).
141
+ ,
142
+ accessible: false,
143
+ importantForAccessibility: "no-hide-descendants",
144
+ children: /*#__PURE__*/_jsx(Pressable, {
145
+ style: StyleSheet.absoluteFill,
146
+ onPress: dismissOnBackdropPress ? onClose : undefined
147
+ })
148
+ }), /*#__PURE__*/_jsx(GestureDetector, {
149
+ gesture: pan,
150
+ children: /*#__PURE__*/_jsxs(Animated.View, {
151
+ onLayout: onSheetLayout,
152
+ accessibilityViewIsModal: true,
153
+ accessibilityLabel: accessibilityLabel,
154
+ testID: testID,
155
+ style: [styles.sheet, {
156
+ maxHeight,
157
+ backgroundColor,
158
+ borderTopLeftRadius: topRadius,
159
+ borderTopRightRadius: topRadius,
160
+ paddingBottom: insets?.bottom ?? 0
161
+ }, sheetStyle, style],
162
+ children: [showHandle ? /*#__PURE__*/_jsx(View, {
163
+ style: [styles.handle, {
164
+ backgroundColor: handleColor
165
+ }]
166
+ }) : null, children]
167
+ })
168
+ })]
169
+ });
170
+ }
171
+ BottomSheet.displayName = 'BottomSheet';
172
+ const styles = StyleSheet.create({
173
+ sheet: {
174
+ position: 'absolute',
175
+ left: 0,
176
+ right: 0,
177
+ bottom: 0,
178
+ overflow: 'hidden'
179
+ },
180
+ handle: {
181
+ alignSelf: 'center',
182
+ width: 36,
183
+ height: 4,
184
+ borderRadius: 2,
185
+ marginTop: 8,
186
+ marginBottom: 4
187
+ }
188
+ });
189
+ export default BottomSheet;
190
+ //# sourceMappingURL=BottomSheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useContext","useEffect","useState","BackHandler","Pressable","StyleSheet","useWindowDimensions","View","Animated","Easing","runOnJS","useAnimatedStyle","useSharedValue","withSpring","withTiming","Gesture","GestureDetector","Portal","SafeAreaInsetsContext","MOTION_DURATION","MOTION_EASING","useReduceMotion","clampSheetDrag","resolveSheetMaxHeight","shouldDismissSheet","SHEET_MAX_HEIGHT_FRACTION","jsx","_jsx","jsxs","_jsxs","ENTER","duration","slow","easing","bezier","decelerate","EXIT","normal","accelerate","BottomSheet","open","onClose","children","maxHeightFraction","backdropColor","backgroundColor","topRadius","showHandle","handleColor","dragToDismiss","dismissOnBackdropPress","accessibilityLabel","testID","style","mounted","setMounted","progress","dragY","sheetHeight","window","insets","reduceMotion","unmount","value","finished","subscription","addEventListener","remove","onSheetLayout","event","nativeEvent","layout","height","pan","Pan","enabled","onChange","translationY","onEnd","velocityY","damping","stiffness","windowHeight","sheetStyle","opacity","transform","translateY","backdropStyle","maxHeight","top","absoluteFill","undefined","accessible","importantForAccessibility","onPress","gesture","onLayout","accessibilityViewIsModal","styles","sheet","borderTopLeftRadius","borderTopRightRadius","paddingBottom","bottom","handle","displayName","create","position","left","right","overflow","alignSelf","width","borderRadius","marginTop","marginBottom"],"sourceRoot":"../../../../src","sources":["overlay/sheet/BottomSheet.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,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AK,EAAE,CACH6C,MAAM,CAACC,KAAK,EACZ;UACIX,SAAS;UACT3C,eAAe;UACfuD,mBAAmB,EAAEtD,SAAS;UAC9BuD,oBAAoB,EAAEvD,SAAS;UAC/BwD,aAAa,EAAE1C,MAAM,EAAE2C,MAAM,IAAI;QACrC,CAAC,EACDpB,UAAU,EACV9B,KAAK,CACP;QAAAX,QAAA,GAEDK,UAAU,gBACPpB,IAAA,CAACpB,IAAI;UACD8C,KAAK,EAAE,CACH6C,MAAM,CAACM,MAAM,EACb;YAAE3D,eAAe,EAAEG;UAAY,CAAC;QAClC,CACL,CAAC,GACF,IAAI,EACPN,QAAQ;MAAA,CACE;IAAC,CACH,CAAC;EAAA,CACd,CAAC;AAEjB;AAEAH,WAAW,CAACkE,WAAW,GAAG,aAAa;AAEvC,MAAMP,MAAM,GAAG7F,UAAU,CAACqG,MAAM,CAAC;EAC7BP,KAAK,EAAE;IACHQ,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRN,MAAM,EAAE,CAAC;IACTO,QAAQ,EAAE;EACd,CAAC;EACDN,MAAM,EAAE;IACJO,SAAS,EAAE,QAAQ;IACnBC,KAAK,EAAE,EAAE;IACTxC,MAAM,EAAE,CAAC;IACTyC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE,CAAC;IACZC,YAAY,EAAE;EAClB;AACJ,CAAC,CAAC;AAEF,eAAe5E,WAAW","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Bottom-sheet gesture arithmetic.
5
+ *
6
+ * Pure and RN-free (the `theme/breakpoint.ts` pattern) so the dismiss
7
+ * decision — the part of a sheet that feels wrong when it is wrong — is
8
+ * unit-testable under vitest. `BottomSheet` wires these into the pan
9
+ * gesture; they also run as Reanimated worklets, so nothing here may close
10
+ * over module state.
11
+ */
12
+
13
+ /** Dragging past this fraction of the sheet's height dismisses on release. */
14
+ export const SHEET_DISMISS_FRACTION = 0.25;
15
+
16
+ /** A downward fling at or above this velocity (pt/s) dismisses regardless. */
17
+ export const SHEET_DISMISS_VELOCITY = 800;
18
+
19
+ /** Default cap: a sheet covers at most this fraction of the window. */
20
+ export const SHEET_MAX_HEIGHT_FRACTION = 0.9;
21
+
22
+ /**
23
+ * The sheet follows the finger downward only — upward drag is pinned so the
24
+ * sheet feels anchored rather than lifting off its resting position.
25
+ */
26
+ export function clampSheetDrag(translationY) {
27
+ 'worklet';
28
+
29
+ return Math.max(0, translationY);
30
+ }
31
+
32
+ /**
33
+ * Whether a released drag should dismiss the sheet: past the distance
34
+ * threshold, or a genuine downward fling. An upward fling never dismisses,
35
+ * whatever distance was covered first.
36
+ */
37
+ export function shouldDismissSheet(translationY, velocityY, sheetHeight) {
38
+ 'worklet';
39
+
40
+ if (velocityY <= -SHEET_DISMISS_VELOCITY) return false;
41
+ if (velocityY >= SHEET_DISMISS_VELOCITY) return translationY > 0;
42
+ return sheetHeight > 0 && translationY >= sheetHeight * SHEET_DISMISS_FRACTION;
43
+ }
44
+
45
+ /**
46
+ * The tallest a sheet may grow: the capped fraction of the window, minus
47
+ * whatever top inset (status bar / notch) must stay visible above it.
48
+ */
49
+ export function resolveSheetMaxHeight(windowHeight, topInset = 0, maxHeightFraction = SHEET_MAX_HEIGHT_FRACTION) {
50
+ const capped = windowHeight * maxHeightFraction;
51
+ return Math.max(0, Math.min(capped, windowHeight - topInset));
52
+ }
53
+ //# sourceMappingURL=sheetMath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SHEET_DISMISS_FRACTION","SHEET_DISMISS_VELOCITY","SHEET_MAX_HEIGHT_FRACTION","clampSheetDrag","translationY","Math","max","shouldDismissSheet","velocityY","sheetHeight","resolveSheetMaxHeight","windowHeight","topInset","maxHeightFraction","capped","min"],"sourceRoot":"../../../../src","sources":["overlay/sheet/sheetMath.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,MAAMA,sBAAsB,GAAG,IAAI;;AAE1C;AACA,OAAO,MAAMC,sBAAsB,GAAG,GAAG;;AAEzC;AACA,OAAO,MAAMC,yBAAyB,GAAG,GAAG;;AAE5C;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,YAAoB,EAAU;EACzD,SAAS;;EACT,OAAOC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEF,YAAY,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,kBAAkBA,CAC9BH,YAAoB,EACpBI,SAAiB,EACjBC,WAAmB,EACZ;EACP,SAAS;;EACT,IAAID,SAAS,IAAI,CAACP,sBAAsB,EAAE,OAAO,KAAK;EACtD,IAAIO,SAAS,IAAIP,sBAAsB,EAAE,OAAOG,YAAY,GAAG,CAAC;EAChE,OACIK,WAAW,GAAG,CAAC,IAAIL,YAAY,IAAIK,WAAW,GAAGT,sBAAsB;AAE/E;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASU,qBAAqBA,CACjCC,YAAoB,EACpBC,QAAgB,GAAG,CAAC,EACpBC,iBAAyB,GAAGX,yBAAyB,EAC/C;EACN,MAAMY,MAAM,GAAGH,YAAY,GAAGE,iBAAiB;EAC/C,OAAOR,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACU,GAAG,CAACD,MAAM,EAAEH,YAAY,GAAGC,QAAQ,CAAC,CAAC;AACjE","ignoreList":[]}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useContext, useEffect, useSyncExternalStore } from 'react';
4
+ import { StyleSheet, View } from 'react-native';
5
+ import Animated, { Easing, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
6
+ import { Portal } from "../portal.js";
7
+ import { SafeAreaInsetsContext } from "../safeAreaInsets.js";
8
+ import { MOTION_DURATION, MOTION_EASING, MOTION_PRESETS } from "../../motion/motion.js";
9
+ import { useReduceMotion } from "../../motion/useReduceMotion.js";
10
+ import { useLiveRegionAnnounce } from "../../a11y/useLiveRegion.js";
11
+ import { dismissToast, getToasts, getVisibleToasts, subscribeToasts } from "./toastStore.js";
12
+
13
+ /**
14
+ * The toast rendering surface, mounted once by `BlendNativeProvider`.
15
+ *
16
+ * Subscribes to the store and renders the newest `MAX_VISIBLE_TOASTS`
17
+ * bottom-stacked above everything through a `Portal`. Each toast slides up
18
+ * on entry (a fade under reduce-motion), owns its auto-dismiss timer, and
19
+ * announces itself to assistive tech when asked.
20
+ */
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ export function ToastOutlet() {
23
+ const toasts = useSyncExternalStore(subscribeToasts, getToasts, getToasts);
24
+ const insets = useContext(SafeAreaInsetsContext);
25
+ const visible = getVisibleToasts(toasts);
26
+ if (visible.length === 0) return null;
27
+ return /*#__PURE__*/_jsx(Portal, {
28
+ children: /*#__PURE__*/_jsx(View, {
29
+ style: [styles.stack, {
30
+ paddingBottom: (insets?.bottom ?? 0) + 16
31
+ }],
32
+ pointerEvents: "box-none",
33
+ testID: "blend-toast-outlet",
34
+ children: visible.map(toast => /*#__PURE__*/_jsx(ToastItem, {
35
+ toast: toast
36
+ }, toast.id))
37
+ })
38
+ });
39
+ }
40
+ ToastOutlet.displayName = 'ToastOutlet';
41
+ function ToastItem({
42
+ toast
43
+ }) {
44
+ const reduceMotion = useReduceMotion();
45
+ const progress = useSharedValue(0);
46
+ const dismiss = useCallback(() => dismissToast(toast.id), [toast.id]);
47
+
48
+ // Enter animation once per toast id.
49
+ useEffect(() => {
50
+ progress.value = withTiming(1, {
51
+ duration: MOTION_PRESETS.slideUp.duration,
52
+ easing: Easing.bezier(...MOTION_EASING.decelerate)
53
+ });
54
+ }, [progress]);
55
+
56
+ // Auto-dismiss owns its timer; content replacement (same id) restarts it.
57
+ useEffect(() => {
58
+ if (toast.duration === null) return;
59
+ const timer = setTimeout(dismiss, toast.duration);
60
+ return () => clearTimeout(timer);
61
+ }, [toast.id, toast.duration, toast.content, dismiss]);
62
+ useLiveRegionAnnounce(toast.announcement, Boolean(toast.announcement));
63
+ const animatedStyle = useAnimatedStyle(() => {
64
+ if (reduceMotion) {
65
+ return {
66
+ opacity: progress.value,
67
+ transform: [{
68
+ translateY: 0
69
+ }]
70
+ };
71
+ }
72
+ return {
73
+ opacity: progress.value,
74
+ transform: [{
75
+ translateY: (1 - progress.value) * (MOTION_PRESETS.slideUp.from.translateY ?? 16)
76
+ }]
77
+ };
78
+ }, [reduceMotion]);
79
+ return /*#__PURE__*/_jsx(Animated.View, {
80
+ style: animatedStyle,
81
+ accessibilityLiveRegion: toast.announcement ? 'polite' : 'none',
82
+ children: typeof toast.content === 'function' ? toast.content(dismiss) : toast.content
83
+ });
84
+ }
85
+
86
+ /** Exit duration is not modelled yet — dismissal unmounts immediately;
87
+ * SnackbarV2 will own richer exit choreography when it lands. Kept simple
88
+ * so the host stays predictable under the synchronous test mock. */
89
+ export const TOAST_EXIT_DURATION = MOTION_DURATION.fast;
90
+ const styles = StyleSheet.create({
91
+ stack: {
92
+ position: 'absolute',
93
+ left: 0,
94
+ right: 0,
95
+ bottom: 0,
96
+ alignItems: 'center',
97
+ gap: 8,
98
+ paddingHorizontal: 16
99
+ }
100
+ });
101
+ //# sourceMappingURL=ToastOutlet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useContext","useEffect","useSyncExternalStore","StyleSheet","View","Animated","Easing","useAnimatedStyle","useSharedValue","withTiming","Portal","SafeAreaInsetsContext","MOTION_DURATION","MOTION_EASING","MOTION_PRESETS","useReduceMotion","useLiveRegionAnnounce","dismissToast","getToasts","getVisibleToasts","subscribeToasts","jsx","_jsx","ToastOutlet","toasts","insets","visible","length","children","style","styles","stack","paddingBottom","bottom","pointerEvents","testID","map","toast","ToastItem","id","displayName","reduceMotion","progress","dismiss","value","duration","slideUp","easing","bezier","decelerate","timer","setTimeout","clearTimeout","content","announcement","Boolean","animatedStyle","opacity","transform","translateY","from","accessibilityLiveRegion","TOAST_EXIT_DURATION","fast","create","position","left","right","alignItems","gap","paddingHorizontal"],"sourceRoot":"../../../../src","sources":["overlay/toast/ToastOutlet.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,oBAAoB,QAAQ,OAAO;AAChF,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,OAAOC,QAAQ,IACXC,MAAM,EACNC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACP,yBAAyB;AAChC,SAASC,MAAM,QAAQ,cAAW;AAClC,SAASC,qBAAqB,QAAQ,sBAAmB;AACzD,SACIC,eAAe,EACfC,aAAa,EACbC,cAAc,QACX,wBAAqB;AAC5B,SAASC,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SACIC,YAAY,EACZC,SAAS,EACTC,gBAAgB,EAChBC,eAAe,QAEZ,iBAAc;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,OAAO,SAASC,WAAWA,CAAA,EAAG;EAC1B,MAAMC,MAAM,GAAGtB,oBAAoB,CAACkB,eAAe,EAAEF,SAAS,EAAEA,SAAS,CAAC;EAC1E,MAAMO,MAAM,GAAGzB,UAAU,CAACW,qBAAqB,CAAC;EAEhD,MAAMe,OAAO,GAAGP,gBAAgB,CAACK,MAAM,CAAC;EACxC,IAAIE,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAErC,oBACIL,IAAA,CAACZ,MAAM;IAAAkB,QAAA,eACHN,IAAA,CAAClB,IAAI;MACDyB,KAAK,EAAE,CACHC,MAAM,CAACC,KAAK,EACZ;QAAEC,aAAa,EAAE,CAACP,MAAM,EAAEQ,MAAM,IAAI,CAAC,IAAI;MAAG,CAAC,CAC/C;MACFC,aAAa,EAAC,UAAU;MACxBC,MAAM,EAAC,oBAAoB;MAAAP,QAAA,EAE1BF,OAAO,CAACU,GAAG,CAAEC,KAAK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OAAO;QAAEgB,OAAO,EAAEf,QAAQ,CAACE,KAAK;QAAEc,SAAS,EAAE,CAAC;UAAEC,UAAU,EAAE;QAAE,CAAC;MAAE,CAAC;IACtE;IACA,OAAO;MACHF,OAAO,EAAEf,QAAQ,CAACE,KAAK;MACvBc,SAAS,EAAE,CACP;QACIC,UAAU,EACN,CAAC,CAAC,GAAGjB,QAAQ,CAACE,KAAK,KAClB9B,cAAc,CAACgC,OAAO,CAACc,IAAI,CAACD,UAAU,IAAI,EAAE;MACrD,CAAC;IAET,CAAC;EACL,CAAC,EAAE,CAAClB,YAAY,CAAC,CAAC;EAElB,oBACInB,IAAA,CAACjB,QAAQ,CAACD,IAAI;IACVyB,KAAK,EAAE2B,aAAc;IACrBK,uBAAuB,EAAExB,KAAK,CAACiB,YAAY,GAAG,QAAQ,GAAG,MAAO;IAAA1B,QAAA,EAE/D,OAAOS,KAAK,CAACgB,OAAO,KAAK,UAAU,GAC9BhB,KAAK,CAACgB,OAAO,CAACV,OAAO,CAAC,GACtBN,KAAK,CAACgB;EAAO,CACR,CAAC;AAExB;;AAEA;AACA;AACA;AACA,OAAO,MAAMS,mBAAmB,GAAGlD,eAAe,CAACmD,IAAI;AAEvD,MAAMjC,MAAM,GAAG3B,UAAU,CAAC6D,MAAM,CAAC;EAC7BjC,KAAK,EAAE;IACHkC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRlC,MAAM,EAAE,CAAC;IACTmC,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAE,CAAC;IACNC,iBAAiB,EAAE;EACvB;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Toast queue — the sonner role, minus the styling.
5
+ *
6
+ * A module-level store with an imperative `showToast`/`dismissToast` API,
7
+ * so any code (not just components) can raise a toast; the outlet the
8
+ * provider mounts subscribes and renders. SnackbarV2 will layer its token
9
+ * styling on top of this host; the host itself owns only queueing,
10
+ * stacking, timing, and announcements.
11
+ *
12
+ * RN-free (a `React.ReactNode` type is the only React surface) so queue
13
+ * semantics unit-test under vitest.
14
+ */
15
+
16
+ /** How many toasts render at once; older ones wait in the queue. */
17
+ export const MAX_VISIBLE_TOASTS = 3;
18
+
19
+ /** Default auto-dismiss delay, matching sonner's. */
20
+ export const DEFAULT_TOAST_DURATION = 4000;
21
+ let toasts = [];
22
+ const listeners = new Set();
23
+ let counter = 0;
24
+ function emit() {
25
+ for (const listener of listeners) listener(toasts);
26
+ }
27
+
28
+ /** Raise a toast; returns its id. */
29
+ export function showToast(options) {
30
+ const id = options.id ?? `blend-toast-${++counter}`;
31
+ const entry = {
32
+ id,
33
+ content: options.content,
34
+ duration: options.duration === null ? null : options.duration ?? DEFAULT_TOAST_DURATION,
35
+ announcement: options.announcement
36
+ };
37
+ const existing = toasts.findIndex(t => t.id === id);
38
+ toasts = existing === -1 ? [...toasts, entry] : toasts.map((t, i) => i === existing ? entry : t);
39
+ emit();
40
+ return id;
41
+ }
42
+
43
+ /** Dismiss one toast, or every toast when no id is given. */
44
+ export function dismissToast(id) {
45
+ toasts = id === undefined ? [] : toasts.filter(t => t.id !== id);
46
+ emit();
47
+ }
48
+ export function getToasts() {
49
+ return toasts;
50
+ }
51
+
52
+ /** The slice the outlet renders: the newest MAX_VISIBLE. */
53
+ export function getVisibleToasts(all = toasts) {
54
+ return all.slice(-MAX_VISIBLE_TOASTS);
55
+ }
56
+ export function subscribeToasts(listener) {
57
+ listeners.add(listener);
58
+ return () => listeners.delete(listener);
59
+ }
60
+
61
+ /** Test hook — clears the queue without notifying. */
62
+ export function resetToasts() {
63
+ toasts = [];
64
+ counter = 0;
65
+ }
66
+ //# sourceMappingURL=toastStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MAX_VISIBLE_TOASTS","DEFAULT_TOAST_DURATION","toasts","listeners","Set","counter","emit","listener","showToast","options","id","entry","content","duration","announcement","existing","findIndex","t","map","i","dismissToast","undefined","filter","getToasts","getVisibleToasts","all","slice","subscribeToasts","add","delete","resetToasts"],"sourceRoot":"../../../../src","sources":["overlay/toast/toastStore.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA,OAAO,MAAMA,kBAAkB,GAAG,CAAC;;AAEnC;AACA,OAAO,MAAMC,sBAAsB,GAAG,IAAI;AAI1C,IAAIC,MAAoB,GAAG,EAAE;AAC7B,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAW,CAAC;AACrC,IAAIC,OAAO,GAAG,CAAC;AAEf,SAASC,IAAIA,CAAA,EAAG;EACZ,KAAK,MAAMC,QAAQ,IAAIJ,SAAS,EAAEI,QAAQ,CAACL,MAAM,CAAC;AACtD;;AAEA;AACA,OAAO,SAASM,SAASA,CAACC,OAAqB,EAAU;EACrD,MAAMC,EAAE,GAAGD,OAAO,CAACC,EAAE,IAAI,eAAe,EAAEL,OAAO,EAAE;EACnD,MAAMM,KAAiB,GAAG;IACtBD,EAAE;IACFE,OAAO,EAAEH,OAAO,CAACG,OAAO;IACxBC,QAAQ,EACJJ,OAAO,CAACI,QAAQ,KAAK,IAAI,GACnB,IAAI,GACHJ,OAAO,CAACI,QAAQ,IAAIZ,sBAAuB;IACtDa,YAAY,EAAEL,OAAO,CAACK;EAC1B,CAAC;EACD,MAAMC,QAAQ,GAAGb,MAAM,CAACc,SAAS,CAAEC,CAAC,IAAKA,CAAC,CAACP,EAAE,KAAKA,EAAE,CAAC;EACrDR,MAAM,GACFa,QAAQ,KAAK,CAAC,CAAC,GACT,CAAC,GAAGb,MAAM,EAAES,KAAK,CAAC,GAClBT,MAAM,CAACgB,GAAG,CAAC,CAACD,CAAC,EAAEE,CAAC,KAAMA,CAAC,KAAKJ,QAAQ,GAAGJ,KAAK,GAAGM,CAAE,CAAC;EAC5DX,IAAI,CAAC,CAAC;EACN,OAAOI,EAAE;AACb;;AAEA;AACA,OAAO,SAASU,YAAYA,CAACV,EAAW,EAAQ;EAC5CR,MAAM,GAAGQ,EAAE,KAAKW,SAAS,GAAG,EAAE,GAAGnB,MAAM,CAACoB,MAAM,CAAEL,CAAC,IAAKA,CAAC,CAACP,EAAE,KAAKA,EAAE,CAAC;EAClEJ,IAAI,CAAC,CAAC;AACV;AAEA,OAAO,SAASiB,SAASA,CAAA,EAA0B;EAC/C,OAAOrB,MAAM;AACjB;;AAEA;AACA,OAAO,SAASsB,gBAAgBA,CAC5BC,GAA0B,GAAGvB,MAAM,EACd;EACrB,OAAOuB,GAAG,CAACC,KAAK,CAAC,CAAC1B,kBAAkB,CAAC;AACzC;AAEA,OAAO,SAAS2B,eAAeA,CAACpB,QAAkB,EAAc;EAC5DJ,SAAS,CAACyB,GAAG,CAACrB,QAAQ,CAAC;EACvB,OAAO,MAAMJ,SAAS,CAAC0B,MAAM,CAACtB,QAAQ,CAAC;AAC3C;;AAEA;AACA,OAAO,SAASuB,WAAWA,CAAA,EAAS;EAChC5B,MAAM,GAAG,EAAE;EACXG,OAAO,GAAG,CAAC;AACf","ignoreList":[]}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useMemo, useRef, useState } from 'react';
4
+ import { useWindowDimensions } from 'react-native';
5
+ import { computeAnchoredPosition } from "./positioning.js";
6
+
7
+ /**
8
+ * Measurement plumbing for `computeAnchoredPosition`.
9
+ *
10
+ * Wires the three inputs the pure engine needs: the anchor's window rect
11
+ * (`measureInWindow`, taken when the overlay opens), the floating content's
12
+ * size (its `onLayout`), and the window size (re-renders on rotation).
13
+ *
14
+ * ```tsx
15
+ * const { anchorRef, measureAnchor, onContentLayout, position } =
16
+ * useAnchoredPosition({ placement: 'bottom' })
17
+ *
18
+ * <Pressable ref={anchorRef} onPress={() => { measureAnchor(); open() }} />
19
+ * <Portal>
20
+ * <View
21
+ * onLayout={onContentLayout}
22
+ * style={position && {
23
+ * position: 'absolute', left: position.x, top: position.y,
24
+ * maxHeight: position.maxHeight, opacity: 1,
25
+ * }}
26
+ * />
27
+ * </Portal>
28
+ * ```
29
+ *
30
+ * `position` is `null` until both measurements land — render the content
31
+ * transparent (not unmounted, or `onLayout` never fires) until then.
32
+ */
33
+ export function useAnchoredPosition(options) {
34
+ const anchorRef = useRef(null);
35
+ const [anchorRect, setAnchorRect] = useState(null);
36
+ const [contentSize, setContentSize] = useState(null);
37
+ const viewport = useWindowDimensions();
38
+
39
+ /** Call when opening (and after anything that moves the anchor). */
40
+ const measureAnchor = useCallback(() => {
41
+ anchorRef.current?.measureInWindow((x, y, width, height) => {
42
+ setAnchorRect({
43
+ x,
44
+ y,
45
+ width,
46
+ height
47
+ });
48
+ });
49
+ }, []);
50
+ const onContentLayout = useCallback(event => {
51
+ const {
52
+ width,
53
+ height
54
+ } = event.nativeEvent.layout;
55
+ setContentSize(previous => previous?.width === width && previous?.height === height ? previous : {
56
+ width,
57
+ height
58
+ });
59
+ }, []);
60
+ const position = useMemo(() => {
61
+ if (!anchorRect || !contentSize) return null;
62
+ return computeAnchoredPosition({
63
+ anchor: anchorRect,
64
+ content: contentSize,
65
+ viewport: {
66
+ width: viewport.width,
67
+ height: viewport.height
68
+ },
69
+ placement: options?.placement,
70
+ alignment: options?.alignment,
71
+ offset: options?.offset,
72
+ viewportPadding: options?.viewportPadding
73
+ });
74
+ }, [anchorRect, contentSize, viewport.width, viewport.height, options?.placement, options?.alignment, options?.offset, options?.viewportPadding]);
75
+ return {
76
+ anchorRef,
77
+ measureAnchor,
78
+ onContentLayout,
79
+ position
80
+ };
81
+ }
82
+ //# sourceMappingURL=useAnchoredPosition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useMemo","useRef","useState","useWindowDimensions","computeAnchoredPosition","useAnchoredPosition","options","anchorRef","anchorRect","setAnchorRect","contentSize","setContentSize","viewport","measureAnchor","current","measureInWindow","x","y","width","height","onContentLayout","event","nativeEvent","layout","previous","position","anchor","content","placement","alignment","offset","viewportPadding"],"sourceRoot":"../../../src","s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MAAMM,QAAQ,GAAGzB,OAAO,CAA0B,MAAM;IACpD,IAAI,CAACQ,UAAU,IAAI,CAACE,WAAW,EAAE,OAAO,IAAI;IAC5C,OAAON,uBAAuB,CAAC;MAC3BsB,MAAM,EAAElB,UAAU;MAClBmB,OAAO,EAAEjB,WAAW;MACpBE,QAAQ,EAAE;QAAEM,KAAK,EAAEN,QAAQ,CAACM,KAAK;QAAEC,MAAM,EAAEP,QAAQ,CAACO;MAAO,CAAC;MAC5DS,SAAS,EAAEtB,OAAO,EAAEsB,SAAS;MAC7BC,SAAS,EAAEvB,OAAO,EAAEuB,SAAS;MAC7BC,MAAM,EAAExB,OAAO,EAAEwB,MAAM;MACvBC,eAAe,EAAEzB,OAAO,EAAEyB;IAC9B,CAAC,CAAC;EACN,CAAC,EAAE,CACCvB,UAAU,EACVE,WAAW,EACXE,QAAQ,CAACM,KAAK,EACdN,QAAQ,CAACO,MAAM,EACfb,OAAO,EAAEsB,SAAS,EAClBtB,OAAO,EAAEuB,SAAS,EAClBvB,OAAO,EAAEwB,MAAM,EACfxB,OAAO,EAAEyB,eAAe,CAC3B,CAAC;EAEF,OAAO;IAAExB,SAAS;IAAEM,aAAa;IAAEO,eAAe;IAAEK;EAAS,CAAC;AAClE","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ import React, { forwardRef, memo } from 'react';
4
+ import { View, Platform, StyleSheet } from 'react-native';
5
+ import { resolveSurfaceStyle } from "../adapters/surfaceStyle.js";
6
+
7
+ /**
8
+ * Native `Block` — a `View` driven by token-shaped style props.
9
+ *
10
+ * Style resolution is delegated to `resolveSurfaceStyle`, the same function
11
+ * `Pressable` uses, so a component that swaps between the two depending on
12
+ * whether it is interactive (web's `TagElement = onClick ? PrimitiveButton :
13
+ * Block` pattern) renders identically in both branches. Before that was
14
+ * shared, `Block` could not render a border, radius, shadow, or height at
15
+ * all.
16
+ *
17
+ * Note there is **no `color` prop**. On web, `Block`'s `color` maps to CSS
18
+ * `color` — a foreground value that SVG icons inherit via `currentColor`.
19
+ * RN has no such inheritance, and mapping `color` to `backgroundColor` (as
20
+ * this file previously did) silently inverted the meaning of every call
21
+ * copied over from web. Use `backgroundColor` for a background, and `Slot`
22
+ * for tinting icons.
23
+ */
24
+ import { jsx as _jsx } from "react/jsx-runtime";
25
+ const BlockImpl = /*#__PURE__*/forwardRef(function Block({
26
+ children,
27
+ style,
28
+ ...rest
29
+ }, ref) {
30
+ // Split token-shaped style props from pass-through RN View props.
31
+ const {
32
+ background,
33
+ backgroundColor,
34
+ border,
35
+ borderRadius,
36
+ boxShadow,
37
+ paddingTop,
38
+ paddingRight,
39
+ paddingBottom,
40
+ paddingLeft,
41
+ width,
42
+ minWidth,
43
+ maxWidth,
44
+ height,
45
+ minHeight,
46
+ maxHeight,
47
+ flexDirection,
48
+ alignItems,
49
+ justifyContent,
50
+ alignSelf,
51
+ gap,
52
+ flexShrink,
53
+ flexGrow,
54
+ opacity,
55
+ overflow,
56
+ ...viewProps
57
+ } = rest;
58
+ const resolved = resolveSurfaceStyle({
59
+ background,
60
+ backgroundColor,
61
+ border,
62
+ borderRadius,
63
+ boxShadow,
64
+ paddingTop,
65
+ paddingRight,
66
+ paddingBottom,
67
+ paddingLeft,
68
+ width,
69
+ minWidth,
70
+ maxWidth,
71
+ height,
72
+ minHeight,
73
+ maxHeight,
74
+ flexDirection,
75
+ alignItems,
76
+ justifyContent,
77
+ alignSelf,
78
+ gap,
79
+ flexShrink,
80
+ flexGrow,
81
+ opacity,
82
+ overflow
83
+ }, Platform.OS);
84
+ return /*#__PURE__*/_jsx(View, {
85
+ ref: ref,
86
+ style: StyleSheet.flatten([baseStyle.view, resolved, style]),
87
+ ...viewProps,
88
+ children: children
89
+ });
90
+ });
91
+
92
+ /**
93
+ * Memoised because primitives sit at the leaves of every component tree: a
94
+ * parent re-render should not walk the whole subtree when none of the
95
+ * token-derived props changed.
96
+ */
97
+ export const Block = /*#__PURE__*/memo(BlockImpl);
98
+ Block.displayName = 'Block';
99
+ const baseStyle = StyleSheet.create({
100
+ view: {
101
+ // RN Views are already flex containers; declaring it keeps parity
102
+ // with web `Block`, which is `display: flex`.
103
+ display: 'flex'
104
+ }
105
+ });
106
+ export default Block;
107
+ //# sourceMappingURL=Block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","forwardRef","memo","View","Platform","StyleSheet","resolveSurfaceStyle","jsx","_jsx","BlockImpl","Block","children","style","rest","ref","background","backgroundColor","border","borderRadius","boxShadow","paddingTop","paddingRight","paddingBottom","paddingLeft","width","minWidth","maxWidth","height","minHeight","maxHeight","flexDirection","alignItems","justifyContent","alignSelf","gap","flexShrink","flexGrow","opacity","overflow","viewProps","resolved","OS","flatten","baseStyle","view","displayName","create","display"],"sourceRoot":"../../../src","sources":["primitives/Block.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,IAAI,QAAQ,OAAO;AAC/C,SACIC,IAAI,EACJC,QAAQ,EACRC,UAAU,QAIP,cAAc;AACrB,SACIC,mBAAmB,QAEhB,6BAA0B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAhBA,SAAAC,GAAA,IAAAC,IAAA;AAwBA,MAAMC,SAAS,gBAAGR,UAAU,CAAqB,SAASS,KAAKA,CAC3D;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAK,CAAC,EAC5BC,GAAG,EACL;EACE;EACA,MAAM;IACFC,UAAU;IACVC,eAAe;IACfC,MAAM;IACNC,YAAY;IACZC,SAAS;IACTC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,WAAW;IACXC,KAAK;IACLC,QAAQ;IACRC,QAAQ;IACRC,MAAM;IACNC,SAAS;IACTC,SAAS;IACTC,aAAa;IACbC,UAAU;IACVC,cAAc;IACdC,SAAS;IACTC,GAAG;IACHC,UAAU;IACVC,QAAQ;I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