@kiva/kv-components 6.4.2 → 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 +89 -73
- 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,17 +1,17 @@
|
|
|
1
|
-
import { toRefs as
|
|
2
|
-
import { mdiClose as
|
|
3
|
-
import { useFocusTrap as
|
|
4
|
-
import { hideOthers as
|
|
5
|
-
import { unlockScroll as
|
|
6
|
-
import { unlockPrintSingleEl as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
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
|
+
import { mdiClose as z, mdiCheckCircle as G } from "@mdi/js";
|
|
3
|
+
import { useFocusTrap as H } from "@vueuse/integrations/useFocusTrap";
|
|
4
|
+
import { hideOthers as J } from "../vendor/aria-hidden/dist/es2015/index.js";
|
|
5
|
+
import { unlockScroll as Q, lockScroll as W } from "../utils/scrollLock.js";
|
|
6
|
+
import { unlockPrintSingleEl as X, lockPrintSingleEl as Y } from "../utils/printing.js";
|
|
7
|
+
import Z from "./KvButton.js";
|
|
8
|
+
import $ from "./KvMaterialIcon.js";
|
|
9
9
|
import "./KvCartModal.css";
|
|
10
|
-
import
|
|
11
|
-
const
|
|
10
|
+
import tt from "../_virtual/_plugin-vue_export-helper.js";
|
|
11
|
+
const et = {
|
|
12
12
|
components: {
|
|
13
|
-
KvMaterialIcon:
|
|
14
|
-
KvButton:
|
|
13
|
+
KvMaterialIcon: $,
|
|
14
|
+
KvButton: Z
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
17
17
|
/**
|
|
@@ -35,75 +35,84 @@ const $ = {
|
|
|
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
52
|
visible: l,
|
|
46
53
|
preventClose: e
|
|
47
|
-
} =
|
|
48
|
-
|
|
54
|
+
} = I(a), c = w(null), i = w(null), d = w(null), u = w(), n = p(() => [
|
|
55
|
+
c.value
|
|
49
56
|
// This cart modal
|
|
50
|
-
]), {
|
|
51
|
-
activate:
|
|
52
|
-
deactivate:
|
|
53
|
-
} =
|
|
57
|
+
]), x = p(() => !!a.categoryName), N = p(() => x.value ? `Support another ${a.categoryName}` : `View basket (${a.basketCount})`), {
|
|
58
|
+
activate: _,
|
|
59
|
+
deactivate: E
|
|
60
|
+
} = H(n, {
|
|
54
61
|
allowOutsideClick: !0
|
|
55
62
|
// allow clicking outside the cart modal to close it
|
|
56
63
|
});
|
|
57
64
|
let v = null, m = null;
|
|
58
|
-
const s = (
|
|
59
|
-
|
|
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
|
-
m = (
|
|
62
|
-
|
|
68
|
+
m = (r) => {
|
|
69
|
+
r && r.key === "Escape" && !e.value && s();
|
|
63
70
|
};
|
|
64
|
-
const
|
|
71
|
+
const A = () => {
|
|
65
72
|
e.value || s("background");
|
|
66
73
|
}, f = () => {
|
|
67
|
-
l.value && (document.addEventListener("keyup", m),
|
|
68
|
-
|
|
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
|
-
s(
|
|
72
|
-
},
|
|
77
|
+
}, O = (r) => {
|
|
78
|
+
s(r);
|
|
79
|
+
}, k = () => {
|
|
73
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
|
|
80
|
-
l.value ? (f(),
|
|
81
|
-
}),
|
|
82
|
-
l.value && (f(),
|
|
83
|
-
}),
|
|
84
|
-
mdiClose:
|
|
85
|
-
mdiCheckCircle:
|
|
86
|
+
return K(l, () => {
|
|
87
|
+
l.value ? (f(), k()) : s();
|
|
88
|
+
}), F(() => {
|
|
89
|
+
l.value && (f(), k());
|
|
90
|
+
}), P(() => s()), {
|
|
91
|
+
mdiClose: z,
|
|
92
|
+
mdiCheckCircle: G,
|
|
86
93
|
onKeyUp: m,
|
|
87
|
-
onScreenClick:
|
|
94
|
+
onScreenClick: A,
|
|
88
95
|
hide: s,
|
|
89
96
|
show: f,
|
|
90
97
|
controlsRef: d,
|
|
91
|
-
handleClick:
|
|
92
|
-
clearAutomaticClose:
|
|
93
|
-
setAutomaticClose:
|
|
98
|
+
handleClick: O,
|
|
99
|
+
clearAutomaticClose: V,
|
|
100
|
+
setAutomaticClose: k,
|
|
101
|
+
ctaText: N,
|
|
102
|
+
showCategoryOption: x
|
|
94
103
|
};
|
|
95
104
|
}
|
|
96
|
-
},
|
|
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 = {
|
|
97
106
|
id: "kvCartModalBody",
|
|
98
107
|
ref: "kvCartModalBody",
|
|
99
108
|
class: "tw-flex tw-gap-2"
|
|
100
|
-
},
|
|
109
|
+
}, it = {
|
|
101
110
|
ref: "controlsRef",
|
|
102
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"
|
|
103
112
|
};
|
|
104
|
-
function
|
|
105
|
-
const d =
|
|
106
|
-
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, {
|
|
107
116
|
"enter-active-class": "tw-transition-opacity tw-duration-300",
|
|
108
117
|
"leave-active-class": "tw-transition-opacity tw-duration-300",
|
|
109
118
|
"enter-class": "tw-opacity-0",
|
|
@@ -111,13 +120,13 @@ function at(c, t, l, e, r, a) {
|
|
|
111
120
|
"leave-class": "tw-opacity-full",
|
|
112
121
|
"leave-to-class": "tw-opacity-0"
|
|
113
122
|
}, {
|
|
114
|
-
default:
|
|
115
|
-
|
|
123
|
+
default: h(() => [
|
|
124
|
+
D(o("div", {
|
|
116
125
|
class: "screen",
|
|
117
|
-
onClick: t[
|
|
126
|
+
onClick: t[6] || (t[6] = y((...n) => e.onScreenClick && e.onScreenClick(...n), ["stop", "prevent"]))
|
|
118
127
|
}, [
|
|
119
128
|
o("div", null, [
|
|
120
|
-
o("div",
|
|
129
|
+
o("div", ot, [
|
|
121
130
|
o("div", {
|
|
122
131
|
ref: "kvCartModal",
|
|
123
132
|
tabindex: "-1",
|
|
@@ -125,58 +134,65 @@ function at(c, t, l, e, r, a) {
|
|
|
125
134
|
class: "modal",
|
|
126
135
|
"aria-modal": "true",
|
|
127
136
|
"aria-label": "Added to basket",
|
|
128
|
-
onClick: t[
|
|
137
|
+
onClick: t[3] || (t[3] = y(() => {
|
|
129
138
|
}, ["stop"])),
|
|
130
|
-
onMouseenter: t[
|
|
131
|
-
onMouseleave: t[
|
|
139
|
+
onMouseenter: t[4] || (t[4] = (n) => e.clearAutomaticClose()),
|
|
140
|
+
onMouseleave: t[5] || (t[5] = (n) => e.setAutomaticClose())
|
|
132
141
|
}, [
|
|
133
|
-
o("div",
|
|
134
|
-
o("div",
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
o("div", lt, [
|
|
143
|
+
o("div", nt, [
|
|
144
|
+
S(a.$slots, "header", {}, () => [
|
|
145
|
+
b(d, {
|
|
137
146
|
class: "tw-w-3.5 tw-h-3.5 tw-text-brand",
|
|
138
147
|
icon: e.mdiCheckCircle
|
|
139
148
|
}, null, 8, ["icon"]),
|
|
140
|
-
t[
|
|
149
|
+
t[7] || (t[7] = o("p", { class: "tw-flex-1 tw-font-medium tw-text-center" }, " Added to basket ", -1))
|
|
141
150
|
], !0),
|
|
142
|
-
l.preventClose ?
|
|
151
|
+
l.preventClose ? T("", !0) : (C(), M("button", {
|
|
143
152
|
key: 0,
|
|
144
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",
|
|
145
|
-
onClick: t[0] || (t[0] =
|
|
154
|
+
onClick: t[0] || (t[0] = y((n) => e.hide("x-button"), ["stop"]))
|
|
146
155
|
}, [
|
|
147
|
-
|
|
156
|
+
b(d, {
|
|
148
157
|
class: "tw-w-3.5 tw-h-3.5",
|
|
149
158
|
icon: e.mdiClose
|
|
150
159
|
}, null, 8, ["icon"]),
|
|
151
|
-
t[
|
|
160
|
+
t[8] || (t[8] = o("span", { class: "tw-sr-only" }, "Close", -1))
|
|
152
161
|
]))
|
|
153
162
|
])
|
|
154
163
|
]),
|
|
155
|
-
o("div",
|
|
156
|
-
|
|
164
|
+
o("div", at, [
|
|
165
|
+
S(a.$slots, "content", {}, void 0, !0)
|
|
157
166
|
], 512),
|
|
158
|
-
o("div",
|
|
159
|
-
|
|
167
|
+
o("div", it, [
|
|
168
|
+
b(u, {
|
|
160
169
|
class: "tw-w-full",
|
|
161
|
-
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
|
+
))
|
|
162
173
|
}, {
|
|
163
|
-
default:
|
|
164
|
-
|
|
174
|
+
default: h(() => [
|
|
175
|
+
L(B(e.ctaText), 1)
|
|
165
176
|
]),
|
|
166
177
|
_: 1
|
|
167
|
-
})
|
|
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)
|
|
168
184
|
], 512)
|
|
169
185
|
], 544)
|
|
170
186
|
])
|
|
171
187
|
])
|
|
172
188
|
], 512), [
|
|
173
|
-
[
|
|
189
|
+
[U, l.visible]
|
|
174
190
|
])
|
|
175
191
|
]),
|
|
176
192
|
_: 3
|
|
177
193
|
});
|
|
178
194
|
}
|
|
179
|
-
const
|
|
195
|
+
const Ct = /* @__PURE__ */ tt(et, [["render", st], ["__scopeId", "data-v-4af12153"]]);
|
|
180
196
|
export {
|
|
181
|
-
|
|
197
|
+
Ct as default
|
|
182
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
|
}
|