@weni/unnnic-system 3.2.5 → 3.2.6

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 (40) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +1 -1
  3. package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +2 -2
  4. package/dist/components/Card/Card.vue.d.ts +1 -1
  5. package/dist/components/Card/CardCompany.vue.d.ts +1 -1
  6. package/dist/components/Card/CardStatusesContainer.vue.d.ts +1 -1
  7. package/dist/components/Card/SimpleCard.vue.d.ts +1 -1
  8. package/dist/components/Card/TitleCard.vue.d.ts +1 -1
  9. package/dist/components/CardImage/CardImage.vue.d.ts +9 -0
  10. package/dist/components/CardInformation/CardInformation.vue.d.ts +1 -1
  11. package/dist/components/CardProject/CardProject.vue.d.ts +9 -0
  12. package/dist/components/Carousel/Carousel.vue.d.ts +1 -1
  13. package/dist/components/Carousel/TagCarousel.vue.d.ts +1 -1
  14. package/dist/components/ChartBar/ChartBar.vue.d.ts +1 -1
  15. package/dist/components/ChartLine/ChartLine.vue.d.ts +1 -1
  16. package/dist/components/ChatText/ChatText.vue.d.ts +1 -1
  17. package/dist/components/ChatsContact/ChatsContact.vue.d.ts +1 -1
  18. package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +1 -1
  19. package/dist/components/DataArea/DataArea.vue.d.ts +1 -1
  20. package/dist/components/Dropdown/Dropdown.vue.d.ts +9 -0
  21. package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
  22. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +3 -2
  23. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +1 -1
  24. package/dist/components/Slider/Slider.vue.d.ts +1 -1
  25. package/dist/components/Tab/Tab.vue.d.ts +1 -1
  26. package/dist/components/Tag/IndicatorTag.vue.d.ts +1 -1
  27. package/dist/components/Tag/Tag.vue.d.ts +1 -1
  28. package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
  29. package/dist/components/index.d.ts +36 -36
  30. package/dist/{es-a07e7553.mjs → es-abc8e9a2.mjs} +1 -1
  31. package/dist/{index-93aafec9.mjs → index-22520f9b.mjs} +119 -113
  32. package/dist/{pt-br-a81c613f.mjs → pt-br-a1f8d5de.mjs} +1 -1
  33. package/dist/style.css +1 -1
  34. package/dist/unnnic.mjs +1 -1
  35. package/dist/unnnic.umd.js +7 -7
  36. package/package.json +1 -1
  37. package/src/components/Dropdown/Dropdown.vue +6 -0
  38. package/src/components/Dropdown/__tests__/Dropdown.spec.js +57 -0
  39. package/src/components/SelectSmart/SelectSmart.vue +3 -1
  40. package/src/components/SelectSmart/__tests__/SelectSmart.spec.js +45 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.2.5",
3
+ "version": "3.2.6",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -38,6 +38,10 @@ export default {
38
38
  type: Boolean,
39
39
  default: false,
40
40
  },
