@pantograph/vue 0.32.0 → 0.32.2

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.
@@ -0,0 +1 @@
1
+ "use strict";const o=["Accordion","AccordionItem","ActionButton","Alert","Avatar","AvatarGroup","Badge","Breadcrumb","Button","ButtonGroup","Card","Checkbox","CheckboxGroup","Chip","ChipGroup","ColorPicker","ColorSwatch","ColorSwatchGroup","ColorTrigger","Combobox","ComboboxInput","Comment","CommentAction","CommentReaction","CommentMention","CommentEditor","CommentReactionListItem","CommentTrigger","ConfigProvider","DataTable","Dialog","DialogTitle","Divider","Drawer","DrawerTitle","DropZone","Empty","FloatButton","Form","FormItem","FormValidation","GOPicker","GraphicalObject","GraphicalObjectGroup","HoverCard","Icon","IconButton","Image","IndentLevel","Indicator","Input","InputNumber","Kbd","Label","Link","Menu","MenuItem","Modal","ModalTitle","Pagination","Popover","Progress","RadioGroup","RadioGroupItem","ScrollContainer","Segmented","Select","SelectOption","SelectLabel","Shortcut","Skeleton","Spinner","Steps","Step","SubMenu","Switch","Table","Th","Td","Tr","TBody","THead","TFoot","Tabs","TabList","TabTrigger","TabContent","Textarea","Tooltip","Tree","TreeNode","Upload","UploadList","UploadTrigger"];exports.components=o;
@@ -30,8 +30,10 @@ const o = [
30
30
  "ConfigProvider",
31
31
  "DataTable",
32
32
  "Dialog",
33
+ "DialogTitle",
33
34
  "Divider",
34
35
  "Drawer",
36
+ "DrawerTitle",
35
37
  "DropZone",
36
38
  "Empty",
37
39
  "FloatButton",
@@ -55,6 +57,7 @@ const o = [
55
57
  "Menu",
56
58
  "MenuItem",
57
59
  "Modal",
60
+ "ModalTitle",
58
61
  "Pagination",
59
62
  "Popover",
60
63
  "Progress",
@@ -1,3 +1,3 @@
1
- export declare const components: readonly ["Accordion", "AccordionItem", "ActionButton", "Alert", "Avatar", "AvatarGroup", "Badge", "Breadcrumb", "Button", "ButtonGroup", "Card", "Checkbox", "CheckboxGroup", "Chip", "ChipGroup", "ColorPicker", "ColorSwatch", "ColorSwatchGroup", "ColorTrigger", "Combobox", "ComboboxInput", "Comment", "CommentAction", "CommentReaction", "CommentMention", "CommentEditor", "CommentReactionListItem", "CommentTrigger", "ConfigProvider", "DataTable", "Dialog", "Divider", "Drawer", "DropZone", "Empty", "FloatButton", "Form", "FormItem", "FormValidation", "GOPicker", "GraphicalObject", "GraphicalObjectGroup", "HoverCard", "Icon", "IconButton", "Image", "IndentLevel", "Indicator", "Input", "InputNumber", "Kbd", "Label", "Link", "Menu", "MenuItem", "Modal", "Pagination", "Popover", "Progress", "RadioGroup", "RadioGroupItem", "ScrollContainer", "Segmented", "Select", "SelectOption", "SelectLabel", "Shortcut", "Skeleton", "Spinner", "Steps", "Step", "SubMenu", "Switch", "Table", "Th", "Td", "Tr", "TBody", "THead", "TFoot", "Tabs", "TabList", "TabTrigger", "TabContent", "Textarea", "Tooltip", "Tree", "TreeNode", "Upload", "UploadList", "UploadTrigger"];
1
+ export declare const components: readonly ["Accordion", "AccordionItem", "ActionButton", "Alert", "Avatar", "AvatarGroup", "Badge", "Breadcrumb", "Button", "ButtonGroup", "Card", "Checkbox", "CheckboxGroup", "Chip", "ChipGroup", "ColorPicker", "ColorSwatch", "ColorSwatchGroup", "ColorTrigger", "Combobox", "ComboboxInput", "Comment", "CommentAction", "CommentReaction", "CommentMention", "CommentEditor", "CommentReactionListItem", "CommentTrigger", "ConfigProvider", "DataTable", "Dialog", "DialogTitle", "Divider", "Drawer", "DrawerTitle", "DropZone", "Empty", "FloatButton", "Form", "FormItem", "FormValidation", "GOPicker", "GraphicalObject", "GraphicalObjectGroup", "HoverCard", "Icon", "IconButton", "Image", "IndentLevel", "Indicator", "Input", "InputNumber", "Kbd", "Label", "Link", "Menu", "MenuItem", "Modal", "ModalTitle", "Pagination", "Popover", "Progress", "RadioGroup", "RadioGroupItem", "ScrollContainer", "Segmented", "Select", "SelectOption", "SelectLabel", "Shortcut", "Skeleton", "Spinner", "Steps", "Step", "SubMenu", "Switch", "Table", "Th", "Td", "Tr", "TBody", "THead", "TFoot", "Tabs", "TabList", "TabTrigger", "TabContent", "Textarea", "Tooltip", "Tree", "TreeNode", "Upload", "UploadList", "UploadTrigger"];
2
2
  export default components;
3
3
  export type Components = (typeof components)[number];
@@ -23,6 +23,16 @@ export declare const DIALOG_DEFAULT_PROPS: {
23
23
  readonly type: "modal";
24
24
  readonly side: "end";
25
25
  readonly zIndex: 1000;
26
+ readonly asDrawerInMobile: false;
27
+ readonly mobileDrawerMinHeight: undefined;
28
+ readonly mobileDrawerHeight: undefined;
29
+ readonly mobileDrawerMaxHeight: undefined;
30
+ readonly noBody: false;
31
+ readonly headerCls: undefined;
32
+ readonly bodyCls: undefined;
33
+ readonly footerCls: undefined;
34
+ readonly swipeTriggerCls: undefined;
35
+ readonly swipeTrigger: undefined;
26
36
  readonly okProps: () => {
27
37
  readonly text: "Submit";
28
38
  };
@@ -147,6 +157,12 @@ export interface DialogSlots {
147
157
  cancelPostIcon?: (data?: object) => never;
148
158
  }
149
159
  export interface DialogProps extends Omit<DialogPortalProps, 'to'>, Omit<DialogContentProps, 'as' | 'asChild' | 'onCloseAutoFocus'> {
160
+ /**
161
+ * Custom styles for the dialog wrapper element
162
+ * @example
163
+ * <Dialog :wrapperStyle="{ backgroundColor: 'red' }" />
164
+ */
165
+ wrapperStyle?: StyleValue;
150
166
  /**
151
167
  * Custom styles for the dialog root element
152
168
  * @example
@@ -509,6 +525,7 @@ export type DialogEmits = DialogRootEmits & Pick<DialogContentEmits, 'pointerDow
509
525
  */
510
526
  close: [];
511
527
  };
528
+ export declare const dialogPrefix: string;
512
529
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<DialogProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
513
530
  cancel: (event: Event) => any;
514
531
  close: () => any;
@@ -532,14 +549,18 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Di
532
549
  mask: boolean;
533
550
  type: DialogType;
534
551
  width: DialogSize | number | string;
552
+ headerCls: string | number | bigint | boolean | import('clsx').ClassArray | import('clsx').ClassDictionary | null;
535
553
  open: boolean;
536
554
  openAutoFocus: boolean;
537
555
  side: DialogDrawerSide;
538
556
  zIndex: number;
539
557
  screen: boolean;
540
558
  closeable: boolean;
559
+ bodyCls: string | number | bigint | boolean | import('clsx').ClassArray | import('clsx').ClassDictionary | null;
541
560
  keyboard: boolean;
561
+ footerCls: string | number | bigint | boolean | import('clsx').ClassArray | import('clsx').ClassDictionary | null;
542
562
  trapFocus: boolean;
563
+ noBody: boolean;
543
564
  closeOnClickOutside: boolean;
544
565
  canFullScreen: boolean;
545
566
  fullScreen: boolean;
@@ -554,6 +575,12 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Di
554
575
  };
555
576
  maskClosable: boolean;
556
577
  animated: boolean | string;
578
+ asDrawerInMobile: boolean;
579
+ mobileDrawerMinHeight: number | string;
580
+ mobileDrawerHeight: number | string;
581
+ mobileDrawerMaxHeight: number | string;
582
+ swipeTriggerCls: string | number | bigint | boolean | import('clsx').ClassArray | import('clsx').ClassDictionary | null;
583
+ swipeTrigger: boolean;
557
584
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
558
585
  swipeTrigger: HTMLDivElement;
559
586
  }, any>, Readonly<DialogSlots> & DialogSlots>;
@@ -0,0 +1,23 @@
1
+ import { ClassValue } from 'clsx';
2
+ export interface DialogTitleSlots {
3
+ default?: (params?: object) => never;
4
+ }
5
+ export interface DialogTitleProps {
6
+ class?: ClassValue;
7
+ title?: string;
8
+ }
9
+ declare function __VLS_template(): {
10
+ attrs: Partial<{}>;
11
+ slots: Readonly<DialogTitleSlots> & DialogTitleSlots;
12
+ refs: {};
13
+ rootEl: any;
14
+ };
15
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
+ declare const __VLS_component: import('vue').DefineComponent<DialogTitleProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<DialogTitleProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
18
+ export default _default;
19
+ type __VLS_WithTemplateSlots<T, S> = T & {
20
+ new (): {
21
+ $slots: S;
22
+ };
23
+ };
@@ -1,3 +1,5 @@
1
1
  export declare const DialogPlugin: import('vue').Plugin;
2
+ export declare const DialogTitlePlugin: import('vue').Plugin;
2
3
  export { default as Dialog, type DialogProps, type DialogSlots, type DialogEmits, DIALOG_DEFAULT_PROPS, default, } from './Dialog';
4
+ export { default as DialogTitle, type DialogTitleProps, type DialogTitleSlots, } from './DialogTitle';
3
5
  export * from './Dialog.model';
@@ -1,14 +1,490 @@
1
- import { _ as o } from "../Dialog.vue_vue_type_style_index_0_lang-CGyB8Lwq.js";
2
- import { D, a as g, b as n, c as p } from "../Dialog.vue_vue_type_style_index_0_lang-CGyB8Lwq.js";
3
- import { installComponent as a } from "@pantograph/utils-vue";
4
- import { getComponentName as i } from "@pantograph/utils";
5
- const r = a(o, i("Dialog"));
1
+ import { defineComponent as oe, useSlots as ne, createBlock as N, openBlock as P, h as s, mergeDefaults as Te, useAttrs as Fe, ref as Y, computed as k, unref as r, withCtx as O, createVNode as w, normalizeProps as Me, guardReactiveProps as He, Transition as Ne, createCommentVNode as I, mergeProps as je, withDirectives as Ie, createElementVNode as ze, normalizeStyle as q, normalizeClass as M, createElementBlock as Ee, vShow as Ve } from "vue";
2
+ import { cva as J } from "class-variance-authority";
3
+ import { DialogTitle as We, DialogRoot as Re, DialogPortal as Le, Primitive as Ue, DialogContent as $e, DialogTrigger as Ke, DialogDescription as Ge } from "reka-ui";
4
+ import { isEmptyElement as f, useVModel as Q, installComponent as re } from "@pantograph/utils-vue";
5
+ import { getComponentOptions as ie, normCls as u, getBemElement as p, getBemBlock as Ye, generateVariantClassList as C, getValidNumber as qe, getPxSize as y, getBemModifier as H, getStyleObject as z, getComponentName as ae } from "@pantograph/utils";
6
+ import "clsx";
7
+ import { g as Je } from "../utils-DeYtvqtV.js";
8
+ import { _ as X } from "../IconButton.vue_vue_type_script_setup_true_lang-BWakPloG.js";
9
+ import "../Blanket/index.js";
10
+ import { isString as Z, isFunction as Qe } from "es-toolkit";
11
+ import { _ } from "../index-BQAmXDSs.js";
12
+ import { usePointerSwipe as Xe } from "@vueuse/core";
13
+ import { _ as ee } from "../Button.vue_vue_type_script_setup_true_lang-Be-JRcnm.js";
14
+ import { _ as Ze } from "../Blanket.vue_vue_type_style_index_0_lang-DSXcWX6s.js";
15
+ const le = /* @__PURE__ */ oe({
16
+ ...ie("DialogTitle"),
17
+ __name: "DialogTitle",
18
+ props: {
19
+ class: { type: [Array, Object, String, Number, null, Boolean] },
20
+ title: {}
21
+ },
22
+ setup(i) {
23
+ const S = ne(), c = i, e = () => {
24
+ var v;
25
+ const n = (v = S.default) == null ? void 0 : v.call(S, {}), D = !f(n);
26
+ if (D || c.title)
27
+ return s(
28
+ We,
29
+ { class: u(p(a, "title"), c.class) },
30
+ () => D ? n : c.title
31
+ );
32
+ };
33
+ return (n, D) => (P(), N(e));
34
+ }
35
+ }), te = ["sm", "md", "lg"], _e = ["modal", "drawer"], et = ["start", "top", "end", "bottom"], tt = ["data-screen"], se = {
36
+ text: "Submit"
37
+ }, ce = {
38
+ text: "Cancel",
39
+ type: "ghost",
40
+ color: "neutral"
41
+ }, ot = {
42
+ keyboard: !0,
43
+ openAutoFocus: !1,
44
+ trapFocus: !1,
45
+ closeOnClickOutside: !1,
46
+ footer: void 0,
47
+ open: !1,
48
+ canFullScreen: !0,
49
+ animated: !0,
50
+ fullScreen: !1,
51
+ width: "md",
52
+ frameless: !1,
53
+ closeable: !0,
54
+ mask: !0,
55
+ maskClosable: !0,
56
+ screen: !0,
57
+ type: "modal",
58
+ side: "end",
59
+ zIndex: 1e3,
60
+ asDrawerInMobile: !1,
61
+ mobileDrawerMinHeight: void 0,
62
+ mobileDrawerHeight: void 0,
63
+ mobileDrawerMaxHeight: void 0,
64
+ noBody: !1,
65
+ headerCls: void 0,
66
+ bodyCls: void 0,
67
+ footerCls: void 0,
68
+ swipeTriggerCls: void 0,
69
+ swipeTrigger: void 0,
70
+ okProps: () => se,
71
+ cancelProps: () => ce
72
+ }, a = Ye("dialog"), nt = /* @__PURE__ */ oe({
73
+ ...ie("Dialog", !1),
74
+ __name: "Dialog",
75
+ props: /* @__PURE__ */ Te({
76
+ wrapperStyle: { type: [Boolean, null, String, Object, Array] },
77
+ style: { type: [Boolean, null, String, Object, Array] },
78
+ contentStyle: { type: [Boolean, null, String, Object, Array] },
79
+ noBody: { type: Boolean },
80
+ keyboard: { type: Boolean },
81
+ openAutoFocus: { type: Boolean },
82
+ trapFocus: { type: Boolean },
83
+ closeOnClickOutside: { type: Boolean },
84
+ open: { type: Boolean },
85
+ canFullScreen: { type: Boolean },
86
+ fullScreen: { type: Boolean },
87
+ minWidth: {},
88
+ width: {},
89
+ maxWidth: {},
90
+ minHeight: {},
91
+ height: {},
92
+ maxHeight: {},
93
+ title: {},
94
+ description: {},
95
+ frameless: { type: Boolean },
96
+ footer: { type: [Boolean, null] },
97
+ closeable: { type: Boolean },
98
+ zIndex: {},
99
+ okProps: {},
100
+ cancelProps: {},
101
+ mask: { type: Boolean },
102
+ maskClosable: { type: Boolean },
103
+ beforeClose: { type: Function },
104
+ beforeCloseDebugger: { type: Boolean },
105
+ to: { type: [String, Function] },
106
+ animated: { type: [Boolean, String] },
107
+ type: {},
108
+ asDrawerInMobile: { type: Boolean },
109
+ mobileDrawerMinHeight: {},
110
+ mobileDrawerHeight: {},
111
+ mobileDrawerMaxHeight: {},
112
+ side: {},
113
+ wrapperCls: { type: [Array, Object, String, Number, null, Boolean] },
114
+ class: { type: [Array, Object, String, Number, null, Boolean] },
115
+ blanketCls: { type: [Array, Object, String, Number, null, Boolean] },
116
+ contentCls: { type: [Array, Object, String, Number, null, Boolean] },
117
+ headerCls: { type: [Array, Object, String, Number, null, Boolean] },
118
+ titleWrapperCls: { type: [Array, Object, String, Number, null, Boolean] },
119
+ titleCls: { type: [Array, Object, String, Number, null, Boolean] },
120
+ descriptionCls: { type: [Array, Object, String, Number, null, Boolean] },
121
+ actionsCls: { type: [Array, Object, String, Number, null, Boolean] },
122
+ bodyCls: { type: [Array, Object, String, Number, null, Boolean] },
123
+ footerCls: { type: [Array, Object, String, Number, null, Boolean] },
124
+ swipeTriggerCls: { type: [Array, Object, String, Number, null, Boolean] },
125
+ screen: { type: Boolean },
126
+ swipeTrigger: { type: Boolean },
127
+ disabled: { type: Boolean },
128
+ defer: { type: Boolean },
129
+ forceMount: { type: Boolean },
130
+ disableOutsidePointerEvents: { type: Boolean }
131
+ }, ot),
132
+ emits: ["update:open", "pointerDownOutside", "escapeKeyDown", "focusOutside", "update:fullScreen", "ok", "cancel", "close"],
133
+ setup(i, { emit: S }) {
134
+ const c = S, e = i, n = ne(), D = Fe(), v = Y(), j = Je({ triggerRef: v, props: e }), A = Q(e, "open", c, {
135
+ passive: e.open === void 0,
136
+ onChange(t) {
137
+ t || c("close");
138
+ }
139
+ }), x = async (t) => {
140
+ if (!t && Qe(e.beforeClose))
141
+ try {
142
+ const o = await e.beforeClose();
143
+ if (e.beforeCloseDebugger && console.info("beforeClose response", o), !o)
144
+ return;
145
+ } catch (o) {
146
+ e.beforeCloseDebugger && console.error("beforeClose error", o);
147
+ return;
148
+ }
149
+ A.value = t;
150
+ }, b = Q(e, "fullScreen", c, {}), ue = () => {
151
+ e.canFullScreen && (b.value = !b.value);
152
+ }, de = (t) => {
153
+ c("ok", t);
154
+ }, pe = (t) => {
155
+ c("cancel", t);
156
+ }, me = () => {
157
+ e.maskClosable && x(!1);
158
+ }, fe = J(a, {
159
+ variants: {
160
+ frameless: C("frameless", a),
161
+ fullscreen: C("fullscreen", a),
162
+ width: C([...te, "custom"], a),
163
+ type: C(_e, a),
164
+ side: C(et, a)
165
+ }
166
+ }), E = p(a, "content"), ge = J(E, {
167
+ variants: {
168
+ swiping: C("swiping", E)
169
+ }
170
+ }), m = k(() => {
171
+ let t = qe(e.width);
172
+ return t !== void 0 ? t = `${t}px` : Z(e.width) && !te.includes(e.width) && (t = e.width), {
173
+ widthVariant: t ? "custom" : e.width,
174
+ minWidth: y(e.minWidth, !0),
175
+ width: t,
176
+ maxWidth: y(e.maxWidth, !0),
177
+ minHeight: y(e.minHeight, !0),
178
+ height: y(e.height, !0),
179
+ maxHeight: y(e.maxHeight, !0),
180
+ mobileDrawerMinHeight: y(e.mobileDrawerMinHeight, !0),
181
+ mobileDrawerHeight: y(e.mobileDrawerHeight, !0),
182
+ mobileDrawerMaxHeight: y(e.mobileDrawerMaxHeight, !0)
183
+ };
184
+ }), ye = () => {
185
+ var o;
186
+ const t = (o = n.trigger) == null ? void 0 : o.call(n, {});
187
+ if (!f(t))
188
+ return s(
189
+ Ke,
190
+ {
191
+ asChild: !0,
192
+ ref: v
193
+ },
194
+ () => t
195
+ );
196
+ }, be = () => {
197
+ var o;
198
+ const t = (o = n.beforeTitle) == null ? void 0 : o.call(n, {});
199
+ if (!f(t)) return t;
200
+ }, he = () => {
201
+ const t = () => {
202
+ var g;
203
+ const d = (g = n.beforeActions) == null ? void 0 : g.call(n, {});
204
+ if (!f(d)) return d;
205
+ }, o = () => {
206
+ const d = [];
207
+ if (e.canFullScreen && d.push(
208
+ s(X, {
209
+ icon: b.value ? "tabler:arrows-minimize" : "tabler:arrows-maximize",
210
+ type: "ghost",
211
+ color: "neutral",
212
+ onClick: ue
213
+ })
214
+ ), e.closeable && d.push(
215
+ s(X, {
216
+ icon: "tabler:x",
217
+ type: "ghost",
218
+ color: "neutral",
219
+ onClick: () => x(!1)
220
+ })
221
+ ), d.length) return s(_, { gap: "sm" }, () => d);
222
+ }, l = t(), h = o();
223
+ if (l || h)
224
+ return s("div", { class: u(p(a, "actions"), e.actionsCls) }, [
225
+ l,
226
+ h
227
+ ]);
228
+ }, we = () => {
229
+ var l;
230
+ const t = (l = n.title) == null ? void 0 : l.call(n, {}), o = !f(t);
231
+ if (e.title || o)
232
+ return s(le, { class: e.titleCls }, () => o ? t : e.title);
233
+ }, Ce = () => {
234
+ var l;
235
+ const t = (l = n.description) == null ? void 0 : l.call(n, {}), o = !f(t);
236
+ if (e.description || o)
237
+ return s(
238
+ Ge,
239
+ {
240
+ class: u(
241
+ p(a, "description"),
242
+ "paragraph",
243
+ e.descriptionCls
244
+ )
245
+ },
246
+ () => o ? t : e.description
247
+ );
248
+ }, Se = () => {
249
+ const t = he(), o = be();
250
+ if (e.frameless) return t;
251
+ const l = () => {
252
+ const g = we();
253
+ if (g || t || o)
254
+ return s(
255
+ "div",
256
+ { class: u(p(a, "title_wrapper"), e.titleWrapperCls) },
257
+ [o, g, t]
258
+ );
259
+ }, h = Ce(), d = l();
260
+ if (d || h)
261
+ return s(
262
+ "div",
263
+ {
264
+ class: u(p(a, "header"), e.headerCls)
265
+ },
266
+ [d, h]
267
+ );
268
+ }, De = () => {
269
+ var U, $;
270
+ const t = (U = n.footer) == null ? void 0 : U.call(n, {}), o = !f(t), l = ($ = n.beforeFooterActions) == null ? void 0 : $.call(n, {}), h = !f(l);
271
+ if (e.footer !== void 0 && !e.footer) return null;
272
+ const g = o ? t : (() => {
273
+ var K, G;
274
+ const T = [];
275
+ (K = e.cancelProps) != null && K.hide || T.push(
276
+ s(
277
+ ee,
278
+ {
279
+ ...ce,
280
+ ...e.cancelProps ?? {},
281
+ onClick: pe
282
+ },
283
+ {
284
+ default: n.cancel,
285
+ preIcon: n.cancelPreIcon,
286
+ postIcon: n.cancelPostIcon
287
+ }
288
+ )
289
+ ), (G = e.okProps) != null && G.hide || T.push(
290
+ s(
291
+ ee,
292
+ {
293
+ ...se,
294
+ ...e.okProps ?? {},
295
+ onClick: de
296
+ },
297
+ {
298
+ default: n.ok,
299
+ preIcon: n.okPreIcon,
300
+ postIcon: n.okPostIcon
301
+ }
302
+ )
303
+ );
304
+ const F = [];
305
+ if (h && F.push(l), T.length && F.push(s(_, { gap: "sm" }, () => T)), F.length) return F;
306
+ })();
307
+ if (g)
308
+ return s(
309
+ "div",
310
+ { class: u(p(a, "footer"), e.footerCls) },
311
+ g
312
+ );
313
+ }, ve = () => {
314
+ var o;
315
+ const t = (o = n.default) == null ? void 0 : o.call(n, {});
316
+ if (!f(t))
317
+ return e.noBody ? t : s(
318
+ "div",
319
+ {
320
+ class: u(p(a, "body"), e.bodyCls)
321
+ },
322
+ t
323
+ );
324
+ }, Be = k(() => {
325
+ if (e.animated && Z(e.animated)) return e.animated;
326
+ if (e.type === "modal") return H(a, "fade");
327
+ switch (e.side) {
328
+ case "start":
329
+ case "end":
330
+ return H(a, "side-x");
331
+ case "bottom":
332
+ case "top":
333
+ return H(a, "side-y");
334
+ }
335
+ }), ke = k(() => {
336
+ switch (e.side) {
337
+ case "start":
338
+ case "top":
339
+ return -1;
340
+ case "bottom":
341
+ case "end":
342
+ return 1;
343
+ }
344
+ }), B = k(
345
+ () => !b.value && m.value.widthVariant !== "custom" && !(e.type === "drawer" && ["top", "bottom"].includes(e.side))
346
+ ), V = Y(), { isSwiping: W, direction: R, distanceY: L } = Xe(V, {
347
+ disableTextSelect: !0,
348
+ threshold: 50,
349
+ onSwipeEnd() {
350
+ e.type === "drawer" && e.closeable && (e.side === "bottom" && R.value === "down" || e.side === "top" && R.value === "up") && x(!1);
351
+ }
352
+ }), Oe = k(() => {
353
+ if (!W.value || e.type !== "drawer" || !["top", "bottom"].includes(e.side))
354
+ return;
355
+ const t = Math.min(Math.abs(L.value) / 100, 1);
356
+ let o = -L.value * t * 0.6;
357
+ return e.side === "top" ? o = Math.min(0, o) : o = Math.max(0, o), o;
358
+ }), Pe = (t) => {
359
+ (!e.keyboard || !e.open) && (t.preventDefault(), t.stopPropagation()), e.open && c("escapeKeyDown", t);
360
+ }, Ae = (t) => {
361
+ e.openAutoFocus || (t.preventDefault(), t.stopPropagation());
362
+ }, xe = (t) => {
363
+ (!e.closeOnClickOutside || !e.open) && (t.preventDefault(), t.stopPropagation());
364
+ };
365
+ return (t, o) => (P(), N(r(Re), {
366
+ open: r(A),
367
+ "onUpdate:open": x,
368
+ modal: i.trapFocus
369
+ }, {
370
+ default: O(() => [
371
+ w(ye),
372
+ w(r(Le), Me(He(r(j))), {
373
+ default: O(() => [
374
+ w(Ne, {
375
+ name: Be.value,
376
+ css: !!i.animated,
377
+ duration: i.type === "drawer" ? 250 : 200
378
+ }, {
379
+ default: O(() => [
380
+ r(j).forceMount || r(A) ? (P(), N(r(Ue), je({
381
+ "as-child": !B.value || !i.screen,
382
+ key: String(!B.value || !i.screen),
383
+ class: {
384
+ [r(u)("pc_grid", r(p)(r(a), "wrapper"), i.wrapperCls)]: B.value && i.screen,
385
+ [r(H)(r(a), "as-drawer-in-mobile")]: e.type === "modal" && i.asDrawerInMobile
386
+ }
387
+ }, r(D), {
388
+ style: {
389
+ zIndex: i.zIndex,
390
+ "--ptc-dialog-transform": i.fullScreen || i.type === "modal" ? "20px" : "100%",
391
+ "--ptc-dialog-transform-ratio": ke.value,
392
+ ...r(z)(B.value && i.screen ? i.wrapperStyle : {})
393
+ }
394
+ }), {
395
+ default: O(() => [
396
+ Ie(ze("div", {
397
+ "data-screen": i.screen ? "" : void 0,
398
+ class: M(
399
+ r(u)(
400
+ {
401
+ pc_grid__container: B.value
402
+ },
403
+ r(fe)({
404
+ frameless: i.frameless,
405
+ fullscreen: r(b),
406
+ width: m.value.widthVariant,
407
+ type: i.type,
408
+ side: i.side
409
+ }),
410
+ e.class
411
+ )
412
+ ),
413
+ style: q({
414
+ "--ptc-dialog-w": m.value.width,
415
+ "--ptc-dialog-min-h": m.value.minHeight,
416
+ "--ptc-dialog-h": m.value.height,
417
+ "--ptc-dialog-max-h": m.value.maxHeight,
418
+ "--ptc-dialog-mobile-drawer-min-h": m.value.mobileDrawerMinHeight,
419
+ "--ptc-dialog-mobile-drawer-h": m.value.mobileDrawerHeight,
420
+ "--ptc-dialog-mobile-drawer-max-h": m.value.mobileDrawerMaxHeight,
421
+ ...r(z)(i.style)
422
+ })
423
+ }, [
424
+ !r(b) && i.mask ? (P(), N(r(Ze), {
425
+ key: 0,
426
+ onClick: me,
427
+ class: M(r(u)(r(p)(r(a), "blanket"), i.blanketCls)),
428
+ screen: !1
429
+ }, null, 8, ["class"])) : I("", !0),
430
+ w(r($e), {
431
+ forceMount: r(j).forceMount,
432
+ onInteractOutside: xe,
433
+ onOpenAutoFocus: Ae,
434
+ onEscapeKeyDown: Pe,
435
+ onPointerDownOutside: o[0] || (o[0] = (l) => c("pointerDownOutside", l)),
436
+ onFocusOutside: o[1] || (o[1] = (l) => c("focusOutside", l)),
437
+ class: M(
438
+ r(u)(
439
+ r(ge)({
440
+ swiping: r(W)
441
+ }),
442
+ i.contentCls
443
+ )
444
+ ),
445
+ style: q({
446
+ "--ptc-dialog-swipe-transform": Oe.value,
447
+ ...r(z)(i.contentStyle)
448
+ })
449
+ }, {
450
+ default: O(() => [
451
+ w(Se),
452
+ w(ve),
453
+ w(De),
454
+ e.swipeTrigger && i.type === "drawer" && ["top", "bottom"].includes(e.side) && !r(b) ? (P(), Ee("div", {
455
+ key: 0,
456
+ ref_key: "swipeTrigger",
457
+ ref: V,
458
+ class: M(r(u)(r(p)(r(a), "swipe_trigger"), i.swipeTriggerCls))
459
+ }, null, 2)) : I("", !0)
460
+ ]),
461
+ _: 1
462
+ }, 8, ["forceMount", "class", "style"])
463
+ ], 14, tt), [
464
+ [Ve, r(A)]
465
+ ])
466
+ ]),
467
+ _: 1
468
+ }, 16, ["as-child", "class", "style"])) : I("", !0)
469
+ ]),
470
+ _: 1
471
+ }, 8, ["name", "css", "duration"])
472
+ ]),
473
+ _: 1
474
+ }, 16)
475
+ ]),
476
+ _: 1
477
+ }, 8, ["open", "modal"]));
478
+ }
479
+ }), ht = re(nt, ae("Dialog")), wt = re(le, ae("DialogTitle"));
6
480
  export {
7
- D as DIALOG_DEFAULT_PROPS,
8
- o as Dialog,
9
- g as DialogDrawerSides,
10
- r as DialogPlugin,
11
- n as DialogSizes,
12
- p as DialogTypes,
13
- o as default
481
+ ot as DIALOG_DEFAULT_PROPS,
482
+ nt as Dialog,
483
+ et as DialogDrawerSides,
484
+ ht as DialogPlugin,
485
+ te as DialogSizes,
486
+ le as DialogTitle,
487
+ wt as DialogTitlePlugin,
488
+ _e as DialogTypes,
489
+ nt as default
14
490
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../Dialog.vue_vue_type_style_index_0_lang-C1VasmFh.js"),i=require("@pantograph/utils-vue"),l=require("@pantograph/utils"),o=i.installComponent(e._sfc_main,l.getComponentName("Dialog"));exports.DIALOG_DEFAULT_PROPS=e.DIALOG_DEFAULT_PROPS;exports.Dialog=e._sfc_main;exports.DialogDrawerSides=e.DialogDrawerSides;exports.DialogSizes=e.DialogSizes;exports.DialogTypes=e.DialogTypes;exports.default=e._sfc_main;exports.DialogPlugin=o;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),I=require("class-variance-authority"),y=require("reka-ui"),c=require("@pantograph/utils-vue"),n=require("@pantograph/utils");require("clsx");const ge=require("../utils-V8eBZdnq.js"),_=require("../IconButton.vue_vue_type_script_setup_true_lang-D3l2EAmu.js");require("../Blanket/index.umd.cjs");const P=require("es-toolkit"),q=require("../index-BOecemV4.js"),fe=require("@vueuse/core"),L=require("../Button.vue_vue_type_script_setup_true_lang-DuzKM6AI.js"),ye=require("../Blanket.vue_vue_type_style_index_0_lang-WQSz_s3C.js"),x=e.defineComponent({...n.getComponentOptions("DialogTitle"),__name:"DialogTitle",props:{class:{type:[Array,Object,String,Number,null,Boolean]},title:{}},setup(l){const h=e.useSlots(),u=l,t=()=>{var C;const i=(C=h.default)==null?void 0:C.call(h,{}),b=!c.isEmptyElement(i);if(b||u.title)return e.h(y.DialogTitle,{class:n.normCls(n.getBemElement(a,"title"),u.class)},()=>b?i:u.title)};return(i,b)=>(e.openBlock(),e.createBlock(t))}}),O=["sm","md","lg"],W=["modal","drawer"],R=["start","top","end","bottom"],he=["data-screen"],U={text:"Submit"},G={text:"Cancel",type:"ghost",color:"neutral"},K={keyboard:!0,openAutoFocus:!1,trapFocus:!1,closeOnClickOutside:!1,footer:void 0,open:!1,canFullScreen:!0,animated:!0,fullScreen:!1,width:"md",frameless:!1,closeable:!0,mask:!0,maskClosable:!0,screen:!0,type:"modal",side:"end",zIndex:1e3,asDrawerInMobile:!1,mobileDrawerMinHeight:void 0,mobileDrawerHeight:void 0,mobileDrawerMaxHeight:void 0,noBody:!1,headerCls:void 0,bodyCls:void 0,footerCls:void 0,swipeTriggerCls:void 0,swipeTrigger:void 0,okProps:()=>U,cancelProps:()=>G},a=n.getBemBlock("dialog"),E=e.defineComponent({...n.getComponentOptions("Dialog",!1),__name:"Dialog",props:e.mergeDefaults({wrapperStyle:{type:[Boolean,null,String,Object,Array]},style:{type:[Boolean,null,String,Object,Array]},contentStyle:{type:[Boolean,null,String,Object,Array]},noBody:{type:Boolean},keyboard:{type:Boolean},openAutoFocus:{type:Boolean},trapFocus:{type:Boolean},closeOnClickOutside:{type:Boolean},open:{type:Boolean},canFullScreen:{type:Boolean},fullScreen:{type:Boolean},minWidth:{},width:{},maxWidth:{},minHeight:{},height:{},maxHeight:{},title:{},description:{},frameless:{type:Boolean},footer:{type:[Boolean,null]},closeable:{type:Boolean},zIndex:{},okProps:{},cancelProps:{},mask:{type:Boolean},maskClosable:{type:Boolean},beforeClose:{type:Function},beforeCloseDebugger:{type:Boolean},to:{type:[String,Function]},animated:{type:[Boolean,String]},type:{},asDrawerInMobile:{type:Boolean},mobileDrawerMinHeight:{},mobileDrawerHeight:{},mobileDrawerMaxHeight:{},side:{},wrapperCls:{type:[Array,Object,String,Number,null,Boolean]},class:{type:[Array,Object,String,Number,null,Boolean]},blanketCls:{type:[Array,Object,String,Number,null,Boolean]},contentCls:{type:[Array,Object,String,Number,null,Boolean]},headerCls:{type:[Array,Object,String,Number,null,Boolean]},titleWrapperCls:{type:[Array,Object,String,Number,null,Boolean]},titleCls:{type:[Array,Object,String,Number,null,Boolean]},descriptionCls:{type:[Array,Object,String,Number,null,Boolean]},actionsCls:{type:[Array,Object,String,Number,null,Boolean]},bodyCls:{type:[Array,Object,String,Number,null,Boolean]},footerCls:{type:[Array,Object,String,Number,null,Boolean]},swipeTriggerCls:{type:[Array,Object,String,Number,null,Boolean]},screen:{type:Boolean},swipeTrigger:{type:Boolean},disabled:{type:Boolean},defer:{type:Boolean},forceMount:{type:Boolean},disableOutsidePointerEvents:{type:Boolean}},K),emits:["update:open","pointerDownOutside","escapeKeyDown","focusOutside","update:fullScreen","ok","cancel","close"],setup(l,{emit:h}){const u=h,t=l,i=e.useSlots(),b=e.useAttrs(),C=e.ref(),k=ge.getPopoverPortalProps({triggerRef:C,props:t}),S=c.useVModel(t,"open",u,{passive:t.open===void 0,onChange(o){o||u("close")}}),B=async o=>{if(!o&&P.isFunction(t.beforeClose))try{const r=await t.beforeClose();if(t.beforeCloseDebugger&&console.info("beforeClose response",r),!r)return}catch(r){t.beforeCloseDebugger&&console.error("beforeClose error",r);return}S.value=o},g=c.useVModel(t,"fullScreen",u,{}),$=()=>{t.canFullScreen&&(g.value=!g.value)},Y=o=>{u("ok",o)},J=o=>{u("cancel",o)},Q=()=>{t.maskClosable&&B(!1)},X=I.cva(a,{variants:{frameless:n.generateVariantClassList("frameless",a),fullscreen:n.generateVariantClassList("fullscreen",a),width:n.generateVariantClassList([...O,"custom"],a),type:n.generateVariantClassList(W,a),side:n.generateVariantClassList(R,a)}}),A=n.getBemElement(a,"content"),Z=I.cva(A,{variants:{swiping:n.generateVariantClassList("swiping",A)}}),m=e.computed(()=>{let o=n.getValidNumber(t.width);return o!==void 0?o=`${o}px`:P.isString(t.width)&&!O.includes(t.width)&&(o=t.width),{widthVariant:o?"custom":t.width,minWidth:n.getPxSize(t.minWidth,!0),width:o,maxWidth:n.getPxSize(t.maxWidth,!0),minHeight:n.getPxSize(t.minHeight,!0),height:n.getPxSize(t.height,!0),maxHeight:n.getPxSize(t.maxHeight,!0),mobileDrawerMinHeight:n.getPxSize(t.mobileDrawerMinHeight,!0),mobileDrawerHeight:n.getPxSize(t.mobileDrawerHeight,!0),mobileDrawerMaxHeight:n.getPxSize(t.mobileDrawerMaxHeight,!0)}}),ee=()=>{var r;const o=(r=i.trigger)==null?void 0:r.call(i,{});if(!c.isEmptyElement(o))return e.h(y.DialogTrigger,{asChild:!0,ref:C},()=>o)},te=()=>{var r;const o=(r=i.beforeTitle)==null?void 0:r.call(i,{});if(!c.isEmptyElement(o))return o},oe=()=>{const o=()=>{var p;const d=(p=i.beforeActions)==null?void 0:p.call(i,{});if(!c.isEmptyElement(d))return d},r=()=>{const d=[];if(t.canFullScreen&&d.push(e.h(_._sfc_main,{icon:g.value?"tabler:arrows-minimize":"tabler:arrows-maximize",type:"ghost",color:"neutral",onClick:$})),t.closeable&&d.push(e.h(_._sfc_main,{icon:"tabler:x",type:"ghost",color:"neutral",onClick:()=>B(!1)})),d.length)return e.h(q._sfc_main,{gap:"sm"},()=>d)},s=o(),f=r();if(s||f)return e.h("div",{class:n.normCls(n.getBemElement(a,"actions"),t.actionsCls)},[s,f])},ne=()=>{var s;const o=(s=i.title)==null?void 0:s.call(i,{}),r=!c.isEmptyElement(o);if(t.title||r)return e.h(x,{class:t.titleCls},()=>r?o:t.title)},re=()=>{var s;const o=(s=i.description)==null?void 0:s.call(i,{}),r=!c.isEmptyElement(o);if(t.description||r)return e.h(y.DialogDescription,{class:n.normCls(n.getBemElement(a,"description"),"paragraph",t.descriptionCls)},()=>r?o:t.description)},ie=()=>{const o=oe(),r=te();if(t.frameless)return o;const s=()=>{const p=ne();if(p||o||r)return e.h("div",{class:n.normCls(n.getBemElement(a,"title_wrapper"),t.titleWrapperCls)},[r,p,o])},f=re(),d=s();if(d||f)return e.h("div",{class:n.normCls(n.getBemElement(a,"header"),t.headerCls)},[d,f])},le=()=>{var V,z;const o=(V=i.footer)==null?void 0:V.call(i,{}),r=!c.isEmptyElement(o),s=(z=i.beforeFooterActions)==null?void 0:z.call(i,{}),f=!c.isEmptyElement(s);if(t.footer!==void 0&&!t.footer)return null;const p=r?o:(()=>{var H,j;const v=[];(H=t.cancelProps)!=null&&H.hide||v.push(e.h(L._sfc_main,{...G,...t.cancelProps??{},onClick:J},{default:i.cancel,preIcon:i.cancelPreIcon,postIcon:i.cancelPostIcon})),(j=t.okProps)!=null&&j.hide||v.push(e.h(L._sfc_main,{...U,...t.okProps??{},onClick:Y},{default:i.ok,preIcon:i.okPreIcon,postIcon:i.okPostIcon}));const D=[];if(f&&D.push(s),v.length&&D.push(e.h(q._sfc_main,{gap:"sm"},()=>v)),D.length)return D})();if(p)return e.h("div",{class:n.normCls(n.getBemElement(a,"footer"),t.footerCls)},p)},ae=()=>{var r;const o=(r=i.default)==null?void 0:r.call(i,{});if(!c.isEmptyElement(o))return t.noBody?o:e.h("div",{class:n.normCls(n.getBemElement(a,"body"),t.bodyCls)},o)},se=e.computed(()=>{if(t.animated&&P.isString(t.animated))return t.animated;if(t.type==="modal")return n.getBemModifier(a,"fade");switch(t.side){case"start":case"end":return n.getBemModifier(a,"side-x");case"bottom":case"top":return n.getBemModifier(a,"side-y")}}),ce=e.computed(()=>{switch(t.side){case"start":case"top":return-1;case"bottom":case"end":return 1}}),w=e.computed(()=>!g.value&&m.value.widthVariant!=="custom"&&!(t.type==="drawer"&&["top","bottom"].includes(t.side))),T=e.ref(),{isSwiping:M,direction:N,distanceY:F}=fe.usePointerSwipe(T,{disableTextSelect:!0,threshold:50,onSwipeEnd(){t.type==="drawer"&&t.closeable&&(t.side==="bottom"&&N.value==="down"||t.side==="top"&&N.value==="up")&&B(!1)}}),ue=e.computed(()=>{if(!M.value||t.type!=="drawer"||!["top","bottom"].includes(t.side))return;const o=Math.min(Math.abs(F.value)/100,1);let r=-F.value*o*.6;return t.side==="top"?r=Math.min(0,r):r=Math.max(0,r),r}),de=o=>{(!t.keyboard||!t.open)&&(o.preventDefault(),o.stopPropagation()),t.open&&u("escapeKeyDown",o)},me=o=>{t.openAutoFocus||(o.preventDefault(),o.stopPropagation())},pe=o=>{(!t.closeOnClickOutside||!t.open)&&(o.preventDefault(),o.stopPropagation())};return(o,r)=>(e.openBlock(),e.createBlock(e.unref(y.DialogRoot),{open:e.unref(S),"onUpdate:open":B,modal:l.trapFocus},{default:e.withCtx(()=>[e.createVNode(ee),e.createVNode(e.unref(y.DialogPortal),e.normalizeProps(e.guardReactiveProps(e.unref(k))),{default:e.withCtx(()=>[e.createVNode(e.Transition,{name:se.value,css:!!l.animated,duration:l.type==="drawer"?250:200},{default:e.withCtx(()=>[e.unref(k).forceMount||e.unref(S)?(e.openBlock(),e.createBlock(e.unref(y.Primitive),e.mergeProps({"as-child":!w.value||!l.screen,key:String(!w.value||!l.screen),class:{[e.unref(n.normCls)("pc_grid",e.unref(n.getBemElement)(e.unref(a),"wrapper"),l.wrapperCls)]:w.value&&l.screen,[e.unref(n.getBemModifier)(e.unref(a),"as-drawer-in-mobile")]:t.type==="modal"&&l.asDrawerInMobile}},e.unref(b),{style:{zIndex:l.zIndex,"--ptc-dialog-transform":l.fullScreen||l.type==="modal"?"20px":"100%","--ptc-dialog-transform-ratio":ce.value,...e.unref(n.getStyleObject)(w.value&&l.screen?l.wrapperStyle:{})}}),{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{"data-screen":l.screen?"":void 0,class:e.normalizeClass(e.unref(n.normCls)({pc_grid__container:w.value},e.unref(X)({frameless:l.frameless,fullscreen:e.unref(g),width:m.value.widthVariant,type:l.type,side:l.side}),t.class)),style:e.normalizeStyle({"--ptc-dialog-w":m.value.width,"--ptc-dialog-min-h":m.value.minHeight,"--ptc-dialog-h":m.value.height,"--ptc-dialog-max-h":m.value.maxHeight,"--ptc-dialog-mobile-drawer-min-h":m.value.mobileDrawerMinHeight,"--ptc-dialog-mobile-drawer-h":m.value.mobileDrawerHeight,"--ptc-dialog-mobile-drawer-max-h":m.value.mobileDrawerMaxHeight,...e.unref(n.getStyleObject)(l.style)})},[!e.unref(g)&&l.mask?(e.openBlock(),e.createBlock(e.unref(ye._sfc_main),{key:0,onClick:Q,class:e.normalizeClass(e.unref(n.normCls)(e.unref(n.getBemElement)(e.unref(a),"blanket"),l.blanketCls)),screen:!1},null,8,["class"])):e.createCommentVNode("",!0),e.createVNode(e.unref(y.DialogContent),{forceMount:e.unref(k).forceMount,onInteractOutside:pe,onOpenAutoFocus:me,onEscapeKeyDown:de,onPointerDownOutside:r[0]||(r[0]=s=>u("pointerDownOutside",s)),onFocusOutside:r[1]||(r[1]=s=>u("focusOutside",s)),class:e.normalizeClass(e.unref(n.normCls)(e.unref(Z)({swiping:e.unref(M)}),l.contentCls)),style:e.normalizeStyle({"--ptc-dialog-swipe-transform":ue.value,...e.unref(n.getStyleObject)(l.contentStyle)})},{default:e.withCtx(()=>[e.createVNode(ie),e.createVNode(ae),e.createVNode(le),t.swipeTrigger&&l.type==="drawer"&&["top","bottom"].includes(t.side)&&!e.unref(g)?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"swipeTrigger",ref:T,class:e.normalizeClass(e.unref(n.normCls)(e.unref(n.getBemElement)(e.unref(a),"swipe_trigger"),l.swipeTriggerCls))},null,2)):e.createCommentVNode("",!0)]),_:1},8,["forceMount","class","style"])],14,he),[[e.vShow,e.unref(S)]])]),_:1},16,["as-child","class","style"])):e.createCommentVNode("",!0)]),_:1},8,["name","css","duration"])]),_:1},16)]),_:1},8,["open","modal"]))}}),be=c.installComponent(E,n.getComponentName("Dialog")),Ce=c.installComponent(x,n.getComponentName("DialogTitle"));exports.DIALOG_DEFAULT_PROPS=K;exports.Dialog=E;exports.DialogDrawerSides=R;exports.DialogPlugin=be;exports.DialogSizes=O;exports.DialogTitle=x;exports.DialogTitlePlugin=Ce;exports.DialogTypes=W;exports.default=E;