@gravity-ui/navigation 0.0.7 → 0.1.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.
- package/CHANGELOG.md +8 -0
- package/build/cjs/index.js +157 -73
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/types/components/ActionBar/ActionBar.d.ts +28 -0
- package/build/cjs/types/components/ActionBar/Group/ActionBarGroup.d.ts +10 -0
- package/build/cjs/types/components/ActionBar/Item/ActionBarItem.d.ts +11 -0
- package/build/cjs/types/components/ActionBar/Section/ActionBarSection.d.ts +9 -0
- package/build/cjs/types/components/ActionBar/Separator/ActionBarSeparator.d.ts +5 -0
- package/build/cjs/types/components/ActionBar/__stories__/ActionBar.stories.d.ts +44 -0
- package/build/cjs/types/components/ActionBar/__stories__/ActionBarShowcase.d.ts +2 -0
- package/build/cjs/types/components/ActionBar/index.d.ts +5 -0
- package/build/cjs/types/components/ActionBar/types.d.ts +3 -0
- package/build/cjs/types/components/AsideHeader/__stories__/getAsideHeaderWrapper.d.ts +3 -0
- package/build/cjs/types/components/CompositeBar/CompositeBar.d.ts +2 -1
- package/build/cjs/types/components/CompositeBar/utils.d.ts +4 -2
- package/build/cjs/types/components/index.d.ts +1 -0
- package/build/cjs/types/components/types.d.ts +1 -1
- package/build/esm/index.js +157 -74
- package/build/esm/index.js.map +1 -1
- package/build/esm/types/components/ActionBar/ActionBar.d.ts +28 -0
- package/build/esm/types/components/ActionBar/Group/ActionBarGroup.d.ts +10 -0
- package/build/esm/types/components/ActionBar/Item/ActionBarItem.d.ts +11 -0
- package/build/esm/types/components/ActionBar/Section/ActionBarSection.d.ts +9 -0
- package/build/esm/types/components/ActionBar/Separator/ActionBarSeparator.d.ts +5 -0
- package/build/esm/types/components/ActionBar/__stories__/ActionBar.stories.d.ts +44 -0
- package/build/esm/types/components/ActionBar/__stories__/ActionBarShowcase.d.ts +2 -0
- package/build/esm/types/components/ActionBar/index.d.ts +5 -0
- package/build/esm/types/components/ActionBar/types.d.ts +3 -0
- package/build/esm/types/components/AsideHeader/__stories__/getAsideHeaderWrapper.d.ts +3 -0
- package/build/esm/types/components/CompositeBar/CompositeBar.d.ts +2 -1
- package/build/esm/types/components/CompositeBar/utils.d.ts +4 -2
- package/build/esm/types/components/index.d.ts +1 -0
- package/build/esm/types/components/types.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.0](https://github.com/gravity-ui/navigation/compare/v0.0.7...v0.1.0) (2022-10-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add ActionBar component ([#19](https://github.com/gravity-ui/navigation/issues/19)) ([595d418](https://github.com/gravity-ui/navigation/commit/595d4189f005615e4ba504cef4689d48fb6a798a))
|
|
9
|
+
* **CompositeBar:** divider item type ([#11](https://github.com/gravity-ui/navigation/issues/11)) ([89f3b85](https://github.com/gravity-ui/navigation/commit/89f3b854ac9348837352809101502a876def8940))
|
|
10
|
+
|
|
3
11
|
## [0.0.7](https://github.com/gravity-ui/navigation/compare/v0.0.6...v0.0.7) (2022-10-11)
|
|
4
12
|
|
|
5
13
|
|
package/build/cjs/index.js
CHANGED
|
@@ -87,6 +87,84 @@ function block(name) {
|
|
|
87
87
|
return _default(`${NAMESPACE}${name}`);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
function styleInject(css, ref) {
|
|
91
|
+
if ( ref === void 0 ) ref = {};
|
|
92
|
+
var insertAt = ref.insertAt;
|
|
93
|
+
|
|
94
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
95
|
+
|
|
96
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
97
|
+
var style = document.createElement('style');
|
|
98
|
+
style.type = 'text/css';
|
|
99
|
+
|
|
100
|
+
if (insertAt === 'top') {
|
|
101
|
+
if (head.firstChild) {
|
|
102
|
+
head.insertBefore(style, head.firstChild);
|
|
103
|
+
} else {
|
|
104
|
+
head.appendChild(style);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
head.appendChild(style);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (style.styleSheet) {
|
|
111
|
+
style.styleSheet.cssText = css;
|
|
112
|
+
} else {
|
|
113
|
+
style.appendChild(document.createTextNode(css));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var css_248z$b = ".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}";
|
|
118
|
+
styleInject(css_248z$b);
|
|
119
|
+
|
|
120
|
+
const b$b = block('action-bar-group');
|
|
121
|
+
const ActionBarGroup = ({ children, className, pull }) => {
|
|
122
|
+
return (React__default["default"].createElement("ul", { className: b$b({ pull }, className), role: "group" }, children));
|
|
123
|
+
};
|
|
124
|
+
ActionBarGroup.displayName = 'ActionBar.Group';
|
|
125
|
+
|
|
126
|
+
var css_248z$a = ".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}";
|
|
127
|
+
styleInject(css_248z$a);
|
|
128
|
+
|
|
129
|
+
const b$a = block('action-bar-item');
|
|
130
|
+
const ActionBarItem = ({ children, className, pull, spacing = true }) => {
|
|
131
|
+
return React__default["default"].createElement("li", { className: b$a({ pull, spacing }, className) }, children);
|
|
132
|
+
};
|
|
133
|
+
ActionBarItem.displayName = 'ActionBar.Item';
|
|
134
|
+
|
|
135
|
+
var css_248z$9 = ".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}";
|
|
136
|
+
styleInject(css_248z$9);
|
|
137
|
+
|
|
138
|
+
const b$9 = block('action-bar-section');
|
|
139
|
+
const ActionBarSection = ({ children, type = 'primary' }) => {
|
|
140
|
+
return React__default["default"].createElement("div", { className: b$9({ type }) }, children);
|
|
141
|
+
};
|
|
142
|
+
ActionBarSection.displayName = 'ActionBar.Section';
|
|
143
|
+
|
|
144
|
+
var css_248z$8 = ".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}";
|
|
145
|
+
styleInject(css_248z$8);
|
|
146
|
+
|
|
147
|
+
const b$8 = block('action-bar-separator');
|
|
148
|
+
const ActionBarSeparator = () => {
|
|
149
|
+
return React__default["default"].createElement("li", { role: "separator", className: b$8() });
|
|
150
|
+
};
|
|
151
|
+
ActionBarSeparator.displayName = 'ActionBar.Separator';
|
|
152
|
+
|
|
153
|
+
var css_248z$7 = ".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}";
|
|
154
|
+
styleInject(css_248z$7);
|
|
155
|
+
|
|
156
|
+
const b$7 = block('action-bar');
|
|
157
|
+
const ActionBar = ({ children, className, 'aria-label': ariaLabel }) => {
|
|
158
|
+
return (React__default["default"].createElement("section", { className: b$7(null, className), "aria-label": ariaLabel }, children));
|
|
159
|
+
};
|
|
160
|
+
ActionBar.displayName = 'ActionBar';
|
|
161
|
+
const PublicActionBar = Object.assign(ActionBar, {
|
|
162
|
+
Section: ActionBarSection,
|
|
163
|
+
Group: ActionBarGroup,
|
|
164
|
+
Item: ActionBarItem,
|
|
165
|
+
Separator: ActionBarSeparator,
|
|
166
|
+
});
|
|
167
|
+
|
|
90
168
|
exports.Dict = void 0;
|
|
91
169
|
(function (Dict) {
|
|
92
170
|
Dict["ExpandButton"] = "button_expand";
|
|
@@ -3113,33 +3191,6 @@ SwitchTransition.defaultProps = {
|
|
|
3113
3191
|
mode: modes.out
|
|
3114
3192
|
};
|
|
3115
3193
|
|
|
3116
|
-
function styleInject(css, ref) {
|
|
3117
|
-
if ( ref === void 0 ) ref = {};
|
|
3118
|
-
var insertAt = ref.insertAt;
|
|
3119
|
-
|
|
3120
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
3121
|
-
|
|
3122
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
3123
|
-
var style = document.createElement('style');
|
|
3124
|
-
style.type = 'text/css';
|
|
3125
|
-
|
|
3126
|
-
if (insertAt === 'top') {
|
|
3127
|
-
if (head.firstChild) {
|
|
3128
|
-
head.insertBefore(style, head.firstChild);
|
|
3129
|
-
} else {
|
|
3130
|
-
head.appendChild(style);
|
|
3131
|
-
}
|
|
3132
|
-
} else {
|
|
3133
|
-
head.appendChild(style);
|
|
3134
|
-
}
|
|
3135
|
-
|
|
3136
|
-
if (style.styleSheet) {
|
|
3137
|
-
style.styleSheet.cssText = css;
|
|
3138
|
-
} else {
|
|
3139
|
-
style.appendChild(document.createTextNode(css));
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
|
|
3143
3194
|
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}";
|
|
3144
3195
|
styleInject(css_248z$6);
|
|
3145
3196
|
|
|
@@ -3749,6 +3800,8 @@ function getItemHeight(item) {
|
|
|
3749
3800
|
switch (item.type) {
|
|
3750
3801
|
case 'action':
|
|
3751
3802
|
return 50;
|
|
3803
|
+
case 'divider':
|
|
3804
|
+
return 15;
|
|
3752
3805
|
default:
|
|
3753
3806
|
return ITEM_HEIGHT;
|
|
3754
3807
|
}
|
|
@@ -3756,10 +3809,31 @@ function getItemHeight(item) {
|
|
|
3756
3809
|
function getItemsHeight(items) {
|
|
3757
3810
|
return items.reduce((sum, item) => sum + getItemHeight(item), 0);
|
|
3758
3811
|
}
|
|
3759
|
-
|
|
3812
|
+
function getSelectedItemIndex(items) {
|
|
3760
3813
|
const index = items.findIndex(({ current }) => Boolean(current));
|
|
3761
3814
|
return index === -1 ? undefined : index;
|
|
3762
|
-
}
|
|
3815
|
+
}
|
|
3816
|
+
function getPinnedItems(items) {
|
|
3817
|
+
const pinnedItems = [];
|
|
3818
|
+
for (const item of items) {
|
|
3819
|
+
if (item.pinned) {
|
|
3820
|
+
pinnedItems.push(item);
|
|
3821
|
+
}
|
|
3822
|
+
else if (item.type === 'divider') {
|
|
3823
|
+
if (pinnedItems.length > 0 && pinnedItems[pinnedItems.length - 1].type !== 'divider') {
|
|
3824
|
+
pinnedItems.push(item);
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
return pinnedItems;
|
|
3829
|
+
}
|
|
3830
|
+
function getItemsMinHeight(items) {
|
|
3831
|
+
const pinnedItems = getPinnedItems(items);
|
|
3832
|
+
const afterMoreButtonItems = items.filter((item) => item.afterMoreButton);
|
|
3833
|
+
return (getItemsHeight(pinnedItems) +
|
|
3834
|
+
getItemsHeight(afterMoreButtonItems) +
|
|
3835
|
+
(pinnedItems.length === items.length ? 0 : ITEM_HEIGHT));
|
|
3836
|
+
}
|
|
3763
3837
|
|
|
3764
3838
|
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}";
|
|
3765
3839
|
styleInject(css_248z$4);
|
|
@@ -3778,7 +3852,7 @@ const ItemTooltip = ({ anchor, text }) => {
|
|
|
3778
3852
|
React__default["default"].createElement("div", { className: b$4('text') }, text)));
|
|
3779
3853
|
};
|
|
3780
3854
|
|
|
3781
|
-
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}";
|
|
3855
|
+
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__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}";
|
|
3782
3856
|
styleInject(css_248z$3);
|
|
3783
3857
|
|
|
3784
3858
|
const b$3 = block('composite-bar-item');
|
|
@@ -3794,6 +3868,9 @@ function renderItemTitle(item) {
|
|
|
3794
3868
|
const defaultPopupPlacement = ['right-end'];
|
|
3795
3869
|
const defaultPopupOffset = [-20, 8];
|
|
3796
3870
|
const Item = ({ item, compact, className, collapseItems, onMouseLeave, onMouseEnter, enableTooltip = true, popupVisible = false, popupAnchor, popupPlacement = defaultPopupPlacement, popupOffset = defaultPopupOffset, renderPopupContent, onClosePopup, }) => {
|
|
3871
|
+
if (item.type === 'divider') {
|
|
3872
|
+
return React__default["default"].createElement("div", { className: b$3('menu-divider') });
|
|
3873
|
+
}
|
|
3797
3874
|
const [tooltipAnchor, setTooltipAnchor] = React__default["default"].useState(null);
|
|
3798
3875
|
const [open, toggleOpen] = React__default["default"].useState(false);
|
|
3799
3876
|
const ref = React__default["default"].useRef(null);
|
|
@@ -3894,14 +3971,13 @@ class CompositeBar extends React__default["default"].Component {
|
|
|
3894
3971
|
}
|
|
3895
3972
|
render() {
|
|
3896
3973
|
const { enableCollapsing, items } = this.props;
|
|
3974
|
+
if (items.length === 0) {
|
|
3975
|
+
return null;
|
|
3976
|
+
}
|
|
3897
3977
|
if (!enableCollapsing) {
|
|
3898
3978
|
return React__default["default"].createElement("div", { className: b$2() }, this.renderMenu());
|
|
3899
3979
|
}
|
|
3900
|
-
const
|
|
3901
|
-
const afterMoreButtonItems = items.filter((item) => item.afterMoreButton);
|
|
3902
|
-
const minHeight = getItemsHeight(pinnedItems) +
|
|
3903
|
-
getItemsHeight(afterMoreButtonItems) +
|
|
3904
|
-
(pinnedItems.length === items.length ? 0 : ITEM_HEIGHT);
|
|
3980
|
+
const minHeight = getItemsMinHeight(items);
|
|
3905
3981
|
return (React__default["default"].createElement("div", { className: b$2({ autosizer: true }), style: { minHeight } }, items.length !== 0 && (React__default["default"].createElement(AutoSizer, null, ({ width, height }) => {
|
|
3906
3982
|
const style = {
|
|
3907
3983
|
width,
|
|
@@ -3911,42 +3987,8 @@ class CompositeBar extends React__default["default"].Component {
|
|
|
3911
3987
|
}))));
|
|
3912
3988
|
}
|
|
3913
3989
|
renderAutosizeMenu(height) {
|
|
3914
|
-
const {
|
|
3915
|
-
const
|
|
3916
|
-
const extraItemHeight = items.reduce((sum, item) => sum + (getItemHeight(item) - ITEM_HEIGHT), afterMoreButtonItems.length * ITEM_HEIGHT);
|
|
3917
|
-
const capacity = Math.max(1, Math.floor((height - extraItemHeight) / ITEM_HEIGHT));
|
|
3918
|
-
let listItems;
|
|
3919
|
-
let collapseItems = [];
|
|
3920
|
-
const regularItems = items.filter((item) => !item.afterMoreButton);
|
|
3921
|
-
if (capacity === 1) {
|
|
3922
|
-
listItems = regularItems.filter((item) => item.pinned);
|
|
3923
|
-
collapseItems = [...regularItems.filter((item) => !item.pinned)];
|
|
3924
|
-
}
|
|
3925
|
-
else if (capacity < items.length) {
|
|
3926
|
-
const extraCount = regularItems.filter((item, idx) => item.pinned && idx >= capacity - 1).length;
|
|
3927
|
-
const pinnedFlag = regularItems.reduceRight((acc, curr, idx) => {
|
|
3928
|
-
const useExtraCount = !curr.pinned && idx < capacity - 1 && acc.extraCount > 0;
|
|
3929
|
-
acc.flags.unshift(curr.pinned || useExtraCount);
|
|
3930
|
-
return {
|
|
3931
|
-
flags: acc.flags,
|
|
3932
|
-
extraCount: acc.extraCount - Number(useExtraCount),
|
|
3933
|
-
};
|
|
3934
|
-
}, { flags: [], extraCount }).flags;
|
|
3935
|
-
listItems = regularItems.filter((item, idx) => item.pinned || (idx < capacity - 1 && !pinnedFlag[idx]));
|
|
3936
|
-
collapseItems = regularItems.filter((item, idx) => !item.pinned && (idx >= capacity - 1 || pinnedFlag[idx]));
|
|
3937
|
-
}
|
|
3938
|
-
else {
|
|
3939
|
-
listItems = [...regularItems];
|
|
3940
|
-
}
|
|
3941
|
-
if ((collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) === 1) {
|
|
3942
|
-
listItems = listItems.concat(collapseItems);
|
|
3943
|
-
}
|
|
3944
|
-
else if ((collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) > 1) {
|
|
3945
|
-
listItems.push(this.getMoreButtonItem(dict));
|
|
3946
|
-
}
|
|
3947
|
-
if (afterMoreButtonItems.length) {
|
|
3948
|
-
listItems = listItems.concat(afterMoreButtonItems);
|
|
3949
|
-
}
|
|
3990
|
+
const { compact, onItemClick } = this.props;
|
|
3991
|
+
const { listItems, collapseItems } = this.getAutosizeListItems(height);
|
|
3950
3992
|
return (React__default["default"].createElement(uikit.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["default"].createElement(Item, { item: item, onMouseLeave: () => {
|
|
3951
3993
|
var _a;
|
|
3952
3994
|
if (compact) {
|
|
@@ -3963,8 +4005,9 @@ class CompositeBar extends React__default["default"].Component {
|
|
|
3963
4005
|
}
|
|
3964
4006
|
}, compact: compact })) }));
|
|
3965
4007
|
}
|
|
3966
|
-
getMoreButtonItem(
|
|
4008
|
+
getMoreButtonItem() {
|
|
3967
4009
|
var _a;
|
|
4010
|
+
const { dict } = this.props;
|
|
3968
4011
|
const title = (_a = dict === null || dict === void 0 ? void 0 : dict[exports.Dict.MoreButton]) !== null && _a !== void 0 ? _a : defaultDict[exports.Dict.MoreButton];
|
|
3969
4012
|
return {
|
|
3970
4013
|
id: COLLAPSE_ITEM_ID,
|
|
@@ -3973,6 +4016,46 @@ class CompositeBar extends React__default["default"].Component {
|
|
|
3973
4016
|
iconSize: 16,
|
|
3974
4017
|
};
|
|
3975
4018
|
}
|
|
4019
|
+
getAutosizeListItems(height) {
|
|
4020
|
+
const { items } = this.props;
|
|
4021
|
+
const afterMoreButtonItems = items.filter((item) => item.afterMoreButton);
|
|
4022
|
+
const regularItems = items.filter((item) => !item.afterMoreButton);
|
|
4023
|
+
const listItems = [...regularItems, ...afterMoreButtonItems];
|
|
4024
|
+
const allItemsHeight = getItemsHeight(listItems);
|
|
4025
|
+
if (allItemsHeight <= height) {
|
|
4026
|
+
return { listItems, collapseItems: [] };
|
|
4027
|
+
}
|
|
4028
|
+
const collapseItem = this.getMoreButtonItem();
|
|
4029
|
+
const collapseItemHeight = getItemHeight(collapseItem);
|
|
4030
|
+
listItems.splice(regularItems.length, 0, collapseItem);
|
|
4031
|
+
const collapseItems = [];
|
|
4032
|
+
let listHeight = allItemsHeight + collapseItemHeight;
|
|
4033
|
+
let index = listItems.length;
|
|
4034
|
+
while (listHeight > height) {
|
|
4035
|
+
if (index === 0) {
|
|
4036
|
+
break;
|
|
4037
|
+
}
|
|
4038
|
+
index--;
|
|
4039
|
+
const item = listItems[index];
|
|
4040
|
+
if (item.pinned || item.id === COLLAPSE_ITEM_ID || item.afterMoreButton) {
|
|
4041
|
+
continue;
|
|
4042
|
+
}
|
|
4043
|
+
if (item.type === 'divider') {
|
|
4044
|
+
if (index + 1 < listItems.length && listItems[index + 1].type === 'divider') {
|
|
4045
|
+
listHeight -= getItemHeight(item);
|
|
4046
|
+
listItems.splice(index, 1);
|
|
4047
|
+
}
|
|
4048
|
+
continue;
|
|
4049
|
+
}
|
|
4050
|
+
listHeight -= getItemHeight(item);
|
|
4051
|
+
collapseItems.unshift(...listItems.splice(index, 1));
|
|
4052
|
+
}
|
|
4053
|
+
if (listItems[index].type === 'divider' &&
|
|
4054
|
+
(index === 0 || listItems[index - 1].type === 'divider')) {
|
|
4055
|
+
listItems.splice(index, 1);
|
|
4056
|
+
}
|
|
4057
|
+
return { listItems, collapseItems };
|
|
4058
|
+
}
|
|
3976
4059
|
}
|
|
3977
4060
|
|
|
3978
4061
|
/* Used by renderContent AsideHeader prop */
|
|
@@ -4016,7 +4099,7 @@ var SvgDividerCollapsed = function SvgDividerCollapsed(props) {
|
|
|
4016
4099
|
})));
|
|
4017
4100
|
};
|
|
4018
4101
|
|
|
4019
|
-
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}";
|
|
4102
|
+
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 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}";
|
|
4020
4103
|
styleInject(css_248z$1);
|
|
4021
4104
|
|
|
4022
4105
|
const b$1 = block('aside-header');
|
|
@@ -4140,6 +4223,7 @@ const FooterItem = (_a) => {
|
|
|
4140
4223
|
return (React__default["default"].createElement(Item, Object.assign({}, props, { item: Object.assign({ iconSize: ASIDE_HEADER_FOOTER_ICON_SIZE }, item), className: b({ compact: props.compact }) })));
|
|
4141
4224
|
};
|
|
4142
4225
|
|
|
4226
|
+
exports.ActionBar = PublicActionBar;
|
|
4143
4227
|
exports.AsideHeader = AsideHeader;
|
|
4144
4228
|
exports.Drawer = Drawer;
|
|
4145
4229
|
exports.DrawerItem = DrawerItem;
|