@jetbrains/kotlin-web-site-ui 4.2.0-alpha.4 → 4.2.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.
Files changed (33) hide show
  1. package/out/components/footer/index.css +3 -6
  2. package/out/components/header/full-search/full-search.js +1 -8
  3. package/out/components/header/header.js +31 -13
  4. package/out/components/header/index.css +84 -120
  5. package/out/components/header/index.js +1 -1
  6. package/out/components/header/logo-small/logo-small.js +1 -1
  7. package/out/components/header/menu-popup/menu-button/close-icon.svg.js +35 -0
  8. package/out/components/header/menu-popup/menu-button/hamburger-icon.svg.js +35 -0
  9. package/out/components/header/menu-popup/menu-button/menu-button.js +5 -8
  10. package/out/components/header/menu-popup/menu-popup.js +42 -2
  11. package/out/components/header/menu-popup/menu-popup.module.pcss.js +4 -0
  12. package/out/components/header/nav-scheme.js +3 -9
  13. package/out/components/header/quick-search/list/list.js +5 -3
  14. package/out/components/header/quick-search/quick-search.js +12 -5
  15. package/out/components/header/quick-search/quick-search.module.pcss.js +2 -1
  16. package/out/components/header/quick-search/result/result.js +1 -1
  17. package/out/components/header/search-box/search-box.js +5 -3
  18. package/out/components/header/search-button/search-button.js +2 -13
  19. package/out/components/header/search-button/search-button.module.pcss.js +1 -2
  20. package/out/components/top-menu/{vertical-menu → dropdown-menu}/arrow-dropdown-icon.svg.js +0 -0
  21. package/out/components/top-menu/dropdown-menu/dropdown-menu.js +71 -0
  22. package/out/components/top-menu/dropdown-menu/dropdown-menu.module.pcss.js +15 -0
  23. package/out/components/top-menu/index.css +122 -87
  24. package/out/components/top-menu/top-menu.js +13 -20
  25. package/out/components/typography/index.css +1 -2
  26. package/out/components/youtube-player/index.css +1 -2
  27. package/package.json +2 -2
  28. package/out/components/header/menu-popup/menu-list/menu-list.js +0 -33
  29. package/out/components/header/menu-popup/menu-list/menu-list.module.pcss.js +0 -4
  30. package/out/components/header/menu-popup/menu-list-item/menu-list-item.js +0 -28
  31. package/out/components/header/menu-popup/menu-list-item/menu-list-item.module.pcss.js +0 -7
  32. package/out/components/top-menu/vertical-menu/vertical-menu.js +0 -119
  33. package/out/components/top-menu/vertical-menu/vertical-menu.module.pcss.js +0 -13
@@ -4,17 +4,19 @@ import { useTextStyles } from '@rescui/typography';
4
4
  import classNames from 'classnames';
5
5
  import { isMacOs } from '../../is-macos.js';
6
6
  import styles from './list.module.pcss.js';
7
+ import { SearchResultView } from '../../header.js';
7
8
 
