@weni/unnnic-system 3.12.6-alpha-teleports.0 → 3.12.7

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 (77) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/CHANGELOG.md +1080 -0
  3. package/README.md +1 -9
  4. package/dist/{es-ebc7770b.mjs → es-c84c6e0c.mjs} +1 -1
  5. package/dist/{index-f117a889.mjs → index-71322a23.mjs} +51837 -54596
  6. package/dist/index.d.ts +1550 -4744
  7. package/dist/{pt-br-b1a08da0.mjs → pt-br-f53036d2.mjs} +1 -1
  8. package/dist/style.css +1 -1
  9. package/dist/unnnic.mjs +211 -237
  10. package/dist/unnnic.umd.js +44 -48
  11. package/package.json +2 -3
  12. package/src/assets/scss/tailwind.scss +0 -8
  13. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
  14. package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +1 -2
  15. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +60 -61
  16. package/src/components/Checkbox/Checkbox.vue +8 -2
  17. package/src/components/CheckboxGroup/CheckboxGroup.vue +7 -5
  18. package/src/components/Chip/Chip.vue +1 -1
  19. package/src/components/Drawer/Drawer.vue +270 -180
  20. package/src/components/Drawer/__tests__/Drawer.spec.js +43 -32
  21. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +19 -18
  22. package/src/components/FormElement/FormElement.vue +96 -87
  23. package/src/components/Input/Input.vue +2 -2
  24. package/src/components/ModalDialog/ModalDialog.vue +154 -63
  25. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +221 -11
  26. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +22 -1
  27. package/src/components/Radio/Radio.vue +12 -6
  28. package/src/components/Radio/__test__/Radio.spec.js +3 -1
  29. package/src/components/RadioGroup/RadioGroup.vue +18 -10
  30. package/src/components/Switch/Switch.vue +10 -3
  31. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -3
  32. package/src/components/TemplatePreview/TemplatePreview.vue +28 -25
  33. package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
  34. package/src/components/TemplatePreview/types.d.ts +3 -3
  35. package/src/components/Toast/Toast.vue +1 -4
  36. package/src/components/Toast/ToastManager.ts +1 -4
  37. package/src/components/Toast/__tests__/ToastManager.spec.js +6 -10
  38. package/src/components/ToolTip/ToolTip.vue +177 -25
  39. package/src/components/ToolTip/__tests__/ToolTip.spec.js +61 -339
  40. package/src/components/index.ts +4 -56
  41. package/src/components/ui/popover/PopoverContent.vue +3 -7
  42. package/src/components/ui/popover/PopoverTrigger.vue +1 -5
  43. package/src/index.ts +2 -9
  44. package/src/stories/Drawer.stories.js +1 -1
  45. package/src/stories/ModalDialog.mdx +0 -3
  46. package/src/stories/ModalDialog.stories.js +1 -1
  47. package/src/stories/TemplatePreview.stories.js +27 -27
  48. package/src/stories/TemplatePreviewModal.stories.js +31 -31
  49. package/src/components/ui/dialog/Dialog.vue +0 -19
  50. package/src/components/ui/dialog/DialogClose.vue +0 -29
  51. package/src/components/ui/dialog/DialogContent.vue +0 -140
  52. package/src/components/ui/dialog/DialogFooter.vue +0 -50
  53. package/src/components/ui/dialog/DialogHeader.vue +0 -83
  54. package/src/components/ui/dialog/DialogTitle.vue +0 -38
  55. package/src/components/ui/dialog/DialogTrigger.vue +0 -16
  56. package/src/components/ui/dialog/index.ts +0 -7
  57. package/src/components/ui/drawer/Drawer.vue +0 -27
  58. package/src/components/ui/drawer/DrawerClose.vue +0 -31
  59. package/src/components/ui/drawer/DrawerContent.vue +0 -113
  60. package/src/components/ui/drawer/DrawerDescription.vue +0 -40
  61. package/src/components/ui/drawer/DrawerFooter.vue +0 -38
  62. package/src/components/ui/drawer/DrawerHeader.vue +0 -57
  63. package/src/components/ui/drawer/DrawerOverlay.vue +0 -33
  64. package/src/components/ui/drawer/DrawerTitle.vue +0 -37
  65. package/src/components/ui/drawer/DrawerTrigger.vue +0 -31
  66. package/src/components/ui/drawer/index.ts +0 -10
  67. package/src/components/ui/tooltip/Tooltip.vue +0 -21
  68. package/src/components/ui/tooltip/TooltipContent.vue +0 -77
  69. package/src/components/ui/tooltip/TooltipTrigger.vue +0 -24
  70. package/src/components/ui/tooltip/index.ts +0 -3
  71. package/src/lib/__tests__/teleport-target.spec.ts +0 -73
  72. package/src/lib/layer-manager.ts +0 -64
  73. package/src/lib/teleport-target.ts +0 -46
  74. package/src/stories/Dialog.stories.js +0 -832
  75. package/src/stories/DrawerNext.stories.js +0 -611
  76. package/src/stories/LayerManager.docs.mdx +0 -40
  77. package/src/stories/LayerManager.stories.js +0 -407
