@gravity-ui/navigation 0.0.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/build/cjs/components/ActionBar/ActionBar.d.ts +28 -0
  3. package/build/cjs/components/ActionBar/Group/ActionBarGroup.d.ts +10 -0
  4. package/build/cjs/components/ActionBar/Item/ActionBarItem.d.ts +11 -0
  5. package/build/cjs/components/ActionBar/Section/ActionBarSection.d.ts +9 -0
  6. package/build/cjs/components/ActionBar/Separator/ActionBarSeparator.d.ts +5 -0
  7. package/build/cjs/components/ActionBar/__stories__/ActionBar.stories.d.ts +44 -0
  8. package/build/cjs/components/ActionBar/__stories__/ActionBarShowcase.d.ts +2 -0
  9. package/build/cjs/components/ActionBar/index.d.ts +5 -0
  10. package/build/cjs/components/ActionBar/types.d.ts +3 -0
  11. package/build/cjs/{types/components → components}/AsideHeader/AsideHeader.d.ts +2 -7
  12. package/build/cjs/{types/components → components}/AsideHeader/Content.d.ts +0 -0
  13. package/build/cjs/{types/components → components}/AsideHeader/__stories__/AsideHeader.stories.d.ts +0 -0
  14. package/build/cjs/{types/components → components}/AsideHeader/__stories__/AsideHeaderShowcase.d.ts +0 -0
  15. package/build/cjs/components/AsideHeader/__stories__/getAsideHeaderWrapper.d.ts +3 -0
  16. package/build/cjs/{types/components → components}/AsideHeader/__stories__/moc.d.ts +0 -0
  17. package/build/cjs/{types/components → components}/CompositeBar/CompositeBar.d.ts +3 -2
  18. package/build/{esm/types → cjs}/components/CompositeBar/Item/Item.d.ts +1 -0
  19. package/build/cjs/{types/components → components}/CompositeBar/__stories__/CompositeBar.stories.d.ts +0 -0
  20. package/build/cjs/{types/components → components}/CompositeBar/__stories__/moc.d.ts +0 -0
  21. package/build/cjs/{types/components → components}/CompositeBar/constants.d.ts +0 -0
  22. package/build/cjs/components/CompositeBar/utils.d.ts +6 -0
  23. package/build/cjs/{types/components → components}/Drawer/Drawer.d.ts +0 -0
  24. package/build/cjs/{types/components → components}/Drawer/__stories__/Drawer.stories.d.ts +0 -0
  25. package/build/cjs/{types/components → components}/Drawer/__stories__/DrawerShowcase.d.ts +0 -0
  26. package/build/cjs/{types/components → components}/FooterItem/FooterItem.d.ts +1 -1
  27. package/build/cjs/{types/components → components}/FooterItem/__stories__/FooterItem.stories.d.ts +0 -0
  28. package/build/cjs/{types/components → components}/ItemTooltip/ItemTooltip.d.ts +0 -0
  29. package/build/cjs/{types/components → components}/Logo/Logo.d.ts +0 -0
  30. package/build/cjs/components/Settings/Settings.d.ts +49 -0
  31. package/build/cjs/components/Settings/SettingsMenu/SettingsMenu.d.ts +27 -0
  32. package/build/cjs/components/Settings/SettingsSearch/SettingsSearch.d.ts +10 -0
  33. package/build/{esm/types/components/AsideHeader/__stories__/AsideHeader.stories.d.ts → cjs/components/Settings/__stories__/Settings.stories.d.ts} +0 -0
  34. package/build/cjs/components/Settings/__stories__/SettingsDemo.d.ts +13 -0
  35. package/build/cjs/components/Settings/collect-settings.d.ts +40 -0
  36. package/build/cjs/components/Settings/helpers.d.ts +6 -0
  37. package/build/cjs/components/Settings/index.d.ts +1 -0
  38. package/build/cjs/{types/components → components}/constants.d.ts +0 -0
  39. package/build/cjs/{types/components → components}/index.d.ts +2 -0
  40. package/build/cjs/{types/components → components}/types.d.ts +1 -1
  41. package/build/cjs/{types/components → components}/utils/cn.d.ts +0 -0
  42. package/build/cjs/{types/index.d.ts → index.d.ts} +0 -0
  43. package/build/cjs/index.js +1187 -191
  44. package/build/cjs/index.js.map +1 -1
  45. package/build/esm/components/ActionBar/ActionBar.d.ts +28 -0
  46. package/build/esm/components/ActionBar/Group/ActionBarGroup.d.ts +10 -0
  47. package/build/esm/components/ActionBar/Item/ActionBarItem.d.ts +11 -0
  48. package/build/esm/components/ActionBar/Section/ActionBarSection.d.ts +9 -0
  49. package/build/esm/components/ActionBar/Separator/ActionBarSeparator.d.ts +5 -0
  50. package/build/esm/components/ActionBar/__stories__/ActionBar.stories.d.ts +44 -0
  51. package/build/esm/components/ActionBar/__stories__/ActionBarShowcase.d.ts +2 -0
  52. package/build/esm/components/ActionBar/index.d.ts +5 -0
  53. package/build/esm/components/ActionBar/types.d.ts +3 -0
  54. package/build/esm/{types/components → components}/AsideHeader/AsideHeader.d.ts +2 -7
  55. package/build/esm/{types/components → components}/AsideHeader/Content.d.ts +0 -0
  56. package/build/esm/{types/components/Drawer/__stories__/Drawer.stories.d.ts → components/AsideHeader/__stories__/AsideHeader.stories.d.ts} +0 -0
  57. package/build/esm/{types/components → components}/AsideHeader/__stories__/AsideHeaderShowcase.d.ts +0 -0
  58. package/build/esm/components/AsideHeader/__stories__/getAsideHeaderWrapper.d.ts +3 -0
  59. package/build/esm/{types/components → components}/AsideHeader/__stories__/moc.d.ts +0 -0
  60. package/build/esm/{types/components → components}/CompositeBar/CompositeBar.d.ts +3 -2
  61. package/build/{cjs/types → esm}/components/CompositeBar/Item/Item.d.ts +1 -0
  62. package/build/esm/{types/components → components}/CompositeBar/__stories__/CompositeBar.stories.d.ts +0 -0
  63. package/build/esm/{types/components → components}/CompositeBar/__stories__/moc.d.ts +0 -0
  64. package/build/esm/{types/components → components}/CompositeBar/constants.d.ts +0 -0
  65. package/build/esm/components/CompositeBar/utils.d.ts +6 -0
  66. package/build/esm/{types/components → components}/Drawer/Drawer.d.ts +0 -0
  67. package/build/esm/components/Drawer/__stories__/Drawer.stories.d.ts +4 -0
  68. package/build/esm/{types/components → components}/Drawer/__stories__/DrawerShowcase.d.ts +0 -0
  69. package/build/esm/{types/components → components}/FooterItem/FooterItem.d.ts +1 -1
  70. package/build/esm/{types/components → components}/FooterItem/__stories__/FooterItem.stories.d.ts +0 -0
  71. package/build/esm/{types/components → components}/ItemTooltip/ItemTooltip.d.ts +0 -0
  72. package/build/esm/{types/components → components}/Logo/Logo.d.ts +0 -0
  73. package/build/esm/components/Settings/Settings.d.ts +49 -0
  74. package/build/esm/components/Settings/SettingsMenu/SettingsMenu.d.ts +27 -0
  75. package/build/esm/components/Settings/SettingsSearch/SettingsSearch.d.ts +10 -0
  76. package/build/esm/components/Settings/__stories__/Settings.stories.d.ts +4 -0
  77. package/build/esm/components/Settings/__stories__/SettingsDemo.d.ts +13 -0
  78. package/build/esm/components/Settings/collect-settings.d.ts +40 -0
  79. package/build/esm/components/Settings/helpers.d.ts +6 -0
  80. package/build/esm/components/Settings/index.d.ts +1 -0
  81. package/build/esm/{types/components → components}/constants.d.ts +0 -0
  82. package/build/esm/{types/components → components}/index.d.ts +2 -0
  83. package/build/esm/{types/components → components}/types.d.ts +1 -1
  84. package/build/esm/{types/components → components}/utils/cn.d.ts +0 -0
  85. package/build/esm/{types/index.d.ts → index.d.ts} +0 -0
  86. package/build/esm/index.js +1187 -193
  87. package/build/esm/index.js.map +1 -1
  88. package/package.json +1 -1
  89. package/build/cjs/types/components/CompositeBar/utils.d.ts +0 -4
  90. package/build/esm/types/components/CompositeBar/utils.d.ts +0 -4
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { Children, isValidElement, cloneElement, createElement, PureComponent } from 'react';
3
- import { Button, Icon, Popup, List } from '@gravity-ui/uikit';
3
+ import { Button, Icon, Popup, List, TextInput, Loader } from '@gravity-ui/uikit';
4
4
  import ReactDOM from 'react-dom';
5
5
 
6
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -60,6 +60,84 @@ function block(name) {
60
60
  return _default(`${NAMESPACE}${name}`);
61
61
  }
62
62
 
63
+ function styleInject(css, ref) {
64
+ if ( ref === void 0 ) ref = {};
65
+ var insertAt = ref.insertAt;
66
+
67
+ if (!css || typeof document === 'undefined') { return; }
68
+
69
+ var head = document.head || document.getElementsByTagName('head')[0];
70
+ var style = document.createElement('style');
71
+ style.type = 'text/css';
72
+
73
+ if (insertAt === 'top') {
74
+ if (head.firstChild) {
75
+ head.insertBefore(style, head.firstChild);
76
+ } else {
77
+ head.appendChild(style);
78
+ }
79
+ } else {
80
+ head.appendChild(style);
81
+ }
82
+
83
+ if (style.styleSheet) {
84
+ style.styleSheet.cssText = css;
85
+ } else {
86
+ style.appendChild(document.createTextNode(css));
87
+ }
88
+ }
89
+
90
+ var css_248z$d = ".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}";
91
+ styleInject(css_248z$d);
92
+
93
+ const b$e = block('action-bar-group');
94
+ const ActionBarGroup = ({ children, className, pull }) => {
95
+ return (React__default.createElement("ul", { className: b$e({ pull }, className), role: "group" }, children));
96
+ };
97
+ ActionBarGroup.displayName = 'ActionBar.Group';
98
+
99
+ var css_248z$c = ".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}";
100
+ styleInject(css_248z$c);
101
+
102
+ const b$d = block('action-bar-item');
103
+ const ActionBarItem = ({ children, className, pull, spacing = true }) => {
104
+ return React__default.createElement("li", { className: b$d({ pull, spacing }, className) }, children);
105
+ };
106
+ ActionBarItem.displayName = 'ActionBar.Item';
107
+
108
+ var css_248z$b = ".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}";
109
+ styleInject(css_248z$b);
110
+
111
+ const b$c = block('action-bar-section');
112
+ const ActionBarSection = ({ children, type = 'primary' }) => {
113
+ return React__default.createElement("div", { className: b$c({ type }) }, children);
114
+ };
115
+ ActionBarSection.displayName = 'ActionBar.Section';
116
+
117
+ var css_248z$a = ".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}";
118
+ styleInject(css_248z$a);
119
+
120
+ const b$b = block('action-bar-separator');
121
+ const ActionBarSeparator = () => {
122
+ return React__default.createElement("li", { role: "separator", className: b$b() });
123
+ };
124
+ ActionBarSeparator.displayName = 'ActionBar.Separator';
125
+
126
+ var css_248z$9 = ".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}";
127
+ styleInject(css_248z$9);
128
+
129
+ const b$a = block('action-bar');
130
+ const ActionBar = ({ children, className, 'aria-label': ariaLabel }) => {
131
+ return (React__default.createElement("section", { className: b$a(null, className), "aria-label": ariaLabel }, children));
132
+ };
133
+ ActionBar.displayName = 'ActionBar';
134
+ const PublicActionBar = Object.assign(ActionBar, {
135
+ Section: ActionBarSection,
136
+ Group: ActionBarGroup,
137
+ Item: ActionBarItem,
138
+ Separator: ActionBarSeparator,
139
+ });
140
+
63
141
  var Dict;
