@weni/unnnic-system 3.12.8-alpha.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/{es-52edeb71.mjs → es-41fceca9.mjs} +1 -1
- package/dist/{index-756fe685.mjs → index-cca96b43.mjs} +26458 -29323
- package/dist/index.d.ts +1652 -4902
- package/dist/{pt-br-24583c8c.mjs → pt-br-a3088529.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +204 -232
- 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/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/FormElement/FormElement.vue +1 -1
- package/src/components/Input/Input.scss +2 -0
- 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/Radio/Radio.vue +1 -1
- package/src/components/Select/index.vue +3 -3
- package/src/components/Switch/Switch.vue +1 -1
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -3
- package/src/components/TemplatePreview/TemplatePreview.vue +2 -2
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +1 -1
- 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 +2 -58
- package/src/components/ui/popover/PopoverContent.vue +4 -5
- package/src/components/ui/popover/PopoverTrigger.vue +1 -5
- package/src/stories/Drawer.stories.js +1 -1
- package/src/stories/ModalDialog.mdx +0 -3
- package/src/stories/ModalDialog.stories.js +1 -1
- package/src/stories/MultiSelect.stories.js +45 -143
- package/src/components/MultiSelect/MultSelectOption.vue +0 -49
- package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +0 -557
- 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 -265
- 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
|
@@ -3,380 +3,102 @@ import { mount } from '@vue/test-utils';
|
|
|
3
3
|
|
|
4
4
|
import ToolTip from '../ToolTip.vue';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
});
|
|
6
|
+
const createWrapper = (props) => {
|
|
7
|
+
return mount(ToolTip, { props });
|
|
26
8
|
};
|
|
27
9
|
|
|
28
10
|
describe('ToolTip', () => {
|
|
29
11
|
let wrapper;
|
|
30
|
-
|
|
31
12
|
beforeEach(() => {
|
|
32
|
-
wrapper = createWrapper({ text: '
|
|
13
|
+
wrapper = createWrapper({ text: 'Text', enabled: true });
|
|
33
14
|
});
|
|
34
15
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
it('should not display the tooltip when enabled is false', async () => {
|
|
17
|
+
await wrapper.setProps({ enabled: false });
|
|
18
|
+
const tooltipLabel = wrapper.find('[data-testid="tooltip-label"]');
|
|
19
|
+
expect(tooltipLabel.isVisible()).toBe(false);
|
|
39
20
|
});
|
|
40
21
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
});
|
|
22
|
+
it('should display the tooltip when enabled is true', async () => {
|
|
23
|
+
const tooltipLabel = wrapper.find('[data-testid="tooltip-label"]');
|
|
24
|
+
expect(tooltipLabel.isVisible()).toBe(true);
|
|
69
25
|
});
|
|
70
26
|
|
|
71
|
-
|
|
72
|
-
|
|
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');
|
|
27
|
+
it('should force open the tooltip when forceOpen is true', async () => {
|
|
28
|
+
await wrapper.setProps({ enabled: false, forceOpen: true });
|
|
112
29
|
|
|
113
|
-
|
|
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
|
-
});
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
describe('Boolean Props', () => {
|
|
129
|
-
it('should handle enabled false', () => {
|
|
130
|
-
const disabledWrapper = createWrapper({
|
|
131
|
-
text: 'Text',
|
|
132
|
-
enabled: false,
|
|
133
|
-
});
|
|
134
|
-
|
|
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
|
-
});
|
|
30
|
+
const tooltipLabel = wrapper.find('[data-testid="tooltip-label"]');
|
|
31
|
+
expect(tooltipLabel.isVisible()).toBe(true);
|
|
155
32
|
});
|
|
156
33
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const plainWrapper = createWrapper({
|
|
160
|
-
text: 'Simple tooltip text',
|
|
161
|
-
enabled: true,
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
expect(plainWrapper.vm.$props.text).toBe('Simple tooltip text');
|
|
34
|
+
it('should position the tooltip correctly based on the side prop', async () => {
|
|
35
|
+
const sideValues = ['top', 'right', 'bottom', 'left'];
|
|
165
36
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
text: 'First line\nSecond line\nThird line',
|
|
172
|
-
enabled: true,
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
expect(multilineWrapper.vm.$props.text).toBe(
|
|
176
|
-
'First line\nSecond line\nThird line',
|
|
177
|
-
);
|
|
178
|
-
|
|
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
|
-
});
|
|
190
|
-
});
|
|
191
|
-
|
|
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
|
-
);
|
|
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
|
-
});
|
|
37
|
+
for (let side of sideValues) {
|
|
38
|
+
await wrapper.setProps({ side });
|
|
39
|
+
const tooltipLabel = wrapper.find('[data-testid="tooltip-label"]');
|
|
40
|
+
expect(tooltipLabel.classes()).include(`unnnic-tooltip-label-${side}`);
|
|
41
|
+
}
|
|
254
42
|
});
|
|
255
43
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const sides = ['top', 'right', 'bottom', 'left'];
|
|
44
|
+
it('should split tooltip text into multiple lines', async () => {
|
|
45
|
+
await wrapper.setProps({ text: 'First line\nSecond line' });
|
|
259
46
|
|
|
260
|
-
|
|
261
|
-
const sideWrapper = createWrapper({
|
|
262
|
-
text: 'Text',
|
|
263
|
-
enabled: true,
|
|
264
|
-
side,
|
|
265
|
-
});
|
|
47
|
+
const tooltipLabel = wrapper.find('[data-testid="tooltip-label"]');
|
|
266
48
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
});
|
|
270
|
-
expect(tooltipContent.exists()).toBe(true);
|
|
271
|
-
expect(tooltipContent.props('side')).toBe(side);
|
|
49
|
+
expect(tooltipLabel.text()).toContain('First line');
|
|
50
|
+
expect(tooltipLabel.text()).toContain('Second line');
|
|
272
51
|
|
|
273
|
-
|
|
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
|
-
});
|
|
52
|
+
const brElements = tooltipLabel.findAll('br');
|
|
53
|
+
expect(brElements.length).toBe(2);
|
|
282
54
|
});
|
|
283
55
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const validator = wrapper.vm.$options.props.side.validator;
|
|
56
|
+
it('should display shortcutText when provided', async () => {
|
|
57
|
+
await wrapper.setProps({ shortcutText: 'Ctrl+C' });
|
|
287
58
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
});
|
|
59
|
+
const tooltipShortcut = wrapper.find(
|
|
60
|
+
'[data-testid="tooltip-label-shortcut"]',
|
|
61
|
+
);
|
|
62
|
+
expect(tooltipShortcut.exists()).toBe(true);
|
|
63
|
+
expect(tooltipShortcut.text()).toBe('Ctrl+C');
|
|
294
64
|
});
|
|
295
65
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const defaultWrapper = createWrapper();
|
|
66
|
+
it('should calculate tooltip position based on element coordinates', async () => {
|
|
67
|
+
await wrapper.setProps({ side: 'right' });
|
|
299
68
|
|
|
300
|
-
|
|
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);
|
|
69
|
+
await wrapper.vm.$nextTick();
|
|
306
70
|
|
|
307
|
-
|
|
308
|
-
|
|
71
|
+
expect(wrapper.vm.leftPos).toBeDefined();
|
|
72
|
+
expect(wrapper.vm.topPos).toBeDefined();
|
|
309
73
|
});
|
|
310
74
|
|
|
311
|
-
|
|
312
|
-
|
|
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
|
-
});
|
|
75
|
+
it('should remove event listeners on unmount', () => {
|
|
76
|
+
const removeEventListenerSpy = vi.spyOn(window, 'removeEventListener');
|
|
333
77
|
|
|
334
|
-
|
|
78
|
+
wrapper.unmount();
|
|
335
79
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
80
|
+
expect(removeEventListenerSpy).toHaveBeenCalledWith(
|
|
81
|
+
'scroll',
|
|
82
|
+
expect.any(Function),
|
|
83
|
+
);
|
|
84
|
+
expect(removeEventListenerSpy).toHaveBeenCalledWith(
|
|
85
|
+
'resize',
|
|
86
|
+
expect.any(Function),
|
|
87
|
+
);
|
|
339
88
|
});
|
|
340
89
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
});
|
|
90
|
+
it('should call handleResize on mouseover event', async () => {
|
|
91
|
+
const handlResizeSpy = vi.spyOn(wrapper.vm, 'handleResize');
|
|
92
|
+
await wrapper.trigger('mouseover');
|
|
93
|
+
expect(handlResizeSpy).toHaveBeenCalled();
|
|
352
94
|
});
|
|
353
95
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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();
|
|
96
|
+
it('should render html link variation', async () => {
|
|
97
|
+
await wrapper.setProps({
|
|
98
|
+
enableHtml: true,
|
|
99
|
+
text: 'tooltip with <a data-testid="weni-link" href="https://weni.ai/" target="_blank" style="color: white;">weni</a> link',
|
|
380
100
|
});
|
|
101
|
+
const link = wrapper.find('a[data-testid="weni-link"]');
|
|
102
|
+
expect(link.exists()).toBeTruthy();
|
|
381
103
|
});
|
|
382
104
|
});
|
package/src/components/index.ts
CHANGED
|
@@ -37,7 +37,7 @@ import selectSmart from './SelectSmart/SelectSmart.vue';
|
|
|
37
37
|
import select from './Select/index.vue';
|
|
38
38
|
import selectItem from './Select/SelectItem.vue';
|
|
39
39
|
// import selectListItem from './SelectListItem/SelectListItem.vue';
|
|
40
|
-
import multiSelect from './MultiSelect/
|
|
40
|
+
import multiSelect from './MultiSelect/MultiSelect.vue';
|
|
41
41
|
import alert from './Alert/Alert.vue';
|
|
42
42
|
// import autocomplete from './Input/Autocomplete.vue';
|
|
43
43
|
// import autocompleteSelect from './AutocompleteSelect/AutocompleteSelect.vue';
|
|
@@ -112,20 +112,6 @@ import {
|
|
|
112
112
|
SegmentedControlContent,
|
|
113
113
|
} from './ui/segmented-control';
|
|
114
114
|
import PageHeader from './PageHeader/PageHeader.vue';
|
|
115
|
-
import Dialog from './ui/dialog/Dialog.vue';
|
|
116
|
-
import DialogContent from './ui/dialog/DialogContent.vue';
|
|
117
|
-
import DialogFooter from './ui/dialog/DialogFooter.vue';
|
|
118
|
-
import DialogHeader from './ui/dialog/DialogHeader.vue';
|
|
119
|
-
import DialogTitle from './ui/dialog/DialogTitle.vue';
|
|
120
|
-
import DialogTrigger from './ui/dialog/DialogTrigger.vue';
|
|
121
|
-
import DialogClose from './ui/dialog/DialogClose.vue';
|
|
122
|
-
import DrawerNext from './ui/drawer/Drawer.vue';
|
|
123
|
-
import DrawerContent from './ui/drawer/DrawerContent.vue';
|
|
124
|
-
import DrawerHeader from './ui/drawer/DrawerHeader.vue';
|
|
125
|
-
import DrawerFooter from './ui/drawer/DrawerFooter.vue';
|
|
126
|
-
import DrawerClose from './ui/drawer/DrawerClose.vue';
|
|
127
|
-
import DrawerTitle from './ui/drawer/DrawerTitle.vue';
|
|
128
|
-
import DrawerDescription from './ui/drawer/DrawerDescription.vue';
|
|
129
115
|
|
|
130
116
|
type VueComponent = Component;
|
|
131
117
|
|
|
@@ -173,7 +159,7 @@ export const components: ComponentsMap = {
|
|
|
173
159
|
unnnicSelect: select,
|
|
174
160
|
unnnicSelectItem: selectItem,
|
|
175
161
|
// unnnicSelectListItem: selectListItem,
|
|
176
|
-
unnnicMultiSelect: multiSelect
|
|
162
|
+
unnnicMultiSelect: multiSelect,
|
|
177
163
|
unnnicAlert: alert,
|
|
178
164
|
unnnicCallAlert: callAlert,
|
|
179
165
|
unnnicCallModal: callModal,
|
|
@@ -246,20 +232,6 @@ export const components: ComponentsMap = {
|
|
|
246
232
|
unnnicSegmentedControlTrigger: SegmentedControlTrigger,
|
|
247
233
|
unnnicSegmentedControlContent: SegmentedControlContent,
|
|
248
234
|
unnnicPageHeader: PageHeader,
|
|
249
|
-
unnnicDialog: Dialog,
|
|
250
|
-
unnnicDialogContent: DialogContent,
|
|
251
|
-
unnnicDialogFooter: DialogFooter,
|
|
252
|
-
unnnicDialogHeader: DialogHeader,
|
|
253
|
-
unnnicDialogTitle: DialogTitle,
|
|
254
|
-
unnnicDialogTrigger: DialogTrigger,
|
|
255
|
-
unnnicDialogClose: DialogClose,
|
|
256
|
-
unnnicDrawerNext: DrawerNext,
|
|
257
|
-
unnnicDrawerContent: DrawerContent,
|
|
258
|
-
unnnicDrawerHeader: DrawerHeader,
|
|
259
|
-
unnnicDrawerFooter: DrawerFooter,
|
|
260
|
-
unnnicDrawerClose: DrawerClose,
|
|
261
|
-
unnnicDrawerTitle: DrawerTitle,
|
|
262
|
-
unnnicDrawerDescription: DrawerDescription,
|
|
263
235
|
};
|
|
264
236
|
|
|
265
237
|
export const unnnicFontSize = fontSize;
|
|
@@ -375,20 +347,6 @@ export const unnnicSegmentedControlList = SegmentedControlList;
|
|
|
375
347
|
export const unnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
376
348
|
export const unnnicSegmentedControlContent = SegmentedControlContent;
|
|
377
349
|
export const unnnicPageHeader = PageHeader;
|
|
378
|
-
export const unnnicDialog = Dialog;
|
|
379
|
-
export const unnnicDialogContent = DialogContent;
|
|
380
|
-
export const unnnicDialogFooter = DialogFooter;
|
|
381
|
-
export const unnnicDialogHeader = DialogHeader;
|
|
382
|
-
export const unnnicDialogTitle = DialogTitle;
|
|
383
|
-
export const unnnicDialogTrigger = DialogTrigger;
|
|
384
|
-
export const unnnicDialogClose = DialogClose;
|
|
385
|
-
export const unnnicDrawerNext = DrawerNext;
|
|
386
|
-
export const unnnicDrawerContent = DrawerContent;
|
|
387
|
-
export const unnnicDrawerHeader = DrawerHeader;
|
|
388
|
-
export const unnnicDrawerFooter = DrawerFooter;
|
|
389
|
-
export const unnnicDrawerClose = DrawerClose;
|
|
390
|
-
export const unnnicDrawerTitle = DrawerTitle;
|
|
391
|
-
export const unnnicDrawerDescription = DrawerDescription;
|
|
392
350
|
|
|
393
351
|
export const UnnnicFontSize = fontSize;
|
|
394
352
|
export const UnnnicFormElement = formElement;
|
|
@@ -503,17 +461,3 @@ export const UnnnicSegmentedControlList = SegmentedControlList;
|
|
|
503
461
|
export const UnnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
504
462
|
export const UnnnicSegmentedControlContent = SegmentedControlContent;
|
|
505
463
|
export const UnnnicPageHeader = PageHeader;
|
|
506
|
-
export const UnnnicDialog = Dialog;
|
|
507
|
-
export const UnnnicDialogContent = DialogContent;
|
|
508
|
-
export const UnnnicDialogFooter = DialogFooter;
|
|
509
|
-
export const UnnnicDialogHeader = DialogHeader;
|
|
510
|
-
export const UnnnicDialogTitle = DialogTitle;
|
|
511
|
-
export const UnnnicDialogTrigger = DialogTrigger;
|
|
512
|
-
export const UnnnicDialogClose = DialogClose;
|
|
513
|
-
export const UnnnicDrawerNext = DrawerNext;
|
|
514
|
-
export const UnnnicDrawerContent = DrawerContent;
|
|
515
|
-
export const UnnnicDrawerHeader = DrawerHeader;
|
|
516
|
-
export const UnnnicDrawerFooter = DrawerFooter;
|
|
517
|
-
export const UnnnicDrawerClose = DrawerClose;
|
|
518
|
-
export const UnnnicDrawerTitle = DrawerTitle;
|
|
519
|
-
export const UnnnicDrawerDescription = DrawerDescription;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<PopoverPortal>
|
|
3
3
|
<PopoverContent
|
|
4
4
|
v-bind="{ ...forwarded, ...$attrs }"
|
|
5
|
-
:style="{ width: contentWidth
|
|
5
|
+
:style="{ width: contentWidth }"
|
|
6
6
|
:class="
|
|
7
7
|
cn(
|
|
8
8
|
'unnnic-popover',
|
|
@@ -34,7 +34,6 @@ import { computed, useSlots } from 'vue';
|
|
|
34
34
|
import { reactiveOmit } from '@vueuse/core';
|
|
35
35
|
import { PopoverContent, PopoverPortal, useForwardPropsEmits } from 'reka-ui';
|
|
36
36
|
import { cn } from '@/lib/utils';
|
|
37
|
-
import { useLayerZIndex } from '@/lib/layer-manager';
|
|
38
37
|
|
|
39
38
|
defineOptions({
|
|
40
39
|
inheritAttrs: false,
|
|
@@ -64,8 +63,6 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
64
63
|
|
|
65
64
|
const slots = useSlots() as Slots;
|
|
66
65
|
|
|
67
|
-
const popoverZIndex = useLayerZIndex('popover');
|
|
68
|
-
|
|
69
66
|
const getComponentName = (vnode: VNode): string | undefined => {
|
|
70
67
|
const componentType = vnode.type as { name?: string; __name?: string };
|
|
71
68
|
return componentType?.name || componentType?.__name;
|
|
@@ -104,12 +101,14 @@ const contentWidth = computed(() => {
|
|
|
104
101
|
$popover-space: $unnnic-space-4;
|
|
105
102
|
|
|
106
103
|
.unnnic-popover {
|
|
104
|
+
z-index: 10000;
|
|
105
|
+
|
|
107
106
|
border-radius: $unnnic-radius-2;
|
|
108
107
|
box-shadow: $unnnic-shadow-1;
|
|
109
108
|
border: 1px solid $unnnic-color-border-soft;
|
|
110
109
|
|
|
111
110
|
&::-webkit-scrollbar {
|
|
112
|
-
width: $unnnic-
|
|
111
|
+
width: $unnnic-space-1;
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
&::-webkit-scrollbar-thumb {
|
|
@@ -14,14 +14,10 @@ const props = defineProps<PopoverTriggerProps>();
|
|
|
14
14
|
</PopoverTrigger>
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
|
-
<style
|
|
17
|
+
<style scoped>
|
|
18
18
|
.unnnic-popover-trigger {
|
|
19
19
|
border: none;
|
|
20
20
|
background: transparent;
|
|
21
21
|
padding: 0;
|
|
22
|
-
|
|
23
|
-
& > * {
|
|
24
|
-
width: 100%;
|
|
25
|
-
}
|
|
26
22
|
}
|
|
27
23
|
</style>
|
|
@@ -6,9 +6,6 @@ import * as ModalDialogStories from './ModalDialog.stories';
|
|
|
6
6
|
|
|
7
7
|
# ModalDialog
|
|
8
8
|
|
|
9
|
-
> **⚠️ DEPRECATED**: This component has been deprecated in favor of the new `Dialog` component. Please use `UnnnicDialog`
|
|
10
|
-
instead for new implementations. See the [Dialog documentation](?path=/docs/feedback-dialog--docs) for more information.
|
|
11
|
-
|
|
12
9
|
The ModalDialog was designed to inform the user about a specific task, request information, or involve other tasks.
|
|
13
10
|
|
|
14
11
|
<Source
|