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