@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.
@@ -1 +1 @@
1
- .screen[data-v-c2a75743]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1400;background-color:#0003}.modal[data-v-c2a75743]{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-c2a75743]{position:absolute;right:0}}.modal[data-v-c2a75743]{max-height:90%}.container[data-v-c2a75743]{position:absolute;top:0;right:0;bottom:0;left:0}@media (min-width: 45.875rem){.modal[data-v-c2a75743]{max-width:24.5rem}}
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}}
@@ -1,17 +1,17 @@
1
- import { toRefs as T, ref as w, computed as E, watch as A, onMounted as N, onBeforeUnmount as V, resolveComponent as y, openBlock as b, createBlock as I, Transition as K, withCtx as x, withDirectives as F, createElementVNode as o, withModifiers as k, renderSlot as g, createVNode as C, createElementBlock as P, createCommentVNode as R, createTextVNode as j, toDisplayString as D, vShow as L, nextTick as O } from "vue";
2
- import { mdiClose as U, mdiCheckCircle as q } from "@mdi/js";
3
- import { useFocusTrap as z } from "@vueuse/integrations/useFocusTrap";
4
- import { hideOthers as G } from "../vendor/aria-hidden/dist/es2015/index.js";
5
- import { unlockScroll as H, lockScroll as J } from "../utils/scrollLock.js";
6
- import { unlockPrintSingleEl as Q, lockPrintSingleEl as W } from "../utils/printing.js";
7
- import X from "./KvButton.js";
8
- import Y from "./KvMaterialIcon.js";
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 Z from "../_virtual/_plugin-vue_export-helper.js";
11
- const $ = {
10
+ import tt from "../_virtual/_plugin-vue_export-helper.js";
11
+ const et = {
12
12
  components: {
13
- KvMaterialIcon: Y,
14
- KvButton: X
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(c, { emit: t }) {
50
+ setup(a, { emit: t }) {
44
51
  const {
45
52
  visible: l,
46
53
  preventClose: e
47
- } = T(c), r = w(null), a = w(null), d = w(null), u = w(), n = E(() => [
48
- r.value
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: h,
52
- deactivate: M
53
- } = z(n, {
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 = (i = "") => {
59
- r.value && a.value && (M(), a.value.scrollTop = 0, Q(a.value)), H(), v && (v(), v = null), document.removeEventListener("keyup", m), t("cart-modal-closed", { type: i });
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 = (i) => {
62
- i && i.key === "Escape" && !e.value && s();
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), O(() => {
68
- r.value && a.value && (h(), v = G(r.value), W(a.value)), J();
74
+ l.value && (document.addEventListener("keyup", m), q(() => {
75
+ c.value && i.value && (_(), v = J(c.value), Y(i.value)), W();
69
76
  }));
70
- }, B = (i) => {
71
- s(i);
72
- }, p = () => {
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
- }, S = () => {
83
+ }, V = () => {
77
84
  e.value || clearTimeout(u.value);
78
85
  };
79
- return A(l, () => {
80
- l.value ? (f(), p()) : s();
81
- }), N(() => {
82
- l.value && (f(), p());
83
- }), V(() => s()), {
84
- mdiClose: U,
85
- mdiCheckCircle: q,
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: B,
92
- clearAutomaticClose: S,
93
- setAutomaticClose: p
98
+ handleClick: O,
99
+ clearAutomaticClose: V,
100
+ setAutomaticClose: k,
101
+ ctaText: N,
102
+ showCategoryOption: x
94
103
  };
95
104
  }
96
- }, tt = { class: "container" }, et = { class: "tw-flex tw-pt-2 tw-px-2.5" }, ot = { class: "tw-flex tw-flex-grow tw-gap-1 tw-items-center tw-pb-2" }, lt = {
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
- }, nt = {
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 at(c, t, l, e, r, a) {
105
- const d = y("kv-material-icon"), u = y("kv-button");
106
- return b(), I(K, {
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: x(() => [
115
- F(o("div", {
123
+ default: h(() => [
124
+ D(o("div", {
116
125
  class: "screen",
117
- onClick: t[5] || (t[5] = k((...n) => e.onScreenClick && e.onScreenClick(...n), ["stop", "prevent"]))
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", tt, [
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[2] || (t[2] = k(() => {
137
+ onClick: t[3] || (t[3] = y(() => {
129
138
  }, ["stop"])),
130
- onMouseenter: t[3] || (t[3] = (n) => e.clearAutomaticClose()),
131
- onMouseleave: t[4] || (t[4] = (n) => e.setAutomaticClose())
139
+ onMouseenter: t[4] || (t[4] = (n) => e.clearAutomaticClose()),
140
+ onMouseleave: t[5] || (t[5] = (n) => e.setAutomaticClose())
132
141
  }, [
133
- o("div", et, [
134
- o("div", ot, [
135
- g(c.$slots, "header", {}, () => [
136
- C(d, {
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[6] || (t[6] = o("p", { class: "tw-flex-1 tw-font-medium tw-text-center" }, " Added to basket ", -1))
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 ? R("", !0) : (b(), P("button", {
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] = k((n) => e.hide("x-button"), ["stop"]))
154
+ onClick: t[0] || (t[0] = y((n) => e.hide("x-button"), ["stop"]))
146
155
  }, [
147
- C(d, {
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[7] || (t[7] = o("span", { class: "tw-sr-only" }, "Close", -1))
160
+ t[8] || (t[8] = o("span", { class: "tw-sr-only" }, "Close", -1))
152
161
  ]))
153
162
  ])
154
163
  ]),
155
- o("div", lt, [
156
- g(c.$slots, "content", {}, void 0, !0)
164
+ o("div", at, [
165
+ S(a.$slots, "content", {}, void 0, !0)
157
166
  ], 512),
158
- o("div", nt, [
159
- C(u, {
167
+ o("div", it, [
168
+ b(u, {
160
169
  class: "tw-w-full",
161
- onClick: t[1] || (t[1] = (n) => e.handleClick("view-basket"))
170
+ onClick: t[1] || (t[1] = (n) => e.handleClick(
171
+ e.showCategoryOption ? "support-another" : "view-basket"
172
+ ))
162
173
  }, {
163
- default: x(() => [
164
- j(" View basket (" + D(l.basketCount) + ") ", 1)
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
- [L, l.visible]
189
+ [U, l.visible]
174
190
  ])
175
191
  ]),
176
192
  _: 3
177
193
  });
178
194
  }
179
- const pt = /* @__PURE__ */ Z($, [["render", at], ["__scopeId", "data-v-c2a75743"]]);
195
+ const Ct = /* @__PURE__ */ tt(et, [["render", st], ["__scopeId", "data-v-4af12153"]]);
180
196
  export {
181
- pt as default
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.4.2",
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": "ad451289b0e7c6a607efce658156f9240576a5ea"
110
+ "gitHead": "d7bbbf5fc30ed4b8c955c8603b6784e36f143344"
111
111
  }