@xaui/native 0.0.26 → 0.0.28
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/LICENSE +21 -0
- package/README.md +105 -228
- package/dist/alert/index.cjs +92 -166
- package/dist/alert/index.js +2 -1
- package/dist/app-bar/index.cjs +24 -98
- package/dist/app-bar/index.js +2 -1
- package/dist/autocomplete/index.cjs +192 -281
- package/dist/autocomplete/index.js +36 -48
- package/dist/avatar/index.cjs +59 -133
- package/dist/avatar/index.js +2 -1
- package/dist/badge/index.cjs +26 -99
- package/dist/badge/index.js +2 -1
- package/dist/bottom-sheet/index.cjs +5 -456
- package/dist/bottom-sheet/index.js +4 -363
- package/dist/bottom-tab-bar/index.cjs +93 -167
- package/dist/bottom-tab-bar/index.js +2 -2
- package/dist/button/index.cjs +73 -525
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +76 -169
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.cjs +68 -145
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +132 -173
- package/dist/checkbox/index.cjs +70 -143
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +89 -164
- package/dist/chip/index.js +2 -1
- package/dist/chunk-BD72HIPR.cjs +75 -0
- package/dist/chunk-DHSTKO3K.cjs +19 -0
- package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
- package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/chunk-HC2SSHNU.js +368 -0
- package/dist/chunk-HSPTLUFA.cjs +7 -0
- package/dist/chunk-JEGEPGVU.js +287 -0
- package/dist/chunk-KTLGDLCB.cjs +287 -0
- package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
- package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/chunk-OQ2BLOOG.cjs +138 -0
- package/dist/chunk-QMYWIWSX.cjs +384 -0
- package/dist/chunk-XFPPR2VB.cjs +368 -0
- package/dist/core/index.cjs +22 -168
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.cjs +239 -320
- package/dist/datepicker/index.js +2 -1
- package/dist/divider/index.cjs +5 -145
- package/dist/divider/index.js +3 -2
- package/dist/drawer/index.cjs +39 -112
- package/dist/drawer/index.js +2 -1
- package/dist/expansion-panel/index.cjs +91 -230
- package/dist/expansion-panel/index.js +3 -2
- package/dist/fab/index.cjs +6 -722
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +81 -814
- package/dist/fab-menu/index.js +4 -3
- package/dist/feature-discovery/index.cjs +72 -139
- package/dist/feature-discovery/index.js +2 -2
- package/dist/index.cjs +1 -18
- package/dist/indicator/index.cjs +5 -445
- package/dist/indicator/index.js +3 -2
- package/dist/input/index.cjs +214 -282
- package/dist/input/index.js +2 -2
- package/dist/list/index.cjs +71 -146
- package/dist/list/index.js +2 -1
- package/dist/menu/index.cjs +59 -127
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +60 -132
- package/dist/menubox/index.js +2 -1
- package/dist/pager/index.cjs +42 -80
- package/dist/progress/index.cjs +43 -114
- package/dist/progress/index.js +2 -1
- package/dist/radio/index.cjs +82 -154
- package/dist/radio/index.js +2 -1
- package/dist/segment-button/index.cjs +60 -147
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.cjs +149 -224
- package/dist/select/index.js +10 -22
- package/dist/skeleton/index.cjs +23 -94
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +77 -156
- package/dist/slider/index.js +2 -1
- package/dist/snackbar/index.cjs +420 -0
- package/dist/snackbar/index.d.cts +175 -0
- package/dist/snackbar/index.d.ts +175 -0
- package/dist/snackbar/index.js +420 -0
- package/dist/stepper/index.cjs +121 -195
- package/dist/stepper/index.js +2 -1
- package/dist/switch/index.cjs +48 -121
- package/dist/switch/index.js +2 -1
- package/dist/tabs/index.cjs +67 -151
- package/dist/tabs/index.js +2 -1
- package/dist/timepicker/index.cjs +135 -593
- package/dist/timepicker/index.js +24 -383
- package/dist/toolbar/index.cjs +59 -128
- package/dist/toolbar/index.js +2 -1
- package/dist/typography/index.cjs +37 -92
- package/dist/typography/index.d.cts +1 -1
- package/dist/typography/index.d.ts +1 -1
- package/dist/typography/index.js +20 -1
- package/dist/view/index.cjs +178 -223
- package/package.json +7 -1
- package/dist/chunk-3XSXTM3G.js +0 -661
- package/dist/chunk-4KSZLONZ.js +0 -79
- package/dist/chunk-I4V5Y5GD.js +0 -76
- package/dist/chunk-URBEEDFX.js +0 -79
package/dist/fab-menu/index.cjs
CHANGED
|
@@ -1,767 +1,35 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/components/fab-menu/index.ts
|
|
31
|
-
var fab_menu_exports = {};
|
|
32
|
-
__export(fab_menu_exports, {
|
|
33
|
-
FabMenu: () => FabMenu,
|
|
34
|
-
FabMenuItem: () => FabMenuItem
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(fab_menu_exports);
|
|
37
|
-
|
|
38
|
-
// src/components/fab-menu/fab-menu.tsx
|
|
39
|
-
var import_react13 = __toESM(require("react"), 1);
|
|
40
|
-
var import_react_native13 = require("react-native");
|
|
41
|
-
|
|
42
|
-
// src/components/fab/fab.tsx
|
|
43
|
-
var import_react11 = __toESM(require("react"), 1);
|
|
44
|
-
var import_react_native10 = require("react-native");
|
|
45
|
-
|
|
46
|
-
// src/components/indicator/indicator.tsx
|
|
47
|
-
var import_react9 = __toESM(require("react"), 1);
|
|
48
|
-
var import_react_native7 = require("react-native");
|
|
49
|
-
|
|
50
|
-
// src/core/theme-context.tsx
|
|
51
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
52
|
-
var import_react_native2 = require("react-native");
|
|
53
|
-
var import_theme = require("@xaui/core/theme");
|
|
54
|
-
var import_palette = require("@xaui/core/palette");
|
|
55
|
-
|
|
56
|
-
// src/core/portal/portal.tsx
|
|
57
|
-
var import_react2 = require("react");
|
|
58
|
-
|
|
59
|
-
// src/core/portal/portal-context.ts
|
|
60
|
-
var import_react = require("react");
|
|
61
|
-
var PortalContext = (0, import_react.createContext)(null);
|
|
62
|
-
|
|
63
|
-
// src/core/portal/portal.tsx
|
|
64
|
-
var portalId = 0;
|
|
65
|
-
var Portal = ({ children }) => {
|
|
66
|
-
const context = (0, import_react2.useContext)(PortalContext);
|
|
67
|
-
const keyRef = (0, import_react2.useRef)(`portal-${++portalId}`);
|
|
68
|
-
(0, import_react2.useLayoutEffect)(() => {
|
|
69
|
-
if (!context) return;
|
|
70
|
-
context.addPortal(keyRef.current, children);
|
|
71
|
-
}, [children, context]);
|
|
72
|
-
(0, import_react2.useEffect)(() => {
|
|
73
|
-
if (!context) return;
|
|
74
|
-
const key = keyRef.current;
|
|
75
|
-
return () => {
|
|
76
|
-
context.removePortal(key);
|
|
77
|
-
};
|
|
78
|
-
}, [context]);
|
|
79
|
-
return null;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// src/core/portal/portal-host.tsx
|
|
83
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
84
|
-
var import_react_native = require("react-native");
|
|
85
|
-
var hostStyles = import_react_native.StyleSheet.create({
|
|
86
|
-
container: {
|
|
87
|
-
flex: 1
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// src/core/theme-context.tsx
|
|
92
|
-
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
93
|
-
|
|
94
|
-
// src/core/theme-hooks.ts
|
|
95
|
-
var import_react5 = require("react");
|
|
96
|
-
var import_react_native3 = require("react-native");
|
|
97
|
-
function useXUITheme() {
|
|
98
|
-
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
99
|
-
if (!theme) {
|
|
100
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
101
|
-
}
|
|
102
|
-
return theme;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// src/core/index.ts
|
|
106
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
107
|
-
|
|
108
|
-
// src/components/indicator/circular-activity-indicator.tsx
|
|
109
|
-
var import_react6 = __toESM(require("react"), 1);
|
|
110
|
-
var import_react_native5 = require("react-native");
|
|
111
|
-
|
|
112
|
-
// src/components/indicator/indicator.style.ts
|
|
113
|
-
var import_react_native4 = require("react-native");
|
|
114
|
-
var styles = import_react_native4.StyleSheet.create({
|
|
115
|
-
container: {
|
|
116
|
-
flexShrink: 1,
|
|
117
|
-
flexBasis: "auto",
|
|
118
|
-
width: "100%",
|
|
119
|
-
justifyContent: "center"
|
|
120
|
-
},
|
|
121
|
-
layer: {
|
|
122
|
-
...import_react_native4.StyleSheet.absoluteFillObject,
|
|
123
|
-
justifyContent: "center",
|
|
124
|
-
alignItems: "center"
|
|
125
|
-
},
|
|
126
|
-
track: {
|
|
127
|
-
width: "100%",
|
|
128
|
-
overflow: "hidden"
|
|
129
|
-
},
|
|
130
|
-
progress: {
|
|
131
|
-
height: "100%"
|
|
132
|
-
}
|
|
133
|
-
});
|
|
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(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
134
2
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var CircularActivityIndicator = ({
|
|
139
|
-
size = 40,
|
|
140
|
-
themeColor = "primary",
|
|
141
|
-
color,
|
|
142
|
-
backgroundColor,
|
|
143
|
-
disableAnimation = false,
|
|
144
|
-
showTrack = true
|
|
145
|
-
}) => {
|
|
146
|
-
const theme = useXUITheme();
|
|
147
|
-
const { current: timer } = (0, import_react6.useRef)(new import_react_native5.Animated.Value(0));
|
|
148
|
-
const rotation = (0, import_react6.useRef)(void 0);
|
|
149
|
-
const startRotation = import_react6.default.useCallback(() => {
|
|
150
|
-
if (rotation.current) {
|
|
151
|
-
timer.setValue(0);
|
|
152
|
-
import_react_native5.Animated.loop(rotation.current).start();
|
|
153
|
-
}
|
|
154
|
-
}, [timer]);
|
|
155
|
-
const stopRotation = () => {
|
|
156
|
-
if (rotation.current) rotation.current.stop();
|
|
157
|
-
};
|
|
158
|
-
(0, import_react6.useEffect)(() => {
|
|
159
|
-
if (rotation.current === void 0) {
|
|
160
|
-
rotation.current = import_react_native5.Animated.timing(timer, {
|
|
161
|
-
duration: DURATION,
|
|
162
|
-
easing: import_react_native5.Easing.linear,
|
|
163
|
-
useNativeDriver: import_react_native5.Platform.OS !== "web",
|
|
164
|
-
toValue: 1
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
if (!disableAnimation) startRotation();
|
|
168
|
-
else stopRotation();
|
|
169
|
-
}, [disableAnimation, startRotation, timer]);
|
|
170
|
-
const safeThemeColor = (0, import_core2.getSafeThemeColor)(themeColor);
|
|
171
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
172
|
-
const mainColor = color || colorScheme.main;
|
|
173
|
-
const trackColor = showTrack ? backgroundColor ?? colorScheme.background : "transparent";
|
|
174
|
-
const strokeWidth = size * 0.1;
|
|
175
|
-
const frames = 60 * DURATION / 1e3;
|
|
176
|
-
const easing = import_react_native5.Easing.bezier(0.4, 0, 0.7, 1);
|
|
177
|
-
const containerStyle = {
|
|
178
|
-
width: size,
|
|
179
|
-
height: size / 2,
|
|
180
|
-
overflow: "hidden"
|
|
181
|
-
};
|
|
182
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_react_native5.View, { style: [styles.container, { width: size, height: size }] }, /* @__PURE__ */ import_react6.default.createElement(
|
|
183
|
-
import_react_native5.View,
|
|
184
|
-
{
|
|
185
|
-
style: {
|
|
186
|
-
width: size,
|
|
187
|
-
height: size,
|
|
188
|
-
borderRadius: size / 2,
|
|
189
|
-
borderWidth: strokeWidth,
|
|
190
|
-
borderColor: trackColor
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
), /* @__PURE__ */ import_react6.default.createElement(
|
|
194
|
-
import_react_native5.View,
|
|
195
|
-
{
|
|
196
|
-
style: {
|
|
197
|
-
width: size,
|
|
198
|
-
height: size,
|
|
199
|
-
position: "absolute"
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
[0, 1].map((index) => {
|
|
203
|
-
const inputRange = Array.from(
|
|
204
|
-
new Array(frames),
|
|
205
|
-
(_, frameIndex) => frameIndex / (frames - 1)
|
|
206
|
-
);
|
|
207
|
-
const outputRange = Array.from(new Array(frames), (_, frameIndex) => {
|
|
208
|
-
let progress = 2 * frameIndex / (frames - 1);
|
|
209
|
-
const rotationValue = index ? +(360 - 15) : -(180 - 15);
|
|
210
|
-
if (progress > 1) {
|
|
211
|
-
progress = 2 - progress;
|
|
212
|
-
}
|
|
213
|
-
const direction = index ? -1 : 1;
|
|
214
|
-
return `${direction * (180 - 30) * easing(progress) + rotationValue}deg`;
|
|
215
|
-
});
|
|
216
|
-
const layerStyle = {
|
|
217
|
-
width: size,
|
|
218
|
-
height: size,
|
|
219
|
-
transform: [
|
|
220
|
-
{
|
|
221
|
-
rotate: timer.interpolate({
|
|
222
|
-
inputRange: [0, 1],
|
|
223
|
-
outputRange: [`${0 + 30 + 15}deg`, `${2 * 360 + 30 + 15}deg`]
|
|
224
|
-
})
|
|
225
|
-
}
|
|
226
|
-
]
|
|
227
|
-
};
|
|
228
|
-
const viewportStyle = {
|
|
229
|
-
width: size,
|
|
230
|
-
height: size,
|
|
231
|
-
transform: [
|
|
232
|
-
{ translateY: index ? -size / 2 : 0 },
|
|
233
|
-
{
|
|
234
|
-
rotate: timer.interpolate({ inputRange, outputRange })
|
|
235
|
-
}
|
|
236
|
-
]
|
|
237
|
-
};
|
|
238
|
-
const offsetStyle = index ? { top: size / 2 } : null;
|
|
239
|
-
const lineStyle = {
|
|
240
|
-
width: size,
|
|
241
|
-
height: size,
|
|
242
|
-
borderColor: mainColor,
|
|
243
|
-
borderWidth: strokeWidth,
|
|
244
|
-
borderRadius: size / 2
|
|
245
|
-
};
|
|
246
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_react_native5.Animated.View, { key: index, style: [styles.layer] }, /* @__PURE__ */ import_react6.default.createElement(import_react_native5.Animated.View, { style: layerStyle }, /* @__PURE__ */ import_react6.default.createElement(
|
|
247
|
-
import_react_native5.Animated.View,
|
|
248
|
-
{
|
|
249
|
-
style: [containerStyle, offsetStyle],
|
|
250
|
-
collapsable: false
|
|
251
|
-
},
|
|
252
|
-
/* @__PURE__ */ import_react6.default.createElement(import_react_native5.Animated.View, { style: viewportStyle }, /* @__PURE__ */ import_react6.default.createElement(import_react_native5.Animated.View, { style: containerStyle, collapsable: false }, /* @__PURE__ */ import_react6.default.createElement(import_react_native5.Animated.View, { style: lineStyle })))
|
|
253
|
-
)));
|
|
254
|
-
})
|
|
255
|
-
));
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// src/components/indicator/linear-activity-indicator.tsx
|
|
259
|
-
var import_react8 = __toESM(require("react"), 1);
|
|
260
|
-
var import_react_native6 = require("react-native");
|
|
261
|
-
var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"), 1);
|
|
262
|
-
|
|
263
|
-
// src/components/indicator/indicator.hook.ts
|
|
264
|
-
var import_react7 = require("react");
|
|
265
|
-
var import_react_native_reanimated = require("react-native-reanimated");
|
|
266
|
-
var useLinearActivityIndicatorAnimation = (disableAnimation) => {
|
|
267
|
-
const primaryTranslateX = (0, import_react_native_reanimated.useSharedValue)(0);
|
|
268
|
-
const primaryScaleX = (0, import_react_native_reanimated.useSharedValue)(0.08);
|
|
269
|
-
const secondaryTranslateX = (0, import_react_native_reanimated.useSharedValue)(0);
|
|
270
|
-
const secondaryScaleX = (0, import_react_native_reanimated.useSharedValue)(0.08);
|
|
271
|
-
(0, import_react7.useEffect)(() => {
|
|
272
|
-
if (disableAnimation) {
|
|
273
|
-
(0, import_react_native_reanimated.cancelAnimation)(primaryTranslateX);
|
|
274
|
-
(0, import_react_native_reanimated.cancelAnimation)(primaryScaleX);
|
|
275
|
-
(0, import_react_native_reanimated.cancelAnimation)(secondaryTranslateX);
|
|
276
|
-
(0, import_react_native_reanimated.cancelAnimation)(secondaryScaleX);
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
primaryTranslateX.value = (0, import_react_native_reanimated.withRepeat)(
|
|
280
|
-
(0, import_react_native_reanimated.withSequence)(
|
|
281
|
-
(0, import_react_native_reanimated.withTiming)(0, { duration: 0 }),
|
|
282
|
-
(0, import_react_native_reanimated.withTiming)(0, { duration: 400, easing: import_react_native_reanimated.Easing.linear }),
|
|
283
|
-
(0, import_react_native_reanimated.withTiming)(0.836714, {
|
|
284
|
-
duration: 783,
|
|
285
|
-
easing: import_react_native_reanimated.Easing.bezier(0.5, 0, 0.701732, 0.495819)
|
|
286
|
-
}),
|
|
287
|
-
(0, import_react_native_reanimated.withTiming)(2.00611, {
|
|
288
|
-
duration: 817,
|
|
289
|
-
easing: import_react_native_reanimated.Easing.bezier(0.302435, 0.381352, 0.55, 0.956352)
|
|
290
|
-
})
|
|
291
|
-
),
|
|
292
|
-
-1,
|
|
293
|
-
false
|
|
294
|
-
);
|
|
295
|
-
primaryScaleX.value = (0, import_react_native_reanimated.withRepeat)(
|
|
296
|
-
(0, import_react_native_reanimated.withSequence)(
|
|
297
|
-
(0, import_react_native_reanimated.withTiming)(0.08, { duration: 0 }),
|
|
298
|
-
(0, import_react_native_reanimated.withTiming)(0.08, { duration: 733, easing: import_react_native_reanimated.Easing.linear }),
|
|
299
|
-
(0, import_react_native_reanimated.withTiming)(0.661479, {
|
|
300
|
-
duration: 650,
|
|
301
|
-
easing: import_react_native_reanimated.Easing.bezier(0.334731, 0.12482, 0.785844, 1)
|
|
302
|
-
}),
|
|
303
|
-
(0, import_react_native_reanimated.withTiming)(0.08, {
|
|
304
|
-
duration: 617,
|
|
305
|
-
easing: import_react_native_reanimated.Easing.bezier(0.06, 0.11, 0.6, 1)
|
|
306
|
-
})
|
|
307
|
-
),
|
|
308
|
-
-1,
|
|
309
|
-
false
|
|
310
|
-
);
|
|
311
|
-
secondaryTranslateX.value = (0, import_react_native_reanimated.withRepeat)(
|
|
312
|
-
(0, import_react_native_reanimated.withSequence)(
|
|
313
|
-
(0, import_react_native_reanimated.withTiming)(0, { duration: 0 }),
|
|
314
|
-
(0, import_react_native_reanimated.withTiming)(0.376519, {
|
|
315
|
-
duration: 500,
|
|
316
|
-
easing: import_react_native_reanimated.Easing.bezier(0.15, 0, 0.515058, 0.409685)
|
|
317
|
-
}),
|
|
318
|
-
(0, import_react_native_reanimated.withTiming)(0.843862, {
|
|
319
|
-
duration: 467,
|
|
320
|
-
easing: import_react_native_reanimated.Easing.bezier(0.31033, 0.284058, 0.8, 0.733712)
|
|
321
|
-
}),
|
|
322
|
-
(0, import_react_native_reanimated.withTiming)(1.60278, {
|
|
323
|
-
duration: 1033,
|
|
324
|
-
easing: import_react_native_reanimated.Easing.bezier(0.4, 0.627035, 0.6, 0.902026)
|
|
325
|
-
})
|
|
326
|
-
),
|
|
327
|
-
-1,
|
|
328
|
-
false
|
|
329
|
-
);
|
|
330
|
-
secondaryScaleX.value = (0, import_react_native_reanimated.withRepeat)(
|
|
331
|
-
(0, import_react_native_reanimated.withSequence)(
|
|
332
|
-
(0, import_react_native_reanimated.withTiming)(0.08, { duration: 0 }),
|
|
333
|
-
(0, import_react_native_reanimated.withTiming)(0.457104, {
|
|
334
|
-
duration: 383,
|
|
335
|
-
easing: import_react_native_reanimated.Easing.bezier(0.205028, 0.057051, 0.57661, 0.453971)
|
|
336
|
-
}),
|
|
337
|
-
(0, import_react_native_reanimated.withTiming)(0.72796, {
|
|
338
|
-
duration: 500,
|
|
339
|
-
easing: import_react_native_reanimated.Easing.bezier(0.152313, 0.196432, 0.648374, 1.00432)
|
|
340
|
-
}),
|
|
341
|
-
(0, import_react_native_reanimated.withTiming)(0.08, {
|
|
342
|
-
duration: 1117,
|
|
343
|
-
easing: import_react_native_reanimated.Easing.bezier(0.257759, -3163e-6, 0.211762, 1.38179)
|
|
344
|
-
})
|
|
345
|
-
),
|
|
346
|
-
-1,
|
|
347
|
-
false
|
|
348
|
-
);
|
|
349
|
-
return () => {
|
|
350
|
-
(0, import_react_native_reanimated.cancelAnimation)(primaryTranslateX);
|
|
351
|
-
(0, import_react_native_reanimated.cancelAnimation)(primaryScaleX);
|
|
352
|
-
(0, import_react_native_reanimated.cancelAnimation)(secondaryTranslateX);
|
|
353
|
-
(0, import_react_native_reanimated.cancelAnimation)(secondaryScaleX);
|
|
354
|
-
};
|
|
355
|
-
}, [disableAnimation]);
|
|
356
|
-
return {
|
|
357
|
-
primaryTranslateX,
|
|
358
|
-
primaryScaleX,
|
|
359
|
-
secondaryTranslateX,
|
|
360
|
-
secondaryScaleX
|
|
361
|
-
};
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
// src/components/indicator/linear-activity-indicator.tsx
|
|
365
|
-
var LinearActivityIndicator = ({
|
|
366
|
-
size = 4,
|
|
367
|
-
themeColor = "primary",
|
|
368
|
-
color,
|
|
369
|
-
backgroundColor,
|
|
370
|
-
disableAnimation = false,
|
|
371
|
-
borderRadius = 0,
|
|
372
|
-
showTrack = true
|
|
373
|
-
}) => {
|
|
374
|
-
const theme = useXUITheme();
|
|
375
|
-
const { primaryTranslateX, primaryScaleX, secondaryTranslateX, secondaryScaleX } = useLinearActivityIndicatorAnimation(disableAnimation);
|
|
376
|
-
const colorScheme = theme.colors[themeColor];
|
|
377
|
-
const mainColor = color || colorScheme.main;
|
|
378
|
-
const trackColor = showTrack ? backgroundColor ?? colorScheme.background : "transparent";
|
|
379
|
-
const barStyle = {
|
|
380
|
-
...import_react_native6.StyleSheet.absoluteFillObject,
|
|
381
|
-
backgroundColor: mainColor,
|
|
382
|
-
borderRadius
|
|
383
|
-
};
|
|
384
|
-
const primaryStyle = (0, import_react_native_reanimated2.useAnimatedStyle)(() => ({
|
|
385
|
-
transform: [
|
|
386
|
-
{ translateX: `${(primaryTranslateX.value - 1.45167) * 100}%` },
|
|
387
|
-
{ scaleX: primaryScaleX.value }
|
|
388
|
-
]
|
|
389
|
-
}));
|
|
390
|
-
const secondaryStyle = (0, import_react_native_reanimated2.useAnimatedStyle)(() => ({
|
|
391
|
-
transform: [
|
|
392
|
-
{ translateX: `${(secondaryTranslateX.value - 0.548889) * 100}%` },
|
|
393
|
-
{ scaleX: secondaryScaleX.value }
|
|
394
|
-
]
|
|
395
|
-
}));
|
|
396
|
-
return /* @__PURE__ */ import_react8.default.createElement(
|
|
397
|
-
import_react_native6.View,
|
|
398
|
-
{
|
|
399
|
-
style: {
|
|
400
|
-
height: size,
|
|
401
|
-
width: "100%",
|
|
402
|
-
borderRadius,
|
|
403
|
-
backgroundColor: trackColor,
|
|
404
|
-
overflow: "hidden"
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
/* @__PURE__ */ import_react8.default.createElement(import_react_native_reanimated2.default.View, { style: [barStyle, primaryStyle] }),
|
|
408
|
-
/* @__PURE__ */ import_react8.default.createElement(import_react_native_reanimated2.default.View, { style: [barStyle, secondaryStyle] })
|
|
409
|
-
);
|
|
410
|
-
};
|
|
411
|
-
|
|
412
|
-
// src/components/indicator/indicator.tsx
|
|
413
|
-
var ActivityIndicator = (props) => {
|
|
414
|
-
const {
|
|
415
|
-
variant = "circular",
|
|
416
|
-
themeColor = "primary",
|
|
417
|
-
color,
|
|
418
|
-
backgroundColor,
|
|
419
|
-
size,
|
|
420
|
-
disableAnimation = false,
|
|
421
|
-
borderRadius,
|
|
422
|
-
showTrack
|
|
423
|
-
} = props;
|
|
424
|
-
const theme = useXUITheme();
|
|
425
|
-
const colorScheme = theme.colors[themeColor];
|
|
426
|
-
const mainColor = color ?? colorScheme.main;
|
|
427
|
-
const trackColor = backgroundColor ?? (showTrack ? colorScheme.background : "transparent");
|
|
428
|
-
if (variant === "circular") {
|
|
429
|
-
const circleSize = size ?? 40;
|
|
430
|
-
return /* @__PURE__ */ import_react9.default.createElement(
|
|
431
|
-
import_react_native7.View,
|
|
432
|
-
{
|
|
433
|
-
style: [styles.container, { width: circleSize, height: circleSize }],
|
|
434
|
-
accessible: true,
|
|
435
|
-
accessibilityRole: "progressbar",
|
|
436
|
-
accessibilityLabel: "Loading"
|
|
437
|
-
},
|
|
438
|
-
/* @__PURE__ */ import_react9.default.createElement(
|
|
439
|
-
CircularActivityIndicator,
|
|
440
|
-
{
|
|
441
|
-
size: circleSize,
|
|
442
|
-
themeColor,
|
|
443
|
-
color: mainColor,
|
|
444
|
-
backgroundColor: trackColor,
|
|
445
|
-
disableAnimation
|
|
446
|
-
}
|
|
447
|
-
)
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
const linearSize = size ?? 4;
|
|
451
|
-
return /* @__PURE__ */ import_react9.default.createElement(
|
|
452
|
-
import_react_native7.View,
|
|
453
|
-
{
|
|
454
|
-
style: styles.container,
|
|
455
|
-
accessible: true,
|
|
456
|
-
accessibilityRole: "progressbar",
|
|
457
|
-
accessibilityLabel: "Loading"
|
|
458
|
-
},
|
|
459
|
-
/* @__PURE__ */ import_react9.default.createElement(
|
|
460
|
-
LinearActivityIndicator,
|
|
461
|
-
{
|
|
462
|
-
size: linearSize,
|
|
463
|
-
themeColor,
|
|
464
|
-
color: mainColor,
|
|
465
|
-
backgroundColor: trackColor,
|
|
466
|
-
disableAnimation,
|
|
467
|
-
borderRadius,
|
|
468
|
-
showTrack
|
|
469
|
-
}
|
|
470
|
-
)
|
|
471
|
-
);
|
|
472
|
-
};
|
|
3
|
+
var _chunkKTLGDLCBcjs = require('../chunk-KTLGDLCB.cjs');
|
|
4
|
+
require('../chunk-QMYWIWSX.cjs');
|
|
5
|
+
require('../chunk-HSPTLUFA.cjs');
|
|
473
6
|
|
|
474
|
-
// src/components/fab/fab.style.ts
|
|
475
|
-
var import_react_native8 = require("react-native");
|
|
476
|
-
var styles2 = import_react_native8.StyleSheet.create({
|
|
477
|
-
container: {
|
|
478
|
-
alignSelf: "flex-start"
|
|
479
|
-
},
|
|
480
|
-
fab: {
|
|
481
|
-
flexDirection: "row",
|
|
482
|
-
alignItems: "center",
|
|
483
|
-
justifyContent: "center",
|
|
484
|
-
overflow: "hidden"
|
|
485
|
-
},
|
|
486
|
-
contentContainer: {
|
|
487
|
-
flexDirection: "row",
|
|
488
|
-
alignItems: "center",
|
|
489
|
-
justifyContent: "center",
|
|
490
|
-
gap: 12
|
|
491
|
-
},
|
|
492
|
-
label: {
|
|
493
|
-
fontWeight: "500"
|
|
494
|
-
},
|
|
495
|
-
disabled: {
|
|
496
|
-
opacity: 0.5
|
|
497
|
-
}
|
|
498
|
-
});
|
|
499
7
|
|
|
500
|
-
// src/components/fab/fab.hook.ts
|
|
501
|
-
var import_react10 = require("react");
|
|
502
|
-
var import_core6 = require("@xaui/core");
|
|
503
|
-
function useFabSizeStyles(size) {
|
|
504
|
-
const theme = useXUITheme();
|
|
505
|
-
const sizeStyles = (0, import_react10.useMemo)(() => {
|
|
506
|
-
const sizes = {
|
|
507
|
-
sm: {
|
|
508
|
-
width: 40,
|
|
509
|
-
height: 40,
|
|
510
|
-
borderRadius: theme.borderRadius.lg,
|
|
511
|
-
iconSize: 24,
|
|
512
|
-
fontSize: theme.fontSizes.sm
|
|
513
|
-
},
|
|
514
|
-
md: {
|
|
515
|
-
width: 56,
|
|
516
|
-
height: 56,
|
|
517
|
-
borderRadius: theme.borderRadius.xl,
|
|
518
|
-
iconSize: 24,
|
|
519
|
-
fontSize: theme.fontSizes.md
|
|
520
|
-
},
|
|
521
|
-
lg: {
|
|
522
|
-
width: 96,
|
|
523
|
-
height: 96,
|
|
524
|
-
borderRadius: theme.borderRadius["2xl"],
|
|
525
|
-
iconSize: 36,
|
|
526
|
-
fontSize: theme.fontSizes.lg
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
return sizes[size];
|
|
530
|
-
}, [size, theme]);
|
|
531
|
-
const extendedSizeStyles = (0, import_react10.useMemo)(() => {
|
|
532
|
-
const sizes = {
|
|
533
|
-
sm: {
|
|
534
|
-
height: 40,
|
|
535
|
-
borderRadius: theme.borderRadius.lg,
|
|
536
|
-
paddingHorizontal: theme.spacing.md,
|
|
537
|
-
iconSize: 20,
|
|
538
|
-
fontSize: theme.fontSizes.sm
|
|
539
|
-
},
|
|
540
|
-
md: {
|
|
541
|
-
height: 56,
|
|
542
|
-
borderRadius: theme.borderRadius.xl,
|
|
543
|
-
paddingHorizontal: theme.spacing.lg,
|
|
544
|
-
iconSize: 24,
|
|
545
|
-
fontSize: theme.fontSizes.md
|
|
546
|
-
},
|
|
547
|
-
lg: {
|
|
548
|
-
height: 80,
|
|
549
|
-
borderRadius: theme.borderRadius["2xl"],
|
|
550
|
-
paddingHorizontal: theme.spacing.xl,
|
|
551
|
-
iconSize: 28,
|
|
552
|
-
fontSize: theme.fontSizes.lg
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
return sizes[size];
|
|
556
|
-
}, [size, theme]);
|
|
557
|
-
return { sizeStyles, extendedSizeStyles };
|
|
558
|
-
}
|
|
559
|
-
function useFabVariantStyles(themeColor, variant, elevation = 0) {
|
|
560
|
-
const theme = useXUITheme();
|
|
561
|
-
const safeThemeColor = (0, import_core6.getSafeThemeColor)(themeColor);
|
|
562
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
563
|
-
const variantStyles = (0, import_react10.useMemo)(() => {
|
|
564
|
-
const variantMap = {
|
|
565
|
-
solid: {
|
|
566
|
-
backgroundColor: colorScheme.main,
|
|
567
|
-
borderWidth: 0
|
|
568
|
-
},
|
|
569
|
-
flat: {
|
|
570
|
-
backgroundColor: colorScheme.background,
|
|
571
|
-
borderWidth: 0
|
|
572
|
-
},
|
|
573
|
-
outlined: {
|
|
574
|
-
backgroundColor: "transparent",
|
|
575
|
-
borderWidth: theme.borderWidth.md,
|
|
576
|
-
borderColor: colorScheme.main
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
const baseStyle = variantMap[variant];
|
|
580
|
-
const shouldApplyElevation = variant !== "outlined";
|
|
581
|
-
const shadowStyles = elevation === 0 ? {} : elevation === 1 ? theme.shadows.sm : elevation === 2 ? theme.shadows.md : elevation === 3 ? theme.shadows.lg : theme.shadows.xl;
|
|
582
|
-
return {
|
|
583
|
-
...baseStyle,
|
|
584
|
-
...shouldApplyElevation ? shadowStyles : {},
|
|
585
|
-
...shouldApplyElevation && elevation > 0 ? { elevation } : {}
|
|
586
|
-
};
|
|
587
|
-
}, [variant, colorScheme, theme, elevation]);
|
|
588
|
-
return variantStyles;
|
|
589
|
-
}
|
|
590
|
-
function useFabIconColor(themeColor, variant) {
|
|
591
|
-
const theme = useXUITheme();
|
|
592
|
-
const safeThemeColor = (0, import_core6.getSafeThemeColor)(themeColor);
|
|
593
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
594
|
-
const iconColor = (0, import_react10.useMemo)(() => {
|
|
595
|
-
if (variant === "solid") {
|
|
596
|
-
return colorScheme.foreground;
|
|
597
|
-
}
|
|
598
|
-
return colorScheme.main;
|
|
599
|
-
}, [variant, colorScheme]);
|
|
600
|
-
return { iconColor };
|
|
601
|
-
}
|
|
602
|
-
function useFabRadiusValue(radius, fallback) {
|
|
603
|
-
const theme = useXUITheme();
|
|
604
|
-
return (0, import_react10.useMemo)(() => {
|
|
605
|
-
if (!radius) return fallback;
|
|
606
|
-
const radiusMap = {
|
|
607
|
-
none: theme.borderRadius.none,
|
|
608
|
-
sm: theme.borderRadius.sm,
|
|
609
|
-
md: theme.borderRadius.md,
|
|
610
|
-
lg: theme.borderRadius.lg,
|
|
611
|
-
full: theme.borderRadius.full
|
|
612
|
-
};
|
|
613
|
-
return radiusMap[radius];
|
|
614
|
-
}, [fallback, radius, theme]);
|
|
615
|
-
}
|
|
616
8
|
|
|
617
|
-
|
|
618
|
-
var import_react_native9 = require("react-native");
|
|
619
|
-
var runFabPressInAnimation = (animatedScale, animatedOpacity) => {
|
|
620
|
-
import_react_native9.Animated.parallel([
|
|
621
|
-
import_react_native9.Animated.spring(animatedScale, {
|
|
622
|
-
toValue: 0.92,
|
|
623
|
-
useNativeDriver: true,
|
|
624
|
-
speed: 50,
|
|
625
|
-
bounciness: 0
|
|
626
|
-
}),
|
|
627
|
-
import_react_native9.Animated.timing(animatedOpacity, {
|
|
628
|
-
toValue: 0.85,
|
|
629
|
-
duration: 100,
|
|
630
|
-
useNativeDriver: true
|
|
631
|
-
})
|
|
632
|
-
]).start();
|
|
633
|
-
};
|
|
634
|
-
var runFabPressOutAnimation = (animatedScale, animatedOpacity) => {
|
|
635
|
-
import_react_native9.Animated.parallel([
|
|
636
|
-
import_react_native9.Animated.spring(animatedScale, {
|
|
637
|
-
toValue: 1,
|
|
638
|
-
useNativeDriver: true,
|
|
639
|
-
speed: 50,
|
|
640
|
-
bounciness: 0
|
|
641
|
-
}),
|
|
642
|
-
import_react_native9.Animated.timing(animatedOpacity, {
|
|
643
|
-
toValue: 1,
|
|
644
|
-
duration: 100,
|
|
645
|
-
useNativeDriver: true
|
|
646
|
-
})
|
|
647
|
-
]).start();
|
|
648
|
-
};
|
|
9
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
649
10
|
|
|
650
|
-
// src/components/fab/fab.tsx
|
|
651
|
-
var
|
|
652
|
-
|
|
653
|
-
label,
|
|
654
|
-
themeColor = "primary",
|
|
655
|
-
variant = "solid",
|
|
656
|
-
size = "md",
|
|
657
|
-
radius,
|
|
658
|
-
isDisabled = false,
|
|
659
|
-
isLoading = false,
|
|
660
|
-
elevation = 0,
|
|
661
|
-
customAppearance,
|
|
662
|
-
onPress,
|
|
663
|
-
onLongPress,
|
|
664
|
-
onPressIn,
|
|
665
|
-
onPressOut
|
|
666
|
-
}) => {
|
|
667
|
-
const animatedScale = import_react11.default.useRef(new import_react_native10.Animated.Value(1)).current;
|
|
668
|
-
const animatedOpacity = import_react11.default.useRef(new import_react_native10.Animated.Value(1)).current;
|
|
669
|
-
const { sizeStyles, extendedSizeStyles } = useFabSizeStyles(size);
|
|
670
|
-
const variantStyles = useFabVariantStyles(themeColor, variant, elevation);
|
|
671
|
-
const { iconColor } = useFabIconColor(themeColor, variant);
|
|
672
|
-
const isExtended = !!label;
|
|
673
|
-
const resolvedRadius = useFabRadiusValue(
|
|
674
|
-
radius,
|
|
675
|
-
isExtended ? extendedSizeStyles.borderRadius : sizeStyles.borderRadius
|
|
676
|
-
);
|
|
677
|
-
const handlePressIn = (event) => {
|
|
678
|
-
if (!isDisabled && !isLoading) {
|
|
679
|
-
runFabPressInAnimation(animatedScale, animatedOpacity);
|
|
680
|
-
}
|
|
681
|
-
onPressIn?.(event);
|
|
682
|
-
};
|
|
683
|
-
const handlePressOut = (event) => {
|
|
684
|
-
if (!isDisabled && !isLoading) {
|
|
685
|
-
runFabPressOutAnimation(animatedScale, animatedOpacity);
|
|
686
|
-
}
|
|
687
|
-
onPressOut?.(event);
|
|
688
|
-
};
|
|
689
|
-
const fabDimensionStyles = isExtended ? {
|
|
690
|
-
height: extendedSizeStyles.height,
|
|
691
|
-
borderRadius: resolvedRadius,
|
|
692
|
-
paddingHorizontal: extendedSizeStyles.paddingHorizontal
|
|
693
|
-
} : {
|
|
694
|
-
width: sizeStyles.width,
|
|
695
|
-
height: sizeStyles.height,
|
|
696
|
-
borderRadius: resolvedRadius
|
|
697
|
-
};
|
|
698
|
-
return /* @__PURE__ */ import_react11.default.createElement(import_react_native10.View, { style: [styles2.container, customAppearance?.container] }, /* @__PURE__ */ import_react11.default.createElement(
|
|
699
|
-
import_react_native10.Pressable,
|
|
700
|
-
{
|
|
701
|
-
onPress: isDisabled || isLoading ? void 0 : onPress,
|
|
702
|
-
onLongPress: isDisabled || isLoading ? void 0 : onLongPress,
|
|
703
|
-
onPressIn: handlePressIn,
|
|
704
|
-
onPressOut: handlePressOut,
|
|
705
|
-
disabled: isDisabled || isLoading
|
|
706
|
-
},
|
|
707
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
|
708
|
-
import_react_native10.Animated.View,
|
|
709
|
-
{
|
|
710
|
-
style: [
|
|
711
|
-
styles2.fab,
|
|
712
|
-
fabDimensionStyles,
|
|
713
|
-
variantStyles,
|
|
714
|
-
isDisabled && styles2.disabled,
|
|
715
|
-
{
|
|
716
|
-
transform: [{ scale: animatedScale }],
|
|
717
|
-
opacity: animatedOpacity
|
|
718
|
-
},
|
|
719
|
-
customAppearance?.fab
|
|
720
|
-
]
|
|
721
|
-
},
|
|
722
|
-
isLoading ? /* @__PURE__ */ import_react11.default.createElement(
|
|
723
|
-
ActivityIndicator,
|
|
724
|
-
{
|
|
725
|
-
variant: "circular",
|
|
726
|
-
themeColor: variant === "solid" ? void 0 : themeColor,
|
|
727
|
-
color: variant === "solid" ? iconColor : void 0,
|
|
728
|
-
size: isExtended ? extendedSizeStyles.iconSize : sizeStyles.iconSize
|
|
729
|
-
}
|
|
730
|
-
) : /* @__PURE__ */ import_react11.default.createElement(import_react_native10.View, { style: styles2.contentContainer }, icon, isExtended && /* @__PURE__ */ import_react11.default.createElement(
|
|
731
|
-
import_react_native10.Text,
|
|
732
|
-
{
|
|
733
|
-
style: [
|
|
734
|
-
styles2.label,
|
|
735
|
-
{
|
|
736
|
-
fontSize: isExtended ? extendedSizeStyles.fontSize : sizeStyles.fontSize,
|
|
737
|
-
color: iconColor
|
|
738
|
-
}
|
|
739
|
-
]
|
|
740
|
-
},
|
|
741
|
-
label
|
|
742
|
-
))
|
|
743
|
-
)
|
|
744
|
-
));
|
|
745
|
-
};
|
|
11
|
+
// src/components/fab-menu/fab-menu.tsx
|
|
12
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
13
|
+
var _reactnative = require('react-native');
|
|
746
14
|
|
|
747
15
|
// src/components/fab-menu/fab-menu.style.ts
|
|
748
|
-
|
|
749
|
-
var
|
|
16
|
+
|
|
17
|
+
var styles = _reactnative.StyleSheet.create({
|
|
750
18
|
container: {
|
|
751
19
|
position: "relative",
|
|
752
20
|
alignItems: "flex-end"
|
|
753
21
|
},
|
|
754
22
|
portalRoot: {
|
|
755
|
-
...
|
|
23
|
+
..._reactnative.StyleSheet.absoluteFillObject
|
|
756
24
|
},
|
|
757
25
|
overlay: {
|
|
758
|
-
...
|
|
26
|
+
..._reactnative.StyleSheet.absoluteFillObject
|
|
759
27
|
},
|
|
760
28
|
overlayPressable: {
|
|
761
29
|
flex: 1
|
|
762
30
|
},
|
|
763
31
|
portalContent: {
|
|
764
|
-
...
|
|
32
|
+
..._reactnative.StyleSheet.absoluteFillObject,
|
|
765
33
|
justifyContent: "flex-end",
|
|
766
34
|
alignItems: "flex-end",
|
|
767
35
|
padding: 16
|
|
@@ -790,32 +58,32 @@ var styles3 = import_react_native11.StyleSheet.create({
|
|
|
790
58
|
});
|
|
791
59
|
|
|
792
60
|
// src/components/fab-menu/fab-menu.hook.ts
|
|
793
|
-
|
|
794
|
-
var
|
|
61
|
+
|
|
62
|
+
var _core = require('@xaui/core');
|
|
795
63
|
function useFabMenuState(controlledExpanded, onToggle) {
|
|
796
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
64
|
+
const [internalExpanded, setInternalExpanded] = _react.useState.call(void 0, false);
|
|
797
65
|
const isControlled = controlledExpanded !== void 0;
|
|
798
66
|
const expanded = isControlled ? controlledExpanded : internalExpanded;
|
|
799
|
-
const toggle = (0,
|
|
67
|
+
const toggle = _react.useCallback.call(void 0, () => {
|
|
800
68
|
const next = !expanded;
|
|
801
69
|
if (!isControlled) {
|
|
802
70
|
setInternalExpanded(next);
|
|
803
71
|
}
|
|
804
|
-
onToggle
|
|
72
|
+
_optionalChain([onToggle, 'optionalCall', _2 => _2(next)]);
|
|
805
73
|
}, [expanded, isControlled, onToggle]);
|
|
806
|
-
const close = (0,
|
|
74
|
+
const close = _react.useCallback.call(void 0, () => {
|
|
807
75
|
if (!isControlled) {
|
|
808
76
|
setInternalExpanded(false);
|
|
809
77
|
}
|
|
810
|
-
onToggle
|
|
78
|
+
_optionalChain([onToggle, 'optionalCall', _3 => _3(false)]);
|
|
811
79
|
}, [isControlled, onToggle]);
|
|
812
80
|
return { expanded, toggle, close };
|
|
813
81
|
}
|
|
814
82
|
function useFabMenuItemStyles(themeColor) {
|
|
815
|
-
const theme = useXUITheme();
|
|
816
|
-
const safeThemeColor = (0,
|
|
83
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
84
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
817
85
|
const colorScheme = theme.colors[safeThemeColor];
|
|
818
|
-
const itemStyles = (0,
|
|
86
|
+
const itemStyles = _react.useMemo.call(void 0, () => {
|
|
819
87
|
const chipStyles = {
|
|
820
88
|
backgroundColor: colorScheme.background,
|
|
821
89
|
borderRadius: theme.borderRadius.full,
|
|
@@ -828,53 +96,53 @@ function useFabMenuItemStyles(themeColor) {
|
|
|
828
96
|
return itemStyles;
|
|
829
97
|
}
|
|
830
98
|
function useFabMenuOverlayColor() {
|
|
831
|
-
const theme = useXUITheme();
|
|
832
|
-
return (0,
|
|
99
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
100
|
+
return _react.useMemo.call(void 0, () => {
|
|
833
101
|
return theme.mode === "dark" ? "rgba(0, 0, 0, 0.5)" : "rgba(0, 0, 0, 0.3)";
|
|
834
102
|
}, [theme.mode]);
|
|
835
103
|
}
|
|
836
104
|
|
|
837
105
|
// src/components/fab-menu/fab-menu.animation.ts
|
|
838
|
-
|
|
106
|
+
|
|
839
107
|
var runMenuExpandAnimation = (overlayOpacity, itemAnimations) => {
|
|
840
108
|
const itemSequence = itemAnimations.map(
|
|
841
|
-
(anim, index) =>
|
|
109
|
+
(anim, index) => _reactnative.Animated.timing(anim, {
|
|
842
110
|
toValue: 1,
|
|
843
111
|
duration: 150,
|
|
844
112
|
delay: index * 50,
|
|
845
113
|
useNativeDriver: true
|
|
846
114
|
})
|
|
847
115
|
);
|
|
848
|
-
|
|
849
|
-
|
|
116
|
+
_reactnative.Animated.parallel([
|
|
117
|
+
_reactnative.Animated.timing(overlayOpacity, {
|
|
850
118
|
toValue: 1,
|
|
851
119
|
duration: 200,
|
|
852
120
|
useNativeDriver: true
|
|
853
121
|
}),
|
|
854
|
-
|
|
122
|
+
_reactnative.Animated.stagger(50, itemSequence)
|
|
855
123
|
]).start();
|
|
856
124
|
};
|
|
857
125
|
var runMenuCollapseAnimation = (overlayOpacity, itemAnimations, onComplete) => {
|
|
858
126
|
const reversed = [...itemAnimations].reverse();
|
|
859
127
|
const itemSequence = reversed.map(
|
|
860
|
-
(anim, index) =>
|
|
128
|
+
(anim, index) => _reactnative.Animated.timing(anim, {
|
|
861
129
|
toValue: 0,
|
|
862
130
|
duration: 120,
|
|
863
131
|
delay: index * 30,
|
|
864
132
|
useNativeDriver: true
|
|
865
133
|
})
|
|
866
134
|
);
|
|
867
|
-
|
|
868
|
-
|
|
135
|
+
_reactnative.Animated.parallel([
|
|
136
|
+
_reactnative.Animated.timing(overlayOpacity, {
|
|
869
137
|
toValue: 0,
|
|
870
138
|
duration: 200,
|
|
871
139
|
useNativeDriver: true
|
|
872
140
|
}),
|
|
873
|
-
|
|
141
|
+
_reactnative.Animated.stagger(30, itemSequence)
|
|
874
142
|
]).start(onComplete);
|
|
875
143
|
};
|
|
876
144
|
var runFabRotateAnimation = (rotateValue, toExpanded) => {
|
|
877
|
-
|
|
145
|
+
_reactnative.Animated.spring(rotateValue, {
|
|
878
146
|
toValue: toExpanded ? 1 : 0,
|
|
879
147
|
useNativeDriver: true,
|
|
880
148
|
speed: 20,
|
|
@@ -900,20 +168,20 @@ var FabMenu = ({
|
|
|
900
168
|
}) => {
|
|
901
169
|
const { expanded, toggle, close } = useFabMenuState(controlledExpanded, onToggle);
|
|
902
170
|
const overlayColor = useFabMenuOverlayColor();
|
|
903
|
-
const [isPortalVisible, setIsPortalVisible] =
|
|
904
|
-
const childArray =
|
|
905
|
-
const overlayOpacity =
|
|
906
|
-
const rotateValue =
|
|
907
|
-
const itemAnimationsRef =
|
|
171
|
+
const [isPortalVisible, setIsPortalVisible] = _react2.default.useState(expanded);
|
|
172
|
+
const childArray = _react2.default.Children.toArray(children);
|
|
173
|
+
const overlayOpacity = _react2.default.useRef(new _reactnative.Animated.Value(expanded ? 1 : 0)).current;
|
|
174
|
+
const rotateValue = _react2.default.useRef(new _reactnative.Animated.Value(expanded ? 1 : 0)).current;
|
|
175
|
+
const itemAnimationsRef = _react2.default.useRef(childArray.map(() => new _reactnative.Animated.Value(0)));
|
|
908
176
|
const itemAnimations = itemAnimationsRef.current;
|
|
909
|
-
const prevExpanded =
|
|
910
|
-
|
|
177
|
+
const prevExpanded = _react2.default.useRef(expanded);
|
|
178
|
+
_react2.default.useEffect(() => {
|
|
911
179
|
if (itemAnimations.length === childArray.length) return;
|
|
912
180
|
itemAnimationsRef.current = childArray.map(
|
|
913
|
-
(_, index) => itemAnimations[index]
|
|
181
|
+
(_, index) => _nullishCoalesce(itemAnimations[index], () => ( new _reactnative.Animated.Value(expanded ? 1 : 0)))
|
|
914
182
|
);
|
|
915
183
|
}, [expanded, itemAnimations, childArray]);
|
|
916
|
-
|
|
184
|
+
_react2.default.useEffect(() => {
|
|
917
185
|
if (prevExpanded.current === expanded) return;
|
|
918
186
|
prevExpanded.current = expanded;
|
|
919
187
|
if (expanded) {
|
|
@@ -932,16 +200,16 @@ var FabMenu = ({
|
|
|
932
200
|
outputRange: ["0deg", "45deg"]
|
|
933
201
|
});
|
|
934
202
|
const currentIcon = expanded && expandedIcon ? expandedIcon : icon;
|
|
935
|
-
const renderFabToggle = () => /* @__PURE__ */
|
|
936
|
-
|
|
203
|
+
const renderFabToggle = () => /* @__PURE__ */ _react2.default.createElement(
|
|
204
|
+
_reactnative.Animated.View,
|
|
937
205
|
{
|
|
938
206
|
style: {
|
|
939
207
|
alignSelf: "flex-end",
|
|
940
208
|
transform: [{ rotate: expandedIcon ? "0deg" : rotation }]
|
|
941
209
|
}
|
|
942
210
|
},
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
Fab,
|
|
211
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
212
|
+
_chunkKTLGDLCBcjs.Fab,
|
|
945
213
|
{
|
|
946
214
|
icon: currentIcon,
|
|
947
215
|
label,
|
|
@@ -951,20 +219,20 @@ var FabMenu = ({
|
|
|
951
219
|
radius,
|
|
952
220
|
elevation,
|
|
953
221
|
onPress: toggle,
|
|
954
|
-
customAppearance: { fab: customAppearance
|
|
222
|
+
customAppearance: { fab: _optionalChain([customAppearance, 'optionalAccess', _4 => _4.fab]) }
|
|
955
223
|
}
|
|
956
224
|
)
|
|
957
225
|
);
|
|
958
|
-
const renderMenuItems = () => /* @__PURE__ */
|
|
226
|
+
const renderMenuItems = () => /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.menuContainer, _optionalChain([customAppearance, 'optionalAccess', _5 => _5.menuContainer])] }, childArray.map((child, index) => {
|
|
959
227
|
const childElement = child;
|
|
960
|
-
const isDisabled = childElement.props
|
|
961
|
-
return /* @__PURE__ */
|
|
962
|
-
|
|
228
|
+
const isDisabled = _optionalChain([childElement, 'access', _6 => _6.props, 'optionalAccess', _7 => _7.isDisabled]);
|
|
229
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
230
|
+
_reactnative.Animated.View,
|
|
963
231
|
{
|
|
964
|
-
key: childElement.key
|
|
232
|
+
key: _nullishCoalesce(childElement.key, () => ( index)),
|
|
965
233
|
style: [
|
|
966
|
-
|
|
967
|
-
isDisabled &&
|
|
234
|
+
styles.menuItem,
|
|
235
|
+
isDisabled && styles.disabled,
|
|
968
236
|
{
|
|
969
237
|
opacity: itemAnimations[index],
|
|
970
238
|
transform: [
|
|
@@ -982,31 +250,31 @@ var FabMenu = ({
|
|
|
982
250
|
}
|
|
983
251
|
]
|
|
984
252
|
},
|
|
985
|
-
customAppearance
|
|
253
|
+
_optionalChain([customAppearance, 'optionalAccess', _8 => _8.menuItem])
|
|
986
254
|
]
|
|
987
255
|
},
|
|
988
|
-
|
|
256
|
+
_react2.default.cloneElement(childElement, {
|
|
989
257
|
_onClose: close,
|
|
990
|
-
themeColor: childElement.props
|
|
258
|
+
themeColor: _nullishCoalesce(_optionalChain([childElement, 'access', _9 => _9.props, 'optionalAccess', _10 => _10.themeColor]), () => ( themeColor))
|
|
991
259
|
})
|
|
992
260
|
);
|
|
993
261
|
}));
|
|
994
|
-
return /* @__PURE__ */
|
|
995
|
-
|
|
262
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, _optionalChain([customAppearance, 'optionalAccess', _11 => _11.container])] }, isPortalVisible && /* @__PURE__ */ _react2.default.createElement(_chunkOQ2BLOOGcjs.Portal, null, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.portalRoot }, showOverlay && /* @__PURE__ */ _react2.default.createElement(
|
|
263
|
+
_reactnative.Animated.View,
|
|
996
264
|
{
|
|
997
265
|
style: [
|
|
998
|
-
|
|
266
|
+
styles.overlay,
|
|
999
267
|
{ backgroundColor: overlayColor, opacity: overlayOpacity },
|
|
1000
|
-
customAppearance
|
|
268
|
+
_optionalChain([customAppearance, 'optionalAccess', _12 => _12.overlay])
|
|
1001
269
|
]
|
|
1002
270
|
},
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
), /* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.Pressable, { style: styles.overlayPressable, onPress: close })
|
|
272
|
+
), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.portalContent }, renderMenuItems(), renderFabToggle()))), !isPortalVisible && renderFabToggle());
|
|
1005
273
|
};
|
|
1006
274
|
|
|
1007
275
|
// src/components/fab-menu/fab-menu-item.tsx
|
|
1008
|
-
|
|
1009
|
-
|
|
276
|
+
|
|
277
|
+
|
|
1010
278
|
var FabMenuItem = ({
|
|
1011
279
|
icon,
|
|
1012
280
|
label,
|
|
@@ -1017,17 +285,17 @@ var FabMenuItem = ({
|
|
|
1017
285
|
}) => {
|
|
1018
286
|
const itemStyles = useFabMenuItemStyles(themeColor);
|
|
1019
287
|
const renderIcon = (menuIcon) => {
|
|
1020
|
-
if (!
|
|
1021
|
-
return
|
|
288
|
+
if (!_react2.default.isValidElement(menuIcon)) return menuIcon;
|
|
289
|
+
return _react2.default.cloneElement(
|
|
1022
290
|
menuIcon,
|
|
1023
291
|
{ color: itemStyles.iconColor }
|
|
1024
292
|
);
|
|
1025
293
|
};
|
|
1026
|
-
return /* @__PURE__ */
|
|
1027
|
-
|
|
294
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
295
|
+
_reactnative.Pressable,
|
|
1028
296
|
{
|
|
1029
297
|
style: [
|
|
1030
|
-
|
|
298
|
+
styles.menuItemChip,
|
|
1031
299
|
{
|
|
1032
300
|
backgroundColor: itemStyles.chipStyles.backgroundColor,
|
|
1033
301
|
borderRadius: itemStyles.chipStyles.borderRadius
|
|
@@ -1035,17 +303,17 @@ var FabMenuItem = ({
|
|
|
1035
303
|
],
|
|
1036
304
|
onPress: (event) => {
|
|
1037
305
|
if (isDisabled) return;
|
|
1038
|
-
onPress
|
|
1039
|
-
_onClose
|
|
306
|
+
_optionalChain([onPress, 'optionalCall', _13 => _13(event)]);
|
|
307
|
+
_optionalChain([_onClose, 'optionalCall', _14 => _14()]);
|
|
1040
308
|
},
|
|
1041
309
|
disabled: isDisabled
|
|
1042
310
|
},
|
|
1043
311
|
renderIcon(icon),
|
|
1044
|
-
/* @__PURE__ */
|
|
1045
|
-
|
|
312
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
313
|
+
_reactnative.Text,
|
|
1046
314
|
{
|
|
1047
315
|
style: [
|
|
1048
|
-
|
|
316
|
+
styles.menuItemLabel,
|
|
1049
317
|
{
|
|
1050
318
|
color: itemStyles.chipStyles.color,
|
|
1051
319
|
fontSize: itemStyles.chipStyles.fontSize
|
|
@@ -1056,8 +324,7 @@ var FabMenuItem = ({
|
|
|
1056
324
|
)
|
|
1057
325
|
);
|
|
1058
326
|
};
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
});
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
exports.FabMenu = FabMenu; exports.FabMenuItem = FabMenuItem;
|