@weni/unnnic-system 3.7.1-alpha.1 → 3.7.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.
Files changed (261) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
  3. package/dist/components/Alert/Alert.vue.d.ts +116 -17
  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 +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 +5 -5
  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 +31 -24
  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 +7 -7
  36. package/dist/components/Carousel/TagCarousel.vue.d.ts +6 -6
  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 +34 -27
  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 +26 -19
  49. package/dist/components/Checkbox/Checkbox.vue.d.ts.map +1 -1
  50. package/dist/components/Comment/Comment.vue.d.ts +1 -1
  51. package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
  52. package/dist/components/DataTable/index.vue.d.ts +1 -1
  53. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  54. package/dist/components/DateFilter/DateFilter.vue.d.ts +41 -251
  55. package/dist/components/DatePicker/DatePicker.vue.d.ts +4 -4
  56. package/dist/components/Drawer/Drawer.vue.d.ts +4 -4
  57. package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
  58. package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
  59. package/dist/components/Flag.vue.d.ts +2 -2
  60. package/dist/components/FormElement/FormElement.vue.d.ts +28 -51
  61. package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
  62. package/dist/components/Icon.vue.d.ts +1 -1
  63. package/dist/components/Icon.vue.d.ts.map +1 -1
  64. package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
  65. package/dist/components/ImportCard/ImportCard.vue.d.ts +4 -4
  66. package/dist/components/Input/BaseInput.vue.d.ts +2 -33
  67. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  68. package/dist/components/Input/Input.vue.d.ts +41 -251
  69. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  70. package/dist/components/Input/TextInput.vue.d.ts +25 -85
  71. package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
  72. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +47 -257
  73. package/dist/components/InputNext/InputNext.vue.d.ts +5 -5
  74. package/dist/components/Label/Label.vue.d.ts +15 -9
  75. package/dist/components/Label/Label.vue.d.ts.map +1 -1
  76. package/dist/components/Modal/Modal.vue.d.ts +2 -2
  77. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +34 -199
  78. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  79. package/dist/components/ModalNext/ModalNext.vue.d.ts +46 -256
  80. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +15 -10
  81. package/dist/components/ModalUpload/ModalUpload.vue.d.ts.map +1 -1
  82. package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
  83. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +14 -20
  84. package/dist/components/Pagination/Pagination.vue.d.ts +3 -3
  85. package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
  86. package/dist/components/Radio/Radio.vue.d.ts +6 -8
  87. package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
  88. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +60 -113
  89. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +5 -5
  90. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +28 -21
  91. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
  92. package/dist/components/SelectTime/index.vue.d.ts +25 -85
  93. package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
  94. package/dist/components/Slider/Slider.vue.d.ts +2 -2
  95. package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
  96. package/dist/components/Switch/Switch.vue.d.ts +21 -55
  97. package/dist/components/Switch/Switch.vue.d.ts.map +1 -1
  98. package/dist/components/Tab/Tab.vue.d.ts +2 -13
  99. package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
  100. package/dist/components/TableNext/TablePagination.vue.d.ts +3 -3
  101. package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
  102. package/dist/components/Tag/BrandTag.vue.d.ts +1 -1
  103. package/dist/components/Tag/DefaultTag.vue.d.ts +1 -1
  104. package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
  105. package/dist/components/Tag/Tag.vue.d.ts +5 -5
  106. package/dist/components/TextArea/TextArea.vue.d.ts +30 -66
  107. package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
  108. package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
  109. package/dist/components/Tour/Tour.vue.d.ts +3 -3
  110. package/dist/components/Tour/TourPopover.vue.d.ts +3 -3
  111. package/dist/components/UploadArea/UploadArea.vue.d.ts +4 -4
  112. package/dist/components/index.d.ts +1352 -4057
  113. package/dist/components/index.d.ts.map +1 -1
  114. package/dist/{es-0331f100.mjs → es-484b4c46.mjs} +1 -1
  115. package/dist/{index-5e29f949.mjs → index-dc007393.mjs} +11929 -18885
  116. package/dist/locales/en.json.d.ts +1 -2
  117. package/dist/locales/es.json.d.ts +1 -2
  118. package/dist/locales/pt_br.json.d.ts +1 -2
  119. package/dist/{pt-br-cbd34d50.mjs → pt-br-f73c4b3a.mjs} +1 -1
  120. package/dist/style.css +1 -1
  121. package/dist/unnnic.mjs +172 -195
  122. package/dist/unnnic.umd.js +50 -56
  123. package/dist/utils/call.d.ts +1 -2
  124. package/dist/utils/call.d.ts.map +1 -1
  125. package/package.json +2 -3
  126. package/src/assets/scss/tailwind.scss +0 -8
  127. package/src/components/Alert/Alert.vue +135 -26
  128. package/src/components/Alert/AlertBanner.vue +182 -0
  129. package/src/components/Alert/AlertCaller.vue +49 -0
  130. package/src/components/Alert/Version1dot1.vue +36 -0
  131. package/src/components/Alert/__tests__/Alert.spec.js +45 -2
  132. package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
  133. package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
  134. package/src/components/Alert/__tests__/Version1dot1.spec.js +21 -0
  135. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +7 -11
  136. package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +2 -2
  137. package/src/components/Button/Button.vue +117 -68
  138. package/src/components/Button/types.ts +1 -0
  139. package/src/components/Checkbox/Checkbox.vue +64 -98
  140. package/src/components/Checkbox/__tests__/Checkbox.spec.js +21 -6
  141. package/src/components/FormElement/FormElement.vue +93 -63
  142. package/src/components/Icon.vue +0 -3
  143. package/src/components/Input/BaseInput.vue +14 -33
  144. package/src/components/Input/Input.scss +21 -20
  145. package/src/components/Input/Input.vue +56 -77
  146. package/src/components/Input/TextInput.vue +68 -80
  147. package/src/components/Input/__test__/TextInput.spec.js +8 -6
  148. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -14
  149. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
  150. package/src/components/Label/Label.vue +21 -52
  151. package/src/components/Label/__tests__/Label.spec.js +1 -1
  152. package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
  153. package/src/components/ModalDialog/ModalDialog.vue +146 -60
  154. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +22 -1
  155. package/src/components/ModalUpload/ModalUpload.vue +2 -0
  156. package/src/components/Radio/Radio.vue +67 -80
  157. package/src/components/Radio/__test__/Radio.spec.js +20 -14
  158. package/src/components/Radio/__test__/__snapshots__/Radio.spec.js.snap +3 -3
  159. package/src/components/SelectSmart/SelectSmart.vue +3 -4
  160. package/src/components/Switch/Switch.vue +96 -123
  161. package/src/components/Switch/__tests__/Switch.spec.js +75 -8
  162. package/src/components/Switch/__tests__/__snapshots__/Switch.spec.js.snap +6 -5
  163. package/src/components/Tab/Tab.vue +23 -37
  164. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
  165. package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
  166. package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
  167. package/src/components/TextArea/TextArea.vue +11 -34
  168. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +3 -11
  169. package/src/components/index.ts +9 -58
  170. package/src/locales/en.json +1 -2
  171. package/src/locales/es.json +1 -2
  172. package/src/locales/pt_br.json +1 -2
  173. package/src/stories/Alert.stories.js +67 -6
  174. package/src/stories/Button.stories.js +39 -29
  175. package/src/stories/Checkbox.stories.js +4 -11
  176. package/src/stories/Input.stories.js +76 -71
  177. package/src/stories/Label.stories.js +0 -7
  178. package/src/stories/ModalDialog.mdx +0 -3
  179. package/src/stories/ModalDialog.stories.js +1 -1
  180. package/src/stories/Switch.stories.js +5 -10
  181. package/src/stories/Tab.stories.js +4 -11
  182. package/src/stories/TextArea.stories.js +2 -13
  183. package/src/types/scheme-colors.d.ts +0 -1
  184. package/src/utils/call.js +18 -46
  185. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +0 -28
  186. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts.map +0 -1
  187. package/dist/components/Toast/Toast.vue.d.ts +0 -16
  188. package/dist/components/Toast/Toast.vue.d.ts.map +0 -1
  189. package/dist/components/Toast/ToastManager.d.ts +0 -14
  190. package/dist/components/Toast/ToastManager.d.ts.map +0 -1
  191. package/dist/components/Toast/types.d.ts +0 -35
  192. package/dist/components/Toast/types.d.ts.map +0 -1
  193. package/dist/components/ui/dialog/Dialog.vue.d.ts +0 -23
  194. package/dist/components/ui/dialog/Dialog.vue.d.ts.map +0 -1
  195. package/dist/components/ui/dialog/DialogClose.vue.d.ts +0 -19
  196. package/dist/components/ui/dialog/DialogClose.vue.d.ts.map +0 -1
  197. package/dist/components/ui/dialog/DialogContent.vue.d.ts +0 -40
  198. package/dist/components/ui/dialog/DialogContent.vue.d.ts.map +0 -1
  199. package/dist/components/ui/dialog/DialogFooter.vue.d.ts +0 -25
  200. package/dist/components/ui/dialog/DialogFooter.vue.d.ts.map +0 -1
  201. package/dist/components/ui/dialog/DialogHeader.vue.d.ts +0 -29
  202. package/dist/components/ui/dialog/DialogHeader.vue.d.ts.map +0 -1
  203. package/dist/components/ui/dialog/DialogTitle.vue.d.ts +0 -23
  204. package/dist/components/ui/dialog/DialogTitle.vue.d.ts.map +0 -1
  205. package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +0 -19
  206. package/dist/components/ui/dialog/DialogTrigger.vue.d.ts.map +0 -1
  207. package/dist/components/ui/dialog/index.d.ts +0 -8
  208. package/dist/components/ui/dialog/index.d.ts.map +0 -1
  209. package/dist/components/ui/popover/Popover.vue.d.ts +0 -23
  210. package/dist/components/ui/popover/Popover.vue.d.ts.map +0 -1
  211. package/dist/components/ui/popover/PopoverContent.vue.d.ts +0 -43
  212. package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +0 -1
  213. package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +0 -19
  214. package/dist/components/ui/popover/PopoverTrigger.vue.d.ts.map +0 -1
  215. package/dist/components/ui/popover/index.d.ts +0 -5
  216. package/dist/components/ui/popover/index.d.ts.map +0 -1
  217. package/src/assets/icons/checkbox-checked-disabled.svg +0 -3
  218. package/src/assets/icons/checkbox-checked.svg +0 -3
  219. package/src/assets/icons/checkbox-less-disabled.svg +0 -3
  220. package/src/assets/icons/checkbox-less.svg +0 -3
  221. package/src/assets/icons/radio-checked.svg +0 -3
  222. package/src/assets/icons/switch-checked-disabled.svg +0 -3
  223. package/src/assets/icons/switch-checked.svg +0 -3
  224. package/src/components/Alert/SIMPLE_MIGRATION_GUIDE.md +0 -152
  225. package/src/components/CheckboxGroup/CheckboxGroup.vue +0 -96
  226. package/src/components/Popover/__tests__/Popover.spec.js +0 -147
  227. package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
  228. package/src/components/Popover/index.vue +0 -146
  229. package/src/components/RadioGroup/RadioGroup.vue +0 -142
  230. package/src/components/Select/SelectOption.vue +0 -65
  231. package/src/components/Select/__tests__/Select.spec.js +0 -412
  232. package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
  233. package/src/components/Select/__tests__/SelectOption.spec.js +0 -174
  234. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -97
  235. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
  236. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
  237. package/src/components/Select/index.vue +0 -245
  238. package/src/components/Toast/Toast.vue +0 -246
  239. package/src/components/Toast/ToastManager.ts +0 -110
  240. package/src/components/Toast/__tests__/Toast.spec.js +0 -284
  241. package/src/components/Toast/__tests__/ToastManager.spec.js +0 -294
  242. package/src/components/Toast/types.ts +0 -57
  243. package/src/components/ui/dialog/Dialog.vue +0 -15
  244. package/src/components/ui/dialog/DialogClose.vue +0 -25
  245. package/src/components/ui/dialog/DialogContent.vue +0 -114
  246. package/src/components/ui/dialog/DialogFooter.vue +0 -46
  247. package/src/components/ui/dialog/DialogHeader.vue +0 -78
  248. package/src/components/ui/dialog/DialogTitle.vue +0 -34
  249. package/src/components/ui/dialog/DialogTrigger.vue +0 -12
  250. package/src/components/ui/dialog/index.ts +0 -7
  251. package/src/components/ui/popover/Popover.vue +0 -19
  252. package/src/components/ui/popover/PopoverContent.vue +0 -98
  253. package/src/components/ui/popover/PopoverTrigger.vue +0 -23
  254. package/src/components/ui/popover/index.ts +0 -4
  255. package/src/stories/CheckboxGroup.stories.js +0 -105
  256. package/src/stories/Dialog.stories.js +0 -832
  257. package/src/stories/Popover.stories.js +0 -306
  258. package/src/stories/RadioGroup.stories.js +0 -144
  259. package/src/stories/Select.stories.js +0 -158
  260. package/src/stories/Toast.mdx +0 -123
  261. package/src/stories/Toast.stories.js +0 -126
