@hzblj/kara-components 0.9.0 → 0.11.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 (281) hide show
  1. package/CHANGELOG.md +72 -28
  2. package/README.md +8 -8
  3. package/lib/module/atoms/activity-indicator/activity-indicator.android.js +6 -1
  4. package/lib/module/atoms/activity-indicator/activity-indicator.android.js.map +1 -1
  5. package/lib/module/atoms/activity-indicator/activity-indicator.ios.js +2 -0
  6. package/lib/module/atoms/activity-indicator/activity-indicator.ios.js.map +1 -1
  7. package/lib/module/atoms/avatar/avatar.js +5 -0
  8. package/lib/module/atoms/avatar/avatar.js.map +1 -1
  9. package/lib/module/atoms/button/button-tokens.js +2 -2
  10. package/lib/module/atoms/button/button-tokens.js.map +1 -1
  11. package/lib/module/atoms/button/button.android.js +6 -2
  12. package/lib/module/atoms/button/button.android.js.map +1 -1
  13. package/lib/module/atoms/button/button.ios.js +7 -2
  14. package/lib/module/atoms/button/button.ios.js.map +1 -1
  15. package/lib/module/atoms/card/card.android.js +5 -3
  16. package/lib/module/atoms/card/card.android.js.map +1 -1
  17. package/lib/module/atoms/card/card.ios.js +7 -3
  18. package/lib/module/atoms/card/card.ios.js.map +1 -1
  19. package/lib/module/atoms/checkbox/checkbox.android.js +1 -1
  20. package/lib/module/atoms/checkbox/checkbox.android.js.map +1 -1
  21. package/lib/module/atoms/color-picker/color-picker.android.js +32 -5
  22. package/lib/module/atoms/color-picker/color-picker.android.js.map +1 -1
  23. package/lib/module/atoms/fab/fab.android.js +9 -1
  24. package/lib/module/atoms/fab/fab.android.js.map +1 -1
  25. package/lib/module/atoms/fab/fab.ios.js +9 -3
  26. package/lib/module/atoms/fab/fab.ios.js.map +1 -1
  27. package/lib/module/atoms/glass-view/glass-view.android.js +1 -1
  28. package/lib/module/atoms/glass-view/glass-view.android.js.map +1 -1
  29. package/lib/module/atoms/h-stack/h-stack.ios.js +5 -3
  30. package/lib/module/atoms/h-stack/h-stack.ios.js.map +1 -1
  31. package/lib/module/atoms/icon-button/icon-button.android.js +9 -0
  32. package/lib/module/atoms/icon-button/icon-button.android.js.map +1 -1
  33. package/lib/module/atoms/icon-button/icon-button.ios.js +26 -6
  34. package/lib/module/atoms/icon-button/icon-button.ios.js.map +1 -1
  35. package/lib/module/atoms/image/image.js +4 -4
  36. package/lib/module/atoms/image/image.js.map +1 -1
  37. package/lib/module/atoms/pressable/pressable.js +52 -28
  38. package/lib/module/atoms/pressable/pressable.js.map +1 -1
  39. package/lib/module/atoms/progress/progress.android.js +7 -0
  40. package/lib/module/atoms/progress/progress.android.js.map +1 -1
  41. package/lib/module/atoms/progress/progress.ios.js +6 -1
  42. package/lib/module/atoms/progress/progress.ios.js.map +1 -1
  43. package/lib/module/atoms/segmented-control/segmented-control.android.js +1 -1
  44. package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -1
  45. package/lib/module/atoms/segmented-control/segmented-control.ios.js +1 -1
  46. package/lib/module/atoms/segmented-control/segmented-control.ios.js.map +1 -1
  47. package/lib/module/atoms/skeleton/skeleton.js +20 -6
  48. package/lib/module/atoms/skeleton/skeleton.js.map +1 -1
  49. package/lib/module/atoms/surface/surface.android.js +5 -3
  50. package/lib/module/atoms/surface/surface.android.js.map +1 -1
  51. package/lib/module/atoms/surface/surface.ios.js +7 -3
  52. package/lib/module/atoms/surface/surface.ios.js.map +1 -1
  53. package/lib/module/atoms/switch/switch.android.js +1 -1
  54. package/lib/module/atoms/switch/switch.android.js.map +1 -1
  55. package/lib/module/atoms/text/text.android.js +5 -3
  56. package/lib/module/atoms/text/text.android.js.map +1 -1
  57. package/lib/module/atoms/text/text.ios.js +6 -4
  58. package/lib/module/atoms/text/text.ios.js.map +1 -1
  59. package/lib/module/atoms/v-stack/v-stack.ios.js +5 -3
  60. package/lib/module/atoms/v-stack/v-stack.ios.js.map +1 -1
  61. package/lib/module/atoms/z-stack/z-stack.ios.js +5 -3
  62. package/lib/module/atoms/z-stack/z-stack.ios.js.map +1 -1
  63. package/lib/module/glyph/glyph.android.js +2 -0
  64. package/lib/module/glyph/glyph.android.js.map +1 -1
  65. package/lib/module/glyph/glyph.ios.js +5 -2
  66. package/lib/module/glyph/glyph.ios.js.map +1 -1
  67. package/lib/module/molecules/collapsible/collapsible.android.js +18 -8
  68. package/lib/module/molecules/collapsible/collapsible.android.js.map +1 -1
  69. package/lib/module/molecules/labeled-content/labeled-content.js +4 -1
  70. package/lib/module/molecules/labeled-content/labeled-content.js.map +1 -1
  71. package/lib/module/molecules/link/link.js +4 -1
  72. package/lib/module/molecules/link/link.js.map +1 -1
  73. package/lib/module/molecules/list-item/list-item.js +4 -1
  74. package/lib/module/molecules/list-item/list-item.js.map +1 -1
  75. package/lib/module/molecules/navigation-bar/navigation-bar.android.js +1 -1
  76. package/lib/module/molecules/navigation-bar/navigation-bar.android.js.map +1 -1
  77. package/lib/module/molecules/navigation-bar/navigation-bar.ios.js +1 -1
  78. package/lib/module/molecules/navigation-bar/navigation-bar.ios.js.map +1 -1
  79. package/lib/module/molecules/rn-list-item/rn-list-item.js +10 -2
  80. package/lib/module/molecules/rn-list-item/rn-list-item.js.map +1 -1
  81. package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js +3 -4
  82. package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js.map +1 -1
  83. package/lib/module/molecules/stepper/stepper.ios.js +6 -2
  84. package/lib/module/molecules/stepper/stepper.ios.js.map +1 -1
  85. package/lib/module/motion.js +19 -0
  86. package/lib/module/motion.js.map +1 -0
  87. package/lib/module/organisms/fab-menu/fab-menu.android.js +8 -5
  88. package/lib/module/organisms/fab-menu/fab-menu.android.js.map +1 -1
  89. package/lib/module/organisms/fab-menu/fab-menu.ios.js +5 -2
  90. package/lib/module/organisms/fab-menu/fab-menu.ios.js.map +1 -1
  91. package/lib/module/organisms/snackbar/snackbar.js +142 -17
  92. package/lib/module/organisms/snackbar/snackbar.js.map +1 -1
  93. package/lib/module/organisms/swipe-actions/swipe-actions.android.js +1 -1
  94. package/lib/module/organisms/swipe-actions/swipe-actions.android.js.map +1 -1
  95. package/lib/module/use-stack-modifiers.js +10 -8
  96. package/lib/module/use-stack-modifiers.js.map +1 -1
  97. package/lib/typescript/atoms/activity-indicator/activity-indicator.types.d.ts +3 -1
  98. package/lib/typescript/atoms/avatar/avatar.types.d.ts +7 -2
  99. package/lib/typescript/atoms/badge/badge.types.d.ts +1 -1
  100. package/lib/typescript/atoms/blur-view/blur-view.types.d.ts +6 -6
  101. package/lib/typescript/atoms/button/button-tokens.d.ts +1 -1
  102. package/lib/typescript/atoms/button/button.types.d.ts +9 -7
  103. package/lib/typescript/atoms/card/card.types.d.ts +3 -3
  104. package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +2 -2
  105. package/lib/typescript/atoms/chip/chip.types.d.ts +1 -1
  106. package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +4 -3
  107. package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +4 -4
  108. package/lib/typescript/atoms/divider/divider.types.d.ts +2 -2
  109. package/lib/typescript/atoms/fab/fab.types.d.ts +10 -3
  110. package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +5 -5
  111. package/lib/typescript/atoms/h-stack/h-stack.types.d.ts +8 -5
  112. package/lib/typescript/atoms/icon/icon.types.d.ts +4 -4
  113. package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +14 -3
  114. package/lib/typescript/atoms/image/image.d.ts +2 -2
  115. package/lib/typescript/atoms/island/island.types.d.ts +4 -4
  116. package/lib/typescript/atoms/list/list.types.d.ts +5 -5
  117. package/lib/typescript/atoms/picker/picker.types.d.ts +1 -1
  118. package/lib/typescript/atoms/pressable/pressable.types.d.ts +23 -7
  119. package/lib/typescript/atoms/progress/progress.types.d.ts +3 -1
  120. package/lib/typescript/atoms/rn-flat-list/rn-flat-list.types.d.ts +2 -2
  121. package/lib/typescript/atoms/rn-icon/rn-icon.types.d.ts +1 -1
  122. package/lib/typescript/atoms/rn-scroll-view/rn-scroll-view.types.d.ts +2 -2
  123. package/lib/typescript/atoms/rn-section-list/rn-section-list.types.d.ts +2 -2
  124. package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +2 -2
  125. package/lib/typescript/atoms/rn-view/rn-view.types.d.ts +3 -3
  126. package/lib/typescript/atoms/scroll-view/scroll-view.types.d.ts +3 -3
  127. package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +3 -3
  128. package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +2 -1
  129. package/lib/typescript/atoms/spacer/spacer.types.d.ts +1 -1
  130. package/lib/typescript/atoms/surface/surface.types.d.ts +3 -3
  131. package/lib/typescript/atoms/switch/switch.types.d.ts +1 -1
  132. package/lib/typescript/atoms/text/text.types.d.ts +3 -3
  133. package/lib/typescript/atoms/text-field/text-field.types.d.ts +4 -4
  134. package/lib/typescript/atoms/v-stack/v-stack.types.d.ts +4 -4
  135. package/lib/typescript/atoms/z-stack/z-stack.types.d.ts +4 -4
  136. package/lib/typescript/glyph/glyph-button.types.d.ts +1 -1
  137. package/lib/typescript/glyph/glyph.types.d.ts +3 -1
  138. package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +1 -1
  139. package/lib/typescript/molecules/empty-state/empty-state.types.d.ts +1 -1
  140. package/lib/typescript/molecules/label/label.types.d.ts +1 -1
  141. package/lib/typescript/molecules/labeled-content/labeled-content.types.d.ts +6 -4
  142. package/lib/typescript/molecules/link/link.types.d.ts +2 -1
  143. package/lib/typescript/molecules/list-item/list-item.types.d.ts +6 -4
  144. package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -8
  145. package/lib/typescript/molecules/pager/pager.types.d.ts +2 -2
  146. package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +2 -2
  147. package/lib/typescript/molecules/rn-list-item/rn-list-item.types.d.ts +1 -1
  148. package/lib/typescript/molecules/rn-tooltip/rn-tooltip.types.d.ts +7 -7
  149. package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +3 -3
  150. package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +2 -2
  151. package/lib/typescript/molecules/stepper/stepper.ios.d.ts +1 -1
  152. package/lib/typescript/molecules/stepper/stepper.types.d.ts +2 -2
  153. package/lib/typescript/molecules/tooltip/tooltip.types.d.ts +6 -6
  154. package/lib/typescript/motion.d.ts +8 -0
  155. package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +3 -3
  156. package/lib/typescript/organisms/alert/alert.types.d.ts +3 -3
  157. package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +9 -9
  158. package/lib/typescript/organisms/fab-menu/fab-menu.types.d.ts +10 -5
  159. package/lib/typescript/organisms/form/form.types.d.ts +1 -1
  160. package/lib/typescript/organisms/menu/menu.types.d.ts +2 -2
  161. package/lib/typescript/organisms/sheet/sheet.types.d.ts +12 -12
  162. package/lib/typescript/organisms/snackbar/snackbar.types.d.ts +39 -6
  163. package/lib/typescript/organisms/swipe-actions/swipe-actions.types.d.ts +5 -5
  164. package/lib/typescript/templates/screen/screen.types.d.ts +2 -2
  165. package/lib/typescript/use-stack-modifiers.d.ts +6 -5
  166. package/package.json +4 -4
  167. package/src/atoms/activity-indicator/activity-indicator.android.tsx +7 -1
  168. package/src/atoms/activity-indicator/activity-indicator.ios.tsx +9 -1
  169. package/src/atoms/activity-indicator/activity-indicator.types.ts +3 -1
  170. package/src/atoms/avatar/avatar.tsx +5 -1
  171. package/src/atoms/avatar/avatar.types.ts +7 -2
  172. package/src/atoms/badge/badge.types.ts +1 -1
  173. package/src/atoms/blur-view/blur-view.types.ts +6 -6
  174. package/src/atoms/button/button-tokens.ts +2 -2
  175. package/src/atoms/button/button.android.tsx +5 -3
  176. package/src/atoms/button/button.ios.tsx +10 -2
  177. package/src/atoms/button/button.types.ts +9 -7
  178. package/src/atoms/card/card.android.tsx +6 -4
  179. package/src/atoms/card/card.ios.tsx +7 -3
  180. package/src/atoms/card/card.types.ts +9 -8
  181. package/src/atoms/checkbox/checkbox.android.tsx +1 -1
  182. package/src/atoms/checkbox/checkbox.types.ts +2 -2
  183. package/src/atoms/chip/chip.types.ts +1 -1
  184. package/src/atoms/color-picker/color-picker.android.tsx +26 -6
  185. package/src/atoms/color-picker/color-picker.types.ts +4 -3
  186. package/src/atoms/date-picker/date-picker.types.ts +4 -4
  187. package/src/atoms/divider/divider.types.ts +2 -2
  188. package/src/atoms/fab/fab.android.tsx +5 -3
  189. package/src/atoms/fab/fab.ios.tsx +8 -4
  190. package/src/atoms/fab/fab.types.ts +10 -3
  191. package/src/atoms/glass-view/glass-view.android.tsx +1 -1
  192. package/src/atoms/glass-view/glass-view.types.ts +5 -5
  193. package/src/atoms/h-stack/h-stack.ios.tsx +6 -4
  194. package/src/atoms/h-stack/h-stack.types.ts +18 -14
  195. package/src/atoms/icon/icon.types.ts +4 -4
  196. package/src/atoms/icon-button/icon-button.android.tsx +16 -3
  197. package/src/atoms/icon-button/icon-button.ios.tsx +24 -5
  198. package/src/atoms/icon-button/icon-button.types.ts +14 -3
  199. package/src/atoms/image/image.tsx +3 -3
  200. package/src/atoms/island/island.types.ts +4 -4
  201. package/src/atoms/list/list.types.ts +5 -5
  202. package/src/atoms/picker/picker.types.ts +1 -1
  203. package/src/atoms/pressable/pressable.tsx +50 -21
  204. package/src/atoms/pressable/pressable.types.ts +35 -17
  205. package/src/atoms/progress/progress.android.tsx +5 -3
  206. package/src/atoms/progress/progress.ios.tsx +5 -2
  207. package/src/atoms/progress/progress.types.ts +3 -1
  208. package/src/atoms/rn-flat-list/rn-flat-list.types.ts +2 -2
  209. package/src/atoms/rn-icon/rn-icon.types.ts +1 -1
  210. package/src/atoms/rn-scroll-view/rn-scroll-view.types.ts +2 -2
  211. package/src/atoms/rn-section-list/rn-section-list.types.ts +2 -2
  212. package/src/atoms/rn-text/rn-text.types.ts +2 -2
  213. package/src/atoms/rn-view/rn-view.types.ts +3 -3
  214. package/src/atoms/scroll-view/scroll-view.types.ts +3 -3
  215. package/src/atoms/segmented-control/segmented-control.android.tsx +1 -1
  216. package/src/atoms/segmented-control/segmented-control.ios.tsx +1 -1
  217. package/src/atoms/segmented-control/segmented-control.types.ts +3 -3
  218. package/src/atoms/skeleton/skeleton.tsx +18 -4
  219. package/src/atoms/skeleton/skeleton.types.ts +2 -1
  220. package/src/atoms/spacer/spacer.types.ts +1 -1
  221. package/src/atoms/surface/surface.android.tsx +6 -4
  222. package/src/atoms/surface/surface.ios.tsx +7 -3
  223. package/src/atoms/surface/surface.types.ts +11 -10
  224. package/src/atoms/switch/switch.android.tsx +1 -1
  225. package/src/atoms/switch/switch.types.ts +1 -1
  226. package/src/atoms/text/text.android.tsx +6 -4
  227. package/src/atoms/text/text.ios.tsx +6 -4
  228. package/src/atoms/text/text.types.ts +24 -23
  229. package/src/atoms/text-field/text-field.types.ts +4 -4
  230. package/src/atoms/v-stack/v-stack.ios.tsx +6 -4
  231. package/src/atoms/v-stack/v-stack.types.ts +18 -17
  232. package/src/atoms/z-stack/z-stack.ios.tsx +6 -4
  233. package/src/atoms/z-stack/z-stack.types.ts +16 -15
  234. package/src/glyph/glyph-button.types.ts +1 -1
  235. package/src/glyph/glyph.android.tsx +14 -2
  236. package/src/glyph/glyph.ios.tsx +13 -3
  237. package/src/glyph/glyph.types.ts +3 -1
  238. package/src/molecules/collapsible/collapsible.android.tsx +27 -7
  239. package/src/molecules/collapsible/collapsible.types.ts +1 -1
  240. package/src/molecules/empty-state/empty-state.types.ts +1 -1
  241. package/src/molecules/label/label.types.ts +1 -1
  242. package/src/molecules/labeled-content/labeled-content.tsx +12 -1
  243. package/src/molecules/labeled-content/labeled-content.types.ts +6 -4
  244. package/src/molecules/link/link.tsx +2 -1
  245. package/src/molecules/link/link.types.ts +2 -1
  246. package/src/molecules/list-item/list-item.tsx +20 -2
  247. package/src/molecules/list-item/list-item.types.ts +6 -4
  248. package/src/molecules/navigation-bar/navigation-bar.android.tsx +1 -1
  249. package/src/molecules/navigation-bar/navigation-bar.ios.tsx +1 -1
  250. package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -8
  251. package/src/molecules/pager/pager.types.ts +2 -2
  252. package/src/molecules/radio-group/radio-group.types.ts +2 -2
  253. package/src/molecules/rn-list-item/rn-list-item.tsx +18 -3
  254. package/src/molecules/rn-list-item/rn-list-item.types.ts +1 -1
  255. package/src/molecules/rn-tooltip/rn-tooltip.types.ts +7 -7
  256. package/src/molecules/scroll-edge-container/scroll-edge-container.android.tsx +3 -2
  257. package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +3 -3
  258. package/src/molecules/search-bar/search-bar.types.ts +2 -2
  259. package/src/molecules/stepper/stepper.ios.tsx +8 -2
  260. package/src/molecules/stepper/stepper.types.ts +2 -2
  261. package/src/molecules/tooltip/tooltip.types.ts +6 -6
  262. package/src/motion.ts +13 -0
  263. package/src/organisms/action-sheet/action-sheet.types.ts +3 -3
  264. package/src/organisms/alert/alert.types.ts +3 -3
  265. package/src/organisms/context-menu/context-menu.types.ts +9 -9
  266. package/src/organisms/fab-menu/fab-menu.android.tsx +9 -5
  267. package/src/organisms/fab-menu/fab-menu.ios.tsx +6 -2
  268. package/src/organisms/fab-menu/fab-menu.types.ts +10 -5
  269. package/src/organisms/form/form.types.ts +1 -1
  270. package/src/organisms/menu/menu.types.ts +2 -2
  271. package/src/organisms/sheet/sheet.types.ts +12 -12
  272. package/src/organisms/snackbar/snackbar.tsx +143 -19
  273. package/src/organisms/snackbar/snackbar.types.ts +42 -6
  274. package/src/organisms/swipe-actions/swipe-actions.android.tsx +1 -1
  275. package/src/organisms/swipe-actions/swipe-actions.types.ts +5 -5
  276. package/src/templates/screen/screen.types.ts +2 -2
  277. package/src/use-stack-modifiers.ts +20 -7
  278. package/lib/module/platform-support.js +0 -19
  279. package/lib/module/platform-support.js.map +0 -1
  280. package/lib/typescript/platform-support.d.ts +0 -8
  281. package/src/platform-support.ts +0 -20
