@weni/unnnic-system 3.12.6 → 3.12.8-alpha.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 (91) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{es-e7dc92a2.mjs → es-52edeb71.mjs} +1 -1
  3. package/dist/{index-84ade580.mjs → index-756fe685.mjs} +99873 -96635
  4. package/dist/index.d.ts +5714 -1674
  5. package/dist/{pt-br-51fd679a.mjs → pt-br-24583c8c.mjs} +1 -1
  6. package/dist/style.css +1 -1
  7. package/dist/unnnic.mjs +236 -204
  8. package/dist/unnnic.umd.js +48 -44
  9. package/package.json +3 -2
  10. package/src/assets/scss/scheme-colors.scss +223 -223
  11. package/src/assets/scss/tailwind.scss +8 -0
  12. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
  13. package/src/components/Checkbox/Checkbox.vue +1 -1
  14. package/src/components/Drawer/Drawer.vue +190 -269
  15. package/src/components/Drawer/__tests__/Drawer.spec.js +37 -46
  16. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
  17. package/src/components/FormElement/FormElement.vue +1 -1
  18. package/src/components/Input/BaseInput.vue +25 -5
  19. package/src/components/Input/Input.scss +2 -3
  20. package/src/components/Input/Input.vue +24 -1
  21. package/src/components/Input/TextInput.vue +64 -25
  22. package/src/components/Input/__test__/TextInput.spec.js +1 -1
  23. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -1
  24. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -1
  25. package/src/components/ModalDialog/ModalDialog.vue +64 -148
  26. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +11 -221
  27. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
  28. package/src/components/MultiSelect/MultSelectOption.vue +49 -0
  29. package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +557 -0
  30. package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +229 -0
  31. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +87 -0
  32. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
  33. package/src/components/MultiSelect/index.vue +265 -0
  34. package/src/components/Radio/Radio.vue +1 -1
  35. package/src/components/Select/__tests__/Select.spec.js +422 -0
  36. package/src/components/Select/__tests__/SelectItem.spec.js +330 -0
  37. package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
  38. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +71 -0
  39. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
  40. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
  41. package/src/components/Select/__tests__/__snapshots__/SelectPopover.spec.js.snap +8 -0
  42. package/src/components/Select/index.vue +308 -0
  43. package/src/components/Switch/Switch.vue +1 -1
  44. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
  45. package/src/components/TemplatePreview/TemplatePreview.vue +2 -2
  46. package/src/components/TemplatePreview/TemplatePreviewModal.vue +1 -1
  47. package/src/components/Toast/Toast.vue +16 -9
  48. package/src/components/ToolTip/ToolTip.vue +25 -177
  49. package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
  50. package/src/components/index.ts +66 -6
  51. package/src/components/ui/dialog/Dialog.vue +19 -0
  52. package/src/components/ui/dialog/DialogClose.vue +29 -0
  53. package/src/components/ui/dialog/DialogContent.vue +140 -0
  54. package/src/components/ui/dialog/DialogFooter.vue +50 -0
  55. package/src/components/ui/dialog/DialogHeader.vue +83 -0
  56. package/src/components/ui/dialog/DialogTitle.vue +38 -0
  57. package/src/components/ui/dialog/DialogTrigger.vue +16 -0
  58. package/src/components/ui/dialog/index.ts +7 -0
  59. package/src/components/ui/drawer/Drawer.vue +27 -0
  60. package/src/components/ui/drawer/DrawerClose.vue +31 -0
  61. package/src/components/ui/drawer/DrawerContent.vue +111 -0
  62. package/src/components/ui/drawer/DrawerDescription.vue +40 -0
  63. package/src/components/ui/drawer/DrawerFooter.vue +38 -0
  64. package/src/components/ui/drawer/DrawerHeader.vue +57 -0
  65. package/src/components/ui/drawer/DrawerOverlay.vue +33 -0
  66. package/src/components/ui/drawer/DrawerTitle.vue +37 -0
  67. package/src/components/ui/drawer/DrawerTrigger.vue +31 -0
  68. package/src/components/ui/drawer/index.ts +10 -0
  69. package/src/components/ui/popover/PopoverContent.vue +30 -10
  70. package/src/components/ui/popover/PopoverOption.vue +5 -1
  71. package/src/components/ui/popover/PopoverTrigger.vue +5 -1
  72. package/src/components/ui/tooltip/Tooltip.vue +21 -0
  73. package/src/components/ui/tooltip/TooltipContent.vue +74 -0
  74. package/src/components/ui/tooltip/TooltipTrigger.vue +26 -0
  75. package/src/components/ui/tooltip/index.ts +3 -0
  76. package/src/lib/layer-manager.ts +92 -0
  77. package/src/locales/en.json +3 -1
  78. package/src/locales/es.json +3 -1
  79. package/src/locales/pt_br.json +3 -1
  80. package/src/stories/Dialog.stories.js +832 -0
  81. package/src/stories/Drawer.stories.js +1 -1
  82. package/src/stories/DrawerNext.stories.js +611 -0
  83. package/src/stories/Input.mdx +3 -0
  84. package/src/stories/LayerManager.docs.mdx +40 -0
  85. package/src/stories/LayerManager.stories.js +364 -0
  86. package/src/stories/ModalDialog.mdx +3 -0
  87. package/src/stories/ModalDialog.stories.js +1 -1
  88. package/src/stories/MultiSelect.stories.js +143 -45
  89. package/src/stories/Popover.stories.js +5 -0
  90. package/src/stories/Select.stories.js +161 -0
  91. package/src/components/MultiSelect/MultiSelect.vue +0 -297