41
+ forceOpen: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
41
45
  position: {
42
46
  type: String,
43
47
  default: 'bottom-left',
@@ -73,10 +77,12 @@ export default {
73
77
  },
74
78
  methods: {
75
79
  onClickTrigger() {
80
+ if (this.forceOpen) return;
76
81
  if (this.useOpenProp) this.$emit('update:open', !this.open);
77
82
  else this.active = !this.active;
78
83
  },
79
84
  onClickOutside() {
85
+ if (this.forceOpen) return;
80
86
  if (this.useOpenProp && this.open) {
81
87
  this.$emit('update:open', false);
82
88
  return;
@@ -95,4 +95,61 @@ describe('Dropdown.vue', () => {
95
95
  expect(wrapper.vm.active).toBe(false);
96
96
  });
97
97
  });
98
+
99
+ describe('ForceOpen Functionality', () => {
100
+ it('should not toggle dropdown on trigger click when forceOpen is true', async () => {
101
+ await wrapper.setProps({ forceOpen: true, open: false });
102
+ const initialActiveState = wrapper.vm.active;
103
+
104
+ const trigger = wrapper.find('[data-testid="dropdown-trigger"]');
105
+ await trigger.trigger('click');
106
+
107
+ expect(wrapper.vm.active).toBe(initialActiveState);
108
+ expect(wrapper.emitted('update:open')).toBeFalsy();
109
+ });
110
+
111
+ it('should not close dropdown on outside click when forceOpen is true', async () => {
112
+ await wrapper.setProps({ forceOpen: true, open: true });
113
+ expect(wrapper.vm.active).toBe(true);
114
+
115
+ await wrapper.vm.onClickOutside();
116
+
117
+ expect(wrapper.vm.active).toBe(true);
118
+ });
119
+
120
+ it('should not emit update:open when forceOpen is true and useOpenProp is true', async () => {
121
+ await wrapper.setProps({
122
+ forceOpen: true,
123
+ useOpenProp: true,
124
+ open: false
125
+ });
126
+
127
+ const trigger = wrapper.find('[data-testid="dropdown-trigger"]');
128
+ await trigger.trigger('click');
129
+
130
+ expect(wrapper.emitted('update:open')).toBeFalsy();
131
+ });
132
+
133
+ it('should not close dropdown via onClickOutside when forceOpen is true and useOpenProp is true', async () => {
134
+ await wrapper.setProps({
135
+ forceOpen: true,
136
+ useOpenProp: true,
137
+ open: true
138
+ });
139
+
140
+ await wrapper.vm.onClickOutside();
141
+
142
+ expect(wrapper.emitted('update:open')).toBeFalsy();
143
+ });
144
+
145
+ it('should allow normal behavior when forceOpen is false', async () => {
146
+ await wrapper.setProps({ forceOpen: false, open: false });
147
+
148
+ const trigger = wrapper.find('[data-testid="dropdown-trigger"]');
149
+ await trigger.trigger('click');
150
+
151
+ expect(wrapper.vm.active).toBe(true);
152
+ expect(wrapper.emitted('update:open')).toBeTruthy();
153
+ });
154
+ });
98
155
  });
@@ -214,7 +214,7 @@ export default {
214
214
  },
215
215
  },
216
216
 
217
- emits: ['update:searchValue', 'onChange', 'update:modelValue'],
217
+ emits: ['update:searchValue', 'onChange', 'update:modelValue', 'onActiveChange'],
218
218
 
219
219
  data() {
220
220
  return {
@@ -303,6 +303,8 @@ export default {
303
303
  active(newValue) {
304
304
  this.$refs['dropdown-skeleton'].calculatePosition();
305
305
 
306
+ this.$emit('onActiveChange', newValue);
307
+
306
308
  this.$nextTick(() => {
307
309
  if (newValue && !this.multiple) {
308
310
  const activeOptionIndex = this.getOptionIndex('active');
@@ -238,6 +238,51 @@ describe('SelectSmart.vue', () => {
238
238
  });
239
239
  });
240
240
 
241
+ describe('onActiveChange Event', () => {
242
+ it('should emit onActiveChange when dropdown opens', async () => {
243
+ await input().trigger('click');
244
+
245
+ expect(wrapper.emitted('onActiveChange')).toBeTruthy();
246
+ expect(wrapper.emitted('onActiveChange')[0][0]).toBe(true);
247
+ });
248
+
249
+ it('should emit onActiveChange when dropdown closes', async () => {
250
+ wrapper.vm.active = true;
251
+ await nextTick();
252
+
253
+ wrapper.vm.active = false;
254
+ await nextTick();
255
+
256
+ expect(wrapper.emitted('onActiveChange')).toBeTruthy();
257
+ expect(wrapper.emitted('onActiveChange')[1][0]).toBe(false);
258
+ });
259
+
260
+ it('should emit onActiveChange when toggling dropdown visibility', async () => {
261
+ // Open dropdown
262
+ await input().trigger('click');
263
+
264
+ // Close dropdown
265
+ await input().trigger('click');
266
+
267
+ const emittedEvents = wrapper.emitted('onActiveChange');
268
+ expect(emittedEvents).toBeTruthy();
269
+ expect(emittedEvents.length).toBe(2);
270
+ expect(emittedEvents[0][0]).toBe(true); // opened
271
+ expect(emittedEvents[1][0]).toBe(false); // closed
272
+ });
273
+
274
+ it('should emit onActiveChange when closing dropdown with escape key', async () => {
275
+ await input().trigger('click');
276
+ expect(wrapper.emitted('onActiveChange')[0][0]).toBe(true);
277
+
278
+ await selectSmart().trigger('keydown', { key: 'Escape' });
279
+
280
+ const emittedEvents = wrapper.emitted('onActiveChange');
281
+ expect(emittedEvents.length).toBe(2);
282
+ expect(emittedEvents[1][0]).toBe(false);
283
+ });
284
+ });
285
+
241
286
  describe('Secondary Type', () => {
242
287
  beforeEach(() => {
243
288
  mountWrapper({