@xaui/native 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,672 @@
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/button/index.ts
31
+ var button_exports = {};
32
+ __export(button_exports, {
33
+ Button: () => Button
34
+ });
35
+ module.exports = __toCommonJS(button_exports);
36
+
37
+ // src/components/button/button.tsx
38
+ var import_react8 = __toESM(require("react"), 1);
39
+ var import_react_native8 = require("react-native");
40
+
41
+ // src/components/indicator/indicator.tsx
42
+ var import_react6 = __toESM(require("react"), 1);
43
+ var import_react_native6 = require("react-native");
44
+
45
+ // src/core/theme-context.tsx
46
+ var import_react = __toESM(require("react"), 1);
47
+ var import_react_native = require("react-native");
48
+ var import_theme = require("@xaui/core/theme");
49
+ var XUIThemeContext = (0, import_react.createContext)(null);
50
+
51
+ // src/core/theme-hooks.ts
52
+ var import_react2 = require("react");
53
+ var import_react_native2 = require("react-native");
54
+ function useXUITheme() {
55
+ const theme = (0, import_react2.useContext)(XUIThemeContext);
56
+ if (!theme) {
57
+ throw new Error("useXUITheme must be used within XUIProvider");
58
+ }
59
+ return theme;
60
+ }
61
+
62
+ // src/components/indicator/circular-activity-indicator.tsx
63
+ var import_react3 = __toESM(require("react"), 1);
64
+ var import_react_native4 = require("react-native");
65
+
66
+ // src/components/indicator/indicator.style.ts
67
+ var import_react_native3 = require("react-native");
68
+ var styles = import_react_native3.StyleSheet.create({
69
+ container: {
70
+ width: "100%",
71
+ justifyContent: "center"
72
+ },
73
+ layer: {
74
+ ...import_react_native3.StyleSheet.absoluteFillObject,
75
+ justifyContent: "center",
76
+ alignItems: "center"
77
+ },
78
+ track: {
79
+ width: "100%",
80
+ overflow: "hidden"
81
+ },
82
+ progress: {
83
+ height: "100%"
84
+ }
85
+ });
86
+
87
+ // src/components/indicator/circular-activity-indicator.tsx
88
+ var import_core2 = require("@xaui/core");
89
+ var DURATION = 1800;
90
+ var CircularActivityIndicator = ({
91
+ size = 40,
92
+ themeColor = "primary",
93
+ color,
94
+ backgroundColor,
95
+ disableAnimation = false,
96
+ showTrack = true
97
+ }) => {
98
+ const theme = useXUITheme();
99
+ const { current: timer } = (0, import_react3.useRef)(new import_react_native4.Animated.Value(0));
100
+ const rotation = (0, import_react3.useRef)(void 0);
101
+ const startRotation = import_react3.default.useCallback(() => {
102
+ if (rotation.current) {
103
+ timer.setValue(0);
104
+ import_react_native4.Animated.loop(rotation.current).start();
105
+ }
106
+ }, [timer]);
107
+ const stopRotation = () => {
108
+ if (rotation.current) rotation.current.stop();
109
+ };
110
+ (0, import_react3.useEffect)(() => {
111
+ if (rotation.current === void 0) {
112
+ rotation.current = import_react_native4.Animated.timing(timer, {
113
+ duration: DURATION,
114
+ easing: import_react_native4.Easing.linear,
115
+ useNativeDriver: import_react_native4.Platform.OS !== "web",
116
+ toValue: 1
117
+ });
118
+ }
119
+ if (!disableAnimation) startRotation();
120
+ else stopRotation();
121
+ }, [disableAnimation, startRotation, timer]);
122
+ const safeThemeColor = (0, import_core2.getSafeThemeColor)(themeColor);
123
+ const colorScheme = theme.colors[safeThemeColor];
124
+ const mainColor = color || colorScheme.main;
125
+ const trackColor = showTrack ? backgroundColor ?? colorScheme.background : "transparent";
126
+ const strokeWidth = size * 0.1;
127
+ const frames = 60 * DURATION / 1e3;
128
+ const easing = import_react_native4.Easing.bezier(0.4, 0, 0.7, 1);
129
+ const containerStyle = {
130
+ width: size,
131
+ height: size / 2,
132
+ overflow: "hidden"
133
+ };
134
+ return /* @__PURE__ */ import_react3.default.createElement(import_react_native4.View, { style: [styles.container, { width: size, height: size }] }, /* @__PURE__ */ import_react3.default.createElement(
135
+ import_react_native4.View,
136
+ {
137
+ style: {
138
+ width: size,
139
+ height: size,
140
+ borderRadius: size / 2,
141
+ borderWidth: strokeWidth,
142
+ borderColor: trackColor
143
+ }
144
+ }
145
+ ), /* @__PURE__ */ import_react3.default.createElement(
146
+ import_react_native4.View,
147
+ {
148
+ style: {
149
+ width: size,
150
+ height: size,
151
+ position: "absolute"
152
+ }
153
+ },
154
+ [0, 1].map((index) => {
155
+ const inputRange = Array.from(
156
+ new Array(frames),
157
+ (_, frameIndex) => frameIndex / (frames - 1)
158
+ );
159
+ const outputRange = Array.from(new Array(frames), (_, frameIndex) => {
160
+ let progress = 2 * frameIndex / (frames - 1);
161
+ const rotationValue = index ? +(360 - 15) : -(180 - 15);
162
+ if (progress > 1) {
163
+ progress = 2 - progress;
164
+ }
165
+ const direction = index ? -1 : 1;
166
+ return `${direction * (180 - 30) * easing(progress) + rotationValue}deg`;
167
+ });
168
+ const layerStyle = {
169
+ width: size,
170
+ height: size,
171
+ transform: [
172
+ {
173
+ rotate: timer.interpolate({
174
+ inputRange: [0, 1],
175
+ outputRange: [`${0 + 30 + 15}deg`, `${2 * 360 + 30 + 15}deg`]
176
+ })
177
+ }
178
+ ]
179
+ };
180
+ const viewportStyle = {
181
+ width: size,
182
+ height: size,
183
+ transform: [
184
+ { translateY: index ? -size / 2 : 0 },
185
+ {
186
+ rotate: timer.interpolate({ inputRange, outputRange })
187
+ }
188
+ ]
189
+ };
190
+ const offsetStyle = index ? { top: size / 2 } : null;
191
+ const lineStyle = {
192
+ width: size,
193
+ height: size,
194
+ borderColor: mainColor,
195
+ borderWidth: strokeWidth,
196
+ borderRadius: size / 2
197
+ };
198
+ return /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Animated.View, { key: index, style: [styles.layer] }, /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Animated.View, { style: layerStyle }, /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Animated.View, { style: [containerStyle, offsetStyle], collapsable: false }, /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Animated.View, { style: viewportStyle }, /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Animated.View, { style: containerStyle, collapsable: false }, /* @__PURE__ */ import_react3.default.createElement(import_react_native4.Animated.View, { style: lineStyle }))))));
199
+ })
200
+ ));
201
+ };
202
+
203
+ // src/components/indicator/linear-activity-indicator.tsx
204
+ var import_react5 = __toESM(require("react"), 1);
205
+ var import_react_native5 = require("react-native");
206
+ var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"), 1);
207
+
208
+ // src/components/indicator/indicator.hook.ts
209
+ var import_react4 = require("react");
210
+ var import_react_native_reanimated = require("react-native-reanimated");
211
+ var useLinearActivityIndicatorAnimation = (disableAnimation) => {
212
+ const primaryTranslateX = (0, import_react_native_reanimated.useSharedValue)(0);
213
+ const primaryScaleX = (0, import_react_native_reanimated.useSharedValue)(0.08);
214
+ const secondaryTranslateX = (0, import_react_native_reanimated.useSharedValue)(0);
215
+ const secondaryScaleX = (0, import_react_native_reanimated.useSharedValue)(0.08);
216
+ (0, import_react4.useEffect)(() => {
217
+ if (disableAnimation) {
218
+ (0, import_react_native_reanimated.cancelAnimation)(primaryTranslateX);
219
+ (0, import_react_native_reanimated.cancelAnimation)(primaryScaleX);
220
+ (0, import_react_native_reanimated.cancelAnimation)(secondaryTranslateX);
221
+ (0, import_react_native_reanimated.cancelAnimation)(secondaryScaleX);
222
+ return;
223
+ }
224
+ primaryTranslateX.value = (0, import_react_native_reanimated.withRepeat)(
225
+ (0, import_react_native_reanimated.withSequence)(
226
+ (0, import_react_native_reanimated.withTiming)(0, { duration: 0 }),
227
+ (0, import_react_native_reanimated.withTiming)(0, { duration: 400, easing: import_react_native_reanimated.Easing.linear }),
228
+ (0, import_react_native_reanimated.withTiming)(0.836714, {
229
+ duration: 783,
230
+ easing: import_react_native_reanimated.Easing.bezier(0.5, 0, 0.701732, 0.495819)
231
+ }),
232
+ (0, import_react_native_reanimated.withTiming)(2.00611, {
233
+ duration: 817,
234
+ easing: import_react_native_reanimated.Easing.bezier(0.302435, 0.381352, 0.55, 0.956352)
235
+ })
236
+ ),
237
+ -1,
238
+ false
239
+ );
240
+ primaryScaleX.value = (0, import_react_native_reanimated.withRepeat)(
241
+ (0, import_react_native_reanimated.withSequence)(
242
+ (0, import_react_native_reanimated.withTiming)(0.08, { duration: 0 }),
243
+ (0, import_react_native_reanimated.withTiming)(0.08, { duration: 733, easing: import_react_native_reanimated.Easing.linear }),
244
+ (0, import_react_native_reanimated.withTiming)(0.661479, {
245
+ duration: 650,
246
+ easing: import_react_native_reanimated.Easing.bezier(0.334731, 0.12482, 0.785844, 1)
247
+ }),
248
+ (0, import_react_native_reanimated.withTiming)(0.08, {
249
+ duration: 617,
250
+ easing: import_react_native_reanimated.Easing.bezier(0.06, 0.11, 0.6, 1)
251
+ })
252
+ ),
253
+ -1,
254
+ false
255
+ );
256
+ secondaryTranslateX.value = (0, import_react_native_reanimated.withRepeat)(
257
+ (0, import_react_native_reanimated.withSequence)(
258
+ (0, import_react_native_reanimated.withTiming)(0, { duration: 0 }),
259
+ (0, import_react_native_reanimated.withTiming)(0.376519, {
260
+ duration: 500,
261
+ easing: import_react_native_reanimated.Easing.bezier(0.15, 0, 0.515058, 0.409685)
262
+ }),
263
+ (0, import_react_native_reanimated.withTiming)(0.843862, {
264
+ duration: 467,
265
+ easing: import_react_native_reanimated.Easing.bezier(0.31033, 0.284058, 0.8, 0.733712)
266
+ }),
267
+ (0, import_react_native_reanimated.withTiming)(1.60278, {
268
+ duration: 1033,
269
+ easing: import_react_native_reanimated.Easing.bezier(0.4, 0.627035, 0.6, 0.902026)
270
+ })
271
+ ),
272
+ -1,
273
+ false
274
+ );
275
+ secondaryScaleX.value = (0, import_react_native_reanimated.withRepeat)(
276
+ (0, import_react_native_reanimated.withSequence)(
277
+ (0, import_react_native_reanimated.withTiming)(0.08, { duration: 0 }),
278
+ (0, import_react_native_reanimated.withTiming)(0.457104, {
279
+ duration: 383,
280
+ easing: import_react_native_reanimated.Easing.bezier(0.205028, 0.057051, 0.57661, 0.453971)
281
+ }),
282
+ (0, import_react_native_reanimated.withTiming)(0.72796, {
283
+ duration: 500,
284
+ easing: import_react_native_reanimated.Easing.bezier(0.152313, 0.196432, 0.648374, 1.00432)
285
+ }),
286
+ (0, import_react_native_reanimated.withTiming)(0.08, {
287
+ duration: 1117,
288
+ easing: import_react_native_reanimated.Easing.bezier(0.257759, -3163e-6, 0.211762, 1.38179)
289
+ })
290
+ ),
291
+ -1,
292
+ false
293
+ );
294
+ return () => {
295
+ (0, import_react_native_reanimated.cancelAnimation)(primaryTranslateX);
296
+ (0, import_react_native_reanimated.cancelAnimation)(primaryScaleX);
297
+ (0, import_react_native_reanimated.cancelAnimation)(secondaryTranslateX);
298
+ (0, import_react_native_reanimated.cancelAnimation)(secondaryScaleX);
299
+ };
300
+ }, [disableAnimation]);
301
+ return {
302
+ primaryTranslateX,
303
+ primaryScaleX,
304
+ secondaryTranslateX,
305
+ secondaryScaleX
306
+ };
307
+ };
308
+
309
+ // src/components/indicator/linear-activity-indicator.tsx
310
+ var LinearActivityIndicator = ({
311
+ size = 4,
312
+ themeColor = "primary",
313
+ color,
314
+ backgroundColor,
315
+ disableAnimation = false,
316
+ borderRadius = 0,
317
+ showTrack = true
318
+ }) => {
319
+ const theme = useXUITheme();
320
+ const { primaryTranslateX, primaryScaleX, secondaryTranslateX, secondaryScaleX } = useLinearActivityIndicatorAnimation(disableAnimation);
321
+ const colorScheme = theme.colors[themeColor];
322
+ const mainColor = color || colorScheme.main;
323
+ const trackColor = showTrack ? backgroundColor ?? colorScheme.background : "transparent";
324
+ const barStyle = {
325
+ ...import_react_native5.StyleSheet.absoluteFillObject,
326
+ backgroundColor: mainColor,
327
+ borderRadius
328
+ };
329
+ const primaryStyle = (0, import_react_native_reanimated2.useAnimatedStyle)(() => ({
330
+ transform: [
331
+ { translateX: `${(primaryTranslateX.value - 1.45167) * 100}%` },
332
+ { scaleX: primaryScaleX.value }
333
+ ]
334
+ }));
335
+ const secondaryStyle = (0, import_react_native_reanimated2.useAnimatedStyle)(() => ({
336
+ transform: [
337
+ { translateX: `${(secondaryTranslateX.value - 0.548889) * 100}%` },
338
+ { scaleX: secondaryScaleX.value }
339
+ ]
340
+ }));
341
+ return /* @__PURE__ */ import_react5.default.createElement(
342
+ import_react_native5.View,
343
+ {
344
+ style: {
345
+ height: size,
346
+ width: "100%",
347
+ borderRadius,
348
+ backgroundColor: trackColor,
349
+ overflow: "hidden"
350
+ }
351
+ },
352
+ /* @__PURE__ */ import_react5.default.createElement(import_react_native_reanimated2.default.View, { style: [barStyle, primaryStyle] }),
353
+ /* @__PURE__ */ import_react5.default.createElement(import_react_native_reanimated2.default.View, { style: [barStyle, secondaryStyle] })
354
+ );
355
+ };
356
+
357
+ // src/components/indicator/indicator.tsx
358
+ var ActivityIndicator = (props) => {
359
+ const {
360
+ variant = "circular",
361
+ themeColor = "primary",
362
+ color,
363
+ backgroundColor,
364
+ size,
365
+ disableAnimation = false,
366
+ borderRadius,
367
+ showTrack
368
+ } = props;
369
+ const theme = useXUITheme();
370
+ const colorScheme = theme.colors[themeColor];
371
+ const mainColor = color ?? colorScheme.main;
372
+ const trackColor = backgroundColor ?? (showTrack ? colorScheme.background : "transparent");
373
+ if (variant === "circular") {
374
+ const circleSize = size ?? 40;
375
+ return /* @__PURE__ */ import_react6.default.createElement(
376
+ import_react_native6.View,
377
+ {
378
+ style: [styles.container, { width: circleSize, height: circleSize }],
379
+ accessible: true,
380
+ accessibilityRole: "progressbar",
381
+ accessibilityLabel: "Loading"
382
+ },
383
+ /* @__PURE__ */ import_react6.default.createElement(
384
+ CircularActivityIndicator,
385
+ {
386
+ size: circleSize,
387
+ themeColor,
388
+ color: mainColor,
389
+ backgroundColor: trackColor,
390
+ disableAnimation
391
+ }
392
+ )
393
+ );
394
+ }
395
+ const linearSize = size ?? 4;
396
+ return /* @__PURE__ */ import_react6.default.createElement(
397
+ import_react_native6.View,
398
+ {
399
+ style: styles.container,
400
+ accessible: true,
401
+ accessibilityRole: "progressbar",
402
+ accessibilityLabel: "Loading"
403
+ },
404
+ /* @__PURE__ */ import_react6.default.createElement(
405
+ LinearActivityIndicator,
406
+ {
407
+ size: linearSize,
408
+ themeColor,
409
+ color: mainColor,
410
+ backgroundColor: trackColor,
411
+ disableAnimation,
412
+ borderRadius,
413
+ showTrack
414
+ }
415
+ )
416
+ );
417
+ };
418
+
419
+ // src/components/button/button.style.ts
420
+ var import_react_native7 = require("react-native");
421
+ var styles2 = import_react_native7.StyleSheet.create({
422
+ button: {
423
+ flexDirection: "row",
424
+ alignItems: "center",
425
+ justifyContent: "center",
426
+ overflow: "hidden"
427
+ },
428
+ contentContainer: {
429
+ flexDirection: "row",
430
+ alignItems: "center",
431
+ justifyContent: "center",
432
+ gap: 8
433
+ },
434
+ text: {
435
+ fontWeight: "500",
436
+ textAlign: "center"
437
+ },
438
+ startContent: {
439
+ marginRight: 4
440
+ },
441
+ endContent: {
442
+ marginLeft: 4
443
+ },
444
+ spinner: {
445
+ marginHorizontal: 4
446
+ },
447
+ fullWidth: {
448
+ width: "100%"
449
+ },
450
+ disabled: {
451
+ opacity: 0.5
452
+ },
453
+ disabledText: {
454
+ opacity: 0.7
455
+ }
456
+ });
457
+
458
+ // src/components/button/button.hook.ts
459
+ var import_react7 = require("react");
460
+ var import_core6 = require("@xaui/core");
461
+ var useButtonStyles = (themeColor, variant, size, radius) => {
462
+ const theme = useXUITheme();
463
+ const safeThemeColor = (0, import_core6.getSafeThemeColor)(themeColor);
464
+ const colorScheme = theme.colors[safeThemeColor];
465
+ const sizeStyles = (0, import_react7.useMemo)(() => {
466
+ const sizes = {
467
+ xs: {
468
+ paddingHorizontal: theme.spacing.sm,
469
+ paddingVertical: theme.spacing.xs,
470
+ minHeight: 34,
471
+ fontSize: theme.fontSizes.xs
472
+ },
473
+ sm: {
474
+ paddingHorizontal: theme.spacing.md,
475
+ paddingVertical: theme.spacing.xs,
476
+ minHeight: 38,
477
+ fontSize: theme.fontSizes.sm
478
+ },
479
+ md: {
480
+ paddingHorizontal: theme.spacing.md,
481
+ paddingVertical: theme.spacing.sm,
482
+ minHeight: 42,
483
+ fontSize: theme.fontSizes.md
484
+ },
485
+ lg: {
486
+ paddingHorizontal: theme.spacing.lg,
487
+ paddingVertical: theme.spacing.md,
488
+ minHeight: 50,
489
+ fontSize: theme.fontSizes.lg
490
+ }
491
+ };
492
+ return sizes[size];
493
+ }, [size, theme]);
494
+ const radiusStyles = (0, import_react7.useMemo)(() => {
495
+ const radii = {
496
+ none: theme.borderRadius.none,
497
+ sm: theme.borderRadius.sm,
498
+ md: theme.borderRadius.md,
499
+ lg: theme.borderRadius.lg,
500
+ full: theme.borderRadius.full
501
+ };
502
+ return { borderRadius: radii[radius] };
503
+ }, [radius, theme]);
504
+ const variantStyles = (0, import_react7.useMemo)(() => {
505
+ const styles3 = {
506
+ solid: {
507
+ backgroundColor: colorScheme.main,
508
+ borderWidth: 0
509
+ },
510
+ outlined: {
511
+ backgroundColor: "transparent",
512
+ borderWidth: theme.borderWidth.md,
513
+ borderColor: colorScheme.main
514
+ },
515
+ flat: {
516
+ backgroundColor: colorScheme.background,
517
+ borderWidth: 0
518
+ },
519
+ light: {
520
+ backgroundColor: "transparent",
521
+ borderWidth: 0
522
+ },
523
+ elevated: {
524
+ backgroundColor: colorScheme.main,
525
+ borderWidth: 0,
526
+ ...theme.shadows.md
527
+ },
528
+ faded: {
529
+ backgroundColor: `${colorScheme.background}90`,
530
+ borderWidth: theme.borderWidth.md,
531
+ borderColor: colorScheme.main
532
+ }
533
+ };
534
+ return styles3[variant];
535
+ }, [variant, colorScheme, theme]);
536
+ const textColor = (0, import_react7.useMemo)(() => {
537
+ if (variant === "solid" || variant === "elevated") {
538
+ return colorScheme.foreground;
539
+ }
540
+ return colorScheme.main;
541
+ }, [variant, colorScheme]);
542
+ const spinnerSize = (0, import_react7.useMemo)(() => {
543
+ const sizes = {
544
+ xs: 14,
545
+ sm: 16,
546
+ md: 18,
547
+ lg: 20
548
+ };
549
+ return sizes[size];
550
+ }, [size]);
551
+ return {
552
+ sizeStyles,
553
+ radiusStyles,
554
+ variantStyles,
555
+ textColor,
556
+ spinnerSize
557
+ };
558
+ };
559
+
560
+ // src/components/button/button.tsx
561
+ var Button = ({
562
+ children,
563
+ themeColor = "default",
564
+ variant = "solid",
565
+ size = "md",
566
+ radius = "md",
567
+ startContent,
568
+ endContent,
569
+ spinnerPlacement = "start",
570
+ fullWidth = false,
571
+ isDisabled = false,
572
+ isLoading = false,
573
+ textStyle,
574
+ style,
575
+ onPress,
576
+ onLongPress,
577
+ onPressIn,
578
+ onPressOut
579
+ }) => {
580
+ const animatedScale = import_react8.default.useRef(new import_react_native8.Animated.Value(1)).current;
581
+ const animatedOpacity = import_react8.default.useRef(new import_react_native8.Animated.Value(1)).current;
582
+ const { sizeStyles, radiusStyles, variantStyles, textColor, spinnerSize } = useButtonStyles(themeColor, variant, size, radius);
583
+ const handlePressIn = (event) => {
584
+ if (!isDisabled && !isLoading) {
585
+ import_react_native8.Animated.parallel([
586
+ import_react_native8.Animated.spring(animatedScale, {
587
+ toValue: 0.975,
588
+ useNativeDriver: true,
589
+ speed: 50,
590
+ bounciness: 0
591
+ }),
592
+ import_react_native8.Animated.timing(animatedOpacity, {
593
+ toValue: 0.9,
594
+ duration: 100,
595
+ useNativeDriver: true
596
+ })
597
+ ]).start();
598
+ }
599
+ onPressIn?.(event);
600
+ };
601
+ const handlePressOut = (event) => {
602
+ if (!isDisabled && !isLoading) {
603
+ import_react_native8.Animated.parallel([
604
+ import_react_native8.Animated.spring(animatedScale, {
605
+ toValue: 1,
606
+ useNativeDriver: true,
607
+ speed: 50,
608
+ bounciness: 0
609
+ }),
610
+ import_react_native8.Animated.timing(animatedOpacity, {
611
+ toValue: 1,
612
+ duration: 100,
613
+ useNativeDriver: true
614
+ })
615
+ ]).start();
616
+ }
617
+ onPressOut?.(event);
618
+ };
619
+ const spinner = /* @__PURE__ */ import_react8.default.createElement(
620
+ ActivityIndicator,
621
+ {
622
+ variant: "circular",
623
+ themeColor: variant === "solid" || variant === "elevated" ? void 0 : themeColor,
624
+ color: variant === "solid" || variant === "elevated" ? textColor : void 0,
625
+ size: spinnerSize
626
+ }
627
+ );
628
+ return /* @__PURE__ */ import_react8.default.createElement(import_react_native8.View, { style: [fullWidth && styles2.fullWidth] }, /* @__PURE__ */ import_react8.default.createElement(
629
+ import_react_native8.Pressable,
630
+ {
631
+ onPress: isDisabled || isLoading ? void 0 : onPress,
632
+ onLongPress: isDisabled || isLoading ? void 0 : onLongPress,
633
+ onPressIn: handlePressIn,
634
+ onPressOut: handlePressOut,
635
+ disabled: isDisabled || isLoading
636
+ },
637
+ /* @__PURE__ */ import_react8.default.createElement(
638
+ import_react_native8.Animated.View,
639
+ {
640
+ style: [
641
+ styles2.button,
642
+ sizeStyles,
643
+ radiusStyles,
644
+ variantStyles,
645
+ fullWidth && styles2.fullWidth,
646
+ isDisabled && styles2.disabled,
647
+ {
648
+ transform: [{ scale: animatedScale }],
649
+ opacity: animatedOpacity
650
+ },
651
+ style
652
+ ]
653
+ },
654
+ /* @__PURE__ */ import_react8.default.createElement(import_react_native8.View, { style: styles2.contentContainer }, startContent && !isLoading && /* @__PURE__ */ import_react8.default.createElement(import_react_native8.View, { style: styles2.startContent }, startContent), isLoading && spinnerPlacement === "start" && /* @__PURE__ */ import_react8.default.createElement(import_react_native8.View, { style: styles2.spinner }, spinner), /* @__PURE__ */ import_react8.default.createElement(
655
+ import_react_native8.Text,
656
+ {
657
+ style: [
658
+ styles2.text,
659
+ { fontSize: sizeStyles.fontSize, color: textColor },
660
+ isDisabled && styles2.disabledText,
661
+ textStyle
662
+ ]
663
+ },
664
+ children
665
+ ), isLoading && spinnerPlacement === "end" && /* @__PURE__ */ import_react8.default.createElement(import_react_native8.View, { style: styles2.spinner }, spinner), endContent && !isLoading && /* @__PURE__ */ import_react8.default.createElement(import_react_native8.View, { style: styles2.endContent }, endContent))
666
+ )
667
+ ));
668
+ };
669
+ // Annotate the CommonJS export names for ESM import in node:
670
+ 0 && (module.exports = {
671
+ Button
672
+ });