@kiva/kv-components 7.2.1 → 7.2.3
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
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:
|
|
8
|
-
KvContentfulImg:
|
|
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(
|
|
33
|
-
const
|
|
34
|
-
|
|
47
|
+
setup(s, { emit: g }) {
|
|
48
|
+
const i = M(null), n = (e) => {
|
|
49
|
+
i.value = e, g("category-selected", e);
|
|
35
50
|
};
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
V(() => {
|
|
52
|
+
s.preSelectedCategory && n(s.preSelectedCategory);
|
|
38
53
|
});
|
|
39
|
-
const
|
|
40
|
-
var
|
|
54
|
+
const _ = (e) => {
|
|
55
|
+
var k, p, b, v, y, I, S, E, L;
|
|
41
56
|
if (e.contentfulEntry) {
|
|
42
|
-
const
|
|
43
|
-
(
|
|
44
|
-
var
|
|
45
|
-
return (
|
|
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 ((
|
|
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
|
-
},
|
|
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:
|
|
71
|
+
contentfulImage: _(e) || null
|
|
57
72
|
})));
|
|
58
73
|
return {
|
|
59
|
-
selectedCategory:
|
|
60
|
-
formattedCategories:
|
|
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
|
-
},
|
|
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
|
|
69
|
-
const
|
|
70
|
-
return r(),
|
|
71
|
-
|
|
72
|
-
(r(!0),
|
|
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: (
|
|
99
|
+
onClick: (x) => n.selectCategory(t.id)
|
|
78
100
|
}, {
|
|
79
|
-
default:
|
|
80
|
-
|
|
81
|
-
|
|
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:
|
|
107
|
+
class: d(n.imageClasses),
|
|
84
108
|
alt: `${t.name} image`,
|
|
85
109
|
"contentful-src": t.contentfulImage,
|
|
86
|
-
width:
|
|
87
|
-
}, null, 8, ["alt", "contentful-src", "width"])) : t != null && t.customImage ? (r(),
|
|
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:
|
|
113
|
+
class: d(n.imageClasses),
|
|
90
114
|
alt: `${t.name} image`,
|
|
91
115
|
src: t.customImage,
|
|
92
|
-
width:
|
|
93
|
-
}, null,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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(),
|
|
130
|
+
n.formattedCategories.length === 0 ? (r(), l("p", R, " No categories available ")) : f("", !0)
|
|
104
131
|
]);
|
|
105
132
|
}
|
|
106
|
-
const
|
|
133
|
+
const $ = /* @__PURE__ */ q(G, [["render", T]]);
|
|
107
134
|
export {
|
|
108
|
-
|
|
135
|
+
$ as default
|
|
109
136
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as r, onMounted as f, onBeforeUnmount as g, resolveComponent as h, resolveDirective as y, openBlock as s, createElementBlock as d, normalizeClass as u, withDirectives as m, withModifiers as b, createVNode as k, createElementVNode as S, normalizeStyle as C, renderSlot as M, vShow as z } from "vue";
|
|
2
2
|
import { mdiDotsVertical as w } from "@mdi/js";
|
|
3
3
|
import _ from "./KvMaterialIcon.js";
|
|
4
|
-
import
|
|
5
|
-
const
|
|
4
|
+
import B from "../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const p = {
|
|
6
6
|
name: "KvUtilityMenu",
|
|
7
7
|
components: {
|
|
8
8
|
KvMaterialIcon: _
|
|
@@ -22,11 +22,12 @@ const A = {
|
|
|
22
22
|
},
|
|
23
23
|
buttonSize: {
|
|
24
24
|
type: String,
|
|
25
|
-
default: "
|
|
25
|
+
default: "large",
|
|
26
26
|
validator(n) {
|
|
27
27
|
return [
|
|
28
28
|
"small",
|
|
29
|
-
"medium"
|
|
29
|
+
"medium",
|
|
30
|
+
"large"
|
|
30
31
|
].includes(n);
|
|
31
32
|
}
|
|
32
33
|
},
|
|
@@ -34,6 +35,14 @@ const A = {
|
|
|
34
35
|
type: String,
|
|
35
36
|
default: w
|
|
36
37
|
},
|
|
38
|
+
menuBorderClass: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "tw-border tw-border-tertiary"
|
|
41
|
+
},
|
|
42
|
+
menuRadiusClass: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "tw-rounded"
|
|
45
|
+
},
|
|
37
46
|
menuPosition: {
|
|
38
47
|
type: String,
|
|
39
48
|
default: "left-aligned",
|
|
@@ -49,8 +58,8 @@ const A = {
|
|
|
49
58
|
"kv-utility-menu-clicked"
|
|
50
59
|
],
|
|
51
60
|
setup(n, { emit: i }) {
|
|
52
|
-
const t =
|
|
53
|
-
t.value && !t.value.contains(
|
|
61
|
+
const t = r(null), e = r(!1), c = r(null), l = (a) => {
|
|
62
|
+
t.value && !t.value.contains(a.target) && (e.value = !1);
|
|
54
63
|
}, o = () => {
|
|
55
64
|
e.value = !e.value, i("kv-utility-menu-clicked", { open: e.value });
|
|
56
65
|
};
|
|
@@ -68,11 +77,15 @@ const A = {
|
|
|
68
77
|
};
|
|
69
78
|
}
|
|
70
79
|
};
|
|
71
|
-
function
|
|
72
|
-
const o = h("KvMaterialIcon"),
|
|
80
|
+
function A(n, i, t, e, c, l) {
|
|
81
|
+
const o = h("KvMaterialIcon"), a = y("kv-track-event");
|
|
73
82
|
return s(), d("div", {
|
|
74
83
|
class: u(["tw-relative utility-menu-wrapper", [
|
|
75
|
-
|
|
84
|
+
{
|
|
85
|
+
"tw-w-4 tw-h-4": t.buttonSize === "small",
|
|
86
|
+
"tw-w-5 tw-h-5": t.buttonSize === "medium",
|
|
87
|
+
"tw-w-6 tw-h-6": t.buttonSize === "large"
|
|
88
|
+
}
|
|
76
89
|
]])
|
|
77
90
|
}, [
|
|
78
91
|
m((s(), d("button", {
|
|
@@ -80,28 +93,36 @@ function B(n, i, t, e, c, l) {
|
|
|
80
93
|
class: u(["tw-absolute tw-bg-white tw-flex tw-items-center tw-justify-center menu-trigger", [
|
|
81
94
|
t.buttonBorderClass,
|
|
82
95
|
t.buttonRadiusClass,
|
|
83
|
-
|
|
96
|
+
{
|
|
97
|
+
"tw-w-4 tw-h-4": t.buttonSize === "small",
|
|
98
|
+
"tw-w-5 tw-h-5": t.buttonSize === "medium",
|
|
99
|
+
"tw-w-6 tw-h-6": t.buttonSize === "large"
|
|
100
|
+
}
|
|
84
101
|
]]),
|
|
85
|
-
onClick: i[0] || (i[0] =
|
|
102
|
+
onClick: i[0] || (i[0] = b((...v) => e.handleMenuAnchorClick && e.handleMenuAnchorClick(...v), ["stop"]))
|
|
86
103
|
}, [
|
|
87
|
-
|
|
104
|
+
k(o, { icon: t.icon }, null, 8, ["icon"])
|
|
88
105
|
], 2)), [
|
|
89
|
-
[
|
|
106
|
+
[a, [t.analyticsCategory, "click", "utility-menu"]]
|
|
90
107
|
]),
|
|
91
|
-
m(
|
|
108
|
+
m(S("div", {
|
|
92
109
|
ref: "optionsMenu",
|
|
93
|
-
class: u(["tw-absolute tw-
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
class: u(["tw-absolute tw-bg-white tw-z-1 tw-shadow-lg vertical-menu", [
|
|
111
|
+
t.menuBorderClass,
|
|
112
|
+
t.menuRadiusClass,
|
|
113
|
+
{
|
|
114
|
+
"tw-right-0": t.menuPosition === "right-aligned"
|
|
115
|
+
}
|
|
116
|
+
]]),
|
|
96
117
|
style: C(`width: 236px; top: ${t.buttonSize === "small" ? "2.5rem" : "3.5rem"};`)
|
|
97
118
|
}, [
|
|
98
119
|
M(n.$slots, "default")
|
|
99
120
|
], 6), [
|
|
100
|
-
[
|
|
121
|
+
[z, e.menuOpen]
|
|
101
122
|
])
|
|
102
123
|
], 2);
|
|
103
124
|
}
|
|
104
|
-
const
|
|
125
|
+
const D = /* @__PURE__ */ B(p, [["render", A]]);
|
|
105
126
|
export {
|
|
106
|
-
|
|
127
|
+
D as default
|
|
107
128
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.3",
|
|
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": "
|
|
117
|
+
"gitHead": "50e5dc38a0640b6fab10cf490c57825edac585a9"
|
|
118
118
|
}
|