@weni/unnnic-system 3.2.9-alpha.9 → 3.3.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 +4 -10
- package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +119 -18
- package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
- package/dist/components/Alert/Version1dot1.vue.d.ts +38 -2
- package/dist/components/Alert/Version1dot1.vue.d.ts.map +1 -1
- package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +2 -2
- package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +5 -5
- package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +2 -2
- package/dist/components/Banner/Banner.vue.d.ts +1 -1
- package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts +2 -2
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Card/AccountCard.vue.d.ts +3 -3
- package/dist/components/Card/BlankCard.vue.d.ts +1 -1
- package/dist/components/Card/Card.vue.d.ts +21 -21
- package/dist/components/Card/CardCompany.vue.d.ts +8 -8
- package/dist/components/Card/CardData.vue.d.ts +1 -1
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +4 -4
- package/dist/components/Card/ContentCard.vue.d.ts +2 -2
- package/dist/components/Card/DashCard.vue.d.ts +4 -4
- package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
- package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
- package/dist/components/Card/SimpleCard.vue.d.ts +3 -3
- package/dist/components/Card/StatusCard.vue.d.ts +2 -2
- package/dist/components/Card/TitleCard.vue.d.ts +2 -2
- package/dist/components/CardImage/CardImage.vue.d.ts +8 -8
- package/dist/components/CardInformation/CardInformation.vue.d.ts +4 -4
- package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
- package/dist/components/Carousel/Carousel.vue.d.ts +11 -11
- package/dist/components/Carousel/TagCarousel.vue.d.ts +9 -9
- package/dist/components/ChartBar/ChartBar.vue.d.ts +8 -8
- package/dist/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue.d.ts.map +1 -1
- package/dist/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue.d.ts +43 -0
- package/dist/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue.d.ts.map +1 -0
- package/dist/components/ChartLine/ChartLine.vue.d.ts +1 -1
- package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +15 -15
- package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
- package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
- package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
- package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
- package/dist/components/Comment/Comment.vue.d.ts +1 -1
- package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
- package/dist/components/DataTable/index.vue.d.ts +1 -8
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DateFilter/DateFilter.vue.d.ts +27 -149
- package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
- package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
- package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/FormElement/FormElement.vue.d.ts +32 -38
- package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
- package/dist/components/Icon.vue.d.ts +1 -1
- package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
- package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
- package/dist/components/Input/BaseInput.vue.d.ts +1 -28
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +27 -149
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +13 -67
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +37 -159
- package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
- package/dist/components/Label/Label.vue.d.ts +15 -9
- package/dist/components/Label/Label.vue.d.ts.map +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +2 -2
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +9 -9
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +35 -157
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +14 -14
- package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +7 -7
- package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
- package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
- package/dist/components/Radio/Radio.vue.d.ts +2 -2
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +27 -81
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
- package/dist/components/SelectTime/index.vue.d.ts +13 -67
- package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
- package/dist/components/Slider/Slider.vue.d.ts +2 -2
- package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
- package/dist/components/Switch/Switch.vue.d.ts +2 -2
- package/dist/components/Tab/Tab.vue.d.ts +2 -13
- package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
- package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
- package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
- package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
- package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
- package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
- package/dist/components/Tag/Tag.vue.d.ts +8 -8
- package/dist/components/TextArea/TextArea.vue.d.ts +32 -38
- package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
- package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
- package/dist/components/Tour/Tour.vue.d.ts +6 -6
- package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
- package/dist/components/UploadArea/UploadArea.vue.d.ts +7 -7
- package/dist/components/index.d.ts +1079 -1889
- package/dist/components/index.d.ts.map +1 -1
- package/dist/{es-d6005598.js → es-db7a2f44.mjs} +1 -1
- package/dist/{index-35640dc9.js → index-08caf833.mjs} +8434 -8712
- package/dist/locales/en.json.d.ts +1 -2
- package/dist/locales/es.json.d.ts +1 -2
- package/dist/locales/pt_br.json.d.ts +1 -2
- package/dist/{pt-br-89c2c09d.js → pt-br-88538a51.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +182 -0
- package/dist/unnnic.umd.js +109 -0
- package/dist/utils/call.d.ts +1 -2
- package/dist/utils/call.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/assets/scss/scheme-colors.scss +4 -131
- package/src/assets/tokens/colors.json +2 -2
- package/src/components/Alert/Alert.vue +135 -26
- package/src/components/Alert/AlertBanner.vue +182 -0
- package/src/components/Alert/AlertCaller.vue +49 -0
- package/src/components/Alert/Version1dot1.vue +36 -0
- package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
- package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +7 -11
- package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +2 -2
- package/src/components/Button/Button.vue +108 -60
- package/src/components/Button/types.ts +1 -0
- package/src/components/ChartFunnel/ChartFunnel.vue +4 -0
- package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +8 -2
- package/src/components/ChartFunnel/SvgFunnel/ChartFunnelBaseRow.vue +1 -1
- package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +64 -0
- package/src/components/DataTable/index.vue +10 -25
- package/src/components/FormElement/FormElement.vue +91 -51
- package/src/components/Input/BaseInput.vue +14 -22
- package/src/components/Input/Input.scss +21 -19
- package/src/components/Input/Input.vue +29 -85
- package/src/components/Input/TextInput.vue +42 -39
- package/src/components/Input/__test__/TextInput.spec.js +5 -5
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +3 -12
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
- package/src/components/Label/Label.vue +21 -52
- package/src/components/Label/__tests__/Label.spec.js +1 -1
- package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
- package/src/components/ModalDialog/ModalDialog.vue +0 -1
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
- package/src/components/Tab/Tab.vue +23 -37
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
- package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
- package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
- package/src/components/TextArea/TextArea.vue +9 -13
- package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +2 -7
- package/src/components/index.ts +4 -18
- package/src/locales/en.json +1 -2
- package/src/locales/es.json +1 -2
- package/src/locales/pt_br.json +1 -2
- package/src/stories/Alert.stories.js +67 -6
- package/src/stories/Button.stories.js +17 -2
- package/src/stories/ChartFunnel.stories.js +19 -0
- package/src/stories/DataTable.stories.js +0 -60
- package/src/stories/Input.stories.js +3 -16
- package/src/stories/Label.stories.js +0 -7
- package/src/stories/Tab.stories.js +4 -11
- package/src/types/scheme-colors.d.ts +14 -120
- package/src/utils/call.js +18 -46
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
- package/dist/components/Toast/Toast.vue.d.ts +0 -16
- package/dist/components/Toast/Toast.vue.d.ts.map +0 -1
- package/dist/components/Toast/ToastManager.d.ts +0 -14
- package/dist/components/Toast/ToastManager.d.ts.map +0 -1
- package/dist/components/Toast/types.d.ts +0 -35
- package/dist/components/Toast/types.d.ts.map +0 -1
- package/dist/unnnic.js +0 -188
- package/dist/unnnic.umd.cjs +0 -110
- package/src/assets/img/previews/doc-preview.png +0 -0
- package/src/assets/img/previews/image-preview.png +0 -0
- package/src/assets/img/previews/video-preview.png +0 -0
- package/src/components/Popover/__tests__/Popover.spec.js +0 -147
- package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
- package/src/components/Popover/index.vue +0 -146
- package/src/components/Select/SelectOption.vue +0 -65
- package/src/components/Select/__tests__/Select.spec.js +0 -412
- package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
- package/src/components/Select/__tests__/SelectOption.spec.js +0 -174
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -93
- package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
- package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
- package/src/components/Select/index.vue +0 -243
- package/src/components/TemplatePreview/TemplatePreview.vue +0 -252
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
- package/src/components/TemplatePreview/types.d.ts +0 -16
- package/src/components/Toast/Toast.vue +0 -236
- package/src/components/Toast/ToastManager.ts +0 -110
- package/src/components/Toast/types.ts +0 -57
- package/src/stories/Popover.stories.js +0 -39
- package/src/stories/Select.stories.js +0 -91
- package/src/stories/TemplatePreview.stories.js +0 -94
- package/src/stories/TemplatePreviewModal.stories.js +0 -110
- package/src/stories/Toast.mdx +0 -123
- package/src/stories/Toast.stories.js +0 -126
|
@@ -27,6 +27,15 @@
|
|
|
27
27
|
{{ text }}
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
|
+
<a
|
|
31
|
+
v-if="linkHref"
|
|
32
|
+
class="alert__link"
|
|
33
|
+
:href="linkHref"
|
|
34
|
+
:target="linkTarget"
|
|
35
|
+
>
|
|
36
|
+
{{ linkText }}
|
|
37
|
+
</a>
|
|
38
|
+
|
|
30
39
|
<div
|
|
31
40
|
class="alert__close"
|
|
32
41
|
@click="emitClose"
|
|
@@ -49,6 +58,10 @@ export default {
|
|
|
49
58
|
UnnnicIcon,
|
|
50
59
|
},
|
|
51
60
|
props: {
|
|
61
|
+
version: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: '1.0',
|
|
64
|
+
},
|
|
52
65
|
text: {
|
|
53
66
|
type: String,
|
|
54
67
|
default: null,
|
|
@@ -61,6 +74,18 @@ export default {
|
|
|
61
74
|
type: Function,
|
|
62
75
|
default: () => {},
|
|
63
76
|
},
|
|
77
|
+
linkHref: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: '',
|
|
80
|
+
},
|
|
81
|
+
linkTarget: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: '_blank',
|
|
84
|
+
},
|
|
85
|
+
linkText: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: 'Learn more',
|
|
88
|
+
},
|
|
64
89
|
type: {
|
|
65
90
|
type: String,
|
|
66
91
|
default: 'default',
|
|
@@ -182,6 +207,7 @@ export default {
|
|
|
182
207
|
padding: $unnnic-spacing-xs $unnnic-spacing-sm;
|
|
183
208
|
}
|
|
184
209
|
|
|
210
|
+
&__link,
|
|
185
211
|
&__close {
|
|
186
212
|
border-left: $unnnic-border-width-thinner solid $unnnic-color-neutral-cloudy;
|
|
187
213
|
|
|
@@ -190,6 +216,14 @@ export default {
|
|
|
190
216
|
}
|
|
191
217
|
}
|
|
192
218
|
|
|
219
|
+
&__link {
|
|
220
|
+
padding: $unnnic-spacing-xs $unnnic-spacing-sm;
|
|
221
|
+
text-decoration: none;
|
|
222
|
+
color: inherit;
|
|
223
|
+
display: block;
|
|
224
|
+
font-weight: $unnnic-font-weight-bold;
|
|
225
|
+
}
|
|
226
|
+
|
|
193
227
|
&__close {
|
|
194
228
|
padding: $unnnic-spacing-xs $unnnic-spacing-sm;
|
|
195
229
|
cursor: pointer;
|
|
@@ -203,6 +237,7 @@ export default {
|
|
|
203
237
|
background-color: $unnnic-color-aux-green-700;
|
|
204
238
|
}
|
|
205
239
|
|
|
240
|
+
.alert__link,
|
|
206
241
|
.alert__close {
|
|
207
242
|
border-left: $unnnic-border-width-thinner solid
|
|
208
243
|
$unnnic-color-aux-green-300;
|
|
@@ -220,6 +255,7 @@ export default {
|
|
|
220
255
|
background-color: $unnnic-color-aux-red-700;
|
|
221
256
|
}
|
|
222
257
|
|
|
258
|
+
.alert__link,
|
|
223
259
|
.alert__close {
|
|
224
260
|
border-left: $unnnic-border-width-thinner solid $unnnic-color-aux-red-300;
|
|
225
261
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
3
|
+
import AlertBanner from '@/components/Alert/AlertBanner.vue';
|
|
4
|
+
|
|
5
|
+
describe('AlertBanner.vue', () => {
|
|
6
|
+
let wrapper;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = mount(AlertBanner, {
|
|
10
|
+
props: {
|
|
11
|
+
text: 'This is a banner alert',
|
|
12
|
+
type: 'danger',
|
|
13
|
+
showCloseButton: true,
|
|
14
|
+
linkHref: 'https://example.com',
|
|
15
|
+
linkText: 'Learn more',
|
|
16
|
+
linkTarget: '_self',
|
|
17
|
+
onClose: vi.fn(),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
wrapper.unmount();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('renders correctly', () => {
|
|
27
|
+
expect(wrapper.exists()).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('renders the correct text and link', () => {
|
|
31
|
+
const textElement = wrapper.find('.text');
|
|
32
|
+
const linkElement = wrapper.find('.banner-alert__link');
|
|
33
|
+
|
|
34
|
+
expect(textElement.text()).toBe('This is a banner alert');
|
|
35
|
+
expect(linkElement.text()).toBe('Learn more');
|
|
36
|
+
expect(linkElement.attributes('href')).toBe('https://example.com');
|
|
37
|
+
expect(linkElement.attributes('target')).toBe('_self');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('applies the correct class based on the type', () => {
|
|
41
|
+
expect(wrapper.classes()).toContain('banner-alert--banner-danger');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('renders the correct icon based on the type', () => {
|
|
45
|
+
const icon = wrapper.findComponent('[data-test="unnnic-icon"]');
|
|
46
|
+
expect(icon.exists()).toBe(true);
|
|
47
|
+
expect(icon.props('icon')).toBe('block');
|
|
48
|
+
expect(icon.props('size')).toBe('sm');
|
|
49
|
+
expect(icon.props('scheme')).toBe('neutral-white');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('does not render the icon when type is not danger, warning, or info', async () => {
|
|
53
|
+
await wrapper.setProps({ type: 'success' });
|
|
54
|
+
const icon = wrapper.findComponent('[data-test="unnnic-icon"]');
|
|
55
|
+
expect(icon.element.style.display).toBe('none');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('calls emitClose and emits close event when close button is clicked', async () => {
|
|
59
|
+
const closeButton = wrapper.find('.banner-alert__close');
|
|
60
|
+
await closeButton.trigger('click');
|
|
61
|
+
|
|
62
|
+
expect(wrapper.emitted()).toHaveProperty('close');
|
|
63
|
+
expect(wrapper.props().onClose).toHaveBeenCalled();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('does not render close button if showCloseButton is false', async () => {
|
|
67
|
+
await wrapper.setProps({ showCloseButton: false });
|
|
68
|
+
const closeButton = wrapper.find('.banner-alert__close');
|
|
69
|
+
expect(closeButton.element.style.display).toBe('none');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('matches the snapshot', () => {
|
|
73
|
+
expect(wrapper.html()).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('getIconType function returns the correct icon based on type', () => {
|
|
77
|
+
expect(wrapper.vm.getIconType('danger')).toBe('block');
|
|
78
|
+
expect(wrapper.vm.getIconType('info')).toBe('info');
|
|
79
|
+
expect(wrapper.vm.getIconType('')).toBe('info');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('isShowTextIcon function returns true for danger, warning, and info types', () => {
|
|
83
|
+
expect(wrapper.vm.isShowTextIcon('danger')).toBe(true);
|
|
84
|
+
expect(wrapper.vm.isShowTextIcon('warning')).toBe(true);
|
|
85
|
+
expect(wrapper.vm.isShowTextIcon('info')).toBe(true);
|
|
86
|
+
expect(wrapper.vm.isShowTextIcon('')).toBe(true);
|
|
87
|
+
expect(wrapper.vm.isShowTextIcon('success')).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, test, vi, beforeEach, afterEach } from 'vitest';
|
|
3
|
+
import AlertCaller from '@/components/Alert/AlertCaller.vue';
|
|
4
|
+
import alert from '@/utils/call';
|
|
5
|
+
|
|
6
|
+
vi.mock('@/utils/call', () => ({
|
|
7
|
+
default: {
|
|
8
|
+
callAlert: vi.fn(),
|
|
9
|
+
},
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
describe('AlertCaller.vue', () => {
|
|
13
|
+
let wrapper;
|
|
14
|
+
|
|
15
|
+
const defaultProps = {
|
|
16
|
+
title: 'Test Title',
|
|
17
|
+
text: 'Test Text',
|
|
18
|
+
icon: 'test-icon',
|
|
19
|
+
enabled: true,
|
|
20
|
+
scheme: 'primary',
|
|
21
|
+
seconds: 5,
|
|
22
|
+
closeText: 'Close',
|
|
23
|
+
position: 'top-right',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
wrapper = mount(AlertCaller, {
|
|
28
|
+
props: defaultProps,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
wrapper.unmount();
|
|
34
|
+
vi.clearAllMocks();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('renders correctly', () => {
|
|
38
|
+
expect(wrapper.exists()).toBe(true);
|
|
39
|
+
expect(wrapper.find('button').text()).toBe('Launch alert');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('calls callAlert method when button is clicked', async () => {
|
|
43
|
+
const callAlertSpy = vi.spyOn(wrapper.vm, 'callAlert');
|
|
44
|
+
await wrapper.find('button').trigger('click');
|
|
45
|
+
expect(callAlertSpy).toHaveBeenCalledTimes(1);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('callAlert method invokes alert.callAlert with correct props', async () => {
|
|
49
|
+
await wrapper.find('button').trigger('click');
|
|
50
|
+
expect(alert.callAlert).toHaveBeenCalledWith({
|
|
51
|
+
props: defaultProps,
|
|
52
|
+
seconds: defaultProps.seconds,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test.each([
|
|
57
|
+
['title', 'New Title'],
|
|
58
|
+
['text', 'New Text'],
|
|
59
|
+
['icon', 'new-icon'],
|
|
60
|
+
['enabled', false],
|
|
61
|
+
['scheme', 'secondary'],
|
|
62
|
+
['seconds', 10],
|
|
63
|
+
['closeText', 'Dismiss'],
|
|
64
|
+
['position', 'bottom-left'],
|
|
65
|
+
])('updates %s prop correctly', async (propName, newValue) => {
|
|
66
|
+
await wrapper.setProps({ [propName]: newValue });
|
|
67
|
+
await wrapper.find('button').trigger('click');
|
|
68
|
+
const expectedProps = { ...defaultProps, [propName]: newValue };
|
|
69
|
+
expect(alert.callAlert).toHaveBeenCalledWith({
|
|
70
|
+
props: expectedProps,
|
|
71
|
+
seconds: expectedProps.seconds,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('passes default values when props are not provided', async () => {
|
|
76
|
+
wrapper = mount(AlertCaller, {
|
|
77
|
+
props: {},
|
|
78
|
+
});
|
|
79
|
+
await wrapper.find('button').trigger('click');
|
|
80
|
+
expect(alert.callAlert).toHaveBeenCalledWith({
|
|
81
|
+
props: {
|
|
82
|
+
title: null,
|
|
83
|
+
text: null,
|
|
84
|
+
icon: null,
|
|
85
|
+
enabled: true,
|
|
86
|
+
scheme: null,
|
|
87
|
+
seconds: 3,
|
|
88
|
+
closeText: null,
|
|
89
|
+
position: 'top-right',
|
|
90
|
+
},
|
|
91
|
+
seconds: 3,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('matches snapshot', () => {
|
|
96
|
+
expect(wrapper.html()).toMatchSnapshot();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`UnnnicAlert.vue > matches the snapshot 1`] = `
|
|
4
|
-
"<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
</section>
|
|
12
|
-
<!--v-if-->
|
|
13
|
-
</aside>
|
|
14
|
-
</transition-stub>"
|
|
4
|
+
"<div data-v-284427ba="" class="unnnic-alert unnnic-alert-position--top-right"><span data-v-26446d8e="" data-v-284427ba="" class="material-symbols-rounded unnnic-icon-scheme--primary unnnic-icon-size--sm" data-testid="material-icon" translate="no" data-test="unnnic-icon">alert-icon</span>
|
|
5
|
+
<div data-v-284427ba="" class="unnnic-alert__content">
|
|
6
|
+
<div data-v-284427ba="" class="unnnic-alert__title">TEST ALERT</div>
|
|
7
|
+
<div data-v-284427ba="" class="unnnic-alert__text">This is an alert message</div>
|
|
8
|
+
</div>
|
|
9
|
+
<div data-v-284427ba="" class="unnnic-alert__close-text unnnic--clickable">CLOSE</div>
|
|
10
|
+
</div>"
|
|
15
11
|
`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`Alert.vue > matches snapshot 1`] = `
|
|
4
|
-
"<div data-v-fb94f284="" class="alert-container"
|
|
4
|
+
"<div data-v-fb94f284="" class="alert-container">
|
|
5
5
|
<div data-v-fb94f284="" class="alert alert--scheme-aux-green">
|
|
6
6
|
<div data-v-fb94f284="" class="alert__progress"></div>
|
|
7
|
-
<div data-v-fb94f284="" class="alert__text">Test Alert</div>
|
|
7
|
+
<div data-v-fb94f284="" class="alert__text">Test Alert</div><a data-v-fb94f284="" class="alert__link" href="https://example.com" target="_blank">Learn more</a>
|
|
8
8
|
<div data-v-fb94f284="" class="alert__close">
|
|
9
9
|
<unnnic-icon-stub data-v-fb94f284="" filled="false" next="false" icon="close-1" clickable="false" size="sm" scheme="neutral-white"></unnnic-icon-stub>
|
|
10
10
|
</div>
|
|
@@ -6,16 +6,20 @@
|
|
|
6
6
|
:class="[
|
|
7
7
|
'unnnic-button',
|
|
8
8
|
`unnnic-button--size-${size}`,
|
|
9
|
-
`unnnic-button--${
|
|
9
|
+
`unnnic-button--${type}`,
|
|
10
10
|
iconCenter ? `unnnic-button--icon-on-center` : null,
|
|
11
11
|
float ? `unnnic-button--float` : null,
|
|
12
12
|
]"
|
|
13
13
|
>
|
|
14
|
-
<
|
|
14
|
+
<UnnnicIcon
|
|
15
15
|
v-if="loading"
|
|
16
|
+
icon="loading-circle-1"
|
|
16
17
|
:scheme="iconScheme"
|
|
17
18
|
:size="iconSize"
|
|
19
|
+
:filled="iconsFilled"
|
|
18
20
|
:style="{ position: 'absolute' }"
|
|
21
|
+
class="rotation"
|
|
22
|
+
:next="next"
|
|
19
23
|
data-testid="icon-loading"
|
|
20
24
|
/>
|
|
21
25
|
|
|
@@ -68,7 +72,6 @@
|
|
|
68
72
|
<script setup lang="ts">
|
|
69
73
|
import { computed, watch, useSlots } from 'vue';
|
|
70
74
|
import UnnnicIcon from '../Icon.vue';
|
|
71
|
-
import UnnnicIconLoading from '../IconLoading/IconLoading.vue';
|
|
72
75
|
import type { ButtonProps, ButtonSize, ButtonType } from './types';
|
|
73
76
|
import type { SchemeColor } from '@/types/scheme-colors';
|
|
74
77
|
|
|
@@ -99,8 +102,8 @@ const buttonDisabled = computed(() => {
|
|
|
99
102
|
});
|
|
100
103
|
|
|
101
104
|
const iconSize = computed(() => {
|
|
102
|
-
if (props.size === '
|
|
103
|
-
return '
|
|
105
|
+
if (props.size === 'small') return 'sm';
|
|
106
|
+
return 'md';
|
|
104
107
|
});
|
|
105
108
|
|
|
106
109
|
const hasText = computed(() => {
|
|
@@ -117,11 +120,12 @@ const iconScheme = computed((): SchemeColor => {
|
|
|
117
120
|
primary: 'neutral-white',
|
|
118
121
|
secondary: 'neutral-dark',
|
|
119
122
|
tertiary: 'neutral-dark',
|
|
123
|
+
alternative: 'neutral-white',
|
|
120
124
|
warning: 'neutral-white',
|
|
121
125
|
attention: 'neutral-white',
|
|
122
126
|
};
|
|
123
127
|
|
|
124
|
-
return typeToSchemeMap[
|
|
128
|
+
return typeToSchemeMap[props.type] || 'neutral-white';
|
|
125
129
|
});
|
|
126
130
|
|
|
127
131
|
const isSizePropValid = computed(() => {
|
|
@@ -132,23 +136,16 @@ const isSizePropValid = computed(() => {
|
|
|
132
136
|
);
|
|
133
137
|
});
|
|
134
138
|
|
|
135
|
-
const buttonType = computed(() => {
|
|
136
|
-
return (
|
|
137
|
-
{
|
|
138
|
-
alternative: 'tertiary',
|
|
139
|
-
}[props.type] || props.type
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
139
|
const isTypePropValid = computed(() => {
|
|
144
140
|
const validTypes: ButtonType[] = [
|
|
145
141
|
'primary',
|
|
146
142
|
'secondary',
|
|
147
143
|
'tertiary',
|
|
144
|
+
'alternative',
|
|
148
145
|
'warning',
|
|
149
146
|
'attention',
|
|
150
147
|
];
|
|
151
|
-
return validTypes.includes(
|
|
148
|
+
return validTypes.includes(props.type);
|
|
152
149
|
});
|
|
153
150
|
|
|
154
151
|
const validateProps = () => {
|
|
@@ -162,8 +159,6 @@ const validateProps = () => {
|
|
|
162
159
|
|
|
163
160
|
if (!isTypePropValid.value) {
|
|
164
161
|
errorMessage += ' Invalid type prop.';
|
|
165
|
-
errorMessage +=
|
|
166
|
-
' Please provide one of the following types: primary, secondary, tertiary, warning, attention. Alternative is discontinued and it was forced renamed to tertiary.';
|
|
167
162
|
}
|
|
168
163
|
|
|
169
164
|
throw new Error(errorMessage);
|
|
@@ -201,12 +196,13 @@ watch(
|
|
|
201
196
|
display: inline-flex;
|
|
202
197
|
align-items: center;
|
|
203
198
|
justify-content: center;
|
|
204
|
-
border-radius: $unnnic-radius-
|
|
199
|
+
border-radius: $unnnic-border-radius-sm;
|
|
205
200
|
border: 0;
|
|
206
201
|
outline: none;
|
|
207
202
|
overflow: hidden;
|
|
208
203
|
white-space: nowrap;
|
|
209
|
-
font: $unnnic-font-
|
|
204
|
+
font-weight: $unnnic-font-weight-regular;
|
|
205
|
+
font-family: $unnnic-font-family-secondary;
|
|
210
206
|
cursor: pointer;
|
|
211
207
|
position: relative;
|
|
212
208
|
|
|
@@ -220,91 +216,129 @@ watch(
|
|
|
220
216
|
}
|
|
221
217
|
}
|
|
222
218
|
|
|
223
|
-
&--primary,
|
|
224
|
-
&--warning,
|
|
225
|
-
&--attention {
|
|
226
|
-
color: $unnnic-color-fg-inverted;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
&--secondary,
|
|
230
|
-
&--tertiary {
|
|
231
|
-
color: $unnnic-color-fg-emphasized;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
219
|
&--primary {
|
|
235
|
-
background-color: $unnnic-color-
|
|
220
|
+
background-color: $unnnic-color-weni-600;
|
|
221
|
+
color: $unnnic-color-neutral-white;
|
|
236
222
|
|
|
237
223
|
&:hover:enabled {
|
|
238
|
-
background-color: $unnnic-color-
|
|
224
|
+
background-color: $unnnic-color-weni-700;
|
|
239
225
|
}
|
|
240
226
|
|
|
241
227
|
&:active:enabled {
|
|
242
|
-
background-color: $unnnic-color-
|
|
228
|
+
background-color: $unnnic-color-weni-800;
|
|
243
229
|
}
|
|
244
230
|
}
|
|
245
231
|
|
|
246
232
|
&--secondary {
|
|
247
|
-
background-color: $unnnic-color-
|
|
233
|
+
background-color: $unnnic-color-neutral-white;
|
|
234
|
+
color: $unnnic-color-neutral-dark;
|
|
248
235
|
box-shadow: inset 0 0 0 $unnnic-border-width-thinner
|
|
249
|
-
$unnnic-color-
|
|
236
|
+
$unnnic-color-neutral-cleanest;
|
|
250
237
|
|
|
251
238
|
&:hover:enabled {
|
|
252
|
-
background-color: $unnnic-color-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
&:active:enabled {
|
|
256
|
-
background-color: $unnnic-color-gray-100;
|
|
239
|
+
background-color: $unnnic-color-neutral-light;
|
|
257
240
|
}
|
|
258
241
|
|
|
259
242
|
&:disabled {
|
|
260
243
|
box-shadow: none;
|
|
261
244
|
}
|
|
245
|
+
|
|
246
|
+
&:active:enabled {
|
|
247
|
+
background-color: $unnnic-color-neutral-soft;
|
|
248
|
+
}
|
|
262
249
|
}
|
|
263
250
|
|
|
264
251
|
&--tertiary {
|
|
265
252
|
background-color: transparent;
|
|
253
|
+
color: $unnnic-color-neutral-dark;
|
|
266
254
|
|
|
267
255
|
&:hover:enabled {
|
|
268
|
-
background-color:
|
|
256
|
+
background-color: $unnnic-color-neutral-light;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
&:disabled {
|
|
260
|
+
color: $unnnic-color-neutral-clean;
|
|
261
|
+
cursor: not-allowed;
|
|
269
262
|
}
|
|
270
263
|
|
|
271
264
|
&:active:enabled {
|
|
272
|
-
background-color:
|
|
265
|
+
background-color: $unnnic-color-neutral-soft;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
&--alternative {
|
|
270
|
+
background-color: $unnnic-color-weni-50;
|
|
271
|
+
color: $unnnic-color-weni-800;
|
|
272
|
+
|
|
273
|
+
:deep(svg .primary) {
|
|
274
|
+
fill: $unnnic-color-weni-800;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
:deep(svg .primary-stroke) {
|
|
278
|
+
stroke: $unnnic-color-weni-800;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
&:hover:enabled {
|
|
282
|
+
background-color: $unnnic-color-weni-100;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
&:disabled {
|
|
286
|
+
:deep(svg .primary) {
|
|
287
|
+
fill: $unnnic-color-neutral-clean;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
:deep(svg .primary-stroke) {
|
|
291
|
+
stroke: $unnnic-color-neutral-clean;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
&:active:enabled {
|
|
296
|
+
background-color: $unnnic-color-weni-200;
|
|
297
|
+
color: $unnnic-color-weni-900;
|
|
298
|
+
|
|
299
|
+
:deep(svg .primary) {
|
|
300
|
+
fill: $unnnic-color-weni-900;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
:deep(svg .primary-stroke) {
|
|
304
|
+
stroke: $unnnic-color-weni-900;
|
|
305
|
+
}
|
|
273
306
|
}
|
|
274
307
|
}
|
|
275
308
|
|
|
276
309
|
&--warning {
|
|
277
|
-
background-color: $unnnic-color-red-500;
|
|
310
|
+
background-color: $unnnic-color-aux-red-500;
|
|
278
311
|
color: $unnnic-color-neutral-white;
|
|
279
312
|
|
|
280
313
|
&:hover:enabled {
|
|
281
|
-
background-color: $unnnic-color-red-
|
|
314
|
+
background-color: $unnnic-color-aux-red-700;
|
|
282
315
|
}
|
|
283
316
|
|
|
284
317
|
&:active:enabled {
|
|
285
|
-
background-color: $unnnic-color-red-
|
|
318
|
+
background-color: $unnnic-color-aux-red-900;
|
|
286
319
|
}
|
|
287
320
|
}
|
|
288
321
|
|
|
289
322
|
&--attention {
|
|
290
|
-
background-color: $unnnic-color-yellow-500;
|
|
323
|
+
background-color: $unnnic-color-aux-yellow-500;
|
|
324
|
+
color: $unnnic-color-neutral-white;
|
|
291
325
|
|
|
292
326
|
&:hover:enabled {
|
|
293
|
-
background-color: $unnnic-color-yellow-
|
|
327
|
+
background-color: $unnnic-color-aux-yellow-700;
|
|
294
328
|
}
|
|
295
329
|
|
|
296
330
|
&:active:enabled {
|
|
297
|
-
background-color: $unnnic-color-yellow-
|
|
331
|
+
background-color: $unnnic-color-aux-yellow-900;
|
|
298
332
|
}
|
|
299
333
|
}
|
|
300
334
|
|
|
301
335
|
&--primary:disabled,
|
|
302
336
|
&--secondary:disabled,
|
|
303
|
-
&--
|
|
337
|
+
&--alternative:disabled,
|
|
304
338
|
&--warning:disabled,
|
|
305
339
|
&--attention:disabled {
|
|
306
|
-
background-color: $unnnic-color-
|
|
307
|
-
color: $unnnic-color-
|
|
340
|
+
background-color: $unnnic-color-neutral-soft;
|
|
341
|
+
color: $unnnic-color-neutral-clean;
|
|
308
342
|
cursor: not-allowed;
|
|
309
343
|
}
|
|
310
344
|
|
|
@@ -317,12 +351,26 @@ watch(
|
|
|
317
351
|
box-shadow: $unnnic-shadow-level-near;
|
|
318
352
|
}
|
|
319
353
|
|
|
320
|
-
&--size
|
|
321
|
-
|
|
322
|
-
|
|
354
|
+
&--size {
|
|
355
|
+
&-extra-large,
|
|
356
|
+
&-large,
|
|
357
|
+
&-small {
|
|
358
|
+
padding: $unnnic-squish-xs;
|
|
359
|
+
font-size: $unnnic-font-size-body-gt;
|
|
360
|
+
line-height: ($unnnic-font-size-body-gt + $unnnic-line-height-medium);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
&-extra-large {
|
|
364
|
+
height: 58px;
|
|
365
|
+
}
|
|
323
366
|
|
|
324
|
-
|
|
325
|
-
|
|
367
|
+
&-large {
|
|
368
|
+
height: 46px;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
&-small {
|
|
372
|
+
height: 38px;
|
|
373
|
+
}
|
|
326
374
|
}
|
|
327
375
|
}
|
|
328
376
|
</style>
|
|
@@ -340,8 +388,8 @@ watch(
|
|
|
340
388
|
}
|
|
341
389
|
|
|
342
390
|
&-large {
|
|
343
|
-
height:
|
|
344
|
-
width:
|
|
391
|
+
height: 46px;
|
|
392
|
+
width: 46px;
|
|
345
393
|
}
|
|
346
394
|
|
|
347
395
|
&-large,
|
|
@@ -356,8 +404,8 @@ watch(
|
|
|
356
404
|
|
|
357
405
|
&-small {
|
|
358
406
|
padding: $unnnic-inset-nano;
|
|
359
|
-
height:
|
|
360
|
-
width:
|
|
407
|
+
height: 38px;
|
|
408
|
+
width: 38px;
|
|
361
409
|
|
|
362
410
|
.unnnic-icon {
|
|
363
411
|
width: $unnnic-icon-size-ant;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
8
|
<script>
|
|
9
|
+
import ChartFunnelTwoRows from './SvgFunnel/ChartFunnelTwoRows.vue';
|
|
9
10
|
import ChartFunnelThreeRows from './SvgFunnel/ChartFunnelThreeRows.vue';
|
|
10
11
|
import ChartFunnelFourRows from './SvgFunnel/ChartFunnelFourRows.vue';
|
|
11
12
|
import ChartFunnelFiveRows from './SvgFunnel/ChartFunnelFiveRows.vue';
|
|
@@ -15,6 +16,7 @@ export default {
|
|
|
15
16
|
name: 'UnnnicChartFunnel',
|
|
16
17
|
|
|
17
18
|
components: {
|
|
19
|
+
ChartFunnelTwoRows,
|
|
18
20
|
ChartFunnelThreeRows,
|
|
19
21
|
ChartFunnelFourRows,
|
|
20
22
|
ChartFunnelFiveRows,
|
|
@@ -36,11 +38,13 @@ export default {
|
|
|
36
38
|
chartComponent() {
|
|
37
39
|
const componentMap = {
|
|
38
40
|
default: {
|
|
41
|
+
2: ChartDefaultFunnelBase,
|
|
39
42
|
3: ChartDefaultFunnelBase,
|
|
40
43
|
4: ChartDefaultFunnelBase,
|
|
41
44
|
5: ChartDefaultFunnelBase,
|
|
42
45
|
},
|
|
43
46
|
basic: {
|
|
47
|
+
2: 'ChartFunnelTwoRows',
|
|
44
48
|
3: 'ChartFunnelThreeRows',
|
|
45
49
|
4: 'ChartFunnelFourRows',
|
|
46
50
|
5: 'ChartFunnelFiveRows',
|