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

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-66126ef1.mjs → es-5aa232c1.mjs} +1 -1
  9. package/dist/{index-f6e9b879.mjs → index-69d07468.mjs} +353 -352
  10. package/dist/{pt-br-3b5a8852.mjs → pt-br-5f8a4e67.mjs} +1 -1
  11. package/dist/style.css +1 -1
  12. package/dist/unnnic.mjs +1 -1
  13. package/dist/unnnic.umd.js +7 -7
  14. package/package.json +2 -2
  15. package/src/components/Button/Button.vue +7 -4
  16. package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +1 -2
  17. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +60 -61
  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 +2 -3
  22. package/src/components/ModalDialog/ModalDialog.vue +29 -26
  23. package/src/components/Popover/__tests__/Popover.spec.js +18 -18
  24. package/src/components/Popover/index.vue +93 -78
  25. package/src/components/Select/SelectOption.vue +43 -37
  26. package/src/components/Select/__tests__/Select.spec.js +41 -36
  27. package/src/components/Select/__tests__/SelectItem.spec.js +35 -15
  28. package/src/components/Select/__tests__/SelectOption.spec.js +6 -3
  29. package/src/components/Select/index.vue +192 -142
  30. package/src/components/TemplatePreview/TemplatePreview.vue +30 -27
  31. package/src/components/TemplatePreview/TemplatePreviewModal.vue +11 -11
  32. package/src/components/TemplatePreview/types.d.ts +3 -3
  33. package/src/stories/Button.stories.js +1 -7
  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,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.2.9-alpha.12",
3
+ "version": "3.2.9-alpha.13",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -84,7 +84,7 @@
84
84
  "@vue/eslint-config-typescript": "^14.6.0",
85
85
  "@vue/test-utils": "^2.4.6",
86
86
  "@weni/eslint-config": "^2.0.0",
87
- "eslint": "^9.33.0",
87
+ "eslint": "^9.37.0",
88
88
  "eslint-plugin-storybook": "^0.8.0",
89
89
  "eslint-plugin-vue": "10.4.0",
90
90
  "jsdom": "^24.1.1",
@@ -133,9 +133,11 @@ const isSizePropValid = computed(() => {
133
133
  });
134
134
 
135
135
  const buttonType = computed(() => {
136
- return {
137
- 'alternative': 'tertiary',
138
- }[props.type] || props.type;
136
+ return (
137
+ {
138
+ alternative: 'tertiary',
139
+ }[props.type] || props.type
140
+ );
139
141
  });
140
142
 
141
143
  const isTypePropValid = computed(() => {
@@ -160,7 +162,8 @@ const validateProps = () => {
160
162
 
161
163
  if (!isTypePropValid.value) {
162
164
  errorMessage += ' Invalid type prop.';
163
- errorMessage += ' Please provide one of the following types: primary, secondary, tertiary, warning, attention. Alternative is discontinued and it was forced renamed to tertiary.';
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.';
164
167
  }
165
168
 
166
169
  throw new Error(errorMessage);
@@ -59,9 +59,8 @@ 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
-
65
64
  </script>
66
65
 
67
66
  <style lang="scss" scoped>
@@ -1,65 +1,64 @@
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,
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,
16
22
  },
17
-
18
- props: {
19
- data: {
20
- type: Array,
21
- required: true,
22
- },
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
+ ];
23
49
  },
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
- }
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;
63
62
  }
64
- </style>
65
-
63
+ }
64
+ </style>
@@ -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,7 +52,6 @@
52
52
  @click="onIconRightClick"
53
53
  />
54
54
  </section>
55
-
56
55
  </div>
57
56
  </template>
58
57
 
@@ -132,7 +131,7 @@ export default {
132
131
  showClear: {
133
132
  type: Boolean,
134
133
  default: false,
135
- }
134
+ },
136
135
  },
137
136
  emits: ['icon-left-click', 'icon-right-click', 'clear'],
