@weni/unnnic-system 3.12.8 → 3.14.0-alpha-teleports.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 (107) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +9 -1
  3. package/dist/{es-62c1e8d3.mjs → es-0d53b5b2.mjs} +1 -1
  4. package/dist/{index-ef197fd5.mjs → index-d7070de8.mjs} +99880 -96723
  5. package/dist/index.d.ts +5588 -1607
  6. package/dist/{pt-br-198b147b.mjs → pt-br-bf4e1f97.mjs} +1 -1
  7. package/dist/style.css +1 -1
  8. package/dist/unnnic.mjs +233 -203
  9. package/dist/unnnic.umd.js +48 -44
  10. package/package.json +3 -2
  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/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +2 -1
  14. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +61 -60
  15. package/src/components/Checkbox/Checkbox.vue +1 -1
  16. package/src/components/CheckboxGroup/CheckboxGroup.vue +5 -7
  17. package/src/components/Chip/Chip.vue +1 -1
  18. package/src/components/DatePicker/DatePicker.vue +10 -1
  19. package/src/components/Drawer/Drawer.vue +180 -270
  20. package/src/components/Drawer/__tests__/Drawer.spec.js +32 -43
  21. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
  22. package/src/components/FormElement/FormElement.vue +87 -96
  23. package/src/components/Input/BaseInput.vue +25 -5
  24. package/src/components/Input/Input.scss +2 -1
  25. package/src/components/Input/Input.vue +24 -1
  26. package/src/components/Input/TextInput.vue +64 -25
  27. package/src/components/Input/__test__/TextInput.spec.js +1 -1
  28. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -1
  29. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -1
  30. package/src/components/InputDatePicker/InputDatePicker.vue +68 -73
  31. package/src/components/InputDatePicker/__test__/InputDatePicker.spec.js +31 -24
  32. package/src/components/ModalDialog/ModalDialog.vue +63 -154
  33. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +30 -210
  34. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
  35. package/src/components/MultiSelect/MultSelectOption.vue +49 -0
  36. package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +557 -0
  37. package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +229 -0
  38. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +87 -0
  39. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
  40. package/src/components/MultiSelect/index.vue +265 -0
  41. package/src/components/Radio/Radio.vue +6 -12
  42. package/src/components/Radio/__test__/Radio.spec.js +1 -3
  43. package/src/components/RadioGroup/RadioGroup.vue +10 -18
  44. package/src/components/Select/__tests__/Select.spec.js +422 -0
  45. package/src/components/Select/__tests__/SelectItem.spec.js +310 -0
  46. package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
  47. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +71 -0
  48. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
  49. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
  50. package/src/components/Select/__tests__/__snapshots__/SelectPopover.spec.js.snap +8 -0
  51. package/src/components/Select/index.vue +308 -0
  52. package/src/components/Switch/Switch.vue +3 -10
  53. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
  54. package/src/components/TemplatePreview/TemplatePreview.vue +25 -28
  55. package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
  56. package/src/components/TemplatePreview/types.d.ts +3 -3
  57. package/src/components/Toast/Toast.vue +4 -1
  58. package/src/components/Toast/ToastManager.ts +4 -1
  59. package/src/components/Toast/__tests__/ToastManager.spec.js +10 -6
  60. package/src/components/ToolTip/ToolTip.vue +25 -177
  61. package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
  62. package/src/components/index.ts +62 -6
  63. package/src/components/ui/dialog/Dialog.vue +19 -0
  64. package/src/components/ui/dialog/DialogClose.vue +29 -0
  65. package/src/components/ui/dialog/DialogContent.vue +140 -0
  66. package/src/components/ui/dialog/DialogFooter.vue +50 -0
  67. package/src/components/ui/dialog/DialogHeader.vue +83 -0
  68. package/src/components/ui/dialog/DialogTitle.vue +38 -0
  69. package/src/components/ui/dialog/DialogTrigger.vue +16 -0
  70. package/src/components/ui/dialog/index.ts +7 -0
  71. package/src/components/ui/drawer/Drawer.vue +27 -0
  72. package/src/components/ui/drawer/DrawerClose.vue +31 -0
  73. package/src/components/ui/drawer/DrawerContent.vue +113 -0
  74. package/src/components/ui/drawer/DrawerDescription.vue +40 -0
  75. package/src/components/ui/drawer/DrawerFooter.vue +38 -0
  76. package/src/components/ui/drawer/DrawerHeader.vue +57 -0
  77. package/src/components/ui/drawer/DrawerOverlay.vue +33 -0
  78. package/src/components/ui/drawer/DrawerTitle.vue +37 -0
  79. package/src/components/ui/drawer/DrawerTrigger.vue +31 -0
  80. package/src/components/ui/drawer/index.ts +10 -0
  81. package/src/components/ui/popover/PopoverContent.vue +7 -4
  82. package/src/components/ui/popover/PopoverOption.vue +4 -0
  83. package/src/components/ui/popover/PopoverTrigger.vue +5 -1
  84. package/src/components/ui/tooltip/Tooltip.vue +21 -0
  85. package/src/components/ui/tooltip/TooltipContent.vue +77 -0
  86. package/src/components/ui/tooltip/TooltipTrigger.vue +24 -0
  87. package/src/components/ui/tooltip/index.ts +3 -0
  88. package/src/index.ts +9 -2
  89. package/src/lib/__tests__/teleport-target.spec.ts +73 -0
  90. package/src/lib/layer-manager.ts +64 -0
  91. package/src/lib/teleport-target.ts +46 -0
  92. package/src/locales/en.json +3 -1
  93. package/src/locales/es.json +3 -1
  94. package/src/locales/pt_br.json +3 -1
  95. package/src/stories/Dialog.stories.js +832 -0
  96. package/src/stories/Drawer.stories.js +1 -1
  97. package/src/stories/DrawerNext.stories.js +611 -0
  98. package/src/stories/Input.mdx +3 -0
  99. package/src/stories/LayerManager.docs.mdx +40 -0
  100. package/src/stories/LayerManager.stories.js +407 -0
  101. package/src/stories/ModalDialog.mdx +3 -0
  102. package/src/stories/ModalDialog.stories.js +96 -1
  103. package/src/stories/MultiSelect.stories.js +143 -45
  104. package/src/stories/Select.stories.js +161 -0
  105. package/src/stories/TemplatePreview.stories.js +27 -27
  106. package/src/stories/TemplatePreviewModal.stories.js +31 -31
  107. package/src/components/MultiSelect/MultiSelect.vue +0 -297
