@ankhorage/surface 4.2.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 (577) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/components/field/Field.js +1 -1
  3. package/dist/components/field/Field.js.map +1 -1
  4. package/dist/components/helper-text/HelperText.js +1 -1
  5. package/dist/components/helper-text/HelperText.js.map +1 -1
  6. package/dist/components/label/Label.js +1 -1
  7. package/dist/components/label/Label.js.map +1 -1
  8. package/dist/components/list-item/ListItem.js +2 -2
  9. package/dist/components/list-item/ListItem.js.map +1 -1
  10. package/dist/components/menu/Menu.d.ts.map +1 -1
  11. package/dist/components/menu/Menu.js +4 -2
  12. package/dist/components/menu/Menu.js.map +1 -1
  13. package/dist/components/modal/Modal.d.ts.map +1 -1
  14. package/dist/components/modal/Modal.js +2 -1
  15. package/dist/components/modal/Modal.js.map +1 -1
  16. package/dist/components/switch/Switch.js +2 -2
  17. package/dist/components/switch/Switch.js.map +1 -1
  18. package/dist/components/tabs/Tab.js +2 -2
  19. package/dist/components/tabs/Tab.js.map +1 -1
  20. package/dist/components/tabs/TabList.js +1 -1
  21. package/dist/components/tabs/TabList.js.map +1 -1
  22. package/dist/components/tabs/Tabs.js +1 -1
  23. package/dist/components/tabs/Tabs.js.map +1 -1
  24. package/dist/components/textarea/Textarea.js +1 -1
  25. package/dist/components/textarea/Textarea.js.map +1 -1
  26. package/dist/components/textarea/types.d.ts +1 -1
  27. package/dist/components/textarea/types.d.ts.map +1 -1
  28. package/dist/components/textarea/types.js.map +1 -1
  29. package/dist/components/toast/Toast.d.ts.map +1 -1
  30. package/dist/components/toast/Toast.js +4 -2
  31. package/dist/components/toast/Toast.js.map +1 -1
  32. package/dist/components/toast/ToastProvider.js +1 -1
  33. package/dist/components/toast/ToastProvider.js.map +1 -1
  34. package/dist/components/tooltip/Tooltip.js +2 -2
  35. package/dist/components/tooltip/Tooltip.js.map +1 -1
  36. package/dist/examples/DocsExamples.js +6 -6
  37. package/dist/examples/DocsExamples.js.map +1 -1
  38. package/dist/features/badge/adapters/inbound/Badge.d.ts +5 -0
  39. package/dist/features/badge/adapters/inbound/Badge.d.ts.map +1 -0
  40. package/dist/features/badge/adapters/inbound/Badge.js +30 -0
  41. package/dist/features/badge/adapters/inbound/Badge.js.map +1 -0
  42. package/dist/features/badge/public.d.ts +3 -0
  43. package/dist/features/badge/public.d.ts.map +1 -0
  44. package/dist/features/badge/public.js +2 -0
  45. package/dist/features/badge/public.js.map +1 -0
  46. package/dist/{components/button → features/button/adapters/inbound}/Button.d.ts +2 -1
  47. package/dist/features/button/adapters/inbound/Button.d.ts.map +1 -0
  48. package/dist/features/button/adapters/inbound/Button.js +60 -0
  49. package/dist/features/button/adapters/inbound/Button.js.map +1 -0
  50. package/dist/{components/icon-button → features/button/adapters/inbound}/IconButton.d.ts +2 -1
  51. package/dist/features/button/adapters/inbound/IconButton.d.ts.map +1 -0
  52. package/dist/features/button/adapters/inbound/IconButton.js +33 -0
  53. package/dist/features/button/adapters/inbound/IconButton.js.map +1 -0
  54. package/dist/features/button/public.d.ts +4 -0
  55. package/dist/features/button/public.d.ts.map +1 -0
  56. package/dist/features/button/public.js +3 -0
  57. package/dist/features/button/public.js.map +1 -0
  58. package/dist/features/card/adapters/inbound/Card.d.ts +5 -0
  59. package/dist/features/card/adapters/inbound/Card.d.ts.map +1 -0
  60. package/dist/features/card/adapters/inbound/Card.js +44 -0
  61. package/dist/features/card/adapters/inbound/Card.js.map +1 -0
  62. package/dist/features/card/public.d.ts +3 -0
  63. package/dist/features/card/public.d.ts.map +1 -0
  64. package/dist/features/card/public.js +2 -0
  65. package/dist/features/card/public.js.map +1 -0
  66. package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts +5 -0
  67. package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts.map +1 -0
  68. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +88 -0
  69. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -0
  70. package/dist/features/form/checkbox/public.d.ts +3 -0
  71. package/dist/features/form/checkbox/public.d.ts.map +1 -0
  72. package/dist/features/form/checkbox/public.js +2 -0
  73. package/dist/features/form/checkbox/public.js.map +1 -0
  74. package/dist/features/form/radio/adapters/inbound/Radio.d.ts +5 -0
  75. package/dist/features/form/radio/adapters/inbound/Radio.d.ts.map +1 -0
  76. package/dist/features/form/radio/adapters/inbound/Radio.js +91 -0
  77. package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -0
  78. package/dist/features/form/radio/public.d.ts +3 -0
  79. package/dist/features/form/radio/public.d.ts.map +1 -0
  80. package/dist/features/form/radio/public.js +2 -0
  81. package/dist/features/form/radio/public.js.map +1 -0
  82. package/dist/features/form/radio/utils/isRadioTextContent.d.ts +4 -0
  83. package/dist/features/form/radio/utils/isRadioTextContent.d.ts.map +1 -0
  84. package/dist/features/form/radio/utils/isRadioTextContent.js +5 -0
  85. package/dist/features/form/radio/utils/isRadioTextContent.js.map +1 -0
  86. package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts +5 -0
  87. package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -0
  88. package/dist/features/form/text-input/adapters/inbound/TextInput.js +41 -0
  89. package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -0
  90. package/dist/features/form/text-input/public.d.ts +3 -0
  91. package/dist/features/form/text-input/public.d.ts.map +1 -0
  92. package/dist/features/form/text-input/public.js +2 -0
  93. package/dist/features/form/text-input/public.js.map +1 -0
  94. package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts +15 -0
  95. package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts.map +1 -0
  96. package/dist/features/form/text-input/utils/resolveTextInputPresentation.js +56 -0
  97. package/dist/features/form/text-input/utils/resolveTextInputPresentation.js.map +1 -0
  98. package/dist/features/icon/adapters/inbound/Icon.d.ts +4 -0
  99. package/dist/features/icon/adapters/inbound/Icon.d.ts.map +1 -0
  100. package/dist/{primitives/icon → features/icon/adapters/inbound}/Icon.js +3 -3
  101. package/dist/features/icon/adapters/inbound/Icon.js.map +1 -0
  102. package/dist/features/icon/adapters/inbound/PortableIcon.d.ts +19 -0
  103. package/dist/features/icon/adapters/inbound/PortableIcon.d.ts.map +1 -0
  104. package/dist/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.js +37 -43
  105. package/dist/features/icon/adapters/inbound/PortableIcon.js.map +1 -0
  106. package/dist/features/icon/constants.d.ts +2 -0
  107. package/dist/features/icon/constants.d.ts.map +1 -0
  108. package/dist/features/icon/constants.js +8 -0
  109. package/dist/features/icon/constants.js.map +1 -0
  110. package/dist/features/icon/public.d.ts +4 -0
  111. package/dist/features/icon/public.d.ts.map +1 -0
  112. package/dist/features/icon/public.js +3 -0
  113. package/dist/features/icon/public.js.map +1 -0
  114. package/dist/{primitives/image → features/image/adapters/inbound}/Image.d.ts +2 -1
  115. package/dist/features/image/adapters/inbound/Image.d.ts.map +1 -0
  116. package/dist/features/image/adapters/inbound/Image.js +28 -0
  117. package/dist/features/image/adapters/inbound/Image.js.map +1 -0
  118. package/dist/features/image/public.d.ts +3 -0
  119. package/dist/features/image/public.d.ts.map +1 -0
  120. package/dist/features/image/public.js +2 -0
  121. package/dist/features/image/public.js.map +1 -0
  122. package/dist/features/image/utils/getSourceKey.d.ts +4 -0
  123. package/dist/features/image/utils/getSourceKey.d.ts.map +1 -0
  124. package/dist/features/image/utils/getSourceKey.js +33 -0
  125. package/dist/features/image/utils/getSourceKey.js.map +1 -0
  126. package/dist/features/image/utils/normalizeSource.d.ts +5 -0
  127. package/dist/features/image/utils/normalizeSource.d.ts.map +1 -0
  128. package/dist/features/image/utils/normalizeSource.js +9 -0
  129. package/dist/features/image/utils/normalizeSource.js.map +1 -0
  130. package/dist/features/image/utils/resolveAccessibilityLabel.d.ts +4 -0
  131. package/dist/features/image/utils/resolveAccessibilityLabel.d.ts.map +1 -0
  132. package/dist/features/image/utils/resolveAccessibilityLabel.js +5 -0
  133. package/dist/features/image/utils/resolveAccessibilityLabel.js.map +1 -0
  134. package/dist/features/image/utils/resolveAlt.d.ts +4 -0
  135. package/dist/features/image/utils/resolveAlt.d.ts.map +1 -0
  136. package/dist/features/image/utils/resolveAlt.js +5 -0
  137. package/dist/features/image/utils/resolveAlt.js.map +1 -0
  138. package/dist/features/image/utils/resolveImageStyle.d.ts +6 -0
  139. package/dist/features/image/utils/resolveImageStyle.d.ts.map +1 -0
  140. package/dist/features/image/utils/resolveImageStyle.js +15 -0
  141. package/dist/features/image/utils/resolveImageStyle.js.map +1 -0
  142. package/dist/features/image/utils/resolveRenderedSource.d.ts +4 -0
  143. package/dist/features/image/utils/resolveRenderedSource.d.ts.map +1 -0
  144. package/dist/features/image/utils/resolveRenderedSource.js +7 -0
  145. package/dist/features/image/utils/resolveRenderedSource.js.map +1 -0
  146. package/dist/features/image/utils/resolveResizeMode.d.ts +5 -0
  147. package/dist/features/image/utils/resolveResizeMode.d.ts.map +1 -0
  148. package/dist/features/image/utils/resolveResizeMode.js +5 -0
  149. package/dist/features/image/utils/resolveResizeMode.js.map +1 -0
  150. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.d.ts +5 -0
  151. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.d.ts.map +1 -0
  152. package/dist/{layout → features/keyboard-avoiding-view/adapters/inbound}/KeyboardAvoidingView.js +2 -2
  153. package/dist/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.js.map +1 -0
  154. package/dist/features/keyboard-avoiding-view/public.d.ts +3 -0
  155. package/dist/features/keyboard-avoiding-view/public.d.ts.map +1 -0
  156. package/dist/features/keyboard-avoiding-view/public.js +2 -0
  157. package/dist/features/keyboard-avoiding-view/public.js.map +1 -0
  158. package/dist/features/layout/adapters/inbound/Box.d.ts +5 -0
  159. package/dist/features/layout/adapters/inbound/Box.d.ts.map +1 -0
  160. package/dist/{layout → features/layout/adapters/inbound}/Box.js +5 -4
  161. package/dist/features/layout/adapters/inbound/Box.js.map +1 -0
  162. package/dist/features/layout/adapters/inbound/Container.d.ts +5 -0
  163. package/dist/features/layout/adapters/inbound/Container.d.ts.map +1 -0
  164. package/dist/features/layout/adapters/inbound/Container.js +28 -0
  165. package/dist/features/layout/adapters/inbound/Container.js.map +1 -0
  166. package/dist/features/layout/adapters/inbound/Divider.d.ts +5 -0
  167. package/dist/features/layout/adapters/inbound/Divider.d.ts.map +1 -0
  168. package/dist/{layout → features/layout/adapters/inbound}/Divider.js +1 -0
  169. package/dist/features/layout/adapters/inbound/Divider.js.map +1 -0
  170. package/dist/features/layout/adapters/inbound/Grid.d.ts +5 -0
  171. package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -0
  172. package/dist/features/layout/adapters/inbound/Grid.js +48 -0
  173. package/dist/features/layout/adapters/inbound/Grid.js.map +1 -0
  174. package/dist/features/layout/adapters/inbound/Stack.d.ts +5 -0
  175. package/dist/features/layout/adapters/inbound/Stack.d.ts.map +1 -0
  176. package/dist/{layout → features/layout/adapters/inbound}/Stack.js +4 -3
  177. package/dist/features/layout/adapters/inbound/Stack.js.map +1 -0
  178. package/dist/features/layout/public.d.ts +7 -0
  179. package/dist/features/layout/public.d.ts.map +1 -0
  180. package/dist/features/layout/public.js +6 -0
  181. package/dist/features/layout/public.js.map +1 -0
  182. package/dist/features/surface/adapters/inbound/Surface.d.ts +5 -0
  183. package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -0
  184. package/dist/{layout → features/surface/adapters/inbound}/Surface.js +17 -28
  185. package/dist/features/surface/adapters/inbound/Surface.js.map +1 -0
  186. package/dist/features/surface/public.d.ts +3 -0
  187. package/dist/features/surface/public.d.ts.map +1 -0
  188. package/dist/features/surface/public.js +2 -0
  189. package/dist/features/surface/public.js.map +1 -0
  190. package/dist/features/typography/adapters/inbound/Heading.d.ts +5 -0
  191. package/dist/features/typography/adapters/inbound/Heading.d.ts.map +1 -0
  192. package/dist/features/typography/adapters/inbound/Heading.js +29 -0
  193. package/dist/features/typography/adapters/inbound/Heading.js.map +1 -0
  194. package/dist/{primitives/text → features/typography/adapters/inbound}/Text.d.ts +2 -1
  195. package/dist/features/typography/adapters/inbound/Text.d.ts.map +1 -0
  196. package/dist/{primitives/text → features/typography/adapters/inbound}/Text.js +18 -25
  197. package/dist/features/typography/adapters/inbound/Text.js.map +1 -0
  198. package/dist/features/typography/public.d.ts +4 -0
  199. package/dist/features/typography/public.d.ts.map +1 -0
  200. package/dist/features/typography/public.js +3 -0
  201. package/dist/features/typography/public.js.map +1 -0
  202. package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts +7 -0
  203. package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts.map +1 -0
  204. package/dist/features/typography/utils/resolveHeadingTextStyle.js +10 -0
  205. package/dist/features/typography/utils/resolveHeadingTextStyle.js.map +1 -0
  206. package/dist/index.d.ts +24 -22
  207. package/dist/index.d.ts.map +1 -1
  208. package/dist/index.js +12 -11
  209. package/dist/index.js.map +1 -1
  210. package/dist/layout/AppBar.d.ts +1 -1
  211. package/dist/layout/AppBar.d.ts.map +1 -1
  212. package/dist/layout/AppBar.js +1 -2
  213. package/dist/layout/AppBar.js.map +1 -1
  214. package/dist/layout/Center.d.ts +1 -1
  215. package/dist/layout/Center.d.ts.map +1 -1
  216. package/dist/layout/Center.js +1 -1
  217. package/dist/layout/Center.js.map +1 -1
  218. package/dist/layout/Inline.d.ts +1 -1
  219. package/dist/layout/Inline.d.ts.map +1 -1
  220. package/dist/layout/Inline.js +1 -1
  221. package/dist/layout/Inline.js.map +1 -1
  222. package/dist/layout/ScrollArea.d.ts +1 -1
  223. package/dist/layout/ScrollArea.d.ts.map +1 -1
  224. package/dist/layout/ScrollArea.js +1 -1
  225. package/dist/layout/ScrollArea.js.map +1 -1
  226. package/dist/layout/Spacer.d.ts +1 -1
  227. package/dist/layout/Spacer.d.ts.map +1 -1
  228. package/dist/layout/Spacer.js +1 -1
  229. package/dist/layout/Spacer.js.map +1 -1
  230. package/dist/layout/Template.d.ts +2 -2
  231. package/dist/layout/Template.d.ts.map +1 -1
  232. package/dist/layout/Template.js +2 -2
  233. package/dist/layout/Template.js.map +1 -1
  234. package/dist/layout/index.d.ts +0 -14
  235. package/dist/layout/index.d.ts.map +1 -1
  236. package/dist/layout/index.js +0 -7
  237. package/dist/layout/index.js.map +1 -1
  238. package/dist/primitives/button-base/ButtonBase.js +1 -1
  239. package/dist/primitives/button-base/ButtonBase.js.map +1 -1
  240. package/dist/primitives/button-base/types.d.ts +1 -1
  241. package/dist/primitives/button-base/types.d.ts.map +1 -1
  242. package/dist/primitives/button-base/types.js.map +1 -1
  243. package/dist/types/badge.d.ts +12 -0
  244. package/dist/types/badge.d.ts.map +1 -0
  245. package/dist/types/badge.js +2 -0
  246. package/dist/types/badge.js.map +1 -0
  247. package/dist/types/button.d.ts +25 -0
  248. package/dist/types/button.d.ts.map +1 -0
  249. package/dist/types/button.js +2 -0
  250. package/dist/types/button.js.map +1 -0
  251. package/dist/{components/card/types.d.ts → types/card.d.ts} +2 -2
  252. package/dist/types/card.d.ts.map +1 -0
  253. package/dist/types/card.js +2 -0
  254. package/dist/types/card.js.map +1 -0
  255. package/dist/{components/checkbox/types.d.ts → types/checkbox.d.ts} +4 -4
  256. package/dist/types/checkbox.d.ts.map +1 -0
  257. package/dist/types/checkbox.js +2 -0
  258. package/dist/types/checkbox.js.map +1 -0
  259. package/dist/types/icon.d.ts +66 -0
  260. package/dist/types/icon.d.ts.map +1 -0
  261. package/dist/types/icon.js +2 -0
  262. package/dist/types/icon.js.map +1 -0
  263. package/dist/{primitives/image/types.d.ts → types/image.d.ts} +3 -4
  264. package/dist/types/image.d.ts.map +1 -0
  265. package/dist/types/image.js +2 -0
  266. package/dist/types/image.js.map +1 -0
  267. package/dist/types/keyboard-avoiding-view.d.ts +4 -0
  268. package/dist/types/keyboard-avoiding-view.d.ts.map +1 -0
  269. package/dist/types/keyboard-avoiding-view.js +2 -0
  270. package/dist/types/keyboard-avoiding-view.js.map +1 -0
  271. package/dist/{layout/helpers.d.ts → types/layout.d.ts} +39 -5
  272. package/dist/types/layout.d.ts.map +1 -0
  273. package/dist/types/layout.js +2 -0
  274. package/dist/types/layout.js.map +1 -0
  275. package/dist/{components/radio/types.d.ts → types/radio.d.ts} +4 -4
  276. package/dist/types/radio.d.ts.map +1 -0
  277. package/dist/types/radio.js +2 -0
  278. package/dist/types/radio.js.map +1 -0
  279. package/dist/types/surface.d.ts +6 -0
  280. package/dist/types/surface.d.ts.map +1 -0
  281. package/dist/types/surface.js +2 -0
  282. package/dist/types/surface.js.map +1 -0
  283. package/dist/{components/text-input/types.d.ts → types/text-input.d.ts} +3 -3
  284. package/dist/types/text-input.d.ts.map +1 -0
  285. package/dist/types/text-input.js +2 -0
  286. package/dist/types/text-input.js.map +1 -0
  287. package/dist/types/typography.d.ts +29 -0
  288. package/dist/types/typography.d.ts.map +1 -0
  289. package/dist/types/typography.js +2 -0
  290. package/dist/types/typography.js.map +1 -0
  291. package/dist/utils/resolveBoxStyles.d.ts +7 -0
  292. package/dist/utils/resolveBoxStyles.d.ts.map +1 -0
  293. package/dist/utils/resolveBoxStyles.js +83 -0
  294. package/dist/utils/resolveBoxStyles.js.map +1 -0
  295. package/dist/utils/resolveSpacing.d.ts +5 -0
  296. package/dist/utils/resolveSpacing.d.ts.map +1 -0
  297. package/dist/utils/resolveSpacing.js +6 -0
  298. package/dist/utils/resolveSpacing.js.map +1 -0
  299. package/package.json +1 -1
  300. package/src/components/field/Field.tsx +1 -1
  301. package/src/components/helper-text/HelperText.tsx +1 -1
  302. package/src/components/label/Label.tsx +1 -1
  303. package/src/components/list-item/ListItem.tsx +2 -2
  304. package/src/components/menu/Menu.tsx +4 -2
  305. package/src/components/modal/Modal.tsx +2 -1
  306. package/src/components/switch/Switch.tsx +2 -2
  307. package/src/components/tabs/Tab.tsx +2 -2
  308. package/src/components/tabs/TabList.tsx +1 -1
  309. package/src/components/tabs/Tabs.tsx +1 -1
  310. package/src/components/textarea/Textarea.tsx +1 -1
  311. package/src/components/textarea/types.ts +1 -1
  312. package/src/components/toast/Toast.tsx +4 -2
  313. package/src/components/toast/ToastProvider.tsx +1 -1
  314. package/src/components/tooltip/Tooltip.tsx +2 -2
  315. package/src/examples/DocsExamples.tsx +6 -6
  316. package/src/features/badge/adapters/inbound/Badge.tsx +58 -0
  317. package/src/features/badge/public.ts +2 -0
  318. package/src/features/button/adapters/inbound/Button.tsx +159 -0
  319. package/src/features/button/adapters/inbound/IconButton.tsx +69 -0
  320. package/src/features/button/public.ts +3 -0
  321. package/src/features/card/adapters/inbound/Card.tsx +88 -0
  322. package/src/features/card/public.ts +2 -0
  323. package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +207 -0
  324. package/src/features/form/checkbox/public.ts +2 -0
  325. package/src/{components/radio → features/form/radio/adapters/inbound}/Radio.test.ts +5 -5
  326. package/src/features/form/radio/adapters/inbound/Radio.tsx +214 -0
  327. package/src/features/form/radio/public.ts +2 -0
  328. package/src/{components/radio → features/form/radio/utils}/isRadioTextContent.ts +1 -3
  329. package/src/features/form/text-input/adapters/inbound/TextInput.tsx +72 -0
  330. package/src/features/form/text-input/public.ts +2 -0
  331. package/src/features/form/text-input/utils/resolveTextInputPresentation.ts +91 -0
  332. package/src/features/icon/adapters/inbound/Icon.tsx +14 -0
  333. package/src/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.tsx +41 -97
  334. package/src/{primitives/icon → features/icon/adapters/inbound}/PortableIcon.web.test.tsx +6 -10
  335. package/src/features/icon/constants.ts +9 -0
  336. package/src/features/icon/public.ts +10 -0
  337. package/src/features/image/adapters/inbound/Image.tsx +55 -0
  338. package/src/features/image/public.ts +2 -0
  339. package/src/features/image/utils/getSourceKey.ts +32 -0
  340. package/src/features/image/utils/normalizeSource.ts +12 -0
  341. package/src/features/image/utils/resolveAccessibilityLabel.ts +9 -0
  342. package/src/features/image/utils/resolveAlt.ts +9 -0
  343. package/src/{primitives/image → features/image/utils}/resolveImageProps.test.ts +10 -22
  344. package/src/features/image/utils/resolveImageStyle.ts +23 -0
  345. package/src/features/image/utils/resolveRenderedSource.ts +11 -0
  346. package/src/features/image/utils/resolveResizeMode.ts +11 -0
  347. package/src/features/keyboard-avoiding-view/adapters/inbound/KeyboardAvoidingView.tsx +9 -0
  348. package/src/features/keyboard-avoiding-view/public.ts +5 -0
  349. package/src/{layout → features/layout/adapters/inbound}/Box.tsx +7 -15
  350. package/src/features/layout/adapters/inbound/Container.tsx +43 -0
  351. package/src/{layout → features/layout/adapters/inbound}/Divider.tsx +3 -8
  352. package/src/features/layout/adapters/inbound/Grid.tsx +78 -0
  353. package/src/{layout → features/layout/adapters/inbound}/Stack.test.ts +0 -1
  354. package/src/{layout → features/layout/adapters/inbound}/Stack.tsx +6 -15
  355. package/src/features/layout/public.ts +12 -0
  356. package/src/{layout → features/surface/adapters/inbound}/Surface.tsx +24 -41
  357. package/src/features/surface/public.ts +2 -0
  358. package/src/{primitives/heading → features/typography/adapters/inbound}/Heading.tsx +35 -38
  359. package/src/{primitives/text → features/typography/adapters/inbound}/Text.tsx +25 -35
  360. package/src/features/typography/public.ts +3 -0
  361. package/src/{primitives/heading/resolveHeadingStyle.test.ts → features/typography/utils/resolveHeadingTextStyle.test.ts} +5 -12
  362. package/src/features/typography/utils/resolveHeadingTextStyle.ts +21 -0
  363. package/src/index.test.ts +58 -28
  364. package/src/index.ts +37 -26
  365. package/src/layout/AppBar.tsx +1 -2
  366. package/src/layout/Center.tsx +1 -1
  367. package/src/layout/Inline.tsx +1 -1
  368. package/src/layout/ScrollArea.tsx +2 -1
  369. package/src/layout/Spacer.tsx +2 -2
  370. package/src/layout/Template.tsx +3 -2
  371. package/src/layout/index.ts +0 -17
  372. package/src/primitives/button-base/ButtonBase.tsx +1 -1
  373. package/src/primitives/button-base/types.ts +1 -1
  374. package/src/{components/badge/types.ts → types/badge.ts} +3 -3
  375. package/src/types/button.ts +34 -0
  376. package/src/{components/card/types.ts → types/card.ts} +1 -1
  377. package/src/{components/checkbox/types.ts → types/checkbox.ts} +3 -3
  378. package/src/types/icon.ts +52 -0
  379. package/src/{primitives/image/types.ts → types/image.ts} +3 -3
  380. package/src/types/keyboard-avoiding-view.ts +6 -0
  381. package/src/types/layout.ts +96 -0
  382. package/src/{components/radio/types.ts → types/radio.ts} +3 -3
  383. package/src/types/surface.ts +7 -0
  384. package/src/{components/text-input/types.ts → types/text-input.ts} +2 -2
  385. package/src/types/typography.ts +32 -0
  386. package/src/{layout/helpers.test.ts → utils/resolveBoxStyles.test.ts} +8 -25
  387. package/src/utils/resolveBoxStyles.ts +135 -0
  388. package/src/utils/resolveSpacing.ts +11 -0
  389. package/src/webAcceptance.test.tsx +2 -3
  390. package/dist/components/badge/Badge.d.ts +0 -4
  391. package/dist/components/badge/Badge.d.ts.map +0 -1
  392. package/dist/components/badge/Badge.js +0 -30
  393. package/dist/components/badge/Badge.js.map +0 -1
  394. package/dist/components/badge/index.d.ts +0 -3
  395. package/dist/components/badge/index.d.ts.map +0 -1
  396. package/dist/components/badge/index.js +0 -2
  397. package/dist/components/badge/index.js.map +0 -1
  398. package/dist/components/badge/types.d.ts +0 -12
  399. package/dist/components/badge/types.d.ts.map +0 -1
  400. package/dist/components/badge/types.js +0 -2
  401. package/dist/components/badge/types.js.map +0 -1
  402. package/dist/components/button/Button.d.ts.map +0 -1
  403. package/dist/components/button/Button.js +0 -51
  404. package/dist/components/button/Button.js.map +0 -1
  405. package/dist/components/button/index.d.ts +0 -3
  406. package/dist/components/button/index.d.ts.map +0 -1
  407. package/dist/components/button/index.js +0 -2
  408. package/dist/components/button/index.js.map +0 -1
  409. package/dist/components/button/types.d.ts +0 -18
  410. package/dist/components/button/types.d.ts.map +0 -1
  411. package/dist/components/button/types.js +0 -2
  412. package/dist/components/button/types.js.map +0 -1
  413. package/dist/components/card/Card.d.ts +0 -4
  414. package/dist/components/card/Card.d.ts.map +0 -1
  415. package/dist/components/card/Card.js +0 -46
  416. package/dist/components/card/Card.js.map +0 -1
  417. package/dist/components/card/index.d.ts +0 -3
  418. package/dist/components/card/index.d.ts.map +0 -1
  419. package/dist/components/card/index.js +0 -2
  420. package/dist/components/card/index.js.map +0 -1
  421. package/dist/components/card/types.d.ts.map +0 -1
  422. package/dist/components/card/types.js +0 -2
  423. package/dist/components/card/types.js.map +0 -1
  424. package/dist/components/checkbox/Checkbox.d.ts +0 -4
  425. package/dist/components/checkbox/Checkbox.d.ts.map +0 -1
  426. package/dist/components/checkbox/Checkbox.js +0 -69
  427. package/dist/components/checkbox/Checkbox.js.map +0 -1
  428. package/dist/components/checkbox/index.d.ts +0 -3
  429. package/dist/components/checkbox/index.d.ts.map +0 -1
  430. package/dist/components/checkbox/index.js +0 -2
  431. package/dist/components/checkbox/index.js.map +0 -1
  432. package/dist/components/checkbox/types.d.ts.map +0 -1
  433. package/dist/components/checkbox/types.js +0 -2
  434. package/dist/components/checkbox/types.js.map +0 -1
  435. package/dist/components/icon-button/IconButton.d.ts.map +0 -1
  436. package/dist/components/icon-button/IconButton.js +0 -28
  437. package/dist/components/icon-button/IconButton.js.map +0 -1
  438. package/dist/components/icon-button/index.d.ts +0 -3
  439. package/dist/components/icon-button/index.d.ts.map +0 -1
  440. package/dist/components/icon-button/index.js +0 -2
  441. package/dist/components/icon-button/index.js.map +0 -1
  442. package/dist/components/icon-button/types.d.ts +0 -13
  443. package/dist/components/icon-button/types.d.ts.map +0 -1
  444. package/dist/components/icon-button/types.js +0 -2
  445. package/dist/components/icon-button/types.js.map +0 -1
  446. package/dist/components/radio/Radio.d.ts +0 -7
  447. package/dist/components/radio/Radio.d.ts.map +0 -1
  448. package/dist/components/radio/Radio.js +0 -75
  449. package/dist/components/radio/Radio.js.map +0 -1
  450. package/dist/components/radio/index.d.ts +0 -3
  451. package/dist/components/radio/index.d.ts.map +0 -1
  452. package/dist/components/radio/index.js +0 -2
  453. package/dist/components/radio/index.js.map +0 -1
  454. package/dist/components/radio/isRadioTextContent.d.ts +0 -6
  455. package/dist/components/radio/isRadioTextContent.d.ts.map +0 -1
  456. package/dist/components/radio/isRadioTextContent.js +0 -7
  457. package/dist/components/radio/isRadioTextContent.js.map +0 -1
  458. package/dist/components/radio/types.d.ts.map +0 -1
  459. package/dist/components/radio/types.js +0 -2
  460. package/dist/components/radio/types.js.map +0 -1
  461. package/dist/components/text-input/TextInput.d.ts +0 -4
  462. package/dist/components/text-input/TextInput.d.ts.map +0 -1
  463. package/dist/components/text-input/TextInput.js +0 -72
  464. package/dist/components/text-input/TextInput.js.map +0 -1
  465. package/dist/components/text-input/index.d.ts +0 -3
  466. package/dist/components/text-input/index.d.ts.map +0 -1
  467. package/dist/components/text-input/index.js +0 -2
  468. package/dist/components/text-input/index.js.map +0 -1
  469. package/dist/components/text-input/types.d.ts.map +0 -1
  470. package/dist/components/text-input/types.js +0 -2
  471. package/dist/components/text-input/types.js.map +0 -1
  472. package/dist/layout/Box.d.ts +0 -14
  473. package/dist/layout/Box.d.ts.map +0 -1
  474. package/dist/layout/Box.js.map +0 -1
  475. package/dist/layout/Container.d.ts +0 -11
  476. package/dist/layout/Container.d.ts.map +0 -1
  477. package/dist/layout/Container.js +0 -24
  478. package/dist/layout/Container.js.map +0 -1
  479. package/dist/layout/Divider.d.ts +0 -10
  480. package/dist/layout/Divider.d.ts.map +0 -1
  481. package/dist/layout/Divider.js.map +0 -1
  482. package/dist/layout/Grid.d.ts +0 -14
  483. package/dist/layout/Grid.d.ts.map +0 -1
  484. package/dist/layout/Grid.js +0 -51
  485. package/dist/layout/Grid.js.map +0 -1
  486. package/dist/layout/KeyboardAvoidingView.d.ts +0 -7
  487. package/dist/layout/KeyboardAvoidingView.d.ts.map +0 -1
  488. package/dist/layout/KeyboardAvoidingView.js.map +0 -1
  489. package/dist/layout/Stack.d.ts +0 -14
  490. package/dist/layout/Stack.d.ts.map +0 -1
  491. package/dist/layout/Stack.js.map +0 -1
  492. package/dist/layout/Surface.d.ts +0 -8
  493. package/dist/layout/Surface.d.ts.map +0 -1
  494. package/dist/layout/Surface.js.map +0 -1
  495. package/dist/layout/helpers.d.ts.map +0 -1
  496. package/dist/layout/helpers.js +0 -91
  497. package/dist/layout/helpers.js.map +0 -1
  498. package/dist/primitives/heading/Heading.d.ts +0 -4
  499. package/dist/primitives/heading/Heading.d.ts.map +0 -1
  500. package/dist/primitives/heading/Heading.js +0 -30
  501. package/dist/primitives/heading/Heading.js.map +0 -1
  502. package/dist/primitives/heading/index.d.ts +0 -3
  503. package/dist/primitives/heading/index.d.ts.map +0 -1
  504. package/dist/primitives/heading/index.js +0 -2
  505. package/dist/primitives/heading/index.js.map +0 -1
  506. package/dist/primitives/heading/resolveHeadingStyle.d.ts +0 -6
  507. package/dist/primitives/heading/resolveHeadingStyle.d.ts.map +0 -1
  508. package/dist/primitives/heading/resolveHeadingStyle.js +0 -9
  509. package/dist/primitives/heading/resolveHeadingStyle.js.map +0 -1
  510. package/dist/primitives/heading/types.d.ts +0 -15
  511. package/dist/primitives/heading/types.d.ts.map +0 -1
  512. package/dist/primitives/heading/types.js +0 -2
  513. package/dist/primitives/heading/types.js.map +0 -1
  514. package/dist/primitives/icon/Icon.d.ts +0 -16
  515. package/dist/primitives/icon/Icon.d.ts.map +0 -1
  516. package/dist/primitives/icon/Icon.js.map +0 -1
  517. package/dist/primitives/icon/PortableIcon.d.ts +0 -70
  518. package/dist/primitives/icon/PortableIcon.d.ts.map +0 -1
  519. package/dist/primitives/icon/PortableIcon.js.map +0 -1
  520. package/dist/primitives/icon/index.d.ts +0 -4
  521. package/dist/primitives/icon/index.d.ts.map +0 -1
  522. package/dist/primitives/icon/index.js +0 -3
  523. package/dist/primitives/icon/index.js.map +0 -1
  524. package/dist/primitives/image/Image.d.ts.map +0 -1
  525. package/dist/primitives/image/Image.js +0 -26
  526. package/dist/primitives/image/Image.js.map +0 -1
  527. package/dist/primitives/image/index.d.ts +0 -3
  528. package/dist/primitives/image/index.d.ts.map +0 -1
  529. package/dist/primitives/image/index.js +0 -2
  530. package/dist/primitives/image/index.js.map +0 -1
  531. package/dist/primitives/image/resolveImageProps.d.ts +0 -12
  532. package/dist/primitives/image/resolveImageProps.d.ts.map +0 -1
  533. package/dist/primitives/image/resolveImageProps.js +0 -67
  534. package/dist/primitives/image/resolveImageProps.js.map +0 -1
  535. package/dist/primitives/image/types.d.ts.map +0 -1
  536. package/dist/primitives/image/types.js +0 -2
  537. package/dist/primitives/image/types.js.map +0 -1
  538. package/dist/primitives/text/Text.d.ts.map +0 -1
  539. package/dist/primitives/text/Text.js.map +0 -1
  540. package/dist/primitives/text/index.d.ts +0 -3
  541. package/dist/primitives/text/index.d.ts.map +0 -1
  542. package/dist/primitives/text/index.js +0 -2
  543. package/dist/primitives/text/index.js.map +0 -1
  544. package/dist/primitives/text/types.d.ts +0 -17
  545. package/dist/primitives/text/types.d.ts.map +0 -1
  546. package/dist/primitives/text/types.js +0 -2
  547. package/dist/primitives/text/types.js.map +0 -1
  548. package/src/components/badge/Badge.tsx +0 -52
  549. package/src/components/badge/index.ts +0 -2
  550. package/src/components/button/Button.tsx +0 -98
  551. package/src/components/button/index.ts +0 -2
  552. package/src/components/button/types.ts +0 -23
  553. package/src/components/card/Card.tsx +0 -81
  554. package/src/components/card/index.ts +0 -2
  555. package/src/components/checkbox/Checkbox.tsx +0 -120
  556. package/src/components/checkbox/index.ts +0 -2
  557. package/src/components/icon-button/IconButton.tsx +0 -55
  558. package/src/components/icon-button/index.ts +0 -2
  559. package/src/components/icon-button/types.ts +0 -16
  560. package/src/components/radio/Radio.tsx +0 -124
  561. package/src/components/radio/index.ts +0 -2
  562. package/src/components/text-input/TextInput.tsx +0 -124
  563. package/src/components/text-input/index.ts +0 -2
  564. package/src/layout/Container.tsx +0 -43
  565. package/src/layout/Grid.tsx +0 -83
  566. package/src/layout/KeyboardAvoidingView.tsx +0 -16
  567. package/src/layout/helpers.ts +0 -205
  568. package/src/primitives/heading/index.ts +0 -2
  569. package/src/primitives/heading/resolveHeadingStyle.ts +0 -20
  570. package/src/primitives/heading/types.ts +0 -17
  571. package/src/primitives/icon/Icon.tsx +0 -34
  572. package/src/primitives/icon/index.ts +0 -10
  573. package/src/primitives/image/Image.tsx +0 -65
  574. package/src/primitives/image/index.ts +0 -2
  575. package/src/primitives/image/resolveImageProps.ts +0 -92
  576. package/src/primitives/text/index.ts +0 -2
  577. package/src/primitives/text/types.ts +0 -18
