@gravity-ui/navigation 3.2.1 → 3.3.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/build/cjs/components/Settings/SettingsSearch/AllResultsPage.d.ts +8 -0
- package/build/cjs/components/Settings/SettingsSearch/SettingsSearch.d.ts +3 -1
- package/build/cjs/components/Settings/collect-settings.d.ts +3 -4
- package/build/cjs/components/Settings/i18n/index.d.ts +2 -2
- package/build/cjs/{index-Chqso-oJ.js → index-9bMDuiin.js} +167 -48
- package/build/cjs/index-9bMDuiin.js.map +1 -0
- package/build/cjs/{index-CJmG1jdh.js → index-BsT7DcU0.js} +2 -2
- package/build/cjs/{index-CJmG1jdh.js.map → index-BsT7DcU0.js.map} +1 -1
- package/build/cjs/index.js +1 -1
- package/build/esm/components/Settings/SettingsSearch/AllResultsPage.d.ts +8 -0
- package/build/esm/components/Settings/SettingsSearch/SettingsSearch.d.ts +3 -1
- package/build/esm/components/Settings/collect-settings.d.ts +3 -4
- package/build/esm/components/Settings/i18n/index.d.ts +2 -2
- package/build/esm/{index-D8I2X2cn.js → index-BSHHbfgh.js} +168 -49
- package/build/esm/index-BSHHbfgh.js.map +1 -0
- package/build/esm/{index-Dwqi8qed.js → index-KqwJsh5S.js} +2 -2
- package/build/esm/{index-Dwqi8qed.js.map → index-KqwJsh5S.js.map} +1 -1
- package/build/esm/index.js +1 -1
- package/package.json +1 -1
- package/build/cjs/index-Chqso-oJ.js.map +0 -1
- package/build/esm/index-D8I2X2cn.js.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SettingsDescription } from '../collect-settings';
|
|
2
|
+
export declare function useAllResultsPage({ pages, handlePageChange, }: {
|
|
3
|
+
pages: SettingsDescription['pages'];
|
|
4
|
+
handlePageChange: (page: string | undefined) => void;
|
|
5
|
+
}): {
|
|
6
|
+
isAllSearchPage: (page: string | undefined) => page is "allSearchResults";
|
|
7
|
+
};
|
|
8
|
+
export declare function getSettingsDescriptionWithAllResultsPage(settingsDescription: SettingsDescription): SettingsDescription;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextInputSize } from '@gravity-ui/uikit';
|
|
3
|
+
import { SettingsSelection } from '../Selection/types';
|
|
3
4
|
interface SettingsSearchProps {
|
|
4
5
|
className?: string;
|
|
5
6
|
initialValue?: string;
|
|
@@ -9,6 +10,7 @@ interface SettingsSearchProps {
|
|
|
9
10
|
inputSize?: TextInputSize;
|
|
10
11
|
placeholder?: string;
|
|
11
12
|
autoFocus?: boolean;
|
|
13
|
+
selection?: SettingsSelection;
|
|
12
14
|
}
|
|
13
|
-
export declare function SettingsSearch({ className, initialValue, onChange, debounce, inputRef, inputSize, placeholder, autoFocus, }: SettingsSearchProps): React.JSX.Element;
|
|
15
|
+
export declare function SettingsSearch({ className, initialValue, onChange, debounce, inputRef, inputSize, placeholder, autoFocus, selection, }: SettingsSearchProps): React.JSX.Element;
|
|
14
16
|
export {};
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { IconProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { SettingsSelection } from './Selection/types';
|
|
4
4
|
export type SettingsMenu = (SettingsMenuGroup | SettingsMenuItem)[];
|
|
5
|
-
interface SettingsMenuGroup {
|
|
5
|
+
export interface SettingsMenuGroup {
|
|
6
6
|
groupTitle: string;
|
|
7
7
|
items: SettingsMenuItem[];
|
|
8
8
|
}
|
|
9
|
-
interface SettingsMenuItem {
|
|
9
|
+
export interface SettingsMenuItem {
|
|
10
10
|
id: string;
|
|
11
11
|
title: string;
|
|
12
12
|
icon?: IconProps;
|
|
@@ -41,10 +41,9 @@ export interface SelectedSettingsPart {
|
|
|
41
41
|
section?: SettingsPageSection;
|
|
42
42
|
setting?: SettingsItem;
|
|
43
43
|
}
|
|
44
|
-
interface SettingsDescription {
|
|
44
|
+
export interface SettingsDescription {
|
|
45
45
|
menu: SettingsMenu;
|
|
46
46
|
pages: Record<string, SettingsPage>;
|
|
47
47
|
}
|
|
48
48
|
export declare function getSettingsFromChildren(children: React.ReactNode, searchText?: string): SettingsDescription;
|
|
49
49
|
export declare function getSelectedSettingsPart(pages: Record<string, SettingsPage>, selection: SettingsSelection): SelectedSettingsPart;
|
|
50
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const _default: ((key: "label_title" | "label_filter-placeholder" | "label_empty-placeholder" | "label_search", params?: import("@gravity-ui/i18n").Params) => string) & {
|
|
1
|
+
declare const _default: ((key: "label_title" | "label_filter-placeholder" | "label_empty-placeholder" | "label_search" | "label_all-results", params?: import("@gravity-ui/i18n").Params) => string) & {
|
|
2
2
|
keysetData: {
|
|
3
|
-
"gn-Settings": Record<"label_title" | "label_filter-placeholder" | "label_empty-placeholder" | "label_search", import("@gravity-ui/i18n").KeyData>;
|
|
3
|
+
"gn-Settings": Record<"label_title" | "label_filter-placeholder" | "label_empty-placeholder" | "label_search" | "label_all-results", import("@gravity-ui/i18n").KeyData>;
|
|
4
4
|
};
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
@@ -140,7 +140,7 @@ function styleInject(css, ref) {
|
|
|
140
140
|
var css_248z$u = ".g-root{--gn-aside-top-panel-height:0px}.gn-aside-header{--gn-aside-header-min-width:56px;--_--item-icon-background-size:38px;--_--background-color:var(--g-color-base-background);--_--decoration-collapsed-background-color:var(--g-color-base-warning-light);--_--decoration-expanded-background-color:var(--g-color-base-warning-light);--_--vertical-divider-line-color:var(--g-color-line-generic);--_--horizontal-divider-line-color:var(--g-color-line-generic);background-color:var(--g-color-base-background);height:100%;position:relative;width:100%}.gn-aside-header__aside{background-color:var(--gn-aside-header-expanded-background-color,var(--gn-aside-header-background-color,var(--_--background-color)));box-sizing:border-box;display:flex;flex-direction:column;height:100vh;left:0;margin-top:var(--gn-top-alert-height,0);max-height:calc(100vh - var(--gn-top-alert-height, 0));position:sticky;top:var(--gn-top-alert-height,0);width:inherit;z-index:var(--gn-aside-header-z-index,100)}.gn-aside-header__aside:after{background-color:var(--gn-aside-header-divider-vertical-color,var(--_--vertical-divider-line-color));content:\"\";height:100%;position:absolute;right:0;top:0;width:1px;z-index:2}.gn-aside-header__aside-popup-anchor{inset:0;position:absolute;z-index:1}.gn-aside-header__aside-content{--gradient-height:334px;display:flex;flex-direction:column;height:inherit;overflow-x:hidden;padding-top:var(--gn-aside-header-padding-top);position:relative;user-select:none;width:inherit;z-index:2}.gn-aside-header__aside-content>.gn-aside-header-logo{margin:8px 0}.gn-aside-header__aside-content_with-decoration{background:linear-gradient(180deg,var(--gn-aside-header-decoration-expanded-background-color,var(--_--decoration-expanded-background-color)) calc(var(--gradient-height)*.33),transparent calc(var(--gradient-height)*.88))}.gn-aside-header__aside-custom-background{bottom:0;display:flex;position:absolute;top:0;width:var(--gn-aside-header-size);z-index:-1}.gn-aside-header_compact .gn-aside-header__aside{background-color:var(--gn-aside-header-collapsed-background-color,var(--gn-aside-header-background-color,var(--_--background-color)))}.gn-aside-header_compact .gn-aside-header__aside-content{background:transparent}.gn-aside-header__header{--gn-aside-header-header-divider-height:29px;box-sizing:border-box;flex:none;padding-bottom:22px;padding-top:8px;position:relative;width:100%;z-index:1}.gn-aside-header__header .gn-aside-header__header-divider{bottom:0;color:var(--gn-aside-header-decoration-collapsed-background-color,var(--_--decoration-collapsed-background-color));display:none;left:0;position:absolute;z-index:-2}.gn-aside-header__header_with-decoration:before{background-color:var(--gn-aside-header-decoration-collapsed-background-color,var(--_--decoration-collapsed-background-color));content:\"\";display:none;height:calc(100% - var(--gn-aside-header-header-divider-height));left:0;position:absolute;top:0;width:100%;z-index:-2}.gn-aside-header__header:after{background-color:var(--gn-aside-header-divider-horizontal-color,var(--_--horizontal-divider-line-color));bottom:12px;content:\"\";height:1px;left:0;position:absolute;width:100%;z-index:-2}.gn-aside-header_compact .gn-aside-header__header:before,.gn-aside-header_compact .gn-aside-header__header_with-decoration .gn-aside-header__header-divider{display:block}.gn-aside-header_compact .gn-aside-header__header_with-decoration:after{display:none}.gn-aside-header__logo-button .gn-aside-header__logo-icon-place{height:var(--gn-aside-header-item-icon-background-size,var(--_--item-icon-background-size));width:var(--gn-aside-header-min-width)}.gn-aside-header__menu-items{flex-grow:1}.gn-aside-header__footer{display:flex;flex-direction:column;flex-shrink:0;margin:8px 0;width:100%}.gn-aside-header__panels{inset:var(--gn-top-alert-height,0) 0 0;max-height:calc(100vh - var(--gn-top-alert-height, 0));overflow:auto;position:fixed;z-index:var(--gn-aside-header-panel-z-index,98)}.gn-aside-header__panel{height:100%}.gn-aside-header__pane-container{display:flex;flex-direction:row;outline:none;overflow:visible;user-select:text}.gn-aside-header__top-alert{background:var(--g-color-base-background);position:fixed;top:0;width:100%;z-index:var(--gn-aside-header-pane-top-z-index,98)}.gn-aside-header__content{margin-top:var(--gn-top-alert-height,0);width:calc(100% - var(--gn-aside-header-size));z-index:var(--gn-aside-header-content-z-index,95)}";
|
|
141
141
|
styleInject(css_248z$u);
|
|
142
142
|
|
|
143
|
-
const TopAlert$1 = React.lazy(() => Promise.resolve().then(function () { return require('./index-
|
|
143
|
+
const TopAlert$1 = React.lazy(() => Promise.resolve().then(function () { return require('./index-BsT7DcU0.js'); }).then((module) => ({ default: module.TopAlert })));
|
|
144
144
|
const Layout = ({ compact, className, children, topAlert }) => {
|
|
145
145
|
const size = compact ? ASIDE_HEADER_COMPACT_WIDTH : ASIDE_HEADER_EXPANDED_WIDTH;
|
|
146
146
|
const asideHeaderContextValue = React.useMemo(() => ({ size, compact }), [compact, size]);
|
|
@@ -4694,6 +4694,123 @@ function HotkeysPanel(_a) {
|
|
|
4694
4694
|
React.createElement(DrawerItem, { id: "hotkeys", visible: visible, className: b$e('drawer-item', drawerItemClassName), content: drawerItemContent })));
|
|
4695
4695
|
}
|
|
4696
4696
|
|
|
4697
|
+
/**
|
|
4698
|
+
* Gets the last element of `array`.
|
|
4699
|
+
*
|
|
4700
|
+
* @static
|
|
4701
|
+
* @memberOf _
|
|
4702
|
+
* @since 0.1.0
|
|
4703
|
+
* @category Array
|
|
4704
|
+
* @param {Array} array The array to query.
|
|
4705
|
+
* @returns {*} Returns the last element of `array`.
|
|
4706
|
+
* @example
|
|
4707
|
+
*
|
|
4708
|
+
* _.last([1, 2, 3]);
|
|
4709
|
+
* // => 3
|
|
4710
|
+
*/
|
|
4711
|
+
|
|
4712
|
+
var last_1;
|
|
4713
|
+
var hasRequiredLast;
|
|
4714
|
+
|
|
4715
|
+
function requireLast () {
|
|
4716
|
+
if (hasRequiredLast) return last_1;
|
|
4717
|
+
hasRequiredLast = 1;
|
|
4718
|
+
function last(array) {
|
|
4719
|
+
var length = array == null ? 0 : array.length;
|
|
4720
|
+
return length ? array[length - 1] : undefined;
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4723
|
+
last_1 = last;
|
|
4724
|
+
return last_1;
|
|
4725
|
+
}
|
|
4726
|
+
|
|
4727
|
+
var lastExports = requireLast();
|
|
4728
|
+
var last = /*@__PURE__*/getDefaultExportFromCjs(lastExports);
|
|
4729
|
+
|
|
4730
|
+
var label_title$1 = "Settings";
|
|
4731
|
+
var label_search$1 = "Search";
|
|
4732
|
+
var en$1 = {
|
|
4733
|
+
label_title: label_title$1,
|
|
4734
|
+
"label_filter-placeholder": "Search settings",
|
|
4735
|
+
"label_empty-placeholder": "No results found",
|
|
4736
|
+
label_search: label_search$1,
|
|
4737
|
+
"label_all-results": "All results"
|
|
4738
|
+
};
|
|
4739
|
+
|
|
4740
|
+
var label_title = "Настройки";
|
|
4741
|
+
var label_search = "Поиск";
|
|
4742
|
+
var ru$1 = {
|
|
4743
|
+
label_title: label_title,
|
|
4744
|
+
"label_filter-placeholder": "Найти настройки",
|
|
4745
|
+
"label_empty-placeholder": "Ничего не найдено",
|
|
4746
|
+
label_search: label_search,
|
|
4747
|
+
"label_all-results": "Все результаты"
|
|
4748
|
+
};
|
|
4749
|
+
|
|
4750
|
+
const COMPONENT$1 = 'Settings';
|
|
4751
|
+
var i18n$1 = i18n$5.addComponentKeysets({ en: en$1, ru: ru$1 }, `${NAMESPACE}${COMPONENT$1}`);
|
|
4752
|
+
|
|
4753
|
+
const allSearchResultsId = 'allSearchResults';
|
|
4754
|
+
const allSearchResultsLabel = i18n$1('label_all-results');
|
|
4755
|
+
function useAllResultsPage({ pages, handlePageChange, }) {
|
|
4756
|
+
const allSearchResultsPage = pages[allSearchResultsId];
|
|
4757
|
+
const hasAllSearchResultsPage = Boolean(allSearchResultsPage);
|
|
4758
|
+
React.useEffect(() => {
|
|
4759
|
+
if (hasAllSearchResultsPage) {
|
|
4760
|
+
handlePageChange(allSearchResultsId);
|
|
4761
|
+
}
|
|
4762
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4763
|
+
}, [hasAllSearchResultsPage]);
|
|
4764
|
+
return {
|
|
4765
|
+
isAllSearchPage: (page) => page === allSearchResultsId,
|
|
4766
|
+
};
|
|
4767
|
+
}
|
|
4768
|
+
function getSettingsDescriptionWithAllResultsPage(settingsDescription) {
|
|
4769
|
+
const { menu, pages } = settingsDescription;
|
|
4770
|
+
const menuWithoutAllResults = getMenuWithoutAllResults(menu);
|
|
4771
|
+
const pagesList = Object.values(pages);
|
|
4772
|
+
return Object.assign(Object.assign({}, settingsDescription), { menu: [createAllResultsMenuItem(), ...menuWithoutAllResults], pages: Object.assign(Object.assign({}, pages), { [allSearchResultsId]: createAllResultsPage(pagesList, menuWithoutAllResults) }) });
|
|
4773
|
+
}
|
|
4774
|
+
function getMenuWithoutAllResults(menu) {
|
|
4775
|
+
return menu.filter((item) => !('id' in item) || item.id !== allSearchResultsId);
|
|
4776
|
+
}
|
|
4777
|
+
function createAllResultsPage(pages, menu) {
|
|
4778
|
+
const breadcrumbsMap = {};
|
|
4779
|
+
for (const menuItem of menu) {
|
|
4780
|
+
if ('items' in menuItem) {
|
|
4781
|
+
for (const pageItem of menuItem.items) {
|
|
4782
|
+
breadcrumbsMap[pageItem.id] = [menuItem.groupTitle, pageItem.title];
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
else {
|
|
4786
|
+
breadcrumbsMap[menuItem.id] = [menuItem.title];
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
return {
|
|
4790
|
+
id: allSearchResultsId,
|
|
4791
|
+
sections: Object.values(pages)
|
|
4792
|
+
.map((page) => {
|
|
4793
|
+
return page.sections.map((section) => {
|
|
4794
|
+
var _a;
|
|
4795
|
+
const breadcrumbs = (_a = breadcrumbsMap[page.id]) !== null && _a !== undefined ? _a : [];
|
|
4796
|
+
const lastBreadcrumb = last(breadcrumbs);
|
|
4797
|
+
const breadcrumbsTitlePart = breadcrumbs.join(' / ');
|
|
4798
|
+
return Object.assign(Object.assign({}, section), { title: section.title === lastBreadcrumb
|
|
4799
|
+
? breadcrumbsTitlePart
|
|
4800
|
+
: `${breadcrumbsTitlePart} / ${section.title}` });
|
|
4801
|
+
});
|
|
4802
|
+
})
|
|
4803
|
+
.flat(),
|
|
4804
|
+
};
|
|
4805
|
+
}
|
|
4806
|
+
function createAllResultsMenuItem() {
|
|
4807
|
+
return {
|
|
4808
|
+
id: allSearchResultsId,
|
|
4809
|
+
title: allSearchResultsLabel,
|
|
4810
|
+
icon: { data: icons.ListUl },
|
|
4811
|
+
};
|
|
4812
|
+
}
|
|
4813
|
+
|
|
4697
4814
|
function useStableCallback(func) {
|
|
4698
4815
|
const funcRef = React__namespace.useRef();
|
|
4699
4816
|
React__namespace.useEffect(() => {
|
|
@@ -4727,7 +4844,13 @@ function getSettingsFromChildren(children, searchText = '') {
|
|
|
4727
4844
|
// 'abc def fg' -> abc.*?cde.*?fg
|
|
4728
4845
|
const preparedFilter = escapeStringForRegExp(searchText).replace(/\s+/g, '.*?');
|
|
4729
4846
|
const filterRe = new RegExp(preparedFilter, 'i');
|
|
4730
|
-
|
|
4847
|
+
const result = getSettingsFromChildrenRecursive(children, '', filterRe);
|
|
4848
|
+
if (Boolean(preparedFilter) && result.menu.length > 0) {
|
|
4849
|
+
return getSettingsDescriptionWithAllResultsPage(result);
|
|
4850
|
+
}
|
|
4851
|
+
else {
|
|
4852
|
+
return result;
|
|
4853
|
+
}
|
|
4731
4854
|
}
|
|
4732
4855
|
function getSettingsFromChildrenRecursive(children, basepath = '', filterRe) {
|
|
4733
4856
|
const menu = [];
|
|
@@ -4757,11 +4880,13 @@ function getSettingsFromChildrenRecursive(children, basepath = '', filterRe) {
|
|
|
4757
4880
|
const hasInnerGroup = menuFragment.some((item) => 'groupTitle' in item);
|
|
4758
4881
|
invariant(!hasInnerGroup, `Group ${element.props.groupTitle} should not include groups`);
|
|
4759
4882
|
}
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4883
|
+
if (menuFragment.length > 0) {
|
|
4884
|
+
menu.push({
|
|
4885
|
+
groupTitle: element.props.groupTitle,
|
|
4886
|
+
// @ts-ignore
|
|
4887
|
+
items: menuFragment,
|
|
4888
|
+
});
|
|
4889
|
+
}
|
|
4765
4890
|
Object.assign(pages, pagesFragment);
|
|
4766
4891
|
}
|
|
4767
4892
|
else {
|
|
@@ -4774,13 +4899,15 @@ function getSettingsFromChildrenRecursive(children, basepath = '', filterRe) {
|
|
|
4774
4899
|
}
|
|
4775
4900
|
pages[pageId] = getSettingsPageFromChildren(element.props.children, filterRe);
|
|
4776
4901
|
pages[pageId].id = pageId;
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4902
|
+
if (!pages[pageId].hidden) {
|
|
4903
|
+
menu.push({
|
|
4904
|
+
id: pageId,
|
|
4905
|
+
title: element.props.title,
|
|
4906
|
+
icon: element.props.icon,
|
|
4907
|
+
withBadge: pages[pageId].withBadge,
|
|
4908
|
+
disabled: pages[pageId].hidden,
|
|
4909
|
+
});
|
|
4910
|
+
}
|
|
4784
4911
|
}
|
|
4785
4912
|
});
|
|
4786
4913
|
return { menu, pages };
|
|
@@ -4931,7 +5058,7 @@ function isSectionSelected(selected, pageId, section) {
|
|
|
4931
5058
|
}
|
|
4932
5059
|
}
|
|
4933
5060
|
|
|
4934
|
-
var css_248z$c = ".gn-settings-menu__group-heading{display:inline-block;font-weight:var(--g-text-accent-font-weight);line-height:18px;margin-bottom:12px;padding:0 20px}.gn-settings-menu__group+.gn-settings-menu__group{margin-top:24px}.gn-settings-menu__item{align-items:center;color:var(--g-color-text-primary);cursor:pointer;display:flex;height:40px;padding:0 20px}.gn-settings-menu__item-icon{color:var(--g-color-text-misc);margin-right:5px}.gn-settings-menu__item:hover,.gn-settings-menu__item_focused{background:var(--g-color-base-simple-hover)}.gn-settings-menu__item_selected{background:var(--g-color-base-selection)}.gn-settings-menu__item_selected.gn-settings-menu__item_focused,.gn-settings-menu__item_selected:hover{background:var(--g-color-base-selection-hover)}.gn-settings-menu__item_disabled{color:var(--g-color-text-secondary);cursor:auto}.gn-settings-menu__item_disabled:hover{background:none}.gn-settings-menu__item_disabled .gn-settings-menu__item-icon{color:var(--g-color-base-misc-heavy)}.gn-settings-menu__item_badge{position:relative}.gn-settings-menu__item_badge:after{background-color:var(--g-color-text-danger);border-radius:50%;content:\"\";display:block;height:6px;position:absolute;right:9px;top:calc(50% - 3px);width:6px}";
|
|
5061
|
+
var css_248z$c = ".gn-settings-menu__group-heading{display:inline-block;font-weight:var(--g-text-accent-font-weight);line-height:18px;margin-bottom:12px;padding:0 20px}.gn-settings-menu__group+.gn-settings-menu__group{margin-top:24px}.gn-settings-menu__item+.gn-settings-menu__group{margin-top:8px}.gn-settings-menu__item{align-items:center;color:var(--g-color-text-primary);cursor:pointer;display:flex;height:40px;padding:0 20px}.gn-settings-menu__item-icon{color:var(--g-color-text-misc);margin-right:5px}.gn-settings-menu__item:hover,.gn-settings-menu__item_focused{background:var(--g-color-base-simple-hover)}.gn-settings-menu__item_selected{background:var(--g-color-base-selection)}.gn-settings-menu__item_selected.gn-settings-menu__item_focused,.gn-settings-menu__item_selected:hover{background:var(--g-color-base-selection-hover)}.gn-settings-menu__item_disabled{color:var(--g-color-text-secondary);cursor:auto}.gn-settings-menu__item_disabled:hover{background:none}.gn-settings-menu__item_disabled .gn-settings-menu__item-icon{color:var(--g-color-base-misc-heavy)}.gn-settings-menu__item_badge{position:relative}.gn-settings-menu__item_badge:after{background-color:var(--g-color-text-danger);border-radius:50%;content:\"\";display:block;height:6px;position:absolute;right:9px;top:calc(50% - 3px);width:6px}";
|
|
4935
5062
|
styleInject(css_248z$c);
|
|
4936
5063
|
|
|
4937
5064
|
const b$d = block('settings-menu');
|
|
@@ -5036,35 +5163,23 @@ const SettingsMenuMobile = ({ items, onChange, activeItemId, className, }) => {
|
|
|
5036
5163
|
React.createElement(legacy.Tabs, { items: tabItems, className: b$c(null, className), size: "l", activeTab: activeItemId, onSelectTab: onChange })));
|
|
5037
5164
|
};
|
|
5038
5165
|
|
|
5039
|
-
var label_title$1 = "Settings";
|
|
5040
|
-
var label_search$1 = "Search";
|
|
5041
|
-
var en$1 = {
|
|
5042
|
-
label_title: label_title$1,
|
|
5043
|
-
"label_filter-placeholder": "Search settings",
|
|
5044
|
-
"label_empty-placeholder": "No results found",
|
|
5045
|
-
label_search: label_search$1
|
|
5046
|
-
};
|
|
5047
|
-
|
|
5048
|
-
var label_title = "Настройки";
|
|
5049
|
-
var label_search = "Поиск";
|
|
5050
|
-
var ru$1 = {
|
|
5051
|
-
label_title: label_title,
|
|
5052
|
-
"label_filter-placeholder": "Найти настройки",
|
|
5053
|
-
"label_empty-placeholder": "Ничего не найдено",
|
|
5054
|
-
label_search: label_search
|
|
5055
|
-
};
|
|
5056
|
-
|
|
5057
|
-
const COMPONENT$1 = 'Settings';
|
|
5058
|
-
var i18n$1 = i18n$5.addComponentKeysets({ en: en$1, ru: ru$1 }, `${NAMESPACE}${COMPONENT$1}`);
|
|
5059
|
-
|
|
5060
5166
|
const b$b = block('settings-search');
|
|
5061
|
-
function SettingsSearch({ className, initialValue, onChange, debounce = 200, inputRef, inputSize, placeholder, autoFocus = true, }) {
|
|
5167
|
+
function SettingsSearch({ className, initialValue, onChange, debounce = 200, inputRef, inputSize, placeholder, autoFocus = true, selection, }) {
|
|
5062
5168
|
const [value, setValue] = React.useState(initialValue !== null && initialValue !== undefined ? initialValue : '');
|
|
5063
|
-
const onChangeDebounced =
|
|
5169
|
+
const onChangeDebounced = debounceFn(onChange, debounce);
|
|
5064
5170
|
const handleUpdate = useStableCallback((updated) => {
|
|
5065
5171
|
setValue(updated);
|
|
5066
5172
|
onChangeDebounced(updated);
|
|
5067
5173
|
});
|
|
5174
|
+
React.useEffect(() => {
|
|
5175
|
+
if (value && selection) {
|
|
5176
|
+
onChangeDebounced.cancel();
|
|
5177
|
+
setValue('');
|
|
5178
|
+
onChange('');
|
|
5179
|
+
}
|
|
5180
|
+
// Remove any search, if selection is passed
|
|
5181
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5182
|
+
}, [selection]);
|
|
5068
5183
|
return (React.createElement("div", { className: b$b(null, className) },
|
|
5069
5184
|
React.createElement(uikit.TextInput, { value: value, controlRef: inputRef, hasClear: true, autoFocus: autoFocus, size: inputSize, placeholder: placeholder, onUpdate: handleUpdate, controlProps: {
|
|
5070
5185
|
'aria-label': i18n$1('label_search'),
|
|
@@ -5098,7 +5213,7 @@ const getPageTitleById = (menu, activePage) => {
|
|
|
5098
5213
|
return '';
|
|
5099
5214
|
};
|
|
5100
5215
|
function SettingsContent({ initialPage, initialSearch, selection, children, renderNotFound, title = i18n$1('label_title'), filterPlaceholder = i18n$1('label_filter-placeholder'), emptyPlaceholder = i18n$1('label_empty-placeholder'), view, onPageChange, onClose, }) {
|
|
5101
|
-
var _a
|
|
5216
|
+
var _a;
|
|
5102
5217
|
const { renderSectionRightAdornment, showRightAdornmentOnHover } = useSettingsContext();
|
|
5103
5218
|
const [search, setSearch] = React.useState(initialSearch !== null && initialSearch !== undefined ? initialSearch : '');
|
|
5104
5219
|
const { menu, pages } = getSettingsFromChildren(children, search);
|
|
@@ -5125,17 +5240,21 @@ function SettingsContent({ initialPage, initialSearch, selection, children, rend
|
|
|
5125
5240
|
};
|
|
5126
5241
|
}, []);
|
|
5127
5242
|
let activePage = selectedPage;
|
|
5128
|
-
if (!activePage ||
|
|
5129
|
-
activePage = (
|
|
5243
|
+
if (!activePage || !pages[activePage] || pages[activePage].hidden) {
|
|
5244
|
+
activePage = (_a = Object.values(pages).find(({ hidden }) => !hidden)) === null || _a === undefined ? undefined : _a.id;
|
|
5130
5245
|
}
|
|
5131
5246
|
const handlePageChange = (newPage) => {
|
|
5132
5247
|
setCurrentPage((prevPage) => {
|
|
5133
|
-
if (prevPage !== newPage) {
|
|
5248
|
+
if (prevPage !== newPage && !isFakePage(newPage)) {
|
|
5134
5249
|
onPageChange === null || onPageChange === undefined ? undefined : onPageChange(newPage);
|
|
5135
5250
|
}
|
|
5136
5251
|
return newPage;
|
|
5137
5252
|
});
|
|
5138
5253
|
};
|
|
5254
|
+
const { isAllSearchPage } = useAllResultsPage({ pages, handlePageChange });
|
|
5255
|
+
function isFakePage(page) {
|
|
5256
|
+
return isAllSearchPage(page);
|
|
5257
|
+
}
|
|
5139
5258
|
React.useEffect(() => {
|
|
5140
5259
|
if (activePage !== selectedPage) {
|
|
5141
5260
|
handlePageChange(activePage);
|
|
@@ -5179,7 +5298,7 @@ function SettingsContent({ initialPage, initialSearch, selection, children, rend
|
|
|
5179
5298
|
return (React.createElement(SettingsSelectionContextProvider, { value: selected },
|
|
5180
5299
|
React.createElement("div", { className: b$a({ view }) },
|
|
5181
5300
|
isMobile ? (React.createElement(React.Fragment, null,
|
|
5182
|
-
React.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$a('search'), initialValue: initialSearch, onChange: setSearch, autoFocus: false, inputSize: 'xl' }),
|
|
5301
|
+
React.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$a('search'), initialValue: initialSearch, selection: selection, onChange: setSearch, autoFocus: false, inputSize: 'xl' }),
|
|
5183
5302
|
React.createElement(SettingsMenuMobile, { items: menu, onChange: handlePageChange, activeItemId: activePage, className: b$a('tabs') }))) : (React.createElement("div", { className: b$a('menu'), onClick: () => {
|
|
5184
5303
|
if (searchInputRef.current) {
|
|
5185
5304
|
searchInputRef.current.focus();
|
|
@@ -5192,7 +5311,7 @@ function SettingsContent({ initialPage, initialSearch, selection, children, rend
|
|
|
5192
5311
|
}
|
|
5193
5312
|
} },
|
|
5194
5313
|
React.createElement(Title, null, title),
|
|
5195
|
-
React.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$a('search'), initialValue: initialSearch, onChange: setSearch, placeholder: filterPlaceholder, autoFocus: true }),
|
|
5314
|
+
React.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$a('search'), initialValue: initialSearch, selection: selection, onChange: setSearch, placeholder: filterPlaceholder, autoFocus: true }),
|
|
5196
5315
|
React.createElement(SettingsMenu, { ref: menuRef, items: menu, onChange: handlePageChange, activeItemId: activePage }))),
|
|
5197
5316
|
React.createElement("div", { className: b$a('page') }, renderPageContent(activePage)))));
|
|
5198
5317
|
}
|
|
@@ -5406,10 +5525,10 @@ const OverlapPanel = ({ title, renderContent, className, onClose, action, closeT
|
|
|
5406
5525
|
React.createElement("div", { className: b$5('content') }, renderContent()))));
|
|
5407
5526
|
};
|
|
5408
5527
|
|
|
5409
|
-
var css_248z$4 = ".gn-mobile-header{--mobile-header-min-heigth:50px;--mobile-header-icon-size:20px}.gn-mobile-
|
|
5528
|
+
var css_248z$4 = ".gn-mobile-header{--mobile-header-min-heigth:50px;--mobile-header-icon-size:20px;background-color:var(--g-color-base-background)}.gn-mobile-header__header-container{background-color:var(--g-color-base-background);position:sticky;top:0;z-index:var(--gn-mobile-header-z-index,100)}.gn-mobile-header__header{align-items:center;border-bottom:1px solid var(--g-color-line-generic);box-sizing:border-box;display:flex;justify-content:space-between;padding:0 10px}.gn-mobile-header__burger{padding:12px}.gn-mobile-header__panel-item{--gn-drawer-item-position:var(--gn-mobile-header-panel-position,absolute)}.gn-mobile-header__burger-menu,.gn-mobile-header__panel-item{background-color:var(--g-color-base-background);max-height:100%;max-width:90vw;width:320px}.gn-mobile-header__user-menu{overflow-y:auto}.gn-mobile-header__overlap-panel,.gn-mobile-header__panels{z-index:var(--gn-mobile-header-panel-z-index,98)}.gn-mobile-header__panels{inset:var(--mobile-header-min-heigth) 0 0;overflow:hidden;position:fixed}.gn-mobile-header__panel-item{top:unset}.gn-mobile-header__content{overflow:auto}";
|
|
5410
5529
|
styleInject(css_248z$4);
|
|
5411
5530
|
|
|
5412
|
-
const TopAlert = React.lazy(() => Promise.resolve().then(function () { return require('./index-
|
|
5531
|
+
const TopAlert = React.lazy(() => Promise.resolve().then(function () { return require('./index-BsT7DcU0.js'); }).then((module) => ({ default: module.TopAlert })));
|
|
5413
5532
|
const b$4 = block('mobile-header');
|
|
5414
5533
|
const MobileHeader = React.forwardRef(({ logo, burgerMenu, burgerCloseTitle = i18n('burger_button_close'), burgerOpenTitle = i18n('burger_button_open'), panelItems = [], renderContent, sideItemRenderContent, onClosePanel, onEvent, className, contentClassName, overlapPanel, topAlert, }, ref) => {
|
|
5415
5534
|
const targetRef = useForwardRef(ref);
|
|
@@ -5527,7 +5646,7 @@ const MobileHeader = React.forwardRef(({ logo, burgerMenu, burgerCloseTitle = i1
|
|
|
5527
5646
|
onOverlapClose,
|
|
5528
5647
|
]);
|
|
5529
5648
|
return (React.createElement("div", { className: b$4({ compact }, className), ref: targetRef },
|
|
5530
|
-
React.createElement("div", { className: b$4('
|
|
5649
|
+
React.createElement("div", { className: b$4('header-container') },
|
|
5531
5650
|
topAlert && (React.createElement(React.Suspense, { fallback: null },
|
|
5532
5651
|
React.createElement(TopAlert, { alert: topAlert, mobileView: true }))),
|
|
5533
5652
|
React.createElement("header", { className: b$4('header'), style: { height: size } },
|
|
@@ -5725,4 +5844,4 @@ exports.styleInject = styleInject;
|
|
|
5725
5844
|
exports.useAsideHeaderContext = useAsideHeaderContext;
|
|
5726
5845
|
exports.useSettingsContext = useSettingsContext;
|
|
5727
5846
|
exports.useSettingsSelectionContext = useSettingsSelectionContext;
|
|
5728
|
-
//# sourceMappingURL=index-
|
|
5847
|
+
//# sourceMappingURL=index-9bMDuiin.js.map
|