@jetbrains/kotlin-web-site-ui 4.3.0-next-layout.7 → 4.4.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 (35) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/out/blocks/formik-wrapper/input.js +3 -2
  3. package/out/blocks/formik-wrapper/submit-button.js +2 -2
  4. package/out/components/footer/index.css +6 -3
  5. package/out/components/header/full-search/full-search.js +8 -1
  6. package/out/components/header/header.js +7 -16
  7. package/out/components/header/header.module.pcss.js +1 -2
  8. package/out/components/header/horizontal-menu/horizontal-menu.js +12 -11
  9. package/out/components/header/index.css +120 -71
  10. package/out/components/header/index.js +1 -1
  11. package/out/components/header/logo-small/kotlin-logo-small.svg.js +18 -16
  12. package/out/components/header/logo-small/logo-small.js +1 -1
  13. package/out/components/header/menu-popup/menu-button/menu-button.js +8 -5
  14. package/out/components/header/menu-popup/menu-list/menu-list.js +33 -0
  15. package/out/components/header/menu-popup/menu-list/menu-list.module.pcss.js +4 -0
  16. package/out/components/header/menu-popup/menu-list-item/menu-list-item.js +28 -0
  17. package/out/components/header/menu-popup/menu-list-item/menu-list-item.module.pcss.js +7 -0
  18. package/out/components/header/menu-popup/menu-popup.js +3 -43
  19. package/out/components/header/menu-popup/menu-popup.module.pcss.js +0 -4
  20. package/out/components/header/nav-scheme.js +9 -3
  21. package/out/components/header/search-button/search-button.js +13 -2
  22. package/out/components/header/search-button/search-button.module.pcss.js +2 -1
  23. package/out/components/popup/popup.js +4 -4
  24. package/out/components/top-menu/index.css +92 -125
  25. package/out/components/top-menu/top-menu.js +20 -13
  26. package/out/components/top-menu/{dropdown-menu → vertical-menu}/arrow-dropdown-icon.svg.js +0 -0
  27. package/out/components/top-menu/vertical-menu/vertical-menu.js +123 -0
  28. package/out/components/top-menu/vertical-menu/vertical-menu.module.pcss.js +13 -0
  29. package/out/components/typography/index.css +2 -1
  30. package/out/components/youtube-player/index.css +2 -1
  31. package/package.json +15 -8
  32. package/out/components/header/menu-popup/menu-button/close-icon.svg.js +0 -35
  33. package/out/components/header/menu-popup/menu-button/hamburger-icon.svg.js +0 -35
  34. package/out/components/top-menu/dropdown-menu/dropdown-menu.js +0 -71
  35. package/out/components/top-menu/dropdown-menu/dropdown-menu.module.pcss.js +0 -15
