@weni/unnnic-system 3.12.7 → 3.12.8-alpha-teleports.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/README.md +9 -1
- package/dist/{es-c84c6e0c.mjs → es-2f6793d2.mjs} +1 -1
- package/dist/{index-71322a23.mjs → index-799af668.mjs} +99557 -96712
- package/dist/index.d.ts +5001 -1654
- package/dist/{pt-br-f53036d2.mjs → pt-br-f5121b47.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +231 -203
- package/dist/unnnic.umd.js +48 -44
- package/package.json +3 -2
- package/src/assets/scss/tailwind.scss +8 -0
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
- package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +2 -1
- package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +61 -60
- package/src/components/Checkbox/Checkbox.vue +2 -8
- package/src/components/CheckboxGroup/CheckboxGroup.vue +5 -7
- package/src/components/Chip/Chip.vue +1 -1
- package/src/components/DatePicker/DatePicker.vue +11 -1
- package/src/components/Drawer/Drawer.vue +180 -270
- 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/FormElement/FormElement.vue +87 -96
- package/src/components/Input/Input.vue +2 -2
- package/src/components/InputDatePicker/InputDatePicker.vue +68 -73
- package/src/components/InputDatePicker/__test__/InputDatePicker.spec.js +31 -24
- package/src/components/ModalDialog/ModalDialog.vue +63 -154
- package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +30 -210
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
- package/src/components/Radio/Radio.vue +6 -12
- package/src/components/Radio/__test__/Radio.spec.js +1 -3
- package/src/components/RadioGroup/RadioGroup.vue +10 -18
- package/src/components/Switch/Switch.vue +3 -10
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
- package/src/components/TemplatePreview/TemplatePreview.vue +25 -28
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
- package/src/components/TemplatePreview/types.d.ts +3 -3
- package/src/components/Toast/Toast.vue +4 -1
- package/src/components/Toast/ToastManager.ts +4 -1
- package/src/components/Toast/__tests__/ToastManager.spec.js +10 -6
- package/src/components/ToolTip/ToolTip.vue +25 -177
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
- package/src/components/index.ts +56 -0
- 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 +31 -0
- package/src/components/ui/drawer/DrawerContent.vue +113 -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 +33 -11
- package/src/components/ui/popover/PopoverOption.vue +1 -1
- 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 +77 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +24 -0
- package/src/components/ui/tooltip/index.ts +3 -0
- package/src/index.ts +9 -2
- package/src/lib/__tests__/teleport-target.spec.ts +73 -0
- package/src/lib/layer-manager.ts +64 -0
- package/src/lib/teleport-target.ts +46 -0
- 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 +407 -0
- package/src/stories/ModalDialog.mdx +3 -0
- package/src/stories/ModalDialog.stories.js +96 -1
- package/src/stories/Popover.stories.js +5 -0
- package/src/stories/TemplatePreview.stories.js +27 -27
- package/src/stories/TemplatePreviewModal.stories.js +31 -31
- package/.vscode/extensions.json +0 -3
- package/CHANGELOG.md +0 -1080
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import UnnnicButton from '../components/Button/Button.vue';
|
|
3
|
+
import UnnnicToast from '../components/Toast/Toast.vue';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogTrigger,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogHeader,
|
|
10
|
+
DialogTitle,
|
|
11
|
+
DialogFooter,
|
|
12
|
+
DialogClose,
|
|
13
|
+
} from '../components/ui/dialog';
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
Drawer,
|
|
17
|
+
DrawerTrigger,
|
|
18
|
+
DrawerContent,
|
|
19
|
+
DrawerHeader,
|
|
20
|
+
DrawerTitle,
|
|
21
|
+
DrawerDescription,
|
|
22
|
+
DrawerFooter,
|
|
23
|
+
DrawerClose,
|
|
24
|
+
} from '../components/ui/drawer';
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
Popover,
|
|
28
|
+
PopoverTrigger,
|
|
29
|
+
PopoverContent,
|
|
30
|
+
} from '../components/ui/popover';
|
|
31
|
+
|
|
32
|
+
import {
|
|
33
|
+
Tooltip,
|
|
34
|
+
TooltipTrigger,
|
|
35
|
+
TooltipContent,
|
|
36
|
+
} from '../components/ui/tooltip';
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
title: 'Utilities/Layer Manager',
|
|
40
|
+
parameters: {
|
|
41
|
+
docs: {
|
|
42
|
+
description: {
|
|
43
|
+
component:
|
|
44
|
+
'Minimal stories that prove the global layer manager keeps dialogs, drawers, tooltips, popovers and toasts in the right stacking order.',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const DialogWithTooltipAndPopover = {
|
|
51
|
+
name: 'Dialog > Tooltip + Popover',
|
|
52
|
+
render: () => ({
|
|
53
|
+
components: {
|
|
54
|
+
Dialog,
|
|
55
|
+
DialogTrigger,
|
|
56
|
+
DialogContent,
|
|
57
|
+
DialogHeader,
|
|
58
|
+
DialogTitle,
|
|
59
|
+
DialogFooter,
|
|
60
|
+
DialogClose,
|
|
61
|
+
Tooltip,
|
|
62
|
+
TooltipTrigger,
|
|
63
|
+
TooltipContent,
|
|
64
|
+
Popover,
|
|
65
|
+
PopoverTrigger,
|
|
66
|
+
PopoverContent,
|
|
67
|
+
UnnnicButton,
|
|
68
|
+
},
|
|
69
|
+
template: `
|
|
70
|
+
<Dialog>
|
|
71
|
+
<DialogTrigger>
|
|
72
|
+
<UnnnicButton text="Open dialog" type="primary" />
|
|
73
|
+
</DialogTrigger>
|
|
74
|
+
<DialogContent>
|
|
75
|
+
<DialogHeader>
|
|
76
|
+
<DialogTitle>Dialog surface</DialogTitle>
|
|
77
|
+
</DialogHeader>
|
|
78
|
+
|
|
79
|
+
<div style="padding: 24px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;">
|
|
80
|
+
<Tooltip>
|
|
81
|
+
<TooltipTrigger>
|
|
82
|
+
<UnnnicButton text="Tooltip" type="secondary" />
|
|
83
|
+
</TooltipTrigger>
|
|
84
|
+
<TooltipContent>This tooltip should appear above the dialog.</TooltipContent>
|
|
85
|
+
</Tooltip>
|
|
86
|
+
|
|
87
|
+
<Popover>
|
|
88
|
+
<PopoverTrigger>
|
|
89
|
+
<UnnnicButton text="Popover" type="primary" />
|
|
90
|
+
</PopoverTrigger>
|
|
91
|
+
<PopoverContent>
|
|
92
|
+
<section style="padding: 16px;">
|
|
93
|
+
<p style="margin: 0; color: #67738B;">
|
|
94
|
+
Popover content should also float above.
|
|
95
|
+
</p>
|
|
96
|
+
</section>
|
|
97
|
+
</PopoverContent>
|
|
98
|
+
</Popover>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<DialogFooter>
|
|
102
|
+
<DialogClose>
|
|
103
|
+
<UnnnicButton text="Close" type="tertiary" />
|
|
104
|
+
</DialogClose>
|
|
105
|
+
</DialogFooter>
|
|
106
|
+
</DialogContent>
|
|
107
|
+
</Dialog>
|
|
108
|
+
`,
|
|
109
|
+
}),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const DrawerWithTooltipAndPopover = {
|
|
113
|
+
name: 'Drawer > Tooltip + Popover',
|
|
114
|
+
render: () => ({
|
|
115
|
+
components: {
|
|
116
|
+
Drawer,
|
|
117
|
+
DrawerTrigger,
|
|
118
|
+
DrawerContent,
|
|
119
|
+
DrawerHeader,
|
|
120
|
+
DrawerTitle,
|
|
121
|
+
DrawerDescription,
|
|
122
|
+
DrawerFooter,
|
|
123
|
+
DrawerClose,
|
|
124
|
+
Tooltip,
|
|
125
|
+
TooltipTrigger,
|
|
126
|
+
TooltipContent,
|
|
127
|
+
Popover,
|
|
128
|
+
PopoverTrigger,
|
|
129
|
+
PopoverContent,
|
|
130
|
+
UnnnicButton,
|
|
131
|
+
},
|
|
132
|
+
template: `
|
|
133
|
+
<Drawer>
|
|
134
|
+
<DrawerTrigger>
|
|
135
|
+
<UnnnicButton text="Open drawer" type="primary" />
|
|
136
|
+
</DrawerTrigger>
|
|
137
|
+
<DrawerContent>
|
|
138
|
+
<DrawerHeader>
|
|
139
|
+
<DrawerTitle>Drawer surface</DrawerTitle>
|
|
140
|
+
<DrawerDescription>Interact with floating layers.</DrawerDescription>
|
|
141
|
+
</DrawerHeader>
|
|
142
|
+
|
|
143
|
+
<div style="padding: 24px; display: flex; flex-direction: column; gap: 16px;">
|
|
144
|
+
<Tooltip>
|
|
145
|
+
<TooltipTrigger>
|
|
146
|
+
<UnnnicButton text="Tooltip" type="secondary" />
|
|
147
|
+
</TooltipTrigger>
|
|
148
|
+
<TooltipContent>Tooltip should appear above the drawer.</TooltipContent>
|
|
149
|
+
</Tooltip>
|
|
150
|
+
|
|
151
|
+
<Popover>
|
|
152
|
+
<PopoverTrigger>
|
|
153
|
+
<UnnnicButton text="Popover" type="primary" />
|
|
154
|
+
</PopoverTrigger>
|
|
155
|
+
<PopoverContent>
|
|
156
|
+
<section style="padding: 16px;">
|
|
157
|
+
<p style="margin: 0; color: #67738B;">
|
|
158
|
+
Popover content should remain on top too.
|
|
159
|
+
</p>
|
|
160
|
+
</section>
|
|
161
|
+
</PopoverContent>
|
|
162
|
+
</Popover>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<DrawerFooter>
|
|
166
|
+
<DrawerClose>
|
|
167
|
+
<UnnnicButton text="Close drawer" type="tertiary" />
|
|
168
|
+
</DrawerClose>
|
|
169
|
+
</DrawerFooter>
|
|
170
|
+
</DrawerContent>
|
|
171
|
+
</Drawer>
|
|
172
|
+
`,
|
|
173
|
+
}),
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const DrawerNextToDialog = {
|
|
177
|
+
name: 'Drawer > Dialog',
|
|
178
|
+
render: () => ({
|
|
179
|
+
components: {
|
|
180
|
+
Drawer,
|
|
181
|
+
DrawerContent,
|
|
182
|
+
DrawerHeader,
|
|
183
|
+
DrawerTitle,
|
|
184
|
+
DrawerDescription,
|
|
185
|
+
DrawerFooter,
|
|
186
|
+
DrawerClose,
|
|
187
|
+
Dialog,
|
|
188
|
+
DialogContent,
|
|
189
|
+
DialogHeader,
|
|
190
|
+
DialogTitle,
|
|
191
|
+
UnnnicButton,
|
|
192
|
+
},
|
|
193
|
+
setup() {
|
|
194
|
+
const drawerOpen = ref(false);
|
|
195
|
+
const dialogOpen = ref(false);
|
|
196
|
+
return { drawerOpen, dialogOpen };
|
|
197
|
+
},
|
|
198
|
+
template: `
|
|
199
|
+
<div>
|
|
200
|
+
<div style="display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;">
|
|
201
|
+
<UnnnicButton text="Open drawer" type="primary" @click="drawerOpen = true" />
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<Drawer v-model:open="drawerOpen">
|
|
205
|
+
<DrawerContent size="large">
|
|
206
|
+
<DrawerHeader>
|
|
207
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
208
|
+
</DrawerHeader>
|
|
209
|
+
<div style="padding: 24px; color: #67738B; display: grid; gap: 16px;">
|
|
210
|
+
Keep this drawer open and toggle the dialog.
|
|
211
|
+
|
|
212
|
+
<UnnnicButton text="Open dialog" @click="dialogOpen = true" />
|
|
213
|
+
</div>
|
|
214
|
+
</DrawerContent>
|
|
215
|
+
</Drawer>
|
|
216
|
+
|
|
217
|
+
<Dialog v-model:open="dialogOpen">
|
|
218
|
+
<DialogContent>
|
|
219
|
+
<DialogHeader>
|
|
220
|
+
<DialogTitle>Dialog overlay</DialogTitle>
|
|
221
|
+
</DialogHeader>
|
|
222
|
+
<div style="padding: 24px; color: #67738B;">
|
|
223
|
+
This dialog must appear above the drawer and its overlay.
|
|
224
|
+
</div>
|
|
225
|
+
</DialogContent>
|
|
226
|
+
</Dialog>
|
|
227
|
+
</div>
|
|
228
|
+
`,
|
|
229
|
+
}),
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export const DrawerOpenedFromDialog = {
|
|
233
|
+
name: 'Dialog > Drawer',
|
|
234
|
+
render: () => ({
|
|
235
|
+
components: {
|
|
236
|
+
UnnnicButton,
|
|
237
|
+
Dialog,
|
|
238
|
+
DialogContent,
|
|
239
|
+
DialogHeader,
|
|
240
|
+
DialogTitle,
|
|
241
|
+
Drawer,
|
|
242
|
+
DrawerContent,
|
|
243
|
+
DrawerHeader,
|
|
244
|
+
DrawerTitle,
|
|
245
|
+
DrawerDescription,
|
|
246
|
+
},
|
|
247
|
+
setup() {
|
|
248
|
+
const dialogOpen = ref(false);
|
|
249
|
+
const drawerOpen = ref(false);
|
|
250
|
+
return { dialogOpen, drawerOpen };
|
|
251
|
+
},
|
|
252
|
+
template: `
|
|
253
|
+
<div>
|
|
254
|
+
<div style="display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;">
|
|
255
|
+
<UnnnicButton text="Open dialog" type="primary" @click="dialogOpen = true" />
|
|
256
|
+
</div>
|
|
257
|
+
<Dialog v-model:open="dialogOpen">
|
|
258
|
+
<DialogContent>
|
|
259
|
+
<DialogHeader>
|
|
260
|
+
<DialogTitle>Dialog</DialogTitle>
|
|
261
|
+
</DialogHeader>
|
|
262
|
+
<div style="padding: 24px; color: #67738B;">
|
|
263
|
+
<UnnnicButton text="Open drawer" type="primary" @click="drawerOpen = true" />
|
|
264
|
+
</div>
|
|
265
|
+
</DialogContent>
|
|
266
|
+
</Dialog>
|
|
267
|
+
<Drawer v-model:open="drawerOpen">
|
|
268
|
+
<DrawerContent>
|
|
269
|
+
<DrawerHeader>
|
|
270
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
271
|
+
</DrawerHeader>
|
|
272
|
+
<div style="padding: 24px; color: #67738B;">
|
|
273
|
+
Drawer should appear above the dialog.
|
|
274
|
+
</div>
|
|
275
|
+
</DrawerContent>
|
|
276
|
+
</Drawer>
|
|
277
|
+
</div>
|
|
278
|
+
`,
|
|
279
|
+
}),
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export const NestedDialogs = {
|
|
283
|
+
name: 'Dialog nested',
|
|
284
|
+
render: () => ({
|
|
285
|
+
components: {
|
|
286
|
+
Dialog,
|
|
287
|
+
DialogTrigger,
|
|
288
|
+
DialogContent,
|
|
289
|
+
DialogHeader,
|
|
290
|
+
DialogTitle,
|
|
291
|
+
DialogFooter,
|
|
292
|
+
DialogClose,
|
|
293
|
+
Tooltip,
|
|
294
|
+
TooltipTrigger,
|
|
295
|
+
TooltipContent,
|
|
296
|
+
UnnnicButton,
|
|
297
|
+
},
|
|
298
|
+
setup() {
|
|
299
|
+
const parentOpen = ref(false);
|
|
300
|
+
const childOpen = ref(false);
|
|
301
|
+
return { parentOpen, childOpen };
|
|
302
|
+
},
|
|
303
|
+
template: `
|
|
304
|
+
<Dialog v-model:open="parentOpen">
|
|
305
|
+
<DialogTrigger>
|
|
306
|
+
<UnnnicButton text="Open parent dialog" type="primary" />
|
|
307
|
+
</DialogTrigger>
|
|
308
|
+
<DialogContent>
|
|
309
|
+
<DialogHeader>
|
|
310
|
+
<DialogTitle>Parent dialog</DialogTitle>
|
|
311
|
+
</DialogHeader>
|
|
312
|
+
<div style="padding: 24px; display: flex; flex-direction: column; gap: 12px;">
|
|
313
|
+
<p style="margin: 0; color: #67738B;">Open the child dialog to stack overlays.</p>
|
|
314
|
+
<UnnnicButton text="Open child dialog" type="primary" @click="childOpen = true" />
|
|
315
|
+
</div>
|
|
316
|
+
<DialogFooter>
|
|
317
|
+
<DialogClose>
|
|
318
|
+
<UnnnicButton text="Close parent" type="tertiary" />
|
|
319
|
+
</DialogClose>
|
|
320
|
+
</DialogFooter>
|
|
321
|
+
</DialogContent>
|
|
322
|
+
</Dialog>
|
|
323
|
+
|
|
324
|
+
<Dialog v-model:open="childOpen">
|
|
325
|
+
<DialogContent size="small">
|
|
326
|
+
<DialogHeader>
|
|
327
|
+
<DialogTitle>Child dialog</DialogTitle>
|
|
328
|
+
</DialogHeader>
|
|
329
|
+
<div style="padding: 24px; display: flex; flex-direction: column; gap: 8px;">
|
|
330
|
+
<Tooltip>
|
|
331
|
+
<TooltipTrigger>
|
|
332
|
+
<UnnnicButton text="Tooltip here" type="secondary" />
|
|
333
|
+
</TooltipTrigger>
|
|
334
|
+
<TooltipContent>Tooltip stays on top of both dialogs.</TooltipContent>
|
|
335
|
+
</Tooltip>
|
|
336
|
+
</div>
|
|
337
|
+
<DialogFooter>
|
|
338
|
+
<DialogClose>
|
|
339
|
+
<UnnnicButton text="Close child" type="primary" />
|
|
340
|
+
</DialogClose>
|
|
341
|
+
</DialogFooter>
|
|
342
|
+
</DialogContent>
|
|
343
|
+
</Dialog>
|
|
344
|
+
`,
|
|
345
|
+
}),
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export const DialogWithToast = {
|
|
349
|
+
name: 'Dialog > Toast',
|
|
350
|
+
render: () => ({
|
|
351
|
+
components: {
|
|
352
|
+
Dialog,
|
|
353
|
+
DialogContent,
|
|
354
|
+
DialogHeader,
|
|
355
|
+
DialogTitle,
|
|
356
|
+
DialogFooter,
|
|
357
|
+
DialogClose,
|
|
358
|
+
UnnnicToast,
|
|
359
|
+
UnnnicButton,
|
|
360
|
+
},
|
|
361
|
+
setup() {
|
|
362
|
+
const dialogOpen = ref(false);
|
|
363
|
+
const toastVisible = ref(false);
|
|
364
|
+
const toastKey = ref(0);
|
|
365
|
+
|
|
366
|
+
const showToast = () => {
|
|
367
|
+
toastKey.value += 1;
|
|
368
|
+
toastVisible.value = true;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
return { dialogOpen, toastVisible, toastKey, showToast };
|
|
372
|
+
},
|
|
373
|
+
template: `
|
|
374
|
+
<div style="display: flex; gap: 16px;">
|
|
375
|
+
<UnnnicButton text="Open dialog" type="primary" @click="dialogOpen = true" />
|
|
376
|
+
<UnnnicButton text="Show toast" type="secondary" @click="showToast" />
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
<Dialog v-model:open="dialogOpen">
|
|
380
|
+
<DialogContent>
|
|
381
|
+
<DialogHeader>
|
|
382
|
+
<DialogTitle>Dialog layer</DialogTitle>
|
|
383
|
+
</DialogHeader>
|
|
384
|
+
<div style="padding: 24px; color: #67738B;">
|
|
385
|
+
Use the buttons to compare dialog and toast layers.
|
|
386
|
+
</div>
|
|
387
|
+
<DialogFooter>
|
|
388
|
+
<DialogClose>
|
|
389
|
+
<UnnnicButton text="Close dialog" type="tertiary" />
|
|
390
|
+
</DialogClose>
|
|
391
|
+
<UnnnicButton text="Show toast" type="primary" @click="showToast" />
|
|
392
|
+
</DialogFooter>
|
|
393
|
+
</DialogContent>
|
|
394
|
+
</Dialog>
|
|
395
|
+
|
|
396
|
+
<UnnnicToast
|
|
397
|
+
v-if="toastVisible"
|
|
398
|
+
:key="toastKey"
|
|
399
|
+
title="Toast layer"
|
|
400
|
+
description="Toasts should always float above dialogs."
|
|
401
|
+
type="success"
|
|
402
|
+
:timeout="0"
|
|
403
|
+
@close="toastVisible = false"
|
|
404
|
+
/>
|
|
405
|
+
`,
|
|
406
|
+
}),
|
|
407
|
+
};
|
|
@@ -6,6 +6,9 @@ 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
|
+
|
|
9
12
|
The ModalDialog was designed to inform the user about a specific task, request information, or involve other tasks.
|
|
10
13
|
|
|
11
14
|
<Source
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import UnnnicModalDialog from '../components/ModalDialog/ModalDialog.vue';
|
|
2
2
|
import UnnnicInput from '../components/Input/Input.vue';
|
|
3
3
|
import UnnnicLabel from '../components/Label/Label.vue';
|
|
4
|
+
import UnnnicInputDatePicker from '../components/InputDatePicker/InputDatePicker.vue';
|
|
5
|
+
import UnnnicSwitch from '../components/Switch/Switch.vue';
|
|
6
|
+
import UnnnicButton from '../components/Button/Button.vue';
|
|
4
7
|
|
|
5
8
|
import { action } from '@storybook/addon-actions';
|
|
6
9
|
import iconsList from '../utils/iconList';
|
|
7
10
|
import colorsList from '../utils/colorsList';
|
|
8
11
|
|
|
9
12
|
export default {
|
|
10
|
-
title: '
|
|
13
|
+
title: 'Feedback/ModalDialog',
|
|
11
14
|
component: UnnnicModalDialog,
|
|
12
15
|
argTypes: {
|
|
13
16
|
type: {
|
|
@@ -182,6 +185,85 @@ const TemplateLeftSidebar = (args) => ({
|
|
|
182
185
|
},
|
|
183
186
|
});
|
|
184
187
|
|
|
188
|
+
const TemplateWithDatePicker = (args) => ({
|
|
189
|
+
components: {
|
|
190
|
+
UnnnicModalDialog,
|
|
191
|
+
UnnnicInputDatePicker,
|
|
192
|
+
UnnnicSwitch,
|
|
193
|
+
UnnnicButton,
|
|
194
|
+
},
|
|
195
|
+
setup() {
|
|
196
|
+
const updateModelValue = (value) => {
|
|
197
|
+
action('update:modelValue')(value);
|
|
198
|
+
args.modelValue = value;
|
|
199
|
+
};
|
|
200
|
+
return { args, updateModelValue };
|
|
201
|
+
},
|
|
202
|
+
data() {
|
|
203
|
+
return {
|
|
204
|
+
forms: [{ date: { start: null, end: null }, repeat: false }],
|
|
205
|
+
isLoading: false,
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
template: `
|
|
209
|
+
<div>
|
|
210
|
+
<button @click="updateModelValue(true)">Open Modal with DatePicker</button>
|
|
211
|
+
<unnnic-modal-dialog
|
|
212
|
+
v-bind="args"
|
|
213
|
+
@primaryButtonClick="handleSave"
|
|
214
|
+
@secondaryButtonClick="secondaryButtonClick"
|
|
215
|
+
@update:modelValue="updateModelValue"
|
|
216
|
+
>
|
|
217
|
+
<section style="display: flex; flex-direction: column; gap: 16px;">
|
|
218
|
+
<section
|
|
219
|
+
v-for="(form, index) in forms"
|
|
220
|
+
:key="index"
|
|
221
|
+
style="display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid #E2E6ED; border-radius: 8px;"
|
|
222
|
+
>
|
|
223
|
+
<section style="display: flex; flex-direction: column; gap: 8px;">
|
|
224
|
+
<p style="font-family: 'Lato'; font-size: 14px; font-weight: 600; margin: 0; color: #3B414D;">
|
|
225
|
+
Select date or period
|
|
226
|
+
</p>
|
|
227
|
+
<UnnnicInputDatePicker
|
|
228
|
+
v-model="form.date"
|
|
229
|
+
:options="[{ id: 'custom', name: 'Custom' }]"
|
|
230
|
+
next
|
|
231
|
+
fillW
|
|
232
|
+
actionText="Confirm"
|
|
233
|
+
disableClear
|
|
234
|
+
/>
|
|
235
|
+
</section>
|
|
236
|
+
<UnnnicSwitch
|
|
237
|
+
v-model="form.repeat"
|
|
238
|
+
textRight="Repeat annually"
|
|
239
|
+
size="small"
|
|
240
|
+
/>
|
|
241
|
+
</section>
|
|
242
|
+
<UnnnicButton
|
|
243
|
+
iconCenter="add-1"
|
|
244
|
+
type="tertiary"
|
|
245
|
+
text="Add"
|
|
246
|
+
@click="addForm"
|
|
247
|
+
/>
|
|
248
|
+
</section>
|
|
249
|
+
</unnnic-modal-dialog>
|
|
250
|
+
</div>
|
|
251
|
+
`,
|
|
252
|
+
methods: {
|
|
253
|
+
primaryButtonClick: action('primaryButtonClick'),
|
|
254
|
+
secondaryButtonClick: action('secondaryButtonClick'),
|
|
255
|
+
handleSave() {
|
|
256
|
+
action('primaryButtonClick')();
|
|
257
|
+
action('save')(this.forms);
|
|
258
|
+
console.log('Forms data:', this.forms);
|
|
259
|
+
},
|
|
260
|
+
addForm() {
|
|
261
|
+
this.forms.push({ date: { start: null, end: null }, repeat: false });
|
|
262
|
+
action('addForm')();
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
|
|
185
267
|
export const Default = Template.bind({});
|
|
186
268
|
Default.args = {
|
|
187
269
|
title: 'Default Modal',
|
|
@@ -261,3 +343,16 @@ Image.args = {
|
|
|
261
343
|
},
|
|
262
344
|
showActionsDivider: true,
|
|
263
345
|
};
|
|
346
|
+
|
|
347
|
+
export const WithDatePicker = TemplateWithDatePicker.bind({});
|
|
348
|
+
WithDatePicker.args = {
|
|
349
|
+
title: 'Add Non-Working Dates',
|
|
350
|
+
type: '',
|
|
351
|
+
primaryButtonProps: {
|
|
352
|
+
text: 'Save',
|
|
353
|
+
loading: false,
|
|
354
|
+
},
|
|
355
|
+
secondaryButtonProps: {
|
|
356
|
+
text: 'Cancel',
|
|
357
|
+
},
|
|
358
|
+
};
|
|
@@ -26,6 +26,11 @@ export default {
|
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
argTypes: {
|
|
29
|
+
width: {
|
|
30
|
+
control: { type: 'text' },
|
|
31
|
+
description:
|
|
32
|
+
'The width of the popover. This overrides the size prop. If not provided, the size prop will be used.',
|
|
33
|
+
},
|
|
29
34
|
size: {
|
|
30
35
|
control: { type: 'select' },
|
|
31
36
|
options: ['small', 'medium', 'large'],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import UnnnicTemplatePreview from
|
|
1
|
+
import UnnnicTemplatePreview from "../components/TemplatePreview/TemplatePreview.vue";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
title:
|
|
5
|
-
tags: [
|
|
4
|
+
title: "example/TemplatePreview",
|
|
5
|
+
tags: ["autodocs"],
|
|
6
6
|
component: UnnnicTemplatePreview,
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -17,28 +17,28 @@ const Template = (args) => ({
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const bodyText =
|
|
20
|
-
|
|
20
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sem orci, ultrices id lectus non, vehicula suscipit libero. Ut vehicula libero a tempus fringilla. Nam tincidunt vestibulum maximus. Morbi vel pretium risus. Curabitur id quam lectus. Quisque dolor elit, auctor a lacus non, rutrum ullamcorper mi. Nulla et turpis sed eros pharetra ullamcorper fermentum ac nisl. Donec lacinia hendrerit tellus, sit amet suscipit velit vestibulum sed. Praesent gravida posuere metus, ut fringilla dolor euismod vel. Aenean vel ipsum magna. Integer metus mi, fermentum ut nulla at, facilisis lobortis metus. Ut vitae tortor posuere, dapibus leo quis, finibus neque.";
|
|
21
21
|
|
|
22
22
|
export const Default = Template.bind({});
|
|
23
23
|
Default.args = {
|
|
24
24
|
template: {
|
|
25
25
|
header: {
|
|
26
|
-
type:
|
|
27
|
-
text:
|
|
26
|
+
type: "TEXT",
|
|
27
|
+
text: "Hello, world!",
|
|
28
28
|
},
|
|
29
|
-
footer:
|
|
29
|
+
footer: "Weni by VTEX",
|
|
30
30
|
buttons: [
|
|
31
31
|
{
|
|
32
|
-
text:
|
|
33
|
-
type:
|
|
32
|
+
text: "Button 1",
|
|
33
|
+
type: "PHONE_NUMBER",
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
text:
|
|
37
|
-
type:
|
|
36
|
+
text: "Button 2",
|
|
37
|
+
type: "URL",
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
text:
|
|
41
|
-
type:
|
|
40
|
+
text: "Button 3",
|
|
41
|
+
type: "QUICK_REPLY",
|
|
42
42
|
},
|
|
43
43
|
],
|
|
44
44
|
body: bodyText,
|
|
@@ -49,10 +49,10 @@ export const Image = Template.bind({});
|
|
|
49
49
|
Image.args = {
|
|
50
50
|
template: {
|
|
51
51
|
header: {
|
|
52
|
-
type:
|
|
53
|
-
mediaType:
|
|
52
|
+
type: "MEDIA",
|
|
53
|
+
mediaType: "IMAGE",
|
|
54
54
|
},
|
|
55
|
-
footer:
|
|
55
|
+
footer: "Weni by VTEX",
|
|
56
56
|
body: bodyText,
|
|
57
57
|
},
|
|
58
58
|
};
|
|
@@ -61,21 +61,21 @@ export const Video = Template.bind({});
|
|
|
61
61
|
Video.args = {
|
|
62
62
|
template: {
|
|
63
63
|
header: {
|
|
64
|
-
type:
|
|
65
|
-
mediaType:
|
|
64
|
+
type: "MEDIA",
|
|
65
|
+
mediaType: "VIDEO",
|
|
66
66
|
},
|
|
67
67
|
buttons: [
|
|
68
68
|
{
|
|
69
|
-
text:
|
|
70
|
-
type:
|
|
69
|
+
text: "Button 1",
|
|
70
|
+
type: "PHONE_NUMBER",
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
text:
|
|
74
|
-
type:
|
|
73
|
+
text: "Button 2",
|
|
74
|
+
type: "URL",
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
|
-
text:
|
|
78
|
-
type:
|
|
77
|
+
text: "Button 3",
|
|
78
|
+
type: "QUICK_REPLY",
|
|
79
79
|
},
|
|
80
80
|
],
|
|
81
81
|
},
|
|
@@ -85,10 +85,10 @@ export const Document = Template.bind({});
|
|
|
85
85
|
Document.args = {
|
|
86
86
|
template: {
|
|
87
87
|
header: {
|
|
88
|
-
type:
|
|
89
|
-
mediaType:
|
|
88
|
+
type: "MEDIA",
|
|
89
|
+
mediaType: "DOCUMENT",
|
|
90
90
|
},
|
|
91
|
-
footer:
|
|
91
|
+
footer: "Weni by VTEX",
|
|
92
92
|
body: bodyText,
|
|
93
93
|
},
|
|
94
94
|
};
|