@weni/unnnic-system 3.2.7-alpha.0 → 3.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
  3. package/dist/components/Alert/Alert.vue.d.ts +5 -5
  4. package/dist/components/Alert/Version1dot1.vue.d.ts +2 -2
  5. package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +2 -2
  6. package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
  7. package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +5 -5
  8. package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +2 -2
  9. package/dist/components/Banner/Banner.vue.d.ts +1 -1
  10. package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
  11. package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
  12. package/dist/components/Button/Button.vue.d.ts +2 -2
  13. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  14. package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
  15. package/dist/components/Button/types.d.ts +1 -1
  16. package/dist/components/Button/types.d.ts.map +1 -1
  17. package/dist/components/Card/AccountCard.vue.d.ts +3 -3
  18. package/dist/components/Card/BlankCard.vue.d.ts +1 -1
  19. package/dist/components/Card/Card.vue.d.ts +21 -21
  20. package/dist/components/Card/CardCompany.vue.d.ts +8 -8
  21. package/dist/components/Card/CardData.vue.d.ts +1 -1
  22. package/dist/components/Card/CardStatusesContainer.vue.d.ts +4 -4
  23. package/dist/components/Card/ContentCard.vue.d.ts +2 -2
  24. package/dist/components/Card/DashCard.vue.d.ts +4 -4
  25. package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
  26. package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
  27. package/dist/components/Card/SimpleCard.vue.d.ts +3 -3
  28. package/dist/components/Card/StatusCard.vue.d.ts +2 -2
  29. package/dist/components/Card/TitleCard.vue.d.ts +2 -2
  30. package/dist/components/CardImage/CardImage.vue.d.ts +8 -8
  31. package/dist/components/CardInformation/CardInformation.vue.d.ts +4 -4
  32. package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
  33. package/dist/components/Carousel/Carousel.vue.d.ts +11 -11
  34. package/dist/components/Carousel/TagCarousel.vue.d.ts +9 -9
  35. package/dist/components/ChartBar/ChartBar.vue.d.ts +8 -8
  36. package/dist/components/ChartLine/ChartLine.vue.d.ts +1 -1
  37. package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
  38. package/dist/components/ChatsContact/ChatsContact.vue.d.ts +15 -15
  39. package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
  40. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
  41. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
  42. package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
  43. package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
  44. package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
  45. package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
  46. package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
  47. package/dist/components/Comment/Comment.vue.d.ts +1 -1
  48. package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
  49. package/dist/components/DataTable/index.vue.d.ts +1 -1
  50. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  51. package/dist/components/DateFilter/DateFilter.vue.d.ts +27 -182
  52. package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
  53. package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
  54. package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
  55. package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
  56. package/dist/components/Flag.vue.d.ts +2 -2
  57. package/dist/components/FormElement/FormElement.vue.d.ts +32 -38
  58. package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
  59. package/dist/components/Icon.vue.d.ts +1 -1
  60. package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
  61. package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
  62. package/dist/components/Input/BaseInput.vue.d.ts +1 -10
  63. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  64. package/dist/components/Input/Input.vue.d.ts +27 -182
  65. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  66. package/dist/components/Input/TextInput.vue.d.ts +13 -31
  67. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +37 -192
  68. package/dist/components/InputNext/InputNext.vue.d.ts +3 -3
  69. package/dist/components/Modal/Modal.vue.d.ts +2 -2
  70. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +10 -10
  71. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  72. package/dist/components/ModalNext/ModalNext.vue.d.ts +34 -189
  73. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +14 -14
  74. package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
  75. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +7 -7
  76. package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
  77. package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
  78. package/dist/components/Radio/Radio.vue.d.ts +2 -2
  79. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +27 -45
  80. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
  81. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
  82. package/dist/components/SelectTime/index.vue.d.ts +13 -31
  83. package/dist/components/Slider/Slider.vue.d.ts +2 -2
  84. package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
  85. package/dist/components/Switch/Switch.vue.d.ts +2 -2
  86. package/dist/components/Tab/Tab.vue.d.ts +2 -2
  87. package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
  88. package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
  89. package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
  90. package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
  91. package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
  92. package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
  93. package/dist/components/Tag/Tag.vue.d.ts +8 -8
  94. package/dist/components/TextArea/TextArea.vue.d.ts +32 -38
  95. package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
  96. package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
  97. package/dist/components/Tour/Tour.vue.d.ts +6 -6
  98. package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
  99. package/dist/components/UploadArea/UploadArea.vue.d.ts +7 -7
  100. package/dist/components/index.d.ts +890 -2158
  101. package/dist/components/index.d.ts.map +1 -1
  102. package/dist/{es-a147ef18.mjs → es-57bb200f.mjs} +1 -1
  103. package/dist/{index-802ab669.mjs → index-5f770b98.mjs} +7615 -7790
  104. package/dist/{pt-br-cdc64aa4.mjs → pt-br-dc8f4568.mjs} +1 -1
  105. package/dist/style.css +1 -1
  106. package/dist/unnnic.mjs +119 -123
  107. package/dist/unnnic.umd.js +41 -42
  108. package/package.json +2 -2
  109. package/src/components/Button/Button.vue +108 -57
  110. package/src/components/Button/types.ts +1 -0
  111. package/src/components/FormElement/FormElement.vue +90 -50
  112. package/src/components/Input/BaseInput.vue +12 -10
  113. package/src/components/Input/Input.scss +20 -17
  114. package/src/components/Input/Input.vue +28 -86
  115. package/src/components/Input/TextInput.vue +35 -27
  116. package/src/components/Input/__test__/TextInput.spec.js +5 -5
  117. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +3 -12
  118. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
  119. package/src/components/ModalDialog/ModalDialog.vue +29 -27
  120. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
  121. package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
  122. package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
  123. package/src/components/TextArea/TextArea.vue +9 -14
  124. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +2 -7
  125. package/src/components/index.ts +3 -11
  126. package/src/stories/Button.stories.js +10 -1
  127. package/src/stories/Input.stories.js +3 -17
  128. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
  129. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
  130. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
  131. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
  132. package/src/assets/img/previews/doc-preview.png +0 -0
  133. package/src/assets/img/previews/image-preview.png +0 -0
  134. package/src/assets/img/previews/video-preview.png +0 -0
  135. package/src/components/TemplatePreview/TemplatePreview.vue +0 -249
  136. package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
  137. package/src/components/TemplatePreview/types.d.ts +0 -16
  138. package/src/stories/TemplatePreview.stories.js +0 -94
  139. package/src/stories/TemplatePreviewModal.stories.js +0 -110