@@ -1,51 +1,61 @@
1
1
  <template>
2
- <div
3
- ref="dropdown"
4
- :class="['dropdown', { active: showCalendarFilter, 'fill-w': fillW }]"
5
- >
6
- <UnnnicInput
7
- :class="['input', { 'date-picker-input-next': next }]"
8
- :size="size"
9
- :iconLeft="iconPosition === 'left' ? 'calendar_month' : undefined"
10
- :iconRight="iconPosition === 'right' ? 'calendar_month' : undefined"
11
- hasCloudyColor
12
- readonly
13
- :modelValue="overwrittenValue || filterText || ''"
14
- @focus="showCalendarFilter = true"
15
- />
16
-
17
- <div
18
- class="dropdown-data"
19
- :style="{ [position]: '0' }"
20
- >
21
- <UnnnicDatePicker
22
- v-if="showCalendarFilter"
23
- v-model:equivalentOption="overwrittenValue"
24
- :type="type"
25
- :clearLabel="clearText"
26
- :actionLabel="actionText"
27
- :months="months"
28
- :days="days"
29
- :options="options"
30
- :periodBaseDate="periodBaseDate"
31
- :initialStartDate="initialStartDate"
32
- :initialEndDate="initialEndDate"
33
- :minDate="minDate"
34
- :maxDate="maxDate"
35
- :disableClear="disableClear"
36
- @change="emitSelectDate"
37
- @submit="changeDate"
38
- />
39
- </div>
2
+ <div :class="['dropdown', { 'fill-w': fillW }]">
3
+ <UnnnicPopover v-model:open="isPopoverOpen">
4
+ <UnnnicPopoverTrigger :asChild="true">
5
+ <UnnnicInput
6
+ data-testid="input"
7
+ :class="['input', { 'date-picker-input-next': next }]"
8
+ :size="size"
9
+ :iconLeft="iconPosition === 'left' ? 'calendar_month' : undefined"
10
+ :iconRight="iconPosition === 'right' ? 'calendar_month' : undefined"
11
+ readonly
12
+ :modelValue="overwrittenValue || filterText || ''"
13
+ @click="openPopover"
14
+ @focus="openPopover"
15
+ />
16
+ </UnnnicPopoverTrigger>
17
+
18
+ <UnnnicPopoverContent
19
+ width="auto"
20
+ side="bottom"
21
+ :align="popoverAlign"
22
+ class="date-picker-popover-content"
23
+ >
24
+ <UnnnicDatePicker
25
+ v-model:equivalentOption="overwrittenValue"
26
+ data-testid="date-picker"
27
+ variant="popover"
28
+ :type="type"
29
+ :clearLabel="clearText"
30
+ :actionLabel="actionText"
31
+ :months="months"
32
+ :days="days"
33
+ :options="options"
34
+ :periodBaseDate="periodBaseDate"
35
+ :initialStartDate="initialStartDate"
36
+ :initialEndDate="initialEndDate"
37
+ :minDate="minDate"
38
+ :maxDate="maxDate"
39
+ :disableClear="disableClear"
40
+ @change="emitSelectDate"
41
+ @submit="changeDate"
42
+ />
43
+ </UnnnicPopoverContent>
44
+ </UnnnicPopover>
40
45
  </div>
