@hzblj/kara-components 0.7.0 → 0.9.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 +59 -0
- package/README.md +5 -5
- package/lib/module/atoms/activity-indicator/activity-indicator.android.js +42 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.android.js.map +1 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.ios.js +19 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.ios.js.map +1 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.types.js +4 -0
- package/lib/module/atoms/activity-indicator/activity-indicator.types.js.map +1 -0
- package/lib/module/atoms/activity-indicator/index.js +2 -1
- package/lib/module/atoms/activity-indicator/index.js.map +1 -1
- package/lib/module/atoms/avatar/avatar.js +2 -4
- package/lib/module/atoms/avatar/avatar.js.map +1 -1
- package/lib/module/atoms/blur-view/blur-view.android.js +100 -0
- package/lib/module/atoms/blur-view/blur-view.android.js.map +1 -0
- package/lib/module/atoms/blur-view/blur-view.ios.js +43 -0
- package/lib/module/atoms/blur-view/blur-view.ios.js.map +1 -0
- package/lib/module/atoms/blur-view/blur-view.types.js +4 -0
- package/lib/module/atoms/blur-view/blur-view.types.js.map +1 -0
- package/lib/module/atoms/blur-view/index.js +5 -0
- package/lib/module/atoms/blur-view/index.js.map +1 -0
- package/lib/module/atoms/glass-view/glass-view.android.js +36 -5
- package/lib/module/atoms/glass-view/glass-view.android.js.map +1 -1
- package/lib/module/atoms/image/image.js +13 -6
- package/lib/module/atoms/image/image.js.map +1 -1
- package/lib/module/atoms/image/image.types.js +4 -0
- package/lib/module/atoms/image/image.types.js.map +1 -0
- package/lib/module/atoms/image/index.js +1 -0
- package/lib/module/atoms/image/index.js.map +1 -1
- package/lib/module/atoms/index.js +1 -0
- package/lib/module/atoms/index.js.map +1 -1
- package/lib/module/atoms/island/island.android.js +6 -2
- package/lib/module/atoms/island/island.android.js.map +1 -1
- package/lib/module/atoms/island/island.ios.js +5 -2
- package/lib/module/atoms/island/island.ios.js.map +1 -1
- package/lib/module/atoms/pressable/pressable.js +38 -6
- package/lib/module/atoms/pressable/pressable.js.map +1 -1
- package/lib/module/atoms/progress/progress.ios.js +10 -4
- package/lib/module/atoms/progress/progress.ios.js.map +1 -1
- package/lib/module/atoms/rn-text/rn-text.js +5 -2
- package/lib/module/atoms/rn-text/rn-text.js.map +1 -1
- package/lib/module/atoms/skeleton/skeleton.js +5 -5
- package/lib/module/atoms/skeleton/skeleton.js.map +1 -1
- package/lib/module/atoms/surface/surface.ios.js +3 -0
- package/lib/module/atoms/surface/surface.ios.js.map +1 -1
- package/lib/module/atoms/text/text.android.js +5 -2
- package/lib/module/atoms/text/text.android.js.map +1 -1
- package/lib/module/atoms/text/text.ios.js +14 -3
- package/lib/module/atoms/text/text.ios.js.map +1 -1
- package/lib/module/atoms/text-field/text-field.android.js +19 -4
- package/lib/module/atoms/text-field/text-field.android.js.map +1 -1
- package/lib/module/atoms/text-field/text-field.ios.js +7 -2
- package/lib/module/atoms/text-field/text-field.ios.js.map +1 -1
- package/lib/module/molecules/collapsible/collapsible.android.js +37 -7
- package/lib/module/molecules/collapsible/collapsible.android.js.map +1 -1
- package/lib/module/molecules/navigation-bar/navigation-bar.android.js +2 -8
- package/lib/module/molecules/navigation-bar/navigation-bar.android.js.map +1 -1
- package/lib/module/molecules/pager/pager.android.js +5 -4
- package/lib/module/molecules/pager/pager.android.js.map +1 -1
- package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js +114 -11
- package/lib/module/molecules/scroll-edge-container/scroll-edge-container.android.js.map +1 -1
- package/lib/module/molecules/stepper/stepper.ios.js +45 -8
- package/lib/module/molecules/stepper/stepper.ios.js.map +1 -1
- package/lib/module/ripple-clip.js +9 -1
- package/lib/module/ripple-clip.js.map +1 -1
- package/lib/typescript/atoms/activity-indicator/activity-indicator.d.ts +1 -3
- package/lib/typescript/atoms/activity-indicator/activity-indicator.ios.d.ts +3 -0
- package/lib/typescript/atoms/activity-indicator/activity-indicator.types.d.ts +17 -0
- package/lib/typescript/atoms/activity-indicator/index.d.ts +1 -0
- package/lib/typescript/atoms/blur-view/blur-view.d.ts +1 -0
- package/lib/typescript/atoms/blur-view/blur-view.ios.d.ts +3 -0
- package/lib/typescript/atoms/blur-view/blur-view.types.d.ts +31 -0
- package/lib/typescript/atoms/blur-view/index.d.ts +2 -0
- package/lib/typescript/atoms/box/a-box.d.ts +1 -1
- package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +12 -5
- package/lib/typescript/atoms/image/image.d.ts +12 -4
- package/lib/typescript/atoms/image/image.types.d.ts +4 -0
- package/lib/typescript/atoms/image/index.d.ts +1 -0
- package/lib/typescript/atoms/index.d.ts +1 -0
- package/lib/typescript/atoms/island/island.types.d.ts +8 -4
- package/lib/typescript/atoms/pressable/pressable.types.d.ts +5 -3
- package/lib/typescript/atoms/progress/progress.types.d.ts +2 -2
- package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +7 -2
- package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +8 -4
- package/lib/typescript/atoms/surface/surface.types.d.ts +2 -2
- package/lib/typescript/atoms/text/text.types.d.ts +7 -2
- package/lib/typescript/atoms/text-field/text-field.types.d.ts +6 -2
- package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +6 -4
- package/lib/typescript/molecules/stepper/stepper.ios.d.ts +5 -0
- package/lib/typescript/molecules/stepper/stepper.types.d.ts +1 -4
- package/package.json +5 -5
- package/src/atoms/activity-indicator/activity-indicator.android.tsx +32 -0
- package/src/atoms/activity-indicator/activity-indicator.ios.tsx +15 -0
- package/src/atoms/activity-indicator/activity-indicator.types.ts +20 -0
- package/src/atoms/activity-indicator/index.ts +1 -0
- package/src/atoms/avatar/avatar.tsx +1 -1
- package/src/atoms/blur-view/blur-view.android.tsx +68 -0
- package/src/atoms/blur-view/blur-view.ios.tsx +37 -0
- package/src/atoms/blur-view/blur-view.types.ts +34 -0
- package/src/atoms/blur-view/index.ts +2 -0
- package/src/atoms/glass-view/glass-view.android.tsx +41 -3
- package/src/atoms/glass-view/glass-view.types.ts +12 -5
- package/src/atoms/image/image.tsx +11 -12
- package/src/atoms/image/image.types.ts +6 -0
- package/src/atoms/image/index.ts +1 -0
- package/src/atoms/index.ts +1 -0
- package/src/atoms/island/island.android.tsx +10 -2
- package/src/atoms/island/island.ios.tsx +4 -2
- package/src/atoms/island/island.types.ts +8 -4
- package/src/atoms/pressable/pressable.tsx +46 -6
- package/src/atoms/pressable/pressable.types.ts +5 -3
- package/src/atoms/progress/progress.ios.tsx +14 -5
- package/src/atoms/progress/progress.types.ts +2 -2
- package/src/atoms/rn-text/rn-text.tsx +6 -3
- package/src/atoms/rn-text/rn-text.types.ts +15 -9
- package/src/atoms/skeleton/skeleton.tsx +4 -4
- package/src/atoms/skeleton/skeleton.types.ts +8 -4
- package/src/atoms/surface/surface.ios.tsx +2 -1
- package/src/atoms/surface/surface.types.ts +2 -2
- package/src/atoms/text/text.android.tsx +7 -1
- package/src/atoms/text/text.ios.tsx +14 -3
- package/src/atoms/text/text.types.ts +7 -2
- package/src/atoms/text-field/text-field.android.tsx +19 -3
- package/src/atoms/text-field/text-field.ios.tsx +7 -1
- package/src/atoms/text-field/text-field.types.ts +6 -2
- package/src/molecules/collapsible/collapsible.android.tsx +47 -7
- package/src/molecules/navigation-bar/navigation-bar.android.tsx +1 -6
- package/src/molecules/pager/pager.android.tsx +4 -1
- package/src/molecules/scroll-edge-container/scroll-edge-container.android.tsx +103 -10
- package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +6 -4
- package/src/molecules/stepper/stepper.ios.tsx +37 -1
- package/src/molecules/stepper/stepper.types.ts +1 -4
- package/src/ripple-clip.ts +10 -1
- package/lib/module/atoms/activity-indicator/activity-indicator.js +0 -14
- package/lib/module/atoms/activity-indicator/activity-indicator.js.map +0 -1
- package/src/atoms/activity-indicator/activity-indicator.tsx +0 -9
|
@@ -5,28 +5,29 @@ import { fillMaxSize, testID as testIdModifier, weight } from '@expo/ui/jetpack-
|
|
|
5
5
|
import { spacing } from '@hzblj/kara-theme';
|
|
6
6
|
import { Children, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
import { HStack } from "../../atoms/h-stack/index.js";
|
|
8
|
+
import { Spacer } from "../../atoms/spacer/index.js";
|
|
8
9
|
import { VStack } from "../../atoms/v-stack/index.js";
|
|
9
10
|
import { useHostGuard } from "../../host-context.js";
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
const DOT_SIZE = 6;
|
|
12
13
|
|
|
13
|
-
/** Compose ships no page indicator, so the dots are composed out of atoms. */
|
|
14
|
+
/** Compose ships no page indicator, so the dots are composed out of atoms — centred between two spacers. */
|
|
14
15
|
const PagerDots = ({
|
|
15
16
|
count,
|
|
16
17
|
current
|
|
17
|
-
}) => /*#__PURE__*/
|
|
18
|
+
}) => /*#__PURE__*/_jsxs(HStack, {
|
|
18
19
|
align: "center",
|
|
19
20
|
py: "s12",
|
|
20
21
|
spacing: "s6",
|
|
21
22
|
wide: true,
|
|
22
|
-
children: Array.from({
|
|
23
|
+
children: [/*#__PURE__*/_jsx(Spacer, {}), Array.from({
|
|
23
24
|
length: count
|
|
24
25
|
}, (_, index) => /*#__PURE__*/_jsx(VStack, {
|
|
25
26
|
bg: index === current ? 'content.primary' : 'fill.tertiary',
|
|
26
27
|
borderRadius: "full",
|
|
27
28
|
h: DOT_SIZE,
|
|
28
29
|
w: DOT_SIZE
|
|
29
|
-
}, index))
|
|
30
|
+
}, index)), /*#__PURE__*/_jsx(Spacer, {})]
|
|
30
31
|
});
|
|
31
32
|
export const Pager = ({
|
|
32
33
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HorizontalPager","fillMaxSize","testID","testIdModifier","weight","spacing","Children","useCallback","useEffect","useMemo","useRef","useState","HStack","VStack","useHostGuard","jsx","_jsx","jsxs","_jsxs","DOT_SIZE","PagerDots","count","current","align","py","wide","children","Array","from","length","_","index","bg","borderRadius","h","w","Pager","indicators","onPageChange","page","pageSpacing","scrollEnabled","pagerRef","settledPage","currentPage","setCurrentPage","undefined","animateScrollToPage","onSettledPageChange","next","modifiers","pager","initialPage","onCurrentPageChange","ref","userScrollEnabled","tall"],"sourceRoot":"../../../../src","sources":["molecules/pager/pager.android.tsx"],"mappings":";;AAAA,SAAQA,eAAe,QAAmC,0BAA0B;AACpF,SAAQC,WAAW,EAAuBC,MAAM,IAAIC,cAAc,EAAEC,MAAM,QAAO,oCAAoC;AACrH,SAAQC,OAAO,QAAO,mBAAmB;AACzC,SAAQC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AAEjF,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C,MAAMC,QAAQ,GAAG,CAAC;;AAElB;AACA,MAAMC,SAAS,GAAGA,CAAC;EAACC,KAAK;EAAEC;AAAyC,CAAC,
|
|
1
|
+
{"version":3,"names":["HorizontalPager","fillMaxSize","testID","testIdModifier","weight","spacing","Children","useCallback","useEffect","useMemo","useRef","useState","HStack","Spacer","VStack","useHostGuard","jsx","_jsx","jsxs","_jsxs","DOT_SIZE","PagerDots","count","current","align","py","wide","children","Array","from","length","_","index","bg","borderRadius","h","w","Pager","indicators","onPageChange","page","pageSpacing","scrollEnabled","pagerRef","settledPage","currentPage","setCurrentPage","undefined","animateScrollToPage","onSettledPageChange","next","modifiers","pager","initialPage","onCurrentPageChange","ref","userScrollEnabled","tall"],"sourceRoot":"../../../../src","sources":["molecules/pager/pager.android.tsx"],"mappings":";;AAAA,SAAQA,eAAe,QAAmC,0BAA0B;AACpF,SAAQC,WAAW,EAAuBC,MAAM,I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;IAAAf,QAAA,EAEhCA;EAAQ,CACM,CAClB;EAED,IAAI,CAACW,UAAU,EAAE;IACf,OAAOc,KAAK;EACd;EAEA,oBACEjC,KAAA,CAACL,MAAM;IAAC2C,IAAI;IAAC/B,IAAI;IAAAC,QAAA,GACdyB,KAAK,eACNnC,IAAA,CAACI,SAAS;MAACC,KAAK,EAAEhB,QAAQ,CAACgB,KAAK,CAACK,QAAQ,CAAE;MAACJ,OAAO,EAAEsB;IAAY,CAAE,CAAC;EAAA,CAC9D,CAAC;AAEb,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { duration, opacity } from '@hzblj/kara-theme';
|
|
4
|
+
import { cloneElement, useCallback, useRef } from 'react';
|
|
5
|
+
import { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
6
|
+
import { ABox, Box } from "../../atoms/box/index.js";
|
|
4
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
/** Less than a pixel scrolled is not scrolled — a fling settles a fraction away from the edge. */
|
|
9
|
+
const EDGE_SLOP = 0.5;
|
|
10
|
+
const FILL = {
|
|
11
|
+
duration: duration.d200
|
|
12
|
+
};
|
|
13
|
+
/** A bar, and behind it the container colour it fills with — faded in and out, not switched. */
|
|
14
|
+
const EdgeBar = ({
|
|
15
|
+
children,
|
|
16
|
+
filled
|
|
17
|
+
}) => {
|
|
18
|
+
const fill = useAnimatedStyle(() => ({
|
|
19
|
+
opacity: filled.value
|
|
20
|
+
}), []);
|
|
21
|
+
if (!children) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
25
|
+
children: [/*#__PURE__*/_jsx(ABox, {
|
|
26
|
+
bg: "surface.secondary",
|
|
27
|
+
bottom: 0,
|
|
28
|
+
left: 0,
|
|
29
|
+
pointerEvents: "none",
|
|
30
|
+
position: "absolute",
|
|
31
|
+
right: 0,
|
|
32
|
+
style: fill,
|
|
33
|
+
top: 0
|
|
34
|
+
}), children]
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
5
38
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
39
|
+
* Material's take on the scroll edge: a React Native scroll view has no `contentInset` to slide content under a bar on
|
|
40
|
+
* Android, so the bars stack above and below it, and do what a Material top app bar does on scroll — transparent at
|
|
41
|
+
* rest, filled with `surface.secondary` (the scrolled container colour, `surfaceContainer`) once content has scrolled
|
|
42
|
+
* under it. The bottom bar mirrors it: filled while there is more content below. The scroll view keeps its own
|
|
43
|
+
* `onScroll`, `onLayout` and `onContentSizeChange`.
|
|
8
44
|
*/
|
|
9
45
|
export const ScrollEdgeContainer = ({
|
|
10
46
|
automaticInsets: _automaticInsets,
|
|
@@ -14,12 +50,79 @@ export const ScrollEdgeContainer = ({
|
|
|
14
50
|
testID,
|
|
15
51
|
topBar,
|
|
16
52
|
...sx
|
|
17
|
-
}) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
53
|
+
}) => {
|
|
54
|
+
const topFilled = useSharedValue(opacity.o0);
|
|
55
|
+
const bottomFilled = useSharedValue(opacity.o0);
|
|
56
|
+
const metrics = useRef({
|
|
57
|
+
content: 0,
|
|
58
|
+
offset: 0,
|
|
59
|
+
viewport: 0
|
|
60
|
+
});
|
|
61
|
+
const state = useRef({
|
|
62
|
+
bottom: false,
|
|
63
|
+
top: false
|
|
64
|
+
});
|
|
65
|
+
const {
|
|
66
|
+
flex,
|
|
67
|
+
onContentSizeChange,
|
|
68
|
+
onLayout,
|
|
69
|
+
onScroll,
|
|
70
|
+
scrollEventThrottle
|
|
71
|
+
} = children.props;
|
|
72
|
+
|
|
73
|
+
// Only a change of state animates; a scroll event restating the same one would restart the fade.
|
|
74
|
+
const update = useCallback(() => {
|
|
75
|
+
const {
|
|
76
|
+
content,
|
|
77
|
+
offset,
|
|
78
|
+
viewport
|
|
79
|
+
} = metrics.current;
|
|
80
|
+
const top = offset > EDGE_SLOP;
|
|
81
|
+
const bottom = viewport > 0 && offset + viewport < content - EDGE_SLOP;
|
|
82
|
+
if (top !== state.current.top) {
|
|
83
|
+
state.current.top = top;
|
|
84
|
+
topFilled.value = withTiming(top ? opacity.o100 : opacity.o0, FILL);
|
|
85
|
+
}
|
|
86
|
+
if (bottom !== state.current.bottom) {
|
|
87
|
+
state.current.bottom = bottom;
|
|
88
|
+
bottomFilled.value = withTiming(bottom ? opacity.o100 : opacity.o0, FILL);
|
|
89
|
+
}
|
|
90
|
+
}, [bottomFilled, topFilled]);
|
|
91
|
+
|
|
92
|
+
// `flex` so the scroll view takes the room between the bars — left to its content, it grew to the content's height,
|
|
93
|
+
// ran under the bottom bar and had nothing to scroll.
|
|
94
|
+
const scrollable = /*#__PURE__*/cloneElement(children, {
|
|
95
|
+
flex: flex ?? 1,
|
|
96
|
+
onContentSizeChange: (width, height) => {
|
|
97
|
+
metrics.current.content = height;
|
|
98
|
+
update();
|
|
99
|
+
onContentSizeChange?.(width, height);
|
|
100
|
+
},
|
|
101
|
+
onLayout: event => {
|
|
102
|
+
metrics.current.viewport = event.nativeEvent.layout.height;
|
|
103
|
+
update();
|
|
104
|
+
onLayout?.(event);
|
|
105
|
+
},
|
|
106
|
+
onScroll: event => {
|
|
107
|
+
metrics.current.offset = event.nativeEvent.contentOffset.y;
|
|
108
|
+
update();
|
|
109
|
+
onScroll?.(event);
|
|
110
|
+
},
|
|
111
|
+
scrollEventThrottle: scrollEventThrottle ?? 16
|
|
112
|
+
});
|
|
113
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
114
|
+
...sx,
|
|
115
|
+
testID: testID,
|
|
116
|
+
children: [/*#__PURE__*/_jsx(EdgeBar, {
|
|
117
|
+
filled: topFilled,
|
|
118
|
+
children: topBar
|
|
119
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
120
|
+
flex: 1,
|
|
121
|
+
children: scrollable
|
|
122
|
+
}), /*#__PURE__*/_jsx(EdgeBar, {
|
|
123
|
+
filled: bottomFilled,
|
|
124
|
+
children: bottomBar
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
127
|
+
};
|
|
25
128
|
//# sourceMappingURL=scroll-edge-container.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Box","jsx","_jsx","jsxs","_jsxs","ScrollEdgeContainer","automaticInsets","_automaticInsets","bottomBar","
|
|
1
|
+
{"version":3,"names":["duration","opacity","cloneElement","useCallback","useRef","useAnimatedStyle","useSharedValue","withTiming","ABox","Box","jsx","_jsx","jsxs","_jsxs","EDGE_SLOP","FILL","d200","EdgeBar","children","filled","fill","value","bg","bottom","left","pointerEvents","position","right","style","top","ScrollEdgeContainer","automaticInsets","_automaticInsets","bottomBar","effect","_effect","testID","topBar","sx","topFilled","o0","bottomFilled","metrics","content","offset","viewport","state","flex","onContentSizeChange","onLayout","onScroll","scrollEventThrottle","props","update","current","o100","scrollable","width","height","event","nativeEvent","layout","contentOffset","y"],"sourceRoot":"../../../../src","sources":["molecules/scroll-edge-container/scroll-edge-container.android.tsx"],"mappings":";;AAAA,SAAQA,QAAQ,EAAEC,OAAO,QAAO,mBAAmB;AACnD,SAAQC,YAAY,EAAkBC,WAAW,EAAEC,MAAM,QAAO,OAAO;AAEvE,SAA0BC,gBAAgB,EAAEC,cAAc,EAAEC,UAAU,QAAO,yBAAyB;AAEtG,SAAQC,IAAI,EAAEC,GAAG,QAAO,0BAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGzC;AACA,MAAMC,SAAS,GAAG,GAAG;AAErB,MAAMC,IAAI,GAAG;EAACf,QAAQ,EAAEA,QAAQ,CAACgB;AAAI,CAAC;AAItC;AACA,MAAMC,OAAO,GAAGA,CAAC;EAACC,QAAQ;EAAEC;AAAW,CAAC,KA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ACH,MAAM;MAC1DL,MAAM,CAAC,CAAC;MACRJ,QAAQ,GAAGU,KAAK,CAAC;IACnB,CAAC;IACDT,QAAQ,EAAGS,KAA8C,IAAK;MAC5DjB,OAAO,CAACY,OAAO,CAACV,MAAM,GAAGe,KAAK,CAACC,WAAW,CAACE,aAAa,CAACC,CAAC;MAC1DV,MAAM,CAAC,CAAC;MACRH,QAAQ,GAAGS,KAAK,CAAC;IACnB,CAAC;IACDR,mBAAmB,EAAEA,mBAAmB,IAAI;EAC9C,CAAmC,CAAC;EAEpC,oBACEtC,KAAA,CAACJ,GAAG;IAAA,GAAK6B,EAAE;IAAEF,MAAM,EAAEA,MAAO;IAAAlB,QAAA,gBAC1BP,IAAA,CAACM,OAAO;MAACE,MAAM,EAAEoB,SAAU;MAAArB,QAAA,EAAEmB;IAAM,CAAU,CAAC,eAC9C1B,IAAA,CAACF,GAAG;MAACsC,IAAI,EAAE,CAAE;MAAA7B,QAAA,EAAEsC;IAAU,CAAM,CAAC,eAChC7C,IAAA,CAACM,OAAO;MAACE,MAAM,EAAEsB,YAAa;MAAAvB,QAAA,EAAEe;IAAS,CAAU,CAAC;EAAA,CACjD,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Stepper as SwiftUIStepper } from '@expo/ui/swift-ui';
|
|
4
|
+
import { labelsHidden } from '@expo/ui/swift-ui/modifiers';
|
|
5
|
+
import { useRef } from 'react';
|
|
6
|
+
import { HStack } from "../../atoms/h-stack/index.js";
|
|
7
|
+
import { Spacer } from "../../atoms/spacer/index.js";
|
|
8
|
+
import { Text } from "../../atoms/text/index.js";
|
|
4
9
|
import { useHostGuard } from "../../host-context.js";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
/** The label stays VoiceOver's, on the control; on screen it is the row's own text. */
|
|
12
|
+
const LABEL_HIDDEN = [labelsHidden()];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* SwiftUI's `Stepper` at the end of a row, the label leading and the value just before the control — the way iOS's own
|
|
16
|
+
* settings show a stepped value. The value rolls to the next one (`numericText`), up or down with the change, in
|
|
17
|
+
* monospaced digits so the row does not jump.
|
|
18
|
+
*/
|
|
6
19
|
export const Stepper = ({
|
|
7
20
|
label,
|
|
8
21
|
max,
|
|
@@ -12,13 +25,37 @@ export const Stepper = ({
|
|
|
12
25
|
value
|
|
13
26
|
}) => {
|
|
14
27
|
useHostGuard('Stepper');
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
const previous = useRef(value);
|
|
29
|
+
const countsDown = value < previous.current;
|
|
30
|
+
previous.current = value;
|
|
31
|
+
return /*#__PURE__*/_jsxs(HStack, {
|
|
32
|
+
align: "center",
|
|
33
|
+
spacing: "s12",
|
|
34
|
+
wide: true,
|
|
35
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
36
|
+
children: label
|
|
37
|
+
}), /*#__PURE__*/_jsx(Spacer, {}), /*#__PURE__*/_jsx(Text, {
|
|
38
|
+
color: "content.secondary",
|
|
39
|
+
ios: {
|
|
40
|
+
animation: {
|
|
41
|
+
value
|
|
42
|
+
},
|
|
43
|
+
contentTransition: {
|
|
44
|
+
countsDown,
|
|
45
|
+
type: 'numericText'
|
|
46
|
+
},
|
|
47
|
+
monospacedDigit: true
|
|
48
|
+
},
|
|
49
|
+
children: String(value)
|
|
50
|
+
}), /*#__PURE__*/_jsx(SwiftUIStepper, {
|
|
51
|
+
label: label,
|
|
52
|
+
max: max,
|
|
53
|
+
min: min,
|
|
54
|
+
modifiers: LABEL_HIDDEN,
|
|
55
|
+
onValueChange: onValueChange,
|
|
56
|
+
step: step,
|
|
57
|
+
value: value
|
|
58
|
+
})]
|
|
22
59
|
});
|
|
23
60
|
};
|
|
24
61
|
//# sourceMappingURL=stepper.ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Stepper","SwiftUIStepper","useHostGuard","jsx","_jsx","label","max","min","onValueChange","step","value"],"sourceRoot":"../../../../src","sources":["molecules/stepper/stepper.ios.tsx"],"mappings":";;AAAA,SAAQA,OAAO,IAAIC,cAAc,QAAO,mBAAmB;
|
|
1
|
+
{"version":3,"names":["Stepper","SwiftUIStepper","labelsHidden","useRef","HStack","Spacer","Text","useHostGuard","jsx","_jsx","jsxs","_jsxs","LABEL_HIDDEN","label","max","min","onValueChange","step","value","previous","countsDown","current","align","spacing","wide","children","color","ios","animation","contentTransition","type","monospacedDigit","String","modifiers"],"sourceRoot":"../../../../src","sources":["molecules/stepper/stepper.ios.tsx"],"mappings":";;AAAA,SAAQA,OAAO,IAAIC,cAAc,QAAO,mBAAmB;AAC3D,SAAQC,YAAY,QAAO,6BAA6B;AACxD,SAAQC,MAAM,QAAO,OAAO;AAE5B,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,MAAM,QAAO,6BAAoB;AACzC,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,YAAY,QAAO,uBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C;AACA,MAAMC,YAAY,GAAG,CAACV,YAAY,CAAC,CAAC,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMF,OAAyB,GAAGA,CAAC;EAACa,KAAK;EAAEC,GAAG;EAAEC,GAAG;EAAEC,aAAa;EAAEC,IAAI,GAAG,CAAC;EAAEC;AAAmB,CAAC,KAAK;EAC5GX,YAAY,CAAC,SAAS,CAAC;EACvB,MAAMY,QAAQ,GAAGhB,MAAM,CAACe,KAAK,CAAC;EAC9B,MAAME,UAAU,GAAGF,KAAK,GAAGC,QAAQ,CAACE,OAAO;EAC3CF,QAAQ,CAACE,OAAO,GAAGH,KAAK;EAExB,oBACEP,KAAA,CAACP,MAAM;IAACkB,KAAK,EAAC,QAAQ;IAACC,OAAO,EAAC,KAAK;IAACC,IAAI;IAAAC,QAAA,gBACvChB,IAAA,CAACH,IAAI;MAAAmB,QAAA,EAAEZ;IAAK,CAAO,CAAC,eACpBJ,IAAA,CAACJ,MAAM,IAAE,CAAC,eACVI,IAAA,CAACH,IAAI;MACHoB,KAAK,EAAC,mBAAmB;MACzBC,GAAG,EAAE;QAACC,SAAS,EAAE;UAACV;QAAK,CAAC;QAAEW,iBAAiB,EAAE;UAACT,UAAU;UAAEU,IAAI,EAAE;QAAa,CAAC;QAAEC,eAAe,EAAE;MAAI,CAAE;MAAAN,QAAA,EAEtGO,MAAM,CAACd,KAAK;IAAC,CACV,CAAC,eACPT,IAAA,CAACR,cAAc;MACbY,KAAK,EAAEA,KAAM;MACbC,GAAG,EAAEA,GAAI;MACTC,GAAG,EAAEA,GAAI;MACTkB,SAAS,EAAErB,YAAa;MACxBI,aAAa,EAAEA,aAAc;MAC7BC,IAAI,EAAEA,IAAK;MACXC,KAAK,EAAEA;IAAM,CACd,CAAC;EAAA,CACI,CAAC;AAEb,CAAC","ignoreList":[]}
|
|
@@ -8,6 +8,9 @@ const FILL = {
|
|
|
8
8
|
flexGrow: 1
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
/** What gives the outer view a height of its own, rather than its content's. */
|
|
12
|
+
const SIZING_KEYS = ['aspectRatio', 'flex', 'flexBasis', 'flexGrow', 'height', 'minHeight'];
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* Splits a resolved style for a pressable with an Android ripple. The ripple is drawn as the pressable's foreground,
|
|
13
16
|
* which its own `overflow: hidden` does not clip — so it would spill past rounded corners. A parent clips its
|
|
@@ -28,8 +31,13 @@ export const splitForRipple = style => {
|
|
|
28
31
|
outer[key] = value;
|
|
29
32
|
}
|
|
30
33
|
}
|
|
34
|
+
|
|
35
|
+
// Only a sized outer view needs the pressable stretched to it. Sized by its content it must not be: Yoga grows a
|
|
36
|
+
// `flexGrow` child of a fit-content parent to the most it may take — inside a row centred on its cross axis, the
|
|
37
|
+
// pressable would stretch to the row's full height and leave its content at the top.
|
|
38
|
+
const sized = SIZING_KEYS.some(key => flat[key] !== undefined) || flat.top !== undefined && flat.bottom !== undefined;
|
|
31
39
|
return {
|
|
32
|
-
inner: [FILL, inner],
|
|
40
|
+
inner: sized ? [FILL, inner] : [inner],
|
|
33
41
|
outer: outer
|
|
34
42
|
};
|
|
35
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","CONTENT_KEYS","Set","FILL","flexGrow","splitForRipple","style","flat","flatten","outer","overflow","inner","key","value","Object","entries","has"],"sourceRoot":"../../src","sources":["ripple-clip.ts"],"mappings":";;AAAA,SAAQA,UAAU,QAAuB,cAAc;;AAEvD;AACA,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAAS,CACnC,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,QAAQ,CACT,CAAC;AAEF,MAAMC,IAAe,GAAG;EAACC,QAAQ,EAAE;AAAC,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAIC,KAA4B,IAA6C;EACtG,MAAMC,IAAI,
|
|
1
|
+
{"version":3,"names":["StyleSheet","CONTENT_KEYS","Set","FILL","flexGrow","SIZING_KEYS","splitForRipple","style","flat","flatten","outer","overflow","inner","key","value","Object","entries","has","sized","some","undefined","top","bottom"],"sourceRoot":"../../src","sources":["ripple-clip.ts"],"mappings":";;AAAA,SAAQA,UAAU,QAAuB,cAAc;;AAEvD;AACA,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAAS,CACnC,cAAc,EACd,YAAY,EACZ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AAK,EAAEA;EAAkB,CAAC;AACtG,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ColorToken } from '@hzblj/kara-theme';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export type ActivityIndicatorSize = 'large' | 'small';
|
|
4
|
+
/**
|
|
5
|
+
* That something is loading, for as long as it takes — UIKit's spinner on iOS, Material 3's expressive
|
|
6
|
+
* `LoadingIndicator` on Android, its shapes morphing as it turns. A React Native view on iOS and a host of its own on
|
|
7
|
+
* Android, so it renders anywhere. For how far along something is, use `Progress`.
|
|
8
|
+
*/
|
|
9
|
+
export type ActivityIndicatorProps = {
|
|
10
|
+
/** Its colour. `fill.accent.primary` by default. */
|
|
11
|
+
color?: ColorToken;
|
|
12
|
+
/** `small` sits in a row or a button, `large` holds a screen that is loading. `small` by default. */
|
|
13
|
+
size?: ActivityIndicatorSize;
|
|
14
|
+
/** Test identifier, forwarded to the view. */
|
|
15
|
+
testID?: string;
|
|
16
|
+
};
|
|
17
|
+
export type ActivityIndicatorComponent = (props: ActivityIndicatorProps) => ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './blur-view.ios';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { BlurMaterial, BlurVibrancy } from '@hzblj/kara-native/swift-ui';
|
|
2
|
+
import type { ResponsiveViewSx } from '@hzblj/kara-sx';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
export type { BlurMaterial, BlurVibrancy } from '@hzblj/kara-native/swift-ui';
|
|
5
|
+
/**
|
|
6
|
+
* One of the system's materials behind React Native content — what sheets, bars, menus and HUDs are made of, in
|
|
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`; below Android 12 the surface alone. The
|
|
10
|
+
* React Native tier: it needs no host, so it suits a list cell. Shape it with `borderRadius`; it clips its children.
|
|
11
|
+
*/
|
|
12
|
+
export type BlurViewProps = ResponsiveViewSx & {
|
|
13
|
+
/**
|
|
14
|
+
* Pins the material to light or dark whatever the app's appearance — a dark HUD over a light screen. Unset, it follows
|
|
15
|
+
* the app theme. Android draws the opposite appearance with Material's inverse surface.
|
|
16
|
+
*/
|
|
17
|
+
appearance?: 'dark' | 'light';
|
|
18
|
+
/** React Native content, over the material. */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/** How much of what lies behind shows through, from `ultraThin` (most) to `ultraThick` (least). `regular` by default. */
|
|
21
|
+
material?: BlurMaterial;
|
|
22
|
+
/** Test identifier, forwarded to the view. */
|
|
23
|
+
testID?: string;
|
|
24
|
+
/**
|
|
25
|
+
* iOS: draws the children vibrant at this level, the way iOS draws its own labels and fills on a material — their
|
|
26
|
+
* colour becomes the material's vibrant one and their alpha the mask. Android has no vibrancy: the children keep
|
|
27
|
+
* their colours there.
|
|
28
|
+
*/
|
|
29
|
+
vibrancy?: BlurVibrancy;
|
|
30
|
+
};
|
|
31
|
+
export type BlurViewComponent = (props: BlurViewProps) => ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ABox: import("react-native-reanimated/lib/typescript/createAnimatedComponent").AnimatedComponentType<Readonly<Omit<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>, "align" | "alignContent" | "alignSelf" | "aspectRatio" | "basis" | "bg" | "blur" | "borderColor" | "borderRadius" | "borderWidth" | "bottom" | "columnGap" | "display" | "flex" | "flexDirection" | "gap" | "grow" | "h" | "justify" | "left" | "m" | "maxH" | "maxW" | "mb" | "minH" | "minW" | "ml" | "mr" | "mt" | "mx" | "my" | "offsetX" | "offsetY" | "opacity" | "overflow" | "p" | "pb" | "pl" | "position" | "pr" | "pt" | "px" | "py" | "right" | "rotate" | "rowGap" | "scale" | "shadow" | "shrink" | "style" | "tall" | "top" | "w" | "wide" | "wrap" | "zIndex" | keyof {
|
|
1
|
+
export declare const ABox: import("react-native-reanimated/lib/typescript/createAnimatedComponent").AnimatedComponentType<Readonly<Omit<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>, "align" | "alignContent" | "alignSelf" | "aspectRatio" | "basis" | "bg" | "blur" | "borderColor" | "borderRadius" | "borderWidth" | "bottom" | "columnGap" | "display" | "flex" | "flexDirection" | "gap" | "grow" | "h" | "inset" | "justify" | "left" | "m" | "maxH" | "maxW" | "mb" | "minH" | "minW" | "ml" | "mr" | "mt" | "mx" | "my" | "offsetX" | "offsetY" | "opacity" | "overflow" | "p" | "pb" | "pl" | "position" | "pr" | "pt" | "px" | "py" | "right" | "rotate" | "rowGap" | "scale" | "shadow" | "shrink" | "style" | "tall" | "top" | "w" | "wide" | "wrap" | "zIndex" | keyof {
|
|
2
2
|
borderBottomWidth?: number;
|
|
3
3
|
borderLeftWidth?: number;
|
|
4
4
|
borderRightWidth?: number;
|
|
@@ -2,18 +2,25 @@ import type { ResponsiveViewSx } from '@hzblj/kara-sx';
|
|
|
2
2
|
import type { ColorToken } from '@hzblj/kara-theme';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Glass around a React Native subtree, shaped as a capsule — the React Native tier, so it needs no host. iOS 26:
|
|
6
|
+
* Liquid Glass. Android: frosted glass — what lies behind, blurred on Android 12+, under a translucent tonal surface
|
|
7
|
+
* (or `tint`) and a hairline. iOS before 26 has no Liquid Glass and draws a capsule of `tint` instead, or of the glass
|
|
8
|
+
* buttons' translucent fill (`btn.bg.glass.base`) when there is none.
|
|
9
|
+
*
|
|
10
|
+
* On Android each glass re-records what lies behind it before every frame: a few buttons cost nothing, but keep it out
|
|
11
|
+
* of the cells of a long list — a plain `tint` reads as well there.
|
|
8
12
|
*/
|
|
9
13
|
export type GlassViewProps = ResponsiveViewSx & {
|
|
10
14
|
/** React Native views. Give them `pointerEvents="none"` when `interactive`, so the press reaches the `Pressable`. */
|
|
11
15
|
children?: ReactNode;
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* iOS 26: swells toward the finger on touch, carrying the children with it. Android has no swell: wrap the view in a
|
|
18
|
+
* `Pressable` with `borderRadius="full"`, whose ripple then keeps to the capsule. The press is always the `Pressable`'s.
|
|
19
|
+
*/
|
|
13
20
|
interactive?: boolean;
|
|
14
21
|
/** Test identifier, forwarded to the view. */
|
|
15
22
|
testID?: string;
|
|
16
|
-
/** Tints the material. Unset leaves it clear. */
|
|
23
|
+
/** Tints the material. Unset leaves it clear on iOS, and the translucent surface colour on Android. */
|
|
17
24
|
tint?: ColorToken;
|
|
18
25
|
};
|
|
19
26
|
export type GlassViewComponent = (props: GlassViewProps) => ReactNode;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import { ImageProps } from 'expo-image';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Image as ExpoImage, type ImageProps as ExpoImageProps } from 'expo-image';
|
|
2
|
+
import type { Ref } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* `expo-image` with the `sx` props, the way `Box` is a `View` with them, and the design system's 100 ms linear fade
|
|
5
|
+
* already applied, so a loaded image never pops in. An explicit `transition` wins, and so does an explicit `style`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Image: import("react").MemoExoticComponent<{
|
|
8
|
+
({ style, ...props }: import("@hzblj/kara-sx").SxProps<ExpoImageProps & {
|
|
9
|
+
ref?: Ref<ExpoImage>;
|
|
10
|
+
}>): import("react").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
}>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { ResponsiveViewSx } from '@hzblj/kara-sx';
|
|
1
2
|
import type { ReactNode } from 'react';
|
|
2
3
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
/**
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A host for native atoms in a React Native layout — the SwiftUI / Compose `Host` an `@expo/ui` tree mounts into. It
|
|
6
|
+
* sits in that layout like a `Box`, and takes `Box`'s `sx` props for it: `h`, `flex`, margins.
|
|
7
|
+
*/
|
|
8
|
+
export type IslandProps = ResponsiveViewSx & {
|
|
5
9
|
/** The native views it hosts. */
|
|
6
10
|
children?: ReactNode;
|
|
7
11
|
/**
|
|
@@ -10,13 +14,13 @@ export type IslandProps = {
|
|
|
10
14
|
* width maps to `fixedSize(horizontal: true)`, so the native side ignores the proposed width and
|
|
11
15
|
* resolves a `wide` stack's ideal width as unbounded.
|
|
12
16
|
*
|
|
13
|
-
* Turn it off — and give the island an explicit
|
|
17
|
+
* Turn it off — and give the island an explicit height, `h` — when the subtree contains an
|
|
14
18
|
* `RnView`: that host drives its SwiftUI frame from the child's Yoga-laid-out bounds while this one
|
|
15
19
|
* writes its measured size back into the Yoga style, and the two together spin a layout loop that
|
|
16
20
|
* hangs the main thread as soon as the views lay out on screen.
|
|
17
21
|
*/
|
|
18
22
|
matchContents?: boolean;
|
|
19
|
-
/** A React Native style for the host view
|
|
23
|
+
/** A React Native style for the host view, merged over the `sx` props — for what they cannot say. */
|
|
20
24
|
style?: StyleProp<ViewStyle>;
|
|
21
25
|
/** Test identifier, forwarded to the host view on iOS — Android ignores it. */
|
|
22
26
|
testID?: string;
|
|
@@ -2,13 +2,15 @@ import type { ResponsiveViewSx } from '@hzblj/kara-sx';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import type { Haptic } from '../../haptics';
|
|
4
4
|
/**
|
|
5
|
-
* React Native's `Pressable`, styled through `sx` like a `Box
|
|
6
|
-
*
|
|
5
|
+
* React Native's `Pressable`, styled through `sx` like a `Box`, taking touches 8 points past its edges. The press is
|
|
6
|
+
* each platform's own: iOS springs it down to 96%; Android draws Material's ripple over the content, clipped to the
|
|
7
|
+
* pressable's shape — give it the `borderRadius` of what it wraps (`full` around a `GlassView`). The React Native
|
|
8
|
+
* tier — it needs no host.
|
|
7
9
|
*/
|
|
8
10
|
export type PressableProps = ResponsiveViewSx & {
|
|
9
11
|
/** The pressable content. */
|
|
10
12
|
children?: ReactNode;
|
|
11
|
-
/** Ignores presses — no `onPress`, no haptic, no spring. */
|
|
13
|
+
/** Ignores presses — no `onPress`, no haptic, no spring or ripple. */
|
|
12
14
|
disabled?: boolean;
|
|
13
15
|
/** Played on press. `true` is a `light` impact; a name picks the haptic, e.g. `selection` for a choice. */
|
|
14
16
|
haptic?: boolean | Haptic;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* A progress bar or ring, tinted `fill.accent.primary` — SwiftUI `ProgressView`
|
|
4
|
-
* `LinearProgressIndicator` and `CircularProgressIndicator`.
|
|
3
|
+
* A progress bar or ring, tinted `fill.accent.primary` — SwiftUI `ProgressView` (a capacity `Gauge` for a ring with a
|
|
4
|
+
* value, which `ProgressView` cannot draw on iOS) / Compose's `LinearProgressIndicator` and `CircularProgressIndicator`.
|
|
5
5
|
*/
|
|
6
6
|
export type ProgressProps = {
|
|
7
7
|
/** A circular indicator instead of a bar. Off by default. */
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { ResponsiveViewSx } from '@hzblj/kara-sx';
|
|
1
2
|
import type { ColorToken, TextVariant } from '@hzblj/kara-theme';
|
|
2
3
|
import type { ReactNode } from 'react';
|
|
3
4
|
import type { TextProps as RNTextProps } from 'react-native';
|
|
4
|
-
/**
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* React Native's `Text` in a theme typography variant — the React Native tier, for text outside a native host. It takes
|
|
7
|
+
* `Box`'s `sx` surface for its own box — margins, flex, padding, a background — all but `align`, which here aligns the
|
|
8
|
+
* lines.
|
|
9
|
+
*/
|
|
10
|
+
export type RnTextProps = Omit<RNTextProps, 'style'> & Omit<ResponsiveViewSx, 'align'> & {
|
|
6
11
|
/** Horizontal alignment, as React Native's `textAlign`. */
|
|
7
12
|
align?: 'center' | 'left' | 'right';
|
|
8
13
|
/** The text's colour. `content.primary` by default. */
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import type { SxDimension } from '@hzblj/kara-sx';
|
|
1
2
|
import type { RadiiSize } from '@hzblj/kara-theme';
|
|
2
3
|
import type { ReactNode } from 'react';
|
|
3
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* A loading placeholder that pulses in `fill.quaternary` — a React Native view, so it needs no host. Sized with the
|
|
6
|
+
* `sx` names: `w`, `h`, `borderRadius`.
|
|
7
|
+
*/
|
|
4
8
|
export type SkeletonProps = {
|
|
5
9
|
/** The corner radius. `small` by default. */
|
|
6
10
|
borderRadius?: RadiiSize;
|
|
7
11
|
/** In points. */
|
|
8
|
-
|
|
12
|
+
h: number;
|
|
9
13
|
/** Test identifier, forwarded to the view. */
|
|
10
14
|
testID?: string;
|
|
11
|
-
/** In points
|
|
12
|
-
|
|
15
|
+
/** In points, or a percentage of the row (`60%` for a line that ends early). Unset, it fills the row. */
|
|
16
|
+
w?: SxDimension;
|
|
13
17
|
};
|
|
14
18
|
export type SkeletonComponent = (props: SkeletonProps) => ReactNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ResponsiveSx } from '@hzblj/kara-sx';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
/**
|
|
4
|
-
* A container padded `s16` and rounded `large` unless told otherwise — a SwiftUI `VStack` on
|
|
5
|
-
* `Surface` around a `Column` on Android.
|
|
4
|
+
* A container on `surface.primary`, padded `s16` and rounded `large` unless told otherwise — a SwiftUI `VStack` on
|
|
5
|
+
* iOS, Material's `Surface` around a `Column` on Android.
|
|
6
6
|
*/
|
|
7
7
|
export type SurfaceProps = ResponsiveSx & {
|
|
8
8
|
/** Stacked vertically, from the leading edge. */
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import type { ResponsiveSx } from '@hzblj/kara-sx';
|
|
1
2
|
import type { ColorToken, TextVariant } from '@hzblj/kara-theme';
|
|
2
3
|
import type { ReactNode } from 'react';
|
|
3
4
|
export type TextAlign = 'center' | 'left' | 'right';
|
|
4
5
|
export type TextDecoration = 'none' | 'strikethrough' | 'underline';
|
|
5
6
|
export type TextTransform = 'lowercase' | 'uppercase';
|
|
6
|
-
/**
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* SwiftUI `Text` / Compose `Text` in a theme typography variant — a native atom; outside a host, use `RnText`. It takes
|
|
9
|
+
* the native `sx` surface too: padding, a frame (`wide` lines it up by `align`), a background, and the `ios` bucket's
|
|
10
|
+
* `contentTransition`, `animation` and `monospacedDigit` for a number that changes in place.
|
|
11
|
+
*/
|
|
12
|
+
export type TextProps = ResponsiveSx & {
|
|
8
13
|
/**
|
|
9
14
|
* How its lines align. iOS reads `left` and `right` as leading and trailing, so they flip in a right-to-left
|
|
10
15
|
* layout; Android keeps them as they are.
|