@ankhorage/surface 4.1.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (574) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/components/field/Field.js +1 -1
  4. package/dist/components/field/Field.js.map +1 -1
  5. package/dist/components/helper-text/HelperText.js +1 -1
  6. package/dist/components/helper-text/HelperText.js.map +1 -1
  7. package/dist/components/label/Label.js +1 -1
  8. package/dist/components/label/Label.js.map +1 -1
  9. package/dist/components/list-item/ListItem.js +2 -2
  10. package/dist/components/list-item/ListItem.js.map +1 -1
  11. package/dist/components/menu/Menu.d.ts.map +1 -1
  12. package/dist/components/menu/Menu.js +4 -2
  13. package/dist/components/menu/Menu.js.map +1 -1
  14. package/dist/components/modal/Modal.d.ts.map +1 -1
  15. package/dist/components/modal/Modal.js +2 -1
  16. package/dist/components/modal/Modal.js.map +1 -1
  17. package/dist/components/switch/Switch.js +2 -2
  18. package/dist/components/switch/Switch.js.map +1 -1
  19. package/dist/components/tabs/Tab.js +2 -2
  20. package/dist/components/tabs/Tab.js.map +1 -1
  21. package/dist/components/tabs/TabList.js +1 -1
  22. package/dist/components/tabs/TabList.js.map +1 -1
  23. package/dist/components/tabs/Tabs.js +1 -1
  24. package/dist/components/tabs/Tabs.js.map +1 -1
  25. package/dist/components/textarea/Textarea.js +1 -1
  26. package/dist/components/textarea/Textarea.js.map +1 -1
  27. package/dist/components/textarea/types.d.ts +1 -1
  28. package/dist/components/textarea/types.d.ts.map +1 -1
  29. package/dist/components/textarea/types.js.map +1 -1
  30. package/dist/components/toast/Toast.d.ts.map +1 -1
  31. package/dist/components/toast/Toast.js +4 -2
  32. package/dist/components/toast/Toast.js.map +1 -1
  33. package/dist/components/toast/ToastProvider.js +1 -1
  34. package/dist/components/toast/ToastProvider.js.map +1 -1
  35. package/dist/components/tooltip/Tooltip.js +2 -2
  36. package/dist/components/tooltip/Tooltip.js.map +1 -1
  37. package/dist/examples/DocsExamples.js +6 -6
  38. package/dist/examples/DocsExamples.js.map +1 -1
  39. package/dist/features/badge/adapters/inbound/Badge.d.ts +5 -0
  40. package/dist/features/badge/adapters/inbound/Badge.d.ts.map +1 -0
  41. package/dist/features/badge/adapters/inbound/Badge.js +30 -0
  42. package/dist/features/badge/adapters/inbound/Badge.js.map +1 -0
  43. package/dist/features/badge/public.d.ts +3 -0
  44. package/dist/features/badge/public.d.ts.map +1 -0
  45. package/dist/features/badge/public.js +2 -0
  46. package/dist/features/badge/public.js.map +1 -0
  47. package/dist/{components/button → features/button/adapters/inbound}/Button.d.ts +2 -1
  48. package/dist/features/button/adapters/inbound/Button.d.ts.map +1 -0
  49. package/dist/features/button/adapters/inbound/Button.js +60 -0
  50. package/dist/features/button/adapters/inbound/Button.js.map +1 -0
  51. package/dist/{components/icon-button → features/button/adapters/inbound}/IconButton.d.ts +2 -1
  52. package/dist/features/button/adapters/inbound/IconButton.d.ts.map +1 -0
  53. package/dist/features/button/adapters/inbound/IconButton.js +33 -0
  54. package/dist/features/button/adapters/inbound/IconButton.js.map +1 -0
  55. package/dist/features/button/public.d.ts +4 -0
  56. package/dist/features/button/public.d.ts.map +1 -0
  57. package/dist/features/button/public.js +3 -0
  58. package/dist/features/button/public.js.map +1 -0
  59. package/dist/features/card/adapters/inbound/Card.d.ts +5 -0
  60. package/dist/features/card/adapters/inbound/Card.d.ts.map +1 -0
  61. package/dist/features/card/adapters/inbound/Card.js +44 -0
  62. package/dist/features/card/adapters/inbound/Card.js.map +1 -0
  63. package/dist/features/card/public.d.ts +3 -0
  64. package/dist/features/card/public.d.ts.map +1 -0
  65. package/dist/features/card/public.js +2 -0
  66. package/dist/features/card/public.js.map +1 -0
  67. package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts +5 -0
  68. package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts.map +1 -0
  69. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +88 -0
  70. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -0
  71. package/dist/features/form/checkbox/public.d.ts +3 -0
  72. package/dist/features/form/checkbox/public.d.ts.map +1 -0
  73. package/dist/features/form/checkbox/public.js +2 -0
  74. package/dist/features/form/checkbox/public.js.map +1 -0
  75. package/dist/features/form/radio/adapters/inbound/Radio.d.ts +5 -0
  76. package/dist/features/form/radio/adapters/inbound/Radio.d.ts.map +1 -0
  77. package/dist/features/form/radio/adapters/inbound/Radio.js +91 -0
  78. package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -0
  79. package/dist/features/form/radio/public.d.ts +3 -0
  80. package/dist/features/form/radio/public.d.ts.map +1 -0
  81. package/dist/features/form/radio/public.js +2 -0
  82. package/dist/features/form/radio/public.js.map +1 -0
  83. package/dist/features/form/radio/utils/isRadioTextContent.d.ts +4 -0
  84. package/dist/features/form/radio/utils/isRadioTextContent.d.ts.map +1 -0
  85. package/dist/features/form/radio/utils/isRadioTextContent.js +5 -0
  86. package/dist/features/form/radio/utils/isRadioTextContent.js.map +1 -0
  87. package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts +5 -0
  88. package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -0
  89. package/dist/features/form/text-input/adapters/inbound/TextInput.js +41 -0
  90. package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -0
  91. package/dist/features/form/text-input/public.d.ts +3 -0
  92. package/dist/features/form/text-input/public.d.ts.map +1 -0
  93. package/dist/features/form/text-input/public.js +2 -0
  94. package/dist/features/form/text-input/public.js.map +1 -0
  95. package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts +15 -0
  96. package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts.map +1 -0
  97. package/dist/features/form/text-input/utils/resolveTextInputPresentation.js +56 -0
  98. package/dist/features/form/text-input/utils/resolveTextInputPresentation.js.map +1 -0
  99. package/dist/features/icon/adapters/inbound/Icon.d.ts +4 -0
  100. package/dist/features/icon/adapters/inbound/Icon.d.ts.map +1 -0
  101. package/dist/{primitives/icon → features/icon/adapters/inbound}/Icon.js +3 -3
  102. package/dist/features/icon/adapters/inbound/Icon.js.map +1 -0
  103. package/dist/features/icon/adapters/inbound/PortableIcon.d.ts +19 -0
  104. package/dist/features/icon/adapters/inbound/PortableIcon.d.ts.map +1 -0
  105. package/dist/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.js +37 -43
  106. package/dist/features/icon/adapters/inbound/PortableIcon.js.map +1 -0
  107. package/dist/features/icon/constants.d.ts +2 -0
  108. package/dist/features/icon/constants.d.ts.map +1 -0
  109. package/dist/features/icon/constants.js +8 -0
  110. package/dist/features/icon/constants.js.map +1 -0
  111. package/dist/features/icon/public.d.ts +4 -0
  112. package/dist/features/icon/public.d.ts.map +1 -0
  113. package/dist/features/icon/public.js +3 -0
  114. package/dist/features/icon/public.js.map +1 -0
  115. package/dist/{primitives/image → features/image/adapters/inbound}/Image.d.ts +2 -1
  116. package/dist/features/image/adapters/inbound/Image.d.ts.map +1 -0
  117. package/dist/features/image/adapters/inbound/Image.js +28 -0
  118. package/dist/features/image/adapters/inbound/Image.js.map +1 -0
  119. package/dist/features/image/public.d.ts +3 -0
  120. package/dist/features/image/public.d.ts.map +1 -0
  121. package/dist/features/image/public.js +2 -0
  122. package/dist/features/image/public.js.map +1 -0
  123. package/dist/features/image/utils/getSourceKey.d.ts +4 -0
  124. package/dist/features/image/utils/getSourceKey.d.ts.map +1 -0
  125. package/dist/features/image/utils/getSourceKey.js +33 -0
  126. package/dist/features/image/utils/getSourceKey.js.map +1 -0
  127. package/dist/features/image/utils/normalizeSource.d.ts +5 -0
  128. package/dist/features/image/utils/normalizeSource.d.ts.map +1 -0
  129. package/dist/features/image/utils/normalizeSource.js +9 -0
  130. package/dist/features/image/utils/normalizeSource.js.map +1 -0
  131. package/dist/features/image/utils/resolveAccessibilityLabel.d.ts +4 -0
  132. package/dist/features/image/utils/resolveAccessibilityLabel.d.ts.map +1 -0
  133. package/dist/features/image/utils/resolveAccessibilityLabel.js +5 -0
  134. package/dist/features/image/utils/resolveAccessibilityLabel.js.map +1 -0
  135. package/dist/features/image/utils/resolveAlt.d.ts +4 -0
  136. package/dist/features/image/utils/resolveAlt.d.ts.map +1 -0
  137. package/dist/features/image/utils/resolveAlt.js +5 -0
  138. package/dist/features/image/utils/resolveAlt.js.map +1 -0
  139. package/dist/features/image/utils/resolveImageStyle.d.ts +6 -0
  140. package/dist/features/image/utils/resolveImageStyle.d.ts.map +1 -0
  141. package/dist/features/image/utils/resolveImageStyle.js +15 -0
  142. package/dist/features/image/utils/resolveImageStyle.js.map +1 -0
  143. package/dist/features/image/utils/resolveRenderedSource.d.ts +4 -0
  144. package/dist/features/image/utils/resolveRenderedSource.d.ts.map +1 -0
  145. package/dist/features/image/utils/resolveRenderedSource.js +7 -0
  146. package/dist/features/image/utils/resolveRenderedSource.js.map +1 -0
  147. package/dist/features/image/utils/resolveResizeMode.d.ts +5 -0
  148. package/dist/features/image/utils/resolveResizeMode.d.ts.map +1 -0
  149. package/dist/features/image/utils/resolveResizeMode.js +5 -0
  150. package/dist/features/image/utils/resolveResizeMode.js.map +1 -0
  151. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.d.ts +5 -0
  152. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.d.ts.map +1 -0
  153. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.js +7 -0
  154. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.js.map +1 -0
  155. package/dist/features/keyboard-avoiding-view/public.d.ts +3 -0
  156. package/dist/features/keyboard-avoiding-view/public.d.ts.map +1 -0
  157. package/dist/features/keyboard-avoiding-view/public.js +2 -0
  158. package/dist/features/keyboard-avoiding-view/public.js.map +1 -0
  159. package/dist/features/layout/adapters/inbound/Box.d.ts +5 -0
  160. package/dist/features/layout/adapters/inbound/Box.d.ts.map +1 -0
  161. package/dist/{layout → features/layout/adapters/inbound}/Box.js +5 -4
  162. package/dist/features/layout/adapters/inbound/Box.js.map +1 -0
  163. package/dist/features/layout/adapters/inbound/Container.d.ts +5 -0
  164. package/dist/features/layout/adapters/inbound/Container.d.ts.map +1 -0
  165. package/dist/features/layout/adapters/inbound/Container.js +28 -0
  166. package/dist/features/layout/adapters/inbound/Container.js.map +1 -0
  167. package/dist/features/layout/adapters/inbound/Divider.d.ts +5 -0
  168. package/dist/features/layout/adapters/inbound/Divider.d.ts.map +1 -0
  169. package/dist/{layout → features/layout/adapters/inbound}/Divider.js +1 -0
  170. package/dist/features/layout/adapters/inbound/Divider.js.map +1 -0
  171. package/dist/features/layout/adapters/inbound/Grid.d.ts +5 -0
  172. package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -0
  173. package/dist/features/layout/adapters/inbound/Grid.js +48 -0
  174. package/dist/features/layout/adapters/inbound/Grid.js.map +1 -0
  175. package/dist/features/layout/adapters/inbound/Stack.d.ts +5 -0
  176. package/dist/features/layout/adapters/inbound/Stack.d.ts.map +1 -0
  177. package/dist/{layout → features/layout/adapters/inbound}/Stack.js +4 -3
  178. package/dist/features/layout/adapters/inbound/Stack.js.map +1 -0
  179. package/dist/features/layout/public.d.ts +7 -0
  180. package/dist/features/layout/public.d.ts.map +1 -0
  181. package/dist/features/layout/public.js +6 -0
  182. package/dist/features/layout/public.js.map +1 -0
  183. package/dist/features/surface/adapters/inbound/Surface.d.ts +5 -0
  184. package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -0
  185. package/dist/{layout → features/surface/adapters/inbound}/Surface.js +17 -28
  186. package/dist/features/surface/adapters/inbound/Surface.js.map +1 -0
  187. package/dist/features/surface/public.d.ts +3 -0
  188. package/dist/features/surface/public.d.ts.map +1 -0
  189. package/dist/features/surface/public.js +2 -0
  190. package/dist/features/surface/public.js.map +1 -0
  191. package/dist/features/typography/adapters/inbound/Heading.d.ts +5 -0
  192. package/dist/features/typography/adapters/inbound/Heading.d.ts.map +1 -0
  193. package/dist/features/typography/adapters/inbound/Heading.js +29 -0
  194. package/dist/features/typography/adapters/inbound/Heading.js.map +1 -0
  195. package/dist/{primitives/text → features/typography/adapters/inbound}/Text.d.ts +2 -1
  196. package/dist/features/typography/adapters/inbound/Text.d.ts.map +1 -0
  197. package/dist/{primitives/text → features/typography/adapters/inbound}/Text.js +18 -25
  198. package/dist/features/typography/adapters/inbound/Text.js.map +1 -0
  199. package/dist/features/typography/public.d.ts +4 -0
  200. package/dist/features/typography/public.d.ts.map +1 -0
  201. package/dist/features/typography/public.js +3 -0
  202. package/dist/features/typography/public.js.map +1 -0
  203. package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts +7 -0
  204. package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts.map +1 -0
  205. package/dist/features/typography/utils/resolveHeadingTextStyle.js +10 -0
  206. package/dist/features/typography/utils/resolveHeadingTextStyle.js.map +1 -0
  207. package/dist/index.d.ts +24 -22
  208. package/dist/index.d.ts.map +1 -1
  209. package/dist/index.js +12 -11
  210. package/dist/index.js.map +1 -1
  211. package/dist/layout/AppBar.d.ts +1 -1
  212. package/dist/layout/AppBar.d.ts.map +1 -1
  213. package/dist/layout/AppBar.js +1 -2
  214. package/dist/layout/AppBar.js.map +1 -1
  215. package/dist/layout/Center.d.ts +1 -1
  216. package/dist/layout/Center.d.ts.map +1 -1
  217. package/dist/layout/Center.js +1 -1
  218. package/dist/layout/Center.js.map +1 -1
  219. package/dist/layout/Inline.d.ts +1 -1
  220. package/dist/layout/Inline.d.ts.map +1 -1
  221. package/dist/layout/Inline.js +1 -1
  222. package/dist/layout/Inline.js.map +1 -1
  223. package/dist/layout/ScrollArea.d.ts +1 -1
  224. package/dist/layout/ScrollArea.d.ts.map +1 -1
  225. package/dist/layout/ScrollArea.js +1 -1
  226. package/dist/layout/ScrollArea.js.map +1 -1
  227. package/dist/layout/Spacer.d.ts +1 -1
  228. package/dist/layout/Spacer.d.ts.map +1 -1
  229. package/dist/layout/Spacer.js +1 -1
  230. package/dist/layout/Spacer.js.map +1 -1
  231. package/dist/layout/Template.d.ts +2 -2
  232. package/dist/layout/Template.d.ts.map +1 -1
  233. package/dist/layout/Template.js +2 -2
  234. package/dist/layout/Template.js.map +1 -1
  235. package/dist/layout/index.d.ts +0 -12
  236. package/dist/layout/index.d.ts.map +1 -1
  237. package/dist/layout/index.js +0 -6
  238. package/dist/layout/index.js.map +1 -1
  239. package/dist/primitives/button-base/ButtonBase.js +1 -1
  240. package/dist/primitives/button-base/ButtonBase.js.map +1 -1
  241. package/dist/primitives/button-base/types.d.ts +1 -1
  242. package/dist/primitives/button-base/types.d.ts.map +1 -1
  243. package/dist/primitives/button-base/types.js.map +1 -1
  244. package/dist/types/badge.d.ts +12 -0
  245. package/dist/types/badge.d.ts.map +1 -0
  246. package/dist/types/badge.js +2 -0
  247. package/dist/types/badge.js.map +1 -0
  248. package/dist/types/button.d.ts +25 -0
  249. package/dist/types/button.d.ts.map +1 -0
  250. package/dist/types/button.js +2 -0
  251. package/dist/types/button.js.map +1 -0
  252. package/dist/{components/card/types.d.ts → types/card.d.ts} +2 -2
  253. package/dist/types/card.d.ts.map +1 -0
  254. package/dist/types/card.js +2 -0
  255. package/dist/types/card.js.map +1 -0
  256. package/dist/{components/checkbox/types.d.ts → types/checkbox.d.ts} +4 -4
  257. package/dist/types/checkbox.d.ts.map +1 -0
  258. package/dist/types/checkbox.js +2 -0
  259. package/dist/types/checkbox.js.map +1 -0
  260. package/dist/types/icon.d.ts +66 -0
  261. package/dist/types/icon.d.ts.map +1 -0
  262. package/dist/types/icon.js +2 -0
  263. package/dist/types/icon.js.map +1 -0
  264. package/dist/{primitives/image/types.d.ts → types/image.d.ts} +3 -4
  265. package/dist/types/image.d.ts.map +1 -0
  266. package/dist/types/image.js +2 -0
  267. package/dist/types/image.js.map +1 -0
  268. package/dist/types/keyboard-avoiding-view.d.ts +4 -0
  269. package/dist/types/keyboard-avoiding-view.d.ts.map +1 -0
  270. package/dist/types/keyboard-avoiding-view.js +2 -0
  271. package/dist/types/keyboard-avoiding-view.js.map +1 -0
  272. package/dist/{layout/helpers.d.ts → types/layout.d.ts} +39 -5
  273. package/dist/types/layout.d.ts.map +1 -0
  274. package/dist/types/layout.js +2 -0
  275. package/dist/types/layout.js.map +1 -0
  276. package/dist/{components/radio/types.d.ts → types/radio.d.ts} +4 -4
  277. package/dist/types/radio.d.ts.map +1 -0
  278. package/dist/types/radio.js +2 -0
  279. package/dist/types/radio.js.map +1 -0
  280. package/dist/types/surface.d.ts +6 -0
  281. package/dist/types/surface.d.ts.map +1 -0
  282. package/dist/types/surface.js +2 -0
  283. package/dist/types/surface.js.map +1 -0
  284. package/dist/{components/text-input/types.d.ts → types/text-input.d.ts} +3 -3
  285. package/dist/types/text-input.d.ts.map +1 -0
  286. package/dist/types/text-input.js +2 -0
  287. package/dist/types/text-input.js.map +1 -0
  288. package/dist/types/typography.d.ts +29 -0
  289. package/dist/types/typography.d.ts.map +1 -0
  290. package/dist/types/typography.js +2 -0
  291. package/dist/types/typography.js.map +1 -0
  292. package/dist/utils/resolveBoxStyles.d.ts +7 -0
  293. package/dist/utils/resolveBoxStyles.d.ts.map +1 -0
  294. package/dist/utils/resolveBoxStyles.js +83 -0
  295. package/dist/utils/resolveBoxStyles.js.map +1 -0
  296. package/dist/utils/resolveSpacing.d.ts +5 -0
  297. package/dist/utils/resolveSpacing.d.ts.map +1 -0
  298. package/dist/utils/resolveSpacing.js +6 -0
  299. package/dist/utils/resolveSpacing.js.map +1 -0
  300. package/package.json +1 -1
  301. package/src/components/field/Field.tsx +1 -1
  302. package/src/components/helper-text/HelperText.tsx +1 -1
  303. package/src/components/label/Label.tsx +1 -1
  304. package/src/components/list-item/ListItem.tsx +2 -2
  305. package/src/components/menu/Menu.tsx +4 -2
  306. package/src/components/modal/Modal.tsx +2 -1
  307. package/src/components/switch/Switch.tsx +2 -2
  308. package/src/components/tabs/Tab.tsx +2 -2
  309. package/src/components/tabs/TabList.tsx +1 -1
  310. package/src/components/tabs/Tabs.tsx +1 -1
  311. package/src/components/textarea/Textarea.tsx +1 -1
  312. package/src/components/textarea/types.ts +1 -1
  313. package/src/components/toast/Toast.tsx +4 -2
  314. package/src/components/toast/ToastProvider.tsx +1 -1
  315. package/src/components/tooltip/Tooltip.tsx +2 -2
  316. package/src/examples/DocsExamples.tsx +6 -6
  317. package/src/features/badge/adapters/inbound/Badge.tsx +58 -0
  318. package/src/features/badge/public.ts +2 -0
  319. package/src/features/button/adapters/inbound/Button.tsx +159 -0
  320. package/src/features/button/adapters/inbound/IconButton.tsx +69 -0
  321. package/src/features/button/public.ts +3 -0
  322. package/src/features/card/adapters/inbound/Card.tsx +88 -0
  323. package/src/features/card/public.ts +2 -0
  324. package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +207 -0
  325. package/src/features/form/checkbox/public.ts +2 -0
  326. package/src/{components/radio → features/form/radio/adapters/inbound}/Radio.test.ts +5 -5
  327. package/src/features/form/radio/adapters/inbound/Radio.tsx +214 -0
  328. package/src/features/form/radio/public.ts +2 -0
  329. package/src/{components/radio → features/form/radio/utils}/isRadioTextContent.ts +1 -3
  330. package/src/features/form/text-input/adapters/inbound/TextInput.tsx +72 -0
  331. package/src/features/form/text-input/public.ts +2 -0
  332. package/src/features/form/text-input/utils/resolveTextInputPresentation.ts +91 -0
  333. package/src/features/icon/adapters/inbound/Icon.tsx +14 -0
  334. package/src/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.tsx +41 -97
  335. package/src/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.web.test.tsx +6 -10
  336. package/src/features/icon/constants.ts +9 -0
  337. package/src/features/icon/public.ts +10 -0
  338. package/src/features/image/adapters/inbound/Image.tsx +55 -0
  339. package/src/features/image/public.ts +2 -0
  340. package/src/features/image/utils/getSourceKey.ts +32 -0
  341. package/src/features/image/utils/normalizeSource.ts +12 -0
  342. package/src/features/image/utils/resolveAccessibilityLabel.ts +9 -0
  343. package/src/features/image/utils/resolveAlt.ts +9 -0
  344. package/src/{primitives/image → features/image/utils}/resolveImageProps.test.ts +10 -22
  345. package/src/features/image/utils/resolveImageStyle.ts +23 -0
  346. package/src/features/image/utils/resolveRenderedSource.ts +11 -0
  347. package/src/features/image/utils/resolveResizeMode.ts +11 -0
  348. package/src/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.tsx +9 -0
  349. package/src/features/keyboard-avoiding-view/public.ts +5 -0
  350. package/src/{layout → features/layout/adapters/inbound}/Box.tsx +7 -15
  351. package/src/features/layout/adapters/inbound/Container.tsx +43 -0
  352. package/src/{layout → features/layout/adapters/inbound}/Divider.tsx +3 -8
  353. package/src/features/layout/adapters/inbound/Grid.tsx +78 -0
  354. package/src/{layout → features/layout/adapters/inbound}/Stack.test.ts +0 -1
  355. package/src/{layout → features/layout/adapters/inbound}/Stack.tsx +6 -15
  356. package/src/features/layout/public.ts +12 -0
  357. package/src/{layout → features/surface/adapters/inbound}/Surface.tsx +24 -41
  358. package/src/features/surface/public.ts +2 -0
  359. package/src/{primitives/heading → features/typography/adapters/inbound}/Heading.tsx +35 -38
  360. package/src/{primitives/text → features/typography/adapters/inbound}/Text.tsx +25 -35
  361. package/src/features/typography/public.ts +3 -0
  362. package/src/{primitives/heading/resolveHeadingStyle.test.ts → features/typography/utils/resolveHeadingTextStyle.test.ts} +5 -12
  363. package/src/features/typography/utils/resolveHeadingTextStyle.ts +21 -0
  364. package/src/index.test.ts +59 -19
  365. package/src/index.ts +37 -26
  366. package/src/layout/AppBar.tsx +1 -2
  367. package/src/layout/Center.tsx +1 -1
  368. package/src/layout/Inline.tsx +1 -1
  369. package/src/layout/ScrollArea.tsx +2 -1
  370. package/src/layout/Spacer.tsx +2 -2
  371. package/src/layout/Template.tsx +3 -2
  372. package/src/layout/index.ts +0 -12
  373. package/src/primitives/button-base/ButtonBase.tsx +1 -1
  374. package/src/primitives/button-base/types.ts +1 -1
  375. package/src/{components/badge/types.ts → types/badge.ts} +3 -3
  376. package/src/types/button.ts +34 -0
  377. package/src/{components/card/types.ts → types/card.ts} +1 -1
  378. package/src/{components/checkbox/types.ts → types/checkbox.ts} +3 -3
  379. package/src/types/icon.ts +52 -0
  380. package/src/{primitives/image/types.ts → types/image.ts} +3 -3
  381. package/src/types/keyboard-avoiding-view.ts +6 -0
  382. package/src/types/layout.ts +96 -0
  383. package/src/{components/radio/types.ts → types/radio.ts} +3 -3
  384. package/src/types/surface.ts +7 -0
  385. package/src/{components/text-input/types.ts → types/text-input.ts} +2 -2
  386. package/src/types/typography.ts +32 -0
  387. package/src/{layout/helpers.test.ts → utils/resolveBoxStyles.test.ts} +8 -25
  388. package/src/utils/resolveBoxStyles.ts +135 -0
  389. package/src/utils/resolveSpacing.ts +11 -0
  390. package/src/webAcceptance.test.tsx +18 -2
  391. package/dist/components/badge/Badge.d.ts +0 -4
  392. package/dist/components/badge/Badge.d.ts.map +0 -1
  393. package/dist/components/badge/Badge.js +0 -30
  394. package/dist/components/badge/Badge.js.map +0 -1
  395. package/dist/components/badge/index.d.ts +0 -3
  396. package/dist/components/badge/index.d.ts.map +0 -1
  397. package/dist/components/badge/index.js +0 -2
  398. package/dist/components/badge/index.js.map +0 -1
  399. package/dist/components/badge/types.d.ts +0 -12
  400. package/dist/components/badge/types.d.ts.map +0 -1
  401. package/dist/components/badge/types.js +0 -2
  402. package/dist/components/badge/types.js.map +0 -1
  403. package/dist/components/button/Button.d.ts.map +0 -1
  404. package/dist/components/button/Button.js +0 -51
  405. package/dist/components/button/Button.js.map +0 -1
  406. package/dist/components/button/index.d.ts +0 -3
  407. package/dist/components/button/index.d.ts.map +0 -1
  408. package/dist/components/button/index.js +0 -2
  409. package/dist/components/button/index.js.map +0 -1
  410. package/dist/components/button/types.d.ts +0 -18
  411. package/dist/components/button/types.d.ts.map +0 -1
  412. package/dist/components/button/types.js +0 -2
  413. package/dist/components/button/types.js.map +0 -1
  414. package/dist/components/card/Card.d.ts +0 -4
  415. package/dist/components/card/Card.d.ts.map +0 -1
  416. package/dist/components/card/Card.js +0 -46
  417. package/dist/components/card/Card.js.map +0 -1
  418. package/dist/components/card/index.d.ts +0 -3
  419. package/dist/components/card/index.d.ts.map +0 -1
  420. package/dist/components/card/index.js +0 -2
  421. package/dist/components/card/index.js.map +0 -1
  422. package/dist/components/card/types.d.ts.map +0 -1
  423. package/dist/components/card/types.js +0 -2
  424. package/dist/components/card/types.js.map +0 -1
  425. package/dist/components/checkbox/Checkbox.d.ts +0 -4
  426. package/dist/components/checkbox/Checkbox.d.ts.map +0 -1
  427. package/dist/components/checkbox/Checkbox.js +0 -69
  428. package/dist/components/checkbox/Checkbox.js.map +0 -1
  429. package/dist/components/checkbox/index.d.ts +0 -3
  430. package/dist/components/checkbox/index.d.ts.map +0 -1
  431. package/dist/components/checkbox/index.js +0 -2
  432. package/dist/components/checkbox/index.js.map +0 -1
  433. package/dist/components/checkbox/types.d.ts.map +0 -1
  434. package/dist/components/checkbox/types.js +0 -2
  435. package/dist/components/checkbox/types.js.map +0 -1
  436. package/dist/components/icon-button/IconButton.d.ts.map +0 -1
  437. package/dist/components/icon-button/IconButton.js +0 -28
  438. package/dist/components/icon-button/IconButton.js.map +0 -1
  439. package/dist/components/icon-button/index.d.ts +0 -3
  440. package/dist/components/icon-button/index.d.ts.map +0 -1
  441. package/dist/components/icon-button/index.js +0 -2
  442. package/dist/components/icon-button/index.js.map +0 -1
  443. package/dist/components/icon-button/types.d.ts +0 -13
  444. package/dist/components/icon-button/types.d.ts.map +0 -1
  445. package/dist/components/icon-button/types.js +0 -2
  446. package/dist/components/icon-button/types.js.map +0 -1
  447. package/dist/components/radio/Radio.d.ts +0 -7
  448. package/dist/components/radio/Radio.d.ts.map +0 -1
  449. package/dist/components/radio/Radio.js +0 -75
  450. package/dist/components/radio/Radio.js.map +0 -1
  451. package/dist/components/radio/index.d.ts +0 -3
  452. package/dist/components/radio/index.d.ts.map +0 -1
  453. package/dist/components/radio/index.js +0 -2
  454. package/dist/components/radio/index.js.map +0 -1
  455. package/dist/components/radio/isRadioTextContent.d.ts +0 -6
  456. package/dist/components/radio/isRadioTextContent.d.ts.map +0 -1
  457. package/dist/components/radio/isRadioTextContent.js +0 -7
  458. package/dist/components/radio/isRadioTextContent.js.map +0 -1
  459. package/dist/components/radio/types.d.ts.map +0 -1
  460. package/dist/components/radio/types.js +0 -2
  461. package/dist/components/radio/types.js.map +0 -1
  462. package/dist/components/text-input/TextInput.d.ts +0 -4
  463. package/dist/components/text-input/TextInput.d.ts.map +0 -1
  464. package/dist/components/text-input/TextInput.js +0 -72
  465. package/dist/components/text-input/TextInput.js.map +0 -1
  466. package/dist/components/text-input/index.d.ts +0 -3
  467. package/dist/components/text-input/index.d.ts.map +0 -1
  468. package/dist/components/text-input/index.js +0 -2
  469. package/dist/components/text-input/index.js.map +0 -1
  470. package/dist/components/text-input/types.d.ts.map +0 -1
  471. package/dist/components/text-input/types.js +0 -2
  472. package/dist/components/text-input/types.js.map +0 -1
  473. package/dist/layout/Box.d.ts +0 -14
  474. package/dist/layout/Box.d.ts.map +0 -1
  475. package/dist/layout/Box.js.map +0 -1
  476. package/dist/layout/Container.d.ts +0 -11
  477. package/dist/layout/Container.d.ts.map +0 -1
  478. package/dist/layout/Container.js +0 -24
  479. package/dist/layout/Container.js.map +0 -1
  480. package/dist/layout/Divider.d.ts +0 -10
  481. package/dist/layout/Divider.d.ts.map +0 -1
  482. package/dist/layout/Divider.js.map +0 -1
  483. package/dist/layout/Grid.d.ts +0 -14
  484. package/dist/layout/Grid.d.ts.map +0 -1
  485. package/dist/layout/Grid.js +0 -51
  486. package/dist/layout/Grid.js.map +0 -1
  487. package/dist/layout/Stack.d.ts +0 -14
  488. package/dist/layout/Stack.d.ts.map +0 -1
  489. package/dist/layout/Stack.js.map +0 -1
  490. package/dist/layout/Surface.d.ts +0 -8
  491. package/dist/layout/Surface.d.ts.map +0 -1
  492. package/dist/layout/Surface.js.map +0 -1
  493. package/dist/layout/helpers.d.ts.map +0 -1
  494. package/dist/layout/helpers.js +0 -91
  495. package/dist/layout/helpers.js.map +0 -1
  496. package/dist/primitives/heading/Heading.d.ts +0 -4
  497. package/dist/primitives/heading/Heading.d.ts.map +0 -1
  498. package/dist/primitives/heading/Heading.js +0 -30
  499. package/dist/primitives/heading/Heading.js.map +0 -1
  500. package/dist/primitives/heading/index.d.ts +0 -3
  501. package/dist/primitives/heading/index.d.ts.map +0 -1
  502. package/dist/primitives/heading/index.js +0 -2
  503. package/dist/primitives/heading/index.js.map +0 -1
  504. package/dist/primitives/heading/resolveHeadingStyle.d.ts +0 -6
  505. package/dist/primitives/heading/resolveHeadingStyle.d.ts.map +0 -1
  506. package/dist/primitives/heading/resolveHeadingStyle.js +0 -9
  507. package/dist/primitives/heading/resolveHeadingStyle.js.map +0 -1
  508. package/dist/primitives/heading/types.d.ts +0 -15
  509. package/dist/primitives/heading/types.d.ts.map +0 -1
  510. package/dist/primitives/heading/types.js +0 -2
  511. package/dist/primitives/heading/types.js.map +0 -1
  512. package/dist/primitives/icon/Icon.d.ts +0 -16
  513. package/dist/primitives/icon/Icon.d.ts.map +0 -1
  514. package/dist/primitives/icon/Icon.js.map +0 -1
  515. package/dist/primitives/icon/PortableIcon.d.ts +0 -70
  516. package/dist/primitives/icon/PortableIcon.d.ts.map +0 -1
  517. package/dist/primitives/icon/PortableIcon.js.map +0 -1
  518. package/dist/primitives/icon/index.d.ts +0 -4
  519. package/dist/primitives/icon/index.d.ts.map +0 -1
  520. package/dist/primitives/icon/index.js +0 -3
  521. package/dist/primitives/icon/index.js.map +0 -1
  522. package/dist/primitives/image/Image.d.ts.map +0 -1
  523. package/dist/primitives/image/Image.js +0 -26
  524. package/dist/primitives/image/Image.js.map +0 -1
  525. package/dist/primitives/image/index.d.ts +0 -3
  526. package/dist/primitives/image/index.d.ts.map +0 -1
  527. package/dist/primitives/image/index.js +0 -2
  528. package/dist/primitives/image/index.js.map +0 -1
  529. package/dist/primitives/image/resolveImageProps.d.ts +0 -12
  530. package/dist/primitives/image/resolveImageProps.d.ts.map +0 -1
  531. package/dist/primitives/image/resolveImageProps.js +0 -67
  532. package/dist/primitives/image/resolveImageProps.js.map +0 -1
  533. package/dist/primitives/image/types.d.ts.map +0 -1
  534. package/dist/primitives/image/types.js +0 -2
  535. package/dist/primitives/image/types.js.map +0 -1
  536. package/dist/primitives/text/Text.d.ts.map +0 -1
  537. package/dist/primitives/text/Text.js.map +0 -1
  538. package/dist/primitives/text/index.d.ts +0 -3
  539. package/dist/primitives/text/index.d.ts.map +0 -1
  540. package/dist/primitives/text/index.js +0 -2
  541. package/dist/primitives/text/index.js.map +0 -1
  542. package/dist/primitives/text/types.d.ts +0 -17
  543. package/dist/primitives/text/types.d.ts.map +0 -1
  544. package/dist/primitives/text/types.js +0 -2
  545. package/dist/primitives/text/types.js.map +0 -1
  546. package/src/components/badge/Badge.tsx +0 -52
  547. package/src/components/badge/index.ts +0 -2
  548. package/src/components/button/Button.tsx +0 -98
  549. package/src/components/button/index.ts +0 -2
  550. package/src/components/button/types.ts +0 -23
  551. package/src/components/card/Card.tsx +0 -81
  552. package/src/components/card/index.ts +0 -2
  553. package/src/components/checkbox/Checkbox.tsx +0 -120
  554. package/src/components/checkbox/index.ts +0 -2
  555. package/src/components/icon-button/IconButton.tsx +0 -55
  556. package/src/components/icon-button/index.ts +0 -2
  557. package/src/components/icon-button/types.ts +0 -16
  558. package/src/components/radio/Radio.tsx +0 -124
  559. package/src/components/radio/index.ts +0 -2
  560. package/src/components/text-input/TextInput.tsx +0 -124
  561. package/src/components/text-input/index.ts +0 -2
  562. package/src/layout/Container.tsx +0 -43
  563. package/src/layout/Grid.tsx +0 -83
  564. package/src/layout/helpers.ts +0 -205
  565. package/src/primitives/heading/index.ts +0 -2
  566. package/src/primitives/heading/resolveHeadingStyle.ts +0 -20
  567. package/src/primitives/heading/types.ts +0 -17
  568. package/src/primitives/icon/Icon.tsx +0 -34
  569. package/src/primitives/icon/index.ts +0 -10
  570. package/src/primitives/image/Image.tsx +0 -65
  571. package/src/primitives/image/index.ts +0 -2
  572. package/src/primitives/image/resolveImageProps.ts +0 -92
  573. package/src/primitives/text/index.ts +0 -2
  574. package/src/primitives/text/types.ts +0 -18
