@app-studio/components 0.12.0 → 0.12.1

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 (335) hide show
  1. package/README.md +1 -1
  2. package/dist/alert.cjs.js +1 -1
  3. package/dist/alert.esm.mjs +1 -1
  4. package/dist/avatar.cjs.js +1 -1
  5. package/dist/avatar.esm.mjs +1 -1
  6. package/dist/button.cjs.js +1 -1
  7. package/dist/button.esm.mjs +1 -1
  8. package/dist/card.cjs.js +1 -1
  9. package/dist/card.esm.mjs +1 -1
  10. package/dist/checkbox.cjs.js +1 -1
  11. package/dist/checkbox.esm.mjs +1 -1
  12. package/dist/chunks/{Alert-Q1HlVX8f.mjs → Alert-B5vkpWXy.mjs} +55 -42
  13. package/dist/chunks/Alert-B5vkpWXy.mjs.map +1 -0
  14. package/dist/chunks/Alert-BHlgJZAo.cjs +2 -0
  15. package/dist/chunks/Alert-BHlgJZAo.cjs.map +1 -0
  16. package/dist/chunks/{AttachmentPreview-8d8gZ5kk.mjs → AttachmentPreview-B2-kP0Bn.mjs} +1745 -2997
  17. package/dist/chunks/AttachmentPreview-B2-kP0Bn.mjs.map +1 -0
  18. package/dist/chunks/AttachmentPreview-BZV6xSa4.cjs +2 -0
  19. package/dist/chunks/AttachmentPreview-BZV6xSa4.cjs.map +1 -0
  20. package/dist/chunks/{Avatar-D-GkyL2c.mjs → Avatar-CC1SDq6h.mjs} +34 -32
  21. package/dist/chunks/Avatar-CC1SDq6h.mjs.map +1 -0
  22. package/dist/chunks/Avatar-DtfD7QQ6.cjs +2 -0
  23. package/dist/chunks/Avatar-DtfD7QQ6.cjs.map +1 -0
  24. package/dist/chunks/Button.core-BB25t8wB.cjs +7 -0
  25. package/dist/chunks/Button.core-BB25t8wB.cjs.map +1 -0
  26. package/dist/chunks/{Button.core-Bc5cSn_z.mjs → Button.core-oxCH_VTn.mjs} +236 -222
  27. package/dist/chunks/Button.core-oxCH_VTn.mjs.map +1 -0
  28. package/dist/chunks/Button.pilot-BJK10U1-.mjs +6 -0
  29. package/dist/chunks/{Button.pilot-C4BIb08S.mjs.map → Button.pilot-BJK10U1-.mjs.map} +1 -1
  30. package/dist/chunks/Button.pilot-eWGY9Jm5.cjs +2 -0
  31. package/dist/chunks/{Button.pilot-JmR2DCSE.cjs.map → Button.pilot-eWGY9Jm5.cjs.map} +1 -1
  32. package/dist/chunks/Card-CK_D7gzP.cjs +2 -0
  33. package/dist/chunks/Card-CK_D7gzP.cjs.map +1 -0
  34. package/dist/chunks/Card-ymI5Thma.mjs +208 -0
  35. package/dist/chunks/Card-ymI5Thma.mjs.map +1 -0
  36. package/dist/chunks/Checkbox-BXbEChdd.cjs +2 -0
  37. package/dist/chunks/Checkbox-BXbEChdd.cjs.map +1 -0
  38. package/dist/chunks/Checkbox-DnwrApdj.mjs +21 -0
  39. package/dist/chunks/Checkbox-DnwrApdj.mjs.map +1 -0
  40. package/dist/chunks/Checkbox.view-B7K8ycvs.cjs +2 -0
  41. package/dist/chunks/Checkbox.view-B7K8ycvs.cjs.map +1 -0
  42. package/dist/chunks/{Checkbox.view-dhc-rfEX.mjs → Checkbox.view-CCGfVtqr.mjs} +140 -119
  43. package/dist/chunks/Checkbox.view-CCGfVtqr.mjs.map +1 -0
  44. package/dist/chunks/{Formik.Uploader-DRIyxMI0.mjs → Formik.Uploader-CIYySBWB.mjs} +18 -18
  45. package/dist/chunks/{Formik.Uploader-DRIyxMI0.mjs.map → Formik.Uploader-CIYySBWB.mjs.map} +1 -1
  46. package/dist/chunks/{Formik.Uploader-D0nzjyau.cjs → Formik.Uploader-DePTdd7A.cjs} +4 -4
  47. package/dist/chunks/{Formik.Uploader-D0nzjyau.cjs.map → Formik.Uploader-DePTdd7A.cjs.map} +1 -1
  48. package/dist/chunks/{Icon-DrAZswNH.mjs → Icon-Cy5kEVYz.mjs} +60 -60
  49. package/dist/chunks/{Icon-DrAZswNH.mjs.map → Icon-Cy5kEVYz.mjs.map} +1 -1
  50. package/dist/chunks/Modal-BzlrQQu5.cjs +2 -0
  51. package/dist/chunks/Modal-BzlrQQu5.cjs.map +1 -0
  52. package/dist/chunks/{Modal-DkckCT8-.mjs → Modal-CqbUQXoc.mjs} +92 -75
  53. package/dist/chunks/Modal-CqbUQXoc.mjs.map +1 -0
  54. package/dist/chunks/Select-CrOxhfvQ.mjs +28 -0
  55. package/dist/chunks/Select-CrOxhfvQ.mjs.map +1 -0
  56. package/dist/chunks/Select-DRMUC3NX.cjs +2 -0
  57. package/dist/chunks/Select-DRMUC3NX.cjs.map +1 -0
  58. package/dist/chunks/{Select.view-CPMqT8pn.mjs → Select.view-BHMiRNIc.mjs} +126 -124
  59. package/dist/chunks/Select.view-BHMiRNIc.mjs.map +1 -0
  60. package/dist/chunks/Select.view-BV01zWHM.cjs +2 -0
  61. package/dist/chunks/Select.view-BV01zWHM.cjs.map +1 -0
  62. package/dist/chunks/{Switch-DWx1g3jT.mjs → Switch-04GGHGrV.mjs} +2 -2
  63. package/dist/chunks/{Switch-DWx1g3jT.mjs.map → Switch-04GGHGrV.mjs.map} +1 -1
  64. package/dist/chunks/{Switch-D80yPNFV.cjs → Switch-DqgmPp8M.cjs} +2 -2
  65. package/dist/chunks/{Switch-D80yPNFV.cjs.map → Switch-DqgmPp8M.cjs.map} +1 -1
  66. package/dist/chunks/Switch.view-6ncV6Ifz.cjs +2 -0
  67. package/dist/chunks/Switch.view-6ncV6Ifz.cjs.map +1 -0
  68. package/dist/chunks/{Switch.view-QLZ7O5Z7.mjs → Switch.view-DUvFLhyy.mjs} +34 -39
  69. package/dist/chunks/Switch.view-DUvFLhyy.mjs.map +1 -0
  70. package/dist/chunks/Tabs-BdoE88Ee.mjs +567 -0
  71. package/dist/chunks/Tabs-BdoE88Ee.mjs.map +1 -0
  72. package/dist/chunks/Tabs-DneEt-le.cjs +2 -0
  73. package/dist/chunks/Tabs-DneEt-le.cjs.map +1 -0
  74. package/dist/chunks/{TextField-DOU2CL5J.mjs → TextField-Bwc_F2Rq.mjs} +97 -86
  75. package/dist/chunks/TextField-Bwc_F2Rq.mjs.map +1 -0
  76. package/dist/chunks/TextField-CwaxvcqN.cjs +2 -0
  77. package/dist/chunks/TextField-CwaxvcqN.cjs.map +1 -0
  78. package/dist/chunks/{default-nRKhMTzF.mjs → default-1F10zins.mjs} +2 -2
  79. package/dist/chunks/{default-nRKhMTzF.mjs.map → default-1F10zins.mjs.map} +1 -1
  80. package/dist/chunks/default-W-NMTEJ3.cjs +2 -0
  81. package/dist/chunks/default-W-NMTEJ3.cjs.map +1 -0
  82. package/dist/chunks/designSystem.page-BgmjSYsz.cjs +11 -0
  83. package/dist/chunks/designSystem.page-BgmjSYsz.cjs.map +1 -0
  84. package/dist/chunks/{designSystem.page-K0ajTvy7.mjs → designSystem.page-CM_h09Ui.mjs} +18 -16
  85. package/dist/chunks/designSystem.page-CM_h09Ui.mjs.map +1 -0
  86. package/dist/chunks/{FieldWrapper-Bb0j8Iog.mjs → useFieldDesignSystemProps-BZj7d9gK.mjs} +118 -87
  87. package/dist/chunks/useFieldDesignSystemProps-BZj7d9gK.mjs.map +1 -0
  88. package/dist/chunks/useFieldDesignSystemProps-CgVU3R10.cjs +2 -0
  89. package/dist/chunks/useFieldDesignSystemProps-CgVU3R10.cjs.map +1 -0
  90. package/dist/design-system-preview.cjs.js +1 -1
  91. package/dist/design-system-preview.esm.mjs +14 -14
  92. package/dist/formik.cjs.js +1 -1
  93. package/dist/formik.esm.mjs +2 -2
  94. package/dist/link.esm.mjs +1 -1
  95. package/dist/modal.cjs.js +1 -1
  96. package/dist/modal.esm.mjs +1 -1
  97. package/dist/native/components/ActionSheet/ActionSheet/ActionSheet.view.native.js +13 -5
  98. package/dist/native/components/ActionSheet/ActionSheet/ActionSheet.view.native.js.map +1 -1
  99. package/dist/native/components/Alert/Alert/Alert.view.d.ts +3 -1
  100. package/dist/native/components/Alert/Alert/Alert.view.js +16 -6
  101. package/dist/native/components/Alert/Alert/Alert.view.js.map +1 -1
  102. package/dist/native/components/Alert/Alert/Alert.view.native.d.ts +3 -1
  103. package/dist/native/components/Alert/Alert/Alert.view.native.js +15 -4
  104. package/dist/native/components/Alert/Alert/Alert.view.native.js.map +1 -1
  105. package/dist/native/components/Alert/Alert.js +3 -3
  106. package/dist/native/components/Alert/Alert.js.map +1 -1
  107. package/dist/native/components/Avatar/Avatar/Avatar.props.d.ts +1 -1
  108. package/dist/native/components/Avatar/Avatar/Avatar.state.d.ts +2 -2
  109. package/dist/native/components/Avatar/Avatar/Avatar.state.js +6 -5
  110. package/dist/native/components/Avatar/Avatar/Avatar.state.js.map +1 -1
  111. package/dist/native/components/Avatar/Avatar/Avatar.view.d.ts +1 -1
  112. package/dist/native/components/Avatar/Avatar/Avatar.view.js +2 -2
  113. package/dist/native/components/Avatar/Avatar/Avatar.view.js.map +1 -1
  114. package/dist/native/components/Avatar/Avatar.js +2 -2
  115. package/dist/native/components/Avatar/Avatar.js.map +1 -1
  116. package/dist/native/components/Button/Button/Button.style.js +11 -6
  117. package/dist/native/components/Button/Button/Button.style.js.map +1 -1
  118. package/dist/native/components/Button/Button/Button.view.d.ts +2 -0
  119. package/dist/native/components/Button/Button/Button.view.js +9 -3
  120. package/dist/native/components/Button/Button/Button.view.js.map +1 -1
  121. package/dist/native/components/Button/Button/Button.view.native.d.ts +1 -0
  122. package/dist/native/components/Button/Button/Button.view.native.js +19 -4
  123. package/dist/native/components/Button/Button/Button.view.native.js.map +1 -1
  124. package/dist/native/components/Button/Button.core.js +3 -3
  125. package/dist/native/components/Button/Button.core.js.map +1 -1
  126. package/dist/native/components/Card/Card/Card.view.d.ts +3 -1
  127. package/dist/native/components/Card/Card/Card.view.js +32 -24
  128. package/dist/native/components/Card/Card/Card.view.js.map +1 -1
  129. package/dist/native/components/Card/Card.js +3 -3
  130. package/dist/native/components/Card/Card.js.map +1 -1
  131. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.props.d.ts +1 -0
  132. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.state.d.ts +5 -1
  133. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.state.js +13 -0
  134. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.state.js.map +1 -1
  135. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.style.d.ts +3 -12
  136. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.style.js +3 -12
  137. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.style.js.map +1 -1
  138. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.js +19 -16
  139. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.js.map +1 -1
  140. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.native.js +36 -30
  141. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.native.js.map +1 -1
  142. package/dist/native/components/Form/Checkbox/Checkbox.js +3 -3
  143. package/dist/native/components/Form/Checkbox/Checkbox.js.map +1 -1
  144. package/dist/native/components/Form/DatePicker/DatePicker/DatePicker.state.js +8 -2
  145. package/dist/native/components/Form/DatePicker/DatePicker/DatePicker.state.js.map +1 -1
  146. package/dist/native/components/Form/Select/Select/Select.props.d.ts +1 -0
  147. package/dist/native/components/Form/Select/Select/Select.view.js +2 -2
  148. package/dist/native/components/Form/Select/Select/Select.view.js.map +1 -1
  149. package/dist/native/components/Form/Select/Select/Select.view.native.js +17 -4
  150. package/dist/native/components/Form/Select/Select/Select.view.native.js.map +1 -1
  151. package/dist/native/components/Form/Select/Select.js +3 -3
  152. package/dist/native/components/Form/Select/Select.js.map +1 -1
  153. package/dist/native/components/Form/Switch/Switch/Switch.style.d.ts +3 -8
  154. package/dist/native/components/Form/Switch/Switch/Switch.style.js +3 -8
  155. package/dist/native/components/Form/Switch/Switch/Switch.style.js.map +1 -1
  156. package/dist/native/components/Form/Switch/Switch/Switch.view.js +1 -5
  157. package/dist/native/components/Form/Switch/Switch/Switch.view.js.map +1 -1
  158. package/dist/native/components/Form/Switch/Switch/Switch.view.native.js +7 -4
  159. package/dist/native/components/Form/Switch/Switch/Switch.view.native.js.map +1 -1
  160. package/dist/native/components/Form/TextField/TextField/TextField.props.d.ts +1 -0
  161. package/dist/native/components/Form/TextField/TextField/TextField.view.js +2 -2
  162. package/dist/native/components/Form/TextField/TextField/TextField.view.js.map +1 -1
  163. package/dist/native/components/Form/TextField/TextField/TextField.view.native.js +9 -4
  164. package/dist/native/components/Form/TextField/TextField/TextField.view.native.js.map +1 -1
  165. package/dist/native/components/Form/TextField/TextField.js +3 -3
  166. package/dist/native/components/Form/TextField/TextField.js.map +1 -1
  167. package/dist/native/components/Input/FieldContent/FieldContent/FieldContent.props.d.ts +1 -0
  168. package/dist/native/components/Input/FieldContent/FieldContent.js +16 -3
  169. package/dist/native/components/Input/FieldContent/FieldContent.js.map +1 -1
  170. package/dist/native/components/Input/useFieldDesignSystemProps.d.ts +9 -0
  171. package/dist/native/components/Input/useFieldDesignSystemProps.js +15 -0
  172. package/dist/native/components/Input/useFieldDesignSystemProps.js.map +1 -0
  173. package/dist/native/components/Modal/Modal/Modal.props.d.ts +2 -0
  174. package/dist/native/components/Modal/Modal/Modal.view.js +6 -4
  175. package/dist/native/components/Modal/Modal/Modal.view.js.map +1 -1
  176. package/dist/native/components/Modal/Modal/Modal.view.native.js +5 -4
  177. package/dist/native/components/Modal/Modal/Modal.view.native.js.map +1 -1
  178. package/dist/native/components/Tabs/Tabs/TabHeader.d.ts +2 -0
  179. package/dist/native/components/Tabs/Tabs/TabHeader.js +7 -6
  180. package/dist/native/components/Tabs/Tabs/TabHeader.js.map +1 -1
  181. package/dist/native/components/Tabs/Tabs/Tabs.props.d.ts +10 -0
  182. package/dist/native/components/Tabs/Tabs/Tabs.state.d.ts +1 -0
  183. package/dist/native/components/Tabs/Tabs/Tabs.state.js +20 -43
  184. package/dist/native/components/Tabs/Tabs/Tabs.state.js.map +1 -1
  185. package/dist/native/components/Tabs/Tabs/Tabs.styles.d.ts +11 -0
  186. package/dist/native/components/Tabs/Tabs/Tabs.styles.js +7 -0
  187. package/dist/native/components/Tabs/Tabs/Tabs.styles.js.map +1 -0
  188. package/dist/native/components/Tabs/Tabs/Tabs.type.d.ts +4 -0
  189. package/dist/native/components/Tabs/Tabs/Tabs.view.js +146 -58
  190. package/dist/native/components/Tabs/Tabs/Tabs.view.js.map +1 -1
  191. package/dist/native/components/Tabs/Tabs/Tabs.view.native.js +83 -19
  192. package/dist/native/components/Tabs/Tabs/Tabs.view.native.js.map +1 -1
  193. package/dist/native/components/Tabs/Tabs.js +8 -8
  194. package/dist/native/components/Tabs/Tabs.js.map +1 -1
  195. package/dist/native/components/index.js +1 -1
  196. package/dist/native/components/index.js.map +1 -1
  197. package/dist/native/components/pilot/blocks/SettingsPanel.js +3 -1
  198. package/dist/native/components/pilot/blocks/SettingsPanel.js.map +1 -1
  199. package/dist/native/components/pilot/blocks/SignIn.js +3 -1
  200. package/dist/native/components/pilot/blocks/SignIn.js.map +1 -1
  201. package/dist/native/design-system/DesignSystemProvider.d.ts +1 -1
  202. package/dist/native/design-system/DesignSystemProvider.js +2 -2
  203. package/dist/native/design-system/DesignSystemProvider.js.map +1 -1
  204. package/dist/native/design-system/configs/default.json +1 -1
  205. package/dist/native/design-system/theme.d.ts +10 -1
  206. package/dist/native/design-system/theme.js +41 -12
  207. package/dist/native/design-system/theme.js.map +1 -1
  208. package/dist/native/design-system/types.d.ts +3 -9
  209. package/dist/native/design-system/utils.d.ts +5 -2
  210. package/dist/native/design-system/utils.js +42 -10
  211. package/dist/native/design-system/utils.js.map +1 -1
  212. package/dist/presets.cjs.js +1 -1
  213. package/dist/presets.esm.mjs +1 -1
  214. package/dist/registry/alert.json +13 -12
  215. package/dist/registry/avatar.json +15 -15
  216. package/dist/registry/button.json +14 -12
  217. package/dist/registry/card.json +13 -13
  218. package/dist/registry/checkbox.json +14 -11
  219. package/dist/registry/modal.json +8 -4
  220. package/dist/registry/registry.json +178 -78
  221. package/dist/registry/select.json +20 -12
  222. package/dist/registry/settings-panel.json +6 -2
  223. package/dist/registry/sign-in.json +6 -2
  224. package/dist/registry/switch.json +15 -15
  225. package/dist/registry/tabs.json +23 -18
  226. package/dist/registry/text-field.json +19 -11
  227. package/dist/registry/theme.json +71 -0
  228. package/dist/select.cjs.js +1 -1
  229. package/dist/select.esm.mjs +1 -1
  230. package/dist/settings-panel.cjs.js +1 -1
  231. package/dist/settings-panel.cjs.js.map +1 -1
  232. package/dist/settings-panel.esm.mjs +9 -9
  233. package/dist/settings-panel.esm.mjs.map +1 -1
  234. package/dist/sign-in.cjs.js +1 -1
  235. package/dist/sign-in.cjs.js.map +1 -1
  236. package/dist/sign-in.esm.mjs +15 -15
  237. package/dist/sign-in.esm.mjs.map +1 -1
  238. package/dist/switch.cjs.js +1 -1
  239. package/dist/switch.esm.mjs +1 -1
  240. package/dist/tabs.cjs.js +1 -1
  241. package/dist/tabs.esm.mjs +1 -1
  242. package/dist/text-field.cjs.js +1 -1
  243. package/dist/text-field.esm.mjs +1 -1
  244. package/dist/theme.cjs.js +1 -1
  245. package/dist/theme.cjs.js.map +1 -1
  246. package/dist/theme.esm.mjs +125 -72
  247. package/dist/theme.esm.mjs.map +1 -1
  248. package/dist/types/components/Alert/Alert/Alert.view.d.ts +3 -1
  249. package/dist/types/components/Avatar/Avatar/Avatar.props.d.ts +1 -1
  250. package/dist/types/components/Avatar/Avatar/Avatar.state.d.ts +2 -2
  251. package/dist/types/components/Avatar/Avatar/Avatar.view.d.ts +1 -1
  252. package/dist/types/components/Button/Button/Button.view.d.ts +2 -0
  253. package/dist/types/components/Card/Card/Card.view.d.ts +3 -1
  254. package/dist/types/components/Form/Checkbox/Checkbox/Checkbox.props.d.ts +1 -0
  255. package/dist/types/components/Form/Checkbox/Checkbox/Checkbox.state.d.ts +5 -1
  256. package/dist/types/components/Form/Checkbox/Checkbox/Checkbox.style.d.ts +3 -12
  257. package/dist/types/components/Form/Select/Select/Select.props.d.ts +1 -0
  258. package/dist/types/components/Form/Switch/Switch/Switch.style.d.ts +3 -8
  259. package/dist/types/components/Form/TextField/TextField/TextField.props.d.ts +1 -0
  260. package/dist/types/components/IconPicker/IconPicker/IconPicker.state.d.ts +2 -2
  261. package/dist/types/components/Input/FieldContent/FieldContent/FieldContent.props.d.ts +1 -0
  262. package/dist/types/components/Input/useFieldDesignSystemProps.d.ts +9 -0
  263. package/dist/types/components/Modal/Modal/Modal.props.d.ts +2 -0
  264. package/dist/types/components/Tabs/Tabs/TabHeader.d.ts +2 -0
  265. package/dist/types/components/Tabs/Tabs/Tabs.props.d.ts +10 -0
  266. package/dist/types/components/Tabs/Tabs/Tabs.state.d.ts +1 -0
  267. package/dist/types/components/Tabs/Tabs/Tabs.styles.d.ts +11 -0
  268. package/dist/types/components/Tabs/Tabs/Tabs.type.d.ts +4 -0
  269. package/dist/types/design-system/DesignSystemProvider.d.ts +1 -1
  270. package/dist/types/design-system/configs/default.json.d.ts +1 -1
  271. package/dist/types/design-system/theme.d.ts +10 -1
  272. package/dist/types/design-system/types.d.ts +3 -9
  273. package/dist/types/design-system/utils.d.ts +5 -2
  274. package/dist/web.cjs.js +16 -16
  275. package/dist/web.esm.mjs +44 -41
  276. package/dist/web.umd.js +38 -38
  277. package/dist/web.umd.js.map +1 -1
  278. package/docs/getting-started/react-native.md +17 -3
  279. package/docs/guides/performance.mdx +5 -0
  280. package/docs/guides/react-native.mdx +10 -0
  281. package/docs/guides/registry-guide.mdx +72 -8
  282. package/package.json +6 -4
  283. package/dist/chunks/Alert-Bjl40k3x.cjs +0 -2
  284. package/dist/chunks/Alert-Bjl40k3x.cjs.map +0 -1
  285. package/dist/chunks/Alert-Q1HlVX8f.mjs.map +0 -1
  286. package/dist/chunks/AttachmentPreview-8d8gZ5kk.mjs.map +0 -1
  287. package/dist/chunks/AttachmentPreview-Bwrz5TJh.cjs +0 -2
  288. package/dist/chunks/AttachmentPreview-Bwrz5TJh.cjs.map +0 -1
  289. package/dist/chunks/Avatar-BB0DeN9j.cjs +0 -2
  290. package/dist/chunks/Avatar-BB0DeN9j.cjs.map +0 -1
  291. package/dist/chunks/Avatar-D-GkyL2c.mjs.map +0 -1
  292. package/dist/chunks/Button.core-Bc5cSn_z.mjs.map +0 -1
  293. package/dist/chunks/Button.core-BhtOm8ak.cjs +0 -7
  294. package/dist/chunks/Button.core-BhtOm8ak.cjs.map +0 -1
  295. package/dist/chunks/Button.pilot-C4BIb08S.mjs +0 -6
  296. package/dist/chunks/Button.pilot-JmR2DCSE.cjs +0 -2
  297. package/dist/chunks/Card-CNSl9fD5.cjs +0 -2
  298. package/dist/chunks/Card-CNSl9fD5.cjs.map +0 -1
  299. package/dist/chunks/Card-DMhV_NTt.mjs +0 -200
  300. package/dist/chunks/Card-DMhV_NTt.mjs.map +0 -1
  301. package/dist/chunks/Checkbox-Bo7IRVRE.mjs +0 -11
  302. package/dist/chunks/Checkbox-Bo7IRVRE.mjs.map +0 -1
  303. package/dist/chunks/Checkbox-CAI6RtuO.cjs +0 -2
  304. package/dist/chunks/Checkbox-CAI6RtuO.cjs.map +0 -1
  305. package/dist/chunks/Checkbox.view-DGdNPlF9.cjs +0 -2
  306. package/dist/chunks/Checkbox.view-DGdNPlF9.cjs.map +0 -1
  307. package/dist/chunks/Checkbox.view-dhc-rfEX.mjs.map +0 -1
  308. package/dist/chunks/FieldWrapper-Bb0j8Iog.mjs.map +0 -1
  309. package/dist/chunks/FieldWrapper-DRCn7BLi.cjs +0 -2
  310. package/dist/chunks/FieldWrapper-DRCn7BLi.cjs.map +0 -1
  311. package/dist/chunks/Modal-DkckCT8-.mjs.map +0 -1
  312. package/dist/chunks/Modal-zok954As.cjs +0 -2
  313. package/dist/chunks/Modal-zok954As.cjs.map +0 -1
  314. package/dist/chunks/Select-C6R0Tei-.cjs +0 -2
  315. package/dist/chunks/Select-C6R0Tei-.cjs.map +0 -1
  316. package/dist/chunks/Select-C7IBNyjR.mjs +0 -24
  317. package/dist/chunks/Select-C7IBNyjR.mjs.map +0 -1
  318. package/dist/chunks/Select.view-CPMqT8pn.mjs.map +0 -1
  319. package/dist/chunks/Select.view-Pq1yAcMm.cjs +0 -2
  320. package/dist/chunks/Select.view-Pq1yAcMm.cjs.map +0 -1
  321. package/dist/chunks/Switch.view-CQZO_Js7.cjs +0 -2
  322. package/dist/chunks/Switch.view-CQZO_Js7.cjs.map +0 -1
  323. package/dist/chunks/Switch.view-QLZ7O5Z7.mjs.map +0 -1
  324. package/dist/chunks/Tabs-D5chMrkE.mjs +0 -403
  325. package/dist/chunks/Tabs-D5chMrkE.mjs.map +0 -1
  326. package/dist/chunks/Tabs-DQeBJwkz.cjs +0 -2
  327. package/dist/chunks/Tabs-DQeBJwkz.cjs.map +0 -1
  328. package/dist/chunks/TextField-DOU2CL5J.mjs.map +0 -1
  329. package/dist/chunks/TextField-Da4JCcAU.cjs +0 -2
  330. package/dist/chunks/TextField-Da4JCcAU.cjs.map +0 -1
  331. package/dist/chunks/default-D7ePSMKP.cjs +0 -2
  332. package/dist/chunks/default-D7ePSMKP.cjs.map +0 -1
  333. package/dist/chunks/designSystem.page-B74Vm2Dt.cjs +0 -11
  334. package/dist/chunks/designSystem.page-B74Vm2Dt.cjs.map +0 -1
  335. package/dist/chunks/designSystem.page-K0ajTvy7.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { d as e } from "./chunks/default-nRKhMTzF.mjs";
