@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.41
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/chunk-2EGR4LWD.js +145 -0
- package/dist/chunk-2NRZKJG7.js +531 -0
- package/dist/chunk-2PMXMKS5.js +67 -0
- package/dist/chunk-2XPG2243.js +586 -0
- package/dist/chunk-36PRYGAM.js +13 -0
- package/dist/chunk-3E7CDKFO.cjs +696 -0
- package/dist/chunk-3GFRSZYR.js +54 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4CUZZWFW.js +92 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4KFKWBN5.cjs +89 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5R26NM4M.cjs +402 -0
- package/dist/chunk-5VKYNBNA.js +607 -0
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/chunk-6DOLGZVV.cjs +147 -0
- package/dist/chunk-6L2TS2R3.cjs +92 -0
- package/dist/chunk-6UEZJRVI.js +669 -0
- package/dist/chunk-734MFAX4.js +27 -0
- package/dist/chunk-73RKQC5X.js +104 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7GHM4GKL.cjs +119 -0
- package/dist/chunk-7YF5NAHQ.cjs +74 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-ABAGZTXZ.cjs +736 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
- package/dist/chunk-AMCSSOJT.cjs +104 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BRRXFOBY.js +431 -0
- package/dist/chunk-C5YLPCFC.cjs +293 -0
- package/dist/chunk-DA3OKXHV.cjs +700 -0
- package/dist/chunk-DD4276RF.js +366 -0
- package/dist/chunk-DG2I4PJG.js +701 -0
- package/dist/chunk-DHGLGSH6.js +661 -0
- package/dist/chunk-DIBUQ46Y.js +346 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/chunk-EZEYMLO3.js +402 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FHUYHV6J.js +89 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G3CCT4EY.js +518 -0
- package/dist/chunk-G7P3ERYF.cjs +478 -0
- package/dist/chunk-GA6PBWNT.js +147 -0
- package/dist/chunk-GFUZ3MUT.cjs +455 -0
- package/dist/chunk-GGW43Q37.cjs +1 -0
- package/dist/chunk-GTR5X65M.cjs +27 -0
- package/dist/chunk-H4E4HDEP.cjs +13 -0
- package/dist/chunk-H7DS4IO7.js +198 -0
- package/dist/chunk-HDVVZG4S.cjs +198 -0
- package/dist/chunk-IKJVLJKT.js +151 -0
- package/dist/chunk-J3MB4PI5.cjs +531 -0
- package/dist/chunk-K72UDPVN.js +119 -0
- package/dist/chunk-KCMYU7WF.js +86 -0
- package/dist/chunk-LRN3RNDO.js +940 -0
- package/dist/chunk-LTX6TB5I.js +124 -0
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/chunk-M63GFNKV.js +194 -0
- package/dist/chunk-N3KTZMPG.js +293 -0
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/chunk-NWGLP6JX.cjs +410 -0
- package/dist/chunk-R73XQK7X.cjs +314 -0
- package/dist/chunk-RU7JCMWC.cjs +881 -0
- package/dist/chunk-SNIHUKDA.cjs +184 -0
- package/dist/chunk-T5FV5F7A.cjs +607 -0
- package/dist/chunk-TDTUAIFF.cjs +153 -0
- package/dist/chunk-TJ74XVZN.cjs +431 -0
- package/dist/chunk-TK44VBIE.cjs +194 -0
- package/dist/chunk-UAWBAD4E.cjs +346 -0
- package/dist/chunk-UFTCTTKK.js +381 -0
- package/dist/chunk-VLKBESEV.cjs +407 -0
- package/dist/chunk-WDDXU3OH.cjs +67 -0
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-WHJTBTYM.js +0 -0
- package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
- package/dist/chunk-XFPQFCEK.js +455 -0
- package/dist/chunk-XSQPVDFH.cjs +60 -0
- package/dist/chunk-XTC2SLFT.js +153 -0
- package/dist/chunk-XV735BSA.cjs +366 -0
- package/dist/chunk-XWNG2U4K.cjs +124 -0
- package/dist/chunk-YGYYJ3LQ.js +314 -0
- package/dist/chunk-YVHT2UVW.js +74 -0
- package/dist/chunk-ZFOOJK37.cjs +86 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/accordion/index.cjs +35 -0
- package/dist/components/accordion/index.d.cts +299 -0
- package/dist/components/accordion/index.d.ts +299 -0
- package/dist/components/accordion/index.js +35 -0
- package/dist/components/alert/index.cjs +20 -0
- package/dist/components/alert/index.d.cts +169 -0
- package/dist/components/alert/index.d.ts +169 -0
- package/dist/components/alert/index.js +20 -0
- package/dist/components/avatar/index.cjs +16 -0
- package/dist/components/avatar/index.d.cts +131 -0
- package/dist/components/avatar/index.d.ts +131 -0
- package/dist/components/avatar/index.js +16 -0
- package/dist/components/badge/index.cjs +15 -0
- package/dist/components/badge/index.d.cts +157 -0
- package/dist/components/badge/index.d.ts +157 -0
- package/dist/components/badge/index.js +15 -0
- package/dist/components/button/index.cjs +22 -0
- package/dist/components/button/index.d.cts +613 -0
- package/dist/components/button/index.d.ts +613 -0
- package/dist/components/button/index.js +22 -0
- package/dist/components/card/index.cjs +22 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +22 -0
- package/dist/components/checkbox/index.cjs +26 -0
- package/dist/components/checkbox/index.d.cts +1136 -0
- package/dist/components/checkbox/index.d.ts +1136 -0
- package/dist/components/checkbox/index.js +26 -0
- package/dist/components/chip/index.cjs +20 -0
- package/dist/components/chip/index.d.cts +608 -0
- package/dist/components/chip/index.d.ts +608 -0
- package/dist/components/chip/index.js +20 -0
- package/dist/components/divider/index.cjs +13 -0
- package/dist/components/divider/index.d.cts +117 -0
- package/dist/components/divider/index.d.ts +117 -0
- package/dist/components/divider/index.js +13 -0
- package/dist/components/field-group/index.cjs +27 -0
- package/dist/components/field-group/index.d.cts +270 -0
- package/dist/components/field-group/index.d.ts +270 -0
- package/dist/components/field-group/index.js +27 -0
- package/dist/components/input-otp/index.cjs +29 -0
- package/dist/components/input-otp/index.d.cts +325 -0
- package/dist/components/input-otp/index.d.ts +325 -0
- package/dist/components/input-otp/index.js +29 -0
- package/dist/components/menu/index.cjs +49 -0
- package/dist/components/menu/index.d.cts +351 -0
- package/dist/components/menu/index.d.ts +351 -0
- package/dist/components/menu/index.js +49 -0
- package/dist/components/popover/index.cjs +38 -0
- package/dist/components/popover/index.d.cts +254 -0
- package/dist/components/popover/index.d.ts +254 -0
- package/dist/components/popover/index.js +38 -0
- package/dist/components/radio/index.cjs +26 -0
- package/dist/components/radio/index.d.cts +1102 -0
- package/dist/components/radio/index.d.ts +1102 -0
- package/dist/components/radio/index.js +26 -0
- package/dist/components/select/index.cjs +50 -0
- package/dist/components/select/index.d.cts +498 -0
- package/dist/components/select/index.d.ts +498 -0
- package/dist/components/select/index.js +50 -0
- package/dist/components/skeleton/index.cjs +11 -0
- package/dist/components/skeleton/index.d.cts +111 -0
- package/dist/components/skeleton/index.d.ts +111 -0
- package/dist/components/skeleton/index.js +11 -0
- package/dist/components/spinner/index.cjs +17 -0
- package/dist/components/spinner/index.d.cts +104 -0
- package/dist/components/spinner/index.d.ts +104 -0
- package/dist/components/spinner/index.js +17 -0
- package/dist/components/switch/index.cjs +27 -0
- package/dist/components/switch/index.d.cts +1154 -0
- package/dist/components/switch/index.d.ts +1154 -0
- package/dist/components/switch/index.js +27 -0
- package/dist/components/tabs/index.cjs +33 -0
- package/dist/components/tabs/index.d.cts +261 -0
- package/dist/components/tabs/index.d.ts +261 -0
- package/dist/components/tabs/index.js +33 -0
- package/dist/components/text-area/index.cjs +14 -0
- package/dist/components/text-area/index.d.cts +73 -0
- package/dist/components/text-area/index.d.ts +73 -0
- package/dist/components/text-area/index.js +14 -0
- package/dist/components/text-field/index.cjs +25 -0
- package/dist/components/text-field/index.d.cts +205 -0
- package/dist/components/text-field/index.d.ts +205 -0
- package/dist/components/text-field/index.js +25 -0
- package/dist/components/typography/index.cjs +15 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +15 -0
- package/dist/components/view/index.cjs +17 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +17 -0
- package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
- package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
- package/dist/icon.type-Kml72iSz.d.ts +73 -0
- package/dist/icon.type-d_i9ma-i.d.cts +73 -0
- package/dist/index.cjs +423 -5
- package/dist/index.d.cts +119 -4
- package/dist/index.d.ts +119 -4
- package/dist/index.js +445 -27
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -0
- package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
- package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
- package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
- package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
- package/dist/system/index.cjs +73 -4
- package/dist/system/index.d.cts +379 -193
- package/dist/system/index.d.ts +379 -193
- package/dist/system/index.js +87 -18
- package/dist/text-field.type-0l73acce.d.ts +167 -0
- package/dist/text-field.type-DBh06DU5.d.cts +167 -0
- package/dist/theme/index.cjs +5 -3
- package/dist/theme/index.d.cts +55 -24
- package/dist/theme/index.d.ts +55 -24
- package/dist/theme/index.js +4 -2
- package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
- package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
- package/package.json +264 -18
- package/dist/chunk-ECDWSSHJ.js +0 -688
- package/dist/chunk-IYFGO523.cjs +0 -688
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }
|
|
2
|
+
|
|
3
|
+
var _chunkF6CQ6CBIcjs = require('./chunk-F6CQ6CBI.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk3E7CDKFOcjs = require('./chunk-3E7CDKFO.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
|
|
27
|
+
|
|
28
|
+
// src/components/radio/radio-indicator.tsx
|
|
29
|
+
var _react = require('react');
|
|
30
|
+
var _reactnative = require('react-native');
|
|
31
|
+
|
|
32
|
+
// src/components/radio/radio.context.ts
|
|
33
|
+
var [RadioProvider, useRadio] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Radio");
|
|
34
|
+
|
|
35
|
+
// src/components/radio/radio-indicator.tsx
|
|
36
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
37
|
+
var RadioIndicator = _react.forwardRef.call(void 0,
|
|
38
|
+
function RadioIndicator2({ children, animation = true, style, ...props }, ref) {
|
|
39
|
+
const { indicatorStyle, fillStyle, isSelected } = useRadio();
|
|
40
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
41
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, ...rest, style: [indicatorStyle, styleProps, style], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
42
|
+
_chunkF6CQ6CBIcjs.SelectionFill,
|
|
43
|
+
{
|
|
44
|
+
isVisible: isSelected,
|
|
45
|
+
style: fillStyle,
|
|
46
|
+
animation,
|
|
47
|
+
children: _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Thumb, {})))
|
|
48
|
+
}
|
|
49
|
+
) });
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
RadioIndicator.displayName = "XAUI.Radio.Indicator";
|
|
53
|
+
function Thumb() {
|
|
54
|
+
const { thumbStyle } = useRadio();
|
|
55
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: thumbStyle });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/components/radio/radio-label.tsx
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var RadioLabel = _react.forwardRef.call(void 0, function RadioLabel2({ children, style, ...props }, ref) {
|
|
63
|
+
const { labelStyle } = useRadio();
|
|
64
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
65
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [labelStyle, styleProps, style], ...rest, children });
|
|
66
|
+
});
|
|
67
|
+
RadioLabel.displayName = "XAUI.Radio.Label";
|
|
68
|
+
|
|
69
|
+
// src/components/radio/radio.tsx
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// src/components/radio/radio.recipe.ts
|
|
73
|
+
var SLOTS = ["root", "indicator", "fill", "thumb", "label"];
|
|
74
|
+
var VARIANT_TOKENS = {
|
|
75
|
+
primary: {
|
|
76
|
+
bg: "fieldBackground",
|
|
77
|
+
border: "fieldBorder",
|
|
78
|
+
bgSelected: "accent",
|
|
79
|
+
fgSelected: "accentForeground"
|
|
80
|
+
},
|
|
81
|
+
secondary: {
|
|
82
|
+
bg: "default",
|
|
83
|
+
border: "fieldBorder",
|
|
84
|
+
bgSelected: "accent",
|
|
85
|
+
fgSelected: "accentForeground"
|
|
86
|
+
},
|
|
87
|
+
tertiary: {
|
|
88
|
+
border: "fieldBorder",
|
|
89
|
+
bgSelected: "accent",
|
|
90
|
+
fgSelected: "accentForeground"
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
function sizeAxis(step) {
|
|
94
|
+
const { box, label, gap } = step;
|
|
95
|
+
return (theme) => {
|
|
96
|
+
const side = theme.spacing(box);
|
|
97
|
+
const dot = Math.round(side * THUMB_RATIO);
|
|
98
|
+
return {
|
|
99
|
+
root: { gap: theme.spacing(gap) },
|
|
100
|
+
indicator: { width: side, height: side },
|
|
101
|
+
thumb: { width: dot, height: dot, borderRadius: dot / 2 },
|
|
102
|
+
label: {
|
|
103
|
+
fontSize: theme.fontSizes[label],
|
|
104
|
+
lineHeight: theme.lineHeights[label]
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
var THUMB_RATIO = 10 / 24;
|
|
110
|
+
var SIZES = {
|
|
111
|
+
sm: { box: 5, gap: 2, label: "sm" },
|
|
112
|
+
md: { box: 6, gap: 2, label: "md" },
|
|
113
|
+
lg: { box: 7, gap: 2.5, label: "lg" }
|
|
114
|
+
};
|
|
115
|
+
var radioRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
116
|
+
slots: SLOTS,
|
|
117
|
+
base: (theme) => ({
|
|
118
|
+
root: { flexDirection: "row", alignItems: "center", alignSelf: "flex-start" },
|
|
119
|
+
indicator: {
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
justifyContent: "center",
|
|
122
|
+
borderWidth: theme.borderWidth.field,
|
|
123
|
+
// The one shape decision this component makes, and the whole difference between it
|
|
124
|
+
// and the `Checkbox`: a radio is round, at every size. `radius` still overrides it.
|
|
125
|
+
borderRadius: theme.radius.full,
|
|
126
|
+
overflow: "hidden"
|
|
127
|
+
},
|
|
128
|
+
fill: {
|
|
129
|
+
position: "absolute",
|
|
130
|
+
top: 0,
|
|
131
|
+
bottom: 0,
|
|
132
|
+
start: 0,
|
|
133
|
+
end: 0,
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
justifyContent: "center"
|
|
136
|
+
},
|
|
137
|
+
label: {
|
|
138
|
+
fontFamily: theme.fontFamilies.body,
|
|
139
|
+
color: theme.colors.foreground
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
variantTokens: VARIANT_TOKENS,
|
|
143
|
+
/** The `Checkbox`'s paint, with a dot where the check was. */
|
|
144
|
+
paint: (theme, colors) => ({
|
|
145
|
+
indicator: {
|
|
146
|
+
backgroundColor: colors.bg,
|
|
147
|
+
borderColor: colors.border,
|
|
148
|
+
borderWidth: colors.border ? theme.borderWidth.field : 0
|
|
149
|
+
},
|
|
150
|
+
fill: { backgroundColor: colors.bgSelected },
|
|
151
|
+
thumb: { backgroundColor: colors.fgSelected }
|
|
152
|
+
}),
|
|
153
|
+
variants: {
|
|
154
|
+
size: {
|
|
155
|
+
sm: sizeAxis(SIZES.sm),
|
|
156
|
+
md: sizeAxis(SIZES.md),
|
|
157
|
+
lg: sizeAxis(SIZES.lg)
|
|
158
|
+
},
|
|
159
|
+
radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "indicator"),
|
|
160
|
+
/** Declared after `size` so its border wins. The `Checkbox`'s rule, to the letter. */
|
|
161
|
+
isInvalid: {
|
|
162
|
+
true: (theme) => ({
|
|
163
|
+
indicator: { borderColor: theme.colors.danger, backgroundColor: void 0 },
|
|
164
|
+
fill: { backgroundColor: theme.colors.danger },
|
|
165
|
+
thumb: { backgroundColor: theme.colors.dangerForeground },
|
|
166
|
+
label: { color: theme.colors.danger }
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
compoundVariants: [
|
|
171
|
+
{
|
|
172
|
+
when: { variant: "primary" },
|
|
173
|
+
style: (theme) => ({ indicator: theme.shadows.field })
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
states: {
|
|
177
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
178
|
+
},
|
|
179
|
+
defaultVariants: { variant: "secondary", size: "md" }
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// src/components/radio/radio.tsx
|
|
183
|
+
|
|
184
|
+
var RadioRoot = _react.forwardRef.call(void 0, function Radio({
|
|
185
|
+
children,
|
|
186
|
+
variant,
|
|
187
|
+
size,
|
|
188
|
+
radius,
|
|
189
|
+
color,
|
|
190
|
+
isSelected,
|
|
191
|
+
defaultSelected = false,
|
|
192
|
+
onSelectedChange,
|
|
193
|
+
isInvalid = false,
|
|
194
|
+
isDisabled = false,
|
|
195
|
+
asChild = false,
|
|
196
|
+
accessibilityRole,
|
|
197
|
+
accessibilityState,
|
|
198
|
+
animation,
|
|
199
|
+
style,
|
|
200
|
+
onPress,
|
|
201
|
+
onPressIn,
|
|
202
|
+
onPressOut,
|
|
203
|
+
...props
|
|
204
|
+
}, ref) {
|
|
205
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
206
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
207
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
208
|
+
const [selected, setSelected] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
209
|
+
value: isSelected,
|
|
210
|
+
defaultValue: defaultSelected,
|
|
211
|
+
onChange: onSelectedChange
|
|
212
|
+
});
|
|
213
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
214
|
+
(event) => {
|
|
215
|
+
setSelected(true);
|
|
216
|
+
_optionalChain([onPress, 'optionalCall', _ => _(event)]);
|
|
217
|
+
},
|
|
218
|
+
[setSelected, onPress]
|
|
219
|
+
);
|
|
220
|
+
const selection = {
|
|
221
|
+
variant,
|
|
222
|
+
size,
|
|
223
|
+
radius,
|
|
224
|
+
isInvalid: isInvalid ? "true" : void 0
|
|
225
|
+
};
|
|
226
|
+
const states = { pressed: isPressed, disabled: isDisabled };
|
|
227
|
+
const styles = radioRecipe.resolve({ theme, selection, states });
|
|
228
|
+
const tint = color && !isInvalid ? radioRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
229
|
+
const context = _react.useMemo.call(void 0,
|
|
230
|
+
() => ({
|
|
231
|
+
// The tint never reaches the circle at rest — only the fill and the dot that say it
|
|
232
|
+
// is the chosen one. The `Checkbox` says why, at the same line.
|
|
233
|
+
indicatorStyle: styles.indicator,
|
|
234
|
+
fillStyle: tint ? [styles.fill, tint.fill] : styles.fill,
|
|
235
|
+
thumbStyle: tint ? [styles.thumb, tint.thumb] : styles.thumb,
|
|
236
|
+
labelStyle: styles.label,
|
|
237
|
+
isSelected: selected,
|
|
238
|
+
isDisabled,
|
|
239
|
+
isInvalid
|
|
240
|
+
}),
|
|
241
|
+
[styles, tint, selected, isDisabled, isInvalid]
|
|
242
|
+
);
|
|
243
|
+
const rootStyle = [
|
|
244
|
+
styles.root,
|
|
245
|
+
_optionalChain([tint, 'optionalAccess', _2 => _2.root]),
|
|
246
|
+
styleProps,
|
|
247
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
248
|
+
];
|
|
249
|
+
const text = _chunk7GHM4GKLcjs.childrenToString.call(void 0, children);
|
|
250
|
+
const content = text !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
251
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, RadioIndicator, {}),
|
|
252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, RadioLabel, { children: text })
|
|
253
|
+
] }) : _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RadioIndicator, {})));
|
|
254
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RadioProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
255
|
+
_chunk3E7CDKFOcjs.PressableFeedback,
|
|
256
|
+
{
|
|
257
|
+
ref,
|
|
258
|
+
isPressed,
|
|
259
|
+
isDisabled,
|
|
260
|
+
asChild,
|
|
261
|
+
animation,
|
|
262
|
+
accessibilityRole: _nullishCoalesce(accessibilityRole, () => ( "radio")),
|
|
263
|
+
accessibilityState: {
|
|
264
|
+
checked: selected,
|
|
265
|
+
disabled: isDisabled,
|
|
266
|
+
...accessibilityState
|
|
267
|
+
},
|
|
268
|
+
"aria-invalid": isInvalid,
|
|
269
|
+
...rest,
|
|
270
|
+
style: rootStyle,
|
|
271
|
+
onPress: handlePress,
|
|
272
|
+
onPressIn: press.onPressIn,
|
|
273
|
+
onPressOut: press.onPressOut,
|
|
274
|
+
children: asChild ? children : content
|
|
275
|
+
}
|
|
276
|
+
) });
|
|
277
|
+
});
|
|
278
|
+
RadioRoot.displayName = "XAUI.Radio.Root";
|
|
279
|
+
|
|
280
|
+
// src/components/radio/index.ts
|
|
281
|
+
var Radio2 = Object.assign(RadioRoot, {
|
|
282
|
+
Indicator: RadioIndicator,
|
|
283
|
+
Label: RadioLabel
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
exports.useRadio = useRadio; exports.RadioIndicator = RadioIndicator; exports.RadioLabel = RadioLabel; exports.radioRecipe = radioRecipe; exports.RadioRoot = RadioRoot; exports.Radio = Radio2;
|