@weni/unnnic-system 3.12.3-alpha.5 → 3.12.3
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 +10 -0
- package/dist/components/Alert/Alert.vue.d.ts +3 -3
- package/dist/components/Alert/Version1dot1.vue.d.ts +1 -1
- package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +18 -92
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +36 -184
- package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts +2 -2
- package/dist/components/Card/AccountCard.vue.d.ts +2 -2
- package/dist/components/Card/Card.vue.d.ts +29 -103
- package/dist/components/Card/CardCompany.vue.d.ts +2 -2
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +19 -93
- package/dist/components/Card/ContentCard.vue.d.ts +1 -1
- package/dist/components/Card/DashCard.vue.d.ts +2 -2
- package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
- package/dist/components/Card/MarketplaceCard.vue.d.ts +1 -1
- package/dist/components/Card/SimpleCard.vue.d.ts +18 -92
- package/dist/components/Card/StatusCard.vue.d.ts +1 -1
- package/dist/components/Card/TitleCard.vue.d.ts +18 -92
- package/dist/components/CardImage/CardImage.vue.d.ts +5 -5
- package/dist/components/CardInformation/CardInformation.vue.d.ts +19 -93
- package/dist/components/CardProject/CardProject.vue.d.ts +2 -2
- package/dist/components/Carousel/Carousel.vue.d.ts +2 -2
- package/dist/components/Carousel/TagCarousel.vue.d.ts +2 -2
- package/dist/components/ChartBar/ChartBar.vue.d.ts +24 -98
- package/dist/components/ChartLine/ChartLine.vue.d.ts +18 -92
- package/dist/components/ChatText/ChatText.vue.d.ts +18 -92
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +6 -6
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +18 -92
- package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
- package/dist/components/DataArea/DataArea.vue.d.ts +18 -92
- package/dist/components/DataTable/index.vue.d.ts +1 -1
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DateFilter/DateFilter.vue.d.ts +16 -122
- package/dist/components/Disclaimer/Disclaimer.vue.d.ts +3 -6
- package/dist/components/Disclaimer/Disclaimer.vue.d.ts.map +1 -1
- package/dist/components/Disclaimer/DisclaimerV2.vue.d.ts +8 -0
- package/dist/components/Disclaimer/DisclaimerV2.vue.d.ts.map +1 -0
- package/dist/components/Disclaimer/types-v2.d.ts +7 -0
- package/dist/components/Disclaimer/types-v2.d.ts.map +1 -0
- package/dist/components/Disclaimer/types.d.ts +3 -6
- package/dist/components/Disclaimer/types.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.vue.d.ts +207 -37
- package/dist/components/Drawer/Drawer.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/components/FormElement/FormElement.vue.d.ts +6 -6
- package/dist/components/ImportCard/ImportCard.vue.d.ts +6 -6
- package/dist/components/Input/BaseInput.vue.d.ts +0 -31
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +15 -121
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +4 -73
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
- package/dist/components/Label/Label.vue.d.ts +1 -1
- package/dist/components/Label/Label.vue.d.ts.map +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +1 -1
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +35 -209
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +21 -127
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +12 -12
- package/dist/components/MoodRating/MoodRating.vue.d.ts +18 -92
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +163 -0
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
- package/dist/components/Radio/Radio.vue.d.ts +6 -6
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +13 -82
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +2 -2
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +5 -5
- package/dist/components/SelectTime/index.vue.d.ts +5 -74
- package/dist/components/Slider/Slider.vue.d.ts +18 -92
- package/dist/components/Switch/Switch.vue.d.ts +3 -3
- package/dist/components/Tab/Tab.vue.d.ts +18 -92
- package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
- package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
- package/dist/components/Tag/DefaultTag.vue.d.ts +1 -1
- package/dist/components/Tag/Tag.vue.d.ts +2 -2
- package/dist/components/TextArea/TextArea.vue.d.ts +8 -8
- package/dist/components/Toast/Toast.vue.d.ts +1 -1
- package/dist/components/Toast/Toast.vue.d.ts.map +1 -1
- package/dist/components/ToolTip/ToolTip.vue.d.ts +18 -92
- package/dist/components/ToolTip/ToolTip.vue.d.ts.map +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 +6 -6
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +2 -2
- package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -1
- package/dist/components/ui/popover/PopoverOption.vue.d.ts +1 -1
- package/dist/components/ui/popover/PopoverOption.vue.d.ts.map +1 -1
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts.map +1 -1
- package/dist/{es-a9e51a05.mjs → es-c19444c0.mjs} +1 -1
- package/dist/{index-ade761d4.mjs → index-93b45359.mjs} +51889 -54741
- package/dist/locales/en.json.d.ts +1 -3
- package/dist/locales/es.json.d.ts +1 -3
- package/dist/locales/pt_br.json.d.ts +1 -3
- package/dist/{pt-br-5395459d.mjs → pt-br-23dc9ca6.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +206 -234
- package/dist/unnnic.umd.js +44 -48
- package/package.json +2 -3
- package/src/assets/scss/scheme-colors.scss +223 -223
- package/src/assets/scss/tailwind.scss +0 -8
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
- package/src/components/Checkbox/Checkbox.vue +1 -1
- package/src/components/Disclaimer/Disclaimer.vue +42 -136
- package/src/components/Disclaimer/DisclaimerV2.vue +171 -0
- package/src/components/Disclaimer/__tests__/Disclaimer.spec.js +45 -70
- package/src/components/Disclaimer/__tests__/DisclaimerV2.spec.js +68 -0
- package/src/components/Disclaimer/types-v2.ts +12 -0
- package/src/components/Disclaimer/types.ts +3 -12
- package/src/components/Drawer/Drawer.vue +269 -190
- package/src/components/Drawer/__tests__/Drawer.spec.js +46 -37
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +19 -18
- package/src/components/Input/BaseInput.vue +5 -25
- package/src/components/Input/Input.scss +3 -2
- package/src/components/Input/Input.vue +1 -24
- package/src/components/Input/TextInput.vue +25 -64
- package/src/components/Input/__test__/TextInput.spec.js +1 -1
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +1 -5
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -7
- package/src/components/ModalDialog/ModalDialog.vue +148 -64
- package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +221 -11
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +22 -1
- package/src/components/MultiSelect/MultiSelect.vue +297 -0
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -3
- package/src/components/Toast/Toast.vue +9 -16
- package/src/components/ToolTip/ToolTip.vue +177 -25
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +61 -339
- package/src/components/index.ts +11 -63
- package/src/components/ui/popover/PopoverContent.vue +2 -19
- package/src/components/ui/popover/PopoverOption.vue +0 -4
- package/src/components/ui/popover/PopoverTrigger.vue +1 -5
- package/src/locales/en.json +1 -3
- package/src/locales/es.json +1 -3
- package/src/locales/pt_br.json +1 -3
- package/src/stories/Disclaimer.stories.js +12 -53
- package/src/stories/DisclaimerV2.stories.js +51 -0
- package/src/stories/Drawer.stories.js +1 -1
- package/src/stories/Input.mdx +0 -3
- package/src/stories/ModalDialog.mdx +0 -3
- package/src/stories/ModalDialog.stories.js +1 -1
- package/src/stories/MultiSelect.stories.js +46 -142
- package/dist/components/MultiSelect/MultSelectOption.vue.d.ts +0 -17
- package/dist/components/MultiSelect/MultSelectOption.vue.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.vue.d.ts +0 -44
- package/dist/components/MultiSelect/index.vue.d.ts.map +0 -1
- package/dist/components/Select/index.vue.d.ts +0 -44
- package/dist/components/Select/index.vue.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -23912
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/ui/dialog/Dialog.vue.d.ts +0 -23
- package/dist/components/ui/dialog/Dialog.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +0 -21
- package/dist/components/ui/dialog/DialogClose.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +0 -43
- package/dist/components/ui/dialog/DialogContent.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +0 -25
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +0 -29
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +0 -23
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +0 -19
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/index.d.ts +0 -8
- package/dist/components/ui/dialog/index.d.ts.map +0 -1
- package/dist/components/ui/drawer/Drawer.vue.d.ts +0 -35
- package/dist/components/ui/drawer/Drawer.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/DrawerClose.vue.d.ts +0 -21
- package/dist/components/ui/drawer/DrawerClose.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts +0 -43
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts +0 -23
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/DrawerFooter.vue.d.ts +0 -22
- package/dist/components/ui/drawer/DrawerFooter.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/DrawerHeader.vue.d.ts +0 -25
- package/dist/components/ui/drawer/DrawerHeader.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts +0 -8
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts +0 -23
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts +0 -19
- package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts.map +0 -1
- package/dist/components/ui/drawer/index.d.ts +0 -11
- package/dist/components/ui/drawer/index.d.ts.map +0 -1
- package/dist/components/ui/tooltip/Tooltip.vue.d.ts +0 -23
- package/dist/components/ui/tooltip/Tooltip.vue.d.ts.map +0 -1
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts +0 -31
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts.map +0 -1
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts +0 -19
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts.map +0 -1
- package/dist/components/ui/tooltip/index.d.ts +0 -4
- package/dist/components/ui/tooltip/index.d.ts.map +0 -1
- package/dist/lib/layer-manager.d.ts +0 -16
- package/dist/lib/layer-manager.d.ts.map +0 -1
- package/src/components/MultiSelect/MultSelectOption.vue +0 -49
- package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +0 -556
- package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +0 -229
- package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +0 -87
- package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +0 -51
- package/src/components/MultiSelect/index.vue +0 -225
- package/src/components/Select/__tests__/Select.spec.js +0 -422
- package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
- package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -71
- 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/__tests__/__snapshots__/SelectPopover.spec.js.snap +0 -8
- package/src/components/Select/index.vue +0 -298
- package/src/components/ui/dialog/Dialog.vue +0 -19
- package/src/components/ui/dialog/DialogClose.vue +0 -29
- package/src/components/ui/dialog/DialogContent.vue +0 -140
- package/src/components/ui/dialog/DialogFooter.vue +0 -50
- package/src/components/ui/dialog/DialogHeader.vue +0 -83
- package/src/components/ui/dialog/DialogTitle.vue +0 -38
- package/src/components/ui/dialog/DialogTrigger.vue +0 -16
- package/src/components/ui/dialog/index.ts +0 -7
- package/src/components/ui/drawer/Drawer.vue +0 -27
- package/src/components/ui/drawer/DrawerClose.vue +0 -31
- package/src/components/ui/drawer/DrawerContent.vue +0 -111
- package/src/components/ui/drawer/DrawerDescription.vue +0 -40
- package/src/components/ui/drawer/DrawerFooter.vue +0 -38
- package/src/components/ui/drawer/DrawerHeader.vue +0 -57
- package/src/components/ui/drawer/DrawerOverlay.vue +0 -33
- package/src/components/ui/drawer/DrawerTitle.vue +0 -37
- package/src/components/ui/drawer/DrawerTrigger.vue +0 -31
- package/src/components/ui/drawer/index.ts +0 -10
- package/src/components/ui/tooltip/Tooltip.vue +0 -21
- package/src/components/ui/tooltip/TooltipContent.vue +0 -74
- package/src/components/ui/tooltip/TooltipTrigger.vue +0 -26
- package/src/components/ui/tooltip/index.ts +0 -3
- package/src/lib/layer-manager.ts +0 -92
- package/src/stories/Dialog.stories.js +0 -832
- package/src/stories/DrawerNext.stories.js +0 -611
- package/src/stories/LayerManager.docs.mdx +0 -40
- package/src/stories/LayerManager.stories.js +0 -364
- package/src/stories/Select.stories.js +0 -158
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
|
-
import { describe, it } from 'vitest';
|
|
2
|
+
import { describe, it, vi } from 'vitest';
|
|
3
3
|
import ModalDialog from '../ModalDialog.vue';
|
|
4
4
|
|
|
5
5
|
describe('ModalDialog.vue', () => {
|
|
@@ -16,12 +16,7 @@ describe('ModalDialog.vue', () => {
|
|
|
16
16
|
'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e }),
|
|
17
17
|
},
|
|
18
18
|
global: {
|
|
19
|
-
stubs: [
|
|
20
|
-
'teleport',
|
|
21
|
-
'UnnnicIcon',
|
|
22
|
-
'UnnnicButton',
|
|
23
|
-
'UnnnicDialogContent',
|
|
24
|
-
],
|
|
19
|
+
stubs: ['UnnnicIcon', 'UnnnicButton'],
|
|
25
20
|
},
|
|
26
21
|
});
|
|
27
22
|
});
|
|
@@ -31,16 +26,231 @@ describe('ModalDialog.vue', () => {
|
|
|
31
26
|
expect(wrapper.html()).toMatchSnapshot();
|
|
32
27
|
});
|
|
33
28
|
|
|
29
|
+
it('should render correctly when modelValue is true', () => {
|
|
30
|
+
const modal = wrapper.find('[data-testid="modal-dialog"]');
|
|
31
|
+
expect(modal.exists()).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should not render when modelValue is false', async () => {
|
|
35
|
+
await wrapper.setProps({ modelValue: false });
|
|
36
|
+
|
|
37
|
+
const modal = wrapper.find('[data-testid="modal-dialog"]');
|
|
38
|
+
expect(modal.exists()).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
|
|
34
41
|
it('should apply the correct size class based on the size prop', async () => {
|
|
35
|
-
const modalContainer = wrapper.find('[data-testid="modal-
|
|
42
|
+
const modalContainer = wrapper.find('[data-testid="modal-container"]');
|
|
43
|
+
const defaultClass = 'unnnic-modal-dialog__container';
|
|
36
44
|
|
|
37
|
-
expect(modalContainer.
|
|
45
|
+
expect(modalContainer.classes()).toContain(defaultClass + '--md');
|
|
38
46
|
|
|
39
47
|
await wrapper.setProps({ size: 'lg' });
|
|
40
|
-
expect(modalContainer.
|
|
48
|
+
expect(modalContainer.classes()).toContain(defaultClass + '--lg');
|
|
41
49
|
|
|
42
50
|
await wrapper.setProps({ size: 'sm' });
|
|
43
|
-
expect(modalContainer.
|
|
51
|
+
expect(modalContainer.classes()).toContain(defaultClass + '--sm');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should render the icon and title when provided', () => {
|
|
55
|
+
const title = wrapper.find('[data-testid="title-text"]');
|
|
56
|
+
expect(title.exists()).toBe(true);
|
|
57
|
+
expect(title.text()).toBe('Test Title');
|
|
58
|
+
|
|
59
|
+
const icon = wrapper.findComponent('[data-testid="title-icon"]');
|
|
60
|
+
expect(icon.exists()).toBe(true);
|
|
61
|
+
expect(icon.props('icon')).toBe('test-icon');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should render the icon from iconsMapper when type prop is provided', async () => {
|
|
65
|
+
await wrapper.setProps({
|
|
66
|
+
type: 'success',
|
|
67
|
+
icon: '',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const icon = wrapper.findComponent('[data-testid="title-icon"]');
|
|
71
|
+
expect(icon.exists()).toBe(true);
|
|
72
|
+
expect(icon.props().icon).toBe(wrapper.vm.iconsMapper['success'].icon);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should not render the icon when both icon and type props are not provided', async () => {
|
|
76
|
+
await wrapper.setProps({
|
|
77
|
+
icon: '',
|
|
78
|
+
type: '',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const icon = wrapper.find('[data-testid="title-icon"]');
|
|
82
|
+
expect(icon.exists()).toBe(false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should render the close icon when showCloseIcon is true', () => {
|
|
86
|
+
const closeIcon = wrapper.find('[data-testid="close-icon"]');
|
|
87
|
+
expect(closeIcon.exists()).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should not render buttons when primaryButtonProps is not provided', async () => {
|
|
91
|
+
await wrapper.setProps({ primaryButtonProps: undefined });
|
|
92
|
+
|
|
93
|
+
const primaryButton = wrapper.find('[data-testid="primary-button"]');
|
|
94
|
+
const secondaryButton = wrapper.find('[data-testid="secondary-button"]');
|
|
95
|
+
expect(primaryButton.exists()).toBe(false);
|
|
96
|
+
expect(secondaryButton.exists()).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('Overlay behavior', () => {
|
|
101
|
+
it('should close the modal when clicking on the overlay if persistent is false', async () => {
|
|
102
|
+
expect(wrapper.props().modelValue).toBe(true);
|
|
103
|
+
|
|
104
|
+
const overlay = wrapper.find('[data-testid="modal-overlay"]');
|
|
105
|
+
await overlay.trigger('click');
|
|
106
|
+
|
|
107
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
|
|
108
|
+
expect(wrapper.emitted('update:modelValue')[0]).toEqual([false]);
|
|
109
|
+
expect(wrapper.props().modelValue).toBe(false);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('should not close the modal when clicking on the overlay if persistent is true', async () => {
|
|
113
|
+
await wrapper.setProps({ persistent: true });
|
|
114
|
+
|
|
115
|
+
const overlay = wrapper.find('[data-testid="modal-overlay"]');
|
|
116
|
+
await overlay.trigger('click');
|
|
117
|
+
|
|
118
|
+
expect(wrapper.emitted('update:modelValue')).toBeFalsy();
|
|
119
|
+
expect(wrapper.props().modelValue).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe('Slot rendering', () => {
|
|
124
|
+
it('should render leftSidebar slot when provided', () => {
|
|
125
|
+
const wrapper = mount(ModalDialog, {
|
|
126
|
+
props: {
|
|
127
|
+
modelValue: true,
|
|
128
|
+
},
|
|
129
|
+
slots: {
|
|
130
|
+
leftSidebar:
|
|
131
|
+
'<div data-testid="left-sidebar">Left Sidebar Content</div>',
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const leftSidebar = wrapper.find('[data-testid="left-sidebar"]');
|
|
136
|
+
expect(leftSidebar.exists()).toBe(true);
|
|
137
|
+
expect(leftSidebar.text()).toBe('Left Sidebar Content');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('should render default slot content', () => {
|
|
141
|
+
const wrapper = mount(ModalDialog, {
|
|
142
|
+
props: {
|
|
143
|
+
modelValue: true,
|
|
144
|
+
},
|
|
145
|
+
slots: {
|
|
146
|
+
default: '<div data-testid="default-slot">Default Slot Content</div>',
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const defaultSlot = wrapper.find('[data-testid="default-slot"]');
|
|
151
|
+
expect(defaultSlot.exists()).toBe(true);
|
|
152
|
+
expect(defaultSlot.text()).toBe('Default Slot Content');
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
describe('Buttons actions', () => {
|
|
157
|
+
it('should close the modal when clicking on close icon', async () => {
|
|
158
|
+
const closeIcon = wrapper.find('[data-testid="close-icon"]');
|
|
159
|
+
await closeIcon.trigger('click');
|
|
160
|
+
|
|
161
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
|
|
162
|
+
expect(wrapper.emitted('update:modelValue')[0]).toEqual([false]);
|
|
163
|
+
expect(wrapper.props().modelValue).toBe(false);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('should emit primaryButtonClick event when the primary button is clicked', async () => {
|
|
167
|
+
const primaryButton = wrapper.find('[data-testid="primary-button"]');
|
|
168
|
+
await primaryButton.trigger('click');
|
|
169
|
+
|
|
170
|
+
expect(wrapper.emitted('primaryButtonClick')).toBeTruthy();
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('should emit secondaryButtonClick event when the secondary button is clicked', async () => {
|
|
174
|
+
await wrapper.setProps({
|
|
175
|
+
secondaryButtonProps: { text: 'Cancel' },
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const secondaryButton = wrapper.find('[data-testid="secondary-button"]');
|
|
179
|
+
await secondaryButton.trigger('click');
|
|
180
|
+
|
|
181
|
+
expect(wrapper.emitted('secondaryButtonClick')).toBeTruthy();
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('should close the modal when the secondary button is clicked and no secondaryButtonClick event is provided', async () => {
|
|
185
|
+
const secondaryButton = wrapper.find('[data-testid="secondary-button"]');
|
|
186
|
+
await secondaryButton.trigger('click');
|
|
187
|
+
|
|
188
|
+
const emittedValue = wrapper.emitted('update:modelValue');
|
|
189
|
+
|
|
190
|
+
expect(emittedValue).toBeTruthy();
|
|
191
|
+
expect(emittedValue[0][0]).toEqual(false);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
describe('Actions and appearance', () => {
|
|
196
|
+
it('should not render the secondary button when hideSecondaryButton is true', async () => {
|
|
197
|
+
await wrapper.setProps({
|
|
198
|
+
hideSecondaryButton: true,
|
|
199
|
+
});
|
|
200
|
+
const secondaryButton = wrapper.find('[data-testid="secondary-button"]');
|
|
201
|
+
expect(secondaryButton.exists()).toBe(false);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('should apply a divider class to the actions section when showActionsDivider is true', async () => {
|
|
205
|
+
await wrapper.setProps({
|
|
206
|
+
showActionsDivider: true,
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
const actionsSection = wrapper.find('[data-testid="actions-section"]');
|
|
210
|
+
expect(actionsSection.classes()).toContain(
|
|
211
|
+
'unnnic-modal-dialog__container__actions--divider',
|
|
212
|
+
);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe('Body overflow', () => {
|
|
217
|
+
it('should toggle body overflow based on modal visibility', async () => {
|
|
218
|
+
await wrapper.setProps({ modelValue: false });
|
|
219
|
+
const updateBodyOverflowSpy = vi.spyOn(wrapper.vm, 'updateBodyOverflow');
|
|
220
|
+
|
|
221
|
+
await wrapper.setProps({ modelValue: true });
|
|
222
|
+
expect(updateBodyOverflowSpy).toHaveBeenCalledWith(true);
|
|
223
|
+
|
|
224
|
+
await wrapper.setProps({ modelValue: false });
|
|
225
|
+
expect(updateBodyOverflowSpy).toHaveBeenCalledWith(false);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
describe('Validators', () => {
|
|
230
|
+
describe('type prop validator', () => {
|
|
231
|
+
it('should validate type prop when a valid value is provided', () => {
|
|
232
|
+
const validTypes = ['success', 'warning', 'attention'];
|
|
233
|
+
validTypes.forEach((validType) => {
|
|
234
|
+
expect(ModalDialog.props.type.validate(validType)).toBe(true);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it('should invalidate type prop when an invalid value is provided', () => {
|
|
239
|
+
expect(ModalDialog.props.type.validate('invalidType')).toBe(false);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
describe('size prop validator', () => {
|
|
244
|
+
it('should validate size prop when a valid value is provided', () => {
|
|
245
|
+
const validSizes = ['sm', 'md', 'lg'];
|
|
246
|
+
validSizes.forEach((validSize) => {
|
|
247
|
+
expect(ModalDialog.props.size.validate(validSize)).toBe(true);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('should invalidate size prop when an invalid value is provided', () => {
|
|
252
|
+
expect(ModalDialog.props.size.validate('invalidSize')).toBe(false);
|
|
253
|
+
});
|
|
44
254
|
});
|
|
45
255
|
});
|
|
46
256
|
});
|
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
|
|
3
|
+
exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
|
|
4
|
+
"<section data-v-68ebadeb="" class="unnnic-modal-dialog" data-testid="modal-dialog">
|
|
5
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__overlay" data-testid="modal-overlay"></section>
|
|
6
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container unnnic-modal-dialog__container--md" data-testid="modal-container">
|
|
7
|
+
<!--v-if-->
|
|
8
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__body">
|
|
9
|
+
<header data-v-68ebadeb="" class="unnnic-modal-dialog__container__header">
|
|
10
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-container">
|
|
11
|
+
<unnnic-icon-stub data-v-68ebadeb="" filled="false" icon="test-icon" clickable="false" size="md" scheme="neutral-darkest" data-testid="title-icon" class="unnnic-modal-dialog__container__title-icon"></unnnic-icon-stub>
|
|
12
|
+
<h1 data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-text" data-testid="title-text">Test Title</h1>
|
|
13
|
+
</section>
|
|
14
|
+
<unnnic-icon-stub data-v-68ebadeb="" filled="false" icon="close" clickable="true" size="md" scheme="neutral-cloudy" data-testid="close-icon"></unnnic-icon-stub>
|
|
15
|
+
</header>
|
|
16
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__content"></section>
|
|
17
|
+
<section data-v-68ebadeb="" data-testid="actions-section" class="unnnic-modal-dialog__container__actions">
|
|
18
|
+
<unnnic-button-stub data-v-68ebadeb="" size="large" text="Cancel" type="tertiary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="secondary-button" class="unnnic-modal-dialog__container__actions__secondary-button"></unnnic-button-stub>
|
|
19
|
+
<unnnic-button-stub data-v-68ebadeb="" size="large" text="Confirm" type="primary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="primary-button" class="unnnic-modal-dialog__container__actions__primary-button"></unnnic-button-stub>
|
|
20
|
+
</section>
|
|
21
|
+
</section>
|
|
22
|
+
</section>
|
|
23
|
+
</section>"
|
|
24
|
+
`;
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="expand ? 'expand-multiselect' : 'normal-multiselect'"
|
|
4
|
+
tabindex="-1"
|
|
5
|
+
>
|
|
6
|
+
<span
|
|
7
|
+
v-if="label"
|
|
8
|
+
class="select-permission-label"
|
|
9
|
+
>{{ label }}</span
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
class="select-permission"
|
|
13
|
+
tabindex="0"
|
|
14
|
+
@keypress="handleIsOpenKeyboard"
|
|
15
|
+
@click="active = !active"
|
|
16
|
+
>
|
|
17
|
+
<h6 class="title noselect">{{ inputTitle }}</h6>
|
|
18
|
+
<UnnnicIcon
|
|
19
|
+
:icon="active ? 'arrow-button-up-1' : 'arrow-button-down-1'"
|
|
20
|
+
size="sm"
|
|
21
|
+
scheme="neutral-dark"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
<div
|
|
25
|
+
v-if="active"
|
|
26
|
+
v-on-click-outside="onClickOutside"
|
|
27
|
+
class="select-content"
|
|
28
|
+
tabindex="0"
|
|
29
|
+
>
|
|
30
|
+
<div>
|
|
31
|
+
<template
|
|
32
|
+
v-for="(group, indexGroup) in modelValue"
|
|
33
|
+
:key="`group-${indexGroup}`"
|
|
34
|
+
>
|
|
35
|
+
<h6
|
|
36
|
+
v-if="!hideGroupTitle"
|
|
37
|
+
:key="`title-${indexGroup}`"
|
|
38
|
+
class="title"
|
|
39
|
+
>
|
|
40
|
+
{{ group.title }}
|
|
41
|
+
</h6>
|
|
42
|
+
<section>
|
|
43
|
+
<template
|
|
44
|
+
v-for="(item, indexItem) in group.items"
|
|
45
|
+
:key="`item-${indexItem}`"
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
v-if="hideRadio"
|
|
49
|
+
:key="indexItem + 'input'"
|
|
50
|
+
class="unnnic-radio-container unnnic-radio-container--sm"
|
|
51
|
+
style="cursor: pointer"
|
|
52
|
+
@click="change(indexGroup, indexItem)"
|
|
53
|
+
>
|
|
54
|
+
<strong>{{ item.title }}</strong>
|
|
55
|
+
<span>{{ item.description }}</span>
|
|
56
|
+
</div>
|
|
57
|
+
<UnnnicRadio
|
|
58
|
+
v-else
|
|
59
|
+
id=""
|
|
60
|
+
:key="'else' + indexItem + 'input'"
|
|
61
|
+
name=""
|
|
62
|
+
:modelValue="group.selected"
|
|
63
|
+
:value="indexItem"
|
|
64
|
+
size="sm"
|
|
65
|
+
class=""
|
|
66
|
+
@update:model-value="change(indexGroup, $event)"
|
|
67
|
+
>
|
|
68
|
+
<strong>{{ item.title }}</strong>
|
|
69
|
+
<span>{{ item.description }}</span>
|
|
70
|
+
</UnnnicRadio>
|
|
71
|
+
</template>
|
|
72
|
+
</section>
|
|
73
|
+
</template>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script>
|
|
80
|
+
import { vOnClickOutside } from '@vueuse/components';
|
|
81
|
+
import UnnnicIcon from '../Icon.vue';
|
|
82
|
+
import UnnnicRadio from '../Radio/Radio.vue';
|
|
83
|
+
|
|
84
|
+
export default {
|
|
85
|
+
name: 'UnnnicMultiSelect',
|
|
86
|
+
components: {
|
|
87
|
+
UnnnicIcon,
|
|
88
|
+
UnnnicRadio,
|
|
89
|
+
},
|
|
90
|
+
directives: {
|
|
91
|
+
onClickOutside: vOnClickOutside,
|
|
92
|
+
},
|
|
93
|
+
props: {
|
|
94
|
+
isOpen: {
|
|
95
|
+
default: false,
|
|
96
|
+
},
|
|
97
|
+
expand: {
|
|
98
|
+
default: false,
|
|
99
|
+
},
|
|
100
|
+
label: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: '',
|
|
103
|
+
},
|
|
104
|
+
modelValue: {
|
|
105
|
+
type: Array,
|
|
106
|
+
default: () => [],
|
|
107
|
+
},
|
|
108
|
+
inputTitle: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: 'Teste',
|
|
111
|
+
},
|
|
112
|
+
hideRadio: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: false,
|
|
115
|
+
},
|
|
116
|
+
hideGroupTitle: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
default: false,
|
|
119
|
+
},
|
|
120
|
+
unselectable: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: false,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
data() {
|
|
127
|
+
return {
|
|
128
|
+
active: false,
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
watch: {
|
|
133
|
+
isOpen() {
|
|
134
|
+
this.active = this.open;
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
handleIsOpenKeyboard(event) {
|
|
139
|
+
if (
|
|
140
|
+
document.querySelector('.select-permission:focus-visible') &&
|
|
141
|
+
event.keyCode === 32
|
|
142
|
+
) {
|
|
143
|
+
this.active = !this.active;
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
onClickOutside() {
|
|
148
|
+
if (!this.active) return;
|
|
149
|
+
this.active = false;
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
change(indexGroup, indexSelected) {
|
|
153
|
+
this.$emit(
|
|
154
|
+
'update:model-value',
|
|
155
|
+
this.modelValue.map((item, index) => {
|
|
156
|
+
if (index === indexGroup) {
|
|
157
|
+
let selected = indexSelected;
|
|
158
|
+
if (this.unselectable && item.selected === indexSelected) {
|
|
159
|
+
selected = -1;
|
|
160
|
+
}
|
|
161
|
+
return { ...item, selected };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return item;
|
|
165
|
+
}),
|
|
166
|
+
);
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
</script>
|
|
171
|
+
|
|
172
|
+
<style lang="scss" scoped>
|
|
173
|
+
@use '@/assets/scss/unnnic' as *;
|
|
174
|
+
|
|
175
|
+
.normal-multiselect,
|
|
176
|
+
.expand-multiselect {
|
|
177
|
+
user-select: none;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.normal-multiselect {
|
|
181
|
+
position: relative;
|
|
182
|
+
max-width: 319px;
|
|
183
|
+
|
|
184
|
+
.select-content {
|
|
185
|
+
max-width: 319px;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.expand-multiselect {
|
|
190
|
+
position: relative;
|
|
191
|
+
width: 100%;
|
|
192
|
+
|
|
193
|
+
.select-content {
|
|
194
|
+
width: 100%;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.noselect {
|
|
199
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
200
|
+
-webkit-user-select: none; /* Safari */
|
|
201
|
+
-khtml-user-select: none; /* Konqueror HTML */
|
|
202
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
203
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
204
|
+
user-select: none; /* Non-prefixed version, currently
|
|
205
|
+
supported by Chrome, Edge, Opera and Firefox */
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.select-permission,
|
|
209
|
+
.select-content > div {
|
|
210
|
+
padding: $unnnic-squish-xs;
|
|
211
|
+
background-color: $unnnic-color-neutral-snow;
|
|
212
|
+
|
|
213
|
+
border-radius: $unnnic-border-radius-sm;
|
|
214
|
+
border: $unnnic-border-width-thinner solid $unnnic-color-neutral-soft;
|
|
215
|
+
}
|
|
216
|
+
.select-permission {
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: row;
|
|
219
|
+
justify-content: space-between;
|
|
220
|
+
align-items: center;
|
|
221
|
+
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
222
|
+
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
.icon {
|
|
225
|
+
margin-left: $unnnic-spacing-inline-xs;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
.select-permission-label {
|
|
229
|
+
display: block;
|
|
230
|
+
|
|
231
|
+
color: $unnnic-color-neutral-cloudy;
|
|
232
|
+
margin-bottom: $unnnic-spacing-stack-xs;
|
|
233
|
+
|
|
234
|
+
font-family: $unnnic-font-family-secondary;
|
|
235
|
+
font-size: $unnnic-font-size-body-gt;
|
|
236
|
+
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.title {
|
|
240
|
+
font-family: $unnnic-font-family-secondary;
|
|
241
|
+
font-size: $unnnic-font-size-body-gt;
|
|
242
|
+
margin: 0;
|
|
243
|
+
font-weight: $unnnic-font-weight-regular;
|
|
244
|
+
color: $unnnic-color-neutral-dark;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.select-content {
|
|
248
|
+
position: absolute;
|
|
249
|
+
margin-top: $unnnic-spacing-stack-xs;
|
|
250
|
+
|
|
251
|
+
> div {
|
|
252
|
+
box-shadow: $unnnic-shadow-level-near;
|
|
253
|
+
.title {
|
|
254
|
+
margin-bottom: $unnnic-spacing-stack-sm;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
& section {
|
|
258
|
+
display: flex;
|
|
259
|
+
flex-direction: column;
|
|
260
|
+
|
|
261
|
+
& + h6 {
|
|
262
|
+
margin-top: $unnnic-spacing-stack-sm;
|
|
263
|
+
padding-top: $unnnic-spacing-stack-sm;
|
|
264
|
+
border-top: $unnnic-border-width-thinner solid
|
|
265
|
+
$unnnic-color-neutral-darkest;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
strong,
|
|
269
|
+
span {
|
|
270
|
+
display: block;
|
|
271
|
+
font-family: $unnnic-font-family-secondary;
|
|
272
|
+
font-size: $unnnic-font-size-body-gt;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
strong {
|
|
276
|
+
font-weight: $unnnic-font-weight-regular;
|
|
277
|
+
}
|
|
278
|
+
span {
|
|
279
|
+
font-weight: $unnnic-font-weight-light;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.unnnic-radio-container {
|
|
283
|
+
& + .unnnic-radio-container {
|
|
284
|
+
margin-top: $unnnic-spacing-stack-sm;
|
|
285
|
+
padding-top: $unnnic-spacing-stack-sm;
|
|
286
|
+
border-top: $unnnic-border-width-thinner solid
|
|
287
|
+
$unnnic-color-neutral-lightest;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
:deep(.unnnic-icon) {
|
|
291
|
+
margin-right: $unnnic-inline-xs;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
</style>
|
|
@@ -4,9 +4,7 @@ exports[`Tab.vue > matches the snapshot 1`] = `
|
|
|
4
4
|
"<div data-v-b4e39fac="" class="tab size-md">
|
|
5
5
|
<header data-v-b4e39fac="" class="tab-header">
|
|
6
6
|
<ul data-v-b4e39fac="" class="tab-content">
|
|
7
|
-
<li data-v-b4e39fac="" class="tab-head">tab1<div data-v-
|
|
8
|
-
<!--teleport start-->
|
|
9
|
-
<!--teleport end-->
|
|
7
|
+
<li data-v-b4e39fac="" class="tab-head">tab1<div data-v-bf0cf546="" data-v-b4e39fac="" class="unnnic-tooltip"><span data-v-26446d8e="" data-v-b4e39fac="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--sm unnnic-icon__size--sm" data-testid="material-icon" translate="no">help</span><span data-v-bf0cf546="" class="unnnic-tooltip-label unnnic-tooltip-label-bottom" data-testid="tooltip-label" style="left: 0px; top: 8px;">Tooltip text <br data-v-bf0cf546=""><!--v-if--></span></div>
|
|
10
8
|
</li>
|
|
11
9
|
<li data-v-b4e39fac="" class="tab-head tab-head--active">tab2
|
|
12
10
|
<!--v-if-->
|
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
>
|
|
8
8
|
<aside
|
|
9
9
|
v-if="isVisible"
|
|
10
|
-
:class="['unnnic-toast', `unnnic-toast--${
|
|
11
|
-
:role="
|
|
12
|
-
:aria-live="
|
|
10
|
+
:class="['unnnic-toast', `unnnic-toast--${type}`]"
|
|
11
|
+
:role="type === 'error' ? 'alert' : 'status'"
|
|
12
|
+
:aria-live="type === 'error' ? 'assertive' : 'polite'"
|
|
13
13
|
data-testid="toast"
|
|
14
|
-
:style="{ zIndex: toastZIndex }"
|
|
15
14
|
>
|
|
16
15
|
<section
|
|
17
16
|
class="unnnic-toast__content"
|
|
@@ -23,7 +22,7 @@
|
|
|
23
22
|
>
|
|
24
23
|
<UnnnicIcon
|
|
25
24
|
:icon="typeConfig.icon"
|
|
26
|
-
:scheme="typeConfig.scheme
|
|
25
|
+
:scheme="typeConfig.scheme"
|
|
27
26
|
size="ant"
|
|
28
27
|
data-testid="toast-type-icon"
|
|
29
28
|
/>
|
|
@@ -75,7 +74,6 @@ import { ref, computed, onMounted, onUnmounted } from 'vue';
|
|
|
75
74
|
|
|
76
75
|
import UnnnicIcon from '@/components/Icon.vue';
|
|
77
76
|
import UnnnicButton from '@/components/Button/Button.vue';
|
|
78
|
-
import { useLayerZIndex } from '@/lib/layer-manager';
|
|
79
77
|
|
|
80
78
|
import type { ToastProps, ToastEmits } from './types';
|
|
81
79
|
import type { SchemeColor } from '@/types/scheme-colors';
|
|
@@ -97,13 +95,6 @@ const emit = defineEmits<ToastEmits>();
|
|
|
97
95
|
const isVisible = ref(false);
|
|
98
96
|
let timeoutId: number | null = null;
|
|
99
97
|
|
|
100
|
-
const validType = computed(() => {
|
|
101
|
-
if (['informational', 'attention', 'success', 'error'].includes(props.type)) {
|
|
102
|
-
return props.type;
|
|
103
|
-
}
|
|
104
|
-
return 'informational';
|
|
105
|
-
});
|
|
106
|
-
|
|
107
98
|
const typeConfig = computed(() => {
|
|
108
99
|
const configMap = {
|
|
109
100
|
informational: { icon: 'info', scheme: 'blue-500' },
|
|
@@ -112,11 +103,12 @@ const typeConfig = computed(() => {
|
|
|
112
103
|
error: { icon: 'cancel', scheme: 'red-500' },
|
|
113
104
|
};
|
|
114
105
|
|
|
115
|
-
return configMap[
|
|
106
|
+
return configMap[props.type || 'informational'] as {
|
|
107
|
+
icon: string;
|
|
108
|
+
scheme: SchemeColor;
|
|
109
|
+
};
|
|
116
110
|
});
|
|
117
111
|
|
|
118
|
-
const toastZIndex = useLayerZIndex('toast');
|
|
119
|
-
|
|
120
112
|
const handleClose = () => {
|
|
121
113
|
isVisible.value = false;
|
|
122
114
|
emit('close');
|
|
@@ -160,6 +152,7 @@ onUnmounted(() => {
|
|
|
160
152
|
position: fixed;
|
|
161
153
|
bottom: $unnnic-space-4;
|
|
162
154
|
right: $unnnic-space-4;
|
|
155
|
+
z-index: 9999;
|
|
163
156
|
|
|
164
157
|
display: flex;
|
|
165
158
|
align-items: flex-end;
|