@cloud-ru/ds-uikit-product-widget 1.0.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 +8 -0
- package/LICENSE +201 -0
- package/README.md +374 -0
- package/dist/cjs/components/Widget/Widget.d.ts +2 -0
- package/dist/cjs/components/Widget/Widget.js +42 -0
- package/dist/cjs/components/Widget/index.d.ts +1 -0
- package/dist/cjs/components/Widget/index.js +17 -0
- package/dist/cjs/components/Widget/styles.module.css +284 -0
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +17 -0
- package/dist/cjs/constants.d.ts +25 -0
- package/dist/cjs/constants.js +28 -0
- package/dist/cjs/helperComponents/Actions/ActionView.d.ts +10 -0
- package/dist/cjs/helperComponents/Actions/ActionView.js +40 -0
- package/dist/cjs/helperComponents/Actions/Actions.d.ts +12 -0
- package/dist/cjs/helperComponents/Actions/Actions.js +43 -0
- package/dist/cjs/helperComponents/Actions/helpers.d.ts +21 -0
- package/dist/cjs/helperComponents/Actions/helpers.js +57 -0
- package/dist/cjs/helperComponents/Actions/index.d.ts +3 -0
- package/dist/cjs/helperComponents/Actions/index.js +21 -0
- package/dist/cjs/helperComponents/Actions/styles.module.css +46 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ActionList.d.ts +9 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ActionList.js +39 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ButtonDroplist.d.ts +2 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ButtonDroplist.js +34 -0
- package/dist/cjs/helperComponents/ButtonDroplist/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ButtonDroplist/index.js +17 -0
- package/dist/cjs/helperComponents/ButtonDroplist/styles.module.css +5 -0
- package/dist/cjs/helperComponents/ButtonKebab/ButtonKebab.d.ts +2 -0
- package/dist/cjs/helperComponents/ButtonKebab/ButtonKebab.js +18 -0
- package/dist/cjs/helperComponents/ButtonKebab/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ButtonKebab/index.js +17 -0
- package/dist/cjs/helperComponents/ButtonKebab/styles.module.css +5 -0
- package/dist/cjs/helperComponents/Content/Content.d.ts +11 -0
- package/dist/cjs/helperComponents/Content/Content.js +36 -0
- package/dist/cjs/helperComponents/Content/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Content/index.js +17 -0
- package/dist/cjs/helperComponents/Content/styles.module.css +22 -0
- package/dist/cjs/helperComponents/ControlBlock/ControlBlock.d.ts +12 -0
- package/dist/cjs/helperComponents/ControlBlock/ControlBlock.js +22 -0
- package/dist/cjs/helperComponents/ControlBlock/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ControlBlock/index.js +17 -0
- package/dist/cjs/helperComponents/ControlBlock/styles.module.css +12 -0
- package/dist/cjs/helperComponents/index.d.ts +5 -0
- package/dist/cjs/helperComponents/index.js +21 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/locale/index.d.ts +27 -0
- package/dist/cjs/locale/index.js +18 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +374 -0
- package/dist/cjs/types.d.ts +116 -0
- package/dist/cjs/types.js +2 -0
- package/dist/esm/components/Widget/Widget.d.ts +2 -0
- package/dist/esm/components/Widget/Widget.js +36 -0
- package/dist/esm/components/Widget/index.d.ts +1 -0
- package/dist/esm/components/Widget/index.js +1 -0
- package/dist/esm/components/Widget/styles.module.css +284 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/constants.d.ts +25 -0
- package/dist/esm/constants.js +25 -0
- package/dist/esm/helperComponents/Actions/ActionView.d.ts +10 -0
- package/dist/esm/helperComponents/Actions/ActionView.js +37 -0
- package/dist/esm/helperComponents/Actions/Actions.d.ts +12 -0
- package/dist/esm/helperComponents/Actions/Actions.js +37 -0
- package/dist/esm/helperComponents/Actions/helpers.d.ts +21 -0
- package/dist/esm/helperComponents/Actions/helpers.js +50 -0
- package/dist/esm/helperComponents/Actions/index.d.ts +3 -0
- package/dist/esm/helperComponents/Actions/index.js +3 -0
- package/dist/esm/helperComponents/Actions/styles.module.css +46 -0
- package/dist/esm/helperComponents/ButtonDroplist/ActionList.d.ts +9 -0
- package/dist/esm/helperComponents/ButtonDroplist/ActionList.js +33 -0
- package/dist/esm/helperComponents/ButtonDroplist/ButtonDroplist.d.ts +2 -0
- package/dist/esm/helperComponents/ButtonDroplist/ButtonDroplist.js +28 -0
- package/dist/esm/helperComponents/ButtonDroplist/index.d.ts +1 -0
- package/dist/esm/helperComponents/ButtonDroplist/index.js +1 -0
- package/dist/esm/helperComponents/ButtonDroplist/styles.module.css +5 -0
- package/dist/esm/helperComponents/ButtonKebab/ButtonKebab.d.ts +2 -0
- package/dist/esm/helperComponents/ButtonKebab/ButtonKebab.js +12 -0
- package/dist/esm/helperComponents/ButtonKebab/index.d.ts +1 -0
- package/dist/esm/helperComponents/ButtonKebab/index.js +1 -0
- package/dist/esm/helperComponents/ButtonKebab/styles.module.css +5 -0
- package/dist/esm/helperComponents/Content/Content.d.ts +11 -0
- package/dist/esm/helperComponents/Content/Content.js +30 -0
- package/dist/esm/helperComponents/Content/index.d.ts +1 -0
- package/dist/esm/helperComponents/Content/index.js +1 -0
- package/dist/esm/helperComponents/Content/styles.module.css +22 -0
- package/dist/esm/helperComponents/ControlBlock/ControlBlock.d.ts +12 -0
- package/dist/esm/helperComponents/ControlBlock/ControlBlock.js +16 -0
- package/dist/esm/helperComponents/ControlBlock/index.d.ts +1 -0
- package/dist/esm/helperComponents/ControlBlock/index.js +1 -0
- package/dist/esm/helperComponents/ControlBlock/styles.module.css +12 -0
- package/dist/esm/helperComponents/index.d.ts +5 -0
- package/dist/esm/helperComponents/index.js +5 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/locale/index.d.ts +27 -0
- package/dist/esm/locale/index.js +15 -0
- package/dist/esm/style.css +374 -0
- package/dist/esm/types.d.ts +116 -0
- package/dist/esm/types.js +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +59 -0
- package/src/components/Widget/Widget.tsx +113 -0
- package/src/components/Widget/index.ts +1 -0
- package/src/components/Widget/styles.module.scss +93 -0
- package/src/components/index.ts +1 -0
- package/src/constants.ts +27 -0
- package/src/helperComponents/Actions/ActionView.tsx +56 -0
- package/src/helperComponents/Actions/Actions.tsx +84 -0
- package/src/helperComponents/Actions/helpers.ts +84 -0
- package/src/helperComponents/Actions/index.ts +3 -0
- package/src/helperComponents/Actions/styles.module.scss +54 -0
- package/src/helperComponents/ButtonDroplist/ButtonDroplist.tsx +50 -0
- package/src/helperComponents/ButtonDroplist/index.ts +1 -0
- package/src/helperComponents/ButtonDroplist/styles.module.scss +5 -0
- package/src/helperComponents/ButtonKebab/ButtonKebab.tsx +36 -0
- package/src/helperComponents/ButtonKebab/index.ts +1 -0
- package/src/helperComponents/ButtonKebab/styles.module.scss +5 -0
- package/src/helperComponents/Content/Content.tsx +72 -0
- package/src/helperComponents/Content/index.ts +1 -0
- package/src/helperComponents/Content/styles.module.scss +26 -0
- package/src/helperComponents/ControlBlock/ControlBlock.tsx +40 -0
- package/src/helperComponents/ControlBlock/index.ts +1 -0
- package/src/helperComponents/ControlBlock/styles.module.scss +16 -0
- package/src/helperComponents/index.ts +5 -0
- package/src/index.ts +4 -0
- package/src/locale/index.ts +19 -0
- package/src/types.ts +151 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Button, VIEW } from '@cloud-ru/ds-button';
|
|
2
|
+
import { CrossSVG, UpdateSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
|
+
import { InfoBlock } from '@cloud-ru/ds-info-block';
|
|
4
|
+
import { Skeleton } from '@cloud-ru/ds-skeleton';
|
|
5
|
+
import { memo, ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
import { TEST_IDS, WIDGET_STATE } from '../../constants';
|
|
8
|
+
import { widgetLocale } from '../../locale';
|
|
9
|
+
import { WidgetErrorStateProps, WidgetLoadingStateProps, WidgetState } from '../../types';
|
|
10
|
+
import styles from './styles.module.scss';
|
|
11
|
+
|
|
12
|
+
type ContentProps = {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
state?: WidgetState;
|
|
15
|
+
wide?: boolean;
|
|
16
|
+
loadingState?: WidgetLoadingStateProps;
|
|
17
|
+
errorState?: WidgetErrorStateProps;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function ContentComponent({ children, state, wide, loadingState, errorState }: ContentProps) {
|
|
21
|
+
const { t } = widgetLocale.useTranslations();
|
|
22
|
+
switch (state) {
|
|
23
|
+
case WIDGET_STATE.Loading: {
|
|
24
|
+
if (loadingState?.loadingContent) {
|
|
25
|
+
return loadingState.loadingContent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (loadingState?.showSkeleton) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={styles.skeletonContent}>
|
|
31
|
+
<Skeleton loading width='100%' height='80px' borderRadius='8px' />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
case WIDGET_STATE.Error: {
|
|
40
|
+
return (
|
|
41
|
+
<div className={styles.errorWrapper} data-wide={wide || undefined}>
|
|
42
|
+
<InfoBlock
|
|
43
|
+
size='m'
|
|
44
|
+
className={styles.infoBlock}
|
|
45
|
+
icon={errorState?.errorIcon ?? { icon: CrossSVG, appearance: 'neutral', background: true }}
|
|
46
|
+
title={errorState?.errorTitle || t('dataErrorTitle')}
|
|
47
|
+
content={errorState?.errorDescription || t('dataErrorDescription')}
|
|
48
|
+
footer={
|
|
49
|
+
errorState?.onClickUpdate && (
|
|
50
|
+
<Button
|
|
51
|
+
size='m'
|
|
52
|
+
label={errorState?.updateButtonLabel || t('updateButtonLabel')}
|
|
53
|
+
appearance='neutral'
|
|
54
|
+
view={VIEW.Filled}
|
|
55
|
+
icon={<UpdateSVG />}
|
|
56
|
+
onClick={errorState?.onClickUpdate}
|
|
57
|
+
data-test-id={TEST_IDS.errorRetry}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
case WIDGET_STATE.Default:
|
|
67
|
+
default:
|
|
68
|
+
return children;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const Content = memo<ContentProps>(ContentComponent);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Content';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.skeletonContent {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: base.$sn-primitive-dimension-4;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.errorWrapper {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
width: 100%;
|
|
15
|
+
padding-block: base.$sn-primitive-dimension-8;
|
|
16
|
+
|
|
17
|
+
&[data-wide] {
|
|
18
|
+
padding-block: base.$sn-primitive-dimension-16;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.infoBlock {
|
|
23
|
+
justify-content: center;
|
|
24
|
+
width: 100%;
|
|
25
|
+
max-width: calc(9 * #{base.$sn-primitive-dimension-64} + #{base.$sn-primitive-dimension-48});
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SegmentControl, SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
2
|
+
import { Skeleton } from '@cloud-ru/ds-skeleton';
|
|
3
|
+
import { memo, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { TEST_IDS } from '../../constants';
|
|
6
|
+
import { WidgetAction, WidgetState } from '../../types';
|
|
7
|
+
import { Actions } from '../Actions';
|
|
8
|
+
import styles from './styles.module.scss';
|
|
9
|
+
|
|
10
|
+
type ControlBlockProps = {
|
|
11
|
+
actions?: WidgetAction[];
|
|
12
|
+
actionsChildren?: ReactNode;
|
|
13
|
+
segmentControl?: SegmentControlProps;
|
|
14
|
+
wide?: boolean;
|
|
15
|
+
state?: WidgetState;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function ControlBlockComponent({ actions, actionsChildren, segmentControl, wide, state }: ControlBlockProps) {
|
|
19
|
+
const shouldShowControl = segmentControl || state === 'loading';
|
|
20
|
+
|
|
21
|
+
if (!shouldShowControl && !wide) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const content =
|
|
26
|
+
state === 'loading' ? (
|
|
27
|
+
<Skeleton loading width='100%' height='32px' borderRadius='8px' />
|
|
28
|
+
) : (
|
|
29
|
+
segmentControl && <SegmentControl {...segmentControl} />
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className={styles.controlWrapper} data-mobile={!wide || undefined} data-test-id={TEST_IDS.control}>
|
|
34
|
+
{shouldShowControl && content}
|
|
35
|
+
{wide && <Actions actions={actions} actionsChildren={actionsChildren} wide={wide} state={state} />}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const ControlBlock = memo<ControlBlockProps>(ControlBlockComponent);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ControlBlock';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.controlWrapper {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
gap: base.$sn-primitive-dimension-8;
|
|
7
|
+
align-items: center;
|
|
8
|
+
|
|
9
|
+
&[data-mobile] {
|
|
10
|
+
width: 100%;
|
|
11
|
+
|
|
12
|
+
> * {
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineLocale, defineMessages } from '@cloud-ru/ds-locale';
|
|
2
|
+
|
|
3
|
+
const WIDGET_MESSAGES = defineMessages({
|
|
4
|
+
'en-GB': {
|
|
5
|
+
dataErrorTitle: 'Could not load data',
|
|
6
|
+
dataErrorDescription: 'Try to refresh the widget',
|
|
7
|
+
updateButtonLabel: 'Update',
|
|
8
|
+
},
|
|
9
|
+
'ru-RU': {
|
|
10
|
+
dataErrorTitle: 'Не удалось получить данные',
|
|
11
|
+
dataErrorDescription: 'Попробуйте обновить виджет',
|
|
12
|
+
updateButtonLabel: 'Обновить',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type WidgetMessages = (typeof WIDGET_MESSAGES)['en-GB'];
|
|
17
|
+
|
|
18
|
+
/** locale компонента Widget: `widgetLocale.useTranslations()` в коде, `widgetLocale.extend(...)` в сервисе. */
|
|
19
|
+
export const widgetLocale = defineLocale('@cloud-ru/ds-uikit-product-widget', WIDGET_MESSAGES);
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { ButtonProps } from '@cloud-ru/ds-button';
|
|
2
|
+
import type { InfoBlockProps } from '@cloud-ru/ds-info-block';
|
|
3
|
+
import type { SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
4
|
+
import { TooltipProps } from '@cloud-ru/ds-tooltip';
|
|
5
|
+
import { TitleClickableProps } from '@cloud-ru/ds-uikit-product-title-clickable';
|
|
6
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
7
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
8
|
+
|
|
9
|
+
import { BUTTON_TYPE } from './constants';
|
|
10
|
+
|
|
11
|
+
export type WidgetState = 'default' | 'loading' | 'error';
|
|
12
|
+
|
|
13
|
+
export type WidgetLayoutType = 'desktop' | 'mobile';
|
|
14
|
+
|
|
15
|
+
export type WidgetHeaderProps = Pick<
|
|
16
|
+
TitleClickableProps,
|
|
17
|
+
'title' | 'icon' | 'avatar' | 'href' | 'target' | 'onClick' | 'titleTag' | 'fullWidth' | 'children' | 'className'
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
export type WidgetLoadingStateProps = {
|
|
21
|
+
/** Кастомный контент для состояния загрузки. */
|
|
22
|
+
loadingContent?: ReactNode;
|
|
23
|
+
/** Показывать skeleton-заглушку в body. */
|
|
24
|
+
showSkeleton?: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type WidgetErrorStateProps = {
|
|
28
|
+
/** Заголовок ошибки. */
|
|
29
|
+
errorTitle?: string;
|
|
30
|
+
/** Описание ошибки. */
|
|
31
|
+
errorDescription?: string;
|
|
32
|
+
/** Иконка InfoBlock. */
|
|
33
|
+
errorIcon?: InfoBlockProps['icon'];
|
|
34
|
+
/** Текст кнопки повтора. */
|
|
35
|
+
updateButtonLabel?: string;
|
|
36
|
+
/** Клик по кнопке повтора. */
|
|
37
|
+
onClickUpdate: MouseEventHandler<HTMLElement>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type WidgetActionListItem = {
|
|
41
|
+
content: { label: string };
|
|
42
|
+
beforeContent?: ReactNode;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
hidden?: boolean;
|
|
45
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type WidgetActionListGroup = {
|
|
49
|
+
type: 'group';
|
|
50
|
+
label?: string;
|
|
51
|
+
divider?: boolean;
|
|
52
|
+
items: WidgetActionListItem[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type WidgetActionListEntry = WidgetActionListItem | WidgetActionListGroup;
|
|
56
|
+
|
|
57
|
+
export type WidgetActionListProps = {
|
|
58
|
+
items: WidgetActionListEntry[];
|
|
59
|
+
closeDroplistOnItemClick?: boolean;
|
|
60
|
+
className?: string;
|
|
61
|
+
open?: boolean;
|
|
62
|
+
onOpenChange?: (open: boolean) => void;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type BaseAction = {
|
|
66
|
+
/** Tooltip вокруг кнопки действия. */
|
|
67
|
+
tooltip?: TooltipProps;
|
|
68
|
+
/** Скрыть действие без удаления из массива. */
|
|
69
|
+
hidden?: boolean;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type ButtonAction = BaseAction &
|
|
73
|
+
Omit<ButtonProps<'button'>, 'view'> & {
|
|
74
|
+
variant?: typeof BUTTON_TYPE.Filled;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type OutlineAction = BaseAction &
|
|
78
|
+
Omit<ButtonProps<'button'>, 'view'> & {
|
|
79
|
+
variant: typeof BUTTON_TYPE.Outline;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type TonalAction = BaseAction &
|
|
83
|
+
Omit<ButtonProps<'button'>, 'view'> & {
|
|
84
|
+
variant: typeof BUTTON_TYPE.Tonal;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type FunctionAction = BaseAction &
|
|
88
|
+
Omit<ButtonProps<'button'>, 'view'> & {
|
|
89
|
+
variant: typeof BUTTON_TYPE.Function;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
type SimpleAction = BaseAction &
|
|
93
|
+
Omit<ButtonProps<'button'>, 'view'> & {
|
|
94
|
+
variant: typeof BUTTON_TYPE.Simple;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export type ButtonKebabProps = {
|
|
98
|
+
button?: Omit<ButtonProps<'button'>, 'label' | 'icon' | 'view'>;
|
|
99
|
+
list: WidgetActionListProps;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type ButtonDroplistProps = {
|
|
103
|
+
button:
|
|
104
|
+
| (Omit<ButtonProps<'button'>, 'appearance' | 'view'> & { buttonType?: 'filled' })
|
|
105
|
+
| (Omit<ButtonProps<'button'>, 'icon' | 'iconPosition' | 'appearance' | 'view'> & { buttonType?: 'function' });
|
|
106
|
+
list: WidgetActionListProps;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type KebabAction = BaseAction &
|
|
110
|
+
ButtonKebabProps & {
|
|
111
|
+
variant: typeof BUTTON_TYPE.Kebab;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
type DroplistAction = BaseAction &
|
|
115
|
+
ButtonDroplistProps & {
|
|
116
|
+
variant: typeof BUTTON_TYPE.Droplist;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export type Action =
|
|
120
|
+
| ButtonAction
|
|
121
|
+
| OutlineAction
|
|
122
|
+
| TonalAction
|
|
123
|
+
| FunctionAction
|
|
124
|
+
| SimpleAction
|
|
125
|
+
| KebabAction
|
|
126
|
+
| DroplistAction;
|
|
127
|
+
|
|
128
|
+
export type WidgetAction = Action;
|
|
129
|
+
|
|
130
|
+
export type WidgetProps = WithSupportProps<{
|
|
131
|
+
/** Пропсы кликабельного заголовка. */
|
|
132
|
+
header: WidgetHeaderProps;
|
|
133
|
+
/** Контент виджета. */
|
|
134
|
+
children: ReactNode;
|
|
135
|
+
/** Действия в шапке/footer. */
|
|
136
|
+
actions?: Action[];
|
|
137
|
+
/** Дополнительный слот рядом с действиями. */
|
|
138
|
+
actionsChildren?: ReactNode;
|
|
139
|
+
/** Пропсы SegmentControl в шапке. */
|
|
140
|
+
segmentControl?: SegmentControlProps;
|
|
141
|
+
/** Только desktop: wide-раскладка виджета. На mobile принудительно выключается (`wide && !isMobile`). */
|
|
142
|
+
wide?: boolean;
|
|
143
|
+
/** Состояние виджета. */
|
|
144
|
+
state?: WidgetState;
|
|
145
|
+
/** Настройки loading-состояния. */
|
|
146
|
+
loadingState?: WidgetLoadingStateProps;
|
|
147
|
+
/** Настройки error-состояния. */
|
|
148
|
+
errorState?: WidgetErrorStateProps;
|
|
149
|
+
/** Дополнительный CSS-класс. */
|
|
150
|
+
className?: string;
|
|
151
|
+
}>;
|