@hzblj/kara-components 0.5.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 (225) hide show
  1. package/CHANGELOG.md +71 -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/chip/chip.js +1 -1
  6. package/lib/module/atoms/chip/chip.js.map +1 -1
  7. package/lib/module/atoms/date-picker/date-picker.ios.js +32 -11
  8. package/lib/module/atoms/date-picker/date-picker.ios.js.map +1 -1
  9. package/lib/module/atoms/index.js +0 -1
  10. package/lib/module/atoms/index.js.map +1 -1
  11. package/lib/module/atoms/pressable/pressable.js +11 -5
  12. package/lib/module/atoms/pressable/pressable.js.map +1 -1
  13. package/lib/module/atoms/rn-flat-list/rn-flat-list.js +10 -9
  14. package/lib/module/atoms/rn-flat-list/rn-flat-list.js.map +1 -1
  15. package/lib/module/atoms/rn-section-list/rn-section-list.js +5 -8
  16. package/lib/module/atoms/rn-section-list/rn-section-list.js.map +1 -1
  17. package/lib/module/atoms/segmented-control/index.js +1 -1
  18. package/lib/module/atoms/segmented-control/index.js.map +1 -1
  19. package/lib/module/atoms/segmented-control/segmented-control.android.js +74 -0
  20. package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -0
  21. package/lib/module/atoms/segmented-control/segmented-control.ios.js +44 -0
  22. package/lib/module/atoms/segmented-control/segmented-control.ios.js.map +1 -0
  23. package/lib/module/atoms/slider/slider.android.js +26 -2
  24. package/lib/module/atoms/slider/slider.android.js.map +1 -1
  25. package/lib/module/atoms/switch/switch.android.js +14 -4
  26. package/lib/module/atoms/switch/switch.android.js.map +1 -1
  27. package/lib/module/haptics/haptics.js +56 -0
  28. package/lib/module/haptics/haptics.js.map +1 -0
  29. package/lib/module/haptics/index.js +5 -0
  30. package/lib/module/haptics/index.js.map +1 -0
  31. package/lib/module/haptics/use-haptic-feedback.js +33 -0
  32. package/lib/module/haptics/use-haptic-feedback.js.map +1 -0
  33. package/lib/module/index.js +1 -0
  34. package/lib/module/index.js.map +1 -1
  35. package/lib/module/molecules/search-bar/search-bar.js +15 -2
  36. package/lib/module/molecules/search-bar/search-bar.js.map +1 -1
  37. package/lib/module/molecules/tooltip/tooltip.android.js +16 -5
  38. package/lib/module/molecules/tooltip/tooltip.android.js.map +1 -1
  39. package/lib/module/organisms/action-sheet/action-sheet.android.js +41 -20
  40. package/lib/module/organisms/action-sheet/action-sheet.android.js.map +1 -1
  41. package/lib/module/organisms/action-sheet/action-sheet.ios.js +24 -8
  42. package/lib/module/organisms/action-sheet/action-sheet.ios.js.map +1 -1
  43. package/lib/module/organisms/alert/alert.ios.js +15 -2
  44. package/lib/module/organisms/alert/alert.ios.js.map +1 -1
  45. package/lib/module/organisms/context-menu/context-menu.android.js +2 -2
  46. package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
  47. package/lib/module/organisms/form/form.android.js +22 -9
  48. package/lib/module/organisms/form/form.android.js.map +1 -1
  49. package/lib/module/organisms/swipe-actions/swipe-actions.android.js +125 -11
  50. package/lib/module/organisms/swipe-actions/swipe-actions.android.js.map +1 -1
  51. package/lib/module/organisms/swipe-actions/swipe-actions.ios.js +46 -18
  52. package/lib/module/organisms/swipe-actions/swipe-actions.ios.js.map +1 -1
  53. package/lib/module/templates/screen/screen.android.js +31 -10
  54. package/lib/module/templates/screen/screen.android.js.map +1 -1
  55. package/lib/typescript/atoms/avatar/avatar.types.d.ts +5 -0
  56. package/lib/typescript/atoms/badge/badge.types.d.ts +3 -0
  57. package/lib/typescript/atoms/button/button.types.d.ts +12 -0
  58. package/lib/typescript/atoms/card/card.types.d.ts +6 -0
  59. package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +5 -0
  60. package/lib/typescript/atoms/chip/chip.types.d.ts +5 -0
  61. package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +4 -0
  62. package/lib/typescript/atoms/date-picker/date-picker.ios.d.ts +6 -1
  63. package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +14 -0
  64. package/lib/typescript/atoms/divider/divider.types.d.ts +3 -0
  65. package/lib/typescript/atoms/fab/fab.types.d.ts +7 -0
  66. package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +1 -0
  67. package/lib/typescript/atoms/h-stack/h-stack.types.d.ts +6 -0
  68. package/lib/typescript/atoms/icon/icon.types.d.ts +8 -0
  69. package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +5 -0
  70. package/lib/typescript/atoms/index.d.ts +0 -1
  71. package/lib/typescript/atoms/island/island.types.d.ts +4 -0
  72. package/lib/typescript/atoms/list/list.types.d.ts +2 -0
  73. package/lib/typescript/atoms/picker/picker.types.d.ts +12 -0
  74. package/lib/typescript/atoms/pressable/pressable.types.d.ts +11 -1
  75. package/lib/typescript/atoms/progress/progress.types.d.ts +6 -0
  76. package/lib/typescript/atoms/rn-flat-list/rn-flat-list.d.ts +5 -8
  77. package/lib/typescript/atoms/rn-flat-list/rn-flat-list.types.d.ts +3 -1
  78. package/lib/typescript/atoms/rn-scroll-view/rn-scroll-view.types.d.ts +4 -0
  79. package/lib/typescript/atoms/rn-section-list/rn-section-list.d.ts +2 -8
  80. package/lib/typescript/atoms/rn-section-list/rn-section-list.types.d.ts +3 -1
  81. package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +4 -0
  82. package/lib/typescript/atoms/rn-view/rn-view.types.d.ts +2 -0
  83. package/lib/typescript/atoms/scroll-view/scroll-view.types.d.ts +4 -0
  84. package/lib/typescript/atoms/segmented-control/segmented-control.d.ts +1 -2
  85. package/lib/typescript/atoms/segmented-control/segmented-control.ios.d.ts +7 -0
  86. package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +13 -0
  87. package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +5 -0
  88. package/lib/typescript/atoms/slider/slider.types.d.ts +7 -0
  89. package/lib/typescript/atoms/spacer/spacer.types.d.ts +3 -0
  90. package/lib/typescript/atoms/surface/surface.types.d.ts +7 -0
  91. package/lib/typescript/atoms/switch/switch.types.d.ts +8 -0
  92. package/lib/typescript/atoms/text/text.types.d.ts +12 -0
  93. package/lib/typescript/atoms/text-field/text-field.types.d.ts +12 -0
  94. package/lib/typescript/atoms/v-stack/v-stack.types.d.ts +9 -0
  95. package/lib/typescript/atoms/z-stack/z-stack.types.d.ts +8 -0
  96. package/lib/typescript/haptics/haptics.d.ts +61 -0
  97. package/lib/typescript/haptics/index.d.ts +2 -0
  98. package/lib/typescript/haptics/use-haptic-feedback.d.ts +15 -0
  99. package/lib/typescript/index.d.ts +1 -0
  100. package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +8 -0
  101. package/lib/typescript/molecules/empty-state/empty-state.types.d.ts +5 -0
  102. package/lib/typescript/molecules/label/label.types.d.ts +6 -0
  103. package/lib/typescript/molecules/labeled-content/labeled-content.types.d.ts +6 -0
  104. package/lib/typescript/molecules/link/link.types.d.ts +6 -0
  105. package/lib/typescript/molecules/list-item/list-item.types.d.ts +9 -0
  106. package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -0
  107. package/lib/typescript/molecules/pager/pager.types.d.ts +2 -0
  108. package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +10 -0
  109. package/lib/typescript/molecules/rn-list-item/rn-list-item.types.d.ts +1 -1
  110. package/lib/typescript/molecules/rn-tooltip/rn-tooltip.types.d.ts +11 -0
  111. package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +3 -0
  112. package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +8 -0
  113. package/lib/typescript/molecules/stepper/stepper.types.d.ts +13 -0
  114. package/lib/typescript/molecules/tooltip/tooltip.types.d.ts +12 -0
  115. package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +8 -0
  116. package/lib/typescript/organisms/alert/alert.types.d.ts +11 -0
  117. package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +4 -0
  118. package/lib/typescript/organisms/fab-menu/fab-menu.types.d.ts +2 -0
  119. package/lib/typescript/organisms/form/form.types.d.ts +6 -0
  120. package/lib/typescript/organisms/menu/menu.types.d.ts +17 -0
  121. package/lib/typescript/organisms/sheet/sheet.types.d.ts +19 -0
  122. package/lib/typescript/organisms/snackbar/snackbar.types.d.ts +8 -0
  123. package/lib/typescript/organisms/swipe-actions/swipe-actions.types.d.ts +36 -13
  124. package/lib/typescript/templates/screen/screen.types.d.ts +9 -0
  125. package/package.json +5 -9
  126. package/src/atoms/avatar/avatar.types.ts +5 -0
  127. package/src/atoms/badge/badge.types.ts +3 -0
  128. package/src/atoms/button/button.types.ts +12 -0
  129. package/src/atoms/card/card.types.ts +6 -0
  130. package/src/atoms/checkbox/checkbox.android.tsx +7 -3
  131. package/src/atoms/checkbox/checkbox.types.ts +5 -0
  132. package/src/atoms/chip/chip.tsx +1 -1
  133. package/src/atoms/chip/chip.types.ts +5 -0
  134. package/src/atoms/color-picker/color-picker.types.ts +4 -0
  135. package/src/atoms/date-picker/date-picker.ios.tsx +33 -13
  136. package/src/atoms/date-picker/date-picker.types.ts +14 -0
  137. package/src/atoms/divider/divider.types.ts +3 -0
  138. package/src/atoms/fab/fab.types.ts +7 -0
  139. package/src/atoms/glass-view/glass-view.types.ts +1 -0
  140. package/src/atoms/h-stack/h-stack.types.ts +6 -0
  141. package/src/atoms/icon/icon.types.ts +8 -0
  142. package/src/atoms/icon-button/icon-button.types.ts +5 -0
  143. package/src/atoms/index.ts +0 -1
  144. package/src/atoms/island/island.types.ts +4 -0
  145. package/src/atoms/list/list.types.ts +2 -0
  146. package/src/atoms/picker/picker.types.ts +12 -0
  147. package/src/atoms/pressable/pressable.tsx +12 -5
  148. package/src/atoms/pressable/pressable.types.ts +12 -1
  149. package/src/atoms/progress/progress.types.ts +6 -0
  150. package/src/atoms/rn-flat-list/rn-flat-list.tsx +8 -8
  151. package/src/atoms/rn-flat-list/rn-flat-list.types.ts +3 -1
  152. package/src/atoms/rn-scroll-view/rn-scroll-view.types.ts +4 -0
  153. package/src/atoms/rn-section-list/rn-section-list.tsx +5 -8
  154. package/src/atoms/rn-section-list/rn-section-list.types.ts +3 -1
  155. package/src/atoms/rn-text/rn-text.types.ts +4 -0
  156. package/src/atoms/rn-view/rn-view.types.ts +2 -0
  157. package/src/atoms/scroll-view/scroll-view.types.ts +4 -0
  158. package/src/atoms/segmented-control/segmented-control.android.tsx +79 -0
  159. package/src/atoms/segmented-control/segmented-control.ios.tsx +47 -0
  160. package/src/atoms/segmented-control/segmented-control.types.ts +13 -0
  161. package/src/atoms/skeleton/skeleton.types.ts +5 -0
  162. package/src/atoms/slider/slider.android.tsx +33 -2
  163. package/src/atoms/slider/slider.types.ts +7 -0
  164. package/src/atoms/spacer/spacer.types.ts +3 -0
  165. package/src/atoms/surface/surface.types.ts +7 -0
  166. package/src/atoms/switch/switch.android.tsx +18 -5
  167. package/src/atoms/switch/switch.types.ts +8 -0
  168. package/src/atoms/text/text.types.ts +12 -0
  169. package/src/atoms/text-field/text-field.types.ts +12 -0
  170. package/src/atoms/v-stack/v-stack.types.ts +9 -0
  171. package/src/atoms/z-stack/z-stack.types.ts +8 -0
  172. package/src/haptics/haptics.ts +68 -0
  173. package/src/haptics/index.ts +2 -0
  174. package/src/haptics/use-haptic-feedback.ts +36 -0
  175. package/src/index.ts +1 -0
  176. package/src/molecules/collapsible/collapsible.types.ts +8 -0
  177. package/src/molecules/empty-state/empty-state.types.ts +5 -0
  178. package/src/molecules/label/label.types.ts +6 -0
  179. package/src/molecules/labeled-content/labeled-content.types.ts +6 -0
  180. package/src/molecules/link/link.types.ts +6 -0
  181. package/src/molecules/list-item/list-item.types.ts +9 -0
  182. package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -0
  183. package/src/molecules/pager/pager.types.ts +2 -0
  184. package/src/molecules/radio-group/radio-group.types.ts +10 -0
  185. package/src/molecules/rn-list-item/rn-list-item.types.ts +1 -1
  186. package/src/molecules/rn-tooltip/rn-tooltip.types.ts +11 -0
  187. package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +3 -0
  188. package/src/molecules/search-bar/search-bar.tsx +9 -2
  189. package/src/molecules/search-bar/search-bar.types.ts +8 -0
  190. package/src/molecules/stepper/stepper.types.ts +13 -0
  191. package/src/molecules/tooltip/tooltip.android.tsx +17 -9
  192. package/src/molecules/tooltip/tooltip.types.ts +12 -0
  193. package/src/organisms/action-sheet/action-sheet.android.tsx +37 -19
  194. package/src/organisms/action-sheet/action-sheet.ios.tsx +22 -9
  195. package/src/organisms/action-sheet/action-sheet.types.ts +8 -0
  196. package/src/organisms/alert/alert.ios.tsx +11 -1
  197. package/src/organisms/alert/alert.types.ts +11 -0
  198. package/src/organisms/context-menu/context-menu.android.tsx +2 -2
  199. package/src/organisms/context-menu/context-menu.types.ts +4 -0
  200. package/src/organisms/fab-menu/fab-menu.types.ts +2 -0
  201. package/src/organisms/form/form.android.tsx +15 -7
  202. package/src/organisms/form/form.types.ts +6 -0
  203. package/src/organisms/menu/menu.types.ts +17 -0
  204. package/src/organisms/sheet/sheet.types.ts +19 -0
  205. package/src/organisms/snackbar/snackbar.types.ts +8 -0
  206. package/src/organisms/swipe-actions/swipe-actions.android.tsx +129 -9
  207. package/src/organisms/swipe-actions/swipe-actions.ios.tsx +45 -11
  208. package/src/organisms/swipe-actions/swipe-actions.types.ts +37 -14
  209. package/src/templates/screen/screen.android.tsx +33 -12
  210. package/src/templates/screen/screen.types.ts +9 -0
  211. package/lib/module/atoms/flash-list/flash-list.js +0 -31
  212. package/lib/module/atoms/flash-list/flash-list.js.map +0 -1
  213. package/lib/module/atoms/flash-list/flash-list.types.js +0 -4
  214. package/lib/module/atoms/flash-list/flash-list.types.js.map +0 -1
  215. package/lib/module/atoms/flash-list/index.js +0 -5
  216. package/lib/module/atoms/flash-list/index.js.map +0 -1
  217. package/lib/module/atoms/segmented-control/segmented-control.js +0 -28
  218. package/lib/module/atoms/segmented-control/segmented-control.js.map +0 -1
  219. package/lib/typescript/atoms/flash-list/flash-list.d.ts +0 -8
  220. package/lib/typescript/atoms/flash-list/flash-list.types.d.ts +0 -18
  221. package/lib/typescript/atoms/flash-list/index.d.ts +0 -2
  222. package/src/atoms/flash-list/flash-list.tsx +0 -28
  223. package/src/atoms/flash-list/flash-list.types.ts +0 -20
  224. package/src/atoms/flash-list/index.ts +0 -2
  225. package/src/atoms/segmented-control/segmented-control.tsx +0 -34