@@ -1,28 +1,37 @@
1
1
  <template>
2
- <section class="unnnic-form-element" :class="{ 'unnnic-form-element--disabled': disabled }">
3
- <UnnnicLabel
4
- v-if="label"
5
- :label="label"
2
+ <section
3
+ class="unnnic-form-element"
4
+ :class="{ 'unnnic-form-element--disabled': disabled }"
5
+ >
6
+ <UnnnicLabel
7
+ v-if="label"
8
+ :label="label"
6
9
  :tooltip="tooltip"
7
10
  :class="[
8
11
  'unnnic-form-element__label',
9
12
  {
10
13
  'unnnic-form-element__label--fixed': fixedLabel,
11
14
  },
12
- ]"
15
+ ]"
13
16
  />
14
17
 
15
18
  <slot></slot>
16
19
 
17
- <section
20
+ <section
18
21
  class="unnnic-form-element__hints-container"
19
22
  v-if="message || error || !!$slots.rightMessage"
20
23
  >
21
24
  <section class="unnnic-form-element__message-container">
22
- <p v-if="message" class="unnnic-form-element__message">
25
+ <p
26
+ v-if="message"
27
+ class="unnnic-form-element__message"
28
+ >
23
29
  {{ fullySanitize(message) }}
24
30
  </p>
25
- <p v-if="!!error?.length" class="unnnic-form-element__message error">
31
+ <p
32
+ v-if="!!error?.length"
33
+ class="unnnic-form-element__message error"
34
+ >
26
35
  {{ Array.isArray(error) ? error.join(', ') : error }}
27
36
  </p>
28
37
  </section>
@@ -34,104 +43,104 @@
34
43
  </template>
35
44
 
36
45
  <script lang="js">
