@gravity-ui/navigation 3.7.2 → 3.7.3

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 (39) hide show
  1. package/build/cjs/components/Settings/Selection/context.d.ts +4 -5
  2. package/build/cjs/components/Settings/Settings.d.ts +1 -55
  3. package/build/cjs/components/Settings/SettingsContext/SettingsContext.d.ts +3 -0
  4. package/build/cjs/components/Settings/SettingsContext/types.d.ts +3 -0
  5. package/build/cjs/components/Settings/SettingsContext/useSettingsContext.d.ts +1 -0
  6. package/build/cjs/components/Settings/SettingsPage/SettingsPageComponent.d.ts +14 -0
  7. package/build/cjs/components/Settings/SettingsPage/getPageTitleById.d.ts +2 -0
  8. package/build/cjs/components/Settings/SettingsRow/SettingsRow.d.ts +8 -0
  9. package/build/cjs/components/Settings/SettingsRow/prepareTitle.d.ts +2 -0
  10. package/build/cjs/components/Settings/SettingsSection.d.ts +7 -0
  11. package/build/cjs/components/Settings/b.d.ts +1 -0
  12. package/build/cjs/components/Settings/index.d.ts +3 -0
  13. package/build/cjs/components/Settings/types.d.ts +54 -1
  14. package/build/cjs/{index-DmbAkuY3.js → index-CP_uL7BD.js} +2 -2
  15. package/build/cjs/{index-DmbAkuY3.js.map → index-CP_uL7BD.js.map} +1 -1
  16. package/build/cjs/{index-CwssjteA.js → index-DXB2_bQS.js} +114 -100
  17. package/build/cjs/index-DXB2_bQS.js.map +1 -0
  18. package/build/cjs/index.js +1 -1
  19. package/build/esm/components/Settings/Selection/context.d.ts +4 -5
  20. package/build/esm/components/Settings/Settings.d.ts +1 -55
  21. package/build/esm/components/Settings/SettingsContext/SettingsContext.d.ts +3 -0
  22. package/build/esm/components/Settings/SettingsContext/types.d.ts +3 -0
  23. package/build/esm/components/Settings/SettingsContext/useSettingsContext.d.ts +1 -0
  24. package/build/esm/components/Settings/SettingsPage/SettingsPageComponent.d.ts +14 -0
  25. package/build/esm/components/Settings/SettingsPage/getPageTitleById.d.ts +2 -0
  26. package/build/esm/components/Settings/SettingsRow/SettingsRow.d.ts +8 -0
  27. package/build/esm/components/Settings/SettingsRow/prepareTitle.d.ts +2 -0
  28. package/build/esm/components/Settings/SettingsSection.d.ts +7 -0
  29. package/build/esm/components/Settings/b.d.ts +1 -0
  30. package/build/esm/components/Settings/index.d.ts +3 -0
  31. package/build/esm/components/Settings/types.d.ts +54 -1
  32. package/build/esm/{index-DLKE2e2V.js → index-BwxN_FEJ.js} +2 -2
  33. package/build/esm/{index-DLKE2e2V.js.map → index-BwxN_FEJ.js.map} +1 -1
  34. package/build/esm/{index-CD_HaUpp.js → index-f1GutIB3.js} +115 -101
  35. package/build/esm/index-f1GutIB3.js.map +1 -0
  36. package/build/esm/index.js +1 -1
  37. package/package.json +1 -1
  38. package/build/cjs/index-CwssjteA.js.map +0 -1
  39. package/build/esm/index-CD_HaUpp.js.map +0 -1
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import { SelectedSettingsPart, SettingsPage } from '../collect-settings';
3
3
  import { SettingsSelection } from './types';