package/CHANGELOG.md CHANGED
@@ -1,5 +1,76 @@
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
+
52
+ ## 0.6.0
53
+
54
+ ### Minor Changes
55
+
56
+ - [#10](https://github.com/hzblj/kara-ui/pull/10) [`62b7131`](https://github.com/hzblj/kara-ui/commit/62b713143bd03872ecdd89ca8de42d98fe589617) Thanks [@hzblj](https://github.com/hzblj)! - Haptics: kara's own, native on both platforms, named for what happened.
57
+
58
+ - `haptics.success()`, `haptics.selection()`, … — one function per haptic — and `haptics.play(name)` for a name that arrives as data. `selection`, `tick`, `toggleOn`/`toggleOff`, `success`/`warning`/`error`, `longPress`, `dragStart`, `thresholdActivate`/`thresholdDeactivate`, `keyPress`, and the impacts `soft`, `light`, `medium`, `rigid`, `heavy` (`intensity` scales them on iOS). Synchronous, nothing to await.
59
+ - iOS: UIKit's feedback generators, kept alive and warmed up with `haptics.prepare` — `Pressable` prepares its haptic on press-in. Android: the system's own haptic feedback (`View.performHapticFeedback`), with Android 14's constants falling back to older ones — never a raw vibration. Both follow the user's system setting.
60
+ - `useHapticFeedback(trigger, haptic)` plays on every change of a value, never on mount; a function of the previous and next value picks a haptic per change.
61
+ - `haptics.setEnabled(false)` silences every kara haptic, the components' own included.
62
+ - `Pressable`'s `haptic` takes a name as well as `true` (a `light` impact); `Chip` plays `selection`.
63
+ - On Android, where Compose's Material controls play nothing: `Switch` plays `toggleOn`/`toggleOff`, a stepped `Slider` ticks at every stop, `SegmentedControl` plays `selection`. iOS keeps its native controls' own feedback.
64
+ - `Slider`: `step` is the increment on Android too — it was passed to Compose as the number of stops.
65
+ - `expo-haptics` is no longer a peer dependency.
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies [[`62b7131`](https://github.com/hzblj/kara-ui/commit/62b713143bd03872ecdd89ca8de42d98fe589617)]:
70
+ - @hzblj/kara-native@0.6.0
71
+ - @hzblj/kara-theme@0.6.0
72
+ - @hzblj/kara-sx@0.6.0
73
+
3
74
  ## 0.5.0
4
75
 
5
76
  ### 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,SAAQ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,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,IAAI,GAAGA,CAAA,KAAMC,SAAS;;AAE5B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMf,QAA2B,GAAGA,CAAC;EAACgB,QAAQ,GAAG,KAAK;EAAEC,KAAK;EAAEC,aAAa;EAAEC;AAAoB,CAAC,KAAK;EAC7GV,YAAY,CAAC,UAAU,CAAC;EACxB,MAAMW,KAAK,GAAGb,WAAW,CAAC,CAAC;EAC3B,MAAMc,YAAY,GAAGb,OAAO,CAC1B,MAAOQ,QAAQ,IAAI,CAACE,aAAa,GAAG,CAACb,YAAY,CAAC,CAAC,CAAC,GAAG,CAACA,YAAY,CAAC,CAAC,EAAED,SAAS,CAAC,MAAMc,aAAa,CAAC,CAACC,KAAK,CAAC,CAAC,CAAE,EAChH,CAACH,QAAQ,EAAEE,aAAa,EAAEC,KAAK,CACjC,CAAC;EACD,MAAMG,OAAO,gBACXX,IAAA,CAACV,eAAe;IACdsB,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,aAAa,IAAIJ,IAAK;IACvCK,KAAK,EAAEA;EAAM,CACd,CACF;EAED,IAAI,CAACF,KAAK,EAAE;IACV,OAAOK,OAAO;EAChB;EAEA,oBACET,KAAA,CAACX,GAAG;IAAC2B,qBAAqB,EAAE;MAACC,QAAQ,EAAExB,OAAO,CAACyB;IAAE,CAAE;IAACC,SAAS,EAAEX,YAAa;IAACY,iBAAiB,EAAC,QAAQ;IAAAC,QAAA,GACpGZ,OAAO,eACRX,IAAA,CAACR,IAAI;MAACsB,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":[]}
@@ -14,7 +14,7 @@ export const Chip = ({
14
14
  borderColor: selected ? 'border.accent' : 'border.tertiary',
15
15
  borderRadius: "full",
16
16
  borderWidth: 1,
17
- haptic: true,
17
+ haptic: "selection",
18
18
  justify: "center",
19
19
  onPress: onPress,
20
20
  px: "s12",
@@ -1 +1 @@
1
- {"version":3,"names":["Pressable","RnText","jsx","_jsx","Chip","label","onPress","selected","testID","align","bg","borderColor","borderRadius","borderWidth","haptic","justify","px","py","children","color","variant"],"sourceRoot":"../../../../src","sources":["atoms/chip/chip.tsx"],"mappings":";;AAAA,SAAQA,SAAS,QAAO,uBAAc;AACtC,SAAQC,MAAM,QAAO,qBAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGjC,OAAO,MAAMC,IAAmB,GAAGA,CAAC;EAACC,KAAK;EAAEC,OAAO;EAAEC,QAAQ,GAAG,KAAK;EAAEC;AAAiB,CAAC,kBACvFL,IAAA,CAACH,SAAS;EACRS,KAAK,EAAC,QAAQ;EACdC,EAAE,EAAEH,QAAQ,GAAG,kBAAkB,GAAG,eAAgB;EACpDI,WAAW,EAAEJ,QAAQ,GAAG,eAAe,GAAG,iBAAkB;EAC5DK,YAAY,EAAC,MAAM;EACnBC,WAAW,EAAE,CAAE;EACfC,MAAM;EACNC,OAAO,EAAC,QAAQ;EAChBT,OAAO,EAAEA,OAAQ;EACjBU,EAAE,EAAC,KAAK;EACRC,EAAE,EAAC,IAAI;EACPT,MAAM,EAAEA,MAAO;EAAAU,QAAA,eAEff,IAAA,CAACF,MAAM;IAACkB,KAAK,EAAEZ,QAAQ,GAAG,gBAAgB,GAAG,mBAAoB;IAACa,OAAO,EAAC,aAAa;IAAAF,QAAA,EACpFb;EAAK,CACA;AAAC,CACA,CACZ","ignoreList":[]}
1
+ {"version":3,"names":["Pressable","RnText","jsx","_jsx","Chip","label","onPress","selected","testID","align","bg","borderColor","borderRadius","borderWidth","haptic","justify","px","py","children","color","variant"],"sourceRoot":"../../../../src","sources":["atoms/chip/chip.tsx"],"mappings":";;AAAA,SAAQA,SAAS,QAAO,uBAAc;AACtC,SAAQC,MAAM,QAAO,qBAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGjC,OAAO,MAAMC,IAAmB,GAAGA,CAAC;EAACC,KAAK;EAAEC,OAAO;EAAEC,QAAQ,GAAG,KAAK;EAAEC;AAAiB,CAAC,kBACvFL,IAAA,CAACH,SAAS;EACRS,KAAK,EAAC,QAAQ;EACdC,EAAE,EAAEH,QAAQ,GAAG,kBAAkB,GAAG,eAAgB;EACpDI,WAAW,EAAEJ,QAAQ,GAAG,eAAe,GAAG,iBAAkB;EAC5DK,YAAY,EAAC,MAAM;EACnBC,WAAW,EAAE,CAAE;EACfC,MAAM,EAAC,WAAW;EAClBC,OAAO,EAAC,QAAQ;EAChBT,OAAO,EAAEA,OAAQ;EACjBU,EAAE,EAAC,KAAK;EACRC,EAAE,EAAC,IAAI;EACPT,MAAM,EAAEA,MAAO;EAAAU,QAAA,eAEff,IAAA,CAACF,MAAM;IAACkB,KAAK,EAAEZ,QAAQ,GAAG,gBAAgB,GAAG,mBAAoB;IAACa,OAAO,EAAC,aAAa;IAAAF,QAAA,EACpFb;EAAK,CACA;AAAC,CACA,CACZ","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,YAAY,EAAEC,IAAI,QAAO,6BAA6B;AAC/E,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,OAAO,QAAO,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAI7B,MAAMC,UAAU,GAAG;EACjBC,IAAI,EAAE,CAAC,MAAM,CAAC;EACdC,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC;EACnCC,IAAI,EAAE,CAAC,eAAe;AACxB,CAAyE;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMZ,UAA+B,GAAGA,CAAC;EAC9Ca,GAAG;EACHC,GAAG;EACHC,IAAI,GAAG,MAAM;EACbC,aAAa;EACbC,MAAM;EACNC;AACe,CAAC,KAAK;EACrB,MAAMC,KAAK,GAAGd,WAAW,CAAC,CAAC;EAE3B,MAAMe,SAAS,GAAGd,OAAO,CACvB,MAAM,CAACJ,eAAe,CAAC,SAAS,CAAC,EAAEC,YAAY,CAAC,CAAC,EAAEC,IAAI,CAACe,KAAK,CAACE,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAC5F,CAACF,KAAK,CACR,CAAC;EAED,oBACEX,IAAA,CAACT,IAAI;IAACuB,WAAW,EAAEH,KAAK,CAACI,IAAI,GAAG,MAAM,GAAG,OAAQ;IAACC,aAAa;IAAAC,QAAA,eAC7DjB,IAAA,CAACP,iBAAiB;MAChByB,mBAAmB,EAAE,CAAC,GAAGjB,UAAU,CAACM,IAAI,CAAC,CAAE;MAC3CK,SAAS,EAAEA,SAAU;MACrBO,YAAY,EAAEX,aAAc;MAC5BY,KAAK,EAAEd,GAAG,IAAID,GAAG,GAAG;QAACgB,GAAG,EAAEhB,GAAG;QAAEiB,KAAK,EAAEhB;MAAG,CAAC,GAAGiB,SAAU;MACvDC,SAAS,EAAEd,KAAM;MACjBD,MAAM,EAAEA;IAAO,CAChB;EAAC,CACE,CAAC;AAEX,CAAC","ignoreList":[]}
@@ -12,7 +12,6 @@ export * from "./color-picker/index.js";
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":[]}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import { useSplitSx } from '@hzblj/kara-sx';
4
- import * as Haptics from 'expo-haptics';
5
4
  import { useCallback } from 'react';
6
5
  import { Pressable as RNPressable } from 'react-native';
7
6
  import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated';
7
+ import { haptics } from "../../haptics/index.js";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  const SPRING = {
10
10
  damping: 20,
@@ -21,23 +21,29 @@ export const Pressable = ({
21
21
  }) => {
22
22
  const [resolved, rest] = useSplitSx(props);
23
23
  const scale = useSharedValue(1);
24
+ const feedback = haptic === true ? 'light' : haptic || undefined;
24
25
  const rStyle = useAnimatedStyle(() => ({
25
26
  transform: [{
26
27
  scale: scale.value
27
28
  }]
28
29
  }), []);
30
+
31
+ // The finger is down: the Taptic Engine has until the release to wake, so the haptic lands with the press.
29
32
  const onPressIn = useCallback(() => {
30
33
  scale.value = withSpring(0.96, SPRING);
31
- }, [scale]);
34
+ if (feedback) {
35
+ haptics.prepare(feedback);
36
+ }
37
+ }, [feedback, scale]);
32
38
  const onPressOut = useCallback(() => {
33
39
  scale.value = withSpring(1, SPRING);
34
40
  }, [scale]);
35
41
  const onPressWithHaptic = useCallback(() => {
36
- if (haptic) {
37
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => undefined);
42
+ if (feedback) {
43
+ haptics.play(feedback);
38
44
  }
39
45
  onPress?.();
40
- }, [haptic, onPress]);
46
+ }, [feedback, onPress]);
41
47
  return /*#__PURE__*/_jsx(AnimatedPressable, {
42
48
  disabled: disabled,
43
49
  hitSlop: 8,
@@ -1 +1 @@
1
- {"version":3,"names":["useSplitSx","Haptics","useCallback","Pressable","RNPressable","Animated","useAnimatedStyle","useSharedValue","withSpring","jsx","_jsx","SPRING","damping","stiffness","AnimatedPressable","createAnimatedComponent","children","disabled","haptic","onPress","testID","props","resolved","rest","scale","rStyle","transform","value","onPressIn","onPressOut","onPressWithHaptic","impactAsync","ImpactFeedbackStyle","Light","catch","undefined","hitSlop","style"],"sourceRoot":"../../../../src","sources":["atoms/pressable/pressable.tsx"],"mappings":";;AAAA,SAAQA,UAAU,QAAO,gBAAgB;AACzC,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAAQC,W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KAAK,CAAC,CAACC,KAAK,CAAC,MAAMC,SAAS,CAAC;IAC/E;IAEAhB,OAAO,GAAG,CAAC;EACb,CAAC,EAAE,CAACD,MAAM,EAAEC,OAAO,CAAC,CAAC;EAErB,oBACET,IAAA,CAACI,iBAAiB;IAChBG,QAAQ,EAAEA,QAAS;IACnBmB,OAAO,EAAE,CAAE;IACXjB,OAAO,EAAEW,iBAAkB;IAC3BF,SAAS,EAAEA,SAAU;IACrBC,UAAU,EAAEA,UAAW;IACvBQ,KAAK,EAAE,CAACf,QAAQ,EAAEG,MAAM,CAAE;IAC1BL,MAAM,EAAEA,MAAO;IAAA,GACXG,IAAI;IAAAP,QAAA,EAEPA;EAAQ,CACQ,CAAC;AAExB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useSplitSx","useCallback","Pressable","RNPressable","Animated","useAnimatedStyle","useSharedValue","withSpring","haptics","jsx","_jsx","SPRING","damping","stiffness","AnimatedPressable","createAnimatedComponent","children","disabled","haptic","onPress","testID","props","resolved","rest","scale","feedback","undefined","rStyle","transform","value","onPressIn","prepare","onPressOut","onPressWithHaptic","play","hitSlop","style"],"sourceRoot":"../../../../src","sources":["atoms/pressable/pressable.tsx"],"mappings":";;AAAA,SAAQA,UAAU,QAAO,gBAAgB;AACzC,SAAQC,WAAW,QAAO,OAAO;AACjC,SAAQC,SAAS,IAAIC,WAAW,QAAO,cAAc;AACrD,OAAOC,QAAQ,IAAGC,gBAAgB,EAAEC,cAAc,EAAEC,UAAU,QAAO,yBAAyB;AAE9F,SAAQC,OAAO,QAAO,wBAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGrC,MAAMC,MAAM,GAAG;EAACC,OAAO,EAAE,EAAE;EAAEC,SAAS,EAAE;AAAG,CAAC;AAE5C,MAAMC,iBAAiB,GAAGV,QAAQ,CAACW,uBAAuB,CAACZ,WAAW,CAAC;AAEvE,OAAO,MAAMD,SAA6B,GAAGA,CAAC;EAC5Cc,QAAQ;EACRC,QAAQ,GAA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AAU;IACrBE,UAAU,EAAEA,UAAW;IACvBI,KAAK,EAAE,CAACd,QAAQ,EAAEK,MAAM,CAAE;IAC1BP,MAAM,EAAEA,MAAO;IAAA,GACXG,IAAI;IAAAP,QAAA,EAEPA;EAAQ,CACQ,CAAC;AAExB,CAAC","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,wBAA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'@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;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CAACZ,aAAa,CAAE;IACrCC,MAAM,EAAEA;EAAO,CAChB,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -2,8 +2,15 @@
2
2
 
3
3
  import { Slider as ComposeSlider } from '@expo/ui/jetpack-compose';
4
4
  import { useAppTheme } from '@hzblj/kara-theme';
5
+ import { useCallback, useEffect, useRef } from 'react';
6
+ import { haptics } from "../../haptics/index.js";
5
7
  import { useHostGuard } from "../../host-context.js";
6
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
+ /**
10
+ * Material's slider. `step` is the increment, as SwiftUI takes it; Compose counts the stops between the two ends
11
+ * instead, so it is converted. A stepped slider ticks at every stop the thumb reaches — Compose's Material slider
12
+ * plays nothing of its own, where iOS 26's slider already does.
13
+ */
7
14
  export const Slider = ({
8
15
  disabled = false,
9
16
  max = 1,
@@ -14,6 +21,23 @@ export const Slider = ({
14
21
  }) => {
15
22
  useHostGuard('Slider');
16
23
  const theme = useAppTheme();
24
+ const steps = step ? Math.max(0, Math.round((max - min) / step) - 1) : 0;
25
+
26
+ // The stop is derived from the value rather than trusting it to arrive snapped, and remembered between events:
27
+ // Compose reports faster than React re-renders the controlled value.
28
+ const stopOf = useCallback(at => step ? Math.round((at - min) / step) : 0, [min, step]);
29
+ const stop = useRef(stopOf(value));
30
+ useEffect(() => {
31
+ stop.current = stopOf(value);
32
+ }, [stopOf, value]);
33
+ const onChange = useCallback(next => {
34
+ const reached = stopOf(next);
35
+ if (steps > 0 && reached !== stop.current) {
36
+ haptics.tick();
37
+ }
38
+ stop.current = reached;
39
+ onValueChange?.(next);
40
+ }, [onValueChange, stopOf, steps]);
17
41
  return /*#__PURE__*/_jsx(ComposeSlider, {
18
42
  colors: {
19
43
  activeTrackColor: theme.color('fill.accent.primary'),
@@ -22,8 +46,8 @@ export const Slider = ({
22
46
  enabled: !disabled,
23
47
  max: max,
24
48
  min: min,
25
- onValueChange: onValueChange,
26
- steps: step,
49
+ onValueChange: onChange,
50
+ steps: steps,
27
51
  value: value
28
52
  });
29
53
  };