@weni/unnnic-system 3.0.5-alpha.0 → 3.1.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 (40) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/dist/components/DataTable/index.vue.d.ts +47 -139
  3. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  4. package/dist/components/DatePicker/DatePicker.vue.d.ts +2 -2
  5. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +3 -3
  6. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +1 -1
  7. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  8. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +0 -18
  9. package/dist/components/SelectSmart/SelectSmart.vue.d.ts.map +1 -1
  10. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +0 -9
  11. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
  12. package/dist/components/index.d.ts +7 -263
  13. package/dist/components/index.d.ts.map +1 -1
  14. package/dist/{es-e4780f92.mjs → es-8ee8b336.mjs} +1 -1
  15. package/dist/{index-c20c8a10.mjs → index-a9c4dc3e.mjs} +8988 -9154
  16. package/dist/{pt-br-9e604702.mjs → pt-br-1b500883.mjs} +1 -1
  17. package/dist/style.css +1 -1
  18. package/dist/unnnic.mjs +24 -26
  19. package/dist/unnnic.umd.js +43 -44
  20. package/package.json +2 -2
  21. package/src/components/DataTable/index.vue +40 -67
  22. package/src/components/ModalDialog/ModalDialog.vue +29 -27
  23. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
  24. package/src/components/SelectSmart/SelectSmart.vue +1 -22
  25. package/src/components/SelectSmart/SelectSmartMultipleHeader.vue +1 -1
  26. package/src/components/SelectSmart/SelectSmartOption.vue +0 -5
  27. package/src/components/index.ts +2 -8
  28. package/src/stories/SelectSmart.stories.js +1 -1
  29. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
  30. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
  31. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
  32. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
  33. package/src/assets/img/previews/doc-preview.png +0 -0
  34. package/src/assets/img/previews/image-preview.png +0 -0
  35. package/src/assets/img/previews/video-preview.png +0 -0
  36. package/src/components/TemplatePreview/TemplatePreview.vue +0 -249
  37. package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
  38. package/src/components/TemplatePreview/types.d.ts +0 -16
  39. package/src/stories/TemplatePreview.stories.js +0 -94
  40. package/src/stories/TemplatePreviewModal.stories.js +0 -110
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.0.5-alpha.0",
3
+ "version": "3.1.0",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -99,4 +99,4 @@
99
99
  "vue-eslint-parser": "^9.4.2",
100
100
  "vue-tsc": "^3.0.5"
101
101
  }
102
- }
102
+ }
@@ -154,14 +154,8 @@
154
154
  </table>
155
155
  </template>
156
156
 
157
- <script lang="ts">
158
- export default {
159
- name: 'UnnnicDataTable',
160
- };
161
- </script>
162
-
163
157
  <script setup lang="ts">
164
- import { computed, ref, useSlots } from 'vue';
158
+ import { computed, ComputedRef, ref, useSlots } from 'vue';
165
159
 
166
160
  import Icon from '../Icon.vue';
167
161
  import IconArrowsDefault from '../icons/iconArrowsDefault.vue';
@@ -179,6 +173,27 @@ type DataTableItem = {
179
173
  [key: string]: any;
180
174
  };
181
175
 
176
+ interface Props {
177
+ headers: DataTableHeader[];
178
+ items: DataTableItem[];
179
+ isLoading?: boolean;
180
+ size?: 'sm' | 'md';
181
+ height?: string;
182
+ maxHeight?: string;
183
+ clickable?: boolean;
184
+ fixedHeaders?: boolean;
185
+ hideHeaders?: boolean;
186
+ hidePagination?: boolean;
187
+ page?: number;
188
+ pageTotal?: number;
189
+ pageInterval?: number;
190
+ locale?: string;
191
+ }
192
+
193
+ defineOptions({
194
+ name: 'UnnnicDataTable',
195
+ });
196
+
182
197
  const slots = useSlots();
183
198
 