1
+ import { d as e } from "./chunks/default-1F10zins.mjs";
2
2
  const o = {
3
3
  id: "airbnb",
4
4
  label: "Airbnb",
@@ -7,12 +7,18 @@
7
7
  "categories": [
8
8
  "Feedback"
9
9
  ],
10
- "registryDependencies": [],
10
+ "registryDependencies": [
11
+ "theme"
12
+ ],
11
13
  "meta": {
12
14
  "appStudio": {
13
15
  "entry": "src/components/pilot/alert.ts",
14
16
  "engine": ">=0.9.5",
15
- "version": "0.11.13",
17
+ "engineByPlatform": {
18
+ "ios": ">=0.10.0",
19
+ "android": ">=0.10.0"
20
+ },
21
+ "version": "0.12.1",
16
22
  "license": "MIT",
17
23
  "platforms": [
18
24
  "web",
@@ -21,15 +27,10 @@
21
27
  ],
22
28
  "dependencies": {
23
29
  "web": [
24
- "@app-studio/components@0.11.13",
25
30
  "lucide-react@^0.562.0"
26
31
  ],
27
- "ios": [
28
- "@app-studio/components@0.11.13"
29
- ],
30
- "android": [
31
- "@app-studio/components@0.11.13"
32
- ]
32
+ "ios": [],
33
+ "android": []
33
34
  },
34
35
  "npmImport": "@app-studio/components/alert"
35
36
  }
@@ -42,7 +43,7 @@
42
43
  },
43
44
  {
44
45
  "path": "src/components/Alert/Alert.tsx",
45
- "content": "import React from 'react';\nimport { AlertView } from './Alert/Alert.view';\nimport { AlertProps } from './Alert/Alert.props';\nimport { useMergedDesignSystemComponentProps } from '@app-studio/components/theme';\n// Definition of the AlertComponent functional component with props.\nconst AlertComponent = (props: AlertProps) => {\n const mergedProps = useMergedDesignSystemComponentProps('alert', props);\n return <AlertView {...mergedProps} />;\n};\n// Exporting the AlertComponent as 'Alert' for use in other parts of the application.\nexport const Alert = AlertComponent;\n",
46
+ "content": "import React from 'react';\nimport { AlertView } from './Alert/Alert.view';\nimport { AlertProps } from './Alert/Alert.props';\nimport { useDesignSystemComponentLayers } from '../../design-system/theme';\n// Definition of the AlertComponent functional component with props.\nconst AlertComponent = (props: AlertProps) => {\n const { props: mergedProps, themeViews } = useDesignSystemComponentLayers(\n 'alert',\n props\n );\n return <AlertView {...mergedProps} themeViews={themeViews} />;\n};\n// Exporting the AlertComponent as 'Alert' for use in other parts of the application.\nexport const Alert = AlertComponent;\n",
46
47
  "type": "registry:ui"
47
48
  },
48
49
  {
@@ -62,12 +63,12 @@
62
63
  },
63
64
  {
64
65
  "path": "src/components/Alert/Alert/Alert.view.native.tsx",
65
- "content": "import React, { useEffect, useMemo } from 'react';\nimport { AccessibilityInfo, Platform } from 'react-native';\nimport { View, Text, Vertical, Horizontal, useTheme } from 'app-studio';\nimport { AlertProps } from './Alert.props';\nimport { getThemes } from './Alert.style';\n\nexport const AlertView = React.memo(\n ({\n icon,\n title = '',\n views,\n description = '',\n variant = 'default',\n themeMode: elementMode,\n children,\n ...props\n }: AlertProps) => {\n const { themeMode } = useTheme();\n const currentThemeMode = elementMode || themeMode;\n const themes = useMemo(\n () => getThemes(currentThemeMode),\n [currentThemeMode]\n );\n\n const urgent = variant === 'error' || variant === 'warning';\n useEffect(() => {\n if (urgent && title && Platform.OS === 'ios') {\n AccessibilityInfo.announceForAccessibility(title);\n }\n }, [title, urgent]);\n\n return (\n <Horizontal\n accessibilityRole={urgent ? 'alert' : undefined}\n accessibilityLiveRegion={urgent ? 'assertive' : 'polite'}\n gap={12}\n padding={12}\n flexWrap=\"nowrap\"\n alignItems=\"flex-start\"\n borderRadius={8}\n borderWidth={1}\n borderStyle=\"solid\"\n borderColor={themes[variant].container.borderColor}\n backgroundColor={themes[variant].container.backgroundColor}\n {...views?.container}\n {...props}\n >\n {icon && (\n <View alignSelf=\"flex-start\" marginTop={2} {...views?.icon}>\n {icon}\n </View>\n )}\n <Vertical gap={4}>\n {title ? (\n <Text\n fontSize={14}\n fontWeight=\"600\"\n lineHeight={20}\n color={themes[variant].content.color}\n {...views?.title}\n >\n {title}\n </Text>\n ) : null}\n <Text\n fontSize={12}\n fontWeight=\"400\"\n lineHeight={16}\n color={themes[variant].content.color}\n {...views?.description}\n >\n {description || children}\n </Text>\n </Vertical>\n </Horizontal>\n );\n }\n);\n",
66
+ "content": "import React, { useEffect, useMemo } from 'react';\nimport { AccessibilityInfo, Platform } from 'react-native';\nimport { View, Text, Vertical, Horizontal, useTheme } from 'app-studio';\nimport { AlertProps } from './Alert.props';\nimport { getThemes } from './Alert.style';\nimport { mergeDesignSystemViews } from '../../../design-system/theme';\n\nexport const AlertView = React.memo(\n ({\n icon,\n title = '',\n views: instanceViews,\n themeViews,\n description = '',\n variant = 'default',\n themeMode: elementMode,\n children,\n ...props\n }: AlertProps & { themeViews?: AlertProps['views'] }) => {\n const { themeMode } = useTheme();\n const currentThemeMode = elementMode || themeMode;\n const themes = useMemo(\n () => getThemes(currentThemeMode),\n [currentThemeMode]\n );\n const palette = themes[variant];\n const { backgroundColor, borderColor } = palette.container;\n const views = themeViews\n ? mergeDesignSystemViews(\n themeViews,\n {\n container: { backgroundColor, borderColor },\n title: palette.content,\n description: palette.content,\n icon: palette.icon,\n },\n instanceViews\n )\n : instanceViews;\n\n const urgent = variant === 'error' || variant === 'warning';\n useEffect(() => {\n if (urgent && title && Platform.OS === 'ios') {\n AccessibilityInfo.announceForAccessibility(title);\n }\n }, [title, urgent]);\n\n return (\n <Horizontal\n accessibilityRole={urgent ? 'alert' : undefined}\n accessibilityLiveRegion={urgent ? 'assertive' : 'polite'}\n gap={12}\n padding={12}\n flexWrap=\"nowrap\"\n alignItems=\"flex-start\"\n borderRadius={8}\n borderWidth={1}\n borderStyle=\"solid\"\n borderColor={borderColor}\n backgroundColor={backgroundColor}\n {...views?.container}\n {...props}\n >\n {icon && (\n <View alignSelf=\"flex-start\" marginTop={2} {...views?.icon}>\n {icon}\n </View>\n )}\n <Vertical gap={4}>\n {title ? (\n <Text\n fontSize={14}\n fontWeight=\"600\"\n lineHeight={20}\n color={palette.content.color}\n {...views?.title}\n >\n {title}\n </Text>\n ) : null}\n <Text\n fontSize={12}\n fontWeight=\"400\"\n lineHeight={16}\n color={palette.content.color}\n {...views?.description}\n >\n {description || children}\n </Text>\n </Vertical>\n </Horizontal>\n );\n }\n);\n",
66
67
  "type": "registry:ui"
67
68
  },
68
69
  {
69
70
  "path": "src/components/Alert/Alert/Alert.view.tsx",
70
- "content": "/**\n * Alert View Component\n *\n * Renders an alert with various styles and states according to the design guidelines.\n */\n\nimport React, { useMemo } from 'react';\nimport { View, useTheme } from 'app-studio';\nimport { Text } from 'app-studio';\nimport { Vertical } from 'app-studio';\nimport { Horizontal } from 'app-studio';\nimport { WarningIcon, InfoIcon, ErrorIcon, SuccessIcon } from '../../Icon/FixedIcons';\nimport { AlertProps } from './Alert.props';\nimport { getThemes } from './Alert.style';\nimport { Variant } from './Alert.type';\n\nconst defaultRoles: Record<Variant, AlertProps['role']> = {\n default: 'alert',\n info: 'status',\n success: 'status',\n error: 'alert',\n warning: 'alert',\n};\n\n/**\n * Alert component that displays important messages to users\n */\nexport const AlertView = React.memo(\n ({\n icon,\n title = '',\n views,\n description = '',\n variant = 'default',\n themeMode: elementMode,\n children,\n ...props\n }: AlertProps) => {\n const { themeMode } = useTheme();\n const currentThemeMode = elementMode || themeMode;\n const themes = useMemo(\n () => getThemes(currentThemeMode),\n [currentThemeMode]\n );\n // The icon's colour, from the theme: set on its wrapper (below), which the SVG inherits.\n const iconColor = views?.icon?.color ?? themes[variant].icon.color;\n // Select the appropriate icon based on the variant\n const getIcon = () => {\n if (icon) return icon;\n\n const iconProps = {\n size: 20,\n // The wrapper sets the CSS colour from the token; the SVG strokes it as currentColor, which every\n // engine paints (Lightpanda does not resolve var() inside the stroke attribute).\n color: 'currentColor',\n };\n\n switch (variant) {\n case 'info':\n return <InfoIcon {...iconProps} />;\n case 'success':\n return <SuccessIcon {...iconProps} />;\n case 'error':\n return <ErrorIcon {...iconProps} />;\n case 'warning':\n default:\n return <WarningIcon {...iconProps} />;\n }\n };\n\n return (\n <Horizontal\n role={defaultRoles[variant]}\n // Layout properties\n gap={12}\n padding=\"12px 16px\"\n flexWrap=\"nowrap\"\n alignItems=\"flex-start\"\n // Visual properties\n borderRadius=\"8px\" // Consistent with design system (rounded-md)\n borderWidth=\"1px\"\n borderStyle=\"solid\"\n borderColor={themes[variant].container.borderColor}\n backgroundColor={themes[variant].container.backgroundColor}\n boxShadow={themes[variant].container.boxShadow}\n // Animation\n transition=\"background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease\"\n // Apply custom container styles and any other props\n {...views?.container}\n {...props}\n >\n {/* Icon */}\n <View\n alignSelf=\"flex-start\"\n marginTop=\"2px\"\n color={iconColor}\n {...views?.icon}\n >\n {getIcon()}\n </View>\n\n {/* Content */}\n <Vertical gap={4}>\n {title ? (\n <Text\n fontSize=\"14px\"\n fontWeight=\"600\"\n lineHeight=\"20px\"\n color={themes[variant].content.color}\n {...views?.title}\n >\n {title}\n </Text>\n ) : null}\n <Text\n fontSize=\"12px\"\n fontWeight=\"400\"\n lineHeight=\"16px\"\n color={themes[variant].content.color}\n {...views?.description}\n >\n {description || children}\n </Text>\n </Vertical>\n </Horizontal>\n );\n }\n);\n",
71
+ "content": "/**\n * Alert View Component\n *\n * Renders an alert with various styles and states according to the design guidelines.\n */\n\nimport React, { useMemo } from 'react';\nimport { View, useTheme } from 'app-studio';\nimport { Text } from 'app-studio';\nimport { Vertical } from 'app-studio';\nimport { Horizontal } from 'app-studio';\nimport {\n WarningIcon,\n InfoIcon,\n ErrorIcon,\n SuccessIcon,\n} from '../../Icon/FixedIcons';\nimport { AlertProps } from './Alert.props';\nimport { getThemes } from './Alert.style';\nimport { Variant } from './Alert.type';\nimport { mergeDesignSystemViews } from '../../../design-system/theme';\n\nconst defaultRoles: Record<Variant, AlertProps['role']> = {\n default: 'alert',\n info: 'status',\n success: 'status',\n error: 'alert',\n warning: 'alert',\n};\n\n/**\n * Alert component that displays important messages to users\n */\nexport const AlertView = React.memo(\n ({\n icon,\n title = '',\n views: instanceViews,\n themeViews,\n description = '',\n variant = 'default',\n themeMode: elementMode,\n children,\n ...props\n }: AlertProps & { themeViews?: AlertProps['views'] }) => {\n const { themeMode } = useTheme();\n const currentThemeMode = elementMode || themeMode;\n const themes = useMemo(\n () => getThemes(currentThemeMode),\n [currentThemeMode]\n );\n const palette = themes[variant];\n const views = themeViews\n ? mergeDesignSystemViews(\n themeViews,\n {\n container: palette.container,\n title: palette.content,\n description: palette.content,\n icon: palette.icon,\n },\n instanceViews\n )\n : instanceViews;\n // The icon's colour, from the theme: set on its wrapper (below), which the SVG inherits.\n const iconColor = views?.icon?.color ?? palette.icon.color;\n // Select the appropriate icon based on the variant\n const getIcon = () => {\n if (icon) return icon;\n\n const iconProps = {\n size: 20,\n // The wrapper sets the CSS colour from the token; the SVG strokes it as currentColor, which every\n // engine paints (Lightpanda does not resolve var() inside the stroke attribute).\n color: 'currentColor',\n };\n\n switch (variant) {\n case 'info':\n return <InfoIcon {...iconProps} />;\n case 'success':\n return <SuccessIcon {...iconProps} />;\n case 'error':\n return <ErrorIcon {...iconProps} />;\n case 'warning':\n default:\n return <WarningIcon {...iconProps} />;\n }\n };\n\n return (\n <Horizontal\n role={defaultRoles[variant]}\n // Layout properties\n gap={12}\n padding=\"12px 16px\"\n flexWrap=\"nowrap\"\n alignItems=\"flex-start\"\n // Visual properties\n borderRadius=\"8px\" // Consistent with design system (rounded-md)\n borderWidth=\"1px\"\n borderStyle=\"solid\"\n borderColor={palette.container.borderColor}\n backgroundColor={palette.container.backgroundColor}\n boxShadow={palette.container.boxShadow}\n // Animation\n transition=\"background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease\"\n // Apply custom container styles and any other props\n {...views?.container}\n {...props}\n >\n {/* Icon */}\n <View\n alignSelf=\"flex-start\"\n marginTop=\"2px\"\n color={iconColor}\n {...views?.icon}\n >\n {getIcon()}\n </View>\n\n {/* Content */}\n <Vertical gap={4}>\n {title ? (\n <Text\n fontSize=\"14px\"\n fontWeight=\"600\"\n lineHeight=\"20px\"\n color={palette.content.color}\n {...views?.title}\n >\n {title}\n </Text>\n ) : null}\n <Text\n fontSize=\"12px\"\n fontWeight=\"400\"\n lineHeight=\"16px\"\n color={palette.content.color}\n {...views?.description}\n >\n {description || children}\n </Text>\n </Vertical>\n </Horizontal>\n );\n }\n);\n",
71
72
  "type": "registry:ui"
72
73
  },
73
74
  {
@@ -7,12 +7,18 @@
7
7
  "categories": [
8
8
  "Data display"
9
9
  ],
10
- "registryDependencies": [],
10
+ "registryDependencies": [
11
+ "theme"
12
+ ],
11
13
  "meta": {
12
14
  "appStudio": {
13
15
  "entry": "src/components/pilot/avatar.ts",
14
16
  "engine": ">=0.9.5",
15
- "version": "0.11.13",
17
+ "engineByPlatform": {
18
+ "ios": ">=0.10.0",
19
+ "android": ">=0.10.0"
20
+ },
21
+ "version": "0.12.1",
16
22
  "license": "MIT",
17
23
  "platforms": [
18
24
  "web",
@@ -20,15 +26,9 @@
20
26
  "android"
21
27
  ],
22
28
  "dependencies": {
23
- "web": [
24
- "@app-studio/components@0.11.13"
25
- ],
26
- "ios": [
27
- "@app-studio/components@0.11.13"
28
- ],
29
- "android": [
30
- "@app-studio/components@0.11.13"
31
- ]
29
+ "web": [],
30
+ "ios": [],
31
+ "android": []
32
32
  },
33
33
  "npmImport": "@app-studio/components/avatar"
34
34
  }
@@ -41,17 +41,17 @@
41
41
  },
42
42
  {
43
43
  "path": "src/components/Avatar/Avatar.tsx",
44
- "content": "import React from 'react';\nimport { AvatarProps } from './Avatar/Avatar.props';\nimport { useAvatarState } from './Avatar/Avatar.state';\nimport { AvatarView } from './Avatar/Avatar.view';\nimport { useMergedDesignSystemComponentProps } from '@app-studio/components/theme';\n\n// Defines the AvatarComponent functional component with destructured props from AvatarProps type.\nconst AvatarComponent = (props: AvatarProps) => {\n const mergedProps = useMergedDesignSystemComponentProps('avatar', props);\n const { src, size, views, fallback, onClick, children } = mergedProps;\n // Uses custom hook useAvatarState to manage the avatar image loading error state.\n const { imageError, setImageError } = useAvatarState();\n // Begins the JSX return block for rendering the AvatarView component.\n return (\n <AvatarView\n src={src}\n size={size}\n views={views}\n fallback={fallback}\n imageError={imageError}\n setImageError={setImageError}\n onClick={onClick}\n >\n {children}\n </AvatarView>\n );\n // AvatarComponent is a functional component that wraps the AvatarView with added state logic.\n};\n// Exports the AvatarComponent as Avatar for use in other parts of the application.\nexport const Avatar = AvatarComponent;\n",
44
+ "content": "import React from 'react';\nimport { AvatarProps } from './Avatar/Avatar.props';\nimport { useAvatarState } from './Avatar/Avatar.state';\nimport { AvatarView } from './Avatar/Avatar.view';\nimport { useMergedDesignSystemComponentProps } from '../../design-system/theme';\n\n// Defines the AvatarComponent functional component with destructured props from AvatarProps type.\nconst AvatarComponent = (props: AvatarProps) => {\n const mergedProps = useMergedDesignSystemComponentProps('avatar', props);\n const { src, size, views, fallback, onClick, children } = mergedProps;\n // Uses custom hook useAvatarState to manage the avatar image loading error state.\n const { imageError, onImageError } = useAvatarState(src);\n // Begins the JSX return block for rendering the AvatarView component.\n return (\n <AvatarView\n src={src}\n size={size}\n views={views}\n fallback={fallback}\n imageError={imageError}\n onImageError={onImageError}\n onClick={onClick}\n >\n {children}\n </AvatarView>\n );\n // AvatarComponent is a functional component that wraps the AvatarView with added state logic.\n};\n// Exports the AvatarComponent as Avatar for use in other parts of the application.\nexport const Avatar = AvatarComponent;\n",
45
45
  "type": "registry:ui"
46
46
  },
47
47
  {
48
48
  "path": "src/components/Avatar/Avatar/Avatar.props.ts",
49
- "content": "import React from 'react';\nimport { AvatarStyles, Size } from './Avatar.type';\n\n// Defines the properties for the Avatar component.\nexport interface AvatarProps {\n // Source URL for the avatar image.\n src?: string;\n // Optional size of the avatar, predefined in 'Size' type.\n size?: Size;\n // URL or path for the fallback image if the source fails to load.\n fallback?: string;\n // Optional custom styles for the avatar, defined by 'AvatarStyles'.\n views?: AvatarStyles;\n // Optional onClick handler. Wired straight to the underlying element, so it\n // receives the mouse event; declaring no parameter is fine too.\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n children?: React.ReactNode;\n}\n// Extends 'AvatarProps' with additional view-related properties.\nexport interface AvatarViewProps extends AvatarProps {\n // Signals whether there was an error when loading the avatar image.\n imageError: boolean;\n // Function to change the state of image load error.\n setImageError: React.Dispatch<React.SetStateAction<boolean>>;\n}\n",
49
+ "content": "import React from 'react';\nimport { AvatarStyles, Size } from './Avatar.type';\n\n// Defines the properties for the Avatar component.\nexport interface AvatarProps {\n // Source URL for the avatar image.\n src?: string;\n // Optional size of the avatar, predefined in 'Size' type.\n size?: Size;\n // Text displayed when the source is empty or fails to load.\n fallback?: string;\n // Optional custom styles for the avatar, defined by 'AvatarStyles'.\n views?: AvatarStyles;\n // Optional onClick handler. Wired straight to the underlying element, so it\n // receives the mouse event; declaring no parameter is fine too.\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n children?: React.ReactNode;\n}\n// Extends 'AvatarProps' with additional view-related properties.\nexport interface AvatarViewProps extends AvatarProps {\n // Signals whether there was an error when loading the avatar image.\n imageError: boolean;\n onImageError: () => void;\n}\n",
50
50
  "type": "registry:ui"
51
51
  },
52
52
  {
53
53
  "path": "src/components/Avatar/Avatar/Avatar.state.ts",
54
- "content": "import { useState } from 'react';\n// Defines a state hook for managing avatar image error status, initialized as false.\nexport const useAvatarState = () => {\n const [imageError, setImageError] = useState(false);\n // Provides an object containing the image error state and its setter function.\n return { imageError, setImageError };\n};\n",
54
+ "content": "import { useState } from 'react';\nexport const useAvatarState = (src?: string) => {\n const [failedSrc, setFailedSrc] = useState<string>();\n return {\n imageError: src !== undefined && failedSrc === src,\n onImageError: () => setFailedSrc(src),\n };\n};\n",
55
55
  "type": "registry:ui"
56
56
  },
57
57
  {
@@ -66,7 +66,7 @@
66
66
  },
67
67
  {
68
68
  "path": "src/components/Avatar/Avatar/Avatar.view.tsx",
69
- "content": "/**\n * Avatar View Component\n *\n * Renders an avatar with various styles and states\n * according to the design guidelines.\n */\n\nimport React from 'react';\nimport { Text } from 'app-studio';\nimport { Center } from 'app-studio';\nimport { Image } from 'app-studio';\nimport { AvatarViewProps } from './Avatar.props';\nimport { AvatarSizeMap, DefaultAvatarStyles } from './Avatar.style';\n// Declaration of the AvatarView functional component with destructured props from AvatarViewProps.\nexport const AvatarView = ({\n src,\n size = 'md',\n fallback = 'IM',\n views,\n imageError,\n setImageError,\n onClick = () => {},\n children,\n}: AvatarViewProps) => {\n // Determines the size of the avatar by mapping the size prop to the predefined AvatarSizeMap.\n const avatarSize = AvatarSizeMap[size];\n // Combine default image styles with custom styles\n const imageStyle: any = {\n ...DefaultAvatarStyles.image,\n ...(views?.image || {}),\n };\n // Start of the JSX returned by the AvatarView component, which uses the Center component as its root element.\n return (\n <Center\n // `data-role`: \"avatar\" is not an ARIA role and failed axe's aria-roles\n // rule (critical) on every consumer screen. The naming, when needed,\n // belongs to the consumer (e.g. a wrapping element with role=\"img\").\n data-role=\"avatar\"\n width={avatarSize}\n height={avatarSize}\n {...DefaultAvatarStyles.container}\n borderColor={imageError ? 'color-gray-400' : 'transparent'}\n onClick={onClick}\n {...views?.container}\n >\n {!imageError && src ? (\n <Image\n // Empty alt: the image is presentational here — the consumer names\n // the avatar (tooltip, wrapping role=\"img\", adjacent text). \"IM\"\n // was a junk name screen readers announced verbatim.\n alt=\"\"\n src={src}\n style={imageStyle}\n width={avatarSize}\n height={avatarSize}\n onError={() => setImageError(true)}\n />\n ) : (\n <Text\n size={size}\n {...DefaultAvatarStyles.fallback}\n {...views?.fallback}\n >\n {fallback}\n </Text>\n )}\n {children}\n </Center>\n );\n};\n",
69
+ "content": "/**\n * Avatar View Component\n *\n * Renders an avatar with various styles and states\n * according to the design guidelines.\n */\n\nimport React from 'react';\nimport { Text } from 'app-studio';\nimport { Center } from 'app-studio';\nimport { Image } from 'app-studio';\nimport { AvatarViewProps } from './Avatar.props';\nimport { AvatarSizeMap, DefaultAvatarStyles } from './Avatar.style';\n// Declaration of the AvatarView functional component with destructured props from AvatarViewProps.\nexport const AvatarView = ({\n src,\n size = 'md',\n fallback = 'IM',\n views,\n imageError,\n onImageError,\n onClick,\n children,\n}: AvatarViewProps) => {\n // Determines the size of the avatar by mapping the size prop to the predefined AvatarSizeMap.\n const avatarSize = AvatarSizeMap[size];\n // Combine default image styles with custom styles\n const imageStyle: any = {\n ...DefaultAvatarStyles.image,\n ...(views?.image || {}),\n };\n // Start of the JSX returned by the AvatarView component, which uses the Center component as its root element.\n return (\n <Center\n // `data-role`: \"avatar\" is not an ARIA role and failed axe's aria-roles\n // rule (critical) on every consumer screen. The naming, when needed,\n // belongs to the consumer (e.g. a wrapping element with role=\"img\").\n data-role=\"avatar\"\n width={avatarSize}\n height={avatarSize}\n {...DefaultAvatarStyles.container}\n borderColor={imageError ? 'color-gray-400' : 'transparent'}\n onClick={onClick}\n {...views?.container}\n >\n {!imageError && src ? (\n <Image\n // Empty alt: the image is presentational here — the consumer names\n // the avatar (tooltip, wrapping role=\"img\", adjacent text). \"IM\"\n // was a junk name screen readers announced verbatim.\n alt=\"\"\n src={src}\n style={imageStyle}\n width={avatarSize}\n height={avatarSize}\n onError={onImageError}\n />\n ) : (\n <Text\n size={size}\n {...DefaultAvatarStyles.fallback}\n {...views?.fallback}\n >\n {fallback}\n </Text>\n )}\n {children}\n </Center>\n );\n};\n",
70
70
  "type": "registry:ui"
71
71
  },
72
72
  {
@@ -7,12 +7,18 @@
7
7
  "categories": [
8
8
  "Actions"
9
9
  ],
10
- "registryDependencies": [],
10
+ "registryDependencies": [
11
+ "theme"
12
+ ],
11
13
  "meta": {
12
14
  "appStudio": {
13
15
  "entry": "src/components/pilot/button.ts",
14
16
  "engine": ">=0.9.5",
15
- "version": "0.11.13",
17
+ "engineByPlatform": {
18
+ "ios": ">=0.10.0",
19
+ "android": ">=0.10.0"
20
+ },
21
+ "version": "0.12.1",
16
22
  "license": "MIT",
17
23
  "platforms": [
18
24
  "web",
@@ -20,15 +26,11 @@
20
26
  "android"
21
27
  ],
22
28
  "dependencies": {
23
- "web": [
24
- "@app-studio/components@0.11.13"
25
- ],
29
+ "web": [],
26
30
  "ios": [
27
- "@app-studio/components@0.11.13",
28
31
  "react-native-svg@>= 13"
29
32
  ],
30
33
  "android": [
31
- "@app-studio/components@0.11.13",
32
34
  "react-native-svg@>= 13"
33
35
  ]
34
36
  },
@@ -43,7 +45,7 @@
43
45
  },
44
46
  {
45
47
  "path": "src/components/Button/Button.core.tsx",
46
- "content": "import React from 'react';\nimport { ButtonProps } from './Button/Button.props';\nimport type { LinkProps } from '../Link/Link/Link.props';\nimport { ButtonElement } from './Button/Button.element';\n// Importing TypeScript type for button properties to ensure the component receives the correct props.\nimport ButtonView from './Button/Button.view';\nimport { useHover } from 'app-studio';\nimport { useMergedDesignSystemComponentProps } from '@app-studio/components/theme';\n// Forwards `ref` to the rendered button (web) or its underlying view (native),\n// sharing the node with the hover tracker.\nexport const createButton = (\n linkComponent?: React.ComponentType<LinkProps>\n) => {\n const ButtonComponent = React.forwardRef<ButtonElement, ButtonProps>(\n (props: any, ref) => {\n const [hoverRef, hover] = useHover();\n const setRef = React.useCallback(\n (node: ButtonElement | null) => {\n // Hover is tracked on DOM nodes only; React Native has no hover.\n hoverRef.current =\n typeof HTMLElement !== 'undefined' && node instanceof HTMLElement\n ? node\n : null;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [hoverRef, ref]\n );\n const mergedProps = useMergedDesignSystemComponentProps('button', props);\n\n // Provenance-aware content color: only THIS instance can declare an\n // explicit content color — via `textColor`, or by passing the CSS-meaning\n // pair (`backgroundColor` + `color`, where `color` keeps its CSS sense).\n // It must be read from the raw instance props BEFORE the design-system\n // merge, which would otherwise let a brand default like Nike's\n // white-on-black `textColor` bleed into e.g. a white carousel control and\n // render its icon white-on-white.\n const explicitTextColor =\n props.textColor ??\n (props.backgroundColor != null && props.color != null\n ? props.color\n : undefined);\n\n return (\n <ButtonView\n ref={setRef}\n isHovered={hover}\n {...mergedProps}\n explicitTextColor={explicitTextColor}\n linkComponent={linkComponent}\n />\n );\n }\n );\n ButtonComponent.displayName = 'Button';\n return ButtonComponent;\n};\n",
48
+ "content": "import React from 'react';\nimport { ButtonProps } from './Button/Button.props';\nimport type { LinkProps } from '../Link/Link/Link.props';\nimport { ButtonElement } from './Button/Button.element';\n// Importing TypeScript type for button properties to ensure the component receives the correct props.\nimport ButtonView from './Button/Button.view';\nimport { useHover } from 'app-studio';\nimport { useDesignSystemComponentLayers } from '../../design-system/theme';\n// Forwards `ref` to the rendered button (web) or its underlying view (native),\n// sharing the node with the hover tracker.\nexport const createButton = (\n linkComponent?: React.ComponentType<LinkProps>\n) => {\n const ButtonComponent = React.forwardRef<ButtonElement, ButtonProps>(\n (props, ref) => {\n const [hoverRef, hover] = useHover();\n const setRef = React.useCallback(\n (node: ButtonElement | null) => {\n // Hover is tracked on DOM nodes only; React Native has no hover.\n hoverRef.current =\n typeof HTMLElement !== 'undefined' && node instanceof HTMLElement\n ? node\n : null;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [hoverRef, ref]\n );\n const { props: mergedProps, themeViews } = useDesignSystemComponentLayers(\n 'button',\n props\n );\n\n // Provenance-aware content color: only THIS instance can declare an\n // explicit content color — via `textColor`, or by passing the CSS-meaning\n // pair (`backgroundColor` + `color`, where `color` keeps its CSS sense).\n // It must be read from the raw instance props BEFORE the design-system\n // merge, which would otherwise let a brand default like Nike's\n // white-on-black `textColor` bleed into e.g. a white carousel control and\n // render its icon white-on-white.\n const explicitTextColor =\n props.textColor ??\n (props.backgroundColor != null && props.color != null\n ? props.color\n : undefined);\n\n return (\n <ButtonView\n ref={setRef}\n isHovered={hover}\n {...mergedProps}\n themeViews={themeViews}\n explicitTextColor={explicitTextColor}\n linkComponent={linkComponent}\n />\n );\n }\n );\n ButtonComponent.displayName = 'Button';\n return ButtonComponent;\n};\n",
47
49
  "type": "registry:ui"
48
50
  },
49
51
  {
@@ -68,7 +70,7 @@
68
70
  },
69
71
  {
70
72
  "path": "src/components/Button/Button/Button.style.ts",
71
- "content": "/**\n * Button Styles\n *\n * Defines the styles for the Button component following the design guidelines:\n * - Typography: Inter/Geist font, specific sizes/weights\n * - Spacing: 4px grid system\n * - Colors: Neutral palette with semantic colors\n * - Rounded corners: Consistent border radius\n * - Transitions: Subtle animations\n */\n\nimport { ViewProps } from 'app-studio';\nimport { alphaColor } from '../../../utils/colors';\nimport { Shape, Size, Variant } from './Button.type';\n\n/**\n * Vertical padding is one pixel short of the obvious `(minHeight - lineHeight) / 2`\n * on purpose.\n *\n * These boxes are `border-box`, and every bordered variant (`filled`, `outline`)\n * draws a 1px border. Budgeting `paddingVertical * 2 + lineHeight === minHeight`\n * leaves no room for it, so those variants rendered exactly 2px taller than the\n * size they declare — a `md` Button came out at 42px next to a `md` TextField at\n * 40px. Borderless variants are unaffected: their content is 2px under\n * `minHeight`, which then floors them to the declared height anyway.\n *\n * The type scale is deliberately untouched; the correction is taken out of\n * spacing rather than typography.\n */\nexport const ButtonSizes: Record<Size, ViewProps> = {\n xs: {\n minHeight: 24,\n paddingHorizontal: 12,\n paddingVertical: 5,\n fontSize: 10,\n fontWeight: 500,\n lineHeight: 12,\n letterSpacing: '-0.01em',\n },\n sm: {\n minHeight: 32,\n paddingHorizontal: 16,\n paddingVertical: 7,\n fontSize: 12,\n fontWeight: 500,\n lineHeight: 16,\n letterSpacing: '-0.01em',\n },\n md: {\n minHeight: 40,\n paddingHorizontal: 20,\n paddingVertical: 9,\n fontSize: 14,\n fontWeight: 500,\n lineHeight: 20,\n letterSpacing: '-0.01em',\n },\n lg: {\n minHeight: 48,\n paddingHorizontal: 24,\n paddingVertical: 11,\n fontSize: 16,\n fontWeight: 500,\n lineHeight: 24,\n letterSpacing: '-0.01em',\n },\n xl: {\n minHeight: 56,\n paddingHorizontal: 28,\n paddingVertical: 13,\n fontSize: 20,\n fontWeight: 500,\n lineHeight: 28,\n letterSpacing: '-0.01em',\n },\n};\n\n/**\n * Button shapes with consistent border radius\n */\nexport const ButtonShapes: Record<Shape, number | string> = {\n square: 0,\n rounded: 8,\n pill: 999, // Full rounded for pill shape\n};\n\n/**\n * Icon sizes for different button sizes\n */\nexport const IconSizes: Record<Size, ViewProps> = {\n xs: {\n width: 16,\n height: 16,\n padding: 6,\n },\n sm: {\n width: 20,\n height: 20,\n padding: 6,\n },\n md: {\n width: 24,\n height: 24,\n padding: 8,\n },\n lg: {\n width: 24,\n height: 24,\n padding: 12,\n },\n xl: {\n width: 28,\n height: 28,\n padding: 14,\n },\n};\n\n/**\n * Convert an app-studio token (`color-*`, `theme-*`, `light-*`, `dark-*`) into\n * the equivalent CSS `var(--token)` reference so it can be embedded inside\n * arbitrary CSS strings (box-shadow, gradients, …) where token resolution is\n * not applied. Non-token values are returned unchanged.\n */\nexport const cssVar = (value: string) =>\n /^(color|theme|light|dark)-/.test(value) ? `var(--${value})` : value;\n\nconst normalizeHex = (value: string) => {\n const match = value.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);\n if (!match) return null;\n\n const hex =\n match[1].length === 3\n ? match[1]\n .split('')\n .map((char) => `${char}${char}`)\n .join('')\n : match[1];\n\n return {\n r: parseInt(hex.slice(0, 2), 16),\n g: parseInt(hex.slice(2, 4), 16),\n b: parseInt(hex.slice(4, 6), 16),\n };\n};\n\nconst mixHex = (value: string, alpha: number) => {\n const color = normalizeHex(value);\n if (!color) return value;\n\n const target = alpha < 100 ? 255 : 0;\n const amount = Math.min(Math.abs(100 - alpha) / 100, 0.28);\n const toHex = (channel: number) =>\n Math.round(channel + (target - channel) * amount)\n .toString(16)\n .padStart(2, '0');\n\n return `#${toHex(color.r)}${toHex(color.g)}${toHex(color.b)}`;\n};\n\nconst tintColor = (value: string, alpha: number) => mixHex(value, alpha);\n\nexport const getButtonVariants = (\n color: string,\n textColor: string,\n reversed: boolean = false,\n theme?: any\n): Record<Variant, ViewProps> => {\n // Determine effective tokens based on reversed state\n const effectiveBg = reversed ? textColor : color;\n const effectiveContent = reversed ? color : textColor;\n const effectiveBorder = reversed ? textColor : color;\n\n // For filled buttons, if the background is the primary color, use onPrimary for text contrast.\n const isPrimary =\n color === 'theme-primary' || (theme && color === theme.primary);\n const filledTextColor =\n isPrimary && theme?.onPrimary ? theme.onPrimary : effectiveContent;\n\n // App-Studio alpha syntax: `{token}-{alpha}` (alpha 0–1000 → 0%–100% opacity).\n const focusRing = `0 0 0 2px ${cssVar('color-white')}, 0 0 0 4px ${cssVar(\n effectiveBorder\n )}`;\n\n return {\n filled: {\n backgroundColor: effectiveBg,\n color: filledTextColor,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: effectiveBg,\n _hover: { opacity: 0.92 },\n _active: { opacity: 0.96 },\n _focusVisible: { outline: 'none', boxShadow: focusRing },\n transition:\n 'background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease',\n },\n empty: {\n color: effectiveBorder,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: alphaColor(effectiveBorder, reversed ? 400 : 250),\n backgroundColor: 'transparent',\n _hover: { opacity: 0.9 },\n _active: { opacity: 0.95 },\n _focusVisible: { outline: 'none', boxShadow: focusRing },\n transition: 'background-color 0.2s ease, opacity 0.2s ease',\n },\n outline: {\n color: effectiveBorder,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: alphaColor(effectiveBorder, reversed ? 400 : 250),\n backgroundColor: 'transparent',\n _hover: { opacity: 0.9 },\n _active: { opacity: 0.95 },\n _focusVisible: { outline: 'none', boxShadow: focusRing },\n transition:\n 'background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease',\n },\n ghost: {\n color: effectiveBorder,\n borderWidth: 0,\n borderStyle: 'solid',\n borderColor: effectiveBorder,\n backgroundColor: 'transparent',\n _hover: { opacity: 0.86 },\n _active: { opacity: 0.94 },\n _focusVisible: { outline: 'none', boxShadow: focusRing },\n transition: 'background-color 0.2s ease, color 0.2s ease',\n },\n link: {\n color: effectiveBorder,\n borderWidth: 0,\n borderStyle: 'none',\n borderColor: effectiveBorder,\n minHeight: 'auto',\n paddingHorizontal: '4px',\n paddingVertical: '10px',\n textDecoration: 'underline',\n backgroundColor: 'transparent',\n style: {\n textUnderlineOffset: '2px',\n textDecorationThickness: '1px',\n textDecorationColor: cssVar(effectiveBorder),\n } as ViewProps['style'],\n _hover: { opacity: 0.8 },\n _active: { opacity: 0.9 },\n _focusVisible: { outline: 'none', boxShadow: focusRing },\n transition: 'opacity 0.2s ease',\n },\n subtle: {\n // Translucent tints via `alphaColor`: tokens get the app-studio\n // `-{alpha}` suffix (0–1000), raw CSS colors (`#hex`, `rgb()`, keywords\n // — e.g. a caller's `backgroundColor`) get an equivalent `color-mix()`.\n // Text stays at full opacity so the label remains readable.\n backgroundColor: alphaColor(effectiveBorder, reversed ? 200 : 100),\n color: effectiveBorder,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: alphaColor(effectiveBorder, reversed ? 400 : 250),\n _hover: {\n backgroundColor: alphaColor(effectiveBorder, reversed ? 300 : 180),\n },\n _active: {\n backgroundColor: alphaColor(effectiveBorder, reversed ? 380 : 240),\n },\n _focusVisible: { outline: 'none', boxShadow: focusRing },\n transition:\n 'background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease',\n },\n };\n};\n\n/**\n * Generate offset path for border animation\n */\nexport function generateOffsetPath(\n width: number,\n height: number,\n borderRadius: number | string\n): string {\n let radius: number;\n\n if (typeof borderRadius === 'string' && borderRadius.endsWith('%')) {\n const percentage = parseFloat(borderRadius) / 100;\n radius = Math.min(width, height) * percentage;\n } else {\n radius = parseFloat(borderRadius.toString());\n }\n\n radius = Math.min(radius, width / 2, height / 2);\n\n if (radius === 0) {\n return `M 0,0 H ${width} V ${height} H 0 Z`;\n }\n\n return `\n M ${radius},0\n H ${width - radius}\n A ${radius},${radius} 0 0 1 ${width},${radius}\n V ${height - radius}\n A ${radius},${radius} 0 0 1 ${width - radius},${height}\n H ${radius}\n A ${radius},${radius} 0 0 1 0,${height - radius}\n V ${radius}\n A ${radius},${radius} 0 0 1 ${radius},0\n Z\n `;\n}\n",
73
+ "content": "/**\n * Button Styles\n *\n * Defines the styles for the Button component following the design guidelines:\n * - Typography: Inter/Geist font, specific sizes/weights\n * - Spacing: 4px grid system\n * - Colors: Neutral palette with semantic colors\n * - Rounded corners: Consistent border radius\n * - Transitions: Subtle animations\n */\n\nimport { ViewProps } from 'app-studio';\nimport { alphaColor } from '../../../utils/colors';\nimport { Shape, Size, Variant } from './Button.type';\n\n/**\n * Vertical padding is one pixel short of the obvious `(minHeight - lineHeight) / 2`\n * on purpose.\n *\n * These boxes are `border-box`, and every bordered variant (`filled`, `outline`)\n * draws a 1px border. Budgeting `paddingVertical * 2 + lineHeight === minHeight`\n * leaves no room for it, so those variants rendered exactly 2px taller than the\n * size they declare — a `md` Button came out at 42px next to a `md` TextField at\n * 40px. Borderless variants are unaffected: their content is 2px under\n * `minHeight`, which then floors them to the declared height anyway.\n *\n * The type scale is deliberately untouched; the correction is taken out of\n * spacing rather than typography.\n */\nexport const ButtonSizes: Record<Size, ViewProps> = {\n xs: {\n minHeight: 24,\n paddingHorizontal: 12,\n paddingVertical: 5,\n fontSize: 10,\n fontWeight: 500,\n lineHeight: 12,\n letterSpacing: '-0.01em',\n },\n sm: {\n minHeight: 32,\n paddingHorizontal: 16,\n paddingVertical: 7,\n fontSize: 12,\n fontWeight: 500,\n lineHeight: 16,\n letterSpacing: '-0.01em',\n },\n md: {\n minHeight: 40,\n paddingHorizontal: 20,\n paddingVertical: 9,\n fontSize: 14,\n fontWeight: 500,\n lineHeight: 20,\n letterSpacing: '-0.01em',\n },\n lg: {\n minHeight: 48,\n paddingHorizontal: 24,\n paddingVertical: 11,\n fontSize: 16,\n fontWeight: 500,\n lineHeight: 24,\n letterSpacing: '-0.01em',\n },\n xl: {\n minHeight: 56,\n paddingHorizontal: 28,\n paddingVertical: 13,\n fontSize: 20,\n fontWeight: 500,\n lineHeight: 28,\n letterSpacing: '-0.01em',\n },\n};\n\n/**\n * Button shapes with consistent border radius\n */\nexport const ButtonShapes: Record<Shape, number | string> = {\n square: 0,\n rounded: 8,\n pill: 999, // Full rounded for pill shape\n};\n\n/**\n * Icon sizes for different button sizes\n */\nexport const IconSizes: Record<Size, ViewProps> = {\n xs: {\n width: 16,\n height: 16,\n padding: 6,\n },\n sm: {\n width: 20,\n height: 20,\n padding: 6,\n },\n md: {\n width: 24,\n height: 24,\n padding: 8,\n },\n lg: {\n width: 24,\n height: 24,\n padding: 12,\n },\n xl: {\n width: 28,\n height: 28,\n padding: 14,\n },\n};\n\n/**\n * Convert an app-studio token (`color-*`, `theme-*`, `light-*`, `dark-*`) into\n * the equivalent CSS `var(--token)` reference so it can be embedded inside\n * arbitrary CSS strings (box-shadow, gradients, …) where token resolution is\n * not applied. Non-token values are returned unchanged.\n */\nexport const cssVar = (value: string) =>\n /^(color|theme|light|dark)-/.test(value) ? `var(--${value})` : value;\n\nconst normalizeHex = (value: string) => {\n const match = value.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);\n if (!match) return null;\n\n const hex =\n match[1].length === 3\n ? match[1]\n .split('')\n .map((char) => `${char}${char}`)\n .join('')\n : match[1];\n\n return {\n r: parseInt(hex.slice(0, 2), 16),\n g: parseInt(hex.slice(2, 4), 16),\n b: parseInt(hex.slice(4, 6), 16),\n };\n};\n\nconst mixHex = (value: string, alpha: number) => {\n const color = normalizeHex(value);\n if (!color) return value;\n\n const target = alpha < 100 ? 255 : 0;\n const amount = Math.min(Math.abs(100 - alpha) / 100, 0.28);\n const toHex = (channel: number) =>\n Math.round(channel + (target - channel) * amount)\n .toString(16)\n .padStart(2, '0');\n\n return `#${toHex(color.r)}${toHex(color.g)}${toHex(color.b)}`;\n};\n\nconst tintColor = (value: string, alpha: number) => mixHex(value, alpha);\n\nexport const getButtonVariants = (\n color: string,\n textColor: string,\n reversed: boolean = false,\n theme?: any\n): Record<Variant, ViewProps> => {\n // Determine effective tokens based on reversed state\n const effectiveBg = reversed ? textColor : color;\n const effectiveContent = reversed ? color : textColor;\n const effectiveBorder = reversed ? textColor : color;\n\n // For filled buttons, if the background is the primary color, use onPrimary for text contrast.\n const isPrimary =\n color === 'theme-primary' || (theme && color === theme.primary);\n const filledTextColor =\n isPrimary && theme?.onPrimary ? theme.onPrimary : effectiveContent;\n\n // App-Studio alpha syntax: `{token}-{alpha}` (alpha 0–1000 → 0%–100% opacity).\n const focusRing = `0 0 0 2px ${cssVar('color-white')}, 0 0 0 4px ${cssVar(\n effectiveBorder\n )}`;\n const focusVisible = {\n outline: `2px solid ${cssVar(effectiveBorder)}`,\n outlineOffset: 2,\n boxShadow: focusRing,\n };\n\n return {\n filled: {\n backgroundColor: effectiveBg,\n color: filledTextColor,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: effectiveBg,\n _hover: { opacity: 0.92 },\n _active: { opacity: 0.96 },\n _focusVisible: focusVisible,\n transition:\n 'background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease',\n },\n empty: {\n color: effectiveBorder,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: alphaColor(effectiveBorder, reversed ? 400 : 250),\n backgroundColor: 'transparent',\n _hover: { opacity: 0.9 },\n _active: { opacity: 0.95 },\n _focusVisible: focusVisible,\n transition: 'background-color 0.2s ease, opacity 0.2s ease',\n },\n outline: {\n color: effectiveBorder,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: alphaColor(effectiveBorder, reversed ? 400 : 250),\n backgroundColor: 'transparent',\n _hover: { opacity: 0.9 },\n _active: { opacity: 0.95 },\n _focusVisible: focusVisible,\n transition:\n 'background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease',\n },\n ghost: {\n color: effectiveBorder,\n borderWidth: 0,\n borderStyle: 'solid',\n borderColor: effectiveBorder,\n backgroundColor: 'transparent',\n _hover: { opacity: 0.86 },\n _active: { opacity: 0.94 },\n _focusVisible: focusVisible,\n transition: 'background-color 0.2s ease, color 0.2s ease',\n },\n link: {\n color: effectiveBorder,\n borderWidth: 0,\n borderStyle: 'none',\n borderColor: effectiveBorder,\n minHeight: 'auto',\n paddingHorizontal: '4px',\n paddingVertical: '10px',\n textDecoration: 'underline',\n backgroundColor: 'transparent',\n style: {\n textUnderlineOffset: '2px',\n textDecorationThickness: '1px',\n textDecorationColor: cssVar(effectiveBorder),\n } as ViewProps['style'],\n _hover: { opacity: 0.8 },\n _active: { opacity: 0.9 },\n _focusVisible: focusVisible,\n transition: 'opacity 0.2s ease',\n },\n subtle: {\n // Translucent tints via `alphaColor`: tokens get the app-studio\n // `-{alpha}` suffix (0–1000), raw CSS colors (`#hex`, `rgb()`, keywords\n // — e.g. a caller's `backgroundColor`) get an equivalent `color-mix()`.\n // Text stays at full opacity so the label remains readable.\n backgroundColor: alphaColor(effectiveBorder, reversed ? 200 : 100),\n color: effectiveBorder,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: alphaColor(effectiveBorder, reversed ? 400 : 250),\n _hover: {\n backgroundColor: alphaColor(effectiveBorder, reversed ? 300 : 180),\n },\n _active: {\n backgroundColor: alphaColor(effectiveBorder, reversed ? 380 : 240),\n },\n _focusVisible: focusVisible,\n transition:\n 'background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease',\n },\n };\n};\n\n/**\n * Generate offset path for border animation\n */\nexport function generateOffsetPath(\n width: number,\n height: number,\n borderRadius: number | string\n): string {\n let radius: number;\n\n if (typeof borderRadius === 'string' && borderRadius.endsWith('%')) {\n const percentage = parseFloat(borderRadius) / 100;\n radius = Math.min(width, height) * percentage;\n } else {\n radius = parseFloat(borderRadius.toString());\n }\n\n radius = Math.min(radius, width / 2, height / 2);\n\n if (radius === 0) {\n return `M 0,0 H ${width} V ${height} H 0 Z`;\n }\n\n return `\n M ${radius},0\n H ${width - radius}\n A ${radius},${radius} 0 0 1 ${width},${radius}\n V ${height - radius}\n A ${radius},${radius} 0 0 1 ${width - radius},${height}\n H ${radius}\n A ${radius},${radius} 0 0 1 0,${height - radius}\n V ${radius}\n A ${radius},${radius} 0 0 1 ${radius},0\n Z\n `;\n}\n",
72
74
  "type": "registry:ui"
73
75
  },
74
76
  {
@@ -78,12 +80,12 @@
78
80
  },
79
81
  {
80
82
  "path": "src/components/Button/Button/Button.view.native.tsx",
81
- "content": "/**\n * ButtonView (React Native) – simplified RN-friendly view.\n * - Drops web-only animations (borderMoving / animatedStroke / borderReveal) and\n * gracefully falls back to the default Standard button.\n * - Uses app-studio's <Element/> (renders a Pressable when onPress is set).\n * - Preserves the public API surface of the web ButtonView.\n */\n\nimport React, { useMemo } from 'react';\nimport { Element, Horizontal, Vertical, View, Text } from 'app-studio';\nimport { Linking } from 'react-native';\nimport type { LinkProps } from '../../Link/Link/Link.props';\nimport { Loader } from '../../Loader/Loader';\nimport { ButtonProps } from './Button.props';\nimport {\n ButtonSizes,\n ButtonShapes,\n IconSizes,\n getButtonVariants,\n} from './Button.style';\nimport { useDesignSystem, deepMerge } from '@app-studio/components/theme';\nimport { Shape, Size, Variant } from './Button.type';\n\n// --- Helper: Button Content ---\nconst ButtonContent: React.FC<{\n children: React.ReactNode;\n icon?: React.ReactNode;\n isLoading?: boolean;\n iconPosition?: string;\n loaderPosition?: string;\n size?: Size;\n resolvedTextColor: string;\n isIconRounded?: boolean;\n views?: any;\n}> = React.memo(\n ({\n children,\n icon,\n isLoading,\n iconPosition = 'left',\n loaderPosition = 'left',\n size = 'md',\n resolvedTextColor,\n views,\n }) => {\n const Wrapper = ['left', 'right'].includes(iconPosition)\n ? Horizontal\n : Vertical;\n const sizeStyles = ButtonSizes[size];\n\n // On native, `color` does NOT cascade into an icon's SVG the way it does on\n // web — an icon whose color is `currentColor` would fall back to a dark\n // default and vanish on a coloured button. Inject the button's text color\n // into the icon unless it already specifies one.\n const tintedIcon = React.isValidElement(icon)\n ? React.cloneElement(icon as any, {\n color: (icon as any).props?.color ?? resolvedTextColor,\n })\n : icon;\n\n return (\n <Wrapper\n gap={8}\n alignItems=\"center\"\n justifyContent=\"center\"\n fontSize={sizeStyles.fontSize}\n fontWeight={sizeStyles.fontWeight}\n lineHeight={sizeStyles.lineHeight}\n letterSpacing={sizeStyles.letterSpacing}\n color={resolvedTextColor}\n {...views?.content}\n >\n {isLoading && loaderPosition === 'left' && (\n <Loader\n size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}\n color={resolvedTextColor}\n {...views?.loader}\n />\n )}\n\n {icon && ['left', 'top'].includes(iconPosition) && !isLoading && (\n <View color={resolvedTextColor} {...views?.icon}>\n {tintedIcon}\n </View>\n )}\n\n {React.Children.map(children, (child) =>\n typeof child === 'string' || typeof child === 'number' ? (\n <Text color={resolvedTextColor}>{child}</Text>\n ) : (\n child\n )\n )}\n\n {icon && ['right', 'bottom'].includes(iconPosition) && !isLoading && (\n <View color={resolvedTextColor} {...views?.icon}>\n {tintedIcon}\n </View>\n )}\n\n {isLoading && loaderPosition === 'right' && (\n <Loader\n size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}\n color={resolvedTextColor}\n {...views?.loader}\n />\n )}\n </Wrapper>\n );\n }\n);\n\n// --- Main Component ---\nfunction NativeLink({\n to,\n href,\n isExternal,\n onPress,\n children,\n ...props\n}: LinkProps) {\n const url = href ?? (isExternal ? to : undefined);\n return (\n <Horizontal\n accessibilityRole=\"link\"\n onPress={\n url\n ? () => {\n void Linking.openURL(url).catch(() => {});\n }\n : onPress\n }\n {...props}\n >\n {children}\n </Horizontal>\n );\n}\n\nconst ButtonView = React.memo(\n React.forwardRef<\n any,\n ButtonProps & { linkComponent?: React.ComponentType<LinkProps> }\n >(\n (\n {\n variant = 'filled',\n size = 'md',\n shape = 'rounded',\n iconPosition = 'left',\n loaderPosition = 'left',\n backgroundColor,\n color,\n textColor,\n explicitTextColor,\n reversed = false,\n isAuto = true,\n isFilled,\n isDisabled,\n isLoading,\n isIconRounded,\n icon,\n children,\n to,\n isExternal,\n linkComponent: Link = NativeLink,\n shadow,\n onClick,\n views = {},\n config: buttonConfig,\n ...props\n },\n ref\n ) => {\n const baseColorKey = backgroundColor ?? color ?? 'theme-primary';\n const mainColorKey = isDisabled\n ? 'theme-disabled'\n : isLoading\n ? 'theme-loading'\n : baseColorKey;\n // Mirrors Button.view.tsx: instance-declared `explicitTextColor`\n // (resolved by the Button wrapper) wins over a config's `textColor`.\n const textColorKey = explicitTextColor ?? textColor ?? 'color-white';\n\n const { config } = useDesignSystem();\n const theme = config?.theme;\n const palette = useMemo(() => {\n const basePalette = getButtonVariants(\n mainColorKey,\n textColorKey,\n reversed,\n theme\n );\n if (buttonConfig?.variants) {\n Object.keys(buttonConfig.variants).forEach((v) => {\n if (basePalette[v as Variant]) {\n basePalette[v as Variant] = deepMerge(\n basePalette[v as Variant],\n buttonConfig.variants[v]\n );\n }\n });\n }\n return basePalette;\n }, [mainColorKey, textColorKey, reversed, theme, buttonConfig?.variants]);\n\n const variantBase = palette[variant as Variant] ?? palette.filled;\n const base = explicitTextColor\n ? { ...variantBase, color: explicitTextColor }\n : variantBase;\n const finalContentColor = (base?.color as string) ?? textColorKey;\n\n const content = (\n <ButtonContent\n icon={icon}\n isLoading={isLoading}\n iconPosition={iconPosition}\n loaderPosition={loaderPosition}\n size={size}\n resolvedTextColor={finalContentColor}\n isIconRounded={isIconRounded}\n views={views}\n >\n {children}\n </ButtonContent>\n );\n\n const sizeStyles = ButtonSizes[size as Size];\n const iconPad = isIconRounded ? IconSizes[size as Size] : {};\n\n const linkOrContent = to ? (\n <Link\n to={to}\n isExternal={isExternal}\n color={finalContentColor}\n {...views?.link}\n >\n {content}\n </Link>\n ) : (\n content\n );\n\n return (\n <Element\n ref={ref}\n {...sizeStyles}\n {...iconPad}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n alignSelf={isFilled ? 'stretch' : isAuto ? 'flex-start' : undefined}\n borderRadius={ButtonShapes[shape as Shape]}\n opacity={isDisabled ? 0.6 : 1}\n onPress={!isDisabled && !isLoading ? (onClick as any) : undefined}\n {...base}\n {...views?.container}\n {...props}\n >\n {linkOrContent}\n </Element>\n );\n }\n )\n);\n\nexport default ButtonView;\n",
83
+ "content": "/**\n * ButtonView (React Native) – simplified RN-friendly view.\n * - Drops web-only animations (borderMoving / animatedStroke / borderReveal) and\n * gracefully falls back to the default Standard button.\n * - Uses app-studio's <Element/> (renders a Pressable when onPress is set).\n * - Preserves the public API surface of the web ButtonView.\n */\n\nimport React, { useMemo } from 'react';\nimport { Element, Horizontal, Vertical, View, Text } from 'app-studio';\nimport { Linking } from 'react-native';\nimport type { LinkProps } from '../../Link/Link/Link.props';\nimport { Loader } from '../../Loader/Loader';\nimport { ButtonProps } from './Button.props';\nimport {\n ButtonSizes,\n ButtonShapes,\n IconSizes,\n getButtonVariants,\n} from './Button.style';\nimport {\n useDesignSystem,\n deepMerge,\n mergeDesignSystemViews,\n} from '../../../design-system/theme';\nimport { Shape, Size, Variant } from './Button.type';\n\n// --- Helper: Button Content ---\nconst ButtonContent: React.FC<{\n children: React.ReactNode;\n icon?: React.ReactNode;\n isLoading?: boolean;\n iconPosition?: string;\n loaderPosition?: string;\n size?: Size;\n resolvedTextColor: string;\n isIconRounded?: boolean;\n views?: any;\n}> = React.memo(\n ({\n children,\n icon,\n isLoading,\n iconPosition = 'left',\n loaderPosition = 'left',\n size = 'md',\n resolvedTextColor,\n views,\n }) => {\n const Wrapper = ['left', 'right'].includes(iconPosition)\n ? Horizontal\n : Vertical;\n const sizeStyles = ButtonSizes[size];\n\n // On native, `color` does NOT cascade into an icon's SVG the way it does on\n // web — an icon whose color is `currentColor` would fall back to a dark\n // default and vanish on a coloured button. Inject the button's text color\n // into the icon unless it already specifies one.\n const tintedIcon = React.isValidElement(icon)\n ? React.cloneElement(icon as any, {\n color: (icon as any).props?.color ?? resolvedTextColor,\n })\n : icon;\n\n return (\n <Wrapper\n gap={8}\n alignItems=\"center\"\n justifyContent=\"center\"\n fontSize={sizeStyles.fontSize}\n fontWeight={sizeStyles.fontWeight}\n lineHeight={sizeStyles.lineHeight}\n letterSpacing={sizeStyles.letterSpacing}\n color={resolvedTextColor}\n {...views?.content}\n >\n {isLoading && loaderPosition === 'left' && (\n <Loader\n size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}\n color={resolvedTextColor}\n {...views?.loader}\n />\n )}\n\n {icon && ['left', 'top'].includes(iconPosition) && !isLoading && (\n <View color={resolvedTextColor} {...views?.icon}>\n {tintedIcon}\n </View>\n )}\n\n {React.Children.map(children, (child) =>\n typeof child === 'string' || typeof child === 'number' ? (\n <Text color={resolvedTextColor}>{child}</Text>\n ) : (\n child\n )\n )}\n\n {icon && ['right', 'bottom'].includes(iconPosition) && !isLoading && (\n <View color={resolvedTextColor} {...views?.icon}>\n {tintedIcon}\n </View>\n )}\n\n {isLoading && loaderPosition === 'right' && (\n <Loader\n size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}\n color={resolvedTextColor}\n {...views?.loader}\n />\n )}\n </Wrapper>\n );\n }\n);\n\nconst noopPress = () => {};\n\n// --- Main Component ---\nfunction NativeLink({\n to,\n href,\n isExternal,\n onPress,\n children,\n ...props\n}: LinkProps) {\n const url = href ?? (isExternal ? to : undefined);\n return (\n <Horizontal\n accessibilityRole=\"link\"\n onPress={\n url\n ? () => {\n void Linking.openURL(url).catch(() => {});\n }\n : onPress\n }\n {...props}\n >\n {children}\n </Horizontal>\n );\n}\n\nconst ButtonView = React.memo(\n React.forwardRef<\n any,\n ButtonProps & {\n linkComponent?: React.ComponentType<LinkProps>;\n themeViews?: ButtonProps['views'];\n }\n >(\n (\n {\n variant = 'filled',\n size = 'md',\n shape = 'rounded',\n iconPosition = 'left',\n loaderPosition = 'left',\n backgroundColor,\n color,\n textColor,\n explicitTextColor,\n reversed = false,\n isAuto = true,\n isFilled,\n isDisabled,\n isLoading,\n disabled,\n isIconRounded,\n icon,\n children,\n to,\n isExternal,\n linkComponent: Link = NativeLink,\n shadow,\n onClick,\n ariaLabel,\n accessibilityState,\n views: instanceViews = {},\n themeViews,\n config: buttonConfig,\n ...props\n },\n ref\n ) => {\n const baseColorKey = backgroundColor ?? color ?? 'theme-primary';\n const mainColorKey = isDisabled\n ? 'theme-disabled'\n : isLoading\n ? 'theme-loading'\n : baseColorKey;\n // Mirrors Button.view.tsx: instance-declared `explicitTextColor`\n // (resolved by the Button wrapper) wins over a config's `textColor`.\n const textColorKey = explicitTextColor ?? textColor ?? 'color-white';\n\n const { config } = useDesignSystem();\n const theme = config?.theme;\n const palette = useMemo(() => {\n const basePalette = getButtonVariants(\n mainColorKey,\n textColorKey,\n reversed,\n theme\n );\n if (buttonConfig?.variants) {\n Object.keys(buttonConfig.variants).forEach((v) => {\n if (basePalette[v as Variant]) {\n basePalette[v as Variant] = deepMerge(\n basePalette[v as Variant],\n buttonConfig.variants[v]\n );\n }\n });\n }\n return basePalette;\n }, [mainColorKey, textColorKey, reversed, theme, buttonConfig?.variants]);\n\n const variantBase = palette[variant as Variant] ?? palette.filled;\n const base = explicitTextColor\n ? { ...variantBase, color: explicitTextColor }\n : variantBase;\n const views = themeViews\n ? mergeDesignSystemViews<NonNullable<ButtonProps['views']>>(\n themeViews,\n { container: base },\n instanceViews\n )\n : instanceViews;\n const slotColor =\n themeViews && (views.container?.style?.color ?? views.container?.color);\n const finalContentColor = (slotColor ||\n base.color ||\n textColorKey) as string;\n\n const content = (\n <ButtonContent\n icon={icon}\n isLoading={isLoading}\n iconPosition={iconPosition}\n loaderPosition={loaderPosition}\n size={size}\n resolvedTextColor={finalContentColor}\n isIconRounded={isIconRounded}\n views={views}\n >\n {children}\n </ButtonContent>\n );\n\n const sizeStyles = ButtonSizes[size as Size];\n const iconPad = isIconRounded ? IconSizes[size as Size] : {};\n\n const linkOrContent = to ? (\n <Link\n to={to}\n isExternal={isExternal}\n color={finalContentColor}\n {...views?.link}\n >\n {content}\n </Link>\n ) : (\n content\n );\n\n const pressDisabled = Boolean(\n isDisabled || isLoading || disabled || accessibilityState?.disabled\n );\n const activate = pressDisabled ? undefined : onClick;\n\n return (\n <Element\n ref={ref}\n {...sizeStyles}\n {...iconPad}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n alignSelf={isFilled ? 'stretch' : isAuto ? 'flex-start' : undefined}\n borderRadius={ButtonShapes[shape as Shape]}\n opacity={isDisabled ? 0.6 : 1}\n onPress={activate ?? (to ? undefined : noopPress)}\n disabled={to ? disabled : pressDisabled}\n accessibilityRole={to ? undefined : 'button'}\n accessibilityLabel={to ? undefined : ariaLabel}\n accessibilityState={\n to\n ? accessibilityState\n : {\n ...accessibilityState,\n disabled: pressDisabled,\n busy: Boolean(isLoading) || accessibilityState?.busy,\n }\n }\n {...base}\n {...views?.container}\n {...props}\n >\n {linkOrContent}\n </Element>\n );\n }\n )\n);\n\nexport default ButtonView;\n",
82
84
  "type": "registry:ui"
83
85
  },
84
86
  {
85
87
  "path": "src/components/Button/Button/Button.view.tsx",
86
- "content": "/**\n * ButtonView component – minimal and design‑system aligned.\n * - Chooses a **main color** with priority: `backgroundColor` → `color` → `theme-primary`.\n * - Uses `getButtonVariants` to derive base/hover/active styles per variant.\n */\n\nimport React, { useMemo } from 'react';\nimport { Element, Horizontal, Vertical, View } from 'app-studio';\nimport type { LinkProps } from '../../Link/Link/Link.props';\nimport { Loader } from '../../Loader/Loader';\nimport { ButtonProps } from './Button.props';\nimport { LoaderProps } from '../../Loader/Loader/Loader.props';\nimport {\n ButtonSizes,\n ButtonShapes,\n IconSizes,\n getButtonVariants,\n cssVar,\n} from './Button.style';\nimport { useDesignSystem, deepMerge } from '@app-studio/components/theme';\nimport { Variant } from './Button.type';\n\n// --- Helper: Button Content ---\n// Renders the inner content: Loader, Icon, and Children.\nconst ButtonContent: React.FC<{\n children: React.ReactNode;\n icon?: React.ReactNode;\n leftIcon?: React.ReactNode;\n rightIcon?: React.ReactNode;\n isLoading?: boolean;\n iconPosition?: string;\n loaderPosition?: string;\n size?: ButtonProps['size'];\n resolvedTextColor: string;\n isIconRounded?: boolean;\n loaderProps?: LoaderProps;\n views?: any;\n}> = React.memo(\n ({\n children,\n icon,\n leftIcon,\n rightIcon,\n isLoading,\n iconPosition = 'left',\n loaderPosition = 'left',\n size = 'md',\n resolvedTextColor,\n isIconRounded,\n loaderProps,\n views,\n }) => {\n const Wrapper = ['left', 'right'].includes(iconPosition)\n ? Horizontal\n : Vertical;\n const sizeStyles = ButtonSizes[size];\n\n return (\n <Wrapper\n gap={8}\n alignItems=\"center\"\n justifyContent=\"center\"\n fontSize={sizeStyles.fontSize}\n fontWeight={sizeStyles.fontWeight}\n lineHeight={sizeStyles.lineHeight}\n letterSpacing={sizeStyles.letterSpacing}\n whiteSpace=\"nowrap\"\n color={resolvedTextColor}\n {...views?.content}\n >\n {isLoading && loaderPosition === 'left' && (\n <Loader\n size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}\n color={resolvedTextColor}\n {...loaderProps}\n {...views?.loader}\n />\n )}\n\n {leftIcon && (\n <View color={resolvedTextColor} {...views?.icon}>\n {leftIcon}\n </View>\n )}\n\n {icon && ['left', 'top'].includes(iconPosition) && !isLoading && (\n <View color={resolvedTextColor} {...views?.icon}>\n {icon}\n </View>\n )}\n\n {children}\n\n {icon && ['right', 'bottom'].includes(iconPosition) && !isLoading && (\n <View color={resolvedTextColor} {...views?.icon}>\n {icon}\n </View>\n )}\n\n {rightIcon && (\n <View color={resolvedTextColor} {...views?.icon}>\n {rightIcon}\n </View>\n )}\n\n {isLoading && loaderPosition === 'right' && (\n <Loader\n size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}\n color={resolvedTextColor}\n {...loaderProps}\n {...views?.loader}\n />\n )}\n </Wrapper>\n );\n }\n);\n\n// --- Animation Logic moved to StandardButton ---\n\n// --- Variant: Standard Button ---\n// --- Helpers ---\n\n// Helper to calculate numeric border radius\nconst getNumericBorderRadius = (shape: string): number => {\n const shapeValue = ButtonShapes[shape as keyof typeof ButtonShapes];\n if (typeof shapeValue === 'number') return shapeValue;\n if (typeof shapeValue === 'string') return parseInt(shapeValue, 10) || 0;\n return 0;\n};\n\n// Common Inner Button Surface\nconst InnerButton: React.FC<{\n asComponent: any;\n isDisabled?: boolean;\n isLoading?: boolean;\n isWrapped?: boolean;\n borderRadius?: any;\n width?: any;\n height?: any;\n baseStyles?: any;\n sizeStyles?: any;\n iconPad?: any;\n mainTone?: string;\n resolvedTextColor?: any;\n children?: React.ReactNode;\n borderWidth?: number;\n [x: string]: any;\n}> = ({\n asComponent,\n isDisabled,\n isLoading,\n isWrapped = false,\n borderRadius,\n width,\n height,\n baseStyles,\n sizeStyles,\n iconPad,\n mainTone,\n resolvedTextColor,\n children,\n borderWidth = 0,\n ...props\n}) => {\n return (\n <Element\n as={asComponent}\n disabled={Boolean(isDisabled || isLoading)}\n display={isWrapped ? 'flex' : 'inline-flex'}\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={borderRadius}\n width={width}\n height={height}\n {...baseStyles}\n {...sizeStyles}\n {...iconPad}\n // Ensure background is solid for wrapped buttons if baseStyles doesn't provide it\n backgroundColor={\n baseStyles?.backgroundColor || (isWrapped ? mainTone : undefined)\n }\n color={resolvedTextColor}\n borderWidth={isWrapped ? 0 : undefined}\n cursor={isDisabled ? 'default' : 'pointer'}\n {...props}\n >\n {children}\n </Element>\n );\n};\n\n// Common Header for Border Animations\nconst BorderWrapper: React.FC<{\n shape: string;\n isDisabled?: boolean;\n onClick?: any;\n shadow?: any;\n borderWidth: number;\n isAuto?: boolean;\n isFilled?: boolean;\n views?: any;\n children: React.ReactNode;\n [x: string]: any;\n}> = ({\n shape,\n isDisabled,\n onClick,\n shadow,\n borderWidth,\n isAuto,\n isFilled,\n views,\n children,\n ...props\n}) => (\n <Element\n as=\"div\"\n position=\"relative\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={ButtonShapes[shape as keyof typeof ButtonShapes]}\n cursor={isDisabled ? 'default' : 'pointer'}\n onClick={onClick}\n boxShadow={shadow}\n padding={borderWidth}\n width={isFilled ? '100%' : isAuto ? 'fit-content' : undefined}\n {...views?.container}\n {...props}\n >\n {children}\n </Element>\n);\n\nconst ButtonAnchor = ({ to, isExternal, children, ...props }: LinkProps) => (\n <Element\n as=\"a\"\n href={to}\n {...(isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n >\n {children}\n </Element>\n);\n\ntype ButtonViewProps = ButtonProps & {\n linkComponent?: React.ComponentType<LinkProps>;\n};\n\n// --- Variant: Standard Button ---\nconst StandardButton: React.FC<\n ButtonViewProps & {\n baseStyles: any;\n sizeStyles: any;\n iconPad: any;\n containerRef?: React.Ref<HTMLElement>;\n // Extra props passed from ButtonView\n mainTone?: string;\n borderMovingDuration?: number;\n borderMovingGradientColors?: string[];\n animatedStrokeAccentColor?: string;\n animatedStrokeTextColor?: string;\n resolvedTextColor?: any;\n content?: React.ReactNode;\n }\n> = ({\n variant,\n animation,\n to,\n linkComponent: Link = ButtonAnchor,\n isDisabled,\n isLoading,\n isAuto,\n isFilled,\n isExternal,\n shape = 'rounded',\n shadow,\n onClick,\n views,\n baseStyles,\n sizeStyles,\n iconPad,\n containerRef,\n resolvedTextColor,\n content,\n size,\n mainTone,\n borderMovingDuration = 2,\n borderMovingGradientColors = ['#705CFF', '#FF5C97', '#FFC75C'],\n animatedStrokeAccentColor = '#705CFF',\n animatedStrokeTextColor = 'color-gray-900',\n ...props\n}) => {\n // --- Common Helpers ---\n const numericBorderRadius = getNumericBorderRadius(shape);\n\n const linkOrContent = to ? (\n <Link\n to={to}\n isExternal={isExternal}\n color=\"currentColor\"\n textDecoration=\"inherit\"\n _hover={{ color: 'currentColor' }}\n {...views?.link}\n >\n {content}\n </Link>\n ) : (\n content\n );\n\n const innerProps = {\n isDisabled,\n isLoading,\n baseStyles,\n sizeStyles,\n iconPad,\n resolvedTextColor,\n mainTone,\n children: linkOrContent,\n };\n\n // --- Animation: Border Moving ---\n if (animation === 'borderMoving' && borderMovingGradientColors) {\n const borderWidth = 3;\n const borderAnimation = {\n from: { backgroundPosition: '0% 50%' },\n to: { backgroundPosition: '200% 50%' },\n duration: `${borderMovingDuration}s`,\n timingFunction: 'linear',\n iterationCount: 'infinite',\n };\n\n return (\n <BorderWrapper\n shape={shape}\n isDisabled={isDisabled}\n onClick={onClick}\n shadow={shadow}\n borderWidth={borderWidth as any}\n isAuto={isAuto}\n isFilled={isFilled}\n views={views}\n background={`linear-gradient(90deg, ${cssVar(\n borderMovingGradientColors[0]\n )}, ${cssVar(borderMovingGradientColors[1])}, ${cssVar(\n borderMovingGradientColors[2]\n )}, ${cssVar(borderMovingGradientColors[0])})`}\n backgroundSize=\"200% 100%\"\n animate={borderAnimation}\n {...props}\n >\n <InnerButton\n asComponent={to ? 'div' : 'button'}\n isWrapped={true}\n borderRadius={Math.max(0, numericBorderRadius - borderWidth)}\n width=\"100%\"\n height=\"100%\"\n {...innerProps}\n />\n </BorderWrapper>\n );\n }\n\n // --- Animation: Animated Stroke ---\n if (animation === 'animatedStroke') {\n // SVG stroke / CSS color need a real CSS value — wrap tokens in var(--…).\n const resolvedAccentColor = cssVar(animatedStrokeAccentColor);\n const resolvedStrokeTextColor = cssVar(animatedStrokeTextColor);\n const strokePathLength = 1000;\n const strokeAnimation = {\n from: {\n strokeWidth: '8px',\n strokeDasharray: `0 ${strokePathLength}`,\n strokeDashoffset: -Math.round(strokePathLength * 0.63),\n },\n to: {\n strokeWidth: '3px',\n strokeDasharray: `${strokePathLength}`,\n strokeDashoffset: 0,\n },\n duration: '0.9s',\n timingFunction: 'ease-in',\n fillMode: 'forwards',\n };\n\n const mergedClassName = [\n 'group',\n (views?.container as any)?.className,\n (props as any)?.className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <Element\n ref={containerRef}\n as={to ? 'div' : 'button'}\n type={to ? undefined : 'button'}\n disabled={Boolean(!to && (isDisabled || isLoading))}\n onClick={onClick}\n position=\"relative\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n width={isFilled ? '100%' : isAuto ? 'fit-content' : undefined}\n borderRadius={ButtonShapes[shape as keyof typeof ButtonShapes]}\n boxShadow={shadow as any}\n transition=\"background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease\"\n cursor={isDisabled ? 'default' : 'pointer'}\n color={resolvedStrokeTextColor}\n backgroundColor=\"transparent\"\n borderWidth={0}\n {...views?.container}\n {...props}\n className={mergedClassName}\n >\n <View\n as=\"svg\"\n position=\"absolute\"\n top={0}\n right={0}\n bottom={0}\n left={0}\n width=\"100%\"\n height=\"100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n pointerEvents=\"none\"\n zIndex={1}\n aria-hidden=\"true\"\n >\n <View\n as=\"rect\"\n x=\"0\"\n y=\"0\"\n height=\"100%\"\n width=\"100%\"\n rx={numericBorderRadius}\n ry={numericBorderRadius}\n fill=\"transparent\"\n stroke={resolvedAccentColor}\n strokeWidth=\"8px\"\n strokeDasharray={`0 ${strokePathLength}`}\n strokeDashoffset={-Math.round(strokePathLength * 0.63)}\n {...({ pathLength: strokePathLength } as any)}\n on={{\n groupHover: {\n animate: strokeAnimation as any,\n },\n }}\n />\n </View>\n\n <View position=\"relative\" zIndex={0}>\n {linkOrContent}\n </View>\n </Element>\n );\n }\n\n // --- Animation: Border Reveal ---\n if (animation === 'borderReveal') {\n const borderWidth = 3;\n // Use the first color from gradient colors or fall back to mainTone.\n // Wrap in var(--…) so app-studio tokens render inside CSS gradient strings.\n const activeColor = cssVar(\n borderMovingGradientColors?.[0] || mainTone || '#000000'\n );\n\n // Sides duration\n // The default duration (2s) is too slow for a hover interaction.\n // We scale it by 0.25 to make it responsive (0.5s total).\n const effectiveDuration = borderMovingDuration * 0.75;\n const sideDuration = effectiveDuration / 4;\n\n // Gradients for each side (color 50%, transparent 50%)\n const topGrad = `linear-gradient(90deg, ${activeColor} 50%, transparent 50%)`;\n const rightGrad = `linear-gradient(180deg, ${activeColor} 50%, transparent 50%)`;\n const bottomGrad = `linear-gradient(270deg, ${activeColor} 50%, transparent 50%)`;\n const leftGrad = `linear-gradient(0deg, ${activeColor} 50%, transparent 50%)`;\n\n // Coordinates:\n // Top (L->R): 100% 0 -> 0 0\n // Right (T->B): 100% 100% -> 100% 0\n // Bottom (R->L): 0 100% -> 100% 100%\n // Left (B->T): 0 0 -> 0 100%\n const bgPosStart = `100% 0, 100% 100%, 0 100%, 0 0`;\n const bgPosEnd = `0 0, 100% 0, 100% 100%, 0 100%`;\n\n // Delays:\n // Enter (Forward): Top(0), Right(1), Bottom(2), Left(3)\n const delayEnter = `0s, ${sideDuration}s, ${sideDuration * 2}s, ${\n sideDuration * 2\n }s`;\n // Exit (Reverse): Top(3), Right(2), Bottom(1), Left(0)\n const delayExit = `${sideDuration * 2}s, ${\n sideDuration * 2\n }s, ${sideDuration}s, 0s`;\n\n // Use slightly larger gradient size to overlap with button content (avoid gaps)\n const gradientSize = borderWidth + 1;\n\n return (\n <Element\n ref={containerRef}\n as=\"div\"\n position=\"relative\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={ButtonShapes[shape]}\n cursor={isDisabled ? 'default' : 'pointer'}\n onClick={onClick}\n boxShadow={shadow as any}\n padding={borderWidth}\n background={`\n ${topGrad} no-repeat,\n ${rightGrad} no-repeat,\n ${bottomGrad} no-repeat,\n ${leftGrad} no-repeat\n `}\n backgroundSize={`200% ${gradientSize}px, ${gradientSize}px 200%, 200% ${gradientSize}px, ${gradientSize}px 200%`}\n // Default State (Hidden)\n backgroundPosition={bgPosStart}\n transitionProperty=\"background-position\"\n transitionDuration={`${sideDuration}s`}\n transitionTimingFunction=\"linear\"\n transitionDelay={delayExit}\n // Hover State (Visible)\n _hover={{\n backgroundPosition: bgPosEnd,\n transitionDelay: delayEnter,\n }}\n width={isFilled ? '100%' : isAuto ? 'fit-content' : undefined}\n {...views?.container}\n {...props}\n >\n <View\n as={to ? 'div' : 'button'}\n disabled={Boolean(isDisabled || isLoading)}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={Math.max(0, numericBorderRadius - borderWidth)}\n width=\"100%\"\n height=\"100%\"\n {...baseStyles}\n {...sizeStyles}\n {...iconPad}\n backgroundColor={baseStyles?.backgroundColor || mainTone}\n color={resolvedTextColor}\n borderWidth={0}\n cursor={isDisabled ? 'default' : 'pointer'}\n >\n {linkOrContent}\n </View>\n </Element>\n );\n }\n\n // --- Default: Standard Button ---\n return (\n <Element\n ref={containerRef}\n as={variant === 'link' && to ? 'div' : 'button'}\n type={variant === 'link' && to ? undefined : 'button'}\n disabled={Boolean(isDisabled || isLoading)}\n /* sizing */\n {...sizeStyles}\n {...iconPad} // Apply icon padding if needed\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n width={isFilled ? '100%' : isAuto ? 'fit-content' : undefined}\n /* visuals */\n borderRadius={ButtonShapes[shape]}\n boxShadow={shadow as any}\n transition=\"background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease\"\n cursor={isDisabled ? 'default' : 'pointer'}\n onClick={onClick}\n {...baseStyles}\n {...views?.container}\n {...props}\n >\n {linkOrContent}\n </Element>\n );\n};\n\n// --- Main Component ---\nconst ButtonView = React.memo(\n React.forwardRef<HTMLElement, ButtonViewProps>(\n (\n {\n /* behaviour */\n variant = 'filled',\n size = 'md',\n shape = 'rounded',\n iconPosition = 'left',\n loaderPosition = 'left',\n backgroundColor, // Primary override for main color\n color, // Main button color (theme tokens or color palette)\n textColor, // Explicit text color\n explicitTextColor, // Instance-declared content color (set by wrapper)\n reversed = false, // Reverse colors for dark backgrounds\n isAuto = true,\n isFilled,\n isDisabled,\n isLoading,\n isIconRounded,\n isIcon,\n isHovered,\n /* content */\n icon,\n leftIcon,\n rightIcon,\n startIcon,\n endIcon,\n children,\n /* nav */\n to,\n linkComponent,\n isExternal,\n /* misc */\n shadow,\n onClick,\n views = {},\n animation,\n loaderProps,\n config: buttonConfig,\n ariaLabel,\n /* effect props */\n borderMovingDuration = 2,\n borderMovingGradientColors = ['#705CFF', '#FF5C97', '#FFC75C'],\n animatedStrokeAccentColor = '#705CFF',\n animatedStrokeTextColor = 'color-gray-900',\n ...props\n },\n ref\n ) => {\n /* MAIN COLOR – an app-studio token that drives the whole palette.\n * Priority: explicit backgroundColor → color → theme-primary.\n * State overrides: disabled → theme-disabled, loading → theme-loading.\n * Tokens are passed straight through to app-studio (no hex conversion). */\n const baseColorKey = backgroundColor ?? color ?? 'theme-primary';\n const mainColorKey = isDisabled\n ? 'theme-disabled'\n : isLoading\n ? 'theme-loading'\n : baseColorKey;\n\n /* TEXT COLOR – instance-declared `explicitTextColor` (resolved by the\n * Button wrapper before the design-system merge) wins over a config's\n * `textColor`, which stays advisory. Falls back to color-white. */\n const textColorKey = explicitTextColor ?? textColor ?? 'color-white';\n\n /* variant palette */\n const { config } = useDesignSystem();\n const theme = config?.theme;\n const palette = useMemo(() => {\n const basePalette = getButtonVariants(\n mainColorKey,\n textColorKey,\n reversed,\n theme\n );\n\n // Merge with any variant overrides from config\n if (buttonConfig?.variants) {\n Object.keys(buttonConfig.variants).forEach((v) => {\n if (basePalette[v as Variant]) {\n basePalette[v as Variant] = deepMerge(\n basePalette[v as Variant],\n buttonConfig.variants[v]\n );\n }\n });\n }\n return basePalette;\n }, [mainColorKey, textColorKey, reversed, theme, buttonConfig?.variants]);\n\n // Fall back to the `filled` palette for any unrecognised variant so an\n // unknown value never renders an unstyled (no-background) button — which\n // would drop white label text onto a light surface and fail contrast.\n const variantBase = palette[variant as Variant] ?? palette.filled;\n // An explicit content color overrides the variant's auto-calculated one\n // (outline/ghost/link derive it from the main tone otherwise).\n const base = explicitTextColor\n ? { ...variantBase, color: explicitTextColor }\n : variantBase;\n const finalContentColor = (base?.color as string) ?? textColorKey;\n\n // Render content logic safely\n const content = (\n <ButtonContent\n icon={icon}\n // `startIcon` / `endIcon` are compatibility aliases for\n // `leftIcon` / `rightIcon`; the left/right spelling wins when both\n // are provided.\n leftIcon={leftIcon ?? startIcon}\n rightIcon={rightIcon ?? endIcon}\n isLoading={isLoading}\n iconPosition={iconPosition}\n loaderPosition={loaderPosition}\n size={size}\n resolvedTextColor={finalContentColor}\n isIconRounded={isIconRounded}\n loaderProps={loaderProps}\n views={views}\n >\n {children}\n </ButtonContent>\n );\n\n // Standard variants (filled, outline, ghost, link)\n const sizeStyles = ButtonSizes[size];\n // `isIcon` marks an icon-only button: reuse the square icon padding\n // scale (the same slot `isIconRounded` uses) so the button stays compact.\n const iconPad = isIconRounded || isIcon ? IconSizes[size] : {};\n\n return (\n <StandardButton\n variant={variant}\n animation={animation}\n to={to}\n linkComponent={linkComponent}\n isDisabled={isDisabled}\n isLoading={isLoading}\n isAuto={isAuto}\n isFilled={isFilled}\n isExternal={isExternal}\n shape={shape}\n shadow={shadow}\n onClick={onClick}\n views={views}\n baseStyles={base}\n sizeStyles={sizeStyles}\n iconPad={iconPad}\n resolvedTextColor={finalContentColor}\n content={content as any}\n size={size}\n mainTone={mainColorKey}\n borderMovingDuration={borderMovingDuration}\n borderMovingGradientColors={borderMovingGradientColors}\n animatedStrokeAccentColor={animatedStrokeAccentColor}\n animatedStrokeTextColor={animatedStrokeTextColor}\n containerRef={ref}\n {...(ariaLabel !== undefined ? { 'aria-label': ariaLabel } : {})}\n {...props}\n />\n );\n }\n )\n);\n\nexport default ButtonView;\n",
88
+ "content": "/**\n * ButtonView component – minimal and design‑system aligned.\n * - Chooses a **main color** with priority: `backgroundColor` → `color` → `theme-primary`.\n * - Uses `getButtonVariants` to derive base/hover/active styles per variant.\n */\n\nimport React, { useMemo } from 'react';\nimport { Element, Horizontal, Vertical, View } from 'app-studio';\nimport type { LinkProps } from '../../Link/Link/Link.props';\nimport { Loader } from '../../Loader/Loader';\nimport { ButtonProps } from './Button.props';\nimport { LoaderProps } from '../../Loader/Loader/Loader.props';\nimport {\n ButtonSizes,\n ButtonShapes,\n IconSizes,\n getButtonVariants,\n cssVar,\n} from './Button.style';\nimport {\n useDesignSystem,\n deepMerge,\n mergeDesignSystemViews,\n} from '../../../design-system/theme';\nimport { Variant } from './Button.type';\n\n// --- Helper: Button Content ---\n// Renders the inner content: Loader, Icon, and Children.\nconst ButtonContent: React.FC<{\n children: React.ReactNode;\n icon?: React.ReactNode;\n leftIcon?: React.ReactNode;\n rightIcon?: React.ReactNode;\n isLoading?: boolean;\n iconPosition?: string;\n loaderPosition?: string;\n size?: ButtonProps['size'];\n resolvedTextColor: string;\n isIconRounded?: boolean;\n loaderProps?: LoaderProps;\n views?: any;\n}> = React.memo(\n ({\n children,\n icon,\n leftIcon,\n rightIcon,\n isLoading,\n iconPosition = 'left',\n loaderPosition = 'left',\n size = 'md',\n resolvedTextColor,\n isIconRounded,\n loaderProps,\n views,\n }) => {\n const Wrapper = ['left', 'right'].includes(iconPosition)\n ? Horizontal\n : Vertical;\n const sizeStyles = ButtonSizes[size];\n\n return (\n <Wrapper\n gap={8}\n alignItems=\"center\"\n justifyContent=\"center\"\n fontSize={sizeStyles.fontSize}\n fontWeight={sizeStyles.fontWeight}\n lineHeight={sizeStyles.lineHeight}\n letterSpacing={sizeStyles.letterSpacing}\n whiteSpace=\"nowrap\"\n color={resolvedTextColor}\n {...views?.content}\n >\n {isLoading && loaderPosition === 'left' && (\n <Loader\n size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}\n color={resolvedTextColor}\n {...loaderProps}\n {...views?.loader}\n />\n )}\n\n {leftIcon && (\n <View color={resolvedTextColor} {...views?.icon}>\n {leftIcon}\n </View>\n )}\n\n {icon && ['left', 'top'].includes(iconPosition) && !isLoading && (\n <View color={resolvedTextColor} {...views?.icon}>\n {icon}\n </View>\n )}\n\n {children}\n\n {icon && ['right', 'bottom'].includes(iconPosition) && !isLoading && (\n <View color={resolvedTextColor} {...views?.icon}>\n {icon}\n </View>\n )}\n\n {rightIcon && (\n <View color={resolvedTextColor} {...views?.icon}>\n {rightIcon}\n </View>\n )}\n\n {isLoading && loaderPosition === 'right' && (\n <Loader\n size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}\n color={resolvedTextColor}\n {...loaderProps}\n {...views?.loader}\n />\n )}\n </Wrapper>\n );\n }\n);\n\n// --- Animation Logic moved to StandardButton ---\n\n// --- Variant: Standard Button ---\n// --- Helpers ---\n\n// Helper to calculate numeric border radius\nconst getNumericBorderRadius = (shape: string): number => {\n const shapeValue = ButtonShapes[shape as keyof typeof ButtonShapes];\n if (typeof shapeValue === 'number') return shapeValue;\n if (typeof shapeValue === 'string') return parseInt(shapeValue, 10) || 0;\n return 0;\n};\n\n// Common Inner Button Surface\nconst InnerButton: React.FC<{\n asComponent: any;\n isDisabled?: boolean;\n isLoading?: boolean;\n isWrapped?: boolean;\n borderRadius?: any;\n width?: any;\n height?: any;\n baseStyles?: any;\n sizeStyles?: any;\n iconPad?: any;\n mainTone?: string;\n resolvedTextColor?: any;\n children?: React.ReactNode;\n borderWidth?: number;\n [x: string]: any;\n}> = ({\n asComponent,\n isDisabled,\n isLoading,\n isWrapped = false,\n borderRadius,\n width,\n height,\n baseStyles,\n sizeStyles,\n iconPad,\n mainTone,\n resolvedTextColor,\n children,\n borderWidth = 0,\n ...props\n}) => {\n return (\n <Element\n as={asComponent}\n disabled={Boolean(isDisabled || isLoading)}\n display={isWrapped ? 'flex' : 'inline-flex'}\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={borderRadius}\n width={width}\n height={height}\n {...baseStyles}\n {...sizeStyles}\n {...iconPad}\n // Ensure background is solid for wrapped buttons if baseStyles doesn't provide it\n backgroundColor={\n baseStyles?.backgroundColor || (isWrapped ? mainTone : undefined)\n }\n color={resolvedTextColor}\n borderWidth={isWrapped ? 0 : undefined}\n cursor={isDisabled ? 'default' : 'pointer'}\n {...props}\n >\n {children}\n </Element>\n );\n};\n\n// Common Header for Border Animations\nconst BorderWrapper: React.FC<{\n shape: string;\n isDisabled?: boolean;\n onClick?: any;\n shadow?: any;\n borderWidth: number;\n isAuto?: boolean;\n isFilled?: boolean;\n views?: any;\n children: React.ReactNode;\n [x: string]: any;\n}> = ({\n shape,\n isDisabled,\n onClick,\n shadow,\n borderWidth,\n isAuto,\n isFilled,\n views,\n children,\n ...props\n}) => (\n <Element\n as=\"div\"\n position=\"relative\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={ButtonShapes[shape as keyof typeof ButtonShapes]}\n cursor={isDisabled ? 'default' : 'pointer'}\n onClick={onClick}\n boxShadow={shadow}\n padding={borderWidth}\n width={isFilled ? '100%' : isAuto ? 'fit-content' : undefined}\n {...views?.container}\n {...props}\n >\n {children}\n </Element>\n);\n\nconst ButtonAnchor = ({ to, isExternal, children, ...props }: LinkProps) => (\n <Element\n as=\"a\"\n href={to}\n {...(isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n >\n {children}\n </Element>\n);\n\ntype ButtonViewProps = ButtonProps & {\n linkComponent?: React.ComponentType<LinkProps>;\n};\n\n// --- Variant: Standard Button ---\nconst StandardButton: React.FC<\n ButtonViewProps & {\n baseStyles: any;\n sizeStyles: any;\n iconPad: any;\n containerRef?: React.Ref<HTMLElement>;\n // Extra props passed from ButtonView\n mainTone?: string;\n borderMovingDuration?: number;\n borderMovingGradientColors?: string[];\n animatedStrokeAccentColor?: string;\n animatedStrokeTextColor?: string;\n resolvedTextColor?: any;\n content?: React.ReactNode;\n }\n> = ({\n variant,\n animation,\n to,\n linkComponent: Link = ButtonAnchor,\n isDisabled,\n isLoading,\n isAuto,\n isFilled,\n isExternal,\n shape = 'rounded',\n shadow,\n onClick,\n views,\n baseStyles,\n sizeStyles,\n iconPad,\n containerRef,\n resolvedTextColor,\n content,\n size,\n mainTone,\n borderMovingDuration = 2,\n borderMovingGradientColors = ['#705CFF', '#FF5C97', '#FFC75C'],\n animatedStrokeAccentColor = '#705CFF',\n animatedStrokeTextColor = 'color-gray-900',\n ...props\n}) => {\n // --- Common Helpers ---\n const numericBorderRadius = getNumericBorderRadius(shape);\n\n const linkOrContent = to ? (\n <Link\n to={to}\n isExternal={isExternal}\n color=\"currentColor\"\n textDecoration=\"inherit\"\n _hover={{ color: 'currentColor' }}\n {...views?.link}\n >\n {content}\n </Link>\n ) : (\n content\n );\n\n const innerProps = {\n isDisabled,\n isLoading,\n baseStyles,\n sizeStyles,\n iconPad,\n resolvedTextColor,\n mainTone,\n children: linkOrContent,\n };\n\n // --- Animation: Border Moving ---\n if (animation === 'borderMoving' && borderMovingGradientColors) {\n const borderWidth = 3;\n const borderAnimation = {\n from: { backgroundPosition: '0% 50%' },\n to: { backgroundPosition: '200% 50%' },\n duration: `${borderMovingDuration}s`,\n timingFunction: 'linear',\n iterationCount: 'infinite',\n };\n\n return (\n <BorderWrapper\n shape={shape}\n isDisabled={isDisabled}\n onClick={onClick}\n shadow={shadow}\n borderWidth={borderWidth as any}\n isAuto={isAuto}\n isFilled={isFilled}\n views={views}\n background={`linear-gradient(90deg, ${cssVar(\n borderMovingGradientColors[0]\n )}, ${cssVar(borderMovingGradientColors[1])}, ${cssVar(\n borderMovingGradientColors[2]\n )}, ${cssVar(borderMovingGradientColors[0])})`}\n backgroundSize=\"200% 100%\"\n animate={borderAnimation}\n {...props}\n >\n <InnerButton\n asComponent={to ? 'div' : 'button'}\n isWrapped={true}\n borderRadius={Math.max(0, numericBorderRadius - borderWidth)}\n width=\"100%\"\n height=\"100%\"\n {...innerProps}\n />\n </BorderWrapper>\n );\n }\n\n // --- Animation: Animated Stroke ---\n if (animation === 'animatedStroke') {\n // SVG stroke / CSS color need a real CSS value — wrap tokens in var(--…).\n const resolvedAccentColor = cssVar(animatedStrokeAccentColor);\n const resolvedStrokeTextColor = cssVar(animatedStrokeTextColor);\n const strokePathLength = 1000;\n const strokeAnimation = {\n from: {\n strokeWidth: '8px',\n strokeDasharray: `0 ${strokePathLength}`,\n strokeDashoffset: -Math.round(strokePathLength * 0.63),\n },\n to: {\n strokeWidth: '3px',\n strokeDasharray: `${strokePathLength}`,\n strokeDashoffset: 0,\n },\n duration: '0.9s',\n timingFunction: 'ease-in',\n fillMode: 'forwards',\n };\n\n const mergedClassName = [\n 'group',\n (views?.container as any)?.className,\n (props as any)?.className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <Element\n ref={containerRef}\n as={to ? 'div' : 'button'}\n type={to ? undefined : 'button'}\n disabled={Boolean(!to && (isDisabled || isLoading))}\n onClick={onClick}\n position=\"relative\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n width={isFilled ? '100%' : isAuto ? 'fit-content' : undefined}\n borderRadius={ButtonShapes[shape as keyof typeof ButtonShapes]}\n boxShadow={shadow as any}\n transition=\"background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease\"\n cursor={isDisabled ? 'default' : 'pointer'}\n color={resolvedStrokeTextColor}\n backgroundColor=\"transparent\"\n borderWidth={0}\n {...views?.container}\n {...props}\n className={mergedClassName}\n >\n <View\n as=\"svg\"\n position=\"absolute\"\n top={0}\n right={0}\n bottom={0}\n left={0}\n width=\"100%\"\n height=\"100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n pointerEvents=\"none\"\n zIndex={1}\n aria-hidden=\"true\"\n >\n <View\n as=\"rect\"\n x=\"0\"\n y=\"0\"\n height=\"100%\"\n width=\"100%\"\n rx={numericBorderRadius}\n ry={numericBorderRadius}\n fill=\"transparent\"\n stroke={resolvedAccentColor}\n strokeWidth=\"8px\"\n strokeDasharray={`0 ${strokePathLength}`}\n strokeDashoffset={-Math.round(strokePathLength * 0.63)}\n {...({ pathLength: strokePathLength } as any)}\n on={{\n groupHover: {\n animate: strokeAnimation as any,\n },\n }}\n />\n </View>\n\n <View position=\"relative\" zIndex={0}>\n {linkOrContent}\n </View>\n </Element>\n );\n }\n\n // --- Animation: Border Reveal ---\n if (animation === 'borderReveal') {\n const borderWidth = 3;\n // Use the first color from gradient colors or fall back to mainTone.\n // Wrap in var(--…) so app-studio tokens render inside CSS gradient strings.\n const activeColor = cssVar(\n borderMovingGradientColors?.[0] || mainTone || '#000000'\n );\n\n // Sides duration\n // The default duration (2s) is too slow for a hover interaction.\n // We scale it by 0.25 to make it responsive (0.5s total).\n const effectiveDuration = borderMovingDuration * 0.75;\n const sideDuration = effectiveDuration / 4;\n\n // Gradients for each side (color 50%, transparent 50%)\n const topGrad = `linear-gradient(90deg, ${activeColor} 50%, transparent 50%)`;\n const rightGrad = `linear-gradient(180deg, ${activeColor} 50%, transparent 50%)`;\n const bottomGrad = `linear-gradient(270deg, ${activeColor} 50%, transparent 50%)`;\n const leftGrad = `linear-gradient(0deg, ${activeColor} 50%, transparent 50%)`;\n\n // Coordinates:\n // Top (L->R): 100% 0 -> 0 0\n // Right (T->B): 100% 100% -> 100% 0\n // Bottom (R->L): 0 100% -> 100% 100%\n // Left (B->T): 0 0 -> 0 100%\n const bgPosStart = `100% 0, 100% 100%, 0 100%, 0 0`;\n const bgPosEnd = `0 0, 100% 0, 100% 100%, 0 100%`;\n\n // Delays:\n // Enter (Forward): Top(0), Right(1), Bottom(2), Left(3)\n const delayEnter = `0s, ${sideDuration}s, ${sideDuration * 2}s, ${\n sideDuration * 2\n }s`;\n // Exit (Reverse): Top(3), Right(2), Bottom(1), Left(0)\n const delayExit = `${sideDuration * 2}s, ${\n sideDuration * 2\n }s, ${sideDuration}s, 0s`;\n\n // Use slightly larger gradient size to overlap with button content (avoid gaps)\n const gradientSize = borderWidth + 1;\n\n return (\n <Element\n ref={containerRef}\n as=\"div\"\n position=\"relative\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={ButtonShapes[shape]}\n cursor={isDisabled ? 'default' : 'pointer'}\n onClick={onClick}\n boxShadow={shadow as any}\n padding={borderWidth}\n background={`\n ${topGrad} no-repeat,\n ${rightGrad} no-repeat,\n ${bottomGrad} no-repeat,\n ${leftGrad} no-repeat\n `}\n backgroundSize={`200% ${gradientSize}px, ${gradientSize}px 200%, 200% ${gradientSize}px, ${gradientSize}px 200%`}\n // Default State (Hidden)\n backgroundPosition={bgPosStart}\n transitionProperty=\"background-position\"\n transitionDuration={`${sideDuration}s`}\n transitionTimingFunction=\"linear\"\n transitionDelay={delayExit}\n // Hover State (Visible)\n _hover={{\n backgroundPosition: bgPosEnd,\n transitionDelay: delayEnter,\n }}\n width={isFilled ? '100%' : isAuto ? 'fit-content' : undefined}\n {...views?.container}\n {...props}\n >\n <View\n as={to ? 'div' : 'button'}\n disabled={Boolean(isDisabled || isLoading)}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n borderRadius={Math.max(0, numericBorderRadius - borderWidth)}\n width=\"100%\"\n height=\"100%\"\n {...baseStyles}\n {...sizeStyles}\n {...iconPad}\n backgroundColor={baseStyles?.backgroundColor || mainTone}\n color={resolvedTextColor}\n borderWidth={0}\n cursor={isDisabled ? 'default' : 'pointer'}\n >\n {linkOrContent}\n </View>\n </Element>\n );\n }\n\n // --- Default: Standard Button ---\n return (\n <Element\n ref={containerRef}\n as={variant === 'link' && to ? 'div' : 'button'}\n type={variant === 'link' && to ? undefined : 'button'}\n disabled={Boolean(isDisabled || isLoading)}\n /* sizing */\n {...sizeStyles}\n {...iconPad} // Apply icon padding if needed\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n width={isFilled ? '100%' : isAuto ? 'fit-content' : undefined}\n /* visuals */\n borderRadius={ButtonShapes[shape]}\n boxShadow={shadow as any}\n transition=\"background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease\"\n cursor={isDisabled ? 'default' : 'pointer'}\n onClick={onClick}\n {...baseStyles}\n {...views?.container}\n {...props}\n >\n {linkOrContent}\n </Element>\n );\n};\n\n// --- Main Component ---\nconst ButtonView = React.memo(\n React.forwardRef<\n HTMLElement,\n ButtonViewProps & { themeViews?: ButtonProps['views'] }\n >(\n (\n {\n /* behaviour */\n variant = 'filled',\n size = 'md',\n shape = 'rounded',\n iconPosition = 'left',\n loaderPosition = 'left',\n backgroundColor, // Primary override for main color\n color, // Main button color (theme tokens or color palette)\n textColor, // Explicit text color\n explicitTextColor, // Instance-declared content color (set by wrapper)\n reversed = false, // Reverse colors for dark backgrounds\n isAuto = true,\n isFilled,\n isDisabled,\n isLoading,\n isIconRounded,\n isIcon,\n isHovered,\n /* content */\n icon,\n leftIcon,\n rightIcon,\n startIcon,\n endIcon,\n children,\n /* nav */\n to,\n linkComponent,\n isExternal,\n /* misc */\n shadow,\n onClick,\n views: instanceViews = {},\n themeViews,\n animation,\n loaderProps,\n config: buttonConfig,\n ariaLabel,\n /* effect props */\n borderMovingDuration = 2,\n borderMovingGradientColors = ['#705CFF', '#FF5C97', '#FFC75C'],\n animatedStrokeAccentColor = '#705CFF',\n animatedStrokeTextColor = 'color-gray-900',\n ...props\n },\n ref\n ) => {\n /* MAIN COLOR – an app-studio token that drives the whole palette.\n * Priority: explicit backgroundColor → color → theme-primary.\n * State overrides: disabled → theme-disabled, loading → theme-loading.\n * Tokens are passed straight through to app-studio (no hex conversion). */\n const baseColorKey = backgroundColor ?? color ?? 'theme-primary';\n const mainColorKey = isDisabled\n ? 'theme-disabled'\n : isLoading\n ? 'theme-loading'\n : baseColorKey;\n\n /* TEXT COLOR – instance-declared `explicitTextColor` (resolved by the\n * Button wrapper before the design-system merge) wins over a config's\n * `textColor`, which stays advisory. Falls back to color-white. */\n const textColorKey = explicitTextColor ?? textColor ?? 'color-white';\n\n /* variant palette */\n const { config } = useDesignSystem();\n const theme = config?.theme;\n const palette = useMemo(() => {\n const basePalette = getButtonVariants(\n mainColorKey,\n textColorKey,\n reversed,\n theme\n );\n\n // Merge with any variant overrides from config\n if (buttonConfig?.variants) {\n Object.keys(buttonConfig.variants).forEach((v) => {\n if (basePalette[v as Variant]) {\n basePalette[v as Variant] = deepMerge(\n basePalette[v as Variant],\n buttonConfig.variants[v]\n );\n }\n });\n }\n return basePalette;\n }, [mainColorKey, textColorKey, reversed, theme, buttonConfig?.variants]);\n\n // Fall back to the `filled` palette for any unrecognised variant so an\n // unknown value never renders an unstyled (no-background) button — which\n // would drop white label text onto a light surface and fail contrast.\n const variantBase = palette[variant as Variant] ?? palette.filled;\n // An explicit content color overrides the variant's auto-calculated one\n // (outline/ghost/link derive it from the main tone otherwise).\n const base = explicitTextColor\n ? { ...variantBase, color: explicitTextColor }\n : variantBase;\n const views = themeViews\n ? mergeDesignSystemViews<NonNullable<ButtonProps['views']>>(\n themeViews,\n { container: base },\n instanceViews\n )\n : instanceViews;\n const slotColor =\n themeViews && (views.container?.style?.color ?? views.container?.color);\n const finalContentColor = (slotColor ||\n base.color ||\n textColorKey) as string;\n\n // Render content logic safely\n const content = (\n <ButtonContent\n icon={icon}\n // `startIcon` / `endIcon` are compatibility aliases for\n // `leftIcon` / `rightIcon`; the left/right spelling wins when both\n // are provided.\n leftIcon={leftIcon ?? startIcon}\n rightIcon={rightIcon ?? endIcon}\n isLoading={isLoading}\n iconPosition={iconPosition}\n loaderPosition={loaderPosition}\n size={size}\n resolvedTextColor={finalContentColor}\n isIconRounded={isIconRounded}\n loaderProps={loaderProps}\n views={views}\n >\n {children}\n </ButtonContent>\n );\n\n // Standard variants (filled, outline, ghost, link)\n const sizeStyles = ButtonSizes[size];\n // `isIcon` marks an icon-only button: reuse the square icon padding\n // scale (the same slot `isIconRounded` uses) so the button stays compact.\n const iconPad = isIconRounded || isIcon ? IconSizes[size] : {};\n\n return (\n <StandardButton\n variant={variant}\n animation={animation}\n to={to}\n linkComponent={linkComponent}\n isDisabled={isDisabled}\n isLoading={isLoading}\n isAuto={isAuto}\n isFilled={isFilled}\n isExternal={isExternal}\n shape={shape}\n shadow={shadow}\n onClick={onClick}\n views={views}\n baseStyles={base}\n sizeStyles={sizeStyles}\n iconPad={iconPad}\n resolvedTextColor={finalContentColor}\n content={content as any}\n size={size}\n mainTone={mainColorKey}\n borderMovingDuration={borderMovingDuration}\n borderMovingGradientColors={borderMovingGradientColors}\n animatedStrokeAccentColor={animatedStrokeAccentColor}\n animatedStrokeTextColor={animatedStrokeTextColor}\n containerRef={ref}\n {...(ariaLabel !== undefined ? { 'aria-label': ariaLabel } : {})}\n {...props}\n />\n );\n }\n )\n);\n\nexport default ButtonView;\n",
87
89
  "type": "registry:ui"
88
90
  },
89
91
  {
@@ -98,7 +100,7 @@
98
100
  },
99
101
  {
100
102
  "path": "src/components/Loader/Loader.tsx",
101
- "content": "import React from 'react';\nimport { LoaderProps } from './Loader/Loader.props';\nimport LoaderView from './Loader/Loader.view';\nimport { useMergedDesignSystemComponentProps } from '@app-studio/components/theme';\n// Defines a LoaderComponent as a functional component with props defined by LoaderProps and returns the LoaderView component, passing along any received props.\nconst LoaderComponent: React.FC<LoaderProps> = (props) => {\n const mergedProps = useMergedDesignSystemComponentProps('loader', props);\n // Renders the LoaderView component by spreading the received props, which allows for a clean pass-through of properties.\n return <LoaderView {...mergedProps} />;\n};\n// Exports the LoaderComponent as Loader, making it available for use in other parts of the application.\nexport const Loader = LoaderComponent;\n",
103
+ "content": "import React from 'react';\nimport { LoaderProps } from './Loader/Loader.props';\nimport LoaderView from './Loader/Loader.view';\nimport { useMergedDesignSystemComponentProps } from '../../design-system/theme';\n// Defines a LoaderComponent as a functional component with props defined by LoaderProps and returns the LoaderView component, passing along any received props.\nconst LoaderComponent: React.FC<LoaderProps> = (props) => {\n const mergedProps = useMergedDesignSystemComponentProps('loader', props);\n // Renders the LoaderView component by spreading the received props, which allows for a clean pass-through of properties.\n return <LoaderView {...mergedProps} />;\n};\n// Exports the LoaderComponent as Loader, making it available for use in other parts of the application.\nexport const Loader = LoaderComponent;\n",
102
104
  "type": "registry:ui"
103
105
  },
104
106
  {
@@ -7,12 +7,18 @@
7
7
  "categories": [
8
8
  "Layout"
9
9
  ],
10
- "registryDependencies": [],
10
+ "registryDependencies": [
11
+ "theme"
12
+ ],
11
13
  "meta": {
12
14
  "appStudio": {
13
15
  "entry": "src/components/pilot/card.ts",
14
16
  "engine": ">=0.9.5",
15
- "version": "0.11.13",
17
+ "engineByPlatform": {
18
+ "ios": ">=0.10.0",
19
+ "android": ">=0.10.0"
20
+ },
21
+ "version": "0.12.1",
16
22
  "license": "MIT",
17
23
  "platforms": [
18
24
  "web",
@@ -20,15 +26,9 @@
20
26
  "android"
21
27
  ],
22
28
  "dependencies": {
23
- "web": [
24
- "@app-studio/components@0.11.13"
25
- ],
26
- "ios": [
27
- "@app-studio/components@0.11.13"
28
- ],
29
- "android": [
30
- "@app-studio/components@0.11.13"
31
- ]
29
+ "web": [],
30
+ "ios": [],
31
+ "android": []
32
32
  },
33
33
  "npmImport": "@app-studio/components/card"
34
34
  }
@@ -41,7 +41,7 @@
41
41
  },
42
42
  {
43
43
  "path": "src/components/Card/Card.tsx",
44
- "content": "import React from 'react';\nimport { CardProps, CardType } from './Card/Card.props';\nimport {\n CardView,\n CardHeader,\n CardContent,\n CardFooter,\n} from './Card/Card.view';\nimport { useMergedDesignSystemComponentProps } from '@app-studio/components/theme';\n// This file defines and exports the main `Card` component, which serves as a wrapper for its sub-components like `Card.Header`, `Card.Content`, and `Card.Footer`, enabling a compound component pattern for flexible content structuring.\nconst CardComponent: React.FC<CardProps> = (props) => {\n const mergedProps = useMergedDesignSystemComponentProps('card', props);\n return <CardView {...mergedProps} />;\n};\nexport const Card = CardComponent as CardType;\nCard.Header = CardHeader;\nCard.Content = CardContent;\nCard.Footer = CardFooter;\n",
44
+ "content": "import React from 'react';\nimport { CardProps, CardType } from './Card/Card.props';\nimport {\n CardView,\n CardHeader,\n CardContent,\n CardFooter,\n} from './Card/Card.view';\nimport { useDesignSystemComponentLayers } from '../../design-system/theme';\n// This file defines and exports the main `Card` component, which serves as a wrapper for its sub-components like `Card.Header`, `Card.Content`, and `Card.Footer`, enabling a compound component pattern for flexible content structuring.\nconst CardComponent: React.FC<CardProps> = (props) => {\n const { props: mergedProps, themeViews } = useDesignSystemComponentLayers(\n 'card',\n props\n );\n return <CardView {...mergedProps} themeViews={themeViews} />;\n};\nexport const Card = CardComponent as CardType;\nCard.Header = CardHeader;\nCard.Content = CardContent;\nCard.Footer = CardFooter;\n",
45
45
  "type": "registry:ui"
46
46
  },
47
47
  {
@@ -66,7 +66,7 @@
66
66
  },
67
67
  {
68
68
  "path": "src/components/Card/Card/Card.view.tsx",
69
- "content": "import React, { useMemo } from 'react';\nimport { View, useTheme } from 'app-studio';\nimport { Vertical } from 'app-studio';\nimport {\n CardProps,\n CardHeaderProps,\n CardContentProps,\n CardFooterProps,\n} from './Card.props';\nimport {\n CardShapes,\n CardSizes,\n getCardVariants,\n getDefaultCardStyles,\n} from './Card.style';\nimport { CardContext, useCardContext } from './Card.context';\n// Defines the `CardHeader` functional component, responsible for rendering the header section of the Card.\nexport const CardHeader: React.FC<CardHeaderProps> = ({\n children,\n views,\n style,\n themeMode: elementMode,\n ...props\n}) => {\n // Initializes `theme` using the `useTheme` hook to access the current theme context for styling.\n const theme = useTheme();\n // Extracts `contextStyles` from the `CardContext` using `useCardContext` to apply context-specific styles.\n const { styles: contextStyles } = useCardContext();\n // Retrieves default header styles based on the current theme.\n const defaultStyles = getDefaultCardStyles(theme).header;\n // Combines default styles, context styles, and component props to create the final set of properties for the `CardHeader`.\n const mergedProps = {\n ...defaultStyles,\n ...contextStyles?.header,\n ...props,\n style: {\n ...defaultStyles?.style,\n ...contextStyles?.header?.style,\n ...style,\n },\n };\n return (\n <Vertical gap={8} {...mergedProps}>\n {children}\n </Vertical>\n );\n};\nexport const CardContent: React.FC<CardContentProps> = ({\n children,\n views,\n style,\n themeMode: elementMode,\n ...props\n}) => {\n const theme = useTheme();\n const { styles: contextStyles } = useCardContext();\n const defaultStyles = getDefaultCardStyles(theme).content;\n const mergedProps = {\n ...defaultStyles,\n ...contextStyles?.content,\n ...props,\n style: {\n ...defaultStyles?.style,\n ...contextStyles?.content?.style,\n ...style,\n },\n };\n return (\n <Vertical gap={12} {...mergedProps}>\n {children}\n </Vertical>\n );\n};\nexport const CardFooter: React.FC<CardFooterProps> = ({\n children,\n views,\n style,\n themeMode: elementMode,\n ...props\n}) => {\n const theme = useTheme();\n const { styles: contextStyles } = useCardContext();\n const defaultStyles = getDefaultCardStyles(theme).footer;\n const mergedProps = {\n ...defaultStyles,\n ...contextStyles?.footer,\n ...props,\n style: {\n ...defaultStyles?.style,\n ...contextStyles?.footer?.style,\n ...style,\n },\n };\n return (\n <Vertical gap={8} {...mergedProps}>\n {children}\n </Vertical>\n );\n};\nexport const CardView: React.FC<CardProps> = ({\n variant = 'default',\n size = 'md',\n shape = 'rounded',\n children,\n header,\n footer,\n isFullWidth = false,\n views,\n style,\n themeMode: elementMode,\n config,\n ...props\n}) => {\n const theme = useTheme();\n const defaultStyles = getDefaultCardStyles(theme);\n const sizePadding = CardSizes[size]?.padding || '16px';\n const contextValue = useMemo(\n () => ({\n styles: {\n container: {\n ...defaultStyles.container,\n borderRadius: CardShapes[shape],\n ...views?.container,\n },\n header: {\n ...defaultStyles.header,\n padding: sizePadding,\n ...views?.header,\n },\n content: {\n ...defaultStyles.content,\n padding: sizePadding,\n ...views?.content,\n },\n footer: {\n ...defaultStyles.footer,\n padding: sizePadding,\n ...views?.footer,\n },\n },\n }),\n [defaultStyles, views, sizePadding, shape]\n );\n const hasExplicitStructure = React.Children.toArray(children).some(\n (child) =>\n React.isValidElement(child) &&\n (child.type === CardHeader ||\n child.type === CardContent ||\n child.type === CardFooter)\n );\n const { themeMode } = theme;\n const currentThemeMode = elementMode || themeMode;\n const variantStyles = getCardVariants(currentThemeMode)[variant];\n const mergedRootProps = {\n width: isFullWidth ? '100%' : 'auto',\n overflow: 'hidden',\n ...variantStyles,\n ...contextValue.styles.container,\n ...props,\n style: { ...contextValue.styles.container?.style, ...style },\n };\n return (\n <CardContext.Provider value={contextValue}>\n <View {...mergedRootProps}>\n {hasExplicitStructure ? (\n children\n ) : (\n <Vertical width=\"100%\">\n {header && <CardHeader>{header}</CardHeader>}\n <CardContent>{children}</CardContent>\n {footer && <CardFooter>{footer}</CardFooter>}\n </Vertical>\n )}\n </View>\n </CardContext.Provider>\n );\n};\n",
69
+ "content": "import React, { useMemo } from 'react';\nimport { View, useTheme } from 'app-studio';\nimport { Vertical } from 'app-studio';\nimport {\n CardProps,\n CardHeaderProps,\n CardContentProps,\n CardFooterProps,\n} from './Card.props';\nimport {\n CardShapes,\n CardSizes,\n getCardVariants,\n getDefaultCardStyles,\n} from './Card.style';\nimport { CardContext, useCardContext } from './Card.context';\nimport { mergeDesignSystemViews } from '../../../design-system/theme';\n// Defines the `CardHeader` functional component, responsible for rendering the header section of the Card.\nexport const CardHeader: React.FC<CardHeaderProps> = ({\n children,\n views,\n style,\n themeMode: elementMode,\n ...props\n}) => {\n // Initializes `theme` using the `useTheme` hook to access the current theme context for styling.\n const theme = useTheme();\n // Extracts `contextStyles` from the `CardContext` using `useCardContext` to apply context-specific styles.\n const { styles: contextStyles } = useCardContext();\n // Retrieves default header styles based on the current theme.\n const defaultStyles = getDefaultCardStyles(theme).header;\n // Combines default styles, context styles, and component props to create the final set of properties for the `CardHeader`.\n const mergedProps = {\n ...defaultStyles,\n ...contextStyles?.header,\n ...views,\n ...props,\n style: {\n ...defaultStyles?.style,\n ...contextStyles?.header?.style,\n ...views?.style,\n ...style,\n },\n };\n return (\n <Vertical gap={8} {...mergedProps}>\n {children}\n </Vertical>\n );\n};\nexport const CardContent: React.FC<CardContentProps> = ({\n children,\n views,\n style,\n themeMode: elementMode,\n ...props\n}) => {\n const theme = useTheme();\n const { styles: contextStyles } = useCardContext();\n const defaultStyles = getDefaultCardStyles(theme).content;\n const mergedProps = {\n ...defaultStyles,\n ...contextStyles?.content,\n ...views,\n ...props,\n style: {\n ...defaultStyles?.style,\n ...contextStyles?.content?.style,\n ...views?.style,\n ...style,\n },\n };\n return (\n <Vertical gap={12} {...mergedProps}>\n {children}\n </Vertical>\n );\n};\nexport const CardFooter: React.FC<CardFooterProps> = ({\n children,\n views,\n style,\n themeMode: elementMode,\n ...props\n}) => {\n const theme = useTheme();\n const { styles: contextStyles } = useCardContext();\n const defaultStyles = getDefaultCardStyles(theme).footer;\n const mergedProps = {\n ...defaultStyles,\n ...contextStyles?.footer,\n ...views,\n ...props,\n style: {\n ...defaultStyles?.style,\n ...contextStyles?.footer?.style,\n ...views?.style,\n ...style,\n },\n };\n return (\n <Vertical gap={8} {...mergedProps}>\n {children}\n </Vertical>\n );\n};\nexport const CardView: React.FC<\n CardProps & { themeViews?: CardProps['views'] }\n> = ({\n variant = 'default',\n size = 'md',\n shape = 'rounded',\n children,\n header,\n footer,\n isFullWidth = false,\n views,\n themeViews,\n style,\n themeMode: elementMode,\n config,\n ...props\n}) => {\n const theme = useTheme();\n const defaultStyles = getDefaultCardStyles(theme);\n const variantStyles = getCardVariants(elementMode || theme.themeMode)[\n variant\n ];\n const sizePadding = CardSizes[size]?.padding || '16px';\n const contextValue = useMemo(() => {\n const base = {\n container: {\n ...defaultStyles.container,\n borderRadius: CardShapes[shape],\n },\n header: { ...defaultStyles.header, padding: sizePadding },\n content: { ...defaultStyles.content, padding: sizePadding },\n footer: { ...defaultStyles.footer, padding: sizePadding },\n };\n if (themeViews) {\n // Every variant shares the same surface fallback in base.container.\n const { backgroundColor, border, ...decoration } = variantStyles ?? {};\n const container =\n border === 'none' ? { ...decoration, borderWidth: 0 } : decoration;\n return {\n styles: mergeDesignSystemViews(base, themeViews, { container }, views),\n };\n }\n return {\n styles: {\n container: { ...base.container, ...views?.container },\n header: { ...base.header, ...views?.header },\n content: { ...base.content, ...views?.content },\n footer: { ...base.footer, ...views?.footer },\n },\n };\n }, [defaultStyles, shape, sizePadding, themeViews, variantStyles, views]);\n const hasExplicitStructure = React.Children.toArray(children).some(\n (child) =>\n React.isValidElement(child) &&\n (child.type === CardHeader ||\n child.type === CardContent ||\n child.type === CardFooter)\n );\n const mergedRootProps = {\n width: isFullWidth ? '100%' : 'auto',\n overflow: 'hidden',\n ...(!themeViews && variantStyles),\n ...contextValue.styles.container,\n ...props,\n style: { ...contextValue.styles.container?.style, ...style },\n };\n return (\n <CardContext.Provider value={contextValue}>\n <View {...mergedRootProps}>\n {hasExplicitStructure ? (\n children\n ) : (\n <Vertical width=\"100%\">\n {header && <CardHeader>{header}</CardHeader>}\n <CardContent>{children}</CardContent>\n {footer && <CardFooter>{footer}</CardFooter>}\n </Vertical>\n )}\n </View>\n </CardContext.Provider>\n );\n};\n",
70
70
  "type": "registry:ui"
71
71
  },
72
72
  {