@sproutsocial/seeds-react-peek-in 0.5.0 → 0.6.0
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/esm/index.js +239 -1520
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +85 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +253 -1533
- package/dist/index.js.map +1 -1
- package/dist/peek-in.css +36 -0
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
|
|
3
3
|
|
|
4
4
|
// src/PeekInStyled.tsx
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
5
|
+
import * as React8 from "react";
|
|
6
|
+
import Box3 from "@sproutsocial/seeds-react-box";
|
|
7
7
|
import Button2 from "@sproutsocial/seeds-react-button";
|
|
8
8
|
import Drawer2 from "@sproutsocial/seeds-react-drawer";
|
|
9
9
|
import Icon2 from "@sproutsocial/seeds-react-icon";
|
|
@@ -26,32 +26,24 @@ function usePeekInContext() {
|
|
|
26
26
|
|
|
27
27
|
// src/components/PeekInHeader.tsx
|
|
28
28
|
import "react";
|
|
29
|
-
import Box from "@sproutsocial/seeds-react-box";
|
|
30
29
|
import Button from "@sproutsocial/seeds-react-button";
|
|
31
30
|
import Text from "@sproutsocial/seeds-react-text";
|
|
32
31
|
import Icon from "@sproutsocial/seeds-react-icon";
|
|
33
32
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
34
33
|
var PeekInHeader = ({
|
|
35
34
|
title,
|
|
35
|
+
subtitle,
|
|
36
36
|
onBack,
|
|
37
37
|
children
|
|
38
38
|
}) => {
|
|
39
39
|
return /* @__PURE__ */ jsxs(
|
|
40
|
-
|
|
40
|
+
"div",
|
|
41
41
|
{
|
|
42
|
-
|
|
43
|
-
alignItems: "center",
|
|
44
|
-
justifyContent: "space-between",
|
|
45
|
-
py: 400,
|
|
46
|
-
px: 400,
|
|
47
|
-
borderBottom: "1px solid",
|
|
48
|
-
borderColor: "container.border.base",
|
|
49
|
-
flexShrink: 0,
|
|
50
|
-
width: "100%",
|
|
42
|
+
className: "seeds-peek-in-header",
|
|
51
43
|
"data-slot": "peek-in-header",
|
|
52
44
|
"data-qa-peek-in-header": true,
|
|
53
45
|
children: [
|
|
54
|
-
/* @__PURE__ */ jsxs(
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { className: "seeds-peek-in-titlegroup", children: [
|
|
55
47
|
onBack && /* @__PURE__ */ jsx(
|
|
56
48
|
Button,
|
|
57
49
|
{
|
|
@@ -62,9 +54,20 @@ var PeekInHeader = ({
|
|
|
62
54
|
children: /* @__PURE__ */ jsx(Icon, { name: "arrow-left-outline", size: "small" })
|
|
63
55
|
}
|
|
64
56
|
),
|
|
65
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ jsxs("div", { className: "seeds-peek-in-titlestack", children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Text.SubHeadline, { as: "h2", "data-qa-peek-in-title": true, children: title }),
|
|
59
|
+
subtitle && /* @__PURE__ */ jsx(
|
|
60
|
+
Text.SmallBodyCopy,
|
|
61
|
+
{
|
|
62
|
+
as: "div",
|
|
63
|
+
color: "text.body",
|
|
64
|
+
"data-qa-peek-in-subtitle": true,
|
|
65
|
+
children: subtitle
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] })
|
|
66
69
|
] }),
|
|
67
|
-
children && /* @__PURE__ */ jsx(
|
|
70
|
+
children && /* @__PURE__ */ jsx("div", { className: "seeds-peek-in-header-actions", children })
|
|
68
71
|
]
|
|
69
72
|
}
|
|
70
73
|
);
|
|
@@ -73,13 +76,13 @@ PeekInHeader.displayName = "PeekInHeader";
|
|
|
73
76
|
|
|
74
77
|
// src/components/PeekInContent.tsx
|
|
75
78
|
import "react";
|
|
76
|
-
import
|
|
79
|
+
import Box from "@sproutsocial/seeds-react-box";
|
|
77
80
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
78
81
|
var PeekInContent = ({
|
|
79
82
|
children
|
|
80
83
|
}) => {
|
|
81
84
|
return /* @__PURE__ */ jsx2(
|
|
82
|
-
|
|
85
|
+
Box,
|
|
83
86
|
{
|
|
84
87
|
flex: "1 1 auto",
|
|
85
88
|
overflow: "auto",
|
|
@@ -93,9 +96,50 @@ var PeekInContent = ({
|
|
|
93
96
|
};
|
|
94
97
|
PeekInContent.displayName = "PeekInContent";
|
|
95
98
|
|
|
96
|
-
// src/components/
|
|
99
|
+
// src/components/PeekInFooter.tsx
|
|
97
100
|
import * as React4 from "react";
|
|
98
|
-
import
|
|
101
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
102
|
+
var CloseOnClick = ({ children }) => {
|
|
103
|
+
const { onClose } = usePeekInContext();
|
|
104
|
+
if (!React4.isValidElement(children)) {
|
|
105
|
+
return /* @__PURE__ */ jsx3(Fragment, { children });
|
|
106
|
+
}
|
|
107
|
+
const child = children;
|
|
108
|
+
return React4.cloneElement(child, {
|
|
109
|
+
onClick: (e) => {
|
|
110
|
+
child.props.onClick?.(e);
|
|
111
|
+
if (!e.defaultPrevented) onClose();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
var PeekInFooter = (props) => {
|
|
116
|
+
const { primaryButton, cancelButton, leftAction } = props;
|
|
117
|
+
const closeOnPrimaryAction = props.closeOnPrimaryAction ?? true;
|
|
118
|
+
if (!primaryButton && !cancelButton && !leftAction) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ jsxs2(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: "seeds-peek-in-footer",
|
|
125
|
+
style: { marginBottom: "var(--bleed, 0px)" },
|
|
126
|
+
"data-slot": "peek-in-footer",
|
|
127
|
+
"data-qa-peek-in-footer": true,
|
|
128
|
+
children: [
|
|
129
|
+
leftAction ?? null,
|
|
130
|
+
/* @__PURE__ */ jsxs2("div", { className: "seeds-peek-in-footer-actions", children: [
|
|
131
|
+
cancelButton && /* @__PURE__ */ jsx3(CloseOnClick, { children: cancelButton }),
|
|
132
|
+
primaryButton && closeOnPrimaryAction ? /* @__PURE__ */ jsx3(CloseOnClick, { children: primaryButton }) : primaryButton ?? null
|
|
133
|
+
] })
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
PeekInFooter.displayName = "PeekInFooter";
|
|
139
|
+
|
|
140
|
+
// src/components/PeekInPanel.tsx
|
|
141
|
+
import * as React5 from "react";
|
|
142
|
+
import Box2 from "@sproutsocial/seeds-react-box";
|
|
99
143
|
import Drawer, { DrawerContext } from "@sproutsocial/seeds-react-drawer";
|
|
100
144
|
import { useIsMobile } from "@sproutsocial/seeds-react-hooks";
|
|
101
145
|
import { Panel, PanelProvider } from "@sproutsocial/seeds-react-panel";
|
|
@@ -110,7 +154,7 @@ var RAIL_DEFAULT_WIDTH = 360;
|
|
|
110
154
|
var RAIL_GAP = 4;
|
|
111
155
|
|
|
112
156
|
// src/components/PeekInPanel.tsx
|
|
113
|
-
import { jsx as
|
|
157
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
114
158
|
var PeekInPanel = ({
|
|
115
159
|
title,
|
|
116
160
|
children,
|
|
@@ -125,12 +169,12 @@ var PeekInPanel = ({
|
|
|
125
169
|
}) => {
|
|
126
170
|
const { panelOpen, setPanelOpen, panelId } = usePeekInContext();
|
|
127
171
|
const isMobile = useIsMobile();
|
|
128
|
-
const parentDrawer =
|
|
129
|
-
|
|
172
|
+
const parentDrawer = React5.useContext(DrawerContext);
|
|
173
|
+
React5.useEffect(() => {
|
|
130
174
|
if (isMobile) parentDrawer.setIsLocked(panelOpen);
|
|
131
175
|
}, [isMobile, panelOpen, parentDrawer]);
|
|
132
176
|
if (isMobile) {
|
|
133
|
-
return /* @__PURE__ */
|
|
177
|
+
return /* @__PURE__ */ jsxs3(
|
|
134
178
|
Drawer,
|
|
135
179
|
{
|
|
136
180
|
open: panelOpen,
|
|
@@ -146,9 +190,9 @@ var PeekInPanel = ({
|
|
|
146
190
|
actionsInHeader,
|
|
147
191
|
"aria-label": title ?? "Panel",
|
|
148
192
|
children: [
|
|
149
|
-
!headerless && /* @__PURE__ */
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
|
|
193
|
+
!headerless && /* @__PURE__ */ jsx4(Drawer.Header, { title }),
|
|
194
|
+
/* @__PURE__ */ jsx4(Drawer.Content, { children: /* @__PURE__ */ jsx4(
|
|
195
|
+
Box2,
|
|
152
196
|
{
|
|
153
197
|
id: panelId,
|
|
154
198
|
role: "region",
|
|
@@ -162,7 +206,7 @@ var PeekInPanel = ({
|
|
|
162
206
|
}
|
|
163
207
|
);
|
|
164
208
|
}
|
|
165
|
-
return /* @__PURE__ */
|
|
209
|
+
return /* @__PURE__ */ jsx4(PanelProvider, { open: panelOpen, onOpenChange: setPanelOpen, children: /* @__PURE__ */ jsx4(
|
|
166
210
|
Panel,
|
|
167
211
|
{
|
|
168
212
|
closeButtonLabel: "Close",
|
|
@@ -173,8 +217,8 @@ var PeekInPanel = ({
|
|
|
173
217
|
title,
|
|
174
218
|
headerless,
|
|
175
219
|
"aria-label": title ?? "Panel",
|
|
176
|
-
children: /* @__PURE__ */
|
|
177
|
-
|
|
220
|
+
children: /* @__PURE__ */ jsx4(
|
|
221
|
+
Box2,
|
|
178
222
|
{
|
|
179
223
|
id: panelId,
|
|
180
224
|
role: "region",
|
|
@@ -193,1397 +237,23 @@ PeekInPanel.displayName = "PeekInPanel";
|
|
|
193
237
|
|
|
194
238
|
// src/components/PeekInTrigger.tsx
|
|
195
239
|
import "react";
|
|
196
|
-
|
|
197
|
-
// ../../node_modules/@radix-ui/react-dialog/dist/index.mjs
|
|
198
|
-
import * as React19 from "react";
|
|
199
|
-
|
|
200
|
-
// ../../node_modules/@radix-ui/primitive/dist/index.mjs
|
|
201
|
-
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
202
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
203
|
-
return function handleEvent(event) {
|
|
204
|
-
originalEventHandler?.(event);
|
|
205
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
206
|
-
return ourEventHandler?.(event);
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// ../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
212
|
-
import * as React5 from "react";
|
|
213
|
-
function setRef(ref, value) {
|
|
214
|
-
if (typeof ref === "function") {
|
|
215
|
-
return ref(value);
|
|
216
|
-
} else if (ref !== null && ref !== void 0) {
|
|
217
|
-
ref.current = value;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function composeRefs(...refs) {
|
|
221
|
-
return (node) => {
|
|
222
|
-
let hasCleanup = false;
|
|
223
|
-
const cleanups = refs.map((ref) => {
|
|
224
|
-
const cleanup = setRef(ref, node);
|
|
225
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
226
|
-
hasCleanup = true;
|
|
227
|
-
}
|
|
228
|
-
return cleanup;
|
|
229
|
-
});
|
|
230
|
-
if (hasCleanup) {
|
|
231
|
-
return () => {
|
|
232
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
233
|
-
const cleanup = cleanups[i];
|
|
234
|
-
if (typeof cleanup == "function") {
|
|
235
|
-
cleanup();
|
|
236
|
-
} else {
|
|
237
|
-
setRef(refs[i], null);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
function useComposedRefs(...refs) {
|
|
245
|
-
return React5.useCallback(composeRefs(...refs), refs);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// ../../node_modules/@radix-ui/react-context/dist/index.mjs
|
|
249
|
-
import * as React6 from "react";
|
|
250
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
251
|
-
function createContext22(rootComponentName, defaultContext) {
|
|
252
|
-
const Context = React6.createContext(defaultContext);
|
|
253
|
-
const Provider = (props) => {
|
|
254
|
-
const { children, ...context } = props;
|
|
255
|
-
const value = React6.useMemo(() => context, Object.values(context));
|
|
256
|
-
return /* @__PURE__ */ jsx4(Context.Provider, { value, children });
|
|
257
|
-
};
|
|
258
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
259
|
-
function useContext22(consumerName) {
|
|
260
|
-
const context = React6.useContext(Context);
|
|
261
|
-
if (context) return context;
|
|
262
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
263
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
264
|
-
}
|
|
265
|
-
return [Provider, useContext22];
|
|
266
|
-
}
|
|
267
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
268
|
-
let defaultContexts = [];
|
|
269
|
-
function createContext32(rootComponentName, defaultContext) {
|
|
270
|
-
const BaseContext = React6.createContext(defaultContext);
|
|
271
|
-
const index = defaultContexts.length;
|
|
272
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
273
|
-
const Provider = (props) => {
|
|
274
|
-
const { scope, children, ...context } = props;
|
|
275
|
-
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
276
|
-
const value = React6.useMemo(() => context, Object.values(context));
|
|
277
|
-
return /* @__PURE__ */ jsx4(Context.Provider, { value, children });
|
|
278
|
-
};
|
|
279
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
280
|
-
function useContext22(consumerName, scope) {
|
|
281
|
-
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
282
|
-
const context = React6.useContext(Context);
|
|
283
|
-
if (context) return context;
|
|
284
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
285
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
286
|
-
}
|
|
287
|
-
return [Provider, useContext22];
|
|
288
|
-
}
|
|
289
|
-
const createScope = () => {
|
|
290
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
291
|
-
return React6.createContext(defaultContext);
|
|
292
|
-
});
|
|
293
|
-
return function useScope(scope) {
|
|
294
|
-
const contexts = scope?.[scopeName] || scopeContexts;
|
|
295
|
-
return React6.useMemo(
|
|
296
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
297
|
-
[scope, contexts]
|
|
298
|
-
);
|
|
299
|
-
};
|
|
300
|
-
};
|
|
301
|
-
createScope.scopeName = scopeName;
|
|
302
|
-
return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
303
|
-
}
|
|
304
|
-
function composeContextScopes(...scopes) {
|
|
305
|
-
const baseScope = scopes[0];
|
|
306
|
-
if (scopes.length === 1) return baseScope;
|
|
307
|
-
const createScope = () => {
|
|
308
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
309
|
-
useScope: createScope2(),
|
|
310
|
-
scopeName: createScope2.scopeName
|
|
311
|
-
}));
|
|
312
|
-
return function useComposedScopes(overrideScopes) {
|
|
313
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
314
|
-
const scopeProps = useScope(overrideScopes);
|
|
315
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
316
|
-
return { ...nextScopes2, ...currentScope };
|
|
317
|
-
}, {});
|
|
318
|
-
return React6.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
319
|
-
};
|
|
320
|
-
};
|
|
321
|
-
createScope.scopeName = baseScope.scopeName;
|
|
322
|
-
return createScope;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// ../../node_modules/@radix-ui/react-id/dist/index.mjs
|
|
326
|
-
import * as React8 from "react";
|
|
327
|
-
|
|
328
|
-
// ../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
329
|
-
import * as React7 from "react";
|
|
330
|
-
var useLayoutEffect2 = globalThis?.document ? React7.useLayoutEffect : () => {
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
// ../../node_modules/@radix-ui/react-id/dist/index.mjs
|
|
334
|
-
var useReactId = React8[" useId ".trim().toString()] || (() => void 0);
|
|
335
|
-
var count = 0;
|
|
336
|
-
function useId(deterministicId) {
|
|
337
|
-
const [id, setId] = React8.useState(useReactId());
|
|
338
|
-
useLayoutEffect2(() => {
|
|
339
|
-
if (!deterministicId) setId((reactId) => reactId ?? String(count++));
|
|
340
|
-
}, [deterministicId]);
|
|
341
|
-
return deterministicId || (id ? `radix-${id}` : "");
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// ../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
345
|
-
import * as React9 from "react";
|
|
346
|
-
import * as React22 from "react";
|
|
347
|
-
var useInsertionEffect = React9[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
348
|
-
function useControllableState({
|
|
349
|
-
prop,
|
|
350
|
-
defaultProp,
|
|
351
|
-
onChange = () => {
|
|
352
|
-
},
|
|
353
|
-
caller
|
|
354
|
-
}) {
|
|
355
|
-
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
356
|
-
defaultProp,
|
|
357
|
-
onChange
|
|
358
|
-
});
|
|
359
|
-
const isControlled = prop !== void 0;
|
|
360
|
-
const value = isControlled ? prop : uncontrolledProp;
|
|
361
|
-
if (true) {
|
|
362
|
-
const isControlledRef = React9.useRef(prop !== void 0);
|
|
363
|
-
React9.useEffect(() => {
|
|
364
|
-
const wasControlled = isControlledRef.current;
|
|
365
|
-
if (wasControlled !== isControlled) {
|
|
366
|
-
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
367
|
-
const to = isControlled ? "controlled" : "uncontrolled";
|
|
368
|
-
console.warn(
|
|
369
|
-
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
isControlledRef.current = isControlled;
|
|
373
|
-
}, [isControlled, caller]);
|
|
374
|
-
}
|
|
375
|
-
const setValue = React9.useCallback(
|
|
376
|
-
(nextValue) => {
|
|
377
|
-
if (isControlled) {
|
|
378
|
-
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
379
|
-
if (value2 !== prop) {
|
|
380
|
-
onChangeRef.current?.(value2);
|
|
381
|
-
}
|
|
382
|
-
} else {
|
|
383
|
-
setUncontrolledProp(nextValue);
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
387
|
-
);
|
|
388
|
-
return [value, setValue];
|
|
389
|
-
}
|
|
390
|
-
function useUncontrolledState({
|
|
391
|
-
defaultProp,
|
|
392
|
-
onChange
|
|
393
|
-
}) {
|
|
394
|
-
const [value, setValue] = React9.useState(defaultProp);
|
|
395
|
-
const prevValueRef = React9.useRef(value);
|
|
396
|
-
const onChangeRef = React9.useRef(onChange);
|
|
397
|
-
useInsertionEffect(() => {
|
|
398
|
-
onChangeRef.current = onChange;
|
|
399
|
-
}, [onChange]);
|
|
400
|
-
React9.useEffect(() => {
|
|
401
|
-
if (prevValueRef.current !== value) {
|
|
402
|
-
onChangeRef.current?.(value);
|
|
403
|
-
prevValueRef.current = value;
|
|
404
|
-
}
|
|
405
|
-
}, [value, prevValueRef]);
|
|
406
|
-
return [value, setValue, onChangeRef];
|
|
407
|
-
}
|
|
408
|
-
function isFunction(value) {
|
|
409
|
-
return typeof value === "function";
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// ../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
413
|
-
import * as React14 from "react";
|
|
414
|
-
|
|
415
|
-
// ../../node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
416
|
-
import * as React11 from "react";
|
|
417
|
-
import * as ReactDOM from "react-dom";
|
|
418
|
-
|
|
419
|
-
// ../../node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
420
|
-
import * as React10 from "react";
|
|
421
240
|
import { Fragment as Fragment2, jsx as jsx5 } from "react/jsx-runtime";
|
|
422
|
-
// @__NO_SIDE_EFFECTS__
|
|
423
|
-
function createSlot(ownerName) {
|
|
424
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
425
|
-
const Slot2 = React10.forwardRef((props, forwardedRef) => {
|
|
426
|
-
const { children, ...slotProps } = props;
|
|
427
|
-
const childrenArray = React10.Children.toArray(children);
|
|
428
|
-
const slottable = childrenArray.find(isSlottable);
|
|
429
|
-
if (slottable) {
|
|
430
|
-
const newElement = slottable.props.children;
|
|
431
|
-
const newChildren = childrenArray.map((child) => {
|
|
432
|
-
if (child === slottable) {
|
|
433
|
-
if (React10.Children.count(newElement) > 1) return React10.Children.only(null);
|
|
434
|
-
return React10.isValidElement(newElement) ? newElement.props.children : null;
|
|
435
|
-
} else {
|
|
436
|
-
return child;
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
return /* @__PURE__ */ jsx5(SlotClone, { ...slotProps, ref: forwardedRef, children: React10.isValidElement(newElement) ? React10.cloneElement(newElement, void 0, newChildren) : null });
|
|
440
|
-
}
|
|
441
|
-
return /* @__PURE__ */ jsx5(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
442
|
-
});
|
|
443
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
444
|
-
return Slot2;
|
|
445
|
-
}
|
|
446
|
-
// @__NO_SIDE_EFFECTS__
|
|
447
|
-
function createSlotClone(ownerName) {
|
|
448
|
-
const SlotClone = React10.forwardRef((props, forwardedRef) => {
|
|
449
|
-
const { children, ...slotProps } = props;
|
|
450
|
-
if (React10.isValidElement(children)) {
|
|
451
|
-
const childrenRef = getElementRef(children);
|
|
452
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
453
|
-
if (children.type !== React10.Fragment) {
|
|
454
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
455
|
-
}
|
|
456
|
-
return React10.cloneElement(children, props2);
|
|
457
|
-
}
|
|
458
|
-
return React10.Children.count(children) > 1 ? React10.Children.only(null) : null;
|
|
459
|
-
});
|
|
460
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
461
|
-
return SlotClone;
|
|
462
|
-
}
|
|
463
|
-
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
464
|
-
function isSlottable(child) {
|
|
465
|
-
return React10.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
466
|
-
}
|
|
467
|
-
function mergeProps(slotProps, childProps) {
|
|
468
|
-
const overrideProps = { ...childProps };
|
|
469
|
-
for (const propName in childProps) {
|
|
470
|
-
const slotPropValue = slotProps[propName];
|
|
471
|
-
const childPropValue = childProps[propName];
|
|
472
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
473
|
-
if (isHandler) {
|
|
474
|
-
if (slotPropValue && childPropValue) {
|
|
475
|
-
overrideProps[propName] = (...args) => {
|
|
476
|
-
const result = childPropValue(...args);
|
|
477
|
-
slotPropValue(...args);
|
|
478
|
-
return result;
|
|
479
|
-
};
|
|
480
|
-
} else if (slotPropValue) {
|
|
481
|
-
overrideProps[propName] = slotPropValue;
|
|
482
|
-
}
|
|
483
|
-
} else if (propName === "style") {
|
|
484
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
485
|
-
} else if (propName === "className") {
|
|
486
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
return { ...slotProps, ...overrideProps };
|
|
490
|
-
}
|
|
491
|
-
function getElementRef(element) {
|
|
492
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
493
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
494
|
-
if (mayWarn) {
|
|
495
|
-
return element.ref;
|
|
496
|
-
}
|
|
497
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
498
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
499
|
-
if (mayWarn) {
|
|
500
|
-
return element.props.ref;
|
|
501
|
-
}
|
|
502
|
-
return element.props.ref || element.ref;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// ../../node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
506
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
507
|
-
var NODES = [
|
|
508
|
-
"a",
|
|
509
|
-
"button",
|
|
510
|
-
"div",
|
|
511
|
-
"form",
|
|
512
|
-
"h2",
|
|
513
|
-
"h3",
|
|
514
|
-
"img",
|
|
515
|
-
"input",
|
|
516
|
-
"label",
|
|
517
|
-
"li",
|
|
518
|
-
"nav",
|
|
519
|
-
"ol",
|
|
520
|
-
"p",
|
|
521
|
-
"select",
|
|
522
|
-
"span",
|
|
523
|
-
"svg",
|
|
524
|
-
"ul"
|
|
525
|
-
];
|
|
526
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
527
|
-
const Slot2 = createSlot(`Primitive.${node}`);
|
|
528
|
-
const Node = React11.forwardRef((props, forwardedRef) => {
|
|
529
|
-
const { asChild, ...primitiveProps } = props;
|
|
530
|
-
const Comp = asChild ? Slot2 : node;
|
|
531
|
-
if (typeof window !== "undefined") {
|
|
532
|
-
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
533
|
-
}
|
|
534
|
-
return /* @__PURE__ */ jsx6(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
535
|
-
});
|
|
536
|
-
Node.displayName = `Primitive.${node}`;
|
|
537
|
-
return { ...primitive, [node]: Node };
|
|
538
|
-
}, {});
|
|
539
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
540
|
-
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
// ../../node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
544
|
-
import * as React12 from "react";
|
|
545
|
-
function useCallbackRef(callback) {
|
|
546
|
-
const callbackRef = React12.useRef(callback);
|
|
547
|
-
React12.useEffect(() => {
|
|
548
|
-
callbackRef.current = callback;
|
|
549
|
-
});
|
|
550
|
-
return React12.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
// ../../node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
|
|
554
|
-
import * as React13 from "react";
|
|
555
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
556
|
-
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
557
|
-
React13.useEffect(() => {
|
|
558
|
-
const handleKeyDown = (event) => {
|
|
559
|
-
if (event.key === "Escape") {
|
|
560
|
-
onEscapeKeyDown(event);
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
564
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
565
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
// ../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
569
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
570
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
571
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
572
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
573
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
574
|
-
var originalBodyPointerEvents;
|
|
575
|
-
var DismissableLayerContext = React14.createContext({
|
|
576
|
-
layers: /* @__PURE__ */ new Set(),
|
|
577
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
578
|
-
branches: /* @__PURE__ */ new Set()
|
|
579
|
-
});
|
|
580
|
-
var DismissableLayer = React14.forwardRef(
|
|
581
|
-
(props, forwardedRef) => {
|
|
582
|
-
const {
|
|
583
|
-
disableOutsidePointerEvents = false,
|
|
584
|
-
onEscapeKeyDown,
|
|
585
|
-
onPointerDownOutside,
|
|
586
|
-
onFocusOutside,
|
|
587
|
-
onInteractOutside,
|
|
588
|
-
onDismiss,
|
|
589
|
-
...layerProps
|
|
590
|
-
} = props;
|
|
591
|
-
const context = React14.useContext(DismissableLayerContext);
|
|
592
|
-
const [node, setNode] = React14.useState(null);
|
|
593
|
-
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
594
|
-
const [, force] = React14.useState({});
|
|
595
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
596
|
-
const layers = Array.from(context.layers);
|
|
597
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
598
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
599
|
-
const index = node ? layers.indexOf(node) : -1;
|
|
600
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
601
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
602
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
603
|
-
const target = event.target;
|
|
604
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
605
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
606
|
-
onPointerDownOutside?.(event);
|
|
607
|
-
onInteractOutside?.(event);
|
|
608
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
609
|
-
}, ownerDocument);
|
|
610
|
-
const focusOutside = useFocusOutside((event) => {
|
|
611
|
-
const target = event.target;
|
|
612
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
613
|
-
if (isFocusInBranch) return;
|
|
614
|
-
onFocusOutside?.(event);
|
|
615
|
-
onInteractOutside?.(event);
|
|
616
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
617
|
-
}, ownerDocument);
|
|
618
|
-
useEscapeKeydown((event) => {
|
|
619
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
620
|
-
if (!isHighestLayer) return;
|
|
621
|
-
onEscapeKeyDown?.(event);
|
|
622
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
623
|
-
event.preventDefault();
|
|
624
|
-
onDismiss();
|
|
625
|
-
}
|
|
626
|
-
}, ownerDocument);
|
|
627
|
-
React14.useEffect(() => {
|
|
628
|
-
if (!node) return;
|
|
629
|
-
if (disableOutsidePointerEvents) {
|
|
630
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
631
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
632
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
633
|
-
}
|
|
634
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
635
|
-
}
|
|
636
|
-
context.layers.add(node);
|
|
637
|
-
dispatchUpdate();
|
|
638
|
-
return () => {
|
|
639
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
640
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
644
|
-
React14.useEffect(() => {
|
|
645
|
-
return () => {
|
|
646
|
-
if (!node) return;
|
|
647
|
-
context.layers.delete(node);
|
|
648
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
649
|
-
dispatchUpdate();
|
|
650
|
-
};
|
|
651
|
-
}, [node, context]);
|
|
652
|
-
React14.useEffect(() => {
|
|
653
|
-
const handleUpdate = () => force({});
|
|
654
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
655
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
656
|
-
}, []);
|
|
657
|
-
return /* @__PURE__ */ jsx7(
|
|
658
|
-
Primitive.div,
|
|
659
|
-
{
|
|
660
|
-
...layerProps,
|
|
661
|
-
ref: composedRefs,
|
|
662
|
-
style: {
|
|
663
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
664
|
-
...props.style
|
|
665
|
-
},
|
|
666
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
667
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
668
|
-
onPointerDownCapture: composeEventHandlers(
|
|
669
|
-
props.onPointerDownCapture,
|
|
670
|
-
pointerDownOutside.onPointerDownCapture
|
|
671
|
-
)
|
|
672
|
-
}
|
|
673
|
-
);
|
|
674
|
-
}
|
|
675
|
-
);
|
|
676
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
677
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
678
|
-
var DismissableLayerBranch = React14.forwardRef((props, forwardedRef) => {
|
|
679
|
-
const context = React14.useContext(DismissableLayerContext);
|
|
680
|
-
const ref = React14.useRef(null);
|
|
681
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
682
|
-
React14.useEffect(() => {
|
|
683
|
-
const node = ref.current;
|
|
684
|
-
if (node) {
|
|
685
|
-
context.branches.add(node);
|
|
686
|
-
return () => {
|
|
687
|
-
context.branches.delete(node);
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
}, [context.branches]);
|
|
691
|
-
return /* @__PURE__ */ jsx7(Primitive.div, { ...props, ref: composedRefs });
|
|
692
|
-
});
|
|
693
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
694
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
695
|
-
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
696
|
-
const isPointerInsideReactTreeRef = React14.useRef(false);
|
|
697
|
-
const handleClickRef = React14.useRef(() => {
|
|
698
|
-
});
|
|
699
|
-
React14.useEffect(() => {
|
|
700
|
-
const handlePointerDown = (event) => {
|
|
701
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
702
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
703
|
-
handleAndDispatchCustomEvent(
|
|
704
|
-
POINTER_DOWN_OUTSIDE,
|
|
705
|
-
handlePointerDownOutside,
|
|
706
|
-
eventDetail,
|
|
707
|
-
{ discrete: true }
|
|
708
|
-
);
|
|
709
|
-
};
|
|
710
|
-
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
711
|
-
const eventDetail = { originalEvent: event };
|
|
712
|
-
if (event.pointerType === "touch") {
|
|
713
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
714
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
715
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
716
|
-
} else {
|
|
717
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
718
|
-
}
|
|
719
|
-
} else {
|
|
720
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
721
|
-
}
|
|
722
|
-
isPointerInsideReactTreeRef.current = false;
|
|
723
|
-
};
|
|
724
|
-
const timerId = window.setTimeout(() => {
|
|
725
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
726
|
-
}, 0);
|
|
727
|
-
return () => {
|
|
728
|
-
window.clearTimeout(timerId);
|
|
729
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
730
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
731
|
-
};
|
|
732
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
733
|
-
return {
|
|
734
|
-
// ensures we check React component tree (not just DOM tree)
|
|
735
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
739
|
-
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
740
|
-
const isFocusInsideReactTreeRef = React14.useRef(false);
|
|
741
|
-
React14.useEffect(() => {
|
|
742
|
-
const handleFocus = (event) => {
|
|
743
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
744
|
-
const eventDetail = { originalEvent: event };
|
|
745
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
746
|
-
discrete: false
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
751
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
752
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
753
|
-
return {
|
|
754
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
755
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
function dispatchUpdate() {
|
|
759
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
760
|
-
document.dispatchEvent(event);
|
|
761
|
-
}
|
|
762
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
763
|
-
const target = detail.originalEvent.target;
|
|
764
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
765
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
766
|
-
if (discrete) {
|
|
767
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
768
|
-
} else {
|
|
769
|
-
target.dispatchEvent(event);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
// ../../node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
774
|
-
import * as React15 from "react";
|
|
775
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
776
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
777
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
778
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
779
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
780
|
-
var FocusScope = React15.forwardRef((props, forwardedRef) => {
|
|
781
|
-
const {
|
|
782
|
-
loop = false,
|
|
783
|
-
trapped = false,
|
|
784
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
785
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
786
|
-
...scopeProps
|
|
787
|
-
} = props;
|
|
788
|
-
const [container, setContainer] = React15.useState(null);
|
|
789
|
-
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
790
|
-
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
791
|
-
const lastFocusedElementRef = React15.useRef(null);
|
|
792
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
793
|
-
const focusScope = React15.useRef({
|
|
794
|
-
paused: false,
|
|
795
|
-
pause() {
|
|
796
|
-
this.paused = true;
|
|
797
|
-
},
|
|
798
|
-
resume() {
|
|
799
|
-
this.paused = false;
|
|
800
|
-
}
|
|
801
|
-
}).current;
|
|
802
|
-
React15.useEffect(() => {
|
|
803
|
-
if (trapped) {
|
|
804
|
-
let handleFocusIn2 = function(event) {
|
|
805
|
-
if (focusScope.paused || !container) return;
|
|
806
|
-
const target = event.target;
|
|
807
|
-
if (container.contains(target)) {
|
|
808
|
-
lastFocusedElementRef.current = target;
|
|
809
|
-
} else {
|
|
810
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
811
|
-
}
|
|
812
|
-
}, handleFocusOut2 = function(event) {
|
|
813
|
-
if (focusScope.paused || !container) return;
|
|
814
|
-
const relatedTarget = event.relatedTarget;
|
|
815
|
-
if (relatedTarget === null) return;
|
|
816
|
-
if (!container.contains(relatedTarget)) {
|
|
817
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
818
|
-
}
|
|
819
|
-
}, handleMutations2 = function(mutations) {
|
|
820
|
-
const focusedElement = document.activeElement;
|
|
821
|
-
if (focusedElement !== document.body) return;
|
|
822
|
-
for (const mutation of mutations) {
|
|
823
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
824
|
-
}
|
|
825
|
-
};
|
|
826
|
-
var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;
|
|
827
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
828
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
829
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
830
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
831
|
-
return () => {
|
|
832
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
833
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
834
|
-
mutationObserver.disconnect();
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
}, [trapped, container, focusScope.paused]);
|
|
838
|
-
React15.useEffect(() => {
|
|
839
|
-
if (container) {
|
|
840
|
-
focusScopesStack.add(focusScope);
|
|
841
|
-
const previouslyFocusedElement = document.activeElement;
|
|
842
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
843
|
-
if (!hasFocusedCandidate) {
|
|
844
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
845
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
846
|
-
container.dispatchEvent(mountEvent);
|
|
847
|
-
if (!mountEvent.defaultPrevented) {
|
|
848
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
849
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
850
|
-
focus(container);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
return () => {
|
|
855
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
856
|
-
setTimeout(() => {
|
|
857
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
858
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
859
|
-
container.dispatchEvent(unmountEvent);
|
|
860
|
-
if (!unmountEvent.defaultPrevented) {
|
|
861
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
862
|
-
}
|
|
863
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
864
|
-
focusScopesStack.remove(focusScope);
|
|
865
|
-
}, 0);
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
869
|
-
const handleKeyDown = React15.useCallback(
|
|
870
|
-
(event) => {
|
|
871
|
-
if (!loop && !trapped) return;
|
|
872
|
-
if (focusScope.paused) return;
|
|
873
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
874
|
-
const focusedElement = document.activeElement;
|
|
875
|
-
if (isTabKey && focusedElement) {
|
|
876
|
-
const container2 = event.currentTarget;
|
|
877
|
-
const [first, last] = getTabbableEdges(container2);
|
|
878
|
-
const hasTabbableElementsInside = first && last;
|
|
879
|
-
if (!hasTabbableElementsInside) {
|
|
880
|
-
if (focusedElement === container2) event.preventDefault();
|
|
881
|
-
} else {
|
|
882
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
883
|
-
event.preventDefault();
|
|
884
|
-
if (loop) focus(first, { select: true });
|
|
885
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
886
|
-
event.preventDefault();
|
|
887
|
-
if (loop) focus(last, { select: true });
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
},
|
|
892
|
-
[loop, trapped, focusScope.paused]
|
|
893
|
-
);
|
|
894
|
-
return /* @__PURE__ */ jsx8(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
895
|
-
});
|
|
896
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
897
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
898
|
-
const previouslyFocusedElement = document.activeElement;
|
|
899
|
-
for (const candidate of candidates) {
|
|
900
|
-
focus(candidate, { select });
|
|
901
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
function getTabbableEdges(container) {
|
|
905
|
-
const candidates = getTabbableCandidates(container);
|
|
906
|
-
const first = findVisible(candidates, container);
|
|
907
|
-
const last = findVisible(candidates.reverse(), container);
|
|
908
|
-
return [first, last];
|
|
909
|
-
}
|
|
910
|
-
function getTabbableCandidates(container) {
|
|
911
|
-
const nodes = [];
|
|
912
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
913
|
-
acceptNode: (node) => {
|
|
914
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
915
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
916
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
917
|
-
}
|
|
918
|
-
});
|
|
919
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
920
|
-
return nodes;
|
|
921
|
-
}
|
|
922
|
-
function findVisible(elements, container) {
|
|
923
|
-
for (const element of elements) {
|
|
924
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
function isHidden(node, { upTo }) {
|
|
928
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
929
|
-
while (node) {
|
|
930
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
931
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
932
|
-
node = node.parentElement;
|
|
933
|
-
}
|
|
934
|
-
return false;
|
|
935
|
-
}
|
|
936
|
-
function isSelectableInput(element) {
|
|
937
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
938
|
-
}
|
|
939
|
-
function focus(element, { select = false } = {}) {
|
|
940
|
-
if (element && element.focus) {
|
|
941
|
-
const previouslyFocusedElement = document.activeElement;
|
|
942
|
-
element.focus({ preventScroll: true });
|
|
943
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
944
|
-
element.select();
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
var focusScopesStack = createFocusScopesStack();
|
|
948
|
-
function createFocusScopesStack() {
|
|
949
|
-
let stack = [];
|
|
950
|
-
return {
|
|
951
|
-
add(focusScope) {
|
|
952
|
-
const activeFocusScope = stack[0];
|
|
953
|
-
if (focusScope !== activeFocusScope) {
|
|
954
|
-
activeFocusScope?.pause();
|
|
955
|
-
}
|
|
956
|
-
stack = arrayRemove(stack, focusScope);
|
|
957
|
-
stack.unshift(focusScope);
|
|
958
|
-
},
|
|
959
|
-
remove(focusScope) {
|
|
960
|
-
stack = arrayRemove(stack, focusScope);
|
|
961
|
-
stack[0]?.resume();
|
|
962
|
-
}
|
|
963
|
-
};
|
|
964
|
-
}
|
|
965
|
-
function arrayRemove(array, item) {
|
|
966
|
-
const updatedArray = [...array];
|
|
967
|
-
const index = updatedArray.indexOf(item);
|
|
968
|
-
if (index !== -1) {
|
|
969
|
-
updatedArray.splice(index, 1);
|
|
970
|
-
}
|
|
971
|
-
return updatedArray;
|
|
972
|
-
}
|
|
973
|
-
function removeLinks(items) {
|
|
974
|
-
return items.filter((item) => item.tagName !== "A");
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
// ../../node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
978
|
-
import * as React16 from "react";
|
|
979
|
-
import ReactDOM2 from "react-dom";
|
|
980
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
981
|
-
var PORTAL_NAME = "Portal";
|
|
982
|
-
var Portal = React16.forwardRef((props, forwardedRef) => {
|
|
983
|
-
const { container: containerProp, ...portalProps } = props;
|
|
984
|
-
const [mounted, setMounted] = React16.useState(false);
|
|
985
|
-
useLayoutEffect2(() => setMounted(true), []);
|
|
986
|
-
const container = containerProp || mounted && globalThis?.document?.body;
|
|
987
|
-
return container ? ReactDOM2.createPortal(/* @__PURE__ */ jsx9(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
988
|
-
});
|
|
989
|
-
Portal.displayName = PORTAL_NAME;
|
|
990
|
-
|
|
991
|
-
// ../../node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
992
|
-
import * as React23 from "react";
|
|
993
|
-
import * as React17 from "react";
|
|
994
|
-
function useStateMachine(initialState, machine) {
|
|
995
|
-
return React17.useReducer((state, event) => {
|
|
996
|
-
const nextState = machine[state][event];
|
|
997
|
-
return nextState ?? state;
|
|
998
|
-
}, initialState);
|
|
999
|
-
}
|
|
1000
|
-
var Presence = (props) => {
|
|
1001
|
-
const { present, children } = props;
|
|
1002
|
-
const presence = usePresence(present);
|
|
1003
|
-
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React23.Children.only(children);
|
|
1004
|
-
const ref = useComposedRefs(presence.ref, getElementRef2(child));
|
|
1005
|
-
const forceMount = typeof children === "function";
|
|
1006
|
-
return forceMount || presence.isPresent ? React23.cloneElement(child, { ref }) : null;
|
|
1007
|
-
};
|
|
1008
|
-
Presence.displayName = "Presence";
|
|
1009
|
-
function usePresence(present) {
|
|
1010
|
-
const [node, setNode] = React23.useState();
|
|
1011
|
-
const stylesRef = React23.useRef(null);
|
|
1012
|
-
const prevPresentRef = React23.useRef(present);
|
|
1013
|
-
const prevAnimationNameRef = React23.useRef("none");
|
|
1014
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
1015
|
-
const [state, send] = useStateMachine(initialState, {
|
|
1016
|
-
mounted: {
|
|
1017
|
-
UNMOUNT: "unmounted",
|
|
1018
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
1019
|
-
},
|
|
1020
|
-
unmountSuspended: {
|
|
1021
|
-
MOUNT: "mounted",
|
|
1022
|
-
ANIMATION_END: "unmounted"
|
|
1023
|
-
},
|
|
1024
|
-
unmounted: {
|
|
1025
|
-
MOUNT: "mounted"
|
|
1026
|
-
}
|
|
1027
|
-
});
|
|
1028
|
-
React23.useEffect(() => {
|
|
1029
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1030
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
1031
|
-
}, [state]);
|
|
1032
|
-
useLayoutEffect2(() => {
|
|
1033
|
-
const styles = stylesRef.current;
|
|
1034
|
-
const wasPresent = prevPresentRef.current;
|
|
1035
|
-
const hasPresentChanged = wasPresent !== present;
|
|
1036
|
-
if (hasPresentChanged) {
|
|
1037
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
1038
|
-
const currentAnimationName = getAnimationName(styles);
|
|
1039
|
-
if (present) {
|
|
1040
|
-
send("MOUNT");
|
|
1041
|
-
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
1042
|
-
send("UNMOUNT");
|
|
1043
|
-
} else {
|
|
1044
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
1045
|
-
if (wasPresent && isAnimating) {
|
|
1046
|
-
send("ANIMATION_OUT");
|
|
1047
|
-
} else {
|
|
1048
|
-
send("UNMOUNT");
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
prevPresentRef.current = present;
|
|
1052
|
-
}
|
|
1053
|
-
}, [present, send]);
|
|
1054
|
-
useLayoutEffect2(() => {
|
|
1055
|
-
if (node) {
|
|
1056
|
-
let timeoutId;
|
|
1057
|
-
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
1058
|
-
const handleAnimationEnd = (event) => {
|
|
1059
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1060
|
-
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
1061
|
-
if (event.target === node && isCurrentAnimation) {
|
|
1062
|
-
send("ANIMATION_END");
|
|
1063
|
-
if (!prevPresentRef.current) {
|
|
1064
|
-
const currentFillMode = node.style.animationFillMode;
|
|
1065
|
-
node.style.animationFillMode = "forwards";
|
|
1066
|
-
timeoutId = ownerWindow.setTimeout(() => {
|
|
1067
|
-
if (node.style.animationFillMode === "forwards") {
|
|
1068
|
-
node.style.animationFillMode = currentFillMode;
|
|
1069
|
-
}
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
};
|
|
1074
|
-
const handleAnimationStart = (event) => {
|
|
1075
|
-
if (event.target === node) {
|
|
1076
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
1077
|
-
}
|
|
1078
|
-
};
|
|
1079
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
1080
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
1081
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
1082
|
-
return () => {
|
|
1083
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
1084
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
1085
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
1086
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
1087
|
-
};
|
|
1088
|
-
} else {
|
|
1089
|
-
send("ANIMATION_END");
|
|
1090
|
-
}
|
|
1091
|
-
}, [node, send]);
|
|
1092
|
-
return {
|
|
1093
|
-
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
1094
|
-
ref: React23.useCallback((node2) => {
|
|
1095
|
-
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
1096
|
-
setNode(node2);
|
|
1097
|
-
}, [])
|
|
1098
|
-
};
|
|
1099
|
-
}
|
|
1100
|
-
function getAnimationName(styles) {
|
|
1101
|
-
return styles?.animationName || "none";
|
|
1102
|
-
}
|
|
1103
|
-
function getElementRef2(element) {
|
|
1104
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1105
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1106
|
-
if (mayWarn) {
|
|
1107
|
-
return element.ref;
|
|
1108
|
-
}
|
|
1109
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1110
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1111
|
-
if (mayWarn) {
|
|
1112
|
-
return element.props.ref;
|
|
1113
|
-
}
|
|
1114
|
-
return element.props.ref || element.ref;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
// ../../node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
1118
|
-
import * as React18 from "react";
|
|
1119
|
-
var count2 = 0;
|
|
1120
|
-
function useFocusGuards() {
|
|
1121
|
-
React18.useEffect(() => {
|
|
1122
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
1123
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
1124
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
1125
|
-
count2++;
|
|
1126
|
-
return () => {
|
|
1127
|
-
if (count2 === 1) {
|
|
1128
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
1129
|
-
}
|
|
1130
|
-
count2--;
|
|
1131
|
-
};
|
|
1132
|
-
}, []);
|
|
1133
|
-
}
|
|
1134
|
-
function createFocusGuard() {
|
|
1135
|
-
const element = document.createElement("span");
|
|
1136
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
1137
|
-
element.tabIndex = 0;
|
|
1138
|
-
element.style.outline = "none";
|
|
1139
|
-
element.style.opacity = "0";
|
|
1140
|
-
element.style.position = "fixed";
|
|
1141
|
-
element.style.pointerEvents = "none";
|
|
1142
|
-
return element;
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
// ../../node_modules/@radix-ui/react-dialog/dist/index.mjs
|
|
1146
|
-
import { RemoveScroll } from "react-remove-scroll";
|
|
1147
|
-
|
|
1148
|
-
// ../../node_modules/aria-hidden/dist/es2015/index.js
|
|
1149
|
-
var getDefaultParent = function(originalTarget) {
|
|
1150
|
-
if (typeof document === "undefined") {
|
|
1151
|
-
return null;
|
|
1152
|
-
}
|
|
1153
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
1154
|
-
return sampleTarget.ownerDocument.body;
|
|
1155
|
-
};
|
|
1156
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
1157
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
1158
|
-
var markerMap = {};
|
|
1159
|
-
var lockCount = 0;
|
|
1160
|
-
var unwrapHost = function(node) {
|
|
1161
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
1162
|
-
};
|
|
1163
|
-
var correctTargets = function(parent, targets) {
|
|
1164
|
-
return targets.map(function(target) {
|
|
1165
|
-
if (parent.contains(target)) {
|
|
1166
|
-
return target;
|
|
1167
|
-
}
|
|
1168
|
-
var correctedTarget = unwrapHost(target);
|
|
1169
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
1170
|
-
return correctedTarget;
|
|
1171
|
-
}
|
|
1172
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
1173
|
-
return null;
|
|
1174
|
-
}).filter(function(x) {
|
|
1175
|
-
return Boolean(x);
|
|
1176
|
-
});
|
|
1177
|
-
};
|
|
1178
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
1179
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
1180
|
-
if (!markerMap[markerName]) {
|
|
1181
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
1182
|
-
}
|
|
1183
|
-
var markerCounter = markerMap[markerName];
|
|
1184
|
-
var hiddenNodes = [];
|
|
1185
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
1186
|
-
var elementsToStop = new Set(targets);
|
|
1187
|
-
var keep = function(el) {
|
|
1188
|
-
if (!el || elementsToKeep.has(el)) {
|
|
1189
|
-
return;
|
|
1190
|
-
}
|
|
1191
|
-
elementsToKeep.add(el);
|
|
1192
|
-
keep(el.parentNode);
|
|
1193
|
-
};
|
|
1194
|
-
targets.forEach(keep);
|
|
1195
|
-
var deep = function(parent) {
|
|
1196
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
1197
|
-
return;
|
|
1198
|
-
}
|
|
1199
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
1200
|
-
if (elementsToKeep.has(node)) {
|
|
1201
|
-
deep(node);
|
|
1202
|
-
} else {
|
|
1203
|
-
try {
|
|
1204
|
-
var attr = node.getAttribute(controlAttribute);
|
|
1205
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
1206
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
1207
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
1208
|
-
counterMap.set(node, counterValue);
|
|
1209
|
-
markerCounter.set(node, markerValue);
|
|
1210
|
-
hiddenNodes.push(node);
|
|
1211
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
1212
|
-
uncontrolledNodes.set(node, true);
|
|
1213
|
-
}
|
|
1214
|
-
if (markerValue === 1) {
|
|
1215
|
-
node.setAttribute(markerName, "true");
|
|
1216
|
-
}
|
|
1217
|
-
if (!alreadyHidden) {
|
|
1218
|
-
node.setAttribute(controlAttribute, "true");
|
|
1219
|
-
}
|
|
1220
|
-
} catch (e) {
|
|
1221
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
});
|
|
1225
|
-
};
|
|
1226
|
-
deep(parentNode);
|
|
1227
|
-
elementsToKeep.clear();
|
|
1228
|
-
lockCount++;
|
|
1229
|
-
return function() {
|
|
1230
|
-
hiddenNodes.forEach(function(node) {
|
|
1231
|
-
var counterValue = counterMap.get(node) - 1;
|
|
1232
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
1233
|
-
counterMap.set(node, counterValue);
|
|
1234
|
-
markerCounter.set(node, markerValue);
|
|
1235
|
-
if (!counterValue) {
|
|
1236
|
-
if (!uncontrolledNodes.has(node)) {
|
|
1237
|
-
node.removeAttribute(controlAttribute);
|
|
1238
|
-
}
|
|
1239
|
-
uncontrolledNodes.delete(node);
|
|
1240
|
-
}
|
|
1241
|
-
if (!markerValue) {
|
|
1242
|
-
node.removeAttribute(markerName);
|
|
1243
|
-
}
|
|
1244
|
-
});
|
|
1245
|
-
lockCount--;
|
|
1246
|
-
if (!lockCount) {
|
|
1247
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
1248
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
1249
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
1250
|
-
markerMap = {};
|
|
1251
|
-
}
|
|
1252
|
-
};
|
|
1253
|
-
};
|
|
1254
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
1255
|
-
if (markerName === void 0) {
|
|
1256
|
-
markerName = "data-aria-hidden";
|
|
1257
|
-
}
|
|
1258
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
1259
|
-
var activeParentNode = parentNode || getDefaultParent(originalTarget);
|
|
1260
|
-
if (!activeParentNode) {
|
|
1261
|
-
return function() {
|
|
1262
|
-
return null;
|
|
1263
|
-
};
|
|
1264
|
-
}
|
|
1265
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
1266
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
1267
|
-
};
|
|
1268
|
-
|
|
1269
|
-
// ../../node_modules/@radix-ui/react-dialog/dist/index.mjs
|
|
1270
|
-
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1271
|
-
var DIALOG_NAME = "Dialog";
|
|
1272
|
-
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
1273
|
-
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
1274
|
-
var Dialog = (props) => {
|
|
1275
|
-
const {
|
|
1276
|
-
__scopeDialog,
|
|
1277
|
-
children,
|
|
1278
|
-
open: openProp,
|
|
1279
|
-
defaultOpen,
|
|
1280
|
-
onOpenChange,
|
|
1281
|
-
modal = true
|
|
1282
|
-
} = props;
|
|
1283
|
-
const triggerRef = React19.useRef(null);
|
|
1284
|
-
const contentRef = React19.useRef(null);
|
|
1285
|
-
const [open, setOpen] = useControllableState({
|
|
1286
|
-
prop: openProp,
|
|
1287
|
-
defaultProp: defaultOpen ?? false,
|
|
1288
|
-
onChange: onOpenChange,
|
|
1289
|
-
caller: DIALOG_NAME
|
|
1290
|
-
});
|
|
1291
|
-
return /* @__PURE__ */ jsx10(
|
|
1292
|
-
DialogProvider,
|
|
1293
|
-
{
|
|
1294
|
-
scope: __scopeDialog,
|
|
1295
|
-
triggerRef,
|
|
1296
|
-
contentRef,
|
|
1297
|
-
contentId: useId(),
|
|
1298
|
-
titleId: useId(),
|
|
1299
|
-
descriptionId: useId(),
|
|
1300
|
-
open,
|
|
1301
|
-
onOpenChange: setOpen,
|
|
1302
|
-
onOpenToggle: React19.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
1303
|
-
modal,
|
|
1304
|
-
children
|
|
1305
|
-
}
|
|
1306
|
-
);
|
|
1307
|
-
};
|
|
1308
|
-
Dialog.displayName = DIALOG_NAME;
|
|
1309
|
-
var TRIGGER_NAME = "DialogTrigger";
|
|
1310
|
-
var DialogTrigger = React19.forwardRef(
|
|
1311
|
-
(props, forwardedRef) => {
|
|
1312
|
-
const { __scopeDialog, ...triggerProps } = props;
|
|
1313
|
-
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
1314
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
1315
|
-
return /* @__PURE__ */ jsx10(
|
|
1316
|
-
Primitive.button,
|
|
1317
|
-
{
|
|
1318
|
-
type: "button",
|
|
1319
|
-
"aria-haspopup": "dialog",
|
|
1320
|
-
"aria-expanded": context.open,
|
|
1321
|
-
"aria-controls": context.contentId,
|
|
1322
|
-
"data-state": getState(context.open),
|
|
1323
|
-
...triggerProps,
|
|
1324
|
-
ref: composedTriggerRef,
|
|
1325
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
1326
|
-
}
|
|
1327
|
-
);
|
|
1328
|
-
}
|
|
1329
|
-
);
|
|
1330
|
-
DialogTrigger.displayName = TRIGGER_NAME;
|
|
1331
|
-
var PORTAL_NAME2 = "DialogPortal";
|
|
1332
|
-
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
|
|
1333
|
-
forceMount: void 0
|
|
1334
|
-
});
|
|
1335
|
-
var DialogPortal = (props) => {
|
|
1336
|
-
const { __scopeDialog, forceMount, children, container } = props;
|
|
1337
|
-
const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
|
|
1338
|
-
return /* @__PURE__ */ jsx10(PortalProvider, { scope: __scopeDialog, forceMount, children: React19.Children.map(children, (child) => /* @__PURE__ */ jsx10(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx10(Portal, { asChild: true, container, children: child }) })) });
|
|
1339
|
-
};
|
|
1340
|
-
DialogPortal.displayName = PORTAL_NAME2;
|
|
1341
|
-
var OVERLAY_NAME = "DialogOverlay";
|
|
1342
|
-
var DialogOverlay = React19.forwardRef(
|
|
1343
|
-
(props, forwardedRef) => {
|
|
1344
|
-
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
1345
|
-
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
1346
|
-
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
1347
|
-
return context.modal ? /* @__PURE__ */ jsx10(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx10(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
1348
|
-
}
|
|
1349
|
-
);
|
|
1350
|
-
DialogOverlay.displayName = OVERLAY_NAME;
|
|
1351
|
-
var Slot = createSlot("DialogOverlay.RemoveScroll");
|
|
1352
|
-
var DialogOverlayImpl = React19.forwardRef(
|
|
1353
|
-
(props, forwardedRef) => {
|
|
1354
|
-
const { __scopeDialog, ...overlayProps } = props;
|
|
1355
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
1356
|
-
return (
|
|
1357
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
1358
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
1359
|
-
/* @__PURE__ */ jsx10(RemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx10(
|
|
1360
|
-
Primitive.div,
|
|
1361
|
-
{
|
|
1362
|
-
"data-state": getState(context.open),
|
|
1363
|
-
...overlayProps,
|
|
1364
|
-
ref: forwardedRef,
|
|
1365
|
-
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
1366
|
-
}
|
|
1367
|
-
) })
|
|
1368
|
-
);
|
|
1369
|
-
}
|
|
1370
|
-
);
|
|
1371
|
-
var CONTENT_NAME = "DialogContent";
|
|
1372
|
-
var DialogContent = React19.forwardRef(
|
|
1373
|
-
(props, forwardedRef) => {
|
|
1374
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
1375
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
1376
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
1377
|
-
return /* @__PURE__ */ jsx10(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx10(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx10(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
1378
|
-
}
|
|
1379
|
-
);
|
|
1380
|
-
DialogContent.displayName = CONTENT_NAME;
|
|
1381
|
-
var DialogContentModal = React19.forwardRef(
|
|
1382
|
-
(props, forwardedRef) => {
|
|
1383
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
1384
|
-
const contentRef = React19.useRef(null);
|
|
1385
|
-
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
1386
|
-
React19.useEffect(() => {
|
|
1387
|
-
const content = contentRef.current;
|
|
1388
|
-
if (content) return hideOthers(content);
|
|
1389
|
-
}, []);
|
|
1390
|
-
return /* @__PURE__ */ jsx10(
|
|
1391
|
-
DialogContentImpl,
|
|
1392
|
-
{
|
|
1393
|
-
...props,
|
|
1394
|
-
ref: composedRefs,
|
|
1395
|
-
trapFocus: context.open,
|
|
1396
|
-
disableOutsidePointerEvents: true,
|
|
1397
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1398
|
-
event.preventDefault();
|
|
1399
|
-
context.triggerRef.current?.focus();
|
|
1400
|
-
}),
|
|
1401
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
1402
|
-
const originalEvent = event.detail.originalEvent;
|
|
1403
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
1404
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
1405
|
-
if (isRightClick) event.preventDefault();
|
|
1406
|
-
}),
|
|
1407
|
-
onFocusOutside: composeEventHandlers(
|
|
1408
|
-
props.onFocusOutside,
|
|
1409
|
-
(event) => event.preventDefault()
|
|
1410
|
-
)
|
|
1411
|
-
}
|
|
1412
|
-
);
|
|
1413
|
-
}
|
|
1414
|
-
);
|
|
1415
|
-
var DialogContentNonModal = React19.forwardRef(
|
|
1416
|
-
(props, forwardedRef) => {
|
|
1417
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
1418
|
-
const hasInteractedOutsideRef = React19.useRef(false);
|
|
1419
|
-
const hasPointerDownOutsideRef = React19.useRef(false);
|
|
1420
|
-
return /* @__PURE__ */ jsx10(
|
|
1421
|
-
DialogContentImpl,
|
|
1422
|
-
{
|
|
1423
|
-
...props,
|
|
1424
|
-
ref: forwardedRef,
|
|
1425
|
-
trapFocus: false,
|
|
1426
|
-
disableOutsidePointerEvents: false,
|
|
1427
|
-
onCloseAutoFocus: (event) => {
|
|
1428
|
-
props.onCloseAutoFocus?.(event);
|
|
1429
|
-
if (!event.defaultPrevented) {
|
|
1430
|
-
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
1431
|
-
event.preventDefault();
|
|
1432
|
-
}
|
|
1433
|
-
hasInteractedOutsideRef.current = false;
|
|
1434
|
-
hasPointerDownOutsideRef.current = false;
|
|
1435
|
-
},
|
|
1436
|
-
onInteractOutside: (event) => {
|
|
1437
|
-
props.onInteractOutside?.(event);
|
|
1438
|
-
if (!event.defaultPrevented) {
|
|
1439
|
-
hasInteractedOutsideRef.current = true;
|
|
1440
|
-
if (event.detail.originalEvent.type === "pointerdown") {
|
|
1441
|
-
hasPointerDownOutsideRef.current = true;
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
const target = event.target;
|
|
1445
|
-
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
1446
|
-
if (targetIsTrigger) event.preventDefault();
|
|
1447
|
-
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
1448
|
-
event.preventDefault();
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
);
|
|
1453
|
-
}
|
|
1454
|
-
);
|
|
1455
|
-
var DialogContentImpl = React19.forwardRef(
|
|
1456
|
-
(props, forwardedRef) => {
|
|
1457
|
-
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
1458
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
1459
|
-
const contentRef = React19.useRef(null);
|
|
1460
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
1461
|
-
useFocusGuards();
|
|
1462
|
-
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
1463
|
-
/* @__PURE__ */ jsx10(
|
|
1464
|
-
FocusScope,
|
|
1465
|
-
{
|
|
1466
|
-
asChild: true,
|
|
1467
|
-
loop: true,
|
|
1468
|
-
trapped: trapFocus,
|
|
1469
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
1470
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
1471
|
-
children: /* @__PURE__ */ jsx10(
|
|
1472
|
-
DismissableLayer,
|
|
1473
|
-
{
|
|
1474
|
-
role: "dialog",
|
|
1475
|
-
id: context.contentId,
|
|
1476
|
-
"aria-describedby": context.descriptionId,
|
|
1477
|
-
"aria-labelledby": context.titleId,
|
|
1478
|
-
"data-state": getState(context.open),
|
|
1479
|
-
...contentProps,
|
|
1480
|
-
ref: composedRefs,
|
|
1481
|
-
onDismiss: () => context.onOpenChange(false)
|
|
1482
|
-
}
|
|
1483
|
-
)
|
|
1484
|
-
}
|
|
1485
|
-
),
|
|
1486
|
-
/* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
1487
|
-
/* @__PURE__ */ jsx10(TitleWarning, { titleId: context.titleId }),
|
|
1488
|
-
/* @__PURE__ */ jsx10(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
1489
|
-
] })
|
|
1490
|
-
] });
|
|
1491
|
-
}
|
|
1492
|
-
);
|
|
1493
|
-
var TITLE_NAME = "DialogTitle";
|
|
1494
|
-
var DialogTitle = React19.forwardRef(
|
|
1495
|
-
(props, forwardedRef) => {
|
|
1496
|
-
const { __scopeDialog, ...titleProps } = props;
|
|
1497
|
-
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
1498
|
-
return /* @__PURE__ */ jsx10(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
1499
|
-
}
|
|
1500
|
-
);
|
|
1501
|
-
DialogTitle.displayName = TITLE_NAME;
|
|
1502
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
1503
|
-
var DialogDescription = React19.forwardRef(
|
|
1504
|
-
(props, forwardedRef) => {
|
|
1505
|
-
const { __scopeDialog, ...descriptionProps } = props;
|
|
1506
|
-
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
1507
|
-
return /* @__PURE__ */ jsx10(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
1508
|
-
}
|
|
1509
|
-
);
|
|
1510
|
-
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
1511
|
-
var CLOSE_NAME = "DialogClose";
|
|
1512
|
-
var DialogClose = React19.forwardRef(
|
|
1513
|
-
(props, forwardedRef) => {
|
|
1514
|
-
const { __scopeDialog, ...closeProps } = props;
|
|
1515
|
-
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
1516
|
-
return /* @__PURE__ */ jsx10(
|
|
1517
|
-
Primitive.button,
|
|
1518
|
-
{
|
|
1519
|
-
type: "button",
|
|
1520
|
-
...closeProps,
|
|
1521
|
-
ref: forwardedRef,
|
|
1522
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
1523
|
-
}
|
|
1524
|
-
);
|
|
1525
|
-
}
|
|
1526
|
-
);
|
|
1527
|
-
DialogClose.displayName = CLOSE_NAME;
|
|
1528
|
-
function getState(open) {
|
|
1529
|
-
return open ? "open" : "closed";
|
|
1530
|
-
}
|
|
1531
|
-
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
1532
|
-
var [WarningProvider, useWarningContext] = createContext22(TITLE_WARNING_NAME, {
|
|
1533
|
-
contentName: CONTENT_NAME,
|
|
1534
|
-
titleName: TITLE_NAME,
|
|
1535
|
-
docsSlug: "dialog"
|
|
1536
|
-
});
|
|
1537
|
-
var TitleWarning = ({ titleId }) => {
|
|
1538
|
-
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
1539
|
-
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
1540
|
-
|
|
1541
|
-
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
1542
|
-
|
|
1543
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
1544
|
-
React19.useEffect(() => {
|
|
1545
|
-
if (titleId) {
|
|
1546
|
-
const hasTitle = document.getElementById(titleId);
|
|
1547
|
-
if (!hasTitle) console.error(MESSAGE);
|
|
1548
|
-
}
|
|
1549
|
-
}, [MESSAGE, titleId]);
|
|
1550
|
-
return null;
|
|
1551
|
-
};
|
|
1552
|
-
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
1553
|
-
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
1554
|
-
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
1555
|
-
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
1556
|
-
React19.useEffect(() => {
|
|
1557
|
-
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
1558
|
-
if (descriptionId && describedById) {
|
|
1559
|
-
const hasDescription = document.getElementById(descriptionId);
|
|
1560
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
1561
|
-
}
|
|
1562
|
-
}, [MESSAGE, contentRef, descriptionId]);
|
|
1563
|
-
return null;
|
|
1564
|
-
};
|
|
1565
|
-
var Trigger = DialogTrigger;
|
|
1566
|
-
|
|
1567
|
-
// src/components/PeekInTrigger.tsx
|
|
1568
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1569
241
|
var PeekInTrigger = ({
|
|
1570
242
|
children
|
|
1571
|
-
}) => {
|
|
1572
|
-
return /* @__PURE__ */ jsx11(Trigger, { asChild: true, children });
|
|
1573
|
-
};
|
|
243
|
+
}) => /* @__PURE__ */ jsx5(Fragment2, { children });
|
|
1574
244
|
PeekInTrigger.displayName = "PeekInTrigger";
|
|
1575
245
|
|
|
1576
246
|
// src/usePeekInPanelState.ts
|
|
1577
|
-
import * as
|
|
247
|
+
import * as React7 from "react";
|
|
1578
248
|
function usePeekInPanelState(panel) {
|
|
1579
249
|
const panelProps = panel?.props;
|
|
1580
250
|
const isControlled = panelProps?.open !== void 0;
|
|
1581
251
|
const onOpenChange = panelProps?.onOpenChange;
|
|
1582
|
-
const [internalOpen, setInternalOpen] =
|
|
252
|
+
const [internalOpen, setInternalOpen] = React7.useState(
|
|
1583
253
|
panelProps?.defaultOpen ?? true
|
|
1584
254
|
);
|
|
1585
255
|
const panelOpen = isControlled ? panelProps.open : internalOpen;
|
|
1586
|
-
const setPanelOpen =
|
|
256
|
+
const setPanelOpen = React7.useCallback(
|
|
1587
257
|
(next) => {
|
|
1588
258
|
const value = typeof next === "function" ? next(panelOpen) : next;
|
|
1589
259
|
if (!isControlled) setInternalOpen(value);
|
|
@@ -1595,17 +265,18 @@ function usePeekInPanelState(panel) {
|
|
|
1595
265
|
}
|
|
1596
266
|
|
|
1597
267
|
// src/PeekInStyled.tsx
|
|
1598
|
-
import { jsx as
|
|
268
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1599
269
|
function getChildByType(children, type) {
|
|
1600
|
-
const childArray =
|
|
270
|
+
const childArray = React8.Children.toArray(children);
|
|
1601
271
|
return childArray.find(
|
|
1602
|
-
(child) =>
|
|
272
|
+
(child) => React8.isValidElement(child) && child.type === type
|
|
1603
273
|
) || null;
|
|
1604
274
|
}
|
|
1605
275
|
var PeekInStyled = ({
|
|
1606
276
|
open,
|
|
1607
277
|
defaultOpen,
|
|
1608
278
|
onOpenChange,
|
|
279
|
+
"aria-label": ariaLabelProp,
|
|
1609
280
|
closeButtonAriaLabel = "Close",
|
|
1610
281
|
actions,
|
|
1611
282
|
panelToggle,
|
|
@@ -1620,20 +291,41 @@ var PeekInStyled = ({
|
|
|
1620
291
|
}) => {
|
|
1621
292
|
const header = getChildByType(children, PeekInHeader);
|
|
1622
293
|
const content = getChildByType(children, PeekInContent);
|
|
294
|
+
const footer = getChildByType(children, PeekInFooter);
|
|
1623
295
|
const panel = getChildByType(children, PeekInPanel);
|
|
1624
296
|
const trigger = getChildByType(children, PeekInTrigger);
|
|
1625
297
|
const { panelOpen, setPanelOpen } = usePeekInPanelState(panel);
|
|
1626
|
-
const panelId =
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
const
|
|
298
|
+
const panelId = React8.useId();
|
|
299
|
+
const isControlled = open !== void 0;
|
|
300
|
+
const [internalOpen, setInternalOpen] = React8.useState(defaultOpen ?? false);
|
|
301
|
+
const effectiveOpen = isControlled ? open ?? false : internalOpen;
|
|
302
|
+
const handleOpenChange = React8.useCallback(
|
|
303
|
+
(next) => {
|
|
304
|
+
if (!isControlled) setInternalOpen(next);
|
|
305
|
+
onOpenChange?.(next);
|
|
306
|
+
},
|
|
307
|
+
[isControlled, onOpenChange]
|
|
308
|
+
);
|
|
309
|
+
const handleClose = React8.useCallback(
|
|
310
|
+
() => handleOpenChange(false),
|
|
311
|
+
[handleOpenChange]
|
|
312
|
+
);
|
|
313
|
+
const contextValue = React8.useMemo(
|
|
1631
314
|
() => ({ onClose: handleClose, panelOpen, setPanelOpen, panelId }),
|
|
1632
315
|
[handleClose, panelOpen, setPanelOpen, panelId]
|
|
1633
316
|
);
|
|
1634
|
-
const
|
|
317
|
+
const headerTitle = header?.props?.title;
|
|
318
|
+
const headerSubtitle = header?.props?.subtitle;
|
|
319
|
+
const ariaLabel = ariaLabelProp ?? (typeof headerTitle === "string" ? headerTitle : void 0) ?? (typeof headerSubtitle === "string" ? headerSubtitle : void 0);
|
|
320
|
+
React8.useEffect(() => {
|
|
321
|
+
if (process.env.NODE_ENV !== "production" && !ariaLabel) {
|
|
322
|
+
console.warn(
|
|
323
|
+
"PeekIn: no accessible name was resolved. Pass `aria-label`, or give PeekInHeader a string `title`."
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
}, [ariaLabel]);
|
|
1635
327
|
const triggerElement = trigger ? trigger.props.children : void 0;
|
|
1636
|
-
const modalActions =
|
|
328
|
+
const modalActions = React8.useMemo(() => {
|
|
1637
329
|
const result = [];
|
|
1638
330
|
if (panelToggle && panel) {
|
|
1639
331
|
result.push({
|
|
@@ -1649,7 +341,7 @@ var PeekInStyled = ({
|
|
|
1649
341
|
}
|
|
1650
342
|
return result.length > 0 ? result : void 0;
|
|
1651
343
|
}, [panelToggle, panel, actions, panelOpen, panelId]);
|
|
1652
|
-
const drawerActions =
|
|
344
|
+
const drawerActions = React8.useMemo(() => {
|
|
1653
345
|
const result = [];
|
|
1654
346
|
if (panelToggle && panel) {
|
|
1655
347
|
result.push({
|
|
@@ -1666,19 +358,8 @@ var PeekInStyled = ({
|
|
|
1666
358
|
return result.length > 0 ? result : void 0;
|
|
1667
359
|
}, [panelToggle, panel, actions, panelOpen, panelId]);
|
|
1668
360
|
const isMobile = useIsMobile2();
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
const effectiveMobileOpen = isControlled ? open ?? false : internalOpen;
|
|
1672
|
-
const handleMobileOpen = React24.useCallback(() => {
|
|
1673
|
-
if (!isControlled) setInternalOpen(true);
|
|
1674
|
-
onOpenChange?.(true);
|
|
1675
|
-
}, [isControlled, onOpenChange]);
|
|
1676
|
-
const handleMobileClose = React24.useCallback(() => {
|
|
1677
|
-
if (!isControlled) setInternalOpen(false);
|
|
1678
|
-
onOpenChange?.(false);
|
|
1679
|
-
}, [isControlled, onOpenChange]);
|
|
1680
|
-
const mobileTrigger = trigger ? React24.cloneElement(trigger.props.children, {
|
|
1681
|
-
onClick: handleMobileOpen
|
|
361
|
+
const mobileTrigger = trigger ? React8.cloneElement(trigger.props.children, {
|
|
362
|
+
onClick: () => handleOpenChange(true)
|
|
1682
363
|
}) : void 0;
|
|
1683
364
|
if (isMobile) {
|
|
1684
365
|
return /* @__PURE__ */ jsxs4(PeekInContext.Provider, { value: contextValue, children: [
|
|
@@ -1686,8 +367,8 @@ var PeekInStyled = ({
|
|
|
1686
367
|
/* @__PURE__ */ jsxs4(
|
|
1687
368
|
Drawer2,
|
|
1688
369
|
{
|
|
1689
|
-
open:
|
|
1690
|
-
onClose:
|
|
370
|
+
open: effectiveOpen,
|
|
371
|
+
onClose: handleClose,
|
|
1691
372
|
direction: "bottom",
|
|
1692
373
|
closeButtonLabel: closeButtonAriaLabel,
|
|
1693
374
|
snapPoints,
|
|
@@ -1700,11 +381,11 @@ var PeekInStyled = ({
|
|
|
1700
381
|
actionsInHeader,
|
|
1701
382
|
"aria-label": ariaLabel,
|
|
1702
383
|
children: [
|
|
1703
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ jsx6(
|
|
1704
385
|
Drawer2.Header,
|
|
1705
386
|
{
|
|
1706
387
|
render: (ctx) => /* @__PURE__ */ jsxs4(
|
|
1707
|
-
|
|
388
|
+
Box3,
|
|
1708
389
|
{
|
|
1709
390
|
display: "flex",
|
|
1710
391
|
alignItems: "center",
|
|
@@ -1713,58 +394,70 @@ var PeekInStyled = ({
|
|
|
1713
394
|
px: 450,
|
|
1714
395
|
flex: "0 0 auto",
|
|
1715
396
|
children: [
|
|
1716
|
-
/* @__PURE__ */ jsxs4(
|
|
1717
|
-
header?.props?.onBack && /* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ jsxs4(Box3, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
398
|
+
header?.props?.onBack && /* @__PURE__ */ jsx6(
|
|
1718
399
|
Button2,
|
|
1719
400
|
{
|
|
1720
401
|
appearance: "unstyled",
|
|
1721
402
|
onClick: header.props.onBack,
|
|
1722
403
|
"aria-label": "Back",
|
|
1723
404
|
"data-qa-peek-in-back": true,
|
|
1724
|
-
children: /* @__PURE__ */
|
|
405
|
+
children: /* @__PURE__ */ jsx6(Icon2, { name: "arrow-left-outline", size: "small" })
|
|
1725
406
|
}
|
|
1726
407
|
),
|
|
1727
|
-
/* @__PURE__ */
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
408
|
+
/* @__PURE__ */ jsxs4(Box3, { display: "flex", flexDirection: "column", children: [
|
|
409
|
+
/* @__PURE__ */ jsx6(
|
|
410
|
+
Text2,
|
|
411
|
+
{
|
|
412
|
+
as: "h2",
|
|
413
|
+
fontSize: 400,
|
|
414
|
+
fontWeight: "semibold",
|
|
415
|
+
color: "text.headline",
|
|
416
|
+
"data-qa-peek-in-title": true,
|
|
417
|
+
children: header?.props?.title
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
header?.props?.subtitle && /* @__PURE__ */ jsx6(
|
|
421
|
+
Text2,
|
|
422
|
+
{
|
|
423
|
+
as: "div",
|
|
424
|
+
fontSize: 200,
|
|
425
|
+
color: "text.body",
|
|
426
|
+
"data-qa-peek-in-subtitle": true,
|
|
427
|
+
children: header.props.subtitle
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
] })
|
|
1738
431
|
] }),
|
|
1739
|
-
/* @__PURE__ */ jsxs4(
|
|
432
|
+
/* @__PURE__ */ jsxs4(Box3, { display: "flex", alignItems: "center", gap: 200, children: [
|
|
1740
433
|
header?.props?.children,
|
|
1741
|
-
actionsInHeader && panelToggle && panel && /* @__PURE__ */
|
|
434
|
+
actionsInHeader && panelToggle && panel && /* @__PURE__ */ jsx6(
|
|
1742
435
|
Button2,
|
|
1743
436
|
{
|
|
1744
437
|
appearance: "pill",
|
|
1745
438
|
"aria-label": panelToggle["aria-label"] ?? "Toggle panel",
|
|
1746
439
|
onClick: () => setPanelOpen((p) => !p),
|
|
1747
|
-
children: /* @__PURE__ */
|
|
440
|
+
children: /* @__PURE__ */ jsx6(Icon2, { "aria-hidden": true, name: panelToggle.iconName })
|
|
1748
441
|
}
|
|
1749
442
|
),
|
|
1750
|
-
actionsInHeader && actions?.map((action, i) => /* @__PURE__ */
|
|
443
|
+
actionsInHeader && actions?.map((action, i) => /* @__PURE__ */ jsx6(
|
|
1751
444
|
Button2,
|
|
1752
445
|
{
|
|
1753
446
|
appearance: "pill",
|
|
1754
447
|
"aria-label": action["aria-label"],
|
|
1755
448
|
onClick: action.onClick,
|
|
1756
449
|
disabled: action.disabled,
|
|
1757
|
-
children: action.iconName && /* @__PURE__ */
|
|
450
|
+
children: action.iconName && /* @__PURE__ */ jsx6(Icon2, { "aria-hidden": true, name: action.iconName })
|
|
1758
451
|
},
|
|
1759
452
|
i
|
|
1760
453
|
)),
|
|
1761
|
-
(actionsInHeader || !drawerActions) && /* @__PURE__ */
|
|
454
|
+
(actionsInHeader || !drawerActions) && /* @__PURE__ */ jsx6(
|
|
1762
455
|
Button2,
|
|
1763
456
|
{
|
|
1764
457
|
appearance: "pill",
|
|
1765
458
|
"aria-label": ctx.closeButtonLabel,
|
|
1766
459
|
onClick: ctx.onClose,
|
|
1767
|
-
children: /* @__PURE__ */
|
|
460
|
+
children: /* @__PURE__ */ jsx6(Icon2, { "aria-hidden": true, name: "x-outline" })
|
|
1768
461
|
}
|
|
1769
462
|
)
|
|
1770
463
|
] })
|
|
@@ -1774,18 +467,18 @@ var PeekInStyled = ({
|
|
|
1774
467
|
}
|
|
1775
468
|
),
|
|
1776
469
|
content,
|
|
470
|
+
footer,
|
|
1777
471
|
panel
|
|
1778
472
|
]
|
|
1779
473
|
}
|
|
1780
474
|
)
|
|
1781
475
|
] });
|
|
1782
476
|
}
|
|
1783
|
-
return /* @__PURE__ */
|
|
477
|
+
return /* @__PURE__ */ jsx6(PeekInContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx6(
|
|
1784
478
|
Modal,
|
|
1785
479
|
{
|
|
1786
|
-
open,
|
|
1787
|
-
|
|
1788
|
-
onOpenChange,
|
|
480
|
+
open: effectiveOpen,
|
|
481
|
+
onOpenChange: handleOpenChange,
|
|
1789
482
|
width: PEEK_IN_WIDTH,
|
|
1790
483
|
height: PEEK_IN_HEIGHT,
|
|
1791
484
|
closeButtonAriaLabel,
|
|
@@ -1795,7 +488,7 @@ var PeekInStyled = ({
|
|
|
1795
488
|
bg: "transparent",
|
|
1796
489
|
children: /* @__PURE__ */ jsxs4(ModalBody, { padding: 0, display: "flex", overflow: "hidden", children: [
|
|
1797
490
|
/* @__PURE__ */ jsxs4(
|
|
1798
|
-
|
|
491
|
+
Box3,
|
|
1799
492
|
{
|
|
1800
493
|
display: "flex",
|
|
1801
494
|
flexDirection: "column",
|
|
@@ -1805,7 +498,8 @@ var PeekInStyled = ({
|
|
|
1805
498
|
borderRadius: 800,
|
|
1806
499
|
children: [
|
|
1807
500
|
header,
|
|
1808
|
-
content
|
|
501
|
+
content,
|
|
502
|
+
footer
|
|
1809
503
|
]
|
|
1810
504
|
}
|
|
1811
505
|
),
|
|
@@ -1817,24 +511,25 @@ var PeekInStyled = ({
|
|
|
1817
511
|
PeekInStyled.displayName = "PeekIn";
|
|
1818
512
|
|
|
1819
513
|
// src/PeekInTailwind.tsx
|
|
1820
|
-
import * as
|
|
514
|
+
import * as React9 from "react";
|
|
1821
515
|
import Button3 from "@sproutsocial/seeds-react-button";
|
|
1822
516
|
import Drawer3 from "@sproutsocial/seeds-react-drawer";
|
|
1823
517
|
import Icon3 from "@sproutsocial/seeds-react-icon";
|
|
1824
518
|
import Text3 from "@sproutsocial/seeds-react-text";
|
|
1825
519
|
import { useIsMobile as useIsMobile3 } from "@sproutsocial/seeds-react-hooks";
|
|
1826
520
|
import { Modal as Modal2, ModalBody as ModalBody2 } from "@sproutsocial/seeds-react-modal/v2";
|
|
1827
|
-
import { jsx as
|
|
521
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1828
522
|
function getChildByType2(children, type) {
|
|
1829
|
-
const childArray =
|
|
523
|
+
const childArray = React9.Children.toArray(children);
|
|
1830
524
|
return childArray.find(
|
|
1831
|
-
(child) =>
|
|
525
|
+
(child) => React9.isValidElement(child) && child.type === type
|
|
1832
526
|
) || null;
|
|
1833
527
|
}
|
|
1834
528
|
var PeekInTailwind = ({
|
|
1835
529
|
open,
|
|
1836
530
|
defaultOpen,
|
|
1837
531
|
onOpenChange,
|
|
532
|
+
"aria-label": ariaLabelProp,
|
|
1838
533
|
closeButtonAriaLabel = "Close",
|
|
1839
534
|
actions,
|
|
1840
535
|
panelToggle,
|
|
@@ -1849,20 +544,41 @@ var PeekInTailwind = ({
|
|
|
1849
544
|
}) => {
|
|
1850
545
|
const header = getChildByType2(children, PeekInHeader);
|
|
1851
546
|
const content = getChildByType2(children, PeekInContent);
|
|
547
|
+
const footer = getChildByType2(children, PeekInFooter);
|
|
1852
548
|
const panel = getChildByType2(children, PeekInPanel);
|
|
1853
549
|
const trigger = getChildByType2(children, PeekInTrigger);
|
|
1854
550
|
const { panelOpen, setPanelOpen } = usePeekInPanelState(panel);
|
|
1855
|
-
const panelId =
|
|
1856
|
-
const
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
const
|
|
551
|
+
const panelId = React9.useId();
|
|
552
|
+
const isControlled = open !== void 0;
|
|
553
|
+
const [internalOpen, setInternalOpen] = React9.useState(defaultOpen ?? false);
|
|
554
|
+
const effectiveOpen = isControlled ? open ?? false : internalOpen;
|
|
555
|
+
const handleOpenChange = React9.useCallback(
|
|
556
|
+
(next) => {
|
|
557
|
+
if (!isControlled) setInternalOpen(next);
|
|
558
|
+
onOpenChange?.(next);
|
|
559
|
+
},
|
|
560
|
+
[isControlled, onOpenChange]
|
|
561
|
+
);
|
|
562
|
+
const handleClose = React9.useCallback(
|
|
563
|
+
() => handleOpenChange(false),
|
|
564
|
+
[handleOpenChange]
|
|
565
|
+
);
|
|
566
|
+
const contextValue = React9.useMemo(
|
|
1860
567
|
() => ({ onClose: handleClose, panelOpen, setPanelOpen, panelId }),
|
|
1861
568
|
[handleClose, panelOpen, setPanelOpen, panelId]
|
|
1862
569
|
);
|
|
1863
|
-
const
|
|
570
|
+
const headerTitle = header?.props?.title;
|
|
571
|
+
const headerSubtitle = header?.props?.subtitle;
|
|
572
|
+
const ariaLabel = ariaLabelProp ?? (typeof headerTitle === "string" ? headerTitle : void 0) ?? (typeof headerSubtitle === "string" ? headerSubtitle : void 0);
|
|
573
|
+
React9.useEffect(() => {
|
|
574
|
+
if (process.env.NODE_ENV !== "production" && !ariaLabel) {
|
|
575
|
+
console.warn(
|
|
576
|
+
"PeekIn: no accessible name was resolved. Pass `aria-label`, or give PeekInHeader a string `title`."
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
}, [ariaLabel]);
|
|
1864
580
|
const triggerElement = trigger ? trigger.props.children : void 0;
|
|
1865
|
-
const modalActions =
|
|
581
|
+
const modalActions = React9.useMemo(() => {
|
|
1866
582
|
const result = [];
|
|
1867
583
|
if (panelToggle && panel) {
|
|
1868
584
|
result.push({
|
|
@@ -1878,7 +594,7 @@ var PeekInTailwind = ({
|
|
|
1878
594
|
}
|
|
1879
595
|
return result.length > 0 ? result : void 0;
|
|
1880
596
|
}, [panelToggle, panel, actions, panelOpen, panelId]);
|
|
1881
|
-
const drawerActions =
|
|
597
|
+
const drawerActions = React9.useMemo(() => {
|
|
1882
598
|
const result = [];
|
|
1883
599
|
if (panelToggle && panel) {
|
|
1884
600
|
result.push({
|
|
@@ -1895,19 +611,8 @@ var PeekInTailwind = ({
|
|
|
1895
611
|
return result.length > 0 ? result : void 0;
|
|
1896
612
|
}, [panelToggle, panel, actions, panelOpen, panelId]);
|
|
1897
613
|
const isMobile = useIsMobile3();
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1900
|
-
const effectiveMobileOpen = isControlled ? open ?? false : internalOpen;
|
|
1901
|
-
const handleMobileOpen = React25.useCallback(() => {
|
|
1902
|
-
if (!isControlled) setInternalOpen(true);
|
|
1903
|
-
onOpenChange?.(true);
|
|
1904
|
-
}, [isControlled, onOpenChange]);
|
|
1905
|
-
const handleMobileClose = React25.useCallback(() => {
|
|
1906
|
-
if (!isControlled) setInternalOpen(false);
|
|
1907
|
-
onOpenChange?.(false);
|
|
1908
|
-
}, [isControlled, onOpenChange]);
|
|
1909
|
-
const mobileTrigger = trigger ? React25.cloneElement(trigger.props.children, {
|
|
1910
|
-
onClick: handleMobileOpen
|
|
614
|
+
const mobileTrigger = trigger ? React9.cloneElement(trigger.props.children, {
|
|
615
|
+
onClick: () => handleOpenChange(true)
|
|
1911
616
|
}) : void 0;
|
|
1912
617
|
if (isMobile) {
|
|
1913
618
|
return /* @__PURE__ */ jsxs5(PeekInContext.Provider, { value: contextValue, children: [
|
|
@@ -1915,8 +620,8 @@ var PeekInTailwind = ({
|
|
|
1915
620
|
/* @__PURE__ */ jsxs5(
|
|
1916
621
|
Drawer3,
|
|
1917
622
|
{
|
|
1918
|
-
open:
|
|
1919
|
-
onClose:
|
|
623
|
+
open: effectiveOpen,
|
|
624
|
+
onClose: handleClose,
|
|
1920
625
|
direction: "bottom",
|
|
1921
626
|
closeButtonLabel: closeButtonAriaLabel,
|
|
1922
627
|
snapPoints,
|
|
@@ -1929,62 +634,74 @@ var PeekInTailwind = ({
|
|
|
1929
634
|
actionsInHeader,
|
|
1930
635
|
"aria-label": ariaLabel,
|
|
1931
636
|
children: [
|
|
1932
|
-
/* @__PURE__ */
|
|
637
|
+
/* @__PURE__ */ jsx7(
|
|
1933
638
|
Drawer3.Header,
|
|
1934
639
|
{
|
|
1935
640
|
render: (ctx) => /* @__PURE__ */ jsxs5("div", { className: "seeds-peek-in-drawer-header", children: [
|
|
1936
641
|
/* @__PURE__ */ jsxs5("div", { className: "seeds-peek-in-titlegroup", children: [
|
|
1937
|
-
header?.props?.onBack && /* @__PURE__ */
|
|
642
|
+
header?.props?.onBack && /* @__PURE__ */ jsx7(
|
|
1938
643
|
Button3,
|
|
1939
644
|
{
|
|
1940
645
|
appearance: "unstyled",
|
|
1941
646
|
onClick: header.props.onBack,
|
|
1942
647
|
"aria-label": "Back",
|
|
1943
648
|
"data-qa-peek-in-back": true,
|
|
1944
|
-
children: /* @__PURE__ */
|
|
649
|
+
children: /* @__PURE__ */ jsx7(Icon3, { name: "arrow-left-outline", size: "small" })
|
|
1945
650
|
}
|
|
1946
651
|
),
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
652
|
+
/* @__PURE__ */ jsxs5("div", { className: "seeds-peek-in-titlestack", children: [
|
|
653
|
+
/* @__PURE__ */ jsx7(
|
|
654
|
+
Text3,
|
|
655
|
+
{
|
|
656
|
+
as: "h2",
|
|
657
|
+
fontSize: 400,
|
|
658
|
+
fontWeight: "semibold",
|
|
659
|
+
color: "text.headline",
|
|
660
|
+
"data-qa-peek-in-title": true,
|
|
661
|
+
children: header?.props?.title
|
|
662
|
+
}
|
|
663
|
+
),
|
|
664
|
+
header?.props?.subtitle && /* @__PURE__ */ jsx7(
|
|
665
|
+
Text3,
|
|
666
|
+
{
|
|
667
|
+
as: "div",
|
|
668
|
+
fontSize: 200,
|
|
669
|
+
color: "text.body",
|
|
670
|
+
"data-qa-peek-in-subtitle": true,
|
|
671
|
+
children: header.props.subtitle
|
|
672
|
+
}
|
|
673
|
+
)
|
|
674
|
+
] })
|
|
1958
675
|
] }),
|
|
1959
676
|
/* @__PURE__ */ jsxs5("div", { className: "seeds-peek-in-header-actions", children: [
|
|
1960
677
|
header?.props?.children,
|
|
1961
|
-
actionsInHeader && panelToggle && panel && /* @__PURE__ */
|
|
678
|
+
actionsInHeader && panelToggle && panel && /* @__PURE__ */ jsx7(
|
|
1962
679
|
Button3,
|
|
1963
680
|
{
|
|
1964
681
|
appearance: "pill",
|
|
1965
682
|
"aria-label": panelToggle["aria-label"] ?? "Toggle panel",
|
|
1966
683
|
onClick: () => setPanelOpen((p) => !p),
|
|
1967
|
-
children: /* @__PURE__ */
|
|
684
|
+
children: /* @__PURE__ */ jsx7(Icon3, { "aria-hidden": true, name: panelToggle.iconName })
|
|
1968
685
|
}
|
|
1969
686
|
),
|
|
1970
|
-
actionsInHeader && actions?.map((action, i) => /* @__PURE__ */
|
|
687
|
+
actionsInHeader && actions?.map((action, i) => /* @__PURE__ */ jsx7(
|
|
1971
688
|
Button3,
|
|
1972
689
|
{
|
|
1973
690
|
appearance: "pill",
|
|
1974
691
|
"aria-label": action["aria-label"],
|
|
1975
692
|
onClick: action.onClick,
|
|
1976
693
|
disabled: action.disabled,
|
|
1977
|
-
children: action.iconName && /* @__PURE__ */
|
|
694
|
+
children: action.iconName && /* @__PURE__ */ jsx7(Icon3, { "aria-hidden": true, name: action.iconName })
|
|
1978
695
|
},
|
|
1979
696
|
i
|
|
1980
697
|
)),
|
|
1981
|
-
(actionsInHeader || !drawerActions) && /* @__PURE__ */
|
|
698
|
+
(actionsInHeader || !drawerActions) && /* @__PURE__ */ jsx7(
|
|
1982
699
|
Button3,
|
|
1983
700
|
{
|
|
1984
701
|
appearance: "pill",
|
|
1985
702
|
"aria-label": ctx.closeButtonLabel,
|
|
1986
703
|
onClick: ctx.onClose,
|
|
1987
|
-
children: /* @__PURE__ */
|
|
704
|
+
children: /* @__PURE__ */ jsx7(Icon3, { "aria-hidden": true, name: "x-outline" })
|
|
1988
705
|
}
|
|
1989
706
|
)
|
|
1990
707
|
] })
|
|
@@ -1992,18 +709,18 @@ var PeekInTailwind = ({
|
|
|
1992
709
|
}
|
|
1993
710
|
),
|
|
1994
711
|
content,
|
|
712
|
+
footer,
|
|
1995
713
|
panel
|
|
1996
714
|
]
|
|
1997
715
|
}
|
|
1998
716
|
)
|
|
1999
717
|
] });
|
|
2000
718
|
}
|
|
2001
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ jsx7(PeekInContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx7(
|
|
2002
720
|
Modal2,
|
|
2003
721
|
{
|
|
2004
|
-
open,
|
|
2005
|
-
|
|
2006
|
-
onOpenChange,
|
|
722
|
+
open: effectiveOpen,
|
|
723
|
+
onOpenChange: handleOpenChange,
|
|
2007
724
|
width: PEEK_IN_WIDTH,
|
|
2008
725
|
height: PEEK_IN_HEIGHT,
|
|
2009
726
|
closeButtonAriaLabel,
|
|
@@ -2014,7 +731,8 @@ var PeekInTailwind = ({
|
|
|
2014
731
|
children: /* @__PURE__ */ jsxs5(ModalBody2, { padding: 0, display: "flex", overflow: "hidden", children: [
|
|
2015
732
|
/* @__PURE__ */ jsxs5("div", { className: "seeds-peek-in-main", children: [
|
|
2016
733
|
header,
|
|
2017
|
-
content
|
|
734
|
+
content,
|
|
735
|
+
footer
|
|
2018
736
|
] }),
|
|
2019
737
|
panel
|
|
2020
738
|
] })
|
|
@@ -2024,22 +742,23 @@ var PeekInTailwind = ({
|
|
|
2024
742
|
PeekInTailwind.displayName = "PeekIn";
|
|
2025
743
|
|
|
2026
744
|
// src/PeekInHybrid.tsx
|
|
2027
|
-
import { jsx as
|
|
745
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
2028
746
|
var PeekInHybrid = (props) => {
|
|
2029
747
|
if (hasStyledProps(props)) {
|
|
2030
|
-
return /* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ jsx8(PeekInStyled, { ...props });
|
|
2031
749
|
}
|
|
2032
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ jsx8(PeekInTailwind, { ...props });
|
|
2033
751
|
};
|
|
2034
752
|
PeekInHybrid.displayName = "PeekIn";
|
|
2035
753
|
|
|
2036
754
|
// src/PeekIn.tsx
|
|
2037
|
-
import { jsx as
|
|
2038
|
-
var PeekIn = (props) => /* @__PURE__ */
|
|
755
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
756
|
+
var PeekIn = (props) => /* @__PURE__ */ jsx9(PeekInHybrid, { ...props });
|
|
2039
757
|
PeekIn.displayName = "PeekIn";
|
|
2040
758
|
export {
|
|
2041
759
|
PeekIn,
|
|
2042
760
|
PeekInContent,
|
|
761
|
+
PeekInFooter,
|
|
2043
762
|
PeekInHeader,
|
|
2044
763
|
PeekInPanel,
|
|
2045
764
|
PeekInTrigger
|