@weni/unnnic-system 3.12.6-alpha-teleports.0 → 3.12.6

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.
Files changed (77) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/CHANGELOG.md +1074 -0
  3. package/README.md +1 -9
  4. package/dist/{es-ebc7770b.mjs → es-e7dc92a2.mjs} +1 -1
  5. package/dist/{index-f117a889.mjs → index-84ade580.mjs} +51079 -53907
  6. package/dist/index.d.ts +1363 -4701
  7. package/dist/{pt-br-b1a08da0.mjs → pt-br-51fd679a.mjs} +1 -1
  8. package/dist/style.css +1 -1
  9. package/dist/unnnic.mjs +206 -234
  10. package/dist/unnnic.umd.js +44 -48
  11. package/package.json +2 -3
  12. package/src/assets/scss/tailwind.scss +0 -8
  13. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
  14. package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +1 -2
  15. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +60 -61
  16. package/src/components/Checkbox/Checkbox.vue +8 -2
  17. package/src/components/CheckboxGroup/CheckboxGroup.vue +7 -5
  18. package/src/components/Chip/Chip.vue +1 -1
  19. package/src/components/Drawer/Drawer.vue +270 -180
  20. package/src/components/Drawer/__tests__/Drawer.spec.js +43 -32
  21. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +19 -18
  22. package/src/components/FormElement/FormElement.vue +96 -87
  23. package/src/components/Input/Input.vue +2 -2
  24. package/src/components/ModalDialog/ModalDialog.vue +154 -63
  25. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +221 -11
  26. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +22 -1
  27. package/src/components/Radio/Radio.vue +12 -6
  28. package/src/components/Radio/__test__/Radio.spec.js +3 -1
  29. package/src/components/RadioGroup/RadioGroup.vue +18 -10
  30. package/src/components/Switch/Switch.vue +10 -3
  31. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -3
  32. package/src/components/TemplatePreview/TemplatePreview.vue +28 -25
  33. package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
  34. package/src/components/TemplatePreview/types.d.ts +3 -3
  35. package/src/components/Toast/Toast.vue +1 -4
  36. package/src/components/Toast/ToastManager.ts +1 -4
  37. package/src/components/Toast/__tests__/ToastManager.spec.js +6 -10
  38. package/src/components/ToolTip/ToolTip.vue +177 -25
  39. package/src/components/ToolTip/__tests__/ToolTip.spec.js +61 -339
  40. package/src/components/index.ts +0 -56
  41. package/src/components/ui/popover/PopoverContent.vue +3 -7
  42. package/src/components/ui/popover/PopoverTrigger.vue +1 -5
  43. package/src/index.ts +2 -9
  44. package/src/stories/Drawer.stories.js +1 -1
  45. package/src/stories/ModalDialog.mdx +0 -3
  46. package/src/stories/ModalDialog.stories.js +1 -1
  47. package/src/stories/TemplatePreview.stories.js +27 -27
  48. package/src/stories/TemplatePreviewModal.stories.js +31 -31
  49. package/src/components/ui/dialog/Dialog.vue +0 -19
  50. package/src/components/ui/dialog/DialogClose.vue +0 -29
  51. package/src/components/ui/dialog/DialogContent.vue +0 -140
  52. package/src/components/ui/dialog/DialogFooter.vue +0 -50
  53. package/src/components/ui/dialog/DialogHeader.vue +0 -83
  54. package/src/components/ui/dialog/DialogTitle.vue +0 -38
  55. package/src/components/ui/dialog/DialogTrigger.vue +0 -16
  56. package/src/components/ui/dialog/index.ts +0 -7
  57. package/src/components/ui/drawer/Drawer.vue +0 -27
  58. package/src/components/ui/drawer/DrawerClose.vue +0 -31
  59. package/src/components/ui/drawer/DrawerContent.vue +0 -113
  60. package/src/components/ui/drawer/DrawerDescription.vue +0 -40
  61. package/src/components/ui/drawer/DrawerFooter.vue +0 -38
  62. package/src/components/ui/drawer/DrawerHeader.vue +0 -57
  63. package/src/components/ui/drawer/DrawerOverlay.vue +0 -33
  64. package/src/components/ui/drawer/DrawerTitle.vue +0 -37
  65. package/src/components/ui/drawer/DrawerTrigger.vue +0 -31
  66. package/src/components/ui/drawer/index.ts +0 -10
  67. package/src/components/ui/tooltip/Tooltip.vue +0 -21
  68. package/src/components/ui/tooltip/TooltipContent.vue +0 -77
  69. package/src/components/ui/tooltip/TooltipTrigger.vue +0 -24
  70. package/src/components/ui/tooltip/index.ts +0 -3
  71. package/src/lib/__tests__/teleport-target.spec.ts +0 -73
  72. package/src/lib/layer-manager.ts +0 -64
  73. package/src/lib/teleport-target.ts +0 -46
  74. package/src/stories/Dialog.stories.js +0 -832
  75. package/src/stories/DrawerNext.stories.js +0 -611
  76. package/src/stories/LayerManager.docs.mdx +0 -40
  77. package/src/stories/LayerManager.stories.js +0 -407