@@ -0,0 +1,52 @@
1
+ import type { FontAwesomeIconName } from '@react-native-vector-icons/fontawesome/static';
2
+ import type {
3
+ FontAwesome5BrandIconName,
4
+ FontAwesome5RegularIconName,
5
+ FontAwesome5SolidIconName,
6
+ } from '@react-native-vector-icons/fontawesome5/static';
7
+ import type {
8
+ FontAwesome6BrandIconName,
9
+ FontAwesome6RegularIconName,
10
+ FontAwesome6SolidIconName,
11
+ } from '@react-native-vector-icons/fontawesome6/static';
12
+ import type { IoniconsIconName } from '@react-native-vector-icons/ionicons/static';
13
+ import type { MaterialDesignIconsIconName } from '@react-native-vector-icons/material-design-icons/static';
14
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
15
+
16
+ import type { SurfaceTheme } from '../theme/types';
17
+ import type { SurfaceImageSource } from './image';
18
+
19
+ export type IconProvider =
20
+ 'Ionicons' | 'FontAwesome' | 'FontAwesome5' | 'FontAwesome6' | 'MaterialDesignIcons';
21
+
22
+ export type IconVariant = 'regular' | 'solid' | 'brand';
23
+
24
+ export type FontIconSource =
25
+ | { name: IoniconsIconName; provider?: 'Ionicons'; variant?: never }
26
+ | { name: FontAwesomeIconName; provider: 'FontAwesome'; variant?: never }
27
+ | { name: FontAwesome5RegularIconName; provider: 'FontAwesome5'; variant: 'regular' }
28
+ | { name: FontAwesome5SolidIconName; provider: 'FontAwesome5'; variant: 'solid' }
29
+ | { name: FontAwesome5BrandIconName; provider: 'FontAwesome5'; variant: 'brand' }
30
+ | { name: FontAwesome6RegularIconName; provider: 'FontAwesome6'; variant: 'regular' }
31
+ | { name: FontAwesome6SolidIconName; provider: 'FontAwesome6'; variant: 'solid' }
32
+ | { name: FontAwesome6BrandIconName; provider: 'FontAwesome6'; variant: 'brand' }
33
+ | { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };
34
+
35
+ export interface SvgIconSource {
36
+ source: SurfaceImageSource;
37
+ name?: never;
38
+ provider?: never;
39
+ variant?: never;
40
+ }
41
+
42
+ export type IconSource = FontIconSource | SvgIconSource;
43
+
44
+ interface IconPresentationProps {
45
+ size?: keyof SurfaceTheme['spacing'] | number;
46
+ color?: keyof SurfaceTheme['colors'] | string;
47
+ testID?: string;
48
+ }
49
+
50
+ export type IconProps =
51
+ | (FontIconSource & IconPresentationProps & { style?: StyleProp<TextStyle> })
52
+ | (SvgIconSource & IconPresentationProps & { style?: StyleProp<ViewStyle> });
@@ -2,13 +2,13 @@ import type {
2
2
  ImageProps as ReactNativeImageProps,
3
3
  ImageResizeMode,
4
4
  ImageSourcePropType,
5
+ ImageStyle,
6
+ StyleProp,
5
7
  } from 'react-native';
