custom-mobile-ui 1.0.1

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.
Files changed (116) hide show
  1. package/dist/Fonts-Black-U4YX6GHD.ttf +0 -0
  2. package/dist/Fonts-Bold-QAA2AGZS.ttf +0 -0
  3. package/dist/Fonts-ExtraBold-OVZKTNJI.ttf +0 -0
  4. package/dist/Fonts-Light-RMQAEPUP.ttf +0 -0
  5. package/dist/Fonts-Medium-UUWQX4EV.ttf +0 -0
  6. package/dist/Fonts-Regular-JNHL4IDV.ttf +0 -0
  7. package/dist/PopupMenuExample-DAAku8nG.d.mts +11 -0
  8. package/dist/PopupMenuExample-DAAku8nG.d.ts +11 -0
  9. package/dist/avatarF1-C47EE65Y.png +0 -0
  10. package/dist/avatarF2-TZPKSMDG.png +0 -0
  11. package/dist/avatarF3-OSDX6E7J.png +0 -0
  12. package/dist/avatarF4-CASWRGNJ.png +0 -0
  13. package/dist/avatarM1-3XV4KE4H.png +0 -0
  14. package/dist/avatarM2-ZMN26Y2Y.png +0 -0
  15. package/dist/avatarM3-XIDLYITU.png +0 -0
  16. package/dist/avatarM4-DYW5DSZC.png +0 -0
  17. package/dist/avatarM5-YP66OPXT.png +0 -0
  18. package/dist/components.d.mts +3286 -0
  19. package/dist/components.d.ts +3286 -0
  20. package/dist/components.js +21401 -0
  21. package/dist/components.mjs +21246 -0
  22. package/dist/config.d.mts +7 -0
  23. package/dist/config.d.ts +7 -0
  24. package/dist/config.js +213 -0
  25. package/dist/config.mjs +210 -0
  26. package/dist/context.d.mts +11 -0
  27. package/dist/context.d.ts +11 -0
  28. package/dist/context.js +150 -0
  29. package/dist/context.mjs +148 -0
  30. package/dist/examples.d.mts +30 -0
  31. package/dist/examples.d.ts +30 -0
  32. package/dist/examples.js +30785 -0
  33. package/dist/examples.mjs +30748 -0
  34. package/dist/hooks.d.mts +15 -0
  35. package/dist/hooks.d.ts +15 -0
  36. package/dist/hooks.js +750 -0
  37. package/dist/hooks.mjs +739 -0
  38. package/dist/icAppleNegative-E3OORB4A.png +0 -0
  39. package/dist/icAppleOriginal-M7FOSDZ4.png +0 -0
  40. package/dist/icBlueskyNegative-QXHPLARU.png +0 -0
  41. package/dist/icBlueskyOriginal-D2GX35RV.png +0 -0
  42. package/dist/icDiscordNegative-EWGZJJ27.png +0 -0
  43. package/dist/icDiscordOriginal-5ODPKZ6S.png +0 -0
  44. package/dist/icDribbbleNegative-GOLJS6SO.png +0 -0
  45. package/dist/icDribbbleOriginal-ONQLW62I.png +0 -0
  46. package/dist/icError404-Z6PQK64J.png +0 -0
  47. package/dist/icFacebookNegative-DIFRSSJJ.png +0 -0
  48. package/dist/icFacebookOriginal-PK7CGUNB.png +0 -0
  49. package/dist/icFigmaNegative-X6P3DVCQ.png +0 -0
  50. package/dist/icFigmaOriginal-VGD7LQVQ.png +0 -0
  51. package/dist/icGithubNegative-G7XH6J7V.png +0 -0
  52. package/dist/icGithubOriginal-BOXVXICL.png +0 -0
  53. package/dist/icGoogleNegative-UFNCEWM7.png +0 -0
  54. package/dist/icGoogleOriginal-WCDLPRSH.png +0 -0
  55. package/dist/icInstagramNegative-47CG4IHG.png +0 -0
  56. package/dist/icInstagramOriginal-SGRJTPEH.png +0 -0
  57. package/dist/icLinkedInNegative-4EHL223U.png +0 -0
  58. package/dist/icLinkedInOriginal-CQXTAW56.png +0 -0
  59. package/dist/icMediumNegative-YMS7U46C.png +0 -0
  60. package/dist/icMediumOriginal-TRTNJBN4.png +0 -0
  61. package/dist/icMessengerNegative-SIFKBM2Y.png +0 -0
  62. package/dist/icMessengerOriginal-PNN2SB3Z.png +0 -0
  63. package/dist/icNoData-JQB7KCKJ.png +0 -0
  64. package/dist/icPinterestNegative-LPDQYRD3.png +0 -0
  65. package/dist/icPinterestOriginal-7AWYJQBQ.png +0 -0
  66. package/dist/icRedditNegative-BBV3R7UA.png +0 -0
  67. package/dist/icRedditOriginal-BIKS3S2I.png +0 -0
  68. package/dist/icRestriction-JFCJAQ5L.png +0 -0
  69. package/dist/icSadMen-6HAFJHIQ.png +0 -0
  70. package/dist/icSignalNegative-DVBANSGJ.png +0 -0
  71. package/dist/icSignalOriginal-FQEXGCKX.png +0 -0
  72. package/dist/icSnapchatNegative-VQFVKRPC.png +0 -0
  73. package/dist/icSnapchatOriginal-ZK4T4CLL.png +0 -0
  74. package/dist/icSpotifyNegative-UGDBMFNS.png +0 -0
  75. package/dist/icSpotifyOriginal-ZFNO4BJO.png +0 -0
  76. package/dist/icTelegramNegative-GDSFFYME.png +0 -0
  77. package/dist/icTelegramOriginal-DMTCZCGP.png +0 -0
  78. package/dist/icThreadsNegative-4NIM4AOP.png +0 -0
  79. package/dist/icThreadsOriginal-OYU6UKN2.png +0 -0
  80. package/dist/icTikTokNegative-WYI3PQGD.png +0 -0
  81. package/dist/icTikTokOriginal-26SKYCIO.png +0 -0
  82. package/dist/icTumblrNegative-CYBTEYAG.png +0 -0
  83. package/dist/icTumblrOriginal-MZ7RV5ZY.png +0 -0
  84. package/dist/icTwitchNegative-GK3VVFL7.png +0 -0
  85. package/dist/icTwitchOriginal-GOENLOGB.png +0 -0
  86. package/dist/icVKNegative-FCXPFYDV.png +0 -0
  87. package/dist/icVKOriginal-NCWB7WYH.png +0 -0
  88. package/dist/icWhatsAppNegative-FJHYFUMA.png +0 -0
  89. package/dist/icWhatsAppOriginal-MWQWQC56.png +0 -0
  90. package/dist/icXTwitterNegative-VS3UXBLN.png +0 -0
  91. package/dist/icXTwitterOriginal-WJ2IFMZL.png +0 -0
  92. package/dist/icYouTubeNegative-LUSZ7OD4.png +0 -0
  93. package/dist/icYouTubeOriginal-6Y2SNMC7.png +0 -0
  94. package/dist/index-tIixPl5M.d.mts +214 -0
  95. package/dist/index-tIixPl5M.d.ts +214 -0
  96. package/dist/index.d.mts +32 -0
  97. package/dist/index.d.ts +32 -0
  98. package/dist/index.js +32215 -0
  99. package/dist/index.mjs +32022 -0
  100. package/dist/theme.d.mts +297 -0
  101. package/dist/theme.d.ts +297 -0
  102. package/dist/theme.js +472 -0
  103. package/dist/theme.mjs +458 -0
  104. package/dist/types-cxHozHqF.d.mts +92 -0
  105. package/dist/types-cxHozHqF.d.ts +92 -0
  106. package/dist/ui.d.mts +400 -0
  107. package/dist/ui.d.ts +400 -0
  108. package/dist/ui.js +1469 -0
  109. package/dist/ui.mjs +1461 -0
  110. package/dist/ui_config-LKHwCbDD.d.mts +102 -0
  111. package/dist/ui_config-LKHwCbDD.d.ts +102 -0
  112. package/dist/utils.d.mts +7 -0
  113. package/dist/utils.d.ts +7 -0
  114. package/dist/utils.js +89 -0
  115. package/dist/utils.mjs +83 -0
  116. package/package.json +78 -0
