@weni/unnnic-system 3.1.2-alpha.1 → 3.1.2
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 +15 -0
- package/dist/components/DatePicker/DatePicker.vue.d.ts +2 -2
- package/dist/components/DropArea/DropArea.vue.d.ts +0 -2
- package/dist/components/DropArea/DropArea.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 +40344 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/{es-a3fefe6b.mjs → es-b95265ef.mjs} +1 -1
- package/dist/{index-5b99e353.mjs → index-d6c4fffb.mjs} +8974 -9131
- package/dist/{pt-br-8aded404.mjs → pt-br-80b6b07a.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +24 -26
- package/dist/unnnic.umd.js +43 -44
- package/package.json +2 -2
- package/src/assets/scss/colors.scss +58 -26
- package/src/components/DropArea/DropArea.vue +0 -17
- package/src/components/ModalDialog/ModalDialog.vue +29 -27
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
- package/src/components/index.ts +2 -8
- 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/package.json
CHANGED
|
@@ -169,6 +169,38 @@ $unnnic-color-brand-sec-dark: $unnnic-color-neutral-black;
|
|
|
169
169
|
$unnnic-color-brand-sec-soft: $unnnic-color-neutral-dark;
|
|
170
170
|
$unnnic-color-brand-sec: $unnnic-color-neutral-cleanest;
|
|
171
171
|
|
|
172
|
+
/* Semantic Background Colors */
|
|
173
|
+
$unnnic-color-bg-base: $unnnic-color-white;
|
|
174
|
+
$unnnic-color-bg-soft: $unnnic-color-gray-50;
|
|
175
|
+
$unnnic-color-bg-muted: $unnnic-color-gray-100;
|
|
176
|
+
$unnnic-color-bg-active: $unnnic-color-teal-600;
|
|
177
|
+
$unnnic-color-bg-info: $unnnic-color-aux-blue-100;
|
|
178
|
+
$unnnic-color-bg-success: $unnnic-color-aux-green-100;
|
|
179
|
+
$unnnic-color-bg-warning: $unnnic-color-aux-yellow-50;
|
|
180
|
+
$unnnic-color-bg-critical: $unnnic-color-aux-red-50;
|
|
181
|
+
|
|
182
|
+
/* Semantic Text Colors */
|
|
183
|
+
$unnnic-color-fg-base: $unnnic-color-gray-500;
|
|
184
|
+
$unnnic-color-fg-muted: $unnnic-color-gray-300;
|
|
185
|
+
$unnnic-color-fg-emphasized: $unnnic-color-gray-900;
|
|
186
|
+
$unnnic-color-fg-inverted: $unnnic-color-white;
|
|
187
|
+
$unnnic-color-fg-active: $unnnic-color-teal-600;
|
|
188
|
+
$unnnic-color-fg-info: $unnnic-color-aux-blue-500;
|
|
189
|
+
$unnnic-color-fg-success: $unnnic-color-aux-green-500;
|
|
190
|
+
$unnnic-color-fg-warning: $unnnic-color-aux-yellow-500;
|
|
191
|
+
$unnnic-color-fg-critical: $unnnic-color-aux-red-500;
|
|
192
|
+
|
|
193
|
+
/* Semantic Border Colors */
|
|
194
|
+
$unnnic-color-border-base: $unnnic-color-gray-200;
|
|
195
|
+
$unnnic-color-border-soft: $unnnic-color-gray-100;
|
|
196
|
+
$unnnic-color-border-muted: $unnnic-color-gray-200;
|
|
197
|
+
$unnnic-color-border-emphasized: $unnnic-color-gray-400;
|
|
198
|
+
$unnnic-color-border-active: $unnnic-color-teal-600;
|
|
199
|
+
$unnnic-color-border-info: $unnnic-color-aux-blue-300;
|
|
200
|
+
$unnnic-color-border-success: $unnnic-color-aux-green-300;
|
|
201
|
+
$unnnic-color-border-warning: $unnnic-color-aux-yellow-300;
|
|
202
|
+
$unnnic-color-border-critical: $unnnic-color-aux-red-300;
|
|
203
|
+
|
|
172
204
|
:export{
|
|
173
205
|
unnnicColorBackgroundSolo: $unnnic-color-background-solo;
|
|
174
206
|
}
|
|
@@ -340,36 +372,36 @@ $scheme-colors:
|
|
|
340
372
|
"brand-sec" $unnnic-color-brand-sec,
|
|
341
373
|
|
|
342
374
|
// Background semantic colors
|
|
343
|
-
"bg-base" $unnnic-color-
|
|
344
|
-
"bg-soft" $unnnic-color-
|
|
345
|
-
"bg-muted" $unnnic-color-
|
|
346
|
-
"bg-active" $unnnic-color-
|
|
347
|
-
"bg-info" $unnnic-color-
|
|
348
|
-
"bg-success" $unnnic-color-
|
|
349
|
-
"bg-warning" $unnnic-color-
|
|
350
|
-
"bg-critical" $unnnic-color-
|
|
375
|
+
"bg-base" $unnnic-color-bg-base,
|
|
376
|
+
"bg-soft" $unnnic-color-bg-soft,
|
|
377
|
+
"bg-muted" $unnnic-color-bg-muted,
|
|
378
|
+
"bg-active" $unnnic-color-bg-active,
|
|
379
|
+
"bg-info" $unnnic-color-bg-info,
|
|
380
|
+
"bg-success" $unnnic-color-bg-success,
|
|
381
|
+
"bg-warning" $unnnic-color-bg-warning,
|
|
382
|
+
"bg-critical" $unnnic-color-bg-critical,
|
|
351
383
|
|
|
352
384
|
// Text semantic colors
|
|
353
|
-
"fg-base" $unnnic-color-
|
|
354
|
-
"fg-muted" $unnnic-color-
|
|
355
|
-
"fg-emphasized" $unnnic-color-
|
|
356
|
-
"fg-inverted" $unnnic-color-
|
|
357
|
-
"fg-active" $unnnic-color-
|
|
358
|
-
"fg-info" $unnnic-color-
|
|
359
|
-
"fg-success" $unnnic-color-
|
|
360
|
-
"fg-warning" $unnnic-color-
|
|
361
|
-
"fg-critical" $unnnic-color-
|
|
385
|
+
"fg-base" $unnnic-color-fg-base,
|
|
386
|
+
"fg-muted" $unnnic-color-fg-muted,
|
|
387
|
+
"fg-emphasized" $unnnic-color-fg-emphasized,
|
|
388
|
+
"fg-inverted" $unnnic-color-fg-inverted,
|
|
389
|
+
"fg-active" $unnnic-color-fg-active,
|
|
390
|
+
"fg-info" $unnnic-color-fg-info,
|
|
391
|
+
"fg-success" $unnnic-color-fg-success,
|
|
392
|
+
"fg-warning" $unnnic-color-fg-warning,
|
|
393
|
+
"fg-critical" $unnnic-color-fg-critical,
|
|
362
394
|
|
|
363
395
|
// Border semantic colors
|
|
364
|
-
"border-base" $unnnic-color-
|
|
365
|
-
"border-soft" $unnnic-color-
|
|
366
|
-
"border-muted" $unnnic-color-
|
|
367
|
-
"border-emphasized" $unnnic-color-
|
|
368
|
-
"border-active" $unnnic-color-
|
|
369
|
-
"border-info" $unnnic-color-
|
|
370
|
-
"border-success" $unnnic-color-
|
|
371
|
-
"border-warning" $unnnic-color-
|
|
372
|
-
"border-critical" $unnnic-color-
|
|
396
|
+
"border-base" $unnnic-color-border-base,
|
|
397
|
+
"border-soft" $unnnic-color-border-soft,
|
|
398
|
+
"border-muted" $unnnic-color-border-muted,
|
|
399
|
+
"border-emphasized" $unnnic-color-border-emphasized,
|
|
400
|
+
"border-active" $unnnic-color-border-active,
|
|
401
|
+
"border-info" $unnnic-color-border-info,
|
|
402
|
+
"border-success" $unnnic-color-border-success,
|
|
403
|
+
"border-warning" $unnnic-color-border-warning,
|
|
404
|
+
"border-critical" $unnnic-color-border-critical;
|
|
373
405
|
|
|
374
406
|
|
|
375
407
|
@each $name, $color in $scheme-colors {
|
|
@@ -111,11 +111,6 @@ const props = defineProps({
|
|
|
111
111
|
type: String,
|
|
112
112
|
default: '',
|
|
113
113
|
},
|
|
114
|
-
|
|
115
|
-
disabled: {
|
|
116
|
-
type: Boolean,
|
|
117
|
-
default: false,
|
|
118
|
-
}
|
|
119
114
|
});
|
|
120
115
|
|
|
121
116
|
const emit = defineEmits([
|
|
@@ -140,21 +135,15 @@ const formattedSupportedFormats = computed(() => {
|
|
|
140
135
|
});
|
|
141
136
|
|
|
142
137
|
function dragenter() {
|
|
143
|
-
if (props.disabled) return;
|
|
144
|
-
|
|
145
138
|
dragEnterCounter.value += 1;
|
|
146
139
|
isDragging.value = true;
|
|
147
140
|
}
|
|
148
141
|
|
|
149
142
|
function dragover() {
|
|
150
|
-
if (props.disabled) return;
|
|
151
|
-
|
|
152
143
|
isDragging.value = true;
|
|
153
144
|
}
|
|
154
145
|
|
|
155
146
|
function dragleave() {
|
|
156
|
-
if (props.disabled) return;
|
|
157
|
-
|
|
158
147
|
dragEnterCounter.value -= 1;
|
|
159
148
|
if (dragEnterCounter.value === 0) {
|
|
160
149
|
isDragging.value = false;
|
|
@@ -162,14 +151,10 @@ function dragleave() {
|
|
|
162
151
|
}
|
|
163
152
|
|
|
164
153
|
function dragend() {
|
|
165
|
-
if (props.disabled) return;
|
|
166
|
-
|
|
167
154
|
isDragging.value = false;
|
|
168
155
|
}
|
|
169
156
|
|
|
170
157
|
function drop(event) {
|
|
171
|
-
if (props.disabled) return;
|
|
172
|
-
|
|
173
158
|
isDragging.value = false;
|
|
174
159
|
|
|
175
160
|
const { files } = event.dataTransfer;
|
|
@@ -180,8 +165,6 @@ function drop(event) {
|
|
|
180
165
|
}
|
|
181
166
|
|
|
182
167
|
function handleFileChange(event) {
|
|
183
|
-
if (props.disabled) return;
|
|
184
|
-
|
|
185
168
|
const { files } = event.target;
|
|
186
169
|
|
|
187
170
|
if (validateFiles(files)) {
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
</section>
|
|
25
25
|
|
|
26
26
|
<section class="unnnic-modal-dialog__container__body">
|
|
27
|
-
<header
|
|
27
|
+
<header
|
|
28
|
+
v-if="title"
|
|
29
|
+
class="unnnic-modal-dialog__container__header"
|
|
30
|
+
>
|
|
28
31
|
<section class="unnnic-modal-dialog__container__title-container">
|
|
29
32
|
<UnnnicIcon
|
|
30
33
|
v-if="icon || type"
|
|
@@ -46,7 +49,6 @@
|
|
|
46
49
|
data-testid="close-icon"
|
|
47
50
|
icon="close"
|
|
48
51
|
clickable
|
|
49
|
-
scheme="neutral-cloudy"
|
|
50
52
|
@click="close()"
|
|
51
53
|
/>
|
|
52
54
|
</header>
|
|
@@ -96,12 +98,12 @@
|
|
|
96
98
|
</template>
|
|
97
99
|
|
|
98
100
|
<script>
|
|
99
|
-
import UnnnicIcon from
|
|
100
|
-
import UnnnicButton from
|
|
101
|
-
import UnnnicI18n from
|
|
101
|
+
import UnnnicIcon from '../Icon.vue';
|
|
102
|
+
import UnnnicButton from '../Button/Button.vue';
|
|
103
|
+
import UnnnicI18n from '../../mixins/i18n';
|
|
102
104
|
|
|
103
105
|
export default {
|
|
104
|
-
name:
|
|
106
|
+
name: 'UnnnicModalDialog',
|
|
105
107
|
components: {
|
|
106
108
|
UnnnicIcon,
|
|
107
109
|
UnnnicButton,
|
|
@@ -118,29 +120,29 @@ export default {
|
|
|
118
120
|
},
|
|
119
121
|
type: {
|
|
120
122
|
type: String,
|
|
121
|
-
default:
|
|
123
|
+
default: '',
|
|
122
124
|
validate(type) {
|
|
123
|
-
return [
|
|
125
|
+
return ['success', 'warning', 'attention'].includes(type);
|
|
124
126
|
},
|
|
125
127
|
},
|
|
126
128
|
size: {
|
|
127
129
|
type: String,
|
|
128
|
-
default:
|
|
130
|
+
default: 'md',
|
|
129
131
|
validate(size) {
|
|
130
|
-
return [
|
|
132
|
+
return ['sm', 'md', 'lg'].includes(size);
|
|
131
133
|
},
|
|
132
134
|
},
|
|
133
135
|
title: {
|
|
134
136
|
type: String,
|
|
135
|
-
default:
|
|
137
|
+
default: '',
|
|
136
138
|
},
|
|
137
139
|
icon: {
|
|
138
140
|
type: String,
|
|
139
|
-
default:
|
|
141
|
+
default: '',
|
|
140
142
|
},
|
|
141
143
|
iconScheme: {
|
|
142
144
|
type: String,
|
|
143
|
-
default:
|
|
145
|
+
default: '',
|
|
144
146
|
},
|
|
145
147
|
showCloseIcon: {
|
|
146
148
|
type: Boolean,
|
|
@@ -163,26 +165,26 @@ export default {
|
|
|
163
165
|
default: () => ({}),
|
|
164
166
|
},
|
|
165
167
|
},
|
|
166
|
-
emits: [
|
|
168
|
+
emits: ['primaryButtonClick', 'secondaryButtonClick', 'update:modelValue'],
|
|
167
169
|
|
|
168
170
|
data() {
|
|
169
171
|
return {
|
|
170
172
|
defaultTranslations: {
|
|
171
173
|
cancel: {
|
|
172
|
-
|
|
173
|
-
en:
|
|
174
|
-
es:
|
|
174
|
+
'pt-br': 'Cancelar',
|
|
175
|
+
en: 'Cancel',
|
|
176
|
+
es: 'Cancelar',
|
|
175
177
|
},
|
|
176
178
|
},
|
|
177
179
|
iconsMapper: {
|
|
178
|
-
success: { icon:
|
|
179
|
-
warning: { icon:
|
|
180
|
-
attention: { icon:
|
|
180
|
+
success: { icon: 'check_circle', scheme: 'aux-green-500' },
|
|
181
|
+
warning: { icon: 'warning', scheme: 'aux-red-500' },
|
|
182
|
+
attention: { icon: 'error', scheme: 'aux-yellow-500' },
|
|
181
183
|
},
|
|
182
184
|
primaryButtonTypeMapper: {
|
|
183
|
-
success:
|
|
184
|
-
warning:
|
|
185
|
-
attention:
|
|
185
|
+
success: 'primary',
|
|
186
|
+
warning: 'warning',
|
|
187
|
+
attention: 'attention',
|
|
186
188
|
},
|
|
187
189
|
};
|
|
188
190
|
},
|
|
@@ -193,17 +195,17 @@ export default {
|
|
|
193
195
|
},
|
|
194
196
|
methods: {
|
|
195
197
|
close() {
|
|
196
|
-
this.$emit(
|
|
198
|
+
this.$emit('update:modelValue', false);
|
|
197
199
|
},
|
|
198
200
|
updateBodyOverflow(isHidden) {
|
|
199
|
-
document.body.style.overflow = isHidden ?
|
|
201
|
+
document.body.style.overflow = isHidden ? 'hidden' : '';
|
|
200
202
|
},
|
|
201
203
|
},
|
|
202
204
|
};
|
|
203
205
|
</script>
|
|
204
206
|
|
|
205
207
|
<style lang="scss" scoped>
|
|
206
|
-
@use
|
|
208
|
+
@use '@/assets/scss/unnnic' as *;
|
|
207
209
|
* {
|
|
208
210
|
margin: 0;
|
|
209
211
|
padding: 0;
|
|
@@ -310,7 +312,7 @@ export default {
|
|
|
310
312
|
&__actions {
|
|
311
313
|
display: grid;
|
|
312
314
|
grid-template-columns: 1fr 1fr;
|
|
313
|
-
grid-template-areas:
|
|
315
|
+
grid-template-areas: 'secondary-button primary-button';
|
|
314
316
|
gap: $unnnic-spacing-sm;
|
|
315
317
|
padding: $unnnic-spacing-md;
|
|
316
318
|
flex-shrink: 0;
|
|
@@ -11,7 +11,7 @@ exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
|
|
|
11
11
|
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="test-icon" clickable="false" size="md" scheme="neutral-darkest" data-testid="title-icon" class="unnnic-modal-dialog__container__title-icon"></unnnic-icon-stub>
|
|
12
12
|
<h1 data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-text" data-testid="title-text">Test Title</h1>
|
|
13
13
|
</section>
|
|
14
|
-
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="close" clickable="true" size="md" scheme="neutral-
|
|
14
|
+
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="close" clickable="true" size="md" scheme="neutral-darkest" data-testid="close-icon"></unnnic-icon-stub>
|
|
15
15
|
</header>
|
|
16
16
|
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__content"></section>
|
|
17
17
|
<section data-v-68ebadeb="" data-testid="actions-section" class="unnnic-modal-dialog__container__actions">
|
package/src/components/index.ts
CHANGED
|
@@ -88,9 +88,7 @@ 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 TemplatePreviewModal from "./TemplatePreview/TemplatePreviewModal.vue";
|
|
93
|
-
import DataTable from './DataTable/index.vue';
|
|
91
|
+
import DataTable from "./DataTable/index.vue";
|
|
94
92
|
|
|
95
93
|
type VueComponent = Component;
|
|
96
94
|
|
|
@@ -189,8 +187,6 @@ export const components: ComponentsMap = {
|
|
|
189
187
|
unnnicTour: Tour,
|
|
190
188
|
unnnicNavigator: Navigator,
|
|
191
189
|
unnnicSelectTime: SelectTime,
|
|
192
|
-
unnnicTemplatePreview: TemplatePreview,
|
|
193
|
-
unnnicTemplatePreviewModal: TemplatePreviewModal,
|
|
194
190
|
unnnicDataTable: DataTable,
|
|
195
191
|
};
|
|
196
192
|
|
|
@@ -284,7 +280,5 @@ export const unnnicDrawer = Drawer;
|
|
|
284
280
|
export const unnnicTableNext = TableNext;
|
|
285
281
|
export const unnnicTour = Tour;
|
|
286
282
|
export const unnnicNavigator = Navigator;
|
|
283
|
+
export const unnnicDataTable = DataTable as VueComponent;
|
|
287
284
|
export const unnnicSelectTime = SelectTime as VueComponent;
|
|
288
|
-
export const unnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
289
|
-
export const unnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
290
|
-
export const unnnicDataTable = DataTable;
|
|
@@ -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>
|