@@ -1,81 +0,0 @@
1
- import React from 'react';
2
-
3
- import { Surface } from '../../layout';
4
- import { ButtonBase } from '../../primitives/button-base';
5
- import { useTheme } from '../../theme/ThemeContext';
6
- import type { CardProps } from './types';
7
-
8
- function resolveCardStateBackground(
9
- variant: NonNullable<CardProps['variant']>,
10
- pressed: boolean,
11
- hovered: boolean,
12
- themeBackgrounds: {
13
- base: string;
14
- subtle: string;
15
- hover: string;
16
- active: string;
17
- },
18
- ) {
19
- if (variant === 'outline') {
20
- return pressed ? themeBackgrounds.active : hovered ? themeBackgrounds.hover : 'transparent';
21
- }
22
-
23
- if (variant === 'subtle') {
24
- return pressed
25
- ? themeBackgrounds.active
26
- : hovered
27
- ? themeBackgrounds.hover
28
- : themeBackgrounds.subtle;
29
- }
30
-
31
- return pressed
32
- ? themeBackgrounds.active
33
- : hovered
34
- ? themeBackgrounds.hover
35
- : themeBackgrounds.base;
36
- }
37
-
38
- export function Card({
39
- children,
40
- variant = 'default',
41
- onPress,
42
- disabled = false,
43
- testID,
44
- style,
45
- ...props
46
- }: CardProps) {
47
- const { theme } = useTheme();
48
-
49
- if (!onPress) {
50
- return (
51
- <Surface {...props} style={style} testID={testID} variant={variant}>
52
- {children}
53
- </Surface>
54
- );
55
- }
56
-
57
- return (
58
- <ButtonBase accessibilityRole="button" disabled={disabled} onPress={onPress} testID={testID}>
59
- {(state) => (
60
- <Surface
61
- {...props}
62
- style={[
63
- {
64
- backgroundColor: resolveCardStateBackground(variant, state.pressed, state.hovered, {
65
- active: theme.semantics.neutral.surfaceActive,
66
- base: theme.semantics.surface.default,
67
- hover: theme.semantics.neutral.surfaceHover,
68
- subtle: theme.semantics.surface.subtle,
69
- }),
70
- opacity: state.disabled ? 0.72 : 1,
71
- },
72
- style,
73
- ]}
74
- variant={variant}
75
- >
76
- {children}
77
- </Surface>
78
- )}
79
- </ButtonBase>
80
- );
81
- }
@@ -1,2 +0,0 @@
1
- export { Card } from './Card';
2
- export type { CardProps } from './types';
@@ -1,120 +0,0 @@
1
- import React from 'react';
2
-
3
- import {
4
- resolveFieldState,
5
- resolveIndicatorSize,
6
- resolveSelectionControlColors,
7
- resolveSelectionControlNextChecked,
8
- } from '../../internal/resolvers';
9
- import { useControllableState } from '../../internal/useControllableState';
10
- import { Box } from '../../layout';
11
- import { ButtonBase } from '../../primitives/button-base';
12
- import { Text } from '../../primitives/text';
13
- import { useTheme } from '../../theme/ThemeContext';
14
- import type { CheckboxProps } from './types';
15
-
16
- export function Checkbox({
17
- children,
18
- checked,
19
- defaultChecked = false,
20
- onCheckedChange,
21
- color = 'primary',
22
- size = 'm',
23
- disabled = false,
24
- invalid = false,
25
- readOnly = false,
26
- accessibilityLabel,
27
- testID,
28
- ...props
29
- }: CheckboxProps) {
30
- const { theme } = useTheme();
31
- const [isChecked, setChecked] = useControllableState<boolean>({
32
- value: checked,
33
- defaultValue: defaultChecked,
34
- onChange: onCheckedChange,
35
- });
36
- const indicatorSize = resolveIndicatorSize(size);
37
- const nextChecked = resolveSelectionControlNextChecked({
38
- checked: isChecked,
39
- disabled,
40
- kind: 'checkbox',
41
- readOnly,
42
- });
43
-
44
- return (
45
- <ButtonBase
46
- {...props}
47
- accessibilityLabel={accessibilityLabel}
48
- accessibilityRole="checkbox"
49
- accessibilityState={{ checked: isChecked }}
50
- disabled={disabled}
51
- onPress={
52
- nextChecked === null
53
- ? undefined
54
- : () => {
55
- setChecked(nextChecked);
56
- }
57
- }
58
- testID={testID}
59
- >
60
- {(interactionState) => {
61
- const fieldState = resolveFieldState({
62
- disabled,
63
- focused: interactionState.focused,
64
- invalid,
65
- readOnly,
66
- });
67
- const colors = resolveSelectionControlColors(theme, {
68
- checked: isChecked,
69
- fieldState,
70
- hovered: interactionState.hovered,
71
- pressed: interactionState.pressed,
72
- color,
73
- });
74
- const labelEmphasis =
75
- colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
76
- const indicatorColor = fieldState.invalid ? 'error' : color;
77
- const indicatorEmphasis = disabled ? 'muted' : 'inverse';
78
-
79
- return (
80
- <Box
81
- style={{
82
- alignItems: 'center',
83
- flexDirection: 'row',
84
- opacity: colors.opacity,
85
- }}
86
- >
87
- <Box
88
- radius="s"
89
- style={{
90
- alignItems: 'center',
91
- backgroundColor: colors.backgroundColor,
92
- borderColor: colors.borderColor,
93
- borderWidth: 1.5,
94
- height: indicatorSize.checkbox,
95
- justifyContent: 'center',
96
- width: indicatorSize.checkbox,
97
- }}
98
- >
99
- {isChecked ? (
100
- <Text
101
- color={disabled ? undefined : indicatorColor}
102
- emphasis={indicatorEmphasis}
103
- variant="caption"
104
- weight="bold"
105
- >
106
- ✓
107
- </Text>
108
- ) : null}
109
- </Box>
110
- {children ? (
111
- <Box ml="s">
112
- <Text emphasis={labelEmphasis}>{children}</Text>
113
- </Box>
114
- ) : null}
115
- </Box>
116
- );
117
- }}
118
- </ButtonBase>
119
- );
120
- }
@@ -1,2 +0,0 @@
1
- export { Checkbox } from './Checkbox';
2
- export type { CheckboxProps } from './types';
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
-
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 { useTheme } from '../../theme/ThemeContext';
8
- import type { IconButtonProps } from './types';
9
-
10
- export function IconButton({
11
- icon,
12
- accessibilityLabel,
13
- variant = 'ghost',
14
- color = 'primary',
15
- size = 'm',
16
- disabled = false,
17
- onPress,
18
- testID,
19
- ...props
20
- }: IconButtonProps) {
21
- const { theme } = useTheme();
22
- const controlSize = resolveControlSize(theme, size);
23
-
24
- return (
25
- <ButtonBase
26
- {...props}
27
- accessibilityLabel={accessibilityLabel}
28
- disabled={disabled}
29
- onPress={onPress}
30
- testID={testID}
31
- >
32
- {(state) => {
33
- const colors = resolveButtonColors(theme, { color, state, variant });
34
-
35
- return (
36
- <Box
37
- radius={controlSize.borderRadius}
38
- style={{
39
- minHeight: controlSize.minHeight,
40
- minWidth: controlSize.minHeight,
41
- alignItems: 'center',
42
- justifyContent: 'center',
43
- backgroundColor: colors.backgroundColor,
44
- borderColor: colors.borderColor,
45
- borderWidth: variant === 'solid' ? 0 : 1,
46
- opacity: colors.opacity,
47
- }}
48
- >
49
- <Icon {...icon} color={colors.contentColor} size={resolveIconSize(theme, size)} />
50
- </Box>
51
- );
52
- }}
53
- </ButtonBase>
54
- );
55
- }
@@ -1,2 +0,0 @@
1
- export { IconButton } from './IconButton';
2
- export type { IconButtonProps } from './types';
@@ -1,16 +0,0 @@
1
- import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
2
- import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
3
- import type { ButtonBaseProps } from '../../primitives/button-base';
4
- import type { IconSource } from '../../primitives/icon';
5
- import type { SurfaceColor } from '../../surfaceColor';
6
-
7
- export interface IconButtonProps extends Omit<
8
- ButtonBaseProps,
9
- 'children' | 'style' | 'accessibilityLabel'
10
- > {
11
- icon: IconSource;
12
- accessibilityLabel: string;
13
- variant?: ButtonVariant;
14
- color?: SurfaceColor;
15
- size?: ControlSize;
16
- }
@@ -1,124 +0,0 @@
1
- import React from 'react';
2
-
3
- import {
4
- resolveFieldState,
5
- resolveIndicatorSize,
6
- resolveSelectionControlColors,
7
- resolveSelectionControlNextChecked,
8
- } from '../../internal/resolvers';
9
- import { useControllableState } from '../../internal/useControllableState';
10
- import { Box } from '../../layout';
11
- import { ButtonBase } from '../../primitives/button-base';
12
- import { Text } from '../../primitives/text';
13
- import { useTheme } from '../../theme/ThemeContext';
14
- import { isRadioTextContent } from './isRadioTextContent';
15
- import type { RadioProps } from './types';
16
-
17
- /***
18
- * Renders one radio control with either text or structured label content.
19
- */
20
- export function Radio({
21
- children,
22
- checked,
23
- defaultChecked = false,
24
- onCheckedChange,
25
- color = 'primary',
26
- size = 'm',
27
- disabled = false,
28
- invalid = false,
29
- readOnly = false,
30
- accessibilityLabel,
31
- testID,
32
- ...props
33
- }: RadioProps) {
34
- const { theme } = useTheme();
35
- const [isChecked, setChecked] = useControllableState<boolean>({
36
- value: checked,
37
- defaultValue: defaultChecked,
38
- onChange: onCheckedChange,
39
- });
40
- const indicatorSize = resolveIndicatorSize(size);
41
- const nextChecked = resolveSelectionControlNextChecked({
42
- checked: isChecked,
43
- disabled,
44
- kind: 'radio',
45
- readOnly,
46
- });
47
- const hasContent = children !== undefined && children !== null && children !== false;
48
-
49
- return (
50
- <ButtonBase
51
- {...props}
52
- accessibilityLabel={accessibilityLabel}
53
- accessibilityRole="radio"
54
- accessibilityState={{ checked: isChecked }}
55
- disabled={disabled}
56
- onPress={
57
- nextChecked === null
58
- ? undefined
59
- : () => {
60
- setChecked(nextChecked);
61
- }
62
- }
63
- testID={testID}
64
- >
65
- {(interactionState) => {
66
- const fieldState = resolveFieldState({
67
- disabled,
68
- focused: interactionState.focused,
69
- invalid,
70
- readOnly,
71
- });
72
- const colors = resolveSelectionControlColors(theme, {
73
- checked: isChecked,
74
- fieldState,
75
- hovered: interactionState.hovered,
76
- pressed: interactionState.pressed,
77
- color,
78
- });
79
- const labelEmphasis =
80
- colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
81
- const isTextContent = isRadioTextContent(children);
82
-
83
- return (
84
- <Box
85
- style={{
86
- alignItems: 'center',
87
- flexDirection: 'row',
88
- opacity: colors.opacity,
89
- }}
90
- >
91
- <Box
92
- radius="full"
93
- style={{
94
- alignItems: 'center',
95
- backgroundColor: colors.backgroundColor,
96
- borderColor: colors.borderColor,
97
- borderWidth: 1.5,
98
- height: indicatorSize.radio,
99
- justifyContent: 'center',
100
- width: indicatorSize.radio,
101
- }}
102
- >
103
- {isChecked ? (
104
- <Box
105
- radius="full"
106
- style={{
107
- backgroundColor: colors.indicatorColor,
108
- height: indicatorSize.radioDot,
109
- width: indicatorSize.radioDot,
110
- }}
111
- />
112
- ) : null}
113
- </Box>
114
- {hasContent ? (
115
- <Box flex={1} ml="s">
116
- {isTextContent ? <Text emphasis={labelEmphasis}>{children}</Text> : children}
117
- </Box>
118
- ) : null}
119
- </Box>
120
- );
121
- }}
122
- </ButtonBase>
123
- );
124
- }
@@ -1,2 +0,0 @@
1
- export { Radio } from './Radio';
2
- export type { RadioProps } from './types';
@@ -1,124 +0,0 @@
1
- import React from 'react';
2
- import { Platform, TextInput as ReactNativeTextInput, View } from 'react-native';
3
-
4
- import {
5
- resolveControlSize,
6
- resolveFieldState,
7
- resolveFocusRingStyles,
8
- resolveInputColors,
9
- resolveTextStyles,
10
- } from '../../internal/resolvers';
11
- import { useTheme } from '../../theme/ThemeContext';
12
- import type { TextInputProps } from './types';
13
-
14
- export function TextInput({
15
- value,
16
- defaultValue,
17
- onChangeText,
18
- placeholder,
19
- size = 'm',
20
- disabled = false,
21
- readOnly = false,
22
- invalid = false,
23
- leadingAccessory,
24
- trailingAccessory,
25
- interactionPolicy = 'enabled',
26
- style,
27
- testID,
28
- onFocus,
29
- onBlur,
30
- ...props
31
- }: TextInputProps) {
32
- const { theme } = useTheme();
33
- const controlSize = resolveControlSize(theme, size);
34
- const [focused, setFocused] = React.useState(false);
35
- const fieldState = resolveFieldState({
36
- disabled,
37
- focused,
38
- invalid,
39
- readOnly,
40
- });
41
- const colors = resolveInputColors(theme, fieldState);
42
- const resolvedTextStyle = resolveTextStyles(theme, {
43
- variant: controlSize.textVariant,
44
- });
45
- const resolvedLineHeight =
46
- typeof resolvedTextStyle.lineHeight === 'number'
47
- ? resolvedTextStyle.lineHeight
48
- : controlSize.minHeight - controlSize.paddingVertical * 2;
49
- const lineCount = Math.max(props.numberOfLines ?? 1, 1);
50
- const inputMinHeight = props.multiline
51
- ? resolvedLineHeight * lineCount
52
- : controlSize.minHeight - controlSize.paddingVertical * 2;
53
- const containerMinHeight = props.multiline
54
- ? inputMinHeight + controlSize.paddingVertical * 2
55
- : controlSize.minHeight;
56
- const passive = interactionPolicy === 'passive';
57
-
58
- const handleFocus: NonNullable<TextInputProps['onFocus']> = (event) => {
59
- setFocused(true);
60
- onFocus?.(event);
61
- };
62
-
63
- const handleBlur: NonNullable<TextInputProps['onBlur']> = (event) => {
64
- setFocused(false);
65
- onBlur?.(event);
66
- };
67
-
68
- return (
69
- <View
70
- style={[
71
- {
72
- minHeight: containerMinHeight,
73
- paddingHorizontal: controlSize.paddingHorizontal,
74
- paddingVertical: controlSize.paddingVertical,
75
- borderRadius: controlSize.borderRadius,
76
- borderWidth: 1,
77
- borderColor: colors.borderColor,
78
- backgroundColor: colors.backgroundColor,
79
- flexDirection: 'row',
80
- alignItems: props.multiline ? 'flex-start' : 'center',
81
- opacity: colors.opacity,
82
- },
83
- resolveFocusRingStyles(theme.semantics.border.focus, focused, Platform.OS === 'web'),
84
- ]}
85
- >
86
- {leadingAccessory ? (
87
- <View style={{ marginRight: theme.spacing.s }}>{leadingAccessory}</View>
88
- ) : null}
89
- <ReactNativeTextInput
90
- {...props}
91
- defaultValue={defaultValue}
92
- editable={passive ? false : !disabled && !readOnly}
93
- numberOfLines={props.multiline ? props.numberOfLines : 1}
94
- onBlur={handleBlur}
95
- onChangeText={(nextValue) => {
96
- if (passive) {
97
- return;
98
- }
99
-
100
- onChangeText?.(nextValue);
101
- }}
102
- onFocus={handleFocus}
103
- placeholder={placeholder}
104
- placeholderTextColor={colors.placeholderColor}
105
- readOnly={readOnly}
106
- style={[
107
- {
108
- flex: 1,
109
- minHeight: inputMinHeight,
110
- padding: 0,
111
- color: colors.contentColor,
112
- textAlignVertical: props.multiline ? 'top' : 'center',
113
- },
114
- style,
115
- ]}
116
- testID={testID}
117
- value={value}
118
- />
119
- {trailingAccessory ? (
120
- <View style={{ marginLeft: theme.spacing.s }}>{trailingAccessory}</View>
121
- ) : null}
122
- </View>
123
- );
124
- }
@@ -1,2 +0,0 @@
1
- export { TextInput } from './TextInput';
2
- export type { TextInputProps } from './types';
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
-
4
- import { resolveResponsive, type Responsive, useResponsiveRuntime } from '../core/responsive';
5
- import { useTheme } from '../theme/ThemeContext';
6
- import type { SurfaceTheme } from '../theme/types';
7
- import { Box, type BoxProps } from './Box';
8
- import { resolveSpacing } from './helpers';
9
-
10
- export interface ContainerProps extends Omit<BoxProps, 'children'> {
11
- children?: React.ReactNode;
12
- maxWidth?: Responsive<number>;
13
- px?: Responsive<number | keyof SurfaceTheme['spacing']>;
14
- }
15
-
16
- export function Container({
17
- children,
18
- maxWidth = { base: Number.MAX_SAFE_INTEGER, lg: 1120 },
19
- px = { base: 16, md: 24, lg: 32 },
20
- ...props
21
- }: ContainerProps) {
22
- const { theme } = useTheme();
23
- const { breakpoint } = useResponsiveRuntime();
24
-
25
- const activeMaxWidth = resolveResponsive(maxWidth, breakpoint);
26
- const activePx = resolveSpacing(theme, resolveResponsive(px, breakpoint));
27
-
28
- return (
29
- <Box {...props} width="100%" style={[{ width: '100%' }, props.style]}>
30
- <View
31
- style={{
32
- width: '100%',
33
- maxWidth: activeMaxWidth,
34
- alignSelf: 'center',
35
- paddingLeft: activePx,
36
- paddingRight: activePx,
37
- }}
38
- >
39
- {children}
40
- </View>
41
- </Box>
42
- );
43
- }
@@ -1,83 +0,0 @@
1
- import React from 'react';
2
- import { View, type ViewStyle } from 'react-native';
3
-
4
- import { resolveResponsive, type Responsive, useResponsiveRuntime } from '../core/responsive';
5
- import { useTheme } from '../theme/ThemeContext';
6
- import { Box, type BoxProps } from './Box';
7
- import { resolveSpacing, type SpaceValue } from './helpers';
8
-
9
- export interface GridProps extends Omit<BoxProps, 'children'> {
10
- children?: React.ReactNode;
11
- cols: Responsive<number>;
12
- gap?: Responsive<SpaceValue>;
13
- rowGap?: Responsive<SpaceValue>;
14
- colGap?: Responsive<SpaceValue>;
15
- minItemWidth?: Responsive<number>;
16
- }
17
-
18
- export function Grid({
19
- children,
20
- cols,
21
- gap = 0,
22
- rowGap,
23
- colGap,
24
- minItemWidth,
25
- ...props
26
- }: GridProps) {
27
- const { theme } = useTheme();
28
- const { breakpoint } = useResponsiveRuntime();
29
-
30
- const activeCols = Math.max(1, Math.floor(resolveResponsive(cols, breakpoint) ?? 1));
31
- const defaultGap = resolveResponsive(gap, breakpoint) ?? 0;
32
- const activeRowGap = resolveResponsive(rowGap, breakpoint) ?? defaultGap;
33
- const activeColGap = resolveResponsive(colGap, breakpoint) ?? defaultGap;
34
- const rowSpacing = Number(resolveSpacing(theme, activeRowGap) ?? 0);
35
- const colSpacing = Number(resolveSpacing(theme, activeColGap) ?? 0);
36
- const activeMinItemWidth = resolveResponsive(minItemWidth, breakpoint);
37
-
38
- const basisPercent: `${number}%` = `${100 / activeCols}%`;
39
- const nodes = React.Children.toArray(children);
40
-
41
- return (
42
- <Box {...props}>
43
- <View
44
- style={{
45
- flexDirection: 'row',
46
- flexWrap: 'wrap',
47
- marginTop: -rowSpacing / 2,
48
- marginLeft: -colSpacing / 2,
49
- marginRight: -colSpacing / 2,
50
- }}
51
- >
52
- {nodes.map((node, index) => {
53
- const itemStyle: ViewStyle =
54
- activeMinItemWidth !== undefined
55
- ? {
56
- minWidth: activeMinItemWidth,
57
- flexBasis: activeMinItemWidth,
58
- flexGrow: 1,
59
- }
60
- : {
61
- width: basisPercent,
62
- flexBasis: basisPercent,
63
- };
64
-
65
- return (
66
- <View
67
- key={String(index)}
68
- style={{
69
- paddingTop: rowSpacing / 2,
70
- paddingBottom: rowSpacing / 2,
71
- paddingLeft: colSpacing / 2,
72
- paddingRight: colSpacing / 2,
73
- ...itemStyle,
74
- }}
75
- >
76
- {node}
77
- </View>
78
- );
79
- })}
80
- </View>
81
- </Box>
82
- );
83
- }
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import {
3
- KeyboardAvoidingView as ReactNativeKeyboardAvoidingView,
4
- type KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps,
5
- } from 'react-native';
6
-
7
- /*** Preserve React Native keyboard avoidance behind the stable Surface layout boundary. */
8
- export function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) {
9
- return <ReactNativeKeyboardAvoidingView {...props} />;
10
- }
11
-
12
- export type KeyboardAvoidingViewBehavior = NonNullable<
13
- ReactNativeKeyboardAvoidingViewProps['behavior']
14
- >;
15
-
16
- export type KeyboardAvoidingViewProps = ReactNativeKeyboardAvoidingViewProps;