8
9
  const ResultsList = ({
9
10
  results,
10
11
  searchString,
11
- toggleFullSearch
12
+ toggleFullSearch,
13
+ resultListViewType
12
14
  }) => {
13
15
  const textCn = useTextStyles();
14
16
  return React__default.createElement("div", {
15
- className: styles.results,
17
+ className: classNames(styles.results),
16
18
  "data-test": 'quick-search-results'
17
- }, results.length ? React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
19
+ }, results.length ? React__default.createElement(React__default.Fragment, null, resultListViewType === SearchResultView.Narrow && React__default.createElement("div", {
18
20
  className: styles.topBar
19
21
  }, React__default.createElement("div", {
20
22
  className: classNames(textCn('rs-text-3'), styles.searchString)
@@ -1,5 +1,6 @@
1
1
  import React__default from 'react';
2
2
  import { ThemeProvider } from '@rescui/ui-contexts';
3
+ import classNames from 'classnames';
3
4
  import { ResultsList } from './list/list.js';
4
5
  import { EmptyResult } from './empty/empty.js';
5
6
  import { LoadingResults } from './loading/loading.js';
@@ -9,13 +10,18 @@ const QuickSearch = ({
9
10
  results,
10
11
  searchString,
11
12
  toggleFullSearch,
12
- placeholder
13
+ placeholder,
14
+ quickSearchBoxViewType
13
15
  }) => {
16
+ const wrapperClassName = classNames(styles.wrapper, {
17
+ [styles.apiReferenceWrapper]: quickSearchBoxViewType
18
+ });
19
+
14
20
  if (placeholder) {
15
21
  return React__default.createElement(ThemeProvider, {
16
22
  theme: 'dark'
17
23
  }, React__default.createElement("div", {
18
- className: styles.wrapper
24
+ className: wrapperClassName
19
25
  }, React__default.createElement(EmptyResult, {
20
26
  placeholder: placeholder
21
27
  })));
@@ -25,16 +31,17 @@ const QuickSearch = ({
25
31
  return React__default.createElement(ThemeProvider, {
26
32
  theme: 'dark'
27
33
  }, React__default.createElement("div", {
28
- className: styles.wrapper
34
+ className: wrapperClassName
29
35
  }, React__default.createElement(ResultsList, {
30
36
  results: results,
31
37
  searchString: searchString,
32
- toggleFullSearch: toggleFullSearch
38
+ toggleFullSearch: toggleFullSearch,
39
+ resultListViewType: quickSearchBoxViewType
33
40
  })));
34
41
  }
35
42
 
36
43
  return React__default.createElement("div", {
37
- className: styles.wrapper
44
+ className: wrapperClassName
38
45
  }, React__default.createElement(LoadingResults, null));
39
46
  };
40
47
 
@@ -1,4 +1,5 @@
1
1
  var styles = {
2
- "wrapper": "ktl-quick-search-module_wrapper_kkbQQ"
2
+ "wrapper": "ktl-quick-search-module_wrapper_kkbQQ",
3
+ "apiReferenceWrapper": "ktl-quick-search-module_apiReferenceWrapper_jv98t"
3
4
  };
4
5
  export { styles as default };
@@ -6,7 +6,7 @@ const Result = ({
6
6
  hit
7
7
  }) => {
8
8
  const textCn = useTextStyles();
9
- const hitTitle = hit.title === hit.mainTitle ? hit.highlightedTitle : `${hit.mainTitle}: ${hit.highlightedTitle}`;
9
+ const hitTitle = !hit.mainTitle || hit.title === hit.mainTitle ? hit.highlightedTitle : `${hit.mainTitle}: ${hit.highlightedTitle}`;
10
10
  return React__default.createElement("a", {
11
11
  className: styles.result,
12
12
  href: hit.url
@@ -11,13 +11,14 @@ const SearchBox = ({
11
11
  closeHandler,
12
12
  isMobile,
13
13
  fullSearchActive,
14
- setFullSearchActive
14
+ setFullSearchActive,
15
+ searchBoxViewType
15
16
  }) => {
16
17
  const [searchInput, setSearchInput] = useState('');
17
18
  const {
18
19
  hits,
19
20
  placeholder
20
- } = useSearch(searchInput, 25);
21
+ } = useSearch(searchInput, fullSearchActive ? 25 : 75);
21
22
  const escHandler = useCallback(event => {
22
23
  if (event.keyCode === ESC_CODE) {
23
24
  closeHandler();
@@ -62,7 +63,8 @@ const SearchBox = ({
62
63
  results: hits,
63
64
  searchString: searchInput,
64
65
  toggleFullSearch: toggleFullSearch,
65
- placeholder: placeholder
66
+ placeholder: placeholder,
67
+ quickSearchBoxViewType: searchBoxViewType
66
68
  }), fullSearchActive && React__default.createElement(FullSearch, {
67
69
  toggleFullSearch: toggleFullSearch,
68
70
  searchString: searchInput,
@@ -2,15 +2,13 @@ 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';
7
5
  const DATA_TEST_HEADER_SEARCH_BUTTON = 'header-search-button';
8
6
 
9
7
  const SearchButton = ({
10
8
  onClick,
11
9
  isActive
12
10
  }) => {
13
- return React__default.createElement(React__default.Fragment, null, React__default.createElement("button", {
11
+ return React__default.createElement("button", {
14
12
  type: "button",
15
13
  className: classNames(styles.button, {
16
14
  [styles.active]: isActive
@@ -18,16 +16,7 @@ const SearchButton = ({
18
16
  "data-test": DATA_TEST_HEADER_SEARCH_BUTTON,
19
17
  "aria-label": "Search",
20
18
  onClick: onClick
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
- })));
19
+ }, React__default.createElement(SvgSearch, null));
31
20
  };
32
21
 
33
22
  export { DATA_TEST_HEADER_SEARCH_BUTTON, SearchButton };
@@ -1,6 +1,5 @@
1
1
  var styles = {
2
2
  "button": "ktl-search-button-module_button_YHJPv",
3
- "active": "ktl-search-button-module_active_lUmdh",
4
- "mobileButton": "ktl-search-button-module_mobileButton_KT2YP"
3
+ "active": "ktl-search-button-module_active_lUmdh"
5
4
  };
6
5
  export { styles as default };
@@ -0,0 +1,71 @@
1
+ import React__default, { useState } from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import classNames from 'classnames';
4
+ import styles from './dropdown-menu.module.pcss.js';
5
+ import { useTextStyles } from '@rescui/typography';
6
+ import SvgArrowDropdownIcon from './arrow-dropdown-icon.svg.js';
7
+ import { useTheme } from '@rescui/ui-contexts';
8
+
9
+ const DropdownMenu = ({
10
+ homeUrl,
11
+ title,
12
+ mobileTitle = 'Overview',
13
+ items,
14
+ activeIndex,
15
+ linkHandler,
16
+ mobileOverview = true
17
+ }) => {
18
+ const theme = useTheme();
19
+ const textCn = useTextStyles();
20
+ const [portalRoot, setPortalRoot] = React__default.useState(null);
21
+ React__default.useEffect(() => {
22
+ if (typeof document !== `undefined`) {
23
+ setPortalRoot(document.body);
24
+ }
25
+ }, []);
26
+
27
+ let _items = (mobileOverview ? [{
28
+ title: mobileTitle,
29
+ url: homeUrl
30
+ }] : []).concat(items);
31
+
32
+ const _activeIndex = mobileOverview ? activeIndex + 1 : activeIndex;
33
+
34
+ const activeItem = _items[_activeIndex];
35
+ const [isExpanded, setIsExpanded] = useState(false);
36
+
37
+ const handleClick = () => setIsExpanded(!isExpanded);
38
+
39
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
40
+ className: classNames(styles.dropdownMenu, {
41
+ [styles.dropdownMenuExpanded]: isExpanded
42
+ }),
43
+ onClick: handleClick
44
+ }, React__default.createElement("button", {
45
+ className: classNames(styles.button, textCn('rs-text-2')),
46
+ "aria-haspopup": "true"
47
+ }, React__default.createElement("span", {
48
+ className: styles.buttonText
49
+ }, activeItem.title), React__default.createElement(SvgArrowDropdownIcon, {
50
+ className: styles.icon
51
+ })), React__default.createElement("nav", {
52
+ className: classNames(styles.dropdownList, {
53
+ [styles.dropdownListDarkTheme]: theme === 'dark'
54
+ })
55
+ }, _items.map((item, index) => React__default.createElement("a", {
56
+ key: item.url,
57
+ href: item.url,
58
+ className: classNames(styles.dropdownItem, textCn('rs-text-2'), {
59
+ [styles.dropdownItemActive]: index === _activeIndex
60
+ }),
61
+ onClick: event => linkHandler?.(event, item.url),
62
+ target: item.isExternal ? '_blank' : undefined
63
+ }, item.title)))), !!portalRoot && ReactDOM.createPortal(React__default.createElement("div", {
64
+ className: classNames(styles.overlay, {
65
+ [styles.overlayVisible]: isExpanded
66
+ }),
67
+ onClick: handleClick
68
+ }), portalRoot));
69
+ };
70
+
71
+ export { DropdownMenu };
@@ -0,0 +1,15 @@
1
+ var styles = {
2
+ "dropdownMenu": "ktl-dropdown-menu-module_dropdown-menu_tq2uU",
3
+ "button": "ktl-dropdown-menu-module_button_OYsuv",
4
+ "buttonText": "ktl-dropdown-menu-module_button-text_SJmh-",
5
+ "icon": "ktl-dropdown-menu-module_icon_GGhMI",
6
+ "dropdownList": "ktl-dropdown-menu-module_dropdown-list_Ylkvt",
7
+ "fadein": "ktl-dropdown-menu-module_fadein_MySnq",
8
+ "dropdownItem": "ktl-dropdown-menu-module_dropdown-item_X3tZ-",
9
+ "dropdownItemActive": "ktl-dropdown-menu-module_dropdown-item-active_99q9X",
10
+ "overlay": "ktl-dropdown-menu-module_overlay_segRo",
11
+ "overlayVisible": "ktl-dropdown-menu-module_overlay-visible_MjwEF",
12
+ "dropdownMenuExpanded": "ktl-dropdown-menu-module_dropdown-menu-expanded_EQefy",
13
+ "dropdownListDarkTheme": "ktl-dropdown-menu-module_dropdown-list-dark-theme_P60ol"
14
+ };
15
+ export { styles as default };
@@ -13,8 +13,7 @@
13
13
  --ktl-overlay-z-index: 900;
14
14
  --ktl-top-menu-z-index: 905;
15
15
  --ktl-header-z-index: 906;
16
- --ktl-mobile-dropdown-list-z-index: 907;
17
- --ktl-header-height-mobile: 52px;
16
+ --ktl-header-height-mobile: 48px;
18
17
  --ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
19
18
  --rs-font-family-ui: var(--ktl-font-family-inter);
20
19
  }
@@ -30,6 +29,7 @@
30
29
  height: 64px;
31
30
  background: #ffffff;
32
31
  padding: 0 32px;
32
+ z-index: var(--ktl-top-menu-z-index);
33
33
  box-shadow: inset 0 -1px 0 0 var(--ktl-light-dark-20);
34
34
  transition: color var(--ktl-transition-fast),
35
35
  background-color var(--ktl-transition-fast);
@@ -48,7 +48,7 @@
48
48
 
49
49
  @media (max-width: 640px) {
50
50
  .ktl-top-menu-module_top-menu_PRX9X {
51
- height: var(--ktl-header-height-mobile);
51
+ height: 48px;
52
52
  padding: 0 16px;
53
53
  grid-gap: 16px;
54
54
  grid-template-columns: 1fr auto;
@@ -75,6 +75,12 @@
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
+
78
84
  :root {
79
85
  --ktl-light-grey: #f4f4f4;
80
86
  --ktl-dark-100: rgba(39, 40, 44, 1);
@@ -90,111 +96,140 @@
90
96
  --ktl-overlay-z-index: 900;
91
97
  --ktl-top-menu-z-index: 905;
92
98
  --ktl-header-z-index: 906;
93
- --ktl-mobile-dropdown-list-z-index: 907;
94
- --ktl-header-height-mobile: 52px;
99
+ --ktl-header-height-mobile: 48px;
95
100
  --ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
96
101
  --rs-font-family-ui: var(--ktl-font-family-inter);
97
102
  }
98
103
 
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: 100%;
113
- width: 100%;
114
- max-width: 100%;
115
- padding: 0;
116
- margin: 0;
117
- display: flex;
118
- align-items: center;
119
- cursor: pointer;
104
+ .ktl-dropdown-menu-module_dropdown-menu_tq2uU {
105
+ display: none;
106
+ height: 100%;
107
+ justify-self: flex-start;
108
+ white-space: nowrap;
109
+ min-width: 0;
110
+ max-width: 100%;
111
+ }
112
+
113
+ .ktl-dropdown-menu-module_button_OYsuv {
114
+ border: none;
115
+ background: none;
116
+ height: 100%;
117
+ max-width: 100%;
118
+ padding: 0;
119
+ margin: 0;
120
+ display: flex;
121
+ align-items: center;
122
+ justify-content: space-between;
123
+ cursor: pointer;
120
124
  }
121
125
 
122
- .ktl-vertical-menu-module_button-text_aXith {
123
- overflow: hidden;
124
- text-overflow: ellipsis;
125
- flex: 0 1 auto;
126
+ .ktl-dropdown-menu-module_button-text_SJmh- {
127
+ overflow: hidden;
128
+ text-overflow: ellipsis;
129
+ flex: 0 1 auto;
126
130
  }
127
131
 
128
- .ktl-vertical-menu-module_icon_-Ieat {
129
- width: 12px;
130
- height: 6px;
131
- margin-left: 6px;
132
- transition: transform ease-in-out var(--ktl-transition-xfast);
133
- flex: 0 0 auto;
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;
134
138
  }
135
139
 
136
- .ktl-vertical-menu-module_dropdown-header_77lTy {
137
- /* workaround */
138
- margin-top: calc(var(--ktl-header-height-mobile) * -1);
139
- display: flex;
140
- color: #ffffff;
141
- align-items: center;
142
- height: var(--ktl-header-height-mobile);
143
- padding: 0 0 0 16px;
144
- border-bottom: 1px solid rgba(255, 255, 255, 0.3);
145
- justify-content: space-between;
146
- background: #ffffff;
140
+ .ktl-dropdown-menu-module_dropdown-list_Ylkvt {
141
+ display: none;
142
+ position: absolute;
143
+ left: 0;
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;
147
149
  }
148
150
 
149
- .ktl-vertical-menu-module_dropdown-list_N3KWV {
150
- display: flex;
151
- flex-direction: column;
152
- opacity: 1;
153
- position: fixed;
154
- top: 0;
155
- left: 0;
156
- right: 0;
157
- bottom: 0;
158
- background: #ffffff;
159
- z-index: var(--ktl-mobile-dropdown-list-z-index);
160
- }
161
-
162
- .ktl-vertical-menu-module_dropdown-item_XLfp4 {
163
- padding: 12px 16px;
164
- text-decoration: none;
165
- transition: color var(--ktl-transition-xfast),
151
+ .ktl-dropdown-menu-module_dropdown-item_X3tZ- {
152
+ padding: 8px 16px;
153
+ text-decoration: none;
154
+ transition: color var(--ktl-transition-xfast),
166
155
  background-color var(--ktl-transition-xfast);
167
156
  }
168
157
 
169
- .ktl-vertical-menu-module_dropdown-item_XLfp4:hover {
170
- background: rgba(39, 40, 44, 0.1);
171
- color: #27282c;
172
- }
158
+ .ktl-dropdown-menu-module_dropdown-item_X3tZ-:hover {
159
+ background: rgba(39, 40, 44, 0.1);
160
+ color: #27282c;
161
+ }
173
162
 
174
- .ktl-vertical-menu-module_dropdown-item_XLfp4.ktl-vertical-menu-module_dropdown-item-active_iBUbj {
175
- background: var(--ktl-dark-100);
176
- color: #ffffff;
177
- }
163
+ .ktl-dropdown-menu-module_dropdown-item_X3tZ-.ktl-dropdown-menu-module_dropdown-item-active_99q9X {
164
+ background: var(--ktl-dark-100);
165
+ color: #ffffff;
166
+ }
178
167
 
179
- .ktl-vertical-menu-module_vertical-menu-expanded_kFaaI .ktl-vertical-menu-module_icon_-Ieat {
180
- transform: scale(1, -1);
181
- }
168
+ .ktl-dropdown-menu-module_overlay_segRo {
169
+ display: none;
170
+ position: fixed;
171
+ top: 0;
172
+ right: 0;
173
+ bottom: 0;
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
+ }
182
192
 
183
- .ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw {
184
- background: rgba(39, 40, 44, 1);
193
+ .ktl-dropdown-menu-module_dropdown-menu-expanded_EQefy .ktl-dropdown-menu-module_dropdown-list_Ylkvt {
194
+ display: flex;
195
+ flex-direction: column;
196
+ opacity: 1;
197
+ }
198
+
199
+ .ktl-dropdown-menu-module_dropdown-list-dark-theme_P60ol {
200
+ background: var(--ktl-dark-bg-hard);
185
201
  }
186
202
 
187
- .ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw .ktl-vertical-menu-module_dropdown-header_77lTy {
188
- background: rgba(39, 40, 44, 1);
203
+ .ktl-dropdown-menu-module_dropdown-list-dark-theme_P60ol .ktl-dropdown-menu-module_dropdown-item_X3tZ-:hover {
204
+ background: rgba(255, 255, 255, 0.1);
205
+ color: #ffffff;
189
206
  }
190
207
 
191
- .ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw .ktl-vertical-menu-module_dropdown-item_XLfp4:hover {
192
- background: rgba(255, 255, 255, 0.1);
193
- color: #ffffff;
194
- }
208
+ .ktl-dropdown-menu-module_dropdown-list-dark-theme_P60ol .ktl-dropdown-menu-module_dropdown-item_X3tZ-.ktl-dropdown-menu-module_dropdown-item-active_99q9X {
209
+ color: var(--ktl-light-text-hard);
210
+ background: #ffffff;
211
+ }
195
212
 
196
- .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 {
197
- color: var(--ktl-light-text-hard);
198
- background: #ffffff;
199
- }
213
+ @media (max-width: 640px) {
214
+ .ktl-dropdown-menu-module_dropdown-menu_tq2uU {
215
+ display: block;
216
+ }
217
+ }
218
+
219
+ @-webkit-keyframes ktl-dropdown-menu-module_fadein_MySnq {
220
+ 0% {
221
+ opacity: 0;
222
+ }
223
+ 100% {
224
+ opacity: 1;
225
+ }
226
+ }
200
227
 
228
+ @keyframes ktl-dropdown-menu-module_fadein_MySnq {
229
+ 0% {
230
+ opacity: 0;
231
+ }
232
+ 100% {
233
+ opacity: 1;
234
+ }
235
+ }
@@ -1,13 +1,12 @@
1
- import React__default, { forwardRef, useRef, useImperativeHandle, useState, useLayoutEffect } from 'react';
1
+ import React__default 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 { VerticalMenu } from './vertical-menu/vertical-menu.js';
8
- import useResizeObserver from '@react-hook/resize-observer';
9
- const BREAKPOINT_XS = 640;
10
- const TopMenu = forwardRef(({
7
+ import { DropdownMenu } from './dropdown-menu/dropdown-menu.js';
8
+
9
+ const TopMenu = ({
11
10
  homeUrl,
12
11
  title,
13
12
  mobileTitle,
@@ -16,39 +15,33 @@ const TopMenu = forwardRef(({
16
15
  linkHandler = () => {},
17
16
  className,
18
17
  children,
18
+ forwardedRef,
19
19
  mobileOverview
20
- }, forwardedRef) => {
20
+ }) => {
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));
30
23
  return React__default.createElement("div", {
31
- ref: menuRef,
32
24
  className: classNames(styles.topMenu, className, {
33
25
  [styles.topMenuDarkTheme]: theme === 'dark'
34
- })
26
+ }),
27
+ ref: forwardedRef
35
28
  }, React__default.createElement("a", {
36
29
  href: homeUrl,
37
30
  className: classNames(styles.logo, textCn('rs-h3')),
38
31
  onClick: event => linkHandler(event, homeUrl)
39
- }, title), isMobileMenuVisible ? React__default.createElement(VerticalMenu, {
32
+ }, title), React__default.createElement(DropdownMenu, {
40
33
  items: items,
41
34
  activeIndex: activeIndex,
42
35
  linkHandler: linkHandler,
43
36
  title: title,
44
37
  mobileTitle: mobileTitle,
45
38
  homeUrl: homeUrl,
46
- mobileOverview: mobileOverview,
47
- topMenuRef: menuRef
48
- }) : React__default.createElement(HorizontalMenu, {
39
+ mobileOverview: mobileOverview
40
+ }), React__default.createElement(HorizontalMenu, {
49
41
  items: items,
50
42
  activeIndex: activeIndex,
51
43
  linkHandler: linkHandler
52
44
  }), children);
53
- });
45
+ };
46
+
54
47
  export { TopMenu };
@@ -13,8 +13,7 @@
13
13
  --ktl-overlay-z-index: 900;
14
14
  --ktl-top-menu-z-index: 905;
15
15
  --ktl-header-z-index: 906;
16
- --ktl-mobile-dropdown-list-z-index: 907;
17
- --ktl-header-height-mobile: 52px;
16
+ --ktl-header-height-mobile: 48px;
18
17
  --ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
19
18
  --rs-font-family-ui: var(--ktl-font-family-inter);
20
19
  }
@@ -13,8 +13,7 @@
13
13
  --ktl-overlay-z-index: 900;
14
14
  --ktl-top-menu-z-index: 905;
15
15
  --ktl-header-z-index: 906;
16
- --ktl-mobile-dropdown-list-z-index: 907;
17
- --ktl-header-height-mobile: 52px;
16
+ --ktl-header-height-mobile: 48px;
18
17
  --ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
19
18
  --rs-font-family-ui: var(--ktl-font-family-inter);
20
19
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jetbrains/kotlin-web-site-ui",
3
3
  "description": "UI components for Kotlin web sites development",
4
- "version": "4.2.0-alpha.4",
4
+ "version": "4.2.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
7
7
  "files": [
@@ -47,7 +47,7 @@
47
47
  "@babel/preset-typescript": "^7.13.0",
48
48
  "@babel/register": "^7.11.5",
49
49
  "@react-hook/resize-observer": "^1.2.5",
50
- "@rescui/button": "^0.6.9",
50
+ "@rescui/button": "^0.2.1",
51
51
  "@rescui/checkbox": "^0.1.0",
52
52
  "@rescui/focus-manager": "^0.1.1",
53
53
  "@rescui/icons": "^0.8.2",
@@ -1,33 +0,0 @@
1
- import React__default, { Fragment } from 'react';
2
- import { MenuListItem } from '../menu-list-item/menu-list-item.js';
3
- import styles from './menu-list.module.pcss.js';
4
-
5
- const MenuList = ({
6
- items,
7
- level,
8
- linkHandler
9
- }) => {
10
- return React__default.createElement(React__default.Fragment, null, items.map((item, i) => React__default.createElement(Fragment, {
11
- key: i
12
- }, item.items && item.items.length > 0 ? React__default.createElement("div", {
13
- className: styles.menuItemGroup
14
- }, React__default.createElement(MenuListItem, {
15
- item: item,
16
- level: level,
17
- linkHandler: linkHandler
18
- }), item.items && item.items.length > 0 && React__default.createElement(MenuList, {
19
- items: item.items,
20
- level: level + 1,
21
- linkHandler: linkHandler
22
- })) : React__default.createElement(React__default.Fragment, null, React__default.createElement(MenuListItem, {
23
- item: item,
24
- level: level,
25
- linkHandler: linkHandler
26
- }), item.items && React__default.createElement(MenuList, {
27
- items: item.items,
28
- level: level + 1,
29
- linkHandler: linkHandler
30
- })))));
31
- };
32
-
33
- export { MenuList };
@@ -1,4 +0,0 @@
1
- var styles = {
2
- "menuItemGroup": "ktl-menu-list-module_menu-item-group_mFvUE"
3
- };
4
- export { styles as default };