@xaui/native 0.0.21 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +195 -2
  2. package/dist/alert/index.js +1 -2
  3. package/dist/app-bar/index.cjs +217 -0
  4. package/dist/app-bar/index.d.cts +52 -0
  5. package/dist/app-bar/index.d.ts +52 -0
  6. package/dist/app-bar/index.js +142 -0
  7. package/dist/autocomplete/index.js +48 -36
  8. package/dist/avatar/index.js +1 -2
  9. package/dist/badge/index.js +1 -2
  10. package/dist/bottom-sheet/index.js +1 -2
  11. package/dist/bottom-tab-bar/index.cjs +571 -0
  12. package/dist/bottom-tab-bar/index.d.cts +211 -0
  13. package/dist/bottom-tab-bar/index.d.ts +211 -0
  14. package/dist/bottom-tab-bar/index.js +497 -0
  15. package/dist/button/index.d.cts +102 -5
  16. package/dist/button/index.d.ts +102 -5
  17. package/dist/button/index.js +2 -3
  18. package/dist/button.type-j1ZdkkSl.d.cts +4 -0
  19. package/dist/button.type-j1ZdkkSl.d.ts +4 -0
  20. package/dist/card/index.cjs +2 -0
  21. package/dist/card/index.d.cts +6 -1
  22. package/dist/card/index.d.ts +6 -1
  23. package/dist/card/index.js +4 -2
  24. package/dist/carousel/index.js +1 -1
  25. package/dist/chart/index.cjs +1067 -0
  26. package/dist/chart/index.d.cts +218 -0
  27. package/dist/chart/index.d.ts +218 -0
  28. package/dist/chart/index.js +1026 -0
  29. package/dist/checkbox/index.js +1 -2
  30. package/dist/chip/index.js +1 -2
  31. package/dist/chunk-3XSXTM3G.js +661 -0
  32. package/dist/chunk-4KSZLONZ.js +79 -0
  33. package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
  34. package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
  35. package/dist/chunk-I4V5Y5GD.js +76 -0
  36. package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
  37. package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
  38. package/dist/chunk-URBEEDFX.js +79 -0
  39. package/dist/core/index.js +3 -5
  40. package/dist/datepicker/index.js +1 -2
  41. package/dist/divider/index.js +2 -3
  42. package/dist/drawer/index.cjs +310 -0
  43. package/dist/drawer/index.d.cts +58 -0
  44. package/dist/drawer/index.d.ts +58 -0
  45. package/dist/drawer/index.js +236 -0
  46. package/dist/{accordion → expansion-panel}/index.cjs +45 -45
  47. package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
  48. package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
  49. package/dist/{accordion → expansion-panel}/index.js +40 -41
  50. package/dist/fab/index.d.cts +3 -3
  51. package/dist/fab/index.d.ts +3 -3
  52. package/dist/fab/index.js +3 -4
  53. package/dist/fab-menu/index.d.cts +2 -2
  54. package/dist/fab-menu/index.d.ts +2 -2
  55. package/dist/fab-menu/index.js +3 -4
  56. package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
  57. package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
  58. package/dist/feature-discovery/index.cjs +531 -0
  59. package/dist/feature-discovery/index.d.cts +82 -0
  60. package/dist/feature-discovery/index.d.ts +82 -0
  61. package/dist/feature-discovery/index.js +464 -0
  62. package/dist/indicator/index.js +2 -3
  63. package/dist/input/index.cjs +258 -164
  64. package/dist/input/index.d.cts +15 -1
  65. package/dist/input/index.d.ts +15 -1
  66. package/dist/input/index.js +219 -126
  67. package/dist/list/index.js +1 -2
  68. package/dist/menu/index.js +2 -2
  69. package/dist/menubox/index.cjs +369 -0
  70. package/dist/menubox/index.d.cts +98 -0
  71. package/dist/menubox/index.d.ts +98 -0
  72. package/dist/menubox/index.js +296 -0
  73. package/dist/pager/index.cjs +243 -0
  74. package/dist/pager/index.d.cts +93 -0
  75. package/dist/pager/index.d.ts +93 -0
  76. package/dist/pager/index.js +205 -0
  77. package/dist/progress/index.js +1 -2
  78. package/dist/radio/index.cjs +537 -0
  79. package/dist/radio/index.d.cts +145 -0
  80. package/dist/radio/index.d.ts +145 -0
  81. package/dist/radio/index.js +464 -0
  82. package/dist/segment-button/index.js +2 -2
  83. package/dist/select/index.js +22 -10
  84. package/dist/skeleton/index.js +2 -2
  85. package/dist/slider/index.cjs +655 -0
  86. package/dist/slider/index.d.cts +171 -0
  87. package/dist/slider/index.d.ts +171 -0
  88. package/dist/slider/index.js +575 -0
  89. package/dist/stepper/index.cjs +624 -0
  90. package/dist/stepper/index.d.cts +137 -0
  91. package/dist/stepper/index.d.ts +137 -0
  92. package/dist/stepper/index.js +549 -0
  93. package/dist/switch/index.js +1 -2
  94. package/dist/tabs/index.cjs +523 -0
  95. package/dist/tabs/index.d.cts +176 -0
  96. package/dist/tabs/index.d.ts +176 -0
  97. package/dist/tabs/index.js +438 -0
  98. package/dist/timepicker/index.cjs +1280 -0
  99. package/dist/timepicker/index.d.cts +215 -0
  100. package/dist/timepicker/index.d.ts +215 -0
  101. package/dist/timepicker/index.js +1181 -0
  102. package/dist/toolbar/index.cjs +395 -0
  103. package/dist/toolbar/index.d.cts +100 -0
  104. package/dist/toolbar/index.d.ts +100 -0
  105. package/dist/toolbar/index.js +325 -0
  106. package/dist/typography/index.js +1 -2
  107. package/dist/view/index.cjs +16 -2
  108. package/dist/view/index.js +16 -2
  109. package/package.json +73 -8
  110. package/dist/button.type-D8tzEBo7.d.ts +0 -104
  111. package/dist/button.type-ikaWzhIg.d.cts +0 -104
  112. package/dist/chunk-GBHQCAKW.js +0 -19
  113. package/dist/chunk-JEGEPGVU.js +0 -287