37
- import { fullySanitize } from '../../utils/sanitize';
38
- import UnnnicLabel from '../Label/Label.vue';
39
-
40
- export default {
41
- components: {
42
- UnnnicLabel,
46
+ import { fullySanitize } from '../../utils/sanitize';
47
+ import UnnnicLabel from '../Label/Label.vue';
48
+
49
+ export default {
50
+ components: {
51
+ UnnnicLabel,
52
+ },
53
+ props: {
54
+ size: {
55
+ type: String,
56
+ default: 'md',
57
+ validator: (size) => ['md', 'sm'].includes(size),
43
58
  },
44
- props: {
45
- size: {
46
- type: String,
47
- default: 'md',
48
- validator: (size) => ['md', 'sm'].includes(size),
49
- },
50
59
 
51
- label: { type: String, default: '' },
60
+ label: { type: String, default: '' },
52
61
 
53
- fixedLabel: { type: Boolean, default: false },
62
+ fixedLabel: { type: Boolean, default: false },
54
63
 
55
- error: {
56
- type: [Boolean, String],
57
- default: false,
58
- },
64
+ error: {
65
+ type: [Boolean, String],
66
+ default: false,
67
+ },
59
68
 
60
- message: { type: String, default: '' },
69
+ message: { type: String, default: '' },
61
70
 
62
- disabled: { type: Boolean, default: false },
71
+ disabled: { type: Boolean, default: false },
63
72
 
64
- tooltip: { type: String, default: '' },
65
- },
66
- methods: {
67
- fullySanitize,
68
- },
69
- };
73
+ tooltip: { type: String, default: '' },
74
+ },
75
+ methods: {
76
+ fullySanitize,
77
+ },
78
+ };
70
79
  </script>
71
80
 
72
81
  <style lang="scss" scoped>
73
- @use '@/assets/scss/unnnic' as *;
74
-
75
- * {
76
- margin: $unnnic-space-0;
77
- padding: $unnnic-space-0;
78
- box-sizing: border-box;
79
- }
82
+ @use '@/assets/scss/unnnic' as *;
83
+
84
+ * {
85
+ margin: $unnnic-space-0;
86
+ padding: $unnnic-space-0;
87
+ box-sizing: border-box;
88
+ }
89
+
90
+ .unnnic-form-element {
91
+ &__label {
92
+ font: $unnnic-font-body;
93
+ color: $unnnic-color-neutral-cloudy;
94
+ margin-bottom: $unnnic-space-1;
95
+ display: flex;
96
+ align-items: center;
97
+ gap: $unnnic-space-2;
98
+
99
+ &--fixed {
100
+ margin-top: -$unnnic-font-size-body-gt - $unnnic-space-2 + $unnnic-space-1;
101
+ }
80
102
 
81
- .unnnic-form-element {
82
- &__label {
83
- font: $unnnic-font-body;
84
- color: $unnnic-color-neutral-cloudy;
85
- margin-bottom: $unnnic-space-1;
86
- display: flex;
87
- align-items: center;
88
- gap: $unnnic-space-2;
89
-
90
- &--fixed {
91
- margin-top: -$unnnic-font-size-body-gt - $unnnic-space-2 + $unnnic-space-1;
92
- }
103
+ &--fixed {
104
+ margin-bottom: $unnnic-space-0;
105
+ position: absolute;
106
+ padding: $unnnic-space-0 $unnnic-space-1;
107
+ margin-left: $unnnic-space-2;
93
108
 
94
- &--fixed {
95
- margin-bottom: $unnnic-space-0;
109
+ &:after {
110
+ content: ' ';
96
111
  position: absolute;
97
- padding: $unnnic-space-0 $unnnic-space-1;
98
- margin-left: $unnnic-space-2;
99
-
100
- &:after {
101
- content: ' ';
102
- position: absolute;
103
- left: $unnnic-space-0;
104
- bottom: $unnnic-space-1 - $unnnic-border-width-thinner;
105
- width: 100%;
106
- height: $unnnic-border-width-thinner;
107
- background-color: $unnnic-color-white;
108
- }
112
+ left: $unnnic-space-0;
113
+ bottom: $unnnic-space-1 - $unnnic-border-width-thinner;
114
+ width: 100%;
115
+ height: $unnnic-border-width-thinner;
116
+ background-color: $unnnic-color-white;
109
117
  }
110
118
  }
119
+ }
111
120
 
112
- &__message {
113
- &.error {
114
- color: $unnnic-color-fg-critical;
115
- }
121
+ &__message {
122
+ &.error {
123
+ color: $unnnic-color-fg-critical;
116
124
  }
125
+ }
117
126
 
118
- &__hints-container {
119
- display: flex;
120
- justify-content: space-between;
121
- margin-top: $unnnic-space-1;
122
- font: $unnnic-font-caption-2;
123
- color: $unnnic-color-fg-base;
124
- }
127
+ &__hints-container {
128
+ display: flex;
129
+ justify-content: space-between;
130
+ margin-top: $unnnic-space-1;
131
+ font: $unnnic-font-caption-2;
132
+ color: $unnnic-color-fg-base;
133
+ }
125
134
 
126
- &__message-container {
127
- display: flex;
128
- flex-direction: column;
129
- gap: $unnnic-space-1;
130
- }
135
+ &__message-container {
136
+ display: flex;
137
+ flex-direction: column;
138
+ gap: $unnnic-space-1;
139
+ }
131
140
 
132
- &--disabled .unnnic-form-element__label,
133
- &--disabled .unnnic-form-element__message {
134
- user-select: none;
135
- }
141
+ &--disabled .unnnic-form-element__label,
142
+ &--disabled .unnnic-form-element__message {
143
+ user-select: none;
136
144
  }
145
+ }
137
146
  </style>
@@ -43,8 +43,8 @@ import UnnnicFormElement from '../FormElement/FormElement.vue';
43
43
 
44
44
  export default {
45
45
  name: 'UnnnicInput',
46
- components: {
47
- TextInput,
46
+ components: {
47
+ TextInput,
48
48
  UnnnicFormElement,
49
49
  },
50
50
  props: {
@@ -1,47 +1,64 @@
1
1
  <template>
2
- <UnnnicDialog
3
- :open="modelValue"
4
- @update:open="$emit('update:modelValue', $event)"
2
+ <section
3
+ v-if="modelValue"
4
+ class="unnnic-modal-dialog"
5
+ data-testid="modal-dialog"
5
6
  >
6
- <UnnnicDialogContent
7
- v-bind="$attrs"
8
- :size="size === 'sm' ? 'small' : size === 'lg' ? 'large' : 'medium'"
9
- :parentClass="['unnnic-modal-dialog', $attrs.class]"
10
- class="unnnic-modal-dialog__container"
11
- data-testid="modal-dialog"
12
- @escape-key-down="persistentHandler"
13
- @pointer-down-outside="persistentHandler"
7
+ <section
8
+ class="unnnic-modal-dialog__overlay"
9
+ data-testid="modal-overlay"
10
+ @click.stop="!persistent && close()"
11
+ />
12
+ <section
13
+ :class="[
14
+ 'unnnic-modal-dialog__container',
15
+ `unnnic-modal-dialog__container--${size}`,
16
+ ]"
17
+ data-testid="modal-container"
14
18
  >
15
19
  <section
16
- :class="[
17
- 'unnnic-modal-dialog__container__body',
18
- {
19
- 'unnnic-modal-dialog__container__body--left-sidebar':
20
- $slots.leftSidebar,
21
- },
22
- ]"
20
+ v-if="$slots.leftSidebar"
21
+ class="unnnic-modal-dialog__container__left-sidebar"
23
22
  >
24
- <section
25
- v-if="$slots.leftSidebar"
26
- class="unnnic-modal-dialog__container__left-sidebar"
27
- >
28
- <slot name="leftSidebar" />
29
- </section>
30
- <UnnnicDialogHeader
23
+ <slot name="leftSidebar" />
24
+ </section>
25
+
26
+ <section class="unnnic-modal-dialog__container__body">
27
+ <header
31
28
  v-if="title"
32
- :closeButton="showCloseIcon"
33
- :type="type"
29
+ class="unnnic-modal-dialog__container__header"
34
30
  >
35
- <UnnnicDialogTitle>
36
- {{ title }}
37
- </UnnnicDialogTitle>
38
- </UnnnicDialogHeader>
31
+ <section class="unnnic-modal-dialog__container__title-container">
32
+ <UnnnicIcon
33
+ v-if="icon || type"
34
+ data-testid="title-icon"
35
+ class="unnnic-modal-dialog__container__title-icon"
36
+ :icon="icon || iconsMapper[type]?.icon"
37
+ :scheme="iconScheme || iconsMapper[type]?.scheme"
38
+ size="md"
39
+ />
40
+ <h1
41
+ class="unnnic-modal-dialog__container__title-text"
42
+ data-testid="title-text"
43
+ >
44
+ {{ title }}
45
+ </h1>
46
+ </section>
47
+ <UnnnicIcon
48
+ v-if="showCloseIcon"
49
+ data-testid="close-icon"
50
+ icon="close"
51
+ clickable
52
+ scheme="neutral-cloudy"
53
+ @click="close()"
54
+ />
55
+ </header>
39
56
  <section class="unnnic-modal-dialog__container__content">
40
57
  <slot></slot>
41
58
  </section>
42
-
43
- <UnnnicDialogFooter
59
+ <section
44
60
  v-if="primaryButtonProps.text"
61
+ data-testid="actions-section"
45
62
  :class="[
46
63
  'unnnic-modal-dialog__container__actions',
47
64
  {
@@ -49,8 +66,6 @@
49
66
  showActionsDivider,
50
67
  },
51
68
  ]"
52
- :divider="showActionsDivider"
53
- data-testid="actions-section"
54
69
  >
55
70
  <UnnnicButton
56
71
  v-if="!hideSecondaryButton"
@@ -77,32 +92,23 @@
77
92
  class="unnnic-modal-dialog__container__actions__primary-button"
78
93
  @click.stop="$emit('primaryButtonClick')"
79
94
  />
80
- </UnnnicDialogFooter>
81
95
  </section>
82
- </UnnnicDialogContent>
83
- </UnnnicDialog>
96
+ </section>
97
+ </section>
98
+ </section>
84
99
  </template>
85
100
 
86
101
  <script>
102
+ import UnnnicIcon from '../Icon.vue';
87
103
  import UnnnicButton from '../Button/Button.vue';
88
104
  import UnnnicI18n from '../../mixins/i18n';
89
- import UnnnicDialog from '../ui/dialog/Dialog.vue';
90
- import UnnnicDialogContent from '../ui/dialog/DialogContent.vue';
91
- import UnnnicDialogHeader from '../ui/dialog/DialogHeader.vue';
92
- import UnnnicDialogTitle from '../ui/dialog/DialogTitle.vue';
93
- import UnnnicDialogFooter from '../ui/dialog/DialogFooter.vue';
94
105
 
95
106
  export default {
96
107
  name: 'UnnnicModalDialog',
97
108
  components: {
109
+ UnnnicIcon,
98
110
  UnnnicButton,
99
- UnnnicDialog,
100
- UnnnicDialogContent,
101
- UnnnicDialogHeader,
102
- UnnnicDialogTitle,
103
- UnnnicDialogFooter,
104
111
  },
105
- inheritAttrs: false,
106
112
  mixins: [UnnnicI18n],
107
113
  props: {
108
114
  modelValue: {
@@ -171,6 +177,11 @@ export default {
171
177
  es: 'Cancelar',
172
178
  },
173
179
  },
180
+ 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' },
184
+ },
174
185
  primaryButtonTypeMapper: {
175
186
  success: 'primary',
176
187
  warning: 'warning',
@@ -178,14 +189,17 @@ export default {
178
189
  },
179
190
  };
180
191
  },
192
+ watch: {
193
+ modelValue(value) {
194
+ this.updateBodyOverflow(value);
195
+ },
196
+ },
181
197
  methods: {
182
198
  close() {
183
199
  this.$emit('update:modelValue', false);
184
200
  },
185
- persistentHandler(event) {
186
- if (this.persistent) {
187
- event.preventDefault();
188
- }
201
+ updateBodyOverflow(isHidden) {
202
+ document.body.style.overflow = isHidden ? 'hidden' : '';
189
203
  },
190
204
  },
191
205
  };
@@ -193,29 +207,85 @@ export default {
193
207
 
194
208
  <style lang="scss" scoped>
195
209
  @use '@/assets/scss/unnnic' as *;
210
+ * {
211
+ margin: 0;
212
+ padding: 0;
213
+ box-sizing: border-box;
214
+ }
215
+ .unnnic-modal-dialog {
216
+ width: 100vw;
217
+ height: 100vh;
218
+ position: fixed;
219
+ left: 0;
220
+ top: 0;
221
+ display: flex;
222
+ justify-content: center;
223
+ align-items: center;
224
+ z-index: 9999;
225
+
226
+ &__overlay {
227
+ position: absolute;
228
+ width: 100%;
229
+ height: 100%;
230
+ background-color: rgba(0, 0, 0, 0.4);
231
+ }
232
+ }
196
233
 
197
234
  .unnnic-modal-dialog__container {
235
+ display: flex;
236
+ background: $unnnic-color-neutral-white;
237
+ border-radius: $unnnic-spacing-xs;
238
+ box-shadow: $unnnic-shadow-level-near;
239
+ position: fixed;
240
+ max-height: calc(100vh - $unnnic-spacing-giant);
241
+ overflow: hidden;
242
+
243
+ &--sm {
244
+ width: 400px;
245
+ }
246
+ &--md {
247
+ width: 600px;
248
+ }
249
+ &--lg {
250
+ width: 800px;
251
+ }
252
+
198
253
  &__left-sidebar {
199
254
  background-color: $unnnic-color-neutral-black;
200
255
  color: $unnnic-color-neutral-white;
201
-
202
- grid-area: left-sidebar;
203
- grid-row: span 3;
204
256
  }
205
257
 
206
258
  &__body {
207
259
  flex: 1;
208
260
  display: flex;
209
261
  flex-direction: column;
262
+ }
210
263
 
211
- overflow-y: auto;
264
+ &__header {
265
+ display: flex;
266
+ justify-content: space-between;
267
+ align-items: center;
268
+ border-bottom: 1px solid $unnnic-color-neutral-soft;
269
+ padding: $unnnic-spacing-md;
270
+ flex-shrink: 0;
271
+ }
212
272
 
213
- &--left-sidebar {
214
- border-radius: $unnnic-radius-4 0 0 $unnnic-radius-4;
215
- display: grid;
216
- grid-template-columns: auto 1fr;
217
- grid-template-areas: 'left-sidebar content';
218
- }
273
+ &__title-container {
274
+ display: flex;
275
+ align-items: center;
276
+ gap: $unnnic-spacing-ant;
277
+ }
278
+
279
+ &__title-icon {
280
+ font-size: 28px;
281
+ }
282
+
283
+ &__title-text {
284
+ font-family: $unnnic-font-family-secondary;
285
+ font-size: $unnnic-font-size-title-sm;
286
+ font-weight: $unnnic-font-weight-black;
287
+ line-height: 28px;
288
+ color: $unnnic-color-neutral-darkest;
219
289
  }
220
290
 
221
291
  &__content {
@@ -239,5 +309,26 @@ export default {
239
309
  border-radius: $unnnic-border-radius-pill;
240
310
  }
241
311
  }
312
+
313
+ &__actions {
314
+ display: grid;
315
+ grid-template-columns: 1fr 1fr;
316
+ grid-template-areas: 'secondary-button primary-button';
317
+ gap: $unnnic-spacing-sm;
318
+ padding: $unnnic-spacing-md;
319
+ flex-shrink: 0;
320
+
321
+ &--divider {
322
+ border-top: 1px solid $unnnic-color-neutral-soft;
323
+ }
324
+
325
+ &__secondary-button {
326
+ grid-area: secondary-button;
327
+ }
328
+
329
+ &__primary-button {
330
+ grid-area: primary-button;
331
+ }
332
+ }
242
333
  }
243
334
  </style>