@kiva/kv-components 3.11.2 → 3.13.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 +22 -0
- package/package.json +2 -2
- package/vue/KvProgressBar.vue +28 -1
- package/vue/KvToast.vue +2 -2
- package/vue/stories/KvProgressBar.stories.js +19 -3
- package/vue/stories/KvToast.stories.js +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.13.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.12.0...@kiva/kv-components@3.13.0) (2023-03-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* danger, caution, and ghost variants for KvPrgoressBar ([8b7e43f](https://github.com/kiva/kv-ui-elements/commit/8b7e43fd55e02fd01e2bc5488c86dd3984a7a42d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.12.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.11.2...@kiva/kv-components@3.12.0) (2023-02-10)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* hide delay param for toast ([d8620c0](https://github.com/kiva/kv-ui-elements/commit/d8620c06e2aa9b814bebdee7a5e1c150f06d77e9))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [3.11.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.11.1...@kiva/kv-components@3.11.2) (2023-01-25)
|
|
7
29
|
|
|
8
30
|
**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.13.0",
|
|
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": "ed1b307da3dda2636febbb5ddbf9230972a4e5e1"
|
|
73
73
|
}
|
package/vue/KvProgressBar.vue
CHANGED
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
>
|
|
13
13
|
<div
|
|
14
14
|
class="
|
|
15
|
-
tw-h-1 tw-w-full tw-absolute tw--left-full tw-rounded-full
|
|
15
|
+
tw-h-1 tw-w-full tw-absolute tw--left-full tw-rounded-full
|
|
16
16
|
tw-transition-all tw-duration-1000 tw-origin-left tw-ease-out
|
|
17
17
|
"
|
|
18
|
+
:class="variantClass"
|
|
18
19
|
:style="{transform: loaded ? `translateX(${percent}%)` : 'translateX(0)' }"
|
|
19
20
|
>
|
|
20
21
|
</div>
|
|
@@ -65,12 +66,24 @@ export default {
|
|
|
65
66
|
default: 0,
|
|
66
67
|
required: true,
|
|
67
68
|
},
|
|
69
|
+
/**
|
|
70
|
+
* Appearance of the progress bar
|
|
71
|
+
* `primary (default), ghost, danger, caution
|
|
72
|
+
* */
|
|
73
|
+
variant: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: 'primary',
|
|
76
|
+
validator(value) {
|
|
77
|
+
return ['primary', 'ghost', 'danger', 'caution'].includes(value);
|
|
78
|
+
},
|
|
79
|
+
},
|
|
68
80
|
},
|
|
69
81
|
setup(props) {
|
|
70
82
|
const {
|
|
71
83
|
min,
|
|
72
84
|
max,
|
|
73
85
|
value,
|
|
86
|
+
variant,
|
|
74
87
|
} = toRefs(props);
|
|
75
88
|
const loaded = ref(false);
|
|
76
89
|
|
|
@@ -81,6 +94,19 @@ export default {
|
|
|
81
94
|
return clamped;
|
|
82
95
|
});
|
|
83
96
|
|
|
97
|
+
const variantClass = computed(() => {
|
|
98
|
+
switch (variant.value) {
|
|
99
|
+
case 'ghost':
|
|
100
|
+
return 'tw-bg-tertiary';
|
|
101
|
+
case 'danger':
|
|
102
|
+
return 'tw-bg-danger';
|
|
103
|
+
case 'caution':
|
|
104
|
+
return 'tw-bg-caution';
|
|
105
|
+
default:
|
|
106
|
+
return 'tw-bg-brand';
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
84
110
|
const animateProgressBar = () => {
|
|
85
111
|
loaded.value = true;
|
|
86
112
|
};
|
|
@@ -94,6 +120,7 @@ export default {
|
|
|
94
120
|
loaded,
|
|
95
121
|
percent,
|
|
96
122
|
animateProgressBar,
|
|
123
|
+
variantClass,
|
|
97
124
|
};
|
|
98
125
|
},
|
|
99
126
|
};
|
package/vue/KvToast.vue
CHANGED
|
@@ -189,7 +189,7 @@ export default {
|
|
|
189
189
|
emit('close');
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
const show = (messageInput, type, persistInput) => {
|
|
192
|
+
const show = (messageInput, type, persistInput, hideDelay) => {
|
|
193
193
|
isVisible.value = true;
|
|
194
194
|
message.value = typeof messageInput === 'string' ? messageInput : '';
|
|
195
195
|
messageType.value = typeof type === 'string' ? type : '';
|
|
@@ -198,7 +198,7 @@ export default {
|
|
|
198
198
|
if (!persist.value) {
|
|
199
199
|
timeout.value = setTimeout(() => {
|
|
200
200
|
close();
|
|
201
|
-
}, msToDisplayToast.value);
|
|
201
|
+
}, hideDelay ?? msToDisplayToast.value);
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
|
|
@@ -7,7 +7,8 @@ export default {
|
|
|
7
7
|
min: 0,
|
|
8
8
|
max: 100,
|
|
9
9
|
value: 50,
|
|
10
|
-
ariaLabel: '',
|
|
10
|
+
ariaLabel: 'Amount the loan has fundraised',
|
|
11
|
+
variant: 'primary',
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
14
|
|
|
@@ -20,11 +21,26 @@ const Template = (args, { argTypes }) => ({
|
|
|
20
21
|
:min="min"
|
|
21
22
|
:max="max"
|
|
22
23
|
:value="value"
|
|
24
|
+
:variant="variant"
|
|
23
25
|
|
|
24
26
|
></kv-progress-bar>`,
|
|
25
27
|
});
|
|
26
28
|
|
|
27
29
|
export const Default = Template.bind({});
|
|
28
|
-
Default.args = {
|
|
29
|
-
|
|
30
|
+
Default.args = {};
|
|
31
|
+
|
|
32
|
+
// Variants
|
|
33
|
+
export const VariantCaution = Template.bind({});
|
|
34
|
+
VariantCaution.args = {
|
|
35
|
+
variant: 'caution',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const VariantDanger = Template.bind({});
|
|
39
|
+
VariantDanger.args = {
|
|
40
|
+
variant: 'danger',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const VariantGhost = Template.bind({});
|
|
44
|
+
VariantGhost.args = {
|
|
45
|
+
variant: 'ghost',
|
|
30
46
|
};
|
|
@@ -26,6 +26,11 @@ export default {
|
|
|
26
26
|
type: 'boolean',
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
|
+
hideDelay: {
|
|
30
|
+
control: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
29
34
|
},
|
|
30
35
|
};
|
|
31
36
|
|
|
@@ -39,7 +44,7 @@ const Template = (args, {
|
|
|
39
44
|
},
|
|
40
45
|
template: `
|
|
41
46
|
<div>
|
|
42
|
-
<kv-button @click="showToast(message, type, persist)">Show Toast</kv-button>
|
|
47
|
+
<kv-button @click="showToast(message, type, persist, hideDelay)">Show Toast</kv-button>
|
|
43
48
|
|
|
44
49
|
<!-- div below is a kludge for storybook docs -->
|
|
45
50
|
<div class="tw-fixed tw-z-toast tw-inset-0 tw-pointer-events-none">
|
|
@@ -49,8 +54,8 @@ const Template = (args, {
|
|
|
49
54
|
</div>
|
|
50
55
|
</div>`,
|
|
51
56
|
methods: {
|
|
52
|
-
showToast(messageInput, type, persistInput) {
|
|
53
|
-
this.$refs.toastRef.show(messageInput, type, persistInput);
|
|
57
|
+
showToast(messageInput, type, persistInput, hideDelay) {
|
|
58
|
+
this.$refs.toastRef.show(messageInput, type, persistInput, hideDelay);
|
|
54
59
|
},
|
|
55
60
|
onClose() {
|
|
56
61
|
},
|
|
@@ -72,6 +77,9 @@ withLongTextAndHtml.args = { message: 'This is a nice long content that could <b
|
|
|
72
77
|
export const persist = Template.bind({});
|
|
73
78
|
persist.args = { persist: true };
|
|
74
79
|
|
|
80
|
+
export const hideDelay = Template.bind({});
|
|
81
|
+
hideDelay.args = { hideDelay: 10000 };
|
|
82
|
+
|
|
75
83
|
const KivaLogoTemplate = (args, {
|
|
76
84
|
argTypes,
|
|
77
85
|
}) => ({
|