@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.
@@ -1 +1 @@
1
- .screen[data-v-b40bef0e]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1400;background-color:#0003}.modal[data-v-b40bef0e]{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-b40bef0e]{position:absolute;right:0}}.modal[data-v-b40bef0e]{max-height:90%}.container[data-v-b40bef0e]{position:absolute;top:0;right:0;bottom:0;left:0}@media (min-width: 45.875rem){.modal[data-v-b40bef0e]{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,4 +1,4 @@
1
- import { toRefs as I, ref as w, computed as b, watch as K, onMounted as F, onBeforeUnmount as P, resolveComponent as x, openBlock as k, createBlock as R, Transition as j, withCtx as h, withDirectives as D, createElementVNode as o, withModifiers as C, renderSlot as g, createVNode as y, createElementBlock as S, createCommentVNode as M, createTextVNode as L, toDisplayString as O, vShow as U, nextTick as q } from "vue";
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(d, { emit: t, slots: i }) {
50
+ setup(a, { emit: t }) {
44
51
  const {
45
- visible: e,
46
- preventClose: r
47
- } = I(d), c = w(null), l = w(null), m = w(null), n = w(), _ = b(() => [
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
- ]), B = b(() => !!i.content), {
51
- activate: T,
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 u = null, v = null;
58
- const a = (s = "") => {
59
- c.value && l.value && (E(), l.value.scrollTop = 0, X(l.value)), Q(), u && (u(), u = null), document.removeEventListener("keyup", v), t("cart-modal-closed", { type: s });
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
- v = (s) => {
62
- s && s.key === "Escape" && !r.value && a();
68
+ m = (r) => {
69
+ r && r.key === "Escape" && !e.value && s();
63
70
  };
64
71
  const A = () => {
65
- r.value || a("background");
72
+ e.value || s("background");
66
73
  }, f = () => {
67
- e.value && (document.addEventListener("keyup", v), q(() => {
68
- c.value && l.value && (T(), u = J(c.value), Y(l.value)), W();
74
+ l.value && (document.addEventListener("keyup", m), q(() => {
75
+ c.value && i.value && (_(), v = J(c.value), Y(i.value)), W();
69
76
  }));
70
- }, N = (s) => {
71
- a(s);
72
- }, p = () => {
73
- r.value || (n.value = setTimeout(() => {
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
- r.value || clearTimeout(n.value);
84
+ e.value || clearTimeout(u.value);
78
85
  };
79
- return K(e, () => {
80
- e.value ? (f(), p()) : a();
86
+ return K(l, () => {
87
+ l.value ? (f(), k()) : s();
81
88
  }), F(() => {
82
- e.value && (f(), p());
83
- }), P(() => a()), {
89
+ l.value && (f(), k());
90
+ }), P(() => s()), {
84
91
  mdiClose: z,
85
92
  mdiCheckCircle: G,
86
- onKeyUp: v,
93
+ onKeyUp: m,
87
94
  onScreenClick: A,
88
- hide: a,
95
+ hide: s,
89
96
  show: f,
90
- controlsRef: m,
91
- handleClick: N,
97
+ controlsRef: d,
98
+ handleClick: O,
92
99
  clearAutomaticClose: V,
93
- setAutomaticClose: p,
94
- showContentSlot: B
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 tw-mx-2.5 tw-border-t tw-border-tertiary tw-py-2"
102
- }, st = {
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 it(d, t, i, e, r, c) {
107
- const l = x("kv-material-icon"), m = x("kv-button");
108
- return k(), R(j, {
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[5] || (t[5] = C((...n) => e.onScreenClick && e.onScreenClick(...n), ["stop", "prevent"]))
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[2] || (t[2] = C(() => {
137
+ onClick: t[3] || (t[3] = y(() => {
131
138
  }, ["stop"])),
132
- onMouseenter: t[3] || (t[3] = (n) => e.clearAutomaticClose()),
133
- 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())
134
141
  }, [
135
142
  o("div", lt, [
136
143
  o("div", nt, [
137
- g(d.$slots, "header", {}, () => [
138
- y(l, {
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[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))
143
150
  ], !0),
144
- i.preventClose ? M("", !0) : (k(), S("button", {
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] = C((n) => e.hide("x-button"), ["stop"]))
154
+ onClick: t[0] || (t[0] = y((n) => e.hide("x-button"), ["stop"]))
148
155
  }, [
149
- y(l, {
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[7] || (t[7] = o("span", { class: "tw-sr-only" }, "Close", -1))
160
+ t[8] || (t[8] = o("span", { class: "tw-sr-only" }, "Close", -1))
154
161
  ]))
155
162
  ])
156
163
  ]),
157
- e.showContentSlot ? (k(), S("div", at, [
158
- g(d.$slots, "content", {}, void 0, !0)
159
- ], 512)) : M("", !0),
160
- o("div", st, [
161
- y(m, {
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("view-basket"))
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(" View basket (" + O(i.basketCount) + ") ", 1)
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, i.visible]
189
+ [U, l.visible]
176
190
  ])
177
191
  ]),
178
192
  _: 3
179
193
  });
180
194
  }
181
- const Ct = /* @__PURE__ */ tt(et, [["render", it], ["__scopeId", "data-v-b40bef0e"]]);
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.4.1",
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": "c48711e01a00c355cafbf20f47114c3d2716d2d0"
110
+ "gitHead": "d7bbbf5fc30ed4b8c955c8603b6784e36f143344"
111
111
  }