@@ -3,12 +3,7 @@
3
3
  exports[`TextArea.vue > matches the snapshot 1`] = `
4
4
  "<section data-v-9f8d6c86="" data-v-735b3c51="" class="unnnic-form-element">
5
5
  <p data-v-9f8d6c86="" class="unnnic-form-element__label">Description</p><textarea data-v-735b3c51="" class="unnnic-text-area__textarea unnnic-text-area__textarea--size-md unnnic-text-area__textarea--type-normal" placeholder="Enter text" maxlength="200" value=""></textarea>
6
- <section data-v-9f8d6c86="" class="unnnic-form-element__hints-container">
7
- <section data-v-9f8d6c86="" class="unnnic-form-element__message-container">
8
- <!--v-if-->
9
- <!--v-if-->
10
- </section>
11
- <p data-v-9f8d6c86="">0/200</p>
12
- </section>
6
+ <!--v-if-->
7
+ <p data-v-9f8d6c86="" class="unnnic-form-element__message"> <span data-v-9f8d6c86="" class="unnnic-form-element__right-message">0/200</span></p>
13
8
  </section>"
14
9
  `;
@@ -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 TemplatePreview from "./TemplatePreview/TemplatePreview.vue";
92
- import TemplatePreviewModal from "./TemplatePreview/TemplatePreviewModal.vue";
93
- import DataTable from './DataTable/index.vue';
91
+ import DataTable from "./DataTable/index.vue";
94
92
  import Chip from "./Chip/Chip.vue";
95
93
 
96
94
  type VueComponent = Component;
@@ -190,8 +188,6 @@ export const components: ComponentsMap = {
190
188
  unnnicTour: Tour,
191
189
  unnnicNavigator: Navigator,
192
190
  unnnicSelectTime: SelectTime,
193
- unnnicTemplatePreview: TemplatePreview,
194
- unnnicTemplatePreviewModal: TemplatePreviewModal,
195
191
  unnnicDataTable: DataTable,
196
192
  unnnicChip: Chip,
197
193
  };
@@ -286,10 +282,8 @@ export const unnnicDrawer = Drawer;
286
282
  export const unnnicTableNext = TableNext;
287
283
  export const unnnicTour = Tour;
288
284
  export const unnnicNavigator = Navigator;
289
- export const unnnicSelectTime = SelectTime as VueComponent;
290
- export const unnnicTemplatePreview = TemplatePreview as VueComponent;
291
- export const unnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
292
285
  export const unnnicDataTable = DataTable as VueComponent;