@@ -0,0 +1,89 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest';
3
+ import AlertBanner from '@/components/Alert/AlertBanner.vue';
4
+
5
+ describe('AlertBanner.vue', () => {
6
+ let wrapper;
7
+
8
+ beforeEach(() => {
9
+ wrapper = mount(AlertBanner, {
10
+ props: {
11
+ text: 'This is a banner alert',
12
+ type: 'danger',
13
+ showCloseButton: true,
14
+ linkHref: 'https://example.com',
15
+ linkText: 'Learn more',
16
+ linkTarget: '_self',
17
+ onClose: vi.fn(),
18
+ },
19
+ });
20
+ });
21
+
22
+ afterEach(() => {
23
+ wrapper.unmount();
24
+ });
25
+
26
+ test('renders correctly', () => {
27
+ expect(wrapper.exists()).toBe(true);
28
+ });
29
+
30
+ test('renders the correct text and link', () => {
31
+ const textElement = wrapper.find('.text');
32
+ const linkElement = wrapper.find('.banner-alert__link');
33
+
34
+ expect(textElement.text()).toBe('This is a banner alert');
35
+ expect(linkElement.text()).toBe('Learn more');
36
+ expect(linkElement.attributes('href')).toBe('https://example.com');
37
+ expect(linkElement.attributes('target')).toBe('_self');
38
+ });
39
+
40
+ test('applies the correct class based on the type', () => {
41
+ expect(wrapper.classes()).toContain('banner-alert--banner-danger');
42
+ });
43
+
44
+ test('renders the correct icon based on the type', () => {
45
+ const icon = wrapper.findComponent('[data-test="unnnic-icon"]');
46
+ expect(icon.exists()).toBe(true);
47
+ expect(icon.props('icon')).toBe('block');
48
+ expect(icon.props('size')).toBe('sm');
49
+ expect(icon.props('scheme')).toBe('neutral-white');
50
+ });
51
+
52
+ test('does not render the icon when type is not danger, warning, or info', async () => {
53
+ await wrapper.setProps({ type: 'success' });
54
+ const icon = wrapper.findComponent('[data-test="unnnic-icon"]');
55
+ expect(icon.element.style.display).toBe('none');
56
+ });
57
+
58
+ test('calls emitClose and emits close event when close button is clicked', async () => {
59
+ const closeButton = wrapper.find('.banner-alert__close');
60
+ await closeButton.trigger('click');
61
+
62
+ expect(wrapper.emitted()).toHaveProperty('close');
63
+ expect(wrapper.props().onClose).toHaveBeenCalled();
64
+ });
65
+
66
+ test('does not render close button if showCloseButton is false', async () => {
67
+ await wrapper.setProps({ showCloseButton: false });
68
+ const closeButton = wrapper.find('.banner-alert__close');
69
+ expect(closeButton.element.style.display).toBe('none');
70
+ });
71
+
72
+ test('matches the snapshot', () => {
73
+ expect(wrapper.html()).toMatchSnapshot();
74
+ });
75
+
76
+ test('getIconType function returns the correct icon based on type', () => {
77
+ expect(wrapper.vm.getIconType('danger')).toBe('block');
78
+ expect(wrapper.vm.getIconType('info')).toBe('info');
79
+ expect(wrapper.vm.getIconType('')).toBe('info');
80
+ });
81
+
82
+ test('isShowTextIcon function returns true for danger, warning, and info types', () => {
83
+ expect(wrapper.vm.isShowTextIcon('danger')).toBe(true);
84
+ expect(wrapper.vm.isShowTextIcon('warning')).toBe(true);
85
+ expect(wrapper.vm.isShowTextIcon('info')).toBe(true);
86
+ expect(wrapper.vm.isShowTextIcon('')).toBe(true);
87
+ expect(wrapper.vm.isShowTextIcon('success')).toBe(false);
88
+ });
89
+ });
@@ -0,0 +1,98 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test, vi, beforeEach, afterEach } from 'vitest';
3
+ import AlertCaller from '@/components/Alert/AlertCaller.vue';
4
+ import alert from '@/utils/call';
5
+
6
+ vi.mock('@/utils/call', () => ({
7
+ default: {
8
+ callAlert: vi.fn(),
9
+ },
10
+ }));
11
+
12
+ describe('AlertCaller.vue', () => {
13
+ let wrapper;
14
+
15
+ const defaultProps = {
16
+ title: 'Test Title',
17
+ text: 'Test Text',
18
+ icon: 'test-icon',
19
+ enabled: true,
20
+ scheme: 'primary',
21
+ seconds: 5,
22
+ closeText: 'Close',
23
+ position: 'top-right',
24
+ };
25
+
26
+ beforeEach(() => {
27
+ wrapper = mount(AlertCaller, {
28
+ props: defaultProps,
29
+ });
30
+ });
31
+
32
+ afterEach(() => {
33
+ wrapper.unmount();
34
+ vi.clearAllMocks();
35
+ });
36
+
37
+ test('renders correctly', () => {
38
+ expect(wrapper.exists()).toBe(true);
39
+ expect(wrapper.find('button').text()).toBe('Launch alert');
40
+ });
41
+
42
+ test('calls callAlert method when button is clicked', async () => {
43
+ const callAlertSpy = vi.spyOn(wrapper.vm, 'callAlert');
44
+ await wrapper.find('button').trigger('click');
45
+ expect(callAlertSpy).toHaveBeenCalledTimes(1);
46
+ });
47
+
48
+ test('callAlert method invokes alert.callAlert with correct props', async () => {
49
+ await wrapper.find('button').trigger('click');
50
+ expect(alert.callAlert).toHaveBeenCalledWith({
51
+ props: defaultProps,
52
+ seconds: defaultProps.seconds,
53
+ });
54
+ });
55
+
56
+ test.each([
57
+ ['title', 'New Title'],
58
+ ['text', 'New Text'],
59
+ ['icon', 'new-icon'],
60
+ ['enabled', false],
61
+ ['scheme', 'secondary'],
62
+ ['seconds', 10],
63
+ ['closeText', 'Dismiss'],
64
+ ['position', 'bottom-left'],
65
+ ])('updates %s prop correctly', async (propName, newValue) => {
66
+ await wrapper.setProps({ [propName]: newValue });
67
+ await wrapper.find('button').trigger('click');
68
+ const expectedProps = { ...defaultProps, [propName]: newValue };
69
+ expect(alert.callAlert).toHaveBeenCalledWith({
70
+ props: expectedProps,
71
+ seconds: expectedProps.seconds,
72
+ });
73
+ });
74
+
75
+ test('passes default values when props are not provided', async () => {
76
+ wrapper = mount(AlertCaller, {
77
+ props: {},
78
+ });
79
+ await wrapper.find('button').trigger('click');
80
+ expect(alert.callAlert).toHaveBeenCalledWith({
81
+ props: {
82
+ title: null,
83
+ text: null,
84
+ icon: null,
85
+ enabled: true,
86
+ scheme: null,
87
+ seconds: 3,
88
+ closeText: null,
89
+ position: 'top-right',
90
+ },
91
+ seconds: 3,
92
+ });
93
+ });
94
+
95
+ test('matches snapshot', () => {
96
+ expect(wrapper.html()).toMatchSnapshot();
97
+ });
98
+ });
@@ -9,9 +9,13 @@ describe('Alert.vue', () => {
9
9
  let wrapper;
10
10
 
11
11
  const defaultProps = {
12
+ version: '1.0',
12
13
  text: 'Test Alert',
13
14
  scheme: 'feedback-green',
14
15
  onClose: vi.fn(),
16
+ linkHref: 'https://example.com',
17
+ linkTarget: '_blank',
18
+ linkText: 'Learn more',
15
19
  type: 'success',
16
20
  };
17
21
 
@@ -47,6 +51,19 @@ describe('Alert.vue', () => {
47
51
  expect(wrapper.find('.alert--scheme-aux-red').exists()).toBe(true);
48
52
  });
49
53
 
54
+ test('renders link when linkHref is provided', () => {
55
+ const link = wrapper.find('.alert__link');
56
+ expect(link.exists()).toBe(true);
57
+ expect(link.attributes('href')).toBe('https://example.com');
58
+ expect(link.attributes('target')).toBe('_blank');
59
+ expect(link.text()).toBe('Learn more');
60
+ });
61
+
62
+ test('does not render link when linkHref is not provided', async () => {
63
+ await wrapper.setProps({ linkHref: '' });
64
+ expect(wrapper.find('.alert__link').exists()).toBe(false);
65
+ });
66
+
50
67
  test('emits close event and calls onClose prop when close button is clicked', async () => {
51
68
  await wrapper.find('.alert__close').trigger('click');
52
69
  expect(wrapper.emitted('close')).toBeTruthy();
@@ -76,8 +93,12 @@ describe('Alert.vue', () => {
76
93
  });
77
94
 
78
95
  test.each([
96
+ ['version', '1.1'],
79
97
  ['text', 'New Alert Text'],
80
98
  ['scheme', 'feedback-red'],
99
+ ['linkHref', 'https://newexample.com'],
100
+ ['linkTarget', '_self'],
101
+ ['linkText', 'Click here'],
81
102
  ['type', 'error'],
82
103
  ])('updates %s prop correctly', async (propName, newValue) => {
83
104
  await wrapper.setProps({ [propName]: newValue });
@@ -1,15 +1,11 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`UnnnicAlert.vue > matches the snapshot 1`] = `
4
- "<transition-stub data-v-c3231c18="" name="toast-slide" appear="true" persisted="false" css="true" icon="alert-icon" position="top-right" closetext="Close">
5
- <aside data-v-c3231c18="" class="unnnic-toast unnnic-toast--informational" role="status" aria-live="polite" data-testid="unnnic-toast">
6
- <section data-v-c3231c18="" class="unnnic-toast__content">
7
- <header data-v-c3231c18="" class="unnnic-toast__header"><span data-v-26446d8e="" data-v-c3231c18="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--blue-500 unnnic-icon-size--ant unnnic-icon__size--ant" data-testid="toast-type-icon" translate="no">info</span>
8
- <h3 data-v-c3231c18="" class="unnnic-toast__title">Test Alert</h3><span data-v-26446d8e="" data-v-c3231c18="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-dark unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable unnnic-toast__close" data-testid="toast-close-button" translate="no">close</span>
9
- </header>
10
- <!--v-if-->
11
- </section>
12
- <!--v-if-->
13
- </aside>
14
- </transition-stub>"
4
+ "<div data-v-284427ba="" class="unnnic-alert unnnic-alert-position--top-right"><span data-v-26446d8e="" data-v-284427ba="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--primary unnnic-icon-size--sm unnnic-icon__size--sm" data-testid="material-icon" translate="no" data-test="unnnic-icon">alert-icon</span>
5
+ <div data-v-284427ba="" class="unnnic-alert__content">
6
+ <div data-v-284427ba="" class="unnnic-alert__title">TEST ALERT</div>
7
+ <div data-v-284427ba="" class="unnnic-alert__text">This is an alert message</div>
8
+ </div>
9
+ <div data-v-284427ba="" class="unnnic-alert__close-text unnnic--clickable">CLOSE</div>
10
+ </div>"
15
11
  `;
@@ -1,10 +1,10 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`Alert.vue > matches snapshot 1`] = `
4
- "<div data-v-fb94f284="" class="alert-container" version="1.0" linkhref="https://example.com" linktarget="_blank" linktext="Learn more">
4
+ "<div data-v-fb94f284="" class="alert-container">
5
5
  <div data-v-fb94f284="" class="alert alert--scheme-aux-green">
6
6
  <div data-v-fb94f284="" class="alert__progress"></div>
7
- <div data-v-fb94f284="" class="alert__text">Test Alert</div>
7
+ <div data-v-fb94f284="" class="alert__text">Test Alert</div><a data-v-fb94f284="" class="alert__link" href="https://example.com" target="_blank">Learn more</a>
8
8
  <div data-v-fb94f284="" class="alert__close">
9
9
  <unnnic-icon-stub data-v-fb94f284="" filled="false" icon="close-1" clickable="false" size="sm" scheme="neutral-white"></unnnic-icon-stub>
10
10
  </div>
@@ -6,16 +6,19 @@
6
6
  :class="[
7
7
  'unnnic-button',
8
8
  `unnnic-button--size-${size}`,
9
- `unnnic-button--${buttonType}`,
9
+ `unnnic-button--${type}`,
10
10
  iconCenter ? `unnnic-button--icon-on-center` : null,
11
11
  float ? `unnnic-button--float` : null,
12
12
  ]"
13
13
  >
14
- <UnnnicIconLoading
14
+ <UnnnicIcon
15
15
  v-if="loading"
16
+ icon="loading-circle-1"
16
17
  :scheme="iconScheme"
17
18
  :size="iconSize"
19
+ :filled="iconsFilled"
18
20
  :style="{ position: 'absolute' }"
21
+ class="rotation"
19
22
  data-testid="icon-loading"
20
23
  />
21
24
 
@@ -27,7 +30,6 @@
27
30
  :filled="iconsFilled"
28
31
  :class="{ 'unnnic-button__icon-left': hasText }"
29
32
  :style="{ visibility: loading ? 'hidden' : 'visible' }"
30
- clickable
31
33
  data-testid="icon-left"
32
34
  />
33
35
 
@@ -38,7 +40,6 @@
38
40
  :style="{ visibility: loading ? 'hidden' : 'visible' }"
39
41
  :size="iconSize"
40
42
  :filled="iconsFilled"
41
- clickable
42
43
  data-testid="icon-center"
43
44
  />
44
45
 
@@ -59,7 +60,6 @@
59
60
  :filled="iconsFilled"
60
61
  :class="{ 'unnnic-button__icon-right': hasText }"
61
62
  :style="{ visibility: loading ? 'hidden' : 'visible' }"
62
- clickable
63
63
  data-testid="icon-right"
64
64
  />
65
65
  </button>
@@ -68,7 +68,6 @@
68
68
  <script setup lang="ts">
69
69
  import { computed, watch, useSlots } from 'vue';
70
70
  import UnnnicIcon from '../Icon.vue';
71
- import UnnnicIconLoading from '../IconLoading/IconLoading.vue';
72
71
  import type { ButtonProps, ButtonSize, ButtonType } from './types';
73
72
  import type { SchemeColor } from '@/types/scheme-colors';
74
73
 
@@ -87,7 +86,6 @@ const props = withDefaults(defineProps<ButtonProps>(), {
87
86
  iconRight: '',
88
87
  iconCenter: '',
89
88
  iconsFilled: false,
90
- next: false,
91
89
  disabled: false,
92
90
  loading: false,
93
91
  });
@@ -99,8 +97,8 @@ const buttonDisabled = computed(() => {
99
97
  });
100
98
 
101
99
  const iconSize = computed(() => {
102
- if (props.size === 'extra-large') return 'lg';
103
- return 'ant';
100
+ if (props.size === 'small') return 'sm';
101
+ return 'md';
104
102
  });
105
103
 
106
104
  const hasText = computed(() => {
@@ -117,11 +115,12 @@ const iconScheme = computed((): SchemeColor => {
117
115
  primary: 'neutral-white',
118
116
  secondary: 'neutral-dark',
119
117
  tertiary: 'neutral-dark',
118
+ alternative: 'neutral-white',
120
119
  warning: 'neutral-white',
121
120
  attention: 'neutral-white',
122
121
  };
123
122
 
124
- return typeToSchemeMap[buttonType.value] || 'neutral-white';
123
+ return typeToSchemeMap[props.type] || 'neutral-white';
125
124
  });
126
125
 
127
126
  const isSizePropValid = computed(() => {
@@ -132,23 +131,16 @@ const isSizePropValid = computed(() => {
132
131
  );
133
132
  });
134
133
 
135
- const buttonType = computed(() => {
136
- return (
137
- {
138
- alternative: 'tertiary',
139
- }[props.type] || props.type
140
- );
141
- });
142
-
143
134
  const isTypePropValid = computed(() => {
144
135
  const validTypes: ButtonType[] = [
145
136
  'primary',
146
137
  'secondary',
147
138
  'tertiary',
139
+ 'alternative',
148
140
  'warning',
149
141
  'attention',
150
142
  ];
151
- return validTypes.includes(buttonType.value);
143
+ return validTypes.includes(props.type);
152
144
  });
153
145
 
154
146
  const validateProps = () => {
@@ -162,8 +154,6 @@ const validateProps = () => {
162
154
 
163
155
  if (!isTypePropValid.value) {
164
156
  errorMessage += ' Invalid type prop.';
165
- errorMessage +=
166
- ' Please provide one of the following types: primary, secondary, tertiary, warning, attention. Alternative is discontinued and it was forced renamed to tertiary.';
167
157
  }
168
158
 
169
159
  throw new Error(errorMessage);
@@ -201,19 +191,16 @@ watch(
201
191
  display: inline-flex;
202
192
  align-items: center;
203
193
  justify-content: center;
204
- border-radius: $unnnic-radius-2;
194
+ border-radius: $unnnic-border-radius-sm;
205
195
  border: 0;
206
196
  outline: none;
207
197
  overflow: hidden;
208
198
  white-space: nowrap;
209
- font: $unnnic-font-action;
199
+ font-weight: $unnnic-font-weight-regular;
200
+ font-family: $unnnic-font-family-secondary;
210
201
  cursor: pointer;
211
202
  position: relative;
212
203
 
213
- transition-property: color, background-color, border-color;
214
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
215
- transition-duration: 0.15s;
216
-
217
204
  &__icon {
218
205
  &-left {
219
206
  margin-right: $unnnic-inline-nano;
@@ -224,91 +211,129 @@ watch(
224
211
  }
225
212
  }
226
213
 
227
- &--primary,
228
- &--warning,
229
- &--attention {
230
- color: $unnnic-color-fg-inverted;
231
- }
232
-
233
- &--secondary,
234
- &--tertiary {
235
- color: $unnnic-color-fg-emphasized;
236
- }
237
-
238
214
  &--primary {
239
- background-color: $unnnic-color-bg-active;
215
+ background-color: $unnnic-color-weni-600;
216
+ color: $unnnic-color-neutral-white;
240
217
 
241
218
  &:hover:enabled {
242
- background-color: $unnnic-color-teal-700;
219
+ background-color: $unnnic-color-weni-700;
243
220
  }
244
221
 
245
222
  &:active:enabled {
246
- background-color: $unnnic-color-teal-800;
223
+ background-color: $unnnic-color-weni-800;
247
224
  }
248
225
  }
249
226
 
250
227
  &--secondary {
251
- background-color: $unnnic-color-bg-base;
228
+ background-color: $unnnic-color-neutral-white;
229
+ color: $unnnic-color-neutral-dark;
252
230
  box-shadow: inset 0 0 0 $unnnic-border-width-thinner
253
- $unnnic-color-border-base;
231
+ $unnnic-color-neutral-cleanest;
254
232
 
255
233
  &:hover:enabled {
256
- background-color: $unnnic-color-gray-50;
257
- }
258
-
259
- &:active:enabled {
260
- background-color: $unnnic-color-gray-100;
234
+ background-color: $unnnic-color-neutral-light;
261
235
  }
262
236
 
263
237
  &:disabled {
264
238
  box-shadow: none;
265
239
  }
240
+
241
+ &:active:enabled {
242
+ background-color: $unnnic-color-neutral-soft;
243
+ }
266
244
  }
267
245
 
268
246
  &--tertiary {
269
247
  background-color: transparent;
248
+ color: $unnnic-color-neutral-dark;
270
249
 
271
250
  &:hover:enabled {
272
- background-color: rgba($unnnic-color-gray-400, 0.1);
251
+ background-color: $unnnic-color-neutral-light;
252
+ }
253
+
254
+ &:disabled {
255
+ color: $unnnic-color-neutral-clean;
256
+ cursor: not-allowed;
273
257
  }
274
258
 
275
259
  &:active:enabled {
276
- background-color: rgba($unnnic-color-gray-400, 0.2);
260
+ background-color: $unnnic-color-neutral-soft;
261
+ }
262
+ }
263
+
264
+ &--alternative {
265
+ background-color: $unnnic-color-weni-50;
266
+ color: $unnnic-color-weni-800;
267
+
268
+ :deep(svg .primary) {
269
+ fill: $unnnic-color-weni-800;
270
+ }
271
+
272
+ :deep(svg .primary-stroke) {
273
+ stroke: $unnnic-color-weni-800;
274
+ }
275
+
276
+ &:hover:enabled {
277
+ background-color: $unnnic-color-weni-100;
278
+ }
279
+
280
+ &:disabled {
281
+ :deep(svg .primary) {
282
+ fill: $unnnic-color-neutral-clean;
283
+ }
284
+
285
+ :deep(svg .primary-stroke) {
286
+ stroke: $unnnic-color-neutral-clean;
287
+ }
288
+ }
289
+
290
+ &:active:enabled {
291
+ background-color: $unnnic-color-weni-200;
292
+ color: $unnnic-color-weni-900;
293
+
294
+ :deep(svg .primary) {
295
+ fill: $unnnic-color-weni-900;
296
+ }
297
+
298
+ :deep(svg .primary-stroke) {
299
+ stroke: $unnnic-color-weni-900;
300
+ }
277
301
  }
278
302
  }
279
303
 
280
304
  &--warning {
281
- background-color: $unnnic-color-red-500;
305
+ background-color: $unnnic-color-aux-red-500;
282
306
  color: $unnnic-color-neutral-white;
283
307
 
284
308
  &:hover:enabled {
285
- background-color: $unnnic-color-red-600;
309
+ background-color: $unnnic-color-aux-red-700;
286
310
  }
287
311
 
288
312
  &:active:enabled {
289
- background-color: $unnnic-color-red-700;
313
+ background-color: $unnnic-color-aux-red-900;
290
314
  }
291
315
  }
292
316
 
293
317
  &--attention {
294
- background-color: $unnnic-color-yellow-500;
318
+ background-color: $unnnic-color-aux-yellow-500;
319
+ color: $unnnic-color-neutral-white;
295
320
 
296
321
  &:hover:enabled {
297
- background-color: $unnnic-color-yellow-600;
322
+ background-color: $unnnic-color-aux-yellow-700;
298
323
  }
299
324
 
300
325
  &:active:enabled {
301
- background-color: $unnnic-color-yellow-700;
326
+ background-color: $unnnic-color-aux-yellow-900;
302
327
  }
303
328
  }
304
329
 
305
330
  &--primary:disabled,
306
331
  &--secondary:disabled,
307
- &--tertiary:disabled,
332
+ &--alternative:disabled,
308
333
  &--warning:disabled,
309
334
  &--attention:disabled {
310
- background-color: $unnnic-color-bg-muted;
311
- color: $unnnic-color-fg-muted;
335
+ background-color: $unnnic-color-neutral-soft;
336
+ color: $unnnic-color-neutral-clean;
312
337
  cursor: not-allowed;
313
338
  }
314
339
 
@@ -321,12 +346,26 @@ watch(
321
346
  box-shadow: $unnnic-shadow-level-near;
322
347
  }
323
348
 
324
- &--size-large {
325
- padding: $unnnic-space-3 $unnnic-space-4;
326
- }
349
+ &--size {
350
+ &-extra-large,
351
+ &-large,
352
+ &-small {
353
+ padding: $unnnic-squish-xs;
354
+ font-size: $unnnic-font-size-body-gt;
355
+ line-height: ($unnnic-font-size-body-gt + $unnnic-line-height-medium);
356
+ }
357
+
358
+ &-extra-large {
359
+ height: 58px;
360
+ }
327
361
 
328
- &--size-small {
329
- padding: $unnnic-space-2 $unnnic-space-4;
362
+ &-large {
363
+ height: 46px;
364
+ }
365
+
366
+ &-small {
367
+ height: 38px;
368
+ }
330
369
  }
331
370
  }
332
371
  </style>
@@ -344,19 +383,29 @@ watch(
344
383
  }
345
384
 
346
385
  &-large {
347
- height: 45px;
348
- width: 45px;
386
+ height: 46px;
387
+ width: 46px;
349
388
  }
350
389
 
351
390
  &-large,
352
391
  &-extra-large {
353
392
  padding: $unnnic-inset-xs;
393
+
394
+ .unnnic-icon {
395
+ width: $unnnic-icon-size-md;
396
+ height: $unnnic-icon-size-md;
397
+ }
354
398
  }
355
399
 
356
400
  &-small {
357
401
  padding: $unnnic-inset-nano;
358
- height: 37px;
359
- width: 37px;
402
+ height: 38px;
403
+ width: 38px;
404
+
405
+ .unnnic-icon {
406
+ width: $unnnic-icon-size-ant;
407
+ height: $unnnic-icon-size-ant;
408
+ }
360
409
  }
361
410
  }
362
411
  }
@@ -4,6 +4,7 @@ export type ButtonType =
4
4
  | 'primary'
5
5
  | 'secondary'
6
6
  | 'tertiary'
7
+ | 'alternative'
7
8
  | 'warning'
8
9
  | 'attention';
9
10