@weni/unnnic-system 1.16.31-develop.0 → 1.16.32-develop.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "1.16.31-develop.0",
3
+ "version": "1.16.32-develop.0",
4
4
  "main": "./dist/unnnic.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <transition name="modal" v-if="showModal">
3
- <div v-bind="$attrs" :class="['unnnic-modal']" v-on="$listeners">
4
- <div class="unnnic-modal-container">
5
- <div class="unnnic-modal-container-background">
3
+ <div ref="modalContainer" v-bind="$attrs" :class="['unnnic-modal']" v-on="$listeners">
4
+ <div class="unnnic-modal-container" @click.self="onOutsideCloseClick">
5
+ <div ref="modal" class="unnnic-modal-container-background">
6
6
  <div class="unnnic-modal-container-background-body">
7
7
  <div v-if="closeIcon" class="unnnic-modal-container-background-body-close_icon">
8
8
  <unnnic-icon-svg
@@ -26,8 +26,11 @@
26
26
  <div class="unnnic-modal-container-background-body-title">
27
27
  {{ text }}
28
28
  </div>
29
+ </div>
30
+ <div class="unnnic-modal-container-background-body-description-container">
29
31
  <div class="unnnic-modal-container-background-body-description">
30
32
  {{ description }} <slot name="message" />
33
+ <slot name="default" />
31
34
  </div>
32
35
  </div>
33
36
  <div class="unnnic-modal-container-background-report" v-if="hasAlertMessage">
@@ -79,9 +82,69 @@ export default {
79
82
  type: String,
80
83
  default: null,
81
84
  },
85
+ persistent: {
86
+ type: Boolean,
87
+ default: false,
88
+ },
89
+ },
90
+ mounted() {
91
+ if (window.innerWidth <= 600) {
92
+ this.mobileAnimateOpen();
93
+ }
82
94
  },
83
95
  methods: {
84
- onCloseClick() {
96
+ mobileAnimateReset() {
97
+ this.$refs.modalContainer.style.transition = null;
98
+ this.$refs.modal.style.transition = null;
99
+ },
100
+
101
+ mobileAnimateOpen() {
102
+ this.$nextTick(() => {
103
+ this.$refs.modalContainer.style.transition = 'none';
104
+ this.$refs.modalContainer.style.backgroundColor = 'transparent';
105
+ this.$refs.modal.style.transition = 'none';
106
+ this.$refs.modal.style.marginBottom = `${-this.$refs.modal.offsetHeight}px`;
107
+
108
+ setTimeout(() => {
109
+ this.$refs.modalContainer.style.transition = 'background-color 0.2s';
110
+ this.$refs.modalContainer.style.backgroundColor = null;
111
+ this.$refs.modal.style.transition = 'margin-bottom 0.2s';
112
+ this.$refs.modal.style.marginBottom = null;
113
+
114
+ setTimeout(() => {
115
+ this.mobileAnimateReset();
116
+ }, 200);
117
+ });
118
+ });
119
+ },
120
+
121
+ mobileAnimateClose() {
122
+ return new Promise((resolve) => {
123
+ this.$refs.modalContainer.style.transition = 'background-color 0.2s';
124
+ this.$refs.modalContainer.style.backgroundColor = 'transparent';
125
+ this.$refs.modal.style.transition = 'margin-bottom 0.2s';
126
+ this.$refs.modal.style.marginBottom = `${-this.$refs.modal.offsetHeight}px`;
127
+
128
+ setTimeout(() => {
129
+ this.mobileAnimateReset();
130
+ resolve();
131
+ }, 200);
132
+ });
133
+ },
134
+
135
+ onOutsideCloseClick() {
136
+ if (this.persistent) {
137
+ return;
138
+ }
139
+
140
+ this.onCloseClick();
141
+ },
142
+
143
+ async onCloseClick() {
144
+ if (window.innerWidth <= 600) {
145
+ await this.mobileAnimateClose();
146
+ }
147
+
85
148
  this.$emit('close');
86
149
  },
87
150
  },
@@ -124,7 +187,6 @@ export default {
124
187
  overflow: hidden;
125
188
 
126
189
  &-body {
127
- min-height: 13.75 * $unnnic-font-size;
128
190
  background-color: $unnnic-color-background-carpet;
129
191
  padding: 0 $unnnic-inline-md;
130
192
  text-align: center;
@@ -161,12 +223,22 @@ export default {
161
223
  width: 100%;
162
224
  text-align: center;
163
225
 
226
+ &-container {
227
+ background-color: $unnnic-color-background-carpet;
228
+ padding: 0 $unnnic-inline-md;
229
+ box-sizing: border-box;
230
+ display: flex;
231
+ overflow: hidden;
232
+ padding-bottom: $unnnic-spacing-stack-giant;
233
+ }
234
+
235
+ overflow: auto;
236
+
164
237
  font-family: $unnnic-font-family-secondary;
165
238
  color: $unnnic-color-neutral-cloudy;
166
239
  font-weight: $unnnic-font-weight-regular;
167
240
  font-size: $unnnic-font-size-body-lg;
168
241
  line-height: ($unnnic-font-size-body-lg + $unnnic-line-height-medium);
169
- padding-bottom: $unnnic-spacing-stack-giant;
170
242
  }
171
243
  }
172
244
 
@@ -203,6 +275,42 @@ export default {
203
275
  }
204
276
  }
205
277
  }
278
+
279
+ @media (max-width: 600px) {
280
+ align-items: flex-end;
281
+
282
+ &-background {
283
+ width: 100%;
284
+ border-radius: 1.5 * $unnnic-font-size 1.5 * $unnnic-font-size 0 0;
285
+ box-shadow: 0px -8px 16px 0px rgba(0, 0, 0, 0.08);
286
+ max-height: 90vh;
287
+ display: flex;
288
+ flex-direction: column;
289
+
290
+ &-body {
291
+ min-height: initial;
292
+
293
+ &-close_icon {
294
+ padding-bottom: 0;
295
+ }
296
+
297
+ &-title {
298
+ font-weight: $unnnic-font-weight-bold;
299
+ color: $unnnic-color-neutral-dark;
300
+ }
301
+
302
+ &-description {
303
+ text-align: initial;
304
+ padding-right: $unnnic-spacing-sm;
305
+ margin-right: -$unnnic-spacing-sm;
306
+
307
+ &-container {
308
+ padding-bottom: $unnnic-spacing-md;
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
206
314
  }
207
315
  }
208
316
  </style>
@@ -22,7 +22,7 @@ export default {
22
22
  const Template = (args, { argTypes }) => ({
23
23
  props: Object.keys(argTypes),
24
24
  components: { unnnicModal, unnnicButton },
25
- template: '<unnnicModal v-bind="$props" />',
25
+ template: '<unnnic-modal v-bind="$props">Conteúdo do modal<br>Conteúdo do modal<br>Conteúdo do modal<br>Conteúdo do modal<br>Conteúdo do modal<br>Conteúdo do modal<br>Conteúdo do modalConteúdo do modal<br></unnnic-modal>',
26
26
  });
27
27
 
28
28
  const ModalTemplate = (args, { argTypes }) => ({