@weni/unnnic-system 3.11.0 → 3.11.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +109 -18
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +218 -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 +120 -29
- package/dist/components/Card/CardCompany.vue.d.ts +2 -2
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +110 -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 +109 -18
- package/dist/components/Card/StatusCard.vue.d.ts +1 -1
- package/dist/components/Card/TitleCard.vue.d.ts +109 -18
- package/dist/components/CardImage/CardImage.vue.d.ts +5 -5
- package/dist/components/CardInformation/CardInformation.vue.d.ts +110 -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 +115 -24
- package/dist/components/ChartLine/ChartLine.vue.d.ts +109 -18
- package/dist/components/ChatText/ChatText.vue.d.ts +109 -18
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +6 -6
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +109 -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 +109 -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 +10 -10
- package/dist/components/DatePicker/DatePicker.vue.d.ts +6 -6
- package/dist/components/Drawer/Drawer.vue.d.ts +35 -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 +4 -4
- package/dist/components/ImportCard/ImportCard.vue.d.ts +6 -6
- package/dist/components/Input/Input.vue.d.ts +9 -9
- package/dist/components/Input/TextInput.vue.d.ts +2 -2
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +15 -15
- package/dist/components/InputNext/InputNext.vue.d.ts +3 -3
- 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 +15 -15
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +12 -12
- package/dist/components/MoodRating/MoodRating.vue.d.ts +109 -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/SelectSmart/SelectSmart.vue.d.ts +11 -11
- 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 +3 -3
- package/dist/components/Slider/Slider.vue.d.ts +109 -18
- package/dist/components/Switch/Switch.vue.d.ts +2 -2
- package/dist/components/Tab/Tab.vue.d.ts +109 -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 +5 -5
- package/dist/components/Toast/Toast.vue.d.ts +1 -1
- package/dist/components/ToolTip/ToolTip.vue.d.ts +109 -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/index.d.ts +5624 -1762
- package/dist/components/index.d.ts.map +1 -1
- 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 +42 -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/segmented-control/SegmentedControlList.vue.d.ts +26 -0
- package/dist/components/ui/segmented-control/SegmentedControlList.vue.d.ts.map +1 -0
- package/dist/components/ui/segmented-control/SegmentedControlTrigger.vue.d.ts +24 -0
- package/dist/components/ui/segmented-control/SegmentedControlTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/segmented-control/index.d.ts +5 -0
- package/dist/components/ui/segmented-control/index.d.ts.map +1 -0
- package/dist/components/ui/tabs/TabsTrigger.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/TooltipProvider.vue.d.ts +19 -0
- package/dist/components/ui/tooltip/TooltipProvider.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 +5 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -0
- package/dist/{es-e3248052.mjs → es-1e5cce64.mjs} +1 -1
- package/dist/{index-f67d5b30.mjs → index-8d75623f.mjs} +99639 -96793
- package/dist/{pt-br-f6f53acd.mjs → pt-br-defd03da.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +232 -196
- package/dist/unnnic.umd.js +48 -44
- package/package.json +2 -1
- package/src/assets/scss/tailwind.scss +8 -0
- package/src/components/Drawer/Drawer.vue +174 -271
- package/src/components/Drawer/__tests__/Drawer.spec.js +32 -43
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
- package/src/components/ModalDialog/ModalDialog.vue +62 -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/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
- package/src/components/ToolTip/ToolTip.vue +41 -188
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +345 -61
- package/src/components/index.ts +86 -12
- package/src/components/ui/dialog/Dialog.vue +15 -0
- package/src/components/ui/dialog/DialogClose.vue +25 -0
- package/src/components/ui/dialog/DialogContent.vue +133 -0
- package/src/components/ui/dialog/DialogFooter.vue +46 -0
- package/src/components/ui/dialog/DialogHeader.vue +79 -0
- package/src/components/ui/dialog/DialogTitle.vue +34 -0
- package/src/components/ui/dialog/DialogTrigger.vue +12 -0
- package/src/components/ui/dialog/index.ts +7 -0
- package/src/components/ui/drawer/Drawer.vue +23 -0
- package/src/components/ui/drawer/DrawerClose.vue +33 -0
- package/src/components/ui/drawer/DrawerContent.vue +98 -0
- package/src/components/ui/drawer/DrawerDescription.vue +36 -0
- package/src/components/ui/drawer/DrawerFooter.vue +34 -0
- package/src/components/ui/drawer/DrawerHeader.vue +53 -0
- package/src/components/ui/drawer/DrawerOverlay.vue +30 -0
- package/src/components/ui/drawer/DrawerTitle.vue +33 -0
- package/src/components/ui/drawer/DrawerTrigger.vue +27 -0
- package/src/components/ui/drawer/index.ts +10 -0
- package/src/components/ui/segmented-control/SegmentedControlList.vue +51 -0
- package/src/components/ui/segmented-control/SegmentedControlTrigger.vue +81 -0
- package/src/components/ui/segmented-control/index.ts +4 -0
- package/src/components/ui/tabs/TabsTrigger.vue +4 -20
- package/src/components/ui/tooltip/Tooltip.vue +15 -0
- package/src/components/ui/tooltip/TooltipContent.vue +73 -0
- package/src/components/ui/tooltip/TooltipProvider.vue +15 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +22 -0
- package/src/components/ui/tooltip/index.ts +4 -0
- package/src/stories/Dialog.stories.js +832 -0
- package/src/stories/Drawer.stories.js +1 -1
- package/src/stories/DrawerNext.stories.js +610 -0
- package/src/stories/ModalDialog.mdx +3 -0
- package/src/stories/ModalDialog.stories.js +1 -1
- package/src/stories/SegmentedControl.stories.js +253 -0
- package/src/stories/Tabs.stories.js +1 -1
|
@@ -3,102 +3,386 @@ 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');
|
|
46
165
|
|
|
47
|
-
|
|
166
|
+
plainWrapper.unmount();
|
|
167
|
+
});
|
|
168
|
+
|
|
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
|
+
});
|
|
199
|
+
|
|
200
|
+
expect(htmlWrapper.vm.$props.enableHtml).toBe(true);
|
|
201
|
+
expect(htmlWrapper.vm.$props.text).toBe(
|
|
202
|
+
'Tooltip with <strong>bold</strong> text',
|
|
203
|
+
);
|
|
58
204
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
});
|
|
64
236
|
});
|
|
65
237
|
|
|
66
|
-
|
|
67
|
-
|
|
238
|
+
describe('Component Structure', () => {
|
|
239
|
+
it('should have TooltipProvider component', () => {
|
|
240
|
+
expect(wrapper.findComponent({ name: 'TooltipProvider' }).exists()).toBe(
|
|
241
|
+
true,
|
|
242
|
+
);
|
|
243
|
+
});
|
|
68
244
|
|
|
69
|
-
|
|
245
|
+
it('should have Tooltip component', () => {
|
|
246
|
+
expect(wrapper.findComponent({ name: 'Tooltip' }).exists()).toBe(true);
|
|
247
|
+
});
|
|
70
248
|
|
|
71
|
-
|
|
72
|
-
|
|
249
|
+
it('should have TooltipTrigger component', () => {
|
|
250
|
+
expect(wrapper.findComponent({ name: 'TooltipTrigger' }).exists()).toBe(
|
|
251
|
+
true,
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should have TooltipContent component', () => {
|
|
256
|
+
expect(wrapper.findComponent({ name: 'TooltipContent' }).exists()).toBe(
|
|
257
|
+
true,
|
|
258
|
+
);
|
|
259
|
+
});
|
|
73
260
|
});
|
|
74
261
|
|
|
75
|
-
|
|
76
|
-
|
|
262
|
+
describe('CSS Classes', () => {
|
|
263
|
+
it('should pass side prop to TooltipContent', () => {
|
|
264
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
265
|
+
|
|
266
|
+
sides.forEach((side) => {
|
|
267
|
+
const sideWrapper = createWrapper({
|
|
268
|
+
text: 'Text',
|
|
269
|
+
enabled: true,
|
|
270
|
+
side,
|
|
271
|
+
});
|
|
77
272
|
|
|
78
|
-
|
|
273
|
+
const tooltipContent = sideWrapper.findComponent({
|
|
274
|
+
name: 'TooltipContent',
|
|
275
|
+
});
|
|
276
|
+
expect(tooltipContent.exists()).toBe(true);
|
|
277
|
+
expect(tooltipContent.props('side')).toBe(side);
|
|
79
278
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
'
|
|
86
|
-
expect.
|
|
87
|
-
|
|
279
|
+
sideWrapper.unmount();
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('should pass class prop to TooltipContent component', () => {
|
|
284
|
+
const tooltipContent = wrapper.findComponent({ name: 'TooltipContent' });
|
|
285
|
+
expect(tooltipContent.exists()).toBe(true);
|
|
286
|
+
expect(tooltipContent.props('class')).toContain('unnnic-tooltip-label');
|
|
287
|
+
});
|
|
88
288
|
});
|
|
89
289
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
290
|
+
describe('Side Validator', () => {
|
|
291
|
+
it('should validate side prop correctly', () => {
|
|
292
|
+
const validator = wrapper.vm.$options.props.side.validator;
|
|
293
|
+
|
|
294
|
+
expect(validator('top')).toBe(true);
|
|
295
|
+
expect(validator('right')).toBe(true);
|
|
296
|
+
expect(validator('bottom')).toBe(true);
|
|
297
|
+
expect(validator('left')).toBe(true);
|
|
298
|
+
expect(validator('invalid')).toBe(false);
|
|
299
|
+
});
|
|
94
300
|
});
|
|
95
301
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
302
|
+
describe('Props Defaults', () => {
|
|
303
|
+
it('should have correct default values', () => {
|
|
304
|
+
const defaultWrapper = createWrapper();
|
|
305
|
+
|
|
306
|
+
expect(defaultWrapper.vm.$props.text).toBe('');
|
|
307
|
+
expect(defaultWrapper.vm.$props.enabled).toBe(false);
|
|
308
|
+
expect(defaultWrapper.vm.$props.forceOpen).toBe(false);
|
|
309
|
+
expect(defaultWrapper.vm.$props.side).toBe('right');
|
|
310
|
+
expect(defaultWrapper.vm.$props.maxWidth).toBe('');
|
|
311
|
+
expect(defaultWrapper.vm.$props.enableHtml).toBe(false);
|
|
312
|
+
|
|
313
|
+
defaultWrapper.unmount();
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
describe('Max Width Style', () => {
|
|
318
|
+
it('should pass maxWidth prop to TooltipContent', () => {
|
|
319
|
+
const maxWidthWrapper = createWrapper({
|
|
320
|
+
text: 'Text',
|
|
321
|
+
enabled: true,
|
|
322
|
+
maxWidth: '250px',
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
expect(maxWidthWrapper.vm.$props.maxWidth).toBe('250px');
|
|
326
|
+
|
|
327
|
+
maxWidthWrapper.unmount();
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('should handle different maxWidth values', () => {
|
|
331
|
+
const values = ['100px', '50%', '20rem', '300px'];
|
|
332
|
+
|
|
333
|
+
values.forEach((maxWidth) => {
|
|
334
|
+
const testWrapper = createWrapper({
|
|
335
|
+
text: 'Text',
|
|
336
|
+
enabled: true,
|
|
337
|
+
maxWidth,
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
expect(testWrapper.vm.$props.maxWidth).toBe(maxWidth);
|
|
341
|
+
|
|
342
|
+
testWrapper.unmount();
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
describe('Component Props Types', () => {
|
|
348
|
+
it('should have correct prop types', () => {
|
|
349
|
+
const { props } = wrapper.vm.$options;
|
|
350
|
+
|
|
351
|
+
expect(props.text.type).toBe(String);
|
|
352
|
+
expect(props.enabled.type).toBe(Boolean);
|
|
353
|
+
expect(props.forceOpen.type).toBe(Boolean);
|
|
354
|
+
expect(props.side.type).toBe(String);
|
|
355
|
+
expect(props.maxWidth.type).toBe(String);
|
|
356
|
+
expect(props.enableHtml.type).toBe(Boolean);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
describe('Enabled and ForceOpen Logic', () => {
|
|
361
|
+
it('should be disabled when enabled is false and forceOpen is false', () => {
|
|
362
|
+
const disabledWrapper = createWrapper({
|
|
363
|
+
text: 'Text',
|
|
364
|
+
enabled: false,
|
|
365
|
+
forceOpen: false,
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
expect(disabledWrapper.vm.$props.enabled).toBe(false);
|
|
369
|
+
expect(disabledWrapper.vm.$props.forceOpen).toBe(false);
|
|
370
|
+
|
|
371
|
+
disabledWrapper.unmount();
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
it('should override disabled state when forceOpen is true', () => {
|
|
375
|
+
const forceOpenWrapper = createWrapper({
|
|
376
|
+
text: 'Text',
|
|
377
|
+
enabled: false,
|
|
378
|
+
forceOpen: true,
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
expect(forceOpenWrapper.vm.$props.enabled).toBe(false);
|
|
382
|
+
expect(forceOpenWrapper.vm.$props.forceOpen).toBe(true);
|
|
383
|
+
expect(forceOpenWrapper.html()).toContain('unnnic-tooltip');
|
|
384
|
+
|
|
385
|
+
forceOpenWrapper.unmount();
|
|
100
386
|
});
|
|
101
|
-
const link = wrapper.find('a[data-testid="weni-link"]');
|
|
102
|
-
expect(link.exists()).toBeTruthy();
|
|
103
387
|
});
|
|
104
388
|
});
|
package/src/components/index.ts
CHANGED
|
@@ -93,17 +93,37 @@ import DataTable from './DataTable/index.vue';
|
|
|
93
93
|
import Chip from './Chip/Chip.vue';
|
|
94
94
|
import Toast from './Toast/Toast.vue';
|
|
95
95
|
import { toast } from './Toast/ToastManager';
|
|
96
|
+
import Tabs from './ui/tabs/Tabs.vue';
|
|
97
|
+
import TabsList from './ui/tabs/TabsList.vue';
|
|
98
|
+
import TabsTrigger from './ui/tabs/TabsTrigger.vue';
|
|
99
|
+
import TabsContent from './ui/tabs/TabsContent.vue';
|
|
100
|
+
import {
|
|
101
|
+
SegmentedControl,
|
|
102
|
+
SegmentedControlList,
|
|
103
|
+
SegmentedControlTrigger,
|
|
104
|
+
SegmentedControlContent,
|
|
105
|
+
} from './ui/segmented-control';
|
|
96
106
|
import Popover from './ui/popover/Popover.vue';
|
|
97
107
|
import PopoverContent from './ui/popover/PopoverContent.vue';
|
|
98
108
|
import PopoverTrigger from './ui/popover/PopoverTrigger.vue';
|
|
99
109
|
import PopoverFooter from './ui/popover/PopoverFooter.vue';
|
|
100
110
|
import TemplatePreview from './TemplatePreview/TemplatePreview.vue';
|
|
101
111
|
import TemplatePreviewModal from './TemplatePreview/TemplatePreviewModal.vue';
|
|
102
|
-
import Tabs from './ui/tabs/Tabs.vue';
|
|
103
|
-
import TabsList from './ui/tabs/TabsList.vue';
|
|
104
|
-
import TabsTrigger from './ui/tabs/TabsTrigger.vue';
|
|
105
|
-
import TabsContent from './ui/tabs/TabsContent.vue';
|
|
106
112
|
import PageHeader from './PageHeader/PageHeader.vue';
|
|
113
|
+
import Dialog from './ui/dialog/Dialog.vue';
|
|
114
|
+
import DialogContent from './ui/dialog/DialogContent.vue';
|
|
115
|
+
import DialogFooter from './ui/dialog/DialogFooter.vue';
|
|
116
|
+
import DialogHeader from './ui/dialog/DialogHeader.vue';
|
|
117
|
+
import DialogTitle from './ui/dialog/DialogTitle.vue';
|
|
118
|
+
import DialogTrigger from './ui/dialog/DialogTrigger.vue';
|
|
119
|
+
import DialogClose from './ui/dialog/DialogClose.vue';
|
|
120
|
+
import DrawerNext from './ui/drawer/Drawer.vue';
|
|
121
|
+
import DrawerContent from './ui/drawer/DrawerContent.vue';
|
|
122
|
+
import DrawerHeader from './ui/drawer/DrawerHeader.vue';
|
|
123
|
+
import DrawerFooter from './ui/drawer/DrawerFooter.vue';
|
|
124
|
+
import DrawerClose from './ui/drawer/DrawerClose.vue';
|
|
125
|
+
import DrawerTitle from './ui/drawer/DrawerTitle.vue';
|
|
126
|
+
import DrawerDescription from './ui/drawer/DrawerDescription.vue';
|
|
107
127
|
|
|
108
128
|
type VueComponent = Component;
|
|
109
129
|
|
|
@@ -217,6 +237,24 @@ export const components: ComponentsMap = {
|
|
|
217
237
|
unnnicTabsTrigger: TabsTrigger,
|
|
218
238
|
unnnicTabsContent: TabsContent,
|
|
219
239
|
unnnicPageHeader: PageHeader,
|
|
240
|
+
unnnicSegmentedControl: SegmentedControl,
|
|
241
|
+
unnnicSegmentedControlList: SegmentedControlList,
|
|
242
|
+
unnnicSegmentedControlTrigger: SegmentedControlTrigger,
|
|
243
|
+
unnnicSegmentedControlContent: SegmentedControlContent,
|
|
244
|
+
unnnicDialog: Dialog,
|
|
245
|
+
unnnicDialogContent: DialogContent,
|
|
246
|
+
unnnicDialogFooter: DialogFooter,
|
|
247
|
+
unnnicDialogHeader: DialogHeader,
|
|
248
|
+
unnnicDialogTitle: DialogTitle,
|
|
249
|
+
unnnicDialogTrigger: DialogTrigger,
|
|
250
|
+
unnnicDialogClose: DialogClose,
|
|
251
|
+
unnnicDrawerNext: DrawerNext,
|
|
252
|
+
unnnicDrawerContent: DrawerContent,
|
|
253
|
+
unnnicDrawerHeader: DrawerHeader,
|
|
254
|
+
unnnicDrawerFooter: DrawerFooter,
|
|
255
|
+
unnnicDrawerClose: DrawerClose,
|
|
256
|
+
unnnicDrawerTitle: DrawerTitle,
|
|
257
|
+
unnnicDrawerDescription: DrawerDescription,
|
|
220
258
|
};
|
|
221
259
|
|
|
222
260
|
export const unnnicFontSize = fontSize;
|
|
@@ -315,17 +353,35 @@ export const unnnicSelectTime = SelectTime as VueComponent;
|
|
|
315
353
|
export const unnnicChip = Chip;
|
|
316
354
|
export const unnnicToast = Toast;
|
|
317
355
|
export const unnnicToastManager = toast;
|
|
356
|
+
export const unnnicTabs = Tabs;
|
|
357
|
+
export const unnnicTabsList = TabsList;
|
|
358
|
+
export const unnnicTabsTrigger = TabsTrigger;
|
|
359
|
+
export const unnnicTabsContent = TabsContent;
|
|
360
|
+
export const unnnicSegmentedControl = SegmentedControl;
|
|
361
|
+
export const unnnicSegmentedControlList = SegmentedControlList;
|
|
362
|
+
export const unnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
363
|
+
export const unnnicSegmentedControlContent = SegmentedControlContent;
|
|
318
364
|
export const unnnicPopover = Popover;
|
|
319
365
|
export const unnnicPopoverContent = PopoverContent;
|
|
320
366
|
export const unnnicPopoverTrigger = PopoverTrigger;
|
|
321
367
|
export const unnnicPopoverFooter = PopoverFooter;
|
|
322
368
|
export const unnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
323
369
|
export const unnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
324
|
-
export const unnnicTabs = Tabs;
|
|
325
|
-
export const unnnicTabsList = TabsList;
|
|
326
|
-
export const unnnicTabsTrigger = TabsTrigger;
|
|
327
|
-
export const unnnicTabsContent = TabsContent;
|
|
328
370
|
export const unnnicPageHeader = PageHeader;
|
|
371
|
+
export const unnnicDialog = Dialog;
|
|
372
|
+
export const unnnicDialogContent = DialogContent;
|
|
373
|
+
export const unnnicDialogFooter = DialogFooter;
|
|
374
|
+
export const unnnicDialogHeader = DialogHeader;
|
|
375
|
+
export const unnnicDialogTitle = DialogTitle;
|
|
376
|
+
export const unnnicDialogTrigger = DialogTrigger;
|
|
377
|
+
export const unnnicDialogClose = DialogClose;
|
|
378
|
+
export const unnnicDrawerNext = DrawerNext;
|
|
379
|
+
export const unnnicDrawerContent = DrawerContent;
|
|
380
|
+
export const unnnicDrawerHeader = DrawerHeader;
|
|
381
|
+
export const unnnicDrawerFooter = DrawerFooter;
|
|
382
|
+
export const unnnicDrawerClose = DrawerClose;
|
|
383
|
+
export const unnnicDrawerTitle = DrawerTitle;
|
|
384
|
+
export const unnnicDrawerDescription = DrawerDescription;
|
|
329
385
|
|
|
330
386
|
export const UnnnicFontSize = fontSize;
|
|
331
387
|
export const UnnnicFormElement = formElement;
|
|
@@ -423,14 +479,32 @@ export const UnnnicSelectTime = SelectTime as VueComponent;
|
|
|
423
479
|
export const UnnnicChip = Chip;
|
|
424
480
|
export const UnnnicToast = Toast;
|
|
425
481
|
export const UnnnicToastManager = toast;
|
|
482
|
+
export const UnnnicTabs = Tabs;
|
|
483
|
+
export const UnnnicTabsList = TabsList;
|
|
484
|
+
export const UnnnicTabsTrigger = TabsTrigger;
|
|
485
|
+
export const UnnnicTabsContent = TabsContent;
|
|
486
|
+
export const UnnnicSegmentedControl = SegmentedControl;
|
|
487
|
+
export const UnnnicSegmentedControlList = SegmentedControlList;
|
|
488
|
+
export const UnnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
489
|
+
export const UnnnicSegmentedControlContent = SegmentedControlContent;
|
|
426
490
|
export const UnnnicPopover = Popover;
|
|
427
491
|
export const UnnnicPopoverContent = PopoverContent;
|
|
428
492
|
export const UnnnicPopoverTrigger = PopoverTrigger;
|
|
429
493
|
export const UnnnicPopoverFooter = PopoverFooter;
|
|
430
494
|
export const UnnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
431
495
|
export const UnnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
432
|
-
export const UnnnicTabs = Tabs;
|
|
433
|
-
export const UnnnicTabsList = TabsList;
|
|
434
|
-
export const UnnnicTabsTrigger = TabsTrigger;
|
|
435
|
-
export const UnnnicTabsContent = TabsContent;
|
|
436
496
|
export const UnnnicPageHeader = PageHeader;
|
|
497
|
+
export const UnnnicDialog = Dialog;
|
|
498
|
+
export const UnnnicDialogContent = DialogContent;
|
|
499
|
+
export const UnnnicDialogFooter = DialogFooter;
|
|
500
|
+
export const UnnnicDialogHeader = DialogHeader;
|
|
501
|
+
export const UnnnicDialogTitle = DialogTitle;
|
|
502
|
+
export const UnnnicDialogTrigger = DialogTrigger;
|
|
503
|
+
export const UnnnicDialogClose = DialogClose;
|
|
504
|
+
export const UnnnicDrawerNext = DrawerNext;
|
|
505
|
+
export const UnnnicDrawerContent = DrawerContent;
|
|
506
|
+
export const UnnnicDrawerHeader = DrawerHeader;
|
|
507
|
+
export const UnnnicDrawerFooter = DrawerFooter;
|
|
508
|
+
export const UnnnicDrawerClose = DrawerClose;
|
|
509
|
+
export const UnnnicDrawerTitle = DrawerTitle;
|
|
510
|
+
export const UnnnicDrawerDescription = DrawerDescription;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DialogRootEmits, DialogRootProps } from 'reka-ui';
|
|
3
|
+
import { DialogRoot, useForwardPropsEmits } from 'reka-ui';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<DialogRootProps>();
|
|
6
|
+
const emits = defineEmits<DialogRootEmits>();
|
|
7
|
+
|
|
8
|
+
const forwarded = useForwardPropsEmits(props, emits);
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<DialogRoot v-bind="forwarded">
|
|
13
|
+
<slot />
|
|
14
|
+
</DialogRoot>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DialogCloseProps } from 'reka-ui';
|
|
3
|
+
import { DialogClose } from 'reka-ui';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<DialogCloseProps>();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<DialogClose
|
|
10
|
+
class="unnnic-dialog-close"
|
|
11
|
+
v-bind="props"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</DialogClose>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<style lang="scss" scoped>
|
|
18
|
+
@use '@/assets/scss/unnnic' as *;
|
|
19
|
+
|
|
20
|
+
.unnnic-dialog-close {
|
|
21
|
+
> * {
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</style>
|