@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,214 @@
1
+ import React from 'react';
2
+ import type { ViewStyle } from 'react-native';
3
+
4
+ import {
5
+ type InteractionState,
6
+ resolveFieldState,
7
+ resolveIndicatorSize,
8
+ resolveSelectionControlColors,
9
+ resolveSelectionControlNextChecked,
10
+ } from '../../../../../internal/resolvers';
11
+ import { useControllableState } from '../../../../../internal/useControllableState';
12
+ import { ButtonBase } from '../../../../../primitives/button-base';
13
+ import type { ButtonBaseProps } from '../../../../../primitives/button-base/types';
14
+ import { useTheme } from '../../../../../theme/ThemeContext';
15
+ import type { SurfaceTheme } from '../../../../../theme/types';
16
+ import type { RadioProps } from '../../../../../types/radio';
17
+ import { Box } from '../../../../layout/public';
18
+ import { Text } from '../../../../typography/public';
19
+ import { isRadioTextContent } from '../../utils/isRadioTextContent';
20
+
21
+ /*** Renders one accessible radio control with text or structured label content. */
22
+ export function Radio({
23
+ accessibilityLabel,
24
+ checked,
25
+ children,
26
+ color = 'primary',
27
+ defaultChecked = false,
28
+ disabled = false,
29
+ invalid = false,
30
+ onCheckedChange,
31
+ readOnly = false,
32
+ size = 'm',
33
+ testID,
34
+ ...buttonProps
35
+ }: RadioProps) {
36
+ const { theme } = useTheme();
37
+ const [isChecked, setChecked] = useControllableState<boolean>({
38
+ value: checked,
39
+ defaultValue: defaultChecked,
40
+ onChange: onCheckedChange,
41
+ });
42
+
43
+ return (
44
+ <RadioControl
45
+ accessibilityLabel={accessibilityLabel}
46
+ buttonProps={buttonProps}
47
+ color={color}
48
+ disabled={disabled}
49
+ invalid={invalid}
50
+ isChecked={isChecked}
51
+ readOnly={readOnly}
52
+ setChecked={setChecked}
53
+ size={size}
54
+ testID={testID}
55
+ theme={theme}
56
+ >
57
+ {children}
58
+ </RadioControl>
59
+ );
60
+ }
61
+
62
+ /*** Owns the radio interaction boundary around resolved selection content. */
63
+ function RadioControl({
64
+ accessibilityLabel,
65
+ buttonProps,
66
+ children,
67
+ color,
68
+ disabled,
69
+ invalid,
70
+ isChecked,
71
+ readOnly,
72
+ setChecked,
73
+ size,
74
+ testID,
75
+ theme,
76
+ }: RadioControlProps) {
77
+ const nextChecked = resolveSelectionControlNextChecked({
78
+ checked: isChecked,
79
+ disabled,
80
+ kind: 'radio',
81
+ readOnly,
82
+ });
83
+
84
+ return (
85
+ <ButtonBase
86
+ {...buttonProps}
87
+ accessibilityLabel={accessibilityLabel}
88
+ accessibilityRole="radio"
89
+ accessibilityState={{ checked: isChecked }}
90
+ disabled={disabled}
91
+ onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}
92
+ testID={testID}
93
+ >
94
+ {(interactionState) =>
95
+ renderRadioContent({
96
+ children,
97
+ color,
98
+ disabled,
99
+ interactionState,
100
+ invalid,
101
+ isChecked,
102
+ readOnly,
103
+ size,
104
+ theme,
105
+ })
106
+ }
107
+ </ButtonBase>
108
+ );
109
+ }
110
+
111
+ /*** Renders the radio indicator and optional content for one interaction state. */
112
+ function renderRadioContent(input: RadioContentInput) {
113
+ const { interactionState, theme } = input;
114
+ const fieldState = resolveFieldState({
115
+ disabled: input.disabled,
116
+ focused: interactionState.focused,
117
+ invalid: input.invalid,
118
+ readOnly: input.readOnly,
119
+ });
120
+ const colors = resolveSelectionControlColors(theme, {
121
+ checked: input.isChecked,
122
+ fieldState,
123
+ hovered: interactionState.hovered,
124
+ pressed: interactionState.pressed,
125
+ color: input.color,
126
+ });
127
+ const indicatorSize = resolveIndicatorSize(input.size);
128
+ const labelEmphasis = colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
129
+ const hasContent =
130
+ input.children !== undefined && input.children !== null && input.children !== false;
131
+
132
+ return (
133
+ <Box style={resolveSelectionRowStyle(colors.opacity)}>
134
+ <Box
135
+ radius="full"
136
+ style={resolveRadioIndicatorStyle(
137
+ colors.backgroundColor,
138
+ colors.borderColor,
139
+ indicatorSize.radio,
140
+ )}
141
+ >
142
+ {input.isChecked ? (
143
+ <Box
144
+ radius="full"
145
+ style={resolveRadioDotStyle(colors.indicatorColor, indicatorSize.radioDot)}
146
+ />
147
+ ) : null}
148
+ </Box>
149
+ {hasContent ? (
150
+ <Box flex={1} ml="s">
151
+ {isRadioTextContent(input.children) ? (
152
+ <Text emphasis={labelEmphasis}>{input.children}</Text>
153
+ ) : (
154
+ input.children
155
+ )}
156
+ </Box>
157
+ ) : null}
158
+ </Box>
159
+ );
160
+ }
161
+
162
+ /*** Resolves the horizontal selection-control row style. */
163
+ function resolveSelectionRowStyle(opacity: number | undefined): ViewStyle {
164
+ return { alignItems: 'center', flexDirection: 'row', opacity };
165
+ }
166
+
167
+ /*** Resolves radio indicator dimensions and interaction colors. */
168
+ function resolveRadioIndicatorStyle(
169
+ backgroundColor: string,
170
+ borderColor: string,
171
+ size: number,
172
+ ): ViewStyle {
173
+ return {
174
+ alignItems: 'center',
175
+ backgroundColor,
176
+ borderColor,
177
+ borderWidth: 1.5,
178
+ height: size,
179
+ justifyContent: 'center',
180
+ width: size,
181
+ };
182
+ }
183
+
184
+ /*** Resolves the checked radio dot style. */
185
+ function resolveRadioDotStyle(backgroundColor: string, size: number): ViewStyle {
186
+ return { backgroundColor, height: size, width: size };
187
+ }
188
+
189
+ interface RadioControlProps {
190
+ accessibilityLabel: RadioProps['accessibilityLabel'];
191
+ buttonProps: ButtonBaseProps;
192
+ children: RadioProps['children'];
193
+ color: NonNullable<RadioProps['color']>;
194
+ disabled: boolean;
195
+ invalid: boolean;
196
+ isChecked: boolean;
197
+ readOnly: boolean;
198
+ setChecked: (checked: boolean) => void;
199
+ size: NonNullable<RadioProps['size']>;
200
+ testID: RadioProps['testID'];
201
+ theme: SurfaceTheme;
202
+ }
203
+
204
+ interface RadioContentInput {
205
+ children: RadioProps['children'];
206
+ color: NonNullable<RadioProps['color']>;
207
+ disabled: boolean;
208
+ interactionState: InteractionState;
209
+ invalid: boolean;
210
+ isChecked: boolean;
211
+ readOnly: boolean;
212
+ size: NonNullable<RadioProps['size']>;
213
+ theme: SurfaceTheme;
214
+ }
@@ -0,0 +1,2 @@
1
+ export type { RadioProps } from '../../../types/radio';
2
+ export { Radio } from './adapters/inbound/Radio';
@@ -1,8 +1,6 @@
1
1
  import type React from 'react';