@@ -0,0 +1,537 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/radio/index.ts
31
+ var radio_exports = {};
32
+ __export(radio_exports, {
33
+ Radio: () => Radio,
34
+ RadioGroup: () => RadioGroup
35
+ });
36
+ module.exports = __toCommonJS(radio_exports);
37
+
38
+ // src/components/radio/radio.tsx
39
+ var import_react8 = __toESM(require("react"), 1);
40
+ var import_react_native6 = require("react-native");
41
+ var import_core3 = require("@xaui/core");
42
+
43
+ // src/core/theme-context.tsx
44
+ var import_react4 = __toESM(require("react"), 1);
45
+ var import_react_native2 = require("react-native");
46
+ var import_theme = require("@xaui/core/theme");
47
+ var import_palette = require("@xaui/core/palette");
48
+
49
+ // src/core/portal/portal.tsx
50
+ var import_react2 = require("react");
51
+
52
+ // src/core/portal/portal-context.ts
53
+ var import_react = require("react");
54
+ var PortalContext = (0, import_react.createContext)(null);
55
+
56
+ // src/core/portal/portal-host.tsx
57
+ var import_react3 = __toESM(require("react"), 1);
58
+ var import_react_native = require("react-native");
59
+ var hostStyles = import_react_native.StyleSheet.create({
60
+ container: {
61
+ flex: 1
62
+ }
63
+ });
64
+
65
+ // src/core/theme-context.tsx
66
+ var XUIThemeContext = (0, import_react4.createContext)(null);
67
+
68
+ // src/core/theme-hooks.ts
69
+ var import_react5 = require("react");
70
+ var import_react_native3 = require("react-native");
71
+ function useXUITheme() {
72
+ const theme = (0, import_react5.useContext)(XUIThemeContext);
73
+ if (!theme) {
74
+ throw new Error("useXUITheme must be used within XUIProvider");
75
+ }
76
+ return theme;
77
+ }
78
+
79
+ // src/core/index.ts
80
+ var import_theme2 = require("@xaui/core/theme");
81
+
82
+ // src/components/radio/radio-context.ts
83
+ var import_react6 = __toESM(require("react"), 1);
84
+ var RadioGroupContext = import_react6.default.createContext(
85
+ null
86
+ );
87
+
88
+ // src/components/radio/radio.hook.ts
89
+ var import_react7 = require("react");
90
+ var import_core = require("@xaui/core");
91
+ function useSizeStyles(size, variant) {
92
+ const theme = useXUITheme();
93
+ const sizeStyles = (0, import_react7.useMemo)(() => {
94
+ const sizes = {
95
+ xs: {
96
+ radioSize: 14,
97
+ fontSize: theme.fontSizes.xs,
98
+ dotSize: variant === "light" ? 5 : 4
99
+ },
100
+ sm: {
101
+ radioSize: 18,
102
+ fontSize: theme.fontSizes.sm,
103
+ dotSize: variant === "light" ? 7 : 6
104
+ },
105
+ md: {
106
+ radioSize: 22,
107
+ fontSize: theme.fontSizes.md,
108
+ dotSize: variant === "light" ? 9 : 8
109
+ },
110
+ lg: {
111
+ radioSize: 26,
112
+ fontSize: theme.fontSizes.lg,
113
+ dotSize: variant === "light" ? 11 : 10
114
+ }
115
+ };
116
+ return sizes[size];
117
+ }, [size, theme, variant]);
118
+ return sizeStyles;
119
+ }
120
+ function useRadiusStyles(radius) {
121
+ const theme = useXUITheme();
122
+ const radiusStyles = (0, import_react7.useMemo)(() => {
123
+ const radii = {
124
+ none: theme.borderRadius.none,
125
+ sm: theme.borderRadius.sm,
126
+ md: theme.borderRadius.md,
127
+ lg: theme.borderRadius.lg,
128
+ full: theme.borderRadius.full
129
+ };
130
+ return { borderRadius: radii[radius] };
131
+ }, [radius, theme]);
132
+ return radiusStyles;
133
+ }
134
+ function useDotColors(themeColor, variant, isActive) {
135
+ const theme = useXUITheme();
136
+ const safeThemeColor = (0, import_core.getSafeThemeColor)(themeColor);
137
+ const colorScheme = theme.colors[safeThemeColor];
138
+ const dotColors = (0, import_react7.useMemo)(() => {
139
+ if (!isActive) {
140
+ return {
141
+ checked: "transparent"
142
+ };
143
+ }
144
+ if (variant === "filled") {
145
+ return {
146
+ checked: colorScheme.foreground
147
+ };
148
+ }
149
+ return {
150
+ checked: colorScheme.main
151
+ };
152
+ }, [colorScheme, isActive, variant]);
153
+ return dotColors;
154
+ }
155
+ function useVariantStyles(themeColor, variant, isActive) {
156
+ const theme = useXUITheme();
157
+ const safeThemeColor = (0, import_core.getSafeThemeColor)(themeColor);
158
+ const colorScheme = theme.colors[safeThemeColor];
159
+ const variantStyles = (0, import_react7.useMemo)(() => {
160
+ if (variant === "filled") {
161
+ return {
162
+ backgroundColor: "transparent",
163
+ borderWidth: isActive ? 0 : theme.borderWidth.md,
164
+ borderColor: isActive ? "transparent" : colorScheme.main
165
+ };
166
+ }
167
+ return {
168
+ backgroundColor: "transparent",
169
+ borderWidth: theme.borderWidth.md,
170
+ borderColor: colorScheme.main
171
+ };
172
+ }, [colorScheme.main, isActive, theme.borderWidth.md, variant]);
173
+ return variantStyles;
174
+ }
175
+ function useContainerStyles(labelAlignment) {
176
+ const containerStyles = (0, import_react7.useMemo)(() => {
177
+ const isJustified = labelAlignment === "justify-left" || labelAlignment === "justify-right";
178
+ return {
179
+ flexDirection: labelAlignment === "left" || labelAlignment === "justify-left" ? "row-reverse" : "row",
180
+ justifyContent: isJustified ? "space-between" : "flex-start"
181
+ };
182
+ }, [labelAlignment]);
183
+ return containerStyles;
184
+ }
185
+
186
+ // src/components/radio/radio.style.ts
187
+ var import_react_native4 = require("react-native");
188
+ var styles = import_react_native4.StyleSheet.create({
189
+ group: {
190
+ width: "100%"
191
+ },
192
+ container: {
193
+ flexDirection: "row",
194
+ alignItems: "center",
195
+ gap: 10
196
+ },
197
+ fullWidth: {
198
+ flexShrink: 1,
199
+ flexBasis: "auto",
200
+ width: "100%"
201
+ },
202
+ radio: {
203
+ alignItems: "center",
204
+ justifyContent: "center",
205
+ overflow: "hidden",
206
+ position: "relative"
207
+ },
208
+ background: {
209
+ position: "absolute",
210
+ width: "100%",
211
+ height: "100%"
212
+ },
213
+ dot: {
214
+ zIndex: 10
215
+ },
216
+ label: {
217
+ fontWeight: "400"
218
+ },
219
+ disabled: {
220
+ opacity: 0.5
221
+ },
222
+ disabledText: {
223
+ opacity: 0.7
224
+ }
225
+ });
226
+
227
+ // src/components/radio/radio.animation.ts
228
+ var import_react_native5 = require("react-native");
229
+ var runDotInAnimation = (dotScale, dotOpacity) => {
230
+ import_react_native5.Animated.parallel([
231
+ import_react_native5.Animated.spring(dotScale, {
232
+ toValue: 1,
233
+ useNativeDriver: true,
234
+ tension: 90,
235
+ friction: 9
236
+ }),
237
+ import_react_native5.Animated.timing(dotOpacity, {
238
+ toValue: 1,
239
+ duration: 180,
240
+ useNativeDriver: true
241
+ })
242
+ ]).start();
243
+ };
244
+ var runDotOutAnimation = (dotScale, dotOpacity) => {
245
+ import_react_native5.Animated.parallel([
246
+ import_react_native5.Animated.spring(dotScale, {
247
+ toValue: 0,
248
+ useNativeDriver: true,
249
+ tension: 90,
250
+ friction: 9
251
+ }),
252
+ import_react_native5.Animated.timing(dotOpacity, {
253
+ toValue: 0,
254
+ duration: 140,
255
+ useNativeDriver: true
256
+ })
257
+ ]).start();
258
+ };
259
+ var runBackgroundInAnimation = (backgroundScale, backgroundOpacity) => {
260
+ import_react_native5.Animated.parallel([
261
+ import_react_native5.Animated.timing(backgroundScale, {
262
+ toValue: 1,
263
+ duration: 200,
264
+ useNativeDriver: true
265
+ }),
266
+ import_react_native5.Animated.timing(backgroundOpacity, {
267
+ toValue: 1,
268
+ duration: 200,
269
+ useNativeDriver: true
270
+ })
271
+ ]).start();
272
+ };
273
+ var runBackgroundOutAnimation = (backgroundScale, backgroundOpacity) => {
274
+ import_react_native5.Animated.parallel([
275
+ import_react_native5.Animated.timing(backgroundScale, {
276
+ toValue: 0.5,
277
+ duration: 200,
278
+ useNativeDriver: true
279
+ }),
280
+ import_react_native5.Animated.timing(backgroundOpacity, {
281
+ toValue: 0,
282
+ duration: 200,
283
+ useNativeDriver: true
284
+ })
285
+ ]).start();
286
+ };
287
+ var runPressInAnimation = (scale) => {
288
+ import_react_native5.Animated.spring(scale, {
289
+ toValue: 0.95,
290
+ useNativeDriver: true
291
+ }).start();
292
+ };
293
+ var runPressOutAnimation = (scale) => {
294
+ import_react_native5.Animated.spring(scale, {
295
+ toValue: 1,
296
+ useNativeDriver: true
297
+ }).start();
298
+ };
299
+
300
+ // src/components/radio/radio.tsx
301
+ var Radio = ({
302
+ label,
303
+ value,
304
+ labelAlignment,
305
+ themeColor,
306
+ variant,
307
+ size,
308
+ radius,
309
+ fullWidth,
310
+ isChecked: isCheckedProp,
311
+ defaultChecked = false,
312
+ isDisabled,
313
+ labelStyle,
314
+ style,
315
+ onValueChange
316
+ }) => {
317
+ const group = (0, import_react8.useContext)(RadioGroupContext);
318
+ const theme = useXUITheme();
319
+ const resolvedLabelAlignment = labelAlignment ?? group?.labelAlignment ?? "right";
320
+ const resolvedThemeColor = themeColor ?? group?.themeColor ?? "primary";
321
+ const resolvedVariant = variant ?? group?.variant ?? "filled";
322
+ const resolvedSize = size ?? group?.size ?? "md";
323
+ const resolvedRadius = radius ?? group?.radius ?? "full";
324
+ const resolvedFullWidth = fullWidth ?? group?.fullWidth ?? false;
325
+ const resolvedDisabled = !!(isDisabled || group?.isDisabled);
326
+ const isInGroup = !!group && typeof value === "string";
327
+ const isControlledStandalone = typeof isCheckedProp === "boolean";
328
+ const [internalChecked, setInternalChecked] = (0, import_react8.useState)(defaultChecked);
329
+ const groupChecked = isInGroup ? group.selectedValue === value : false;
330
+ const isChecked = isInGroup ? groupChecked : isControlledStandalone ? isCheckedProp : internalChecked;
331
+ const colorScheme = theme.colors[(0, import_core3.getSafeThemeColor)(resolvedThemeColor)];
332
+ const scale = (0, import_react8.useRef)(new import_react_native6.Animated.Value(1)).current;
333
+ const backgroundScale = (0, import_react8.useRef)(new import_react_native6.Animated.Value(0.5)).current;
334
+ const backgroundOpacity = (0, import_react8.useRef)(new import_react_native6.Animated.Value(0)).current;
335
+ const dotScale = (0, import_react8.useRef)(new import_react_native6.Animated.Value(isChecked ? 1 : 0)).current;
336
+ const dotOpacity = (0, import_react8.useRef)(new import_react_native6.Animated.Value(isChecked ? 1 : 0)).current;
337
+ const sizeStyles = useSizeStyles(resolvedSize, resolvedVariant);
338
+ const radiusStyles = useRadiusStyles(resolvedRadius);
339
+ const dotColors = useDotColors(resolvedThemeColor, resolvedVariant, isChecked);
340
+ const variantStyles = useVariantStyles(
341
+ resolvedThemeColor,
342
+ resolvedVariant,
343
+ isChecked
344
+ );
345
+ const containerStyles = useContainerStyles(resolvedLabelAlignment);
346
+ (0, import_react8.useEffect)(() => {
347
+ if (resolvedVariant !== "filled") return;
348
+ if (isChecked) {
349
+ runBackgroundInAnimation(backgroundScale, backgroundOpacity);
350
+ } else {
351
+ runBackgroundOutAnimation(backgroundScale, backgroundOpacity);
352
+ }
353
+ }, [backgroundOpacity, backgroundScale, isChecked, resolvedVariant]);
354
+ (0, import_react8.useEffect)(() => {
355
+ if (isChecked) {
356
+ runDotInAnimation(dotScale, dotOpacity);
357
+ } else {
358
+ runDotOutAnimation(dotScale, dotOpacity);
359
+ }
360
+ }, [dotOpacity, dotScale, isChecked]);
361
+ const handlePress = () => {
362
+ if (resolvedDisabled || isChecked) return;
363
+ if (isInGroup && value) {
364
+ group.onValueChange?.(value);
365
+ onValueChange?.(true);
366
+ return;
367
+ }
368
+ if (!isControlledStandalone) {
369
+ setInternalChecked(true);
370
+ }
371
+ onValueChange?.(true);
372
+ };
373
+ const handlePressIn = () => {
374
+ if (resolvedDisabled) return;
375
+ runPressInAnimation(scale);
376
+ };
377
+ const handlePressOut = () => {
378
+ if (resolvedDisabled) return;
379
+ runPressOutAnimation(scale);
380
+ };
381
+ return /* @__PURE__ */ import_react8.default.createElement(
382
+ import_react_native6.Pressable,
383
+ {
384
+ onPress: handlePress,
385
+ onPressIn: handlePressIn,
386
+ onPressOut: handlePressOut,
387
+ disabled: resolvedDisabled,
388
+ accessible: true,
389
+ accessibilityRole: "radio",
390
+ accessibilityLabel: label,
391
+ accessibilityState: {
392
+ disabled: resolvedDisabled,
393
+ checked: !!isChecked
394
+ },
395
+ style: [
396
+ styles.container,
397
+ containerStyles,
398
+ resolvedFullWidth && styles.fullWidth,
399
+ resolvedDisabled && styles.disabled,
400
+ style
401
+ ]
402
+ },
403
+ /* @__PURE__ */ import_react8.default.createElement(
404
+ import_react_native6.Animated.View,
405
+ {
406
+ style: [
407
+ styles.radio,
408
+ {
409
+ width: sizeStyles.radioSize,
410
+ height: sizeStyles.radioSize,
411
+ ...radiusStyles,
412
+ ...variantStyles
413
+ },
414
+ {
415
+ transform: [{ scale }]
416
+ }
417
+ ]
418
+ },
419
+ resolvedVariant === "filled" && /* @__PURE__ */ import_react8.default.createElement(
420
+ import_react_native6.Animated.View,
421
+ {
422
+ style: [
423
+ styles.background,
424
+ radiusStyles,
425
+ {
426
+ backgroundColor: colorScheme.main,
427
+ transform: [{ scale: backgroundScale }],
428
+ opacity: backgroundOpacity
429
+ }
430
+ ]
431
+ }
432
+ ),
433
+ /* @__PURE__ */ import_react8.default.createElement(
434
+ import_react_native6.Animated.View,
435
+ {
436
+ style: [
437
+ styles.dot,
438
+ {
439
+ width: sizeStyles.dotSize,
440
+ height: sizeStyles.dotSize,
441
+ borderRadius: sizeStyles.dotSize / 2,
442
+ backgroundColor: dotColors.checked,
443
+ opacity: dotOpacity,
444
+ transform: [{ scale: dotScale }]
445
+ }
446
+ ]
447
+ }
448
+ )
449
+ ),
450
+ label && /* @__PURE__ */ import_react8.default.createElement(
451
+ import_react_native6.Text,
452
+ {
453
+ style: [
454
+ styles.label,
455
+ { fontSize: sizeStyles.fontSize, color: theme.colors.foreground },
456
+ resolvedDisabled && styles.disabledText,
457
+ labelStyle
458
+ ]
459
+ },
460
+ label
461
+ )
462
+ );
463
+ };
464
+
465
+ // src/components/radio/radio-group.tsx
466
+ var import_react9 = __toESM(require("react"), 1);
467
+ var import_react_native7 = require("react-native");
468
+ var RadioGroup = ({
469
+ children,
470
+ value,
471
+ defaultValue,
472
+ onValueChange,
473
+ isDisabled = false,
474
+ themeColor = "primary",
475
+ variant = "filled",
476
+ size = "md",
477
+ radius = "full",
478
+ labelAlignment = "right",
479
+ fullWidth = false,
480
+ orientation = "vertical",
481
+ gap,
482
+ style
483
+ }) => {
484
+ const theme = useXUITheme();
485
+ const isControlled = typeof value === "string";
486
+ const [internalValue, setInternalValue] = (0, import_react9.useState)(defaultValue);
487
+ const selectedValue = isControlled ? value : internalValue;
488
+ const handleValueChange = (nextValue) => {
489
+ if (nextValue === selectedValue) return;
490
+ if (!isControlled) {
491
+ setInternalValue(nextValue);
492
+ }
493
+ onValueChange?.(nextValue);
494
+ };
495
+ const contextValue = (0, import_react9.useMemo)(
496
+ () => ({
497
+ selectedValue,
498
+ isDisabled,
499
+ themeColor,
500
+ variant,
501
+ size,
502
+ radius,
503
+ labelAlignment,
504
+ fullWidth,
505
+ onValueChange: handleValueChange
506
+ }),
507
+ [
508
+ fullWidth,
509
+ isDisabled,
510
+ labelAlignment,
511
+ radius,
512
+ selectedValue,
513
+ size,
514
+ themeColor,
515
+ variant
516
+ ]
517
+ );
518
+ return /* @__PURE__ */ import_react9.default.createElement(RadioGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react9.default.createElement(
519
+ import_react_native7.View,
520
+ {
521
+ style: [
522
+ styles.group,
523
+ {
524
+ flexDirection: orientation === "horizontal" ? "row" : "column",
525
+ gap: gap ?? theme.spacing.sm
526
+ },
527
+ style
528
+ ]
529
+ },
530
+ children
531
+ ));
532
+ };
533
+ // Annotate the CommonJS export names for ESM import in node:
534
+ 0 && (module.exports = {
535
+ Radio,
536
+ RadioGroup
537
+ });
@@ -0,0 +1,145 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { TextStyle, ViewStyle } from 'react-native';
3
+ import { T as ThemeColor, S as Size, R as Radius } from '../index-BOw6tbkc.cjs';
4
+
5
+ type RadioVariant = 'filled' | 'light';
6
+ type RadioLabelAlignment = 'left' | 'right' | 'justify-left' | 'justify-right';
7
+ type RadioOrientation = 'vertical' | 'horizontal';
8
+ type RadioProps = {
9
+ /**
10
+ * The label to display alongside the radio.
11
+ */
12
+ label?: string;
13
+ /**
14
+ * Value associated to this option when used inside RadioGroup.
15
+ */
16
+ value?: string;
17
+ /**
18
+ * Alignment of the label relative to the radio.
19
+ * @default 'right'
20
+ */
21
+ labelAlignment?: RadioLabelAlignment;
22
+ /**
23
+ * The theme color of the radio.
24
+ * @default 'primary'
25
+ */
26
+ themeColor?: ThemeColor;
27
+ /**
28
+ * The variant of the radio.
29
+ * @default 'filled'
30
+ */
31
+ variant?: RadioVariant;
32
+ /**
33
+ * The size of the radio.
34
+ * @default 'md'
35
+ */
36
+ size?: Size;
37
+ /**
38
+ * The border radius of the radio.
39
+ * @default 'full'
40
+ */
41
+ radius?: Radius;
42
+ /**
43
+ * Whether the radio should take full width.
44
+ * @default false
45
+ */
46
+ fullWidth?: boolean;
47
+ /**
48
+ * Controlled checked state when used outside RadioGroup.
49
+ */
50
+ isChecked?: boolean;
51
+ /**
52
+ * Uncontrolled checked state when used outside RadioGroup.
53
+ * @default false
54
+ */
55
+ defaultChecked?: boolean;
56
+ /**
57
+ * Whether the radio is disabled.
58
+ * @default false
59
+ */
60
+ isDisabled?: boolean;
61
+ /**
62
+ * Custom style for label text.
63
+ */
64
+ labelStyle?: TextStyle;
65
+ /**
66
+ * Custom style for container.
67
+ */
68
+ style?: ViewStyle;
69
+ /**
70
+ * Callback fired when the radio checked state changes.
71
+ */
72
+ onValueChange?: (isChecked: boolean) => void;
73
+ };
74
+ type RadioGroupProps = {
75
+ /**
76
+ * Group options.
77
+ */
78
+ children: ReactNode;
79
+ /**
80
+ * Controlled selected value.
81
+ */
82
+ value?: string;
83
+ /**
84
+ * Uncontrolled default selected value.
85
+ */
86
+ defaultValue?: string;
87
+ /**
88
+ * Callback fired when selected value changes.
89
+ */
90
+ onValueChange?: (value: string) => void;
91
+ /**
92
+ * Whether all radios in group are disabled.
93
+ * @default false
94
+ */
95
+ isDisabled?: boolean;
96
+ /**
97
+ * Shared theme color for radios.
98
+ * @default 'primary'
99
+ */
100
+ themeColor?: ThemeColor;
101
+ /**
102
+ * Shared variant for radios.
103
+ * @default 'filled'
104
+ */
105
+ variant?: RadioVariant;
106
+ /**
107
+ * Shared size for radios.
108
+ * @default 'md'
109
+ */
110
+ size?: Size;
111
+ /**
112
+ * Shared radius for radios.
113
+ * @default 'full'
114
+ */
115
+ radius?: Radius;
116
+ /**
117
+ * Shared label alignment for radios.
118
+ * @default 'right'
119
+ */
120
+ labelAlignment?: RadioLabelAlignment;
121
+ /**
122
+ * Shared full width behavior for radios.
123
+ * @default false
124
+ */
125
+ fullWidth?: boolean;
126
+ /**
127
+ * Group orientation.
128
+ * @default 'vertical'
129
+ */
130
+ orientation?: RadioOrientation;
131
+ /**
132
+ * Space between options.
133
+ */
134
+ gap?: number;
135
+ /**
136
+ * Custom style for the group container.
137
+ */
138
+ style?: ViewStyle;
139
+ };
140
+
141
+ declare const Radio: React.FC<RadioProps>;
142
+
143
+ declare const RadioGroup: React.FC<RadioGroupProps>;
144
+
145
+ export { Radio, RadioGroup, type RadioGroupProps, type RadioLabelAlignment, type RadioOrientation, type RadioProps, type RadioVariant };