@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,31 +1,31 @@
1
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
- import { useState as a } from "react";
1
+ import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
+ import { useState as t } from "react";
3
3
  import { Text as b, Form as y } from "app-studio";
4
- import { A as x } from "./chunks/Alert-Q1HlVX8f.mjs";
5
- import { B as w } from "./chunks/Button.pilot-C4BIb08S.mjs";
6
- import { C as o } from "./chunks/Card-DMhV_NTt.mjs";
7
- import { T as p } from "./chunks/TextField-DOU2CL5J.mjs";
4
+ import { A as x } from "./chunks/Alert-B5vkpWXy.mjs";
5
+ import { B as w } from "./chunks/Button.pilot-BJK10U1-.mjs";
6
+ import { C as o } from "./chunks/Card-ymI5Thma.mjs";
7
+ import { T as p } from "./chunks/TextField-Bwc_F2Rq.mjs";
8
8
  function q({ onSubmit: g }) {
9
- const [n, h] = a(""), [t, l] = a(""), [e, d] = a(!1), [m, s] = a("");
9
+ const [n, h] = t(""), [a, l] = t(""), [e, d] = t(!1), [m, s] = t("");
10
10
  async function u() {
11
11
  if (e) return;
12
12
  const i = n.trim();
13
- if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i) || !t) {
13
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i) || !a) {
14
14
  s("Enter a valid email address and password.");
15
15
  return;
16
16
  }
17
17
  d(!0), s("");
18
18
  try {
19
- await g({ email: i, password: t }), l("");
19
+ await g({ email: i, password: a }), l("");
20
20
  } catch {
21
21
  s("Sign-in failed. Please try again.");
22
22
  } finally {
23
23
  d(!1);
24
24
  }
25
25
  }