2
2
 
3
- /***
4
- * Reports whether Radio content should use the built-in text-label presentation.
5
- */
3
+ /*** Reports whether Radio content should use the built-in text-label presentation. */
6
4
  export function isRadioTextContent(children: React.ReactNode): children is string | number {
7
5
  return typeof children === 'string' || typeof children === 'number';
8
6
  }
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import { Platform, TextInput as ReactNativeTextInput, View, type ViewStyle } from 'react-native';
3
+
4
+ import { resolveFocusRingStyles } from '../../../../../internal/resolvers';
5
+ import { useTheme } from '../../../../../theme/ThemeContext';
6
+ import type { TextInputProps } from '../../../../../types/text-input';
7
+ import { resolveTextInputPresentation } from '../../utils/resolveTextInputPresentation';
8
+
9
+ /*** Renders a token-aware text input with controlled interaction policy. */
10
+ export function TextInput(props: TextInputProps) {
11
+ const { theme } = useTheme();
12
+ const [focused, setFocused] = React.useState(false);
13
+ const {
14
+ disabled: _disabled,
15
+ interactionPolicy = 'enabled',
16
+ invalid: _invalid,
17
+ leadingAccessory,
18
+ readOnly = false,
19
+ size: _size,
20
+ trailingAccessory,
21
+ ...nativeProps
22
+ } = props;
23
+ const presentation = resolveTextInputPresentation(theme, props, focused);
24
+
25
+ return (
26
+ <View
27
+ style={[
28
+ presentation.containerStyle,
29
+ resolveFocusRingStyles(theme.semantics.border.focus, focused, Platform.OS === 'web'),
30
+ ]}
31
+ >
32
+ {renderAccessory(leadingAccessory, presentation.accessorySpacing, 'leading')}
33
+ <ReactNativeTextInput
34
+ {...nativeProps}
35
+ editable={presentation.editable}
36
+ numberOfLines={presentation.numberOfLines}
37
+ onBlur={(event) => {
38
+ setFocused(false);
39
+ nativeProps.onBlur?.(event);
40
+ }}
41
+ onChangeText={(nextValue) => {
42
+ if (interactionPolicy !== 'passive') {
43
+ nativeProps.onChangeText?.(nextValue);
44
+ }
45
+ }}
46
+ onFocus={(event) => {
47
+ setFocused(true);
48
+ nativeProps.onFocus?.(event);
49
+ }}
50
+ placeholderTextColor={presentation.placeholderColor}
51
+ readOnly={readOnly}
52
+ style={[presentation.inputStyle, nativeProps.style]}
53
+ />
54
+ {renderAccessory(trailingAccessory, presentation.accessorySpacing, 'trailing')}
55
+ </View>
56
+ );
57
+ }
58
+
59
+ /*** Renders one optional TextInput accessory with directional spacing. */
60
+ function renderAccessory(
61
+ accessory: React.ReactNode,
62
+ spacing: number,
63
+ position: 'leading' | 'trailing',
64
+ ) {
65
+ if (!accessory) return null;
66
+ return <View style={resolveAccessoryStyle(spacing, position)}>{accessory}</View>;
67
+ }
68
+
69
+ /*** Resolves spacing around a leading or trailing TextInput accessory. */
70
+ function resolveAccessoryStyle(spacing: number, position: 'leading' | 'trailing'): ViewStyle {
71
+ return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };
72
+ }
@@ -0,0 +1,2 @@
1
+ export type { TextInputProps } from '../../../types/text-input';
2
+ export { TextInput } from './adapters/inbound/TextInput';
@@ -0,0 +1,91 @@
1
+ import type { TextStyle, ViewStyle } from 'react-native';
2
+
3
+ import {
4
+ resolveControlSize,
5
+ resolveFieldState,
6
+ resolveInputColors,
7
+ resolveTextStyles,
8
+ } from '../../../../internal/resolvers';
9
+ import type { SurfaceTheme } from '../../../../theme/types';
10
+ import type { TextInputProps } from '../../../../types/text-input';
11
+
12
+ /*** Resolves layout, colors, and editability for one TextInput state. */
13
+ export function resolveTextInputPresentation(
14
+ theme: SurfaceTheme,
15
+ props: TextInputProps,
16
+ focused: boolean,
17
+ ): TextInputPresentation {
18
+ const controlSize = resolveControlSize(theme, props.size ?? 'm');
19
+ const disabled = props.disabled ?? false;
20
+ const readOnly = props.readOnly ?? false;
21
+ const fieldState = resolveFieldState({
22
+ disabled,
23
+ focused,
24
+ invalid: props.invalid ?? false,
25
+ readOnly,
26
+ });
27
+ const colors = resolveInputColors(theme, fieldState);
28
+ const textStyle = resolveTextStyles(theme, { variant: controlSize.textVariant });
29
+ const heights = resolveTextInputHeights(
30
+ controlSize,
31
+ props.multiline,
32
+ props.numberOfLines,
33
+ textStyle.lineHeight,
34
+ );
35
+
36
+ return {
37
+ accessorySpacing: theme.spacing.s,
38
+ containerStyle: {
39
+ alignItems: props.multiline ? 'flex-start' : 'center',
40
+ backgroundColor: colors.backgroundColor,
41
+ borderColor: colors.borderColor,
42
+ borderRadius: controlSize.borderRadius,
43
+ borderWidth: 1,
44
+ flexDirection: 'row',
45
+ minHeight: heights.container,
46
+ opacity: colors.opacity,
47
+ paddingHorizontal: controlSize.paddingHorizontal,
48
+ paddingVertical: controlSize.paddingVertical,
49
+ },
50
+ editable: props.interactionPolicy === 'passive' ? false : !disabled && !readOnly,
51
+ inputStyle: {
52
+ color: colors.contentColor,
53
+ flex: 1,
54
+ minHeight: heights.input,
55
+ padding: 0,
56
+ textAlignVertical: props.multiline ? 'top' : 'center',
57
+ },
58
+ numberOfLines: props.multiline ? props.numberOfLines : 1,
59
+ placeholderColor: colors.placeholderColor,
60
+ };
61
+ }
62
+
63
+ /*** Resolves input and container heights from control typography and multiline state. */
64
+ function resolveTextInputHeights(
65
+ controlSize: ReturnType<typeof resolveControlSize>,
66
+ multiline: boolean | undefined,
67
+ numberOfLines: number | undefined,
68
+ lineHeight: TextStyle['lineHeight'],
69
+ ) {
70
+ const resolvedLineHeight =
71
+ typeof lineHeight === 'number'
72
+ ? lineHeight
73
+ : controlSize.minHeight - controlSize.paddingVertical * 2;
74
+ const lineCount = Math.max(numberOfLines ?? 1, 1);
75
+ const input = multiline
76
+ ? resolvedLineHeight * lineCount
77
+ : controlSize.minHeight - controlSize.paddingVertical * 2;
78
+ return {
79
+ input,
80
+ container: multiline ? input + controlSize.paddingVertical * 2 : controlSize.minHeight,
81
+ };
82
+ }
83
+
84
+ interface TextInputPresentation {
85
+ accessorySpacing: number;
86
+ containerStyle: ViewStyle;
87
+ editable: boolean;
88
+ inputStyle: TextStyle;
89
+ numberOfLines: number | undefined;
90
+ placeholderColor: string;
91
+ }
@@ -0,0 +1,14 @@
1
+ import { resolveToken } from '../../../../theme/resolveToken';
2
+ import { useTheme } from '../../../../theme/ThemeContext';
3
+ import type { IconProps } from '../../../../types/icon';
4
+ import { PortableIcon } from './PortableIcon';
5
+
6
+ /*** Renders a theme-aware font or SVG icon through the portable icon adapter. */
7
+ export function Icon(props: IconProps) {
8
+ const { theme } = useTheme();
9
+ const size = props.size ?? 'm';
10
+ const color = props.color ?? 'text';
11
+ const resolvedSize = typeof size === 'number' ? size : resolveToken(theme.spacing, size);
12
+ const resolvedColor = resolveToken(theme.colors, color);
13
+ return <PortableIcon {...props} color={resolvedColor} size={resolvedSize} />;
14
+ }
@@ -1,24 +1,8 @@
1
- import {
2
- FontAwesome,
3
- type FontAwesomeIconName,
4
- } from '@react-native-vector-icons/fontawesome/static';
5
- import {
6
- FontAwesome5,
7
- type FontAwesome5BrandIconName,
8
- type FontAwesome5RegularIconName,
9
- type FontAwesome5SolidIconName,
10
- } from '@react-native-vector-icons/fontawesome5/static';
11
- import {
12
- FontAwesome6,
13
- type FontAwesome6BrandIconName,
14
- type FontAwesome6RegularIconName,
15
- type FontAwesome6SolidIconName,
16
- } from '@react-native-vector-icons/fontawesome6/static';
17
- import { Ionicons, type IoniconsIconName } from '@react-native-vector-icons/ionicons/static';
18
- import {
19
- MaterialDesignIcons,
20
- type MaterialDesignIconsIconName,
21
- } from '@react-native-vector-icons/material-design-icons/static';
1
+ import { FontAwesome } from '@react-native-vector-icons/fontawesome/static';
2
+ import { FontAwesome5 } from '@react-native-vector-icons/fontawesome5/static';
3
+ import { FontAwesome6 } from '@react-native-vector-icons/fontawesome6/static';
4
+ import { Ionicons } from '@react-native-vector-icons/ionicons/static';
5
+ import { MaterialDesignIcons } from '@react-native-vector-icons/material-design-icons/static';
22
6
  import React from 'react';
