@c-rex/components 0.0.1
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.d.mts +68 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +2919 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2910 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2910 @@
|
|
|
1
|
+
// src/providers/search-state-wrapper.tsx
|
|
2
|
+
import { SearchProvider } from "@c-rex/contexts";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var SearchStateWrapper = ({
|
|
5
|
+
children,
|
|
6
|
+
filters
|
|
7
|
+
}) => {
|
|
8
|
+
return /* @__PURE__ */ jsx(SearchProvider, { value: { ...filters }, children });
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/blog-card.tsx
|
|
12
|
+
import Link from "next/link";
|
|
13
|
+
import { cn as cn2 } from "@c-rex/ui";
|
|
14
|
+
|
|
15
|
+
// src/blur-image.tsx
|
|
16
|
+
import { useState } from "react";
|
|
17
|
+
import Image from "next/image";
|
|
18
|
+
import { cn } from "@c-rex/ui";
|
|
19
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
20
|
+
var BlurImage = (props) => {
|
|
21
|
+
const [isLoading, setLoading] = useState(true);
|
|
22
|
+
return /* @__PURE__ */ jsx2(
|
|
23
|
+
Image,
|
|
24
|
+
{
|
|
25
|
+
...props,
|
|
26
|
+
alt: props.alt,
|
|
27
|
+
className: cn(
|
|
28
|
+
props.className,
|
|
29
|
+
"duration-500 ease-in-out",
|
|
30
|
+
isLoading ? "blur-sm" : "blur-0"
|
|
31
|
+
),
|
|
32
|
+
onLoad: () => setLoading(false)
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/blog-card.tsx
|
|
38
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
39
|
+
var BlogCard = ({
|
|
40
|
+
data,
|
|
41
|
+
priority,
|
|
42
|
+
horizontal = false
|
|
43
|
+
}) => {
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
"article",
|
|
46
|
+
{
|
|
47
|
+
className: cn2(
|
|
48
|
+
"group relative",
|
|
49
|
+
horizontal ? "grid grid-cols-1 gap-3 md:grid-cols-2 md:gap-6" : "flex flex-col space-y-2"
|
|
50
|
+
),
|
|
51
|
+
children: [
|
|
52
|
+
data.image && /* @__PURE__ */ jsx3("div", { className: "w-full overflow-hidden rounded-xl border", children: /* @__PURE__ */ jsx3(
|
|
53
|
+
BlurImage,
|
|
54
|
+
{
|
|
55
|
+
alt: data.title,
|
|
56
|
+
blurDataURL: data.blurDataURL,
|
|
57
|
+
className: cn2(
|
|
58
|
+
"size-full object-cover object-center",
|
|
59
|
+
horizontal ? "lg:h-72" : null
|
|
60
|
+
),
|
|
61
|
+
width: 800,
|
|
62
|
+
height: 400,
|
|
63
|
+
priority,
|
|
64
|
+
placeholder: "blur",
|
|
65
|
+
src: data.image,
|
|
66
|
+
sizes: "(max-width: 768px) 750px, 600px"
|
|
67
|
+
}
|
|
68
|
+
) }),
|
|
69
|
+
/* @__PURE__ */ jsxs(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: cn2(
|
|
73
|
+
"flex flex-1 flex-col",
|
|
74
|
+
horizontal ? "justify-center" : "justify-between"
|
|
75
|
+
),
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
78
|
+
/* @__PURE__ */ jsx3("h2", { className: "my-1.5 line-clamp-2 font-heading text-2xl", children: data.title }),
|
|
79
|
+
data.description && /* @__PURE__ */ jsx3("p", { className: "line-clamp-2 text-muted-foreground", children: data.description })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center space-x-3", children: [
|
|
82
|
+
/* @__PURE__ */ jsx3("div", { className: "flex items-center -space-x-2", children: data.authors && /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: data.authors }) }),
|
|
83
|
+
data.date && /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: data.date })
|
|
84
|
+
] })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsx3(Link, { href: data.slug, className: "absolute inset-0", target: "_blank", children: /* @__PURE__ */ jsx3("span", { className: "sr-only", children: "View Article" }) })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// src/result-view/blog.tsx
|
|
95
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
96
|
+
|
|
97
|
+
// src/result-view/table.tsx
|
|
98
|
+
import {
|
|
99
|
+
Table,
|
|
100
|
+
TableBody,
|
|
101
|
+
TableCell,
|
|
102
|
+
TableHeader,
|
|
103
|
+
TableRow
|
|
104
|
+
} from "@c-rex/ui";
|
|
105
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
106
|
+
var TableView = ({ items }) => {
|
|
107
|
+
const getTitle = (labels) => {
|
|
108
|
+
return labels.map((item) => item.value).join();
|
|
109
|
+
};
|
|
110
|
+
const getIcons = (languages) => {
|
|
111
|
+
return languages.map((lang, index) => {
|
|
112
|
+
const aux = lang.split("-")[1];
|
|
113
|
+
return /* @__PURE__ */ jsx5("div", { style: { width: 36 }, className: "border me-3", children: aux }, index);
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
return /* @__PURE__ */ jsx5("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs2(Table, { children: [
|
|
117
|
+
/* @__PURE__ */ jsx5(TableHeader, { children: /* @__PURE__ */ jsxs2(TableRow, { children: [
|
|
118
|
+
/* @__PURE__ */ jsx5(TableCell, { children: "Title" }),
|
|
119
|
+
/* @__PURE__ */ jsx5(TableCell, { children: "Country" })
|
|
120
|
+
] }) }),
|
|
121
|
+
/* @__PURE__ */ jsx5(TableBody, { children: items.map((item, index) => /* @__PURE__ */ jsxs2(TableRow, { children: [
|
|
122
|
+
/* @__PURE__ */ jsx5(TableCell, { children: getTitle(item.labels) }),
|
|
123
|
+
/* @__PURE__ */ jsx5(TableCell, { children: getIcons(item.languages) })
|
|
124
|
+
] }, index)) })
|
|
125
|
+
] }) });
|
|
126
|
+
};
|
|
127
|
+
var table_default = TableView;
|
|
128
|
+
|
|
129
|
+
// ../../node_modules/cmdk/dist/chunk-NZJY6EH4.mjs
|
|
130
|
+
var U = 1;
|
|
131
|
+
var Y = 0.9;
|
|
132
|
+
var H = 0.8;
|
|
133
|
+
var J = 0.17;
|
|
134
|
+
var p = 0.1;
|
|
135
|
+
var u = 0.999;
|
|
136
|
+
var $ = 0.9999;
|
|
137
|
+
var k = 0.99;
|
|
138
|
+
var m = /[\\\/_+.#"@\[\(\{&]/;
|
|
139
|
+
var B = /[\\\/_+.#"@\[\(\{&]/g;
|
|
140
|
+
var K = /[\s-]/;
|
|
141
|
+
var X = /[\s-]/g;
|
|
142
|
+
function G(_, C, h, P2, A, f, O) {
|
|
143
|
+
if (f === C.length) return A === _.length ? U : k;
|
|
144
|
+
var T2 = `${A},${f}`;
|
|
145
|
+
if (O[T2] !== void 0) return O[T2];
|
|
146
|
+
for (var L2 = P2.charAt(f), c = h.indexOf(L2, A), S = 0, E, N2, R, M; c >= 0; ) E = G(_, C, h, P2, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B), R && A > 0 && (E *= Math.pow(u, R.length))) : K.test(_.charAt(c - 1)) ? (E *= Y, M = _.slice(A, c - 1).match(X), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P2.charAt(f + 1) || P2.charAt(f + 1) === P2.charAt(f) && h.charAt(c - 1) !== P2.charAt(f)) && (N2 = G(_, C, h, P2, c + 1, f + 2, O), N2 * p > E && (E = N2 * p)), E > S && (S = E), c = h.indexOf(L2, c + 1);
|
|
147
|
+
return O[T2] = S, S;
|
|
148
|
+
}
|
|
149
|
+
function D(_) {
|
|
150
|
+
return _.toLowerCase().replace(X, " ");
|
|
151
|
+
}
|
|
152
|
+
function W(_, C, h) {
|
|
153
|
+
return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ../../node_modules/@radix-ui/react-dialog/dist/index.mjs
|
|
157
|
+
import * as React23 from "react";
|
|
158
|
+
|
|
159
|
+
// ../../node_modules/@radix-ui/primitive/dist/index.mjs
|
|
160
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
161
|
+
return function handleEvent(event) {
|
|
162
|
+
originalEventHandler?.(event);
|
|
163
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
164
|
+
return ourEventHandler?.(event);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
170
|
+
import * as React from "react";
|
|
171
|
+
function setRef(ref, value) {
|
|
172
|
+
if (typeof ref === "function") {
|
|
173
|
+
return ref(value);
|
|
174
|
+
} else if (ref !== null && ref !== void 0) {
|
|
175
|
+
ref.current = value;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function composeRefs(...refs) {
|
|
179
|
+
return (node) => {
|
|
180
|
+
let hasCleanup = false;
|
|
181
|
+
const cleanups = refs.map((ref) => {
|
|
182
|
+
const cleanup = setRef(ref, node);
|
|
183
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
184
|
+
hasCleanup = true;
|
|
185
|
+
}
|
|
186
|
+
return cleanup;
|
|
187
|
+
});
|
|
188
|
+
if (hasCleanup) {
|
|
189
|
+
return () => {
|
|
190
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
191
|
+
const cleanup = cleanups[i];
|
|
192
|
+
if (typeof cleanup == "function") {
|
|
193
|
+
cleanup();
|
|
194
|
+
} else {
|
|
195
|
+
setRef(refs[i], null);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function useComposedRefs(...refs) {
|
|
203
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// ../../node_modules/@radix-ui/react-context/dist/index.mjs
|
|
207
|
+
import * as React2 from "react";
|
|
208
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
209
|
+
function createContext2(rootComponentName, defaultContext) {
|
|
210
|
+
const Context = React2.createContext(defaultContext);
|
|
211
|
+
const Provider = (props) => {
|
|
212
|
+
const { children, ...context } = props;
|
|
213
|
+
const value = React2.useMemo(() => context, Object.values(context));
|
|
214
|
+
return /* @__PURE__ */ jsx6(Context.Provider, { value, children });
|
|
215
|
+
};
|
|
216
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
217
|
+
function useContext22(consumerName) {
|
|
218
|
+
const context = React2.useContext(Context);
|
|
219
|
+
if (context) return context;
|
|
220
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
221
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
222
|
+
}
|
|
223
|
+
return [Provider, useContext22];
|
|
224
|
+
}
|
|
225
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
226
|
+
let defaultContexts = [];
|
|
227
|
+
function createContext32(rootComponentName, defaultContext) {
|
|
228
|
+
const BaseContext = React2.createContext(defaultContext);
|
|
229
|
+
const index = defaultContexts.length;
|
|
230
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
231
|
+
const Provider = (props) => {
|
|
232
|
+
const { scope, children, ...context } = props;
|
|
233
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
234
|
+
const value = React2.useMemo(() => context, Object.values(context));
|
|
235
|
+
return /* @__PURE__ */ jsx6(Context.Provider, { value, children });
|
|
236
|
+
};
|
|
237
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
238
|
+
function useContext22(consumerName, scope) {
|
|
239
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
240
|
+
const context = React2.useContext(Context);
|
|
241
|
+
if (context) return context;
|
|
242
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
243
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
244
|
+
}
|
|
245
|
+
return [Provider, useContext22];
|
|
246
|
+
}
|
|
247
|
+
const createScope = () => {
|
|
248
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
249
|
+
return React2.createContext(defaultContext);
|
|
250
|
+
});
|
|
251
|
+
return function useScope(scope) {
|
|
252
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
253
|
+
return React2.useMemo(
|
|
254
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
255
|
+
[scope, contexts]
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
createScope.scopeName = scopeName;
|
|
260
|
+
return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
261
|
+
}
|
|
262
|
+
function composeContextScopes(...scopes) {
|
|
263
|
+
const baseScope = scopes[0];
|
|
264
|
+
if (scopes.length === 1) return baseScope;
|
|
265
|
+
const createScope = () => {
|
|
266
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
267
|
+
useScope: createScope2(),
|
|
268
|
+
scopeName: createScope2.scopeName
|
|
269
|
+
}));
|
|
270
|
+
return function useComposedScopes(overrideScopes) {
|
|
271
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
272
|
+
const scopeProps = useScope(overrideScopes);
|
|
273
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
274
|
+
return { ...nextScopes2, ...currentScope };
|
|
275
|
+
}, {});
|
|
276
|
+
return React2.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
createScope.scopeName = baseScope.scopeName;
|
|
280
|
+
return createScope;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ../../node_modules/@radix-ui/react-id/dist/index.mjs
|
|
284
|
+
import * as React4 from "react";
|
|
285
|
+
|
|
286
|
+
// ../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
287
|
+
import * as React3 from "react";
|
|
288
|
+
var useLayoutEffect2 = globalThis?.document ? React3.useLayoutEffect : () => {
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// ../../node_modules/@radix-ui/react-id/dist/index.mjs
|
|
292
|
+
var useReactId = React4[" useId ".trim().toString()] || (() => void 0);
|
|
293
|
+
var count = 0;
|
|
294
|
+
function useId(deterministicId) {
|
|
295
|
+
const [id, setId] = React4.useState(useReactId());
|
|
296
|
+
useLayoutEffect2(() => {
|
|
297
|
+
if (!deterministicId) setId((reactId) => reactId ?? String(count++));
|
|
298
|
+
}, [deterministicId]);
|
|
299
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// ../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
303
|
+
import * as React6 from "react";
|
|
304
|
+
|
|
305
|
+
// ../../node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
306
|
+
import * as React5 from "react";
|
|
307
|
+
function useCallbackRef(callback) {
|
|
308
|
+
const callbackRef = React5.useRef(callback);
|
|
309
|
+
React5.useEffect(() => {
|
|
310
|
+
callbackRef.current = callback;
|
|
311
|
+
});
|
|
312
|
+
return React5.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// ../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
316
|
+
function useControllableState({
|
|
317
|
+
prop,
|
|
318
|
+
defaultProp,
|
|
319
|
+
onChange = () => {
|
|
320
|
+
}
|
|
321
|
+
}) {
|
|
322
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
323
|
+
const isControlled = prop !== void 0;
|
|
324
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
325
|
+
const handleChange = useCallbackRef(onChange);
|
|
326
|
+
const setValue = React6.useCallback(
|
|
327
|
+
(nextValue) => {
|
|
328
|
+
if (isControlled) {
|
|
329
|
+
const setter = nextValue;
|
|
330
|
+
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
331
|
+
if (value2 !== prop) handleChange(value2);
|
|
332
|
+
} else {
|
|
333
|
+
setUncontrolledProp(nextValue);
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
337
|
+
);
|
|
338
|
+
return [value, setValue];
|
|
339
|
+
}
|
|
340
|
+
function useUncontrolledState({
|
|
341
|
+
defaultProp,
|
|
342
|
+
onChange
|
|
343
|
+
}) {
|
|
344
|
+
const uncontrolledState = React6.useState(defaultProp);
|
|
345
|
+
const [value] = uncontrolledState;
|
|
346
|
+
const prevValueRef = React6.useRef(value);
|
|
347
|
+
const handleChange = useCallbackRef(onChange);
|
|
348
|
+
React6.useEffect(() => {
|
|
349
|
+
if (prevValueRef.current !== value) {
|
|
350
|
+
handleChange(value);
|
|
351
|
+
prevValueRef.current = value;
|
|
352
|
+
}
|
|
353
|
+
}, [value, prevValueRef, handleChange]);
|
|
354
|
+
return uncontrolledState;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// ../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
358
|
+
import * as React10 from "react";
|
|
359
|
+
|
|
360
|
+
// ../../node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
361
|
+
import * as React8 from "react";
|
|
362
|
+
import * as ReactDOM from "react-dom";
|
|
363
|
+
|
|
364
|
+
// ../../node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
365
|
+
import * as React7 from "react";
|
|
366
|
+
import { Fragment as Fragment2, jsx as jsx7 } from "react/jsx-runtime";
|
|
367
|
+
// @__NO_SIDE_EFFECTS__
|
|
368
|
+
function createSlot(ownerName) {
|
|
369
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
370
|
+
const Slot2 = React7.forwardRef((props, forwardedRef) => {
|
|
371
|
+
const { children, ...slotProps } = props;
|
|
372
|
+
const childrenArray = React7.Children.toArray(children);
|
|
373
|
+
const slottable = childrenArray.find(isSlottable);
|
|
374
|
+
if (slottable) {
|
|
375
|
+
const newElement = slottable.props.children;
|
|
376
|
+
const newChildren = childrenArray.map((child) => {
|
|
377
|
+
if (child === slottable) {
|
|
378
|
+
if (React7.Children.count(newElement) > 1) return React7.Children.only(null);
|
|
379
|
+
return React7.isValidElement(newElement) ? newElement.props.children : null;
|
|
380
|
+
} else {
|
|
381
|
+
return child;
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
return /* @__PURE__ */ jsx7(SlotClone, { ...slotProps, ref: forwardedRef, children: React7.isValidElement(newElement) ? React7.cloneElement(newElement, void 0, newChildren) : null });
|
|
385
|
+
}
|
|
386
|
+
return /* @__PURE__ */ jsx7(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
387
|
+
});
|
|
388
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
389
|
+
return Slot2;
|
|
390
|
+
}
|
|
391
|
+
// @__NO_SIDE_EFFECTS__
|
|
392
|
+
function createSlotClone(ownerName) {
|
|
393
|
+
const SlotClone = React7.forwardRef((props, forwardedRef) => {
|
|
394
|
+
const { children, ...slotProps } = props;
|
|
395
|
+
if (React7.isValidElement(children)) {
|
|
396
|
+
const childrenRef = getElementRef(children);
|
|
397
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
398
|
+
if (children.type !== React7.Fragment) {
|
|
399
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
400
|
+
}
|
|
401
|
+
return React7.cloneElement(children, props2);
|
|
402
|
+
}
|
|
403
|
+
return React7.Children.count(children) > 1 ? React7.Children.only(null) : null;
|
|
404
|
+
});
|
|
405
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
406
|
+
return SlotClone;
|
|
407
|
+
}
|
|
408
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
409
|
+
function isSlottable(child) {
|
|
410
|
+
return React7.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
411
|
+
}
|
|
412
|
+
function mergeProps(slotProps, childProps) {
|
|
413
|
+
const overrideProps = { ...childProps };
|
|
414
|
+
for (const propName in childProps) {
|
|
415
|
+
const slotPropValue = slotProps[propName];
|
|
416
|
+
const childPropValue = childProps[propName];
|
|
417
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
418
|
+
if (isHandler) {
|
|
419
|
+
if (slotPropValue && childPropValue) {
|
|
420
|
+
overrideProps[propName] = (...args) => {
|
|
421
|
+
childPropValue(...args);
|
|
422
|
+
slotPropValue(...args);
|
|
423
|
+
};
|
|
424
|
+
} else if (slotPropValue) {
|
|
425
|
+
overrideProps[propName] = slotPropValue;
|
|
426
|
+
}
|
|
427
|
+
} else if (propName === "style") {
|
|
428
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
429
|
+
} else if (propName === "className") {
|
|
430
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return { ...slotProps, ...overrideProps };
|
|
434
|
+
}
|
|
435
|
+
function getElementRef(element) {
|
|
436
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
437
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
438
|
+
if (mayWarn) {
|
|
439
|
+
return element.ref;
|
|
440
|
+
}
|
|
441
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
442
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
443
|
+
if (mayWarn) {
|
|
444
|
+
return element.props.ref;
|
|
445
|
+
}
|
|
446
|
+
return element.props.ref || element.ref;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// ../../node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
450
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
451
|
+
var NODES = [
|
|
452
|
+
"a",
|
|
453
|
+
"button",
|
|
454
|
+
"div",
|
|
455
|
+
"form",
|
|
456
|
+
"h2",
|
|
457
|
+
"h3",
|
|
458
|
+
"img",
|
|
459
|
+
"input",
|
|
460
|
+
"label",
|
|
461
|
+
"li",
|
|
462
|
+
"nav",
|
|
463
|
+
"ol",
|
|
464
|
+
"p",
|
|
465
|
+
"span",
|
|
466
|
+
"svg",
|
|
467
|
+
"ul"
|
|
468
|
+
];
|
|
469
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
470
|
+
const Slot2 = createSlot(`Primitive.${node}`);
|
|
471
|
+
const Node = React8.forwardRef((props, forwardedRef) => {
|
|
472
|
+
const { asChild, ...primitiveProps } = props;
|
|
473
|
+
const Comp = asChild ? Slot2 : node;
|
|
474
|
+
if (typeof window !== "undefined") {
|
|
475
|
+
window[Symbol.for("radix-ui")] = true;
|
|
476
|
+
}
|
|
477
|
+
return /* @__PURE__ */ jsx8(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
478
|
+
});
|
|
479
|
+
Node.displayName = `Primitive.${node}`;
|
|
480
|
+
return { ...primitive, [node]: Node };
|
|
481
|
+
}, {});
|
|
482
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
483
|
+
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// ../../node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
|
|
487
|
+
import * as React9 from "react";
|
|
488
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
489
|
+
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
490
|
+
React9.useEffect(() => {
|
|
491
|
+
const handleKeyDown = (event) => {
|
|
492
|
+
if (event.key === "Escape") {
|
|
493
|
+
onEscapeKeyDown(event);
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
497
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
498
|
+
}, [onEscapeKeyDown, ownerDocument]);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// ../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
502
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
503
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
504
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
505
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
506
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
507
|
+
var originalBodyPointerEvents;
|
|
508
|
+
var DismissableLayerContext = React10.createContext({
|
|
509
|
+
layers: /* @__PURE__ */ new Set(),
|
|
510
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
511
|
+
branches: /* @__PURE__ */ new Set()
|
|
512
|
+
});
|
|
513
|
+
var DismissableLayer = React10.forwardRef(
|
|
514
|
+
(props, forwardedRef) => {
|
|
515
|
+
const {
|
|
516
|
+
disableOutsidePointerEvents = false,
|
|
517
|
+
onEscapeKeyDown,
|
|
518
|
+
onPointerDownOutside,
|
|
519
|
+
onFocusOutside,
|
|
520
|
+
onInteractOutside,
|
|
521
|
+
onDismiss,
|
|
522
|
+
...layerProps
|
|
523
|
+
} = props;
|
|
524
|
+
const context = React10.useContext(DismissableLayerContext);
|
|
525
|
+
const [node, setNode] = React10.useState(null);
|
|
526
|
+
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
527
|
+
const [, force] = React10.useState({});
|
|
528
|
+
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
529
|
+
const layers = Array.from(context.layers);
|
|
530
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
531
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
532
|
+
const index = node ? layers.indexOf(node) : -1;
|
|
533
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
534
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
535
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
536
|
+
const target = event.target;
|
|
537
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
538
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
539
|
+
onPointerDownOutside?.(event);
|
|
540
|
+
onInteractOutside?.(event);
|
|
541
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
542
|
+
}, ownerDocument);
|
|
543
|
+
const focusOutside = useFocusOutside((event) => {
|
|
544
|
+
const target = event.target;
|
|
545
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
546
|
+
if (isFocusInBranch) return;
|
|
547
|
+
onFocusOutside?.(event);
|
|
548
|
+
onInteractOutside?.(event);
|
|
549
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
550
|
+
}, ownerDocument);
|
|
551
|
+
useEscapeKeydown((event) => {
|
|
552
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
553
|
+
if (!isHighestLayer) return;
|
|
554
|
+
onEscapeKeyDown?.(event);
|
|
555
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
556
|
+
event.preventDefault();
|
|
557
|
+
onDismiss();
|
|
558
|
+
}
|
|
559
|
+
}, ownerDocument);
|
|
560
|
+
React10.useEffect(() => {
|
|
561
|
+
if (!node) return;
|
|
562
|
+
if (disableOutsidePointerEvents) {
|
|
563
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
564
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
565
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
566
|
+
}
|
|
567
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
568
|
+
}
|
|
569
|
+
context.layers.add(node);
|
|
570
|
+
dispatchUpdate();
|
|
571
|
+
return () => {
|
|
572
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
573
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
577
|
+
React10.useEffect(() => {
|
|
578
|
+
return () => {
|
|
579
|
+
if (!node) return;
|
|
580
|
+
context.layers.delete(node);
|
|
581
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
582
|
+
dispatchUpdate();
|
|
583
|
+
};
|
|
584
|
+
}, [node, context]);
|
|
585
|
+
React10.useEffect(() => {
|
|
586
|
+
const handleUpdate = () => force({});
|
|
587
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
588
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
589
|
+
}, []);
|
|
590
|
+
return /* @__PURE__ */ jsx9(
|
|
591
|
+
Primitive.div,
|
|
592
|
+
{
|
|
593
|
+
...layerProps,
|
|
594
|
+
ref: composedRefs,
|
|
595
|
+
style: {
|
|
596
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
597
|
+
...props.style
|
|
598
|
+
},
|
|
599
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
600
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
601
|
+
onPointerDownCapture: composeEventHandlers(
|
|
602
|
+
props.onPointerDownCapture,
|
|
603
|
+
pointerDownOutside.onPointerDownCapture
|
|
604
|
+
)
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
610
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
611
|
+
var DismissableLayerBranch = React10.forwardRef((props, forwardedRef) => {
|
|
612
|
+
const context = React10.useContext(DismissableLayerContext);
|
|
613
|
+
const ref = React10.useRef(null);
|
|
614
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
615
|
+
React10.useEffect(() => {
|
|
616
|
+
const node = ref.current;
|
|
617
|
+
if (node) {
|
|
618
|
+
context.branches.add(node);
|
|
619
|
+
return () => {
|
|
620
|
+
context.branches.delete(node);
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
}, [context.branches]);
|
|
624
|
+
return /* @__PURE__ */ jsx9(Primitive.div, { ...props, ref: composedRefs });
|
|
625
|
+
});
|
|
626
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
627
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
628
|
+
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
629
|
+
const isPointerInsideReactTreeRef = React10.useRef(false);
|
|
630
|
+
const handleClickRef = React10.useRef(() => {
|
|
631
|
+
});
|
|
632
|
+
React10.useEffect(() => {
|
|
633
|
+
const handlePointerDown = (event) => {
|
|
634
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
635
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
636
|
+
handleAndDispatchCustomEvent(
|
|
637
|
+
POINTER_DOWN_OUTSIDE,
|
|
638
|
+
handlePointerDownOutside,
|
|
639
|
+
eventDetail,
|
|
640
|
+
{ discrete: true }
|
|
641
|
+
);
|
|
642
|
+
};
|
|
643
|
+
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
644
|
+
const eventDetail = { originalEvent: event };
|
|
645
|
+
if (event.pointerType === "touch") {
|
|
646
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
647
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
648
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
649
|
+
} else {
|
|
650
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
651
|
+
}
|
|
652
|
+
} else {
|
|
653
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
654
|
+
}
|
|
655
|
+
isPointerInsideReactTreeRef.current = false;
|
|
656
|
+
};
|
|
657
|
+
const timerId = window.setTimeout(() => {
|
|
658
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
659
|
+
}, 0);
|
|
660
|
+
return () => {
|
|
661
|
+
window.clearTimeout(timerId);
|
|
662
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
663
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
664
|
+
};
|
|
665
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
666
|
+
return {
|
|
667
|
+
// ensures we check React component tree (not just DOM tree)
|
|
668
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
672
|
+
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
673
|
+
const isFocusInsideReactTreeRef = React10.useRef(false);
|
|
674
|
+
React10.useEffect(() => {
|
|
675
|
+
const handleFocus = (event) => {
|
|
676
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
677
|
+
const eventDetail = { originalEvent: event };
|
|
678
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
679
|
+
discrete: false
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
684
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
685
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
686
|
+
return {
|
|
687
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
688
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function dispatchUpdate() {
|
|
692
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
693
|
+
document.dispatchEvent(event);
|
|
694
|
+
}
|
|
695
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
696
|
+
const target = detail.originalEvent.target;
|
|
697
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
698
|
+
if (handler) target.addEventListener(name, handler, { once: true });
|
|
699
|
+
if (discrete) {
|
|
700
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
701
|
+
} else {
|
|
702
|
+
target.dispatchEvent(event);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// ../../node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
707
|
+
import * as React11 from "react";
|
|
708
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
709
|
+
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
710
|
+
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
711
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
712
|
+
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
713
|
+
var FocusScope = React11.forwardRef((props, forwardedRef) => {
|
|
714
|
+
const {
|
|
715
|
+
loop = false,
|
|
716
|
+
trapped = false,
|
|
717
|
+
onMountAutoFocus: onMountAutoFocusProp,
|
|
718
|
+
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
719
|
+
...scopeProps
|
|
720
|
+
} = props;
|
|
721
|
+
const [container, setContainer] = React11.useState(null);
|
|
722
|
+
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
723
|
+
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
724
|
+
const lastFocusedElementRef = React11.useRef(null);
|
|
725
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
726
|
+
const focusScope = React11.useRef({
|
|
727
|
+
paused: false,
|
|
728
|
+
pause() {
|
|
729
|
+
this.paused = true;
|
|
730
|
+
},
|
|
731
|
+
resume() {
|
|
732
|
+
this.paused = false;
|
|
733
|
+
}
|
|
734
|
+
}).current;
|
|
735
|
+
React11.useEffect(() => {
|
|
736
|
+
if (trapped) {
|
|
737
|
+
let handleFocusIn2 = function(event) {
|
|
738
|
+
if (focusScope.paused || !container) return;
|
|
739
|
+
const target = event.target;
|
|
740
|
+
if (container.contains(target)) {
|
|
741
|
+
lastFocusedElementRef.current = target;
|
|
742
|
+
} else {
|
|
743
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
744
|
+
}
|
|
745
|
+
}, handleFocusOut2 = function(event) {
|
|
746
|
+
if (focusScope.paused || !container) return;
|
|
747
|
+
const relatedTarget = event.relatedTarget;
|
|
748
|
+
if (relatedTarget === null) return;
|
|
749
|
+
if (!container.contains(relatedTarget)) {
|
|
750
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
751
|
+
}
|
|
752
|
+
}, handleMutations2 = function(mutations) {
|
|
753
|
+
const focusedElement = document.activeElement;
|
|
754
|
+
if (focusedElement !== document.body) return;
|
|
755
|
+
for (const mutation of mutations) {
|
|
756
|
+
if (mutation.removedNodes.length > 0) focus(container);
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;
|
|
760
|
+
document.addEventListener("focusin", handleFocusIn2);
|
|
761
|
+
document.addEventListener("focusout", handleFocusOut2);
|
|
762
|
+
const mutationObserver = new MutationObserver(handleMutations2);
|
|
763
|
+
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
764
|
+
return () => {
|
|
765
|
+
document.removeEventListener("focusin", handleFocusIn2);
|
|
766
|
+
document.removeEventListener("focusout", handleFocusOut2);
|
|
767
|
+
mutationObserver.disconnect();
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
}, [trapped, container, focusScope.paused]);
|
|
771
|
+
React11.useEffect(() => {
|
|
772
|
+
if (container) {
|
|
773
|
+
focusScopesStack.add(focusScope);
|
|
774
|
+
const previouslyFocusedElement = document.activeElement;
|
|
775
|
+
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
776
|
+
if (!hasFocusedCandidate) {
|
|
777
|
+
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
778
|
+
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
779
|
+
container.dispatchEvent(mountEvent);
|
|
780
|
+
if (!mountEvent.defaultPrevented) {
|
|
781
|
+
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
782
|
+
if (document.activeElement === previouslyFocusedElement) {
|
|
783
|
+
focus(container);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
return () => {
|
|
788
|
+
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
789
|
+
setTimeout(() => {
|
|
790
|
+
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
791
|
+
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
792
|
+
container.dispatchEvent(unmountEvent);
|
|
793
|
+
if (!unmountEvent.defaultPrevented) {
|
|
794
|
+
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
795
|
+
}
|
|
796
|
+
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
797
|
+
focusScopesStack.remove(focusScope);
|
|
798
|
+
}, 0);
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
802
|
+
const handleKeyDown = React11.useCallback(
|
|
803
|
+
(event) => {
|
|
804
|
+
if (!loop && !trapped) return;
|
|
805
|
+
if (focusScope.paused) return;
|
|
806
|
+
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
807
|
+
const focusedElement = document.activeElement;
|
|
808
|
+
if (isTabKey && focusedElement) {
|
|
809
|
+
const container2 = event.currentTarget;
|
|
810
|
+
const [first, last] = getTabbableEdges(container2);
|
|
811
|
+
const hasTabbableElementsInside = first && last;
|
|
812
|
+
if (!hasTabbableElementsInside) {
|
|
813
|
+
if (focusedElement === container2) event.preventDefault();
|
|
814
|
+
} else {
|
|
815
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
816
|
+
event.preventDefault();
|
|
817
|
+
if (loop) focus(first, { select: true });
|
|
818
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
819
|
+
event.preventDefault();
|
|
820
|
+
if (loop) focus(last, { select: true });
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
[loop, trapped, focusScope.paused]
|
|
826
|
+
);
|
|
827
|
+
return /* @__PURE__ */ jsx10(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
828
|
+
});
|
|
829
|
+
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
830
|
+
function focusFirst(candidates, { select = false } = {}) {
|
|
831
|
+
const previouslyFocusedElement = document.activeElement;
|
|
832
|
+
for (const candidate of candidates) {
|
|
833
|
+
focus(candidate, { select });
|
|
834
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
function getTabbableEdges(container) {
|
|
838
|
+
const candidates = getTabbableCandidates(container);
|
|
839
|
+
const first = findVisible(candidates, container);
|
|
840
|
+
const last = findVisible(candidates.reverse(), container);
|
|
841
|
+
return [first, last];
|
|
842
|
+
}
|
|
843
|
+
function getTabbableCandidates(container) {
|
|
844
|
+
const nodes = [];
|
|
845
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
846
|
+
acceptNode: (node) => {
|
|
847
|
+
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
848
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
849
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
853
|
+
return nodes;
|
|
854
|
+
}
|
|
855
|
+
function findVisible(elements, container) {
|
|
856
|
+
for (const element of elements) {
|
|
857
|
+
if (!isHidden(element, { upTo: container })) return element;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
function isHidden(node, { upTo }) {
|
|
861
|
+
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
862
|
+
while (node) {
|
|
863
|
+
if (upTo !== void 0 && node === upTo) return false;
|
|
864
|
+
if (getComputedStyle(node).display === "none") return true;
|
|
865
|
+
node = node.parentElement;
|
|
866
|
+
}
|
|
867
|
+
return false;
|
|
868
|
+
}
|
|
869
|
+
function isSelectableInput(element) {
|
|
870
|
+
return element instanceof HTMLInputElement && "select" in element;
|
|
871
|
+
}
|
|
872
|
+
function focus(element, { select = false } = {}) {
|
|
873
|
+
if (element && element.focus) {
|
|
874
|
+
const previouslyFocusedElement = document.activeElement;
|
|
875
|
+
element.focus({ preventScroll: true });
|
|
876
|
+
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
877
|
+
element.select();
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
var focusScopesStack = createFocusScopesStack();
|
|
881
|
+
function createFocusScopesStack() {
|
|
882
|
+
let stack = [];
|
|
883
|
+
return {
|
|
884
|
+
add(focusScope) {
|
|
885
|
+
const activeFocusScope = stack[0];
|
|
886
|
+
if (focusScope !== activeFocusScope) {
|
|
887
|
+
activeFocusScope?.pause();
|
|
888
|
+
}
|
|
889
|
+
stack = arrayRemove(stack, focusScope);
|
|
890
|
+
stack.unshift(focusScope);
|
|
891
|
+
},
|
|
892
|
+
remove(focusScope) {
|
|
893
|
+
stack = arrayRemove(stack, focusScope);
|
|
894
|
+
stack[0]?.resume();
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function arrayRemove(array, item) {
|
|
899
|
+
const updatedArray = [...array];
|
|
900
|
+
const index = updatedArray.indexOf(item);
|
|
901
|
+
if (index !== -1) {
|
|
902
|
+
updatedArray.splice(index, 1);
|
|
903
|
+
}
|
|
904
|
+
return updatedArray;
|
|
905
|
+
}
|
|
906
|
+
function removeLinks(items) {
|
|
907
|
+
return items.filter((item) => item.tagName !== "A");
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// ../../node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
911
|
+
import * as React12 from "react";
|
|
912
|
+
import ReactDOM2 from "react-dom";
|
|
913
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
914
|
+
var PORTAL_NAME = "Portal";
|
|
915
|
+
var Portal = React12.forwardRef((props, forwardedRef) => {
|
|
916
|
+
const { container: containerProp, ...portalProps } = props;
|
|
917
|
+
const [mounted, setMounted] = React12.useState(false);
|
|
918
|
+
useLayoutEffect2(() => setMounted(true), []);
|
|
919
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
920
|
+
return container ? ReactDOM2.createPortal(/* @__PURE__ */ jsx11(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
921
|
+
});
|
|
922
|
+
Portal.displayName = PORTAL_NAME;
|
|
923
|
+
|
|
924
|
+
// ../../node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
925
|
+
import * as React22 from "react";
|
|
926
|
+
import * as React13 from "react";
|
|
927
|
+
function useStateMachine(initialState, machine) {
|
|
928
|
+
return React13.useReducer((state, event) => {
|
|
929
|
+
const nextState = machine[state][event];
|
|
930
|
+
return nextState ?? state;
|
|
931
|
+
}, initialState);
|
|
932
|
+
}
|
|
933
|
+
var Presence = (props) => {
|
|
934
|
+
const { present, children } = props;
|
|
935
|
+
const presence = usePresence(present);
|
|
936
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React22.Children.only(children);
|
|
937
|
+
const ref = useComposedRefs(presence.ref, getElementRef2(child));
|
|
938
|
+
const forceMount = typeof children === "function";
|
|
939
|
+
return forceMount || presence.isPresent ? React22.cloneElement(child, { ref }) : null;
|
|
940
|
+
};
|
|
941
|
+
Presence.displayName = "Presence";
|
|
942
|
+
function usePresence(present) {
|
|
943
|
+
const [node, setNode] = React22.useState();
|
|
944
|
+
const stylesRef = React22.useRef({});
|
|
945
|
+
const prevPresentRef = React22.useRef(present);
|
|
946
|
+
const prevAnimationNameRef = React22.useRef("none");
|
|
947
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
948
|
+
const [state, send] = useStateMachine(initialState, {
|
|
949
|
+
mounted: {
|
|
950
|
+
UNMOUNT: "unmounted",
|
|
951
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
952
|
+
},
|
|
953
|
+
unmountSuspended: {
|
|
954
|
+
MOUNT: "mounted",
|
|
955
|
+
ANIMATION_END: "unmounted"
|
|
956
|
+
},
|
|
957
|
+
unmounted: {
|
|
958
|
+
MOUNT: "mounted"
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
React22.useEffect(() => {
|
|
962
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
963
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
964
|
+
}, [state]);
|
|
965
|
+
useLayoutEffect2(() => {
|
|
966
|
+
const styles = stylesRef.current;
|
|
967
|
+
const wasPresent = prevPresentRef.current;
|
|
968
|
+
const hasPresentChanged = wasPresent !== present;
|
|
969
|
+
if (hasPresentChanged) {
|
|
970
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
971
|
+
const currentAnimationName = getAnimationName(styles);
|
|
972
|
+
if (present) {
|
|
973
|
+
send("MOUNT");
|
|
974
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
975
|
+
send("UNMOUNT");
|
|
976
|
+
} else {
|
|
977
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
978
|
+
if (wasPresent && isAnimating) {
|
|
979
|
+
send("ANIMATION_OUT");
|
|
980
|
+
} else {
|
|
981
|
+
send("UNMOUNT");
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
prevPresentRef.current = present;
|
|
985
|
+
}
|
|
986
|
+
}, [present, send]);
|
|
987
|
+
useLayoutEffect2(() => {
|
|
988
|
+
if (node) {
|
|
989
|
+
let timeoutId;
|
|
990
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
991
|
+
const handleAnimationEnd = (event) => {
|
|
992
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
993
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
994
|
+
if (event.target === node && isCurrentAnimation) {
|
|
995
|
+
send("ANIMATION_END");
|
|
996
|
+
if (!prevPresentRef.current) {
|
|
997
|
+
const currentFillMode = node.style.animationFillMode;
|
|
998
|
+
node.style.animationFillMode = "forwards";
|
|
999
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
1000
|
+
if (node.style.animationFillMode === "forwards") {
|
|
1001
|
+
node.style.animationFillMode = currentFillMode;
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
const handleAnimationStart = (event) => {
|
|
1008
|
+
if (event.target === node) {
|
|
1009
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
1013
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
1014
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
1015
|
+
return () => {
|
|
1016
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
1017
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
1018
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
1019
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
1020
|
+
};
|
|
1021
|
+
} else {
|
|
1022
|
+
send("ANIMATION_END");
|
|
1023
|
+
}
|
|
1024
|
+
}, [node, send]);
|
|
1025
|
+
return {
|
|
1026
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
1027
|
+
ref: React22.useCallback((node2) => {
|
|
1028
|
+
if (node2) stylesRef.current = getComputedStyle(node2);
|
|
1029
|
+
setNode(node2);
|
|
1030
|
+
}, [])
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
function getAnimationName(styles) {
|
|
1034
|
+
return styles?.animationName || "none";
|
|
1035
|
+
}
|
|
1036
|
+
function getElementRef2(element) {
|
|
1037
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1038
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1039
|
+
if (mayWarn) {
|
|
1040
|
+
return element.ref;
|
|
1041
|
+
}
|
|
1042
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1043
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1044
|
+
if (mayWarn) {
|
|
1045
|
+
return element.props.ref;
|
|
1046
|
+
}
|
|
1047
|
+
return element.props.ref || element.ref;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// ../../node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
1051
|
+
import * as React14 from "react";
|
|
1052
|
+
var count2 = 0;
|
|
1053
|
+
function useFocusGuards() {
|
|
1054
|
+
React14.useEffect(() => {
|
|
1055
|
+
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
1056
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
1057
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
1058
|
+
count2++;
|
|
1059
|
+
return () => {
|
|
1060
|
+
if (count2 === 1) {
|
|
1061
|
+
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
1062
|
+
}
|
|
1063
|
+
count2--;
|
|
1064
|
+
};
|
|
1065
|
+
}, []);
|
|
1066
|
+
}
|
|
1067
|
+
function createFocusGuard() {
|
|
1068
|
+
const element = document.createElement("span");
|
|
1069
|
+
element.setAttribute("data-radix-focus-guard", "");
|
|
1070
|
+
element.tabIndex = 0;
|
|
1071
|
+
element.style.outline = "none";
|
|
1072
|
+
element.style.opacity = "0";
|
|
1073
|
+
element.style.position = "fixed";
|
|
1074
|
+
element.style.pointerEvents = "none";
|
|
1075
|
+
return element;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// ../../node_modules/tslib/tslib.es6.mjs
|
|
1079
|
+
var __assign = function() {
|
|
1080
|
+
__assign = Object.assign || function __assign2(t2) {
|
|
1081
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1082
|
+
s = arguments[i];
|
|
1083
|
+
for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2)) t2[p2] = s[p2];
|
|
1084
|
+
}
|
|
1085
|
+
return t2;
|
|
1086
|
+
};
|
|
1087
|
+
return __assign.apply(this, arguments);
|
|
1088
|
+
};
|
|
1089
|
+
function __rest(s, e) {
|
|
1090
|
+
var t2 = {};
|
|
1091
|
+
for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0)
|
|
1092
|
+
t2[p2] = s[p2];
|
|
1093
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1094
|
+
for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++) {
|
|
1095
|
+
if (e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]))
|
|
1096
|
+
t2[p2[i]] = s[p2[i]];
|
|
1097
|
+
}
|
|
1098
|
+
return t2;
|
|
1099
|
+
}
|
|
1100
|
+
function __spreadArray(to, from, pack) {
|
|
1101
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1102
|
+
if (ar || !(i in from)) {
|
|
1103
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1104
|
+
ar[i] = from[i];
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
1111
|
+
import * as React21 from "react";
|
|
1112
|
+
|
|
1113
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
1114
|
+
import * as React17 from "react";
|
|
1115
|
+
|
|
1116
|
+
// ../../node_modules/react-remove-scroll-bar/dist/es2015/constants.js
|
|
1117
|
+
var zeroRightClassName = "right-scroll-bar-position";
|
|
1118
|
+
var fullWidthClassName = "width-before-scroll-bar";
|
|
1119
|
+
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
1120
|
+
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
1121
|
+
|
|
1122
|
+
// ../../node_modules/use-callback-ref/dist/es2015/assignRef.js
|
|
1123
|
+
function assignRef(ref, value) {
|
|
1124
|
+
if (typeof ref === "function") {
|
|
1125
|
+
ref(value);
|
|
1126
|
+
} else if (ref) {
|
|
1127
|
+
ref.current = value;
|
|
1128
|
+
}
|
|
1129
|
+
return ref;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
// ../../node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
1133
|
+
import { useState as useState8 } from "react";
|
|
1134
|
+
function useCallbackRef2(initialValue, callback) {
|
|
1135
|
+
var ref = useState8(function() {
|
|
1136
|
+
return {
|
|
1137
|
+
// value
|
|
1138
|
+
value: initialValue,
|
|
1139
|
+
// last callback
|
|
1140
|
+
callback,
|
|
1141
|
+
// "memoized" public interface
|
|
1142
|
+
facade: {
|
|
1143
|
+
get current() {
|
|
1144
|
+
return ref.value;
|
|
1145
|
+
},
|
|
1146
|
+
set current(value) {
|
|
1147
|
+
var last = ref.value;
|
|
1148
|
+
if (last !== value) {
|
|
1149
|
+
ref.value = value;
|
|
1150
|
+
ref.callback(value, last);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
})[0];
|
|
1156
|
+
ref.callback = callback;
|
|
1157
|
+
return ref.facade;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
// ../../node_modules/use-callback-ref/dist/es2015/useMergeRef.js
|
|
1161
|
+
import * as React15 from "react";
|
|
1162
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React15.useLayoutEffect : React15.useEffect;
|
|
1163
|
+
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
1164
|
+
function useMergeRefs(refs, defaultValue) {
|
|
1165
|
+
var callbackRef = useCallbackRef2(defaultValue || null, function(newValue) {
|
|
1166
|
+
return refs.forEach(function(ref) {
|
|
1167
|
+
return assignRef(ref, newValue);
|
|
1168
|
+
});
|
|
1169
|
+
});
|
|
1170
|
+
useIsomorphicLayoutEffect(function() {
|
|
1171
|
+
var oldValue = currentValues.get(callbackRef);
|
|
1172
|
+
if (oldValue) {
|
|
1173
|
+
var prevRefs_1 = new Set(oldValue);
|
|
1174
|
+
var nextRefs_1 = new Set(refs);
|
|
1175
|
+
var current_1 = callbackRef.current;
|
|
1176
|
+
prevRefs_1.forEach(function(ref) {
|
|
1177
|
+
if (!nextRefs_1.has(ref)) {
|
|
1178
|
+
assignRef(ref, null);
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
nextRefs_1.forEach(function(ref) {
|
|
1182
|
+
if (!prevRefs_1.has(ref)) {
|
|
1183
|
+
assignRef(ref, current_1);
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
currentValues.set(callbackRef, refs);
|
|
1188
|
+
}, [refs]);
|
|
1189
|
+
return callbackRef;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// ../../node_modules/use-sidecar/dist/es2015/medium.js
|
|
1193
|
+
function ItoI(a) {
|
|
1194
|
+
return a;
|
|
1195
|
+
}
|
|
1196
|
+
function innerCreateMedium(defaults, middleware) {
|
|
1197
|
+
if (middleware === void 0) {
|
|
1198
|
+
middleware = ItoI;
|
|
1199
|
+
}
|
|
1200
|
+
var buffer = [];
|
|
1201
|
+
var assigned = false;
|
|
1202
|
+
var medium = {
|
|
1203
|
+
read: function() {
|
|
1204
|
+
if (assigned) {
|
|
1205
|
+
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
1206
|
+
}
|
|
1207
|
+
if (buffer.length) {
|
|
1208
|
+
return buffer[buffer.length - 1];
|
|
1209
|
+
}
|
|
1210
|
+
return defaults;
|
|
1211
|
+
},
|
|
1212
|
+
useMedium: function(data) {
|
|
1213
|
+
var item = middleware(data, assigned);
|
|
1214
|
+
buffer.push(item);
|
|
1215
|
+
return function() {
|
|
1216
|
+
buffer = buffer.filter(function(x) {
|
|
1217
|
+
return x !== item;
|
|
1218
|
+
});
|
|
1219
|
+
};
|
|
1220
|
+
},
|
|
1221
|
+
assignSyncMedium: function(cb) {
|
|
1222
|
+
assigned = true;
|
|
1223
|
+
while (buffer.length) {
|
|
1224
|
+
var cbs = buffer;
|
|
1225
|
+
buffer = [];
|
|
1226
|
+
cbs.forEach(cb);
|
|
1227
|
+
}
|
|
1228
|
+
buffer = {
|
|
1229
|
+
push: function(x) {
|
|
1230
|
+
return cb(x);
|
|
1231
|
+
},
|
|
1232
|
+
filter: function() {
|
|
1233
|
+
return buffer;
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
},
|
|
1237
|
+
assignMedium: function(cb) {
|
|
1238
|
+
assigned = true;
|
|
1239
|
+
var pendingQueue = [];
|
|
1240
|
+
if (buffer.length) {
|
|
1241
|
+
var cbs = buffer;
|
|
1242
|
+
buffer = [];
|
|
1243
|
+
cbs.forEach(cb);
|
|
1244
|
+
pendingQueue = buffer;
|
|
1245
|
+
}
|
|
1246
|
+
var executeQueue = function() {
|
|
1247
|
+
var cbs2 = pendingQueue;
|
|
1248
|
+
pendingQueue = [];
|
|
1249
|
+
cbs2.forEach(cb);
|
|
1250
|
+
};
|
|
1251
|
+
var cycle = function() {
|
|
1252
|
+
return Promise.resolve().then(executeQueue);
|
|
1253
|
+
};
|
|
1254
|
+
cycle();
|
|
1255
|
+
buffer = {
|
|
1256
|
+
push: function(x) {
|
|
1257
|
+
pendingQueue.push(x);
|
|
1258
|
+
cycle();
|
|
1259
|
+
},
|
|
1260
|
+
filter: function(filter) {
|
|
1261
|
+
pendingQueue = pendingQueue.filter(filter);
|
|
1262
|
+
return buffer;
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
return medium;
|
|
1268
|
+
}
|
|
1269
|
+
function createSidecarMedium(options) {
|
|
1270
|
+
if (options === void 0) {
|
|
1271
|
+
options = {};
|
|
1272
|
+
}
|
|
1273
|
+
var medium = innerCreateMedium(null);
|
|
1274
|
+
medium.options = __assign({ async: true, ssr: false }, options);
|
|
1275
|
+
return medium;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
// ../../node_modules/use-sidecar/dist/es2015/exports.js
|
|
1279
|
+
import * as React16 from "react";
|
|
1280
|
+
var SideCar = function(_a) {
|
|
1281
|
+
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
1282
|
+
if (!sideCar) {
|
|
1283
|
+
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
1284
|
+
}
|
|
1285
|
+
var Target = sideCar.read();
|
|
1286
|
+
if (!Target) {
|
|
1287
|
+
throw new Error("Sidecar medium not found");
|
|
1288
|
+
}
|
|
1289
|
+
return React16.createElement(Target, __assign({}, rest));
|
|
1290
|
+
};
|
|
1291
|
+
SideCar.isSideCarExport = true;
|
|
1292
|
+
function exportSidecar(medium, exported) {
|
|
1293
|
+
medium.useMedium(exported);
|
|
1294
|
+
return SideCar;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/medium.js
|
|
1298
|
+
var effectCar = createSidecarMedium();
|
|
1299
|
+
|
|
1300
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
1301
|
+
var nothing = function() {
|
|
1302
|
+
return;
|
|
1303
|
+
};
|
|
1304
|
+
var RemoveScroll = React17.forwardRef(function(props, parentRef) {
|
|
1305
|
+
var ref = React17.useRef(null);
|
|
1306
|
+
var _a = React17.useState({
|
|
1307
|
+
onScrollCapture: nothing,
|
|
1308
|
+
onWheelCapture: nothing,
|
|
1309
|
+
onTouchMoveCapture: nothing
|
|
1310
|
+
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
1311
|
+
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, 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", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
1312
|
+
var SideCar2 = sideCar;
|
|
1313
|
+
var containerRef = useMergeRefs([ref, parentRef]);
|
|
1314
|
+
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
1315
|
+
return React17.createElement(
|
|
1316
|
+
React17.Fragment,
|
|
1317
|
+
null,
|
|
1318
|
+
enabled && React17.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
1319
|
+
forwardProps ? React17.cloneElement(React17.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React17.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
1320
|
+
);
|
|
1321
|
+
});
|
|
1322
|
+
RemoveScroll.defaultProps = {
|
|
1323
|
+
enabled: true,
|
|
1324
|
+
removeScrollBar: true,
|
|
1325
|
+
inert: false
|
|
1326
|
+
};
|
|
1327
|
+
RemoveScroll.classNames = {
|
|
1328
|
+
fullWidth: fullWidthClassName,
|
|
1329
|
+
zeroRight: zeroRightClassName
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
1333
|
+
import * as React20 from "react";
|
|
1334
|
+
|
|
1335
|
+
// ../../node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
1336
|
+
import * as React19 from "react";
|
|
1337
|
+
|
|
1338
|
+
// ../../node_modules/react-style-singleton/dist/es2015/hook.js
|
|
1339
|
+
import * as React18 from "react";
|
|
1340
|
+
|
|
1341
|
+
// ../../node_modules/get-nonce/dist/es2015/index.js
|
|
1342
|
+
var currentNonce;
|
|
1343
|
+
var getNonce = function() {
|
|
1344
|
+
if (currentNonce) {
|
|
1345
|
+
return currentNonce;
|
|
1346
|
+
}
|
|
1347
|
+
if (typeof __webpack_nonce__ !== "undefined") {
|
|
1348
|
+
return __webpack_nonce__;
|
|
1349
|
+
}
|
|
1350
|
+
return void 0;
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1353
|
+
// ../../node_modules/react-style-singleton/dist/es2015/singleton.js
|
|
1354
|
+
function makeStyleTag() {
|
|
1355
|
+
if (!document)
|
|
1356
|
+
return null;
|
|
1357
|
+
var tag = document.createElement("style");
|
|
1358
|
+
tag.type = "text/css";
|
|
1359
|
+
var nonce = getNonce();
|
|
1360
|
+
if (nonce) {
|
|
1361
|
+
tag.setAttribute("nonce", nonce);
|
|
1362
|
+
}
|
|
1363
|
+
return tag;
|
|
1364
|
+
}
|
|
1365
|
+
function injectStyles(tag, css) {
|
|
1366
|
+
if (tag.styleSheet) {
|
|
1367
|
+
tag.styleSheet.cssText = css;
|
|
1368
|
+
} else {
|
|
1369
|
+
tag.appendChild(document.createTextNode(css));
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
function insertStyleTag(tag) {
|
|
1373
|
+
var head = document.head || document.getElementsByTagName("head")[0];
|
|
1374
|
+
head.appendChild(tag);
|
|
1375
|
+
}
|
|
1376
|
+
var stylesheetSingleton = function() {
|
|
1377
|
+
var counter = 0;
|
|
1378
|
+
var stylesheet = null;
|
|
1379
|
+
return {
|
|
1380
|
+
add: function(style) {
|
|
1381
|
+
if (counter == 0) {
|
|
1382
|
+
if (stylesheet = makeStyleTag()) {
|
|
1383
|
+
injectStyles(stylesheet, style);
|
|
1384
|
+
insertStyleTag(stylesheet);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
counter++;
|
|
1388
|
+
},
|
|
1389
|
+
remove: function() {
|
|
1390
|
+
counter--;
|
|
1391
|
+
if (!counter && stylesheet) {
|
|
1392
|
+
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
1393
|
+
stylesheet = null;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
// ../../node_modules/react-style-singleton/dist/es2015/hook.js
|
|
1400
|
+
var styleHookSingleton = function() {
|
|
1401
|
+
var sheet = stylesheetSingleton();
|
|
1402
|
+
return function(styles, isDynamic) {
|
|
1403
|
+
React18.useEffect(function() {
|
|
1404
|
+
sheet.add(styles);
|
|
1405
|
+
return function() {
|
|
1406
|
+
sheet.remove();
|
|
1407
|
+
};
|
|
1408
|
+
}, [styles && isDynamic]);
|
|
1409
|
+
};
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
// ../../node_modules/react-style-singleton/dist/es2015/component.js
|
|
1413
|
+
var styleSingleton = function() {
|
|
1414
|
+
var useStyle = styleHookSingleton();
|
|
1415
|
+
var Sheet = function(_a) {
|
|
1416
|
+
var styles = _a.styles, dynamic = _a.dynamic;
|
|
1417
|
+
useStyle(styles, dynamic);
|
|
1418
|
+
return null;
|
|
1419
|
+
};
|
|
1420
|
+
return Sheet;
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
// ../../node_modules/react-remove-scroll-bar/dist/es2015/utils.js
|
|
1424
|
+
var zeroGap = {
|
|
1425
|
+
left: 0,
|
|
1426
|
+
top: 0,
|
|
1427
|
+
right: 0,
|
|
1428
|
+
gap: 0
|
|
1429
|
+
};
|
|
1430
|
+
var parse = function(x) {
|
|
1431
|
+
return parseInt(x || "", 10) || 0;
|
|
1432
|
+
};
|
|
1433
|
+
var getOffset = function(gapMode) {
|
|
1434
|
+
var cs = window.getComputedStyle(document.body);
|
|
1435
|
+
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
1436
|
+
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
1437
|
+
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
1438
|
+
return [parse(left), parse(top), parse(right)];
|
|
1439
|
+
};
|
|
1440
|
+
var getGapWidth = function(gapMode) {
|
|
1441
|
+
if (gapMode === void 0) {
|
|
1442
|
+
gapMode = "margin";
|
|
1443
|
+
}
|
|
1444
|
+
if (typeof window === "undefined") {
|
|
1445
|
+
return zeroGap;
|
|
1446
|
+
}
|
|
1447
|
+
var offsets = getOffset(gapMode);
|
|
1448
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
1449
|
+
var windowWidth = window.innerWidth;
|
|
1450
|
+
return {
|
|
1451
|
+
left: offsets[0],
|
|
1452
|
+
top: offsets[1],
|
|
1453
|
+
right: offsets[2],
|
|
1454
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
1455
|
+
};
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
// ../../node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
1459
|
+
var Style = styleSingleton();
|
|
1460
|
+
var lockAttribute = "data-scroll-locked";
|
|
1461
|
+
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
1462
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
1463
|
+
if (gapMode === void 0) {
|
|
1464
|
+
gapMode = "margin";
|
|
1465
|
+
}
|
|
1466
|
+
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([
|
|
1467
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
1468
|
+
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 "),
|
|
1469
|
+
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
1470
|
+
].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");
|
|
1471
|
+
};
|
|
1472
|
+
var getCurrentUseCounter = function() {
|
|
1473
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
1474
|
+
return isFinite(counter) ? counter : 0;
|
|
1475
|
+
};
|
|
1476
|
+
var useLockAttribute = function() {
|
|
1477
|
+
React19.useEffect(function() {
|
|
1478
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
1479
|
+
return function() {
|
|
1480
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
1481
|
+
if (newCounter <= 0) {
|
|
1482
|
+
document.body.removeAttribute(lockAttribute);
|
|
1483
|
+
} else {
|
|
1484
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
}, []);
|
|
1488
|
+
};
|
|
1489
|
+
var RemoveScrollBar = function(_a) {
|
|
1490
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
1491
|
+
useLockAttribute();
|
|
1492
|
+
var gap = React19.useMemo(function() {
|
|
1493
|
+
return getGapWidth(gapMode);
|
|
1494
|
+
}, [gapMode]);
|
|
1495
|
+
return React19.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
1496
|
+
};
|
|
1497
|
+
|
|
1498
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
|
|
1499
|
+
var passiveSupported = false;
|
|
1500
|
+
if (typeof window !== "undefined") {
|
|
1501
|
+
try {
|
|
1502
|
+
options = Object.defineProperty({}, "passive", {
|
|
1503
|
+
get: function() {
|
|
1504
|
+
passiveSupported = true;
|
|
1505
|
+
return true;
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1508
|
+
window.addEventListener("test", options, options);
|
|
1509
|
+
window.removeEventListener("test", options, options);
|
|
1510
|
+
} catch (err) {
|
|
1511
|
+
passiveSupported = false;
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
var options;
|
|
1515
|
+
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
1516
|
+
|
|
1517
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/handleScroll.js
|
|
1518
|
+
var alwaysContainsScroll = function(node) {
|
|
1519
|
+
return node.tagName === "TEXTAREA";
|
|
1520
|
+
};
|
|
1521
|
+
var elementCanBeScrolled = function(node, overflow) {
|
|
1522
|
+
if (!(node instanceof Element)) {
|
|
1523
|
+
return false;
|
|
1524
|
+
}
|
|
1525
|
+
var styles = window.getComputedStyle(node);
|
|
1526
|
+
return (
|
|
1527
|
+
// not-not-scrollable
|
|
1528
|
+
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
1529
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
1530
|
+
);
|
|
1531
|
+
};
|
|
1532
|
+
var elementCouldBeVScrolled = function(node) {
|
|
1533
|
+
return elementCanBeScrolled(node, "overflowY");
|
|
1534
|
+
};
|
|
1535
|
+
var elementCouldBeHScrolled = function(node) {
|
|
1536
|
+
return elementCanBeScrolled(node, "overflowX");
|
|
1537
|
+
};
|
|
1538
|
+
var locationCouldBeScrolled = function(axis, node) {
|
|
1539
|
+
var ownerDocument = node.ownerDocument;
|
|
1540
|
+
var current = node;
|
|
1541
|
+
do {
|
|
1542
|
+
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
1543
|
+
current = current.host;
|
|
1544
|
+
}
|
|
1545
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
1546
|
+
if (isScrollable) {
|
|
1547
|
+
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
1548
|
+
if (scrollHeight > clientHeight) {
|
|
1549
|
+
return true;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
current = current.parentNode;
|
|
1553
|
+
} while (current && current !== ownerDocument.body);
|
|
1554
|
+
return false;
|
|
1555
|
+
};
|
|
1556
|
+
var getVScrollVariables = function(_a) {
|
|
1557
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
1558
|
+
return [
|
|
1559
|
+
scrollTop,
|
|
1560
|
+
scrollHeight,
|
|
1561
|
+
clientHeight
|
|
1562
|
+
];
|
|
1563
|
+
};
|
|
1564
|
+
var getHScrollVariables = function(_a) {
|
|
1565
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
1566
|
+
return [
|
|
1567
|
+
scrollLeft,
|
|
1568
|
+
scrollWidth,
|
|
1569
|
+
clientWidth
|
|
1570
|
+
];
|
|
1571
|
+
};
|
|
1572
|
+
var elementCouldBeScrolled = function(axis, node) {
|
|
1573
|
+
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
1574
|
+
};
|
|
1575
|
+
var getScrollVariables = function(axis, node) {
|
|
1576
|
+
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
1577
|
+
};
|
|
1578
|
+
var getDirectionFactor = function(axis, direction) {
|
|
1579
|
+
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
1580
|
+
};
|
|
1581
|
+
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
1582
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
1583
|
+
var delta = directionFactor * sourceDelta;
|
|
1584
|
+
var target = event.target;
|
|
1585
|
+
var targetInLock = endTarget.contains(target);
|
|
1586
|
+
var shouldCancelScroll = false;
|
|
1587
|
+
var isDeltaPositive = delta > 0;
|
|
1588
|
+
var availableScroll = 0;
|
|
1589
|
+
var availableScrollTop = 0;
|
|
1590
|
+
do {
|
|
1591
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
1592
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
1593
|
+
if (position || elementScroll) {
|
|
1594
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
1595
|
+
availableScroll += elementScroll;
|
|
1596
|
+
availableScrollTop += position;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
if (target instanceof ShadowRoot) {
|
|
1600
|
+
target = target.host;
|
|
1601
|
+
} else {
|
|
1602
|
+
target = target.parentNode;
|
|
1603
|
+
}
|
|
1604
|
+
} while (
|
|
1605
|
+
// portaled content
|
|
1606
|
+
!targetInLock && target !== document.body || // self content
|
|
1607
|
+
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
1608
|
+
);
|
|
1609
|
+
if (isDeltaPositive && (noOverscroll && Math.abs(availableScroll) < 1 || !noOverscroll && delta > availableScroll)) {
|
|
1610
|
+
shouldCancelScroll = true;
|
|
1611
|
+
} else if (!isDeltaPositive && (noOverscroll && Math.abs(availableScrollTop) < 1 || !noOverscroll && -delta > availableScrollTop)) {
|
|
1612
|
+
shouldCancelScroll = true;
|
|
1613
|
+
}
|
|
1614
|
+
return shouldCancelScroll;
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
1618
|
+
var getTouchXY = function(event) {
|
|
1619
|
+
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
1620
|
+
};
|
|
1621
|
+
var getDeltaXY = function(event) {
|
|
1622
|
+
return [event.deltaX, event.deltaY];
|
|
1623
|
+
};
|
|
1624
|
+
var extractRef = function(ref) {
|
|
1625
|
+
return ref && "current" in ref ? ref.current : ref;
|
|
1626
|
+
};
|
|
1627
|
+
var deltaCompare = function(x, y) {
|
|
1628
|
+
return x[0] === y[0] && x[1] === y[1];
|
|
1629
|
+
};
|
|
1630
|
+
var generateStyle = function(id) {
|
|
1631
|
+
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
1632
|
+
};
|
|
1633
|
+
var idCounter = 0;
|
|
1634
|
+
var lockStack = [];
|
|
1635
|
+
function RemoveScrollSideCar(props) {
|
|
1636
|
+
var shouldPreventQueue = React20.useRef([]);
|
|
1637
|
+
var touchStartRef = React20.useRef([0, 0]);
|
|
1638
|
+
var activeAxis = React20.useRef();
|
|
1639
|
+
var id = React20.useState(idCounter++)[0];
|
|
1640
|
+
var Style2 = React20.useState(styleSingleton)[0];
|
|
1641
|
+
var lastProps = React20.useRef(props);
|
|
1642
|
+
React20.useEffect(function() {
|
|
1643
|
+
lastProps.current = props;
|
|
1644
|
+
}, [props]);
|
|
1645
|
+
React20.useEffect(function() {
|
|
1646
|
+
if (props.inert) {
|
|
1647
|
+
document.body.classList.add("block-interactivity-".concat(id));
|
|
1648
|
+
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
1649
|
+
allow_1.forEach(function(el) {
|
|
1650
|
+
return el.classList.add("allow-interactivity-".concat(id));
|
|
1651
|
+
});
|
|
1652
|
+
return function() {
|
|
1653
|
+
document.body.classList.remove("block-interactivity-".concat(id));
|
|
1654
|
+
allow_1.forEach(function(el) {
|
|
1655
|
+
return el.classList.remove("allow-interactivity-".concat(id));
|
|
1656
|
+
});
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
return;
|
|
1660
|
+
}, [props.inert, props.lockRef.current, props.shards]);
|
|
1661
|
+
var shouldCancelEvent = React20.useCallback(function(event, parent) {
|
|
1662
|
+
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
1663
|
+
return !lastProps.current.allowPinchZoom;
|
|
1664
|
+
}
|
|
1665
|
+
var touch = getTouchXY(event);
|
|
1666
|
+
var touchStart = touchStartRef.current;
|
|
1667
|
+
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
1668
|
+
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
1669
|
+
var currentAxis;
|
|
1670
|
+
var target = event.target;
|
|
1671
|
+
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
1672
|
+
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
1673
|
+
return false;
|
|
1674
|
+
}
|
|
1675
|
+
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
1676
|
+
if (!canBeScrolledInMainDirection) {
|
|
1677
|
+
return true;
|
|
1678
|
+
}
|
|
1679
|
+
if (canBeScrolledInMainDirection) {
|
|
1680
|
+
currentAxis = moveDirection;
|
|
1681
|
+
} else {
|
|
1682
|
+
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
1683
|
+
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
1684
|
+
}
|
|
1685
|
+
if (!canBeScrolledInMainDirection) {
|
|
1686
|
+
return false;
|
|
1687
|
+
}
|
|
1688
|
+
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
1689
|
+
activeAxis.current = currentAxis;
|
|
1690
|
+
}
|
|
1691
|
+
if (!currentAxis) {
|
|
1692
|
+
return true;
|
|
1693
|
+
}
|
|
1694
|
+
var cancelingAxis = activeAxis.current || currentAxis;
|
|
1695
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
|
|
1696
|
+
}, []);
|
|
1697
|
+
var shouldPrevent = React20.useCallback(function(_event) {
|
|
1698
|
+
var event = _event;
|
|
1699
|
+
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
1703
|
+
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
1704
|
+
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
1705
|
+
})[0];
|
|
1706
|
+
if (sourceEvent && sourceEvent.should) {
|
|
1707
|
+
if (event.cancelable) {
|
|
1708
|
+
event.preventDefault();
|
|
1709
|
+
}
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
if (!sourceEvent) {
|
|
1713
|
+
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
1714
|
+
return node.contains(event.target);
|
|
1715
|
+
});
|
|
1716
|
+
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
1717
|
+
if (shouldStop) {
|
|
1718
|
+
if (event.cancelable) {
|
|
1719
|
+
event.preventDefault();
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}, []);
|
|
1724
|
+
var shouldCancel = React20.useCallback(function(name, delta, target, should) {
|
|
1725
|
+
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
1726
|
+
shouldPreventQueue.current.push(event);
|
|
1727
|
+
setTimeout(function() {
|
|
1728
|
+
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
1729
|
+
return e !== event;
|
|
1730
|
+
});
|
|
1731
|
+
}, 1);
|
|
1732
|
+
}, []);
|
|
1733
|
+
var scrollTouchStart = React20.useCallback(function(event) {
|
|
1734
|
+
touchStartRef.current = getTouchXY(event);
|
|
1735
|
+
activeAxis.current = void 0;
|
|
1736
|
+
}, []);
|
|
1737
|
+
var scrollWheel = React20.useCallback(function(event) {
|
|
1738
|
+
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1739
|
+
}, []);
|
|
1740
|
+
var scrollTouchMove = React20.useCallback(function(event) {
|
|
1741
|
+
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1742
|
+
}, []);
|
|
1743
|
+
React20.useEffect(function() {
|
|
1744
|
+
lockStack.push(Style2);
|
|
1745
|
+
props.setCallbacks({
|
|
1746
|
+
onScrollCapture: scrollWheel,
|
|
1747
|
+
onWheelCapture: scrollWheel,
|
|
1748
|
+
onTouchMoveCapture: scrollTouchMove
|
|
1749
|
+
});
|
|
1750
|
+
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
1751
|
+
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
1752
|
+
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
1753
|
+
return function() {
|
|
1754
|
+
lockStack = lockStack.filter(function(inst) {
|
|
1755
|
+
return inst !== Style2;
|
|
1756
|
+
});
|
|
1757
|
+
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
1758
|
+
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
1759
|
+
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
1760
|
+
};
|
|
1761
|
+
}, []);
|
|
1762
|
+
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
1763
|
+
return React20.createElement(
|
|
1764
|
+
React20.Fragment,
|
|
1765
|
+
null,
|
|
1766
|
+
inert ? React20.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
1767
|
+
removeScrollBar ? React20.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null
|
|
1768
|
+
);
|
|
1769
|
+
}
|
|
1770
|
+
function getOutermostShadowParent(node) {
|
|
1771
|
+
var shadowParent = null;
|
|
1772
|
+
while (node !== null) {
|
|
1773
|
+
if (node instanceof ShadowRoot) {
|
|
1774
|
+
shadowParent = node.host;
|
|
1775
|
+
node = node.host;
|
|
1776
|
+
}
|
|
1777
|
+
node = node.parentNode;
|
|
1778
|
+
}
|
|
1779
|
+
return shadowParent;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/sidecar.js
|
|
1783
|
+
var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
1784
|
+
|
|
1785
|
+
// ../../node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
1786
|
+
var ReactRemoveScroll = React21.forwardRef(function(props, ref) {
|
|
1787
|
+
return React21.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
|
|
1788
|
+
});
|
|
1789
|
+
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
1790
|
+
var Combination_default = ReactRemoveScroll;
|
|
1791
|
+
|
|
1792
|
+
// ../../node_modules/aria-hidden/dist/es2015/index.js
|
|
1793
|
+
var getDefaultParent = function(originalTarget) {
|
|
1794
|
+
if (typeof document === "undefined") {
|
|
1795
|
+
return null;
|
|
1796
|
+
}
|
|
1797
|
+
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
1798
|
+
return sampleTarget.ownerDocument.body;
|
|
1799
|
+
};
|
|
1800
|
+
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
1801
|
+
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
1802
|
+
var markerMap = {};
|
|
1803
|
+
var lockCount = 0;
|
|
1804
|
+
var unwrapHost = function(node) {
|
|
1805
|
+
return node && (node.host || unwrapHost(node.parentNode));
|
|
1806
|
+
};
|
|
1807
|
+
var correctTargets = function(parent, targets) {
|
|
1808
|
+
return targets.map(function(target) {
|
|
1809
|
+
if (parent.contains(target)) {
|
|
1810
|
+
return target;
|
|
1811
|
+
}
|
|
1812
|
+
var correctedTarget = unwrapHost(target);
|
|
1813
|
+
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
1814
|
+
return correctedTarget;
|
|
1815
|
+
}
|
|
1816
|
+
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
1817
|
+
return null;
|
|
1818
|
+
}).filter(function(x) {
|
|
1819
|
+
return Boolean(x);
|
|
1820
|
+
});
|
|
1821
|
+
};
|
|
1822
|
+
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
1823
|
+
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
1824
|
+
if (!markerMap[markerName]) {
|
|
1825
|
+
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
1826
|
+
}
|
|
1827
|
+
var markerCounter = markerMap[markerName];
|
|
1828
|
+
var hiddenNodes = [];
|
|
1829
|
+
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
1830
|
+
var elementsToStop = new Set(targets);
|
|
1831
|
+
var keep = function(el) {
|
|
1832
|
+
if (!el || elementsToKeep.has(el)) {
|
|
1833
|
+
return;
|
|
1834
|
+
}
|
|
1835
|
+
elementsToKeep.add(el);
|
|
1836
|
+
keep(el.parentNode);
|
|
1837
|
+
};
|
|
1838
|
+
targets.forEach(keep);
|
|
1839
|
+
var deep = function(parent) {
|
|
1840
|
+
if (!parent || elementsToStop.has(parent)) {
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1843
|
+
Array.prototype.forEach.call(parent.children, function(node) {
|
|
1844
|
+
if (elementsToKeep.has(node)) {
|
|
1845
|
+
deep(node);
|
|
1846
|
+
} else {
|
|
1847
|
+
try {
|
|
1848
|
+
var attr = node.getAttribute(controlAttribute);
|
|
1849
|
+
var alreadyHidden = attr !== null && attr !== "false";
|
|
1850
|
+
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
1851
|
+
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
1852
|
+
counterMap.set(node, counterValue);
|
|
1853
|
+
markerCounter.set(node, markerValue);
|
|
1854
|
+
hiddenNodes.push(node);
|
|
1855
|
+
if (counterValue === 1 && alreadyHidden) {
|
|
1856
|
+
uncontrolledNodes.set(node, true);
|
|
1857
|
+
}
|
|
1858
|
+
if (markerValue === 1) {
|
|
1859
|
+
node.setAttribute(markerName, "true");
|
|
1860
|
+
}
|
|
1861
|
+
if (!alreadyHidden) {
|
|
1862
|
+
node.setAttribute(controlAttribute, "true");
|
|
1863
|
+
}
|
|
1864
|
+
} catch (e) {
|
|
1865
|
+
console.error("aria-hidden: cannot operate on ", node, e);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1869
|
+
};
|
|
1870
|
+
deep(parentNode);
|
|
1871
|
+
elementsToKeep.clear();
|
|
1872
|
+
lockCount++;
|
|
1873
|
+
return function() {
|
|
1874
|
+
hiddenNodes.forEach(function(node) {
|
|
1875
|
+
var counterValue = counterMap.get(node) - 1;
|
|
1876
|
+
var markerValue = markerCounter.get(node) - 1;
|
|
1877
|
+
counterMap.set(node, counterValue);
|
|
1878
|
+
markerCounter.set(node, markerValue);
|
|
1879
|
+
if (!counterValue) {
|
|
1880
|
+
if (!uncontrolledNodes.has(node)) {
|
|
1881
|
+
node.removeAttribute(controlAttribute);
|
|
1882
|
+
}
|
|
1883
|
+
uncontrolledNodes.delete(node);
|
|
1884
|
+
}
|
|
1885
|
+
if (!markerValue) {
|
|
1886
|
+
node.removeAttribute(markerName);
|
|
1887
|
+
}
|
|
1888
|
+
});
|
|
1889
|
+
lockCount--;
|
|
1890
|
+
if (!lockCount) {
|
|
1891
|
+
counterMap = /* @__PURE__ */ new WeakMap();
|
|
1892
|
+
counterMap = /* @__PURE__ */ new WeakMap();
|
|
1893
|
+
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
1894
|
+
markerMap = {};
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
};
|
|
1898
|
+
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
1899
|
+
if (markerName === void 0) {
|
|
1900
|
+
markerName = "data-aria-hidden";
|
|
1901
|
+
}
|
|
1902
|
+
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
1903
|
+
var activeParentNode = parentNode || getDefaultParent(originalTarget);
|
|
1904
|
+
if (!activeParentNode) {
|
|
1905
|
+
return function() {
|
|
1906
|
+
return null;
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
|
|
1910
|
+
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
1911
|
+
};
|
|
1912
|
+
|
|
1913
|
+
// ../../node_modules/@radix-ui/react-dialog/dist/index.mjs
|
|
1914
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1915
|
+
var DIALOG_NAME = "Dialog";
|
|
1916
|
+
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
1917
|
+
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
1918
|
+
var Dialog = (props) => {
|
|
1919
|
+
const {
|
|
1920
|
+
__scopeDialog,
|
|
1921
|
+
children,
|
|
1922
|
+
open: openProp,
|
|
1923
|
+
defaultOpen,
|
|
1924
|
+
onOpenChange,
|
|
1925
|
+
modal = true
|
|
1926
|
+
} = props;
|
|
1927
|
+
const triggerRef = React23.useRef(null);
|
|
1928
|
+
const contentRef = React23.useRef(null);
|
|
1929
|
+
const [open = false, setOpen] = useControllableState({
|
|
1930
|
+
prop: openProp,
|
|
1931
|
+
defaultProp: defaultOpen,
|
|
1932
|
+
onChange: onOpenChange
|
|
1933
|
+
});
|
|
1934
|
+
return /* @__PURE__ */ jsx12(
|
|
1935
|
+
DialogProvider,
|
|
1936
|
+
{
|
|
1937
|
+
scope: __scopeDialog,
|
|
1938
|
+
triggerRef,
|
|
1939
|
+
contentRef,
|
|
1940
|
+
contentId: useId(),
|
|
1941
|
+
titleId: useId(),
|
|
1942
|
+
descriptionId: useId(),
|
|
1943
|
+
open,
|
|
1944
|
+
onOpenChange: setOpen,
|
|
1945
|
+
onOpenToggle: React23.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
1946
|
+
modal,
|
|
1947
|
+
children
|
|
1948
|
+
}
|
|
1949
|
+
);
|
|
1950
|
+
};
|
|
1951
|
+
Dialog.displayName = DIALOG_NAME;
|
|
1952
|
+
var TRIGGER_NAME = "DialogTrigger";
|
|
1953
|
+
var DialogTrigger = React23.forwardRef(
|
|
1954
|
+
(props, forwardedRef) => {
|
|
1955
|
+
const { __scopeDialog, ...triggerProps } = props;
|
|
1956
|
+
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
1957
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
1958
|
+
return /* @__PURE__ */ jsx12(
|
|
1959
|
+
Primitive.button,
|
|
1960
|
+
{
|
|
1961
|
+
type: "button",
|
|
1962
|
+
"aria-haspopup": "dialog",
|
|
1963
|
+
"aria-expanded": context.open,
|
|
1964
|
+
"aria-controls": context.contentId,
|
|
1965
|
+
"data-state": getState(context.open),
|
|
1966
|
+
...triggerProps,
|
|
1967
|
+
ref: composedTriggerRef,
|
|
1968
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
1969
|
+
}
|
|
1970
|
+
);
|
|
1971
|
+
}
|
|
1972
|
+
);
|
|
1973
|
+
DialogTrigger.displayName = TRIGGER_NAME;
|
|
1974
|
+
var PORTAL_NAME2 = "DialogPortal";
|
|
1975
|
+
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
|
|
1976
|
+
forceMount: void 0
|
|
1977
|
+
});
|
|
1978
|
+
var DialogPortal = (props) => {
|
|
1979
|
+
const { __scopeDialog, forceMount, children, container } = props;
|
|
1980
|
+
const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
|
|
1981
|
+
return /* @__PURE__ */ jsx12(PortalProvider, { scope: __scopeDialog, forceMount, children: React23.Children.map(children, (child) => /* @__PURE__ */ jsx12(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx12(Portal, { asChild: true, container, children: child }) })) });
|
|
1982
|
+
};
|
|
1983
|
+
DialogPortal.displayName = PORTAL_NAME2;
|
|
1984
|
+
var OVERLAY_NAME = "DialogOverlay";
|
|
1985
|
+
var DialogOverlay = React23.forwardRef(
|
|
1986
|
+
(props, forwardedRef) => {
|
|
1987
|
+
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
1988
|
+
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
1989
|
+
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
1990
|
+
return context.modal ? /* @__PURE__ */ jsx12(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx12(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
1991
|
+
}
|
|
1992
|
+
);
|
|
1993
|
+
DialogOverlay.displayName = OVERLAY_NAME;
|
|
1994
|
+
var Slot = createSlot("DialogOverlay.RemoveScroll");
|
|
1995
|
+
var DialogOverlayImpl = React23.forwardRef(
|
|
1996
|
+
(props, forwardedRef) => {
|
|
1997
|
+
const { __scopeDialog, ...overlayProps } = props;
|
|
1998
|
+
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
1999
|
+
return (
|
|
2000
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
2001
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
2002
|
+
/* @__PURE__ */ jsx12(Combination_default, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx12(
|
|
2003
|
+
Primitive.div,
|
|
2004
|
+
{
|
|
2005
|
+
"data-state": getState(context.open),
|
|
2006
|
+
...overlayProps,
|
|
2007
|
+
ref: forwardedRef,
|
|
2008
|
+
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
2009
|
+
}
|
|
2010
|
+
) })
|
|
2011
|
+
);
|
|
2012
|
+
}
|
|
2013
|
+
);
|
|
2014
|
+
var CONTENT_NAME = "DialogContent";
|
|
2015
|
+
var DialogContent = React23.forwardRef(
|
|
2016
|
+
(props, forwardedRef) => {
|
|
2017
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
2018
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
2019
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
2020
|
+
return /* @__PURE__ */ jsx12(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx12(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx12(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
2021
|
+
}
|
|
2022
|
+
);
|
|
2023
|
+
DialogContent.displayName = CONTENT_NAME;
|
|
2024
|
+
var DialogContentModal = React23.forwardRef(
|
|
2025
|
+
(props, forwardedRef) => {
|
|
2026
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
2027
|
+
const contentRef = React23.useRef(null);
|
|
2028
|
+
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
2029
|
+
React23.useEffect(() => {
|
|
2030
|
+
const content = contentRef.current;
|
|
2031
|
+
if (content) return hideOthers(content);
|
|
2032
|
+
}, []);
|
|
2033
|
+
return /* @__PURE__ */ jsx12(
|
|
2034
|
+
DialogContentImpl,
|
|
2035
|
+
{
|
|
2036
|
+
...props,
|
|
2037
|
+
ref: composedRefs,
|
|
2038
|
+
trapFocus: context.open,
|
|
2039
|
+
disableOutsidePointerEvents: true,
|
|
2040
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
2041
|
+
event.preventDefault();
|
|
2042
|
+
context.triggerRef.current?.focus();
|
|
2043
|
+
}),
|
|
2044
|
+
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
2045
|
+
const originalEvent = event.detail.originalEvent;
|
|
2046
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
2047
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
2048
|
+
if (isRightClick) event.preventDefault();
|
|
2049
|
+
}),
|
|
2050
|
+
onFocusOutside: composeEventHandlers(
|
|
2051
|
+
props.onFocusOutside,
|
|
2052
|
+
(event) => event.preventDefault()
|
|
2053
|
+
)
|
|
2054
|
+
}
|
|
2055
|
+
);
|
|
2056
|
+
}
|
|
2057
|
+
);
|
|
2058
|
+
var DialogContentNonModal = React23.forwardRef(
|
|
2059
|
+
(props, forwardedRef) => {
|
|
2060
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
2061
|
+
const hasInteractedOutsideRef = React23.useRef(false);
|
|
2062
|
+
const hasPointerDownOutsideRef = React23.useRef(false);
|
|
2063
|
+
return /* @__PURE__ */ jsx12(
|
|
2064
|
+
DialogContentImpl,
|
|
2065
|
+
{
|
|
2066
|
+
...props,
|
|
2067
|
+
ref: forwardedRef,
|
|
2068
|
+
trapFocus: false,
|
|
2069
|
+
disableOutsidePointerEvents: false,
|
|
2070
|
+
onCloseAutoFocus: (event) => {
|
|
2071
|
+
props.onCloseAutoFocus?.(event);
|
|
2072
|
+
if (!event.defaultPrevented) {
|
|
2073
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
2074
|
+
event.preventDefault();
|
|
2075
|
+
}
|
|
2076
|
+
hasInteractedOutsideRef.current = false;
|
|
2077
|
+
hasPointerDownOutsideRef.current = false;
|
|
2078
|
+
},
|
|
2079
|
+
onInteractOutside: (event) => {
|
|
2080
|
+
props.onInteractOutside?.(event);
|
|
2081
|
+
if (!event.defaultPrevented) {
|
|
2082
|
+
hasInteractedOutsideRef.current = true;
|
|
2083
|
+
if (event.detail.originalEvent.type === "pointerdown") {
|
|
2084
|
+
hasPointerDownOutsideRef.current = true;
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
const target = event.target;
|
|
2088
|
+
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
2089
|
+
if (targetIsTrigger) event.preventDefault();
|
|
2090
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
2091
|
+
event.preventDefault();
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
);
|
|
2096
|
+
}
|
|
2097
|
+
);
|
|
2098
|
+
var DialogContentImpl = React23.forwardRef(
|
|
2099
|
+
(props, forwardedRef) => {
|
|
2100
|
+
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
2101
|
+
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
2102
|
+
const contentRef = React23.useRef(null);
|
|
2103
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2104
|
+
useFocusGuards();
|
|
2105
|
+
return /* @__PURE__ */ jsxs3(Fragment5, { children: [
|
|
2106
|
+
/* @__PURE__ */ jsx12(
|
|
2107
|
+
FocusScope,
|
|
2108
|
+
{
|
|
2109
|
+
asChild: true,
|
|
2110
|
+
loop: true,
|
|
2111
|
+
trapped: trapFocus,
|
|
2112
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
2113
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
2114
|
+
children: /* @__PURE__ */ jsx12(
|
|
2115
|
+
DismissableLayer,
|
|
2116
|
+
{
|
|
2117
|
+
role: "dialog",
|
|
2118
|
+
id: context.contentId,
|
|
2119
|
+
"aria-describedby": context.descriptionId,
|
|
2120
|
+
"aria-labelledby": context.titleId,
|
|
2121
|
+
"data-state": getState(context.open),
|
|
2122
|
+
...contentProps,
|
|
2123
|
+
ref: composedRefs,
|
|
2124
|
+
onDismiss: () => context.onOpenChange(false)
|
|
2125
|
+
}
|
|
2126
|
+
)
|
|
2127
|
+
}
|
|
2128
|
+
),
|
|
2129
|
+
/* @__PURE__ */ jsxs3(Fragment5, { children: [
|
|
2130
|
+
/* @__PURE__ */ jsx12(TitleWarning, { titleId: context.titleId }),
|
|
2131
|
+
/* @__PURE__ */ jsx12(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
2132
|
+
] })
|
|
2133
|
+
] });
|
|
2134
|
+
}
|
|
2135
|
+
);
|
|
2136
|
+
var TITLE_NAME = "DialogTitle";
|
|
2137
|
+
var DialogTitle = React23.forwardRef(
|
|
2138
|
+
(props, forwardedRef) => {
|
|
2139
|
+
const { __scopeDialog, ...titleProps } = props;
|
|
2140
|
+
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
2141
|
+
return /* @__PURE__ */ jsx12(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
2142
|
+
}
|
|
2143
|
+
);
|
|
2144
|
+
DialogTitle.displayName = TITLE_NAME;
|
|
2145
|
+
var DESCRIPTION_NAME = "DialogDescription";
|
|
2146
|
+
var DialogDescription = React23.forwardRef(
|
|
2147
|
+
(props, forwardedRef) => {
|
|
2148
|
+
const { __scopeDialog, ...descriptionProps } = props;
|
|
2149
|
+
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
2150
|
+
return /* @__PURE__ */ jsx12(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
2151
|
+
}
|
|
2152
|
+
);
|
|
2153
|
+
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
2154
|
+
var CLOSE_NAME = "DialogClose";
|
|
2155
|
+
var DialogClose = React23.forwardRef(
|
|
2156
|
+
(props, forwardedRef) => {
|
|
2157
|
+
const { __scopeDialog, ...closeProps } = props;
|
|
2158
|
+
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
2159
|
+
return /* @__PURE__ */ jsx12(
|
|
2160
|
+
Primitive.button,
|
|
2161
|
+
{
|
|
2162
|
+
type: "button",
|
|
2163
|
+
...closeProps,
|
|
2164
|
+
ref: forwardedRef,
|
|
2165
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
2166
|
+
}
|
|
2167
|
+
);
|
|
2168
|
+
}
|
|
2169
|
+
);
|
|
2170
|
+
DialogClose.displayName = CLOSE_NAME;
|
|
2171
|
+
function getState(open) {
|
|
2172
|
+
return open ? "open" : "closed";
|
|
2173
|
+
}
|
|
2174
|
+
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
2175
|
+
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
2176
|
+
contentName: CONTENT_NAME,
|
|
2177
|
+
titleName: TITLE_NAME,
|
|
2178
|
+
docsSlug: "dialog"
|
|
2179
|
+
});
|
|
2180
|
+
var TitleWarning = ({ titleId }) => {
|
|
2181
|
+
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
2182
|
+
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
2183
|
+
|
|
2184
|
+
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
2185
|
+
|
|
2186
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
2187
|
+
React23.useEffect(() => {
|
|
2188
|
+
if (titleId) {
|
|
2189
|
+
const hasTitle = document.getElementById(titleId);
|
|
2190
|
+
if (!hasTitle) console.error(MESSAGE);
|
|
2191
|
+
}
|
|
2192
|
+
}, [MESSAGE, titleId]);
|
|
2193
|
+
return null;
|
|
2194
|
+
};
|
|
2195
|
+
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
2196
|
+
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
2197
|
+
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
2198
|
+
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
2199
|
+
React23.useEffect(() => {
|
|
2200
|
+
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
2201
|
+
if (descriptionId && describedById) {
|
|
2202
|
+
const hasDescription = document.getElementById(descriptionId);
|
|
2203
|
+
if (!hasDescription) console.warn(MESSAGE);
|
|
2204
|
+
}
|
|
2205
|
+
}, [MESSAGE, contentRef, descriptionId]);
|
|
2206
|
+
return null;
|
|
2207
|
+
};
|
|
2208
|
+
var Root = Dialog;
|
|
2209
|
+
var Portal2 = DialogPortal;
|
|
2210
|
+
var Overlay = DialogOverlay;
|
|
2211
|
+
var Content = DialogContent;
|
|
2212
|
+
|
|
2213
|
+
// ../../node_modules/cmdk/dist/index.mjs
|
|
2214
|
+
import * as t from "react";
|
|
2215
|
+
var N = '[cmdk-group=""]';
|
|
2216
|
+
var Y2 = '[cmdk-group-items=""]';
|
|
2217
|
+
var be = '[cmdk-group-heading=""]';
|
|
2218
|
+
var le = '[cmdk-item=""]';
|
|
2219
|
+
var ce = `${le}:not([aria-disabled="true"])`;
|
|
2220
|
+
var Z = "cmdk-item-select";
|
|
2221
|
+
var T = "data-value";
|
|
2222
|
+
var Re = (r, o, n) => W(r, o, n);
|
|
2223
|
+
var ue = t.createContext(void 0);
|
|
2224
|
+
var K2 = () => t.useContext(ue);
|
|
2225
|
+
var de = t.createContext(void 0);
|
|
2226
|
+
var ee = () => t.useContext(de);
|
|
2227
|
+
var fe = t.createContext(void 0);
|
|
2228
|
+
var me = t.forwardRef((r, o) => {
|
|
2229
|
+
let n = L(() => {
|
|
2230
|
+
var e, a;
|
|
2231
|
+
return { search: "", value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
|
|
2232
|
+
}), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId(), q = useId(), _ = useId(), I = t.useRef(null), v = ke();
|
|
2233
|
+
k2(() => {
|
|
2234
|
+
if (R !== void 0) {
|
|
2235
|
+
let e = R.trim();
|
|
2236
|
+
n.current.value = e, E.emit();
|
|
2237
|
+
}
|
|
2238
|
+
}, [R]), k2(() => {
|
|
2239
|
+
v(6, ne);
|
|
2240
|
+
}, []);
|
|
2241
|
+
let E = t.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => n.current, setState: (e, a, s) => {
|
|
2242
|
+
var i, l, g, y;
|
|
2243
|
+
if (!Object.is(n.current[e], a)) {
|
|
2244
|
+
if (n.current[e] = a, e === "search") J2(), z(), v(1, W2);
|
|
2245
|
+
else if (e === "value") {
|
|
2246
|
+
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
2247
|
+
let h = document.getElementById(_);
|
|
2248
|
+
h ? h.focus() : (i = document.getElementById($2)) == null || i.focus();
|
|
2249
|
+
}
|
|
2250
|
+
if (v(7, () => {
|
|
2251
|
+
var h;
|
|
2252
|
+
n.current.selectedItemId = (h = M()) == null ? void 0 : h.id, E.emit();
|
|
2253
|
+
}), s || v(5, ne), ((l = p2.current) == null ? void 0 : l.value) !== void 0) {
|
|
2254
|
+
let h = a != null ? a : "";
|
|
2255
|
+
(y = (g = p2.current).onValueChange) == null || y.call(g, h);
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
E.emit();
|
|
2260
|
+
}
|
|
2261
|
+
}, emit: () => {
|
|
2262
|
+
f.current.forEach((e) => e());
|
|
2263
|
+
} }), []), U2 = t.useMemo(() => ({ value: (e, a, s) => {
|
|
2264
|
+
var i;
|
|
2265
|
+
a !== ((i = d.current.get(e)) == null ? void 0 : i.value) && (d.current.set(e, { value: a, keywords: s }), n.current.filtered.items.set(e, te(a, s)), v(2, () => {
|
|
2266
|
+
z(), E.emit();
|
|
2267
|
+
}));
|
|
2268
|
+
}, item: (e, a) => (u2.current.add(e), a && (c.current.has(a) ? c.current.get(a).add(e) : c.current.set(a, /* @__PURE__ */ new Set([e]))), v(3, () => {
|
|
2269
|
+
J2(), z(), n.current.value || W2(), E.emit();
|
|
2270
|
+
}), () => {
|
|
2271
|
+
d.current.delete(e), u2.current.delete(e), n.current.filtered.items.delete(e);
|
|
2272
|
+
let s = M();
|
|
2273
|
+
v(4, () => {
|
|
2274
|
+
J2(), (s == null ? void 0 : s.getAttribute("id")) === e && W2(), E.emit();
|
|
2275
|
+
});
|
|
2276
|
+
}), group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => {
|
|
2277
|
+
d.current.delete(e), c.current.delete(e);
|
|
2278
|
+
}), filter: () => p2.current.shouldFilter, label: b || r["aria-label"], getDisablePointerSelection: () => p2.current.disablePointerSelection, listId: $2, inputId: _, labelId: q, listInnerRef: I }), []);
|
|
2279
|
+
function te(e, a) {
|
|
2280
|
+
var i, l;
|
|
2281
|
+
let s = (l = (i = p2.current) == null ? void 0 : i.filter) != null ? l : Re;
|
|
2282
|
+
return e ? s(e, n.current.search, a) : 0;
|
|
2283
|
+
}
|
|
2284
|
+
function z() {
|
|
2285
|
+
if (!n.current.search || p2.current.shouldFilter === false) return;
|
|
2286
|
+
let e = n.current.filtered.items, a = [];
|
|
2287
|
+
n.current.filtered.groups.forEach((i) => {
|
|
2288
|
+
let l = c.current.get(i), g = 0;
|
|
2289
|
+
l.forEach((y) => {
|
|
2290
|
+
let h = e.get(y);
|
|
2291
|
+
g = Math.max(h, g);
|
|
2292
|
+
}), a.push([i, g]);
|
|
2293
|
+
});
|
|
2294
|
+
let s = I.current;
|
|
2295
|
+
V().sort((i, l) => {
|
|
2296
|
+
var h, F;
|
|
2297
|
+
let g = i.getAttribute("id"), y = l.getAttribute("id");
|
|
2298
|
+
return ((h = e.get(y)) != null ? h : 0) - ((F = e.get(g)) != null ? F : 0);
|
|
2299
|
+
}).forEach((i) => {
|
|
2300
|
+
let l = i.closest(Y2);
|
|
2301
|
+
l ? l.appendChild(i.parentElement === l ? i : i.closest(`${Y2} > *`)) : s.appendChild(i.parentElement === s ? i : i.closest(`${Y2} > *`));
|
|
2302
|
+
}), a.sort((i, l) => l[1] - i[1]).forEach((i) => {
|
|
2303
|
+
var g;
|
|
2304
|
+
let l = (g = I.current) == null ? void 0 : g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);
|
|
2305
|
+
l == null || l.parentElement.appendChild(l);
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
function W2() {
|
|
2309
|
+
let e = V().find((s) => s.getAttribute("aria-disabled") !== "true"), a = e == null ? void 0 : e.getAttribute(T);
|
|
2310
|
+
E.setState("value", a || void 0);
|
|
2311
|
+
}
|
|
2312
|
+
function J2() {
|
|
2313
|
+
var a, s, i, l;
|
|
2314
|
+
if (!n.current.search || p2.current.shouldFilter === false) {
|
|
2315
|
+
n.current.filtered.count = u2.current.size;
|
|
2316
|
+
return;
|
|
2317
|
+
}
|
|
2318
|
+
n.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
2319
|
+
let e = 0;
|
|
2320
|
+
for (let g of u2.current) {
|
|
2321
|
+
let y = (s = (a = d.current.get(g)) == null ? void 0 : a.value) != null ? s : "", h = (l = (i = d.current.get(g)) == null ? void 0 : i.keywords) != null ? l : [], F = te(y, h);
|
|
2322
|
+
n.current.filtered.items.set(g, F), F > 0 && e++;
|
|
2323
|
+
}
|
|
2324
|
+
for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) {
|
|
2325
|
+
n.current.filtered.groups.add(g);
|
|
2326
|
+
break;
|
|
2327
|
+
}
|
|
2328
|
+
n.current.filtered.count = e;
|
|
2329
|
+
}
|
|
2330
|
+
function ne() {
|
|
2331
|
+
var a, s, i;
|
|
2332
|
+
let e = M();
|
|
2333
|
+
e && (((a = e.parentElement) == null ? void 0 : a.firstChild) === e && ((i = (s = e.closest(N)) == null ? void 0 : s.querySelector(be)) == null || i.scrollIntoView({ block: "nearest" })), e.scrollIntoView({ block: "nearest" }));
|
|
2334
|
+
}
|
|
2335
|
+
function M() {
|
|
2336
|
+
var e;
|
|
2337
|
+
return (e = I.current) == null ? void 0 : e.querySelector(`${le}[aria-selected="true"]`);
|
|
2338
|
+
}
|
|
2339
|
+
function V() {
|
|
2340
|
+
var e;
|
|
2341
|
+
return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []);
|
|
2342
|
+
}
|
|
2343
|
+
function X2(e) {
|
|
2344
|
+
let s = V()[e];
|
|
2345
|
+
s && E.setState("value", s.getAttribute(T));
|
|
2346
|
+
}
|
|
2347
|
+
function Q(e) {
|
|
2348
|
+
var g;
|
|
2349
|
+
let a = M(), s = V(), i = s.findIndex((y) => y === a), l = s[i + e];
|
|
2350
|
+
(g = p2.current) != null && g.loop && (l = i + e < 0 ? s[s.length - 1] : i + e === s.length ? s[0] : s[i + e]), l && E.setState("value", l.getAttribute(T));
|
|
2351
|
+
}
|
|
2352
|
+
function re(e) {
|
|
2353
|
+
let a = M(), s = a == null ? void 0 : a.closest(N), i;
|
|
2354
|
+
for (; s && !i; ) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
|
|
2355
|
+
i ? E.setState("value", i.getAttribute(T)) : Q(e);
|
|
2356
|
+
}
|
|
2357
|
+
let oe = () => X2(V().length - 1), ie = (e) => {
|
|
2358
|
+
e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1);
|
|
2359
|
+
}, se = (e) => {
|
|
2360
|
+
e.preventDefault(), e.metaKey ? X2(0) : e.altKey ? re(-1) : Q(-1);
|
|
2361
|
+
};
|
|
2362
|
+
return t.createElement(Primitive.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
|
|
2363
|
+
var s;
|
|
2364
|
+
(s = O.onKeyDown) == null || s.call(O, e);
|
|
2365
|
+
let a = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
2366
|
+
if (!(e.defaultPrevented || a)) switch (e.key) {
|
|
2367
|
+
case "n":
|
|
2368
|
+
case "j": {
|
|
2369
|
+
j && e.ctrlKey && ie(e);
|
|
2370
|
+
break;
|
|
2371
|
+
}
|
|
2372
|
+
case "ArrowDown": {
|
|
2373
|
+
ie(e);
|
|
2374
|
+
break;
|
|
2375
|
+
}
|
|
2376
|
+
case "p":
|
|
2377
|
+
case "k": {
|
|
2378
|
+
j && e.ctrlKey && se(e);
|
|
2379
|
+
break;
|
|
2380
|
+
}
|
|
2381
|
+
case "ArrowUp": {
|
|
2382
|
+
se(e);
|
|
2383
|
+
break;
|
|
2384
|
+
}
|
|
2385
|
+
case "Home": {
|
|
2386
|
+
e.preventDefault(), X2(0);
|
|
2387
|
+
break;
|
|
2388
|
+
}
|
|
2389
|
+
case "End": {
|
|
2390
|
+
e.preventDefault(), oe();
|
|
2391
|
+
break;
|
|
2392
|
+
}
|
|
2393
|
+
case "Enter": {
|
|
2394
|
+
e.preventDefault();
|
|
2395
|
+
let i = M();
|
|
2396
|
+
if (i) {
|
|
2397
|
+
let l = new Event(Z);
|
|
2398
|
+
i.dispatchEvent(l);
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
} }, t.createElement("label", { "cmdk-label": "", htmlFor: U2.inputId, id: U2.labelId, style: Te }, b), B2(r, (e) => t.createElement(de.Provider, { value: E }, t.createElement(ue.Provider, { value: U2 }, e))));
|
|
2403
|
+
});
|
|
2404
|
+
var he = t.forwardRef((r, o) => {
|
|
2405
|
+
var _, I;
|
|
2406
|
+
let n = useId(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
|
|
2407
|
+
k2(() => {
|
|
2408
|
+
if (!p2) return d.item(n, c == null ? void 0 : c.id);
|
|
2409
|
+
}, [p2]);
|
|
2410
|
+
let b = ve(n, u2, [r.value, r.children, u2], r.keywords), m2 = ee(), R = P((v) => v.value && v.value === b.current), x = P((v) => p2 || d.filter() === false ? true : v.search ? v.filtered.items.get(n) > 0 : true);
|
|
2411
|
+
t.useEffect(() => {
|
|
2412
|
+
let v = u2.current;
|
|
2413
|
+
if (!(!v || r.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
|
|
2414
|
+
}, [x, r.onSelect, r.disabled]);
|
|
2415
|
+
function C() {
|
|
2416
|
+
var v, E;
|
|
2417
|
+
S(), (E = (v = f.current).onSelect) == null || E.call(v, b.current);
|
|
2418
|
+
}
|
|
2419
|
+
function S() {
|
|
2420
|
+
m2.setState("value", b.current, true);
|
|
2421
|
+
}
|
|
2422
|
+
if (!x) return null;
|
|
2423
|
+
let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r;
|
|
2424
|
+
return t.createElement(Primitive.div, { ref: composeRefs(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r.children);
|
|
2425
|
+
});
|
|
2426
|
+
var Ee = t.forwardRef((r, o) => {
|
|
2427
|
+
let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
|
|
2428
|
+
k2(() => R.group(f), []), ve(f, p2, [r.value, r.heading, b]);
|
|
2429
|
+
let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]);
|
|
2430
|
+
return t.createElement(Primitive.div, { ref: composeRefs(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
|
|
2431
|
+
});
|
|
2432
|
+
var ye = t.forwardRef((r, o) => {
|
|
2433
|
+
let { alwaysRender: n, ...u2 } = r, c = t.useRef(null), d = P((f) => !f.search);
|
|
2434
|
+
return !n && !d ? null : t.createElement(Primitive.div, { ref: composeRefs(c, o), ...u2, "cmdk-separator": "", role: "separator" });
|
|
2435
|
+
});
|
|
2436
|
+
var Se = t.forwardRef((r, o) => {
|
|
2437
|
+
let { onValueChange: n, ...u2 } = r, c = r.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2();
|
|
2438
|
+
return t.useEffect(() => {
|
|
2439
|
+
r.value != null && d.setState("search", r.value);
|
|
2440
|
+
}, [r.value]), t.createElement(Primitive.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r.value : f, onChange: (m2) => {
|
|
2441
|
+
c || d.setState("search", m2.target.value), n == null || n(m2.target.value);
|
|
2442
|
+
} });
|
|
2443
|
+
});
|
|
2444
|
+
var Ce = t.forwardRef((r, o) => {
|
|
2445
|
+
let { children: n, label: u2 = "Suggestions", ...c } = r, d = t.useRef(null), f = t.useRef(null), p2 = P((m2) => m2.selectedItemId), b = K2();
|
|
2446
|
+
return t.useEffect(() => {
|
|
2447
|
+
if (f.current && d.current) {
|
|
2448
|
+
let m2 = f.current, R = d.current, x, C = new ResizeObserver(() => {
|
|
2449
|
+
x = requestAnimationFrame(() => {
|
|
2450
|
+
let S = m2.offsetHeight;
|
|
2451
|
+
R.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
|
|
2452
|
+
});
|
|
2453
|
+
});
|
|
2454
|
+
return C.observe(m2), () => {
|
|
2455
|
+
cancelAnimationFrame(x), C.unobserve(m2);
|
|
2456
|
+
};
|
|
2457
|
+
}
|
|
2458
|
+
}, []), t.createElement(Primitive.div, { ref: composeRefs(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t.createElement("div", { ref: composeRefs(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
|
|
2459
|
+
});
|
|
2460
|
+
var xe = t.forwardRef((r, o) => {
|
|
2461
|
+
let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r;
|
|
2462
|
+
return t.createElement(Root, { open: n, onOpenChange: u2 }, t.createElement(Portal2, { container: f }, t.createElement(Overlay, { "cmdk-overlay": "", className: c }), t.createElement(Content, { "aria-label": r.label, "cmdk-dialog": "", className: d }, t.createElement(me, { ref: o, ...p2 }))));
|
|
2463
|
+
});
|
|
2464
|
+
var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
|
|
2465
|
+
var Pe = t.forwardRef((r, o) => {
|
|
2466
|
+
let { progress: n, children: u2, label: c = "Loading...", ...d } = r;
|
|
2467
|
+
return t.createElement(Primitive.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t.createElement("div", { "aria-hidden": true }, f)));
|
|
2468
|
+
});
|
|
2469
|
+
var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe });
|
|
2470
|
+
function we(r, o) {
|
|
2471
|
+
let n = r.nextElementSibling;
|
|
2472
|
+
for (; n; ) {
|
|
2473
|
+
if (n.matches(o)) return n;
|
|
2474
|
+
n = n.nextElementSibling;
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
function De(r, o) {
|
|
2478
|
+
let n = r.previousElementSibling;
|
|
2479
|
+
for (; n; ) {
|
|
2480
|
+
if (n.matches(o)) return n;
|
|
2481
|
+
n = n.previousElementSibling;
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function pe(r) {
|
|
2485
|
+
let o = t.useRef(r);
|
|
2486
|
+
return k2(() => {
|
|
2487
|
+
o.current = r;
|
|
2488
|
+
}), o;
|
|
2489
|
+
}
|
|
2490
|
+
var k2 = typeof window == "undefined" ? t.useEffect : t.useLayoutEffect;
|
|
2491
|
+
function L(r) {
|
|
2492
|
+
let o = t.useRef();
|
|
2493
|
+
return o.current === void 0 && (o.current = r()), o;
|
|
2494
|
+
}
|
|
2495
|
+
function P(r) {
|
|
2496
|
+
let o = ee(), n = () => r(o.snapshot());
|
|
2497
|
+
return t.useSyncExternalStore(o.subscribe, n, n);
|
|
2498
|
+
}
|
|
2499
|
+
function ve(r, o, n, u2 = []) {
|
|
2500
|
+
let c = t.useRef(), d = K2();
|
|
2501
|
+
return k2(() => {
|
|
2502
|
+
var b;
|
|
2503
|
+
let f = (() => {
|
|
2504
|
+
var m2;
|
|
2505
|
+
for (let R of n) {
|
|
2506
|
+
if (typeof R == "string") return R.trim();
|
|
2507
|
+
if (typeof R == "object" && "current" in R) return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current;
|
|
2508
|
+
}
|
|
2509
|
+
})(), p2 = u2.map((m2) => m2.trim());
|
|
2510
|
+
d.value(r, f, p2), (b = o.current) == null || b.setAttribute(T, f), c.current = f;
|
|
2511
|
+
}), c;
|
|
2512
|
+
}
|
|
2513
|
+
var ke = () => {
|
|
2514
|
+
let [r, o] = t.useState(), n = L(() => /* @__PURE__ */ new Map());
|
|
2515
|
+
return k2(() => {
|
|
2516
|
+
n.current.forEach((u2) => u2()), n.current = /* @__PURE__ */ new Map();
|
|
2517
|
+
}, [r]), (u2, c) => {
|
|
2518
|
+
n.current.set(u2, c), o({});
|
|
2519
|
+
};
|
|
2520
|
+
};
|
|
2521
|
+
function Me(r) {
|
|
2522
|
+
let o = r.type;
|
|
2523
|
+
return typeof o == "function" ? o(r.props) : "render" in o ? o.render(r.props) : r;
|
|
2524
|
+
}
|
|
2525
|
+
function B2({ asChild: r, children: o }, n) {
|
|
2526
|
+
return r && t.isValidElement(o) ? t.cloneElement(Me(o), { ref: o.ref }, n(o.props.children)) : n(o);
|
|
2527
|
+
}
|
|
2528
|
+
var Te = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
|
|
2529
|
+
|
|
2530
|
+
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
2531
|
+
import { forwardRef as forwardRef11, createElement as createElement8 } from "react";
|
|
2532
|
+
|
|
2533
|
+
// ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
2534
|
+
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2535
|
+
var toCamelCase = (string) => string.replace(
|
|
2536
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
2537
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
2538
|
+
);
|
|
2539
|
+
var toPascalCase = (string) => {
|
|
2540
|
+
const camelCase = toCamelCase(string);
|
|
2541
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
2542
|
+
};
|
|
2543
|
+
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
2544
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
2545
|
+
}).join(" ").trim();
|
|
2546
|
+
|
|
2547
|
+
// ../../node_modules/lucide-react/dist/esm/Icon.js
|
|
2548
|
+
import { forwardRef as forwardRef10, createElement as createElement7 } from "react";
|
|
2549
|
+
|
|
2550
|
+
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
2551
|
+
var defaultAttributes = {
|
|
2552
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2553
|
+
width: 24,
|
|
2554
|
+
height: 24,
|
|
2555
|
+
viewBox: "0 0 24 24",
|
|
2556
|
+
fill: "none",
|
|
2557
|
+
stroke: "currentColor",
|
|
2558
|
+
strokeWidth: 2,
|
|
2559
|
+
strokeLinecap: "round",
|
|
2560
|
+
strokeLinejoin: "round"
|
|
2561
|
+
};
|
|
2562
|
+
|
|
2563
|
+
// ../../node_modules/lucide-react/dist/esm/Icon.js
|
|
2564
|
+
var Icon = forwardRef10(
|
|
2565
|
+
({
|
|
2566
|
+
color = "currentColor",
|
|
2567
|
+
size = 24,
|
|
2568
|
+
strokeWidth = 2,
|
|
2569
|
+
absoluteStrokeWidth,
|
|
2570
|
+
className = "",
|
|
2571
|
+
children,
|
|
2572
|
+
iconNode,
|
|
2573
|
+
...rest
|
|
2574
|
+
}, ref) => {
|
|
2575
|
+
return createElement7(
|
|
2576
|
+
"svg",
|
|
2577
|
+
{
|
|
2578
|
+
ref,
|
|
2579
|
+
...defaultAttributes,
|
|
2580
|
+
width: size,
|
|
2581
|
+
height: size,
|
|
2582
|
+
stroke: color,
|
|
2583
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
2584
|
+
className: mergeClasses("lucide", className),
|
|
2585
|
+
...rest
|
|
2586
|
+
},
|
|
2587
|
+
[
|
|
2588
|
+
...iconNode.map(([tag, attrs]) => createElement7(tag, attrs)),
|
|
2589
|
+
...Array.isArray(children) ? children : [children]
|
|
2590
|
+
]
|
|
2591
|
+
);
|
|
2592
|
+
}
|
|
2593
|
+
);
|
|
2594
|
+
|
|
2595
|
+
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
2596
|
+
var createLucideIcon = (iconName, iconNode) => {
|
|
2597
|
+
const Component = forwardRef11(
|
|
2598
|
+
({ className, ...props }, ref) => createElement8(Icon, {
|
|
2599
|
+
ref,
|
|
2600
|
+
iconNode,
|
|
2601
|
+
className: mergeClasses(
|
|
2602
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
2603
|
+
`lucide-${iconName}`,
|
|
2604
|
+
className
|
|
2605
|
+
),
|
|
2606
|
+
...props
|
|
2607
|
+
})
|
|
2608
|
+
);
|
|
2609
|
+
Component.displayName = toPascalCase(iconName);
|
|
2610
|
+
return Component;
|
|
2611
|
+
};
|
|
2612
|
+
|
|
2613
|
+
// ../../node_modules/lucide-react/dist/esm/icons/check.js
|
|
2614
|
+
var __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
2615
|
+
var Check = createLucideIcon("check", __iconNode);
|
|
2616
|
+
|
|
2617
|
+
// src/autocomplete.tsx
|
|
2618
|
+
import { useEffect as useEffect14, useState as useState12 } from "react";
|
|
2619
|
+
import {
|
|
2620
|
+
Command,
|
|
2621
|
+
CommandEmpty,
|
|
2622
|
+
CommandGroup,
|
|
2623
|
+
CommandItem,
|
|
2624
|
+
CommandList,
|
|
2625
|
+
Input,
|
|
2626
|
+
Popover,
|
|
2627
|
+
PopoverAnchor,
|
|
2628
|
+
PopoverContent
|
|
2629
|
+
} from "@c-rex/ui";
|
|
2630
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2631
|
+
var AutoComplete = ({
|
|
2632
|
+
initialValue,
|
|
2633
|
+
onSearch,
|
|
2634
|
+
onSelect
|
|
2635
|
+
}) => {
|
|
2636
|
+
const [query, setQuery] = useState12(initialValue);
|
|
2637
|
+
const [suggestions, setSuggestions] = useState12([]);
|
|
2638
|
+
const [open, setOpen] = useState12(false);
|
|
2639
|
+
useEffect14(() => {
|
|
2640
|
+
const debounceFetch = setTimeout(() => {
|
|
2641
|
+
if (query) {
|
|
2642
|
+
onSearch(query).then(setSuggestions);
|
|
2643
|
+
} else {
|
|
2644
|
+
setSuggestions([]);
|
|
2645
|
+
}
|
|
2646
|
+
}, 300);
|
|
2647
|
+
return () => clearTimeout(debounceFetch);
|
|
2648
|
+
}, [onSearch, query]);
|
|
2649
|
+
return /* @__PURE__ */ jsx13("div", { className: "flex items-center", children: /* @__PURE__ */ jsx13(Popover, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs4(Command, { shouldFilter: false, children: [
|
|
2650
|
+
/* @__PURE__ */ jsx13(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsx13(
|
|
2651
|
+
_e.Input,
|
|
2652
|
+
{
|
|
2653
|
+
asChild: true,
|
|
2654
|
+
value: query,
|
|
2655
|
+
onValueChange: setQuery,
|
|
2656
|
+
onKeyDown: (e) => setOpen(e.key !== "Escape"),
|
|
2657
|
+
onMouseDown: () => setOpen(false),
|
|
2658
|
+
onFocus: () => setOpen(true),
|
|
2659
|
+
children: /* @__PURE__ */ jsx13(Input, {})
|
|
2660
|
+
}
|
|
2661
|
+
) }),
|
|
2662
|
+
!open && /* @__PURE__ */ jsx13(CommandList, { "aria-hidden": "true", className: "hidden" }),
|
|
2663
|
+
/* @__PURE__ */ jsx13(
|
|
2664
|
+
PopoverContent,
|
|
2665
|
+
{
|
|
2666
|
+
asChild: true,
|
|
2667
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2668
|
+
onInteractOutside: (e) => {
|
|
2669
|
+
if (e.target instanceof Element && e.target.hasAttribute("cmdk-input")) {
|
|
2670
|
+
e.preventDefault();
|
|
2671
|
+
}
|
|
2672
|
+
},
|
|
2673
|
+
className: "w-[--radix-popover-trigger-width] p-0",
|
|
2674
|
+
children: /* @__PURE__ */ jsx13(CommandList, { children: suggestions.length > 0 ? /* @__PURE__ */ jsx13(CommandGroup, { children: suggestions.map((option) => /* @__PURE__ */ jsxs4(
|
|
2675
|
+
CommandItem,
|
|
2676
|
+
{
|
|
2677
|
+
value: option,
|
|
2678
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2679
|
+
onSelect: (inputValue) => {
|
|
2680
|
+
setOpen(false);
|
|
2681
|
+
onSelect(inputValue ?? "");
|
|
2682
|
+
},
|
|
2683
|
+
children: [
|
|
2684
|
+
/* @__PURE__ */ jsx13(Check, { className: "mr-2 h-4 w-4 opacity-0" }),
|
|
2685
|
+
option
|
|
2686
|
+
]
|
|
2687
|
+
},
|
|
2688
|
+
option
|
|
2689
|
+
)) }) : /* @__PURE__ */ jsx13(CommandEmpty, { children: "No suggestions." }) })
|
|
2690
|
+
}
|
|
2691
|
+
)
|
|
2692
|
+
] }) }) });
|
|
2693
|
+
};
|
|
2694
|
+
|
|
2695
|
+
// src/breadcrumb.tsx
|
|
2696
|
+
import {
|
|
2697
|
+
Breadcrumb as BreadcrumbComponent,
|
|
2698
|
+
BreadcrumbItem,
|
|
2699
|
+
BreadcrumbLink,
|
|
2700
|
+
BreadcrumbList,
|
|
2701
|
+
BreadcrumbPage,
|
|
2702
|
+
BreadcrumbSeparator,
|
|
2703
|
+
Skeleton
|
|
2704
|
+
} from "@c-rex/ui";
|
|
2705
|
+
import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2706
|
+
var Breadcrumb = ({ items, loading }) => {
|
|
2707
|
+
if (!items) {
|
|
2708
|
+
return null;
|
|
2709
|
+
}
|
|
2710
|
+
if (loading) {
|
|
2711
|
+
return /* @__PURE__ */ jsx14(BreadcrumbComponent, { children: /* @__PURE__ */ jsxs5(BreadcrumbList, { children: [
|
|
2712
|
+
/* @__PURE__ */ jsx14(BreadcrumbItem, { children: /* @__PURE__ */ jsx14(BreadcrumbPage, { children: "Home" }) }),
|
|
2713
|
+
/* @__PURE__ */ jsx14(BreadcrumbSeparator, {}),
|
|
2714
|
+
/* @__PURE__ */ jsx14(BreadcrumbItem, { children: /* @__PURE__ */ jsx14(Skeleton, { className: "w-40 h-6" }) }),
|
|
2715
|
+
/* @__PURE__ */ jsx14(BreadcrumbSeparator, {}),
|
|
2716
|
+
/* @__PURE__ */ jsx14(BreadcrumbItem, { children: /* @__PURE__ */ jsx14(Skeleton, { className: "w-40 h-6" }) })
|
|
2717
|
+
] }) });
|
|
2718
|
+
}
|
|
2719
|
+
const homeItem = {
|
|
2720
|
+
link: "/",
|
|
2721
|
+
label: "Home",
|
|
2722
|
+
id: "home",
|
|
2723
|
+
active: false,
|
|
2724
|
+
children: []
|
|
2725
|
+
};
|
|
2726
|
+
const newItemList = [homeItem, ...items];
|
|
2727
|
+
const renderLink = (showLink, item) => {
|
|
2728
|
+
if (showLink) {
|
|
2729
|
+
return /* @__PURE__ */ jsx14(BreadcrumbLink, { href: item.link, children: item.label });
|
|
2730
|
+
}
|
|
2731
|
+
return /* @__PURE__ */ jsx14(BreadcrumbPage, { children: item.label });
|
|
2732
|
+
};
|
|
2733
|
+
return /* @__PURE__ */ jsx14(BreadcrumbComponent, { children: /* @__PURE__ */ jsx14(BreadcrumbList, { children: newItemList.map((item, index) => {
|
|
2734
|
+
const isLast = index === newItemList.length - 1;
|
|
2735
|
+
return /* @__PURE__ */ jsxs5(Fragment6, { children: [
|
|
2736
|
+
/* @__PURE__ */ jsx14(BreadcrumbItem, { children: renderLink(!isLast, item) }, `${item.label}-item`),
|
|
2737
|
+
!isLast && /* @__PURE__ */ jsx14(BreadcrumbSeparator, {}, `${item.label}-separator`)
|
|
2738
|
+
] });
|
|
2739
|
+
}) }) });
|
|
2740
|
+
};
|
|
2741
|
+
|
|
2742
|
+
// src/empty.tsx
|
|
2743
|
+
import { Alert, AlertDescription, AlertTitle } from "@c-rex/ui";
|
|
2744
|
+
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2745
|
+
var Empty = () => {
|
|
2746
|
+
return /* @__PURE__ */ jsxs6(Alert, { className: "my-2", children: [
|
|
2747
|
+
/* @__PURE__ */ jsx15(AlertTitle, { children: "No results" }),
|
|
2748
|
+
/* @__PURE__ */ jsx15(AlertDescription, { children: "No data available. Please try adjusting your search or filter criteria." })
|
|
2749
|
+
] });
|
|
2750
|
+
};
|
|
2751
|
+
|
|
2752
|
+
// src/navbar.tsx
|
|
2753
|
+
import Link2 from "next/link";
|
|
2754
|
+
import { Button } from "@c-rex/ui";
|
|
2755
|
+
import Image2 from "next/image";
|
|
2756
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2757
|
+
var NavBar = () => {
|
|
2758
|
+
return /* @__PURE__ */ jsx16("header", { className: "sticky top-0 z-40 flex w-full bg-background/60 backdrop-blur-xl transition-all bg-transparent border-b justify-center py-4", children: /* @__PURE__ */ jsxs7("div", { className: "container flex justify-between", children: [
|
|
2759
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex gap-6 md:gap-10", children: [
|
|
2760
|
+
/* @__PURE__ */ jsx16(Link2, { href: "/", className: "flex items-center space-x-1.5", children: /* @__PURE__ */ jsx16(
|
|
2761
|
+
Image2,
|
|
2762
|
+
{
|
|
2763
|
+
src: "/img/logo.png",
|
|
2764
|
+
alt: "C-rex Logo",
|
|
2765
|
+
width: 88,
|
|
2766
|
+
height: 50
|
|
2767
|
+
}
|
|
2768
|
+
) }),
|
|
2769
|
+
/* @__PURE__ */ jsxs7("nav", { className: "hidden gap-6 md:flex", children: [
|
|
2770
|
+
/* @__PURE__ */ jsx16(
|
|
2771
|
+
Link2,
|
|
2772
|
+
{
|
|
2773
|
+
href: "/blog",
|
|
2774
|
+
prefetch: true,
|
|
2775
|
+
className: "flex items-center text-lg font-medium transition-colors hover:text-foreground/80 sm:text-sm",
|
|
2776
|
+
children: "Blog"
|
|
2777
|
+
}
|
|
2778
|
+
),
|
|
2779
|
+
/* @__PURE__ */ jsx16(
|
|
2780
|
+
Link2,
|
|
2781
|
+
{
|
|
2782
|
+
href: "#",
|
|
2783
|
+
prefetch: true,
|
|
2784
|
+
className: "flex items-center text-lg font-medium transition-colors hover:text-foreground/80 sm:text-sm",
|
|
2785
|
+
children: "Documentation"
|
|
2786
|
+
}
|
|
2787
|
+
)
|
|
2788
|
+
] })
|
|
2789
|
+
] }),
|
|
2790
|
+
/* @__PURE__ */ jsx16("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ jsx16(
|
|
2791
|
+
Button,
|
|
2792
|
+
{
|
|
2793
|
+
className: "hidden gap-2 px-5 md:flex",
|
|
2794
|
+
variant: "default",
|
|
2795
|
+
size: "sm",
|
|
2796
|
+
rounded: "full",
|
|
2797
|
+
children: /* @__PURE__ */ jsx16("span", { children: "Sign In" })
|
|
2798
|
+
}
|
|
2799
|
+
) })
|
|
2800
|
+
] }) });
|
|
2801
|
+
};
|
|
2802
|
+
|
|
2803
|
+
// src/result-list.tsx
|
|
2804
|
+
import { Fragment as Fragment7, jsx as jsx17 } from "react/jsx-runtime";
|
|
2805
|
+
var ViewComponent = table_default;
|
|
2806
|
+
var ResultList = ({ items }) => {
|
|
2807
|
+
return /* @__PURE__ */ jsx17(Fragment7, { children: items.length == 0 ? /* @__PURE__ */ jsx17(Empty, {}) : /* @__PURE__ */ jsx17(ViewComponent, { items }) });
|
|
2808
|
+
};
|
|
2809
|
+
|
|
2810
|
+
// src/sidebar.tsx
|
|
2811
|
+
import {
|
|
2812
|
+
Sidebar,
|
|
2813
|
+
SidebarContent,
|
|
2814
|
+
SidebarGroup,
|
|
2815
|
+
SidebarMenu,
|
|
2816
|
+
SidebarMenuButton,
|
|
2817
|
+
SidebarMenuItem,
|
|
2818
|
+
SidebarMenuSub,
|
|
2819
|
+
SidebarMenuSubButton,
|
|
2820
|
+
SidebarMenuSubItem,
|
|
2821
|
+
SidebarRail,
|
|
2822
|
+
Skeleton as Skeleton2
|
|
2823
|
+
} from "@c-rex/ui";
|
|
2824
|
+
import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2825
|
+
function AppSidebar({ data, loading, ...props }) {
|
|
2826
|
+
return /* @__PURE__ */ jsxs8(Sidebar, { collapsible: "icon", ...props, className: "top-20", children: [
|
|
2827
|
+
/* @__PURE__ */ jsx18(SidebarContent, { children: /* @__PURE__ */ jsx18(SidebarGroup, { children: /* @__PURE__ */ jsx18(SidebarMenu, { className: "pt-4", children: loading ? /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2828
|
+
/* @__PURE__ */ jsx18(Skeleton2, { className: "w-auto h-10 mb-2" }),
|
|
2829
|
+
/* @__PURE__ */ jsx18(Skeleton2, { className: "w-auto h-10 mb-2" }),
|
|
2830
|
+
/* @__PURE__ */ jsx18(Skeleton2, { className: "w-auto h-10 mb-2 ml-8" }),
|
|
2831
|
+
/* @__PURE__ */ jsx18(Skeleton2, { className: "w-auto h-10 mb-2 ml-8" }),
|
|
2832
|
+
/* @__PURE__ */ jsx18(Skeleton2, { className: "w-auto h-10 mb-2 ml-8" }),
|
|
2833
|
+
/* @__PURE__ */ jsx18(Skeleton2, { className: "w-auto h-10 mb-2 ml-8" }),
|
|
2834
|
+
/* @__PURE__ */ jsx18(Skeleton2, { className: "w-auto h-10 mb-2" })
|
|
2835
|
+
] }) : /* @__PURE__ */ jsx18(Fragment8, { children: data.map((item) => /* @__PURE__ */ jsxs8(SidebarMenuItem, { children: [
|
|
2836
|
+
/* @__PURE__ */ jsx18(SidebarMenuButton, { asChild: true, isActive: item.active, children: /* @__PURE__ */ jsx18("a", { href: item.link, title: item.label, children: item.label }) }),
|
|
2837
|
+
item.children?.length ? /* @__PURE__ */ jsx18(SidebarMenuSub, { children: item.children.map((item2) => /* @__PURE__ */ jsx18(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx18(
|
|
2838
|
+
SidebarMenuSubButton,
|
|
2839
|
+
{
|
|
2840
|
+
asChild: true,
|
|
2841
|
+
isActive: item2.active,
|
|
2842
|
+
children: /* @__PURE__ */ jsx18("a", { href: item2.link, title: item2.label, children: item2.label })
|
|
2843
|
+
}
|
|
2844
|
+
) }, item2.label)) }) : null
|
|
2845
|
+
] }, item.id)) }) }) }) }),
|
|
2846
|
+
/* @__PURE__ */ jsx18(SidebarRail, {})
|
|
2847
|
+
] });
|
|
2848
|
+
}
|
|
2849
|
+
export {
|
|
2850
|
+
AppSidebar,
|
|
2851
|
+
AutoComplete,
|
|
2852
|
+
BlogCard,
|
|
2853
|
+
BlurImage,
|
|
2854
|
+
Breadcrumb,
|
|
2855
|
+
Empty,
|
|
2856
|
+
NavBar,
|
|
2857
|
+
ResultList,
|
|
2858
|
+
SearchStateWrapper
|
|
2859
|
+
};
|
|
2860
|
+
/*! Bundled license information:
|
|
2861
|
+
|
|
2862
|
+
lucide-react/dist/esm/shared/src/utils.js:
|
|
2863
|
+
(**
|
|
2864
|
+
* @license lucide-react v0.486.0 - ISC
|
|
2865
|
+
*
|
|
2866
|
+
* This source code is licensed under the ISC license.
|
|
2867
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
2868
|
+
*)
|
|
2869
|
+
|
|
2870
|
+
lucide-react/dist/esm/defaultAttributes.js:
|
|
2871
|
+
(**
|
|
2872
|
+
* @license lucide-react v0.486.0 - ISC
|
|
2873
|
+
*
|
|
2874
|
+
* This source code is licensed under the ISC license.
|
|
2875
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
2876
|
+
*)
|
|
2877
|
+
|
|
2878
|
+
lucide-react/dist/esm/Icon.js:
|
|
2879
|
+
(**
|
|
2880
|
+
* @license lucide-react v0.486.0 - ISC
|
|
2881
|
+
*
|
|
2882
|
+
* This source code is licensed under the ISC license.
|
|
2883
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
2884
|
+
*)
|
|
2885
|
+
|
|
2886
|
+
lucide-react/dist/esm/createLucideIcon.js:
|
|
2887
|
+
(**
|
|
2888
|
+
* @license lucide-react v0.486.0 - ISC
|
|
2889
|
+
*
|
|
2890
|
+
* This source code is licensed under the ISC license.
|
|
2891
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
2892
|
+
*)
|
|
2893
|
+
|
|
2894
|
+
lucide-react/dist/esm/icons/check.js:
|
|
2895
|
+
(**
|
|
2896
|
+
* @license lucide-react v0.486.0 - ISC
|
|
2897
|
+
*
|
|
2898
|
+
* This source code is licensed under the ISC license.
|
|
2899
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
2900
|
+
*)
|
|
2901
|
+
|
|
2902
|
+
lucide-react/dist/esm/lucide-react.js:
|
|
2903
|
+
(**
|
|
2904
|
+
* @license lucide-react v0.486.0 - ISC
|
|
2905
|
+
*
|
|
2906
|
+
* This source code is licensed under the ISC license.
|
|
2907
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
2908
|
+
*)
|
|
2909
|
+
*/
|
|
2910
|
+
//# sourceMappingURL=index.mjs.map
|