@weni/unnnic-system 3.3.1-alpha.3 → 3.3.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.
Files changed (203) hide show
  1. package/CHANGELOG.md +9 -1
  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/ChartLine/ChartLine.vue.d.ts +1 -1
  39. package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
  40. package/dist/components/ChatsContact/ChatsContact.vue.d.ts +15 -15
  41. package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
  42. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
  43. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
  44. package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
  45. package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
  46. package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
  47. package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
  48. package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
  49. package/dist/components/Comment/Comment.vue.d.ts +1 -1
  50. package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
  51. package/dist/components/DataTable/index.vue.d.ts +1 -1
  52. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  53. package/dist/components/DateFilter/DateFilter.vue.d.ts +29 -176
  54. package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
  55. package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
  56. package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
  57. package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
  58. package/dist/components/Flag.vue.d.ts +2 -2
  59. package/dist/components/FormElement/FormElement.vue.d.ts +32 -38
  60. package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
  61. package/dist/components/Icon.vue.d.ts +1 -1
  62. package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
  63. package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
  64. package/dist/components/Input/BaseInput.vue.d.ts +1 -32
  65. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  66. package/dist/components/Input/Input.vue.d.ts +29 -176
  67. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  68. package/dist/components/Input/TextInput.vue.d.ts +14 -83
  69. package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
  70. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +39 -186
  71. package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
  72. package/dist/components/Label/Label.vue.d.ts +15 -9
  73. package/dist/components/Label/Label.vue.d.ts.map +1 -1
  74. package/dist/components/Modal/Modal.vue.d.ts +2 -2
  75. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +9 -9
  76. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  77. package/dist/components/ModalNext/ModalNext.vue.d.ts +37 -184
  78. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +14 -14
  79. package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
  80. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +14 -20
  81. package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
  82. package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
  83. package/dist/components/Radio/Radio.vue.d.ts +6 -8
  84. package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
  85. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +28 -97
  86. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
  87. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
  88. package/dist/components/SelectTime/index.vue.d.ts +14 -83
  89. package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
  90. package/dist/components/Slider/Slider.vue.d.ts +2 -2
  91. package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
  92. package/dist/components/Switch/Switch.vue.d.ts +2 -2
  93. package/dist/components/Tab/Tab.vue.d.ts +2 -13
  94. package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
  95. package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
  96. package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
  97. package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
  98. package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
  99. package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
  100. package/dist/components/Tag/Tag.vue.d.ts +8 -8
  101. package/dist/components/TextArea/TextArea.vue.d.ts +32 -38
  102. package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
  103. package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
  104. package/dist/components/Tour/Tour.vue.d.ts +6 -6
  105. package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
  106. package/dist/components/UploadArea/UploadArea.vue.d.ts +7 -7
  107. package/dist/components/index.d.ts +1110 -2132
  108. package/dist/components/index.d.ts.map +1 -1
  109. package/dist/{es-94ab560e.mjs → es-54ddaf5a.mjs} +1 -1
  110. package/dist/{index-5caf403e.mjs → index-a34da30f.mjs} +8094 -8447
  111. package/dist/locales/en.json.d.ts +1 -2
  112. package/dist/locales/es.json.d.ts +1 -2
  113. package/dist/locales/pt_br.json.d.ts +1 -2
  114. package/dist/{pt-br-3002df05.mjs → pt-br-ff00f945.mjs} +1 -1
  115. package/dist/style.css +1 -1
  116. package/dist/unnnic.mjs +120 -126
  117. package/dist/unnnic.umd.js +41 -42
  118. package/dist/utils/call.d.ts +1 -2
  119. package/dist/utils/call.d.ts.map +1 -1
  120. package/package.json +2 -2
  121. package/src/assets/scss/scheme-colors.scss +238 -115
  122. package/src/components/Alert/Alert.vue +135 -26
  123. package/src/components/Alert/AlertBanner.vue +182 -0
  124. package/src/components/Alert/AlertCaller.vue +49 -0
  125. package/src/components/Alert/Version1dot1.vue +36 -0
  126. package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
  127. package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
  128. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +7 -11
  129. package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +2 -2
  130. package/src/components/Button/Button.vue +108 -60
  131. package/src/components/Button/types.ts +1 -0
  132. package/src/components/FormElement/FormElement.vue +91 -51
  133. package/src/components/Input/BaseInput.vue +14 -31
  134. package/src/components/Input/Input.scss +21 -19
  135. package/src/components/Input/Input.vue +30 -94
  136. package/src/components/Input/TextInput.vue +58 -82
  137. package/src/components/Input/__test__/TextInput.spec.js +5 -5
  138. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +3 -16
  139. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -7
  140. package/src/components/Label/Label.vue +21 -52
  141. package/src/components/Label/__tests__/Label.spec.js +1 -1
  142. package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
  143. package/src/components/ModalDialog/ModalDialog.vue +0 -1
  144. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
  145. package/src/components/Radio/Radio.vue +67 -80
  146. package/src/components/Radio/__test__/Radio.spec.js +20 -14
  147. package/src/components/Radio/__test__/__snapshots__/Radio.spec.js.snap +3 -3
  148. package/src/components/Tab/Tab.vue +23 -37
  149. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
  150. package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
  151. package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
  152. package/src/components/TextArea/TextArea.vue +9 -13
  153. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +2 -7
  154. package/src/components/index.ts +4 -18
  155. package/src/locales/en.json +1 -2
  156. package/src/locales/es.json +1 -2
  157. package/src/locales/pt_br.json +1 -2
  158. package/src/stories/Alert.stories.js +67 -6
  159. package/src/stories/Button.stories.js +17 -2
  160. package/src/stories/Input.stories.js +3 -22
  161. package/src/stories/Label.stories.js +0 -7
  162. package/src/stories/Tab.stories.js +4 -11
  163. package/src/types/scheme-colors.d.ts +0 -1
  164. package/src/utils/call.js +18 -46
  165. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
  166. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
  167. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
  168. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
  169. package/dist/components/Toast/Toast.vue.d.ts +0 -16
  170. package/dist/components/Toast/Toast.vue.d.ts.map +0 -1
  171. package/dist/components/Toast/ToastManager.d.ts +0 -14
  172. package/dist/components/Toast/ToastManager.d.ts.map +0 -1
  173. package/dist/components/Toast/types.d.ts +0 -35
  174. package/dist/components/Toast/types.d.ts.map +0 -1
  175. package/src/assets/icons/radio-checked.svg +0 -3
  176. package/src/assets/img/previews/doc-preview.png +0 -0
  177. package/src/assets/img/previews/image-preview.png +0 -0
  178. package/src/assets/img/previews/video-preview.png +0 -0
  179. package/src/components/Popover/__tests__/Popover.spec.js +0 -147
  180. package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
  181. package/src/components/Popover/index.vue +0 -146
  182. package/src/components/RadioGroup/RadioGroup.vue +0 -110
  183. package/src/components/Select/SelectOption.vue +0 -65
  184. package/src/components/Select/__tests__/Select.spec.js +0 -412
  185. package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
  186. package/src/components/Select/__tests__/SelectOption.spec.js +0 -174
  187. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -97
  188. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
  189. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
  190. package/src/components/Select/index.vue +0 -245
  191. package/src/components/TemplatePreview/TemplatePreview.vue +0 -252
  192. package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
  193. package/src/components/TemplatePreview/types.d.ts +0 -16
  194. package/src/components/Toast/Toast.vue +0 -236
  195. package/src/components/Toast/ToastManager.ts +0 -110
  196. package/src/components/Toast/types.ts +0 -57
  197. package/src/stories/Popover.stories.js +0 -39
  198. package/src/stories/RadioGroup.stories.js +0 -139
  199. package/src/stories/Select.stories.js +0 -158
  200. package/src/stories/TemplatePreview.stories.js +0 -94
  201. package/src/stories/TemplatePreviewModal.stories.js +0 -110
  202. package/src/stories/Toast.mdx +0 -123
  203. 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,139 +0,0 @@
