@ankhorage/surface 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (623) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/field/Field.js +1 -1
  3. package/dist/components/field/Field.js.map +1 -1
  4. package/dist/components/helper-text/HelperText.js +1 -1
  5. package/dist/components/helper-text/HelperText.js.map +1 -1
  6. package/dist/components/label/Label.js +1 -1
  7. package/dist/components/label/Label.js.map +1 -1
  8. package/dist/components/list-item/ListItem.js +2 -2
  9. package/dist/components/list-item/ListItem.js.map +1 -1
  10. package/dist/components/menu/Menu.d.ts.map +1 -1
  11. package/dist/components/menu/Menu.js +4 -2
  12. package/dist/components/menu/Menu.js.map +1 -1
  13. package/dist/components/modal/Modal.d.ts.map +1 -1
  14. package/dist/components/modal/Modal.js +2 -1
  15. package/dist/components/modal/Modal.js.map +1 -1
  16. package/dist/components/switch/Switch.js +2 -2
  17. package/dist/components/switch/Switch.js.map +1 -1
  18. package/dist/components/tabs/Tab.js +2 -2
  19. package/dist/components/tabs/Tab.js.map +1 -1
  20. package/dist/components/tabs/TabList.js +1 -1
  21. package/dist/components/tabs/TabList.js.map +1 -1
  22. package/dist/components/tabs/Tabs.js +1 -1
  23. package/dist/components/tabs/Tabs.js.map +1 -1
  24. package/dist/components/textarea/Textarea.js +1 -1
  25. package/dist/components/textarea/Textarea.js.map +1 -1
  26. package/dist/components/textarea/types.d.ts +1 -1
  27. package/dist/components/textarea/types.d.ts.map +1 -1
  28. package/dist/components/textarea/types.js.map +1 -1
  29. package/dist/components/toast/Toast.d.ts.map +1 -1
  30. package/dist/components/toast/Toast.js +4 -2
  31. package/dist/components/toast/Toast.js.map +1 -1
  32. package/dist/components/toast/ToastProvider.js +1 -1
  33. package/dist/components/toast/ToastProvider.js.map +1 -1
  34. package/dist/components/tooltip/Tooltip.js +2 -2
  35. package/dist/components/tooltip/Tooltip.js.map +1 -1
  36. package/dist/examples/DocsExamples.js +6 -6
  37. package/dist/examples/DocsExamples.js.map +1 -1
  38. package/dist/features/accordion/adapters/inbound/Accordion.d.ts +5 -0
  39. package/dist/features/accordion/adapters/inbound/Accordion.d.ts.map +1 -0
  40. package/dist/features/accordion/adapters/inbound/Accordion.js +46 -0
  41. package/dist/features/accordion/adapters/inbound/Accordion.js.map +1 -0
  42. package/dist/features/accordion/adapters/inbound/AccordionContent.d.ts +5 -0
  43. package/dist/features/accordion/adapters/inbound/AccordionContent.d.ts.map +1 -0
  44. package/dist/features/accordion/adapters/inbound/AccordionContent.js +16 -0
  45. package/dist/features/accordion/adapters/inbound/AccordionContent.js.map +1 -0
  46. package/dist/features/accordion/adapters/inbound/AccordionContext.d.ts +4 -0
  47. package/dist/features/accordion/adapters/inbound/AccordionContext.d.ts.map +1 -0
  48. package/dist/features/accordion/adapters/inbound/AccordionContext.js +3 -0
  49. package/dist/features/accordion/adapters/inbound/AccordionContext.js.map +1 -0
  50. package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts +5 -0
  51. package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts.map +1 -0
  52. package/dist/features/accordion/adapters/inbound/AccordionItem.js +28 -0
  53. package/dist/features/accordion/adapters/inbound/AccordionItem.js.map +1 -0
  54. package/dist/features/accordion/adapters/inbound/AccordionItemContext.d.ts +4 -0
  55. package/dist/features/accordion/adapters/inbound/AccordionItemContext.d.ts.map +1 -0
  56. package/dist/features/accordion/adapters/inbound/AccordionItemContext.js +3 -0
  57. package/dist/features/accordion/adapters/inbound/AccordionItemContext.js.map +1 -0
  58. package/dist/features/accordion/adapters/inbound/AccordionTrigger.d.ts +5 -0
  59. package/dist/features/accordion/adapters/inbound/AccordionTrigger.d.ts.map +1 -0
  60. package/dist/features/accordion/adapters/inbound/AccordionTrigger.js +17 -0
  61. package/dist/features/accordion/adapters/inbound/AccordionTrigger.js.map +1 -0
  62. package/dist/features/accordion/public.d.ts +6 -0
  63. package/dist/features/accordion/public.d.ts.map +1 -0
  64. package/dist/features/accordion/public.js +5 -0
  65. package/dist/features/accordion/public.js.map +1 -0
  66. package/dist/features/accordion/utils/resolveAccordionToggle.d.ts +11 -0
  67. package/dist/features/accordion/utils/resolveAccordionToggle.d.ts.map +1 -0
  68. package/dist/features/accordion/utils/resolveAccordionToggle.js +13 -0
  69. package/dist/features/accordion/utils/resolveAccordionToggle.js.map +1 -0
  70. package/dist/features/badge/adapters/inbound/Badge.d.ts +5 -0
  71. package/dist/features/badge/adapters/inbound/Badge.d.ts.map +1 -0
  72. package/dist/features/badge/adapters/inbound/Badge.js +30 -0
  73. package/dist/features/badge/adapters/inbound/Badge.js.map +1 -0
  74. package/dist/features/badge/public.d.ts +3 -0
  75. package/dist/features/badge/public.d.ts.map +1 -0
  76. package/dist/features/badge/public.js +2 -0
  77. package/dist/features/badge/public.js.map +1 -0
  78. package/dist/{components/button → features/button/adapters/inbound}/Button.d.ts +2 -1
  79. package/dist/features/button/adapters/inbound/Button.d.ts.map +1 -0
  80. package/dist/features/button/adapters/inbound/Button.js +60 -0
  81. package/dist/features/button/adapters/inbound/Button.js.map +1 -0
  82. package/dist/{components/icon-button → features/button/adapters/inbound}/IconButton.d.ts +2 -1
  83. package/dist/features/button/adapters/inbound/IconButton.d.ts.map +1 -0
  84. package/dist/features/button/adapters/inbound/IconButton.js +33 -0
  85. package/dist/features/button/adapters/inbound/IconButton.js.map +1 -0
  86. package/dist/features/button/public.d.ts +4 -0
  87. package/dist/features/button/public.d.ts.map +1 -0
  88. package/dist/features/button/public.js +3 -0
  89. package/dist/features/button/public.js.map +1 -0
  90. package/dist/features/card/adapters/inbound/Card.d.ts +5 -0
  91. package/dist/features/card/adapters/inbound/Card.d.ts.map +1 -0
  92. package/dist/features/card/adapters/inbound/Card.js +44 -0
  93. package/dist/features/card/adapters/inbound/Card.js.map +1 -0
  94. package/dist/features/card/public.d.ts +3 -0
  95. package/dist/features/card/public.d.ts.map +1 -0
  96. package/dist/features/card/public.js +2 -0
  97. package/dist/features/card/public.js.map +1 -0
  98. package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts +5 -0
  99. package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts.map +1 -0
  100. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +88 -0
  101. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -0
  102. package/dist/features/form/checkbox/public.d.ts +3 -0
  103. package/dist/features/form/checkbox/public.d.ts.map +1 -0
  104. package/dist/features/form/checkbox/public.js +2 -0
  105. package/dist/features/form/checkbox/public.js.map +1 -0
  106. package/dist/features/form/radio/adapters/inbound/Radio.d.ts +5 -0
  107. package/dist/features/form/radio/adapters/inbound/Radio.d.ts.map +1 -0
  108. package/dist/features/form/radio/adapters/inbound/Radio.js +91 -0
  109. package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -0
  110. package/dist/features/form/radio/public.d.ts +3 -0
  111. package/dist/features/form/radio/public.d.ts.map +1 -0
  112. package/dist/features/form/radio/public.js +2 -0
  113. package/dist/features/form/radio/public.js.map +1 -0
  114. package/dist/features/form/radio/utils/isRadioTextContent.d.ts +4 -0
  115. package/dist/features/form/radio/utils/isRadioTextContent.d.ts.map +1 -0
  116. package/dist/features/form/radio/utils/isRadioTextContent.js +5 -0
  117. package/dist/features/form/radio/utils/isRadioTextContent.js.map +1 -0
  118. package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts +5 -0
  119. package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -0
  120. package/dist/features/form/text-input/adapters/inbound/TextInput.js +41 -0
  121. package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -0
  122. package/dist/features/form/text-input/public.d.ts +3 -0
  123. package/dist/features/form/text-input/public.d.ts.map +1 -0
  124. package/dist/features/form/text-input/public.js +2 -0
  125. package/dist/features/form/text-input/public.js.map +1 -0
  126. package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts +15 -0
  127. package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts.map +1 -0
  128. package/dist/features/form/text-input/utils/resolveTextInputPresentation.js +56 -0
  129. package/dist/features/form/text-input/utils/resolveTextInputPresentation.js.map +1 -0
  130. package/dist/features/icon/adapters/inbound/Icon.d.ts +4 -0
  131. package/dist/features/icon/adapters/inbound/Icon.d.ts.map +1 -0
  132. package/dist/{primitives/icon → features/icon/adapters/inbound}/Icon.js +3 -3
  133. package/dist/features/icon/adapters/inbound/Icon.js.map +1 -0
  134. package/dist/features/icon/adapters/inbound/PortableIcon.d.ts +19 -0
  135. package/dist/features/icon/adapters/inbound/PortableIcon.d.ts.map +1 -0
  136. package/dist/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.js +37 -43
  137. package/dist/features/icon/adapters/inbound/PortableIcon.js.map +1 -0
  138. package/dist/features/icon/constants.d.ts +2 -0
  139. package/dist/features/icon/constants.d.ts.map +1 -0
  140. package/dist/features/icon/constants.js +8 -0
  141. package/dist/features/icon/constants.js.map +1 -0
  142. package/dist/features/icon/public.d.ts +4 -0
  143. package/dist/features/icon/public.d.ts.map +1 -0
  144. package/dist/features/icon/public.js +3 -0
  145. package/dist/features/icon/public.js.map +1 -0
  146. package/dist/{primitives/image → features/image/adapters/inbound}/Image.d.ts +2 -1
  147. package/dist/features/image/adapters/inbound/Image.d.ts.map +1 -0
  148. package/dist/features/image/adapters/inbound/Image.js +28 -0
  149. package/dist/features/image/adapters/inbound/Image.js.map +1 -0
  150. package/dist/features/image/public.d.ts +3 -0
  151. package/dist/features/image/public.d.ts.map +1 -0
  152. package/dist/features/image/public.js +2 -0
  153. package/dist/features/image/public.js.map +1 -0
  154. package/dist/features/image/utils/getSourceKey.d.ts +4 -0
  155. package/dist/features/image/utils/getSourceKey.d.ts.map +1 -0
  156. package/dist/features/image/utils/getSourceKey.js +33 -0
  157. package/dist/features/image/utils/getSourceKey.js.map +1 -0
  158. package/dist/features/image/utils/normalizeSource.d.ts +5 -0
  159. package/dist/features/image/utils/normalizeSource.d.ts.map +1 -0
  160. package/dist/features/image/utils/normalizeSource.js +9 -0
  161. package/dist/features/image/utils/normalizeSource.js.map +1 -0
  162. package/dist/features/image/utils/resolveAccessibilityLabel.d.ts +4 -0
  163. package/dist/features/image/utils/resolveAccessibilityLabel.d.ts.map +1 -0
  164. package/dist/features/image/utils/resolveAccessibilityLabel.js +5 -0
  165. package/dist/features/image/utils/resolveAccessibilityLabel.js.map +1 -0
  166. package/dist/features/image/utils/resolveAlt.d.ts +4 -0
  167. package/dist/features/image/utils/resolveAlt.d.ts.map +1 -0
  168. package/dist/features/image/utils/resolveAlt.js +5 -0
  169. package/dist/features/image/utils/resolveAlt.js.map +1 -0
  170. package/dist/features/image/utils/resolveImageStyle.d.ts +6 -0
  171. package/dist/features/image/utils/resolveImageStyle.d.ts.map +1 -0
  172. package/dist/features/image/utils/resolveImageStyle.js +15 -0
  173. package/dist/features/image/utils/resolveImageStyle.js.map +1 -0
  174. package/dist/features/image/utils/resolveRenderedSource.d.ts +4 -0
  175. package/dist/features/image/utils/resolveRenderedSource.d.ts.map +1 -0
  176. package/dist/features/image/utils/resolveRenderedSource.js +7 -0
  177. package/dist/features/image/utils/resolveRenderedSource.js.map +1 -0
  178. package/dist/features/image/utils/resolveResizeMode.d.ts +5 -0
  179. package/dist/features/image/utils/resolveResizeMode.d.ts.map +1 -0
  180. package/dist/features/image/utils/resolveResizeMode.js +5 -0
  181. package/dist/features/image/utils/resolveResizeMode.js.map +1 -0
  182. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.d.ts +5 -0
  183. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.d.ts.map +1 -0
  184. package/dist/{layout → features/keyboard-avoiding-view/adapters/inbound}/KeyboardAvoidingView.js +2 -2
  185. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.js.map +1 -0
  186. package/dist/features/keyboard-avoiding-view/public.d.ts +3 -0
  187. package/dist/features/keyboard-avoiding-view/public.d.ts.map +1 -0
  188. package/dist/features/keyboard-avoiding-view/public.js +2 -0
  189. package/dist/features/keyboard-avoiding-view/public.js.map +1 -0
  190. package/dist/features/layout/adapters/inbound/Box.d.ts +5 -0
  191. package/dist/features/layout/adapters/inbound/Box.d.ts.map +1 -0
  192. package/dist/{layout → features/layout/adapters/inbound}/Box.js +5 -4
  193. package/dist/features/layout/adapters/inbound/Box.js.map +1 -0
  194. package/dist/features/layout/adapters/inbound/Container.d.ts +5 -0
  195. package/dist/features/layout/adapters/inbound/Container.d.ts.map +1 -0
  196. package/dist/features/layout/adapters/inbound/Container.js +28 -0
  197. package/dist/features/layout/adapters/inbound/Container.js.map +1 -0
  198. package/dist/features/layout/adapters/inbound/Divider.d.ts +5 -0
  199. package/dist/features/layout/adapters/inbound/Divider.d.ts.map +1 -0
  200. package/dist/{layout → features/layout/adapters/inbound}/Divider.js +1 -0
  201. package/dist/features/layout/adapters/inbound/Divider.js.map +1 -0
  202. package/dist/features/layout/adapters/inbound/Grid.d.ts +5 -0
  203. package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -0
  204. package/dist/features/layout/adapters/inbound/Grid.js +48 -0
  205. package/dist/features/layout/adapters/inbound/Grid.js.map +1 -0
  206. package/dist/features/layout/adapters/inbound/Stack.d.ts +5 -0
  207. package/dist/features/layout/adapters/inbound/Stack.d.ts.map +1 -0
  208. package/dist/{layout → features/layout/adapters/inbound}/Stack.js +4 -3
  209. package/dist/features/layout/adapters/inbound/Stack.js.map +1 -0
  210. package/dist/features/layout/public.d.ts +7 -0
  211. package/dist/features/layout/public.d.ts.map +1 -0
  212. package/dist/features/layout/public.js +6 -0
  213. package/dist/features/layout/public.js.map +1 -0
  214. package/dist/features/surface/adapters/inbound/Surface.d.ts +5 -0
  215. package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -0
  216. package/dist/{layout → features/surface/adapters/inbound}/Surface.js +17 -28
  217. package/dist/features/surface/adapters/inbound/Surface.js.map +1 -0
  218. package/dist/features/surface/public.d.ts +3 -0
  219. package/dist/features/surface/public.d.ts.map +1 -0
  220. package/dist/features/surface/public.js +2 -0
  221. package/dist/features/surface/public.js.map +1 -0
  222. package/dist/features/typography/adapters/inbound/Heading.d.ts +5 -0
  223. package/dist/features/typography/adapters/inbound/Heading.d.ts.map +1 -0
  224. package/dist/features/typography/adapters/inbound/Heading.js +29 -0
  225. package/dist/features/typography/adapters/inbound/Heading.js.map +1 -0
  226. package/dist/{primitives/text → features/typography/adapters/inbound}/Text.d.ts +2 -1
  227. package/dist/features/typography/adapters/inbound/Text.d.ts.map +1 -0
  228. package/dist/{primitives/text → features/typography/adapters/inbound}/Text.js +18 -25
  229. package/dist/features/typography/adapters/inbound/Text.js.map +1 -0
  230. package/dist/features/typography/public.d.ts +4 -0
  231. package/dist/features/typography/public.d.ts.map +1 -0
  232. package/dist/features/typography/public.js +3 -0
  233. package/dist/features/typography/public.js.map +1 -0
  234. package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts +7 -0
  235. package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts.map +1 -0
  236. package/dist/features/typography/utils/resolveHeadingTextStyle.js +10 -0
  237. package/dist/features/typography/utils/resolveHeadingTextStyle.js.map +1 -0
  238. package/dist/index.d.ts +26 -22
  239. package/dist/index.d.ts.map +1 -1
  240. package/dist/index.js +13 -11
  241. package/dist/index.js.map +1 -1
  242. package/dist/layout/AppBar.d.ts +1 -1
  243. package/dist/layout/AppBar.d.ts.map +1 -1
  244. package/dist/layout/AppBar.js +1 -2
  245. package/dist/layout/AppBar.js.map +1 -1
  246. package/dist/layout/Center.d.ts +1 -1
  247. package/dist/layout/Center.d.ts.map +1 -1
  248. package/dist/layout/Center.js +1 -1
  249. package/dist/layout/Center.js.map +1 -1
  250. package/dist/layout/Inline.d.ts +1 -1
  251. package/dist/layout/Inline.d.ts.map +1 -1
  252. package/dist/layout/Inline.js +1 -1
  253. package/dist/layout/Inline.js.map +1 -1
  254. package/dist/layout/ScrollArea.d.ts +1 -1
  255. package/dist/layout/ScrollArea.d.ts.map +1 -1
  256. package/dist/layout/ScrollArea.js +1 -1
  257. package/dist/layout/ScrollArea.js.map +1 -1
  258. package/dist/layout/Spacer.d.ts +1 -1
  259. package/dist/layout/Spacer.d.ts.map +1 -1
  260. package/dist/layout/Spacer.js +1 -1
  261. package/dist/layout/Spacer.js.map +1 -1
  262. package/dist/layout/Template.d.ts +2 -2
  263. package/dist/layout/Template.d.ts.map +1 -1
  264. package/dist/layout/Template.js +2 -2
  265. package/dist/layout/Template.js.map +1 -1
  266. package/dist/layout/index.d.ts +0 -14
  267. package/dist/layout/index.d.ts.map +1 -1
  268. package/dist/layout/index.js +0 -7
  269. package/dist/layout/index.js.map +1 -1
  270. package/dist/primitives/button-base/ButtonBase.js +1 -1
  271. package/dist/primitives/button-base/ButtonBase.js.map +1 -1
  272. package/dist/primitives/button-base/types.d.ts +1 -1
  273. package/dist/primitives/button-base/types.d.ts.map +1 -1
  274. package/dist/primitives/button-base/types.js.map +1 -1
  275. package/dist/types/accordion.d.ts +54 -0
  276. package/dist/types/accordion.d.ts.map +1 -0
  277. package/dist/types/accordion.js +2 -0
  278. package/dist/types/accordion.js.map +1 -0
  279. package/dist/types/badge.d.ts +12 -0
  280. package/dist/types/badge.d.ts.map +1 -0
  281. package/dist/types/badge.js +2 -0
  282. package/dist/types/badge.js.map +1 -0
  283. package/dist/types/button.d.ts +25 -0
  284. package/dist/types/button.d.ts.map +1 -0
  285. package/dist/types/button.js +2 -0
  286. package/dist/types/button.js.map +1 -0
  287. package/dist/{components/card/types.d.ts → types/card.d.ts} +2 -2
  288. package/dist/types/card.d.ts.map +1 -0
  289. package/dist/types/card.js +2 -0
  290. package/dist/types/card.js.map +1 -0
  291. package/dist/{components/checkbox/types.d.ts → types/checkbox.d.ts} +4 -4
  292. package/dist/types/checkbox.d.ts.map +1 -0
  293. package/dist/types/checkbox.js +2 -0
  294. package/dist/types/checkbox.js.map +1 -0
  295. package/dist/types/icon.d.ts +66 -0
  296. package/dist/types/icon.d.ts.map +1 -0
  297. package/dist/types/icon.js +2 -0
  298. package/dist/types/icon.js.map +1 -0
  299. package/dist/{primitives/image/types.d.ts → types/image.d.ts} +3 -4
  300. package/dist/types/image.d.ts.map +1 -0
  301. package/dist/types/image.js +2 -0
  302. package/dist/types/image.js.map +1 -0
  303. package/dist/types/keyboard-avoiding-view.d.ts +4 -0
  304. package/dist/types/keyboard-avoiding-view.d.ts.map +1 -0
  305. package/dist/types/keyboard-avoiding-view.js +2 -0
  306. package/dist/types/keyboard-avoiding-view.js.map +1 -0
  307. package/dist/{layout/helpers.d.ts → types/layout.d.ts} +39 -5
  308. package/dist/types/layout.d.ts.map +1 -0
  309. package/dist/types/layout.js +2 -0
  310. package/dist/types/layout.js.map +1 -0
  311. package/dist/{components/radio/types.d.ts → types/radio.d.ts} +4 -4
  312. package/dist/types/radio.d.ts.map +1 -0
  313. package/dist/types/radio.js +2 -0
  314. package/dist/types/radio.js.map +1 -0
  315. package/dist/types/surface.d.ts +6 -0
  316. package/dist/types/surface.d.ts.map +1 -0
  317. package/dist/types/surface.js +2 -0
  318. package/dist/types/surface.js.map +1 -0
  319. package/dist/{components/text-input/types.d.ts → types/text-input.d.ts} +3 -3
  320. package/dist/types/text-input.d.ts.map +1 -0
  321. package/dist/types/text-input.js +2 -0
  322. package/dist/types/text-input.js.map +1 -0
  323. package/dist/types/typography.d.ts +29 -0
  324. package/dist/types/typography.d.ts.map +1 -0
  325. package/dist/types/typography.js +2 -0
  326. package/dist/types/typography.js.map +1 -0
  327. package/dist/utils/resolveBoxStyles.d.ts +7 -0
  328. package/dist/utils/resolveBoxStyles.d.ts.map +1 -0
  329. package/dist/utils/resolveBoxStyles.js +83 -0
  330. package/dist/utils/resolveBoxStyles.js.map +1 -0
  331. package/dist/utils/resolveSpacing.d.ts +5 -0
  332. package/dist/utils/resolveSpacing.d.ts.map +1 -0
  333. package/dist/utils/resolveSpacing.js +6 -0
  334. package/dist/utils/resolveSpacing.js.map +1 -0
  335. package/package.json +1 -1
  336. package/src/components/field/Field.tsx +1 -1
  337. package/src/components/helper-text/HelperText.tsx +1 -1
  338. package/src/components/label/Label.tsx +1 -1
  339. package/src/components/list-item/ListItem.tsx +2 -2
  340. package/src/components/menu/Menu.tsx +4 -2
  341. package/src/components/modal/Modal.tsx +2 -1
  342. package/src/components/switch/Switch.tsx +2 -2
  343. package/src/components/tabs/Tab.tsx +2 -2
  344. package/src/components/tabs/TabList.tsx +1 -1
  345. package/src/components/tabs/Tabs.tsx +1 -1
  346. package/src/components/textarea/Textarea.tsx +1 -1
  347. package/src/components/textarea/types.ts +1 -1
  348. package/src/components/toast/Toast.tsx +4 -2
  349. package/src/components/toast/ToastProvider.tsx +1 -1
  350. package/src/components/tooltip/Tooltip.tsx +2 -2
  351. package/src/examples/DocsExamples.tsx +6 -6
  352. package/src/features/accordion/adapters/inbound/Accordion.tsx +83 -0
  353. package/src/features/accordion/adapters/inbound/AccordionContent.tsx +30 -0
  354. package/src/features/accordion/adapters/inbound/AccordionContext.ts +5 -0
  355. package/src/features/accordion/adapters/inbound/AccordionItem.tsx +42 -0
  356. package/src/features/accordion/adapters/inbound/AccordionItemContext.ts +5 -0
  357. package/src/features/accordion/adapters/inbound/AccordionTrigger.tsx +34 -0
  358. package/src/features/accordion/public.ts +13 -0
  359. package/src/features/accordion/utils/resolveAccordionToggle.test.ts +57 -0
  360. package/src/features/accordion/utils/resolveAccordionToggle.ts +28 -0
  361. package/src/features/badge/adapters/inbound/Badge.tsx +58 -0
  362. package/src/features/badge/public.ts +2 -0
  363. package/src/features/button/adapters/inbound/Button.tsx +159 -0
  364. package/src/features/button/adapters/inbound/IconButton.tsx +69 -0
  365. package/src/features/button/public.ts +3 -0
  366. package/src/features/card/adapters/inbound/Card.tsx +88 -0
  367. package/src/features/card/public.ts +2 -0
  368. package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +207 -0
  369. package/src/features/form/checkbox/public.ts +2 -0
  370. package/src/{components/radio → features/form/radio/adapters/inbound}/Radio.test.ts +5 -5
  371. package/src/features/form/radio/adapters/inbound/Radio.tsx +214 -0
  372. package/src/features/form/radio/public.ts +2 -0
  373. package/src/{components/radio → features/form/radio/utils}/isRadioTextContent.ts +1 -3
  374. package/src/features/form/text-input/adapters/inbound/TextInput.tsx +72 -0
  375. package/src/features/form/text-input/public.ts +2 -0
  376. package/src/features/form/text-input/utils/resolveTextInputPresentation.ts +91 -0
  377. package/src/features/icon/adapters/inbound/Icon.tsx +14 -0
  378. package/src/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.tsx +41 -97
  379. package/src/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.web.test.tsx +6 -10
  380. package/src/features/icon/constants.ts +9 -0
  381. package/src/features/icon/public.ts +10 -0
  382. package/src/features/image/adapters/inbound/Image.tsx +55 -0
  383. package/src/features/image/public.ts +2 -0
  384. package/src/features/image/utils/getSourceKey.ts +32 -0
  385. package/src/features/image/utils/normalizeSource.ts +12 -0
  386. package/src/features/image/utils/resolveAccessibilityLabel.ts +9 -0
  387. package/src/features/image/utils/resolveAlt.ts +9 -0
  388. package/src/{primitives/image → features/image/utils}/resolveImageProps.test.ts +10 -22
  389. package/src/features/image/utils/resolveImageStyle.ts +23 -0
  390. package/src/features/image/utils/resolveRenderedSource.ts +11 -0
  391. package/src/features/image/utils/resolveResizeMode.ts +11 -0
  392. package/src/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.tsx +9 -0
  393. package/src/features/keyboard-avoiding-view/public.ts +5 -0
  394. package/src/{layout → features/layout/adapters/inbound}/Box.tsx +7 -15
  395. package/src/features/layout/adapters/inbound/Container.tsx +43 -0
  396. package/src/{layout → features/layout/adapters/inbound}/Divider.tsx +3 -8
  397. package/src/features/layout/adapters/inbound/Grid.tsx +78 -0
  398. package/src/{layout → features/layout/adapters/inbound}/Stack.test.ts +0 -1
  399. package/src/{layout → features/layout/adapters/inbound}/Stack.tsx +6 -15
  400. package/src/features/layout/public.ts +12 -0
  401. package/src/{layout → features/surface/adapters/inbound}/Surface.tsx +24 -41
  402. package/src/features/surface/public.ts +2 -0
  403. package/src/{primitives/heading → features/typography/adapters/inbound}/Heading.tsx +35 -38
  404. package/src/{primitives/text → features/typography/adapters/inbound}/Text.tsx +25 -35
  405. package/src/features/typography/public.ts +3 -0
  406. package/src/{primitives/heading/resolveHeadingStyle.test.ts → features/typography/utils/resolveHeadingTextStyle.test.ts} +5 -12
  407. package/src/features/typography/utils/resolveHeadingTextStyle.ts +21 -0
  408. package/src/index.test.ts +58 -28
  409. package/src/index.ts +52 -26
  410. package/src/layout/AppBar.tsx +1 -2
  411. package/src/layout/Center.tsx +1 -1
  412. package/src/layout/Inline.tsx +1 -1
  413. package/src/layout/ScrollArea.tsx +2 -1
  414. package/src/layout/Spacer.tsx +2 -2
  415. package/src/layout/Template.tsx +3 -2
  416. package/src/layout/index.ts +0 -17
  417. package/src/primitives/button-base/ButtonBase.tsx +1 -1
  418. package/src/primitives/button-base/types.ts +1 -1
  419. package/src/types/accordion.ts +69 -0
  420. package/src/{components/badge/types.ts → types/badge.ts} +3 -3
  421. package/src/types/button.ts +34 -0
  422. package/src/{components/card/types.ts → types/card.ts} +1 -1
  423. package/src/{components/checkbox/types.ts → types/checkbox.ts} +3 -3
  424. package/src/types/icon.ts +52 -0
  425. package/src/{primitives/image/types.ts → types/image.ts} +3 -3
  426. package/src/types/keyboard-avoiding-view.ts +6 -0
  427. package/src/types/layout.ts +96 -0
  428. package/src/{components/radio/types.ts → types/radio.ts} +3 -3
  429. package/src/types/surface.ts +7 -0
  430. package/src/{components/text-input/types.ts → types/text-input.ts} +2 -2
  431. package/src/types/typography.ts +32 -0
  432. package/src/{layout/helpers.test.ts → utils/resolveBoxStyles.test.ts} +8 -25
  433. package/src/utils/resolveBoxStyles.ts +135 -0
  434. package/src/utils/resolveSpacing.ts +11 -0
  435. package/src/webAcceptance.test.tsx +2 -3
  436. package/dist/components/badge/Badge.d.ts +0 -4
  437. package/dist/components/badge/Badge.d.ts.map +0 -1
  438. package/dist/components/badge/Badge.js +0 -30
  439. package/dist/components/badge/Badge.js.map +0 -1
  440. package/dist/components/badge/index.d.ts +0 -3
  441. package/dist/components/badge/index.d.ts.map +0 -1
  442. package/dist/components/badge/index.js +0 -2
  443. package/dist/components/badge/index.js.map +0 -1
  444. package/dist/components/badge/types.d.ts +0 -12
  445. package/dist/components/badge/types.d.ts.map +0 -1
  446. package/dist/components/badge/types.js +0 -2
  447. package/dist/components/badge/types.js.map +0 -1
  448. package/dist/components/button/Button.d.ts.map +0 -1
  449. package/dist/components/button/Button.js +0 -51
  450. package/dist/components/button/Button.js.map +0 -1
  451. package/dist/components/button/index.d.ts +0 -3
  452. package/dist/components/button/index.d.ts.map +0 -1
  453. package/dist/components/button/index.js +0 -2
  454. package/dist/components/button/index.js.map +0 -1
  455. package/dist/components/button/types.d.ts +0 -18
  456. package/dist/components/button/types.d.ts.map +0 -1
  457. package/dist/components/button/types.js +0 -2
  458. package/dist/components/button/types.js.map +0 -1
  459. package/dist/components/card/Card.d.ts +0 -4
  460. package/dist/components/card/Card.d.ts.map +0 -1
  461. package/dist/components/card/Card.js +0 -46
  462. package/dist/components/card/Card.js.map +0 -1
  463. package/dist/components/card/index.d.ts +0 -3
  464. package/dist/components/card/index.d.ts.map +0 -1
  465. package/dist/components/card/index.js +0 -2
  466. package/dist/components/card/index.js.map +0 -1
  467. package/dist/components/card/types.d.ts.map +0 -1
  468. package/dist/components/card/types.js +0 -2
  469. package/dist/components/card/types.js.map +0 -1
  470. package/dist/components/checkbox/Checkbox.d.ts +0 -4
  471. package/dist/components/checkbox/Checkbox.d.ts.map +0 -1
  472. package/dist/components/checkbox/Checkbox.js +0 -69
  473. package/dist/components/checkbox/Checkbox.js.map +0 -1
  474. package/dist/components/checkbox/index.d.ts +0 -3
  475. package/dist/components/checkbox/index.d.ts.map +0 -1
  476. package/dist/components/checkbox/index.js +0 -2
  477. package/dist/components/checkbox/index.js.map +0 -1
  478. package/dist/components/checkbox/types.d.ts.map +0 -1
  479. package/dist/components/checkbox/types.js +0 -2
  480. package/dist/components/checkbox/types.js.map +0 -1
  481. package/dist/components/icon-button/IconButton.d.ts.map +0 -1
  482. package/dist/components/icon-button/IconButton.js +0 -28
  483. package/dist/components/icon-button/IconButton.js.map +0 -1
  484. package/dist/components/icon-button/index.d.ts +0 -3
  485. package/dist/components/icon-button/index.d.ts.map +0 -1
  486. package/dist/components/icon-button/index.js +0 -2
  487. package/dist/components/icon-button/index.js.map +0 -1
  488. package/dist/components/icon-button/types.d.ts +0 -13
  489. package/dist/components/icon-button/types.d.ts.map +0 -1
  490. package/dist/components/icon-button/types.js +0 -2
  491. package/dist/components/icon-button/types.js.map +0 -1
  492. package/dist/components/radio/Radio.d.ts +0 -7
  493. package/dist/components/radio/Radio.d.ts.map +0 -1
  494. package/dist/components/radio/Radio.js +0 -75
  495. package/dist/components/radio/Radio.js.map +0 -1
  496. package/dist/components/radio/index.d.ts +0 -3
  497. package/dist/components/radio/index.d.ts.map +0 -1
  498. package/dist/components/radio/index.js +0 -2
  499. package/dist/components/radio/index.js.map +0 -1
  500. package/dist/components/radio/isRadioTextContent.d.ts +0 -6
  501. package/dist/components/radio/isRadioTextContent.d.ts.map +0 -1
  502. package/dist/components/radio/isRadioTextContent.js +0 -7
  503. package/dist/components/radio/isRadioTextContent.js.map +0 -1
  504. package/dist/components/radio/types.d.ts.map +0 -1
  505. package/dist/components/radio/types.js +0 -2
  506. package/dist/components/radio/types.js.map +0 -1
  507. package/dist/components/text-input/TextInput.d.ts +0 -4
  508. package/dist/components/text-input/TextInput.d.ts.map +0 -1
  509. package/dist/components/text-input/TextInput.js +0 -72
  510. package/dist/components/text-input/TextInput.js.map +0 -1
  511. package/dist/components/text-input/index.d.ts +0 -3
  512. package/dist/components/text-input/index.d.ts.map +0 -1
  513. package/dist/components/text-input/index.js +0 -2
  514. package/dist/components/text-input/index.js.map +0 -1
  515. package/dist/components/text-input/types.d.ts.map +0 -1
  516. package/dist/components/text-input/types.js +0 -2
  517. package/dist/components/text-input/types.js.map +0 -1
  518. package/dist/layout/Box.d.ts +0 -14
  519. package/dist/layout/Box.d.ts.map +0 -1
  520. package/dist/layout/Box.js.map +0 -1
  521. package/dist/layout/Container.d.ts +0 -11
  522. package/dist/layout/Container.d.ts.map +0 -1
  523. package/dist/layout/Container.js +0 -24
  524. package/dist/layout/Container.js.map +0 -1
  525. package/dist/layout/Divider.d.ts +0 -10
  526. package/dist/layout/Divider.d.ts.map +0 -1
  527. package/dist/layout/Divider.js.map +0 -1
  528. package/dist/layout/Grid.d.ts +0 -14
  529. package/dist/layout/Grid.d.ts.map +0 -1
  530. package/dist/layout/Grid.js +0 -51
  531. package/dist/layout/Grid.js.map +0 -1
  532. package/dist/layout/KeyboardAvoidingView.d.ts +0 -7
  533. package/dist/layout/KeyboardAvoidingView.d.ts.map +0 -1
  534. package/dist/layout/KeyboardAvoidingView.js.map +0 -1
  535. package/dist/layout/Stack.d.ts +0 -14
  536. package/dist/layout/Stack.d.ts.map +0 -1
  537. package/dist/layout/Stack.js.map +0 -1
  538. package/dist/layout/Surface.d.ts +0 -8
  539. package/dist/layout/Surface.d.ts.map +0 -1
  540. package/dist/layout/Surface.js.map +0 -1
  541. package/dist/layout/helpers.d.ts.map +0 -1
  542. package/dist/layout/helpers.js +0 -91
  543. package/dist/layout/helpers.js.map +0 -1
  544. package/dist/primitives/heading/Heading.d.ts +0 -4
  545. package/dist/primitives/heading/Heading.d.ts.map +0 -1
  546. package/dist/primitives/heading/Heading.js +0 -30
  547. package/dist/primitives/heading/Heading.js.map +0 -1
  548. package/dist/primitives/heading/index.d.ts +0 -3
  549. package/dist/primitives/heading/index.d.ts.map +0 -1
  550. package/dist/primitives/heading/index.js +0 -2
  551. package/dist/primitives/heading/index.js.map +0 -1
  552. package/dist/primitives/heading/resolveHeadingStyle.d.ts +0 -6
  553. package/dist/primitives/heading/resolveHeadingStyle.d.ts.map +0 -1
  554. package/dist/primitives/heading/resolveHeadingStyle.js +0 -9
  555. package/dist/primitives/heading/resolveHeadingStyle.js.map +0 -1
  556. package/dist/primitives/heading/types.d.ts +0 -15
  557. package/dist/primitives/heading/types.d.ts.map +0 -1
  558. package/dist/primitives/heading/types.js +0 -2
  559. package/dist/primitives/heading/types.js.map +0 -1
  560. package/dist/primitives/icon/Icon.d.ts +0 -16
  561. package/dist/primitives/icon/Icon.d.ts.map +0 -1
  562. package/dist/primitives/icon/Icon.js.map +0 -1
  563. package/dist/primitives/icon/PortableIcon.d.ts +0 -70
  564. package/dist/primitives/icon/PortableIcon.d.ts.map +0 -1
  565. package/dist/primitives/icon/PortableIcon.js.map +0 -1
  566. package/dist/primitives/icon/index.d.ts +0 -4
  567. package/dist/primitives/icon/index.d.ts.map +0 -1
  568. package/dist/primitives/icon/index.js +0 -3
  569. package/dist/primitives/icon/index.js.map +0 -1
  570. package/dist/primitives/image/Image.d.ts.map +0 -1
  571. package/dist/primitives/image/Image.js +0 -26
  572. package/dist/primitives/image/Image.js.map +0 -1
  573. package/dist/primitives/image/index.d.ts +0 -3
  574. package/dist/primitives/image/index.d.ts.map +0 -1
  575. package/dist/primitives/image/index.js +0 -2
  576. package/dist/primitives/image/index.js.map +0 -1
  577. package/dist/primitives/image/resolveImageProps.d.ts +0 -12
  578. package/dist/primitives/image/resolveImageProps.d.ts.map +0 -1
  579. package/dist/primitives/image/resolveImageProps.js +0 -67
  580. package/dist/primitives/image/resolveImageProps.js.map +0 -1
  581. package/dist/primitives/image/types.d.ts.map +0 -1
  582. package/dist/primitives/image/types.js +0 -2
  583. package/dist/primitives/image/types.js.map +0 -1
  584. package/dist/primitives/text/Text.d.ts.map +0 -1
  585. package/dist/primitives/text/Text.js.map +0 -1
  586. package/dist/primitives/text/index.d.ts +0 -3
  587. package/dist/primitives/text/index.d.ts.map +0 -1
  588. package/dist/primitives/text/index.js +0 -2
  589. package/dist/primitives/text/index.js.map +0 -1
  590. package/dist/primitives/text/types.d.ts +0 -17
  591. package/dist/primitives/text/types.d.ts.map +0 -1
  592. package/dist/primitives/text/types.js +0 -2
  593. package/dist/primitives/text/types.js.map +0 -1
  594. package/src/components/badge/Badge.tsx +0 -52
  595. package/src/components/badge/index.ts +0 -2
  596. package/src/components/button/Button.tsx +0 -98
  597. package/src/components/button/index.ts +0 -2
  598. package/src/components/button/types.ts +0 -23
  599. package/src/components/card/Card.tsx +0 -81
  600. package/src/components/card/index.ts +0 -2
  601. package/src/components/checkbox/Checkbox.tsx +0 -120
  602. package/src/components/checkbox/index.ts +0 -2
  603. package/src/components/icon-button/IconButton.tsx +0 -55
  604. package/src/components/icon-button/index.ts +0 -2
  605. package/src/components/icon-button/types.ts +0 -16
  606. package/src/components/radio/Radio.tsx +0 -124
  607. package/src/components/radio/index.ts +0 -2
  608. package/src/components/text-input/TextInput.tsx +0 -124
  609. package/src/components/text-input/index.ts +0 -2
  610. package/src/layout/Container.tsx +0 -43
  611. package/src/layout/Grid.tsx +0 -83
  612. package/src/layout/KeyboardAvoidingView.tsx +0 -16
  613. package/src/layout/helpers.ts +0 -205
  614. package/src/primitives/heading/index.ts +0 -2
  615. package/src/primitives/heading/resolveHeadingStyle.ts +0 -20
  616. package/src/primitives/heading/types.ts +0 -17
  617. package/src/primitives/icon/Icon.tsx +0 -34
  618. package/src/primitives/icon/index.ts +0 -10
  619. package/src/primitives/image/Image.tsx +0 -65
  620. package/src/primitives/image/index.ts +0 -2
  621. package/src/primitives/image/resolveImageProps.ts +0 -92
  622. package/src/primitives/text/index.ts +0 -2
  623. package/src/primitives/text/types.ts +0 -18
