@weni/unnnic-system 3.9.2 → 3.9.3-alpha.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 (254) hide show
  1. package/dist/assets/tokens/colors.json.d.ts +376 -0
  2. package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
  3. package/dist/components/Alert/Alert.vue.d.ts +17 -116
  4. package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
  5. package/dist/components/Alert/Version1dot1.vue.d.ts +2 -38
  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 +3 -3
  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 +1 -1
  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 +5 -5
  20. package/dist/components/Card/BlankCard.vue.d.ts +1 -1
  21. package/dist/components/Card/Card.vue.d.ts +27 -27
  22. package/dist/components/Card/CardCompany.vue.d.ts +11 -414
  23. package/dist/components/Card/CardData.vue.d.ts +1 -1
  24. package/dist/components/Card/CardStatusesContainer.vue.d.ts +5 -5
  25. package/dist/components/Card/ContentCard.vue.d.ts +3 -3
  26. package/dist/components/Card/DashCard.vue.d.ts +5 -5
  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 +3 -3
  32. package/dist/components/CardImage/CardImage.vue.d.ts +24 -31
  33. package/dist/components/CardInformation/CardInformation.vue.d.ts +5 -5
  34. package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
  35. package/dist/components/Carousel/Carousel.vue.d.ts +13 -416
  36. package/dist/components/Carousel/TagCarousel.vue.d.ts +12 -415
  37. package/dist/components/ChartBar/ChartBar.vue.d.ts +5 -5
  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 +30 -448
  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 +19 -26
  49. package/dist/components/Checkbox/Checkbox.vue.d.ts.map +1 -1
  50. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +28 -0
  51. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts.map +1 -0
  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 -1
  55. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  56. package/dist/components/DateFilter/DateFilter.vue.d.ts +251 -41
  57. package/dist/components/DatePicker/DatePicker.vue.d.ts +4 -4
  58. package/dist/components/Drawer/Drawer.vue.d.ts +4 -4
  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 +51 -28
  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/Icon.vue.d.ts.map +1 -1
  66. package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
  67. package/dist/components/ImportCard/ImportCard.vue.d.ts +4 -4
  68. package/dist/components/Input/BaseInput.vue.d.ts +33 -2
  69. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  70. package/dist/components/Input/Input.vue.d.ts +251 -41
  71. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  72. package/dist/components/Input/TextInput.vue.d.ts +85 -25
  73. package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
  74. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +256 -46
  75. package/dist/components/InputNext/InputNext.vue.d.ts +5 -5
  76. package/dist/components/Label/Label.vue.d.ts +9 -15
  77. package/dist/components/Label/Label.vue.d.ts.map +1 -1
  78. package/dist/components/Modal/Modal.vue.d.ts +2 -2
  79. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +6 -6
  80. package/dist/components/ModalNext/ModalNext.vue.d.ts +256 -46
  81. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +9 -9
  82. package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
  83. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +26 -14
  84. package/dist/components/PageHeader/PageHeader.vue.d.ts +28 -0
  85. package/dist/components/PageHeader/PageHeader.vue.d.ts.map +1 -0
  86. package/dist/components/PageHeader/index.d.ts +3 -0
  87. package/dist/components/PageHeader/index.d.ts.map +1 -0
  88. package/dist/components/PageHeader/types.d.ts +9 -0
  89. package/dist/components/PageHeader/types.d.ts.map +1 -0
  90. package/dist/components/Pagination/Pagination.vue.d.ts +3 -3
  91. package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
  92. package/dist/components/Radio/Radio.vue.d.ts +10 -6
  93. package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
  94. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +120 -470
  95. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +11 -414
  96. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +21 -28
  97. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
  98. package/dist/components/SelectTime/index.vue.d.ts +85 -25
  99. package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
  100. package/dist/components/Slider/Slider.vue.d.ts +2 -2
  101. package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
  102. package/dist/components/Switch/Switch.vue.d.ts +55 -21
  103. package/dist/components/Switch/Switch.vue.d.ts.map +1 -1
  104. package/dist/components/Tab/Tab.vue.d.ts +13 -2
  105. package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
  106. package/dist/components/TableNext/TablePagination.vue.d.ts +3 -3
  107. package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
  108. package/dist/components/Tag/DefaultTag.vue.d.ts +4 -83
  109. package/dist/components/Tag/DefaultTag.vue.d.ts.map +1 -1
  110. package/dist/components/Tag/Tag.vue.d.ts +12 -414
  111. package/dist/components/Tag/Tag.vue.d.ts.map +1 -1
  112. package/dist/components/Tag/types.d.ts +18 -0
  113. package/dist/components/Tag/types.d.ts.map +1 -0
  114. package/dist/components/TextArea/TextArea.vue.d.ts +78 -33
  115. package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
  116. package/dist/components/Toast/Toast.vue.d.ts +16 -0
  117. package/dist/components/Toast/Toast.vue.d.ts.map +1 -0
  118. package/dist/components/Toast/ToastManager.d.ts +14 -0
  119. package/dist/components/Toast/ToastManager.d.ts.map +1 -0
  120. package/dist/components/Toast/types.d.ts +35 -0
  121. package/dist/components/Toast/types.d.ts.map +1 -0
  122. package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
  123. package/dist/components/Tour/Tour.vue.d.ts +3 -3
  124. package/dist/components/Tour/TourPopover.vue.d.ts +3 -3
  125. package/dist/components/UploadArea/UploadArea.vue.d.ts +4 -4
  126. package/dist/components/index.d.ts +8736 -10161
  127. package/dist/components/index.d.ts.map +1 -1
  128. package/dist/components/ui/popover/PopoverContent.vue.d.ts +1 -1
  129. package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -1
  130. package/dist/{es-4aab69cb.mjs → es-61b41785.mjs} +1 -1
  131. package/dist/{index-789225a6.mjs → index-10160248.mjs} +9358 -8815
  132. package/dist/locales/en.json.d.ts +2 -1
  133. package/dist/locales/es.json.d.ts +2 -1
  134. package/dist/locales/pt_br.json.d.ts +2 -1
  135. package/dist/{pt-br-2f695ddd.mjs → pt-br-31a68683.mjs} +1 -1
  136. package/dist/style.css +1 -1
  137. package/dist/unnnic.mjs +158 -151
  138. package/dist/unnnic.umd.js +35 -36
  139. package/dist/utils/call.d.ts +2 -1
  140. package/dist/utils/call.d.ts.map +1 -1
  141. package/package.json +2 -2
  142. package/src/assets/icons/checkbox-checked-disabled.svg +3 -0
  143. package/src/assets/icons/checkbox-checked.svg +3 -0
  144. package/src/assets/icons/checkbox-less-disabled.svg +3 -0
  145. package/src/assets/icons/checkbox-less.svg +3 -0
  146. package/src/assets/icons/radio-checked.svg +3 -0
  147. package/src/assets/icons/switch-checked-disabled.svg +3 -0
  148. package/src/assets/icons/switch-checked.svg +3 -0
  149. package/src/assets/scss/scheme-colors.scss +309 -223
  150. package/src/components/Alert/Alert.vue +26 -135
  151. package/src/components/Alert/Version1dot1.vue +0 -36
  152. package/src/components/Alert/__tests__/Alert.spec.js +2 -45
  153. package/src/components/Alert/__tests__/Version1dot1.spec.js +0 -21
  154. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +11 -7
  155. package/src/components/Alert/__tests__/__snapshots__/AlertBanner.spec.js.snap +2 -2
  156. package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +1 -1
  157. package/src/components/Button/Button.vue +67 -117
  158. package/src/components/Button/types.ts +0 -1
  159. package/src/components/ChatsContact/ChatsContact.vue +16 -8
  160. package/src/components/Checkbox/Checkbox.vue +117 -65
  161. package/src/components/Checkbox/__tests__/Checkbox.spec.js +6 -21
  162. package/src/components/CheckboxGroup/CheckboxGroup.vue +96 -0
  163. package/src/components/FormElement/FormElement.vue +63 -93
  164. package/src/components/Icon.vue +2 -0
  165. package/src/components/Input/BaseInput.vue +33 -14
  166. package/src/components/Input/Input.scss +22 -22
  167. package/src/components/Input/Input.vue +79 -56
  168. package/src/components/Input/TextInput.vue +81 -65
  169. package/src/components/Input/__test__/Input.spec.js +13 -33
  170. package/src/components/Input/__test__/TextInput.spec.js +6 -8
  171. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +17 -4
  172. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -1
  173. package/src/components/Label/Label.vue +52 -21
  174. package/src/components/Label/__tests__/Label.spec.js +1 -1
  175. package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
  176. package/src/components/MultiSelectV2/MultSelectOption.vue +67 -0
  177. package/src/components/MultiSelectV2/__tests__/MultiSelect.spec.js +556 -0
  178. package/src/components/MultiSelectV2/__tests__/MultiSelectOption.spec.js +229 -0
  179. package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelect.spec.js.snap +121 -0
  180. package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
  181. package/src/components/MultiSelectV2/index.vue +221 -0
  182. package/src/components/PageHeader/PageHeader.vue +148 -0
  183. package/src/components/PageHeader/index.ts +2 -0
  184. package/src/components/PageHeader/types.ts +10 -0
  185. package/src/components/Popover/__tests__/Popover.spec.js +147 -0
  186. package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
  187. package/src/components/Popover/index.vue +146 -0
  188. package/src/components/Radio/Radio.vue +118 -66
  189. package/src/components/Radio/__test__/Radio.spec.js +14 -20
  190. package/src/components/Radio/__test__/__snapshots__/Radio.spec.js.snap +4 -3
  191. package/src/components/RadioGroup/RadioGroup.vue +142 -0
  192. package/src/components/Select/SelectOption.vue +65 -0
  193. package/src/components/Select/__tests__/Select.spec.js +412 -0
  194. package/src/components/Select/__tests__/SelectItem.spec.js +330 -0
  195. package/src/components/Select/__tests__/SelectOption.spec.js +174 -0
  196. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +97 -0
  197. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
  198. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
  199. package/src/components/Select/index.vue +249 -0
  200. package/src/components/SelectSmart/SelectSmart.vue +4 -3
  201. package/src/components/Switch/Switch.vue +132 -91
  202. package/src/components/Switch/__tests__/Switch.spec.js +8 -75
  203. package/src/components/Switch/__tests__/__snapshots__/Switch.spec.js.snap +5 -6
  204. package/src/components/Tab/Tab.vue +37 -23
  205. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
  206. package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
  207. package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
  208. package/src/components/Tag/DefaultTag.vue +51 -107
  209. package/src/components/Tag/Tag.vue +32 -79
  210. package/src/components/Tag/types.ts +19 -0
  211. package/src/components/TextArea/TextArea.vue +41 -12
  212. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +11 -3
  213. package/src/components/Toast/Toast.vue +246 -0
  214. package/src/components/Toast/ToastManager.ts +110 -0
  215. package/src/components/Toast/__tests__/Toast.spec.js +291 -0
  216. package/src/components/Toast/__tests__/ToastManager.spec.js +294 -0
  217. package/src/components/Toast/types.ts +57 -0
  218. package/src/components/index.ts +33 -18
  219. package/src/locales/en.json +2 -1
  220. package/src/locales/es.json +2 -1
  221. package/src/locales/pt_br.json +2 -1
  222. package/src/stories/Alert.stories.js +6 -67
  223. package/src/stories/Button.stories.js +29 -39
  224. package/src/stories/ChatsContact.stories.js +9 -0
  225. package/src/stories/Checkbox.stories.js +11 -4
  226. package/src/stories/CheckboxGroup.stories.js +105 -0
  227. package/src/stories/Input.stories.js +71 -76
  228. package/src/stories/Label.stories.js +7 -0
  229. package/src/stories/MultiSelectV2.stories.js +158 -0
  230. package/src/stories/PageHeader.stories.js +330 -0
  231. package/src/stories/Radio.stories.js +28 -1
  232. package/src/stories/RadioGroup.stories.js +144 -0
  233. package/src/stories/Select.stories.js +158 -0
  234. package/src/stories/Switch.stories.js +10 -5
  235. package/src/stories/Tab.stories.js +11 -4
  236. package/src/stories/Tag.stories.js +24 -43
  237. package/src/stories/TextArea.stories.js +14 -2
  238. package/src/stories/Toast.mdx +123 -0
  239. package/src/stories/Toast.stories.js +126 -0
  240. package/src/types/scheme-colors.d.ts +1 -0
  241. package/src/utils/call.js +46 -18
  242. package/dist/components/Tag/BrandTag.vue.d.ts +0 -51
  243. package/dist/components/Tag/BrandTag.vue.d.ts.map +0 -1
  244. package/dist/components/Tag/IndicatorTag.vue.d.ts +0 -151
  245. package/dist/components/Tag/IndicatorTag.vue.d.ts.map +0 -1
  246. package/dist/components/Tag/TagNext.vue.d.ts +0 -24
  247. package/dist/components/Tag/TagNext.vue.d.ts.map +0 -1
  248. package/src/components/Alert/AlertBanner.vue +0 -182
  249. package/src/components/Alert/AlertCaller.vue +0 -49
  250. package/src/components/Alert/__tests__/AlertBanner.spec.js +0 -89
  251. package/src/components/Alert/__tests__/AlertCaller.spec.js +0 -98
  252. package/src/components/Tag/BrandTag.vue +0 -96
  253. package/src/components/Tag/IndicatorTag.vue +0 -107
  254. package/src/components/Tag/TagNext.vue +0 -60
