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