@kiva/kv-components 3.10.2 → 3.11.1
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 +19 -0
- package/package.json +2 -2
- package/vue/KvExpandableQuestion.vue +2 -0
- package/vue/KvToast.vue +29 -2
- package/vue/stories/KvToast.stories.js +36 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.11.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.11.0...@kiva/kv-components@3.11.1) (2023-01-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @kiva/kv-components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.11.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.10.2...@kiva/kv-components@3.11.0) (2023-01-19)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* kiva logo type added to kv toast component including an svg icon ([#227](https://github.com/kiva/kv-ui-elements/issues/227)) ([c24ecc1](https://github.com/kiva/kv-ui-elements/commit/c24ecc1295e32b817bf057f0570de56224c85c3f))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [3.10.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.10.1...@kiva/kv-components@3.10.2) (2022-12-07)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @kiva/kv-components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"optional": true
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "c9c8bbac3592a57f2b860511aea8d6f1fe38a954"
|
|
73
73
|
}
|
|
@@ -17,11 +17,13 @@
|
|
|
17
17
|
<div v-show="open">
|
|
18
18
|
<div class="tw-prose tw-pb-4 tw-pt-2">
|
|
19
19
|
<slot></slot>
|
|
20
|
+
<!-- eslint-disable vue/no-v-html -->
|
|
20
21
|
<div
|
|
21
22
|
v-if="content !== ''"
|
|
22
23
|
v-html="content"
|
|
23
24
|
>
|
|
24
25
|
</div>
|
|
26
|
+
<!--eslint-enable-->
|
|
25
27
|
</div>
|
|
26
28
|
</div>
|
|
27
29
|
</kv-expandable>
|
package/vue/KvToast.vue
CHANGED
|
@@ -35,13 +35,30 @@
|
|
|
35
35
|
"
|
|
36
36
|
:class="{
|
|
37
37
|
'tw-bg-brand tw-text-white' : (
|
|
38
|
-
messageType === '' || messageType === 'confirmation'
|
|
38
|
+
messageType === '' || messageType === 'confirmation' ||
|
|
39
|
+
messageType === 'kiva-logo'
|
|
39
40
|
),
|
|
40
41
|
'tw-bg-danger tw-text-primary-inverse' : messageType === 'error',
|
|
41
42
|
'tw-bg-caution tw-text-primary' : messageType === 'warning',
|
|
42
43
|
}"
|
|
43
44
|
>
|
|
45
|
+
<!-- Kiva Icon SVG -->
|
|
46
|
+
<!-- eslint-disable max-len -->
|
|
47
|
+
<svg
|
|
48
|
+
v-if="messageType === 'kiva-logo'"
|
|
49
|
+
width="16"
|
|
50
|
+
height="24"
|
|
51
|
+
viewBox="0 0 16 24"
|
|
52
|
+
fill="none"
|
|
53
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
54
|
+
>
|
|
55
|
+
<path
|
|
56
|
+
d="M4.78202 0H0V23.141H4.78202V0ZM6.00533 14.6274C13.6788 14.6274 15.4582 8.05649 15.4582 6.91372H14.7909C7.11743 6.91372 5.33807 13.4846 5.33807 14.6274H6.00533ZM5.33807 15.1988C5.33807 16.3987 6.67259 23.0838 14.9021 23.0838H15.5694C15.5694 21.8839 14.2349 15.1988 6.00533 15.1988H5.33807Z"
|
|
57
|
+
fill="white"
|
|
58
|
+
/>
|
|
59
|
+
</svg>
|
|
44
60
|
<kv-material-icon
|
|
61
|
+
v-else
|
|
45
62
|
class="tw-w-2.5 tw-h-2.5"
|
|
46
63
|
:icon="icon"
|
|
47
64
|
/>
|
|
@@ -54,11 +71,18 @@
|
|
|
54
71
|
tw-flex
|
|
55
72
|
"
|
|
56
73
|
>
|
|
74
|
+
<slot
|
|
75
|
+
v-if="hasToastContentSlot"
|
|
76
|
+
name="toastContent"
|
|
77
|
+
></slot>
|
|
78
|
+
<!-- eslint-disable vue/no-v-html -->
|
|
57
79
|
<p
|
|
80
|
+
v-else
|
|
58
81
|
class="tw-inline-block tw-m-auto"
|
|
59
82
|
v-html="message"
|
|
60
83
|
>
|
|
61
84
|
</p>
|
|
85
|
+
<!--eslint-enable-->
|
|
62
86
|
</div>
|
|
63
87
|
|
|
64
88
|
<button
|
|
@@ -122,7 +146,7 @@ export default {
|
|
|
122
146
|
emits: [
|
|
123
147
|
'close',
|
|
124
148
|
],
|
|
125
|
-
setup(props, { emit }) {
|
|
149
|
+
setup(props, { emit, slots }) {
|
|
126
150
|
const isVisible = ref(false);
|
|
127
151
|
const message = ref('');
|
|
128
152
|
const messageType = ref('confirmation'); // 'error', 'info', 'confirmation'
|
|
@@ -152,6 +176,8 @@ export default {
|
|
|
152
176
|
return Math.max(characterMs, MINIMUM_MS);
|
|
153
177
|
});
|
|
154
178
|
|
|
179
|
+
const hasToastContentSlot = computed(() => !!slots?.toastContent ?? false);
|
|
180
|
+
|
|
155
181
|
const close = () => {
|
|
156
182
|
isVisible.value = false;
|
|
157
183
|
clearTimeout(timeout.value);
|
|
@@ -187,6 +213,7 @@ export default {
|
|
|
187
213
|
msToDisplayToast,
|
|
188
214
|
close,
|
|
189
215
|
show,
|
|
216
|
+
hasToastContentSlot,
|
|
190
217
|
};
|
|
191
218
|
},
|
|
192
219
|
};
|
|
@@ -50,11 +50,9 @@ const Template = (args, {
|
|
|
50
50
|
</div>`,
|
|
51
51
|
methods: {
|
|
52
52
|
showToast(messageInput, type, persistInput) {
|
|
53
|
-
console.log(this.$refs.toastRef);
|
|
54
53
|
this.$refs.toastRef.show(messageInput, type, persistInput);
|
|
55
54
|
},
|
|
56
55
|
onClose() {
|
|
57
|
-
console.log('toast closed');
|
|
58
56
|
},
|
|
59
57
|
},
|
|
60
58
|
});
|
|
@@ -73,3 +71,39 @@ withLongTextAndHtml.args = { message: 'This is a nice long content that could <b
|
|
|
73
71
|
|
|
74
72
|
export const persist = Template.bind({});
|
|
75
73
|
persist.args = { persist: true };
|
|
74
|
+
|
|
75
|
+
const KivaLogoTemplate = (args, {
|
|
76
|
+
argTypes,
|
|
77
|
+
}) => ({
|
|
78
|
+
props: Object.keys(argTypes),
|
|
79
|
+
components: {
|
|
80
|
+
KvToast,
|
|
81
|
+
KvButton,
|
|
82
|
+
},
|
|
83
|
+
template: `
|
|
84
|
+
<div>
|
|
85
|
+
<kv-button @click="showToast(message, type, persist)">Show Toast</kv-button>
|
|
86
|
+
|
|
87
|
+
<!-- div below is a kludge for storybook docs -->
|
|
88
|
+
<div class="tw-fixed tw-z-toast tw-inset-0 tw-pointer-events-none">
|
|
89
|
+
<div class="tw-fixed tw-left-0 tw-right-0 tw-top-2 tw-pointer-events-auto">
|
|
90
|
+
<kv-toast ref="toastRef" @close="onClose">
|
|
91
|
+
<template #toastContent>
|
|
92
|
+
<div>
|
|
93
|
+
Welcome to Lending home! We’re doing something new based on your feedback this year. <button class="tw-text-action">Read more here</button>
|
|
94
|
+
</div>
|
|
95
|
+
</template>
|
|
96
|
+
</kv-toast>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>`,
|
|
100
|
+
methods: {
|
|
101
|
+
showToast(messageInput, type, persistInput) {
|
|
102
|
+
this.$refs.toastRef.show(messageInput, type, persistInput);
|
|
103
|
+
},
|
|
104
|
+
onClose() {
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
export const typeKivaLogo = KivaLogoTemplate.bind({});
|
|
109
|
+
typeKivaLogo.args = { type: 'kiva-logo', message: '' };
|