@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/fab-menu/index.js
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Fab
|
|
3
|
-
} from "../chunk-UU4HHBDN.js";
|
|
4
|
-
import "../chunk-VSZEXOUN.js";
|
|
5
|
-
import "../chunk-SHBDANQN.js";
|
|
6
|
-
import {
|
|
7
|
-
Portal,
|
|
8
|
-
useXUITheme
|
|
9
|
-
} from "../chunk-RBSA4NH4.js";
|
|
10
|
-
|
|
11
|
-
// src/components/fab-menu/fab-menu.tsx
|
|
12
|
-
import React from "react";
|
|
13
|
-
import { Pressable, View, Animated as Animated2 } from "react-native";
|
|
14
|
-
|
|
15
|
-
// src/components/fab-menu/fab-menu.style.ts
|
|
16
|
-
import { StyleSheet } from "react-native";
|
|
17
|
-
var styles = StyleSheet.create({
|
|
18
|
-
container: {
|
|
19
|
-
position: "relative",
|
|
20
|
-
alignItems: "flex-end"
|
|
21
|
-
},
|
|
22
|
-
portalRoot: {
|
|
23
|
-
...StyleSheet.absoluteFillObject
|
|
24
|
-
},
|
|
25
|
-
overlay: {
|
|
26
|
-
...StyleSheet.absoluteFillObject
|
|
27
|
-
},
|
|
28
|
-
overlayPressable: {
|
|
29
|
-
flex: 1
|
|
30
|
-
},
|
|
31
|
-
portalContent: {
|
|
32
|
-
...StyleSheet.absoluteFillObject,
|
|
33
|
-
justifyContent: "flex-end",
|
|
34
|
-
alignItems: "flex-end",
|
|
35
|
-
padding: 16
|
|
36
|
-
},
|
|
37
|
-
menuContainer: {
|
|
38
|
-
alignItems: "flex-end",
|
|
39
|
-
marginBottom: 16
|
|
40
|
-
},
|
|
41
|
-
menuItem: {
|
|
42
|
-
marginBottom: 12
|
|
43
|
-
},
|
|
44
|
-
menuItemChip: {
|
|
45
|
-
flexDirection: "row",
|
|
46
|
-
alignItems: "center",
|
|
47
|
-
paddingVertical: 12,
|
|
48
|
-
paddingLeft: 16,
|
|
49
|
-
paddingRight: 20,
|
|
50
|
-
gap: 8
|
|
51
|
-
},
|
|
52
|
-
menuItemLabel: {
|
|
53
|
-
fontWeight: "500"
|
|
54
|
-
},
|
|
55
|
-
disabled: {
|
|
56
|
-
opacity: 0.5
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// src/components/fab-menu/fab-menu.hook.ts
|
|
61
|
-
import { useMemo, useState, useCallback } from "react";
|
|
62
|
-
import { getSafeThemeColor } from "@xaui/core";
|
|
63
|
-
function useFabMenuState(controlledExpanded, onToggle) {
|
|
64
|
-
const [internalExpanded, setInternalExpanded] = useState(false);
|
|
65
|
-
const isControlled = controlledExpanded !== void 0;
|
|
66
|
-
const expanded = isControlled ? controlledExpanded : internalExpanded;
|
|
67
|
-
const toggle = useCallback(() => {
|
|
68
|
-
const next = !expanded;
|
|
69
|
-
if (!isControlled) {
|
|
70
|
-
setInternalExpanded(next);
|
|
71
|
-
}
|
|
72
|
-
onToggle?.(next);
|
|
73
|
-
}, [expanded, isControlled, onToggle]);
|
|
74
|
-
const close = useCallback(() => {
|
|
75
|
-
if (!isControlled) {
|
|
76
|
-
setInternalExpanded(false);
|
|
77
|
-
}
|
|
78
|
-
onToggle?.(false);
|
|
79
|
-
}, [isControlled, onToggle]);
|
|
80
|
-
return { expanded, toggle, close };
|
|
81
|
-
}
|
|
82
|
-
function useFabMenuItemStyles(themeColor) {
|
|
83
|
-
const theme = useXUITheme();
|
|
84
|
-
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
85
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
86
|
-
const itemStyles = useMemo(() => {
|
|
87
|
-
const chipStyles = {
|
|
88
|
-
backgroundColor: colorScheme.container,
|
|
89
|
-
borderRadius: theme.borderRadius.full,
|
|
90
|
-
color: colorScheme.main,
|
|
91
|
-
fontSize: theme.fontSizes.md
|
|
92
|
-
};
|
|
93
|
-
const iconColor = colorScheme.main;
|
|
94
|
-
return { chipStyles, iconColor };
|
|
95
|
-
}, [colorScheme, theme]);
|
|
96
|
-
return itemStyles;
|
|
97
|
-
}
|
|
98
|
-
function useFabMenuOverlayColor() {
|
|
99
|
-
const theme = useXUITheme();
|
|
100
|
-
return useMemo(() => {
|
|
101
|
-
return theme.mode === "dark" ? "rgba(0, 0, 0, 0.5)" : "rgba(0, 0, 0, 0.3)";
|
|
102
|
-
}, [theme.mode]);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// src/components/fab-menu/fab-menu.animation.ts
|
|
106
|
-
import { Animated } from "react-native";
|
|
107
|
-
var runMenuExpandAnimation = (overlayOpacity, itemAnimations) => {
|
|
108
|
-
const itemSequence = itemAnimations.map(
|
|
109
|
-
(anim, index) => Animated.timing(anim, {
|
|
110
|
-
toValue: 1,
|
|
111
|
-
duration: 150,
|
|
112
|
-
delay: index * 50,
|
|
113
|
-
useNativeDriver: true
|
|
114
|
-
})
|
|
115
|
-
);
|
|
116
|
-
Animated.parallel([
|
|
117
|
-
Animated.timing(overlayOpacity, {
|
|
118
|
-
toValue: 1,
|
|
119
|
-
duration: 200,
|
|
120
|
-
useNativeDriver: true
|
|
121
|
-
}),
|
|
122
|
-
Animated.stagger(50, itemSequence)
|
|
123
|
-
]).start();
|
|
124
|
-
};
|
|
125
|
-
var runMenuCollapseAnimation = (overlayOpacity, itemAnimations, onComplete) => {
|
|
126
|
-
const reversed = [...itemAnimations].reverse();
|
|
127
|
-
const itemSequence = reversed.map(
|
|
128
|
-
(anim, index) => Animated.timing(anim, {
|
|
129
|
-
toValue: 0,
|
|
130
|
-
duration: 120,
|
|
131
|
-
delay: index * 30,
|
|
132
|
-
useNativeDriver: true
|
|
133
|
-
})
|
|
134
|
-
);
|
|
135
|
-
Animated.parallel([
|
|
136
|
-
Animated.timing(overlayOpacity, {
|
|
137
|
-
toValue: 0,
|
|
138
|
-
duration: 200,
|
|
139
|
-
useNativeDriver: true
|
|
140
|
-
}),
|
|
141
|
-
Animated.stagger(30, itemSequence)
|
|
142
|
-
]).start(onComplete);
|
|
143
|
-
};
|
|
144
|
-
var runFabRotateAnimation = (rotateValue, toExpanded) => {
|
|
145
|
-
Animated.spring(rotateValue, {
|
|
146
|
-
toValue: toExpanded ? 1 : 0,
|
|
147
|
-
useNativeDriver: true,
|
|
148
|
-
speed: 20,
|
|
149
|
-
bounciness: 0
|
|
150
|
-
}).start();
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
// src/components/fab-menu/fab-menu.tsx
|
|
154
|
-
var FabMenu = ({
|
|
155
|
-
icon,
|
|
156
|
-
label,
|
|
157
|
-
expandedIcon,
|
|
158
|
-
children,
|
|
159
|
-
themeColor = "primary",
|
|
160
|
-
variant = "solid",
|
|
161
|
-
size = "md",
|
|
162
|
-
radius,
|
|
163
|
-
elevation = 0,
|
|
164
|
-
isExpanded: controlledExpanded,
|
|
165
|
-
onToggle,
|
|
166
|
-
showOverlay = true,
|
|
167
|
-
customAppearance
|
|
168
|
-
}) => {
|
|
169
|
-
const { expanded, toggle, close } = useFabMenuState(controlledExpanded, onToggle);
|
|
170
|
-
const overlayColor = useFabMenuOverlayColor();
|
|
171
|
-
const [isPortalVisible, setIsPortalVisible] = React.useState(expanded);
|
|
172
|
-
const childArray = React.Children.toArray(children);
|
|
173
|
-
const overlayOpacity = React.useRef(new Animated2.Value(expanded ? 1 : 0)).current;
|
|
174
|
-
const rotateValue = React.useRef(new Animated2.Value(expanded ? 1 : 0)).current;
|
|
175
|
-
const itemAnimationsRef = React.useRef(childArray.map(() => new Animated2.Value(0)));
|
|
176
|
-
const itemAnimations = itemAnimationsRef.current;
|
|
177
|
-
const prevExpanded = React.useRef(expanded);
|
|
178
|
-
React.useEffect(() => {
|
|
179
|
-
if (itemAnimations.length === childArray.length) return;
|
|
180
|
-
itemAnimationsRef.current = childArray.map(
|
|
181
|
-
(_, index) => itemAnimations[index] ?? new Animated2.Value(expanded ? 1 : 0)
|
|
182
|
-
);
|
|
183
|
-
}, [expanded, itemAnimations, childArray]);
|
|
184
|
-
React.useEffect(() => {
|
|
185
|
-
if (prevExpanded.current === expanded) return;
|
|
186
|
-
prevExpanded.current = expanded;
|
|
187
|
-
if (expanded) {
|
|
188
|
-
setIsPortalVisible(true);
|
|
189
|
-
runMenuExpandAnimation(overlayOpacity, itemAnimations);
|
|
190
|
-
runFabRotateAnimation(rotateValue, true);
|
|
191
|
-
} else {
|
|
192
|
-
runMenuCollapseAnimation(overlayOpacity, itemAnimations, () => {
|
|
193
|
-
setIsPortalVisible(false);
|
|
194
|
-
});
|
|
195
|
-
runFabRotateAnimation(rotateValue, false);
|
|
196
|
-
}
|
|
197
|
-
}, [expanded, overlayOpacity, itemAnimations, rotateValue]);
|
|
198
|
-
const rotation = rotateValue.interpolate({
|
|
199
|
-
inputRange: [0, 1],
|
|
200
|
-
outputRange: ["0deg", "45deg"]
|
|
201
|
-
});
|
|
202
|
-
const currentIcon = expanded && expandedIcon ? expandedIcon : icon;
|
|
203
|
-
const renderFabToggle = () => /* @__PURE__ */ React.createElement(
|
|
204
|
-
Animated2.View,
|
|
205
|
-
{
|
|
206
|
-
style: {
|
|
207
|
-
alignSelf: "flex-end",
|
|
208
|
-
transform: [{ rotate: expandedIcon ? "0deg" : rotation }]
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
/* @__PURE__ */ React.createElement(
|
|
212
|
-
Fab,
|
|
213
|
-
{
|
|
214
|
-
icon: currentIcon,
|
|
215
|
-
label,
|
|
216
|
-
themeColor,
|
|
217
|
-
variant,
|
|
218
|
-
size,
|
|
219
|
-
radius,
|
|
220
|
-
elevation,
|
|
221
|
-
onPress: toggle,
|
|
222
|
-
customAppearance: { fab: customAppearance?.fab }
|
|
223
|
-
}
|
|
224
|
-
)
|
|
225
|
-
);
|
|
226
|
-
const renderMenuItems = () => /* @__PURE__ */ React.createElement(View, { style: [styles.menuContainer, customAppearance?.menuContainer] }, childArray.map((child, index) => {
|
|
227
|
-
const childElement = child;
|
|
228
|
-
const isDisabled = childElement.props?.isDisabled;
|
|
229
|
-
return /* @__PURE__ */ React.createElement(
|
|
230
|
-
Animated2.View,
|
|
231
|
-
{
|
|
232
|
-
key: childElement.key ?? index,
|
|
233
|
-
style: [
|
|
234
|
-
styles.menuItem,
|
|
235
|
-
isDisabled && styles.disabled,
|
|
236
|
-
{
|
|
237
|
-
opacity: itemAnimations[index],
|
|
238
|
-
transform: [
|
|
239
|
-
{
|
|
240
|
-
translateY: itemAnimations[index].interpolate({
|
|
241
|
-
inputRange: [0, 1],
|
|
242
|
-
outputRange: [20, 0]
|
|
243
|
-
})
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
scale: itemAnimations[index].interpolate({
|
|
247
|
-
inputRange: [0, 1],
|
|
248
|
-
outputRange: [0.8, 1]
|
|
249
|
-
})
|
|
250
|
-
}
|
|
251
|
-
]
|
|
252
|
-
},
|
|
253
|
-
customAppearance?.menuItem
|
|
254
|
-
]
|
|
255
|
-
},
|
|
256
|
-
React.cloneElement(childElement, {
|
|
257
|
-
_onClose: close,
|
|
258
|
-
themeColor: childElement.props?.themeColor ?? themeColor
|
|
259
|
-
})
|
|
260
|
-
);
|
|
261
|
-
}));
|
|
262
|
-
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, customAppearance?.container] }, isPortalVisible && /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(View, { style: styles.portalRoot }, showOverlay && /* @__PURE__ */ React.createElement(
|
|
263
|
-
Animated2.View,
|
|
264
|
-
{
|
|
265
|
-
style: [
|
|
266
|
-
styles.overlay,
|
|
267
|
-
{ backgroundColor: overlayColor, opacity: overlayOpacity },
|
|
268
|
-
customAppearance?.overlay
|
|
269
|
-
]
|
|
270
|
-
},
|
|
271
|
-
/* @__PURE__ */ React.createElement(Pressable, { style: styles.overlayPressable, onPress: close })
|
|
272
|
-
), /* @__PURE__ */ React.createElement(View, { style: styles.portalContent }, renderMenuItems(), renderFabToggle()))), !isPortalVisible && renderFabToggle());
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
// src/components/fab-menu/fab-menu-item.tsx
|
|
276
|
-
import React2 from "react";
|
|
277
|
-
import { Pressable as Pressable2, Text } from "react-native";
|
|
278
|
-
var FabMenuItem = ({
|
|
279
|
-
icon,
|
|
280
|
-
label,
|
|
281
|
-
themeColor = "primary",
|
|
282
|
-
onPress,
|
|
283
|
-
isDisabled,
|
|
284
|
-
_onClose
|
|
285
|
-
}) => {
|
|
286
|
-
const itemStyles = useFabMenuItemStyles(themeColor);
|
|
287
|
-
const renderIcon = (menuIcon) => {
|
|
288
|
-
if (!React2.isValidElement(menuIcon)) return menuIcon;
|
|
289
|
-
return React2.cloneElement(
|
|
290
|
-
menuIcon,
|
|
291
|
-
{ color: itemStyles.iconColor }
|
|
292
|
-
);
|
|
293
|
-
};
|
|
294
|
-
return /* @__PURE__ */ React2.createElement(
|
|
295
|
-
Pressable2,
|
|
296
|
-
{
|
|
297
|
-
style: [
|
|
298
|
-
styles.menuItemChip,
|
|
299
|
-
{
|
|
300
|
-
backgroundColor: itemStyles.chipStyles.backgroundColor,
|
|
301
|
-
borderRadius: itemStyles.chipStyles.borderRadius
|
|
302
|
-
}
|
|
303
|
-
],
|
|
304
|
-
onPress: (event) => {
|
|
305
|
-
if (isDisabled) return;
|
|
306
|
-
onPress?.(event);
|
|
307
|
-
_onClose?.();
|
|
308
|
-
},
|
|
309
|
-
disabled: isDisabled
|
|
310
|
-
},
|
|
311
|
-
renderIcon(icon),
|
|
312
|
-
/* @__PURE__ */ React2.createElement(
|
|
313
|
-
Text,
|
|
314
|
-
{
|
|
315
|
-
style: [
|
|
316
|
-
styles.menuItemLabel,
|
|
317
|
-
{
|
|
318
|
-
color: itemStyles.chipStyles.color,
|
|
319
|
-
fontSize: itemStyles.chipStyles.fontSize
|
|
320
|
-
}
|
|
321
|
-
]
|
|
322
|
-
},
|
|
323
|
-
label
|
|
324
|
-
)
|
|
325
|
-
);
|
|
326
|
-
};
|
|
327
|
-
export {
|
|
328
|
-
FabMenu,
|
|
329
|
-
FabMenuItem
|
|
330
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
import { B as ButtonRadius, E as ElevationLevel } from './button.type-j1ZdkkSl.js';
|
|
5
|
-
|
|
6
|
-
type FabVariant = 'solid' | 'flat' | 'outlined';
|
|
7
|
-
type FabSize = 'sm' | 'md' | 'lg';
|
|
8
|
-
type FabCustomAppearance = {
|
|
9
|
-
/**
|
|
10
|
-
* Custom styles for the outer container
|
|
11
|
-
*/
|
|
12
|
-
container?: ViewStyle;
|
|
13
|
-
/**
|
|
14
|
-
* Custom styles for the fab button
|
|
15
|
-
*/
|
|
16
|
-
fab?: ViewStyle;
|
|
17
|
-
};
|
|
18
|
-
type FabProps = {
|
|
19
|
-
/**
|
|
20
|
-
* The icon to display in the FAB.
|
|
21
|
-
*/
|
|
22
|
-
icon: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Optional text label for an extended FAB.
|
|
25
|
-
* When provided, the FAB renders as an extended FAB with icon + label.
|
|
26
|
-
*/
|
|
27
|
-
label?: ReactNode;
|
|
28
|
-
/**
|
|
29
|
-
* The theme color of the FAB.
|
|
30
|
-
* @default 'primary'
|
|
31
|
-
*/
|
|
32
|
-
themeColor?: ThemeColor;
|
|
33
|
-
/**
|
|
34
|
-
* The visual variant of the FAB.
|
|
35
|
-
* @default 'solid'
|
|
36
|
-
*/
|
|
37
|
-
variant?: FabVariant;
|
|
38
|
-
/**
|
|
39
|
-
* The size of the FAB.
|
|
40
|
-
* @default 'md'
|
|
41
|
-
*/
|
|
42
|
-
size?: FabSize;
|
|
43
|
-
/**
|
|
44
|
-
* Custom border radius for the FAB.
|
|
45
|
-
* Overrides the default size-based border radius.
|
|
46
|
-
*/
|
|
47
|
-
radius?: ButtonRadius;
|
|
48
|
-
/**
|
|
49
|
-
* Whether the FAB is disabled.
|
|
50
|
-
* @default false
|
|
51
|
-
*/
|
|
52
|
-
isDisabled?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Whether the FAB is in a loading state.
|
|
55
|
-
* @default false
|
|
56
|
-
*/
|
|
57
|
-
isLoading?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Android elevation level from 0 to 4.
|
|
60
|
-
* Does not apply to `outlined` and `light` variants.
|
|
61
|
-
* @default 0
|
|
62
|
-
*/
|
|
63
|
-
elevation?: ElevationLevel;
|
|
64
|
-
/**
|
|
65
|
-
* Custom appearance styles for FAB parts.
|
|
66
|
-
*/
|
|
67
|
-
customAppearance?: FabCustomAppearance;
|
|
68
|
-
/**
|
|
69
|
-
* Callback fired when the FAB is pressed.
|
|
70
|
-
*/
|
|
71
|
-
onPress?: (event: GestureResponderEvent) => void;
|
|
72
|
-
/**
|
|
73
|
-
* Callback fired when the FAB is long pressed.
|
|
74
|
-
*/
|
|
75
|
-
onLongPress?: (event: GestureResponderEvent) => void;
|
|
76
|
-
/**
|
|
77
|
-
* Callback fired when the FAB press starts.
|
|
78
|
-
*/
|
|
79
|
-
onPressIn?: (event: GestureResponderEvent) => void;
|
|
80
|
-
/**
|
|
81
|
-
* Callback fired when the FAB press ends.
|
|
82
|
-
*/
|
|
83
|
-
onPressOut?: (event: GestureResponderEvent) => void;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export type { FabProps as F, FabVariant as a, FabSize as b };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
import { B as ButtonRadius, E as ElevationLevel } from './button.type-j1ZdkkSl.cjs';
|
|
5
|
-
|
|
6
|
-
type FabVariant = 'solid' | 'flat' | 'outlined';
|
|
7
|
-
type FabSize = 'sm' | 'md' | 'lg';
|
|
8
|
-
type FabCustomAppearance = {
|
|
9
|
-
/**
|
|
10
|
-
* Custom styles for the outer container
|
|
11
|
-
*/
|
|
12
|
-
container?: ViewStyle;
|
|
13
|
-
/**
|
|
14
|
-
* Custom styles for the fab button
|
|
15
|
-
*/
|
|
16
|
-
fab?: ViewStyle;
|
|
17
|
-
};
|
|
18
|
-
type FabProps = {
|
|
19
|
-
/**
|
|
20
|
-
* The icon to display in the FAB.
|
|
21
|
-
*/
|
|
22
|
-
icon: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Optional text label for an extended FAB.
|
|
25
|
-
* When provided, the FAB renders as an extended FAB with icon + label.
|
|
26
|
-
*/
|
|
27
|
-
label?: ReactNode;
|
|
28
|
-
/**
|
|
29
|
-
* The theme color of the FAB.
|
|
30
|
-
* @default 'primary'
|
|
31
|
-
*/
|
|
32
|
-
themeColor?: ThemeColor;
|
|
33
|
-
/**
|
|
34
|
-
* The visual variant of the FAB.
|
|
35
|
-
* @default 'solid'
|
|
36
|
-
*/
|
|
37
|
-
variant?: FabVariant;
|
|
38
|
-
/**
|
|
39
|
-
* The size of the FAB.
|
|
40
|
-
* @default 'md'
|
|
41
|
-
*/
|
|
42
|
-
size?: FabSize;
|
|
43
|
-
/**
|
|
44
|
-
* Custom border radius for the FAB.
|
|
45
|
-
* Overrides the default size-based border radius.
|
|
46
|
-
*/
|
|
47
|
-
radius?: ButtonRadius;
|
|
48
|
-
/**
|
|
49
|
-
* Whether the FAB is disabled.
|
|
50
|
-
* @default false
|
|
51
|
-
*/
|
|
52
|
-
isDisabled?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Whether the FAB is in a loading state.
|
|
55
|
-
* @default false
|
|
56
|
-
*/
|
|
57
|
-
isLoading?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Android elevation level from 0 to 4.
|
|
60
|
-
* Does not apply to `outlined` and `light` variants.
|
|
61
|
-
* @default 0
|
|
62
|
-
*/
|
|
63
|
-
elevation?: ElevationLevel;
|
|
64
|
-
/**
|
|
65
|
-
* Custom appearance styles for FAB parts.
|
|
66
|
-
*/
|
|
67
|
-
customAppearance?: FabCustomAppearance;
|
|
68
|
-
/**
|
|
69
|
-
* Callback fired when the FAB is pressed.
|
|
70
|
-
*/
|
|
71
|
-
onPress?: (event: GestureResponderEvent) => void;
|
|
72
|
-
/**
|
|
73
|
-
* Callback fired when the FAB is long pressed.
|
|
74
|
-
*/
|
|
75
|
-
onLongPress?: (event: GestureResponderEvent) => void;
|
|
76
|
-
/**
|
|
77
|
-
* Callback fired when the FAB press starts.
|
|
78
|
-
*/
|
|
79
|
-
onPressIn?: (event: GestureResponderEvent) => void;
|
|
80
|
-
/**
|
|
81
|
-
* Callback fired when the FAB press ends.
|
|
82
|
-
*/
|
|
83
|
-
onPressOut?: (event: GestureResponderEvent) => void;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export type { FabProps as F, FabVariant as a, FabSize as b };
|