@hzblj/kara-ui 0.5.0 → 0.6.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 +25 -0
- package/README.md +3 -68
- package/package.json +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @hzblj/kara-ui
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
- `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.
|
|
10
|
+
- 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.
|
|
11
|
+
- `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.
|
|
12
|
+
- `haptics.setEnabled(false)` silences every kara haptic, the components' own included.
|
|
13
|
+
- `Pressable`'s `haptic` takes a name as well as `true` (a `light` impact); `Chip` plays `selection`.
|
|
14
|
+
- 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.
|
|
15
|
+
- `Slider`: `step` is the increment on Android too — it was passed to Compose as the number of stops.
|
|
16
|
+
- `expo-haptics` is no longer a peer dependency.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`62b7131`](https://github.com/hzblj/kara-ui/commit/62b713143bd03872ecdd89ca8de42d98fe589617)]:
|
|
21
|
+
- @hzblj/kara-native@0.6.0
|
|
22
|
+
- @hzblj/kara-components@0.6.0
|
|
23
|
+
- @hzblj/kara-router@0.6.0
|
|
24
|
+
- @hzblj/kara-theme@0.6.0
|
|
25
|
+
- @hzblj/kara-sx@0.6.0
|
|
26
|
+
- @hzblj/kara-expo-plugin@0.6.0
|
|
27
|
+
|
|
3
28
|
## 0.5.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@ iOS and Android, Expo SDK 57, development build required.
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npx expo install @hzblj/kara-ui @expo/ui @lodev09/react-native-true-sheet @shopify/flash-list expo-
|
|
12
|
-
npx expo install expo-router # optional, for
|
|
11
|
+
npx expo install @hzblj/kara-ui @expo/ui @lodev09/react-native-true-sheet @shopify/flash-list expo-image react-native-reanimated react-native-worklets
|
|
12
|
+
npx expo install expo-router # optional, for @hzblj/kara-ui/router
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Use
|
|
@@ -53,74 +53,9 @@ plugins: [['@hzblj/kara-ui', {icons: {source: './assets/icons'}}]]
|
|
|
53
53
|
|
|
54
54
|
Every SVG in the folder becomes a native icon at prebuild: `bolt.svg` → `<Icon name="bolt" />`.
|
|
55
55
|
|
|
56
|
-
## Sheets
|
|
57
|
-
|
|
58
|
-
```tsx
|
|
59
|
-
<Sheet onDismiss={close} visible={open}>
|
|
60
|
-
<Sheet.Header title="Choose a size" trailingItems={[{type: 'close', onPress: close}]} />
|
|
61
|
-
<Content />
|
|
62
|
-
</Sheet>
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
The header is a real navigation bar: `back`, `close` and icon items on either side, a centred, leading or large title.
|
|
66
|
-
|
|
67
|
-
## Zoom transition
|
|
68
|
-
|
|
69
|
-
A push that grows out of the photo it was opened from and shrinks back into it — UIKit's zoom on iOS 18 (a slide
|
|
70
|
-
below), Material's container transform on Android. Any Expo Router stack screen.
|
|
71
|
-
|
|
72
|
-
```tsx
|
|
73
|
-
import {
|
|
74
|
-
useZoomTransitionParam,
|
|
75
|
-
useZoomTransitionSourceId,
|
|
76
|
-
withZoomTransition,
|
|
77
|
-
ZOOM_TRANSITION_PARAM,
|
|
78
|
-
ZoomTransition,
|
|
79
|
-
} from '@hzblj/kara-ui/router'
|
|
80
|
-
|
|
81
|
-
// The list
|
|
82
|
-
const zoomId = useZoomTransitionSourceId(product.id)
|
|
83
|
-
const open = () => router.push({pathname: '/product/[id]', params: {id: product.id, [ZOOM_TRANSITION_PARAM]: zoomId}})
|
|
84
|
-
|
|
85
|
-
<Pressable onPress={open}>
|
|
86
|
-
<ZoomTransition.Source identifier={zoomId} android={{borderRadius: 'large'}}>
|
|
87
|
-
<ProductPhoto />
|
|
88
|
-
</ZoomTransition.Source>
|
|
89
|
-
</Pressable>
|
|
90
|
-
|
|
91
|
-
// The pushed screen — the enabler first, before any loading state
|
|
92
|
-
const zoomId = useZoomTransitionParam()
|
|
93
|
-
|
|
94
|
-
<ZoomTransition.Enabler sourceIdentifier={zoomId} />
|
|
95
|
-
<ZoomTransition.Target identifier={zoomId} android={{borderRadius: 'large'}}>
|
|
96
|
-
<ProductPhoto />
|
|
97
|
-
</ZoomTransition.Target>
|
|
98
|
-
|
|
99
|
-
// Its layout: on Android the push fades under the transform
|
|
100
|
-
<Stack.Screen name="product/[id]" options={withZoomTransition({title: 'Product'})} />
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Props at the top work on both platforms; the rest is typed apart under `ios` and `android`:
|
|
104
|
-
|
|
105
|
-
```tsx
|
|
106
|
-
<ZoomTransition.Enabler
|
|
107
|
-
sourceIdentifier={zoomId}
|
|
108
|
-
scrim="fill.accent.primary:o20"
|
|
109
|
-
ios={{dismissGesture: 'vertical', blur: 'thin'}}
|
|
110
|
-
android={{duration: 'd300', easing: 'standard', fade: 'through', path: 'linear'}}
|
|
111
|
-
/>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Inside a `ContextMenu`, a tap on the iOS preview zooms the preview's photo straight into the pushed screen
|
|
115
|
-
(`previewTransition` picks `zoom`, `pop` or `dismiss`).
|
|
116
|
-
|
|
117
|
-
On iOS 18+ react-native-screens (4.30 and older) reports a zoom pop ~0.5 s late, so a tap right after it is lost —
|
|
118
|
-
[react-native-screens#4711](https://github.com/software-mansion/react-native-screens/issues/4711); the example app
|
|
119
|
-
carries the fix as a Yarn patch (`.yarn/patches/` in the repo).
|
|
120
|
-
|
|
121
56
|
## Entry points
|
|
122
57
|
|
|
123
|
-
`@hzblj/kara-ui` (everything), `@hzblj/kara-ui/router` (
|
|
58
|
+
`@hzblj/kara-ui` (everything), `@hzblj/kara-ui/router` (what needs Expo Router), `@hzblj/kara-ui/swift-ui` and
|
|
124
59
|
`@hzblj/kara-ui/jetpack-compose` (the raw native views).
|
|
125
60
|
|
|
126
61
|
[Example app and source](https://github.com/hzblj/kara-ui) · MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzblj/kara-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A native-first design system for Expo: real SwiftUI and Jetpack Compose views through @expo/ui, styled by one token-typed sx engine.",
|
|
5
5
|
"author": "Jan Blazej",
|
|
6
6
|
"license": "MIT",
|
|
@@ -87,19 +87,18 @@
|
|
|
87
87
|
]
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@hzblj/kara-components": "^0.
|
|
91
|
-
"@hzblj/kara-expo-plugin": "^0.
|
|
92
|
-
"@hzblj/kara-native": "^0.
|
|
93
|
-
"@hzblj/kara-router": "^0.
|
|
94
|
-
"@hzblj/kara-sx": "^0.
|
|
95
|
-
"@hzblj/kara-theme": "^0.
|
|
90
|
+
"@hzblj/kara-components": "^0.6.0",
|
|
91
|
+
"@hzblj/kara-expo-plugin": "^0.6.0",
|
|
92
|
+
"@hzblj/kara-native": "^0.6.0",
|
|
93
|
+
"@hzblj/kara-router": "^0.6.0",
|
|
94
|
+
"@hzblj/kara-sx": "^0.6.0",
|
|
95
|
+
"@hzblj/kara-theme": "^0.6.0"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"@expo/ui": "~57.0.0",
|
|
99
99
|
"@lodev09/react-native-true-sheet": ">=3.11.0",
|
|
100
100
|
"@shopify/flash-list": ">=2.0.0",
|
|
101
101
|
"expo": "~57.0.0",
|
|
102
|
-
"expo-haptics": "*",
|
|
103
102
|
"expo-image": "*",
|
|
104
103
|
"expo-router": "*",
|
|
105
104
|
"react": "*",
|
|
@@ -117,7 +116,6 @@
|
|
|
117
116
|
"@shopify/flash-list": "^2.3.2",
|
|
118
117
|
"@types/react": "~19.2.18",
|
|
119
118
|
"expo": "~57.0.22",
|
|
120
|
-
"expo-haptics": "~57.0.3",
|
|
121
119
|
"expo-image": "~57.0.5",
|
|
122
120
|
"expo-router": "~57.0.21",
|
|
123
121
|
"react": "19.2.3",
|