@@ -0,0 +1,123 @@
1
+ import React__default, { useState, useCallback, useEffect, useRef, useLayoutEffect } from 'react';
2
+ import classNames from 'classnames';
3
+ import styles from './vertical-menu.module.pcss.js';
4
+ import { useTextStyles } from '@rescui/typography';
5
+ import SvgArrowDropdownIcon from './arrow-dropdown-icon.svg.js';
6
+ import { useTheme } from '@rescui/ui-contexts';
7
+ import Button from '@rescui/button';
8
+ import { CloseIcon } from '@rescui/icons';
9
+ import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
10
+ import { createPortal } from 'react-dom';
11
+
12
+ const VerticalMenu = ({
13
+ homeUrl,
14
+ title,
15
+ mobileTitle = 'Overview',
16
+ items,
17
+ activeIndex,
18
+ linkHandler,
19
+ mobileOverview = true,
20
+ topMenuRef
21
+ }) => {
22
+ const textCn = useTextStyles();
23
+
24
+ let _items = (mobileOverview ? [{
25
+ title: mobileTitle,
26
+ url: homeUrl
27
+ }] : []).concat(items);
28
+
29
+ const _activeIndex = mobileOverview ? activeIndex + 1 : activeIndex;
30
+
31
+ const activeItem = _items[_activeIndex];
32
+ const [isExpanded, setIsExpanded] = useState(false);
33
+ const [portalRoot, setPortalRoot] = useState(null);
34
+ const handleOpen = useCallback(() => {
35
+ setIsExpanded(true);
36
+ }, []);
37
+ const handleClose = useCallback(() => {
38
+ setIsExpanded(false);
39
+ }, []);
40
+ useEffect(() => {
41
+ if (typeof document !== `undefined`) {
42
+ setPortalRoot(document.body);
43
+ }
44
+ }, []);
45
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
46
+ className: classNames(styles.dropdownMenu, {
47
+ [styles.dropdownMenuExpanded]: isExpanded
48
+ })
49
+ }, React__default.createElement("button", {
50
+ className: classNames(styles.button),
51
+ "aria-haspopup": "true",
52
+ onClick: handleOpen
53
+ }, React__default.createElement("span", {
54
+ className: textCn('rs-text-2', {
55
+ hardness: 'hard'
56
+ })
57
+ }, activeItem.title), React__default.createElement(SvgArrowDropdownIcon, {
58
+ className: styles.icon
59
+ })), !!portalRoot && isExpanded && createPortal(React__default.createElement(VerticalMenuDropDown, {
60
+ title: title,
61
+ activeIndex: _activeIndex,
62
+ items: _items,
63
+ onClose: handleClose,
64
+ linkHandler: linkHandler,
65
+ topMenuRef: topMenuRef
66
+ }), portalRoot)));
67
+ };
68
+
69
+ const VerticalMenuDropDown = ({
70
+ title,
71
+ onClose,
72
+ items,
73
+ linkHandler,
74
+ activeIndex,
75
+ topMenuRef
76
+ }) => {
77
+ const textCn = useTextStyles();
78
+ const theme = useTheme();
79
+ const navRef = useRef(null);
80
+ const [navStyle, setNavStyle] = useState({});
81
+ useEffect(() => {
82
+ if (navRef.current) {
83
+ disableBodyScroll(navRef.current);
84
+ }
85
+
86
+ return clearAllBodyScrollLocks;
87
+ }, []);
88
+ useLayoutEffect(() => {
89
+ if (topMenuRef.current) {
90
+ setNavStyle({
91
+ top: topMenuRef.current.getBoundingClientRect().top
92
+ });
93
+ }
94
+ }, [topMenuRef]);
95
+ return React__default.createElement("nav", {
96
+ ref: navRef,
97
+ style: navStyle,
98
+ className: classNames(styles.dropdownList, {
99
+ [styles.dropdownListDarkTheme]: theme === 'dark'
100
+ })
101
+ }, React__default.createElement("div", {
102
+ className: styles.dropdownHeader
103
+ }, React__default.createElement("div", {
104
+ className: textCn('rs-text-2')
105
+ }, title), React__default.createElement(Button, {
106
+ mode: 'clear',
107
+ size: 'l',
108
+ icon: React__default.createElement(CloseIcon, null),
109
+ onClick: onClose
110
+ })), items.map((item, index) => React__default.createElement("a", {
111
+ key: item.url,
112
+ href: item.url,
113
+ className: classNames(styles.dropdownItem, textCn('rs-text-1', {
114
+ hardness: 'hard'
115
+ }), {
116
+ [styles.dropdownItemActive]: index === activeIndex
117
+ }),
118
+ onClick: event => linkHandler?.(event, item.url),
119
+ target: item.isExternal ? '_blank' : undefined
120
+ }, item.title)));
121
+ };
122
+
123
+ export { VerticalMenu };
@@ -0,0 +1,13 @@
1
+ var styles = {
2
+ "verticalMenu": "ktl-vertical-menu-module_vertical-menu_aLIbw",
3
+ "button": "ktl-vertical-menu-module_button_zqr20",
4
+ "buttonText": "ktl-vertical-menu-module_button-text_aXith",
5
+ "icon": "ktl-vertical-menu-module_icon_-Ieat",
6
+ "dropdownHeader": "ktl-vertical-menu-module_dropdown-header_77lTy",
7
+ "dropdownList": "ktl-vertical-menu-module_dropdown-list_N3KWV",
8
+ "dropdownItem": "ktl-vertical-menu-module_dropdown-item_XLfp4",
9
+ "dropdownItemActive": "ktl-vertical-menu-module_dropdown-item-active_iBUbj",
10
+ "verticalMenuExpanded": "ktl-vertical-menu-module_vertical-menu-expanded_kFaaI",
11
+ "dropdownListDarkTheme": "ktl-vertical-menu-module_dropdown-list-dark-theme_A1-Bw"
12
+ };
13
+ export { styles as default };
@@ -14,7 +14,8 @@
14
14
  --ktl-overlay-z-index: 900;
