@gravity-ui/navigation 0.7.0 → 0.8.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.
- package/CHANGELOG.md +14 -0
- package/build/cjs/components/Settings/Settings.d.ts +1 -0
- package/build/cjs/components/Settings/__stories__/SettingsDemo.d.ts +2 -1
- package/build/cjs/components/Settings/__stories__/SettingsMobileDemo.d.ts +2 -2
- package/build/cjs/components/Settings/collect-settings.d.ts +1 -1
- package/build/cjs/components/Title/Title.d.ts +12 -0
- package/build/cjs/components/Title/index.d.ts +1 -0
- package/build/cjs/components/index.d.ts +2 -0
- package/build/cjs/index.js +428 -145
- package/build/cjs/index.js.map +1 -1
- package/build/esm/components/Settings/Settings.d.ts +1 -0
- package/build/esm/components/Settings/__stories__/SettingsDemo.d.ts +2 -1
- package/build/esm/components/Settings/__stories__/SettingsMobileDemo.d.ts +2 -2
- package/build/esm/components/Settings/collect-settings.d.ts +1 -1
- package/build/esm/components/Title/Title.d.ts +12 -0
- package/build/esm/components/Title/index.d.ts +1 -0
- package/build/esm/components/index.d.ts +2 -0
- package/build/esm/index.js +427 -147
- package/build/esm/index.js.map +1 -1
- package/package.json +3 -1
package/build/esm/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { Children, isValidElement, cloneElement, createElement, PureComponent, useState, useMemo, useCallback } from 'react';
|
|
3
|
-
import { useBodyScrollLock, Button, Icon, Popup, List, Tooltip, Hotkey, TextInput, Tabs, Loader } from '@gravity-ui/uikit';
|
|
2
|
+
import React__default, { Children, isValidElement, cloneElement, createElement, PureComponent, useState, useMemo, useCallback, useEffect } from 'react';
|
|
3
|
+
import { useBodyScrollLock, Button, Icon, Popup, List, Tooltip, Text, Hotkey, TextInput, Tabs, Loader, Sheet, eventBroker } from '@gravity-ui/uikit';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
import { Xmark } from '@gravity-ui/icons';
|
|
5
6
|
|
|
6
7
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7
8
|
|
|
@@ -87,48 +88,48 @@ function styleInject(css, ref) {
|
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
var css_248z$
|
|
91
|
-
styleInject(css_248z$
|
|
91
|
+
var css_248z$l = ".ycn-action-bar-group {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-start;\n margin: 0;\n padding: 0;\n}\n.ycn-action-bar-group_pull_left {\n margin-left: 0;\n margin-right: auto;\n}\n.ycn-action-bar-group_pull_right {\n margin-left: auto;\n margin-right: 0;\n}\n.ycn-action-bar-group_pull_center {\n margin-left: auto;\n margin-right: auto;\n}";
|
|
92
|
+
styleInject(css_248z$l);
|
|
92
93
|
|
|
93
|
-
const b$
|
|
94
|
+
const b$m = block('action-bar-group');
|
|
94
95
|
const ActionBarGroup = ({ children, className, pull }) => {
|
|
95
|
-
return (React__default.createElement("ul", { className: b$
|
|
96
|
+
return (React__default.createElement("ul", { className: b$m({ pull }, className), role: "group" }, children));
|
|
96
97
|
};
|
|
97
98
|
ActionBarGroup.displayName = 'ActionBar.Group';
|
|
98
99
|
|
|
99
|
-
var css_248z$
|
|
100
|
-
styleInject(css_248z$
|
|
100
|
+
var css_248z$k = ".ycn-action-bar-item {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n.ycn-action-bar-item_pull_left {\n margin-left: 0;\n margin-right: auto;\n}\n.ycn-action-bar-item_pull_right {\n margin-left: auto;\n margin-right: 0;\n}\n.ycn-action-bar-item_pull_center {\n margin-left: auto;\n margin-right: auto;\n}\n.ycn-action-bar-item + .ycn-action-bar-item_spacing {\n margin-left: 8px;\n}";
|
|
101
|
+
styleInject(css_248z$k);
|
|
101
102
|
|
|
102
|
-
const b$
|
|
103
|
+
const b$l = block('action-bar-item');
|
|
103
104
|
const ActionBarItem = ({ children, className, pull, spacing = true }) => {
|
|
104
|
-
return React__default.createElement("li", { className: b$
|
|
105
|
+
return React__default.createElement("li", { className: b$l({ pull, spacing }, className) }, children);
|
|
105
106
|
};
|
|
106
107
|
ActionBarItem.displayName = 'ActionBar.Item';
|
|
107
108
|
|
|
108
|
-
var css_248z$
|
|
109
|
-
styleInject(css_248z$
|
|
109
|
+
var css_248z$j = ".ycn-action-bar-section {\n display: flex;\n flex-flow: row nowrap;\n justify-content: flex-start;\n align-items: stretch;\n}\n.ycn-action-bar-section + .ycn-action-bar-section {\n border-left: solid 1px var(--yc-color-line-generic);\n}\n.ycn-action-bar-section_type_primary {\n flex: 1 1 auto;\n padding-left: 20px;\n padding-right: 20px;\n}\n.ycn-action-bar-section_type_secondary {\n padding-left: 6px;\n padding-right: 6px;\n}";
|
|
110
|
+
styleInject(css_248z$j);
|
|
110
111
|
|
|
111
|
-
const b$
|
|
112
|
+
const b$k = block('action-bar-section');
|
|
112
113
|
const ActionBarSection = ({ children, type = 'primary' }) => {
|
|
113
|
-
return React__default.createElement("div", { className: b$
|
|
114
|
+
return React__default.createElement("div", { className: b$k({ type }) }, children);
|
|
114
115
|
};
|
|
115
116
|
ActionBarSection.displayName = 'ActionBar.Section';
|
|
116
117
|
|
|
117
|
-
var css_248z$
|
|
118
|
-
styleInject(css_248z$
|
|
118
|
+
var css_248z$i = ".ycn-action-bar-separator {\n list-style: none;\n margin: 0;\n padding: 0;\n margin-left: 6px;\n margin-right: 6px;\n border-right: solid 1px var(--yc-color-line-generic);\n height: 40px;\n}";
|
|
119
|
+
styleInject(css_248z$i);
|
|
119
120
|
|
|
120
|
-
const b$
|
|
121
|
+
const b$j = block('action-bar-separator');
|
|
121
122
|
const ActionBarSeparator = () => {
|
|
122
|
-
return React__default.createElement("li", { role: "separator", className: b$
|
|
123
|
+
return React__default.createElement("li", { role: "separator", className: b$j() });
|
|
123
124
|
};
|
|
124
125
|
ActionBarSeparator.displayName = 'ActionBar.Separator';
|
|
125
126
|
|
|
126
|
-
var css_248z$
|
|
127
|
-
styleInject(css_248z$
|
|
127
|
+
var css_248z$h = ".ycn-action-bar {\n box-sizing: border-box;\n height: 40px;\n border-bottom: solid 1px var(--yc-color-line-generic);\n display: flex;\n flex-flow: row nowrap;\n justify-content: flex-start;\n align-items: stretch;\n}";
|
|
128
|
+
styleInject(css_248z$h);
|
|
128
129
|
|
|
129
|
-
const b$
|
|
130
|
+
const b$i = block('action-bar');
|
|
130
131
|
const ActionBar = ({ children, className, 'aria-label': ariaLabel }) => {
|
|
131
|
-
return (React__default.createElement("section", { className: b$
|
|
132
|
+
return (React__default.createElement("section", { className: b$i(null, className), "aria-label": ariaLabel }, children));
|
|
132
133
|
};
|
|
133
134
|
ActionBar.displayName = 'ActionBar';
|
|
134
135
|
const PublicActionBar = Object.assign(ActionBar, {
|
|
@@ -153,7 +154,7 @@ var Dict;
|
|
|
153
154
|
const ASIDE_HEADER_FOOTER_ICON_SIZE = 20;
|
|
154
155
|
const ASIDE_HEADER_COMPACT_WIDTH = 56;
|
|
155
156
|
const ASIDE_HEADER_EXPANDED_WIDTH = 236;
|
|
156
|
-
const defaultDict$
|
|
157
|
+
const defaultDict$2 = {
|
|
157
158
|
[Dict.CollapseButton]: 'Collapse',
|
|
158
159
|
[Dict.ExpandButton]: 'Expand',
|
|
159
160
|
[Dict.MoreButton]: 'More',
|
|
@@ -3180,15 +3181,15 @@ SwitchTransition.defaultProps = {
|
|
|
3180
3181
|
mode: modes.out
|
|
3181
3182
|
};
|
|
3182
3183
|
|
|
3183
|
-
var css_248z$
|
|
3184
|
-
styleInject(css_248z$
|
|
3184
|
+
var css_248z$g = ".ycn-drawer__item {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n height: 100%;\n will-change: transform;\n background-color: var(--yc-color-base-background);\n}\n.ycn-drawer__item_direction_right {\n left: auto;\n right: 0;\n}\n.ycn-drawer__item-transition-enter {\n transform: translate(-100%, 0);\n}\n.ycn-drawer__item-transition_direction_right-enter {\n transform: translate(100%, 0);\n}\n.ycn-drawer__item-transition-enter-active, .ycn-drawer__item-transition_direction_right-enter-active {\n transform: translate(0, 0);\n transition: transform 300ms;\n}\n.ycn-drawer__item-transition-enter-done, .ycn-drawer__item-transition_direction_right-enter-done {\n filter: blur(0px);\n transform: translateZ(0);\n}\n.ycn-drawer__item-transition-exit, .ycn-drawer__item-transition_direction_right-exit {\n transform: translate(0, 0);\n}\n.ycn-drawer__item-transition-exit-active, .ycn-drawer__item-transition_direction_right-exit-active {\n transition: transform 300ms;\n}\n.ycn-drawer__item-transition-exit-active {\n transform: translate(-100%, 0);\n}\n.ycn-drawer__item-transition_direction_right-exit-active {\n transform: translate(100%, 0);\n}\n.ycn-drawer__item-transition-exit-done, .ycn-drawer__item-transition_direction_right-exit-done {\n visibility: hidden;\n}\n.ycn-drawer__veil {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n background-color: var(--yc-color-sfx-veil);\n}\n.ycn-drawer__veil-transition-enter {\n opacity: 0;\n}\n.ycn-drawer__veil-transition-enter-active {\n opacity: 1;\n transition: opacity 300ms;\n}\n.ycn-drawer__veil-transition-exit {\n opacity: 1;\n}\n.ycn-drawer__veil-transition-exit-active {\n opacity: 0;\n transition: opacity 300ms;\n}\n.ycn-drawer__veil-transition-exit-done {\n visibility: hidden;\n}";
|
|
3185
|
+
styleInject(css_248z$g);
|
|
3185
3186
|
|
|
3186
|
-
const b$
|
|
3187
|
+
const b$h = block('drawer');
|
|
3187
3188
|
const TIMEOUT = 300;
|
|
3188
3189
|
const DrawerItem = ({ visible, content, direction, className }) => {
|
|
3189
3190
|
const itemRef = React__default.useRef(null);
|
|
3190
|
-
return (React__default.createElement(CSSTransition, { in: visible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$
|
|
3191
|
-
React__default.createElement("div", { ref: itemRef, className: b$
|
|
3191
|
+
return (React__default.createElement(CSSTransition, { in: visible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$h('item-transition', { direction }), nodeRef: itemRef },
|
|
3192
|
+
React__default.createElement("div", { ref: itemRef, className: b$h('item', { direction }, className) }, content)));
|
|
3192
3193
|
};
|
|
3193
3194
|
const Drawer = ({ className, children, style, onVeilClick, onEscape, preventScrollBody = true, }) => {
|
|
3194
3195
|
let someItemVisible = false;
|
|
@@ -3219,9 +3220,9 @@ const Drawer = ({ className, children, style, onVeilClick, onEscape, preventScro
|
|
|
3219
3220
|
const veilRef = React__default.useRef(null);
|
|
3220
3221
|
return (React__default.createElement(Transition, { in: someItemVisible, timeout: { enter: 0, exit: TIMEOUT }, mountOnEnter: true, unmountOnExit: true, nodeRef: containerRef }, (state) => {
|
|
3221
3222
|
const childrenVisible = someItemVisible && state === 'entered';
|
|
3222
|
-
return (React__default.createElement("div", { ref: containerRef, className: b$
|
|
3223
|
-
React__default.createElement(CSSTransition, { in: childrenVisible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$
|
|
3224
|
-
React__default.createElement("div", { ref: veilRef, className: b$
|
|
3223
|
+
return (React__default.createElement("div", { ref: containerRef, className: b$h(null, className), style: style },
|
|
3224
|
+
React__default.createElement(CSSTransition, { in: childrenVisible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$h('veil-transition'), nodeRef: veilRef },
|
|
3225
|
+
React__default.createElement("div", { ref: veilRef, className: b$h('veil'), onClick: onVeilClick })),
|
|
3225
3226
|
React__default.Children.map(children, (child) => {
|
|
3226
3227
|
const childElem = child;
|
|
3227
3228
|
if (childElem.type === DrawerItem) {
|
|
@@ -3233,11 +3234,11 @@ const Drawer = ({ className, children, style, onVeilClick, onEscape, preventScro
|
|
|
3233
3234
|
}));
|
|
3234
3235
|
};
|
|
3235
3236
|
|
|
3236
|
-
var css_248z$
|
|
3237
|
-
styleInject(css_248z$
|
|
3237
|
+
var css_248z$f = ".ycn-logo {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n height: 40px;\n}\n.ycn-logo__logo-btn-place {\n flex-shrink: 0;\n width: var(--aside-header-min-width);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.ycn-logo__logo-btn-place .yc-button::before {\n background-color: transparent;\n}\n.ycn-logo__btn-logo.yc-button_view_flat.yc-button_size_l {\n --yc-button-height: 38px;\n}\n.ycn-logo__logo {\n font-size: var(--yc-text-body-2-font-size);\n line-height: var(--yc-text-body-2-line-height);\n font-weight: var(--yc-text-body-font-weight);\n vertical-align: middle;\n cursor: pointer;\n}\n.ycn-logo__logo-link, .ycn-logo__logo-link:hover, .ycn-logo__logo-link:active, .ycn-logo__logo-link:visited, .ycn-logo__logo-link:focus {\n text-decoration: none;\n outline: none;\n color: inherit;\n}\n.yc-root .ycn-logo__btn-logo.button2_theme_flat.button2_hovered_yes::before {\n background-color: transparent;\n}";
|
|
3238
|
+
styleInject(css_248z$f);
|
|
3238
3239
|
|
|
3239
|
-
const b$
|
|
3240
|
-
const Logo = ({ text, compact, icon, iconSrc, iconClassName, iconSize = 24, textSize = 15, href = '/', wrapper, onClick, }) => {
|
|
3240
|
+
const b$g = block('logo');
|
|
3241
|
+
const Logo$1 = ({ text, compact, icon, iconSrc, iconClassName, iconSize = 24, textSize = 15, href = '/', wrapper, onClick, }) => {
|
|
3241
3242
|
const hasClickHandler = typeof onClick === 'function';
|
|
3242
3243
|
const hasWrapper = typeof wrapper === 'function';
|
|
3243
3244
|
const linkProps = hasClickHandler
|
|
@@ -3254,18 +3255,18 @@ const Logo = ({ text, compact, icon, iconSrc, iconClassName, iconSize = 24, text
|
|
|
3254
3255
|
else if (icon) {
|
|
3255
3256
|
buttonIcon = React__default.createElement(Icon, { data: icon, size: iconSize, className: iconClassName });
|
|
3256
3257
|
}
|
|
3257
|
-
const button = (React__default.createElement(Button, Object.assign({ view: "flat", size: "l", className: b$
|
|
3258
|
+
const button = (React__default.createElement(Button, Object.assign({ view: "flat", size: "l", className: b$g('btn-logo'), component: hasWrapper ? 'span' : undefined, onClick: onClick }, linkProps), buttonIcon));
|
|
3258
3259
|
let logo;
|
|
3259
3260
|
if (typeof text === 'function') {
|
|
3260
3261
|
logo = text();
|
|
3261
3262
|
}
|
|
3262
3263
|
else {
|
|
3263
|
-
logo = (React__default.createElement("div", { className: b$
|
|
3264
|
+
logo = (React__default.createElement("div", { className: b$g('logo'), style: { fontSize: textSize } }, text));
|
|
3264
3265
|
}
|
|
3265
|
-
return (React__default.createElement("div", { className: b$
|
|
3266
|
-
React__default.createElement("div", { className: b$
|
|
3266
|
+
return (React__default.createElement("div", { className: b$g() },
|
|
3267
|
+
React__default.createElement("div", { className: b$g('logo-btn-place') }, hasWrapper ? wrapper(button, compact) : button),
|
|
3267
3268
|
!compact &&
|
|
3268
|
-
(hasWrapper ? (React__default.createElement("div", { onClick: onClick }, wrapper(logo, compact))) : (React__default.createElement("a", Object.assign({}, linkProps, { className: b$
|
|
3269
|
+
(hasWrapper ? (React__default.createElement("div", { onClick: onClick }, wrapper(logo, compact))) : (React__default.createElement("a", Object.assign({}, linkProps, { className: b$g('logo-link'), onClick: onClick }), logo)))));
|
|
3269
3270
|
};
|
|
3270
3271
|
|
|
3271
3272
|
var classCallCheck = function (instance, Constructor) {
|
|
@@ -3758,7 +3759,7 @@ const COLLAPSE_ITEM_ID = 'collapse-item-id';
|
|
|
3758
3759
|
const POPUP_PLACEMENT = ['right-start', 'right-end', 'right'];
|
|
3759
3760
|
const POPUP_ITEM_HEIGHT = 28;
|
|
3760
3761
|
|
|
3761
|
-
function getItemHeight(item) {
|
|
3762
|
+
function getItemHeight$1(item) {
|
|
3762
3763
|
switch (item.type) {
|
|
3763
3764
|
case 'action':
|
|
3764
3765
|
return 50;
|
|
@@ -3769,9 +3770,9 @@ function getItemHeight(item) {
|
|
|
3769
3770
|
}
|
|
3770
3771
|
}
|
|
3771
3772
|
function getItemsHeight(items) {
|
|
3772
|
-
return items.reduce((sum, item) => sum + getItemHeight(item), 0);
|
|
3773
|
+
return items.reduce((sum, item) => sum + getItemHeight$1(item), 0);
|
|
3773
3774
|
}
|
|
3774
|
-
function getSelectedItemIndex(items) {
|
|
3775
|
+
function getSelectedItemIndex$1(items) {
|
|
3775
3776
|
const index = items.findIndex(({ current }) => Boolean(current));
|
|
3776
3777
|
return index === -1 ? undefined : index;
|
|
3777
3778
|
}
|
|
@@ -3797,25 +3798,25 @@ function getItemsMinHeight(items) {
|
|
|
3797
3798
|
(pinnedItems.length === items.length ? 0 : ITEM_HEIGHT));
|
|
3798
3799
|
}
|
|
3799
3800
|
|
|
3800
|
-
var css_248z$
|
|
3801
|
-
styleInject(css_248z$
|
|
3801
|
+
var css_248z$e = ".ycn-composite-bar-item {\n --composite-bar-item-action-size: 36px;\n display: flex;\n width: 100%;\n height: 100%;\n align-items: center;\n cursor: pointer;\n}\n.ycn-composite-bar-item__icon {\n color: var(--yc-color-text-misc);\n}\n.ycn-composite-bar-item__icon-place {\n flex-shrink: 0;\n width: var(--aside-header-min-width);\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.ycn-composite-bar-item__title {\n display: flex;\n overflow: hidden;\n}\n.ycn-composite-bar-item__title-text {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.ycn-composite-bar-item__title-adornment {\n margin: 0 10px;\n}\n.ycn-composite-bar-item__collapse-item {\n display: flex;\n padding: 0 16px;\n align-items: center;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.ycn-composite-bar-item__collapse-item .ycn-composite-bar-item__title-adornment {\n margin-right: 0;\n}\n.ycn-composite-bar-item__menu-divider {\n margin: 0 8px;\n width: 100%;\n border-top: 1px solid var(--yc-color-line-generic);\n cursor: default;\n}\n.ycn-composite-bar-item__collapse-items-popup-content {\n padding: 4px 0;\n}\n.ycn-composite-bar-item__link {\n display: flex;\n width: 100%;\n height: 100%;\n align-items: center;\n}\n.ycn-composite-bar-item__link, .ycn-composite-bar-item__link:hover, .ycn-composite-bar-item__link:active, .ycn-composite-bar-item__link:visited, .ycn-composite-bar-item__link:focus {\n text-decoration: none;\n outline: none;\n color: inherit;\n}\n.ycn-composite-bar-item__btn-icon {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ycn-composite-bar-item_type_action {\n justify-content: center;\n height: var(--composite-bar-item-action-size);\n margin: 0 10px 8px;\n background: var(--yc-color-base-float);\n box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.03), 0px 5px 6px rgba(0, 0, 0, 0.12);\n border-radius: var(--composite-bar-item-action-size);\n transition: transform 0.1s ease-out, background-color 0.15s linear;\n}\n.ycn-composite-bar-item_type_action:focus {\n box-shadow: 0 0 0 2px var(--yc-color-line-misc);\n}\n.ycn-composite-bar-item_type_action:focus:not(:focus-visible) {\n box-shadow: none;\n}\n.ycn-composite-bar-item_type_action:hover {\n background-color: var(--yc-color-base-float-hover);\n}\n.ycn-composite-bar-item_type_action:active {\n box-shadow: 0 1px 2px var(--yc-color-sfx-shadow);\n transition: none;\n transform: scale(0.96);\n}\n.ycn-composite-bar-item_type_action .ycn-composite-bar-item__icon-place {\n width: var(--composite-bar-item-action-size);\n}\n.ycn-composite-bar-item_type_action .ycn-composite-bar-item__title {\n margin-right: 16px;\n}\n.ycn-composite-bar-item__icon-tooltip_item-type_action {\n margin-left: 10px;\n}\n.ycn-composite-bar-item:not(.ycn-composite-bar-item_compact).ycn-composite-bar-item_current.ycn-composite-bar-item_type_regular {\n background-color: var(--yc-color-base-selection);\n}\n.ycn-composite-bar-item:not(.ycn-composite-bar-item_compact):not(.ycn-composite-bar-item_current):hover.ycn-composite-bar-item_type_regular {\n background-color: var(--yc-color-base-simple-hover);\n}\n.ycn-composite-bar-item_compact.ycn-composite-bar-item_type_action {\n width: var(--composite-bar-item-action-size);\n}\n.ycn-composite-bar-item_compact.ycn-composite-bar-item_type_action .ycn-composite-bar-item__title {\n margin: 0;\n}\n.ycn-composite-bar-item_compact.ycn-composite-bar-item_current.ycn-composite-bar-item_type_regular .ycn-composite-bar-item__btn-icon {\n position: relative;\n background-color: transparent;\n}\n.ycn-composite-bar-item_compact.ycn-composite-bar-item_current.ycn-composite-bar-item_type_regular .ycn-composite-bar-item__btn-icon::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: -1;\n width: 38px;\n height: 38px;\n margin-top: -19px;\n margin-left: -19px;\n border-radius: 7px;\n}\n.ycn-composite-bar-item_compact.ycn-composite-bar-item_current.ycn-composite-bar-item_type_regular .ycn-composite-bar-item__btn-icon::before {\n background-color: var(--yc-color-base-selection);\n}\n.ycn-composite-bar-item_compact:not(.ycn-composite-bar-item_current):hover.ycn-composite-bar-item_type_regular .ycn-composite-bar-item__btn-icon {\n position: relative;\n background-color: transparent;\n}\n.ycn-composite-bar-item_compact:not(.ycn-composite-bar-item_current):hover.ycn-composite-bar-item_type_regular .ycn-composite-bar-item__btn-icon::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: -1;\n width: 38px;\n height: 38px;\n margin-top: -19px;\n margin-left: -19px;\n border-radius: 7px;\n}\n.ycn-composite-bar-item_compact:not(.ycn-composite-bar-item_current):hover.ycn-composite-bar-item_type_regular .ycn-composite-bar-item__btn-icon::before {\n background-color: var(--yc-color-base-simple-hover);\n}";
|
|
3802
|
+
styleInject(css_248z$e);
|
|
3802
3803
|
|
|
3803
|
-
const b$
|
|
3804
|
+
const b$f = block('composite-bar-item');
|
|
3804
3805
|
function renderItemTitle(item) {
|
|
3805
|
-
let titleNode = React__default.createElement("div", { className: b$
|
|
3806
|
+
let titleNode = React__default.createElement("div", { className: b$f('title-text') }, item.title);
|
|
3806
3807
|
if (item.rightAdornment) {
|
|
3807
3808
|
titleNode = (React__default.createElement(React__default.Fragment, null,
|
|
3808
3809
|
titleNode,
|
|
3809
|
-
React__default.createElement("div", { className: b$
|
|
3810
|
+
React__default.createElement("div", { className: b$f('title-adornment') }, item.rightAdornment)));
|
|
3810
3811
|
}
|
|
3811
3812
|
return titleNode;
|
|
3812
3813
|
}
|
|
3813
3814
|
const defaultPopupPlacement = ['right-end'];
|
|
3814
3815
|
const defaultPopupOffset = [-20, 8];
|
|
3815
|
-
const Item = (props) => {
|
|
3816
|
+
const Item$1 = (props) => {
|
|
3816
3817
|
const { item, compact, className, collapseItems, onMouseLeave, onMouseEnter, enableTooltip = true, popupVisible = false, popupAnchor, popupPlacement = defaultPopupPlacement, popupOffset = defaultPopupOffset, popupKeepMounted, renderPopupContent, onClosePopup, onItemClick, } = props;
|
|
3817
3818
|
if (item.type === 'divider') {
|
|
3818
|
-
return React__default.createElement("div", { className: b$
|
|
3819
|
+
return React__default.createElement("div", { className: b$f('menu-divider') });
|
|
3819
3820
|
}
|
|
3820
3821
|
const [open, toggleOpen] = React__default.useState(false);
|
|
3821
3822
|
const ref = React__default.useRef(null);
|
|
@@ -3836,7 +3837,7 @@ const Item = (props) => {
|
|
|
3836
3837
|
onClosePopup === null || onClosePopup === void 0 ? void 0 : onClosePopup();
|
|
3837
3838
|
}, [onClosePopup]);
|
|
3838
3839
|
const makeNode = ({ icon: iconEl, title: titleEl }) => {
|
|
3839
|
-
const createdNode = (React__default.createElement("div", { className: b$
|
|
3840
|
+
const createdNode = (React__default.createElement("div", { className: b$f({ type, current, compact }, className), ref: ref, onClick: () => {
|
|
3840
3841
|
if (collapsedItem) {
|
|
3841
3842
|
/**
|
|
3842
3843
|
* If we call onItemClick for collapsedItem then:
|
|
@@ -3857,13 +3858,13 @@ const Item = (props) => {
|
|
|
3857
3858
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
|
|
3858
3859
|
}
|
|
3859
3860
|
} },
|
|
3860
|
-
React__default.createElement("div", { className: b$
|
|
3861
|
-
React__default.createElement("div", { onMouseEnter: () => onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(), onMouseLeave: () => onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(), className: b$
|
|
3862
|
-
React__default.createElement("div", { className: b$
|
|
3863
|
-
renderPopupContent && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(Popup, { className: b$
|
|
3864
|
-
return item.link ? (React__default.createElement("a", { href: item.link, className: b$
|
|
3861
|
+
React__default.createElement("div", { className: b$f('icon-place') }, compact ? (React__default.createElement(Tooltip, { content: tooltipText, disabled: !enableTooltip || (collapsedItem && open), placement: "right", className: b$f('icon-tooltip', { 'item-type': type }) },
|
|
3862
|
+
React__default.createElement("div", { onMouseEnter: () => onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(), onMouseLeave: () => onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(), className: b$f('btn-icon') }, iconEl))) : (iconEl)),
|
|
3863
|
+
React__default.createElement("div", { className: b$f('title'), title: typeof item.title === 'string' ? item.title : undefined }, titleEl),
|
|
3864
|
+
renderPopupContent && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(Popup, { className: b$f('popup'), open: popupVisible, keepMounted: popupKeepMounted, placement: popupPlacement, offset: popupOffset, anchorRef: anchorRef, onClose: onClose }, renderPopupContent()))));
|
|
3865
|
+
return item.link ? (React__default.createElement("a", { href: item.link, className: b$f('link') }, createdNode)) : (createdNode);
|
|
3865
3866
|
};
|
|
3866
|
-
const iconNode = icon ? React__default.createElement(Icon, { data: icon, size: iconSize, className: b$
|
|
3867
|
+
const iconNode = icon ? React__default.createElement(Icon, { data: icon, size: iconSize, className: b$f('icon') }) : null;
|
|
3867
3868
|
const titleNode = renderItemTitle(item);
|
|
3868
3869
|
const params = { icon: iconNode, title: titleNode };
|
|
3869
3870
|
let node;
|
|
@@ -3878,16 +3879,16 @@ const Item = (props) => {
|
|
|
3878
3879
|
node,
|
|
3879
3880
|
open && collapsedItem && (collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(CollapsedPopup, Object.assign({}, props, { anchorRef: ref, onClose: () => toggleOpen(false) })))));
|
|
3880
3881
|
};
|
|
3881
|
-
Item.displayName = 'Item';
|
|
3882
|
+
Item$1.displayName = 'Item';
|
|
3882
3883
|
function CollapsedPopup({ compact, onItemClick, collapseItems, anchorRef, onClose, }) {
|
|
3883
3884
|
return (collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) ? (React__default.createElement(Popup, { placement: POPUP_PLACEMENT, open: true, anchorRef: anchorRef, onClose: onClose },
|
|
3884
|
-
React__default.createElement("div", { className: b$
|
|
3885
|
-
React__default.createElement(List, { itemClassName: b$
|
|
3885
|
+
React__default.createElement("div", { className: b$f('collapse-items-popup-content') },
|
|
3886
|
+
React__default.createElement(List, { itemClassName: b$f('root-collapse-item'), items: collapseItems, selectedItemIndex: getSelectedItemIndex$1(collapseItems), itemHeight: POPUP_ITEM_HEIGHT, itemsHeight: collapseItems.length * POPUP_ITEM_HEIGHT, virtualized: false, filterable: false, sortable: false, renderItem: (collapseItem) => {
|
|
3886
3887
|
const makeCollapseNode = ({ title: titleEl }) => {
|
|
3887
|
-
const res = (React__default.createElement("div", { className: b$
|
|
3888
|
+
const res = (React__default.createElement("div", { className: b$f('collapse-item'), onClick: () => {
|
|
3888
3889
|
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(collapseItem, true);
|
|
3889
3890
|
} }, titleEl));
|
|
3890
|
-
return collapseItem.link ? (React__default.createElement("a", { href: collapseItem.link, className: b$
|
|
3891
|
+
return collapseItem.link ? (React__default.createElement("a", { href: collapseItem.link, className: b$f('link') }, res)) : (res);
|
|
3891
3892
|
};
|
|
3892
3893
|
const titleNode = renderItemTitle(collapseItem);
|
|
3893
3894
|
const params = { title: titleNode };
|
|
@@ -3917,10 +3918,10 @@ var SvgDots = function SvgDots(props) {
|
|
|
3917
3918
|
};
|
|
3918
3919
|
var dotsIcon = SvgDots;
|
|
3919
3920
|
|
|
3920
|
-
var css_248z$
|
|
3921
|
-
styleInject(css_248z$
|
|
3921
|
+
var css_248z$d = ".ycn-composite-bar {\n flex: 1 0 auto;\n width: 100%;\n min-height: 40px;\n}\n.ycn-composite-bar .ycn-composite-bar__root-menu-item[class] {\n background-color: transparent;\n}";
|
|
3922
|
+
styleInject(css_248z$d);
|
|
3922
3923
|
|
|
3923
|
-
const b$
|
|
3924
|
+
const b$e = block('composite-bar');
|
|
3924
3925
|
class CompositeBar extends React__default.Component {
|
|
3925
3926
|
constructor() {
|
|
3926
3927
|
super(...arguments);
|
|
@@ -3935,10 +3936,10 @@ class CompositeBar extends React__default.Component {
|
|
|
3935
3936
|
return null;
|
|
3936
3937
|
}
|
|
3937
3938
|
if (!enableCollapsing) {
|
|
3938
|
-
return React__default.createElement("div", { className: b$
|
|
3939
|
+
return React__default.createElement("div", { className: b$e() }, this.renderMenu());
|
|
3939
3940
|
}
|
|
3940
3941
|
const minHeight = getItemsMinHeight(items);
|
|
3941
|
-
return (React__default.createElement("div", { className: b$
|
|
3942
|
+
return (React__default.createElement("div", { className: b$e({ autosizer: true }), style: { minHeight } }, items.length !== 0 && (React__default.createElement(AutoSizer, null, ({ width, height }) => {
|
|
3942
3943
|
const style = {
|
|
3943
3944
|
width,
|
|
3944
3945
|
height,
|
|
@@ -3949,7 +3950,7 @@ class CompositeBar extends React__default.Component {
|
|
|
3949
3950
|
renderAutosizeMenu(height) {
|
|
3950
3951
|
const { compact, onItemClick } = this.props;
|
|
3951
3952
|
const { listItems, collapseItems } = this.getAutosizeListItems(height);
|
|
3952
|
-
return (React__default.createElement(List, { ref: this.listRef, items: listItems, selectedItemIndex: getSelectedItemIndex(listItems), itemHeight: getItemHeight, itemClassName: b$
|
|
3953
|
+
return (React__default.createElement(List, { ref: this.listRef, items: listItems, selectedItemIndex: getSelectedItemIndex$1(listItems), itemHeight: getItemHeight$1, itemClassName: b$e('root-menu-item'), itemsHeight: getItemsHeight, virtualized: false, filterable: false, sortable: false, renderItem: (item) => (React__default.createElement(Item$1, { item: item, onMouseLeave: () => {
|
|
3953
3954
|
var _a;
|
|
3954
3955
|
if (compact) {
|
|
3955
3956
|
(_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.activateItem(undefined);
|
|
@@ -3958,7 +3959,7 @@ class CompositeBar extends React__default.Component {
|
|
|
3958
3959
|
}
|
|
3959
3960
|
renderMenu() {
|
|
3960
3961
|
const { items, onItemClick, compact } = this.props;
|
|
3961
|
-
return (React__default.createElement(List, { ref: this.listRef, items: items, selectedItemIndex: getSelectedItemIndex(items), itemHeight: getItemHeight, itemClassName: b$
|
|
3962
|
+
return (React__default.createElement(List, { ref: this.listRef, items: items, selectedItemIndex: getSelectedItemIndex$1(items), itemHeight: getItemHeight$1, itemClassName: b$e('root-menu-item'), itemsHeight: getItemsHeight, virtualized: false, filterable: false, sortable: false, renderItem: (item) => (React__default.createElement(Item$1, { item: item, onMouseLeave: () => {
|
|
3962
3963
|
var _a;
|
|
3963
3964
|
if (compact) {
|
|
3964
3965
|
(_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.activateItem(undefined);
|
|
@@ -3968,7 +3969,7 @@ class CompositeBar extends React__default.Component {
|
|
|
3968
3969
|
getMoreButtonItem() {
|
|
3969
3970
|
var _a;
|
|
3970
3971
|
const { dict } = this.props;
|
|
3971
|
-
const title = (_a = dict === null || dict === void 0 ? void 0 : dict[Dict.MoreButton]) !== null && _a !== void 0 ? _a : defaultDict$
|
|
3972
|
+
const title = (_a = dict === null || dict === void 0 ? void 0 : dict[Dict.MoreButton]) !== null && _a !== void 0 ? _a : defaultDict$2[Dict.MoreButton];
|
|
3972
3973
|
return {
|
|
3973
3974
|
id: COLLAPSE_ITEM_ID,
|
|
3974
3975
|
title,
|
|
@@ -3987,7 +3988,7 @@ class CompositeBar extends React__default.Component {
|
|
|
3987
3988
|
return { listItems, collapseItems: [] };
|
|
3988
3989
|
}
|
|
3989
3990
|
const collapseItem = this.getMoreButtonItem();
|
|
3990
|
-
const collapseItemHeight = getItemHeight(collapseItem);
|
|
3991
|
+
const collapseItemHeight = getItemHeight$1(collapseItem);
|
|
3991
3992
|
listItems.splice(regularItems.length, 0, collapseItem);
|
|
3992
3993
|
const collapseItems = [];
|
|
3993
3994
|
let listHeight = allItemsHeight + collapseItemHeight;
|
|
@@ -4003,12 +4004,12 @@ class CompositeBar extends React__default.Component {
|
|
|
4003
4004
|
}
|
|
4004
4005
|
if (item.type === 'divider') {
|
|
4005
4006
|
if (index + 1 < listItems.length && ((_a = listItems[index + 1]) === null || _a === void 0 ? void 0 : _a.type) === 'divider') {
|
|
4006
|
-
listHeight -= getItemHeight(item);
|
|
4007
|
+
listHeight -= getItemHeight$1(item);
|
|
4007
4008
|
listItems.splice(index, 1);
|
|
4008
4009
|
}
|
|
4009
4010
|
continue;
|
|
4010
4011
|
}
|
|
4011
|
-
listHeight -= getItemHeight(item);
|
|
4012
|
+
listHeight -= getItemHeight$1(item);
|
|
4012
4013
|
collapseItems.unshift(...listItems.splice(index, 1));
|
|
4013
4014
|
}
|
|
4014
4015
|
if (((_b = listItems[index]) === null || _b === void 0 ? void 0 : _b.type) === 'divider' &&
|
|
@@ -4058,10 +4059,10 @@ var SvgDividerCollapsed = function SvgDividerCollapsed(props) {
|
|
|
4058
4059
|
};
|
|
4059
4060
|
var headerDividerCollapsedIcon = SvgDividerCollapsed;
|
|
4060
4061
|
|
|
4061
|
-
var css_248z$
|
|
4062
|
-
styleInject(css_248z$
|
|
4062
|
+
var css_248z$c = ".yc-root {\n --aside-header-background-color: var(--yc-color-base-info);\n --aside-header-collapse-button-divider-line-color: var(\n --aside-header-header-divider-line-color\n );\n}\n\n.yc-root_theme_light,\n.yc-root_theme_light-hc {\n --aside-header-divider-line-color: transparent;\n --aside-header-header-divider-line-color: var(--yc-color-line-generic);\n}\n\n.yc-root_theme_dark,\n.yc-root_theme_dark-hc {\n --aside-header-divider-line-color: var(--yc-color-line-solid);\n --aside-header-header-divider-line-color: var(--yc-color-line-solid);\n}\n\n.ycn-aside-header {\n --aside-header-min-width: 56px;\n height: 100%;\n width: 100%;\n position: relative;\n background-color: var(--yc-color-base-background);\n}\n.ycn-aside-header__aside {\n position: sticky;\n top: 0;\n left: 0;\n height: 100vh;\n width: inherit;\n display: flex;\n flex-direction: column;\n background-color: var(--yc-color-base-background);\n z-index: 100;\n box-sizing: border-box;\n}\n.ycn-aside-header__aside::after {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 2;\n width: 1px;\n height: 100%;\n content: \"\";\n background-color: var(--aside-header-divider-line-color);\n}\n.ycn-aside-header__aside-popup-anchor {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 1;\n}\n.ycn-aside-header__aside-content {\n --gradient-height: 334px;\n display: flex;\n flex-direction: column;\n overflow-x: hidden;\n width: inherit;\n height: inherit;\n position: relative;\n z-index: 2;\n user-select: none;\n}\n.ycn-aside-header__aside-content::after {\n position: absolute;\n top: 0;\n right: -100px;\n bottom: 0;\n width: 100px;\n content: \"\";\n box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1), 0px 0px 24px rgba(0, 0, 0, 0.08);\n}\n.ycn-aside-header__aside-content > .ycn-aside-header-logo {\n margin: 8px 0;\n}\n.ycn-aside-header__aside-content_with-decoration {\n background: linear-gradient(180deg, var(--aside-header-background-color) calc(var(--gradient-height) * 0.33), transparent calc(var(--gradient-height) * 0.88));\n}\n.ycn-aside-header_compact .ycn-aside-header__aside-content {\n background: transparent;\n}\n.ycn-aside-header__header {\n --aside-header-header-divider-height: 29px;\n position: relative;\n z-index: 1;\n flex: none;\n box-sizing: border-box;\n width: 100%;\n padding-top: 8px;\n padding-bottom: 22px;\n}\n.ycn-aside-header__header .ycn-aside-header__header-divider {\n position: absolute;\n bottom: 0;\n left: 0;\n z-index: -2;\n display: none;\n color: var(--aside-header-background-color);\n}\n.ycn-aside-header__header_with-decoration::before {\n position: absolute;\n top: 0;\n left: 0;\n z-index: -2;\n display: none;\n width: 100%;\n height: calc(100% - var(--aside-header-header-divider-height));\n content: \"\";\n background-color: var(--aside-header-background-color);\n}\n.ycn-aside-header__header::after {\n position: absolute;\n bottom: 12px;\n left: 0;\n z-index: -2;\n width: 100%;\n height: 1px;\n content: \"\";\n background-color: var(--aside-header-header-divider-line-color);\n}\n.ycn-aside-header_compact .ycn-aside-header__header::before {\n display: block;\n}\n.ycn-aside-header_compact .ycn-aside-header__header_with-decoration .ycn-aside-header__header-divider {\n display: block;\n}\n.ycn-aside-header_compact .ycn-aside-header__header_with-decoration::after {\n display: none;\n}\n.ycn-aside-header__menu-items {\n flex-grow: 1;\n}\n.ycn-aside-header__footer {\n flex-shrink: 0;\n width: 100%;\n margin: 8px 0;\n display: flex;\n flex-direction: column;\n}\n.ycn-aside-header__panels {\n z-index: 98;\n position: fixed;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n overflow: auto;\n}\n.ycn-aside-header__panel {\n height: 100%;\n}\n.ycn-aside-header__pane-container {\n display: flex;\n outline: none;\n overflow: visible;\n user-select: text;\n flex-direction: row;\n}\n.ycn-aside-header__content {\n width: calc(100% - var(--aside-header-size));\n z-index: 95;\n}\n.ycn-aside-header__collapse-button {\n --yc-button-background-color-hover: transparent;\n overflow: hidden;\n box-sizing: border-box;\n flex: none;\n width: 100%;\n height: 20px;\n border-top: 1px solid var(--aside-header-collapse-button-divider-line-color);\n margin-top: auto;\n}\n.ycn-aside-header__collapse-button:not(.ycn-aside-header__collapse-button_compact) .ycn-aside-header__collapse-icon {\n transform: rotate(180deg);\n}\n.ycn-aside-header__collapse-button .ycn-aside-header__collapse-icon {\n color: var(--yc-color-text-secondary);\n}\n.ycn-aside-header__collapse-button:hover .ycn-aside-header__collapse-icon {\n color: var(--yc-color-text-primary);\n}";
|
|
4063
|
+
styleInject(css_248z$c);
|
|
4063
4064
|
|
|
4064
|
-
const b$
|
|
4065
|
+
const b$d = block('aside-header');
|
|
4065
4066
|
class AsideHeader extends React__default.Component {
|
|
4066
4067
|
constructor() {
|
|
4067
4068
|
super(...arguments);
|
|
@@ -4069,26 +4070,26 @@ class AsideHeader extends React__default.Component {
|
|
|
4069
4070
|
this.renderFirstPane = (size) => {
|
|
4070
4071
|
const { dict, menuItems, panelItems, compact, headerDecoration } = this.props;
|
|
4071
4072
|
return (React__default.createElement(React__default.Fragment, null,
|
|
4072
|
-
React__default.createElement("div", { className: b$
|
|
4073
|
-
React__default.createElement("div", { className: b$
|
|
4074
|
-
React__default.createElement("div", { className: b$
|
|
4073
|
+
React__default.createElement("div", { className: b$d('aside'), style: { width: size } },
|
|
4074
|
+
React__default.createElement("div", { className: b$d('aside-popup-anchor'), ref: this.asideRef }),
|
|
4075
|
+
React__default.createElement("div", { className: b$d('aside-content', { ['with-decoration']: headerDecoration }) },
|
|
4075
4076
|
this.renderHeader(),
|
|
4076
|
-
(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) ? (React__default.createElement(CompositeBar, { items: menuItems, compact: compact, enableCollapsing: true, dict: dict, onItemClick: this.onItemClick })) : (React__default.createElement("div", { className: b$
|
|
4077
|
+
(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) ? (React__default.createElement(CompositeBar, { items: menuItems, compact: compact, enableCollapsing: true, dict: dict, onItemClick: this.onItemClick })) : (React__default.createElement("div", { className: b$d('menu-items') })),
|
|
4077
4078
|
this.renderFooter(size),
|
|
4078
4079
|
this.renderCollapseButton())),
|
|
4079
4080
|
panelItems && this.renderPanels(size)));
|
|
4080
4081
|
};
|
|
4081
4082
|
this.renderSecondPane = (size) => {
|
|
4082
|
-
return (React__default.createElement(Content, { size: size, renderContent: this.props.renderContent, className: b$
|
|
4083
|
+
return (React__default.createElement(Content, { size: size, renderContent: this.props.renderContent, className: b$d('content') }));
|
|
4083
4084
|
};
|
|
4084
|
-
this.renderLogo = () => (React__default.createElement(Logo, Object.assign({}, this.props.logo, { compact: this.props.compact, onClick: this.onLogoClick })));
|
|
4085
|
-
this.renderHeader = () => (React__default.createElement("div", { className: b$
|
|
4085
|
+
this.renderLogo = () => (React__default.createElement(Logo$1, Object.assign({}, this.props.logo, { compact: this.props.compact, onClick: this.onLogoClick })));
|
|
4086
|
+
this.renderHeader = () => (React__default.createElement("div", { className: b$d('header', { ['with-decoration']: this.props.headerDecoration }) },
|
|
4086
4087
|
this.renderLogo(),
|
|
4087
4088
|
React__default.createElement(CompositeBar, { items: this.props.subheaderItems, compact: this.props.compact, enableCollapsing: false, onItemClick: this.onItemClick }),
|
|
4088
|
-
React__default.createElement(Icon, { data: headerDividerCollapsedIcon, className: b$
|
|
4089
|
+
React__default.createElement(Icon, { data: headerDividerCollapsedIcon, className: b$d('header-divider'), width: ASIDE_HEADER_COMPACT_WIDTH, height: "29" })));
|
|
4089
4090
|
this.renderFooter = (size) => {
|
|
4090
4091
|
const { compact, renderFooter } = this.props;
|
|
4091
|
-
return (React__default.createElement("div", { className: b$
|
|
4092
|
+
return (React__default.createElement("div", { className: b$d('footer') }, renderFooter === null || renderFooter === void 0 ? void 0 : renderFooter({
|
|
4092
4093
|
size,
|
|
4093
4094
|
compact,
|
|
4094
4095
|
asideRef: this.asideRef,
|
|
@@ -4096,14 +4097,14 @@ class AsideHeader extends React__default.Component {
|
|
|
4096
4097
|
};
|
|
4097
4098
|
this.renderPanels = (size) => {
|
|
4098
4099
|
const { panelItems } = this.props;
|
|
4099
|
-
return (React__default.createElement(Drawer, { className: b$
|
|
4100
|
+
return (React__default.createElement(Drawer, { className: b$d('panels'), onVeilClick: this.onCloseDrawer, onEscape: this.onCloseDrawer, style: { left: size } }, panelItems.map((item) => (React__default.createElement(DrawerItem, Object.assign({ key: item.id }, item))))));
|
|
4100
4101
|
};
|
|
4101
4102
|
this.renderCollapseButton = () => {
|
|
4102
4103
|
var _a;
|
|
4103
4104
|
const { compact, dict } = this.props;
|
|
4104
4105
|
const typeButton = compact ? Dict.ExpandButton : Dict.CollapseButton;
|
|
4105
|
-
return (React__default.createElement(Button, { className: b$
|
|
4106
|
-
React__default.createElement(Icon, { data: controlMenuButtonIcon, className: b$
|
|
4106
|
+
return (React__default.createElement(Button, { className: b$d('collapse-button', { compact }), view: "flat", onClick: this.onCollapseButtonClick, title: (_a = dict === null || dict === void 0 ? void 0 : dict[typeButton]) !== null && _a !== void 0 ? _a : defaultDict$2[typeButton] },
|
|
4107
|
+
React__default.createElement(Icon, { data: controlMenuButtonIcon, className: b$d('collapse-icon'), width: "16", height: "10" })));
|
|
4107
4108
|
};
|
|
4108
4109
|
this.onCollapseButtonClick = () => {
|
|
4109
4110
|
var _a, _b;
|
|
@@ -4127,8 +4128,8 @@ class AsideHeader extends React__default.Component {
|
|
|
4127
4128
|
render() {
|
|
4128
4129
|
const { className, compact } = this.props;
|
|
4129
4130
|
const size = compact ? ASIDE_HEADER_COMPACT_WIDTH : ASIDE_HEADER_EXPANDED_WIDTH;
|
|
4130
|
-
return (React__default.createElement("div", { className: b$
|
|
4131
|
-
React__default.createElement("div", { className: b$
|
|
4131
|
+
return (React__default.createElement("div", { className: b$d({ compact }, className) },
|
|
4132
|
+
React__default.createElement("div", { className: b$d('pane-container') },
|
|
4132
4133
|
this.renderFirstPane(size),
|
|
4133
4134
|
this.renderSecondPane(size))));
|
|
4134
4135
|
}
|
|
@@ -4167,15 +4168,32 @@ function __rest(s, e) {
|
|
|
4167
4168
|
return t;
|
|
4168
4169
|
}
|
|
4169
4170
|
|
|
4170
|
-
var css_248z$
|
|
4171
|
-
styleInject(css_248z$
|
|
4171
|
+
var css_248z$b = ".ycn-footer-item {\n width: 100%;\n height: 40px;\n}";
|
|
4172
|
+
styleInject(css_248z$b);
|
|
4172
4173
|
|
|
4173
|
-
const b$
|
|
4174
|
-
const FooterItem = (_a) => {
|
|
4174
|
+
const b$c = block('footer-item');
|
|
4175
|
+
const FooterItem$1 = (_a) => {
|
|
4175
4176
|
var { item } = _a, props = __rest(_a, ["item"]);
|
|
4176
|
-
return (React__default.createElement(Item, Object.assign({}, props, { item: Object.assign({ iconSize: ASIDE_HEADER_FOOTER_ICON_SIZE }, item), className: b$
|
|
4177
|
+
return (React__default.createElement(Item$1, Object.assign({}, props, { item: Object.assign({ iconSize: ASIDE_HEADER_FOOTER_ICON_SIZE }, item), className: b$c({ compact: props.compact }), onItemClick: item.onItemClick })));
|
|
4177
4178
|
};
|
|
4178
4179
|
|
|
4180
|
+
var css_248z$a = ".ycn-title {\n box-sizing: border-box;\n padding: 14px 10px 14px 20px;\n min-height: 64px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.ycn-title_separator {\n border-bottom: 1px solid var(--yc-color-line-generic);\n}\n.ycn-title__text {\n margin: 0;\n margin-right: 20px;\n}";
|
|
4181
|
+
styleInject(css_248z$a);
|
|
4182
|
+
|
|
4183
|
+
const b$b = block('title');
|
|
4184
|
+
const defaultDict$1 = {
|
|
4185
|
+
close: 'Close',
|
|
4186
|
+
};
|
|
4187
|
+
const Title = ({ children, closeIconSize = 23, hasSeparator, dict = defaultDict$1, onClose, }) => {
|
|
4188
|
+
return (React__default.createElement("div", { className: b$b({ separator: hasSeparator }) },
|
|
4189
|
+
React__default.createElement(Text, { className: b$b('text'), as: 'h3', variant: 'subheader-3' }, children),
|
|
4190
|
+
onClose && (React__default.createElement(Button, { onClick: onClose, view: "flat", size: "l", extraProps: {
|
|
4191
|
+
'aria-label': dict['close'],
|
|
4192
|
+
} },
|
|
4193
|
+
React__default.createElement(Icon, { data: Xmark, size: closeIconSize })))));
|
|
4194
|
+
};
|
|
4195
|
+
Title.displayName = 'Title';
|
|
4196
|
+
|
|
4179
4197
|
function flattenHotkeyGroups(hotkeys) {
|
|
4180
4198
|
const result = [];
|
|
4181
4199
|
for (const hotkeysGroup of hotkeys) {
|
|
@@ -4203,10 +4221,10 @@ function filterHotkeys(hotkeys, filter) {
|
|
|
4203
4221
|
return hotkeys;
|
|
4204
4222
|
}
|
|
4205
4223
|
|
|
4206
|
-
var css_248z$
|
|
4207
|
-
styleInject(css_248z$
|
|
4224
|
+
var css_248z$9 = ".ycn-hotkeys-panel {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n --hotkeys-panel-width: 400px;\n --hotkeys-panel-vertical-padding: 18px;\n --hotkeys-panel-horizontal-padding: 24px;\n}\n.ycn-hotkeys-panel__drawer-item {\n width: var(--hotkeys-panel-width);\n padding: var(--hotkeys-panel-vertical-padding) 0;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n}\n.ycn-hotkeys-panel__title {\n margin: 0 var(--hotkeys-panel-horizontal-padding) 16px var(--hotkeys-panel-horizontal-padding);\n}\n.ycn-hotkeys-panel__search {\n padding: 0 var(--hotkeys-panel-horizontal-padding);\n margin-bottom: 14px;\n}\n.ycn-hotkeys-panel__list {\n flex: 1;\n overflow-y: auto;\n}\n.ycn-hotkeys-panel__item {\n height: auto;\n padding: 8px var(--hotkeys-panel-horizontal-padding);\n}\n.ycn-hotkeys-panel__item.yc-list__item_active {\n background: inherit;\n}\n.ycn-hotkeys-panel__item-content {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n width: 100%;\n font-size: var(--yc-text-body-1-font-size);\n line-height: var(--yc-text-body-1-line-height);\n color: var(--yc-color-text-primary);\n}\n.ycn-hotkeys-panel__item-content_group {\n font-size: var(--yc-text-body-2-font-size);\n font-weight: 500;\n line-height: var(--yc-text-body-2-line-height);\n}\n.ycn-hotkeys-panel__hotkey {\n color: var(--yc-color-text-complementary);\n}";
|
|
4225
|
+
styleInject(css_248z$9);
|
|
4208
4226
|
|
|
4209
|
-
const b$
|
|
4227
|
+
const b$a = block('hotkeys-panel');
|
|
4210
4228
|
function HotkeysPanel(_a) {
|
|
4211
4229
|
var { visible, onClose, leftOffset, topOffset, className, preventScrollBody, hotkeys, itemClassName, filterPlaceholder, title, emptyState } = _a, listProps = __rest(_a, ["visible", "onClose", "leftOffset", "topOffset", "className", "preventScrollBody", "hotkeys", "itemClassName", "filterPlaceholder", "title", "emptyState"]);
|
|
4212
4230
|
const [filter, setFilter] = useState('');
|
|
@@ -4214,18 +4232,18 @@ function HotkeysPanel(_a) {
|
|
|
4214
4232
|
const filteredHotkeys = filterHotkeys(hotkeys, filter);
|
|
4215
4233
|
return flattenHotkeyGroups(filteredHotkeys);
|
|
4216
4234
|
}, [hotkeys, filter]);
|
|
4217
|
-
const renderItem = useCallback((item) => (React__default.createElement("div", { className: b$
|
|
4235
|
+
const renderItem = useCallback((item) => (React__default.createElement("div", { className: b$a('item-content', { group: item.group }), key: item.title },
|
|
4218
4236
|
item.title,
|
|
4219
|
-
item.value && React__default.createElement(Hotkey, { className: b$
|
|
4237
|
+
item.value && React__default.createElement(Hotkey, { className: b$a('hotkey'), value: item.value }))), []);
|
|
4220
4238
|
const drawerItemContent = (React__default.createElement(React__default.Fragment, null,
|
|
4221
|
-
React__default.createElement("h2", { className: b$
|
|
4222
|
-
React__default.createElement(TextInput, { value: filter, onUpdate: setFilter, placeholder: filterPlaceholder, autoFocus: true, className: b$
|
|
4223
|
-
React__default.createElement(List, Object.assign({ className: b$
|
|
4224
|
-
return (React__default.createElement(Drawer, { className: b$
|
|
4239
|
+
React__default.createElement("h2", { className: b$a('title') }, title),
|
|
4240
|
+
React__default.createElement(TextInput, { value: filter, onUpdate: setFilter, placeholder: filterPlaceholder, autoFocus: true, className: b$a('search') }),
|
|
4241
|
+
React__default.createElement(List, Object.assign({ className: b$a('list'), virtualized: false, filterable: false, items: hotkeysList, renderItem: renderItem, itemClassName: b$a('item', itemClassName), emptyPlaceholder: emptyState }, listProps))));
|
|
4242
|
+
return (React__default.createElement(Drawer, { className: b$a(null, className), onVeilClick: onClose, onEscape: onClose, preventScrollBody: preventScrollBody, style: {
|
|
4225
4243
|
left: leftOffset,
|
|
4226
4244
|
top: topOffset,
|
|
4227
4245
|
} },
|
|
4228
|
-
React__default.createElement(DrawerItem, { id: "hotkeys", visible: visible, className: b$
|
|
4246
|
+
React__default.createElement(DrawerItem, { id: "hotkeys", visible: visible, className: b$a('drawer-item'), content: drawerItemContent })));
|
|
4229
4247
|
}
|
|
4230
4248
|
|
|
4231
4249
|
/**
|
|
@@ -4819,18 +4837,18 @@ function escapeStringForRegExp(input) {
|
|
|
4819
4837
|
return input.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
4820
4838
|
}
|
|
4821
4839
|
|
|
4822
|
-
const b$
|
|
4840
|
+
const b$9 = block('settings-search');
|
|
4823
4841
|
function SettingsSearch({ className, onChange, debounce = 200, inputRef, inputSize, placeholder, autoFocus = true, }) {
|
|
4824
4842
|
const onChangeStable = useStableCallback(onChange);
|
|
4825
4843
|
const handleUpdate = React__default.useCallback(debounce_1(onChangeStable, debounce), [debounce]);
|
|
4826
|
-
return (React__default.createElement("div", { className: b$
|
|
4844
|
+
return (React__default.createElement("div", { className: b$9(null, className) },
|
|
4827
4845
|
React__default.createElement(TextInput, { controlRef: inputRef, hasClear: true, autoFocus: autoFocus, size: inputSize, placeholder: placeholder, onUpdate: handleUpdate })));
|
|
4828
4846
|
}
|
|
4829
4847
|
|
|
4830
|
-
var css_248z$
|
|
4831
|
-
styleInject(css_248z$
|
|
4848
|
+
var css_248z$8 = ".ycn-settings-menu__group-heading {\n font-weight: var(--yc-text-accent-font-weight);\n display: inline-block;\n padding: 0 20px;\n margin-bottom: 12px;\n line-height: 18px;\n}\n.ycn-settings-menu__group + .ycn-settings-menu__group {\n margin-top: 24px;\n}\n.ycn-settings-menu__item {\n display: flex;\n align-items: center;\n height: 40px;\n padding: 0 20px;\n cursor: pointer;\n color: var(--yc-color-text-primary);\n}\n.ycn-settings-menu__item-icon {\n color: var(--yc-color-text-misc);\n margin-right: 5px;\n}\n.ycn-settings-menu__item:hover, .ycn-settings-menu__item_focused {\n background: var(--yc-color-base-simple-hover);\n}\n.ycn-settings-menu__item_selected {\n background: var(--yc-color-base-selection);\n}\n.ycn-settings-menu__item_selected:hover, .ycn-settings-menu__item_selected.ycn-settings-menu__item_focused {\n background: var(--yc-color-base-selection-hover);\n}\n.ycn-settings-menu__item_disabled {\n color: var(--yc-color-text-secondary);\n cursor: auto;\n}\n.ycn-settings-menu__item_disabled:hover {\n background: none;\n}\n.ycn-settings-menu__item_disabled .ycn-settings-menu__item-icon {\n color: var(--yc-color-base-misc-heavy);\n}\n.ycn-settings-menu__item_badge {\n position: relative;\n}\n.ycn-settings-menu__item_badge::after {\n content: \"\";\n display: block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: var(--yc-color-text-danger);\n position: absolute;\n right: 9px;\n top: calc(50% - 3px);\n}";
|
|
4849
|
+
styleInject(css_248z$8);
|
|
4832
4850
|
|
|
4833
|
-
const b$
|
|
4851
|
+
const b$8 = block('settings-menu');
|
|
4834
4852
|
const SettingsMenu = React__default.forwardRef(
|
|
4835
4853
|
// eslint-disable-next-line prefer-arrow-callback
|
|
4836
4854
|
function SettingsMenu({ items, onChange, activeItemId }, ref) {
|
|
@@ -4862,10 +4880,10 @@ function SettingsMenu({ items, onChange, activeItemId }, ref) {
|
|
|
4862
4880
|
setFocusId(undefined);
|
|
4863
4881
|
},
|
|
4864
4882
|
}), [getFocused, handleChange]);
|
|
4865
|
-
return (React__default.createElement("div", { ref: containerRef, className: b$
|
|
4883
|
+
return (React__default.createElement("div", { ref: containerRef, className: b$8() }, items.map((firstLevelItem) => {
|
|
4866
4884
|
if ('groupTitle' in firstLevelItem) {
|
|
4867
|
-
return (React__default.createElement("div", { key: firstLevelItem.groupTitle, className: b$
|
|
4868
|
-
React__default.createElement("span", { className: b$
|
|
4885
|
+
return (React__default.createElement("div", { key: firstLevelItem.groupTitle, className: b$8('group') },
|
|
4886
|
+
React__default.createElement("span", { className: b$8('group-heading') }, firstLevelItem.groupTitle),
|
|
4869
4887
|
firstLevelItem.items.map((item) => {
|
|
4870
4888
|
return renderMenuItem(item, onChange, activeItemId, focusItemId);
|
|
4871
4889
|
})));
|
|
@@ -4874,7 +4892,7 @@ function SettingsMenu({ items, onChange, activeItemId }, ref) {
|
|
|
4874
4892
|
})));
|
|
4875
4893
|
});
|
|
4876
4894
|
function renderMenuItem(item, onChange, activeItemId, focusItemId) {
|
|
4877
|
-
return (React__default.createElement("span", { key: item.title, className: b$
|
|
4895
|
+
return (React__default.createElement("span", { key: item.title, className: b$8('item', {
|
|
4878
4896
|
selected: activeItemId === item.id,
|
|
4879
4897
|
disabled: item.disabled,
|
|
4880
4898
|
focused: focusItemId === item.id,
|
|
@@ -4884,12 +4902,12 @@ function renderMenuItem(item, onChange, activeItemId, focusItemId) {
|
|
|
4884
4902
|
onChange(item.id);
|
|
4885
4903
|
}
|
|
4886
4904
|
}, "data-id": item.id },
|
|
4887
|
-
item.icon ? React__default.createElement(Icon, Object.assign({ size: 16 }, item.icon, { className: b$
|
|
4905
|
+
item.icon ? React__default.createElement(Icon, Object.assign({ size: 16 }, item.icon, { className: b$8('item-icon') })) : undefined,
|
|
4888
4906
|
React__default.createElement("span", null, item.title)));
|
|
4889
4907
|
}
|
|
4890
4908
|
function focusNext(container, focused, direction) {
|
|
4891
4909
|
var _a;
|
|
4892
|
-
const elements = container.querySelectorAll(`.${b$
|
|
4910
|
+
const elements = container.querySelectorAll(`.${b$8('item')}:not(.${b$8('item')}_disabled)`);
|
|
4893
4911
|
if (elements.length === 0) {
|
|
4894
4912
|
return undefined;
|
|
4895
4913
|
}
|
|
@@ -4901,10 +4919,10 @@ function focusNext(container, focused, direction) {
|
|
|
4901
4919
|
return (_a = elements[currentIndex].getAttribute('data-id')) !== null && _a !== void 0 ? _a : undefined;
|
|
4902
4920
|
}
|
|
4903
4921
|
|
|
4904
|
-
var css_248z$
|
|
4905
|
-
styleInject(css_248z$
|
|
4922
|
+
var css_248z$7 = ".ycn-settings-menu-mobile.yc-tabs_direction_horizontal {\n overflow-x: auto;\n flex-wrap: nowrap;\n overscroll-behavior-x: none;\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n.ycn-settings-menu-mobile.yc-tabs_direction_horizontal::-webkit-scrollbar {\n display: none;\n}\n.ycn-settings-menu-mobile__item_badge {\n position: relative;\n}\n.ycn-settings-menu-mobile__item_badge::after {\n content: \"\";\n display: block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: var(--yc-color-text-danger);\n position: absolute;\n right: -8px;\n top: 11px;\n}";
|
|
4923
|
+
styleInject(css_248z$7);
|
|
4906
4924
|
|
|
4907
|
-
const b$
|
|
4925
|
+
const b$7 = block('settings-menu-mobile');
|
|
4908
4926
|
const SettingsMenuMobile = ({ items, onChange, activeItemId, className, }) => {
|
|
4909
4927
|
const ref = React__default.useRef(null);
|
|
4910
4928
|
const tabItems = React__default.useMemo(() => {
|
|
@@ -4915,12 +4933,12 @@ const SettingsMenuMobile = ({ items, onChange, activeItemId, className, }) => {
|
|
|
4915
4933
|
id,
|
|
4916
4934
|
title,
|
|
4917
4935
|
disabled,
|
|
4918
|
-
className: b$
|
|
4936
|
+
className: b$7('item', { badge: withBadge }),
|
|
4919
4937
|
})));
|
|
4920
4938
|
}
|
|
4921
4939
|
else {
|
|
4922
4940
|
const { id, title, disabled, withBadge } = firstLevelItem;
|
|
4923
|
-
tabItems.push({ id, title, disabled, className: b$
|
|
4941
|
+
tabItems.push({ id, title, disabled, className: b$7('item', { badge: withBadge }) });
|
|
4924
4942
|
}
|
|
4925
4943
|
});
|
|
4926
4944
|
return tabItems;
|
|
@@ -4929,7 +4947,7 @@ const SettingsMenuMobile = ({ items, onChange, activeItemId, className, }) => {
|
|
|
4929
4947
|
e.stopPropagation();
|
|
4930
4948
|
};
|
|
4931
4949
|
return (React__default.createElement("div", { ref: ref, onTouchMove: handleTouchMove },
|
|
4932
|
-
React__default.createElement(Tabs, { items: tabItems, className: b$
|
|
4950
|
+
React__default.createElement(Tabs, { items: tabItems, className: b$7(null, className), size: "l", activeTab: activeItemId, onSelectTab: onChange })));
|
|
4933
4951
|
};
|
|
4934
4952
|
|
|
4935
4953
|
function getSettingsFromChildren(children, searchText = '') {
|
|
@@ -5053,10 +5071,10 @@ function getSettingsItemsFromChildren(children, filterRe) {
|
|
|
5053
5071
|
return { items, hidden };
|
|
5054
5072
|
}
|
|
5055
5073
|
|
|
5056
|
-
var css_248z = ".ycn-settings {\n display: grid;\n grid-template-columns: 216px 1fr;\n width: 834px;\n height: 100%;\n}\n.ycn-settings_view_mobile {\n display: block;\n width: auto;\n height: calc(80vh - 56px);\n overflow-x: hidden;\n}\n@supports (height: 90dvh) {\n .ycn-settings_view_mobile {\n /* stylelint-disable-next-line */\n height: calc(90dvh - 56px);\n }\n}\n.ycn-settings_view_mobile.ycn-settings_loading {\n text-align: center;\n}\n.ycn-settings_view_mobile .ycn-settings__loader {\n margin-top: 20px;\n}\n.ycn-settings_view_mobile .ycn-settings__search {\n padding: 0 20px;\n margin: 4px 0 16px;\n}\n.ycn-settings_view_mobile .ycn-settings__page {\n
|
|
5057
|
-
styleInject(css_248z);
|
|
5074
|
+
var css_248z$6 = ".ycn-settings {\n display: grid;\n grid-template-columns: 216px 1fr;\n width: 834px;\n height: 100%;\n}\n.ycn-settings_view_mobile {\n display: block;\n width: auto;\n height: calc(80vh - 56px);\n overflow-x: hidden;\n}\n@supports (height: 90dvh) {\n .ycn-settings_view_mobile {\n /* stylelint-disable-next-line */\n height: calc(90dvh - 56px);\n }\n}\n.ycn-settings_view_mobile.ycn-settings_loading {\n text-align: center;\n}\n.ycn-settings_view_mobile .ycn-settings__loader {\n margin-top: 20px;\n}\n.ycn-settings_view_mobile .ycn-settings__search {\n padding: 0 20px;\n margin: 4px 0 16px;\n}\n.ycn-settings_view_mobile .ycn-settings__page {\n overflow-y: visible;\n}\n.ycn-settings_view_mobile .ycn-settings__tabs .yc-tabs__item:first-child {\n margin-left: 20px;\n}\n.ycn-settings_view_mobile .ycn-settings__tabs .yc-tabs__item:last-child {\n margin-right: 20px;\n}\n.ycn-settings_view_mobile .ycn-settings__section-heading {\n font-size: var(--yc-text-subheader-3-font-size);\n line-height: var(--yc-text-subheader-3-line-height);\n font-weight: var(--yc-text-subheader-font-weight);\n}\n.ycn-settings_view_mobile .ycn-settings__section-subheader {\n color: var(--yc-color-text-secondary);\n}\n.ycn-settings_view_mobile .ycn-settings__section-heading + .ycn-settings-subheader {\n margin-top: 8px;\n}\n.ycn-settings_view_mobile .ycn-settings__section-item {\n margin-top: 0;\n}\n.ycn-settings_view_mobile .ycn-settings__section-heading + .ycn-settings__section-item, .ycn-settings_view_mobile .ycn-settings__section-subheader + .ycn-settings__section-item {\n margin-top: 30px;\n}\n.ycn-settings_view_mobile .ycn-settings__section-item + .ycn-settings__section-item {\n margin-top: 22px;\n}\n.ycn-settings_view_mobile .ycn-settings__item:not(.ycn-settings_view_mobile .ycn-settings__item_mode_row) {\n grid-template-columns: 1fr;\n gap: 8px;\n}\n.ycn-settings_view_mobile .ycn-settings__item-heading {\n font-size: var(--yc-text-body-2-font-size);\n line-height: var(--yc-text-body-2-line-height);\n font-weight: var(--yc-text-body-font-weight);\n}\n.ycn-settings_view_mobile .ycn-settings__item-description {\n font-size: var(--yc-text-body-1-font-size);\n line-height: var(--yc-text-body-1-line-height);\n font-weight: var(--yc-text-body-font-weight);\n}\n.ycn-settings_view_mobile .ycn-settings__item_mode_row {\n grid-template-columns: 1fr auto;\n}\n.ycn-settings_view_mobile .ycn-settings__item_mode_row .ycn-settings__item-heading {\n padding-right: 20px;\n}\n.ycn-settings_view_mobile .ycn-settings__item-content {\n width: 100%;\n}\n.ycn-settings_loading {\n grid-template-columns: auto;\n}\n.ycn-settings__loader {\n align-self: center;\n justify-self: center;\n}\n.ycn-settings__not-found {\n display: grid;\n align-items: center;\n justify-items: center;\n height: 100%;\n}\n.ycn-settings__menu {\n border-right: 1px solid var(--yc-color-line-generic);\n}\n.ycn-settings__heading {\n font-size: var(--yc-text-subheader-2-font-size);\n line-height: var(--yc-text-subheader-2-line-height);\n font-weight: var(--yc-text-subheader-font-weight);\n margin: 20px 20px 0;\n}\n.ycn-settings__search {\n margin: 0 20px 16px;\n}\n.ycn-settings__page {\n overflow-y: auto;\n}\n.ycn-settings__content {\n padding: 20px;\n}\n.ycn-settings__section-heading {\n font-size: var(--yc-text-subheader-2-font-size);\n line-height: var(--yc-text-subheader-2-line-height);\n font-weight: var(--yc-text-subheader-font-weight);\n margin: 0;\n}\n.ycn-settings__section-item {\n margin-top: 24px;\n}\n.ycn-settings__section + .ycn-settings__section {\n margin-top: 32px;\n}\n.ycn-settings__item {\n display: grid;\n grid-template-columns: 216px 1fr;\n justify-items: start;\n}\n.ycn-settings__item_align_top {\n align-items: start;\n}\n.ycn-settings__item_align_center {\n align-items: center;\n}\n.ycn-settings__item-title_badge {\n position: relative;\n}\n.ycn-settings__item-title_badge::after {\n content: \"\";\n display: block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background-color: var(--yc-color-text-danger);\n position: absolute;\n right: -8px;\n top: 1px;\n}\n.ycn-settings__item-description {\n font-size: var(--yc-text-caption-2-font-size);\n line-height: var(--yc-text-caption-2-line-height);\n font-weight: var(--yc-text-caption-font-weight);\n display: block;\n margin-top: 2px;\n padding-right: 20px;\n color: var(--yc-color-text-secondary);\n}\n.ycn-settings__found {\n font-weight: var(--yc-text-accent-font-weight);\n background: var(--yc-color-base-selection);\n}";
|
|
5075
|
+
styleInject(css_248z$6);
|
|
5058
5076
|
|
|
5059
|
-
const b = block('settings');
|
|
5077
|
+
const b$6 = block('settings');
|
|
5060
5078
|
const defaultDict = {
|
|
5061
5079
|
heading_settings: 'Settings',
|
|
5062
5080
|
placeholder_search: 'Search settings',
|
|
@@ -5065,14 +5083,26 @@ const defaultDict = {
|
|
|
5065
5083
|
function Settings(_a) {
|
|
5066
5084
|
var { loading, renderLoading, children, view = 'normal' } = _a, props = __rest(_a, ["loading", "renderLoading", "children", "view"]);
|
|
5067
5085
|
if (loading) {
|
|
5068
|
-
return (React__default.createElement("div", { className: b({ loading: true, view }) }, typeof renderLoading === 'function' ? (renderLoading()) : (React__default.createElement(Loader, { className: b('loader'), size: "m" }))));
|
|
5086
|
+
return (React__default.createElement("div", { className: b$6({ loading: true, view }) }, typeof renderLoading === 'function' ? (renderLoading()) : (React__default.createElement(Loader, { className: b$6('loader'), size: "m" }))));
|
|
5069
5087
|
}
|
|
5070
5088
|
return (React__default.createElement(SettingsContent, Object.assign({ view: view }, props), children));
|
|
5071
5089
|
}
|
|
5090
|
+
const getPageTitleById = (menu, activePage) => {
|
|
5091
|
+
for (const firstLevel of menu) {
|
|
5092
|
+
if ('groupTitle' in firstLevel) {
|
|
5093
|
+
for (const secondLevel of firstLevel.items)
|
|
5094
|
+
if (secondLevel.id === activePage)
|
|
5095
|
+
return secondLevel.title;
|
|
5096
|
+
}
|
|
5097
|
+
else if (firstLevel.id === activePage)
|
|
5098
|
+
return firstLevel.title;
|
|
5099
|
+
}
|
|
5100
|
+
return '';
|
|
5101
|
+
};
|
|
5072
5102
|
Settings.defaultProps = {
|
|
5073
5103
|
dict: defaultDict,
|
|
5074
5104
|
};
|
|
5075
|
-
function SettingsContent({ initialPage,
|
|
5105
|
+
function SettingsContent({ initialPage, children, renderNotFound, dict, view, onPageChange, onClose, }) {
|
|
5076
5106
|
var _a, _b;
|
|
5077
5107
|
const [search, setSearch] = React__default.useState('');
|
|
5078
5108
|
const { menu, pages } = getSettingsFromChildren(children, search);
|
|
@@ -5114,19 +5144,23 @@ function SettingsContent({ initialPage, onPageChange, children, renderNotFound,
|
|
|
5114
5144
|
});
|
|
5115
5145
|
const renderPageContent = () => {
|
|
5116
5146
|
if (!activePage) {
|
|
5117
|
-
return typeof renderNotFound === 'function' ? (renderNotFound()) : (React__default.createElement("div", { className: b('not-found') }, dict === null || dict === void 0 ? void 0 : dict.not_found));
|
|
5147
|
+
return typeof renderNotFound === 'function' ? (renderNotFound()) : (React__default.createElement("div", { className: b$6('not-found') }, dict === null || dict === void 0 ? void 0 : dict.not_found));
|
|
5118
5148
|
}
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5149
|
+
const filteredSections = pages[activePage].sections.filter((section) => !section.hidden);
|
|
5150
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
5151
|
+
!isMobile && (React__default.createElement(Title, { hasSeparator: true, onClose: onClose }, getPageTitleById(menu, activePage))),
|
|
5152
|
+
React__default.createElement("div", { className: b$6('content') }, filteredSections.map((section) => (React__default.createElement("div", { key: section.title, className: b$6('section') },
|
|
5153
|
+
section.showTitle && (React__default.createElement("h3", { className: b$6('section-heading') }, section.title)),
|
|
5154
|
+
section.header &&
|
|
5155
|
+
(isMobile ? (React__default.createElement("div", { className: b$6('section-subheader') }, section.header)) : (section.header)),
|
|
5156
|
+
section.items.map(({ hidden, title, element }) => hidden ? null : (React__default.createElement("div", { key: title, className: b$6('section-item') }, React__default.cloneElement(element, Object.assign(Object.assign({}, element.props), { title: search && title
|
|
5157
|
+
? prepareTitle(title, search)
|
|
5158
|
+
: title })))))))))));
|
|
5125
5159
|
};
|
|
5126
|
-
return (React__default.createElement("div", { className: b({ view }) },
|
|
5160
|
+
return (React__default.createElement("div", { className: b$6({ view }) },
|
|
5127
5161
|
isMobile ? (React__default.createElement(React__default.Fragment, null,
|
|
5128
|
-
React__default.createElement(SettingsSearch, { inputRef: searchInputRef, className: b('search'), onChange: setSearch, autoFocus: false, inputSize: 'l' }),
|
|
5129
|
-
React__default.createElement(SettingsMenuMobile, { items: menu, onChange: handlePageChange, activeItemId: activePage, className: b('tabs') }))) : (React__default.createElement("div", { className: b('menu'), onClick: () => {
|
|
5162
|
+
React__default.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$6('search'), onChange: setSearch, autoFocus: false, inputSize: 'l' }),
|
|
5163
|
+
React__default.createElement(SettingsMenuMobile, { items: menu, onChange: handlePageChange, activeItemId: activePage, className: b$6('tabs') }))) : (React__default.createElement("div", { className: b$6('menu'), onClick: () => {
|
|
5130
5164
|
if (searchInputRef.current) {
|
|
5131
5165
|
searchInputRef.current.focus();
|
|
5132
5166
|
}
|
|
@@ -5137,10 +5171,10 @@ function SettingsContent({ initialPage, onPageChange, children, renderNotFound,
|
|
|
5137
5171
|
}
|
|
5138
5172
|
}
|
|
5139
5173
|
} },
|
|
5140
|
-
React__default.createElement(
|
|
5141
|
-
React__default.createElement(SettingsSearch, { inputRef: searchInputRef, className: b('search'), onChange: setSearch, placeholder: dict === null || dict === void 0 ? void 0 : dict.placeholder_search, autoFocus: true }),
|
|
5174
|
+
React__default.createElement(Title, null, dict === null || dict === void 0 ? void 0 : dict.heading_settings),
|
|
5175
|
+
React__default.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$6('search'), onChange: setSearch, placeholder: dict === null || dict === void 0 ? void 0 : dict.placeholder_search, autoFocus: true }),
|
|
5142
5176
|
React__default.createElement(SettingsMenu, { ref: menuRef, items: menu, onChange: handlePageChange, activeItemId: activePage }))),
|
|
5143
|
-
React__default.createElement("div", { className: b('page') }, renderPageContent())));
|
|
5177
|
+
React__default.createElement("div", { className: b$6('page') }, renderPageContent())));
|
|
5144
5178
|
}
|
|
5145
5179
|
Settings.Group = function SettingsGroup({ children }) {
|
|
5146
5180
|
return React__default.createElement(React__default.Fragment, null, children);
|
|
@@ -5152,11 +5186,11 @@ Settings.Section = function SettingsSection({ children }) {
|
|
|
5152
5186
|
return React__default.createElement(React__default.Fragment, null, children);
|
|
5153
5187
|
};
|
|
5154
5188
|
Settings.Item = function SettingsItem({ title, children, align = 'center', withBadge, renderTitleComponent = identity_1, mode, description, }) {
|
|
5155
|
-
return (React__default.createElement("div", { className: b('item', { align, mode }) },
|
|
5156
|
-
React__default.createElement("label", { className: b('item-heading') },
|
|
5157
|
-
React__default.createElement("span", { className: b('item-title', { badge: withBadge }) }, renderTitleComponent(title)),
|
|
5158
|
-
description ? React__default.createElement("span", { className: b('item-description') }, description) : null),
|
|
5159
|
-
React__default.createElement("div", { className: b('item-content') }, children)));
|
|
5189
|
+
return (React__default.createElement("div", { className: b$6('item', { align, mode }) },
|
|
5190
|
+
React__default.createElement("label", { className: b$6('item-heading') },
|
|
5191
|
+
React__default.createElement("span", { className: b$6('item-title', { badge: withBadge }) }, renderTitleComponent(title)),
|
|
5192
|
+
description ? React__default.createElement("span", { className: b$6('item-description') }, description) : null),
|
|
5193
|
+
React__default.createElement("div", { className: b$6('item-content') }, children)));
|
|
5160
5194
|
};
|
|
5161
5195
|
function prepareTitle(string, search) {
|
|
5162
5196
|
let temp = string.slice(0);
|
|
@@ -5172,7 +5206,7 @@ function prepareTitle(string, search) {
|
|
|
5172
5206
|
if (i > 0) {
|
|
5173
5207
|
title.push(temp.slice(0, i));
|
|
5174
5208
|
}
|
|
5175
|
-
title.push(React__default.createElement("strong", { key: key++, className: b('found') }, m));
|
|
5209
|
+
title.push(React__default.createElement("strong", { key: key++, className: b$6('found') }, m));
|
|
5176
5210
|
temp = temp.slice(i + m.length);
|
|
5177
5211
|
}
|
|
5178
5212
|
}
|
|
@@ -5182,5 +5216,251 @@ function prepareTitle(string, search) {
|
|
|
5182
5216
|
return title;
|
|
5183
5217
|
}
|
|
5184
5218
|
|
|
5185
|
-
|
|
5219
|
+
const useForwardRef = (ref, initialValue = null) => {
|
|
5220
|
+
const targetRef = React__default.useRef(initialValue);
|
|
5221
|
+
React__default.useEffect(() => {
|
|
5222
|
+
if (!ref)
|
|
5223
|
+
return;
|
|
5224
|
+
if (typeof ref === 'function') {
|
|
5225
|
+
ref(targetRef.current);
|
|
5226
|
+
}
|
|
5227
|
+
else {
|
|
5228
|
+
ref.current = targetRef.current;
|
|
5229
|
+
}
|
|
5230
|
+
}, [ref]);
|
|
5231
|
+
return targetRef;
|
|
5232
|
+
};
|
|
5233
|
+
|
|
5234
|
+
var css_248z$5 = ".ycn-mobile-header-burger {\n margin: 0;\n padding: 0;\n font-family: var(--yc-text-body-font-family);\n font-size: inherit;\n font-weight: 400;\n color: inherit;\n background: none;\n border: none;\n outline: none;\n cursor: pointer;\n}\n.ycn-mobile-header-burger_opened .ycn-mobile-header-burger__icon:before, .ycn-mobile-header-burger_opened .ycn-mobile-header-burger__icon:after,\n.ycn-mobile-header-burger_opened .ycn-mobile-header-burger__icon .ycn-mobile-header-burger__icon-dash {\n left: 3px;\n}\n.ycn-mobile-header-burger_opened .ycn-mobile-header-burger__icon:before {\n transform: rotate(45deg);\n}\n.ycn-mobile-header-burger_opened .ycn-mobile-header-burger__icon:after {\n transform: rotate(-45deg);\n}\n.ycn-mobile-header-burger_opened .ycn-mobile-header-burger__icon .ycn-mobile-header-burger__icon-dash {\n opacity: 0;\n}\n.ycn-mobile-header-burger__icon {\n display: flex;\n align-content: center;\n justify-content: center;\n height: var(--mobile-header-icon-size);\n width: var(--mobile-header-icon-size);\n position: relative;\n}\n.ycn-mobile-header-burger__icon:after, .ycn-mobile-header-burger__icon:before {\n content: \"\";\n transform-origin: left center;\n transition: transform 0.2s, left 0.2s;\n}\n.ycn-mobile-header-burger__icon:before {\n top: 2px;\n}\n.ycn-mobile-header-burger__icon:after {\n bottom: 2px;\n}\n.ycn-mobile-header-burger__icon:before, .ycn-mobile-header-burger__icon:after,\n.ycn-mobile-header-burger__icon .ycn-mobile-header-burger__icon-dash {\n background-color: var(--yc-color-text-primary);\n border-radius: 1px;\n height: 2px;\n left: 0;\n position: absolute;\n width: 100%;\n}\n.ycn-mobile-header-burger__icon .ycn-mobile-header-burger__icon-dash {\n margin-top: -1px;\n top: 50%;\n transition: opacity 0.2s;\n}";
|
|
5235
|
+
styleInject(css_248z$5);
|
|
5236
|
+
|
|
5237
|
+
const b$5 = block('mobile-header-burger');
|
|
5238
|
+
const Burger = React__default.memo(({ opened, className, onClick }) => (React__default.createElement("button", { className: b$5({ opened }, className), onClick: onClick, "aria-label": opened ? defaultDict$2['button_close-burger'] : defaultDict$2['button_open-burger'] },
|
|
5239
|
+
React__default.createElement("span", { className: b$5('icon') },
|
|
5240
|
+
React__default.createElement("span", { className: b$5('icon-dash') })))));
|
|
5241
|
+
Burger.displayName = 'Burger';
|
|
5242
|
+
|
|
5243
|
+
var css_248z$4 = ".ycn-mobile-header-logo {\n display: flex;\n align-items: center;\n overflow: hidden;\n gap: 8px;\n}\n.ycn-mobile-header-logo:is(a), .ycn-mobile-header-logo:is(a):hover, .ycn-mobile-header-logo:is(a):active, .ycn-mobile-header-logo:is(a):visited, .ycn-mobile-header-logo:is(a):focus {\n text-decoration: none;\n outline: none;\n color: var(--yc-color-text-primary);\n}\n.ycn-mobile-header-logo__icon {\n flex-shrink: 0;\n}\n.ycn-mobile-header-logo__title {\n font-size: var(--yc-text-header-1-font-size);\n line-height: var(--yc-text-header-1-line-height);\n font-weight: var(--yc-text-header-font-weight);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}";
|
|
5244
|
+
styleInject(css_248z$4);
|
|
5245
|
+
|
|
5246
|
+
const b$4 = block('mobile-header-logo');
|
|
5247
|
+
const Logo = ({ text, compact, icon, iconSrc, iconClassName, iconSize = 32, textSize = 20, href = '/', wrapper, onClick, }) => {
|
|
5248
|
+
const hasClickHandler = typeof onClick === 'function';
|
|
5249
|
+
const hasWrapper = typeof wrapper === 'function';
|
|
5250
|
+
const linkProps = hasClickHandler
|
|
5251
|
+
? {}
|
|
5252
|
+
: {
|
|
5253
|
+
target: '_self',
|
|
5254
|
+
href,
|
|
5255
|
+
};
|
|
5256
|
+
let logoIcon;
|
|
5257
|
+
if (iconSrc) {
|
|
5258
|
+
logoIcon = (React__default.createElement("img", { alt: "logo icon", src: iconSrc, width: iconSize, height: iconSize, className: iconClassName }));
|
|
5259
|
+
}
|
|
5260
|
+
else if (icon) {
|
|
5261
|
+
logoIcon = React__default.createElement(Icon, { data: icon, size: iconSize, className: b$4('icon', iconClassName) });
|
|
5262
|
+
}
|
|
5263
|
+
let logoTitle;
|
|
5264
|
+
if (typeof text === 'function') {
|
|
5265
|
+
logoTitle = text();
|
|
5266
|
+
}
|
|
5267
|
+
else {
|
|
5268
|
+
logoTitle = (React__default.createElement("span", { className: b$4('title'), style: { fontSize: textSize } }, text));
|
|
5269
|
+
}
|
|
5270
|
+
const logo = (React__default.createElement(React__default.Fragment, null,
|
|
5271
|
+
logoIcon,
|
|
5272
|
+
logoTitle));
|
|
5273
|
+
return hasWrapper ? (React__default.createElement("div", { className: b$4(), onClick: onClick }, wrapper(logo, compact))) : (React__default.createElement("a", Object.assign({}, linkProps, { className: b$4(), onClick: onClick }), logo));
|
|
5274
|
+
};
|
|
5275
|
+
|
|
5276
|
+
const MOBILE_ITEM_HEIGHT = 48;
|
|
5277
|
+
const MOBILE_HEADER_COMPACT_HEIGHT = 50;
|
|
5278
|
+
const MOBILE_HEADER_EXPANDED_HEIGHT = 120;
|
|
5279
|
+
const MOBILE_HEADER_ICON_SIZE = 20;
|
|
5280
|
+
const EVENT_NAMES = {
|
|
5281
|
+
toggleEvent: 'MOBILE_PANEL_TOGGLE',
|
|
5282
|
+
closeEvent: 'MOBILE_PANEL_CLOSE',
|
|
5283
|
+
openEvent: 'MOBILE_PANEL_OPEN',
|
|
5284
|
+
};
|
|
5285
|
+
const BURGER_PANEL_ITEM_ID = 'burger';
|
|
5286
|
+
|
|
5287
|
+
const getItemHeight = (item) => {
|
|
5288
|
+
switch (item.type) {
|
|
5289
|
+
case 'divider':
|
|
5290
|
+
return 1;
|
|
5291
|
+
default:
|
|
5292
|
+
return MOBILE_ITEM_HEIGHT;
|
|
5293
|
+
}
|
|
5294
|
+
};
|
|
5295
|
+
const getSelectedItemIndex = (items) => {
|
|
5296
|
+
const index = items.findIndex(({ current }) => Boolean(current));
|
|
5297
|
+
return index === -1 ? undefined : index;
|
|
5298
|
+
};
|
|
5299
|
+
|
|
5300
|
+
var css_248z$3 = ".ycn-burger-composite-bar {\n overflow-y: auto;\n}\n.ycn-burger-composite-bar__item {\n display: flex;\n height: 100%;\n align-items: center;\n flex-grow: 1;\n box-sizing: border-box;\n padding: 4px 22px 4px 12px;\n overflow: hidden;\n}\n.ycn-burger-composite-bar__item-icon-place {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 40px;\n margin-right: 8px;\n}\n.ycn-burger-composite-bar .ycn-burger-composite-bar__item-icon {\n color: var(--yc-color-text-misc);\n}\n.ycn-burger-composite-bar__item-title {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--yc-text-body-2-font-size);\n line-height: var(--yc-text-body-2-line-height);\n font-weight: var(--yc-text-body-font-weight);\n}\n.ycn-burger-composite-bar__link {\n display: flex;\n flex-grow: 1;\n height: 100%;\n align-items: center;\n}\n.ycn-burger-composite-bar__link, .ycn-burger-composite-bar__link:hover, .ycn-burger-composite-bar__link:active, .ycn-burger-composite-bar__link:visited, .ycn-burger-composite-bar__link:focus {\n text-decoration: none;\n outline: none;\n color: inherit;\n}\n.ycn-burger-composite-bar__menu-divider {\n margin: 0;\n flex-grow: 1;\n border-top: 1px solid var(--yc-color-line-generic);\n}\n.ycn-burger-composite-bar__root-menu-item.yc-list__item_selected {\n background-color: var(--yc-color-base-selection);\n}\n.ycn-burger-composite-bar__root-menu-item:not(.yc-list__item_selected).yc-list__item_active {\n background: none;\n}";
|
|
5301
|
+
styleInject(css_248z$3);
|
|
5302
|
+
|
|
5303
|
+
const b$3 = block('burger-composite-bar');
|
|
5304
|
+
const Item = ({ item, onItemClick }) => {
|
|
5305
|
+
const { icon, type = 'regular', iconSize = MOBILE_HEADER_ICON_SIZE } = item;
|
|
5306
|
+
if (type === 'divider') {
|
|
5307
|
+
return React__default.createElement("div", { className: b$3('menu-divider') });
|
|
5308
|
+
}
|
|
5309
|
+
const node = (React__default.createElement("div", { className: b$3('item', { type }), onClick: () => {
|
|
5310
|
+
if (typeof item.onItemClick === 'function') {
|
|
5311
|
+
item.onItemClick(item);
|
|
5312
|
+
}
|
|
5313
|
+
if (type === 'regular') {
|
|
5314
|
+
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item);
|
|
5315
|
+
}
|
|
5316
|
+
} },
|
|
5317
|
+
React__default.createElement("div", { className: b$3('item-icon-place') }, icon && React__default.createElement(Icon, { data: icon, size: iconSize, className: b$3('item-icon') })),
|
|
5318
|
+
React__default.createElement("div", { className: b$3('item-title') }, item.title)));
|
|
5319
|
+
if (typeof item.itemWrapper === 'function') {
|
|
5320
|
+
return item.itemWrapper(node, item);
|
|
5321
|
+
}
|
|
5322
|
+
return item.link ? (React__default.createElement("a", { href: item.link, className: b$3('link') }, node)) : (node);
|
|
5323
|
+
};
|
|
5324
|
+
Item.displayName = 'Item';
|
|
5325
|
+
const BurgerCompositeBar = React__default.memo(({ items, onItemClick }) => {
|
|
5326
|
+
return (React__default.createElement("nav", { className: b$3() },
|
|
5327
|
+
React__default.createElement(List, { items: items, selectedItemIndex: getSelectedItemIndex(items), itemHeight: getItemHeight, itemClassName: b$3('root-menu-item'), virtualized: false, filterable: false, sortable: false, renderItem: (item) => React__default.createElement(Item, { item: item, onItemClick: onItemClick }) })));
|
|
5328
|
+
});
|
|
5329
|
+
BurgerCompositeBar.displayName = 'BurgerCompositeBar';
|
|
5330
|
+
|
|
5331
|
+
var css_248z$2 = ".ycn-mobile-header-burger-menu {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.ycn-mobile-header-burger-menu__footer {\n display: flex;\n border-top: 1px solid var(--yc-color-base-generic);\n margin-top: auto;\n}";
|
|
5332
|
+
styleInject(css_248z$2);
|
|
5333
|
+
|
|
5334
|
+
const b$2 = block('mobile-header-burger-menu');
|
|
5335
|
+
const BurgerMenu = React__default.memo(({ items = [], renderFooter, modalItem, className, onItemClick }) => {
|
|
5336
|
+
var _a;
|
|
5337
|
+
return (React__default.createElement("div", { className: b$2(null, className) },
|
|
5338
|
+
modalItem && (React__default.createElement(Sheet, { visible: modalItem.visible, id: modalItem.id, title: modalItem.title, onClose: modalItem.onClose, contentClassName: modalItem.contentClassName, className: modalItem.className }, (_a = modalItem.renderContent) === null || _a === void 0 ? void 0 : _a.call(modalItem))),
|
|
5339
|
+
React__default.createElement(BurgerCompositeBar, { items: items, onItemClick: onItemClick }),
|
|
5340
|
+
renderFooter && React__default.createElement("div", { className: b$2('footer') }, renderFooter === null || renderFooter === void 0 ? void 0 : renderFooter())));
|
|
5341
|
+
});
|
|
5342
|
+
BurgerMenu.displayName = 'BurgerMenu';
|
|
5343
|
+
|
|
5344
|
+
var css_248z$1 = ".ycn-mobile-header {\n --mobile-header-min-heigth: 50px;\n --mobile-header-icon-size: 20px;\n background-color: var(--yc-color-base-background);\n}\n.ycn-mobile-header__header {\n background-color: var(--yc-color-base-background);\n border-bottom: 1px solid var(--yc-color-line-generic);\n position: sticky;\n top: 0;\n padding: 0 10px;\n box-sizing: border-box;\n display: flex;\n justify-content: space-between;\n align-items: center;\n z-index: 100;\n}\n.ycn-mobile-header__burger {\n padding: 12px;\n}\n.ycn-mobile-header__burger-menu, .ycn-mobile-header__panel-item {\n background-color: var(--yc-color-base-background);\n width: 320px;\n max-width: 90vw;\n max-height: 100%;\n}\n.ycn-mobile-header__user-menu {\n overflow-y: auto;\n}\n.ycn-mobile-header__panels {\n z-index: 98;\n position: fixed;\n left: 0;\n right: 0;\n bottom: 0;\n top: var(--mobile-header-min-heigth);\n overflow: hidden;\n}\n.ycn-mobile-header__content {\n overflow: auto;\n}";
|
|
5345
|
+
styleInject(css_248z$1);
|
|
5346
|
+
|
|
5347
|
+
const b$1 = block('mobile-header');
|
|
5348
|
+
const MobileHeader = React__default.forwardRef(({ logo, burgerMenu, panelItems = [], renderContent, sideItemRenderContent, onClosePanel, onEvent, className, }, ref) => {
|
|
5349
|
+
const targetRef = useForwardRef(ref);
|
|
5350
|
+
const [compact] = useState(true);
|
|
5351
|
+
const [visiblePanel, setVisiblePanel] = useState(null);
|
|
5352
|
+
// for expand top panel cases (i.e. switch service panel). Will be removed if not used in future design
|
|
5353
|
+
const size = compact ? MOBILE_HEADER_COMPACT_HEIGHT : MOBILE_HEADER_EXPANDED_HEIGHT;
|
|
5354
|
+
const onPanelToggle = useCallback((name) => {
|
|
5355
|
+
if (!name)
|
|
5356
|
+
return;
|
|
5357
|
+
setVisiblePanel((prev) => {
|
|
5358
|
+
const panelOpen = prev === name;
|
|
5359
|
+
onEvent === null || onEvent === void 0 ? void 0 : onEvent(name, panelOpen ? EVENT_NAMES.closeEvent : EVENT_NAMES.openEvent);
|
|
5360
|
+
return panelOpen ? null : name;
|
|
5361
|
+
});
|
|
5362
|
+
}, [visiblePanel, onEvent]);
|
|
5363
|
+
const onMobilePanelToggle = useCallback(({ detail }) => {
|
|
5364
|
+
if (typeof (detail === null || detail === void 0 ? void 0 : detail.panelName) === 'string') {
|
|
5365
|
+
onPanelToggle(detail === null || detail === void 0 ? void 0 : detail.panelName);
|
|
5366
|
+
}
|
|
5367
|
+
}, [onEvent]);
|
|
5368
|
+
const onMobilePanelOpen = useCallback(({ detail }) => {
|
|
5369
|
+
if (typeof (detail === null || detail === void 0 ? void 0 : detail.panelName) === 'string') {
|
|
5370
|
+
onEvent === null || onEvent === void 0 ? void 0 : onEvent(detail === null || detail === void 0 ? void 0 : detail.panelName, EVENT_NAMES.openEvent);
|
|
5371
|
+
setVisiblePanel(detail === null || detail === void 0 ? void 0 : detail.panelName);
|
|
5372
|
+
}
|
|
5373
|
+
}, [onEvent]);
|
|
5374
|
+
const onMobilePanelClose = useCallback(({ detail }) => {
|
|
5375
|
+
if (typeof (detail === null || detail === void 0 ? void 0 : detail.panelName) === 'string') {
|
|
5376
|
+
onEvent === null || onEvent === void 0 ? void 0 : onEvent(detail === null || detail === void 0 ? void 0 : detail.panelName, EVENT_NAMES.closeEvent);
|
|
5377
|
+
setVisiblePanel(null);
|
|
5378
|
+
}
|
|
5379
|
+
}, [onEvent]);
|
|
5380
|
+
const onBurgerOpen = useCallback(() => {
|
|
5381
|
+
onEvent === null || onEvent === void 0 ? void 0 : onEvent(BURGER_PANEL_ITEM_ID, EVENT_NAMES.openEvent);
|
|
5382
|
+
setVisiblePanel(BURGER_PANEL_ITEM_ID);
|
|
5383
|
+
}, [onEvent]);
|
|
5384
|
+
const onBurgerClose = useCallback(() => {
|
|
5385
|
+
onEvent === null || onEvent === void 0 ? void 0 : onEvent(BURGER_PANEL_ITEM_ID, EVENT_NAMES.closeEvent);
|
|
5386
|
+
setVisiblePanel(null);
|
|
5387
|
+
}, [onEvent]);
|
|
5388
|
+
const onCloseDrawer = useCallback(() => {
|
|
5389
|
+
if (visiblePanel) {
|
|
5390
|
+
onEvent === null || onEvent === void 0 ? void 0 : onEvent(visiblePanel, EVENT_NAMES.closeEvent);
|
|
5391
|
+
}
|
|
5392
|
+
setVisiblePanel(null);
|
|
5393
|
+
}, [visiblePanel, onEvent]);
|
|
5394
|
+
const onBurgerMenuItemClick = useCallback((item) => {
|
|
5395
|
+
var _a;
|
|
5396
|
+
const closeMenuOnClick = (_a = item.closeMenuOnClick) !== null && _a !== void 0 ? _a : true;
|
|
5397
|
+
if (closeMenuOnClick) {
|
|
5398
|
+
onBurgerClose();
|
|
5399
|
+
}
|
|
5400
|
+
}, [onBurgerClose]);
|
|
5401
|
+
const renderBurgerMenuFooter = useCallback(() => {
|
|
5402
|
+
var _a;
|
|
5403
|
+
return (_a = burgerMenu.renderFooter) === null || _a === void 0 ? void 0 : _a.call(burgerMenu, {
|
|
5404
|
+
size,
|
|
5405
|
+
isCompact: compact,
|
|
5406
|
+
});
|
|
5407
|
+
}, [burgerMenu.renderFooter, size, compact]);
|
|
5408
|
+
const onLogoClick = useCallback((event) => {
|
|
5409
|
+
var _a;
|
|
5410
|
+
onClosePanel === null || onClosePanel === void 0 ? void 0 : onClosePanel();
|
|
5411
|
+
(_a = logo.onClick) === null || _a === void 0 ? void 0 : _a.call(logo, event);
|
|
5412
|
+
}, [logo.onClick, onClosePanel]);
|
|
5413
|
+
const burgerPanelItem = useMemo(() => ({
|
|
5414
|
+
id: BURGER_PANEL_ITEM_ID,
|
|
5415
|
+
content: (React__default.createElement(BurgerMenu, { items: burgerMenu.items, modalItem: burgerMenu.modalItem, renderFooter: renderBurgerMenuFooter, onItemClick: onBurgerMenuItemClick, className: b$1('burger-menu') })),
|
|
5416
|
+
}), [burgerMenu]);
|
|
5417
|
+
useEffect(() => {
|
|
5418
|
+
const node = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current;
|
|
5419
|
+
if (node) {
|
|
5420
|
+
node.addEventListener('MOBILE_BURGER_OPEN', onBurgerOpen);
|
|
5421
|
+
node.addEventListener('MOBILE_BURGER_CLOSE', onBurgerClose);
|
|
5422
|
+
node.addEventListener('MOBILE_PANEL_TOGGLE', onMobilePanelToggle);
|
|
5423
|
+
node.addEventListener('MOBILE_PANEL_OPEN', onMobilePanelOpen);
|
|
5424
|
+
node.addEventListener('MOBILE_PANEL_CLOSE', onMobilePanelClose);
|
|
5425
|
+
}
|
|
5426
|
+
return () => {
|
|
5427
|
+
if (node) {
|
|
5428
|
+
node.removeEventListener('MOBILE_BURGER_OPEN', onBurgerOpen);
|
|
5429
|
+
node.removeEventListener('MOBILE_BURGER_CLOSE', onBurgerClose);
|
|
5430
|
+
node.removeEventListener('MOBILE_PANEL_TOGGLE', onMobilePanelToggle);
|
|
5431
|
+
node.removeEventListener('MOBILE_PANEL_OPEN', onMobilePanelOpen);
|
|
5432
|
+
node.removeEventListener('MOBILE_PANEL_CLOSE', onMobilePanelClose);
|
|
5433
|
+
}
|
|
5434
|
+
};
|
|
5435
|
+
}, [targetRef, onBurgerClose, onBurgerOpen]);
|
|
5436
|
+
return (React__default.createElement("div", { className: b$1({ compact }, className), ref: targetRef },
|
|
5437
|
+
React__default.createElement("header", { className: b$1('header'), style: { height: size } },
|
|
5438
|
+
React__default.createElement(Burger, { opened: visiblePanel === burgerPanelItem.id, onClick: () => onPanelToggle(BURGER_PANEL_ITEM_ID), className: b$1('burger') }),
|
|
5439
|
+
React__default.createElement(Logo, Object.assign({}, logo, { compact: compact, onClick: onLogoClick })),
|
|
5440
|
+
React__default.createElement("div", { className: b$1('side-item') }, sideItemRenderContent === null || sideItemRenderContent === void 0 ? void 0 : sideItemRenderContent({ size }))),
|
|
5441
|
+
React__default.createElement(Drawer, { className: b$1('panels'), onVeilClick: onCloseDrawer, onEscape: onCloseDrawer, style: { top: size } }, [burgerPanelItem, ...panelItems].map((item) => (React__default.createElement(DrawerItem, Object.assign({}, item, { key: item.id, visible: visiblePanel === item.id, className: b$1('panel-item', item.className) }))))),
|
|
5442
|
+
React__default.createElement(Content, { size: size, renderContent: renderContent, className: b$1('content'), cssSizeVariableName: "--mobile-header-size" })));
|
|
5443
|
+
});
|
|
5444
|
+
MobileHeader.displayName = 'MobileHeader';
|
|
5445
|
+
|
|
5446
|
+
var css_248z = ".ycn-mobile-header-footer-item {\n flex-grow: 1;\n position: relative;\n}\n.ycn-mobile-header-footer-item__button {\n margin: 0;\n padding: 0;\n font-family: var(--yc-text-body-font-family);\n font-size: inherit;\n font-weight: 400;\n color: inherit;\n background: none;\n border: none;\n outline: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 13px 10px;\n width: 100%;\n box-sizing: border-box;\n}\n.ycn-mobile-header-footer-item .ycn-mobile-header-footer-item__icon {\n color: var(--yc-color-text-misc);\n}\n.ycn-mobile-header-footer-item + .ycn-mobile-header-footer-item::before {\n content: \"\";\n border-left: 1px solid var(--yc-color-base-generic);\n position: absolute;\n top: 8px;\n bottom: 8px;\n left: 0;\n}\n.ycn-mobile-header-footer-item:empty {\n display: none;\n}";
|
|
5447
|
+
styleInject(css_248z);
|
|
5448
|
+
|
|
5449
|
+
const b = block('mobile-header-footer-item');
|
|
5450
|
+
const FooterItem = ({ icon, iconSize = MOBILE_HEADER_ICON_SIZE, className, modalItem = { visible: false }, onClick, }) => {
|
|
5451
|
+
var _a;
|
|
5452
|
+
const handleClick = React__default.useCallback((event) => {
|
|
5453
|
+
eventBroker.publish({
|
|
5454
|
+
componentId: 'MobileHeaderFooterItem',
|
|
5455
|
+
eventId: 'click',
|
|
5456
|
+
domEvent: event,
|
|
5457
|
+
});
|
|
5458
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
5459
|
+
}, [onClick]);
|
|
5460
|
+
return (React__default.createElement("div", { className: b() },
|
|
5461
|
+
React__default.createElement("button", { className: b('button', className), onClick: handleClick }, icon ? React__default.createElement(Icon, { data: icon, size: iconSize, className: b('icon') }) : null),
|
|
5462
|
+
React__default.createElement(Sheet, { id: modalItem.id, title: modalItem.title, visible: modalItem.visible, className: b('modal', modalItem.className), contentClassName: b('modal-content', modalItem.contentClassName), allowHideOnContentScroll: modalItem.modalAllowHideOnContentScroll, onClose: modalItem.onClose }, (_a = modalItem.renderContent) === null || _a === void 0 ? void 0 : _a.call(modalItem))));
|
|
5463
|
+
};
|
|
5464
|
+
|
|
5465
|
+
export { PublicActionBar as ActionBar, AsideHeader, Dict, Drawer, DrawerItem, FooterItem$1 as FooterItem, HotkeysPanel, MobileHeader, MobileHeaderDict, FooterItem as MobileHeaderFooterItem, Settings, Title };
|
|
5186
5466
|
//# sourceMappingURL=index.js.map
|