@weni/unnnic-system 3.2.9-alpha.9 → 3.3.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.
Files changed (209) hide show
  1. package/CHANGELOG.md +4 -10
  2. package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
  3. package/dist/components/Alert/Alert.vue.d.ts +119 -18
  4. package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
  5. package/dist/components/Alert/Version1dot1.vue.d.ts +38 -2
  6. package/dist/components/Alert/Version1dot1.vue.d.ts.map +1 -1
  7. package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +2 -2
  8. package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
  9. package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +5 -5
  10. package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +2 -2
  11. package/dist/components/Banner/Banner.vue.d.ts +1 -1
  12. package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
  13. package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
  14. package/dist/components/Button/Button.vue.d.ts +2 -2
  15. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  16. package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
  17. package/dist/components/Button/types.d.ts +1 -1
  18. package/dist/components/Button/types.d.ts.map +1 -1
  19. package/dist/components/Card/AccountCard.vue.d.ts +3 -3
  20. package/dist/components/Card/BlankCard.vue.d.ts +1 -1
  21. package/dist/components/Card/Card.vue.d.ts +21 -21
  22. package/dist/components/Card/CardCompany.vue.d.ts +8 -8
  23. package/dist/components/Card/CardData.vue.d.ts +1 -1
  24. package/dist/components/Card/CardStatusesContainer.vue.d.ts +4 -4
  25. package/dist/components/Card/ContentCard.vue.d.ts +2 -2
  26. package/dist/components/Card/DashCard.vue.d.ts +4 -4
  27. package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
  28. package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
  29. package/dist/components/Card/SimpleCard.vue.d.ts +3 -3
  30. package/dist/components/Card/StatusCard.vue.d.ts +2 -2
  31. package/dist/components/Card/TitleCard.vue.d.ts +2 -2
  32. package/dist/components/CardImage/CardImage.vue.d.ts +8 -8
  33. package/dist/components/CardInformation/CardInformation.vue.d.ts +4 -4
  34. package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
  35. package/dist/components/Carousel/Carousel.vue.d.ts +11 -11
  36. package/dist/components/Carousel/TagCarousel.vue.d.ts +9 -9
  37. package/dist/components/ChartBar/ChartBar.vue.d.ts +8 -8
  38. package/dist/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue.d.ts.map +1 -1
  39. package/dist/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue.d.ts +43 -0
  40. package/dist/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue.d.ts.map +1 -0
  41. package/dist/components/ChartLine/ChartLine.vue.d.ts +1 -1
  42. package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
  43. package/dist/components/ChatsContact/ChatsContact.vue.d.ts +15 -15
  44. package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
  45. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
  46. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
  47. package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
  48. package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
  49. package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
  50. package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
  51. package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
  52. package/dist/components/Comment/Comment.vue.d.ts +1 -1
  53. package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
  54. package/dist/components/DataTable/index.vue.d.ts +1 -8
  55. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  56. package/dist/components/DateFilter/DateFilter.vue.d.ts +27 -149
  57. package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
  58. package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
  59. package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
  60. package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
  61. package/dist/components/Flag.vue.d.ts +2 -2
  62. package/dist/components/FormElement/FormElement.vue.d.ts +32 -38
  63. package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
  64. package/dist/components/Icon.vue.d.ts +1 -1
  65. package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
  66. package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
  67. package/dist/components/Input/BaseInput.vue.d.ts +1 -28
  68. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  69. package/dist/components/Input/Input.vue.d.ts +27 -149
  70. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  71. package/dist/components/Input/TextInput.vue.d.ts +13 -67
  72. package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
  73. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +37 -159
  74. package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
  75. package/dist/components/Label/Label.vue.d.ts +15 -9
  76. package/dist/components/Label/Label.vue.d.ts.map +1 -1
  77. package/dist/components/Modal/Modal.vue.d.ts +2 -2
  78. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +9 -9
  79. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  80. package/dist/components/ModalNext/ModalNext.vue.d.ts +35 -157
  81. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +14 -14
  82. package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
  83. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +7 -7
  84. package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
  85. package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
  86. package/dist/components/Radio/Radio.vue.d.ts +2 -2
  87. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +27 -81
  88. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
  89. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
  90. package/dist/components/SelectTime/index.vue.d.ts +13 -67
  91. package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
  92. package/dist/components/Slider/Slider.vue.d.ts +2 -2
  93. package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
  94. package/dist/components/Switch/Switch.vue.d.ts +2 -2
  95. package/dist/components/Tab/Tab.vue.d.ts +2 -13
  96. package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
  97. package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
  98. package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
  99. package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
  100. package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
  101. package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
  102. package/dist/components/Tag/Tag.vue.d.ts +8 -8
  103. package/dist/components/TextArea/TextArea.vue.d.ts +32 -38
  104. package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
  105. package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
  106. package/dist/components/Tour/Tour.vue.d.ts +6 -6
  107. package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
  108. package/dist/components/UploadArea/UploadArea.vue.d.ts +7 -7
  109. package/dist/components/index.d.ts +1079 -1889
  110. package/dist/components/index.d.ts.map +1 -1
  111. package/dist/{es-d6005598.js → es-db7a2f44.mjs} +1 -1
  112. package/dist/{index-35640dc9.js → index-08caf833.mjs} +8434 -8712
  113. package/dist/locales/en.json.d.ts +1 -2
  114. package/dist/locales/es.json.d.ts +1 -2
  115. package/dist/locales/pt_br.json.d.ts +1 -2
  116. package/dist/{pt-br-89c2c09d.js → pt-br-88538a51.mjs} +1 -1
  117. package/dist/style.css +1 -1
  118. package/dist/unnnic.mjs +182 -0
  119. package/dist/unnnic.umd.js +109 -0
  120. package/dist/utils/call.d.ts +1 -2
  121. package/dist/utils/call.d.ts.map +1 -1
  122. package/package.json +4 -4
  123. package/src/assets/scss/scheme-colors.scss +4 -131
  124. package/src/assets/tokens/colors.json +2 -2
  125. package/src/components/Alert/Alert.vue +135 -26
  126. package/src/components/Alert/AlertBanner.vue +182 -0
  127. package/src/components/Alert/AlertCaller.vue +49 -0
  128. package/src/components/Alert/Version1dot1.vue +36 -0
  129. package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
  130. package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
  131. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +7 -11
  132. package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +2 -2
  133. package/src/components/Button/Button.vue +108 -60
  134. package/src/components/Button/types.ts +1 -0
  135. package/src/components/ChartFunnel/ChartFunnel.vue +4 -0
  136. package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +8 -2
  137. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelBaseRow.vue +1 -1
  138. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +64 -0
  139. package/src/components/DataTable/index.vue +10 -25
  140. package/src/components/FormElement/FormElement.vue +91 -51
  141. package/src/components/Input/BaseInput.vue +14 -22
  142. package/src/components/Input/Input.scss +21 -19
  143. package/src/components/Input/Input.vue +29 -85
  144. package/src/components/Input/TextInput.vue +42 -39
  145. package/src/components/Input/__test__/TextInput.spec.js +5 -5
  146. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +3 -12
  147. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
  148. package/src/components/Label/Label.vue +21 -52
  149. package/src/components/Label/__tests__/Label.spec.js +1 -1
  150. package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
  151. package/src/components/ModalDialog/ModalDialog.vue +0 -1
  152. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
  153. package/src/components/Tab/Tab.vue +23 -37
  154. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
  155. package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
  156. package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
  157. package/src/components/TextArea/TextArea.vue +9 -13
  158. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +2 -7
  159. package/src/components/index.ts +4 -18
  160. package/src/locales/en.json +1 -2
  161. package/src/locales/es.json +1 -2
  162. package/src/locales/pt_br.json +1 -2
  163. package/src/stories/Alert.stories.js +67 -6
  164. package/src/stories/Button.stories.js +17 -2
  165. package/src/stories/ChartFunnel.stories.js +19 -0
  166. package/src/stories/DataTable.stories.js +0 -60
  167. package/src/stories/Input.stories.js +3 -16
  168. package/src/stories/Label.stories.js +0 -7
  169. package/src/stories/Tab.stories.js +4 -11
  170. package/src/types/scheme-colors.d.ts +14 -120
  171. package/src/utils/call.js +18 -46
  172. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
  173. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
  174. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
  175. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
  176. package/dist/components/Toast/Toast.vue.d.ts +0 -16
  177. package/dist/components/Toast/Toast.vue.d.ts.map +0 -1
  178. package/dist/components/Toast/ToastManager.d.ts +0 -14
  179. package/dist/components/Toast/ToastManager.d.ts.map +0 -1
  180. package/dist/components/Toast/types.d.ts +0 -35
  181. package/dist/components/Toast/types.d.ts.map +0 -1
  182. package/dist/unnnic.js +0 -188
  183. package/dist/unnnic.umd.cjs +0 -110
  184. package/src/assets/img/previews/doc-preview.png +0 -0
  185. package/src/assets/img/previews/image-preview.png +0 -0
  186. package/src/assets/img/previews/video-preview.png +0 -0
  187. package/src/components/Popover/__tests__/Popover.spec.js +0 -147
  188. package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
  189. package/src/components/Popover/index.vue +0 -146
  190. package/src/components/Select/SelectOption.vue +0 -65
  191. package/src/components/Select/__tests__/Select.spec.js +0 -412
  192. package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
  193. package/src/components/Select/__tests__/SelectOption.spec.js +0 -174
  194. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -93
  195. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
  196. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
  197. package/src/components/Select/index.vue +0 -243
  198. package/src/components/TemplatePreview/TemplatePreview.vue +0 -252
  199. package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
  200. package/src/components/TemplatePreview/types.d.ts +0 -16
  201. package/src/components/Toast/Toast.vue +0 -236
  202. package/src/components/Toast/ToastManager.ts +0 -110
  203. package/src/components/Toast/types.ts +0 -57
  204. package/src/stories/Popover.stories.js +0 -39
  205. package/src/stories/Select.stories.js +0 -91
  206. package/src/stories/TemplatePreview.stories.js +0 -94
  207. package/src/stories/TemplatePreviewModal.stories.js +0 -110
  208. package/src/stories/Toast.mdx +0 -123
  209. package/src/stories/Toast.stories.js +0 -126
