@huahaharis/ui 0.1.0 → 0.1.2
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/index.cjs +416 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +65 -2257
- package/dist/index.js.map +1 -1
- package/package.json +5 -10
- package/dist/index.mjs +0 -2528
- package/dist/index.mjs.map +0 -1
- /package/dist/{index.d.mts → index.d.cts} +0 -0
package/dist/index.mjs
DELETED
|
@@ -1,2528 +0,0 @@
|
|
|
1
|
-
import * as React25 from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
6
|
-
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
7
|
-
import { ChevronDownIcon } from 'lucide-react';
|
|
8
|
-
import * as ReactDOM from 'react-dom';
|
|
9
|
-
import ReactDOM__default from 'react-dom';
|
|
10
|
-
|
|
11
|
-
// ../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.8_react@19.2.3/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
12
|
-
function setRef(ref, value) {
|
|
13
|
-
if (typeof ref === "function") {
|
|
14
|
-
return ref(value);
|
|
15
|
-
} else if (ref !== null && ref !== void 0) {
|
|
16
|
-
ref.current = value;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function composeRefs(...refs) {
|
|
20
|
-
return (node) => {
|
|
21
|
-
let hasCleanup = false;
|
|
22
|
-
const cleanups = refs.map((ref) => {
|
|
23
|
-
const cleanup = setRef(ref, node);
|
|
24
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
25
|
-
hasCleanup = true;
|
|
26
|
-
}
|
|
27
|
-
return cleanup;
|
|
28
|
-
});
|
|
29
|
-
if (hasCleanup) {
|
|
30
|
-
return () => {
|
|
31
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
32
|
-
const cleanup = cleanups[i];
|
|
33
|
-
if (typeof cleanup == "function") {
|
|
34
|
-
cleanup();
|
|
35
|
-
} else {
|
|
36
|
-
setRef(refs[i], null);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function useComposedRefs(...refs) {
|
|
44
|
-
return React25.useCallback(composeRefs(...refs), refs);
|
|
45
|
-
}
|
|
46
|
-
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
47
|
-
var use = React25[" use ".trim().toString()];
|
|
48
|
-
function isPromiseLike(value) {
|
|
49
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
50
|
-
}
|
|
51
|
-
function isLazyComponent(element) {
|
|
52
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
53
|
-
}
|
|
54
|
-
// @__NO_SIDE_EFFECTS__
|
|
55
|
-
function createSlot(ownerName) {
|
|
56
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
57
|
-
const Slot22 = React25.forwardRef((props, forwardedRef) => {
|
|
58
|
-
let { children, ...slotProps } = props;
|
|
59
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
60
|
-
children = use(children._payload);
|
|
61
|
-
}
|
|
62
|
-
const childrenArray = React25.Children.toArray(children);
|
|
63
|
-
const slottable = childrenArray.find(isSlottable);
|
|
64
|
-
if (slottable) {
|
|
65
|
-
const newElement = slottable.props.children;
|
|
66
|
-
const newChildren = childrenArray.map((child) => {
|
|
67
|
-
if (child === slottable) {
|
|
68
|
-
if (React25.Children.count(newElement) > 1) return React25.Children.only(null);
|
|
69
|
-
return React25.isValidElement(newElement) ? newElement.props.children : null;
|
|
70
|
-
} else {
|
|
71
|
-
return child;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React25.isValidElement(newElement) ? React25.cloneElement(newElement, void 0, newChildren) : null });
|
|
75
|
-
}
|
|
76
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
77
|
-
});
|
|
78
|
-
Slot22.displayName = `${ownerName}.Slot`;
|
|
79
|
-
return Slot22;
|
|
80
|
-
}
|
|
81
|
-
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
82
|
-
// @__NO_SIDE_EFFECTS__
|
|
83
|
-
function createSlotClone(ownerName) {
|
|
84
|
-
const SlotClone = React25.forwardRef((props, forwardedRef) => {
|
|
85
|
-
let { children, ...slotProps } = props;
|
|
86
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
87
|
-
children = use(children._payload);
|
|
88
|
-
}
|
|
89
|
-
if (React25.isValidElement(children)) {
|
|
90
|
-
const childrenRef = getElementRef(children);
|
|
91
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
92
|
-
if (children.type !== React25.Fragment) {
|
|
93
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
94
|
-
}
|
|
95
|
-
return React25.cloneElement(children, props2);
|
|
96
|
-
}
|
|
97
|
-
return React25.Children.count(children) > 1 ? React25.Children.only(null) : null;
|
|
98
|
-
});
|
|
99
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
100
|
-
return SlotClone;
|
|
101
|
-
}
|
|
102
|
-
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
103
|
-
function isSlottable(child) {
|
|
104
|
-
return React25.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
105
|
-
}
|
|
106
|
-
function mergeProps(slotProps, childProps) {
|
|
107
|
-
const overrideProps = { ...childProps };
|
|
108
|
-
for (const propName in childProps) {
|
|
109
|
-
const slotPropValue = slotProps[propName];
|
|
110
|
-
const childPropValue = childProps[propName];
|
|
111
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
112
|
-
if (isHandler) {
|
|
113
|
-
if (slotPropValue && childPropValue) {
|
|
114
|
-
overrideProps[propName] = (...args) => {
|
|
115
|
-
const result = childPropValue(...args);
|
|
116
|
-
slotPropValue(...args);
|
|
117
|
-
return result;
|
|
118
|
-
};
|
|
119
|
-
} else if (slotPropValue) {
|
|
120
|
-
overrideProps[propName] = slotPropValue;
|
|
121
|
-
}
|
|
122
|
-
} else if (propName === "style") {
|
|
123
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
124
|
-
} else if (propName === "className") {
|
|
125
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return { ...slotProps, ...overrideProps };
|
|
129
|
-
}
|
|
130
|
-
function getElementRef(element) {
|
|
131
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
132
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
133
|
-
if (mayWarn) {
|
|
134
|
-
return element.ref;
|
|
135
|
-
}
|
|
136
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
137
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
138
|
-
if (mayWarn) {
|
|
139
|
-
return element.props.ref;
|
|
140
|
-
}
|
|
141
|
-
return element.props.ref || element.ref;
|
|
142
|
-
}
|
|
143
|
-
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
144
|
-
var cx = clsx;
|
|
145
|
-
var cva = (base, config) => (props) => {
|
|
146
|
-
var _config_compoundVariants;
|
|
147
|
-
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
148
|
-
const { variants, defaultVariants } = config;
|
|
149
|
-
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
150
|
-
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
151
|
-
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
152
|
-
if (variantProp === null) return null;
|
|
153
|
-
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
154
|
-
return variants[variant][variantKey];
|
|
155
|
-
});
|
|
156
|
-
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
157
|
-
let [key, value] = param;
|
|
158
|
-
if (value === void 0) {
|
|
159
|
-
return acc;
|
|
160
|
-
}
|
|
161
|
-
acc[key] = value;
|
|
162
|
-
return acc;
|
|
163
|
-
}, {});
|
|
164
|
-
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
|
|
165
|
-
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
166
|
-
return Object.entries(compoundVariantOptions).every((param2) => {
|
|
167
|
-
let [key, value] = param2;
|
|
168
|
-
return Array.isArray(value) ? value.includes({
|
|
169
|
-
...defaultVariants,
|
|
170
|
-
...propsWithoutUndefined
|
|
171
|
-
}[key]) : {
|
|
172
|
-
...defaultVariants,
|
|
173
|
-
...propsWithoutUndefined
|
|
174
|
-
}[key] === value;
|
|
175
|
-
}) ? [
|
|
176
|
-
...acc,
|
|
177
|
-
cvClass,
|
|
178
|
-
cvClassName
|
|
179
|
-
] : acc;
|
|
180
|
-
}, []);
|
|
181
|
-
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
182
|
-
};
|
|
183
|
-
function cn(...inputs) {
|
|
184
|
-
return twMerge(clsx(inputs));
|
|
185
|
-
}
|
|
186
|
-
var buttonVariants = cva(
|
|
187
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
188
|
-
{
|
|
189
|
-
variants: {
|
|
190
|
-
variant: {
|
|
191
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
192
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
193
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
194
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
195
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
196
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
197
|
-
},
|
|
198
|
-
size: {
|
|
199
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
200
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
201
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
202
|
-
icon: "size-9",
|
|
203
|
-
"icon-sm": "size-8",
|
|
204
|
-
"icon-lg": "size-10"
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
defaultVariants: {
|
|
208
|
-
variant: "default",
|
|
209
|
-
size: "default"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
function Button({
|
|
214
|
-
className,
|
|
215
|
-
variant,
|
|
216
|
-
size,
|
|
217
|
-
asChild = false,
|
|
218
|
-
...props
|
|
219
|
-
}) {
|
|
220
|
-
const Comp = asChild ? Slot : "button";
|
|
221
|
-
return /* @__PURE__ */ jsx(
|
|
222
|
-
Comp,
|
|
223
|
-
{
|
|
224
|
-
"data-slot": "button",
|
|
225
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
226
|
-
...props
|
|
227
|
-
}
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
function Accordion({
|
|
231
|
-
...props
|
|
232
|
-
}) {
|
|
233
|
-
return /* @__PURE__ */ jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
|
|
234
|
-
}
|
|
235
|
-
function AccordionItem({
|
|
236
|
-
className,
|
|
237
|
-
...props
|
|
238
|
-
}) {
|
|
239
|
-
return /* @__PURE__ */ jsx(
|
|
240
|
-
AccordionPrimitive.Item,
|
|
241
|
-
{
|
|
242
|
-
"data-slot": "accordion-item",
|
|
243
|
-
className: cn("border-b last:border-b-0", className),
|
|
244
|
-
...props
|
|
245
|
-
}
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
function AccordionTrigger({
|
|
249
|
-
className,
|
|
250
|
-
children,
|
|
251
|
-
...props
|
|
252
|
-
}) {
|
|
253
|
-
return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
254
|
-
AccordionPrimitive.Trigger,
|
|
255
|
-
{
|
|
256
|
-
"data-slot": "accordion-trigger",
|
|
257
|
-
className: cn(
|
|
258
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
259
|
-
className
|
|
260
|
-
),
|
|
261
|
-
...props,
|
|
262
|
-
children: [
|
|
263
|
-
children,
|
|
264
|
-
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
|
|
265
|
-
]
|
|
266
|
-
}
|
|
267
|
-
) });
|
|
268
|
-
}
|
|
269
|
-
function AccordionContent({
|
|
270
|
-
className,
|
|
271
|
-
children,
|
|
272
|
-
...props
|
|
273
|
-
}) {
|
|
274
|
-
return /* @__PURE__ */ jsx(
|
|
275
|
-
AccordionPrimitive.Content,
|
|
276
|
-
{
|
|
277
|
-
"data-slot": "accordion-content",
|
|
278
|
-
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
279
|
-
...props,
|
|
280
|
-
children: /* @__PURE__ */ jsx("div", { className: cn("pt-0 pb-4", className), children })
|
|
281
|
-
}
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
function createContext2(rootComponentName, defaultContext) {
|
|
285
|
-
const Context = React25.createContext(defaultContext);
|
|
286
|
-
const Provider = (props) => {
|
|
287
|
-
const { children, ...context } = props;
|
|
288
|
-
const value = React25.useMemo(() => context, Object.values(context));
|
|
289
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
290
|
-
};
|
|
291
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
292
|
-
function useContext22(consumerName) {
|
|
293
|
-
const context = React25.useContext(Context);
|
|
294
|
-
if (context) return context;
|
|
295
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
296
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
297
|
-
}
|
|
298
|
-
return [Provider, useContext22];
|
|
299
|
-
}
|
|
300
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
301
|
-
let defaultContexts = [];
|
|
302
|
-
function createContext32(rootComponentName, defaultContext) {
|
|
303
|
-
const BaseContext = React25.createContext(defaultContext);
|
|
304
|
-
const index = defaultContexts.length;
|
|
305
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
306
|
-
const Provider = (props) => {
|
|
307
|
-
const { scope, children, ...context } = props;
|
|
308
|
-
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
309
|
-
const value = React25.useMemo(() => context, Object.values(context));
|
|
310
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
311
|
-
};
|
|
312
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
313
|
-
function useContext22(consumerName, scope) {
|
|
314
|
-
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
315
|
-
const context = React25.useContext(Context);
|
|
316
|
-
if (context) return context;
|
|
317
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
318
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
319
|
-
}
|
|
320
|
-
return [Provider, useContext22];
|
|
321
|
-
}
|
|
322
|
-
const createScope = () => {
|
|
323
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
324
|
-
return React25.createContext(defaultContext);
|
|
325
|
-
});
|
|
326
|
-
return function useScope(scope) {
|
|
327
|
-
const contexts = scope?.[scopeName] || scopeContexts;
|
|
328
|
-
return React25.useMemo(
|
|
329
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
330
|
-
[scope, contexts]
|
|
331
|
-
);
|
|
332
|
-
};
|
|
333
|
-
};
|
|
334
|
-
createScope.scopeName = scopeName;
|
|
335
|
-
return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
336
|
-
}
|
|
337
|
-
function composeContextScopes(...scopes) {
|
|
338
|
-
const baseScope = scopes[0];
|
|
339
|
-
if (scopes.length === 1) return baseScope;
|
|
340
|
-
const createScope = () => {
|
|
341
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
342
|
-
useScope: createScope2(),
|
|
343
|
-
scopeName: createScope2.scopeName
|
|
344
|
-
}));
|
|
345
|
-
return function useComposedScopes(overrideScopes) {
|
|
346
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
347
|
-
const scopeProps = useScope(overrideScopes);
|
|
348
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
349
|
-
return { ...nextScopes2, ...currentScope };
|
|
350
|
-
}, {});
|
|
351
|
-
return React25.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
352
|
-
};
|
|
353
|
-
};
|
|
354
|
-
createScope.scopeName = baseScope.scopeName;
|
|
355
|
-
return createScope;
|
|
356
|
-
}
|
|
357
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
358
|
-
return function handleEvent(event) {
|
|
359
|
-
originalEventHandler?.(event);
|
|
360
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
361
|
-
return ourEventHandler?.(event);
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
var useLayoutEffect2 = globalThis?.document ? React25.useLayoutEffect : () => {
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
// ../node_modules/.pnpm/@radix-ui+react-id@1.1.1_@types+react@19.2.8_react@19.2.3/node_modules/@radix-ui/react-id/dist/index.mjs
|
|
369
|
-
var useReactId = React25[" useId ".trim().toString()] || (() => void 0);
|
|
370
|
-
var count = 0;
|
|
371
|
-
function useId(deterministicId) {
|
|
372
|
-
const [id, setId] = React25.useState(useReactId());
|
|
373
|
-
useLayoutEffect2(() => {
|
|
374
|
-
setId((reactId) => reactId ?? String(count++));
|
|
375
|
-
}, [deterministicId]);
|
|
376
|
-
return deterministicId || (id ? `radix-${id}` : "");
|
|
377
|
-
}
|
|
378
|
-
var useInsertionEffect = React25[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
379
|
-
function useControllableState({
|
|
380
|
-
prop,
|
|
381
|
-
defaultProp,
|
|
382
|
-
onChange = () => {
|
|
383
|
-
},
|
|
384
|
-
caller
|
|
385
|
-
}) {
|
|
386
|
-
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
387
|
-
defaultProp,
|
|
388
|
-
onChange
|
|
389
|
-
});
|
|
390
|
-
const isControlled = prop !== void 0;
|
|
391
|
-
const value = isControlled ? prop : uncontrolledProp;
|
|
392
|
-
{
|
|
393
|
-
const isControlledRef = React25.useRef(prop !== void 0);
|
|
394
|
-
React25.useEffect(() => {
|
|
395
|
-
const wasControlled = isControlledRef.current;
|
|
396
|
-
if (wasControlled !== isControlled) {
|
|
397
|
-
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
398
|
-
const to = isControlled ? "controlled" : "uncontrolled";
|
|
399
|
-
console.warn(
|
|
400
|
-
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
isControlledRef.current = isControlled;
|
|
404
|
-
}, [isControlled, caller]);
|
|
405
|
-
}
|
|
406
|
-
const setValue = React25.useCallback(
|
|
407
|
-
(nextValue) => {
|
|
408
|
-
if (isControlled) {
|
|
409
|
-
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
410
|
-
if (value2 !== prop) {
|
|
411
|
-
onChangeRef.current?.(value2);
|
|
412
|
-
}
|
|
413
|
-
} else {
|
|
414
|
-
setUncontrolledProp(nextValue);
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
418
|
-
);
|
|
419
|
-
return [value, setValue];
|
|
420
|
-
}
|
|
421
|
-
function useUncontrolledState({
|
|
422
|
-
defaultProp,
|
|
423
|
-
onChange
|
|
424
|
-
}) {
|
|
425
|
-
const [value, setValue] = React25.useState(defaultProp);
|
|
426
|
-
const prevValueRef = React25.useRef(value);
|
|
427
|
-
const onChangeRef = React25.useRef(onChange);
|
|
428
|
-
useInsertionEffect(() => {
|
|
429
|
-
onChangeRef.current = onChange;
|
|
430
|
-
}, [onChange]);
|
|
431
|
-
React25.useEffect(() => {
|
|
432
|
-
if (prevValueRef.current !== value) {
|
|
433
|
-
onChangeRef.current?.(value);
|
|
434
|
-
prevValueRef.current = value;
|
|
435
|
-
}
|
|
436
|
-
}, [value, prevValueRef]);
|
|
437
|
-
return [value, setValue, onChangeRef];
|
|
438
|
-
}
|
|
439
|
-
function isFunction(value) {
|
|
440
|
-
return typeof value === "function";
|
|
441
|
-
}
|
|
442
|
-
// @__NO_SIDE_EFFECTS__
|
|
443
|
-
function createSlot2(ownerName) {
|
|
444
|
-
const SlotClone = /* @__PURE__ */ createSlotClone2(ownerName);
|
|
445
|
-
const Slot22 = React25.forwardRef((props, forwardedRef) => {
|
|
446
|
-
const { children, ...slotProps } = props;
|
|
447
|
-
const childrenArray = React25.Children.toArray(children);
|
|
448
|
-
const slottable = childrenArray.find(isSlottable2);
|
|
449
|
-
if (slottable) {
|
|
450
|
-
const newElement = slottable.props.children;
|
|
451
|
-
const newChildren = childrenArray.map((child) => {
|
|
452
|
-
if (child === slottable) {
|
|
453
|
-
if (React25.Children.count(newElement) > 1) return React25.Children.only(null);
|
|
454
|
-
return React25.isValidElement(newElement) ? newElement.props.children : null;
|
|
455
|
-
} else {
|
|
456
|
-
return child;
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React25.isValidElement(newElement) ? React25.cloneElement(newElement, void 0, newChildren) : null });
|
|
460
|
-
}
|
|
461
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
462
|
-
});
|
|
463
|
-
Slot22.displayName = `${ownerName}.Slot`;
|
|
464
|
-
return Slot22;
|
|
465
|
-
}
|
|
466
|
-
// @__NO_SIDE_EFFECTS__
|
|
467
|
-
function createSlotClone2(ownerName) {
|
|
468
|
-
const SlotClone = React25.forwardRef((props, forwardedRef) => {
|
|
469
|
-
const { children, ...slotProps } = props;
|
|
470
|
-
if (React25.isValidElement(children)) {
|
|
471
|
-
const childrenRef = getElementRef2(children);
|
|
472
|
-
const props2 = mergeProps2(slotProps, children.props);
|
|
473
|
-
if (children.type !== React25.Fragment) {
|
|
474
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
475
|
-
}
|
|
476
|
-
return React25.cloneElement(children, props2);
|
|
477
|
-
}
|
|
478
|
-
return React25.Children.count(children) > 1 ? React25.Children.only(null) : null;
|
|
479
|
-
});
|
|
480
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
481
|
-
return SlotClone;
|
|
482
|
-
}
|
|
483
|
-
var SLOTTABLE_IDENTIFIER2 = /* @__PURE__ */ Symbol("radix.slottable");
|
|
484
|
-
// @__NO_SIDE_EFFECTS__
|
|
485
|
-
function createSlottable(ownerName) {
|
|
486
|
-
const Slottable2 = ({ children }) => {
|
|
487
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
488
|
-
};
|
|
489
|
-
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
490
|
-
Slottable2.__radixId = SLOTTABLE_IDENTIFIER2;
|
|
491
|
-
return Slottable2;
|
|
492
|
-
}
|
|
493
|
-
function isSlottable2(child) {
|
|
494
|
-
return React25.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER2;
|
|
495
|
-
}
|
|
496
|
-
function mergeProps2(slotProps, childProps) {
|
|
497
|
-
const overrideProps = { ...childProps };
|
|
498
|
-
for (const propName in childProps) {
|
|
499
|
-
const slotPropValue = slotProps[propName];
|
|
500
|
-
const childPropValue = childProps[propName];
|
|
501
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
502
|
-
if (isHandler) {
|
|
503
|
-
if (slotPropValue && childPropValue) {
|
|
504
|
-
overrideProps[propName] = (...args) => {
|
|
505
|
-
const result = childPropValue(...args);
|
|
506
|
-
slotPropValue(...args);
|
|
507
|
-
return result;
|
|
508
|
-
};
|
|
509
|
-
} else if (slotPropValue) {
|
|
510
|
-
overrideProps[propName] = slotPropValue;
|
|
511
|
-
}
|
|
512
|
-
} else if (propName === "style") {
|
|
513
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
514
|
-
} else if (propName === "className") {
|
|
515
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
return { ...slotProps, ...overrideProps };
|
|
519
|
-
}
|
|
520
|
-
function getElementRef2(element) {
|
|
521
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
522
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
523
|
-
if (mayWarn) {
|
|
524
|
-
return element.ref;
|
|
525
|
-
}
|
|
526
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
527
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
528
|
-
if (mayWarn) {
|
|
529
|
-
return element.props.ref;
|
|
530
|
-
}
|
|
531
|
-
return element.props.ref || element.ref;
|
|
532
|
-
}
|
|
533
|
-
var NODES = [
|
|
534
|
-
"a",
|
|
535
|
-
"button",
|
|
536
|
-
"div",
|
|
537
|
-
"form",
|
|
538
|
-
"h2",
|
|
539
|
-
"h3",
|
|
540
|
-
"img",
|
|
541
|
-
"input",
|
|
542
|
-
"label",
|
|
543
|
-
"li",
|
|
544
|
-
"nav",
|
|
545
|
-
"ol",
|
|
546
|
-
"p",
|
|
547
|
-
"select",
|
|
548
|
-
"span",
|
|
549
|
-
"svg",
|
|
550
|
-
"ul"
|
|
551
|
-
];
|
|
552
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
553
|
-
const Slot3 = createSlot2(`Primitive.${node}`);
|
|
554
|
-
const Node2 = React25.forwardRef((props, forwardedRef) => {
|
|
555
|
-
const { asChild, ...primitiveProps } = props;
|
|
556
|
-
const Comp = asChild ? Slot3 : node;
|
|
557
|
-
if (typeof window !== "undefined") {
|
|
558
|
-
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
559
|
-
}
|
|
560
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
561
|
-
});
|
|
562
|
-
Node2.displayName = `Primitive.${node}`;
|
|
563
|
-
return { ...primitive, [node]: Node2 };
|
|
564
|
-
}, {});
|
|
565
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
566
|
-
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
567
|
-
}
|
|
568
|
-
function useCallbackRef(callback) {
|
|
569
|
-
const callbackRef = React25.useRef(callback);
|
|
570
|
-
React25.useEffect(() => {
|
|
571
|
-
callbackRef.current = callback;
|
|
572
|
-
});
|
|
573
|
-
return React25.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
574
|
-
}
|
|
575
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
576
|
-
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
577
|
-
React25.useEffect(() => {
|
|
578
|
-
const handleKeyDown = (event) => {
|
|
579
|
-
if (event.key === "Escape") {
|
|
580
|
-
onEscapeKeyDown(event);
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
584
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
585
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
586
|
-
}
|
|
587
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
588
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
589
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
590
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
591
|
-
var originalBodyPointerEvents;
|
|
592
|
-
var DismissableLayerContext = React25.createContext({
|
|
593
|
-
layers: /* @__PURE__ */ new Set(),
|
|
594
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
595
|
-
branches: /* @__PURE__ */ new Set()
|
|
596
|
-
});
|
|
597
|
-
var DismissableLayer = React25.forwardRef(
|
|
598
|
-
(props, forwardedRef) => {
|
|
599
|
-
const {
|
|
600
|
-
disableOutsidePointerEvents = false,
|
|
601
|
-
onEscapeKeyDown,
|
|
602
|
-
onPointerDownOutside,
|
|
603
|
-
onFocusOutside,
|
|
604
|
-
onInteractOutside,
|
|
605
|
-
onDismiss,
|
|
606
|
-
...layerProps
|
|
607
|
-
} = props;
|
|
608
|
-
const context = React25.useContext(DismissableLayerContext);
|
|
609
|
-
const [node, setNode] = React25.useState(null);
|
|
610
|
-
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
611
|
-
const [, force] = React25.useState({});
|
|
612
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
613
|
-
const layers = Array.from(context.layers);
|
|
614
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
615
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
616
|
-
const index = node ? layers.indexOf(node) : -1;
|
|
617
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
618
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
619
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
620
|
-
const target = event.target;
|
|
621
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
622
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
623
|
-
onPointerDownOutside?.(event);
|
|
624
|
-
onInteractOutside?.(event);
|
|
625
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
626
|
-
}, ownerDocument);
|
|
627
|
-
const focusOutside = useFocusOutside((event) => {
|
|
628
|
-
const target = event.target;
|
|
629
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
630
|
-
if (isFocusInBranch) return;
|
|
631
|
-
onFocusOutside?.(event);
|
|
632
|
-
onInteractOutside?.(event);
|
|
633
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
634
|
-
}, ownerDocument);
|
|
635
|
-
useEscapeKeydown((event) => {
|
|
636
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
637
|
-
if (!isHighestLayer) return;
|
|
638
|
-
onEscapeKeyDown?.(event);
|
|
639
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
640
|
-
event.preventDefault();
|
|
641
|
-
onDismiss();
|
|
642
|
-
}
|
|
643
|
-
}, ownerDocument);
|
|
644
|
-
React25.useEffect(() => {
|
|
645
|
-
if (!node) return;
|
|
646
|
-
if (disableOutsidePointerEvents) {
|
|
647
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
648
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
649
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
650
|
-
}
|
|
651
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
652
|
-
}
|
|
653
|
-
context.layers.add(node);
|
|
654
|
-
dispatchUpdate();
|
|
655
|
-
return () => {
|
|
656
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
657
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
661
|
-
React25.useEffect(() => {
|
|
662
|
-
return () => {
|
|
663
|
-
if (!node) return;
|
|
664
|
-
context.layers.delete(node);
|
|
665
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
666
|
-
dispatchUpdate();
|
|
667
|
-
};
|
|
668
|
-
}, [node, context]);
|
|
669
|
-
React25.useEffect(() => {
|
|
670
|
-
const handleUpdate = () => force({});
|
|
671
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
672
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
673
|
-
}, []);
|
|
674
|
-
return /* @__PURE__ */ jsx(
|
|
675
|
-
Primitive.div,
|
|
676
|
-
{
|
|
677
|
-
...layerProps,
|
|
678
|
-
ref: composedRefs,
|
|
679
|
-
style: {
|
|
680
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
681
|
-
...props.style
|
|
682
|
-
},
|
|
683
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
684
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
685
|
-
onPointerDownCapture: composeEventHandlers(
|
|
686
|
-
props.onPointerDownCapture,
|
|
687
|
-
pointerDownOutside.onPointerDownCapture
|
|
688
|
-
)
|
|
689
|
-
}
|
|
690
|
-
);
|
|
691
|
-
}
|
|
692
|
-
);
|
|
693
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
694
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
695
|
-
var DismissableLayerBranch = React25.forwardRef((props, forwardedRef) => {
|
|
696
|
-
const context = React25.useContext(DismissableLayerContext);
|
|
697
|
-
const ref = React25.useRef(null);
|
|
698
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
699
|
-
React25.useEffect(() => {
|
|
700
|
-
const node = ref.current;
|
|
701
|
-
if (node) {
|
|
702
|
-
context.branches.add(node);
|
|
703
|
-
return () => {
|
|
704
|
-
context.branches.delete(node);
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
}, [context.branches]);
|
|
708
|
-
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
709
|
-
});
|
|
710
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
711
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
712
|
-
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
713
|
-
const isPointerInsideReactTreeRef = React25.useRef(false);
|
|
714
|
-
const handleClickRef = React25.useRef(() => {
|
|
715
|
-
});
|
|
716
|
-
React25.useEffect(() => {
|
|
717
|
-
const handlePointerDown = (event) => {
|
|
718
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
719
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
720
|
-
handleAndDispatchCustomEvent(
|
|
721
|
-
POINTER_DOWN_OUTSIDE,
|
|
722
|
-
handlePointerDownOutside,
|
|
723
|
-
eventDetail,
|
|
724
|
-
{ discrete: true }
|
|
725
|
-
);
|
|
726
|
-
};
|
|
727
|
-
const eventDetail = { originalEvent: event };
|
|
728
|
-
if (event.pointerType === "touch") {
|
|
729
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
730
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
731
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
732
|
-
} else {
|
|
733
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
734
|
-
}
|
|
735
|
-
} else {
|
|
736
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
737
|
-
}
|
|
738
|
-
isPointerInsideReactTreeRef.current = false;
|
|
739
|
-
};
|
|
740
|
-
const timerId = window.setTimeout(() => {
|
|
741
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
742
|
-
}, 0);
|
|
743
|
-
return () => {
|
|
744
|
-
window.clearTimeout(timerId);
|
|
745
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
746
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
747
|
-
};
|
|
748
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
749
|
-
return {
|
|
750
|
-
// ensures we check React component tree (not just DOM tree)
|
|
751
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
755
|
-
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
756
|
-
const isFocusInsideReactTreeRef = React25.useRef(false);
|
|
757
|
-
React25.useEffect(() => {
|
|
758
|
-
const handleFocus = (event) => {
|
|
759
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
760
|
-
const eventDetail = { originalEvent: event };
|
|
761
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
762
|
-
discrete: false
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
767
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
768
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
769
|
-
return {
|
|
770
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
771
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
function dispatchUpdate() {
|
|
775
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
776
|
-
document.dispatchEvent(event);
|
|
777
|
-
}
|
|
778
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
779
|
-
const target = detail.originalEvent.target;
|
|
780
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
781
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
782
|
-
if (discrete) {
|
|
783
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
784
|
-
} else {
|
|
785
|
-
target.dispatchEvent(event);
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
789
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
790
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
791
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
792
|
-
var FocusScope = React25.forwardRef((props, forwardedRef) => {
|
|
793
|
-
const {
|
|
794
|
-
loop = false,
|
|
795
|
-
trapped = false,
|
|
796
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
797
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
798
|
-
...scopeProps
|
|
799
|
-
} = props;
|
|
800
|
-
const [container, setContainer] = React25.useState(null);
|
|
801
|
-
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
802
|
-
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
803
|
-
const lastFocusedElementRef = React25.useRef(null);
|
|
804
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
805
|
-
const focusScope = React25.useRef({
|
|
806
|
-
paused: false,
|
|
807
|
-
pause() {
|
|
808
|
-
this.paused = true;
|
|
809
|
-
},
|
|
810
|
-
resume() {
|
|
811
|
-
this.paused = false;
|
|
812
|
-
}
|
|
813
|
-
}).current;
|
|
814
|
-
React25.useEffect(() => {
|
|
815
|
-
if (trapped) {
|
|
816
|
-
let handleFocusIn2 = function(event) {
|
|
817
|
-
if (focusScope.paused || !container) return;
|
|
818
|
-
const target = event.target;
|
|
819
|
-
if (container.contains(target)) {
|
|
820
|
-
lastFocusedElementRef.current = target;
|
|
821
|
-
} else {
|
|
822
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
823
|
-
}
|
|
824
|
-
}, handleFocusOut2 = function(event) {
|
|
825
|
-
if (focusScope.paused || !container) return;
|
|
826
|
-
const relatedTarget = event.relatedTarget;
|
|
827
|
-
if (relatedTarget === null) return;
|
|
828
|
-
if (!container.contains(relatedTarget)) {
|
|
829
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
830
|
-
}
|
|
831
|
-
}, handleMutations2 = function(mutations) {
|
|
832
|
-
const focusedElement = document.activeElement;
|
|
833
|
-
if (focusedElement !== document.body) return;
|
|
834
|
-
for (const mutation of mutations) {
|
|
835
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
836
|
-
}
|
|
837
|
-
};
|
|
838
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
839
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
840
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
841
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
842
|
-
return () => {
|
|
843
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
844
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
845
|
-
mutationObserver.disconnect();
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
}, [trapped, container, focusScope.paused]);
|
|
849
|
-
React25.useEffect(() => {
|
|
850
|
-
if (container) {
|
|
851
|
-
focusScopesStack.add(focusScope);
|
|
852
|
-
const previouslyFocusedElement = document.activeElement;
|
|
853
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
854
|
-
if (!hasFocusedCandidate) {
|
|
855
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
856
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
857
|
-
container.dispatchEvent(mountEvent);
|
|
858
|
-
if (!mountEvent.defaultPrevented) {
|
|
859
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
860
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
861
|
-
focus(container);
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
return () => {
|
|
866
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
867
|
-
setTimeout(() => {
|
|
868
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
869
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
870
|
-
container.dispatchEvent(unmountEvent);
|
|
871
|
-
if (!unmountEvent.defaultPrevented) {
|
|
872
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
873
|
-
}
|
|
874
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
875
|
-
focusScopesStack.remove(focusScope);
|
|
876
|
-
}, 0);
|
|
877
|
-
};
|
|
878
|
-
}
|
|
879
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
880
|
-
const handleKeyDown = React25.useCallback(
|
|
881
|
-
(event) => {
|
|
882
|
-
if (!loop && !trapped) return;
|
|
883
|
-
if (focusScope.paused) return;
|
|
884
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
885
|
-
const focusedElement = document.activeElement;
|
|
886
|
-
if (isTabKey && focusedElement) {
|
|
887
|
-
const container2 = event.currentTarget;
|
|
888
|
-
const [first, last] = getTabbableEdges(container2);
|
|
889
|
-
const hasTabbableElementsInside = first && last;
|
|
890
|
-
if (!hasTabbableElementsInside) {
|
|
891
|
-
if (focusedElement === container2) event.preventDefault();
|
|
892
|
-
} else {
|
|
893
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
894
|
-
event.preventDefault();
|
|
895
|
-
if (loop) focus(first, { select: true });
|
|
896
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
897
|
-
event.preventDefault();
|
|
898
|
-
if (loop) focus(last, { select: true });
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
},
|
|
903
|
-
[loop, trapped, focusScope.paused]
|
|
904
|
-
);
|
|
905
|
-
return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
906
|
-
});
|
|
907
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
908
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
909
|
-
const previouslyFocusedElement = document.activeElement;
|
|
910
|
-
for (const candidate of candidates) {
|
|
911
|
-
focus(candidate, { select });
|
|
912
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
function getTabbableEdges(container) {
|
|
916
|
-
const candidates = getTabbableCandidates(container);
|
|
917
|
-
const first = findVisible(candidates, container);
|
|
918
|
-
const last = findVisible(candidates.reverse(), container);
|
|
919
|
-
return [first, last];
|
|
920
|
-
}
|
|
921
|
-
function getTabbableCandidates(container) {
|
|
922
|
-
const nodes = [];
|
|
923
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
924
|
-
acceptNode: (node) => {
|
|
925
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
926
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
927
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
931
|
-
return nodes;
|
|
932
|
-
}
|
|
933
|
-
function findVisible(elements, container) {
|
|
934
|
-
for (const element of elements) {
|
|
935
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
function isHidden(node, { upTo }) {
|
|
939
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
940
|
-
while (node) {
|
|
941
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
942
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
943
|
-
node = node.parentElement;
|
|
944
|
-
}
|
|
945
|
-
return false;
|
|
946
|
-
}
|
|
947
|
-
function isSelectableInput(element) {
|
|
948
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
949
|
-
}
|
|
950
|
-
function focus(element, { select = false } = {}) {
|
|
951
|
-
if (element && element.focus) {
|
|
952
|
-
const previouslyFocusedElement = document.activeElement;
|
|
953
|
-
element.focus({ preventScroll: true });
|
|
954
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
955
|
-
element.select();
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
var focusScopesStack = createFocusScopesStack();
|
|
959
|
-
function createFocusScopesStack() {
|
|
960
|
-
let stack = [];
|
|
961
|
-
return {
|
|
962
|
-
add(focusScope) {
|
|
963
|
-
const activeFocusScope = stack[0];
|
|
964
|
-
if (focusScope !== activeFocusScope) {
|
|
965
|
-
activeFocusScope?.pause();
|
|
966
|
-
}
|
|
967
|
-
stack = arrayRemove(stack, focusScope);
|
|
968
|
-
stack.unshift(focusScope);
|
|
969
|
-
},
|
|
970
|
-
remove(focusScope) {
|
|
971
|
-
stack = arrayRemove(stack, focusScope);
|
|
972
|
-
stack[0]?.resume();
|
|
973
|
-
}
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
function arrayRemove(array, item) {
|
|
977
|
-
const updatedArray = [...array];
|
|
978
|
-
const index = updatedArray.indexOf(item);
|
|
979
|
-
if (index !== -1) {
|
|
980
|
-
updatedArray.splice(index, 1);
|
|
981
|
-
}
|
|
982
|
-
return updatedArray;
|
|
983
|
-
}
|
|
984
|
-
function removeLinks(items) {
|
|
985
|
-
return items.filter((item) => item.tagName !== "A");
|
|
986
|
-
}
|
|
987
|
-
var PORTAL_NAME = "Portal";
|
|
988
|
-
var Portal = React25.forwardRef((props, forwardedRef) => {
|
|
989
|
-
const { container: containerProp, ...portalProps } = props;
|
|
990
|
-
const [mounted, setMounted] = React25.useState(false);
|
|
991
|
-
useLayoutEffect2(() => setMounted(true), []);
|
|
992
|
-
const container = containerProp || mounted && globalThis?.document?.body;
|
|
993
|
-
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
994
|
-
});
|
|
995
|
-
Portal.displayName = PORTAL_NAME;
|
|
996
|
-
function useStateMachine(initialState, machine) {
|
|
997
|
-
return React25.useReducer((state, event) => {
|
|
998
|
-
const nextState = machine[state][event];
|
|
999
|
-
return nextState ?? state;
|
|
1000
|
-
}, initialState);
|
|
1001
|
-
}
|
|
1002
|
-
var Presence = (props) => {
|
|
1003
|
-
const { present, children } = props;
|
|
1004
|
-
const presence = usePresence(present);
|
|
1005
|
-
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React25.Children.only(children);
|
|
1006
|
-
const ref = useComposedRefs(presence.ref, getElementRef3(child));
|
|
1007
|
-
const forceMount = typeof children === "function";
|
|
1008
|
-
return forceMount || presence.isPresent ? React25.cloneElement(child, { ref }) : null;
|
|
1009
|
-
};
|
|
1010
|
-
Presence.displayName = "Presence";
|
|
1011
|
-
function usePresence(present) {
|
|
1012
|
-
const [node, setNode] = React25.useState();
|
|
1013
|
-
const stylesRef = React25.useRef(null);
|
|
1014
|
-
const prevPresentRef = React25.useRef(present);
|
|
1015
|
-
const prevAnimationNameRef = React25.useRef("none");
|
|
1016
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
1017
|
-
const [state, send] = useStateMachine(initialState, {
|
|
1018
|
-
mounted: {
|
|
1019
|
-
UNMOUNT: "unmounted",
|
|
1020
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
1021
|
-
},
|
|
1022
|
-
unmountSuspended: {
|
|
1023
|
-
MOUNT: "mounted",
|
|
1024
|
-
ANIMATION_END: "unmounted"
|
|
1025
|
-
},
|
|
1026
|
-
unmounted: {
|
|
1027
|
-
MOUNT: "mounted"
|
|
1028
|
-
}
|
|
1029
|
-
});
|
|
1030
|
-
React25.useEffect(() => {
|
|
1031
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1032
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
1033
|
-
}, [state]);
|
|
1034
|
-
useLayoutEffect2(() => {
|
|
1035
|
-
const styles = stylesRef.current;
|
|
1036
|
-
const wasPresent = prevPresentRef.current;
|
|
1037
|
-
const hasPresentChanged = wasPresent !== present;
|
|
1038
|
-
if (hasPresentChanged) {
|
|
1039
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
1040
|
-
const currentAnimationName = getAnimationName(styles);
|
|
1041
|
-
if (present) {
|
|
1042
|
-
send("MOUNT");
|
|
1043
|
-
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
1044
|
-
send("UNMOUNT");
|
|
1045
|
-
} else {
|
|
1046
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
1047
|
-
if (wasPresent && isAnimating) {
|
|
1048
|
-
send("ANIMATION_OUT");
|
|
1049
|
-
} else {
|
|
1050
|
-
send("UNMOUNT");
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
prevPresentRef.current = present;
|
|
1054
|
-
}
|
|
1055
|
-
}, [present, send]);
|
|
1056
|
-
useLayoutEffect2(() => {
|
|
1057
|
-
if (node) {
|
|
1058
|
-
let timeoutId;
|
|
1059
|
-
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
1060
|
-
const handleAnimationEnd = (event) => {
|
|
1061
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1062
|
-
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
1063
|
-
if (event.target === node && isCurrentAnimation) {
|
|
1064
|
-
send("ANIMATION_END");
|
|
1065
|
-
if (!prevPresentRef.current) {
|
|
1066
|
-
const currentFillMode = node.style.animationFillMode;
|
|
1067
|
-
node.style.animationFillMode = "forwards";
|
|
1068
|
-
timeoutId = ownerWindow.setTimeout(() => {
|
|
1069
|
-
if (node.style.animationFillMode === "forwards") {
|
|
1070
|
-
node.style.animationFillMode = currentFillMode;
|
|
1071
|
-
}
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
};
|
|
1076
|
-
const handleAnimationStart = (event) => {
|
|
1077
|
-
if (event.target === node) {
|
|
1078
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
1079
|
-
}
|
|
1080
|
-
};
|
|
1081
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
1082
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
1083
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
1084
|
-
return () => {
|
|
1085
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
1086
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
1087
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
1088
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
1089
|
-
};
|
|
1090
|
-
} else {
|
|
1091
|
-
send("ANIMATION_END");
|
|
1092
|
-
}
|
|
1093
|
-
}, [node, send]);
|
|
1094
|
-
return {
|
|
1095
|
-
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
1096
|
-
ref: React25.useCallback((node2) => {
|
|
1097
|
-
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
1098
|
-
setNode(node2);
|
|
1099
|
-
}, [])
|
|
1100
|
-
};
|
|
1101
|
-
}
|
|
1102
|
-
function getAnimationName(styles) {
|
|
1103
|
-
return styles?.animationName || "none";
|
|
1104
|
-
}
|
|
1105
|
-
function getElementRef3(element) {
|
|
1106
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1107
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1108
|
-
if (mayWarn) {
|
|
1109
|
-
return element.ref;
|
|
1110
|
-
}
|
|
1111
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1112
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1113
|
-
if (mayWarn) {
|
|
1114
|
-
return element.props.ref;
|
|
1115
|
-
}
|
|
1116
|
-
return element.props.ref || element.ref;
|
|
1117
|
-
}
|
|
1118
|
-
var count2 = 0;
|
|
1119
|
-
function useFocusGuards() {
|
|
1120
|
-
React25.useEffect(() => {
|
|
1121
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
1122
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
1123
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
1124
|
-
count2++;
|
|
1125
|
-
return () => {
|
|
1126
|
-
if (count2 === 1) {
|
|
1127
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
1128
|
-
}
|
|
1129
|
-
count2--;
|
|
1130
|
-
};
|
|
1131
|
-
}, []);
|
|
1132
|
-
}
|
|
1133
|
-
function createFocusGuard() {
|
|
1134
|
-
const element = document.createElement("span");
|
|
1135
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
1136
|
-
element.tabIndex = 0;
|
|
1137
|
-
element.style.outline = "none";
|
|
1138
|
-
element.style.opacity = "0";
|
|
1139
|
-
element.style.position = "fixed";
|
|
1140
|
-
element.style.pointerEvents = "none";
|
|
1141
|
-
return element;
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
// ../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
1145
|
-
var __assign = function() {
|
|
1146
|
-
__assign = Object.assign || function __assign2(t) {
|
|
1147
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1148
|
-
s = arguments[i];
|
|
1149
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
1150
|
-
}
|
|
1151
|
-
return t;
|
|
1152
|
-
};
|
|
1153
|
-
return __assign.apply(this, arguments);
|
|
1154
|
-
};
|
|
1155
|
-
function __rest(s, e) {
|
|
1156
|
-
var t = {};
|
|
1157
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1158
|
-
t[p] = s[p];
|
|
1159
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1160
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1161
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1162
|
-
t[p[i]] = s[p[i]];
|
|
1163
|
-
}
|
|
1164
|
-
return t;
|
|
1165
|
-
}
|
|
1166
|
-
function __spreadArray(to, from, pack) {
|
|
1167
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1168
|
-
if (ar || !(i in from)) {
|
|
1169
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1170
|
-
ar[i] = from[i];
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
// ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll-bar/dist/es2015/constants.js
|
|
1177
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
1178
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
1179
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
1180
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
1181
|
-
|
|
1182
|
-
// ../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@19.2.8_react@19.2.3/node_modules/use-callback-ref/dist/es2015/assignRef.js
|
|
1183
|
-
function assignRef(ref, value) {
|
|
1184
|
-
if (typeof ref === "function") {
|
|
1185
|
-
ref(value);
|
|
1186
|
-
} else if (ref) {
|
|
1187
|
-
ref.current = value;
|
|
1188
|
-
}
|
|
1189
|
-
return ref;
|
|
1190
|
-
}
|
|
1191
|
-
function useCallbackRef2(initialValue, callback) {
|
|
1192
|
-
var ref = useState(function() {
|
|
1193
|
-
return {
|
|
1194
|
-
// value
|
|
1195
|
-
value: initialValue,
|
|
1196
|
-
// last callback
|
|
1197
|
-
callback,
|
|
1198
|
-
// "memoized" public interface
|
|
1199
|
-
facade: {
|
|
1200
|
-
get current() {
|
|
1201
|
-
return ref.value;
|
|
1202
|
-
},
|
|
1203
|
-
set current(value) {
|
|
1204
|
-
var last = ref.value;
|
|
1205
|
-
if (last !== value) {
|
|
1206
|
-
ref.value = value;
|
|
1207
|
-
ref.callback(value, last);
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
};
|
|
1212
|
-
})[0];
|
|
1213
|
-
ref.callback = callback;
|
|
1214
|
-
return ref.facade;
|
|
1215
|
-
}
|
|
1216
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React25.useLayoutEffect : React25.useEffect;
|
|
1217
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
1218
|
-
function useMergeRefs(refs, defaultValue) {
|
|
1219
|
-
var callbackRef = useCallbackRef2(null, function(newValue) {
|
|
1220
|
-
return refs.forEach(function(ref) {
|
|
1221
|
-
return assignRef(ref, newValue);
|
|
1222
|
-
});
|
|
1223
|
-
});
|
|
1224
|
-
useIsomorphicLayoutEffect(function() {
|
|
1225
|
-
var oldValue = currentValues.get(callbackRef);
|
|
1226
|
-
if (oldValue) {
|
|
1227
|
-
var prevRefs_1 = new Set(oldValue);
|
|
1228
|
-
var nextRefs_1 = new Set(refs);
|
|
1229
|
-
var current_1 = callbackRef.current;
|
|
1230
|
-
prevRefs_1.forEach(function(ref) {
|
|
1231
|
-
if (!nextRefs_1.has(ref)) {
|
|
1232
|
-
assignRef(ref, null);
|
|
1233
|
-
}
|
|
1234
|
-
});
|
|
1235
|
-
nextRefs_1.forEach(function(ref) {
|
|
1236
|
-
if (!prevRefs_1.has(ref)) {
|
|
1237
|
-
assignRef(ref, current_1);
|
|
1238
|
-
}
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
currentValues.set(callbackRef, refs);
|
|
1242
|
-
}, [refs]);
|
|
1243
|
-
return callbackRef;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
// ../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@19.2.8_react@19.2.3/node_modules/use-sidecar/dist/es2015/medium.js
|
|
1247
|
-
function ItoI(a) {
|
|
1248
|
-
return a;
|
|
1249
|
-
}
|
|
1250
|
-
function innerCreateMedium(defaults, middleware) {
|
|
1251
|
-
if (middleware === void 0) {
|
|
1252
|
-
middleware = ItoI;
|
|
1253
|
-
}
|
|
1254
|
-
var buffer = [];
|
|
1255
|
-
var assigned = false;
|
|
1256
|
-
var medium = {
|
|
1257
|
-
read: function() {
|
|
1258
|
-
if (assigned) {
|
|
1259
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
1260
|
-
}
|
|
1261
|
-
if (buffer.length) {
|
|
1262
|
-
return buffer[buffer.length - 1];
|
|
1263
|
-
}
|
|
1264
|
-
return defaults;
|
|
1265
|
-
},
|
|
1266
|
-
useMedium: function(data) {
|
|
1267
|
-
var item = middleware(data, assigned);
|
|
1268
|
-
buffer.push(item);
|
|
1269
|
-
return function() {
|
|
1270
|
-
buffer = buffer.filter(function(x) {
|
|
1271
|
-
return x !== item;
|
|
1272
|
-
});
|
|
1273
|
-
};
|
|
1274
|
-
},
|
|
1275
|
-
assignSyncMedium: function(cb) {
|
|
1276
|
-
assigned = true;
|
|
1277
|
-
while (buffer.length) {
|
|
1278
|
-
var cbs = buffer;
|
|
1279
|
-
buffer = [];
|
|
1280
|
-
cbs.forEach(cb);
|
|
1281
|
-
}
|
|
1282
|
-
buffer = {
|
|
1283
|
-
push: function(x) {
|
|
1284
|
-
return cb(x);
|
|
1285
|
-
},
|
|
1286
|
-
filter: function() {
|
|
1287
|
-
return buffer;
|
|
1288
|
-
}
|
|
1289
|
-
};
|
|
1290
|
-
},
|
|
1291
|
-
assignMedium: function(cb) {
|
|
1292
|
-
assigned = true;
|
|
1293
|
-
var pendingQueue = [];
|
|
1294
|
-
if (buffer.length) {
|
|
1295
|
-
var cbs = buffer;
|
|
1296
|
-
buffer = [];
|
|
1297
|
-
cbs.forEach(cb);
|
|
1298
|
-
pendingQueue = buffer;
|
|
1299
|
-
}
|
|
1300
|
-
var executeQueue = function() {
|
|
1301
|
-
var cbs2 = pendingQueue;
|
|
1302
|
-
pendingQueue = [];
|
|
1303
|
-
cbs2.forEach(cb);
|
|
1304
|
-
};
|
|
1305
|
-
var cycle = function() {
|
|
1306
|
-
return Promise.resolve().then(executeQueue);
|
|
1307
|
-
};
|
|
1308
|
-
cycle();
|
|
1309
|
-
buffer = {
|
|
1310
|
-
push: function(x) {
|
|
1311
|
-
pendingQueue.push(x);
|
|
1312
|
-
cycle();
|
|
1313
|
-
},
|
|
1314
|
-
filter: function(filter) {
|
|
1315
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
1316
|
-
return buffer;
|
|
1317
|
-
}
|
|
1318
|
-
};
|
|
1319
|
-
}
|
|
1320
|
-
};
|
|
1321
|
-
return medium;
|
|
1322
|
-
}
|
|
1323
|
-
function createSidecarMedium(options) {
|
|
1324
|
-
if (options === void 0) {
|
|
1325
|
-
options = {};
|
|
1326
|
-
}
|
|
1327
|
-
var medium = innerCreateMedium(null);
|
|
1328
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
1329
|
-
return medium;
|
|
1330
|
-
}
|
|
1331
|
-
var SideCar = function(_a) {
|
|
1332
|
-
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
1333
|
-
if (!sideCar) {
|
|
1334
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
1335
|
-
}
|
|
1336
|
-
var Target = sideCar.read();
|
|
1337
|
-
if (!Target) {
|
|
1338
|
-
throw new Error("Sidecar medium not found");
|
|
1339
|
-
}
|
|
1340
|
-
return React25.createElement(Target, __assign({}, rest));
|
|
1341
|
-
};
|
|
1342
|
-
SideCar.isSideCarExport = true;
|
|
1343
|
-
function exportSidecar(medium, exported) {
|
|
1344
|
-
medium.useMedium(exported);
|
|
1345
|
-
return SideCar;
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
// ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/medium.js
|
|
1349
|
-
var effectCar = createSidecarMedium();
|
|
1350
|
-
|
|
1351
|
-
// ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
1352
|
-
var nothing = function() {
|
|
1353
|
-
return;
|
|
1354
|
-
};
|
|
1355
|
-
var RemoveScroll = React25.forwardRef(function(props, parentRef) {
|
|
1356
|
-
var ref = React25.useRef(null);
|
|
1357
|
-
var _a = React25.useState({
|
|
1358
|
-
onScrollCapture: nothing,
|
|
1359
|
-
onWheelCapture: nothing,
|
|
1360
|
-
onTouchMoveCapture: nothing
|
|
1361
|
-
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
1362
|
-
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
1363
|
-
var SideCar2 = sideCar;
|
|
1364
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
1365
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
1366
|
-
return React25.createElement(
|
|
1367
|
-
React25.Fragment,
|
|
1368
|
-
null,
|
|
1369
|
-
enabled && React25.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
1370
|
-
forwardProps ? React25.cloneElement(React25.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React25.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
1371
|
-
);
|
|
1372
|
-
});
|
|
1373
|
-
RemoveScroll.defaultProps = {
|
|
1374
|
-
enabled: true,
|
|
1375
|
-
removeScrollBar: true,
|
|
1376
|
-
inert: false
|
|
1377
|
-
};
|
|
1378
|
-
RemoveScroll.classNames = {
|
|
1379
|
-
fullWidth: fullWidthClassName,
|
|
1380
|
-
zeroRight: zeroRightClassName
|
|
1381
|
-
};
|
|
1382
|
-
var getNonce = function() {
|
|
1383
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
1384
|
-
return __webpack_nonce__;
|
|
1385
|
-
}
|
|
1386
|
-
return void 0;
|
|
1387
|
-
};
|
|
1388
|
-
|
|
1389
|
-
// ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@19.2.8_react@19.2.3/node_modules/react-style-singleton/dist/es2015/singleton.js
|
|
1390
|
-
function makeStyleTag() {
|
|
1391
|
-
if (!document)
|
|
1392
|
-
return null;
|
|
1393
|
-
var tag = document.createElement("style");
|
|
1394
|
-
tag.type = "text/css";
|
|
1395
|
-
var nonce = getNonce();
|
|
1396
|
-
if (nonce) {
|
|
1397
|
-
tag.setAttribute("nonce", nonce);
|
|
1398
|
-
}
|
|
1399
|
-
return tag;
|
|
1400
|
-
}
|
|
1401
|
-
function injectStyles(tag, css) {
|
|
1402
|
-
if (tag.styleSheet) {
|
|
1403
|
-
tag.styleSheet.cssText = css;
|
|
1404
|
-
} else {
|
|
1405
|
-
tag.appendChild(document.createTextNode(css));
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
function insertStyleTag(tag) {
|
|
1409
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
1410
|
-
head.appendChild(tag);
|
|
1411
|
-
}
|
|
1412
|
-
var stylesheetSingleton = function() {
|
|
1413
|
-
var counter = 0;
|
|
1414
|
-
var stylesheet = null;
|
|
1415
|
-
return {
|
|
1416
|
-
add: function(style) {
|
|
1417
|
-
if (counter == 0) {
|
|
1418
|
-
if (stylesheet = makeStyleTag()) {
|
|
1419
|
-
injectStyles(stylesheet, style);
|
|
1420
|
-
insertStyleTag(stylesheet);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
counter++;
|
|
1424
|
-
},
|
|
1425
|
-
remove: function() {
|
|
1426
|
-
counter--;
|
|
1427
|
-
if (!counter && stylesheet) {
|
|
1428
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
1429
|
-
stylesheet = null;
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
};
|
|
1433
|
-
};
|
|
1434
|
-
|
|
1435
|
-
// ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@19.2.8_react@19.2.3/node_modules/react-style-singleton/dist/es2015/hook.js
|
|
1436
|
-
var styleHookSingleton = function() {
|
|
1437
|
-
var sheet = stylesheetSingleton();
|
|
1438
|
-
return function(styles, isDynamic) {
|
|
1439
|
-
React25.useEffect(function() {
|
|
1440
|
-
sheet.add(styles);
|
|
1441
|
-
return function() {
|
|
1442
|
-
sheet.remove();
|
|
1443
|
-
};
|
|
1444
|
-
}, [styles && isDynamic]);
|
|
1445
|
-
};
|
|
1446
|
-
};
|
|
1447
|
-
|
|
1448
|
-
// ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@19.2.8_react@19.2.3/node_modules/react-style-singleton/dist/es2015/component.js
|
|
1449
|
-
var styleSingleton = function() {
|
|
1450
|
-
var useStyle = styleHookSingleton();
|
|
1451
|
-
var Sheet = function(_a) {
|
|
1452
|
-
var styles = _a.styles, dynamic = _a.dynamic;
|
|
1453
|
-
useStyle(styles, dynamic);
|
|
1454
|
-
return null;
|
|
1455
|
-
};
|
|
1456
|
-
return Sheet;
|
|
1457
|
-
};
|
|
1458
|
-
|
|
1459
|
-
// ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll-bar/dist/es2015/utils.js
|
|
1460
|
-
var zeroGap = {
|
|
1461
|
-
left: 0,
|
|
1462
|
-
top: 0,
|
|
1463
|
-
right: 0,
|
|
1464
|
-
gap: 0
|
|
1465
|
-
};
|
|
1466
|
-
var parse = function(x) {
|
|
1467
|
-
return parseInt(x || "", 10) || 0;
|
|
1468
|
-
};
|
|
1469
|
-
var getOffset = function(gapMode) {
|
|
1470
|
-
var cs = window.getComputedStyle(document.body);
|
|
1471
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
1472
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
1473
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
1474
|
-
return [parse(left), parse(top), parse(right)];
|
|
1475
|
-
};
|
|
1476
|
-
var getGapWidth = function(gapMode) {
|
|
1477
|
-
if (gapMode === void 0) {
|
|
1478
|
-
gapMode = "margin";
|
|
1479
|
-
}
|
|
1480
|
-
if (typeof window === "undefined") {
|
|
1481
|
-
return zeroGap;
|
|
1482
|
-
}
|
|
1483
|
-
var offsets = getOffset(gapMode);
|
|
1484
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
1485
|
-
var windowWidth = window.innerWidth;
|
|
1486
|
-
return {
|
|
1487
|
-
left: offsets[0],
|
|
1488
|
-
top: offsets[1],
|
|
1489
|
-
right: offsets[2],
|
|
1490
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
1491
|
-
};
|
|
1492
|
-
};
|
|
1493
|
-
|
|
1494
|
-
// ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
1495
|
-
var Style = styleSingleton();
|
|
1496
|
-
var lockAttribute = "data-scroll-locked";
|
|
1497
|
-
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
1498
|
-
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
1499
|
-
if (gapMode === void 0) {
|
|
1500
|
-
gapMode = "margin";
|
|
1501
|
-
}
|
|
1502
|
-
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
1503
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
1504
|
-
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
1505
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
1506
|
-
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
1507
|
-
};
|
|
1508
|
-
var getCurrentUseCounter = function() {
|
|
1509
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
1510
|
-
return isFinite(counter) ? counter : 0;
|
|
1511
|
-
};
|
|
1512
|
-
var useLockAttribute = function() {
|
|
1513
|
-
React25.useEffect(function() {
|
|
1514
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
1515
|
-
return function() {
|
|
1516
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
1517
|
-
if (newCounter <= 0) {
|
|
1518
|
-
document.body.removeAttribute(lockAttribute);
|
|
1519
|
-
} else {
|
|
1520
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
1521
|
-
}
|
|
1522
|
-
};
|
|
1523
|
-
}, []);
|
|
1524
|
-
};
|
|
1525
|
-
var RemoveScrollBar = function(_a) {
|
|
1526
|
-
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
1527
|
-
useLockAttribute();
|
|
1528
|
-
var gap = React25.useMemo(function() {
|
|
1529
|
-
return getGapWidth(gapMode);
|
|
1530
|
-
}, [gapMode]);
|
|
1531
|
-
return React25.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
|
-
// ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
|
|
1535
|
-
var passiveSupported = false;
|
|
1536
|
-
if (typeof window !== "undefined") {
|
|
1537
|
-
try {
|
|
1538
|
-
options = Object.defineProperty({}, "passive", {
|
|
1539
|
-
get: function() {
|
|
1540
|
-
passiveSupported = true;
|
|
1541
|
-
return true;
|
|
1542
|
-
}
|
|
1543
|
-
});
|
|
1544
|
-
window.addEventListener("test", options, options);
|
|
1545
|
-
window.removeEventListener("test", options, options);
|
|
1546
|
-
} catch (err) {
|
|
1547
|
-
passiveSupported = false;
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
|
-
var options;
|
|
1551
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
1552
|
-
|
|
1553
|
-
// ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/handleScroll.js
|
|
1554
|
-
var alwaysContainsScroll = function(node) {
|
|
1555
|
-
return node.tagName === "TEXTAREA";
|
|
1556
|
-
};
|
|
1557
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
1558
|
-
if (!(node instanceof Element)) {
|
|
1559
|
-
return false;
|
|
1560
|
-
}
|
|
1561
|
-
var styles = window.getComputedStyle(node);
|
|
1562
|
-
return (
|
|
1563
|
-
// not-not-scrollable
|
|
1564
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
1565
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
1566
|
-
);
|
|
1567
|
-
};
|
|
1568
|
-
var elementCouldBeVScrolled = function(node) {
|
|
1569
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
1570
|
-
};
|
|
1571
|
-
var elementCouldBeHScrolled = function(node) {
|
|
1572
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
1573
|
-
};
|
|
1574
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
1575
|
-
var ownerDocument = node.ownerDocument;
|
|
1576
|
-
var current = node;
|
|
1577
|
-
do {
|
|
1578
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
1579
|
-
current = current.host;
|
|
1580
|
-
}
|
|
1581
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
1582
|
-
if (isScrollable) {
|
|
1583
|
-
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
1584
|
-
if (scrollHeight > clientHeight) {
|
|
1585
|
-
return true;
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
current = current.parentNode;
|
|
1589
|
-
} while (current && current !== ownerDocument.body);
|
|
1590
|
-
return false;
|
|
1591
|
-
};
|
|
1592
|
-
var getVScrollVariables = function(_a) {
|
|
1593
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
1594
|
-
return [
|
|
1595
|
-
scrollTop,
|
|
1596
|
-
scrollHeight,
|
|
1597
|
-
clientHeight
|
|
1598
|
-
];
|
|
1599
|
-
};
|
|
1600
|
-
var getHScrollVariables = function(_a) {
|
|
1601
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
1602
|
-
return [
|
|
1603
|
-
scrollLeft,
|
|
1604
|
-
scrollWidth,
|
|
1605
|
-
clientWidth
|
|
1606
|
-
];
|
|
1607
|
-
};
|
|
1608
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
1609
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
1610
|
-
};
|
|
1611
|
-
var getScrollVariables = function(axis, node) {
|
|
1612
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
1613
|
-
};
|
|
1614
|
-
var getDirectionFactor = function(axis, direction) {
|
|
1615
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
1616
|
-
};
|
|
1617
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
1618
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
1619
|
-
var delta = directionFactor * sourceDelta;
|
|
1620
|
-
var target = event.target;
|
|
1621
|
-
var targetInLock = endTarget.contains(target);
|
|
1622
|
-
var shouldCancelScroll = false;
|
|
1623
|
-
var isDeltaPositive = delta > 0;
|
|
1624
|
-
var availableScroll = 0;
|
|
1625
|
-
var availableScrollTop = 0;
|
|
1626
|
-
do {
|
|
1627
|
-
if (!target) {
|
|
1628
|
-
break;
|
|
1629
|
-
}
|
|
1630
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
1631
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
1632
|
-
if (position || elementScroll) {
|
|
1633
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
1634
|
-
availableScroll += elementScroll;
|
|
1635
|
-
availableScrollTop += position;
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
var parent_1 = target.parentNode;
|
|
1639
|
-
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
1640
|
-
} while (
|
|
1641
|
-
// portaled content
|
|
1642
|
-
!targetInLock && target !== document.body || // self content
|
|
1643
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
1644
|
-
);
|
|
1645
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
1646
|
-
shouldCancelScroll = true;
|
|
1647
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
1648
|
-
shouldCancelScroll = true;
|
|
1649
|
-
}
|
|
1650
|
-
return shouldCancelScroll;
|
|
1651
|
-
};
|
|
1652
|
-
|
|
1653
|
-
// ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
1654
|
-
var getTouchXY = function(event) {
|
|
1655
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
1656
|
-
};
|
|
1657
|
-
var getDeltaXY = function(event) {
|
|
1658
|
-
return [event.deltaX, event.deltaY];
|
|
1659
|
-
};
|
|
1660
|
-
var extractRef = function(ref) {
|
|
1661
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
1662
|
-
};
|
|
1663
|
-
var deltaCompare = function(x, y) {
|
|
1664
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
1665
|
-
};
|
|
1666
|
-
var generateStyle = function(id) {
|
|
1667
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
1668
|
-
};
|
|
1669
|
-
var idCounter = 0;
|
|
1670
|
-
var lockStack = [];
|
|
1671
|
-
function RemoveScrollSideCar(props) {
|
|
1672
|
-
var shouldPreventQueue = React25.useRef([]);
|
|
1673
|
-
var touchStartRef = React25.useRef([0, 0]);
|
|
1674
|
-
var activeAxis = React25.useRef();
|
|
1675
|
-
var id = React25.useState(idCounter++)[0];
|
|
1676
|
-
var Style2 = React25.useState(styleSingleton)[0];
|
|
1677
|
-
var lastProps = React25.useRef(props);
|
|
1678
|
-
React25.useEffect(function() {
|
|
1679
|
-
lastProps.current = props;
|
|
1680
|
-
}, [props]);
|
|
1681
|
-
React25.useEffect(function() {
|
|
1682
|
-
if (props.inert) {
|
|
1683
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
1684
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef)).filter(Boolean);
|
|
1685
|
-
allow_1.forEach(function(el) {
|
|
1686
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
1687
|
-
});
|
|
1688
|
-
return function() {
|
|
1689
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
1690
|
-
allow_1.forEach(function(el) {
|
|
1691
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
1692
|
-
});
|
|
1693
|
-
};
|
|
1694
|
-
}
|
|
1695
|
-
return;
|
|
1696
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
1697
|
-
var shouldCancelEvent = React25.useCallback(function(event, parent) {
|
|
1698
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
1699
|
-
return !lastProps.current.allowPinchZoom;
|
|
1700
|
-
}
|
|
1701
|
-
var touch = getTouchXY(event);
|
|
1702
|
-
var touchStart = touchStartRef.current;
|
|
1703
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
1704
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
1705
|
-
var currentAxis;
|
|
1706
|
-
var target = event.target;
|
|
1707
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
1708
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
1709
|
-
return false;
|
|
1710
|
-
}
|
|
1711
|
-
var selection = window.getSelection();
|
|
1712
|
-
var anchorNode = selection && selection.anchorNode;
|
|
1713
|
-
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
1714
|
-
if (isTouchingSelection) {
|
|
1715
|
-
return false;
|
|
1716
|
-
}
|
|
1717
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
1718
|
-
if (!canBeScrolledInMainDirection) {
|
|
1719
|
-
return true;
|
|
1720
|
-
}
|
|
1721
|
-
if (canBeScrolledInMainDirection) {
|
|
1722
|
-
currentAxis = moveDirection;
|
|
1723
|
-
} else {
|
|
1724
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
1725
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
1726
|
-
}
|
|
1727
|
-
if (!canBeScrolledInMainDirection) {
|
|
1728
|
-
return false;
|
|
1729
|
-
}
|
|
1730
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
1731
|
-
activeAxis.current = currentAxis;
|
|
1732
|
-
}
|
|
1733
|
-
if (!currentAxis) {
|
|
1734
|
-
return true;
|
|
1735
|
-
}
|
|
1736
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
1737
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
1738
|
-
}, []);
|
|
1739
|
-
var shouldPrevent = React25.useCallback(function(_event) {
|
|
1740
|
-
var event = _event;
|
|
1741
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
1742
|
-
return;
|
|
1743
|
-
}
|
|
1744
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
1745
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
1746
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
1747
|
-
})[0];
|
|
1748
|
-
if (sourceEvent && sourceEvent.should) {
|
|
1749
|
-
if (event.cancelable) {
|
|
1750
|
-
event.preventDefault();
|
|
1751
|
-
}
|
|
1752
|
-
return;
|
|
1753
|
-
}
|
|
1754
|
-
if (!sourceEvent) {
|
|
1755
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
1756
|
-
return node.contains(event.target);
|
|
1757
|
-
});
|
|
1758
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
1759
|
-
if (shouldStop) {
|
|
1760
|
-
if (event.cancelable) {
|
|
1761
|
-
event.preventDefault();
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
}, []);
|
|
1766
|
-
var shouldCancel = React25.useCallback(function(name, delta, target, should) {
|
|
1767
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
1768
|
-
shouldPreventQueue.current.push(event);
|
|
1769
|
-
setTimeout(function() {
|
|
1770
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
1771
|
-
return e !== event;
|
|
1772
|
-
});
|
|
1773
|
-
}, 1);
|
|
1774
|
-
}, []);
|
|
1775
|
-
var scrollTouchStart = React25.useCallback(function(event) {
|
|
1776
|
-
touchStartRef.current = getTouchXY(event);
|
|
1777
|
-
activeAxis.current = void 0;
|
|
1778
|
-
}, []);
|
|
1779
|
-
var scrollWheel = React25.useCallback(function(event) {
|
|
1780
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1781
|
-
}, []);
|
|
1782
|
-
var scrollTouchMove = React25.useCallback(function(event) {
|
|
1783
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1784
|
-
}, []);
|
|
1785
|
-
React25.useEffect(function() {
|
|
1786
|
-
lockStack.push(Style2);
|
|
1787
|
-
props.setCallbacks({
|
|
1788
|
-
onScrollCapture: scrollWheel,
|
|
1789
|
-
onWheelCapture: scrollWheel,
|
|
1790
|
-
onTouchMoveCapture: scrollTouchMove
|
|
1791
|
-
});
|
|
1792
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
1793
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
1794
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
1795
|
-
return function() {
|
|
1796
|
-
lockStack = lockStack.filter(function(inst) {
|
|
1797
|
-
return inst !== Style2;
|
|
1798
|
-
});
|
|
1799
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
1800
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
1801
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
1802
|
-
};
|
|
1803
|
-
}, []);
|
|
1804
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
1805
|
-
return React25.createElement(
|
|
1806
|
-
React25.Fragment,
|
|
1807
|
-
null,
|
|
1808
|
-
inert ? React25.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
1809
|
-
removeScrollBar ? React25.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
1810
|
-
);
|
|
1811
|
-
}
|
|
1812
|
-
function getOutermostShadowParent(node) {
|
|
1813
|
-
var shadowParent = null;
|
|
1814
|
-
while (node !== null) {
|
|
1815
|
-
if (node instanceof ShadowRoot) {
|
|
1816
|
-
shadowParent = node.host;
|
|
1817
|
-
node = node.host;
|
|
1818
|
-
}
|
|
1819
|
-
node = node.parentNode;
|
|
1820
|
-
}
|
|
1821
|
-
return shadowParent;
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
// ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/sidecar.js
|
|
1825
|
-
var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
1826
|
-
|
|
1827
|
-
// ../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@19.2.8_react@19.2.3/node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
1828
|
-
var ReactRemoveScroll = React25.forwardRef(function(props, ref) {
|
|
1829
|
-
return React25.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
|
|
1830
|
-
});
|
|
1831
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
1832
|
-
var Combination_default = ReactRemoveScroll;
|
|
1833
|
-
|
|
1834
|
-
// ../node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js
|
|
1835
|
-
var getDefaultParent = function(originalTarget) {
|
|
1836
|
-
if (typeof document === "undefined") {
|
|
1837
|
-
return null;
|
|
1838
|
-
}
|
|
1839
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
1840
|
-
return sampleTarget.ownerDocument.body;
|
|
1841
|
-
};
|
|
1842
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
1843
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
1844
|
-
var markerMap = {};
|
|
1845
|
-
var lockCount = 0;
|
|
1846
|
-
var unwrapHost = function(node) {
|
|
1847
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
1848
|
-
};
|
|
1849
|
-
var correctTargets = function(parent, targets) {
|
|
1850
|
-
return targets.map(function(target) {
|
|
1851
|
-
if (parent.contains(target)) {
|
|
1852
|
-
return target;
|
|
1853
|
-
}
|
|
1854
|
-
var correctedTarget = unwrapHost(target);
|
|
1855
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
1856
|
-
return correctedTarget;
|
|
1857
|
-
}
|
|
1858
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
1859
|
-
return null;
|
|
1860
|
-
}).filter(function(x) {
|
|
1861
|
-
return Boolean(x);
|
|
1862
|
-
});
|
|
1863
|
-
};
|
|
1864
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
1865
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
1866
|
-
if (!markerMap[markerName]) {
|
|
1867
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
1868
|
-
}
|
|
1869
|
-
var markerCounter = markerMap[markerName];
|
|
1870
|
-
var hiddenNodes = [];
|
|
1871
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
1872
|
-
var elementsToStop = new Set(targets);
|
|
1873
|
-
var keep = function(el) {
|
|
1874
|
-
if (!el || elementsToKeep.has(el)) {
|
|
1875
|
-
return;
|
|
1876
|
-
}
|
|
1877
|
-
elementsToKeep.add(el);
|
|
1878
|
-
keep(el.parentNode);
|
|
1879
|
-
};
|
|
1880
|
-
targets.forEach(keep);
|
|
1881
|
-
var deep = function(parent) {
|
|
1882
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
1883
|
-
return;
|
|
1884
|
-
}
|
|
1885
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
1886
|
-
if (elementsToKeep.has(node)) {
|
|
1887
|
-
deep(node);
|
|
1888
|
-
} else {
|
|
1889
|
-
try {
|
|
1890
|
-
var attr = node.getAttribute(controlAttribute);
|
|
1891
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
1892
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
1893
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
1894
|
-
counterMap.set(node, counterValue);
|
|
1895
|
-
markerCounter.set(node, markerValue);
|
|
1896
|
-
hiddenNodes.push(node);
|
|
1897
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
1898
|
-
uncontrolledNodes.set(node, true);
|
|
1899
|
-
}
|
|
1900
|
-
if (markerValue === 1) {
|
|
1901
|
-
node.setAttribute(markerName, "true");
|
|
1902
|
-
}
|
|
1903
|
-
if (!alreadyHidden) {
|
|
1904
|
-
node.setAttribute(controlAttribute, "true");
|
|
1905
|
-
}
|
|
1906
|
-
} catch (e) {
|
|
1907
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
});
|
|
1911
|
-
};
|
|
1912
|
-
deep(parentNode);
|
|
1913
|
-
elementsToKeep.clear();
|
|
1914
|
-
lockCount++;
|
|
1915
|
-
return function() {
|
|
1916
|
-
hiddenNodes.forEach(function(node) {
|
|
1917
|
-
var counterValue = counterMap.get(node) - 1;
|
|
1918
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
1919
|
-
counterMap.set(node, counterValue);
|
|
1920
|
-
markerCounter.set(node, markerValue);
|
|
1921
|
-
if (!counterValue) {
|
|
1922
|
-
if (!uncontrolledNodes.has(node)) {
|
|
1923
|
-
node.removeAttribute(controlAttribute);
|
|
1924
|
-
}
|
|
1925
|
-
uncontrolledNodes.delete(node);
|
|
1926
|
-
}
|
|
1927
|
-
if (!markerValue) {
|
|
1928
|
-
node.removeAttribute(markerName);
|
|
1929
|
-
}
|
|
1930
|
-
});
|
|
1931
|
-
lockCount--;
|
|
1932
|
-
if (!lockCount) {
|
|
1933
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
1934
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
1935
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
1936
|
-
markerMap = {};
|
|
1937
|
-
}
|
|
1938
|
-
};
|
|
1939
|
-
};
|
|
1940
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
1941
|
-
if (markerName === void 0) {
|
|
1942
|
-
markerName = "data-aria-hidden";
|
|
1943
|
-
}
|
|
1944
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
1945
|
-
var activeParentNode = getDefaultParent(originalTarget);
|
|
1946
|
-
if (!activeParentNode) {
|
|
1947
|
-
return function() {
|
|
1948
|
-
return null;
|
|
1949
|
-
};
|
|
1950
|
-
}
|
|
1951
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
1952
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
1953
|
-
};
|
|
1954
|
-
var DIALOG_NAME = "Dialog";
|
|
1955
|
-
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
1956
|
-
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
1957
|
-
var Dialog = (props) => {
|
|
1958
|
-
const {
|
|
1959
|
-
__scopeDialog,
|
|
1960
|
-
children,
|
|
1961
|
-
open: openProp,
|
|
1962
|
-
defaultOpen,
|
|
1963
|
-
onOpenChange,
|
|
1964
|
-
modal = true
|
|
1965
|
-
} = props;
|
|
1966
|
-
const triggerRef = React25.useRef(null);
|
|
1967
|
-
const contentRef = React25.useRef(null);
|
|
1968
|
-
const [open, setOpen] = useControllableState({
|
|
1969
|
-
prop: openProp,
|
|
1970
|
-
defaultProp: defaultOpen ?? false,
|
|
1971
|
-
onChange: onOpenChange,
|
|
1972
|
-
caller: DIALOG_NAME
|
|
1973
|
-
});
|
|
1974
|
-
return /* @__PURE__ */ jsx(
|
|
1975
|
-
DialogProvider,
|
|
1976
|
-
{
|
|
1977
|
-
scope: __scopeDialog,
|
|
1978
|
-
triggerRef,
|
|
1979
|
-
contentRef,
|
|
1980
|
-
contentId: useId(),
|
|
1981
|
-
titleId: useId(),
|
|
1982
|
-
descriptionId: useId(),
|
|
1983
|
-
open,
|
|
1984
|
-
onOpenChange: setOpen,
|
|
1985
|
-
onOpenToggle: React25.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
1986
|
-
modal,
|
|
1987
|
-
children
|
|
1988
|
-
}
|
|
1989
|
-
);
|
|
1990
|
-
};
|
|
1991
|
-
Dialog.displayName = DIALOG_NAME;
|
|
1992
|
-
var TRIGGER_NAME = "DialogTrigger";
|
|
1993
|
-
var DialogTrigger = React25.forwardRef(
|
|
1994
|
-
(props, forwardedRef) => {
|
|
1995
|
-
const { __scopeDialog, ...triggerProps } = props;
|
|
1996
|
-
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
1997
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
1998
|
-
return /* @__PURE__ */ jsx(
|
|
1999
|
-
Primitive.button,
|
|
2000
|
-
{
|
|
2001
|
-
type: "button",
|
|
2002
|
-
"aria-haspopup": "dialog",
|
|
2003
|
-
"aria-expanded": context.open,
|
|
2004
|
-
"aria-controls": context.contentId,
|
|
2005
|
-
"data-state": getState(context.open),
|
|
2006
|
-
...triggerProps,
|
|
2007
|
-
ref: composedTriggerRef,
|
|
2008
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
2009
|
-
}
|
|
2010
|
-
);
|
|
2011
|
-
}
|
|
2012
|
-
);
|
|
2013
|
-
DialogTrigger.displayName = TRIGGER_NAME;
|
|
2014
|
-
var PORTAL_NAME2 = "DialogPortal";
|
|
2015
|
-
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
|
|
2016
|
-
forceMount: void 0
|
|
2017
|
-
});
|
|
2018
|
-
var DialogPortal = (props) => {
|
|
2019
|
-
const { __scopeDialog, forceMount, children, container } = props;
|
|
2020
|
-
const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
|
|
2021
|
-
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React25.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal, { asChild: true, container, children: child }) })) });
|
|
2022
|
-
};
|
|
2023
|
-
DialogPortal.displayName = PORTAL_NAME2;
|
|
2024
|
-
var OVERLAY_NAME = "DialogOverlay";
|
|
2025
|
-
var DialogOverlay = React25.forwardRef(
|
|
2026
|
-
(props, forwardedRef) => {
|
|
2027
|
-
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
2028
|
-
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
2029
|
-
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
2030
|
-
return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
2031
|
-
}
|
|
2032
|
-
);
|
|
2033
|
-
DialogOverlay.displayName = OVERLAY_NAME;
|
|
2034
|
-
var Slot2 = createSlot2("DialogOverlay.RemoveScroll");
|
|
2035
|
-
var DialogOverlayImpl = React25.forwardRef(
|
|
2036
|
-
(props, forwardedRef) => {
|
|
2037
|
-
const { __scopeDialog, ...overlayProps } = props;
|
|
2038
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
2039
|
-
return (
|
|
2040
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
2041
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
2042
|
-
/* @__PURE__ */ jsx(Combination_default, { as: Slot2, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
|
|
2043
|
-
Primitive.div,
|
|
2044
|
-
{
|
|
2045
|
-
"data-state": getState(context.open),
|
|
2046
|
-
...overlayProps,
|
|
2047
|
-
ref: forwardedRef,
|
|
2048
|
-
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
2049
|
-
}
|
|
2050
|
-
) })
|
|
2051
|
-
);
|
|
2052
|
-
}
|
|
2053
|
-
);
|
|
2054
|
-
var CONTENT_NAME = "DialogContent";
|
|
2055
|
-
var DialogContent = React25.forwardRef(
|
|
2056
|
-
(props, forwardedRef) => {
|
|
2057
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
2058
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
2059
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
2060
|
-
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
2061
|
-
}
|
|
2062
|
-
);
|
|
2063
|
-
DialogContent.displayName = CONTENT_NAME;
|
|
2064
|
-
var DialogContentModal = React25.forwardRef(
|
|
2065
|
-
(props, forwardedRef) => {
|
|
2066
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
2067
|
-
const contentRef = React25.useRef(null);
|
|
2068
|
-
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
2069
|
-
React25.useEffect(() => {
|
|
2070
|
-
const content = contentRef.current;
|
|
2071
|
-
if (content) return hideOthers(content);
|
|
2072
|
-
}, []);
|
|
2073
|
-
return /* @__PURE__ */ jsx(
|
|
2074
|
-
DialogContentImpl,
|
|
2075
|
-
{
|
|
2076
|
-
...props,
|
|
2077
|
-
ref: composedRefs,
|
|
2078
|
-
trapFocus: context.open,
|
|
2079
|
-
disableOutsidePointerEvents: true,
|
|
2080
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
2081
|
-
event.preventDefault();
|
|
2082
|
-
context.triggerRef.current?.focus();
|
|
2083
|
-
}),
|
|
2084
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
2085
|
-
const originalEvent = event.detail.originalEvent;
|
|
2086
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
2087
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
2088
|
-
if (isRightClick) event.preventDefault();
|
|
2089
|
-
}),
|
|
2090
|
-
onFocusOutside: composeEventHandlers(
|
|
2091
|
-
props.onFocusOutside,
|
|
2092
|
-
(event) => event.preventDefault()
|
|
2093
|
-
)
|
|
2094
|
-
}
|
|
2095
|
-
);
|
|
2096
|
-
}
|
|
2097
|
-
);
|
|
2098
|
-
var DialogContentNonModal = React25.forwardRef(
|
|
2099
|
-
(props, forwardedRef) => {
|
|
2100
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
2101
|
-
const hasInteractedOutsideRef = React25.useRef(false);
|
|
2102
|
-
const hasPointerDownOutsideRef = React25.useRef(false);
|
|
2103
|
-
return /* @__PURE__ */ jsx(
|
|
2104
|
-
DialogContentImpl,
|
|
2105
|
-
{
|
|
2106
|
-
...props,
|
|
2107
|
-
ref: forwardedRef,
|
|
2108
|
-
trapFocus: false,
|
|
2109
|
-
disableOutsidePointerEvents: false,
|
|
2110
|
-
onCloseAutoFocus: (event) => {
|
|
2111
|
-
props.onCloseAutoFocus?.(event);
|
|
2112
|
-
if (!event.defaultPrevented) {
|
|
2113
|
-
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
2114
|
-
event.preventDefault();
|
|
2115
|
-
}
|
|
2116
|
-
hasInteractedOutsideRef.current = false;
|
|
2117
|
-
hasPointerDownOutsideRef.current = false;
|
|
2118
|
-
},
|
|
2119
|
-
onInteractOutside: (event) => {
|
|
2120
|
-
props.onInteractOutside?.(event);
|
|
2121
|
-
if (!event.defaultPrevented) {
|
|
2122
|
-
hasInteractedOutsideRef.current = true;
|
|
2123
|
-
if (event.detail.originalEvent.type === "pointerdown") {
|
|
2124
|
-
hasPointerDownOutsideRef.current = true;
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
const target = event.target;
|
|
2128
|
-
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
2129
|
-
if (targetIsTrigger) event.preventDefault();
|
|
2130
|
-
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
2131
|
-
event.preventDefault();
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
);
|
|
2136
|
-
}
|
|
2137
|
-
);
|
|
2138
|
-
var DialogContentImpl = React25.forwardRef(
|
|
2139
|
-
(props, forwardedRef) => {
|
|
2140
|
-
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
2141
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
2142
|
-
const contentRef = React25.useRef(null);
|
|
2143
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2144
|
-
useFocusGuards();
|
|
2145
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2146
|
-
/* @__PURE__ */ jsx(
|
|
2147
|
-
FocusScope,
|
|
2148
|
-
{
|
|
2149
|
-
asChild: true,
|
|
2150
|
-
loop: true,
|
|
2151
|
-
trapped: trapFocus,
|
|
2152
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
2153
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
2154
|
-
children: /* @__PURE__ */ jsx(
|
|
2155
|
-
DismissableLayer,
|
|
2156
|
-
{
|
|
2157
|
-
role: "dialog",
|
|
2158
|
-
id: context.contentId,
|
|
2159
|
-
"aria-describedby": context.descriptionId,
|
|
2160
|
-
"aria-labelledby": context.titleId,
|
|
2161
|
-
"data-state": getState(context.open),
|
|
2162
|
-
...contentProps,
|
|
2163
|
-
ref: composedRefs,
|
|
2164
|
-
onDismiss: () => context.onOpenChange(false)
|
|
2165
|
-
}
|
|
2166
|
-
)
|
|
2167
|
-
}
|
|
2168
|
-
),
|
|
2169
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2170
|
-
/* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
|
|
2171
|
-
/* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
2172
|
-
] })
|
|
2173
|
-
] });
|
|
2174
|
-
}
|
|
2175
|
-
);
|
|
2176
|
-
var TITLE_NAME = "DialogTitle";
|
|
2177
|
-
var DialogTitle = React25.forwardRef(
|
|
2178
|
-
(props, forwardedRef) => {
|
|
2179
|
-
const { __scopeDialog, ...titleProps } = props;
|
|
2180
|
-
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
2181
|
-
return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
2182
|
-
}
|
|
2183
|
-
);
|
|
2184
|
-
DialogTitle.displayName = TITLE_NAME;
|
|
2185
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
2186
|
-
var DialogDescription = React25.forwardRef(
|
|
2187
|
-
(props, forwardedRef) => {
|
|
2188
|
-
const { __scopeDialog, ...descriptionProps } = props;
|
|
2189
|
-
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
2190
|
-
return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
2191
|
-
}
|
|
2192
|
-
);
|
|
2193
|
-
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
2194
|
-
var CLOSE_NAME = "DialogClose";
|
|
2195
|
-
var DialogClose = React25.forwardRef(
|
|
2196
|
-
(props, forwardedRef) => {
|
|
2197
|
-
const { __scopeDialog, ...closeProps } = props;
|
|
2198
|
-
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
2199
|
-
return /* @__PURE__ */ jsx(
|
|
2200
|
-
Primitive.button,
|
|
2201
|
-
{
|
|
2202
|
-
type: "button",
|
|
2203
|
-
...closeProps,
|
|
2204
|
-
ref: forwardedRef,
|
|
2205
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
2206
|
-
}
|
|
2207
|
-
);
|
|
2208
|
-
}
|
|
2209
|
-
);
|
|
2210
|
-
DialogClose.displayName = CLOSE_NAME;
|
|
2211
|
-
function getState(open) {
|
|
2212
|
-
return open ? "open" : "closed";
|
|
2213
|
-
}
|
|
2214
|
-
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
2215
|
-
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
2216
|
-
contentName: CONTENT_NAME,
|
|
2217
|
-
titleName: TITLE_NAME,
|
|
2218
|
-
docsSlug: "dialog"
|
|
2219
|
-
});
|
|
2220
|
-
var TitleWarning = ({ titleId }) => {
|
|
2221
|
-
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
2222
|
-
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
2223
|
-
|
|
2224
|
-
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
2225
|
-
|
|
2226
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
2227
|
-
React25.useEffect(() => {
|
|
2228
|
-
if (titleId) {
|
|
2229
|
-
const hasTitle = document.getElementById(titleId);
|
|
2230
|
-
if (!hasTitle) console.error(MESSAGE);
|
|
2231
|
-
}
|
|
2232
|
-
}, [MESSAGE, titleId]);
|
|
2233
|
-
return null;
|
|
2234
|
-
};
|
|
2235
|
-
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
2236
|
-
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
2237
|
-
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
2238
|
-
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
2239
|
-
React25.useEffect(() => {
|
|
2240
|
-
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
2241
|
-
if (descriptionId && describedById) {
|
|
2242
|
-
const hasDescription = document.getElementById(descriptionId);
|
|
2243
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
2244
|
-
}
|
|
2245
|
-
}, [MESSAGE, contentRef, descriptionId]);
|
|
2246
|
-
return null;
|
|
2247
|
-
};
|
|
2248
|
-
var Root2 = Dialog;
|
|
2249
|
-
var Trigger2 = DialogTrigger;
|
|
2250
|
-
var Portal2 = DialogPortal;
|
|
2251
|
-
var Overlay = DialogOverlay;
|
|
2252
|
-
var Content2 = DialogContent;
|
|
2253
|
-
var Title = DialogTitle;
|
|
2254
|
-
var Description = DialogDescription;
|
|
2255
|
-
var Close = DialogClose;
|
|
2256
|
-
var ROOT_NAME = "AlertDialog";
|
|
2257
|
-
var [createAlertDialogContext] = createContextScope(ROOT_NAME, [
|
|
2258
|
-
createDialogScope
|
|
2259
|
-
]);
|
|
2260
|
-
var useDialogScope = createDialogScope();
|
|
2261
|
-
var AlertDialog = (props) => {
|
|
2262
|
-
const { __scopeAlertDialog, ...alertDialogProps } = props;
|
|
2263
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2264
|
-
return /* @__PURE__ */ jsx(Root2, { ...dialogScope, ...alertDialogProps, modal: true });
|
|
2265
|
-
};
|
|
2266
|
-
AlertDialog.displayName = ROOT_NAME;
|
|
2267
|
-
var TRIGGER_NAME2 = "AlertDialogTrigger";
|
|
2268
|
-
var AlertDialogTrigger = React25.forwardRef(
|
|
2269
|
-
(props, forwardedRef) => {
|
|
2270
|
-
const { __scopeAlertDialog, ...triggerProps } = props;
|
|
2271
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2272
|
-
return /* @__PURE__ */ jsx(Trigger2, { ...dialogScope, ...triggerProps, ref: forwardedRef });
|
|
2273
|
-
}
|
|
2274
|
-
);
|
|
2275
|
-
AlertDialogTrigger.displayName = TRIGGER_NAME2;
|
|
2276
|
-
var PORTAL_NAME3 = "AlertDialogPortal";
|
|
2277
|
-
var AlertDialogPortal = (props) => {
|
|
2278
|
-
const { __scopeAlertDialog, ...portalProps } = props;
|
|
2279
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2280
|
-
return /* @__PURE__ */ jsx(Portal2, { ...dialogScope, ...portalProps });
|
|
2281
|
-
};
|
|
2282
|
-
AlertDialogPortal.displayName = PORTAL_NAME3;
|
|
2283
|
-
var OVERLAY_NAME2 = "AlertDialogOverlay";
|
|
2284
|
-
var AlertDialogOverlay = React25.forwardRef(
|
|
2285
|
-
(props, forwardedRef) => {
|
|
2286
|
-
const { __scopeAlertDialog, ...overlayProps } = props;
|
|
2287
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2288
|
-
return /* @__PURE__ */ jsx(Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
|
|
2289
|
-
}
|
|
2290
|
-
);
|
|
2291
|
-
AlertDialogOverlay.displayName = OVERLAY_NAME2;
|
|
2292
|
-
var CONTENT_NAME2 = "AlertDialogContent";
|
|
2293
|
-
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME2);
|
|
2294
|
-
var Slottable = createSlottable("AlertDialogContent");
|
|
2295
|
-
var AlertDialogContent = React25.forwardRef(
|
|
2296
|
-
(props, forwardedRef) => {
|
|
2297
|
-
const { __scopeAlertDialog, children, ...contentProps } = props;
|
|
2298
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2299
|
-
const contentRef = React25.useRef(null);
|
|
2300
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2301
|
-
const cancelRef = React25.useRef(null);
|
|
2302
|
-
return /* @__PURE__ */ jsx(
|
|
2303
|
-
WarningProvider,
|
|
2304
|
-
{
|
|
2305
|
-
contentName: CONTENT_NAME2,
|
|
2306
|
-
titleName: TITLE_NAME2,
|
|
2307
|
-
docsSlug: "alert-dialog",
|
|
2308
|
-
children: /* @__PURE__ */ jsx(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ jsxs(
|
|
2309
|
-
Content2,
|
|
2310
|
-
{
|
|
2311
|
-
role: "alertdialog",
|
|
2312
|
-
...dialogScope,
|
|
2313
|
-
...contentProps,
|
|
2314
|
-
ref: composedRefs,
|
|
2315
|
-
onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
|
|
2316
|
-
event.preventDefault();
|
|
2317
|
-
cancelRef.current?.focus({ preventScroll: true });
|
|
2318
|
-
}),
|
|
2319
|
-
onPointerDownOutside: (event) => event.preventDefault(),
|
|
2320
|
-
onInteractOutside: (event) => event.preventDefault(),
|
|
2321
|
-
children: [
|
|
2322
|
-
/* @__PURE__ */ jsx(Slottable, { children }),
|
|
2323
|
-
/* @__PURE__ */ jsx(DescriptionWarning2, { contentRef })
|
|
2324
|
-
]
|
|
2325
|
-
}
|
|
2326
|
-
) })
|
|
2327
|
-
}
|
|
2328
|
-
);
|
|
2329
|
-
}
|
|
2330
|
-
);
|
|
2331
|
-
AlertDialogContent.displayName = CONTENT_NAME2;
|
|
2332
|
-
var TITLE_NAME2 = "AlertDialogTitle";
|
|
2333
|
-
var AlertDialogTitle = React25.forwardRef(
|
|
2334
|
-
(props, forwardedRef) => {
|
|
2335
|
-
const { __scopeAlertDialog, ...titleProps } = props;
|
|
2336
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2337
|
-
return /* @__PURE__ */ jsx(Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
|
|
2338
|
-
}
|
|
2339
|
-
);
|
|
2340
|
-
AlertDialogTitle.displayName = TITLE_NAME2;
|
|
2341
|
-
var DESCRIPTION_NAME2 = "AlertDialogDescription";
|
|
2342
|
-
var AlertDialogDescription = React25.forwardRef((props, forwardedRef) => {
|
|
2343
|
-
const { __scopeAlertDialog, ...descriptionProps } = props;
|
|
2344
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2345
|
-
return /* @__PURE__ */ jsx(Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
|
|
2346
|
-
});
|
|
2347
|
-
AlertDialogDescription.displayName = DESCRIPTION_NAME2;
|
|
2348
|
-
var ACTION_NAME = "AlertDialogAction";
|
|
2349
|
-
var AlertDialogAction = React25.forwardRef(
|
|
2350
|
-
(props, forwardedRef) => {
|
|
2351
|
-
const { __scopeAlertDialog, ...actionProps } = props;
|
|
2352
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2353
|
-
return /* @__PURE__ */ jsx(Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
|
|
2354
|
-
}
|
|
2355
|
-
);
|
|
2356
|
-
AlertDialogAction.displayName = ACTION_NAME;
|
|
2357
|
-
var CANCEL_NAME = "AlertDialogCancel";
|
|
2358
|
-
var AlertDialogCancel = React25.forwardRef(
|
|
2359
|
-
(props, forwardedRef) => {
|
|
2360
|
-
const { __scopeAlertDialog, ...cancelProps } = props;
|
|
2361
|
-
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
|
|
2362
|
-
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2363
|
-
const ref = useComposedRefs(forwardedRef, cancelRef);
|
|
2364
|
-
return /* @__PURE__ */ jsx(Close, { ...dialogScope, ...cancelProps, ref });
|
|
2365
|
-
}
|
|
2366
|
-
);
|
|
2367
|
-
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
2368
|
-
var DescriptionWarning2 = ({ contentRef }) => {
|
|
2369
|
-
const MESSAGE = `\`${CONTENT_NAME2}\` requires a description for the component to be accessible for screen reader users.
|
|
2370
|
-
|
|
2371
|
-
You can add a description to the \`${CONTENT_NAME2}\` by passing a \`${DESCRIPTION_NAME2}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
2372
|
-
|
|
2373
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME2}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
2374
|
-
|
|
2375
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
|
|
2376
|
-
React25.useEffect(() => {
|
|
2377
|
-
const hasDescription = document.getElementById(
|
|
2378
|
-
contentRef.current?.getAttribute("aria-describedby")
|
|
2379
|
-
);
|
|
2380
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
2381
|
-
}, [MESSAGE, contentRef]);
|
|
2382
|
-
return null;
|
|
2383
|
-
};
|
|
2384
|
-
var Root22 = AlertDialog;
|
|
2385
|
-
var Trigger22 = AlertDialogTrigger;
|
|
2386
|
-
var Portal22 = AlertDialogPortal;
|
|
2387
|
-
var Overlay2 = AlertDialogOverlay;
|
|
2388
|
-
var Content22 = AlertDialogContent;
|
|
2389
|
-
var Action = AlertDialogAction;
|
|
2390
|
-
var Cancel = AlertDialogCancel;
|
|
2391
|
-
var Title2 = AlertDialogTitle;
|
|
2392
|
-
var Description2 = AlertDialogDescription;
|
|
2393
|
-
function AlertDialog2({
|
|
2394
|
-
...props
|
|
2395
|
-
}) {
|
|
2396
|
-
return /* @__PURE__ */ jsx(Root22, { "data-slot": "alert-dialog", ...props });
|
|
2397
|
-
}
|
|
2398
|
-
function AlertDialogTrigger2({
|
|
2399
|
-
...props
|
|
2400
|
-
}) {
|
|
2401
|
-
return /* @__PURE__ */ jsx(Trigger22, { "data-slot": "alert-dialog-trigger", ...props });
|
|
2402
|
-
}
|
|
2403
|
-
function AlertDialogPortal2({
|
|
2404
|
-
...props
|
|
2405
|
-
}) {
|
|
2406
|
-
return /* @__PURE__ */ jsx(Portal22, { "data-slot": "alert-dialog-portal", ...props });
|
|
2407
|
-
}
|
|
2408
|
-
function AlertDialogOverlay2({
|
|
2409
|
-
className,
|
|
2410
|
-
...props
|
|
2411
|
-
}) {
|
|
2412
|
-
return /* @__PURE__ */ jsx(
|
|
2413
|
-
Overlay2,
|
|
2414
|
-
{
|
|
2415
|
-
"data-slot": "alert-dialog-overlay",
|
|
2416
|
-
className: cn(
|
|
2417
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
2418
|
-
className
|
|
2419
|
-
),
|
|
2420
|
-
...props
|
|
2421
|
-
}
|
|
2422
|
-
);
|
|
2423
|
-
}
|
|
2424
|
-
function AlertDialogContent2({
|
|
2425
|
-
className,
|
|
2426
|
-
...props
|
|
2427
|
-
}) {
|
|
2428
|
-
return /* @__PURE__ */ jsxs(AlertDialogPortal2, { children: [
|
|
2429
|
-
/* @__PURE__ */ jsx(AlertDialogOverlay2, {}),
|
|
2430
|
-
/* @__PURE__ */ jsx(
|
|
2431
|
-
Content22,
|
|
2432
|
-
{
|
|
2433
|
-
"data-slot": "alert-dialog-content",
|
|
2434
|
-
className: cn(
|
|
2435
|
-
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
2436
|
-
className
|
|
2437
|
-
),
|
|
2438
|
-
...props
|
|
2439
|
-
}
|
|
2440
|
-
)
|
|
2441
|
-
] });
|
|
2442
|
-
}
|
|
2443
|
-
function AlertDialogHeader({
|
|
2444
|
-
className,
|
|
2445
|
-
...props
|
|
2446
|
-
}) {
|
|
2447
|
-
return /* @__PURE__ */ jsx(
|
|
2448
|
-
"div",
|
|
2449
|
-
{
|
|
2450
|
-
"data-slot": "alert-dialog-header",
|
|
2451
|
-
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
2452
|
-
...props
|
|
2453
|
-
}
|
|
2454
|
-
);
|
|
2455
|
-
}
|
|
2456
|
-
function AlertDialogFooter({
|
|
2457
|
-
className,
|
|
2458
|
-
...props
|
|
2459
|
-
}) {
|
|
2460
|
-
return /* @__PURE__ */ jsx(
|
|
2461
|
-
"div",
|
|
2462
|
-
{
|
|
2463
|
-
"data-slot": "alert-dialog-footer",
|
|
2464
|
-
className: cn(
|
|
2465
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
2466
|
-
className
|
|
2467
|
-
),
|
|
2468
|
-
...props
|
|
2469
|
-
}
|
|
2470
|
-
);
|
|
2471
|
-
}
|
|
2472
|
-
function AlertDialogTitle2({
|
|
2473
|
-
className,
|
|
2474
|
-
...props
|
|
2475
|
-
}) {
|
|
2476
|
-
return /* @__PURE__ */ jsx(
|
|
2477
|
-
Title2,
|
|
2478
|
-
{
|
|
2479
|
-
"data-slot": "alert-dialog-title",
|
|
2480
|
-
className: cn("text-lg font-semibold", className),
|
|
2481
|
-
...props
|
|
2482
|
-
}
|
|
2483
|
-
);
|
|
2484
|
-
}
|
|
2485
|
-
function AlertDialogDescription2({
|
|
2486
|
-
className,
|
|
2487
|
-
...props
|
|
2488
|
-
}) {
|
|
2489
|
-
return /* @__PURE__ */ jsx(
|
|
2490
|
-
Description2,
|
|
2491
|
-
{
|
|
2492
|
-
"data-slot": "alert-dialog-description",
|
|
2493
|
-
className: cn("text-muted-foreground text-sm", className),
|
|
2494
|
-
...props
|
|
2495
|
-
}
|
|
2496
|
-
);
|
|
2497
|
-
}
|
|
2498
|
-
function AlertDialogAction2({
|
|
2499
|
-
className,
|
|
2500
|
-
...props
|
|
2501
|
-
}) {
|
|
2502
|
-
return /* @__PURE__ */ jsx(
|
|
2503
|
-
Action,
|
|
2504
|
-
{
|
|
2505
|
-
className: cn(buttonVariants(), className),
|
|
2506
|
-
...props
|
|
2507
|
-
}
|
|
2508
|
-
);
|
|
2509
|
-
}
|
|
2510
|
-
function AlertDialogCancel2({
|
|
2511
|
-
className,
|
|
2512
|
-
...props
|
|
2513
|
-
}) {
|
|
2514
|
-
return /* @__PURE__ */ jsx(
|
|
2515
|
-
Cancel,
|
|
2516
|
-
{
|
|
2517
|
-
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
2518
|
-
...props
|
|
2519
|
-
}
|
|
2520
|
-
);
|
|
2521
|
-
}
|
|
2522
|
-
function cn2(...inputs) {
|
|
2523
|
-
return twMerge(clsx(inputs));
|
|
2524
|
-
}
|
|
2525
|
-
|
|
2526
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog2 as AlertDialog, AlertDialogAction2 as AlertDialogAction, AlertDialogCancel2 as AlertDialogCancel, AlertDialogContent2 as AlertDialogContent, AlertDialogDescription2 as AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay2 as AlertDialogOverlay, AlertDialogPortal2 as AlertDialogPortal, AlertDialogTitle2 as AlertDialogTitle, AlertDialogTrigger2 as AlertDialogTrigger, Button, buttonVariants, cn2 as cn };
|
|
2527
|
-
//# sourceMappingURL=index.mjs.map
|
|
2528
|
-
//# sourceMappingURL=index.mjs.map
|