@jetbrains/kotlin-web-site-ui 4.0.0-alpha.3 → 4.1.0-alpha.1

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 (37) hide show
  1. package/out/components/header/full-search/chapters/chapters.js +56 -0
  2. package/out/components/header/full-search/chapters/chapters.module.pcss.js +11 -0
  3. package/out/components/header/full-search/empty/empty.js +22 -0
  4. package/out/components/header/full-search/empty/empty.module.pcss.js +6 -0
  5. package/out/components/header/full-search/empty/full-search-empty.svg.js +1539 -0
  6. package/out/components/header/full-search/full-search.js +70 -0
  7. package/out/components/header/full-search/full-search.module.pcss.js +9 -0
  8. package/out/components/header/full-search/hit-list/hit-list.js +44 -0
  9. package/out/components/header/full-search/hit-list/hit-list.module.pcss.js +5 -0
  10. package/out/components/header/full-search/loading/loading.js +11 -0
  11. package/out/components/header/full-search/loading/loading.module.pcss.js +4 -0
  12. package/out/components/header/full-search/result/get-extended-hits.js +55 -0
  13. package/out/components/header/full-search/results-list/results-list.js +25 -0
  14. package/out/components/header/header.js +49 -7
  15. package/out/components/header/index.css +253 -0
  16. package/out/components/header/is-macos.js +5 -0
  17. package/out/components/header/key-codes.js +3 -0
  18. package/out/components/header/quick-search/empty/empty.js +16 -0
  19. package/out/components/header/quick-search/empty/empty.module.pcss.js +4 -0
  20. package/out/components/header/quick-search/list/list.js +31 -0
  21. package/out/components/header/quick-search/list/list.module.pcss.js +6 -0
  22. package/out/components/header/quick-search/loading/loading.js +14 -0
  23. package/out/components/header/quick-search/loading/loading.module.pcss.js +4 -0
  24. package/out/components/header/quick-search/quick-search.js +41 -0
  25. package/out/components/header/quick-search/quick-search.module.pcss.js +4 -0
  26. package/out/components/header/quick-search/result/result.js +30 -0
  27. package/out/components/header/quick-search/result/result.module.pcss.js +6 -0
  28. package/out/components/header/search-box/search-box.js +69 -0
  29. package/out/components/header/search-box/search-box.module.pcss.js +4 -0
  30. package/out/components/header/search-button/search-button.js +3 -1
  31. package/out/components/header/search-wrapper/init-search.js +60 -0
  32. package/out/components/header/search-wrapper/search-const.js +13 -0
  33. package/out/components/header/search-wrapper/search-context.js +18 -0
  34. package/out/components/header/search-wrapper/search-with-algolia.js +58 -0
  35. package/out/components/header/search-wrapper/search-wrapper.js +40 -0
  36. package/out/components/header/search-wrapper/use-search.js +85 -0
  37. package/package.json +9 -7
