@hzblj/kara-components 0.6.0 → 0.7.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 (197) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +31 -3
  3. package/lib/module/atoms/checkbox/checkbox.android.js +7 -3
  4. package/lib/module/atoms/checkbox/checkbox.android.js.map +1 -1
  5. package/lib/module/atoms/date-picker/date-picker.ios.js +32 -11
  6. package/lib/module/atoms/date-picker/date-picker.ios.js.map +1 -1
  7. package/lib/module/atoms/index.js +0 -1
  8. package/lib/module/atoms/index.js.map +1 -1
  9. package/lib/module/atoms/rn-flat-list/rn-flat-list.js +10 -9
  10. package/lib/module/atoms/rn-flat-list/rn-flat-list.js.map +1 -1
  11. package/lib/module/atoms/rn-section-list/rn-section-list.js +5 -8
  12. package/lib/module/atoms/rn-section-list/rn-section-list.js.map +1 -1
  13. package/lib/module/atoms/segmented-control/index.js +1 -1
  14. package/lib/module/atoms/segmented-control/index.js.map +1 -1
  15. package/lib/module/atoms/segmented-control/segmented-control.android.js +74 -0
  16. package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -0
  17. package/lib/module/atoms/segmented-control/segmented-control.ios.js +44 -0
  18. package/lib/module/atoms/segmented-control/segmented-control.ios.js.map +1 -0
  19. package/lib/module/atoms/switch/switch.android.js +4 -1
  20. package/lib/module/atoms/switch/switch.android.js.map +1 -1
  21. package/lib/module/molecules/search-bar/search-bar.js +15 -2
  22. package/lib/module/molecules/search-bar/search-bar.js.map +1 -1
  23. package/lib/module/molecules/tooltip/tooltip.android.js +16 -5
  24. package/lib/module/molecules/tooltip/tooltip.android.js.map +1 -1
  25. package/lib/module/organisms/action-sheet/action-sheet.android.js +41 -20
  26. package/lib/module/organisms/action-sheet/action-sheet.android.js.map +1 -1
  27. package/lib/module/organisms/action-sheet/action-sheet.ios.js +24 -8
  28. package/lib/module/organisms/action-sheet/action-sheet.ios.js.map +1 -1
  29. package/lib/module/organisms/alert/alert.ios.js +15 -2
  30. package/lib/module/organisms/alert/alert.ios.js.map +1 -1
  31. package/lib/module/organisms/form/form.android.js +22 -9
  32. package/lib/module/organisms/form/form.android.js.map +1 -1
  33. package/lib/module/organisms/swipe-actions/swipe-actions.android.js +125 -11
  34. package/lib/module/organisms/swipe-actions/swipe-actions.android.js.map +1 -1
  35. package/lib/module/organisms/swipe-actions/swipe-actions.ios.js +46 -18
  36. package/lib/module/organisms/swipe-actions/swipe-actions.ios.js.map +1 -1
  37. package/lib/module/templates/screen/screen.android.js +31 -10
  38. package/lib/module/templates/screen/screen.android.js.map +1 -1
  39. package/lib/typescript/atoms/avatar/avatar.types.d.ts +5 -0
  40. package/lib/typescript/atoms/badge/badge.types.d.ts +3 -0
  41. package/lib/typescript/atoms/button/button.types.d.ts +12 -0
  42. package/lib/typescript/atoms/card/card.types.d.ts +6 -0
  43. package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +5 -0
  44. package/lib/typescript/atoms/chip/chip.types.d.ts +5 -0
  45. package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +4 -0
  46. package/lib/typescript/atoms/date-picker/date-picker.ios.d.ts +6 -1
  47. package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +14 -0
  48. package/lib/typescript/atoms/divider/divider.types.d.ts +3 -0
  49. package/lib/typescript/atoms/fab/fab.types.d.ts +7 -0
  50. package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +1 -0
  51. package/lib/typescript/atoms/h-stack/h-stack.types.d.ts +6 -0
  52. package/lib/typescript/atoms/icon/icon.types.d.ts +8 -0
  53. package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +5 -0
  54. package/lib/typescript/atoms/index.d.ts +0 -1
  55. package/lib/typescript/atoms/island/island.types.d.ts +4 -0
  56. package/lib/typescript/atoms/list/list.types.d.ts +2 -0
  57. package/lib/typescript/atoms/picker/picker.types.d.ts +12 -0
  58. package/lib/typescript/atoms/pressable/pressable.types.d.ts +8 -0
  59. package/lib/typescript/atoms/progress/progress.types.d.ts +6 -0
  60. package/lib/typescript/atoms/rn-flat-list/rn-flat-list.d.ts +5 -8
  61. package/lib/typescript/atoms/rn-flat-list/rn-flat-list.types.d.ts +3 -1
  62. package/lib/typescript/atoms/rn-scroll-view/rn-scroll-view.types.d.ts +4 -0
  63. package/lib/typescript/atoms/rn-section-list/rn-section-list.d.ts +2 -8
  64. package/lib/typescript/atoms/rn-section-list/rn-section-list.types.d.ts +3 -1
  65. package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +4 -0
  66. package/lib/typescript/atoms/rn-view/rn-view.types.d.ts +2 -0
  67. package/lib/typescript/atoms/scroll-view/scroll-view.types.d.ts +4 -0
  68. package/lib/typescript/atoms/segmented-control/segmented-control.d.ts +1 -6
  69. package/lib/typescript/atoms/segmented-control/segmented-control.ios.d.ts +7 -0
  70. package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +13 -0
  71. package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +5 -0
  72. package/lib/typescript/atoms/slider/slider.types.d.ts +7 -0
  73. package/lib/typescript/atoms/spacer/spacer.types.d.ts +3 -0
  74. package/lib/typescript/atoms/surface/surface.types.d.ts +7 -0
  75. package/lib/typescript/atoms/switch/switch.types.d.ts +8 -0
  76. package/lib/typescript/atoms/text/text.types.d.ts +12 -0
  77. package/lib/typescript/atoms/text-field/text-field.types.d.ts +12 -0
  78. package/lib/typescript/atoms/v-stack/v-stack.types.d.ts +9 -0
  79. package/lib/typescript/atoms/z-stack/z-stack.types.d.ts +8 -0
  80. package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +8 -0
  81. package/lib/typescript/molecules/empty-state/empty-state.types.d.ts +5 -0
  82. package/lib/typescript/molecules/label/label.types.d.ts +6 -0
  83. package/lib/typescript/molecules/labeled-content/labeled-content.types.d.ts +6 -0
  84. package/lib/typescript/molecules/link/link.types.d.ts +6 -0
  85. package/lib/typescript/molecules/list-item/list-item.types.d.ts +9 -0
  86. package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -0
  87. package/lib/typescript/molecules/pager/pager.types.d.ts +2 -0
  88. package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +10 -0
  89. package/lib/typescript/molecules/rn-list-item/rn-list-item.types.d.ts +1 -1
  90. package/lib/typescript/molecules/rn-tooltip/rn-tooltip.types.d.ts +11 -0
  91. package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +3 -0
  92. package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +8 -0
  93. package/lib/typescript/molecules/stepper/stepper.types.d.ts +13 -0
  94. package/lib/typescript/molecules/tooltip/tooltip.types.d.ts +12 -0
  95. package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +8 -0
  96. package/lib/typescript/organisms/alert/alert.types.d.ts +11 -0
  97. package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +4 -0
  98. package/lib/typescript/organisms/fab-menu/fab-menu.types.d.ts +2 -0
  99. package/lib/typescript/organisms/form/form.types.d.ts +6 -0
  100. package/lib/typescript/organisms/menu/menu.types.d.ts +17 -0
  101. package/lib/typescript/organisms/sheet/sheet.types.d.ts +19 -0
  102. package/lib/typescript/organisms/snackbar/snackbar.types.d.ts +8 -0
  103. package/lib/typescript/organisms/swipe-actions/swipe-actions.types.d.ts +36 -13
  104. package/lib/typescript/templates/screen/screen.types.d.ts +9 -0
  105. package/package.json +5 -7
  106. package/src/atoms/avatar/avatar.types.ts +5 -0
  107. package/src/atoms/badge/badge.types.ts +3 -0
  108. package/src/atoms/button/button.types.ts +12 -0
  109. package/src/atoms/card/card.types.ts +6 -0
  110. package/src/atoms/checkbox/checkbox.android.tsx +7 -3
  111. package/src/atoms/checkbox/checkbox.types.ts +5 -0
  112. package/src/atoms/chip/chip.types.ts +5 -0
  113. package/src/atoms/color-picker/color-picker.types.ts +4 -0
  114. package/src/atoms/date-picker/date-picker.ios.tsx +33 -13
  115. package/src/atoms/date-picker/date-picker.types.ts +14 -0
  116. package/src/atoms/divider/divider.types.ts +3 -0
  117. package/src/atoms/fab/fab.types.ts +7 -0
  118. package/src/atoms/glass-view/glass-view.types.ts +1 -0
  119. package/src/atoms/h-stack/h-stack.types.ts +6 -0
  120. package/src/atoms/icon/icon.types.ts +8 -0
  121. package/src/atoms/icon-button/icon-button.types.ts +5 -0
  122. package/src/atoms/index.ts +0 -1
  123. package/src/atoms/island/island.types.ts +4 -0
  124. package/src/atoms/list/list.types.ts +2 -0
  125. package/src/atoms/picker/picker.types.ts +12 -0
  126. package/src/atoms/pressable/pressable.types.ts +8 -0
  127. package/src/atoms/progress/progress.types.ts +6 -0
  128. package/src/atoms/rn-flat-list/rn-flat-list.tsx +8 -8
  129. package/src/atoms/rn-flat-list/rn-flat-list.types.ts +3 -1
  130. package/src/atoms/rn-scroll-view/rn-scroll-view.types.ts +4 -0
  131. package/src/atoms/rn-section-list/rn-section-list.tsx +5 -8
  132. package/src/atoms/rn-section-list/rn-section-list.types.ts +3 -1
  133. package/src/atoms/rn-text/rn-text.types.ts +4 -0
  134. package/src/atoms/rn-view/rn-view.types.ts +2 -0
  135. package/src/atoms/scroll-view/scroll-view.types.ts +4 -0
  136. package/src/atoms/segmented-control/segmented-control.android.tsx +79 -0
  137. package/src/atoms/segmented-control/segmented-control.ios.tsx +47 -0
  138. package/src/atoms/segmented-control/segmented-control.types.ts +13 -0
  139. package/src/atoms/skeleton/skeleton.types.ts +5 -0
  140. package/src/atoms/slider/slider.types.ts +7 -0
  141. package/src/atoms/spacer/spacer.types.ts +3 -0
  142. package/src/atoms/surface/surface.types.ts +7 -0
  143. package/src/atoms/switch/switch.android.tsx +4 -1
  144. package/src/atoms/switch/switch.types.ts +8 -0
  145. package/src/atoms/text/text.types.ts +12 -0
  146. package/src/atoms/text-field/text-field.types.ts +12 -0
  147. package/src/atoms/v-stack/v-stack.types.ts +9 -0
  148. package/src/atoms/z-stack/z-stack.types.ts +8 -0
  149. package/src/molecules/collapsible/collapsible.types.ts +8 -0
  150. package/src/molecules/empty-state/empty-state.types.ts +5 -0
  151. package/src/molecules/label/label.types.ts +6 -0
  152. package/src/molecules/labeled-content/labeled-content.types.ts +6 -0
  153. package/src/molecules/link/link.types.ts +6 -0
  154. package/src/molecules/list-item/list-item.types.ts +9 -0
  155. package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -0
  156. package/src/molecules/pager/pager.types.ts +2 -0
  157. package/src/molecules/radio-group/radio-group.types.ts +10 -0
  158. package/src/molecules/rn-list-item/rn-list-item.types.ts +1 -1
  159. package/src/molecules/rn-tooltip/rn-tooltip.types.ts +11 -0
  160. package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +3 -0
  161. package/src/molecules/search-bar/search-bar.tsx +9 -2
  162. package/src/molecules/search-bar/search-bar.types.ts +8 -0
  163. package/src/molecules/stepper/stepper.types.ts +13 -0
  164. package/src/molecules/tooltip/tooltip.android.tsx +17 -9
  165. package/src/molecules/tooltip/tooltip.types.ts +12 -0
  166. package/src/organisms/action-sheet/action-sheet.android.tsx +37 -19
  167. package/src/organisms/action-sheet/action-sheet.ios.tsx +22 -9
  168. package/src/organisms/action-sheet/action-sheet.types.ts +8 -0
  169. package/src/organisms/alert/alert.ios.tsx +11 -1
  170. package/src/organisms/alert/alert.types.ts +11 -0
  171. package/src/organisms/context-menu/context-menu.types.ts +4 -0
  172. package/src/organisms/fab-menu/fab-menu.types.ts +2 -0
  173. package/src/organisms/form/form.android.tsx +15 -7
  174. package/src/organisms/form/form.types.ts +6 -0
  175. package/src/organisms/menu/menu.types.ts +17 -0
  176. package/src/organisms/sheet/sheet.types.ts +19 -0
  177. package/src/organisms/snackbar/snackbar.types.ts +8 -0
  178. package/src/organisms/swipe-actions/swipe-actions.android.tsx +129 -9
  179. package/src/organisms/swipe-actions/swipe-actions.ios.tsx +45 -11
  180. package/src/organisms/swipe-actions/swipe-actions.types.ts +37 -14
  181. package/src/templates/screen/screen.android.tsx +33 -12
  182. package/src/templates/screen/screen.types.ts +9 -0
  183. package/lib/module/atoms/flash-list/flash-list.js +0 -31
  184. package/lib/module/atoms/flash-list/flash-list.js.map +0 -1
  185. package/lib/module/atoms/flash-list/flash-list.types.js +0 -4
  186. package/lib/module/atoms/flash-list/flash-list.types.js.map +0 -1
  187. package/lib/module/atoms/flash-list/index.js +0 -5
  188. package/lib/module/atoms/flash-list/index.js.map +0 -1
  189. package/lib/module/atoms/segmented-control/segmented-control.js +0 -40
  190. package/lib/module/atoms/segmented-control/segmented-control.js.map +0 -1
  191. package/lib/typescript/atoms/flash-list/flash-list.d.ts +0 -8
  192. package/lib/typescript/atoms/flash-list/flash-list.types.d.ts +0 -18
  193. package/lib/typescript/atoms/flash-list/index.d.ts +0 -2
  194. package/src/atoms/flash-list/flash-list.tsx +0 -28
  195. package/src/atoms/flash-list/flash-list.types.ts +0 -20
  196. package/src/atoms/flash-list/index.ts +0 -2
  197. package/src/atoms/segmented-control/segmented-control.tsx +0 -47
