@gravity-ui/navigation 3.7.2 → 3.7.4
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/Selection/context.d.ts +4 -5
- package/build/cjs/components/Settings/Settings.d.ts +1 -55
- package/build/cjs/components/Settings/SettingsContext/SettingsContext.d.ts +3 -0
- package/build/cjs/components/Settings/SettingsContext/types.d.ts +3 -0
- package/build/cjs/components/Settings/SettingsContext/useSettingsContext.d.ts +1 -0
- package/build/cjs/components/Settings/SettingsPage/SettingsPageComponent.d.ts +14 -0
- package/build/cjs/components/Settings/SettingsPage/getPageTitleById.d.ts +2 -0
- package/build/cjs/components/Settings/SettingsRow/SettingsRow.d.ts +8 -0
- package/build/cjs/components/Settings/SettingsRow/prepareTitle.d.ts +2 -0
- package/build/cjs/components/Settings/SettingsSection.d.ts +7 -0
- package/build/cjs/components/Settings/b.d.ts +1 -0
- package/build/cjs/components/Settings/index.d.ts +3 -0
- package/build/cjs/components/Settings/types.d.ts +54 -1
- package/build/cjs/{index-CwssjteA.js → index-6IkDuB63.js} +115 -101
- package/build/cjs/index-6IkDuB63.js.map +1 -0
- package/build/cjs/{index-DmbAkuY3.js → index-Dbssunyq.js} +2 -2
- package/build/cjs/{index-DmbAkuY3.js.map → index-Dbssunyq.js.map} +1 -1
- package/build/cjs/index.js +1 -1
- package/build/esm/components/Settings/Selection/context.d.ts +4 -5
- package/build/esm/components/Settings/Settings.d.ts +1 -55
- package/build/esm/components/Settings/SettingsContext/SettingsContext.d.ts +3 -0
- package/build/esm/components/Settings/SettingsContext/types.d.ts +3 -0
- package/build/esm/components/Settings/SettingsContext/useSettingsContext.d.ts +1 -0
- package/build/esm/components/Settings/SettingsPage/SettingsPageComponent.d.ts +14 -0
- package/build/esm/components/Settings/SettingsPage/getPageTitleById.d.ts +2 -0
- package/build/esm/components/Settings/SettingsRow/SettingsRow.d.ts +8 -0
- package/build/esm/components/Settings/SettingsRow/prepareTitle.d.ts +2 -0
- package/build/esm/components/Settings/SettingsSection.d.ts +7 -0
- package/build/esm/components/Settings/b.d.ts +1 -0
- package/build/esm/components/Settings/index.d.ts +3 -0
- package/build/esm/components/Settings/types.d.ts +54 -1
- package/build/esm/{index-CD_HaUpp.js → index-91wssyHT.js} +116 -102
- package/build/esm/index-91wssyHT.js.map +1 -0
- package/build/esm/{index-DLKE2e2V.js → index-CXVH4ncN.js} +2 -2
- package/build/esm/{index-DLKE2e2V.js.map → index-CXVH4ncN.js.map} +1 -1
- package/build/esm/index.js +1 -1
- package/package.json +1 -1
- package/build/cjs/index-CwssjteA.js.map +0 -1
- package/build/esm/index-CD_HaUpp.js.map +0 -1
|
@@ -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-
|
|
5
|
+
var index = require('./index-6IkDuB63.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-
|
|
70
|
+
//# sourceMappingURL=index-Dbssunyq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Dbssunyq.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,CAAC;IAEnD,MAAM,sBAAsB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,YAAoB,KAAI;QACtE,MAAM,YAAY,GAAG;aAChB,sBAAsB,CAAC,iBAAiB;aACxC,IAAI,CAAC,CAAC,CAAuB;AAClC,QAAA,YAAY,KAAZ,IAAA,IAAA,YAAY,KAAZ,SAAA,GAAA,SAAA,GAAA,YAAY,CAAE,KAAK,CAAC,WAAW,CAAC,uBAAuB,EAAE,YAAY,GAAG,IAAI,CAAC;KAChF,EAAE,EAAE,CAAC;AAEN,IAAA,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,MAAK;;QACzC,sBAAsB,CAAC,CAAA,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,YAAY,KAAI,CAAC,CAAC;AAC/D,KAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC;AAE5B,IAAA,KAAK,CAAC,eAAe,CAAC,MAAK;AACvB,QAAA,MAAM,qBAAqB,GAAGA,gBAAU,CAAC,aAAa,EAAE,GAAG,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;QAE7E,IAAI,KAAK,EAAE;AACP,YAAA,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,CAAC;AACxD,YAAA,qBAAqB,EAAE;;AA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M,EAAC,EAAE,SAAS,CAAC,EAAA,EAEhF,MAAM,KACH,KAAC,CAAA,aAAA,CAAAC,WAAK,IACF,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,KAAK,EAAE,KAAK,CAAC,KAAK;SACrB,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;;;;"}
|
package/build/cjs/index.js
CHANGED
|
@@ -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
|
|
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):
|
|
8
|
-
export declare const SettingsSelectionContextProvider: React.Provider<
|
|
9
|
-
export declare function useSettingsSelectionContext():
|
|
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 {
|
|
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 @@
|
|
|
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,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
|
|
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 {};
|