@xaui/native 0.2.7 → 0.9.1-alpha.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/dist/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -356
- package/dist/alert/index.d.cts +0 -90
- package/dist/alert/index.d.ts +0 -90
- package/dist/alert/index.js +0 -356
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
package/dist/radio/index.js
DELETED
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
import "../chunk-SHBDANQN.js";
|
|
2
|
-
import {
|
|
3
|
-
useXUITheme
|
|
4
|
-
} from "../chunk-RBSA4NH4.js";
|
|
5
|
-
|
|
6
|
-
// src/components/radio/radio.tsx
|
|
7
|
-
import React2, { useContext, useEffect, useRef, useState } from "react";
|
|
8
|
-
import { Animated as Animated2, Pressable, Text } from "react-native";
|
|
9
|
-
import { getSafeThemeColor as getSafeThemeColor2 } from "@xaui/core";
|
|
10
|
-
|
|
11
|
-
// src/components/radio/radio-context.ts
|
|
12
|
-
import React from "react";
|
|
13
|
-
var RadioGroupContext = React.createContext(
|
|
14
|
-
null
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
// src/components/radio/radio.hook.ts
|
|
18
|
-
import { useMemo } from "react";
|
|
19
|
-
import { getSafeThemeColor } from "@xaui/core";
|
|
20
|
-
function useSizeStyles(size, variant) {
|
|
21
|
-
const theme = useXUITheme();
|
|
22
|
-
const sizeStyles = useMemo(() => {
|
|
23
|
-
const sizes = {
|
|
24
|
-
xs: {
|
|
25
|
-
radioSize: 14,
|
|
26
|
-
fontSize: theme.fontSizes.xs,
|
|
27
|
-
dotSize: variant === "light" ? 5 : 4
|
|
28
|
-
},
|
|
29
|
-
sm: {
|
|
30
|
-
radioSize: 18,
|
|
31
|
-
fontSize: theme.fontSizes.sm,
|
|
32
|
-
dotSize: variant === "light" ? 7 : 6
|
|
33
|
-
},
|
|
34
|
-
md: {
|
|
35
|
-
radioSize: 22,
|
|
36
|
-
fontSize: theme.fontSizes.md,
|
|
37
|
-
dotSize: variant === "light" ? 9 : 8
|
|
38
|
-
},
|
|
39
|
-
lg: {
|
|
40
|
-
radioSize: 26,
|
|
41
|
-
fontSize: theme.fontSizes.lg,
|
|
42
|
-
dotSize: variant === "light" ? 11 : 10
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return sizes[size];
|
|
46
|
-
}, [size, theme, variant]);
|
|
47
|
-
return sizeStyles;
|
|
48
|
-
}
|
|
49
|
-
function useRadiusStyles(radius) {
|
|
50
|
-
const theme = useXUITheme();
|
|
51
|
-
const radiusStyles = useMemo(() => {
|
|
52
|
-
const radii = {
|
|
53
|
-
none: theme.borderRadius.none,
|
|
54
|
-
sm: theme.borderRadius.sm,
|
|
55
|
-
md: theme.borderRadius.md,
|
|
56
|
-
lg: theme.borderRadius.lg,
|
|
57
|
-
full: theme.borderRadius.full
|
|
58
|
-
};
|
|
59
|
-
return { borderRadius: radii[radius] };
|
|
60
|
-
}, [radius, theme]);
|
|
61
|
-
return radiusStyles;
|
|
62
|
-
}
|
|
63
|
-
function useDotColors(themeColor, variant, isActive) {
|
|
64
|
-
const theme = useXUITheme();
|
|
65
|
-
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
66
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
67
|
-
const dotColors = useMemo(() => {
|
|
68
|
-
if (!isActive) {
|
|
69
|
-
return {
|
|
70
|
-
checked: "transparent"
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
if (variant === "filled") {
|
|
74
|
-
return {
|
|
75
|
-
checked: colorScheme.onMain
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
checked: colorScheme.main
|
|
80
|
-
};
|
|
81
|
-
}, [colorScheme, isActive, variant]);
|
|
82
|
-
return dotColors;
|
|
83
|
-
}
|
|
84
|
-
function useVariantStyles(themeColor, variant, isActive) {
|
|
85
|
-
const theme = useXUITheme();
|
|
86
|
-
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
87
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
88
|
-
const variantStyles = useMemo(() => {
|
|
89
|
-
if (variant === "filled") {
|
|
90
|
-
return {
|
|
91
|
-
backgroundColor: isActive ? colorScheme.main : "transparent",
|
|
92
|
-
borderWidth: isActive ? 0 : theme.borderWidth.md,
|
|
93
|
-
borderColor: isActive ? "transparent" : colorScheme.main
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
backgroundColor: "transparent",
|
|
98
|
-
borderWidth: theme.borderWidth.md,
|
|
99
|
-
borderColor: colorScheme.main
|
|
100
|
-
};
|
|
101
|
-
}, [colorScheme.main, isActive, theme.borderWidth.md, variant]);
|
|
102
|
-
return variantStyles;
|
|
103
|
-
}
|
|
104
|
-
function useContainerStyles(labelAlignment) {
|
|
105
|
-
const containerStyles = useMemo(() => {
|
|
106
|
-
const isJustified = labelAlignment === "justify-left" || labelAlignment === "justify-right";
|
|
107
|
-
return {
|
|
108
|
-
flexDirection: labelAlignment === "left" || labelAlignment === "justify-left" ? "row-reverse" : "row",
|
|
109
|
-
justifyContent: isJustified ? "space-between" : "flex-start"
|
|
110
|
-
};
|
|
111
|
-
}, [labelAlignment]);
|
|
112
|
-
return containerStyles;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/components/radio/radio.style.ts
|
|
116
|
-
import { StyleSheet } from "react-native";
|
|
117
|
-
var styles = StyleSheet.create({
|
|
118
|
-
group: {
|
|
119
|
-
width: "100%"
|
|
120
|
-
},
|
|
121
|
-
container: {
|
|
122
|
-
flexDirection: "row",
|
|
123
|
-
alignItems: "center",
|
|
124
|
-
gap: 10
|
|
125
|
-
},
|
|
126
|
-
fullWidth: {
|
|
127
|
-
flexShrink: 1,
|
|
128
|
-
flexBasis: "auto",
|
|
129
|
-
width: "100%"
|
|
130
|
-
},
|
|
131
|
-
radio: {
|
|
132
|
-
alignItems: "center",
|
|
133
|
-
justifyContent: "center",
|
|
134
|
-
overflow: "hidden",
|
|
135
|
-
position: "relative"
|
|
136
|
-
},
|
|
137
|
-
background: {
|
|
138
|
-
position: "absolute",
|
|
139
|
-
width: "100%",
|
|
140
|
-
height: "100%"
|
|
141
|
-
},
|
|
142
|
-
dot: {
|
|
143
|
-
zIndex: 10
|
|
144
|
-
},
|
|
145
|
-
label: {
|
|
146
|
-
fontWeight: "400"
|
|
147
|
-
},
|
|
148
|
-
disabled: {
|
|
149
|
-
opacity: 0.5
|
|
150
|
-
},
|
|
151
|
-
disabledText: {
|
|
152
|
-
opacity: 0.7
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// src/components/radio/radio.animation.ts
|
|
157
|
-
import { Animated } from "react-native";
|
|
158
|
-
var runDotInAnimation = (dotScale, dotOpacity) => {
|
|
159
|
-
Animated.parallel([
|
|
160
|
-
Animated.spring(dotScale, {
|
|
161
|
-
toValue: 1,
|
|
162
|
-
useNativeDriver: true,
|
|
163
|
-
tension: 90,
|
|
164
|
-
friction: 9
|
|
165
|
-
}),
|
|
166
|
-
Animated.timing(dotOpacity, {
|
|
167
|
-
toValue: 1,
|
|
168
|
-
duration: 180,
|
|
169
|
-
useNativeDriver: true
|
|
170
|
-
})
|
|
171
|
-
]).start();
|
|
172
|
-
};
|
|
173
|
-
var runDotOutAnimation = (dotScale, dotOpacity) => {
|
|
174
|
-
Animated.parallel([
|
|
175
|
-
Animated.spring(dotScale, {
|
|
176
|
-
toValue: 0,
|
|
177
|
-
useNativeDriver: true,
|
|
178
|
-
tension: 90,
|
|
179
|
-
friction: 9
|
|
180
|
-
}),
|
|
181
|
-
Animated.timing(dotOpacity, {
|
|
182
|
-
toValue: 0,
|
|
183
|
-
duration: 140,
|
|
184
|
-
useNativeDriver: true
|
|
185
|
-
})
|
|
186
|
-
]).start();
|
|
187
|
-
};
|
|
188
|
-
var runBackgroundInAnimation = (backgroundScale, backgroundOpacity) => {
|
|
189
|
-
Animated.parallel([
|
|
190
|
-
Animated.timing(backgroundScale, {
|
|
191
|
-
toValue: 1,
|
|
192
|
-
duration: 200,
|
|
193
|
-
useNativeDriver: true
|
|
194
|
-
}),
|
|
195
|
-
Animated.timing(backgroundOpacity, {
|
|
196
|
-
toValue: 1,
|
|
197
|
-
duration: 200,
|
|
198
|
-
useNativeDriver: true
|
|
199
|
-
})
|
|
200
|
-
]).start();
|
|
201
|
-
};
|
|
202
|
-
var runBackgroundOutAnimation = (backgroundScale, backgroundOpacity) => {
|
|
203
|
-
Animated.parallel([
|
|
204
|
-
Animated.timing(backgroundScale, {
|
|
205
|
-
toValue: 0.5,
|
|
206
|
-
duration: 200,
|
|
207
|
-
useNativeDriver: true
|
|
208
|
-
}),
|
|
209
|
-
Animated.timing(backgroundOpacity, {
|
|
210
|
-
toValue: 0,
|
|
211
|
-
duration: 200,
|
|
212
|
-
useNativeDriver: true
|
|
213
|
-
})
|
|
214
|
-
]).start();
|
|
215
|
-
};
|
|
216
|
-
var runPressInAnimation = (scale) => {
|
|
217
|
-
Animated.spring(scale, {
|
|
218
|
-
toValue: 0.95,
|
|
219
|
-
useNativeDriver: true
|
|
220
|
-
}).start();
|
|
221
|
-
};
|
|
222
|
-
var runPressOutAnimation = (scale) => {
|
|
223
|
-
Animated.spring(scale, {
|
|
224
|
-
toValue: 1,
|
|
225
|
-
useNativeDriver: true
|
|
226
|
-
}).start();
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// src/components/radio/radio.tsx
|
|
230
|
-
var Radio = ({
|
|
231
|
-
label,
|
|
232
|
-
value,
|
|
233
|
-
labelAlignment,
|
|
234
|
-
themeColor,
|
|
235
|
-
variant,
|
|
236
|
-
size,
|
|
237
|
-
radius,
|
|
238
|
-
fullWidth,
|
|
239
|
-
isChecked: isCheckedProp,
|
|
240
|
-
defaultChecked = false,
|
|
241
|
-
isDisabled,
|
|
242
|
-
labelStyle,
|
|
243
|
-
style,
|
|
244
|
-
onValueChange
|
|
245
|
-
}) => {
|
|
246
|
-
const group = useContext(RadioGroupContext);
|
|
247
|
-
const theme = useXUITheme();
|
|
248
|
-
const resolvedLabelAlignment = labelAlignment ?? group?.labelAlignment ?? "right";
|
|
249
|
-
const resolvedThemeColor = themeColor ?? group?.themeColor ?? "primary";
|
|
250
|
-
const resolvedVariant = variant ?? group?.variant ?? "filled";
|
|
251
|
-
const resolvedSize = size ?? group?.size ?? "md";
|
|
252
|
-
const resolvedRadius = radius ?? group?.radius ?? "full";
|
|
253
|
-
const resolvedFullWidth = fullWidth ?? group?.fullWidth ?? false;
|
|
254
|
-
const resolvedDisabled = !!(isDisabled || group?.isDisabled);
|
|
255
|
-
const isInGroup = !!group && typeof value === "string";
|
|
256
|
-
const isControlledStandalone = typeof isCheckedProp === "boolean";
|
|
257
|
-
const [internalChecked, setInternalChecked] = useState(defaultChecked);
|
|
258
|
-
const groupChecked = isInGroup ? group.selectedValue === value : false;
|
|
259
|
-
const isChecked = isInGroup ? groupChecked : isControlledStandalone ? isCheckedProp : internalChecked;
|
|
260
|
-
const colorScheme = theme.colors[getSafeThemeColor2(resolvedThemeColor)];
|
|
261
|
-
const scale = useRef(new Animated2.Value(1)).current;
|
|
262
|
-
const backgroundScale = useRef(new Animated2.Value(0.5)).current;
|
|
263
|
-
const backgroundOpacity = useRef(new Animated2.Value(0)).current;
|
|
264
|
-
const dotScale = useRef(new Animated2.Value(isChecked ? 1 : 0)).current;
|
|
265
|
-
const dotOpacity = useRef(new Animated2.Value(isChecked ? 1 : 0)).current;
|
|
266
|
-
const sizeStyles = useSizeStyles(resolvedSize, resolvedVariant);
|
|
267
|
-
const radiusStyles = useRadiusStyles(resolvedRadius);
|
|
268
|
-
const dotColors = useDotColors(resolvedThemeColor, resolvedVariant, isChecked);
|
|
269
|
-
const variantStyles = useVariantStyles(
|
|
270
|
-
resolvedThemeColor,
|
|
271
|
-
resolvedVariant,
|
|
272
|
-
isChecked
|
|
273
|
-
);
|
|
274
|
-
const containerStyles = useContainerStyles(resolvedLabelAlignment);
|
|
275
|
-
useEffect(() => {
|
|
276
|
-
if (resolvedVariant !== "filled") return;
|
|
277
|
-
if (isChecked) {
|
|
278
|
-
runBackgroundInAnimation(backgroundScale, backgroundOpacity);
|
|
279
|
-
} else {
|
|
280
|
-
runBackgroundOutAnimation(backgroundScale, backgroundOpacity);
|
|
281
|
-
}
|
|
282
|
-
}, [backgroundOpacity, backgroundScale, isChecked, resolvedVariant]);
|
|
283
|
-
useEffect(() => {
|
|
284
|
-
if (isChecked) {
|
|
285
|
-
runDotInAnimation(dotScale, dotOpacity);
|
|
286
|
-
} else {
|
|
287
|
-
runDotOutAnimation(dotScale, dotOpacity);
|
|
288
|
-
}
|
|
289
|
-
}, [dotOpacity, dotScale, isChecked]);
|
|
290
|
-
const handlePress = () => {
|
|
291
|
-
if (resolvedDisabled || isChecked) return;
|
|
292
|
-
if (isInGroup && value) {
|
|
293
|
-
group.onValueChange?.(value);
|
|
294
|
-
onValueChange?.(true);
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
if (!isControlledStandalone) {
|
|
298
|
-
setInternalChecked(true);
|
|
299
|
-
}
|
|
300
|
-
onValueChange?.(true);
|
|
301
|
-
};
|
|
302
|
-
const handlePressIn = () => {
|
|
303
|
-
if (resolvedDisabled) return;
|
|
304
|
-
runPressInAnimation(scale);
|
|
305
|
-
};
|
|
306
|
-
const handlePressOut = () => {
|
|
307
|
-
if (resolvedDisabled) return;
|
|
308
|
-
runPressOutAnimation(scale);
|
|
309
|
-
};
|
|
310
|
-
return /* @__PURE__ */ React2.createElement(
|
|
311
|
-
Pressable,
|
|
312
|
-
{
|
|
313
|
-
onPress: handlePress,
|
|
314
|
-
onPressIn: handlePressIn,
|
|
315
|
-
onPressOut: handlePressOut,
|
|
316
|
-
disabled: resolvedDisabled,
|
|
317
|
-
accessible: true,
|
|
318
|
-
accessibilityRole: "radio",
|
|
319
|
-
accessibilityLabel: label,
|
|
320
|
-
accessibilityState: {
|
|
321
|
-
disabled: resolvedDisabled,
|
|
322
|
-
checked: !!isChecked
|
|
323
|
-
},
|
|
324
|
-
style: [
|
|
325
|
-
styles.container,
|
|
326
|
-
containerStyles,
|
|
327
|
-
resolvedFullWidth && styles.fullWidth,
|
|
328
|
-
resolvedDisabled && styles.disabled,
|
|
329
|
-
style
|
|
330
|
-
]
|
|
331
|
-
},
|
|
332
|
-
/* @__PURE__ */ React2.createElement(
|
|
333
|
-
Animated2.View,
|
|
334
|
-
{
|
|
335
|
-
style: [
|
|
336
|
-
styles.radio,
|
|
337
|
-
{
|
|
338
|
-
width: sizeStyles.radioSize,
|
|
339
|
-
height: sizeStyles.radioSize,
|
|
340
|
-
...radiusStyles,
|
|
341
|
-
...variantStyles
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
transform: [{ scale }]
|
|
345
|
-
}
|
|
346
|
-
]
|
|
347
|
-
},
|
|
348
|
-
resolvedVariant === "filled" && /* @__PURE__ */ React2.createElement(
|
|
349
|
-
Animated2.View,
|
|
350
|
-
{
|
|
351
|
-
style: [
|
|
352
|
-
styles.background,
|
|
353
|
-
radiusStyles,
|
|
354
|
-
{
|
|
355
|
-
backgroundColor: colorScheme.main,
|
|
356
|
-
transform: [{ scale: backgroundScale }],
|
|
357
|
-
opacity: backgroundOpacity
|
|
358
|
-
}
|
|
359
|
-
]
|
|
360
|
-
}
|
|
361
|
-
),
|
|
362
|
-
/* @__PURE__ */ React2.createElement(
|
|
363
|
-
Animated2.View,
|
|
364
|
-
{
|
|
365
|
-
style: [
|
|
366
|
-
styles.dot,
|
|
367
|
-
{
|
|
368
|
-
width: sizeStyles.dotSize,
|
|
369
|
-
height: sizeStyles.dotSize,
|
|
370
|
-
borderRadius: sizeStyles.dotSize / 2,
|
|
371
|
-
backgroundColor: dotColors.checked,
|
|
372
|
-
opacity: dotOpacity,
|
|
373
|
-
transform: [{ scale: dotScale }]
|
|
374
|
-
}
|
|
375
|
-
]
|
|
376
|
-
}
|
|
377
|
-
)
|
|
378
|
-
),
|
|
379
|
-
label && /* @__PURE__ */ React2.createElement(
|
|
380
|
-
Text,
|
|
381
|
-
{
|
|
382
|
-
style: [
|
|
383
|
-
styles.label,
|
|
384
|
-
{ fontSize: sizeStyles.fontSize, color: theme.colors.foreground },
|
|
385
|
-
resolvedDisabled && styles.disabledText,
|
|
386
|
-
labelStyle
|
|
387
|
-
]
|
|
388
|
-
},
|
|
389
|
-
label
|
|
390
|
-
)
|
|
391
|
-
);
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
// src/components/radio/radio-group.tsx
|
|
395
|
-
import React3, { useMemo as useMemo2, useState as useState2 } from "react";
|
|
396
|
-
import { View } from "react-native";
|
|
397
|
-
var RadioGroup = ({
|
|
398
|
-
children,
|
|
399
|
-
value,
|
|
400
|
-
defaultValue,
|
|
401
|
-
onValueChange,
|
|
402
|
-
isDisabled = false,
|
|
403
|
-
themeColor = "primary",
|
|
404
|
-
variant = "filled",
|
|
405
|
-
size = "md",
|
|
406
|
-
radius = "full",
|
|
407
|
-
labelAlignment = "right",
|
|
408
|
-
fullWidth = false,
|
|
409
|
-
orientation = "vertical",
|
|
410
|
-
gap,
|
|
411
|
-
style
|
|
412
|
-
}) => {
|
|
413
|
-
const theme = useXUITheme();
|
|
414
|
-
const isControlled = typeof value === "string";
|
|
415
|
-
const [internalValue, setInternalValue] = useState2(defaultValue);
|
|
416
|
-
const selectedValue = isControlled ? value : internalValue;
|
|
417
|
-
const handleValueChange = (nextValue) => {
|
|
418
|
-
if (nextValue === selectedValue) return;
|
|
419
|
-
if (!isControlled) {
|
|
420
|
-
setInternalValue(nextValue);
|
|
421
|
-
}
|
|
422
|
-
onValueChange?.(nextValue);
|
|
423
|
-
};
|
|
424
|
-
const contextValue = useMemo2(
|
|
425
|
-
() => ({
|
|
426
|
-
selectedValue,
|
|
427
|
-
isDisabled,
|
|
428
|
-
themeColor,
|
|
429
|
-
variant,
|
|
430
|
-
size,
|
|
431
|
-
radius,
|
|
432
|
-
labelAlignment,
|
|
433
|
-
fullWidth,
|
|
434
|
-
onValueChange: handleValueChange
|
|
435
|
-
}),
|
|
436
|
-
[
|
|
437
|
-
fullWidth,
|
|
438
|
-
isDisabled,
|
|
439
|
-
labelAlignment,
|
|
440
|
-
radius,
|
|
441
|
-
selectedValue,
|
|
442
|
-
size,
|
|
443
|
-
themeColor,
|
|
444
|
-
variant
|
|
445
|
-
]
|
|
446
|
-
);
|
|
447
|
-
return /* @__PURE__ */ React3.createElement(RadioGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ React3.createElement(
|
|
448
|
-
View,
|
|
449
|
-
{
|
|
450
|
-
style: [
|
|
451
|
-
styles.group,
|
|
452
|
-
{
|
|
453
|
-
flexDirection: orientation === "horizontal" ? "row" : "column",
|
|
454
|
-
gap: gap ?? theme.spacing.sm
|
|
455
|
-
},
|
|
456
|
-
style
|
|
457
|
-
]
|
|
458
|
-
},
|
|
459
|
-
children
|
|
460
|
-
));
|
|
461
|
-
};
|
|
462
|
-
export {
|
|
463
|
-
Radio,
|
|
464
|
-
RadioGroup
|
|
465
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('../chunk-56RPWZD2.cjs');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
5
|
-
|
|
6
|
-
// src/components/refresh-control/refresh-control.tsx
|
|
7
|
-
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
-
var _reactnative = require('react-native');
|
|
9
|
-
var PullToRefresh = ({
|
|
10
|
-
refreshing,
|
|
11
|
-
onRefresh,
|
|
12
|
-
enabled = true,
|
|
13
|
-
themeColor = "primary",
|
|
14
|
-
color,
|
|
15
|
-
title,
|
|
16
|
-
titleColor,
|
|
17
|
-
progressViewOffset,
|
|
18
|
-
children,
|
|
19
|
-
refreshControlProps
|
|
20
|
-
}) => {
|
|
21
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
22
|
-
const indicatorColor = _nullishCoalesce(color, () => ( theme.colors[themeColor].main));
|
|
23
|
-
const indicatorTitleColor = _nullishCoalesce(titleColor, () => ( theme.colors.foreground));
|
|
24
|
-
const refreshControl = /* @__PURE__ */ _react2.default.createElement(
|
|
25
|
-
_reactnative.RefreshControl,
|
|
26
|
-
{
|
|
27
|
-
refreshing,
|
|
28
|
-
onRefresh,
|
|
29
|
-
enabled,
|
|
30
|
-
colors: [indicatorColor],
|
|
31
|
-
tintColor: indicatorColor,
|
|
32
|
-
title,
|
|
33
|
-
titleColor: indicatorTitleColor,
|
|
34
|
-
progressViewOffset,
|
|
35
|
-
...refreshControlProps
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
return _react2.default.cloneElement(children, {
|
|
39
|
-
refreshControl
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
PullToRefresh.displayName = "PullToRefresh";
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
exports.PullToRefresh = PullToRefresh;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
import { RefreshControlProps } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type SupportedChildProps = {
|
|
6
|
-
refreshControl?: ReactElement | null;
|
|
7
|
-
};
|
|
8
|
-
type PullToRefreshProps = {
|
|
9
|
-
/**
|
|
10
|
-
* Whether the refresh indicator is visible.
|
|
11
|
-
*/
|
|
12
|
-
refreshing: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Callback fired when user triggers pull-to-refresh.
|
|
15
|
-
*/
|
|
16
|
-
onRefresh: () => void | Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Whether pull-to-refresh is enabled.
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
enabled?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Theme color used for the refresh indicator.
|
|
24
|
-
* @default 'primary'
|
|
25
|
-
*/
|
|
26
|
-
themeColor?: ThemeColor;
|
|
27
|
-
/**
|
|
28
|
-
* Override indicator color.
|
|
29
|
-
*/
|
|
30
|
-
color?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Title shown near the refresh indicator.
|
|
33
|
-
*/
|
|
34
|
-
title?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Override title color.
|
|
37
|
-
*/
|
|
38
|
-
titleColor?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Progress offset from top (Android).
|
|
41
|
-
*/
|
|
42
|
-
progressViewOffset?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Scrollable child that accepts `refreshControl` prop.
|
|
45
|
-
*/
|
|
46
|
-
children: ReactElement<SupportedChildProps>;
|
|
47
|
-
/**
|
|
48
|
-
* Additional native refresh control props.
|
|
49
|
-
*/
|
|
50
|
-
refreshControlProps?: Omit<RefreshControlProps, 'refreshing' | 'onRefresh' | 'enabled' | 'colors' | 'tintColor' | 'title' | 'titleColor' | 'progressViewOffset'>;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
declare const PullToRefresh: React.FC<PullToRefreshProps>;
|
|
54
|
-
|
|
55
|
-
export { PullToRefresh, type PullToRefreshProps };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
import { RefreshControlProps } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type SupportedChildProps = {
|
|
6
|
-
refreshControl?: ReactElement | null;
|
|
7
|
-
};
|
|
8
|
-
type PullToRefreshProps = {
|
|
9
|
-
/**
|
|
10
|
-
* Whether the refresh indicator is visible.
|
|
11
|
-
*/
|
|
12
|
-
refreshing: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Callback fired when user triggers pull-to-refresh.
|
|
15
|
-
*/
|
|
16
|
-
onRefresh: () => void | Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Whether pull-to-refresh is enabled.
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
enabled?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Theme color used for the refresh indicator.
|
|
24
|
-
* @default 'primary'
|
|
25
|
-
*/
|
|
26
|
-
themeColor?: ThemeColor;
|
|
27
|
-
/**
|
|
28
|
-
* Override indicator color.
|
|
29
|
-
*/
|
|
30
|
-
color?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Title shown near the refresh indicator.
|
|
33
|
-
*/
|
|
34
|
-
title?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Override title color.
|
|
37
|
-
*/
|
|
38
|
-
titleColor?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Progress offset from top (Android).
|
|
41
|
-
*/
|
|
42
|
-
progressViewOffset?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Scrollable child that accepts `refreshControl` prop.
|
|
45
|
-
*/
|
|
46
|
-
children: ReactElement<SupportedChildProps>;
|
|
47
|
-
/**
|
|
48
|
-
* Additional native refresh control props.
|
|
49
|
-
*/
|
|
50
|
-
refreshControlProps?: Omit<RefreshControlProps, 'refreshing' | 'onRefresh' | 'enabled' | 'colors' | 'tintColor' | 'title' | 'titleColor' | 'progressViewOffset'>;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
declare const PullToRefresh: React.FC<PullToRefreshProps>;
|
|
54
|
-
|
|
55
|
-
export { PullToRefresh, type PullToRefreshProps };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import "../chunk-SHBDANQN.js";
|
|
2
|
-
import {
|
|
3
|
-
useXUITheme
|
|
4
|
-
} from "../chunk-RBSA4NH4.js";
|
|
5
|
-
|
|
6
|
-
// src/components/refresh-control/refresh-control.tsx
|
|
7
|
-
import React from "react";
|
|
8
|
-
import { RefreshControl as RNRefreshControl } from "react-native";
|
|
9
|
-
var PullToRefresh = ({
|
|
10
|
-
refreshing,
|
|
11
|
-
onRefresh,
|
|
12
|
-
enabled = true,
|
|
13
|
-
themeColor = "primary",
|
|
14
|
-
color,
|
|
15
|
-
title,
|
|
16
|
-
titleColor,
|
|
17
|
-
progressViewOffset,
|
|
18
|
-
children,
|
|
19
|
-
refreshControlProps
|
|
20
|
-
}) => {
|
|
21
|
-
const theme = useXUITheme();
|
|
22
|
-
const indicatorColor = color ?? theme.colors[themeColor].main;
|
|
23
|
-
const indicatorTitleColor = titleColor ?? theme.colors.foreground;
|
|
24
|
-
const refreshControl = /* @__PURE__ */ React.createElement(
|
|
25
|
-
RNRefreshControl,
|
|
26
|
-
{
|
|
27
|
-
refreshing,
|
|
28
|
-
onRefresh,
|
|
29
|
-
enabled,
|
|
30
|
-
colors: [indicatorColor],
|
|
31
|
-
tintColor: indicatorColor,
|
|
32
|
-
title,
|
|
33
|
-
titleColor: indicatorTitleColor,
|
|
34
|
-
progressViewOffset,
|
|
35
|
-
...refreshControlProps
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
return React.cloneElement(children, {
|
|
39
|
-
refreshControl
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
PullToRefresh.displayName = "PullToRefresh";
|
|
43
|
-
export {
|
|
44
|
-
PullToRefresh
|
|
45
|
-
};
|