@weni/unnnic-system 3.31.1 → 3.32.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/dist/index.d.ts +3822 -10606
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +15979 -17314
- package/dist/unnnic.umd.js +37 -37
- package/package.json +1 -1
- package/src/components/AvatarIcon/AvatarIcon.vue +35 -49
- package/src/components/Breadcrumb/Breadcrumb.vue +20 -14
- package/src/components/Checkbox/Checkbox.vue +44 -57
- package/src/components/DatePicker/DatePicker.vue +53 -35
- package/src/components/DatePicker/{translations.js → translations.ts} +17 -5
- package/src/components/Input/BaseInput.vue +67 -75
- package/src/components/Input/Input.vue +84 -132
- package/src/components/Input/TextInput.vue +119 -136
- package/src/components/Input/__test__/TextInput.spec.js +10 -14
- package/src/components/Pagination/Pagination.vue +124 -141
- package/src/components/Radio/Radio.vue +36 -31
- package/src/components/Select/SelectItem.vue +24 -24
- package/src/components/SkeletonLoading/SkeletonLoading.vue +87 -88
- package/src/components/SkeletonLoading/skeletonTheme.vue +49 -44
- package/src/components/index.ts +1 -41
- package/src/stories/PageHeader.stories.js +11 -5
- package/src/types/index.d.ts +0 -1
- package/src/components/Button/ButtonIcon.vue +0 -106
- package/src/components/Button/__tests__/ButtonIcon.spec.js +0 -56
- package/src/components/Carousel/Carousel.vue +0 -59
- package/src/components/Carousel/TagCarousel.vue +0 -209
- package/src/components/Carousel/__tests__/TagCarousel.spec.js +0 -258
- package/src/components/ChatText/ChatText.vue +0 -179
- package/src/components/CircleProgressBar/CircleProgressBar.vue +0 -150
- package/src/components/Indicator/Indicator.vue +0 -110
- package/src/components/InputNext/InputNext.vue +0 -282
- package/src/components/ModalUpload/ModalUpload.vue +0 -181
- package/src/components/MoodRating/MoodRating.vue +0 -130
- package/src/components/Slider/Slider.vue +0 -438
- package/src/components/Slider/__tests__/Slider.spec.js +0 -321
- package/src/components/StarRating/StarRating.vue +0 -76
- package/src/components/TransitionRipple/TransitionRipple.vue +0 -126
- package/src/stories/ButtonIcon.stories.js +0 -31
- package/src/stories/Carousel.stories.js +0 -45
- package/src/stories/ChatText.stories.js +0 -57
- package/src/stories/CircleProgressBar.stories.js +0 -15
- package/src/stories/Indicator.stories.js +0 -18
- package/src/stories/InputNext.stories.js +0 -92
- package/src/stories/ModalUpload.stories.js +0 -25
- package/src/stories/MoodRating.stories.js +0 -33
- package/src/stories/Slider.stories.js +0 -23
- package/src/stories/StarRating.stories.js +0 -38
- package/src/stories/TransitionRipple.stories.js +0 -35
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="unnnic-card-tag-carousel">
|
|
3
|
-
<div
|
|
4
|
-
class="unnnic-card-tag-carousel__button unnnic-card-tag-carousel__button--left"
|
|
5
|
-
>
|
|
6
|
-
<div class="unnnic-card-tag-carousel__button__icon">
|
|
7
|
-
<UnnnicIcon
|
|
8
|
-
icon="arrow-left-1-1"
|
|
9
|
-
size="sm"
|
|
10
|
-
:scheme="hasPrev ? 'fg-emphasized' : 'fg-muted'"
|
|
11
|
-
clickable
|
|
12
|
-
@click="handlePrevious"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
<span
|
|
16
|
-
v-show="hasPrev"
|
|
17
|
-
class="unnnic-card-tag-carousel__button__blur unnnic-card-tag-carousel__button__blur--left"
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<div
|
|
22
|
-
id="scroll"
|
|
23
|
-
class="unnnic-card-tag-carousel__container"
|
|
24
|
-
>
|
|
25
|
-
<div
|
|
26
|
-
v-for="tag in slides"
|
|
27
|
-
:key="tag.id"
|
|
28
|
-
class="unnnic-card-tag-carousel__container__slide"
|
|
29
|
-
>
|
|
30
|
-
<UnnnicTag
|
|
31
|
-
:text="tag.name"
|
|
32
|
-
clickable
|
|
33
|
-
type="brand"
|
|
34
|
-
:disabled="checkIsInclude(tag)"
|
|
35
|
-
class="unnnic-card-tag-carousel__container__slide__item"
|
|
36
|
-
@click="save(tag)"
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<div
|
|
42
|
-
class="unnnic-card-tag-carousel__button unnnic-card-tag-carousel__button--right"
|
|
43
|
-
>
|
|
44
|
-
<span
|
|
45
|
-
v-show="hasNext"
|
|
46
|
-
class="unnnic-card-tag-carousel__button__blur unnnic-card-tag-carousel__button__blur--right"
|
|
47
|
-
/>
|
|
48
|
-
<div class="unnnic-card-tag-carousel__button__icon">
|
|
49
|
-
<UnnnicIcon
|
|
50
|
-
icon="arrow-right-1-1"
|
|
51
|
-
size="sm"
|
|
52
|
-
:scheme="hasNext ? 'fg-emphasized' : 'fg-muted'"
|
|
53
|
-
clickable
|
|
54
|
-
@click="handleNext"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</template>
|
|
60
|
-
|
|
61
|
-
<script>
|
|
62
|
-
import UnnnicTag from '../Tag/Tag.vue';
|
|
63
|
-
import UnnnicIcon from '../Icon.vue';
|
|
64
|
-
|
|
65
|
-
export default {
|
|
66
|
-
name: 'UnnnicTagCarousel',
|
|
67
|
-
components: {
|
|
68
|
-
UnnnicTag,
|
|
69
|
-
UnnnicIcon,
|
|
70
|
-
},
|
|
71
|
-
props: {
|
|
72
|
-
modelValue: {
|
|
73
|
-
type: Array,
|
|
74
|
-
default() {
|
|
75
|
-
return [];
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
tagItems: {
|
|
79
|
-
type: Array,
|
|
80
|
-
default: () => [],
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
data() {
|
|
84
|
-
return {
|
|
85
|
-
hasNext: true,
|
|
86
|
-
hasPrev: false,
|
|
87
|
-
slides: [],
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
mounted() {
|
|
91
|
-
this.slides = this.tagItems;
|
|
92
|
-
},
|
|
93
|
-
methods: {
|
|
94
|
-
handleNext() {
|
|
95
|
-
this.next();
|
|
96
|
-
},
|
|
97
|
-
handlePrevious() {
|
|
98
|
-
this.previous();
|
|
99
|
-
},
|
|
100
|
-
save(tagItem) {
|
|
101
|
-
let valueLocal = this.modelValue;
|
|
102
|
-
if (this.checkIsInclude(tagItem)) {
|
|
103
|
-
valueLocal = valueLocal.filter((id) => id !== tagItem.id);
|
|
104
|
-
} else {
|
|
105
|
-
valueLocal = [...valueLocal, tagItem.id];
|
|
106
|
-
}
|
|
107
|
-
this.$emit('selected', valueLocal);
|
|
108
|
-
},
|
|
109
|
-
checkIsInclude(tagItem) {
|
|
110
|
-
return this.modelValue.some((id) => id === tagItem.id);
|
|
111
|
-
},
|
|
112
|
-
next() {
|
|
113
|
-
const element = document.querySelector('#scroll');
|
|
114
|
-
const scrollCalc = element.scrollWidth - element.clientWidth;
|
|
115
|
-
element.scrollLeft += 200;
|
|
116
|
-
if (scrollCalc !== element.scrollLeft) {
|
|
117
|
-
if (!this.hasNext) {
|
|
118
|
-
this.hasNext = true;
|
|
119
|
-
}
|
|
120
|
-
this.hasPrev = true;
|
|
121
|
-
} else {
|
|
122
|
-
this.hasNext = false;
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
previous() {
|
|
126
|
-
const element = document.querySelector('#scroll');
|
|
127
|
-
element.scrollLeft -= 200;
|
|
128
|
-
if (element.scrollLeft !== 0) {
|
|
129
|
-
if (!this.hasPrev) {
|
|
130
|
-
this.hasPrev = true;
|
|
131
|
-
}
|
|
132
|
-
this.hasNext = true;
|
|
133
|
-
} else {
|
|
134
|
-
this.hasPrev = false;
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
</script>
|
|
140
|
-
|
|
141
|
-
<style lang="scss">
|
|
142
|
-
@use '@/assets/scss/unnnic' as *;
|
|
143
|
-
|
|
144
|
-
.unnnic-card-tag-carousel {
|
|
145
|
-
display: flex;
|
|
146
|
-
align-items: center;
|
|
147
|
-
position: relative;
|
|
148
|
-
|
|
149
|
-
&__container {
|
|
150
|
-
width: 100%;
|
|
151
|
-
display: flex;
|
|
152
|
-
overflow: hidden;
|
|
153
|
-
scroll-behavior: smooth;
|
|
154
|
-
|
|
155
|
-
&__slide {
|
|
156
|
-
&:first-of-type {
|
|
157
|
-
margin-left: $unnnic-inline-lg;
|
|
158
|
-
}
|
|
159
|
-
&:last-of-type {
|
|
160
|
-
margin-right: $unnnic-inline-awesome;
|
|
161
|
-
}
|
|
162
|
-
&__item {
|
|
163
|
-
margin-right: 2 * $unnnic-font-size;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
&__button {
|
|
169
|
-
z-index: 1;
|
|
170
|
-
position: absolute;
|
|
171
|
-
display: flex;
|
|
172
|
-
justify-content: center;
|
|
173
|
-
align-items: center;
|
|
174
|
-
|
|
175
|
-
&__icon {
|
|
176
|
-
height: $unnnic-inline-lg;
|
|
177
|
-
display: flex;
|
|
178
|
-
justify-content: center;
|
|
179
|
-
align-items: center;
|
|
180
|
-
background-color: $unnnic-color-bg-base;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
&__blur {
|
|
184
|
-
width: $unnnic-inline-giant;
|
|
185
|
-
height: $unnnic-inline-lg;
|
|
186
|
-
&--left {
|
|
187
|
-
background-image: linear-gradient(
|
|
188
|
-
to right,
|
|
189
|
-
$unnnic-color-bg-base,
|
|
190
|
-
rgba($unnnic-color-bg-base, $unnnic-opacity-level-overlay)
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
&--right {
|
|
194
|
-
background-image: linear-gradient(
|
|
195
|
-
to right,
|
|
196
|
-
rgba($unnnic-color-bg-base, $unnnic-opacity-level-overlay),
|
|
197
|
-
$unnnic-color-bg-base
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
&--left {
|
|
202
|
-
left: 0;
|
|
203
|
-
}
|
|
204
|
-
&--right {
|
|
205
|
-
right: 0;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
</style>
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from 'vitest';
|
|
2
|
-
import { mount, flushPromises } from '@vue/test-utils';
|
|
3
|
-
|
|
4
|
-
import TagCarousel from '../TagCarousel.vue';
|
|
5
|
-
|
|
6
|
-
const tagItems = [
|
|
7
|
-
{ id: 1, name: 'Tag 1' },
|
|
8
|
-
{ id: 2, name: 'Tag 2' },
|
|
9
|
-
{ id: 3, name: 'Tag 3' },
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
const mountCarousel = async (props = {}) => {
|
|
13
|
-
const wrapper = mount(TagCarousel, {
|
|
14
|
-
props: {
|
|
15
|
-
modelValue: [],
|
|
16
|
-
tagItems,
|
|
17
|
-
...props,
|
|
18
|
-
},
|
|
19
|
-
attachTo: document.body,
|
|
20
|
-
global: {
|
|
21
|
-
stubs: {
|
|
22
|
-
UnnnicIcon: true,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
await flushPromises();
|
|
28
|
-
await wrapper.vm.$nextTick();
|
|
29
|
-
|
|
30
|
-
return wrapper;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const mockScrollElement = (
|
|
34
|
-
wrapper,
|
|
35
|
-
{ scrollWidth = 800, clientWidth = 400, scrollLeft = 0 } = {},
|
|
36
|
-
) => {
|
|
37
|
-
const element = wrapper.find('#scroll').element;
|
|
38
|
-
|
|
39
|
-
Object.defineProperty(element, 'scrollWidth', {
|
|
40
|
-
configurable: true,
|
|
41
|
-
value: scrollWidth,
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(element, 'clientWidth', {
|
|
44
|
-
configurable: true,
|
|
45
|
-
value: clientWidth,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
let currentScrollLeft = scrollLeft;
|
|
49
|
-
Object.defineProperty(element, 'scrollLeft', {
|
|
50
|
-
configurable: true,
|
|
51
|
-
get: () => currentScrollLeft,
|
|
52
|
-
set: (value) => {
|
|
53
|
-
currentScrollLeft = value;
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return element;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
describe('TagCarousel', () => {
|
|
61
|
-
afterEach(() => {
|
|
62
|
-
document.body.innerHTML = '';
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('renders tag slides from tagItems', async () => {
|
|
66
|
-
const wrapper = await mountCarousel();
|
|
67
|
-
|
|
68
|
-
expect(wrapper.vm.slides).toHaveLength(3);
|
|
69
|
-
expect(wrapper.findAll('.chip')).toHaveLength(3);
|
|
70
|
-
expect(wrapper.text()).toContain('Tag 1');
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('adds a tag to selection when clicked', async () => {
|
|
74
|
-
const wrapper = await mountCarousel();
|
|
75
|
-
|
|
76
|
-
await wrapper.findAll('.chip')[0].trigger('click');
|
|
77
|
-
|
|
78
|
-
expect(wrapper.emitted('selected')[0]).toEqual([[1]]);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('removes a tag from selection when already selected', async () => {
|
|
82
|
-
const wrapper = await mountCarousel({ modelValue: [1] });
|
|
83
|
-
|
|
84
|
-
await wrapper.findAll('.chip')[0].trigger('click');
|
|
85
|
-
|
|
86
|
-
expect(wrapper.emitted('selected')[0]).toEqual([[]]);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('checks whether a tag is included in modelValue', async () => {
|
|
90
|
-
const wrapper = await mountCarousel({ modelValue: [2] });
|
|
91
|
-
|
|
92
|
-
expect(wrapper.vm.checkIsInclude({ id: 2, name: 'Tag 2' })).toBe(true);
|
|
93
|
-
expect(wrapper.vm.checkIsInclude({ id: 1, name: 'Tag 1' })).toBe(false);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('enables previous button after moving forward', async () => {
|
|
97
|
-
const wrapper = await mountCarousel();
|
|
98
|
-
mockScrollElement(wrapper, {
|
|
99
|
-
scrollWidth: 800,
|
|
100
|
-
clientWidth: 400,
|
|
101
|
-
scrollLeft: 0,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
wrapper.vm.next();
|
|
105
|
-
|
|
106
|
-
expect(wrapper.vm.hasPrev).toBe(true);
|
|
107
|
-
expect(wrapper.vm.hasNext).toBe(true);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('disables next button when scrolled to the end', async () => {
|
|
111
|
-
const wrapper = await mountCarousel();
|
|
112
|
-
mockScrollElement(wrapper, {
|
|
113
|
-
scrollWidth: 800,
|
|
114
|
-
clientWidth: 400,
|
|
115
|
-
scrollLeft: 200,
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
wrapper.vm.next();
|
|
119
|
-
|
|
120
|
-
expect(wrapper.vm.hasNext).toBe(false);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('disables previous button when scrolled to the start', async () => {
|
|
124
|
-
const wrapper = await mountCarousel();
|
|
125
|
-
mockScrollElement(wrapper, {
|
|
126
|
-
scrollWidth: 800,
|
|
127
|
-
clientWidth: 400,
|
|
128
|
-
scrollLeft: 200,
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
wrapper.vm.previous();
|
|
132
|
-
|
|
133
|
-
expect(wrapper.vm.hasPrev).toBe(false);
|
|
134
|
-
expect(wrapper.vm.hasNext).toBe(true);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('keeps next enabled when already disabled and not at end', async () => {
|
|
138
|
-
const wrapper = await mountCarousel();
|
|
139
|
-
mockScrollElement(wrapper, {
|
|
140
|
-
scrollWidth: 900,
|
|
141
|
-
clientWidth: 400,
|
|
142
|
-
scrollLeft: 0,
|
|
143
|
-
});
|
|
144
|
-
wrapper.vm.hasNext = false;
|
|
145
|
-
|
|
146
|
-
wrapper.vm.next();
|
|
147
|
-
|
|
148
|
-
expect(wrapper.vm.hasNext).toBe(true);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('keeps previous enabled when already disabled and not at start', async () => {
|
|
152
|
-
const wrapper = await mountCarousel();
|
|
153
|
-
mockScrollElement(wrapper, {
|
|
154
|
-
scrollWidth: 900,
|
|
155
|
-
clientWidth: 400,
|
|
156
|
-
scrollLeft: 500,
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
wrapper.vm.previous();
|
|
160
|
-
|
|
161
|
-
expect(wrapper.vm.hasPrev).toBe(true);
|
|
162
|
-
expect(wrapper.vm.hasNext).toBe(true);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('shows blur overlays when navigation is available', async () => {
|
|
166
|
-
const wrapper = await mountCarousel();
|
|
167
|
-
mockScrollElement(wrapper, {
|
|
168
|
-
scrollWidth: 800,
|
|
169
|
-
clientWidth: 400,
|
|
170
|
-
scrollLeft: 0,
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
expect(wrapper.vm.hasNext).toBe(true);
|
|
174
|
-
expect(wrapper.vm.hasPrev).toBe(false);
|
|
175
|
-
|
|
176
|
-
wrapper.vm.next();
|
|
177
|
-
|
|
178
|
-
expect(wrapper.vm.hasPrev).toBe(true);
|
|
179
|
-
expect(wrapper.vm.hasNext).toBe(true);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it('uses default modelValue when omitted', async () => {
|
|
183
|
-
const wrapper = mount(TagCarousel, {
|
|
184
|
-
props: { tagItems },
|
|
185
|
-
attachTo: document.body,
|
|
186
|
-
global: { stubs: { UnnnicIcon: true } },
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
await flushPromises();
|
|
190
|
-
await wrapper.vm.$nextTick();
|
|
191
|
-
|
|
192
|
-
expect(wrapper.vm.modelValue).toEqual([]);
|
|
193
|
-
expect(wrapper.vm.slides).toHaveLength(3);
|
|
194
|
-
|
|
195
|
-
wrapper.unmount();
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('uses default tagItems when omitted', async () => {
|
|
199
|
-
const wrapper = mount(TagCarousel, {
|
|
200
|
-
props: { modelValue: [] },
|
|
201
|
-
attachTo: document.body,
|
|
202
|
-
global: { stubs: { UnnnicIcon: true } },
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
await flushPromises();
|
|
206
|
-
await wrapper.vm.$nextTick();
|
|
207
|
-
|
|
208
|
-
expect(wrapper.vm.tagItems).toEqual([]);
|
|
209
|
-
expect(wrapper.vm.slides).toEqual([]);
|
|
210
|
-
|
|
211
|
-
wrapper.unmount();
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it('keeps next enabled when it is already enabled', async () => {
|
|
215
|
-
const wrapper = await mountCarousel();
|
|
216
|
-
mockScrollElement(wrapper, {
|
|
217
|
-
scrollWidth: 900,
|
|
218
|
-
clientWidth: 400,
|
|
219
|
-
scrollLeft: 0,
|
|
220
|
-
});
|
|
221
|
-
wrapper.vm.hasNext = true;
|
|
222
|
-
|
|
223
|
-
wrapper.vm.handleNext();
|
|
224
|
-
|
|
225
|
-
expect(wrapper.vm.hasNext).toBe(true);
|
|
226
|
-
expect(wrapper.vm.hasPrev).toBe(true);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
it('keeps previous enabled when it is already enabled', async () => {
|
|
230
|
-
const wrapper = await mountCarousel();
|
|
231
|
-
mockScrollElement(wrapper, {
|
|
232
|
-
scrollWidth: 900,
|
|
233
|
-
clientWidth: 400,
|
|
234
|
-
scrollLeft: 500,
|
|
235
|
-
});
|
|
236
|
-
wrapper.vm.hasPrev = true;
|
|
237
|
-
|
|
238
|
-
wrapper.vm.handlePrevious();
|
|
239
|
-
|
|
240
|
-
expect(wrapper.vm.hasPrev).toBe(true);
|
|
241
|
-
expect(wrapper.vm.hasNext).toBe(true);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
it('delegates navigation to next and previous handlers', async () => {
|
|
245
|
-
const wrapper = await mountCarousel();
|
|
246
|
-
mockScrollElement(wrapper, {
|
|
247
|
-
scrollWidth: 800,
|
|
248
|
-
clientWidth: 400,
|
|
249
|
-
scrollLeft: 0,
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
wrapper.vm.handleNext();
|
|
253
|
-
expect(wrapper.vm.hasPrev).toBe(true);
|
|
254
|
-
|
|
255
|
-
wrapper.vm.handlePrevious();
|
|
256
|
-
expect(wrapper.vm.hasPrev).toBe(false);
|
|
257
|
-
});
|
|
258
|
-
});
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="['unnnic-chat-text', size]">
|
|
3
|
-
<div class="header">
|
|
4
|
-
<div :class="['title', titleColor]">
|
|
5
|
-
{{ title }}
|
|
6
|
-
|
|
7
|
-
<UnnnicToolTip
|
|
8
|
-
v-if="info"
|
|
9
|
-
side="top"
|
|
10
|
-
class="info"
|
|
11
|
-
:text="info"
|
|
12
|
-
enabled
|
|
13
|
-
>
|
|
14
|
-
<UnnnicIcon
|
|
15
|
-
class="info__icon"
|
|
16
|
-
icon="info"
|
|
17
|
-
size="sm"
|
|
18
|
-
scheme="fg-base"
|
|
19
|
-
></UnnnicIcon>
|
|
20
|
-
</UnnnicToolTip>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<slot name="actions" />
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div
|
|
27
|
-
ref="description"
|
|
28
|
-
class="description"
|
|
29
|
-
>
|
|
30
|
-
<slot name="description" />
|
|
31
|
-
|
|
32
|
-
<div
|
|
33
|
-
v-if="isScrollable"
|
|
34
|
-
class="scrollable-gradient"
|
|
35
|
-
></div>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</template>
|
|
39
|
-
|
|
40
|
-
<script>
|
|
41
|
-
import UnnnicToolTip from '../ToolTip/ToolTip.vue';
|
|
42
|
-
import UnnnicIcon from '../Icon.vue';
|
|
43
|
-
|
|
44
|
-
export default {
|
|
45
|
-
components: {
|
|
46
|
-
UnnnicToolTip,
|
|
47
|
-
UnnnicIcon,
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
props: {
|
|
51
|
-
size: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: 'normal',
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
title: {
|
|
57
|
-
type: String,
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
titleColor: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: 'brand-weni-soft',
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
info: {
|
|
66
|
-
type: String,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
data() {
|
|
71
|
-
return {
|
|
72
|
-
isScrollable: false,
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
mounted() {
|
|
77
|
-
const areaScrollable =
|
|
78
|
-
this.$refs.description.scrollHeight - this.$refs.description.offsetHeight;
|
|
79
|
-
|
|
80
|
-
this.isScrollable = areaScrollable;
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<style lang="scss" scoped>
|
|
86
|
-
@use '@/assets/scss/unnnic' as *;
|
|
87
|
-
|
|
88
|
-
.unnnic-chat-text {
|
|
89
|
-
border-radius: $unnnic-border-radius-lg;
|
|
90
|
-
background-color: $unnnic-color-bg-base;
|
|
91
|
-
max-width: 31.25 * $unnnic-font-size;
|
|
92
|
-
padding: $unnnic-spacing-inset-md;
|
|
93
|
-
box-sizing: border-box;
|
|
94
|
-
border: 1px solid $unnnic-color-border-base;
|
|
95
|
-
max-height: 15.625 * $unnnic-font-size;
|
|
96
|
-
display: flex;
|
|
97
|
-
flex-direction: column;
|
|
98
|
-
|
|
99
|
-
.header {
|
|
100
|
-
margin-bottom: $unnnic-spacing-stack-md;
|
|
101
|
-
display: flex;
|
|
102
|
-
align-items: center;
|
|
103
|
-
justify-content: space-between;
|
|
104
|
-
|
|
105
|
-
.title {
|
|
106
|
-
display: flex;
|
|
107
|
-
|
|
108
|
-
font-family: $unnnic-font-family-secondary;
|
|
109
|
-
font-weight: $unnnic-font-weight-black;
|
|
110
|
-
font-size: $unnnic-font-size-body-gt;
|
|
111
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
|
|
112
|
-
flex: 1;
|
|
113
|
-
|
|
114
|
-
.info {
|
|
115
|
-
display: flex;
|
|
116
|
-
align-items: center;
|
|
117
|
-
|
|
118
|
-
&__icon {
|
|
119
|
-
margin-left: $unnnic-spacing-inline-nano;
|
|
120
|
-
cursor: default;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@each $name, $color in $scheme-colors {
|
|
125
|
-
&.#{$name} {
|
|
126
|
-
color: $color;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.description {
|
|
133
|
-
font-family: $unnnic-font-family-primary;
|
|
134
|
-
font-weight: $unnnic-font-weight-regular;
|
|
135
|
-
font-size: $unnnic-font-size-body-lg;
|
|
136
|
-
line-height: $unnnic-font-size-body-lg + $unnnic-line-height-md;
|
|
137
|
-
color: $unnnic-color-fg-emphasized;
|
|
138
|
-
overflow: hidden;
|
|
139
|
-
position: relative;
|
|
140
|
-
|
|
141
|
-
.intent {
|
|
142
|
-
background-color: rgba(
|
|
143
|
-
$unnnic-color-purple-10,
|
|
144
|
-
$unnnic-opacity-level-light
|
|
145
|
-
);
|
|
146
|
-
padding: calc($unnnic-line-height-md / 2) 0;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.scrollable-gradient {
|
|
150
|
-
position: absolute;
|
|
151
|
-
background-image: linear-gradient(transparent, $unnnic-color-bg-base);
|
|
152
|
-
width: 100%;
|
|
153
|
-
height: 5 * $unnnic-font-size;
|
|
154
|
-
bottom: 0;
|
|
155
|
-
left: 0;
|
|
156
|
-
pointer-events: none;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
&.small {
|
|
161
|
-
border-radius: $unnnic-border-radius-md;
|
|
162
|
-
padding: $unnnic-spacing-inset-sm;
|
|
163
|
-
max-height: 7.1875 * $unnnic-font-size;
|
|
164
|
-
|
|
165
|
-
.header {
|
|
166
|
-
margin-bottom: $unnnic-spacing-stack-xs;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.description {
|
|
170
|
-
font-size: $unnnic-font-size-body-md;
|
|
171
|
-
line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
|
|
172
|
-
|
|
173
|
-
.scrollable-gradient {
|
|
174
|
-
height: 2 * $unnnic-font-size;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
</style>
|