@weni/unnnic-system 3.12.2 → 3.12.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 (211) hide show
  1. package/dist/components/Alert/Alert.vue.d.ts +3 -3
  2. package/dist/components/Alert/Version1dot1.vue.d.ts +1 -1
  3. package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +92 -18
  4. package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +184 -36
  5. package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +1 -1
  6. package/dist/components/Button/Button.vue.d.ts +2 -2
  7. package/dist/components/Card/AccountCard.vue.d.ts +2 -2
  8. package/dist/components/Card/Card.vue.d.ts +103 -29
  9. package/dist/components/Card/CardCompany.vue.d.ts +2 -2
  10. package/dist/components/Card/CardStatusesContainer.vue.d.ts +93 -19
  11. package/dist/components/Card/ContentCard.vue.d.ts +1 -1
  12. package/dist/components/Card/DashCard.vue.d.ts +2 -2
  13. package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
  14. package/dist/components/Card/MarketplaceCard.vue.d.ts +1 -1
  15. package/dist/components/Card/SimpleCard.vue.d.ts +92 -18
  16. package/dist/components/Card/StatusCard.vue.d.ts +1 -1
  17. package/dist/components/Card/TitleCard.vue.d.ts +92 -18
  18. package/dist/components/CardImage/CardImage.vue.d.ts +5 -5
  19. package/dist/components/CardInformation/CardInformation.vue.d.ts +93 -19
  20. package/dist/components/CardProject/CardProject.vue.d.ts +2 -2
  21. package/dist/components/Carousel/Carousel.vue.d.ts +2 -2
  22. package/dist/components/Carousel/TagCarousel.vue.d.ts +2 -2
  23. package/dist/components/ChartBar/ChartBar.vue.d.ts +98 -24
  24. package/dist/components/ChartLine/ChartLine.vue.d.ts +92 -18
  25. package/dist/components/ChatText/ChatText.vue.d.ts +92 -18
  26. package/dist/components/ChatsContact/ChatsContact.vue.d.ts +6 -6
  27. package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +92 -18
  28. package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +1 -1
  29. package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
  30. package/dist/components/DataArea/DataArea.vue.d.ts +92 -18
  31. package/dist/components/DataTable/index.vue.d.ts +1 -1
  32. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  33. package/dist/components/DateFilter/DateFilter.vue.d.ts +94 -15
  34. package/dist/components/Drawer/Drawer.vue.d.ts +37 -207
  35. package/dist/components/Drawer/Drawer.vue.d.ts.map +1 -1
  36. package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
  37. package/dist/components/FormElement/FormElement.vue.d.ts +6 -6
  38. package/dist/components/ImportCard/ImportCard.vue.d.ts +6 -6
  39. package/dist/components/Input/BaseInput.vue.d.ts +22 -0
  40. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  41. package/dist/components/Input/Input.vue.d.ts +93 -14
  42. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  43. package/dist/components/Input/TextInput.vue.d.ts +54 -3
  44. package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
  45. package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
  46. package/dist/components/Label/Label.vue.d.ts +1 -1
  47. package/dist/components/Label/Label.vue.d.ts.map +1 -1
  48. package/dist/components/Modal/Modal.vue.d.ts +1 -1
  49. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +209 -35
  50. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  51. package/dist/components/ModalNext/ModalNext.vue.d.ts +99 -20
  52. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +12 -12
  53. package/dist/components/MoodRating/MoodRating.vue.d.ts +92 -18
  54. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +18 -18
  55. package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
  56. package/dist/components/Radio/Radio.vue.d.ts +6 -6
  57. package/dist/components/Select/index.vue.d.ts +44 -0
  58. package/dist/components/Select/index.vue.d.ts.map +1 -0
  59. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +63 -12
  60. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +2 -2
  61. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +5 -5
  62. package/dist/components/SelectTime/index.vue.d.ts +55 -4
  63. package/dist/components/Slider/Slider.vue.d.ts +92 -18
  64. package/dist/components/Switch/Switch.vue.d.ts +3 -3
  65. package/dist/components/Tab/Tab.vue.d.ts +92 -18
  66. package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
  67. package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
  68. package/dist/components/Tag/DefaultTag.vue.d.ts +1 -1
  69. package/dist/components/Tag/Tag.vue.d.ts +2 -2
  70. package/dist/components/TextArea/TextArea.vue.d.ts +8 -8
  71. package/dist/components/Toast/Toast.vue.d.ts +1 -1
  72. package/dist/components/Toast/Toast.vue.d.ts.map +1 -1
  73. package/dist/components/ToolTip/ToolTip.vue.d.ts +92 -18
  74. package/dist/components/ToolTip/ToolTip.vue.d.ts.map +1 -1
  75. package/dist/components/Tour/Tour.vue.d.ts +6 -6
  76. package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
  77. package/dist/components/UploadArea/UploadArea.vue.d.ts +6 -6
  78. package/dist/components/ui/dialog/Dialog.vue.d.ts +23 -0
  79. package/dist/components/ui/dialog/Dialog.vue.d.ts.map +1 -0
  80. package/dist/components/ui/dialog/DialogClose.vue.d.ts +19 -0
  81. package/dist/components/ui/dialog/DialogClose.vue.d.ts.map +1 -0
  82. package/dist/components/ui/dialog/DialogContent.vue.d.ts +43 -0
  83. package/dist/components/ui/dialog/DialogContent.vue.d.ts.map +1 -0
  84. package/dist/components/ui/dialog/DialogFooter.vue.d.ts +25 -0
  85. package/dist/components/ui/dialog/DialogFooter.vue.d.ts.map +1 -0
  86. package/dist/components/ui/dialog/DialogHeader.vue.d.ts +29 -0
  87. package/dist/components/ui/dialog/DialogHeader.vue.d.ts.map +1 -0
  88. package/dist/components/ui/dialog/DialogTitle.vue.d.ts +23 -0
  89. package/dist/components/ui/dialog/DialogTitle.vue.d.ts.map +1 -0
  90. package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +19 -0
  91. package/dist/components/ui/dialog/DialogTrigger.vue.d.ts.map +1 -0
  92. package/dist/components/ui/dialog/index.d.ts +8 -0
  93. package/dist/components/ui/dialog/index.d.ts.map +1 -0
  94. package/dist/components/ui/drawer/Drawer.vue.d.ts +35 -0
  95. package/dist/components/ui/drawer/Drawer.vue.d.ts.map +1 -0
  96. package/dist/components/ui/drawer/DrawerClose.vue.d.ts +19 -0
  97. package/dist/components/ui/drawer/DrawerClose.vue.d.ts.map +1 -0
  98. package/dist/components/ui/drawer/DrawerContent.vue.d.ts +43 -0
  99. package/dist/components/ui/drawer/DrawerContent.vue.d.ts.map +1 -0
  100. package/dist/components/ui/drawer/DrawerDescription.vue.d.ts +23 -0
  101. package/dist/components/ui/drawer/DrawerDescription.vue.d.ts.map +1 -0
  102. package/dist/components/ui/drawer/DrawerFooter.vue.d.ts +22 -0
  103. package/dist/components/ui/drawer/DrawerFooter.vue.d.ts.map +1 -0
  104. package/dist/components/ui/drawer/DrawerHeader.vue.d.ts +25 -0
  105. package/dist/components/ui/drawer/DrawerHeader.vue.d.ts.map +1 -0
  106. package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts +8 -0
  107. package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts.map +1 -0
  108. package/dist/components/ui/drawer/DrawerTitle.vue.d.ts +23 -0
  109. package/dist/components/ui/drawer/DrawerTitle.vue.d.ts.map +1 -0
  110. package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts +19 -0
  111. package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts.map +1 -0
  112. package/dist/components/ui/drawer/index.d.ts +11 -0
  113. package/dist/components/ui/drawer/index.d.ts.map +1 -0
  114. package/dist/components/ui/popover/PopoverContent.vue.d.ts +2 -2
  115. package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -1
  116. package/dist/components/ui/popover/PopoverOption.vue.d.ts +1 -1
  117. package/dist/components/ui/popover/PopoverOption.vue.d.ts.map +1 -1
  118. package/dist/components/ui/popover/PopoverTrigger.vue.d.ts.map +1 -1
  119. package/dist/components/ui/tooltip/Tooltip.vue.d.ts +23 -0
  120. package/dist/components/ui/tooltip/Tooltip.vue.d.ts.map +1 -0
  121. package/dist/components/ui/tooltip/TooltipContent.vue.d.ts +31 -0
  122. package/dist/components/ui/tooltip/TooltipContent.vue.d.ts.map +1 -0
  123. package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts +19 -0
  124. package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts.map +1 -0
  125. package/dist/components/ui/tooltip/index.d.ts +4 -0
  126. package/dist/components/ui/tooltip/index.d.ts.map +1 -0
  127. package/dist/{es-40d7aad6.mjs → es-59933601.mjs} +1 -1
  128. package/dist/{index-56b50ff8.mjs → index-4fe9253b.mjs} +99820 -96757
  129. package/dist/lib/layer-manager.d.ts +16 -0
  130. package/dist/lib/layer-manager.d.ts.map +1 -0
  131. package/dist/locales/en.json.d.ts +2 -1
  132. package/dist/locales/es.json.d.ts +2 -1
  133. package/dist/locales/pt_br.json.d.ts +2 -1
  134. package/dist/{pt-br-e6e2313f.mjs → pt-br-10db3200.mjs} +1 -1
  135. package/dist/style.css +1 -1
  136. package/dist/unnnic.mjs +234 -204
  137. package/dist/unnnic.umd.js +48 -44
  138. package/package.json +3 -2
  139. package/src/assets/scss/scheme-colors.scss +223 -223
  140. package/src/assets/scss/tailwind.scss +8 -0
  141. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
  142. package/src/components/Checkbox/Checkbox.vue +1 -1
  143. package/src/components/Drawer/Drawer.vue +190 -269
  144. package/src/components/Drawer/__tests__/Drawer.spec.js +37 -46
  145. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
  146. package/src/components/Input/BaseInput.vue +21 -2
  147. package/src/components/Input/Input.scss +2 -3
  148. package/src/components/Input/Input.vue +19 -1
  149. package/src/components/Input/TextInput.vue +58 -22
  150. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -1
  151. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -1
  152. package/src/components/ModalDialog/ModalDialog.vue +64 -148
  153. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +11 -221
  154. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
  155. package/src/components/MultiSelectV2/MultSelectOption.vue +67 -0
  156. package/src/components/MultiSelectV2/__tests__/MultiSelect.spec.js +556 -0
  157. package/src/components/MultiSelectV2/__tests__/MultiSelectOption.spec.js +229 -0
  158. package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelect.spec.js.snap +121 -0
  159. package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
  160. package/src/components/MultiSelectV2/index.vue +224 -0
  161. package/src/components/Select/__tests__/Select.spec.js +422 -0
  162. package/src/components/Select/__tests__/SelectItem.spec.js +330 -0
  163. package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
  164. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +65 -0
  165. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
  166. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
  167. package/src/components/Select/__tests__/__snapshots__/SelectPopover.spec.js.snap +8 -0
  168. package/src/components/Select/index.vue +261 -0
  169. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
  170. package/src/components/Toast/Toast.vue +16 -9
  171. package/src/components/ToolTip/ToolTip.vue +25 -177
  172. package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
  173. package/src/components/index.ts +60 -4
  174. package/src/components/ui/dialog/Dialog.vue +19 -0
  175. package/src/components/ui/dialog/DialogClose.vue +29 -0
  176. package/src/components/ui/dialog/DialogContent.vue +140 -0
  177. package/src/components/ui/dialog/DialogFooter.vue +50 -0
  178. package/src/components/ui/dialog/DialogHeader.vue +83 -0
  179. package/src/components/ui/dialog/DialogTitle.vue +38 -0
  180. package/src/components/ui/dialog/DialogTrigger.vue +16 -0
  181. package/src/components/ui/dialog/index.ts +7 -0
  182. package/src/components/ui/drawer/Drawer.vue +27 -0
  183. package/src/components/ui/drawer/DrawerClose.vue +37 -0
  184. package/src/components/ui/drawer/DrawerContent.vue +111 -0
  185. package/src/components/ui/drawer/DrawerDescription.vue +40 -0
  186. package/src/components/ui/drawer/DrawerFooter.vue +38 -0
  187. package/src/components/ui/drawer/DrawerHeader.vue +57 -0
  188. package/src/components/ui/drawer/DrawerOverlay.vue +33 -0
  189. package/src/components/ui/drawer/DrawerTitle.vue +37 -0
  190. package/src/components/ui/drawer/DrawerTrigger.vue +31 -0
  191. package/src/components/ui/drawer/index.ts +10 -0
  192. package/src/components/ui/popover/PopoverContent.vue +4 -2
  193. package/src/components/ui/popover/PopoverOption.vue +4 -0
  194. package/src/components/ui/popover/PopoverTrigger.vue +5 -1
  195. package/src/components/ui/tooltip/Tooltip.vue +21 -0
  196. package/src/components/ui/tooltip/TooltipContent.vue +74 -0
  197. package/src/components/ui/tooltip/TooltipTrigger.vue +26 -0
  198. package/src/components/ui/tooltip/index.ts +3 -0
  199. package/src/lib/layer-manager.ts +84 -0
  200. package/src/locales/en.json +2 -1
  201. package/src/locales/es.json +2 -1
  202. package/src/locales/pt_br.json +2 -1
  203. package/src/stories/Dialog.stories.js +832 -0
  204. package/src/stories/Drawer.stories.js +1 -1
  205. package/src/stories/DrawerNext.stories.js +611 -0
  206. package/src/stories/LayerManager.docs.mdx +40 -0
  207. package/src/stories/LayerManager.stories.js +364 -0
  208. package/src/stories/ModalDialog.mdx +3 -0
  209. package/src/stories/ModalDialog.stories.js +1 -1
  210. package/src/stories/MultiSelectV2.stories.js +158 -0
  211. package/src/stories/Select.stories.js +158 -0