@@ -1,23 +1,22 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`Drawer.vue > Component Rendering > Component Rendering > matches the snapshot 1`] = `
4
- "<aside data-v-196de012="" class="unnnic-drawer" data-testid="drawer">
5
- <section data-v-196de012="" class="unnnic-drawer__overlay" data-testid="overlay"></section>
6
- <transition-stub data-v-196de012="" name="drawer" appear="true" persisted="false" css="true">
7
- <section data-v-196de012="" data-testid="drawer-container" class="unnnic-drawer__container unnnic-drawer__container--md">
8
- <header data-v-196de012="" class="unnnic-drawer__header">
9
- <section data-v-196de012="" class="unnnic-drawer__title-container">
10
- <h1 data-v-196de012="" class="unnnic-drawer__title" data-testid="drawer-title">Test Title</h1>
11
- <p data-v-196de012="" class="unnnic-drawer__description" data-testid="drawer-description">Test Description</p>
12
- </section>
13
- <unnnic-icon-stub data-v-196de012="" filled="false" icon="arrow_back" clickable="true" size="avatar-nano" scheme="neutral-darkest" class="unnnic-drawer__close" data-testid="close-icon"></unnnic-icon-stub>
14
- </header>
15
- <section data-v-196de012="" class="unnnic-drawer__content"></section>
16
- <footer data-v-196de012="" class="unnnic-drawer__footer" data-testid="footer">
17
- <unnnic-button-stub data-v-196de012="" size="large" text="Secondary Action" type="tertiary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="secondary-button"></unnnic-button-stub>
18
- <unnnic-button-stub data-v-196de012="" size="large" text="Primary Action" type="primary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="primary-button"></unnnic-button-stub>
19
- </footer>
20
- </section>
21
- </transition-stub>
22
- </aside>"
4
+ "<div data-v-e761d31f="" data-v-196de012="" disabled="false" defer="false" forcemount="false" data-testid="drawer-container">
5
+ <div data-v-7f241b30="" data-v-e761d31f="" data-state="open" style="pointer-events: auto;" data-vaul-overlay="" data-vaul-snap-points="false" data-vaul-snap-points-overlay="true" class="unnnic-drawer__overlay"></div>
6
+ <div data-v-e761d31f="" data-dismissable-layer="" style="--snap-point-height: 0; --initial-transform: calc(100% + 8px); pointer-events: auto;" tabindex="-1" data-vaul-drawer="" data-vaul-drawer-direction="right" data-vaul-delayed-snap-points="false" data-vaul-snap-points="false" size="medium" showoverlay="true" class="unnnic-drawer__content unnnic-drawer__content--medium unnnic-drawer__container unnnic-drawer__container--md" id="" role="dialog" aria-describedby="reka-dialog-description-v-1" aria-labelledby="reka-dialog-title-v-0" data-state="open">
7
+ <header data-v-39d0dfb8="" data-v-196de012="" class="unnnic-drawer__header unnnic-drawer__header">
8
+ <section data-v-196de012="" class="unnnic-drawer__title-container">
9
+ <h2 data-v-97709962="" data-v-196de012="" id="reka-dialog-title-v-0" class="unnnic-drawer__title unnnic-drawer__title" data-testid="drawer-title">Test Title</h2>
10
+ <p data-v-750ea255="" data-v-196de012="" id="reka-dialog-description-v-1" class="unnnic-drawer__description unnnic-drawer__description" data-testid="drawer-description">Test Description</p>
11
+ </section><button data-v-4a771f40="" data-v-196de012="" type="button" class="unnnic-drawer__close">
12
+ <unnnic-button-stub data-v-196de012="" size="small" text="" type="tertiary" float="false" iconleft="" iconright="" iconcenter="arrow_forward" iconsfilled="false" disabled="false" loading="false" class="unnnic-drawer__close-icon" data-testid="close-icon"></unnnic-button-stub>
13
+ </button>
14
+ </header>
15
+ <section data-v-196de012="" class="unnnic-drawer__content"></section>
16
+ <footer data-v-02ebc5b4="" data-v-196de012="" class="unnnic-drawer__footer unnnic-drawer__footer" data-testid="footer">
17
+ <unnnic-button-stub data-v-196de012="" size="large" text="Secondary Action" type="tertiary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="secondary-button"></unnnic-button-stub>
18
+ <unnnic-button-stub data-v-196de012="" size="large" text="Primary Action" type="primary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="primary-button"></unnnic-button-stub>
19
+ </footer>
20
+ </div>
21
+ </div>"
23
22
  `;
