@weni/unnnic-system 3.14.0-alpha-teleports.0 → 3.15.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 +11 -0
- package/README.md +1 -9
- package/dist/{es-0d53b5b2.mjs → es-b51fb49d.mjs} +1 -1
- package/dist/{index-d7070de8.mjs → index-88ec0352.mjs} +26529 -29321
- package/dist/index.d.ts +1485 -4826
- package/dist/{pt-br-bf4e1f97.mjs → pt-br-cd9f0dbc.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +204 -232
- package/dist/unnnic.umd.js +46 -50
- 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/CheckboxGroup/CheckboxGroup.vue +7 -5
- package/src/components/Chip/Chip.vue +1 -1
- package/src/components/DatePicker/DatePicker.vue +1 -10
- 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/InputDatePicker/InputDatePicker.vue +73 -68
- package/src/components/InputDatePicker/__test__/InputDatePicker.spec.js +24 -31
- package/src/components/ModalDialog/ModalDialog.vue +154 -63
- package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +210 -30
- 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/Select/__tests__/Select.spec.js +74 -0
- package/src/components/Select/__tests__/SelectItem.spec.js +35 -15
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +18 -0
- package/src/components/Select/index.vue +131 -22
- 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 +0 -56
- package/src/components/ui/popover/PopoverContent.vue +4 -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 -96
- package/src/stories/Select.stories.js +86 -0
- 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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<UnnnicModalDialog
|
|
3
|
-
:
|
|
3
|
+
:modelValue="modelValue"
|
|
4
4
|
@update:modelValue="$event === false && $emit('close')"
|
|
5
5
|
:title="defaultTranslations.title[props.locale]"
|
|
6
|
-
:
|
|
6
|
+
:showCloseIcon="true"
|
|
7
7
|
class="unnnic-template-preview-modal"
|
|
8
8
|
>
|
|
9
9
|
<UnnnicTemplatePreview :template="template" />
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script lang="ts" setup>
|
|
14
|
-
import UnnnicTemplatePreview from
|
|
15
|
-
import UnnnicModalDialog from
|
|
14
|
+
import UnnnicTemplatePreview from './TemplatePreview.vue';
|
|
15
|
+
import UnnnicModalDialog from '../ModalDialog/ModalDialog.vue';
|
|
16
16
|
|
|
17
|
-
import type { Template } from
|
|
17
|
+
import type { Template } from './types';
|
|
18
18
|
|
|
19
19
|
const defaultTranslations = {
|
|
20
20
|
title: {
|
|
21
|
-
|
|
22
|
-
en:
|
|
23
|
-
es:
|
|
21
|
+
'pt-br': 'Visualizar modelo',
|
|
22
|
+
en: 'Template preview',
|
|
23
|
+
es: 'Vista previa de plantilla',
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ interface Props {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const props = withDefaults(defineProps<Props>(), {
|
|
34
|
-
locale:
|
|
34
|
+
locale: 'en',
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
defineEmits<{
|
|
@@ -40,7 +40,7 @@ defineEmits<{
|
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
42
|
<style lang="scss" scoped>
|
|
43
|
-
@use
|
|
43
|
+
@use '@/assets/scss/unnnic' as *;
|
|
44
44
|
|
|
45
45
|
:deep(.unnnic-modal-dialog__container__content) {
|
|
46
46
|
display: flex;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export interface Template {
|
|
2
2
|
header: {
|
|
3
|
-
type:
|
|
4
|
-
mediaType?:
|
|
3
|
+
type: 'TEXT' | 'MEDIA';
|
|
4
|
+
mediaType?: 'IMAGE' | 'VIDEO' | 'DOCUMENT';
|
|
5
5
|
text?: string | null;
|
|
6
6
|
src?: string | null;
|
|
7
7
|
};
|
|
8
8
|
body?: string;
|
|
9
9
|
footer?: string;
|
|
10
10
|
buttons?: Array<{
|
|
11
|
-
type:
|
|
11
|
+
type: 'QUICK_REPLY' | 'PHONE_NUMBER';
|
|
12
12
|
text: string;
|
|
13
13
|
countryCode?: string;
|
|
14
14
|
phoneNumber?: string;
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
:role="type === 'error' ? 'alert' : 'status'"
|
|
12
12
|
:aria-live="type === 'error' ? 'assertive' : 'polite'"
|
|
13
13
|
data-testid="toast"
|
|
14
|
-
:style="{ zIndex: toastZIndex }"
|
|
15
14
|
>
|
|
16
15
|
<section
|
|
17
16
|
class="unnnic-toast__content"
|
|
@@ -75,7 +74,6 @@ import { ref, computed, onMounted, onUnmounted } from 'vue';
|
|
|
75
74
|
|
|
76
75
|
import UnnnicIcon from '@/components/Icon.vue';
|
|
77
76
|
import UnnnicButton from '@/components/Button/Button.vue';
|
|
78
|
-
import { useLayerZIndex } from '@/lib/layer-manager';
|
|
79
77
|
|
|
80
78
|
import type { ToastProps, ToastEmits } from './types';
|
|
81
79
|
import type { SchemeColor } from '@/types/scheme-colors';
|
|
@@ -111,8 +109,6 @@ const typeConfig = computed(() => {
|
|
|
111
109
|
};
|
|
112
110
|
});
|
|
113
111
|
|
|
114
|
-
const toastZIndex = useLayerZIndex();
|
|
115
|
-
|
|
116
112
|
const handleClose = () => {
|
|
117
113
|
isVisible.value = false;
|
|
118
114
|
emit('close');
|
|
@@ -156,6 +152,7 @@ onUnmounted(() => {
|
|
|
156
152
|
position: fixed;
|
|
157
153
|
bottom: $unnnic-space-4;
|
|
158
154
|
right: $unnnic-space-4;
|
|
155
|
+
z-index: 9999;
|
|
159
156
|
|
|
160
157
|
display: flex;
|
|
161
158
|
align-items: flex-end;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createApp } from 'vue';
|
|
2
|
-
import { getTeleportContainer } from '@/lib/teleport-target';
|
|
3
2
|
import Toast from './Toast.vue';
|
|
4
3
|
import type {
|
|
5
4
|
ToastProps,
|
|
@@ -21,9 +20,7 @@ class ToastManager implements ToastManager {
|
|
|
21
20
|
this.container = document.createElement('div');
|
|
22
21
|
this.container.setAttribute('unnnic-toast-container', 'true');
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
host?.appendChild(this.container);
|
|
26
|
-
|
|
23
|
+
document.body.appendChild(this.container);
|
|
27
24
|
return this.container;
|
|
28
25
|
}
|
|
29
26
|
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, afterEach, test, vi } from 'vitest';
|
|
2
2
|
|
|
3
|
-
vi.mock('vue',
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
unmount: vi.fn(),
|
|
10
|
-
})),
|
|
11
|
-
};
|
|
12
|
-
});
|
|
3
|
+
vi.mock('vue', () => ({
|
|
4
|
+
createApp: vi.fn(() => ({
|
|
5
|
+
mount: vi.fn(),
|
|
6
|
+
unmount: vi.fn(),
|
|
7
|
+
})),
|
|
8
|
+
}));
|
|
13
9
|
|
|
14
10
|
vi.mock('../Toast.vue', () => ({
|
|
15
11
|
default: {
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
:
|
|
5
|
-
|
|
2
|
+
<div
|
|
3
|
+
ref="tooltip"
|
|
4
|
+
:class="{
|
|
5
|
+
'unnnic-tooltip': enabled || forceOpen,
|
|
6
|
+
'force-open': forceOpen,
|
|
7
|
+
}"
|
|
8
|
+
@mouseover="handleResize"
|
|
6
9
|
>
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<TooltipContent
|
|
10
|
+
<slot />
|
|
11
|
+
<span
|
|
12
|
+
v-show="enabled || forceOpen"
|
|
13
|
+
ref="label"
|
|
12
14
|
:class="['unnnic-tooltip-label', `unnnic-tooltip-label-${side}`]"
|
|
13
|
-
:style="{ maxWidth: maxWidth }"
|
|
14
|
-
|
|
15
|
-
data-testid="tooltip-content"
|
|
15
|
+
:style="{ maxWidth: maxWidth, left: leftPos, top: topPos }"
|
|
16
|
+
data-testid="tooltip-label"
|
|
16
17
|
>
|
|
17
18
|
<template v-if="enableHtml">
|
|
18
19
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
19
|
-
<section
|
|
20
|
-
v-html="text"
|
|
21
|
-
data-testid="tooltip-html-content"
|
|
22
|
-
></section>
|
|
20
|
+
<section v-html="text"></section>
|
|
23
21
|
</template>
|
|
24
22
|
<template
|
|
25
23
|
v-for="(line, index) in text.split('\n')"
|
|
@@ -29,20 +27,22 @@
|
|
|
29
27
|
{{ line }}
|
|
30
28
|
<br />
|
|
31
29
|
</template>
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
|
|
31
|
+
<template v-if="shortcutText">
|
|
32
|
+
<span
|
|
33
|
+
class="unnnic-tooltip-label-shortcut"
|
|
34
|
+
data-testid="tooltip-label-shortcut"
|
|
35
|
+
>
|
|
36
|
+
{{ shortcutText }}
|
|
37
|
+
</span>
|
|
38
|
+
</template>
|
|
39
|
+
</span>
|
|
40
|
+
</div>
|
|
34
41
|
</template>
|
|
35
42
|
|
|
36
43
|
<script>
|
|
37
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
|
38
|
-
|
|
39
44
|
export default {
|
|
40
45
|
name: 'UnnnicTooltip',
|
|
41
|
-
components: {
|
|
42
|
-
Tooltip,
|
|
43
|
-
TooltipTrigger,
|
|
44
|
-
TooltipContent,
|
|
45
|
-
},
|
|
46
46
|
props: {
|
|
47
47
|
text: {
|
|
48
48
|
type: String,
|
|
@@ -67,10 +67,162 @@ export default {
|
|
|
67
67
|
type: String,
|
|
68
68
|
default: '',
|
|
69
69
|
},
|
|
70
|
+
shortcutText: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: null,
|
|
73
|
+
},
|
|
70
74
|
enableHtml: {
|
|
71
75
|
type: Boolean,
|
|
72
76
|
default: false,
|
|
73
77
|
},
|
|
74
78
|
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
topPos: null,
|
|
82
|
+
leftPos: null,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
watch: {
|
|
86
|
+
side() {
|
|
87
|
+
this.getRightPost(this.$refs.tooltip);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
mounted() {
|
|
91
|
+
this.handleResize();
|
|
92
|
+
|
|
93
|
+
window.addEventListener('scroll', this.handleResize);
|
|
94
|
+
window.addEventListener('resize', this.handleResize);
|
|
95
|
+
},
|
|
96
|
+
unmounted() {
|
|
97
|
+
window.removeEventListener('scroll', this.handleResize);
|
|
98
|
+
window.removeEventListener('resize', this.handleResize);
|
|
99
|
+
},
|
|
100
|
+
methods: {
|
|
101
|
+
handleResize() {
|
|
102
|
+
this.getRightPost(this.$refs.tooltip);
|
|
103
|
+
},
|
|
104
|
+
getRightPost(element) {
|
|
105
|
+
const elementPos = element.getBoundingClientRect();
|
|
106
|
+
|
|
107
|
+
if (element && this.$refs.label) {
|
|
108
|
+
if (this.side === 'right') {
|
|
109
|
+
this.leftPos = `${elementPos.x + elementPos.width + 8}px`;
|
|
110
|
+
this.topPos = `${elementPos.y + elementPos.height / 2 - this.$refs.label.offsetHeight / 2}px`;
|
|
111
|
+
} else if (this.side === 'left') {
|
|
112
|
+
this.leftPos = `${elementPos.x - this.$refs.label.offsetWidth - 8}px`;
|
|
113
|
+
this.topPos = `${elementPos.y + elementPos.height / 2 - this.$refs.label.offsetHeight / 2}px`;
|
|
114
|
+
} else if (this.side === 'top') {
|
|
115
|
+
this.leftPos = `${elementPos.x + elementPos.width / 2 - this.$refs.label.clientWidth / 2}px`;
|
|
116
|
+
this.topPos = `${elementPos.y - this.$refs.label.offsetHeight - 8}px`;
|
|
117
|
+
} else if (this.side === 'bottom') {
|
|
118
|
+
this.leftPos = `${elementPos.x + elementPos.width / 2 - this.$refs.label.clientWidth / 2}px`;
|
|
119
|
+
this.topPos = `${elementPos.y + elementPos.height + 8}px`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
},
|
|
75
124
|
};
|
|
76
125
|
</script>
|
|
126
|
+
|
|
127
|
+
<style lang="scss" scoped>
|
|
128
|
+
@use '@/assets/scss/unnnic' as *;
|
|
129
|
+
|
|
130
|
+
.unnnic-tooltip {
|
|
131
|
+
position: relative;
|
|
132
|
+
display: inline-block;
|
|
133
|
+
overflow-wrap: break-word;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.unnnic-tooltip-label {
|
|
137
|
+
z-index: 1;
|
|
138
|
+
visibility: hidden;
|
|
139
|
+
text-align: center;
|
|
140
|
+
position: fixed;
|
|
141
|
+
width: max-content;
|
|
142
|
+
min-width: 2 * $unnnic-font-size;
|
|
143
|
+
box-sizing: border-box;
|
|
144
|
+
width: auto;
|
|
145
|
+
display: flex;
|
|
146
|
+
justify-content: center;
|
|
147
|
+
gap: $unnnic-spacing-xs;
|
|
148
|
+
align-items: center;
|
|
149
|
+
|
|
150
|
+
background-color: $unnnic-color-neutral-black;
|
|
151
|
+
color: $unnnic-color-neutral-snow;
|
|
152
|
+
border-radius: $unnnic-border-radius-sm;
|
|
153
|
+
padding: $unnnic-inset-nano;
|
|
154
|
+
box-shadow: $unnnic-shadow-level-near;
|
|
155
|
+
font-size: $unnnic-font-size-body-md;
|
|
156
|
+
font-family: $unnnic-font-family-secondary;
|
|
157
|
+
font-weight: $unnnic-font-weight-regular;
|
|
158
|
+
line-height: ($unnnic-font-size-body-md + $unnnic-line-height-medium);
|
|
159
|
+
|
|
160
|
+
&::after {
|
|
161
|
+
content: '';
|
|
162
|
+
position: absolute;
|
|
163
|
+
border-width: 5px;
|
|
164
|
+
border-style: solid;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&-top {
|
|
168
|
+
position: fixed;
|
|
169
|
+
&::after {
|
|
170
|
+
top: 100%;
|
|
171
|
+
left: 50%;
|
|
172
|
+
margin-left: -5px;
|
|
173
|
+
border-color: $unnnic-color-neutral-black transparent transparent
|
|
174
|
+
transparent;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&-bottom {
|
|
179
|
+
position: fixed;
|
|
180
|
+
&::after {
|
|
181
|
+
bottom: 100%;
|
|
182
|
+
left: 50%;
|
|
183
|
+
margin-left: -5px;
|
|
184
|
+
border-color: transparent transparent $unnnic-color-neutral-black
|
|
185
|
+
transparent;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
&-right {
|
|
189
|
+
position: fixed;
|
|
190
|
+
&::after {
|
|
191
|
+
top: 50%;
|
|
192
|
+
right: 100%;
|
|
193
|
+
margin-top: -5px;
|
|
194
|
+
border-color: transparent $unnnic-color-neutral-black transparent
|
|
195
|
+
transparent;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
&-left {
|
|
199
|
+
position: fixed;
|
|
200
|
+
&::after {
|
|
201
|
+
top: 50%;
|
|
202
|
+
left: 100%;
|
|
203
|
+
margin-top: -5px;
|
|
204
|
+
border-color: transparent transparent transparent
|
|
205
|
+
$unnnic-color-neutral-black;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&-shortcut {
|
|
210
|
+
background-color: $unnnic-color-neutral-darkest;
|
|
211
|
+
border-radius: $unnnic-border-radius-sm;
|
|
212
|
+
padding: calc($unnnic-inset-nano / 2) $unnnic-inset-nano;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.unnnic-tooltip.force-open {
|
|
217
|
+
.unnnic-tooltip-label {
|
|
218
|
+
visibility: visible;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.unnnic-tooltip:hover {
|
|
223
|
+
.unnnic-tooltip-label {
|
|
224
|
+
visibility: visible;
|
|
225
|
+
width: auto;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
</style>
|