@@ -0,0 +1,294 @@
1
+ import { beforeEach, describe, expect, afterEach, test, vi } from 'vitest';
2
+
3
+ vi.mock('vue', () => ({
4
+ createApp: vi.fn(() => ({
5
+ mount: vi.fn(),
6
+ unmount: vi.fn(),
7
+ })),
8
+ }));
9
+
10
+ vi.mock('../Toast.vue', () => ({
11
+ default: {
12
+ name: 'Toast',
13
+ template: '<div data-testid="toast">Mock Toast</div>',
14
+ },
15
+ }));
16
+
17
+ import toastManager, { toast } from '../ToastManager';
18
+ import Toast from '../Toast.vue';
19
+
20
+ describe('ToastManager', () => {
21
+ let mockCreateApp;
22
+ let mockMount;
23
+ let mockUnmount;
24
+
25
+ beforeEach(async () => {
26
+ vi.clearAllMocks();
27
+
28
+ document.body.innerHTML = '';
29
+
30
+ const { createApp } = await import('vue');
31
+ mockCreateApp = createApp;
32
+ mockMount = vi.fn();
33
+ mockUnmount = vi.fn();
34
+
35
+ mockCreateApp.mockReturnValue({
36
+ mount: mockMount,
37
+ unmount: mockUnmount,
38
+ });
39
+
40
+ Object.defineProperty(globalThis, 'document', {
41
+ value: {
42
+ ...document,
43
+ createElement: vi.fn((tagName) => {
44
+ const element = {
45
+ tagName: tagName.toUpperCase(),
46
+ setAttribute: vi.fn(),
47
+ appendChild: vi.fn(),
48
+ remove: vi.fn(),
49
+ children: [],
50
+ parentNode: null,
51
+ };
52
+
53
+ if (tagName === 'div') {
54
+ element.appendChild = vi.fn((child) => {
55
+ child.parentNode = element;
56
+ element.children.push(child);
57
+ });
58
+ }
59
+
60
+ return element;
61
+ }),
62
+ body: {
63
+ ...document.body,
64
+ appendChild: vi.fn(),
65
+ },
66
+ },
67
+ writable: true,
68
+ });
69
+ });
70
+
71
+ afterEach(() => {
72
+ if (toastManager.toasts) {
73
+ toastManager.toasts.clear();
74
+ }
75
+
76
+ document.body.innerHTML = '';
77
+
78
+ vi.clearAllMocks();
79
+ });
80
+
81
+ describe('Container Management', () => {
82
+ test('creates container on first toast', () => {
83
+ const createElementSpy = vi.spyOn(document, 'createElement');
84
+ const appendChildSpy = vi.spyOn(document.body, 'appendChild');
85
+
86
+ toastManager.show({ title: 'Test Toast' });
87
+
88
+ expect(createElementSpy).toHaveBeenCalledWith('div');
89
+ expect(appendChildSpy).toHaveBeenCalled();
90
+ });
91
+
92
+ test('reuses existing container', () => {
93
+ const createElementSpy = vi.spyOn(document, 'createElement');
94
+
95
+ toastManager.show({ title: 'First Toast' });
96
+ const firstCallCount = createElementSpy.mock.calls.length;
97
+
98
+ toastManager.show({ title: 'Second Toast' });
99
+ const secondCallCount = createElementSpy.mock.calls.length;
100
+
101
+ // First toast: container div + wrapper div = 2 calls
102
+ // Second toast: only wrapper div = 1 more call
103
+ // Total: 3 calls (1 container + 2 wrappers)
104
+ expect(secondCallCount).toBe(firstCallCount + 1);
105
+
106
+ expect(createElementSpy).toHaveBeenCalledWith('div');
107
+ });
108
+ });
109
+
110
+ describe('Toast Instance Management', () => {
111
+ test('generates unique IDs for toasts', () => {
112
+ const toast1 = toastManager.show({ title: 'First Toast' });
113
+ const toast2 = toastManager.show({ title: 'Second Toast' });
114
+
115
+ expect(toast1.id).not.toBe(toast2.id);
116
+ expect(toast1.id).toMatch(/^toast-\d+$/);
117
+ expect(toast2.id).toMatch(/^toast-\d+$/);
118
+ });
119
+
120
+ test('stores toast instances in map', () => {
121
+ const toast1 = toastManager.show({ title: 'First Toast' });
122
+ const toast2 = toastManager.show({ title: 'Second Toast' });
123
+
124
+ expect(toastManager.toasts.has(toast1.id)).toBe(true);
125
+ expect(toastManager.toasts.has(toast2.id)).toBe(true);
126
+ expect(toastManager.toasts.size).toBe(2);
127
+ });
128
+
129
+ test('creates toast with correct props', () => {
130
+ const props = {
131
+ title: 'Test Toast',
132
+ description: 'Test Description',
133
+ type: 'success',
134
+ timeout: 3000,
135
+ };
136
+
137
+ toastManager.show(props);
138
+
139
+ expect(mockCreateApp).toHaveBeenCalledWith(
140
+ Toast,
141
+ expect.objectContaining({
142
+ title: 'Test Toast',
143
+ description: 'Test Description',
144
+ type: 'success',
145
+ timeout: 3000,
146
+ onClose: expect.any(Function),
147
+ onDestroy: expect.any(Function),
148
+ }),
149
+ );
150
+ });
151
+
152
+ test('mounts toast app to wrapper element', () => {
153
+ toastManager.show({ title: 'Test Toast' });
154
+
155
+ expect(mockMount).toHaveBeenCalled();
156
+ });
157
+ });
158
+
159
+ describe('Toast Close Functionality', () => {
160
+ test('removes toast from map when closed', () => {
161
+ const toastInstance = toastManager.show({ title: 'Test Toast' });
162
+
163
+ expect(toastManager.toasts.has(toastInstance.id)).toBe(true);
164
+
165
+ toastManager.close(toastInstance.id);
166
+
167
+ expect(toastManager.toasts.has(toastInstance.id)).toBe(false);
168
+ });
169
+
170
+ test('handles closing non-existent toast gracefully', () => {
171
+ expect(() => {
172
+ toastManager.close('non-existent-id');
173
+ }).not.toThrow();
174
+ });
175
+
176
+ test('calls close when onClose is triggered', () => {
177
+ const closeSpy = vi.spyOn(toastManager, 'close');
178
+
179
+ toastManager.show({ title: 'Test Toast' });
180
+
181
+ const createAppCall = mockCreateApp.mock.calls[0];
182
+ const props = createAppCall[1];
183
+ const onCloseCallback = props.onClose;
184
+
185
+ onCloseCallback();
186
+
187
+ expect(closeSpy).toHaveBeenCalled();
188
+ });
189
+ });
190
+
191
+ describe('Toast Destroy Functionality', () => {
192
+ test('unmounts app and removes wrapper on destroy', () => {
193
+ toastManager.show({ title: 'Test Toast' });
194
+
195
+ const createAppCall = mockCreateApp.mock.calls[0];
196
+ const props = createAppCall[1];
197
+ const onDestroyCallback = props.onDestroy;
198
+
199
+ onDestroyCallback();
200
+
201
+ expect(mockUnmount).toHaveBeenCalled();
202
+ });
203
+
204
+ test('resolves promise when toast is destroyed', async () => {
205
+ const toastInstance = toastManager.show({ title: 'Test Toast' });
206
+
207
+ const createAppCall = mockCreateApp.mock.calls[0];
208
+ const props = createAppCall[1];
209
+ const onDestroyCallback = props.onDestroy;
210
+
211
+ const promiseResolved = vi.fn();
212
+ toastInstance.promise.then(promiseResolved);
213
+
214
+ onDestroyCallback();
215
+
216
+ await new Promise((resolve) => setTimeout(resolve, 0));
217
+
218
+ expect(promiseResolved).toHaveBeenCalled();
219
+ });
220
+ });
221
+
222
+ describe('Toast API', () => {
223
+ beforeEach(() => {
224
+ vi.spyOn(toastManager, 'show').mockReturnValue({
225
+ id: 'mock-id',
226
+ props: {},
227
+ close: vi.fn(),
228
+ promise: Promise.resolve(),
229
+ });
230
+ });
231
+
232
+ test('toast.info creates informational toast', () => {
233
+ toast.info('Info Title', 'Info Description', { timeout: 1000 });
234
+
235
+ expect(toastManager.show).toHaveBeenCalledWith({
236
+ title: 'Info Title',
237
+ description: 'Info Description',
238
+ timeout: 1000,
239
+ type: 'informational',
240
+ });
241
+ });
242
+
243
+ test('toast.success creates success toast', () => {
244
+ toast.success('Success Title', 'Success Description');
245
+
246
+ expect(toastManager.show).toHaveBeenCalledWith({
247
+ title: 'Success Title',
248
+ description: 'Success Description',
249
+ type: 'success',
250
+ });
251
+ });
252
+
253
+ test('toast.attention creates attention toast', () => {
254
+ toast.attention('Attention Title');
255
+
256
+ expect(toastManager.show).toHaveBeenCalledWith({
257
+ title: 'Attention Title',
258
+ type: 'attention',
259
+ });
260
+ });
261
+
262
+ test('toast.error creates error toast', () => {
263
+ toast.error('Error Title', 'Error Description', {
264
+ button: { text: 'Retry', action: vi.fn() },
265
+ });
266
+
267
+ expect(toastManager.show).toHaveBeenCalledWith({
268
+ title: 'Error Title',
269
+ description: 'Error Description',
270
+ button: { text: 'Retry', action: expect.any(Function) },
271
+ type: 'error',
272
+ });
273
+ });
274
+
275
+ test('toast methods return promises', async () => {
276
+ const infoPromise = toast.info('Test');
277
+ const successPromise = toast.success('Test');
278
+ const attentionPromise = toast.attention('Test');
279
+ const errorPromise = toast.error('Test');
280
+
281
+ expect(infoPromise).toBeInstanceOf(Promise);
282
+ expect(successPromise).toBeInstanceOf(Promise);
283
+ expect(attentionPromise).toBeInstanceOf(Promise);
284
+ expect(errorPromise).toBeInstanceOf(Promise);
285
+
286
+ await Promise.all([
287
+ infoPromise,
288
+ successPromise,
289
+ attentionPromise,
290
+ errorPromise,
291
+ ]);
292
+ });
293
+ });
294
+ });
@@ -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
+ }
@@ -25,6 +25,7 @@ import cardImage from './CardImage/CardImage.vue';
25
25
  import cardProject from './CardProject/CardProject.vue';
