@destyler/dialog 0.0.2 → 0.0.4
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/README.md +7 -0
- package/dist/component.cjs +38 -548
- package/dist/component.d.cts +303 -75
- package/dist/component.d.mts +303 -75
- package/dist/component.d.ts +303 -75
- package/dist/component.mjs +11 -537
- package/dist/index.cjs +19 -10
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -2
- package/dist/resolver.cjs +10 -10
- package/dist/resolver.d.cts +2 -2
- package/dist/resolver.d.mts +2 -2
- package/dist/resolver.d.ts +2 -2
- package/dist/resolver.mjs +10 -10
- package/dist/shared/dialog.1e7a01aa.mjs +514 -0
- package/dist/shared/dialog.d09a7a95.cjs +540 -0
- package/dist/shared/dialog.f396ab6e.d.cts +622 -0
- package/dist/shared/dialog.f396ab6e.d.mts +622 -0
- package/dist/shared/dialog.f396ab6e.d.ts +622 -0
- package/package.json +20 -21
- package/dist/shared/dialog.25aba8c4.d.cts +0 -420
- package/dist/shared/dialog.25aba8c4.d.mts +0 -420
- package/dist/shared/dialog.25aba8c4.d.ts +0 -420
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @destyler/dialog
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@destyler/dialog)
|
|
4
|
+
|
|
5
|
+
> before taking action, please confirm.
|
|
6
|
+
|
|
7
|
+
[GitHub](https://github.com/destyler/destyler) | [Documentation](https://destyler-dev.zeabur.app/)
|
package/dist/component.cjs
CHANGED
|
@@ -1,550 +1,40 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const contentElement = vue.ref();
|
|
42
|
-
const { modal } = vue.toRefs(props);
|
|
43
|
-
provideDialogRootContext({
|
|
44
|
-
open,
|
|
45
|
-
modal,
|
|
46
|
-
openModal: () => {
|
|
47
|
-
open.value = true;
|
|
48
|
-
},
|
|
49
|
-
onOpenChange: (value) => {
|
|
50
|
-
open.value = value;
|
|
51
|
-
},
|
|
52
|
-
onOpenToggle: () => {
|
|
53
|
-
open.value = !open.value;
|
|
54
|
-
},
|
|
55
|
-
contentId: composition.useId(),
|
|
56
|
-
titleId: composition.useId(),
|
|
57
|
-
descriptionId: composition.useId(),
|
|
58
|
-
triggerElement,
|
|
59
|
-
contentElement
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
render() {
|
|
63
|
-
return this.$slots.default?.();
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const destylerDialogCloseProps = {
|
|
68
|
-
asChild: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
required: false,
|
|
71
|
-
default: false
|
|
72
|
-
},
|
|
73
|
-
as: {
|
|
74
|
-
type: [String, Object],
|
|
75
|
-
required: false,
|
|
76
|
-
default: "button"
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
const DestylerDialogClose = vue.defineComponent({
|
|
80
|
-
name: "DestylerDialogClose",
|
|
81
|
-
props: destylerDialogCloseProps,
|
|
82
|
-
setup() {
|
|
83
|
-
const rootContext = injectDialogRootContext();
|
|
84
|
-
return {
|
|
85
|
-
rootContext
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
render() {
|
|
89
|
-
return vue.h(primitive.DestylerPrimitive, vue.mergeProps(this.$props, {
|
|
90
|
-
type: this.$props.as === "button" ? "button" : void 0,
|
|
91
|
-
onClick: () => {
|
|
92
|
-
this.rootContext.onOpenChange(false);
|
|
93
|
-
}
|
|
94
|
-
}), {
|
|
95
|
-
default: () => this.$slots.default?.()
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const destylerDialogContentImplProps = {
|
|
101
|
-
as: {
|
|
102
|
-
type: [String, Object],
|
|
103
|
-
required: false,
|
|
104
|
-
default: "div"
|
|
105
|
-
},
|
|
106
|
-
asChild: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
required: false,
|
|
109
|
-
default: false
|
|
110
|
-
},
|
|
111
|
-
forceMount: {
|
|
112
|
-
type: Boolean,
|
|
113
|
-
required: false
|
|
114
|
-
},
|
|
115
|
-
trapFocus: {
|
|
116
|
-
type: Boolean,
|
|
117
|
-
required: false,
|
|
118
|
-
default: false
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
const DestylerDialogContentImpl = vue.defineComponent({
|
|
122
|
-
name: "DestylerDialogContentImpl",
|
|
123
|
-
props: destylerDialogContentImplProps,
|
|
124
|
-
emits: ["openAutoFocus", "closeAutoFocus", "escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "dismiss"],
|
|
125
|
-
setup() {
|
|
126
|
-
const rootContext = injectDialogRootContext();
|
|
127
|
-
const { forwardRef, currentElement: contentElement } = composition.useForwardExpose();
|
|
128
|
-
vue.onMounted(() => {
|
|
129
|
-
rootContext.contentElement = contentElement;
|
|
130
|
-
});
|
|
131
|
-
return {
|
|
132
|
-
rootContext,
|
|
133
|
-
forwardRef
|
|
134
|
-
};
|
|
135
|
-
},
|
|
136
|
-
render() {
|
|
137
|
-
return vue.h(focusScope.DestylerFocusScope, {
|
|
138
|
-
asChild: true,
|
|
139
|
-
loop: true,
|
|
140
|
-
trapped: this.$props.trapFocus,
|
|
141
|
-
onMountAutoFocus: (event) => {
|
|
142
|
-
this.$emit("openAutoFocus", event);
|
|
143
|
-
},
|
|
144
|
-
onUnmountAutoFocus: (event) => {
|
|
145
|
-
this.$emit("closeAutoFocus", event);
|
|
146
|
-
}
|
|
147
|
-
}, vue.withDirectives(vue.h(dismissableLayer.DestylerDismissableLayer, vue.mergeProps(this.$attrs, {
|
|
148
|
-
"ref": (el) => this.forwardRef(el),
|
|
149
|
-
"as": this.$props.as,
|
|
150
|
-
"asChild": this.$props.asChild,
|
|
151
|
-
"role": "dialog",
|
|
152
|
-
"aria-describedby": this.rootContext.descriptionId,
|
|
153
|
-
"aria-labelledby": this.rootContext.titleId,
|
|
154
|
-
"data-state": shared.getOpenState(this.rootContext.open.value),
|
|
155
|
-
"isDismissable": true,
|
|
156
|
-
"onDismiss": () => {
|
|
157
|
-
this.rootContext.onOpenChange(false);
|
|
158
|
-
},
|
|
159
|
-
"onEscapeKeyDown": (event) => {
|
|
160
|
-
this.$emit("escapeKeyDown", event);
|
|
161
|
-
},
|
|
162
|
-
"onFocusOutside": (event) => {
|
|
163
|
-
this.$emit("focusOutside", event);
|
|
164
|
-
},
|
|
165
|
-
"onInteractOutside": (event) => {
|
|
166
|
-
this.$emit("interactOutside", event);
|
|
167
|
-
},
|
|
168
|
-
"onPointerDownOutside": (event) => {
|
|
169
|
-
this.$emit("pointerDownOutside", event);
|
|
170
|
-
}
|
|
171
|
-
}), {
|
|
172
|
-
default: () => this.$slots.default?.()
|
|
173
|
-
}), [
|
|
174
|
-
[directives.BindOnceDirective, { id: this.rootContext.contentId }]
|
|
175
|
-
]));
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
const DestylerDialogContentModal = vue.defineComponent({
|
|
180
|
-
name: "DestylerDialogContentModal",
|
|
181
|
-
props: destylerDialogContentImplProps,
|
|
182
|
-
emits: ["openAutoFocus", "closeAutoFocus", "escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "dismiss"],
|
|
183
|
-
setup(_, { emit }) {
|
|
184
|
-
const rootContext = injectDialogRootContext();
|
|
185
|
-
const emitsAsProps = composition.useEmitAsProps(emit);
|
|
186
|
-
const { forwardRef, currentElement } = composition.useForwardExpose();
|
|
187
|
-
composition.useHideOthers(currentElement);
|
|
188
|
-
return {
|
|
189
|
-
rootContext,
|
|
190
|
-
emitsAsProps,
|
|
191
|
-
forwardRef
|
|
192
|
-
};
|
|
193
|
-
},
|
|
194
|
-
render() {
|
|
195
|
-
return vue.h(DestylerDialogContentImpl, vue.mergeProps(this.$props, this.emitsAsProps, {
|
|
196
|
-
"ref": (el) => this.forwardRef(el),
|
|
197
|
-
"trap-focus": this.rootContext.open.value,
|
|
198
|
-
"disableOutsidePointerEvents": true,
|
|
199
|
-
"onCloseAutoFocus": (event) => {
|
|
200
|
-
this.$emit("closeAutoFocus", event);
|
|
201
|
-
if (!event.defaultPrevented) {
|
|
202
|
-
event.preventDefault();
|
|
203
|
-
this.rootContext.triggerElement.value?.focus();
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
"onPointerDownOutside": (event) => {
|
|
207
|
-
const originalEvent = event.detail.originalEvent;
|
|
208
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
209
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
210
|
-
if (isRightClick)
|
|
211
|
-
event.preventDefault();
|
|
212
|
-
},
|
|
213
|
-
"onFocusOutside": (event) => {
|
|
214
|
-
event.preventDefault();
|
|
215
|
-
},
|
|
216
|
-
"onOpenAutoFocus": (event) => {
|
|
217
|
-
this.$emit("openAutoFocus", event);
|
|
218
|
-
}
|
|
219
|
-
}), {
|
|
220
|
-
default: () => this.$slots.default?.()
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
const DestylerDialogContentNonModal = vue.defineComponent({
|
|
226
|
-
name: "DestylerDialogContentNonModal",
|
|
227
|
-
props: destylerDialogContentImplProps,
|
|
228
|
-
emits: ["openAutoFocus", "closeAutoFocus", "escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "dismiss"],
|
|
229
|
-
setup(_, { emit }) {
|
|
230
|
-
const rootContext = injectDialogRootContext();
|
|
231
|
-
const hasInteractedOutsideRef = vue.ref(false);
|
|
232
|
-
const hasPointerDownOutsideRef = vue.ref(false);
|
|
233
|
-
const emitsAsProps = composition.useEmitAsProps(emit);
|
|
234
|
-
return {
|
|
235
|
-
rootContext,
|
|
236
|
-
hasInteractedOutsideRef,
|
|
237
|
-
hasPointerDownOutsideRef,
|
|
238
|
-
emitsAsProps
|
|
239
|
-
};
|
|
240
|
-
},
|
|
241
|
-
render() {
|
|
242
|
-
return vue.h(DestylerDialogContentImpl, vue.mergeProps(this.$props, this.emitsAsProps, {
|
|
243
|
-
"trap-focus": false,
|
|
244
|
-
"disableOutsidePointerEvents": false,
|
|
245
|
-
"onCloseAutoFocus": (event) => {
|
|
246
|
-
this.$emit("closeAutoFocus", event);
|
|
247
|
-
if (!event.defaultPrevented) {
|
|
248
|
-
if (!this.hasInteractedOutsideRef)
|
|
249
|
-
this.rootContext.triggerElement.value?.focus();
|
|
250
|
-
event.preventDefault();
|
|
251
|
-
}
|
|
252
|
-
this.hasInteractedOutsideRef = false;
|
|
253
|
-
this.hasPointerDownOutsideRef = false;
|
|
254
|
-
},
|
|
255
|
-
"onInteractOutside": (event) => {
|
|
256
|
-
if (!event.defaultPrevented) {
|
|
257
|
-
this.hasInteractedOutsideRef = true;
|
|
258
|
-
if (event.detail.originalEvent.type === "pointerdown")
|
|
259
|
-
this.hasPointerDownOutsideRef = true;
|
|
260
|
-
}
|
|
261
|
-
const target = event.target;
|
|
262
|
-
const targetIsTrigger = this.rootContext.triggerElement.value?.contains(target);
|
|
263
|
-
if (targetIsTrigger)
|
|
264
|
-
event.preventDefault();
|
|
265
|
-
if (event.detail.originalEvent.type === "focusin" && this.hasPointerDownOutsideRef)
|
|
266
|
-
event.preventDefault();
|
|
267
|
-
}
|
|
268
|
-
}), {
|
|
269
|
-
default: () => this.$slots.default?.()
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
const destylerDialogContentProps = {
|
|
275
|
-
as: {
|
|
276
|
-
type: [String, Object],
|
|
277
|
-
required: false,
|
|
278
|
-
default: "div"
|
|
279
|
-
},
|
|
280
|
-
asChild: {
|
|
281
|
-
type: Boolean,
|
|
282
|
-
required: false,
|
|
283
|
-
default: false
|
|
284
|
-
},
|
|
285
|
-
forceMount: {
|
|
286
|
-
type: Boolean,
|
|
287
|
-
required: false
|
|
288
|
-
},
|
|
289
|
-
trapFocus: {
|
|
290
|
-
type: Boolean,
|
|
291
|
-
required: false,
|
|
292
|
-
default: false
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
const DestylerDialogContent = vue.defineComponent({
|
|
296
|
-
name: "DestylerDialogContent",
|
|
297
|
-
props: destylerDialogContentProps,
|
|
298
|
-
emits: ["openAutoFocus", "closeAutoFocus", "escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "dismiss"],
|
|
299
|
-
setup(_, { emit }) {
|
|
300
|
-
const rootContext = injectDialogRootContext();
|
|
301
|
-
const emitsAsProps = composition.useEmitAsProps(emit);
|
|
302
|
-
const { forwardRef } = composition.useForwardExpose();
|
|
303
|
-
return {
|
|
304
|
-
rootContext,
|
|
305
|
-
emitsAsProps,
|
|
306
|
-
forwardRef
|
|
307
|
-
};
|
|
308
|
-
},
|
|
309
|
-
render() {
|
|
310
|
-
const useVShow = this.rootContext.modal.value;
|
|
311
|
-
return vue.h(presence.DestylerPresence, {
|
|
312
|
-
present: this.$props.forceMount || this.rootContext.open.value
|
|
313
|
-
}, [
|
|
314
|
-
useVShow ? vue.h(DestylerDialogContentModal, vue.mergeProps(this.$props, this.emitsAsProps, this.$attrs, {
|
|
315
|
-
ref: (el) => this.forwardRef(el),
|
|
316
|
-
onOpenAutoFocus: (event) => {
|
|
317
|
-
this.$emit("openAutoFocus", event);
|
|
318
|
-
}
|
|
319
|
-
}), {
|
|
320
|
-
default: () => this.$slots.default?.()
|
|
321
|
-
}) : vue.h(DestylerDialogContentNonModal, vue.mergeProps(this.$props, this.emitsAsProps, this.$attrs), {
|
|
322
|
-
ref: (el) => this.forwardRef(el),
|
|
323
|
-
default: () => this.$slots.default?.()
|
|
324
|
-
})
|
|
325
|
-
]);
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
const destylerDialogDescriptionProps = {
|
|
330
|
-
asChild: {
|
|
331
|
-
type: Boolean,
|
|
332
|
-
required: false,
|
|
333
|
-
default: false
|
|
334
|
-
},
|
|
335
|
-
as: {
|
|
336
|
-
type: [String, Object],
|
|
337
|
-
required: false,
|
|
338
|
-
default: "p"
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
const DestylerDialogDescription = vue.defineComponent({
|
|
342
|
-
name: "DestylerDialogDescription",
|
|
343
|
-
props: destylerDialogDescriptionProps,
|
|
344
|
-
setup() {
|
|
345
|
-
const rootContext = injectDialogRootContext();
|
|
346
|
-
return {
|
|
347
|
-
rootContext
|
|
348
|
-
};
|
|
349
|
-
},
|
|
350
|
-
render() {
|
|
351
|
-
return vue.withDirectives(vue.h(primitive.DestylerPrimitive, {
|
|
352
|
-
as: this.$props.as,
|
|
353
|
-
asChild: this.$props.asChild
|
|
354
|
-
}, {
|
|
355
|
-
default: () => this.$slots.default?.()
|
|
356
|
-
}), [
|
|
357
|
-
[directives.BindOnceDirective, { id: this.rootContext.descriptionId }]
|
|
358
|
-
]);
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
const destylerDialogOverlayImplProps = {
|
|
363
|
-
as: {
|
|
364
|
-
type: [String, Object],
|
|
365
|
-
required: false,
|
|
366
|
-
default: "div"
|
|
367
|
-
},
|
|
368
|
-
asChild: {
|
|
369
|
-
type: Boolean,
|
|
370
|
-
required: false,
|
|
371
|
-
default: false
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
const DestylerDialogOverlayImpl = vue.defineComponent({
|
|
375
|
-
name: "DestylerDialogOverlayImpl",
|
|
376
|
-
props: destylerDialogOverlayImplProps,
|
|
377
|
-
setup() {
|
|
378
|
-
const rootContext = injectDialogRootContext();
|
|
379
|
-
composition.useForwardExpose();
|
|
380
|
-
return {
|
|
381
|
-
rootContext
|
|
382
|
-
};
|
|
383
|
-
},
|
|
384
|
-
render() {
|
|
385
|
-
return vue.h(primitive.DestylerPrimitive, {
|
|
386
|
-
"as": this.$props.as,
|
|
387
|
-
"asChild": this.$props.asChild,
|
|
388
|
-
"data-state": this.rootContext.open.value ? "open" : "closed",
|
|
389
|
-
"style": {
|
|
390
|
-
"pointer-events": "auto"
|
|
391
|
-
}
|
|
392
|
-
}, {
|
|
393
|
-
default: () => this.$slots.default?.()
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
const destylerDialogOverlayProps = {
|
|
399
|
-
as: {
|
|
400
|
-
type: [String, Object],
|
|
401
|
-
required: false,
|
|
402
|
-
default: "div"
|
|
403
|
-
},
|
|
404
|
-
asChild: {
|
|
405
|
-
type: Boolean,
|
|
406
|
-
required: false,
|
|
407
|
-
default: false
|
|
408
|
-
},
|
|
409
|
-
forceMount: {
|
|
410
|
-
type: Boolean,
|
|
411
|
-
required: false
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
const DestylerDialogOverlay = vue.defineComponent({
|
|
415
|
-
name: "DestylerDialogOverlay",
|
|
416
|
-
props: destylerDialogOverlayProps,
|
|
417
|
-
setup() {
|
|
418
|
-
const rootContext = injectDialogRootContext();
|
|
419
|
-
const { forwardRef } = composition.useForwardExpose();
|
|
420
|
-
return {
|
|
421
|
-
rootContext,
|
|
422
|
-
forwardRef
|
|
423
|
-
};
|
|
424
|
-
},
|
|
425
|
-
render() {
|
|
426
|
-
const useVShow = this.rootContext?.modal.value;
|
|
427
|
-
return useVShow ? vue.h(presence.DestylerPresence, {
|
|
428
|
-
present: this.$props.forceMount || this.rootContext.open.value
|
|
429
|
-
}, vue.h(DestylerDialogOverlayImpl, vue.mergeProps(this.$attrs, {
|
|
430
|
-
ref: (el) => this.forwardRef(el),
|
|
431
|
-
as: this.$props.as,
|
|
432
|
-
asChild: this.$props.asChild
|
|
433
|
-
}), {
|
|
434
|
-
default: () => this.$slots.default?.()
|
|
435
|
-
})) : null;
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
const destylerDialogPortalProps = {
|
|
440
|
-
as: {
|
|
441
|
-
type: [String, Object],
|
|
442
|
-
required: false,
|
|
443
|
-
default: "div"
|
|
444
|
-
},
|
|
445
|
-
asChild: {
|
|
446
|
-
type: Boolean,
|
|
447
|
-
required: false,
|
|
448
|
-
default: false
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
const DestylerDialogPortal = vue.defineComponent({
|
|
452
|
-
name: "DestylerDialogPortal",
|
|
453
|
-
props: destylerDialogPortalProps,
|
|
454
|
-
render() {
|
|
455
|
-
return vue.h(teleport.DestylerTeleport, {}, {
|
|
456
|
-
default: () => this.$slots.default?.()
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
const destylerDialogTitleProps = {
|
|
462
|
-
asChild: {
|
|
463
|
-
type: Boolean,
|
|
464
|
-
required: false,
|
|
465
|
-
default: false
|
|
466
|
-
},
|
|
467
|
-
as: {
|
|
468
|
-
type: [String, Object],
|
|
469
|
-
required: false,
|
|
470
|
-
default: "h2"
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
const DestylerDialogTitle = vue.defineComponent({
|
|
474
|
-
name: "DestylerDialogTitle",
|
|
475
|
-
props: destylerDialogTitleProps,
|
|
476
|
-
setup() {
|
|
477
|
-
const rootContext = injectDialogRootContext();
|
|
478
|
-
return {
|
|
479
|
-
rootContext
|
|
480
|
-
};
|
|
481
|
-
},
|
|
482
|
-
render() {
|
|
483
|
-
return vue.withDirectives(vue.h(primitive.DestylerPrimitive, {
|
|
484
|
-
as: this.$props.as,
|
|
485
|
-
asChild: this.$props.asChild
|
|
486
|
-
}, {
|
|
487
|
-
default: () => this.$slots.default?.()
|
|
488
|
-
}), [
|
|
489
|
-
[directives.BindOnceDirective, { id: this.rootContext.titleId }]
|
|
490
|
-
]);
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
const destylerDialogTriggerProps = {
|
|
495
|
-
asChild: {
|
|
496
|
-
type: Boolean,
|
|
497
|
-
required: false,
|
|
498
|
-
default: false
|
|
499
|
-
},
|
|
500
|
-
as: {
|
|
501
|
-
type: [String, Object],
|
|
502
|
-
required: false,
|
|
503
|
-
default: "button"
|
|
504
|
-
}
|
|
505
|
-
};
|
|
506
|
-
const DestylerDialogTrigger = vue.defineComponent({
|
|
507
|
-
name: "DestylerDialogTrigger",
|
|
508
|
-
props: destylerDialogTriggerProps,
|
|
509
|
-
setup() {
|
|
510
|
-
const rootContext = injectDialogRootContext();
|
|
511
|
-
const { forwardRef, currentElement } = composition.useForwardExpose();
|
|
512
|
-
vue.onMounted(() => {
|
|
513
|
-
rootContext.triggerElement = currentElement;
|
|
514
|
-
});
|
|
515
|
-
return {
|
|
516
|
-
rootContext,
|
|
517
|
-
forwardRef
|
|
518
|
-
};
|
|
519
|
-
},
|
|
520
|
-
render() {
|
|
521
|
-
return vue.h(primitive.DestylerPrimitive, vue.mergeProps(this.$attrs, {
|
|
522
|
-
"as": this.$props.as,
|
|
523
|
-
"asChild": this.$props.asChild,
|
|
524
|
-
"ref": (el) => this.forwardRef(el),
|
|
525
|
-
"type": this.$props.as === "button" ? "button" : void 0,
|
|
526
|
-
"aria-haspopup": "dialog",
|
|
527
|
-
"aria-expanded": this.rootContext.open.value || false,
|
|
528
|
-
"aria-controls": this.rootContext.contentId,
|
|
529
|
-
"data-state": this.rootContext.open.value ? "open" : "closed",
|
|
530
|
-
"onClick": () => {
|
|
531
|
-
this.rootContext.onOpenToggle();
|
|
532
|
-
}
|
|
533
|
-
}), {
|
|
534
|
-
default: () => this.$slots.default?.()
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
exports.DestylerDialogClose = DestylerDialogClose;
|
|
540
|
-
exports.DestylerDialogContent = DestylerDialogContent;
|
|
541
|
-
exports.DestylerDialogContentImpl = DestylerDialogContentImpl;
|
|
542
|
-
exports.DestylerDialogContentModal = DestylerDialogContentModal;
|
|
543
|
-
exports.DestylerDialogContentNonModal = DestylerDialogContentNonModal;
|
|
544
|
-
exports.DestylerDialogDescription = DestylerDialogDescription;
|
|
545
|
-
exports.DestylerDialogOverlay = DestylerDialogOverlay;
|
|
546
|
-
exports.DestylerDialogOverlayImpl = DestylerDialogOverlayImpl;
|
|
547
|
-
exports.DestylerDialogPortal = DestylerDialogPortal;
|
|
548
|
-
exports.DestylerDialogRoot = DestylerDialogRoot;
|
|
549
|
-
exports.DestylerDialogTitle = DestylerDialogTitle;
|
|
550
|
-
exports.DestylerDialogTrigger = DestylerDialogTrigger;
|
|
3
|
+
const index = require('./shared/dialog.d09a7a95.cjs');
|
|
4
|
+
require('vue');
|
|
5
|
+
require('@destyler/primitive');
|
|
6
|
+
require('@destyler/composition');
|
|
7
|
+
require('@destyler/shared');
|
|
8
|
+
require('@destyler/presence');
|
|
9
|
+
require('@destyler/focus-scope');
|
|
10
|
+
require('@destyler/dismissable-layer');
|
|
11
|
+
require('@destyler/dismissable-layer/component');
|
|
12
|
+
require('@destyler/directives');
|
|
13
|
+
require('@destyler/teleport');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
exports.DialogClose = index.DialogClose;
|
|
18
|
+
exports.DialogContent = index.DialogContent;
|
|
19
|
+
exports.DialogContentImpl = index.DialogContentImpl;
|
|
20
|
+
exports.DialogContentModal = index.DialogContentModal;
|
|
21
|
+
exports.DialogContentNonModal = index.DialogContentNonModal;
|
|
22
|
+
exports.DialogDescription = index.DialogDescription;
|
|
23
|
+
exports.DialogOverlay = index.DialogOverlay;
|
|
24
|
+
exports.DialogOverlayImpl = index.DialogOverlayImpl;
|
|
25
|
+
exports.DialogPortal = index.DialogPortal;
|
|
26
|
+
exports.DialogRoot = index.DialogRoot;
|
|
27
|
+
exports.DialogTitle = index.DialogTitle;
|
|
28
|
+
exports.DialogTrigger = index.DialogTrigger;
|
|
29
|
+
exports.dialogCloseProps = index.dialogCloseProps;
|
|
30
|
+
exports.dialogContentEmits = index.dialogContentEmits;
|
|
31
|
+
exports.dialogContentImplEmtis = index.dialogContentImplEmtis;
|
|
32
|
+
exports.dialogContentImplProps = index.dialogContentImplProps;
|
|
33
|
+
exports.dialogContentProps = index.dialogContentProps;
|
|
34
|
+
exports.dialogDescriptionProps = index.dialogDescriptionProps;
|
|
35
|
+
exports.dialogOverlayImplProps = index.dialogOverlayImplProps;
|
|
36
|
+
exports.dialogPortalProps = index.dialogPortalProps;
|
|
37
|
+
exports.dialogRootEmits = index.dialogRootEmits;
|
|
38
|
+
exports.dialogRootProps = index.dialogRootProps;
|
|
39
|
+
exports.dialogTitleProps = index.dialogTitleProps;
|
|
40
|
+
exports.dialogTriggerProps = index.dialogTriggerProps;
|