@formixru/b2b-ui 4.6.1 → 4.6.2
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,8 +1,7 @@
|
|
|
1
1
|
@use '../../variables' as *;
|
|
2
2
|
|
|
3
3
|
$b: '.sidebar';
|
|
4
|
-
|
|
5
|
-
$sidebarButtonSize: 56px;
|
|
4
|
+
$sidebar-button-size: 56px;
|
|
6
5
|
|
|
7
6
|
#{$b} {
|
|
8
7
|
display: flex;
|
|
@@ -44,7 +43,7 @@ $sidebarButtonSize: 56px;
|
|
|
44
43
|
display: flex;
|
|
45
44
|
flex-direction: column;
|
|
46
45
|
position: absolute;
|
|
47
|
-
right: calc(100% - $
|
|
46
|
+
right: calc(100% - $sidebar-button-size);
|
|
48
47
|
top: 0;
|
|
49
48
|
|
|
50
49
|
@media (--tablet-landscape-up) {
|
|
@@ -65,7 +64,7 @@ $sidebarButtonSize: 56px;
|
|
|
65
64
|
|
|
66
65
|
#{$b}_left & {
|
|
67
66
|
align-items: flex-start;
|
|
68
|
-
left: calc(100% - $
|
|
67
|
+
left: calc(100% - $sidebar-button-size);
|
|
69
68
|
right: auto;
|
|
70
69
|
|
|
71
70
|
@media (--tablet-landscape-up) {
|
|
@@ -91,12 +90,12 @@ $sidebarButtonSize: 56px;
|
|
|
91
90
|
background-color: $sidebar-disabled-button-bg;
|
|
92
91
|
color: $sidebar-disabled-button-color;
|
|
93
92
|
display: flex;
|
|
94
|
-
height: $
|
|
93
|
+
height: $sidebar-button-size;
|
|
95
94
|
justify-content: center;
|
|
96
95
|
transition-duration: var(--duration-micro-s);
|
|
97
96
|
transition-property: background-color, color;
|
|
98
97
|
transition-timing-function: var(--easing-standard);
|
|
99
|
-
width: $
|
|
98
|
+
width: $sidebar-button-size;
|
|
100
99
|
|
|
101
100
|
#{$b}_catalog & {
|
|
102
101
|
@media (--tablet-landscape-up) {
|
|
@@ -134,7 +133,7 @@ $sidebarButtonSize: 56px;
|
|
|
134
133
|
color: $sidebar-disabled-button-label-color;
|
|
135
134
|
height: auto;
|
|
136
135
|
justify-content: flex-start;
|
|
137
|
-
min-height: $
|
|
136
|
+
min-height: $sidebar-button-size;
|
|
138
137
|
min-width: 112px;
|
|
139
138
|
padding: 16px;
|
|
140
139
|
width: 100%;
|
|
@@ -183,7 +182,7 @@ $sidebarButtonSize: 56px;
|
|
|
183
182
|
height: 100%;
|
|
184
183
|
overflow: auto;
|
|
185
184
|
-webkit-overflow-scrolling: touch;
|
|
186
|
-
width: calc(100% - $
|
|
185
|
+
width: calc(100% - $sidebar-button-size);
|
|
187
186
|
|
|
188
187
|
@media (--tablet-landscape-up) {
|
|
189
188
|
width: 320px;
|
|
@@ -17,25 +17,14 @@ const setLeftWidth = async ($line, $el) => {
|
|
|
17
17
|
}).finished;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const setActive = ($el, active) => {
|
|
21
|
-
if ($el.tagName === 'BUTTON') {
|
|
22
|
-
$el.disabled = active;
|
|
23
|
-
} else if (active) {
|
|
24
|
-
$el.dataset.disabled = '';
|
|
25
|
-
} else {
|
|
26
|
-
delete $el.dataset.disabled;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
20
|
export const setInitLineStyles = ($b) => {
|
|
31
21
|
const $nav = $b.querySelector('.tabs__nav');
|
|
32
22
|
const $items = $nav.querySelectorAll('.tabs__item');
|
|
33
23
|
const $line = $nav.querySelector('.tabs__line');
|
|
34
24
|
|
|
35
|
-
const $el =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}) || $items[0];
|
|
25
|
+
const $el = [...$items].find((el) => {
|
|
26
|
+
return el.disabled || (el.tagName !== 'BUTTON' && !el.href);
|
|
27
|
+
});
|
|
39
28
|
|
|
40
29
|
setLeftWidth($line, $el);
|
|
41
30
|
// Прокручиваем до нужного таба
|
|
@@ -58,7 +47,7 @@ const changeTab = ($el) => {
|
|
|
58
47
|
const index = [...$items].indexOf($el);
|
|
59
48
|
|
|
60
49
|
for (const [i, $item] of $items.entries()) {
|
|
61
|
-
|
|
50
|
+
$item.disabled = i === index;
|
|
62
51
|
}
|
|
63
52
|
|
|
64
53
|
for (const [i, $c] of $content.entries()) {
|
|
@@ -89,28 +78,25 @@ export const init = async ($b) => {
|
|
|
89
78
|
const handleItemClick = async (e) => {
|
|
90
79
|
const $el = e.currentTarget;
|
|
91
80
|
const index = [...$items].indexOf($el);
|
|
81
|
+
if ($el.tagName === 'BUTTON') {
|
|
82
|
+
if ($el.dataset.tabsFetch && $content[index].innerHTML.trim() === '') {
|
|
83
|
+
const { content } = await request({ url: $el.dataset.tabsFetch });
|
|
84
|
+
// Вставляем полученный HTML
|
|
85
|
+
$content[index].innerHTML = content;
|
|
86
|
+
// Переключаем таб
|
|
87
|
+
changeTab($el);
|
|
88
|
+
} else {
|
|
89
|
+
// Переключаем таб
|
|
90
|
+
changeTab($el);
|
|
91
|
+
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if ($el.dataset.tabsFetch && $content[index].innerHTML.trim() === '') {
|
|
98
|
-
const { content } = await request({ url: $el.dataset.tabsFetch });
|
|
99
|
-
// Вставляем полученный HTML
|
|
100
|
-
$content[index].innerHTML = content;
|
|
101
|
-
// Переключаем таб
|
|
102
|
-
changeTab($el);
|
|
103
|
-
} else {
|
|
104
|
-
// Переключаем таб
|
|
105
|
-
changeTab($el);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if ($nav.swiper) {
|
|
109
|
-
$nav.swiper.slideTo(index);
|
|
110
|
-
}
|
|
93
|
+
if ($nav.swiper) {
|
|
94
|
+
$nav.swiper.slideTo(index);
|
|
95
|
+
}
|
|
111
96
|
|
|
112
|
-
|
|
113
|
-
|
|
97
|
+
if ($line) {
|
|
98
|
+
setLeftWidth($line, $el);
|
|
99
|
+
}
|
|
114
100
|
}
|
|
115
101
|
};
|
|
116
102
|
|