@weni/unnnic-system 3.12.6-alpha-teleports.0 → 3.12.7
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/.vscode/extensions.json +3 -0
- package/CHANGELOG.md +1080 -0
- package/README.md +1 -9
- package/dist/{es-ebc7770b.mjs → es-c84c6e0c.mjs} +1 -1
- package/dist/{index-f117a889.mjs → index-71322a23.mjs} +51837 -54596
- package/dist/index.d.ts +1550 -4744
- package/dist/{pt-br-b1a08da0.mjs → pt-br-f53036d2.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +211 -237
- package/dist/unnnic.umd.js +44 -48
- package/package.json +2 -3
- package/src/assets/scss/tailwind.scss +0 -8
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
- package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +1 -2
- package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +60 -61
- package/src/components/Checkbox/Checkbox.vue +8 -2
- package/src/components/CheckboxGroup/CheckboxGroup.vue +7 -5
- package/src/components/Chip/Chip.vue +1 -1
- package/src/components/Drawer/Drawer.vue +270 -180
- package/src/components/Drawer/__tests__/Drawer.spec.js +43 -32
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +19 -18
- package/src/components/FormElement/FormElement.vue +96 -87
- package/src/components/Input/Input.vue +2 -2
- package/src/components/ModalDialog/ModalDialog.vue +154 -63
- 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/Radio/Radio.vue +12 -6
- package/src/components/Radio/__test__/Radio.spec.js +3 -1
- package/src/components/RadioGroup/RadioGroup.vue +18 -10
- package/src/components/Switch/Switch.vue +10 -3
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -3
- package/src/components/TemplatePreview/TemplatePreview.vue +28 -25
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
- package/src/components/TemplatePreview/types.d.ts +3 -3
- package/src/components/Toast/Toast.vue +1 -4
- package/src/components/Toast/ToastManager.ts +1 -4
- package/src/components/Toast/__tests__/ToastManager.spec.js +6 -10
- package/src/components/ToolTip/ToolTip.vue +177 -25
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +61 -339
- package/src/components/index.ts +4 -56
- package/src/components/ui/popover/PopoverContent.vue +3 -7
- package/src/components/ui/popover/PopoverTrigger.vue +1 -5
- package/src/index.ts +2 -9
- 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/TemplatePreview.stories.js +27 -27
- package/src/stories/TemplatePreviewModal.stories.js +31 -31
- 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 -113
- 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 -77
- package/src/components/ui/tooltip/TooltipTrigger.vue +0 -24
- package/src/components/ui/tooltip/index.ts +0 -3
- package/src/lib/__tests__/teleport-target.spec.ts +0 -73
- package/src/lib/layer-manager.ts +0 -64
- package/src/lib/teleport-target.ts +0 -46
- 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 -407
package/src/components/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ import checkbox from './Checkbox/Checkbox.vue';
|
|
|
28
28
|
import checkboxGroup from './CheckboxGroup/CheckboxGroup.vue';
|
|
29
29
|
import collapse from './Collapse/Collapse.vue';
|
|
30
30
|
import radio from './Radio/Radio.vue';
|
|
31
|
+
import radioGroup from './RadioGroup/RadioGroup.vue';
|
|
31
32
|
import languageSelect from './Dropdown/LanguageSelect.vue';
|
|
32
33
|
import modal from './Modal/Modal.vue';
|
|
33
34
|
import modalUpload from './ModalUpload/ModalUpload.vue';
|
|
@@ -111,20 +112,6 @@ import {
|
|
|
111
112
|
SegmentedControlContent,
|
|
112
113
|
} from './ui/segmented-control';
|
|
113
114
|
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';
|
|
128
115
|
|
|
129
116
|
type VueComponent = Component;
|
|
130
117
|
|
|
@@ -162,6 +149,7 @@ export const components: ComponentsMap = {
|
|
|
162
149
|
unnnicCheckboxGroup: checkboxGroup,
|
|
163
150
|
unnnicCollapse: collapse,
|
|
164
151
|
unnnicRadio: radio,
|
|
152
|
+
unnnicRadioGroup: radioGroup,
|
|
165
153
|
unnnicLanguageSelect: languageSelect,
|
|
166
154
|
unnnicModal: modal,
|
|
167
155
|
unnnicModalNext: ModalNext,
|
|
@@ -244,20 +232,6 @@ export const components: ComponentsMap = {
|
|
|
244
232
|
unnnicSegmentedControlTrigger: SegmentedControlTrigger,
|
|
245
233
|
unnnicSegmentedControlContent: SegmentedControlContent,
|
|
246
234
|
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,
|
|
261
235
|
};
|
|
262
236
|
|
|
263
237
|
export const unnnicFontSize = fontSize;
|
|
@@ -290,6 +264,7 @@ export const unnnicCheckbox = checkbox;
|
|
|
290
264
|
export const unnnicCheckboxGroup = checkboxGroup;
|
|
291
265
|
export const unnnicCollapse = collapse;
|
|
292
266
|
export const unnnicRadio = radio;
|
|
267
|
+
export const unnnicRadioGroup = radioGroup;
|
|
293
268
|
export const unnniclanguageSelect = languageSelect as VueComponent;
|
|
294
269
|
export const unnnicModal = modal;
|
|
295
270
|
export const unnnicModalDialog = ModalDialog;
|
|
@@ -372,20 +347,6 @@ export const unnnicSegmentedControlList = SegmentedControlList;
|
|
|
372
347
|
export const unnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
373
348
|
export const unnnicSegmentedControlContent = SegmentedControlContent;
|
|
374
349
|
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;
|
|
389
350
|
|
|
390
351
|
export const UnnnicFontSize = fontSize;
|
|
391
352
|
export const UnnnicFormElement = formElement;
|
|
@@ -417,6 +378,7 @@ export const UnnnicCheckbox = checkbox;
|
|
|
417
378
|
export const UnnnicCheckboxGroup = checkboxGroup;
|
|
418
379
|
export const UnnnicCollapse = collapse;
|
|
419
380
|
export const UnnnicRadio = radio;
|
|
381
|
+
export const UnnnicRadioGroup = radioGroup;
|
|
420
382
|
export const UnnniclanguageSelect = languageSelect as VueComponent;
|
|
421
383
|
export const UnnnicModal = modal;
|
|
422
384
|
export const UnnnicModalDialog = ModalDialog;
|
|
@@ -499,17 +461,3 @@ export const UnnnicSegmentedControlList = SegmentedControlList;
|
|
|
499
461
|
export const UnnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
500
462
|
export const UnnnicSegmentedControlContent = SegmentedControlContent;
|
|
501
463
|
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<PopoverPortal
|
|
2
|
+
<PopoverPortal>
|
|
3
3
|
<PopoverContent
|
|
4
4
|
v-bind="{ ...forwarded, ...$attrs }"
|
|
5
5
|
:class="
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
'bg-popover text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
10
10
|
)
|
|
11
11
|
"
|
|
12
|
-
:style="{ zIndex: popoverZIndex }"
|
|
13
12
|
>
|
|
14
13
|
<section :class="`unnnic-popover__content ${props.class || ''}`">
|
|
15
14
|
<component
|
|
@@ -35,8 +34,6 @@ import { computed, useSlots } from 'vue';
|
|
|
35
34
|
import { reactiveOmit } from '@vueuse/core';
|
|
36
35
|
import { PopoverContent, PopoverPortal, useForwardPropsEmits } from 'reka-ui';
|
|
37
36
|
import { cn } from '@/lib/utils';
|
|
38
|
-
import { useLayerZIndex } from '@/lib/layer-manager';
|
|
39
|
-
import { useTeleportTarget } from '@/lib/teleport-target';
|
|
40
37
|
|
|
41
38
|
defineOptions({
|
|
42
39
|
inheritAttrs: false,
|
|
@@ -64,9 +61,6 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
64
61
|
|
|
65
62
|
const slots = useSlots() as Slots;
|
|
66
63
|
|
|
67
|
-
const popoverZIndex = useLayerZIndex();
|
|
68
|
-
const portalTarget = useTeleportTarget();
|
|
69
|
-
|
|
70
64
|
const getComponentName = (vnode: VNode): string | undefined => {
|
|
71
65
|
const componentType = vnode.type as { name?: string; __name?: string };
|
|
72
66
|
return componentType?.name || componentType?.__name;
|
|
@@ -93,6 +87,8 @@ const footerChildren = computed(() => {
|
|
|
93
87
|
$popover-space: $unnnic-space-4;
|
|
94
88
|
|
|
95
89
|
.unnnic-popover {
|
|
90
|
+
z-index: 10000;
|
|
91
|
+
|
|
96
92
|
border-radius: $unnnic-radius-2;
|
|
97
93
|
box-shadow: $unnnic-shadow-1;
|
|
98
94
|
|
|
@@ -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>
|
package/src/index.ts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
2
|
import { components } from '@/components';
|
|
3
3
|
import './assets/scss/tailwind.scss';
|
|
4
|
-
import { setTeleportTarget, type TeleportTarget } from '@/lib/teleport-target';
|
|
5
4
|
|
|
6
5
|
interface UnnnicPlugin {
|
|
7
|
-
install(app: App
|
|
6
|
+
install(app: App): void;
|
|
8
7
|
[key: string]: any;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
export interface UnnnicPluginOptions {
|
|
12
|
-
teleportTarget?: TeleportTarget | null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
10
|
const Unnnic: UnnnicPlugin = {
|
|
16
|
-
install(app: App
|
|
17
|
-
setTeleportTarget(options?.teleportTarget ?? null);
|
|
18
|
-
|
|
11
|
+
install(app: App) {
|
|
19
12
|
Object.keys(components).forEach((name) => {
|
|
20
13
|
app.component(name, components[name] as any);
|
|
21
14
|
});
|
|
@@ -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
|
|
@@ -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
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import UnnnicTemplatePreviewModal from
|
|
1
|
+
import UnnnicTemplatePreviewModal from '../components/TemplatePreview/TemplatePreviewModal.vue';
|
|
2
2
|
|
|
3
|
-
import { action } from
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
title:
|
|
7
|
-
tags: [
|
|
6
|
+
title: 'example/TemplatePreviewModal',
|
|
7
|
+
tags: ['autodocs'],
|
|
8
8
|
component: UnnnicTemplatePreviewModal,
|
|
9
9
|
argTypes: {
|
|
10
10
|
locale: {
|
|
11
|
-
control: { type:
|
|
12
|
-
options: [
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['pt-br', 'en', 'es'],
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
};
|
|
@@ -18,7 +18,7 @@ const Template = (args) => ({
|
|
|
18
18
|
components: { UnnnicTemplatePreviewModal },
|
|
19
19
|
setup() {
|
|
20
20
|
const close = () => {
|
|
21
|
-
action(
|
|
21
|
+
action('close')();
|
|
22
22
|
args.modelValue = false;
|
|
23
23
|
};
|
|
24
24
|
return { args, close };
|
|
@@ -32,29 +32,29 @@ const Template = (args) => ({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
const bodyText =
|
|
35
|
-
|
|
35
|
+
'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.';
|
|
36
36
|
|
|
37
37
|
export const Default = Template.bind({});
|
|
38
38
|
Default.args = {
|
|
39
39
|
modelValue: false,
|
|
40
40
|
template: {
|
|
41
41
|
header: {
|
|
42
|
-
type:
|
|
43
|
-
text:
|
|
42
|
+
type: 'TEXT',
|
|
43
|
+
text: 'Hello, world!',
|
|
44
44
|
},
|
|
45
|
-
footer:
|
|
45
|
+
footer: 'Weni by VTEX',
|
|
46
46
|
buttons: [
|
|
47
47
|
{
|
|
48
|
-
text:
|
|
49
|
-
type:
|
|
48
|
+
text: 'Button 1',
|
|
49
|
+
type: 'PHONE_NUMBER',
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
text:
|
|
53
|
-
type:
|
|
52
|
+
text: 'Button 2',
|
|
53
|
+
type: 'URL',
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
text:
|
|
57
|
-
type:
|
|
56
|
+
text: 'Button 3',
|
|
57
|
+
type: 'QUICK_REPLY',
|
|
58
58
|
},
|
|
59
59
|
],
|
|
60
60
|
body: bodyText,
|
|
@@ -65,10 +65,10 @@ export const Image = Template.bind({});
|
|
|
65
65
|
Image.args = {
|
|
66
66
|
template: {
|
|
67
67
|
header: {
|
|
68
|
-
type:
|
|
69
|
-
mediaType:
|
|
68
|
+
type: 'MEDIA',
|
|
69
|
+
mediaType: 'IMAGE',
|
|
70
70
|
},
|
|
71
|
-
footer:
|
|
71
|
+
footer: 'Weni by VTEX',
|
|
72
72
|
body: bodyText,
|
|
73
73
|
},
|
|
74
74
|
};
|
|
@@ -77,21 +77,21 @@ export const Video = Template.bind({});
|
|
|
77
77
|
Video.args = {
|
|
78
78
|
template: {
|
|
79
79
|
header: {
|
|
80
|
-
type:
|
|
81
|
-
mediaType:
|
|
80
|
+
type: 'MEDIA',
|
|
81
|
+
mediaType: 'VIDEO',
|
|
82
82
|
},
|
|
83
83
|
buttons: [
|
|
84
84
|
{
|
|
85
|
-
text:
|
|
86
|
-
type:
|
|
85
|
+
text: 'Button 1',
|
|
86
|
+
type: 'PHONE_NUMBER',
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
|
-
text:
|
|
90
|
-
type:
|
|
89
|
+
text: 'Button 2',
|
|
90
|
+
type: 'URL',
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
text:
|
|
94
|
-
type:
|
|
93
|
+
text: 'Button 3',
|
|
94
|
+
type: 'QUICK_REPLY',
|
|
95
95
|
},
|
|
96
96
|
],
|
|
97
97
|
},
|
|
@@ -101,10 +101,10 @@ export const Document = Template.bind({});
|
|
|
101
101
|
Document.args = {
|
|
102
102
|
template: {
|
|
103
103
|
header: {
|
|
104
|
-
type:
|
|
105
|
-
mediaType:
|
|
104
|
+
type: 'MEDIA',
|
|
105
|
+
mediaType: 'DOCUMENT',
|
|
106
106
|
},
|
|
107
|
-
footer:
|
|
107
|
+
footer: 'Weni by VTEX',
|
|
108
108
|
body: bodyText,
|
|
109
109
|
},
|
|
110
110
|
};
|
|
@@ -1,19 +0,0 @@
|
|
|
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>
|
|
@@ -1,29 +0,0 @@
|
|
|
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 = withDefaults(defineProps<DialogCloseProps>(), {
|
|
10
|
-
asChild: true,
|
|
11
|
-
});
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<template>
|
|
15
|
-
<DialogClose
|
|
16
|
-
class="unnnic-dialog-close"
|
|
17
|
-
v-bind="props"
|
|
18
|
-
>
|
|
19
|
-
<slot />
|
|
20
|
-
</DialogClose>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<style lang="scss" scoped>
|
|
24
|
-
.unnnic-dialog-close {
|
|
25
|
-
> * {
|
|
26
|
-
width: 100%;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
</style>
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { DialogContentEmits, DialogContentProps } from 'reka-ui';
|
|
3
|
-
import type { HTMLAttributes, Component } from 'vue';
|
|
4
|
-
import { computed, h } from 'vue';
|
|
5
|
-
import { reactiveOmit } from '@vueuse/core';
|
|
6
|
-
import {
|
|
7
|
-
DialogContent,
|
|
8
|
-
DialogOverlay,
|
|
9
|
-
DialogPortal,
|
|
10
|
-
useForwardPropsEmits,
|
|
11
|
-
} from 'reka-ui';
|
|
12
|
-
import { cn } from '@/lib/utils';
|
|
13
|
-
import { useLayerZIndex } from '@/lib/layer-manager';
|
|
14
|
-
import { useTeleportTarget } from '@/lib/teleport-target';
|
|
15
|
-
|
|
16
|
-
defineOptions({
|
|
17
|
-
name: 'UnnnicDialogContent',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const props = withDefaults(
|
|
21
|
-
defineProps<
|
|
22
|
-
DialogContentProps & {
|
|
23
|
-
parentClass?: HTMLAttributes['class'];
|
|
24
|
-
class?: HTMLAttributes['class'];
|
|
25
|
-
size?: 'small' | 'medium' | 'large';
|
|
26
|
-
}
|
|
27
|
-
>(),
|
|
28
|
-
{
|
|
29
|
-
size: 'medium',
|
|
30
|
-
parentClass: '', // This class should be temporary, to be discontinued with the ModalDialog component
|
|
31
|
-
class: '',
|
|
32
|
-
},
|
|
33
|
-
);
|
|
34
|
-
const emits = defineEmits<DialogContentEmits>();
|
|
35
|
-
|
|
36
|
-
const delegatedProps = reactiveOmit(props, 'class', 'parentClass');
|
|
37
|
-
|
|
38
|
-
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
39
|
-
|
|
40
|
-
const overlayZIndex = useLayerZIndex({ offset: -2 });
|
|
41
|
-
const modalZIndex = useLayerZIndex();
|
|
42
|
-
const portalTarget = useTeleportTarget();
|
|
43
|
-
|
|
44
|
-
const contentClasses = computed(() =>
|
|
45
|
-
cn(
|
|
46
|
-
'unnnic-dialog-content',
|
|
47
|
-
`unnnic-dialog-content--size-${props.size}`,
|
|
48
|
-
'duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]',
|
|
49
|
-
props.class,
|
|
50
|
-
),
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
// This component is used to wrap the DialogContent component in a section if the parentClass is provided
|
|
54
|
-
// This is a temporary solution, to be discontinued with the ModalDialog component
|
|
55
|
-
const ConditionalWrapper: Component = (_, { slots }) => {
|
|
56
|
-
const content = slots.default?.();
|
|
57
|
-
return props.parentClass
|
|
58
|
-
? h('section', { class: props.parentClass }, content)
|
|
59
|
-
: content;
|
|
60
|
-
};
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
<template>
|
|
64
|
-
<DialogPortal :to="portalTarget">
|
|
65
|
-
<DialogOverlay
|
|
66
|
-
class="unnnic-dialog-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
67
|
-
:style="{ zIndex: overlayZIndex }"
|
|
68
|
-
/>
|
|
69
|
-
|
|
70
|
-
<ConditionalWrapper>
|
|
71
|
-
<DialogContent
|
|
72
|
-
v-bind="forwarded"
|
|
73
|
-
:class="contentClasses"
|
|
74
|
-
:style="{ zIndex: modalZIndex }"
|
|
75
|
-
>
|
|
76
|
-
<slot />
|
|
77
|
-
</DialogContent>
|
|
78
|
-
</ConditionalWrapper>
|
|
79
|
-
</DialogPortal>
|
|
80
|
-
</template>
|
|
81
|
-
|
|
82
|
-
<style lang="scss" scoped>
|
|
83
|
-
@use '@/assets/scss/unnnic' as *;
|
|
84
|
-
|
|
85
|
-
.unnnic-dialog-overlay {
|
|
86
|
-
position: fixed;
|
|
87
|
-
top: 0;
|
|
88
|
-
left: 0;
|
|
89
|
-
|
|
90
|
-
width: 100vw;
|
|
91
|
-
height: 100vh;
|
|
92
|
-
background: rgba(53, 57, 69, 0.5);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.unnnic-dialog-content {
|
|
96
|
-
position: fixed;
|
|
97
|
-
top: 50%;
|
|
98
|
-
left: 50%;
|
|
99
|
-
|
|
100
|
-
transform: translate(-50%, -50%);
|
|
101
|
-
|
|
102
|
-
width: 100%;
|
|
103
|
-
max-height: calc(100% - $unnnic-space-20);
|
|
104
|
-
|
|
105
|
-
display: flex;
|
|
106
|
-
flex-direction: column;
|
|
107
|
-
|
|
108
|
-
box-shadow: $unnnic-shadow-2;
|
|
109
|
-
border-radius: $unnnic-radius-4;
|
|
110
|
-
background-color: $unnnic-color-bg-base;
|
|
111
|
-
|
|
112
|
-
&--size-small {
|
|
113
|
-
max-width: 360px;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&--size-medium {
|
|
117
|
-
max-width: 560px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&--size-large {
|
|
121
|
-
max-width: 800px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
> * {
|
|
125
|
-
&::-webkit-scrollbar {
|
|
126
|
-
width: $unnnic-spacing-inline-nano;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
&::-webkit-scrollbar-thumb {
|
|
130
|
-
background: $unnnic-color-neutral-cleanest;
|
|
131
|
-
border-radius: $unnnic-border-radius-pill;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
&::-webkit-scrollbar-track {
|
|
135
|
-
background: $unnnic-color-neutral-soft;
|
|
136
|
-
border-radius: $unnnic-border-radius-pill;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
</style>
|