26
26
  import cardInformation from './CardInformation/CardInformation.vue';
27
27
  import checkbox from './Checkbox/Checkbox.vue';
28
+ import checkboxGroup from './CheckboxGroup/CheckboxGroup.vue';
28
29
  import collapse from './Collapse/Collapse.vue';
29
30
  import radio from './Radio/Radio.vue';
30
31
  import languageSelect from './Dropdown/LanguageSelect.vue';
@@ -90,16 +91,19 @@ import Navigator from './Navigator/index.vue';
90
91
  import SelectTime from './SelectTime/index.vue';
91
92
  import DataTable from './DataTable/index.vue';
92
93
  import Chip from './Chip/Chip.vue';
93
- import Tabs from './ui/tabs/Tabs.vue';
94
- import TabsList from './ui/tabs/TabsList.vue';
95
- import TabsTrigger from './ui/tabs/TabsTrigger.vue';
96
- import TabsContent from './ui/tabs/TabsContent.vue';
94
+ import Toast from './Toast/Toast.vue';
95
+ import { toast } from './Toast/ToastManager';
97
96
  import Popover from './ui/popover/Popover.vue';
98
97
  import PopoverContent from './ui/popover/PopoverContent.vue';
99
98
  import PopoverTrigger from './ui/popover/PopoverTrigger.vue';
