astro-md-editor 0.0.7 → 0.0.8
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/.output/nitro.json +1 -1
- package/.output/public/assets/index-CstiJsWh.js +378 -0
- package/.output/public/assets/{main-BrRIwdKE.js → main-Cc9C-tdG.js} +1 -1
- package/.output/public/assets/styles-DCSwPMSs.css +1 -0
- package/.output/server/{__root-CL_tq3ov.mjs → __root-Bv3dTvZ5.mjs} +1 -1
- package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +210 -0
- package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +11 -0
- package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +69 -0
- package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-escape-keydown+[...].mjs +17 -0
- package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +6 -0
- package/.output/server/_libs/aria-hidden.mjs +122 -0
- package/.output/server/_libs/base-ui__react.mjs +2548 -2548
- package/.output/server/_libs/base-ui__utils.mjs +2 -2
- package/.output/server/_libs/cmdk.mjs +315 -0
- package/.output/server/_libs/detect-node-es.mjs +1 -0
- package/.output/server/_libs/get-nonce.mjs +9 -0
- package/.output/server/_libs/lucide-react.mjs +25 -17
- package/.output/server/_libs/radix-ui__primitive.mjs +11 -0
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +39 -0
- package/.output/server/_libs/radix-ui__react-context.mjs +78 -0
- package/.output/server/_libs/radix-ui__react-dialog.mjs +319 -0
- package/.output/server/_libs/radix-ui__react-focus-guards.mjs +29 -0
- package/.output/server/_libs/radix-ui__react-focus-scope.mjs +206 -0
- package/.output/server/_libs/radix-ui__react-id.mjs +14 -0
- package/.output/server/_libs/radix-ui__react-portal.mjs +16 -0
- package/.output/server/_libs/radix-ui__react-presence.mjs +128 -0
- package/.output/server/_libs/radix-ui__react-primitive.mjs +75 -0
- package/.output/server/_libs/radix-ui__react-slot.mjs +184 -0
- package/.output/server/_libs/react-remove-scroll-bar.mjs +82 -0
- package/.output/server/_libs/react-remove-scroll.mjs +328 -0
- package/.output/server/_libs/react-style-singleton.mjs +69 -0
- package/.output/server/_libs/react.mjs +2 -0
- package/.output/server/_libs/tslib.mjs +576 -0
- package/.output/server/_libs/use-callback-ref.mjs +66 -0
- package/.output/server/_libs/use-sidecar.mjs +106 -0
- package/.output/server/_ssr/{ImageAssetBrowser-DNDdTqtf.mjs → ImageAssetBrowser-DuPVChYO.mjs} +2 -2
- package/.output/server/_ssr/{collections.server-s12asITg.mjs → collections.server-DjgohZR7.mjs} +2 -1
- package/.output/server/_ssr/{file-history.api-oydnxFVV.mjs → file-history.api-JMkTXrYq.mjs} +1 -1
- package/.output/server/_ssr/{image-assets.server-Ci2E1_Tm.mjs → image-assets.server-2-0DgxSb.mjs} +1 -1
- package/.output/server/_ssr/{image-preview.api-pcN5PQhH.mjs → image-preview.api-V_Q-MBx9.mjs} +2 -2
- package/.output/server/_ssr/{index-BjQuGIib.mjs → index-ByW88Uz2.mjs} +3 -2
- package/.output/server/_ssr/{index-qpTkRHX1.mjs → index-C6Fb3DjG.mjs} +796 -409
- package/.output/server/_ssr/index.mjs +15 -15
- package/.output/server/_ssr/{router-DU3Hv7p_.mjs → router-DbnWNAi_.mjs} +2 -2
- package/.output/server/{_tanstack-start-manifest_v-BdKE8Xjm.mjs → _tanstack-start-manifest_v-BDWWBEf1.mjs} +1 -1
- package/.output/server/index.mjs +49 -49
- package/LICENSE.md +1 -1
- package/package.json +2 -1
- package/scripts/bootstrap-collections.mjs +2 -0
- package/.output/public/assets/index-CBGDT9fi.js +0 -334
- package/.output/public/assets/styles-CezfLgHY.css +0 -1
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports } from "./react.mjs";
|
|
2
|
+
import { c as composeEventHandlers } from "./radix-ui__primitive.mjs";
|
|
3
|
+
import { u as useComposedRefs } from "./radix-ui__react-compose-refs.mjs";
|
|
4
|
+
import { c as createContextScope, a as createContext2 } from "./radix-ui__react-context.mjs";
|
|
5
|
+
import { u as useId } from "./radix-ui__react-id.mjs";
|
|
6
|
+
import { u as useControllableState } from "./@radix-ui/react-use-controllable-state+[...].mjs";
|
|
7
|
+
import { D as DismissableLayer } from "./@radix-ui/react-dismissable-layer+[...].mjs";
|
|
8
|
+
import { F as FocusScope } from "./radix-ui__react-focus-scope.mjs";
|
|
9
|
+
import { P as Portal$1 } from "./radix-ui__react-portal.mjs";
|
|
10
|
+
import { P as Presence } from "./radix-ui__react-presence.mjs";
|
|
11
|
+
import { a as Primitive } from "./radix-ui__react-primitive.mjs";
|
|
12
|
+
import { u as useFocusGuards } from "./radix-ui__react-focus-guards.mjs";
|
|
13
|
+
import { R as ReactRemoveScroll } from "./react-remove-scroll.mjs";
|
|
14
|
+
import { h as hideOthers } from "./aria-hidden.mjs";
|
|
15
|
+
import { c as createSlot } from "./radix-ui__react-slot.mjs";
|
|
16
|
+
var DIALOG_NAME = "Dialog";
|
|
17
|
+
var [createDialogContext] = createContextScope(DIALOG_NAME);
|
|
18
|
+
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
19
|
+
var Dialog = (props) => {
|
|
20
|
+
const {
|
|
21
|
+
__scopeDialog,
|
|
22
|
+
children,
|
|
23
|
+
open: openProp,
|
|
24
|
+
defaultOpen,
|
|
25
|
+
onOpenChange,
|
|
26
|
+
modal = true
|
|
27
|
+
} = props;
|
|
28
|
+
const triggerRef = reactExports.useRef(null);
|
|
29
|
+
const contentRef = reactExports.useRef(null);
|
|
30
|
+
const [open, setOpen] = useControllableState({
|
|
31
|
+
prop: openProp,
|
|
32
|
+
defaultProp: defaultOpen ?? false,
|
|
33
|
+
onChange: onOpenChange,
|
|
34
|
+
caller: DIALOG_NAME
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
37
|
+
DialogProvider,
|
|
38
|
+
{
|
|
39
|
+
scope: __scopeDialog,
|
|
40
|
+
triggerRef,
|
|
41
|
+
contentRef,
|
|
42
|
+
contentId: useId(),
|
|
43
|
+
titleId: useId(),
|
|
44
|
+
descriptionId: useId(),
|
|
45
|
+
open,
|
|
46
|
+
onOpenChange: setOpen,
|
|
47
|
+
onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
48
|
+
modal,
|
|
49
|
+
children
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
Dialog.displayName = DIALOG_NAME;
|
|
54
|
+
var TRIGGER_NAME = "DialogTrigger";
|
|
55
|
+
var DialogTrigger = reactExports.forwardRef(
|
|
56
|
+
(props, forwardedRef) => {
|
|
57
|
+
const { __scopeDialog, ...triggerProps } = props;
|
|
58
|
+
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
59
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
60
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
61
|
+
Primitive.button,
|
|
62
|
+
{
|
|
63
|
+
type: "button",
|
|
64
|
+
"aria-haspopup": "dialog",
|
|
65
|
+
"aria-expanded": context.open,
|
|
66
|
+
"aria-controls": context.contentId,
|
|
67
|
+
"data-state": getState(context.open),
|
|
68
|
+
...triggerProps,
|
|
69
|
+
ref: composedTriggerRef,
|
|
70
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
DialogTrigger.displayName = TRIGGER_NAME;
|
|
76
|
+
var PORTAL_NAME = "DialogPortal";
|
|
77
|
+
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
78
|
+
forceMount: void 0
|
|
79
|
+
});
|
|
80
|
+
var DialogPortal = (props) => {
|
|
81
|
+
const { __scopeDialog, forceMount, children, container } = props;
|
|
82
|
+
const context = useDialogContext(PORTAL_NAME, __scopeDialog);
|
|
83
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: reactExports.Children.map(children, (child) => /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$1, { asChild: true, container, children: child }) })) });
|
|
84
|
+
};
|
|
85
|
+
DialogPortal.displayName = PORTAL_NAME;
|
|
86
|
+
var OVERLAY_NAME = "DialogOverlay";
|
|
87
|
+
var DialogOverlay = reactExports.forwardRef(
|
|
88
|
+
(props, forwardedRef) => {
|
|
89
|
+
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
90
|
+
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
91
|
+
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
92
|
+
return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
DialogOverlay.displayName = OVERLAY_NAME;
|
|
96
|
+
var Slot = createSlot("DialogOverlay.RemoveScroll");
|
|
97
|
+
var DialogOverlayImpl = reactExports.forwardRef(
|
|
98
|
+
(props, forwardedRef) => {
|
|
99
|
+
const { __scopeDialog, ...overlayProps } = props;
|
|
100
|
+
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
101
|
+
return (
|
|
102
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
103
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
104
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
105
|
+
Primitive.div,
|
|
106
|
+
{
|
|
107
|
+
"data-state": getState(context.open),
|
|
108
|
+
...overlayProps,
|
|
109
|
+
ref: forwardedRef,
|
|
110
|
+
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
111
|
+
}
|
|
112
|
+
) })
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
var CONTENT_NAME = "DialogContent";
|
|
117
|
+
var DialogContent = reactExports.forwardRef(
|
|
118
|
+
(props, forwardedRef) => {
|
|
119
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
120
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
121
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
122
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
DialogContent.displayName = CONTENT_NAME;
|
|
126
|
+
var DialogContentModal = reactExports.forwardRef(
|
|
127
|
+
(props, forwardedRef) => {
|
|
128
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
129
|
+
const contentRef = reactExports.useRef(null);
|
|
130
|
+
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
131
|
+
reactExports.useEffect(() => {
|
|
132
|
+
const content = contentRef.current;
|
|
133
|
+
if (content) return hideOthers(content);
|
|
134
|
+
}, []);
|
|
135
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
136
|
+
DialogContentImpl,
|
|
137
|
+
{
|
|
138
|
+
...props,
|
|
139
|
+
ref: composedRefs,
|
|
140
|
+
trapFocus: context.open,
|
|
141
|
+
disableOutsidePointerEvents: true,
|
|
142
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
context.triggerRef.current?.focus();
|
|
145
|
+
}),
|
|
146
|
+
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
147
|
+
const originalEvent = event.detail.originalEvent;
|
|
148
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
149
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
150
|
+
if (isRightClick) event.preventDefault();
|
|
151
|
+
}),
|
|
152
|
+
onFocusOutside: composeEventHandlers(
|
|
153
|
+
props.onFocusOutside,
|
|
154
|
+
(event) => event.preventDefault()
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
var DialogContentNonModal = reactExports.forwardRef(
|
|
161
|
+
(props, forwardedRef) => {
|
|
162
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
163
|
+
const hasInteractedOutsideRef = reactExports.useRef(false);
|
|
164
|
+
const hasPointerDownOutsideRef = reactExports.useRef(false);
|
|
165
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
166
|
+
DialogContentImpl,
|
|
167
|
+
{
|
|
168
|
+
...props,
|
|
169
|
+
ref: forwardedRef,
|
|
170
|
+
trapFocus: false,
|
|
171
|
+
disableOutsidePointerEvents: false,
|
|
172
|
+
onCloseAutoFocus: (event) => {
|
|
173
|
+
props.onCloseAutoFocus?.(event);
|
|
174
|
+
if (!event.defaultPrevented) {
|
|
175
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
}
|
|
178
|
+
hasInteractedOutsideRef.current = false;
|
|
179
|
+
hasPointerDownOutsideRef.current = false;
|
|
180
|
+
},
|
|
181
|
+
onInteractOutside: (event) => {
|
|
182
|
+
props.onInteractOutside?.(event);
|
|
183
|
+
if (!event.defaultPrevented) {
|
|
184
|
+
hasInteractedOutsideRef.current = true;
|
|
185
|
+
if (event.detail.originalEvent.type === "pointerdown") {
|
|
186
|
+
hasPointerDownOutsideRef.current = true;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const target = event.target;
|
|
190
|
+
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
191
|
+
if (targetIsTrigger) event.preventDefault();
|
|
192
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
var DialogContentImpl = reactExports.forwardRef(
|
|
201
|
+
(props, forwardedRef) => {
|
|
202
|
+
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
203
|
+
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
204
|
+
const contentRef = reactExports.useRef(null);
|
|
205
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
206
|
+
useFocusGuards();
|
|
207
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
208
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
209
|
+
FocusScope,
|
|
210
|
+
{
|
|
211
|
+
asChild: true,
|
|
212
|
+
loop: true,
|
|
213
|
+
trapped: trapFocus,
|
|
214
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
215
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
216
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
217
|
+
DismissableLayer,
|
|
218
|
+
{
|
|
219
|
+
role: "dialog",
|
|
220
|
+
id: context.contentId,
|
|
221
|
+
"aria-describedby": context.descriptionId,
|
|
222
|
+
"aria-labelledby": context.titleId,
|
|
223
|
+
"data-state": getState(context.open),
|
|
224
|
+
...contentProps,
|
|
225
|
+
ref: composedRefs,
|
|
226
|
+
onDismiss: () => context.onOpenChange(false)
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
232
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
|
|
233
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
234
|
+
] })
|
|
235
|
+
] });
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
var TITLE_NAME = "DialogTitle";
|
|
239
|
+
var DialogTitle = reactExports.forwardRef(
|
|
240
|
+
(props, forwardedRef) => {
|
|
241
|
+
const { __scopeDialog, ...titleProps } = props;
|
|
242
|
+
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
243
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
DialogTitle.displayName = TITLE_NAME;
|
|
247
|
+
var DESCRIPTION_NAME = "DialogDescription";
|
|
248
|
+
var DialogDescription = reactExports.forwardRef(
|
|
249
|
+
(props, forwardedRef) => {
|
|
250
|
+
const { __scopeDialog, ...descriptionProps } = props;
|
|
251
|
+
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
252
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
256
|
+
var CLOSE_NAME = "DialogClose";
|
|
257
|
+
var DialogClose = reactExports.forwardRef(
|
|
258
|
+
(props, forwardedRef) => {
|
|
259
|
+
const { __scopeDialog, ...closeProps } = props;
|
|
260
|
+
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
261
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
262
|
+
Primitive.button,
|
|
263
|
+
{
|
|
264
|
+
type: "button",
|
|
265
|
+
...closeProps,
|
|
266
|
+
ref: forwardedRef,
|
|
267
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
DialogClose.displayName = CLOSE_NAME;
|
|
273
|
+
function getState(open) {
|
|
274
|
+
return open ? "open" : "closed";
|
|
275
|
+
}
|
|
276
|
+
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
277
|
+
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
278
|
+
contentName: CONTENT_NAME,
|
|
279
|
+
titleName: TITLE_NAME,
|
|
280
|
+
docsSlug: "dialog"
|
|
281
|
+
});
|
|
282
|
+
var TitleWarning = ({ titleId }) => {
|
|
283
|
+
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
284
|
+
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
285
|
+
|
|
286
|
+
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
287
|
+
|
|
288
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
289
|
+
reactExports.useEffect(() => {
|
|
290
|
+
if (titleId) {
|
|
291
|
+
const hasTitle = document.getElementById(titleId);
|
|
292
|
+
if (!hasTitle) console.error(MESSAGE);
|
|
293
|
+
}
|
|
294
|
+
}, [MESSAGE, titleId]);
|
|
295
|
+
return null;
|
|
296
|
+
};
|
|
297
|
+
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
298
|
+
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
299
|
+
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
300
|
+
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
301
|
+
reactExports.useEffect(() => {
|
|
302
|
+
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
303
|
+
if (descriptionId && describedById) {
|
|
304
|
+
const hasDescription = document.getElementById(descriptionId);
|
|
305
|
+
if (!hasDescription) console.warn(MESSAGE);
|
|
306
|
+
}
|
|
307
|
+
}, [MESSAGE, contentRef, descriptionId]);
|
|
308
|
+
return null;
|
|
309
|
+
};
|
|
310
|
+
var Root = Dialog;
|
|
311
|
+
var Portal = DialogPortal;
|
|
312
|
+
var Overlay = DialogOverlay;
|
|
313
|
+
var Content = DialogContent;
|
|
314
|
+
export {
|
|
315
|
+
Content as C,
|
|
316
|
+
Overlay as O,
|
|
317
|
+
Portal as P,
|
|
318
|
+
Root as R
|
|
319
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { r as reactExports } from "./react.mjs";
|
|
2
|
+
var count = 0;
|
|
3
|
+
function useFocusGuards() {
|
|
4
|
+
reactExports.useEffect(() => {
|
|
5
|
+
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
6
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
7
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
8
|
+
count++;
|
|
9
|
+
return () => {
|
|
10
|
+
if (count === 1) {
|
|
11
|
+
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
12
|
+
}
|
|
13
|
+
count--;
|
|
14
|
+
};
|
|
15
|
+
}, []);
|
|
16
|
+
}
|
|
17
|
+
function createFocusGuard() {
|
|
18
|
+
const element = document.createElement("span");
|
|
19
|
+
element.setAttribute("data-radix-focus-guard", "");
|
|
20
|
+
element.tabIndex = 0;
|
|
21
|
+
element.style.outline = "none";
|
|
22
|
+
element.style.opacity = "0";
|
|
23
|
+
element.style.position = "fixed";
|
|
24
|
+
element.style.pointerEvents = "none";
|
|
25
|
+
return element;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
useFocusGuards as u
|
|
29
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports } from "./react.mjs";
|
|
2
|
+
import { u as useComposedRefs } from "./radix-ui__react-compose-refs.mjs";
|
|
3
|
+
import { a as Primitive } from "./radix-ui__react-primitive.mjs";
|
|
4
|
+
import { u as useCallbackRef } from "./@radix-ui/react-use-callback-ref+[...].mjs";
|
|
5
|
+
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
6
|
+
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
7
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
8
|
+
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
9
|
+
var FocusScope = reactExports.forwardRef((props, forwardedRef) => {
|
|
10
|
+
const {
|
|
11
|
+
loop = false,
|
|
12
|
+
trapped = false,
|
|
13
|
+
onMountAutoFocus: onMountAutoFocusProp,
|
|
14
|
+
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
15
|
+
...scopeProps
|
|
16
|
+
} = props;
|
|
17
|
+
const [container, setContainer] = reactExports.useState(null);
|
|
18
|
+
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
19
|
+
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
20
|
+
const lastFocusedElementRef = reactExports.useRef(null);
|
|
21
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
22
|
+
const focusScope = reactExports.useRef({
|
|
23
|
+
paused: false,
|
|
24
|
+
pause() {
|
|
25
|
+
this.paused = true;
|
|
26
|
+
},
|
|
27
|
+
resume() {
|
|
28
|
+
this.paused = false;
|
|
29
|
+
}
|
|
30
|
+
}).current;
|
|
31
|
+
reactExports.useEffect(() => {
|
|
32
|
+
if (trapped) {
|
|
33
|
+
let handleFocusIn2 = function(event) {
|
|
34
|
+
if (focusScope.paused || !container) return;
|
|
35
|
+
const target = event.target;
|
|
36
|
+
if (container.contains(target)) {
|
|
37
|
+
lastFocusedElementRef.current = target;
|
|
38
|
+
} else {
|
|
39
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
40
|
+
}
|
|
41
|
+
}, handleFocusOut2 = function(event) {
|
|
42
|
+
if (focusScope.paused || !container) return;
|
|
43
|
+
const relatedTarget = event.relatedTarget;
|
|
44
|
+
if (relatedTarget === null) return;
|
|
45
|
+
if (!container.contains(relatedTarget)) {
|
|
46
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
47
|
+
}
|
|
48
|
+
}, handleMutations2 = function(mutations) {
|
|
49
|
+
const focusedElement = document.activeElement;
|
|
50
|
+
if (focusedElement !== document.body) return;
|
|
51
|
+
for (const mutation of mutations) {
|
|
52
|
+
if (mutation.removedNodes.length > 0) focus(container);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
document.addEventListener("focusin", handleFocusIn2);
|
|
56
|
+
document.addEventListener("focusout", handleFocusOut2);
|
|
57
|
+
const mutationObserver = new MutationObserver(handleMutations2);
|
|
58
|
+
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
59
|
+
return () => {
|
|
60
|
+
document.removeEventListener("focusin", handleFocusIn2);
|
|
61
|
+
document.removeEventListener("focusout", handleFocusOut2);
|
|
62
|
+
mutationObserver.disconnect();
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}, [trapped, container, focusScope.paused]);
|
|
66
|
+
reactExports.useEffect(() => {
|
|
67
|
+
if (container) {
|
|
68
|
+
focusScopesStack.add(focusScope);
|
|
69
|
+
const previouslyFocusedElement = document.activeElement;
|
|
70
|
+
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
71
|
+
if (!hasFocusedCandidate) {
|
|
72
|
+
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
73
|
+
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
74
|
+
container.dispatchEvent(mountEvent);
|
|
75
|
+
if (!mountEvent.defaultPrevented) {
|
|
76
|
+
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
77
|
+
if (document.activeElement === previouslyFocusedElement) {
|
|
78
|
+
focus(container);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return () => {
|
|
83
|
+
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
86
|
+
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
87
|
+
container.dispatchEvent(unmountEvent);
|
|
88
|
+
if (!unmountEvent.defaultPrevented) {
|
|
89
|
+
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
90
|
+
}
|
|
91
|
+
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
92
|
+
focusScopesStack.remove(focusScope);
|
|
93
|
+
}, 0);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
97
|
+
const handleKeyDown = reactExports.useCallback(
|
|
98
|
+
(event) => {
|
|
99
|
+
if (!loop && !trapped) return;
|
|
100
|
+
if (focusScope.paused) return;
|
|
101
|
+
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
102
|
+
const focusedElement = document.activeElement;
|
|
103
|
+
if (isTabKey && focusedElement) {
|
|
104
|
+
const container2 = event.currentTarget;
|
|
105
|
+
const [first, last] = getTabbableEdges(container2);
|
|
106
|
+
const hasTabbableElementsInside = first && last;
|
|
107
|
+
if (!hasTabbableElementsInside) {
|
|
108
|
+
if (focusedElement === container2) event.preventDefault();
|
|
109
|
+
} else {
|
|
110
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
if (loop) focus(first, { select: true });
|
|
113
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
if (loop) focus(last, { select: true });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
[loop, trapped, focusScope.paused]
|
|
121
|
+
);
|
|
122
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
123
|
+
});
|
|
124
|
+
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
125
|
+
function focusFirst(candidates, { select = false } = {}) {
|
|
126
|
+
const previouslyFocusedElement = document.activeElement;
|
|
127
|
+
for (const candidate of candidates) {
|
|
128
|
+
focus(candidate, { select });
|
|
129
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function getTabbableEdges(container) {
|
|
133
|
+
const candidates = getTabbableCandidates(container);
|
|
134
|
+
const first = findVisible(candidates, container);
|
|
135
|
+
const last = findVisible(candidates.reverse(), container);
|
|
136
|
+
return [first, last];
|
|
137
|
+
}
|
|
138
|
+
function getTabbableCandidates(container) {
|
|
139
|
+
const nodes = [];
|
|
140
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
141
|
+
acceptNode: (node) => {
|
|
142
|
+
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
143
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
144
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
148
|
+
return nodes;
|
|
149
|
+
}
|
|
150
|
+
function findVisible(elements, container) {
|
|
151
|
+
for (const element of elements) {
|
|
152
|
+
if (!isHidden(element, { upTo: container })) return element;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function isHidden(node, { upTo }) {
|
|
156
|
+
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
157
|
+
while (node) {
|
|
158
|
+
if (upTo !== void 0 && node === upTo) return false;
|
|
159
|
+
if (getComputedStyle(node).display === "none") return true;
|
|
160
|
+
node = node.parentElement;
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
function isSelectableInput(element) {
|
|
165
|
+
return element instanceof HTMLInputElement && "select" in element;
|
|
166
|
+
}
|
|
167
|
+
function focus(element, { select = false } = {}) {
|
|
168
|
+
if (element && element.focus) {
|
|
169
|
+
const previouslyFocusedElement = document.activeElement;
|
|
170
|
+
element.focus({ preventScroll: true });
|
|
171
|
+
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
172
|
+
element.select();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
var focusScopesStack = createFocusScopesStack();
|
|
176
|
+
function createFocusScopesStack() {
|
|
177
|
+
let stack = [];
|
|
178
|
+
return {
|
|
179
|
+
add(focusScope) {
|
|
180
|
+
const activeFocusScope = stack[0];
|
|
181
|
+
if (focusScope !== activeFocusScope) {
|
|
182
|
+
activeFocusScope?.pause();
|
|
183
|
+
}
|
|
184
|
+
stack = arrayRemove(stack, focusScope);
|
|
185
|
+
stack.unshift(focusScope);
|
|
186
|
+
},
|
|
187
|
+
remove(focusScope) {
|
|
188
|
+
stack = arrayRemove(stack, focusScope);
|
|
189
|
+
stack[0]?.resume();
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function arrayRemove(array, item) {
|
|
194
|
+
const updatedArray = [...array];
|
|
195
|
+
const index = updatedArray.indexOf(item);
|
|
196
|
+
if (index !== -1) {
|
|
197
|
+
updatedArray.splice(index, 1);
|
|
198
|
+
}
|
|
199
|
+
return updatedArray;
|
|
200
|
+
}
|
|
201
|
+
function removeLinks(items) {
|
|
202
|
+
return items.filter((item) => item.tagName !== "A");
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
FocusScope as F
|
|
206
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { r as reactExports, R as React } from "./react.mjs";
|
|
2
|
+
import { u as useLayoutEffect2 } from "./@radix-ui/react-use-layout-effect+[...].mjs";
|
|
3
|
+
var useReactId = React[" useId ".trim().toString()] || (() => void 0);
|
|
4
|
+
var count = 0;
|
|
5
|
+
function useId(deterministicId) {
|
|
6
|
+
const [id, setId] = reactExports.useState(useReactId());
|
|
7
|
+
useLayoutEffect2(() => {
|
|
8
|
+
setId((reactId) => reactId ?? String(count++));
|
|
9
|
+
}, [deterministicId]);
|
|
10
|
+
return id ? `radix-${id}` : "";
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
useId as u
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports } from "./react.mjs";
|
|
2
|
+
import { a as ReactDOM } from "./react-dom.mjs";
|
|
3
|
+
import { a as Primitive } from "./radix-ui__react-primitive.mjs";
|
|
4
|
+
import { u as useLayoutEffect2 } from "./@radix-ui/react-use-layout-effect+[...].mjs";
|
|
5
|
+
var PORTAL_NAME = "Portal";
|
|
6
|
+
var Portal = reactExports.forwardRef((props, forwardedRef) => {
|
|
7
|
+
const { container: containerProp, ...portalProps } = props;
|
|
8
|
+
const [mounted, setMounted] = reactExports.useState(false);
|
|
9
|
+
useLayoutEffect2(() => setMounted(true), []);
|
|
10
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
11
|
+
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
12
|
+
});
|
|
13
|
+
Portal.displayName = PORTAL_NAME;
|
|
14
|
+
export {
|
|
15
|
+
Portal as P
|
|
16
|
+
};
|