15
15
  --ktl-top-menu-z-index: 905;
16
16
  --ktl-header-z-index: 906;
17
- --ktl-header-height-mobile: 48px;
17
+ --ktl-mobile-dropdown-list-z-index: 907;
18
+ --ktl-header-height-mobile: 52px;
18
19
  --ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
19
20
  --rs-font-family-ui: var(--ktl-font-family-inter);
20
21
  }
@@ -14,7 +14,8 @@
14
14
  --ktl-overlay-z-index: 900;
15
15
  --ktl-top-menu-z-index: 905;
16
16
  --ktl-header-z-index: 906;
17
- --ktl-header-height-mobile: 48px;
17
+ --ktl-mobile-dropdown-list-z-index: 907;
18
+ --ktl-header-height-mobile: 52px;
18
19
  --ktl-font-family-inter: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
19
20
  --rs-font-family-ui: var(--ktl-font-family-inter);
20
21
  }
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.3.0-next-layout.7",
4
+ "version": "4.4.0-alpha.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
7
7
  "files": [
@@ -59,22 +59,26 @@
59
59
  "@rollup/plugin-babel": "^5.3.1",
60
60
  "@rollup/plugin-json": "^4.1.0",
61
61
  "@rollup/plugin-node-resolve": "^13.1.3",
62
- "@storybook/addon-actions": "^6.2.8",
63
- "@storybook/addon-essentials": "^6.2.8",
64
- "@storybook/addon-links": "^6.2.8",
65
- "@storybook/builder-webpack5": "^6.3.0-alpha.13",
66
- "@storybook/react": "^6.2.8",
62
+ "@storybook/addon-actions": "^6.5.13",
63
+ "@storybook/addon-essentials": "^6.5.13",
64
+ "@storybook/addon-links": "^6.5.13",
65
+ "@storybook/builder-webpack5": "^6.5.13",
66
+ "@storybook/manager-webpack5": "^6.5.13",
67
+ "@storybook/react": "^6.5.13",
67
68
  "@svgr/rollup": "^6.2.1",
68
69
  "@svgr/webpack": "^5.5.0",
69
70
  "@types/body-scroll-lock": "^3.1.0",
70
71
  "@types/cookie": "^0.4.1",
71
72
  "@types/fs-extra": "^9.0.13",
73
+ "@types/node": "^18.11.9",
74
+ "@types/postcss-import": "^14.0.0",
72
75
  "@types/react": "^17.0.0",
73
76
  "@types/react-dom": "^17.0.0",
74
77
  "@types/react-modal": "^3.13.1",
75
78
  "@types/react-outside-click-handler": "^1.3.1",
76
79
  "@types/react-swipeable-views": "^0.13.1",
77
80
  "@types/sha.js": "^2.4.0",
81
+ "@types/webpack": "^5.28.0",
78
82
  "@types/youtube": "^0.0.45",
79
83
  "@typescript-eslint/eslint-plugin": "^4.22.0",
80
84
  "@typescript-eslint/parser": "^4.22.0",
@@ -99,7 +103,7 @@
99
103
  "formik": "^2.2.9",
100
104
  "fs-extra": "^10.0.1",
101
105
  "mini-css-extract-plugin": "1.4.0",
102
- "postcss": "^8.2.12",
106
+ "postcss": "^8.4.19",
103
107
  "postcss-custom-media": "^8.0.0",
104
108
  "postcss-for": "^2.1.1",
105
109
  "postcss-import": "^14.1.0",
@@ -108,14 +112,17 @@
108
112
  "postcss-nested": "^5.0.5",
109
113
  "postcss-remove-global": "^0.1.1",
110
114
  "prettier": "2.2.1",
115
+ "prop-types": "^15.8.1",
111
116
  "query-string": "^7.0.1",
112
117
  "react": "^16.8.6",
118
+ "react-cache": "^2.0.0-alpha.1",
113
119
  "react-dom": "^16.8.6",
114
120
  "react-modal": "^3.14.4",
115
121
  "react-outside-click-handler": "^1.3.0",
116
122
  "react-remove-scroll-bar": "^2.2.0",
117
123
  "react-scrollbar-size": "^5.0.0",
118
124
  "react-swipeable-views": "^0.14.0",
125
+ "require-from-string": "^2.0.2",
119
126
  "rollup": "^2.70.1",
120
127
  "rollup-plugin-node-externals": "^4.0.0",
121
128
  "rollup-plugin-postcss": "^4.0.2",
@@ -125,7 +132,7 @@
125
132
  "svgo-loader": "^3.0.0",
126
133
  "the-platform": "^0.10.1",
127
134
  "ts-node": "^10.9.1",
128
- "typescript": "^4.2.4",
135
+ "typescript": "^4.9.3",
129
136
  "webpack": "^5.30.0",
130
137
  "webpack-cli": "^4.6.0",
131
138
  "whatwg-fetch": "^3.6.2"
@@ -1,35 +0,0 @@
1
- import * as React from 'react';
2
-
3
- var _path;
4
-
5
- function _extends() {
6
- _extends = Object.assign || function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
9
-
10
- for (var key in source) {
11
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12
- target[key] = source[key];
13
- }
14
- }
15
- }
16
-
17
- return target;
18
- };
19
-
20
- return _extends.apply(this, arguments);
21
- }
22
-
23
- const SvgCloseIcon = props => /*#__PURE__*/React.createElement("svg", _extends({
24
- width: 16,
25
- height: 16,
26
- fill: "none",
27
- xmlns: "http://www.w3.org/2000/svg"
28
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
29
- fillRule: "evenodd",
30
- clipRule: "evenodd",
31
- d: "M15.707 1.707 14.293.293 8 6.586 1.707.293.293 1.707 6.586 8 .293 14.293l1.414 1.414L8 9.414l6.293 6.293 1.414-1.414L9.414 8l6.293-6.293Z",
32
- fill: "currentColor"
33
- })));
34
-
35
- export { SvgCloseIcon as default };
@@ -1,35 +0,0 @@
1
- import * as React from 'react';
2
-
3
- var _path;
4
-
5
- function _extends() {
6
- _extends = Object.assign || function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
9
-
10
- for (var key in source) {
11
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12
- target[key] = source[key];
13
- }
14
- }
15
- }
16
-
17
- return target;
18
- };
19
-
20
- return _extends.apply(this, arguments);
21
- }
22
-
23
- const SvgHamburgerIcon = props => /*#__PURE__*/React.createElement("svg", _extends({
24
- width: 24,
25
- height: 24,
26
- fill: "none",
27
- xmlns: "http://www.w3.org/2000/svg"
28
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
29
- fillRule: "evenodd",
30
- clipRule: "evenodd",
31
- d: "M4 5h16v2H4V5Zm0 6h16v2H4v-2Zm16 6H4v2h16v-2Z",
32
- fill: "currentColor"
33
- })));
34
-
35
- export { SvgHamburgerIcon as default };
@@ -1,71 +0,0 @@
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 };
@@ -1,15 +0,0 @@
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 };