@jetbrains/kotlin-web-site-ui 4.0.0-alpha.2 → 4.1.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.
Files changed (77) hide show
  1. package/out/blocks/formik-wrapper/input.js +3 -3
  2. package/out/blocks/formik-wrapper/privacy-checkbox.js +17 -21
  3. package/out/blocks/formik-wrapper/privacy-notice.js +19 -28
  4. package/out/blocks/formik-wrapper/submit-button.js +3 -3
  5. package/out/components/cta-block/cta-block.js +17 -33
  6. package/out/components/footer/footer.js +30 -48
  7. package/out/components/footer/logo/logo.js +3 -5
  8. package/out/components/footer/nav/nav-item.js +11 -15
  9. package/out/components/footer/nav/nav-list.js +8 -11
  10. package/out/components/footer/social-list/social-item/social-item.js +3 -5
  11. package/out/components/footer/social-list/social-list.js +6 -7
  12. package/out/components/header/{consts.js → components/header/consts.js} +0 -0
  13. package/out/components/header/components/header/full-search/chapters/chapters.js +56 -0
  14. package/out/components/header/components/header/full-search/chapters/chapters.module.pcss.js +11 -0
  15. package/out/components/header/components/header/full-search/empty/empty.js +22 -0
  16. package/out/components/header/components/header/full-search/empty/empty.module.pcss.js +6 -0
  17. package/out/components/header/components/header/full-search/empty/full-search-empty.svg.js +1539 -0
  18. package/out/components/header/components/header/full-search/full-search.js +70 -0
  19. package/out/components/header/components/header/full-search/full-search.module.pcss.js +9 -0
  20. package/out/components/header/components/header/full-search/hit-list/hit-list.js +44 -0
  21. package/out/components/header/components/header/full-search/hit-list/hit-list.module.pcss.js +5 -0
  22. package/out/components/header/components/header/full-search/loading/loading.js +11 -0
  23. package/out/components/header/components/header/full-search/loading/loading.module.pcss.js +4 -0
  24. package/out/components/header/components/header/full-search/result/get-extended-hits.js +55 -0
  25. package/out/components/header/components/header/full-search/results-list/results-list.js +25 -0
  26. package/out/components/header/components/header/header.js +105 -0
  27. package/out/components/header/{header.module.pcss.js → components/header/header.module.pcss.js} +0 -0
  28. package/out/components/header/components/header/horizontal-menu/horizontal-menu.js +100 -0
  29. package/out/components/header/{horizontal-menu → components/header/horizontal-menu}/horizontal-menu.module.pcss.js +0 -0
  30. package/out/components/header/{index.js → components/header/index.js} +0 -0
  31. package/out/components/header/{logo-large → components/header/logo-large}/kotlin-logo-large.svg.js +0 -0
  32. package/out/components/header/{logo-large → components/header/logo-large}/logo-large.js +11 -17
  33. package/out/components/header/{logo-large → components/header/logo-large}/logo-large.module.pcss.js +0 -0
  34. package/out/components/header/{logo-small → components/header/logo-small}/kotlin-logo-small.svg.js +0 -0
  35. package/out/components/header/components/header/logo-small/logo-small.js +27 -0
  36. package/out/components/header/{logo-small → components/header/logo-small}/logo-small.module.pcss.js +0 -0
  37. package/out/components/header/{menu-popup → components/header/menu-popup}/menu-button/close-icon.svg.js +0 -0
  38. package/out/components/header/{menu-popup → components/header/menu-popup}/menu-button/hamburger-icon.svg.js +0 -0
  39. package/out/components/header/{menu-popup → components/header/menu-popup}/menu-button/menu-button.js +3 -5
  40. package/out/components/header/{menu-popup → components/header/menu-popup}/menu-button/menu-button.module.pcss.js +0 -0
  41. package/out/components/header/{menu-popup → components/header/menu-popup}/menu-popup.js +28 -37
  42. package/out/components/header/{menu-popup → components/header/menu-popup}/menu-popup.module.pcss.js +0 -0
  43. package/out/components/header/{nav-scheme.js → components/header/nav-scheme.js} +0 -0
  44. package/out/components/header/components/header/quick-search/empty/empty.js +16 -0
  45. package/out/components/header/components/header/quick-search/empty/empty.module.pcss.js +4 -0
  46. package/out/components/header/components/header/quick-search/list/list.js +31 -0
  47. package/out/components/header/components/header/quick-search/list/list.module.pcss.js +6 -0
  48. package/out/components/header/components/header/quick-search/loading/loading.js +14 -0
  49. package/out/components/header/components/header/quick-search/loading/loading.module.pcss.js +4 -0
  50. package/out/components/header/components/header/quick-search/quick-search.js +41 -0
  51. package/out/components/header/components/header/quick-search/quick-search.module.pcss.js +4 -0
  52. package/out/components/header/components/header/quick-search/result/result.js +30 -0
  53. package/out/components/header/components/header/quick-search/result/result.module.pcss.js +6 -0
  54. package/out/components/header/components/header/search-box/search-box.js +69 -0
  55. package/out/components/header/components/header/search-box/search-box.module.pcss.js +4 -0
  56. package/out/components/header/{search-button → components/header/search-button}/search-button.js +6 -6
  57. package/out/components/header/{search-button → components/header/search-button}/search-button.module.pcss.js +0 -0
  58. package/out/components/header/{search-button → components/header/search-button}/search.svg.js +0 -0
  59. package/out/components/header/components/header/search-wrapper/init-search.js +60 -0
  60. package/out/components/header/components/header/search-wrapper/search-const.js +13 -0
  61. package/out/components/header/components/header/search-wrapper/search-context.js +18 -0
  62. package/out/components/header/components/header/search-wrapper/search-with-algolia.js +58 -0
  63. package/out/components/header/components/header/search-wrapper/search-wrapper.js +40 -0
  64. package/out/components/header/components/header/search-wrapper/use-search.js +85 -0
  65. package/out/components/header/helper/is-macos.js +5 -0
  66. package/out/components/header/helper/key-codes.js +3 -0
  67. package/out/components/header/index.css +253 -0
  68. package/out/components/popup/popup.js +34 -40
  69. package/out/components/quotes-slider/quites-slider.js +33 -63
  70. package/out/components/top-menu/dropdown-menu/dropdown-menu.js +28 -40
  71. package/out/components/top-menu/horizontal-menu/horizontal-menu.js +13 -17
  72. package/out/components/top-menu/top-menu.js +19 -23
  73. package/out/components/youtube-player/youtube-player.js +24 -31
  74. package/package.json +13 -8
  75. package/out/components/header/header.js +0 -68
  76. package/out/components/header/horizontal-menu/horizontal-menu.js +0 -110
  77. package/out/components/header/logo-small/logo-small.js +0 -33
