@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,16 +1,13 @@
|
|
|
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';
|
|
7
4
|
|
|
8
5
|
import { action } from '@storybook/addon-actions';
|
|
9
6
|
import iconsList from '../utils/iconList';
|
|
10
7
|
import colorsList from '../utils/colorsList';
|
|
11
8
|
|
|
12
9
|
export default {
|
|
13
|
-
title: '
|
|
10
|
+
title: 'Example/ModalDialog',
|
|
14
11
|
component: UnnnicModalDialog,
|
|
15
12
|
argTypes: {
|
|
16
13
|
type: {
|
|
@@ -185,85 +182,6 @@ const TemplateLeftSidebar = (args) => ({
|
|
|
185
182
|
},
|
|
186
183
|
});
|
|
187
184
|
|
|
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
|
-
|
|
267
185
|
export const Default = Template.bind({});
|
|
268
186
|
Default.args = {
|
|
269
187
|
title: 'Default Modal',
|
|
@@ -343,16 +261,3 @@ Image.args = {
|
|
|
343
261
|
},
|
|
344
262
|
showActionsDivider: true,
|
|
345
263
|
};
|
|
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
|
-
};
|
|
@@ -82,6 +82,18 @@ export default {
|
|
|
82
82
|
disabled: {
|
|
83
83
|
description: 'Disable the select.',
|
|
84
84
|
},
|
|
85
|
+
infiniteScroll: {
|
|
86
|
+
description:
|
|
87
|
+
'Enable infinite scroll functionality. When enabled, the component will emit a `scroll-end` event when the user scrolls near the bottom of the options list.',
|
|
88
|
+
},
|
|
89
|
+
infiniteScrollDistance: {
|
|
90
|
+
description:
|
|
91
|
+
'Distance in pixels from the bottom of the scroll area to trigger the `scroll-end` event. Default is 10.',
|
|
92
|
+
},
|
|
93
|
+
infiniteScrollCanLoadMore: {
|
|
94
|
+
description:
|
|
95
|
+
'Function that returns a boolean indicating whether more items can be loaded. Used to prevent unnecessary scroll-end events.',
|
|
96
|
+
},
|
|
85
97
|
},
|
|
86
98
|
render: (args) => ({
|
|
87
99
|
components: { UnnnicSelect },
|
|
@@ -159,3 +171,77 @@ export const WithSearch = {
|
|
|
159
171
|
search: '',
|
|
160
172
|
},
|
|
161
173
|
};
|
|
174
|
+
|
|
175
|
+
export const WithInfiniteScroll = {
|
|
176
|
+
render: () => ({
|
|
177
|
+
components: { UnnnicSelect },
|
|
178
|
+
data() {
|
|
179
|
+
return {
|
|
180
|
+
selectedValue: null,
|
|
181
|
+
loadedOptions: [],
|
|
182
|
+
currentPage: 1,
|
|
183
|
+
totalPages: 10,
|
|
184
|
+
isLoading: false,
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
mounted() {
|
|
188
|
+
this.loadInitialOptions();
|
|
189
|
+
},
|
|
190
|
+
methods: {
|
|
191
|
+
loadInitialOptions() {
|
|
192
|
+
this.loadedOptions = this.generateOptions(1);
|
|
193
|
+
},
|
|
194
|
+
generateOptions(page) {
|
|
195
|
+
const startIndex = (page - 1) * 10 + 1;
|
|
196
|
+
return Array.from({ length: 10 }, (_, i) => ({
|
|
197
|
+
label: `Option ${startIndex + i}`,
|
|
198
|
+
value: `option${startIndex + i}`,
|
|
199
|
+
}));
|
|
200
|
+
},
|
|
201
|
+
async handleScrollEnd() {
|
|
202
|
+
if (this.currentPage >= this.totalPages || this.isLoading) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
this.isLoading = true;
|
|
207
|
+
|
|
208
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
209
|
+
|
|
210
|
+
this.currentPage++;
|
|
211
|
+
const newOptions = this.generateOptions(this.currentPage);
|
|
212
|
+
this.loadedOptions = [...this.loadedOptions, ...newOptions];
|
|
213
|
+
|
|
214
|
+
this.isLoading = false;
|
|
215
|
+
|
|
216
|
+
this.$refs.selectRef.finishInfiniteScroll();
|
|
217
|
+
},
|
|
218
|
+
canLoadMore() {
|
|
219
|
+
return this.currentPage < this.totalPages && !this.isLoading;
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
template: `
|
|
223
|
+
<div style="width: 300px;">
|
|
224
|
+
<h3>Infinite Scroll Example</h3>
|
|
225
|
+
<p style="color: #666; font-size: 14px;">
|
|
226
|
+
Scroll down in the options list to load more items.
|
|
227
|
+
<br />
|
|
228
|
+
Page: {{ currentPage }} / {{ totalPages }}
|
|
229
|
+
<br />
|
|
230
|
+
Total options: {{ loadedOptions.length }}
|
|
231
|
+
</p>
|
|
232
|
+
<p>Selected: {{ selectedValue }}</p>
|
|
233
|
+
<unnnic-select
|
|
234
|
+
ref="selectRef"
|
|
235
|
+
v-model="selectedValue"
|
|
236
|
+
:options="loadedOptions"
|
|
237
|
+
placeholder="Select an option"
|
|
238
|
+
label="Infinite Scroll Select"
|
|
239
|
+
:infinite-scroll="true"
|
|
240
|
+
:infinite-scroll-distance="10"
|
|
241
|
+
:infinite-scroll-can-load-more="canLoadMore"
|
|
242
|
+
@scroll-end="handleScrollEnd"
|
|
243
|
+
/>
|
|
244
|
+
</div>
|
|
245
|
+
`,
|
|
246
|
+
}),
|
|
247
|
+
};
|
|
@@ -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>
|
|
@@ -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>
|