@@ -1,5 +1,5 @@
1
1
  import { mount } from '@vue/test-utils';
2
- import { describe, it, vi } from 'vitest';
2
+ import { describe, it } from 'vitest';
3
3
  import ModalDialog from '../ModalDialog.vue';
4
4
 
5
5
  describe('ModalDialog.vue', () => {
@@ -16,7 +16,12 @@ describe('ModalDialog.vue', () => {
16
16
  'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e }),
17
17
  },
18
18
  global: {
19
- stubs: ['UnnnicIcon', 'UnnnicButton'],
19
+ stubs: [
20
+ 'teleport',
21
+ 'UnnnicIcon',
22
+ 'UnnnicButton',
23
+ 'UnnnicDialogContent',
24
+ ],
20
25
  },
21
26
  });
22
27
  });
@@ -26,231 +31,16 @@ describe('ModalDialog.vue', () => {
26
31
  expect(wrapper.html()).toMatchSnapshot();
27
32
  });
28
33
 
29
- it('should render correctly when modelValue is true', () => {
30
- const modal = wrapper.find('[data-testid="modal-dialog"]');
31
- expect(modal.exists()).toBe(true);
32
- });
33
-
34
- it('should not render when modelValue is false', async () => {
35
- await wrapper.setProps({ modelValue: false });
36
-
37
- const modal = wrapper.find('[data-testid="modal-dialog"]');
38
- expect(modal.exists()).toBe(false);
39
- });
40
-
41
34
  it('should apply the correct size class based on the size prop', async () => {
42
- const modalContainer = wrapper.find('[data-testid="modal-container"]');
43
- const defaultClass = 'unnnic-modal-dialog__container';
35
+ const modalContainer = wrapper.find('[data-testid="modal-dialog"]');
44
36
 
45
- expect(modalContainer.classes()).toContain(defaultClass + '--md');
37
+ expect(modalContainer.attributes('size')).toContain('medium');
46
38
 
47
39
  await wrapper.setProps({ size: 'lg' });
48
- expect(modalContainer.classes()).toContain(defaultClass + '--lg');
40
+ expect(modalContainer.attributes('size')).toContain('large');
49
41
 
50
42
  await wrapper.setProps({ size: 'sm' });
51
- expect(modalContainer.classes()).toContain(defaultClass + '--sm');
52
- });
53
-
54
- it('should render the icon and title when provided', () => {
55
- const title = wrapper.find('[data-testid="title-text"]');
56
- expect(title.exists()).toBe(true);
57
- expect(title.text()).toBe('Test Title');
58
-
59
- const icon = wrapper.findComponent('[data-testid="title-icon"]');
60
- expect(icon.exists()).toBe(true);
61
- expect(icon.props('icon')).toBe('test-icon');
62
- });
63
-
64
- it('should render the icon from iconsMapper when type prop is provided', async () => {
65
- await wrapper.setProps({
66
- type: 'success',
67
- icon: '',
68
- });
69
-
70
- const icon = wrapper.findComponent('[data-testid="title-icon"]');
71
- expect(icon.exists()).toBe(true);
72
- expect(icon.props().icon).toBe(wrapper.vm.iconsMapper['success'].icon);
73
- });
74
-
75
- it('should not render the icon when both icon and type props are not provided', async () => {
76
- await wrapper.setProps({
77
- icon: '',
78
- type: '',
79
- });
80
-
81
- const icon = wrapper.find('[data-testid="title-icon"]');
82
- expect(icon.exists()).toBe(false);
83
- });
84
-
85
- it('should render the close icon when showCloseIcon is true', () => {
86
- const closeIcon = wrapper.find('[data-testid="close-icon"]');
87
- expect(closeIcon.exists()).toBe(true);
88
- });
89
-
90
- it('should not render buttons when primaryButtonProps is not provided', async () => {
91
- await wrapper.setProps({ primaryButtonProps: undefined });
92
-
93
- const primaryButton = wrapper.find('[data-testid="primary-button"]');
94
- const secondaryButton = wrapper.find('[data-testid="secondary-button"]');
95
- expect(primaryButton.exists()).toBe(false);
96
- expect(secondaryButton.exists()).toBe(false);
97
- });
98
- });
99
-
100
- describe('Overlay behavior', () => {
101
- it('should close the modal when clicking on the overlay if persistent is false', async () => {
102
- expect(wrapper.props().modelValue).toBe(true);
103
-
104
- const overlay = wrapper.find('[data-testid="modal-overlay"]');
105
- await overlay.trigger('click');
106
-
107
- expect(wrapper.emitted('update:modelValue')).toBeTruthy();
108
- expect(wrapper.emitted('update:modelValue')[0]).toEqual([false]);
109
- expect(wrapper.props().modelValue).toBe(false);
110
- });
111
-
112
- it('should not close the modal when clicking on the overlay if persistent is true', async () => {
113
- await wrapper.setProps({ persistent: true });
114
-
115
- const overlay = wrapper.find('[data-testid="modal-overlay"]');
116
- await overlay.trigger('click');
117
-
118
- expect(wrapper.emitted('update:modelValue')).toBeFalsy();
119
- expect(wrapper.props().modelValue).toBe(true);
120
- });
121
- });
122
-
123
- describe('Slot rendering', () => {
124
- it('should render leftSidebar slot when provided', () => {
125
- const wrapper = mount(ModalDialog, {
126
- props: {
127
- modelValue: true,
128
- },
129
- slots: {
130
- leftSidebar:
131
- '<div data-testid="left-sidebar">Left Sidebar Content</div>',
132
- },
133
- });
134
-
135
- const leftSidebar = wrapper.find('[data-testid="left-sidebar"]');
136
- expect(leftSidebar.exists()).toBe(true);
137
- expect(leftSidebar.text()).toBe('Left Sidebar Content');
138
- });
139
-
140
- it('should render default slot content', () => {
141
- const wrapper = mount(ModalDialog, {
142
- props: {
143
- modelValue: true,
144
- },
145
- slots: {
146
- default: '<div data-testid="default-slot">Default Slot Content</div>',
147
- },
148
- });
149
-
150
- const defaultSlot = wrapper.find('[data-testid="default-slot"]');
151
- expect(defaultSlot.exists()).toBe(true);
152
- expect(defaultSlot.text()).toBe('Default Slot Content');
153
- });
154
- });
155
-
156
- describe('Buttons actions', () => {
157
- it('should close the modal when clicking on close icon', async () => {
158
- const closeIcon = wrapper.find('[data-testid="close-icon"]');
159
- await closeIcon.trigger('click');
160
-
161
- expect(wrapper.emitted('update:modelValue')).toBeTruthy();
162
- expect(wrapper.emitted('update:modelValue')[0]).toEqual([false]);
163
- expect(wrapper.props().modelValue).toBe(false);
164
- });
165
-
166
- it('should emit primaryButtonClick event when the primary button is clicked', async () => {
167
- const primaryButton = wrapper.find('[data-testid="primary-button"]');
168
- await primaryButton.trigger('click');
169
-
170
- expect(wrapper.emitted('primaryButtonClick')).toBeTruthy();
171
- });
172
-
173
- it('should emit secondaryButtonClick event when the secondary button is clicked', async () => {
174
- await wrapper.setProps({
175
- secondaryButtonProps: { text: 'Cancel' },
176
- });
177
-
178
- const secondaryButton = wrapper.find('[data-testid="secondary-button"]');
179
- await secondaryButton.trigger('click');
180
-
181
- expect(wrapper.emitted('secondaryButtonClick')).toBeTruthy();
182
- });
183
-
184
- it('should close the modal when the secondary button is clicked and no secondaryButtonClick event is provided', async () => {
185
- const secondaryButton = wrapper.find('[data-testid="secondary-button"]');
186
- await secondaryButton.trigger('click');
187
-
188
- const emittedValue = wrapper.emitted('update:modelValue');
189
-
190
- expect(emittedValue).toBeTruthy();
191
- expect(emittedValue[0][0]).toEqual(false);
192
- });
193
- });
194
-
195
- describe('Actions and appearance', () => {
196
- it('should not render the secondary button when hideSecondaryButton is true', async () => {
197
- await wrapper.setProps({
198
- hideSecondaryButton: true,
199
- });
200
- const secondaryButton = wrapper.find('[data-testid="secondary-button"]');
201
- expect(secondaryButton.exists()).toBe(false);
202
- });
203
-
204
- it('should apply a divider class to the actions section when showActionsDivider is true', async () => {
205
- await wrapper.setProps({
206
- showActionsDivider: true,
207
- });
208
-
209
- const actionsSection = wrapper.find('[data-testid="actions-section"]');
210
- expect(actionsSection.classes()).toContain(
211
- 'unnnic-modal-dialog__container__actions--divider',
212
- );
213
- });
214
- });
215
-
216
- describe('Body overflow', () => {
217
- it('should toggle body overflow based on modal visibility', async () => {
218
- await wrapper.setProps({ modelValue: false });
219
- const updateBodyOverflowSpy = vi.spyOn(wrapper.vm, 'updateBodyOverflow');
220
-
221
- await wrapper.setProps({ modelValue: true });
222
- expect(updateBodyOverflowSpy).toHaveBeenCalledWith(true);
223
-
224
- await wrapper.setProps({ modelValue: false });
225
- expect(updateBodyOverflowSpy).toHaveBeenCalledWith(false);
226
- });
227
- });
228
-
229
- describe('Validators', () => {
230
- describe('type prop validator', () => {
231
- it('should validate type prop when a valid value is provided', () => {
232
- const validTypes = ['success', 'warning', 'attention'];
233
- validTypes.forEach((validType) => {
234
- expect(ModalDialog.props.type.validate(validType)).toBe(true);
235
- });
236
- });
237
-
238
- it('should invalidate type prop when an invalid value is provided', () => {
239
- expect(ModalDialog.props.type.validate('invalidType')).toBe(false);
240
- });
241
- });
242
-
243
- describe('size prop validator', () => {
244
- it('should validate size prop when a valid value is provided', () => {
245
- const validSizes = ['sm', 'md', 'lg'];
246
- validSizes.forEach((validSize) => {
247
- expect(ModalDialog.props.size.validate(validSize)).toBe(true);
248
- });
249
- });
250
-
251
- it('should invalidate size prop when an invalid value is provided', () => {
252
- expect(ModalDialog.props.size.validate('invalidSize')).toBe(false);
253
- });
43
+ expect(modalContainer.attributes('size')).toContain('small');
254
44
  });
255
45
  });