@@ -0,0 +1,9 @@
1
+ import type { IconProvider } from '../../types/icon';
2
+
3
+ export const SUPPORTED_ICON_PROVIDERS = [
4
+ 'Ionicons',
5
+ 'FontAwesome',
6
+ 'FontAwesome5',
7
+ 'FontAwesome6',
8
+ 'MaterialDesignIcons',
9
+ ] as const satisfies readonly IconProvider[];
@@ -0,0 +1,10 @@
1
+ export type {
2
+ FontIconSource,
3
+ IconProps,
4
+ IconProvider,
5
+ IconSource,
6
+ IconVariant,
7
+ SvgIconSource,
8
+ } from '../../types/icon';
9
+ export { Icon } from './adapters/inbound/Icon';
10
+ export { SUPPORTED_ICON_PROVIDERS } from './constants';
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import { Image as ReactNativeImage } from 'react-native';
3
+
4
+ import { useTheme } from '../../../../theme/ThemeContext';
5
+ import type { ImageProps } from '../../../../types/image';
6
+ import { getSourceKey } from '../../utils/getSourceKey';
7
+ import { normalizeSource } from '../../utils/normalizeSource';
8
+ import { resolveAccessibilityLabel } from '../../utils/resolveAccessibilityLabel';
9
+ import { resolveAlt } from '../../utils/resolveAlt';
10
+ import { resolveImageStyle } from '../../utils/resolveImageStyle';
11
+ import { resolveRenderedSource } from '../../utils/resolveRenderedSource';
12
+ import { resolveResizeMode } from '../../utils/resolveResizeMode';
13
+
14
+ /*** Renders a token-aware accessible image with optional fallback source. */
15
+ export function Image({
16
+ source,
17
+ fallbackSource,
18
+ alt,
19
+ accessibilityLabel,
20
+ width,
21
+ height,
22
+ aspectRatio,
23
+ fit,
24
+ resizeMode,
25
+ radius,
26
+ style,
27
+ testID,
28
+ onError,
29
+ }: ImageProps) {
30
+ const { theme } = useTheme();
31
+ const primaryKey = React.useMemo(() => getSourceKey(source), [source]);
32
+ const [failedPrimaryKey, setFailedPrimaryKey] = React.useState<string | null>(null);
33
+ const showFallback = primaryKey !== null && failedPrimaryKey === primaryKey;
34
+ const normalizedPrimary = normalizeSource(source);
35
+ const normalizedFallback = normalizeSource(fallbackSource);
36
+ const resolvedSource = resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback);
37
+
38
+ if (!resolvedSource) return null;
39
+
40
+ return (
41
+ <ReactNativeImage
42
+ accessibilityLabel={resolveAccessibilityLabel(alt, accessibilityLabel)}
43
+ accessibilityRole="image"
44
+ alt={resolveAlt(alt, accessibilityLabel)}
45
+ onError={(event) => {
46
+ onError?.(event);
47
+ if (!showFallback && normalizedFallback) setFailedPrimaryKey(primaryKey);
48
+ }}
49
+ resizeMode={resolveResizeMode(fit, resizeMode)}
50
+ source={resolvedSource}
51
+ style={[resolveImageStyle(theme, { width, height, aspectRatio, radius }), style]}
52
+ testID={testID}
53
+ />
54
+ );
55
+ }
@@ -0,0 +1,2 @@
1
+ export type { ImageFit, ImageProps, SurfaceImageSource } from '../../types/image';
2
+ export { Image } from './adapters/inbound/Image';
@@ -0,0 +1,32 @@
1
+ import type { ImageSourcePropType } from 'react-native';
2
+
3
+ import type { SurfaceImageSource } from '../../../types/image';
4
+
5
+ /*** Derives a stable runtime key for one Surface image source. */
6
+ export function getSourceKey(source: SurfaceImageSource | null | undefined): string | null {
7
+ if (source === null || source === undefined) return null;
8
+ if (typeof source === 'string') return `uri:${source}`;
9
+ if (typeof source === 'number') return `asset:${source}`;
10
+ if (Array.isArray(source)) {
11
+ const parts = source
12
+ .map((item) => item.uri)
13
+ .filter((value): value is string => typeof value === 'string');
14
+ return `uri-set:${parts.join('|')}`;
15
+ }
16
+
17
+ const uri = getUriFromSource(source);
18
+ if (uri) return `uri:${uri}`;
19
+
20
+ try {
21
+ return `src:${JSON.stringify(source)}`;
22
+ } catch {
23
+ return 'src:unknown';
24
+ }
25
+ }
26
+
27
+ /*** Reads the first URI represented by a React Native image source. */
28
+ function getUriFromSource(source: ImageSourcePropType): string | undefined {
29
+ if (Array.isArray(source)) return source[0]?.uri;
30
+ if (typeof source === 'number') return undefined;
31
+ return source.uri;
32
+ }
@@ -0,0 +1,12 @@
1
+ import type { ImageSourcePropType } from 'react-native';
2
+
3
+ import type { SurfaceImageSource } from '../../../types/image';
4
+
5
+ /*** Normalizes a Surface image source into React Native's source shape. */
6
+ export function normalizeSource(
7
+ source: SurfaceImageSource | null | undefined,
8
+ ): ImageSourcePropType | undefined {
9
+ if (source === null || source === undefined) return undefined;
10
+ if (typeof source === 'string') return { uri: source };
11
+ return source;
12
+ }
@@ -0,0 +1,9 @@
1
+ import type { ImageProps } from '../../../types/image';
2
+
3
+ /*** Resolves the accessible image label from explicit label or alt text. */
4
+ export function resolveAccessibilityLabel(
5
+ alt: ImageProps['alt'],
6
+ accessibilityLabel: ImageProps['accessibilityLabel'],
7
+ ): string | undefined {
8
+ return accessibilityLabel ?? alt;
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { ImageProps } from '../../../types/image';
2
+
3
+ /*** Resolves web alt text from alt or the accessible label. */
4
+ export function resolveAlt(
5
+ alt: ImageProps['alt'],
6
+ accessibilityLabel: ImageProps['accessibilityLabel'],
7
+ ): string | undefined {
8
+ return alt ?? accessibilityLabel;
9
+ }
@@ -1,13 +1,11 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
 
3
- import { createTheme } from '../../theme/createTheme';
4
- import {
5
- getSourceKey,
6
- normalizeSource,
7
- resolveImageStyle,
8
- resolveRenderedSource,
9
- resolveResizeMode,
10
- } from './resolveImageProps';
3
+ import { createTheme } from '../../../theme/createTheme';
4
+ import { getSourceKey } from './getSourceKey';
5
+ import { normalizeSource } from './normalizeSource';
6
+ import { resolveImageStyle } from './resolveImageStyle';
7
+ import { resolveRenderedSource } from './resolveRenderedSource';
8
+ import { resolveResizeMode } from './resolveResizeMode';
11
9
 
12
10
  describe('normalizeSource', () => {
13
11
  it('normalizes string sources into uri objects', () => {
@@ -15,13 +13,11 @@ describe('normalizeSource', () => {
15
13
  uri: 'https://example.com/image.png',
16
14
  });
17
15
  });
18
-
19
16
  it('passes through react-native image sources', () => {
20
17
  expect(normalizeSource({ uri: 'https://example.com/image.png' })).toEqual({
21
18
  uri: 'https://example.com/image.png',
22
19
  });
23
20
  });
24
-
25
21
  it('returns undefined for nullish sources', () => {
26
22
  expect(normalizeSource(null)).toBeUndefined();
27
23
  expect(normalizeSource(undefined)).toBeUndefined();
@@ -32,7 +28,6 @@ describe('resolveResizeMode', () => {
32
28
  it('prefers fit over resizeMode', () => {
33
29
  expect(resolveResizeMode('contain', 'cover')).toBe('contain');
34
30
  });
35
-
36
31
  it('defaults to cover when both are absent', () => {
37
32
  expect(resolveResizeMode(undefined, undefined)).toBe('cover');
38
33
  });
@@ -40,8 +35,8 @@ describe('resolveResizeMode', () => {
40
35
 
41
36
  describe('resolveRenderedSource', () => {
42
37
  it('renders fallback when the primary source is absent', () => {
43
- const normalizedFallback = normalizeSource('https://example.com/fallback.png');
44
- expect(resolveRenderedSource(undefined, normalizedFallback, false)).toEqual(normalizedFallback);
38
+ const fallback = normalizeSource('https://example.com/fallback.png');
39
+ expect(resolveRenderedSource(undefined, fallback, false)).toEqual(fallback);
45
40
  });
46
41
  });
47
42
 
@@ -52,29 +47,22 @@ describe('getSourceKey', () => {
52
47
  'uri:https://example.com/image.png',
53
48
  );
54
49
  });
55
-
56
- it('derives stable keys for asset sources', () => {
57
- expect(getSourceKey(12)).toBe('asset:12');
58
- });
59
-
50
+ it('derives stable keys for asset sources', () => expect(getSourceKey(12)).toBe('asset:12'));
60
51
  it('derives stable keys for uri sets', () => {
61
52
  expect(getSourceKey([{ uri: 'a' }, { uri: 'b' }])).toBe('uri-set:a|b');
62
53
  });
63
54
  });
64
55
 
65
56
  describe('resolveImageStyle', () => {
66
- it('resolves spacing tokens for width/height and preserves raw strings', () => {
57
+ it('resolves spacing tokens for dimensions and preserves raw strings', () => {
67
58
  const theme = createTheme();
68
59
  const style = resolveImageStyle(theme, { width: 'm', height: '100%' });
69
-
70
60
  expect(style.width).toBe(theme.spacing.m);
71
61
  expect(style.height).toBe('100%');
72
62
  });
73
-
74
63
  it('resolves radius tokens for borderRadius', () => {
75
64
  const theme = createTheme();
76
65
  const style = resolveImageStyle(theme, { radius: 'full' });
77
-
78
66
  expect(style.borderRadius).toBe(theme.radii.full);
79
67
  expect(style.overflow).toBe('hidden');
80
68
  });
@@ -0,0 +1,23 @@
1
+ import type { ImageStyle } from 'react-native';
2
+
3
+ import { resolveToken } from '../../../theme/resolveToken';
4
+ import type { SurfaceTheme } from '../../../theme/types';
5
+ import type { ImageProps } from '../../../types/image';
6
+
7
+ /*** Resolves token-aware dimensions and radius for a Surface image. */
8
+ export function resolveImageStyle(
9
+ theme: SurfaceTheme,
10
+ props: Pick<ImageProps, 'width' | 'height' | 'aspectRatio' | 'radius'>,
11
+ ): ImageStyle {
12
+ const width = resolveToken(theme.spacing, props.width);
13
+ const height = resolveToken(theme.spacing, props.height);
14
+ const borderRadius = resolveToken(theme.radii, props.radius);
15
+
16
+ return {
17
+ width,
18
+ height,
19
+ aspectRatio: props.aspectRatio,
20
+ borderRadius,
21
+ overflow: borderRadius !== undefined ? 'hidden' : undefined,
22
+ };
23
+ }
@@ -0,0 +1,11 @@
1
+ import type { ImageSourcePropType } from 'react-native';
2
+
3
+ /*** Chooses the primary or fallback normalized image source. */
4
+ export function resolveRenderedSource(
5
+ normalizedPrimary: ImageSourcePropType | undefined,
6
+ normalizedFallback: ImageSourcePropType | undefined,
7
+ showFallback: boolean,
8
+ ): ImageSourcePropType | undefined {
9
+ if (showFallback || !normalizedPrimary) return normalizedFallback;
10
+ return normalizedPrimary;
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { ImageResizeMode } from 'react-native';
2
+
3
+ import type { ImageProps } from '../../../types/image';
4
+
5
+ /*** Resolves the canonical resize mode, preferring the Surface fit alias. */
6
+ export function resolveResizeMode(
7
+ fit: ImageProps['fit'],
8
+ resizeMode: ImageProps['resizeMode'],
9
+ ): ImageResizeMode {
10
+ return fit ?? resizeMode ?? 'cover';
11
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { KeyboardAvoidingView as ReactNativeKeyboardAvoidingView } from 'react-native';
3
+
4
+ import type { KeyboardAvoidingViewProps } from '../../../../types/keyboard-avoiding-view';
5
+
6
+ /*** Preserves React Native keyboard avoidance behind the stable Surface feature boundary. */
7
+ export function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) {
8
+ return <ReactNativeKeyboardAvoidingView {...props} />;
9
+ }
@@ -0,0 +1,5 @@
1
+ export type {
2
+ KeyboardAvoidingViewBehavior,
3
+ KeyboardAvoidingViewProps,
4
+ } from '../../types/keyboard-avoiding-view';
5
+ export { KeyboardAvoidingView } from './adapters/inbound/KeyboardAvoidingView';
@@ -1,21 +1,13 @@
1
1
  import React from 'react';
2
- import { View, type ViewProps as ReactNativeViewProps } from 'react-native';
2
+ import { View } from 'react-native';
3
3
 
4
- import { useResponsiveRuntime } from '../core/responsive';
5
- import { resolvePointerEvents } from '../internal/resolvePointerEvents';
6
- import { useTheme } from '../theme/ThemeContext';
7
- import { type BoxStyleProps, resolveBoxStyles } from './helpers';
8
-
9
- export interface BoxProps extends BoxStyleProps {
10
- accessibilityLabel?: ReactNativeViewProps['accessibilityLabel'];
11
- accessibilityRole?: ReactNativeViewProps['accessibilityRole'];
12
- accessibilityState?: ReactNativeViewProps['accessibilityState'];
13
- accessible?: ReactNativeViewProps['accessible'];
14
- children?: React.ReactNode;
15
- pointerEvents?: ReactNativeViewProps['pointerEvents'];
16
- testID?: string;
17
- }
4
+ import { useResponsiveRuntime } from '../../../../core/responsive';
5
+ import { resolvePointerEvents } from '../../../../internal/resolvePointerEvents';
6
+ import { useTheme } from '../../../../theme/ThemeContext';
7
+ import type { BoxProps } from '../../../../types/layout';
8
+ import { resolveBoxStyles } from '../../../../utils/resolveBoxStyles';
18
9
 
10
+ /*** Renders the responsive foundational layout box. */
19
11
  export function Box({
20
12
  accessible,
21
13
  accessibilityLabel,
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { StyleSheet, View, type ViewStyle } from 'react-native';
3
+
4
+ import { resolveResponsive, useResponsiveRuntime } from '../../../../core/responsive';
5
+ import { useTheme } from '../../../../theme/ThemeContext';
6
+ import type { ContainerProps } from '../../../../types/layout';
7
+ import { resolveSpacing } from '../../../../utils/resolveSpacing';
8
+ import { Box } from './Box';
9
+
10
+ /*** Centers responsive content inside a configurable maximum width. */
11
+ export function Container({
12
+ children,
13
+ maxWidth = { base: Number.MAX_SAFE_INTEGER, lg: 1120 },
14
+ px = { base: 16, md: 24, lg: 32 },
15
+ ...props
16
+ }: ContainerProps) {
17
+ const { theme } = useTheme();
18
+ const { breakpoint } = useResponsiveRuntime();
19
+ const activeMaxWidth = resolveResponsive(maxWidth, breakpoint);
20
+ const activePx = resolveSpacing(theme, resolveResponsive(px, breakpoint));
21
+
22
+ return (
23
+ <Box {...props} width="100%" style={[styles.fullWidth, props.style]}>
24
+ <View style={resolveContainerStyle(activeMaxWidth, activePx)}>{children}</View>
25
+ </Box>
26
+ );
27
+ }
28
+
29
+ /*** Resolves centered responsive Container dimensions and padding. */
30
+ function resolveContainerStyle(
31
+ maxWidth: number | undefined,
32
+ horizontalPadding: number | undefined,
33
+ ): ViewStyle {
34
+ return {
35
+ alignSelf: 'center',
36
+ maxWidth,
37
+ paddingLeft: horizontalPadding,
38
+ paddingRight: horizontalPadding,
39
+ width: '100%',
40
+ };
41
+ }
42
+
43
+ const styles = StyleSheet.create({ fullWidth: { width: '100%' } });
@@ -1,14 +1,9 @@
1
1
  import React from 'react';
2
2
 
3
- import { Box, type BoxProps } from './Box';
4
- import type { ColorValue } from './helpers';
5
-
6
- export interface DividerProps extends Omit<BoxProps, 'bg' | 'height' | 'width'> {
7
- orientation?: 'horizontal' | 'vertical';
8
- color?: ColorValue;
9
- thickness?: number;
10
- }
3
+ import type { DividerProps } from '../../../../types/layout';
4
+ import { Box } from './Box';
11
5
 
6
+ /*** Renders a horizontal or vertical separator using layout tokens. */
12
7
  export function Divider({
13
8
  orientation = 'horizontal',
14
9
  color = 'border',
@@ -0,0 +1,78 @@
1
+ import React from 'react';
2
+ import { View, type ViewStyle } from 'react-native';
3
+
4
+ import { resolveResponsive, useResponsiveRuntime } from '../../../../core/responsive';
5
+ import { useTheme } from '../../../../theme/ThemeContext';
6
+ import type { GridProps } from '../../../../types/layout';
7
+ import { resolveSpacing } from '../../../../utils/resolveSpacing';
8
+ import { Box } from './Box';
9
+
10
+ /*** Lays out children in a responsive wrapping grid. */
11
+ export function Grid({
12
+ children,
13
+ cols,
14
+ gap = 0,
15
+ rowGap,
16
+ colGap,
17
+ minItemWidth,
18
+ ...props
19
+ }: GridProps) {
20
+ const { theme } = useTheme();
21
+ const { breakpoint } = useResponsiveRuntime();
22
+ const activeCols = Math.max(1, Math.floor(resolveResponsive(cols, breakpoint) ?? 1));
23
+ const defaultGap = resolveResponsive(gap, breakpoint) ?? 0;
24
+ const rowSpacing = Number(
25
+ resolveSpacing(theme, resolveResponsive(rowGap, breakpoint) ?? defaultGap) ?? 0,
26
+ );
27
+ const colSpacing = Number(
28
+ resolveSpacing(theme, resolveResponsive(colGap, breakpoint) ?? defaultGap) ?? 0,
29
+ );
30
+ const activeMinItemWidth = resolveResponsive(minItemWidth, breakpoint);
31
+ const basisPercent: `${number}%` = `${100 / activeCols}%`;
32
+
33
+ return (
34
+ <Box {...props}>
35
+ <View style={resolveGridStyle(rowSpacing, colSpacing)}>
36
+ {React.Children.toArray(children).map((node, index) => (
37
+ <View
38
+ key={String(index)}
39
+ style={resolveGridItemStyle(activeMinItemWidth, basisPercent, rowSpacing, colSpacing)}
40
+ >
41
+ {node}
42
+ </View>
43
+ ))}
44
+ </View>
45
+ </Box>
46
+ );
47
+ }
48
+
49
+ /*** Resolves the wrapping Grid container style. */
50
+ function resolveGridStyle(rowSpacing: number, colSpacing: number): ViewStyle {
51
+ return {
52
+ flexDirection: 'row',
53
+ flexWrap: 'wrap',
54
+ marginLeft: -colSpacing / 2,
55
+ marginRight: -colSpacing / 2,
56
+ marginTop: -rowSpacing / 2,
57
+ };
58
+ }
59
+
60
+ /*** Resolves a fixed-column or minimum-width grid item style. */
61
+ function resolveGridItemStyle(
62
+ minItemWidth: number | undefined,
63
+ basisPercent: `${number}%`,
64
+ rowSpacing: number,
65
+ colSpacing: number,
66
+ ): ViewStyle {
67
+ const sizing =
68
+ minItemWidth === undefined
69
+ ? { width: basisPercent, flexBasis: basisPercent }
70
+ : { minWidth: minItemWidth, flexBasis: minItemWidth, flexGrow: 1 };
71
+ return {
72
+ ...sizing,
73
+ paddingBottom: rowSpacing / 2,
74
+ paddingLeft: colSpacing / 2,
75
+ paddingRight: colSpacing / 2,
76
+ paddingTop: rowSpacing / 2,
77
+ };
78
+ }
@@ -5,7 +5,6 @@ import { describe, expect, it } from 'bun:test';
5
5
  describe('Stack layout contract', () => {
6
6
  it('keeps authored children as direct flex items and applies spacing through gap', async () => {
7
7
  const source = await readFile(new URL('./Stack.tsx', import.meta.url), 'utf8');
8
-
9
8
  expect(source).toContain('gap: activeGap');
10
9
  expect(source).toContain('{children}');
11
10
  expect(source).not.toContain("from 'react-native'");
@@ -1,21 +1,12 @@
1
1
  import type React from 'react';
2
2
 
3
- import { resolveResponsive, type Responsive, useResponsiveRuntime } from '../core/responsive';
4
- import { useTheme } from '../theme/ThemeContext';
5
- import { Box, type BoxProps } from './Box';
6
- import { resolveSpacing, type SpaceValue } from './helpers';
7
-
8
- export interface StackProps extends Omit<BoxProps, 'children'> {
9
- children?: React.ReactNode;
10
- direction?: Responsive<'row' | 'column'>;
11
- gap?: Responsive<SpaceValue>;
12
- align?: Responsive<'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'>;
13
- justify?: Responsive<
14
- 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'
15
- >;
16
- wrap?: Responsive<'nowrap' | 'wrap'>;
17
- }
3
+ import { resolveResponsive, useResponsiveRuntime } from '../../../../core/responsive';
4
+ import { useTheme } from '../../../../theme/ThemeContext';
5
+ import type { StackProps } from '../../../../types/layout';
6
+ import { resolveSpacing } from '../../../../utils/resolveSpacing';
7
+ import { Box } from './Box';
18
8
 
9
+ /*** Stacks authored children directly along a responsive flex direction. */
19
10
  export function Stack({
20
11
  children,
21
12
  direction = 'column',
@@ -0,0 +1,12 @@
1
+ export type {
2
+ BoxProps,
3
+ ContainerProps,
4
+ DividerProps,
5
+ GridProps,
6
+ StackProps,
7
+ } from '../../types/layout';
8
+ export { Box } from './adapters/inbound/Box';
9
+ export { Container } from './adapters/inbound/Container';
10
+ export { Divider } from './adapters/inbound/Divider';
11
+ export { Grid } from './adapters/inbound/Grid';
12
+ export { Stack } from './adapters/inbound/Stack';
@@ -1,15 +1,31 @@
1
1
  import React from 'react';
2
2
  import type { ViewStyle } from 'react-native';
3
3
 
4
- import { useTheme } from '../theme/ThemeContext';
5
- import { Box, type BoxProps } from './Box';
4
+ import { useTheme } from '../../../../theme/ThemeContext';
5
+ import type { SurfaceProps, SurfaceVariant } from '../../../../types/surface';
6
+ import { Box } from '../../../layout/public';
6
7
 
7
- export type SurfaceVariant = 'default' | 'subtle' | 'raised' | 'outline';
8
+ /*** Renders a themed container surface with semantic elevation and border variants. */
9
+ export function Surface({ variant = 'default', radius = 'm', style, ...props }: SurfaceProps) {
10
+ const { theme } = useTheme();
11
+ const backgroundColor =
12
+ variant === 'subtle'
13
+ ? theme.semantics.surface.subtle
14
+ : variant === 'raised'
15
+ ? theme.semantics.surface.raised
16
+ : theme.semantics.surface.default;
17
+ const borderColor = theme.semantics.border.default;
8
18
 
9
- export interface SurfaceProps extends Omit<BoxProps, 'bg' | 'borderColor' | 'borderWidth'> {
10
- variant?: SurfaceVariant;
19
+ return (
20
+ <Box
21
+ {...props}
22
+ radius={radius}
23
+ style={[resolveSurfaceVariantStyles(variant, borderColor, backgroundColor), style]}
24
+ />
25
+ );
11
26
  }
12
27
 
28
+ /*** Resolves the semantic visual treatment for one Surface variant. */
13
29
  function resolveSurfaceVariantStyles(
14
30
  variant: SurfaceVariant,
15
31
  borderColor: string,
@@ -17,11 +33,7 @@ function resolveSurfaceVariantStyles(
17
33
  ): ViewStyle {
18
34
  switch (variant) {
19
35
  case 'subtle':
20
- return {
21
- backgroundColor,
22
- borderColor: 'transparent',
23
- borderWidth: 0,
24
- };
36
+ return { backgroundColor, borderColor: 'transparent', borderWidth: 0 };
25
37
  case 'raised':
26
38
  return {
27
39
  backgroundColor,
@@ -34,37 +46,8 @@ function resolveSurfaceVariantStyles(
34
46
  shadowRadius: 8,
35
47
  };
36
48
  case 'outline':
37
- return {
38
- backgroundColor: 'transparent',
39
- borderColor,
40
- borderWidth: 1,
41
- };
49
+ return { backgroundColor: 'transparent', borderColor, borderWidth: 1 };
42
50
  case 'default':
43
- default:
44
- return {
45
- backgroundColor,
46
- borderColor,
47
- borderWidth: 1,
48
- };
51
+ return { backgroundColor, borderColor, borderWidth: 1 };
49
52
  }
50
53
  }
51
-
52
- export function Surface({ variant = 'default', radius = 'm', style, ...props }: SurfaceProps) {
53
- const { theme } = useTheme();
54
-
55
- const backgroundColor =
56
- variant === 'subtle'
57
- ? theme.semantics.surface.subtle
58
- : variant === 'raised'
59
- ? theme.semantics.surface.raised
60
- : theme.semantics.surface.default;
61
- const borderColor = theme.semantics.border.default;
62
-
63
- return (
64
- <Box
65
- {...props}
66
- radius={radius}
67
- style={[resolveSurfaceVariantStyles(variant, borderColor, backgroundColor), style]}
68
- />
69
- );
70
- }
@@ -0,0 +1,2 @@
1
+ export type { SurfaceProps, SurfaceVariant } from '../../types/surface';
2
+ export { Surface } from './adapters/inbound/Surface';