@@ -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 };
@@ -0,0 +1,105 @@
1
+ import React__default, { forwardRef, useState, useMemo, useRef, useImperativeHandle, useLayoutEffect, useCallback, useEffect } from 'react';
2
+ import { ThemeProvider } from '@rescui/ui-contexts';
3
+ import useResizeObserver from '@react-hook/resize-observer';
4
+ import OutsideClickHandler from 'react-outside-click-handler';
5
+ import { LogoLarge } from './logo-large/logo-large.js';
6
+ import styles from './header.module.pcss.js';
7
+ import { getNavScheme } from './nav-scheme.js';
8
+ import { HorizontalMenu } from './horizontal-menu/horizontal-menu.js';
9
+ import { SearchButton } from './search-button/search-button.js';
10
+ import { SearchBox } from './search-box/search-box.js';
11
+ import { MenuPopup } from './menu-popup/menu-popup.js';
12
+ import { LogoSmall } from './logo-small/logo-small.js';
13
+ import classNames from 'classnames';
14
+ import { SearchWrapper } from './search-wrapper/search-wrapper.js';
15
+ import { isMacOs } from '../../helper/is-macos.js';
16
+ import { KEY_K_CODE } from '../../helper/key-codes.js';
17
+ const MENU_POPUP_BREAKPOINT = 640;
18
+ const Header = forwardRef(({
19
+ productWebUrl,
20
+ hasSearch = false,
21
+ currentUrl,
22
+ currentTitle,
23
+ className,
24
+ hasBorder = true,
25
+ dropdownTheme = 'dark',
26
+ linkHandler,
27
+ isPlayground,
28
+ isUrlActive,
29
+ searchConfig
30
+ }, forwardedRef) => {
31
+ const [menuPopupExpanded, setMenuPopupExpanded] = useState(false);
32
+ const [isMenuPopupVisible, setIsMenuPopupVisible] = useState(false);
33
+ const [isSearchBoxVisible, setSearchBoxVisible] = useState(false);
34
+ const [fullSearchActive, setFullSearchActive] = useState(false);
35
+ const items = useMemo(() => getNavScheme(isUrlActive, currentUrl, isPlayground), [isUrlActive, currentUrl, isPlayground]);
36
+ const headerRef = useRef(null);
37
+ useImperativeHandle(forwardedRef, () => headerRef.current);
38
+ useLayoutEffect(() => {
39
+ setIsMenuPopupVisible((headerRef.current?.getBoundingClientRect?.().width ?? 0) <= MENU_POPUP_BREAKPOINT);
40
+ }, [headerRef]);
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]);
68
+ return React__default.createElement(ThemeProvider, {
69
+ theme: 'dark'
70
+ }, React__default.createElement(SearchWrapper, {
71
+ searchConfig: searchConfig
72
+ }, React__default.createElement("header", {
73
+ ref: headerRef,
74
+ className: classNames(styles.headerMenu, className, {
75
+ [styles.withMenuPopup]: menuPopupExpanded,
76
+ [styles.border]: hasBorder
77
+ })
78
+ }, isMenuPopupVisible && currentTitle && currentUrl && !menuPopupExpanded ? React__default.createElement(LogoSmall, {
79
+ homeTitle: currentTitle,
80
+ homeUrl: currentUrl
81
+ }) : React__default.createElement(LogoLarge, {
82
+ productWebUrl: productWebUrl
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, {
91
+ items: items,
92
+ theme: dropdownTheme,
93
+ linkHandler: linkHandler
94
+ }), React__default.createElement(SearchButton, {
95
+ onClick: handleSearchButtonClick,
96
+ isActive: hasSearch
97
+ }), isMenuPopupVisible && React__default.createElement(MenuPopup, {
98
+ items: items,
99
+ setExpand: setMenuPopupExpanded,
100
+ isExpanded: menuPopupExpanded,
101
+ headerRef: headerRef,
102
+ linkHandler: linkHandler
103
+ })))));
104
+ });
105
+ export { Header };
@@ -0,0 +1,100 @@
1
+ import classNames from 'classnames';
2
+ import React__default, { useState, useEffect } from 'react';
3
+ import styles from './horizontal-menu.module.pcss.js';
4
+ import { useTextStyles } from '@rescui/typography';
5
+
6
+ const DropdownMenu = ({
7
+ items,
8
+ isExpanded,
9
+ alignRight,
10
+ linkHandler
11
+ }) => {
12
+ const textCn = useTextStyles();
13
+ return React__default.createElement("ul", {
14
+ className: classNames(styles.dropdownMenu, textCn('rs-text-2'), {
15
+ [styles.dropdownMenuExpanded]: isExpanded,
16
+ [styles.dropdownMenuAlignRight]: alignRight
17
+ })
18
+ }, items.map((item, key) => {
19
+ const Tag = !item.isActive && item.url ? 'a' : 'span';
20
+ return React__default.createElement("li", {
21
+ key: key
22
+ }, React__default.createElement(Tag, Object.assign({
23
+ className: classNames(styles.dropdownMenuItem, {
24
+ [styles.active]: item.isActive
25
+ })
26
+ }, item.url ? {
27
+ href: item.url,
28
+ onClick: linkHandler ? event => item.url && linkHandler(event, item.url) : undefined
29
+ } : {}), item.title));
30
+ }));
31
+ };
32
+
33
+ const HorizontalMenuItem = ({
34
+ item,
35
+ onMouseEnter,
36
+ onMouseLeave,
37
+ isExpanded,
38
+ isLast,
39
+ linkHandler
40
+ }) => {
41
+ const Tag = item.isActive || !item.url ? 'span' : 'a';
42
+ const textCn = useTextStyles();
43
+
44
+ const handleEnter = () => onMouseEnter(item);
45
+
46
+ return React__default.createElement("li", {
47
+ className: styles.menuItemWrap,
48
+ onMouseEnter: handleEnter,
49
+ onMouseLeave: onMouseLeave
50
+ }, React__default.createElement(Tag, Object.assign({}, item.url ? {
51
+ href: item.url,
52
+ onClick: linkHandler ? event => item.url && linkHandler(event, item.url) : undefined
53
+ } : {}, {
54
+ key: item.title,
55
+ className: classNames(styles.menuItem, textCn('rs-text-2'), {
56
+ [styles.itemActive]: item.isActive,
57
+ [styles.expanded]: isExpanded && !!item.items?.length
58
+ })
59
+ }), item.title), !!item.items?.length && React__default.createElement(DropdownMenu, {
60
+ items: item.items,
61
+ isExpanded: isExpanded,
62
+ alignRight: isLast,
63
+ linkHandler: linkHandler
64
+ }));
65
+ };
66
+
67
+ const HorizontalMenu = ({
68
+ items,
69
+ theme,
70
+ linkHandler
71
+ }) => {
72
+ const [activeIndex, setActiveIndex] = useState(-1);
73
+ const [debouncedActiveIndex, setDebouncedActiveIndex] = useState(activeIndex);
74
+ useEffect(() => {
75
+ const handler = setTimeout(() => setDebouncedActiveIndex(activeIndex), activeIndex !== -1 ? 200 : 400);
76
+ return () => clearTimeout(handler);
77
+ }, [activeIndex]);
78
+
79
+ const handleEnter = item => setActiveIndex(items.findIndex(val => val === item));
80
+
81
+ const handleLeave = () => setActiveIndex(-1);
82
+
83
+ return React__default.createElement("nav", {
84
+ className: classNames(styles.nav, {
85
+ [styles.darkTheme]: theme === 'dark'
86
+ })
87
+ }, React__default.createElement("ul", {
88
+ className: styles.menuList
89
+ }, items.map((item, index) => React__default.createElement(HorizontalMenuItem, {
90
+ item: item,
91
+ onMouseEnter: handleEnter,
92
+ onMouseLeave: handleLeave,
93
+ isExpanded: index === debouncedActiveIndex,
94
+ isLast: index === items.length - 1,
95
+ key: index,
96
+ linkHandler: linkHandler
97
+ }))));
98
+ };
99
+
100
+ export { HorizontalMenu };
@@ -1,4 +1,4 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import React__default from 'react';
2
2
  import styles from './logo-large.module.pcss.js';