@@ -18,8 +18,8 @@
18
18
  <slot></slot>
19
19
 
20
20
  <section
21
- class="unnnic-form-element__hints-container"
22
21
  v-if="message || error || !!$slots.rightMessage"
22
+ class="unnnic-form-element__hints-container"
23
23
  >
24
24
  <section class="unnnic-form-element__message-container">
25
25
  <p
@@ -4,16 +4,18 @@
4
4
  v-mask="mask"
5
5
  v-bind="attributes"
6
6
  :value="fullySanitize(modelValue)"
7
- :class="classes"
7
+ :class="[classes, { focus, 'use-focus-prop': useFocusProp }]"
8
8
  :type="nativeType"
9
+ :readonly="readonly"
9
10
  />
10
11
  <input
11
12
  v-else
12
13
  v-bind="attributes"
13
14
  :value="fullySanitize(modelValue)"
14
- :class="classes"
15
+ :class="[classes, { focus, 'use-focus-prop': useFocusProp }]"
15
16
  :type="nativeType"
16
17
  :maxlength="maxlength"
18
+ :readonly="readonly"
17
19
  />
18
20
  </template>
19
21
 
@@ -49,15 +51,25 @@ export default {
49
51
  },
50
52
  hasIconLeft: Boolean,
51
53
  hasIconRight: Boolean,
54
+ hasClearIcon: Boolean,
52
55
  maxlength: {
53
56
  type: Number,
54
57
  default: null,
55
58
  },
59
+ readonly: {
60
+ type: Boolean,
61
+ default: false,
62
+ },
63
+ useFocusProp: {
64
+ type: Boolean,
65
+ default: false,
66
+ },
67
+ focus: {
68
+ type: Boolean,
69
+ default: false,
70
+ },
56
71
  },
