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