@@ -1,12 +1,24 @@
1
1
  import type { ReactNode } from 'react';
2
+ /**
3
+ * An uncontrolled text field with an optional label above it — SwiftUI `TextField` (`SecureField` when `secure`) /
4
+ * Compose `OutlinedTextField`.
5
+ */
2
6
  export type TextFieldProps = {
7
+ /** The text it starts with. Read once, on mount — the field is uncontrolled. */
3
8
  defaultValue?: string;
9
+ /** Stops editing and dims the field. On iOS it outranks `error`. */
4
10
  disabled?: boolean;
11
+ /** Marks the field invalid: a destructive outline and label. */
5
12
  error?: boolean;
13
+ /** Shown above the field, in `labelMedium`. */
6
14
  label?: string;
15
+ /** Wraps the text and grows the field to fit it. iOS ignores it when `secure`. */
7
16
  multiline?: boolean;
17
+ /** Called with the whole text after every change. */
8
18
  onChangeText?: (text: string) => void;
19
+ /** Masks the text, for a password. */
9
20
  secure?: boolean;
21
+ /** iOS: forwarded to the native field. Android ignores it. */
10
22
  testID?: string;
11
23
  };
12
24
  export type TextFieldComponent = (props: TextFieldProps) => ReactNode;
@@ -2,11 +2,20 @@ import type { ResponsiveSx } from '@hzblj/kara-sx';
2
2
  import type { SpaceSize } from '@hzblj/kara-theme';
