@jetbrains/kotlin-web-site-ui 4.2.0 → 4.3.0-alpha.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/out/components/footer/index.css +6 -3
- package/out/components/header/full-search/full-search.js +8 -1
- package/out/components/header/header.js +7 -16
- package/out/components/header/index.css +117 -67
- package/out/components/header/index.js +1 -1
- package/out/components/header/logo-small/kotlin-logo-small.svg.js +18 -16
- package/out/components/header/logo-small/logo-small.js +1 -1
- package/out/components/header/menu-popup/menu-button/menu-button.js +8 -5
- package/out/components/header/menu-popup/menu-list/menu-list.js +33 -0
- package/out/components/header/menu-popup/menu-list/menu-list.module.pcss.js +4 -0
- package/out/components/header/menu-popup/menu-list-item/menu-list-item.js +28 -0
- package/out/components/header/menu-popup/menu-list-item/menu-list-item.module.pcss.js +7 -0
- package/out/components/header/menu-popup/menu-popup.js +2 -42
- package/out/components/header/menu-popup/menu-popup.module.pcss.js +0 -4
- package/out/components/header/nav-scheme.js +9 -3
- package/out/components/header/search-button/search-button.js +13 -2
- package/out/components/header/search-button/search-button.module.pcss.js +2 -1
- package/out/components/top-menu/index.css +91 -124
- package/out/components/top-menu/top-menu.js +20 -13
- package/out/components/top-menu/{dropdown-menu → vertical-menu}/arrow-dropdown-icon.svg.js +0 -0
- package/out/components/top-menu/vertical-menu/vertical-menu.js +123 -0
- package/out/components/top-menu/vertical-menu/vertical-menu.module.pcss.js +13 -0
- package/out/components/typography/index.css +2 -1
- package/out/components/youtube-player/index.css +2 -1
- package/package.json +1 -1
- package/out/components/header/menu-popup/menu-button/close-icon.svg.js +0 -35
- package/out/components/header/menu-popup/menu-button/hamburger-icon.svg.js +0 -35
- package/out/components/top-menu/dropdown-menu/dropdown-menu.js +0 -71
- package/out/components/top-menu/dropdown-menu/dropdown-menu.module.pcss.js +0 -15
|
@@ -2,13 +2,15 @@ import React__default from 'react';
|
|
|
2
2
|
import styles from './search-button.module.pcss.js';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import SvgSearch from './search.svg.js';
|
|
5
|
+
import { SearchIcon } from '@rescui/icons';
|
|
6
|
+
import Button from '@rescui/button';
|
|
5
7
|
const DATA_TEST_HEADER_SEARCH_BUTTON = 'header-search-button';
|
|
6
8
|
|
|
7
9
|
const SearchButton = ({
|
|
8
10
|
onClick,
|
|
9
11
|
isActive
|
|
10
12
|
}) => {
|
|
11
|
-
return React__default.createElement("button", {
|
|
13
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("button", {
|
|
12
14
|
type: "button",
|
|
13
15
|
className: classNames(styles.button, {
|
|
14
16
|
[styles.active]: isActive
|
|
@@ -16,7 +18,16 @@ const SearchButton = ({
|
|
|
16
18
|
"data-test": DATA_TEST_HEADER_SEARCH_BUTTON,
|
|
17
19
|
"aria-label": "Search",
|
|
18
20
|
onClick: onClick
|
|
19
|
-
}, React__default.createElement(SvgSearch, null))
|
|
21
|
+
}, React__default.createElement(SvgSearch, null)), React__default.createElement("div", {
|
|
22
|
+
className: styles.mobileButton
|
|
23
|
+
}, React__default.createElement(Button, {
|
|
24
|
+
"data-test": DATA_TEST_HEADER_SEARCH_BUTTON,
|
|
25
|
+
"aria-label": "Search",
|
|
26
|
+
onClick: onClick,
|
|
27
|
+
mode: 'clear',
|
|
28
|
+
size: 'l',
|
|
29
|
+
icon: React__default.createElement(SearchIcon, null)
|
|
30
|
+
})));
|
|
20
31
|
};
|
|
21
32
|
|
|
22
33
|
export { DATA_TEST_HEADER_SEARCH_BUTTON, SearchButton };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var styles = {
|
|
2
2
|
"button": "ktl-search-button-module_button_YHJPv",
|
|
3
|
-
"active": "ktl-search-button-module_active_lUmdh"
|
|
3
|
+
"active": "ktl-search-button-module_active_lUmdh",
|
|
4
|
+
"mobileButton": "ktl-search-button-module_mobileButton_KT2YP"
|
|
4
5
|
};
|
|
5
6
|
export { styles as default };
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
--ktl-overlay-z-index: 900;
|
|
14
14
|
--ktl-top-menu-z-index: 905;
|
|
15
15
|
--ktl-header-z-index: 906;
|
|
16
|
-
--ktl-
|
|
16
|
+
--ktl-mobile-dropdown-list-z-index: 907;
|
|
17
|
+
--ktl-header-height-mobile: 52px;
|
|
17
18
|
--ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
18
19
|
--rs-font-family-ui: var(--ktl-font-family-inter);
|
|
19
20
|
}
|
|
@@ -29,15 +30,14 @@
|
|
|
29
30
|
height: 64px;
|
|
30
31
|
background: #ffffff;
|
|
31
32
|
padding: 0 32px;
|
|
32
|
-
|
|
33
|
-
box-shadow: inset 0 -1px 0 0 var(--ktl-light-dark-20);
|
|
33
|
+
box-shadow: inset 0 -1px 0 0 rgba(255, 255, 255, 0.3);
|
|
34
34
|
transition: color var(--ktl-transition-fast),
|
|
35
35
|
background-color var(--ktl-transition-fast);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.ktl-top-menu-module_top-menu-dark-theme_aNBxr {
|
|
39
39
|
background: #1b1b1b;
|
|
40
|
-
box-shadow: inset 0 -1px 0 0 rgba(255, 255, 255, 0.
|
|
40
|
+
box-shadow: inset 0 -1px 0 0 rgba(255, 255, 255, 0.3);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.ktl-top-menu-module_logo_CNH2W {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
@media (max-width: 640px) {
|
|
50
50
|
.ktl-top-menu-module_top-menu_PRX9X {
|
|
51
|
-
height:
|
|
51
|
+
height: var(--ktl-header-height-mobile);
|
|
52
52
|
padding: 0 16px;
|
|
53
53
|
grid-gap: 16px;
|
|
54
54
|
grid-template-columns: 1fr auto;
|
|
@@ -75,12 +75,6 @@
|
|
|
75
75
|
color: var(--ktl-color-primary-light-theme);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
@media (max-width: 640px) {
|
|
79
|
-
.ktl-horizontal-menu-module_horizontal-menu_pB2-S {
|
|
80
|
-
display: none;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
78
|
:root {
|
|
85
79
|
--ktl-light-grey: #f4f4f4;
|
|
86
80
|
--ktl-dark-100: rgba(39, 40, 44, 1);
|
|
@@ -96,140 +90,113 @@
|
|
|
96
90
|
--ktl-overlay-z-index: 900;
|
|
97
91
|
--ktl-top-menu-z-index: 905;
|
|
98
92
|
--ktl-header-z-index: 906;
|
|
99
|
-
--ktl-
|
|
93
|
+
--ktl-mobile-dropdown-list-z-index: 907;
|
|
94
|
+
--ktl-header-height-mobile: 52px;
|
|
100
95
|
--ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
101
96
|
--rs-font-family-ui: var(--ktl-font-family-inter);
|
|
102
97
|
}
|
|
103
98
|
|
|
104
|
-
.ktl-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
.ktl-dropdown-menu-module_button-text_SJmh- {
|
|
127
|
-
overflow: hidden;
|
|
128
|
-
text-overflow: ellipsis;
|
|
129
|
-
flex: 0 1 auto;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.ktl-dropdown-menu-module_icon_GGhMI {
|
|
133
|
-
width: 12px;
|
|
134
|
-
height: 6px;
|
|
135
|
-
margin-left: 6px;
|
|
136
|
-
transition: transform ease-in-out var(--ktl-transition-xfast);
|
|
137
|
-
flex: 0 0 auto;
|
|
99
|
+
.ktl-vertical-menu-module_vertical-menu_aLIbw {
|
|
100
|
+
display: block;
|
|
101
|
+
height: 100%;
|
|
102
|
+
justify-self: flex-start;
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
width: 100%;
|
|
105
|
+
min-width: 0;
|
|
106
|
+
max-width: 100%;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.ktl-vertical-menu-module_button_zqr20 {
|
|
110
|
+
border: none;
|
|
111
|
+
background: none;
|
|
112
|
+
height: 52px;
|
|
113
|
+
width: 100%;
|
|
114
|
+
max-width: 100%;
|
|
115
|
+
padding: 0;
|
|
116
|
+
margin: 0;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
color: #fff;
|
|
138
121
|
}
|
|
139
122
|
|
|
140
|
-
.ktl-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
right: 0;
|
|
145
|
-
background: #ffffff;
|
|
146
|
-
opacity: 0;
|
|
147
|
-
-webkit-animation: ktl-dropdown-menu-module_fadein_MySnq ease-out var(--ktl-transition-fast) forwards;
|
|
148
|
-
animation: ktl-dropdown-menu-module_fadein_MySnq ease-out var(--ktl-transition-fast) forwards;
|
|
123
|
+
.ktl-vertical-menu-module_button-text_aXith {
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
text-overflow: ellipsis;
|
|
126
|
+
flex: 0 1 auto;
|
|
149
127
|
}
|
|
150
128
|
|
|
151
|
-
.ktl-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
129
|
+
.ktl-vertical-menu-module_icon_-Ieat {
|
|
130
|
+
width: 14px;
|
|
131
|
+
height: 8px;
|
|
132
|
+
margin-left: 13px;
|
|
133
|
+
transition: transform ease-in-out var(--ktl-transition-xfast);
|
|
134
|
+
flex: 0 0 auto;
|
|
156
135
|
}
|
|
157
136
|
|
|
158
|
-
.ktl-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
.ktl-dropdown-menu-module_dropdown-item_X3tZ-.ktl-dropdown-menu-module_dropdown-item-active_99q9X {
|
|
164
|
-
background: var(--ktl-dark-100);
|
|
137
|
+
.ktl-vertical-menu-module_dropdown-header_77lTy {
|
|
138
|
+
/* workaround */
|
|
139
|
+
margin-top: calc(var(--ktl-header-height-mobile) * -1);
|
|
140
|
+
display: flex;
|
|
165
141
|
color: #ffffff;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
left: 0;
|
|
175
|
-
width: 100%;
|
|
176
|
-
height: 100%;
|
|
177
|
-
opacity: 0;
|
|
178
|
-
background-color: var(--ktl-color-dark-40);
|
|
179
|
-
z-index: var(--ktl-overlay-z-index);
|
|
180
|
-
-webkit-animation: ktl-dropdown-menu-module_fadein_MySnq ease-out var(--ktl-transition-fast) forwards;
|
|
181
|
-
animation: ktl-dropdown-menu-module_fadein_MySnq ease-out var(--ktl-transition-fast) forwards;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.ktl-dropdown-menu-module_overlay-visible_MjwEF {
|
|
185
|
-
display: block;
|
|
186
|
-
opacity: 1;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.ktl-dropdown-menu-module_dropdown-menu-expanded_EQefy .ktl-dropdown-menu-module_icon_GGhMI {
|
|
190
|
-
transform: scale(1, -1);
|
|
191
|
-
}
|
|
142
|
+
align-items: center;
|
|
143
|
+
height: var(--ktl-header-height-mobile);
|
|
144
|
+
padding: 0 0 0 16px;
|
|
145
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
|
|
146
|
+
justify-content: space-between;
|
|
147
|
+
background: #ffffff;
|
|
148
|
+
margin-bottom: 8px;
|
|
149
|
+
}
|
|
192
150
|
|
|
193
|
-
.ktl-
|
|
151
|
+
.ktl-vertical-menu-module_dropdown-list_N3KWV {
|
|
194
152
|
display: flex;
|
|
195
153
|
flex-direction: column;
|
|
196
154
|
opacity: 1;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
155
|
+
position: fixed;
|
|
156
|
+
top: 0;
|
|
157
|
+
left: 0;
|
|
158
|
+
right: 0;
|
|
159
|
+
bottom: 0;
|
|
160
|
+
background: #ffffff;
|
|
161
|
+
z-index: var(--ktl-mobile-dropdown-list-z-index);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.ktl-vertical-menu-module_dropdown-item_XLfp4 {
|
|
165
|
+
padding: 12px 16px;
|
|
166
|
+
text-decoration: none;
|
|
167
|
+
transition: color var(--ktl-transition-xfast),
|
|
168
|
+
background-color var(--ktl-transition-xfast);
|
|
201
169
|
}
|
|
202
170
|
|
|
203
|
-
.ktl-
|
|
204
|
-
|
|
205
|
-
|
|
171
|
+
.ktl-vertical-menu-module_dropdown-item_XLfp4:hover {
|
|
172
|
+
background: rgba(39, 40, 44, 0.1);
|
|
173
|
+
color: #27282c;
|
|
206
174
|
}
|
|
207
175
|
|
|
208
|
-
.ktl-
|
|
209
|
-
|
|
210
|
-
|
|
176
|
+
.ktl-vertical-menu-module_dropdown-item_XLfp4.ktl-vertical-menu-module_dropdown-item-active_iBUbj {
|
|
177
|
+
background: var(--ktl-dark-100);
|
|
178
|
+
color: #ffffff;
|
|
211
179
|
}
|
|
212
180
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
}
|
|
181
|
+
.ktl-vertical-menu-module_vertical-menu-expanded_kFaaI .ktl-vertical-menu-module_icon_-Ieat {
|
|
182
|
+
transform: scale(1, -1);
|
|
183
|
+
}
|
|
218
184
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
opacity: 0;
|
|
222
|
-
}
|
|
223
|
-
100% {
|
|
224
|
-
opacity: 1;
|
|
225
|
-
}
|
|
185
|
+
.ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw {
|
|
186
|
+
background: rgba(39, 40, 44, 1);
|
|
226
187
|
}
|
|
227
188
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
189
|
+
.ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw .ktl-vertical-menu-module_dropdown-header_77lTy {
|
|
190
|
+
background: rgba(39, 40, 44, 1);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw .ktl-vertical-menu-module_dropdown-item_XLfp4:hover {
|
|
194
|
+
background: rgba(255, 255, 255, 0.1);
|
|
195
|
+
color: #ffffff;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw .ktl-vertical-menu-module_dropdown-item_XLfp4.ktl-vertical-menu-module_dropdown-item-active_iBUbj {
|
|
199
|
+
color: var(--ktl-light-text-hard);
|
|
200
|
+
background: #ffffff;
|
|
201
|
+
}
|
|
202
|
+
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
1
|
+
import React__default, { forwardRef, useRef, useImperativeHandle, useState, useLayoutEffect } from 'react';
|
|
2
2
|
import { useTheme } from '@rescui/ui-contexts';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import styles from './top-menu.module.pcss.js';
|
|
5
5
|
import { useTextStyles } from '@rescui/typography';
|
|
6
6
|
import { HorizontalMenu } from './horizontal-menu/horizontal-menu.js';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const
|
|
7
|
+
import { VerticalMenu } from './vertical-menu/vertical-menu.js';
|
|
8
|
+
import useResizeObserver from '@react-hook/resize-observer';
|
|
9
|
+
const BREAKPOINT_XS = 640;
|
|
10
|
+
const TopMenu = forwardRef(({
|
|
10
11
|
homeUrl,
|
|
11
12
|
title,
|
|
12
13
|
mobileTitle,
|
|
@@ -15,33 +16,39 @@ const TopMenu = ({
|
|
|
15
16
|
linkHandler = () => {},
|
|
16
17
|
className,
|
|
17
18
|
children,
|
|
18
|
-
forwardedRef,
|
|
19
19
|
mobileOverview
|
|
20
|
-
}) => {
|
|
20
|
+
}, forwardedRef) => {
|
|
21
21
|
const theme = useTheme();
|
|
22
22
|
const textCn = useTextStyles();
|
|
23
|
+
const menuRef = useRef(null);
|
|
24
|
+
useImperativeHandle(forwardedRef, () => menuRef.current);
|
|
25
|
+
const [isMobileMenuVisible, setMobileMenuVisible] = useState(false);
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
setMobileMenuVisible((menuRef.current?.getBoundingClientRect?.().width ?? 0) <= BREAKPOINT_XS);
|
|
28
|
+
}, [menuRef]);
|
|
29
|
+
useResizeObserver(menuRef, entry => setMobileMenuVisible(entry.contentRect.width <= BREAKPOINT_XS));
|
|
23
30
|
return React__default.createElement("div", {
|
|
31
|
+
ref: menuRef,
|
|
24
32
|
className: classNames(styles.topMenu, className, {
|
|
25
33
|
[styles.topMenuDarkTheme]: theme === 'dark'
|
|
26
|
-
})
|
|
27
|
-
ref: forwardedRef
|
|
34
|
+
})
|
|
28
35
|
}, React__default.createElement("a", {
|
|
29
36
|
href: homeUrl,
|
|
30
37
|
className: classNames(styles.logo, textCn('rs-h3')),
|
|
31
38
|
onClick: event => linkHandler(event, homeUrl)
|
|
32
|
-
}, title), React__default.createElement(
|
|
39
|
+
}, title), isMobileMenuVisible ? React__default.createElement(VerticalMenu, {
|
|
33
40
|
items: items,
|
|
34
41
|
activeIndex: activeIndex,
|
|
35
42
|
linkHandler: linkHandler,
|
|
36
43
|
title: title,
|
|
37
44
|
mobileTitle: mobileTitle,
|
|
38
45
|
homeUrl: homeUrl,
|
|
39
|
-
mobileOverview: mobileOverview
|
|
40
|
-
|
|
46
|
+
mobileOverview: mobileOverview,
|
|
47
|
+
topMenuRef: menuRef
|
|
48
|
+
}) : React__default.createElement(HorizontalMenu, {
|
|
41
49
|
items: items,
|
|
42
50
|
activeIndex: activeIndex,
|
|
43
51
|
linkHandler: linkHandler
|
|
44
52
|
}), children);
|
|
45
|
-
};
|
|
46
|
-
|
|
53
|
+
});
|
|
47
54
|
export { TopMenu };
|
|
File without changes
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React__default, { useState, useCallback, useEffect, useRef, useLayoutEffect } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import styles from './vertical-menu.module.pcss.js';
|
|
4
|
+
import { useTextStyles } from '@rescui/typography';
|
|
5
|
+
import SvgArrowDropdownIcon from './arrow-dropdown-icon.svg.js';
|
|
6
|
+
import { useTheme } from '@rescui/ui-contexts';
|
|
7
|
+
import Button from '@rescui/button';
|
|
8
|
+
import { CloseIcon } from '@rescui/icons';
|
|
9
|
+
import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
|
|
10
|
+
import { createPortal } from 'react-dom';
|
|
11
|
+
|
|
12
|
+
const VerticalMenu = ({
|
|
13
|
+
homeUrl,
|
|
14
|
+
title,
|
|
15
|
+
mobileTitle = 'Overview',
|
|
16
|
+
items,
|
|
17
|
+
activeIndex,
|
|
18
|
+
linkHandler,
|
|
19
|
+
mobileOverview = true,
|
|
20
|
+
topMenuRef
|
|
21
|
+
}) => {
|
|
22
|
+
const textCn = useTextStyles();
|
|
23
|
+
|
|
24
|
+
let _items = (mobileOverview ? [{
|
|
25
|
+
title: mobileTitle,
|
|
26
|
+
url: homeUrl
|
|
27
|
+
}] : []).concat(items);
|
|
28
|
+
|
|
29
|
+
const _activeIndex = mobileOverview ? activeIndex + 1 : activeIndex;
|
|
30
|
+
|
|
31
|
+
const activeItem = _items[_activeIndex];
|
|
32
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
33
|
+
const [portalRoot, setPortalRoot] = useState(null);
|
|
34
|
+
const handleOpen = useCallback(() => {
|
|
35
|
+
setIsExpanded(true);
|
|
36
|
+
}, []);
|
|
37
|
+
const handleClose = useCallback(() => {
|
|
38
|
+
setIsExpanded(false);
|
|
39
|
+
}, []);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (typeof document !== `undefined`) {
|
|
42
|
+
setPortalRoot(document.body);
|
|
43
|
+
}
|
|
44
|
+
}, []);
|
|
45
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
46
|
+
className: classNames(styles.dropdownMenu, {
|
|
47
|
+
[styles.dropdownMenuExpanded]: isExpanded
|
|
48
|
+
})
|
|
49
|
+
}, React__default.createElement("button", {
|
|
50
|
+
className: classNames(styles.button),
|
|
51
|
+
"aria-haspopup": "true",
|
|
52
|
+
onClick: handleOpen
|
|
53
|
+
}, React__default.createElement("span", {
|
|
54
|
+
className: textCn('rs-text-2', {
|
|
55
|
+
hardness: 'hard'
|
|
56
|
+
})
|
|
57
|
+
}, activeItem.title), React__default.createElement(SvgArrowDropdownIcon, {
|
|
58
|
+
className: styles.icon
|
|
59
|
+
})), !!portalRoot && isExpanded && createPortal(React__default.createElement(VerticalMenuDropDown, {
|
|
60
|
+
title: title,
|
|
61
|
+
activeIndex: _activeIndex,
|
|
62
|
+
items: _items,
|
|
63
|
+
onClose: handleClose,
|
|
64
|
+
linkHandler: linkHandler,
|
|
65
|
+
topMenuRef: topMenuRef
|
|
66
|
+
}), portalRoot)));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const VerticalMenuDropDown = ({
|
|
70
|
+
title,
|
|
71
|
+
onClose,
|
|
72
|
+
items,
|
|
73
|
+
linkHandler,
|
|
74
|
+
activeIndex,
|
|
75
|
+
topMenuRef
|
|
76
|
+
}) => {
|
|
77
|
+
const textCn = useTextStyles();
|
|
78
|
+
const theme = useTheme();
|
|
79
|
+
const navRef = useRef(null);
|
|
80
|
+
const [navStyle, setNavStyle] = useState({});
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (navRef.current) {
|
|
83
|
+
disableBodyScroll(navRef.current);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return clearAllBodyScrollLocks;
|
|
87
|
+
}, []);
|
|
88
|
+
useLayoutEffect(() => {
|
|
89
|
+
if (topMenuRef.current) {
|
|
90
|
+
setNavStyle({
|
|
91
|
+
top: topMenuRef.current.getBoundingClientRect().top
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}, [topMenuRef]);
|
|
95
|
+
return React__default.createElement("nav", {
|
|
96
|
+
ref: navRef,
|
|
97
|
+
style: navStyle,
|
|
98
|
+
className: classNames(styles.dropdownList, {
|
|
99
|
+
[styles.dropdownListDarkTheme]: theme === 'dark'
|
|
100
|
+
})
|
|
101
|
+
}, React__default.createElement("div", {
|
|
102
|
+
className: styles.dropdownHeader
|
|
103
|
+
}, React__default.createElement("div", {
|
|
104
|
+
className: textCn('rs-text-2')
|
|
105
|
+
}, title), React__default.createElement(Button, {
|
|
106
|
+
mode: 'clear',
|
|
107
|
+
size: 'l',
|
|
108
|
+
icon: React__default.createElement(CloseIcon, null),
|
|
109
|
+
onClick: onClose
|
|
110
|
+
})), items.map((item, index) => React__default.createElement("a", {
|
|
111
|
+
key: item.url,
|
|
112
|
+
href: item.url,
|
|
113
|
+
className: classNames(styles.dropdownItem, textCn('rs-text-1', {
|
|
114
|
+
hardness: 'hard'
|
|
115
|
+
}), {
|
|
116
|
+
[styles.dropdownItemActive]: index === activeIndex
|
|
117
|
+
}),
|
|
118
|
+
onClick: event => linkHandler?.(event, item.url),
|
|
119
|
+
target: item.isExternal ? '_blank' : undefined
|
|
120
|
+
}, item.title)));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export { VerticalMenu };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
"verticalMenu": "ktl-vertical-menu-module_vertical-menu_aLIbw",
|
|
3
|
+
"button": "ktl-vertical-menu-module_button_zqr20",
|
|
4
|
+
"buttonText": "ktl-vertical-menu-module_button-text_aXith",
|
|
5
|
+
"icon": "ktl-vertical-menu-module_icon_-Ieat",
|
|
6
|
+
"dropdownHeader": "ktl-vertical-menu-module_dropdown-header_77lTy",
|
|
7
|
+
"dropdownList": "ktl-vertical-menu-module_dropdown-list_N3KWV",
|
|
8
|
+
"dropdownItem": "ktl-vertical-menu-module_dropdown-item_XLfp4",
|
|
9
|
+
"dropdownItemActive": "ktl-vertical-menu-module_dropdown-item-active_iBUbj",
|
|
10
|
+
"verticalMenuExpanded": "ktl-vertical-menu-module_vertical-menu-expanded_kFaaI",
|
|
11
|
+
"dropdownListDarkTheme": "ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw"
|
|
12
|
+
};
|
|
13
|
+
export { styles as default };
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
--ktl-overlay-z-index: 900;
|
|
14
14
|
--ktl-top-menu-z-index: 905;
|
|
15
15
|
--ktl-header-z-index: 906;
|
|
16
|
-
--ktl-
|
|
16
|
+
--ktl-mobile-dropdown-list-z-index: 907;
|
|
17
|
+
--ktl-header-height-mobile: 52px;
|
|
17
18
|
--ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
18
19
|
--rs-font-family-ui: var(--ktl-font-family-inter);
|
|
19
20
|
}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
--ktl-overlay-z-index: 900;
|
|
14
14
|
--ktl-top-menu-z-index: 905;
|
|
15
15
|
--ktl-header-z-index: 906;
|
|
16
|
-
--ktl-
|
|
16
|
+
--ktl-mobile-dropdown-list-z-index: 907;
|
|
17
|
+
--ktl-header-height-mobile: 52px;
|
|
17
18
|
--ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
18
19
|
--rs-font-family-ui: var(--ktl-font-family-inter);
|
|
19
20
|
}
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
var _path;
|
|
4
|
-
|
|
5
|
-
function _extends() {
|
|
6
|
-
_extends = Object.assign || function (target) {
|
|
7
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
8
|
-
var source = arguments[i];
|
|
9
|
-
|
|
10
|
-
for (var key in source) {
|
|
11
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
-
target[key] = source[key];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return target;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return _extends.apply(this, arguments);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const SvgCloseIcon = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
24
|
-
width: 16,
|
|
25
|
-
height: 16,
|
|
26
|
-
fill: "none",
|
|
27
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
28
|
-
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
29
|
-
fillRule: "evenodd",
|
|
30
|
-
clipRule: "evenodd",
|
|
31
|
-
d: "M15.707 1.707 14.293.293 8 6.586 1.707.293.293 1.707 6.586 8 .293 14.293l1.414 1.414L8 9.414l6.293 6.293 1.414-1.414L9.414 8l6.293-6.293Z",
|
|
32
|
-
fill: "currentColor"
|
|
33
|
-
})));
|
|
34
|
-
|
|
35
|
-
export { SvgCloseIcon as default };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
var _path;
|
|
4
|
-
|
|
5
|
-
function _extends() {
|
|
6
|
-
_extends = Object.assign || function (target) {
|
|
7
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
8
|
-
var source = arguments[i];
|
|
9
|
-
|
|
10
|
-
for (var key in source) {
|
|
11
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
-
target[key] = source[key];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return target;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return _extends.apply(this, arguments);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const SvgHamburgerIcon = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
24
|
-
width: 24,
|
|
25
|
-
height: 24,
|
|
26
|
-
fill: "none",
|
|
27
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
28
|
-
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
29
|
-
fillRule: "evenodd",
|
|
30
|
-
clipRule: "evenodd",
|
|
31
|
-
d: "M4 5h16v2H4V5Zm0 6h16v2H4v-2Zm16 6H4v2h16v-2Z",
|
|
32
|
-
fill: "currentColor"
|
|
33
|
-
})));
|
|
34
|
-
|
|
35
|
-
export { SvgHamburgerIcon as default };
|