@kiva/kv-components 0.20.3 → 0.21.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 +45 -0
- package/package.json +2 -2
- package/vue/.storybook/preview.js +1 -1
- package/vue/KvButton.vue +51 -15
- package/vue/KvCarousel.vue +8 -6
- package/vue/KvLightbox.vue +4 -3
- package/vue/stories/KvButton.stories.js +5 -0
- package/vue/stories/KvLightbox.stories.js +80 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
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
|
+
## [0.21.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@0.21.0...@kiva/kv-components@0.21.1) (2021-09-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **KvButton:** prevent underline on focus when button is an anchor tag ([10199ba](https://github.com/kiva/kv-ui-elements/commit/10199badc4bec6ae0badc420df5b0c2d7fed59e3))
|
|
12
|
+
* Use themable class names. Change to low-opacity instead of text-color for disabled state. ([6aa9f0d](https://github.com/kiva/kv-ui-elements/commit/6aa9f0dc9d0952e172848fdbd834fecb94cd0bc2))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [0.21.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@0.20.5...@kiva/kv-components@0.21.0) (2021-09-23)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **KvButton:** Add active state prop and styling ([5c97148](https://github.com/kiva/kv-ui-elements/commit/5c9714835cea5536f7fc88b36483f691b5cba9a3))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [0.20.5](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@0.20.4...@kiva/kv-components@0.20.5) (2021-09-23)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* Remove unnecessary lightbox class and webkit fix, make lightbox stories initialize with open lightboxes for better visual diffs ([#117](https://github.com/kiva/kv-ui-elements/issues/117)) ([1aa4f33](https://github.com/kiva/kv-ui-elements/commit/1aa4f33c1d9425874e54058930a753d7aab6773e))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [0.20.4](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@0.20.3...@kiva/kv-components@0.20.4) (2021-09-23)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* Fix lightboxes being cut off vertically on mobile ([#116](https://github.com/kiva/kv-ui-elements/issues/116)) ([23dd4d9](https://github.com/kiva/kv-ui-elements/commit/23dd4d91ba9aa4178644afe1cbd2bdf98de0d05a))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
6
51
|
## [0.20.3](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@0.20.2...@kiva/kv-components@0.20.3) (2021-09-23)
|
|
7
52
|
|
|
8
53
|
**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": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"vue": "^2.6.12",
|
|
54
54
|
"vue-focus-lock": "^1.4.1"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "784234382fc9635832d775c9c32470dcdb056bb4"
|
|
57
57
|
}
|
package/vue/KvButton.vue
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:href="href"
|
|
7
7
|
:type="computedType"
|
|
8
8
|
:disabled="isDisabled"
|
|
9
|
-
class="hover:tw-no-underline tw-inline-block"
|
|
9
|
+
class="hover:tw-no-underline focus:tw-no-underline tw-inline-block"
|
|
10
10
|
:class="{
|
|
11
11
|
'tw-opacity-low': state === 'disabled',
|
|
12
12
|
'tw-pointer-events-none': state === 'loading' || isDisabled
|
|
@@ -18,18 +18,7 @@
|
|
|
18
18
|
ref="buttonInnerRef"
|
|
19
19
|
class="tw-inline-flex tw-w-full tw-justify-center tw-items-center tw-rounded
|
|
20
20
|
tw-min-h-6 tw-relative tw-overflow-hidden tw-border tw-font-medium"
|
|
21
|
-
:class="
|
|
22
|
-
'tw-bg-action hover:tw-bg-action-highlight tw-text-primary-inverse tw-border-action hover:tw-border-action-highlight'
|
|
23
|
-
: variant === 'primary',
|
|
24
|
-
'tw-bg-primary hover:tw-bg-secondary tw-text-primary tw-border-tertiary hover:tw-border-primary'
|
|
25
|
-
: variant === 'secondary',
|
|
26
|
-
'tw-bg-danger hover:tw-bg-danger-highlight tw-text-primary-inverse tw-border-danger hover:tw-border-danger-highlight'
|
|
27
|
-
: variant === 'danger',
|
|
28
|
-
'tw-bg-primary-inverse tw-text-primary-inverse tw-border-primary hover:tw-border-secondary'
|
|
29
|
-
: variant === 'link',
|
|
30
|
-
'tw-bg-primary hover:tw-bg-secondary tw-text-primary tw-border-transparent'
|
|
31
|
-
: variant === 'ghost',
|
|
32
|
-
}"
|
|
21
|
+
:class="computedClass"
|
|
33
22
|
>
|
|
34
23
|
<!-- eslint-enable max-len -->
|
|
35
24
|
<template v-if="state === 'loading'">
|
|
@@ -94,13 +83,13 @@ export default {
|
|
|
94
83
|
},
|
|
95
84
|
/**
|
|
96
85
|
* State of the button
|
|
97
|
-
* `'' (default), disabled, loading`
|
|
86
|
+
* `'' (default), active, disabled, loading`
|
|
98
87
|
* */
|
|
99
88
|
state: {
|
|
100
89
|
type: String,
|
|
101
90
|
default: '',
|
|
102
91
|
validator(value) {
|
|
103
|
-
return ['', 'disabled', 'loading'].includes(value);
|
|
92
|
+
return ['', 'active', 'disabled', 'loading'].includes(value);
|
|
104
93
|
},
|
|
105
94
|
},
|
|
106
95
|
},
|
|
@@ -118,6 +107,53 @@ export default {
|
|
|
118
107
|
return 'white';
|
|
119
108
|
}
|
|
120
109
|
},
|
|
110
|
+
computedClass() {
|
|
111
|
+
let classes = '';
|
|
112
|
+
switch (this.variant) {
|
|
113
|
+
case 'primary':
|
|
114
|
+
default:
|
|
115
|
+
classes = 'tw-text-primary-inverse';
|
|
116
|
+
if (this.state === 'active') {
|
|
117
|
+
classes = `${classes} tw-bg-action-highlight tw-border-action-highlight`;
|
|
118
|
+
} else {
|
|
119
|
+
classes = `${classes} tw-bg-action hover:tw-bg-action-highlight tw-border-action hover:tw-border-action-highlight`;
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
case 'secondary':
|
|
123
|
+
classes = 'tw-text-primary';
|
|
124
|
+
if (this.state === 'active') {
|
|
125
|
+
classes = `${classes} tw-bg-secondary tw-border-primary`;
|
|
126
|
+
} else {
|
|
127
|
+
classes = `${classes} tw-bg-primary hover:tw-bg-secondary tw-border-tertiary hover:tw-border-primary`;
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case 'danger':
|
|
131
|
+
classes = 'tw-text-primary-inverse';
|
|
132
|
+
if (this.state === 'active') {
|
|
133
|
+
classes = `${classes} tw-bg-danger-highlight tw-border-danger-highlight`;
|
|
134
|
+
} else {
|
|
135
|
+
classes = `${classes} tw-bg-danger hover:tw-bg-danger-highlight tw-border-danger hover:tw-border-danger-highlight`;
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
case 'link':
|
|
139
|
+
classes = 'tw-bg-primary-inverse tw-text-primary-inverse';
|
|
140
|
+
if (this.state === 'active') {
|
|
141
|
+
classes = `${classes} tw-border-secondary`;
|
|
142
|
+
} else {
|
|
143
|
+
classes = `${classes} tw-border-primary hover:tw-border-secondary`;
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
case 'ghost':
|
|
147
|
+
classes = 'tw-text-primary tw-border-transparent';
|
|
148
|
+
if (this.state === 'active') {
|
|
149
|
+
classes = `${classes} tw-bg-secondary`;
|
|
150
|
+
} else {
|
|
151
|
+
classes = `${classes} tw-bg-primary hover:tw-bg-secondary`;
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
return classes;
|
|
156
|
+
},
|
|
121
157
|
isDisabled() {
|
|
122
158
|
return this.state === 'disabled' || this.state === 'loading';
|
|
123
159
|
},
|
package/vue/KvCarousel.vue
CHANGED
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
tw-mt-4 tw-w-full"
|
|
34
34
|
>
|
|
35
35
|
<button
|
|
36
|
-
class="tw-text-
|
|
36
|
+
class="tw-text-primary
|
|
37
37
|
tw-rounded-full
|
|
38
|
-
tw-border-2 tw-border-
|
|
38
|
+
tw-border-2 tw-border-primary
|
|
39
39
|
tw-h-4 tw-w-4
|
|
40
|
-
tw-flex tw-items-center tw-justify-center
|
|
40
|
+
tw-flex tw-items-center tw-justify-center
|
|
41
|
+
disabled:tw-opacity-low disabled:tw-cursor-default"
|
|
41
42
|
:disabled="embla && !embla.canScrollPrev()"
|
|
42
43
|
@click="handleUserInteraction(previousIndex, 'click-left-arrow')"
|
|
43
44
|
>
|
|
@@ -51,11 +52,12 @@
|
|
|
51
52
|
{{ currentIndex + 1 }}/{{ slideIndicatorListLength() }}
|
|
52
53
|
</div>
|
|
53
54
|
<button
|
|
54
|
-
class="tw-text-
|
|
55
|
+
class="tw-text-primary
|
|
55
56
|
tw-rounded-full
|
|
56
|
-
tw-border-2 tw-border-
|
|
57
|
+
tw-border-2 tw-border-primary
|
|
57
58
|
tw-h-4 tw-w-4
|
|
58
|
-
tw-flex tw-items-center tw-justify-center
|
|
59
|
+
tw-flex tw-items-center tw-justify-center
|
|
60
|
+
disabled:tw-opacity-low disabled:tw-cursor-default"
|
|
59
61
|
:disabled="embla && !embla.canScrollNext()"
|
|
60
62
|
@click="handleUserInteraction(nextIndex, 'click-right-arrow')"
|
|
61
63
|
>
|
package/vue/KvLightbox.vue
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
tw-bg-black
|
|
18
18
|
tw-bg-opacity-[75%]
|
|
19
19
|
"
|
|
20
|
-
:class="{'tw-min-h-screen' : variant === 'lightbox'}"
|
|
21
20
|
@click.stop.prevent="onScreenClick"
|
|
22
21
|
>
|
|
23
22
|
<focus-lock
|
|
@@ -44,17 +43,19 @@
|
|
|
44
43
|
tw-bg-primary
|
|
45
44
|
tw-flex tw-flex-col
|
|
46
45
|
tw-mx-auto md:tw-my-auto
|
|
46
|
+
|
|
47
47
|
"
|
|
48
48
|
:class="{
|
|
49
|
+
'tw-w-full md:tw-w-auto' : variant === 'lightbox',
|
|
49
50
|
'tw-mt-auto md:tw-my-auto' : variant === 'lightbox',
|
|
50
51
|
'tw-min-h-half-screen md:tw-min-h-0' : variant === 'lightbox',
|
|
51
52
|
'tw-rounded-t md:tw-rounded' : variant === 'lightbox',
|
|
52
53
|
'tw-my-auto tw-rounded' : variant === 'alert',
|
|
53
54
|
}"
|
|
54
|
-
style="max-width: 55.55rem; max-height:
|
|
55
|
+
style="max-width: 55.55rem; max-height: 90%"
|
|
55
56
|
aria-modal="true"
|
|
56
57
|
:aria-label="title ? title : null"
|
|
57
|
-
:aria-describedby="variant === 'alert' ? kvLightboxBody : null"
|
|
58
|
+
:aria-describedby="variant === 'alert' ? 'kvLightboxBody' : null"
|
|
58
59
|
:role="role"
|
|
59
60
|
@click.stop
|
|
60
61
|
>
|
|
@@ -95,6 +95,11 @@ StateLoading.args = {
|
|
|
95
95
|
state: 'loading',
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
+
export const StateActive = VariantTemplate.bind({});
|
|
99
|
+
StateActive.args = {
|
|
100
|
+
state: 'active',
|
|
101
|
+
};
|
|
102
|
+
|
|
98
103
|
export const StateDisabled = VariantTemplate.bind({});
|
|
99
104
|
StateDisabled.args = {
|
|
100
105
|
state: 'disabled',
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
args: {
|
|
21
|
-
visible:
|
|
21
|
+
visible: true,
|
|
22
22
|
title: '',
|
|
23
23
|
variant: 'lightbox',
|
|
24
24
|
preventClose: false,
|
|
@@ -56,6 +56,75 @@ const DefaultTemplate = (args, { argTypes }) => ({
|
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
const VeryShortTemplate = (args, { argTypes }) => ({
|
|
60
|
+
props: Object.keys(argTypes),
|
|
61
|
+
components: { KvLightbox, KvButton },
|
|
62
|
+
template: `
|
|
63
|
+
<div>
|
|
64
|
+
<kv-button @click="isLightboxVisible = true;">Show {{variant}}</kv-button>
|
|
65
|
+
<p>The lightbox is visible: {{isLightboxVisible}}</p>
|
|
66
|
+
|
|
67
|
+
<kv-lightbox
|
|
68
|
+
:visible="isLightboxVisible"
|
|
69
|
+
:title="title"
|
|
70
|
+
:variant="variant"
|
|
71
|
+
:prevent-close="preventClose"
|
|
72
|
+
@lightbox-closed="isLightboxVisible = false"
|
|
73
|
+
>
|
|
74
|
+
<p class="tw-mb-2">The lightbox content is very short.</p>
|
|
75
|
+
<template #controls>
|
|
76
|
+
<kv-button variant="secondary" @click="isLightboxVisible = false" ref="dontDoItRef">Don't do it!</kv-button>
|
|
77
|
+
<kv-button @click="isLightboxVisible = false" ref="doItRef">Do it!</kv-button>
|
|
78
|
+
</template>
|
|
79
|
+
</kv-lightbox>
|
|
80
|
+
</div>
|
|
81
|
+
`,
|
|
82
|
+
data() {
|
|
83
|
+
return {
|
|
84
|
+
isLightboxVisible: args.visible,
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const VeryLongTemplate = (args, { argTypes }) => ({
|
|
90
|
+
props: Object.keys(argTypes),
|
|
91
|
+
components: { KvLightbox, KvButton },
|
|
92
|
+
template: `
|
|
93
|
+
<div>
|
|
94
|
+
<kv-button @click="isLightboxVisible = true;">Show {{variant}}</kv-button>
|
|
95
|
+
<p>The lightbox is visible: {{isLightboxVisible}}</p>
|
|
96
|
+
|
|
97
|
+
<kv-lightbox
|
|
98
|
+
:visible="isLightboxVisible"
|
|
99
|
+
:title="title"
|
|
100
|
+
:variant="variant"
|
|
101
|
+
:prevent-close="preventClose"
|
|
102
|
+
@lightbox-closed="isLightboxVisible = false"
|
|
103
|
+
>
|
|
104
|
+
<p class="tw-mb-2">Lorem ipsum dolor sit amet consectetur adipisicing elit. Exercitationem voluptatum quod illum minima alias quae non architecto ipsum sunt repudiandae eius ipsa commodi adipisci nam, magni praesentium error, deleniti impedit!
|
|
105
|
+
Qui sint repudiandae incidunt odit distinctio neque repellendus, soluta culpa. Vero rem, odit laudantium autem quis facilis ratione omnis aut voluptas, velit vitae adipisci? Magni iure animi doloribus illum soluta.
|
|
106
|
+
Enim aspernatur non accusantium aut minima, quos maxime? Perferendis suscipit enim laborum, recusandae fugit praesentium fugiat animi cumque voluptatum voluptate labore dolore quaerat libero esse quasi magnam tempore id autem.
|
|
107
|
+
Nisi voluptas architecto dolores aut perspiciatis itaque, est reprehenderit tempora. Animi dicta laudantium repudiandae facere atque omnis voluptatem, incidunt ipsum, accusantium minima aspernatur modi soluta molestiae neque quam doloremque nemo.
|
|
108
|
+
Neque delectus quidem sapiente facere consequuntur maiores molestiae vel! Quidem, veniam. Libero labore voluptatibus id corporis molestias cumque magnam maiores praesentium laborum? Voluptate, porro eum. Recusandae earum rerum quis quos.
|
|
109
|
+
Cupiditate ea quas non ut adipisci illum dolorem eligendi sequi quod, doloribus suscipit assumenda ullam aliquid ad repudiandae dignissimos optio, possimus molestiae voluptate vel! Esse fuga praesentium maxime animi nihil.
|
|
110
|
+
Sint, est? Maiores commodi adipisci minus itaque nisi dolorum, velit fugiat est quia saepe ipsum quo nobis mollitia repellendus facilis, quos hic facere! Tenetur sint corporis dignissimos molestias saepe ipsa?
|
|
111
|
+
Excepturi, praesentium quisquam veritatis quaerat eligendi explicabo vitae sit minima recusandae. Dolorum molestiae, vero nulla eum sunt exercitationem dolore ipsum quos ea doloribus reprehenderit aliquam quibusdam vel veniam ex quis.
|
|
112
|
+
Corporis, neque cum pariatur saepe inventore sunt, maiores sed deserunt beatae quasi non sint vitae error incidunt odio nam amet quisquam! Mollitia, suscipit earum. Molestiae nesciunt fugit ea cupiditate rerum?
|
|
113
|
+
Placeat, atque sit unde sunt fugit reprehenderit tenetur provident similique odio accusamus, suscipit quod doloribus aliquam animi quia quae laboriosam natus aspernatur repellendus tempore itaque expedita! Optio adipisci amet excepturi!</p>
|
|
114
|
+
<template #controls>
|
|
115
|
+
<kv-button variant="secondary" @click="isLightboxVisible = false" ref="dontDoItRef">Don't do it!</kv-button>
|
|
116
|
+
<kv-button @click="isLightboxVisible = false" ref="doItRef">Do it!</kv-button>
|
|
117
|
+
</template>
|
|
118
|
+
</kv-lightbox>
|
|
119
|
+
</div>
|
|
120
|
+
`,
|
|
121
|
+
data() {
|
|
122
|
+
return {
|
|
123
|
+
isLightboxVisible: args.visible,
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
|
|
59
128
|
const AlertTemplate = (args, { argTypes }) => ({
|
|
60
129
|
props: Object.keys(argTypes),
|
|
61
130
|
components: { KvLightbox, KvButton },
|
|
@@ -91,6 +160,16 @@ Lightbox.args = {
|
|
|
91
160
|
title: 'Lightbox Title',
|
|
92
161
|
};
|
|
93
162
|
|
|
163
|
+
export const ShortContentLightbox = VeryShortTemplate.bind({});
|
|
164
|
+
ShortContentLightbox.args = {
|
|
165
|
+
title: 'Short Lightbox Title',
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const LongContentLightbox = VeryLongTemplate.bind({});
|
|
169
|
+
LongContentLightbox.args = {
|
|
170
|
+
title: 'Long Lightbox Title',
|
|
171
|
+
};
|
|
172
|
+
|
|
94
173
|
export const Alert = AlertTemplate.bind({});
|
|
95
174
|
Alert.args = {
|
|
96
175
|
title: 'Delete credit card?',
|