@@ -0,0 +1,70 @@
1
+ import React__default, { useState, useContext, useCallback } from 'react';
2
+ import { ThemeProvider } from '@rescui/ui-contexts';
3
+ import Input from '@rescui/input';
4
+ import Switcher from '@rescui/switcher';
5
+ import { CloseIcon, ErrorIcon } from '@rescui/icons';
6
+ import styles from './full-search.module.pcss.js';
7
+ import { useSearch } from '../search-wrapper/use-search.js';
8
+ import { ResultsList } from './results-list/results-list.js';
9
+ import SearchContext from '../search-wrapper/search-context.js';
10
+
11
+ const FullSearch = ({
12
+ searchString,
13
+ killSearch
14
+ }) => {
15
+ const [inputValue, setInputValue] = useState(searchString);
16
+ const {
17
+ hits,
18
+ placeholder
19
+ } = useSearch(inputValue, 75);
20
+ const {
21
+ matching,
22
+ matchingOptions,
23
+ setMatching
24
+ } = useContext(SearchContext);
25
+ const clearSearch = useCallback(() => {
26
+ setInputValue('');
27
+ }, []);
28
+ const handleSwitcherChange = useCallback(value => {
29
+ setMatching(value);
30
+ }, []);
31
+ const handleInputChange = useCallback(e => {
32
+ setInputValue(e.target.value);
33
+ }, [inputValue]);
34
+ return React__default.createElement(ThemeProvider, {
35
+ theme: 'light'
36
+ }, React__default.createElement("div", {
37
+ className: styles.fullSearch
38
+ }, React__default.createElement("div", {
39
+ className: styles.header
40
+ }, React__default.createElement("button", {
41
+ className: styles.closeSearch,
42
+ onClick: killSearch
43
+ }, React__default.createElement(CloseIcon, {
44
+ size: 'l'
45
+ })), React__default.createElement("div", {
46
+ className: styles.wrapper
47
+ }, React__default.createElement(Input, {
48
+ placeholder: 'Search',
49
+ value: inputValue,
50
+ onClear: clearSearch,
51
+ onChange: handleInputChange,
52
+ clearIcon: React__default.createElement(ErrorIcon, null),
53
+ size: 'l',
54
+ autoFocus: true
55
+ }), React__default.createElement("div", {
56
+ className: styles.switcher
57
+ }, React__default.createElement(Switcher, {
58
+ value: matching,
59
+ onChange: handleSwitcherChange,
60
+ options: matchingOptions,
61
+ size: 'xs'
62
+ })))), React__default.createElement("div", {
63
+ className: styles.wrapper
64
+ }, inputValue && React__default.createElement(ResultsList, {
65
+ placeholder: placeholder,
66
+ hits: hits
67
+ }))));
68
+ };
69
+
70
+ export { FullSearch };
@@ -0,0 +1,9 @@
1
+ var styles = {
2
+ "fullSearch": "ktl-full-search-module_fullSearch_MTU8t",
3
+ "closeSearch": "ktl-full-search-module_closeSearch_5vYDG",
4
+ "wrapper": "ktl-full-search-module_wrapper_9rxXb",
5
+ "header": "ktl-full-search-module_header_Wltw0",
6
+ "switcher": "ktl-full-search-module_switcher_o1RgM",
7
+ "results": "ktl-full-search-module_results_svcSE"
8
+ };
9
+ export { styles as default };
@@ -0,0 +1,44 @@
1
+ import React__default from 'react';
2
+ import { useTextStyles } from '@rescui/typography';
3
+ import getExtendedHits from '../result/get-extended-hits.js';
4
+ import { Chapters } from '../chapters/chapters.js';
5
+ import classNames from 'classnames';
6
+ import styles from './hit-list.module.pcss.js';
7
+
8
+ const HitList = ({
9
+ hits
10
+ }) => {
11
+ const textCn = useTextStyles();
12
+ const extendedHits = getExtendedHits(hits);
13
+ return React__default.createElement(React__default.Fragment, null, extendedHits.map(({
14
+ title,
15
+ snippet,
16
+ chapters = [],
17
+ url,
18
+ breadcrumb
19
+ }, pageIndex) => {
20
+ const isHitWithChapters = chapters.length > 0;
21
+ return React__default.createElement("div", {
22
+ className: styles.hitList,
23
+ key: pageIndex
24
+ }, React__default.createElement("h3", {
25
+ className: textCn('rs-h3')
26
+ }, React__default.createElement("a", {
27
+ className: classNames(styles.titleLink, textCn('rs-link')),
28
+ href: url,
29
+ dangerouslySetInnerHTML: {
30
+ __html: title
31
+ }
32
+ })), isHitWithChapters ? React__default.createElement(Chapters, {
33
+ chapters: chapters,
34
+ hitIndex: pageIndex
35
+ }) : React__default.createElement("div", {
36
+ className: classNames(textCn('rs-text-2')),
37
+ dangerouslySetInnerHTML: {
38
+ __html: snippet
39
+ }
40
+ }));
41
+ }));
42
+ };
43
+
44
+ export { HitList };
@@ -0,0 +1,5 @@
1
+ var styles = {
2
+ "hitList": "ktl-hit-list-module_hitList_1MP6m",
3
+ "titleLink": "ktl-hit-list-module_titleLink_rdJ6u"
4
+ };
5
+ export { styles as default };
@@ -0,0 +1,11 @@
1
+ import React__default from 'react';
2
+ import { LoadingIcon } from '@rescui/icons';
3
+ import styles from './loading.module.pcss.js';
4
+
5
+ const FullSearchLoader = () => {
6
+ return React__default.createElement("div", {
7
+ className: styles.loader
8
+ }, React__default.createElement(LoadingIcon, null));
9
+ };
10
+
11
+ export { FullSearchLoader };
@@ -0,0 +1,4 @@
1
+ var styles = {
2
+ "loader": "ktl-loading-module_loader_B2IQl"
3
+ };
4
+ export { styles as default };
@@ -0,0 +1,55 @@
1
+ const groupHitsByPageId = ungroupedHits => ungroupedHits.reduce((groups, currentHit) => {
2
+ const currentGroup = groups.find(group => group.name === currentHit.mainTitle);
3
+
4
+ if (currentGroup) {
5
+ currentGroup.hits.push(currentHit);
6
+ return groups;
7
+ }
8
+
9
+ const newGroup = {
10
+ name: currentHit.mainTitle,
11
+ hits: [currentHit]
12
+ };
13
+ return [...groups, newGroup];
14
+ }, []);
15
+
16
+ const getChapterName = fullName => fullName.split(':')[1] || fullName;
17
+
18
+ const highlightChaptersTitles = chapters => chapters.map(chapter => ({ ...chapter,
19
+ highlightedTitle: getChapterName(chapter.highlightedTitle)
20
+ }));
21
+
22
+ const getExtendedHits = hits => {
23
+ try {
24
+ const groupedHits = groupHitsByPageId(hits);
25
+ return groupedHits.map(group => {
26
+ const mainHit = group.hits.find(hit => hit.title === group.name);
27
+
28
+ if (mainHit) {
29
+ const chapters = group.hits.filter(hit => hit.title !== group.name);
30
+ return { ...mainHit,
31
+ title: mainHit.highlightedTitle,
32
+ chapters: highlightChaptersTitles(chapters)
33
+ };
34
+ }
35
+
36
+ const {
37
+ url,
38
+ breadcrumb,
39
+ ...restHitProps
40
+ } = group.hits[0];
41
+ return { ...restHitProps,
42
+ title: group.name,
43
+ url: url.split('#')[0],
44
+ breadcrumb,
45
+ chapters: highlightChaptersTitles(group.hits)
46
+ };
47
+ });
48
+ } catch (error) {
49
+ // reportError(error, { func: 'getExtendedHits' });
50
+ console.log('error');
51
+ return [];
52
+ }
53
+ };
54
+
55
+ export { getExtendedHits as default };
@@ -0,0 +1,25 @@
1
+ import React__default from 'react';
2
+ import { FullSearchLoader } from '../loading/loading.js';
3
+ import { FullSearchEmpty } from '../empty/empty.js';
4
+ import { HitList } from '../hit-list/hit-list.js';
5
+
6
+ const ResultsList = ({
7
+ placeholder,
8
+ hits
9
+ }) => {
10
+ if (placeholder) {
11
+ return React__default.createElement(FullSearchEmpty, {
12
+ placeholder: placeholder
13
+ });
14
+ }
15
+
16
+ if (hits.length) {
17
+ return React__default.createElement(HitList, {
18
+ hits: hits
19
+ });
20
+ }
21
+
22
+ return React__default.createElement(FullSearchLoader, null);
23
+ };
24
+
25
+ export { ResultsList };
@@ -1,19 +1,23 @@
1
- import React__default, { forwardRef, useState, useMemo, useRef, useImperativeHandle, useLayoutEffect } from 'react';
1
+ import React__default, { forwardRef, useState, useMemo, useRef, useImperativeHandle, useLayoutEffect, useCallback, useEffect } from 'react';
2
2
  import { ThemeProvider } from '@rescui/ui-contexts';