3
3
  import type { ReactNode } from 'react';
4
4
  export type VStackAlign = 'center' | 'end' | 'start';
5
+ /** Stacks its children top to bottom — SwiftUI `VStack` / Compose `Column`. */
5
6
  export type VStackProps = ResponsiveSx & {
7
+ /** The children's horizontal alignment. `start` by default. */
6
8
  align?: VStackAlign;
9
+ /** Laid out top to bottom, `spacing` apart. */
7
10
  children?: ReactNode;
11
+ /**
12
+ * Makes the whole stack pressable. iOS adds a tap gesture with no press feedback; Android a `clickable` whose ripple
13
+ * fills the stack's shape.
14
+ */
8
15
  onPress?: () => void;
16
+ /** The space between children. */
9
17
  spacing?: SpaceSize;
18
+ /** Test identifier, forwarded to the native view. */
10
19
  testID?: string;
11
20
  };
12
21
  export type VStackComponent = (props: VStackProps) => ReactNode;
@@ -1,10 +1,18 @@
1
1
  import type { ResponsiveSx } from '@hzblj/kara-sx';
2
2
  import type { ReactNode } from 'react';
3
3
  export type ZStackAlign = 'bottom' | 'center' | 'top';
4
+ /** Layers its children on one another — SwiftUI `ZStack` / Compose `Box`. */
4
5
  export type ZStackProps = ResponsiveSx & {
6
+ /** Where the children sit vertically; they are always centred horizontally. `center` by default. */
5
7
  align?: ZStackAlign;
8
+ /** Drawn in order, the last on top. */
6
9
  children?: ReactNode;
10
+ /**
11
+ * Makes the whole stack pressable. iOS adds a tap gesture with no press feedback; Android a `clickable` whose ripple
12
+ * fills the stack's shape.
13
+ */
7
14
  onPress?: () => void;
15
+ /** Test identifier, forwarded to the native view. */
8
16
  testID?: string;
9
17
  };