3
3
  import SvgKotlinLogoLarge from './kotlin-logo-large.svg.js';
4
4
  import classNames from 'classnames';
@@ -11,25 +11,19 @@ const LogoLarge = ({
11
11
  }) => {
12
12
  const version = productWebUrl ? getProductVersion(productWebUrl) : null;
13
13
  const textCn = useTextStyles();
14
- return jsxs("div", Object.assign({
14
+ return React__default.createElement("div", {
15
15
  className: classNames(styles.container, className, textCn('rs-text-3', {
16
16
  hardness: 'average'
17
17
  }))
18
- }, {
19
- children: [jsx("a", Object.assign({
20
- className: styles.link,
21
- href: KOTLINLANG_URL,
22
- "aria-label": "Kotlin Home Page"
23
- }, {
24
- children: jsx(SvgKotlinLogoLarge, {}, void 0)
25
- }), void 0), version && jsx("a", Object.assign({
26
- className: classNames(styles.versionTag),
27
- href: productWebUrl,
28
- target: "_blank"
29
- }, {
30
- children: version
31
- }), void 0)]
32
- }), void 0);
18
+ }, React__default.createElement("a", {
19
+ className: styles.link,
20
+ href: KOTLINLANG_URL,
21
+ "aria-label": "Kotlin Home Page"
22
+ }, React__default.createElement(SvgKotlinLogoLarge, null)), version && React__default.createElement("a", {
23
+ className: classNames(styles.versionTag),
24
+ href: productWebUrl,
25
+ target: "_blank"
26
+ }, version));
33
27
  };
