@weni/unnnic-system 3.12.2 → 3.12.3-alpha.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/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 +92 -18
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +184 -36
- 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 +103 -29
- package/dist/components/Card/CardCompany.vue.d.ts +2 -2
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +93 -19
- 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 +92 -18
- package/dist/components/Card/StatusCard.vue.d.ts +1 -1
- package/dist/components/Card/TitleCard.vue.d.ts +92 -18
- package/dist/components/CardImage/CardImage.vue.d.ts +5 -5
- package/dist/components/CardInformation/CardInformation.vue.d.ts +93 -19
- 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 +98 -24
- package/dist/components/ChartLine/ChartLine.vue.d.ts +92 -18
- package/dist/components/ChatText/ChatText.vue.d.ts +92 -18
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +6 -6
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +92 -18
- 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 +92 -18
- 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 +94 -15
- package/dist/components/Drawer/Drawer.vue.d.ts +37 -207
- 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 +22 -0
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +93 -14
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +54 -3
- 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 +209 -35
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +99 -20
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +12 -12
- package/dist/components/MoodRating/MoodRating.vue.d.ts +92 -18
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +18 -18
- package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
- package/dist/components/Radio/Radio.vue.d.ts +6 -6
- package/dist/components/Select/index.vue.d.ts +44 -0
- package/dist/components/Select/index.vue.d.ts.map +1 -0
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +63 -12
- 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 +55 -4
- package/dist/components/Slider/Slider.vue.d.ts +92 -18
- package/dist/components/Switch/Switch.vue.d.ts +3 -3
- package/dist/components/Tab/Tab.vue.d.ts +92 -18
- 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 +92 -18
- 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/dialog/Dialog.vue.d.ts +23 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +19 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +43 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +25 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +29 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +23 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +19 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/index.d.ts +8 -0
- package/dist/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/components/ui/drawer/Drawer.vue.d.ts +35 -0
- package/dist/components/ui/drawer/Drawer.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerClose.vue.d.ts +19 -0
- package/dist/components/ui/drawer/DrawerClose.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts +43 -0
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts +23 -0
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerFooter.vue.d.ts +22 -0
- package/dist/components/ui/drawer/DrawerFooter.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerHeader.vue.d.ts +25 -0
- package/dist/components/ui/drawer/DrawerHeader.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts +8 -0
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts +23 -0
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts +19 -0
- package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/index.d.ts +11 -0
- package/dist/components/ui/drawer/index.d.ts.map +1 -0
- 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/components/ui/tooltip/Tooltip.vue.d.ts +23 -0
- package/dist/components/ui/tooltip/Tooltip.vue.d.ts.map +1 -0
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts +31 -0
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts.map +1 -0
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts +19 -0
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +4 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -0
- package/dist/{es-40d7aad6.mjs → es-59933601.mjs} +1 -1
- package/dist/{index-56b50ff8.mjs → index-4fe9253b.mjs} +99820 -96757
- package/dist/lib/layer-manager.d.ts +16 -0
- package/dist/lib/layer-manager.d.ts.map +1 -0
- package/dist/locales/en.json.d.ts +2 -1
- package/dist/locales/es.json.d.ts +2 -1
- package/dist/locales/pt_br.json.d.ts +2 -1
- package/dist/{pt-br-e6e2313f.mjs → pt-br-10db3200.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +234 -204
- package/dist/unnnic.umd.js +48 -44
- package/package.json +3 -2
- package/src/assets/scss/scheme-colors.scss +223 -223
- package/src/assets/scss/tailwind.scss +8 -0
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
- package/src/components/Checkbox/Checkbox.vue +1 -1
- package/src/components/Drawer/Drawer.vue +190 -269
- package/src/components/Drawer/__tests__/Drawer.spec.js +37 -46
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
- package/src/components/Input/BaseInput.vue +21 -2
- package/src/components/Input/Input.scss +2 -3
- package/src/components/Input/Input.vue +19 -1
- package/src/components/Input/TextInput.vue +58 -22
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -1
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -1
- package/src/components/ModalDialog/ModalDialog.vue +64 -148
- package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +11 -221
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
- package/src/components/MultiSelectV2/MultSelectOption.vue +67 -0
- package/src/components/MultiSelectV2/__tests__/MultiSelect.spec.js +556 -0
- package/src/components/MultiSelectV2/__tests__/MultiSelectOption.spec.js +229 -0
- package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelect.spec.js.snap +121 -0
- package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
- package/src/components/MultiSelectV2/index.vue +224 -0
- package/src/components/Select/__tests__/Select.spec.js +422 -0
- package/src/components/Select/__tests__/SelectItem.spec.js +330 -0
- package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +65 -0
- package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
- package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
- package/src/components/Select/__tests__/__snapshots__/SelectPopover.spec.js.snap +8 -0
- package/src/components/Select/index.vue +261 -0
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
- package/src/components/Toast/Toast.vue +16 -9
- package/src/components/ToolTip/ToolTip.vue +25 -177
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
- package/src/components/index.ts +60 -4
- package/src/components/ui/dialog/Dialog.vue +19 -0
- package/src/components/ui/dialog/DialogClose.vue +29 -0
- package/src/components/ui/dialog/DialogContent.vue +140 -0
- package/src/components/ui/dialog/DialogFooter.vue +50 -0
- package/src/components/ui/dialog/DialogHeader.vue +83 -0
- package/src/components/ui/dialog/DialogTitle.vue +38 -0
- package/src/components/ui/dialog/DialogTrigger.vue +16 -0
- package/src/components/ui/dialog/index.ts +7 -0
- package/src/components/ui/drawer/Drawer.vue +27 -0
- package/src/components/ui/drawer/DrawerClose.vue +37 -0
- package/src/components/ui/drawer/DrawerContent.vue +111 -0
- package/src/components/ui/drawer/DrawerDescription.vue +40 -0
- package/src/components/ui/drawer/DrawerFooter.vue +38 -0
- package/src/components/ui/drawer/DrawerHeader.vue +57 -0
- package/src/components/ui/drawer/DrawerOverlay.vue +33 -0
- package/src/components/ui/drawer/DrawerTitle.vue +37 -0
- package/src/components/ui/drawer/DrawerTrigger.vue +31 -0
- package/src/components/ui/drawer/index.ts +10 -0
- package/src/components/ui/popover/PopoverContent.vue +4 -2
- package/src/components/ui/popover/PopoverOption.vue +4 -0
- package/src/components/ui/popover/PopoverTrigger.vue +5 -1
- package/src/components/ui/tooltip/Tooltip.vue +21 -0
- package/src/components/ui/tooltip/TooltipContent.vue +74 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +26 -0
- package/src/components/ui/tooltip/index.ts +3 -0
- package/src/lib/layer-manager.ts +84 -0
- package/src/locales/en.json +2 -1
- package/src/locales/es.json +2 -1
- package/src/locales/pt_br.json +2 -1
- package/src/stories/Dialog.stories.js +832 -0
- package/src/stories/Drawer.stories.js +1 -1
- package/src/stories/DrawerNext.stories.js +611 -0
- package/src/stories/LayerManager.docs.mdx +40 -0
- package/src/stories/LayerManager.stories.js +364 -0
- package/src/stories/ModalDialog.mdx +3 -0
- package/src/stories/ModalDialog.stories.js +1 -1
- package/src/stories/MultiSelectV2.stories.js +158 -0
- package/src/stories/Select.stories.js +158 -0
|
@@ -3,102 +3,380 @@ import { mount } from '@vue/test-utils';
|
|
|
3
3
|
|
|
4
4
|
import ToolTip from '../ToolTip.vue';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
globalThis.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
7
|
+
observe: vi.fn(),
|
|
8
|
+
unobserve: vi.fn(),
|
|
9
|
+
disconnect: vi.fn(),
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
const createWrapper = (props = {}, slots = {}) => {
|
|
13
|
+
return mount(ToolTip, {
|
|
14
|
+
props,
|
|
15
|
+
slots: {
|
|
16
|
+
default: '<button data-testid="trigger-button">Hover me</button>',
|
|
17
|
+
...slots,
|
|
18
|
+
},
|
|
19
|
+
attachTo: document.body,
|
|
20
|
+
global: {
|
|
21
|
+
stubs: {
|
|
22
|
+
teleport: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
8
26
|
};
|
|
9
27
|
|
|
10
28
|
describe('ToolTip', () => {
|
|
11
29
|
let wrapper;
|
|
30
|
+
|
|
12
31
|
beforeEach(() => {
|
|
13
|
-
wrapper = createWrapper({ text: '
|
|
32
|
+
wrapper = createWrapper({ text: 'Tooltip text', enabled: true });
|
|
14
33
|
});
|
|
15
34
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
if (wrapper) {
|
|
37
|
+
wrapper.unmount();
|
|
38
|
+
}
|
|
20
39
|
});
|
|
21
40
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
describe('Component Rendering', () => {
|
|
42
|
+
it('should render the component', () => {
|
|
43
|
+
expect(wrapper.exists()).toBe(true);
|
|
44
|
+
expect(wrapper.vm).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should render slot content', () => {
|
|
48
|
+
const triggerButton = wrapper.find('[data-testid="trigger-button"]');
|
|
49
|
+
expect(triggerButton.exists()).toBe(true);
|
|
50
|
+
expect(triggerButton.text()).toBe('Hover me');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should render custom slot content', () => {
|
|
54
|
+
const customWrapper = createWrapper(
|
|
55
|
+
{ text: 'Tooltip text', enabled: true },
|
|
56
|
+
{
|
|
57
|
+
default: '<span data-testid="custom-trigger">Custom Content</span>',
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const customTrigger = customWrapper.find(
|
|
62
|
+
'[data-testid="custom-trigger"]',
|
|
63
|
+
);
|
|
64
|
+
expect(customTrigger.exists()).toBe(true);
|
|
65
|
+
expect(customTrigger.text()).toBe('Custom Content');
|
|
66
|
+
|
|
67
|
+
customWrapper.unmount();
|
|
68
|
+
});
|
|
25
69
|
});
|
|
26
70
|
|
|
27
|
-
|
|
28
|
-
|
|
71
|
+
describe('Props', () => {
|
|
72
|
+
it('should accept text prop', () => {
|
|
73
|
+
expect(wrapper.vm.$props.text).toBe('Tooltip text');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should accept enabled prop', () => {
|
|
77
|
+
expect(wrapper.vm.$props.enabled).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('should accept forceOpen prop', () => {
|
|
81
|
+
const testWrapper = createWrapper({ text: 'Text', forceOpen: true });
|
|
82
|
+
expect(testWrapper.vm.$props.forceOpen).toBe(true);
|
|
83
|
+
testWrapper.unmount();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should accept side prop with valid values', () => {
|
|
87
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
88
|
+
|
|
89
|
+
sides.forEach((side) => {
|
|
90
|
+
const sideWrapper = createWrapper({
|
|
91
|
+
text: 'Text',
|
|
92
|
+
enabled: true,
|
|
93
|
+
side,
|
|
94
|
+
});
|
|
95
|
+
expect(sideWrapper.vm.$props.side).toBe(side);
|
|
96
|
+
sideWrapper.unmount();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('should default to "right" side when not specified', () => {
|
|
101
|
+
expect(wrapper.vm.$props.side).toBe('right');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('should accept maxWidth prop', () => {
|
|
105
|
+
const maxWidthWrapper = createWrapper({
|
|
106
|
+
text: 'Text',
|
|
107
|
+
enabled: true,
|
|
108
|
+
maxWidth: '200px',
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
expect(maxWidthWrapper.vm.$props.maxWidth).toBe('200px');
|
|
29
112
|
|
|
30
|
-
|
|
31
|
-
|
|
113
|
+
maxWidthWrapper.unmount();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should accept enableHtml prop', () => {
|
|
117
|
+
const htmlWrapper = createWrapper({
|
|
118
|
+
text: 'Text',
|
|
119
|
+
enableHtml: true,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
expect(htmlWrapper.vm.$props.enableHtml).toBe(true);
|
|
123
|
+
|
|
124
|
+
htmlWrapper.unmount();
|
|
125
|
+
});
|
|
32
126
|
});
|
|
33
127
|
|
|
34
|
-
|
|
35
|
-
|
|
128
|
+
describe('Boolean Props', () => {
|
|
129
|
+
it('should handle enabled false', () => {
|
|
130
|
+
const disabledWrapper = createWrapper({
|
|
131
|
+
text: 'Text',
|
|
132
|
+
enabled: false,
|
|
133
|
+
});
|
|
36
134
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
135
|
+
expect(disabledWrapper.vm.$props.enabled).toBe(false);
|
|
136
|
+
|
|
137
|
+
disabledWrapper.unmount();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('should handle forceOpen true', () => {
|
|
141
|
+
const forceOpenWrapper = createWrapper({
|
|
142
|
+
text: 'Text',
|
|
143
|
+
enabled: false,
|
|
144
|
+
forceOpen: true,
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
expect(forceOpenWrapper.vm.$props.forceOpen).toBe(true);
|
|
148
|
+
|
|
149
|
+
forceOpenWrapper.unmount();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('should handle enableHtml false', () => {
|
|
153
|
+
expect(wrapper.vm.$props.enableHtml).toBe(false);
|
|
154
|
+
});
|
|
42
155
|
});
|
|
43
156
|
|
|
44
|
-
|
|
45
|
-
|
|
157
|
+
describe('Text Content Rendering', () => {
|
|
158
|
+
it('should accept plain text content via prop', () => {
|
|
159
|
+
const plainWrapper = createWrapper({
|
|
160
|
+
text: 'Simple tooltip text',
|
|
161
|
+
enabled: true,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
expect(plainWrapper.vm.$props.text).toBe('Simple tooltip text');
|
|
165
|
+
|
|
166
|
+
plainWrapper.unmount();
|
|
167
|
+
});
|
|
46
168
|
|
|
47
|
-
|
|
169
|
+
it('should accept multiline text via prop', () => {
|
|
170
|
+
const multilineWrapper = createWrapper({
|
|
171
|
+
text: 'First line\nSecond line\nThird line',
|
|
172
|
+
enabled: true,
|
|
173
|
+
});
|
|
48
174
|
|
|
49
|
-
|
|
50
|
-
|
|
175
|
+
expect(multilineWrapper.vm.$props.text).toBe(
|
|
176
|
+
'First line\nSecond line\nThird line',
|
|
177
|
+
);
|
|
51
178
|
|
|
52
|
-
|
|
53
|
-
|
|
179
|
+
multilineWrapper.unmount();
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('should handle empty text', () => {
|
|
183
|
+
const emptyWrapper = createWrapper({ text: '', enabled: true });
|
|
184
|
+
|
|
185
|
+
expect(emptyWrapper.vm.$props.text).toBe('');
|
|
186
|
+
expect(emptyWrapper.exists()).toBe(true);
|
|
187
|
+
|
|
188
|
+
emptyWrapper.unmount();
|
|
189
|
+
});
|
|
54
190
|
});
|
|
55
191
|
|
|
56
|
-
|
|
57
|
-
|
|
192
|
+
describe('HTML Content', () => {
|
|
193
|
+
it('should accept HTML text with enableHtml prop set to true', () => {
|
|
194
|
+
const htmlWrapper = createWrapper({
|
|
195
|
+
enableHtml: true,
|
|
196
|
+
enabled: true,
|
|
197
|
+
text: 'Tooltip with <strong>bold</strong> text',
|
|
198
|
+
});
|
|
58
199
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
200
|
+
expect(htmlWrapper.vm.$props.enableHtml).toBe(true);
|
|
201
|
+
expect(htmlWrapper.vm.$props.text).toBe(
|
|
202
|
+
'Tooltip with <strong>bold</strong> text',
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
htmlWrapper.unmount();
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('should accept HTML link with enableHtml prop', () => {
|
|
209
|
+
const linkWrapper = createWrapper({
|
|
210
|
+
enableHtml: true,
|
|
211
|
+
enabled: true,
|
|
212
|
+
text: 'Visit <a href="https://weni.ai/" target="_blank">Weni</a>',
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
expect(linkWrapper.vm.$props.enableHtml).toBe(true);
|
|
216
|
+
expect(linkWrapper.vm.$props.text).toContain('href="https://weni.ai/"');
|
|
217
|
+
expect(linkWrapper.vm.$props.text).toContain('target="_blank"');
|
|
218
|
+
|
|
219
|
+
linkWrapper.unmount();
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('should handle plain text when enableHtml is false', () => {
|
|
223
|
+
const plainWrapper = createWrapper({
|
|
224
|
+
enableHtml: false,
|
|
225
|
+
enabled: true,
|
|
226
|
+
text: 'Tooltip with <strong>bold</strong> text',
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
expect(plainWrapper.vm.$props.enableHtml).toBe(false);
|
|
230
|
+
expect(plainWrapper.vm.$props.text).toBe(
|
|
231
|
+
'Tooltip with <strong>bold</strong> text',
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
plainWrapper.unmount();
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
describe('Component Structure', () => {
|
|
239
|
+
it('should have Tooltip component', () => {
|
|
240
|
+
expect(wrapper.findComponent({ name: 'Tooltip' }).exists()).toBe(true);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('should have TooltipTrigger component', () => {
|
|
244
|
+
expect(wrapper.findComponent({ name: 'TooltipTrigger' }).exists()).toBe(
|
|
245
|
+
true,
|
|
246
|
+
);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('should have TooltipContent component', () => {
|
|
250
|
+
expect(wrapper.findComponent({ name: 'TooltipContent' }).exists()).toBe(
|
|
251
|
+
true,
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
describe('CSS Classes', () => {
|
|
257
|
+
it('should pass side prop to TooltipContent', () => {
|
|
258
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
259
|
+
|
|
260
|
+
sides.forEach((side) => {
|
|
261
|
+
const sideWrapper = createWrapper({
|
|
262
|
+
text: 'Text',
|
|
263
|
+
enabled: true,
|
|
264
|
+
side,
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
const tooltipContent = sideWrapper.findComponent({
|
|
268
|
+
name: 'TooltipContent',
|
|
269
|
+
});
|
|
270
|
+
expect(tooltipContent.exists()).toBe(true);
|
|
271
|
+
expect(tooltipContent.props('side')).toBe(side);
|
|
272
|
+
|
|
273
|
+
sideWrapper.unmount();
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('should pass class prop to TooltipContent component', () => {
|
|
278
|
+
const tooltipContent = wrapper.findComponent({ name: 'TooltipContent' });
|
|
279
|
+
expect(tooltipContent.exists()).toBe(true);
|
|
280
|
+
expect(tooltipContent.props('class')).toContain('unnnic-tooltip-label');
|
|
281
|
+
});
|
|
64
282
|
});
|
|
65
283
|
|
|
66
|
-
|
|
67
|
-
|
|
284
|
+
describe('Side Validator', () => {
|
|
285
|
+
it('should validate side prop correctly', () => {
|
|
286
|
+
const validator = wrapper.vm.$options.props.side.validator;
|
|
287
|
+
|
|
288
|
+
expect(validator('top')).toBe(true);
|
|
289
|
+
expect(validator('right')).toBe(true);
|
|
290
|
+
expect(validator('bottom')).toBe(true);
|
|
291
|
+
expect(validator('left')).toBe(true);
|
|
292
|
+
expect(validator('invalid')).toBe(false);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
68
295
|
|
|
69
|
-
|
|
296
|
+
describe('Props Defaults', () => {
|
|
297
|
+
it('should have correct default values', () => {
|
|
298
|
+
const defaultWrapper = createWrapper();
|
|
70
299
|
|
|
71
|
-
|
|
72
|
-
|
|
300
|
+
expect(defaultWrapper.vm.$props.text).toBe('');
|
|
301
|
+
expect(defaultWrapper.vm.$props.enabled).toBe(false);
|
|
302
|
+
expect(defaultWrapper.vm.$props.forceOpen).toBe(false);
|
|
303
|
+
expect(defaultWrapper.vm.$props.side).toBe('right');
|
|
304
|
+
expect(defaultWrapper.vm.$props.maxWidth).toBe('');
|
|
305
|
+
expect(defaultWrapper.vm.$props.enableHtml).toBe(false);
|
|
306
|
+
|
|
307
|
+
defaultWrapper.unmount();
|
|
308
|
+
});
|
|
73
309
|
});
|
|
74
310
|
|
|
75
|
-
|
|
76
|
-
|
|
311
|
+
describe('Max Width Style', () => {
|
|
312
|
+
it('should pass maxWidth prop to TooltipContent', () => {
|
|
313
|
+
const maxWidthWrapper = createWrapper({
|
|
314
|
+
text: 'Text',
|
|
315
|
+
enabled: true,
|
|
316
|
+
maxWidth: '250px',
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
expect(maxWidthWrapper.vm.$props.maxWidth).toBe('250px');
|
|
320
|
+
|
|
321
|
+
maxWidthWrapper.unmount();
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
it('should handle different maxWidth values', () => {
|
|
325
|
+
const values = ['100px', '50%', '20rem', '300px'];
|
|
326
|
+
|
|
327
|
+
values.forEach((maxWidth) => {
|
|
328
|
+
const testWrapper = createWrapper({
|
|
329
|
+
text: 'Text',
|
|
330
|
+
enabled: true,
|
|
331
|
+
maxWidth,
|
|
332
|
+
});
|
|
77
333
|
|
|
78
|
-
|
|
334
|
+
expect(testWrapper.vm.$props.maxWidth).toBe(maxWidth);
|
|
79
335
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
);
|
|
84
|
-
expect(removeEventListenerSpy).toHaveBeenCalledWith(
|
|
85
|
-
'resize',
|
|
86
|
-
expect.any(Function),
|
|
87
|
-
);
|
|
336
|
+
testWrapper.unmount();
|
|
337
|
+
});
|
|
338
|
+
});
|
|
88
339
|
});
|
|
89
340
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
341
|
+
describe('Component Props Types', () => {
|
|
342
|
+
it('should have correct prop types', () => {
|
|
343
|
+
const { props } = wrapper.vm.$options;
|
|
344
|
+
|
|
345
|
+
expect(props.text.type).toBe(String);
|
|
346
|
+
expect(props.enabled.type).toBe(Boolean);
|
|
347
|
+
expect(props.forceOpen.type).toBe(Boolean);
|
|
348
|
+
expect(props.side.type).toBe(String);
|
|
349
|
+
expect(props.maxWidth.type).toBe(String);
|
|
350
|
+
expect(props.enableHtml.type).toBe(Boolean);
|
|
351
|
+
});
|
|
94
352
|
});
|
|
95
353
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
354
|
+
describe('Enabled and ForceOpen Logic', () => {
|
|
355
|
+
it('should be disabled when enabled is false and forceOpen is false', () => {
|
|
356
|
+
const disabledWrapper = createWrapper({
|
|
357
|
+
text: 'Text',
|
|
358
|
+
enabled: false,
|
|
359
|
+
forceOpen: false,
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
expect(disabledWrapper.vm.$props.enabled).toBe(false);
|
|
363
|
+
expect(disabledWrapper.vm.$props.forceOpen).toBe(false);
|
|
364
|
+
|
|
365
|
+
disabledWrapper.unmount();
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it('should override disabled state when forceOpen is true', () => {
|
|
369
|
+
const forceOpenWrapper = createWrapper({
|
|
370
|
+
text: 'Text',
|
|
371
|
+
enabled: false,
|
|
372
|
+
forceOpen: true,
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
expect(forceOpenWrapper.vm.$props.enabled).toBe(false);
|
|
376
|
+
expect(forceOpenWrapper.vm.$props.forceOpen).toBe(true);
|
|
377
|
+
expect(forceOpenWrapper.html()).toContain('unnnic-tooltip');
|
|
378
|
+
|
|
379
|
+
forceOpenWrapper.unmount();
|
|
100
380
|
});
|
|
101
|
-
const link = wrapper.find('a[data-testid="weni-link"]');
|
|
102
|
-
expect(link.exists()).toBeTruthy();
|
|
103
381
|
});
|
|
104
382
|
});
|
package/src/components/index.ts
CHANGED
|
@@ -33,7 +33,7 @@ import modal from './Modal/Modal.vue';
|
|
|
33
33
|
import modalUpload from './ModalUpload/ModalUpload.vue';
|
|
34
34
|
import { callAlert, callModal } from '../utils/call';
|
|
35
35
|
import selectSmart from './SelectSmart/SelectSmart.vue';
|
|
36
|
-
|
|
36
|
+
import select from './Select/index.vue';
|
|
37
37
|
import selectItem from './Select/SelectItem.vue';
|
|
38
38
|
// import selectListItem from './SelectListItem/SelectListItem.vue';
|
|
39
39
|
import multiSelect from './MultiSelect/MultiSelect.vue';
|
|
@@ -111,6 +111,20 @@ import {
|
|
|
111
111
|
SegmentedControlContent,
|
|
112
112
|
} from './ui/segmented-control';
|
|
113
113
|
import PageHeader from './PageHeader/PageHeader.vue';
|
|
114
|
+
import Dialog from './ui/dialog/Dialog.vue';
|
|
115
|
+
import DialogContent from './ui/dialog/DialogContent.vue';
|
|
116
|
+
import DialogFooter from './ui/dialog/DialogFooter.vue';
|
|
117
|
+
import DialogHeader from './ui/dialog/DialogHeader.vue';
|
|
118
|
+
import DialogTitle from './ui/dialog/DialogTitle.vue';
|
|
119
|
+
import DialogTrigger from './ui/dialog/DialogTrigger.vue';
|
|
120
|
+
import DialogClose from './ui/dialog/DialogClose.vue';
|
|
121
|
+
import DrawerNext from './ui/drawer/Drawer.vue';
|
|
122
|
+
import DrawerContent from './ui/drawer/DrawerContent.vue';
|
|
123
|
+
import DrawerHeader from './ui/drawer/DrawerHeader.vue';
|
|
124
|
+
import DrawerFooter from './ui/drawer/DrawerFooter.vue';
|
|
125
|
+
import DrawerClose from './ui/drawer/DrawerClose.vue';
|
|
126
|
+
import DrawerTitle from './ui/drawer/DrawerTitle.vue';
|
|
127
|
+
import DrawerDescription from './ui/drawer/DrawerDescription.vue';
|
|
114
128
|
|
|
115
129
|
type VueComponent = Component;
|
|
116
130
|
|
|
@@ -154,7 +168,7 @@ export const components: ComponentsMap = {
|
|
|
154
168
|
unnnicModalDialog: ModalDialog,
|
|
155
169
|
unnnicModalUpload: modalUpload,
|
|
156
170
|
unnnicSelectSmart: selectSmart,
|
|
157
|
-
|
|
171
|
+
unnnicSelect: select,
|
|
158
172
|
unnnicSelectItem: selectItem,
|
|
159
173
|
// unnnicSelectListItem: selectListItem,
|
|
160
174
|
unnnicMultiSelect: multiSelect,
|
|
@@ -230,6 +244,20 @@ export const components: ComponentsMap = {
|
|
|
230
244
|
unnnicSegmentedControlTrigger: SegmentedControlTrigger,
|
|
231
245
|
unnnicSegmentedControlContent: SegmentedControlContent,
|
|
232
246
|
unnnicPageHeader: PageHeader,
|
|
247
|
+
unnnicDialog: Dialog,
|
|
248
|
+
unnnicDialogContent: DialogContent,
|
|
249
|
+
unnnicDialogFooter: DialogFooter,
|
|
250
|
+
unnnicDialogHeader: DialogHeader,
|
|
251
|
+
unnnicDialogTitle: DialogTitle,
|
|
252
|
+
unnnicDialogTrigger: DialogTrigger,
|
|
253
|
+
unnnicDialogClose: DialogClose,
|
|
254
|
+
unnnicDrawerNext: DrawerNext,
|
|
255
|
+
unnnicDrawerContent: DrawerContent,
|
|
256
|
+
unnnicDrawerHeader: DrawerHeader,
|
|
257
|
+
unnnicDrawerFooter: DrawerFooter,
|
|
258
|
+
unnnicDrawerClose: DrawerClose,
|
|
259
|
+
unnnicDrawerTitle: DrawerTitle,
|
|
260
|
+
unnnicDrawerDescription: DrawerDescription,
|
|
233
261
|
};
|
|
234
262
|
|
|
235
263
|
export const unnnicFontSize = fontSize;
|
|
@@ -268,7 +296,7 @@ export const unnnicModalDialog = ModalDialog;
|
|
|
268
296
|
export const unnnicModalNext = ModalNext;
|
|
269
297
|
export const unnnicModalUpload = modalUpload;
|
|
270
298
|
export const unnnicSelectSmart = selectSmart as VueComponent;
|
|
271
|
-
|
|
299
|
+
export const unnnicSelect = select as VueComponent;
|
|
272
300
|
export const unnnicSelectItem = selectItem;
|
|
273
301
|
// export const unnnicSelectListItem = selectListItem;
|
|
274
302
|
export const unnnicMultiSelect = multiSelect as VueComponent;
|
|
@@ -344,6 +372,20 @@ export const unnnicSegmentedControlList = SegmentedControlList;
|
|
|
344
372
|
export const unnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
345
373
|
export const unnnicSegmentedControlContent = SegmentedControlContent;
|
|
346
374
|
export const unnnicPageHeader = PageHeader;
|
|
375
|
+
export const unnnicDialog = Dialog;
|
|
376
|
+
export const unnnicDialogContent = DialogContent;
|
|
377
|
+
export const unnnicDialogFooter = DialogFooter;
|
|
378
|
+
export const unnnicDialogHeader = DialogHeader;
|
|
379
|
+
export const unnnicDialogTitle = DialogTitle;
|
|
380
|
+
export const unnnicDialogTrigger = DialogTrigger;
|
|
381
|
+
export const unnnicDialogClose = DialogClose;
|
|
382
|
+
export const unnnicDrawerNext = DrawerNext;
|
|
383
|
+
export const unnnicDrawerContent = DrawerContent;
|
|
384
|
+
export const unnnicDrawerHeader = DrawerHeader;
|
|
385
|
+
export const unnnicDrawerFooter = DrawerFooter;
|
|
386
|
+
export const unnnicDrawerClose = DrawerClose;
|
|
387
|
+
export const unnnicDrawerTitle = DrawerTitle;
|
|
388
|
+
export const unnnicDrawerDescription = DrawerDescription;
|
|
347
389
|
|
|
348
390
|
export const UnnnicFontSize = fontSize;
|
|
349
391
|
export const UnnnicFormElement = formElement;
|
|
@@ -381,7 +423,7 @@ export const UnnnicModalDialog = ModalDialog;
|
|
|
381
423
|
export const UnnnicModalNext = ModalNext;
|
|
382
424
|
export const UnnnicModalUpload = modalUpload;
|
|
383
425
|
export const UnnnicSelectSmart = selectSmart as VueComponent;
|
|
384
|
-
|
|
426
|
+
export const UnnnicSelect = select as VueComponent;
|
|
385
427
|
export const UnnnicSelectItem = selectItem;
|
|
386
428
|
// export const UnnnicSelectListItem = selectListItem;
|
|
387
429
|
export const UnnnicMultiSelect = multiSelect as VueComponent;
|
|
@@ -457,3 +499,17 @@ export const UnnnicSegmentedControlList = SegmentedControlList;
|
|
|
457
499
|
export const UnnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
458
500
|
export const UnnnicSegmentedControlContent = SegmentedControlContent;
|
|
459
501
|
export const UnnnicPageHeader = PageHeader;
|
|
502
|
+
export const UnnnicDialog = Dialog;
|
|
503
|
+
export const UnnnicDialogContent = DialogContent;
|
|
504
|
+
export const UnnnicDialogFooter = DialogFooter;
|
|
505
|
+
export const UnnnicDialogHeader = DialogHeader;
|
|
506
|
+
export const UnnnicDialogTitle = DialogTitle;
|
|
507
|
+
export const UnnnicDialogTrigger = DialogTrigger;
|
|
508
|
+
export const UnnnicDialogClose = DialogClose;
|
|
509
|
+
export const UnnnicDrawerNext = DrawerNext;
|
|
510
|
+
export const UnnnicDrawerContent = DrawerContent;
|
|
511
|
+
export const UnnnicDrawerHeader = DrawerHeader;
|
|
512
|
+
export const UnnnicDrawerFooter = DrawerFooter;
|
|
513
|
+
export const UnnnicDrawerClose = DrawerClose;
|
|
514
|
+
export const UnnnicDrawerTitle = DrawerTitle;
|
|
515
|
+
export const UnnnicDrawerDescription = DrawerDescription;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DialogRootEmits, DialogRootProps } from 'reka-ui';
|
|
3
|
+
import { DialogRoot, useForwardPropsEmits } from 'reka-ui';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UnnnicDialog',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<DialogRootProps>();
|
|
10
|
+
const emits = defineEmits<DialogRootEmits>();
|
|
11
|
+
|
|
12
|
+
const forwarded = useForwardPropsEmits(props, emits);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<DialogRoot v-bind="forwarded">
|
|
17
|
+
<slot />
|
|
18
|
+
</DialogRoot>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DialogCloseProps } from 'reka-ui';
|
|
3
|
+
import { DialogClose } from 'reka-ui';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UnnnicDialogClose',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<DialogCloseProps>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<DialogClose
|
|
14
|
+
class="unnnic-dialog-close"
|
|
15
|
+
v-bind="props"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</DialogClose>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<style lang="scss" scoped>
|
|
22
|
+
@use '@/assets/scss/unnnic' as *;
|
|
23
|
+
|
|
24
|
+
.unnnic-dialog-close {
|
|
25
|
+
> * {
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</style>
|