@jetbrains/kotlin-web-site-ui 4.8.0-alpha.2 → 4.8.0-alpha.3

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.
@@ -0,0 +1,46 @@
1
+ .ktl-nav-item-module_navItem_gRy22 {
2
+ padding: 0 12px;
3
+ height: 52px;
4
+ cursor: pointer;
5
+ display: inline-flex;
6
+ align-items: center;
7
+ position: relative;
8
+ box-sizing: border-box;
9
+ border: 0;
10
+ background: none;
11
+ color: #ffffff;
12
+ }
13
+ .ktl-nav-item-module_navItem_gRy22:hover {
14
+ background: rgba(255, 255, 255, 0.10);
15
+ }
16
+
17
+ .ktl-nav-item-module_rightIcon_XlxMF {
18
+ flex-direction: row-reverse;
19
+ }
20
+
21
+ .ktl-nav-item-module_navItemActive_gI8Nv::after {
22
+ content: '';
23
+ width: 100%;
24
+ height: 2px;
25
+ background: #ffffff;
26
+ position: absolute;
27
+ bottom: 0;
28
+ left: 0;
29
+ }
30
+
31
+ .ktl-nav-item-module_title_9VXwr {
32
+ display: block;
33
+ }
34
+
35
+ .ktl-nav-item-module_titleWithIcon_CVqpS {
36
+ margin-left: 8px;
37
+ }
38
+
39
+ .ktl-nav-item-module_titleWithIconRight_FwEnm {
40
+ margin-left: 0;
41
+ margin-right: 8px;
42
+ }
43
+
44
+ .ktl-nav-item-module_titleWithoutIcon_XgnMl {
45
+ margin: 0;
46
+ }
@@ -0,0 +1,34 @@
1
+ import './index.css';
2
+ import React from 'react';
3
+ import cn from 'classnames';
4
+ import styles from './nav-item.module.pcss.js';
5
+ import { useTextStyles } from '@rescui/typography';
6
+
7
+ const NavItem = ({
8
+ children,
9
+ icon,
10
+ active,
11
+ iconPosition,
12
+ onClick
13
+ }) => {
14
+ const textCn = useTextStyles();
15
+ const navItemClass = cn(styles.navItem, {
16
+ [styles.navItemActive]: active,
17
+ [styles.rightIcon]: iconPosition === 'right'
18
+ });
19
+ const textStyles = cn(styles.title, {
20
+ [styles.titleWithIcon]: icon,
21
+ [styles.titleWithIconRight]: iconPosition === 'right',
22
+ [styles.titleWithoutIcon]: !children
23
+ });
24
+ return React.createElement("div", {
25
+ className: navItemClass,
26
+ onClick: onClick
27
+ }, icon ? icon : null, React.createElement("div", {
28
+ className: cn(textCn('rs-text-2', {
29
+ hardness: 'hard'
30
+ }), textStyles)
31
+ }, children));
32
+ };
33
+
34
+ export { NavItem, NavItem as default };
@@ -0,0 +1,10 @@
1
+ var styles = {
2
+ "navItem": "ktl-nav-item-module_navItem_gRy22",
3
+ "rightIcon": "ktl-nav-item-module_rightIcon_XlxMF",
4
+ "navItemActive": "ktl-nav-item-module_navItemActive_gI8Nv",
5
+ "title": "ktl-nav-item-module_title_9VXwr",
6
+ "titleWithIcon": "ktl-nav-item-module_titleWithIcon_CVqpS",
7
+ "titleWithIconRight": "ktl-nav-item-module_titleWithIconRight_FwEnm",
8
+ "titleWithoutIcon": "ktl-nav-item-module_titleWithoutIcon_XgnMl"
9
+ };
10
+ export { styles as default };
@@ -0,0 +1,108 @@
1
+ .ktl-sidebar-module_popup_bidR1 {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ z-index: 910;
8
+
9
+ --ktf-header-animation-timing: 250ms;
10
+ --ktf-header-animation-function: cubic-bezier(0.4, 0, 0.2, 1);
11
+ }
12
+
13
+ .ktl-sidebar-module_popup_bidR1::before {
14
+ display: block;
15
+ content: '';
16
+
17
+ position: absolute;
18
+ top: 0;
19
+ bottom: 0;
20
+ right: 0;
21
+ left: 0;
22
+
23
+ visibility: visible;
24
+ -webkit-backdrop-filter: blur(4px);
25
+ backdrop-filter: blur(4px);
26
+
27
+ transition: background-color var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
28
+ visibility var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
29
+ -webkit-backdrop-filter var(--ktf-header-animation-function) var(--ktf-header-animation-timing);
30
+
31
+ transition: background-color var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
32
+ visibility var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
33
+ backdrop-filter var(--ktf-header-animation-function) var(--ktf-header-animation-timing);
34
+
35
+ transition: background-color var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
36
+ visibility var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
37
+ backdrop-filter var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
38
+ -webkit-backdrop-filter var(--ktf-header-animation-function) var(--ktf-header-animation-timing);
39
+ will-change: background-color, visible;
40
+ }
41
+
42
+ .ktl-sidebar-module_popup_bidR1.ktl-sidebar-module_tabletMode_vcf0T {
43
+ --ktl-sidebar-width: 320px;
44
+ }
45
+
46
+ .ktl-sidebar-module_popup_bidR1.ktl-sidebar-module_mobileMode_yCmFY {
47
+ --ktl-sidebar-width: 100%;
48
+ }
49
+
50
+ @media (min-width: 473px) {
51
+
52
+ .ktl-sidebar-module_popup_bidR1:not(:is(.ktl-sidebar-module_tabletMode_vcf0T, .ktl-sidebar-module_mobileMode_yCmFY)) {
53
+ --ktl-sidebar-width: 320px
54
+ }
55
+ }
56
+
57
+ @media (max-width: 472px) {
58
+
59
+ .ktl-sidebar-module_popup_bidR1:not(:is(.ktl-sidebar-module_tabletMode_vcf0T, .ktl-sidebar-module_mobileMode_yCmFY)) {
60
+ --ktl-sidebar-width: 100%
61
+ }
62
+ }
63
+
64
+ .ktl-sidebar-module_content_SzdiT {
65
+ margin-left: auto;
66
+ height: 100%;
67
+ max-width: 100%;
68
+ width: var(--ktl-sidebar-width, auto);
69
+ }
70
+
71
+ .ktl-sidebar-module_dark_GNaUl::before {
72
+ background-color: rgba(0, 0, 0, 0.5);
73
+ }
74
+
75
+ .ktl-sidebar-module_dark_GNaUl > .ktl-sidebar-module_content_SzdiT {
76
+ background-color: var(--ktl-dark-100);
77
+ }
78
+
79
+ .ktl-sidebar-module_light_OnGcf::before {
80
+ background-color: rgba(0, 0, 0, 0.62);
81
+ }
82
+
83
+ .ktl-sidebar-module_light_OnGcf > .ktl-sidebar-module_content_SzdiT {
84
+ background-color: #fff;
85
+ }
86
+
87
+ .ktl-sidebar-module_popup_bidR1 > .ktl-sidebar-module_content_SzdiT {
88
+ transform: translateX(0);
89
+
90
+ transition: transform var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
91
+ visibility var(--ktf-header-animation-function) var(--ktf-header-animation-timing);
92
+ will-change: transform;
93
+ }
94
+
95
+ .ktl-sidebar-module_close_lN33m {
96
+ --ktf-header-animation-timing: 300ms;
97
+ pointer-events: none;
98
+ }
99
+
100
+ .ktl-sidebar-module_close_lN33m::before {
101
+ background: rgba(0, 0, 0, 0);
102
+ visibility: hidden;
103
+ }
104
+
105
+ .ktl-sidebar-module_close_lN33m > .ktl-sidebar-module_content_SzdiT {
106
+ transform: translateX(100%);
107
+ visibility: hidden;
108
+ }
@@ -0,0 +1,51 @@
1
+ import './index.css';
2
+ import React, { createContext, useContext, useRef, useCallback } from 'react';
3
+ import cn from 'classnames';
4
+ import { RemoveScrollBar } from 'react-remove-scroll-bar';
5
+ import { useTheme } from '@rescui/ui-contexts';
6
+ import styles from './sidebar.module.css.js';
7
+ const SidebarContext = createContext({});
8
+
9
+ function useSidebarContext() {
10
+ return useContext(SidebarContext);
11
+ }
12
+
13
+ function Sidebar({
14
+ className,
15
+ classNameContent,
16
+ mode,
17
+ children,
18
+ isOpen,
19
+ onClose
20
+ }) {
21
+ const ref = useRef(null);
22
+ const theme = useTheme();
23
+ const onToggleClick = useCallback(e => {
24
+ if (e.currentTarget == e.target) onClose();
25
+ }, [onClose]);
26
+ const classes = cn(className, styles.popup, styles[theme || 'light'], {
27
+ [styles.close]: !isOpen,
28
+ [styles[`${mode}Mode`]]: Boolean(mode && styles[`${mode}Mode`])
29
+ });
30
+ const disableProps = {};
31
+
32
+ if (!isOpen) {
33
+ disableProps.tabIndex = -1;
34
+ disableProps.role = 'none';
35
+ }
36
+
37
+ return React.createElement(SidebarContext.Provider, {
38
+ value: {
39
+ onClose
40
+ }
41
+ }, React.createElement("div", {
42
+ className: classes,
43
+ onClick: onToggleClick,
44
+ ...disableProps
45
+ }, isOpen && React.createElement(RemoveScrollBar, null), React.createElement("div", {
46
+ ref: ref,
47
+ className: cn(classNameContent, styles.content)
48
+ }, children)));
49
+ }
50
+
51
+ export { Sidebar, SidebarContext, useSidebarContext };
@@ -0,0 +1,10 @@
1
+ var styles = {
2
+ "popup": "ktl-sidebar-module_popup_bidR1",
3
+ "tabletMode": "ktl-sidebar-module_tabletMode_vcf0T",
4
+ "mobileMode": "ktl-sidebar-module_mobileMode_yCmFY",
5
+ "content": "ktl-sidebar-module_content_SzdiT",
6
+ "dark": "ktl-sidebar-module_dark_GNaUl",
7
+ "light": "ktl-sidebar-module_light_OnGcf",
8
+ "close": "ktl-sidebar-module_close_lN33m"
9
+ };
10
+ export { styles as default };
@@ -0,0 +1,145 @@
1
+ .ktl-sidebar-module_popup_bidR1 {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ z-index: 910;
8
+
9
+ --ktf-header-animation-timing: 250ms;
10
+ --ktf-header-animation-function: cubic-bezier(0.4, 0, 0.2, 1);
11
+ }
12
+
13
+ .ktl-sidebar-module_popup_bidR1::before {
14
+ display: block;
15
+ content: '';
16
+
17
+ position: absolute;
18
+ top: 0;
19
+ bottom: 0;
20
+ right: 0;
21
+ left: 0;
22
+
23
+ visibility: visible;
24
+ -webkit-backdrop-filter: blur(4px);
25
+ backdrop-filter: blur(4px);
26
+
27
+ transition: background-color var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
28
+ visibility var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
29
+ -webkit-backdrop-filter var(--ktf-header-animation-function) var(--ktf-header-animation-timing);
30
+
31
+ transition: background-color var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
32
+ visibility var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
33
+ backdrop-filter var(--ktf-header-animation-function) var(--ktf-header-animation-timing);
34
+
35
+ transition: background-color var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
36
+ visibility var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
37
+ backdrop-filter var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
38
+ -webkit-backdrop-filter var(--ktf-header-animation-function) var(--ktf-header-animation-timing);
39
+ will-change: background-color, visible;
40
+ }
41
+
42
+ .ktl-sidebar-module_popup_bidR1.ktl-sidebar-module_tabletMode_vcf0T {
43
+ --ktl-sidebar-width: 320px;
44
+ }
45
+
46
+ .ktl-sidebar-module_popup_bidR1.ktl-sidebar-module_mobileMode_yCmFY {
47
+ --ktl-sidebar-width: 100%;
48
+ }
49
+
50
+ @media (min-width: 473px) {
51
+
52
+ .ktl-sidebar-module_popup_bidR1:not(:is(.ktl-sidebar-module_tabletMode_vcf0T, .ktl-sidebar-module_mobileMode_yCmFY)) {
53
+ --ktl-sidebar-width: 320px
54
+ }
55
+ }
56
+
57
+ @media (max-width: 472px) {
58
+
59
+ .ktl-sidebar-module_popup_bidR1:not(:is(.ktl-sidebar-module_tabletMode_vcf0T, .ktl-sidebar-module_mobileMode_yCmFY)) {
60
+ --ktl-sidebar-width: 100%
61
+ }
62
+ }
63
+
64
+ .ktl-sidebar-module_content_SzdiT {
65
+ margin-left: auto;
66
+ height: 100%;
67
+ max-width: 100%;
68
+ width: var(--ktl-sidebar-width, auto);
69
+ }
70
+
71
+ .ktl-sidebar-module_dark_GNaUl::before {
72
+ background-color: rgba(0, 0, 0, 0.5);
73
+ }
74
+
75
+ .ktl-sidebar-module_dark_GNaUl > .ktl-sidebar-module_content_SzdiT {
76
+ background-color: var(--ktl-dark-100);
77
+ }
78
+
79
+ .ktl-sidebar-module_light_OnGcf::before {
80
+ background-color: rgba(0, 0, 0, 0.62);
81
+ }
82
+
83
+ .ktl-sidebar-module_light_OnGcf > .ktl-sidebar-module_content_SzdiT {
84
+ background-color: #fff;
85
+ }
86
+
87
+ .ktl-sidebar-module_popup_bidR1 > .ktl-sidebar-module_content_SzdiT {
88
+ transform: translateX(0);
89
+
90
+ transition: transform var(--ktf-header-animation-function) var(--ktf-header-animation-timing),
91
+ visibility var(--ktf-header-animation-function) var(--ktf-header-animation-timing);
92
+ will-change: transform;
93
+ }
94
+
95
+ .ktl-sidebar-module_close_lN33m {
96
+ --ktf-header-animation-timing: 300ms;
97
+ pointer-events: none;
98
+ }
99
+
100
+ .ktl-sidebar-module_close_lN33m::before {
101
+ background: rgba(0, 0, 0, 0);
102
+ visibility: hidden;
103
+ }
104
+
105
+ .ktl-sidebar-module_close_lN33m > .ktl-sidebar-module_content_SzdiT {
106
+ transform: translateX(100%);
107
+ visibility: hidden;
108
+ }
109
+
110
+ .ktl-popup-module_popup_b34tS {
111
+ display: flex;
112
+ flex-direction: column;
113
+ }
114
+
115
+ .ktl-popup-module_menu_wZMEB {
116
+ padding: 0;
117
+ margin: 0;
118
+ }
119
+
120
+ .ktl-menu-header-module_header_nm8jO {
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: space-between;
124
+ padding-left: var(--ktl-box-block-l);
125
+ border-bottom: 1px solid transparent;
126
+ margin-bottom: var(--ktl-box-block-m);
127
+ }
128
+
129
+ .ktl-menu-header-module_light_3UtZR {
130
+ border-bottom-color: var(--ktl-divider-color);
131
+ }
132
+
133
+ .ktl-menu-header-module_dark_jdymL {
134
+ border-bottom-color: rgba(255, 255, 255, 0.30);
135
+ }
136
+
137
+ .ktl-menu-header-module_header_nm8jO > .ktl-menu-header-module_trigger_FbJ59 {
138
+ display: flex;
139
+ align-items: center;
140
+ justify-content: center;
141
+ cursor: pointer;
142
+ border-radius: 50%;
143
+ width: 52px;
144
+ height: 52px;
145
+ }
@@ -0,0 +1,46 @@
1
+ import React, { createContext, useRef, useCallback } from 'react';
2
+ import cn from 'classnames';
3
+ import { RemoveScrollBar } from 'react-remove-scroll-bar';
4
+ import { useTheme } from '@rescui/ui-contexts';
5
+ import styles from './sidebar.module.css.js';
6
+ const SidebarContext = createContext({});
7
+
8
+ function Sidebar({
9
+ className,
10
+ classNameContent,
11
+ mode,
12
+ children,
13
+ isOpen,
14
+ onClose
15
+ }) {
16
+ const ref = useRef(null);
17
+ const theme = useTheme();
18
+ const onToggleClick = useCallback(e => {
19
+ if (e.currentTarget == e.target) onClose();
20
+ }, [onClose]);
21
+ const classes = cn(className, styles.popup, styles[theme || 'light'], {
22
+ [styles.close]: !isOpen,
23
+ [styles[`${mode}Mode`]]: Boolean(mode && styles[`${mode}Mode`])
24
+ });
25
+ const disableProps = {};
26
+
27
+ if (!isOpen) {
28
+ disableProps.tabIndex = -1;
29
+ disableProps.role = 'none';
30
+ }
31
+
32
+ return React.createElement(SidebarContext.Provider, {
33
+ value: {
34
+ onClose
35
+ }
36
+ }, React.createElement("div", {
37
+ className: classes,
38
+ onClick: onToggleClick,
39
+ ...disableProps
40
+ }, isOpen && React.createElement(RemoveScrollBar, null), React.createElement("div", {
41
+ ref: ref,
42
+ className: cn(classNameContent, styles.content)
43
+ }, children)));
44
+ }
45
+
46
+ export { Sidebar, SidebarContext };
@@ -0,0 +1,10 @@
1
+ var styles = {
2
+ "popup": "ktl-sidebar-module_popup_bidR1",
3
+ "tabletMode": "ktl-sidebar-module_tabletMode_vcf0T",
4
+ "mobileMode": "ktl-sidebar-module_mobileMode_yCmFY",
5
+ "content": "ktl-sidebar-module_content_SzdiT",
6
+ "dark": "ktl-sidebar-module_dark_GNaUl",
7
+ "light": "ktl-sidebar-module_light_OnGcf",
8
+ "close": "ktl-sidebar-module_close_lN33m"
9
+ };
10
+ export { styles as default };
@@ -0,0 +1,31 @@
1
+ import './index.css';
2
+ import React from 'react';
3
+ import cn from 'classnames';
4
+ import { Menu } from '@rescui/menu';
5
+ import { Sidebar } from '../sidebar/index.js';
6
+ import { SidebarMenuItem } from './menu-item.js';
7
+ import styles from './popup.module.css.js';
8
+ export { SidebarMenuHeader } from './menu-header.js';
9
+
10
+ function SidebarMenu({
11
+ className,
12
+ before,
13
+ activeIndex,
14
+ items,
15
+ onItemClick,
16
+ ...props
17
+ }) {
18
+ return React.createElement(Sidebar, { ...props,
19
+ className: cn(className, styles.popup)
20
+ }, before, React.createElement(Menu, {
21
+ className: styles.menu
22
+ }, items.map((item, i) => React.createElement(SidebarMenuItem, {
23
+ key: i,
24
+ isActive: i === activeIndex,
25
+ index: i,
26
+ ...item,
27
+ onClick: onItemClick
28
+ }))));
29
+ }
30
+
31
+ export { SidebarMenu };
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import cn from 'classnames';
3
+ import { useTheme } from '@rescui/ui-contexts';
4
+ import { CloseIcon } from '@rescui/icons';
5
+ import Button from '@rescui/button';
6
+ import styles from './menu-header.module.css.js';
7
+ import { useSidebarContext } from '@jetbrains/kotlin-web-site-ui/out/components/sidebar';
8
+
9
+ function SidebarMenuHeader({
10
+ className,
11
+ children,
12
+ onClose
13
+ }) {
14
+ const theme = useTheme();
15
+ const {
16
+ onClose: onCloseContext
17
+ } = useSidebarContext();
18
+ const close = onClose || onCloseContext;
19
+ return React.createElement("div", {
20
+ className: cn(styles[theme || 'light'], className, styles.header)
21
+ }, children, React.createElement(Button, {
22
+ "aria-label": "close menu",
23
+ mode: "clear",
24
+ className: styles.trigger,
25
+ onClick: close,
26
+ icon: React.createElement(CloseIcon, null)
27
+ }));
28
+ }
29
+
30
+ export { SidebarMenuHeader };
@@ -0,0 +1,7 @@
1
+ var styles = {
2
+ "header": "ktl-menu-header-module_header_nm8jO",
3
+ "light": "ktl-menu-header-module_light_3UtZR",
4
+ "dark": "ktl-menu-header-module_dark_jdymL",
5
+ "trigger": "ktl-menu-header-module_trigger_FbJ59"
6
+ };
7
+ export { styles as default };
@@ -0,0 +1,20 @@
1
+ import React, { useCallback } from 'react';
2
+ import { MenuItem } from '@rescui/menu';
3
+
4
+ function SidebarMenuItem({
5
+ index,
6
+ isActive,
7
+ onClick,
8
+ ...props
9
+ }) {
10
+ const handleClick = useCallback(e => {
11
+ if (onClick) onClick(e, index);
12
+ }, [onClick, index]);
13
+ return React.createElement(MenuItem, {
14
+ selected: isActive,
15
+ ...props,
16
+ onClick: handleClick
17
+ });
18
+ }
19
+
20
+ export { SidebarMenuItem };
@@ -0,0 +1,5 @@
1
+ var styles = {
2
+ "popup": "ktl-popup-module_popup_b34tS",
3
+ "menu": "ktl-popup-module_menu_wZMEB"
4
+ };
5
+ export { styles as default };
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.8.0-alpha.2",
4
+ "version": "4.8.0-alpha.3",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
7
7
  "files": [
@@ -53,6 +53,7 @@
53
53
  "@rescui/focus-manager": "^0.1.1",
54
54
  "@rescui/icons": "^0.12.0",
55
55
  "@rescui/input": "^0.4.6",
56
+ "@rescui/menu": "^0.9.4",
56
57
  "@rescui/switcher": "^0.2.2",
57
58
  "@rescui/tooltip": "^0.1.2",
58
59
  "@rescui/typography": "^0.7.3",