34
28
 
35
29
  function getProductVersion(productWebUrl) {
@@ -0,0 +1,27 @@
1
+ import React__default from 'react';
2
+ import SvgKotlinLogoSmall from './kotlin-logo-small.svg.js';
3
+ import styles from './logo-small.module.pcss.js';
4
+ import classNames from 'classnames';
5
+ import { useTextStyles } from '@rescui/typography';
6
+ import { KOTLINLANG_URL } from '../consts.js';
7
+
8
+ const LogoSmall = ({
9
+ homeTitle,
10
+ homeUrl,
11
+ className
12
+ }) => {
13
+ const textCn = useTextStyles();
14
+ return React__default.createElement("div", {
15
+ className: classNames(styles.logoSmall, className)
16
+ }, React__default.createElement("a", {
17
+ href: KOTLINLANG_URL,
18
+ className: styles.iconWrap
19
+ }, React__default.createElement(SvgKotlinLogoSmall, {
20
+ className: styles.icon
21
+ })), React__default.createElement("a", {
22
+ href: homeUrl,
23
+ className: classNames(styles.link, textCn('rs-h3'))
24
+ }, homeTitle));
25
+ };
26
+
27
+ export { LogoSmall };
@@ -1,4 +1,4 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import React__default from 'react';
2
2
  import styles from './menu-button.module.pcss.js';
3
3
  import classNames from 'classnames';
4
4
  import SvgHamburgerIcon from './hamburger-icon.svg.js';
@@ -8,15 +8,13 @@ const MenuButton = ({
8
8
  onClick,
9
9
  isExpanded
10
10
  }) => {
11
- return jsx("button", Object.assign({
11
+ return React__default.createElement("button", {
12
12
  type: "button",
13
13
  className: classNames(styles.button),
14
14
  "aria-haspopup": "true",
15
15
  "aria-label": "Open the navigation",
16
16
  onClick: onClick
17
- }, {
18
- children: isExpanded ? jsx(SvgCloseIcon, {}, void 0) : jsx(SvgHamburgerIcon, {}, void 0)
19
- }), void 0);
17
+ }, isExpanded ? React__default.createElement(SvgCloseIcon, null) : React__default.createElement(SvgHamburgerIcon, null));
20
18
  };
21
19
 
22
20
  export { MenuButton };
@@ -1,5 +1,4 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { useRef, useState, useEffect, useLayoutEffect, useCallback, Fragment as Fragment$1 } from 'react';
1
+ import React__default, { useRef, useState, useEffect, useLayoutEffect, useCallback, Fragment } from 'react';
3
2
  import styles from './menu-popup.module.pcss.js';
4
3
  import classNames from 'classnames';
5
4
  import { MenuButton } from './menu-button/menu-button.js';
@@ -16,7 +15,7 @@ const MenuListItem = ({
16
15
  '--level': level
17
16
  };
18
17
  const handleClick = useCallback(event => linkHandler && item.url && linkHandler(event, item.url), []);
19
- return jsx(Tag, Object.assign({}, item.url ? {
18
+ return React__default.createElement(Tag, Object.assign({}, item.url ? {
20
19
  href: item.url,
21
20
  onClick: handleClick
22
21
  } : {}, {
@@ -26,9 +25,7 @@ const MenuListItem = ({
26
25
  [styles.activeWithChild]: item.items && item.items.length
27
26
  }),
28
27
  style: style
29
- }, {
30
- children: item.title
31
- }), void 0);
28
+ }), item.title);
32
29
  };
33
30
 
34
31
  const MenuList = ({
@@ -36,19 +33,17 @@ const MenuList = ({
36
33
  level,
37
34
  linkHandler
38
35
  }) => {
39
- return jsx(Fragment, {
40
- children: items.map((item, i) => jsxs(Fragment$1, {
41
- children: [jsx(MenuListItem, {
42
- item: item,
43
- level: level,
44
- linkHandler: linkHandler
45
- }, void 0), item.items && item.items.length > 0 && jsx(MenuList, {
46
- items: item.items,
47
- level: level + 1,
48
- linkHandler: linkHandler
49
- }, void 0)]
50
- }, i))
51
- }, void 0);
36
+ return React__default.createElement(React__default.Fragment, null, items.map((item, i) => React__default.createElement(Fragment, {
37
+ key: i
38
+ }, React__default.createElement(MenuListItem, {
39
+ item: item,
40
+ level: level,
41
+ linkHandler: linkHandler
42
+ }), item.items && item.items.length > 0 && React__default.createElement(MenuList, {
43
+ items: item.items,
44
+ level: level + 1,
45
+ linkHandler: linkHandler
46
+ }))));
52
47
  };
53
48
 
54
49
  const MenuPopup = ({
@@ -81,24 +76,20 @@ const MenuPopup = ({
81
76
 
82
77
  setExpand(!isExpanded);
83
78
  }, [isExpanded, navRef]);
84
- return jsxs(Fragment, {
85
- children: [jsx(MenuButton, {
86
- onClick: handleClick,
87
- isExpanded: isExpanded
88
- }, void 0), jsx("nav", Object.assign({
89
- style: navStyle,
90
- ref: navRef,
91
- className: classNames(styles.menuPopup, textCn('rs-text-2'), {
92
- [styles.menuPopupExpanded]: isExpanded
93
- })
94
- }, {
95
- children: jsx(MenuList, {
96
- items: items,
97
- level: 0,
98
- linkHandler: linkHandler
99
- }, void 0)
100
- }), void 0)]
101
- }, void 0);
79
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement(MenuButton, {
80
+ onClick: handleClick,
81
+ isExpanded: isExpanded
82
+ }), React__default.createElement("nav", {
83
+ style: navStyle,
84
+ ref: navRef,
85
+ className: classNames(styles.menuPopup, textCn('rs-text-2'), {
86
+ [styles.menuPopupExpanded]: isExpanded
87
+ })
88
+ }, React__default.createElement(MenuList, {
89
+ items: items,
90
+ level: 0,
91
+ linkHandler: linkHandler
92
+ })));
102
93
  };
103
94
 
104
95
  export { MenuPopup };