1
- import { action } from '@storybook/addon-actions';
2
- import UnnnicRadioGroup from '../components/RadioGroup/RadioGroup.vue';
3
- import UnnnicRadio from '../components/Radio/Radio.vue';
4
- import { ref } from 'vue';
5
-
6
- export default {
7
- title: 'Form/RadioGroup',
8
- component: UnnnicRadioGroup,
9
- tags: ['autodocs'],
10
- parameters: {
11
- docs: {
12
- description: {
13
- component: `Fundamental in forms, used when we present a list of two or more mutually
14
- exclusive options, and the user needs to choose exactly one of them. When you click on
15
- an unselected radio button, it will automatically deselect any other buttons that were
16
- previously selected in the list.
17
- `,
18
- },
19
- },
20
- },
21
- argTypes: {
22
- label: { control: { type: 'text' } },
23
- labelTooltip: { control: { type: 'text' } },
24
- labelUseHtmlTooltip: { control: 'boolean' },
25
- modelValue: { control: { type: ['string', 'number'] } },
26
- name: { control: { type: 'text' } },
27
- state: { control: 'select', options: ['horizontal', 'vertical'] },
28
- },
29
- };
30
-
31
- export const Default = {
32
- args: {
33
- label: 'Radio Group 1',
34
- },
35
-
36
- render: (args) => ({
37
- components: {
38
- UnnnicRadioGroup,
39
- UnnnicRadio,
40
- },
41
-
42
- setup() {
43
- const modelValue = ref('option 1');
44
-
45
- const updateModelValue = (value) => {
46
- action('update:modelValue')(value);
47
- modelValue.value = value;
48
- };
49
-
50
- return { args, modelValue, updateModelValue };
51
- },
52
-
53
- template: `
54
- <section>
55
- <pre>v-model: {{ modelValue }}</pre>
56
-
57
- <UnnnicRadioGroup v-bind="args" :modelValue="modelValue" @update:modelValue="updateModelValue">
58
- <UnnnicRadio value="option 1">
59
- Option 1
60
- </UnnnicRadio>
61
-
62
- <UnnnicRadio value="option 2">
63
- Option 2
64
- </UnnnicRadio>
65
-
66
- <UnnnicRadio value="option 3">
67
- Option 3
68
- </UnnnicRadio>
69
- </UnnnicRadioGroup>
70
- </section>
71
- `,
72
- }),
73
- };
74
-
75
- export const Horizontal = {
76
- args: {
77
- state: 'horizontal',
78
- label: 'Label',
79
- name: 'Radio Group 1',
80
- },
81
-
82
- render: (args) => ({
83
- components: {
84
- UnnnicRadioGroup,
85
- UnnnicRadio,
86
- },
87
- setup() {
88
- return { args };
89
- },
90
- template: `
91
- <UnnnicRadioGroup v-bind="args">
92
- <UnnnicRadio value="option 1">
93
- Option 1
94
- </UnnnicRadio>
95
-
96
- <UnnnicRadio value="option 2">
97
- Option 2
98
- </UnnnicRadio>
99
-
100
- <UnnnicRadio value="option 3">
101
- Option 3
102
- </UnnnicRadio>
103
- </UnnnicRadioGroup>
104
- `,
105
- }),
106
- };
107
-
108
- export const Vertical = {
109
- args: {
110
- state: 'vertical',
111
- label: 'Label',
112
- name: 'Radio Group 2',
113
- },
114
-
115
- render: (args) => ({
116
- components: {
117
- UnnnicRadioGroup,
118
- UnnnicRadio,
119
- },
120
- setup() {
121
- return { args };
122
- },
123
- template: `
124
- <UnnnicRadioGroup v-bind="args">
125
- <UnnnicRadio value="option 1">
126
- Option 1
127
- </UnnnicRadio>
128
-
129
- <UnnnicRadio value="option 2">
130
- Option 2
131
- </UnnnicRadio>
132
-
133
- <UnnnicRadio value="option 3">
134
- Option 3
135
- </UnnnicRadio>
136
- </UnnnicRadioGroup>
137
- `,
138
- }),
139
- };