@@ -5,7 +5,7 @@ export type SwitchProps = {
5
5
  /** Stops the user flipping it, and dims it. */
6
6
  disabled?: boolean
7
7
  /**
8
- * Shown beside the switch. On Android it makes a full-width row — label at the start, switch at the end — that
8
+ * Shown beside the switch. On Android it makes a full-width row (label at the start, switch at the end) that
9
9
  * toggles wherever it is tapped.
10
10
  */
11
11
  label?: string
@@ -1,6 +1,6 @@
1
1
  import {Text as ComposeText} from '@expo/ui/jetpack-compose'
2
2
  import {testID as testIdModifier} from '@expo/ui/jetpack-compose/modifiers'
3
- import {useSxModifiers} from '@hzblj/kara-sx'
3
+ import {splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
4
4
  import {useAppTheme} from '@hzblj/kara-theme'
5
5
  import {useMemo} from 'react'
6
6
 
@@ -33,15 +33,17 @@ export const Text: TextComponent = ({
33
33
  testID,
34
34
  transform,
35
35
  variant = 'body',
36
- ...sx
36
+ ...props
37
37
  }: TextProps) => {
38
38
  useHostGuard('Text')
39
39
  const theme = useAppTheme()
40
40
  const style = theme.typography[variant]
41
+ const [accessibility, sx] = splitAccessibility(props)
41
42
  const sxModifiers = useSxModifiers(sx)
43
+ const accessibilityModifiers = useAccessibilityModifiers(accessibility)
42
44
  const modifiers = useMemo(
43
- () => (testID ? [...sxModifiers, testIdModifier(testID)] : sxModifiers),
44
- [sxModifiers, testID]
45
+ () => [...sxModifiers, ...(testID ? [testIdModifier(testID)] : []), ...accessibilityModifiers],
46
+ [accessibilityModifiers, sxModifiers, testID]
45
47
  )
46
48
 
47
49
  return (
@@ -10,7 +10,7 @@ import {
10
10
  underline,
11
11
  } from '@expo/ui/swift-ui/modifiers'
12
12
  import {scaledFont} from '@hzblj/kara-native/swift-ui'
13
- import {type FrameAlignment, useSxModifiers} from '@hzblj/kara-sx'
13
+ import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
14
14
  import {useAppTheme} from '@hzblj/kara-theme'
15
15
  import {useMemo} from 'react'
16
16
 
@@ -39,13 +39,15 @@ export const Text: TextComponent = ({
39
39
  testID,
40
40
  transform,
41
41
  variant = 'body',
42
- ...sx
42
+ ...props
43
43
  }: TextProps) => {
44
44
  useHostGuard('Text')
45
45
  const theme = useAppTheme()
46
46
  const style = theme.typography[variant]
47
47
  // After the text's own modifiers: the font and colour belong to the glyphs, the padding and frame to the box around.
48
+ const [accessibility, sx] = splitAccessibility(props)
48
49
  const sxModifiers = useSxModifiers(sx, FRAME_ALIGNMENT[align ?? 'left'])
50
+ const accessibilityModifiers = useAccessibilityModifiers(accessibility)
49
51
 
50
52
  const modifiers = useMemo(() => {
51
53
  const list: ModifierConfig[] = [
@@ -76,8 +78,8 @@ export const Text: TextComponent = ({
76
78
  list.push(lineLimit(numberOfLines))
77
79
  }
78
80
 
79
- return [...list, ...sxModifiers]
80
- }, [align, color, decoration, numberOfLines, style, sxModifiers, theme, transform])
81
+ return [...list, ...sxModifiers, ...accessibilityModifiers]
82
+ }, [accessibilityModifiers, align, color, decoration, numberOfLines, style, sxModifiers, theme, transform])
81
83
 
82
84
  return (
83
85
  <SwiftUIText modifiers={modifiers} testID={testID}>
@@ -1,4 +1,4 @@
1
- import type {ResponsiveSx} from '@hzblj/kara-sx'
1
+ import type {AccessibilityProps, ResponsiveSx} from '@hzblj/kara-sx'
2
2
  import type {ColorToken, TextVariant} from '@hzblj/kara-theme'
3
3
  import type {ReactNode} from 'react'
4
4
 
@@ -9,30 +9,31 @@ export type TextDecoration = 'none' | 'strikethrough' | 'underline'
9
9
  export type TextTransform = 'lowercase' | 'uppercase'
10
10
 
11
11
  /**
12
- * SwiftUI `Text` / Compose `Text` in a theme typography variant — a native atom; outside a host, use `RnText`. It takes
12
+ * SwiftUI `Text` / Compose `Text` in a theme typography variant. A native atom: outside a host, use `RnText`. It takes
13
13
  * the native `sx` surface too: padding, a frame (`wide` lines it up by `align`), a background, and the `ios` bucket's
14
14
  * `contentTransition`, `animation` and `monospacedDigit` for a number that changes in place.
15
15
  */
16
- export type TextProps = ResponsiveSx & {
17
- /**
18
- * How its lines align. iOS reads `left` and `right` as leading and trailing, so they flip in a right-to-left
19
- * layout; Android keeps them as they are.
20
- */
21
- align?: TextAlign
22
- /** The text. */
23
- children?: ReactNode
24
- /** The text's colour. `content.primary` by default. */
25
- color?: ColorToken
26
- /** An underline or a strikethrough. */
27
- decoration?: TextDecoration
28
- /** The most lines it wraps to. iOS truncates the last with an ellipsis; Android clips it. */
29
- numberOfLines?: number
30
- /** Test identifier, forwarded to the native view. */
31
- testID?: string
32
- /** Upper- or lower-cases the text. Android applies it only when `children` is a plain string. */
33
- transform?: TextTransform
34
- /** The typography variant. `body` by default. */
35
- variant?: TextVariant
36
- }
16
+ export type TextProps = ResponsiveSx &
17
+ AccessibilityProps & {
18
+ /**
19
+ * How its lines align. iOS reads `left` and `right` as leading and trailing, so they flip in a right-to-left
20
+ * layout; Android keeps them as they are.
21
+ */
22
+ align?: TextAlign
23
+ /** The text. */
24
+ children?: ReactNode
25
+ /** The text's colour. `content.primary` by default. */
26
+ color?: ColorToken
27
+ /** An underline or a strikethrough. */
28
+ decoration?: TextDecoration
29
+ /** The most lines it wraps to. iOS truncates the last with an ellipsis; Android clips it. */
30
+ numberOfLines?: number
31
+ /** Test identifier, forwarded to the native view. */
32
+ testID?: string
33
+ /** Upper- or lower-cases the text. Android applies it only when `children` is a plain string. */
34
+ transform?: TextTransform
35
+ /** The typography variant. `body` by default. */
36
+ variant?: TextVariant
37
+ }
37
38
 
38
39
  export type TextComponent = (props: TextProps) => ReactNode
@@ -1,17 +1,17 @@
1
1
  import type {ReactNode} from 'react'
2
2
 
3
3
  /**
4
- * An uncontrolled text field with an optional label above it — SwiftUI `TextField` (`SecureField` when `secure`) /
4
+ * An uncontrolled text field with an optional label above it: SwiftUI `TextField` (`SecureField` when `secure`) /
5
5
  * Compose `OutlinedTextField`.
6
6
  */
7
7
  export type TextFieldProps = {
8
- /** The text it starts with. Read once, on mount — the field is uncontrolled. */
8
+ /** The text it starts with. Read once, on mount: the field is uncontrolled. */
9
9
  defaultValue?: string
10
10
  /** Stops editing and dims the field. On iOS it outranks `error`. */
11
11
  disabled?: boolean
12
12
  /**
13
- * Marks the field invalid: a destructive outline and label. A message is shown under the field as well — on Android
14
- * as Material's supporting text, beside its error icon — so the error never rests on colour alone; Material's error
13
+ * Marks the field invalid: a destructive outline and label. A message is shown under the field as well (on Android
14
+ * as Material's supporting text, beside its error icon), so the error never rests on colour alone; Material's error
15
15
  * colour is a pale red in dark mode. `true` marks it without a message.
16
16
  */
17
17
  error?: boolean | string
@@ -1,6 +1,6 @@
1
1
  import {VStack as SwiftUIVStack} from '@expo/ui/swift-ui'
2
2
  import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
3
- import {type FrameAlignment, useSxModifiers} from '@hzblj/kara-sx'
3
+ import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
4
4
  import {spacing} from '@hzblj/kara-theme'
5
5
  import {useMemo} from 'react'
6
6
  import {useHostGuard} from '../../host-context'
@@ -18,13 +18,15 @@ export const VStack: VStackComponent = ({
18
18
  onPress,
19
19
  spacing: gap,
20
20
  testID,
21
- ...sx
21
+ ...props
22
22
  }: VStackProps) => {
23
23
  useHostGuard('VStack')
24
+ const [accessibility, sx] = splitAccessibility(props)
24
25
  const sxModifiers = useSxModifiers(sx, ALIGNMENT[align])
26
+ const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
25
27
  const modifiers = useMemo(
26
- () => (onPress ? [...sxModifiers, onTapGesture(onPress)] : sxModifiers),
27
- [onPress, sxModifiers]
28
+ () => [...sxModifiers, ...(onPress ? [onTapGesture(onPress)] : []), ...accessibilityModifiers],
29
+ [accessibilityModifiers, onPress, sxModifiers]
28
30
  )
29
31
 
30
32
  return (
@@ -1,24 +1,25 @@
1
- import type {ResponsiveSx} from '@hzblj/kara-sx'
1
+ import type {AccessibilityProps, ResponsiveSx} from '@hzblj/kara-sx'
2
2
  import type {SpaceSize} from '@hzblj/kara-theme'
3
3
  import type {ReactNode} from 'react'
4
4
 
5
5
  export type VStackAlign = 'center' | 'end' | 'start'
6
6
 
7
- /** Stacks its children top to bottom — SwiftUI `VStack` / Compose `Column`. */
8
- export type VStackProps = ResponsiveSx & {
9
- /** The children's horizontal alignment. `start` by default. */
10
- align?: VStackAlign
11
- /** Laid out top to bottom, `spacing` apart. */
12
- children?: ReactNode
13
- /**
14
- * Makes the whole stack pressable. iOS adds a tap gesture with no press feedback; Android a `clickable` whose ripple
15
- * fills the stack's shape.
16
- */
17
- onPress?: () => void
18
- /** The space between children. */
19
- spacing?: SpaceSize
20
- /** Test identifier, forwarded to the native view. */
21
- testID?: string
22
- }
7
+ /** Stacks its children top to bottom: SwiftUI `VStack` / Compose `Column`. */
8
+ export type VStackProps = ResponsiveSx &
9
+ AccessibilityProps & {
10
+ /** The children's horizontal alignment. `start` by default. */
11
+ align?: VStackAlign
12
+ /** Laid out top to bottom, `spacing` apart. */
13
+ children?: ReactNode
14
+ /**
15
+ * Makes the whole stack pressable. iOS adds a tap gesture with no press feedback; Android a `clickable` whose ripple
16
+ * fills the stack's shape. Screen readers then read the stack as one button.
17
+ */
18
+ onPress?: () => void
19
+ /** The space between children. */
20
+ spacing?: SpaceSize
21
+ /** Test identifier, forwarded to the native view. */
22
+ testID?: string
23
+ }
23
24
 
24
25
  export type VStackComponent = (props: VStackProps) => ReactNode
@@ -1,6 +1,6 @@
1
1
  import {ZStack as SwiftUIZStack} from '@expo/ui/swift-ui'
2
2
  import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
3
- import {type FrameAlignment, useSxModifiers} from '@hzblj/kara-sx'
3
+ import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
4
4
  import {useMemo} from 'react'
5
5
  import {useHostGuard} from '../../host-context'
6
6
  import type {ZStackAlign, ZStackComponent, ZStackProps} from './z-stack.types'
@@ -11,12 +11,14 @@ const ALIGNMENT = {
11
11
  top: 'top',
12
12
  } as const satisfies Record<ZStackAlign, FrameAlignment>
13
13
 
14
- export const ZStack: ZStackComponent = ({align = 'center', children, onPress, testID, ...sx}: ZStackProps) => {
14
+ export const ZStack: ZStackComponent = ({align = 'center', children, onPress, testID, ...props}: ZStackProps) => {
15
15
  useHostGuard('ZStack')
16
+ const [accessibility, sx] = splitAccessibility(props)
16
17
  const sxModifiers = useSxModifiers(sx, ALIGNMENT[align])
18
+ const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
17
19
  const modifiers = useMemo(
18
- () => (onPress ? [...sxModifiers, onTapGesture(onPress)] : sxModifiers),
19
- [onPress, sxModifiers]
20
+ () => [...sxModifiers, ...(onPress ? [onTapGesture(onPress)] : []), ...accessibilityModifiers],
21
+ [accessibilityModifiers, onPress, sxModifiers]
20
22
  )
21
23
 
22
24
  return (
@@ -1,21 +1,22 @@
1
- import type {ResponsiveSx} from '@hzblj/kara-sx'
1
+ import type {AccessibilityProps, ResponsiveSx} from '@hzblj/kara-sx'
2
2
  import type {ReactNode} from 'react'
3
3
 
4
4
  export type ZStackAlign = 'bottom' | 'center' | 'top'
5
5
 
6
- /** Layers its children on one another — SwiftUI `ZStack` / Compose `Box`. */
7
- export type ZStackProps = ResponsiveSx & {
8
- /** Where the children sit vertically; they are always centred horizontally. `center` by default. */
9
- align?: ZStackAlign
10
- /** Drawn in order, the last on top. */
11
- children?: ReactNode
12
- /**
13
- * Makes the whole stack pressable. iOS adds a tap gesture with no press feedback; Android a `clickable` whose ripple
14
- * fills the stack's shape.
15
- */
16
- onPress?: () => void
17
- /** Test identifier, forwarded to the native view. */
18
- testID?: string
19
- }
6
+ /** Layers its children on one another: SwiftUI `ZStack` / Compose `Box`. */
7
+ export type ZStackProps = ResponsiveSx &
8
+ AccessibilityProps & {
9
+ /** Where the children sit vertically; they are always centred horizontally. `center` by default. */
10
+ align?: ZStackAlign
11
+ /** Drawn in order, the last on top. */
12
+ children?: ReactNode
13
+ /**
14
+ * Makes the whole stack pressable. iOS adds a tap gesture with no press feedback; Android a `clickable` whose ripple
15
+ * fills the stack's shape. Screen readers then read the stack as one button.
16
+ */
17
+ onPress?: () => void
18
+ /** Test identifier, forwarded to the native view. */
19
+ testID?: string
20
+ }
20
21
 
21
22
  export type ZStackComponent = (props: ZStackProps) => ReactNode
@@ -1,7 +1,7 @@
1
1
  import type {GlyphName} from '@hzblj/kara-native'
2
2
  import type {ReactNode} from 'react'
3
3
 
4
- /** An icon button over one of kara's glyphs — for the controls its own components build (a stepper, a bar). */
4
+ /** An icon button over one of kara's glyphs, for the controls its own components build (a stepper, a bar). */
5
5
  export type GlyphButtonProps = {
6
6
  accessibilityLabel?: string
7
7
  disabled?: boolean
@@ -5,8 +5,20 @@ import {spacing, useAppTheme} from '@hzblj/kara-theme'
5
5
  import type {GlyphComponent, GlyphProps} from './glyph.types'
6
6
 
7
7
  /** The Material Symbol `@hzblj/kara-native` ships as a drawable — inside a Compose host. */
8
- export const Glyph: GlyphComponent = ({color = 'content.primary', name, size = 's24'}: GlyphProps) => {
8
+ export const Glyph: GlyphComponent = ({
9
+ accessibilityLabel,
10
+ color = 'content.primary',
11
+ name,
12
+ size = 's24',
13
+ }: GlyphProps) => {
9
14
  const theme = useAppTheme()
10
15
 
11
- return <DrawableIcon iconColor={theme.color(color)} iconSize={spacing[size]} resourceName={GLYPHS[name].android} />
16
+ return (
17
+ <DrawableIcon
18
+ accessibilityLabel={accessibilityLabel}
19
+ iconColor={theme.color(color)}
20
+ iconSize={spacing[size]}
21
+ resourceName={GLYPHS[name].android}
22
+ />
23
+ )
12
24
  }
@@ -1,15 +1,25 @@
1
1
  import {Image} from '@expo/ui/swift-ui'
2
- import {accessibilityHidden} from '@expo/ui/swift-ui/modifiers'
2
+ import {accessibilityHidden, accessibilityLabel as labelModifier} from '@expo/ui/swift-ui/modifiers'
3
3
  import {GLYPHS} from '@hzblj/kara-native'
4
4
  import {spacing, useAppTheme} from '@hzblj/kara-theme'
5
+ import {useMemo} from 'react'
5
6
 
6
7
  import type {GlyphComponent, GlyphProps} from './glyph.types'
7
8
 
8
9
  const DECORATIVE = [accessibilityHidden(true)]
9
10
 
10
11
  /** The SF Symbol the system already has — inside a SwiftUI host. */
11
- export const Glyph: GlyphComponent = ({color = 'content.primary', name, size = 's24'}: GlyphProps) => {
12
+ export const Glyph: GlyphComponent = ({
13
+ accessibilityLabel,
14
+ color = 'content.primary',
15
+ name,
16
+ size = 's24',
17
+ }: GlyphProps) => {
12
18
  const theme = useAppTheme()
19
+ const modifiers = useMemo(
20
+ () => (accessibilityLabel ? [labelModifier(accessibilityLabel)] : DECORATIVE),
21
+ [accessibilityLabel]
22
+ )
13
23
 
14
- return <Image color={theme.color(color)} modifiers={DECORATIVE} size={spacing[size]} systemName={GLYPHS[name].ios} />
24
+ return <Image color={theme.color(color)} modifiers={modifiers} size={spacing[size]} systemName={GLYPHS[name].ios} />
15
25
  }
@@ -3,10 +3,12 @@ import type {ColorToken, SpaceSize} from '@hzblj/kara-theme'
3
3
  import type {ReactNode} from 'react'
4
4
 
5
5
  /**
6
- * One of the few glyphs kara's own components draw — a search field's magnifier, a row's chevron. Internal: apps draw
6
+ * One of the few glyphs kara's own components draw: a search field's magnifier, a row's chevron. Internal: apps draw
7
7
  * their own icons with `Icon` / `RnIcon`.
8
8
  */
9
9
  export type GlyphProps = {
10
+ /** What a screen reader says. Unset, the glyph is decorative and hidden from it. */
11
+ accessibilityLabel?: string
10
12
  color?: ColorToken
11
13
  name: GlyphName
12
14
  size?: SpaceSize
@@ -15,19 +15,25 @@ import {
15
15
  graphicsLayer,
16
16
  tween,
17
17
  } from '@expo/ui/jetpack-compose/modifiers'
18
- import {duration, useAppTheme} from '@hzblj/kara-theme'
18
+ import {useAccessibilityModifiers} from '@hzblj/kara-sx'
19
+ import {duration, useAppTheme, useReducedMotion} from '@hzblj/kara-theme'
19
20
  import {useMemo} from 'react'
20
21
  import {Glyph} from '../../glyph'
21
22
  import {useHostGuard} from '../../host-context'
22
23
  import type {CollapsibleComponent, CollapsibleProps} from './collapsible.types'
23
24
 
24
- /** Material's standard easing, at the length a disclosure takes. */
25
- const TURN = tween({durationMillis: duration.d200, easing: 'fastOutSlowIn'})
25
+ /** Material's standard easing, at the length a chevron turning takes. */
26
+ const TURN = tween({durationMillis: duration.fast, easing: 'fastOutSlowIn'})
27
+ const SNAP = tween({durationMillis: duration.none})
26
28
 
27
29
  /** Down from the row, fading in — Compose's default grows from a corner, sideways as well as down. */
28
30
  const ENTER = EnterTransition.expandVertically().plus(EnterTransition.fadeIn())
29
31
  const EXIT = ExitTransition.shrinkVertically().plus(ExitTransition.fadeOut())
30
32
 
33
+ /** With motion reduced (Compose follows the device's own setting, this `KaraProvider reduceMotion`): no growing. */
34
+ const FADE_IN = EnterTransition.fadeIn()
35
+ const FADE_OUT = ExitTransition.fadeOut()
36
+
31
37
  const WIDE = [fillMaxWidth()]
32
38
 
33
39
  /** Material's least touch target. */
@@ -41,11 +47,21 @@ const ROW_HEIGHT = 48
41
47
  export const Collapsible: CollapsibleComponent = ({children, expanded, label, onExpandedChange}: CollapsibleProps) => {
42
48
  useHostGuard('Collapsible')
43
49
  const theme = useAppTheme()
50
+ const reduced = useReducedMotion()
51
+ const accessibilityModifiers = useAccessibilityModifiers({}, true)
44
52
  const modifiers = useMemo(
45
- () => [fillMaxWidth(), defaultMinSize({minHeight: ROW_HEIGHT}), clickable(() => onExpandedChange(!expanded))],
46
- [expanded, onExpandedChange]
53
+ () => [
54
+ fillMaxWidth(),
55
+ defaultMinSize({minHeight: ROW_HEIGHT}),
56
+ clickable(() => onExpandedChange(!expanded)),
57
+ ...accessibilityModifiers,
58
+ ],
59
+ [accessibilityModifiers, expanded, onExpandedChange]
60
+ )
61
+ const turn = useMemo(
62
+ () => [graphicsLayer({rotationZ: animated(expanded ? 90 : 0, reduced ? SNAP : TURN)})],
63
+ [expanded, reduced]
47
64
  )
48
- const turn = useMemo(() => [graphicsLayer({rotationZ: animated(expanded ? 90 : 0, TURN)})], [expanded])
49
65
 
50
66
  return (
51
67
  <Column modifiers={WIDE}>
@@ -57,7 +73,11 @@ export const Collapsible: CollapsibleComponent = ({children, expanded, label, on
57
73
  <Glyph name="chevronRight" size="s20" />
58
74
  </Box>
59
75
  </Row>
60
- <AnimatedVisibility enterTransition={ENTER} exitTransition={EXIT} visible={expanded}>
76
+ <AnimatedVisibility
77
+ enterTransition={reduced ? FADE_IN : ENTER}
78
+ exitTransition={reduced ? FADE_OUT : EXIT}
79
+ visible={expanded}
80
+ >
61
81
  {children}
62
82
  </AnimatedVisibility>
63
83
  </Column>
@@ -2,7 +2,7 @@ import type {ReactNode} from 'react'
2
2
 
3
3
  /**
4
4
  * A row that shows and hides its content: SwiftUI's `DisclosureGroup` on iOS; on Android a pressable row with a
5
- * chevron over an animated reveal. A native atom — it renders inside `<Screen>` or `<Island>`.
5
+ * chevron over an animated reveal. A native atom: it renders inside `<Screen>` or `<Island>`.
6
6
  */
7
7
  export type CollapsibleProps = {
8
8
  /** Shown while `expanded`. */
@@ -6,7 +6,7 @@ import type {IconName} from '../../atoms/icon'
6
6
  * `action` takes a `Button` so the state can offer a way out.
7
7
  */
8
8
  export type EmptyStateProps = {
9
- /** Under the text — a `Button`, say. */
9
+ /** Under the text: a `Button`, say. */
10
10
  action?: ReactNode
11
11
  /** A second line under the title, in the secondary colour. */
12
12
  description?: string
@@ -4,7 +4,7 @@ import type {ReactNode} from 'react'
4
4
  import type {IconName} from '../../atoms/icon'
5
5
 
6
6
  /**
7
- * An inline icon + text pair — the thing you put inside a button, a menu row or a section
7
+ * An inline icon + text pair: the thing you put inside a button, a menu row or a section
8
8
  * header. For a full tappable row with a subtitle and chevron, use `ListItem`.
9
9
  */
10
10
  export type LabelProps = {
@@ -19,8 +19,19 @@ export const LabeledContent: LabeledContentComponent = ({
19
19
  px,
20
20
  testID,
21
21
  value,
22
+ ...accessibility
22
23
  }: LabeledContentProps) => (
23
- <HStack align="center" onPress={onPress} px={px} py="s8" spacing="s12" testID={testID} wide>
24
+ <HStack
25
+ accessible={children === undefined}
26
+ {...accessibility}
27
+ align="center"
28
+ onPress={onPress}
29
+ px={px}
30
+ py="s8"
31
+ spacing="s12"
32
+ testID={testID}
33
+ wide
34
+ >
24
35
  {icon ? <Icon color="content.secondary" name={icon} size="s20" /> : null}
25
36
  <Text variant="body">{label}</Text>
26
37
  <Spacer />
@@ -1,12 +1,14 @@
1
+ import type {AccessibilityProps} from '@hzblj/kara-sx'
1
2
  import type {SpaceSize} from '@hzblj/kara-theme'
2
3
  import type {ReactNode} from 'react'
3
4
  import type {IconName} from '../../atoms/icon'
4
5
 
5
6
  /**
6
- * A label on the leading edge and its value on the trailing edge — the settings/detail row.
7
- * Pass `children` instead of `value` when the trailing side is a control rather than text.
7
+ * A label on the leading edge and its value on the trailing edge: the settings/detail row.
8
+ * Pass `children` instead of `value` when the trailing side is a control rather than text. With a `value`, screen
9
+ * readers read the row as one element ("Version, 2.4"); with a control, the control stays its own.
8
10
  */
9
- export type LabeledContentProps = {
11
+ export type LabeledContentProps = AccessibilityProps & {
10
12
  /** The trailing side when it is a control, in place of `value`. */
11
13
  children?: ReactNode
12
14
  /** One of the app's icons, before the label, in the secondary colour. */
@@ -15,7 +17,7 @@ export type LabeledContentProps = {
15
17
  label: string
16
18
  /** Makes the row pressable and adds a chevron on the trailing edge. */
17
19
  onPress?: () => void
18
- /** Horizontal padding inside the row — inside its press area too, so Android's ripple reaches the card's edges. */
20
+ /** Horizontal padding inside the row, and inside its press area too, so Android's ripple reaches the card's edges. */
19
21
  px?: SpaceSize
20
22
  /** Test identifier, forwarded to the native view. */
21
23
  testID?: string
@@ -12,13 +12,14 @@ export const Link: LinkComponent = ({
12
12
  testID,
13
13
  url,
14
14
  variant = 'body',
15
+ ...accessibility
15
16
  }: LinkProps) => {
16
17
  const open = () => {
17
18
  Linking.openURL(url).catch(() => undefined)
18
19
  }
19
20
 
20
21
  return (
21
- <HStack align="center" onPress={open} spacing="s8" testID={testID}>
22
+ <HStack accessibilityRole="link" {...accessibility} align="center" onPress={open} spacing="s8" testID={testID}>
22
23
  {icon ? <Icon color={color} name={icon} size="s20" /> : null}
23
24
  <Text color={color} variant={variant}>
24
25
  {label}
@@ -1,10 +1,11 @@
1
+ import type {AccessibilityProps} from '@hzblj/kara-sx'
1
2
  import type {ColorToken, TextVariant} from '@hzblj/kara-theme'
2
3
  import type {ReactNode} from 'react'
3
4
 
4
5
  import type {IconName} from '../../atoms/icon'
5
6
 
6
7
  /** Opens an external URL in the platform browser or the app that claims the scheme. */
7
- export type LinkProps = {
8
+ export type LinkProps = AccessibilityProps & {
8
9
  /** Colours the label and the icon. `content.accent` by default. */
9
10
  color?: ColorToken
10
11
  /** One of the app's icons, before the label. */
@@ -14,8 +14,26 @@ import type {ListItemComponent, ListItemProps} from './list-item.types'
14
14
  */
15
15
  const TEXT_FILLS_ROW = {weight: 1}
16
16
 
17
- export const ListItem: ListItemComponent = ({icon, onPress, px, subtitle, testID, title}: ListItemProps) => (
18
- <HStack align="center" onPress={onPress} px={px} py="s8" spacing="s12" testID={testID} wide>
17
+ export const ListItem: ListItemComponent = ({
18
+ icon,
19
+ onPress,
20
+ px,
21
+ subtitle,
22
+ testID,
23
+ title,
24
+ ...accessibility
25
+ }: ListItemProps) => (
26
+ <HStack
27
+ accessible
28
+ {...accessibility}
29
+ align="center"
30
+ onPress={onPress}
31
+ px={px}
32
+ py="s8"
33
+ spacing="s12"
34
+ testID={testID}
35
+ wide
36
+ >
19
37
  {icon ? <Icon color="content.secondary" name={icon} size="s20" /> : null}
20
38
  <VStack android={TEXT_FILLS_ROW} spacing="s2">
21
39
  <Text variant="body">{title}</Text>
@@ -1,19 +1,21 @@
1
+ import type {AccessibilityProps} from '@hzblj/kara-sx'
1
2
  import type {SpaceSize} from '@hzblj/kara-theme'
2
3
  import type {ReactNode} from 'react'
3
4
 
4
5
  import type {IconName} from '../../atoms/icon'
5
6
 
6
7
  /**
7
- * A row with an optional icon, a title and subtitle, and a chevron when it can be pressed. A native atom — it renders
8
- * inside `<Screen>` or `<Island>`; `RnListItem` is the same row without a host.
8
+ * A row with an optional icon, a title and subtitle, and a chevron when it can be pressed. Screen readers read it as one
9
+ * element (a button when it is pressable). A native atom: it renders inside `<Screen>` or `<Island>`; `RnListItem` is
10
+ * the same row without a host.
9
11
  */
10
- export type ListItemProps = {
12
+ export type ListItemProps = AccessibilityProps & {
11
13
  /** One of the app's icons, before the title, in the secondary colour. */
12
14
  icon?: IconName
13
15
  /** Makes the row pressable and adds a chevron on the trailing edge. */
14
16
  onPress?: () => void
15
17
  /**
16
- * Horizontal padding inside the row — inside its press area too, so Android's ripple reaches the card's edges. For
18
+ * Horizontal padding inside the row, and inside its press area too, so Android's ripple reaches the card's edges. For
17
19
  * rows in a card of your own; a `List` insets its rows by itself.
18
20
  */
19
21
  px?: SpaceSize
@@ -27,7 +27,7 @@ export const NavigationBar: NavigationBarComponent = ({
27
27
  }: NavigationBarProps) => {
28
28
  const theme = useAppTheme()
29
29
  const font = theme.typography.headline
30
- const color = theme.color(inverted ? 'content.on.bg' : 'content.primary')
30
+ const color = theme.color(inverted ? 'content.on.accent' : 'content.primary')
31
31
 
32
32
  const nativeLeadingItems = useMemo(() => leadingItems?.map(toNativeItem), [leadingItems])
33
33
  const nativeTrailingItems = useMemo(() => trailingItems?.map(toNativeItem), [trailingItems])
@@ -38,7 +38,7 @@ export const NavigationBar: NavigationBarComponent = ({
38
38
  const theme = useAppTheme()
39
39
  const barRef = useRef<NavigationBarRef>(null)
40
40
  const font = theme.typography.headline
41
- const color = theme.color(inverted ? 'content.on.bg' : 'content.primary')
41
+ const color = theme.color(inverted ? 'content.on.accent' : 'content.primary')
42
42
 
43
43
  useImperativeHandle(
44
44
  search?.ref,