@kiva/kv-components 3.7.0 → 3.8.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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.8.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.7.1...@kiva/kv-components@3.8.0) (2022-10-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* created and implemented a reusable global component and story (KvExpandableQuestion)[VUE-1318] ([173ae50](https://github.com/kiva/kv-ui-elements/commit/173ae50e88dffa7dabb7392404ccdb813307ea31))
|
|
12
|
+
* removed analyticsCategory prop, edited other code blocks ([2864261](https://github.com/kiva/kv-ui-elements/commit/2864261b55517bab8099b84b404d09aaae37b489))
|
|
13
|
+
* removed line 84, and converted faq into a string ([8f5a3da](https://github.com/kiva/kv-ui-elements/commit/8f5a3dab81556997a6eb7dd0e5dffac2babff104))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [3.7.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.7.0...@kiva/kv-components@3.7.1) (2022-09-27)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **KvContentfulImg:** match size and fit of picture to figure wrapper MARS-265 ([f6ede31](https://github.com/kiva/kv-ui-elements/commit/f6ede316c286871cc685e0840a6c2b9452ee48e3))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [3.7.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.6.2...@kiva/kv-components@3.7.0) (2022-09-24)
|
|
7
31
|
|
|
8
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@mdi/js": "^5.9.55",
|
|
55
55
|
"@vueuse/integrations": "^7.6.0",
|
|
56
56
|
"aria-hidden": "^1.1.3",
|
|
57
|
+
"change-case": "^4.1.2",
|
|
57
58
|
"embla-carousel": "^4.5.3",
|
|
58
59
|
"focus-trap": "^6.7.2",
|
|
59
60
|
"nanoid": "^3.1.23",
|
|
@@ -68,5 +69,5 @@
|
|
|
68
69
|
"optional": true
|
|
69
70
|
}
|
|
70
71
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "ea1adfefc0d8e3169fc80b7745a01a6cd1b07c58"
|
|
72
73
|
}
|
package/vue/KvContentfulImg.vue
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
v-if="(width || height) && contentfulSrc"
|
|
4
4
|
class="tw-inline-block tw-not-prose"
|
|
5
5
|
>
|
|
6
|
-
<picture
|
|
6
|
+
<picture
|
|
7
|
+
class="tw-h-full tw-w-full"
|
|
8
|
+
style="object-fit: inherit;"
|
|
9
|
+
>
|
|
7
10
|
<!-- Set of image sources -->
|
|
8
11
|
<template v-if="sourceSizes.length > 0">
|
|
9
12
|
<!-- browser supports webp -->
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<button
|
|
4
|
+
class="tw-w-full tw-py-2 tw-flex tw-justify-between"
|
|
5
|
+
@click="toggleFAQ"
|
|
6
|
+
>
|
|
7
|
+
<h3 class="tw-text-subhead tw-text-left">
|
|
8
|
+
{{ title }}
|
|
9
|
+
</h3>
|
|
10
|
+
<kv-material-icon
|
|
11
|
+
class="tw-w-4 tw-h-4"
|
|
12
|
+
:icon="open ? mdiChevronUp : mdiChevronDown"
|
|
13
|
+
@click="open = !open"
|
|
14
|
+
/>
|
|
15
|
+
</button>
|
|
16
|
+
<kv-expandable easing="ease-in-out">
|
|
17
|
+
<div
|
|
18
|
+
v-show="open"
|
|
19
|
+
class="tw-prose tw-pb-4 tw-pt-2"
|
|
20
|
+
v-html="content"
|
|
21
|
+
>
|
|
22
|
+
</div>
|
|
23
|
+
</kv-expandable>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
import {
|
|
29
|
+
computed,
|
|
30
|
+
onMounted,
|
|
31
|
+
watch,
|
|
32
|
+
ref,
|
|
33
|
+
toRefs,
|
|
34
|
+
} from 'vue-demi';
|
|
35
|
+
import {
|
|
36
|
+
mdiChevronDown,
|
|
37
|
+
mdiChevronUp,
|
|
38
|
+
} from '@mdi/js';
|
|
39
|
+
import { paramCase } from 'change-case';
|
|
40
|
+
|
|
41
|
+
import KvExpandable from './KvExpandable.vue';
|
|
42
|
+
import KvMaterialIcon from './KvMaterialIcon.vue';
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
components: {
|
|
46
|
+
KvMaterialIcon,
|
|
47
|
+
KvExpandable,
|
|
48
|
+
},
|
|
49
|
+
props: {
|
|
50
|
+
/**
|
|
51
|
+
* Question Title
|
|
52
|
+
* */
|
|
53
|
+
title: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '',
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Question Content - can accept raw html
|
|
59
|
+
* */
|
|
60
|
+
content: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: '',
|
|
63
|
+
},
|
|
64
|
+
active: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false,
|
|
67
|
+
},
|
|
68
|
+
routeHash: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: '',
|
|
71
|
+
},
|
|
72
|
+
kvTrackFunction: {
|
|
73
|
+
type: Function,
|
|
74
|
+
default: () => {},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
emits: [
|
|
78
|
+
'toggle',
|
|
79
|
+
],
|
|
80
|
+
setup(props, { emit }) {
|
|
81
|
+
const {
|
|
82
|
+
title,
|
|
83
|
+
active,
|
|
84
|
+
} = toRefs(props);
|
|
85
|
+
const open = ref(active.value || false);
|
|
86
|
+
const titleSlugified = computed(() => paramCase(title.value));
|
|
87
|
+
|
|
88
|
+
const toggleFAQ = () => {
|
|
89
|
+
props.kvTrackFunction('faq', 'toggle', titleSlugified, open.value ? 'expand' : 'collapse');
|
|
90
|
+
open.value = !open.value;
|
|
91
|
+
emit('toggle', { title: titleSlugified });
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
watch(active, (val) => {
|
|
95
|
+
open.value = val;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
onMounted(() => {
|
|
99
|
+
/** Allows directly linking to the question via a hash equal to slugified title */
|
|
100
|
+
if (props.routeHash === `#${titleSlugified.value}`) {
|
|
101
|
+
open.value = true;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
open,
|
|
107
|
+
mdiChevronDown,
|
|
108
|
+
mdiChevronUp,
|
|
109
|
+
titleSlugified,
|
|
110
|
+
toggleFAQ,
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
</script>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import KvExpandableQuestion from '../KvExpandableQuestion.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'KvExpandableQuestion',
|
|
5
|
+
component: KvExpandableQuestion,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const DefaultTemplate = () => ({
|
|
9
|
+
components: { KvExpandableQuestion },
|
|
10
|
+
template: `
|
|
11
|
+
<div style="padding: 20px;">
|
|
12
|
+
<kv-expandable-question
|
|
13
|
+
id="expandable-question-test"
|
|
14
|
+
title="expandable-question-title"
|
|
15
|
+
content="<p> Hello, KvAccordion Contents! </p>"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
`,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const Default = DefaultTemplate.bind({});
|
|
22
|
+
|
|
23
|
+
const expandableQuestions = [
|
|
24
|
+
{
|
|
25
|
+
title: 'expandable question title one',
|
|
26
|
+
content: '<p> Hello, KvAccordion Contents! </p>',
|
|
27
|
+
id: 'expandable-question-test-1',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: 'expandable question title two',
|
|
31
|
+
content: '<p> Hello, KvAccordion Contents! </p>',
|
|
32
|
+
id: 'expandable-question-test-2',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: 'expandable question title three',
|
|
36
|
+
content: '<p> Hello, KvAccordion Contents! </p>',
|
|
37
|
+
id: 'expandable-question-test-3',
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const GroupTemplate = () => ({
|
|
42
|
+
components: { KvExpandableQuestion },
|
|
43
|
+
data: () => ({
|
|
44
|
+
questions: expandableQuestions,
|
|
45
|
+
}),
|
|
46
|
+
methods: {
|
|
47
|
+
kvTrackMock(
|
|
48
|
+
category,
|
|
49
|
+
action,
|
|
50
|
+
label,
|
|
51
|
+
) {
|
|
52
|
+
console.log(category, action, label);
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
template: `
|
|
56
|
+
<div style="padding: 20px;">
|
|
57
|
+
<kv-expandable-question
|
|
58
|
+
v-for="(question, index) in questions"
|
|
59
|
+
:key="index"
|
|
60
|
+
:id="question.id"
|
|
61
|
+
:title="question.title"
|
|
62
|
+
:content="question.content"
|
|
63
|
+
:active="question.id === 'expandable-question-test-2'"
|
|
64
|
+
:kv-track-function="kvTrackMock"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
`,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export const ExpandableSet = GroupTemplate.bind({});
|