@kiva/kv-components 7.2.2 → 7.2.4

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,11 +1,11 @@
1
- import { ref as E, onMounted as N, computed as y, resolveComponent as x, openBlock as r, createElementBlock as d, createElementVNode as o, Fragment as B, renderList as K, createBlock as I, withCtx as V, createCommentVNode as L, toDisplayString as S } from "vue";
2
- import W from "./KvCardFrame.js";
3
- import A from "./KvContentfulImg.js";
4
- import D from "../_virtual/_plugin-vue_export-helper.js";
5
- const F = {
1
+ import { ref as M, onMounted as V, computed as o, resolveComponent as N, openBlock as r, createElementBlock as l, createElementVNode as a, Fragment as W, renderList as z, createBlock as K, withCtx as D, normalizeClass as d, createCommentVNode as f, toDisplayString as C } from "vue";
2
+ import F from "./KvCardFrame.js";
3
+ import j from "./KvContentfulImg.js";
4
+ import q from "../_virtual/_plugin-vue_export-helper.js";
5
+ const G = {
6
6
  components: {
7
- KvCardFrame: W,
8
- KvContentfulImg: A
7
+ KvCardFrame: F,
8
+ KvContentfulImg: j
9
9
  },
10
10
  props: {
11
11
  // Expects an array of categories from our API
@@ -26,84 +26,111 @@ const F = {
26
26
  preSelectedCategory: {
27
27
  type: String,
28
28
  default: null
29
+ },
30
+ // Use compact horizontal layout on tablet and up (keeps image to the left)
31
+ useCompactCard: {
32
+ type: Boolean,
33
+ default: !1
34
+ },
35
+ // Array of category ids that the user has already selected
36
+ existingCategories: {
37
+ type: Array,
38
+ default: () => []
39
+ },
40
+ // Message to show for categories that are in the existingCategories list
41
+ existingCategoryMessage: {
42
+ type: String,
43
+ default: "Already selected"
29
44
  }
30
45
  },
31
46
  emits: ["category-selected"],
32
- setup(l, { emit: u }) {
33
- const s = E(null), n = (e) => {
34
- s.value = e, u("category-selected", e);
47
+ setup(s, { emit: g }) {
48
+ const i = M(null), n = (e) => {
49
+ i.value = e, g("category-selected", e);
35
50
  };
36
- N(() => {
37
- l.preSelectedCategory && n(l.preSelectedCategory);
51
+ V(() => {
52
+ s.preSelectedCategory && n(s.preSelectedCategory);
38
53
  });
39
- const f = (e) => {
40
- var i, t, c, _, h, g, C, p, k;
54
+ const _ = (e) => {
55
+ var k, p, b, v, y, I, S, E, L;
41
56
  if (e.contentfulEntry) {
42
- const a = (_ = (c = (t = (i = e == null ? void 0 : e.contentfulEntry) == null ? void 0 : i.entry) == null ? void 0 : t.fields) == null ? void 0 : c.content) == null ? void 0 : _.find(
43
- (m) => {
44
- var v, b;
45
- return (b = (v = m == null ? void 0 : m.fields) == null ? void 0 : v.key) == null ? void 0 : b.includes("category-icon");
57
+ const u = (v = (b = (p = (k = e == null ? void 0 : e.contentfulEntry) == null ? void 0 : k.entry) == null ? void 0 : p.fields) == null ? void 0 : b.content) == null ? void 0 : v.find(
58
+ (w) => {
59
+ var A, B;
60
+ return (B = (A = w == null ? void 0 : w.fields) == null ? void 0 : A.key) == null ? void 0 : B.includes("category-icon");
46
61
  }
47
62
  );
48
- return ((k = (p = (C = (g = (h = a == null ? void 0 : a.fields) == null ? void 0 : h.contentLight) == null ? void 0 : g[0]) == null ? void 0 : C.fields) == null ? void 0 : p.file) == null ? void 0 : k.url) ?? null;
63
+ return ((L = (E = (S = (I = (y = u == null ? void 0 : u.fields) == null ? void 0 : y.contentLight) == null ? void 0 : I[0]) == null ? void 0 : S.fields) == null ? void 0 : E.file) == null ? void 0 : L.url) ?? null;
49
64
  }
50
65
  return null;
51
- }, w = y(() => !l.categoryList || l.categoryList.length === 0 ? [] : l.categoryList.filter((e) => !l.hiddenCategories.includes(e.id)).map((e) => ({
66
+ }, h = o(() => s.useCompactCard ? "tw-p-2 md:tw-p-3 tw-flex tw-flex-row tw-items-center tw-cursor-pointer" : "tw-p-2 tw-flex tw-flex-row md:tw-flex-col tw-items-center tw-cursor-pointer"), c = o(() => s.useCompactCard ? "tw-shrink-0 tw-mr-2" : "tw-shrink-0 tw-mr-2 md:tw-mr-0 md:tw-mb-2"), m = o(() => s.useCompactCard ? "" : "md:tw-text-center"), t = (e) => s.existingCategories.includes(e), x = o(() => !s.categoryList || s.categoryList.length === 0 ? [] : s.categoryList.filter((e) => !s.hiddenCategories.includes(e.id)).map((e) => ({
52
67
  id: e.id,
53
68
  name: e.name,
54
69
  description: e.description,
55
70
  customImage: e.customImage || null,
56
- contentfulImage: f(e) || null
71
+ contentfulImage: _(e) || null
57
72
  })));
58
73
  return {
59
- selectedCategory: s,
60
- formattedCategories: w,
61
- selectCategory: n
74
+ selectedCategory: i,
75
+ formattedCategories: x,
76
+ selectCategory: n,
77
+ cardContainerClasses: h,
78
+ imageClasses: c,
79
+ textContainerClasses: m,
80
+ isCategoryExisting: t
62
81
  };
63
82
  }
64
- }, M = { class: "tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-3" }, j = { class: "tw-p-2 tw-flex tw-flex-row md:tw-flex-col tw-items-center tw-cursor-pointer" }, q = ["alt", "src", "width"], z = { class: "md:tw-text-center" }, G = { class: "tw-mb-0.5 tw-font-medium" }, H = { class: "tw-text-small" }, J = {
83
+ }, H = { class: "tw-grid tw-grid-cols-1 md:tw-grid-cols-2 tw-gap-3" }, J = ["alt", "src", "width"], O = { class: "tw-mb-0.5 tw-font-medium" }, P = { class: "tw-text-small" }, Q = {
84
+ key: 0,
85
+ class: "tw-text-small tw-py-1 tw-px-2 tw-mt-1 tw-bg-brand-200 tw-rounded tw-inline-block"
86
+ }, R = {
65
87
  key: 0,
66
88
  class: "tw-text-gray-500 tw-italic"
67
89
  };
68
- function O(l, u, s, n, f, w) {
69
- const e = x("kv-contentful-img"), i = x("kv-card-frame");
70
- return r(), d("div", null, [
71
- o("div", M, [
72
- (r(!0), d(B, null, K(n.formattedCategories, (t) => (r(), I(i, {
90
+ function T(s, g, i, n, _, h) {
91
+ const c = N("kv-contentful-img"), m = N("kv-card-frame");
92
+ return r(), l("div", null, [
93
+ a("div", H, [
94
+ (r(!0), l(W, null, z(n.formattedCategories, (t) => (r(), K(m, {
73
95
  key: t.id,
74
96
  "bg-color-class": n.selectedCategory === t.id ? "tw-bg-secondary" : "tw-bg-white",
75
97
  "border-class": n.selectedCategory === t.id ? "tw-border-2 tw-border-action" : "tw-border-2 tw-border-transparent",
76
98
  class: "tw-transition-all tw-duration-200 hover:tw-shadow-lg",
77
- onClick: (c) => n.selectCategory(t.id)
99
+ onClick: (x) => n.selectCategory(t.id)
78
100
  }, {
79
- default: V(() => [
80
- o("div", j, [
81
- t != null && t.contentfulImage ? (r(), I(e, {
101
+ default: D(() => [
102
+ a("div", {
103
+ class: d(n.cardContainerClasses)
104
+ }, [
105
+ t != null && t.contentfulImage ? (r(), K(c, {
82
106
  key: 0,
83
- class: "tw-shrink-0 tw-mr-2 md:tw-mr-0 md:tw-mb-2",
107
+ class: d(n.imageClasses),
84
108
  alt: `${t.name} image`,
85
109
  "contentful-src": t.contentfulImage,
86
- width: s.imageWidth
87
- }, null, 8, ["alt", "contentful-src", "width"])) : t != null && t.customImage ? (r(), d("img", {
110
+ width: i.imageWidth
111
+ }, null, 8, ["class", "alt", "contentful-src", "width"])) : t != null && t.customImage ? (r(), l("img", {
88
112
  key: 1,
89
- class: "tw-shrink-0 tw-mr-2 md:tw-mr-0 md:tw-mb-2",
113
+ class: d(n.imageClasses),
90
114
  alt: `${t.name} image`,
91
115
  src: t.customImage,
92
- width: s.imageWidth
93
- }, null, 8, q)) : L("", !0),
94
- o("div", z, [
95
- o("p", G, S(t.name), 1),
96
- o("p", H, S(t.description), 1)
97
- ])
98
- ])
116
+ width: i.imageWidth
117
+ }, null, 10, J)) : f("", !0),
118
+ a("div", {
119
+ class: d(n.textContainerClasses)
120
+ }, [
121
+ a("p", O, C(t.name), 1),
122
+ a("p", P, C(t.description), 1),
123
+ n.isCategoryExisting(t.id) ? (r(), l("p", Q, C(i.existingCategoryMessage), 1)) : f("", !0)
124
+ ], 2)
125
+ ], 2)
99
126
  ]),
100
127
  _: 2
101
128
  }, 1032, ["bg-color-class", "border-class", "onClick"]))), 128))
102
129
  ]),
103
- n.formattedCategories.length === 0 ? (r(), d("p", J, " No categories available ")) : L("", !0)
130
+ n.formattedCategories.length === 0 ? (r(), l("p", R, " No categories available ")) : f("", !0)
104
131
  ]);
105
132
  }
106
- const U = /* @__PURE__ */ D(F, [["render", O]]);
133
+ const $ = /* @__PURE__ */ q(G, [["render", T]]);
107
134
  export {
108
- U as default
135
+ $ as default
109
136
  };
@@ -1 +1 @@
1
- .mobile-link[data-v-d1df98b6]{--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1));text-decoration-line:none}.mobile-link[data-v-d1df98b6]:hover{--tw-text-opacity: 1;color:rgba(var(--text-action),var(--tw-text-opacity, 1));text-decoration-line:underline}
1
+ .mobile-link[data-v-8418c5da]{--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1));text-decoration-line:none}.mobile-link[data-v-8418c5da]:hover{--tw-text-opacity: 1;color:rgba(var(--text-action),var(--tw-text-opacity, 1));text-decoration-line:underline}
@@ -1,7 +1,7 @@
1
1
  import { mdiClose as f } from "@mdi/js";
2
2
  import g from "../KvAccordionItem.js";
3
3
  import C from "../KvMaterialIcon.js";
4
- import { resolveComponent as m, resolveDirective as A, openBlock as t, createElementBlock as l, withDirectives as i, createBlock as u, createCommentVNode as K, withCtx as p, createElementVNode as a, Fragment as N, renderList as T, withModifiers as n, toDisplayString as k, createTextVNode as r } from "vue";
4
+ import { resolveComponent as m, resolveDirective as A, openBlock as t, createElementBlock as l, withDirectives as i, createBlock as u, createCommentVNode as K, withCtx as p, createElementVNode as a, Fragment as N, renderList as T, withModifiers as n, toDisplayString as k, createTextVNode as s } from "vue";
5
5
  import "./KvHeaderMobileMenu.css";
6
6
  import y from "../../_virtual/_plugin-vue_export-helper.js";
7
7
  const I = {
@@ -50,7 +50,7 @@ const I = {
50
50
  {
51
51
  title: "Buy a Kiva Card",
52
52
  description: "Give the gift of lending to others",
53
- url: "/portfolio/kiva-card",
53
+ url: "/gifts/kiva-cards",
54
54
  trackEvent: "menu-buy-kiva-card"
55
55
  }
56
56
  ]
@@ -64,7 +64,7 @@ function B(v, o, b, P, d, $) {
64
64
  key: 0,
65
65
  icon: d.mdiClose,
66
66
  class: "tw-cursor-pointer",
67
- onClick: o[0] || (o[0] = (s) => v.$emit("closing-menu"))
67
+ onClick: o[0] || (o[0] = (r) => v.$emit("closing-menu"))
68
68
  }, null, 8, ["icon"])), [
69
69
  [e, ["TopNav", "click-Hamburger-close"]]
70
70
  ]) : K("", !0),
@@ -78,17 +78,17 @@ function B(v, o, b, P, d, $) {
78
78
  ])),
79
79
  default: p(() => [
80
80
  a("div", M, [
81
- (t(!0), l(N, null, T(d.menuItems, (s) => i((t(), l("a", {
82
- key: s.title,
83
- href: s.url,
81
+ (t(!0), l(N, null, T(d.menuItems, (r) => i((t(), l("a", {
82
+ key: r.title,
83
+ href: r.url,
84
84
  class: "mobile-link",
85
85
  onClick: o[1] || (o[1] = n(() => {
86
86
  }, ["stop"]))
87
87
  }, [
88
- a("div", null, k(s.title), 1),
89
- a("p", D, k(s.description), 1)
88
+ a("div", null, k(r.title), 1),
89
+ a("p", D, k(r.description), 1)
90
90
  ], 8, H)), [
91
- [e, ["TopNav", `click-${s.trackEvent}`]]
91
+ [e, ["TopNav", `click-${r.trackEvent}`]]
92
92
  ])), 128))
93
93
  ])
94
94
  ]),
@@ -111,7 +111,7 @@ function B(v, o, b, P, d, $) {
111
111
  onClick: o[2] || (o[2] = n(() => {
112
112
  }, ["stop"]))
113
113
  }, o[12] || (o[12] = [
114
- r("About us")
114
+ s("About us")
115
115
  ]))), [
116
116
  [e, ["TopNav", "click-About-About us"]]
117
117
  ]),
@@ -121,7 +121,7 @@ function B(v, o, b, P, d, $) {
121
121
  onClick: o[3] || (o[3] = n(() => {
122
122
  }, ["stop"]))
123
123
  }, o[13] || (o[13] = [
124
- r("How Kiva works")
124
+ s("How Kiva works")
125
125
  ]))), [
126
126
  [e, ["TopNav", "click-About-How Kiva works"]]
127
127
  ]),
@@ -131,7 +131,7 @@ function B(v, o, b, P, d, $) {
131
131
  onClick: o[4] || (o[4] = n(() => {
132
132
  }, ["stop"]))
133
133
  }, o[14] || (o[14] = [
134
- r("Where Kiva works")
134
+ s("Where Kiva works")
135
135
  ]))), [
136
136
  [e, ["TopNav", "click-About-Where Kiva works"]]
137
137
  ]),
@@ -141,7 +141,7 @@ function B(v, o, b, P, d, $) {
141
141
  onClick: o[5] || (o[5] = n(() => {
142
142
  }, ["stop"]))
143
143
  }, o[15] || (o[15] = [
144
- r("Impact")
144
+ s("Impact")
145
145
  ]))), [
146
146
  [e, ["TopNav", "click-About-Impact"]]
147
147
  ]),
@@ -151,7 +151,7 @@ function B(v, o, b, P, d, $) {
151
151
  onClick: o[6] || (o[6] = n(() => {
152
152
  }, ["stop"]))
153
153
  }, o[16] || (o[16] = [
154
- r("Leadership")
154
+ s("Leadership")
155
155
  ]))), [
156
156
  [e, ["TopNav", "click-About-Leadership"]]
157
157
  ]),
@@ -161,7 +161,7 @@ function B(v, o, b, P, d, $) {
161
161
  onClick: o[7] || (o[7] = n(() => {
162
162
  }, ["stop"]))
163
163
  }, o[17] || (o[17] = [
164
- r("Finances")
164
+ s("Finances")
165
165
  ]))), [
166
166
  [e, ["TopNav", "click-About-Finances"]]
167
167
  ]),
@@ -171,7 +171,7 @@ function B(v, o, b, P, d, $) {
171
171
  onClick: o[8] || (o[8] = n(() => {
172
172
  }, ["stop"]))
173
173
  }, o[18] || (o[18] = [
174
- r("Press")
174
+ s("Press")
175
175
  ]))), [
176
176
  [e, ["TopNav", "click-About-Press"]]
177
177
  ]),
@@ -181,7 +181,7 @@ function B(v, o, b, P, d, $) {
181
181
  onClick: o[9] || (o[9] = n(() => {
182
182
  }, ["stop"]))
183
183
  }, o[19] || (o[19] = [
184
- r("Due diligence")
184
+ s("Due diligence")
185
185
  ]))), [
186
186
  [e, ["TopNav", "click-About-Due diligence"]]
187
187
  ])
@@ -193,7 +193,7 @@ function B(v, o, b, P, d, $) {
193
193
  ])
194
194
  ]);
195
195
  }
196
- const q = /* @__PURE__ */ y(I, [["render", B], ["__scopeId", "data-v-d1df98b6"]]);
196
+ const q = /* @__PURE__ */ y(I, [["render", B], ["__scopeId", "data-v-8418c5da"]]);
197
197
  export {
198
198
  q as default
199
199
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "7.2.2",
3
+ "version": "7.2.4",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -114,5 +114,5 @@
114
114
  "embla-carousel-fade",
115
115
  "popper.js"
116
116
  ],
117
- "gitHead": "a1f47f0b2511bbed3305b181a8e139e175657237"
117
+ "gitHead": "57ce77622d4fb48addabf3276df04ccb05de2438"
118
118
  }