23
7
  import {
24
8
  Image,
@@ -30,39 +14,38 @@ import {
30
14
  } from 'react-native';
31
15
  import { SvgUri } from 'react-native-svg';
32
16
 
33
- import type { SurfaceImageSource } from '../image';
17
+ import type { FontIconSource, IconSource, SvgIconSource } from '../../../../types/icon';
18
+ import type { SurfaceImageSource } from '../../../../types/image';
34
19
 
35
- export const SUPPORTED_ICON_PROVIDERS = [
36
- 'Ionicons',
37
- 'FontAwesome',
38
- 'FontAwesome5',
39
- 'FontAwesome6',
40
- 'MaterialDesignIcons',
41
- ] as const;
42
-
43
- export type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];
44
- export type IconVariant = 'regular' | 'solid' | 'brand';
20
+ /*** Renders a resolved portable icon using the configured font or SVG runtime. */
21
+ export function PortableIcon(props: PortableIconProps) {
22
+ if ('source' in props) return renderSvgIcon(props);
45
23
 
46
- export type FontIconSource =
47
- | { name: IoniconsIconName; provider?: 'Ionicons'; variant?: never }
48
- | { name: FontAwesomeIconName; provider: 'FontAwesome'; variant?: never }
49
- | { name: FontAwesome5RegularIconName; provider: 'FontAwesome5'; variant: 'regular' }
50
- | { name: FontAwesome5SolidIconName; provider: 'FontAwesome5'; variant: 'solid' }
51
- | { name: FontAwesome5BrandIconName; provider: 'FontAwesome5'; variant: 'brand' }
52
- | { name: FontAwesome6RegularIconName; provider: 'FontAwesome6'; variant: 'regular' }
53
- | { name: FontAwesome6SolidIconName; provider: 'FontAwesome6'; variant: 'solid' }
54
- | { name: FontAwesome6BrandIconName; provider: 'FontAwesome6'; variant: 'brand' }
55
- | { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };
24
+ const { provider } = props;
25
+ const sharedProps = {
26
+ color: props.color,
27
+ size: props.size,
28
+ style: props.style,
29
+ testID: props.testID,
30
+ };
56
31
 
57
- export interface SvgIconSource {
58
- source: SurfaceImageSource;
59
- name?: never;
60
- provider?: never;
61
- variant?: never;
32
+ switch (provider) {
33
+ case undefined:
34
+ case 'Ionicons':
35
+ return <Ionicons {...sharedProps} name={props.name} />;
36
+ case 'FontAwesome':
37
+ return <FontAwesome {...sharedProps} name={props.name} />;
38
+ case 'FontAwesome5':
39
+ return renderFontAwesome5(props, sharedProps);
40
+ case 'FontAwesome6':
41
+ return renderFontAwesome6(props, sharedProps);
42
+ case 'MaterialDesignIcons':
43
+ return <MaterialDesignIcons {...sharedProps} name={props.name} />;
44
+ default:
45
+ return assertNever(provider, 'provider');
46
+ }
62
47
  }
63
48
 
64
- export type IconSource = FontIconSource | SvgIconSource;
65
-
66
49
  interface PortableIconPresentationProps {
67
50
  color: string;
68
51
  size: number;
@@ -70,37 +53,25 @@ interface PortableIconPresentationProps {
70
53
  }
71
54
 
72
55
  type FontPortableIconProps = FontIconSource &
73
- PortableIconPresentationProps & {
74
- style?: StyleProp<TextStyle>;
75
- };
76
-
56
+ PortableIconPresentationProps & { style?: StyleProp<TextStyle> };
77
57
  type SvgPortableIconProps = SvgIconSource &
78
- PortableIconPresentationProps & {
79
- style?: StyleProp<ViewStyle>;
80
- };
81
-
58
+ PortableIconPresentationProps & { style?: StyleProp<ViewStyle> };
82
59
  type PortableIconProps = FontPortableIconProps | SvgPortableIconProps;
60
+ type SharedIconProps = PortableIconPresentationProps & { style?: StyleProp<TextStyle> };
83
61
 
84
- type SharedIconProps = PortableIconPresentationProps & {
85
- style?: StyleProp<TextStyle>;
86
- };
87
-
88
- const styles = StyleSheet.create({
89
- bundledSvgImage: { height: '100%', width: '100%' },
90
- });
62
+ const styles = StyleSheet.create({ bundledSvgImage: { height: '100%', width: '100%' } });
91
63
 
92
- /*** Resolve an SVG URI directly or through React Native's native bundled-asset API when available. */
64
+ /*** Resolves an SVG URI directly or through React Native's bundled-asset API. */
93
65
  function resolveSvgIconUri(source: SurfaceImageSource): string | null {
94
66
  if (typeof source === 'string') return source;
95
67
  if (!Array.isArray(source) && typeof source === 'object' && typeof source.uri === 'string') {
96
68
  return source.uri;
97
69
  }
98
70
  if (typeof Image.resolveAssetSource !== 'function') return null;
99
-
100
71
  return Image.resolveAssetSource(source).uri;
101
72
  }
102
73
 
103
- /*** Render URI-backed SVGs through SvgUri and let React Native Web resolve bundled numeric assets through Image. */
74
+ /*** Renders URI-backed SVGs and bundled SVG image assets. */
104
75
  function renderSvgIcon(props: SvgPortableIconProps) {
105
76
  const uri = resolveSvgIconUri(props.source);
106
77
  if (uri) {
@@ -124,10 +95,12 @@ function renderSvgIcon(props: SvgPortableIconProps) {
124
95
  );
125
96
  }
126
97
 
98
+ /*** Rejects unsupported icon configuration at runtime. */
127
99
  function assertNever(value: never, configuration: string): never {
128
100
  throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);
129
101
  }
130
102
 
103
+ /*** Renders one FontAwesome5 variant. */
131
104
  function renderFontAwesome5(
132
105
  props: Extract<IconSource, { provider: 'FontAwesome5' }>,
133
106
  sharedProps: SharedIconProps,
@@ -146,6 +119,7 @@ function renderFontAwesome5(
146
119
  }
147
120
  }
148
121
 
122
+ /*** Renders one FontAwesome6 variant. */
149
123
  function renderFontAwesome6(
150
124
  props: Extract<IconSource, { provider: 'FontAwesome6' }>,
151
125
  sharedProps: SharedIconProps,
@@ -163,33 +137,3 @@ function renderFontAwesome6(
163
137
  return assertNever(variant, 'FontAwesome6 variant');
164
138
  }
165
139
  }
166
-
167
- export function PortableIcon(props: PortableIconProps) {
168
- if ('source' in props) {
169
- return renderSvgIcon(props);
170
- }
171
-
172
- const { provider } = props;
173
- const sharedProps = {
174
- color: props.color,
175
- size: props.size,
176
- style: props.style,
177
- testID: props.testID,
178
- };
179
-
180
- switch (provider) {
181
- case undefined:
182
- case 'Ionicons':
183
- return <Ionicons {...sharedProps} name={props.name} />;
184
- case 'FontAwesome':
185
- return <FontAwesome {...sharedProps} name={props.name} />;
186
- case 'FontAwesome5':
187
- return renderFontAwesome5(props, sharedProps);
188
- case 'FontAwesome6':
189
- return renderFontAwesome6(props, sharedProps);
190
- case 'MaterialDesignIcons':
191
- return <MaterialDesignIcons {...sharedProps} name={props.name} />;
192
- default:
193
- return assertNever(provider, 'provider');
194
- }
195
- }
@@ -34,13 +34,13 @@ await mock.module('react-native-svg', () => ({
34
34
  }),
35
35
  }));