286
+ export const unnnicSelectTime = SelectTime as VueComponent;
293
287
  export const unnnicChip = Chip;
294
288
 
295
289
  export const UnnnicFontSize = fontSize;
@@ -382,8 +376,6 @@ export const UnnnicDrawer = Drawer;
382
376
  export const UnnnicTableNext = TableNext;
383
377
  export const UnnnicTour = Tour;
384
378
  export const UnnnicNavigator = Navigator;
385
- export const UnnnicSelectTime = SelectTime as VueComponent;
386
- export const UnnnicTemplatePreview = TemplatePreview as VueComponent;
387
- export const UnnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
388
379
  export const UnnnicDataTable = DataTable as VueComponent;
380
+ export const UnnnicSelectTime = SelectTime as VueComponent;
389
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 5 types: Primary, Secondary, Tertiary, Warning, Attention.
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: {
@@ -35,7 +35,9 @@ export default {
35
35
  },
36
36
  },
37
37
  template: `
38
- <unnnic-input v-model="value" @icon-right-click="click" v-bind="args" label="Label" />
38
+ <unnnic-form-element label="Label" message="Helper text">
39
+ <unnnic-input v-model="value" @icon-right-click="click" v-bind="args" />
40
+ </unnnic-form-element>
39
41
  `,
40
42
  }),
41
43
  };
@@ -154,20 +156,4 @@ export const Mask = {
154
156
  placeholder: 'Text',
155
157
  mask: ['###.###.###-##', '##.###.###/####-##'],
156
158
  },
157
-
158
- };
159
-
160
- export const LimitMaxLength = {
161
- args: {
162
- placeholder: 'Text',
163
- maxlength: 10,
164
- showMaxlengthCounter: true,
165
- },
166
159
  };