4
- interface ContextValue extends SelectedSettingsPart {
4
+ export interface SettingsSelectionProviderContextValue extends SelectedSettingsPart {
5
5
  selectedRef?: React.RefObject<HTMLDivElement>;
6
6
  }
7
- export declare function useSettingsSelectionProviderValue(pages: Record<string, SettingsPage>, selection: SettingsSelection | undefined): ContextValue;
8
- export declare const SettingsSelectionContextProvider: React.Provider<ContextValue>;
9
- export declare function useSettingsSelectionContext(): ContextValue;
10
- export {};
7
+ export declare function useSettingsSelectionProviderValue(pages: Record<string, SettingsPage>, selection: SettingsSelection | undefined): SettingsSelectionProviderContextValue;
8
+ export declare const SettingsSelectionContextProvider: React.Provider<SettingsSelectionProviderContextValue>;
9
+ export declare function useSettingsSelectionContext(): SettingsSelectionProviderContextValue;
@@ -1,60 +1,6 @@
1
1
  import React from 'react';
2
- import { IconProps } from '@gravity-ui/uikit';
3
- import { SettingsSelection } from './Selection';
4
- import type { SettingsPageSection } from './collect-settings';
2
+ import type { SettingsGroupProps, SettingsItemProps, SettingsPageProps, SettingsProps, SettingsSectionProps } from './types';
5
3
  import './Settings.scss';
6
- export interface SettingsProps {
7
- children: React.ReactNode;
8
- title?: string;
9
- filterPlaceholder?: string;
10
- emptyPlaceholder?: string;
11
- initialPage?: string;
12
- initialSearch?: string;
13
- selection?: SettingsSelection;
14
- onPageChange?: (page: string | undefined) => void;
15
- renderNotFound?: () => React.ReactNode;
16
- renderLoading?: () => React.ReactNode;
17
- loading?: boolean;
18
- view?: 'normal' | 'mobile';
19
- onClose?: () => void;
20
- renderRightAdornment?: (item: SettingsItemProps) => React.ReactNode;
21
- renderSectionRightAdornment?: (section: SettingsPageSection) => React.ReactNode;
22
- showRightAdornmentOnHover?: boolean;
23
- }
24
- export interface SettingsGroupProps {
25
- id?: string;
26
- groupTitle: string;
27
- children: React.ReactNode;
28
- }
29
- export interface SettingsPageProps {
30
- id?: string;
31
- title?: string;
32
- icon?: IconProps;
33
- children: React.ReactNode;
34
- }
35
- export interface SettingsSectionProps {
36
- id?: string;
37
- title: string;
38
- header?: React.ReactNode;
39
- children: React.ReactNode;
40
- withBadge?: boolean;
41
- hideTitle?: boolean;
42
- }
43
- export interface SettingsItemProps {
44
- id?: string;
45
- labelId?: string;
46
- title: string;
47
- highlightedTitle?: React.ReactNode | null;
48
- renderTitleComponent?: (highlightedTitle: React.ReactNode | null) => React.ReactNode;
49
- align?: 'top' | 'center';
50
- children: React.ReactNode;
51
- withBadge?: boolean;
52
- mode?: 'row';
53
- description?: React.ReactNode;
54
- }
55
- export interface SettingsContextType extends Pick<SettingsProps, 'renderRightAdornment' | 'renderSectionRightAdornment' | 'showRightAdornmentOnHover'> {
56
- }
57
- export declare const useSettingsContext: () => SettingsContextType;
58
4
  export declare function Settings({ loading, renderLoading, children, view, renderRightAdornment, renderSectionRightAdornment, showRightAdornmentOnHover, ...props }: SettingsProps): React.JSX.Element;
59
5
  export declare namespace Settings {
60
6
  var Group: ({ children }: SettingsGroupProps) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { SettingsContextType } from './types';
3
+ export declare const SettingsContext: React.Context<SettingsContextType>;
@@ -0,0 +1,3 @@
1
+ import type { SettingsProps } from '../types';
2
+ export interface SettingsContextType extends Pick<SettingsProps, 'renderRightAdornment' | 'renderSectionRightAdornment' | 'showRightAdornmentOnHover'> {
3
+ }
@@ -0,0 +1 @@
1
+ export declare const useSettingsContext: () => import("./types").SettingsContextType;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { SettingsSelectionProviderContextValue } from '../Selection/context';
3
+ import { SettingsMenu as CollectSettingsSettingsMenu, SettingsPage } from '../collect-settings';
4
+ import { SettingsContentProps } from '../types';
5
+ type Props = {
6
+ menu: CollectSettingsSettingsMenu;
7
+ pages: Record<string, SettingsPage>;
8
+ page: string | undefined;
9
+ isMobile: boolean;
10
+ search: string;
11
+ selected: SettingsSelectionProviderContextValue;
12
+ } & Pick<SettingsContentProps, 'renderNotFound' | 'emptyPlaceholder' | 'onClose'>;
13
+ export declare const SettingsPageComponent: ({ menu, pages, selected, isMobile, search, page, renderNotFound, emptyPlaceholder, onClose, }: Props) => React.ReactElement;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { SettingsMenu as SettingsMenuType } from '../collect-settings';
2
+ export declare const getPageTitleById: (menu: SettingsMenuType, activePage: string) => string;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { SettingsItem } from '../collect-settings';
3
+ export declare const SettingRow: {
4
+ ({ title: settingTitle, element, search, }: SettingsItem & {
5
+ search: string;
6
+ }): React.ReactElement;
7
+ displayName: string;
8
+ };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function prepareTitle(string: string, search: string): React.ReactNode[];
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { SettingsPageSection } from './collect-settings';
3
+ export declare const SettingsSection: React.ForwardRefExoticComponent<SettingsPageSection & {
4
+ search: string;
5
+ isMobile: boolean;
6
+ isSelected: boolean;
7
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ export declare const b: import("@bem-react/classname").ClassNameFormatter;
@@ -1,2 +1,5 @@
1
1
  export * from './Selection';
2
2
  export * from './Settings';
3
+ export type { SettingsContextType } from './SettingsContext/types';
4
+ export { useSettingsContext } from './SettingsContext/useSettingsContext';
5
+ export type { SettingsProps, SettingsGroupProps, SettingsPageProps, SettingsSectionProps, SettingsItemProps, } from './types';
@@ -1,4 +1,7 @@
1
- import { IconProps } from '@gravity-ui/uikit';
1
+ import type React from 'react';
2
+ import type { IconProps } from '@gravity-ui/uikit';
3
+ import type { SettingsSelection } from './Selection';
4
+ import type { SettingsPageSection } from './collect-settings';
2
5
  export interface GroupItem {
3
6
  groupTitle: string;
4
7
  items: Item[];
@@ -18,4 +21,54 @@ export interface SettingsMenuProps {
18
21
  focusItemId?: string;
19
22
  className?: string;
20
23
  }
24
+ export interface SettingsProps {
25
+ children: React.ReactNode;
26
+ title?: string;
27
+ filterPlaceholder?: string;
28
+ emptyPlaceholder?: string;
29
+ initialPage?: string;
30
+ initialSearch?: string;
31
+ selection?: SettingsSelection;
32
+ onPageChange?: (page: string | undefined) => void;
33
+ renderNotFound?: () => React.ReactNode;
34
+ renderLoading?: () => React.ReactNode;
35
+ loading?: boolean;
36
+ view?: 'normal' | 'mobile';
37
+ onClose?: () => void;
38
+ renderRightAdornment?: (item: SettingsItemProps) => React.ReactNode;
39
+ renderSectionRightAdornment?: (section: SettingsPageSection) => React.ReactNode;
40
+ showRightAdornmentOnHover?: boolean;
41
+ }
42
+ export interface SettingsGroupProps {
43
+ id?: string;
44
+ groupTitle: string;
45
+ children: React.ReactNode;
46
+ }
47
+ export interface SettingsPageProps {
48
+ id?: string;
49
+ title?: string;
50
+ icon?: IconProps;
51
+ children: React.ReactNode;
52
+ }
53
+ export interface SettingsSectionProps {
54
+ id?: string;
55
+ title: string;
56
+ header?: React.ReactNode;
57
+ children: React.ReactNode;
58
+ withBadge?: boolean;
59
+ hideTitle?: boolean;
60
+ }
61
+ export interface SettingsItemProps {
62
+ id?: string;
63
+ labelId?: string;
64
+ title: string;
65
+ highlightedTitle?: React.ReactNode | null;
66
+ renderTitleComponent?: (highlightedTitle: React.ReactNode | null) => React.ReactNode;
67
+ align?: 'top' | 'center';
68
+ children: React.ReactNode;
69
+ withBadge?: boolean;
70
+ mode?: 'row';
71
+ description?: React.ReactNode;
72
+ }
73
+ export type SettingsContentProps = Omit<SettingsProps, 'loading' | 'renderLoading'>;
21
74
  export {};
@@ -2,7 +2,7 @@
2
2
 
3
3
  var React = require('react');
4
4
  var uikit = require('@gravity-ui/uikit');
5
- var index = require('./index-CwssjteA.js');
5
+ var index = require('./index-DXB2_bQS.js');
6
6
  require('@bem-react/classname');
7
7
  require('@gravity-ui/icons');
8
8
  require('@gravity-ui/uikit/i18n');
@@ -67,4 +67,4 @@ const TopAlert = ({ alert, className, mobileView = false }) => {
67
67
  };
68
68
 
69
69
  exports.TopAlert = TopAlert;
70
- //# sourceMappingURL=index-DmbAkuY3.js.map
70
+ //# sourceMappingURL=index-CP_uL7BD.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DmbAkuY3.js","sources":["../../../src/components/TopAlert/useTopAlertHeight.ts","../../../src/components/TopAlert/TopAlert.tsx"],"sourcesContent":["import React from 'react';\n\nimport debounceFn from 'lodash/debounce';\n\nimport {TopAlertProps} from '../types';\n\ntype TopAlertHeightControls = {\n alertRef: React.RefObject<HTMLDivElement>;\n updateTopSize: () => void;\n};\n\nconst G_ROOT_CLASS_NAME = 'g-root';\n\nexport const useTopAlertHeight = ({alert}: {alert?: TopAlertProps}): TopAlertHeightControls => {\n const alertRef = React.useRef<HTMLDivElement>(null);\n\n const setAsideTopPanelHeight = React.useCallback((clientHeight: number) => {\n const gRootElement = document\n .getElementsByClassName(G_ROOT_CLASS_NAME)\n .item(0) as HTMLElement | null;\n gRootElement?.style.setProperty('--gn-top-alert-height', clientHeight + 'px');\n }, []);\n\n const updateTopSize = React.useCallback(() => {\n setAsideTopPanelHeight(alertRef.current?.clientHeight || 0);\n }, [setAsideTopPanelHeight]);\n\n React.useLayoutEffect(() => {\n const updateTopSizeDebounce = debounceFn(updateTopSize, 200, {leading: true});\n\n if (alert) {\n window.addEventListener('resize', updateTopSizeDebounce);\n updateTopSizeDebounce();\n }\n return () => {\n window.removeEventListener('resize', updateTopSizeDebounce);\n setAsideTopPanelHeight(0);\n };\n }, [alert, alertRef, updateTopSize, setAsideTopPanelHeight]);\n\n return {\n alertRef,\n updateTopSize,\n };\n};\n","import React from 'react';\n\nimport {Alert, Text} from '@gravity-ui/uikit';\n\nimport {TopAlertProps} from '../types';\nimport {block} from '../utils/cn';\n\nimport {useTopAlertHeight} from './useTopAlertHeight';\n\nimport './TopAlert.scss';\n\nconst b = block('top-alert');\n\ntype Props = {\n alert?: TopAlertProps;\n className?: string;\n mobileView?: boolean;\n};\n\nexport const TopAlert = ({alert, className, mobileView = false}: Props) => {\n const {alertRef, updateTopSize} = useTopAlertHeight({alert});\n\n const [opened, setOpened] = React.useState(true);\n\n const handleClose = React.useCallback(() => {\n setOpened(false);\n alert?.onCloseTopAlert?.();\n }, [alert]);\n\n React.useEffect(() => {\n if (!opened) {\n updateTopSize();\n }\n }, [opened, updateTopSize]);\n\n if (!alert || !alert.message) {\n return null;\n }\n\n return (\n <div\n ref={alertRef}\n className={b('wrapper', {'with-bottom-border': !mobileView && opened}, className)}\n >\n {opened && (\n <Alert\n className={b('', {\n centered: alert.centered,\n dense: alert.dense,\n })}\n corners=\"square\"\n layout=\"horizontal\"\n align={alert.align}\n theme={alert.theme || 'warning'}\n view={alert.view}\n icon={alert.icon}\n title={alert.title}\n message={\n mobileView ? (\n <Text ellipsisLines={5} variant=\"body-2\">\n {alert.message}\n </Text>\n ) : (\n alert.message\n )\n }\n actions={alert.actions}\n onClose={alert.closable ? handleClose : undefined}\n />\n )}\n </div>\n );\n};\n"],"names":["debounceFn","block","Alert","Text"],"mappings":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B,CAAC,EACF,OAAO,EAAC,QAAQ,EAChB,MAAM,EAAC,YAAY,EACnB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS,EAC/B,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,EACH,UAAU,IACN,oBAACC,UAAI,EAAA,EAAC,aAAa,EAAE,CAAC,EAAE,OAAO,EAAC,QAAQ,EACnC,EAAA,KAAK,CAAC,OAAO,CACX,KAEP,KAAK,CAAC,OAAO,CAChB,EAEL,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAG,WAAW,GAAG,SAAS,EACnD,CAAA,CACL,CACC;AAEd;;;;"}
1
+ {"version":3,"file":"index-CP_uL7BD.js","sources":["../../../src/components/TopAlert/useTopAlertHeight.ts","../../../src/components/TopAlert/TopAlert.tsx"],"sourcesContent":["import React from 'react';\n\nimport debounceFn from 'lodash/debounce';\n\nimport {TopAlertProps} from '../types';\n\ntype TopAlertHeightControls = {\n alertRef: React.RefObject<HTMLDivElement>;\n updateTopSize: () => void;\n};\n\nconst G_ROOT_CLASS_NAME = 'g-root';\n\nexport const useTopAlertHeight = ({alert}: {alert?: TopAlertProps}): TopAlertHeightControls => {\n const alertRef = React.useRef<HTMLDivElement>(null);\n\n const setAsideTopPanelHeight = React.useCallback((clientHeight: number) => {\n const gRootElement = document\n .getElementsByClassName(G_ROOT_CLASS_NAME)\n .item(0) as HTMLElement | null;\n gRootElement?.style.setProperty('--gn-top-alert-height', clientHeight + 'px');\n }, []);\n\n const updateTopSize = React.useCallback(() => {\n setAsideTopPanelHeight(alertRef.current?.clientHeight || 0);\n }, [setAsideTopPanelHeight]);\n\n React.useLayoutEffect(() => {\n const updateTopSizeDebounce = debounceFn(updateTopSize, 200, {leading: true});\n\n if (alert) {\n window.addEventListener('resize', updateTopSizeDebounce);\n updateTopSizeDebounce();\n }\n return () => {\n window.removeEventListener('resize', updateTopSizeDebounce);\n setAsideTopPanelHeight(0);\n };\n }, [alert, alertRef, updateTopSize, setAsideTopPanelHeight]);\n\n return {\n alertRef,\n updateTopSize,\n };\n};\n","import React from 'react';\n\nimport {Alert, Text} from '@gravity-ui/uikit';\n\nimport {TopAlertProps} from '../types';\nimport {block} from '../utils/cn';\n\nimport {useTopAlertHeight} from './useTopAlertHeight';\n\nimport './TopAlert.scss';\n\nconst b = block('top-alert');\n\ntype Props = {\n alert?: TopAlertProps;\n className?: string;\n mobileView?: boolean;\n};\n\nexport const TopAlert = ({alert, className, mobileView = false}: Props) => {\n const {alertRef, updateTopSize} = useTopAlertHeight({alert});\n\n const [opened, setOpened] = React.useState(true);\n\n const handleClose = React.useCallback(() => {\n setOpened(false);\n alert?.onCloseTopAlert?.();\n }, [alert]);\n\n React.useEffect(() => {\n if (!opened) {\n updateTopSize();\n }\n }, [opened, updateTopSize]);\n\n if (!alert || !alert.message) {\n return null;\n }\n\n return (\n <div\n ref={alertRef}\n className={b('wrapper', {'with-bottom-border': !mobileView && opened}, className)}\n >\n {opened && (\n <Alert\n className={b('', {\n centered: alert.centered,\n dense: alert.dense,\n })}\n corners=\"square\"\n layout=\"horizontal\"\n align={alert.align}\n theme={alert.theme || 'warning'}\n view={alert.view}\n icon={alert.icon}\n title={alert.title}\n message={\n mobileView ? (\n <Text ellipsisLines={5} variant=\"body-2\">\n {alert.message}\n </Text>\n ) : (\n alert.message\n )\n }\n actions={alert.actions}\n onClose={alert.closable ? handleClose : undefined}\n />\n )}\n </div>\n );\n};\n"],"names":["debounceFn","block","Alert","Text"],"mappings":";;;;;;;;;;;;AAWA,MAAM,iBAAiB,GAAG,QAAQ;AAE3B,MAAM,iBAAiB,GAAG,CAAC,EAAC,KAAK,EAA0B,KAA4B;IAC1F,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CA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AC,IAAI,EAChB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,EACH,UAAU,IACN,oBAACC,UAAI,EAAA,EAAC,aAAa,EAAE,CAAC,EAAE,OAAO,EAAC,QAAQ,EACnC,EAAA,KAAK,CAAC,OAAO,CACX,KAEP,KAAK,CAAC,OAAO,CAChB,EAEL,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAG,WAAW,GAAG,SAAS,EACnD,CAAA,CACL,CACC;AAEd;;;;"}
@@ -138,10 +138,10 @@ function styleInject(css, ref) {
138
138
  }
139
139
  }
140
140
 
141
- 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
+ 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{--gn-drawer-z-index:var(--gn-aside-header-panel-z-index,98);display:flex;flex-direction:column;inset:var(--gn-top-alert-height,0) 0 0;max-height:calc(100vh - var(--gn-top-alert-height, 0));overflow:auto;position:fixed}.gn-aside-header__panel{flex-grow:1;height:auto}.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)}";
142
142
  styleInject(css_248z$u);
143
143
 
144
- const TopAlert$1 = React.lazy(() => Promise.resolve().then(function () { return require('./index-DmbAkuY3.js'); }).then((module) => ({ default: module.TopAlert })));
144
+ const TopAlert$1 = React.lazy(() => Promise.resolve().then(function () { return require('./index-CP_uL7BD.js'); }).then((module) => ({ default: module.TopAlert })));
145
145
  const Layout = ({ compact, className, children, topAlert }) => {
146
146
  const size = compact ? ASIDE_HEADER_COMPACT_WIDTH : ASIDE_HEADER_EXPANDED_WIDTH;
147
147
  const asideHeaderContextValue = React.useMemo(() => ({ size, compact }), [compact, size]);
@@ -4589,7 +4589,7 @@ const Drawer = ({ className, veilClassName, children, style, onVeilClick, onEsca
4589
4589
 
4590
4590
  const Panels = () => {
4591
4591
  const { panelItems, onClosePanel, size } = useAsideHeaderInnerContext();
4592
- return panelItems ? (React.createElement(Drawer, { className: b$v('panels'), onVeilClick: onClosePanel, onEscape: onClosePanel, style: { left: size } }, panelItems.map((item) => (React.createElement(DrawerItem, Object.assign({ key: item.id }, item)))))) : null;
4592
+ return panelItems ? (React.createElement(Drawer, { className: b$v('panels'), onVeilClick: onClosePanel, onEscape: onClosePanel, style: { left: size } }, panelItems.map((item) => (React.createElement(DrawerItem, Object.assign({ key: item.id, className: b$v('panel') }, item)))))) : null;
4593
4593
  };
4594
4594
 
4595
4595
  const MENU_ITEMS_COMPOSITE_ID = 'gravity-ui/navigation-menu-items-composite-bar';
@@ -5188,23 +5188,9 @@ function requireIdentity () {
5188
5188
  var identityExports = requireIdentity();
5189
5189
  var identity = /*@__PURE__*/getDefaultExportFromCjs(identityExports);
5190
5190
 
5191
- function isSectionSelected(selected, pageId, section) {
5192
- var _a;
5193
- if (!selected.section || selected.setting) {
5194
- return false;
5195
- }
5196
- else if (selected.section.id && selected.section.id === section.id) {
5197
- return true;
5198
- }
5199
- else if (((_a = selected.page) === null || _a === undefined ? undefined : _a.id) === pageId &&
5200
- selected.section.title &&
5201
- selected.section.title === section.title) {
5202
- return true;
5203
- }
5204
- else {
5205
- return false;
5206
- }
5207
- }
5191
+ const SettingsContext = React.createContext({});
5192
+
5193
+ const useSettingsContext = () => React.useContext(SettingsContext);
5208
5194
 
5209
5195
  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}";
5210
5196
  styleInject(css_248z$c);
@@ -5311,7 +5297,97 @@ const SettingsMenuMobile = ({ items, onChange, activeItemId, className, }) => {
5311
5297
  React.createElement(legacy.Tabs, { items: tabItems, className: b$c(null, className), size: "l", activeTab: activeItemId, onSelectTab: onChange })));
5312
5298
  };
5313
5299
 
5314
- const b$b = block('settings-search');
5300
+ function isSectionSelected(selected, pageId, section) {
5301
+ var _a;
5302
+ if (!selected.section || selected.setting) {
5303
+ return false;
5304
+ }
5305
+ else if (selected.section.id && selected.section.id === section.id) {
5306
+ return true;
5307
+ }
5308
+ else if (((_a = selected.page) === null || _a === undefined ? undefined : _a.id) === pageId &&
5309
+ selected.section.title &&
5310
+ selected.section.title === section.title) {
5311
+ return true;
5312
+ }
5313
+ else {
5314
+ return false;
5315
+ }
5316
+ }
5317
+
5318
+ const b$b = block('settings');
5319
+
5320
+ function prepareTitle(string, search) {
5321
+ let temp = string.slice(0);
5322
+ const title = [];
5323
+ const parts = escapeStringForRegExp(search).split(' ').filter(Boolean);
5324
+ let key = 0;
5325
+ for (const part of parts) {
5326
+ const regex = new RegExp(part, 'ig');
5327
+ const match = regex.exec(temp);
5328
+ if (match) {
5329
+ const m = match[0];
5330
+ const i = match.index;
5331
+ if (i > 0) {
5332
+ title.push(temp.slice(0, i));
5333
+ }
5334
+ title.push(React.createElement("strong", { key: key++, className: b$b('found') }, m));
5335
+ temp = temp.slice(i + m.length);
5336
+ }
5337
+ }
5338
+ if (temp) {
5339
+ title.push(temp);
5340
+ }
5341
+ return title;
5342
+ }
5343
+
5344
+ const SettingRow = ({ title: settingTitle, element, search, }) => {
5345
+ return (React.createElement("div", { className: b$b('section-item') }, React.cloneElement(element, Object.assign(Object.assign({}, element.props), { highlightedTitle: search && settingTitle ? prepareTitle(settingTitle, search) : settingTitle }))));
5346
+ };
5347
+ SettingRow.displayName = 'SettingRow';
5348
+
5349
+ const SettingsSection = React.forwardRef((_a, ref) => {
5350
+ var { search, isMobile, isSelected } = _a, section = __rest(_a, ["search", "isMobile", "isSelected"]);
5351
+ const { renderSectionRightAdornment, showRightAdornmentOnHover } = useSettingsContext();
5352
+ return (React.createElement("div", { className: b$b('section', { selected: isSelected }), ref: isSelected ? ref : undefined },
5353
+ section.title && !section.hideTitle && (React.createElement("h3", { className: b$b('section-heading') }, renderSectionRightAdornment ? (React.createElement(uikit.Flex, { gap: 2, alignItems: 'center' },
5354
+ section.title,
5355
+ React.createElement("div", { className: b$b('section-right-adornment', {
5356
+ hidden: showRightAdornmentOnHover,
5357
+ }) }, renderSectionRightAdornment(section)))) : (section.title))),
5358
+ section.header &&
5359
+ (isMobile ? (React.createElement("div", { className: b$b('section-subheader') }, section.header)) : (section.header)),
5360
+ section.items.map((setting) => setting.hidden ? null : (React.createElement(SettingRow, Object.assign({}, setting, { key: setting.title, search: search }))))));
5361
+ });
5362
+ SettingsSection.displayName = 'SettingsSection';
5363
+
5364
+ const getPageTitleById = (menu, activePage) => {
5365
+ for (const firstLevel of menu) {
5366
+ if ('groupTitle' in firstLevel) {
5367
+ for (const secondLevel of firstLevel.items)
5368
+ if (secondLevel.id === activePage)
5369
+ return secondLevel.title;
5370
+ }
5371
+ else if (firstLevel.id === activePage)
5372
+ return firstLevel.title;
5373
+ }
5374
+ return '';
5375
+ };
5376
+
5377
+ const SettingsPageComponent = ({ menu, pages, selected, isMobile, search, page, renderNotFound, emptyPlaceholder, onClose, }) => {
5378
+ if (!page) {
5379
+ return typeof renderNotFound === 'function' ? (React.createElement(React.Fragment, null, renderNotFound())) : (React.createElement("div", { className: b$b('not-found') }, emptyPlaceholder));
5380
+ }
5381
+ const filteredSections = pages[page].sections.filter((section) => !section.hidden);
5382
+ return (React.createElement(React.Fragment, null,
5383
+ !isMobile && (React.createElement(Title, { hasSeparator: true, onClose: onClose }, getPageTitleById(menu, page))),
5384
+ React.createElement("div", { className: b$b('content') }, filteredSections.map((section) => {
5385
+ const isSelected = isSectionSelected(selected, page, section);
5386
+ return (React.createElement(SettingsSection, Object.assign({ isSelected: isSelected, isMobile: isMobile, search: search }, section, { key: section.title })));
5387
+ }))));
5388
+ };
5389
+
5390
+ const b$a = block('settings-search');
5315
5391
  function SettingsSearch({ className, initialValue, onChange, debounce = 200, inputRef, inputSize, placeholder, autoFocus = true, selection, }) {
5316
5392
  const [value, setValue] = React.useState(initialValue !== null && initialValue !== undefined ? initialValue : '');
5317
5393
  const onChangeDebounced = debounceFn(onChange, debounce);
@@ -5328,7 +5404,7 @@ function SettingsSearch({ className, initialValue, onChange, debounce = 200, inp
5328
5404
  // Remove any search, if selection is passed
5329
5405
  // eslint-disable-next-line react-hooks/exhaustive-deps
5330
5406
  }, [selection]);
5331
- return (React.createElement("div", { className: b$b(null, className) },
5407
+ return (React.createElement("div", { className: b$a(null, className) },
5332
5408
  React.createElement(uikit.TextInput, { value: value, controlRef: inputRef, hasClear: true, autoFocus: autoFocus, size: inputSize, placeholder: placeholder, onUpdate: handleUpdate, controlProps: {
5333
5409
  'aria-label': i18n$1('label_search'),
5334
5410
  } })));
@@ -5337,32 +5413,16 @@ function SettingsSearch({ className, initialValue, onChange, debounce = 200, inp
5337
5413
  var css_248z$a = ".gn-settings{display:grid;grid-template-columns:216px 1fr;height:100%;width:834px}.gn-settings_view_mobile{display:block;height:calc(80vh - 56px);overflow-x:hidden;width:auto}@supports (height:90dvh){.gn-settings_view_mobile{height:calc(90dvh - 56px)}}.gn-settings_view_mobile.gn-settings_loading{text-align:center}.gn-settings_view_mobile .gn-settings__loader{margin-top:20px}.gn-settings_view_mobile .gn-settings__search{margin:4px 0 16px;padding:0 20px}.gn-settings_view_mobile .gn-settings__page{overflow-y:visible}.gn-settings_view_mobile .gn-settings__tabs .g-tabs__item:first-child{margin-left:20px}.gn-settings_view_mobile .gn-settings__tabs .g-tabs__item:last-child{margin-right:20px}.gn-settings_view_mobile .gn-settings__section-heading{font-family:var(--g-text-subheader-font-family);font-size:var(--g-text-subheader-3-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-3-line-height)}.gn-settings_view_mobile .gn-settings__section-subheader{color:var(--g-color-text-secondary)}.gn-settings_view_mobile .gn-settings__section-heading+.gn-settings-subheader{margin-top:8px}.gn-settings_view_mobile .gn-settings__section-item{margin-top:0}.gn-settings_view_mobile .gn-settings__section-heading+.gn-settings__section-item,.gn-settings_view_mobile .gn-settings__section-subheader+.gn-settings__section-item{margin-top:30px}.gn-settings_view_mobile .gn-settings__section-item+.gn-settings__section-item{margin-top:22px}.gn-settings_view_mobile .gn-settings__item:not(.gn-settings_view_mobile .gn-settings__item_mode_row){gap:8px;grid-template-columns:1fr}.gn-settings_view_mobile .gn-settings__item-heading{font-family:var(--g-text-body-font-family);font-size:var(--g-text-body-2-font-size);font-weight:var(--g-text-body-font-weight);line-height:var(--g-text-body-2-line-height)}.gn-settings_view_mobile .gn-settings__item-description{font-family:var(--g-text-body-font-family);font-size:var(--g-text-body-1-font-size);font-weight:var(--g-text-body-font-weight);line-height:var(--g-text-body-1-line-height)}.gn-settings_view_mobile .gn-settings__item_mode_row{grid-template-columns:1fr auto}.gn-settings_view_mobile .gn-settings__item_mode_row .gn-settings__item-heading{padding-right:20px}.gn-settings_view_mobile .gn-settings__item-content{width:100%}.gn-settings_view_mobile .gn-settings__not-found{color:var(--g-color-text-hint);font-family:var(--g-text-body-font-family);font-size:var(--g-text-body-2-font-size);font-weight:var(--g-text-body-font-weight);justify-items:start;line-height:var(--g-text-body-2-line-height);margin:20px 0 0 20px}.gn-settings_loading{grid-template-columns:auto}.gn-settings__loader{place-self:center}.gn-settings__not-found{display:grid;height:100%;place-items:center}.gn-settings__menu{border-right:1px solid var(--g-color-line-generic)}.gn-settings__heading{font-family:var(--g-text-subheader-font-family);font-size:var(--g-text-subheader-2-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-2-line-height);margin:20px 20px 0}.gn-settings__search{margin:0 20px 16px}.gn-settings__page{overflow-y:auto}.gn-settings__content{padding:20px}.gn-settings__section-right-adornment_hidden{opacity:0;transition:opacity .2s}.gn-settings__section-heading:hover .gn-settings__section-right-adornment_hidden{opacity:1}.gn-settings__section-heading{font-family:var(--g-text-subheader-font-family);font-size:var(--g-text-subheader-2-font-size);font-weight:var(--g-text-subheader-font-weight);line-height:var(--g-text-subheader-2-line-height);margin:0}.gn-settings__section-item{margin-top:24px}.gn-settings__section+.gn-settings__section{margin-top:32px}.gn-settings__section:only-child .gn-settings__section-item:first-of-type{margin-top:0}.gn-settings__section:only-child .gn-settings__section-heading{display:none}.gn-settings__item{display:grid;grid-template-columns:216px 1fr;justify-items:start}.gn-settings__item_align_top{align-items:start}.gn-settings__item_align_center{align-items:center}.gn-settings__item-title_badge{position:relative}.gn-settings__item-title_badge:after{background-color:var(--g-color-text-danger);border-radius:50%;content:\"\";display:block;height:6px;position:absolute;right:-8px;top:1px;width:6px}.gn-settings__item-description{color:var(--g-color-text-secondary);display:block;font-family:var(--g-text-caption-font-family);font-size:var(--g-text-caption-2-font-size);font-weight:var(--g-text-caption-font-weight);line-height:var(--g-text-caption-2-line-height);margin-top:2px;padding-right:20px}.gn-settings__item-right-adornment_hidden{opacity:0;transition:opacity .2s}.gn-settings__item:hover .gn-settings__item-right-adornment_hidden{opacity:1}.gn-settings__item_selected,.gn-settings__section_selected{background:var(--g-color-base-selection);border-radius:8px;margin-left:-8px;padding:8px}.gn-settings__found{background:var(--g-color-base-selection);font-weight:var(--g-text-accent-font-weight)}";
5338
5414
  styleInject(css_248z$a);
5339
5415
 
5340
- const b$a = block('settings');
5341
- const SettingsContext = React.createContext({});
5342
- const useSettingsContext = () => React.useContext(SettingsContext);
5343
5416
  function Settings(_a) {
5344
5417
  var { loading, renderLoading, children, view = 'normal', renderRightAdornment, renderSectionRightAdornment, showRightAdornmentOnHover = true } = _a, props = __rest(_a, ["loading", "renderLoading", "children", "view", "renderRightAdornment", "renderSectionRightAdornment", "showRightAdornmentOnHover"]);
5345
5418
  if (loading) {
5346
- return (React.createElement("div", { className: b$a({ loading: true, view }) }, typeof renderLoading === 'function' ? (renderLoading()) : (React.createElement(uikit.Loader, { className: b$a('loader'), size: "m" }))));
5419
+ return (React.createElement("div", { className: b$b({ loading: true, view }) }, typeof renderLoading === 'function' ? (renderLoading()) : (React.createElement(uikit.Loader, { className: b$b('loader'), size: "m" }))));
5347
5420
  }
5348
5421
  return (React.createElement(SettingsContext.Provider, { value: { renderRightAdornment, renderSectionRightAdornment, showRightAdornmentOnHover } },
5349
5422
  React.createElement(SettingsContent, Object.assign({ view: view }, props), children)));
5350
5423
  }
5351
- const getPageTitleById = (menu, activePage) => {
5352
- for (const firstLevel of menu) {
5353
- if ('groupTitle' in firstLevel) {
5354
- for (const secondLevel of firstLevel.items)
5355
- if (secondLevel.id === activePage)
5356
- return secondLevel.title;
5357
- }
5358
- else if (firstLevel.id === activePage)
5359
- return firstLevel.title;
5360
- }
5361
- return '';
5362
- };
5363
5424
  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, }) {
5364
5425
  var _a;
5365
- const { renderSectionRightAdornment, showRightAdornmentOnHover } = useSettingsContext();
5366
5426
  const [search, setSearch] = React.useState(initialSearch !== null && initialSearch !== undefined ? initialSearch : '');
5367
5427
  const { menu, pages } = getSettingsFromChildren(children, search);
5368
5428
  const selected = useSettingsSelectionProviderValue(pages, selection);
@@ -5419,35 +5479,11 @@ function SettingsContent({ initialPage, initialSearch, selection, children, rend
5419
5479
  selected.selectedRef.current.scrollIntoView();
5420
5480
  }
5421
5481
  }, [selected.selectedRef]);
5422
- const renderSetting = ({ title: settingTitle, element }) => {
5423
- return (React.createElement("div", { key: settingTitle, className: b$a('section-item') }, React.cloneElement(element, Object.assign(Object.assign({}, element.props), { highlightedTitle: search && settingTitle ? prepareTitle(settingTitle, search) : settingTitle }))));
5424
- };
5425
- const renderSection = (page, section) => {
5426
- const isSelected = isSectionSelected(selected, page, section);
5427
- return (React.createElement("div", { key: section.title, className: b$a('section', { selected: isSelected }), ref: isSelected ? selected.selectedRef : undefined },
5428
- section.title && !section.hideTitle && (React.createElement("h3", { className: b$a('section-heading') }, renderSectionRightAdornment ? (React.createElement(uikit.Flex, { gap: 2, alignItems: 'center' },
5429
- section.title,
5430
- React.createElement("div", { className: b$a('section-right-adornment', {
5431
- hidden: showRightAdornmentOnHover,
5432
- }) }, renderSectionRightAdornment(section)))) : (section.title))),
5433
- section.header &&
5434
- (isMobile ? (React.createElement("div", { className: b$a('section-subheader') }, section.header)) : (section.header)),
5435
- section.items.map((setting) => (setting.hidden ? null : renderSetting(setting)))));
5436
- };
5437
- const renderPageContent = (page) => {
5438
- if (!page) {
5439
- return typeof renderNotFound === 'function' ? (renderNotFound()) : (React.createElement("div", { className: b$a('not-found') }, emptyPlaceholder));
5440
- }
5441
- const filteredSections = pages[page].sections.filter((section) => !section.hidden);
5442
- return (React.createElement(React.Fragment, null,
5443
- !isMobile && (React.createElement(Title, { hasSeparator: true, onClose: onClose }, getPageTitleById(menu, page))),
5444
- React.createElement("div", { className: b$a('content') }, filteredSections.map((section) => renderSection(page, section)))));
5445
- };
5446
5482
  return (React.createElement(SettingsSelectionContextProvider, { value: selected },
5447
- React.createElement("div", { className: b$a({ view }) },
5483
+ React.createElement("div", { className: b$b({ view }) },
5448
5484
  isMobile ? (React.createElement(React.Fragment, null,
5449
- React.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$a('search'), initialValue: initialSearch, selection: selection, onChange: setSearch, autoFocus: false, inputSize: 'xl' }),
5450
- React.createElement(SettingsMenuMobile, { items: menu, onChange: handlePageChange, activeItemId: activePage, className: b$a('tabs') }))) : (React.createElement("div", { className: b$a('menu'), onClick: () => {
5485
+ React.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$b('search'), initialValue: initialSearch, selection: selection, onChange: setSearch, autoFocus: false, inputSize: 'xl' }),
5486
+ React.createElement(SettingsMenuMobile, { items: menu, onChange: handlePageChange, activeItemId: activePage, className: b$b('tabs') }))) : (React.createElement("div", { className: b$b('menu'), onClick: () => {
5451
5487
  if (searchInputRef.current) {
5452
5488
  searchInputRef.current.focus();
5453
5489
  }
@@ -5459,9 +5495,10 @@ function SettingsContent({ initialPage, initialSearch, selection, children, rend
5459
5495
  }
5460
5496
  } },
5461
5497
  React.createElement(Title, null, title),
5462
- React.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$a('search'), initialValue: initialSearch, selection: selection, onChange: setSearch, placeholder: filterPlaceholder, autoFocus: true }),
5498
+ React.createElement(SettingsSearch, { inputRef: searchInputRef, className: b$b('search'), initialValue: initialSearch, selection: selection, onChange: setSearch, placeholder: filterPlaceholder, autoFocus: true }),
5463
5499
  React.createElement(SettingsMenu, { ref: menuRef, items: menu, onChange: handlePageChange, activeItemId: activePage }))),
5464
- React.createElement("div", { className: b$a('page') }, renderPageContent(activePage)))));
5500
+ React.createElement("div", { className: b$b('page') },
5501
+ React.createElement(SettingsPageComponent, { menu: menu, pages: pages, selected: selected, search: search, isMobile: isMobile, page: activePage, emptyPlaceholder: emptyPlaceholder, renderNotFound: renderNotFound, onClose: onClose })))));
5465
5502
  }