6
- import type { ImageStyle, StyleProp } from 'react-native';
7
8
 
8
- import type { SurfaceTheme } from '../../theme/types';
9
+ import type { SurfaceTheme } from '../theme/types';
9
10
 
10
11
  export type SurfaceImageSource = string | ImageSourcePropType;
11
-
12
12
  export type ImageFit = ImageResizeMode;
13
13
 
14
14
  export interface ImageProps {
@@ -0,0 +1,6 @@
1
+ import type { KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps } from 'react-native';
2
+
3
+ export type KeyboardAvoidingViewBehavior = NonNullable<
4
+ ReactNativeKeyboardAvoidingViewProps['behavior']
5
+ >;
6
+ export type KeyboardAvoidingViewProps = ReactNativeKeyboardAvoidingViewProps;
@@ -0,0 +1,96 @@
1
+ import type React from 'react';
2
+ import type { StyleProp, ViewProps as ReactNativeViewProps, ViewStyle } from 'react-native';
3
+
4
+ import type { Responsive } from '../core/responsive';
5
+ import type { SurfaceTheme } from '../theme/types';
6
+
7
+ type SpaceToken = keyof SurfaceTheme['spacing'];
8
+ type RadiusToken = keyof SurfaceTheme['radii'];
9
+ type ColorToken = keyof SurfaceTheme['colors'];
10
+ type RadiusValue = number | RadiusToken;
11
+
12
+ export type SpaceValue = number | SpaceToken;
13
+ export type ColorValue = string | ColorToken;
14
+
15
+ export interface BoxStyleProps {
16
+ p?: Responsive<SpaceValue>;
17
+ px?: Responsive<SpaceValue>;
18
+ py?: Responsive<SpaceValue>;
19
+ pt?: Responsive<SpaceValue>;
20
+ pb?: Responsive<SpaceValue>;
21
+ pl?: Responsive<SpaceValue>;
22
+ pr?: Responsive<SpaceValue>;
23
+ m?: Responsive<SpaceValue>;
24
+ mx?: Responsive<SpaceValue>;
25
+ my?: Responsive<SpaceValue>;
26
+ mt?: Responsive<SpaceValue>;
27
+ mb?: Responsive<SpaceValue>;
28
+ ml?: Responsive<SpaceValue>;
29
+ mr?: Responsive<SpaceValue>;
30
+ bg?: Responsive<ColorValue>;
31
+ radius?: Responsive<RadiusValue>;
32
+ borderWidth?: Responsive<number>;
33
+ borderColor?: Responsive<ColorValue>;
34
+ width?: Responsive<number | string>;
35
+ height?: Responsive<number | string>;
36
+ minWidth?: Responsive<number | string>;
37
+ maxWidth?: Responsive<number | string>;
38
+ minHeight?: Responsive<number | string>;
39
+ maxHeight?: Responsive<number | string>;
40
+ flex?: Responsive<number>;
41
+ flexGrow?: Responsive<number>;
42
+ flexShrink?: Responsive<number>;
43
+ flexBasis?: Responsive<number | string>;
44
+ alignSelf?: Responsive<ViewStyle['alignSelf']>;
45
+ position?: Responsive<ViewStyle['position']>;
46
+ top?: Responsive<number>;
47
+ bottom?: Responsive<number>;
48
+ left?: Responsive<number>;
49
+ right?: Responsive<number>;
50
+ overflow?: Responsive<ViewStyle['overflow']>;
51
+ zIndex?: Responsive<number>;
52
+ opacity?: Responsive<number>;
53
+ style?: StyleProp<ViewStyle>;
54
+ }
55
+
56
+ export interface BoxProps extends BoxStyleProps {
57
+ accessibilityLabel?: ReactNativeViewProps['accessibilityLabel'];
58
+ accessibilityRole?: ReactNativeViewProps['accessibilityRole'];
59
+ accessibilityState?: ReactNativeViewProps['accessibilityState'];
60
+ accessible?: ReactNativeViewProps['accessible'];
61
+ children?: React.ReactNode;
62
+ pointerEvents?: ReactNativeViewProps['pointerEvents'];
63
+ testID?: string;
64
+ }
65
+
66
+ export interface ContainerProps extends Omit<BoxProps, 'children'> {
67
+ children?: React.ReactNode;
68
+ maxWidth?: Responsive<number>;
69
+ px?: Responsive<number | keyof SurfaceTheme['spacing']>;
70
+ }
71
+
72
+ export interface DividerProps extends Omit<BoxProps, 'bg' | 'height' | 'width'> {
73
+ orientation?: 'horizontal' | 'vertical';
74
+ color?: ColorValue;
75
+ thickness?: number;
76
+ }
77
+
78
+ export interface GridProps extends Omit<BoxProps, 'children'> {
79
+ children?: React.ReactNode;
80
+ cols: Responsive<number>;
81
+ gap?: Responsive<SpaceValue>;
82
+ rowGap?: Responsive<SpaceValue>;
83
+ colGap?: Responsive<SpaceValue>;
84
+ minItemWidth?: Responsive<number>;
85
+ }
86
+
87
+ export interface StackProps extends Omit<BoxProps, 'children'> {
88
+ children?: React.ReactNode;
89
+ direction?: Responsive<'row' | 'column'>;
90
+ gap?: Responsive<SpaceValue>;
91
+ align?: Responsive<'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'>;
92
+ justify?: Responsive<
93
+ 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'
94
+ >;
95
+ wrap?: Responsive<'nowrap' | 'wrap'>;
96
+ }
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
2
 
3
- import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
4
- import type { ButtonBaseProps } from '../../primitives/button-base';
5
- import type { SurfaceColor } from '../../surfaceColor';
3
+ import type { ControlSize } from '../internal/resolvers/resolveControlSize';
4
+ import type { ButtonBaseProps } from '../primitives/button-base';
5
+ import type { SurfaceColor } from '../surfaceColor';
6
6
 
7
7
  export interface RadioProps extends Omit<
8
8
  ButtonBaseProps,
@@ -0,0 +1,7 @@
1
+ import type { BoxProps } from './layout';
2
+
3
+ export type SurfaceVariant = 'default' | 'subtle' | 'raised' | 'outline';
4
+
5
+ export interface SurfaceProps extends Omit<BoxProps, 'bg' | 'borderColor' | 'borderWidth'> {
6
+ variant?: SurfaceVariant;
7
+ }
@@ -5,8 +5,8 @@ import type {
5
5
  TextStyle,
6
6
  } from 'react-native';
7
7
 
8
- import type { InteractionPolicy } from '../../interactionPolicy';
9
- import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
8
+ import type { InteractionPolicy } from '../interactionPolicy';
9
+ import type { ControlSize } from '../internal/resolvers/resolveControlSize';
10
10
 
11
11
  export interface TextInputProps extends Omit<
12
12
  ReactNativeTextInputProps,
@@ -0,0 +1,32 @@
1
+ import type React from 'react';
2
+ import type { TextStyle } from 'react-native';
3
+
4
+ import type { TextVariant, TextWeight } from '../internal/resolvers/resolveTextStyles';
5
+ import type { SurfaceColor, SurfaceEmphasis } from '../surfaceColor';
6
+
7
+ export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
8
+
9
+ export interface HeadingProps {
10
+ text?: string;
11
+ children?: React.ReactNode;
12
+ level?: HeadingLevel;
13
+ align?: 'auto' | 'left' | 'right' | 'center' | 'justify';
14
+ color?: SurfaceColor;
15
+ emphasis?: SurfaceEmphasis;
16
+ numberOfLines?: number;
17
+ i18nKey?: string;
18
+ testID?: string;
19
+ }
20
+
21
+ export interface TextProps {
22
+ children?: React.ReactNode;
23
+ i18nKey?: string;
24
+ variant?: TextVariant;
25
+ emphasis?: SurfaceEmphasis;
26
+ color?: SurfaceColor;
27
+ align?: TextStyle['textAlign'];
28
+ weight?: TextWeight;
29
+ italic?: boolean;
30
+ numberOfLines?: number;
31
+ testID?: string;
32
+ }
@@ -1,41 +1,25 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
2
 
3
3
  import type { SurfaceTheme } from '../theme/types';
4
- import { resolveBoxStyles } from './helpers';
4
+ import { resolveBoxStyles } from './resolveBoxStyles';
5
5
 
6
6
  const mockTheme = {
7
- spacing: {
8
- s: 4,
9
- m: 8,
10
- l: 16,
11
- },
12
- radii: {
13
- m: 8,
14
- },
15
- colors: {
16
- primary: '#007AFF',
17
- surface: '#FFFFFF',
18
- },
7
+ spacing: { s: 4, m: 8, l: 16 },
8
+ radii: { m: 8 },
9
+ colors: { primary: '#007AFF', surface: '#FFFFFF' },
19
10
  } as unknown as SurfaceTheme;
20
11
 
21
12
  describe('resolveBoxStyles', () => {
22
13
  test('resolves padding and margins correctly', () => {
23
- const styles = resolveBoxStyles(mockTheme, 'base', {
24
- p: 's',
25
- m: 8,
26
- });
14
+ const styles = resolveBoxStyles(mockTheme, 'base', { p: 's', m: 8 });
27
15
  expect(styles.padding).toBe(4);
28
16
  expect(styles.margin).toBe(8);
29
17
  });
30
18
 
31
19
  test('resolves responsive properties', () => {
32
- const props = {
33
- p: { base: 's', lg: 'l' },
34
- };
35
- const baseStyles = resolveBoxStyles(mockTheme, 'base', props);
36
- const lgStyles = resolveBoxStyles(mockTheme, 'lg', props);
37
- expect(baseStyles.padding).toBe(4);
38
- expect(lgStyles.padding).toBe(16);
20
+ const props = { p: { base: 's', lg: 'l' } } as const;
21
+ expect(resolveBoxStyles(mockTheme, 'base', props).padding).toBe(4);
22
+ expect(resolveBoxStyles(mockTheme, 'lg', props).padding).toBe(16);
39
23
  });
40
24
 
41
25
  test('resolves colors and border styles', () => {
@@ -57,7 +41,6 @@ describe('resolveBoxStyles', () => {
57
41
  minHeight: 'l',
58
42
  maxWidth: '50%',
59
43
  });
60
-
61
44
  expect(styles.width).toBe(8);
62
45
  expect(styles.minHeight).toBe(16);
63
46
  expect(styles.maxWidth).toBe('50%');
@@ -0,0 +1,135 @@
1
+ import type { ViewStyle } from 'react-native';
2
+
3
+ import { resolveResponsive } from '../core/responsive/resolve';
4
+ import type { Breakpoint } from '../core/responsive/types';
5
+ import { resolveToken } from '../theme/resolveToken';
6
+ import type { SurfaceTheme } from '../theme/types';
7
+ import type { BoxStyleProps, ColorValue } from '../types/layout';
8
+ import { resolveSpacing } from './resolveSpacing';
9
+
10
+ /*** Resolves responsive Box style props into one React Native view style. */
11
+ export function resolveBoxStyles(
12
+ theme: SurfaceTheme,
13
+ breakpoint: Breakpoint,
14
+ props: BoxStyleProps,
15
+ ): ViewStyle {
16
+ return {
17
+ elevation: 0,
18
+ ...resolveSpacingStyles(theme, breakpoint, props),
19
+ ...resolveVisualStyles(theme, breakpoint, props),
20
+ ...resolveDimensionStyles(theme, breakpoint, props),
21
+ ...resolveLayoutStyles(breakpoint, props),
22
+ };
23
+ }
24
+
25
+ /*** Resolves padding and margin styles from responsive spacing props. */
26
+ function resolveSpacingStyles(
27
+ theme: SurfaceTheme,
28
+ breakpoint: Breakpoint,
29
+ props: BoxStyleProps,
30
+ ): ViewStyle {
31
+ return {
32
+ padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),
33
+ paddingHorizontal: resolveSpacing(theme, resolveResponsive(props.px, breakpoint)),
34
+ paddingVertical: resolveSpacing(theme, resolveResponsive(props.py, breakpoint)),
35
+ paddingTop: resolveSpacing(theme, resolveResponsive(props.pt, breakpoint)),
36
+ paddingBottom: resolveSpacing(theme, resolveResponsive(props.pb, breakpoint)),
37
+ paddingLeft: resolveSpacing(theme, resolveResponsive(props.pl, breakpoint)),
38
+ paddingRight: resolveSpacing(theme, resolveResponsive(props.pr, breakpoint)),
39
+ margin: resolveSpacing(theme, resolveResponsive(props.m, breakpoint)),
40
+ marginHorizontal: resolveSpacing(theme, resolveResponsive(props.mx, breakpoint)),
41
+ marginVertical: resolveSpacing(theme, resolveResponsive(props.my, breakpoint)),
42
+ marginTop: resolveSpacing(theme, resolveResponsive(props.mt, breakpoint)),
43
+ marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),
44
+ marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),
45
+ marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),
46
+ };
47
+ }
48
+
49
+ /*** Resolves background, radius, and border styles. */
50
+ function resolveVisualStyles(
51
+ theme: SurfaceTheme,
52
+ breakpoint: Breakpoint,
53
+ props: BoxStyleProps,
54
+ ): ViewStyle {
55
+ return {
56
+ backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),
57
+ borderRadius: resolveRadius(theme, resolveResponsive(props.radius, breakpoint)),
58
+ borderWidth: resolveResponsive(props.borderWidth, breakpoint),
59
+ borderColor: resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),
60
+ };
61
+ }
62
+
63
+ /*** Resolves responsive dimension props through spacing tokens. */
64
+ function resolveDimensionStyles(
65
+ theme: SurfaceTheme,
66
+ breakpoint: Breakpoint,
67
+ props: BoxStyleProps,
68
+ ): ViewStyle {
69
+ return {
70
+ width: resolveDimension(
71
+ theme,
72
+ resolveResponsive(props.width, breakpoint),
73
+ ) as ViewStyle['width'],
74
+ height: resolveDimension(
75
+ theme,
76
+ resolveResponsive(props.height, breakpoint),
77
+ ) as ViewStyle['height'],
78
+ minWidth: resolveDimension(
79
+ theme,
80
+ resolveResponsive(props.minWidth, breakpoint),
81
+ ) as ViewStyle['minWidth'],
82
+ maxWidth: resolveDimension(
83
+ theme,
84
+ resolveResponsive(props.maxWidth, breakpoint),
85
+ ) as ViewStyle['maxWidth'],
86
+ minHeight: resolveDimension(
87
+ theme,
88
+ resolveResponsive(props.minHeight, breakpoint),
89
+ ) as ViewStyle['minHeight'],
90
+ maxHeight: resolveDimension(
91
+ theme,
92
+ resolveResponsive(props.maxHeight, breakpoint),
93
+ ) as ViewStyle['maxHeight'],
94
+ };
95
+ }
96
+
97
+ /*** Resolves responsive flex, positioning, and visibility styles. */
98
+ function resolveLayoutStyles(breakpoint: Breakpoint, props: BoxStyleProps): ViewStyle {
99
+ return {
100
+ flex: resolveResponsive(props.flex, breakpoint),
101
+ flexGrow: resolveResponsive(props.flexGrow, breakpoint),
102
+ flexShrink: resolveResponsive(props.flexShrink, breakpoint),
103
+ flexBasis: resolveResponsive(props.flexBasis, breakpoint) as ViewStyle['flexBasis'],
104
+ alignSelf: resolveResponsive(props.alignSelf, breakpoint),
105
+ position: resolveResponsive(props.position, breakpoint),
106
+ top: resolveResponsive(props.top, breakpoint),
107
+ bottom: resolveResponsive(props.bottom, breakpoint),
108
+ left: resolveResponsive(props.left, breakpoint),
109
+ right: resolveResponsive(props.right, breakpoint),
110
+ overflow: resolveResponsive(props.overflow, breakpoint),
111
+ zIndex: resolveResponsive(props.zIndex, breakpoint),
112
+ opacity: resolveResponsive(props.opacity, breakpoint),
113
+ };
114
+ }
115
+
116
+ /*** Resolves a Surface radius token or raw number. */
117
+ function resolveRadius(
118
+ theme: SurfaceTheme,
119
+ value: number | keyof SurfaceTheme['radii'] | undefined,
120
+ ): number | undefined {
121
+ return resolveToken(theme.radii, value);
122
+ }
123
+
124
+ /*** Resolves a Surface color token while preserving arbitrary color strings. */
125
+ function resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {
126
+ return resolveToken(theme.colors, value);
127
+ }
128
+
129
+ /*** Resolves spacing-token dimensions while preserving raw dimension strings. */
130
+ function resolveDimension(
131
+ theme: SurfaceTheme,
132
+ value: number | string | undefined,
133
+ ): number | string | undefined {
134
+ return resolveToken(theme.spacing, value);
135
+ }
@@ -0,0 +1,11 @@
1
+ import { resolveToken } from '../theme/resolveToken';
2
+ import type { SurfaceTheme } from '../theme/types';
3
+ import type { SpaceValue } from '../types/layout';
4
+
5
+ /*** Resolves a numeric spacing value or a Surface spacing token. */
6
+ export function resolveSpacing(
7
+ theme: SurfaceTheme,
8
+ value: SpaceValue | undefined,
9
+ ): number | undefined {
10
+ return resolveToken(theme.spacing, value);
11
+ }
@@ -8,8 +8,8 @@ await mock.module('react-native', () => ReactNativeWeb);
8
8
 