36
36
 
37
+ const { SUPPORTED_ICON_PROVIDERS } = await import('../../constants');
37
38
  const { Icon } = await import('./Icon');
38
- const { PortableIcon, SUPPORTED_ICON_PROVIDERS } = await import('./PortableIcon');
39
+ const { PortableIcon } = await import('./PortableIcon');
39
40
 
40
41
  describe('portable icon rendering', () => {
41
42
  test('renders Ionicons through the public Icon API', () => {
42
43
  const markup = renderToStaticMarkup(<Icon color="#123456" name="home-outline" size={18} />);
43
-
44
44
  expect(markup).toContain('font-family:Ionicons');
45
45
  });
46
46
 
@@ -48,7 +48,6 @@ describe('portable icon rendering', () => {
48
48
  const markup = renderToStaticMarkup(
49
49
  <Icon color="#123456" name="github" provider="FontAwesome" size={18} />,
50
50
  );
51
-
52
51
  expect(markup).toContain('font-family:FontAwesome');
53
52
  });
54
53
 
@@ -56,7 +55,6 @@ describe('portable icon rendering', () => {
56
55
  const markup = renderToStaticMarkup(
57
56
  <Icon color="#123456" name="microsoft" provider="FontAwesome5" size={18} variant="brand" />,
58
57
  );
59
-
60
58
  expect(markup).toContain('font-family:FontAwesome5Brands-Regular');
61
59
  });
62
60
 
@@ -64,7 +62,6 @@ describe('portable icon rendering', () => {
64
62
  const markup = renderToStaticMarkup(
65
63
  <Icon color="#123456" name="video" provider="FontAwesome5" size={18} variant="solid" />,
66
64
  );
67
-
68
65
  expect(markup).toContain('font-family:FontAwesome5Free-Solid');
69
66
  });
70
67
 
@@ -72,7 +69,6 @@ describe('portable icon rendering', () => {
72
69
  const markup = renderToStaticMarkup(
73
70
  <Icon color="#123456" name="x-twitter" provider="FontAwesome6" size={18} variant="brand" />,
74
71
  );
75
-
76
72
  expect(markup).toContain('font-family:FontAwesome6Brands-Regular');
77
73
  });
78
74
 
@@ -80,7 +76,6 @@ describe('portable icon rendering', () => {
80
76
  const markup = renderToStaticMarkup(
81
77
  <Icon color="#123456" name="bookshelf" provider="MaterialDesignIcons" size={18} />,
82
78
  );
83
-
84
79
  expect(markup).toContain('font-family:MaterialDesignIcons');
85
80
  });
86
81
 
@@ -88,7 +83,6 @@ describe('portable icon rendering', () => {
88
83
  const markup = renderToStaticMarkup(
89
84
  <Icon color="#123456" size={18} source="https://example.com/icons/home.svg" />,
90
85
  );
91
-
92
86
  expect(markup).toContain('data-uri="https://example.com/icons/home.svg"');
93
87
  expect(markup).toContain('data-color="#123456"');
94
88
  expect(markup).toContain('width="18"');
@@ -101,7 +95,6 @@ describe('portable icon web assets', () => {
101
95
  const markup = renderToStaticMarkup(
102
96
  <Icon color="#123456" size={18} source={42} testID="bundled-svg" />,
103
97
  );
104
-
105
98
  expect(markup).toContain('data-image-source="42"');
106
99
  expect(markup).toContain('data-testid="bundled-svg"');
107
100
  expect(markup).toContain('data-tint-color="#123456"');
@@ -162,7 +155,10 @@ describe('portable icon runtime rejection', () => {
162
155
 
163
156
  describe('portable icon dependency boundary', () => {
164
157
  test('has no Expo icon dependency or resolver path', () => {
165
- const packageSource = readFileSync(new URL('../../../package.json', import.meta.url), 'utf8');
158
+ const packageSource = readFileSync(
159
+ new URL('../../../../../package.json', import.meta.url),
160
+ 'utf8',
161
+ );
166
162
  const iconSource = readFileSync(new URL('./PortableIcon.tsx', import.meta.url), 'utf8');
167
163
 
168
164
  expect(packageSource).not.toContain('@expo/vector-icons');