@astral/ui 4.47.1 → 4.48.1

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 (51) hide show
  1. package/components/DescriptionList/DescriptionList.d.ts +1 -1
  2. package/components/DescriptionList/DescriptionList.js +31 -8
  3. package/components/DescriptionList/constants.d.ts +13 -0
  4. package/components/DescriptionList/constants.js +13 -0
  5. package/components/DescriptionList/styles.d.ts +0 -2
  6. package/components/DescriptionList/styles.js +35 -12
  7. package/components/DescriptionList/types.d.ts +4 -0
  8. package/components/DescriptionList/{hooks → useLogic/hooks}/useGroupedDescriptionItems/useGroupedDescriptionItems.d.ts +1 -1
  9. package/components/DescriptionList/useLogic/index.d.ts +1 -0
  10. package/components/DescriptionList/useLogic/index.js +1 -0
  11. package/components/DescriptionList/useLogic/useLogic.d.ts +8 -0
  12. package/components/DescriptionList/useLogic/useLogic.js +21 -0
  13. package/components/PageHeader/HeaderContent/HeaderContent.js +1 -1
  14. package/components/PageHeader/HeaderContent/styles.js +2 -0
  15. package/components/PageHeader/PageHeader.js +16 -2
  16. package/components/PageHeader/constants.d.ts +3 -0
  17. package/components/PageHeader/constants.js +3 -0
  18. package/components/PageHeader/styles.js +8 -2
  19. package/components/PageHeader/useLogic/useLogic.d.ts +1 -2
  20. package/components/PageHeader/useLogic/useLogic.js +2 -10
  21. package/node/components/DescriptionList/DescriptionList.d.ts +1 -1
  22. package/node/components/DescriptionList/DescriptionList.js +31 -8
  23. package/node/components/DescriptionList/constants.d.ts +13 -0
  24. package/node/components/DescriptionList/constants.js +16 -0
  25. package/node/components/DescriptionList/styles.d.ts +0 -2
  26. package/node/components/DescriptionList/styles.js +34 -11
  27. package/node/components/DescriptionList/types.d.ts +4 -0
  28. package/node/components/DescriptionList/{hooks → useLogic/hooks}/useGroupedDescriptionItems/useGroupedDescriptionItems.d.ts +1 -1
  29. package/node/components/DescriptionList/useLogic/index.d.ts +1 -0
  30. package/node/components/DescriptionList/useLogic/index.js +17 -0
  31. package/node/components/DescriptionList/useLogic/useLogic.d.ts +8 -0
  32. package/node/components/DescriptionList/useLogic/useLogic.js +25 -0
  33. package/node/components/PageHeader/HeaderContent/HeaderContent.js +1 -1
  34. package/node/components/PageHeader/HeaderContent/styles.js +2 -0
  35. package/node/components/PageHeader/PageHeader.js +16 -2
  36. package/node/components/PageHeader/constants.d.ts +3 -0
  37. package/node/components/PageHeader/constants.js +3 -0
  38. package/node/components/PageHeader/styles.js +8 -2
  39. package/node/components/PageHeader/useLogic/useLogic.d.ts +1 -2
  40. package/node/components/PageHeader/useLogic/useLogic.js +1 -9
  41. package/package.json +1 -1
  42. /package/components/DescriptionList/{hooks → useLogic/hooks}/index.d.ts +0 -0
  43. /package/components/DescriptionList/{hooks → useLogic/hooks}/index.js +0 -0
  44. /package/components/DescriptionList/{hooks → useLogic/hooks}/useGroupedDescriptionItems/index.d.ts +0 -0
  45. /package/components/DescriptionList/{hooks → useLogic/hooks}/useGroupedDescriptionItems/index.js +0 -0
  46. /package/components/DescriptionList/{hooks → useLogic/hooks}/useGroupedDescriptionItems/useGroupedDescriptionItems.js +0 -0
  47. /package/node/components/DescriptionList/{hooks → useLogic/hooks}/index.d.ts +0 -0
  48. /package/node/components/DescriptionList/{hooks → useLogic/hooks}/index.js +0 -0
  49. /package/node/components/DescriptionList/{hooks → useLogic/hooks}/useGroupedDescriptionItems/index.d.ts +0 -0
  50. /package/node/components/DescriptionList/{hooks → useLogic/hooks}/useGroupedDescriptionItems/index.js +0 -0
  51. /package/node/components/DescriptionList/{hooks → useLogic/hooks}/useGroupedDescriptionItems/useGroupedDescriptionItems.js +0 -0
@@ -1,2 +1,2 @@
1
1
  import type { DescriptionListProps } from './types';
