@formixru/b2b-ui 1.0.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/CONTRIBUTING.md +61 -0
- package/README.md +30 -0
- package/package.json +110 -0
- package/src/base.scss +89 -0
- package/src/components/action-list/index.scss +38 -0
- package/src/components/banner/index.scss +30 -0
- package/src/components/breadcrumbs/index.js +8 -0
- package/src/components/breadcrumbs/index.scss +55 -0
- package/src/components/button/index.scss +223 -0
- package/src/components/checkbox/index.scss +94 -0
- package/src/components/color-input/index.scss +88 -0
- package/src/components/color-input/index.vue +156 -0
- package/src/components/date-input/index.scss +126 -0
- package/src/components/date-input/index.vue +240 -0
- package/src/components/delete-all/index.scss +44 -0
- package/src/components/dialog/index.js +221 -0
- package/src/components/dialog/index.scss +198 -0
- package/src/components/empty-list/index.scss +97 -0
- package/src/components/file-input/index.scss +119 -0
- package/src/components/file-input/index.vue +333 -0
- package/src/components/font-input/index.scss +47 -0
- package/src/components/font-input/index.vue +154 -0
- package/src/components/form/index.js +228 -0
- package/src/components/form/index.scss +398 -0
- package/src/components/header-announcement/index.scss +48 -0
- package/src/components/input/index.js +85 -0
- package/src/components/input/index.scss +87 -0
- package/src/components/link/index.scss +266 -0
- package/src/components/loader/index.js +65 -0
- package/src/components/loader/index.scss +99 -0
- package/src/components/nobr/index.scss +5 -0
- package/src/components/overlay/index.js +82 -0
- package/src/components/overlay/index.scss +29 -0
- package/src/components/pagination/index.scss +59 -0
- package/src/components/pagination-group/index.js +5 -0
- package/src/components/pagination-group/index.scss +86 -0
- package/src/components/quantity-input/index.scss +179 -0
- package/src/components/quantity-input/index.vue +141 -0
- package/src/components/radio/index.scss +80 -0
- package/src/components/radio-list/index.scss +79 -0
- package/src/components/range-input/index.scss +109 -0
- package/src/components/range-input/index.vue +185 -0
- package/src/components/rating-input/index.js +32 -0
- package/src/components/rating-input/index.scss +36 -0
- package/src/components/select/index.js +6 -0
- package/src/components/select/index.scss +84 -0
- package/src/components/sidebar/index.js +174 -0
- package/src/components/sidebar/index.scss +398 -0
- package/src/components/simple-page/index.scss +32 -0
- package/src/components/slider-nav/index.scss +82 -0
- package/src/components/slider-pagination/index.scss +130 -0
- package/src/components/spinner/index.scss +35 -0
- package/src/components/sr-only/index.scss +25 -0
- package/src/components/steps/index.scss +155 -0
- package/src/components/suggest-input/index.scss +141 -0
- package/src/components/suggest-input/index.vue +324 -0
- package/src/components/tabs/index.js +192 -0
- package/src/components/tabs/index.scss +137 -0
- package/src/components/time-select/index.scss +27 -0
- package/src/components/toggle/index.scss +76 -0
- package/src/components/tooltip/index.js +69 -0
- package/src/components/tooltip/index.scss +112 -0
- package/src/components/total/index.scss +162 -0
- package/src/components/warning-message/index.scss +170 -0
- package/src/components/warning-message/index.vue +94 -0
- package/src/components/wysiwyg/index.scss +344 -0
- package/src/helpers/css-var.js +8 -0
- package/src/helpers/error-handler.js +61 -0
- package/src/helpers/get-smart-captcha.js +7 -0
- package/src/helpers/is-in-viewport.js +10 -0
- package/src/helpers/mm.js +52 -0
- package/src/helpers/scroll-to.js +21 -0
- package/src/variables.scss +1295 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export const init = async ($b) => {
|
|
2
|
+
if ($b.imask) {
|
|
3
|
+
$b.imask.destroy();
|
|
4
|
+
delete $b.imask;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
if ($b.type === 'tel') {
|
|
8
|
+
const { default: IMask } = await import('imask');
|
|
9
|
+
|
|
10
|
+
const mask = [
|
|
11
|
+
{
|
|
12
|
+
mask: '+7 000 000-00-00',
|
|
13
|
+
startsWith: ['7'],
|
|
14
|
+
country: 'RU',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
mask: '000000000000',
|
|
18
|
+
startsWith: [''],
|
|
19
|
+
country: 'Unknown',
|
|
20
|
+
prepareChar(value, masked) {
|
|
21
|
+
// Меняем 8 на 7 при вводе первого символа или при вставке телефонного номера
|
|
22
|
+
const ruNumberLength = 11;
|
|
23
|
+
if (
|
|
24
|
+
value === '8' &&
|
|
25
|
+
(value === $b.value || $b.value.replaceAll(/\D/g, '').length === ruNumberLength) &&
|
|
26
|
+
masked._value.length === 0
|
|
27
|
+
) {
|
|
28
|
+
return '7';
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
if (window.TEL_ADD_MASKS) {
|
|
36
|
+
for (const item of [...window.TEL_ADD_MASKS].reverse()) {
|
|
37
|
+
mask.unshift(item);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
$b.imask = new IMask($b, {
|
|
42
|
+
mask,
|
|
43
|
+
dispatch(appended, dynamicMasked) {
|
|
44
|
+
const number = (dynamicMasked.value + appended).replaceAll(/\D/g, '');
|
|
45
|
+
let mask = dynamicMasked.compiledMasks.find(({ startsWith }) =>
|
|
46
|
+
startsWith.some((n) => number.indexOf(n) === 0),
|
|
47
|
+
);
|
|
48
|
+
if (number.length >= 3 && mask.country === 'Unknown') {
|
|
49
|
+
mask = dynamicMasked.compiledMasks.find(({ country }) => country === 'RU');
|
|
50
|
+
}
|
|
51
|
+
if (window.TEL_FLAGS && window.TEL_FLAGS.show) {
|
|
52
|
+
if (mask.country === 'Unknown' || number.length < 3) {
|
|
53
|
+
Object.assign($b.style, {
|
|
54
|
+
backgroundImage: ``,
|
|
55
|
+
backgroundPosition: '',
|
|
56
|
+
backgroundRepeat: '',
|
|
57
|
+
backgroundSize: '',
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
Object.assign($b.style, {
|
|
61
|
+
backgroundImage: `url(${window.TEL_FLAGS.path.replace(/\/$/, '')}/${mask.country}.svg)`,
|
|
62
|
+
backgroundPosition: 'right 12px center',
|
|
63
|
+
backgroundRepeat: 'no-repeat',
|
|
64
|
+
backgroundSize: '20px',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
Object.assign($b.style, {
|
|
69
|
+
backgroundImage: ``,
|
|
70
|
+
backgroundPosition: '',
|
|
71
|
+
backgroundRepeat: '',
|
|
72
|
+
backgroundSize: '',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return mask;
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
$b.addEventListener('input', () => {
|
|
81
|
+
if ($b.classList.contains('input_error')) {
|
|
82
|
+
$b.classList.remove('input_error');
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
@use '../../variables' as *;
|
|
2
|
+
|
|
3
|
+
$b: '.input';
|
|
4
|
+
|
|
5
|
+
#{$b} {
|
|
6
|
+
appearance: none;
|
|
7
|
+
background-color: $input-bg;
|
|
8
|
+
border: $input-border-width solid $input-filled-border-color;
|
|
9
|
+
border-radius: $input-radius;
|
|
10
|
+
color: $input-color;
|
|
11
|
+
display: block;
|
|
12
|
+
height: $input-height;
|
|
13
|
+
padding: $input-padding-y $input-padding-x;
|
|
14
|
+
transition-duration: var(--duration-micro-s);
|
|
15
|
+
transition-property: background-color, border-color, color;
|
|
16
|
+
transition-timing-function: var(--easing-standard);
|
|
17
|
+
width: 100%;
|
|
18
|
+
|
|
19
|
+
@include font($input-font);
|
|
20
|
+
|
|
21
|
+
&:placeholder-shown {
|
|
22
|
+
border-color: $input-border-color;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&[type='number'] {
|
|
26
|
+
@media (--tablet-landscape-up) {
|
|
27
|
+
appearance: textfield;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&::-webkit-inner-spin-button,
|
|
31
|
+
&::-webkit-outer-spin-button {
|
|
32
|
+
@media (--tablet-landscape-up) {
|
|
33
|
+
appearance: none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&::placeholder {
|
|
39
|
+
color: $input-placeholder-color;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:disabled {
|
|
43
|
+
background-color: $input-disabled-bg;
|
|
44
|
+
border-color: $input-disabled-border-color;
|
|
45
|
+
color: $input-disabled-color;
|
|
46
|
+
|
|
47
|
+
&::placeholder {
|
|
48
|
+
color: $input-disabled-placeholder-color;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:focus-visible {
|
|
53
|
+
background-color: $input-active-bg;
|
|
54
|
+
border-color: $input-active-border-color;
|
|
55
|
+
color: $input-active-color;
|
|
56
|
+
outline: $input-border-width solid $input-active-outline-color;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&_small {
|
|
60
|
+
height: $input-small-height;
|
|
61
|
+
padding: $input-small-padding-y $input-small-padding-x;
|
|
62
|
+
|
|
63
|
+
@include font($input-small-font);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&_textarea {
|
|
67
|
+
min-height: $input-textarea-min-height;
|
|
68
|
+
resize: vertical;
|
|
69
|
+
|
|
70
|
+
@include font($input-textarea-font);
|
|
71
|
+
|
|
72
|
+
&#{$b}_small {
|
|
73
|
+
min-height: $input-textarea-small-min-height;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&_error {
|
|
78
|
+
background-color: $input-error-bg;
|
|
79
|
+
border-color: $input-error-border-color;
|
|
80
|
+
color: $input-error-color;
|
|
81
|
+
|
|
82
|
+
&:placeholder-shown,
|
|
83
|
+
&:focus-visible {
|
|
84
|
+
border-color: $input-error-border-color;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
@use '../../variables' as *;
|
|
2
|
+
|
|
3
|
+
$b: '.link';
|
|
4
|
+
|
|
5
|
+
@mixin transform($property: color) {
|
|
6
|
+
transition-duration: var(--duration-micro-s);
|
|
7
|
+
transition-property: $property;
|
|
8
|
+
transition-timing-function: var(--easing-standard);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@mixin link($color: $link-color, $active-color: $link-active-color) {
|
|
12
|
+
cursor: default;
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
|
|
15
|
+
@include transform;
|
|
16
|
+
|
|
17
|
+
&:any-link,
|
|
18
|
+
&:enabled {
|
|
19
|
+
color: $color;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
|
|
22
|
+
&:hover,
|
|
23
|
+
&:focus-visible {
|
|
24
|
+
color: $active-color;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#{$b} {
|
|
30
|
+
@include link;
|
|
31
|
+
|
|
32
|
+
&_solid:any-link,
|
|
33
|
+
&_solid:enabled {
|
|
34
|
+
&:not(#{$b}_partial),
|
|
35
|
+
& #{$b}__text {
|
|
36
|
+
@include ul-solid($link-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:hover,
|
|
40
|
+
&:focus-visible {
|
|
41
|
+
&:not(#{$b}_partial),
|
|
42
|
+
& #{$b}__text {
|
|
43
|
+
@include ul-solid($link-active-color);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&_dashed:any-link,
|
|
49
|
+
&_dashed:enabled {
|
|
50
|
+
&:not(#{$b}_partial),
|
|
51
|
+
& #{$b}__text {
|
|
52
|
+
@include ul-dashed($link-color);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:hover,
|
|
56
|
+
&:focus-visible {
|
|
57
|
+
&:not(#{$b}_partial),
|
|
58
|
+
& #{$b}__text {
|
|
59
|
+
@include ul-dashed($link-active-color);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&_dotted:any-link,
|
|
65
|
+
&_dotted:enabled {
|
|
66
|
+
&:not(#{$b}_partial),
|
|
67
|
+
& #{$b}__text {
|
|
68
|
+
@include ul-dotted($link-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:hover,
|
|
72
|
+
&:focus-visible {
|
|
73
|
+
&:not(#{$b}_partial),
|
|
74
|
+
& #{$b}__text {
|
|
75
|
+
@include ul-dotted($link-active-color);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&_alt {
|
|
81
|
+
&:any-link,
|
|
82
|
+
&:enabled {
|
|
83
|
+
color: $link-alt-color;
|
|
84
|
+
|
|
85
|
+
&:hover,
|
|
86
|
+
&:focus-visible {
|
|
87
|
+
color: $link-alt-active-color;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&#{$b}_solid:any-link,
|
|
92
|
+
&#{$b}_solid:enabled {
|
|
93
|
+
&:not(#{$b}_partial),
|
|
94
|
+
& #{$b}__text {
|
|
95
|
+
@include ul-solid($link-alt-color);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:hover,
|
|
99
|
+
&:focus-visible {
|
|
100
|
+
&:not(#{$b}_partial),
|
|
101
|
+
& #{$b}__text {
|
|
102
|
+
@include ul-solid($link-alt-active-color);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&#{$b}_dashed:any-link,
|
|
108
|
+
&#{$b}_dashed:enabled {
|
|
109
|
+
&:not(#{$b}_partial),
|
|
110
|
+
& #{$b}__text {
|
|
111
|
+
@include ul-dashed($link-alt-color);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&:hover,
|
|
115
|
+
&:focus-visible {
|
|
116
|
+
&:not(#{$b}_partial),
|
|
117
|
+
& #{$b}__text {
|
|
118
|
+
@include ul-dashed($link-alt-active-color);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&#{$b}_dotted:any-link,
|
|
124
|
+
&#{$b}_dotted:enabled {
|
|
125
|
+
&:not(#{$b}_partial),
|
|
126
|
+
& #{$b}__text {
|
|
127
|
+
@include ul-dotted($link-alt-color);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&:hover,
|
|
131
|
+
&:focus-visible {
|
|
132
|
+
&:not(#{$b}_partial),
|
|
133
|
+
& #{$b}__text {
|
|
134
|
+
@include ul-dotted($link-alt-active-color);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&_grey {
|
|
141
|
+
&:any-link,
|
|
142
|
+
&:enabled {
|
|
143
|
+
color: $link-grey-color;
|
|
144
|
+
|
|
145
|
+
&:hover,
|
|
146
|
+
&:focus-visible {
|
|
147
|
+
color: $link-grey-active-color;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&#{$b}_solid:any-link,
|
|
152
|
+
&#{$b}_solid:enabled {
|
|
153
|
+
&:not(#{$b}_partial),
|
|
154
|
+
& #{$b}__text {
|
|
155
|
+
@include ul-solid($link-grey-color);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:hover,
|
|
159
|
+
&:focus-visible {
|
|
160
|
+
&:not(#{$b}_partial),
|
|
161
|
+
& #{$b}__text {
|
|
162
|
+
@include ul-solid($link-grey-active-color);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&#{$b}_dashed:any-link,
|
|
168
|
+
&#{$b}_dashed:enabled {
|
|
169
|
+
&:not(#{$b}_partial),
|
|
170
|
+
& #{$b}__text {
|
|
171
|
+
@include ul-dashed($link-grey-color);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&:hover,
|
|
175
|
+
&:focus-visible {
|
|
176
|
+
&:not(#{$b}_partial),
|
|
177
|
+
& #{$b}__text {
|
|
178
|
+
@include ul-dashed($link-grey-active-color);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&#{$b}_dotted:any-link,
|
|
184
|
+
&#{$b}_dotted:enabled {
|
|
185
|
+
&:not(#{$b}_partial),
|
|
186
|
+
& #{$b}__text {
|
|
187
|
+
@include ul-dotted($link-grey-color);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&:hover,
|
|
191
|
+
&:focus-visible {
|
|
192
|
+
&:not(#{$b}_partial),
|
|
193
|
+
& #{$b}__text {
|
|
194
|
+
@include ul-dotted($link-grey-active-color);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
&_inverted {
|
|
201
|
+
&:any-link,
|
|
202
|
+
&:enabled {
|
|
203
|
+
color: $link-inverted-color;
|
|
204
|
+
|
|
205
|
+
&:hover,
|
|
206
|
+
&:focus-visible {
|
|
207
|
+
color: $link-inverted-active-color;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&#{$b}_solid:any-link,
|
|
212
|
+
&#{$b}_solid:enabled {
|
|
213
|
+
&:not(#{$b}_partial),
|
|
214
|
+
& #{$b}__text {
|
|
215
|
+
@include ul-solid($link-inverted-color);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&:hover,
|
|
219
|
+
&:focus-visible {
|
|
220
|
+
&:not(#{$b}_partial),
|
|
221
|
+
& #{$b}__text {
|
|
222
|
+
@include ul-solid($link-inverted-active-color);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&#{$b}_dashed:any-link,
|
|
228
|
+
&#{$b}_dashed:enabled {
|
|
229
|
+
&:not(#{$b}_partial),
|
|
230
|
+
& #{$b}__text {
|
|
231
|
+
@include ul-dashed($link-inverted-color);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
&:hover,
|
|
235
|
+
&:focus-visible {
|
|
236
|
+
&:not(#{$b}_partial),
|
|
237
|
+
& #{$b}__text {
|
|
238
|
+
@include ul-dashed($link-inverted-active-color);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
&#{$b}_dotted:any-link,
|
|
244
|
+
&#{$b}_dotted:enabled {
|
|
245
|
+
&:not(#{$b}_partial),
|
|
246
|
+
& #{$b}__text {
|
|
247
|
+
@include ul-dotted($link-inverted-color);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&:hover,
|
|
251
|
+
&:focus-visible {
|
|
252
|
+
&:not(#{$b}_partial),
|
|
253
|
+
& #{$b}__text {
|
|
254
|
+
@include ul-dotted($link-inverted-active-color);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&__text {
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
&__icon {
|
|
264
|
+
fill: currentcolor;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
let loaderTimeout;
|
|
2
|
+
|
|
3
|
+
export const clearLoaderTimeout = () => {
|
|
4
|
+
clearTimeout(loaderTimeout);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const show = (delay) => {
|
|
8
|
+
if (!document.querySelector('.loader')) {
|
|
9
|
+
document.body.insertAdjacentHTML(
|
|
10
|
+
'beforeend',
|
|
11
|
+
`
|
|
12
|
+
<div class="loader">
|
|
13
|
+
<div class="loader__dots">
|
|
14
|
+
<div class="loader__dot loader__dot_1"></div>
|
|
15
|
+
<div class="loader__dot loader__dot_2"></div>
|
|
16
|
+
<div class="loader__dot loader__dot_3"></div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
`,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
const $b = document.querySelector('.loader');
|
|
23
|
+
clearLoaderTimeout();
|
|
24
|
+
return new Promise((resolve) => {
|
|
25
|
+
loaderTimeout = setTimeout(
|
|
26
|
+
() => {
|
|
27
|
+
if (!$b.classList.contains('loader_active')) {
|
|
28
|
+
$b.classList.add('loader_active');
|
|
29
|
+
}
|
|
30
|
+
resolve();
|
|
31
|
+
},
|
|
32
|
+
delay === undefined ? window.__FORMIX__LOADER__DELAY || 500 : delay,
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const hide = (delay) => {
|
|
38
|
+
const $b = document.querySelector('.loader');
|
|
39
|
+
clearLoaderTimeout();
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
loaderTimeout = setTimeout(
|
|
42
|
+
() => {
|
|
43
|
+
if ($b.classList.contains('loader_active')) {
|
|
44
|
+
$b.classList.remove('loader_active');
|
|
45
|
+
}
|
|
46
|
+
resolve();
|
|
47
|
+
},
|
|
48
|
+
delay === undefined ? window.__FORMIX__LOADER__DELAY || 500 : delay,
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
window.showLoader = (delay) => {
|
|
54
|
+
show(delay);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
window.hideLoader = (delay) => {
|
|
58
|
+
hide(delay);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
window.addEventListener('pageshow', (event) => {
|
|
62
|
+
if (event.persisted && document.querySelector('.loader_active')) {
|
|
63
|
+
hide(0);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
@use '../../variables' as *;
|
|
2
|
+
|
|
3
|
+
@keyframes loader {
|
|
4
|
+
0% {
|
|
5
|
+
transform: scale(0);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
50% {
|
|
9
|
+
transform: scale(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
100% {
|
|
13
|
+
transform: scale(0);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
$b: '.loader';
|
|
18
|
+
|
|
19
|
+
#{$b} {
|
|
20
|
+
align-items: center;
|
|
21
|
+
background-color: $loader-bg;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
height: 100%;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
left: 0;
|
|
27
|
+
opacity: 0;
|
|
28
|
+
position: fixed;
|
|
29
|
+
top: 0;
|
|
30
|
+
transform: translateX(-100%);
|
|
31
|
+
transition-duration: var(--duration-leave-s);
|
|
32
|
+
transition-property: opacity;
|
|
33
|
+
transition-timing-function: var(--easing-acceleration);
|
|
34
|
+
width: 100%;
|
|
35
|
+
z-index: 1000;
|
|
36
|
+
|
|
37
|
+
&_active {
|
|
38
|
+
opacity: 1;
|
|
39
|
+
transform: translateX(0);
|
|
40
|
+
transition-duration: var(--duration-enter-s);
|
|
41
|
+
transition-timing-function: var(--easing-deceleration);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&__dots {
|
|
45
|
+
align-items: center;
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__dot {
|
|
50
|
+
animation-duration: 1000ms;
|
|
51
|
+
animation-fill-mode: both;
|
|
52
|
+
animation-iteration-count: infinite;
|
|
53
|
+
animation-name: loader;
|
|
54
|
+
animation-timing-function: var(--easing-standard);
|
|
55
|
+
background-color: $loader-color;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
height: 4px * 6;
|
|
58
|
+
width: 4px * 6;
|
|
59
|
+
|
|
60
|
+
@media (--tablet-landscape-up) {
|
|
61
|
+
height: 4px * 8;
|
|
62
|
+
width: 4px * 8;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&_1 {
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&_2 {
|
|
69
|
+
animation-delay: 100ms;
|
|
70
|
+
margin: 0 4px * 2;
|
|
71
|
+
|
|
72
|
+
@media (--tablet-landscape-up) {
|
|
73
|
+
margin: 0 4px * 3;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&_3 {
|
|
78
|
+
animation-delay: 200ms;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&__message {
|
|
83
|
+
color: $loader-label-color;
|
|
84
|
+
margin-left: 4px * 4;
|
|
85
|
+
margin-right: 4px * 4;
|
|
86
|
+
margin-top: 4px * 4;
|
|
87
|
+
text-align: center;
|
|
88
|
+
|
|
89
|
+
@include font($loader-label-mobile-font);
|
|
90
|
+
|
|
91
|
+
@media (--tablet-landscape-up) {
|
|
92
|
+
margin-left: 4px * 8;
|
|
93
|
+
margin-right: 4px * 8;
|
|
94
|
+
margin-top: 4px * 6;
|
|
95
|
+
|
|
96
|
+
@include font($loader-label-desktop-font);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { getScrollbarWidth } from '@advdominion/get-scrollbar-width';
|
|
2
|
+
|
|
3
|
+
import { mm } from '../../helpers/mm.js';
|
|
4
|
+
|
|
5
|
+
export const show = () => {
|
|
6
|
+
if (!document.querySelector('.overlay')) {
|
|
7
|
+
document.body.insertAdjacentHTML('beforeend', '<div class="overlay"></div>');
|
|
8
|
+
}
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
const overlay = document.querySelector('.overlay');
|
|
11
|
+
overlay.classList.add('overlay_active');
|
|
12
|
+
overlay.addEventListener(
|
|
13
|
+
'transitionend',
|
|
14
|
+
() => {
|
|
15
|
+
resolve();
|
|
16
|
+
},
|
|
17
|
+
{ once: true },
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const hide = () => {
|
|
23
|
+
return new Promise((resolve) => {
|
|
24
|
+
const overlay = document.querySelector('.overlay');
|
|
25
|
+
overlay.classList.remove('overlay_active');
|
|
26
|
+
overlay.addEventListener(
|
|
27
|
+
'transitionend',
|
|
28
|
+
() => {
|
|
29
|
+
resolve();
|
|
30
|
+
},
|
|
31
|
+
{ once: true },
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const defaultBlockingSelectors = ['.dialog', '.sidebar'];
|
|
37
|
+
|
|
38
|
+
export const disableScroll = () => {
|
|
39
|
+
const scrollbarWidth = getScrollbarWidth();
|
|
40
|
+
document.body.style = `
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
margin-right: ${scrollbarWidth}px;
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
if (mm('desktop-up') && window.__FORMIX__OVERLAY__FIXED_ELEMENTS?.length > 0) {
|
|
46
|
+
const fixedElements = [...document.querySelectorAll(window.__FORMIX__OVERLAY__FIXED_ELEMENTS.join(','))];
|
|
47
|
+
|
|
48
|
+
for (const element of fixedElements) {
|
|
49
|
+
element.style = `
|
|
50
|
+
width: calc(100% - ${scrollbarWidth}px);
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const enableScroll = () => {
|
|
57
|
+
const blockingSelements = [
|
|
58
|
+
...document.querySelectorAll(defaultBlockingSelectors.join(',')),
|
|
59
|
+
...(window.__FORMIX__OVERLAY__BLOCKING_ELEMENTS?.length > 0
|
|
60
|
+
? document.querySelectorAll(window.__FORMIX__OVERLAY__BLOCKING_ELEMENTS.join(','))
|
|
61
|
+
: []),
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const hasVisibleBlockingElements = blockingSelements.some((el) => !el.hidden);
|
|
65
|
+
|
|
66
|
+
if (!hasVisibleBlockingElements) {
|
|
67
|
+
document.body.style = `
|
|
68
|
+
overflow: '';
|
|
69
|
+
margin-right: '';
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
if (mm('desktop-up') && window.__FORMIX__OVERLAY__FIXED_ELEMENTS?.length > 0) {
|
|
73
|
+
const fixedElements = [...document.querySelectorAll(window.__FORMIX__OVERLAY__FIXED_ELEMENTS.join(','))];
|
|
74
|
+
|
|
75
|
+
for (const element of fixedElements) {
|
|
76
|
+
element.style = `
|
|
77
|
+
width: '';
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|