@tamagui/radio-group 1.13.3 → 1.13.4
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/cjs/RadioGroup.js +1 -393
- package/dist/cjs/RadioGroup.js.map +2 -2
- package/dist/cjs/index.js +1 -18
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/RadioGroup.js +1 -365
- package/dist/esm/RadioGroup.js.map +2 -2
- package/dist/esm/RadioGroup.mjs +1 -365
- package/dist/esm/RadioGroup.mjs.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/jsx/RadioGroup.js +1 -341
- package/dist/jsx/RadioGroup.js.map +2 -2
- package/dist/jsx/RadioGroup.mjs +1 -341
- package/dist/jsx/RadioGroup.mjs.map +2 -2
- package/dist/jsx/index.js +1 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +1 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/cjs/RadioGroup.js
CHANGED
|
@@ -1,394 +1,2 @@
|
|
|
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
|
-
var RadioGroup_exports = {};
|
|
30
|
-
__export(RadioGroup_exports, {
|
|
31
|
-
RadioGroup: () => RadioGroup,
|
|
32
|
-
createRadioGroupScope: () => createRadioGroupScope
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(RadioGroup_exports);
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react_use_previous = require("@radix-ui/react-use-previous");
|
|
37
|
-
var import_core = require("@tamagui/core");
|
|
38
|
-
var import_create_context = require("@tamagui/create-context");
|
|
39
|
-
var import_focusable = require("@tamagui/focusable");
|
|
40
|
-
var import_get_size = require("@tamagui/get-size");
|
|
41
|
-
var import_label = require("@tamagui/label");
|
|
42
|
-
var import_stacks = require("@tamagui/stacks");
|
|
43
|
-
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
44
|
-
var React = __toESM(require("react"));
|
|
45
|
-
const RADIO_GROUP_NAME = "RadioGroup";
|
|
46
|
-
const ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
47
|
-
const [createRadioGroupContext, createRadioGroupScope] = (0, import_create_context.createContextScope)(RADIO_GROUP_NAME);
|
|
48
|
-
const [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME);
|
|
49
|
-
const getState = (checked) => {
|
|
50
|
-
return checked ? "checked" : "unchecked";
|
|
51
|
-
};
|
|
52
|
-
const RADIO_GROUP_INDICATOR_NAME = "RadioGroupIndicator";
|
|
53
|
-
const RadioIndicatorFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
54
|
-
name: RADIO_GROUP_INDICATOR_NAME,
|
|
55
|
-
variants: {
|
|
56
|
-
unstyled: {
|
|
57
|
-
false: {
|
|
58
|
-
w: "40%",
|
|
59
|
-
h: "40%",
|
|
60
|
-
br: 1e3,
|
|
61
|
-
backgroundColor: "$color",
|
|
62
|
-
pressTheme: true,
|
|
63
|
-
pressStyle: {
|
|
64
|
-
backgroundColor: "$colorTransparent"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
defaultVariants: {
|
|
70
|
-
unstyled: false
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const RadioIndicator = RadioIndicatorFrame.extractable(
|
|
74
|
-
React.forwardRef(
|
|
75
|
-
(props, forwardedRef) => {
|
|
76
|
-
const { __scopeRadioGroupItem, forceMount, disabled, ...indicatorProps } = props;
|
|
77
|
-
const { checked } = useRadioGroupItemContext(
|
|
78
|
-
RADIO_GROUP_INDICATOR_NAME,
|
|
79
|
-
__scopeRadioGroupItem
|
|
80
|
-
);
|
|
81
|
-
if (forceMount || checked) {
|
|
82
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
-
RadioIndicatorFrame,
|
|
84
|
-
{
|
|
85
|
-
theme: "active",
|
|
86
|
-
"data-state": getState(checked),
|
|
87
|
-
"data-disabled": disabled ? "" : void 0,
|
|
88
|
-
...indicatorProps,
|
|
89
|
-
ref: forwardedRef
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
);
|
|
97
|
-
RadioIndicator.displayName = RADIO_GROUP_INDICATOR_NAME;
|
|
98
|
-
const RADIO_GROUP_ITEM_NAME = "RadioGroupItem";
|
|
99
|
-
const [RadioGroupItemProvider, useRadioGroupItemContext] = createRadioGroupContext(RADIO_GROUP_NAME);
|
|
100
|
-
const RadioGroupItemFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
101
|
-
name: RADIO_GROUP_ITEM_NAME,
|
|
102
|
-
tag: "button",
|
|
103
|
-
variants: {
|
|
104
|
-
unstyled: {
|
|
105
|
-
false: {
|
|
106
|
-
size: "$true",
|
|
107
|
-
borderRadius: 1e3,
|
|
108
|
-
backgroundColor: "$background",
|
|
109
|
-
alignItems: "center",
|
|
110
|
-
justifyContent: "center",
|
|
111
|
-
borderWidth: 1,
|
|
112
|
-
borderColor: "$borderColor",
|
|
113
|
-
padding: 0,
|
|
114
|
-
hoverStyle: {
|
|
115
|
-
borderColor: "$borderColorHover",
|
|
116
|
-
background: "$backgroundHover"
|
|
117
|
-
},
|
|
118
|
-
focusStyle: {
|
|
119
|
-
borderColor: "$borderColorHover",
|
|
120
|
-
background: "$backgroundHover"
|
|
121
|
-
},
|
|
122
|
-
pressStyle: {
|
|
123
|
-
borderColor: "$borderColorFocus",
|
|
124
|
-
background: "$backgroundFocus"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
size: {
|
|
129
|
-
"...size": (value, { props }) => {
|
|
130
|
-
const size = Math.floor(
|
|
131
|
-
(0, import_core.getVariableValue)((0, import_get_size.getSize)(value)) * (props["scaleSize"] ?? 0.5)
|
|
132
|
-
);
|
|
133
|
-
return {
|
|
134
|
-
width: size,
|
|
135
|
-
height: size
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
defaultVariants: {
|
|
141
|
-
unstyled: false
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
const RadioGroupItem = RadioGroupItemFrame.extractable(
|
|
145
|
-
React.forwardRef(
|
|
146
|
-
(props, forwardedRef) => {
|
|
147
|
-
const {
|
|
148
|
-
__scopeRadioGroup,
|
|
149
|
-
value,
|
|
150
|
-
labelledBy: ariaLabelledby,
|
|
151
|
-
disabled: itemDisabled,
|
|
152
|
-
...itemProps
|
|
153
|
-
} = props;
|
|
154
|
-
const {
|
|
155
|
-
value: groupValue,
|
|
156
|
-
disabled,
|
|
157
|
-
required,
|
|
158
|
-
onChange,
|
|
159
|
-
name,
|
|
160
|
-
native,
|
|
161
|
-
accentColor
|
|
162
|
-
} = useRadioGroupContext(RADIO_GROUP_ITEM_NAME, __scopeRadioGroup);
|
|
163
|
-
const [button, setButton] = React.useState(null);
|
|
164
|
-
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
165
|
-
const ref = React.useRef(null);
|
|
166
|
-
const composedRefs = (0, import_core.useComposedRefs)(forwardedRef, (node) => setButton(node), ref);
|
|
167
|
-
const isArrowKeyPressedRef = React.useRef(false);
|
|
168
|
-
const isFormControl = import_core.isWeb ? button ? Boolean(button.closest("form")) : true : false;
|
|
169
|
-
const checked = groupValue === value;
|
|
170
|
-
const labelId = (0, import_label.useLabelContext)(button);
|
|
171
|
-
const labelledBy = ariaLabelledby || labelId;
|
|
172
|
-
React.useEffect(() => {
|
|
173
|
-
if (import_core.isWeb) {
|
|
174
|
-
const handleKeyDown = (event) => {
|
|
175
|
-
if (ARROW_KEYS.includes(event.key)) {
|
|
176
|
-
isArrowKeyPressedRef.current = true;
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
const handleKeyUp = () => isArrowKeyPressedRef.current = false;
|
|
180
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
181
|
-
document.addEventListener("keyup", handleKeyUp);
|
|
182
|
-
return () => {
|
|
183
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
184
|
-
document.removeEventListener("keyup", handleKeyUp);
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}, []);
|
|
188
|
-
if (process.env.TAMAGUI_TARGET === "native") {
|
|
189
|
-
React.useEffect(() => {
|
|
190
|
-
if (!props.id)
|
|
191
|
-
return;
|
|
192
|
-
return (0, import_focusable.registerFocusable)(props.id, {
|
|
193
|
-
focusAndSelect: () => {
|
|
194
|
-
onChange == null ? void 0 : onChange(value);
|
|
195
|
-
},
|
|
196
|
-
focus: () => {
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}, [props.id, value]);
|
|
200
|
-
}
|
|
201
|
-
const isDisabled = disabled || itemDisabled;
|
|
202
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItemProvider, { checked, scope: __scopeRadioGroup, children: import_core.isWeb && native ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
203
|
-
BubbleInput,
|
|
204
|
-
{
|
|
205
|
-
control: button,
|
|
206
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
207
|
-
name,
|
|
208
|
-
value,
|
|
209
|
-
checked,
|
|
210
|
-
required,
|
|
211
|
-
disabled: isDisabled,
|
|
212
|
-
id: props.id,
|
|
213
|
-
accentColor
|
|
214
|
-
}
|
|
215
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
216
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
217
|
-
RadioGroupItemFrame,
|
|
218
|
-
{
|
|
219
|
-
"data-state": getState(checked),
|
|
220
|
-
"data-disabled": isDisabled ? "" : void 0,
|
|
221
|
-
role: "radio",
|
|
222
|
-
"aria-labelledby": labelledBy,
|
|
223
|
-
"aria-checked": checked,
|
|
224
|
-
"aria-required": required,
|
|
225
|
-
disabled: isDisabled,
|
|
226
|
-
ref: composedRefs,
|
|
227
|
-
...import_core.isWeb && {
|
|
228
|
-
type: "button",
|
|
229
|
-
value
|
|
230
|
-
},
|
|
231
|
-
...itemProps,
|
|
232
|
-
onPress: (0, import_core.composeEventHandlers)(props.onPress, (event) => {
|
|
233
|
-
if (!checked) {
|
|
234
|
-
onChange == null ? void 0 : onChange(value);
|
|
235
|
-
}
|
|
236
|
-
if (isFormControl) {
|
|
237
|
-
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
238
|
-
if (!hasConsumerStoppedPropagationRef.current)
|
|
239
|
-
event.stopPropagation();
|
|
240
|
-
}
|
|
241
|
-
}),
|
|
242
|
-
...import_core.isWeb && {
|
|
243
|
-
onKeyDown: (0, import_core.composeEventHandlers)(
|
|
244
|
-
props.onKeyDown,
|
|
245
|
-
(event) => {
|
|
246
|
-
if (event.key === "Enter")
|
|
247
|
-
event.preventDefault();
|
|
248
|
-
}
|
|
249
|
-
),
|
|
250
|
-
onFocus: (0, import_core.composeEventHandlers)(itemProps.onFocus, () => {
|
|
251
|
-
var _a;
|
|
252
|
-
if (isArrowKeyPressedRef.current)
|
|
253
|
-
(_a = ref.current) == null ? void 0 : _a.click();
|
|
254
|
-
})
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
),
|
|
258
|
-
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
259
|
-
BubbleInput,
|
|
260
|
-
{
|
|
261
|
-
isHidden: true,
|
|
262
|
-
control: button,
|
|
263
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
264
|
-
name,
|
|
265
|
-
value,
|
|
266
|
-
checked,
|
|
267
|
-
required,
|
|
268
|
-
disabled: isDisabled
|
|
269
|
-
}
|
|
270
|
-
)
|
|
271
|
-
] }) });
|
|
272
|
-
}
|
|
273
|
-
)
|
|
274
|
-
);
|
|
275
|
-
const BubbleInput = (props) => {
|
|
276
|
-
const { checked, bubbles = true, control, isHidden, accentColor, ...inputProps } = props;
|
|
277
|
-
const ref = React.useRef(null);
|
|
278
|
-
const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
|
|
279
|
-
React.useEffect(() => {
|
|
280
|
-
const input = ref.current;
|
|
281
|
-
const inputProto = window.HTMLInputElement.prototype;
|
|
282
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
283
|
-
inputProto,
|
|
284
|
-
"checked"
|
|
285
|
-
);
|
|
286
|
-
const setChecked = descriptor.set;
|
|
287
|
-
if (prevChecked !== checked && setChecked) {
|
|
288
|
-
const event = new Event("click", { bubbles });
|
|
289
|
-
setChecked.call(input, checked);
|
|
290
|
-
input.dispatchEvent(event);
|
|
291
|
-
}
|
|
292
|
-
}, [prevChecked, checked, bubbles]);
|
|
293
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
294
|
-
"input",
|
|
295
|
-
{
|
|
296
|
-
type: "radio",
|
|
297
|
-
defaultChecked: checked,
|
|
298
|
-
...inputProps,
|
|
299
|
-
tabIndex: -1,
|
|
300
|
-
ref,
|
|
301
|
-
"aria-hidden": isHidden,
|
|
302
|
-
style: {
|
|
303
|
-
...isHidden ? {
|
|
304
|
-
// ...controlSize,
|
|
305
|
-
position: "absolute",
|
|
306
|
-
pointerEvents: "none",
|
|
307
|
-
opacity: 0,
|
|
308
|
-
margin: 0
|
|
309
|
-
} : {
|
|
310
|
-
appearance: "auto",
|
|
311
|
-
accentColor
|
|
312
|
-
},
|
|
313
|
-
...props.style
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
);
|
|
317
|
-
};
|
|
318
|
-
const RadioGroupFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
319
|
-
name: RADIO_GROUP_NAME,
|
|
320
|
-
variants: {
|
|
321
|
-
orientation: {
|
|
322
|
-
horizontal: {
|
|
323
|
-
flexDirection: "row",
|
|
324
|
-
spaceDirection: "horizontal"
|
|
325
|
-
},
|
|
326
|
-
vertical: {
|
|
327
|
-
flexDirection: "column",
|
|
328
|
-
spaceDirection: "vertical"
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
const RadioGroup = (0, import_core.withStaticProperties)(
|
|
334
|
-
RadioGroupFrame.extractable(
|
|
335
|
-
React.forwardRef(
|
|
336
|
-
(props, forwardedRef) => {
|
|
337
|
-
const {
|
|
338
|
-
__scopeRadioGroup,
|
|
339
|
-
value: valueProp,
|
|
340
|
-
defaultValue,
|
|
341
|
-
onValueChange,
|
|
342
|
-
disabled = false,
|
|
343
|
-
required = false,
|
|
344
|
-
name,
|
|
345
|
-
orientation,
|
|
346
|
-
native,
|
|
347
|
-
accentColor,
|
|
348
|
-
...radioGroupProps
|
|
349
|
-
} = props;
|
|
350
|
-
const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
351
|
-
prop: valueProp,
|
|
352
|
-
defaultProp: defaultValue,
|
|
353
|
-
onChange: onValueChange
|
|
354
|
-
});
|
|
355
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
356
|
-
RadioGroupProvider,
|
|
357
|
-
{
|
|
358
|
-
scope: __scopeRadioGroup,
|
|
359
|
-
value,
|
|
360
|
-
required,
|
|
361
|
-
onChange: setValue,
|
|
362
|
-
disabled,
|
|
363
|
-
name,
|
|
364
|
-
native,
|
|
365
|
-
accentColor,
|
|
366
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
367
|
-
RadioGroupFrame,
|
|
368
|
-
{
|
|
369
|
-
"aria-valuetext": value,
|
|
370
|
-
role: "radiogroup",
|
|
371
|
-
"aria-orientation": orientation,
|
|
372
|
-
ref: forwardedRef,
|
|
373
|
-
orientation,
|
|
374
|
-
"data-disabled": disabled ? "" : void 0,
|
|
375
|
-
...radioGroupProps
|
|
376
|
-
}
|
|
377
|
-
)
|
|
378
|
-
}
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
)
|
|
382
|
-
),
|
|
383
|
-
{
|
|
384
|
-
Indicator: RadioIndicator,
|
|
385
|
-
Item: RadioGroupItem
|
|
386
|
-
}
|
|
387
|
-
);
|
|
388
|
-
RadioGroup.displayName = RADIO_GROUP_NAME;
|
|
389
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
390
|
-
0 && (module.exports = {
|
|
391
|
-
RadioGroup,
|
|
392
|
-
createRadioGroupScope
|
|
393
|
-
});
|
|
1
|
+
"use strict";var X=Object.create;var h=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var re=(e,o)=>{for(var t in o)h(e,t,{get:o[t],enumerable:!0})},M=(e,o,t,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of ee(o))!te.call(e,n)&&n!==t&&h(e,n,{get:()=>o[n],enumerable:!(a=Z(o,n))||a.enumerable});return e};var ae=(e,o,t)=>(t=e!=null?X(oe(e)):{},M(o||!e||!e.__esModule?h(t,"default",{value:e,enumerable:!0}):t,e)),ne=e=>M(h({},"__esModule",{value:!0}),e);var pe={};re(pe,{RadioGroup:()=>w,createRadioGroupScope:()=>N});module.exports=ne(pe);var d=require("react/jsx-runtime"),O=require("@radix-ui/react-use-previous"),r=require("@tamagui/core"),$=require("@tamagui/create-context"),q=require("@tamagui/focusable"),z=require("@tamagui/get-size"),K=require("@tamagui/label"),C=require("@tamagui/stacks"),U=require("@tamagui/use-controllable-state"),s=ae(require("react"));const G="RadioGroup",ie=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],[_,N]=(0,$.createContextScope)(G),[de,se]=_(G),L=e=>e?"checked":"unchecked",k="RadioGroupIndicator",x=(0,r.styled)(C.ThemeableStack,{name:k,variants:{unstyled:{false:{w:"40%",h:"40%",br:1e3,backgroundColor:"$color",pressTheme:!0,pressStyle:{backgroundColor:"$colorTransparent"}}}},defaultVariants:{unstyled:!1}}),D=x.extractable(s.forwardRef((e,o)=>{const{__scopeRadioGroupItem:t,forceMount:a,disabled:n,...p}=e,{checked:l}=ce(k,t);return a||l?(0,d.jsx)(x,{theme:"active","data-state":L(l),"data-disabled":n?"":void 0,...p,ref:o}):null}));D.displayName=k;const A="RadioGroupItem",[le,ce]=_(G),V=(0,r.styled)(C.ThemeableStack,{name:A,tag:"button",variants:{unstyled:{false:{size:"$true",borderRadius:1e3,backgroundColor:"$background",alignItems:"center",justifyContent:"center",borderWidth:1,borderColor:"$borderColor",padding:0,hoverStyle:{borderColor:"$borderColorHover",background:"$backgroundHover"},focusStyle:{borderColor:"$borderColorHover",background:"$backgroundHover"},pressStyle:{borderColor:"$borderColorFocus",background:"$backgroundFocus"}}},size:{"...size":(e,{props:o})=>{const t=Math.floor((0,r.getVariableValue)((0,z.getSize)(e))*(o.scaleSize??.5));return{width:t,height:t}}}},defaultVariants:{unstyled:!1}}),ue=V.extractable(s.forwardRef((e,o)=>{const{__scopeRadioGroup:t,value:a,labelledBy:n,disabled:p,...l}=e,{value:b,disabled:f,required:u,onChange:c,name:P,native:R,accentColor:y}=se(A,t),[m,W]=s.useState(null),I=s.useRef(!1),S=s.useRef(null),j=(0,r.useComposedRefs)(o,i=>W(i),S),E=s.useRef(!1),T=r.isWeb?m?Boolean(m.closest("form")):!0:!1,v=b===a,Y=(0,K.useLabelContext)(m),J=n||Y;s.useEffect(()=>{if(r.isWeb){const i=Q=>{ie.includes(Q.key)&&(E.current=!0)},H=()=>E.current=!1;return document.addEventListener("keydown",i),document.addEventListener("keyup",H),()=>{document.removeEventListener("keydown",i),document.removeEventListener("keyup",H)}}},[]),process.env.TAMAGUI_TARGET==="native"&&s.useEffect(()=>{if(e.id)return(0,q.registerFocusable)(e.id,{focusAndSelect:()=>{c==null||c(a)},focus:()=>{}})},[e.id,a]);const g=f||p;return(0,d.jsx)(le,{checked:v,scope:t,children:r.isWeb&&R?(0,d.jsx)(B,{control:m,bubbles:!I.current,name:P,value:a,checked:v,required:u,disabled:g,id:e.id,accentColor:y}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(V,{"data-state":L(v),"data-disabled":g?"":void 0,role:"radio","aria-labelledby":J,"aria-checked":v,"aria-required":u,disabled:g,ref:j,...r.isWeb&&{type:"button",value:a},...l,onPress:(0,r.composeEventHandlers)(e.onPress,i=>{v||c==null||c(a),T&&(I.current=i.isPropagationStopped(),I.current||i.stopPropagation())}),...r.isWeb&&{onKeyDown:(0,r.composeEventHandlers)(e.onKeyDown,i=>{i.key==="Enter"&&i.preventDefault()}),onFocus:(0,r.composeEventHandlers)(l.onFocus,()=>{var i;E.current&&((i=S.current)==null||i.click())})}}),T&&(0,d.jsx)(B,{isHidden:!0,control:m,bubbles:!I.current,name:P,value:a,checked:v,required:u,disabled:g})]})})})),B=e=>{const{checked:o,bubbles:t=!0,control:a,isHidden:n,accentColor:p,...l}=e,b=s.useRef(null),f=(0,O.usePrevious)(o);return s.useEffect(()=>{const u=b.current,c=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(c,"checked").set;if(f!==o&&R){const y=new Event("click",{bubbles:t});R.call(u,o),u.dispatchEvent(y)}},[f,o,t]),(0,d.jsx)("input",{type:"radio",defaultChecked:o,...l,tabIndex:-1,ref:b,"aria-hidden":n,style:{...n?{position:"absolute",pointerEvents:"none",opacity:0,margin:0}:{appearance:"auto",accentColor:p},...e.style}})},F=(0,r.styled)(C.ThemeableStack,{name:G,variants:{orientation:{horizontal:{flexDirection:"row",spaceDirection:"horizontal"},vertical:{flexDirection:"column",spaceDirection:"vertical"}}}}),w=(0,r.withStaticProperties)(F.extractable(s.forwardRef((e,o)=>{const{__scopeRadioGroup:t,value:a,defaultValue:n,onValueChange:p,disabled:l=!1,required:b=!1,name:f,orientation:u,native:c,accentColor:P,...R}=e,[y,m]=(0,U.useControllableState)({prop:a,defaultProp:n,onChange:p});return(0,d.jsx)(de,{scope:t,value:y,required:b,onChange:m,disabled:l,name:f,native:c,accentColor:P,children:(0,d.jsx)(F,{"aria-valuetext":y,role:"radiogroup","aria-orientation":u,ref:o,orientation:u,"data-disabled":l?"":void 0,...R})})})),{Indicator:D,Item:ue});w.displayName=G;0&&(module.exports={RadioGroup,createRadioGroupScope});
|
|
394
2
|
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/RadioGroup.tsx"],
|
|
4
4
|
"sourcesContent": ["// forked from Radix UI\n// https://github.com/radix-ui/primitives/blob/main/packages/react/radio-group/src/RadioGroup.tsx\n\nimport { usePrevious } from '@radix-ui/react-use-previous'\nimport {\n GetProps,\n composeEventHandlers,\n getVariableValue,\n isWeb,\n styled,\n useComposedRefs,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport { registerFocusable } from '@tamagui/focusable'\nimport { getSize, stepTokenUpOrDown } from '@tamagui/get-size'\nimport { useLabelContext } from '@tamagui/label'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { View } from 'react-native'\n\nconst RADIO_GROUP_NAME = 'RadioGroup'\n\nconst ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']\n\nconst [createRadioGroupContext, createRadioGroupScope] =\n createContextScope(RADIO_GROUP_NAME)\ntype RadioGroupContextValue = {\n value?: string\n disabled?: boolean\n required?: boolean\n onChange?: (value: string) => void\n name?: string\n native?: boolean\n accentColor?: string\n}\nconst [RadioGroupProvider, useRadioGroupContext] =\n createRadioGroupContext<RadioGroupContextValue>(RADIO_GROUP_NAME)\n\nconst getState = (checked: boolean) => {\n return checked ? 'checked' : 'unchecked'\n}\n\n/* -------------------------------------------------------------------------\n * RadioIndicator\n * ------------------------------------------------------------------------ */\n\nconst RADIO_GROUP_INDICATOR_NAME = 'RadioGroupIndicator'\n\nconst RadioIndicatorFrame = styled(ThemeableStack, {\n name: RADIO_GROUP_INDICATOR_NAME,\n\n variants: {\n unstyled: {\n false: {\n w: '40%',\n h: '40%',\n br: 1000,\n backgroundColor: '$color',\n pressTheme: true,\n pressStyle: {\n backgroundColor: '$colorTransparent',\n },\n },\n },\n } as const,\n\n defaultVariants: {\n unstyled: false,\n },\n})\n\ntype RadioIndicatorProps = GetProps<typeof RadioIndicatorFrame> & {\n forceMount?: boolean\n unstyled?: boolean\n}\n\ntype RadioIndicatorElement = TamaguiElement\n\nconst RadioIndicator = RadioIndicatorFrame.extractable(\n React.forwardRef<RadioIndicatorElement, RadioIndicatorProps>(\n (props: ScopedRadioGroupItemProps<RadioIndicatorProps>, forwardedRef) => {\n const { __scopeRadioGroupItem, forceMount, disabled, ...indicatorProps } = props\n const { checked } = useRadioGroupItemContext(\n RADIO_GROUP_INDICATOR_NAME,\n __scopeRadioGroupItem\n )\n\n if (forceMount || checked) {\n return (\n <RadioIndicatorFrame\n theme=\"active\"\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n {...indicatorProps}\n ref={forwardedRef}\n />\n )\n }\n\n return null\n }\n )\n)\n\nRadioIndicator.displayName = RADIO_GROUP_INDICATOR_NAME\n\n/* -------------------------------------------------------------------------\n * RadioGroupItem\n * ------------------------------------------------------------------------ */\n\nconst RADIO_GROUP_ITEM_NAME = 'RadioGroupItem'\n\ntype RadioGroupItemContextValue = {\n checked: boolean\n disabled?: boolean\n}\n\nconst [RadioGroupItemProvider, useRadioGroupItemContext] =\n createRadioGroupContext<RadioGroupItemContextValue>(RADIO_GROUP_NAME)\n\nconst RadioGroupItemFrame = styled(ThemeableStack, {\n name: RADIO_GROUP_ITEM_NAME,\n tag: 'button',\n\n variants: {\n unstyled: {\n false: {\n size: '$true',\n borderRadius: 1000,\n backgroundColor: '$background',\n alignItems: 'center',\n justifyContent: 'center',\n borderWidth: 1,\n borderColor: '$borderColor',\n padding: 0,\n\n hoverStyle: {\n borderColor: '$borderColorHover',\n background: '$backgroundHover',\n },\n\n focusStyle: {\n borderColor: '$borderColorHover',\n background: '$backgroundHover',\n },\n\n pressStyle: {\n borderColor: '$borderColorFocus',\n background: '$backgroundFocus',\n },\n },\n },\n\n size: {\n '...size': (value, { props }) => {\n const size = Math.floor(\n getVariableValue(getSize(value)) * (props['scaleSize'] ?? 0.5)\n )\n return {\n width: size,\n height: size,\n }\n },\n },\n } as const,\n\n defaultVariants: {\n unstyled: false,\n },\n})\n\ntype RadioGroupItemProps = GetProps<typeof RadioGroupItemFrame> & {\n value: string\n id?: string\n labelledBy?: string\n disabled?: boolean\n}\n\ntype RadioGroupItemElement = HTMLButtonElement\n\ntype ScopedRadioGroupItemProps<P> = P & {\n __scopeRadioGroupItem?: Scope\n}\n\nconst RadioGroupItem = RadioGroupItemFrame.extractable(\n React.forwardRef<RadioGroupItemElement, RadioGroupItemProps>(\n (props: ScopedProps<RadioGroupItemProps>, forwardedRef) => {\n const {\n __scopeRadioGroup,\n value,\n labelledBy: ariaLabelledby,\n disabled: itemDisabled,\n ...itemProps\n } = props\n const {\n value: groupValue,\n disabled,\n required,\n onChange,\n name,\n native,\n accentColor,\n } = useRadioGroupContext(RADIO_GROUP_ITEM_NAME, __scopeRadioGroup)\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null)\n const hasConsumerStoppedPropagationRef = React.useRef(false)\n const ref = React.useRef<HTMLButtonElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node), ref)\n const isArrowKeyPressedRef = React.useRef(false)\n\n const isFormControl = isWeb\n ? button\n ? Boolean(button.closest('form'))\n : true\n : false\n\n const checked = groupValue === value\n\n const labelId = useLabelContext(button)\n const labelledBy = ariaLabelledby || labelId\n\n React.useEffect(() => {\n if (isWeb) {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (ARROW_KEYS.includes(event.key)) {\n isArrowKeyPressedRef.current = true\n }\n }\n const handleKeyUp = () => (isArrowKeyPressedRef.current = false)\n document.addEventListener('keydown', handleKeyDown)\n document.addEventListener('keyup', handleKeyUp)\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n document.removeEventListener('keyup', handleKeyUp)\n }\n }\n }, [])\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (!props.id) return\n return registerFocusable(props.id, {\n focusAndSelect: () => {\n onChange?.(value)\n },\n focus: () => {},\n })\n }, [props.id, value])\n }\n\n const isDisabled = disabled || itemDisabled\n\n return (\n <RadioGroupItemProvider checked={checked} scope={__scopeRadioGroup}>\n {isWeb && native ? (\n <BubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={isDisabled}\n id={props.id}\n accentColor={accentColor}\n />\n ) : (\n <>\n <RadioGroupItemFrame\n // theme={checked ? 'active' : undefined}\n data-state={getState(checked)}\n data-disabled={isDisabled ? '' : undefined}\n role=\"radio\"\n aria-labelledby={labelledBy}\n aria-checked={checked}\n aria-required={required}\n disabled={isDisabled}\n ref={composedRefs}\n {...(isWeb && {\n type: 'button',\n value: value,\n })}\n // allow them to override all but the handlers that already compose:\n {...itemProps}\n onPress={composeEventHandlers(props.onPress as any, (event) => {\n if (!checked) {\n onChange?.(value)\n }\n\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current =\n event.isPropagationStopped()\n // if radio is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect radio updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation()\n }\n })}\n {...(isWeb && {\n onKeyDown: composeEventHandlers(\n (props as React.HTMLProps<HTMLButtonElement>).onKeyDown,\n (event) => {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n if (event.key === 'Enter') event.preventDefault()\n }\n ),\n onFocus: composeEventHandlers(itemProps.onFocus, () => {\n /**\n * Our `RovingFocusGroup` will focus the radio when navigating with arrow keys\n * and we need to \"check\" it in that case. We click it to \"check\" it (instead\n * of updating `context.value`) so that the radio change event fires.\n */\n if (isArrowKeyPressedRef.current)\n (ref.current as HTMLButtonElement)?.click()\n }),\n })}\n />\n {isFormControl && (\n <BubbleInput\n isHidden\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={isDisabled}\n />\n )}\n </>\n )}\n </RadioGroupItemProvider>\n )\n }\n )\n)\n\n/* -------------------------------------------------------------------------\n * BubbleInput\n * ------------------------------------------------------------------------ */\n\ninterface BubbleInputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'checked'> {\n checked: boolean\n control: HTMLElement | null\n bubbles: boolean\n isHidden?: boolean\n accentColor?: string\n}\n\nconst BubbleInput = (props: BubbleInputProps) => {\n const { checked, bubbles = true, control, isHidden, accentColor, ...inputProps } = props\n const ref = React.useRef<HTMLInputElement>(null)\n const prevChecked = usePrevious(checked)\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = ref.current!\n const inputProto = window.HTMLInputElement.prototype\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n 'checked'\n ) as PropertyDescriptor\n const setChecked = descriptor.set\n if (prevChecked !== checked && setChecked) {\n const event = new Event('click', { bubbles })\n setChecked.call(input, checked)\n input.dispatchEvent(event)\n }\n }, [prevChecked, checked, bubbles])\n\n return (\n <input\n type=\"radio\"\n defaultChecked={checked}\n {...inputProps}\n tabIndex={-1}\n ref={ref}\n aria-hidden={isHidden}\n style={{\n ...(isHidden\n ? {\n // ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }\n : {\n appearance: 'auto',\n accentColor,\n }),\n\n ...props.style,\n }}\n />\n )\n}\n\n/* -------------------------------------------------------------------------\n * RadioGroup\n * ----------------------------------------------------------------------- */\n\ntype ScopedProps<P> = P & { __scopeRadioGroup?: Scope }\n\ntype TamaguiElement = HTMLElement | View\n\ntype RadioGroupElement = TamaguiElement\n\nconst RadioGroupFrame = styled(ThemeableStack, {\n name: RADIO_GROUP_NAME,\n\n variants: {\n orientation: {\n horizontal: {\n flexDirection: 'row',\n spaceDirection: 'horizontal',\n },\n vertical: {\n flexDirection: 'column',\n spaceDirection: 'vertical',\n },\n },\n } as const,\n})\n\ntype RadioGroupProps = GetProps<typeof RadioGroupFrame> & {\n value?: string\n defaultValue?: string\n onValueChange?: (value: string) => void\n required?: boolean\n disabled?: boolean\n name?: string\n native?: boolean\n accentColor?: string\n}\n\nconst RadioGroup = withStaticProperties(\n RadioGroupFrame.extractable(\n React.forwardRef<RadioGroupElement, RadioGroupProps>(\n (props: ScopedProps<RadioGroupProps>, forwardedRef) => {\n const {\n __scopeRadioGroup,\n value: valueProp,\n defaultValue,\n onValueChange,\n disabled = false,\n required = false,\n name,\n orientation,\n native,\n accentColor,\n ...radioGroupProps\n } = props\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue!,\n onChange: onValueChange,\n })\n\n return (\n <RadioGroupProvider\n scope={__scopeRadioGroup}\n value={value}\n required={required}\n onChange={setValue}\n disabled={disabled}\n name={name}\n native={native}\n accentColor={accentColor}\n >\n <RadioGroupFrame\n aria-valuetext={value}\n role=\"radiogroup\"\n aria-orientation={orientation}\n ref={forwardedRef}\n orientation={orientation}\n data-disabled={disabled ? '' : undefined}\n {...radioGroupProps}\n />\n </RadioGroupProvider>\n )\n }\n )\n ),\n {\n Indicator: RadioIndicator,\n Item: RadioGroupItem,\n }\n)\n\nRadioGroup.displayName = RADIO_GROUP_NAME\n\nexport { createRadioGroupScope, RadioGroup }\nexport type { RadioGroupProps }\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "mkBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,gBAAAE,EAAA,0BAAAC,IAAA,eAAAC,GAAAJ,IA2FU,IAAAK,EAAA,6BAxFVC,EAA4B,wCAC5BC,EAQO,yBACPC,EAA0C,mCAC1CC,EAAkC,8BAClCC,EAA2C,6BAC3CC,EAAgC,0BAChCC,EAA+B,2BAC/BC,EAAqC,2CACrCC,EAAuB,qBAGvB,MAAMC,EAAmB,aAEnBC,GAAa,CAAC,UAAW,YAAa,YAAa,Y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ACU,EAAO2C,CAAQ,KAAI,wBAAqB,CAC7C,KAAML,EACN,YAAaC,EACb,SAAUC,CACZ,CAAC,EAED,SACE,OAACzD,GAAA,CACC,MAAOoB,EACP,MAAOH,EACP,SAAUQ,EACV,SAAUmC,EACV,SAAUjD,EACV,KAAMgB,EACN,OAAQC,EACR,YAAaC,EAEb,mBAACyB,EAAA,CACC,iBAAgBrC,EAChB,KAAK,aACL,mBAAkByC,EAClB,IAAKlD,EACL,YAAakD,EACb,gBAAe/C,EAAW,GAAK,OAC9B,GAAGgD,EACN,EACF,CAEJ,CACF,CACF,EACA,CACE,UAAWrD,EACX,KAAMa,EACR,CACF,EAEAnC,EAAW,YAAca",
|
|
6
|
+
"names": ["RadioGroup_exports", "__export", "RadioGroup", "createRadioGroupScope", "__toCommonJS", "import_jsx_runtime", "import_react_use_previous", "import_core", "import_create_context", "import_focusable", "import_get_size", "import_label", "import_stacks", "import_use_controllable_state", "React", "RADIO_GROUP_NAME", "ARROW_KEYS", "createRadioGroupContext", "RadioGroupProvider", "useRadioGroupContext", "getState", "checked", "RADIO_GROUP_INDICATOR_NAME", "RadioIndicatorFrame", "RadioIndicator", "props", "forwardedRef", "__scopeRadioGroupItem", "forceMount", "disabled", "indicatorProps", "useRadioGroupItemContext", "RADIO_GROUP_ITEM_NAME", "RadioGroupItemProvider", "RadioGroupItemFrame", "value", "size", "RadioGroupItem", "__scopeRadioGroup", "ariaLabelledby", "itemDisabled", "itemProps", "groupValue", "required", "onChange", "name", "native", "accentColor", "button", "setButton", "hasConsumerStoppedPropagationRef", "ref", "composedRefs", "node", "isArrowKeyPressedRef", "isFormControl", "labelId", "labelledBy", "handleKeyDown", "event", "handleKeyUp", "isDisabled", "BubbleInput", "_a", "bubbles", "control", "isHidden", "inputProps", "prevChecked", "input", "inputProto", "setChecked", "RadioGroupFrame", "valueProp", "defaultValue", "onValueChange", "orientation", "radioGroupProps", "setValue"]
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var src_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(src_exports);
|
|
18
|
-
__reExport(src_exports, require("./RadioGroup"), module.exports);
|
|
1
|
+
"use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./RadioGroup"),module.exports);
|
|
19
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './RadioGroup'\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,wBAAd",
|
|
6
|
+
"names": ["src_exports", "__toCommonJS", "__reExport"]
|
|
7
7
|
}
|