10
18
  export type ZStackComponent = (props: ZStackProps) => ReactNode;
@@ -1,8 +1,16 @@
1
1
  import type { ReactNode } from 'react';
2
+ /**
3
+ * A row that shows and hides its content: SwiftUI's `DisclosureGroup` on iOS; on Android a pressable row with a
4
+ * chevron over an animated reveal. A native atom — it renders inside `<Screen>` or `<Island>`.
5
+ */
2
6
  export type CollapsibleProps = {
7
+ /** Shown while `expanded`. */
3
8
  children: ReactNode;
9
+ /** Whether the content is shown. Update it from `onExpandedChange`. */
4
10
  expanded: boolean;
11
+ /** The row's text. */
5
12
  label: string;
13
+ /** The user pressed the row; it passes the state the row asks for. */
6
14
  onExpandedChange: (expanded: boolean) => void;
7
15
  };
8
16
  export type CollapsibleComponent = (props: CollapsibleProps) => ReactNode;
@@ -5,10 +5,15 @@ import type { IconName } from '../../atoms/icon';
5
5
  * `action` takes a `Button` so the state can offer a way out.
6
6
  */
7
7
  export type EmptyStateProps = {
8
+ /** Under the text — a `Button`, say. */
8
9
  action?: ReactNode;
10
+ /** A second line under the title, in the secondary colour. */
9
11
  description?: string;
12
+ /** One of the app's icons, large and muted above the title. */
10
13
  icon?: IconName;
14
+ /** Test identifier, forwarded to the native view. */
11
15
  testID?: string;
16
+ /** The headline. */
12
17
  title: string;
13
18
  };
14
19
  export type EmptyStateComponent = (props: EmptyStateProps) => ReactNode;
@@ -6,11 +6,17 @@ import type { IconName } from '../../atoms/icon';
6
6
  * header. For a full tappable row with a subtitle and chevron, use `ListItem`.
7
7
  */
8
8
  export type LabelProps = {
9
+ /** Colours the icon and the title alike. `content.primary` by default. */
9
10
  color?: ColorToken;
11
+ /** One of the app's icons, before the title. */
10
12
  icon: IconName;
13
+ /** The icon's size. `s20` by default. */
11
14
  iconSize?: SpaceSize;
15
+ /** Test identifier, forwarded to the native view. */
12
16
  testID?: string;
17
+ /** The text beside the icon. */
13
18
  title: string;
19
+ /** The title's text style. `body` by default. */
14
20
  variant?: TextVariant;
15
21
  };
16
22
  export type LabelComponent = (props: LabelProps) => ReactNode;
@@ -6,13 +6,19 @@ import type { IconName } from '../../atoms/icon';
6
6
  * Pass `children` instead of `value` when the trailing side is a control rather than text.
7
7
  */
8
8
  export type LabeledContentProps = {
9
+ /** The trailing side when it is a control, in place of `value`. */
9
10
  children?: ReactNode;
11
+ /** One of the app's icons, before the label, in the secondary colour. */
10
12
  icon?: IconName;
13
+ /** The leading text. */
11
14
  label: string;
15
+ /** Makes the row pressable and adds a chevron on the trailing edge. */
12
16
  onPress?: () => void;
13
17
  /** Horizontal padding inside the row — inside its press area too, so Android's ripple reaches the card's edges. */
14
18
  px?: SpaceSize;
19
+ /** Test identifier, forwarded to the native view. */
15
20
  testID?: string;
21
+ /** The trailing text, in the secondary colour. Ignored when `children` is given. */
16
22
  value?: string;
17
23
  };
18
24
  export type LabeledContentComponent = (props: LabeledContentProps) => ReactNode;
@@ -3,11 +3,17 @@ import type { ReactNode } from 'react';
3
3
  import type { IconName } from '../../atoms/icon';
4
4
  /** Opens an external URL in the platform browser or the app that claims the scheme. */
5
5
  export type LinkProps = {
6
+ /** Colours the label and the icon. `content.accent` by default. */
6
7
  color?: ColorToken;
8
+ /** One of the app's icons, before the label. */
7
9
  icon?: IconName;
10
+ /** The link's text. */
8
11
  label: string;
12
+ /** Test identifier, forwarded to the native view. */
9
13
  testID?: string;
14
+ /** Opened through React Native's `Linking` on press. A URL nothing can open fails silently. */
10
15
  url: string;
16
+ /** The label's text style. `body` by default. */
11
17
  variant?: TextVariant;
12
18
  };
13
19
  export type LinkComponent = (props: LinkProps) => ReactNode;
@@ -1,16 +1,25 @@
1
1
  import type { SpaceSize } from '@hzblj/kara-theme';