256
46
  });
@@ -1,24 +1,3 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
4
- "<section data-v-68ebadeb="" class="unnnic-modal-dialog" data-testid="modal-dialog">
5
- <section data-v-68ebadeb="" class="unnnic-modal-dialog__overlay" data-testid="modal-overlay"></section>
6
- <section data-v-68ebadeb="" class="unnnic-modal-dialog__container unnnic-modal-dialog__container--md" data-testid="modal-container">
7
- <!--v-if-->
8
- <section data-v-68ebadeb="" class="unnnic-modal-dialog__container__body">
9
- <header data-v-68ebadeb="" class="unnnic-modal-dialog__container__header">
10
- <section data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-container">
11
- <unnnic-icon-stub data-v-68ebadeb="" filled="false" icon="test-icon" clickable="false" size="md" scheme="neutral-darkest" data-testid="title-icon" class="unnnic-modal-dialog__container__title-icon"></unnnic-icon-stub>
12
- <h1 data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-text" data-testid="title-text">Test Title</h1>
13
- </section>
14
- <unnnic-icon-stub data-v-68ebadeb="" filled="false" icon="close" clickable="true" size="md" scheme="neutral-cloudy" data-testid="close-icon"></unnnic-icon-stub>
15
- </header>
16
- <section data-v-68ebadeb="" class="unnnic-modal-dialog__container__content"></section>
17
- <section data-v-68ebadeb="" data-testid="actions-section" class="unnnic-modal-dialog__container__actions">
18
- <unnnic-button-stub data-v-68ebadeb="" size="large" text="Cancel" type="tertiary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="secondary-button" class="unnnic-modal-dialog__container__actions__secondary-button"></unnnic-button-stub>
19
- <unnnic-button-stub data-v-68ebadeb="" size="large" text="Confirm" type="primary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="primary-button" class="unnnic-modal-dialog__container__actions__primary-button"></unnnic-button-stub>
20
- </section>
21
- </section>
22
- </section>
23
- </section>"
24
- `;
3
+ exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `"<unnnic-dialog-content-stub data-v-68ebadeb="" forcemount="false" disableoutsidepointerevents="false" aschild="false" parentclass="unnnic-modal-dialog," class="unnnic-modal-dialog__container" size="medium" data-testid="modal-dialog"></unnnic-dialog-content-stub>"`;
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <div :class="['unnnic-multi-select-option']">
3
+ <UnnnicCheckbox
4
+ :modelValue="props.active"
5
+ :disabled="props.disabled"
6
+ :label="props.label"
7
+ @update:model-value="emit('update:modelValue', !props.active)"
8
+ />
9
+ </div>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import UnnnicCheckbox from '../Checkbox/Checkbox.vue';
14
+
15
+ defineOptions({
16
+ name: 'UnnnicMultiSelectOption',
17
+ });
18
+
19
+ const emit = defineEmits<{
20
+ 'update:modelValue': [boolean];
21
+ }>();
22
+
23
+ interface SelectOptionProps {
24
+ label: string;
25
+ disabled?: boolean;
26
+ active?: boolean;
27
+ focused?: boolean;
28
+ }
29
+
30
+ const props = withDefaults(defineProps<SelectOptionProps>(), {
31
+ disabled: false,
32
+ active: false,
33
+ focused: false,
34
+ });
35
+ </script>
36
+
37
+ <style lang="scss" scoped>
38
+ @use '@/assets/scss/unnnic' as *;
39
+ * {
40
+ margin: 0;
41
+ padding: 0;
42
+ box-sizing: border-box;
43
+ }
44
+
45
+ .unnnic-multi-select-option {
46
+ // cursor: pointer;
47
+ border-radius: $unnnic-radius-1;
48
+ font: $unnnic-font-emphasis;
49
+
50
+ // TODO: remove variations styles?
51
+ // &:hover:not(&--active):not(&--disabled),
52
+ // &--focused {
53
+ // background-color: $unnnic-color-bg-soft;
54
+ // }
55
+
56
+ // &--active {
57
+ // background-color: $unnnic-color-bg-active;
58
+ // color: $unnnic-color-fg-inverted;
59
+ // }
60
+
61
+ // &--disabled {
62
+ // color: $unnnic-color-fg-muted;
63
+ // background-color: $unnnic-color-bg-muted;
64
+ // cursor: not-allowed;
65
+ // }
66
+ }
67
+ </style>