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
package/README.md ADDED
@@ -0,0 +1,404 @@
1
+ # blend-native
2
+
3
+ React Native components for the [Blend Design System](https://github.com/juspay/blend-design-system).
4
+
5
+ This package consumes Blend's token system via the React-free `@juspay/blend-design-system/node` entry and translates CSS-string token values into React Native style objects. No `styled-components`, no DOM, no `window.addEventListener`.
6
+
7
+ ## Architecture
8
+
9
+ ```
10
+ @juspay/blend-design-system/node ← React-free token entry
11
+ FOUNDATION_THEME, Theme, BREAKPOINTS, mergeTokenTree,
12
+ getXTokens factories, component enums
13
+
14
+
15
+ ┌──────────────────────────────────────────────────────────┐
16
+ │ theme/ BlendNativeProvider + useNativeTokens │
17
+ │ (context, deep-merged overrides, │
18
+ │ breakpoint resolution) │
19
+ │ │
20
+ │ adapters/ CSS-string → RN style translation │
21
+ │ cssStringAdapter, surfaceStyle │
22
+ │ │
23
+ │ primitives/ Block, Pressable, Text, Slot, Separator │
24
+ │ │
25
+ │ a11y/ live-region announcements │
26
+ │ │
27
+ │ components/ Alert, Button, Tag, shared/ │
28
+ └──────────────────────────────────────────────────────────┘
29
+ ```
30
+
31
+ ### Why a separate package?
32
+
33
+ A POC originally added native files directly inside `packages/blend/lib/components/ButtonV2/`. That worked in Expo but broke structural quality gates:
34
+
35
+ - Barrel imports pulled `styled-components` into RN bundles
36
+ - `useBreakPoints.ts` used DOM `window.addEventListener` (crashes on RN)
37
+ - The Vite build for web would have been polluted
38
+
39
+ `blend-native` is a sibling package that imports **only** from `@juspay/blend-design-system/node` — the React-free, CSS-free entry point. The web package stays untouched apart from additive exports.
40
+
41
+ ### Token flow
42
+
43
+ ```
44
+ <BlendNativeProvider theme componentTokens>
45
+
46
+
47
+ useNativeTokens<XTokensType>('TAGV2')
48
+ │ 1. look the slot up in nativeTokenRegistry
49
+ │ 2. call the factory → { sm: {...}, lg: {...} }
50
+ │ 3. mergeTokenTree(defaults, overrides) ← shared with web
51
+ │ 4. pick the active breakpoint ← useWindowDimensions
52
+
53
+ flat token object
54
+
55
+
56
+ get<X>NativeStyles(...) → CSS-string values per state
57
+
58
+
59
+ <Pressable background="linear-gradient(...)" border="1px solid #E1E4EA" />
60
+ │ resolveSurfaceStyle → ViewStyle
61
+
62
+ RN Pressable (+ LinearGradient when the background is a gradient)
63
+ ```
64
+
65
+ `mergeTokenTree` is imported from the web package rather than reimplemented, so override semantics cannot drift between platforms.
66
+
67
+ ### Theming
68
+
69
+ Theme and per-slot token overrides come from context, mirroring web's `ThemeProvider`:
70
+
71
+ ```tsx
72
+ import { BlendNativeProvider, Theme } from 'blend-native'
73
+ ;<BlendNativeProvider
74
+ theme={Theme.DARK}
75
+ componentTokens={{
76
+ TAGV2: { sm: { gap: '8px' } },
77
+ }}
78
+ >
79
+ <App />
80
+ </BlendNativeProvider>
81
+ ```
82
+
83
+ Overrides are deep-merged onto the active theme's defaults — supply only the paths you want to change and every untouched path keeps its light/dark value. Components also work with no provider mounted, falling back to light-theme defaults.
84
+
85
+ `theme` also accepts `'system'` (exported as `SYSTEM_THEME`), which follows the OS appearance via `useColorScheme` and re-renders when the user flips light/dark. `breakpoints` overrides the thresholds token resolution uses (`{ sm: 320, lg: 1024 }` by default — tablets resolve `lg`).
86
+
87
+ ### Fonts
88
+
89
+ Web never applies Blend's font tokens — components inherit whatever the host document loads, and the consuming app supplies InterDisplay via `@font-face`. RN has no inheritance, so the provider is the inheritance mechanism: it resolves one family per role (`display` / `body` / `heading` / `mono`, defaulting to the foundation `font.family` tokens) and `Text` applies the `body` role by default.
90
+
91
+ Consumers must load the faces themselves (e.g. `expo-font`, or native asset linking) **under the exact token family name** (`InterDisplay`); until they do, the platform falls back to the system font (with a dev warning on iOS). Opt out or override per role:
92
+
93
+ ```tsx
94
+ <BlendNativeProvider fontFamily="system" /> // platform fonts everywhere
95
+ <BlendNativeProvider fontFamily={{ mono: 'JetBrainsMono' }} /> // override one role
96
+ <BlendNativeProvider fontFamily={{ body: null }} /> // disable one role
97
+ ```
98
+
99
+ Android note: static font files must be registered so numeric `fontWeight` values resolve within one family (the `expo-font` config plugin handles this); otherwise weights beyond regular/bold may not render.
100
+
101
+ ### Font scaling
102
+
103
+ OS font scaling (Dynamic Type) is deliberately left **on** — the package policy is to respect it and let controls grow: components size with `minHeight`, never a fixed `height`, so scaled text expands the control instead of clipping. Consumers needing a cap can pass RN's own `maxFontSizeMultiplier` through to `Text`.
104
+
105
+ ### CSS-string adapter
106
+
107
+ Blend tokens emit CSS strings (`"6px"`, `"1px solid #E1E4EA"`, `"linear-gradient(...)"`, `"0px 2px 8px rgba(5,5,6,0.07)"`). RN's stylesheet accepts only numbers or platform-specific objects, so every token value that touches layout or decoration is translated in `cssStringAdapter.ts`:
108
+
109
+ | Function | Input | Output |
110
+ | ------------------- | --------------------------------------------- | ----------------------------------------------------------------------- |
111
+ | `parseDimension` | `"6px"`, `"0"` | `6`, `0` |
112
+ | `parseSize` | `"50%"`, `"auto"`, `"fit-content"`, `"24px"` | `'50%'`, `'auto'`, `'auto'`, `24` |
113
+ | `parseBorder` | `"1px solid #E1E4EA"` | `{ borderWidth: 1, borderColor: '#E1E4EA' }` |
114
+ | `parseBorderRadius` | `"10px"`, `"10px 0 0 10px"` | `10` or `{ borderTopLeftRadius: 10, ... }` |
115
+ | `parseBoxShadow` | `"0px 2px 8px rgba(0,0,0,0.15)"` | `{ shadowColor, shadowOffset, shadowOpacity, shadowRadius, elevation }` |
116
+ | `parseBackground` | `"linear-gradient(180deg, #1A56DB, #2563EB)"` | `{ type: 'gradient', colors, locations, start, end }` |
117
+ | `parseBackground` | `"#FFFFFF"` | `{ type: 'flat', color: '#FFFFFF' }` |
118
+
119
+ All functions are pure and total — unparseable input returns a safe fallback rather than throwing. `parseSize` is deliberately strict: `parseFloat` would turn `"100%"` into `100`, which RN renders as 100 **pixels**.
120
+
121
+ `surfaceStyle.ts` composes those parsers into `resolveSurfaceStyle`, the single translation both `Block` and `Pressable` use.
122
+
123
+ ### Primitives
124
+
125
+ | Primitive | Replaces | Notes |
126
+ | ----------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
127
+ | `Block` | web `Block` (styled `div`) | RN `View`. Has **no `color` prop** — web's `color` is a foreground value; use `backgroundColor` for fills and `Slot` for icon tinting. |
128
+ | `Pressable` | web `PrimitiveButton` (styled `button`) | RN `Pressable`. Handles pressed/disabled/loading. Gradients render via `<LinearGradient>` with a negative-inset bleed to avoid antialiasing gaps. |
129
+ | `Text` | web `Text` (styled `span`) | RN `Text`, maps `fontSize`/`fontWeight`/`color`/`lineHeight`/`textAlign` |
130
+ | `Slot` | web `Block` used as an icon wrapper | Tints icons explicitly (RN has no `currentColor`), honours per-slot `maxHeight`, and hides itself from screen readers when the parent also has a label |
131
+
132
+ `Block` and `Pressable` both derive their props from `SurfaceStyleProps`. That shared base is load-bearing: components that switch between the two depending on interactivity build one surface object for both, and a divergent prop set would silently vanish into `...rest` without TypeScript noticing.
133
+
134
+ ## Folder structure
135
+
136
+ ```
137
+ packages/blend-native/
138
+ ├── package.json # dual ESM+CJS build via react-native-builder-bob;
139
+ │ # Metro consumes raw src/ via the react-native condition
140
+ ├── tsconfig.json # ES2020, no DOM lib, JSX react-jsx, strict
141
+ ├── tsconfig.build.json # declaration-only emit for bob's typescript target
142
+ ├── eslint.config.js # mirrors web config, no browser globals
143
+ ├── vitest.config.ts # covers the pure layer (see Testing)
144
+ ├── jest.config.cjs # RN preset for *.render.test.tsx (RNTL)
145
+ ├── __tests__/
146
+ └── src/
147
+ ├── index.ts # public barrel — the semver commitment
148
+ ├── theme/
149
+ │ ├── BlendNativeProvider.tsx # context (theme, overrides, breakpoints, fonts)
150
+ │ ├── useNativeTokens.ts # slot → flat, override-merged tokens
151
+ │ ├── nativeTokenRegistry.ts # slot → factory (ONE file per new component)
152
+ │ ├── useNativeBreakpoint.ts # useWindowDimensions → 'sm' | 'lg'
153
+ │ ├── breakpoint.ts # pure width → label (RN-free, testable)
154
+ │ ├── fonts.ts # pure role → family resolution (RN-free)
155
+ │ └── systemTheme.ts # pure 'system' → light/dark (RN-free)
156
+ ├── adapters/
157
+ │ ├── cssStringAdapter.ts # pure CSS-string → RN value parsers
158
+ │ └── surfaceStyle.ts # composes them into a ViewStyle
159
+ ├── a11y/
160
+ │ ├── announcement.ts # pure announcement composition
161
+ │ └── useLiveRegion.ts # iOS announceForAccessibility bridge
162
+ ├── primitives/
163
+ │ ├── Block.tsx Pressable.tsx Text.tsx Slot.tsx Separator.tsx
164
+ │ ├── pressFeedback.ts # ripple (Android) vs scale (elsewhere)
165
+ │ ├── tintSlot.ts # explicit icon tinting (no currentColor)
166
+ │ └── touchTarget.ts # 44pt hitSlop policy (RN-free, testable)
167
+ └── components/
168
+ ├── shared/
169
+ │ └── group.ts # grouped-control radius/border collapse
170
+ ├── Alert/ # Alert.tsx + AlertActions/AlertClose/AlertText
171
+ ├── Button/
172
+ │ ├── Button.tsx
173
+ │ ├── button.types.ts
174
+ │ ├── button.utils.ts
175
+ │ └── index.ts
176
+ └── Tag/ # same shape as Button/
177
+ ```
178
+
179
+ Files are named plainly. `.native.tsx` / `.ios.tsx` / `.web.tsx` are Metro **resolver directives** meaning "use this instead of the sibling", so they are reserved for genuine platform splits — this package has none.
180
+
181
+ ## Installation
182
+
183
+ ```bash
184
+ pnpm add blend-native @juspay/blend-design-system react react-native
185
+ # only if you use gradient variants (Button primary):
186
+ pnpm add expo-linear-gradient
187
+ ```
188
+
189
+ ### Peer dependencies
190
+
191
+ | Package | Version | Required |
192
+ | ----------------------------- | ----------------- | ------------------------------------------------- |
193
+ | `@juspay/blend-design-system` | `>=0.0.38-beta.2` | yes |
194
+ | `react` | `>=18.2.0` | yes |
195
+ | `react-native` | `>=0.74.0` | yes |
196
+ | `expo-linear-gradient` | `>=15.0.0` | **optional** — gradients fall back to a flat fill |
197
+
198
+ ## Usage
199
+
200
+ ```tsx
201
+ import {
202
+ BlendNativeProvider,
203
+ Button,
204
+ ButtonType,
205
+ Tag,
206
+ TagType,
207
+ TagColor,
208
+ } from 'blend-native'
209
+
210
+ function Example() {
211
+ return (
212
+ <BlendNativeProvider>
213
+ <Button
214
+ buttonType={ButtonType.PRIMARY}
215
+ text="Press me"
216
+ onPress={() => console.log('pressed')}
217
+ />
218
+ <Tag text="Beta" type={TagType.SUBTLE} color={TagColor.PRIMARY} />
219
+ </BlendNativeProvider>
220
+ )
221
+ }
222
+ ```
223
+
224
+ ### Button props
225
+
226
+ | Prop | Type | Default | Description |
227
+ | -------------------- | ------------------------------------ | --------- | ------------------------------------------------------- |
228
+ | `buttonType` | `ButtonType` | `PRIMARY` | `PRIMARY`, `SECONDARY`, `DANGER`, `SUCCESS` |
229
+ | `size` | `ButtonSize` | `SMALL` | `SMALL`, `MEDIUM`, `LARGE` |
230
+ | `subType` | `ButtonSubType` | `DEFAULT` | `DEFAULT`, `INLINE`, `ICON_ONLY` |
231
+ | `state` | `ButtonState` | `DEFAULT` | `DEFAULT`, `HOVER`, `ACTIVE` (hover is no-op on native) |
232
+ | `text` | `string` | — | Button label |
233
+ | `leftSlot` | `{ slot, maxHeight? }` | — | Leading icon/element |
234
+ | `rightSlot` | `{ slot, maxHeight? }` | — | Trailing icon/element |
235
+ | `loading` | `boolean` | `false` | Swaps content for a spinner; keeps its own chrome |
236
+ | `disabled` | `boolean` | `false` | Disabled chrome + blocks presses |
237
+ | `width` | `string \| number` | `'auto'` | `"100%"`, `"auto"`, `"fit-content"`, `120` |
238
+ | `minWidth` | `string \| number` | — | Minimum width constraint |
239
+ | `maxWidth` | `string \| number` | — | Maximum width constraint |
240
+ | `onPress` | `(e: GestureResponderEvent) => void` | — | Press handler |
241
+ | `testID` | `string` | — | Test ID |
242
+ | `accessibilityLabel` | `string` | `text` | Screen reader label |
243
+
244
+ Plus any `PressableProps` (`onLongPress`, `onPressIn`, `hitSlop`, `accessibilityHint`, …) and a `style` escape hatch. Refs forward to the underlying `Pressable`.
245
+
246
+ ### Tag props
247
+
248
+ | Prop | Type | Default | Description |
249
+ | -------------------- | ------------------------------------ | ----------- | ------------------------------------------------------------- |
250
+ | `text` | `string` | — (req.) | Tag label |
251
+ | `type` | `TagType` | `SUBTLE` | `NO_FILL`, `SUBTLE`, `ATTENTIVE` |
252
+ | `color` | `TagColor` | `PRIMARY` | `NEUTRAL`, `PRIMARY`, `SUCCESS`, `ERROR`, `WARNING`, `PURPLE` |
253
+ | `size` | `TagSize` | `SM` | `XS`, `SM`, `MD`, `LG` |
254
+ | `subType` | `TagSubType` | `SQUARICAL` | `SQUARICAL`, `ROUNDED` (pill) |
255
+ | `leftSlot` | `{ slot, maxHeight? }` | — | Leading icon/element |
256
+ | `rightSlot` | `{ slot, maxHeight? }` | — | Trailing icon/element |
257
+ | `tagGroupPosition` | `'left' \| 'center' \| 'right'` | — | Collapses the joined corners |
258
+ | `onPress` | `(e: GestureResponderEvent) => void` | — | Supplying this makes the tag interactive |
259
+ | `pressed` | `boolean \| 'mixed'` | — | Toggle state (web's `aria-pressed`) |
260
+ | `accessibilityLabel` | `string` | derived | Overrides the name built from `text` + `pressed` |
261
+
262
+ ### Alert props
263
+
264
+ | Prop | Type | Default | Description |
265
+ | --------------------------------- | ------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------- |
266
+ | `type` | `AlertType` | `PRIMARY` | `PRIMARY`, `SUCCESS`, `WARNING`, `ERROR`, `PURPLE`, `ORANGE`, `NEUTRAL` |
267
+ | `subType` | `AlertSubType` | `SUBTLE` | `SUBTLE`, `NO_FILL` |
268
+ | `heading` | `string` | — | Alert heading |
269
+ | `description` | `string` | — | Body text |
270
+ | `slot` | `{ slot, maxHeight? }` | — | Leading icon/element |
271
+ | `actions` | `{ position?, primaryAction?, secondaryAction? }` | bottom | Action links; `position` is `BOTTOM` or `RIGHT` |
272
+ | `closeButton` | `{ show?, onPress? }` | `{ show: true }` | Close affordance |
273
+ | `announce` | `boolean` | `true` | Live-region announcement (imperative on iOS, `accessibilityLiveRegion` on Android) |
274
+ | `width` / `maxWidth` / `minWidth` | `string \| number` | token defaults | Sizing overrides |
275
+
276
+ ## Development
277
+
278
+ ```bash
279
+ pnpm --filter blend-native typecheck
280
+ pnpm --filter blend-native lint
281
+ pnpm --filter blend-native test
282
+ ```
283
+
284
+ `@juspay/blend-design-system/node` resolves to the workspace package, which serves built `dist/`. Run `pnpm build:blend` after changing `packages/blend/lib/node.ts`, or the new exports will be missing at runtime.
285
+
286
+ ### Testing
287
+
288
+ Two runners, disjoint globs, both run by `pnpm test`:
289
+
290
+ - **vitest** (`test:unit`) covers the **pure** layer — adapters, surface resolution, per-component style/utility functions, breakpoint/theme/font resolution, and override merging. It runs with no RN runtime, because every `react-native` import in those modules is type-only and therefore erased.
291
+ - **jest + `@testing-library/react-native`** (`test:render`) covers `*.render.test.tsx` — what actually reaches the render tree: accessibility reachability, provider wiring (breakpoints, fonts, `theme="system"`), and regressions only a mounted component can catch.
292
+
293
+ **Verify visually on a simulator or device, not just the browser.** Several
294
+ bugs here were invisible under `react-native-web` and only appeared on a real
295
+ device — RN and CSS differ on clipping, `lineHeight`, overflow, and the default
296
+ value of `flexShrink`.
297
+
298
+ `apps/native-site` is the verification vehicle. Its
299
+ [README](../../apps/native-site/README.md) is the runbook: running on
300
+ simulators and physical devices for both platforms, capturing screenshots,
301
+ capturing pressed states, and the Expo Go SDK ceiling on Android.
302
+
303
+ ## Verifying as a consumer
304
+
305
+ `apps/native-site` consumes this package through the workspace link (raw
306
+ `src/`), which is right for development but is **not** what npm consumers
307
+ receive. Before a release, smoke-test the publish artifact itself:
308
+
309
+ ```bash
310
+ # 1. Build and pack — the tarball is byte-for-byte what npm publish uploads
311
+ pnpm --filter blend-native build
312
+ pnpm --filter blend-native pack --pack-destination /tmp
313
+
314
+ # 2. Point native-site at the tarball instead of the workspace:
315
+ # - apps/native-site/package.json: "blend-native": "file:/tmp/juspay-blend-native-<version>.tgz"
316
+ # - apps/native-site/tsconfig.json: REMOVE the "blend-native" paths entry
317
+ pnpm install --filter native-site
318
+
319
+ # 3. Consumer checks
320
+ pnpm --filter native-site typecheck # published d.ts via the exports map
321
+ cd apps/native-site && npx expo export --platform android # full Metro bundle
322
+ npx expo start # then verify on a simulator/device
323
+
324
+ # 4. Revert package.json + tsconfig.json to the workspace state and reinstall
325
+ ```
326
+
327
+ The typecheck proves the `types` conditions resolve; the export proves Metro
328
+ resolves the `react-native` condition into the shipped `src/` and the whole
329
+ module graph (Reanimated worklets, gesture handler, portals) compiles.
330
+
331
+ ## Publishing
332
+
333
+ `blend-native` versions **independently** of
334
+ `@juspay/blend-design-system`; compatibility is declared through the peer
335
+ range. Publishing runs through the **Publish Native to NPM** workflow
336
+ (`.github/workflows/publish-native-npm.yml`), which gates on branch,
337
+ version format, a green lint/typecheck/test/build, and the peer-export
338
+ check below, before `npm publish`.
339
+
340
+ ### Publish the web package first — always
341
+
342
+ This package imports its whole token system from
343
+ `@juspay/blend-design-system/node`. The workspace build always has the
344
+ newest exports, so **local checks and CI cannot tell you whether the
345
+ version consumers will install has them**. A new native component almost
346
+ always adds an export to `packages/blend/lib/node.ts`, and until a web
347
+ version containing it is on npm, publishing native ships a package that
348
+ crashes on first render with an unrelated `undefined`.
349
+
350
+ ```bash
351
+ pnpm --filter blend-native check:peer
352
+ ```
353
+
354
+ resolves the floor version out of the declared peer range, fetches that
355
+ exact version from the registry, and asserts every value import exists in
356
+ it. Run it before any release; the publish workflow runs it too. When it
357
+ fails, the fix is always the same order:
358
+
359
+ 1. Publish a `@juspay/blend-design-system` version whose `lib/node.ts`
360
+ carries the new exports (its own beta workflow runs from `staging`).
361
+ 2. Raise `peerDependencies["@juspay/blend-design-system"]` here to that
362
+ version.
363
+ 3. Re-run `check:peer` — then publish native.
364
+
365
+ ### Beta
366
+
367
+ 1. Bump `version` in `packages/blend-native/package.json` to `X.Y.Z-beta.N`
368
+ (e.g. `0.0.1-beta.1`) in a PR and merge it to `dev`.
369
+ 2. GitHub → Actions → **Publish Native to NPM** → Run workflow **from
370
+ `dev`** (or `staging`), `dist_tag: beta`, type `PUBLISH` to confirm.
371
+ 3. The workflow refuses a non-beta version, an already-published version,
372
+ or a red check; on success it verifies the tag on the registry.
373
+ 4. Consumers install with `npm install blend-native@beta`.
374
+
375
+ ### Stable
376
+
377
+ 1. Bump `version` to plain `X.Y.Z` (drop the `-beta.N`) in a PR; land it on
378
+ `main` through the usual `dev → staging → main` train.
379
+ 2. Run the same workflow **from `main`**, `dist_tag: latest`, confirm
380
+ `PUBLISH`. The workflow refuses `latest` from any other branch.
381
+ 3. Consumers on `npm install blend-native` now get this version.
382
+
383
+ Iterating a beta: bump to `-beta.N+1`, merge, run the workflow again — the
384
+ already-published gate makes re-running for a published version a no-op.
385
+
386
+ ## Adding a new component
387
+
388
+ 1. Ensure the token factory, its types, and its enums are exported from `@juspay/blend-design-system/node` (edit `packages/blend/lib/node.ts`), then `pnpm build:blend`.
389
+ 2. Register the slot in `src/theme/nativeTokenRegistry.ts` — **the only file to touch** for wiring (web needs three files in lockstep).
390
+ 3. Create `src/components/<Component>/` with `<Component>.tsx`, `<component>.types.ts`, `<component>.utils.ts`, `index.ts`.
391
+ 4. Export from `src/index.ts`.
392
+ 5. Add a variant-matrix test asserting no `NaN`/`undefined` reaches a style.
393
+
394
+ ## Known limitations
395
+
396
+ - **Gradient percentage midpoints**: token gradients use positions outside `[0,1]` (e.g. `-5%`, `107.5%`). RN's `<LinearGradient>` clamps `locations` to `[0,1]`, so gradients render as simple 2-stop fades.
397
+ - **Inset shadows dropped**: RN has no inset-shadow concept. `parseBoxShadow` returns `null` for inset declarations; focus-ring shadows become outer shadows.
398
+ - **Hover is a no-op**: `ButtonState.HOVER` exists in the enum but native has no hover. Tokens apply only if the consumer explicitly sets `state={ButtonState.HOVER}`.
399
+ - **No skeleton**: web's `skeleton` prop has no native counterpart. It is `Omit`ted from the prop types rather than accepted and ignored, so passing it is a compile error.
400
+ - **Tag vertical padding is not applied**: the tokens pair a height with vertical padding that leaves a content box shorter than the text's line height. CSS lets the line box overflow harmlessly; RN clips it, shearing descenders. The height token is applied as `minHeight` (identical result at the default font scale, and the box grows under OS font scaling) and the inert vertical padding is dropped.
401
+ - **Not ported from web's ButtonV2 barrel**: `IconButton`, `LinkButton` and `ButtonGroupV2` have no native counterpart yet, and neither does `TagGroupV2` — only the per-control `tagGroupPosition` / `buttonGroupPosition` prop is supported.
402
+ - **Gradients in the ESM build**: the optional `expo-linear-gradient` peer is loaded with `require`, which exists under Metro, the CJS build, and bundlers that polyfill it (webpack). In a pure-ESM Node context the probe degrades and gradient surfaces render their first-stop flat fill.
403
+
404
+ Controls smaller than 44pt automatically receive a `hitSlop` so their tap target meets Apple HIG and Material guidance without changing their visual size; pass `minTouchTarget={0}` to opt out.
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.buildAnnouncement = buildAnnouncement;
7
+ /**
8
+ * Live-region message construction.
9
+ *
10
+ * Kept RN-free so it stays unit-testable outside a renderer — the same split
11
+ * as `theme/breakpoint.ts` and `primitives/touchTarget.ts`.
12
+ */
13
+
14
+ /**
15
+ * Compose the sentence a screen reader should announce for a status surface.
16
+ *
17
+ * Web relies on `aria-atomic="true"` to have the whole region re-read when any
18
+ * part changes, so the announcement is heading and description together. iOS
19
+ * has no live-region concept at all and must be told the exact string, so it
20
+ * is built here rather than left to the platform.
21
+ *
22
+ * Returns `undefined` when there is nothing worth announcing, so callers can
23
+ * skip the announcement entirely instead of interrupting the user with silence.
24
+ *
25
+ * ```
26
+ * buildAnnouncement('Saved', 'Your changes are live') -> 'Saved. Your changes are live'
27
+ * buildAnnouncement('Saved', undefined) -> 'Saved'
28
+ * buildAnnouncement(undefined, 'Your changes are live')-> 'Your changes are live'
29
+ * buildAnnouncement(undefined, undefined) -> undefined
30
+ * ```
31
+ */
32
+ function buildAnnouncement(heading, description) {
33
+ const parts = [heading, description].map(part => part?.trim()).filter(part => Boolean(part));
34
+ if (parts.length === 0) return undefined;
35
+ if (parts.length === 1) return parts[0];
36
+
37
+ // Punctuate between the two so the reader pauses rather than running the
38
+ // heading into the description as one sentence.
39
+ const [head, rest] = parts;
40
+ return /[.!?:]$/.test(head) ? `${head} ${rest}` : `${head}. ${rest}`;
41
+ }
42
+ //# sourceMappingURL=announcement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["buildAnnouncement","heading","description","parts","map","part","trim","filter","Boolean","length","undefined","head","rest","test"],"sourceRoot":"../../../src","sources":["a11y/announcement.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAiBA,CAC7BC,OAAgB,EAChBC,WAAoB,EACF;EAClB,MAAMC,KAAK,GAAG,CAACF,OAAO,EAAEC,WAAW,CAAC,CAC/BE,GAAG,CAAEC,IAAI,IAAKA,IAAI,EAAEC,IAAI,CAAC,CAAC,CAAC,CAC3BC,MAAM,CAAEF,IAAI,IAAqBG,OAAO,CAACH,IAAI,CAAC,CAAC;EAEpD,IAAIF,KAAK,CAACM,MAAM,KAAK,CAAC,EAAE,OAAOC,SAAS;EACxC,IAAIP,KAAK,CAACM,MAAM,KAAK,CAAC,EAAE,OAAON,KAAK,CAAC,CAAC,CAAC;;EAEvC;EACA;EACA,MAAM,CAACQ,IAAI,EAAEC,IAAI,CAAC,GAAGT,KAAK;EAC1B,OAAO,SAAS,CAACU,IAAI,CAACF,IAAI,CAAC,GAAG,GAAGA,IAAI,IAAIC,IAAI,EAAE,GAAG,GAAGD,IAAI,KAAKC,IAAI,EAAE;AACxE","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.useLiveRegionAnnounce = useLiveRegionAnnounce;
8
+ var _react = require("react");
9
+ var _reactNative = require("react-native");
10
+ /**
11
+ * Announce a status message to assistive tech.
12
+ *
13
+ * Web expresses this declaratively with `aria-live` + `aria-atomic`. React
14
+ * Native splits it across platforms:
15
+ *
16
+ * - **Android** understands `accessibilityLiveRegion` on the view itself, so
17
+ * callers set that prop directly and this hook stays out of the way.
18
+ * - **iOS** has no live-region support. The only route is to hand the exact
19
+ * string to `announceForAccessibility`, which is what this does.
20
+ *
21
+ * Re-announces when the message changes, and skips repeats of the same string
22
+ * so a parent re-render does not interrupt the user twice with the same text.
23
+ */
24
+ function useLiveRegionAnnounce(message, enabled = true) {
25
+ const lastAnnounced = (0, _react.useRef)(undefined);
26
+ (0, _react.useEffect)(() => {
27
+ if (!enabled || !message) return;
28
+ // Android already announces via accessibilityLiveRegion; announcing
29
+ // again here would read the alert twice.
30
+ if (_reactNative.Platform.OS !== 'ios') return;
31
+ if (lastAnnounced.current === message) return;
32
+ lastAnnounced.current = message;
33
+ _reactNative.AccessibilityInfo.announceForAccessibility(message);
34
+ }, [message, enabled]);
35
+ }
36
+ var _default = exports.default = useLiveRegionAnnounce;
37
+ //# sourceMappingURL=useLiveRegion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","useLiveRegionAnnounce","message","enabled","lastAnnounced","useRef","undefined","useEffect","Platform","OS","current","AccessibilityInfo","announceForAccessibility","_default","exports","default"],"sourceRoot":"../../../src","sources":["a11y/useLiveRegion.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,qBAAqBA,CACjCC,OAA2B,EAC3BC,OAAO,GAAG,IAAI,EACV;EACJ,MAAMC,aAAa,GAAG,IAAAC,aAAM,EAAqBC,SAAS,CAAC;EAE3D,IAAAC,gBAAS,EAAC,MAAM;IACZ,IAAI,CAACJ,OAAO,IAAI,CAACD,OAAO,EAAE;IAC1B;IACA;IACA,IAAIM,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IAC3B,IAAIL,aAAa,CAACM,OAAO,KAAKR,OAAO,EAAE;IAEvCE,aAAa,CAACM,OAAO,GAAGR,OAAO;IAC/BS,8BAAiB,CAACC,wBAAwB,CAACV,OAAO,CAAC;EACvD,CAAC,EAAE,CAACA,OAAO,EAAEC,OAAO,CAAC,CAAC;AAC1B;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcd,qBAAqB","ignoreList":[]}