100
99
  import PopoverFooter from './ui/popover/PopoverFooter.vue';
101
100
  import TemplatePreview from './TemplatePreview/TemplatePreview.vue';
102
101
  import TemplatePreviewModal from './TemplatePreview/TemplatePreviewModal.vue';
102
+ import Tabs from './ui/tabs/Tabs.vue';
103
+ import TabsList from './ui/tabs/TabsList.vue';
104
+ import TabsTrigger from './ui/tabs/TabsTrigger.vue';
105
+ import TabsContent from './ui/tabs/TabsContent.vue';
106
+ import PageHeader from './PageHeader/PageHeader.vue';
103
107
 
104
108
  type VueComponent = Component;
105
109
 
@@ -134,6 +138,7 @@ export const components: ComponentsMap = {
134
138
  unnnicCardProject: cardProject,
135
139
  unnnicCardInformation: cardInformation,
136
140
  unnnicCheckbox: checkbox,
141
+ unnnicCheckboxGroup: checkboxGroup,
137
142
  unnnicCollapse: collapse,
138
143
  unnnicRadio: radio,
139
144
  unnnicLanguageSelect: languageSelect,
@@ -202,13 +207,16 @@ export const components: ComponentsMap = {
202
207
  unnnicTemplatePreviewModal: TemplatePreviewModal,
203
208
  unnnicDataTable: DataTable,
204
209
  unnnicChip: Chip,
210
+ unnnicToast: Toast,
211
+ unnnicToastManager: toast,
212
+ unnnicPopover: Popover,
213
+ unnnicPopoverContent: PopoverContent,
214
+ unnnicPopoverTrigger: PopoverTrigger,
205
215
  unnnicTabs: Tabs,
206
216
  unnnicTabsList: TabsList,
207
217
  unnnicTabsTrigger: TabsTrigger,
208
218
  unnnicTabsContent: TabsContent,
209
- unnnicPopover: Popover,
210
- unnnicPopoverContent: PopoverContent,
211
- unnnicPopoverTrigger: PopoverTrigger,
219
+ unnnicPageHeader: PageHeader,
212
220
  };
213
221
 
214
222
  export const unnnicFontSize = fontSize;
@@ -238,6 +246,7 @@ export const unnnicCardImage = cardImage as VueComponent;
238
246
  export const unnnicCardProject = cardProject as VueComponent;
239
247
  export const unnnicCardInformation = cardInformation;
240
248
  export const unnnicCheckbox = checkbox;
249
+ export const unnnicCheckboxGroup = checkboxGroup;
241
250
  export const unnnicCollapse = collapse;
242
251
  export const unnnicRadio = radio;
243
252
  export const unnniclanguageSelect = languageSelect as VueComponent;
@@ -260,7 +269,7 @@ export const unnnicAccordion = accordion;
260
269
  export const unnnicIndicator = indicator;
261
270
  export const unnnicSkeletonLoading = skeletonLoading;
262
271
  export const unnnicCarousel = carousel;
263
- export const unnnicLabel = label;
272
+ export const unnnicLabel = label as VueComponent;
264
273
  export const unnnicTab = tab;
265
274
  export const unnnicTabsExpanded = tabsExpanded;
266
275
  export const unnnicBanner = banner;
@@ -304,19 +313,21 @@ export const unnnicNavigator = Navigator;
304
313
  export const unnnicDataTable = DataTable as VueComponent;
305
314
  export const unnnicSelectTime = SelectTime as VueComponent;
306
315
  export const unnnicChip = Chip;
307
- export const unnnicTabs = Tabs;
308
- export const unnnicTabsList = TabsList;
309
- export const unnnicTabsTrigger = TabsTrigger;
310
- export const unnnicTabsContent = TabsContent;
316
+ export const unnnicToast = Toast;
317
+ export const unnnicToastManager = toast;
311
318
  export const unnnicPopover = Popover;
312
319
  export const unnnicPopoverContent = PopoverContent;
313
320
  export const unnnicPopoverTrigger = PopoverTrigger;
314
321
  export const unnnicPopoverFooter = PopoverFooter;
315
322
  export const unnnicTemplatePreview = TemplatePreview as VueComponent;
316
323
  export const unnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
324
+ export const unnnicTabs = Tabs;
325
+ export const unnnicTabsList = TabsList;
326
+ export const unnnicTabsTrigger = TabsTrigger;
327
+ export const unnnicTabsContent = TabsContent;
328
+ export const unnnicPageHeader = PageHeader;
317
329
 
318
330
  export const UnnnicFontSize = fontSize;
319
- export const UnnnicFormElement = formElement;
320
331
  export const UnnnicInput = input;
321
332
  export const UnnnicInputNext = inputNext;
322
333
  export const UnnnicInputDatePicker = inputDatePicker;
@@ -342,6 +353,7 @@ export const UnnnicCardImage = cardImage as VueComponent;
342
353
  export const UnnnicCardProject = cardProject as VueComponent;
343
354
  export const UnnnicCardInformation = cardInformation;
344
355
  export const UnnnicCheckbox = checkbox;
356
+ export const UnnnicCheckboxGroup = checkboxGroup;
345
357
  export const UnnnicCollapse = collapse;
346
358
  export const UnnnicRadio = radio;
347
359
  export const UnnniclanguageSelect = languageSelect as VueComponent;
@@ -364,7 +376,7 @@ export const UnnnicAccordion = accordion;
364
376
  export const UnnnicIndicator = indicator;
365
377
  export const UnnnicSkeletonLoading = skeletonLoading;
366
378
  export const UnnnicCarousel = carousel;
367
- export const UnnnicLabel = label;
379
+ export const UnnnicLabel = label as VueComponent;
368
380
  export const UnnnicTab = tab;
369
381
  export const UnnnicTabsExpanded = tabsExpanded;
370
382
  export const UnnnicBanner = banner;
@@ -408,13 +420,16 @@ export const UnnnicNavigator = Navigator;
408
420
  export const UnnnicDataTable = DataTable as VueComponent;
409
421
  export const UnnnicSelectTime = SelectTime as VueComponent;
410
422
  export const UnnnicChip = Chip;
411
- export const UnnnicTabs = Tabs;
412
- export const UnnnicTabsList = TabsList;
413
- export const UnnnicTabsTrigger = TabsTrigger;
414
- export const UnnnicTabsContent = TabsContent;
423
+ export const UnnnicToast = Toast;
424
+ export const UnnnicToastManager = toast;
415
425
  export const UnnnicPopover = Popover;
416
426
  export const UnnnicPopoverContent = PopoverContent;
417
427
  export const UnnnicPopoverTrigger = PopoverTrigger;
418
428
  export const UnnnicPopoverFooter = PopoverFooter;
419
429
  export const UnnnicTemplatePreview = TemplatePreview as VueComponent;
420
430
  export const UnnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
431
+ export const UnnnicTabs = Tabs;
432
+ export const UnnnicTabsList = TabsList;
433
+ export const UnnnicTabsTrigger = TabsTrigger;
434
+ export const UnnnicTabsContent = TabsContent;
435
+ export const UnnnicPageHeader = PageHeader;
@@ -41,5 +41,6 @@
41
41
  "flags": "Flags",
42
42
  "custom": "Custom"
43
43
  }
44
- }
44
+ },
45
+ "search": "Search"
45
46
  }
@@ -41,5 +41,6 @@
41
41
  "flags": "Banderas",
42
42
  "custom": "Personalizados"
43
43
  }
44
- }
44
+ },
45
+ "search": "Buscar"
45
46
  }
@@ -41,5 +41,6 @@
41
41
  "flags": "Bandeiras",
42
42
  "custom": "Personalizados"
43
43
  }
44
- }
44
+ },
45
+ "search": "Buscar"
45
46
  }
@@ -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: 'text',
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: { AlertCaller, UnnnicAlert },
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: { AlertCaller, UnnnicAlert },
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: { AlertCaller, UnnnicAlert },
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
- };