package/dist/hooks.mjs ADDED
@@ -0,0 +1,739 @@
1
+ import { useFonts as useFonts$1 } from 'expo-font';
2
+ import React, { createContext, useContext, useState, useCallback } from 'react';
3
+ import { StyleSheet, Platform, Modal, View, TouchableOpacity, ActivityIndicator, Text as Text$1 } from 'react-native';
4
+ import { X, AlertCircle, Info, CheckCircle } from 'lucide-react-native';
5
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
+
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+
12
+ // assets/fonts/Fonts-Light.ttf
13
+ var require_Fonts_Light = __commonJS({
14
+ "assets/fonts/Fonts-Light.ttf"(exports$1, module) {
15
+ module.exports = "./Fonts-Light-RMQAEPUP.ttf";
16
+ }
17
+ });
18
+
19
+ // assets/fonts/Fonts-Regular.ttf
20
+ var require_Fonts_Regular = __commonJS({
21
+ "assets/fonts/Fonts-Regular.ttf"(exports$1, module) {
22
+ module.exports = "./Fonts-Regular-JNHL4IDV.ttf";
23
+ }
24
+ });
25
+
26
+ // assets/fonts/Fonts-Medium.ttf
27
+ var require_Fonts_Medium = __commonJS({
28
+ "assets/fonts/Fonts-Medium.ttf"(exports$1, module) {
29
+ module.exports = "./Fonts-Medium-UUWQX4EV.ttf";
30
+ }
31
+ });
32
+
33
+ // assets/fonts/Fonts-Bold.ttf
34
+ var require_Fonts_Bold = __commonJS({
35
+ "assets/fonts/Fonts-Bold.ttf"(exports$1, module) {
36
+ module.exports = "./Fonts-Bold-QAA2AGZS.ttf";
37
+ }
38
+ });
39
+
40
+ // assets/fonts/Fonts-ExtraBold.ttf
41
+ var require_Fonts_ExtraBold = __commonJS({
42
+ "assets/fonts/Fonts-ExtraBold.ttf"(exports$1, module) {
43
+ module.exports = "./Fonts-ExtraBold-OVZKTNJI.ttf";
44
+ }
45
+ });
46
+
47
+ // assets/fonts/Fonts-Black.ttf
48
+ var require_Fonts_Black = __commonJS({
49
+ "assets/fonts/Fonts-Black.ttf"(exports$1, module) {
50
+ module.exports = "./Fonts-Black-U4YX6GHD.ttf";
51
+ }
52
+ });
53
+ var useFonts = () => {
54
+ const [fontsLoaded] = useFonts$1({
55
+ // Prompts family
56
+ "Fonts-Light": require_Fonts_Light(),
57
+ "Fonts-Regular": require_Fonts_Regular(),
58
+ "Fonts-Medium": require_Fonts_Medium(),
59
+ "Fonts-Bold": require_Fonts_Bold(),
60
+ "Fonts-ExtraBold": require_Fonts_ExtraBold(),
61
+ "Fonts-Black": require_Fonts_Black(),
62
+ // Weight aliases (VERY IMPORTANT for fontWeight mapping)
63
+ Fonts_300: require_Fonts_Light(),
64
+ Fonts_400: require_Fonts_Regular(),
65
+ Fonts_500: require_Fonts_Medium(),
66
+ Fonts_700: require_Fonts_Bold(),
67
+ Fonts_800: require_Fonts_ExtraBold(),
68
+ Fonts_900: require_Fonts_Black()
69
+ });
70
+ return fontsLoaded;
71
+ };
72
+ var Fonts = {
73
+ light: "Fonts-Light",
74
+ regular: "Fonts-Regular",
75
+ medium: "Fonts-Medium",
76
+ bold: "Fonts-Bold",
77
+ extraBold: "Fonts-ExtraBold",
78
+ black: "Fonts-Black"
79
+ };
80
+
81
+ // src/theme/colors.ts
82
+ var Colors = {
83
+ primary: {
84
+ 50: "#EFF6FF",
85
+ 400: "#60A5FA",
86
+ 500: "#3B82F6",
87
+ 600: "#2563EB",
88
+ 900: "#1E3A8A"
89
+ },
90
+ primaryColor: "#2563EB",
91
+ gray: {
92
+ 50: "#F9FAFB",
93
+ 100: "#F3F4F6",
94
+ 200: "#E5E7EB",
95
+ 300: "#D1D5DB",
96
+ 400: "#9CA3AF",
97
+ 500: "#6B7280",
98
+ 600: "#4B5563",
99
+ 700: "#374151",
100
+ 800: "#1F2937",
101
+ 900: "#111827"
102
+ },
103
+ white: "#ffffff",
104
+ green: { 500: "#22C55E" },
105
+ orange: { 500: "#F97316" },
106
+ red: { 50: "#FEE2E2", 500: "#EF4444" }};
107
+ var colors_default = Colors;
108
+
109
+ // src/theme/theme.ts
110
+ var BaseTheme = {
111
+ primary: {
112
+ default: colors_default.primary[600],
113
+ hover: colors_default.primary[500]
114
+ },
115
+ background: {
116
+ screen: colors_default.gray[50],
117
+ surface: "#FFFFFF",
118
+ selected: colors_default.primary[50],
119
+ secondary: colors_default.gray[100],
120
+ design: colors_default.primary[50]
121
+ },
122
+ input: {
123
+ background: colors_default.gray[50]
124
+ },
125
+ text: {
126
+ primary: colors_default.gray[900],
127
+ secondary: colors_default.gray[600],
128
+ muted: colors_default.gray[400],
129
+ inverse: "#FFFFFF"
130
+ },
131
+ border: {
132
+ default: colors_default.gray[300],
133
+ focused: colors_default.primary[600],
134
+ success: colors_default.green[500],
135
+ warning: colors_default.orange[500],
136
+ error: colors_default.red[500]
137
+ },
138
+ status: {
139
+ success: colors_default.green[500],
140
+ warning: colors_default.orange[500],
141
+ error: colors_default.red[500],
142
+ validating: colors_default.primary[600]
143
+ },
144
+ icon: {
145
+ default: colors_default.gray[500],
146
+ active: colors_default.primary[600],
147
+ disabled: colors_default.gray[400]
148
+ },
149
+ tabContent: {
150
+ active: colors_default.primary[600],
151
+ inactive: colors_default.gray[400]
152
+ },
153
+ skeleton: {
154
+ background: colors_default.gray[200],
155
+ componentBg: colors_default.gray[300],
156
+ highlight: "#ffffff99"
157
+ },
158
+ primaryContent: {
159
+ color: colors_default.primaryColor
160
+ }
161
+ };
162
+ var LightTheme = {
163
+ ...BaseTheme
164
+ };
165
+ var DarkTheme = {
166
+ ...BaseTheme,
167
+ primary: {
168
+ default: colors_default.primary[500],
169
+ hover: colors_default.primary[400]
170
+ },
171
+ background: {
172
+ ...BaseTheme.background,
173
+ screen: colors_default.gray[900],
174
+ surface: colors_default.gray[800],
175
+ selected: colors_default.primary[900],
176
+ secondary: colors_default.gray[900],
177
+ design: colors_default.primaryColor + 10
178
+ },
179
+ input: {
180
+ background: colors_default.gray[700]
181
+ },
182
+ text: {
183
+ ...BaseTheme.text,
184
+ primary: "#FFFFFF",
185
+ secondary: colors_default.gray[200],
186
+ muted: colors_default.gray[500],
187
+ inverse: colors_default.gray[900]
188
+ },
189
+ border: {
190
+ ...BaseTheme.border,
191
+ default: colors_default.gray[700]
192
+ },
193
+ icon: {
194
+ ...BaseTheme.icon,
195
+ default: colors_default.gray[400],
196
+ disabled: colors_default.gray[600]
197
+ },
198
+ tabContent: {
199
+ active: colors_default.white,
200
+ inactive: colors_default.gray[500]
201
+ },
202
+ skeleton: {
203
+ background: colors_default.gray[700],
204
+ componentBg: colors_default.gray[800],
205
+ highlight: "#ffffff14"
206
+ },
207
+ primaryContent: {
208
+ color: colors_default.primary[400]
209
+ }
210
+ };
211
+
212
+ // src/theme/index.ts
213
+ var getTheme = (mode) => mode === "dark" ? DarkTheme : LightTheme;
214
+
215
+ // src/context/ThemeContext.tsx
216
+ var ThemeContext = createContext({
217
+ mode: "system",
218
+ setMode: () => {
219
+ },
220
+ theme: getTheme("light"),
221
+ resolvedMode: "light"
222
+ });
223
+
224
+ // src/hooks/useTheme.ts
225
+ var useTheme = () => {
226
+ const { theme } = useContext(ThemeContext);
227
+ return theme;
228
+ };
229
+ var FontFamily = (style) => {
230
+ const weight = style?.fontWeight ?? "400";
231
+ let fontFamily = "Fonts-Regular";
232
+ let numericWeight = "400";
233
+ switch (weight) {
234
+ case "100":
235
+ case "200":
236
+ fontFamily = "Fonts-Light";
237
+ numericWeight = "300";
238
+ break;
239
+ case "300":
240
+ case "light":
241
+ fontFamily = "Fonts-Light";
242
+ numericWeight = "300";
243
+ break;
244
+ case "400":
245
+ case "normal":
246
+ case "regular":
247
+ fontFamily = "Fonts-Regular";
248
+ numericWeight = "400";
249
+ break;
250
+ case "500":
251
+ case "medium":
252
+ fontFamily = "Fonts-Medium";
253
+ numericWeight = "500";
254
+ break;
255
+ case "600":
256
+ case "semibold":
257
+ fontFamily = "Fonts-Bold";
258
+ numericWeight = "600";
259
+ break;
260
+ case "700":
261
+ case "bold":
262
+ fontFamily = "Fonts-Bold";
263
+ numericWeight = "700";
264
+ break;
265
+ case "800":
266
+ case "heavy":
267
+ fontFamily = "Fonts-ExtraBold";
268
+ numericWeight = "800";
269
+ break;
270
+ case "900":
271
+ case "black":
272
+ fontFamily = "Fonts-Black";
273
+ numericWeight = "900";
274
+ break;
275
+ }
276
+ return {
277
+ fontFamily,
278
+ fontWeight: Platform.OS === "android" ? "normal" : numericWeight
279
+ };
280
+ };
281
+ var VARIANT_STYLES = {
282
+ display: {
283
+ fontSize: 34,
284
+ ...FontFamily({ fontWeight: "700" }),
285
+ lineHeight: 42,
286
+ letterSpacing: -0.5
287
+ },
288
+ heading: {
289
+ fontSize: 24,
290
+ ...FontFamily({ fontWeight: "700" }),
291
+ lineHeight: 32,
292
+ letterSpacing: -0.25
293
+ },
294
+ title: {
295
+ fontSize: 20,
296
+ ...FontFamily({ fontWeight: "600" }),
297
+ lineHeight: 28,
298
+ letterSpacing: 0
299
+ },
300
+ subtitle: {
301
+ fontSize: 16,
302
+ ...FontFamily({ fontWeight: "600" }),
303
+ lineHeight: 24,
304
+ letterSpacing: 0.1
305
+ },
306
+ body: {
307
+ fontSize: 14,
308
+ ...FontFamily({ fontWeight: "400" }),
309
+ lineHeight: 20,
310
+ letterSpacing: 0.15
311
+ },
312
+ caption: {
313
+ fontSize: 12,
314
+ ...FontFamily({ fontWeight: "400" }),
315
+ lineHeight: 16,
316
+ letterSpacing: 0.3
317
+ },
318
+ overline: {
319
+ fontSize: 10,
320
+ ...FontFamily({ fontWeight: "600" }),
321
+ lineHeight: 14,
322
+ letterSpacing: 1,
323
+ textTransform: "uppercase"
324
+ }
325
+ };
326
+ var COLOR_SHORTCUT_MAP = {
327
+ primary: (t) => t.text.primary,
328
+ secondary: (t) => t.text.secondary,
329
+ muted: (t) => t.text.muted,
330
+ inverse: (t) => t.text.inverse,
331
+ success: (t) => t.status.success,
332
+ error: (t) => t.status.error,
333
+ warning: (t) => t.status.warning
334
+ };
335
+ function resolveColor(color, theme) {
336
+ if (!color) return void 0;
337
+ const resolver = COLOR_SHORTCUT_MAP[color];
338
+ return resolver ? resolver(theme) : color;
339
+ }
340
+ function Text({
341
+ style,
342
+ variant,
343
+ color,
344
+ align,
345
+ uppercase,
346
+ italic,
347
+ underline,
348
+ strikethrough,
349
+ selectable = false,
350
+ numberOfLines,
351
+ ellipsizeMode = "tail",
352
+ ...props
353
+ }) {
354
+ const theme = useTheme();
355
+ const flatStyle = Array.isArray(style) ? Object.assign({}, ...style) : style;
356
+ const enhancementStyle = {};
357
+ if (variant) {
358
+ Object.assign(enhancementStyle, VARIANT_STYLES[variant]);
359
+ }
360
+ const resolvedColor = resolveColor(color, theme);
361
+ if (resolvedColor) {
362
+ enhancementStyle.color = resolvedColor;
363
+ }
364
+ if (align) {
365
+ enhancementStyle.textAlign = align;
366
+ }
367
+ if (uppercase) {
368
+ enhancementStyle.textTransform = "uppercase";
369
+ }
370
+ if (italic) {
371
+ enhancementStyle.fontStyle = "italic";
372
+ }
373
+ const decorations = [];
374
+ if (underline) decorations.push("underline");
375
+ if (strikethrough) decorations.push("line-through");
376
+ if (decorations.length > 0) {
377
+ enhancementStyle.textDecorationLine = decorations.join(
378
+ " "
379
+ );
380
+ }
381
+ const mergedFlatForFont = { ...enhancementStyle, ...flatStyle };
382
+ return /* @__PURE__ */ jsx(
383
+ Text$1,
384
+ {
385
+ ...props,
386
+ selectable,
387
+ numberOfLines,
388
+ ellipsizeMode,
389
+ style: [
390
+ FontFamily(mergedFlatForFont),
391
+ { includeFontPadding: false, textAlignVertical: "center" },
392
+ enhancementStyle,
393
+ style
394
+ ]
395
+ }
396
+ );
397
+ }
398
+ var shade = (obj, key, fallback) => obj[key] ?? fallback;
399
+ function getAlertIconAndColors(type) {
400
+ switch (type) {
401
+ case "danger":
402
+ return {
403
+ icon: React.createElement(AlertCircle, {
404
+ size: 32,
405
+ color: colors_default.red[500] || "#ef4444",
406
+ strokeWidth: 1.5
407
+ }),
408
+ color: colors_default.red[500] || "#ef4444",
409
+ backgroundColor: shade(
410
+ colors_default.red,
411
+ "50",
412
+ "#fef2f2"
413
+ )
414
+ };
415
+ case "success":
416
+ return {
417
+ icon: React.createElement(CheckCircle, {
418
+ size: 32,
419
+ color: colors_default.green[500] || "#16a34a",
420
+ strokeWidth: 1.5
421
+ }),
422
+ color: colors_default.green[500] || "#16a34a",
423
+ backgroundColor: shade(
424
+ colors_default.green,
425
+ "50",
426
+ "#f0fdf4"
427
+ )
428
+ };
429
+ case "info":
430
+ return {
431
+ icon: React.createElement(Info, {
432
+ size: 32,
433
+ color: colors_default.primaryColor,
434
+ strokeWidth: 1.5
435
+ }),
436
+ color: colors_default.primaryColor,
437
+ backgroundColor: colors_default.primary[50]
438
+ };
439
+ case "warning":
440
+ default:
441
+ return {
442
+ icon: React.createElement(AlertCircle, {
443
+ size: 32,
444
+ color: colors_default.orange[500] || "#ea580c",
445
+ strokeWidth: 1.5
446
+ }),
447
+ color: colors_default.orange[500] || "#ea580c",
448
+ backgroundColor: shade(
449
+ colors_default.orange,
450
+ "50",
451
+ "#fff7ed"
452
+ )
453
+ };
454
+ }
455
+ }
456
+ var AlertModal = ({
457
+ visible,
458
+ title,
459
+ message,
460
+ type = "warning",
461
+ buttons,
462
+ isLoading = false,
463
+ onButtonPress,
464
+ onCancel,
465
+ style
466
+ }) => {
467
+ const {
468
+ icon,
469
+ color,
470
+ backgroundColor
471
+ } = getAlertIconAndColors(type);
472
+ const defaultButtons = [
473
+ {
474
+ text: "OK",
475
+ onPress: onCancel,
476
+ style: "default"
477
+ }
478
+ ];
479
+ const displayButtons = buttons && buttons.length > 0 ? buttons : defaultButtons;
480
+ const cancelButton = displayButtons.find((b) => b.style === "cancel");
481
+ const otherButtons = displayButtons.filter((b) => b.style !== "cancel");
482
+ return /* @__PURE__ */ jsx(
483
+ Modal,
484
+ {
485
+ visible,
486
+ animationType: "fade",
487
+ transparent: true,
488
+ onRequestClose: onCancel,
489
+ children: /* @__PURE__ */ jsx(View, { style: styles.overlay, children: /* @__PURE__ */ jsxs(View, { style: [styles.container, style], children: [
490
+ /* @__PURE__ */ jsx(
491
+ TouchableOpacity,
492
+ {
493
+ style: styles.closeButton,
494
+ onPress: onCancel,
495
+ disabled: isLoading,
496
+ children: /* @__PURE__ */ jsx(X, { size: 24, color: colors_default.gray[400] })
497
+ }
498
+ ),
499
+ /* @__PURE__ */ jsx(View, { style: [styles.iconContainer, { backgroundColor }], children: icon }),
500
+ /* @__PURE__ */ jsx(Text, { style: styles.title, children: title }),
501
+ message && /* @__PURE__ */ jsx(Text, { style: styles.message, children: message }),
502
+ /* @__PURE__ */ jsxs(View, { style: styles.buttonContainer, children: [
503
+ cancelButton && /* @__PURE__ */ jsx(
504
+ TouchableOpacity,
505
+ {
506
+ onPress: () => onButtonPress?.(cancelButton),
507
+ disabled: isLoading,
508
+ style: [styles.buttonWrapper, styles.cancelButtonStyle],
509
+ children: /* @__PURE__ */ jsx(Text, { style: styles.cancelButtonText, children: cancelButton.text || "Cancel" })
510
+ }
511
+ ),
512
+ otherButtons.map((button, index) => {
513
+ const isDestructive = button.style === "destructive";
514
+ const buttonColor = isDestructive ? color : colors_default.primaryColor;
515
+ return /* @__PURE__ */ jsx(
516
+ TouchableOpacity,
517
+ {
518
+ onPress: () => onButtonPress?.(button),
519
+ disabled: isLoading,
520
+ style: [
521
+ styles.buttonWrapper,
522
+ styles.actionButtonStyle,
523
+ {
524
+ backgroundColor: buttonColor,
525
+ opacity: isLoading ? 0.6 : 1
526
+ }
527
+ ],
528
+ children: isLoading ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: "#fff" }) : /* @__PURE__ */ jsx(Text, { style: styles.actionButtonText, children: button.text || "OK" })
529
+ },
530
+ index
531
+ );
532
+ })
533
+ ] }),
534
+ isLoading && /* @__PURE__ */ jsx(View, { style: styles.loadingOverlay, children: /* @__PURE__ */ jsx(ActivityIndicator, { size: "large", color: colors_default.primaryColor }) })
535
+ ] }) })
536
+ }
537
+ );
538
+ };
539
+ var styles = StyleSheet.create({
540
+ overlay: {
541
+ flex: 1,
542
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
543
+ justifyContent: "center",
544
+ alignItems: "center"
545
+ },
546
+ container: {
547
+ backgroundColor: "#fff",
548
+ borderRadius: 10,
549
+ padding: 15,
550
+ margin: 15,
551
+ shadowColor: "#000",
552
+ shadowOffset: { width: 0, height: 10 },
553
+ shadowOpacity: 0.25,
554
+ shadowRadius: 12,
555
+ elevation: 10
556
+ },
557
+ closeButton: {
558
+ position: "absolute",
559
+ top: 12,
560
+ right: 12,
561
+ zIndex: 10,
562
+ padding: 8
563
+ },
564
+ iconContainer: {
565
+ width: 64,
566
+ height: 64,
567
+ borderRadius: 32,
568
+ justifyContent: "center",
569
+ alignItems: "center",
570
+ alignSelf: "center",
571
+ marginTop: 8,
572
+ marginBottom: 16
573
+ },
574
+ title: {
575
+ fontSize: 18,
576
+ ...FontFamily({ fontWeight: "600" }),
577
+ color: colors_default.gray[900],
578
+ textAlign: "center",
579
+ marginBottom: 8
580
+ },
581
+ message: {
582
+ fontSize: 14,
583
+ color: colors_default.gray[600],
584
+ textAlign: "center",
585
+ lineHeight: 20,
586
+ marginBottom: 24
587
+ },
588
+ buttonContainer: {
589
+ flexDirection: "row",
590
+ gap: 12,
591
+ width: "100%",
592
+ marginTop: 8
593
+ },
594
+ buttonWrapper: {
595
+ flex: 1,
596
+ paddingVertical: 12,
597
+ paddingHorizontal: 16,
598
+ borderRadius: 8,
599
+ justifyContent: "center",
600
+ alignItems: "center",
601
+ minHeight: 44
602
+ },
603
+ cancelButtonStyle: {
604
+ backgroundColor: colors_default.gray[100],
605
+ borderWidth: 1,
606
+ borderColor: colors_default.gray[300]
607
+ },
608
+ cancelButtonText: {
609
+ fontSize: 14,
610
+ ...FontFamily({ fontWeight: "600" }),
611
+ color: colors_default.gray[700]
612
+ },
613
+ actionButtonStyle: {
614
+ backgroundColor: colors_default.primaryColor
615
+ },
616
+ actionButtonText: {
617
+ fontSize: 14,
618
+ ...FontFamily({ fontWeight: "600" }),
619
+ color: "#fff"
620
+ },
621
+ loadingOverlay: {
622
+ position: "absolute",
623
+ top: 0,
624
+ left: 0,
625
+ right: 0,
626
+ bottom: 0,
627
+ borderRadius: 16,
628
+ backgroundColor: "rgba(255, 255, 255, 0.7)",
629
+ justifyContent: "center",
630
+ alignItems: "center"
631
+ }
632
+ });
633
+ var AlertContext = createContext(void 0);
634
+ var globalAlertState = null;
635
+ var showAlert = (title, message, buttons, type = "warning") => {
636
+ if (!globalAlertState) {
637
+ console.warn(
638
+ "Alert must be used within AlertProvider. Wrap your app with <AlertProvider>"
639
+ );
640
+ return;
641
+ }
642
+ const defaultButtons = [
643
+ {
644
+ text: "OK",
645
+ onPress: () => globalAlertState?.setState((prev) => ({ ...prev, visible: false })),
646
+ style: "default"
647
+ }
648
+ ];
649
+ const finalButtons = buttons && buttons.length > 0 ? buttons : defaultButtons;
650
+ globalAlertState.setState({
651
+ visible: true,
652
+ title,
653
+ message: message || "",
654
+ type,
655
+ buttons: finalButtons,
656
+ isLoading: false
657
+ });
658
+ };
659
+ var Alert = {
660
+ alert: (title, message, buttons) => showAlert(title, message, buttons, "warning"),
661
+ warning: (title, message, buttons) => showAlert(title, message, buttons, "warning"),
662
+ error: (title, message, buttons) => showAlert(title, message, buttons, "danger"),
663
+ info: (title, message, buttons) => showAlert(title, message, buttons, "info"),
664
+ success: (title, message, buttons) => showAlert(title, message, buttons, "success")
665
+ };
666
+ var AlertProvider = ({
667
+ children
668
+ }) => {
669
+ const [state, setState] = useState({
670
+ visible: false,
671
+ title: "",
672
+ message: "",
673
+ type: "warning",
674
+ buttons: [],
675
+ isLoading: false
676
+ });
677
+ React.useEffect(() => {
678
+ globalAlertState = { setState };
679
+ }, []);
680
+ const alert = useCallback(
681
+ (title, message, buttons, options) => {
682
+ const defaultButtons = [
683
+ {
684
+ text: "OK",
685
+ onPress: () => setState((prev) => ({ ...prev, visible: false })),
686
+ style: "default"
687
+ }
688
+ ];
689
+ const finalButtons = buttons && buttons.length > 0 ? buttons : defaultButtons;
690
+ setState({
691
+ visible: true,
692
+ title,
693
+ message: message || "",
694
+ type: options?.type || "warning",
695
+ buttons: finalButtons,
696
+ isLoading: false
697
+ });
698
+ },
699
+ []
700
+ );
701
+ const hide = useCallback(() => {
702
+ setState((prev) => ({ ...prev, visible: false }));
703
+ }, []);
704
+ const handleButtonPress = useCallback(async (button) => {
705
+ setState((prev) => ({ ...prev, isLoading: true }));
706
+ try {
707
+ if (button.onPress) {
708
+ await button.onPress();
709
+ }
710
+ } finally {
711
+ setState((prev) => ({ ...prev, isLoading: false, visible: false }));
712
+ }
713
+ }, []);
714
+ return /* @__PURE__ */ jsxs(AlertContext.Provider, { value: { alert }, children: [
715
+ children,
716
+ /* @__PURE__ */ jsx(
717
+ AlertModal,
718
+ {
719
+ visible: state.visible,
720
+ title: state.title,
721
+ message: state.message,
722
+ type: state.type,
723
+ buttons: state.buttons,
724
+ isLoading: state.isLoading,
725
+ onButtonPress: handleButtonPress,
726
+ onCancel: hide
727
+ }
728
+ )
729
+ ] });
730
+ };
731
+ var useAlert = () => {
732
+ const context = useContext(AlertContext);
733
+ if (!context) {
734
+ throw new Error("useAlert must be used within an AlertProvider");
735
+ }
736
+ return context;
737
+ };
738
+
739
+ export { Alert, AlertProvider, Fonts, useAlert, useFonts, useTheme };