@xaui/native 0.0.26 → 0.0.28
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/LICENSE +21 -0
- package/README.md +105 -228
- package/dist/alert/index.cjs +92 -166
- package/dist/alert/index.js +2 -1
- package/dist/app-bar/index.cjs +24 -98
- package/dist/app-bar/index.js +2 -1
- package/dist/autocomplete/index.cjs +192 -281
- package/dist/autocomplete/index.js +36 -48
- package/dist/avatar/index.cjs +59 -133
- package/dist/avatar/index.js +2 -1
- package/dist/badge/index.cjs +26 -99
- package/dist/badge/index.js +2 -1
- package/dist/bottom-sheet/index.cjs +5 -456
- package/dist/bottom-sheet/index.js +4 -363
- package/dist/bottom-tab-bar/index.cjs +93 -167
- package/dist/bottom-tab-bar/index.js +2 -2
- package/dist/button/index.cjs +73 -525
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +76 -169
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.cjs +68 -145
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +132 -173
- package/dist/checkbox/index.cjs +70 -143
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +89 -164
- package/dist/chip/index.js +2 -1
- package/dist/chunk-BD72HIPR.cjs +75 -0
- package/dist/chunk-DHSTKO3K.cjs +19 -0
- package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
- package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/chunk-HC2SSHNU.js +368 -0
- package/dist/chunk-HSPTLUFA.cjs +7 -0
- package/dist/chunk-JEGEPGVU.js +287 -0
- package/dist/chunk-KTLGDLCB.cjs +287 -0
- package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
- package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/chunk-OQ2BLOOG.cjs +138 -0
- package/dist/chunk-QMYWIWSX.cjs +384 -0
- package/dist/chunk-XFPPR2VB.cjs +368 -0
- package/dist/core/index.cjs +22 -168
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.cjs +239 -320
- package/dist/datepicker/index.js +2 -1
- package/dist/divider/index.cjs +5 -145
- package/dist/divider/index.js +3 -2
- package/dist/drawer/index.cjs +39 -112
- package/dist/drawer/index.js +2 -1
- package/dist/expansion-panel/index.cjs +91 -230
- package/dist/expansion-panel/index.js +3 -2
- package/dist/fab/index.cjs +6 -722
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +81 -814
- package/dist/fab-menu/index.js +4 -3
- package/dist/feature-discovery/index.cjs +72 -139
- package/dist/feature-discovery/index.js +2 -2
- package/dist/index.cjs +1 -18
- package/dist/indicator/index.cjs +5 -445
- package/dist/indicator/index.js +3 -2
- package/dist/input/index.cjs +214 -282
- package/dist/input/index.js +2 -2
- package/dist/list/index.cjs +71 -146
- package/dist/list/index.js +2 -1
- package/dist/menu/index.cjs +59 -127
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +60 -132
- package/dist/menubox/index.js +2 -1
- package/dist/pager/index.cjs +42 -80
- package/dist/progress/index.cjs +43 -114
- package/dist/progress/index.js +2 -1
- package/dist/radio/index.cjs +82 -154
- package/dist/radio/index.js +2 -1
- package/dist/segment-button/index.cjs +60 -147
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.cjs +149 -224
- package/dist/select/index.js +10 -22
- package/dist/skeleton/index.cjs +23 -94
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +77 -156
- package/dist/slider/index.js +2 -1
- package/dist/snackbar/index.cjs +420 -0
- package/dist/snackbar/index.d.cts +175 -0
- package/dist/snackbar/index.d.ts +175 -0
- package/dist/snackbar/index.js +420 -0
- package/dist/stepper/index.cjs +121 -195
- package/dist/stepper/index.js +2 -1
- package/dist/switch/index.cjs +48 -121
- package/dist/switch/index.js +2 -1
- package/dist/tabs/index.cjs +67 -151
- package/dist/tabs/index.js +2 -1
- package/dist/timepicker/index.cjs +135 -593
- package/dist/timepicker/index.js +24 -383
- package/dist/toolbar/index.cjs +59 -128
- package/dist/toolbar/index.js +2 -1
- package/dist/typography/index.cjs +37 -92
- package/dist/typography/index.d.cts +1 -1
- package/dist/typography/index.d.ts +1 -1
- package/dist/typography/index.js +20 -1
- package/dist/view/index.cjs +178 -223
- package/package.json +7 -1
- package/dist/chunk-3XSXTM3G.js +0 -661
- package/dist/chunk-4KSZLONZ.js +0 -79
- package/dist/chunk-I4V5Y5GD.js +0 -76
- package/dist/chunk-URBEEDFX.js +0 -79
package/dist/radio/index.cjs
CHANGED
|
@@ -1,96 +1,25 @@
|
|
|
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
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-HSPTLUFA.cjs');
|
|
64
2
|
|
|
65
|
-
// src/core/theme-context.tsx
|
|
66
|
-
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
67
3
|
|
|
68
|
-
|
|
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
|
-
}
|
|
4
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
78
5
|
|
|
79
|
-
// src/
|
|
80
|
-
var
|
|
6
|
+
// src/components/radio/radio.tsx
|
|
7
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
+
var _reactnative = require('react-native');
|
|
9
|
+
var _core = require('@xaui/core');
|
|
81
10
|
|
|
82
11
|
// src/components/radio/radio-context.ts
|
|
83
|
-
|
|
84
|
-
var RadioGroupContext =
|
|
12
|
+
|
|
13
|
+
var RadioGroupContext = _react2.default.createContext(
|
|
85
14
|
null
|
|
86
15
|
);
|
|
87
16
|
|
|
88
17
|
// src/components/radio/radio.hook.ts
|
|
89
|
-
|
|
90
|
-
|
|
18
|
+
|
|
19
|
+
|
|
91
20
|
function useSizeStyles(size, variant) {
|
|
92
|
-
const theme = useXUITheme();
|
|
93
|
-
const sizeStyles = (0,
|
|
21
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
22
|
+
const sizeStyles = _react.useMemo.call(void 0, () => {
|
|
94
23
|
const sizes = {
|
|
95
24
|
xs: {
|
|
96
25
|
radioSize: 14,
|
|
@@ -118,8 +47,8 @@ function useSizeStyles(size, variant) {
|
|
|
118
47
|
return sizeStyles;
|
|
119
48
|
}
|
|
120
49
|
function useRadiusStyles(radius) {
|
|
121
|
-
const theme = useXUITheme();
|
|
122
|
-
const radiusStyles = (0,
|
|
50
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
51
|
+
const radiusStyles = _react.useMemo.call(void 0, () => {
|
|
123
52
|
const radii = {
|
|
124
53
|
none: theme.borderRadius.none,
|
|
125
54
|
sm: theme.borderRadius.sm,
|
|
@@ -132,10 +61,10 @@ function useRadiusStyles(radius) {
|
|
|
132
61
|
return radiusStyles;
|
|
133
62
|
}
|
|
134
63
|
function useDotColors(themeColor, variant, isActive) {
|
|
135
|
-
const theme = useXUITheme();
|
|
136
|
-
const safeThemeColor = (0,
|
|
64
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
65
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
137
66
|
const colorScheme = theme.colors[safeThemeColor];
|
|
138
|
-
const dotColors = (0,
|
|
67
|
+
const dotColors = _react.useMemo.call(void 0, () => {
|
|
139
68
|
if (!isActive) {
|
|
140
69
|
return {
|
|
141
70
|
checked: "transparent"
|
|
@@ -153,10 +82,10 @@ function useDotColors(themeColor, variant, isActive) {
|
|
|
153
82
|
return dotColors;
|
|
154
83
|
}
|
|
155
84
|
function useVariantStyles(themeColor, variant, isActive) {
|
|
156
|
-
const theme = useXUITheme();
|
|
157
|
-
const safeThemeColor = (0,
|
|
85
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
86
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
158
87
|
const colorScheme = theme.colors[safeThemeColor];
|
|
159
|
-
const variantStyles = (0,
|
|
88
|
+
const variantStyles = _react.useMemo.call(void 0, () => {
|
|
160
89
|
if (variant === "filled") {
|
|
161
90
|
return {
|
|
162
91
|
backgroundColor: "transparent",
|
|
@@ -173,7 +102,7 @@ function useVariantStyles(themeColor, variant, isActive) {
|
|
|
173
102
|
return variantStyles;
|
|
174
103
|
}
|
|
175
104
|
function useContainerStyles(labelAlignment) {
|
|
176
|
-
const containerStyles = (0,
|
|
105
|
+
const containerStyles = _react.useMemo.call(void 0, () => {
|
|
177
106
|
const isJustified = labelAlignment === "justify-left" || labelAlignment === "justify-right";
|
|
178
107
|
return {
|
|
179
108
|
flexDirection: labelAlignment === "left" || labelAlignment === "justify-left" ? "row-reverse" : "row",
|
|
@@ -184,8 +113,8 @@ function useContainerStyles(labelAlignment) {
|
|
|
184
113
|
}
|
|
185
114
|
|
|
186
115
|
// src/components/radio/radio.style.ts
|
|
187
|
-
|
|
188
|
-
var styles =
|
|
116
|
+
|
|
117
|
+
var styles = _reactnative.StyleSheet.create({
|
|
189
118
|
group: {
|
|
190
119
|
width: "100%"
|
|
191
120
|
},
|
|
@@ -225,16 +154,16 @@ var styles = import_react_native4.StyleSheet.create({
|
|
|
225
154
|
});
|
|
226
155
|
|
|
227
156
|
// src/components/radio/radio.animation.ts
|
|
228
|
-
|
|
157
|
+
|
|
229
158
|
var runDotInAnimation = (dotScale, dotOpacity) => {
|
|
230
|
-
|
|
231
|
-
|
|
159
|
+
_reactnative.Animated.parallel([
|
|
160
|
+
_reactnative.Animated.spring(dotScale, {
|
|
232
161
|
toValue: 1,
|
|
233
162
|
useNativeDriver: true,
|
|
234
163
|
tension: 90,
|
|
235
164
|
friction: 9
|
|
236
165
|
}),
|
|
237
|
-
|
|
166
|
+
_reactnative.Animated.timing(dotOpacity, {
|
|
238
167
|
toValue: 1,
|
|
239
168
|
duration: 180,
|
|
240
169
|
useNativeDriver: true
|
|
@@ -242,14 +171,14 @@ var runDotInAnimation = (dotScale, dotOpacity) => {
|
|
|
242
171
|
]).start();
|
|
243
172
|
};
|
|
244
173
|
var runDotOutAnimation = (dotScale, dotOpacity) => {
|
|
245
|
-
|
|
246
|
-
|
|
174
|
+
_reactnative.Animated.parallel([
|
|
175
|
+
_reactnative.Animated.spring(dotScale, {
|
|
247
176
|
toValue: 0,
|
|
248
177
|
useNativeDriver: true,
|
|
249
178
|
tension: 90,
|
|
250
179
|
friction: 9
|
|
251
180
|
}),
|
|
252
|
-
|
|
181
|
+
_reactnative.Animated.timing(dotOpacity, {
|
|
253
182
|
toValue: 0,
|
|
254
183
|
duration: 140,
|
|
255
184
|
useNativeDriver: true
|
|
@@ -257,13 +186,13 @@ var runDotOutAnimation = (dotScale, dotOpacity) => {
|
|
|
257
186
|
]).start();
|
|
258
187
|
};
|
|
259
188
|
var runBackgroundInAnimation = (backgroundScale, backgroundOpacity) => {
|
|
260
|
-
|
|
261
|
-
|
|
189
|
+
_reactnative.Animated.parallel([
|
|
190
|
+
_reactnative.Animated.timing(backgroundScale, {
|
|
262
191
|
toValue: 1,
|
|
263
192
|
duration: 200,
|
|
264
193
|
useNativeDriver: true
|
|
265
194
|
}),
|
|
266
|
-
|
|
195
|
+
_reactnative.Animated.timing(backgroundOpacity, {
|
|
267
196
|
toValue: 1,
|
|
268
197
|
duration: 200,
|
|
269
198
|
useNativeDriver: true
|
|
@@ -271,13 +200,13 @@ var runBackgroundInAnimation = (backgroundScale, backgroundOpacity) => {
|
|
|
271
200
|
]).start();
|
|
272
201
|
};
|
|
273
202
|
var runBackgroundOutAnimation = (backgroundScale, backgroundOpacity) => {
|
|
274
|
-
|
|
275
|
-
|
|
203
|
+
_reactnative.Animated.parallel([
|
|
204
|
+
_reactnative.Animated.timing(backgroundScale, {
|
|
276
205
|
toValue: 0.5,
|
|
277
206
|
duration: 200,
|
|
278
207
|
useNativeDriver: true
|
|
279
208
|
}),
|
|
280
|
-
|
|
209
|
+
_reactnative.Animated.timing(backgroundOpacity, {
|
|
281
210
|
toValue: 0,
|
|
282
211
|
duration: 200,
|
|
283
212
|
useNativeDriver: true
|
|
@@ -285,13 +214,13 @@ var runBackgroundOutAnimation = (backgroundScale, backgroundOpacity) => {
|
|
|
285
214
|
]).start();
|
|
286
215
|
};
|
|
287
216
|
var runPressInAnimation = (scale) => {
|
|
288
|
-
|
|
217
|
+
_reactnative.Animated.spring(scale, {
|
|
289
218
|
toValue: 0.95,
|
|
290
219
|
useNativeDriver: true
|
|
291
220
|
}).start();
|
|
292
221
|
};
|
|
293
222
|
var runPressOutAnimation = (scale) => {
|
|
294
|
-
|
|
223
|
+
_reactnative.Animated.spring(scale, {
|
|
295
224
|
toValue: 1,
|
|
296
225
|
useNativeDriver: true
|
|
297
226
|
}).start();
|
|
@@ -314,26 +243,26 @@ var Radio = ({
|
|
|
314
243
|
style,
|
|
315
244
|
onValueChange
|
|
316
245
|
}) => {
|
|
317
|
-
const group = (0,
|
|
318
|
-
const theme = useXUITheme();
|
|
319
|
-
const resolvedLabelAlignment = labelAlignment
|
|
320
|
-
const resolvedThemeColor = themeColor
|
|
321
|
-
const resolvedVariant = variant
|
|
322
|
-
const resolvedSize = size
|
|
323
|
-
const resolvedRadius = radius
|
|
324
|
-
const resolvedFullWidth = fullWidth
|
|
325
|
-
const resolvedDisabled = !!(isDisabled || group
|
|
246
|
+
const group = _react.useContext.call(void 0, RadioGroupContext);
|
|
247
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
248
|
+
const resolvedLabelAlignment = _nullishCoalesce(_nullishCoalesce(labelAlignment, () => ( _optionalChain([group, 'optionalAccess', _ => _.labelAlignment]))), () => ( "right"));
|
|
249
|
+
const resolvedThemeColor = _nullishCoalesce(_nullishCoalesce(themeColor, () => ( _optionalChain([group, 'optionalAccess', _2 => _2.themeColor]))), () => ( "primary"));
|
|
250
|
+
const resolvedVariant = _nullishCoalesce(_nullishCoalesce(variant, () => ( _optionalChain([group, 'optionalAccess', _3 => _3.variant]))), () => ( "filled"));
|
|
251
|
+
const resolvedSize = _nullishCoalesce(_nullishCoalesce(size, () => ( _optionalChain([group, 'optionalAccess', _4 => _4.size]))), () => ( "md"));
|
|
252
|
+
const resolvedRadius = _nullishCoalesce(_nullishCoalesce(radius, () => ( _optionalChain([group, 'optionalAccess', _5 => _5.radius]))), () => ( "full"));
|
|
253
|
+
const resolvedFullWidth = _nullishCoalesce(_nullishCoalesce(fullWidth, () => ( _optionalChain([group, 'optionalAccess', _6 => _6.fullWidth]))), () => ( false));
|
|
254
|
+
const resolvedDisabled = !!(isDisabled || _optionalChain([group, 'optionalAccess', _7 => _7.isDisabled]));
|
|
326
255
|
const isInGroup = !!group && typeof value === "string";
|
|
327
256
|
const isControlledStandalone = typeof isCheckedProp === "boolean";
|
|
328
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
257
|
+
const [internalChecked, setInternalChecked] = _react.useState.call(void 0, defaultChecked);
|
|
329
258
|
const groupChecked = isInGroup ? group.selectedValue === value : false;
|
|
330
259
|
const isChecked = isInGroup ? groupChecked : isControlledStandalone ? isCheckedProp : internalChecked;
|
|
331
|
-
const colorScheme = theme.colors[(0,
|
|
332
|
-
const scale = (0,
|
|
333
|
-
const backgroundScale = (0,
|
|
334
|
-
const backgroundOpacity = (0,
|
|
335
|
-
const dotScale = (0,
|
|
336
|
-
const dotOpacity = (0,
|
|
260
|
+
const colorScheme = theme.colors[_core.getSafeThemeColor.call(void 0, resolvedThemeColor)];
|
|
261
|
+
const scale = _react.useRef.call(void 0, new _reactnative.Animated.Value(1)).current;
|
|
262
|
+
const backgroundScale = _react.useRef.call(void 0, new _reactnative.Animated.Value(0.5)).current;
|
|
263
|
+
const backgroundOpacity = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
264
|
+
const dotScale = _react.useRef.call(void 0, new _reactnative.Animated.Value(isChecked ? 1 : 0)).current;
|
|
265
|
+
const dotOpacity = _react.useRef.call(void 0, new _reactnative.Animated.Value(isChecked ? 1 : 0)).current;
|
|
337
266
|
const sizeStyles = useSizeStyles(resolvedSize, resolvedVariant);
|
|
338
267
|
const radiusStyles = useRadiusStyles(resolvedRadius);
|
|
339
268
|
const dotColors = useDotColors(resolvedThemeColor, resolvedVariant, isChecked);
|
|
@@ -343,7 +272,7 @@ var Radio = ({
|
|
|
343
272
|
isChecked
|
|
344
273
|
);
|
|
345
274
|
const containerStyles = useContainerStyles(resolvedLabelAlignment);
|
|
346
|
-
(0,
|
|
275
|
+
_react.useEffect.call(void 0, () => {
|
|
347
276
|
if (resolvedVariant !== "filled") return;
|
|
348
277
|
if (isChecked) {
|
|
349
278
|
runBackgroundInAnimation(backgroundScale, backgroundOpacity);
|
|
@@ -351,7 +280,7 @@ var Radio = ({
|
|
|
351
280
|
runBackgroundOutAnimation(backgroundScale, backgroundOpacity);
|
|
352
281
|
}
|
|
353
282
|
}, [backgroundOpacity, backgroundScale, isChecked, resolvedVariant]);
|
|
354
|
-
(0,
|
|
283
|
+
_react.useEffect.call(void 0, () => {
|
|
355
284
|
if (isChecked) {
|
|
356
285
|
runDotInAnimation(dotScale, dotOpacity);
|
|
357
286
|
} else {
|
|
@@ -361,14 +290,14 @@ var Radio = ({
|
|
|
361
290
|
const handlePress = () => {
|
|
362
291
|
if (resolvedDisabled || isChecked) return;
|
|
363
292
|
if (isInGroup && value) {
|
|
364
|
-
group.onValueChange
|
|
365
|
-
onValueChange
|
|
293
|
+
_optionalChain([group, 'access', _8 => _8.onValueChange, 'optionalCall', _9 => _9(value)]);
|
|
294
|
+
_optionalChain([onValueChange, 'optionalCall', _10 => _10(true)]);
|
|
366
295
|
return;
|
|
367
296
|
}
|
|
368
297
|
if (!isControlledStandalone) {
|
|
369
298
|
setInternalChecked(true);
|
|
370
299
|
}
|
|
371
|
-
onValueChange
|
|
300
|
+
_optionalChain([onValueChange, 'optionalCall', _11 => _11(true)]);
|
|
372
301
|
};
|
|
373
302
|
const handlePressIn = () => {
|
|
374
303
|
if (resolvedDisabled) return;
|
|
@@ -378,8 +307,8 @@ var Radio = ({
|
|
|
378
307
|
if (resolvedDisabled) return;
|
|
379
308
|
runPressOutAnimation(scale);
|
|
380
309
|
};
|
|
381
|
-
return /* @__PURE__ */
|
|
382
|
-
|
|
310
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
311
|
+
_reactnative.Pressable,
|
|
383
312
|
{
|
|
384
313
|
onPress: handlePress,
|
|
385
314
|
onPressIn: handlePressIn,
|
|
@@ -400,8 +329,8 @@ var Radio = ({
|
|
|
400
329
|
style
|
|
401
330
|
]
|
|
402
331
|
},
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
|
|
332
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
333
|
+
_reactnative.Animated.View,
|
|
405
334
|
{
|
|
406
335
|
style: [
|
|
407
336
|
styles.radio,
|
|
@@ -416,8 +345,8 @@ var Radio = ({
|
|
|
416
345
|
}
|
|
417
346
|
]
|
|
418
347
|
},
|
|
419
|
-
resolvedVariant === "filled" && /* @__PURE__ */
|
|
420
|
-
|
|
348
|
+
resolvedVariant === "filled" && /* @__PURE__ */ _react2.default.createElement(
|
|
349
|
+
_reactnative.Animated.View,
|
|
421
350
|
{
|
|
422
351
|
style: [
|
|
423
352
|
styles.background,
|
|
@@ -430,8 +359,8 @@ var Radio = ({
|
|
|
430
359
|
]
|
|
431
360
|
}
|
|
432
361
|
),
|
|
433
|
-
/* @__PURE__ */
|
|
434
|
-
|
|
362
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
363
|
+
_reactnative.Animated.View,
|
|
435
364
|
{
|
|
436
365
|
style: [
|
|
437
366
|
styles.dot,
|
|
@@ -447,8 +376,8 @@ var Radio = ({
|
|
|
447
376
|
}
|
|
448
377
|
)
|
|
449
378
|
),
|
|
450
|
-
label && /* @__PURE__ */
|
|
451
|
-
|
|
379
|
+
label && /* @__PURE__ */ _react2.default.createElement(
|
|
380
|
+
_reactnative.Text,
|
|
452
381
|
{
|
|
453
382
|
style: [
|
|
454
383
|
styles.label,
|
|
@@ -463,8 +392,8 @@ var Radio = ({
|
|
|
463
392
|
};
|
|
464
393
|
|
|
465
394
|
// src/components/radio/radio-group.tsx
|
|
466
|
-
|
|
467
|
-
|
|
395
|
+
|
|
396
|
+
|
|
468
397
|
var RadioGroup = ({
|
|
469
398
|
children,
|
|
470
399
|
value,
|
|
@@ -481,18 +410,18 @@ var RadioGroup = ({
|
|
|
481
410
|
gap,
|
|
482
411
|
style
|
|
483
412
|
}) => {
|
|
484
|
-
const theme = useXUITheme();
|
|
413
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
485
414
|
const isControlled = typeof value === "string";
|
|
486
|
-
const [internalValue, setInternalValue] = (0,
|
|
415
|
+
const [internalValue, setInternalValue] = _react.useState.call(void 0, defaultValue);
|
|
487
416
|
const selectedValue = isControlled ? value : internalValue;
|
|
488
417
|
const handleValueChange = (nextValue) => {
|
|
489
418
|
if (nextValue === selectedValue) return;
|
|
490
419
|
if (!isControlled) {
|
|
491
420
|
setInternalValue(nextValue);
|
|
492
421
|
}
|
|
493
|
-
onValueChange
|
|
422
|
+
_optionalChain([onValueChange, 'optionalCall', _12 => _12(nextValue)]);
|
|
494
423
|
};
|
|
495
|
-
const contextValue = (0,
|
|
424
|
+
const contextValue = _react.useMemo.call(void 0,
|
|
496
425
|
() => ({
|
|
497
426
|
selectedValue,
|
|
498
427
|
isDisabled,
|
|
@@ -515,14 +444,14 @@ var RadioGroup = ({
|
|
|
515
444
|
variant
|
|
516
445
|
]
|
|
517
446
|
);
|
|
518
|
-
return /* @__PURE__ */
|
|
519
|
-
|
|
447
|
+
return /* @__PURE__ */ _react2.default.createElement(RadioGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ _react2.default.createElement(
|
|
448
|
+
_reactnative.View,
|
|
520
449
|
{
|
|
521
450
|
style: [
|
|
522
451
|
styles.group,
|
|
523
452
|
{
|
|
524
453
|
flexDirection: orientation === "horizontal" ? "row" : "column",
|
|
525
|
-
gap: gap
|
|
454
|
+
gap: _nullishCoalesce(gap, () => ( theme.spacing.sm))
|
|
526
455
|
},
|
|
527
456
|
style
|
|
528
457
|
]
|
|
@@ -530,8 +459,7 @@ var RadioGroup = ({
|
|
|
530
459
|
children
|
|
531
460
|
));
|
|
532
461
|
};
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
});
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
exports.Radio = Radio; exports.RadioGroup = RadioGroup;
|
package/dist/radio/index.js
CHANGED