41
46
  </template>
42
47
 
43
48
  <script setup lang="ts">
44
- import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
49
+ import { computed, ref } from 'vue';
45
50
  import moment from 'moment';
46
51
 
47
52
  import UnnnicInput from '../Input/Input.vue';
48
53
  import UnnnicDatePicker from '../DatePicker/DatePicker.vue';
54
+ import {
55
+ Popover as UnnnicPopover,
56
+ PopoverContent as UnnnicPopoverContent,
57
+ PopoverTrigger as UnnnicPopoverTrigger,
58
+ } from '../ui/popover';
49
59
 
50
60
  defineOptions({
51
61
  name: 'UnnnicInputDatePicker',
@@ -112,9 +122,11 @@ const emit = defineEmits<{
112
122
  (e: 'selectDate', value: DateRangeValue): void;
113
123
  }>();
114
124
 
115
- const dropdown = ref<HTMLElement | null>(null);
116
- const showCalendarFilter = ref(false);
125
+ const isPopoverOpen = ref(false);
117
126
  const overwrittenValue = ref('');
127
+ const popoverAlign = computed<'start' | 'end'>(() =>
128
+ props.position === 'right' ? 'end' : 'start',
129
+ );
118
130
 
119
131
  const filterText = computed(() => {
120
132
  const dates: string[] = [];
@@ -160,20 +172,12 @@ function emitSelectDate(date: { startDate: string; endDate: string }) {
160
172
  emit('selectDate', formattedDates);
161
173
  }
162
174
 
163
- function mouseout(event: MouseEvent | { target: EventTarget | null }) {
164
- if (dropdown.value?.contains(event.target as Node)) {
165
- return;
166
- }
167
-
168
- showCalendarFilter.value = false;
169
- }
170
-
171
175
  function changeDate(value: { startDate: string; endDate: string }) {
172
176
  const startDate = value.startDate.replace(/(\d+)-(\d+)-(\d+)/, '$3-$1-$2');
173
177
 
174
178
  const endDate = value.endDate.replace(/(\d+)-(\d+)-(\d+)/, '$3-$1-$2');
175
179
 
176
- showCalendarFilter.value = false;
180
+ isPopoverOpen.value = false;
177
181
 
178
182
  emit('update:model-value', {
179
183
  start: startDate
@@ -183,39 +187,30 @@ function changeDate(value: { startDate: string; endDate: string }) {
183
187
  });
184
188
  }
185
189
 
186
- onMounted(() => {
187
- window.document.body.addEventListener('click', mouseout as any);
188
- });
189
-
190
- onBeforeUnmount(() => {
191
- window.document.body.removeEventListener('click', mouseout as any);
192
- });
190
+ function openPopover() {
191
+ isPopoverOpen.value = true;
192
+ }
193
193
  </script>
194
194
 
195
+ <style lang="scss">
196
+ @use '@/assets/scss/unnnic' as *;
197
+
198
+ .date-picker-popover-content {
199
+ overflow: hidden;
200
+ border-radius: $unnnic-radius-2;
201
+ padding: 0;
202
+ }
203
+ </style>
204
+
195
205
  <style lang="scss" scoped>
196
206
  @use '@/assets/scss/unnnic' as *;
197
207
  .fill-w {
198
208
  width: 100%;
199
209
  }
210
+
200
211
  .dropdown {
201
- position: relative;
202
212
  display: inline-block;
203
213
 
204
- .dropdown-data {
205
- position: absolute;
206
- pointer-events: none;
207
- display: none;
208
- top: 100%;
209
- z-index: 2;
210
- margin-top: $unnnic-spacing-stack-nano;
211
- width: max-content;
212
- }
213
-
214
- &.active .dropdown-data {
215
- pointer-events: auto;
216
- display: block;
217
- }
218
-
219
214
  .input {
220
215
  display: inline-block;
221
216
  }
@@ -1,5 +1,6 @@
1
1
  import { mount } from '@vue/test-utils';
2
- import { beforeEach, describe, expect, it } from 'vitest';
2
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3
+
3
4
  import InputDatePicker from '../InputDatePicker.vue';
4
5
 
5
6
  const factory = (props = {}) =>
@@ -11,20 +12,7 @@ const factory = (props = {}) =>
11
12
  },
12
13
  ...props,
13
14
  },
14
- global: {
15
- stubs: {
16
- UnnnicInput: {
17
- name: 'UnnnicInput',
18
- template:
19
- '<input data-testid="input" v-bind="$attrs" @focus="$emit(\'focus\', $event)" />',
20
- },
21
- UnnnicDatePicker: {
22
- name: 'UnnnicDatePicker',
23
- props: ['minDate', 'maxDate', 'periodBaseDate', 'options'],
24
- template: '<div data-testid="datepicker"></div>',
25
- },
26
- },
27
- },
15
+ attachTo: document.body,
28
16
  });
29
17
 
30
18
  describe('InputDatePicker.vue', () => {
@@ -34,6 +22,12 @@ describe('InputDatePicker.vue', () => {
34
22
  wrapper = factory();
35
23
  });
36
24
 
25
+ afterEach(() => {
26
+ if (wrapper) {
27
+ wrapper.unmount();
28
+ }
29
+ });
30
+
37
31
  it('renders input and does not show datepicker by default', () => {
38
32
  expect(wrapper.find('[data-testid="input"]').exists()).toBe(true);
39
33
  expect(wrapper.find('[data-testid="datepicker"]').exists()).toBe(false);
@@ -42,13 +36,23 @@ describe('InputDatePicker.vue', () => {
42
36
  it('opens datepicker when input receives focus', async () => {
43
37
  const input = wrapper.find('[data-testid="input"]');
44
38
  await input.trigger('focus');
39
+ await wrapper.vm.$nextTick();
45
40
 
46
- wrapper.vm.showCalendarFilter = true;
41
+ expect(wrapper.findComponent({ name: 'UnnnicDatePicker' }).exists()).toBe(
42
+ true,
43
+ );
44
+ expect(wrapper.vm.isPopoverOpen).toBe(true);
45
+ });
46
+
47
+ it('opens datepicker when input receives click', async () => {
48
+ const input = wrapper.find('[data-testid="input"]');
49
+ await input.trigger('click');
47
50
  await wrapper.vm.$nextTick();
48
51
 
49
52
  expect(wrapper.findComponent({ name: 'UnnnicDatePicker' }).exists()).toBe(
50
53
  true,
51
54
  );
55
+ expect(wrapper.vm.isPopoverOpen).toBe(true);
52
56
  });
53
57
 
54
58
  it('computes filterText placeholder when there is no date selected', () => {
@@ -66,6 +70,7 @@ describe('InputDatePicker.vue', () => {
66
70
  });
67
71
 
68
72
  expect(withDates.vm.filterText).toBe('01-10-2025 ~ 01-20-2025');
73
+ withDates.unmount();
69
74
  });
70
75
 
71
76
  it('computes initialStartDate and initialEndDate for DatePicker', () => {
@@ -78,10 +83,11 @@ describe('InputDatePicker.vue', () => {
78
83
 
79
84
  expect(withDates.vm.initialStartDate).toBe('01 10 2025');
80
85
  expect(withDates.vm.initialEndDate).toBe('01 20 2025');
86
+ withDates.unmount();
81
87
  });
82
88
 
83
89
  it('emits selectDate with formatted dates when DatePicker emits change', async () => {
84
- wrapper.vm.showCalendarFilter = true;
90
+ wrapper.vm.isPopoverOpen = true;
85
91
  await wrapper.vm.$nextTick();
86
92
 
87
93
  const datePicker = wrapper.findComponent({ name: 'UnnnicDatePicker' });
@@ -104,7 +110,7 @@ describe('InputDatePicker.vue', () => {
104
110
  });
105
111
 
106
112
  it('emits update:model-value and closes dropdown when DatePicker emits submit', async () => {
107
- wrapper.vm.showCalendarFilter = true;
113
+ wrapper.vm.isPopoverOpen = true;
108
114
  await wrapper.vm.$nextTick();
109
115
 
110
116
  const datePicker = wrapper.findComponent({ name: 'UnnnicDatePicker' });
@@ -125,7 +131,7 @@ describe('InputDatePicker.vue', () => {
125
131
  end: '2025-01-20',
126
132
  });
127
133
 
128
- expect(wrapper.vm.showCalendarFilter).toBe(false);
134
+ expect(wrapper.vm.isPopoverOpen).toBe(false);
129
135
  });
130
136
 
131
137
  it('passes minDate, maxDate, options and periodBaseDate down to DatePicker', async () => {
@@ -137,7 +143,7 @@ describe('InputDatePicker.vue', () => {
137
143
  };
138
144
 
139
145
  wrapper = factory(props);
140
- wrapper.vm.showCalendarFilter = true;
146
+ wrapper.vm.isPopoverOpen = true;
141
147
  await wrapper.vm.$nextTick();
142
148
 
143
149
  const datePicker = wrapper.findComponent({ name: 'UnnnicDatePicker' });
@@ -147,13 +153,14 @@ describe('InputDatePicker.vue', () => {
147
153
  expect(dpProps.maxDate).toBe(props.maxDate);
148
154
  expect(dpProps.periodBaseDate).toBe(props.periodBaseDate);
149
155
  expect(dpProps.options).toEqual(props.options);
156
+ expect(dpProps.variant).toBe('popover');
150
157
  });
151
158
 
152
- it('closes dropdown on mouseout when clicking outside', () => {
153
- wrapper.vm.showCalendarFilter = true;
159
+ it('aligns the popover to the end when position is right', () => {
160
+ const rightWrapper = factory({ position: 'right' });
154
161
 
155
- wrapper.vm.mouseout({ target: document.createElement('div') });
162
+ expect(rightWrapper.vm.popoverAlign).toBe('end');
156
163
 
157
- expect(wrapper.vm.showCalendarFilter).toBe(false);
164
+ rightWrapper.unmount();
158
165
  });
159
166
  });
@@ -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',
@@ -189,17 +178,14 @@ export default {
189
178
  },
190
179
  };
191
180
  },
192
- watch: {
193
- modelValue(value) {
194
- this.updateBodyOverflow(value);
195
- },
196
- },
197
181
  methods: {
198
182
  close() {
199
183
  this.$emit('update:modelValue', false);
200
184
  },
201
- updateBodyOverflow(isHidden) {
202
- document.body.style.overflow = isHidden ? 'hidden' : '';
185
+ persistentHandler(event) {
186
+ if (this.persistent) {
187
+ event.preventDefault();
188
+ }
203
189
  },
204
190
  },
205
191
  };
@@ -207,85 +193,29 @@ export default {
207
193
 
208
194
  <style lang="scss" scoped>
209
195
  @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
196
 
234
197
  .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
198
  &__left-sidebar {
254
199
  background-color: $unnnic-color-neutral-black;
255
200
  color: $unnnic-color-neutral-white;
201
+
202
+ grid-area: left-sidebar;
203
+ grid-row: span 3;
256
204
  }
257
205
 
258
206
  &__body {
259
207
  flex: 1;
260
208
  display: flex;
261
209
  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
210
 
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
- }
211
+ overflow-y: auto;
282
212
 
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;
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
+ }
289
219
  }
290
220
 
291
221
  &__content {
@@ -309,26 +239,5 @@ export default {
309
239
  border-radius: $unnnic-border-radius-pill;
310
240
  }
311
241
  }
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
242
  }
334
243
  </style>