5466
5503
  Settings.Group = function SettingsGroup({ children }) {
5467
5504
  return React.createElement(React.Fragment, null, children);
@@ -5477,40 +5514,17 @@ Settings.Item = function SettingsItem(setting) {
5477
5514
  const selected = useSettingsSelectionContext();
5478
5515
  const isSettingSelected = selected.setting && selected.setting.id === id;
5479
5516
  const { renderRightAdornment, showRightAdornmentOnHover } = useSettingsContext();
5480
- const titleNode = (React.createElement("span", { className: b$a('item-title', { badge: withBadge }) }, renderTitleComponent(highlightedTitle)));
5481
- return (React.createElement("div", { className: b$a('item', { align, mode, selected: isSettingSelected }), ref: isSettingSelected ? selected.selectedRef : undefined },
5482
- React.createElement("label", { className: b$a('item-heading'), id: labelId },
5483
- renderRightAdornment ? (React.createElement(uikit.Flex, { className: b$a('item-title-wrapper'), gap: 3 },
5517
+ const titleNode = (React.createElement("span", { className: b$b('item-title', { badge: withBadge }) }, renderTitleComponent(highlightedTitle)));
5518
+ return (React.createElement("div", { className: b$b('item', { align, mode, selected: isSettingSelected }), ref: isSettingSelected ? selected.selectedRef : undefined },
5519
+ React.createElement("label", { className: b$b('item-heading'), id: labelId },
5520
+ renderRightAdornment ? (React.createElement(uikit.Flex, { className: b$b('item-title-wrapper'), gap: 3 },
5484
5521
  titleNode,
5485
- React.createElement("div", { className: b$a('item-right-adornment', {
5522
+ React.createElement("div", { className: b$b('item-right-adornment', {
5486
5523
  hidden: showRightAdornmentOnHover,
5487
5524
  }) }, renderRightAdornment(setting)))) : (titleNode),
5488
- description ? React.createElement("span", { className: b$a('item-description') }, description) : null),
5489
- React.createElement("div", { className: b$a('item-content') }, children)));
5525
+ description ? React.createElement("span", { className: b$b('item-description') }, description) : null),
5526
+ React.createElement("div", { className: b$b('item-content') }, children)));
5490
5527
  };
5491
- function prepareTitle(string, search) {
5492
- let temp = string.slice(0);
5493
- const title = [];
5494
- const parts = escapeStringForRegExp(search).split(' ').filter(Boolean);
5495
- let key = 0;
5496
- for (const part of parts) {
5497
- const regex = new RegExp(part, 'ig');
5498
- const match = regex.exec(temp);
5499
- if (match) {
5500
- const m = match[0];
5501
- const i = match.index;
5502
- if (i > 0) {
5503
- title.push(temp.slice(0, i));
5504
- }
5505
- title.push(React.createElement("strong", { key: key++, className: b$a('found') }, m));
5506
- temp = temp.slice(i + m.length);
5507
- }
5508
- }
5509
- if (temp) {
5510
- title.push(temp);
5511
- }
5512
- return title;
5513
- }
5514
5528
 
5515
5529
  const useForwardRef = (ref, initialValue = null) => {
5516
5530
  const targetRef = React.useRef(initialValue);
@@ -5689,7 +5703,7 @@ const OverlapPanel = ({ title, renderContent, className, onClose, action, closeT
5689
5703
  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}";
5690
5704
  styleInject(css_248z$4);
5691
5705
 
5692
- const TopAlert = React.lazy(() => Promise.resolve().then(function () { return require('./index-DmbAkuY3.js'); }).then((module) => ({ default: module.TopAlert })));
5706
+ const TopAlert = React.lazy(() => Promise.resolve().then(function () { return require('./index-CP_uL7BD.js'); }).then((module) => ({ default: module.TopAlert })));
5693
5707
  const b$4 = block('mobile-header');
5694
5708
  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) => {
5695
5709
  const targetRef = useForwardRef(ref);
@@ -6008,4 +6022,4 @@ exports.styleInject = styleInject;
6008
6022
  exports.useAsideHeaderContext = useAsideHeaderContext;
6009
6023
  exports.useSettingsContext = useSettingsContext;
6010
6024
  exports.useSettingsSelectionContext = useSettingsSelectionContext;
6011
- //# sourceMappingURL=index-CwssjteA.js.map
6025
+ //# sourceMappingURL=index-DXB2_bQS.js.map