@ankhorage/surface 5.0.1 → 7.0.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 (319) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -2
  3. package/dist/{layout → core/responsive}/Show.d.ts +2 -1
  4. package/dist/core/responsive/Show.d.ts.map +1 -0
  5. package/dist/{layout → core/responsive}/Show.js +3 -1
  6. package/dist/core/responsive/Show.js.map +1 -0
  7. package/dist/core/responsive/index.d.ts +1 -0
  8. package/dist/core/responsive/index.d.ts.map +1 -1
  9. package/dist/core/responsive/index.js +1 -0
  10. package/dist/core/responsive/index.js.map +1 -1
  11. package/dist/features/app-bar/adapters/inbound/AppBar.d.ts +5 -0
  12. package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -0
  13. package/dist/features/app-bar/adapters/inbound/AppBar.js +40 -0
  14. package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -0
  15. package/dist/features/app-bar/public.d.ts +3 -0
  16. package/dist/features/app-bar/public.d.ts.map +1 -0
  17. package/dist/features/app-bar/public.js +2 -0
  18. package/dist/features/app-bar/public.js.map +1 -0
  19. package/dist/features/badge/adapters/inbound/Badge.js +3 -3
  20. package/dist/features/badge/adapters/inbound/Badge.js.map +1 -1
  21. package/dist/features/button/adapters/inbound/Button.js +8 -8
  22. package/dist/features/button/adapters/inbound/Button.js.map +1 -1
  23. package/dist/features/button/adapters/inbound/IconButton.js +3 -3
  24. package/dist/features/button/adapters/inbound/IconButton.js.map +1 -1
  25. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +7 -7
  26. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
  27. package/dist/{components/field → features/form/field/adapters/inbound}/Field.d.ts +2 -1
  28. package/dist/features/form/field/adapters/inbound/Field.d.ts.map +1 -0
  29. package/dist/features/form/field/adapters/inbound/Field.js +40 -0
  30. package/dist/features/form/field/adapters/inbound/Field.js.map +1 -0
  31. package/dist/features/form/field/public.d.ts +3 -0
  32. package/dist/features/form/field/public.d.ts.map +1 -0
  33. package/dist/features/form/field/public.js +2 -0
  34. package/dist/features/form/field/public.js.map +1 -0
  35. package/dist/features/form/radio/adapters/inbound/Radio.js +8 -8
  36. package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
  37. package/dist/{components/switch → features/form/switch/adapters/inbound}/Switch.d.ts +2 -1
  38. package/dist/features/form/switch/adapters/inbound/Switch.d.ts.map +1 -0
  39. package/dist/features/form/switch/adapters/inbound/Switch.js +52 -0
  40. package/dist/features/form/switch/adapters/inbound/Switch.js.map +1 -0
  41. package/dist/features/form/switch/public.d.ts +3 -0
  42. package/dist/features/form/switch/public.d.ts.map +1 -0
  43. package/dist/features/form/switch/public.js +2 -0
  44. package/dist/features/form/switch/public.js.map +1 -0
  45. package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -1
  46. package/dist/features/form/text-input/adapters/inbound/TextInput.js +8 -4
  47. package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -1
  48. package/dist/features/layout/adapters/inbound/Divider.js +2 -2
  49. package/dist/features/layout/adapters/inbound/Divider.js.map +1 -1
  50. package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -1
  51. package/dist/features/layout/adapters/inbound/Grid.js +7 -9
  52. package/dist/features/layout/adapters/inbound/Grid.js.map +1 -1
  53. package/dist/features/layout/adapters/inbound/ScrollView.d.ts +5 -0
  54. package/dist/features/layout/adapters/inbound/ScrollView.d.ts.map +1 -0
  55. package/dist/features/layout/adapters/inbound/ScrollView.js +69 -0
  56. package/dist/features/layout/adapters/inbound/ScrollView.js.map +1 -0
  57. package/dist/features/layout/adapters/inbound/View.d.ts +5 -0
  58. package/dist/features/layout/adapters/inbound/View.d.ts.map +1 -0
  59. package/dist/features/layout/adapters/inbound/View.js +17 -0
  60. package/dist/features/layout/adapters/inbound/View.js.map +1 -0
  61. package/dist/features/layout/public.d.ts +3 -4
  62. package/dist/features/layout/public.d.ts.map +1 -1
  63. package/dist/features/layout/public.js +2 -3
  64. package/dist/features/layout/public.js.map +1 -1
  65. package/dist/features/list/adapters/inbound/List.d.ts +5 -0
  66. package/dist/features/list/adapters/inbound/List.d.ts.map +1 -0
  67. package/dist/features/list/adapters/inbound/List.js +7 -0
  68. package/dist/features/list/adapters/inbound/List.js.map +1 -0
  69. package/dist/features/list/adapters/inbound/ListItem.d.ts +5 -0
  70. package/dist/features/list/adapters/inbound/ListItem.d.ts.map +1 -0
  71. package/dist/features/list/adapters/inbound/ListItem.js +59 -0
  72. package/dist/features/list/adapters/inbound/ListItem.js.map +1 -0
  73. package/dist/features/list/public.d.ts +4 -0
  74. package/dist/features/list/public.d.ts.map +1 -0
  75. package/dist/features/list/public.js +3 -0
  76. package/dist/features/list/public.js.map +1 -0
  77. package/dist/features/modal/adapters/inbound/Modal.d.ts.map +1 -1
  78. package/dist/features/modal/adapters/inbound/Modal.js +8 -8
  79. package/dist/features/modal/adapters/inbound/Modal.js.map +1 -1
  80. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -1
  81. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +11 -12
  82. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -1
  83. package/dist/features/surface/adapters/inbound/Surface.d.ts +1 -1
  84. package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -1
  85. package/dist/features/surface/adapters/inbound/Surface.js +3 -3
  86. package/dist/features/surface/adapters/inbound/Surface.js.map +1 -1
  87. package/dist/features/tabs/adapters/inbound/Tab.js +3 -3
  88. package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -1
  89. package/dist/features/tabs/adapters/inbound/TabList.d.ts.map +1 -1
  90. package/dist/features/tabs/adapters/inbound/TabList.js +3 -5
  91. package/dist/features/tabs/adapters/inbound/TabList.js.map +1 -1
  92. package/dist/features/tabs/adapters/inbound/Tabs.js +2 -2
  93. package/dist/features/tabs/adapters/inbound/Tabs.js.map +1 -1
  94. package/dist/features/toast/adapters/inbound/Toast.js +5 -5
  95. package/dist/features/toast/adapters/inbound/Toast.js.map +1 -1
  96. package/dist/features/toast/adapters/inbound/ToastProvider.js +3 -3
  97. package/dist/features/toast/adapters/inbound/ToastProvider.js.map +1 -1
  98. package/dist/index.d.ts +10 -15
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +5 -8
  101. package/dist/index.js.map +1 -1
  102. package/dist/primitives/button-base/ButtonBase.d.ts +1 -0
  103. package/dist/primitives/button-base/ButtonBase.d.ts.map +1 -1
  104. package/dist/primitives/button-base/ButtonBase.js +6 -5
  105. package/dist/primitives/button-base/ButtonBase.js.map +1 -1
  106. package/dist/primitives/button-base/types.d.ts +2 -2
  107. package/dist/primitives/button-base/types.d.ts.map +1 -1
  108. package/dist/primitives/button-base/types.js.map +1 -1
  109. package/dist/types/app-bar.d.ts +12 -0
  110. package/dist/types/app-bar.d.ts.map +1 -0
  111. package/dist/types/app-bar.js +2 -0
  112. package/dist/types/app-bar.js.map +1 -0
  113. package/dist/{components/field/types.d.ts → types/field.d.ts} +1 -1
  114. package/dist/types/field.d.ts.map +1 -0
  115. package/dist/types/field.js +2 -0
  116. package/dist/types/field.js.map +1 -0
  117. package/dist/types/layout.d.ts +15 -17
  118. package/dist/types/layout.d.ts.map +1 -1
  119. package/dist/types/layout.js.map +1 -1
  120. package/dist/types/list.d.ts +20 -0
  121. package/dist/types/list.d.ts.map +1 -0
  122. package/dist/types/list.js +2 -0
  123. package/dist/types/list.js.map +1 -0
  124. package/dist/types/surface.d.ts +2 -2
  125. package/dist/types/surface.d.ts.map +1 -1
  126. package/dist/types/surface.js.map +1 -1
  127. package/dist/{components/switch/types.d.ts → types/switch.d.ts} +4 -4
  128. package/dist/types/switch.d.ts.map +1 -0
  129. package/dist/types/switch.js +2 -0
  130. package/dist/types/switch.js.map +1 -0
  131. package/dist/utils/resolveViewStyles.d.ts +7 -0
  132. package/dist/utils/resolveViewStyles.d.ts.map +1 -0
  133. package/dist/utils/{resolveBoxStyles.js → resolveViewStyles.js} +11 -4
  134. package/dist/utils/resolveViewStyles.js.map +1 -0
  135. package/package.json +1 -1
  136. package/src/{layout → core/responsive}/Show.tsx +4 -1
  137. package/src/core/responsive/index.ts +1 -0
  138. package/src/features/app-bar/adapters/inbound/AppBar.tsx +69 -0
  139. package/src/features/app-bar/public.ts +2 -0
  140. package/src/features/badge/adapters/inbound/Badge.tsx +3 -3
  141. package/src/features/button/adapters/inbound/Button.tsx +8 -8
  142. package/src/features/button/adapters/inbound/IconButton.tsx +3 -3
  143. package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +7 -7
  144. package/src/features/form/field/adapters/inbound/Field.tsx +82 -0
  145. package/src/features/form/field/public.ts +2 -0
  146. package/src/features/form/radio/adapters/inbound/Radio.tsx +8 -8
  147. package/src/features/form/switch/adapters/inbound/Switch.tsx +123 -0
  148. package/src/features/form/switch/public.ts +2 -0
  149. package/src/features/form/text-input/adapters/inbound/TextInput.tsx +21 -5
  150. package/src/features/layout/adapters/inbound/Divider.tsx +2 -2
  151. package/src/features/layout/adapters/inbound/Grid.tsx +12 -14
  152. package/src/features/layout/adapters/inbound/ScrollView.tsx +102 -0
  153. package/src/features/layout/adapters/inbound/{Box.tsx → View.tsx} +9 -9
  154. package/src/features/layout/public.ts +3 -10
  155. package/src/features/list/adapters/inbound/List.tsx +9 -0
  156. package/src/features/list/adapters/inbound/ListItem.tsx +128 -0
  157. package/src/features/list/public.test.ts +13 -0
  158. package/src/features/list/public.ts +3 -0
  159. package/src/features/modal/adapters/inbound/Modal.tsx +11 -8
  160. package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +11 -14
  161. package/src/features/surface/adapters/inbound/Surface.tsx +3 -3
  162. package/src/features/tabs/adapters/inbound/Tab.tsx +3 -3
  163. package/src/features/tabs/adapters/inbound/TabList.tsx +3 -6
  164. package/src/features/tabs/adapters/inbound/Tabs.tsx +2 -2
  165. package/src/features/toast/adapters/inbound/Toast.tsx +5 -5
  166. package/src/features/toast/adapters/inbound/ToastProvider.tsx +3 -3
  167. package/src/index.test.ts +26 -48
  168. package/src/index.ts +10 -21
  169. package/src/primitives/button-base/ButtonBase.tsx +6 -8
  170. package/src/primitives/button-base/types.ts +2 -2
  171. package/src/types/app-bar.ts +13 -0
  172. package/src/types/layout.ts +25 -20
  173. package/src/types/list.ts +22 -0
  174. package/src/types/surface.ts +2 -2
  175. package/src/{components/switch/types.ts → types/switch.ts} +3 -3
  176. package/src/utils/resolveViewStyles.test.ts +71 -0
  177. package/src/utils/{resolveBoxStyles.ts → resolveViewStyles.ts} +16 -9
  178. package/src/webAcceptance.test.tsx +8 -9
  179. package/dist/components/field/Field.d.ts.map +0 -1
  180. package/dist/components/field/Field.js +0 -26
  181. package/dist/components/field/Field.js.map +0 -1
  182. package/dist/components/field/index.d.ts +0 -3
  183. package/dist/components/field/index.d.ts.map +0 -1
  184. package/dist/components/field/index.js +0 -2
  185. package/dist/components/field/index.js.map +0 -1
  186. package/dist/components/field/types.d.ts.map +0 -1
  187. package/dist/components/field/types.js +0 -2
  188. package/dist/components/field/types.js.map +0 -1
  189. package/dist/components/helper-text/HelperText.d.ts +0 -4
  190. package/dist/components/helper-text/HelperText.d.ts.map +0 -1
  191. package/dist/components/helper-text/HelperText.js +0 -8
  192. package/dist/components/helper-text/HelperText.js.map +0 -1
  193. package/dist/components/helper-text/index.d.ts +0 -3
  194. package/dist/components/helper-text/index.d.ts.map +0 -1
  195. package/dist/components/helper-text/index.js +0 -2
  196. package/dist/components/helper-text/index.js.map +0 -1
  197. package/dist/components/helper-text/types.d.ts +0 -9
  198. package/dist/components/helper-text/types.d.ts.map +0 -1
  199. package/dist/components/helper-text/types.js +0 -2
  200. package/dist/components/helper-text/types.js.map +0 -1
  201. package/dist/components/label/Label.d.ts +0 -4
  202. package/dist/components/label/Label.d.ts.map +0 -1
  203. package/dist/components/label/Label.js +0 -11
  204. package/dist/components/label/Label.js.map +0 -1
  205. package/dist/components/label/index.d.ts +0 -3
  206. package/dist/components/label/index.d.ts.map +0 -1
  207. package/dist/components/label/index.js +0 -2
  208. package/dist/components/label/index.js.map +0 -1
  209. package/dist/components/label/types.d.ts +0 -10
  210. package/dist/components/label/types.d.ts.map +0 -1
  211. package/dist/components/label/types.js +0 -2
  212. package/dist/components/label/types.js.map +0 -1
  213. package/dist/components/list-item/ListItem.d.ts +0 -4
  214. package/dist/components/list-item/ListItem.d.ts.map +0 -1
  215. package/dist/components/list-item/ListItem.js +0 -43
  216. package/dist/components/list-item/ListItem.js.map +0 -1
  217. package/dist/components/list-item/index.d.ts +0 -3
  218. package/dist/components/list-item/index.d.ts.map +0 -1
  219. package/dist/components/list-item/index.js +0 -2
  220. package/dist/components/list-item/index.js.map +0 -1
  221. package/dist/components/list-item/types.d.ts +0 -11
  222. package/dist/components/list-item/types.d.ts.map +0 -1
  223. package/dist/components/list-item/types.js +0 -2
  224. package/dist/components/list-item/types.js.map +0 -1
  225. package/dist/components/switch/Switch.d.ts.map +0 -1
  226. package/dist/components/switch/Switch.js +0 -71
  227. package/dist/components/switch/Switch.js.map +0 -1
  228. package/dist/components/switch/index.d.ts +0 -3
  229. package/dist/components/switch/index.d.ts.map +0 -1
  230. package/dist/components/switch/index.js +0 -2
  231. package/dist/components/switch/index.js.map +0 -1
  232. package/dist/components/switch/types.d.ts.map +0 -1
  233. package/dist/components/switch/types.js +0 -2
  234. package/dist/components/switch/types.js.map +0 -1
  235. package/dist/components/textarea/Textarea.d.ts +0 -4
  236. package/dist/components/textarea/Textarea.d.ts.map +0 -1
  237. package/dist/components/textarea/Textarea.js +0 -6
  238. package/dist/components/textarea/Textarea.js.map +0 -1
  239. package/dist/components/textarea/index.d.ts +0 -3
  240. package/dist/components/textarea/index.d.ts.map +0 -1
  241. package/dist/components/textarea/index.js +0 -2
  242. package/dist/components/textarea/index.js.map +0 -1
  243. package/dist/components/textarea/types.d.ts +0 -5
  244. package/dist/components/textarea/types.d.ts.map +0 -1
  245. package/dist/components/textarea/types.js +0 -2
  246. package/dist/components/textarea/types.js.map +0 -1
  247. package/dist/features/layout/adapters/inbound/Box.d.ts +0 -5
  248. package/dist/features/layout/adapters/inbound/Box.d.ts.map +0 -1
  249. package/dist/features/layout/adapters/inbound/Box.js +0 -17
  250. package/dist/features/layout/adapters/inbound/Box.js.map +0 -1
  251. package/dist/features/layout/adapters/inbound/Container.d.ts +0 -5
  252. package/dist/features/layout/adapters/inbound/Container.d.ts.map +0 -1
  253. package/dist/features/layout/adapters/inbound/Container.js +0 -28
  254. package/dist/features/layout/adapters/inbound/Container.js.map +0 -1
  255. package/dist/features/layout/adapters/inbound/Stack.d.ts +0 -5
  256. package/dist/features/layout/adapters/inbound/Stack.d.ts.map +0 -1
  257. package/dist/features/layout/adapters/inbound/Stack.js +0 -27
  258. package/dist/features/layout/adapters/inbound/Stack.js.map +0 -1
  259. package/dist/layout/AppBar.d.ts +0 -13
  260. package/dist/layout/AppBar.d.ts.map +0 -1
  261. package/dist/layout/AppBar.js +0 -30
  262. package/dist/layout/AppBar.js.map +0 -1
  263. package/dist/layout/Center.d.ts +0 -7
  264. package/dist/layout/Center.d.ts.map +0 -1
  265. package/dist/layout/Center.js +0 -12
  266. package/dist/layout/Center.js.map +0 -1
  267. package/dist/layout/Inline.d.ts +0 -5
  268. package/dist/layout/Inline.d.ts.map +0 -1
  269. package/dist/layout/Inline.js +0 -6
  270. package/dist/layout/Inline.js.map +0 -1
  271. package/dist/layout/ScrollArea.d.ts +0 -9
  272. package/dist/layout/ScrollArea.d.ts.map +0 -1
  273. package/dist/layout/ScrollArea.js +0 -52
  274. package/dist/layout/ScrollArea.js.map +0 -1
  275. package/dist/layout/Show.d.ts.map +0 -1
  276. package/dist/layout/Show.js.map +0 -1
  277. package/dist/layout/Spacer.d.ts +0 -9
  278. package/dist/layout/Spacer.d.ts.map +0 -1
  279. package/dist/layout/Spacer.js +0 -12
  280. package/dist/layout/Spacer.js.map +0 -1
  281. package/dist/layout/Template.d.ts +0 -18
  282. package/dist/layout/Template.d.ts.map +0 -1
  283. package/dist/layout/Template.js +0 -36
  284. package/dist/layout/Template.js.map +0 -1
  285. package/dist/layout/index.d.ts +0 -15
  286. package/dist/layout/index.d.ts.map +0 -1
  287. package/dist/layout/index.js +0 -8
  288. package/dist/layout/index.js.map +0 -1
  289. package/dist/utils/resolveBoxStyles.d.ts +0 -7
  290. package/dist/utils/resolveBoxStyles.d.ts.map +0 -1
  291. package/dist/utils/resolveBoxStyles.js.map +0 -1
  292. package/src/components/field/Field.tsx +0 -51
  293. package/src/components/field/index.ts +0 -2
  294. package/src/components/helper-text/HelperText.tsx +0 -12
  295. package/src/components/helper-text/index.ts +0 -2
  296. package/src/components/helper-text/types.ts +0 -10
  297. package/src/components/label/Label.tsx +0 -23
  298. package/src/components/label/index.ts +0 -2
  299. package/src/components/label/types.ts +0 -11
  300. package/src/components/list-item/ListItem.tsx +0 -72
  301. package/src/components/list-item/index.ts +0 -2
  302. package/src/components/list-item/types.ts +0 -11
  303. package/src/components/switch/Switch.tsx +0 -118
  304. package/src/components/switch/index.ts +0 -2
  305. package/src/components/textarea/Textarea.tsx +0 -15
  306. package/src/components/textarea/index.ts +0 -2
  307. package/src/components/textarea/types.ts +0 -5
  308. package/src/features/layout/adapters/inbound/Container.tsx +0 -43
  309. package/src/features/layout/adapters/inbound/Stack.test.ts +0 -13
  310. package/src/features/layout/adapters/inbound/Stack.tsx +0 -44
  311. package/src/layout/AppBar.tsx +0 -60
  312. package/src/layout/Center.tsx +0 -22
  313. package/src/layout/Inline.tsx +0 -9
  314. package/src/layout/ScrollArea.tsx +0 -116
  315. package/src/layout/Spacer.tsx +0 -22
  316. package/src/layout/Template.tsx +0 -86
  317. package/src/layout/index.ts +0 -14
  318. package/src/utils/resolveBoxStyles.test.ts +0 -54
  319. /package/src/{components/field/types.ts → types/field.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveViewStyles.js","sourceRoot":"","sources":["../../src/utils/resolveViewSty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C,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,gFAAgF;AAChF,SAAS,YAAY,CAAC,KAAmB,EAAE,KAA6B;IACtE,OAAO,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED,iFAAiF;AACjF,SAAS,gBAAgB,CACvB,KAAmB,EACnB,KAAkC;IAElC,OAAO,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import type { ViewStyle } from 'react-native';\n\nimport { resolveResponsive } from '../core/responsive/resolve';\nimport type { Breakpoint } from '../core/responsive/types';\nimport { resolveToken } from '../theme/resolveToken';\nimport type { SurfaceTheme } from '../theme/types';\nimport type { ColorValue, ViewStyleProps } from '../types/layout';\nimport { resolveSpacing } from './resolveSpacing';\n\n/*** Resolves responsive Surface View style props into one React Native view style. */\nexport function resolveViewStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n elevation: 0,\n ...resolveSpacingStyles(theme, breakpoint, props),\n ...resolveVisualStyles(theme, breakpoint, props),\n ...resolveDimensionStyles(theme, breakpoint, props),\n ...resolveLayoutStyles(breakpoint, props),\n };\n}\n\n/*** Resolves padding, margin, and gap styles from responsive spacing props. */\nfunction resolveSpacingStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),\n paddingHorizontal: resolveSpacing(theme, resolveResponsive(props.px, breakpoint)),\n paddingVertical: resolveSpacing(theme, resolveResponsive(props.py, breakpoint)),\n paddingTop: resolveSpacing(theme, resolveResponsive(props.pt, breakpoint)),\n paddingBottom: resolveSpacing(theme, resolveResponsive(props.pb, breakpoint)),\n paddingLeft: resolveSpacing(theme, resolveResponsive(props.pl, breakpoint)),\n paddingRight: resolveSpacing(theme, resolveResponsive(props.pr, breakpoint)),\n margin: resolveSpacing(theme, resolveResponsive(props.m, breakpoint)),\n marginHorizontal: resolveSpacing(theme, resolveResponsive(props.mx, breakpoint)),\n marginVertical: resolveSpacing(theme, resolveResponsive(props.my, breakpoint)),\n marginTop: resolveSpacing(theme, resolveResponsive(props.mt, breakpoint)),\n marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),\n marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),\n marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),\n gap: resolveSpacing(theme, resolveResponsive(props.gap, breakpoint)),\n rowGap: resolveSpacing(theme, resolveResponsive(props.rowGap, breakpoint)),\n columnGap: resolveSpacing(theme, resolveResponsive(props.columnGap, breakpoint)),\n };\n}\n\n/*** Resolves background, radius, and border styles. */\nfunction resolveVisualStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),\n borderRadius: resolveRadius(theme, resolveResponsive(props.radius, breakpoint)),\n borderWidth: resolveResponsive(props.borderWidth, breakpoint),\n borderColor: resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),\n };\n}\n\n/*** Resolves responsive dimension props through spacing tokens. */\nfunction resolveDimensionStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: ViewStyleProps,\n): ViewStyle {\n return {\n width: resolveDimension(\n theme,\n resolveResponsive(props.width, breakpoint),\n ) as ViewStyle['width'],\n height: resolveDimension(\n theme,\n resolveResponsive(props.height, breakpoint),\n ) as ViewStyle['height'],\n minWidth: resolveDimension(\n theme,\n resolveResponsive(props.minWidth, breakpoint),\n ) as ViewStyle['minWidth'],\n maxWidth: resolveDimension(\n theme,\n resolveResponsive(props.maxWidth, breakpoint),\n ) as ViewStyle['maxWidth'],\n minHeight: resolveDimension(\n theme,\n resolveResponsive(props.minHeight, breakpoint),\n ) as ViewStyle['minHeight'],\n maxHeight: resolveDimension(\n theme,\n resolveResponsive(props.maxHeight, breakpoint),\n ) as ViewStyle['maxHeight'],\n };\n}\n\n/*** Resolves responsive flex, positioning, and visibility styles. */\nfunction resolveLayoutStyles(breakpoint: Breakpoint, props: ViewStyleProps): ViewStyle {\n return {\n flex: resolveResponsive(props.flex, breakpoint),\n flexGrow: resolveResponsive(props.flexGrow, breakpoint),\n flexShrink: resolveResponsive(props.flexShrink, breakpoint),\n flexBasis: resolveResponsive(props.flexBasis, breakpoint) as ViewStyle['flexBasis'],\n flexDirection: resolveResponsive(props.direction, breakpoint),\n alignItems: resolveResponsive(props.align, breakpoint),\n justifyContent: resolveResponsive(props.justify, breakpoint),\n flexWrap: resolveResponsive(props.wrap, breakpoint),\n alignSelf: resolveResponsive(props.alignSelf, breakpoint),\n position: resolveResponsive(props.position, breakpoint),\n top: resolveResponsive(props.top, breakpoint),\n bottom: resolveResponsive(props.bottom, breakpoint),\n left: resolveResponsive(props.left, breakpoint),\n right: resolveResponsive(props.right, breakpoint),\n overflow: resolveResponsive(props.overflow, breakpoint),\n zIndex: resolveResponsive(props.zIndex, breakpoint),\n opacity: resolveResponsive(props.opacity, breakpoint),\n };\n}\n\n/*** Resolves a Surface radius token or raw number. */\nfunction resolveRadius(\n theme: SurfaceTheme,\n value: number | keyof SurfaceTheme['radii'] | undefined,\n): number | undefined {\n return resolveToken(theme.radii, value);\n}\n\n/*** Resolves a Surface color token while preserving arbitrary color strings. */\nfunction resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {\n return resolveToken(theme.colors, value);\n}\n\n/*** Resolves spacing-token dimensions while preserving raw dimension strings. */\nfunction resolveDimension(\n theme: SurfaceTheme,\n value: number | string | undefined,\n): number | string | undefined {\n return resolveToken(theme.spacing, value);\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "5.0.1",
4
+ "version": "7.0.0",
5
5
  "description": "Stable UI foundation for React Native and React Native Web.",
6
6
  "homepage": "https://github.com/ankhorage/surface#readme",
7
7
  "bugs": {
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
 
3
- import { resolveResponsive, type Responsive, useResponsiveRuntime } from '../core/responsive';
3
+ import { resolveResponsive } from './resolve';
4
+ import { useResponsiveRuntime } from './ResponsiveProvider';
5
+ import type { Responsive } from './types';
4
6
 
5
7
  export interface ShowProps {
6
8
  when: Responsive<boolean>;
@@ -8,6 +10,7 @@ export interface ShowProps {
8
10
  fallback?: React.ReactNode;
9
11
  }
10
12
 
13
+ /*** Conditionally renders one responsive subtree or its fallback. */
11
14
  export function Show({ when, children, fallback = null }: ShowProps) {
12
15
  const { breakpoint } = useResponsiveRuntime();
13
16
  const visible = resolveResponsive(when, breakpoint) ?? false;
@@ -2,5 +2,6 @@ export { BREAKPOINT_ORDER, BREAKPOINTS } from './breakpoints';
2
2
  export { getBreakpointFromWidth } from './getBreakpointFromWidth';
3
3
  export { resolveResponsive } from './resolve';
4
4
  export { ResponsiveProvider, useResponsiveRuntime } from './ResponsiveProvider';
5
+ export { Show, type ShowProps } from './Show';
5
6
  export type { Breakpoint, Responsive, ResponsiveRuntime } from './types';
6
7
  export { useBreakpoint } from './useBreakpoint';
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import { StyleSheet, View as ReactNativeView, type ViewStyle } from 'react-native';
3
+ import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
4
+
5
+ import { useTheme } from '../../../../theme/ThemeContext';
6
+ import type { AppBarProps } from '../../../../types/app-bar';
7
+ import { Divider, View } from '../../../layout/public';
8
+
9
+ /*** Renders application chrome with optional safe-area padding and leading/trailing slots. */
10
+ export function AppBar({
11
+ leading,
12
+ trailing,
13
+ children,
14
+ safeAreaTop = true,
15
+ divider = false,
16
+ contentStyle,
17
+ bg,
18
+ style,
19
+ ...props
20
+ }: AppBarProps) {
21
+ const { theme } = useTheme();
22
+ const insets = React.use(SafeAreaInsetsContext);
23
+ const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;
24
+ const safeAreaStyle: ViewStyle | undefined =
25
+ topInset === 0 ? undefined : { paddingTop: topInset };
26
+
27
+ return (
28
+ <View {...props} bg={bg ?? theme.semantics.surface.default} style={style}>
29
+ <ReactNativeView style={safeAreaStyle}>
30
+ <ReactNativeView
31
+ style={[styles.content, resolveHorizontalPadding(theme.spacing.m), contentStyle]}
32
+ >
33
+ {leading ? (
34
+ <ReactNativeView
35
+ style={[styles.accessory, resolveAccessoryMargin(theme.spacing.s, 'leading')]}
36
+ >
37
+ {leading}
38
+ </ReactNativeView>
39
+ ) : null}
40
+ <ReactNativeView style={styles.center}>{children}</ReactNativeView>
41
+ {trailing ? (
42
+ <ReactNativeView
43
+ style={[styles.accessory, resolveAccessoryMargin(theme.spacing.s, 'trailing')]}
44
+ >
45
+ {trailing}
46
+ </ReactNativeView>
47
+ ) : null}
48
+ </ReactNativeView>
49
+ {divider ? <Divider color={theme.semantics.neutral.divider} thickness={1} /> : null}
50
+ </ReactNativeView>
51
+ </View>
52
+ );
53
+ }
54
+
55
+ /*** Resolves dynamic horizontal padding for the AppBar content row. */
56
+ function resolveHorizontalPadding(paddingHorizontal: number): ViewStyle {
57
+ return { paddingHorizontal };
58
+ }
59
+
60
+ /*** Resolves directional spacing for one AppBar accessory. */
61
+ function resolveAccessoryMargin(spacing: number, position: 'leading' | 'trailing'): ViewStyle {
62
+ return position === 'leading' ? { marginRight: spacing } : { marginLeft: spacing };
63
+ }
64
+
65
+ const styles = StyleSheet.create({
66
+ accessory: { flexShrink: 0 },
67
+ center: { flex: 1, minWidth: 0 },
68
+ content: { alignItems: 'center', flexDirection: 'row', minHeight: 56 },
69
+ });
@@ -0,0 +1,2 @@
1
+ export type { AppBarProps } from '../../types/app-bar';
2
+ export { AppBar } from './adapters/inbound/AppBar';
@@ -4,7 +4,7 @@ import type { ViewStyle } from 'react-native';
4
4
  import { resolveButtonColors, resolveControlSize } from '../../../../internal/resolvers';
5
5
  import { useTheme } from '../../../../theme/ThemeContext';
6
6
  import type { BadgeProps } from '../../../../types/badge';
7
- import { Box } from '../../../layout/public';
7
+ import { View } from '../../../layout/public';
8
8
  import { Text } from '../../../typography/public';
9
9
 
10
10
  /*** Renders compact semantic status or metadata content. */
@@ -24,7 +24,7 @@ export function Badge({
24
24
  });
25
25
 
26
26
  return (
27
- <Box
27
+ <View
28
28
  px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)}
29
29
  py={Math.max(4, controlSize.paddingVertical - 2)}
30
30
  radius={controlSize.borderRadius}
@@ -39,7 +39,7 @@ export function Badge({
39
39
  >
40
40
  {content}
41
41
  </Text>
42
- </Box>
42
+ </View>
43
43
  );
44
44
  }
45
45
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ActivityIndicator, View, type ViewStyle } from 'react-native';
2
+ import { ActivityIndicator, View as ReactNativeView, type ViewStyle } from 'react-native';
3
3
 
4
4
  import {
5
5
  type InteractionState,
@@ -12,7 +12,7 @@ import { useTheme } from '../../../../theme/ThemeContext';
12
12
  import type { SurfaceTheme } from '../../../../theme/types';
13
13
  import type { ButtonProps } from '../../../../types/button';
14
14
  import { Icon } from '../../../icon/public';
15
- import { Box } from '../../../layout/public';
15
+ import { View } from '../../../layout/public';
16
16
  import { Text } from '../../../typography/public';
17
17
 
18
18
  /*** Renders the primary Surface action control with semantic visual states. */
@@ -80,7 +80,7 @@ function ButtonContent({
80
80
  const iconSize = resolveIconSize(theme, size);
81
81
 
82
82
  return (
83
- <Box
83
+ <View
84
84
  px={controlSize.paddingHorizontal}
85
85
  py={controlSize.paddingVertical}
86
86
  radius={controlSize.borderRadius}
@@ -91,9 +91,9 @@ function ButtonContent({
91
91
  ) : (
92
92
  <>
93
93
  {leadingIcon ? (
94
- <View style={resolveAccessoryStyle(theme.spacing.s, 'leading')}>
94
+ <ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'leading')}>
95
95
  <Icon {...leadingIcon} color={colors.contentColor} size={iconSize} />
96
- </View>
96
+ </ReactNativeView>
97
97
  ) : null}
98
98
  <Text
99
99
  color={muted ? undefined : color}
@@ -104,13 +104,13 @@ function ButtonContent({
104
104
  {children}
105
105
  </Text>
106
106
  {trailingIcon ? (
107
- <View style={resolveAccessoryStyle(theme.spacing.s, 'trailing')}>
107
+ <ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'trailing')}>
108
108
  <Icon {...trailingIcon} color={colors.contentColor} size={iconSize} />
109
- </View>
109
+ </ReactNativeView>
110
110
  ) : null}
111
111
  </>
112
112
  )}
113
- </Box>
113
+ </View>
114
114
  );
115
115
  }
116
116
 
@@ -10,7 +10,7 @@ import { ButtonBase } from '../../../../primitives/button-base';
10
10
  import { useTheme } from '../../../../theme/ThemeContext';
11
11
  import type { IconButtonProps } from '../../../../types/button';
12
12
  import { Icon } from '../../../icon/public';
13
- import { Box } from '../../../layout/public';
13
+ import { View } from '../../../layout/public';
14
14
 
15
15
  /*** Renders a compact accessible icon-only action control. */
16
16
  export function IconButton({
@@ -38,12 +38,12 @@ export function IconButton({
38
38
  {(state) => {
39
39
  const colors = resolveButtonColors(theme, { color, state, variant });
40
40
  return (
41
- <Box
41
+ <View
42
42
  radius={controlSize.borderRadius}
43
43
  style={resolveIconButtonStyle(controlSize, colors, variant)}
44
44
  >
45
45
  <Icon {...icon} color={colors.contentColor} size={resolveIconSize(theme, size)} />
46
- </Box>
46
+ </View>
47
47
  );
48
48
  }}
49
49
  </ButtonBase>
@@ -14,7 +14,7 @@ import type { ButtonBaseProps } from '../../../../../primitives/button-base/type
14
14
  import { useTheme } from '../../../../../theme/ThemeContext';
15
15
  import type { SurfaceTheme } from '../../../../../theme/types';
16
16
  import type { CheckboxProps } from '../../../../../types/checkbox';
17
- import { Box } from '../../../../layout/public';
17
+ import { View } from '../../../../layout/public';
18
18
  import { Text } from '../../../../typography/public';
19
19
 
20
20
  /*** Renders a controlled or uncontrolled accessible checkbox. */
@@ -128,8 +128,8 @@ function renderCheckboxContent(input: CheckboxContentInput) {
128
128
  const indicatorColor = fieldState.invalid ? 'error' : input.color;
129
129
 
130
130
  return (
131
- <Box style={resolveSelectionRowStyle(colors.opacity)}>
132
- <Box
131
+ <View style={resolveSelectionRowStyle(colors.opacity)}>
132
+ <View
133
133
  radius="s"
134
134
  style={resolveCheckboxIndicatorStyle(
135
135
  colors.backgroundColor,
@@ -147,13 +147,13 @@ function renderCheckboxContent(input: CheckboxContentInput) {
147
147
  ✓
148
148
  </Text>
149
149
  ) : null}
150
- </Box>
150
+ </View>
151
151
  {input.children ? (
152
- <Box ml="s">
152
+ <View ml="s">
153
153
  <Text emphasis={labelEmphasis}>{input.children}</Text>
154
- </Box>
154
+ </View>
155
155
  ) : null}
156
- </Box>
156
+ </View>
157
157
  );
158
158
  }
159
159
 
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+
3
+ import {
4
+ type ResolvedFieldPresentation,
5
+ resolveFieldPresentation,
6
+ resolveFieldState,
7
+ } from '../../../../../internal/resolvers';
8
+ import type { FieldProps } from '../../../../../types/field';
9
+ import { View } from '../../../../layout/public';
10
+ import { Text } from '../../../../typography/public';
11
+
12
+ /*** Composes a control with its label and helper or error message. */
13
+ export function Field({
14
+ children,
15
+ label,
16
+ helperText,
17
+ errorText,
18
+ required = false,
19
+ disabled = false,
20
+ invalid = false,
21
+ readOnly = false,
22
+ testID,
23
+ }: FieldProps) {
24
+ const hasErrorText = Boolean(errorText);
25
+ const presentation = resolveFieldPresentation(
26
+ resolveFieldState({ disabled, invalid: invalid || hasErrorText, readOnly }),
27
+ );
28
+ const message = hasErrorText ? errorText : helperText;
29
+
30
+ return (
31
+ <View gap="xs" testID={testID}>
32
+ {renderFieldLabel(label, required, presentation)}
33
+ <View>{children}</View>
34
+ {renderFieldMessage(message, presentation)}
35
+ </View>
36
+ );
37
+ }
38
+
39
+ /*** Renders an optional field label and required indicator. */
40
+ function renderFieldLabel(
41
+ label: React.ReactNode,
42
+ required: boolean,
43
+ presentation: ResolvedFieldPresentation,
44
+ ) {
45
+ if (label === undefined || label === null) return null;
46
+ const labelContent =
47
+ typeof label === 'string' || typeof label === 'number' ? (
48
+ <Text
49
+ color={presentation.labelColor}
50
+ emphasis={presentation.labelEmphasis}
51
+ variant="label"
52
+ weight="medium"
53
+ >
54
+ {label}
55
+ </Text>
56
+ ) : (
57
+ label
58
+ );
59
+
60
+ return (
61
+ <View align="center" direction="row" gap="xs">
62
+ <View flex={1}>{labelContent}</View>
63
+ {required ? (
64
+ <Text color="error" variant="label" weight="medium">
65
+ *
66
+ </Text>
67
+ ) : null}
68
+ </View>
69
+ );
70
+ }
71
+
72
+ /*** Renders an optional helper or error message using field presentation semantics. */
73
+ function renderFieldMessage(message: React.ReactNode, presentation: ResolvedFieldPresentation) {
74
+ if (message === undefined || message === null || message === '') return null;
75
+ if (typeof message !== 'string' && typeof message !== 'number') return message;
76
+
77
+ return (
78
+ <Text color={presentation.helperColor} emphasis={presentation.helperEmphasis} variant="caption">
79
+ {message}
80
+ </Text>
81
+ );
82
+ }
@@ -0,0 +1,2 @@
1
+ export type { FieldProps } from '../../../types/field';
2
+ export { Field } from './adapters/inbound/Field';
@@ -14,7 +14,7 @@ import type { ButtonBaseProps } from '../../../../../primitives/button-base/type
14
14
  import { useTheme } from '../../../../../theme/ThemeContext';
15
15
  import type { SurfaceTheme } from '../../../../../theme/types';
16
16
  import type { RadioProps } from '../../../../../types/radio';
17
- import { Box } from '../../../../layout/public';
17
+ import { View } from '../../../../layout/public';
18
18
  import { Text } from '../../../../typography/public';
19
19
  import { isRadioTextContent } from '../../utils/isRadioTextContent';
20
20
 
@@ -130,8 +130,8 @@ function renderRadioContent(input: RadioContentInput) {
130
130
  input.children !== undefined && input.children !== null && input.children !== false;
131
131
 
132
132
  return (
133
- <Box style={resolveSelectionRowStyle(colors.opacity)}>
134
- <Box
133
+ <View style={resolveSelectionRowStyle(colors.opacity)}>
134
+ <View
135
135
  radius="full"
136
136
  style={resolveRadioIndicatorStyle(
137
137
  colors.backgroundColor,
@@ -140,22 +140,22 @@ function renderRadioContent(input: RadioContentInput) {
140
140
  )}
141
141
  >
142
142
  {input.isChecked ? (
143
- <Box
143
+ <View
144
144
  radius="full"
145
145
  style={resolveRadioDotStyle(colors.indicatorColor, indicatorSize.radioDot)}
146
146
  />
147
147
  ) : null}
148
- </Box>
148
+ </View>
149
149
  {hasContent ? (
150
- <Box flex={1} ml="s">
150
+ <View flex={1} ml="s">
151
151
  {isRadioTextContent(input.children) ? (
152
152
  <Text emphasis={labelEmphasis}>{input.children}</Text>
153
153
  ) : (
154
154
  input.children
155
155
  )}
156
- </Box>
156
+ </View>
157
157
  ) : null}
158
- </Box>
158
+ </View>
159
159
  );
160
160
  }
161
161
 
@@ -0,0 +1,123 @@
1
+ import React from 'react';
2
+
3
+ import {
4
+ type InteractionState,
5
+ resolveFieldState,
6
+ resolveIndicatorSize,
7
+ resolveSelectionControlColors,
8
+ resolveSelectionControlNextChecked,
9
+ } from '../../../../../internal/resolvers';
10
+ import { useControllableState } from '../../../../../internal/useControllableState';
11
+ import { ButtonBase } from '../../../../../primitives/button-base';
12
+ import { useTheme } from '../../../../../theme/ThemeContext';
13
+ import type { SwitchProps } from '../../../../../types/switch';
14
+ import { View } from '../../../../layout/public';
15
+ import { Text } from '../../../../typography/public';
16
+
17
+ /*** Renders a controlled or uncontrolled accessible switch. */
18
+ export function Switch({
19
+ children,
20
+ checked,
21
+ defaultChecked = false,
22
+ onCheckedChange,
23
+ color = 'primary',
24
+ size = 'm',
25
+ disabled = false,
26
+ invalid = false,
27
+ readOnly = false,
28
+ accessibilityLabel,
29
+ testID,
30
+ ...props
31
+ }: SwitchProps) {
32
+ const { theme } = useTheme();
33
+ const [isChecked, setChecked] = useControllableState<boolean>({
34
+ value: checked,
35
+ defaultValue: defaultChecked,
36
+ onChange: onCheckedChange,
37
+ });
38
+ const nextChecked = resolveSelectionControlNextChecked({
39
+ checked: isChecked,
40
+ disabled,
41
+ kind: 'switch',
42
+ readOnly,
43
+ });
44
+
45
+ return (
46
+ <ButtonBase
47
+ {...props}
48
+ accessibilityLabel={accessibilityLabel}
49
+ accessibilityRole="switch"
50
+ accessibilityState={{ checked: isChecked }}
51
+ disabled={disabled}
52
+ onPress={nextChecked === null ? undefined : () => setChecked(nextChecked)}
53
+ testID={testID}
54
+ >
55
+ {(interactionState) =>
56
+ renderSwitchContent(
57
+ { children, color, disabled, invalid, isChecked, readOnly, size, theme },
58
+ interactionState,
59
+ )
60
+ }
61
+ </ButtonBase>
62
+ );
63
+ }
64
+
65
+ interface SwitchContentInput {
66
+ children: React.ReactNode;
67
+ color: NonNullable<SwitchProps['color']>;
68
+ disabled: boolean;
69
+ invalid: boolean;
70
+ isChecked: boolean;
71
+ readOnly: boolean;
72
+ size: NonNullable<SwitchProps['size']>;
73
+ theme: ReturnType<typeof useTheme>['theme'];
74
+ }
75
+
76
+ /*** Resolves switch presentation for one interaction state and renders the visual control. */
77
+ function renderSwitchContent(input: SwitchContentInput, interactionState: InteractionState) {
78
+ const fieldState = resolveFieldState({
79
+ disabled: input.disabled,
80
+ focused: interactionState.focused,
81
+ invalid: input.invalid,
82
+ readOnly: input.readOnly,
83
+ });
84
+ const colors = resolveSelectionControlColors(input.theme, {
85
+ checked: input.isChecked,
86
+ fieldState,
87
+ hovered: interactionState.hovered,
88
+ pressed: interactionState.pressed,
89
+ color: input.color,
90
+ });
91
+ const indicatorSize = resolveIndicatorSize(input.size);
92
+ const labelEmphasis =
93
+ colors.labelColor === input.theme.semantics.content.muted ? 'muted' : 'default';
94
+
95
+ return (
96
+ <View align="center" direction="row" opacity={colors.opacity}>
97
+ <View
98
+ bg={colors.trackColor}
99
+ borderColor={colors.borderColor}
100
+ borderWidth={1}
101
+ height={indicatorSize.switchHeight}
102
+ justify="center"
103
+ minWidth={indicatorSize.switchWidth}
104
+ px={2}
105
+ radius="full"
106
+ width={indicatorSize.switchWidth}
107
+ >
108
+ <View
109
+ alignSelf={input.isChecked ? 'flex-end' : 'flex-start'}
110
+ bg={colors.thumbColor}
111
+ height={indicatorSize.switchThumb}
112
+ radius="full"
113
+ width={indicatorSize.switchThumb}
114
+ />
115
+ </View>
116
+ {input.children ? (
117
+ <View ml="s">
118
+ <Text emphasis={labelEmphasis}>{input.children}</Text>
119
+ </View>
120
+ ) : null}
121
+ </View>
122
+ );
123
+ }
@@ -0,0 +1,2 @@
1
+ export type { SwitchProps } from '../../../types/switch';
2
+ export { Switch } from './adapters/inbound/Switch';
@@ -1,5 +1,12 @@
1
1
  import React from 'react';
2
- import { Platform, TextInput as ReactNativeTextInput, View, type ViewStyle } from 'react-native';
2
+ import {
3
+ Platform,
4
+ type StyleProp,
5
+ TextInput as ReactNativeTextInput,
6
+ type TextStyle,
7
+ View,
8
+ type ViewStyle,
9
+ } from 'react-native';
3
10
 
4
11
  import { resolveFocusRingStyles } from '../../../../../internal/resolvers';
5
12
  import { useTheme } from '../../../../../theme/ThemeContext';
@@ -39,9 +46,7 @@ export function TextInput(props: TextInputProps) {
39
46
  nativeProps.onBlur?.(event);
40
47
  }}
41
48
  onChangeText={(nextValue) => {
42
- if (interactionPolicy !== 'passive') {
43
- nativeProps.onChangeText?.(nextValue);
44
- }
49
+ if (interactionPolicy !== 'passive') nativeProps.onChangeText?.(nextValue);
45
50
  }}
46
51
  onFocus={(event) => {
47
52
  setFocused(true);
@@ -49,13 +54,24 @@ export function TextInput(props: TextInputProps) {
49
54
  }}
50
55
  placeholderTextColor={presentation.placeholderColor}
51
56
  readOnly={readOnly}
52
- style={[presentation.inputStyle, nativeProps.style]}
57
+ style={resolveInputStyle(presentation.inputStyle, nativeProps.multiline, nativeProps.style)}
53
58
  />
54
59
  {renderAccessory(trailingAccessory, presentation.accessorySpacing, 'trailing')}
55
60
  </View>
56
61
  );
57
62
  }
58
63
 
64
+ const multilineInputStyle: TextStyle = { textAlignVertical: 'top' };
65
+
66
+ /*** Resolves TextInput style composition including canonical multiline alignment. */
67
+ function resolveInputStyle(
68
+ presentationStyle: StyleProp<TextStyle>,
69
+ multiline: boolean | undefined,
70
+ style: StyleProp<TextStyle>,
71
+ ): StyleProp<TextStyle> {
72
+ return [presentationStyle, multiline ? multilineInputStyle : undefined, style];
73
+ }
74
+
59
75
  /*** Renders one optional TextInput accessory with directional spacing. */
60
76
  function renderAccessory(
61
77
  accessory: React.ReactNode,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import type { DividerProps } from '../../../../types/layout';
4
- import { Box } from './Box';
4
+ import { View } from './View';
5
5
 
6
6
  /*** Renders a horizontal or vertical separator using layout tokens. */
7
7
  export function Divider({
@@ -11,7 +11,7 @@ export function Divider({
11
11
  ...props
12
12
  }: DividerProps) {
13
13
  return (
14
- <Box
14
+ <View
15
15
  {...props}
16
16
  bg={color}
17
17
  height={orientation === 'horizontal' ? thickness : '100%'}
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { View, type ViewStyle } from 'react-native';
2
+ import { View as ReactNativeView, type ViewStyle } from 'react-native';
3
3
 
4
4
  import { resolveResponsive, useResponsiveRuntime } from '../../../../core/responsive';
5
5
  import { useTheme } from '../../../../theme/ThemeContext';
6
6
  import type { GridProps } from '../../../../types/layout';
7
7
  import { resolveSpacing } from '../../../../utils/resolveSpacing';
8
- import { Box } from './Box';
8
+ import { View } from './View';
9
9
 
10
10
  /*** Lays out children in a responsive wrapping grid. */
11
11
  export function Grid({
@@ -31,18 +31,16 @@ export function Grid({
31
31
  const basisPercent: `${number}%` = `${100 / activeCols}%`;
32
32
 
33
33
  return (
34
- <Box {...props}>
35
- <View style={resolveGridStyle(rowSpacing, colSpacing)}>
36
- {React.Children.toArray(children).map((node, index) => (
37
- <View
38
- key={String(index)}
39
- style={resolveGridItemStyle(activeMinItemWidth, basisPercent, rowSpacing, colSpacing)}
40
- >
41
- {node}
42
- </View>
43
- ))}
44
- </View>
45
- </Box>
34
+ <View {...props} style={[resolveGridStyle(rowSpacing, colSpacing), props.style]}>
35
+ {React.Children.toArray(children).map((node, index) => (
36
+ <ReactNativeView
37
+ key={React.isValidElement(node) && node.key !== null ? String(node.key) : String(index)}
38
+ style={resolveGridItemStyle(activeMinItemWidth, basisPercent, rowSpacing, colSpacing)}
39
+ >
40
+ {node}
41
+ </ReactNativeView>
42
+ ))}
43
+ </View>
46
44
  );
47
45
  }
48
46