9
9
  const scrollContentStyle = { padding: 4 };
10
10
 
11
- const { Container } = await import('./layout/Container');
12
- const { Grid } = await import('./layout/Grid');
11
+ const { Container, Grid } = await import('./features/layout/public');
12
+ const { KeyboardAvoidingView } = await import('./features/keyboard-avoiding-view/public');
13
13
  const { ScrollArea } = await import('./layout/ScrollArea');
14
14
  const { Show } = await import('./layout/Show');
15
15
  const { OverlayProvider } = await import('./internal/overlay/OverlayProvider');
@@ -94,3 +94,19 @@ test('RN Web 0.21 compiles box-none overlay pointer events into a hit-test-safe
94
94
  expect(markup).toContain('data-testid="interactive-content"');
95
95
  expect(markup).toContain('r-pointerEvents-');
96
96
  });
97
+
98
+ test('RN Web 0.21 renders keyboard-safe content through the Surface layout boundary', () => {
99
+ const markup = renderToString(
100
+ <KeyboardAvoidingView
101
+ behavior="padding"
102
+ enabled
103
+ keyboardVerticalOffset={24}
104
+ testID="keyboard-safe"
105
+ >
106
+ <ReactNativeWeb.Text>Keyboard-safe content</ReactNativeWeb.Text>
107
+ </KeyboardAvoidingView>,
108
+ );
109
+
110
+ expect(markup).toContain('data-testid="keyboard-safe"');
111
+ expect(markup).toContain('Keyboard-safe content');
112
+ });
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import type { BadgeProps } from './types';
3
- export declare function Badge({ content, variant, color, size, testID, }: BadgeProps): React.JSX.Element;
4
- //# sourceMappingURL=Badge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,OAAgB,EAChB,KAAiB,EACjB,IAAU,EACV,MAAM,GACP,EAAE,UAAU,qBAqCZ"}
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { resolveButtonColors, resolveControlSize } from '../../internal/resolvers';
3
- import { Box } from '../../layout';
4
- import { Text } from '../../primitives/text';
5
- import { useTheme } from '../../theme/ThemeContext';
6
- export function Badge({ content, variant = 'soft', color = 'primary', size = 's', testID, }) {
7
- const { theme } = useTheme();
8
- const controlSize = resolveControlSize(theme, size);
9
- const colors = resolveButtonColors(theme, {
10
- variant,
11
- color,
12
- state: {
13
- disabled: false,
14
- focused: false,
15
- hovered: false,
16
- pressed: false,
17
- },
18
- });
19
- return (<Box px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)} py={Math.max(4, controlSize.paddingVertical - 2)} radius={controlSize.borderRadius} style={{
20
- alignSelf: 'flex-start',
21
- backgroundColor: colors.backgroundColor,
22
- borderColor: colors.borderColor,
23
- borderWidth: variant === 'solid' ? 0 : 1,
24
- }} testID={testID}>
25
- <Text color={color} emphasis={variant === 'solid' ? 'inverse' : 'default'} variant="bodySmall" weight="medium">
26
- {content}
27
- </Text>
28
- </Box>);
29
- }
30
- //# sourceMappingURL=Badge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,MAAM,UAAU,KAAK,CAAC,EACpB,OAAO,EACP,OAAO,GAAG,MAAM,EAChB,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,GAAG,EACV,MAAM,GACK;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,EAAE;QACxC,OAAO;QACP,KAAK;QACL,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,KAAK;SACf;KACF,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,GAAG,CACF,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,WAAW,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAClE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,CACjD,MAAM,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CACjC,KAAK,CAAC,CAAC;YACL,SAAS,EAAE,YAAY;YACvB,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACzC,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;MAAA,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACtD,OAAO,CAAC,WAAW,CACnB,MAAM,CAAC,QAAQ,CAEf;QAAA,CAAC,OAAO,CACV;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { resolveButtonColors, resolveControlSize } from '../../internal/resolvers';\nimport { Box } from '../../layout';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { BadgeProps } from './types';\n\nexport function Badge({\n content,\n variant = 'soft',\n color = 'primary',\n size = 's',\n testID,\n}: BadgeProps) {\n const { theme } = useTheme();\n const controlSize = resolveControlSize(theme, size);\n const colors = resolveButtonColors(theme, {\n variant,\n color,\n state: {\n disabled: false,\n focused: false,\n hovered: false,\n pressed: false,\n },\n });\n\n return (\n <Box\n px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)}\n py={Math.max(4, controlSize.paddingVertical - 2)}\n radius={controlSize.borderRadius}\n style={{\n alignSelf: 'flex-start',\n backgroundColor: colors.backgroundColor,\n borderColor: colors.borderColor,\n borderWidth: variant === 'solid' ? 0 : 1,\n }}\n testID={testID}\n >\n <Text\n color={color}\n emphasis={variant === 'solid' ? 'inverse' : 'default'}\n variant=\"bodySmall\"\n weight=\"medium\"\n >\n {content}\n </Text>\n </Box>\n );\n}\n"]}
@@ -1,3 +0,0 @@
1
- export { Badge } from './Badge';
2
- export type { BadgeProps } from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
@@ -1,2 +0,0 @@
1
- export { Badge } from './Badge';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { Badge } from './Badge';\nexport type { BadgeProps } from './types';\n"]}
@@ -1,12 +0,0 @@
1
- import type React from 'react';
2
- import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
3
- import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
4
- import type { SurfaceColor } from '../../surfaceColor';
5
- export interface BadgeProps {
6
- content?: React.ReactNode;
7
- variant?: Extract<ButtonVariant, 'solid' | 'soft' | 'outline'>;
8
- color?: SurfaceColor;
9
- size?: ControlSize;
10
- testID?: string;
11
- }
12
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/badge/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ControlSize } from '../../internal/resolvers/resolveControlSize';\nimport type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';\nimport type { SurfaceColor } from '../../surfaceColor';\n\nexport interface BadgeProps {\n content?: React.ReactNode;\n variant?: Extract<ButtonVariant, 'solid' | 'soft' | 'outline'>;\n color?: SurfaceColor;\n size?: ControlSize;\n testID?: string;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAiB,EACjB,KAAiB,EACjB,IAAU,EACV,QAAgB,EAChB,OAAe,EACf,WAAW,EACX,YAAY,EACZ,SAAiB,EACjB,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EAAE,WAAW,qBAyEb"}
@@ -1,51 +0,0 @@
1
- import React from 'react';
2
- import { ActivityIndicator, View } from 'react-native';
3
- import { resolveButtonColors, resolveControlSize, resolveIconSize } from '../../internal/resolvers';
4
- import { Box } from '../../layout';
5
- import { ButtonBase } from '../../primitives/button-base';
6
- import { Icon } from '../../primitives/icon';
7
- import { Text } from '../../primitives/text';
8
- import { useTheme } from '../../theme/ThemeContext';
9
- export function Button({ children, variant = 'solid', color = 'primary', size = 'm', disabled = false, loading = false, leadingIcon, trailingIcon, fullWidth = false, onPress, testID, ...props }) {
10
- const { theme } = useTheme();
11
- const controlSize = resolveControlSize(theme, size);
12
- return (<ButtonBase {...props} disabled={disabled || loading} onPress={onPress} style={{
13
- alignSelf: fullWidth ? 'stretch' : 'flex-start',
14
- }} testID={testID}>
15
- {(state) => {
16
- const colors = resolveButtonColors(theme, {
17
- variant,
18
- color,
19
- state,
20
- });
21
- const textEmphasis = colors.contentColor === theme.semantics.content.muted ? 'muted' : 'default';
22
- const resolvedTextColor = textEmphasis === 'muted' ? undefined : color;
23
- const resolvedTextEmphasis = textEmphasis === 'muted' ? 'muted' : variant === 'solid' ? 'inverse' : 'default';
24
- const iconSize = resolveIconSize(theme, size);
25
- return (<Box px={controlSize.paddingHorizontal} py={controlSize.paddingVertical} radius={controlSize.borderRadius} style={{
26
- minHeight: controlSize.minHeight,
27
- width: fullWidth ? '100%' : undefined,
28
- flexDirection: 'row',
29
- alignItems: 'center',
30
- justifyContent: 'center',
31
- backgroundColor: colors.backgroundColor,
32
- borderColor: colors.borderColor,
33
- borderWidth: variant === 'solid' ? 0 : 1,
34
- opacity: colors.opacity,
35
- }}>
36
- {loading ? (<ActivityIndicator color={colors.contentColor} size="small"/>) : (<>
37
- {leadingIcon ? (<View style={{ marginRight: theme.spacing.s }}>
38
- <Icon {...leadingIcon} color={colors.contentColor} size={iconSize}/>
39
- </View>) : null}
40
- <Text color={resolvedTextColor} emphasis={resolvedTextEmphasis} variant={controlSize.textVariant} weight="semiBold">
41
- {children}
42
- </Text>
43
- {trailingIcon ? (<View style={{ marginLeft: theme.spacing.s }}>
44
- <Icon {...trailingIcon} color={colors.contentColor} size={iconSize}/>
45
- </View>) : null}
46
- </>)}
47
- </Box>);
48
- }}
49
- </ButtonBase>);
50
- }
51
- //# sourceMappingURL=Button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"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","sourcesContent":["import React from 'react';\nimport { ActivityIndicator, View } from 'react-native';\n\nimport { resolveButtonColors, resolveControlSize, resolveIconSize } from '../../internal/resolvers';\nimport { Box } from '../../layout';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { Icon } from '../../primitives/icon';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { ButtonProps } from './types';\n\nexport function Button({\n children,\n variant = 'solid',\n color = 'primary',\n size = 'm',\n disabled = false,\n loading = false,\n leadingIcon,\n trailingIcon,\n fullWidth = false,\n onPress,\n testID,\n ...props\n}: ButtonProps) {\n const { theme } = useTheme();\n const controlSize = resolveControlSize(theme, size);\n\n return (\n <ButtonBase\n {...props}\n disabled={disabled || loading}\n onPress={onPress}\n style={{\n alignSelf: fullWidth ? 'stretch' : 'flex-start',\n }}\n testID={testID}\n >\n {(state) => {\n const colors = resolveButtonColors(theme, {\n variant,\n color,\n state,\n });\n const textEmphasis =\n colors.contentColor === theme.semantics.content.muted ? 'muted' : 'default';\n const resolvedTextColor = textEmphasis === 'muted' ? undefined : color;\n const resolvedTextEmphasis =\n textEmphasis === 'muted' ? 'muted' : variant === 'solid' ? 'inverse' : 'default';\n const iconSize = resolveIconSize(theme, size);\n\n return (\n <Box\n px={controlSize.paddingHorizontal}\n py={controlSize.paddingVertical}\n radius={controlSize.borderRadius}\n style={{\n minHeight: controlSize.minHeight,\n width: fullWidth ? '100%' : undefined,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: colors.backgroundColor,\n borderColor: colors.borderColor,\n borderWidth: variant === 'solid' ? 0 : 1,\n opacity: colors.opacity,\n }}\n >\n {loading ? (\n <ActivityIndicator color={colors.contentColor} size=\"small\" />\n ) : (\n <>\n {leadingIcon ? (\n <View style={{ marginRight: theme.spacing.s }}>\n <Icon {...leadingIcon} color={colors.contentColor} size={iconSize} />\n </View>\n ) : null}\n <Text\n color={resolvedTextColor}\n emphasis={resolvedTextEmphasis}\n variant={controlSize.textVariant}\n weight=\"semiBold\"\n >\n {children}\n </Text>\n {trailingIcon ? (\n <View style={{ marginLeft: theme.spacing.s }}>\n <Icon {...trailingIcon} color={colors.contentColor} size={iconSize} />\n </View>\n ) : null}\n </>\n )}\n </Box>\n );\n }}\n </ButtonBase>\n );\n}\n"]}
@@ -1,3 +0,0 @@
1
- export { Button } from './Button';
2
- export type { ButtonIconSpec, ButtonProps } from './types';
3
- //# sourceMappingURL=index.d.ts.map