@weni/unnnic-system 3.2.9-alpha.11 → 3.2.9-alpha.12

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 (38) hide show
  1. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  2. package/dist/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue.d.ts.map +1 -1
  3. package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
  4. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +1 -1
  5. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  6. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +1 -1
  7. package/dist/components/index.d.ts +2 -2
  8. package/dist/{es-dcef703d.js → es-66126ef1.mjs} +1 -1
  9. package/dist/{index-6ddf8580.js → index-f6e9b879.mjs} +15 -15
  10. package/dist/{pt-br-485ef253.js → pt-br-3b5a8852.mjs} +1 -1
  11. package/dist/style.css +1 -1
  12. package/dist/{unnnic.js → unnnic.mjs} +1 -1
  13. package/dist/{unnnic.umd.cjs → unnnic.umd.js} +5 -5
  14. package/package.json +2 -2
  15. package/src/components/Button/Button.vue +4 -7
  16. package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +2 -1
  17. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +61 -60
  18. package/src/components/Chip/Chip.vue +1 -1
  19. package/src/components/Input/BaseInput.vue +4 -4
  20. package/src/components/Input/Input.vue +1 -1
  21. package/src/components/Input/TextInput.vue +3 -2
  22. package/src/components/ModalDialog/ModalDialog.vue +26 -29
  23. package/src/components/Popover/__tests__/Popover.spec.js +18 -18
  24. package/src/components/Popover/index.vue +78 -93
  25. package/src/components/Select/SelectOption.vue +37 -43
  26. package/src/components/Select/__tests__/Select.spec.js +36 -41
  27. package/src/components/Select/__tests__/SelectItem.spec.js +15 -35
  28. package/src/components/Select/__tests__/SelectOption.spec.js +3 -6
  29. package/src/components/Select/index.vue +142 -192
  30. package/src/components/TemplatePreview/TemplatePreview.vue +25 -28
  31. package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
  32. package/src/components/TemplatePreview/types.d.ts +3 -3
  33. package/src/stories/Button.stories.js +7 -1
  34. package/src/stories/Input.stories.js +4 -4
  35. package/src/stories/Popover.stories.js +9 -9
  36. package/src/stories/Select.stories.js +39 -39
  37. package/src/stories/TemplatePreview.stories.js +27 -27
  38. package/src/stories/TemplatePreviewModal.stories.js +31 -31
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.2.9-alpha.11",
4
- "type": "module",
3
+ "version": "3.2.9-alpha.12",
4
+ "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
7
7
  "src",
@@ -133,11 +133,9 @@ const isSizePropValid = computed(() => {
133
133
  });
134
134
 
135
135
  const buttonType = computed(() => {
136
- return (
137
- {
138
- alternative: 'tertiary',
139
- }[props.type] || props.type
140
- );
136
+ return {
137
+ 'alternative': 'tertiary',
138
+ }[props.type] || props.type;
141
139
  });
142
140
 