@@ -1,236 +0,0 @@
1
- <template>
2
- <Transition
3
- name="toast-slide"
4
- appear
5
- @after-leave="$emit('destroy')"
6
- >
7
- <aside
8
- v-if="isVisible"
9
- :class="['unnnic-toast', `unnnic-toast--${type}`]"
10
- :role="type === 'error' ? 'alert' : 'status'"
11
- :aria-live="type === 'error' ? 'assertive' : 'polite'"
12
- data-testid="unnnic-toast"
13
- >
14
- <section class="unnnic-toast__content">
15
- <header class="unnnic-toast__header">
16
- <UnnnicIcon
17
- :icon="typeConfig.icon"
18
- :scheme="typeConfig.scheme"
19
- size="ant"
20
- data-testid="toast-type-icon"
21
- />
22
-
23
- <h3 class="unnnic-toast__title">
24
- {{ title }}
25
- </h3>
26
-
27
- <UnnnicIcon
28
- icon="close"
29
- scheme="neutral-dark"
30
- size="ant"
31
- clickable
32
- class="unnnic-toast__close"
33
- data-testid="toast-close-button"
34
- @click="handleClose"
35
- @keydown.enter="handleClose"
36
- @keydown.space.prevent="handleClose"
37
- />
38
- </header>
39
-
40
- <p
41
- v-if="description"
42
- class="unnnic-toast__text"
43
- >
44
- {{ description }}
45
- </p>
46
- </section>
47
-
48
- <UnnnicButton
49
- v-if="button"
50
- type="tertiary"
51
- :text="button.text"
52
- class="unnnic-toast__action-button"
53
- data-testid="toast-action-button"
54
- @click="handleAction"
55
- @keydown.enter="handleAction"
56
- @keydown.space.prevent="handleAction"
57
- />
58
- </aside>
59
- </Transition>
60
- </template>
61
-
62
- <script setup lang="ts">
63
- import { ref, computed, onMounted, onUnmounted } from 'vue';
64
-
65
- import UnnnicIcon from '@/components/Icon.vue';
66
- import UnnnicButton from '@/components/Button/Button.vue';
67
-
68
- import type { ToastProps, ToastEmits } from './types';
69
- import type { SchemeColor } from '@/types/scheme-colors';
70
-
71
- defineOptions({
72
- name: 'UnnnicToast',
73
- });
74
-
75
- const props = withDefaults(defineProps<ToastProps>(), {
76
- title: '',
77
- description: '',
78
- button: undefined,
79
- timeout: 5000,
80
- type: 'informational',
81
- });
82
-
83
- const emit = defineEmits<ToastEmits>();
84
-
85
- const isVisible = ref(false);
86
- let timeoutId: number | null = null;
87
-
88
- const typeConfig = computed(() => {
89
- const configMap = {
90
- informational: { icon: 'info', scheme: 'blue-500' },
91
- attention: { icon: 'error', scheme: 'yellow-500' },
92
- success: { icon: 'check_circle', scheme: 'green-500' },
93
- error: { icon: 'cancel', scheme: 'red-500' },
94
- };
95
-
96
- return configMap[props.type || 'informational'] as {
97
- icon: string;
98
- scheme: SchemeColor;
99
- };
100
- });
101
-
102
- const handleClose = () => {
103
- isVisible.value = false;
104
- emit('close');
105
- };
106
-
107
- const handleAction = () => {
108
- if (props.button?.action) {
109
- props.button.action();
110
- }
111
- };
112
-
113
- const startTimeout = () => {
114
- if (props.timeout > 0) {
115
- timeoutId = window.setTimeout(() => {
116
- handleClose();
117
- }, props.timeout);
118
- }
119
- };
120
-
121
- const clearTimeout = () => {
122
- if (timeoutId) {
123
- window.clearTimeout(timeoutId);
124
- timeoutId = null;
125
- }
126
- };
127
-
128
- onMounted(() => {
129
- isVisible.value = true;
130
- startTimeout();
131
- });
132
-
133
- onUnmounted(() => {
134
- clearTimeout();
135
- });
136
- </script>
137
-
138
- <style lang="scss" scoped>
139
- @use '@/assets/scss/unnnic' as *;
140
-
141
- .unnnic-toast {
142
- position: fixed;
143
- bottom: $unnnic-space-4;
144
- right: $unnnic-space-4;
145
- z-index: 9999;
146
-
147
- display: flex;
148
- align-items: flex-end;
149
- flex-direction: column;
150
- gap: $unnnic-space-5;
151
-
152
- min-width: 250px;
153
- max-width: 450px;
154
- padding: $unnnic-space-4;
155
-
156
- border-radius: $unnnic-radius-2;
157
- box-shadow: $unnnic-shadow-2;
158
- border: 1px solid $unnnic-color-border-base;
159
-
160
- &--informational {
161
- border-color: $unnnic-color-border-info;
162
- background-color: $unnnic-color-bg-info;
163
- }
164
-
165
- &--attention {
166
- border-color: $unnnic-color-border-warning;
167
- background-color: $unnnic-color-bg-warning;
168
- }
169
-
170
- &--success {
171
- border-color: $unnnic-color-border-success;
172
- background-color: $unnnic-color-bg-success;
173
- }
174
-
175
- &--error {
176
- border-color: $unnnic-color-border-critical;
177
- background-color: $unnnic-color-bg-critical;
178
- }
179
-
180
- &__content,
181
- &__header {
182
- width: 100%;
183
-
184
- display: flex;
185
- gap: $unnnic-space-2;
186
- }
187
-
188
- &__content {
189
- flex-direction: column;
190
- gap: $unnnic-space-2;
191
- }
192
-
193
- &__header {
194
- align-items: center;
195
- }
196
-
197
- &__title {
198
- flex: 1;
199
-
200
- margin: 0;
201
-
202
- font: $unnnic-font-action;
203
- color: $unnnic-color-fg-emphasized;
204
- }
205
-
206
- &__text {
207
- margin: 0;
208
- margin-left: $unnnic-space-7;
209
-
210
- font: $unnnic-font-caption-2;
211
- color: $unnnic-color-fg-emphasized;
212
- }
213
- }
214
-
215
- // Animations
216
- .toast-slide-enter-active,
217
- .toast-slide-leave-active {
218
- transition: all 0.3s ease;
219
- }
220
-
221
- .toast-slide-enter-from {
222
- transform: translateY(100%);
223
- opacity: 0;
224
- }
225
-
226
- .toast-slide-leave-to {
227
- transform: translateY(100%);
228
- opacity: 0;
229
- }
230
-
231
- .toast-slide-enter-to,
232
- .toast-slide-leave-from {
233
- transform: translateY(0);
234
- opacity: 1;
235
- }
236
- </style>
@@ -1,110 +0,0 @@
1
- import { createApp } from 'vue';
2
- import Toast from './Toast.vue';
3
- import type {
4
- ToastProps,
5
- ToastInstance,
6
- ToastOptions,
7
- ToastCall,
8
- } from './types';
9
-
10
- class ToastManager implements ToastManager {
11
- private toasts: Map<string, ToastInstance> = new Map();
12
- private container: HTMLElement | null = null;
13
- private nextId = 0;
14
-
15
- private createContainer(): HTMLElement {
16
- if (this.container) {
17
- return this.container;
18
- }
19
-
20
- this.container = document.createElement('div');
21
- this.container.setAttribute('unnnic-toast-container', 'true');
22
-
23
- document.body.appendChild(this.container);
24
- return this.container;
25
- }
26
-
27
- private generateId(): string {
28
- return `toast-${++this.nextId}`;
29
- }
30
-
31
- show(props: ToastProps): ToastInstance {
32
- const id = this.generateId();
33
- const container = this.createContainer();
34
-
35
- const toastWrapper = document.createElement('div');
36
-
37
- // Create promise that resolves when toast is destroyed
38
- let resolvePromise: () => void;
39
- const promise = new Promise<void>((resolve) => {
40
- resolvePromise = resolve;
41
- });
42
-
43
- const app = createApp(Toast, {
44
- ...props,
45
- onClose: () => {
46
- this.close(id);
47
- },
48
- onDestroy: () => {
49
- app.unmount();
50
- toastWrapper.remove();
51
- resolvePromise(); // Resolve the promise when toast is destroyed
52
- },
53
- });
54
-
55
- app.mount(toastWrapper);
56
- container.appendChild(toastWrapper);
57
-
58
- const toastInstance: ToastInstance = {
59
- id,
60
- props,
61
- close: () => this.close(id),
62
- promise,
63
- };
64
-
65
- this.toasts.set(id, toastInstance);
66
- return toastInstance;
67
- }
68
-
69
- close(id: string): void {
70
- const toast = this.toasts.get(id);
71
- if (toast) {
72
- this.toasts.delete(id);
73
- }
74
- }
75
- }
76
-
77
- const toastManager = new ToastManager();
78
-
79
- export const toast: ToastCall = {
80
- info: (title: string, description?: string, options?: ToastOptions) =>
81
- toastManager.show({
82
- title,
83
- description,
84
- ...options,
85
- type: 'informational',
86
- }).promise,
87
- success: (title: string, description?: string, options?: ToastOptions) =>
88
- toastManager.show({
89
- title,
90
- description,
91
- ...options,
92
- type: 'success',
93
- }).promise,
94
- attention: (title: string, description?: string, options?: ToastOptions) =>
95
- toastManager.show({
96
- title,
97
- description,
98
- ...options,
99
- type: 'attention',
100
- }).promise,
101
- error: (title: string, description?: string, options?: ToastOptions) =>
102
- toastManager.show({
103
- title,
104
- description,
105
- ...options,
106
- type: 'error',
107
- }).promise,
108
- };
109
-
110
- export default toastManager;
@@ -1,57 +0,0 @@
1
- export interface ToastManager {
2
- show: (props: ToastProps) => ToastInstance;
3
- close: (id: string) => void;
4
- }
5
-
6
- export interface ToastButton {
7
- text: string;
8
- action: () => void;
9
- }
10
-
11
- export type ToastType = 'informational' | 'attention' | 'success' | 'error';
12
-
13
- export interface ToastProps extends ToastOptions {
14
- title: string;
15
- description?: string;
16
- }
17
-
18
- export interface ToastOptions {
19
- type?: ToastType;
20
- button?: ToastButton;
21
- timeout?: number;
22
- }
23
-
24
- export interface ToastEmits {
25
- close: [];
26
- destroy: [];
27
- }
28
-
29
- export interface ToastInstance {
30
- id: string;
31
- props: ToastProps;
32
- close: () => void;
33
- promise: Promise<void>;
34
- }
35
-
36
- export interface ToastCall {
37
- info: (
38
- title: string,
39
- description?: string,
40
- options?: ToastOptions,
41
- ) => Promise<void>;
42
- success: (
43
- title: string,
44
- description?: string,
45
- options?: ToastOptions,
46
- ) => Promise<void>;
47
- attention: (
48
- title: string,
49
- description?: string,
50
- options?: ToastOptions,
51
- ) => Promise<void>;
52
- error: (
53
- title: string,
54
- description?: string,
55
- options?: ToastOptions,
56
- ) => Promise<void>;
57
- }
@@ -1,39 +0,0 @@
1
- import UnnnicPopover from '../components/Popover/index.vue';
2
-
3
- export default {
4
- title: 'example/Popover',
5
- component: UnnnicPopover,
6
- render: (args) => ({
7
- components: { UnnnicPopover },
8
- setup() {
9
- return {
10
- args,
11
- };
12
- },
13
- template: `
14
- <div>
15
- <unnnic-popover v-bind="args">
16
- <template #trigger>
17
- <button>Click me</button>
18
- </template>
19
- <template #content>
20
- <p>Hello</p>
21
- </template>
22
- </unnnic-popover>
23
- <p>label label</p>
24
- </div>
25
- `,
26
- }),
27
- };
28
-
29
- export const Default = {
30
- args: {
31
- modelValue: false,
32
- },
33
- };
34
-
35
- export const WithModelValue = {
36
- args: {
37
- modelValue: true,
38
- },
39
- };
@@ -1,91 +0,0 @@
1
- import UnnnicSelect from '../components/Select/index.vue';
2
-
3
- const options = [
4
- { label: 'Option 1', value: 'option1', altValue: 'alt_value_option1' },
5
- { label: 'Option 2', value: 'option2', altValue: 'alt_value_option2' },
6
- { label: 'Option 3', value: 'option3', altValue: 'alt_value_option3' },
7
- { label: 'Option 4', value: 'option4', altValue: 'alt_value_option4' },
8
- { label: 'Option 5', value: 'option5', altValue: 'alt_value_option5' },
9
- { label: 'Option 6', value: 'option6', altValue: 'alt_value_option6' },
10
- { label: 'Option 7', value: 'option7', altValue: 'alt_value_option7' },
11
- { label: 'Option 8', value: 'option8', altValue: 'alt_value_option8' },
12
- { label: 'Option 9', value: 'option9', altValue: 'alt_value_option9' },
13
- { label: 'Option 10', value: 'option10', disabled: true },
14
- ];
15
-
16
- export default {
17
- title: 'Form/Select',
18
- component: UnnnicSelect,
19
- render: (args) => ({
20
- components: { UnnnicSelect },
21
- setup() {
22
- const handleSearch = (value) => {
23
- args.search = value;
24
- };
25
- return { args, handleSearch };
26
- },
27
- data() {
28
- return {
29
- exampleValue: null,
30
- };
31
- },
32
- template: `
33
- <p>modelValue: {{ exampleValue }}</p>
34
- <unnnic-select v-model="exampleValue" v-bind="args" @update:search="handleSearch" />
35
- `,
36
- }),
37
- };
38
-
39
- export const Default = {
40
- args: {
41
- placeholder: 'Placeholder',
42
- label: 'Label',
43
- options,
44
- },
45
- };
46
-
47
- export const ReturnObject = {
48
- args: {
49
- returnObject: true,
50
- placeholder: 'Placeholder',
51
- label: 'Label',
52
- options,
53
- },
54
- };
55
-
56
- export const AlternativeValueKey = {
57
- args: {
58
- itemValue: 'altValue',
59
- placeholder: 'Placeholder',
60
- label: 'Label',
61
- options,
62
- },
63
- };
64
-
65
- export const AlternativeValueLabel = {
66
- args: {
67
- itemLabel: 'altValue',
68
- placeholder: 'Placeholder',
69
- label: 'Label',
70
- options,
71
- },
72
- };
73
-
74
- export const Disabled = {
75
- args: {
76
- placeholder: 'Placeholder',
77
- label: 'Label',
78
- options,
79
- disabled: true,
80
- },
81
- };
82
-
83
- export const WithSearch = {
84
- args: {
85
- placeholder: 'Placeholder',
86
- label: 'Label',
87
- options,
88
- enableSearch: true,
89
- search: '',
90
- },
91
- };
@@ -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
- };