@cloud-ru/ds-uikit-product-page-layout 2.1.2-preview-c0e895ed.0 → 2.2.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/CHANGELOG.md +6 -0
- package/README.md +11 -85
- package/dist/cjs/components/Actions/ActionView.d.ts +1 -1
- package/dist/cjs/components/Actions/ActionView.js +2 -6
- package/dist/cjs/components/Actions/MobileActions.js +1 -20
- package/dist/cjs/components/Actions/styles.module.css +0 -5
- package/dist/cjs/components/Actions/types.d.ts +7 -18
- package/dist/cjs/components/PageForm/styles.module.css +3 -4
- package/dist/cjs/components/PageServices/MobilePageServices.d.ts +2 -2
- package/dist/cjs/components/PageServices/MobilePageServices.js +2 -2
- package/dist/cjs/style.css +3 -9
- package/dist/esm/components/Actions/ActionView.d.ts +1 -1
- package/dist/esm/components/Actions/ActionView.js +2 -6
- package/dist/esm/components/Actions/MobileActions.js +2 -21
- package/dist/esm/components/Actions/styles.module.css +0 -5
- package/dist/esm/components/Actions/types.d.ts +7 -18
- package/dist/esm/components/PageForm/styles.module.css +3 -4
- package/dist/esm/components/PageServices/MobilePageServices.d.ts +2 -2
- package/dist/esm/components/PageServices/MobilePageServices.js +2 -2
- package/dist/esm/style.css +3 -9
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +22 -22
- package/src/components/Actions/ActionView.tsx +9 -8
- package/src/components/Actions/MobileActions.tsx +2 -19
- package/src/components/Actions/styles.module.scss +0 -4
- package/src/components/Actions/types.ts +7 -16
- package/src/components/PageForm/styles.module.scss +2 -4
- package/src/components/PageServices/MobilePageServices.tsx +1 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/ds-uikit-product-page-layout",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Набор страничных раскладок продуктового кабинета — каталог, детальная страница сервиса, форма, дерево-навигация, сайдбар и общие слоты — с адаптацией desktop/mobile через AdaptiveProvider.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,27 +40,27 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"classnames": "^2.5.1",
|
|
43
|
-
"@cloud-ru/ds-adaptive": "1.0.4
|
|
44
|
-
"@cloud-ru/ds-
|
|
45
|
-
"@cloud-ru/ds-
|
|
46
|
-
"@cloud-ru/ds-
|
|
47
|
-
"@cloud-ru/ds-
|
|
48
|
-
"@cloud-ru/ds-list": "3.1.2
|
|
49
|
-
"@cloud-ru/ds-
|
|
50
|
-
"@cloud-ru/ds-
|
|
51
|
-
"@cloud-ru/ds-
|
|
52
|
-
"@cloud-ru/ds-
|
|
53
|
-
"@cloud-ru/ds-
|
|
54
|
-
"@cloud-ru/ds-
|
|
55
|
-
"@cloud-ru/ds-
|
|
56
|
-
"@cloud-ru/ds-
|
|
57
|
-
"@cloud-ru/ds-
|
|
58
|
-
"@cloud-ru/ds-
|
|
59
|
-
"@cloud-ru/ds-
|
|
60
|
-
"@cloud-ru/ds-
|
|
61
|
-
"@cloud-ru/ds-uikit-product-
|
|
62
|
-
"@cloud-ru/ds-
|
|
63
|
-
"@cloud-ru/ds-
|
|
43
|
+
"@cloud-ru/ds-adaptive": "^1.0.4",
|
|
44
|
+
"@cloud-ru/ds-block": "^1.0.5",
|
|
45
|
+
"@cloud-ru/ds-icon-predefined": "^1.0.5",
|
|
46
|
+
"@cloud-ru/ds-dropdown": "^1.2.2",
|
|
47
|
+
"@cloud-ru/ds-button": "^1.0.6",
|
|
48
|
+
"@cloud-ru/ds-list": "^3.1.2",
|
|
49
|
+
"@cloud-ru/ds-icons": "^1.7.3",
|
|
50
|
+
"@cloud-ru/ds-loader": "^1.0.5",
|
|
51
|
+
"@cloud-ru/ds-locale": "^1.0.0",
|
|
52
|
+
"@cloud-ru/ds-modal": "^2.1.2",
|
|
53
|
+
"@cloud-ru/ds-popover": "^1.1.4",
|
|
54
|
+
"@cloud-ru/ds-status": "^1.1.17",
|
|
55
|
+
"@cloud-ru/ds-search": "^1.0.20",
|
|
56
|
+
"@cloud-ru/ds-tooltip": "^1.0.19",
|
|
57
|
+
"@cloud-ru/ds-tree": "^1.0.45",
|
|
58
|
+
"@cloud-ru/ds-typography": "^1.0.2",
|
|
59
|
+
"@cloud-ru/ds-uikit-product-copy": "^1.1.19",
|
|
60
|
+
"@cloud-ru/ds-truncate-string": "^1.0.20",
|
|
61
|
+
"@cloud-ru/ds-uikit-product-button-predefined": "^1.0.45",
|
|
62
|
+
"@cloud-ru/ds-uikit-product-quota": "^2.1.0",
|
|
63
|
+
"@cloud-ru/ds-utils": "^1.4.0"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
@@ -16,16 +16,17 @@ type CommonProps = { className?: string; size?: Size; fullWidth?: boolean };
|
|
|
16
16
|
* `@ds`-примитивы, которые берут раскладку из `AdaptiveProvider`. Раскладку фиксируют обёртки
|
|
17
17
|
* `DesktopActions` / `MobileActions` (`withLayoutType`), поэтому отдельный проп `layoutType` не нужен.
|
|
18
18
|
*/
|
|
19
|
-
export function ActionView({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
export function ActionView({
|
|
20
|
+
variant,
|
|
21
|
+
tooltip,
|
|
22
|
+
hidden = false,
|
|
23
|
+
commonProps,
|
|
24
|
+
...buttonProps
|
|
25
|
+
}: Action & { commonProps: CommonProps }) {
|
|
26
|
+
if (hidden) {
|
|
27
|
+
return null;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
const { variant, ...buttonProps } = action;
|
|
28
|
-
|
|
29
30
|
// disableSpanWrapper — кнопка остаётся ПРЯМЫМ flex-потомком контейнера действий: без него Tooltip
|
|
30
31
|
// добавляет span-обёртку (`flex:0 1 auto`), и `fullWidth`-кнопка (`flex:1 1 0`) не растягивается на
|
|
31
32
|
// всю ширину (mobile: 2 действия должны делить строку). Как в MobilePageForm ButtonGroup.
|
|
@@ -5,7 +5,7 @@ import { Droplist, DroplistProps, Item } from '@cloud-ru/ds-list';
|
|
|
5
5
|
import { Tooltip } from '@cloud-ru/ds-tooltip';
|
|
6
6
|
import { quotaLocale, QuotaWidget } from '@cloud-ru/ds-uikit-product-quota';
|
|
7
7
|
import { useDynamicList } from '@cloud-ru/ds-utils';
|
|
8
|
-
import { MouseEvent, ReactNode,
|
|
8
|
+
import { MouseEvent, ReactNode, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { TEST_IDS } from '../../constants';
|
|
11
11
|
import { ActionView } from './ActionView';
|
|
@@ -27,12 +27,7 @@ function MobileActionsBase({ items, maxVisibleItems }: ActionsProps) {
|
|
|
27
27
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
28
28
|
|
|
29
29
|
const [isOpen, setIsOpen] = useState(false);
|
|
30
|
-
const
|
|
31
|
-
const { visibleItems, hiddenItems } = useDynamicList({
|
|
32
|
-
parentContainerRef: containerRef,
|
|
33
|
-
items: availableItems,
|
|
34
|
-
maxVisibleItems,
|
|
35
|
-
});
|
|
30
|
+
const { visibleItems, hiddenItems } = useDynamicList({ parentContainerRef: containerRef, items, maxVisibleItems });
|
|
36
31
|
|
|
37
32
|
const { t: tQuota } = quotaLocale.useTranslations();
|
|
38
33
|
|
|
@@ -44,18 +39,6 @@ function MobileActionsBase({ items, maxVisibleItems }: ActionsProps) {
|
|
|
44
39
|
const visibleItemsWithoutKebab = visibleItems.filter(item => item.variant !== BUTTON_TYPE.Kebab);
|
|
45
40
|
|
|
46
41
|
const droplistItems = hiddenItemsWithKebab.reduce<Item[]>((acc, action) => {
|
|
47
|
-
if (action.hidden) return acc;
|
|
48
|
-
if (action.type === 'custom') {
|
|
49
|
-
const { asListItem } = action.render();
|
|
50
|
-
acc.push({
|
|
51
|
-
...asListItem,
|
|
52
|
-
onClick: (event: MouseEvent<HTMLElement>) => {
|
|
53
|
-
setIsOpen(false);
|
|
54
|
-
if ('onClick' in asListItem) asListItem.onClick?.(event);
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
return acc;
|
|
58
|
-
}
|
|
59
42
|
switch (action.variant) {
|
|
60
43
|
case BUTTON_TYPE.Tonal:
|
|
61
44
|
case BUTTON_TYPE.Simple:
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ButtonProps } from '@cloud-ru/ds-button';
|
|
2
|
-
import { Item } from '@cloud-ru/ds-list';
|
|
3
2
|
import { TooltipProps } from '@cloud-ru/ds-tooltip';
|
|
4
3
|
import { ButtonDropdownProps } from '@cloud-ru/ds-uikit-product-button-predefined';
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
4
|
|
|
7
5
|
import { ButtonDroplistProps } from './buttons/ButtonDroplist';
|
|
8
6
|
import { ButtonKebabProps } from './buttons/ButtonKebab';
|
|
@@ -16,20 +14,13 @@ import { BUTTON_TYPE } from './constants';
|
|
|
16
14
|
export type ActionButtonProps =
|
|
17
15
|
(ButtonProps & { href?: never; target?: never }) | (Omit<ButtonProps<'a'>, 'as'> & { as: 'a' });
|
|
18
16
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
render(): { default: ReactNode; asListItem: Item };
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type Action = CustomAction | StandardAction;
|
|
30
|
-
|
|
31
|
-
type StandardAction = {
|
|
32
|
-
type?: never;
|
|
17
|
+
/**
|
|
18
|
+
* Action — один элемент панели действий. Дискриминированный union по `variant` (`BUTTON_TYPE`).
|
|
19
|
+
* Простые кнопки (`filled`/`outline`/`tonal`/`function`/`simple`) маппятся на единый `Button` из
|
|
20
|
+
* `@cloud-ru/ds-button` с соответствующим `view`; составные (`dropdown`/`kebab`/`droplist`/`quota`) — на
|
|
21
|
+
* предопределённые обёртки.
|
|
22
|
+
*/
|
|
23
|
+
export type Action = {
|
|
33
24
|
tooltip?: TooltipProps;
|
|
34
25
|
hidden?: boolean;
|
|
35
26
|
} & (
|
|
@@ -7,11 +7,10 @@ $card-padding: block.$sn-block-anatomy-l-padding;
|
|
|
7
7
|
.container {
|
|
8
8
|
display: flex;
|
|
9
9
|
gap: base.$sn-primitive-dimension-24;
|
|
10
|
-
justify-content:
|
|
10
|
+
justify-content: center;
|
|
11
11
|
|
|
12
12
|
box-sizing: border-box;
|
|
13
|
-
width:
|
|
14
|
-
min-width: 0;
|
|
13
|
+
min-width: fit-content;
|
|
15
14
|
min-height: 100%;
|
|
16
15
|
padding: base.$sn-density-spacing-interval-l;
|
|
17
16
|
}
|
|
@@ -115,7 +114,6 @@ $card-padding: block.$sn-block-anatomy-l-padding;
|
|
|
115
114
|
|
|
116
115
|
display: flex;
|
|
117
116
|
flex-direction: column;
|
|
118
|
-
flex-shrink: 0;
|
|
119
117
|
gap: base.$sn-primitive-dimension-4;
|
|
120
118
|
align-self: flex-start;
|
|
121
119
|
// 304px — фиксированная ширина боковой колонки, токена нет.
|
|
@@ -9,7 +9,7 @@ import styles from './mobileStyles.module.scss';
|
|
|
9
9
|
|
|
10
10
|
export type MobilePageServicesProps = WithSupportProps<
|
|
11
11
|
PropsWithChildren<
|
|
12
|
-
Pick<HeadlineProps, 'title' | 'slotBeforeTitle' | 'subtitle' | 'slotAfterTitle'
|
|
12
|
+
Pick<HeadlineProps, 'title' | 'slotBeforeTitle' | 'subtitle' | 'slotAfterTitle'> & {
|
|
13
13
|
className?: string;
|
|
14
14
|
sidebar?: SidebarSelectProps;
|
|
15
15
|
actions?: ActionsProps['items'];
|
|
@@ -28,7 +28,6 @@ export function MobilePageServices({
|
|
|
28
28
|
subtitle,
|
|
29
29
|
slotBeforeTitle,
|
|
30
30
|
maxVisibleActionsItems,
|
|
31
|
-
truncateTitle,
|
|
32
31
|
...rest
|
|
33
32
|
}: MobilePageServicesProps) {
|
|
34
33
|
return (
|
|
@@ -37,7 +36,6 @@ export function MobilePageServices({
|
|
|
37
36
|
<div className={styles.headlineWrapper}>
|
|
38
37
|
<Headline
|
|
39
38
|
title={title}
|
|
40
|
-
truncateTitle={truncateTitle}
|
|
41
39
|
slotBeforeTitle={slotBeforeTitle}
|
|
42
40
|
slotAfterTitle={slotAfterTitle}
|
|
43
41
|
subtitle={subtitle}
|