mediacube-ui 0.1.199 → 0.1.201
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.201](https://github.com/MediaCubeCo/mcui/compare/v0.1.200...v0.1.201) (2024-01-08)
|
|
6
|
+
|
|
7
|
+
### [0.1.200](https://github.com/MediaCubeCo/mcui/compare/v0.1.199...v0.1.200) (2023-12-29)
|
|
8
|
+
|
|
5
9
|
### [0.1.199](https://github.com/MediaCubeCo/mcui/compare/v0.1.198...v0.1.199) (2023-12-27)
|
|
6
10
|
|
|
7
11
|
### [0.1.198](https://github.com/MediaCubeCo/mcui/compare/v0.1.197...v0.1.198) (2023-12-21)
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<modal
|
|
3
3
|
:class="classes"
|
|
4
4
|
:name="name"
|
|
5
|
+
:style="styles"
|
|
5
6
|
:max-width="maxWidth"
|
|
6
7
|
:click-to-close="clickToClose"
|
|
7
8
|
class="mc-modal"
|
|
@@ -126,6 +127,20 @@ export default {
|
|
|
126
127
|
scrolled_top: false,
|
|
127
128
|
scrolled_bottom: false,
|
|
128
129
|
resize_observer: null,
|
|
130
|
+
small_indents: false,
|
|
131
|
+
modal_params: {},
|
|
132
|
+
indent: {
|
|
133
|
+
regular: 400,
|
|
134
|
+
small: 150,
|
|
135
|
+
},
|
|
136
|
+
header: {
|
|
137
|
+
title: {
|
|
138
|
+
line_height: {
|
|
139
|
+
regular: 300,
|
|
140
|
+
small: 250,
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
129
144
|
}),
|
|
130
145
|
computed: {
|
|
131
146
|
classes() {
|
|
@@ -136,9 +151,18 @@ export default {
|
|
|
136
151
|
'mc-modal--scrolled-bottom': this.scrolled_bottom,
|
|
137
152
|
'mc-modal--scrollable': this.scrollableContent,
|
|
138
153
|
'mc-modal--top-padding': this.topPadding,
|
|
154
|
+
'mc-modal--small-indents': this.small_indents,
|
|
139
155
|
[`mc-modal--variation-${this.variation}`]: !!this.variation,
|
|
140
156
|
[`mc-modal--header-align-${this.headerAlign}`]:
|
|
141
|
-
|
|
157
|
+
(this.closeVisible || this.arrowVisible) && !!this.headerAlign,
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
styles() {
|
|
161
|
+
return {
|
|
162
|
+
'--mc-modal-padding': `var(--space-${this.indent.regular})`,
|
|
163
|
+
'--mc-modal-padding-small': `var(--space-${this.indent.small})`,
|
|
164
|
+
'--mc-modal-header-line-height': `var(--line-height-${this.header.title.line_height.regular})`,
|
|
165
|
+
'--mc-modal-header-line-height-small': `var(--line-height-${this.header.title.line_height.small})`,
|
|
142
166
|
}
|
|
143
167
|
},
|
|
144
168
|
},
|
|
@@ -162,6 +186,7 @@ export default {
|
|
|
162
186
|
},
|
|
163
187
|
handleOpened(event) {
|
|
164
188
|
if (this.separators) {
|
|
189
|
+
this.getParams()
|
|
165
190
|
this.$refs.mcModalBody.addEventListener('scroll', this.calculateSeparators, {
|
|
166
191
|
passive: true,
|
|
167
192
|
})
|
|
@@ -189,6 +214,16 @@ export default {
|
|
|
189
214
|
handleBack(event) {
|
|
190
215
|
this.$emit('back', event)
|
|
191
216
|
},
|
|
217
|
+
getParams() {
|
|
218
|
+
try {
|
|
219
|
+
Object.keys(this.styles).forEach(attr => {
|
|
220
|
+
const param = parseInt(getComputedStyle(this.$refs.modalInner)?.getPropertyValue(attr))
|
|
221
|
+
param && (this.modal_params[attr] = param)
|
|
222
|
+
})
|
|
223
|
+
} catch (e) {
|
|
224
|
+
console.error(e)
|
|
225
|
+
}
|
|
226
|
+
},
|
|
192
227
|
/**
|
|
193
228
|
* Устанавливаем сепараторы, если есть скролл
|
|
194
229
|
* @param {Boolean} scrolled - если метод вызван скроллом
|
|
@@ -197,6 +232,7 @@ export default {
|
|
|
197
232
|
if (!scrolled) {
|
|
198
233
|
this.scrolled_top = false
|
|
199
234
|
this.scrolled_bottom = false
|
|
235
|
+
this.small_indents = false
|
|
200
236
|
}
|
|
201
237
|
|
|
202
238
|
setTimeout(
|
|
@@ -205,6 +241,18 @@ export default {
|
|
|
205
241
|
// Сепаратор появится если высота скролла будет > 2px
|
|
206
242
|
const offset = 2
|
|
207
243
|
this.scrolled_top = scrollTop > offset
|
|
244
|
+
/* Если шапка уже маленькая, то отключаем при отключении сепаратора
|
|
245
|
+
* Иначе смотрим, чтобы отступ был > чем убираемые отступы, т.к. нет смысла сжимать шапку, если <
|
|
246
|
+
*/
|
|
247
|
+
const indentDifferences =
|
|
248
|
+
(this.modal_params?.['--mc-modal-padding'] -
|
|
249
|
+
this.modal_params?.['--mc-modal-padding-small']) *
|
|
250
|
+
3
|
|
251
|
+
const lineHeightDifferences =
|
|
252
|
+
this.modal_params?.['--mc-modal-header-line-height'] -
|
|
253
|
+
this.modal_params?.['--mc-modal-header-line-height-small']
|
|
254
|
+
const sizeDifferences = indentDifferences + lineHeightDifferences
|
|
255
|
+
this.small_indents = this.small_indents ? this.scrolled_top : scrollTop > sizeDifferences
|
|
208
256
|
this.scrolled_bottom = scrollTop + clientHeight < scrollHeight - offset
|
|
209
257
|
},
|
|
210
258
|
scrolled ? 0 : 300,
|
|
@@ -223,6 +271,10 @@ export default {
|
|
|
223
271
|
$block-name: &;
|
|
224
272
|
$border-color: #dee1e9;
|
|
225
273
|
$box-shadow-color: #20008c28;
|
|
274
|
+
--mc-modal-padding: $space-400;
|
|
275
|
+
--mc-modal-padding-small: $space-150;
|
|
276
|
+
--mc-modal-header-line-height: $line-height-300;
|
|
277
|
+
--mc-modal-header-line-height-small: $line-height-250;
|
|
226
278
|
|
|
227
279
|
@media #{$media-query-s} {
|
|
228
280
|
padding: 12px 0;
|
|
@@ -231,22 +283,23 @@ export default {
|
|
|
231
283
|
.vm--modal {
|
|
232
284
|
border-radius: $radius-200;
|
|
233
285
|
}
|
|
234
|
-
&__btn-close
|
|
286
|
+
&__btn-close,
|
|
287
|
+
&__btn-back {
|
|
235
288
|
@include reset-btn();
|
|
236
|
-
@include position(absolute, $space-400 $space-200 null null);
|
|
237
289
|
@include close-link();
|
|
238
290
|
z-index: $z-index-sticky;
|
|
291
|
+
transition: $duration-s all;
|
|
292
|
+
}
|
|
293
|
+
&__btn-close {
|
|
294
|
+
@include position(absolute, var(--mc-modal-padding) $space-200 null null);
|
|
239
295
|
@media #{$media-query-s} {
|
|
240
|
-
@include position(absolute,
|
|
296
|
+
@include position(absolute, var(--mc-modal-padding) $space-600 null null);
|
|
241
297
|
}
|
|
242
298
|
}
|
|
243
299
|
&__btn-back {
|
|
244
|
-
@include
|
|
245
|
-
@include position(absolute, $space-400 null null $space-200);
|
|
246
|
-
@include close-link();
|
|
247
|
-
z-index: $z-index-sticky;
|
|
300
|
+
@include position(absolute, var(--mc-modal-padding) null null $space-200);
|
|
248
301
|
@media #{$media-query-s} {
|
|
249
|
-
@include position(absolute,
|
|
302
|
+
@include position(absolute, var(--mc-modal-padding) null null $space-600);
|
|
250
303
|
}
|
|
251
304
|
}
|
|
252
305
|
|
|
@@ -290,7 +343,7 @@ export default {
|
|
|
290
343
|
&__header {
|
|
291
344
|
padding-bottom: 9px;
|
|
292
345
|
border-bottom: 2px solid $border-color;
|
|
293
|
-
margin-bottom:
|
|
346
|
+
margin-bottom: var(--mc-modal-padding);
|
|
294
347
|
}
|
|
295
348
|
&__control {
|
|
296
349
|
display: flex;
|
|
@@ -358,9 +411,14 @@ export default {
|
|
|
358
411
|
|
|
359
412
|
&__header {
|
|
360
413
|
flex-shrink: 0;
|
|
361
|
-
|
|
414
|
+
transition: $duration-s all;
|
|
415
|
+
padding: var(--mc-modal-padding) $space-200 $space-250;
|
|
362
416
|
@media #{$media-query-s} {
|
|
363
417
|
padding: $space-350;
|
|
418
|
+
.mc-title {
|
|
419
|
+
transition: $duration-s all;
|
|
420
|
+
line-height: var(--mc-modal-header-line-height);
|
|
421
|
+
}
|
|
364
422
|
}
|
|
365
423
|
}
|
|
366
424
|
|
|
@@ -393,10 +451,10 @@ export default {
|
|
|
393
451
|
overflow: hidden;
|
|
394
452
|
height: 100% !important;
|
|
395
453
|
> *:first-child {
|
|
396
|
-
padding-top:
|
|
454
|
+
padding-top: var(--mc-modal-padding);
|
|
397
455
|
}
|
|
398
456
|
> *:last-child {
|
|
399
|
-
padding-bottom:
|
|
457
|
+
padding-bottom: var(--mc-modal-padding);
|
|
400
458
|
}
|
|
401
459
|
@media #{$media-query-s} {
|
|
402
460
|
overflow: visible;
|
|
@@ -444,6 +502,30 @@ export default {
|
|
|
444
502
|
}
|
|
445
503
|
}
|
|
446
504
|
}
|
|
505
|
+
&--small-indents {
|
|
506
|
+
@media #{$media-query-s} {
|
|
507
|
+
#{$block-name} {
|
|
508
|
+
&__control {
|
|
509
|
+
padding-bottom: var(--mc-modal-padding-small) !important;
|
|
510
|
+
}
|
|
511
|
+
&__header {
|
|
512
|
+
padding-block: var(--mc-modal-padding-small) !important;
|
|
513
|
+
.mc-title {
|
|
514
|
+
font-weight: $font-weight-semi-bold;
|
|
515
|
+
font-size: $font-size-300;
|
|
516
|
+
line-height: var(--mc-modal-header-line-height-small);
|
|
517
|
+
align-items: center;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
&__btn {
|
|
521
|
+
&-back,
|
|
522
|
+
&-close {
|
|
523
|
+
top: var(--mc-modal-padding-small) !important;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
447
529
|
|
|
448
530
|
&--scrolled {
|
|
449
531
|
&-top {
|
|
@@ -473,8 +555,9 @@ export default {
|
|
|
473
555
|
display: flex;
|
|
474
556
|
justify-content: center;
|
|
475
557
|
padding: $space-250 $space-200 $space-400;
|
|
558
|
+
transition: $duration-s all;
|
|
476
559
|
@media #{$media-query-s} {
|
|
477
|
-
padding: $space-
|
|
560
|
+
padding: $space-150 $space-300 $space-300;
|
|
478
561
|
}
|
|
479
562
|
.mc-button {
|
|
480
563
|
width: 100%;
|