@@ -111,20 +111,6 @@ import {
111
111
  SegmentedControlContent,
112
112
  } from './ui/segmented-control';
113
113
  import PageHeader from './PageHeader/PageHeader.vue';
114
- import Dialog from './ui/dialog/Dialog.vue';
115
- import DialogContent from './ui/dialog/DialogContent.vue';
116
- import DialogFooter from './ui/dialog/DialogFooter.vue';
117
- import DialogHeader from './ui/dialog/DialogHeader.vue';
118
- import DialogTitle from './ui/dialog/DialogTitle.vue';
119
- import DialogTrigger from './ui/dialog/DialogTrigger.vue';
120
- import DialogClose from './ui/dialog/DialogClose.vue';
121
- import DrawerNext from './ui/drawer/Drawer.vue';
122
- import DrawerContent from './ui/drawer/DrawerContent.vue';
123
- import DrawerHeader from './ui/drawer/DrawerHeader.vue';
124
- import DrawerFooter from './ui/drawer/DrawerFooter.vue';
125
- import DrawerClose from './ui/drawer/DrawerClose.vue';
126
- import DrawerTitle from './ui/drawer/DrawerTitle.vue';
127
- import DrawerDescription from './ui/drawer/DrawerDescription.vue';
128
114
 
129
115
  type VueComponent = Component;
130
116
 
@@ -244,20 +230,6 @@ export const components: ComponentsMap = {
244
230
  unnnicSegmentedControlTrigger: SegmentedControlTrigger,
245
231
  unnnicSegmentedControlContent: SegmentedControlContent,
246
232
  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
233
  };
262
234
 
263
235
  export const unnnicFontSize = fontSize;
@@ -372,20 +344,6 @@ export const unnnicSegmentedControlList = SegmentedControlList;
372
344
  export const unnnicSegmentedControlTrigger = SegmentedControlTrigger;
373
345
  export const unnnicSegmentedControlContent = SegmentedControlContent;
374
346
  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
347
 
390
348
  export const UnnnicFontSize = fontSize;
391
349
  export const UnnnicFormElement = formElement;
@@ -499,17 +457,3 @@ export const UnnnicSegmentedControlList = SegmentedControlList;
499
457
  export const UnnnicSegmentedControlTrigger = SegmentedControlTrigger;
500
458
  export const UnnnicSegmentedControlContent = SegmentedControlContent;
501
459
  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 :to="portalTarget">
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 lang="scss" scoped>
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, options?: UnnnicPluginOptions): void;
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, options?: UnnnicPluginOptions) {
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
  });
@@ -14,7 +14,7 @@ const primaryButtonTypeOptions = [
14
14
  ];
15
15
 