143
141
  const isTypePropValid = computed(() => {
@@ -162,8 +160,7 @@ const validateProps = () => {
162
160
 
163
161
  if (!isTypePropValid.value) {
164
162
  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.';
163
+ errorMessage += ' Please provide one of the following types: primary, secondary, tertiary, warning, attention. Alternative is discontinued and it was forced renamed to tertiary.';
167
164
  }
168
165
 
169
166
  throw new Error(errorMessage);
@@ -59,8 +59,9 @@ const props = defineProps<{
59
59
  }>();
60
60
 
61
61
  const calculatedTransform = computed(() => {
62
- return `skew(${props.data.length === 2 ? '-8deg' : '-12deg'}, 0deg) translateX(-20px)`;
62
+ return `skew(${props.data.length === 2 ? '-8deg': '-12deg'}, 0deg) translateX(-20px)`;
63
63
  });
64
+
64
65
  </script>
65
66
 
66
67
  <style lang="scss" scoped>
@@ -1,64 +1,65 @@
1
1
  <template>
2
- <ChartFunnelBaseRow
3
- class="unnnic-chart-funnel-two-rows"
4
- :rows="rows"
5
- viewBox="0 0 250 148"
6
- />
7
- </template>
8
-
9
- <script>
10
- import ChartFunnelBaseRow from './ChartFunnelBaseRow.vue';
11
- export default {
12
- name: 'UnnnicChartFunnelTwoRows',
13
-
14
- components: {
15
- ChartFunnelBaseRow,
16
- },
17
-
18
- props: {
19
- data: {
20
- type: Array,
21
- required: true,
2
+ <ChartFunnelBaseRow
3
+ class="unnnic-chart-funnel-two-rows"
4
+ :rows="rows"
5
+ viewBox="0 0 250 148"
6
+ />
7
+ </template>
8
+
9
+ <script>
10
+ import ChartFunnelBaseRow from './ChartFunnelBaseRow.vue';
11
+ export default {
12
+ name: 'UnnnicChartFunnelTwoRows',
13
+
14
+ components: {
15
+ ChartFunnelBaseRow,
22
16
  },
23
- },
24
-
25
- computed: {
26
- rows() {
27
- const { data } = this;
28
- return [
29
- {
30
- pathD:
31
- 'M362.938 0H12.025C6.30976 0 2.43799 5.81972 4.64626 11.0911L31 74H343.75L370.307 11.1122C372.535 5.83818 368.663 0 362.938 0Z',
32
- titleX: '50%',
33
- titleY: '32',
34
- descriptionX: '50%',
35
- descriptionY: '52',
36
- title: data[0].title,
37
- description: data[0].description,
38
- },
39
- {
40
- pathD: 'M344 74H31L63.4654 148H311.535L344 74Z',
41
- titleX: '50%',
42
- titleY: '106',
43
- descriptionX: '50%',
44
- descriptionY: '126',
45
- title: data[1].title,
46
- description: data[1].description,
47
- },
48
- ];
17
+
18
+ props: {
19
+ data: {
20
+ type: Array,
21
+ required: true,
22
+ },
49
23
  },
50
- },
51
- };
52
- </script>
53
-
54
- <style lang="scss">
55
- @use '@/assets/scss/unnnic' as *;
56
- .unnnic-chart-funnel-two-rows {
57
- [class$='row']:nth-child(1) {
58
- fill: $unnnic-color-weni-950;
59
- }
60
- [class$='row']:nth-child(2) {
61
- fill: $unnnic-color-weni-800;
24
+
25
+ computed: {
26
+ rows() {
27
+ const { data } = this;
28
+ return [
29
+ {
30
+ pathD:
31
+ 'M362.938 0H12.025C6.30976 0 2.43799 5.81972 4.64626 11.0911L31 74H343.75L370.307 11.1122C372.535 5.83818 368.663 0 362.938 0Z',
32
+ titleX: '50%',
33
+ titleY: '32',
34
+ descriptionX: '50%',
35
+ descriptionY: '52',
36
+ title: data[0].title,
37
+ description: data[0].description,
38
+ },
39
+ {
40
+ pathD: 'M344 74H31L63.4654 148H311.535L344 74Z',
41
+ titleX: '50%',
42
+ titleY: '106',
43
+ descriptionX: '50%',
44
+ descriptionY: '126',
45
+ title: data[1].title,
46
+ description: data[1].description,
47
+ }
48
+ ];
49
+ },
50
+ },
51
+ };
52
+ </script>
53
+
54
+ <style lang="scss">
55
+ @use '@/assets/scss/unnnic' as *;
56
+ .unnnic-chart-funnel-two-rows {
57
+ [class$='row']:nth-child(1) {
58
+ fill: $unnnic-color-weni-950;
59
+ }
60
+ [class$='row']:nth-child(2) {
61
+ fill: $unnnic-color-weni-800;
62
+ }
62
63
  }
63
- }
64
- </style>
64
+ </style>
65
+
@@ -80,7 +80,7 @@ const chipClass = computed(() => {
80
80
  border-radius: 600px;
81
81
  background-color: $unnnic-color-bg-base;
82
82
  border: 1px solid transparent;
83
-
83
+
84
84
  &:hover {
85
85
  background-color: $unnnic-color-bg-soft;
86
86
  }
@@ -4,7 +4,7 @@
4
4
  v-mask="mask"
5
5
  v-bind="attributes"
6
6
  :value="fullySanitize(modelValue)"
7
- :class="[classes, { focus: forceActiveStatus }]"
7
+ :class="[classes, { 'focus': forceActiveStatus }]"
8
8
  :type="nativeType"
9
9
  :readonly="readonly"
10
10
  />
@@ -12,7 +12,7 @@
12
12
  v-else
13
13
  v-bind="attributes"
14
14
  :value="fullySanitize(modelValue)"
15
- :class="[classes, { focus: forceActiveStatus }]"
15
+ :class="[classes, { 'focus': forceActiveStatus }]"
16
16
  :type="nativeType"
17
17
  :maxlength="maxlength"
18
18
  :readonly="readonly"
@@ -133,8 +133,8 @@ export default {
133
133
  }
134
134
 
135
135
  &.input--has-clear-icon {
136
- padding-right: $unnnic-space-10;
137
- }
136
+ padding-right: $unnnic-space-10;
137
+ }
138
138
 
139
139
  &.error {
140
140
  @include input-error;
@@ -159,7 +159,7 @@ export default {
159
159
  default: false,
160
160
  },
161
161
  },
162
-
162
+
163
163
  emits: ['update:modelValue', 'clear'],
164
164
 
165
165
  data() {
@@ -52,6 +52,7 @@
52
52
  @click="onIconRightClick"
53
53
  />
54
54
  </section>
55
+
55
56
  </div>
56
57
  </template>
57
58
 
@@ -131,7 +132,7 @@ export default {
131
132
  showClear: {
132
133
  type: Boolean,
133
134
  default: false,
134
- },
135
+ }
135
136
  },
136
137
  emits: ['icon-left-click', 'icon-right-click', 'clear'],
137
138
  data() {
@@ -232,7 +233,7 @@ export default {
232
233
  top: 50%;
233
234
  transform: translateY(-50%);
234
235
  right: $unnnic-space-4;
235
-
236
+
236
237
  display: flex;
237
238
  align-items: center;
238
239
  gap: $unnnic-space-2;
@@ -24,10 +24,7 @@
24
24
  </section>
25
25
 
26
26
  <section class="unnnic-modal-dialog__container__body">
27
- <header
28
- v-if="title"
29
- class="unnnic-modal-dialog__container__header"
30
- >
27
+ <header v-if="title" class="unnnic-modal-dialog__container__header">
31
28
  <section class="unnnic-modal-dialog__container__title-container">
32
29
  <UnnnicIcon
33
30
  v-if="icon || type"
@@ -99,12 +96,12 @@
99
96
  </template>
100
97
 
101
98
  <script>
102
- import UnnnicIcon from '../Icon.vue';
103
- import UnnnicButton from '../Button/Button.vue';
104
- import UnnnicI18n from '../../mixins/i18n';
99
+ import UnnnicIcon from "../Icon.vue";
100
+ import UnnnicButton from "../Button/Button.vue";
101
+ import UnnnicI18n from "../../mixins/i18n";
105
102
 
106
103
  export default {
107
- name: 'UnnnicModalDialog',
104
+ name: "UnnnicModalDialog",
108
105
  components: {
109
106
  UnnnicIcon,
110
107
  UnnnicButton,
@@ -121,29 +118,29 @@ export default {
121
118
  },
122
119
  type: {
123
120
  type: String,
124
- default: '',
121
+ default: "",
125
122
  validate(type) {
126
- return ['success', 'warning', 'attention'].includes(type);
123
+ return ["success", "warning", "attention"].includes(type);
127
124
  },
128
125
  },
129
126
  size: {
130
127
  type: String,
131
- default: 'md',
128
+ default: "md",
132
129
  validate(size) {
133
- return ['sm', 'md', 'lg'].includes(size);
130
+ return ["sm", "md", "lg"].includes(size);
134
131
  },
135
132
  },
136
133
  title: {
137
134
  type: String,
138
- default: '',
135
+ default: "",
139
136
  },
140
137
  icon: {
141
138
  type: String,
142
- default: '',
139
+ default: "",
143
140
  },
144
141
  iconScheme: {
145
142
  type: String,
146
- default: '',
143
+ default: "",
147
144
  },
148
145
  showCloseIcon: {
149
146
  type: Boolean,
@@ -166,26 +163,26 @@ export default {
166
163
  default: () => ({}),
167
164
  },
168
165
  },
169
- emits: ['primaryButtonClick', 'secondaryButtonClick', 'update:modelValue'],
166
+ emits: ["primaryButtonClick", "secondaryButtonClick", "update:modelValue"],
170
167
 
171
168
  data() {
172
169
  return {
173
170
  defaultTranslations: {
174
171
  cancel: {
175
- 'pt-br': 'Cancelar',
176
- en: 'Cancel',
177
- es: 'Cancelar',
172
+ "pt-br": "Cancelar",
173
+ en: "Cancel",
174
+ es: "Cancelar",
178
175
  },
179
176
  },
180
177
  iconsMapper: {
181
- success: { icon: 'check_circle', scheme: 'aux-green-500' },
182
- warning: { icon: 'warning', scheme: 'aux-red-500' },
183
- attention: { icon: 'error', scheme: 'aux-yellow-500' },
178
+ success: { icon: "check_circle", scheme: "aux-green-500" },
179
+ warning: { icon: "warning", scheme: "aux-red-500" },
180
+ attention: { icon: "error", scheme: "aux-yellow-500" },
184
181
  },
185
182
  primaryButtonTypeMapper: {
186
- success: 'primary',
187
- warning: 'warning',
188
- attention: 'attention',
183
+ success: "primary",
184
+ warning: "warning",
185
+ attention: "attention",
189
186
  },
190
187
  };
191
188
  },
@@ -196,17 +193,17 @@ export default {
196
193
  },
197
194
  methods: {
198
195
  close() {
199
- this.$emit('update:modelValue', false);
196
+ this.$emit("update:modelValue", false);
200
197
  },
201
198
  updateBodyOverflow(isHidden) {
202
- document.body.style.overflow = isHidden ? 'hidden' : '';
199
+ document.body.style.overflow = isHidden ? "hidden" : "";
203
200
  },
204
201
  },
205
202
  };
206
203
  </script>
207
204
 
208
205
  <style lang="scss" scoped>
209
- @use '@/assets/scss/unnnic' as *;
206
+ @use "@/assets/scss/unnnic" as *;
210
207
  * {
211
208
  margin: 0;
212
209
  padding: 0;
@@ -313,7 +310,7 @@ export default {
313
310
  &__actions {
314
311
  display: grid;
315
312
  grid-template-columns: 1fr 1fr;
316
- grid-template-areas: 'secondary-button primary-button';
313
+ grid-template-areas: "secondary-button primary-button";
317
314
  gap: $unnnic-spacing-sm;
318
315
  padding: $unnnic-spacing-md;
319
316
  flex-shrink: 0;
@@ -4,7 +4,7 @@ import UnnnicPopover from '@/components/Popover/index.vue';
4
4
 
5
5
  vi.mock('@vueuse/core', () => ({
6
6
  onClickOutside: vi.fn(),
7
- useResizeObserver: vi.fn(),
7
+ useResizeObserver: vi.fn()
8
8
  }));
9
9
 
10
10
  describe('UnnnicPopover.vue', () => {
@@ -12,7 +12,7 @@ describe('UnnnicPopover.vue', () => {
12
12
 
13
13
  const defaultSlots = {
14
14
  trigger: '<button data-testid="trigger-button">Click me</button>',
15
- content: '<div data-testid="popover-content">Popover content</div>',
15
+ content: '<div data-testid="popover-content">Popover content</div>'
16
16
  };
17
17
 
18
18
  const mountWrapper = (props) => {
@@ -20,9 +20,9 @@ describe('UnnnicPopover.vue', () => {
20
20
  slots: defaultSlots,
21
21
  props: {
22
22
  ...props,
23
- },
23
+ }
24
24
  });
25
- };
25
+ }
26
26
 
27
27
  beforeEach(() => {
28
28
  wrapper = mountWrapper();
@@ -40,7 +40,7 @@ describe('UnnnicPopover.vue', () => {
40
40
  test('renders trigger slot', () => {
41
41
  const trigger = wrapper.find('[data-testid="popover-trigger"]');
42
42
  const triggerButton = wrapper.find('[data-testid="trigger-button"]');
43
-
43
+
44
44
  expect(trigger.exists()).toBe(true);
45
45
  expect(triggerButton.exists()).toBe(true);
46
46
  expect(triggerButton.text()).toBe('Click me');
@@ -51,7 +51,7 @@ describe('UnnnicPopover.vue', () => {
51
51
  await wrapper.vm.$nextTick();
52
52
  const balloon = wrapper.find('[data-testid="popover-balloon"]');
53
53
  const content = wrapper.find('[data-testid="popover-content"]');
54
-
54
+
55
55
  expect(balloon.exists()).toBe(true);
56
56
  expect(content.exists()).toBe(true);
57
57
  expect(content.text()).toBe('Popover content');
@@ -64,9 +64,9 @@ describe('UnnnicPopover.vue', () => {
64
64
 
65
65
  test('toggles balloon visibility when trigger is clicked', async () => {
66
66
  const trigger = wrapper.find('[data-testid="popover-trigger"]');
67
-
67
+
68
68
  let balloon = wrapper.find('[data-testid="popover-balloon"]');
69
-
69
+
70
70
  expect(balloon.exists()).toBe(false);
71
71
 
72
72
  await trigger.trigger('click');
@@ -85,10 +85,10 @@ describe('UnnnicPopover.vue', () => {
85
85
 
86
86
  test('emits update:modelValue when open state changes', async () => {
87
87
  await wrapper.setProps({ modelValue: false });
88
-
88
+
89
89
  const trigger = wrapper.find('[data-testid="popover-trigger"]');
90
90
  await trigger.trigger('click');
91
-
91
+
92
92
  expect(wrapper.emitted('update:modelValue')).toBeTruthy();
93
93
  expect(wrapper.emitted('update:modelValue')[0]).toEqual([true]);
94
94
  });
@@ -96,7 +96,7 @@ describe('UnnnicPopover.vue', () => {
96
96
  test('does not emit update:modelValue when modelValue is undefined', async () => {
97
97
  const trigger = wrapper.find('[data-testid="popover-trigger"]');
98
98
  await trigger.trigger('click');
99
-
99
+
100
100
  expect(wrapper.emitted('update:modelValue')).toBeFalsy();
101
101
  });
102
102
 
@@ -108,24 +108,24 @@ describe('UnnnicPopover.vue', () => {
108
108
  test('open ref can be controlled programmatically', async () => {
109
109
  wrapper.vm.open = true;
110
110
  await wrapper.vm.$nextTick();
111
-
111
+
112
112
  const balloon = wrapper.find('[data-testid="popover-balloon"]');
113
113
  expect(balloon.isVisible()).toBe(true);
114
114
  });
115
115
 
116
116
  test('persistent prop prevents closing on outside click', async () => {
117
117
  await wrapper.setProps({ persistent: true });
118
-
118
+
119
119
  const { onClickOutside } = await import('@vueuse/core');
120
120
  const mockOnClickOutside = vi.mocked(onClickOutside);
121
-
121
+
122
122
  const callback = mockOnClickOutside.mock.calls[0][1];
123
-
123
+
124
124
  wrapper.vm.open = true;
125
125
  await wrapper.vm.$nextTick();
126
-
126
+
127
127
  callback();
128
-
128
+
129
129
  const balloon = wrapper.find('[data-testid="popover-balloon"]');
130
130
  expect(balloon.isVisible()).toBe(true);
131
131
  });
@@ -136,7 +136,7 @@ describe('UnnnicPopover.vue', () => {
136
136
 
137
137
  const popover = wrapper.find('.unnnic-popover');
138
138
  const balloon = wrapper.find('.unnnic-popover__balloon');
139
-
139
+
140
140
  expect(popover.exists()).toBe(true);
141
141
  expect(balloon.exists()).toBe(true);
142
142
  });