184
199
  const emit = defineEmits<{
@@ -187,64 +202,22 @@ const emit = defineEmits<{
187
202
  'update:page': [page: number];
188
203
  }>();
189
204
 
190
- const props = defineProps<{
191
- headers: {
192
- type: DataTableHeader[];
193
- required: true;
194
- };
195
- items: {
196
- type: DataTableItem[];
197
- required: true;
198
- };
199
- isLoading: {
200
- type: Boolean;
201
- default: false;
202
- };
203
- size: {
204
- type: 'sm' | 'md';
205
- default: 'md';
206
- };
207
- height: {
208
- type: String;
209
- default: '';
210
- };
211
- maxHeight: {
212
- type: String;
213
- default: '';
214
- };
215
- clickable: {
216
- type: Boolean;
217
- default: false;
218
- };
219
- fixedHeaders: {
220
- type: Boolean;
221
- default: false;
222
- };
223
- hideHeaders: {
224
- type: Boolean;
225
- default: false;
226
- };
227
- hidePagination: {
228
- type: Boolean;
229
- default: false;
230
- };
231
- page: {
232
- type: Number;
233
- default: 1;
234
- };
235
- pageTotal: {
236
- type: Number;
237
- default: 0;
238
- };
239
- pageInterval: {
240
- type: Number;
241
- default: 5;
242
- };
243
- locale: {
244
- type: string;
245
- default: 'en';
246
- };
247
- }>();
205
+
206
+
207
+ const props = withDefaults(defineProps<Props>(), {
208
+ isLoading: false,
209
+ size: 'md',
210
+ height: '',
211
+ maxHeight: '',
212
+ clickable: false,
213
+ fixedHeaders: false,
214
+ hideHeaders: false,
215
+ hidePagination: false,
216
+ page: 1,
217
+ pageTotal: 0,
218
+ pageInterval: 5,
219
+ locale: 'en',
220
+ });
248
221
 
249
222
  const defaultTranslations = {
250
223
  without_results: {
@@ -266,7 +239,7 @@ const shouldHideHeaders = computed(() => {
266
239
  return props.hideHeaders || !props.headers.length;
267
240
  });
268
241
 
269
- const headersItemsKeys: string[] = computed(() => {
242
+ const headersItemsKeys: ComputedRef<string[]> = computed(() => {
270
243
  return props.headers.map((header) => header.itemKey);
271
244
  });
272
245
 
@@ -281,7 +254,7 @@ const getHeaderColumnSize = (header: DataTableHeader): string => {
281
254
  : header.size || '1fr';
282
255
  };
283
256
 
284
- const gridTemplateColumns: string = computed(() => {
257
+ const gridTemplateColumns: ComputedRef<string> = computed(() => {
285
258
  const columnSizes = props.headers.length
286
259
  ? props.headers.map(getHeaderColumnSize)
287
260
  : props.items[0].content.map(() => '1fr');
@@ -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"
@@ -46,7 +49,6 @@
46
49
  data-testid="close-icon"
47
50
  icon="close"
48
51
  clickable
49
- scheme="neutral-cloudy"
50
52
  @click="close()"
51
53
  />
52
54
  </header>
@@ -96,12 +98,12 @@
96
98
  </template>
97
99
 
98
100
  <script>
99
- import UnnnicIcon from "../Icon.vue";
100
- import UnnnicButton from "../Button/Button.vue";
101
- import UnnnicI18n from "../../mixins/i18n";
101
+ import UnnnicIcon from '../Icon.vue';
102
+ import UnnnicButton from '../Button/Button.vue';
103
+ import UnnnicI18n from '../../mixins/i18n';
102
104
 
103
105
  export default {
104
- name: "UnnnicModalDialog",
106
+ name: 'UnnnicModalDialog',
105
107
  components: {
106
108
  UnnnicIcon,
107
109
  UnnnicButton,
@@ -118,29 +120,29 @@ export default {
118
120
  },
119
121
  type: {
120
122
  type: String,
121
- default: "",
123
+ default: '',
122
124
  validate(type) {
123
- return ["success", "warning", "attention"].includes(type);
125
+ return ['success', 'warning', 'attention'].includes(type);
124
126
  },
125
127
  },
126
128
  size: {
127
129
  type: String,
128
- default: "md",
130
+ default: 'md',
129
131
  validate(size) {
130
- return ["sm", "md", "lg"].includes(size);
132
+ return ['sm', 'md', 'lg'].includes(size);
131
133
  },
132
134
  },
133
135
  title: {
134
136
  type: String,
135
- default: "",
137
+ default: '',
136
138
  },
137
139
  icon: {
138
140
  type: String,
139
- default: "",
141
+ default: '',
140
142
  },
141
143
  iconScheme: {
142
144
  type: String,
143
- default: "",
145
+ default: '',
144
146
  },
145
147
  showCloseIcon: {
146
148
  type: Boolean,
@@ -163,26 +165,26 @@ export default {
163
165
  default: () => ({}),
164
166
  },
165
167
  },
166
- emits: ["primaryButtonClick", "secondaryButtonClick", "update:modelValue"],
168
+ emits: ['primaryButtonClick', 'secondaryButtonClick', 'update:modelValue'],
167
169
 
168
170
  data() {
169
171
  return {
170
172
  defaultTranslations: {
171
173
  cancel: {
172
- "pt-br": "Cancelar",
173
- en: "Cancel",
174
- es: "Cancelar",
174
+ 'pt-br': 'Cancelar',
175
+ en: 'Cancel',
176
+ es: 'Cancelar',
175
177
  },
176
178
  },
177
179
  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" },
180
+ success: { icon: 'check_circle', scheme: 'aux-green-500' },
181
+ warning: { icon: 'warning', scheme: 'aux-red-500' },
182
+ attention: { icon: 'error', scheme: 'aux-yellow-500' },
181
183
  },
182
184
  primaryButtonTypeMapper: {
183
- success: "primary",
184
- warning: "warning",
185
- attention: "attention",
185
+ success: 'primary',
186
+ warning: 'warning',
187
+ attention: 'attention',
186
188
  },
187
189
  };
188
190
  },
@@ -193,17 +195,17 @@ export default {
193
195
  },
194
196
  methods: {
195
197
  close() {
196
- this.$emit("update:modelValue", false);
198
+ this.$emit('update:modelValue', false);
197
199
  },
198
200
  updateBodyOverflow(isHidden) {
199
- document.body.style.overflow = isHidden ? "hidden" : "";
201
+ document.body.style.overflow = isHidden ? 'hidden' : '';
200
202
  },
201
203
  },
202
204
  };
203
205
  </script>
204
206
 
205
207
  <style lang="scss" scoped>
206
- @use "@/assets/scss/unnnic" as *;
208
+ @use '@/assets/scss/unnnic' as *;
207
209
  * {
208
210
  margin: 0;
209
211
  padding: 0;
@@ -310,7 +312,7 @@ export default {
310
312
  &__actions {
311
313
  display: grid;
312
314
  grid-template-columns: 1fr 1fr;
313
- grid-template-areas: "secondary-button primary-button";
315
+ grid-template-areas: 'secondary-button primary-button';
314
316
  gap: $unnnic-spacing-sm;
315
317
  padding: $unnnic-spacing-md;
316
318
  flex-shrink: 0;
@@ -11,7 +11,7 @@ exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
11
11
  <unnnic-icon-stub data-v-68ebadeb="" filled="false" next="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
12
  <h1 data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-text" data-testid="title-text">Test Title</h1>
13
13
  </section>
14
- <unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="close" clickable="true" size="md" scheme="neutral-cloudy" data-testid="close-icon"></unnnic-icon-stub>
14
+ <unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="close" clickable="true" size="md" scheme="neutral-darkest" data-testid="close-icon"></unnnic-icon-stub>
15
15
  </header>
16
16
  <section data-v-68ebadeb="" class="unnnic-modal-dialog__container__content"></section>
17
17
  <section data-v-68ebadeb="" data-testid="actions-section" class="unnnic-modal-dialog__container__actions">
@@ -86,7 +86,6 @@
86
86
  :active="
87
87
  option.value === modelValue || optionIsSelected(option)
88
88
  "
89
- :disabled="optionIsSelected(option) && option.disableRemove"
90
89
  :focused="focusedOption && focusedOption.value === option.value"
91
90
  :allowCheckbox="!!multiple"
92
91
  :activeColor="type === 'secondary' ? 'secondary' : 'primary'"
@@ -143,10 +142,6 @@ export default {
143
142
  value: 'option1',
144
143
  label: 'Option1',
145
144
  },
146
- {
147
- value: 'option2',
148
- label: 'Option2',
149
- },
150
145
  ],
151
146
  },
152
147
  modelValue: {
@@ -208,10 +203,6 @@ export default {
208
203
  type: Boolean,
209
204
  default: false,
210
205
  },
211
- multipleLimit: {
212
- type: [Number, null],
213
- default: null,
214
- },
215
206
  },
216
207
 
217
208
  emits: ['update:searchValue', 'onChange', 'update:modelValue'],
@@ -372,23 +363,11 @@ export default {
372
363
 
373
364
  handleSelect(option) {
374
365
  if (option) {
375
- if (
376
- this.multiple &&
377
- this.optionIsSelected(option) &&
378
- !option.disableRemove
379
- ) {
366
+ if (this.multiple && this.optionIsSelected(option)) {
380
367
  this.unselectOption(option);
381
368
  return;
382
369
  }
383
370
 
384
- if(this.multiple && option.disableRemove && this.optionIsSelected(option)) {
385
- return;
386
- }
387
-
388
- if (this.multipleLimit && this.modelValue.length >= this.multipleLimit) {
389
- return;
390
- }
391
-
392
371
  this.selectOption(option);
393
372
  }
394
373
  },
@@ -10,7 +10,7 @@
10
10
  :key="option.value"
11
11
  class="unnnic-select-smart__options__multiple__selecteds__option"
12
12
  :text="option.label"
13
- :hasCloseIcon="!option.disableRemove"
13
+ hasCloseIcon
14
14
  @close="unselectOption(option)"
15
15
  />
16
16
  <p
@@ -19,7 +19,6 @@
19
19
  data-testid="checkbox"
20
20
  :modelValue="active"
21
21
  :size="size"
22
- :disabled="disabled"
23
22
  />
24
23
  <div>
25
24
  <span
@@ -78,10 +77,6 @@ export default {
78
77
  type: Boolean,
79
78
  default: null,
80
79
  },
81
- disabled: {
82
- type: Boolean,
83
- default: false,
84
- },
85
80
  allowCheckbox: {
86
81
  type: Boolean,
87
82
  default: false,
@@ -88,9 +88,7 @@ import ModalDialog from "./ModalDialog/ModalDialog.vue";
88
88
  import Tour from "./Tour/Tour.vue";
89
89
  import Navigator from "./Navigator/index.vue";
90
90
  import SelectTime from "./SelectTime/index.vue";
91
- import TemplatePreview from "./TemplatePreview/TemplatePreview.vue";
92
- import TemplatePreviewModal from "./TemplatePreview/TemplatePreviewModal.vue";
93
- import DataTable from './DataTable/index.vue';
91
+ import DataTable from "./DataTable/index.vue";
94
92
 
95
93
  type VueComponent = Component;
96
94
 
@@ -189,8 +187,6 @@ export const components: ComponentsMap = {
189
187
  unnnicTour: Tour,
190
188
  unnnicNavigator: Navigator,
191
189
  unnnicSelectTime: SelectTime,
192
- unnnicTemplatePreview: TemplatePreview,
193
- unnnicTemplatePreviewModal: TemplatePreviewModal,
194
190
  unnnicDataTable: DataTable,
195
191
  };
196
192
 
@@ -284,7 +280,5 @@ export const unnnicDrawer = Drawer;
284
280
  export const unnnicTableNext = TableNext;
285
281
  export const unnnicTour = Tour;
286
282
  export const unnnicNavigator = Navigator;
283
+ export const unnnicDataTable = DataTable as VueComponent;
287
284
  export const unnnicSelectTime = SelectTime as VueComponent;
288
- export const unnnicTemplatePreview = TemplatePreview as VueComponent;
289
- export const unnnicTemplatePreviewModal = TemplatePreviewModal as VueComponent;
290
- export const unnnicDataTable = DataTable;
@@ -284,7 +284,7 @@ export const Multiple = {
284
284
  { value: 'spain', label: 'Espanha' },
285
285
  { value: 'saudi_arabia', label: 'Arábia Saudita' },
286
286
  ],
287
- multiple:true,
287
+ multiple: true,
288
288
  multipleWithoutSelectsMessage: 'No country selected yet :(',
289
289
  },
290
290
  };
@@ -1,9 +0,0 @@
1
- import { Template } from './types';
2
- interface Props {
3
- template?: Template | null;
4
- }
5
- declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
6
- template: Template | null;
7
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
8
- export default _default;
9
- //# sourceMappingURL=TemplatePreview.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TemplatePreview.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TemplatePreview/TemplatePreview.vue"],"names":[],"mappings":"AAgGA;AA6PA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQxC,UAAU,KAAK;IACb,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC5B;;cADY,QAAQ,GAAG,IAAI;;AAkN5B,wBAQG"}
@@ -1,15 +0,0 @@
1
- import { Template } from './types';
2
- interface Props {
3
- locale?: string;
4
- template: Template;
5
- modelValue: boolean;
6
- }
7
- declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
- close: () => any;
9
- }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
10
- onClose?: (() => any) | undefined;
11
- }>, {
12
- locale: string;
13
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
- export default _default;
15
- //# sourceMappingURL=TemplatePreviewModal.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TemplatePreviewModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TemplatePreview/TemplatePreviewModal.vue"],"names":[],"mappings":"AAWA;AAwDA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAUxC,UAAU,KAAK;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;;;;;;YAHU,MAAM;;AAgGjB,wBASG"}