@weni/unnnic-system 3.2.5-alpha.0 → 3.2.5
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 +31 -0
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Chip/Chip.vue.d.ts +8 -0
- package/dist/components/Chip/Chip.vue.d.ts.map +1 -0
- package/dist/components/Chip/types.d.ts +9 -0
- package/dist/components/Chip/types.d.ts.map +1 -0
- package/dist/components/DatePicker/DatePicker.vue.d.ts +2 -2
- package/dist/components/Disclaimer/types.d.ts +1 -1
- package/dist/components/Disclaimer/types.d.ts.map +1 -1
- package/dist/components/DropArea/DropArea.vue.d.ts +0 -2
- package/dist/components/DropArea/DropArea.vue.d.ts.map +1 -1
- package/dist/components/FormElement/FormElement.vue.d.ts +1 -1
- package/dist/components/Icon/types.d.ts +2 -1
- package/dist/components/Icon/types.d.ts.map +1 -1
- package/dist/components/Icon.vue.d.ts +2 -1
- package/dist/components/Icon.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +3 -3
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +1 -1
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +0 -6
- package/dist/components/UploadArea/UploadArea.vue.d.ts +0 -6
- package/dist/components/index.d.ts +24 -54
- package/dist/components/index.d.ts.map +1 -1
- package/dist/{es-e4a6e990.mjs → es-a07e7553.mjs} +1 -1
- package/dist/{index-de083a7a.mjs → index-93aafec9.mjs} +7413 -7525
- package/dist/{pt-br-229e5ab3.mjs → pt-br-a81c613f.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +116 -118
- package/dist/unnnic.umd.js +41 -42
- package/package.json +2 -2
- package/src/assets/scss/scheme-colors.scss +132 -0
- package/src/assets/scss/unnnic.scss +2 -0
- package/src/components/Button/Button.vue +109 -58
- package/src/components/Button/types.ts +1 -0
- package/src/components/Card/Card.vue +12 -21
- package/src/components/Chip/Chip.vue +124 -0
- package/src/components/Chip/__tests__/Chip.spec.js +164 -0
- package/src/components/Chip/types.ts +8 -0
- package/src/components/Disclaimer/types.ts +1 -1
- package/src/components/DropArea/DropArea.vue +2 -26
- package/src/components/Icon/types.ts +4 -88
- package/src/components/Icon.vue +3 -91
- package/src/components/ModalDialog/ModalDialog.vue +29 -27
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
- package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
- package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
- package/src/components/index.ts +7 -12
- package/src/stories/Button.stories.js +10 -1
- package/src/stories/Chip.stories.js +173 -0
- package/src/types/scheme-colors.d.ts +102 -0
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
- package/src/assets/img/previews/doc-preview.png +0 -0
- package/src/assets/img/previews/image-preview.png +0 -0
- package/src/assets/img/previews/video-preview.png +0 -0
- package/src/components/TemplatePreview/TemplatePreview.vue +0 -249
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
- package/src/components/TemplatePreview/types.d.ts +0 -16
- package/src/stories/TemplatePreview.stories.js +0 -94
- package/src/stories/TemplatePreviewModal.stories.js +0 -110
package/src/components/index.ts
CHANGED
|
@@ -88,9 +88,8 @@ import ModalDialog from "./ModalDialog/ModalDialog.vue";
|
|
|
88
88
|
import Tour from "./Tour/Tour.vue";
|
|
89
89
|
import Navigator from "./Navigator/index.vue";
|
|
90
90
|
import SelectTime from "./SelectTime/index.vue";
|
|
91
|
-
import
|
|
92
|
-
import
|
|
93
|
-
import DataTable from './DataTable/index.vue';
|
|
91
|
+
import DataTable from "./DataTable/index.vue";
|
|
92
|
+
import Chip from "./Chip/Chip.vue";
|
|
94
93
|
|
|
95
94
|
type VueComponent = Component;
|
|
96
95
|
|
|
@@ -189,9 +188,8 @@ export const components: ComponentsMap = {
|
|
|
189
188
|
unnnicTour: Tour,
|
|
190
189
|
unnnicNavigator: Navigator,
|
|
191
190
|
unnnicSelectTime: SelectTime,
|
|
192
|
-
unnnicTemplatePreview: TemplatePreview,
|
|
193
|
-
unnnicTemplatePreviewModal: TemplatePreviewModal,
|
|
194
191
|
unnnicDataTable: DataTable,
|
|
192
|
+
unnnicChip: Chip,
|
|
195
193
|
};
|
|
196
194
|
|
|
197
195
|
export const unnnicFontSize = fontSize;
|
|
@@ -284,10 +282,9 @@ export const unnnicDrawer = Drawer;
|
|
|
284
282
|
export const unnnicTableNext = TableNext;
|
|
285
283
|
export const unnnicTour = Tour;
|
|
286
284
|
export const unnnicNavigator = Navigator;
|
|
287
|
-
export const unnnicSelectTime = SelectTime as VueComponent;
|
|
288
|
-
export const unnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
289
|
-
export const unnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
290
285
|
export const unnnicDataTable = DataTable as VueComponent;
|
|
286
|
+
export const unnnicSelectTime = SelectTime as VueComponent;
|
|
287
|
+
export const unnnicChip = Chip;
|
|
291
288
|
|
|
292
289
|
export const UnnnicFontSize = fontSize;
|
|
293
290
|
export const UnnnicFormElement = formElement;
|
|
@@ -379,8 +376,6 @@ export const UnnnicDrawer = Drawer;
|
|
|
379
376
|
export const UnnnicTableNext = TableNext;
|
|
380
377
|
export const UnnnicTour = Tour;
|
|
381
378
|
export const UnnnicNavigator = Navigator;
|
|
382
|
-
export const UnnnicSelectTime = SelectTime as VueComponent;
|
|
383
|
-
export const UnnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
384
|
-
export const UnnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
385
379
|
export const UnnnicDataTable = DataTable as VueComponent;
|
|
386
|
-
|
|
380
|
+
export const UnnnicSelectTime = SelectTime as VueComponent;
|
|
381
|
+
export const UnnnicChip = Chip;
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
description: {
|
|
9
9
|
component: `Allows users to perform an action or navigate to another page.
|
|
10
10
|
It has styles for various needs and are ideal for directing the user's attention.
|
|
11
|
-
It is divided into
|
|
11
|
+
It is divided into 6 types: Primary, Secondary, Tertiary, Alternative, Warning, Attention.
|
|
12
12
|
Each of these types has its states.
|
|
13
13
|
<br/>
|
|
14
14
|
<br/>
|
|
@@ -40,6 +40,7 @@ export default {
|
|
|
40
40
|
'primary',
|
|
41
41
|
'secondary',
|
|
42
42
|
'tertiary',
|
|
43
|
+
'alternative',
|
|
43
44
|
'warning',
|
|
44
45
|
'attention',
|
|
45
46
|
],
|
|
@@ -113,6 +114,14 @@ export const OnlyIcon = {
|
|
|
113
114
|
},
|
|
114
115
|
};
|
|
115
116
|
|
|
117
|
+
export const Alternative = {
|
|
118
|
+
args: {
|
|
119
|
+
type: 'alternative',
|
|
120
|
+
iconLeft: 'add',
|
|
121
|
+
text: 'Text',
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
116
125
|
export const Warning = {
|
|
117
126
|
parameters: {
|
|
118
127
|
docs: {
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import UnnnicChip from '../components/Chip/Chip.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Data Display/Chip',
|
|
5
|
+
component: UnnnicChip,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: `A simplified compact element used for selection and filtering.
|
|
11
|
+
Chips are commonly used to display tags, filters, or selectable options
|
|
12
|
+
with automatic styling based on selection state. They provide a clean
|
|
13
|
+
and organized way to show multiple related items with clear visual feedback.`,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
text: 'Chip Text',
|
|
19
|
+
type: 'single',
|
|
20
|
+
isSelected: false,
|
|
21
|
+
count: null,
|
|
22
|
+
isClickable: false,
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
type: {
|
|
26
|
+
control: { type: 'select' },
|
|
27
|
+
options: ['single', 'multiple'],
|
|
28
|
+
description: 'The type of chip - single for basic display, multiple for selection with icons',
|
|
29
|
+
},
|
|
30
|
+
text: {
|
|
31
|
+
control: { type: 'text' },
|
|
32
|
+
description: 'The text content displayed in the chip',
|
|
33
|
+
},
|
|
34
|
+
isSelected: {
|
|
35
|
+
control: { type: 'boolean' },
|
|
36
|
+
description: 'Whether the chip is in selected state (affects styling and icons)',
|
|
37
|
+
},
|
|
38
|
+
count: {
|
|
39
|
+
control: { type: 'number' },
|
|
40
|
+
description: 'Optional count number displayed in the chip',
|
|
41
|
+
},
|
|
42
|
+
isClickable: {
|
|
43
|
+
control: { type: 'boolean' },
|
|
44
|
+
description: 'Whether the chip should show clickable styling (cursor pointer)',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Default = {
|
|
50
|
+
args: {
|
|
51
|
+
text: 'Default Chip',
|
|
52
|
+
type: 'single',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const Selected = {
|
|
57
|
+
args: {
|
|
58
|
+
text: 'Selected Chip',
|
|
59
|
+
type: 'single',
|
|
60
|
+
isSelected: true,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const WithCount = {
|
|
65
|
+
args: {
|
|
66
|
+
text: 'Messages',
|
|
67
|
+
type: 'single',
|
|
68
|
+
count: 5,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const WithCountSelected = {
|
|
73
|
+
args: {
|
|
74
|
+
text: 'Selected Messages',
|
|
75
|
+
type: 'single',
|
|
76
|
+
count: 12,
|
|
77
|
+
isSelected: true,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const MultipleType = {
|
|
82
|
+
args: {
|
|
83
|
+
text: 'Multiple Chip',
|
|
84
|
+
type: 'multiple',
|
|
85
|
+
isSelected: false,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const MultipleSelected = {
|
|
90
|
+
args: {
|
|
91
|
+
text: 'Selected Multiple',
|
|
92
|
+
type: 'multiple',
|
|
93
|
+
isSelected: true,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const MultipleWithCount = {
|
|
98
|
+
args: {
|
|
99
|
+
text: 'Items',
|
|
100
|
+
type: 'multiple',
|
|
101
|
+
count: 8,
|
|
102
|
+
isSelected: false,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const MultipleWithCountSelected = {
|
|
107
|
+
args: {
|
|
108
|
+
text: 'Selected Items',
|
|
109
|
+
type: 'multiple',
|
|
110
|
+
count: 15,
|
|
111
|
+
isSelected: true,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const LongText = {
|
|
116
|
+
args: {
|
|
117
|
+
text: 'This is a chip with longer text content',
|
|
118
|
+
type: 'single',
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const LongTextSelected = {
|
|
123
|
+
args: {
|
|
124
|
+
text: 'This is a selected chip with longer text',
|
|
125
|
+
type: 'single',
|
|
126
|
+
isSelected: true,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const Clickable = {
|
|
131
|
+
args: {
|
|
132
|
+
text: 'Clickable Chip',
|
|
133
|
+
type: 'single',
|
|
134
|
+
isClickable: true,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const ClickableSelected = {
|
|
139
|
+
args: {
|
|
140
|
+
text: 'Clickable Selected',
|
|
141
|
+
type: 'multiple',
|
|
142
|
+
isSelected: true,
|
|
143
|
+
isClickable: true,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Interactive example showing state changes
|
|
148
|
+
export const Interactive = {
|
|
149
|
+
args: {
|
|
150
|
+
text: 'Click to toggle',
|
|
151
|
+
type: 'multiple',
|
|
152
|
+
count: 3,
|
|
153
|
+
isClickable: true,
|
|
154
|
+
},
|
|
155
|
+
render: (args) => ({
|
|
156
|
+
components: { UnnnicChip },
|
|
157
|
+
data() {
|
|
158
|
+
return {
|
|
159
|
+
selected: args.isSelected || false,
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
template: `
|
|
163
|
+
<UnnnicChip
|
|
164
|
+
:text="'${args.text}'"
|
|
165
|
+
:type="'${args.type}'"
|
|
166
|
+
:count="${args.count}"
|
|
167
|
+
:isSelected="selected"
|
|
168
|
+
:isClickable="true"
|
|
169
|
+
@click="selected = !selected"
|
|
170
|
+
/>
|
|
171
|
+
`,
|
|
172
|
+
}),
|
|
173
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export type SchemeColor =
|
|
2
|
+
| 'background-solo'
|
|
3
|
+
| 'background-sky'
|
|
4
|
+
| 'background-grass'
|
|
5
|
+
| 'background-carpet'
|
|
6
|
+
| 'background-snow'
|
|
7
|
+
| 'background-lightest'
|
|
8
|
+
| 'background-white'
|
|
9
|
+
| 'neutral-black'
|
|
10
|
+
| 'neutral-darkest'
|
|
11
|
+
| 'neutral-dark'
|
|
12
|
+
| 'neutral-cloudy'
|
|
13
|
+
| 'neutral-cleanest'
|
|
14
|
+
| 'neutral-clean'
|
|
15
|
+
| 'neutral-soft'
|
|
16
|
+
| 'neutral-lightest'
|
|
17
|
+
| 'neutral-light'
|
|
18
|
+
| 'neutral-white'
|
|
19
|
+
| 'neutral-snow'
|
|
20
|
+
| 'feedback-red'
|
|
21
|
+
| 'feedback-green'
|
|
22
|
+
| 'feedback-yellow'
|
|
23
|
+
| 'feedback-blue'
|
|
24
|
+
| 'feedback-grey'
|
|
25
|
+
| 'aux-blue'
|
|
26
|
+
| 'aux-purple'
|
|
27
|
+
| 'aux-orange'
|
|
28
|
+
| 'aux-lemon'
|
|
29
|
+
| 'aux-pink'
|
|
30
|
+
| 'aux-baby-blue'
|
|
31
|
+
| 'aux-baby-yellow'
|
|
32
|
+
| 'aux-baby-red'
|
|
33
|
+
| 'aux-baby-green'
|
|
34
|
+
| 'aux-baby-pink'
|
|
35
|
+
| 'aux-green-100'
|
|
36
|
+
| 'aux-green-300'
|
|
37
|
+
| 'aux-green-500'
|
|
38
|
+
| 'aux-green-700'
|
|
39
|
+
| 'aux-green-900'
|
|
40
|
+
| 'aux-blue-100'
|
|
41
|
+
| 'aux-blue-300'
|
|
42
|
+
| 'aux-blue-500'
|
|
43
|
+
| 'aux-blue-700'
|
|
44
|
+
| 'aux-blue-900'
|
|
45
|
+
| 'aux-purple-100'
|
|
46
|
+
| 'aux-purple-300'
|
|
47
|
+
| 'aux-purple-500'
|
|
48
|
+
| 'aux-purple-700'
|
|
49
|
+
| 'aux-purple-900'
|
|
50
|
+
| 'aux-red-100'
|
|
51
|
+
| 'aux-red-300'
|
|
52
|
+
| 'aux-red-500'
|
|
53
|
+
| 'aux-red-700'
|
|
54
|
+
| 'aux-red-900'
|
|
55
|
+
| 'aux-orange-100'
|
|
56
|
+
| 'aux-orange-300'
|
|
57
|
+
| 'aux-orange-500'
|
|
58
|
+
| 'aux-orange-700'
|
|
59
|
+
| 'aux-orange-900'
|
|
60
|
+
| 'aux-yellow-100'
|
|
61
|
+
| 'aux-yellow-300'
|
|
62
|
+
| 'aux-yellow-500'
|
|
63
|
+
| 'aux-yellow-700'
|
|
64
|
+
| 'aux-yellow-900'
|
|
65
|
+
| 'floweditor-blue'
|
|
66
|
+
| 'floweditor-purple'
|
|
67
|
+
| 'floweditor-wine'
|
|
68
|
+
| 'floweditor-orange'
|
|
69
|
+
| 'floweditor-pink'
|
|
70
|
+
| 'floweditor-turquoise'
|
|
71
|
+
| 'floweditor-green'
|
|
72
|
+
| 'weni-50'
|
|
73
|
+
| 'weni-100'
|
|
74
|
+
| 'weni-200'
|
|
75
|
+
| 'weni-300'
|
|
76
|
+
| 'weni-400'
|
|
77
|
+
| 'weni-500'
|
|
78
|
+
| 'weni-600'
|
|
79
|
+
| 'weni-700'
|
|
80
|
+
| 'weni-800'
|
|
81
|
+
| 'weni-900'
|
|
82
|
+
| 'weni-950'
|
|
83
|
+
| 'brand-weni'
|
|
84
|
+
| 'brand-weni-dark'
|
|
85
|
+
| 'brand-weni-soft'
|
|
86
|
+
| 'brand-sec-dark'
|
|
87
|
+
| 'brand-sec-soft'
|
|
88
|
+
| 'brand-sec'
|
|
89
|
+
| 'bg-base'
|
|
90
|
+
| 'bg-soft'
|
|
91
|
+
| 'teal-50'
|
|
92
|
+
| 'teal-100'
|
|
93
|
+
| 'teal-200'
|
|
94
|
+
| 'teal-300'
|
|
95
|
+
| 'teal-400'
|
|
96
|
+
| 'teal-500'
|
|
97
|
+
| 'teal-600'
|
|
98
|
+
| 'teal-700'
|
|
99
|
+
| 'teal-800'
|
|
100
|
+
| 'teal-900'
|
|
101
|
+
| 'teal-950';
|
|
102
|
+
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Template } from './types';
|
|
2
|
-
interface Props {
|
|
3
|
-
template?: Template | null;
|
|
4
|
-
}
|
|
5
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
6
|
-
template: Template | null;
|
|
7
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
|
|
8
|
-
export default _default;
|
|
9
|
-
//# sourceMappingURL=TemplatePreview.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TemplatePreview.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TemplatePreview/TemplatePreview.vue"],"names":[],"mappings":"AAgGA;AA6PA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQxC,UAAU,KAAK;IACb,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC5B;;cADY,QAAQ,GAAG,IAAI;;AAkN5B,wBAQG"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Template } from './types';
|
|
2
|
-
interface Props {
|
|
3
|
-
locale?: string;
|
|
4
|
-
template: Template;
|
|
5
|
-
modelValue: boolean;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
8
|
-
close: () => any;
|
|
9
|
-
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
10
|
-
onClose?: (() => any) | undefined;
|
|
11
|
-
}>, {
|
|
12
|
-
locale: string;
|
|
13
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
-
export default _default;
|
|
15
|
-
//# sourceMappingURL=TemplatePreviewModal.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TemplatePreviewModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TemplatePreview/TemplatePreviewModal.vue"],"names":[],"mappings":"AAWA;AAwDA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAUxC,UAAU,KAAK;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;;;;;;YAHU,MAAM;;AAgGjB,wBASG"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="unnnic-template-preview">
|
|
3
|
-
<section
|
|
4
|
-
:class="[
|
|
5
|
-
'unnnic-template-preview__content',
|
|
6
|
-
{ 'unnnic-template-preview__content--has-media': hasHeaderMedia },
|
|
7
|
-
]"
|
|
8
|
-
>
|
|
9
|
-
<header
|
|
10
|
-
v-if="hasHeader"
|
|
11
|
-
:class="`unnnic-template-preview__header__${
|
|
12
|
-
template?.header.type === 'TEXT' ? 'text' : 'media'
|
|
13
|
-
}`"
|
|
14
|
-
>
|
|
15
|
-
<img
|
|
16
|
-
class="unnnic-template-preview__header__media__preview"
|
|
17
|
-
v-if="
|
|
18
|
-
template?.header.type === 'MEDIA' &&
|
|
19
|
-
template?.header.mediaType === 'IMAGE'
|
|
20
|
-
"
|
|
21
|
-
:src="template.header.src || imagePreview"
|
|
22
|
-
/>
|
|
23
|
-
<template
|
|
24
|
-
v-else-if="
|
|
25
|
-
template?.header.type === 'MEDIA' &&
|
|
26
|
-
template?.header.mediaType === 'VIDEO'
|
|
27
|
-
"
|
|
28
|
-
>
|
|
29
|
-
<video
|
|
30
|
-
v-if="template.header.src"
|
|
31
|
-
class="unnnic-template-preview__header__media__preview"
|
|
32
|
-
:src="template.header.src"
|
|
33
|
-
controls
|
|
34
|
-
/>
|
|
35
|
-
<img
|
|
36
|
-
v-else
|
|
37
|
-
class="unnnic-template-preview__header__media__preview"
|
|
38
|
-
:src="videoPreview"
|
|
39
|
-
/>
|
|
40
|
-
</template>
|
|
41
|
-
<template
|
|
42
|
-
v-else-if="
|
|
43
|
-
template?.header.type === 'MEDIA' &&
|
|
44
|
-
template?.header.mediaType === 'DOCUMENT'
|
|
45
|
-
"
|
|
46
|
-
>
|
|
47
|
-
<img
|
|
48
|
-
class="unnnic-template-preview__header__media__preview"
|
|
49
|
-
:src="documentPreview"
|
|
50
|
-
/>
|
|
51
|
-
</template>
|
|
52
|
-
<h1
|
|
53
|
-
class="unnnic-template-preview__header__text__preview"
|
|
54
|
-
v-else-if="template?.header.type === 'TEXT'"
|
|
55
|
-
>
|
|
56
|
-
{{ template.header.text }}
|
|
57
|
-
</h1>
|
|
58
|
-
</header>
|
|
59
|
-
<section
|
|
60
|
-
v-if="hasBody"
|
|
61
|
-
:class="[
|
|
62
|
-
'unnnic-template-preview__body',
|
|
63
|
-
{ 'unnnic-template-preview__body--has-media': hasHeaderMedia },
|
|
64
|
-
]"
|
|
65
|
-
>
|
|
66
|
-
<section v-html="parsedBody"></section>
|
|
67
|
-
</section>
|
|
68
|
-
<footer
|
|
69
|
-
v-if="hasFooter"
|
|
70
|
-
:class="[
|
|
71
|
-
'unnnic-template-preview__footer',
|
|
72
|
-
{ 'unnnic-template-preview__footer--has-media': hasHeaderMedia },
|
|
73
|
-
]"
|
|
74
|
-
>
|
|
75
|
-
{{ template?.footer }}
|
|
76
|
-
</footer>
|
|
77
|
-
</section>
|
|
78
|
-
<footer v-if="hasButtons" class="unnnic-template-preview__buttons">
|
|
79
|
-
<section
|
|
80
|
-
v-for="(button, index) in template?.buttons"
|
|
81
|
-
:key="`button-${index}`"
|
|
82
|
-
class="unnnic-template-preview__buttons__button"
|
|
83
|
-
>
|
|
84
|
-
<UnnnicIcon
|
|
85
|
-
class="unnnic-template-preview__buttons__button__icon"
|
|
86
|
-
:icon="getButtonIcon(button.type)"
|
|
87
|
-
scheme="aux-blue-500"
|
|
88
|
-
size="ant"
|
|
89
|
-
/>
|
|
90
|
-
<p class="unnnic-template-preview__buttons__button__text">
|
|
91
|
-
{{ button.text }}
|
|
92
|
-
</p>
|
|
93
|
-
</section>
|
|
94
|
-
</footer>
|
|
95
|
-
</section>
|
|
96
|
-
</template>
|
|
97
|
-
|
|
98
|
-
<script lang="ts" setup>
|
|
99
|
-
import { computed } from "vue";
|
|
100
|
-
|
|
101
|
-
import type { Template } from "./types";
|
|
102
|
-
|
|
103
|
-
import imagePreview from "../../assets/img/previews/image-preview.png";
|
|
104
|
-
import documentPreview from "../../assets/img/previews/doc-preview.png";
|
|
105
|
-
import videoPreview from "../../assets/img/previews/video-preview.png";
|
|
106
|
-
|
|
107
|
-
import UnnnicIcon from "../Icon.vue";
|
|
108
|
-
|
|
109
|
-
interface Props {
|
|
110
|
-
template?: Template | null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
114
|
-
template: null,
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const hasHeader = computed(
|
|
118
|
-
() => props.template?.header && props.template.header.type
|
|
119
|
-
);
|
|
120
|
-
const hasHeaderMedia = computed(
|
|
121
|
-
() => !!props.template?.header && props.template.header.type === "MEDIA"
|
|
122
|
-
);
|
|
123
|
-
const hasBody = computed(
|
|
124
|
-
() => !!props.template?.body && props.template.body.length > 0
|
|
125
|
-
);
|
|
126
|
-
const hasFooter = computed(
|
|
127
|
-
() => !!props.template?.footer && props.template.footer.length > 0
|
|
128
|
-
);
|
|
129
|
-
const hasButtons = computed(
|
|
130
|
-
() => !!props.template?.buttons && props.template.buttons.length > 0
|
|
131
|
-
);
|
|
132
|
-
const parsedBody = computed(() => {
|
|
133
|
-
if (!hasBody.value) return "";
|
|
134
|
-
|
|
135
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
136
|
-
const result = props
|
|
137
|
-
.template!.body!.replaceAll("\n", "<br/>")
|
|
138
|
-
.replaceAll(/(?:\*)([^*<\n]+)(?:\*)/g, "<strong>$1</strong>")
|
|
139
|
-
.replaceAll(/(?:_)([^_<\n]+)(?:_)/g, "<i>$1</i>")
|
|
140
|
-
.replaceAll(/(?:~)([^~<\n]+)(?:~)/g, "<s>$1</s>")
|
|
141
|
-
.replaceAll(/(?:```)([^```<\n]+)(?:```)/g, "<tt>$1</tt>")
|
|
142
|
-
.replaceAll(/{{.*?}}/g, (match) => `<strong>${match}</strong>`);
|
|
143
|
-
|
|
144
|
-
return result;
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
const getButtonIcon = (buttonType) => {
|
|
148
|
-
const buttonMapper = {
|
|
149
|
-
PHONE_NUMBER: "phone",
|
|
150
|
-
URL: "open_in_new",
|
|
151
|
-
COPY_CODE: "content_copy",
|
|
152
|
-
FLOW: "",
|
|
153
|
-
QUICK_REPLY: "reply",
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
return buttonMapper[buttonType] || "";
|
|
157
|
-
};
|
|
158
|
-
</script>
|
|
159
|
-
|
|
160
|
-
<style lang="scss" scoped>
|
|
161
|
-
@use "@/assets/scss/unnnic" as *;
|
|
162
|
-
|
|
163
|
-
.unnnic-template-preview {
|
|
164
|
-
display: flex;
|
|
165
|
-
flex-direction: column;
|
|
166
|
-
box-shadow: $unnnic-shadow-level-near;
|
|
167
|
-
background-color: $unnnic-color-background-white;
|
|
168
|
-
width: 368px;
|
|
169
|
-
border-radius: $unnnic-border-radius-md;
|
|
170
|
-
|
|
171
|
-
&__content {
|
|
172
|
-
display: flex;
|
|
173
|
-
flex-direction: column;
|
|
174
|
-
gap: $unnnic-space-3;
|
|
175
|
-
padding: $unnnic-space-4 $unnnic-space-3;
|
|
176
|
-
|
|
177
|
-
&--has-media {
|
|
178
|
-
padding: $unnnic-space-1;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
&__header {
|
|
183
|
-
&__text {
|
|
184
|
-
&__preview {
|
|
185
|
-
font-family: $unnnic-font-family-secondary;
|
|
186
|
-
font-weight: $unnnic-font-weight-bold;
|
|
187
|
-
font-size: $unnnic-font-size-body-gt;
|
|
188
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
189
|
-
color: $unnnic-color-neutral-dark;
|
|
190
|
-
|
|
191
|
-
margin: $unnnic-space-0;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
&__media {
|
|
196
|
-
&__preview {
|
|
197
|
-
width: 100%;
|
|
198
|
-
object-fit: cover;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&__body {
|
|
204
|
-
font-family: $unnnic-font-family-secondary;
|
|
205
|
-
font-weight: $unnnic-font-weight-regular;
|
|
206
|
-
font-size: $unnnic-font-size-body-gt;
|
|
207
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
208
|
-
color: $unnnic-color-neutral-cloudy;
|
|
209
|
-
|
|
210
|
-
&--has-media {
|
|
211
|
-
padding: $unnnic-space-0 $unnnic-space-2;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
&__footer {
|
|
216
|
-
font-family: $unnnic-font-family-secondary;
|
|
217
|
-
font-weight: $unnnic-font-weight-regular;
|
|
218
|
-
font-size: $unnnic-font-size-body-md;
|
|
219
|
-
line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
|
|
220
|
-
color: $unnnic-color-neutral-clean;
|
|
221
|
-
|
|
222
|
-
&--has-media {
|
|
223
|
-
padding: $unnnic-space-0 $unnnic-space-3 $unnnic-space-2;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
&__buttons {
|
|
228
|
-
font-family: $unnnic-font-family-secondary;
|
|
229
|
-
font-weight: $unnnic-font-weight-bold;
|
|
230
|
-
font-size: $unnnic-font-size-body-gt;
|
|
231
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
232
|
-
|
|
233
|
-
&__button {
|
|
234
|
-
margin: 0;
|
|
235
|
-
display: flex;
|
|
236
|
-
align-items: center;
|
|
237
|
-
justify-content: center;
|
|
238
|
-
gap: $unnnic-space-2;
|
|
239
|
-
padding: $unnnic-space-3;
|
|
240
|
-
border-top: 1px solid $unnnic-color-neutral-light;
|
|
241
|
-
|
|
242
|
-
&__text {
|
|
243
|
-
color: $unnnic-color-aux-blue-500;
|
|
244
|
-
margin: $unnnic-space-0;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
</style>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<UnnnicModalDialog
|
|
3
|
-
:model-value="modelValue"
|
|
4
|
-
@update:modelValue="$event === false && $emit('close')"
|
|
5
|
-
:title="defaultTranslations.title[props.locale]"
|
|
6
|
-
:show-close-icon="true"
|
|
7
|
-
class="unnnic-template-preview-modal"
|
|
8
|
-
>
|
|
9
|
-
<UnnnicTemplatePreview :template="template" />
|
|
10
|
-
</UnnnicModalDialog>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script lang="ts" setup>
|
|
14
|
-
import UnnnicTemplatePreview from "./TemplatePreview.vue";
|
|
15
|
-
import UnnnicModalDialog from "../ModalDialog/ModalDialog.vue";
|
|
16
|
-
|
|
17
|
-
import type { Template } from "./types";
|
|
18
|
-
|
|
19
|
-
const defaultTranslations = {
|
|
20
|
-
title: {
|
|
21
|
-
"pt-br": "Visualizar modelo",
|
|
22
|
-
en: "Template preview",
|
|
23
|
-
es: "Vista previa de plantilla",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
interface Props {
|
|
28
|
-
locale?: string;
|
|
29
|
-
template: Template;
|
|
30
|
-
modelValue: boolean;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
34
|
-
locale: "en",
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
defineEmits<{
|
|
38
|
-
close: void;
|
|
39
|
-
}>();
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<style lang="scss" scoped>
|
|
43
|
-
@use "@/assets/scss/unnnic" as *;
|
|
44
|
-
|
|
45
|
-
:deep(.unnnic-modal-dialog__container__content) {
|
|
46
|
-
display: flex;
|
|
47
|
-
align-items: center;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
background-color: $unnnic-color-neutral-lightest;
|
|
50
|
-
}
|
|
51
|
-
</style>
|