3
3
  import useResizeObserver from '@react-hook/resize-observer';
4
+ import OutsideClickHandler from 'react-outside-click-handler';
4
5
  import { LogoLarge } from './logo-large/logo-large.js';
5
6
  import styles from './header.module.pcss.js';
6
7
  import { getNavScheme } from './nav-scheme.js';
7
8
  import { HorizontalMenu } from './horizontal-menu/horizontal-menu.js';
8
9
  import { SearchButton } from './search-button/search-button.js';
10
+ import { SearchBox } from './search-box/search-box.js';
9
11
  import { MenuPopup } from './menu-popup/menu-popup.js';
10
12
  import { LogoSmall } from './logo-small/logo-small.js';
11
13
  import classNames from 'classnames';
14
+ import { SearchWrapper } from './search-wrapper/search-wrapper.js';
15
+ import { isMacOs } from './is-macos.js';
16
+ import { KEY_K_CODE } from './key-codes.js';
12
17
  const MENU_POPUP_BREAKPOINT = 640;
13
18
  const Header = forwardRef(({
14
19
  productWebUrl,
15
20
  hasSearch = false,
16
- onSearchClick,
17
21
  currentUrl,
18
22
  currentTitle,
19
23
  className,
@@ -21,10 +25,13 @@ const Header = forwardRef(({
21
25
  dropdownTheme = 'dark',
22
26
  linkHandler,
23
27
  isPlayground,
24
- isUrlActive
28
+ isUrlActive,
29
+ searchConfig
25
30
  }, forwardedRef) => {
26
31
  const [menuPopupExpanded, setMenuPopupExpanded] = useState(false);
27
32
  const [isMenuPopupVisible, setIsMenuPopupVisible] = useState(false);
33
+ const [isSearchBoxVisible, setSearchBoxVisible] = useState(false);
34
+ const [fullSearchActive, setFullSearchActive] = useState(false);
28
35
  const items = useMemo(() => getNavScheme(isUrlActive, currentUrl, isPlayground), [isUrlActive, currentUrl, isPlayground]);
29
36
  const headerRef = useRef(null);
30
37
  useImperativeHandle(forwardedRef, () => headerRef.current);
@@ -32,8 +39,36 @@ const Header = forwardRef(({
32
39
  setIsMenuPopupVisible((headerRef.current?.getBoundingClientRect?.().width ?? 0) <= MENU_POPUP_BREAKPOINT);
33
40
  }, [headerRef]);
34
41
  useResizeObserver(headerRef, entry => setIsMenuPopupVisible(entry.contentRect.width <= MENU_POPUP_BREAKPOINT));
42
+ const handleSearchButtonClick = useCallback(() => {
43
+ setSearchBoxVisible(!isSearchBoxVisible);
44
+ }, []);
45
+ const handleSearchClose = useCallback(() => {
46
+ setSearchBoxVisible(false);
47
+ setFullSearchActive(false);
48
+ }, []);
49
+ const fullSearchKeyHandler = useCallback(event => {
50
+ const isMacOsHotkeyPressed = isMacOs() && event.keyCode === KEY_K_CODE && event.metaKey;
51
+ const isOtherPlatformsHotkeyPressed = !isMacOs() && event.keyCode === KEY_K_CODE && event.ctrlKey;
52
+
53
+ if (isMacOsHotkeyPressed || isOtherPlatformsHotkeyPressed) {
54
+ event.preventDefault();
55
+ event.stopPropagation();
56
+ setSearchBoxVisible(true);
57
+ setFullSearchActive(true);
58
+ }
59
+ }, []);
60
+ useEffect(() => {
61
+ if (typeof document !== `undefined`) {
62
+ document.addEventListener('keydown', fullSearchKeyHandler);
63
+ return () => {
64
+ document.removeEventListener('keydown', fullSearchKeyHandler);
65
+ };
66
+ }
67
+ }, [fullSearchKeyHandler]);
35
68
  return React__default.createElement(ThemeProvider, {
36
69
  theme: 'dark'
70
+ }, React__default.createElement(SearchWrapper, {
71
+ searchConfig: searchConfig
37
72
  }, React__default.createElement("header", {
38
73
  ref: headerRef,
39
74
  className: classNames(styles.headerMenu, className, {
@@ -45,19 +80,26 @@ const Header = forwardRef(({
45
80
  homeUrl: currentUrl
46
81
  }) : React__default.createElement(LogoLarge, {
47
82
  productWebUrl: productWebUrl
48
- }), !isMenuPopupVisible && React__default.createElement(HorizontalMenu, {
83
+ }), isSearchBoxVisible ? React__default.createElement(OutsideClickHandler, {
84
+ onOutsideClick: handleSearchClose
85
+ }, React__default.createElement(SearchBox, {
86
+ closeHandler: handleSearchClose,
87
+ isMobile: isMenuPopupVisible,
88
+ fullSearchActive: fullSearchActive,
89
+ setFullSearchActive: setFullSearchActive
90
+ })) : React__default.createElement(React__default.Fragment, null, !isMenuPopupVisible && React__default.createElement(HorizontalMenu, {
49
91
  items: items,
50
92
  theme: dropdownTheme,
51
93
  linkHandler: linkHandler
52
94
  }), React__default.createElement(SearchButton, {
53
- onClick: onSearchClick,
54
- isActive: hasSearch && !!onSearchClick
95
+ onClick: handleSearchButtonClick,
96
+ isActive: hasSearch
55
97
  }), isMenuPopupVisible && React__default.createElement(MenuPopup, {
56
98
  items: items,
57
99
  setExpand: setMenuPopupExpanded,
58
100
  isExpanded: menuPopupExpanded,
59
101
  headerRef: headerRef,
60
102
  linkHandler: linkHandler
61
- })));
103
+ })))));
62
104
  });
63
105
  export { Header };
@@ -272,6 +272,259 @@
272
272
  }
273
273
  }
274
274
 
275
+ .ktl-result-module_result_EKhUw {
276
+ box-sizing: border-box;
277
+ display: block;
278
+ padding: 16px 32px;
279
+ text-decoration: none;
280
+ }
281
+ .ktl-result-module_result_EKhUw:hover {
282
+ background: rgba(255, 255, 255, 0.1);
283
+ }
284
+ .ktl-result-module_result_EKhUw:focus {
285
+ outline: none;
286
+ background: rgba(255, 255, 255, 0.1);
287
+ }
288
+ .ktl-result-module_result_EKhUw em {
289
+ background-color: rgba(127,82,255,0.3);
290
+ font-style: normal;
291
+ }
292
+
293
+ .ktl-result-module_resultTitle_DSpAT {
294
+ margin-bottom: 6px;
295
+ }
296
+
297
+ .ktl-result-module_text_fWBKG {
298
+ display: -webkit-box;
299
+ -webkit-line-clamp: 2;
300
+ -webkit-box-orient: vertical;
301
+ overflow: hidden;
302
+ }
303
+ .ktl-list-module_results_LlxqY {
304
+ box-sizing: border-box;
305
+ max-height: 305px;
306
+ border: 1px solid rgba(255, 255, 255, 0.2);
307
+ background: #323236;
308
+ color: #fff;
309
+ overflow-y: scroll;
310
+ }
311
+
312
+ .ktl-list-module_topBar_OO0XT {
313
+ display: none;
314
+ }
315
+
316
+ .ktl-list-module_advancedSearch_XNy88 {
317
+ display: inline-block;
318
+ background: transparent;
319
+ border: 0;
320
+ padding: 6px 16px;
321
+ border-radius: 24px;
322
+ cursor: pointer;
323
+ flex-shrink: 0;
324
+ }
325
+
326
+ .ktl-list-module_advancedSearch_XNy88:hover {
327
+ background: rgba(255, 255, 255, .1);
328
+ }
329
+
330
+ .ktl-list-module_advancedSearch_XNy88:focus {
331
+ outline: none;
332
+ box-shadow: rgba(107, 87, 255, 0.8) 0 0 0 4px;
333
+ }
334
+
335
+ @media (min-width: 768px) {
336
+ .ktl-list-module_results_LlxqY {
337
+ max-height: 434px;
338
+ }
339
+ .ktl-list-module_topBar_OO0XT {
340
+ display: flex;
341
+ align-items: center;
342
+ justify-content: space-between;
343
+ padding: 34px 32px 14px 32px;
344
+ }
345
+ }
346
+ .ktl-empty-module_empty_xh1i- {
347
+ box-sizing: border-box;
348
+ border: 1px solid rgba(255, 255, 255, 0.2);
349
+ background: #323236;
350
+ padding: 32px;
351
+ }
352
+ .ktl-loading-module_loading_CtOhW {
353
+ box-sizing: border-box;
354
+ height: 92px;
355
+ border: 1px solid rgba(255, 255, 255, 0.2);
356
+ background: #323236;
357
+ display: flex;
358
+ justify-content: center;
359
+ align-items: center;
360
+ text-align: left;
361
+ }
362
+ .ktl-loading-module_loading_CtOhW > svg {
363
+ fill: #6B57FF;
364
+ }
365
+ .ktl-quick-search-module_wrapper_kkbQQ {
366
+ box-sizing: border-box;
367
+ position: absolute;
368
+ left: 8px;
369
+ right: 8px;
370
+ bottom: -8px;
371
+ transform: translateY(100%);
372
+ }
373
+
374
+ @media (min-width: 768px) {
375
+ .ktl-quick-search-module_wrapper_kkbQQ {
376
+ left: 0;
377
+ right: 0;
378
+ }
379
+ }
380
+ .ktl-full-search-module_fullSearch_MTU8t {
381
+ display: none;
382
+ box-sizing: border-box;
383
+ position: fixed;
384
+ width: 100%;
385
+ height: 100%;
386
+ top: 0;
387
+ left: 0;
388
+ background: #ffffff;
389
+ overflow: scroll;
390
+ }
391
+
392
+ .ktl-full-search-module_closeSearch_5vYDG {
393
+ padding: 0;
394
+ margin: 0;
395
+ border: 0;
396
+ background: none;
397
+ cursor: pointer;
398
+ position: absolute;
399
+ top: 40px;
400
+ right: 40px;
401
+ }
402
+
403
+ .ktl-full-search-module_wrapper_9rxXb {
404
+ max-width: 704px;
405
+ margin: 0 auto;
406
+ }
407
+
408
+ .ktl-full-search-module_header_Wltw0 {
409
+ width: 100%;
410
+ padding-top: 120px;
411
+ padding-bottom: 24px;
412
+ position: sticky;
413
+ top: 0;
414
+ left: 0;
415
+ background: #ffffff;
416
+ z-index: 10;
417
+ }
418
+
419
+ .ktl-full-search-module_switcher_o1RgM {
420
+ margin-top: 14px;
421
+ display: flex;
422
+ justify-content: flex-end;
423
+ }
424
+
425
+ .ktl-full-search-module_results_svcSE {
426
+ margin-top: 14px;
427
+ }
428
+
429
+ @media (min-width: 768px) {
430
+ .ktl-full-search-module_fullSearch_MTU8t {
431
+ display: block;
432
+ }
433
+ }
434
+ .ktl-loading-module_loader_B2IQl {
435
+ margin: 24px 0;
436
+ }
437
+ .ktl-loading-module_loader_B2IQl > svg {
438
+ fill: #6B57FF;
439
+ }
440
+ .ktl-empty-module_wrapper_cNB8Y {
441
+ display: block;
442
+ }
443
+
444
+ .ktl-empty-module_title_p2FMj {
445
+ margin-bottom: 24px;
446
+ }
447
+
448
+ .ktl-empty-module_image_6Xr6L {
449
+ display: flex;
450
+ justify-content: flex-end;
451
+ margin-top: 16px;
452
+ }
453
+ .ktl-chapters-module_chapters_J0wLB {
454
+ border-left: 1px solid var(--ktl-light-dark-20);
455
+ padding-left: 12px;
456
+ margin-top: 24px;
457
+ }
458
+
459
+ .ktl-chapters-module_chapterTitle_b6Rdz {
460
+ border-bottom-color: transparent;
461
+ }
462
+
463
+ .ktl-chapters-module_chapterTitle_b6Rdz em {
464
+ background: rgba(127, 82, 255, 0.2);
465
+ font-style: normal;
466
+ }
467
+
468
+ .ktl-chapters-module_singleChapter_zSmx2:not(:last-child) {
469
+ margin-bottom: 12px;
470
+ }
471
+
472
+ .ktl-chapters-module_headliner_ZBuf9 {
473
+ margin: 0;
474
+ }
475
+
476
+ .ktl-chapters-module_snippet_yROJo {
477
+ margin-top: 8px;
478
+ color: rgba(39, 40, 44, 0.7);
479
+ }
480
+
481
+ .ktl-chapters-module_snippet_yROJo em {
482
+ background: rgba(127, 82, 255, 0.2);
483
+ font-style: normal;
484
+ }
485
+
486
+ .ktl-chapters-module_extraSection_lsZfw {
487
+ display: none;
488
+ }
489
+
490
+ .ktl-chapters-module_visibleSection_wQyvM {
491
+ display: block;
492
+ }
493
+
494
+ .ktl-chapters-module_moreButton_98oqy {
495
+ margin-top: 12px;
496
+ }
497
+ .ktl-hit-list-module_hitList_1MP6m {
498
+ margin: 24px 0;
499
+ }
500
+
501
+ .ktl-hit-list-module_titleLink_rdJ6u {
502
+ border-bottom-color: transparent;
503
+ }
504
+
505
+ .ktl-hit-list-module_titleLink_rdJ6u em {
506
+ background: rgba(127, 82, 255, 0.2);
507
+ font-style: normal;
508
+ }
509
+
510
+ .ktl-search-box-module_searchBox_0SgE9 {
511
+ position: relative;
512
+ width: 408px;
513
+ }
514
+
515
+ @media (max-width: 767px) {
516
+ .ktl-search-box-module_searchBox_0SgE9 {
517
+ background: var(--ktl-dark-100);
518
+ width: auto;
519
+ position: absolute;
520
+ top: 0;
521
+ left: 0;
522
+ right: 0;
523
+ bottom: 0;
524
+ padding: 4px;
525
+ }
526
+ }
527
+
275
528
  :root {
276
529
  --ktl-light-grey: #f4f4f4;
277
530
  --ktl-dark-100: rgba(39, 40, 44, 1);
@@ -0,0 +1,5 @@
1
+ function isMacOs() {
2
+ return window.navigator.appVersion.indexOf('Mac') !== -1;
3
+ }
4
+
5
+ export { isMacOs };
@@ -0,0 +1,3 @@
1
+ const ESC_CODE = 27;
2
+ const KEY_K_CODE = 75;
3
+ export { ESC_CODE, KEY_K_CODE };
@@ -0,0 +1,16 @@
1
+ import React__default from 'react';
2
+ import { useTextStyles } from '@rescui/typography';
3
+ import styles from './empty.module.pcss.js';
4
+
5
+ const EmptyResult = ({
6
+ placeholder
7
+ }) => {
8
+ const textCn = useTextStyles();
9
+ return React__default.createElement("div", {
10
+ className: styles.empty
11
+ }, React__default.createElement("div", {
12
+ className: textCn('rs-h4')
13
+ }, placeholder));
14
+ };
15
+
16
+ export { EmptyResult };
@@ -0,0 +1,4 @@
1
+ var styles = {
2
+ "empty": "ktl-empty-module_empty_xh1i-"
3
+ };
4
+ export { styles as default };
@@ -0,0 +1,31 @@
1
+ import React__default, { useMemo } from 'react';
2
+ import { Result } from '../result/result.js';
3
+ import { useTextStyles } from '@rescui/typography';
4
+ import { isMacOs } from '../../is-macos.js';
5
+ import styles from './list.module.pcss.js';
6
+
7
+ const ResultsList = ({
8
+ results,
9
+ searchString,
10
+ toggleFullSearch
11
+ }) => {
12
+ const textCn = useTextStyles();
13
+ const controlledSearchString = useMemo(() => searchString.length > 5 ? `${searchString.substring(0, 5)}...` : searchString, [searchString]);
14
+ return React__default.createElement("div", {
15
+ className: styles.results
16
+ }, results.length ? React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
17
+ className: styles.topBar
18
+ }, React__default.createElement("div", {
19
+ className: textCn('rs-text-3')
20
+ }, "Showing results for \u00AB", controlledSearchString, "\u00BB"), React__default.createElement("button", {
21
+ className: styles.advancedSearch,
22
+ onClick: toggleFullSearch
23
+ }, React__default.createElement("div", {
24
+ className: textCn('rs-text-3')
25
+ }, "Advanced search ", isMacOs() ? '⌘K' : 'Ctrl+K'))), results.map((searchResult, index) => React__default.createElement(Result, {
26
+ key: index,
27
+ hit: searchResult
28
+ }))) : null);
29
+ };
30
+
31
+ export { ResultsList };
@@ -0,0 +1,6 @@
1
+ var styles = {
2
+ "results": "ktl-list-module_results_LlxqY",
3
+ "topBar": "ktl-list-module_topBar_OO0XT",
4
+ "advancedSearch": "ktl-list-module_advancedSearch_XNy88"
5
+ };
6
+ export { styles as default };
@@ -0,0 +1,14 @@
1
+ import React__default from 'react';
2
+ import { LoadingIcon } from '@rescui/icons';
3
+ import styles from './loading.module.pcss.js';
4
+
5
+ const LoadingResults = () => {
6
+ return React__default.createElement("div", {
7
+ className: styles.loading
8
+ }, React__default.createElement(LoadingIcon, {
9
+ theme: 'dark',
10
+ size: 'l'
11
+ }));
12
+ };
13
+
14
+ export { LoadingResults };