@kiva/kv-components 3.38.2 → 3.39.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 +11 -0
- package/package.json +2 -2
- package/tailwind.config.cjs +2 -0
- package/vue/KvToast.vue +23 -9
- package/vue/stories/KvToast.stories.js +26 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.39.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.38.2...@kiva/kv-components@3.39.0) (2023-09-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add bg and drop shadow toast variations ([a2b045d](https://github.com/kiva/kv-ui-elements/commit/a2b045d0823d55d1c643105fde2a847a0713f55f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [3.38.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.38.1...@kiva/kv-components@3.38.2) (2023-08-31)
|
|
7
18
|
|
|
8
19
|
**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.39.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"optional": true
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "3205fcfb9e4a34fedfa0b5063751288a387daef5"
|
|
79
79
|
}
|
package/tailwind.config.cjs
CHANGED
|
@@ -37,6 +37,7 @@ const fontWeight = buildValuesFromThemeObj(theme.fontWeight);
|
|
|
37
37
|
const radii = buildValuesFromThemeObj(theme.borderRadius);
|
|
38
38
|
const opacity = buildValuesFromThemeObj(theme.opacity);
|
|
39
39
|
const zIndices = buildValuesFromThemeObj(theme.zIndex);
|
|
40
|
+
const boxShadows = buildValuesFromThemeObj(theme.boxShadow);
|
|
40
41
|
|
|
41
42
|
const safelist = [
|
|
42
43
|
...backgroundColor.map((color) => buildTailwindClassName(`${themePrefix}bg`, color)),
|
|
@@ -49,6 +50,7 @@ const safelist = [
|
|
|
49
50
|
...radii.map((radius) => buildTailwindClassName(`${themePrefix}radius`, radius)),
|
|
50
51
|
...opacity.map((opacityVal) => buildTailwindClassName(`${themePrefix}opacity`, opacityVal)),
|
|
51
52
|
...zIndices.map((zIndex) => buildTailwindClassName(`${themePrefix}z`, zIndex)),
|
|
53
|
+
...boxShadows.map((boxShadow) => buildTailwindClassName(`${themePrefix}shadow`, boxShadow)),
|
|
52
54
|
];
|
|
53
55
|
|
|
54
56
|
module.exports = {
|
package/vue/KvToast.vue
CHANGED
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
class="
|
|
22
22
|
tw-rounded tw-overflow-hidden
|
|
23
23
|
tw-flex
|
|
24
|
-
tw-bg-secondary
|
|
25
24
|
tw-mx-auto
|
|
26
25
|
tw-w-full md:tw-w-max md:tw-max-w-full md:tw-min-w-1/2
|
|
27
26
|
"
|
|
27
|
+
:class="[backgroundClass, { 'tw-shadow': applyDropShadow }]"
|
|
28
28
|
>
|
|
29
29
|
<div
|
|
30
30
|
class="
|
|
@@ -87,13 +87,13 @@
|
|
|
87
87
|
|
|
88
88
|
<button
|
|
89
89
|
class="
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
tw-w-5
|
|
91
|
+
tw-flex-shrink-0
|
|
92
|
+
tw-flex
|
|
93
|
+
tw-items-center tw-justify-center
|
|
94
|
+
hover:tw-text-action-highlight
|
|
95
|
+
"
|
|
96
|
+
:class="[backgroundClass]"
|
|
97
97
|
@click="close"
|
|
98
98
|
>
|
|
99
99
|
<kv-material-icon
|
|
@@ -150,9 +150,19 @@ export default {
|
|
|
150
150
|
const isVisible = ref(false);
|
|
151
151
|
const message = ref('');
|
|
152
152
|
const messageType = ref('confirmation'); // 'error', 'info', 'confirmation'
|
|
153
|
+
const backgroundType = ref('secondary'); // 'primary', 'secondary', 'tertiary'
|
|
154
|
+
const applyDropShadow = ref(false);
|
|
153
155
|
const persist = ref(false);
|
|
154
156
|
const timeout = ref(null);
|
|
155
157
|
|
|
158
|
+
const backgroundClass = computed(() => {
|
|
159
|
+
switch (backgroundType.value) {
|
|
160
|
+
case 'primary': return 'tw-bg-primary';
|
|
161
|
+
case 'tertiary': return 'tw-bg-tertiary';
|
|
162
|
+
default: return 'tw-bg-secondary';
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
156
166
|
const icon = computed(() => {
|
|
157
167
|
if (messageType.value === 'warning') {
|
|
158
168
|
return mdiAlert;
|
|
@@ -189,10 +199,12 @@ export default {
|
|
|
189
199
|
emit('close');
|
|
190
200
|
};
|
|
191
201
|
|
|
192
|
-
const show = (messageInput, type, persistInput, hideDelay) => {
|
|
202
|
+
const show = (messageInput, type, persistInput, hideDelay, background, dropShadow) => {
|
|
193
203
|
isVisible.value = true;
|
|
194
204
|
message.value = typeof messageInput === 'string' ? messageInput : '';
|
|
195
205
|
messageType.value = typeof type === 'string' ? type : '';
|
|
206
|
+
backgroundType.value = typeof background === 'string' ? background : '';
|
|
207
|
+
applyDropShadow.value = Boolean(dropShadow);
|
|
196
208
|
persist.value = Boolean(persistInput);
|
|
197
209
|
|
|
198
210
|
if (!persist.value) {
|
|
@@ -214,6 +226,8 @@ export default {
|
|
|
214
226
|
close,
|
|
215
227
|
show,
|
|
216
228
|
hasToastContentSlot,
|
|
229
|
+
backgroundClass,
|
|
230
|
+
applyDropShadow,
|
|
217
231
|
};
|
|
218
232
|
},
|
|
219
233
|
};
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
title: 'KvToast',
|
|
6
6
|
component: KvToast,
|
|
7
7
|
args: {
|
|
8
|
-
message: '
|
|
8
|
+
message: 'Successfully added to basket!',
|
|
9
9
|
persist: false,
|
|
10
10
|
type: 'confirmation',
|
|
11
11
|
},
|
|
@@ -31,6 +31,16 @@ export default {
|
|
|
31
31
|
type: 'number',
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
|
+
background: {
|
|
35
|
+
control: {
|
|
36
|
+
type: 'text',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
dropShadow: {
|
|
40
|
+
control: {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
34
44
|
},
|
|
35
45
|
};
|
|
36
46
|
|
|
@@ -44,7 +54,7 @@ const Template = (args, {
|
|
|
44
54
|
},
|
|
45
55
|
template: `
|
|
46
56
|
<div>
|
|
47
|
-
<kv-button @click="showToast(message, type, persist, hideDelay)">Show Toast</kv-button>
|
|
57
|
+
<kv-button @click="showToast(message, type, persist, hideDelay, background, dropShadow)">Show Toast</kv-button>
|
|
48
58
|
|
|
49
59
|
<!-- div below is a kludge for storybook docs -->
|
|
50
60
|
<div class="tw-fixed tw-z-toast tw-inset-0 tw-pointer-events-none">
|
|
@@ -54,8 +64,8 @@ const Template = (args, {
|
|
|
54
64
|
</div>
|
|
55
65
|
</div>`,
|
|
56
66
|
methods: {
|
|
57
|
-
showToast(messageInput, type, persistInput, hideDelay) {
|
|
58
|
-
this.$refs.toastRef.show(messageInput, type, persistInput, hideDelay);
|
|
67
|
+
showToast(messageInput, type, persistInput, hideDelay, background, dropShadow) {
|
|
68
|
+
this.$refs.toastRef.show(messageInput, type, persistInput, hideDelay, background, dropShadow);
|
|
59
69
|
},
|
|
60
70
|
onClose() {
|
|
61
71
|
},
|
|
@@ -80,6 +90,18 @@ persist.args = { persist: true };
|
|
|
80
90
|
export const hideDelay = Template.bind({});
|
|
81
91
|
hideDelay.args = { hideDelay: 10000 };
|
|
82
92
|
|
|
93
|
+
export const backgroundPrimary = Template.bind({});
|
|
94
|
+
backgroundPrimary.args = { background: 'primary' };
|
|
95
|
+
|
|
96
|
+
export const backgroundSecondary = Template.bind({});
|
|
97
|
+
backgroundSecondary.args = { background: 'secondary' };
|
|
98
|
+
|
|
99
|
+
export const backgroundTertiary = Template.bind({});
|
|
100
|
+
backgroundTertiary.args = { background: 'tertiary' };
|
|
101
|
+
|
|
102
|
+
export const dropShadow = Template.bind({});
|
|
103
|
+
dropShadow.args = { dropShadow: true };
|
|
104
|
+
|
|
83
105
|
const KivaLogoTemplate = (args, {
|
|
84
106
|
argTypes,
|
|
85
107
|
}) => ({
|