64
142
  (function (Dict) {
65
143
  Dict["ExpandButton"] = "button_expand";
@@ -70,7 +148,7 @@ var Dict;
70
148
  const ASIDE_HEADER_FOOTER_ICON_SIZE = 20;
71
149
  const ASIDE_HEADER_COMPACT_WIDTH = 56;
72
150
  const ASIDE_HEADER_EXPANDED_WIDTH = 236;
73
- const defaultDict = {
151
+ const defaultDict$1 = {
74
152
  [Dict.CollapseButton]: 'Collapse',
75
153
  [Dict.ExpandButton]: 'Expand',
76
154
  [Dict.MoreButton]: 'More',
@@ -80,14 +158,12 @@ function _extends$4() {
80
158
  _extends$4 = Object.assign ? Object.assign.bind() : function (target) {
81
159
  for (var i = 1; i < arguments.length; i++) {
82
160
  var source = arguments[i];
83
-
84
161
  for (var key in source) {
85
162
  if (Object.prototype.hasOwnProperty.call(source, key)) {
86
163
  target[key] = source[key];
87
164
  }
88
165
  }
89
166
  }
90
-
91
167
  return target;
92
168
  };
93
169
  return _extends$4.apply(this, arguments);
@@ -98,13 +174,11 @@ function _objectWithoutPropertiesLoose(source, excluded) {
98
174
  var target = {};
99
175
  var sourceKeys = Object.keys(source);
100
176
  var key, i;
101
-
102
177
  for (i = 0; i < sourceKeys.length; i++) {
103
178
  key = sourceKeys[i];
104
179
  if (excluded.indexOf(key) >= 0) continue;
105
180
  target[key] = source[key];
106
181
  }
107
-
108
182
  return target;
109
183
  }
110
184
 
@@ -1371,6 +1445,10 @@ var classNamesShape = process.env.NODE_ENV !== 'production' ? propTypes.exports.
1371
1445
 
1372
1446
  var TransitionGroupContext = React__default.createContext(null);
1373
1447
 
1448
+ var forceReflow = function forceReflow(node) {
1449
+ return node.scrollTop;
1450
+ };
1451
+
1374
1452
  var UNMOUNTED = 'unmounted';
1375
1453
  var EXITED = 'exited';
1376
1454
  var ENTERING = 'entering';
@@ -1590,6 +1668,14 @@ var Transition = /*#__PURE__*/function (_React$Component) {
1590
1668
  this.cancelNextCallback();
1591
1669
 
1592
1670
  if (nextStatus === ENTERING) {
1671
+ if (this.props.unmountOnExit || this.props.mountOnEnter) {
1672
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
1673
+ // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
1674
+ // To make the animation happen, we have to separate each rendering and avoid being processed as batched.
1675
+
1676
+ if (node) forceReflow(node);
1677
+ }
1678
+
1593
1679
  this.performEnter(mounting);
1594
1680
  } else {
1595
1681
  this.performExit();
@@ -1782,7 +1868,10 @@ Transition.propTypes = process.env.NODE_ENV !== "production" ? {
1782
1868
  * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
1783
1869
  */
1784
1870
  nodeRef: propTypes.exports.shape({
1785
- current: typeof Element === 'undefined' ? propTypes.exports.any : propTypes.exports.instanceOf(Element)
1871
+ current: typeof Element === 'undefined' ? propTypes.exports.any : function (propValue, key, componentName, location, propFullName, secret) {
1872
+ var value = propValue[key];
1873
+ return propTypes.exports.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
1874
+ }
1786
1875
  }),
1787
1876
 
1788
1877
  /**
@@ -2190,13 +2279,12 @@ var CSSTransition = /*#__PURE__*/function (_React$Component) {
2190
2279
 
2191
2280
  if (type === 'appear' && phase === 'done' && doneClassName) {
2192
2281
  className += " " + doneClassName;
2193
- } // This is for to force a repaint,
2282
+ } // This is to force a repaint,
2194
2283
  // which is necessary in order to transition styles when adding a class name.
2195
2284
 
2196
2285
 
2197
2286
  if (phase === 'active') {
2198
- /* eslint-disable no-unused-expressions */
2199
- node && node.scrollTop;
2287
+ if (node) forceReflow(node);
2200
2288
  }
2201
2289
 
2202
2290
  if (className) {
@@ -2382,7 +2470,6 @@ function _assertThisInitialized(self) {
2382
2470
  if (self === void 0) {
2383
2471
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2384
2472
  }
2385
-
2386
2473
  return self;
2387
2474
  }
2388
2475
 
@@ -3086,42 +3173,15 @@ SwitchTransition.defaultProps = {
3086
3173
  mode: modes.out
3087
3174
  };
3088
3175
 
3089
- function styleInject(css, ref) {
3090
- if ( ref === void 0 ) ref = {};
3091
- var insertAt = ref.insertAt;
3092
-
3093
- if (!css || typeof document === 'undefined') { return; }
3094
-
3095
- var head = document.head || document.getElementsByTagName('head')[0];
3096
- var style = document.createElement('style');
3097
- style.type = 'text/css';
3098
-
3099
- if (insertAt === 'top') {
3100
- if (head.firstChild) {
3101
- head.insertBefore(style, head.firstChild);
3102
- } else {
3103
- head.appendChild(style);
3104
- }
3105
- } else {
3106
- head.appendChild(style);
3107
- }
3108
-
3109
- if (style.styleSheet) {
3110
- style.styleSheet.cssText = css;
3111
- } else {
3112
- style.appendChild(document.createTextNode(css));
3113
- }
3114
- }
3115
-
3116
- var css_248z$6 = ".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-transition-enter {\n transform: translate(-100%, 0);\n}\n.ycn-drawer__item-transition-enter-active {\n transform: translate(0, 0);\n transition: transform 300ms;\n}\n.ycn-drawer__item-transition-enter-done {\n filter: blur(0px);\n transform: translateZ(0);\n}\n.ycn-drawer__item-transition-exit {\n transform: translate(0, 0);\n}\n.ycn-drawer__item-transition-exit-active {\n transform: translate(-100%, 0);\n transition: transform 300ms;\n}\n.ycn-drawer__item-transition-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}";
3117
- styleInject(css_248z$6);
3176
+ var css_248z$8 = ".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-transition-enter {\n transform: translate(-100%, 0);\n}\n.ycn-drawer__item-transition-enter-active {\n transform: translate(0, 0);\n transition: transform 300ms;\n}\n.ycn-drawer__item-transition-enter-done {\n filter: blur(0px);\n transform: translateZ(0);\n}\n.ycn-drawer__item-transition-exit {\n transform: translate(0, 0);\n}\n.ycn-drawer__item-transition-exit-active {\n transform: translate(-100%, 0);\n transition: transform 300ms;\n}\n.ycn-drawer__item-transition-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}";
3177
+ styleInject(css_248z$8);
3118
3178
 
3119
- const b$6 = block('drawer');
3179
+ const b$9 = block('drawer');
3120
3180
  const TIMEOUT = 300;
3121
3181
  const DrawerItem = ({ visible, content, className }) => {
3122
3182
  const itemRef = React__default.useRef(null);
3123
- return (React__default.createElement(CSSTransition, { in: visible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$6('item-transition'), nodeRef: itemRef },
3124
- React__default.createElement("div", { ref: itemRef, className: b$6('item', className) }, content)));
3183
+ return (React__default.createElement(CSSTransition, { in: visible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$9('item-transition'), nodeRef: itemRef },
3184
+ React__default.createElement("div", { ref: itemRef, className: b$9('item', className) }, content)));
3125
3185
  };
3126
3186
  const Drawer = ({ className, children, style, onVeilClick, onEscape, preventScrollBody = true, }) => {
3127
3187
  let someItemVisible = false;
@@ -3179,9 +3239,9 @@ const Drawer = ({ className, children, style, onVeilClick, onEscape, preventScro
3179
3239
  const veilRef = React__default.useRef(null);
3180
3240
  return (React__default.createElement(Transition, { in: someItemVisible, timeout: { enter: 0, exit: TIMEOUT }, mountOnEnter: true, unmountOnExit: true, nodeRef: containerRef }, (state) => {
3181
3241
  const childrenVisible = someItemVisible && state === 'entered';
3182
- return (React__default.createElement("div", { ref: containerRef, className: b$6(null, className), style: style },
3183
- React__default.createElement(CSSTransition, { in: childrenVisible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$6('veil-transition'), nodeRef: veilRef },
3184
- React__default.createElement("div", { ref: veilRef, className: b$6('veil'), onClick: onVeilClick })),
3242
+ return (React__default.createElement("div", { ref: containerRef, className: b$9(null, className), style: style },
3243
+ React__default.createElement(CSSTransition, { in: childrenVisible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$9('veil-transition'), nodeRef: veilRef },
3244
+ React__default.createElement("div", { ref: veilRef, className: b$9('veil'), onClick: onVeilClick })),
3185
3245
  React__default.Children.map(children, (child) => {
3186
3246
  const childElem = child;
3187
3247
  if (childElem.type === DrawerItem) {
@@ -3193,10 +3253,10 @@ const Drawer = ({ className, children, style, onVeilClick, onEscape, preventScro
3193
3253
  }));
3194
3254
  };
3195
3255
 
3196
- var css_248z$5 = ".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}\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}\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}";
3197
- styleInject(css_248z$5);
3256
+ var css_248z$7 = ".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}\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}\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}";
3257
+ styleInject(css_248z$7);
3198
3258
 
3199
- const b$5 = block('logo');
3259
+ const b$8 = block('logo');
3200
3260
  const Logo = ({ text, compact, icon, iconSrc, iconClassName, iconSize = 24, textSize = 15, href = '/', wrapper, onClick, }) => {
3201
3261
  const hasClickHandler = typeof onClick === 'function';
3202
3262
  const hasWrapper = typeof wrapper === 'function';
@@ -3214,18 +3274,18 @@ const Logo = ({ text, compact, icon, iconSrc, iconClassName, iconSize = 24, text
3214
3274
  else if (icon) {
3215
3275
  buttonIcon = React__default.createElement(Icon, { data: icon, size: iconSize, className: iconClassName });
3216
3276
  }
3217
- const button = (React__default.createElement(Button, Object.assign({ view: "flat", size: "l", className: b$5('btn-logo'), component: hasWrapper ? 'span' : undefined, onClick: onClick }, linkProps), buttonIcon));
3277
+ const button = (React__default.createElement(Button, Object.assign({ view: "flat", size: "l", className: b$8('btn-logo'), component: hasWrapper ? 'span' : undefined, onClick: onClick }, linkProps), buttonIcon));
3218
3278
  let logo;
3219
3279
  if (typeof text === 'function') {
3220
3280
  logo = text();
3221
3281
  }
3222
3282
  else {
3223
- logo = (React__default.createElement("div", { className: b$5('logo'), style: { fontSize: textSize } }, text));
3283
+ logo = (React__default.createElement("div", { className: b$8('logo'), style: { fontSize: textSize } }, text));
3224
3284
  }
3225
- return (React__default.createElement("div", { className: b$5() },
3226
- React__default.createElement("div", { className: b$5('logo-btn-place') }, hasWrapper ? wrapper(button, compact) : button),
3285
+ return (React__default.createElement("div", { className: b$8() },
3286
+ React__default.createElement("div", { className: b$8('logo-btn-place') }, hasWrapper ? wrapper(button, compact) : button),
3227
3287
  !compact &&
3228
- (hasWrapper ? (wrapper(logo, compact)) : (React__default.createElement("a", Object.assign({}, linkProps, { className: b$5('logo-link'), onClick: onClick }), logo)))));
3288
+ (hasWrapper ? (wrapper(logo, compact)) : (React__default.createElement("a", Object.assign({}, linkProps, { className: b$8('logo-link'), onClick: onClick }), logo)))));
3229
3289
  };
3230
3290
 
3231
3291
  var classCallCheck = function (instance, Constructor) {
@@ -3722,6 +3782,8 @@ function getItemHeight(item) {
3722
3782
  switch (item.type) {
3723
3783
  case 'action':
3724
3784
  return 50;
3785
+ case 'divider':
3786
+ return 15;
3725
3787
  default:
3726
3788
  return ITEM_HEIGHT;
3727
3789
  }
@@ -3729,15 +3791,36 @@ function getItemHeight(item) {
3729
3791
  function getItemsHeight(items) {
3730
3792
  return items.reduce((sum, item) => sum + getItemHeight(item), 0);
3731
3793
  }
3732
- const getSelectedItemIndex = (items) => {
3794
+ function getSelectedItemIndex(items) {
3733
3795
  const index = items.findIndex(({ current }) => Boolean(current));
3734
3796
  return index === -1 ? undefined : index;
3735
- };
3797
+ }
3798
+ function getPinnedItems(items) {
3799
+ const pinnedItems = [];
3800
+ for (const item of items) {
3801
+ if (item.pinned) {
3802
+ pinnedItems.push(item);
3803
+ }
3804
+ else if (item.type === 'divider') {
3805
+ if (pinnedItems.length > 0 && pinnedItems[pinnedItems.length - 1].type !== 'divider') {
3806
+ pinnedItems.push(item);
3807
+ }
3808
+ }
3809
+ }
3810
+ return pinnedItems;
3811
+ }
3812
+ function getItemsMinHeight(items) {
3813
+ const pinnedItems = getPinnedItems(items);
3814
+ const afterMoreButtonItems = items.filter((item) => item.afterMoreButton);
3815
+ return (getItemsHeight(pinnedItems) +
3816
+ getItemsHeight(afterMoreButtonItems) +
3817
+ (pinnedItems.length === items.length ? 0 : ITEM_HEIGHT));
3818
+ }
3736
3819
 
3737
- var css_248z$4 = ".ycn-item-tooltip.yc-popup {\n animation-name: none;\n box-shadow: none;\n border: none;\n}\n.ycn-item-tooltip__text {\n padding: 6px 12px;\n background-color: var(--yc-color-base-float-heavy);\n color: var(--yc-color-text-light-primary);\n border-radius: 4px;\n}";
3738
- styleInject(css_248z$4);
3820
+ var css_248z$6 = ".ycn-item-tooltip.yc-popup {\n animation-name: none;\n box-shadow: none;\n border: none;\n}\n.ycn-item-tooltip__text {\n padding: 6px 12px;\n background-color: var(--yc-color-base-float-heavy);\n color: var(--yc-color-text-light-primary);\n border-radius: 4px;\n}";
3821
+ styleInject(css_248z$6);
3739
3822
 
3740
- const b$4 = block('item-tooltip');
3823
+ const b$7 = block('item-tooltip');
3741
3824
  const popupPlacement = ['right'];
3742
3825
  const ItemTooltip = ({ anchor, text }) => {
3743
3826
  const anchorRef = React__default.useRef(anchor);
@@ -3747,26 +3830,29 @@ const ItemTooltip = ({ anchor, text }) => {
3747
3830
  if (!anchor) {
3748
3831
  return null;
3749
3832
  }
3750
- return (React__default.createElement(Popup, { className: b$4(), open: true, anchorRef: anchorRef, placement: popupPlacement, disableEscapeKeyDown: true, disableOutsideClick: true, disableLayer: true },
3751
- React__default.createElement("div", { className: b$4('text') }, text)));
3833
+ return (React__default.createElement(Popup, { className: b$7(), open: true, anchorRef: anchorRef, placement: popupPlacement, disableEscapeKeyDown: true, disableOutsideClick: true, disableLayer: true },
3834
+ React__default.createElement("div", { className: b$7('text') }, text)));
3752
3835
  };
3753
3836
 
3754
- var css_248z$3 = ".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__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: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}";
3755
- styleInject(css_248z$3);
3837
+ var css_248z$5 = ".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: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}";
3838
+ styleInject(css_248z$5);
3756
3839
 
3757
- const b$3 = block('composite-bar-item');
3840
+ const b$6 = block('composite-bar-item');
3758
3841
  function renderItemTitle(item) {
3759
- let titleNode = React__default.createElement("div", { className: b$3('title-text') }, item.title);
3842
+ let titleNode = React__default.createElement("div", { className: b$6('title-text') }, item.title);
3760
3843
  if (item.rightAdornment) {
3761
3844
  titleNode = (React__default.createElement(React__default.Fragment, null,
3762
3845
  titleNode,
3763
- React__default.createElement("div", { className: b$3('title-adornment') }, item.rightAdornment)));
3846
+ React__default.createElement("div", { className: b$6('title-adornment') }, item.rightAdornment)));
3764
3847
  }
3765
3848
  return titleNode;
3766
3849
  }
3767
3850
  const defaultPopupPlacement = ['right-end'];
3768
3851
  const defaultPopupOffset = [-20, 8];
3769
- const Item = ({ item, compact, className, collapseItems, onMouseLeave, onMouseEnter, enableTooltip = true, popupVisible = false, popupAnchor, popupPlacement = defaultPopupPlacement, popupOffset = defaultPopupOffset, renderPopupContent, onClosePopup, }) => {
3852
+ const Item = ({ item, compact, className, collapseItems, onMouseLeave, onMouseEnter, enableTooltip = true, popupVisible = false, popupAnchor, popupPlacement = defaultPopupPlacement, popupOffset = defaultPopupOffset, renderPopupContent, onClosePopup, onItemClick, }) => {
3853
+ if (item.type === 'divider') {
3854
+ return React__default.createElement("div", { className: b$6('menu-divider') });
3855
+ }
3770
3856
  const [tooltipAnchor, setTooltipAnchor] = React__default.useState(null);
3771
3857
  const [open, toggleOpen] = React__default.useState(false);
3772
3858
  const ref = React__default.useRef(null);
@@ -3786,14 +3872,19 @@ const Item = ({ item, compact, className, collapseItems, onMouseLeave, onMouseEn
3786
3872
  }
3787
3873
  onClosePopup === null || onClosePopup === void 0 ? void 0 : onClosePopup();
3788
3874
  }, [onClosePopup]);
3789
- const node = (React__default.createElement("div", { className: b$3({ type, current, compact }, className), ref: ref, onClick: () => {
3790
- if (typeof item.onItemClick === 'function') {
3791
- item.onItemClick(item, false);
3792
- }
3875
+ const node = (React__default.createElement("div", { className: b$6({ type, current, compact }, className), ref: ref, onClick: () => {
3793
3876
  if (collapsedItem) {
3877
+ /**
3878
+ * If we call onItemClick for collapsedItem then:
3879
+ * - User get unexpected item in onItemClick callback
3880
+ * - onClosePanel calls twice for each popuped item, as result it will prevent opening of panelItems
3881
+ */
3794
3882
  toggleOpen(!open);
3795
3883
  setTooltipAnchor(null);
3796
3884
  }
3885
+ else {
3886
+ onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, false);
3887
+ }
3797
3888
  }, onMouseEnter: () => {
3798
3889
  if (!compact) {
3799
3890
  onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter();
@@ -3803,7 +3894,7 @@ const Item = ({ item, compact, className, collapseItems, onMouseLeave, onMouseEn
3803
3894
  onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
3804
3895
  }
3805
3896
  } },
3806
- React__default.createElement("div", { className: b$3('icon-place') }, compact ? (React__default.createElement(React__default.Fragment, null,
3897
+ React__default.createElement("div", { className: b$6('icon-place') }, compact ? (React__default.createElement(React__default.Fragment, null,
3807
3898
  React__default.createElement("div", { onMouseEnter: (event) => {
3808
3899
  if (!open) {
3809
3900
  setTooltipAnchor(event.currentTarget);
@@ -3812,51 +3903,47 @@ const Item = ({ item, compact, className, collapseItems, onMouseLeave, onMouseEn
3812
3903
  }, onMouseLeave: () => {
3813
3904
  setTooltipAnchor(null);
3814
3905
  onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
3815
- }, className: b$3('btn-icon') }, icon && React__default.createElement(Icon, { data: icon, size: iconSize, className: b$3('icon') })),
3816
- enableTooltip && React__default.createElement(ItemTooltip, { anchor: tooltipAnchor, text: tooltipText }))) : (icon && React__default.createElement(Icon, { data: icon, size: iconSize, className: b$3('icon') }))),
3817
- React__default.createElement("div", { className: b$3('title'), title: typeof item.title === 'string' ? item.title : undefined }, renderItemTitle(item)),
3906
+ }, className: b$6('btn-icon') }, icon && React__default.createElement(Icon, { data: icon, size: iconSize, className: b$6('icon') })),
3907
+ enableTooltip && React__default.createElement(ItemTooltip, { anchor: tooltipAnchor, text: tooltipText }))) : (icon && React__default.createElement(Icon, { data: icon, size: iconSize, className: b$6('icon') }))),
3908
+ React__default.createElement("div", { className: b$6('title'), title: typeof item.title === 'string' ? item.title : undefined }, renderItemTitle(item)),
3818
3909
  collapsedItem && (collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(Popup, { placement: POPUP_PLACEMENT, open: open, anchorRef: ref, onClose: () => toggleOpen(false) },
3819
- React__default.createElement("div", { className: b$3('collapse-items-popup-content') },
3820
- React__default.createElement(List, { itemClassName: b$3('root-collapse-item'), items: collapseItems, selectedItemIndex: getSelectedItemIndex(collapseItems), itemHeight: POPUP_ITEM_HEIGHT, itemsHeight: collapseItems.length * POPUP_ITEM_HEIGHT, virtualized: false, filterable: false, sortable: false, renderItem: (collapseItem) => {
3821
- const collapseNode = (React__default.createElement("div", { className: b$3('collapse-item'), onClick: () => {
3822
- if (typeof collapseItem.onItemClick === 'function') {
3823
- collapseItem.onItemClick(collapseItem, true);
3824
- }
3910
+ React__default.createElement("div", { className: b$6('collapse-items-popup-content') },
3911
+ React__default.createElement(List, { itemClassName: b$6('root-collapse-item'), items: collapseItems, selectedItemIndex: getSelectedItemIndex(collapseItems), itemHeight: POPUP_ITEM_HEIGHT, itemsHeight: collapseItems.length * POPUP_ITEM_HEIGHT, virtualized: false, filterable: false, sortable: false, renderItem: (collapseItem) => {
3912
+ const collapseNode = (React__default.createElement("div", { className: b$6('collapse-item'), onClick: () => {
3913
+ onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(collapseItem, true);
3825
3914
  } }, renderItemTitle(collapseItem)));
3826
3915
  if (typeof collapseItem.itemWrapper === 'function') {
3827
3916
  return collapseItem.itemWrapper(collapseNode, collapseItem, true, compact);
3828
3917
  }
3829
- return collapseItem.link ? (React__default.createElement("a", { href: collapseItem.link, className: b$3('link') }, collapseNode)) : (collapseNode);
3918
+ return collapseItem.link ? (React__default.createElement("a", { href: collapseItem.link, className: b$6('link') }, collapseNode)) : (collapseNode);
3830
3919
  } })))),
3831
- renderPopupContent && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(Popup, { className: b$3('popup'), open: popupVisible, placement: popupPlacement, offset: popupOffset, anchorRef: anchorRef, onClose: onClose }, renderPopupContent()))));
3920
+ renderPopupContent && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(Popup, { className: b$6('popup'), open: popupVisible, placement: popupPlacement, offset: popupOffset, anchorRef: anchorRef, onClose: onClose }, renderPopupContent()))));
3832
3921
  if (typeof item.itemWrapper === 'function') {
3833
3922
  return item.itemWrapper(node, item, false, compact);
3834
3923
  }
3835
- return item.link ? (React__default.createElement("a", { href: item.link, className: b$3('link') }, node)) : (node);
3924
+ return item.link ? (React__default.createElement("a", { href: item.link, className: b$6('link') }, node)) : (node);
3836
3925
  };
3837
3926
  Item.displayName = 'Item';
3838
3927
 
3839
3928
  var _path$2;
3840
-
3841
3929
  function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
3842
-
3843
3930
  var SvgDots = function SvgDots(props) {
3844
3931
  return /*#__PURE__*/React.createElement("svg", _extends$2({
3845
3932
  xmlns: "http://www.w3.org/2000/svg",
3846
3933
  width: 16,
3847
- height: 16,
3848
- role: "img"
3934
+ height: 16
3849
3935
  }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
3850
3936
  d: "M14 6.125a1.874 1.874 0 1 1 .001 3.749A1.874 1.874 0 0 1 14 6.125zm-5.906 0a1.874 1.874 0 1 1 0 3.749 1.874 1.874 0 0 1 0-3.749zM2 6.125a1.874 1.874 0 1 1 .001 3.749A1.874 1.874 0 0 1 2 6.125z",
3851
3937
  fill: "currentColor",
3852
3938
  fillRule: "evenodd"
3853
3939
  })));
3854
3940
  };
3941
+ var dotsIcon = SvgDots;
3855
3942
 
3856
- var css_248z$2 = ".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}";
3857
- styleInject(css_248z$2);
3943
+ var css_248z$4 = ".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}";
3944
+ styleInject(css_248z$4);
3858
3945
 
3859
- const b$2 = block('composite-bar');
3946
+ const b$5 = block('composite-bar');
3860
3947
  class CompositeBar extends React__default.Component {
3861
3948
  constructor() {
3862
3949
  super(...arguments);
@@ -3867,15 +3954,14 @@ class CompositeBar extends React__default.Component {
3867
3954
  }
3868
3955
  render() {
3869
3956
  const { enableCollapsing, items } = this.props;
3957
+ if (items.length === 0) {
3958
+ return null;
3959
+ }
3870
3960
  if (!enableCollapsing) {
3871
- return React__default.createElement("div", { className: b$2() }, this.renderMenu());
3961
+ return React__default.createElement("div", { className: b$5() }, this.renderMenu());
3872
3962
  }
3873
- const pinnedItems = items.filter((item) => item.pinned);
3874
- const afterMoreButtonItems = items.filter((item) => item.afterMoreButton);
3875
- const minHeight = getItemsHeight(pinnedItems) +
3876
- getItemsHeight(afterMoreButtonItems) +
3877
- (pinnedItems.length === items.length ? 0 : ITEM_HEIGHT);
3878
- return (React__default.createElement("div", { className: b$2({ autosizer: true }), style: { minHeight } }, items.length !== 0 && (React__default.createElement(AutoSizer, null, ({ width, height }) => {
3963
+ const minHeight = getItemsMinHeight(items);
3964
+ return (React__default.createElement("div", { className: b$5({ autosizer: true }), style: { minHeight } }, items.length !== 0 && (React__default.createElement(AutoSizer, null, ({ width, height }) => {
3879
3965
  const style = {
3880
3966
  width,
3881
3967
  height,
@@ -3884,68 +3970,75 @@ class CompositeBar extends React__default.Component {
3884
3970
  }))));
3885
3971
  }
3886
3972
  renderAutosizeMenu(height) {
3887
- const { dict, items, compact, onItemClick } = this.props;
3888
- const afterMoreButtonItems = items.filter((item) => item.afterMoreButton);
3889
- const extraItemHeight = items.reduce((sum, item) => sum + (getItemHeight(item) - ITEM_HEIGHT), afterMoreButtonItems.length * ITEM_HEIGHT);
3890
- const capacity = Math.max(1, Math.floor((height - extraItemHeight) / ITEM_HEIGHT));
3891
- let listItems;
3892
- let collapseItems = [];
3893
- const regularItems = items.filter((item) => !item.afterMoreButton);
3894
- if (capacity === 1) {
3895
- listItems = regularItems.filter((item) => item.pinned);
3896
- collapseItems = [...regularItems.filter((item) => !item.pinned)];
3897
- }
3898
- else if (capacity < items.length) {
3899
- const extraCount = regularItems.filter((item, idx) => item.pinned && idx >= capacity - 1).length;
3900
- const pinnedFlag = regularItems.reduceRight((acc, curr, idx) => {
3901
- const useExtraCount = !curr.pinned && idx < capacity - 1 && acc.extraCount > 0;
3902
- acc.flags.unshift(curr.pinned || useExtraCount);
3903
- return {
3904
- flags: acc.flags,
3905
- extraCount: acc.extraCount - Number(useExtraCount),
3906
- };
3907
- }, { flags: [], extraCount }).flags;
3908
- listItems = regularItems.filter((item, idx) => item.pinned || (idx < capacity - 1 && !pinnedFlag[idx]));
3909
- collapseItems = regularItems.filter((item, idx) => !item.pinned && (idx >= capacity - 1 || pinnedFlag[idx]));
3910
- }
3911
- else {
3912
- listItems = [...regularItems];
3913
- }
3914
- if ((collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) === 1) {
3915
- listItems = listItems.concat(collapseItems);
3916
- }
3917
- else if ((collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) > 1) {
3918
- listItems.push(this.getMoreButtonItem(dict));
3919
- }
3920
- if (afterMoreButtonItems.length) {
3921
- listItems = listItems.concat(afterMoreButtonItems);
3922
- }
3923
- return (React__default.createElement(List, { ref: this.listRef, items: listItems, selectedItemIndex: getSelectedItemIndex(listItems), itemHeight: getItemHeight, itemClassName: b$2('root-menu-item'), itemsHeight: getItemsHeight, virtualized: false, filterable: false, sortable: false, onItemClick: onItemClick, renderItem: (item) => (React__default.createElement(Item, { item: item, onMouseLeave: () => {
3973
+ const { compact, onItemClick } = this.props;
3974
+ const { listItems, collapseItems } = this.getAutosizeListItems(height);
3975
+ return (React__default.createElement(List, { ref: this.listRef, items: listItems, selectedItemIndex: getSelectedItemIndex(listItems), itemHeight: getItemHeight, itemClassName: b$5('root-menu-item'), itemsHeight: getItemsHeight, virtualized: false, filterable: false, sortable: false, renderItem: (item) => (React__default.createElement(Item, { item: item, onMouseLeave: () => {
3924
3976
  var _a;
3925
3977
  if (compact) {
3926
3978
  (_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.activateItem(undefined);
3927
3979
  }
3928
- }, compact: compact, collapseItems: collapseItems })) }));
3980
+ }, compact: compact, collapseItems: collapseItems, onItemClick: onItemClick })) }));
3929
3981
  }
3930
3982
  renderMenu() {
3931
3983
  const { items, onItemClick, compact } = this.props;
3932
- return (React__default.createElement(List, { ref: this.listRef, items: items, selectedItemIndex: getSelectedItemIndex(items), itemHeight: getItemHeight, itemClassName: b$2('root-menu-item'), itemsHeight: getItemsHeight, virtualized: false, filterable: false, sortable: false, onItemClick: onItemClick, renderItem: (item) => (React__default.createElement(Item, { item: item, onMouseLeave: () => {
3984
+ return (React__default.createElement(List, { ref: this.listRef, items: items, selectedItemIndex: getSelectedItemIndex(items), itemHeight: getItemHeight, itemClassName: b$5('root-menu-item'), itemsHeight: getItemsHeight, virtualized: false, filterable: false, sortable: false, renderItem: (item) => (React__default.createElement(Item, { item: item, onMouseLeave: () => {
3933
3985
  var _a;
3934
3986
  if (compact) {
3935
3987
  (_a = this.listRef.current) === null || _a === void 0 ? void 0 : _a.activateItem(undefined);
3936
3988
  }
3937
- }, compact: compact })) }));
3989
+ }, compact: compact, onItemClick: onItemClick })) }));
3938
3990
  }
3939
- getMoreButtonItem(dict) {
3991
+ getMoreButtonItem() {
3940
3992
  var _a;
3941
- const title = (_a = dict === null || dict === void 0 ? void 0 : dict[Dict.MoreButton]) !== null && _a !== void 0 ? _a : defaultDict[Dict.MoreButton];
3993
+ const { dict } = this.props;
3994
+ const title = (_a = dict === null || dict === void 0 ? void 0 : dict[Dict.MoreButton]) !== null && _a !== void 0 ? _a : defaultDict$1[Dict.MoreButton];
3942
3995
  return {
3943
3996
  id: COLLAPSE_ITEM_ID,
3944
3997
  title,
3945
- icon: SvgDots,
3998
+ icon: dotsIcon,
3946
3999
  iconSize: 16,
3947
4000
  };
3948
4001
  }
4002
+ getAutosizeListItems(height) {
4003
+ const { items } = this.props;
4004
+ const afterMoreButtonItems = items.filter((item) => item.afterMoreButton);
4005
+ const regularItems = items.filter((item) => !item.afterMoreButton);
4006
+ const listItems = [...regularItems, ...afterMoreButtonItems];
4007
+ const allItemsHeight = getItemsHeight(listItems);
4008
+ if (allItemsHeight <= height) {
4009
+ return { listItems, collapseItems: [] };
4010
+ }
4011
+ const collapseItem = this.getMoreButtonItem();
4012
+ const collapseItemHeight = getItemHeight(collapseItem);
4013
+ listItems.splice(regularItems.length, 0, collapseItem);
4014
+ const collapseItems = [];
4015
+ let listHeight = allItemsHeight + collapseItemHeight;
4016
+ let index = listItems.length;
4017
+ while (listHeight > height) {
4018
+ if (index === 0) {
4019
+ break;
4020
+ }
4021
+ index--;
4022
+ const item = listItems[index];
4023
+ if (item.pinned || item.id === COLLAPSE_ITEM_ID || item.afterMoreButton) {
4024
+ continue;
4025
+ }
4026
+ if (item.type === 'divider') {
4027
+ if (index + 1 < listItems.length && listItems[index + 1].type === 'divider') {
4028
+ listHeight -= getItemHeight(item);
4029
+ listItems.splice(index, 1);
4030
+ }
4031
+ continue;
4032
+ }
4033
+ listHeight -= getItemHeight(item);
4034
+ collapseItems.unshift(...listItems.splice(index, 1));
4035
+ }
4036
+ if (listItems[index].type === 'divider' &&
4037
+ (index === 0 || listItems[index - 1].type === 'divider')) {
4038
+ listItems.splice(index, 1);
4039
+ }
4040
+ return { listItems, collapseItems };
4041
+ }
3949
4042
  }
3950
4043
 
3951
4044
  /* Used by renderContent AsideHeader prop */
@@ -3958,70 +4051,64 @@ const Content = ({ size, className, renderContent }) => {
3958
4051
  };
3959
4052
 
3960
4053
  var _path$1;
3961
-
3962
4054
  function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
3963
-
3964
4055
  var SvgControlMenuButton = function SvgControlMenuButton(props) {
3965
4056
  return /*#__PURE__*/React.createElement("svg", _extends$1({
3966
4057
  width: 8,
3967
4058
  height: 8,
3968
4059
  fill: "currentColor",
3969
- xmlns: "http://www.w3.org/2000/svg",
3970
- role: "img"
4060
+ xmlns: "http://www.w3.org/2000/svg"
3971
4061
  }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
3972
4062
  d: "m.72 7.64 6.39-3.2a.5.5 0 0 0 0-.89L.72.36A.5.5 0 0 0 0 .81v6.38c0 .37.4.61.72.45Z"
3973
4063
  })));
3974
4064
  };
4065
+ var controlMenuButtonIcon = SvgControlMenuButton;
3975
4066
 
3976
4067
  var _path;
3977
-
3978
4068
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3979
-
3980
4069
  var SvgDividerCollapsed = function SvgDividerCollapsed(props) {
3981
4070
  return /*#__PURE__*/React.createElement("svg", _extends({
3982
4071
  width: 56,
3983
4072
  height: 29,
3984
4073
  fill: "currentColor",
3985
- xmlns: "http://www.w3.org/2000/svg",
3986
- role: "img"
4074
+ xmlns: "http://www.w3.org/2000/svg"
3987
4075
  }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
3988
4076
  d: "M56 0v29c-.8-1-7-6.1-17.7-8.4L13 15.7A16 16 0 0 1 0 0Z"
3989
4077
  })));
3990
4078
  };
4079
+ var headerDividerCollapsedIcon = SvgDividerCollapsed;
3991
4080
 
3992
- var css_248z$1 = ".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 --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 --aside-header-divider-line-color: var(--yc-color-base-light-simple-hover);\n --aside-header-header-divider-line-color: var(--yc-color-base-light-simple-hover);\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 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__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_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::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::after {\n display: none;\n}\n.ycn-aside-header_compact .ycn-aside-header__header .ycn-aside-header__header-divider {\n display: block;\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}\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}\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}";
3993
- styleInject(css_248z$1);
4081
+ var css_248z$3 = ".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 --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 --aside-header-divider-line-color: var(--yc-color-base-light-simple-hover);\n --aside-header-header-divider-line-color: var(--yc-color-base-light-simple-hover);\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 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__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_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::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::after {\n display: none;\n}\n.ycn-aside-header_compact .ycn-aside-header__header .ycn-aside-header__header-divider {\n display: block;\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}";
4082
+ styleInject(css_248z$3);
3994
4083
 
3995
- const b$1 = block('aside-header');
4084
+ const b$4 = block('aside-header');
3996
4085
  class AsideHeader extends React__default.Component {
3997
- constructor(props) {
3998
- super(props);
4086
+ constructor() {
4087
+ super(...arguments);
3999
4088
  this.asideRef = React__default.createRef();
4000
4089
  this.renderFirstPane = (size) => {
4001
- const { dict, menuItems, panelItems } = this.props;
4002
- const { compact } = this.state;
4003
- return (React__default.createElement("div", null,
4004
- React__default.createElement("div", { className: b$1('aside'), style: { width: size } },
4005
- React__default.createElement("div", { className: b$1('aside-popup-anchor'), ref: this.asideRef }),
4006
- React__default.createElement("div", { className: b$1('aside-content') },
4090
+ const { dict, menuItems, panelItems, compact } = this.props;
4091
+ return (React__default.createElement(React__default.Fragment, null,
4092
+ React__default.createElement("div", { className: b$4('aside'), style: { width: size } },
4093
+ React__default.createElement("div", { className: b$4('aside-popup-anchor'), ref: this.asideRef }),
4094
+ React__default.createElement("div", { className: b$4('aside-content') },
4007
4095
  this.renderHeader(),
4008
- React__default.createElement(CompositeBar, { items: menuItems, compact: compact, enableCollapsing: true, dict: dict, onItemClick: this.onCompositeBarClick }),
4096
+ React__default.createElement(CompositeBar, { items: menuItems, compact: compact, enableCollapsing: true, dict: dict, onItemClick: this.onItemClick }),
4009
4097
  this.renderFooter(size),
4010
4098
  this.renderCollapseButton())),
4011
4099
  panelItems && this.renderPanels(size)));
4012
4100
  };
4013
4101
  this.renderSecondPane = (size) => {
4014
- return (React__default.createElement(Content, { size: size, renderContent: this.props.renderContent, className: b$1('content') }));
4102
+ return (React__default.createElement(Content, { size: size, renderContent: this.props.renderContent, className: b$4('content') }));
4015
4103
  };
4016
4104
  this.renderLogo = () => React__default.createElement(Logo, Object.assign({}, this.props.logo, { compact: this.props.compact }));
4017
- this.renderHeader = () => (React__default.createElement("div", { className: b$1('header') },
4105
+ this.renderHeader = () => (React__default.createElement("div", { className: b$4('header') },
4018
4106
  this.renderLogo(),
4019
- React__default.createElement(CompositeBar, { items: this.props.subheaderItems, compact: this.props.compact, enableCollapsing: false }),
4020
- React__default.createElement(Icon, { data: SvgDividerCollapsed, className: b$1('header-divider'), width: ASIDE_HEADER_COMPACT_WIDTH, height: "29" })));
4107
+ React__default.createElement(CompositeBar, { items: this.props.subheaderItems, compact: this.props.compact, enableCollapsing: false, onItemClick: this.onItemClick }),
4108
+ React__default.createElement(Icon, { data: headerDividerCollapsedIcon, className: b$4('header-divider'), width: ASIDE_HEADER_COMPACT_WIDTH, height: "29" })));
4021
4109
  this.renderFooter = (size) => {
4022
- var _a, _b;
4023
- const { compact } = this.state;
4024
- return (React__default.createElement("div", { className: b$1('footer') }, (_b = (_a = this.props).renderFooter) === null || _b === void 0 ? void 0 : _b.call(_a, {
4110
+ const { compact, renderFooter } = this.props;
4111
+ return (React__default.createElement("div", { className: b$4('footer') }, renderFooter === null || renderFooter === void 0 ? void 0 : renderFooter({
4025
4112
  size,
4026
4113
  compact,
4027
4114
  asideRef: this.asideRef,
@@ -4029,44 +4116,34 @@ class AsideHeader extends React__default.Component {
4029
4116
  };
4030
4117
  this.renderPanels = (size) => {
4031
4118
  const { panelItems } = this.props;
4032
- return (React__default.createElement(Drawer, { className: b$1('panels'), onVeilClick: this.onCloseDrawer, onEscape: this.onCloseDrawer, style: { left: size } }, panelItems.map((item) => (React__default.createElement(DrawerItem, Object.assign({ key: item.id }, item))))));
4119
+ return (React__default.createElement(Drawer, { className: b$4('panels'), onVeilClick: this.onCloseDrawer, onEscape: this.onCloseDrawer, style: { left: size } }, panelItems.map((item) => (React__default.createElement(DrawerItem, Object.assign({ key: item.id }, item))))));
4033
4120
  };
4034
4121
  this.renderCollapseButton = () => {
4035
4122
  var _a;
4036
4123
  const { compact, dict } = this.props;
4037
4124
  const typeButton = compact ? Dict.ExpandButton : Dict.CollapseButton;
4038
- return (React__default.createElement(Button, { className: b$1('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[typeButton] },
4039
- React__default.createElement(Icon, { data: SvgControlMenuButton, className: b$1('collapse-icon'), width: "16", height: "10" })));
4125
+ return (React__default.createElement(Button, { className: b$4('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$1[typeButton] },
4126
+ React__default.createElement(Icon, { data: controlMenuButtonIcon, className: b$4('collapse-icon'), width: "16", height: "10" })));
4040
4127
  };
4041
4128
  this.onCollapseButtonClick = () => {
4042
4129
  var _a, _b;
4043
- const newCompact = !this.state.compact;
4044
- this.setState({ compact: newCompact });
4045
- (_b = (_a = this.props).onChangeCompact) === null || _b === void 0 ? void 0 : _b.call(_a, newCompact);
4130
+ (_b = (_a = this.props).onChangeCompact) === null || _b === void 0 ? void 0 : _b.call(_a, !this.props.compact);
4046
4131
  };
4047
4132
  this.onCloseDrawer = () => {
4048
4133
  var _a, _b;
4049
4134
  (_b = (_a = this.props).onClosePanel) === null || _b === void 0 ? void 0 : _b.call(_a);
4050
4135
  };
4051
- this.onCompositeBarClick = () => {
4052
- var _a, _b;
4136
+ this.onItemClick = (item, collapsed) => {
4137
+ var _a, _b, _c;
4053
4138
  (_b = (_a = this.props).onClosePanel) === null || _b === void 0 ? void 0 : _b.call(_a);
4054
- };
4055
- this.state = {
4056
- compact: Boolean(props.compact),
4139
+ (_c = item.onItemClick) === null || _c === void 0 ? void 0 : _c.call(item, item, collapsed);
4057
4140
  };
4058
4141
  }
4059
- componentDidUpdate(prevProps) {
4060
- if (prevProps.compact !== this.props.compact) {
4061
- this.setState({ compact: Boolean(this.props.compact) });
4062
- }
4063
- }
4064
4142
  render() {
4065
- const { className } = this.props;
4066
- const { compact } = this.state;
4143
+ const { className, compact } = this.props;
4067
4144
  const size = compact ? ASIDE_HEADER_COMPACT_WIDTH : ASIDE_HEADER_EXPANDED_WIDTH;
4068
- return (React__default.createElement("div", { className: b$1({ compact }, className) },
4069
- React__default.createElement("div", { className: b$1('pane-container') },
4145
+ return (React__default.createElement("div", { className: b$4({ compact }, className) },
4146
+ React__default.createElement("div", { className: b$4('pane-container') },
4070
4147
  this.renderFirstPane(size),
4071
4148
  this.renderSecondPane(size))));
4072
4149
  }
@@ -4104,14 +4181,931 @@ function __rest(s, e) {
4104
4181
  return t;
4105
4182
  }
4106
4183
 
4107
- var css_248z = ".ycn-footer-item {\n width: 100%;\n height: 40px;\n}";
4108
- styleInject(css_248z);
4184
+ var css_248z$2 = ".ycn-footer-item {\n width: 100%;\n height: 40px;\n}";
4185
+ styleInject(css_248z$2);
4109
4186
 
4110
- const b = block('footer-item');
4187
+ const b$3 = block('footer-item');
4111
4188
  const FooterItem = (_a) => {
4112
4189
  var { item } = _a, props = __rest(_a, ["item"]);
4113
- return (React__default.createElement(Item, Object.assign({}, props, { item: Object.assign({ iconSize: ASIDE_HEADER_FOOTER_ICON_SIZE }, item), className: b({ compact: props.compact }) })));
4190
+ return (React__default.createElement(Item, Object.assign({}, props, { item: Object.assign({ iconSize: ASIDE_HEADER_FOOTER_ICON_SIZE }, item), className: b$3({ compact: props.compact }), onItemClick: item.onItemClick })));
4114
4191
  };
4115
4192
 
4116
- export { AsideHeader, Dict, Drawer, DrawerItem, FooterItem };
4193
+ /**
4194
+ * This method returns the first argument it receives.
4195
+ *
4196
+ * @static
4197
+ * @since 0.1.0
4198
+ * @memberOf _
4199
+ * @category Util
4200
+ * @param {*} value Any value.
4201
+ * @returns {*} Returns `value`.
4202
+ * @example
4203
+ *
4204
+ * var object = { 'a': 1 };
4205
+ *
4206
+ * console.log(_.identity(object) === object);
4207
+ * // => true
4208
+ */
4209
+
4210
+ function identity(value) {
4211
+ return value;
4212
+ }
4213
+
4214
+ var identity_1 = identity;
4215
+
4216
+ /**
4217
+ * Checks if `value` is the
4218
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
4219
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
4220
+ *
4221
+ * @static
4222
+ * @memberOf _
4223
+ * @since 0.1.0
4224
+ * @category Lang
4225
+ * @param {*} value The value to check.
4226
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
4227
+ * @example
4228
+ *
4229
+ * _.isObject({});
4230
+ * // => true
4231
+ *
4232
+ * _.isObject([1, 2, 3]);
4233
+ * // => true
4234
+ *
4235
+ * _.isObject(_.noop);
4236
+ * // => true
4237
+ *
4238
+ * _.isObject(null);
4239
+ * // => false
4240
+ */
4241
+
4242
+ function isObject$2(value) {
4243
+ var type = typeof value;
4244
+ return value != null && (type == 'object' || type == 'function');
4245
+ }
4246
+
4247
+ var isObject_1 = isObject$2;
4248
+
4249
+ /** Detect free variable `global` from Node.js. */
4250
+
4251
+ var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
4252
+
4253
+ var _freeGlobal = freeGlobal$1;
4254
+
4255
+ var freeGlobal = _freeGlobal;
4256
+
4257
+ /** Detect free variable `self`. */
4258
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
4259
+
4260
+ /** Used as a reference to the global object. */
4261
+ var root$2 = freeGlobal || freeSelf || Function('return this')();
4262
+
4263
+ var _root = root$2;
4264
+
4265
+ var root$1 = _root;
4266
+
4267
+ /**
4268
+ * Gets the timestamp of the number of milliseconds that have elapsed since
4269
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
4270
+ *
4271
+ * @static
4272
+ * @memberOf _
4273
+ * @since 2.4.0
4274
+ * @category Date
4275
+ * @returns {number} Returns the timestamp.
4276
+ * @example
4277
+ *
4278
+ * _.defer(function(stamp) {
4279
+ * console.log(_.now() - stamp);
4280
+ * }, _.now());
4281
+ * // => Logs the number of milliseconds it took for the deferred invocation.
4282
+ */
4283
+ var now$1 = function() {
4284
+ return root$1.Date.now();
4285
+ };
4286
+
4287
+ var now_1 = now$1;
4288
+
4289
+ /** Used to match a single whitespace character. */
4290
+
4291
+ var reWhitespace = /\s/;
4292
+
4293
+ /**
4294
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
4295
+ * character of `string`.
4296
+ *
4297
+ * @private
4298
+ * @param {string} string The string to inspect.
4299
+ * @returns {number} Returns the index of the last non-whitespace character.
4300
+ */
4301
+ function trimmedEndIndex$1(string) {
4302
+ var index = string.length;
4303
+
4304
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
4305
+ return index;
4306
+ }
4307
+
4308
+ var _trimmedEndIndex = trimmedEndIndex$1;
4309
+
4310
+ var trimmedEndIndex = _trimmedEndIndex;
4311
+
4312
+ /** Used to match leading whitespace. */
4313
+ var reTrimStart = /^\s+/;
4314
+
4315
+ /**
4316
+ * The base implementation of `_.trim`.
4317
+ *
4318
+ * @private
4319
+ * @param {string} string The string to trim.
4320
+ * @returns {string} Returns the trimmed string.
4321
+ */
4322
+ function baseTrim$1(string) {
4323
+ return string
4324
+ ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
4325
+ : string;
4326
+ }
4327
+
4328
+ var _baseTrim = baseTrim$1;
4329
+
4330
+ var root = _root;
4331
+
4332
+ /** Built-in value references. */
4333
+ var Symbol$3 = root.Symbol;
4334
+
4335
+ var _Symbol = Symbol$3;
4336
+
4337
+ var Symbol$2 = _Symbol;
4338
+
4339
+ /** Used for built-in method references. */
4340
+ var objectProto$1 = Object.prototype;
4341
+
4342
+ /** Used to check objects for own properties. */
4343
+ var hasOwnProperty = objectProto$1.hasOwnProperty;
4344
+
4345
+ /**
4346
+ * Used to resolve the
4347
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
4348
+ * of values.
4349
+ */
4350
+ var nativeObjectToString$1 = objectProto$1.toString;
4351
+
4352
+ /** Built-in value references. */
4353
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
4354
+
4355
+ /**
4356
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
4357
+ *
4358
+ * @private
4359
+ * @param {*} value The value to query.
4360
+ * @returns {string} Returns the raw `toStringTag`.
4361
+ */
4362
+ function getRawTag$1(value) {
4363
+ var isOwn = hasOwnProperty.call(value, symToStringTag$1),
4364
+ tag = value[symToStringTag$1];
4365
+
4366
+ try {
4367
+ value[symToStringTag$1] = undefined;
4368
+ var unmasked = true;
4369
+ } catch (e) {}
4370
+
4371
+ var result = nativeObjectToString$1.call(value);
4372
+ if (unmasked) {
4373
+ if (isOwn) {
4374
+ value[symToStringTag$1] = tag;
4375
+ } else {
4376
+ delete value[symToStringTag$1];
4377
+ }
4378
+ }
4379
+ return result;
4380
+ }
4381
+
4382
+ var _getRawTag = getRawTag$1;
4383
+
4384
+ /** Used for built-in method references. */
4385
+
4386
+ var objectProto = Object.prototype;
4387
+
4388
+ /**
4389
+ * Used to resolve the
4390
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
4391
+ * of values.
4392
+ */
4393
+ var nativeObjectToString = objectProto.toString;
4394
+
4395
+ /**
4396
+ * Converts `value` to a string using `Object.prototype.toString`.
4397
+ *
4398
+ * @private
4399
+ * @param {*} value The value to convert.
4400
+ * @returns {string} Returns the converted string.
4401
+ */
4402
+ function objectToString$1(value) {
4403
+ return nativeObjectToString.call(value);
4404
+ }
4405
+
4406
+ var _objectToString = objectToString$1;
4407
+
4408
+ var Symbol$1 = _Symbol,
4409
+ getRawTag = _getRawTag,
4410
+ objectToString = _objectToString;
4411
+
4412
+ /** `Object#toString` result references. */
4413
+ var nullTag = '[object Null]',
4414
+ undefinedTag = '[object Undefined]';
4415
+
4416
+ /** Built-in value references. */
4417
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
4418
+
4419
+ /**
4420
+ * The base implementation of `getTag` without fallbacks for buggy environments.
4421
+ *
4422
+ * @private
4423
+ * @param {*} value The value to query.
4424
+ * @returns {string} Returns the `toStringTag`.
4425
+ */
4426
+ function baseGetTag$1(value) {
4427
+ if (value == null) {
4428
+ return value === undefined ? undefinedTag : nullTag;
4429
+ }
4430
+ return (symToStringTag && symToStringTag in Object(value))
4431
+ ? getRawTag(value)
4432
+ : objectToString(value);
4433
+ }
4434
+
4435
+ var _baseGetTag = baseGetTag$1;
4436
+
4437
+ /**
4438
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
4439
+ * and has a `typeof` result of "object".
4440
+ *
4441
+ * @static
4442
+ * @memberOf _
4443
+ * @since 4.0.0
4444
+ * @category Lang
4445
+ * @param {*} value The value to check.
4446
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4447
+ * @example
4448
+ *
4449
+ * _.isObjectLike({});
4450
+ * // => true
4451
+ *
4452
+ * _.isObjectLike([1, 2, 3]);
4453
+ * // => true
4454
+ *
4455
+ * _.isObjectLike(_.noop);
4456
+ * // => false
4457
+ *
4458
+ * _.isObjectLike(null);
4459
+ * // => false
4460
+ */
4461
+
4462
+ function isObjectLike$1(value) {
4463
+ return value != null && typeof value == 'object';
4464
+ }
4465
+
4466
+ var isObjectLike_1 = isObjectLike$1;
4467
+
4468
+ var baseGetTag = _baseGetTag,
4469
+ isObjectLike = isObjectLike_1;
4470
+
4471
+ /** `Object#toString` result references. */
4472
+ var symbolTag = '[object Symbol]';
4473
+
4474
+ /**
4475
+ * Checks if `value` is classified as a `Symbol` primitive or object.
4476
+ *
4477
+ * @static
4478
+ * @memberOf _
4479
+ * @since 4.0.0
4480
+ * @category Lang
4481
+ * @param {*} value The value to check.
4482
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
4483
+ * @example
4484
+ *
4485
+ * _.isSymbol(Symbol.iterator);
4486
+ * // => true
4487
+ *
4488
+ * _.isSymbol('abc');
4489
+ * // => false
4490
+ */
4491
+ function isSymbol$1(value) {
4492
+ return typeof value == 'symbol' ||
4493
+ (isObjectLike(value) && baseGetTag(value) == symbolTag);
4494
+ }
4495
+
4496
+ var isSymbol_1 = isSymbol$1;
4497
+
4498
+ var baseTrim = _baseTrim,
4499
+ isObject$1 = isObject_1,
4500
+ isSymbol = isSymbol_1;
4501
+
4502
+ /** Used as references for various `Number` constants. */
4503
+ var NAN = 0 / 0;
4504
+
4505
+ /** Used to detect bad signed hexadecimal string values. */
4506
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
4507
+
4508
+ /** Used to detect binary string values. */
4509
+ var reIsBinary = /^0b[01]+$/i;
4510
+
4511
+ /** Used to detect octal string values. */
4512
+ var reIsOctal = /^0o[0-7]+$/i;
4513
+
4514
+ /** Built-in method references without a dependency on `root`. */
4515
+ var freeParseInt = parseInt;
4516
+
4517
+ /**
4518
+ * Converts `value` to a number.
4519
+ *
4520
+ * @static
4521
+ * @memberOf _
4522
+ * @since 4.0.0
4523
+ * @category Lang
4524
+ * @param {*} value The value to process.
4525
+ * @returns {number} Returns the number.
4526
+ * @example
4527
+ *
4528
+ * _.toNumber(3.2);
4529
+ * // => 3.2
4530
+ *
4531
+ * _.toNumber(Number.MIN_VALUE);
4532
+ * // => 5e-324
4533
+ *
4534
+ * _.toNumber(Infinity);
4535
+ * // => Infinity
4536
+ *
4537
+ * _.toNumber('3.2');
4538
+ * // => 3.2
4539
+ */
4540
+ function toNumber$1(value) {
4541
+ if (typeof value == 'number') {
4542
+ return value;
4543
+ }
4544
+ if (isSymbol(value)) {
4545
+ return NAN;
4546
+ }
4547
+ if (isObject$1(value)) {
4548
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
4549
+ value = isObject$1(other) ? (other + '') : other;
4550
+ }
4551
+ if (typeof value != 'string') {
4552
+ return value === 0 ? value : +value;
4553
+ }
4554
+ value = baseTrim(value);
4555
+ var isBinary = reIsBinary.test(value);
4556
+ return (isBinary || reIsOctal.test(value))
4557
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
4558
+ : (reIsBadHex.test(value) ? NAN : +value);
4559
+ }
4560
+
4561
+ var toNumber_1 = toNumber$1;
4562
+
4563
+ var isObject = isObject_1,
4564
+ now = now_1,
4565
+ toNumber = toNumber_1;
4566
+
4567
+ /** Error message constants. */
4568
+ var FUNC_ERROR_TEXT = 'Expected a function';
4569
+
4570
+ /* Built-in method references for those with the same name as other `lodash` methods. */
4571
+ var nativeMax = Math.max,
4572
+ nativeMin = Math.min;
4573
+
4574
+ /**
4575
+ * Creates a debounced function that delays invoking `func` until after `wait`
4576
+ * milliseconds have elapsed since the last time the debounced function was
4577
+ * invoked. The debounced function comes with a `cancel` method to cancel
4578
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
4579
+ * Provide `options` to indicate whether `func` should be invoked on the
4580
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
4581
+ * with the last arguments provided to the debounced function. Subsequent
4582
+ * calls to the debounced function return the result of the last `func`
4583
+ * invocation.
4584
+ *
4585
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
4586
+ * invoked on the trailing edge of the timeout only if the debounced function
4587
+ * is invoked more than once during the `wait` timeout.
4588
+ *
4589
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
4590
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
4591
+ *
4592
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
4593
+ * for details over the differences between `_.debounce` and `_.throttle`.
4594
+ *
4595
+ * @static
4596
+ * @memberOf _
4597
+ * @since 0.1.0
4598
+ * @category Function
4599
+ * @param {Function} func The function to debounce.
4600
+ * @param {number} [wait=0] The number of milliseconds to delay.
4601
+ * @param {Object} [options={}] The options object.
4602
+ * @param {boolean} [options.leading=false]
4603
+ * Specify invoking on the leading edge of the timeout.
4604
+ * @param {number} [options.maxWait]
4605
+ * The maximum time `func` is allowed to be delayed before it's invoked.
4606
+ * @param {boolean} [options.trailing=true]
4607
+ * Specify invoking on the trailing edge of the timeout.
4608
+ * @returns {Function} Returns the new debounced function.
4609
+ * @example
4610
+ *
4611
+ * // Avoid costly calculations while the window size is in flux.
4612
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
4613
+ *
4614
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
4615
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
4616
+ * 'leading': true,
4617
+ * 'trailing': false
4618
+ * }));
4619
+ *
4620
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
4621
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
4622
+ * var source = new EventSource('/stream');
4623
+ * jQuery(source).on('message', debounced);
4624
+ *
4625
+ * // Cancel the trailing debounced invocation.
4626
+ * jQuery(window).on('popstate', debounced.cancel);
4627
+ */
4628
+ function debounce(func, wait, options) {
4629
+ var lastArgs,
4630
+ lastThis,
4631
+ maxWait,
4632
+ result,
4633
+ timerId,
4634
+ lastCallTime,
4635
+ lastInvokeTime = 0,
4636
+ leading = false,
4637
+ maxing = false,
4638
+ trailing = true;
4639
+
4640
+ if (typeof func != 'function') {
4641
+ throw new TypeError(FUNC_ERROR_TEXT);
4642
+ }
4643
+ wait = toNumber(wait) || 0;
4644
+ if (isObject(options)) {
4645
+ leading = !!options.leading;
4646
+ maxing = 'maxWait' in options;
4647
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
4648
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
4649
+ }
4650
+
4651
+ function invokeFunc(time) {
4652
+ var args = lastArgs,
4653
+ thisArg = lastThis;
4654
+
4655
+ lastArgs = lastThis = undefined;
4656
+ lastInvokeTime = time;
4657
+ result = func.apply(thisArg, args);
4658
+ return result;
4659
+ }
4660
+
4661
+ function leadingEdge(time) {
4662
+ // Reset any `maxWait` timer.
4663
+ lastInvokeTime = time;
4664
+ // Start the timer for the trailing edge.
4665
+ timerId = setTimeout(timerExpired, wait);
4666
+ // Invoke the leading edge.
4667
+ return leading ? invokeFunc(time) : result;
4668
+ }
4669
+
4670
+ function remainingWait(time) {
4671
+ var timeSinceLastCall = time - lastCallTime,
4672
+ timeSinceLastInvoke = time - lastInvokeTime,
4673
+ timeWaiting = wait - timeSinceLastCall;
4674
+
4675
+ return maxing
4676
+ ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
4677
+ : timeWaiting;
4678
+ }
4679
+
4680
+ function shouldInvoke(time) {
4681
+ var timeSinceLastCall = time - lastCallTime,
4682
+ timeSinceLastInvoke = time - lastInvokeTime;
4683
+
4684
+ // Either this is the first call, activity has stopped and we're at the
4685
+ // trailing edge, the system time has gone backwards and we're treating
4686
+ // it as the trailing edge, or we've hit the `maxWait` limit.
4687
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
4688
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
4689
+ }
4690
+
4691
+ function timerExpired() {
4692
+ var time = now();
4693
+ if (shouldInvoke(time)) {
4694
+ return trailingEdge(time);
4695
+ }
4696
+ // Restart the timer.
4697
+ timerId = setTimeout(timerExpired, remainingWait(time));
4698
+ }
4699
+
4700
+ function trailingEdge(time) {
4701
+ timerId = undefined;
4702
+
4703
+ // Only invoke if we have `lastArgs` which means `func` has been
4704
+ // debounced at least once.
4705
+ if (trailing && lastArgs) {
4706
+ return invokeFunc(time);
4707
+ }
4708
+ lastArgs = lastThis = undefined;
4709
+ return result;
4710
+ }
4711
+
4712
+ function cancel() {
4713
+ if (timerId !== undefined) {
4714
+ clearTimeout(timerId);
4715
+ }
4716
+ lastInvokeTime = 0;
4717
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
4718
+ }
4719
+
4720
+ function flush() {
4721
+ return timerId === undefined ? result : trailingEdge(now());
4722
+ }
4723
+
4724
+ function debounced() {
4725
+ var time = now(),
4726
+ isInvoking = shouldInvoke(time);
4727
+
4728
+ lastArgs = arguments;
4729
+ lastThis = this;
4730
+ lastCallTime = time;
4731
+
4732
+ if (isInvoking) {
4733
+ if (timerId === undefined) {
4734
+ return leadingEdge(lastCallTime);
4735
+ }
4736
+ if (maxing) {
4737
+ // Handle invocations in a tight loop.
4738
+ clearTimeout(timerId);
4739
+ timerId = setTimeout(timerExpired, wait);
4740
+ return invokeFunc(lastCallTime);
4741
+ }
4742
+ }
4743
+ if (timerId === undefined) {
4744
+ timerId = setTimeout(timerExpired, wait);
4745
+ }
4746
+ return result;
4747
+ }
4748
+ debounced.cancel = cancel;
4749
+ debounced.flush = flush;
4750
+ return debounced;
4751
+ }
4752
+
4753
+ var debounce_1 = debounce;
4754
+
4755
+ function useStableCallback(func) {
4756
+ const funcRef = React.useRef();
4757
+ React.useEffect(() => {
4758
+ funcRef.current = func;
4759
+ return () => {
4760
+ funcRef.current = undefined;
4761
+ };
4762
+ }, [func]);
4763
+ return React.useCallback((...args) => {
4764
+ if (typeof funcRef.current === 'function') {
4765
+ return funcRef.current(...args);
4766
+ }
4767
+ return undefined;
4768
+ }, []);
4769
+ }
4770
+ function useCurrent(value) {
4771
+ const ref = React.useRef(value);
4772
+ ref.current = value;
4773
+ return React.useCallback(() => ref.current, []);
4774
+ }
4775
+ function invariant(cond, message) {
4776
+ if (!cond) {
4777
+ throw new Error(message);
4778
+ }
4779
+ }
4780
+ function escapeStringForRegExp(input) {
4781
+ return input.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
4782
+ }
4783
+
4784
+ const b$2 = block('settings-search');
4785
+ function SettingsSearch({ className, onChange, debounce = 200, inputRef, placeholder, }) {
4786
+ const onChangeStable = useStableCallback(onChange);
4787
+ const handleUpdate = React__default.useCallback(debounce_1(onChangeStable, debounce), [debounce]);
4788
+ return (React__default.createElement("div", { className: b$2(null, className) },
4789
+ React__default.createElement(TextInput, { controlRef: inputRef, hasClear: true, autoFocus: true, placeholder: placeholder, onUpdate: handleUpdate })));
4790
+ }
4791
+
4792
+ var css_248z$1 = ".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}";
4793
+ styleInject(css_248z$1);
4794
+
4795
+ const b$1 = block('settings-menu');
4796
+ const SettingsMenu = React__default.forwardRef(
4797
+ // eslint-disable-next-line prefer-arrow-callback
4798
+ function SettingsMenu({ items, onChange, activeItem }, ref) {
4799
+ const [focusItem, setFocus] = React__default.useState();
4800
+ const containerRef = React__default.useRef(null);
4801
+ const handleChange = useStableCallback(onChange);
4802
+ const getFocused = useCurrent(focusItem);
4803
+ React__default.useImperativeHandle(ref, () => ({
4804
+ handleKeyDown(event) {
4805
+ if (!containerRef.current) {
4806
+ return false;
4807
+ }
4808
+ const focused = getFocused();
4809
+ if (focused && event.key === 'Enter') {
4810
+ handleChange(focused);
4811
+ return true;
4812
+ }
4813
+ else if (event.key === 'ArrowDown') {
4814
+ setFocus(focusNext(containerRef.current, focused, 1));
4815
+ return true;
4816
+ }
4817
+ else if (event.key === 'ArrowUp') {
4818
+ setFocus(focusNext(containerRef.current, focused, -1));
4819
+ return true;
4820
+ }
4821
+ return false;
4822
+ },
4823
+ clearFocus() {
4824
+ setFocus(undefined);
4825
+ },
4826
+ }), [getFocused, handleChange]);
4827
+ return (React__default.createElement("div", { ref: containerRef, className: b$1() }, items.map((firstLevelItem) => {
4828
+ if ('groupTitle' in firstLevelItem) {
4829
+ return (React__default.createElement("div", { key: firstLevelItem.groupTitle, className: b$1('group') },
4830
+ React__default.createElement("span", { className: b$1('group-heading') }, firstLevelItem.groupTitle),
4831
+ firstLevelItem.items.map((item) => {
4832
+ return renderMenuItem(item, onChange, activeItem, focusItem);
4833
+ })));
4834
+ }
4835
+ return renderMenuItem(firstLevelItem, onChange, activeItem, focusItem);
4836
+ })));
4837
+ });
4838
+ function renderMenuItem(item, onChange, activeItem, focusItem) {
4839
+ return (React__default.createElement("span", { key: item.title, className: b$1('item', {
4840
+ selected: activeItem === item.id,
4841
+ disabled: item.disabled,
4842
+ focused: focusItem === item.id,
4843
+ badge: item.withBadge,
4844
+ }), onClick: () => {
4845
+ if (!item.disabled) {
4846
+ onChange(item.id);
4847
+ }
4848
+ }, "data-id": item.id },
4849
+ item.icon ? React__default.createElement(Icon, Object.assign({ size: 16 }, item.icon, { className: b$1('item-icon') })) : undefined,
4850
+ React__default.createElement("span", null, item.title)));
4851
+ }
4852
+ function focusNext(container, focused, direction) {
4853
+ var _a;
4854
+ const elements = container.querySelectorAll(`.${b$1('item')}:not(.${b$1('item')}_disabled)`);
4855
+ if (elements.length === 0) {
4856
+ return undefined;
4857
+ }
4858
+ let currentIndex = direction > 0 ? -1 : 0;
4859
+ if (focused) {
4860
+ currentIndex = Array.prototype.findIndex.call(elements, (element) => element.getAttribute('data-id') === focused);
4861
+ }
4862
+ currentIndex = (elements.length + currentIndex + direction) % elements.length;
4863
+ return (_a = elements[currentIndex].getAttribute('data-id')) !== null && _a !== void 0 ? _a : undefined;
4864
+ }
4865
+
4866
+ function getSettingsFromChildren(children, searchText = '') {
4867
+ // 'abc def fg' -> abc.*?cde.*?fg
4868
+ const preparedFilter = escapeStringForRegExp(searchText).replace(/\s+/g, '.*?');
4869
+ const filterRe = new RegExp(preparedFilter, 'i');
4870
+ return getSettingsFromChildrenRecursive(children, '', filterRe);
4871
+ }
4872
+ function getSettingsFromChildrenRecursive(children, basepath = '', filterRe) {
4873
+ const menu = [];
4874
+ const pages = {};
4875
+ let hasGroup = false;
4876
+ let hasItems = false;
4877
+ React__default.Children.forEach(children, (element) => {
4878
+ var _a, _b;
4879
+ if (!React__default.isValidElement(element)) {
4880
+ // Ignore non-elements.
4881
+ return;
4882
+ }
4883
+ if (element.type === React__default.Fragment) {
4884
+ // Transparently support React.Fragment and its children.
4885
+ const { menu: menuFragment, pages: pagesFragment } = getSettingsFromChildrenRecursive(element.props.children, basepath, filterRe);
4886
+ menu.push(...menuFragment);
4887
+ Object.assign(pages, pagesFragment);
4888
+ }
4889
+ else if (element.props.groupTitle) {
4890
+ if (process.env.NODE_ENV === 'development') {
4891
+ invariant(!hasItems, 'Setting menu must not mix groups and pages on one level');
4892
+ }
4893
+ const pageId = `${basepath}/${(_a = element.props.id) !== null && _a !== void 0 ? _a : element.props.groupTitle}`;
4894
+ hasGroup = true;
4895
+ const { menu: menuFragment, pages: pagesFragment } = getSettingsFromChildrenRecursive(element.props.children, pageId, filterRe);
4896
+ if (process.env.NODE_ENV === 'development') {
4897
+ const hasInnerGroup = menuFragment.some((item) => 'groupTitle' in item);
4898
+ invariant(!hasInnerGroup, `Group ${element.props.groupTitle} should not include groups`);
4899
+ }
4900
+ menu.push({
4901
+ groupTitle: element.props.groupTitle,
4902
+ // @ts-ignore
4903
+ items: menuFragment,
4904
+ });
4905
+ Object.assign(pages, pagesFragment);
4906
+ }
4907
+ else {
4908
+ hasItems = true;
4909
+ const pageId = `${basepath}/${(_b = element.props.id) !== null && _b !== void 0 ? _b : element.props.title}`;
4910
+ if (process.env.NODE_ENV === 'development') {
4911
+ invariant(Boolean(element.props.title), 'Component must include title prop');
4912
+ invariant(!hasGroup, 'Setting menu must not mix groups and pages on one level');
4913
+ invariant(!pages[pageId], `Setting menu page id must be uniq (${pageId})`);
4914
+ }
4915
+ pages[pageId] = getSettingsPageFromChildren(element.props.children, filterRe);
4916
+ pages[pageId].id = pageId;
4917
+ menu.push({
4918
+ id: pageId,
4919
+ title: element.props.title,
4920
+ icon: element.props.icon,
4921
+ withBadge: pages[pageId].withBadge,
4922
+ disabled: pages[pageId].hidden,
4923
+ });
4924
+ }
4925
+ });
4926
+ return { menu, pages };
4927
+ }
4928
+ function getSettingsPageFromChildren(children, filterRe) {
4929
+ const page = { id: '', sections: [], hidden: true };
4930
+ React__default.Children.forEach(children, (element) => {
4931
+ if (!React__default.isValidElement(element)) {
4932
+ // Ignore non-elements.
4933
+ return;
4934
+ }
4935
+ if (element.type === React__default.Fragment) {
4936
+ // Transparently support React.Fragment and its children.
4937
+ const { sections, withBadge, hidden } = getSettingsPageFromChildren(element.props.children, filterRe);
4938
+ page.sections.push(...sections);
4939
+ page.withBadge = withBadge || page.withBadge;
4940
+ page.hidden = hidden && page.hidden;
4941
+ }
4942
+ else {
4943
+ const { title, header, withBadge } = element.props;
4944
+ const { items, hidden } = getSettingsItemsFromChildren(element.props.children, filterRe);
4945
+ page.withBadge = withBadge || page.withBadge;
4946
+ page.hidden = hidden && page.hidden;
4947
+ page.sections.push({
4948
+ title,
4949
+ header,
4950
+ withBadge,
4951
+ items,
4952
+ hidden,
4953
+ });
4954
+ }
4955
+ });
4956
+ return page;
4957
+ }
4958
+ function getSettingsItemsFromChildren(children, filterRe) {
4959
+ let hidden = true;
4960
+ const items = [];
4961
+ React__default.Children.forEach(children, (element) => {
4962
+ if (!React__default.isValidElement(element)) {
4963
+ // Ignore non-elements.
4964
+ return;
4965
+ }
4966
+ if (element.type === React__default.Fragment) {
4967
+ // Transparently support React.Fragment and its children.
4968
+ const fragmentItems = getSettingsItemsFromChildren(element.props.children, filterRe);
4969
+ items.push(...fragmentItems.items);
4970
+ hidden = hidden && fragmentItems.hidden;
4971
+ }
4972
+ else {
4973
+ const item = {
4974
+ title: element.props.title,
4975
+ renderTitleComponent: element.props.renderTitleComponent,
4976
+ element,
4977
+ hidden: !filterRe.test(element.props.title),
4978
+ };
4979
+ items.push(item);
4980
+ hidden = hidden && item.hidden;
4981
+ }
4982
+ });
4983
+ return { items, hidden };
4984
+ }
4985
+
4986
+ var css_248z = ".ycn-settings {\n display: grid;\n grid-template-columns: 216px 1fr;\n width: 834px;\n height: 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: 12px 20px 16px;\n}\n.ycn-settings__page {\n padding: 20px;\n overflow-y: auto;\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-heading_badge {\n position: relative;\n}\n.ycn-settings__item-heading_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__found {\n font-weight: var(--yc-text-accent-font-weight);\n background: var(--yc-color-base-selection);\n}";
4987
+ styleInject(css_248z);
4988
+
4989
+ const b = block('settings');
4990
+ const defaultDict = {
4991
+ heading_settings: 'Settings',
4992
+ placeholder_search: 'Search settings',
4993
+ not_found: 'No results found',
4994
+ };
4995
+ function Settings(_a) {
4996
+ var { loading, renderLoading, children } = _a, props = __rest(_a, ["loading", "renderLoading", "children"]);
4997
+ if (loading) {
4998
+ return (React__default.createElement("div", { className: b({ loading: true }) }, typeof renderLoading === 'function' ? (renderLoading()) : (React__default.createElement(Loader, { className: b('loader'), size: "m" }))));
4999
+ }
5000
+ return React__default.createElement(SettingsContent, Object.assign({}, props), children);
5001
+ }
5002
+ Settings.defaultProps = {
5003
+ dict: defaultDict,
5004
+ };
5005
+ function SettingsContent({ initialPage, onPageChange, children, renderNotFound, dict, }) {
5006
+ var _a, _b;
5007
+ const [search, setSearch] = React__default.useState('');
5008
+ const { menu, pages } = getSettingsFromChildren(children, search);
5009
+ const pageKeys = Object.keys(pages);
5010
+ const [selectedPage, setCurrentPage] = React__default.useState(initialPage && pageKeys.includes(initialPage) ? initialPage : undefined);
5011
+ const searchInputRef = React__default.useRef(null);
5012
+ const menuRef = React__default.useRef(null);
5013
+ React__default.useEffect(() => {
5014
+ var _a;
5015
+ (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.clearFocus();
5016
+ }, [search]);
5017
+ React__default.useEffect(() => {
5018
+ const handler = () => {
5019
+ var _a;
5020
+ (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.clearFocus();
5021
+ };
5022
+ window.addEventListener('click', handler);
5023
+ return () => {
5024
+ window.removeEventListener('click', handler);
5025
+ };
5026
+ }, []);
5027
+ let activePage = selectedPage;
5028
+ if (!activePage || ((_a = pages[activePage]) === null || _a === void 0 ? void 0 : _a.hidden)) {
5029
+ activePage = (_b = Object.values(pages).find(({ hidden }) => !hidden)) === null || _b === void 0 ? void 0 : _b.id;
5030
+ }
5031
+ const handlePageChange = (newPage) => {
5032
+ setCurrentPage((prevPage) => {
5033
+ if (prevPage !== newPage) {
5034
+ onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(newPage);
5035
+ }
5036
+ return newPage;
5037
+ });
5038
+ };
5039
+ React__default.useEffect(() => {
5040
+ if (activePage !== selectedPage) {
5041
+ handlePageChange(activePage);
5042
+ }
5043
+ });
5044
+ const renderPageContent = () => {
5045
+ if (!activePage) {
5046
+ return typeof renderNotFound === 'function' ? (renderNotFound()) : (React__default.createElement("div", { className: b('not-found') }, dict === null || dict === void 0 ? void 0 : dict.not_found));
5047
+ }
5048
+ return pages[activePage].sections
5049
+ .filter((section) => !section.hidden)
5050
+ .map((section) => (React__default.createElement("div", { key: section.title, className: b('section') },
5051
+ React__default.createElement("h3", { className: b('section-heading') }, section.title),
5052
+ section.header ? section.header : null,
5053
+ section.items.map(({ hidden, title, element }) => hidden ? null : (React__default.createElement("div", { key: title, className: b('section-item') }, React__default.cloneElement(element, Object.assign(Object.assign({}, element.props), { title: search && title ? prepareTitle(title, search) : title }))))))));
5054
+ };
5055
+ return (React__default.createElement("div", { className: b() },
5056
+ React__default.createElement("div", { className: b('menu'), onClick: () => {
5057
+ if (searchInputRef.current) {
5058
+ searchInputRef.current.focus();
5059
+ }
5060
+ }, onKeyDown: (event) => {
5061
+ if (menuRef.current) {
5062
+ if (menuRef.current.handleKeyDown(event)) {
5063
+ event.preventDefault();
5064
+ }
5065
+ }
5066
+ } },
5067
+ React__default.createElement("h2", { className: b('heading') }, dict === null || dict === void 0 ? void 0 : dict.heading_settings),
5068
+ React__default.createElement(SettingsSearch, { inputRef: searchInputRef, className: b('search'), onChange: setSearch, placeholder: dict === null || dict === void 0 ? void 0 : dict.placeholder_search }),
5069
+ React__default.createElement(SettingsMenu, { ref: menuRef, items: menu, onChange: handlePageChange, activeItem: activePage })),
5070
+ React__default.createElement("div", { className: b('page') }, renderPageContent())));
5071
+ }
5072
+ Settings.Group = function SettingsGroup({ children }) {
5073
+ return React__default.createElement(React__default.Fragment, null, children);
5074
+ };
5075
+ Settings.Page = function SettingsPage({ children }) {
5076
+ return React__default.createElement(React__default.Fragment, null, children);
5077
+ };
5078
+ Settings.Section = function SettingsSection({ children }) {
5079
+ return React__default.createElement(React__default.Fragment, null, children);
5080
+ };
5081
+ Settings.Item = function SettingsItem({ title, children, align = 'center', withBadge, renderTitleComponent = identity_1, }) {
5082
+ return (React__default.createElement("div", { className: b('item', { align }) },
5083
+ React__default.createElement("label", { className: b('item-heading', { badge: withBadge }) }, renderTitleComponent(title)),
5084
+ React__default.createElement("div", null, children)));
5085
+ };
5086
+ function prepareTitle(string, search) {
5087
+ let temp = string.slice(0);
5088
+ const title = [];
5089
+ const parts = escapeStringForRegExp(search).split(' ').filter(Boolean);
5090
+ let key = 0;
5091
+ for (const part of parts) {
5092
+ const regex = new RegExp(part, 'ig');
5093
+ const match = regex.exec(temp);
5094
+ if (match) {
5095
+ const m = match[0];
5096
+ const i = match.index;
5097
+ if (i > 0) {
5098
+ title.push(temp.slice(0, i));
5099
+ }
5100
+ title.push(React__default.createElement("strong", { key: key++, className: b('found') }, m));
5101
+ temp = temp.slice(i + m.length);
5102
+ }
5103
+ }
5104
+ if (temp) {
5105
+ title.push(temp);
5106
+ }
5107
+ return title;
5108
+ }
5109
+
5110
+ export { PublicActionBar as ActionBar, AsideHeader, Dict, Drawer, DrawerItem, FooterItem, Settings };
4117
5111
  //# sourceMappingURL=index.js.map