@inertia-vuetify/modal 3.0.0-rc.0 → 3.0.1
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/inertia-modal-vuetify.js +94 -92
- package/package.json +1 -1
- package/src/ModalBtn.vue +4 -11
- package/src/ModalLink.vue +3 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import * as e from "@inertiaui/vanilla";
|
|
2
2
|
import { except as t, generateId as n, kebabCase as r, markAriaHidden as i, only as a, prefersReducedMotion as o, rejectNullValues as s, sameUrlPath as c } from "@inertiaui/vanilla";
|
|
3
|
-
import { Fragment as l, Transition as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createSlots as g, createTextVNode as _, createVNode as v, defineComponent as y, guardReactiveProps as b, h as x, inject as S, markRaw as C, mergeProps as w, nextTick as ee, normalizeClass as te, normalizeProps as T, normalizeStyle as ne, onBeforeUnmount as E, onMounted as D, onUnmounted as O, openBlock as k, provide as A, reactive as j, readonly as M, ref as N, renderSlot as P, resolveDynamicComponent as F, toDisplayString as re, toRef as ie, toValue as ae, unref as I, useAttrs as
|
|
4
|
-
import { http as
|
|
5
|
-
import { mergeDataIntoQueryString as
|
|
6
|
-
import { useDefaults as
|
|
7
|
-
import { VCard as
|
|
8
|
-
import { VDialog as
|
|
9
|
-
import { VBtn as
|
|
3
|
+
import { Fragment as l, Transition as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createSlots as g, createTextVNode as _, createVNode as v, defineComponent as y, guardReactiveProps as b, h as x, inject as S, markRaw as C, mergeProps as w, nextTick as ee, normalizeClass as te, normalizeProps as T, normalizeStyle as ne, onBeforeUnmount as E, onMounted as D, onUnmounted as O, openBlock as k, provide as A, reactive as j, readonly as M, ref as N, renderSlot as P, resolveDynamicComponent as F, toDisplayString as re, toRef as ie, toValue as ae, unref as I, useAttrs as L, useId as oe, useSlots as se, useTemplateRef as R, watch as z, withCtx as B } from "vue";
|
|
4
|
+
import { http as V, progress as H, router as U, usePage as ce } from "@inertiajs/vue3";
|
|
5
|
+
import { mergeDataIntoQueryString as le } from "@inertiajs/core";
|
|
6
|
+
import { useDefaults as ue, useDisplay as de, useLocale as fe, useRtl as pe } from "vuetify";
|
|
7
|
+
import { VCard as me, VCardActions as he, VCardItem as ge } from "vuetify/components/VCard";
|
|
8
|
+
import { VDialog as _e } from "vuetify/components/VDialog";
|
|
9
|
+
import { VBtn as ve } from "vuetify/components/VBtn";
|
|
10
10
|
// src/helpers.ts
|
|
11
|
-
function
|
|
11
|
+
function ye(e) {
|
|
12
12
|
return typeof e == "string" ? JSON.parse(e) : e;
|
|
13
13
|
}
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
return
|
|
14
|
+
var be = null;
|
|
15
|
+
function xe(e = "inertiaui_modal_") {
|
|
16
|
+
return be?.() ?? n(e);
|
|
17
17
|
}
|
|
18
18
|
// src/cache.ts
|
|
19
|
-
var
|
|
19
|
+
var Se = class {
|
|
20
20
|
cache = /* @__PURE__ */ new Map();
|
|
21
21
|
timers = /* @__PURE__ */ new Map();
|
|
22
22
|
inFlight = /* @__PURE__ */ new Map();
|
|
@@ -128,26 +128,26 @@ function Ee(e) {
|
|
|
128
128
|
}
|
|
129
129
|
Ce();
|
|
130
130
|
// src/modalStack.ts
|
|
131
|
-
var Y = N(null), X = N([]), De = N({}), Z = null, Q = new
|
|
132
|
-
function Oe(e, t =
|
|
131
|
+
var Y = N(null), X = N([]), De = N({}), Z = null, Q = new Se();
|
|
132
|
+
function Oe(e, t = xe()) {
|
|
133
133
|
return {
|
|
134
134
|
...e,
|
|
135
135
|
Accept: "text/html, application/xhtml+xml",
|
|
136
136
|
"X-Requested-With": "XMLHttpRequest",
|
|
137
137
|
"X-Inertia": "true",
|
|
138
|
-
"X-Inertia-Version":
|
|
138
|
+
"X-Inertia-Version": ce().version ?? "",
|
|
139
139
|
"X-InertiaUI-Modal": t,
|
|
140
140
|
"X-InertiaUI-Modal-Base-Url": Y.value ?? ""
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
function ke(e, t = {}) {
|
|
144
144
|
if (e.startsWith("#")) return Promise.resolve();
|
|
145
|
-
let n = t.method ?? "get", [r, i] =
|
|
145
|
+
let n = t.method ?? "get", [r, i] = le(n, e, t.data ?? {}, t.queryStringArrayFormat ?? "brackets"), a = Se.key(n, r, i);
|
|
146
146
|
if (Q.get(a)) return Promise.resolve();
|
|
147
147
|
let o = Q.getInFlight(a);
|
|
148
148
|
if (o) return o.then(() => {});
|
|
149
149
|
t.onPrefetching?.();
|
|
150
|
-
let s =
|
|
150
|
+
let s = V.getClient().request({
|
|
151
151
|
url: r,
|
|
152
152
|
method: n,
|
|
153
153
|
data: i,
|
|
@@ -170,7 +170,7 @@ var Ae = (e) => {}, je = class {
|
|
|
170
170
|
onTopOfStack;
|
|
171
171
|
name;
|
|
172
172
|
constructor(e, t, n, r, i) {
|
|
173
|
-
this.id = t.id ??
|
|
173
|
+
this.id = t.id ?? xe(), this.component = e, this.props = N(t.props ?? {}), this.response = t, this.config = n ?? {}, this.onCloseCallback = r ?? null, this.afterLeaveCallback = i ?? null, this.index = d(() => X.value.findIndex((e) => e.id === this.id)), this.onTopOfStack = d(() => X.value.length < 2 || X.value.findLast((e) => e.shouldRender)?.id === this.id);
|
|
174
174
|
}
|
|
175
175
|
getComponentPropKeys = () => {
|
|
176
176
|
let e = this.component?.props;
|
|
@@ -204,7 +204,7 @@ var Ae = (e) => {}, je = class {
|
|
|
204
204
|
if (e !== 0) return;
|
|
205
205
|
X.value = [];
|
|
206
206
|
let n = Y.value;
|
|
207
|
-
Y.value = null, Z = n, n && typeof window < "u" && !c(n, window.location.href) &&
|
|
207
|
+
Y.value = null, Z = n, n && typeof window < "u" && !c(n, window.location.href) && U.push({
|
|
208
208
|
url: n,
|
|
209
209
|
preserveScroll: !0,
|
|
210
210
|
preserveState: !0,
|
|
@@ -235,7 +235,7 @@ var Ae = (e) => {}, je = class {
|
|
|
235
235
|
let n = t(e.only ?? Object.keys(this.response.props), e.except ?? []), r = e.method ?? "get", i = e.data ?? {};
|
|
236
236
|
e.onStart?.();
|
|
237
237
|
try {
|
|
238
|
-
let t = await
|
|
238
|
+
let t = await V.getClient().request({
|
|
239
239
|
url: this.response.url,
|
|
240
240
|
method: r,
|
|
241
241
|
data: r === "get" ? void 0 : i,
|
|
@@ -247,11 +247,11 @@ var Ae = (e) => {}, je = class {
|
|
|
247
247
|
"X-Inertia-Partial-Component": this.response.component,
|
|
248
248
|
"X-Inertia-Version": this.response.version ?? "",
|
|
249
249
|
"X-Inertia-Partial-Data": n.join(","),
|
|
250
|
-
"X-InertiaUI-Modal":
|
|
250
|
+
"X-InertiaUI-Modal": xe(),
|
|
251
251
|
"X-InertiaUI-Modal-Base-Url": Y.value ?? ""
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
|
-
this.updateProps(
|
|
254
|
+
this.updateProps(ye(t.data).props), e.onSuccess?.(t);
|
|
255
255
|
} catch (t) {
|
|
256
256
|
e.onError?.(t);
|
|
257
257
|
} finally {
|
|
@@ -281,7 +281,7 @@ function Fe(e) {
|
|
|
281
281
|
return typeof e == "object" && !!e && typeof e.component == "string";
|
|
282
282
|
}
|
|
283
283
|
function Ie(e, t, n) {
|
|
284
|
-
e && t && typeof window < "u" &&
|
|
284
|
+
e && t && typeof window < "u" && U.push({
|
|
285
285
|
url: e,
|
|
286
286
|
preserveScroll: !0,
|
|
287
287
|
preserveState: !0,
|
|
@@ -295,22 +295,22 @@ function Ie(e, t, n) {
|
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
function Le(e, t = {}, n = null, r = null) {
|
|
298
|
-
return Fe(e) ?
|
|
298
|
+
return Fe(e) ? U.resolveComponent(e.component).then((i) => He(C(i), e, t, n, r)) : Promise.reject(/* @__PURE__ */ Error("Invalid modal response. This usually happens when the server returns a redirect (e.g., due to session expiration). Check if the user is still authenticated."));
|
|
299
299
|
}
|
|
300
300
|
function Re(e) {
|
|
301
301
|
try {
|
|
302
|
-
e ?
|
|
302
|
+
e ? H.start() : H.finish();
|
|
303
303
|
} catch {}
|
|
304
304
|
}
|
|
305
305
|
async function ze(e, t, n = {}, r = {}, i = {}, a = null, o = null, s = "brackets", c = !1, l = null, u = null, d = null, f = null) {
|
|
306
306
|
if (e.startsWith("#")) return Ne(e.substring(1), i, a, o, f);
|
|
307
|
-
let [p, m] =
|
|
308
|
-
let t =
|
|
307
|
+
let [p, m] = le(t, e, n, s), h = (e) => {
|
|
308
|
+
let t = ye(e.data);
|
|
309
309
|
return u?.(e), Le(t, i, a, o).then((e) => (Ie(t.url, c, t), e));
|
|
310
310
|
};
|
|
311
311
|
X.value.length === 0 && (Y.value = typeof window < "u" ? window.location.href : "");
|
|
312
|
-
let g = Q.get(
|
|
313
|
-
return g ? h(g) : (l?.(), Re(!0),
|
|
312
|
+
let g = Q.get(Se.key(t, p, m));
|
|
313
|
+
return g ? h(g) : (l?.(), Re(!0), V.getClient().request({
|
|
314
314
|
url: p,
|
|
315
315
|
method: t,
|
|
316
316
|
data: m,
|
|
@@ -370,14 +370,14 @@ var We = /* @__PURE__ */ y({
|
|
|
370
370
|
}), Ge = /* @__PURE__ */ y({
|
|
371
371
|
__name: "ModalRoot",
|
|
372
372
|
setup(e) {
|
|
373
|
-
let t = $(), n =
|
|
374
|
-
O(
|
|
373
|
+
let t = $(), n = ce(), r = !1, i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = (e) => e.id || `${e.component}:${e.url}`, s = (e) => e?._inertiaui_modal;
|
|
374
|
+
O(U.on("start", ({ detail: { visit: e } }) => {
|
|
375
375
|
r = !0, e.method !== "get" && a.set(e.id, !1);
|
|
376
|
-
})), O(
|
|
376
|
+
})), O(U.on("success", ({ detail: { page: e, visitId: t } }) => {
|
|
377
377
|
t && a.has(t) && !s(e.props) && a.set(t, !0);
|
|
378
|
-
})), O(
|
|
378
|
+
})), O(U.on("finish", ({ detail: { visit: e } }) => {
|
|
379
379
|
r = !1, a.get(e.id) && t.closeAll(), a.delete(e.id);
|
|
380
|
-
})), O(
|
|
380
|
+
})), O(U.on("navigate", ({ detail: { page: e } }) => {
|
|
381
381
|
let n = s(e.props);
|
|
382
382
|
if (t.isClosingToBaseUrl(e.url)) {
|
|
383
383
|
t.clearClosingToBaseUrl(), t.closeAll(!0), t.setBaseUrl(null);
|
|
@@ -389,20 +389,20 @@ var We = /* @__PURE__ */ y({
|
|
|
389
389
|
}
|
|
390
390
|
let a = o(n), l = t.stack.value;
|
|
391
391
|
i.has(a) || n.id && l.some((e) => e.id === n.id) || l.some((e) => e.response.component === n.component && c(e.response.url, n.url)) || (t.setBaseUrl(n.baseUrl ?? null), i.add(a), t.pushFromResponseData(n, {}, () => {
|
|
392
|
-
n.baseUrl ? (t.setBaseUrl(null), !r && typeof window < "u" && window.location.href !== n.baseUrl &&
|
|
392
|
+
n.baseUrl ? (t.setBaseUrl(null), !r && typeof window < "u" && window.location.href !== n.baseUrl && U.visit(n.baseUrl, {
|
|
393
393
|
preserveScroll: !0,
|
|
394
394
|
preserveState: !0
|
|
395
395
|
})) : console.error("No base url in modal response data so cannot navigate back");
|
|
396
396
|
}).finally(() => i.delete(a)));
|
|
397
397
|
}));
|
|
398
|
-
let u = typeof window > "u" ? void 0 :
|
|
398
|
+
let u = typeof window > "u" ? void 0 : V.onRequest((e) => {
|
|
399
399
|
let r = t.getBaseUrl() ?? s(n.props)?.baseUrl;
|
|
400
400
|
return r && (e.headers = {
|
|
401
401
|
...e.headers,
|
|
402
402
|
"X-InertiaUI-Modal-Base-Url": r
|
|
403
403
|
}), e;
|
|
404
404
|
});
|
|
405
|
-
return O(() => u?.()),
|
|
405
|
+
return O(() => u?.()), z(() => s(n.props), (e, n) => {
|
|
406
406
|
if (!e) return;
|
|
407
407
|
let r = (t) => t.component === e.component && c(t.url, e.url);
|
|
408
408
|
n && r(n) ? t.stack.value[0]?.updateProps(e.props ?? {}) : n || t.stack.value.find((e) => r(e.response))?.updateProps(e.props ?? {});
|
|
@@ -498,7 +498,7 @@ var Je = /* @__PURE__ */ y({
|
|
|
498
498
|
fullscreen: r.fullscreen ?? q(e, "fullscreen"),
|
|
499
499
|
...o.value?.config
|
|
500
500
|
};
|
|
501
|
-
}), c =
|
|
501
|
+
}), c = L(), u;
|
|
502
502
|
function h() {
|
|
503
503
|
u = o.value?.registerEventListenersFromAttrs(c);
|
|
504
504
|
}
|
|
@@ -540,9 +540,9 @@ var Je = /* @__PURE__ */ y({
|
|
|
540
540
|
get shouldRender() {
|
|
541
541
|
return o.value?.shouldRender;
|
|
542
542
|
}
|
|
543
|
-
}),
|
|
543
|
+
}), z(() => o.value?.onTopOfStack, (e, t) => {
|
|
544
544
|
e && !t ? i("focus") : !e && t && i("blur");
|
|
545
|
-
}),
|
|
545
|
+
}), z(() => o.value?.isOpen, (e, t) => {
|
|
546
546
|
e ? i("success") : t === !0 && i("close");
|
|
547
547
|
}, { immediate: !0 });
|
|
548
548
|
let _ = d(() => {
|
|
@@ -572,8 +572,8 @@ var Je = /* @__PURE__ */ y({
|
|
|
572
572
|
}), Xe = Symbol("inertia-modal-request-close"), Ze = /* @__PURE__ */ y({
|
|
573
573
|
__name: "CloseButton",
|
|
574
574
|
setup(e) {
|
|
575
|
-
let t = S(Xe), { t: n } =
|
|
576
|
-
return (e, r) => (k(), f(I(
|
|
575
|
+
let t = S(Xe), { t: n } = fe();
|
|
576
|
+
return (e, r) => (k(), f(I(ve), {
|
|
577
577
|
class: "im-close-button",
|
|
578
578
|
icon: "$close",
|
|
579
579
|
variant: "text",
|
|
@@ -620,9 +620,9 @@ var et = ["id"], tt = {
|
|
|
620
620
|
},
|
|
621
621
|
emits: ["after-leave"],
|
|
622
622
|
setup(e, { emit: t }) {
|
|
623
|
-
let n = e, r = t, a =
|
|
624
|
-
A("modalContext", ie(n, "modalContext")), A(Xe, M),
|
|
625
|
-
let { isRtl: o } =
|
|
623
|
+
let n = e, r = t, a = se();
|
|
624
|
+
A("modalContext", ie(n, "modalContext")), A(Xe, M), ue({}, "InertiaModal");
|
|
625
|
+
let { isRtl: o } = pe(), s = de(), c = oe(), l = N(!1), u = R("dialog"), y = typeof document < "u" && document.activeElement !== document.body ? document.activeElement : null, b = d(() => n.config.slideover ? "slideover" : "modal"), x = d(() => !!n.title || !!a.title), S = d(() => n.config.closeButton !== !1), C = d(() => {
|
|
626
626
|
let e = n.config.fullscreen;
|
|
627
627
|
return e === "mobile" ? s.mobile.value : typeof e == "string" ? s.width.value < s.thresholds.value[e] : typeof e == "number" ? s.width.value < e : !!e;
|
|
628
628
|
}), ee = d(() => {
|
|
@@ -675,22 +675,22 @@ var et = ["id"], tt = {
|
|
|
675
675
|
function ae() {
|
|
676
676
|
n.modalContext.onTopOfStack ? !n.config.closeExplicitly && n.config.closeOnClickOutside === !1 && (F = "refuse") : F = "ignore";
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function L(e) {
|
|
679
679
|
let t = F;
|
|
680
680
|
F = "close", !(e || t === "ignore") && (t === "refuse" ? u.value?.animateClick() : M());
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function V() {
|
|
683
683
|
r("after-leave"), n.modalContext.afterLeave();
|
|
684
684
|
}
|
|
685
|
-
let
|
|
686
|
-
function
|
|
685
|
+
let H = null;
|
|
686
|
+
function U(e) {
|
|
687
687
|
let t = K("appElement");
|
|
688
|
-
e ? typeof t == "string" && (
|
|
688
|
+
e ? typeof t == "string" && (H ??= i(t)) : (l.value = !1, H?.(), H = null, y?.focus({ preventScroll: !0 }));
|
|
689
689
|
}
|
|
690
|
-
return D(() =>
|
|
690
|
+
return D(() => z(() => n.modalContext.isOpen, U, {
|
|
691
691
|
immediate: !0,
|
|
692
692
|
flush: "post"
|
|
693
|
-
})), E(() =>
|
|
693
|
+
})), E(() => U(!1)), (t, n) => (k(), f(I(_e), w({
|
|
694
694
|
ref_key: "dialog",
|
|
695
695
|
ref: u
|
|
696
696
|
}, {
|
|
@@ -707,25 +707,25 @@ var et = ["id"], tt = {
|
|
|
707
707
|
"data-inertiaui-modal-id": e.modalContext.id,
|
|
708
708
|
"data-inertiaui-modal-index": e.modalContext.index,
|
|
709
709
|
"onClick:outside": ae,
|
|
710
|
-
"onUpdate:modelValue":
|
|
710
|
+
"onUpdate:modelValue": L,
|
|
711
711
|
onAfterEnter: n[0] ||= (e) => l.value = !0,
|
|
712
|
-
onAfterLeave:
|
|
712
|
+
onAfterLeave: V
|
|
713
713
|
}), {
|
|
714
|
-
default:
|
|
714
|
+
default: B(() => [v(I(me), w({
|
|
715
715
|
class: `im-${b.value}-wrapper`,
|
|
716
716
|
rounded: e.config.slideover ? 0 : void 0,
|
|
717
717
|
"data-inertiaui-modal-entered": l.value
|
|
718
718
|
}, e.cardProps), {
|
|
719
|
-
default:
|
|
720
|
-
x.value ? (k(), f(I(
|
|
719
|
+
default: B(() => [
|
|
720
|
+
x.value ? (k(), f(I(ge), {
|
|
721
721
|
key: 0,
|
|
722
722
|
class: te(`im-${b.value}-title`)
|
|
723
723
|
}, g({
|
|
724
|
-
title:
|
|
724
|
+
title: B(() => [h("span", { id: I(c) }, [P(t.$slots, "title", { requestClose: M }, () => [_(re(e.title), 1)])], 8, et)]),
|
|
725
725
|
_: 2
|
|
726
726
|
}, [S.value ? {
|
|
727
727
|
name: "append",
|
|
728
|
-
fn:
|
|
728
|
+
fn: B(() => [v(Ze)]),
|
|
729
729
|
key: "0"
|
|
730
730
|
} : void 0]), 1032, ["class"])) : S.value ? (k(), m("div", tt, [v(Ze)])) : p("", !0),
|
|
731
731
|
h("div", {
|
|
@@ -741,11 +741,11 @@ var et = ["id"], tt = {
|
|
|
741
741
|
paddingTop: x.value ? 0 : void 0
|
|
742
742
|
})
|
|
743
743
|
}, [P(t.$slots, "default", { requestClose: M })], 6),
|
|
744
|
-
a.actions ? (k(), f(I(
|
|
744
|
+
a.actions ? (k(), f(I(he), {
|
|
745
745
|
key: 2,
|
|
746
746
|
class: te(`im-${b.value}-actions`)
|
|
747
747
|
}, {
|
|
748
|
-
default:
|
|
748
|
+
default: B(() => [P(t.$slots, "actions", { requestClose: M })]),
|
|
749
749
|
_: 3
|
|
750
750
|
}, 8, ["class"])) : p("", !0)
|
|
751
751
|
]),
|
|
@@ -835,7 +835,7 @@ var et = ["id"], tt = {
|
|
|
835
835
|
panelClasses: r.panelClasses,
|
|
836
836
|
position: r.position,
|
|
837
837
|
fullscreen: r.fullscreen
|
|
838
|
-
})), o =
|
|
838
|
+
})), o = R("modal");
|
|
839
839
|
return t({
|
|
840
840
|
afterLeave: () => o.value?.afterLeave(),
|
|
841
841
|
close: () => o.value?.close(),
|
|
@@ -874,7 +874,7 @@ var et = ["id"], tt = {
|
|
|
874
874
|
onFocus: n[3] ||= (e) => i("focus"),
|
|
875
875
|
onBlur: n[4] ||= (e) => i("blur")
|
|
876
876
|
}), {
|
|
877
|
-
default:
|
|
877
|
+
default: B((r) => [(k(), f(nt, {
|
|
878
878
|
key: r.id,
|
|
879
879
|
"modal-context": r.modalContext,
|
|
880
880
|
config: r.config,
|
|
@@ -884,21 +884,21 @@ var et = ["id"], tt = {
|
|
|
884
884
|
"card-props": e.cardProps,
|
|
885
885
|
onAfterLeave: n[0] ||= (e) => i("after-leave")
|
|
886
886
|
}, g({
|
|
887
|
-
default:
|
|
887
|
+
default: B(({ requestClose: e }) => [P(t.$slots, "default", T(b({
|
|
888
888
|
...r,
|
|
889
889
|
requestClose: e
|
|
890
890
|
})))]),
|
|
891
891
|
_: 2
|
|
892
892
|
}, [t.$slots.title ? {
|
|
893
893
|
name: "title",
|
|
894
|
-
fn:
|
|
894
|
+
fn: B(({ requestClose: e }) => [P(t.$slots, "title", T(b({
|
|
895
895
|
...r,
|
|
896
896
|
requestClose: e
|
|
897
897
|
})))]),
|
|
898
898
|
key: "0"
|
|
899
899
|
} : void 0, t.$slots.actions ? {
|
|
900
900
|
name: "actions",
|
|
901
|
-
fn:
|
|
901
|
+
fn: B(({ requestClose: e }) => [P(t.$slots, "actions", T(b({
|
|
902
902
|
...r,
|
|
903
903
|
requestClose: e
|
|
904
904
|
})))]),
|
|
@@ -1029,43 +1029,44 @@ var et = ["id"], tt = {
|
|
|
1029
1029
|
function h() {
|
|
1030
1030
|
u.value.includes("hover") && (m = setTimeout(p, 75));
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1032
|
+
function _() {
|
|
1033
1033
|
clearTimeout(m);
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function v(e) {
|
|
1036
1036
|
u.value.includes("click") && e.button === 0 && p();
|
|
1037
1037
|
}
|
|
1038
1038
|
D(() => {
|
|
1039
1039
|
u.value.includes("mount") && p();
|
|
1040
1040
|
});
|
|
1041
|
-
let
|
|
1042
|
-
|
|
1043
|
-
c.value && (e &&
|
|
1041
|
+
let y = !1;
|
|
1042
|
+
z(() => c.value?.onTopOfStack, (e) => {
|
|
1043
|
+
c.value && (e && y ? r("focus") : e || r("blur"), y = !e);
|
|
1044
1044
|
});
|
|
1045
|
-
let
|
|
1045
|
+
let b = L(), x;
|
|
1046
1046
|
E(() => {
|
|
1047
|
-
|
|
1048
|
-
}),
|
|
1049
|
-
e && !t && (
|
|
1047
|
+
x?.(), clearTimeout(m);
|
|
1048
|
+
}), z(c, (e, t) => {
|
|
1049
|
+
e && !t && (x = e.registerEventListenersFromAttrs(b), r("success"));
|
|
1050
1050
|
});
|
|
1051
|
-
function
|
|
1051
|
+
function S() {
|
|
1052
1052
|
c.value = null, r("after-leave");
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1055
|
-
(e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) && e.currentTarget instanceof HTMLAnchorElement || (e.preventDefault(), !i.value && (n.href.startsWith("#") || (i.value = !0, r("start")), o.visit(n.href, n.method, n.data, n.headers, s(a(n, Ue)), () => r("close"),
|
|
1054
|
+
function C(e) {
|
|
1055
|
+
(e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) && e.currentTarget instanceof HTMLAnchorElement || (e.preventDefault(), !i.value && (n.href.startsWith("#") || (i.value = !0, r("start")), o.visit(n.href, n.method, n.data, n.headers, s(a(n, Ue)), () => r("close"), S, n.queryStringArrayFormat, l.value).then((e) => c.value = j(e)).catch((e) => {
|
|
1056
1056
|
console.error(e), r("error", e);
|
|
1057
1057
|
}).finally(() => i.value = !1)));
|
|
1058
1058
|
}
|
|
1059
1059
|
return (t, n) => (k(), f(F(e.as), w(t.$attrs, {
|
|
1060
1060
|
href: e.href,
|
|
1061
|
-
onClick:
|
|
1061
|
+
onClick: C,
|
|
1062
1062
|
onMouseenter: h,
|
|
1063
|
-
onMouseleave:
|
|
1064
|
-
onMousedown:
|
|
1065
|
-
}), {
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1063
|
+
onMouseleave: _,
|
|
1064
|
+
onMousedown: v
|
|
1065
|
+
}), g({ _: 2 }, [t.$slots.default ? {
|
|
1066
|
+
name: "default",
|
|
1067
|
+
fn: B(() => [P(t.$slots, "default", { loading: i.value })]),
|
|
1068
|
+
key: "0"
|
|
1069
|
+
} : void 0]), 1040, ["href"]));
|
|
1069
1070
|
}
|
|
1070
1071
|
}), at = /* @__PURE__ */ y({
|
|
1071
1072
|
inheritAttrs: !1,
|
|
@@ -1074,16 +1075,17 @@ var et = ["id"], tt = {
|
|
|
1074
1075
|
setup(e) {
|
|
1075
1076
|
let t = N(!1);
|
|
1076
1077
|
return (n, r) => (k(), f(it, w(n.$attrs, {
|
|
1077
|
-
as: I(
|
|
1078
|
+
as: I(ve),
|
|
1078
1079
|
href: e.href,
|
|
1079
1080
|
loading: t.value,
|
|
1080
1081
|
onStart: r[0] ||= (e) => t.value = !0,
|
|
1081
1082
|
onSuccess: r[1] ||= (e) => t.value = !1,
|
|
1082
1083
|
onError: r[2] ||= (e) => t.value = !1
|
|
1083
|
-
}), {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1084
|
+
}), g({ _: 2 }, [n.$slots.default ? {
|
|
1085
|
+
name: "default",
|
|
1086
|
+
fn: B((e) => [P(n.$slots, "default", T(b(e)))]),
|
|
1087
|
+
key: "0"
|
|
1088
|
+
} : void 0]), 1040, [
|
|
1087
1089
|
"as",
|
|
1088
1090
|
"href",
|
|
1089
1091
|
"loading"
|
|
@@ -1107,7 +1109,7 @@ var st = /* @__PURE__ */ y({
|
|
|
1107
1109
|
setup(e) {
|
|
1108
1110
|
let t = e, n = S("modalContext");
|
|
1109
1111
|
if (!n) throw Error("WhenVisible component must be used inside a Modal component");
|
|
1110
|
-
let r = N(!1), i =
|
|
1112
|
+
let r = N(!1), i = R("root"), a = !1, o;
|
|
1111
1113
|
function s() {
|
|
1112
1114
|
if (t.data) return { only: [t.data].flat() };
|
|
1113
1115
|
if (!t.params) throw Error("You must provide either a `data` or `params` prop.");
|
|
@@ -1132,7 +1134,7 @@ var st = /* @__PURE__ */ y({
|
|
|
1132
1134
|
ref_key: "root",
|
|
1133
1135
|
ref: i
|
|
1134
1136
|
}, {
|
|
1135
|
-
default:
|
|
1137
|
+
default: B(() => [r.value ? P(t.$slots, "default", {}, void 0, void 0, 0) : P(t.$slots, "fallback", {}, void 0, void 0, 1)]),
|
|
1136
1138
|
_: 3
|
|
1137
1139
|
}, 512));
|
|
1138
1140
|
}
|
package/package.json
CHANGED
package/src/ModalBtn.vue
CHANGED
|
@@ -13,16 +13,9 @@ const loading = ref(false)
|
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<template>
|
|
16
|
-
<ModalLink
|
|
17
|
-
v-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
:href
|
|
21
|
-
:loading
|
|
22
|
-
@start="loading = true"
|
|
23
|
-
@success="loading = false"
|
|
24
|
-
@error="loading = false"
|
|
25
|
-
>
|
|
26
|
-
<slot v-bind="slotProps" />
|
|
16
|
+
<ModalLink v-bind="$attrs" :as="VBtn" :href :loading @start="loading = true" @success="loading = false" @error="loading = false">
|
|
17
|
+
<template v-if="$slots.default" #default="slotProps">
|
|
18
|
+
<slot v-bind="slotProps" />
|
|
19
|
+
</template>
|
|
27
20
|
</ModalLink>
|
|
28
21
|
</template>
|
package/src/ModalLink.vue
CHANGED