26
- return /* @__PURE__ */ c(o, { children: [
27
- /* @__PURE__ */ r(o.Header, { children: /* @__PURE__ */ r(b, { fontWeight: "bold", children: "Sign in" }) }),
28
- /* @__PURE__ */ r(o.Content, { children: /* @__PURE__ */ c(
26
+ return /* @__PURE__ */ f(o, { children: [
27
+ /* @__PURE__ */ r(o.Header, { children: /* @__PURE__ */ r(b, { fontWeight: "bold", color: "theme-text", children: "Sign in" }) }),
28
+ /* @__PURE__ */ r(o.Content, { children: /* @__PURE__ */ f(
29
29
  y,
30
30
  {
31
31
  display: "flex",
@@ -52,7 +52,7 @@ function q({ onSubmit: g }) {
52
52
  {
53
53
  label: "Password",
54
54
  type: "password",
55
- value: t,
55
+ value: a,
56
56
  onChange: l,
57
57
  isRequired: !0,
58
58
  isDisabled: e
@@ -66,8 +66,8 @@ function q({ onSubmit: g }) {
66
66
  "aria-busy": e || void 0,
67
67
  type: "submit",
68
68
  onClick: (i) => {
69
- var f;
70
- (f = i == null ? void 0 : i.preventDefault) == null || f.call(i), u();
69
+ var c;
70
+ (c = i == null ? void 0 : i.preventDefault) == null || c.call(i), u();
71
71
  },
72
72
  children: "Sign in"
73
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sign-in.esm.mjs","sources":["../src/components/pilot/blocks/SignIn.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Form, Text } from 'app-studio';\nimport { Alert } from '../alert';\nimport { Button } from '../button';\nimport { Card } from '../card';\nimport { TextField } from '../text-field';\n\nexport interface SignInProps {\n onSubmit: (credentials: {\n email: string;\n password: string;\n }) => void | Promise<void>;\n}\n\nexport function SignIn({ onSubmit }: SignInProps) {\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [pending, setPending] = useState(false);\n const [error, setError] = useState('');\n\n async function submit() {\n if (pending) return;\n const address = email.trim();\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(address) || !password) {\n setError('Enter a valid email address and password.');\n return;\n }\n setPending(true);\n setError('');\n try {\n await onSubmit({ email: address, password });\n setPassword('');\n } catch {\n setError('Sign-in failed. Please try again.');\n } finally {\n setPending(false);\n }\n }\n\n return (\n <Card>\n <Card.Header>\n <Text fontWeight=\"bold\">Sign in</Text>\n </Card.Header>\n <Card.Content>\n <Form\n display=\"flex\"\n flexDirection=\"column\"\n gap={12}\n noValidate\n onSubmit={(event: React.FormEvent) => {\n event.preventDefault();\n void submit();\n }}\n >\n <TextField\n label=\"Email\"\n type=\"email\"\n value={email}\n onChange={setEmail}\n isRequired\n isDisabled={pending}\n />\n <TextField\n label=\"Password\"\n type=\"password\"\n value={password}\n onChange={setPassword}\n isRequired\n isDisabled={pending}\n />\n {error && <Alert variant=\"error\" title={error} />}\n <Button\n isLoading={pending}\n aria-busy={pending || undefined}\n type=\"submit\"\n onClick={(event?: { preventDefault?: () => void }) => {\n event?.preventDefault?.();\n void submit();\n }}\n >\n Sign in\n </Button>\n </Form>\n </Card.Content>\n </Card>\n );\n}\n"],"names":["SignIn","onSubmit","email","setEmail","useState","password","setPassword","pending","setPending","error","setError","submit","address","Card","jsx","Text","jsxs","Form","event","TextField","Alert","Button","_a"],"mappings":";;;;;;;AAcO,SAASA,EAAO,EAAE,UAA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,MAAK;AAAA,cACL,OAAOd;AAAA,cACP,UAAUC;AAAA,cACV,YAAU;AAAA,cACV,YAAYC;AAAA,YAAA;AAAA,UAAA;AAAA,UAEbE,KAAS,gBAAAK,EAACM,GAAA,EAAM,SAAQ,SAAQ,OAAOX,GAAO;AAAA,UAC/C,gBAAAK;AAAA,YAACO;AAAA,YAAA;AAAA,cACC,WAAWd;AAAA,cACX,aAAWA,KAAW;AAAA,cACtB,MAAK;AAAA,cACL,SAAS,CAACW,MAA4C;;AACpD,iBAAAI,IAAAJ,KAAA,gBAAAA,EAAO,mBAAP,QAAAI,EAAA,KAAAJ,IACKP,EAAA;AAAA,cACP;AAAA,cACD,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED;AAAA,MAAA;AAAA,IAAA,EACF,CACF;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"sign-in.esm.mjs","sources":["../src/components/pilot/blocks/SignIn.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Form, Text } from 'app-studio';\nimport { Alert } from '../alert';\nimport { Button } from '../button';\nimport { Card } from '../card';\nimport { TextField } from '../text-field';\n\nexport interface SignInProps {\n onSubmit: (credentials: {\n email: string;\n password: string;\n }) => void | Promise<void>;\n}\n\nexport function SignIn({ onSubmit }: SignInProps) {\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [pending, setPending] = useState(false);\n const [error, setError] = useState('');\n\n async function submit() {\n if (pending) return;\n const address = email.trim();\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(address) || !password) {\n setError('Enter a valid email address and password.');\n return;\n }\n setPending(true);\n setError('');\n try {\n await onSubmit({ email: address, password });\n setPassword('');\n } catch {\n setError('Sign-in failed. Please try again.');\n } finally {\n setPending(false);\n }\n }\n\n return (\n <Card>\n <Card.Header>\n <Text fontWeight=\"bold\" color=\"theme-text\">\n Sign in\n </Text>\n </Card.Header>\n <Card.Content>\n <Form\n display=\"flex\"\n flexDirection=\"column\"\n gap={12}\n noValidate\n onSubmit={(event: React.FormEvent) => {\n event.preventDefault();\n void submit();\n }}\n >\n <TextField\n label=\"Email\"\n type=\"email\"\n value={email}\n onChange={setEmail}\n isRequired\n isDisabled={pending}\n />\n <TextField\n label=\"Password\"\n type=\"password\"\n value={password}\n onChange={setPassword}\n isRequired\n isDisabled={pending}\n />\n {error && <Alert variant=\"error\" title={error} />}\n <Button\n isLoading={pending}\n aria-busy={pending || undefined}\n type=\"submit\"\n onClick={(event?: { preventDefault?: () => void }) => {\n event?.preventDefault?.();\n void submit();\n }}\n >\n Sign in\n </Button>\n </Form>\n </Card.Content>\n </Card>\n );\n}\n"],"names":["SignIn","onSubmit","email","setEmail","useState","password","setPassword","pending","setPending","error","setError","submit","address","Card","jsx","Text","jsxs","Form","event","TextField","Alert","Button","_a"],"mappings":";;;;;;;AAcO,SAASA,EAAO,EAAE,UAAAC,KAAyB;AAChD,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAS,EAAE,GAC/B,CAACC,GAAUC,CAAW,IAAIF,EAAS,EAAE,GACrC,CAACG,GAASC,CAAU,IAAIJ,EAAS,EAAK,GACtC,CAACK,GAAOC,CAAQ,IAAIN,EAAS,EAAE;AAErC,iBAAeO,IAAS;AACtB,QAAIJ,EAAS;AACb,UAAMK,IAAUV,EAAM,KAAA;AACtB,QAAI,CAAC,6BAA6B,KAAKU,CAAO,KAAK,CAACP,GAAU;AAC5D,MAAAK,EAAS,2CAA2C;AACpD;AAAA,IACF;AACA,IAAAF,EAAW,EAAI,GACfE,EAAS,EAAE;AACX,QAAI;AACF,YAAMT,EAAS,EAAE,OAAOW,GAAS,UAAAP,GAAU,GAC3CC,EAAY,EAAE;AAAA,IAChB,QAAQ;AACN,MAAAI,EAAS,mCAAmC;AAAA,IAC9C,UAAA;AACE,MAAAF,EAAW,EAAK;AAAA,IAClB;AAAA,EACF;AAEA,2BACGK,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACD,EAAK,QAAL,EACC,UAAA,gBAAAC,EAACC,GAAA,EAAK,YAAW,QAAO,OAAM,cAAa,UAAA,UAAA,CAE3C,EAAA,CACF;AAAA,IACA,gBAAAD,EAACD,EAAK,SAAL,EACC,UAAA,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,eAAc;AAAA,QACd,KAAK;AAAA,QACL,YAAU;AAAA,QACV,UAAU,CAACC,MAA2B;AACpC,UAAAA,EAAM,eAAA,GACDP,EAAA;AAAA,QACP;AAAA,QAEA,UAAA;AAAA,UAAA,gBAAAG;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,OAAM;AAAA,cACN,MAAK;AAAA,cACL,OAAOjB;AAAA,cACP,UAAUC;AAAA,cACV,YAAU;AAAA,cACV,YAAYI;AAAA,YAAA;AAAA,UAAA;AAAA,UAEd,gBAAAO;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,OAAM;AAAA,cACN,MAAK;AAAA,cACL,OAAOd;AAAA,cACP,UAAUC;AAAA,cACV,YAAU;AAAA,cACV,YAAYC;AAAA,YAAA;AAAA,UAAA;AAAA,UAEbE,KAAS,gBAAAK,EAACM,GAAA,EAAM,SAAQ,SAAQ,OAAOX,GAAO;AAAA,UAC/C,gBAAAK;AAAA,YAACO;AAAA,YAAA;AAAA,cACC,WAAWd;AAAA,cACX,aAAWA,KAAW;AAAA,cACtB,MAAK;AAAA,cACL,SAAS,CAACW,MAA4C;;AACpD,iBAAAI,IAAAJ,KAAA,gBAAAA,EAAO,mBAAP,QAAAI,EAAA,KAAAJ,IACKP,EAAA;AAAA,cACP;AAAA,cACD,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED;AAAA,MAAA;AAAA,IAAA,EACF,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./chunks/Switch-D80yPNFV.cjs");exports.Switch=t.Switch;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./chunks/Switch-DqgmPp8M.cjs");exports.Switch=t.Switch;
2
2
  //# sourceMappingURL=switch.cjs.js.map
@@ -1,4 +1,4 @@
1
- import { S as t } from "./chunks/Switch-DWx1g3jT.mjs";
1
+ import { S as t } from "./chunks/Switch-04GGHGrV.mjs";
2
2
  export {
3
3
  t as Switch
4
4
  };
package/dist/tabs.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/Tabs-DQeBJwkz.cjs");exports.Tabs=e.Tabs;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/Tabs-DneEt-le.cjs");exports.Tabs=e.Tabs;
2
2
  //# sourceMappingURL=tabs.cjs.js.map
package/dist/tabs.esm.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { T as r } from "./chunks/Tabs-D5chMrkE.mjs";
1
+ import { T as r } from "./chunks/Tabs-BdoE88Ee.mjs";
2
2
  export {
3
3
  r as Tabs
4
4
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/TextField-Da4JCcAU.cjs");exports.TextField=e.TextField;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/TextField-CwaxvcqN.cjs");exports.TextField=e.TextField;
2
2
  //# sourceMappingURL=text-field.cjs.js.map
@@ -1,4 +1,4 @@
1
- import { T as r } from "./chunks/TextField-DOU2CL5J.mjs";
1
+ import { T as r } from "./chunks/TextField-Bwc_F2Rq.mjs";
2
2
  export {
3
3
  r as TextField
4
4
  };
package/dist/theme.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),u=require("react"),C=require("app-studio"),P=require("./chunks/default-D7ePSMKP.cjs"),j=({children:e,id:t,appearance:o})=>c.jsx("div",{"data-design-system":t,"data-appearance":o,style:{display:"contents"},children:e}),i=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.prototype.toString.call(e)==="[object Object]",g=e=>e,a=(...e)=>{const t={};return e.forEach(o=>{i(o)&&Object.entries(o).forEach(([n,s])=>{if(s!=null){if(i(s)&&i(t[n])){t[n]=a(t[n],s);return}t[n]=s}})}),t},h=e=>{if(Array.isArray(e)||!i(e))return e;const t={};for(const[o,n]of Object.entries(e))n!==null&&(t[o]=i(n)?h(n):n);return t},v=new Set(["button"]),w=["backgroundColor","background","borderColor","color"],b=new Set,O=(e,t)=>{if(process.env.NODE_ENV!=="production"&&!(!t||!v.has(e))&&!b.has(e))for(const[o,n]of Object.entries(t)){if(!i(n))continue;const s=w.filter(r=>n[r]!=null);if(s.length>0){b.add(e),console.warn(`[design-system] components.${e}.views.${o} sets ${s.join(", ")} — view styles apply above every variant, so this flattens ghost/outline/subtle into solid blocks. Move colors to components.${e}.config.variants.<variant> (merged under each variant); keep views to shape and typography.`);return}}},l=(e,t)=>{if(!t)return{};const o=t.components[e]||{},n=g(h(o));return O(e,n.views),n},D=(e,t,o)=>{const{config:n,...s}=t,r=l(e,o),d=a(r,n||{});return g(a(d,s))},p=u.createContext({isEnabled:!1}),E=({children:e,config:t,mode:o,targetWindow:n,inheritTheme:s=!1})=>{const r=t??P.defaultConfig,{themeMode:d}=C.useTheme(),m=o??d??r.metadata.defaultAppearance,y=u.useMemo(()=>({config:r,configId:r.metadata.id,isEnabled:!0}),[r]),S=c.jsx(j,{id:r.metadata.id,appearance:m,children:e});return s?c.jsx(p.Provider,{value:y,children:S}):c.jsx(p.Provider,{value:y,children:c.jsx(C.ThemeProvider,{theme:r.theme,mode:m,targetWindow:n,transparentWrapper:!0,children:S})})},f=()=>u.useContext(p),M=e=>{const{config:t}=f();return l(e,t)},x=(e,t)=>{const{config:o}=f();return D(e,t,o)};exports.DesignSystemProvider=E;exports.deepMerge=a;exports.getDesignSystemComponentProps=l;exports.mergeDesignSystemComponentProps=D;exports.normalizeDesignSystemComponentProps=g;exports.useDesignSystem=f;exports.useDesignSystemComponentProps=M;exports.useMergedDesignSystemComponentProps=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),a=require("react"),P=require("app-studio"),x=require("./chunks/default-W-NMTEJ3.cjs"),M=({children:e,id:t,appearance:s})=>u.jsx("div",{"data-design-system":t,"data-appearance":s,style:{display:"contents"},children:e}),c=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.prototype.toString.call(e)==="[object Object]",D=e=>e,f=(...e)=>{const t={};return e.forEach(s=>{c(s)&&Object.entries(s).forEach(([n,o])=>{if(o!=null){if(c(o)&&c(t[n])){t[n]=f(t[n],o);return}t[n]=o}})}),t};function E(...e){const t={};for(const s of e)for(const[n,o]of Object.entries(s??{})){if(!c(o))continue;const i=Array.isArray(o.style)?{...o,style:Object.assign({},...o.style.flat(1/0).filter(c))}:o,r=t[n];if(c(r==null?void 0:r.style)){const d={...r.style};for(const[l,y]of Object.entries(i))l!=="style"&&y!=null&&delete d[l];t[n]=f({...r,style:d},i)}else t[n]=f(r,i)}return t}const j=e=>{if(Array.isArray(e)||!c(e))return e;const t={};for(const[s,n]of Object.entries(e))n!==null&&(t[s]=c(n)?j(n):n);return t},V=new Set(["button"]),A=["backgroundColor","background","borderColor","color"],w=new Set,T=(e,t)=>{if(process.env.NODE_ENV!=="production"&&!(!t||!V.has(e))&&!w.has(e))for(const[s,n]of Object.entries(t)){if(!c(n))continue;const o=A.filter(i=>n[i]!=null);if(o.length>0){w.add(e),console.warn(`[design-system] components.${e}.views.${s} sets ${o.join(", ")} — view styles apply above every variant, so this flattens ghost/outline/subtle into solid blocks. Move colors to components.${e}.config.variants.<variant> for an individual variant; keep legacy views to shape and typography.`);return}}},p=(e,t,s="legacy")=>{if(!t)return{};const n=t.components[e]||{},o=D(j(n));return s==="legacy"&&T(e,o.views),o},v=(e,t,s)=>g(p(e,s),t);function g(e,t){const{config:s,...n}=t;return D(f(e,s,n))}const S=Symbol.for("@app-studio/components/design-system-context/v1");function _(){const e=globalThis,t=e[S]??(e[S]=new WeakMap),s=t.get(a.createContext);if(s)return s;const n=a.createContext({isEnabled:!1});return t.set(a.createContext,n),n}const C=_(),k=({children:e,config:t,mode:s,targetWindow:n,inheritTheme:o=!1,stylePrecedence:i="standard"})=>{const r=t??x.defaultConfig,{themeMode:d}=P.useTheme(),l=s??d??r.metadata.defaultAppearance,y=a.useMemo(()=>({...r.theme}),[r.theme]),O={mode:l,targetWindow:n,transparentWrapper:!0},b=a.useMemo(()=>({config:r,configId:r.metadata.id,isEnabled:!0,stylePrecedence:i}),[r,i]),h=u.jsx(M,{id:r.metadata.id,appearance:l,children:e});return o?u.jsx(C.Provider,{value:b,children:h}):u.jsx(C.Provider,{value:b,children:u.jsx(P.ThemeProvider,{theme:y,...O,children:h})})},m=()=>a.useContext(C),I=e=>{const{config:t,stylePrecedence:s}=m();return p(e,t,s)},R=(e,t)=>{const{config:s}=m();return v(e,t,s)};function q(e,t){const{config:s,stylePrecedence:n}=m(),o=p(e,s,n);if(n!=="standard")return{props:g(o,t)};const{views:i,...r}=o;return{props:g(r,t),themeViews:i??{}}}exports.DesignSystemProvider=k;exports.deepMerge=f;exports.getDesignSystemComponentProps=p;exports.mergeComponentDefaults=g;exports.mergeDesignSystemComponentProps=v;exports.mergeDesignSystemViews=E;exports.normalizeDesignSystemComponentProps=D;exports.useDesignSystem=m;exports.useDesignSystemComponentLayers=q;exports.useDesignSystemComponentProps=I;exports.useMergedDesignSystemComponentProps=R;
2
2
  //# sourceMappingURL=theme.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme.cjs.js","sources":["../src/design-system/DesignSystemScope.tsx","../src/design-system/utils.ts","../src/design-system/theme.tsx"],"sourcesContent":["import React from 'react';\nimport { DesignSystemScopeProps } from './types';\n\n/**\n * Marks the design system's subtree for CSS (`[data-design-system]`,\n * `[data-appearance]`) without adding a layout box. Native twin:\n * DesignSystemScope.native, which has no DOM to mark.\n */\nexport const DesignSystemScope: React.FC<DesignSystemScopeProps> = ({\n children,\n id,\n appearance,\n}) => (\n <div\n data-design-system={id}\n data-appearance={appearance}\n style={{ display: 'contents' }}\n >\n {children}\n </div>\n);\n","import {\n DesignSystemComponentConfig,\n DesignSystemComponentName,\n DesignSystemConfig,\n DesignSystemViewProps,\n} from './types';\n\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n Boolean(value) &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.prototype.toString.call(value) === '[object Object]';\n\nexport const normalizeDesignSystemComponentProps = <\n T extends Record<string, any>\n>(\n props: T\n): T => {\n return props;\n};\n\nexport const deepMerge = <T extends Record<string, any> = Record<string, any>>(\n ...objects: Array<Record<string, any> | undefined>\n): T => {\n const result: Record<string, any> = {};\n\n objects.forEach((object) => {\n if (!isPlainObject(object)) return;\n\n Object.entries(object).forEach(([key, value]) => {\n // Treat null the same as undefined: configs use null to declare a key\n // exists in the schema without overriding component defaults. Nested\n // nulls (e.g. `views.container.backgroundColor: null`) are pre-stripped\n // from configs at the boundary — see `stripNullsDeep` below — so this\n // top-level check is sufficient and we keep the cycle-safe shape that\n // assigns React-element props by reference rather than recursing.\n if (value === undefined || value === null) return;\n\n if (isPlainObject(value) && isPlainObject(result[key])) {\n result[key] = deepMerge(result[key], value);\n return;\n }\n\n result[key] = value;\n });\n });\n\n return result as T;\n};\n\n// Recursively remove keys whose value is `null` from plain-object trees.\n// Only descends into plain objects: arrays and non-object values are returned\n// as-is, so React elements / fibers / class instances are left alone. Used to\n// scrub `views.container.backgroundColor: null` and friends from configs\n// before they ever reach the merge pipeline.\nconst stripNullsDeep = <T>(value: T): T => {\n if (Array.isArray(value)) return value;\n if (!isPlainObject(value)) return value;\n const out: Record<string, any> = {};\n for (const [k, v] of Object.entries(value)) {\n if (v === null) continue;\n out[k] = isPlainObject(v) ? stripNullsDeep(v) : v;\n }\n return out as T;\n};\n\n// Components whose colors are computed per-variant. A config block's `views`\n// sits ABOVE the variant palette, so a color there flattens every variant\n// (ghost/outline/subtle all render as solid blocks). Colors for these\n// components belong in `config.variants.<variant>` (merged UNDER each\n// variant) or the top-level `color`/`textColor` keys.\nconst VARIANT_DRIVEN_COMPONENTS: ReadonlySet<string> = new Set(['button']);\nconst VIEW_COLOR_KEYS = [\n 'backgroundColor',\n 'background',\n 'borderColor',\n 'color',\n] as const;\nconst warnedViewColorBlocks = new Set<string>();\n\nconst warnOnViewColors = (\n componentName: string,\n views: Record<string, Record<string, unknown>> | undefined\n) => {\n if (process.env.NODE_ENV === 'production') return;\n if (!views || !VARIANT_DRIVEN_COMPONENTS.has(componentName)) return;\n if (warnedViewColorBlocks.has(componentName)) return;\n for (const [viewKey, viewValue] of Object.entries(views)) {\n if (!isPlainObject(viewValue)) continue;\n const offenders = VIEW_COLOR_KEYS.filter((k) => viewValue[k] != null);\n if (offenders.length > 0) {\n warnedViewColorBlocks.add(componentName);\n console.warn(\n `[design-system] components.${componentName}.views.${viewKey} sets ` +\n `${offenders.join(', ')} — view styles apply above every variant, ` +\n 'so this flattens ghost/outline/subtle into solid blocks. Move ' +\n `colors to components.${componentName}.config.variants.<variant> ` +\n '(merged under each variant); keep views to shape and typography.'\n );\n return;\n }\n }\n};\n\nexport const getDesignSystemComponentProps = (\n componentName: DesignSystemComponentName,\n config?: DesignSystemConfig\n): DesignSystemComponentConfig => {\n if (!config) return {};\n const raw = config.components[componentName] || {};\n const cleaned = normalizeDesignSystemComponentProps(stripNullsDeep(raw));\n warnOnViewColors(componentName, cleaned.views);\n return cleaned;\n};\n\nexport const mergeDesignSystemComponentProps = <T extends Record<string, any>>(\n componentName: DesignSystemComponentName,\n props: T,\n config?: DesignSystemConfig\n): T => {\n const { config: localConfig, ...otherProps } = props;\n\n const globalConfig = getDesignSystemComponentProps(componentName, config);\n\n const mergedConfig = deepMerge(globalConfig, localConfig || {});\n\n return normalizeDesignSystemComponentProps(\n deepMerge<T>(mergedConfig as any, otherProps as any) as T\n );\n};\n","import React, { createContext, ReactNode, useContext, useMemo } from 'react';\nimport { ThemeProvider, useTheme } from 'app-studio';\nimport defaultConfig from './configs/default.json';\nimport { DesignSystemScope } from './DesignSystemScope';\nimport {\n DesignSystemAppearance,\n DesignSystemComponentConfigFor,\n DesignSystemComponentName,\n DesignSystemConfig,\n DesignSystemContextValue,\n} from './types';\nimport {\n getDesignSystemComponentProps,\n mergeDesignSystemComponentProps,\n} from './utils';\n\nconst DesignSystemContext = createContext<DesignSystemContextValue>({\n isEnabled: false,\n});\n\nexport interface DesignSystemProviderProps {\n children: ReactNode;\n config?: DesignSystemConfig;\n /**\n * Explicitly pin the appearance for this subtree (light/dark). When omitted,\n * the provider follows the **global** theme mode (so a light/dark toggle\n * flips the design system), falling back to the config's `defaultAppearance`\n * only when there is no surrounding ThemeProvider.\n */\n mode?: DesignSystemAppearance;\n /** Document that owns the subtree and its theme stylesheet (for iframe portals). */\n targetWindow?: Window;\n /**\n * Render no ThemeProvider of its own: colours and mode come from the\n * surrounding ThemeProvider (an app's `brand`), and this provider only\n * supplies the component configuration. Without it (the default), the\n * config's `theme` is applied through a nested ThemeProvider.\n */\n inheritTheme?: boolean;\n}\n\nexport const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({\n children,\n config,\n mode,\n targetWindow,\n inheritTheme = false,\n}) => {\n const resolvedConfig = config ?? (defaultConfig as DesignSystemConfig);\n\n // Follow the active global theme mode so a light/dark toggle actually flips\n // the design system. An explicit `mode` prop pins the subtree; otherwise we\n // inherit the surrounding ThemeProvider's mode and fall back to the config's\n // declared default appearance when no provider is present.\n const { themeMode } = useTheme();\n const effectiveMode: DesignSystemAppearance =\n mode ?? themeMode ?? resolvedConfig.metadata.defaultAppearance;\n\n const value = useMemo(\n () => ({\n config: resolvedConfig,\n configId: resolvedConfig.metadata.id,\n isEnabled: true,\n }),\n [resolvedConfig]\n );\n\n // Delegate token resolution to app-studio's ThemeProvider: it emits\n // `--theme-<slot>` CSS variables from the theme object and registers them\n // with its color resolver, so `theme-primary`, `theme-canvas`, etc. work\n // anywhere a component uses them. `transparentWrapper` is auto-inferred\n // (nested under another ThemeProvider) and keeps the page layout intact.\n const scoped = (\n <DesignSystemScope\n id={resolvedConfig.metadata.id}\n appearance={effectiveMode}\n >\n {children}\n </DesignSystemScope>\n );\n\n if (inheritTheme) {\n return (\n <DesignSystemContext.Provider value={value}>\n {scoped}\n </DesignSystemContext.Provider>\n );\n }\n\n return (\n <DesignSystemContext.Provider value={value}>\n {/* No cast: app-studio's `theme` prop accepts ThemeSlots, which\n DesignSystemTheme satisfies structurally. */}\n <ThemeProvider\n theme={resolvedConfig.theme}\n mode={effectiveMode}\n targetWindow={targetWindow}\n transparentWrapper\n >\n {scoped}\n </ThemeProvider>\n </DesignSystemContext.Provider>\n );\n};\n\nexport const useDesignSystem = () => useContext(DesignSystemContext);\n\nexport const useDesignSystemComponentProps = <\n Name extends DesignSystemComponentName\n>(\n componentName: Name\n): DesignSystemComponentConfigFor<Name> => {\n const { config } = useDesignSystem();\n return getDesignSystemComponentProps(\n componentName,\n config\n ) as DesignSystemComponentConfigFor<Name>;\n};\n\nexport const useMergedDesignSystemComponentProps = <\n T extends Record<string, any>\n>(\n componentName: DesignSystemComponentName,\n props: T\n): T => {\n const { config } = useDesignSystem();\n return mergeDesignSystemComponentProps(componentName, props, config);\n};\n\nexport * from './types';\nexport * from './utils';\n"],"names":["DesignSystemScope","children","id","appearance","jsx","isPlainObject","value","normalizeDesignSystemComponentProps","props","deepMerge","objects","result","object","key","stripNullsDeep","out","k","v","VARIANT_DRIVEN_COMPONENTS","VIEW_COLOR_KEYS","warnedViewColorBlocks","warnOnViewColors","componentName","views","viewKey","viewValue","offenders","getDesignSystemComponentProps","config","raw","cleaned","mergeDesignSystemComponentProps","localConfig","otherProps","globalConfig","mergedConfig","DesignSystemContext","createContext","DesignSystemProvider","mode","targetWindow","inheritTheme","resolvedConfig","defaultConfig","themeMode","useTheme","effectiveMode","useMemo","scoped","ThemeProvider","useDesignSystem","useContext","useDesignSystemComponentProps","useMergedDesignSystemComponentProps"],"mappings":"2MAQaA,EAAsD,CAAC,CAClE,SAAAC,EACA,GAAAC,EACA,WAAAC,CACF,IACEC,EAAAA,IAAC,MAAA,CACC,qBAAoBF,EACpB,kBAAiBC,EACjB,MAAO,CAAE,QAAS,UAAA,EAEjB,SAAAF,CAAA,CACH,ECZII,EAAiBC,GACrB,EAAQA,GACR,OAAOA,GAAU,UACjB,CAAC,MAAM,QAAQA,CAAK,GACpB,OAAO,UAAU,SAAS,KAAKA,CAAK,IAAM,kBAE/BC,EAGXC,GAEOA,EAGIC,EAAY,IACpBC,IACG,CACN,MAAMC,EAA8B,CAAA,EAEpC,OAAAD,EAAQ,QAASE,GAAW,CACrBP,EAAcO,CAAM,GAEzB,OAAO,QAAQA,CAAM,EAAE,QAAQ,CAAC,CAACC,EAAKP,CAAK,IAAM,CAO/C,GAA2BA,GAAU,KAErC,IAAID,EAAcC,CAAK,GAAKD,EAAcM,EAAOE,CAAG,CAAC,EAAG,CACtDF,EAAOE,CAAG,EAAIJ,EAAUE,EAAOE,CAAG,EAAGP,CAAK,EAC1C,MACF,CAEAK,EAAOE,CAAG,EAAIP,EAChB,CAAC,CACH,CAAC,EAEMK,CACT,EAOMG,EAAqBR,GAAgB,CAEzC,GADI,MAAM,QAAQA,CAAK,GACnB,CAACD,EAAcC,CAAK,EAAG,OAAOA,EAClC,MAAMS,EAA2B,CAAA,EACjC,SAAW,CAACC,EAAGC,CAAC,IAAK,OAAO,QAAQX,CAAK,EACnCW,IAAM,OACVF,EAAIC,CAAC,EAAIX,EAAcY,CAAC,EAAIH,EAAeG,CAAC,EAAIA,GAElD,OAAOF,CACT,EAOMG,EAAiD,IAAI,IAAI,CAAC,QAAQ,CAAC,EACnEC,EAAkB,CACtB,kBACA,aACA,cACA,OACF,EACMC,MAA4B,IAE5BC,EAAmB,CACvBC,EACAC,IACG,CACH,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EACR,SAAUA,EAAe,SAAS,GAClC,UAAW,EAAA,GAEb,CAACA,CAAc,CAAA,EAQXM,EACJ5C,EAAAA,IAACJ,EAAA,CACC,GAAI0C,EAAe,SAAS,GAC5B,WAAYI,EAEX,SAAA7C,CAAA,CAAA,EAIL,OAAIwC,EAEArC,EAAAA,IAACgC,EAAoB,SAApB,CAA6B,MAAA9B,EAC3B,SAAA0C,EACH,EAKF5C,EAAAA,IAACgC,EAAoB,SAApB,CAA6B,MAAA9B,EAG5B,SAAAF,EAAAA,IAAC6C,EAAAA,cAAA,CACC,MAAOP,EAAe,MACtB,KAAMI,EACN,aAAAN,EACA,mBAAkB,GAEjB,SAAAQ,CAAA,CAAA,EAEL,CAEJ,EAEaE,EAAkB,IAAMC,EAAAA,WAAWf,CAAmB,EAEtDgB,EAGX9B,GACyC,CACzC,KAAM,CAAE,OAAAM,CAAA,EAAWsB,EAAA,EACnB,OAAOvB,EACLL,EACAM,CAAA,CAEJ,EAEayB,EAAsC,CAGjD/B,EACAd,IACM,CACN,KAAM,CAAE,OAAAoB,CAAA,EAAWsB,EAAA,EACnB,OAAOnB,EAAgCT,EAAed,EAAOoB,CAAM,CACrE"}
1
+ {"version":3,"file":"theme.cjs.js","sources":["../src/design-system/DesignSystemScope.tsx","../src/design-system/utils.ts","../src/design-system/theme.tsx"],"sourcesContent":["import React from 'react';\nimport { DesignSystemScopeProps } from './types';\n\n/**\n * Marks the design system's subtree for CSS (`[data-design-system]`,\n * `[data-appearance]`) without adding a layout box. Native twin:\n * DesignSystemScope.native, which has no DOM to mark.\n */\nexport const DesignSystemScope: React.FC<DesignSystemScopeProps> = ({\n children,\n id,\n appearance,\n}) => (\n <div\n data-design-system={id}\n data-appearance={appearance}\n style={{ display: 'contents' }}\n >\n {children}\n </div>\n);\n","import {\n DesignSystemComponentConfig,\n DesignSystemComponentName,\n DesignSystemConfig,\n DesignSystemStylePrecedence,\n} from './types';\n\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n Boolean(value) &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.prototype.toString.call(value) === '[object Object]';\n\nexport const normalizeDesignSystemComponentProps = <\n T extends Record<string, any>\n>(\n props: T\n): T => {\n return props;\n};\n\nexport const deepMerge = <T extends Record<string, any> = Record<string, any>>(\n ...objects: Array<Record<string, any> | undefined>\n): T => {\n const result: Record<string, any> = {};\n\n objects.forEach((object) => {\n if (!isPlainObject(object)) return;\n\n Object.entries(object).forEach(([key, value]) => {\n // Treat null the same as undefined: configs use null to declare a key\n // exists in the schema without overriding component defaults. Nested\n // nulls (e.g. `views.container.backgroundColor: null`) are pre-stripped\n // from configs at the boundary — see `stripNullsDeep` below — so this\n // top-level check is sufficient and we keep the cycle-safe shape that\n // assigns React-element props by reference rather than recursing.\n if (value === undefined || value === null) return;\n\n if (isPlainObject(value) && isPlainObject(result[key])) {\n result[key] = deepMerge(result[key], value);\n return;\n }\n\n result[key] = value;\n });\n });\n\n return result as T;\n};\n\n/** Merge slots in order, including styles supplied through the engine's inline style prop. */\nexport function mergeDesignSystemViews<T extends Record<string, any>>(\n ...layers: Array<Partial<T> | undefined>\n): T {\n const result: Record<string, any> = {};\n for (const layer of layers) {\n for (const [slot, view] of Object.entries(layer ?? {})) {\n if (!isPlainObject(view)) continue;\n // React Native styles can include nested arrays of objects and false values.\n const next = Array.isArray(view.style)\n ? {\n ...view,\n style: Object.assign(\n {},\n ...view.style.flat(Infinity).filter(isPlainObject)\n ),\n }\n : view;\n const previous = result[slot];\n if (isPlainObject(previous?.style)) {\n const style = { ...previous.style };\n // The engine applies inline styles after style props. Remove an earlier\n // inline value when a higher-priority layer sets the same direct prop.\n for (const [key, value] of Object.entries(next)) {\n if (key !== 'style' && value != null) delete style[key];\n }\n result[slot] = deepMerge({ ...previous, style }, next);\n } else {\n result[slot] = deepMerge(previous, next);\n }\n }\n }\n return result as T;\n}\n\n// Recursively remove keys whose value is `null` from plain-object trees.\n// Only descends into plain objects: arrays and non-object values are returned\n// as-is, so React elements / fibers / class instances are left alone. Used to\n// scrub `views.container.backgroundColor: null` and friends from configs\n// before they ever reach the merge pipeline.\nconst stripNullsDeep = <T>(value: T): T => {\n if (Array.isArray(value)) return value;\n if (!isPlainObject(value)) return value;\n const out: Record<string, any> = {};\n for (const [k, v] of Object.entries(value)) {\n if (v === null) continue;\n out[k] = isPlainObject(v) ? stripNullsDeep(v) : v;\n }\n return out as T;\n};\n\n// Components whose colors are computed per-variant. A config block's `views`\n// sits ABOVE the variant palette, so a color there flattens every variant\n// (ghost/outline/subtle all render as solid blocks). Colors for these\n// components belong in `config.variants.<variant>` or the top-level\n// `color`/`textColor` keys. Retain this warning for legacy precedence.\nconst VARIANT_DRIVEN_COMPONENTS: ReadonlySet<string> = new Set(['button']);\nconst VIEW_COLOR_KEYS = [\n 'backgroundColor',\n 'background',\n 'borderColor',\n 'color',\n] as const;\nconst warnedViewColorBlocks = new Set<string>();\n\nconst warnOnViewColors = (\n componentName: string,\n views: Record<string, Record<string, unknown>> | undefined\n) => {\n if (process.env.NODE_ENV === 'production') return;\n if (!views || !VARIANT_DRIVEN_COMPONENTS.has(componentName)) return;\n if (warnedViewColorBlocks.has(componentName)) return;\n for (const [viewKey, viewValue] of Object.entries(views)) {\n if (!isPlainObject(viewValue)) continue;\n const offenders = VIEW_COLOR_KEYS.filter((k) => viewValue[k] != null);\n if (offenders.length > 0) {\n warnedViewColorBlocks.add(componentName);\n console.warn(\n `[design-system] components.${componentName}.views.${viewKey} sets ` +\n `${offenders.join(', ')} — view styles apply above every variant, ` +\n 'so this flattens ghost/outline/subtle into solid blocks. Move ' +\n `colors to components.${componentName}.config.variants.<variant> ` +\n 'for an individual variant; keep legacy views to shape and typography.'\n );\n return;\n }\n }\n};\n\nexport const getDesignSystemComponentProps = (\n componentName: DesignSystemComponentName,\n config?: DesignSystemConfig,\n stylePrecedence: DesignSystemStylePrecedence = 'legacy'\n): DesignSystemComponentConfig => {\n if (!config) return {};\n const raw: DesignSystemComponentConfig =\n config.components[componentName] || {};\n const cleaned = normalizeDesignSystemComponentProps(stripNullsDeep(raw));\n if (stylePrecedence === 'legacy')\n warnOnViewColors(componentName, cleaned.views);\n return cleaned;\n};\n\nexport const mergeDesignSystemComponentProps = <T extends Record<string, any>>(\n componentName: DesignSystemComponentName,\n props: T,\n config?: DesignSystemConfig\n): T =>\n mergeComponentDefaults(\n getDesignSystemComponentProps(componentName, config),\n props\n );\n\nexport function mergeComponentDefaults<T extends Record<string, any>>(\n defaults: DesignSystemComponentConfig,\n props: T\n): T {\n const { config: localConfig, ...otherProps } = props;\n return normalizeDesignSystemComponentProps(\n deepMerge<T>(defaults, localConfig, otherProps)\n );\n}\n","import React, {\n Context,\n createContext,\n ReactNode,\n useContext,\n useMemo,\n} from 'react';\nimport { ThemeProvider, useTheme } from 'app-studio';\nimport defaultConfig from './configs/default.json';\nimport { DesignSystemScope } from './DesignSystemScope';\nimport {\n DesignSystemAppearance,\n DesignSystemComponentConfigFor,\n DesignSystemComponentName,\n DesignSystemConfig,\n DesignSystemContextValue,\n DesignSystemStylePrecedence,\n} from './types';\nimport {\n getDesignSystemComponentProps,\n mergeComponentDefaults,\n mergeDesignSystemComponentProps,\n} from './utils';\n\nconst contextKey = Symbol.for(\n '@app-studio/components/design-system-context/v1'\n);\n\nfunction getDesignSystemContext() {\n // A copied theme and the npm entry can coexist in one React tree. Share the\n // context for that React runtime. Provider values still live in the tree.\n const scope = globalThis as typeof globalThis & {\n [contextKey]?: WeakMap<\n typeof createContext,\n Context<DesignSystemContextValue>\n >;\n };\n const contexts = (scope[contextKey] ??= new WeakMap());\n const existing = contexts.get(createContext);\n if (existing) return existing;\n\n const context = createContext<DesignSystemContextValue>({ isEnabled: false });\n contexts.set(createContext, context);\n return context;\n}\n\nconst DesignSystemContext = getDesignSystemContext();\n\nexport interface DesignSystemProviderProps {\n children: ReactNode;\n config?: DesignSystemConfig;\n /**\n * Explicitly pin the appearance for this subtree (light/dark). When omitted,\n * the provider follows the **global** theme mode (so a light/dark toggle\n * flips the design system), falling back to the config's `defaultAppearance`\n * only when there is no surrounding ThemeProvider.\n */\n mode?: DesignSystemAppearance;\n /** Document that owns the subtree and its theme stylesheet (for iframe portals). */\n targetWindow?: Window;\n /**\n * Render no ThemeProvider of its own: colours and mode come from the\n * surrounding ThemeProvider (an app's `brand`), and this provider only\n * supplies the component configuration. Without it (the default), the\n * config's `theme` is applied through a nested ThemeProvider.\n */\n inheritTheme?: boolean;\n /** Standard precedence applies theme defaults, then variant styles, then instance overrides. */\n stylePrecedence?: DesignSystemStylePrecedence;\n}\n\nexport const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({\n children,\n config,\n mode,\n targetWindow,\n inheritTheme = false,\n stylePrecedence = 'standard',\n}) => {\n const resolvedConfig = config ?? (defaultConfig as DesignSystemConfig);\n\n // Follow the active global theme mode so a light/dark toggle actually flips\n // the design system. An explicit `mode` prop pins the subtree; otherwise we\n // inherit the surrounding ThemeProvider's mode and fall back to the config's\n // declared default appearance when no provider is present.\n const { themeMode } = useTheme();\n const effectiveMode: DesignSystemAppearance =\n mode ?? themeMode ?? resolvedConfig.metadata.defaultAppearance;\n const theme = useMemo(\n () => ({ ...resolvedConfig.theme }),\n [resolvedConfig.theme]\n );\n const themeOptions = {\n mode: effectiveMode,\n targetWindow,\n transparentWrapper: true,\n };\n\n const value = useMemo(\n () => ({\n config: resolvedConfig,\n configId: resolvedConfig.metadata.id,\n isEnabled: true,\n stylePrecedence,\n }),\n [resolvedConfig, stylePrecedence]\n );\n\n // Delegate token resolution to app-studio's ThemeProvider: it emits\n // `--theme-<slot>` CSS variables from the theme object and registers them\n // with its color resolver, so `theme-primary`, `theme-canvas`, etc. work\n // anywhere a component uses them. `transparentWrapper` is auto-inferred\n // (nested under another ThemeProvider) and keeps the page layout intact.\n const scoped = (\n <DesignSystemScope\n id={resolvedConfig.metadata.id}\n appearance={effectiveMode}\n >\n {children}\n </DesignSystemScope>\n );\n\n if (inheritTheme) {\n return (\n <DesignSystemContext.Provider value={value}>\n {scoped}\n </DesignSystemContext.Provider>\n );\n }\n\n return (\n <DesignSystemContext.Provider value={value}>\n <ThemeProvider theme={theme} {...themeOptions}>\n {scoped}\n </ThemeProvider>\n </DesignSystemContext.Provider>\n );\n};\n\nexport const useDesignSystem = () => useContext(DesignSystemContext);\n\nexport const useDesignSystemComponentProps = <\n Name extends DesignSystemComponentName\n>(\n componentName: Name\n): DesignSystemComponentConfigFor<Name> => {\n const { config, stylePrecedence } = useDesignSystem();\n return getDesignSystemComponentProps(\n componentName,\n config,\n stylePrecedence\n ) as DesignSystemComponentConfigFor<Name>;\n};\n\nexport const useMergedDesignSystemComponentProps = <\n T extends Record<string, any>\n>(\n componentName: DesignSystemComponentName,\n props: T\n): T => {\n const { config } = useDesignSystem();\n return mergeDesignSystemComponentProps(componentName, props, config);\n};\n\n/** Keep theme views separate until the component knows which variant to apply. */\nexport function useDesignSystemComponentLayers<\n T extends { views?: Record<string, any> }\n>(\n componentName: DesignSystemComponentName,\n props: T\n): { props: T; themeViews?: T['views'] } {\n const { config, stylePrecedence } = useDesignSystem();\n const defaults = getDesignSystemComponentProps(\n componentName,\n config,\n stylePrecedence\n );\n if (stylePrecedence !== 'standard') {\n return { props: mergeComponentDefaults(defaults, props) };\n }\n const { views, ...otherDefaults } = defaults;\n return {\n props: mergeComponentDefaults(otherDefaults, props),\n themeViews: (views ?? {}) as T['views'],\n };\n}\n\nexport * from './types';\nexport * from './utils';\n"],"names":["DesignSystemScope","children","id","appearance","jsx","isPlainObject","value","normalizeDesignSystemComponentProps","props","deepMerge","objects","result","object","key","mergeDesignSystemViews","layers","layer","slot","view","next","previous","style","stripNullsDeep","out","k","v","VARIANT_DRIVEN_COMPONENTS","VIEW_COLOR_KEYS","warnedViewColorBlocks","warnOnViewColors","componentName","views","viewKey","viewValue","offenders","getDesignSystemComponentProps","config","stylePrecedence","raw","cleaned","mergeDesignSystemComponentProps","mergeComponentDefaults","defaults","localConfig","otherProps","contextKey","getDesignSystemContext","scope","contexts","existing","createContext","context","DesignSystemContext","DesignSystemProvider","mode","targetWindow","inheritTheme","resolvedConfig","defaultConfig","themeMode","useTheme","effectiveMode","theme","useMemo","themeOptions","scoped","ThemeProvider","useDesignSystem","useContext","useDesignSystemComponentProps","useMergedDesignSystemComponentProps","useDesignSystemComponentLayers","otherDefaults"],"mappings":"2MAQaA,EAAsD,CAAC,CAClE,SAAAC,EACA,GAAAC,EACA,WAAAC,CACF,IACEC,EAAAA,IAAC,MAAA,CACC,qBAAoBF,EACpB,kBAAiBC,EACjB,MAAO,CAAE,QAAS,UAAA,EAEjB,SAAAF,CAAA,CACH,ECZII,EAAiBC,GACrB,EAAQA,GACR,OAAOA,GAAU,UACjB,CAAC,MAAM,QAAQA,CAAK,GACpB,OAAO,UAAU,SAAS,KAAKA,CAAK,IAAM,kBAE/BC,EAGXC,GAEOA,EAGIC,EAAY,IACpBC,IACG,CACN,MAAMC,EAA8B,CAAA,EAEpC,OAAAD,EAAQ,QAASE,GAAW,CACrBP,EAAcO,CAAM,GAEzB,OAAO,QAAQA,CAAM,EAAE,QAAQ,CAAC,CAACC,EAAKP,CAAK,IAAM,CAO/C,GAA2BA,GAAU,KAErC,IAAID,EAAcC,CAAK,GAAKD,EAAcM,EAAOE,CAAG,CAAC,EAAG,CACtDF,EAAOE,CAAG,EAAIJ,EAAUE,EAAOE,CAAG,EAAGP,CAAK,EAC1C,MACF,CAEAK,EAAOE,CAAG,EAAIP,EAChB,CAAC,CACH,CAAC,EAEMK,CACT,EAGO,SAASG,KACXC,EACA,CACH,MAAMJ,EAA8B,CAAA,EACpC,UAAWK,KAASD,EAClB,SAAW,CAACE,EAAMC,CAAI,IAAK,OAAO,QAAQF,GAAS,CAAA,CAAE,EAAG,CACtD,GAAI,CAACX,EAAca,CAAI,EAAG,SAE1B,MAAMC,EAAO,MAAM,QAAQD,EAAK,KAAK,EACjC,CACE,GAAGA,EACH,MAAO,OAAO,OACZ,CAAA,EACA,GAAGA,EAAK,MAAM,KAAK,GAAQ,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x-runtime";
2
- import { createContext as b, useContext as S, useMemo as w } from "react";
3
- import { useTheme as v, ThemeProvider as D } from "app-studio";
4
- import { d as O } from "./chunks/default-nRKhMTzF.mjs";
5
- const P = ({
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { createContext as p, useContext as j, useMemo as w } from "react";
3
+ import { useTheme as x, ThemeProvider as E } from "app-studio";
4
+ import { d as A } from "./chunks/default-1F10zins.mjs";
5
+ const V = ({
6
6
  children: e,
7
7
  id: t,
8
- appearance: n
9
- }) => /* @__PURE__ */ c(
8
+ appearance: o
9
+ }) => /* @__PURE__ */ f(
10
10
  "div",
11
11
  {
12
12
  "data-design-system": t,
13
- "data-appearance": n,
13
+ "data-appearance": o,
14
14
  style: { display: "contents" },
15
15
  children: e
16
16
  }
17
- ), i = (e) => !!e && typeof e == "object" && !Array.isArray(e) && Object.prototype.toString.call(e) === "[object Object]", m = (e) => e, d = (...e) => {
17
+ ), c = (e) => !!e && typeof e == "object" && !Array.isArray(e) && Object.prototype.toString.call(e) === "[object Object]", v = (e) => e, d = (...e) => {
18
18
  const t = {};
19
- return e.forEach((n) => {
20
- i(n) && Object.entries(n).forEach(([o, r]) => {
21
- if (r != null) {
22
- if (i(r) && i(t[o])) {
23
- t[o] = d(t[o], r);
19
+ return e.forEach((o) => {
20
+ c(o) && Object.entries(o).forEach(([n, s]) => {
21
+ if (s != null) {
22
+ if (c(s) && c(t[n])) {
23
+ t[n] = d(t[n], s);
24
24
  return;
25
25
  }
26
- t[o] = r;
26
+ t[n] = s;
27
27
  }
28
28
  });
29
29
  }), t;
30
- }, y = (e) => {
31
- if (Array.isArray(e) || !i(e)) return e;
30
+ };
31
+ function L(...e) {
32
+ const t = {};
33
+ for (const o of e)
34
+ for (const [n, s] of Object.entries(o ?? {})) {
35
+ if (!c(s)) continue;
36
+ const i = Array.isArray(s.style) ? {
37
+ ...s,
38
+ style: Object.assign(
39
+ {},
40
+ ...s.style.flat(1 / 0).filter(c)
41
+ )
42
+ } : s, r = t[n];
43
+ if (c(r == null ? void 0 : r.style)) {
44
+ const l = { ...r.style };
45
+ for (const [a, u] of Object.entries(i))
46
+ a !== "style" && u != null && delete l[a];
47
+ t[n] = d({ ...r, style: l }, i);
48
+ } else
49
+ t[n] = d(r, i);
50
+ }
51
+ return t;
52
+ }
53
+ const O = (e) => {
54
+ if (Array.isArray(e) || !c(e)) return e;
32
55
  const t = {};
33
- for (const [n, o] of Object.entries(e))
34
- o !== null && (t[n] = i(o) ? y(o) : o);
56
+ for (const [o, n] of Object.entries(e))
57
+ n !== null && (t[o] = c(n) ? O(n) : n);
35
58
  return t;
36
- }, E = /* @__PURE__ */ new Set(["button"]), j = [
59
+ }, M = /* @__PURE__ */ new Set(["button"]), k = [
37
60
  "backgroundColor",
38
61
  "background",
39
62
  "borderColor",
40
63
  "color"
41
- ], g = /* @__PURE__ */ new Set(), A = (e, t) => {
42
- if (process.env.NODE_ENV !== "production" && !(!t || !E.has(e)) && !g.has(e))
43
- for (const [n, o] of Object.entries(t)) {
44
- if (!i(o)) continue;
45
- const r = j.filter((s) => o[s] != null);
46
- if (r.length > 0) {
47
- g.add(e), console.warn(
48
- `[design-system] components.${e}.views.${n} sets ${r.join(", ")} — view styles apply above every variant, so this flattens ghost/outline/subtle into solid blocks. Move colors to components.${e}.config.variants.<variant> (merged under each variant); keep views to shape and typography.`
64
+ ], D = /* @__PURE__ */ new Set(), I = (e, t) => {
65
+ if (process.env.NODE_ENV !== "production" && !(!t || !M.has(e)) && !D.has(e))
66
+ for (const [o, n] of Object.entries(t)) {
67
+ if (!c(n)) continue;
68
+ const s = k.filter((i) => n[i] != null);
69
+ if (s.length > 0) {
70
+ D.add(e), console.warn(
71
+ `[design-system] components.${e}.views.${o} sets ${s.join(", ")} — view styles apply above every variant, so this flattens ghost/outline/subtle into solid blocks. Move colors to components.${e}.config.variants.<variant> for an individual variant; keep legacy views to shape and typography.`
49
72
  );
50
73
  return;
51
74
  }
52
75
  }
53
- }, h = (e, t) => {
76
+ }, h = (e, t, o = "legacy") => {
54
77
  if (!t) return {};
55
- const n = t.components[e] || {}, o = m(y(n));
56
- return A(e, o.views), o;
57
- }, M = (e, t, n) => {
58
- const { config: o, ...r } = t, s = h(e, n), a = d(s, o || {});
59
- return m(
60
- d(a, r)
78
+ const n = t.components[e] || {}, s = v(O(n));
79
+ return o === "legacy" && I(e, s.views), s;
80
+ }, T = (e, t, o) => y(
81
+ h(e, o),
82
+ t
83
+ );
84
+ function y(e, t) {
85
+ const { config: o, ...n } = t;
86
+ return v(
87
+ d(e, o, n)
61
88
  );
62
- }, f = b({
63
- isEnabled: !1
64
- }), T = ({
89
+ }
90
+ const g = Symbol.for(
91
+ "@app-studio/components/design-system-context/v1"
92
+ );
93
+ function _() {
94
+ const e = globalThis, t = e[g] ?? (e[g] = /* @__PURE__ */ new WeakMap()), o = t.get(p);
95
+ if (o) return o;
96
+ const n = p({ isEnabled: !1 });
97
+ return t.set(p, n), n;
98
+ }
99
+ const m = _(), N = ({
65
100
  children: e,
66
101
  config: t,
67
- mode: n,
68
- targetWindow: o,
69
- inheritTheme: r = !1
102
+ mode: o,
103
+ targetWindow: n,
104
+ inheritTheme: s = !1,
105
+ stylePrecedence: i = "standard"
70
106
  }) => {
71
- const s = t ?? O, { themeMode: a } = v(), p = n ?? a ?? s.metadata.defaultAppearance, l = w(
107
+ const r = t ?? A, { themeMode: l } = x(), a = o ?? l ?? r.metadata.defaultAppearance, u = w(
108
+ () => ({ ...r.theme }),
109
+ [r.theme]
110
+ ), P = {
111
+ mode: a,
112
+ targetWindow: n,
113
+ transparentWrapper: !0
114
+ }, C = w(
72
115
  () => ({
73
- config: s,
74
- configId: s.metadata.id,
75
- isEnabled: !0
116
+ config: r,
117
+ configId: r.metadata.id,
118
+ isEnabled: !0,
119
+ stylePrecedence: i
76
120
  }),
77
- [s]
78
- ), u = /* @__PURE__ */ c(
79
- P,
121
+ [r, i]
122
+ ), S = /* @__PURE__ */ f(
123
+ V,
80
124
  {
81
- id: s.metadata.id,
82
- appearance: p,
125
+ id: r.metadata.id,
126
+ appearance: a,
83
127
  children: e
84
128
  }
85
129
  );
86
- return r ? /* @__PURE__ */ c(f.Provider, { value: l, children: u }) : /* @__PURE__ */ c(f.Provider, { value: l, children: /* @__PURE__ */ c(
87
- D,
88
- {
89
- theme: s.theme,
90
- mode: p,
91
- targetWindow: o,
92
- transparentWrapper: !0,
93
- children: u
94
- }
95
- ) });
96
- }, C = () => S(f), $ = (e) => {
97
- const { config: t } = C();
130
+ return s ? /* @__PURE__ */ f(m.Provider, { value: C, children: S }) : /* @__PURE__ */ f(m.Provider, { value: C, children: /* @__PURE__ */ f(E, { theme: u, ...P, children: S }) });
131
+ }, b = () => j(m), z = (e) => {
132
+ const { config: t, stylePrecedence: o } = b();
98
133
  return h(
99
134
  e,
100
- t
135
+ t,
136
+ o
101
137
  );
102
- }, k = (e, t) => {
103
- const { config: n } = C();
104
- return M(e, t, n);
138
+ }, K = (e, t) => {
139
+ const { config: o } = b();
140
+ return T(e, t, o);
105
141
  };
142
+ function Y(e, t) {
143
+ const { config: o, stylePrecedence: n } = b(), s = h(
144
+ e,
145
+ o,
146
+ n
147
+ );
148
+ if (n !== "standard")
149
+ return { props: y(s, t) };
150
+ const { views: i, ...r } = s;
151
+ return {
152
+ props: y(r, t),
153
+ themeViews: i ?? {}
154
+ };
155
+ }
106
156
  export {
107
- T as DesignSystemProvider,
157
+ N as DesignSystemProvider,
108
158
  d as deepMerge,
109
159
  h as getDesignSystemComponentProps,
110
- M as mergeDesignSystemComponentProps,
111
- m as normalizeDesignSystemComponentProps,
112
- C as useDesignSystem,
113
- $ as useDesignSystemComponentProps,
114
- k as useMergedDesignSystemComponentProps
160
+ y as mergeComponentDefaults,
161
+ T as mergeDesignSystemComponentProps,
162
+ L as mergeDesignSystemViews,
163
+ v as normalizeDesignSystemComponentProps,
164
+ b as useDesignSystem,
165
+ Y as useDesignSystemComponentLayers,
166
+ z as useDesignSystemComponentProps,
167
+ K as useMergedDesignSystemComponentProps
115
168
  };
116
169
  //# sourceMappingURL=theme.esm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme.esm.mjs","sources":["../src/design-system/DesignSystemScope.tsx","../src/design-system/utils.ts","../src/design-system/theme.tsx"],"sourcesContent":["import React from 'react';\nimport { DesignSystemScopeProps } from './types';\n\n/**\n * Marks the design system's subtree for CSS (`[data-design-system]`,\n * `[data-appearance]`) without adding a layout box. Native twin:\n * DesignSystemScope.native, which has no DOM to mark.\n */\nexport const DesignSystemScope: React.FC<DesignSystemScopeProps> = ({\n children,\n id,\n appearance,\n}) => (\n <div\n data-design-system={id}\n data-appearance={appearance}\n style={{ display: 'contents' }}\n >\n {children}\n </div>\n);\n","import {\n DesignSystemComponentConfig,\n DesignSystemComponentName,\n DesignSystemConfig,\n DesignSystemViewProps,\n} from './types';\n\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n Boolean(value) &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.prototype.toString.call(value) === '[object Object]';\n\nexport const normalizeDesignSystemComponentProps = <\n T extends Record<string, any>\n>(\n props: T\n): T => {\n return props;\n};\n\nexport const deepMerge = <T extends Record<string, any> = Record<string, any>>(\n ...objects: Array<Record<string, any> | undefined>\n): T => {\n const result: Record<string, any> = {};\n\n objects.forEach((object) => {\n if (!isPlainObject(object)) return;\n\n Object.entries(object).forEach(([key, value]) => {\n // Treat null the same as undefined: configs use null to declare a key\n // exists in the schema without overriding component defaults. Nested\n // nulls (e.g. `views.container.backgroundColor: null`) are pre-stripped\n // from configs at the boundary — see `stripNullsDeep` below — so this\n // top-level check is sufficient and we keep the cycle-safe shape that\n // assigns React-element props by reference rather than recursing.\n if (value === undefined || value === null) return;\n\n if (isPlainObject(value) && isPlainObject(result[key])) {\n result[key] = deepMerge(result[key], value);\n return;\n }\n\n result[key] = value;\n });\n });\n\n return result as T;\n};\n\n// Recursively remove keys whose value is `null` from plain-object trees.\n// Only descends into plain objects: arrays and non-object values are returned\n// as-is, so React elements / fibers / class instances are left alone. Used to\n// scrub `views.container.backgroundColor: null` and friends from configs\n// before they ever reach the merge pipeline.\nconst stripNullsDeep = <T>(value: T): T => {\n if (Array.isArray(value)) return value;\n if (!isPlainObject(value)) return value;\n const out: Record<string, any> = {};\n for (const [k, v] of Object.entries(value)) {\n if (v === null) continue;\n out[k] = isPlainObject(v) ? stripNullsDeep(v) : v;\n }\n return out as T;\n};\n\n// Components whose colors are computed per-variant. A config block's `views`\n// sits ABOVE the variant palette, so a color there flattens every variant\n// (ghost/outline/subtle all render as solid blocks). Colors for these\n// components belong in `config.variants.<variant>` (merged UNDER each\n// variant) or the top-level `color`/`textColor` keys.\nconst VARIANT_DRIVEN_COMPONENTS: ReadonlySet<string> = new Set(['button']);\nconst VIEW_COLOR_KEYS = [\n 'backgroundColor',\n 'background',\n 'borderColor',\n 'color',\n] as const;\nconst warnedViewColorBlocks = new Set<string>();\n\nconst warnOnViewColors = (\n componentName: string,\n views: Record<string, Record<string, unknown>> | undefined\n) => {\n if (process.env.NODE_ENV === 'production') return;\n if (!views || !VARIANT_DRIVEN_COMPONENTS.has(componentName)) return;\n if (warnedViewColorBlocks.has(componentName)) return;\n for (const [viewKey, viewValue] of Object.entries(views)) {\n if (!isPlainObject(viewValue)) continue;\n const offenders = VIEW_COLOR_KEYS.filter((k) => viewValue[k] != null);\n if (offenders.length > 0) {\n warnedViewColorBlocks.add(componentName);\n console.warn(\n `[design-system] components.${componentName}.views.${viewKey} sets ` +\n `${offenders.join(', ')} — view styles apply above every variant, ` +\n 'so this flattens ghost/outline/subtle into solid blocks. Move ' +\n `colors to components.${componentName}.config.variants.<variant> ` +\n '(merged under each variant); keep views to shape and typography.'\n );\n return;\n }\n }\n};\n\nexport const getDesignSystemComponentProps = (\n componentName: DesignSystemComponentName,\n config?: DesignSystemConfig\n): DesignSystemComponentConfig => {\n if (!config) return {};\n const raw = config.components[componentName] || {};\n const cleaned = normalizeDesignSystemComponentProps(stripNullsDeep(raw));\n warnOnViewColors(componentName, cleaned.views);\n return cleaned;\n};\n\nexport const mergeDesignSystemComponentProps = <T extends Record<string, any>>(\n componentName: DesignSystemComponentName,\n props: T,\n config?: DesignSystemConfig\n): T => {\n const { config: localConfig, ...otherProps } = props;\n\n const globalConfig = getDesignSystemComponentProps(componentName, config);\n\n const mergedConfig = deepMerge(globalConfig, localConfig || {});\n\n return normalizeDesignSystemComponentProps(\n deepMerge<T>(mergedConfig as any, otherProps as any) as T\n );\n};\n","import React, { createContext, ReactNode, useContext, useMemo } from 'react';\nimport { ThemeProvider, useTheme } from 'app-studio';\nimport defaultConfig from './configs/default.json';\nimport { DesignSystemScope } from './DesignSystemScope';\nimport {\n DesignSystemAppearance,\n DesignSystemComponentConfigFor,\n DesignSystemComponentName,\n DesignSystemConfig,\n DesignSystemContextValue,\n} from './types';\nimport {\n getDesignSystemComponentProps,\n mergeDesignSystemComponentProps,\n} from './utils';\n\nconst DesignSystemContext = createContext<DesignSystemContextValue>({\n isEnabled: false,\n});\n\nexport interface DesignSystemProviderProps {\n children: ReactNode;\n config?: DesignSystemConfig;\n /**\n * Explicitly pin the appearance for this subtree (light/dark). When omitted,\n * the provider follows the **global** theme mode (so a light/dark toggle\n * flips the design system), falling back to the config's `defaultAppearance`\n * only when there is no surrounding ThemeProvider.\n */\n mode?: DesignSystemAppearance;\n /** Document that owns the subtree and its theme stylesheet (for iframe portals). */\n targetWindow?: Window;\n /**\n * Render no ThemeProvider of its own: colours and mode come from the\n * surrounding ThemeProvider (an app's `brand`), and this provider only\n * supplies the component configuration. Without it (the default), the\n * config's `theme` is applied through a nested ThemeProvider.\n */\n inheritTheme?: boolean;\n}\n\nexport const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({\n children,\n config,\n mode,\n targetWindow,\n inheritTheme = false,\n}) => {\n const resolvedConfig = config ?? (defaultConfig as DesignSystemConfig);\n\n // Follow the active global theme mode so a light/dark toggle actually flips\n // the design system. An explicit `mode` prop pins the subtree; otherwise we\n // inherit the surrounding ThemeProvider's mode and fall back to the config's\n // declared default appearance when no provider is present.\n const { themeMode } = useTheme();\n const effectiveMode: DesignSystemAppearance =\n mode ?? themeMode ?? resolvedConfig.metadata.defaultAppearance;\n\n const value = useMemo(\n () => ({\n config: resolvedConfig,\n configId: resolvedConfig.metadata.id,\n isEnabled: true,\n }),\n [resolvedConfig]\n );\n\n // Delegate token resolution to app-studio's ThemeProvider: it emits\n // `--theme-<slot>` CSS variables from the theme object and registers them\n // with its color resolver, so `theme-primary`, `theme-canvas`, etc. work\n // anywhere a component uses them. `transparentWrapper` is auto-inferred\n // (nested under another ThemeProvider) and keeps the page layout intact.\n const scoped = (\n <DesignSystemScope\n id={resolvedConfig.metadata.id}\n appearance={effectiveMode}\n >\n {children}\n </DesignSystemScope>\n );\n\n if (inheritTheme) {\n return (\n <DesignSystemContext.Provider value={value}>\n {scoped}\n </DesignSystemContext.Provider>\n );\n }\n\n return (\n <DesignSystemContext.Provider value={value}>\n {/* No cast: app-studio's `theme` prop accepts ThemeSlots, which\n DesignSystemTheme satisfies structurally. */}\n <ThemeProvider\n theme={resolvedConfig.theme}\n mode={effectiveMode}\n targetWindow={targetWindow}\n transparentWrapper\n >\n {scoped}\n </ThemeProvider>\n </DesignSystemContext.Provider>\n );\n};\n\nexport const useDesignSystem = () => useContext(DesignSystemContext);\n\nexport const useDesignSystemComponentProps = <\n Name extends DesignSystemComponentName\n>(\n componentName: Name\n): DesignSystemComponentConfigFor<Name> => {\n const { config } = useDesignSystem();\n return getDesignSystemComponentProps(\n componentName,\n config\n ) as DesignSystemComponentConfigFor<Name>;\n};\n\nexport const useMergedDesignSystemComponentProps = <\n T extends Record<string, any>\n>(\n componentName: DesignSystemComponentName,\n props: T\n): T => {\n const { config } = useDesignSystem();\n return mergeDesignSystemComponentProps(componentName, props, config);\n};\n\nexport * from './types';\nexport * from './utils';\n"],"names":["DesignSystemScope","children","id","appearance","jsx","isPlainObject","value","normalizeDesignSystemComponentProps","props","deepMerge","objects","result","object","key","stripNullsDeep","out","k","v","VARIANT_DRIVEN_COMPONENTS","VIEW_COLOR_KEYS","warnedViewColorBlocks","warnOnViewColors","componentName","views","viewKey","viewValue","offenders","getDesignSystemComponentProps","config","raw","cleaned","mergeDesignSystemComponentProps","localConfig","otherProps","globalConfig","mergedConfig","DesignSystemContext","createContext","DesignSystemProvider","mode","targetWindow","inheritTheme","resolvedConfig","defaultConfig","themeMode","useTheme","effectiveMode","useMemo","scoped","ThemeProvider","useDesignSystem","useContext","useDesignSystemComponentProps","useMergedDesignSystemComponentProps"],"mappings":";;;;AAQO,MAAMA,IAAsD,CAAC;AAAA,EAClE,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,YAAAC;AACF,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,sBAAoBF;AAAA,IACpB,mBAAiBC;AAAA,IACjB,OAAO,EAAE,SAAS,WAAA;AAAA,IAEjB,UAAAF;AAAA,EAAA;AACH,GCZII,IAAgB,CAACC,MACrB,EAAQA,KACR,OAAOA,KAAU,YACjB,CAAC,MAAM,QAAQA,CAAK,KACpB,OAAO,UAAU,SAAS,KAAKA,CAAK,MAAM,mBAE/BC,IAAsC,CAGjDC,MAEOA,GAGIC,IAAY,IACpBC,MACG;AACN,QAAMC,IAA8B,CAAA;AAEpC,SAAAD,EAAQ,QAAQ,CAACE,MAAW;AAC1B,IAAKP,EAAcO,CAAM,KAEzB,OAAO,QAAQA,CAAM,EAAE,QAAQ,CAAC,CAACC,GAAKP,CAAK,MAAM;AAO/C,UAA2BA,KAAU,MAErC;AAAA,YAAID,EAAcC,CAAK,KAAKD,EAAcM,EAAOE,CAAG,CAAC,GAAG;AACtD,UAAAF,EAAOE,CAAG,IAAIJ,EAAUE,EAAOE,CAAG,GAAGP,CAAK;AAC1C;AAAA,QACF;AAEA,QAAAK,EAAOE,CAAG,IAAIP;AAAA;AAAA,IAChB,CAAC;AAAA,EACH,CAAC,GAEMK;AACT,GAOMG,IAAiB,CAAIR,MAAgB;AAEzC,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AEayB,IAAsC,CAGjD/B,GACAd,MACM;AACN,QAAM,EAAE,QAAAoB,EAAA,IAAWsB,EAAA;AACnB,SAAOnB,EAAgCT,GAAed,GAAOoB,CAAM;AACrE;"}
1
+ {"version":3,"file":"theme.esm.mjs","sources":["../src/design-system/DesignSystemScope.tsx","../src/design-system/utils.ts","../src/design-system/theme.tsx"],"sourcesContent":["import React from 'react';\nimport { DesignSystemScopeProps } from './types';\n\n/**\n * Marks the design system's subtree for CSS (`[data-design-system]`,\n * `[data-appearance]`) without adding a layout box. Native twin:\n * DesignSystemScope.native, which has no DOM to mark.\n */\nexport const DesignSystemScope: React.FC<DesignSystemScopeProps> = ({\n children,\n id,\n appearance,\n}) => (\n <div\n data-design-system={id}\n data-appearance={appearance}\n style={{ display: 'contents' }}\n >\n {children}\n </div>\n);\n","import {\n DesignSystemComponentConfig,\n DesignSystemComponentName,\n DesignSystemConfig,\n DesignSystemStylePrecedence,\n} from './types';\n\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n Boolean(value) &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.prototype.toString.call(value) === '[object Object]';\n\nexport const normalizeDesignSystemComponentProps = <\n T extends Record<string, any>\n>(\n props: T\n): T => {\n return props;\n};\n\nexport const deepMerge = <T extends Record<string, any> = Record<string, any>>(\n ...objects: Array<Record<string, any> | undefined>\n): T => {\n const result: Record<string, any> = {};\n\n objects.forEach((object) => {\n if (!isPlainObject(object)) return;\n\n Object.entries(object).forEach(([key, value]) => {\n // Treat null the same as undefined: configs use null to declare a key\n // exists in the schema without overriding component defaults. Nested\n // nulls (e.g. `views.container.backgroundColor: null`) are pre-stripped\n // from configs at the boundary — see `stripNullsDeep` below — so this\n // top-level check is sufficient and we keep the cycle-safe shape that\n // assigns React-element props by reference rather than recursing.\n if (value === undefined || value === null) return;\n\n if (isPlainObject(value) && isPlainObject(result[key])) {\n result[key] = deepMerge(result[key], value);\n return;\n }\n\n result[key] = value;\n });\n });\n\n return result as T;\n};\n\n/** Merge slots in order, including styles supplied through the engine's inline style prop. */\nexport function mergeDesignSystemViews<T extends Record<string, any>>(\n ...layers: Array<Partial<T> | undefined>\n): T {\n const result: Record<string, any> = {};\n for (const layer of layers) {\n for (const [slot, view] of Object.entries(layer ?? {})) {\n if (!isPlainObject(view)) continue;\n // React Native styles can include nested arrays of objects and false values.\n const next = Array.isArray(view.style)\n ? {\n ...view,\n style: Object.assign(\n {},\n ...view.style.flat(Infinity).filter(isPlainObject)\n ),\n }\n : view;\n const previous = result[slot];\n if (isPlainObject(previous?.style)) {\n const style = { ...previous.style };\n // The engine applies inline styles after style props. Remove an earlier\n // inline value when a higher-priority layer sets the same direct prop.\n for (const [key, value] of Object.entries(next)) {\n if (key !== 'style' && value != null) delete style[key];\n }\n result[slot] = deepMerge({ ...previous, style }, next);\n } else {\n result[slot] = deepMerge(previous, next);\n }\n }\n }\n return result as T;\n}\n\n// Recursively remove keys whose value is `null` from plain-object trees.\n// Only descends into plain objects: arrays and non-object values are returned\n// as-is, so React elements / fibers / class instances are left alone. Used to\n// scrub `views.container.backgroundColor: null` and friends from configs\n// before they ever reach the merge pipeline.\nconst stripNullsDeep = <T>(value: T): T => {\n if (Array.isArray(value)) return value;\n if (!isPlainObject(value)) return value;\n const out: Record<string, any> = {};\n for (const [k, v] of Object.entries(value)) {\n if (v === null) continue;\n out[k] = isPlainObject(v) ? stripNullsDeep(v) : v;\n }\n return out as T;\n};\n\n// Components whose colors are computed per-variant. A config block's `views`\n// sits ABOVE the variant palette, so a color there flattens every variant\n// (ghost/outline/subtle all render as solid blocks). Colors for these\n// components belong in `config.variants.<variant>` or the top-level\n// `color`/`textColor` keys. Retain this warning for legacy precedence.\nconst VARIANT_DRIVEN_COMPONENTS: ReadonlySet<string> = new Set(['button']);\nconst VIEW_COLOR_KEYS = [\n 'backgroundColor',\n 'background',\n 'borderColor',\n 'color',\n] as const;\nconst warnedViewColorBlocks = new Set<string>();\n\nconst warnOnViewColors = (\n componentName: string,\n views: Record<string, Record<string, unknown>> | undefined\n) => {\n if (process.env.NODE_ENV === 'production') return;\n if (!views || !VARIANT_DRIVEN_COMPONENTS.has(componentName)) return;\n if (warnedViewColorBlocks.has(componentName)) return;\n for (const [viewKey, viewValue] of Object.entries(views)) {\n if (!isPlainObject(viewValue)) continue;\n const offenders = VIEW_COLOR_KEYS.filter((k) => viewValue[k] != null);\n if (offenders.length > 0) {\n warnedViewColorBlocks.add(componentName);\n console.warn(\n `[design-system] components.${componentName}.views.${viewKey} sets ` +\n `${offenders.join(', ')} — view styles apply above every variant, ` +\n 'so this flattens ghost/outline/subtle into solid blocks. Move ' +\n `colors to components.${componentName}.config.variants.<variant> ` +\n 'for an individual variant; keep legacy views to shape and typography.'\n );\n return;\n }\n }\n};\n\nexport const getDesignSystemComponentProps = (\n componentName: DesignSystemComponentName,\n config?: DesignSystemConfig,\n stylePrecedence: DesignSystemStylePrecedence = 'legacy'\n): DesignSystemComponentConfig => {\n if (!config) return {};\n const raw: DesignSystemComponentConfig =\n config.components[componentName] || {};\n const cleaned = normalizeDesignSystemComponentProps(stripNullsDeep(raw));\n if (stylePrecedence === 'legacy')\n warnOnViewColors(componentName, cleaned.views);\n return cleaned;\n};\n\nexport const mergeDesignSystemComponentProps = <T extends Record<string, any>>(\n componentName: DesignSystemComponentName,\n props: T,\n config?: DesignSystemConfig\n): T =>\n mergeComponentDefaults(\n getDesignSystemComponentProps(componentName, config),\n props\n );\n\nexport function mergeComponentDefaults<T extends Record<string, any>>(\n defaults: DesignSystemComponentConfig,\n props: T\n): T {\n const { config: localConfig, ...otherProps } = props;\n return normalizeDesignSystemComponentProps(\n deepMerge<T>(defaults, localConfig, otherProps)\n );\n}\n","import React, {\n Context,\n createContext,\n ReactNode,\n useContext,\n useMemo,\n} from 'react';\nimport { ThemeProvider, useTheme } from 'app-studio';\nimport defaultConfig from './configs/default.json';\nimport { DesignSystemScope } from './DesignSystemScope';\nimport {\n DesignSystemAppearance,\n DesignSystemComponentConfigFor,\n DesignSystemComponentName,\n DesignSystemConfig,\n DesignSystemContextValue,\n DesignSystemStylePrecedence,\n} from './types';\nimport {\n getDesignSystemComponentProps,\n mergeComponentDefaults,\n mergeDesignSystemComponentProps,\n} from './utils';\n\nconst contextKey = Symbol.for(\n '@app-studio/components/design-system-context/v1'\n);\n\nfunction getDesignSystemContext() {\n // A copied theme and the npm entry can coexist in one React tree. Share the\n // context for that React runtime. Provider values still live in the tree.\n const scope = globalThis as typeof globalThis & {\n [contextKey]?: WeakMap<\n typeof createContext,\n Context<DesignSystemContextValue>\n >;\n };\n const contexts = (scope[contextKey] ??= new WeakMap());\n const existing = contexts.get(createContext);\n if (existing) return existing;\n\n const context = createContext<DesignSystemContextValue>({ isEnabled: false });\n contexts.set(createContext, context);\n return context;\n}\n\nconst DesignSystemContext = getDesignSystemContext();\n\nexport interface DesignSystemProviderProps {\n children: ReactNode;\n config?: DesignSystemConfig;\n /**\n * Explicitly pin the appearance for this subtree (light/dark). When omitted,\n * the provider follows the **global** theme mode (so a light/dark toggle\n * flips the design system), falling back to the config's `defaultAppearance`\n * only when there is no surrounding ThemeProvider.\n */\n mode?: DesignSystemAppearance;\n /** Document that owns the subtree and its theme stylesheet (for iframe portals). */\n targetWindow?: Window;\n /**\n * Render no ThemeProvider of its own: colours and mode come from the\n * surrounding ThemeProvider (an app's `brand`), and this provider only\n * supplies the component configuration. Without it (the default), the\n * config's `theme` is applied through a nested ThemeProvider.\n */\n inheritTheme?: boolean;\n /** Standard precedence applies theme defaults, then variant styles, then instance overrides. */\n stylePrecedence?: DesignSystemStylePrecedence;\n}\n\nexport const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({\n children,\n config,\n mode,\n targetWindow,\n inheritTheme = false,\n stylePrecedence = 'standard',\n}) => {\n const resolvedConfig = config ?? (defaultConfig as DesignSystemConfig);\n\n // Follow the active global theme mode so a light/dark toggle actually flips\n // the design system. An explicit `mode` prop pins the subtree; otherwise we\n // inherit the surrounding ThemeProvider's mode and fall back to the config's\n // declared default appearance when no provider is present.\n const { themeMode } = useTheme();\n const effectiveMode: DesignSystemAppearance =\n mode ?? themeMode ?? resolvedConfig.metadata.defaultAppearance;\n const theme = useMemo(\n () => ({ ...resolvedConfig.theme }),\n [resolvedConfig.theme]\n );\n const themeOptions = {\n mode: effectiveMode,\n targetWindow,\n transparentWrapper: true,\n };\n\n const value = useMemo(\n () => ({\n config: resolvedConfig,\n configId: resolvedConfig.metadata.id,\n isEnabled: true,\n stylePrecedence,\n }),\n [resolvedConfig, stylePrecedence]\n );\n\n // Delegate token resolution to app-studio's ThemeProvider: it emits\n // `--theme-<slot>` CSS variables from the theme object and registers them\n // with its color resolver, so `theme-primary`, `theme-canvas`, etc. work\n // anywhere a component uses them. `transparentWrapper` is auto-inferred\n // (nested under another ThemeProvider) and keeps the page layout intact.\n const scoped = (\n <DesignSystemScope\n id={resolvedConfig.metadata.id}\n appearance={effectiveMode}\n >\n {children}\n </DesignSystemScope>\n );\n\n if (inheritTheme) {\n return (\n <DesignSystemContext.Provider value={value}>\n {scoped}\n </DesignSystemContext.Provider>\n );\n }\n\n return (\n <DesignSystemContext.Provider value={value}>\n <ThemeProvider theme={theme} {...themeOptions}>\n {scoped}\n </ThemeProvider>\n </DesignSystemContext.Provider>\n );\n};\n\nexport const useDesignSystem = () => useContext(DesignSystemContext);\n\nexport const useDesignSystemComponentProps = <\n Name extends DesignSystemComponentName\n>(\n componentName: Name\n): DesignSystemComponentConfigFor<Name> => {\n const { config, stylePrecedence } = useDesignSystem();\n return getDesignSystemComponentProps(\n componentName,\n config,\n stylePrecedence\n ) as DesignSystemComponentConfigFor<Name>;\n};\n\nexport const useMergedDesignSystemComponentProps = <\n T extends Record<string, any>\n>(\n componentName: DesignSystemComponentName,\n props: T\n): T => {\n const { config } = useDesignSystem();\n return mergeDesignSystemComponentProps(componentName, props, config);\n};\n\n/** Keep theme views separate until the component knows which variant to apply. */\nexport function useDesignSystemComponentLayers<\n T extends { views?: Record<string, any> }\n>(\n componentName: DesignSystemComponentName,\n props: T\n): { props: T; themeViews?: T['views'] } {\n const { config, stylePrecedence } = useDesignSystem();\n const defaults = getDesignSystemComponentProps(\n componentName,\n config,\n stylePrecedence\n );\n if (stylePrecedence !== 'standard') {\n return { props: mergeComponentDefaults(defaults, props) };\n }\n const { views, ...otherDefaults } = defaults;\n return {\n props: mergeComponentDefaults(otherDefaults, props),\n themeViews: (views ?? {}) as T['views'],\n };\n}\n\nexport * from './types';\nexport * from './utils';\n"],"names":["DesignSystemScope","children","id","appearance","jsx","isPlainObject","value","normalizeDesignSystemComponentProps","props","deepMerge","objects","result","object","key","mergeDesignSystemViews","layers","layer","slot","view","next","previous","style","stripNullsDeep","out","k","v","VARIANT_DRIVEN_COMPONENTS","VIEW_COLOR_KEYS","warnedViewColorBlocks","warnOnViewColors","componentName","views","viewKey","viewValue","offenders","getDesignSystemComponentProps","config","stylePrecedence","raw","cleaned","mergeDesignSystemComponentProps","mergeComponentDefaults","defaults","localConfig","otherProps","contextKey","getDesignSystemContext","scope","contexts","existing","createContext","context","DesignSystemContext","DesignSystemProvider","mode","targetWindow","inheritTheme","resolvedConfig","defaultConfig","themeMode","useTheme","effectiveMode","theme","useMemo","themeOptions","scoped","ThemeProvider","useDesignSystem","useContext","useDesignSystemComponentProps","useMergedDesignSystemComponentProps","useDesignSystemComponentLayers","otherDefaults"],"mappings":";;;;AAQO,MAAMA,IAAsD,CAAC;AAAA,EAClE,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,YAAAC;AACF,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,sBAAoBF;AAAA,IACpB,mBAAiBC;AAAA,IACjB,OAAO,EAAE,SAAS,WAAA;AAAA,IAEjB,UAAAF;AAAA,EAAA;AACH,GCZII,IAAgB,CAACC,MACrB,EAAQA,KACR,OAAOA,KAAU,YACjB,CAAC,MAAM,QAAQA,CAAK,KACpB,OAAO,UAAU,SAAS,KAAKA,CAAK,MAAM,mBAE/BC,IAAsC,CAGjDC,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;AAAA,IAACJ;AAAA,IAAA;AAAA,MACC,IAAIyD,EAAe,SAAS;AAAA,MAC5B,YAAYI;AAAA,MAEX,UAAA5D;AAAA,IAAA;AAAA,EAAA;AAIL,SAAIuD,IAEA,gBAAApD,EAACgD,EAAoB,UAApB,EAA6B,OAAA9C,GAC3B,UAAA2D,GACH,IAKF,gBAAA7D,EAACgD,EAAoB,UAApB,EAA6B,OAAA9C,GAC5B,UAAA,gBAAAF,EAAC8D,GAAA,EAAc,OAAAJ,GAAe,GAAGE,GAC9B,UAAAC,EAAA,CACH,EAAA,CACF;AAEJ,GAEaE,IAAkB,MAAMC,EAAWhB,CAAmB,GAEtDiB,IAAgC,CAG3CvC,MACyC;AACzC,QAAM,EAAE,QAAAM,GAAQ,iBAAAC,EAAA,IAAoB8B,EAAA;AACpC,SAAOhC;AAAA,IACLL;AAAA,IACAM;AAAA,IACAC;AAAA,EAAA;AAEJ,GAEaiC,IAAsC,CAGjDxC,GACAtB,MACM;AACN,QAAM,EAAE,QAAA4B,EAAA,IAAW+B,EAAA;AACnB,SAAO3B,EAAgCV,GAAetB,GAAO4B,CAAM;AACrE;AAGO,SAASmC,EAGdzC,GACAtB,GACuC;AACvC,QAAM,EAAE,QAAA4B,GAAQ,iBAAAC,EAAA,IAAoB8B,EAAA,GAC9BzB,IAAWP;AAAA,IACfL;AAAA,IACAM;AAAA,IACAC;AAAA,EAAA;AAEF,MAAIA,MAAoB;AACtB,WAAO,EAAE,OAAOI,EAAuBC,GAAUlC,CAAK,EAAA;AAExD,QAAM,EAAE,OAAAuB,GAAO,GAAGyC,EAAA,IAAkB9B;AACpC,SAAO;AAAA,IACL,OAAOD,EAAuB+B,GAAehE,CAAK;AAAA,IAClD,YAAauB,KAAS,CAAA;AAAA,EAAC;AAE3B;"}
@@ -3,4 +3,6 @@ import { AlertProps } from './Alert.props';
3
3
  /**
4
4
  * Alert component that displays important messages to users
5
5
  */
6
- export declare const AlertView: React.MemoExoticComponent<({ icon, title, views, description, variant, themeMode: elementMode, children, ...props }: AlertProps) => React.JSX.Element>;
6
+ export declare const AlertView: React.MemoExoticComponent<({ icon, title, views: instanceViews, themeViews, description, variant, themeMode: elementMode, children, ...props }: AlertProps & {
7
+ themeViews?: AlertProps["views"];
8
+ }) => React.JSX.Element>;
@@ -10,5 +10,5 @@ export interface AvatarProps {
10
10
  }
11
11
  export interface AvatarViewProps extends AvatarProps {
12
12
  imageError: boolean;
13
- setImageError: React.Dispatch<React.SetStateAction<boolean>>;
13
+ onImageError: () => void;
14
14
  }
@@ -1,4 +1,4 @@
1
- export declare const useAvatarState: () => {
1
+ export declare const useAvatarState: (src?: string) => {
2
2
  imageError: boolean;
3
- setImageError: import('react').Dispatch<import('react').SetStateAction<boolean>>;
3
+ onImageError: () => void;
4
4
  };
@@ -1,3 +1,3 @@
1
1
  import { default as React } from 'react';
2
2
  import { AvatarViewProps } from './Avatar.props';
3
- export declare const AvatarView: ({ src, size, fallback, views, imageError, setImageError, onClick, children, }: AvatarViewProps) => React.JSX.Element;
3
+ export declare const AvatarView: ({ src, size, fallback, views, imageError, onImageError, onClick, children, }: AvatarViewProps) => React.JSX.Element;
@@ -3,5 +3,7 @@ import { LinkProps } from '../../Link/Link/Link.props';
3
3
  import { ButtonProps } from './Button.props';
4
4
  declare const ButtonView: React.NamedExoticComponent<ButtonProps & {
5
5
  linkComponent?: React.ComponentType<LinkProps>;
6
+ } & {
7
+ themeViews?: ButtonProps["views"];
6
8
  } & React.RefAttributes<HTMLElement>>;
7
9
  export default ButtonView;
@@ -3,4 +3,6 @@ import { CardProps, CardHeaderProps, CardContentProps, CardFooterProps } from '.
3
3
  export declare const CardHeader: React.FC<CardHeaderProps>;
4
4
  export declare const CardContent: React.FC<CardContentProps>;
5
5
  export declare const CardFooter: React.FC<CardFooterProps>;
6
- export declare const CardView: React.FC<CardProps>;
6
+ export declare const CardView: React.FC<CardProps & {
7
+ themeViews?: CardProps['views'];
8
+ }>;