@cyberkaidev/ui 0.1.0 → 0.1.2
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/lib/module/components/Button.js +13 -10
- package/lib/module/components/Button.js.map +1 -1
- package/lib/module/components/Chips.js +19 -4
- package/lib/module/components/Chips.js.map +1 -1
- package/lib/module/components/RippleEffect.js +32 -15
- package/lib/module/components/RippleEffect.js.map +1 -1
- package/lib/typescript/src/components/Button.d.ts +6 -7
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Chips.d.ts.map +1 -1
- package/lib/typescript/src/components/RippleEffect.d.ts +5 -3
- package/lib/typescript/src/components/RippleEffect.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Button.tsx +15 -13
- package/src/components/Chips.tsx +18 -3
- package/src/components/RippleEffect.tsx +48 -19
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Platform, TouchableOpacity } from 'react-native';
|
|
4
|
-
import {
|
|
3
|
+
import { Platform, Pressable, TouchableOpacity } from 'react-native';
|
|
4
|
+
import { useColors } from "../ThemeProvider.js";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
/**
|
|
7
|
-
* Base pressable. Android gets
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Base pressable. Android gets the platform touch ripple (drawn in the
|
|
8
|
+
* foreground and clipped to the view's own shape); every other platform gets
|
|
9
|
+
* opacity feedback. Kept in one file (not `.ios`/`.android`) so consumers' type
|
|
10
|
+
* resolution works without `moduleSuffixes`.
|
|
10
11
|
*/
|
|
11
12
|
export function Button({
|
|
12
13
|
children,
|
|
@@ -17,11 +18,11 @@ export function Button({
|
|
|
17
18
|
style,
|
|
18
19
|
testID,
|
|
19
20
|
hitSlop,
|
|
20
|
-
rippleColor
|
|
21
|
-
rippleContainerBorderRadius
|
|
21
|
+
rippleColor
|
|
22
22
|
}) {
|
|
23
|
+
const colors = useColors();
|
|
23
24
|
if (Platform.OS === 'android') {
|
|
24
|
-
return /*#__PURE__*/_jsx(
|
|
25
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
25
26
|
testID: testID,
|
|
26
27
|
style: style,
|
|
27
28
|
disabled: disabled,
|
|
@@ -29,8 +30,10 @@ export function Button({
|
|
|
29
30
|
onPressIn: onPressIn,
|
|
30
31
|
onPressOut: onPressOut,
|
|
31
32
|
hitSlop: hitSlop,
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
android_ripple: {
|
|
34
|
+
color: rippleColor ?? colors.text,
|
|
35
|
+
foreground: true
|
|
36
|
+
},
|
|
34
37
|
children: children
|
|
35
38
|
});
|
|
36
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","TouchableOpacity","
|
|
1
|
+
{"version":3,"names":["Platform","Pressable","TouchableOpacity","useColors","jsx","_jsx","Button","children","onPress","onPressIn","onPressOut","disabled","style","testID","hitSlop","rippleColor","colors","OS","android_ripple","color","text","foreground"],"sourceRoot":"../../../src","sources":["components/Button.tsx"],"mappings":";;AACA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,gBAAgB,QAAQ,cAAc;AAGpE,SAASC,SAAS,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAe7C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,MAAMA,CAAC;EACrBC,QAAQ;EACRC,OAAO;EACPC,SAAS;EACTC,UAAU;EACVC,QAAQ;EACRC,KAAK;EACLC,MAAM;EACNC,OAAO;EACPC;AACK,CAAC,EAAE;EACR,MAAMC,MAAM,GAAGb,SAAS,CAAC,CAAC;EAE1B,IAAIH,QAAQ,CAACiB,EAAE,KAAK,SAAS,EAAE;IAC7B,oBACEZ,IAAA,CAACJ,SAAS;MACRY,MAAM,EAAEA,MAAO;MACfD,KAAK,EAAEA,KAAM;MACbD,QAAQ,EAAEA,QAAS;MACnBH,OAAO,EAAEA,OAAQ;MACjBC,SAAS,EAAEA,SAAU;MACrBC,UAAU,EAAEA,UAAW;MACvBI,OAAO,EAAEA,OAAQ;MACjBI,cAAc,EAAE;QACdC,KAAK,EAAEJ,WAAW,IAAIC,MAAM,CAACI,IAAI;QACjCC,UAAU,EAAE;MACd,CAAE;MAAAd,QAAA,EAEDA;IAAQ,CACA,CAAC;EAEhB;EAEA,oBACEF,IAAA,CAACH,gBAAgB;IACfW,MAAM,EAAEA,MAAO;IACfD,KAAK,EAAEA,KAAM;IACbD,QAAQ,EAAEA,QAAS;IACnBH,OAAO,EAAEA,OAAQ;IACjBC,SAAS,EAAEA,SAAU;IACrBC,UAAU,EAAEA,UAAW;IACvBI,OAAO,EAAEA,OAAQ;IAAAP,QAAA,EAEhBA;EAAQ,CACO,CAAC;AAEvB","ignoreList":[]}
|
|
@@ -53,15 +53,24 @@ export function Chips({
|
|
|
53
53
|
disabled,
|
|
54
54
|
prefix,
|
|
55
55
|
scheme = 'surface'
|
|
56
|
-
}) => /*#__PURE__*/
|
|
56
|
+
}) => /*#__PURE__*/_jsx(Button, {
|
|
57
57
|
testID: `chip-${String(key)}`,
|
|
58
58
|
disabled: !isInteractive || disabled,
|
|
59
59
|
style: [styles.button, schemeButton[scheme], disabled ? styles.dimmed : null],
|
|
60
60
|
onPress: () => onPress?.(key),
|
|
61
|
-
children:
|
|
61
|
+
children: prefix == null ? /*#__PURE__*/_jsx(Text, {
|
|
62
62
|
color: schemeTextColor[scheme],
|
|
63
63
|
children: label
|
|
64
|
-
})
|
|
64
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
65
|
+
style: styles.row,
|
|
66
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
67
|
+
style: styles.prefix,
|
|
68
|
+
children: prefix
|
|
69
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
70
|
+
color: schemeTextColor[scheme],
|
|
71
|
+
children: label
|
|
72
|
+
})]
|
|
73
|
+
})
|
|
65
74
|
}, String(key)))
|
|
66
75
|
})
|
|
67
76
|
});
|
|
@@ -83,9 +92,15 @@ function makeStyles(t) {
|
|
|
83
92
|
borderStyle: 'solid',
|
|
84
93
|
flexDirection: 'row',
|
|
85
94
|
alignItems: 'center',
|
|
86
|
-
gap: t.spaces.horizontal.s,
|
|
87
95
|
overflow: 'hidden'
|
|
88
96
|
},
|
|
97
|
+
row: {
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
alignItems: 'center'
|
|
100
|
+
},
|
|
101
|
+
prefix: {
|
|
102
|
+
marginRight: t.spaces.horizontal.s
|
|
103
|
+
},
|
|
89
104
|
dimmed: {
|
|
90
105
|
opacity: 0.5
|
|
91
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ScrollView","StyleSheet","View","useTheme","useThemedStyles","Text","Button","jsx","_jsx","jsxs","_jsxs","Chips","data","marginB","marginT","onPress","testID","colors","styles","makeStyles","isInteractive","schemeButton","surface","borderColor","border","backgroundColor","on_surface","primary","schemeTextColor","text","style","container","marginTop","marginBottom","children","horizontal","showsHorizontalScrollIndicator","contentContainerStyle","content","map","key","label","disabled","prefix","scheme","String","button","dimmed","color","t","create","width","gap","spaces","l","paddingHorizontal","pageSpacing","m","paddingVertical","vertical","xs","borderRadius","radius_20","borderWidth","borderStyle","flexDirection","alignItems","
|
|
1
|
+
{"version":3,"names":["ScrollView","StyleSheet","View","useTheme","useThemedStyles","Text","Button","jsx","_jsx","jsxs","_jsxs","Chips","data","marginB","marginT","onPress","testID","colors","styles","makeStyles","isInteractive","schemeButton","surface","borderColor","border","backgroundColor","on_surface","primary","schemeTextColor","text","style","container","marginTop","marginBottom","children","horizontal","showsHorizontalScrollIndicator","contentContainerStyle","content","map","key","label","disabled","prefix","scheme","String","button","dimmed","color","row","t","create","width","gap","spaces","l","paddingHorizontal","pageSpacing","m","paddingVertical","vertical","xs","borderRadius","radius_20","borderWidth","borderStyle","flexDirection","alignItems","overflow","marginRight","s","opacity"],"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IACvBpB,SAAS,EAAE;MACTqB,KAAK,EAAE;IACT,CAAC;IACDd,OAAO,EAAE;MACPe,GAAG,EAAEH,CAAC,CAACI,MAAM,CAACnB,UAAU,CAACoB,CAAC;MAC1BC,iBAAiB,EAAEN,CAAC,CAACO,WAAW,CAACtB;IACnC,CAAC;IACDW,MAAM,EAAE;MACNU,iBAAiB,EAAEN,CAAC,CAACI,MAAM,CAACnB,UAAU,CAACuB,CAAC;MACxCC,eAAe,EAAET,CAAC,CAACI,MAAM,CAACM,QAAQ,CAACC,EAAE;MACrCC,YAAY,EAAEZ,CAAC,CAACY,YAAY,CAACC,SAAS;MACtCC,WAAW,EAAE,CAAC;MACdC,WAAW,EAAE,OAAO;MACpBC,aAAa,EAAE,KAAK;MACpBC,UAAU,EAAE,QAAQ;MACpBC,QAAQ,EAAE;IACZ,CAAC;IACDnB,GAAG,EAAE;MACHiB,aAAa,EAAE,KAAK;MACpBC,UAAU,EAAE;IACd,CAAC;IACDxB,MAAM,EAAE;MACN0B,WAAW,EAAEnB,CAAC,CAACI,MAAM,CAACnB,UAAU,CAACmC;IACnC,CAAC;IACDvB,MAAM,EAAE;MACNwB,OAAO,EAAE;IACX;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -21,6 +21,7 @@ export function RippleEffect({
|
|
|
21
21
|
rippleSequential = false,
|
|
22
22
|
rippleFades = true,
|
|
23
23
|
disabled = false,
|
|
24
|
+
style,
|
|
24
25
|
onLayout,
|
|
25
26
|
onPressIn,
|
|
26
27
|
onPressOut,
|
|
@@ -74,19 +75,13 @@ export function RippleEffect({
|
|
|
74
75
|
};
|
|
75
76
|
ripplesRef.current.set(ripple.unique, ripple);
|
|
76
77
|
activeRippleRef.current = ripple.unique;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}).start();
|
|
83
|
-
Animated.timing(ripple.opacity, {
|
|
84
|
-
toValue: rippleOpacity,
|
|
85
|
-
duration: Math.min(rippleDuration, PRESS_FADE_IN_DURATION),
|
|
86
|
-
useNativeDriver: true
|
|
87
|
-
}).start();
|
|
78
|
+
|
|
79
|
+
// The entrance animation is kicked off from `RippleCircle`'s mount effect,
|
|
80
|
+
// not here: on the New Architecture, starting a native-driven animation on
|
|
81
|
+
// an `Animated.Value` before its `Animated.View` is mounted leaves the
|
|
82
|
+
// native driver with no view to attach to, so the ripple never shows.
|
|
88
83
|
setRippleIds(current => current.concat(ripple.unique));
|
|
89
|
-
}, [layout.width, layout.height, onPressIn, rippleCentered,
|
|
84
|
+
}, [layout.width, layout.height, onPressIn, rippleCentered, rippleSequential, rippleSize]);
|
|
90
85
|
const handlePressOut = React.useCallback(event => {
|
|
91
86
|
onPressOut?.(event);
|
|
92
87
|
const releasedUnique = activeRippleRef.current;
|
|
@@ -118,7 +113,10 @@ export function RippleEffect({
|
|
|
118
113
|
onLayout: handleLayout,
|
|
119
114
|
onPressIn: handlePressIn,
|
|
120
115
|
onPressOut: handlePressOut,
|
|
121
|
-
children: [
|
|
116
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
117
|
+
style: style,
|
|
118
|
+
children: children
|
|
119
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
122
120
|
pointerEvents: "none",
|
|
123
121
|
style: [styles.container, {
|
|
124
122
|
borderRadius: rippleContainerBorderRadius
|
|
@@ -128,7 +126,9 @@ export function RippleEffect({
|
|
|
128
126
|
if (!ripple) return null;
|
|
129
127
|
return /*#__PURE__*/_jsx(RippleCircle, {
|
|
130
128
|
ripple: ripple,
|
|
131
|
-
color: color
|
|
129
|
+
color: color,
|
|
130
|
+
duration: rippleDuration,
|
|
131
|
+
toOpacity: rippleOpacity
|
|
132
132
|
}, id);
|
|
133
133
|
})
|
|
134
134
|
})]
|
|
@@ -136,7 +136,9 @@ export function RippleEffect({
|
|
|
136
136
|
}
|
|
137
137
|
function RippleCircleComponent({
|
|
138
138
|
ripple,
|
|
139
|
-
color
|
|
139
|
+
color,
|
|
140
|
+
duration,
|
|
141
|
+
toOpacity
|
|
140
142
|
}) {
|
|
141
143
|
const {
|
|
142
144
|
locationX,
|
|
@@ -145,6 +147,21 @@ function RippleCircleComponent({
|
|
|
145
147
|
scale,
|
|
146
148
|
opacity
|
|
147
149
|
} = ripple;
|
|
150
|
+
React.useEffect(() => {
|
|
151
|
+
Animated.timing(scale, {
|
|
152
|
+
toValue: 1,
|
|
153
|
+
duration,
|
|
154
|
+
easing: Easing.out(Easing.ease),
|
|
155
|
+
useNativeDriver: true
|
|
156
|
+
}).start();
|
|
157
|
+
Animated.timing(opacity, {
|
|
158
|
+
toValue: toOpacity,
|
|
159
|
+
duration: Math.min(duration, PRESS_FADE_IN_DURATION),
|
|
160
|
+
useNativeDriver: true
|
|
161
|
+
}).start();
|
|
162
|
+
// Entrance runs exactly once, when the ripple view mounts.
|
|
163
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
164
|
+
}, []);
|
|
148
165
|
const rippleStyle = {
|
|
149
166
|
top: locationY - CIRCLE_RADIUS,
|
|
150
167
|
[I18nManager.isRTL ? 'right' : 'left']: locationX - CIRCLE_RADIUS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Animated","Easing","I18nManager","Pressable","StyleSheet","View","useColors","jsx","_jsx","jsxs","_jsxs","CIRCLE_RADIUS","RELEASE_GROW_DURATION","RELEASE_FADE_DURATION","PRESS_FADE_IN_DURATION","RippleEffect","children","rippleColor","rippleOpacity","rippleDuration","rippleSize","rippleContainerBorderRadius","rippleCentered","rippleSequential","rippleFades","disabled","onLayout","onPressIn","onPressOut","pressableProps","colors","color","text","layout","setLayout","useState","width","height","rippleIds","setRippleIds","ripplesRef","useRef","Map","activeRippleRef","uniqueRef","handleLayout","event","nativeEvent","handlePressIn","useCallback","current","size","w2","h2","locationX","locationY","offsetX","Math","abs","offsetY","radius","sqrt","ripple","unique","scale","Value","opacity","set","
|
|
1
|
+
{"version":3,"names":["React","Animated","Easing","I18nManager","Pressable","StyleSheet","View","useColors","jsx","_jsx","jsxs","_jsxs","CIRCLE_RADIUS","RELEASE_GROW_DURATION","RELEASE_FADE_DURATION","PRESS_FADE_IN_DURATION","RippleEffect","children","rippleColor","rippleOpacity","rippleDuration","rippleSize","rippleContainerBorderRadius","rippleCentered","rippleSequential","rippleFades","disabled","style","onLayout","onPressIn","onPressOut","pressableProps","colors","color","text","layout","setLayout","useState","width","height","rippleIds","setRippleIds","ripplesRef","useRef","Map","activeRippleRef","uniqueRef","handleLayout","event","nativeEvent","handlePressIn","useCallback","current","size","w2","h2","locationX","locationY","offsetX","Math","abs","offsetY","radius","sqrt","ripple","unique","scale","Value","opacity","set","concat","handlePressOut","releasedUnique","get","removeRipple","delete","filter","id","parallel","timing","toValue","duration","useNativeDriver","start","pointerEvents","styles","container","borderRadius","map","RippleCircle","toOpacity","RippleCircleComponent","useEffect","easing","out","ease","min","rippleStyle","top","isRTL","backgroundColor","transform","interpolate","inputRange","outputRange","circle","memo","create","absoluteFillObject","overflow","position"],"sourceRoot":"../../../src","sources":["components/RippleEffect.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,SAAS,EACTC,UAAU,EACVC,IAAI,QACC,cAAc;AASrB,SAASC,SAAS,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA0B7C,MAAMC,aAAa,GAAG,EAAE;AACxB,MAAMC,qBAAqB,GAAG,GAAG;AACjC,MAAMC,qBAAqB,GAAG,GAAG;AACjC,MAAMC,sBAAsB,GAAG,EAAE;;AAEjC;AACA,OAAO,SAASC,YAAYA,CAAC;EAC3BC,QAAQ;EACRC,WAAW;EACXC,aAAa,GAAG,GAAG;EACnBC,cAAc,GAAG,GAAG;EACpBC,UAAU,GAAG,CAAC;EACdC,2BAA2B,GAAG,CAAC;EAC/BC,cAAc,GAAG,KAAK;EACtBC,g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K,CAAC,CAAC;IACV;IACA;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMc,WAAW,GAAG;IAClBC,GAAG,EAAEzC,SAAS,GAAG7C,aAAa;IAC9B,CAACT,WAAW,CAACgG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG3C,SAAS,GAAG5C,aAAa;IACjEwF,eAAe,EAAEnE,KAAK;IACtBmC,OAAO;IACPiC,SAAS,EAAE,CACT;MACEnC,KAAK,EAAEA,KAAK,CAACoC,WAAW,CAAC;QACvBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAClBC,WAAW,EAAE,CAAC,GAAG,GAAG5F,aAAa,EAAEkD,MAAM,GAAGlD,aAAa;MAC3D,CAAC;IACH,CAAC;EAEL,CAAC;EAED,oBAAOH,IAAA,CAACR,QAAQ,CAACK,IAAI;IAACqB,KAAK,EAAE,CAAC0D,MAAM,CAACoB,MAAM,EAAER,WAAW;EAAE,CAAE,CAAC;AAC/D;AAEA,MAAMR,YAAY,gBAAGzF,KAAK,CAAC0G,IAAI,CAACf,qBAAqB,CAAC;AAEtD,MAAMN,MAAM,GAAGhF,UAAU,CAACsG,MAAM,CAAC;EAC/BrB,SAAS,EAAE;IACT,GAAGjF,UAAU,CAACuG,kBAAkB;IAChCC,QAAQ,EAAE;EACZ,CAAC;EACDJ,MAAM,EAAE;IACNnE,KAAK,EAAE1B,aAAa,GAAG,CAAC;IACxB2B,MAAM,EAAE3B,aAAa,GAAG,CAAC;IACzB2E,YAAY,EAAE3E,aAAa;IAC3BiG,QAAQ,EAAE,QAAQ;IAClBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -9,16 +9,15 @@ type Props = {
|
|
|
9
9
|
style?: StyleProp<ViewStyle>;
|
|
10
10
|
testID?: string;
|
|
11
11
|
hitSlop?: Insets;
|
|
12
|
-
/** Android only. */
|
|
12
|
+
/** Android only. Ripple color. Defaults to the theme `text` color. */
|
|
13
13
|
rippleColor?: string;
|
|
14
|
-
/** Android only. */
|
|
15
|
-
rippleContainerBorderRadius?: number;
|
|
16
14
|
};
|
|
17
15
|
/**
|
|
18
|
-
* Base pressable. Android gets
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* Base pressable. Android gets the platform touch ripple (drawn in the
|
|
17
|
+
* foreground and clipped to the view's own shape); every other platform gets
|
|
18
|
+
* opacity feedback. Kept in one file (not `.ios`/`.android`) so consumers' type
|
|
19
|
+
* resolution works without `moduleSuffixes`.
|
|
21
20
|
*/
|
|
22
|
-
export declare function Button({ children, onPress, onPressIn, onPressOut, disabled, style, testID, hitSlop, rippleColor,
|
|
21
|
+
export declare function Button({ children, onPress, onPressIn, onPressOut, disabled, style, testID, hitSlop, rippleColor, }: Props): import("react").JSX.Element;
|
|
23
22
|
export {};
|
|
24
23
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIjE,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KA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AM,GACP,EAAE,KAAK,CAAC,IAAI,CAAC,+BA6Db"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { PressableProps } from 'react-native';
|
|
3
|
-
type Props = PressableProps & {
|
|
2
|
+
import type { PressableProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
type Props = Omit<PressableProps, 'style'> & {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
+
/** Applied to an inner wrapper around `children`, not to the pressable. */
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
5
7
|
/** Ripple color. Default: theme `text`. */
|
|
6
8
|
rippleColor?: string;
|
|
7
9
|
rippleOpacity?: number;
|
|
@@ -13,6 +15,6 @@ type Props = PressableProps & {
|
|
|
13
15
|
rippleFades?: boolean;
|
|
14
16
|
};
|
|
15
17
|
/** Wraps a child and paints a touch ripple at the press location. */
|
|
16
|
-
export declare function RippleEffect({ children, rippleColor, rippleOpacity, rippleDuration, rippleSize, rippleContainerBorderRadius, rippleCentered, rippleSequential, rippleFades, disabled, onLayout, onPressIn, onPressOut, ...pressableProps }: Props): React.JSX.Element;
|
|
18
|
+
export declare function RippleEffect({ children, rippleColor, rippleOpacity, rippleDuration, rippleSize, rippleContainerBorderRadius, rippleCentered, rippleSequential, rippleFades, disabled, style, onLayout, onPressIn, onPressOut, ...pressableProps }: Props): React.JSX.Element;
|
|
17
19
|
export {};
|
|
18
20
|
//# sourceMappingURL=RippleEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RippleEffect.d.ts","sourceRoot":"","sources":["../../../../src/components/RippleEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAGV,cAAc,
|
|
1
|
+
{"version":3,"file":"RippleEffect.d.ts","sourceRoot":"","sources":["../../../../src/components/RippleEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAGV,cAAc,EACd,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAatB,KAAK,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAOF,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,WAAW,EACX,aAAmB,EACnB,cAAoB,EACpB,UAAc,EACd,2BAA+B,EAC/B,cAAsB,EACtB,gBAAwB,EACxB,WAAkB,EAClB,QAAgB,EAChB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,GAAG,cAAc,EAClB,EAAE,KAAK,qBA6IP"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { Platform, TouchableOpacity } from 'react-native';
|
|
2
|
+
import { Platform, Pressable, TouchableOpacity } from 'react-native';
|
|
3
3
|
import type { Insets, StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useColors } from '../ThemeProvider';
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
8
|
children: ReactNode;
|
|
@@ -13,16 +13,15 @@ type Props = {
|
|
|
13
13
|
style?: StyleProp<ViewStyle>;
|
|
14
14
|
testID?: string;
|
|
15
15
|
hitSlop?: Insets;
|
|
16
|
-
/** Android only. */
|
|
16
|
+
/** Android only. Ripple color. Defaults to the theme `text` color. */
|
|
17
17
|
rippleColor?: string;
|
|
18
|
-
/** Android only. */
|
|
19
|
-
rippleContainerBorderRadius?: number;
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
|
-
* Base pressable. Android gets
|
|
24
|
-
*
|
|
25
|
-
*
|
|
21
|
+
* Base pressable. Android gets the platform touch ripple (drawn in the
|
|
22
|
+
* foreground and clipped to the view's own shape); every other platform gets
|
|
23
|
+
* opacity feedback. Kept in one file (not `.ios`/`.android`) so consumers' type
|
|
24
|
+
* resolution works without `moduleSuffixes`.
|
|
26
25
|
*/
|
|
27
26
|
export function Button({
|
|
28
27
|
children,
|
|
@@ -34,11 +33,12 @@ export function Button({
|
|
|
34
33
|
testID,
|
|
35
34
|
hitSlop,
|
|
36
35
|
rippleColor,
|
|
37
|
-
rippleContainerBorderRadius,
|
|
38
36
|
}: Props) {
|
|
37
|
+
const colors = useColors();
|
|
38
|
+
|
|
39
39
|
if (Platform.OS === 'android') {
|
|
40
40
|
return (
|
|
41
|
-
<
|
|
41
|
+
<Pressable
|
|
42
42
|
testID={testID}
|
|
43
43
|
style={style}
|
|
44
44
|
disabled={disabled}
|
|
@@ -46,11 +46,13 @@ export function Button({
|
|
|
46
46
|
onPressIn={onPressIn}
|
|
47
47
|
onPressOut={onPressOut}
|
|
48
48
|
hitSlop={hitSlop}
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
android_ripple={{
|
|
50
|
+
color: rippleColor ?? colors.text,
|
|
51
|
+
foreground: true,
|
|
52
|
+
}}
|
|
51
53
|
>
|
|
52
54
|
{children}
|
|
53
|
-
</
|
|
55
|
+
</Pressable>
|
|
54
56
|
);
|
|
55
57
|
}
|
|
56
58
|
|
package/src/components/Chips.tsx
CHANGED
|
@@ -79,8 +79,17 @@ export function Chips<Item>({
|
|
|
79
79
|
]}
|
|
80
80
|
onPress={() => onPress?.(key)}
|
|
81
81
|
>
|
|
82
|
-
{prefix
|
|
83
|
-
|
|
82
|
+
{/* Keep this a single child when there is no prefix — a falsy
|
|
83
|
+
leading child still reserves a flex `gap` slot on the New
|
|
84
|
+
Architecture, which reads as extra padding on the label side. */}
|
|
85
|
+
{prefix == null ? (
|
|
86
|
+
<Text color={schemeTextColor[scheme]}>{label}</Text>
|
|
87
|
+
) : (
|
|
88
|
+
<View style={styles.row}>
|
|
89
|
+
<View style={styles.prefix}>{prefix}</View>
|
|
90
|
+
<Text color={schemeTextColor[scheme]}>{label}</Text>
|
|
91
|
+
</View>
|
|
92
|
+
)}
|
|
84
93
|
</Button>
|
|
85
94
|
))}
|
|
86
95
|
</ScrollView>
|
|
@@ -105,9 +114,15 @@ function makeStyles(t: ThemeType) {
|
|
|
105
114
|
borderStyle: 'solid',
|
|
106
115
|
flexDirection: 'row',
|
|
107
116
|
alignItems: 'center',
|
|
108
|
-
gap: t.spaces.horizontal.s,
|
|
109
117
|
overflow: 'hidden',
|
|
110
118
|
},
|
|
119
|
+
row: {
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
},
|
|
123
|
+
prefix: {
|
|
124
|
+
marginRight: t.spaces.horizontal.s,
|
|
125
|
+
},
|
|
111
126
|
dimmed: {
|
|
112
127
|
opacity: 0.5,
|
|
113
128
|
},
|
|
@@ -11,6 +11,8 @@ import type {
|
|
|
11
11
|
GestureResponderEvent,
|
|
12
12
|
LayoutChangeEvent,
|
|
13
13
|
PressableProps,
|
|
14
|
+
StyleProp,
|
|
15
|
+
ViewStyle,
|
|
14
16
|
} from 'react-native';
|
|
15
17
|
|
|
16
18
|
import { useColors } from '../ThemeProvider';
|
|
@@ -24,8 +26,10 @@ type RippleItemType = {
|
|
|
24
26
|
opacity: Animated.Value;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
type Props = PressableProps & {
|
|
29
|
+
type Props = Omit<PressableProps, 'style'> & {
|
|
28
30
|
children: React.ReactNode;
|
|
31
|
+
/** Applied to an inner wrapper around `children`, not to the pressable. */
|
|
32
|
+
style?: StyleProp<ViewStyle>;
|
|
29
33
|
/** Ripple color. Default: theme `text`. */
|
|
30
34
|
rippleColor?: string;
|
|
31
35
|
rippleOpacity?: number;
|
|
@@ -54,6 +58,7 @@ export function RippleEffect({
|
|
|
54
58
|
rippleSequential = false,
|
|
55
59
|
rippleFades = true,
|
|
56
60
|
disabled = false,
|
|
61
|
+
style,
|
|
57
62
|
onLayout,
|
|
58
63
|
onPressIn,
|
|
59
64
|
onPressOut,
|
|
@@ -109,19 +114,10 @@ export function RippleEffect({
|
|
|
109
114
|
ripplesRef.current.set(ripple.unique, ripple);
|
|
110
115
|
activeRippleRef.current = ripple.unique;
|
|
111
116
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
useNativeDriver: true,
|
|
117
|
-
}).start();
|
|
118
|
-
|
|
119
|
-
Animated.timing(ripple.opacity, {
|
|
120
|
-
toValue: rippleOpacity,
|
|
121
|
-
duration: Math.min(rippleDuration, PRESS_FADE_IN_DURATION),
|
|
122
|
-
useNativeDriver: true,
|
|
123
|
-
}).start();
|
|
124
|
-
|
|
117
|
+
// The entrance animation is kicked off from `RippleCircle`'s mount effect,
|
|
118
|
+
// not here: on the New Architecture, starting a native-driven animation on
|
|
119
|
+
// an `Animated.Value` before its `Animated.View` is mounted leaves the
|
|
120
|
+
// native driver with no view to attach to, so the ripple never shows.
|
|
125
121
|
setRippleIds((current) => current.concat(ripple.unique));
|
|
126
122
|
},
|
|
127
123
|
[
|
|
@@ -129,8 +125,6 @@ export function RippleEffect({
|
|
|
129
125
|
layout.height,
|
|
130
126
|
onPressIn,
|
|
131
127
|
rippleCentered,
|
|
132
|
-
rippleDuration,
|
|
133
|
-
rippleOpacity,
|
|
134
128
|
rippleSequential,
|
|
135
129
|
rippleSize,
|
|
136
130
|
]
|
|
@@ -183,7 +177,10 @@ export function RippleEffect({
|
|
|
183
177
|
onPressIn={handlePressIn}
|
|
184
178
|
onPressOut={handlePressOut}
|
|
185
179
|
>
|
|
186
|
-
{
|
|
180
|
+
{/* The caller's `style` (often a flex row with `justifyContent`) is
|
|
181
|
+
applied here, wrapping only the real children — so the absolutely
|
|
182
|
+
positioned ripple layer below can never take part in that layout. */}
|
|
183
|
+
<View style={style}>{children}</View>
|
|
187
184
|
<View
|
|
188
185
|
pointerEvents="none"
|
|
189
186
|
style={[
|
|
@@ -194,7 +191,15 @@ export function RippleEffect({
|
|
|
194
191
|
{rippleIds.map((id) => {
|
|
195
192
|
const ripple = ripplesRef.current.get(id);
|
|
196
193
|
if (!ripple) return null;
|
|
197
|
-
return
|
|
194
|
+
return (
|
|
195
|
+
<RippleCircle
|
|
196
|
+
key={id}
|
|
197
|
+
ripple={ripple}
|
|
198
|
+
color={color}
|
|
199
|
+
duration={rippleDuration}
|
|
200
|
+
toOpacity={rippleOpacity}
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
198
203
|
})}
|
|
199
204
|
</View>
|
|
200
205
|
</Pressable>
|
|
@@ -204,11 +209,35 @@ export function RippleEffect({
|
|
|
204
209
|
type RippleCircleProps = {
|
|
205
210
|
ripple: RippleItemType;
|
|
206
211
|
color: string;
|
|
212
|
+
duration: number;
|
|
213
|
+
toOpacity: number;
|
|
207
214
|
};
|
|
208
215
|
|
|
209
|
-
function RippleCircleComponent({
|
|
216
|
+
function RippleCircleComponent({
|
|
217
|
+
ripple,
|
|
218
|
+
color,
|
|
219
|
+
duration,
|
|
220
|
+
toOpacity,
|
|
221
|
+
}: RippleCircleProps) {
|
|
210
222
|
const { locationX, locationY, radius, scale, opacity } = ripple;
|
|
211
223
|
|
|
224
|
+
React.useEffect(() => {
|
|
225
|
+
Animated.timing(scale, {
|
|
226
|
+
toValue: 1,
|
|
227
|
+
duration,
|
|
228
|
+
easing: Easing.out(Easing.ease),
|
|
229
|
+
useNativeDriver: true,
|
|
230
|
+
}).start();
|
|
231
|
+
|
|
232
|
+
Animated.timing(opacity, {
|
|
233
|
+
toValue: toOpacity,
|
|
234
|
+
duration: Math.min(duration, PRESS_FADE_IN_DURATION),
|
|
235
|
+
useNativeDriver: true,
|
|
236
|
+
}).start();
|
|
237
|
+
// Entrance runs exactly once, when the ripple view mounts.
|
|
238
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
239
|
+
}, []);
|
|
240
|
+
|
|
212
241
|
const rippleStyle = {
|
|
213
242
|
top: locationY - CIRCLE_RADIUS,
|
|
214
243
|
[I18nManager.isRTL ? 'right' : 'left']: locationX - CIRCLE_RADIUS,
|