2
2
  import type { ReactNode } from 'react';
3
3
  import type { IconName } from '../../atoms/icon';
4
+ /**
5
+ * A row with an optional icon, a title and subtitle, and a chevron when it can be pressed. A native atom — it renders
6
+ * inside `<Screen>` or `<Island>`; `RnListItem` is the same row without a host.
7
+ */
4
8
  export type ListItemProps = {
9
+ /** One of the app's icons, before the title, in the secondary colour. */
5
10
  icon?: IconName;
11
+ /** Makes the row pressable and adds a chevron on the trailing edge. */
6
12
  onPress?: () => void;
7
13
  /**
8
14
  * Horizontal padding inside the row — inside its press area too, so Android's ripple reaches the card's edges. For
9
15
  * rows in a card of your own; a `List` insets its rows by itself.
10
16
  */
11
17
  px?: SpaceSize;
18
+ /** A second line under the title, smaller and in the secondary colour. */
12
19
  subtitle?: string;
20
+ /** Test identifier, forwarded to the row's view. */
13
21
  testID?: string;
22
+ /** The row's main text. */
14
23
  title: string;
15
24
  };
16
25
  export type ListItemComponent = (props: ListItemProps) => ReactNode;
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode, Ref } from 'react';
2
2
  import type { IconName } from '../../atoms/icon';
