@weni/unnnic-system 3.31.1 → 3.32.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/dist/index.d.ts +1518 -4106
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +12879 -13865
- package/dist/unnnic.umd.js +36 -36
- package/package.json +1 -1
- 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,321 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { mount } from '@vue/test-utils';
|
|
3
|
-
|
|
4
|
-
import Slider from '../Slider.vue';
|
|
5
|
-
|
|
6
|
-
const tooltipStub = {
|
|
7
|
-
name: 'UnnnicTooltip',
|
|
8
|
-
template: '<div><div ref="label" class="tooltip-label"><slot /></div></div>',
|
|
9
|
-
mounted() {
|
|
10
|
-
Object.defineProperty(this.$refs.label, 'clientWidth', {
|
|
11
|
-
configurable: true,
|
|
12
|
-
value: 32,
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const noLabelTooltipStub = {
|
|
18
|
-
name: 'UnnnicTooltip',
|
|
19
|
-
template: '<div><slot /></div>',
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const mockInputDimensions = (wrapper, width = 200) => {
|
|
23
|
-
const input = wrapper.find('input[type="range"]').element;
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(input, 'clientWidth', {
|
|
26
|
-
configurable: true,
|
|
27
|
-
value: width,
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(input, 'offsetWidth', {
|
|
30
|
-
configurable: true,
|
|
31
|
-
value: width,
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const createWrapper = async (props = {}, options = {}) => {
|
|
36
|
-
const wrapper = mount(Slider, {
|
|
37
|
-
props: {
|
|
38
|
-
initialValue: 2,
|
|
39
|
-
minValue: 0,
|
|
40
|
-
maxValue: 10,
|
|
41
|
-
...props,
|
|
42
|
-
},
|
|
43
|
-
attachTo: document.body,
|
|
44
|
-
global: {
|
|
45
|
-
stubs: {
|
|
46
|
-
UnnnicTooltip: tooltipStub,
|
|
47
|
-
UnnnicIcon: true,
|
|
48
|
-
...options.stubs,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
mockInputDimensions(wrapper);
|
|
54
|
-
await wrapper.vm.$nextTick();
|
|
55
|
-
|
|
56
|
-
return wrapper;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
describe('Slider', () => {
|
|
60
|
-
beforeEach(() => {
|
|
61
|
-
vi.useFakeTimers();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
afterEach(() => {
|
|
65
|
-
vi.useRealTimers();
|
|
66
|
-
document.body.innerHTML = '';
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('renders label, info tooltip, and min/max labels', async () => {
|
|
70
|
-
const wrapper = await createWrapper({
|
|
71
|
-
label: 'Volume',
|
|
72
|
-
labelInfo: 'Adjust volume',
|
|
73
|
-
minLabel: 'Low',
|
|
74
|
-
maxLabel: 'High',
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
expect(wrapper.find('.unnnic-slider__label').text()).toBe('Volume');
|
|
78
|
-
expect(wrapper.find('.unnnic-label__tooltip').exists()).toBe(true);
|
|
79
|
-
expect(wrapper.find('.unnnic-slider__content__labels__min').text()).toBe(
|
|
80
|
-
'Low',
|
|
81
|
-
);
|
|
82
|
-
expect(wrapper.find('.unnnic-slider__content__labels__max').text()).toBe(
|
|
83
|
-
'High',
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('hides value input when showInputValue is false', async () => {
|
|
88
|
-
const wrapper = await createWrapper({ showInputValue: false });
|
|
89
|
-
|
|
90
|
-
expect(wrapper.find('.value-input').exists()).toBe(false);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('emits valueChange when range input changes', async () => {
|
|
94
|
-
const wrapper = await createWrapper();
|
|
95
|
-
|
|
96
|
-
const rangeInput = wrapper.find('input[type="range"]');
|
|
97
|
-
await rangeInput.setValue(5);
|
|
98
|
-
await rangeInput.trigger('change');
|
|
99
|
-
|
|
100
|
-
expect(wrapper.emitted('valueChange')).toBeTruthy();
|
|
101
|
-
expect(wrapper.emitted('valueChange').at(-1)).toEqual(['5']);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('updates value from the text input', async () => {
|
|
105
|
-
const wrapper = await createWrapper();
|
|
106
|
-
|
|
107
|
-
const valueInput = wrapper.find('.value-input');
|
|
108
|
-
await valueInput.setValue('7');
|
|
109
|
-
|
|
110
|
-
expect(wrapper.vm.sliderVal).toBe('7');
|
|
111
|
-
expect(wrapper.emitted('valueChange')).toBeTruthy();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('shows tooltip on mouseover and hides on mouseleave', async () => {
|
|
115
|
-
const wrapper = await createWrapper();
|
|
116
|
-
|
|
117
|
-
const rangeInput = wrapper.find('input[type="range"]');
|
|
118
|
-
await rangeInput.trigger('mouseover');
|
|
119
|
-
expect(wrapper.vm.showTooltip).toBe(true);
|
|
120
|
-
|
|
121
|
-
await rangeInput.trigger('mouseleave');
|
|
122
|
-
expect(wrapper.vm.showTooltip).toBe(false);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('computes css variables from current state', async () => {
|
|
126
|
-
const wrapper = await createWrapper({
|
|
127
|
-
initialValue: 4,
|
|
128
|
-
minValue: 0,
|
|
129
|
-
maxValue: 8,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
expect(wrapper.vm.cssVars).toEqual({
|
|
133
|
-
'--val': 4,
|
|
134
|
-
'--tooltip-offset': expect.any(Number),
|
|
135
|
-
'--min': 0,
|
|
136
|
-
'--max': 8,
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('returns zero tooltip offset when dimensions are unavailable', async () => {
|
|
141
|
-
const wrapper = await createWrapper();
|
|
142
|
-
wrapper.vm.sliderWidth = 0;
|
|
143
|
-
wrapper.vm.labelWidth = 0;
|
|
144
|
-
|
|
145
|
-
expect(wrapper.vm.getNewTooltipPosition()).toBe(0);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('handles NaN range when min and max are equal', async () => {
|
|
149
|
-
const wrapper = await createWrapper({
|
|
150
|
-
initialValue: 5,
|
|
151
|
-
minValue: 5,
|
|
152
|
-
maxValue: 5,
|
|
153
|
-
});
|
|
154
|
-
wrapper.vm.sliderWidth = 200;
|
|
155
|
-
wrapper.vm.labelWidth = 32;
|
|
156
|
-
|
|
157
|
-
expect(wrapper.vm.getNewTooltipPosition()).toBeTypeOf('number');
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('uses fallback label width when label width is zero', async () => {
|
|
161
|
-
const wrapper = await createWrapper();
|
|
162
|
-
wrapper.vm.sliderWidth = 200;
|
|
163
|
-
wrapper.vm.labelWidth = 0;
|
|
164
|
-
|
|
165
|
-
expect(wrapper.vm.getNewTooltipPosition()).toBe(0);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('reconfigures tooltip on window resize', async () => {
|
|
169
|
-
const wrapper = await createWrapper();
|
|
170
|
-
const configureSpy = vi.spyOn(wrapper.vm, 'configureTooltip');
|
|
171
|
-
|
|
172
|
-
window.dispatchEvent(new Event('resize'));
|
|
173
|
-
|
|
174
|
-
expect(configureSpy).toHaveBeenCalled();
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('removes resize listener on unmount', async () => {
|
|
178
|
-
const wrapper = await createWrapper();
|
|
179
|
-
const removeSpy = vi.spyOn(window, 'removeEventListener');
|
|
180
|
-
|
|
181
|
-
wrapper.unmount();
|
|
182
|
-
|
|
183
|
-
expect(removeSpy).toHaveBeenCalledWith('resize', wrapper.vm.handleResize);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it('initializes dimensions from polling intervals', async () => {
|
|
187
|
-
const wrapper = await createWrapper();
|
|
188
|
-
mockInputDimensions(wrapper, 0);
|
|
189
|
-
|
|
190
|
-
vi.advanceTimersByTime(100);
|
|
191
|
-
await wrapper.vm.$nextTick();
|
|
192
|
-
|
|
193
|
-
mockInputDimensions(wrapper, 200);
|
|
194
|
-
vi.advanceTimersByTime(100);
|
|
195
|
-
await wrapper.vm.$nextTick();
|
|
196
|
-
|
|
197
|
-
expect(wrapper.vm.sliderWidth).toBe(200);
|
|
198
|
-
expect(wrapper.vm.labelWidth).toBe(32);
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('skips tooltip label polling when label ref is missing', async () => {
|
|
202
|
-
vi.spyOn(Slider.methods, 'configureTooltip').mockImplementation(() => {});
|
|
203
|
-
|
|
204
|
-
const wrapper = await createWrapper(
|
|
205
|
-
{},
|
|
206
|
-
{ stubs: { UnnnicTooltip: noLabelTooltipStub } },
|
|
207
|
-
);
|
|
208
|
-
mockInputDimensions(wrapper);
|
|
209
|
-
|
|
210
|
-
vi.advanceTimersByTime(100);
|
|
211
|
-
await wrapper.vm.$nextTick();
|
|
212
|
-
|
|
213
|
-
expect(wrapper.vm.labelWidth).toBe(0);
|
|
214
|
-
|
|
215
|
-
Slider.methods.configureTooltip.mockRestore();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it('syncs value input text when slider value changes', async () => {
|
|
219
|
-
const wrapper = await createWrapper({ initialValue: 1 });
|
|
220
|
-
|
|
221
|
-
const valueInput = wrapper.find('.value-input').element;
|
|
222
|
-
valueInput.textContent = 'old';
|
|
223
|
-
|
|
224
|
-
wrapper.vm.sliderVal = 9;
|
|
225
|
-
await wrapper.vm.$nextTick();
|
|
226
|
-
await wrapper.vm.$nextTick();
|
|
227
|
-
|
|
228
|
-
expect(valueInput.textContent).toBe('9');
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it('skips value input sync when text already matches slider value', async () => {
|
|
232
|
-
const wrapper = await createWrapper({ initialValue: 4 });
|
|
233
|
-
const valueInput = wrapper.find('.value-input').element;
|
|
234
|
-
valueInput.textContent = '4';
|
|
235
|
-
|
|
236
|
-
wrapper.vm.sliderVal = 4;
|
|
237
|
-
await wrapper.vm.$nextTick();
|
|
238
|
-
await wrapper.vm.$nextTick();
|
|
239
|
-
|
|
240
|
-
expect(valueInput.textContent).toBe('4');
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it('computes tooltip position with non-zero dimensions', async () => {
|
|
244
|
-
const wrapper = await createWrapper({
|
|
245
|
-
initialValue: 5,
|
|
246
|
-
minValue: 0,
|
|
247
|
-
maxValue: 10,
|
|
248
|
-
});
|
|
249
|
-
wrapper.vm.sliderWidth = 200;
|
|
250
|
-
wrapper.vm.labelWidth = 32;
|
|
251
|
-
|
|
252
|
-
expect(wrapper.vm.getNewTooltipPosition()).toBeGreaterThan(0);
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it('uses fallback label width when label width is NaN', async () => {
|
|
256
|
-
const wrapper = await createWrapper();
|
|
257
|
-
wrapper.vm.sliderWidth = 200;
|
|
258
|
-
wrapper.vm.labelWidth = Number.NaN;
|
|
259
|
-
|
|
260
|
-
expect(wrapper.vm.getNewTooltipPosition()).toBeTypeOf('number');
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it('ignores input polling after unmount', async () => {
|
|
264
|
-
const wrapper = await createWrapper();
|
|
265
|
-
mockInputDimensions(wrapper, 0);
|
|
266
|
-
|
|
267
|
-
wrapper.unmount();
|
|
268
|
-
vi.advanceTimersByTime(200);
|
|
269
|
-
|
|
270
|
-
expect(true).toBe(true);
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
it('waits until tooltip label width is greater than zero', async () => {
|
|
274
|
-
const delayedLabelTooltipStub = {
|
|
275
|
-
name: 'UnnnicTooltip',
|
|
276
|
-
template:
|
|
277
|
-
'<div><div ref="label" class="tooltip-label"><slot /></div></div>',
|
|
278
|
-
mounted() {
|
|
279
|
-
Object.defineProperty(this.$refs.label, 'clientWidth', {
|
|
280
|
-
configurable: true,
|
|
281
|
-
value: 0,
|
|
282
|
-
});
|
|
283
|
-
},
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
vi.spyOn(Slider.methods, 'configureTooltip').mockImplementation(
|
|
287
|
-
function mockConfigure() {
|
|
288
|
-
if (!this.$refs.input || !this.$refs.tooltip?.$refs?.label) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
this.sliderWidth = this.$refs.input.clientWidth;
|
|
293
|
-
this.labelWidth = this.$refs.tooltip.$refs.label.clientWidth;
|
|
294
|
-
this.tooltipOffset = this.getNewTooltipPosition();
|
|
295
|
-
},
|
|
296
|
-
);
|
|
297
|
-
|
|
298
|
-
const wrapper = await createWrapper(
|
|
299
|
-
{},
|
|
300
|
-
{
|
|
301
|
-
stubs: { UnnnicTooltip: delayedLabelTooltipStub },
|
|
302
|
-
},
|
|
303
|
-
);
|
|
304
|
-
mockInputDimensions(wrapper);
|
|
305
|
-
|
|
306
|
-
vi.advanceTimersByTime(100);
|
|
307
|
-
await wrapper.vm.$nextTick();
|
|
308
|
-
expect(wrapper.vm.labelWidth).toBe(0);
|
|
309
|
-
|
|
310
|
-
Object.defineProperty(wrapper.vm.$refs.tooltip.$refs.label, 'clientWidth', {
|
|
311
|
-
configurable: true,
|
|
312
|
-
value: 32,
|
|
313
|
-
});
|
|
314
|
-
vi.advanceTimersByTime(100);
|
|
315
|
-
await wrapper.vm.$nextTick();
|
|
316
|
-
|
|
317
|
-
expect(wrapper.vm.labelWidth).toBe(32);
|
|
318
|
-
|
|
319
|
-
Slider.methods.configureTooltip.mockRestore();
|
|
320
|
-
});
|
|
321
|
-
});
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="unnnic-star-rating">
|
|
3
|
-
<UnnnicIcon
|
|
4
|
-
v-for="index in 5"
|
|
5
|
-
:key="index"
|
|
6
|
-
:scheme="starScheme(index)"
|
|
7
|
-
icon="star"
|
|
8
|
-
:filled="index <= modelValue"
|
|
9
|
-
size="ant"
|
|
10
|
-
/>
|
|
11
|
-
|
|
12
|
-
<div
|
|
13
|
-
v-if="showValue"
|
|
14
|
-
class="rating-title"
|
|
15
|
-
>
|
|
16
|
-
<span class="highlight"> {{ modelValue.toFixed(1) }} </span>
|
|
17
|
-
/5.0
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import UnnnicIcon from '../Icon.vue';
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
components: {
|
|
27
|
-
UnnnicIcon,
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
props: {
|
|
31
|
-
modelValue: {
|
|
32
|
-
type: Number,
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
showValue: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
readonly: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
data() {
|
|
45
|
-
return {};
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
methods: {
|
|
49
|
-
starScheme(star) {
|
|
50
|
-
return star <= this.modelValue ? 'yellow-5' : 'fg-base';
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<style lang="scss" scoped>
|
|
57
|
-
@use '@/assets/scss/unnnic' as *;
|
|
58
|
-
|
|
59
|
-
.unnnic-star-rating {
|
|
60
|
-
display: flex;
|
|
61
|
-
align-items: center;
|
|
62
|
-
|
|
63
|
-
.rating-title {
|
|
64
|
-
margin-left: $unnnic-spacing-inline-xs;
|
|
65
|
-
font-family: $unnnic-font-family-secondary;
|
|
66
|
-
font-weight: $unnnic-font-weight-bold;
|
|
67
|
-
font-size: $unnnic-font-size-body-lg;
|
|
68
|
-
line-height: $unnnic-font-size-body-lg + $unnnic-line-height-md;
|
|
69
|
-
color: $unnnic-color-fg-muted;
|
|
70
|
-
|
|
71
|
-
.highlight {
|
|
72
|
-
color: $unnnic-color-fg-emphasized;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<TransitionGroup
|
|
3
|
-
class="ripples"
|
|
4
|
-
name="grow"
|
|
5
|
-
tag="div"
|
|
6
|
-
>
|
|
7
|
-
<div
|
|
8
|
-
v-for="ripple in ripples"
|
|
9
|
-
:key="ripple.id"
|
|
10
|
-
class="ripple"
|
|
11
|
-
:style="{
|
|
12
|
-
top: ripple.top,
|
|
13
|
-
left: ripple.left,
|
|
14
|
-
width: ripple.width,
|
|
15
|
-
height: ripple.height,
|
|
16
|
-
}"
|
|
17
|
-
:class="`ripples-color--${color}`"
|
|
18
|
-
></div>
|
|
19
|
-
</TransitionGroup>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
export default {
|
|
24
|
-
props: {
|
|
25
|
-
color: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: 'fg-inverted',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
data() {
|
|
31
|
-
return {
|
|
32
|
-
ripples: [],
|
|
33
|
-
rippleWidth: 0,
|
|
34
|
-
halfRippleWidth: 0,
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
mounted() {
|
|
38
|
-
const { transitionContainer } = this.$parent.$refs;
|
|
39
|
-
|
|
40
|
-
if (transitionContainer) {
|
|
41
|
-
this.$parent.$refs.transitionContainer.style.position = 'relative';
|
|
42
|
-
this.$parent.$refs.transitionContainer.style.overflow = 'hidden';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const width = transitionContainer.offsetWidth;
|
|
46
|
-
const height = transitionContainer.offsetHeight;
|
|
47
|
-
this.rippleWidth = width > height ? width : height;
|
|
48
|
-
this.halfRippleWidth = this.rippleWidth / 2;
|
|
49
|
-
|
|
50
|
-
window.addEventListener('mouseup', this.purgeRipples);
|
|
51
|
-
},
|
|
52
|
-
beforeUnmount() {
|
|
53
|
-
window.removeEventListener('mouseup', this.purgeRipples);
|
|
54
|
-
},
|
|
55
|
-
methods: {
|
|
56
|
-
addRipple(e) {
|
|
57
|
-
const { left, top } =
|
|
58
|
-
this.$parent.$refs.transitionContainer.getBoundingClientRect();
|
|
59
|
-
const rippleId = Date.now();
|
|
60
|
-
this.ripples.push({
|
|
61
|
-
width: `${this.rippleWidth}px`,
|
|
62
|
-
height: `${this.rippleWidth}px`,
|
|
63
|
-
left: `${e.clientX - left - this.halfRippleWidth}px`,
|
|
64
|
-
top: `${e.clientY - top - this.halfRippleWidth}px`,
|
|
65
|
-
id: rippleId,
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
purgeRipples() {
|
|
69
|
-
this.ripples = [];
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
</script>
|
|
74
|
-
|
|
75
|
-
<style scoped lang="scss">
|
|
76
|
-
@use '@/assets/scss/unnnic' as *;
|
|
77
|
-
|
|
78
|
-
.ripples {
|
|
79
|
-
position: absolute;
|
|
80
|
-
width: 100%;
|
|
81
|
-
height: 100%;
|
|
82
|
-
z-index: 1;
|
|
83
|
-
|
|
84
|
-
@each $name, $color in $unnnic-scheme-colors {
|
|
85
|
-
&-color--#{$name} {
|
|
86
|
-
background-color: $color;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.ripple {
|
|
92
|
-
position: absolute;
|
|
93
|
-
border-radius: 50%;
|
|
94
|
-
transform: scale(0);
|
|
95
|
-
opacity: 0.05;
|
|
96
|
-
animation: grow 1s ease-out;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.grow-enter-active,
|
|
100
|
-
.grow-enter-to-active {
|
|
101
|
-
transition: all 1.5s ease-out;
|
|
102
|
-
}
|
|
103
|
-
.grow-leave-active,
|
|
104
|
-
.grow-leave-to-active {
|
|
105
|
-
transition: all 1s ease-out;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.grow-enter {
|
|
109
|
-
transform: scale(0);
|
|
110
|
-
opacity: 0.1;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.grow-enter-to {
|
|
114
|
-
transform: scale(4);
|
|
115
|
-
opacity: 0.1;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.grow-leave {
|
|
119
|
-
transform: scale(4);
|
|
120
|
-
opacity: 0.1;
|
|
121
|
-
}
|
|
122
|
-
.grow-leave-to {
|
|
123
|
-
transform: scale(4);
|
|
124
|
-
opacity: 0;
|
|
125
|
-
}
|
|
126
|
-
</style>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import UnnnicButtonIcon from '../components/Button/ButtonIcon.vue';
|
|
2
|
-
|
|
3
|
-
const iconsOptions = ['add'];
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Form/ButtonIcon',
|
|
7
|
-
component: UnnnicButtonIcon,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
argTypes: {
|
|
10
|
-
size: {
|
|
11
|
-
control: {
|
|
12
|
-
type: 'select',
|
|
13
|
-
options: ['small', 'large'],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
icon: {
|
|
18
|
-
control: {
|
|
19
|
-
type: 'select',
|
|
20
|
-
options: iconsOptions,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Normal = {
|
|
27
|
-
args: {
|
|
28
|
-
size: 'small',
|
|
29
|
-
icon: iconsOptions[0],
|
|
30
|
-
},
|
|
31
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import UnnnicCarousel from '../components/Carousel/Carousel.vue';
|
|
2
|
-
import iconList from '../utils/iconList';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Data Display/Carousel',
|
|
6
|
-
component: UnnnicCarousel,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
argTypes: {
|
|
9
|
-
type: { control: { type: 'select' }, options: ['brand'] },
|
|
10
|
-
icon: { control: { type: 'select' }, options: iconList },
|
|
11
|
-
},
|
|
12
|
-
render: (args) => ({
|
|
13
|
-
components: {
|
|
14
|
-
UnnnicCarousel,
|
|
15
|
-
},
|
|
16
|
-
setup() {
|
|
17
|
-
return { args };
|
|
18
|
-
},
|
|
19
|
-
data() {
|
|
20
|
-
return {
|
|
21
|
-
selecteds: [1],
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
template: `
|
|
25
|
-
<UnnnicCarousel v-bind="args" v-model="selecteds" />
|
|
26
|
-
`,
|
|
27
|
-
}),
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const Tag = {
|
|
31
|
-
args: {
|
|
32
|
-
type: 'brand',
|
|
33
|
-
tagItems: [
|
|
34
|
-
{ id: 1, name: 'tag - 1' },
|
|
35
|
-
{ id: 2, name: 'tag - 2' },
|
|
36
|
-
{ id: 3, name: 'tag - 3' },
|
|
37
|
-
{ id: 4, name: 'tag - 4' },
|
|
38
|
-
{ id: 5, name: 'tag - 5' },
|
|
39
|
-
{ id: 6, name: 'tag - 6' },
|
|
40
|
-
{ id: 7, name: 'tag - 7' },
|
|
41
|
-
{ id: 8, name: 'tag - 8' },
|
|
42
|
-
{ id: 9, name: 'tag - 9' },
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { action } from 'storybook/actions';
|
|
2
|
-
|
|
3
|
-
import UnnnicChatText from '../components/ChatText/ChatText.vue';
|
|
4
|
-
import UnnnicButtonIcon from '../components/Button/ButtonIcon.vue';
|
|
5
|
-
import colorsList from '../utils/colorsList';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Data Display/ChatText',
|
|
9
|
-
component: UnnnicChatText,
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
argTypes: {
|
|
12
|
-
size: { control: 'select', options: ['normal', 'small'] },
|
|
13
|
-
titleColor: {
|
|
14
|
-
control: 'select',
|
|
15
|
-
options: colorsList,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
render: (args) => ({
|
|
19
|
-
components: {
|
|
20
|
-
UnnnicChatText,
|
|
21
|
-
UnnnicButtonIcon,
|
|
22
|
-
},
|
|
23
|
-
setup() {
|
|
24
|
-
return { args };
|
|
25
|
-
},
|
|
26
|
-
methods: {
|
|
27
|
-
actionClick() {
|
|
28
|
-
action('action-click')();
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
template: `
|
|
32
|
-
<div>
|
|
33
|
-
<UnnnicChatText v-bind="args">
|
|
34
|
-
<template #actions>
|
|
35
|
-
<UnnnicButtonIcon
|
|
36
|
-
@click="actionClick"
|
|
37
|
-
type="secondary"
|
|
38
|
-
size="small"
|
|
39
|
-
icon="pencil-write-1"
|
|
40
|
-
/>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<template #description>
|
|
44
|
-
<span class="intent">Lorem</span> Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
|
45
|
-
</template>
|
|
46
|
-
</UnnnicChatText>
|
|
47
|
-
</div>
|
|
48
|
-
`,
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const Default = {
|
|
53
|
-
args: {
|
|
54
|
-
title: 'Title',
|
|
55
|
-
info: 'Info',
|
|
56
|
-
},
|
|
57
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import UnnnicCircleProgressBar from '../components/CircleProgressBar/CircleProgressBar.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Progress/CircleProgressBar',
|
|
5
|
-
component: UnnnicCircleProgressBar,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
argTypes: {},
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const Default = {
|
|
11
|
-
args: {
|
|
12
|
-
progress: 4,
|
|
13
|
-
totalProgress: 8,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import UnnnicIndicator from '../components/Indicator/Indicator.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Example/Indicator',
|
|
5
|
-
component: UnnnicIndicator,
|
|
6
|
-
argTypes: {
|
|
7
|
-
numberOfSteps: { control: { type: 'number' } },
|
|
8
|
-
currentStep: { control: { type: 'number' } },
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const Default = {
|
|
13
|
-
args: {
|
|
14
|
-
numberOfSteps: 3,
|
|
15
|
-
currentStep: 2,
|
|
16
|
-
titles: ['Indicator-1', 'Indicator-2', 'Indicator-3'],
|
|
17
|
-
},
|
|
18
|
-
};
|