16
16
  export default {
17
- title: 'Misc/Drawer',
17
+ title: 'Example/Drawer',
18
18
  component: UnnnicDrawer,
19
19
  argTypes: {
20
20
  title: { control: { type: 'text' } },
@@ -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
@@ -7,7 +7,7 @@ import iconsList from '../utils/iconList';
7
7
  import colorsList from '../utils/colorsList';
8
8
 
9
9
  export default {
10
- title: 'Feedback/ModalDialog',
10
+ title: 'Example/ModalDialog',
11
11
  component: UnnnicModalDialog,
12
12
  argTypes: {
13
13
  type: {
@@ -1,8 +1,8 @@
1
- import UnnnicTemplatePreview from "../components/TemplatePreview/TemplatePreview.vue";
1
+ import UnnnicTemplatePreview from '../components/TemplatePreview/TemplatePreview.vue';
2
2
 
3
3
  export default {
4
- title: "example/TemplatePreview",
5
- tags: ["autodocs"],
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
- "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.";
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: "TEXT",
27
- text: "Hello, world!",
26
+ type: 'TEXT',
27
+ text: 'Hello, world!',
28
28
  },
29
- footer: "Weni by VTEX",
29
+ footer: 'Weni by VTEX',
30
30
  buttons: [
31
31
  {
32
- text: "Button 1",
33
- type: "PHONE_NUMBER",
32
+ text: 'Button 1',
33
+ type: 'PHONE_NUMBER',
34
34
  },
35
35
  {
36
- text: "Button 2",
37
- type: "URL",
36
+ text: 'Button 2',
37
+ type: 'URL',
38
38
  },
39
39
  {
40
- text: "Button 3",
41
- type: "QUICK_REPLY",
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: "MEDIA",
53
- mediaType: "IMAGE",
52
+ type: 'MEDIA',
53
+ mediaType: 'IMAGE',
54
54
  },
55
- footer: "Weni by VTEX",
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: "MEDIA",
65
- mediaType: "VIDEO",
64
+ type: 'MEDIA',
65
+ mediaType: 'VIDEO',
66
66
  },
67
67
  buttons: [
68
68
  {
69
- text: "Button 1",
70
- type: "PHONE_NUMBER",
69
+ text: 'Button 1',
70
+ type: 'PHONE_NUMBER',
71
71
  },
72
72
  {
73
- text: "Button 2",
74
- type: "URL",
73
+ text: 'Button 2',
74
+ type: 'URL',
75
75
  },
76
76
  {
77
- text: "Button 3",
78
- type: "QUICK_REPLY",
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: "MEDIA",
89
- mediaType: "DOCUMENT",
88
+ type: 'MEDIA',
89
+ mediaType: 'DOCUMENT',
90
90
  },
91
- footer: "Weni by VTEX",
91
+ footer: 'Weni by VTEX',
92
92
  body: bodyText,
93
93
  },
94
94
  };
@@ -1,15 +1,15 @@
1
- import UnnnicTemplatePreviewModal from "../components/TemplatePreview/TemplatePreviewModal.vue";
1
+ import UnnnicTemplatePreviewModal from '../components/TemplatePreview/TemplatePreviewModal.vue';
2
2
 
3
- import { action } from "@storybook/addon-actions";
3
+ import { action } from '@storybook/addon-actions';
4
4
 
5
5
  export default {
6
- title: "example/TemplatePreviewModal",
7
- tags: ["autodocs"],
6
+ title: 'example/TemplatePreviewModal',
7
+ tags: ['autodocs'],
8
8
  component: UnnnicTemplatePreviewModal,
9
9
  argTypes: {
10
10
  locale: {
11
- control: { type: "select" },
12
- options: ["pt-br", "en", "es"],
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("close")();
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
- "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.";
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: "TEXT",
43
- text: "Hello, world!",
42
+ type: 'TEXT',
43
+ text: 'Hello, world!',
44
44
  },
45
- footer: "Weni by VTEX",
45
+ footer: 'Weni by VTEX',
46
46
  buttons: [
47
47
  {
48
- text: "Button 1",
49
- type: "PHONE_NUMBER",
48
+ text: 'Button 1',
49
+ type: 'PHONE_NUMBER',
50
50
  },
51
51
  {
52
- text: "Button 2",
53
- type: "URL",
52
+ text: 'Button 2',
53
+ type: 'URL',
54
54
  },
55
55
  {
56
- text: "Button 3",
57
- type: "QUICK_REPLY",
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: "MEDIA",
69
- mediaType: "IMAGE",
68
+ type: 'MEDIA',
69
+ mediaType: 'IMAGE',
70
70
  },
71
- footer: "Weni by VTEX",
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: "MEDIA",
81
- mediaType: "VIDEO",
80
+ type: 'MEDIA',
81
+ mediaType: 'VIDEO',
82
82
  },
83
83
  buttons: [
84
84
  {
85
- text: "Button 1",
86
- type: "PHONE_NUMBER",
85
+ text: 'Button 1',
86
+ type: 'PHONE_NUMBER',
87
87
  },
88
88
  {
89
- text: "Button 2",
90
- type: "URL",
89
+ text: 'Button 2',
90
+ type: 'URL',
91
91
  },
92
92
  {
93
- text: "Button 3",
94
- type: "QUICK_REPLY",
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: "MEDIA",
105
- mediaType: "DOCUMENT",
104
+ type: 'MEDIA',
105
+ mediaType: 'DOCUMENT',
106
106
  },
107
- footer: "Weni by VTEX",
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>
@@ -1,50 +0,0 @@
1
- <script setup lang="ts">
2
- import type { HTMLAttributes } from 'vue';
3
- import { cn } from '@/lib/utils';
4
-
5
- defineOptions({
6
- name: 'UnnnicDialogFooter',
7
- });
8
-
9
- const props = withDefaults(
10
- defineProps<{ class?: HTMLAttributes['class']; divider?: boolean }>(),
11
- {
12
- divider: true,
13
- },
14
- );
15
- </script>
16
-
17
- <template>
18
- <footer
19
- :class="
20
- cn(
21
- 'unnnic-dialog-footer',
22
- { 'unnnic-dialog-footer--with-divider': props.divider },
23
- props.class,
24
- )
25
- "
26
- >
27
- <slot />
28
- </footer>
29
- </template>
30
-
31
- <style lang="scss" scoped>
32
- @use '@/assets/scss/unnnic' as *;
33
-
34
- .unnnic-dialog-footer {
35
- display: flex;
36
- justify-content: center;
37
- align-items: center;
38
- gap: $unnnic-space-2;
39
-
40
- padding: $unnnic-space-6;
41
-
42
- &--with-divider {
43
- border-top: 1px solid $unnnic-color-border-soft;
44
- }
45
-
46
- > * {
47
- width: 100%;
48
- }
49
- }
50
- </style>