@hzblj/kara-components 0.9.0 → 0.10.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.
- package/CHANGELOG.md +45 -28
- package/README.md +8 -8
- package/lib/module/atoms/color-picker/color-picker.android.js +32 -5
- package/lib/module/atoms/color-picker/color-picker.android.js.map +1 -1
- package/lib/module/atoms/icon-button/icon-button.ios.js +17 -4
- package/lib/module/atoms/icon-button/icon-button.ios.js.map +1 -1
- package/lib/module/atoms/pressable/pressable.js +45 -22
- package/lib/module/atoms/pressable/pressable.js.map +1 -1
- package/lib/typescript/atoms/activity-indicator/activity-indicator.types.d.ts +1 -1
- package/lib/typescript/atoms/avatar/avatar.types.d.ts +2 -2
- package/lib/typescript/atoms/badge/badge.types.d.ts +1 -1
- package/lib/typescript/atoms/blur-view/blur-view.types.d.ts +6 -6
- package/lib/typescript/atoms/button/button.types.d.ts +7 -7
- package/lib/typescript/atoms/card/card.types.d.ts +1 -1
- package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +2 -2
- package/lib/typescript/atoms/chip/chip.types.d.ts +1 -1
- package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +4 -3
- package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +4 -4
- package/lib/typescript/atoms/divider/divider.types.d.ts +2 -2
- package/lib/typescript/atoms/fab/fab.types.d.ts +2 -2
- package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +5 -5
- package/lib/typescript/atoms/h-stack/h-stack.types.d.ts +3 -3
- package/lib/typescript/atoms/icon/icon.types.d.ts +4 -4
- package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +7 -3
- package/lib/typescript/atoms/island/island.types.d.ts +4 -4
- package/lib/typescript/atoms/list/list.types.d.ts +5 -5
- package/lib/typescript/atoms/picker/picker.types.d.ts +1 -1
- package/lib/typescript/atoms/pressable/pressable.types.d.ts +21 -5
- package/lib/typescript/atoms/progress/progress.types.d.ts +1 -1
- package/lib/typescript/atoms/rn-flat-list/rn-flat-list.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-icon/rn-icon.types.d.ts +1 -1
- package/lib/typescript/atoms/rn-scroll-view/rn-scroll-view.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-section-list/rn-section-list.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-view/rn-view.types.d.ts +3 -3
- package/lib/typescript/atoms/scroll-view/scroll-view.types.d.ts +3 -3
- package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +3 -3
- package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +2 -2
- package/lib/typescript/atoms/spacer/spacer.types.d.ts +1 -1
- package/lib/typescript/atoms/surface/surface.types.d.ts +1 -1
- package/lib/typescript/atoms/switch/switch.types.d.ts +1 -1
- package/lib/typescript/atoms/text/text.types.d.ts +1 -1
- package/lib/typescript/atoms/text-field/text-field.types.d.ts +4 -4
- package/lib/typescript/atoms/v-stack/v-stack.types.d.ts +1 -1
- package/lib/typescript/atoms/z-stack/z-stack.types.d.ts +1 -1
- package/lib/typescript/glyph/glyph-button.types.d.ts +1 -1
- package/lib/typescript/glyph/glyph.types.d.ts +1 -1
- package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +1 -1
- package/lib/typescript/molecules/empty-state/empty-state.types.d.ts +1 -1
- package/lib/typescript/molecules/label/label.types.d.ts +1 -1
- package/lib/typescript/molecules/labeled-content/labeled-content.types.d.ts +2 -2
- package/lib/typescript/molecules/list-item/list-item.types.d.ts +2 -2
- package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -8
- package/lib/typescript/molecules/pager/pager.types.d.ts +2 -2
- package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +2 -2
- package/lib/typescript/molecules/rn-list-item/rn-list-item.types.d.ts +1 -1
- package/lib/typescript/molecules/rn-tooltip/rn-tooltip.types.d.ts +7 -7
- package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +3 -3
- package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +2 -2
- package/lib/typescript/molecules/stepper/stepper.types.d.ts +2 -2
- package/lib/typescript/molecules/tooltip/tooltip.types.d.ts +6 -6
- package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +3 -3
- package/lib/typescript/organisms/alert/alert.types.d.ts +3 -3
- package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +9 -9
- package/lib/typescript/organisms/fab-menu/fab-menu.types.d.ts +5 -5
- package/lib/typescript/organisms/form/form.types.d.ts +1 -1
- package/lib/typescript/organisms/menu/menu.types.d.ts +2 -2
- package/lib/typescript/organisms/sheet/sheet.types.d.ts +12 -12
- package/lib/typescript/organisms/snackbar/snackbar.types.d.ts +1 -1
- package/lib/typescript/organisms/swipe-actions/swipe-actions.types.d.ts +5 -5
- package/lib/typescript/templates/screen/screen.types.d.ts +2 -2
- package/package.json +4 -4
- package/src/atoms/activity-indicator/activity-indicator.types.ts +1 -1
- package/src/atoms/avatar/avatar.types.ts +2 -2
- package/src/atoms/badge/badge.types.ts +1 -1
- package/src/atoms/blur-view/blur-view.types.ts +6 -6
- package/src/atoms/button/button.types.ts +7 -7
- package/src/atoms/card/card.types.ts +1 -1
- package/src/atoms/checkbox/checkbox.types.ts +2 -2
- package/src/atoms/chip/chip.types.ts +1 -1
- package/src/atoms/color-picker/color-picker.android.tsx +26 -6
- package/src/atoms/color-picker/color-picker.types.ts +4 -3
- package/src/atoms/date-picker/date-picker.types.ts +4 -4
- package/src/atoms/divider/divider.types.ts +2 -2
- package/src/atoms/fab/fab.types.ts +2 -2
- package/src/atoms/glass-view/glass-view.types.ts +5 -5
- package/src/atoms/h-stack/h-stack.types.ts +3 -3
- package/src/atoms/icon/icon.types.ts +4 -4
- package/src/atoms/icon-button/icon-button.ios.tsx +12 -2
- package/src/atoms/icon-button/icon-button.types.ts +7 -3
- package/src/atoms/island/island.types.ts +4 -4
- package/src/atoms/list/list.types.ts +5 -5
- package/src/atoms/picker/picker.types.ts +1 -1
- package/src/atoms/pressable/pressable.tsx +39 -18
- package/src/atoms/pressable/pressable.types.ts +22 -5
- package/src/atoms/progress/progress.types.ts +1 -1
- package/src/atoms/rn-flat-list/rn-flat-list.types.ts +2 -2
- package/src/atoms/rn-icon/rn-icon.types.ts +1 -1
- package/src/atoms/rn-scroll-view/rn-scroll-view.types.ts +2 -2
- package/src/atoms/rn-section-list/rn-section-list.types.ts +2 -2
- package/src/atoms/rn-text/rn-text.types.ts +2 -2
- package/src/atoms/rn-view/rn-view.types.ts +3 -3
- package/src/atoms/scroll-view/scroll-view.types.ts +3 -3
- package/src/atoms/segmented-control/segmented-control.types.ts +3 -3
- package/src/atoms/skeleton/skeleton.types.ts +2 -2
- package/src/atoms/spacer/spacer.types.ts +1 -1
- package/src/atoms/surface/surface.types.ts +1 -1
- package/src/atoms/switch/switch.types.ts +1 -1
- package/src/atoms/text/text.types.ts +1 -1
- package/src/atoms/text-field/text-field.types.ts +4 -4
- package/src/atoms/v-stack/v-stack.types.ts +1 -1
- package/src/atoms/z-stack/z-stack.types.ts +1 -1
- package/src/glyph/glyph-button.types.ts +1 -1
- package/src/glyph/glyph.types.ts +1 -1
- package/src/molecules/collapsible/collapsible.types.ts +1 -1
- package/src/molecules/empty-state/empty-state.types.ts +1 -1
- package/src/molecules/label/label.types.ts +1 -1
- package/src/molecules/labeled-content/labeled-content.types.ts +2 -2
- package/src/molecules/list-item/list-item.types.ts +2 -2
- package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -8
- package/src/molecules/pager/pager.types.ts +2 -2
- package/src/molecules/radio-group/radio-group.types.ts +2 -2
- package/src/molecules/rn-list-item/rn-list-item.types.ts +1 -1
- package/src/molecules/rn-tooltip/rn-tooltip.types.ts +7 -7
- package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +3 -3
- package/src/molecules/search-bar/search-bar.types.ts +2 -2
- package/src/molecules/stepper/stepper.types.ts +2 -2
- package/src/molecules/tooltip/tooltip.types.ts +6 -6
- package/src/organisms/action-sheet/action-sheet.types.ts +3 -3
- package/src/organisms/alert/alert.types.ts +3 -3
- package/src/organisms/context-menu/context-menu.types.ts +9 -9
- package/src/organisms/fab-menu/fab-menu.types.ts +5 -5
- package/src/organisms/form/form.types.ts +1 -1
- package/src/organisms/menu/menu.types.ts +2 -2
- package/src/organisms/sheet/sheet.types.ts +12 -12
- package/src/organisms/snackbar/snackbar.types.ts +1 -1
- package/src/organisms/swipe-actions/swipe-actions.types.ts +5 -5
- package/src/templates/screen/screen.types.ts +2 -2
- package/lib/module/platform-support.js +0 -19
- package/lib/module/platform-support.js.map +0 -1
- package/lib/typescript/platform-support.d.ts +0 -8
- package/src/platform-support.ts +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
# @hzblj/kara-components
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#23](https://github.com/hzblj/kara-ui/pull/23) [`26f1651`](https://github.com/hzblj/kara-ui/commit/26f1651b6a8be9fc2d7af6bbe29bd2335605a717) Thanks [@hzblj](https://github.com/hzblj)! - `ColorPicker` works on Android. Compose ships no colour picker, so kara draws its own in the iOS picker's shape: a well with a rainbow ring beside the label, and a Material bottom sheet with a grid of swatches, a spectrum and RGB sliders, an opacity slider with `supportsOpacity`, and the colour with its hex at the foot. It reports every change through `onValueChange`, as `#RRGGBB` or, with opacity, `#RRGGBBAA`. It needs no extra dependency.
|
|
8
|
+
|
|
9
|
+
`Pressable` takes a `pressEffect`: `scale` springs the content down to `pressedScale` (0.96), `opacity` dims it to `pressedOpacity` (`o60`), `none` holds it still. Each platform keeps its own by default, a spring on iOS and the ripple on Android, and Android keeps the ripple on top of any effect unless `ripple` is off.
|
|
10
|
+
|
|
11
|
+
`IconButton` on iOS sits in a 44pt tap target with the icon centred, as Android's sits in Material's 48dp, so a row of them spaces itself the same way on both. A disabled one is dimmed once, by SwiftUI, instead of twice.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`26f1651`](https://github.com/hzblj/kara-ui/commit/26f1651b6a8be9fc2d7af6bbe29bd2335605a717), [`26f1651`](https://github.com/hzblj/kara-ui/commit/26f1651b6a8be9fc2d7af6bbe29bd2335605a717)]:
|
|
16
|
+
- @hzblj/kara-native@0.10.0
|
|
17
|
+
- @hzblj/kara-theme@0.10.0
|
|
18
|
+
- @hzblj/kara-sx@0.10.0
|
|
19
|
+
|
|
3
20
|
## 0.9.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
6
23
|
|
|
7
|
-
- [#21](https://github.com/hzblj/kara-ui/pull/21) [`356c00f`](https://github.com/hzblj/kara-ui/commit/356c00f76eee8323c4eb65ed4cbcda121c3af627) Thanks [@hzblj](https://github.com/hzblj)! - `TextField`'s `error` takes a message: `error="A postcode has five digits."` shows it under the field
|
|
24
|
+
- [#21](https://github.com/hzblj/kara-ui/pull/21) [`356c00f`](https://github.com/hzblj/kara-ui/commit/356c00f76eee8323c4eb65ed4cbcda121c3af627) Thanks [@hzblj](https://github.com/hzblj)! - `TextField`'s `error` takes a message: `error="A postcode has five digits."` shows it under the field (Material's supporting text beside its error icon on Android), so an error never rests on colour alone, which in dark mode Material draws a pale red. `error` alone still marks the field. kara's glyphs gain `error` for it.
|
|
8
25
|
|
|
9
26
|
`Tabs` on iOS tint their icons: the selected one takes the accent and the rest the label colour. Expo Router tints an asset-catalog icon only when both states have an icon colour, so with the accent alone every icon kept its SVG's black, selected or not, in dark mode too.
|
|
10
27
|
|
|
11
|
-
`Surface` on iOS sits on `surface.primary` unless told otherwise, as it does on Android; a plain one drew nothing behind its content. `Progress` with `circular` and a `value` is a ring that fills on iOS
|
|
28
|
+
`Surface` on iOS sits on `surface.primary` unless told otherwise, as it does on Android; a plain one drew nothing behind its content. `Progress` with `circular` and a `value` is a ring that fills on iOS (a SwiftUI capacity `Gauge`), where a circular `ProgressView` ignored the value and spun.
|
|
12
29
|
|
|
13
30
|
### Patch Changes
|
|
14
31
|
|
|
@@ -21,23 +38,23 @@
|
|
|
21
38
|
|
|
22
39
|
### Minor Changes
|
|
23
40
|
|
|
24
|
-
- [#17](https://github.com/hzblj/kara-ui/pull/17) [`4c7eaa0`](https://github.com/hzblj/kara-ui/commit/4c7eaa021ee4a4b0475e1dfb420fa5803c21ba29) Thanks [@hzblj](https://github.com/hzblj)! - `ActivityIndicator` plays Material 3's expressive `LoadingIndicator` on Android
|
|
41
|
+
- [#17](https://github.com/hzblj/kara-ui/pull/17) [`4c7eaa0`](https://github.com/hzblj/kara-ui/commit/4c7eaa021ee4a4b0475e1dfb420fa5803c21ba29) Thanks [@hzblj](https://github.com/hzblj)! - `ActivityIndicator` plays Material 3's expressive `LoadingIndicator` on Android (its shapes morph as it turns), in a host of its own, so it still renders anywhere; iOS keeps UIKit's spinner. It takes the design system's props now, not React Native's: `color` is a token (`fill.accent.primary` by default), `size` is `small` or `large`.
|
|
25
42
|
|
|
26
43
|
`Collapsible` on Android spans its parent, the chevron at the far end, and its row is never shorter than Material's 48dp touch target; the chevron sat right after the label. `Pager`'s dots on Android are centred under the pages.
|
|
27
44
|
|
|
28
45
|
- [#17](https://github.com/hzblj/kara-ui/pull/17) [`4c7eaa0`](https://github.com/hzblj/kara-ui/commit/4c7eaa021ee4a4b0475e1dfb420fa5803c21ba29) Thanks [@hzblj](https://github.com/hzblj)! - Android gets glass and a scroll edge of its own.
|
|
29
46
|
|
|
30
|
-
- `GlassView` is frosted glass on Android: what lies behind the capsule, blurred (Android 12+), under a translucent tonal surface
|
|
31
|
-
- `ScrollEdgeContainer` on Android behaves like a Material top app bar on scroll: the bars stay transparent at rest and fill with the scrolled container colour once content scrolls under the top one, the bottom one while there is more below. Its scroll view also takes the room between the bars now
|
|
32
|
-
- New token `surface.secondary`: Material's `surfaceContainer` on Android, `tertiarySystemGroupedBackgroundColor` on iOS
|
|
47
|
+
- `GlassView` is frosted glass on Android: what lies behind the capsule, blurred (Android 12+), under a translucent tonal surface (or its `tint`) and a light hairline, the blurred surfaces Android 16 gives its own system UI. It was an almost clear capsule that left its content unreadable over a photo. Below Android 12 the same colours are drawn near-opaque. kara-native's new `BackdropBlurView` (`/jetpack-compose`) does the blur (blurred, then saturated, as iOS lifts the colour under its materials): a plain view, no host, and an idle screen draws no frames.
|
|
48
|
+
- `ScrollEdgeContainer` on Android behaves like a Material top app bar on scroll: the bars stay transparent at rest and fill with the scrolled container colour once content scrolls under the top one, the bottom one while there is more below. Its scroll view also takes the room between the bars now; before, it grew to its content's height, ran under the bottom bar and could not scroll.
|
|
49
|
+
- New token `surface.secondary`, a step above `surface.primary`: Material's `surfaceContainer` on Android, `tertiarySystemGroupedBackgroundColor` on iOS.
|
|
33
50
|
|
|
34
|
-
- [#17](https://github.com/hzblj/kara-ui/pull/17) [`4c7eaa0`](https://github.com/hzblj/kara-ui/commit/4c7eaa021ee4a4b0475e1dfb420fa5803c21ba29) Thanks [@hzblj](https://github.com/hzblj)! - `Pressable` on Android presses the Material way: a ripple over the content
|
|
51
|
+
- [#17](https://github.com/hzblj/kara-ui/pull/17) [`4c7eaa0`](https://github.com/hzblj/kara-ui/commit/4c7eaa021ee4a4b0475e1dfb420fa5803c21ba29) Thanks [@hzblj](https://github.com/hzblj)! - `Pressable` on Android presses the Material way: a ripple over the content (the pressed state layer), clipped to the pressable's shape, and nothing scales. iOS keeps its spring to 96%. Give the `Pressable` the `borderRadius` of what it wraps (`full` around a `GlassView`) and the ripple follows it.
|
|
35
52
|
|
|
36
53
|
`Collapsible` on Android expands down from its row with a fade, and its chevron turns toward the content; it grew from a corner and the chevron jumped.
|
|
37
54
|
|
|
38
|
-
- [#17](https://github.com/hzblj/kara-ui/pull/17) [`4c7eaa0`](https://github.com/hzblj/kara-ui/commit/4c7eaa021ee4a4b0475e1dfb420fa5803c21ba29) Thanks [@hzblj](https://github.com/hzblj)! - New `BlurView`: the system materials, by SwiftUI's names
|
|
55
|
+
- [#17](https://github.com/hzblj/kara-ui/pull/17) [`4c7eaa0`](https://github.com/hzblj/kara-ui/commit/4c7eaa021ee4a4b0475e1dfb420fa5803c21ba29) Thanks [@hzblj](https://github.com/hzblj)! - New `BlurView`: the system materials, by SwiftUI's names (`ultraThin`, `thin`, `regular`, `thick`, `ultraThick`).
|
|
39
56
|
|
|
40
|
-
- iOS: UIKit's `system*Material` blur as a plain view
|
|
57
|
+
- iOS: UIKit's `system*Material` blur as a plain view (no SwiftUI host, cheap enough for a list cell), with `vibrancy` (`primary` to `quaternary`, `fill`, `separator`) to draw the content the way iOS draws its own on a material.
|
|
41
58
|
- Android: what lies behind, blurred and saturated (Android 12+), under a Material tonal surface that rises from `surface` to `surfaceContainerHighest` as the material thickens; below Android 12 the surface alone.
|
|
42
59
|
- `appearance` pins a material to light or dark whatever the app's; `borderRadius` shapes it and clips the content.
|
|
43
60
|
|
|
@@ -45,8 +62,8 @@
|
|
|
45
62
|
|
|
46
63
|
- [#17](https://github.com/hzblj/kara-ui/pull/17) [`4c7eaa0`](https://github.com/hzblj/kara-ui/commit/4c7eaa021ee4a4b0475e1dfb420fa5803c21ba29) Thanks [@hzblj](https://github.com/hzblj)! - `sx` reaches the components that still took raw styles or none:
|
|
47
64
|
|
|
48
|
-
- `Text` takes the native `sx` surface
|
|
49
|
-
- `RnText` takes `Box`'s `sx` props for its own box
|
|
65
|
+
- `Text` takes the native `sx` surface: padding, a background, a frame (`wide` puts the text on the side `align` names) and the `ios` bucket. `ios.contentTransition` with the new `ios.animation` rolls a number to its next value, and `ios.monospacedDigit` keeps it from shifting what follows. `Stepper` on iOS is built on it.
|
|
66
|
+
- `RnText` takes `Box`'s `sx` props for its own box (margins, `flex`, padding), all but `align`, which still aligns its lines.
|
|
50
67
|
- `Image` is `sx(expo-image)`, the way `Box` is `sx(View)`: `w`, `h`, `aspectRatio`, `borderRadius`, `position`… instead of a `style` object. Its props are exported as `ImageProps`.
|
|
51
68
|
- `Island` takes the same `sx` props for where it sits in React Native layout: `<Island h={240} matchContents={false}>`. An explicit `style` still wins.
|
|
52
69
|
- `Skeleton` is sized with the `sx` names, `h` and `w` (was `height` and `width`), and `w` takes a percentage: `<Skeleton h={12} w="60%" />` for a line that ends early.
|
|
@@ -63,7 +80,7 @@
|
|
|
63
80
|
|
|
64
81
|
### Minor Changes
|
|
65
82
|
|
|
66
|
-
- [#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
|
|
83
|
+
- [#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:
|
|
67
84
|
|
|
68
85
|
```tsx
|
|
69
86
|
<SwipeActions
|
|
@@ -75,33 +92,33 @@
|
|
|
75
92
|
</SwipeActions>
|
|
76
93
|
```
|
|
77
94
|
|
|
78
|
-
iOS renders SwiftUI's `swipeActions`, each action its icon on a button in its tint
|
|
95
|
+
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.
|
|
79
96
|
|
|
80
|
-
- [#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
|
|
97
|
+
- [#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.
|
|
81
98
|
|
|
82
|
-
- [#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
|
|
99
|
+
- [#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.
|
|
83
100
|
|
|
84
101
|
`TooltipBox` (`@hzblj/kara-native/jetpack-compose`) takes `plain` for that style, and hides when `isPresented` turns false.
|
|
85
102
|
|
|
86
103
|
### Patch Changes
|
|
87
104
|
|
|
88
|
-
- [#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
|
|
105
|
+
- [#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.
|
|
89
106
|
|
|
90
107
|
`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`.
|
|
91
108
|
|
|
92
109
|
- [#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:
|
|
93
110
|
|
|
94
|
-
- `Screen` keeps its content clear of the status bar when nothing sits above it, as a SwiftUI host keeps to the safe area
|
|
95
|
-
- `Form` is inset from its container on every side, with section titles and footers indented to the cards' content, like SwiftUI's grouped form
|
|
111
|
+
- `Screen` keeps its content clear of the status bar when nothing sits above it, as a SwiftUI host keeps to the safe area; it used to draw under it. Under a navigation bar nothing changes; the background still runs to the edges.
|
|
112
|
+
- `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 used to run into the screen's edges.
|
|
96
113
|
- 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.
|
|
97
114
|
|
|
98
|
-
- [#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
|
|
115
|
+
- [#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.
|
|
99
116
|
|
|
100
|
-
- [#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`
|
|
117
|
+
- [#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.
|
|
101
118
|
|
|
102
119
|
- [#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.
|
|
103
120
|
|
|
104
|
-
- [#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
|
|
121
|
+
- [#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.
|
|
105
122
|
|
|
106
123
|
- 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)]:
|
|
107
124
|
- @hzblj/kara-native@0.7.0
|
|
@@ -114,13 +131,13 @@
|
|
|
114
131
|
|
|
115
132
|
- [#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.
|
|
116
133
|
|
|
117
|
-
- `haptics.success()`, `haptics.selection()`, …
|
|
118
|
-
- iOS: UIKit's feedback generators, kept alive and warmed up with `haptics.prepare`
|
|
134
|
+
- One function per haptic (`haptics.success()`, `haptics.selection()`, …) 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.
|
|
135
|
+
- 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.
|
|
119
136
|
- `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.
|
|
120
137
|
- `haptics.setEnabled(false)` silences every kara haptic, the components' own included.
|
|
121
138
|
- `Pressable`'s `haptic` takes a name as well as `true` (a `light` impact); `Chip` plays `selection`.
|
|
122
139
|
- 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.
|
|
123
|
-
- `Slider`: `step` is the increment on Android too
|
|
140
|
+
- `Slider`: `step` is the increment on Android too. It was passed to Compose as the number of stops.
|
|
124
141
|
- `expo-haptics` is no longer a peer dependency.
|
|
125
142
|
|
|
126
143
|
### Patch Changes
|
|
@@ -181,7 +198,7 @@
|
|
|
181
198
|
|
|
182
199
|
### Minor Changes
|
|
183
200
|
|
|
184
|
-
- [`f84ffd5`](https://github.com/hzblj/kara-ui/commit/f84ffd52954a5e7052541c8682787137de205a28) Thanks [@hzblj](https://github.com/hzblj)! - Native sheets with a native header. `Sheet` is now a TrueSheet (`@lodev09/react-native-true-sheet`, a new peer dependency) with `<Sheet.Header>`
|
|
201
|
+
- [`f84ffd5`](https://github.com/hzblj/kara-ui/commit/f84ffd52954a5e7052541c8682787137de205a28) Thanks [@hzblj](https://github.com/hzblj)! - Native sheets with a native header. `Sheet` is now a TrueSheet (`@lodev09/react-native-true-sheet`, a new peer dependency) with `<Sheet.Header>`, `<Sheet.ScrollView>`, `useSheetScroll`, detents, a footer and a ref (`present`/`dismiss`/`resize`). `<Sheet.Header>` is a real navigation bar with a centred, leading or large title that hands over to the bar as it scrolls away, items on either side, and on iOS 26 the content scrolls under it with the soft edge effect. It is React Native tier now: no host, native atoms inside go in an `Island`. `fitToContents` is replaced by `detents` (`['auto']` by default).
|
|
185
202
|
|
|
186
203
|
`NavigationBar` takes `leadingItems` / `trailingItems` instead of `onBack` / `onClose`: `back`, `close` or an app `icon`, on either side and in any order; on iOS 26 neighbours share a glass capsule unless an item is `separated`. Also `titleAlignment`, `titleVisible`, `inverted` and an iOS `search` field. On Android it is now Material's native top app bar.
|
|
187
204
|
|
|
@@ -209,12 +226,12 @@
|
|
|
209
226
|
|
|
210
227
|
- [`c30bef6`](https://github.com/hzblj/kara-ui/commit/c30bef6be2639deb6d385ad209d1a2799b5b656f) Thanks [@hzblj](https://github.com/hzblj)! - Icons are now fully native and the app's own: `plugins: [['@hzblj/kara-ui', {icons: {source: './assets/icons'}}]]` turns every SVG in the folder into an iOS asset-catalog template image and an Android vector drawable at prebuild (`x.ios.svg` / `x.android.svg` for per-platform glyphs), and writes `kara-icons.d.ts` so `name` only accepts icons that exist; `npx kara-icons` does the same for CI. `Icon` draws them in a host, the new `RnIcon` anywhere, and `Tabs` passes them as `xcasset` / `drawable`. The built-in SF Symbol / Material icon names and the `@expo/vector-icons` peer dependency are gone.
|
|
211
228
|
|
|
212
|
-
- [`c30bef6`](https://github.com/hzblj/kara-ui/commit/c30bef6be2639deb6d385ad209d1a2799b5b656f) Thanks [@hzblj](https://github.com/hzblj)! - Leaner, reusable-only components. `Countdown` is gone, with its native views. There is one `ContextMenu` now
|
|
229
|
+
- [`c30bef6`](https://github.com/hzblj/kara-ui/commit/c30bef6be2639deb6d385ad209d1a2799b5b656f) Thanks [@hzblj](https://github.com/hzblj)! - Leaner, reusable-only components. `Countdown` is gone, with its native views. There is one `ContextMenu` now: the native module's long-press menu on React Native content, with a custom preview on iOS (formerly `RnContextMenu`); the `@expo/ui`-based one is removed.
|
|
213
230
|
|
|
214
231
|
Android, reworked to look and behave like Material while honouring the theme:
|
|
215
232
|
|
|
216
233
|
- `Button`, `Badge` and `Alert` render their labels; `Button` keeps Material's own shape (no iOS ring), takes `tint` as its fill with a label that contrasts with it, and draws `glass` as Material's outlined button.
|
|
217
|
-
- `Alert` is built from `AlertDialog`'s slots
|
|
234
|
+
- `Alert` is built from `AlertDialog`'s slots instead of drawing empty: title, message, the confirm action (destructive when asked) and Cancel.
|
|
218
235
|
- `Menu` presents its actions in Material's dropdown popup, with their icons, instead of laying them out over the trigger.
|
|
219
236
|
- `Picker` is a themed Material exposed dropdown the width of its container.
|
|
220
237
|
- `Switch`, `Checkbox` and `RadioGroup` are tinted with the accent, and with a label are full-width rows that toggle as a whole; `Form` sections span the form's width.
|
|
@@ -232,7 +249,7 @@
|
|
|
232
249
|
|
|
233
250
|
### Minor Changes
|
|
234
251
|
|
|
235
|
-
- [`f919c7b`](https://github.com/hzblj/kara-ui/commit/f919c7b06f3798cebd58eef1581076bf1ee61cd1) Thanks [@hzblj](https://github.com/hzblj)! - First release of the kara-ui design system: theme and tokens, the `sx` engine, atoms, molecules, organisms and `Screen`, native tabs (`@hzblj/kara-ui/router`), the KaraUI native module (Liquid Glass, scroll edge effect, native countdown, context menu with preview, rich tooltip, FAB menu), and `KaraProvider` with theme overrides
|
|
252
|
+
- [`f919c7b`](https://github.com/hzblj/kara-ui/commit/f919c7b06f3798cebd58eef1581076bf1ee61cd1) Thanks [@hzblj](https://github.com/hzblj)! - First release of the kara-ui design system: theme and tokens, the `sx` engine, atoms, molecules, organisms and `Screen`, native tabs (`@hzblj/kara-ui/router`), the KaraUI native module (Liquid Glass, scroll edge effect, native countdown, context menu with preview, rich tooltip, FAB menu), and `KaraProvider` with theme overrides (colours, the app's own fonts, the Material seed, and Material You dynamic colour on Android). Text uses the platform's face by default. Install `@hzblj/kara-ui`; the scoped packages are its building blocks.
|
|
236
253
|
|
|
237
254
|
### Patch Changes
|
|
238
255
|
|
package/README.md
CHANGED
|
@@ -8,25 +8,25 @@
|
|
|
8
8
|
[license-badge]: https://img.shields.io/badge/license-MIT-ff5700?labelColor=27272a
|
|
9
9
|
[license-url]: https://github.com/hzblj/kara-ui/blob/main/LICENSE
|
|
10
10
|
|
|
11
|
-
<a href="https://www.kara.janblazej.dev"><img src="https://www.kara.janblazej.dev/og.png" alt="Kara
|
|
11
|
+
<a href="https://www.kara.janblazej.dev"><img src="https://www.kara.janblazej.dev/og.png" alt="Kara, native UI for Expo: real SwiftUI and Jetpack Compose views" width="720"></a>
|
|
12
12
|
|
|
13
|
-
The components of [Kara UI](https://www.kara.janblazej.dev)
|
|
13
|
+
The components of [Kara UI](https://www.kara.janblazej.dev), a native-first design system for Expo.
|
|
14
14
|
|
|
15
15
|
> **Install [`@hzblj/kara-ui`](https://www.npmjs.com/package/@hzblj/kara-ui) instead.** This package is one of its
|
|
16
16
|
> building blocks, published so its types resolve; everything here is re-exported from `@hzblj/kara-ui`.
|
|
17
17
|
|
|
18
18
|
## What's inside
|
|
19
19
|
|
|
20
|
-
- **Native components
|
|
20
|
+
- **Native components**: real SwiftUI views on iOS and Jetpack Compose on Android, through `@expo/ui`. A `Switch` is
|
|
21
21
|
a SwiftUI `Toggle` on one and a Material `Switch` on the other.
|
|
22
|
-
- **`Screen` and `Island
|
|
23
|
-
- **The React Native tier
|
|
24
|
-
`sx` props, for long lists and for content around the native islands.
|
|
25
|
-
- **Haptics
|
|
22
|
+
- **`Screen` and `Island`**: the hosts native views render in.
|
|
23
|
+
- **The React Native tier**: `RnView`, `RnText`, `RnScrollView` and the rest are plain React Native views with the
|
|
24
|
+
same `sx` props, for long lists and for content around the native islands.
|
|
25
|
+
- **Haptics**: the platform's own feedback, named for what happened.
|
|
26
26
|
|
|
27
27
|
## Documentation
|
|
28
28
|
|
|
29
|
-
- [Components](https://www.kara.janblazej.dev/docs/components)
|
|
29
|
+
- [Components](https://www.kara.janblazej.dev/docs/components): every one on iOS and Android, with its props
|
|
30
30
|
- [Screen and Island](https://www.kara.janblazej.dev/docs/hosts)
|
|
31
31
|
- [Haptics](https://www.kara.janblazej.dev/docs/haptics)
|
|
32
32
|
|
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { ColorWell } from '@hzblj/kara-native/jetpack-compose';
|
|
4
|
+
import { useHostGuard } from "../../host-context.js";
|
|
5
|
+
import { HStack } from "../h-stack/index.js";
|
|
6
|
+
import { Spacer } from "../spacer/index.js";
|
|
7
|
+
import { Text } from "../text/index.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* The row SwiftUI's `ColorPicker` lays out on iOS, the label leading and the well trailing, around kara's own Compose
|
|
11
|
+
* well: Compose ships no colour picker, so the sheet behind it draws the iOS picker's grid, spectrum and sliders.
|
|
12
|
+
*/
|
|
13
|
+
export const ColorPicker = ({
|
|
14
|
+
label,
|
|
15
|
+
onValueChange,
|
|
16
|
+
supportsOpacity = false,
|
|
17
|
+
testID,
|
|
18
|
+
value
|
|
19
|
+
}) => {
|
|
20
|
+
useHostGuard('ColorPicker');
|
|
21
|
+
return /*#__PURE__*/_jsxs(HStack, {
|
|
22
|
+
align: "center",
|
|
23
|
+
spacing: "s12",
|
|
24
|
+
testID: testID,
|
|
25
|
+
wide: true,
|
|
26
|
+
children: [label ? /*#__PURE__*/_jsx(Text, {
|
|
27
|
+
children: label
|
|
28
|
+
}) : null, /*#__PURE__*/_jsx(Spacer, {}), /*#__PURE__*/_jsx(ColorWell, {
|
|
29
|
+
onValueChange: onValueChange,
|
|
30
|
+
supportsOpacity: supportsOpacity,
|
|
31
|
+
title: label,
|
|
32
|
+
value: value
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
8
35
|
};
|
|
9
36
|
//# sourceMappingURL=color-picker.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ColorWell","useHostGuard","HStack","Spacer","Text","jsx","_jsx","jsxs","_jsxs","ColorPicker","label","onValueChange","supportsOpacity","testID","value","align","spacing","wide","children","title"],"sourceRoot":"../../../../src","sources":["atoms/color-picker/color-picker.android.tsx"],"mappings":";;AAAA,SAAQA,SAAS,QAAO,oCAAoC;AAE5D,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,MAAM,QAAO,qBAAY;AACjC,SAAQC,MAAM,QAAO,oBAAW;AAChC,SAAQC,IAAI,QAAO,kBAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG5B;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAiC,GAAGA,CAAC;EAChDC,KAAK;EACLC,aAAa;EACbC,eAAe,GAAG,KAAK;EACvBC,MAAM;EACNC;AACgB,CAAC,KAAK;EACtBb,YAAY,CAAC,aAAa,CAAC;EAE3B,oBACEO,KAAA,CAACN,MAAM;IAACa,KAAK,EAAC,QAAQ;IAACC,OAAO,EAAC,KAAK;IAACH,MAAM,EAAEA,MAAO;IAACI,IAAI;IAAAC,QAAA,GACtDR,KAAK,gBAAGJ,IAAA,CAACF,IAAI;MAAAc,QAAA,EAAER;IAAK,CAAO,CAAC,GAAG,IAAI,eACpCJ,IAAA,CAACH,MAAM,IAAE,CAAC,eACVG,IAAA,CAACN,SAAS;MAACW,aAAa,EAAEA,aAAc;MAACC,eAAe,EAAEA,eAAgB;MAACO,KAAK,EAAET,KAAM;MAACI,KAAK,EAAEA;IAAM,CAAE,CAAC;EAAA,CACnG,CAAC;AAEb,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Button } from '@expo/ui/swift-ui';
|
|
4
|
-
import { buttonStyle, disabled as disabledModifier } from '@expo/ui/swift-ui/modifiers';
|
|
4
|
+
import { buttonStyle, contentShape, disabled as disabledModifier, shapes } from '@expo/ui/swift-ui/modifiers';
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
import { useHostGuard } from "../../host-context.js";
|
|
7
7
|
import { Icon } from "../icon/index.js";
|
|
8
|
+
import { ZStack } from "../z-stack/index.js";
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/** Apple's least tap target. Android's `IconButton` is Material's 48dp; this is the same idea in points. */
|
|
11
|
+
const TARGET = 44;
|
|
12
|
+
|
|
13
|
+
/** The whole square takes the tap, not only the glyph's own pixels. */
|
|
14
|
+
const WHOLE_TARGET = {
|
|
15
|
+
modifiers: [contentShape(shapes.circle())]
|
|
16
|
+
};
|
|
9
17
|
export const IconButton = ({
|
|
10
18
|
disabled = false,
|
|
11
19
|
name,
|
|
@@ -24,9 +32,14 @@ export const IconButton = ({
|
|
|
24
32
|
modifiers: modifiers,
|
|
25
33
|
onPress: onPress,
|
|
26
34
|
testID: testID,
|
|
27
|
-
children: /*#__PURE__*/_jsx(
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
children: /*#__PURE__*/_jsx(ZStack, {
|
|
36
|
+
h: TARGET,
|
|
37
|
+
ios: WHOLE_TARGET,
|
|
38
|
+
w: TARGET,
|
|
39
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
40
|
+
color: "content.primary",
|
|
41
|
+
name: name
|
|
42
|
+
})
|
|
30
43
|
})
|
|
31
44
|
});
|
|
32
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","buttonStyle","disabled","disabledModifier","useMemo","useHostGuard","Icon","jsx","_jsx","IconButton","name","onPress","testID","
|
|
1
|
+
{"version":3,"names":["Button","buttonStyle","contentShape","disabled","disabledModifier","shapes","useMemo","useHostGuard","Icon","ZStack","jsx","_jsx","TARGET","WHOLE_TARGET","modifiers","circle","IconButton","name","onPress","testID","list","push","children","h","ios","w","color"],"sourceRoot":"../../../../src","sources":["atoms/icon-button/icon-button.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,mBAAmB;AACxC,SAAQC,WAAW,EAAEC,YAAY,EAAEC,QAAQ,IAAIC,gBAAgB,EAAEC,MAAM,QAAO,6BAA6B;AAC3G,SAAQC,OAAO,QAAO,OAAO;AAE7B,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,IAAI,QAAO,kBAAS;AAC5B,SAAQC,MAAM,QAAO,qBAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGjC;AACA,MAAMC,MAAM,GAAG,EAAE;;AAEjB;AACA,MAAMC,YAAY,GAAG;EAACC,SAAS,EAAE,CAACZ,YAAY,CAACG,MAAM,CAACU,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC;AAEjE,OAAO,MAAMC,UAA+B,GAAGA,CAAC;EAACb,QAAQ,GAAG,KAAK;EAAEc,IAAI;EAAEC,OAAO;EAAEC;AAAuB,CAAC,KAAK;EAC7GZ,YAAY,CAAC,YAAY,CAAC;EAE1B,MAAMO,SAAS,GAAGR,OAAO,CAAC,MAAM;IAC9B,MAAMc,IAAI,GAAG,CAACnB,WAAW,CAAC,OAAO,CAAC,CAAC;IAEnC,IAAIE,QAAQ,EAAE;MACZiB,IAAI,CAACC,IAAI,CAACjB,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC;IAEA,OAAOgB,IAAI;EACb,CAAC,EAAE,CAACjB,QAAQ,CAAC,CAAC;EAEd,oBACEQ,IAAA,CAACX,MAAM;IAACc,SAAS,EAAEA,SAAU;IAACI,OAAO,EAAEA,OAAQ;IAACC,MAAM,EAAEA,MAAO;IAAAG,QAAA,eAC7DX,IAAA,CAACF,MAAM;MAACc,CAAC,EAAEX,MAAO;MAACY,GAAG,EAAEX,YAAa;MAACY,CAAC,EAAEb,MAAO;MAAAU,QAAA,eAE9CX,IAAA,CAACH,IAAI;QAACkB,KAAK,EAAC,iBAAiB;QAACT,IAAI,EAAEA;MAAK,CAAE;IAAC,CACtC;EAAC,CACH,CAAC;AAEb,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useSplitSx } from '@hzblj/kara-sx';
|
|
4
|
-
import { useAppTheme, withOpacity } from '@hzblj/kara-theme';
|
|
4
|
+
import { duration, opacity, useAppTheme, withOpacity } from '@hzblj/kara-theme';
|
|
5
5
|
import { useCallback, useMemo } from 'react';
|
|
6
|
-
import { Platform, Pressable as RNPressable
|
|
7
|
-
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated';
|
|
6
|
+
import { Platform, Pressable as RNPressable } from 'react-native';
|
|
7
|
+
import Animated, { useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
8
8
|
import { haptics } from "../../haptics/index.js";
|
|
9
9
|
import { splitForRipple } from "../../ripple-clip.js";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -12,48 +12,70 @@ const SPRING = {
|
|
|
12
12
|
damping: 20,
|
|
13
13
|
stiffness: 400
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
/** A dim comes in quickly and leaves a little slower, as UIKit's own highlight does. */
|
|
17
|
+
const DIM_IN = {
|
|
18
|
+
duration: duration.d100
|
|
19
|
+
};
|
|
20
|
+
const DIM_OUT = {
|
|
21
|
+
duration: duration.d200
|
|
22
|
+
};
|
|
23
|
+
const PLATFORM_EFFECT = Platform.OS === 'ios' ? 'scale' : 'none';
|
|
15
24
|
const AnimatedPressable = Animated.createAnimatedComponent(RNPressable);
|
|
16
25
|
export const Pressable = ({
|
|
17
26
|
children,
|
|
18
27
|
disabled = false,
|
|
19
28
|
haptic = false,
|
|
20
29
|
onPress,
|
|
30
|
+
pressEffect = PLATFORM_EFFECT,
|
|
31
|
+
pressedOpacity = 'o60',
|
|
32
|
+
pressedScale = 0.96,
|
|
33
|
+
ripple: withRipple = true,
|
|
21
34
|
testID,
|
|
22
35
|
...props
|
|
23
36
|
}) => {
|
|
24
37
|
const [resolved, rest] = useSplitSx(props);
|
|
25
|
-
|
|
38
|
+
// 0 at rest, 1 held: one value drives whichever effect is picked, so a change of effect needs no second animation.
|
|
39
|
+
const pressed = useSharedValue(0);
|
|
26
40
|
const feedback = haptic === true ? 'light' : haptic || undefined;
|
|
41
|
+
const dimmed = opacity[pressedOpacity];
|
|
27
42
|
const theme = useAppTheme();
|
|
28
43
|
const isAndroid = Platform.OS === 'android';
|
|
29
|
-
const rStyle = useAnimatedStyle(() =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
const rStyle = useAnimatedStyle(() => {
|
|
45
|
+
if (pressEffect === 'scale') {
|
|
46
|
+
return {
|
|
47
|
+
transform: [{
|
|
48
|
+
scale: 1 - (1 - pressedScale) * pressed.value
|
|
49
|
+
}]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return pressEffect === 'opacity' ? {
|
|
53
|
+
opacity: 1 - (1 - dimmed) * pressed.value
|
|
54
|
+
} : {};
|
|
55
|
+
}, [dimmed, pressEffect, pressedScale]);
|
|
34
56
|
|
|
35
|
-
// Android's press is Material's: a ripple over the content
|
|
36
|
-
// the shape by an outer view (`splitForRipple`),
|
|
37
|
-
const ripple = useMemo(() => isAndroid ? {
|
|
57
|
+
// Android's press is Material's: a ripple over the content (the pressed state layer, `onSurface` at 10 %) clipped to
|
|
58
|
+
// the shape by an outer view (`splitForRipple`). The effect, when there is one, moves that outer view, ripple and all.
|
|
59
|
+
const ripple = useMemo(() => isAndroid && withRipple ? {
|
|
38
60
|
color: withOpacity(String(theme.color('content.primary')), 'o10'),
|
|
39
61
|
foreground: true
|
|
40
|
-
} : undefined, [isAndroid, theme]);
|
|
62
|
+
} : undefined, [isAndroid, theme, withRipple]);
|
|
41
63
|
const androidStyle = useMemo(() => isAndroid ? splitForRipple(resolved) : undefined, [isAndroid, resolved]);
|
|
42
64
|
|
|
43
65
|
// The finger is down: the Taptic Engine has until the release to wake, so the haptic lands with the press.
|
|
44
66
|
const onPressIn = useCallback(() => {
|
|
45
|
-
if (
|
|
46
|
-
|
|
67
|
+
if (pressEffect === 'scale') {
|
|
68
|
+
pressed.value = withSpring(1, SPRING);
|
|
69
|
+
} else if (pressEffect === 'opacity') {
|
|
70
|
+
pressed.value = withTiming(1, DIM_IN);
|
|
47
71
|
}
|
|
48
72
|
if (feedback) {
|
|
49
73
|
haptics.prepare(feedback);
|
|
50
74
|
}
|
|
51
|
-
}, [feedback,
|
|
75
|
+
}, [feedback, pressEffect, pressed]);
|
|
52
76
|
const onPressOut = useCallback(() => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
}, [isAndroid, scale]);
|
|
77
|
+
pressed.value = pressEffect === 'scale' ? withSpring(0, SPRING) : withTiming(0, DIM_OUT);
|
|
78
|
+
}, [pressEffect, pressed]);
|
|
57
79
|
const onPressWithHaptic = useCallback(() => {
|
|
58
80
|
if (feedback) {
|
|
59
81
|
haptics.play(feedback);
|
|
@@ -61,14 +83,15 @@ export const Pressable = ({
|
|
|
61
83
|
onPress?.();
|
|
62
84
|
}, [feedback, onPress]);
|
|
63
85
|
if (androidStyle) {
|
|
64
|
-
return /*#__PURE__*/_jsx(View, {
|
|
65
|
-
style: androidStyle.outer,
|
|
86
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
87
|
+
style: [androidStyle.outer, rStyle],
|
|
66
88
|
children: /*#__PURE__*/_jsx(RNPressable, {
|
|
67
89
|
android_ripple: ripple,
|
|
68
90
|
disabled: disabled,
|
|
69
91
|
hitSlop: 8,
|
|
70
92
|
onPress: onPressWithHaptic,
|
|
71
93
|
onPressIn: onPressIn,
|
|
94
|
+
onPressOut: onPressOut,
|
|
72
95
|
style: androidStyle.inner,
|
|
73
96
|
testID: testID,
|
|
74
97
|
...rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSplitSx","useAppTheme","withOpacity","useCallback","useMemo","Platform","Pressable","RNPressable","
|
|
1
|
+
{"version":3,"names":["useSplitSx","duration","opacity","useAppTheme","withOpacity","useCallback","useMemo","Platform","Pressable","RNPressable","Animated","useAnimatedStyle","useSharedValue","withSpring","withTiming","haptics","splitForRipple","jsx","_jsx","SPRING","damping","stiffness","DIM_IN","d100","DIM_OUT","d200","PLATFORM_EFFECT","OS","AnimatedPressable","createAnimatedComponent","children","disabled","haptic","onPress","pressEffect","pressedOpacity","pressedScale","ripple","withRipple","testID","props","resolved","rest","pressed","feedback","undefined","dimmed","theme","isAndroid","rStyle","transform","scale","value","color","String","foreground","androidStyle","onPressIn","prepare","onPressOut","onPressWithHaptic","play","View","style","outer","android_ripple","hitSlop","inner"],"sourceRoot":"../../../../src","sources":["atoms/pressable/pressable.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import type { ColorToken } from '@hzblj/kara-theme';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
export type ActivityIndicatorSize = 'large' | 'small';
|
|
4
4
|
/**
|
|
5
|
-
* That something is loading, for as long as it takes
|
|
5
|
+
* That something is loading, for as long as it takes: UIKit's spinner on iOS, Material 3's expressive
|
|
6
6
|
* `LoadingIndicator` on Android, its shapes morphing as it turns. A React Native view on iOS and a host of its own on
|
|
7
7
|
* Android, so it renders anywhere. For how far along something is, use `Progress`.
|
|
8
8
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ImageSourcePropType } from 'react-native';
|
|
3
3
|
export type AvatarSize = 'lg' | 'md' | 'sm';
|
|
4
|
-
/** A round avatar: the image in `source`, or `initials` without one. The React Native tier
|
|
4
|
+
/** A round avatar: the image in `source`, or `initials` without one. The React Native tier: it needs no host. */
|
|
5
5
|
export type AvatarProps = {
|
|
6
6
|
/** Shown in place of the image when there is no `source`. */
|
|
7
7
|
initials?: string;
|
|
8
|
-
/** The diameter
|
|
8
|
+
/** The diameter: `sm` is `s24`, `md` `s40`, `lg` `s64`. `md` by default. */
|
|
9
9
|
size?: AvatarSize;
|
|
10
10
|
/** The image, cropped to the circle. */
|
|
11
11
|
source?: ImageSourcePropType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
export type BadgeTone = 'accent' | 'destructive' | 'neutral' | 'success';
|
|
3
|
-
/** A small status label in a capsule
|
|
3
|
+
/** A small status label in a capsule: a SwiftUI `HStack` in the tone's fill on iOS, Material's `Badge` on Android. */
|
|
4
4
|
export type BadgeProps = {
|
|
5
5
|
/** The text inside. */
|
|
6
6
|
label: string;
|
|
@@ -3,16 +3,16 @@ import type { ResponsiveViewSx } from '@hzblj/kara-sx';
|
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
export type { BlurMaterial, BlurVibrancy } from '@hzblj/kara-native/swift-ui';
|
|
5
5
|
/**
|
|
6
|
-
* One of the system's materials
|
|
6
|
+
* One of the system's materials (what sheets, bars, menus and HUDs are made of) behind React Native content, in
|
|
7
7
|
* SwiftUI's five thicknesses. iOS: UIKit's `system*Material` blur, with optional vibrancy for the content. Android:
|
|
8
|
-
* what lies behind, blurred and saturated (Android 12+), under a Material tonal surface as thick as the material
|
|
9
|
-
* `surface` at `ultraThin` up to `surfaceContainerHighest` at `ultraThick
|
|
8
|
+
* what lies behind, blurred and saturated (Android 12+), under a Material tonal surface as thick as the material
|
|
9
|
+
* (`surface` at `ultraThin` up to `surfaceContainerHighest` at `ultraThick`); below Android 12 the surface alone. The
|
|
10
10
|
* React Native tier: it needs no host, so it suits a list cell. Shape it with `borderRadius`; it clips its children.
|
|
11
11
|
*/
|
|
12
12
|
export type BlurViewProps = ResponsiveViewSx & {
|
|
13
13
|
/**
|
|
14
|
-
* Pins the material to light or dark whatever the app's appearance
|
|
15
|
-
* the app theme. Android draws the opposite appearance with Material's inverse surface.
|
|
14
|
+
* Pins the material to light or dark whatever the app's appearance (a dark HUD over a light screen). Unset, it
|
|
15
|
+
* follows the app theme. Android draws the opposite appearance with Material's inverse surface.
|
|
16
16
|
*/
|
|
17
17
|
appearance?: 'dark' | 'light';
|
|
18
18
|
/** React Native content, over the material. */
|
|
@@ -22,7 +22,7 @@ export type BlurViewProps = ResponsiveViewSx & {
|
|
|
22
22
|
/** Test identifier, forwarded to the view. */
|
|
23
23
|
testID?: string;
|
|
24
24
|
/**
|
|
25
|
-
* iOS: draws the children vibrant at this level, the way iOS draws its own labels and fills on a material
|
|
25
|
+
* iOS: draws the children vibrant at this level, the way iOS draws its own labels and fills on a material. Their
|
|
26
26
|
* colour becomes the material's vibrant one and their alpha the mask. Android has no vibrancy: the children keep
|
|
27
27
|
* their colours there.
|
|
28
28
|
*/
|
|
@@ -2,23 +2,23 @@ import type { ColorToken } from '@hzblj/kara-theme';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
export type ButtonVariant = 'accent' | 'destructive' | 'glass' | 'secondary';
|
|
4
4
|
/**
|
|
5
|
-
* SwiftUI `ButtonStyle`. iOS only
|
|
5
|
+
* SwiftUI `ButtonStyle`. iOS only: Compose has no equivalent, so Android ignores it and keeps
|
|
6
6
|
* rendering the variant's tokens.
|
|
7
7
|
*/
|
|
8
8
|
export type ButtonStyleName = 'automatic' | 'bordered' | 'borderedProminent' | 'borderless' | 'glass' | 'glassProminent' | 'plain';
|
|
9
9
|
/**
|
|
10
|
-
* SwiftUI `ControlSize`. iOS only, and it has no `automatic` member
|
|
10
|
+
* SwiftUI `ControlSize`. iOS only, and it has no `automatic` member: leave it unset to inherit
|
|
11
11
|
* whatever the surrounding SwiftUI environment provides.
|
|
12
12
|
*/
|
|
13
13
|
export type ButtonControlSize = 'extraLarge' | 'large' | 'mini' | 'regular' | 'small';
|
|
14
|
-
/** A text button
|
|
14
|
+
/** A text button: SwiftUI `Button` on iOS, Material's filled button (outlined for `glass`) on Android. */
|
|
15
15
|
export type ButtonProps = {
|
|
16
16
|
/**
|
|
17
|
-
* Replaces the style the variant picks
|
|
18
|
-
* `secondary`, `glass` for `glass`. iOS only
|
|
17
|
+
* Replaces the style the variant picks: `borderedProminent` for `accent` and `destructive`, `bordered` for
|
|
18
|
+
* `secondary`, `glass` for `glass`. iOS only. Android ignores it.
|
|
19
19
|
*/
|
|
20
20
|
buttonStyle?: ButtonStyleName;
|
|
21
|
-
/** SwiftUI's control size. `large` by default. iOS only
|
|
21
|
+
/** SwiftUI's control size. `large` by default. iOS only. Android ignores it. */
|
|
22
22
|
controlSize?: ButtonControlSize;
|
|
23
23
|
/** Draws the button in its disabled colours and stops it responding to presses. */
|
|
24
24
|
disabled?: boolean;
|
|
@@ -31,7 +31,7 @@ export type ButtonProps = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Overrides the variant's own tint. A prominent style takes it as the fill and picks a contrasting
|
|
33
33
|
* label. `glass` has to reach the material through `glassEffect` instead, so tinting one costs it
|
|
34
|
-
* the stock `.glass` style
|
|
34
|
+
* the stock `.glass` style (see the iOS implementation).
|
|
35
35
|
*/
|
|
36
36
|
tint?: ColorToken;
|
|
37
37
|
/** The look. `accent` by default. Material has no glass, so on Android `glass` is an outlined button. */
|