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,121 @@
1
+ "use strict";
2
+
3
+ import { forwardRef, useMemo } from 'react';
4
+ import { ButtonV2Size, ButtonV2State, ButtonV2SubType, ButtonV2Type } from '@juspay/blend-design-system/node';
5
+ import { useNativeTokens } from "../../theme/useNativeTokens.js";
6
+ import { Pressable } from "../../primitives/Pressable.js";
7
+ import { Slot } from "../../primitives/Slot.js";
8
+ import { Text } from "../../primitives/Text.js";
9
+ import { getButtonNativeStyles, getIconMaxHeight, getLoaderSize } from "./button.utils.js";
10
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
+ /**
12
+ * Button — React Native implementation of web's `ButtonV2`.
13
+ *
14
+ * Imports only from `@juspay/blend-design-system/node` (the React-free token
15
+ * entry), the local adapters, and the local primitives — never from web's
16
+ * `context/`, `hooks/`, or `Primitives/` directories.
17
+ *
18
+ * Tokens resolve through `useNativeTokens('BUTTONV2')`, which reads theme and
19
+ * per-slot overrides from `BlendNativeProvider`. This replaces the earlier
20
+ * per-component `theme` prop, which offered no app-wide dark mode, no nested
21
+ * theme scopes, and no `componentTokens` overrides.
22
+ */
23
+ const Button = /*#__PURE__*/forwardRef(function Button({
24
+ buttonType = ButtonV2Type.PRIMARY,
25
+ size = ButtonV2Size.SMALL,
26
+ subType = ButtonV2SubType.DEFAULT,
27
+ text,
28
+ leftSlot,
29
+ rightSlot,
30
+ loading = false,
31
+ disabled = false,
32
+ state = ButtonV2State.DEFAULT,
33
+ buttonGroupPosition,
34
+ width,
35
+ minWidth,
36
+ maxWidth,
37
+ justifyContent = 'center',
38
+ onPress,
39
+ testID,
40
+ accessibilityLabel,
41
+ style,
42
+ ...rest
43
+ }, ref) {
44
+ const tokens = useNativeTokens('BUTTONV2');
45
+ const styles = useMemo(() => getButtonNativeStyles(disabled, buttonType, subType, size, state, tokens, buttonGroupPosition), [disabled, buttonType, subType, size, state, tokens, buttonGroupPosition]);
46
+ const iconMaxHeights = getIconMaxHeight(subType, leftSlot?.maxHeight, rightSlot?.maxHeight, tokens.slotMaxHeight[size]);
47
+
48
+ // Icon colour tracks the resolved text colour for the current state, and
49
+ // is handed to the icon element explicitly by `Slot` — RN has no
50
+ // `currentColor` inheritance the way web's `Block` relies on.
51
+ const iconColor = styles.textColor;
52
+ const loaderColor = String(tokens.text.color[buttonType][subType].default ?? '#2563EB');
53
+ const content = /*#__PURE__*/_jsxs(_Fragment, {
54
+ children: [leftSlot?.slot ? /*#__PURE__*/_jsx(Slot, {
55
+ color: iconColor,
56
+ maxHeight: iconMaxHeights.left,
57
+ hidden: Boolean(text),
58
+ testID: testID ? `${testID}-left-slot` : undefined,
59
+ children: leftSlot.slot
60
+ }) : null, text ? /*#__PURE__*/_jsx(Text, {
61
+ fontSize: tokens.text.fontSize[size],
62
+ fontWeight: tokens.text.fontWeight[size],
63
+ lineHeight: tokens.text.lineHeight?.[size],
64
+ color: styles.textColor,
65
+ textAlign: "center",
66
+ children: text
67
+ }) : null, rightSlot?.slot ? /*#__PURE__*/_jsx(Slot, {
68
+ color: iconColor,
69
+ maxHeight: iconMaxHeights.right,
70
+ hidden: Boolean(text),
71
+ testID: testID ? `${testID}-right-slot` : undefined,
72
+ children: rightSlot.slot
73
+ }) : null]
74
+ });
75
+ return /*#__PURE__*/_jsx(Pressable, {
76
+ ref: ref,
77
+ background: styles.background,
78
+ activeBackground: styles.activeBackground,
79
+ disabledBackground: styles.disabledBackground,
80
+ border: styles.border,
81
+ activeBorder: styles.activeBorder,
82
+ disabledBorder: styles.disabledBorder,
83
+ borderRadius: styles.borderRadius,
84
+ boxShadow: styles.boxShadow,
85
+ activeBoxShadow: styles.activeBoxShadow,
86
+ paddingTop: styles.padding.top,
87
+ paddingRight: styles.padding.right,
88
+ paddingBottom: styles.padding.bottom,
89
+ paddingLeft: styles.padding.left,
90
+ flexDirection: "row",
91
+ alignItems: "center",
92
+ justifyContent: justifyContent,
93
+ gap: styles.gap
94
+ // Web defaults to `width: fit-content`; `auto` is RN's equivalent.
95
+ ,
96
+ width: width ?? 'auto',
97
+ minWidth: minWidth,
98
+ maxWidth: maxWidth,
99
+ height: styles.height,
100
+ disabled: disabled,
101
+ loading: loading,
102
+ loaderColor: loaderColor,
103
+ loaderSize: getLoaderSize(size),
104
+ onPress: onPress,
105
+ testID: testID,
106
+ accessibilityLabel: accessibilityLabel ?? text,
107
+ accessibilityRole: "button"
108
+ // Grouped members drop their shared edges; spread after the
109
+ // resolved surface so `borderWidth` still covers the other sides.
110
+ ,
111
+ style: {
112
+ ...styles.groupBorderWidths,
113
+ ...style
114
+ },
115
+ ...rest,
116
+ children: content
117
+ });
118
+ });
119
+ Button.displayName = 'Button';
120
+ export default Button;
121
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","useMemo","ButtonV2Size","ButtonV2State","ButtonV2SubType","ButtonV2Type","useNativeTokens","Pressable","Slot","Text","getButtonNativeStyles","getIconMaxHeight","getLoaderSize","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Button","buttonType","PRIMARY","size","SMALL","subType","DEFAULT","text","leftSlot","rightSlot","loading","disabled","state","buttonGroupPosition","width","minWidth","maxWidth","justifyContent","onPress","testID","accessibilityLabel","style","rest","ref","tokens","styles","iconMaxHeights","maxHeight","slotMaxHeight","iconColor","textColor","loaderColor","String","color","default","content","children","slot","left","hidden","Boolean","undefined","fontSize","fontWeight","lineHeight","textAlign","right","background","activeBackground","disabledBackground","border","activeBorder","disabledBorder","borderRadius","boxShadow","activeBoxShadow","paddingTop","padding","top","paddingRight","paddingBottom","bottom","paddingLeft","flexDirection","alignItems","gap","height","loaderSize","accessibilityRole","groupBorderWidths","displayName"],"sourceRoot":"../../../../src","sources":["components/Button/Button.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAE3C,SACIC,YAAY,EACZC,aAAa,EACbC,eAAe,EACfC,YAAY,QAET,kCAAkC;AACzC,SAASC,eAAe,QAAQ,gCAA6B;AAC7D,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SAASC,IAAI,QAAQ,0BAAuB;AAC5C,SACIC,qBAAqB,EACrBC,gBAAgB,EAChBC,aAAa,QACV,mBAAgB;AAAA,SAAAC,GAAA,IAAA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M,CAACsE,WAAW,GAAG,QAAQ;AAE7B,eAAetE,MAAM","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=button.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Button/button.types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ import { ButtonV2Size, ButtonV2State, ButtonV2SubType, PaddingDirection } from '@juspay/blend-design-system/node';
4
+ import { getGroupedBorderRadius, getGroupedBorderWidths } from "../shared/group.js";
5
+
6
+ /**
7
+ * Native ButtonV2 style resolver.
8
+ *
9
+ * Reimplements `packages/blend/lib/components/ButtonV2/utils.ts` for RN. Web
10
+ * builds a `ButtonStylesReturn` carrying `_active` / `_hover` /
11
+ * `_focusVisible` / `_disabled` pseudo-state maps; RN has no pseudo-selectors,
12
+ * so this returns the token strings per state and lets `Pressable` compose
13
+ * them against `{ pressed }`.
14
+ *
15
+ * `_hover` and `_focusVisible` have no native counterpart and are dropped.
16
+ */
17
+
18
+ /**
19
+ * Resolve padding tokens per direction.
20
+ * Mirrors `getButtonPadding` in web `utils.ts`.
21
+ */
22
+ export function getButtonPadding(size, buttonType, subType, tokens) {
23
+ return {
24
+ top: String(tokens.padding[PaddingDirection.TOP][size][buttonType][subType]),
25
+ right: String(tokens.padding[PaddingDirection.RIGHT][size][buttonType][subType]),
26
+ bottom: String(tokens.padding[PaddingDirection.BOTTOM][size][buttonType][subType]),
27
+ left: String(tokens.padding[PaddingDirection.LEFT][size][buttonType][subType])
28
+ };
29
+ }
30
+
31
+ /**
32
+ * Resolve the border radius, collapsing joined edges inside a button group.
33
+ *
34
+ * Mirrors `getButtonV2BorderRadius` in web `utils.ts`. The collapsing itself
35
+ * lives in `shared/group` because Tag needs the same algorithm.
36
+ */
37
+ export function getButtonV2BorderRadius(size, buttonType, subType, buttonGroupPosition, tokens) {
38
+ return getGroupedBorderRadius(tokens.borderRadius[size][buttonType][subType], buttonGroupPosition);
39
+ }
40
+
41
+ /**
42
+ * Resolve the max height for each icon slot.
43
+ *
44
+ * Mirrors `getIconMaxHeight` in web `utils.ts`, including both behaviours
45
+ * that were previously missing on native: the inline subType stretches slots
46
+ * to `100%`, and a per-slot `maxHeight` overrides the size-derived default.
47
+ */
48
+ export function getIconMaxHeight(subType, leftSlotMaxHeight, rightSlotMaxHeight, defaultMaxHeight) {
49
+ if (subType === ButtonV2SubType.INLINE) {
50
+ return {
51
+ left: '100%',
52
+ right: '100%'
53
+ };
54
+ }
55
+ return {
56
+ left: leftSlotMaxHeight ?? defaultMaxHeight,
57
+ right: rightSlotMaxHeight ?? defaultMaxHeight
58
+ };
59
+ }
60
+
61
+ /**
62
+ * Height override for the inline subType.
63
+ * Mirrors `getButtonHeight` in web `utils.ts` (`fit-content` → RN `auto`).
64
+ */
65
+ export function getButtonHeight(subType) {
66
+ return subType === ButtonV2SubType.INLINE ? 'auto' : undefined;
67
+ }
68
+
69
+ /**
70
+ * Spinner size for the current button size.
71
+ *
72
+ * Web maps these to explicit pixel sizes (16/18/20 for sm/md/lg) so the
73
+ * loader never overflows a small button; RN's `ActivityIndicator` accepts a
74
+ * number on both platforms.
75
+ */
76
+ export function getLoaderSize(size) {
77
+ const loaderSizeMap = {
78
+ [ButtonV2Size.SMALL]: 16,
79
+ [ButtonV2Size.MEDIUM]: 18,
80
+ [ButtonV2Size.LARGE]: 20
81
+ };
82
+ return loaderSizeMap[size] ?? 16;
83
+ }
84
+
85
+ /**
86
+ * Resolve the text/icon colour for the current state.
87
+ * Mirrors `getTextColor` in web `utils.ts`.
88
+ */
89
+ export function getTextColor(disabled, state, buttonType, subType, tokens) {
90
+ const color = tokens.text.color[buttonType][subType][disabled ? ButtonV2State.DISABLED : state];
91
+ return color ? String(color) : 'transparent';
92
+ }
93
+
94
+ /**
95
+ * Compute the full native style set for a button.
96
+ *
97
+ * The native equivalent of `getButtonStyles` in web `utils.ts`.
98
+ */
99
+ export function getButtonNativeStyles(isDisabled, buttonType, subType, size, state, tokens, buttonGroupPosition) {
100
+ const bg = tokens.backgroundColor[buttonType][subType];
101
+ const borders = tokens.border[buttonType][subType];
102
+ const shadows = tokens.shadow[buttonType][subType];
103
+ return {
104
+ background: String(bg.default),
105
+ activeBackground: String(bg.active),
106
+ disabledBackground: String(bg.disabled),
107
+ border: String(borders.default),
108
+ activeBorder: String(borders?.active ?? ''),
109
+ disabledBorder: String(borders?.disabled ?? ''),
110
+ boxShadow: String(shadows.default),
111
+ activeBoxShadow: String(shadows?.active ?? 'none'),
112
+ textColor: getTextColor(isDisabled, state, buttonType, subType, tokens),
113
+ padding: getButtonPadding(size, buttonType, subType, tokens),
114
+ gap: String(tokens.gap),
115
+ groupBorderWidths: getGroupedBorderWidths(buttonGroupPosition),
116
+ borderRadius: getButtonV2BorderRadius(size, buttonType, subType, buttonGroupPosition, tokens),
117
+ height: getButtonHeight(subType)
118
+ };
119
+ }
120
+ //# sourceMappingURL=button.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ButtonV2Size","ButtonV2State","ButtonV2SubType","PaddingDirection","getGroupedBorderRadius","getGroupedBorderWidths","getButtonPadding","size","buttonType","subType","tokens","top","String","padding","TOP","right","RIGHT","bottom","BOTTOM","left","LEFT","getButtonV2BorderRadius","buttonGroupPosition","borderRadius","getIconMaxHeight","leftSlotMaxHeight","rightSlotMaxHeight","defaultMaxHeight","INLINE","getButtonHeight","undefined","getLoaderSize","loaderSizeMap","SMALL","MEDIUM","LARGE","getTextColor","disabled","state","color","text","DISABLED","getButtonNativeStyles","isDisabled","bg","backgroundColor","borders","border","shadows","shadow","background","default","activeBackground","active","disabledBackground","activeBorder","disabledBorder","boxShadow","activeBoxShadow","textColor","gap","groupBorderWidths","height"],"sourceRoot":"../../../../src","sources":["components/Button/button.utils.ts"],"mappings":";;AACA,SACIA,YAAY,EACZC,aAAa,EACbC,eAAe,EAEfC,gBAAgB,QAEb,kCAAkC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List":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export { default as Button } from "./Button.js";
4
+ export { getButtonNativeStyles, getButtonPadding, getButtonV2BorderRadius, getButtonHeight, getIconMaxHeight, getLoaderSize, getTextColor } from "./button.utils.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","Button","getButtonNativeStyles","getButtonPadding","getButtonV2BorderRadius","getButtonHeight","getIconMaxHeight","getLoaderSize","getTextColor"],"sourceRoot":"../../../../src","sources":["components/Button/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,MAAM,QAAQ,aAAU;AAE5C,SACIC,qBAAqB,EACrBC,gBAAgB,EAChBC,uBAAuB,EACvBC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,EACbC,YAAY,QACT,mBAAgB","ignoreList":[]}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+
3
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
4
+ import { StyleSheet, View } from 'react-native';
5
+ import Animated, { Easing, cancelAnimation, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
6
+ import { useNativeTokens } from "../../theme/useNativeTokens.js";
7
+ import { useReduceMotion } from "../../motion/useReduceMotion.js";
8
+ import { LinearGradient } from "../../adapters/optionalGradient.js";
9
+ import { parseSize } from "../../adapters/cssStringAdapter.js";
10
+ import { resolveSkeletonDuration, resolveSkeletonRadius } from "./skeleton.utils.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ /**
13
+ * Skeleton — React Native implementation of web's `Skeleton`, resolving the
14
+ * same themed `SKELETON` token slot (base/highlight colours, duration).
15
+ *
16
+ * Two usages, matching web:
17
+ *
18
+ * - **Block**: `<Skeleton width={120} height={16} />` — a placeholder box.
19
+ * - **Wrap**: `<Skeleton>{content}</Skeleton>` — the content keeps its
20
+ * layout but renders invisible, with the skeleton surface painted over
21
+ * it. This is what restores the `skeleton` prop parity on Button and Tag.
22
+ *
23
+ * Variants: `pulse` animates opacity between highlight and base; `wave` and
24
+ * `shimmer` sweep a highlight gradient across the box (requiring the
25
+ * optional `expo-linear-gradient` — absent, they degrade to pulse; web's
26
+ * `::after` sweep has no other RN expression). OS reduce-motion renders a
27
+ * static base-coloured box.
28
+ *
29
+ * Hidden from assistive tech: a skeleton is a visual placeholder, and the
30
+ * owning component announces its loading state (the Button/Alert pattern).
31
+ */
32
+ const SkeletonImpl = ({
33
+ variant = 'pulse',
34
+ shape = 'rectangle',
35
+ width,
36
+ height,
37
+ borderRadius,
38
+ children,
39
+ style,
40
+ testID
41
+ }) => {
42
+ const tokens = useNativeTokens('SKELETON');
43
+ const reduceMotion = useReduceMotion();
44
+ const duration = resolveSkeletonDuration(tokens);
45
+ const baseColor = String(tokens.colors.base);
46
+ const highlightColor = String(tokens.colors.highlight);
47
+ const radius = borderRadius ?? resolveSkeletonRadius(shape, tokens, width, height);
48
+
49
+ // Sweep needs the measured box; pulse does not.
50
+ const [measuredWidth, setMeasuredWidth] = useState(0);
51
+ const onLayout = useCallback(event => {
52
+ setMeasuredWidth(event.nativeEvent.layout.width);
53
+ }, []);
54
+ const canSweep = (variant === 'wave' || variant === 'shimmer') && LinearGradient !== null && !reduceMotion;
55
+ const pulses = !reduceMotion && !canSweep;
56
+ const progress = useSharedValue(0);
57
+ useEffect(() => {
58
+ if (reduceMotion) {
59
+ cancelAnimation(progress);
60
+ progress.value = 0;
61
+ return;
62
+ }
63
+ progress.value = 0;
64
+ progress.value = withRepeat(withTiming(1, {
65
+ duration,
66
+ easing: Easing.inOut(Easing.ease)
67
+ }), -1,
68
+ // Pulse breathes in and out; the sweep restarts from the left.
69
+ !canSweep);
70
+ return () => cancelAnimation(progress);
71
+ }, [progress, duration, reduceMotion, canSweep]);
72
+ const pulseStyle = useAnimatedStyle(() => ({
73
+ opacity: pulses ? 1 - progress.value * 0.5 : 1
74
+ }), [pulses]);
75
+ const sweepStyle = useAnimatedStyle(() => ({
76
+ transform: [{
77
+ translateX: canSweep ? -measuredWidth + progress.value * 2 * measuredWidth : 0
78
+ }]
79
+ }), [canSweep, measuredWidth]);
80
+ const boxStyle = useMemo(() => ({
81
+ backgroundColor: baseColor,
82
+ borderRadius: radius,
83
+ overflow: 'hidden',
84
+ ...(children ? null : {
85
+ width: parseSize(width) ?? undefined,
86
+ height: parseSize(height) ?? undefined
87
+ })
88
+ }), [baseColor, radius, children, width, height]);
89
+ const surface = /*#__PURE__*/_jsx(Animated.View, {
90
+ pointerEvents: "none",
91
+ onLayout: canSweep ? onLayout : undefined,
92
+ style: [children ? styles.fill : null, boxStyle, pulseStyle],
93
+ testID: testID ? `${testID}-surface` : undefined,
94
+ children: canSweep && measuredWidth > 0 && LinearGradient ? /*#__PURE__*/_jsx(Animated.View, {
95
+ style: [StyleSheet.absoluteFill, sweepStyle],
96
+ children: /*#__PURE__*/_jsx(LinearGradient, {
97
+ colors: [baseColor, highlightColor, baseColor],
98
+ locations: [0.2, 0.5, 0.8],
99
+ start: {
100
+ x: 0,
101
+ y: 0.5
102
+ },
103
+ end: {
104
+ x: 1,
105
+ y: 0.5
106
+ },
107
+ style: styles.fill
108
+ })
109
+ }) : null
110
+ });
111
+ if (!children) {
112
+ return /*#__PURE__*/_jsx(View, {
113
+ testID: testID,
114
+ style: style,
115
+ accessible: false,
116
+ importantForAccessibility: "no-hide-descendants",
117
+ accessibilityElementsHidden: true,
118
+ children: surface
119
+ });
120
+ }
121
+ return /*#__PURE__*/_jsxs(View, {
122
+ testID: testID,
123
+ style: style,
124
+ pointerEvents: "none",
125
+ accessible: false,
126
+ importantForAccessibility: "no-hide-descendants",
127
+ accessibilityElementsHidden: true,
128
+ children: [/*#__PURE__*/_jsx(View, {
129
+ style: styles.hiddenContent,
130
+ children: children
131
+ }), surface]
132
+ });
133
+ };
134
+ export const Skeleton = /*#__PURE__*/React.memo(SkeletonImpl);
135
+ Skeleton.displayName = 'Skeleton';
136
+ const styles = StyleSheet.create({
137
+ hiddenContent: {
138
+ opacity: 0
139
+ },
140
+ fill: {
141
+ position: 'absolute',
142
+ top: 0,
143
+ right: 0,
144
+ bottom: 0,
145
+ left: 0
146
+ }
147
+ });
148
+ export default Skeleton;
149
+ //# sourceMappingURL=Skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useEffect","useMemo","useState","StyleSheet","View","Animated","Easing","cancelAnimation","useAnimatedStyle","useSharedValue","withRepeat","withTiming","useNativeTokens","useReduceMotion","LinearGradient","parseSize","resolveSkeletonDuration","resolveSkeletonRadius","jsx","_jsx","jsxs","_jsxs","SkeletonImpl","variant","shape","width","height","borderRadius","children","style","testID","tokens","reduceMotion","duration","baseColor","String","colors","base","highlightColor","highlight","radius","measuredWidth","setMeasuredWidth","onLayout","event","nativeEvent","layout","canSweep","pulses","progress","value","easing","inOut","ease","pulseStyle","opacity","sweepStyle","transform","translateX","boxStyle","backgroundColor","overflow","undefined","surface","pointerEvents","styles","fill","absoluteFill","locations","start","x","y","end","accessible","importantForAccessibility","accessibilityElementsHidden","hiddenContent","Skeleton","memo","displayName","create","position","top","right","bottom","left"],"sourceRoot":"../../../../src","sources":["components/Skeleton/Skeleton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACxE,SACIC,UAAU,EACVC,IAAI,QAGD,cAAc;AACrB,OAAOC,QAAQ,IACXC,MAAM,EACNC,eAAe,EACfC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACP,yBAAyB;AAMhC,SAASC,eAAe,QAAQ,gCAA6B;AAC7D,SAASC,eAAe,QAAQ,iCAA8B;AAC9D,SAASC,cAAc,QAAQ,oCAAiC;AAChE,SAASC,SAAS,QAAQ,oCAAiC;AAC3D,SACIC,uBAAuB,EACvBC,qBAAqB,QAClB,qBAAkB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;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D0B,MAAM,EAAEA,MAAO;IACfD,KAAK,EAAEA,KAAM;IACbmC,aAAa,EAAC,MAAM;IACpBS,UAAU,EAAE,KAAM;IAClBC,yBAAyB,EAAC,qBAAqB;IAC/CC,2BAA2B;IAAA/C,QAAA,gBAG3BT,IAAA,CAACf,IAAI;MAACyB,KAAK,EAAEoC,MAAM,CAACW,aAAc;MAAAhD,QAAA,EAAEA;IAAQ,CAAO,CAAC,EACnDmC,OAAO;EAAA,CACN,CAAC;AAEf,CAAC;AAED,OAAO,MAAMc,QAAQ,gBAAG/E,KAAK,CAACgF,IAAI,CAACxD,YAAY,CAAC;AAChDuD,QAAQ,CAACE,WAAW,GAAG,UAAU;AAEjC,MAAMd,MAAM,GAAG9D,UAAU,CAAC6E,MAAM,CAAC;EAC7BJ,aAAa,EAAE;IAAErB,OAAO,EAAE;EAAE,CAAC;EAC7BW,IAAI,EAAE;IAAEe,QAAQ,EAAE,UAAU;IAAEC,GAAG,EAAE,CAAC;IAAEC,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE,CAAC;IAAEC,IAAI,EAAE;EAAE;AACvE,CAAC,CAAC;AAEF,eAAeR,QAAQ","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { Skeleton, default } from "./Skeleton.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Skeleton","default"],"sourceRoot":"../../../../src","sources":["components/Skeleton/index.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,eAAY","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=skeleton.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Skeleton/skeleton.types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ import { parseBorderRadius, parseDuration, parseSize } from "../../adapters/cssStringAdapter.js";
4
+
5
+ /**
6
+ * Pure resolution for the native Skeleton — vitest-testable, worklet-free.
7
+ */
8
+
9
+ /** Default when the token duration cannot be parsed. */
10
+ export const SKELETON_FALLBACK_DURATION = 1500;
11
+
12
+ /**
13
+ * Animation cycle length in milliseconds, from the token's CSS duration
14
+ * string (`"1.5s"`).
15
+ */
16
+ export function resolveSkeletonDuration(tokens) {
17
+ return parseDuration(tokens.animation.duration) ?? SKELETON_FALLBACK_DURATION;
18
+ }
19
+
20
+ /**
21
+ * Border radius for a shape.
22
+ *
23
+ * The `circle` token is CSS `"50%"`, which RN cannot express — a circle
24
+ * needs a numeric radius of half the box. When the box size is unknown
25
+ * (string sizes, wrap mode) a large radius produces the same pill/circle
26
+ * silhouette, the same trick web's `radius.full` relies on.
27
+ */
28
+ export function resolveSkeletonRadius(shape, tokens, width, height) {
29
+ if (shape === 'circle') {
30
+ const w = typeof width === 'number' ? width : parseSize(String(width));
31
+ const h = typeof height === 'number' ? height : parseSize(String(height));
32
+ if (typeof w === 'number' && typeof h === 'number') {
33
+ return Math.min(w, h) / 2;
34
+ }
35
+ return 9999;
36
+ }
37
+ const parsed = parseBorderRadius(tokens.borderRadius[shape]);
38
+ return typeof parsed === 'number' ? parsed : 0;
39
+ }
40
+ //# sourceMappingURL=skeleton.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["parseBorderRadius","parseDuration","parseSize","SKELETON_FALLBACK_DURATION","resolveSkeletonDuration","tokens","animation","duration","resolveSkeletonRadius","shape","width","height","w","String","h","Math","min","parsed","borderRadius"],"sourceRoot":"../../../../src","sources":["components/Skeleton/skeleton.utils.ts"],"mappings":";;AAIA,SACIA,iBAAiB,EACjBC,aAAa,EACbC,SAAS,QACN,oCAAiC;;AAExC;AACA;AACA;;AAEA;AACA,OAAO,MAAMC,0BAA0B,GAAG,IAAI;;AAE9C;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,MAA0B,EAAU;EACxE,OACIJ,aAAa,CAACI,MAAM,CAACC,SAAS,CAACC,QAA2B,CAAC,IAC3DJ,0BAA0B;AAElC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,qBAAqBA,CACjCC,KAAoB,EACpBJ,MAA0B,EAC1BK,KAAuB,EACvBC,MAAwB,EAClB;EACN,IAAIF,KAAK,KAAK,QAAQ,EAAE;IACpB,MAAMG,CAAC,GAAG,OAAOF,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAGR,SAAS,CAACW,MAAM,CAACH,KAAK,CAAC,CAAC;IACtE,MAAMI,CAAC,GACH,OAAOH,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAGT,SAAS,CAACW,MAAM,CAACF,MAAM,CAAC,CAAC;IACnE,IAAI,OAAOC,CAAC,KAAK,QAAQ,IAAI,OAAOE,CAAC,KAAK,QAAQ,EAAE;MAChD,OAAOC,IAAI,CAACC,GAAG,CAACJ,CAAC,EAAEE,CAAC,CAAC,GAAG,CAAC;IAC7B;IACA,OAAO,IAAI;EACf;EACA,MAAMG,MAAM,GAAGjB,iBAAiB,CAC5BK,MAAM,CAACa,YAAY,CAACT,KAAK,CAC7B,CAAC;EACD,OAAO,OAAOQ,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,CAAC;AAClD","ignoreList":[]}