2
- export declare const DescriptionList: ({ items, variant: listVariant, title, direction, ...props }: DescriptionListProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const DescriptionList: ({ items, variant: listVariant, title, direction, alignNameWidth, leader, ...props }: DescriptionListProps) => import("react/jsx-runtime").JSX.Element;
@@ -4,11 +4,32 @@ import { Description } from '../Description';
4
4
  import { GuidTypography } from '../GuidTypography';
5
5
  import { Tag } from '../Tag';
6
6
  import { Typography } from '../Typography';
7
- import { useGroupedDescriptionItems } from './hooks';
7
+ import { cva } from '../utils/cva';
8
+ import { descriptionListClassnames } from './constants';
8
9
  import { DescriptionWrapper, ListWrapper, StyledDescriptionName, StyledDescriptionValue, Title, Wrapper, } from './styles';
10
+ import { useLogic } from './useLogic';
9
11
  import { getTooltipProps } from './utils';
10
- export const DescriptionList = ({ items, variant: listVariant = 'default', title, direction, ...props }) => {
11
- const descriptionItems = useGroupedDescriptionItems({ items });
12
+ const descriptionList = cva(descriptionListClassnames.root, {
13
+ variants: {
14
+ variant: {
15
+ contained: descriptionListClassnames.contained,
16
+ default: descriptionListClassnames.default,
17
+ },
18
+ },
19
+ });
20
+ const descriptionItem = cva(descriptionListClassnames.item, {
21
+ variants: {
22
+ alignNameWidth: {
23
+ true: descriptionListClassnames.itemAlignNameWidth,
24
+ },
25
+ },
26
+ });
27
+ export const DescriptionList = ({ items, variant: listVariant = 'default', title, direction, alignNameWidth, leader, ...props }) => {
28
+ const { descriptionItems, descriptionListStyles } = useLogic({
29
+ items,
30
+ alignNameWidth,
31
+ leader,
32
+ });
12
33
  const render = useCallback((value, optionProps) => {
13
34
  const { renderValue, color, canCopy, copyPosition, variant, copyText } = optionProps;
14
35
  if (renderValue) {
@@ -25,19 +46,21 @@ export const DescriptionList = ({ items, variant: listVariant = 'default', title
25
46
  }, []);
26
47
  const renderTitle = () => {
27
48
  if (typeof title === 'string') {
28
- return _jsx(Title, { variant: "h6", children: title });
49
+ return (_jsx(Title, { variant: "h6", className: descriptionListClassnames.title, children: title }));
29
50
  }
30
- return _jsx(Title, { component: "div", children: title });
51
+ return (_jsx(Title, { component: "div", className: descriptionListClassnames.title, children: title }));
31
52
  };
32
53
  const renderNote = (note) => {
33
54
  if (typeof note === 'string') {
34
- return (_jsx(Typography, { variant: "caption", color: "textSecondary", children: note }));
55
+ return (_jsx(Typography, { variant: "caption", color: "textSecondary", className: descriptionListClassnames.note, children: note }));
35
56
  }
36
57
  return note;
37
58
  };
38
59
  const renderItem = (value, name, options) => {
39
60
  const { nameMaxWidth, note, ...restOptions } = options || {};
40
- return (_jsxs(DescriptionWrapper, { children: [_jsxs(Description, { direction: direction, ...props, component: "div", children: [_jsx(StyledDescriptionName, { "$nameMaxWidth": nameMaxWidth, "$direction": direction, children: name }), render(value, restOptions)] }), note && renderNote(note)] }, `${name}:${value}`));
61
+ return (_jsxs(DescriptionWrapper, { className: descriptionItem({
62
+ alignNameWidth: Boolean(alignNameWidth),
63
+ }), children: [_jsxs(Description, { direction: direction, leader: leader, ...props, component: "div", children: [_jsx(StyledDescriptionName, { "$nameMaxWidth": nameMaxWidth, "$direction": direction, children: name }), render(value, restOptions)] }), note && renderNote(note)] }, `${name}:${value}`));
41
64
  };
42
- return (_jsxs(Wrapper, { "$variant": listVariant, children: [title && renderTitle(), descriptionItems.map((group, groupIndex) => (_jsx(ListWrapper, { "$direction": direction, "$hasDivider": groupIndex !== 0, "$variant": listVariant, children: group.map(({ name, value, options }) => renderItem(value, name, options)) }, groupIndex)))] }));
65
+ return (_jsxs(Wrapper, { className: descriptionList({ variant: listVariant }), style: descriptionListStyles, children: [title && renderTitle(), descriptionItems.map((group, groupIndex) => (_jsx(ListWrapper, { "$direction": direction, "$hasDivider": groupIndex !== 0, "$variant": listVariant, children: group.map(({ name, value, options }) => renderItem(value, name, options)) }, groupIndex)))] }));
43
66
  };
@@ -0,0 +1,13 @@
1
+ export declare const descriptionListVariantClassnames: {
2
+ contained: string;
3
+ default: string;
4
+ };
5
+ export declare const descriptionListClassnames: {
6
+ contained: string;
7
+ default: string;
8
+ root: string;
9
+ title: string;
10
+ item: string;
11
+ itemAlignNameWidth: string;
12
+ note: string;
13
+ };
@@ -0,0 +1,13 @@
1
+ import { createUIKitClassname } from '../utils/createUIKitClassname';
2
+ export const descriptionListVariantClassnames = {
3
+ contained: createUIKitClassname('description-list_variant-contained'),
4
+ default: createUIKitClassname('description-list_variant-default'),
5
+ };
6
+ export const descriptionListClassnames = {
7
+ root: createUIKitClassname('description-list'),
8
+ title: createUIKitClassname('description-list__title'),
9
+ item: createUIKitClassname('description-list__item'),
10
+ itemAlignNameWidth: createUIKitClassname('description-list__item_align-name-width'),
11
+ note: createUIKitClassname('description-list__note'),
12
+ ...descriptionListVariantClassnames,
13
+ };
@@ -11,8 +11,6 @@ export declare const StyledDescriptionName: import("../styled").StyledComponent<
11
11
  export declare const Wrapper: import("../styled").StyledComponent<{
12
12
  theme?: import("@emotion/react").Theme | undefined;
13
13
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
14
- } & {
15
- $variant: DescriptionListVariant;
16
14
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
17
15
  export declare const ListWrapper: import("../styled").StyledComponent<{
18
16
  theme?: import("@emotion/react").Theme | undefined;
@@ -1,6 +1,7 @@
1
- import { Description } from '../Description';
1
+ import { Description, descriptionClassnames } from '../Description';
2
2
  import { styled } from '../styled';
3
3
  import { Typography } from '../Typography';
4
+ import { descriptionListClassnames } from './constants';
4
5
  export const StyledDescriptionName = styled(Description.Name, {
5
6
  shouldForwardProp: (prop) => !['$nameMaxWidth', '$direction'].includes(prop),
6
7
  }) `
@@ -11,20 +12,17 @@ export const StyledDescriptionName = styled(Description.Name, {
11
12
  margin-bottom: ${({ theme, $direction }) => Object.is($direction, 'row') ? 0 : theme.spacing(1)};
12
13
  }
13
14
  `;
14
- export const Wrapper = styled('article', {
15
- shouldForwardProp: (prop) => !['$variant'].includes(prop),
16
- }) `
15
+ export const Wrapper = styled.article `
17
16
  display: grid;
18
17
 
19
- padding: ${({ $variant, theme }) => $variant === 'contained' ? theme.spacing(4) : 0};
20
-
21
- background-color: ${({ $variant, theme }) => $variant === 'contained'
22
- ? theme.palette.background.default
23
- : 'transparent'};
24
- border: ${({ $variant, theme }) => $variant === 'contained'
25
- ? `1px solid ${theme.palette.grey[300]}`
26
- : 'unset'};
27
18
  border-radius: ${({ theme }) => theme.shape.small};
19
+
20
+ &.${descriptionListClassnames.contained} {
21
+ padding: ${({ theme }) => theme.spacing(4)};
22
+
23
+ background-color: ${({ theme }) => theme.palette.background.default};
24
+ border: 1px solid ${({ theme }) => theme.palette.grey[300]};
25
+ }
28
26
  `;
29
27
  export const ListWrapper = styled('dl', {
30
28
  shouldForwardProp: (prop) => !['$direction', '$hasDivider', '$variant'].includes(prop),
@@ -60,6 +58,31 @@ export const DescriptionWrapper = styled.div `
60
58
  display: flex;
61
59
  flex-direction: column;
62
60
  gap: ${({ theme }) => theme.spacing(1)};
61
+
62
+ ${({ theme }) => theme.breakpoints.up('sm')} {
63
+ &.${descriptionListClassnames.itemAlignNameWidth} {
64
+ display: grid;
65
+ grid-template-columns: var(--name-desktop-width) 1fr;
66
+
67
+ & .${descriptionListClassnames.note} {
68
+ grid-column: 1 / -1;
69
+ }
70
+
71
+ & .${descriptionClassnames.root} {
72
+ display: grid;
73
+ grid-column: 1 / -1;
74
+ grid-template-columns: inherit;
75
+ gap: ${({ theme }) => theme.spacing(1)};
76
+
77
+ /* Причина игнора: прогрессивное улучшение */
78
+ /* stylelint-disable plugin/no-unsupported-browser-features */
79
+ @supports (grid-template-columns: subgrid) {
80
+ grid-template-columns: subgrid;
81
+ }
82
+ /* stylelint-enable plugin/no-unsupported-browser-features */
83
+ }
84
+ }
85
+ }
63
86
  `;
64
87
  export const Title = styled(Typography) `
65
88
  margin-bottom: ${({ theme }) => theme.spacing(3)};
@@ -37,4 +37,8 @@ export type DescriptionListProps = Pick<DescriptionProps, 'justifyContent' | 'le
37
37
  * Заголовок блока
38
38
  */
39
39
  title?: ReactNode;
40
+ /**
41
+ * Включает выравнивание колонок DescriptionList с указанной шириной для поля наименования.
42
+ */
43
+ alignNameWidth?: `${string}px`;
40
44
  };
@@ -1,4 +1,4 @@
1
- import type { DescriptionListItem, DescriptionListProps } from '../../types';
1
+ import type { DescriptionListItem, DescriptionListProps } from '../../../types';
2
2
  type UseNormalizedDescriptionItemsParams = Pick<DescriptionListProps, 'items'>;
3
3
  /**
4
4
  * Группирует элементы описания в логические секции для рендеринга.
@@ -0,0 +1 @@
1
+ export * from './useLogic';
@@ -0,0 +1 @@
1
+ export * from './useLogic';
@@ -0,0 +1,8 @@
1
+ import { type CSSProperties } from 'react';
2
+ import type { DescriptionListProps } from '../types';
3
+ type UseLogicParams = Pick<DescriptionListProps, 'items' | 'alignNameWidth' | 'leader'>;
4
+ export declare const useLogic: ({ items, alignNameWidth, leader }: UseLogicParams) => {
5
+ descriptionItems: import("../types").DescriptionListItem[][];
6
+ descriptionListStyles: CSSProperties;
7
+ };
8
+ export {};
@@ -0,0 +1,21 @@
1
+ import { useEffect } from 'react';
2
+ import { useGroupedDescriptionItems } from './hooks';
3
+ export const useLogic = ({ items, alignNameWidth, leader }) => {
4
+ const descriptionItems = useGroupedDescriptionItems({ items });
5
+ const getDescriptionListStyles = () => {
6
+ if (!alignNameWidth) {
7
+ return {};
8
+ }
9
+ return { '--name-desktop-width': alignNameWidth };
10
+ };
11
+ useEffect(() => {
12
+ if (leader && alignNameWidth) {
13
+ // biome-ignore lint/suspicious/noConsole: Сообщение для интеграторов
14
+ console.error('DescriptionList: Параметры leader и alignNameWidth не могут быть использованы вместе');
15
+ }
16
+ }, [leader, alignNameWidth]);
17
+ return {
18
+ descriptionItems,
19
+ descriptionListStyles: getDescriptionListStyles(),
20
+ };
21
+ };
@@ -14,5 +14,5 @@ export const HeaderContent = ({ backButton, description, subheader, breadcrumbs,
14
14
  }
15
15
  return (_jsx(BreadcrumbsWrapper, { children: Array.isArray(breadcrumbs) ? (_jsx(Breadcrumbs, { children: breadcrumbs })) : (breadcrumbs) }));
16
16
  };
17
- return (_jsxs(_Fragment, { children: [renderBreadcrumbs(), _jsx(DesktopTitleWrapper, { children: _jsx(Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), _jsx(Description, { description: description, isLoading: isLoading }), actions && (_jsx(PageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", withCollapseOnLaptop: Boolean(filters), ...actions })), filters && (_jsx(FormFiltersProvider, { filtersClassName: pageHeaderClassnames.filters, quickFiltersClassName: pageHeaderClassnames.quickFilters, children: filters })), subheader && _jsx(PageSubheader, { children: subheader })] }));
17
+ return (_jsxs(_Fragment, { children: [renderBreadcrumbs(), _jsx(DesktopTitleWrapper, { children: _jsx(Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), _jsx(Description, { description: description, isLoading: isLoading }), actions && (_jsx(PageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", withCollapseOnLaptop: Boolean(filters), ...actions })), filters && (_jsx(FormFiltersProvider, { filtersClassName: pageHeaderClassnames.filters, quickFiltersClassName: pageHeaderClassnames.quickFilters, children: filters })), subheader && (_jsx(PageSubheader, { className: pageHeaderClassnames.subheader, children: subheader }))] }));
18
18
  };
@@ -17,6 +17,8 @@ export const PageSubheader = styled.div `
17
17
 
18
18
  ${({ theme }) => theme.breakpoints.down('sm')} {
19
19
  padding: ${({ theme }) => theme.spacing(0, 4, 4, 4)};
20
+
21
+ border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
20
22
  }
21
23
  `;
22
24
  export const DesktopTitleWrapper = styled.div `
@@ -1,13 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { classNames } from '../utils/classNames';
3
+ import { cva } from '../utils/cva';
3
4
  import { pageHeaderClassnames } from './constants';
4
5
  import { HeaderContent } from './HeaderContent';
5
6
  import { MobilePageActions } from './MobilePageActions';
6
7
  import { MobileTitleWrapper, Wrapper } from './styles';
7
8
  import { Title } from './Title';
8
9
  import { useLogic } from './useLogic';
10
+ const mobilePageHeader = cva(pageHeaderClassnames.pageHeaderMobileTitle, {
11
+ variants: {
12
+ hasTitle: {
13
+ true: pageHeaderClassnames.hasTitle,
14
+ },
15
+ hasBackButton: {
16
+ true: pageHeaderClassnames.hasBackButton,
17
+ },
18
+ },
19
+ });
9
20
  export const PageHeader = (props) => {
10
21
  const { title, description, subheader, breadcrumbs, actions, backButton, className, filters, } = props;
11
- const { isLoading, mobileTitleActions, isShowMobileActions, mobileClassnames, } = useLogic(props);
12
- return (_jsxs(_Fragment, { children: [_jsxs(MobileTitleWrapper, { className: mobileClassnames, children: [_jsx(Title, { backButton: backButton, title: title, isLoading: isLoading }), mobileTitleActions && mobileTitleActions] }), _jsx(Wrapper, { className: className, children: _jsx(HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, filters: filters, isLoading: isLoading }) }), isShowMobileActions && (_jsx(MobilePageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
22
+ const { isLoading, mobileTitleActions, isShowMobileActions } = useLogic(props);
23
+ return (_jsxs(_Fragment, { children: [_jsxs(MobileTitleWrapper, { className: mobilePageHeader({
24
+ hasTitle: Boolean(title) || isLoading,
25
+ hasBackButton: Boolean(backButton),
26
+ }), children: [_jsx(Title, { backButton: backButton, title: title, isLoading: isLoading }), mobileTitleActions && mobileTitleActions] }), _jsx(Wrapper, { className: classNames(pageHeaderClassnames.root, className), children: _jsx(HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, filters: filters, isLoading: isLoading }) }), isShowMobileActions && (_jsx(MobilePageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
13
27
  };
@@ -1,10 +1,13 @@
1
1
  export declare const pageHeaderClassnames: {
2
+ root: string;
2
3
  pageHeaderMobileTitle: string;
3
4
  pageHeaderActions: string;
4
5
  hasBackButton: string;
5
6
  hasTitle: string;
6
7
  filters: string;
8
+ subheader: string;
7
9
  quickFilters: string;
8
10
  hasFilters: string;
11
+ hasSubheader: string;
9
12
  };
10
13
  export declare const PAGE_HEADER_HEIGHT_MOBILE = "48px";
@@ -1,11 +1,14 @@
1
1
  import { createUIKitClassname } from '../utils/createUIKitClassname';
2
2
  export const pageHeaderClassnames = {
3
+ root: createUIKitClassname('page-header'),
3
4
  pageHeaderMobileTitle: createUIKitClassname('page-header__mobile-title'),
4
5
  pageHeaderActions: createUIKitClassname('page-header__actions'),
5
6
  hasBackButton: createUIKitClassname('page-header_has-back-button'),
6
7
  hasTitle: createUIKitClassname('page-header_has-title'),
7
8
  filters: createUIKitClassname('page-header__filters'),
9
+ subheader: createUIKitClassname('page-header__subheader'),
8
10
  quickFilters: createUIKitClassname('page-header__quick-filters'),
9
11
  hasFilters: createUIKitClassname('page-header_has-filters'),
12
+ hasSubheader: createUIKitClassname('page-header_has-subheader'),
10
13
  };
11
14
  export const PAGE_HEADER_HEIGHT_MOBILE = '48px';
@@ -69,10 +69,16 @@ export const MobileTitleWrapper = styled.div `
69
69
 
70
70
  background-color: ${({ theme }) => theme.palette.background.default};
71
71
 
72
- &:not(.${pageHeaderClassnames.hasFilters}) {
72
+ /* Причина игнора: прогрессивное улучшение */
73
+ /* stylelint-disable plugin/no-unsupported-browser-features */
74
+ &:not(:has(+ .${pageHeaderClassnames.root} :is(
75
+ .${pageHeaderClassnames.filters},
76
+ .${pageHeaderClassnames.subheader}
77
+ ))) {
73
78
  border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
74
79
  }
75
-
80
+ /* stylelint-enable plugin/no-unsupported-browser-features */
81
+
76
82
  &.${pageHeaderClassnames.hasTitle} {
77
83
  display: flex;
78
84
 
@@ -1,10 +1,9 @@
1
1
  import { type ElementType } from 'react';
2
2
  import type { PageHeaderProps } from '../types';
3
3
  type UseLogicParams<TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType> = PageHeaderProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>;
4
- export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType>({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, filters, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => {
4
+ export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType>({ shouldUpdateDocumentTitle, title, actions, htmlTitle, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => {
5
5
  isShowMobileActions: boolean | undefined;
6
6
  isLoading: boolean | undefined;
7
7
  mobileTitleActions: import("react").ReactNode;
8
- mobileClassnames: string;
9
8
  };
10
9
  export {};
@@ -1,22 +1,14 @@
1
- import { useContext, useMemo } from 'react';
1
+ import { useContext } from 'react';
2
2
  import { PageContext } from '../../PageContext';
3
- import { classNames } from '../../utils/classNames';
4
- import { pageHeaderClassnames } from '../constants';
5
3
  import { usePageTitle } from '../hooks/usePageTitle';
6
- export const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, filters, }) => {
4
+ export const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, }) => {
7
5
  //Переопределение Html title на title из параметров
8
6
  usePageTitle({ shouldUpdateDocumentTitle, htmlTitle, title });
9
7
  const { mobileTitleActions, isLoading } = useContext(PageContext);
10
8
  const isShowMobileActions = actions && !mobileTitleActions;
11
- const mobileClassnames = useMemo(() => classNames(pageHeaderClassnames.pageHeaderMobileTitle, {
12
- [pageHeaderClassnames.hasTitle]: Boolean(title) || isLoading,
13
- [pageHeaderClassnames.hasBackButton]: Boolean(backButton),
14
- [pageHeaderClassnames.hasFilters]: Boolean(filters),
15
- }), [title, backButton, isLoading]);
16
9
  return {
17
10
  isShowMobileActions,
18
11
  isLoading,
19
12
  mobileTitleActions,
20
- mobileClassnames,
21
13
  };
22
14
  };
@@ -1,2 +1,2 @@
1
1
  import type { DescriptionListProps } from './types';
2
- export declare const DescriptionList: ({ items, variant: listVariant, title, direction, ...props }: DescriptionListProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const DescriptionList: ({ items, variant: listVariant, title, direction, alignNameWidth, leader, ...props }: DescriptionListProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,11 +7,32 @@ const Description_1 = require("../Description");
7
7
  const GuidTypography_1 = require("../GuidTypography");
8
8
  const Tag_1 = require("../Tag");
9
9
  const Typography_1 = require("../Typography");
10
- const hooks_1 = require("./hooks");
10
+ const cva_1 = require("../utils/cva");
11
+ const constants_1 = require("./constants");
11
12
  const styles_1 = require("./styles");
13
+ const useLogic_1 = require("./useLogic");
12
14
  const utils_1 = require("./utils");
13
- const DescriptionList = ({ items, variant: listVariant = 'default', title, direction, ...props }) => {
14
- const descriptionItems = (0, hooks_1.useGroupedDescriptionItems)({ items });
15
+ const descriptionList = (0, cva_1.cva)(constants_1.descriptionListClassnames.root, {
16
+ variants: {
17
+ variant: {
18
+ contained: constants_1.descriptionListClassnames.contained,
19
+ default: constants_1.descriptionListClassnames.default,
20
+ },
21
+ },
22
+ });
23
+ const descriptionItem = (0, cva_1.cva)(constants_1.descriptionListClassnames.item, {
24
+ variants: {
25
+ alignNameWidth: {
26
+ true: constants_1.descriptionListClassnames.itemAlignNameWidth,
27
+ },
28
+ },
29
+ });
30
+ const DescriptionList = ({ items, variant: listVariant = 'default', title, direction, alignNameWidth, leader, ...props }) => {
31
+ const { descriptionItems, descriptionListStyles } = (0, useLogic_1.useLogic)({
32
+ items,
33
+ alignNameWidth,
34
+ leader,
35
+ });
15
36
  const render = (0, react_1.useCallback)((value, optionProps) => {
16
37
  const { renderValue, color, canCopy, copyPosition, variant, copyText } = optionProps;
17
38
  if (renderValue) {
@@ -28,20 +49,22 @@ const DescriptionList = ({ items, variant: listVariant = 'default', title, direc
28
49
  }, []);
29
50
  const renderTitle = () => {
30
51
  if (typeof title === 'string') {
31
- return (0, jsx_runtime_1.jsx)(styles_1.Title, { variant: "h6", children: title });
52
+ return ((0, jsx_runtime_1.jsx)(styles_1.Title, { variant: "h6", className: constants_1.descriptionListClassnames.title, children: title }));
32
53
  }
33
- return (0, jsx_runtime_1.jsx)(styles_1.Title, { component: "div", children: title });
54
+ return ((0, jsx_runtime_1.jsx)(styles_1.Title, { component: "div", className: constants_1.descriptionListClassnames.title, children: title }));
34
55
  };
35
56
  const renderNote = (note) => {
36
57
  if (typeof note === 'string') {
37
- return ((0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "caption", color: "textSecondary", children: note }));
58
+ return ((0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "caption", color: "textSecondary", className: constants_1.descriptionListClassnames.note, children: note }));
38
59
  }
39
60
  return note;
40
61
  };
41
62
  const renderItem = (value, name, options) => {
42
63
  const { nameMaxWidth, note, ...restOptions } = options || {};
43
- return ((0, jsx_runtime_1.jsxs)(styles_1.DescriptionWrapper, { children: [(0, jsx_runtime_1.jsxs)(Description_1.Description, { direction: direction, ...props, component: "div", children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDescriptionName, { "$nameMaxWidth": nameMaxWidth, "$direction": direction, children: name }), render(value, restOptions)] }), note && renderNote(note)] }, `${name}:${value}`));
64
+ return ((0, jsx_runtime_1.jsxs)(styles_1.DescriptionWrapper, { className: descriptionItem({
65
+ alignNameWidth: Boolean(alignNameWidth),
66
+ }), children: [(0, jsx_runtime_1.jsxs)(Description_1.Description, { direction: direction, leader: leader, ...props, component: "div", children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDescriptionName, { "$nameMaxWidth": nameMaxWidth, "$direction": direction, children: name }), render(value, restOptions)] }), note && renderNote(note)] }, `${name}:${value}`));
44
67
  };
45
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$variant": listVariant, children: [title && renderTitle(), descriptionItems.map((group, groupIndex) => ((0, jsx_runtime_1.jsx)(styles_1.ListWrapper, { "$direction": direction, "$hasDivider": groupIndex !== 0, "$variant": listVariant, children: group.map(({ name, value, options }) => renderItem(value, name, options)) }, groupIndex)))] }));
68
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: descriptionList({ variant: listVariant }), style: descriptionListStyles, children: [title && renderTitle(), descriptionItems.map((group, groupIndex) => ((0, jsx_runtime_1.jsx)(styles_1.ListWrapper, { "$direction": direction, "$hasDivider": groupIndex !== 0, "$variant": listVariant, children: group.map(({ name, value, options }) => renderItem(value, name, options)) }, groupIndex)))] }));
46
69
  };
47
70
  exports.DescriptionList = DescriptionList;
@@ -0,0 +1,13 @@
1
+ export declare const descriptionListVariantClassnames: {
2
+ contained: string;
3
+ default: string;
4
+ };
5
+ export declare const descriptionListClassnames: {
6
+ contained: string;
7
+ default: string;
8
+ root: string;
9
+ title: string;
10
+ item: string;
11
+ itemAlignNameWidth: string;
12
+ note: string;
13
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.descriptionListClassnames = exports.descriptionListVariantClassnames = void 0;
4
+ const createUIKitClassname_1 = require("../utils/createUIKitClassname");
5
+ exports.descriptionListVariantClassnames = {
6
+ contained: (0, createUIKitClassname_1.createUIKitClassname)('description-list_variant-contained'),
7
+ default: (0, createUIKitClassname_1.createUIKitClassname)('description-list_variant-default'),
8
+ };
9
+ exports.descriptionListClassnames = {
10
+ root: (0, createUIKitClassname_1.createUIKitClassname)('description-list'),
11
+ title: (0, createUIKitClassname_1.createUIKitClassname)('description-list__title'),
12
+ item: (0, createUIKitClassname_1.createUIKitClassname)('description-list__item'),
13
+ itemAlignNameWidth: (0, createUIKitClassname_1.createUIKitClassname)('description-list__item_align-name-width'),
14
+ note: (0, createUIKitClassname_1.createUIKitClassname)('description-list__note'),
15
+ ...exports.descriptionListVariantClassnames,
16
+ };
@@ -11,8 +11,6 @@ export declare const StyledDescriptionName: import("@emotion/styled/dist/declara
11
11
  export declare const Wrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
12
12
  theme?: import("@emotion/react").Theme | undefined;
13
13
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
14
- } & {
15
- $variant: DescriptionListVariant;
16
14
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
17
15
  export declare const ListWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
18
16
  theme?: import("@emotion/react").Theme | undefined;
@@ -4,6 +4,7 @@ exports.Title = exports.DescriptionWrapper = exports.StyledDescriptionValue = ex
4
4
  const Description_1 = require("../Description");
5
5
  const styled_1 = require("../styled");
6
6
  const Typography_1 = require("../Typography");
7
+ const constants_1 = require("./constants");
7
8
  exports.StyledDescriptionName = (0, styled_1.styled)(Description_1.Description.Name, {
8
9
  shouldForwardProp: (prop) => !['$nameMaxWidth', '$direction'].includes(prop),
9
10
  }) `
@@ -14,20 +15,17 @@ exports.StyledDescriptionName = (0, styled_1.styled)(Description_1.Description.N
14
15
  margin-bottom: ${({ theme, $direction }) => Object.is($direction, 'row') ? 0 : theme.spacing(1)};
15
16
  }
16
17
  `;
17
- exports.Wrapper = (0, styled_1.styled)('article', {
18
- shouldForwardProp: (prop) => !['$variant'].includes(prop),
19
- }) `
18
+ exports.Wrapper = styled_1.styled.article `
20
19
  display: grid;
21
20
 
22
- padding: ${({ $variant, theme }) => $variant === 'contained' ? theme.spacing(4) : 0};
23
-
24
- background-color: ${({ $variant, theme }) => $variant === 'contained'
25
- ? theme.palette.background.default
26
- : 'transparent'};
27
- border: ${({ $variant, theme }) => $variant === 'contained'
28
- ? `1px solid ${theme.palette.grey[300]}`
29
- : 'unset'};
30
21
  border-radius: ${({ theme }) => theme.shape.small};
22
+
23
+ &.${constants_1.descriptionListClassnames.contained} {
24
+ padding: ${({ theme }) => theme.spacing(4)};
25
+
26
+ background-color: ${({ theme }) => theme.palette.background.default};
27
+ border: 1px solid ${({ theme }) => theme.palette.grey[300]};
28
+ }
31
29
  `;
32
30
  exports.ListWrapper = (0, styled_1.styled)('dl', {
33
31
  shouldForwardProp: (prop) => !['$direction', '$hasDivider', '$variant'].includes(prop),
@@ -63,6 +61,31 @@ exports.DescriptionWrapper = styled_1.styled.div `
63
61
  display: flex;
64
62
  flex-direction: column;
65
63
  gap: ${({ theme }) => theme.spacing(1)};
64
+
65
+ ${({ theme }) => theme.breakpoints.up('sm')} {
66
+ &.${constants_1.descriptionListClassnames.itemAlignNameWidth} {
67
+ display: grid;
68
+ grid-template-columns: var(--name-desktop-width) 1fr;
69
+
70
+ & .${constants_1.descriptionListClassnames.note} {
71
+ grid-column: 1 / -1;
72
+ }
73
+
74
+ & .${Description_1.descriptionClassnames.root} {
75
+ display: grid;
76
+ grid-column: 1 / -1;
77
+ grid-template-columns: inherit;
78
+ gap: ${({ theme }) => theme.spacing(1)};
79
+
80
+ /* Причина игнора: прогрессивное улучшение */
81
+ /* stylelint-disable plugin/no-unsupported-browser-features */
82
+ @supports (grid-template-columns: subgrid) {
83
+ grid-template-columns: subgrid;
84
+ }
85
+ /* stylelint-enable plugin/no-unsupported-browser-features */
86
+ }
87
+ }
88
+ }
66
89
  `;
67
90
  exports.Title = (0, styled_1.styled)(Typography_1.Typography) `
68
91
  margin-bottom: ${({ theme }) => theme.spacing(3)};
@@ -37,4 +37,8 @@ export type DescriptionListProps = Pick<DescriptionProps, 'justifyContent' | 'le
37
37
  * Заголовок блока
38
38
  */
39
39
  title?: ReactNode;
40
+ /**
41
+ * Включает выравнивание колонок DescriptionList с указанной шириной для поля наименования.
42
+ */
43
+ alignNameWidth?: `${string}px`;
40
44
  };
@@ -1,4 +1,4 @@
1
- import type { DescriptionListItem, DescriptionListProps } from '../../types';
1
+ import type { DescriptionListItem, DescriptionListProps } from '../../../types';
2
2
  type UseNormalizedDescriptionItemsParams = Pick<DescriptionListProps, 'items'>;
3
3
  /**
4
4
  * Группирует элементы описания в логические секции для рендеринга.
@@ -0,0 +1 @@
1
+ export * from './useLogic';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./useLogic"), exports);
@@ -0,0 +1,8 @@
1
+ import { type CSSProperties } from 'react';
2
+ import type { DescriptionListProps } from '../types';
3
+ type UseLogicParams = Pick<DescriptionListProps, 'items' | 'alignNameWidth' | 'leader'>;
4
+ export declare const useLogic: ({ items, alignNameWidth, leader }: UseLogicParams) => {
5
+ descriptionItems: import("../types").DescriptionListItem[][];
6
+ descriptionListStyles: CSSProperties;
7
+ };
8
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLogic = void 0;
4
+ const react_1 = require("react");
5
+ const hooks_1 = require("./hooks");
6
+ const useLogic = ({ items, alignNameWidth, leader }) => {
7
+ const descriptionItems = (0, hooks_1.useGroupedDescriptionItems)({ items });
8
+ const getDescriptionListStyles = () => {
9
+ if (!alignNameWidth) {
10
+ return {};
11
+ }
12
+ return { '--name-desktop-width': alignNameWidth };
13
+ };
14
+ (0, react_1.useEffect)(() => {
15
+ if (leader && alignNameWidth) {
16
+ // biome-ignore lint/suspicious/noConsole: Сообщение для интеграторов
17
+ console.error('DescriptionList: Параметры leader и alignNameWidth не могут быть использованы вместе');
18
+ }
19
+ }, [leader, alignNameWidth]);
20
+ return {
21
+ descriptionItems,
22
+ descriptionListStyles: getDescriptionListStyles(),
23
+ };
24
+ };
25
+ exports.useLogic = useLogic;
@@ -17,6 +17,6 @@ const HeaderContent = ({ backButton, description, subheader, breadcrumbs, action
17
17
  }
18
18
  return ((0, jsx_runtime_1.jsx)(styles_1.BreadcrumbsWrapper, { children: Array.isArray(breadcrumbs) ? ((0, jsx_runtime_1.jsx)(Breadcrumbs_1.Breadcrumbs, { children: breadcrumbs })) : (breadcrumbs) }));
19
19
  };
20
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderBreadcrumbs(), (0, jsx_runtime_1.jsx)(styles_1.DesktopTitleWrapper, { children: (0, jsx_runtime_1.jsx)(Title_1.Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), (0, jsx_runtime_1.jsx)(Description_1.Description, { description: description, isLoading: isLoading }), actions && ((0, jsx_runtime_1.jsx)(PageActions_1.PageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", withCollapseOnLaptop: Boolean(filters), ...actions })), filters && ((0, jsx_runtime_1.jsx)(FormFiltersProvider_1.FormFiltersProvider, { filtersClassName: constants_1.pageHeaderClassnames.filters, quickFiltersClassName: constants_1.pageHeaderClassnames.quickFilters, children: filters })), subheader && (0, jsx_runtime_1.jsx)(styles_1.PageSubheader, { children: subheader })] }));
20
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderBreadcrumbs(), (0, jsx_runtime_1.jsx)(styles_1.DesktopTitleWrapper, { children: (0, jsx_runtime_1.jsx)(Title_1.Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), (0, jsx_runtime_1.jsx)(Description_1.Description, { description: description, isLoading: isLoading }), actions && ((0, jsx_runtime_1.jsx)(PageActions_1.PageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", withCollapseOnLaptop: Boolean(filters), ...actions })), filters && ((0, jsx_runtime_1.jsx)(FormFiltersProvider_1.FormFiltersProvider, { filtersClassName: constants_1.pageHeaderClassnames.filters, quickFiltersClassName: constants_1.pageHeaderClassnames.quickFilters, children: filters })), subheader && ((0, jsx_runtime_1.jsx)(styles_1.PageSubheader, { className: constants_1.pageHeaderClassnames.subheader, children: subheader }))] }));
21
21
  };
22
22
  exports.HeaderContent = HeaderContent;
@@ -20,6 +20,8 @@ exports.PageSubheader = styled_1.styled.div `
20
20
 
21
21
  ${({ theme }) => theme.breakpoints.down('sm')} {
22
22
  padding: ${({ theme }) => theme.spacing(0, 4, 4, 4)};
23
+
24
+ border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
23
25
  }
24
26
  `;
25
27
  exports.DesktopTitleWrapper = styled_1.styled.div `
@@ -3,15 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PageHeader = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const classNames_1 = require("../utils/classNames");
6
+ const cva_1 = require("../utils/cva");
6
7
  const constants_1 = require("./constants");
7
8
  const HeaderContent_1 = require("./HeaderContent");
8
9
  const MobilePageActions_1 = require("./MobilePageActions");
9
10
  const styles_1 = require("./styles");
10
11
  const Title_1 = require("./Title");
11
12
  const useLogic_1 = require("./useLogic");
13
+ const mobilePageHeader = (0, cva_1.cva)(constants_1.pageHeaderClassnames.pageHeaderMobileTitle, {
14
+ variants: {
15
+ hasTitle: {
16
+ true: constants_1.pageHeaderClassnames.hasTitle,
17
+ },
18
+ hasBackButton: {
19
+ true: constants_1.pageHeaderClassnames.hasBackButton,
20
+ },
21
+ },
22
+ });
12
23
  const PageHeader = (props) => {
13
24
  const { title, description, subheader, breadcrumbs, actions, backButton, className, filters, } = props;
14
- const { isLoading, mobileTitleActions, isShowMobileActions, mobileClassnames, } = (0, useLogic_1.useLogic)(props);
15
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(styles_1.MobileTitleWrapper, { className: mobileClassnames, children: [(0, jsx_runtime_1.jsx)(Title_1.Title, { backButton: backButton, title: title, isLoading: isLoading }), mobileTitleActions && mobileTitleActions] }), (0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: className, children: (0, jsx_runtime_1.jsx)(HeaderContent_1.HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, filters: filters, isLoading: isLoading }) }), isShowMobileActions && ((0, jsx_runtime_1.jsx)(MobilePageActions_1.MobilePageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
25
+ const { isLoading, mobileTitleActions, isShowMobileActions } = (0, useLogic_1.useLogic)(props);
26
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(styles_1.MobileTitleWrapper, { className: mobilePageHeader({
27
+ hasTitle: Boolean(title) || isLoading,
28
+ hasBackButton: Boolean(backButton),
29
+ }), children: [(0, jsx_runtime_1.jsx)(Title_1.Title, { backButton: backButton, title: title, isLoading: isLoading }), mobileTitleActions && mobileTitleActions] }), (0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.root, className), children: (0, jsx_runtime_1.jsx)(HeaderContent_1.HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, filters: filters, isLoading: isLoading }) }), isShowMobileActions && ((0, jsx_runtime_1.jsx)(MobilePageActions_1.MobilePageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
16
30
  };
17
31
  exports.PageHeader = PageHeader;
@@ -1,10 +1,13 @@
1
1
  export declare const pageHeaderClassnames: {
2
+ root: string;
2
3
  pageHeaderMobileTitle: string;
3
4
  pageHeaderActions: string;
4
5
  hasBackButton: string;
5
6
  hasTitle: string;
6
7
  filters: string;
8
+ subheader: string;
7
9
  quickFilters: string;
8
10
  hasFilters: string;
11
+ hasSubheader: string;
9
12
  };
10
13
  export declare const PAGE_HEADER_HEIGHT_MOBILE = "48px";
@@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PAGE_HEADER_HEIGHT_MOBILE = exports.pageHeaderClassnames = void 0;
4
4
  const createUIKitClassname_1 = require("../utils/createUIKitClassname");
5
5
  exports.pageHeaderClassnames = {
6
+ root: (0, createUIKitClassname_1.createUIKitClassname)('page-header'),
6
7
  pageHeaderMobileTitle: (0, createUIKitClassname_1.createUIKitClassname)('page-header__mobile-title'),
7
8
  pageHeaderActions: (0, createUIKitClassname_1.createUIKitClassname)('page-header__actions'),
8
9
  hasBackButton: (0, createUIKitClassname_1.createUIKitClassname)('page-header_has-back-button'),
9
10
  hasTitle: (0, createUIKitClassname_1.createUIKitClassname)('page-header_has-title'),
10
11
  filters: (0, createUIKitClassname_1.createUIKitClassname)('page-header__filters'),
12
+ subheader: (0, createUIKitClassname_1.createUIKitClassname)('page-header__subheader'),
11
13
  quickFilters: (0, createUIKitClassname_1.createUIKitClassname)('page-header__quick-filters'),
12
14
  hasFilters: (0, createUIKitClassname_1.createUIKitClassname)('page-header_has-filters'),
15
+ hasSubheader: (0, createUIKitClassname_1.createUIKitClassname)('page-header_has-subheader'),
13
16
  };
14
17
  exports.PAGE_HEADER_HEIGHT_MOBILE = '48px';
@@ -72,10 +72,16 @@ exports.MobileTitleWrapper = styled_1.styled.div `
72
72
 
73
73
  background-color: ${({ theme }) => theme.palette.background.default};
74
74
 
75
- &:not(.${constants_1.pageHeaderClassnames.hasFilters}) {
75
+ /* Причина игнора: прогрессивное улучшение */
76
+ /* stylelint-disable plugin/no-unsupported-browser-features */
77
+ &:not(:has(+ .${constants_1.pageHeaderClassnames.root} :is(
78
+ .${constants_1.pageHeaderClassnames.filters},
79
+ .${constants_1.pageHeaderClassnames.subheader}
80
+ ))) {
76
81
  border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
77
82
  }
78
-
83
+ /* stylelint-enable plugin/no-unsupported-browser-features */
84
+
79
85
  &.${constants_1.pageHeaderClassnames.hasTitle} {
80
86
  display: flex;
81
87
 
@@ -1,10 +1,9 @@
1
1
  import { type ElementType } from 'react';
2
2
  import type { PageHeaderProps } from '../types';
3
3
  type UseLogicParams<TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType> = PageHeaderProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>;
4
- export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType>({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, filters, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => {
4
+ export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType>({ shouldUpdateDocumentTitle, title, actions, htmlTitle, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => {
5
5
  isShowMobileActions: boolean | undefined;
6
6
  isLoading: boolean | undefined;
7
7
  mobileTitleActions: import("react").ReactNode;
8
- mobileClassnames: string;
9
8
  };
10
9
  export {};
@@ -3,24 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
4
  const react_1 = require("react");
5
5
  const PageContext_1 = require("../../PageContext");
6
- const classNames_1 = require("../../utils/classNames");
7
- const constants_1 = require("../constants");
8
6
  const usePageTitle_1 = require("../hooks/usePageTitle");
9
- const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, filters, }) => {
7
+ const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, }) => {
10
8
  //Переопределение Html title на title из параметров
11
9
  (0, usePageTitle_1.usePageTitle)({ shouldUpdateDocumentTitle, htmlTitle, title });
12
10
  const { mobileTitleActions, isLoading } = (0, react_1.useContext)(PageContext_1.PageContext);
13
11
  const isShowMobileActions = actions && !mobileTitleActions;
14
- const mobileClassnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderMobileTitle, {
15
- [constants_1.pageHeaderClassnames.hasTitle]: Boolean(title) || isLoading,
16
- [constants_1.pageHeaderClassnames.hasBackButton]: Boolean(backButton),
17
- [constants_1.pageHeaderClassnames.hasFilters]: Boolean(filters),
18
- }), [title, backButton, isLoading]);
19
12
  return {
20
13
  isShowMobileActions,
21
14
  isLoading,
22
15
  mobileTitleActions,
23
- mobileClassnames,
24
16
  };
25
17
  };
26
18
  exports.useLogic = useLogic;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.47.1",
3
+ "version": "4.48.1",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {