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