@weni/unnnic-system 3.2.8 → 3.2.9-alpha.1
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/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +18 -119
- package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
- package/dist/components/Alert/Version1dot1.vue.d.ts +2 -38
- package/dist/components/Alert/Version1dot1.vue.d.ts.map +1 -1
- package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +2 -2
- package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +5 -5
- package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +2 -2
- package/dist/components/Banner/Banner.vue.d.ts +1 -1
- package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts +2 -2
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Card/AccountCard.vue.d.ts +3 -3
- package/dist/components/Card/BlankCard.vue.d.ts +1 -1
- package/dist/components/Card/Card.vue.d.ts +21 -21
- package/dist/components/Card/CardCompany.vue.d.ts +8 -8
- package/dist/components/Card/CardData.vue.d.ts +1 -1
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +4 -4
- package/dist/components/Card/ContentCard.vue.d.ts +2 -2
- package/dist/components/Card/DashCard.vue.d.ts +4 -4
- package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
- package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
- package/dist/components/Card/SimpleCard.vue.d.ts +3 -3
- package/dist/components/Card/StatusCard.vue.d.ts +2 -2
- package/dist/components/Card/TitleCard.vue.d.ts +2 -2
- package/dist/components/CardImage/CardImage.vue.d.ts +8 -8
- package/dist/components/CardInformation/CardInformation.vue.d.ts +4 -4
- package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
- package/dist/components/Carousel/Carousel.vue.d.ts +11 -11
- package/dist/components/Carousel/TagCarousel.vue.d.ts +9 -9
- package/dist/components/ChartBar/ChartBar.vue.d.ts +8 -8
- package/dist/components/ChartLine/ChartLine.vue.d.ts +1 -1
- package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +15 -15
- package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
- package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
- package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
- package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
- package/dist/components/Comment/Comment.vue.d.ts +1 -1
- package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
- package/dist/components/DataTable/index.vue.d.ts +1 -1
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DateFilter/DateFilter.vue.d.ts +182 -27
- package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
- package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
- package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/FormElement/FormElement.vue.d.ts +38 -32
- package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
- package/dist/components/Icon.vue.d.ts +1 -1
- package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
- package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
- package/dist/components/Input/BaseInput.vue.d.ts +10 -1
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +182 -27
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +31 -13
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +192 -37
- package/dist/components/InputNext/InputNext.vue.d.ts +3 -3
- package/dist/components/Label/Label.vue.d.ts +9 -15
- package/dist/components/Label/Label.vue.d.ts.map +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +2 -2
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +9 -9
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +190 -35
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +14 -14
- package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +7 -7
- package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
- package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
- package/dist/components/Radio/Radio.vue.d.ts +2 -2
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +45 -27
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
- package/dist/components/SelectTime/index.vue.d.ts +31 -13
- package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
- package/dist/components/Slider/Slider.vue.d.ts +2 -2
- package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
- package/dist/components/Switch/Switch.vue.d.ts +2 -2
- package/dist/components/Tab/Tab.vue.d.ts +2 -2
- package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
- package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
- package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
- package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
- package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
- package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
- package/dist/components/Tag/Tag.vue.d.ts +8 -8
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +9 -0
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +1 -0
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +15 -0
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.vue.d.ts +38 -32
- package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
- package/dist/components/Toast/Toast.vue.d.ts +16 -0
- package/dist/components/Toast/Toast.vue.d.ts.map +1 -0
- package/dist/components/Toast/ToastManager.d.ts +14 -0
- package/dist/components/Toast/ToastManager.d.ts.map +1 -0
- package/dist/components/Toast/types.d.ts +35 -0
- package/dist/components/Toast/types.d.ts.map +1 -0
- package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
- package/dist/components/Tour/Tour.vue.d.ts +6 -6
- package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
- package/dist/components/UploadArea/UploadArea.vue.d.ts +7 -7
- package/dist/components/index.d.ts +2116 -1064
- package/dist/components/index.d.ts.map +1 -1
- package/dist/{es-b3e51efa.js → es-2735a8fb.js} +1 -1
- package/dist/{index-b9e3c5e9.js → index-e012fa52.js} +8396 -8093
- package/dist/{pt-br-20887b32.js → pt-br-f38a8b9c.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.js +126 -120
- package/dist/unnnic.umd.cjs +42 -41
- package/dist/utils/call.d.ts +2 -1
- package/dist/utils/call.d.ts.map +1 -1
- package/package.json +2 -2
- 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/assets/scss/scheme-colors.scss +131 -4
- package/src/assets/tokens/colors.json +2 -2
- package/src/components/Alert/Alert.vue +26 -135
- package/src/components/Alert/Version1dot1.vue +0 -36
- package/src/components/Button/Button.vue +60 -108
- package/src/components/Button/types.ts +0 -1
- package/src/components/FormElement/FormElement.vue +51 -91
- package/src/components/Input/BaseInput.vue +10 -12
- package/src/components/Input/Input.scss +17 -20
- package/src/components/Input/Input.vue +96 -28
- package/src/components/Input/TextInput.vue +28 -41
- package/src/components/Input/__test__/TextInput.spec.js +5 -5
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +12 -3
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
- package/src/components/Label/Label.vue +52 -21
- package/src/components/Label/__tests__/Label.spec.js +1 -1
- package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
- package/src/components/ModalDialog/ModalDialog.vue +1 -0
- 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/TemplatePreview/TemplatePreview.vue +252 -0
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +51 -0
- package/src/components/TemplatePreview/types.d.ts +16 -0
- package/src/components/TextArea/TextArea.vue +13 -9
- package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +7 -2
- package/src/components/Toast/Toast.vue +236 -0
- package/src/components/Toast/ToastManager.ts +110 -0
- package/src/components/Toast/types.ts +57 -0
- package/src/components/index.ts +18 -4
- package/src/stories/Alert.stories.js +6 -67
- package/src/stories/Button.stories.js +2 -17
- package/src/stories/Input.stories.js +16 -3
- package/src/stories/Label.stories.js +7 -0
- package/src/stories/TemplatePreview.stories.js +94 -0
- package/src/stories/TemplatePreviewModal.stories.js +110 -0
- package/src/stories/Toast.mdx +123 -0
- package/src/stories/Toast.stories.js +126 -0
- package/src/types/scheme-colors.d.ts +120 -14
- package/src/utils/call.js +46 -18
- package/src/components/Alert/AlertBanner.vue +0 -182
- package/src/components/Alert/AlertCaller.vue +0 -49
- package/src/components/Alert/__tests__/AlertBanner.spec.js +0 -89
- package/src/components/Alert/__tests__/AlertCaller.spec.js +0 -98
|
@@ -0,0 +1,110 @@
|
|
|
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;
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -88,8 +88,12 @@ 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';
|
|
91
93
|
import DataTable from './DataTable/index.vue';
|
|
92
94
|
import Chip from './Chip/Chip.vue';
|
|
95
|
+
import Toast from './Toast/Toast.vue';
|
|
96
|
+
import { toast } from './Toast/ToastManager';
|
|
93
97
|
|
|
94
98
|
type VueComponent = Component;
|
|
95
99
|
|
|
@@ -188,8 +192,12 @@ export const components: ComponentsMap = {
|
|
|
188
192
|
unnnicTour: Tour,
|
|
189
193
|
unnnicNavigator: Navigator,
|
|
190
194
|
unnnicSelectTime: SelectTime,
|
|
195
|
+
unnnicTemplatePreview: TemplatePreview,
|
|
196
|
+
unnnicTemplatePreviewModal: TemplatePreviewModal,
|
|
191
197
|
unnnicDataTable: DataTable,
|
|
192
198
|
unnnicChip: Chip,
|
|
199
|
+
unnnicToast: Toast,
|
|
200
|
+
unnnicToastManager: toast,
|
|
193
201
|
};
|
|
194
202
|
|
|
195
203
|
export const unnnicFontSize = fontSize;
|
|
@@ -241,7 +249,7 @@ export const unnnicAccordion = accordion;
|
|
|
241
249
|
export const unnnicIndicator = indicator;
|
|
242
250
|
export const unnnicSkeletonLoading = skeletonLoading;
|
|
243
251
|
export const unnnicCarousel = carousel;
|
|
244
|
-
export const unnnicLabel = label;
|
|
252
|
+
export const unnnicLabel = label as VueComponent;
|
|
245
253
|
export const unnnicTab = tab;
|
|
246
254
|
export const unnnicTabsExpanded = tabsExpanded;
|
|
247
255
|
export const unnnicBanner = banner;
|
|
@@ -282,8 +290,10 @@ export const unnnicDrawer = Drawer;
|
|
|
282
290
|
export const unnnicTableNext = TableNext;
|
|
283
291
|
export const unnnicTour = Tour;
|
|
284
292
|
export const unnnicNavigator = Navigator;
|
|
285
|
-
export const unnnicDataTable = DataTable as VueComponent;
|
|
286
293
|
export const unnnicSelectTime = SelectTime as VueComponent;
|
|
294
|
+
export const unnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
295
|
+
export const unnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
296
|
+
export const unnnicDataTable = DataTable as VueComponent;
|
|
287
297
|
export const unnnicChip = Chip;
|
|
288
298
|
|
|
289
299
|
export const UnnnicFontSize = fontSize;
|
|
@@ -335,7 +345,7 @@ export const UnnnicAccordion = accordion;
|
|
|
335
345
|
export const UnnnicIndicator = indicator;
|
|
336
346
|
export const UnnnicSkeletonLoading = skeletonLoading;
|
|
337
347
|
export const UnnnicCarousel = carousel;
|
|
338
|
-
export const UnnnicLabel = label;
|
|
348
|
+
export const UnnnicLabel = label as VueComponent;
|
|
339
349
|
export const UnnnicTab = tab;
|
|
340
350
|
export const UnnnicTabsExpanded = tabsExpanded;
|
|
341
351
|
export const UnnnicBanner = banner;
|
|
@@ -376,6 +386,10 @@ export const UnnnicDrawer = Drawer;
|
|
|
376
386
|
export const UnnnicTableNext = TableNext;
|
|
377
387
|
export const UnnnicTour = Tour;
|
|
378
388
|
export const UnnnicNavigator = Navigator;
|
|
379
|
-
export const UnnnicDataTable = DataTable as VueComponent;
|
|
380
389
|
export const UnnnicSelectTime = SelectTime as VueComponent;
|
|
390
|
+
export const UnnnicTemplatePreview = TemplatePreview as VueComponent;
|
|
391
|
+
export const UnnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
|
|
392
|
+
export const UnnnicDataTable = DataTable as VueComponent;
|
|
381
393
|
export const UnnnicChip = Chip;
|
|
394
|
+
export const UnnnicToast = Toast;
|
|
395
|
+
export const UnnnicToastManager = toast;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import AlertCaller from '../components/Alert/AlertCaller.vue';
|
|
2
1
|
import alert from '../utils/call';
|
|
3
2
|
import UnnnicAlert from '../components/Alert/Alert.vue';
|
|
4
|
-
import AlertBanner from '../components/Alert/AlertBanner.vue';
|
|
5
3
|
|
|
6
4
|
export default {
|
|
7
5
|
title: 'Feedback/Alert',
|
|
@@ -20,9 +18,6 @@ export default {
|
|
|
20
18
|
args: {
|
|
21
19
|
type: 'default',
|
|
22
20
|
text: 'Text',
|
|
23
|
-
linkHref: '',
|
|
24
|
-
linkText: '',
|
|
25
|
-
linkTarget: '',
|
|
26
21
|
},
|
|
27
22
|
argTypes: {
|
|
28
23
|
type: {
|
|
@@ -37,42 +32,15 @@ export default {
|
|
|
37
32
|
type: 'text',
|
|
38
33
|
},
|
|
39
34
|
},
|
|
40
|
-
|
|
41
|
-
linkHref: {
|
|
42
|
-
control: {
|
|
43
|
-
type: 'text',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
linkText: {
|
|
48
|
-
control: {
|
|
49
|
-
type: 'text',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
linkTarget: {
|
|
35
|
+
version: {
|
|
54
36
|
control: {
|
|
55
|
-
type: '
|
|
37
|
+
type: 'select',
|
|
56
38
|
},
|
|
57
|
-
|
|
58
|
-
position: {
|
|
59
|
-
if: { arg: 'version' },
|
|
60
|
-
},
|
|
61
|
-
version: {
|
|
62
|
-
control: false,
|
|
39
|
+
options: ['1.1', '2.0'],
|
|
63
40
|
},
|
|
64
41
|
title: {
|
|
65
42
|
if: { arg: 'version' },
|
|
66
43
|
},
|
|
67
|
-
icon: {
|
|
68
|
-
if: { arg: 'version' },
|
|
69
|
-
},
|
|
70
|
-
closeText: {
|
|
71
|
-
if: { arg: 'version' },
|
|
72
|
-
},
|
|
73
|
-
scheme: {
|
|
74
|
-
if: { arg: 'version' },
|
|
75
|
-
},
|
|
76
44
|
},
|
|
77
45
|
};
|
|
78
46
|
|
|
@@ -95,7 +63,7 @@ export const Normal = {
|
|
|
95
63
|
},
|
|
96
64
|
},
|
|
97
65
|
render: (args) => ({
|
|
98
|
-
components: {
|
|
66
|
+
components: { UnnnicAlert },
|
|
99
67
|
setup() {
|
|
100
68
|
return { args };
|
|
101
69
|
},
|
|
@@ -117,7 +85,7 @@ export const Normal = {
|
|
|
117
85
|
|
|
118
86
|
export const InlineComponent = {
|
|
119
87
|
render: (args) => ({
|
|
120
|
-
components: {
|
|
88
|
+
components: { UnnnicAlert },
|
|
121
89
|
setup() {
|
|
122
90
|
return { args };
|
|
123
91
|
},
|
|
@@ -166,7 +134,7 @@ export const WithContainerRef = {
|
|
|
166
134
|
},
|
|
167
135
|
},
|
|
168
136
|
render: (args) => ({
|
|
169
|
-
components: {
|
|
137
|
+
components: { UnnnicAlert },
|
|
170
138
|
setup() {
|
|
171
139
|
return { args };
|
|
172
140
|
},
|
|
@@ -190,32 +158,3 @@ export const WithContainerRef = {
|
|
|
190
158
|
scheme: 'feedback-green',
|
|
191
159
|
},
|
|
192
160
|
};
|
|
193
|
-
|
|
194
|
-
export const Banner = {
|
|
195
|
-
parameters: {
|
|
196
|
-
docs: {
|
|
197
|
-
description: {
|
|
198
|
-
story: `This variation has the additional prop ${'`showCloseButton`'}, false by default.`,
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
render: (args) => ({
|
|
203
|
-
components: { AlertBanner },
|
|
204
|
-
setup() {
|
|
205
|
-
return { args };
|
|
206
|
-
},
|
|
207
|
-
methods: {
|
|
208
|
-
unnnicCallAlert() {
|
|
209
|
-
alert.callAlert({
|
|
210
|
-
props: this.args,
|
|
211
|
-
containerRef: this.$refs.divContainer,
|
|
212
|
-
});
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
template: '<alert-banner v-bind="args" />',
|
|
216
|
-
}),
|
|
217
|
-
args: {
|
|
218
|
-
text: 'Text',
|
|
219
|
-
showCloseButton: false,
|
|
220
|
-
},
|
|
221
|
-
};
|
|
@@ -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 5 types: Primary, Secondary, Tertiary, Warning, Attention.
|
|
12
12
|
Each of these types has its states.
|
|
13
13
|
<br/>
|
|
14
14
|
<br/>
|
|
@@ -36,14 +36,7 @@ export default {
|
|
|
36
36
|
argTypes: {
|
|
37
37
|
type: {
|
|
38
38
|
control: { type: 'select' },
|
|
39
|
-
options: [
|
|
40
|
-
'primary',
|
|
41
|
-
'secondary',
|
|
42
|
-
'tertiary',
|
|
43
|
-
'alternative',
|
|
44
|
-
'warning',
|
|
45
|
-
'attention',
|
|
46
|
-
],
|
|
39
|
+
options: ['primary', 'secondary', 'tertiary', 'warning', 'attention'],
|
|
47
40
|
},
|
|
48
41
|
size: {
|
|
49
42
|
control: { type: 'select' },
|
|
@@ -114,14 +107,6 @@ export const OnlyIcon = {
|
|
|
114
107
|
},
|
|
115
108
|
};
|
|
116
109
|
|
|
117
|
-
export const Alternative = {
|
|
118
|
-
args: {
|
|
119
|
-
type: 'alternative',
|
|
120
|
-
iconLeft: 'add',
|
|
121
|
-
text: 'Text',
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
|
|
125
110
|
export const Warning = {
|
|
126
111
|
parameters: {
|
|
127
112
|
docs: {
|
|
@@ -35,9 +35,7 @@ export default {
|
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
template: `
|
|
38
|
-
|
|
39
|
-
<unnnic-input v-model="value" @icon-right-click="click" v-bind="args" />
|
|
40
|
-
</unnnic-form-element>
|
|
38
|
+
<unnnic-input v-model="value" @icon-right-click="click" v-bind="args" label="Label" />
|
|
41
39
|
`,
|
|
42
40
|
}),
|
|
43
41
|
};
|
|
@@ -157,3 +155,18 @@ export const Mask = {
|
|
|
157
155
|
mask: ['###.###.###-##', '##.###.###/####-##'],
|
|
158
156
|
},
|
|
159
157
|
};
|
|
158
|
+
|
|
159
|
+
export const LimitMaxLength = {
|
|
160
|
+
args: {
|
|
161
|
+
placeholder: 'Text',
|
|
162
|
+
maxlength: 10,
|
|
163
|
+
showMaxlengthCounter: true,
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const WithTooltip = {
|
|
168
|
+
args: {
|
|
169
|
+
placeholder: 'Text',
|
|
170
|
+
tooltip: 'Tooltip',
|
|
171
|
+
},
|
|
172
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
};
|