167
-
168
- export const WithTooltip = {
169
- args: {
170
- placeholder: 'Text',
171
- tooltip: 'Tooltip',
172
- },
173
- };
@@ -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"}
@@ -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>
@@ -1,16 +0,0 @@
1
- export interface Template {
2
- header: {
3
- type: "TEXT" | "MEDIA";
4
- mediaType?: "IMAGE" | "VIDEO" | "DOCUMENT";
5
- text?: string | null;
6
- src?: string | null;
7
- };
8
- body?: string;
9
- footer?: string;
10
- buttons?: Array<{
11
- type: "QUICK_REPLY" | "PHONE_NUMBER";
12
- text: string;
13
- countryCode?: string;
14
- phoneNumber?: string;
15
- }>;
16
- }
@@ -1,94 +0,0 @@
1
- import UnnnicTemplatePreview from "../components/TemplatePreview/TemplatePreview.vue";
2
-
3
- export default {
4
- title: "example/TemplatePreview",
5
- tags: ["autodocs"],
6
- component: UnnnicTemplatePreview,
7
- };
8
-
9
- const Template = (args) => ({
10
- components: { UnnnicTemplatePreview },
11
- setup() {
12
- return { args };
13
- },
14
- template: `
15
- <unnnic-template-preview v-bind="args" />
16
- `,
17
- });
18
-
19
- const bodyText =
20
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sem orci, ultrices id lectus non, vehicula suscipit libero. Ut vehicula libero a tempus fringilla. Nam tincidunt vestibulum maximus. Morbi vel pretium risus. Curabitur id quam lectus. Quisque dolor elit, auctor a lacus non, rutrum ullamcorper mi. Nulla et turpis sed eros pharetra ullamcorper fermentum ac nisl. Donec lacinia hendrerit tellus, sit amet suscipit velit vestibulum sed. Praesent gravida posuere metus, ut fringilla dolor euismod vel. Aenean vel ipsum magna. Integer metus mi, fermentum ut nulla at, facilisis lobortis metus. Ut vitae tortor posuere, dapibus leo quis, finibus neque.";
21
-
22
- export const Default = Template.bind({});
23
- Default.args = {
24
- template: {
25
- header: {
26
- type: "TEXT",
27
- text: "Hello, world!",
28
- },
29
- footer: "Weni by VTEX",
30
- buttons: [
31
- {
32
- text: "Button 1",
33
- type: "PHONE_NUMBER",
34
- },
35
- {
36
- text: "Button 2",
37
- type: "URL",
38
- },
39
- {
40
- text: "Button 3",
41
- type: "QUICK_REPLY",
42
- },
43
- ],
44
- body: bodyText,
45
- },
46
- };
47
-
48
- export const Image = Template.bind({});
49
- Image.args = {
50
- template: {
51
- header: {
52
- type: "MEDIA",
53
- mediaType: "IMAGE",
54
- },
55
- footer: "Weni by VTEX",
56
- body: bodyText,
57
- },
58
- };
59
-
60
- export const Video = Template.bind({});
61
- Video.args = {
62
- template: {
63
- header: {
64
- type: "MEDIA",
65
- mediaType: "VIDEO",
66
- },
67
- buttons: [
68
- {
69
- text: "Button 1",
70
- type: "PHONE_NUMBER",
71
- },
72
- {
73
- text: "Button 2",
74
- type: "URL",
75
- },
76
- {
77
- text: "Button 3",
78
- type: "QUICK_REPLY",
79
- },
80
- ],
81
- },
82
- };
83
-
84
- export const Document = Template.bind({});
85
- Document.args = {
86
- template: {
87
- header: {
88
- type: "MEDIA",
89
- mediaType: "DOCUMENT",
90
- },
91
- footer: "Weni by VTEX",
92
- body: bodyText,
93
- },
94
- };
@@ -1,110 +0,0 @@
1
- import UnnnicTemplatePreviewModal from "../components/TemplatePreview/TemplatePreviewModal.vue";
2
-
3
- import { action } from "@storybook/addon-actions";
4
-
5
- export default {
6
- title: "example/TemplatePreviewModal",
7
- tags: ["autodocs"],
8
- component: UnnnicTemplatePreviewModal,
9
- argTypes: {
10
- locale: {
11
- control: { type: "select" },
12
- options: ["pt-br", "en", "es"],
13
- },
14
- },
15
- };
16
-
17
- const Template = (args) => ({
18
- components: { UnnnicTemplatePreviewModal },
19
- setup() {
20
- const close = () => {
21
- action("close")();
22
- args.modelValue = false;
23
- };
24
- return { args, close };
25
- },
26
- template: `
27
- <div>
28
- <button @click="args.modelValue = true">Open Modal</button>
29
- <unnnic-template-preview-modal v-bind="args" @close="close" />
30
- </div>
31
- `,
32
- });
33
-
34
- const bodyText =
35
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sem orci, ultrices id lectus non, vehicula suscipit libero. Ut vehicula libero a tempus fringilla. Nam tincidunt vestibulum maximus. Morbi vel pretium risus. Curabitur id quam lectus. Quisque dolor elit, auctor a lacus non, rutrum ullamcorper mi. Nulla et turpis sed eros pharetra ullamcorper fermentum ac nisl. Donec lacinia hendrerit tellus, sit amet suscipit velit vestibulum sed. Praesent gravida posuere metus, ut fringilla dolor euismod vel. Aenean vel ipsum magna. Integer metus mi, fermentum ut nulla at, facilisis lobortis metus. Ut vitae tortor posuere, dapibus leo quis, finibus neque.";
36
-
37
- export const Default = Template.bind({});
38
- Default.args = {
39
- modelValue: false,
40
- template: {
41
- header: {
42
- type: "TEXT",
43
- text: "Hello, world!",
44
- },
45
- footer: "Weni by VTEX",
46
- buttons: [
47
- {
48
- text: "Button 1",
49
- type: "PHONE_NUMBER",
50
- },
51
- {
52
- text: "Button 2",
53
- type: "URL",
54
- },
55
- {
56
- text: "Button 3",
57
- type: "QUICK_REPLY",
58
- },
59
- ],
60
- body: bodyText,
61
- },
62
- };
63
-
64
- export const Image = Template.bind({});
65
- Image.args = {
66
- template: {
67
- header: {
68
- type: "MEDIA",
69
- mediaType: "IMAGE",
70
- },
71
- footer: "Weni by VTEX",
72
- body: bodyText,
73
- },
74
- };
75
-
76
- export const Video = Template.bind({});
77
- Video.args = {
78
- template: {
79
- header: {
80
- type: "MEDIA",
81
- mediaType: "VIDEO",
82
- },
83
- buttons: [
84
- {
85
- text: "Button 1",
86
- type: "PHONE_NUMBER",
87
- },
88
- {
89
- text: "Button 2",
90
- type: "URL",
91
- },
92
- {
93
- text: "Button 3",
94
- type: "QUICK_REPLY",
95
- },
96
- ],
97
- },
98
- };
99
-
100
- export const Document = Template.bind({});
101
- Document.args = {
102
- template: {
103
- header: {
104
- type: "MEDIA",
105
- mediaType: "DOCUMENT",
106
- },
107
- footer: "Weni by VTEX",
108
- body: bodyText,
109
- },
110
- };