3
3
  type NavigationBarItemBase = {
4
+ /** Called when the item is pressed. */
4
5
  onPress: () => void;
5
6
  /**
6
7
  * iOS 26: neighbouring items on one side share a glass capsule; this gives the item its own. A close next to
@@ -29,10 +30,15 @@ export type NavigationBarSearchRef = {
29
30
  };
30
31
  /** A search field in place of the title — iOS only for now; Android keeps the title. */
31
32
  export type NavigationBarSearch = {
33
+ /** Every edit of the field's text. */
32
34
  onChangeText: (text: string) => void;
35
+ /** The field gained or lost focus. */
33
36
  onFocusChange?: (focused: boolean) => void;
37
+ /** Shown while the field is empty. */
34
38
  placeholder: string;
39
+ /** Imperative `clear`. */
35
40
  ref?: Ref<NavigationBarSearchRef>;
41
+ /** Test identifier, forwarded to the native search field. */
36
42
  testID?: string;
37
43
  };
38
44
  export type NavigationBarTitleAlignment = 'center' | 'leading';
@@ -50,7 +56,9 @@ export type NavigationBarProps = {
50
56
  leadingItems?: NavigationBarItem[];
51
57
  /** Replaces the title with a search field (iOS). */
52
58
  search?: NavigationBarSearch;
59
+ /** Test identifier, forwarded to the native bar. iOS only — Android ignores it. */
53
60
  testID?: string;
61
+ /** The bar's title. */
54
62
  title?: string;
55
63
  /** `center` by default — iOS's own; `leading` is Material's top app bar. */
56
64
  titleAlignment?: NavigationBarTitleAlignment;
@@ -10,6 +10,7 @@ import type { ReactNode } from 'react';
10
10
  * ceremony would buy nothing.
11
11
  */
12
12
  export type PagerProps = {
13
+ /** The pages, one per child, in order. */
13
14
  children?: ReactNode;
14
15
  /**
15
16
  * Page dots. iOS draws SwiftUI's own, over the bottom edge; Compose has no built-in indicator, so
@@ -27,6 +28,7 @@ export type PagerProps = {
27
28
  * content down with the swipe, so iOS always stays swipeable.
28
29
  */
29
30
  scrollEnabled?: boolean;
31
+ /** Test identifier, forwarded to the native view. */
30
32
  testID?: string;
31
33
  };
32
34
  export type PagerComponent = (props: PagerProps) => ReactNode;
@@ -1,11 +1,21 @@
1
1
  import type { ReactNode } from 'react';
2
+ /** One choice of a `RadioGroup`. */
2
3
  export type RadioOption = {
4
+ /** The option's text. */
3
5
  label: string;
6
+ /** Identifies the option to `value` and `onValueChange`, and keys its row — keep it unique. */
4
7
  value: string;
5
8
  };
9
+ /**
10
+ * A single choice from a list: rows with a checkmark on the selected one on iOS, Material radio buttons on Android. A
11
+ * native atom — it renders inside `<Screen>` or `<Island>`.
12
+ */
6
13
  export type RadioGroupProps = {
14
+ /** The user pressed an option; it passes that option's `value`. */
7
15
  onValueChange?: (value: string) => void;
16
+ /** The choices, top to bottom. */
8
17
  options: RadioOption[];
18
+ /** The selected option's `value`. Update it from `onValueChange`. */
9
19
  value: string;
10
20
  };
11
21
  export type RadioGroupComponent = (props: RadioGroupProps) => ReactNode;
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import type { ListItemProps } from '../list-item';
3
3
  /**
4
4
  * `ListItem`'s row in the React Native tier — plain views, no host. For lists long enough that a native host per row
5
- * would cost too much to mount (a navigation list, a FlashList of rows), with the platform's own press feedback: a
5
+ * would cost too much to mount (a navigation list, an `RnFlatList` of rows), with the platform's own press feedback: a
6
6
  * ripple across the whole row on Android, a highlight on iOS. In a rounded card, give the card `overflow="hidden"`:
7
7
  * Android draws the ripple as the row's foreground, which only a parent's clip keeps inside rounded corners.
8
8
  */
@@ -1,7 +1,10 @@
1
1
  import type { ReactElement, ReactNode } from 'react';
2
2
  export type RnTooltipActionVariant = 'link' | 'primary' | 'secondary';
3
+ /** A button in an `RnTooltip`. */
3
4
  export type RnTooltipAction = {
5
+ /** The button's text. */
4
6
  label: string;
7
+ /** Called on press. The tooltip stays up — turn `visible` off here if the action should close it. */
5
8
  onPress: () => void;
6
9
  /** `link` by default — an underlined text. `primary`/`secondary` are small filled/outlined buttons. */
7
10
  variant?: RnTooltipActionVariant;
@@ -14,6 +17,7 @@ export type RnTooltipDismissReason = 'anchorHidden' | 'outside';
14
17
  * Native tier, unlike `Tooltip`, whose anchor is a native view inside a host.
15
18
  */
16
19
  export type RnTooltipProps = {
20
+ /** A row of buttons under the text, in order. */
17
21
  actions?: RnTooltipAction[];
18
22
  /** Which end of the bubble the actions sit at. `end` by default. */
19
23
  actionsAlignment?: 'end' | 'start';
@@ -27,11 +31,18 @@ export type RnTooltipProps = {
27
31
  };
28
32
  /** The anchor — a single React Native view. */
29
33
  children: ReactElement;
34
+ /** The body text, under the title. */
30
35
  message?: string;
36
+ /**
37
+ * Asks for the tooltip to close, with the reason — turn `visible` off. On Android any touch outside asks, the start
38
+ * of a scroll included; iOS keeps the tooltip through a scroll.
39
+ */
31
40
  onDismiss: (reason: RnTooltipDismissReason) => void;
32
41
  /** The appear animation finished. */
33
42
  onShown?: () => void;
43
+ /** The heading line, above the message. */
34
44
  title?: string;
45
+ /** Shows the tooltip while true. It never hides itself. */
35
46
  visible: boolean;
36
47
  };
37
48
  export type RnTooltipComponent = (props: RnTooltipProps) => ReactNode;
@@ -15,12 +15,15 @@ export type ScrollEdgeContainerProps = ResponsiveViewSx & {
15
15
  * content begins below the top bar and scrolls under it. On by default.
16
16
  */
17
17
  automaticInsets?: boolean;
18
+ /** Laid over the scroll view's bottom edge on iOS; stacked below it on Android, where it wants a background. */
18
19
  bottomBar?: ReactNode;
19
20
  /** Exactly one React Native scroll view — `RnScrollView`, `RnFlatList`, `RnSectionList`. */
20
21
  children: ReactElement<ScrollEdgeScrollableProps>;
21
22
  /** iOS 26: how hard the edge cuts. `soft` by default. */
22
23
  effect?: ScrollEdgeEffect;
24
+ /** Test identifier, forwarded to the container view. */
23
25
  testID?: string;
26
+ /** Laid over the scroll view's top edge on iOS; stacked above it on Android, where it wants a background. */
24
27
  topBar?: ReactNode;
25
28
  };
26
29
  export type ScrollEdgeContainerComponent = (props: ScrollEdgeContainerProps) => ReactNode;
@@ -1,8 +1,16 @@
1
1
  import type { ReactNode } from 'react';
2
+ /**
3
+ * A search field drawn the same on both platforms — a rounded box with a magnifier, a `TextInput` and a clear button
4
+ * while there is text. The React Native tier: it needs no host.
5
+ */
2
6
  export type SearchBarProps = {
7
+ /** Every edit, and `''` when the clear button is pressed. */
3
8
  onChangeText?: (text: string) => void;
9
+ /** Shown while the field is empty. `Search` by default. */
4
10
  placeholder?: string;
11
+ /** Test identifier, put on the field's container view rather than on the `TextInput`. */
5
12
  testID?: string;
13
+ /** The field's text. Controlled — pass back what `onChangeText` reports. */
6
14
  value: string;
7
15
  };
8
16
  export type SearchBarComponent = (props: SearchBarProps) => ReactNode;
@@ -1,10 +1,23 @@
1
1
  import type { ReactNode } from 'react';
2
+ /**
3
+ * A number with minus and plus buttons beside a label: SwiftUI's `Stepper` on iOS; on Android the label, the value and
4
+ * two icon buttons in a row. A native atom — it renders inside `<Screen>` or `<Island>`.
5
+ */
2
6
  export type StepperProps = {
7
+ /**
8
+ * The leading text. iOS shows only the label, not the value — put the value in it if it should be seen. Android
9
+ * shows the value between its buttons.
10
+ */
3
11
  label: string;
12
+ /** The highest value. When unset, Android has no upper limit and iOS stops at `100`. */
4
13
  max?: number;
14
+ /** The lowest value. When unset, Android has no lower limit and iOS stops at `0`. */
5
15
  min?: number;
16
+ /** A button was pressed; it passes the new value, kept within `min` and `max`. */
6
17
  onValueChange: (value: number) => void;
18
+ /** How much one press adds or takes away. `1` by default. */
7
19
  step?: number;
20
+ /** The current value. Update it from `onValueChange`. iOS's native stepper counts in whole numbers. */
8
21
  value: number;
9
22
  };
10
23
  export type StepperComponent = (props: StepperProps) => ReactNode;
@@ -1,8 +1,20 @@
1
1
  import type { ReactNode } from 'react';
2
+ /**
3
+ * A short text tip on a native view, shown while `visible` — a SwiftUI popover from `children` on iOS, Material's plain
4
+ * tooltip centred above them on Android. A native atom — it renders inside `<Screen>` or `<Island>`; `RnTooltip`
5
+ * anchors to a React Native view.
6
+ */
2
7
  export type TooltipProps = {
8
+ /** The anchor — a native view. */
3
9
  children: ReactNode;
10
+ /** The tip. */
4
11
  text: string;
12
+ /** Shows the tip while true. Controlled: nothing opens it but this — wire a long press to it if you want one. */
5
13
  visible: boolean;
14
+ /**
15
+ * The user dismissed the tip — turn `visible` off. iOS: a tap outside the popover. Android: any touch outside it, the
16
+ * start of a scroll included, or the anchor scrolling out of the window.
17
+ */
6
18
  onDismiss: () => void;
7
19
  };
8
20
  export type TooltipComponent = (props: TooltipProps) => ReactNode;
@@ -1,9 +1,17 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { MenuAction } from '../menu';
3
+ /**
4
+ * A list of actions to pick one from: SwiftUI's confirmation dialog on iOS, a `Sheet` of Material rows — icon and label
5
+ * — under the title on Android. A native atom — it renders inside `<Screen>` or `<Island>`.
6
+ */
3
7
  export type ActionSheetProps = {
8
+ /** The choices, top to bottom. Picking one closes the sheet. */
4
9
  actions: MenuAction[];
10
+ /** The sheet closed — after a pick too — so turn `visible` off. */
5
11
  onDismiss: () => void;
12
+ /** The heading above the actions. Android always shows it; on iOS the system decides, and may hide it. */
6
13
  title: string;
14
+ /** Presents the sheet while true. */
7
15
  visible: boolean;
8
16
  };
9
17
  export type ActionSheetComponent = (props: ActionSheetProps) => ReactNode;
@@ -1,11 +1,22 @@
1
1
  import type { ReactNode } from 'react';
2
+ /**
3
+ * A modal alert with a confirm button and Cancel: SwiftUI's alert on iOS, Material's `AlertDialog` on Android. A native
4
+ * atom — it renders inside `<Screen>` or `<Island>`.
5
+ */
2
6
  export type AlertProps = {
7
+ /** The confirm button's label. `OK` by default. */
3
8
  confirmLabel?: string;
9
+ /** Marks the confirm button destructive — the system's destructive role on iOS, the destructive colour on Android. */
4
10
  destructive?: boolean;
11
+ /** The body text, under the title. */
5
12
  message?: string;
13
+ /** The confirm button was pressed. `onDismiss` follows, as it does for every way the alert closes. */
6
14
  onConfirm?: () => void;
15
+ /** The alert closed — either button, or on Android a tap outside or back — so turn `visible` off. */
7
16
  onDismiss: () => void;
17
+ /** The alert's heading. */
8
18
  title: string;
19
+ /** Shows the alert while true. */
9
20
  visible: boolean;
10
21
  };
11
22
  export type AlertComponent = (props: AlertProps) => ReactNode;
@@ -9,6 +9,7 @@ import type { MenuAction } from '../menu';
9
9
  * needs no `Screen` or `Island`.
10
10
  */
11
11
  export type ContextMenuProps = ResponsiveViewSx & {
12
+ /** The menu's actions, top to bottom. */
12
13
  actions: MenuAction[];
13
14
  /** The trigger, laid out as usual. */
14
15
  children: ReactNode;
@@ -28,9 +29,12 @@ export type ContextMenuProps = ResponsiveViewSx & {
28
29
  * `ZoomTransition.Source`, `pop` otherwise.
29
30
  */
30
31
  previewTransition?: 'dismiss' | 'pop' | 'zoom';
32
+ /** Test identifier — on the native view around the trigger on iOS, on the trigger's `Pressable` on Android. */
31
33
  testID?: string;
32
34
  };
35
+ /** A region of a `ContextMenu`'s trigger that keeps its own long press — see `ContextMenu.Exclusion`. */
33
36
  export type ContextMenuExclusionProps = {
37
+ /** The region — a button inside the card, say. */
34
38
  children: ReactNode;
35
39
  };
36
40
  export type ContextMenuComponent = ((props: ContextMenuProps) => ReactNode) & {
@@ -7,9 +7,11 @@ import type { MenuAction } from '../menu';
7
7
  * of a SwiftUI `Menu`. A native atom — it renders inside `<Screen>` or `<Island>`.
8
8
  */
9
9
  export type FabMenuProps = {
10
+ /** The actions the button unfolds into. */
10
11
  actions: MenuAction[];
11
12
  /** The closed button's icon — one of the app's. A plus by default. */
12
13
  icon?: IconName;
14
+ /** Test identifier, forwarded to the SwiftUI `Menu`. iOS only — Android ignores it. */
13
15
  testID?: string;
14
16
  };
15
17
  export type FabMenuComponent = (props: FabMenuProps) => ReactNode;
@@ -5,12 +5,18 @@ import type { ReactNode } from 'react';
5
5
  * an island that sizes itself to its content it has no height and shows nothing.
6
6
  */
7
7
  export type FormProps = {
8
+ /** The form's `Form.Section`s. */
8
9
  children: ReactNode;
10
+ /** Test identifier, forwarded to the native view. */
9
11
  testID?: string;
10
12
  };
13
+ /** A group of rows in a `Form`: a SwiftUI `Section` on iOS, a `Card` under a heading on Android. */
11
14
  export type FormSectionProps = {
15
+ /** The section's rows. */
12
16
  children: ReactNode;
17
+ /** Small print under the section. */
13
18
  footer?: string;
19
+ /** The section's heading. */
14
20
  title?: string;
15
21
  };
16
22
  export type FormComponent = ((props: FormProps) => ReactNode) & {
@@ -1,13 +1,30 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { IconName } from '../../atoms/icon';
3
+ /** One action of a `Menu`, an `ActionSheet`, a `ContextMenu` or a `FabMenu`. */
3
4
  export type MenuAction = {
5
+ /**
6
+ * Draws the action in the destructive colour — the system's destructive role on iOS. `FabMenu` ignores it on
7
+ * Android.
8
+ */
4
9
  destructive?: boolean;
10
+ /**
11
+ * One of the app's icons, before the label. `ContextMenu` and `FabMenu` show it on both platforms, `Menu` and
12
+ * `ActionSheet` on Android only.
13
+ */
5
14
  icon?: IconName;
15
+ /** The action's text. Rows are keyed by it, so keep labels unique within one list. */
6
16
  label: string;
17
+ /** Called when the action is chosen; the menu closes by itself. */
7
18
  onPress: () => void;
8
19
  };
20
+ /**
21
+ * A text button that opens a list of actions: a SwiftUI `Menu` on iOS, a Material dropdown anchored to it on Android.
22
+ * A native atom — it renders inside `<Screen>` or `<Island>`.
23
+ */
9
24
  export type MenuProps = {
25
+ /** The menu's actions, top to bottom. */
10
26
  actions: MenuAction[];
27
+ /** The trigger's text. Android draws it in the accent colour, with a chevron. */
11
28
  label: string;
12
29
  };
13
30
  export type MenuComponent = (props: MenuProps) => ReactNode;
@@ -24,13 +24,16 @@ export type SheetHeaderProps = {
24
24
  leadingItems?: NavigationBarItem[];
25
25
  /** A search field in place of the title (iOS). */
26
26
  search?: NavigationBarSearch;
27
+ /** The title — in the bar, or above the content with a `large` `titleStyle`. */
27
28
  title?: string;
28
29
  /** `center` by default. */
29
30
  titleStyle?: SheetTitleStyle;
30
31
  /** In screen order, toward the trailing edge — the close item, by convention. */
31
32
  trailingItems?: NavigationBarItem[];
32
33
  };
34
+ /** Imperative control of a `Sheet`, through its `ref`. */
33
35
  export type SheetRef = {
36
+ /** Dismisses it without calling `onDismiss`, which reports the user's dismissals only. */
34
37
  dismiss: () => Promise<void>;
35
38
  /** Presents at a detent — the first by default. */
36
39
  present: (detentIndex?: number) => Promise<void>;
@@ -45,6 +48,7 @@ export type SheetRef = {
45
48
  export type SheetProps = {
46
49
  /** The sheet's colour. `surface.primary` by default. */
47
50
  bg?: ColorToken;
51
+ /** The content. A `<Sheet.Header>` among the direct children becomes the native header instead. */
48
52
  children: ReactNode;
49
53
  /** Where the sheet can rest, smallest first. `['auto']` — fit the content — by default. */
50
54
  detents?: SheetDetent[];
@@ -60,29 +64,44 @@ export type SheetProps = {
60
64
  grabber?: boolean;
61
65
  /** The user dismissed it — `visible` going false does not call this. */
62
66
  onDismiss: () => void;
67
+ /** The sheet moved to another detent — its index in `detents`. */
63
68
  onDetentChange?: (detentIndex: number) => void;
69
+ /** The sheet finished presenting. */
64
70
  onPresent?: () => void;
71
+ /** `present`, `dismiss` and `resize`, for driving the sheet imperatively. */
65
72
  ref?: Ref<SheetRef>;
66
73
  /**
67
74
  * The content is a scroll view (`<Sheet.ScrollView>`) the sheet drives: dragging past its top resizes the sheet,
68
75
  * and a header scrolls with the iOS 26 edge effect. Off by default — set it with a scrolling body.
69
76
  */
70
77
  scrollable?: boolean;
78
+ /** Test identifier, forwarded to the native sheet. */
71
79
  testID?: string;
80
+ /** Presents the sheet while true; going false dismisses it. */
72
81
  visible: boolean;
73
82
  };
74
83
  export type SheetScrollHandler = (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
75
84
  /** What a scroll view inside a sheet needs: the room the header takes, the large title, the scroll listener. */
76
85
  export type SheetScrollContextValue = {
86
+ /** Render it first in the content. `null` unless the header's `titleStyle` is `large`. */
77
87
  largeTitle: ReactNode;
88
+ /** Forward the scroll view's scroll events to it — it tracks the large title. Unset when there is none. */
78
89
  onScroll?: SheetScrollHandler;
90
+ /** The room an overlaid header takes, to add to the content's top padding. `0` where the header sits above it. */
79
91
  topInset: number;
80
92
  };
93
+ /**
94
+ * The body of a `scrollable` sheet: its content starts below an overlaid header, it carries a large title, and it
95
+ * reports its scroll to the sheet.
96
+ */
81
97
  export type SheetScrollViewProps = Pick<ScrollViewProps, 'keyboardShouldPersistTaps'> & {
98
+ /** The scrolling content, after the large title if there is one. */
82
99
  children: ReactNode;
83
100
  /** Styles the scrolling content — padding and gap belong here, as with `RnScrollView`. */
84
101
  content?: ResponsiveViewSx;
102
+ /** Called on every scroll event, after the sheet's own listener. */
85
103
  onScroll?: SheetScrollHandler;
104
+ /** Test identifier, forwarded to the scroll view. */
86
105
  testID?: string;
87
106
  };
88
107
  export type SheetComponent = ((props: SheetProps) => ReactNode) & {
@@ -1,8 +1,16 @@
1
1
  import type { ReactNode } from 'react';
2
+ /**
3
+ * A short message laid over the bottom of its parent, with an optional action. The React Native tier, drawn the same on
4
+ * both platforms: it needs no host, and it never hides itself.
5
+ */
2
6
  export type SnackbarProps = {
7
+ /** The action button's text, on the trailing side. No button without it. */
3
8
  actionLabel?: string;
9
+ /** The message. */
4
10
  message: string;
11
+ /** The action was pressed. The snackbar stays up — turn `visible` off to hide it. */
5
12
  onAction?: () => void;
13
+ /** Shows the snackbar while true, fading it in and out. It sets no timer of its own. */
6
14
  visible: boolean;
7
15
  };
8
16
  export type SnackbarComponent = (props: SnackbarProps) => ReactNode;