138
137
  data() {
@@ -233,7 +232,7 @@ export default {
233
232
  top: 50%;
234
233
  transform: translateY(-50%);
235
234
  right: $unnnic-space-4;
236
-
235
+
237
236
  display: flex;
238
237
  align-items: center;
239
238
  gap: $unnnic-space-2;
@@ -24,7 +24,10 @@
24
24
  </section>
25
25
 
26
26
  <section class="unnnic-modal-dialog__container__body">
27
- <header v-if="title" class="unnnic-modal-dialog__container__header">
27
+ <header
28
+ v-if="title"
29
+ class="unnnic-modal-dialog__container__header"
30
+ >
28
31
  <section class="unnnic-modal-dialog__container__title-container">
29
32
  <UnnnicIcon
30
33
  v-if="icon || type"
@@ -96,12 +99,12 @@
96
99
  </template>
97
100
 
98
101
  <script>
99
- import UnnnicIcon from "../Icon.vue";
100
- import UnnnicButton from "../Button/Button.vue";
101
- import UnnnicI18n from "../../mixins/i18n";
102
+ import UnnnicIcon from '../Icon.vue';
103
+ import UnnnicButton from '../Button/Button.vue';
104
+ import UnnnicI18n from '../../mixins/i18n';
102
105
 
103
106
  export default {
104
- name: "UnnnicModalDialog",
107
+ name: 'UnnnicModalDialog',
105
108
  components: {
106
109
  UnnnicIcon,
107
110
  UnnnicButton,
@@ -118,29 +121,29 @@ export default {
118
121
  },
119
122
  type: {
120
123
  type: String,
121
- default: "",
124
+ default: '',
122
125
  validate(type) {
123
- return ["success", "warning", "attention"].includes(type);
126
+ return ['success', 'warning', 'attention'].includes(type);
124
127
  },
125
128
  },
126
129
  size: {
127
130
  type: String,
128
- default: "md",
131
+ default: 'md',
129
132
  validate(size) {
130
- return ["sm", "md", "lg"].includes(size);
133
+ return ['sm', 'md', 'lg'].includes(size);
131
134
  },
132
135
  },
133
136
  title: {
134
137
  type: String,
135
- default: "",
138
+ default: '',
136
139
  },
137
140
  icon: {
138
141
  type: String,
139
- default: "",
142
+ default: '',
140
143
  },
141
144
  iconScheme: {
142
145
  type: String,
143
- default: "",
146
+ default: '',
144
147
  },
145
148
  showCloseIcon: {
146
149
  type: Boolean,
@@ -163,26 +166,26 @@ export default {
163
166
  default: () => ({}),
164
167
  },
165
168
  },
166
- emits: ["primaryButtonClick", "secondaryButtonClick", "update:modelValue"],
169
+ emits: ['primaryButtonClick', 'secondaryButtonClick', 'update:modelValue'],
167
170
 
168
171
  data() {
169
172
  return {
170
173
  defaultTranslations: {
171
174
  cancel: {
172
- "pt-br": "Cancelar",
173
- en: "Cancel",
174
- es: "Cancelar",
175
+ 'pt-br': 'Cancelar',
176
+ en: 'Cancel',
177
+ es: 'Cancelar',
175
178
  },
176
179
  },
177
180
  iconsMapper: {
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" },
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' },
181
184
  },
182
185
  primaryButtonTypeMapper: {
183
- success: "primary",
184
- warning: "warning",
185
- attention: "attention",
186
+ success: 'primary',
187
+ warning: 'warning',
188
+ attention: 'attention',
186
189
  },
187
190
  };
188
191
  },
@@ -193,17 +196,17 @@ export default {
193
196
  },
194
197
  methods: {
195
198
  close() {
196
- this.$emit("update:modelValue", false);
199
+ this.$emit('update:modelValue', false);
197
200
  },
198
201
  updateBodyOverflow(isHidden) {
199
- document.body.style.overflow = isHidden ? "hidden" : "";
202
+ document.body.style.overflow = isHidden ? 'hidden' : '';
200
203
  },
201
204
  },
202
205
  };
203
206
  </script>
204
207
 
205
208
  <style lang="scss" scoped>
206
- @use "@/assets/scss/unnnic" as *;
209
+ @use '@/assets/scss/unnnic' as *;
207
210
  * {
208
211
  margin: 0;
209
212
  padding: 0;
@@ -310,7 +313,7 @@ export default {
310
313
  &__actions {
311
314
  display: grid;
312
315
  grid-template-columns: 1fr 1fr;
313
- grid-template-areas: "secondary-button primary-button";
316
+ grid-template-areas: 'secondary-button primary-button';
314
317
  gap: $unnnic-spacing-sm;
315
318
  padding: $unnnic-spacing-md;
316
319
  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
  });