@nextsparkjs/ui 0.1.0-beta.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/index.d.ts +195 -0
- package/dist/index.js +754 -0
- package/dist/index.js.map +1 -0
- package/dist/index.native.d.ts +456 -0
- package/dist/index.native.js +2371 -0
- package/dist/index.native.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,2371 @@
|
|
|
1
|
+
// src/native/ThemeContext.tsx
|
|
2
|
+
import { createContext, useContext, useMemo } from "react";
|
|
3
|
+
|
|
4
|
+
// src/native/defaultColors.ts
|
|
5
|
+
var defaultColors = {
|
|
6
|
+
// Base
|
|
7
|
+
background: "#FFFFFF",
|
|
8
|
+
foreground: "#1a1a1a",
|
|
9
|
+
card: "#FFFFFF",
|
|
10
|
+
cardForeground: "#1a1a1a",
|
|
11
|
+
// Interactive
|
|
12
|
+
primary: "#171717",
|
|
13
|
+
primaryForeground: "#fafafa",
|
|
14
|
+
secondary: "#f5f5f5",
|
|
15
|
+
secondaryForeground: "#1a1a1a",
|
|
16
|
+
// States
|
|
17
|
+
muted: "#f5f5f5",
|
|
18
|
+
mutedForeground: "#737373",
|
|
19
|
+
accent: "#f5f5f5",
|
|
20
|
+
accentForeground: "#1a1a1a",
|
|
21
|
+
// Alerts
|
|
22
|
+
destructive: "#ef4444",
|
|
23
|
+
destructiveForeground: "#FFFFFF",
|
|
24
|
+
success: "#22c55e",
|
|
25
|
+
successForeground: "#FFFFFF",
|
|
26
|
+
// UI
|
|
27
|
+
border: "#e5e5e5",
|
|
28
|
+
input: "#e5e5e5",
|
|
29
|
+
ring: "#a3a3a3",
|
|
30
|
+
placeholder: "#a3a3a3",
|
|
31
|
+
// Status colors
|
|
32
|
+
statusTodo: "rgba(107, 114, 128, 0.2)",
|
|
33
|
+
// gray-500/20
|
|
34
|
+
statusInProgress: "rgba(59, 130, 246, 0.2)",
|
|
35
|
+
// blue-500/20
|
|
36
|
+
statusReview: "rgba(245, 158, 11, 0.2)",
|
|
37
|
+
// amber-500/20
|
|
38
|
+
statusDone: "rgba(34, 197, 94, 0.2)",
|
|
39
|
+
// green-500/20
|
|
40
|
+
statusBlocked: "rgba(239, 68, 68, 0.2)",
|
|
41
|
+
// red-500/20
|
|
42
|
+
// Status text colors
|
|
43
|
+
statusTodoText: "#4b5563",
|
|
44
|
+
// gray-600
|
|
45
|
+
statusInProgressText: "#2563eb",
|
|
46
|
+
// blue-600
|
|
47
|
+
statusReviewText: "#d97706",
|
|
48
|
+
// amber-600
|
|
49
|
+
statusDoneText: "#16a34a",
|
|
50
|
+
// green-600
|
|
51
|
+
statusBlockedText: "#dc2626",
|
|
52
|
+
// red-600
|
|
53
|
+
// Dot colors
|
|
54
|
+
dotTodo: "#6b7280",
|
|
55
|
+
// gray-500
|
|
56
|
+
dotInProgress: "#3b82f6",
|
|
57
|
+
// blue-500
|
|
58
|
+
dotReview: "#f59e0b",
|
|
59
|
+
// amber-500
|
|
60
|
+
dotDone: "#22c55e",
|
|
61
|
+
// green-500
|
|
62
|
+
dotBlocked: "#ef4444"
|
|
63
|
+
// red-500
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/native/ThemeContext.tsx
|
|
67
|
+
import { jsx } from "react/jsx-runtime";
|
|
68
|
+
var ThemeContext = createContext(null);
|
|
69
|
+
function ThemeProvider({ colors: customColors, children }) {
|
|
70
|
+
const value = useMemo(
|
|
71
|
+
() => ({
|
|
72
|
+
colors: { ...defaultColors, ...customColors }
|
|
73
|
+
}),
|
|
74
|
+
[customColors]
|
|
75
|
+
);
|
|
76
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children });
|
|
77
|
+
}
|
|
78
|
+
function useTheme() {
|
|
79
|
+
const context = useContext(ThemeContext);
|
|
80
|
+
if (!context) {
|
|
81
|
+
return { colors: defaultColors };
|
|
82
|
+
}
|
|
83
|
+
return context;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/components/Button.native.tsx
|
|
87
|
+
import React, { useMemo as useMemo2 } from "react";
|
|
88
|
+
import {
|
|
89
|
+
Pressable,
|
|
90
|
+
Text,
|
|
91
|
+
StyleSheet,
|
|
92
|
+
ActivityIndicator
|
|
93
|
+
} from "react-native";
|
|
94
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
95
|
+
var Button = React.forwardRef(
|
|
96
|
+
({
|
|
97
|
+
variant = "default",
|
|
98
|
+
size = "default",
|
|
99
|
+
children,
|
|
100
|
+
disabled,
|
|
101
|
+
style,
|
|
102
|
+
textStyle,
|
|
103
|
+
isLoading,
|
|
104
|
+
asChild,
|
|
105
|
+
// Ignored in RN
|
|
106
|
+
className,
|
|
107
|
+
// Ignored in RN (NativeWind doesn't work for external packages)
|
|
108
|
+
textClassName,
|
|
109
|
+
// Ignored in RN
|
|
110
|
+
...props
|
|
111
|
+
}, ref) => {
|
|
112
|
+
const { colors } = useTheme();
|
|
113
|
+
const isDisabled = disabled || isLoading;
|
|
114
|
+
const variantStyles = useMemo2(
|
|
115
|
+
() => ({
|
|
116
|
+
default: {
|
|
117
|
+
container: { backgroundColor: colors.primary },
|
|
118
|
+
text: { color: colors.primaryForeground }
|
|
119
|
+
},
|
|
120
|
+
destructive: {
|
|
121
|
+
container: { backgroundColor: colors.destructive },
|
|
122
|
+
text: { color: colors.destructiveForeground }
|
|
123
|
+
},
|
|
124
|
+
outline: {
|
|
125
|
+
container: {
|
|
126
|
+
backgroundColor: colors.background,
|
|
127
|
+
borderWidth: 1,
|
|
128
|
+
borderColor: colors.input
|
|
129
|
+
},
|
|
130
|
+
text: { color: colors.foreground }
|
|
131
|
+
},
|
|
132
|
+
secondary: {
|
|
133
|
+
container: { backgroundColor: colors.secondary },
|
|
134
|
+
text: { color: colors.secondaryForeground }
|
|
135
|
+
},
|
|
136
|
+
ghost: {
|
|
137
|
+
container: { backgroundColor: "transparent" },
|
|
138
|
+
text: { color: colors.foreground }
|
|
139
|
+
},
|
|
140
|
+
link: {
|
|
141
|
+
container: { backgroundColor: "transparent" },
|
|
142
|
+
text: { color: colors.primary, textDecorationLine: "underline" }
|
|
143
|
+
},
|
|
144
|
+
"outline-destructive": {
|
|
145
|
+
container: {
|
|
146
|
+
backgroundColor: colors.background,
|
|
147
|
+
borderWidth: 1,
|
|
148
|
+
borderColor: colors.destructive
|
|
149
|
+
},
|
|
150
|
+
text: { color: colors.destructive }
|
|
151
|
+
}
|
|
152
|
+
}),
|
|
153
|
+
[colors]
|
|
154
|
+
);
|
|
155
|
+
const variantStyle = variantStyles[variant] || variantStyles.default;
|
|
156
|
+
const sizeStyle = sizeStyles[size] || sizeStyles.default;
|
|
157
|
+
const getSpinnerColor = () => {
|
|
158
|
+
if (variant === "outline" || variant === "ghost" || variant === "outline-destructive") {
|
|
159
|
+
return colors.foreground;
|
|
160
|
+
}
|
|
161
|
+
return colors.primaryForeground;
|
|
162
|
+
};
|
|
163
|
+
return /* @__PURE__ */ jsx2(
|
|
164
|
+
Pressable,
|
|
165
|
+
{
|
|
166
|
+
ref,
|
|
167
|
+
disabled: isDisabled,
|
|
168
|
+
style: ({ pressed }) => [
|
|
169
|
+
styles.base,
|
|
170
|
+
variantStyle.container,
|
|
171
|
+
sizeStyle.container,
|
|
172
|
+
pressed && styles.pressed,
|
|
173
|
+
isDisabled && styles.disabled,
|
|
174
|
+
style
|
|
175
|
+
],
|
|
176
|
+
...props,
|
|
177
|
+
children: isLoading ? /* @__PURE__ */ jsx2(ActivityIndicator, { color: getSpinnerColor(), size: "small" }) : typeof children === "string" ? /* @__PURE__ */ jsx2(
|
|
178
|
+
Text,
|
|
179
|
+
{
|
|
180
|
+
style: [styles.text, variantStyle.text, sizeStyle.text, textStyle],
|
|
181
|
+
children
|
|
182
|
+
}
|
|
183
|
+
) : children
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
Button.displayName = "Button";
|
|
189
|
+
var buttonVariants = (options) => {
|
|
190
|
+
return "";
|
|
191
|
+
};
|
|
192
|
+
var styles = StyleSheet.create({
|
|
193
|
+
base: {
|
|
194
|
+
flexDirection: "row",
|
|
195
|
+
alignItems: "center",
|
|
196
|
+
justifyContent: "center",
|
|
197
|
+
borderRadius: 8,
|
|
198
|
+
// rounded-lg equivalent
|
|
199
|
+
gap: 8
|
|
200
|
+
},
|
|
201
|
+
text: {
|
|
202
|
+
fontSize: 16,
|
|
203
|
+
fontWeight: "600"
|
|
204
|
+
// font-semibold
|
|
205
|
+
},
|
|
206
|
+
pressed: {
|
|
207
|
+
opacity: 0.8
|
|
208
|
+
},
|
|
209
|
+
disabled: {
|
|
210
|
+
opacity: 0.5
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
var sizeStyles = {
|
|
214
|
+
default: {
|
|
215
|
+
container: { height: 44, paddingHorizontal: 16 },
|
|
216
|
+
// h-11
|
|
217
|
+
text: { fontSize: 16 }
|
|
218
|
+
// text-base
|
|
219
|
+
},
|
|
220
|
+
sm: {
|
|
221
|
+
container: { height: 36, paddingHorizontal: 12 },
|
|
222
|
+
// h-9
|
|
223
|
+
text: { fontSize: 14 }
|
|
224
|
+
// text-sm
|
|
225
|
+
},
|
|
226
|
+
lg: {
|
|
227
|
+
container: { height: 48, paddingHorizontal: 24 },
|
|
228
|
+
// h-12
|
|
229
|
+
text: { fontSize: 18 }
|
|
230
|
+
// text-lg
|
|
231
|
+
},
|
|
232
|
+
icon: {
|
|
233
|
+
container: { height: 40, width: 40, paddingHorizontal: 0 },
|
|
234
|
+
// h-10 w-10
|
|
235
|
+
text: { fontSize: 16 }
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// src/components/Input.native.tsx
|
|
240
|
+
import React2, { useMemo as useMemo3 } from "react";
|
|
241
|
+
import {
|
|
242
|
+
TextInput,
|
|
243
|
+
View as View2,
|
|
244
|
+
Text as Text2,
|
|
245
|
+
StyleSheet as StyleSheet2
|
|
246
|
+
} from "react-native";
|
|
247
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
248
|
+
var Input = React2.forwardRef(
|
|
249
|
+
({
|
|
250
|
+
label,
|
|
251
|
+
error,
|
|
252
|
+
required,
|
|
253
|
+
containerStyle,
|
|
254
|
+
inputStyle,
|
|
255
|
+
className,
|
|
256
|
+
containerClassName,
|
|
257
|
+
editable = true,
|
|
258
|
+
...props
|
|
259
|
+
}, ref) => {
|
|
260
|
+
const { colors } = useTheme();
|
|
261
|
+
const colorStyles = useMemo3(
|
|
262
|
+
() => ({
|
|
263
|
+
label: { color: colors.foreground },
|
|
264
|
+
required: { color: colors.destructive },
|
|
265
|
+
input: {
|
|
266
|
+
borderColor: colors.border,
|
|
267
|
+
color: colors.foreground,
|
|
268
|
+
backgroundColor: colors.card
|
|
269
|
+
},
|
|
270
|
+
inputError: { borderColor: colors.destructive },
|
|
271
|
+
error: { color: colors.destructive }
|
|
272
|
+
}),
|
|
273
|
+
[colors]
|
|
274
|
+
);
|
|
275
|
+
return /* @__PURE__ */ jsxs(View2, { style: [styles2.container, containerStyle], children: [
|
|
276
|
+
label && /* @__PURE__ */ jsxs(View2, { style: styles2.labelRow, children: [
|
|
277
|
+
/* @__PURE__ */ jsx3(Text2, { style: [styles2.label, colorStyles.label], children: label }),
|
|
278
|
+
required && /* @__PURE__ */ jsx3(Text2, { style: [styles2.required, colorStyles.required], children: " *" })
|
|
279
|
+
] }),
|
|
280
|
+
/* @__PURE__ */ jsx3(
|
|
281
|
+
TextInput,
|
|
282
|
+
{
|
|
283
|
+
ref,
|
|
284
|
+
style: [
|
|
285
|
+
styles2.input,
|
|
286
|
+
colorStyles.input,
|
|
287
|
+
error && colorStyles.inputError,
|
|
288
|
+
!editable && styles2.inputDisabled,
|
|
289
|
+
inputStyle
|
|
290
|
+
],
|
|
291
|
+
editable,
|
|
292
|
+
placeholderTextColor: colors.placeholder,
|
|
293
|
+
...props
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
error && /* @__PURE__ */ jsx3(Text2, { style: [styles2.error, colorStyles.error], children: error })
|
|
297
|
+
] });
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
Input.displayName = "Input";
|
|
301
|
+
var styles2 = StyleSheet2.create({
|
|
302
|
+
container: {
|
|
303
|
+
gap: 8
|
|
304
|
+
},
|
|
305
|
+
labelRow: {
|
|
306
|
+
flexDirection: "row",
|
|
307
|
+
alignItems: "center"
|
|
308
|
+
},
|
|
309
|
+
label: {
|
|
310
|
+
fontSize: 14,
|
|
311
|
+
fontWeight: "500"
|
|
312
|
+
},
|
|
313
|
+
required: {
|
|
314
|
+
fontSize: 14
|
|
315
|
+
},
|
|
316
|
+
input: {
|
|
317
|
+
height: 44,
|
|
318
|
+
borderWidth: 1,
|
|
319
|
+
borderRadius: 8,
|
|
320
|
+
paddingHorizontal: 12,
|
|
321
|
+
fontSize: 16
|
|
322
|
+
},
|
|
323
|
+
inputDisabled: {
|
|
324
|
+
opacity: 0.5
|
|
325
|
+
},
|
|
326
|
+
error: {
|
|
327
|
+
fontSize: 14
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
// src/components/Textarea.native.tsx
|
|
332
|
+
import React3, { useMemo as useMemo4 } from "react";
|
|
333
|
+
import {
|
|
334
|
+
TextInput as TextInput2,
|
|
335
|
+
View as View3,
|
|
336
|
+
Text as Text3,
|
|
337
|
+
StyleSheet as StyleSheet3
|
|
338
|
+
} from "react-native";
|
|
339
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
340
|
+
var Textarea = React3.forwardRef(
|
|
341
|
+
({
|
|
342
|
+
label,
|
|
343
|
+
error,
|
|
344
|
+
required,
|
|
345
|
+
containerStyle,
|
|
346
|
+
inputStyle,
|
|
347
|
+
className,
|
|
348
|
+
containerClassName,
|
|
349
|
+
editable = true,
|
|
350
|
+
numberOfLines = 4,
|
|
351
|
+
...props
|
|
352
|
+
}, ref) => {
|
|
353
|
+
const { colors } = useTheme();
|
|
354
|
+
const colorStyles = useMemo4(
|
|
355
|
+
() => ({
|
|
356
|
+
label: { color: colors.foreground },
|
|
357
|
+
required: { color: colors.destructive },
|
|
358
|
+
input: {
|
|
359
|
+
borderColor: colors.border,
|
|
360
|
+
color: colors.foreground,
|
|
361
|
+
backgroundColor: colors.card
|
|
362
|
+
},
|
|
363
|
+
inputError: { borderColor: colors.destructive },
|
|
364
|
+
error: { color: colors.destructive }
|
|
365
|
+
}),
|
|
366
|
+
[colors]
|
|
367
|
+
);
|
|
368
|
+
return /* @__PURE__ */ jsxs2(View3, { style: [styles3.container, containerStyle], children: [
|
|
369
|
+
label && /* @__PURE__ */ jsxs2(View3, { style: styles3.labelRow, children: [
|
|
370
|
+
/* @__PURE__ */ jsx4(Text3, { style: [styles3.label, colorStyles.label], children: label }),
|
|
371
|
+
required && /* @__PURE__ */ jsx4(Text3, { style: [styles3.required, colorStyles.required], children: " *" })
|
|
372
|
+
] }),
|
|
373
|
+
/* @__PURE__ */ jsx4(
|
|
374
|
+
TextInput2,
|
|
375
|
+
{
|
|
376
|
+
ref,
|
|
377
|
+
style: [
|
|
378
|
+
styles3.input,
|
|
379
|
+
colorStyles.input,
|
|
380
|
+
error && colorStyles.inputError,
|
|
381
|
+
!editable && styles3.inputDisabled,
|
|
382
|
+
inputStyle
|
|
383
|
+
],
|
|
384
|
+
editable,
|
|
385
|
+
multiline: true,
|
|
386
|
+
numberOfLines,
|
|
387
|
+
textAlignVertical: "top",
|
|
388
|
+
placeholderTextColor: colors.placeholder,
|
|
389
|
+
...props
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
error && /* @__PURE__ */ jsx4(Text3, { style: [styles3.error, colorStyles.error], children: error })
|
|
393
|
+
] });
|
|
394
|
+
}
|
|
395
|
+
);
|
|
396
|
+
Textarea.displayName = "Textarea";
|
|
397
|
+
var styles3 = StyleSheet3.create({
|
|
398
|
+
container: {
|
|
399
|
+
gap: 8
|
|
400
|
+
},
|
|
401
|
+
labelRow: {
|
|
402
|
+
flexDirection: "row",
|
|
403
|
+
alignItems: "center"
|
|
404
|
+
},
|
|
405
|
+
label: {
|
|
406
|
+
fontSize: 14,
|
|
407
|
+
fontWeight: "500"
|
|
408
|
+
},
|
|
409
|
+
required: {
|
|
410
|
+
fontSize: 14
|
|
411
|
+
},
|
|
412
|
+
input: {
|
|
413
|
+
minHeight: 100,
|
|
414
|
+
borderWidth: 1,
|
|
415
|
+
borderRadius: 8,
|
|
416
|
+
paddingHorizontal: 12,
|
|
417
|
+
paddingVertical: 12,
|
|
418
|
+
fontSize: 16
|
|
419
|
+
},
|
|
420
|
+
inputDisabled: {
|
|
421
|
+
opacity: 0.5
|
|
422
|
+
},
|
|
423
|
+
error: {
|
|
424
|
+
fontSize: 14
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
// src/components/Checkbox.native.tsx
|
|
429
|
+
import React4, { useMemo as useMemo5 } from "react";
|
|
430
|
+
import {
|
|
431
|
+
View as View4,
|
|
432
|
+
Text as Text4,
|
|
433
|
+
Pressable as Pressable2,
|
|
434
|
+
StyleSheet as StyleSheet4
|
|
435
|
+
} from "react-native";
|
|
436
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
437
|
+
var Checkbox = React4.forwardRef(
|
|
438
|
+
({
|
|
439
|
+
checked = false,
|
|
440
|
+
onCheckedChange,
|
|
441
|
+
disabled,
|
|
442
|
+
label,
|
|
443
|
+
style,
|
|
444
|
+
textStyle,
|
|
445
|
+
className,
|
|
446
|
+
// Ignored in RN
|
|
447
|
+
...props
|
|
448
|
+
}, ref) => {
|
|
449
|
+
const { colors } = useTheme();
|
|
450
|
+
const colorStyles = useMemo5(
|
|
451
|
+
() => ({
|
|
452
|
+
checkboxChecked: {
|
|
453
|
+
backgroundColor: colors.primary,
|
|
454
|
+
borderColor: colors.primary
|
|
455
|
+
},
|
|
456
|
+
checkboxUnchecked: {
|
|
457
|
+
backgroundColor: colors.background,
|
|
458
|
+
borderColor: colors.input
|
|
459
|
+
},
|
|
460
|
+
checkmark: { color: colors.primaryForeground },
|
|
461
|
+
label: { color: colors.foreground }
|
|
462
|
+
}),
|
|
463
|
+
[colors]
|
|
464
|
+
);
|
|
465
|
+
return /* @__PURE__ */ jsxs3(
|
|
466
|
+
Pressable2,
|
|
467
|
+
{
|
|
468
|
+
ref,
|
|
469
|
+
style: [styles4.container, disabled && styles4.disabled, style],
|
|
470
|
+
onPress: () => onCheckedChange?.(!checked),
|
|
471
|
+
disabled,
|
|
472
|
+
...props,
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ jsx5(
|
|
475
|
+
View4,
|
|
476
|
+
{
|
|
477
|
+
style: [
|
|
478
|
+
styles4.checkbox,
|
|
479
|
+
checked ? colorStyles.checkboxChecked : colorStyles.checkboxUnchecked
|
|
480
|
+
],
|
|
481
|
+
children: checked && /* @__PURE__ */ jsx5(Text4, { style: [styles4.checkmark, colorStyles.checkmark], children: "\u2713" })
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
label && /* @__PURE__ */ jsx5(Text4, { style: [styles4.label, colorStyles.label, textStyle], children: label })
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
Checkbox.displayName = "Checkbox";
|
|
491
|
+
var styles4 = StyleSheet4.create({
|
|
492
|
+
container: {
|
|
493
|
+
flexDirection: "row",
|
|
494
|
+
alignItems: "center",
|
|
495
|
+
gap: 8
|
|
496
|
+
},
|
|
497
|
+
checkbox: {
|
|
498
|
+
width: 20,
|
|
499
|
+
height: 20,
|
|
500
|
+
alignItems: "center",
|
|
501
|
+
justifyContent: "center",
|
|
502
|
+
borderRadius: 4,
|
|
503
|
+
borderWidth: 2
|
|
504
|
+
},
|
|
505
|
+
checkmark: {
|
|
506
|
+
fontSize: 12,
|
|
507
|
+
fontWeight: "bold"
|
|
508
|
+
},
|
|
509
|
+
label: {
|
|
510
|
+
fontSize: 14
|
|
511
|
+
},
|
|
512
|
+
disabled: {
|
|
513
|
+
opacity: 0.5
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
// src/components/Switch.native.tsx
|
|
518
|
+
import React5, { useEffect, useMemo as useMemo6 } from "react";
|
|
519
|
+
import {
|
|
520
|
+
Pressable as Pressable3,
|
|
521
|
+
StyleSheet as StyleSheet5
|
|
522
|
+
} from "react-native";
|
|
523
|
+
import Animated, {
|
|
524
|
+
useAnimatedStyle,
|
|
525
|
+
useSharedValue,
|
|
526
|
+
withTiming
|
|
527
|
+
} from "react-native-reanimated";
|
|
528
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
529
|
+
var AnimatedThumb = Animated.View;
|
|
530
|
+
var Switch = React5.forwardRef(
|
|
531
|
+
({
|
|
532
|
+
checked = false,
|
|
533
|
+
onCheckedChange,
|
|
534
|
+
disabled,
|
|
535
|
+
style,
|
|
536
|
+
className,
|
|
537
|
+
// Ignored in RN
|
|
538
|
+
...props
|
|
539
|
+
}, ref) => {
|
|
540
|
+
const { colors } = useTheme();
|
|
541
|
+
const translateX = useSharedValue(checked ? 20 : 0);
|
|
542
|
+
useEffect(() => {
|
|
543
|
+
translateX.value = withTiming(checked ? 20 : 0, { duration: 200 });
|
|
544
|
+
}, [checked, translateX]);
|
|
545
|
+
const thumbStyle = useAnimatedStyle(() => ({
|
|
546
|
+
transform: [{ translateX: translateX.value }]
|
|
547
|
+
}));
|
|
548
|
+
const colorStyles = useMemo6(
|
|
549
|
+
() => ({
|
|
550
|
+
trackChecked: { backgroundColor: colors.primary },
|
|
551
|
+
trackUnchecked: { backgroundColor: colors.input },
|
|
552
|
+
thumb: { backgroundColor: colors.background }
|
|
553
|
+
}),
|
|
554
|
+
[colors]
|
|
555
|
+
);
|
|
556
|
+
return /* @__PURE__ */ jsx6(
|
|
557
|
+
Pressable3,
|
|
558
|
+
{
|
|
559
|
+
ref,
|
|
560
|
+
style: [
|
|
561
|
+
styles5.track,
|
|
562
|
+
checked ? colorStyles.trackChecked : colorStyles.trackUnchecked,
|
|
563
|
+
disabled && styles5.disabled,
|
|
564
|
+
style
|
|
565
|
+
],
|
|
566
|
+
onPress: () => onCheckedChange?.(!checked),
|
|
567
|
+
disabled,
|
|
568
|
+
...props,
|
|
569
|
+
children: /* @__PURE__ */ jsx6(AnimatedThumb, { style: [styles5.thumb, colorStyles.thumb, thumbStyle] })
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
);
|
|
574
|
+
Switch.displayName = "Switch";
|
|
575
|
+
var styles5 = StyleSheet5.create({
|
|
576
|
+
track: {
|
|
577
|
+
width: 44,
|
|
578
|
+
height: 24,
|
|
579
|
+
borderRadius: 12,
|
|
580
|
+
padding: 2,
|
|
581
|
+
justifyContent: "center"
|
|
582
|
+
},
|
|
583
|
+
thumb: {
|
|
584
|
+
width: 20,
|
|
585
|
+
height: 20,
|
|
586
|
+
borderRadius: 10,
|
|
587
|
+
shadowColor: "#000",
|
|
588
|
+
shadowOffset: { width: 0, height: 1 },
|
|
589
|
+
shadowOpacity: 0.2,
|
|
590
|
+
shadowRadius: 2,
|
|
591
|
+
elevation: 2
|
|
592
|
+
},
|
|
593
|
+
disabled: {
|
|
594
|
+
opacity: 0.5
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
// src/components/Select.native.tsx
|
|
599
|
+
import React6, { useState, useMemo as useMemo7 } from "react";
|
|
600
|
+
import {
|
|
601
|
+
View as View6,
|
|
602
|
+
Text as Text5,
|
|
603
|
+
Pressable as Pressable4,
|
|
604
|
+
Modal,
|
|
605
|
+
FlatList,
|
|
606
|
+
StyleSheet as StyleSheet6
|
|
607
|
+
} from "react-native";
|
|
608
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
609
|
+
var Select = React6.forwardRef(
|
|
610
|
+
({
|
|
611
|
+
options,
|
|
612
|
+
value,
|
|
613
|
+
onValueChange,
|
|
614
|
+
placeholder = "Select...",
|
|
615
|
+
label,
|
|
616
|
+
error,
|
|
617
|
+
required,
|
|
618
|
+
disabled,
|
|
619
|
+
style,
|
|
620
|
+
className,
|
|
621
|
+
// Ignored in RN
|
|
622
|
+
...props
|
|
623
|
+
}, ref) => {
|
|
624
|
+
const { colors } = useTheme();
|
|
625
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
626
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
627
|
+
const colorStyles = useMemo7(
|
|
628
|
+
() => ({
|
|
629
|
+
label: { color: colors.foreground },
|
|
630
|
+
required: { color: colors.destructive },
|
|
631
|
+
trigger: {
|
|
632
|
+
borderColor: colors.input,
|
|
633
|
+
backgroundColor: colors.card
|
|
634
|
+
},
|
|
635
|
+
triggerError: { borderColor: colors.destructive },
|
|
636
|
+
triggerText: { color: colors.foreground },
|
|
637
|
+
placeholder: { color: colors.mutedForeground },
|
|
638
|
+
chevron: { color: colors.mutedForeground },
|
|
639
|
+
error: { color: colors.destructive },
|
|
640
|
+
modalContent: { backgroundColor: colors.card },
|
|
641
|
+
modalHeader: { borderBottomColor: colors.border },
|
|
642
|
+
modalTitle: { color: colors.cardForeground },
|
|
643
|
+
option: { borderBottomColor: colors.border },
|
|
644
|
+
optionSelected: { backgroundColor: colors.secondary },
|
|
645
|
+
optionText: { color: colors.foreground }
|
|
646
|
+
}),
|
|
647
|
+
[colors]
|
|
648
|
+
);
|
|
649
|
+
return /* @__PURE__ */ jsxs4(View6, { ref, style: [styles6.container, style], ...props, children: [
|
|
650
|
+
label && /* @__PURE__ */ jsxs4(Text5, { style: [styles6.label, colorStyles.label], children: [
|
|
651
|
+
label,
|
|
652
|
+
required && /* @__PURE__ */ jsx7(Text5, { style: colorStyles.required, children: " *" })
|
|
653
|
+
] }),
|
|
654
|
+
/* @__PURE__ */ jsxs4(
|
|
655
|
+
Pressable4,
|
|
656
|
+
{
|
|
657
|
+
style: [
|
|
658
|
+
styles6.trigger,
|
|
659
|
+
colorStyles.trigger,
|
|
660
|
+
error && colorStyles.triggerError,
|
|
661
|
+
disabled && styles6.disabled
|
|
662
|
+
],
|
|
663
|
+
onPress: () => !disabled && setIsOpen(true),
|
|
664
|
+
children: [
|
|
665
|
+
/* @__PURE__ */ jsx7(
|
|
666
|
+
Text5,
|
|
667
|
+
{
|
|
668
|
+
style: [
|
|
669
|
+
styles6.triggerText,
|
|
670
|
+
colorStyles.triggerText,
|
|
671
|
+
!selectedOption && colorStyles.placeholder
|
|
672
|
+
],
|
|
673
|
+
children: selectedOption?.label || placeholder
|
|
674
|
+
}
|
|
675
|
+
),
|
|
676
|
+
/* @__PURE__ */ jsx7(Text5, { style: [styles6.chevron, colorStyles.chevron], children: "\u25BC" })
|
|
677
|
+
]
|
|
678
|
+
}
|
|
679
|
+
),
|
|
680
|
+
error && /* @__PURE__ */ jsx7(Text5, { style: [styles6.error, colorStyles.error], children: error }),
|
|
681
|
+
/* @__PURE__ */ jsx7(
|
|
682
|
+
Modal,
|
|
683
|
+
{
|
|
684
|
+
visible: isOpen,
|
|
685
|
+
transparent: true,
|
|
686
|
+
animationType: "fade",
|
|
687
|
+
onRequestClose: () => setIsOpen(false),
|
|
688
|
+
children: /* @__PURE__ */ jsx7(
|
|
689
|
+
Pressable4,
|
|
690
|
+
{
|
|
691
|
+
style: styles6.backdrop,
|
|
692
|
+
onPress: () => setIsOpen(false),
|
|
693
|
+
children: /* @__PURE__ */ jsxs4(View6, { style: [styles6.modalContent, colorStyles.modalContent], children: [
|
|
694
|
+
/* @__PURE__ */ jsx7(View6, { style: [styles6.modalHeader, colorStyles.modalHeader], children: /* @__PURE__ */ jsx7(Text5, { style: [styles6.modalTitle, colorStyles.modalTitle], children: label || "Select an option" }) }),
|
|
695
|
+
/* @__PURE__ */ jsx7(
|
|
696
|
+
FlatList,
|
|
697
|
+
{
|
|
698
|
+
data: options,
|
|
699
|
+
keyExtractor: (item) => item.value,
|
|
700
|
+
renderItem: ({ item }) => /* @__PURE__ */ jsx7(
|
|
701
|
+
Pressable4,
|
|
702
|
+
{
|
|
703
|
+
style: [
|
|
704
|
+
styles6.option,
|
|
705
|
+
colorStyles.option,
|
|
706
|
+
value === item.value && colorStyles.optionSelected
|
|
707
|
+
],
|
|
708
|
+
onPress: () => {
|
|
709
|
+
onValueChange?.(item.value);
|
|
710
|
+
setIsOpen(false);
|
|
711
|
+
},
|
|
712
|
+
children: /* @__PURE__ */ jsx7(
|
|
713
|
+
Text5,
|
|
714
|
+
{
|
|
715
|
+
style: [
|
|
716
|
+
styles6.optionText,
|
|
717
|
+
colorStyles.optionText,
|
|
718
|
+
value === item.value && styles6.optionTextSelected
|
|
719
|
+
],
|
|
720
|
+
children: item.label
|
|
721
|
+
}
|
|
722
|
+
)
|
|
723
|
+
}
|
|
724
|
+
)
|
|
725
|
+
}
|
|
726
|
+
)
|
|
727
|
+
] })
|
|
728
|
+
}
|
|
729
|
+
)
|
|
730
|
+
}
|
|
731
|
+
)
|
|
732
|
+
] });
|
|
733
|
+
}
|
|
734
|
+
);
|
|
735
|
+
Select.displayName = "Select";
|
|
736
|
+
var styles6 = StyleSheet6.create({
|
|
737
|
+
container: {
|
|
738
|
+
gap: 8
|
|
739
|
+
},
|
|
740
|
+
label: {
|
|
741
|
+
fontSize: 14,
|
|
742
|
+
fontWeight: "600"
|
|
743
|
+
},
|
|
744
|
+
trigger: {
|
|
745
|
+
height: 44,
|
|
746
|
+
flexDirection: "row",
|
|
747
|
+
alignItems: "center",
|
|
748
|
+
justifyContent: "space-between",
|
|
749
|
+
paddingHorizontal: 12,
|
|
750
|
+
borderRadius: 8,
|
|
751
|
+
borderWidth: 1
|
|
752
|
+
},
|
|
753
|
+
disabled: {
|
|
754
|
+
opacity: 0.5
|
|
755
|
+
},
|
|
756
|
+
triggerText: {
|
|
757
|
+
fontSize: 14
|
|
758
|
+
},
|
|
759
|
+
chevron: {
|
|
760
|
+
fontSize: 10
|
|
761
|
+
},
|
|
762
|
+
error: {
|
|
763
|
+
fontSize: 12
|
|
764
|
+
},
|
|
765
|
+
backdrop: {
|
|
766
|
+
flex: 1,
|
|
767
|
+
alignItems: "center",
|
|
768
|
+
justifyContent: "center",
|
|
769
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
770
|
+
},
|
|
771
|
+
modalContent: {
|
|
772
|
+
margin: 16,
|
|
773
|
+
maxHeight: "60%",
|
|
774
|
+
width: "90%",
|
|
775
|
+
borderRadius: 12,
|
|
776
|
+
overflow: "hidden"
|
|
777
|
+
},
|
|
778
|
+
modalHeader: {
|
|
779
|
+
padding: 16,
|
|
780
|
+
borderBottomWidth: 1
|
|
781
|
+
},
|
|
782
|
+
modalTitle: {
|
|
783
|
+
fontSize: 18,
|
|
784
|
+
fontWeight: "600"
|
|
785
|
+
},
|
|
786
|
+
option: {
|
|
787
|
+
padding: 16,
|
|
788
|
+
borderBottomWidth: 1
|
|
789
|
+
},
|
|
790
|
+
optionText: {
|
|
791
|
+
fontSize: 14
|
|
792
|
+
},
|
|
793
|
+
optionTextSelected: {
|
|
794
|
+
fontWeight: "600"
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
// src/components/Label.native.tsx
|
|
799
|
+
import React7, { useMemo as useMemo8 } from "react";
|
|
800
|
+
import {
|
|
801
|
+
Text as Text6,
|
|
802
|
+
StyleSheet as StyleSheet7
|
|
803
|
+
} from "react-native";
|
|
804
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
805
|
+
var Label = React7.forwardRef(
|
|
806
|
+
({
|
|
807
|
+
children,
|
|
808
|
+
required,
|
|
809
|
+
style,
|
|
810
|
+
className,
|
|
811
|
+
// Ignored in RN
|
|
812
|
+
htmlFor,
|
|
813
|
+
// Ignored in RN
|
|
814
|
+
...props
|
|
815
|
+
}, ref) => {
|
|
816
|
+
const { colors } = useTheme();
|
|
817
|
+
const colorStyles = useMemo8(
|
|
818
|
+
() => ({
|
|
819
|
+
label: { color: colors.foreground },
|
|
820
|
+
required: { color: colors.destructive }
|
|
821
|
+
}),
|
|
822
|
+
[colors]
|
|
823
|
+
);
|
|
824
|
+
return /* @__PURE__ */ jsxs5(Text6, { ref, style: [styles7.label, colorStyles.label, style], ...props, children: [
|
|
825
|
+
children,
|
|
826
|
+
required && /* @__PURE__ */ jsx8(Text6, { style: colorStyles.required, children: " *" })
|
|
827
|
+
] });
|
|
828
|
+
}
|
|
829
|
+
);
|
|
830
|
+
Label.displayName = "Label";
|
|
831
|
+
var styles7 = StyleSheet7.create({
|
|
832
|
+
label: {
|
|
833
|
+
fontSize: 14,
|
|
834
|
+
fontWeight: "600",
|
|
835
|
+
lineHeight: 14
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
// src/components/Badge.native.tsx
|
|
840
|
+
import React8, { useMemo as useMemo9 } from "react";
|
|
841
|
+
import {
|
|
842
|
+
View as View7,
|
|
843
|
+
Text as Text7,
|
|
844
|
+
Pressable as Pressable5,
|
|
845
|
+
StyleSheet as StyleSheet8
|
|
846
|
+
} from "react-native";
|
|
847
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
848
|
+
function getBadgeVariants(colors) {
|
|
849
|
+
return {
|
|
850
|
+
default: { bg: colors.primary, text: colors.primaryForeground },
|
|
851
|
+
secondary: { bg: colors.secondary, text: colors.secondaryForeground },
|
|
852
|
+
destructive: { bg: colors.destructive, text: colors.destructiveForeground },
|
|
853
|
+
outline: { bg: "transparent", text: colors.foreground, border: colors.border },
|
|
854
|
+
success: { bg: colors.success, text: colors.successForeground },
|
|
855
|
+
// Status variants
|
|
856
|
+
todo: { bg: colors.statusTodo || "rgba(107, 114, 128, 0.2)", text: colors.statusTodoText || "#4b5563" },
|
|
857
|
+
"in-progress": { bg: colors.statusInProgress || "rgba(59, 130, 246, 0.2)", text: colors.statusInProgressText || "#2563eb" },
|
|
858
|
+
review: { bg: colors.statusReview || "rgba(245, 158, 11, 0.2)", text: colors.statusReviewText || "#d97706" },
|
|
859
|
+
done: { bg: colors.statusDone || "rgba(34, 197, 94, 0.2)", text: colors.statusDoneText || "#16a34a" },
|
|
860
|
+
blocked: { bg: colors.statusBlocked || "rgba(239, 68, 68, 0.2)", text: colors.statusBlockedText || "#dc2626" },
|
|
861
|
+
// Priority variants
|
|
862
|
+
low: { bg: colors.statusTodo || "rgba(107, 114, 128, 0.2)", text: colors.statusTodoText || "#4b5563" },
|
|
863
|
+
medium: { bg: colors.statusInProgress || "rgba(59, 130, 246, 0.2)", text: colors.statusInProgressText || "#2563eb" },
|
|
864
|
+
high: { bg: colors.statusReview || "rgba(245, 158, 11, 0.2)", text: colors.statusReviewText || "#d97706" },
|
|
865
|
+
urgent: { bg: colors.statusBlocked || "rgba(239, 68, 68, 0.2)", text: colors.statusBlockedText || "#dc2626" }
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
function getDotColors(colors) {
|
|
869
|
+
return {
|
|
870
|
+
todo: colors.dotTodo || "#6b7280",
|
|
871
|
+
"in-progress": colors.dotInProgress || "#3b82f6",
|
|
872
|
+
review: colors.dotReview || "#f59e0b",
|
|
873
|
+
done: colors.dotDone || "#22c55e",
|
|
874
|
+
blocked: colors.dotBlocked || "#ef4444"
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
var Badge = React8.forwardRef(
|
|
878
|
+
({
|
|
879
|
+
variant = "default",
|
|
880
|
+
children,
|
|
881
|
+
showDot,
|
|
882
|
+
style,
|
|
883
|
+
textStyle,
|
|
884
|
+
className,
|
|
885
|
+
// Ignored in RN
|
|
886
|
+
textClassName,
|
|
887
|
+
// Ignored in RN
|
|
888
|
+
...props
|
|
889
|
+
}, ref) => {
|
|
890
|
+
const { colors } = useTheme();
|
|
891
|
+
const badgeVariants = useMemo9(() => getBadgeVariants(colors), [colors]);
|
|
892
|
+
const badgeDotColors = useMemo9(() => getDotColors(colors), [colors]);
|
|
893
|
+
const variantStyle = badgeVariants[variant] || badgeVariants.default;
|
|
894
|
+
const hasBorder = "border" in variantStyle;
|
|
895
|
+
const containerStyle = {
|
|
896
|
+
backgroundColor: variantStyle.bg,
|
|
897
|
+
...hasBorder && {
|
|
898
|
+
borderWidth: 1,
|
|
899
|
+
borderColor: variantStyle.border
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
const dotColor = showDot && variant && badgeDotColors[variant];
|
|
903
|
+
return /* @__PURE__ */ jsxs6(View7, { ref, style: [styles8.container, containerStyle, style], ...props, children: [
|
|
904
|
+
dotColor && /* @__PURE__ */ jsx9(View7, { style: [styles8.dot, { backgroundColor: dotColor }] }),
|
|
905
|
+
typeof children === "string" ? /* @__PURE__ */ jsx9(Text7, { style: [styles8.text, { color: variantStyle.text }, textStyle], children }) : children
|
|
906
|
+
] });
|
|
907
|
+
}
|
|
908
|
+
);
|
|
909
|
+
Badge.displayName = "Badge";
|
|
910
|
+
var PressableBadge = React8.forwardRef(
|
|
911
|
+
({
|
|
912
|
+
variant = "outline",
|
|
913
|
+
selectedVariant,
|
|
914
|
+
children,
|
|
915
|
+
selected,
|
|
916
|
+
style,
|
|
917
|
+
textStyle,
|
|
918
|
+
className,
|
|
919
|
+
// Ignored in RN
|
|
920
|
+
textClassName,
|
|
921
|
+
// Ignored in RN
|
|
922
|
+
...props
|
|
923
|
+
}, ref) => {
|
|
924
|
+
const { colors } = useTheme();
|
|
925
|
+
const badgeVariants = useMemo9(() => getBadgeVariants(colors), [colors]);
|
|
926
|
+
const currentVariant = selected && selectedVariant ? selectedVariant : variant;
|
|
927
|
+
const variantStyle = badgeVariants[currentVariant] || badgeVariants.default;
|
|
928
|
+
const hasBorder = "border" in variantStyle;
|
|
929
|
+
const containerStyle = {
|
|
930
|
+
backgroundColor: variantStyle.bg,
|
|
931
|
+
...hasBorder && {
|
|
932
|
+
borderWidth: selected ? 2 : 1,
|
|
933
|
+
borderColor: variantStyle.border
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
return /* @__PURE__ */ jsx9(
|
|
937
|
+
Pressable5,
|
|
938
|
+
{
|
|
939
|
+
ref,
|
|
940
|
+
style: ({ pressed }) => [
|
|
941
|
+
styles8.container,
|
|
942
|
+
containerStyle,
|
|
943
|
+
pressed && styles8.pressed,
|
|
944
|
+
style
|
|
945
|
+
],
|
|
946
|
+
...props,
|
|
947
|
+
children: typeof children === "string" ? /* @__PURE__ */ jsx9(Text7, { style: [styles8.text, { color: variantStyle.text }, textStyle], children }) : children
|
|
948
|
+
}
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
);
|
|
952
|
+
PressableBadge.displayName = "PressableBadge";
|
|
953
|
+
var styles8 = StyleSheet8.create({
|
|
954
|
+
container: {
|
|
955
|
+
flexDirection: "row",
|
|
956
|
+
alignItems: "center",
|
|
957
|
+
borderRadius: 9999,
|
|
958
|
+
paddingHorizontal: 12,
|
|
959
|
+
paddingVertical: 4
|
|
960
|
+
},
|
|
961
|
+
text: {
|
|
962
|
+
fontSize: 12,
|
|
963
|
+
fontWeight: "500"
|
|
964
|
+
},
|
|
965
|
+
dot: {
|
|
966
|
+
width: 6,
|
|
967
|
+
height: 6,
|
|
968
|
+
borderRadius: 3,
|
|
969
|
+
marginRight: 6
|
|
970
|
+
},
|
|
971
|
+
pressed: {
|
|
972
|
+
opacity: 0.8
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
// src/components/Avatar.native.tsx
|
|
977
|
+
import React9, { useState as useState2, useMemo as useMemo10 } from "react";
|
|
978
|
+
import {
|
|
979
|
+
View as View8,
|
|
980
|
+
Image,
|
|
981
|
+
Text as Text8,
|
|
982
|
+
StyleSheet as StyleSheet9
|
|
983
|
+
} from "react-native";
|
|
984
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
985
|
+
var sizeStyles2 = {
|
|
986
|
+
sm: {
|
|
987
|
+
container: { width: 32, height: 32 },
|
|
988
|
+
text: { fontSize: 12 }
|
|
989
|
+
},
|
|
990
|
+
default: {
|
|
991
|
+
container: { width: 40, height: 40 },
|
|
992
|
+
text: { fontSize: 14 }
|
|
993
|
+
},
|
|
994
|
+
lg: {
|
|
995
|
+
container: { width: 48, height: 48 },
|
|
996
|
+
text: { fontSize: 16 }
|
|
997
|
+
},
|
|
998
|
+
xl: {
|
|
999
|
+
container: { width: 64, height: 64 },
|
|
1000
|
+
text: { fontSize: 18 }
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
var Avatar = React9.forwardRef(
|
|
1004
|
+
({
|
|
1005
|
+
size = "default",
|
|
1006
|
+
children,
|
|
1007
|
+
style,
|
|
1008
|
+
className,
|
|
1009
|
+
// Ignored in RN
|
|
1010
|
+
...props
|
|
1011
|
+
}, ref) => {
|
|
1012
|
+
return /* @__PURE__ */ jsx10(
|
|
1013
|
+
View8,
|
|
1014
|
+
{
|
|
1015
|
+
ref,
|
|
1016
|
+
style: [styles9.avatar, sizeStyles2[size].container, style],
|
|
1017
|
+
...props,
|
|
1018
|
+
children
|
|
1019
|
+
}
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
);
|
|
1023
|
+
Avatar.displayName = "Avatar";
|
|
1024
|
+
var AvatarImage = React9.forwardRef(
|
|
1025
|
+
({
|
|
1026
|
+
src,
|
|
1027
|
+
style,
|
|
1028
|
+
className,
|
|
1029
|
+
// Ignored in RN
|
|
1030
|
+
...props
|
|
1031
|
+
}, ref) => {
|
|
1032
|
+
const [hasError, setHasError] = useState2(false);
|
|
1033
|
+
if (!src || hasError) return null;
|
|
1034
|
+
return /* @__PURE__ */ jsx10(
|
|
1035
|
+
Image,
|
|
1036
|
+
{
|
|
1037
|
+
ref,
|
|
1038
|
+
source: { uri: src },
|
|
1039
|
+
style: [styles9.image, style],
|
|
1040
|
+
onError: () => setHasError(true),
|
|
1041
|
+
...props
|
|
1042
|
+
}
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
);
|
|
1046
|
+
AvatarImage.displayName = "AvatarImage";
|
|
1047
|
+
var AvatarFallback = React9.forwardRef(
|
|
1048
|
+
({
|
|
1049
|
+
size = "default",
|
|
1050
|
+
children,
|
|
1051
|
+
style,
|
|
1052
|
+
className,
|
|
1053
|
+
// Ignored in RN
|
|
1054
|
+
...props
|
|
1055
|
+
}, ref) => {
|
|
1056
|
+
const { colors } = useTheme();
|
|
1057
|
+
const colorStyles = useMemo10(
|
|
1058
|
+
() => ({
|
|
1059
|
+
fallback: { backgroundColor: colors.accent },
|
|
1060
|
+
fallbackText: { color: colors.accentForeground }
|
|
1061
|
+
}),
|
|
1062
|
+
[colors]
|
|
1063
|
+
);
|
|
1064
|
+
return /* @__PURE__ */ jsx10(View8, { ref, style: [styles9.fallback, colorStyles.fallback, style], ...props, children: typeof children === "string" ? /* @__PURE__ */ jsx10(Text8, { style: [styles9.fallbackText, colorStyles.fallbackText, sizeStyles2[size].text], children }) : children });
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
AvatarFallback.displayName = "AvatarFallback";
|
|
1068
|
+
function getInitials(name) {
|
|
1069
|
+
if (!name) return "U";
|
|
1070
|
+
const parts = name.trim().split(" ");
|
|
1071
|
+
if (parts.length >= 2) {
|
|
1072
|
+
return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
|
|
1073
|
+
}
|
|
1074
|
+
return name.substring(0, 2).toUpperCase();
|
|
1075
|
+
}
|
|
1076
|
+
var styles9 = StyleSheet9.create({
|
|
1077
|
+
avatar: {
|
|
1078
|
+
alignItems: "center",
|
|
1079
|
+
justifyContent: "center",
|
|
1080
|
+
overflow: "hidden",
|
|
1081
|
+
borderRadius: 9999
|
|
1082
|
+
},
|
|
1083
|
+
image: {
|
|
1084
|
+
width: "100%",
|
|
1085
|
+
height: "100%"
|
|
1086
|
+
},
|
|
1087
|
+
fallback: {
|
|
1088
|
+
width: "100%",
|
|
1089
|
+
height: "100%",
|
|
1090
|
+
alignItems: "center",
|
|
1091
|
+
justifyContent: "center"
|
|
1092
|
+
},
|
|
1093
|
+
fallbackText: {
|
|
1094
|
+
fontWeight: "600"
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
|
|
1098
|
+
// src/components/Card.native.tsx
|
|
1099
|
+
import React10, { useMemo as useMemo11 } from "react";
|
|
1100
|
+
import {
|
|
1101
|
+
View as View9,
|
|
1102
|
+
Text as Text9,
|
|
1103
|
+
Pressable as Pressable6,
|
|
1104
|
+
StyleSheet as StyleSheet10
|
|
1105
|
+
} from "react-native";
|
|
1106
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1107
|
+
var Card = React10.forwardRef(
|
|
1108
|
+
({
|
|
1109
|
+
children,
|
|
1110
|
+
style,
|
|
1111
|
+
className,
|
|
1112
|
+
// Ignored in RN
|
|
1113
|
+
...props
|
|
1114
|
+
}, ref) => {
|
|
1115
|
+
const { colors } = useTheme();
|
|
1116
|
+
const colorStyles = useMemo11(
|
|
1117
|
+
() => ({
|
|
1118
|
+
card: {
|
|
1119
|
+
borderColor: colors.border,
|
|
1120
|
+
backgroundColor: colors.card
|
|
1121
|
+
}
|
|
1122
|
+
}),
|
|
1123
|
+
[colors]
|
|
1124
|
+
);
|
|
1125
|
+
return /* @__PURE__ */ jsx11(View9, { ref, style: [styles10.card, colorStyles.card, style], ...props, children });
|
|
1126
|
+
}
|
|
1127
|
+
);
|
|
1128
|
+
Card.displayName = "Card";
|
|
1129
|
+
var PressableCard = React10.forwardRef(
|
|
1130
|
+
({
|
|
1131
|
+
children,
|
|
1132
|
+
style,
|
|
1133
|
+
className,
|
|
1134
|
+
// Ignored in RN
|
|
1135
|
+
...props
|
|
1136
|
+
}, ref) => {
|
|
1137
|
+
const { colors } = useTheme();
|
|
1138
|
+
const colorStyles = useMemo11(
|
|
1139
|
+
() => ({
|
|
1140
|
+
card: {
|
|
1141
|
+
borderColor: colors.border,
|
|
1142
|
+
backgroundColor: colors.card
|
|
1143
|
+
}
|
|
1144
|
+
}),
|
|
1145
|
+
[colors]
|
|
1146
|
+
);
|
|
1147
|
+
return /* @__PURE__ */ jsx11(
|
|
1148
|
+
Pressable6,
|
|
1149
|
+
{
|
|
1150
|
+
ref,
|
|
1151
|
+
style: ({ pressed }) => [
|
|
1152
|
+
styles10.card,
|
|
1153
|
+
colorStyles.card,
|
|
1154
|
+
pressed && styles10.pressed,
|
|
1155
|
+
style
|
|
1156
|
+
],
|
|
1157
|
+
...props,
|
|
1158
|
+
children
|
|
1159
|
+
}
|
|
1160
|
+
);
|
|
1161
|
+
}
|
|
1162
|
+
);
|
|
1163
|
+
PressableCard.displayName = "PressableCard";
|
|
1164
|
+
var CardHeader = React10.forwardRef(
|
|
1165
|
+
({
|
|
1166
|
+
children,
|
|
1167
|
+
style,
|
|
1168
|
+
className,
|
|
1169
|
+
// Ignored in RN
|
|
1170
|
+
...props
|
|
1171
|
+
}, ref) => {
|
|
1172
|
+
return /* @__PURE__ */ jsx11(View9, { ref, style: [styles10.header, style], ...props, children });
|
|
1173
|
+
}
|
|
1174
|
+
);
|
|
1175
|
+
CardHeader.displayName = "CardHeader";
|
|
1176
|
+
var CardTitle = React10.forwardRef(
|
|
1177
|
+
({
|
|
1178
|
+
children,
|
|
1179
|
+
style,
|
|
1180
|
+
textStyle,
|
|
1181
|
+
className,
|
|
1182
|
+
// Ignored in RN
|
|
1183
|
+
...props
|
|
1184
|
+
}, ref) => {
|
|
1185
|
+
const { colors } = useTheme();
|
|
1186
|
+
const colorStyles = useMemo11(
|
|
1187
|
+
() => ({
|
|
1188
|
+
titleText: { color: colors.cardForeground }
|
|
1189
|
+
}),
|
|
1190
|
+
[colors]
|
|
1191
|
+
);
|
|
1192
|
+
return /* @__PURE__ */ jsx11(View9, { ref, style: [style], ...props, children: typeof children === "string" ? /* @__PURE__ */ jsx11(Text9, { style: [styles10.titleText, colorStyles.titleText, textStyle], children }) : children });
|
|
1193
|
+
}
|
|
1194
|
+
);
|
|
1195
|
+
CardTitle.displayName = "CardTitle";
|
|
1196
|
+
var CardDescription = React10.forwardRef(
|
|
1197
|
+
({
|
|
1198
|
+
children,
|
|
1199
|
+
style,
|
|
1200
|
+
textStyle,
|
|
1201
|
+
className,
|
|
1202
|
+
// Ignored in RN
|
|
1203
|
+
...props
|
|
1204
|
+
}, ref) => {
|
|
1205
|
+
const { colors } = useTheme();
|
|
1206
|
+
const colorStyles = useMemo11(
|
|
1207
|
+
() => ({
|
|
1208
|
+
descriptionText: { color: colors.mutedForeground }
|
|
1209
|
+
}),
|
|
1210
|
+
[colors]
|
|
1211
|
+
);
|
|
1212
|
+
return /* @__PURE__ */ jsx11(View9, { ref, style: [styles10.description, style], ...props, children: typeof children === "string" ? /* @__PURE__ */ jsx11(Text9, { style: [styles10.descriptionText, colorStyles.descriptionText, textStyle], children }) : children });
|
|
1213
|
+
}
|
|
1214
|
+
);
|
|
1215
|
+
CardDescription.displayName = "CardDescription";
|
|
1216
|
+
var CardContent = React10.forwardRef(
|
|
1217
|
+
({
|
|
1218
|
+
children,
|
|
1219
|
+
style,
|
|
1220
|
+
className,
|
|
1221
|
+
// Ignored in RN
|
|
1222
|
+
...props
|
|
1223
|
+
}, ref) => {
|
|
1224
|
+
return /* @__PURE__ */ jsx11(View9, { ref, style: [style], ...props, children });
|
|
1225
|
+
}
|
|
1226
|
+
);
|
|
1227
|
+
CardContent.displayName = "CardContent";
|
|
1228
|
+
var CardFooter = React10.forwardRef(
|
|
1229
|
+
({
|
|
1230
|
+
children,
|
|
1231
|
+
style,
|
|
1232
|
+
className,
|
|
1233
|
+
// Ignored in RN
|
|
1234
|
+
...props
|
|
1235
|
+
}, ref) => {
|
|
1236
|
+
const { colors } = useTheme();
|
|
1237
|
+
const colorStyles = useMemo11(
|
|
1238
|
+
() => ({
|
|
1239
|
+
footer: { borderTopColor: colors.border }
|
|
1240
|
+
}),
|
|
1241
|
+
[colors]
|
|
1242
|
+
);
|
|
1243
|
+
return /* @__PURE__ */ jsx11(View9, { ref, style: [styles10.footer, colorStyles.footer, style], ...props, children });
|
|
1244
|
+
}
|
|
1245
|
+
);
|
|
1246
|
+
CardFooter.displayName = "CardFooter";
|
|
1247
|
+
var styles10 = StyleSheet10.create({
|
|
1248
|
+
card: {
|
|
1249
|
+
borderRadius: 12,
|
|
1250
|
+
borderWidth: 1,
|
|
1251
|
+
padding: 16
|
|
1252
|
+
},
|
|
1253
|
+
pressed: {
|
|
1254
|
+
opacity: 0.8
|
|
1255
|
+
},
|
|
1256
|
+
header: {
|
|
1257
|
+
marginBottom: 12
|
|
1258
|
+
},
|
|
1259
|
+
titleText: {
|
|
1260
|
+
fontSize: 18,
|
|
1261
|
+
fontWeight: "600"
|
|
1262
|
+
},
|
|
1263
|
+
description: {
|
|
1264
|
+
marginTop: 4
|
|
1265
|
+
},
|
|
1266
|
+
descriptionText: {
|
|
1267
|
+
fontSize: 14
|
|
1268
|
+
},
|
|
1269
|
+
footer: {
|
|
1270
|
+
marginTop: 12,
|
|
1271
|
+
paddingTop: 12,
|
|
1272
|
+
borderTopWidth: 1
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
// src/components/Separator.native.tsx
|
|
1277
|
+
import React11, { useMemo as useMemo12 } from "react";
|
|
1278
|
+
import {
|
|
1279
|
+
View as View10,
|
|
1280
|
+
StyleSheet as StyleSheet11
|
|
1281
|
+
} from "react-native";
|
|
1282
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1283
|
+
var Separator = React11.forwardRef(
|
|
1284
|
+
({
|
|
1285
|
+
orientation = "horizontal",
|
|
1286
|
+
style,
|
|
1287
|
+
className,
|
|
1288
|
+
// Ignored in RN
|
|
1289
|
+
...props
|
|
1290
|
+
}, ref) => {
|
|
1291
|
+
const { colors } = useTheme();
|
|
1292
|
+
const colorStyles = useMemo12(
|
|
1293
|
+
() => ({
|
|
1294
|
+
base: { backgroundColor: colors.border }
|
|
1295
|
+
}),
|
|
1296
|
+
[colors]
|
|
1297
|
+
);
|
|
1298
|
+
return /* @__PURE__ */ jsx12(
|
|
1299
|
+
View10,
|
|
1300
|
+
{
|
|
1301
|
+
ref,
|
|
1302
|
+
style: [
|
|
1303
|
+
colorStyles.base,
|
|
1304
|
+
orientation === "horizontal" ? styles11.horizontal : styles11.vertical,
|
|
1305
|
+
style
|
|
1306
|
+
],
|
|
1307
|
+
...props
|
|
1308
|
+
}
|
|
1309
|
+
);
|
|
1310
|
+
}
|
|
1311
|
+
);
|
|
1312
|
+
Separator.displayName = "Separator";
|
|
1313
|
+
var styles11 = StyleSheet11.create({
|
|
1314
|
+
horizontal: {
|
|
1315
|
+
height: 1,
|
|
1316
|
+
width: "100%"
|
|
1317
|
+
},
|
|
1318
|
+
vertical: {
|
|
1319
|
+
width: 1,
|
|
1320
|
+
height: "100%"
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
|
|
1324
|
+
// src/components/Skeleton.native.tsx
|
|
1325
|
+
import React12, { useEffect as useEffect2, useMemo as useMemo13 } from "react";
|
|
1326
|
+
import {
|
|
1327
|
+
View as View11,
|
|
1328
|
+
StyleSheet as StyleSheet12
|
|
1329
|
+
} from "react-native";
|
|
1330
|
+
import Animated2, {
|
|
1331
|
+
useAnimatedStyle as useAnimatedStyle2,
|
|
1332
|
+
useSharedValue as useSharedValue2,
|
|
1333
|
+
withRepeat,
|
|
1334
|
+
withTiming as withTiming2,
|
|
1335
|
+
withSequence
|
|
1336
|
+
} from "react-native-reanimated";
|
|
1337
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1338
|
+
var AnimatedBox = Animated2.View;
|
|
1339
|
+
var Skeleton = React12.forwardRef(
|
|
1340
|
+
({
|
|
1341
|
+
style,
|
|
1342
|
+
className,
|
|
1343
|
+
// Ignored in RN
|
|
1344
|
+
...props
|
|
1345
|
+
}, ref) => {
|
|
1346
|
+
const { colors } = useTheme();
|
|
1347
|
+
const opacity = useSharedValue2(1);
|
|
1348
|
+
useEffect2(() => {
|
|
1349
|
+
opacity.value = withRepeat(
|
|
1350
|
+
withSequence(
|
|
1351
|
+
withTiming2(0.5, { duration: 1e3 }),
|
|
1352
|
+
withTiming2(1, { duration: 1e3 })
|
|
1353
|
+
),
|
|
1354
|
+
-1,
|
|
1355
|
+
false
|
|
1356
|
+
);
|
|
1357
|
+
}, [opacity]);
|
|
1358
|
+
const animatedStyle = useAnimatedStyle2(() => ({
|
|
1359
|
+
opacity: opacity.value
|
|
1360
|
+
}));
|
|
1361
|
+
const colorStyles = useMemo13(
|
|
1362
|
+
() => ({
|
|
1363
|
+
base: { backgroundColor: colors.muted }
|
|
1364
|
+
}),
|
|
1365
|
+
[colors]
|
|
1366
|
+
);
|
|
1367
|
+
return /* @__PURE__ */ jsx13(
|
|
1368
|
+
AnimatedBox,
|
|
1369
|
+
{
|
|
1370
|
+
ref,
|
|
1371
|
+
style: [styles12.base, colorStyles.base, animatedStyle, style],
|
|
1372
|
+
...props
|
|
1373
|
+
}
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1377
|
+
Skeleton.displayName = "Skeleton";
|
|
1378
|
+
var SkeletonText = React12.forwardRef(
|
|
1379
|
+
({
|
|
1380
|
+
style,
|
|
1381
|
+
className,
|
|
1382
|
+
// Ignored in RN
|
|
1383
|
+
...props
|
|
1384
|
+
}, ref) => {
|
|
1385
|
+
const { colors } = useTheme();
|
|
1386
|
+
const colorStyles = useMemo13(
|
|
1387
|
+
() => ({
|
|
1388
|
+
text: { backgroundColor: colors.muted }
|
|
1389
|
+
}),
|
|
1390
|
+
[colors]
|
|
1391
|
+
);
|
|
1392
|
+
return /* @__PURE__ */ jsx13(Skeleton, { ref, style: [styles12.text, colorStyles.text, style], ...props });
|
|
1393
|
+
}
|
|
1394
|
+
);
|
|
1395
|
+
SkeletonText.displayName = "SkeletonText";
|
|
1396
|
+
var SkeletonTitle = React12.forwardRef(
|
|
1397
|
+
({
|
|
1398
|
+
style,
|
|
1399
|
+
className,
|
|
1400
|
+
// Ignored in RN
|
|
1401
|
+
...props
|
|
1402
|
+
}, ref) => {
|
|
1403
|
+
const { colors } = useTheme();
|
|
1404
|
+
const colorStyles = useMemo13(
|
|
1405
|
+
() => ({
|
|
1406
|
+
title: { backgroundColor: colors.muted }
|
|
1407
|
+
}),
|
|
1408
|
+
[colors]
|
|
1409
|
+
);
|
|
1410
|
+
return /* @__PURE__ */ jsx13(Skeleton, { ref, style: [styles12.title, colorStyles.title, style], ...props });
|
|
1411
|
+
}
|
|
1412
|
+
);
|
|
1413
|
+
SkeletonTitle.displayName = "SkeletonTitle";
|
|
1414
|
+
var SkeletonAvatar = React12.forwardRef(
|
|
1415
|
+
({
|
|
1416
|
+
style,
|
|
1417
|
+
className,
|
|
1418
|
+
// Ignored in RN
|
|
1419
|
+
...props
|
|
1420
|
+
}, ref) => {
|
|
1421
|
+
const { colors } = useTheme();
|
|
1422
|
+
const colorStyles = useMemo13(
|
|
1423
|
+
() => ({
|
|
1424
|
+
avatar: { backgroundColor: colors.muted }
|
|
1425
|
+
}),
|
|
1426
|
+
[colors]
|
|
1427
|
+
);
|
|
1428
|
+
return /* @__PURE__ */ jsx13(Skeleton, { ref, style: [styles12.avatar, colorStyles.avatar, style], ...props });
|
|
1429
|
+
}
|
|
1430
|
+
);
|
|
1431
|
+
SkeletonAvatar.displayName = "SkeletonAvatar";
|
|
1432
|
+
var SkeletonCard = React12.forwardRef(
|
|
1433
|
+
({
|
|
1434
|
+
style,
|
|
1435
|
+
className,
|
|
1436
|
+
// Ignored in RN
|
|
1437
|
+
...props
|
|
1438
|
+
}, ref) => {
|
|
1439
|
+
const { colors } = useTheme();
|
|
1440
|
+
const colorStyles = useMemo13(
|
|
1441
|
+
() => ({
|
|
1442
|
+
card: {
|
|
1443
|
+
borderColor: colors.border,
|
|
1444
|
+
backgroundColor: colors.card
|
|
1445
|
+
},
|
|
1446
|
+
skeleton: { backgroundColor: colors.muted }
|
|
1447
|
+
}),
|
|
1448
|
+
[colors]
|
|
1449
|
+
);
|
|
1450
|
+
return /* @__PURE__ */ jsxs7(View11, { ref, style: [styles12.card, colorStyles.card, style], ...props, children: [
|
|
1451
|
+
/* @__PURE__ */ jsx13(Skeleton, { style: [styles12.cardTitle, colorStyles.skeleton] }),
|
|
1452
|
+
/* @__PURE__ */ jsx13(Skeleton, { style: [styles12.cardLine1, colorStyles.skeleton] }),
|
|
1453
|
+
/* @__PURE__ */ jsx13(Skeleton, { style: [styles12.cardLine2, colorStyles.skeleton] }),
|
|
1454
|
+
/* @__PURE__ */ jsxs7(View11, { style: styles12.cardBadges, children: [
|
|
1455
|
+
/* @__PURE__ */ jsx13(Skeleton, { style: [styles12.cardBadge, colorStyles.skeleton] }),
|
|
1456
|
+
/* @__PURE__ */ jsx13(Skeleton, { style: [styles12.cardBadge, colorStyles.skeleton] })
|
|
1457
|
+
] })
|
|
1458
|
+
] });
|
|
1459
|
+
}
|
|
1460
|
+
);
|
|
1461
|
+
SkeletonCard.displayName = "SkeletonCard";
|
|
1462
|
+
var styles12 = StyleSheet12.create({
|
|
1463
|
+
base: {
|
|
1464
|
+
borderRadius: 6
|
|
1465
|
+
},
|
|
1466
|
+
text: {
|
|
1467
|
+
height: 16,
|
|
1468
|
+
width: "75%",
|
|
1469
|
+
borderRadius: 6
|
|
1470
|
+
},
|
|
1471
|
+
title: {
|
|
1472
|
+
height: 24,
|
|
1473
|
+
width: "50%",
|
|
1474
|
+
borderRadius: 6
|
|
1475
|
+
},
|
|
1476
|
+
avatar: {
|
|
1477
|
+
height: 40,
|
|
1478
|
+
width: 40,
|
|
1479
|
+
borderRadius: 20
|
|
1480
|
+
},
|
|
1481
|
+
card: {
|
|
1482
|
+
gap: 12,
|
|
1483
|
+
borderRadius: 12,
|
|
1484
|
+
borderWidth: 1,
|
|
1485
|
+
padding: 16
|
|
1486
|
+
},
|
|
1487
|
+
cardTitle: {
|
|
1488
|
+
height: 20,
|
|
1489
|
+
width: "66%",
|
|
1490
|
+
borderRadius: 6
|
|
1491
|
+
},
|
|
1492
|
+
cardLine1: {
|
|
1493
|
+
height: 16,
|
|
1494
|
+
width: "100%",
|
|
1495
|
+
borderRadius: 6
|
|
1496
|
+
},
|
|
1497
|
+
cardLine2: {
|
|
1498
|
+
height: 16,
|
|
1499
|
+
width: "80%",
|
|
1500
|
+
borderRadius: 6
|
|
1501
|
+
},
|
|
1502
|
+
cardBadges: {
|
|
1503
|
+
flexDirection: "row",
|
|
1504
|
+
gap: 8,
|
|
1505
|
+
paddingTop: 8
|
|
1506
|
+
},
|
|
1507
|
+
cardBadge: {
|
|
1508
|
+
height: 24,
|
|
1509
|
+
width: 64,
|
|
1510
|
+
borderRadius: 12
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1513
|
+
|
|
1514
|
+
// src/components/Dialog.native.tsx
|
|
1515
|
+
import React13, { useMemo as useMemo14 } from "react";
|
|
1516
|
+
import {
|
|
1517
|
+
View as View12,
|
|
1518
|
+
Text as Text10,
|
|
1519
|
+
Modal as Modal2,
|
|
1520
|
+
Pressable as Pressable7,
|
|
1521
|
+
StyleSheet as StyleSheet13
|
|
1522
|
+
} from "react-native";
|
|
1523
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1524
|
+
function Dialog({
|
|
1525
|
+
open = false,
|
|
1526
|
+
onOpenChange,
|
|
1527
|
+
children,
|
|
1528
|
+
...props
|
|
1529
|
+
}) {
|
|
1530
|
+
const { colors } = useTheme();
|
|
1531
|
+
const colorStyles = useMemo14(
|
|
1532
|
+
() => ({
|
|
1533
|
+
content: { backgroundColor: colors.card }
|
|
1534
|
+
}),
|
|
1535
|
+
[colors]
|
|
1536
|
+
);
|
|
1537
|
+
return /* @__PURE__ */ jsx14(
|
|
1538
|
+
Modal2,
|
|
1539
|
+
{
|
|
1540
|
+
visible: open,
|
|
1541
|
+
transparent: true,
|
|
1542
|
+
animationType: "fade",
|
|
1543
|
+
onRequestClose: () => onOpenChange?.(false),
|
|
1544
|
+
...props,
|
|
1545
|
+
children: /* @__PURE__ */ jsx14(
|
|
1546
|
+
Pressable7,
|
|
1547
|
+
{
|
|
1548
|
+
style: styles13.backdrop,
|
|
1549
|
+
onPress: () => onOpenChange?.(false),
|
|
1550
|
+
children: /* @__PURE__ */ jsx14(
|
|
1551
|
+
Pressable7,
|
|
1552
|
+
{
|
|
1553
|
+
style: [styles13.content, colorStyles.content],
|
|
1554
|
+
onPress: (e) => e.stopPropagation(),
|
|
1555
|
+
children
|
|
1556
|
+
}
|
|
1557
|
+
)
|
|
1558
|
+
}
|
|
1559
|
+
)
|
|
1560
|
+
}
|
|
1561
|
+
);
|
|
1562
|
+
}
|
|
1563
|
+
Dialog.displayName = "Dialog";
|
|
1564
|
+
var DialogHeader = React13.forwardRef(
|
|
1565
|
+
({
|
|
1566
|
+
children,
|
|
1567
|
+
style,
|
|
1568
|
+
className,
|
|
1569
|
+
// Ignored in RN
|
|
1570
|
+
...props
|
|
1571
|
+
}, ref) => {
|
|
1572
|
+
const { colors } = useTheme();
|
|
1573
|
+
const colorStyles = useMemo14(
|
|
1574
|
+
() => ({
|
|
1575
|
+
header: { borderBottomColor: colors.border }
|
|
1576
|
+
}),
|
|
1577
|
+
[colors]
|
|
1578
|
+
);
|
|
1579
|
+
return /* @__PURE__ */ jsx14(View12, { ref, style: [styles13.header, colorStyles.header, style], ...props, children });
|
|
1580
|
+
}
|
|
1581
|
+
);
|
|
1582
|
+
DialogHeader.displayName = "DialogHeader";
|
|
1583
|
+
var DialogTitle = React13.forwardRef(
|
|
1584
|
+
({
|
|
1585
|
+
children,
|
|
1586
|
+
style,
|
|
1587
|
+
textStyle,
|
|
1588
|
+
className,
|
|
1589
|
+
// Ignored in RN
|
|
1590
|
+
...props
|
|
1591
|
+
}, ref) => {
|
|
1592
|
+
const { colors } = useTheme();
|
|
1593
|
+
const colorStyles = useMemo14(
|
|
1594
|
+
() => ({
|
|
1595
|
+
titleText: { color: colors.cardForeground }
|
|
1596
|
+
}),
|
|
1597
|
+
[colors]
|
|
1598
|
+
);
|
|
1599
|
+
return /* @__PURE__ */ jsx14(View12, { ref, style: [style], ...props, children: typeof children === "string" ? /* @__PURE__ */ jsx14(Text10, { style: [styles13.titleText, colorStyles.titleText, textStyle], children }) : children });
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1602
|
+
DialogTitle.displayName = "DialogTitle";
|
|
1603
|
+
var DialogDescription = React13.forwardRef(
|
|
1604
|
+
({
|
|
1605
|
+
children,
|
|
1606
|
+
style,
|
|
1607
|
+
textStyle,
|
|
1608
|
+
className,
|
|
1609
|
+
// Ignored in RN
|
|
1610
|
+
...props
|
|
1611
|
+
}, ref) => {
|
|
1612
|
+
const { colors } = useTheme();
|
|
1613
|
+
const colorStyles = useMemo14(
|
|
1614
|
+
() => ({
|
|
1615
|
+
descriptionText: { color: colors.mutedForeground }
|
|
1616
|
+
}),
|
|
1617
|
+
[colors]
|
|
1618
|
+
);
|
|
1619
|
+
return /* @__PURE__ */ jsx14(View12, { ref, style: [styles13.description, style], ...props, children: typeof children === "string" ? /* @__PURE__ */ jsx14(Text10, { style: [styles13.descriptionText, colorStyles.descriptionText, textStyle], children }) : children });
|
|
1620
|
+
}
|
|
1621
|
+
);
|
|
1622
|
+
DialogDescription.displayName = "DialogDescription";
|
|
1623
|
+
var DialogContent = React13.forwardRef(
|
|
1624
|
+
({
|
|
1625
|
+
children,
|
|
1626
|
+
style,
|
|
1627
|
+
className,
|
|
1628
|
+
// Ignored in RN
|
|
1629
|
+
...props
|
|
1630
|
+
}, ref) => {
|
|
1631
|
+
return /* @__PURE__ */ jsx14(View12, { ref, style: [styles13.body, style], ...props, children });
|
|
1632
|
+
}
|
|
1633
|
+
);
|
|
1634
|
+
DialogContent.displayName = "DialogContent";
|
|
1635
|
+
var DialogFooter = React13.forwardRef(
|
|
1636
|
+
({
|
|
1637
|
+
children,
|
|
1638
|
+
style,
|
|
1639
|
+
className,
|
|
1640
|
+
// Ignored in RN
|
|
1641
|
+
...props
|
|
1642
|
+
}, ref) => {
|
|
1643
|
+
const { colors } = useTheme();
|
|
1644
|
+
const colorStyles = useMemo14(
|
|
1645
|
+
() => ({
|
|
1646
|
+
footer: { borderTopColor: colors.border }
|
|
1647
|
+
}),
|
|
1648
|
+
[colors]
|
|
1649
|
+
);
|
|
1650
|
+
return /* @__PURE__ */ jsx14(View12, { ref, style: [styles13.footer, colorStyles.footer, style], ...props, children });
|
|
1651
|
+
}
|
|
1652
|
+
);
|
|
1653
|
+
DialogFooter.displayName = "DialogFooter";
|
|
1654
|
+
var DialogClose = React13.forwardRef(
|
|
1655
|
+
({
|
|
1656
|
+
children,
|
|
1657
|
+
onClose,
|
|
1658
|
+
className
|
|
1659
|
+
// Ignored in RN
|
|
1660
|
+
}, ref) => {
|
|
1661
|
+
return /* @__PURE__ */ jsx14(Pressable7, { ref, onPress: onClose, children });
|
|
1662
|
+
}
|
|
1663
|
+
);
|
|
1664
|
+
DialogClose.displayName = "DialogClose";
|
|
1665
|
+
var styles13 = StyleSheet13.create({
|
|
1666
|
+
backdrop: {
|
|
1667
|
+
flex: 1,
|
|
1668
|
+
alignItems: "center",
|
|
1669
|
+
justifyContent: "center",
|
|
1670
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
1671
|
+
padding: 16
|
|
1672
|
+
},
|
|
1673
|
+
content: {
|
|
1674
|
+
width: "100%",
|
|
1675
|
+
maxWidth: 512,
|
|
1676
|
+
borderRadius: 12,
|
|
1677
|
+
maxHeight: "85%",
|
|
1678
|
+
overflow: "hidden"
|
|
1679
|
+
},
|
|
1680
|
+
header: {
|
|
1681
|
+
padding: 16,
|
|
1682
|
+
borderBottomWidth: 1
|
|
1683
|
+
},
|
|
1684
|
+
titleText: {
|
|
1685
|
+
fontSize: 18,
|
|
1686
|
+
fontWeight: "600"
|
|
1687
|
+
},
|
|
1688
|
+
description: {
|
|
1689
|
+
marginTop: 4
|
|
1690
|
+
},
|
|
1691
|
+
descriptionText: {
|
|
1692
|
+
fontSize: 14
|
|
1693
|
+
},
|
|
1694
|
+
body: {
|
|
1695
|
+
padding: 16
|
|
1696
|
+
},
|
|
1697
|
+
footer: {
|
|
1698
|
+
flexDirection: "row",
|
|
1699
|
+
justifyContent: "flex-end",
|
|
1700
|
+
gap: 8,
|
|
1701
|
+
padding: 16,
|
|
1702
|
+
borderTopWidth: 1
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
|
|
1706
|
+
// src/components/Progress.native.tsx
|
|
1707
|
+
import React14, { useEffect as useEffect3, useRef } from "react";
|
|
1708
|
+
import {
|
|
1709
|
+
View as View13,
|
|
1710
|
+
Animated as Animated3,
|
|
1711
|
+
StyleSheet as StyleSheet14
|
|
1712
|
+
} from "react-native";
|
|
1713
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1714
|
+
var Progress = React14.forwardRef(
|
|
1715
|
+
({ value = 0, style, className }, ref) => {
|
|
1716
|
+
const { colors } = useTheme();
|
|
1717
|
+
const animatedWidth = useRef(new Animated3.Value(value)).current;
|
|
1718
|
+
useEffect3(() => {
|
|
1719
|
+
Animated3.timing(animatedWidth, {
|
|
1720
|
+
toValue: value,
|
|
1721
|
+
duration: 200,
|
|
1722
|
+
useNativeDriver: false
|
|
1723
|
+
}).start();
|
|
1724
|
+
}, [value, animatedWidth]);
|
|
1725
|
+
return /* @__PURE__ */ jsx15(
|
|
1726
|
+
View13,
|
|
1727
|
+
{
|
|
1728
|
+
ref,
|
|
1729
|
+
style: [
|
|
1730
|
+
styles14.track,
|
|
1731
|
+
{ backgroundColor: colors.secondary },
|
|
1732
|
+
style
|
|
1733
|
+
],
|
|
1734
|
+
children: /* @__PURE__ */ jsx15(
|
|
1735
|
+
Animated3.View,
|
|
1736
|
+
{
|
|
1737
|
+
style: [
|
|
1738
|
+
styles14.indicator,
|
|
1739
|
+
{
|
|
1740
|
+
backgroundColor: colors.primary,
|
|
1741
|
+
width: animatedWidth.interpolate({
|
|
1742
|
+
inputRange: [0, 100],
|
|
1743
|
+
outputRange: ["0%", "100%"],
|
|
1744
|
+
extrapolate: "clamp"
|
|
1745
|
+
})
|
|
1746
|
+
}
|
|
1747
|
+
]
|
|
1748
|
+
}
|
|
1749
|
+
)
|
|
1750
|
+
}
|
|
1751
|
+
);
|
|
1752
|
+
}
|
|
1753
|
+
);
|
|
1754
|
+
Progress.displayName = "Progress";
|
|
1755
|
+
var styles14 = StyleSheet14.create({
|
|
1756
|
+
track: {
|
|
1757
|
+
height: 16,
|
|
1758
|
+
width: "100%",
|
|
1759
|
+
overflow: "hidden",
|
|
1760
|
+
borderRadius: 9999
|
|
1761
|
+
// rounded-full
|
|
1762
|
+
},
|
|
1763
|
+
indicator: {
|
|
1764
|
+
height: "100%"
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
|
|
1768
|
+
// src/components/Tabs.native.tsx
|
|
1769
|
+
import React15, { createContext as createContext2, useContext as useContext2, useMemo as useMemo15 } from "react";
|
|
1770
|
+
import {
|
|
1771
|
+
View as View14,
|
|
1772
|
+
Text as Text11,
|
|
1773
|
+
Pressable as Pressable8,
|
|
1774
|
+
StyleSheet as StyleSheet15
|
|
1775
|
+
} from "react-native";
|
|
1776
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1777
|
+
var TabsContext = createContext2(null);
|
|
1778
|
+
function useTabsContext() {
|
|
1779
|
+
const context = useContext2(TabsContext);
|
|
1780
|
+
if (!context) {
|
|
1781
|
+
throw new Error("Tabs components must be used within a Tabs provider");
|
|
1782
|
+
}
|
|
1783
|
+
return context;
|
|
1784
|
+
}
|
|
1785
|
+
var Tabs = React15.forwardRef(
|
|
1786
|
+
({ value, onValueChange, children, style, className, defaultValue }, ref) => {
|
|
1787
|
+
const contextValue = useMemo15(
|
|
1788
|
+
() => ({ value, onValueChange }),
|
|
1789
|
+
[value, onValueChange]
|
|
1790
|
+
);
|
|
1791
|
+
return /* @__PURE__ */ jsx16(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx16(View14, { ref, style, children }) });
|
|
1792
|
+
}
|
|
1793
|
+
);
|
|
1794
|
+
Tabs.displayName = "Tabs";
|
|
1795
|
+
var TabsList = React15.forwardRef(
|
|
1796
|
+
({ children, style, className }, ref) => {
|
|
1797
|
+
const { colors } = useTheme();
|
|
1798
|
+
return /* @__PURE__ */ jsx16(
|
|
1799
|
+
View14,
|
|
1800
|
+
{
|
|
1801
|
+
ref,
|
|
1802
|
+
style: [
|
|
1803
|
+
styles15.list,
|
|
1804
|
+
{ backgroundColor: colors.muted },
|
|
1805
|
+
style
|
|
1806
|
+
],
|
|
1807
|
+
children
|
|
1808
|
+
}
|
|
1809
|
+
);
|
|
1810
|
+
}
|
|
1811
|
+
);
|
|
1812
|
+
TabsList.displayName = "TabsList";
|
|
1813
|
+
var TabsTrigger = React15.forwardRef(
|
|
1814
|
+
({ value, children, disabled, style, textStyle, className }, ref) => {
|
|
1815
|
+
const { colors } = useTheme();
|
|
1816
|
+
const { value: activeValue, onValueChange } = useTabsContext();
|
|
1817
|
+
const isActive = activeValue === value;
|
|
1818
|
+
return /* @__PURE__ */ jsx16(
|
|
1819
|
+
Pressable8,
|
|
1820
|
+
{
|
|
1821
|
+
ref,
|
|
1822
|
+
disabled,
|
|
1823
|
+
onPress: () => onValueChange(value),
|
|
1824
|
+
style: ({ pressed }) => [
|
|
1825
|
+
styles15.trigger,
|
|
1826
|
+
isActive && [styles15.triggerActive, { backgroundColor: colors.background }],
|
|
1827
|
+
pressed && styles15.pressed,
|
|
1828
|
+
disabled && styles15.disabled,
|
|
1829
|
+
style
|
|
1830
|
+
],
|
|
1831
|
+
children: typeof children === "string" ? /* @__PURE__ */ jsx16(
|
|
1832
|
+
Text11,
|
|
1833
|
+
{
|
|
1834
|
+
style: [
|
|
1835
|
+
styles15.triggerText,
|
|
1836
|
+
{ color: colors.mutedForeground },
|
|
1837
|
+
isActive && { color: colors.foreground },
|
|
1838
|
+
textStyle
|
|
1839
|
+
],
|
|
1840
|
+
children
|
|
1841
|
+
}
|
|
1842
|
+
) : children
|
|
1843
|
+
}
|
|
1844
|
+
);
|
|
1845
|
+
}
|
|
1846
|
+
);
|
|
1847
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
1848
|
+
var TabsContent = React15.forwardRef(
|
|
1849
|
+
({ value, children, style, className }, ref) => {
|
|
1850
|
+
const { value: activeValue } = useTabsContext();
|
|
1851
|
+
if (activeValue !== value) {
|
|
1852
|
+
return null;
|
|
1853
|
+
}
|
|
1854
|
+
return /* @__PURE__ */ jsx16(View14, { ref, style: [styles15.content, style], children });
|
|
1855
|
+
}
|
|
1856
|
+
);
|
|
1857
|
+
TabsContent.displayName = "TabsContent";
|
|
1858
|
+
var styles15 = StyleSheet15.create({
|
|
1859
|
+
list: {
|
|
1860
|
+
flexDirection: "row",
|
|
1861
|
+
alignItems: "center",
|
|
1862
|
+
justifyContent: "center",
|
|
1863
|
+
borderRadius: 8,
|
|
1864
|
+
padding: 4,
|
|
1865
|
+
gap: 4
|
|
1866
|
+
},
|
|
1867
|
+
trigger: {
|
|
1868
|
+
flex: 1,
|
|
1869
|
+
alignItems: "center",
|
|
1870
|
+
justifyContent: "center",
|
|
1871
|
+
paddingHorizontal: 12,
|
|
1872
|
+
paddingVertical: 6,
|
|
1873
|
+
borderRadius: 6
|
|
1874
|
+
},
|
|
1875
|
+
triggerActive: {
|
|
1876
|
+
shadowColor: "#000",
|
|
1877
|
+
shadowOffset: { width: 0, height: 1 },
|
|
1878
|
+
shadowOpacity: 0.1,
|
|
1879
|
+
shadowRadius: 2,
|
|
1880
|
+
elevation: 2
|
|
1881
|
+
},
|
|
1882
|
+
triggerText: {
|
|
1883
|
+
fontSize: 14,
|
|
1884
|
+
fontWeight: "500"
|
|
1885
|
+
},
|
|
1886
|
+
pressed: {
|
|
1887
|
+
opacity: 0.8
|
|
1888
|
+
},
|
|
1889
|
+
disabled: {
|
|
1890
|
+
opacity: 0.5
|
|
1891
|
+
},
|
|
1892
|
+
content: {
|
|
1893
|
+
marginTop: 8
|
|
1894
|
+
}
|
|
1895
|
+
});
|
|
1896
|
+
|
|
1897
|
+
// src/components/Accordion.native.tsx
|
|
1898
|
+
import React16, {
|
|
1899
|
+
createContext as createContext3,
|
|
1900
|
+
useContext as useContext3,
|
|
1901
|
+
useMemo as useMemo16,
|
|
1902
|
+
useRef as useRef2,
|
|
1903
|
+
useEffect as useEffect4,
|
|
1904
|
+
useState as useState3
|
|
1905
|
+
} from "react";
|
|
1906
|
+
import {
|
|
1907
|
+
View as View15,
|
|
1908
|
+
Text as Text12,
|
|
1909
|
+
Pressable as Pressable9,
|
|
1910
|
+
Animated as Animated4,
|
|
1911
|
+
StyleSheet as StyleSheet16,
|
|
1912
|
+
LayoutAnimation,
|
|
1913
|
+
Platform,
|
|
1914
|
+
UIManager
|
|
1915
|
+
} from "react-native";
|
|
1916
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1917
|
+
if (Platform.OS === "android" && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
1918
|
+
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
1919
|
+
}
|
|
1920
|
+
var AccordionContext = createContext3(null);
|
|
1921
|
+
function useAccordionContext() {
|
|
1922
|
+
const context = useContext3(AccordionContext);
|
|
1923
|
+
if (!context) {
|
|
1924
|
+
throw new Error("Accordion components must be used within an Accordion provider");
|
|
1925
|
+
}
|
|
1926
|
+
return context;
|
|
1927
|
+
}
|
|
1928
|
+
var AccordionItemContext = createContext3(null);
|
|
1929
|
+
function useAccordionItemContext() {
|
|
1930
|
+
const context = useContext3(AccordionItemContext);
|
|
1931
|
+
if (!context) {
|
|
1932
|
+
throw new Error("AccordionItem components must be used within an AccordionItem");
|
|
1933
|
+
}
|
|
1934
|
+
return context;
|
|
1935
|
+
}
|
|
1936
|
+
var Accordion = React16.forwardRef(
|
|
1937
|
+
({
|
|
1938
|
+
type = "single",
|
|
1939
|
+
value,
|
|
1940
|
+
defaultValue,
|
|
1941
|
+
onValueChange,
|
|
1942
|
+
collapsible = false,
|
|
1943
|
+
children,
|
|
1944
|
+
style,
|
|
1945
|
+
className
|
|
1946
|
+
}, ref) => {
|
|
1947
|
+
const [internalValue, setInternalValue] = useState3(() => {
|
|
1948
|
+
if (value !== void 0) {
|
|
1949
|
+
return Array.isArray(value) ? value : value ? [value] : [];
|
|
1950
|
+
}
|
|
1951
|
+
if (defaultValue !== void 0) {
|
|
1952
|
+
return Array.isArray(defaultValue) ? defaultValue : defaultValue ? [defaultValue] : [];
|
|
1953
|
+
}
|
|
1954
|
+
return [];
|
|
1955
|
+
});
|
|
1956
|
+
const expandedItems = value !== void 0 ? Array.isArray(value) ? value : value ? [value] : [] : internalValue;
|
|
1957
|
+
const toggleItem = (itemValue) => {
|
|
1958
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
1959
|
+
let newItems;
|
|
1960
|
+
if (type === "single") {
|
|
1961
|
+
if (expandedItems.includes(itemValue)) {
|
|
1962
|
+
newItems = collapsible ? [] : [itemValue];
|
|
1963
|
+
} else {
|
|
1964
|
+
newItems = [itemValue];
|
|
1965
|
+
}
|
|
1966
|
+
} else {
|
|
1967
|
+
if (expandedItems.includes(itemValue)) {
|
|
1968
|
+
newItems = expandedItems.filter((v) => v !== itemValue);
|
|
1969
|
+
} else {
|
|
1970
|
+
newItems = [...expandedItems, itemValue];
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
if (value === void 0) {
|
|
1974
|
+
setInternalValue(newItems);
|
|
1975
|
+
}
|
|
1976
|
+
if (onValueChange) {
|
|
1977
|
+
onValueChange(type === "single" ? newItems[0] || "" : newItems);
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
const contextValue = useMemo16(
|
|
1981
|
+
() => ({ type, expandedItems, toggleItem, collapsible }),
|
|
1982
|
+
[type, expandedItems, collapsible]
|
|
1983
|
+
);
|
|
1984
|
+
return /* @__PURE__ */ jsx17(AccordionContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx17(View15, { ref, style, children }) });
|
|
1985
|
+
}
|
|
1986
|
+
);
|
|
1987
|
+
Accordion.displayName = "Accordion";
|
|
1988
|
+
var AccordionItem = React16.forwardRef(
|
|
1989
|
+
({ value, children, style, className }, ref) => {
|
|
1990
|
+
const { colors } = useTheme();
|
|
1991
|
+
const { expandedItems } = useAccordionContext();
|
|
1992
|
+
const isExpanded = expandedItems.includes(value);
|
|
1993
|
+
const contextValue = useMemo16(
|
|
1994
|
+
() => ({ value, isExpanded }),
|
|
1995
|
+
[value, isExpanded]
|
|
1996
|
+
);
|
|
1997
|
+
return /* @__PURE__ */ jsx17(AccordionItemContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx17(
|
|
1998
|
+
View15,
|
|
1999
|
+
{
|
|
2000
|
+
ref,
|
|
2001
|
+
style: [
|
|
2002
|
+
styles16.item,
|
|
2003
|
+
{ borderBottomColor: colors.border },
|
|
2004
|
+
style
|
|
2005
|
+
],
|
|
2006
|
+
children
|
|
2007
|
+
}
|
|
2008
|
+
) });
|
|
2009
|
+
}
|
|
2010
|
+
);
|
|
2011
|
+
AccordionItem.displayName = "AccordionItem";
|
|
2012
|
+
var AccordionTrigger = React16.forwardRef(
|
|
2013
|
+
({ children, style, textStyle, className }, ref) => {
|
|
2014
|
+
const { colors } = useTheme();
|
|
2015
|
+
const { toggleItem } = useAccordionContext();
|
|
2016
|
+
const { value, isExpanded } = useAccordionItemContext();
|
|
2017
|
+
const rotateAnim = useRef2(new Animated4.Value(isExpanded ? 1 : 0)).current;
|
|
2018
|
+
useEffect4(() => {
|
|
2019
|
+
Animated4.timing(rotateAnim, {
|
|
2020
|
+
toValue: isExpanded ? 1 : 0,
|
|
2021
|
+
duration: 200,
|
|
2022
|
+
useNativeDriver: true
|
|
2023
|
+
}).start();
|
|
2024
|
+
}, [isExpanded, rotateAnim]);
|
|
2025
|
+
const rotation = rotateAnim.interpolate({
|
|
2026
|
+
inputRange: [0, 1],
|
|
2027
|
+
outputRange: ["0deg", "180deg"]
|
|
2028
|
+
});
|
|
2029
|
+
return /* @__PURE__ */ jsxs8(
|
|
2030
|
+
Pressable9,
|
|
2031
|
+
{
|
|
2032
|
+
ref,
|
|
2033
|
+
onPress: () => toggleItem(value),
|
|
2034
|
+
style: ({ pressed }) => [
|
|
2035
|
+
styles16.trigger,
|
|
2036
|
+
pressed && styles16.pressed,
|
|
2037
|
+
style
|
|
2038
|
+
],
|
|
2039
|
+
children: [
|
|
2040
|
+
typeof children === "string" ? /* @__PURE__ */ jsx17(Text12, { style: [styles16.triggerText, { color: colors.foreground }, textStyle], children }) : /* @__PURE__ */ jsx17(View15, { style: styles16.triggerContent, children }),
|
|
2041
|
+
/* @__PURE__ */ jsx17(Animated4.View, { style: { transform: [{ rotate: rotation }] }, children: /* @__PURE__ */ jsx17(ChevronIcon, { color: colors.mutedForeground }) })
|
|
2042
|
+
]
|
|
2043
|
+
}
|
|
2044
|
+
);
|
|
2045
|
+
}
|
|
2046
|
+
);
|
|
2047
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
2048
|
+
var AccordionContent = React16.forwardRef(
|
|
2049
|
+
({ children, style, className }, ref) => {
|
|
2050
|
+
const { isExpanded } = useAccordionItemContext();
|
|
2051
|
+
if (!isExpanded) {
|
|
2052
|
+
return null;
|
|
2053
|
+
}
|
|
2054
|
+
return /* @__PURE__ */ jsx17(View15, { ref, style: [styles16.content, style], children });
|
|
2055
|
+
}
|
|
2056
|
+
);
|
|
2057
|
+
AccordionContent.displayName = "AccordionContent";
|
|
2058
|
+
function ChevronIcon({ color = "#666", size = 16 }) {
|
|
2059
|
+
return /* @__PURE__ */ jsx17(View15, { style: { width: size, height: size, justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx17(
|
|
2060
|
+
View15,
|
|
2061
|
+
{
|
|
2062
|
+
style: {
|
|
2063
|
+
width: size * 0.5,
|
|
2064
|
+
height: size * 0.5,
|
|
2065
|
+
borderRightWidth: 2,
|
|
2066
|
+
borderBottomWidth: 2,
|
|
2067
|
+
borderColor: color,
|
|
2068
|
+
transform: [{ rotate: "45deg" }, { translateY: -2 }]
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
) });
|
|
2072
|
+
}
|
|
2073
|
+
var styles16 = StyleSheet16.create({
|
|
2074
|
+
item: {
|
|
2075
|
+
borderBottomWidth: 1
|
|
2076
|
+
},
|
|
2077
|
+
trigger: {
|
|
2078
|
+
flexDirection: "row",
|
|
2079
|
+
alignItems: "center",
|
|
2080
|
+
justifyContent: "space-between",
|
|
2081
|
+
paddingVertical: 16
|
|
2082
|
+
},
|
|
2083
|
+
triggerContent: {
|
|
2084
|
+
flex: 1
|
|
2085
|
+
},
|
|
2086
|
+
triggerText: {
|
|
2087
|
+
flex: 1,
|
|
2088
|
+
fontSize: 14,
|
|
2089
|
+
fontWeight: "500"
|
|
2090
|
+
},
|
|
2091
|
+
pressed: {
|
|
2092
|
+
opacity: 0.7
|
|
2093
|
+
},
|
|
2094
|
+
content: {
|
|
2095
|
+
paddingBottom: 16
|
|
2096
|
+
}
|
|
2097
|
+
});
|
|
2098
|
+
|
|
2099
|
+
// src/components/Slider.native.tsx
|
|
2100
|
+
import React17, { useRef as useRef3, useState as useState4, useCallback, useEffect as useEffect5 } from "react";
|
|
2101
|
+
import {
|
|
2102
|
+
View as View16,
|
|
2103
|
+
Animated as Animated5,
|
|
2104
|
+
PanResponder,
|
|
2105
|
+
StyleSheet as StyleSheet17
|
|
2106
|
+
} from "react-native";
|
|
2107
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2108
|
+
var Slider = React17.forwardRef(
|
|
2109
|
+
({
|
|
2110
|
+
value: controlledValue,
|
|
2111
|
+
defaultValue = [0],
|
|
2112
|
+
onValueChange,
|
|
2113
|
+
onValueCommit,
|
|
2114
|
+
min = 0,
|
|
2115
|
+
max = 100,
|
|
2116
|
+
step = 1,
|
|
2117
|
+
disabled = false,
|
|
2118
|
+
style
|
|
2119
|
+
}, ref) => {
|
|
2120
|
+
const { colors } = useTheme();
|
|
2121
|
+
const [trackWidth, setTrackWidth] = useState4(0);
|
|
2122
|
+
const isControlled = controlledValue !== void 0;
|
|
2123
|
+
const [internalValue, setInternalValue] = useState4(defaultValue[0]);
|
|
2124
|
+
const currentValue = isControlled ? controlledValue[0] ?? 0 : internalValue;
|
|
2125
|
+
const pan = useRef3(new Animated5.Value(0)).current;
|
|
2126
|
+
const stateRef = useRef3({
|
|
2127
|
+
trackWidth: 0,
|
|
2128
|
+
currentValue: 0,
|
|
2129
|
+
isControlled: false,
|
|
2130
|
+
disabled: false,
|
|
2131
|
+
min: 0,
|
|
2132
|
+
max: 100,
|
|
2133
|
+
step: 1,
|
|
2134
|
+
onValueChange: void 0,
|
|
2135
|
+
onValueCommit: void 0,
|
|
2136
|
+
setInternalValue: (() => {
|
|
2137
|
+
})
|
|
2138
|
+
});
|
|
2139
|
+
const startPosition = useRef3(0);
|
|
2140
|
+
useEffect5(() => {
|
|
2141
|
+
stateRef.current = {
|
|
2142
|
+
trackWidth,
|
|
2143
|
+
currentValue,
|
|
2144
|
+
isControlled,
|
|
2145
|
+
disabled,
|
|
2146
|
+
min,
|
|
2147
|
+
max,
|
|
2148
|
+
step,
|
|
2149
|
+
onValueChange,
|
|
2150
|
+
onValueCommit,
|
|
2151
|
+
setInternalValue
|
|
2152
|
+
};
|
|
2153
|
+
});
|
|
2154
|
+
const valueToPosition = useCallback(
|
|
2155
|
+
(val, width = trackWidth) => {
|
|
2156
|
+
if (width === 0) return 0;
|
|
2157
|
+
const percentage = (val - min) / (max - min);
|
|
2158
|
+
return percentage * width;
|
|
2159
|
+
},
|
|
2160
|
+
[trackWidth, min, max]
|
|
2161
|
+
);
|
|
2162
|
+
const positionToValueRef = (pos) => {
|
|
2163
|
+
const { trackWidth: w, min: minVal, max: maxVal, step: stepVal } = stateRef.current;
|
|
2164
|
+
if (w === 0) return minVal;
|
|
2165
|
+
const percentage = Math.max(0, Math.min(1, pos / w));
|
|
2166
|
+
let val = minVal + percentage * (maxVal - minVal);
|
|
2167
|
+
val = Math.round(val / stepVal) * stepVal;
|
|
2168
|
+
return Math.max(minVal, Math.min(maxVal, val));
|
|
2169
|
+
};
|
|
2170
|
+
const valueToPositionRef = (val) => {
|
|
2171
|
+
const { trackWidth: w, min: minVal, max: maxVal } = stateRef.current;
|
|
2172
|
+
if (w === 0) return 0;
|
|
2173
|
+
const percentage = (val - minVal) / (maxVal - minVal);
|
|
2174
|
+
return percentage * w;
|
|
2175
|
+
};
|
|
2176
|
+
useEffect5(() => {
|
|
2177
|
+
const position = valueToPosition(currentValue);
|
|
2178
|
+
pan.setValue(position);
|
|
2179
|
+
}, [currentValue, valueToPosition, pan]);
|
|
2180
|
+
const panResponder = useRef3(
|
|
2181
|
+
PanResponder.create({
|
|
2182
|
+
onStartShouldSetPanResponder: () => !stateRef.current.disabled,
|
|
2183
|
+
onMoveShouldSetPanResponder: () => !stateRef.current.disabled,
|
|
2184
|
+
onPanResponderGrant: () => {
|
|
2185
|
+
pan.stopAnimation();
|
|
2186
|
+
startPosition.current = valueToPositionRef(stateRef.current.currentValue);
|
|
2187
|
+
},
|
|
2188
|
+
onPanResponderMove: (_, gestureState) => {
|
|
2189
|
+
const { trackWidth: w, isControlled: controlled, onValueChange: onChange, setInternalValue: setVal } = stateRef.current;
|
|
2190
|
+
const newPosition = Math.max(
|
|
2191
|
+
0,
|
|
2192
|
+
Math.min(w, startPosition.current + gestureState.dx)
|
|
2193
|
+
);
|
|
2194
|
+
pan.setValue(newPosition);
|
|
2195
|
+
const newValue = positionToValueRef(newPosition);
|
|
2196
|
+
if (!controlled) {
|
|
2197
|
+
setVal(newValue);
|
|
2198
|
+
}
|
|
2199
|
+
onChange?.([newValue]);
|
|
2200
|
+
},
|
|
2201
|
+
onPanResponderRelease: () => {
|
|
2202
|
+
const { onValueCommit: onCommit } = stateRef.current;
|
|
2203
|
+
const newValue = positionToValueRef(pan._value);
|
|
2204
|
+
onCommit?.([newValue]);
|
|
2205
|
+
}
|
|
2206
|
+
})
|
|
2207
|
+
).current;
|
|
2208
|
+
const handleTrackLayout = (event) => {
|
|
2209
|
+
const { width } = event.nativeEvent.layout;
|
|
2210
|
+
setTrackWidth(width - 16);
|
|
2211
|
+
};
|
|
2212
|
+
const handleTrackPress = (event) => {
|
|
2213
|
+
if (disabled) return;
|
|
2214
|
+
const { locationX } = event.nativeEvent;
|
|
2215
|
+
const positionToValue = (pos) => {
|
|
2216
|
+
if (trackWidth === 0) return min;
|
|
2217
|
+
const percentage = Math.max(0, Math.min(1, pos / trackWidth));
|
|
2218
|
+
let val = min + percentage * (max - min);
|
|
2219
|
+
val = Math.round(val / step) * step;
|
|
2220
|
+
return Math.max(min, Math.min(max, val));
|
|
2221
|
+
};
|
|
2222
|
+
const newValue = positionToValue(locationX - 8);
|
|
2223
|
+
if (!isControlled) {
|
|
2224
|
+
setInternalValue(newValue);
|
|
2225
|
+
}
|
|
2226
|
+
onValueChange?.([newValue]);
|
|
2227
|
+
onValueCommit?.([newValue]);
|
|
2228
|
+
Animated5.spring(pan, {
|
|
2229
|
+
toValue: valueToPosition(newValue),
|
|
2230
|
+
useNativeDriver: false,
|
|
2231
|
+
friction: 7
|
|
2232
|
+
}).start();
|
|
2233
|
+
};
|
|
2234
|
+
const fillPercentage = (currentValue - min) / (max - min) * 100;
|
|
2235
|
+
return /* @__PURE__ */ jsxs9(
|
|
2236
|
+
View16,
|
|
2237
|
+
{
|
|
2238
|
+
ref,
|
|
2239
|
+
style: [styles17.container, style],
|
|
2240
|
+
onLayout: handleTrackLayout,
|
|
2241
|
+
onStartShouldSetResponder: () => !disabled,
|
|
2242
|
+
onResponderRelease: handleTrackPress,
|
|
2243
|
+
children: [
|
|
2244
|
+
/* @__PURE__ */ jsx18(
|
|
2245
|
+
View16,
|
|
2246
|
+
{
|
|
2247
|
+
style: [
|
|
2248
|
+
styles17.track,
|
|
2249
|
+
{ backgroundColor: colors.secondary },
|
|
2250
|
+
disabled && styles17.trackDisabled
|
|
2251
|
+
],
|
|
2252
|
+
children: /* @__PURE__ */ jsx18(
|
|
2253
|
+
View16,
|
|
2254
|
+
{
|
|
2255
|
+
style: [
|
|
2256
|
+
styles17.range,
|
|
2257
|
+
{
|
|
2258
|
+
backgroundColor: disabled ? colors.muted : colors.primary,
|
|
2259
|
+
width: `${fillPercentage}%`
|
|
2260
|
+
}
|
|
2261
|
+
]
|
|
2262
|
+
}
|
|
2263
|
+
)
|
|
2264
|
+
}
|
|
2265
|
+
),
|
|
2266
|
+
/* @__PURE__ */ jsx18(
|
|
2267
|
+
Animated5.View,
|
|
2268
|
+
{
|
|
2269
|
+
...panResponder.panHandlers,
|
|
2270
|
+
style: [
|
|
2271
|
+
styles17.thumb,
|
|
2272
|
+
{
|
|
2273
|
+
backgroundColor: colors.background,
|
|
2274
|
+
borderColor: disabled ? colors.muted : colors.primary,
|
|
2275
|
+
transform: [{ translateX: pan }]
|
|
2276
|
+
},
|
|
2277
|
+
disabled && styles17.thumbDisabled
|
|
2278
|
+
]
|
|
2279
|
+
}
|
|
2280
|
+
)
|
|
2281
|
+
]
|
|
2282
|
+
}
|
|
2283
|
+
);
|
|
2284
|
+
}
|
|
2285
|
+
);
|
|
2286
|
+
Slider.displayName = "Slider";
|
|
2287
|
+
var styles17 = StyleSheet17.create({
|
|
2288
|
+
container: {
|
|
2289
|
+
height: 20,
|
|
2290
|
+
justifyContent: "center",
|
|
2291
|
+
position: "relative"
|
|
2292
|
+
},
|
|
2293
|
+
track: {
|
|
2294
|
+
height: 6,
|
|
2295
|
+
borderRadius: 3,
|
|
2296
|
+
width: "100%",
|
|
2297
|
+
overflow: "hidden"
|
|
2298
|
+
},
|
|
2299
|
+
trackDisabled: {
|
|
2300
|
+
opacity: 0.5
|
|
2301
|
+
},
|
|
2302
|
+
range: {
|
|
2303
|
+
height: "100%",
|
|
2304
|
+
borderRadius: 3
|
|
2305
|
+
},
|
|
2306
|
+
thumb: {
|
|
2307
|
+
position: "absolute",
|
|
2308
|
+
width: 16,
|
|
2309
|
+
height: 16,
|
|
2310
|
+
borderRadius: 8,
|
|
2311
|
+
borderWidth: 2,
|
|
2312
|
+
shadowColor: "#000",
|
|
2313
|
+
shadowOffset: { width: 0, height: 1 },
|
|
2314
|
+
shadowOpacity: 0.2,
|
|
2315
|
+
shadowRadius: 1,
|
|
2316
|
+
elevation: 2
|
|
2317
|
+
},
|
|
2318
|
+
thumbDisabled: {
|
|
2319
|
+
opacity: 0.5
|
|
2320
|
+
}
|
|
2321
|
+
});
|
|
2322
|
+
export {
|
|
2323
|
+
Accordion,
|
|
2324
|
+
AccordionContent,
|
|
2325
|
+
AccordionItem,
|
|
2326
|
+
AccordionTrigger,
|
|
2327
|
+
Avatar,
|
|
2328
|
+
AvatarFallback,
|
|
2329
|
+
AvatarImage,
|
|
2330
|
+
Badge,
|
|
2331
|
+
Button,
|
|
2332
|
+
Card,
|
|
2333
|
+
CardContent,
|
|
2334
|
+
CardDescription,
|
|
2335
|
+
CardFooter,
|
|
2336
|
+
CardHeader,
|
|
2337
|
+
CardTitle,
|
|
2338
|
+
Checkbox,
|
|
2339
|
+
Dialog,
|
|
2340
|
+
DialogClose,
|
|
2341
|
+
DialogContent,
|
|
2342
|
+
DialogDescription,
|
|
2343
|
+
DialogFooter,
|
|
2344
|
+
DialogHeader,
|
|
2345
|
+
DialogTitle,
|
|
2346
|
+
Input,
|
|
2347
|
+
Label,
|
|
2348
|
+
PressableBadge,
|
|
2349
|
+
PressableCard,
|
|
2350
|
+
Progress,
|
|
2351
|
+
Select,
|
|
2352
|
+
Separator,
|
|
2353
|
+
Skeleton,
|
|
2354
|
+
SkeletonAvatar,
|
|
2355
|
+
SkeletonCard,
|
|
2356
|
+
SkeletonText,
|
|
2357
|
+
SkeletonTitle,
|
|
2358
|
+
Slider,
|
|
2359
|
+
Switch,
|
|
2360
|
+
Tabs,
|
|
2361
|
+
TabsContent,
|
|
2362
|
+
TabsList,
|
|
2363
|
+
TabsTrigger,
|
|
2364
|
+
Textarea,
|
|
2365
|
+
ThemeProvider,
|
|
2366
|
+
buttonVariants,
|
|
2367
|
+
defaultColors,
|
|
2368
|
+
getInitials,
|
|
2369
|
+
useTheme
|
|
2370
|
+
};
|
|
2371
|
+
//# sourceMappingURL=index.native.js.map
|