@cfxjs/sirius-next-common 0.1.21 → 0.1.22
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-JC4IRQUL.js +10 -0
- package/dist/chunk-JC4IRQUL.js.map +1 -0
- package/dist/chunk-LODRRFZ2.js +40 -0
- package/dist/chunk-LODRRFZ2.js.map +1 -0
- package/dist/chunk-MDGKQBVR.js +1091 -0
- package/dist/chunk-MDGKQBVR.js.map +1 -0
- package/dist/chunk-OAPWRTVW.js +1091 -0
- package/dist/chunk-OAPWRTVW.js.map +1 -0
- package/dist/chunk-VMOMJ3B6.js +1095 -0
- package/dist/chunk-VMOMJ3B6.js.map +1 -0
- package/dist/chunk-WMBLMDER.js +1090 -0
- package/dist/chunk-WMBLMDER.js.map +1 -0
- package/dist/components/Radio/index.d.ts +22 -0
- package/dist/components/Radio/index.js +1107 -0
- package/dist/components/Radio/index.js.map +1 -0
- package/dist/components/Radio/radio.d.ts +8 -0
- package/dist/components/Radio/radio.js +15 -0
- package/dist/components/Radio/radio.js.map +1 -0
- package/dist/uno.css +20 -2
- package/package.json +3 -2
|
@@ -0,0 +1,1107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "../../chunk-Q3D6I5CY.js";
|
|
4
|
+
import "../../chunk-X4Z42UJ7.js";
|
|
5
|
+
import "../../chunk-ERTKZU2B.js";
|
|
6
|
+
|
|
7
|
+
// ../../node_modules/.pnpm/@radix-ui+react-radio-group@1.2.3_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18._7hoofqvtnex5636yqbwyqoruey/node_modules/@radix-ui/react-radio-group/dist/index.mjs
|
|
8
|
+
import * as React23 from "react";
|
|
9
|
+
|
|
10
|
+
// ../../node_modules/.pnpm/@radix-ui+primitive@1.1.1/node_modules/@radix-ui/primitive/dist/index.mjs
|
|
11
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
12
|
+
return function handleEvent(event) {
|
|
13
|
+
originalEventHandler?.(event);
|
|
14
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
15
|
+
return ourEventHandler?.(event);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ../../node_modules/.pnpm/@radix-ui+react-compose-refs@1.1.1_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
21
|
+
import * as React from "react";
|
|
22
|
+
function setRef(ref, value) {
|
|
23
|
+
if (typeof ref === "function") {
|
|
24
|
+
return ref(value);
|
|
25
|
+
} else if (ref !== null && ref !== void 0) {
|
|
26
|
+
ref.current = value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function composeRefs(...refs) {
|
|
30
|
+
return (node) => {
|
|
31
|
+
let hasCleanup = false;
|
|
32
|
+
const cleanups = refs.map((ref) => {
|
|
33
|
+
const cleanup = setRef(ref, node);
|
|
34
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
35
|
+
hasCleanup = true;
|
|
36
|
+
}
|
|
37
|
+
return cleanup;
|
|
38
|
+
});
|
|
39
|
+
if (hasCleanup) {
|
|
40
|
+
return () => {
|
|
41
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
42
|
+
const cleanup = cleanups[i];
|
|
43
|
+
if (typeof cleanup == "function") {
|
|
44
|
+
cleanup();
|
|
45
|
+
} else {
|
|
46
|
+
setRef(refs[i], null);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function useComposedRefs(...refs) {
|
|
54
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ../../node_modules/.pnpm/@radix-ui+react-context@1.1.1_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.mjs
|
|
58
|
+
import * as React2 from "react";
|
|
59
|
+
import { jsx } from "react/jsx-runtime";
|
|
60
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
61
|
+
let defaultContexts = [];
|
|
62
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
63
|
+
const BaseContext = React2.createContext(defaultContext);
|
|
64
|
+
const index = defaultContexts.length;
|
|
65
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
66
|
+
const Provider = (props) => {
|
|
67
|
+
const { scope, children, ...context } = props;
|
|
68
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
69
|
+
const value = React2.useMemo(() => context, Object.values(context));
|
|
70
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
71
|
+
};
|
|
72
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
73
|
+
function useContext22(consumerName, scope) {
|
|
74
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
75
|
+
const context = React2.useContext(Context);
|
|
76
|
+
if (context)
|
|
77
|
+
return context;
|
|
78
|
+
if (defaultContext !== void 0)
|
|
79
|
+
return defaultContext;
|
|
80
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
81
|
+
}
|
|
82
|
+
return [Provider, useContext22];
|
|
83
|
+
}
|
|
84
|
+
const createScope = () => {
|
|
85
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
86
|
+
return React2.createContext(defaultContext);
|
|
87
|
+
});
|
|
88
|
+
return function useScope(scope) {
|
|
89
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
90
|
+
return React2.useMemo(
|
|
91
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
92
|
+
[scope, contexts]
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
createScope.scopeName = scopeName;
|
|
97
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
98
|
+
}
|
|
99
|
+
function composeContextScopes(...scopes) {
|
|
100
|
+
const baseScope = scopes[0];
|
|
101
|
+
if (scopes.length === 1)
|
|
102
|
+
return baseScope;
|
|
103
|
+
const createScope = () => {
|
|
104
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
105
|
+
useScope: createScope2(),
|
|
106
|
+
scopeName: createScope2.scopeName
|
|
107
|
+
}));
|
|
108
|
+
return function useComposedScopes(overrideScopes) {
|
|
109
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
110
|
+
const scopeProps = useScope(overrideScopes);
|
|
111
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
112
|
+
return { ...nextScopes2, ...currentScope };
|
|
113
|
+
}, {});
|
|
114
|
+
return React2.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
createScope.scopeName = baseScope.scopeName;
|
|
118
|
+
return createScope;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ../../node_modules/.pnpm/@radix-ui+react-primitive@2.0.2_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18.2._tx2wrhqsp6jqegxgxbfc4hom3e/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
122
|
+
import * as React4 from "react";
|
|
123
|
+
import * as ReactDOM from "react-dom";
|
|
124
|
+
|
|
125
|
+
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.1.2_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
126
|
+
import * as React3 from "react";
|
|
127
|
+
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
128
|
+
var Slot = React3.forwardRef((props, forwardedRef) => {
|
|
129
|
+
const { children, ...slotProps } = props;
|
|
130
|
+
const childrenArray = React3.Children.toArray(children);
|
|
131
|
+
const slottable = childrenArray.find(isSlottable);
|
|
132
|
+
if (slottable) {
|
|
133
|
+
const newElement = slottable.props.children;
|
|
134
|
+
const newChildren = childrenArray.map((child) => {
|
|
135
|
+
if (child === slottable) {
|
|
136
|
+
if (React3.Children.count(newElement) > 1)
|
|
137
|
+
return React3.Children.only(null);
|
|
138
|
+
return React3.isValidElement(newElement) ? newElement.props.children : null;
|
|
139
|
+
} else {
|
|
140
|
+
return child;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
return /* @__PURE__ */ jsx2(SlotClone, { ...slotProps, ref: forwardedRef, children: React3.isValidElement(newElement) ? React3.cloneElement(newElement, void 0, newChildren) : null });
|
|
144
|
+
}
|
|
145
|
+
return /* @__PURE__ */ jsx2(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
146
|
+
});
|
|
147
|
+
Slot.displayName = "Slot";
|
|
148
|
+
var SlotClone = React3.forwardRef((props, forwardedRef) => {
|
|
149
|
+
const { children, ...slotProps } = props;
|
|
150
|
+
if (React3.isValidElement(children)) {
|
|
151
|
+
const childrenRef = getElementRef(children);
|
|
152
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
153
|
+
if (children.type !== React3.Fragment) {
|
|
154
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
155
|
+
}
|
|
156
|
+
return React3.cloneElement(children, props2);
|
|
157
|
+
}
|
|
158
|
+
return React3.Children.count(children) > 1 ? React3.Children.only(null) : null;
|
|
159
|
+
});
|
|
160
|
+
SlotClone.displayName = "SlotClone";
|
|
161
|
+
var Slottable = ({ children }) => {
|
|
162
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children });
|
|
163
|
+
};
|
|
164
|
+
function isSlottable(child) {
|
|
165
|
+
return React3.isValidElement(child) && child.type === Slottable;
|
|
166
|
+
}
|
|
167
|
+
function mergeProps(slotProps, childProps) {
|
|
168
|
+
const overrideProps = { ...childProps };
|
|
169
|
+
for (const propName in childProps) {
|
|
170
|
+
const slotPropValue = slotProps[propName];
|
|
171
|
+
const childPropValue = childProps[propName];
|
|
172
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
173
|
+
if (isHandler) {
|
|
174
|
+
if (slotPropValue && childPropValue) {
|
|
175
|
+
overrideProps[propName] = (...args) => {
|
|
176
|
+
childPropValue(...args);
|
|
177
|
+
slotPropValue(...args);
|
|
178
|
+
};
|
|
179
|
+
} else if (slotPropValue) {
|
|
180
|
+
overrideProps[propName] = slotPropValue;
|
|
181
|
+
}
|
|
182
|
+
} else if (propName === "style") {
|
|
183
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
184
|
+
} else if (propName === "className") {
|
|
185
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return { ...slotProps, ...overrideProps };
|
|
189
|
+
}
|
|
190
|
+
function getElementRef(element) {
|
|
191
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
192
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
193
|
+
if (mayWarn) {
|
|
194
|
+
return element.ref;
|
|
195
|
+
}
|
|
196
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
197
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
198
|
+
if (mayWarn) {
|
|
199
|
+
return element.props.ref;
|
|
200
|
+
}
|
|
201
|
+
return element.props.ref || element.ref;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ../../node_modules/.pnpm/@radix-ui+react-primitive@2.0.2_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18.2._tx2wrhqsp6jqegxgxbfc4hom3e/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
205
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
206
|
+
var NODES = [
|
|
207
|
+
"a",
|
|
208
|
+
"button",
|
|
209
|
+
"div",
|
|
210
|
+
"form",
|
|
211
|
+
"h2",
|
|
212
|
+
"h3",
|
|
213
|
+
"img",
|
|
214
|
+
"input",
|
|
215
|
+
"label",
|
|
216
|
+
"li",
|
|
217
|
+
"nav",
|
|
218
|
+
"ol",
|
|
219
|
+
"p",
|
|
220
|
+
"span",
|
|
221
|
+
"svg",
|
|
222
|
+
"ul"
|
|
223
|
+
];
|
|
224
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
225
|
+
const Node = React4.forwardRef((props, forwardedRef) => {
|
|
226
|
+
const { asChild, ...primitiveProps } = props;
|
|
227
|
+
const Comp = asChild ? Slot : node;
|
|
228
|
+
if (typeof window !== "undefined") {
|
|
229
|
+
window[Symbol.for("radix-ui")] = true;
|
|
230
|
+
}
|
|
231
|
+
return /* @__PURE__ */ jsx3(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
232
|
+
});
|
|
233
|
+
Node.displayName = `Primitive.${node}`;
|
|
234
|
+
return { ...primitive, [node]: Node };
|
|
235
|
+
}, {});
|
|
236
|
+
|
|
237
|
+
// ../../node_modules/.pnpm/@radix-ui+react-roving-focus@1.1.2_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18_fxud4eulc7qig36n2hyuxoumvm/node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
238
|
+
import * as React11 from "react";
|
|
239
|
+
|
|
240
|
+
// ../../node_modules/.pnpm/@radix-ui+react-collection@1.1.2_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18.2_gpoji3swyu6xqm25zy4nvzfjsi/node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
241
|
+
import React5 from "react";
|
|
242
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
243
|
+
function createCollection(name) {
|
|
244
|
+
const PROVIDER_NAME = name + "CollectionProvider";
|
|
245
|
+
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
246
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
247
|
+
PROVIDER_NAME,
|
|
248
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
249
|
+
);
|
|
250
|
+
const CollectionProvider = (props) => {
|
|
251
|
+
const { scope, children } = props;
|
|
252
|
+
const ref = React5.useRef(null);
|
|
253
|
+
const itemMap = React5.useRef(/* @__PURE__ */ new Map()).current;
|
|
254
|
+
return /* @__PURE__ */ jsx4(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
255
|
+
};
|
|
256
|
+
CollectionProvider.displayName = PROVIDER_NAME;
|
|
257
|
+
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
258
|
+
const CollectionSlot = React5.forwardRef(
|
|
259
|
+
(props, forwardedRef) => {
|
|
260
|
+
const { scope, children } = props;
|
|
261
|
+
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
262
|
+
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
263
|
+
return /* @__PURE__ */ jsx4(Slot, { ref: composedRefs, children });
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
267
|
+
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
268
|
+
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
269
|
+
const CollectionItemSlot = React5.forwardRef(
|
|
270
|
+
(props, forwardedRef) => {
|
|
271
|
+
const { scope, children, ...itemData } = props;
|
|
272
|
+
const ref = React5.useRef(null);
|
|
273
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
274
|
+
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
275
|
+
React5.useEffect(() => {
|
|
276
|
+
context.itemMap.set(ref, { ref, ...itemData });
|
|
277
|
+
return () => void context.itemMap.delete(ref);
|
|
278
|
+
});
|
|
279
|
+
return /* @__PURE__ */ jsx4(Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
283
|
+
function useCollection2(scope) {
|
|
284
|
+
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
285
|
+
const getItems = React5.useCallback(() => {
|
|
286
|
+
const collectionNode = context.collectionRef.current;
|
|
287
|
+
if (!collectionNode)
|
|
288
|
+
return [];
|
|
289
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
290
|
+
const items = Array.from(context.itemMap.values());
|
|
291
|
+
const orderedItems = items.sort(
|
|
292
|
+
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
293
|
+
);
|
|
294
|
+
return orderedItems;
|
|
295
|
+
}, [context.collectionRef, context.itemMap]);
|
|
296
|
+
return getItems;
|
|
297
|
+
}
|
|
298
|
+
return [
|
|
299
|
+
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
300
|
+
useCollection2,
|
|
301
|
+
createCollectionScope2
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// ../../node_modules/.pnpm/@radix-ui+react-id@1.1.0_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.mjs
|
|
306
|
+
import * as React7 from "react";
|
|
307
|
+
|
|
308
|
+
// ../../node_modules/.pnpm/@radix-ui+react-use-layout-effect@1.1.0_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
309
|
+
import * as React6 from "react";
|
|
310
|
+
var useLayoutEffect2 = Boolean(globalThis?.document) ? React6.useLayoutEffect : () => {
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// ../../node_modules/.pnpm/@radix-ui+react-id@1.1.0_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.mjs
|
|
314
|
+
var useReactId = React7["useId".toString()] || (() => void 0);
|
|
315
|
+
var count = 0;
|
|
316
|
+
function useId(deterministicId) {
|
|
317
|
+
const [id, setId] = React7.useState(useReactId());
|
|
318
|
+
useLayoutEffect2(() => {
|
|
319
|
+
if (!deterministicId)
|
|
320
|
+
setId((reactId) => reactId ?? String(count++));
|
|
321
|
+
}, [deterministicId]);
|
|
322
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// ../../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.1.0_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
326
|
+
import * as React8 from "react";
|
|
327
|
+
function useCallbackRef(callback) {
|
|
328
|
+
const callbackRef = React8.useRef(callback);
|
|
329
|
+
React8.useEffect(() => {
|
|
330
|
+
callbackRef.current = callback;
|
|
331
|
+
});
|
|
332
|
+
return React8.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// ../../node_modules/.pnpm/@radix-ui+react-use-controllable-state@1.1.0_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
336
|
+
import * as React9 from "react";
|
|
337
|
+
function useControllableState({
|
|
338
|
+
prop,
|
|
339
|
+
defaultProp,
|
|
340
|
+
onChange = () => {
|
|
341
|
+
}
|
|
342
|
+
}) {
|
|
343
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
344
|
+
const isControlled = prop !== void 0;
|
|
345
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
346
|
+
const handleChange = useCallbackRef(onChange);
|
|
347
|
+
const setValue = React9.useCallback(
|
|
348
|
+
(nextValue) => {
|
|
349
|
+
if (isControlled) {
|
|
350
|
+
const setter = nextValue;
|
|
351
|
+
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
352
|
+
if (value2 !== prop)
|
|
353
|
+
handleChange(value2);
|
|
354
|
+
} else {
|
|
355
|
+
setUncontrolledProp(nextValue);
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
359
|
+
);
|
|
360
|
+
return [value, setValue];
|
|
361
|
+
}
|
|
362
|
+
function useUncontrolledState({
|
|
363
|
+
defaultProp,
|
|
364
|
+
onChange
|
|
365
|
+
}) {
|
|
366
|
+
const uncontrolledState = React9.useState(defaultProp);
|
|
367
|
+
const [value] = uncontrolledState;
|
|
368
|
+
const prevValueRef = React9.useRef(value);
|
|
369
|
+
const handleChange = useCallbackRef(onChange);
|
|
370
|
+
React9.useEffect(() => {
|
|
371
|
+
if (prevValueRef.current !== value) {
|
|
372
|
+
handleChange(value);
|
|
373
|
+
prevValueRef.current = value;
|
|
374
|
+
}
|
|
375
|
+
}, [value, prevValueRef, handleChange]);
|
|
376
|
+
return uncontrolledState;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// ../../node_modules/.pnpm/@radix-ui+react-direction@1.1.0_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
380
|
+
import * as React10 from "react";
|
|
381
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
382
|
+
var DirectionContext = React10.createContext(void 0);
|
|
383
|
+
function useDirection(localDir) {
|
|
384
|
+
const globalDir = React10.useContext(DirectionContext);
|
|
385
|
+
return localDir || globalDir || "ltr";
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// ../../node_modules/.pnpm/@radix-ui+react-roving-focus@1.1.2_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18_fxud4eulc7qig36n2hyuxoumvm/node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
389
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
390
|
+
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
391
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
392
|
+
var GROUP_NAME = "RovingFocusGroup";
|
|
393
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
394
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
395
|
+
GROUP_NAME,
|
|
396
|
+
[createCollectionScope]
|
|
397
|
+
);
|
|
398
|
+
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
399
|
+
var RovingFocusGroup = React11.forwardRef(
|
|
400
|
+
(props, forwardedRef) => {
|
|
401
|
+
return /* @__PURE__ */ jsx6(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx6(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx6(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
402
|
+
}
|
|
403
|
+
);
|
|
404
|
+
RovingFocusGroup.displayName = GROUP_NAME;
|
|
405
|
+
var RovingFocusGroupImpl = React11.forwardRef((props, forwardedRef) => {
|
|
406
|
+
const {
|
|
407
|
+
__scopeRovingFocusGroup,
|
|
408
|
+
orientation,
|
|
409
|
+
loop = false,
|
|
410
|
+
dir,
|
|
411
|
+
currentTabStopId: currentTabStopIdProp,
|
|
412
|
+
defaultCurrentTabStopId,
|
|
413
|
+
onCurrentTabStopIdChange,
|
|
414
|
+
onEntryFocus,
|
|
415
|
+
preventScrollOnEntryFocus = false,
|
|
416
|
+
...groupProps
|
|
417
|
+
} = props;
|
|
418
|
+
const ref = React11.useRef(null);
|
|
419
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
420
|
+
const direction = useDirection(dir);
|
|
421
|
+
const [currentTabStopId = null, setCurrentTabStopId] = useControllableState({
|
|
422
|
+
prop: currentTabStopIdProp,
|
|
423
|
+
defaultProp: defaultCurrentTabStopId,
|
|
424
|
+
onChange: onCurrentTabStopIdChange
|
|
425
|
+
});
|
|
426
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React11.useState(false);
|
|
427
|
+
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
428
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
429
|
+
const isClickFocusRef = React11.useRef(false);
|
|
430
|
+
const [focusableItemsCount, setFocusableItemsCount] = React11.useState(0);
|
|
431
|
+
React11.useEffect(() => {
|
|
432
|
+
const node = ref.current;
|
|
433
|
+
if (node) {
|
|
434
|
+
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
435
|
+
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
436
|
+
}
|
|
437
|
+
}, [handleEntryFocus]);
|
|
438
|
+
return /* @__PURE__ */ jsx6(
|
|
439
|
+
RovingFocusProvider,
|
|
440
|
+
{
|
|
441
|
+
scope: __scopeRovingFocusGroup,
|
|
442
|
+
orientation,
|
|
443
|
+
dir: direction,
|
|
444
|
+
loop,
|
|
445
|
+
currentTabStopId,
|
|
446
|
+
onItemFocus: React11.useCallback(
|
|
447
|
+
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
448
|
+
[setCurrentTabStopId]
|
|
449
|
+
),
|
|
450
|
+
onItemShiftTab: React11.useCallback(() => setIsTabbingBackOut(true), []),
|
|
451
|
+
onFocusableItemAdd: React11.useCallback(
|
|
452
|
+
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
453
|
+
[]
|
|
454
|
+
),
|
|
455
|
+
onFocusableItemRemove: React11.useCallback(
|
|
456
|
+
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
457
|
+
[]
|
|
458
|
+
),
|
|
459
|
+
children: /* @__PURE__ */ jsx6(
|
|
460
|
+
Primitive.div,
|
|
461
|
+
{
|
|
462
|
+
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
463
|
+
"data-orientation": orientation,
|
|
464
|
+
...groupProps,
|
|
465
|
+
ref: composedRefs,
|
|
466
|
+
style: { outline: "none", ...props.style },
|
|
467
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
468
|
+
isClickFocusRef.current = true;
|
|
469
|
+
}),
|
|
470
|
+
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
471
|
+
const isKeyboardFocus = !isClickFocusRef.current;
|
|
472
|
+
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
473
|
+
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
474
|
+
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
475
|
+
if (!entryFocusEvent.defaultPrevented) {
|
|
476
|
+
const items = getItems().filter((item) => item.focusable);
|
|
477
|
+
const activeItem = items.find((item) => item.active);
|
|
478
|
+
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
479
|
+
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
480
|
+
Boolean
|
|
481
|
+
);
|
|
482
|
+
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
483
|
+
focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
isClickFocusRef.current = false;
|
|
487
|
+
}),
|
|
488
|
+
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
489
|
+
}
|
|
490
|
+
)
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
});
|
|
494
|
+
var ITEM_NAME = "RovingFocusGroupItem";
|
|
495
|
+
var RovingFocusGroupItem = React11.forwardRef(
|
|
496
|
+
(props, forwardedRef) => {
|
|
497
|
+
const {
|
|
498
|
+
__scopeRovingFocusGroup,
|
|
499
|
+
focusable = true,
|
|
500
|
+
active = false,
|
|
501
|
+
tabStopId,
|
|
502
|
+
...itemProps
|
|
503
|
+
} = props;
|
|
504
|
+
const autoId = useId();
|
|
505
|
+
const id = tabStopId || autoId;
|
|
506
|
+
const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
507
|
+
const isCurrentTabStop = context.currentTabStopId === id;
|
|
508
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
509
|
+
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
510
|
+
React11.useEffect(() => {
|
|
511
|
+
if (focusable) {
|
|
512
|
+
onFocusableItemAdd();
|
|
513
|
+
return () => onFocusableItemRemove();
|
|
514
|
+
}
|
|
515
|
+
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
516
|
+
return /* @__PURE__ */ jsx6(
|
|
517
|
+
Collection.ItemSlot,
|
|
518
|
+
{
|
|
519
|
+
scope: __scopeRovingFocusGroup,
|
|
520
|
+
id,
|
|
521
|
+
focusable,
|
|
522
|
+
active,
|
|
523
|
+
children: /* @__PURE__ */ jsx6(
|
|
524
|
+
Primitive.span,
|
|
525
|
+
{
|
|
526
|
+
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
527
|
+
"data-orientation": context.orientation,
|
|
528
|
+
...itemProps,
|
|
529
|
+
ref: forwardedRef,
|
|
530
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
531
|
+
if (!focusable)
|
|
532
|
+
event.preventDefault();
|
|
533
|
+
else
|
|
534
|
+
context.onItemFocus(id);
|
|
535
|
+
}),
|
|
536
|
+
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
537
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
538
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
539
|
+
context.onItemShiftTab();
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (event.target !== event.currentTarget)
|
|
543
|
+
return;
|
|
544
|
+
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
545
|
+
if (focusIntent !== void 0) {
|
|
546
|
+
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey)
|
|
547
|
+
return;
|
|
548
|
+
event.preventDefault();
|
|
549
|
+
const items = getItems().filter((item) => item.focusable);
|
|
550
|
+
let candidateNodes = items.map((item) => item.ref.current);
|
|
551
|
+
if (focusIntent === "last")
|
|
552
|
+
candidateNodes.reverse();
|
|
553
|
+
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
554
|
+
if (focusIntent === "prev")
|
|
555
|
+
candidateNodes.reverse();
|
|
556
|
+
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
557
|
+
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
558
|
+
}
|
|
559
|
+
setTimeout(() => focusFirst(candidateNodes));
|
|
560
|
+
}
|
|
561
|
+
})
|
|
562
|
+
}
|
|
563
|
+
)
|
|
564
|
+
}
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
RovingFocusGroupItem.displayName = ITEM_NAME;
|
|
569
|
+
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
570
|
+
ArrowLeft: "prev",
|
|
571
|
+
ArrowUp: "prev",
|
|
572
|
+
ArrowRight: "next",
|
|
573
|
+
ArrowDown: "next",
|
|
574
|
+
PageUp: "first",
|
|
575
|
+
Home: "first",
|
|
576
|
+
PageDown: "last",
|
|
577
|
+
End: "last"
|
|
578
|
+
};
|
|
579
|
+
function getDirectionAwareKey(key, dir) {
|
|
580
|
+
if (dir !== "rtl")
|
|
581
|
+
return key;
|
|
582
|
+
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
583
|
+
}
|
|
584
|
+
function getFocusIntent(event, orientation, dir) {
|
|
585
|
+
const key = getDirectionAwareKey(event.key, dir);
|
|
586
|
+
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key))
|
|
587
|
+
return void 0;
|
|
588
|
+
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key))
|
|
589
|
+
return void 0;
|
|
590
|
+
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
591
|
+
}
|
|
592
|
+
function focusFirst(candidates, preventScroll = false) {
|
|
593
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
594
|
+
for (const candidate of candidates) {
|
|
595
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT)
|
|
596
|
+
return;
|
|
597
|
+
candidate.focus({ preventScroll });
|
|
598
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT)
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
function wrapArray(array, startIndex) {
|
|
603
|
+
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
604
|
+
}
|
|
605
|
+
var Root = RovingFocusGroup;
|
|
606
|
+
var Item = RovingFocusGroupItem;
|
|
607
|
+
|
|
608
|
+
// ../../node_modules/.pnpm/@radix-ui+react-radio-group@1.2.3_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18._7hoofqvtnex5636yqbwyqoruey/node_modules/@radix-ui/react-radio-group/dist/index.mjs
|
|
609
|
+
import * as React15 from "react";
|
|
610
|
+
|
|
611
|
+
// ../../node_modules/.pnpm/@radix-ui+react-use-size@1.1.0_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-use-size/dist/index.mjs
|
|
612
|
+
import * as React12 from "react";
|
|
613
|
+
function useSize(element) {
|
|
614
|
+
const [size, setSize] = React12.useState(void 0);
|
|
615
|
+
useLayoutEffect2(() => {
|
|
616
|
+
if (element) {
|
|
617
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
618
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
619
|
+
if (!Array.isArray(entries)) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
if (!entries.length) {
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
const entry = entries[0];
|
|
626
|
+
let width;
|
|
627
|
+
let height;
|
|
628
|
+
if ("borderBoxSize" in entry) {
|
|
629
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
630
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
631
|
+
width = borderSize["inlineSize"];
|
|
632
|
+
height = borderSize["blockSize"];
|
|
633
|
+
} else {
|
|
634
|
+
width = element.offsetWidth;
|
|
635
|
+
height = element.offsetHeight;
|
|
636
|
+
}
|
|
637
|
+
setSize({ width, height });
|
|
638
|
+
});
|
|
639
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
640
|
+
return () => resizeObserver.unobserve(element);
|
|
641
|
+
} else {
|
|
642
|
+
setSize(void 0);
|
|
643
|
+
}
|
|
644
|
+
}, [element]);
|
|
645
|
+
return size;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// ../../node_modules/.pnpm/@radix-ui+react-use-previous@1.1.0_@types+react@18.2.67_react@18.2.0/node_modules/@radix-ui/react-use-previous/dist/index.mjs
|
|
649
|
+
import * as React13 from "react";
|
|
650
|
+
function usePrevious(value) {
|
|
651
|
+
const ref = React13.useRef({ value, previous: value });
|
|
652
|
+
return React13.useMemo(() => {
|
|
653
|
+
if (ref.current.value !== value) {
|
|
654
|
+
ref.current.previous = ref.current.value;
|
|
655
|
+
ref.current.value = value;
|
|
656
|
+
}
|
|
657
|
+
return ref.current.previous;
|
|
658
|
+
}, [value]);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// ../../node_modules/.pnpm/@radix-ui+react-presence@1.1.2_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
662
|
+
import * as React22 from "react";
|
|
663
|
+
import * as React14 from "react";
|
|
664
|
+
function useStateMachine(initialState, machine) {
|
|
665
|
+
return React14.useReducer((state, event) => {
|
|
666
|
+
const nextState = machine[state][event];
|
|
667
|
+
return nextState ?? state;
|
|
668
|
+
}, initialState);
|
|
669
|
+
}
|
|
670
|
+
var Presence = (props) => {
|
|
671
|
+
const { present, children } = props;
|
|
672
|
+
const presence = usePresence(present);
|
|
673
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React22.Children.only(children);
|
|
674
|
+
const ref = useComposedRefs(presence.ref, getElementRef2(child));
|
|
675
|
+
const forceMount = typeof children === "function";
|
|
676
|
+
return forceMount || presence.isPresent ? React22.cloneElement(child, { ref }) : null;
|
|
677
|
+
};
|
|
678
|
+
Presence.displayName = "Presence";
|
|
679
|
+
function usePresence(present) {
|
|
680
|
+
const [node, setNode] = React22.useState();
|
|
681
|
+
const stylesRef = React22.useRef({});
|
|
682
|
+
const prevPresentRef = React22.useRef(present);
|
|
683
|
+
const prevAnimationNameRef = React22.useRef("none");
|
|
684
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
685
|
+
const [state, send] = useStateMachine(initialState, {
|
|
686
|
+
mounted: {
|
|
687
|
+
UNMOUNT: "unmounted",
|
|
688
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
689
|
+
},
|
|
690
|
+
unmountSuspended: {
|
|
691
|
+
MOUNT: "mounted",
|
|
692
|
+
ANIMATION_END: "unmounted"
|
|
693
|
+
},
|
|
694
|
+
unmounted: {
|
|
695
|
+
MOUNT: "mounted"
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
React22.useEffect(() => {
|
|
699
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
700
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
701
|
+
}, [state]);
|
|
702
|
+
useLayoutEffect2(() => {
|
|
703
|
+
const styles = stylesRef.current;
|
|
704
|
+
const wasPresent = prevPresentRef.current;
|
|
705
|
+
const hasPresentChanged = wasPresent !== present;
|
|
706
|
+
if (hasPresentChanged) {
|
|
707
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
708
|
+
const currentAnimationName = getAnimationName(styles);
|
|
709
|
+
if (present) {
|
|
710
|
+
send("MOUNT");
|
|
711
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
712
|
+
send("UNMOUNT");
|
|
713
|
+
} else {
|
|
714
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
715
|
+
if (wasPresent && isAnimating) {
|
|
716
|
+
send("ANIMATION_OUT");
|
|
717
|
+
} else {
|
|
718
|
+
send("UNMOUNT");
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
prevPresentRef.current = present;
|
|
722
|
+
}
|
|
723
|
+
}, [present, send]);
|
|
724
|
+
useLayoutEffect2(() => {
|
|
725
|
+
if (node) {
|
|
726
|
+
let timeoutId;
|
|
727
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
728
|
+
const handleAnimationEnd = (event) => {
|
|
729
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
730
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
731
|
+
if (event.target === node && isCurrentAnimation) {
|
|
732
|
+
send("ANIMATION_END");
|
|
733
|
+
if (!prevPresentRef.current) {
|
|
734
|
+
const currentFillMode = node.style.animationFillMode;
|
|
735
|
+
node.style.animationFillMode = "forwards";
|
|
736
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
737
|
+
if (node.style.animationFillMode === "forwards") {
|
|
738
|
+
node.style.animationFillMode = currentFillMode;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
const handleAnimationStart = (event) => {
|
|
745
|
+
if (event.target === node) {
|
|
746
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
750
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
751
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
752
|
+
return () => {
|
|
753
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
754
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
755
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
756
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
757
|
+
};
|
|
758
|
+
} else {
|
|
759
|
+
send("ANIMATION_END");
|
|
760
|
+
}
|
|
761
|
+
}, [node, send]);
|
|
762
|
+
return {
|
|
763
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
764
|
+
ref: React22.useCallback((node2) => {
|
|
765
|
+
if (node2)
|
|
766
|
+
stylesRef.current = getComputedStyle(node2);
|
|
767
|
+
setNode(node2);
|
|
768
|
+
}, [])
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
function getAnimationName(styles) {
|
|
772
|
+
return styles?.animationName || "none";
|
|
773
|
+
}
|
|
774
|
+
function getElementRef2(element) {
|
|
775
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
776
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
777
|
+
if (mayWarn) {
|
|
778
|
+
return element.ref;
|
|
779
|
+
}
|
|
780
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
781
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
782
|
+
if (mayWarn) {
|
|
783
|
+
return element.props.ref;
|
|
784
|
+
}
|
|
785
|
+
return element.props.ref || element.ref;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// ../../node_modules/.pnpm/@radix-ui+react-radio-group@1.2.3_@types+react-dom@18.2.22_@types+react@18.2.67_react-dom@18._7hoofqvtnex5636yqbwyqoruey/node_modules/@radix-ui/react-radio-group/dist/index.mjs
|
|
789
|
+
import { jsx as jsx7, jsxs } from "react/jsx-runtime";
|
|
790
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
791
|
+
var RADIO_NAME = "Radio";
|
|
792
|
+
var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
|
|
793
|
+
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
794
|
+
var Radio = React15.forwardRef(
|
|
795
|
+
(props, forwardedRef) => {
|
|
796
|
+
const {
|
|
797
|
+
__scopeRadio,
|
|
798
|
+
name,
|
|
799
|
+
checked = false,
|
|
800
|
+
required,
|
|
801
|
+
disabled,
|
|
802
|
+
value = "on",
|
|
803
|
+
onCheck,
|
|
804
|
+
form,
|
|
805
|
+
...radioProps
|
|
806
|
+
} = props;
|
|
807
|
+
const [button, setButton] = React15.useState(null);
|
|
808
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
809
|
+
const hasConsumerStoppedPropagationRef = React15.useRef(false);
|
|
810
|
+
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
811
|
+
return /* @__PURE__ */ jsxs(RadioProvider, { scope: __scopeRadio, checked, disabled, children: [
|
|
812
|
+
/* @__PURE__ */ jsx7(
|
|
813
|
+
Primitive.button,
|
|
814
|
+
{
|
|
815
|
+
type: "button",
|
|
816
|
+
role: "radio",
|
|
817
|
+
"aria-checked": checked,
|
|
818
|
+
"data-state": getState(checked),
|
|
819
|
+
"data-disabled": disabled ? "" : void 0,
|
|
820
|
+
disabled,
|
|
821
|
+
value,
|
|
822
|
+
...radioProps,
|
|
823
|
+
ref: composedRefs,
|
|
824
|
+
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
825
|
+
if (!checked)
|
|
826
|
+
onCheck?.();
|
|
827
|
+
if (isFormControl) {
|
|
828
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
829
|
+
if (!hasConsumerStoppedPropagationRef.current)
|
|
830
|
+
event.stopPropagation();
|
|
831
|
+
}
|
|
832
|
+
})
|
|
833
|
+
}
|
|
834
|
+
),
|
|
835
|
+
isFormControl && /* @__PURE__ */ jsx7(
|
|
836
|
+
BubbleInput,
|
|
837
|
+
{
|
|
838
|
+
control: button,
|
|
839
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
840
|
+
name,
|
|
841
|
+
value,
|
|
842
|
+
checked,
|
|
843
|
+
required,
|
|
844
|
+
disabled,
|
|
845
|
+
form,
|
|
846
|
+
style: { transform: "translateX(-100%)" }
|
|
847
|
+
}
|
|
848
|
+
)
|
|
849
|
+
] });
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
Radio.displayName = RADIO_NAME;
|
|
853
|
+
var INDICATOR_NAME = "RadioIndicator";
|
|
854
|
+
var RadioIndicator = React15.forwardRef(
|
|
855
|
+
(props, forwardedRef) => {
|
|
856
|
+
const { __scopeRadio, forceMount, ...indicatorProps } = props;
|
|
857
|
+
const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
|
|
858
|
+
return /* @__PURE__ */ jsx7(Presence, { present: forceMount || context.checked, children: /* @__PURE__ */ jsx7(
|
|
859
|
+
Primitive.span,
|
|
860
|
+
{
|
|
861
|
+
"data-state": getState(context.checked),
|
|
862
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
863
|
+
...indicatorProps,
|
|
864
|
+
ref: forwardedRef
|
|
865
|
+
}
|
|
866
|
+
) });
|
|
867
|
+
}
|
|
868
|
+
);
|
|
869
|
+
RadioIndicator.displayName = INDICATOR_NAME;
|
|
870
|
+
var BubbleInput = (props) => {
|
|
871
|
+
const { control, checked, bubbles = true, ...inputProps } = props;
|
|
872
|
+
const ref = React15.useRef(null);
|
|
873
|
+
const prevChecked = usePrevious(checked);
|
|
874
|
+
const controlSize = useSize(control);
|
|
875
|
+
React15.useEffect(() => {
|
|
876
|
+
const input = ref.current;
|
|
877
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
878
|
+
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
|
|
879
|
+
const setChecked = descriptor.set;
|
|
880
|
+
if (prevChecked !== checked && setChecked) {
|
|
881
|
+
const event = new Event("click", { bubbles });
|
|
882
|
+
setChecked.call(input, checked);
|
|
883
|
+
input.dispatchEvent(event);
|
|
884
|
+
}
|
|
885
|
+
}, [prevChecked, checked, bubbles]);
|
|
886
|
+
return /* @__PURE__ */ jsx7(
|
|
887
|
+
"input",
|
|
888
|
+
{
|
|
889
|
+
type: "radio",
|
|
890
|
+
"aria-hidden": true,
|
|
891
|
+
defaultChecked: checked,
|
|
892
|
+
...inputProps,
|
|
893
|
+
tabIndex: -1,
|
|
894
|
+
ref,
|
|
895
|
+
style: {
|
|
896
|
+
...props.style,
|
|
897
|
+
...controlSize,
|
|
898
|
+
position: "absolute",
|
|
899
|
+
pointerEvents: "none",
|
|
900
|
+
opacity: 0,
|
|
901
|
+
margin: 0
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
);
|
|
905
|
+
};
|
|
906
|
+
function getState(checked) {
|
|
907
|
+
return checked ? "checked" : "unchecked";
|
|
908
|
+
}
|
|
909
|
+
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
910
|
+
var RADIO_GROUP_NAME = "RadioGroup";
|
|
911
|
+
var [createRadioGroupContext, createRadioGroupScope] = createContextScope(RADIO_GROUP_NAME, [
|
|
912
|
+
createRovingFocusGroupScope,
|
|
913
|
+
createRadioScope
|
|
914
|
+
]);
|
|
915
|
+
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
916
|
+
var useRadioScope = createRadioScope();
|
|
917
|
+
var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME);
|
|
918
|
+
var RadioGroup = React23.forwardRef(
|
|
919
|
+
(props, forwardedRef) => {
|
|
920
|
+
const {
|
|
921
|
+
__scopeRadioGroup,
|
|
922
|
+
name,
|
|
923
|
+
defaultValue,
|
|
924
|
+
value: valueProp,
|
|
925
|
+
required = false,
|
|
926
|
+
disabled = false,
|
|
927
|
+
orientation,
|
|
928
|
+
dir,
|
|
929
|
+
loop = true,
|
|
930
|
+
onValueChange,
|
|
931
|
+
...groupProps
|
|
932
|
+
} = props;
|
|
933
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
934
|
+
const direction = useDirection(dir);
|
|
935
|
+
const [value, setValue] = useControllableState({
|
|
936
|
+
prop: valueProp,
|
|
937
|
+
defaultProp: defaultValue,
|
|
938
|
+
onChange: onValueChange
|
|
939
|
+
});
|
|
940
|
+
return /* @__PURE__ */ jsx22(
|
|
941
|
+
RadioGroupProvider,
|
|
942
|
+
{
|
|
943
|
+
scope: __scopeRadioGroup,
|
|
944
|
+
name,
|
|
945
|
+
required,
|
|
946
|
+
disabled,
|
|
947
|
+
value,
|
|
948
|
+
onValueChange: setValue,
|
|
949
|
+
children: /* @__PURE__ */ jsx22(
|
|
950
|
+
Root,
|
|
951
|
+
{
|
|
952
|
+
asChild: true,
|
|
953
|
+
...rovingFocusGroupScope,
|
|
954
|
+
orientation,
|
|
955
|
+
dir: direction,
|
|
956
|
+
loop,
|
|
957
|
+
children: /* @__PURE__ */ jsx22(
|
|
958
|
+
Primitive.div,
|
|
959
|
+
{
|
|
960
|
+
role: "radiogroup",
|
|
961
|
+
"aria-required": required,
|
|
962
|
+
"aria-orientation": orientation,
|
|
963
|
+
"data-disabled": disabled ? "" : void 0,
|
|
964
|
+
dir: direction,
|
|
965
|
+
...groupProps,
|
|
966
|
+
ref: forwardedRef
|
|
967
|
+
}
|
|
968
|
+
)
|
|
969
|
+
}
|
|
970
|
+
)
|
|
971
|
+
}
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
);
|
|
975
|
+
RadioGroup.displayName = RADIO_GROUP_NAME;
|
|
976
|
+
var ITEM_NAME2 = "RadioGroupItem";
|
|
977
|
+
var RadioGroupItem = React23.forwardRef(
|
|
978
|
+
(props, forwardedRef) => {
|
|
979
|
+
const { __scopeRadioGroup, disabled, ...itemProps } = props;
|
|
980
|
+
const context = useRadioGroupContext(ITEM_NAME2, __scopeRadioGroup);
|
|
981
|
+
const isDisabled = context.disabled || disabled;
|
|
982
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
983
|
+
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
984
|
+
const ref = React23.useRef(null);
|
|
985
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
986
|
+
const checked = context.value === itemProps.value;
|
|
987
|
+
const isArrowKeyPressedRef = React23.useRef(false);
|
|
988
|
+
React23.useEffect(() => {
|
|
989
|
+
const handleKeyDown = (event) => {
|
|
990
|
+
if (ARROW_KEYS.includes(event.key)) {
|
|
991
|
+
isArrowKeyPressedRef.current = true;
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
const handleKeyUp = () => isArrowKeyPressedRef.current = false;
|
|
995
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
996
|
+
document.addEventListener("keyup", handleKeyUp);
|
|
997
|
+
return () => {
|
|
998
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
999
|
+
document.removeEventListener("keyup", handleKeyUp);
|
|
1000
|
+
};
|
|
1001
|
+
}, []);
|
|
1002
|
+
return /* @__PURE__ */ jsx22(
|
|
1003
|
+
Item,
|
|
1004
|
+
{
|
|
1005
|
+
asChild: true,
|
|
1006
|
+
...rovingFocusGroupScope,
|
|
1007
|
+
focusable: !isDisabled,
|
|
1008
|
+
active: checked,
|
|
1009
|
+
children: /* @__PURE__ */ jsx22(
|
|
1010
|
+
Radio,
|
|
1011
|
+
{
|
|
1012
|
+
disabled: isDisabled,
|
|
1013
|
+
required: context.required,
|
|
1014
|
+
checked,
|
|
1015
|
+
...radioScope,
|
|
1016
|
+
...itemProps,
|
|
1017
|
+
name: context.name,
|
|
1018
|
+
ref: composedRefs,
|
|
1019
|
+
onCheck: () => context.onValueChange(itemProps.value),
|
|
1020
|
+
onKeyDown: composeEventHandlers((event) => {
|
|
1021
|
+
if (event.key === "Enter")
|
|
1022
|
+
event.preventDefault();
|
|
1023
|
+
}),
|
|
1024
|
+
onFocus: composeEventHandlers(itemProps.onFocus, () => {
|
|
1025
|
+
if (isArrowKeyPressedRef.current)
|
|
1026
|
+
ref.current?.click();
|
|
1027
|
+
})
|
|
1028
|
+
}
|
|
1029
|
+
)
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
RadioGroupItem.displayName = ITEM_NAME2;
|
|
1035
|
+
var INDICATOR_NAME2 = "RadioGroupIndicator";
|
|
1036
|
+
var RadioGroupIndicator = React23.forwardRef(
|
|
1037
|
+
(props, forwardedRef) => {
|
|
1038
|
+
const { __scopeRadioGroup, ...indicatorProps } = props;
|
|
1039
|
+
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
1040
|
+
return /* @__PURE__ */ jsx22(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef });
|
|
1041
|
+
}
|
|
1042
|
+
);
|
|
1043
|
+
RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
1044
|
+
var Root2 = RadioGroup;
|
|
1045
|
+
var Item2 = RadioGroupItem;
|
|
1046
|
+
var Indicator = RadioGroupIndicator;
|
|
1047
|
+
|
|
1048
|
+
// src/components/Radio/index.tsx
|
|
1049
|
+
import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1050
|
+
var RadioItem = ({
|
|
1051
|
+
value,
|
|
1052
|
+
label,
|
|
1053
|
+
className
|
|
1054
|
+
}) => {
|
|
1055
|
+
return /* @__PURE__ */ jsxs2(
|
|
1056
|
+
"label",
|
|
1057
|
+
{
|
|
1058
|
+
className: cn(
|
|
1059
|
+
"flex items-center gap-[4px] cursor-pointer group",
|
|
1060
|
+
className
|
|
1061
|
+
),
|
|
1062
|
+
children: [
|
|
1063
|
+
/* @__PURE__ */ jsx8(
|
|
1064
|
+
Item2,
|
|
1065
|
+
{
|
|
1066
|
+
value,
|
|
1067
|
+
className: "w-[16px] h-[16px] rounded-full border-[1px] bg-[#FAFAFF] outline-none cursor-pointer overflow-hidden",
|
|
1068
|
+
children: /* @__PURE__ */ jsx8(Indicator, { className: "flex items-center justify-center w-full h-full rounded-full bg-[#1E3DE4] relative after:content-[''] after:block after:w-[8px] after:h-[8px] after:rounded-full after:bg-[#fff]" })
|
|
1069
|
+
}
|
|
1070
|
+
),
|
|
1071
|
+
/* @__PURE__ */ jsx8("span", { className: "text-[16px] lt-sm:text-[14px] font-450 lh-[18px] text-[#777791] group-has-[[data-state=checked]]:text-[#26244B]", children: label })
|
|
1072
|
+
]
|
|
1073
|
+
},
|
|
1074
|
+
value
|
|
1075
|
+
);
|
|
1076
|
+
};
|
|
1077
|
+
var Radio2 = ({
|
|
1078
|
+
options,
|
|
1079
|
+
value,
|
|
1080
|
+
onChange,
|
|
1081
|
+
name,
|
|
1082
|
+
className
|
|
1083
|
+
}) => {
|
|
1084
|
+
return /* @__PURE__ */ jsx8(
|
|
1085
|
+
Root2,
|
|
1086
|
+
{
|
|
1087
|
+
value,
|
|
1088
|
+
onValueChange: onChange,
|
|
1089
|
+
name,
|
|
1090
|
+
"aria-label": name,
|
|
1091
|
+
className: cn("flex gap-[16px]", className),
|
|
1092
|
+
children: options.map((option) => /* @__PURE__ */ jsx8(
|
|
1093
|
+
RadioItem,
|
|
1094
|
+
{
|
|
1095
|
+
value: option.value,
|
|
1096
|
+
label: option.label
|
|
1097
|
+
},
|
|
1098
|
+
option.value
|
|
1099
|
+
))
|
|
1100
|
+
}
|
|
1101
|
+
);
|
|
1102
|
+
};
|
|
1103
|
+
export {
|
|
1104
|
+
Radio2 as Radio,
|
|
1105
|
+
RadioItem
|
|
1106
|
+
};
|
|
1107
|
+
//# sourceMappingURL=index.js.map
|