@kiva/kv-components 6.4.1 → 6.5.0
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/vue/KvCartModal.css +1 -1
- package/dist/vue/KvCartModal.js +72 -58
- package/package.json +2 -2
package/dist/vue/KvCartModal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.screen[data-v-
|
|
1
|
+
.screen[data-v-4af12153]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1400;background-color:#0003}.modal[data-v-4af12153]{width:100%;border-bottom-right-radius:.875rem;border-bottom-left-radius:.875rem;--tw-bg-opacity: 1;background-color:rgba(var(--bg-primary),var(--tw-bg-opacity, 1))}@media (min-width: 45.875rem){.modal[data-v-4af12153]{position:absolute;right:0}}.modal[data-v-4af12153]{max-height:90%}.container[data-v-4af12153]{position:absolute;top:0;right:0;bottom:0;left:0}@media (min-width: 45.875rem){.modal[data-v-4af12153]{max-width:24.5rem}}
|
package/dist/vue/KvCartModal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toRefs as I, ref as w, computed as
|
|
1
|
+
import { toRefs as I, ref as w, computed as p, watch as K, onMounted as F, onBeforeUnmount as P, resolveComponent as g, openBlock as C, createBlock as R, Transition as j, withCtx as h, withDirectives as D, createElementVNode as o, withModifiers as y, renderSlot as S, createVNode as b, createElementBlock as M, createCommentVNode as T, createTextVNode as L, toDisplayString as B, vShow as U, nextTick as q } from "vue";
|
|
2
2
|
import { mdiClose as z, mdiCheckCircle as G } from "@mdi/js";
|
|
3
3
|
import { useFocusTrap as H } from "@vueuse/integrations/useFocusTrap";
|
|
4
4
|
import { hideOthers as J } from "../vendor/aria-hidden/dist/es2015/index.js";
|
|
@@ -35,77 +35,84 @@ const et = {
|
|
|
35
35
|
basketCount: {
|
|
36
36
|
type: Number,
|
|
37
37
|
default: 0
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Category name for the CTA button
|
|
41
|
+
* */
|
|
42
|
+
categoryName: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
38
45
|
}
|
|
39
46
|
},
|
|
40
47
|
emits: [
|
|
41
48
|
"cart-modal-closed"
|
|
42
49
|
],
|
|
43
|
-
setup(
|
|
50
|
+
setup(a, { emit: t }) {
|
|
44
51
|
const {
|
|
45
|
-
visible:
|
|
46
|
-
preventClose:
|
|
47
|
-
} = I(
|
|
52
|
+
visible: l,
|
|
53
|
+
preventClose: e
|
|
54
|
+
} = I(a), c = w(null), i = w(null), d = w(null), u = w(), n = p(() => [
|
|
48
55
|
c.value
|
|
49
56
|
// This cart modal
|
|
50
|
-
]),
|
|
51
|
-
activate:
|
|
57
|
+
]), x = p(() => !!a.categoryName), N = p(() => x.value ? `Support another ${a.categoryName}` : `View basket (${a.basketCount})`), {
|
|
58
|
+
activate: _,
|
|
52
59
|
deactivate: E
|
|
53
|
-
} = H(
|
|
60
|
+
} = H(n, {
|
|
54
61
|
allowOutsideClick: !0
|
|
55
62
|
// allow clicking outside the cart modal to close it
|
|
56
63
|
});
|
|
57
|
-
let
|
|
58
|
-
const
|
|
59
|
-
c.value &&
|
|
64
|
+
let v = null, m = null;
|
|
65
|
+
const s = (r = "") => {
|
|
66
|
+
c.value && i.value && (E(), i.value.scrollTop = 0, X(i.value)), Q(), v && (v(), v = null), document.removeEventListener("keyup", m), t("cart-modal-closed", { type: r });
|
|
60
67
|
};
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
m = (r) => {
|
|
69
|
+
r && r.key === "Escape" && !e.value && s();
|
|
63
70
|
};
|
|
64
71
|
const A = () => {
|
|
65
|
-
|
|
72
|
+
e.value || s("background");
|
|
66
73
|
}, f = () => {
|
|
67
|
-
|
|
68
|
-
c.value &&
|
|
74
|
+
l.value && (document.addEventListener("keyup", m), q(() => {
|
|
75
|
+
c.value && i.value && (_(), v = J(c.value), Y(i.value)), W();
|
|
69
76
|
}));
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
|
|
77
|
+
}, O = (r) => {
|
|
78
|
+
s(r);
|
|
79
|
+
}, k = () => {
|
|
80
|
+
e.value || (u.value = setTimeout(() => {
|
|
74
81
|
t("cart-modal-closed", { type: "time" });
|
|
75
82
|
}, 1e4));
|
|
76
83
|
}, V = () => {
|
|
77
|
-
|
|
84
|
+
e.value || clearTimeout(u.value);
|
|
78
85
|
};
|
|
79
|
-
return K(
|
|
80
|
-
|
|
86
|
+
return K(l, () => {
|
|
87
|
+
l.value ? (f(), k()) : s();
|
|
81
88
|
}), F(() => {
|
|
82
|
-
|
|
83
|
-
}), P(() =>
|
|
89
|
+
l.value && (f(), k());
|
|
90
|
+
}), P(() => s()), {
|
|
84
91
|
mdiClose: z,
|
|
85
92
|
mdiCheckCircle: G,
|
|
86
|
-
onKeyUp:
|
|
93
|
+
onKeyUp: m,
|
|
87
94
|
onScreenClick: A,
|
|
88
|
-
hide:
|
|
95
|
+
hide: s,
|
|
89
96
|
show: f,
|
|
90
|
-
controlsRef:
|
|
91
|
-
handleClick:
|
|
97
|
+
controlsRef: d,
|
|
98
|
+
handleClick: O,
|
|
92
99
|
clearAutomaticClose: V,
|
|
93
|
-
setAutomaticClose:
|
|
94
|
-
|
|
100
|
+
setAutomaticClose: k,
|
|
101
|
+
ctaText: N,
|
|
102
|
+
showCategoryOption: x
|
|
95
103
|
};
|
|
96
104
|
}
|
|
97
105
|
}, ot = { class: "container" }, lt = { class: "tw-flex tw-pt-2 tw-px-2.5" }, nt = { class: "tw-flex tw-flex-grow tw-gap-1 tw-items-center tw-pb-2" }, at = {
|
|
98
|
-
key: 0,
|
|
99
106
|
id: "kvCartModalBody",
|
|
100
107
|
ref: "kvCartModalBody",
|
|
101
|
-
class: "tw-flex tw-gap-2
|
|
102
|
-
},
|
|
108
|
+
class: "tw-flex tw-gap-2"
|
|
109
|
+
}, it = {
|
|
103
110
|
ref: "controlsRef",
|
|
104
111
|
class: "tw-flex-shrink-0 tw-flex tw-justify-end tw-gap-x-2.5 tw-px-2.5 tw-pb-2 tw-flex-col tw-gap-1"
|
|
105
112
|
};
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
return
|
|
113
|
+
function st(a, t, l, e, c, i) {
|
|
114
|
+
const d = g("kv-material-icon"), u = g("kv-button");
|
|
115
|
+
return C(), R(j, {
|
|
109
116
|
"enter-active-class": "tw-transition-opacity tw-duration-300",
|
|
110
117
|
"leave-active-class": "tw-transition-opacity tw-duration-300",
|
|
111
118
|
"enter-class": "tw-opacity-0",
|
|
@@ -116,7 +123,7 @@ function it(d, t, i, e, r, c) {
|
|
|
116
123
|
default: h(() => [
|
|
117
124
|
D(o("div", {
|
|
118
125
|
class: "screen",
|
|
119
|
-
onClick: t[
|
|
126
|
+
onClick: t[6] || (t[6] = y((...n) => e.onScreenClick && e.onScreenClick(...n), ["stop", "prevent"]))
|
|
120
127
|
}, [
|
|
121
128
|
o("div", null, [
|
|
122
129
|
o("div", ot, [
|
|
@@ -127,58 +134,65 @@ function it(d, t, i, e, r, c) {
|
|
|
127
134
|
class: "modal",
|
|
128
135
|
"aria-modal": "true",
|
|
129
136
|
"aria-label": "Added to basket",
|
|
130
|
-
onClick: t[
|
|
137
|
+
onClick: t[3] || (t[3] = y(() => {
|
|
131
138
|
}, ["stop"])),
|
|
132
|
-
onMouseenter: t[
|
|
133
|
-
onMouseleave: t[
|
|
139
|
+
onMouseenter: t[4] || (t[4] = (n) => e.clearAutomaticClose()),
|
|
140
|
+
onMouseleave: t[5] || (t[5] = (n) => e.setAutomaticClose())
|
|
134
141
|
}, [
|
|
135
142
|
o("div", lt, [
|
|
136
143
|
o("div", nt, [
|
|
137
|
-
|
|
138
|
-
|
|
144
|
+
S(a.$slots, "header", {}, () => [
|
|
145
|
+
b(d, {
|
|
139
146
|
class: "tw-w-3.5 tw-h-3.5 tw-text-brand",
|
|
140
147
|
icon: e.mdiCheckCircle
|
|
141
148
|
}, null, 8, ["icon"]),
|
|
142
|
-
t[
|
|
149
|
+
t[7] || (t[7] = o("p", { class: "tw-flex-1 tw-font-medium tw-text-center" }, " Added to basket ", -1))
|
|
143
150
|
], !0),
|
|
144
|
-
|
|
151
|
+
l.preventClose ? T("", !0) : (C(), M("button", {
|
|
145
152
|
key: 0,
|
|
146
153
|
class: "tw-grid tw-content-center tw-justify-center tw-ml-auto tw-w-6 tw-h-6 tw--m-2 hover:tw-text-action-highlight",
|
|
147
|
-
onClick: t[0] || (t[0] =
|
|
154
|
+
onClick: t[0] || (t[0] = y((n) => e.hide("x-button"), ["stop"]))
|
|
148
155
|
}, [
|
|
149
|
-
|
|
156
|
+
b(d, {
|
|
150
157
|
class: "tw-w-3.5 tw-h-3.5",
|
|
151
158
|
icon: e.mdiClose
|
|
152
159
|
}, null, 8, ["icon"]),
|
|
153
|
-
t[
|
|
160
|
+
t[8] || (t[8] = o("span", { class: "tw-sr-only" }, "Close", -1))
|
|
154
161
|
]))
|
|
155
162
|
])
|
|
156
163
|
]),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
], 512)
|
|
160
|
-
o("div",
|
|
161
|
-
|
|
164
|
+
o("div", at, [
|
|
165
|
+
S(a.$slots, "content", {}, void 0, !0)
|
|
166
|
+
], 512),
|
|
167
|
+
o("div", it, [
|
|
168
|
+
b(u, {
|
|
162
169
|
class: "tw-w-full",
|
|
163
|
-
onClick: t[1] || (t[1] = (n) => e.handleClick(
|
|
170
|
+
onClick: t[1] || (t[1] = (n) => e.handleClick(
|
|
171
|
+
e.showCategoryOption ? "support-another" : "view-basket"
|
|
172
|
+
))
|
|
164
173
|
}, {
|
|
165
174
|
default: h(() => [
|
|
166
|
-
L(
|
|
175
|
+
L(B(e.ctaText), 1)
|
|
167
176
|
]),
|
|
168
177
|
_: 1
|
|
169
|
-
})
|
|
178
|
+
}),
|
|
179
|
+
e.showCategoryOption ? (C(), M("button", {
|
|
180
|
+
key: 0,
|
|
181
|
+
class: "tw-text-action tw-pt-1.5 tw-font-medium",
|
|
182
|
+
onClick: t[2] || (t[2] = (n) => e.handleClick("view-basket"))
|
|
183
|
+
}, " No thanks, go to basket (" + B(l.basketCount) + ") ", 1)) : T("", !0)
|
|
170
184
|
], 512)
|
|
171
185
|
], 544)
|
|
172
186
|
])
|
|
173
187
|
])
|
|
174
188
|
], 512), [
|
|
175
|
-
[U,
|
|
189
|
+
[U, l.visible]
|
|
176
190
|
])
|
|
177
191
|
]),
|
|
178
192
|
_: 3
|
|
179
193
|
});
|
|
180
194
|
}
|
|
181
|
-
const Ct = /* @__PURE__ */ tt(et, [["render",
|
|
195
|
+
const Ct = /* @__PURE__ */ tt(et, [["render", st], ["__scopeId", "data-v-4af12153"]]);
|
|
182
196
|
export {
|
|
183
197
|
Ct as default
|
|
184
198
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"embla-carousel-fade",
|
|
108
108
|
"popper.js"
|
|
109
109
|
],
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "d7bbbf5fc30ed4b8c955c8603b6784e36f143344"
|
|
111
111
|
}
|