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

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