@jetbrains/kotlin-web-site-ui 4.1.0-alpha.9 → 4.1.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/header/full-search/full-search.js +57 -9
- package/out/components/header/full-search/full-search.module.pcss.js +3 -1
- package/out/components/header/full-search/hit-list/hit-list.js +2 -19
- package/out/components/header/full-search/hit-list/hit-list.module.pcss.js +0 -1
- package/out/components/header/index.css +80 -52
- package/out/components/top-menu/dropdown-menu/dropdown-menu.js +3 -1
- package/out/components/top-menu/dropdown-menu/dropdown-menu.module.pcss.js +1 -0
- package/out/components/top-menu/index.css +11 -0
- package/package.json +3 -1
|
@@ -1,34 +1,70 @@
|
|
|
1
|
-
import React__default, { useState, useCallback } from 'react';
|
|
1
|
+
import React__default, { useState, useContext, useRef, useCallback, useLayoutEffect } from 'react';
|
|
2
|
+
import useScrollbarSize from 'react-scrollbar-size';
|
|
2
3
|
import { ThemeProvider } from '@rescui/ui-contexts';
|
|
3
4
|
import Input from '@rescui/input';
|
|
4
5
|
import Button from '@rescui/button';
|
|
6
|
+
import Switcher from '@rescui/switcher';
|
|
5
7
|
import { CloseIcon, ErrorIcon } from '@rescui/icons';
|
|
6
|
-
import styles from './full-search.module.pcss.js';
|
|
7
8
|
import { useSearch } from '../search-wrapper/use-search.js';
|
|
8
9
|
import { ResultsList } from './results-list/results-list.js';
|
|
10
|
+
import SearchContext from '../search-wrapper/search-context.js';
|
|
11
|
+
import styles from './full-search.module.pcss.js';
|
|
9
12
|
|
|
10
13
|
const FullSearch = ({
|
|
11
14
|
searchString,
|
|
12
15
|
killSearch
|
|
13
16
|
}) => {
|
|
17
|
+
const [isScrollbarCompensated, setIsScrollbarCompensated] = useState(false);
|
|
14
18
|
const [inputValue, setInputValue] = useState(searchString);
|
|
15
19
|
const {
|
|
16
20
|
hits,
|
|
17
21
|
placeholder
|
|
18
22
|
} = useSearch(inputValue, 75);
|
|
23
|
+
const {
|
|
24
|
+
matching,
|
|
25
|
+
matchingOptions,
|
|
26
|
+
setMatching
|
|
27
|
+
} = useContext(SearchContext);
|
|
28
|
+
const ref = useRef(null);
|
|
29
|
+
const headerRef = useRef(null);
|
|
30
|
+
const listRef = useRef(null);
|
|
31
|
+
const isResultsVisible = hits.length > 0 && inputValue;
|
|
32
|
+
const handleSwitcherChange = useCallback(value => {
|
|
33
|
+
setMatching(value);
|
|
34
|
+
}, []);
|
|
19
35
|
const clearSearch = useCallback(() => {
|
|
20
36
|
setInputValue('');
|
|
21
37
|
}, []);
|
|
22
38
|
const handleInputChange = useCallback(e => {
|
|
23
39
|
setInputValue(e.target.value);
|
|
24
|
-
}, [inputValue]);
|
|
40
|
+
}, [inputValue]); // Scrollbar compensation
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
width
|
|
44
|
+
} = useScrollbarSize();
|
|
45
|
+
useLayoutEffect(() => {
|
|
46
|
+
if (headerRef.current && listRef.current) {
|
|
47
|
+
const countedHeight = headerRef.current.offsetHeight + listRef.current.offsetHeight;
|
|
48
|
+
|
|
49
|
+
if (isResultsVisible) {
|
|
50
|
+
setIsScrollbarCompensated(countedHeight < window.innerWidth);
|
|
51
|
+
} else {
|
|
52
|
+
setIsScrollbarCompensated(true);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, [hits, inputValue]);
|
|
25
56
|
return React__default.createElement(ThemeProvider, {
|
|
26
57
|
theme: 'light'
|
|
27
58
|
}, React__default.createElement("div", {
|
|
28
59
|
className: styles.fullSearch,
|
|
29
|
-
|
|
60
|
+
style: {
|
|
61
|
+
paddingRight: isScrollbarCompensated ? `${width}px` : 0
|
|
62
|
+
},
|
|
63
|
+
tabIndex: 1000,
|
|
64
|
+
ref: ref
|
|
30
65
|
}, React__default.createElement("div", {
|
|
31
|
-
className: styles.header
|
|
66
|
+
className: styles.header,
|
|
67
|
+
ref: headerRef
|
|
32
68
|
}, React__default.createElement("div", {
|
|
33
69
|
className: styles.closeSearch
|
|
34
70
|
}, React__default.createElement(Button, {
|
|
@@ -41,13 +77,25 @@ const FullSearch = ({
|
|
|
41
77
|
}, React__default.createElement(Input, {
|
|
42
78
|
placeholder: 'Search',
|
|
43
79
|
value: inputValue,
|
|
44
|
-
onClear: clearSearch,
|
|
45
80
|
onChange: handleInputChange,
|
|
46
|
-
|
|
81
|
+
onClear: clearSearch,
|
|
82
|
+
clearIcon: React__default.createElement("button", {
|
|
83
|
+
className: styles.fullSearchClearButton
|
|
84
|
+
}, React__default.createElement(ErrorIcon, {
|
|
85
|
+
size: 'l'
|
|
86
|
+
})),
|
|
47
87
|
size: 'l',
|
|
48
88
|
autoFocus: true
|
|
49
|
-
})
|
|
50
|
-
className: styles.
|
|
89
|
+
}), isResultsVisible && React__default.createElement("div", {
|
|
90
|
+
className: styles.switcher
|
|
91
|
+
}, React__default.createElement(Switcher, {
|
|
92
|
+
value: matching,
|
|
93
|
+
onChange: handleSwitcherChange,
|
|
94
|
+
options: matchingOptions,
|
|
95
|
+
size: 'xs'
|
|
96
|
+
})))), React__default.createElement("div", {
|
|
97
|
+
className: styles.wrapper,
|
|
98
|
+
ref: listRef
|
|
51
99
|
}, inputValue && React__default.createElement(ResultsList, {
|
|
52
100
|
placeholder: placeholder,
|
|
53
101
|
hits: hits
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
var styles = {
|
|
2
2
|
"fullSearch": "ktl-full-search-module_fullSearch_MTU8t",
|
|
3
3
|
"closeSearch": "ktl-full-search-module_closeSearch_5vYDG",
|
|
4
|
+
"fullSearchClearButton": "ktl-full-search-module_fullSearchClearButton_DGS6T",
|
|
4
5
|
"wrapper": "ktl-full-search-module_wrapper_9rxXb",
|
|
5
6
|
"header": "ktl-full-search-module_header_Wltw0",
|
|
6
|
-
"results": "ktl-full-search-module_results_svcSE"
|
|
7
|
+
"results": "ktl-full-search-module_results_svcSE",
|
|
8
|
+
"switcher": "ktl-full-search-module_switcher_o1RgM"
|
|
7
9
|
};
|
|
8
10
|
export { styles as default };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import React__default
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { useTextStyles } from '@rescui/typography';
|
|
4
|
-
import Switcher from '@rescui/switcher';
|
|
5
|
-
import SearchContext from '../../search-wrapper/search-context.js';
|
|
6
4
|
import getExtendedHits from './get-extended-hits.js';
|
|
7
5
|
import { Chapters } from '../chapters/chapters.js';
|
|
8
6
|
import styles from './hit-list.module.pcss.js';
|
|
@@ -12,22 +10,7 @@ const HitList = ({
|
|
|
12
10
|
}) => {
|
|
13
11
|
const textCn = useTextStyles();
|
|
14
12
|
const extendedHits = getExtendedHits(hits);
|
|
15
|
-
|
|
16
|
-
matching,
|
|
17
|
-
matchingOptions,
|
|
18
|
-
setMatching
|
|
19
|
-
} = useContext(SearchContext);
|
|
20
|
-
const handleSwitcherChange = useCallback(value => {
|
|
21
|
-
setMatching(value);
|
|
22
|
-
}, []);
|
|
23
|
-
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
24
|
-
className: styles.switcher
|
|
25
|
-
}, React__default.createElement(Switcher, {
|
|
26
|
-
value: matching,
|
|
27
|
-
onChange: handleSwitcherChange,
|
|
28
|
-
options: matchingOptions,
|
|
29
|
-
size: 'xs'
|
|
30
|
-
})), extendedHits.map(({
|
|
13
|
+
return React__default.createElement(React__default.Fragment, null, extendedHits.map(({
|
|
31
14
|
title,
|
|
32
15
|
snippet,
|
|
33
16
|
chapters = [],
|
|
@@ -419,51 +419,6 @@
|
|
|
419
419
|
right: 0;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
.ktl-full-search-module_fullSearch_MTU8t {
|
|
423
|
-
display: none;
|
|
424
|
-
box-sizing: border-box;
|
|
425
|
-
position: fixed;
|
|
426
|
-
width: 100%;
|
|
427
|
-
height: 100%;
|
|
428
|
-
top: 0;
|
|
429
|
-
left: 0;
|
|
430
|
-
background: #ffffff;
|
|
431
|
-
overflow-y: scroll;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
.ktl-full-search-module_closeSearch_5vYDG {
|
|
435
|
-
position: absolute;
|
|
436
|
-
top: 40px;
|
|
437
|
-
right: 40px;
|
|
438
|
-
display: flex;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.ktl-full-search-module_wrapper_9rxXb {
|
|
442
|
-
max-width: 704px;
|
|
443
|
-
margin: 0 auto;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
.ktl-full-search-module_header_Wltw0 {
|
|
447
|
-
width: 100%;
|
|
448
|
-
padding-top: 120px;
|
|
449
|
-
padding-bottom: 10px;
|
|
450
|
-
position: sticky;
|
|
451
|
-
top: 0;
|
|
452
|
-
left: 0;
|
|
453
|
-
background: #ffffff;
|
|
454
|
-
z-index: 10;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
.ktl-full-search-module_results_svcSE {
|
|
458
|
-
margin-top: 14px;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
@media (min-width: 768px) {
|
|
462
|
-
.ktl-full-search-module_fullSearch_MTU8t {
|
|
463
|
-
display: block;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
422
|
.ktl-loading-module_loader_B2IQl {
|
|
468
423
|
margin-top: 4px;
|
|
469
424
|
}
|
|
@@ -532,14 +487,8 @@
|
|
|
532
487
|
.ktl-chapters-module_moreButton_98oqy {
|
|
533
488
|
margin-top: 12px;
|
|
534
489
|
}
|
|
535
|
-
.ktl-hit-list-module_switcher_bt6Xx {
|
|
536
|
-
display: flex;
|
|
537
|
-
justify-content: flex-end;
|
|
538
|
-
margin-top: 4px;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
490
|
.ktl-hit-list-module_hitList_1MP6m {
|
|
542
|
-
margin: 50px 0;
|
|
491
|
+
margin: 40px 0 50px 0;
|
|
543
492
|
}
|
|
544
493
|
|
|
545
494
|
.ktl-hit-list-module_titleLink_rdJ6u em {
|
|
@@ -547,6 +496,85 @@
|
|
|
547
496
|
font-style: normal;
|
|
548
497
|
}
|
|
549
498
|
|
|
499
|
+
.ktl-full-search-module_fullSearch_MTU8t {
|
|
500
|
+
display: none;
|
|
501
|
+
box-sizing: border-box;
|
|
502
|
+
position: fixed;
|
|
503
|
+
width: 100%;
|
|
504
|
+
height: 100%;
|
|
505
|
+
top: 0;
|
|
506
|
+
left: 0;
|
|
507
|
+
background: #ffffff;
|
|
508
|
+
overflow-y: auto;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.ktl-full-search-module_closeSearch_5vYDG {
|
|
512
|
+
position: absolute;
|
|
513
|
+
top: 40px;
|
|
514
|
+
right: 40px;
|
|
515
|
+
display: flex;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T {
|
|
519
|
+
margin: 0;
|
|
520
|
+
padding: 0;
|
|
521
|
+
border: 0;
|
|
522
|
+
background: none;
|
|
523
|
+
display: flex;
|
|
524
|
+
cursor: pointer;
|
|
525
|
+
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T > svg {
|
|
529
|
+
opacity: 0.7;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T:hover > svg {
|
|
533
|
+
opacity: 1;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T:focus {
|
|
537
|
+
outline: none;
|
|
538
|
+
box-shadow: rgba(107, 87, 255, 0.8) 0 0 0 4px;
|
|
539
|
+
border-radius: 100%;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.ktl-full-search-module_fullSearchClearButton_DGS6T:focus > svg {
|
|
543
|
+
opacity: 1;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.ktl-full-search-module_wrapper_9rxXb {
|
|
547
|
+
max-width: 704px;
|
|
548
|
+
margin: 0 auto;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.ktl-full-search-module_header_Wltw0 {
|
|
552
|
+
width: 100%;
|
|
553
|
+
padding-top: 120px;
|
|
554
|
+
padding-bottom: 10px;
|
|
555
|
+
position: sticky;
|
|
556
|
+
top: 0;
|
|
557
|
+
left: 0;
|
|
558
|
+
background: #ffffff;
|
|
559
|
+
z-index: 10;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.ktl-full-search-module_results_svcSE {
|
|
563
|
+
margin-top: 14px;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.ktl-full-search-module_switcher_o1RgM {
|
|
567
|
+
display: flex;
|
|
568
|
+
justify-content: flex-end;
|
|
569
|
+
margin-top: 14px;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
@media (min-width: 768px) {
|
|
573
|
+
.ktl-full-search-module_fullSearch_MTU8t {
|
|
574
|
+
display: block;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
550
578
|
.ktl-search-box-module_searchBox_0SgE9 {
|
|
551
579
|
position: relative;
|
|
552
580
|
width: 408px;
|
|
@@ -44,7 +44,9 @@ const DropdownMenu = ({
|
|
|
44
44
|
}, React__default.createElement("button", {
|
|
45
45
|
className: classNames(styles.button, textCn('rs-text-2')),
|
|
46
46
|
"aria-haspopup": "true"
|
|
47
|
-
}, React__default.createElement("span",
|
|
47
|
+
}, React__default.createElement("span", {
|
|
48
|
+
className: styles.buttonText
|
|
49
|
+
}, activeItem.title), React__default.createElement(SvgArrowDropdownIcon, {
|
|
48
50
|
className: styles.icon
|
|
49
51
|
})), React__default.createElement("nav", {
|
|
50
52
|
className: classNames(styles.dropdownList, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var styles = {
|
|
2
2
|
"dropdownMenu": "ktl-dropdown-menu-module_dropdown-menu_tq2uU",
|
|
3
3
|
"button": "ktl-dropdown-menu-module_button_OYsuv",
|
|
4
|
+
"buttonText": "ktl-dropdown-menu-module_button-text_SJmh-",
|
|
4
5
|
"icon": "ktl-dropdown-menu-module_icon_GGhMI",
|
|
5
6
|
"dropdownList": "ktl-dropdown-menu-module_dropdown-list_Ylkvt",
|
|
6
7
|
"fadein": "ktl-dropdown-menu-module_fadein_MySnq",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
height: 48px;
|
|
52
52
|
padding: 0 16px;
|
|
53
53
|
grid-gap: 16px;
|
|
54
|
+
grid-template-columns: 1fr auto;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
.ktl-top-menu-module_logo_CNH2W {
|
|
@@ -105,12 +106,15 @@
|
|
|
105
106
|
height: 100%;
|
|
106
107
|
justify-self: flex-start;
|
|
107
108
|
white-space: nowrap;
|
|
109
|
+
min-width: 0;
|
|
110
|
+
max-width: 100%;
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
.ktl-dropdown-menu-module_button_OYsuv {
|
|
111
114
|
border: none;
|
|
112
115
|
background: none;
|
|
113
116
|
height: 100%;
|
|
117
|
+
max-width: 100%;
|
|
114
118
|
padding: 0;
|
|
115
119
|
margin: 0;
|
|
116
120
|
display: flex;
|
|
@@ -119,11 +123,18 @@
|
|
|
119
123
|
cursor: pointer;
|
|
120
124
|
}
|
|
121
125
|
|
|
126
|
+
.ktl-dropdown-menu-module_button-text_SJmh- {
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
text-overflow: ellipsis;
|
|
129
|
+
flex: 0 1 auto;
|
|
130
|
+
}
|
|
131
|
+
|
|
122
132
|
.ktl-dropdown-menu-module_icon_GGhMI {
|
|
123
133
|
width: 12px;
|
|
124
134
|
height: 6px;
|
|
125
135
|
margin-left: 6px;
|
|
126
136
|
transition: transform ease-in-out var(--ktl-transition-xfast);
|
|
137
|
+
flex: 0 0 auto;
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
.ktl-dropdown-menu-module_dropdown-list_Ylkvt {
|
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.1.0
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
7
7
|
"files": [
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"react": ">= 16.8.6 < 18",
|
|
36
36
|
"react-dom": ">= 16.8.6 < 18",
|
|
37
37
|
"react-outside-click-handler": "1.x",
|
|
38
|
+
"react-scrollbar-size": "5.x",
|
|
38
39
|
"react-swipeable-views": "0.x",
|
|
39
40
|
"sha.js": "2.x"
|
|
40
41
|
},
|
|
@@ -112,6 +113,7 @@
|
|
|
112
113
|
"react-modal": "^3.14.4",
|
|
113
114
|
"react-outside-click-handler": "^1.3.0",
|
|
114
115
|
"react-remove-scroll-bar": "^2.2.0",
|
|
116
|
+
"react-scrollbar-size": "^5.0.0",
|
|
115
117
|
"react-swipeable-views": "^0.14.0",
|
|
116
118
|
"rollup": "^2.70.1",
|
|
117
119
|
"rollup-plugin-node-externals": "^4.0.0",
|