@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # @hzblj/kara-components
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - `SwipeActions` works on Android, and takes its buttons as data. **Breaking:** `SwipeActions.Actions` and its `Button` children are gone — pass `leading` and/or `trailing`, each a list of `{icon, label, onPress, destructive?, tint?}`, and `allowsFullSwipe` on the row:
8
+
9
+ ```tsx
10
+ <SwipeActions
11
+ trailing={[
12
+ { destructive: true, icon: "trash", label: "Delete", onPress: remove },
13
+ ]}
14
+ >
15
+ <ListItem title="Order [#1024](https://github.com/hzblj/kara-ui/issues/1024)" />
16
+ </SwipeActions>
17
+ ```
18
+
19
+ iOS renders SwiftUI's `swipeActions`, each action its icon on a button in its tint — round, with the label under it, on iOS 26. Android, where Compose has no swipe actions, gets kara's own `SwipeActionsBox` (`@hzblj/kara-native/jetpack-compose`): the row slides on an anchored drag, and filled icon buttons with their labels show in the strip it leaves. One row is open at a time on both, and a tap on an open row closes it.
20
+
21
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - **Breaking:** `FlashList` is gone, and `@shopify/flash-list` is no longer a peer dependency. kara's list for React Native content is `RnFlatList` (and `RnSectionList`): React Native's own virtualized lists, whose cells stay in normal flow, so rows that host native views keep them in place — a recycling list moves its cells, which an `@expo/ui` host does not survive. An app that wants FlashList for plain data rows installs and imports it itself.
22
+
23
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - `Tooltip` is controlled on Android too: `visible` shows Material's plain tooltip, centred above the anchor and kept inside the window, and `onDismiss` reports a touch outside it or the anchor scrolling away. It used to open only on a long press and hide itself, ignoring both props — and Material's own placement let it run off the edge of the screen. Nothing opens it on a long press any more; wire one to `visible` if you want it.
24
+
25
+ `TooltipBox` (`@hzblj/kara-native/jetpack-compose`) takes `plain` for that style, and hides when `isPresented` turns false.
26
+
27
+ ### Patch Changes
28
+
29
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - `ActionSheet` on Android renders its rows in a host of its own — they were Compose views straight inside the sheet, which has none, and threw "must be rendered inside a Host". The rows are Material's bottom-sheet menu now: full width, with each action's `icon` before its label.
30
+
31
+ `SearchBar` on iOS centres its text beside the magnifier. The type scale's line height sat the text at the bottom of a taller line in a single-line `UITextField`.
32
+
33
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - Android layout fixes:
34
+
35
+ - `Screen` keeps its content clear of the status bar when nothing sits above it, as a SwiftUI host keeps to the safe area — it drew under it. Under a navigation bar nothing changes; the background still runs to the edges.
36
+ - `Form` is inset from its container on every side, with section titles and footers indented to the cards' content, like SwiftUI's grouped form — in a `Screen` its cards ran into the screen's edges.
37
+ - A disabled or read-only `Checkbox` or `Switch` keeps Material's 48dp touch target, so it lines up with the enabled ones instead of shifting toward the edge.
38
+
39
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - `DatePicker` on iOS sizes itself to its value. Its host took the width it was given and laid the compact field out against the far edge of it — past its container's, in a row. The calendar is in the accent now.
40
+
41
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - `Alert` and `ActionSheet` appear on iOS. Both hung their SwiftUI presentation on an `EmptyView` — `@expo/ui` uses one when there is no trigger, and SwiftUI never presents from it — so `visible` changed nothing. Each now has a trigger that takes no room, and `ActionSheet` passes its buttons through the dialog's `Actions` slot.
42
+
43
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - `RnFlatList` and `RnSectionList` keep rows that host native views on Android. React Native's Android default, `removeClippedSubviews`, detached a host measured at zero height before its first layout, and the row stayed empty; it is off unless you turn it on.
44
+
45
+ - [#12](https://github.com/hzblj/kara-ui/pull/12) [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490) Thanks [@hzblj](https://github.com/hzblj)! - `SegmentedControl` draws its selected segment in the accent on both platforms. iOS renders kara's own `UISegmentedControl` (`SegmentedControl` in `@hzblj/kara-native/swift-ui`), whose pill, labels and track take colours — the system control tints only the pill, SwiftUI's segmented picker not even that. Android colours Material's segmented buttons, equal widths. `onChange` now fires for a new segment only on Android too.
46
+
47
+ - Updated dependencies [[`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490), [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490), [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490), [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490), [`2a6595f`](https://github.com/hzblj/kara-ui/commit/2a6595f79176a3450610d361a02001aac9530490)]:
48
+ - @hzblj/kara-native@0.7.0
49
+ - @hzblj/kara-sx@0.7.0
50
+ - @hzblj/kara-theme@0.7.0
51
+
3
52
  ## 0.6.0
4
53
 
5
54
  ### Minor Changes
package/README.md CHANGED
@@ -1,7 +1,35 @@
1
1
  # @hzblj/kara-components
2
2
 
3
- The components of kara-ui.
3
+ [![npm version][npm-badge]][npm-url]
4
+ [![License: MIT][license-badge]][license-url]
4
5
 
5
- Install [`@hzblj/kara-ui`](https://www.npmjs.com/package/@hzblj/kara-ui) instead — this is one of its building blocks.
6
+ [npm-badge]: https://img.shields.io/npm/v/@hzblj/kara-components?labelColor=27272a&color=ff5700&label=%40hzblj%2Fkara-components
7
+ [npm-url]: https://www.npmjs.com/package/@hzblj/kara-components
8
+ [license-badge]: https://img.shields.io/badge/license-MIT-ff5700?labelColor=27272a
9
+ [license-url]: https://github.com/hzblj/kara-ui/blob/main/LICENSE
6
10
 
7
- MIT
11
+ <a href="https://kara.janblazej.dev"><img src="https://kara.janblazej.dev/og.png" alt="Kara — native UI for Expo: real SwiftUI and Jetpack Compose views" width="720"></a>
12
+
13
+ The components of [Kara UI](https://kara.janblazej.dev) — a native-first design system for Expo.
14
+
15
+ > **Install [`@hzblj/kara-ui`](https://www.npmjs.com/package/@hzblj/kara-ui) instead.** This package is one of its
16
+ > building blocks, published so its types resolve; everything here is re-exported from `@hzblj/kara-ui`.
17
+
18
+ ## What's inside
19
+
20
+ - **Native components** — real SwiftUI views on iOS and Jetpack Compose on Android, through `@expo/ui`: a `Switch` is
21
+ a SwiftUI `Toggle` on one and a Material `Switch` on the other.
22
+ - **`Screen` and `Island`** — the hosts native views render in.
23
+ - **The React Native tier** — `RnView`, `RnText`, `RnScrollView` and the rest: plain React Native views with the same
24
+ `sx` props, for long lists and for content around the native islands.
25
+ - **Haptics** — the platform's own feedback, named for what happened.
26
+
27
+ ## Documentation
28
+
29
+ - [Components](https://kara.janblazej.dev/docs/components) — every one photographed on iOS and Android, with its props
30
+ - [Screen and Island](https://kara.janblazej.dev/docs/hosts)
31
+ - [Haptics](https://kara.janblazej.dev/docs/haptics)
32
+
33
+ ## License
34
+
35
+ MIT © Jan Blazej
@@ -6,9 +6,13 @@ import { spacing, useAppTheme } from '@hzblj/kara-theme';
6
6
  import { useMemo } from 'react';
7
7
  import { useHostGuard } from "../../host-context.js";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ /** Stands in for a missing handler: Material drops its 48dp touch target without one, and the box moves. */
10
+ const NOOP = () => undefined;
11
+
9
12
  /**
10
- * Material's checkbox, tinted with the accent. With a label it is a full-width row that toggles as a whole; the gap is
11
- * explicit because a checkbox without a handler drops Material's 48dp touch target, and with it the space around it.
13
+ * Material's checkbox, tinted with the accent. With a label it is a full-width row that toggles as a whole. It always
14
+ * gets a handler, so a disabled or read-only box keeps the touch target an enabled one has, and lines up with it;
15
+ * `enabled` is what stops the input.
12
16
  */
13
17
  export const Checkbox = ({
14
18
  disabled = false,
@@ -25,7 +29,7 @@ export const Checkbox = ({
25
29
  checkmarkColor: theme.color('content.on.bg')
26
30
  },
27
31
  enabled: !disabled,
28
- onCheckedChange: onValueChange,
32
+ onCheckedChange: onValueChange ?? NOOP,
29
33
  value: value
30
34
  });
31
35
  if (!label) {
@@ -1 +1 @@
1
- {"version":3,"names":["Checkbox","ComposeCheckbox","Row","Text","clickable","fillMaxWidth","spacing","useAppTheme","useMemo","useHostGuard","jsx","_jsx","jsxs","_jsxs","disabled","label","onValueChange","value","theme","rowModifiers","control","colors","checkedColor","color","checkmarkColor","enabled","onCheckedChange","horizontalArrangement","spacedBy","s8","modifiers","verticalAlignment","children","colorString","style","typography","body"],"sourceRoot":"../../../../src","sources":["atoms/checkbox/checkbox.android.tsx"],"mappings":";;AAAA,SAAQA,QAAQ,IAAIC,eAAe,EAAEC,GAAG,EAAEC,IAAI,QAAO,0BAA0B;AAC/E,SAAQC,SAAS,EAAEC,YAAY,QAAO,oCAAoC;AAC1E,SAAQC,OAAO,EAAEC,WAAW,QAAO,mBAAmB;AACtD,SAAQC,OAAO,QAAO,OAAO;AAE7B,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C;AACA;AACA;AACA;AACA,OAAO,MAAMb,QAA2B,GAAGA,CAAC;EAACc,QAAQ,GAAG,KAAK;EAAEC,KAAK;EAAEC,aAAa;EAAEC;AAAoB,CAAC,KAAK;EAC7GR,YAAY,CAAC,UAAU,CAAC;EACxB,MAAMS,KAAK,GAAGX,WAAW,CAAC,CAAC;EAC3B,MAAMY,YAAY,GAAGX,OAAO,CAC1B,MAAOM,QAAQ,IAAI,CAACE,aAAa,GAAG,CAACX,YAAY,CAAC,CAAC,CAAC,GAAG,CAACA,YAAY,CAAC,CAAC,EAAED,SAAS,CAAC,MAAMY,aAAa,CAAC,CAACC,KAAK,CAAC,CAAC,CAAE,EAChH,CAACH,QAAQ,EAAEE,aAAa,EAAEC,KAAK,CACjC,CAAC;EACD,MAAMG,OAAO,gBACXT,IAAA,CAACV,eAAe;IACdoB,MAAM,EAAE;MAACC,YAAY,EAAEJ,KAAK,CAACK,KAAK,CAAC,qBAAqB,CAAC;MAAEC,cAAc,EAAEN,KAAK,CAACK,KAAK,CAAC,eAAe;IAAC,CAAE;IACzGE,OAAO,EAAE,CAACX,QAAS;IACnBY,eAAe,EAAEV,aAAc;IAC/BC,KAAK,EAAEA;EAAM,CACd,CACF;EAED,IAAI,CAACF,KAAK,EAAE;IACV,OAAOK,OAAO;EAChB;EAEA,oBACEP,KAAA,CAACX,GAAG;IAACyB,qBAAqB,EAAE;MAACC,QAAQ,EAAEtB,OAAO,CAACuB;IAAE,CAAE;IAACC,SAAS,EAAEX,YAAa;IAACY,iBAAiB,EAAC,QAAQ;IAAAC,QAAA,GACpGZ,OAAO,eACRT,IAAA,CAACR,IAAI;MAACoB,KAAK,EAAEL,KAAK,CAACe,WAAW,CAACnB,QAAQ,GAAG,kBAAkB,GAAG,iBAAiB,CAAE;MAACoB,KAAK,EAAEhB,KAAK,CAACiB,UAAU,CAACC,IAAK;MAAAJ,QAAA,EAC7GjB;IAAK,CACF,CAAC;EAAA,CACJ,CAAC;AAEV,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Checkbox","ComposeCheckbox","Row","Text","clickable","fillMaxWidth","spacing","useAppTheme","useMemo","useHostGuard","jsx","_jsx","jsxs","_jsxs","NOOP","undefined","disabled","label","onValueChange","value","theme","rowModifiers","control","colors","checkedColor","color","checkmarkColor","enabled","onCheckedChange","horizontalArrangement","spacedBy","s8","modifiers","verticalAlignment","children","colorString","style","typography","body"],"sourceRoot":"../../../../src","sources":["atoms/checkbox/checkbox.android.tsx"],"mappings":";;AAAA,SAAQA,QAAQ,IAAIC,eAAe,EAAEC,GAAG,EAAEC,IAAI,QAAO,0BAA0B;AAC/E,SAAQC,SAAS,EAAEC,YAAY,QAAO,oCAAoC;AAC1E,SAAQC,OAAO,EAAEC,WAAW,QAAO,mBAAmB;AACtD,SAAQC,OAAO,QAAO,OAAO;AAE7B,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C;AACA,MAAMC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jB;IAAK,CACF,CAAC;EAAA,CACJ,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -1,9 +1,22 @@
1
1
  "use strict";
2
2
 
3
- import { DateTimePicker } from '@expo/ui/community/datetime-picker';
4
- import { useCallback } from 'react';
3
+ import { Host, DatePicker as SwiftUIDatePicker } from '@expo/ui/swift-ui';
4
+ import { datePickerStyle, labelsHidden, tint } from '@expo/ui/swift-ui/modifiers';
5
+ import { useAppTheme } from '@hzblj/kara-theme';
6
+ import { useMemo } from 'react';
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
6
- /** The system's compact date picker, inline: a tap on it opens the calendar popover UIKit owns. */
8
+ const COMPONENTS = {
9
+ date: ['date'],
10
+ datetime: ['date', 'hourAndMinute'],
11
+ time: ['hourAndMinute']
12
+ };
13
+
14
+ /**
15
+ * The system's compact date picker: the value in a pill, and a tap on it opens the calendar popover UIKit owns. Its own
16
+ * host, sized to the pill on both axes — a host that took the width it was given would lay the pill out against the
17
+ * far edge of it, or past its container's — so it drops into a row the way a `Text` does. The label is the caller's,
18
+ * beside it; the calendar is in the accent.
19
+ */
7
20
  export const DatePicker = ({
8
21
  max,
9
22
  min,
@@ -12,14 +25,22 @@ export const DatePicker = ({
12
25
  testID,
13
26
  value
14
27
  }) => {
15
- const onChange = useCallback((_event, date) => onValueChange?.(date), [onValueChange]);
16
- return /*#__PURE__*/_jsx(DateTimePicker, {
17
- maximumDate: max,
18
- minimumDate: min,
19
- mode: mode,
20
- onValueChange: onChange,
21
- testID: testID,
22
- value: value
28
+ const theme = useAppTheme();
29
+ const modifiers = useMemo(() => [datePickerStyle('compact'), labelsHidden(), tint(theme.color('fill.accent.primary'))], [theme]);
30
+ return /*#__PURE__*/_jsx(Host, {
31
+ colorScheme: theme.dark ? 'dark' : 'light',
32
+ matchContents: true,
33
+ children: /*#__PURE__*/_jsx(SwiftUIDatePicker, {
34
+ displayedComponents: [...COMPONENTS[mode]],
35
+ modifiers: modifiers,
36
+ onDateChange: onValueChange,
37
+ range: min || max ? {
38
+ end: max,
39
+ start: min
40
+ } : undefined,
41
+ selection: value,
42
+ testID: testID
43
+ })
23
44
  });
24
45
  };
25
46
  //# sourceMappingURL=date-picker.ios.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DateTimePicker","useCallback","jsx","_jsx","DatePicker","max","min","mode","onValueChange","testID","value","onChange","_event","date","maximumDate","minimumDate"],"sourceRoot":"../../../../src","sources":["atoms/date-picker/date-picker.ios.tsx"],"mappings":";;AAAA,SAAQA,cAAc,QAAO,oCAAoC;AACjE,SAAQC,WAAW,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAIjC;AACA,OAAO,MAAMC,UAA+B,GAAGA,CAAC;EAC9CC,GAAG;EACHC,GAAG;EACHC,IAAI,GAAG,MAAM;EACbC,aAAa;EACbC,MAAM;EACNC;AACe,CAAC,KAAK;EACrB,MAAMC,QAAQ,GAAGV,WAAW,CAAC,CAACW,MAAe,EAAEC,IAAU,KAAKL,aAAa,GAAGK,IAAI,CAAC,EAAE,CAACL,aAAa,CAAC,CAAC;EAErG,oBACEL,IAAA,CAACH,cAAc;IACbc,WAAW,EAAET,GAAI;IACjBU,WAAW,EAAET,GAAI;IACjBC,IAAI,EAAEA,IAAK;IACXC,aAAa,EAAEG,QAAS;IACxBF,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Host","DatePicker","SwiftUIDatePicker","datePickerStyle","labelsHidden","tint","useAppTheme","useMemo","jsx","_jsx","COMPONENTS","date","datetime","time","max","min","mode","onValueChange","testID","value","theme","modifiers","color","colorScheme","dark","matchContents","children","displayedComponents","onDateChange","range","end","start","undefined","selection"],"sourceRoot":"../../../../src","sources":["atoms/date-picker/date-picker.ios.tsx"],"mappings":";;AAAA,SAAQA,IAAI,EAAEC,UAAU,IAAIC,iBAAiB,QAAO,mBAAmB;AACvE,SAAQC,eAAe,EAAEC,YAA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";
12
12
  export * from "./date-picker/index.js";
13
13
  export * from "./divider/index.js";
14
14
  export * from "./fab/index.js";
15
- export * from "./flash-list/index.js";
16
15
  export * from "./glass-view/index.js";
17
16
  export * from "./h-stack/index.js";
18
17
  export * from "./icon/index.js";
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["atoms/index.ts"],"mappings":";;AAAA,cAAc,+BAAsB;AACpC,cAAc,mBAAU;AACxB,cAAc,kBAAS;AACvB,cAAc,gBAAO;AACrB,cAAc,mBAAU;AACxB,cAAc,iBAAQ;AACtB,cAAc,qBAAY;AAC1B,cAAc,iBAAQ;AACtB,cAAc,yBAAgB;AAC9B,cAAc,wBAAe;AAC7B,cAAc,oBAAW;AACzB,cAAc,gBAAO;AACrB,cAAc,uBAAc;AAC5B,cAAc,uBAAc;AAC5B,cAAc,oBAAW;AACzB,cAAc,iBAAQ;AACtB,cAAc,wBAAe;AAC7B,cAAc,kBAAS;AACvB,cAAc,mBAAU;AACxB,cAAc,iBAAQ;AACtB,cAAc,mBAAU;AACxB,cAAc,sBAAa;AAC3B,cAAc,qBAAY;AAC1B,cAAc,yBAAgB;AAC9B,cAAc,oBAAW;AACzB,cAAc,2BAAkB;AAChC,cAAc,4BAAmB;AACjC,cAAc,oBAAW;AACzB,cAAc,oBAAW;AACzB,cAAc,wBAAe;AAC7B,cAAc,8BAAqB;AACnC,cAAc,qBAAY;AAC1B,cAAc,mBAAU;AACxB,cAAc,mBAAU;AACxB,cAAc,oBAAW;AACzB,cAAc,mBAAU;AACxB,cAAc,iBAAQ;AACtB,cAAc,uBAAc;AAC5B,cAAc,oBAAW;AACzB,cAAc,oBAAW","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["atoms/index.ts"],"mappings":";;AAAA,cAAc,+BAAsB;AACpC,cAAc,mBAAU;AACxB,cAAc,kBAAS;AACvB,cAAc,gBAAO;AACrB,cAAc,mBAAU;AACxB,cAAc,iBAAQ;AACtB,cAAc,qBAAY;AAC1B,cAAc,iBAAQ;AACtB,cAAc,yBAAgB;AAC9B,cAAc,wBAAe;AAC7B,cAAc,oBAAW;AACzB,cAAc,gBAAO;AACrB,cAAc,uBAAc;AAC5B,cAAc,oBAAW;AACzB,cAAc,iBAAQ;AACtB,cAAc,wBAAe;AAC7B,cAAc,kBAAS;AACvB,cAAc,mBAAU;AACxB,cAAc,iBAAQ;AACtB,cAAc,mBAAU;AACxB,cAAc,sBAAa;AAC3B,cAAc,qBAAY;AAC1B,cAAc,yBAAgB;AAC9B,cAAc,oBAAW;AACzB,cAAc,2BAAkB;AAChC,cAAc,4BAAmB;AACjC,cAAc,oBAAW;AACzB,cAAc,oBAAW;AACzB,cAAc,wBAAe;AAC7B,cAAc,8BAAqB;AACnC,cAAc,qBAAY;AAC1B,cAAc,mBAAU;AACxB,cAAc,mBAAU;AACxB,cAAc,oBAAW;AACzB,cAAc,mBAAU;AACxB,cAAc,iBAAQ;AACtB,cAAc,uBAAc;AAC5B,cAAc,oBAAW;AACzB,cAAc,oBAAW","ignoreList":[]}
@@ -7,14 +7,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const NO_SX = {};
8
8
 
9
9
  /**
10
- * Flat list built on React Native's own `VirtualizedList` rather than FlashList.
11
- *
12
- * FlashList is the default for lists in this codebase and should stay that way for data rows — reach
13
- * for this only for the case it cannot serve: content that hosts native views. FlashList positions its
14
- * rows absolutely and recycles their cells, and an `@expo/ui` host survives neither — the hosted view
15
- * ends up drawn where the layout no longer is. `VirtualizedList` renders its cells in normal flow
16
- * inside a scroll view, using blank spacers for the range it has not rendered, so a hosted view stays
17
- * exactly where the layout put it. This is `SectionList`'s reason to exist too, without the sections.
10
+ * kara's list for React Native content: React Native's own `VirtualizedList`, styled through `sx`. It renders its
11
+ * cells in normal flow inside a scroll view, with blank spacers for the range it has not rendered, so a row that hosts
12
+ * native views keeps them where the layout put it. A recycling list (absolutely positioned, reused cells) cannot
13
+ * promise that — an `@expo/ui` host survives neither, and draws where the layout no longer is — which is why kara
14
+ * ships none.
18
15
  */
19
16
  export const RnFlatList = ({
20
17
  content,
@@ -25,7 +22,11 @@ export const RnFlatList = ({
25
22
  const [style, rest] = useSplitSx(props);
26
23
  const contentStyle = useSx(content ?? NO_SX);
27
24
  return /*#__PURE__*/_jsx(RNFlatList, {
28
- data: data,
25
+ data: data
26
+ // Android clips by default, and a host is measured after its first layout — at zero height it counts as
27
+ // off-screen, is detached, and its native view never comes back.
28
+ ,
29
+ removeClippedSubviews: false,
29
30
  renderItem: renderItem,
30
31
  ...rest,
31
32
  contentContainerStyle: content === undefined ? undefined : contentStyle,
@@ -1 +1 @@
1
- {"version":3,"names":["useSplitSx","useSx","FlatList","RNFlatList","jsx","_jsx","NO_SX","RnFlatList","content","data","renderItem","props","style","rest","contentStyle","contentContainerStyle","undefined"],"sourceRoot":"../../../../src","sources":["atoms/rn-flat-list/rn-flat-list.tsx"],"mappings":";;AAAA,SAAQA,UAAU,EAAEC,KAAK,QAAO,gBAAgB;AAChD,SAAQC,QAAQ,IAAIC,UAAU,QAAO,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAInD;AACA,MAAMC,KAAK,GAAG,CAAC,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGA,CAAS;EAACC,OAAO;EAAEC,IAAI;EAAEC,UAAU;EAAE,GAAGC;AAA6B,CAAC,KAAK;EACnG,MAAM,CAACC,KAAK,EAAEC,IAAI,CAAC,GAAGb,UAAU,CAACW,KAAgC,CAAC;EAClE,MAAMG,YAAY,GAAGb,KAAK,CAACO,OAAO,IAAIF,KAAK,CAAC;EAE5C,oBACED,IAAA,CAACF,UAAU;IACTM,IAAI,EAAEA,IAAK;IACXC,UAAU,EAAEA,UAAW;IAAA,GACnBG,IAAI;IACRE,qBAAqB,EAAEP,OAAO,KAAKQ,SAAS,GAAGA,SAAS,GAAGF,YAAa;IACxEF,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useSplitSx","useSx","FlatList","RNFlatList","jsx","_jsx","NO_SX","RnFlatList","content","data","renderItem","props","style","rest","contentStyle","removeClippedSubviews","contentContainerStyle","undefined"],"sourceRoot":"../../../../src","sources":["atoms/rn-flat-list/rn-flat-list.tsx"],"mappings":";;AAAA,SAAQA,UAAU,EAAEC,KAAK,QAAO,gBAAgB;AAChD,SAAQC,QAAQ,IAAIC,UAAU,QAAO,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAInD;AACA,MAAMC,KAAK,GAAG,CAAC,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGA,CAAS;EAACC,OAAO;EAAEC,IAAI;EAAEC,UAAU;EAAE,GAAGC;AAA6B,CAAC,KAAK;EACnG,MAAM,CAACC,KAAK,EAAEC,IAAI,CAAC,GAAGb,UAAU,CAACW,KAAgC,CAAC;EAClE,MAAMG,YAAY,GAAGb,KAAK,CAACO,OAAO,IAAIF,KAAK,CAAC;EAE5C,oBACED,IAAA,CAACF,UAAU;IACTM,IAAI,EAAEA;IACN;IACA;IAAA;IACAM,qBAAqB,EAAE,KAAM;IAC7BL,UAAU,EAAEA,UAAW;IAAA,GACnBG,IAAI;IACRG,qBAAqB,EAAER,OAAO,KAAKS,SAAS,GAAGA,SAAS,GAAGH,YAAa;IACxEF,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -7,14 +7,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const NO_SX = {};
8
8
 
9
9
  /**
10
- * Sectioned list built on React Native's own `VirtualizedList` rather than FlashList.
11
- *
12
- * FlashList is the default for lists in this codebase and should stay that way for data rows. This
13
- * exists for the case it cannot serve: content that hosts native views. FlashList positions its rows
14
- * absolutely and recycles their cells, and an `@expo/ui` host does not survive either — the hosted
15
- * view ends up drawn where the layout no longer is. `VirtualizedList` renders its cells in normal flow
16
- * inside a scroll view, using blank spacers for the range it has not rendered, so a hosted view stays
17
- * exactly where the layout put it.
10
+ * `RnFlatList` with sections: React Native's own `VirtualizedList`, cells in normal flow inside a scroll view, so a
11
+ * row that hosts native views keeps them where the layout put it.
18
12
  *
19
13
  * Sticky headers default off, unlike React Native, where they are on for vertical lists. A header that
20
14
  * detaches and floats over the content is a deliberate effect, not something a list should do unasked.
@@ -28,6 +22,9 @@ export const RnSectionList = ({
28
22
  const [style, rest] = useSplitSx(props);
29
23
  const contentStyle = useSx(content ?? NO_SX);
30
24
  return /*#__PURE__*/_jsx(RNSectionList, {
25
+ // Android clips by default, and a host is measured after its first layout — at zero height it counts as
26
+ // off-screen, is detached, and its native view never comes back.
27
+ removeClippedSubviews: false,
31
28
  sections: sections,
32
29
  ...rest,
33
30
  contentContainerStyle: content === undefined ? undefined : contentStyle,
@@ -1 +1 @@
1
- {"version":3,"names":["useSplitSx","useSx","SectionList","RNSectionList","jsx","_jsx","NO_SX","RnSectionList","content","sections","stickySectionHeadersEnabled","props","style","rest","contentStyle","contentContainerStyle","undefined"],"sourceRoot":"../../../../src","sources":["atoms/rn-section-list/rn-section-list.tsx"],"mappings":";;AAAA,SAAQA,UAAU,EAAEC,KAAK,QAAO,gBAAgB;AAChD,SAA8BC,WAAW,IAAIC,aAAa,QAAO,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAI/E;AACA,MAAMC,KAAK,GAAG,CAAC,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAoC;EAC/DC,OAAO;EACPC,QAAQ;EACRC,2BAA2B,GAAG,KAAK;EACnC,GAAGC;AACgC,CAAC,KAAK;EACzC,MAAM,CAACC,KAAK,EAAEC,IAAI,CAAC,GAAGb,UAAU,CAACW,KAAgC,CAAC;EAClE,MAAMG,YAAY,GAAGb,KAAK,CAACO,OAAO,IAAIF,KAAK,CAAC;EAE5C,oBACED,IAAA,CAACF,aAAa;IACZM,QAAQ,EAAEA,QAAS;IAAA,GACfI,IAAI;IACRE,qBAAqB,EAAEP,OAAO,KAAKQ,SAAS,GAAGA,SAAS,GAAGF,YAAa;IACxEJ,2BAA2B,EAAEA,2BAA4B;IACzDE,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useSplitSx","useSx","SectionList","RNSectionList","jsx","_jsx","NO_SX","RnSectionList","content","sections","stickySectionHeadersEnabled","props","style","rest","contentStyle","removeClippedSubviews","contentContainerStyle","undefined"],"sourceRoot":"../../../../src","sources":["atoms/rn-section-list/rn-section-list.tsx"],"mappings":";;AAAA,SAAQA,UAAU,EAAEC,KAAK,QAAO,gBAAgB;AAChD,SAA8BC,WAAW,IAAIC,aAAa,QAAO,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAI/E;AACA,MAAMC,KAAK,GAAG,CAAC,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAoC;EAC/DC,OAAO;EACPC,QAAQ;EACRC,2BAA2B,GAAG,KAAK;EACnC,GAAGC;AACgC,CAAC,KAAK;EACzC,MAAM,CAACC,KAAK,EAAEC,IAAI,CAAC,GAAGb,UAAU,CAACW,KAAgC,CAAC;EAClE,MAAMG,YAAY,GAAGb,KAAK,CAACO,OAAO,IAAIF,KAAK,CAAC;EAE5C,oBACED,IAAA,CAACF,aAAa;IACZ;IACA;IACAY,qBAAqB,EAAE,KAAM;IAC7BN,QAAQ,EAAEA,QAAS;IAAA,GACfI,IAAI;IACRG,qBAAqB,EAAER,OAAO,KAAKS,SAAS,GAAGA,SAAS,GAAGH,YAAa;IACxEJ,2BAA2B,EAAEA,2BAA4B;IACzDE,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
 
3
- export * from "./segmented-control.js";
3
+ export * from './segmented-control';
4
4
  export * from "./segmented-control.types.js";
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["atoms/segmented-control/index.ts"],"mappings":";;AAAA,cAAc,wBAAqB;AACnC,cAAc,8BAA2B","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["atoms/segmented-control/index.ts"],"mappings":";;AAAA,cAAc,qBAAqB;AACnC,cAAc,8BAA2B","ignoreList":[]}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ import { Host, SegmentedButton, SingleChoiceSegmentedButtonRow, Text } from '@expo/ui/jetpack-compose';
4
+ import { fillMaxWidth, testID as testIdModifier, weight } from '@expo/ui/jetpack-compose/modifiers';
5
+ import { useAppTheme } from '@hzblj/kara-theme';
6
+ import { useCallback, useMemo } from 'react';
7
+ import { haptics } from "../../haptics/index.js";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const MATCH_HEIGHT_ONLY = {
10
+ horizontal: false,
11
+ vertical: true
12
+ };
13
+
14
+ /** Every segment the same width, like UIKit's: Material's would size each to its label. */
15
+ const SEGMENT = [weight(1)];
16
+
17
+ /**
18
+ * Material's single-choice segmented buttons, the selected one filled with the accent like a checked `Switch`. Its own
19
+ * host, themed like an `Island`, so it drops into React Native layout the way the iOS control does. Material plays
20
+ * nothing on a new segment, so this plays `selection`.
21
+ */
22
+ export const SegmentedControl = ({
23
+ disabled = false,
24
+ onChange,
25
+ selectedIndex,
26
+ testID,
27
+ values
28
+ }) => {
29
+ const theme = useAppTheme();
30
+ const colors = useMemo(() => ({
31
+ activeBorderColor: theme.color('fill.accent.primary'),
32
+ activeContainerColor: theme.color('fill.accent.primary'),
33
+ activeContentColor: theme.color('content.on.bg'),
34
+ disabledActiveBorderColor: theme.color('fill.accent.disabled'),
35
+ disabledActiveContainerColor: theme.color('fill.accent.disabled'),
36
+ disabledActiveContentColor: theme.color('btn.content.disabled'),
37
+ disabledInactiveBorderColor: theme.color('border.tertiary'),
38
+ disabledInactiveContentColor: theme.color('btn.content.disabled'),
39
+ inactiveBorderColor: theme.color('border.secondary.base'),
40
+ inactiveContentColor: theme.color('content.primary')
41
+ }), [theme]);
42
+ const rowModifiers = useMemo(() => testID ? [fillMaxWidth(), testIdModifier(testID)] : [fillMaxWidth()], [testID]);
43
+
44
+ // Material reports a tap on the segment that is already selected too; iOS does not, and neither does this.
45
+ const select = useCallback(index => {
46
+ if (index === selectedIndex) {
47
+ return;
48
+ }
49
+ haptics.selection();
50
+ onChange?.(index, values[index] ?? '');
51
+ }, [onChange, selectedIndex, values]);
52
+ return /*#__PURE__*/_jsx(Host, {
53
+ colorScheme: theme.dark ? 'dark' : 'light',
54
+ matchContents: MATCH_HEIGHT_ONLY,
55
+ seedColor: theme.materialSeed,
56
+ children: /*#__PURE__*/_jsx(SingleChoiceSegmentedButtonRow, {
57
+ modifiers: rowModifiers,
58
+ children: values.map((label, index) => /*#__PURE__*/_jsx(SegmentedButton, {
59
+ colors: colors,
60
+ enabled: !disabled,
61
+ modifiers: SEGMENT,
62
+ onClick: () => select(index),
63
+ selected: index === selectedIndex,
64
+ children: /*#__PURE__*/_jsx(SegmentedButton.Label, {
65
+ children: /*#__PURE__*/_jsx(Text, {
66
+ style: theme.typography.subheadlineMedium,
67
+ children: label
68
+ })
69
+ })
70
+ }, index))
71
+ })
72
+ });
73
+ };
74
+ //# sourceMappingURL=segmented-control.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Host","SegmentedButton","SingleChoiceSegmentedButtonRow","Text","fillMaxWidth","testID","testIdModifier","weight","useAppTheme","useCallback","useMemo","haptics","jsx","_jsx","MATCH_HEIGHT_ONLY","horizontal","vertical","SEGMENT","SegmentedControl","disabled","onChange","selectedIndex","values","theme","colors","activeBorderColor","color","activeContainerColor","activeContentColor","disabledActiveBorderColor","disabledActiveContainerColor","disabledActiveContentColor","disabledInactiveBorderColor","disabledInactiveContentColor","inactiveBorderColor","inactiveContentColor","rowModifiers","select","index","selection","colorScheme","dark","matchContents","seedColor","materialSeed","children","modifiers","map","label","enabled","onClick","selected","Label","style","typography","subheadlineMedium"],"sourceRoot":"../../../../src","sources":["atoms/segmented-control/segmented-control.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,EAAEC,eAAe,EAAEC,8BAA8B,EAAEC,IAAI,QAAO,0BAA0B;AACpG,SAAQC,YAAY,EAAEC,MAAM,IAAIC,cAAc,EAAEC,MAAM,QAAO,oCAAoC;AACjG,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,OAAO,QAAO,OAAO;AAE1C,SAAQC,OAAO,QAAO,wBAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGrC,MAAMC,iBAAiB,GAAG;EAACC,UAAU,EAAE,KAAK;EAAEC,QAAQ,EAAE;AAAI,CAAC;;AAE7D;AACA,MAAMC,OAAO,GAAG,CAACV,MAAM,CAAC,CAAC,CAAC,CAAC;;AAE3B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMW,gBAA2C,GAAGA,CAAC;EAC1DC,QAAQ,GAAG,KAAK;EAChBC,QAAQ;EACRC,aAAa;EACbhB,MAAM;EACNiB;AACqB,CAAC,KAAK;EAC3B,MAAMC,KAAK,GAAGf,WAAW,CAAC,CAAC;EAE3B,MAAMgB,MAAM,GAAGd,OAAO,CACpB,OAAO;IACLe,iBAAiB,EAAEF,KAAK,CAACG,KAAK,CAAC,qBAAqB,CAAC;IACrDC,oBAAoB,EAAEJ,KAAK,CAACG,KAAK,CAAC,qBAAqB,CAAC;IACxDE,kBAAkB,EAAEL,KAAK,CAACG,KAAK,CAAC,eAAe,CAAC;IAChDG,yBAAyB,EAAEN,KAAK,CAACG,KAAK,CAAC,sBAAsB,CAAC;IAC9DI,4BAA4B,EAAEP,KAAK,CAACG,KAAK,CAAC,sBAAsB,CAAC;IACjEK,0BAA0B,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AS,EAAE7B,OAAQ;QACnBiC,OAAO,EAAEA,CAAA,KAAMb,MAAM,CAACC,KAAK,CAAE;QAC7Ba,QAAQ,EAAEb,KAAK,KAAKjB,aAAc;QAAAwB,QAAA,eAElChC,IAAA,CAACZ,eAAe,CAACmD,KAAK;UAAAP,QAAA,eACpBhC,IAAA,CAACV,IAAI;YAACkD,KAAK,EAAE9B,KAAK,CAAC+B,UAAU,CAACC,iBAAkB;YAAAV,QAAA,EAAEG;UAAK,CAAO;QAAC,CAC1C;MAAC,GAPnBV,KAQU,CAClB;IAAC,CAC4B;EAAC,CAC7B,CAAC;AAEX,CAAC","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ import { SegmentedControl as NativeSegmentedControl } from '@hzblj/kara-native/swift-ui';
4
+ import { useAppTheme } from '@hzblj/kara-theme';
5
+ import { useCallback, useMemo } from 'react';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * kara's own `UISegmentedControl`, with the pill in the accent and white text on it — the system control tints only the
9
+ * pill, and SwiftUI's segmented picker not even that. A plain `UIView` in React Native layout: it needs no host, takes
10
+ * the width it is given and UIKit's height. UIKit plays the control's own feedback.
11
+ */
12
+ export const SegmentedControl = ({
13
+ disabled = false,
14
+ onChange,
15
+ selectedIndex,
16
+ testID,
17
+ values
18
+ }) => {
19
+ const theme = useAppTheme();
20
+ const face = theme.typography.footnoteMedium;
21
+
22
+ // The native control speaks in values; a segment's is its index, so two labels may read the same.
23
+ const options = useMemo(() => values.map((label, index) => ({
24
+ label,
25
+ value: String(index)
26
+ })), [values]);
27
+ const onValueChange = useCallback(value => {
28
+ const index = Number(value);
29
+ onChange?.(index, values[index] ?? '');
30
+ }, [onChange, values]);
31
+ return /*#__PURE__*/_jsx(NativeSegmentedControl, {
32
+ activePillColor: theme.color('fill.accent.primary'),
33
+ activeTextColor: theme.color('content.on.bg'),
34
+ disabled: disabled,
35
+ fontFamily: face.fontFamily,
36
+ fontSize: face.fontSize,
37
+ inactiveTextColor: theme.color('content.primary'),
38
+ onValueChange: onValueChange,
39
+ options: options,
40
+ selectedValue: String(selectedIndex),
41
+ testID: testID
42
+ });
43
+ };
44
+ //# sourceMappingURL=segmented-control.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SegmentedControl","NativeSegmentedControl","useAppTheme","useCallback","useMemo","jsx","_jsx","disabled","onChange","selectedIndex","testID","values","theme","face","typography","footnoteMedium","options","map","label","index","value","String","onValueChange","Number","activePillColor","color","activeTextColor","fontFamily","fontSize","inactiveTextColor","selectedValue"],"sourceRoot":"../../../../src","sources":["atoms/segmented-control/segmented-control.ios.tsx"],"mappings":";;AAAA,SAAQA,gBAAgB,IAAIC,sBAAsB,QAAO,6BAA6B;AACtF,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,OAAO,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAI1C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMN,gBAA2C,GAAGA,CAAC;EAC1DO,QAAQ,GAAG,KAAK;EAChBC,QAAQ;EACRC,aAAa;EACbC,MAAM;EACNC;AACqB,CAAC,KAAK;EAC3B,MAAMC,KAAK,GAAGV,WAAW,CAAC,CAAC;EAC3B,MAAMW,IAAI,GAAGD,KAAK,CAACE,UAAU,CAACC,cAAc;;EAE5C;EACA,MAAMC,OAAO,GAAGZ,OAAO,CAAC,MAAMO,MAAM,CAACM,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,MAAM;IAACD,KAAK;IAAEE,KAAK,EAAEC,MAAM,CAACF,KAAK;EAAC,CAAC,CAAC,CAAC,EAAE,CAACR,MAAM,CAAC,CAAC;EAEtG,MAAMW,aAAa,GAAGnB,WAAW,CAC9BiB,KAAa,IAAK;IACjB,MAAMD,KAAK,GAAGI,MAAM,CAACH,KAAK,CAAC;IAC3BZ,QAAQ,GAAGW,KAAK,EAAER,MAAM,CAACQ,KAAK,CAAC,IAAI,EAAE,CAAC;EACxC,CAAC,EACD,CAACX,QAAQ,EAAEG,MAAM,CACnB,CAAC;EAED,oBACEL,IAAA,CAACL,sBAAsB;IACrBuB,eAAe,EAAEZ,KAAK,CAACa,KAAK,CAAC,qBAAqB,CAAE;IACpDC,eAAe,EAAEd,KAAK,CAACa,KAAK,CAAC,eAAe,CAAE;IAC9ClB,QAAQ,EAAEA,QAAS;IACnBoB,UAAU,EAAEd,IAAI,CAACc,UAAW;IAC5BC,QAAQ,EAAEf,IAAI,CAACe,QAAS;IACxBC,iBAAiB,EAAEjB,KAAK,CAACa,KAAK,CAAC,iBAAiB,CAAE;IAClDH,aAAa,EAAEA,aAAc;IAC7BN,OAAO,EAAEA,OAAQ;IACjBc,aAAa,EAAET,MAAM,CAACZ,aAAa,CAAE;IACrCC,MAAM,EAAEA;EAAO,CAChB,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -7,6 +7,9 @@ import { useCallback, useMemo } from 'react';
7
7
  import { haptics } from "../../haptics/index.js";
8
8
  import { useHostGuard } from "../../host-context.js";
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ /** Stands in for a missing handler: Material drops its 48dp touch target without one, and the switch moves. */
11
+ const NOOP = () => undefined;
12
+
10
13
  /**
11
14
  * Material's switch, tinted with the accent like SwiftUI's toggle. With a label it is a full-width row — label at the
12
15
  * start, switch at the end — and the whole row toggles, the way a Material settings row does. A flip plays
@@ -33,7 +36,7 @@ export const Switch = ({
33
36
  checkedTrackColor: theme.color('fill.accent.primary')
34
37
  },
35
38
  enabled: !disabled,
36
- onCheckedChange: onValueChange ? toggle : undefined,
39
+ onCheckedChange: onValueChange ? toggle : NOOP,
37
40
  value: value
38
41
  });
39
42
  if (!label) {
@@ -1 +1 @@
1
- {"version":3,"names":["Switch","ComposeSwitch","Row","Text","clickable","fillMaxWidth","useAppTheme","useCallback","useMemo","haptics","useHostGuard","jsx","_jsx","jsxs","_jsxs","disabled","label","onValueChange","value","theme","toggle","next","play","rowModifiers","control","colors","checkedBorderColor","color","checkedThumbColor","checkedTrackColor","enabled","onCheckedChange","undefined","horizontalArrangement","modifiers","verticalAlignment","children","colorString","style","typography","body"],"sourceRoot":"../../../../src","sources":["atoms/switch/switch.android.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,EAAEC,GAAG,EAAEC,IAAI,QAAO,0BAA0B;AAC3E,SAAQC,SAAS,EAAEC,YAAY,QAAO,oCAAoC;AAC1E,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,EAAEC,OAAO,QAAO,OAAO;AAE1C,SAAQC,OAAO,QAAO,wBAAe;AACrC,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMd,MAAuB,GAAGA,CAAC;EAACe,QAAQ,GAAG,KAAK;EAAEC,KAAK;EAAEC,aAAa;EAAEC;AAAkB,CAAC,KAAK;EACvGR,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAMS,KAAK,GAAGb,WAAW,CAAC,CAAC;EAC3B,MAAMc,MAAM,GAAGb,WAAW,CACvBc,IAAa,IAAK;IACjBZ,OAAO,CAACa,IAAI,CAACD,IAAI,GAAG,UAAU,GAAG,WAAW,CAAC;IAC7CJ,aAAa,GAAGI,IAAI,CAAC;EACvB,CAAC,EACD,CAACJ,aAAa,CAChB,CAAC;EACD,MAAMM,YAAY,GAAGf,OAAO,CAC1B,MAAOO,QAAQ,IAAI,CAACE,aAAa,GAAG,CAACZ,YAAY,CAAC,CAAC,CAAC,GAAG,CAACA,YAAY,CAAC,CAAC,EAAED,SAAS,CAAC,MAAMgB,MAAM,CAAC,CAACF,KAAK,CAAC,CAAC,CAAE,EACzG,CAACH,QAAQ,EAAEE,aAAa,EAAEG,MAAM,EAAEF,KAAK,CACzC,CAAC;EACD,MAAMM,OAAO,gBACXZ,IAAA,CAACX,aAAa;IACZwB,MAAM,EAAE;MACNC,kBAAkB,EAAEP,KAAK,CAACQ,KAAK,CAAC,qBAAqB,CAAC;MACtDC,iBAAiB,EAAET,KAAK,CAACQ,KAAK,CAAC,eAAe,CAAC;MAC/CE,iBAAiB,EAAEV,KAAK,CAACQ,KAAK,CAAC,qBAAqB;IACtD,CAAE;IACFG,OAAO,EAAE,CAACf,QAAS;IACnBgB,eAAe,EAAEd,aAAa,GAAGG,MAAM,GAAGY,SAAU;IACpDd,KAAK,EAAEA;EAAM,CACd,CACF;EAED,IAAI,CAACF,KAAK,EAAE;IACV,OAAOQ,OAAO;EAChB;EAEA,oBACEV,KAAA,CAACZ,GAAG;IAAC+B,qBAAqB,EAAC,cAAc;IAACC,SAAS,EAAEX,YAAa;IAACY,iBAAiB,EAAC,QAAQ;IAAAC,QAAA,gBAC3FxB,IAAA,CAACT,IAAI;MAACwB,KAAK,EAAER,KAAK,CAACkB,WAAW,CAACtB,QAAQ,GAAG,kBAAkB,GAAG,iBAAiB,CAAE;MAACuB,KAAK,EAAEnB,KAAK,CAACoB,UAAU,CAACC,IAAK;MAAAJ,QAAA,EAC7GpB;IAAK,CACF,CAAC,EACNQ,OAAO;EAAA,CACL,CAAC;AAEV,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Switch","ComposeSwitch","Row","Text","clickable","fillMaxWidth","useAppTheme","useCallback","useMemo","haptics","useHostGuard","jsx","_jsx","jsxs","_jsxs","NOOP","undefined","disabled","label","onValueChange","value","theme","toggle","next","play","rowModifiers","control","colors","checkedBorderColor","color","checkedThumbColor","checkedTrackColor","enabled","onCheckedChange","horizontalArrangement","modifiers","verticalAlignment","children","colorString","style","typography","body"],"sourceRoot":"../../../../src","sources":["atoms/switch/switch.android.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,EAAEC,GAAG,EAAEC,IAAI,QAAO,0BAA0B;AAC3E,SAAQC,SAAS,EAAEC,YAAY,QAAO,oCAAoC;AAC1E,SAAQC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AS;IACnBgB,eAAe,EAAEd,aAAa,GAAGG,MAAM,GAAGP,IAAK;IAC/CK,KAAK,EAAEA;EAAM,CACd,CACF;EAED,IAAI,CAACF,KAAK,EAAE;IACV,OAAOQ,OAAO;EAChB;EAEA,oBACEZ,KAAA,CAACZ,GAAG;IAACgC,qBAAqB,EAAC,cAAc;IAACC,SAAS,EAAEV,YAAa;IAACW,iBAAiB,EAAC,QAAQ;IAAAC,QAAA,gBAC3FzB,IAAA,CAACT,IAAI;MAAC0B,KAAK,EAAER,KAAK,CAACiB,WAAW,CAACrB,QAAQ,GAAG,kBAAkB,GAAG,iBAAiB,CAAE;MAACsB,KAAK,EAAElB,KAAK,CAACmB,UAAU,CAACC,IAAK;MAAAJ,QAAA,EAC7GnB;IAAK,CACF,CAAC,EACNQ,OAAO;EAAA,CACL,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { useAppTheme } from '@hzblj/kara-theme';
4
- import { TextInput } from 'react-native';
4
+ import { Platform, TextInput } from 'react-native';
5
5
  import { Box } from "../../atoms/box/index.js";
6
6
  import { Pressable } from "../../atoms/pressable/index.js";
7
7
  import { RnGlyph } from "../../glyph/index.js";
@@ -13,6 +13,19 @@ export const SearchBar = ({
13
13
  value
14
14
  }) => {
15
15
  const theme = useAppTheme();
16
+ const {
17
+ lineHeight,
18
+ ...face
19
+ } = theme.typography.body;
20
+ /**
21
+ * A single-line `UITextField` sets its text against the bottom of a line taller than the font, so the variant's
22
+ * `lineHeight` pushed the text below the magnifier beside it. iOS takes the face without it, in a field as tall as
23
+ * the line would have been; Android centres the line and keeps it.
24
+ */
25
+ const text = Platform.OS === 'ios' ? {
26
+ ...face,
27
+ height: lineHeight
28
+ } : theme.typography.body;
16
29
  return /*#__PURE__*/_jsxs(Box, {
17
30
  align: "center",
18
31
  bg: "fill.quaternary",
@@ -31,7 +44,7 @@ export const SearchBar = ({
31
44
  onChangeText: onChangeText,
32
45
  placeholder: placeholder,
33
46
  placeholderTextColor: theme.color('content.quaternary'),
34
- style: [theme.typography.body, {
47
+ style: [text, {
35
48
  color: theme.color('content.primary'),
36
49
  flex: 1,
37
50
  padding: 0
@@ -1 +1 @@
1
- {"version":3,"names":["useAppTheme","TextInput","Box","Pressable","RnGlyph","jsx","_jsx","jsxs","_jsxs","SearchBar","onChangeText","placeholder","testID","value","theme","align","bg","borderRadius","flexDirection","gap","px","py","wide","children","color","name","size","placeholderTextColor","style","typography","body","flex","padding","length","onPress"],"sourceRoot":"../../../../src","sources":["molecules/search-bar/search-bar.tsx"],"mappings":";;AAAA,SAAQA,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,SAAS,QAAO,cAAc;AAEtC,SAAQC,GAAG,QAAO,0BAAiB;AACnC,SAAQC,SAAS,QAAO,gCAAuB;AAC/C,SAAQC,OAAO,QAAO,sBAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGnC,OAAO,MAAMC,SAA6B,GAAGA,CAAC;EAC5CC,YAAY;EACZC,WAAW,GAAG,QAAQ;EACtBC,MAAM;EACNC;AACc,CAAC,KAAK;EACpB,MAAMC,KAAK,GAAGd,WAAW,CAAC,CAAC;EAE3B,oBACEQ,KAAA,CAACN,GAAG;IACFa,KAAK,EAAC,QAAQ;IACdC,EAAE,EAAC,iBAAiB;IACpBC,YAAY,EAAC,QAAQ;IACrBC,aAAa,EAAC,KAAK;IACnBC,GAAG,EAAC,IAAI;IACRC,EAAE,EAAC,KAAK;IACRC,EAAE,EAAC,IAAI;IACPT,MAAM,EAAEA,MAAO;IACfU,IAAI;IAAAC,QAAA,gBAEJjB,IAAA,CAACF,OAAO;MAACoB,KAAK,EAAC,kBAAkB;MAACC,IAAI,EAAC,QAAQ;MAACC,IAAI,EAAC;IAAK,CAAE,CAAC,eAC7DpB,IAAA,CAACL,SAAS;MACRS,YAAY,EAAEA,YAAa;MAC3BC,WAAW,EAAEA,WAAY;MACzBgB,oBAAoB,EAAEb,KAAK,CAACU,KAAK,CAAC,oBAAoB,CAAE;MACxDI,KAAK,EAAE,CAACd,KAAK,CAACe,UAAU,CAACC,IAAI,EAAE;QAACN,KAAK,EAAEV,KAAK,CAACU,KAAK,CAAC,iBAAiB,CAAC;QAAEO,IAAI,EAAE,CAAC;QAAEC,OAAO,EAAE;MAAC,CAAC,CAAE;MAC7FnB,KAAK,EAAEA;IAAM,CACd,CAAC,EACDA,KAAK,CAACoB,MAAM,GAAG,CAAC,gBACf3B,IAAA,CAACH,SAAS;MAAC+B,OAAO,EAAEA,CAAA,KAAMxB,YAAY,GAAG,EAAE,CAAE;MAAAa,QAAA,eAC3CjB,IAAA,CAACF,OAAO;QAACoB,KAAK,EAAC,kBAAkB;QAACC,IAAI,EAAC,OAAO;QAACC,IAAI,EAAC;MAAK,CAAE;IAAC,CACnD,CAAC,GACV,IAAI;EAAA,CACL,CAAC;AAEV,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useAppTheme","Platform","TextInput","Box","Pressable","RnGlyph","jsx","_jsx","jsxs","_jsxs","SearchBar","onChangeText","placeholder","testID","value","theme","lineHeight","face","typography","body","text","OS","height","align","bg","borderRadius","flexDirection","gap","px","py","wide","children","color","name","size","placeholderTextColor","style","flex","padding","length","onPress"],"sourceRoot":"../../../../src","sources":["molecules/search-bar/search-bar.tsx"],"mappings":";;AAAA,SAAQA,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,QAAQ,EAAEC,SAAS,QAAO,cAAc;AAEhD,SAAQC,GAAG,QAAO,0BAAiB;AACnC,SAAQC,SAAS,QAAO,gCAAuB;AAC/C,SAAQC,OAAO,QAAO,sBAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGnC,OAAO,MAAMC,SAA6B,GAAGA,CAAC;EAC5CC,YAAY;EACZC,WAAW,GAAG,QAAQ;EACtBC,MAAM;EACNC;AACc,CAAC,KAAK;EACpB,MAAMC,KAAK,GAAGf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O;QAACC,IAAI,EAAC;MAAK,CAAE;IAAC,CACnD,CAAC,GACV,IAAI;EAAA,CACL,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -1,19 +1,30 @@
1
1
  "use strict";
2
2
 
3
- import { Text as ComposeText, TooltipBox } from '@expo/ui/jetpack-compose';
3
+ import { Text as ComposeText } from '@expo/ui/jetpack-compose';
4
+ import { TooltipBox } from '@hzblj/kara-native/jetpack-compose';
4
5
  import { useAppTheme } from '@hzblj/kara-theme';
6
+ import { useCallback } from 'react';
5
7
  import { useHostGuard } from "../../host-context.js";
6
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ /**
10
+ * Material's plain tooltip in kara's controlled `TooltipBox`: shown while `visible`, centred above the anchor and kept
11
+ * inside the window. Material's own would open on a long press and hide itself without a word to JS.
12
+ */
7
13
  export const Tooltip = ({
8
14
  children,
9
- text
15
+ onDismiss,
16
+ text,
17
+ visible
10
18
  }) => {
11
19
  useHostGuard('Tooltip');
12
20
  const theme = useAppTheme();
21
+ const onDismissRequest = useCallback(() => onDismiss(), [onDismiss]);
13
22
  return /*#__PURE__*/_jsxs(TooltipBox, {
14
- children: [/*#__PURE__*/_jsx(TooltipBox.PlainTooltip, {
15
- containerColor: theme.colorString('surface.high.contrast'),
16
- contentColor: theme.colorString('content.on.high.contrast'),
23
+ containerColor: theme.color('surface.high.contrast'),
24
+ isPresented: visible,
25
+ onDismissRequest: onDismissRequest,
26
+ plain: true,
27
+ children: [/*#__PURE__*/_jsx(TooltipBox.Text, {
17
28
  children: /*#__PURE__*/_jsx(ComposeText, {
18
29
  color: theme.colorString('content.on.high.contrast'),
19
30
  style: theme.typography.footnote,
@@ -1 +1 @@
1
- {"version":3,"names":["Text","ComposeText","TooltipBox","useAppTheme","useHostGuard","jsx","_jsx","jsxs","_jsxs","Tooltip","children","text","theme","PlainTooltip","containerColor","colorString","contentColor","color","style","typography","footnote"],"sourceRoot":"../../../../src","sources":["molecules/tooltip/tooltip.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,IAAIC,WAAW,EAAEC,UAAU,QAAO,0BAA0B;AACxE,SAAQC,WAAW,QAAO,mBAAmB;AAE7C,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C,OAAO,MAAMC,OAAyB,GAAGA,CAAC;EAACC,QAAQ;EAAEC;AAAkB,CAAC,KAAK;EAC3EP,YAAY,CAAC,SAAS,CAAC;EAEvB,MAAMQ,KAAK,GAAGT,WAAW,CAAC,CAAC;EAE3B,oBACEK,KAAA,CAACN,UAAU;IAAAQ,QAAA,gBACTJ,IAAA,CAACJ,UAAU,CAACW,YAAY;MACtBC,cAAc,EAAEF,KAAK,CAACG,WAAW,CAAC,uBAAuB,CAAE;MAC3DC,YAAY,EAAEJ,KAAK,CAACG,WAAW,CAAC,0BAA0B,CAAE;MAAAL,QAAA,eAE5DJ,IAAA,CAACL,WAAW;QAACgB,KAAK,EAAEL,KAAK,CAACG,WAAW,CAAC,0BAA0B,CAAE;QAACG,KAAK,EAAEN,KAAK,CAACO,UAAU,CAACC,QAAS;QAAAV,QAAA,EACjGC;MAAI,CACM;IAAC,CACS,CAAC,EACzBD,QAAQ;EAAA,CACC,CAAC;AAEjB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Text","ComposeText","TooltipBox","useAppTheme","useCallback","useHostGuard","jsx","_jsx","jsxs","_jsxs","Tooltip","children","onDismiss","text","visible","theme","onDismissRequest","containerColor","color","isPresented","plain","colorString","style","typography","footnote"],"sourceRoot":"../../../../src","sources":["molecules/tooltip/tooltip.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,IAAIC,WAAW,QAAO,0BAA0B;AAC5D,SAAQC,UAAU,QAAO,oCAAoC;AAC7D,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,WAAW,QAAO,OAAO;AAEjC,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAyB,GAAGA,CAAC;EAACC,QAAQ;EAAEC,SAAS;EAAEC,IAAI;EAAEC;AAAqB,CAAC,KAAK;EAC/FT,YAAY,CAAC,SAAS,CAAC;EACvB,MAAMU,KAAK,GAAGZ,WAAW,CAAC,CAAC;EAC3B,MAAMa,gBAAgB,GAAGZ,WAAW,CAAC,MAAMQ,SAAS,CAAC,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;EAEpE,oBACEH,KAAA,CAACP,UAAU;IACTe,cAAc,EAAEF,KAAK,CAACG,KAAK,CAAC,uBAAuB,CAAE;IACrDC,WAAW,EAAEL,OAAQ;IACrBE,gBAAgB,EAAEA,gBAAiB;IACnCI,KAAK;IAAAT,QAAA,gBAELJ,IAAA,CAACL,UAAU,CAACF,IAAI;MAAAW,QAAA,eACdJ,IAAA,CAACN,WAAW;QAACiB,KAAK,EAAEH,KAAK,CAACM,WAAW,CAAC,0BAA0B,CAAE;QAACC,KAAK,EAAEP,KAAK,CAACQ,UAAU,CAACC,QAAS;QAAAb,QAAA,EACjGE;MAAI,CACM;IAAC,CACC,CAAC,EACjBF,QAAQ;EAAA,CACC,CAAC;AAEjB,CAAC","ignoreList":[]}