@alfalab/core-components-side-panel 5.3.10 → 5.4.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/components/content/Component.desktop.js +1 -1
- package/components/content/Component.js +1 -1
- package/components/content/Component.mobile.js +1 -1
- package/components/content/desktop.css +7 -5
- package/components/content/index.css +4 -4
- package/components/content/mobile.css +6 -5
- package/components/controls/Component.js +2 -2
- package/components/controls/index.css +2 -2
- package/components/footer/Component.desktop.js +1 -1
- package/components/footer/Component.js +2 -2
- package/components/footer/Component.mobile.js +1 -1
- package/components/footer/desktop.css +6 -4
- package/components/footer/index.css +4 -4
- package/components/footer/layout.css +27 -24
- package/components/footer/mobile.css +5 -4
- package/components/header/Component.js +3 -3
- package/components/header/desktop.css +8 -6
- package/components/header/index.css +14 -14
- package/components/header/mobile.css +12 -11
- package/cssm/components/content/desktop.module.css +4 -2
- package/cssm/components/content/mobile.module.css +3 -2
- package/cssm/components/footer/desktop.module.css +3 -1
- package/cssm/components/footer/layout.module.css +10 -7
- package/cssm/components/footer/mobile.module.css +2 -1
- package/cssm/components/header/desktop.module.css +3 -1
- package/cssm/components/header/mobile.module.css +8 -7
- package/desktop/Component.desktop.js +2 -2
- package/desktop/desktop.css +3 -3
- package/desktop/transitions.desktop.css +7 -7
- package/esm/components/content/Component.desktop.js +1 -1
- package/esm/components/content/Component.js +1 -1
- package/esm/components/content/Component.mobile.js +1 -1
- package/esm/components/content/desktop.css +7 -5
- package/esm/components/content/index.css +4 -4
- package/esm/components/content/mobile.css +6 -5
- package/esm/components/controls/Component.js +2 -2
- package/esm/components/controls/index.css +2 -2
- package/esm/components/footer/Component.desktop.js +1 -1
- package/esm/components/footer/Component.js +2 -2
- package/esm/components/footer/Component.mobile.js +1 -1
- package/esm/components/footer/desktop.css +6 -4
- package/esm/components/footer/index.css +4 -4
- package/esm/components/footer/layout.css +27 -24
- package/esm/components/footer/mobile.css +5 -4
- package/esm/components/header/Component.js +3 -3
- package/esm/components/header/desktop.css +8 -6
- package/esm/components/header/index.css +14 -14
- package/esm/components/header/mobile.css +12 -11
- package/esm/desktop/Component.desktop.js +2 -2
- package/esm/desktop/desktop.css +3 -3
- package/esm/desktop/transitions.desktop.css +7 -7
- package/esm/layout.module-747ebd5d.js +4 -0
- package/esm/mobile/Component.mobile.js +2 -2
- package/esm/mobile/mobile.css +4 -4
- package/esm/mobile/transitions.mobile.css +8 -8
- package/layout.module-7617e951.js +6 -0
- package/mobile/Component.mobile.js +2 -2
- package/mobile/mobile.css +4 -4
- package/mobile/transitions.mobile.css +8 -8
- package/modern/components/content/Component.desktop.js +1 -1
- package/modern/components/content/Component.js +1 -1
- package/modern/components/content/Component.mobile.js +1 -1
- package/modern/components/content/desktop.css +7 -5
- package/modern/components/content/index.css +4 -4
- package/modern/components/content/mobile.css +6 -5
- package/modern/components/controls/Component.js +2 -2
- package/modern/components/controls/index.css +2 -2
- package/modern/components/footer/Component.desktop.js +1 -1
- package/modern/components/footer/Component.js +2 -2
- package/modern/components/footer/Component.mobile.js +1 -1
- package/modern/components/footer/desktop.css +6 -4
- package/modern/components/footer/index.css +4 -4
- package/modern/components/footer/layout.css +27 -24
- package/modern/components/footer/mobile.css +5 -4
- package/modern/components/header/Component.js +3 -3
- package/modern/components/header/desktop.css +8 -6
- package/modern/components/header/index.css +14 -14
- package/modern/components/header/mobile.css +12 -11
- package/modern/desktop/Component.desktop.js +2 -2
- package/modern/desktop/desktop.css +3 -3
- package/modern/desktop/transitions.desktop.css +7 -7
- package/modern/layout.module-8eef6acd.js +4 -0
- package/modern/mobile/Component.mobile.js +2 -2
- package/modern/mobile/mobile.css +4 -4
- package/modern/mobile/transitions.mobile.css +8 -8
- package/moderncssm/Component.responsive.d.ts +52 -0
- package/moderncssm/Component.responsive.js +37 -0
- package/moderncssm/Context.d.ts +4 -0
- package/moderncssm/Context.js +5 -0
- package/moderncssm/ResponsiveContext.d.ts +5 -0
- package/moderncssm/ResponsiveContext.js +5 -0
- package/moderncssm/components/content/Component.d.ts +17 -0
- package/moderncssm/components/content/Component.desktop.d.ts +10 -0
- package/moderncssm/components/content/Component.desktop.js +9 -0
- package/moderncssm/components/content/Component.js +16 -0
- package/moderncssm/components/content/Component.mobile.d.ts +5 -0
- package/moderncssm/components/content/Component.mobile.js +8 -0
- package/moderncssm/components/content/desktop.module.css +25 -0
- package/moderncssm/components/content/index.module.css +31 -0
- package/moderncssm/components/content/mobile.module.css +24 -0
- package/moderncssm/components/controls/Component.d.ts +29 -0
- package/moderncssm/components/controls/Component.js +20 -0
- package/moderncssm/components/controls/index.d.ts +1 -0
- package/moderncssm/components/controls/index.js +1 -0
- package/moderncssm/components/controls/index.module.css +3 -0
- package/moderncssm/components/footer/Component.d.ts +29 -0
- package/moderncssm/components/footer/Component.desktop.d.ts +10 -0
- package/moderncssm/components/footer/Component.desktop.js +11 -0
- package/moderncssm/components/footer/Component.js +21 -0
- package/moderncssm/components/footer/Component.mobile.d.ts +5 -0
- package/moderncssm/components/footer/Component.mobile.js +10 -0
- package/moderncssm/components/footer/desktop.module.css +25 -0
- package/moderncssm/components/footer/index.module.css +36 -0
- package/moderncssm/components/footer/layout.module.css +76 -0
- package/moderncssm/components/footer/mobile.module.css +24 -0
- package/moderncssm/components/header/Component.d.ts +5 -0
- package/moderncssm/components/header/Component.js +33 -0
- package/moderncssm/components/header/desktop.module.css +41 -0
- package/moderncssm/components/header/index.module.css +84 -0
- package/moderncssm/components/header/mobile.module.css +38 -0
- package/moderncssm/consts.d.ts +5 -0
- package/moderncssm/consts.js +6 -0
- package/moderncssm/desktop/Component.desktop.d.ts +36 -0
- package/moderncssm/desktop/Component.desktop.js +48 -0
- package/moderncssm/desktop/desktop.module.css +25 -0
- package/moderncssm/desktop/index.d.ts +2 -0
- package/moderncssm/desktop/index.js +1 -0
- package/moderncssm/desktop/transitions.desktop.module.css +32 -0
- package/moderncssm/index.d.ts +2 -0
- package/moderncssm/index.js +1 -0
- package/moderncssm/mobile/Component.mobile.d.ts +24 -0
- package/moderncssm/mobile/Component.mobile.js +30 -0
- package/moderncssm/mobile/index.d.ts +2 -0
- package/moderncssm/mobile/index.js +1 -0
- package/moderncssm/mobile/mobile.module.css +37 -0
- package/moderncssm/mobile/transitions.mobile.module.css +24 -0
- package/moderncssm/shared/index.d.ts +2 -0
- package/moderncssm/shared/index.js +2 -0
- package/moderncssm/typings.d.ts +7 -0
- package/moderncssm/typings.js +1 -0
- package/moderncssm/utils.d.ts +11 -0
- package/moderncssm/utils.js +16 -0
- package/moderncssm/vars.css +16 -0
- package/package.json +6 -6
- package/src/components/content/desktop.module.css +1 -1
- package/src/components/content/mobile.module.css +2 -2
- package/src/components/footer/layout.module.css +6 -6
- package/src/components/footer/mobile.module.css +1 -1
- package/src/vars.css +11 -11
- package/esm/layout.module-b0d167bd.js +0 -4
- package/layout.module-c1f11c9a.js +0 -6
- package/modern/layout.module-2fb6ba6b.js +0 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { SIZE_TO_CLASSNAME_MAP } from '../../consts.js';
|
|
4
|
+
import { Content } from './Component.js';
|
|
5
|
+
import styles from './desktop.module.css';
|
|
6
|
+
|
|
7
|
+
const ContentDesktop = ({ size = 500, className, ...restProps }) => (React.createElement(Content, { className: cn(className, size && styles[SIZE_TO_CLASSNAME_MAP[size]]), ...restProps }));
|
|
8
|
+
|
|
9
|
+
export { ContentDesktop };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { getDataTestId } from '@alfalab/core-components-shared/moderncssm';
|
|
4
|
+
import { ModalContext } from '../../Context.js';
|
|
5
|
+
import { ResponsiveContext } from '../../ResponsiveContext.js';
|
|
6
|
+
import styles from './index.module.css';
|
|
7
|
+
|
|
8
|
+
const Content = ({ children, className, dataTestId }) => {
|
|
9
|
+
const { contentRef, hasHeader } = useContext(ModalContext);
|
|
10
|
+
const responsiveContext = useContext(ResponsiveContext);
|
|
11
|
+
return (React.createElement("div", { className: cn(styles.content, className, styles.flex, {
|
|
12
|
+
[styles.withHeader]: hasHeader,
|
|
13
|
+
}), ref: contentRef, "data-test-id": dataTestId || getDataTestId(responsiveContext?.dataTestId, 'content') }, children));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { Content };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { Content } from './Component.js';
|
|
4
|
+
import styles from './mobile.module.css';
|
|
5
|
+
|
|
6
|
+
const ContentMobile = ({ className, ...restProps }) => (React.createElement(Content, { className: cn(className, styles.content), ...restProps }));
|
|
7
|
+
|
|
8
|
+
export { ContentMobile };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
|
|
5
|
+
/* sizes */
|
|
6
|
+
|
|
7
|
+
/* paddings */
|
|
8
|
+
--side-panel-s-content-paddings: var(--gap-40) var(--gap-40) 0;
|
|
9
|
+
|
|
10
|
+
/* scroll */
|
|
11
|
+
|
|
12
|
+
/* desktop */
|
|
13
|
+
|
|
14
|
+
/* mobile */
|
|
15
|
+
|
|
16
|
+
/* paddings */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.size-500 {
|
|
20
|
+
padding: var(--side-panel-s-content-paddings)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.size-500:last-child {
|
|
24
|
+
padding-bottom: var(--gap-32);
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
|
|
5
|
+
/* sizes */
|
|
6
|
+
|
|
7
|
+
/* paddings */
|
|
8
|
+
|
|
9
|
+
/* scroll */
|
|
10
|
+
|
|
11
|
+
/* desktop */
|
|
12
|
+
|
|
13
|
+
/* mobile */
|
|
14
|
+
|
|
15
|
+
/* paddings */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.content {
|
|
19
|
+
position: relative;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
width: 100%;
|
|
22
|
+
z-index: 0
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.content.withHeader {
|
|
26
|
+
padding-top: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.flex {
|
|
30
|
+
flex: 1 1 auto;
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
|
|
5
|
+
/* sizes */
|
|
6
|
+
|
|
7
|
+
/* paddings */
|
|
8
|
+
|
|
9
|
+
/* scroll */
|
|
10
|
+
|
|
11
|
+
/* desktop */
|
|
12
|
+
|
|
13
|
+
/* mobile */
|
|
14
|
+
|
|
15
|
+
/* paddings */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.content {
|
|
19
|
+
padding: var(--gap-16) var(--gap-16) 0
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.content:last-child {
|
|
23
|
+
padding-bottom: var(--gap-16);
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
interface ControlsProps {
|
|
5
|
+
/**
|
|
6
|
+
* Основной слот
|
|
7
|
+
*/
|
|
8
|
+
primary?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Дополнительный слот
|
|
11
|
+
*/
|
|
12
|
+
secondary?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Выравнивание элементов футера
|
|
15
|
+
* @default start
|
|
16
|
+
*/
|
|
17
|
+
layout?: 'start' | 'center' | 'space-between' | 'column';
|
|
18
|
+
/**
|
|
19
|
+
* Выравнивание элементов футера (мобильный view)
|
|
20
|
+
* @default start
|
|
21
|
+
*/
|
|
22
|
+
mobileLayout?: 'start' | 'center' | 'space-between' | 'column';
|
|
23
|
+
/**
|
|
24
|
+
* Отступы между элементами футера
|
|
25
|
+
*/
|
|
26
|
+
gap?: 16 | 24 | 32;
|
|
27
|
+
}
|
|
28
|
+
declare const Controls: React.FC<ControlsProps>;
|
|
29
|
+
export { ControlsProps, Controls };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { getDataTestId } from '@alfalab/core-components-shared/moderncssm';
|
|
4
|
+
import { ResponsiveContext } from '../../ResponsiveContext.js';
|
|
5
|
+
import layoutStyles from '../footer/layout.module.css';
|
|
6
|
+
import styles from './index.module.css';
|
|
7
|
+
|
|
8
|
+
const Controls = ({ primary, secondary, gap, layout: layoutProp = 'start', mobileLayout = layoutProp, }) => {
|
|
9
|
+
const context = useContext(ResponsiveContext);
|
|
10
|
+
const { view = 'desktop', dataTestId } = context || {};
|
|
11
|
+
const layout = view === 'mobile' ? mobileLayout : layoutProp;
|
|
12
|
+
const shouldReverse = view === 'mobile' && layout !== 'column';
|
|
13
|
+
return (React.createElement("div", { "data-test-id": getDataTestId(dataTestId, 'controls'), className: cn(styles.component, layoutStyles[layout], gap && layoutStyles[`gap-${gap}`]) }, shouldReverse ? (React.createElement(React.Fragment, null,
|
|
14
|
+
secondary,
|
|
15
|
+
primary)) : (React.createElement(React.Fragment, null,
|
|
16
|
+
primary,
|
|
17
|
+
secondary))));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { Controls };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Controls } from './Component.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
type FooterProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Контент футера
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Дополнительный класс
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Фиксирует футер
|
|
13
|
+
*/
|
|
14
|
+
sticky?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Выравнивание элементов футера
|
|
17
|
+
*/
|
|
18
|
+
layout?: 'start' | 'center' | 'space-between' | 'column';
|
|
19
|
+
/**
|
|
20
|
+
* Отступы между элементами футера
|
|
21
|
+
*/
|
|
22
|
+
gap?: 16 | 24 | 32;
|
|
23
|
+
/**
|
|
24
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
25
|
+
*/
|
|
26
|
+
dataTestId?: string;
|
|
27
|
+
};
|
|
28
|
+
declare const Footer: FC<FooterProps>;
|
|
29
|
+
export { FooterProps, Footer };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FooterProps } from "./Component";
|
|
3
|
+
type FooterDesktopProps = FooterProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Размер (только для desktop версии компонента)
|
|
6
|
+
*/
|
|
7
|
+
size?: 's' | 500;
|
|
8
|
+
};
|
|
9
|
+
declare const FooterDesktop: FC<FooterDesktopProps>;
|
|
10
|
+
export { FooterDesktopProps, FooterDesktop };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { SIZE_TO_CLASSNAME_MAP } from '../../consts.js';
|
|
4
|
+
import { Footer } from './Component.js';
|
|
5
|
+
import styles from './desktop.module.css';
|
|
6
|
+
|
|
7
|
+
const FooterDesktop = ({ size = 500, className, sticky, ...restProps }) => (React.createElement(Footer, { className: cn(className, size && styles[SIZE_TO_CLASSNAME_MAP[size]], {
|
|
8
|
+
[styles.sticky]: sticky,
|
|
9
|
+
}), sticky: sticky, ...restProps }));
|
|
10
|
+
|
|
11
|
+
export { FooterDesktop };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { getDataTestId } from '@alfalab/core-components-shared/moderncssm';
|
|
4
|
+
import { ModalContext } from '../../Context.js';
|
|
5
|
+
import { ResponsiveContext } from '../../ResponsiveContext.js';
|
|
6
|
+
import styles from './index.module.css';
|
|
7
|
+
import layoutStyles from './layout.module.css';
|
|
8
|
+
|
|
9
|
+
const Footer = ({ children, className, sticky, layout = 'start', gap, dataTestId, }) => {
|
|
10
|
+
const { footerHighlighted, setHasFooter } = useContext(ModalContext);
|
|
11
|
+
const responsiveContext = useContext(ResponsiveContext);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setHasFooter(true);
|
|
14
|
+
}, [setHasFooter]);
|
|
15
|
+
return (React.createElement("div", { className: cn(styles.footer, className, layoutStyles[layout], gap && layoutStyles[`gap-${gap}`], {
|
|
16
|
+
[styles.highlighted]: sticky && footerHighlighted,
|
|
17
|
+
[styles.sticky]: sticky,
|
|
18
|
+
}), "data-test-id": dataTestId || getDataTestId(responsiveContext?.dataTestId, 'footer') }, children));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { Footer };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { Footer } from './Component.js';
|
|
4
|
+
import styles from './mobile.module.css';
|
|
5
|
+
|
|
6
|
+
const FooterMobile = ({ className, sticky, layout = 'start', ...restProps }) => (React.createElement(Footer, { className: cn(className, styles.footer, {
|
|
7
|
+
[styles.sticky]: sticky,
|
|
8
|
+
}), sticky: sticky, layout: layout, ...restProps }));
|
|
9
|
+
|
|
10
|
+
export { FooterMobile };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
|
|
5
|
+
/* sizes */
|
|
6
|
+
|
|
7
|
+
/* paddings */
|
|
8
|
+
--side-panel-s-footer-paddings: var(--gap-24) var(--gap-40) var(--gap-40);
|
|
9
|
+
|
|
10
|
+
/* scroll */
|
|
11
|
+
|
|
12
|
+
/* desktop */
|
|
13
|
+
|
|
14
|
+
/* mobile */
|
|
15
|
+
|
|
16
|
+
/* paddings */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sticky {
|
|
20
|
+
bottom: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.size-500 {
|
|
24
|
+
padding: var(--side-panel-s-footer-paddings);
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--side-panel-footer-background: var(--color-light-modal-bg-primary);
|
|
5
|
+
|
|
6
|
+
/* sizes */
|
|
7
|
+
|
|
8
|
+
/* paddings */
|
|
9
|
+
|
|
10
|
+
/* scroll */
|
|
11
|
+
--side-panel-footer-highlight-background: var(--color-light-modal-bg-primary);
|
|
12
|
+
--side-panel-footer-highlight-box-shadow: 0 -1px 0 0 var(--color-light-neutral-300);
|
|
13
|
+
|
|
14
|
+
/* desktop */
|
|
15
|
+
|
|
16
|
+
/* mobile */
|
|
17
|
+
|
|
18
|
+
/* paddings */
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.footer {
|
|
22
|
+
width: 100%;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
transition: box-shadow 0.2s ease, background 0.2s ease;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.sticky {
|
|
28
|
+
background: var(--side-panel-footer-background);
|
|
29
|
+
position: sticky;
|
|
30
|
+
z-index: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.highlighted {
|
|
34
|
+
background: var(--side-panel-footer-highlight-background);
|
|
35
|
+
box-shadow: var(--side-panel-footer-highlight-box-shadow);
|
|
36
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--side-panel-footer-default-gap: var(--gap-16);
|
|
5
|
+
|
|
6
|
+
/* sizes */
|
|
7
|
+
|
|
8
|
+
/* paddings */
|
|
9
|
+
|
|
10
|
+
/* scroll */
|
|
11
|
+
|
|
12
|
+
/* desktop */
|
|
13
|
+
|
|
14
|
+
/* mobile */
|
|
15
|
+
|
|
16
|
+
/* paddings */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.column {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.column > *:not(:last-child):not(:only-child) {
|
|
25
|
+
margin-bottom: var(--side-panel-footer-default-gap);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.column.gap-16 > *:not(:last-child):not(:only-child) {
|
|
29
|
+
margin-bottom: var(--gap-16);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.column.gap-24 > *:not(:last-child):not(:only-child) {
|
|
33
|
+
margin-bottom: var(--gap-24);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.column.gap-32 > *:not(:last-child):not(:only-child) {
|
|
37
|
+
margin-bottom: var(--gap-32);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.start {
|
|
41
|
+
justify-content: flex-start;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.center {
|
|
45
|
+
justify-content: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.space-between {
|
|
49
|
+
justify-content: space-between
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.space-between > * {
|
|
53
|
+
flex: 1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.start,
|
|
57
|
+
.center,
|
|
58
|
+
.space-between {
|
|
59
|
+
display: flex
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.start > *:not(:last-child):not(:only-child), .center > *:not(:last-child):not(:only-child), .space-between > *:not(:last-child):not(:only-child) {
|
|
63
|
+
margin-right: var(--side-panel-footer-default-gap);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.start.gap-16 > *:not(:last-child):not(:only-child), .center.gap-16 > *:not(:last-child):not(:only-child), .space-between.gap-16 > *:not(:last-child):not(:only-child) {
|
|
67
|
+
margin-right: var(--gap-16);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.start.gap-24 > *:not(:last-child):not(:only-child), .center.gap-24 > *:not(:last-child):not(:only-child), .space-between.gap-24 > *:not(:last-child):not(:only-child) {
|
|
71
|
+
margin-right: var(--gap-24);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.start.gap-32 > *:not(:last-child):not(:only-child), .center.gap-32 > *:not(:last-child):not(:only-child), .space-between.gap-32 > *:not(:last-child):not(:only-child) {
|
|
75
|
+
margin-right: var(--gap-32);
|
|
76
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { NavigationBarPrivateProps } from "@alfalab/core-components-navigation-bar-private";
|
|
3
|
+
type HeaderProps = Omit<NavigationBarPrivateProps, 'size' | 'view' | 'parentRef'>;
|
|
4
|
+
declare const Header: FC<HeaderProps>;
|
|
5
|
+
export { HeaderProps, Header };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { NavigationBarPrivate } from '@alfalab/core-components-navigation-bar-private/moderncssm';
|
|
4
|
+
import { getDataTestId } from '@alfalab/core-components-shared/moderncssm';
|
|
5
|
+
import { SIZE_TO_CLASSNAME_MAP } from '../../consts.js';
|
|
6
|
+
import { ModalContext } from '../../Context.js';
|
|
7
|
+
import { ResponsiveContext } from '../../ResponsiveContext.js';
|
|
8
|
+
import desktopStyles from './desktop.module.css';
|
|
9
|
+
import styles from './index.module.css';
|
|
10
|
+
import mobileStyles from './mobile.module.css';
|
|
11
|
+
|
|
12
|
+
const Header = ({ className, children, contentClassName, title, sticky, hasCloser = true, ...restProps }) => {
|
|
13
|
+
const { setHasHeader, headerHighlighted, onClose, componentRef } = useContext(ModalContext);
|
|
14
|
+
const { size = 500, view = 'desktop', dataTestId } = useContext(ResponsiveContext) || {};
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
setHasHeader(true);
|
|
17
|
+
}, [setHasHeader]);
|
|
18
|
+
const hasContent = Boolean(title || children);
|
|
19
|
+
return (React.createElement(NavigationBarPrivate, { dataTestId: getDataTestId(dataTestId, 'header'), ...restProps, scrollableParentRef: componentRef, view: view, sticky: sticky, title: title, hasCloser: hasCloser, onClose: onClose, className: cn(styles.header, className, {
|
|
20
|
+
[styles.highlighted]: hasContent && sticky && headerHighlighted,
|
|
21
|
+
[styles.sticky]: sticky,
|
|
22
|
+
[styles.hasContent]: hasContent,
|
|
23
|
+
[desktopStyles.sticky]: view === 'desktop' && sticky,
|
|
24
|
+
[desktopStyles[SIZE_TO_CLASSNAME_MAP[size]]]: view === 'desktop',
|
|
25
|
+
[mobileStyles.sticky]: view === 'mobile' && sticky,
|
|
26
|
+
[mobileStyles.header]: view === 'mobile',
|
|
27
|
+
}), contentClassName: cn(contentClassName, {
|
|
28
|
+
[desktopStyles.content]: view === 'desktop',
|
|
29
|
+
[mobileStyles.content]: view === 'mobile',
|
|
30
|
+
}) }, children));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { Header };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
|
|
5
|
+
/* sizes */
|
|
6
|
+
|
|
7
|
+
/* paddings */
|
|
8
|
+
--side-panel-s-header-paddings: 28px 28px 0;
|
|
9
|
+
|
|
10
|
+
/* scroll */
|
|
11
|
+
|
|
12
|
+
/* desktop */
|
|
13
|
+
--side-panel-s-header-desktop-content-paddings: 6px var(--gap-12) var(--gap-16);
|
|
14
|
+
--side-panel-s-header-desktop-font-size: 30px;
|
|
15
|
+
--side-panel-s-header-desktop-line-height: 36px;
|
|
16
|
+
--side-panel-header-desktop-font-weight: bold;
|
|
17
|
+
--side-panel-header-desktop-font-family: var(--font-family-system);
|
|
18
|
+
|
|
19
|
+
/* mobile */
|
|
20
|
+
|
|
21
|
+
/* paddings */
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.content {
|
|
25
|
+
font-weight: var(--side-panel-header-desktop-font-weight);
|
|
26
|
+
font-family: var(--side-panel-header-desktop-font-family);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.size-500 .content {
|
|
30
|
+
padding: var(--side-panel-s-header-desktop-content-paddings);
|
|
31
|
+
font-size: var(--side-panel-s-header-desktop-font-size);
|
|
32
|
+
line-height: var(--side-panel-s-header-desktop-line-height);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.size-500 {
|
|
36
|
+
padding: var(--side-panel-s-header-paddings);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.sticky {
|
|
40
|
+
top: 0;
|
|
41
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--side-panel-header-background: var(--color-light-modal-bg-primary);
|
|
5
|
+
|
|
6
|
+
/* sizes */
|
|
7
|
+
|
|
8
|
+
/* paddings */
|
|
9
|
+
|
|
10
|
+
/* scroll */
|
|
11
|
+
--side-panel-header-highlight-background: var(--color-light-modal-bg-primary);
|
|
12
|
+
--side-panel-header-highlight-box-shadow: 0 1px 0 0 var(--color-light-neutral-300);
|
|
13
|
+
|
|
14
|
+
/* desktop */
|
|
15
|
+
|
|
16
|
+
/* mobile */
|
|
17
|
+
|
|
18
|
+
/* paddings */
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.header {
|
|
22
|
+
width: 100%;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
transition: box-shadow 0.2s ease, background 0.2s ease
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.header:not(.hasContent) {
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.highlighted {
|
|
32
|
+
background: var(--side-panel-header-highlight-background);
|
|
33
|
+
box-shadow: var(--side-panel-header-highlight-box-shadow);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.sticky {
|
|
37
|
+
position: sticky;
|
|
38
|
+
z-index: 1
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.sticky.hasContent {
|
|
42
|
+
background: var(--side-panel-header-background);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.header.backgroundImage {
|
|
46
|
+
background: center no-repeat;
|
|
47
|
+
background-size: cover;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.content {
|
|
51
|
+
flex-grow: 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.title {
|
|
55
|
+
word-break: break-word;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.addon {
|
|
59
|
+
min-width: 48px;
|
|
60
|
+
height: 48px;
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
align-items: center;
|
|
64
|
+
pointer-events: all;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.closer {
|
|
68
|
+
margin-left: auto;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.right {
|
|
72
|
+
justify-content: flex-end;
|
|
73
|
+
text-align: right;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.trim {
|
|
77
|
+
overflow: hidden
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.trim .title {
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
|
|
5
|
+
/* sizes */
|
|
6
|
+
|
|
7
|
+
/* paddings */
|
|
8
|
+
|
|
9
|
+
/* scroll */
|
|
10
|
+
|
|
11
|
+
/* desktop */
|
|
12
|
+
|
|
13
|
+
/* mobile */
|
|
14
|
+
--side-panel-header-mobile-content-paddings: 10px var(--gap-8);
|
|
15
|
+
--side-panel-header-mobile-font-size: 20px;
|
|
16
|
+
--side-panel-header-mobile-line-height: 28px;
|
|
17
|
+
--side-panel-header-mobile-font-family: var(--font-family-system);
|
|
18
|
+
--side-panel-header-mobile-font-weight: 600;
|
|
19
|
+
|
|
20
|
+
/* paddings */
|
|
21
|
+
--side-panel-header-mobile-paddings: var(--gap-4) var(--gap-8);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.header {
|
|
25
|
+
padding: var(--side-panel-header-mobile-paddings);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sticky {
|
|
29
|
+
top: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.content {
|
|
33
|
+
font-size: var(--side-panel-header-mobile-font-size);
|
|
34
|
+
line-height: var(--side-panel-header-mobile-line-height);
|
|
35
|
+
font-family: var(--side-panel-header-mobile-font-family);
|
|
36
|
+
font-weight: var(--side-panel-header-mobile-font-weight);
|
|
37
|
+
padding: var(--side-panel-header-mobile-content-paddings);
|
|
38
|
+
}
|