57
72
  emits: ['update:modelValue'],
58
- data() {
59
- return {};
60
- },
61
73
  computed: {
62
74
  attributes() {
63
75
  return {
@@ -77,6 +89,7 @@ export default {
77
89
  {
78
90
  'input--has-icon-left': this.hasIconLeft,
79
91
  'input--has-icon-right': this.hasIconRight,
92
+ 'input--has-clear-icon': this.hasClearIcon,
80
93
  },
81
94
  ];
82
95
  },
@@ -117,6 +130,13 @@ export default {
117
130
 
118
131
  &.input--has-icon-right {
119
132
  padding-right: $unnnic-space-10;
133
+ &.input--has-clear-icon {
134
+ padding-right: $unnnic-space-10 + $unnnic-space-6;
135
+ }
136
+ }
137
+
138
+ &.input--has-clear-icon {
139
+ padding-right: $unnnic-space-10;
120
140
  }
121
141
 
122
142
  &.error {
@@ -9,9 +9,8 @@
9
9
  caret-color: $unnnic-color-fg-muted;
10
10
  font: $unnnic-font-body;
11
11
 
12
- transition: border-color 0.1s ease-in-out;
13
-
14
- &:focus {
12
+ &:focus:not(.use-focus-prop),
13
+ &.focus {
15
14
  border-color: $unnnic-color-border-active;
16
15
  }
17
16
 
@@ -13,6 +13,8 @@
13
13
  v-bind="$attrs"
14
14
  v-model="val"
15
15
  class="unnnic-form-input"
16
+ :useFocusProp="useFocusProp"
17
+ :focus="focus"
16
18
  :placeholder="placeholder"
17
19
  :iconLeft="iconLeft"
18
20
  :iconRight="iconRight"
@@ -25,6 +27,9 @@
25
27
  :nativeType="nativeType"
26
28
  :maxlength="maxlength"
27
29
  :disabled="disabled"
30
+ :readonly="readonly"
31
+ :showClear="showClear"
32
+ @clear="$emit('clear')"
28
33
  />
29
34
 
30
35
  <template
@@ -127,8 +132,26 @@ export default {
127
132
  type: Boolean,
128
133
  default: false,
129
134
  },
135
+ readonly: {
136
+ type: Boolean,
137
+ default: false,
138
+ },
139
+ useFocusProp: {
140
+ type: Boolean,
141
+ default: false,
142
+ },
143
+ focus: {
144
+ type: Boolean,
145
+ default: false,
146
+ },
147
+ showClear: {
148
+ type: Boolean,
149
+ default: false,
150
+ },
130
151
  },
131
- emits: ['update:modelValue'],
152
+
153
+ emits: ['update:modelValue', 'clear'],
154
+
132
155
  data() {
133
156
  return {
134
157
  val: this.modelValue,
@@ -12,9 +12,11 @@
12
12
  class="input-itself"
13
13
  :hasIconLeft="!!iconLeft"
14
14
  :hasIconRight="!!iconRight || allowTogglePassword"
15
+ :hasClearIcon="showClear"
15
16
  :maxlength="maxlength"
16
- @focus="onFocus"
17
- @blur="onBlur"
17
+ :readonly="readonly"
18
+ :useFocusProp="useFocusProp"
19
+ :focus="focus"
18
20
  />
19
21
 
20
22
  <UnnnicIcon
@@ -27,18 +29,28 @@
27
29
  @click="onIconLeftClick"
28
30
  />
29
31
 
30
- <UnnnicIcon
31
- v-if="iconRightSvg"
32
- :scheme="iconScheme"
33
- :icon="iconRightSvg"
34
- size="ant"
35
- :clickable="iconRightClickable || allowTogglePassword"
36
- :class="[
37
- 'icon-right',
38
- { clickable: iconRightClickable || allowTogglePassword },
39
- ]"
40
- @click="onIconRightClick"
41
- />
32
+ <section class="icon-right-container">
33
+ <UnnnicIcon
34
+ v-if="showClear"
35
+ class="icon-clear"
36
+ :scheme="iconScheme"
37
+ icon="close"
38
+ size="ant"
39
+ clickable
40
+ @click.stop="onClearClick"
41
+ />
42
+
43
+ <UnnnicIcon
44
+ v-if="iconRightSvg"
45
+ :scheme="iconScheme"
46
+ :icon="iconRightSvg"
47
+ size="ant"
48
+ :clickable="iconRightClickable || allowTogglePassword"
49
+ class="icon-right"
50
+ :class="{ clickable: iconRightClickable || allowTogglePassword }"
51
+ @click="onIconRightClick"
52
+ />
53
+ </section>
42
54
  </div>
43
55
  </template>
44
56
 
@@ -103,8 +115,24 @@ export default {
103
115
  type: Boolean,
104
116
  default: false,
105
117
  },
118
+ readonly: {
119
+ type: Boolean,
120
+ default: false,
121
+ },
122
+ useFocusProp: {
123
+ type: Boolean,
124
+ default: false,
125
+ },
126
+ focus: {
127
+ type: Boolean,
128
+ default: false,
129
+ },
130
+ showClear: {
131
+ type: Boolean,
132
+ default: false,
133
+ },
106
134
  },
107
- emits: ['icon-left-click', 'icon-right-click'],
135
+ emits: ['icon-left-click', 'icon-right-click', 'clear'],
108
136
  data() {
109
137
  return {
110
138
  isFocused: false,
@@ -128,7 +156,6 @@ export default {
128
156
  if (this.isDisabled) {
129
157
  return 'fg-muted';
130
158
  }
131
-
132
159
  return 'fg-base';
133
160
  },
134
161
 
@@ -138,7 +165,7 @@ export default {
138
165
  },
139
166
 
140
167
  methods: {
141
- focus() {
168
+ focusInput() {
142
169
  this.$refs['base-input'].$el.focus();
143
170
  },
144
171
 
@@ -154,6 +181,10 @@ export default {
154
181
  if (this.iconLeftClickable) this.$emit('icon-left-click');
155
182
  },
156
183
 
184
+ onClearClick() {
185
+ this.$emit('clear');
186
+ },
187
+
157
188
  onIconRightClick() {
158
189
  if (this.attributes.disabled) return;
159
190
  if (this.allowTogglePassword) this.showPassword = !this.showPassword;
@@ -171,25 +202,33 @@ export default {
171
202
  }
172
203
 
173
204
  .icon {
174
- &-left,
175
- &-right {
176
- &:not(.clickable) {
177
- pointer-events: none;
178
- }
179
- }
180
-
181
205
  &-left {
182
206
  position: absolute;
183
207
  top: 50%;
184
208
  transform: translateY(-50%);
185
209
  left: $unnnic-space-4;
210
+
211
+ &:not(.clickable) {
212
+ pointer-events: none;
213
+ }
186
214
  }
187
215
 
188
- &-right {
216
+ &-right-container {
189
217
  position: absolute;
190
218
  top: 50%;
191
219
  transform: translateY(-50%);
192
220
  right: $unnnic-space-4;
221
+
222
+ display: flex;
223
+ align-items: center;
224
+ gap: $unnnic-space-2;
225
+
226
+ .icon-clear {
227
+ cursor: pointer;
228
+ }
229
+ .icon-right:not(.clickable) {
230
+ pointer-events: none;
231
+ }
193
232
  }
194
233
  }
195
234
  </style>
@@ -129,7 +129,7 @@ describe('TextInput.vue', () => {
129
129
 
130
130
  test('focus method calls focus on base input element', () => {
131
131
  const focusSpy = vi.spyOn(wrapper.vm.$refs['base-input'].$el, 'focus');
132
- wrapper.vm.focus();
132
+ wrapper.vm.focusInput();
133
133
 
134
134
  expect(focusSpy).toHaveBeenCalled();
135
135
  focusSpy.mockRestore();
@@ -6,7 +6,11 @@ exports[`Input.vue > matches the snapshot 1`] = `
6
6
  <p data-v-7f222291="" class="unnnic-label__label">Sample Label</p>
7
7
  <!--v-if-->
8
8
  </section>
9
- <div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-form-input" hascloudycolor="false" mask="####-####"><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-form-input input-itself input size-md normal input--has-icon-left input--has-icon-right unnnic-form-input input-itself" hascloudycolor="false" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" type="text" value=""><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable icon-left clickable" data-testid="material-icon" translate="no">search</span><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable icon-right clickable" data-testid="material-icon" translate="no">clear</span></div>
9
+ <div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-form-input" hascloudycolor="false" mask="####-####"><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-form-input input-itself input size-md normal input--has-icon-left input--has-icon-right unnnic-form-input input-itself" hascloudycolor="false" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" showclear="false" type="text" value=""><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable icon-left clickable" data-testid="material-icon" translate="no">search</span>
10
+ <section data-v-a0d36167="" class="icon-right-container">
11
+ <!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable icon-right clickable" data-testid="material-icon" translate="no">clear</span>
12
+ </section>
13
+ </div>
10
14
  <section data-v-9f8d6c86="" class="unnnic-form-element__hints-container">
11
15
  <section data-v-9f8d6c86="" class="unnnic-form-element__message-container">
12
16
  <p data-v-9f8d6c86="" class="unnnic-form-element__message">Error message</p>
@@ -1,3 +1,9 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`TextInput.vue > matches the snapshot 1`] = `"<div data-v-a0d36167="" class="text-input size--md"><input data-v-86533b41="" data-v-a0d36167="" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" allowtogglepassword="false" class="input-itself input size-md normal input--has-icon-left input--has-icon-right input-itself" type="text" value=""><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable icon-left clickable" data-testid="material-icon" translate="no">search</span><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable icon-right clickable" data-testid="material-icon" translate="no">clear</span></div>"`;
3
+ exports[`TextInput.vue > matches the snapshot 1`] = `
4
+ "<div data-v-a0d36167="" class="text-input size--md"><input data-v-86533b41="" data-v-a0d36167="" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" allowtogglepassword="false" showclear="false" class="input-itself input size-md normal input--has-icon-left input--has-icon-right input-itself" type="text" value=""><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable icon-left clickable" data-testid="material-icon" translate="no">search</span>
5
+ <section data-v-a0d36167="" class="icon-right-container">
6
+ <!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable icon-right clickable" data-testid="material-icon" translate="no">clear</span>
7
+ </section>
8
+ </div>"
9
+ `;
@@ -1,64 +1,47 @@
1
1
  <template>
2
- <section
3
- v-if="modelValue"
4
- class="unnnic-modal-dialog"
5
- data-testid="modal-dialog"
2
+ <UnnnicDialog
3
+ :open="modelValue"
4
+ @update:open="$emit('update:modelValue', $event)"
6
5
  >
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"
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"
18
14
  >
19
15
  <section
20
- v-if="$slots.leftSidebar"
21
- class="unnnic-modal-dialog__container__left-sidebar"
16
+ :class="[
17
+ 'unnnic-modal-dialog__container__body',
18
+ {
19
+ 'unnnic-modal-dialog__container__body--left-sidebar':
20
+ $slots.leftSidebar,
21
+ },
22
+ ]"
22
23
  >
23
- <slot name="leftSidebar" />
24
- </section>
25
-
26
- <section class="unnnic-modal-dialog__container__body">
27
- <header
24
+ <section
25
+ v-if="$slots.leftSidebar"
26
+ class="unnnic-modal-dialog__container__left-sidebar"
27
+ >
28
+ <slot name="leftSidebar" />
29
+ </section>
30
+ <UnnnicDialogHeader
28
31
  v-if="title"
29
- class="unnnic-modal-dialog__container__header"
32
+ :closeButton="showCloseIcon"
33
+ :type="type"
30
34
  >
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>
35
+ <UnnnicDialogTitle>
36
+ {{ title }}
37
+ </UnnnicDialogTitle>
38
+ </UnnnicDialogHeader>
56
39
  <section class="unnnic-modal-dialog__container__content">
57
40
  <slot></slot>
58
41
  </section>
59
- <section
42
+
43
+ <UnnnicDialogFooter
60
44
  v-if="primaryButtonProps.text"
61
- data-testid="actions-section"
62
45
  :class="[
63
46
  'unnnic-modal-dialog__container__actions',
64
47
  {
@@ -66,6 +49,8 @@
66
49
  showActionsDivider,
67
50
  },
68
51
  ]"
52
+ :divider="showActionsDivider"
53
+ data-testid="actions-section"
69
54
  >
70
55
  <UnnnicButton
71
56
  v-if="!hideSecondaryButton"
@@ -92,24 +77,33 @@
92
77
  class="unnnic-modal-dialog__container__actions__primary-button"
93
78
  @click.stop="$emit('primaryButtonClick')"
94
79
  />
95
- </section>
80
+ </UnnnicDialogFooter>
96
81
  </section>
97
- </section>
98
- </section>
82
+ </UnnnicDialogContent>
83
+ </UnnnicDialog>
99
84
  </template>
100
85
 
101
86
  <script>
102
- import UnnnicIcon from '../Icon.vue';
103
87
  import UnnnicButton from '../Button/Button.vue';
104
88
  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';
105
94
 
106
95
  export default {
107
96
  name: 'UnnnicModalDialog',
108
97
  components: {
109
- UnnnicIcon,
110
98
  UnnnicButton,
99
+ UnnnicDialog,
100
+ UnnnicDialogContent,
101
+ UnnnicDialogHeader,
102
+ UnnnicDialogTitle,
103
+ UnnnicDialogFooter,
111
104
  },
112
105
  mixins: [UnnnicI18n],
106
+ inheritAttrs: false,
113
107
  props: {
114
108
  modelValue: {
115
109
  type: Boolean,
@@ -177,11 +171,6 @@ export default {
177
171
  es: 'Cancelar',
178
172
  },
179
173
  },
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
- },
185
174
  primaryButtonTypeMapper: {
186
175
  success: 'primary',
187
176
  warning: 'warning',
@@ -201,91 +190,39 @@ export default {
201
190
  updateBodyOverflow(isHidden) {
202
191
  document.body.style.overflow = isHidden ? 'hidden' : '';
203
192
  },
193
+ persistentHandler(event) {
194
+ if (this.persistent) {
195
+ event.preventDefault();
196
+ }
197
+ },
204
198
  },
205
199
  };
206
200
  </script>
207
201
 
208
202
  <style lang="scss" scoped>
209
203
  @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
- }
233
-
234
204
  .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
-
253
205
  &__left-sidebar {
254
206
  background-color: $unnnic-color-neutral-black;
255
207
  color: $unnnic-color-neutral-white;
208
+
209
+ grid-area: left-sidebar;
210
+ grid-row: span 3;
256
211
  }
257
212
 
258
213
  &__body {
259
214
  flex: 1;
260
215
  display: flex;
261
216
  flex-direction: column;
262
- }
263
-
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
- }
272
217
 
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
- }
218
+ overflow-y: auto;
282
219
 
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;
220
+ &--left-sidebar {
221
+ border-radius: $unnnic-radius-4 0 0 $unnnic-radius-4;
222
+ display: grid;
223
+ grid-template-columns: auto 1fr;
224
+ grid-template-areas: 'left-sidebar content';
225
+ }
289
226
  }
290
227
 
291
228
  &__content {
@@ -309,26 +246,5 @@ export default {
309
246
  border-radius: $unnnic-border-radius-pill;
310
247
  }
311
248
  }
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
- }
333
249
  }
334
250
  </style>