@astral/ui 4.104.2 → 4.105.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/ActionGroup/MainActions/ActionNode/ActionNode.d.ts +9 -0
- package/components/ActionGroup/MainActions/ActionNode/ActionNode.js +30 -0
- package/components/ActionGroup/MainActions/ActionNode/index.d.ts +1 -0
- package/components/ActionGroup/MainActions/ActionNode/index.js +1 -0
- package/components/ActionGroup/MainActions/MainActions.d.ts +1 -1
- package/components/ActionGroup/MainActions/MainActions.js +3 -14
- package/components/ActionGroup/MainActions/hooks/useMainActions/useMainActions.d.ts +352 -3
- package/components/ActionGroup/MainActions/hooks/useMainActions/useMainActions.js +33 -6
- package/components/ActionGroup/MainActions/index.d.ts +1 -0
- package/components/ActionGroup/MainActions/index.js +1 -0
- package/components/ActionGroup/MainActions/styles.d.ts +5 -6
- package/components/ActionGroup/MainActions/styles.js +6 -7
- package/components/ActionGroup/SecondaryVisibleActions/ActionNode/ActionNode.d.ts +12 -0
- package/components/ActionGroup/SecondaryVisibleActions/ActionNode/ActionNode.js +30 -0
- package/components/ActionGroup/SecondaryVisibleActions/ActionNode/index.d.ts +1 -0
- package/components/ActionGroup/SecondaryVisibleActions/ActionNode/index.js +1 -0
- package/components/ActionGroup/SecondaryVisibleActions/SecondaryVisibleActions.d.ts +1 -1
- package/components/ActionGroup/SecondaryVisibleActions/SecondaryVisibleActions.js +3 -7
- package/components/ActionGroup/constants.d.ts +3 -0
- package/components/ActionGroup/constants.js +4 -0
- package/components/ActionGroup/index.d.ts +2 -1
- package/components/ActionGroup/index.js +1 -0
- package/components/ActionGroup/public.d.ts +2 -1
- package/components/ActionGroup/public.js +1 -0
- package/components/ActionGroup/styles.js +5 -0
- package/components/ActionGroup/types.d.ts +48 -6
- package/components/PageHeader/MobilePageActions/MobilePageActions.js +2 -2
- package/components/PageHeader/MobilePageActions/useLogic/useLogic.d.ts +1 -0
- package/components/PageHeader/MobilePageActions/useLogic/useLogic.js +3 -0
- package/components/PageHeader/PageActions/MainActions/MainActions.d.ts +1 -1
- package/components/PageHeader/PageActions/MainActions/MainActions.js +2 -2
- package/components/PageHeader/PageActions/MainActions/styles.js +5 -0
- package/components/PageHeader/PageActions/PageActions.js +2 -2
- package/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.d.ts +1 -1
- package/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.js +3 -3
- package/components/PageHeader/PageActions/SecondaryVisibleActions/styles.d.ts +7 -1
- package/components/PageHeader/PageActions/useLogic/useLogic.d.ts +1 -0
- package/components/PageHeader/PageActions/useLogic/useLogic.js +3 -0
- package/components/index.d.ts +1 -1
- package/node/components/ActionGroup/MainActions/ActionNode/ActionNode.d.ts +9 -0
- package/node/components/ActionGroup/MainActions/ActionNode/ActionNode.js +34 -0
- package/node/components/ActionGroup/MainActions/ActionNode/index.d.ts +1 -0
- package/node/components/ActionGroup/MainActions/ActionNode/index.js +17 -0
- package/node/components/ActionGroup/MainActions/MainActions.d.ts +1 -1
- package/node/components/ActionGroup/MainActions/MainActions.js +3 -14
- package/node/components/ActionGroup/MainActions/hooks/useMainActions/useMainActions.d.ts +352 -3
- package/node/components/ActionGroup/MainActions/hooks/useMainActions/useMainActions.js +33 -6
- package/node/components/ActionGroup/MainActions/index.d.ts +1 -0
- package/node/components/ActionGroup/MainActions/index.js +1 -0
- package/node/components/ActionGroup/MainActions/styles.d.ts +5 -6
- package/node/components/ActionGroup/MainActions/styles.js +7 -8
- package/node/components/ActionGroup/SecondaryVisibleActions/ActionNode/ActionNode.d.ts +12 -0
- package/node/components/ActionGroup/SecondaryVisibleActions/ActionNode/ActionNode.js +34 -0
- package/node/components/ActionGroup/SecondaryVisibleActions/ActionNode/index.d.ts +1 -0
- package/node/components/ActionGroup/SecondaryVisibleActions/ActionNode/index.js +17 -0
- package/node/components/ActionGroup/SecondaryVisibleActions/SecondaryVisibleActions.d.ts +1 -1
- package/node/components/ActionGroup/SecondaryVisibleActions/SecondaryVisibleActions.js +3 -7
- package/node/components/ActionGroup/constants.d.ts +3 -0
- package/node/components/ActionGroup/constants.js +7 -0
- package/node/components/ActionGroup/index.d.ts +2 -1
- package/node/components/ActionGroup/index.js +3 -1
- package/node/components/ActionGroup/public.d.ts +2 -1
- package/node/components/ActionGroup/public.js +3 -1
- package/node/components/ActionGroup/styles.js +5 -0
- package/node/components/ActionGroup/types.d.ts +48 -6
- package/node/components/PageHeader/MobilePageActions/MobilePageActions.js +2 -2
- package/node/components/PageHeader/MobilePageActions/useLogic/useLogic.d.ts +1 -0
- package/node/components/PageHeader/MobilePageActions/useLogic/useLogic.js +3 -0
- package/node/components/PageHeader/PageActions/MainActions/MainActions.d.ts +1 -1
- package/node/components/PageHeader/PageActions/MainActions/MainActions.js +2 -2
- package/node/components/PageHeader/PageActions/MainActions/styles.js +5 -0
- package/node/components/PageHeader/PageActions/PageActions.js +2 -2
- package/node/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.d.ts +1 -1
- package/node/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.js +3 -3
- package/node/components/PageHeader/PageActions/SecondaryVisibleActions/styles.d.ts +7 -1
- package/node/components/PageHeader/PageActions/useLogic/useLogic.d.ts +1 -0
- package/node/components/PageHeader/PageActions/useLogic/useLogic.js +3 -0
- package/node/components/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ActionGroup } from './ActionGroup';
|
|
2
|
+
export { actionGroupClassnames } from './constants';
|
|
2
3
|
export * from './hooks';
|
|
3
4
|
export { MainActions, useMainActions } from './MainActions';
|
|
4
5
|
export { SecondaryActions } from './SecondaryActions';
|
|
5
6
|
export { SecondaryVisibleActions } from './SecondaryVisibleActions';
|
|
6
|
-
export type { ActionGroupProps, MainAction, MainActionsProps, SecondaryAction, SecondaryActionProps, SecondaryVisibleAction, SecondaryVisibleActionProps, } from './types';
|
|
7
|
+
export type { ActionElementProps, ActionGroupProps, ActionRenderContext, MainAction, MainActionsProps, NestedActionRenderContext, SecondaryAction, SecondaryActionProps, SecondaryVisibleAction, SecondaryVisibleActionProps, } from './types';
|
|
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.SecondaryVisibleActions = exports.SecondaryActions = exports.useMainActions = exports.MainActions = exports.ActionGroup = void 0;
|
|
17
|
+
exports.SecondaryVisibleActions = exports.SecondaryActions = exports.useMainActions = exports.MainActions = exports.actionGroupClassnames = exports.ActionGroup = void 0;
|
|
18
18
|
var ActionGroup_1 = require("./ActionGroup");
|
|
19
19
|
Object.defineProperty(exports, "ActionGroup", { enumerable: true, get: function () { return ActionGroup_1.ActionGroup; } });
|
|
20
|
+
var constants_1 = require("./constants");
|
|
21
|
+
Object.defineProperty(exports, "actionGroupClassnames", { enumerable: true, get: function () { return constants_1.actionGroupClassnames; } });
|
|
20
22
|
__exportStar(require("./hooks"), exports);
|
|
21
23
|
var MainActions_1 = require("./MainActions");
|
|
22
24
|
Object.defineProperty(exports, "MainActions", { enumerable: true, get: function () { return MainActions_1.MainActions; } });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ActionGroup } from './ActionGroup';
|
|
2
|
+
export { actionGroupClassnames } from './constants';
|
|
2
3
|
export * from './hooks';
|
|
3
4
|
export { MainActions, useMainActions } from './MainActions';
|
|
4
5
|
export { SecondaryActions } from './SecondaryActions';
|
|
5
6
|
export { SecondaryVisibleActions } from './SecondaryVisibleActions';
|
|
6
|
-
export type { ActionGroupProps, MainAction, MainActionsProps, SecondaryActionProps, SecondaryVisibleActionProps, } from './types';
|
|
7
|
+
export type { ActionElementProps, ActionGroupProps, ActionRenderContext, MainAction, MainActionsProps, NestedActionRenderContext, SecondaryActionProps, SecondaryVisibleActionProps, } from './types';
|
|
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.SecondaryVisibleActions = exports.SecondaryActions = exports.useMainActions = exports.MainActions = exports.ActionGroup = void 0;
|
|
17
|
+
exports.SecondaryVisibleActions = exports.SecondaryActions = exports.useMainActions = exports.MainActions = exports.actionGroupClassnames = exports.ActionGroup = void 0;
|
|
18
18
|
var ActionGroup_1 = require("./ActionGroup");
|
|
19
19
|
Object.defineProperty(exports, "ActionGroup", { enumerable: true, get: function () { return ActionGroup_1.ActionGroup; } });
|
|
20
|
+
var constants_1 = require("./constants");
|
|
21
|
+
Object.defineProperty(exports, "actionGroupClassnames", { enumerable: true, get: function () { return constants_1.actionGroupClassnames; } });
|
|
20
22
|
__exportStar(require("./hooks"), exports);
|
|
21
23
|
var MainActions_1 = require("./MainActions");
|
|
22
24
|
Object.defineProperty(exports, "MainActions", { enumerable: true, get: function () { return MainActions_1.MainActions; } });
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Wrapper = void 0;
|
|
4
4
|
const styled_1 = require("../styled");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
5
6
|
exports.Wrapper = styled_1.styled.div `
|
|
6
7
|
display: flex;
|
|
7
8
|
gap: ${({ theme }) => theme.spacing(2)};
|
|
9
|
+
|
|
10
|
+
.${constants_1.actionGroupClassnames.action} {
|
|
11
|
+
flex-grow: 1;
|
|
12
|
+
}
|
|
8
13
|
`;
|
|
@@ -1,9 +1,51 @@
|
|
|
1
|
-
import type { ComponentProps, ElementType, ReactNode } from 'react';
|
|
1
|
+
import type { ComponentProps, ElementType, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { ButtonProps, ButtonSize } from '../Button';
|
|
3
3
|
import type { DropdownButtonProps } from '../DropdownButton';
|
|
4
4
|
import type { ListItemButtonProps } from '../ListItemButton';
|
|
5
5
|
import type { MenuItemProps } from '../MenuItem';
|
|
6
6
|
import type { TooltipProps } from '../Tooltip';
|
|
7
|
+
/** Свойства стандартного элемента действия, из которых продукт может собрать собственный элемент в `renderAction` */
|
|
8
|
+
export type ActionElementProps = {
|
|
9
|
+
/** Содержимое действия: название */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** Признак блокировки действия */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Признак загрузки действия */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
/** Обработчик нажатия на действие */
|
|
16
|
+
onClick?: ButtonProps['onClick'];
|
|
17
|
+
/** Размер, совпадающий с размером группы действий */
|
|
18
|
+
size: ButtonSize;
|
|
19
|
+
/** Класс, отвечающий за поведение действия в ряду группы */
|
|
20
|
+
className: string;
|
|
21
|
+
};
|
|
22
|
+
/** Контекст renderAction */
|
|
23
|
+
export type ActionRenderContext = {
|
|
24
|
+
/** Стандартный элемент действия */
|
|
25
|
+
defaultElement: ReactElement;
|
|
26
|
+
/** Свойства действия */
|
|
27
|
+
elementProps: ActionElementProps;
|
|
28
|
+
/** DOM-узел действия */
|
|
29
|
+
anchorEl: HTMLElement | null;
|
|
30
|
+
};
|
|
31
|
+
/** Контекст renderAction у действия с выпадающим списком */
|
|
32
|
+
export type NestedActionRenderContext = Pick<ActionRenderContext, 'defaultElement'>;
|
|
33
|
+
type WithRenderAction<TContext = ActionRenderContext> = {
|
|
34
|
+
/**
|
|
35
|
+
* Подменяет отображение действия: стандартный элемент можно обернуть
|
|
36
|
+
* или собрать заново из `elementProps`
|
|
37
|
+
*/
|
|
38
|
+
renderAction?: (context: TContext) => ReactNode;
|
|
39
|
+
};
|
|
40
|
+
type WithRenderActionDisabled = {
|
|
41
|
+
/**
|
|
42
|
+
* Отключает вызов `renderAction` — для копии действий, скрытой через css:
|
|
43
|
+
* попап из подмены открывается в портале, и css его не прячет
|
|
44
|
+
*
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
isRenderActionDisabled?: boolean;
|
|
48
|
+
};
|
|
7
49
|
type NestedAction = MenuItemProps & {
|
|
8
50
|
/** Название действия */
|
|
9
51
|
text: string;
|
|
@@ -33,7 +75,7 @@ export type SingleAction<TMainActionComponent extends ElementType> = Omit<Button
|
|
|
33
75
|
* Компонент, используемый для корневого узла. Либо строка для использования элемента HTML, либо компонент
|
|
34
76
|
*/
|
|
35
77
|
component?: TMainActionComponent;
|
|
36
|
-
} & Omit<ComponentProps<ElementType extends TMainActionComponent ? 'button' : TMainActionComponent>, ''>;
|
|
78
|
+
} & WithRenderAction & Omit<ComponentProps<ElementType extends TMainActionComponent ? 'button' : TMainActionComponent>, ''>;
|
|
37
79
|
export type MultipleAction<TMainActionComponent extends ElementType> = Omit<DropdownButtonProps, 'children' | 'name' | 'component'> & {
|
|
38
80
|
/**
|
|
39
81
|
* Флаг показа выпадающего списка при клике
|
|
@@ -63,7 +105,7 @@ export type MultipleAction<TMainActionComponent extends ElementType> = Omit<Drop
|
|
|
63
105
|
* Компонент, используемый для корневого узла. Либо строка для использования элемента HTML, либо компонент
|
|
64
106
|
*/
|
|
65
107
|
component?: TMainActionComponent;
|
|
66
|
-
} & Omit<ComponentProps<ElementType extends TMainActionComponent ? 'button' : TMainActionComponent>, ''>;
|
|
108
|
+
} & WithRenderAction<NestedActionRenderContext> & Omit<ComponentProps<ElementType extends TMainActionComponent ? 'button' : TMainActionComponent>, ''>;
|
|
67
109
|
/** Модель основного экшена */
|
|
68
110
|
export type MainAction<TMainActionComponent extends ElementType> = SingleAction<TMainActionComponent> | MultipleAction<TMainActionComponent>;
|
|
69
111
|
export type MainActionsProps<TMainActionComponent extends ElementType> = {
|
|
@@ -73,7 +115,7 @@ export type MainActionsProps<TMainActionComponent extends ElementType> = {
|
|
|
73
115
|
*/
|
|
74
116
|
isDisabled?: boolean;
|
|
75
117
|
size?: ButtonSize;
|
|
76
|
-
};
|
|
118
|
+
} & WithRenderActionDisabled;
|
|
77
119
|
/** Модель второстепенного экшена */
|
|
78
120
|
export type SecondaryAction<TSecondaryActionComponent extends ElementType> = Omit<ListItemButtonProps, 'children' | 'component'> & {
|
|
79
121
|
/**
|
|
@@ -114,7 +156,7 @@ export type SecondaryVisibleAction = Omit<ButtonProps, 'children'> & {
|
|
|
114
156
|
* Если true, блокирует взаимодействие с actions
|
|
115
157
|
*/
|
|
116
158
|
isBlockingOperation?: boolean;
|
|
117
|
-
};
|
|
159
|
+
} & WithRenderAction;
|
|
118
160
|
export type SecondaryVisibleActionProps = {
|
|
119
161
|
/**
|
|
120
162
|
* Видимые второстепенные действия
|
|
@@ -125,7 +167,7 @@ export type SecondaryVisibleActionProps = {
|
|
|
125
167
|
*/
|
|
126
168
|
className?: string;
|
|
127
169
|
size?: ButtonSize;
|
|
128
|
-
};
|
|
170
|
+
} & WithRenderActionDisabled;
|
|
129
171
|
export type ActionGroupProps<TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType> = {
|
|
130
172
|
/**
|
|
131
173
|
* Основные действия
|
|
@@ -6,11 +6,11 @@ const PageActions_1 = require("../PageActions");
|
|
|
6
6
|
const styles_1 = require("./styles");
|
|
7
7
|
const useLogic_1 = require("./useLogic");
|
|
8
8
|
const MobilePageActions = (props) => {
|
|
9
|
-
const { disabledAction, isActive, handleToggle, visibleMainActions, hiddenMainActions, isVisibleShowMoreButton, isLoading, } = (0, useLogic_1.useLogic)(props);
|
|
9
|
+
const { disabledAction, isRenderActionDisabled, isActive, handleToggle, visibleMainActions, hiddenMainActions, isVisibleShowMoreButton, isLoading, } = (0, useLogic_1.useLogic)(props);
|
|
10
10
|
const { secondary, secondaryVisible, className } = props;
|
|
11
11
|
if (isLoading) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, role: "presentation", children: [(0, jsx_runtime_1.jsxs)(styles_1.ActionWrapper, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledMainActions, { actions: visibleMainActions, isDisabled: disabledAction, "$isVisibleShowMoreButton": isVisibleShowMoreButton, size: "large" }), (0, jsx_runtime_1.jsxs)(styles_1.StyledCollapse, { in: isActive, children: [(0, jsx_runtime_1.jsx)(PageActions_1.MainActions, { isDisabled: disabledAction, actions: hiddenMainActions, size: "large" }), (0, jsx_runtime_1.jsxs)(styles_1.SecondaryActionsWrapper, { children: [secondaryVisible && ((0, jsx_runtime_1.jsx)(PageActions_1.SecondaryVisibleActions, { actions: secondaryVisible, size: "large" })), secondary && ((0, jsx_runtime_1.jsx)(PageActions_1.SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: "large" }))] })] })] }), isVisibleShowMoreButton && ((0, jsx_runtime_1.jsx)(styles_1.ShowMoreButton, { onClick: handleToggle, children: isActive ? 'Скрыть другие действия' : 'Показать другие действия' }))] }));
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, role: "presentation", children: [(0, jsx_runtime_1.jsxs)(styles_1.ActionWrapper, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledMainActions, { actions: visibleMainActions, isDisabled: disabledAction, "$isVisibleShowMoreButton": isVisibleShowMoreButton, size: "large", isRenderActionDisabled: isRenderActionDisabled }), (0, jsx_runtime_1.jsxs)(styles_1.StyledCollapse, { in: isActive, children: [(0, jsx_runtime_1.jsx)(PageActions_1.MainActions, { isDisabled: disabledAction, actions: hiddenMainActions, size: "large", isRenderActionDisabled: isRenderActionDisabled }), (0, jsx_runtime_1.jsxs)(styles_1.SecondaryActionsWrapper, { children: [secondaryVisible && ((0, jsx_runtime_1.jsx)(PageActions_1.SecondaryVisibleActions, { actions: secondaryVisible, size: "large", isRenderActionDisabled: true })), secondary && ((0, jsx_runtime_1.jsx)(PageActions_1.SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: "large" }))] })] })] }), isVisibleShowMoreButton && ((0, jsx_runtime_1.jsx)(styles_1.ShowMoreButton, { onClick: handleToggle, children: isActive ? 'Скрыть другие действия' : 'Показать другие действия' }))] }));
|
|
15
15
|
};
|
|
16
16
|
exports.MobilePageActions = MobilePageActions;
|
|
@@ -3,6 +3,7 @@ import { type MobilePageActionsProps } from '../MobilePageActions';
|
|
|
3
3
|
type UseLogicParams<TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType> = MobilePageActionsProps<TMainActionComponent, TSecondaryActionComponent>;
|
|
4
4
|
export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType>({ main, secondary, secondaryVisible, isLoading, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent>) => {
|
|
5
5
|
disabledAction: boolean;
|
|
6
|
+
isRenderActionDisabled: boolean;
|
|
6
7
|
isActive: boolean;
|
|
7
8
|
handleToggle: () => void;
|
|
8
9
|
visibleMainActions: import("../../../ActionGroup").MainAction<TMainActionComponent>[] | undefined;
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const ActionGroup_1 = require("../../../ActionGroup");
|
|
6
|
+
const useViewportType_1 = require("../../../useViewportType");
|
|
6
7
|
const useLogic = ({ main, secondary, secondaryVisible, isLoading, }) => {
|
|
7
8
|
const [isActive, setIsActive] = (0, react_1.useState)(false);
|
|
8
9
|
const { disabledAction } = (0, ActionGroup_1.useActionsState)({ main, secondary });
|
|
10
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
9
11
|
const handleToggle = () => {
|
|
10
12
|
setIsActive(!isActive);
|
|
11
13
|
};
|
|
@@ -13,6 +15,7 @@ const useLogic = ({ main, secondary, secondaryVisible, isLoading, }) => {
|
|
|
13
15
|
const hiddenMainActions = main?.slice(2);
|
|
14
16
|
return {
|
|
15
17
|
disabledAction,
|
|
18
|
+
isRenderActionDisabled: !isMobile,
|
|
16
19
|
isActive,
|
|
17
20
|
handleToggle,
|
|
18
21
|
visibleMainActions,
|
|
@@ -13,5 +13,5 @@ type PageMainActionsProps<TMainActionComponent extends ElementType> = Omit<MainA
|
|
|
13
13
|
*/
|
|
14
14
|
spacing?: number;
|
|
15
15
|
};
|
|
16
|
-
export declare const MainActions: <TMainActionComponent extends ElementType = ElementType>({ actions, isDisabled, className, size, spacing, }: PageMainActionsProps<TMainActionComponent>) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export declare const MainActions: <TMainActionComponent extends ElementType = ElementType>({ actions, isDisabled, className, size, spacing, isRenderActionDisabled, }: PageMainActionsProps<TMainActionComponent>) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
17
|
export {};
|
|
@@ -4,10 +4,10 @@ exports.MainActions = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ActionGroup_1 = require("../../../ActionGroup");
|
|
6
6
|
const styles_1 = require("./styles");
|
|
7
|
-
const MainActions = ({ actions, isDisabled, className, size, spacing = 2, }) => {
|
|
7
|
+
const MainActions = ({ actions, isDisabled, className, size, spacing = 2, isRenderActionDisabled, }) => {
|
|
8
8
|
if (!actions || (actions && actions.length === 0)) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: className, "$spacing": spacing, children: (0, jsx_runtime_1.jsx)(ActionGroup_1.MainActions, { actions: actions ?? [], isDisabled: isDisabled, size: size }) }));
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: className, "$spacing": spacing, children: (0, jsx_runtime_1.jsx)(ActionGroup_1.MainActions, { actions: actions ?? [], isDisabled: isDisabled, size: size, isRenderActionDisabled: isRenderActionDisabled }) }));
|
|
12
12
|
};
|
|
13
13
|
exports.MainActions = MainActions;
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Wrapper = void 0;
|
|
4
4
|
const Button_1 = require("@mui/material/Button");
|
|
5
|
+
const ActionGroup_1 = require("../../../ActionGroup");
|
|
5
6
|
const styled_1 = require("../../../styled");
|
|
6
7
|
const Tooltip_1 = require("../../../Tooltip");
|
|
7
8
|
exports.Wrapper = styled_1.styled.div `
|
|
8
9
|
display: flex;
|
|
9
10
|
gap: ${({ theme, $spacing }) => theme.spacing($spacing)};
|
|
10
11
|
|
|
12
|
+
.${ActionGroup_1.actionGroupClassnames.action} {
|
|
13
|
+
flex-grow: 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
12
17
|
flex-wrap: wrap;
|
|
13
18
|
gap: ${({ theme }) => theme.spacing(2)};
|
|
@@ -14,10 +14,10 @@ const styles_1 = require("./styles");
|
|
|
14
14
|
const useLogic_1 = require("./useLogic");
|
|
15
15
|
const PageActionsInner = (props, ref) => {
|
|
16
16
|
const { secondary, secondaryVisible, main, className, isLoading, size = 'medium', spacing = 2, } = props;
|
|
17
|
-
const { disabledAction, buttonClassnames, isFocusedMode, handleClick, tooltipTitle, collapsedActions, classnames, } = (0, useLogic_1.useLogic)(props);
|
|
17
|
+
const { disabledAction, isRenderActionDisabled, buttonClassnames, isFocusedMode, handleClick, tooltipTitle, collapsedActions, classnames, } = (0, useLogic_1.useLogic)(props);
|
|
18
18
|
if (isLoading) {
|
|
19
19
|
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { children: (0, jsx_runtime_1.jsx)(PageActionSkeleton_1.PageActionSkeleton, { size: size }) }));
|
|
20
20
|
}
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: className, ref: ref, children: (0, jsx_runtime_1.jsxs)(styles_1.ActionWrapper, { "$spacing": spacing, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: tooltipTitle, enterDelay: 400, enterNextDelay: 400, placement: "bottom-end", children: (0, jsx_runtime_1.jsx)(styles_1.FocusModeButton, { className: buttonClassnames, variant: "outlined", onClick: handleClick, "aria-label": tooltipTitle, color: "grey", children: isFocusedMode ? (0, jsx_runtime_1.jsx)(MinimizeOutlineMd_1.MinimizeOutlineMd, {}) : (0, jsx_runtime_1.jsx)(FullSizeOutlineMd_1.FullSizeOutlineMd, {}) }) }), (0, jsx_runtime_1.jsx)(styles_1.MainActionsWrapper, { "$spacing": spacing, className: classnames, children: (0, jsx_runtime_1.jsx)(MainActions_1.MainActions, { isDisabled: disabledAction, actions: main, size: size, spacing: spacing }) }), (secondaryVisible || secondary) && ((0, jsx_runtime_1.jsxs)(styles_1.SecondaryVisibleWrapper, { "$spacing": spacing, className: classnames, children: [secondaryVisible && ((0, jsx_runtime_1.jsx)(SecondaryVisibleActions_1.SecondaryVisibleActions, { actions: secondaryVisible, size: size })), secondary && ((0, jsx_runtime_1.jsx)(SecondaryActions_1.SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: size }))] })), collapsedActions.length > 0 && ((0, jsx_runtime_1.jsx)(styles_1.CollapsedActionsWrapper, { className: classnames, children: (0, jsx_runtime_1.jsx)(SecondaryActions_1.SecondaryActions, { isDisabled: disabledAction, actions: collapsedActions, size: size }) }))] }) }));
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: className, ref: ref, children: (0, jsx_runtime_1.jsxs)(styles_1.ActionWrapper, { "$spacing": spacing, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: tooltipTitle, enterDelay: 400, enterNextDelay: 400, placement: "bottom-end", children: (0, jsx_runtime_1.jsx)(styles_1.FocusModeButton, { className: buttonClassnames, variant: "outlined", onClick: handleClick, "aria-label": tooltipTitle, color: "grey", children: isFocusedMode ? (0, jsx_runtime_1.jsx)(MinimizeOutlineMd_1.MinimizeOutlineMd, {}) : (0, jsx_runtime_1.jsx)(FullSizeOutlineMd_1.FullSizeOutlineMd, {}) }) }), (0, jsx_runtime_1.jsx)(styles_1.MainActionsWrapper, { "$spacing": spacing, className: classnames, children: (0, jsx_runtime_1.jsx)(MainActions_1.MainActions, { isDisabled: disabledAction, actions: main, size: size, spacing: spacing, isRenderActionDisabled: isRenderActionDisabled }) }), (secondaryVisible || secondary) && ((0, jsx_runtime_1.jsxs)(styles_1.SecondaryVisibleWrapper, { "$spacing": spacing, className: classnames, children: [secondaryVisible && ((0, jsx_runtime_1.jsx)(SecondaryVisibleActions_1.SecondaryVisibleActions, { actions: secondaryVisible, size: size, isRenderActionDisabled: isRenderActionDisabled })), secondary && ((0, jsx_runtime_1.jsx)(SecondaryActions_1.SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: size }))] })), collapsedActions.length > 0 && ((0, jsx_runtime_1.jsx)(styles_1.CollapsedActionsWrapper, { className: classnames, children: (0, jsx_runtime_1.jsx)(SecondaryActions_1.SecondaryActions, { isDisabled: disabledAction, actions: collapsedActions, size: size }) }))] }) }));
|
|
22
22
|
};
|
|
23
23
|
exports.PageActions = (0, forwardRefWithGeneric_1.forwardRefWithGeneric)(PageActionsInner);
|
package/node/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type SecondaryVisibleActionProps } from '../../../ActionGroup';
|
|
2
|
-
export declare const SecondaryVisibleActions: ({ actions, size, }: SecondaryVisibleActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const SecondaryVisibleActions: ({ actions, size, isRenderActionDisabled, }: SecondaryVisibleActionProps) => import("react/jsx-runtime").JSX.Element;
|
package/node/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SecondaryVisibleActions = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const styles_1 = require("./styles");
|
|
6
|
-
const SecondaryVisibleActions = ({ actions, size = 'medium', }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [actions.map(({ disabledReason, isBlockingOperation, icon, name, ...restActionProps }) => {
|
|
6
|
+
const SecondaryVisibleActions = ({ actions, size = 'medium', isRenderActionDisabled, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [actions.map(({ disabledReason, isBlockingOperation, icon, name, renderAction, ...restActionProps }) => {
|
|
8
8
|
return ((0, jsx_runtime_1.jsx)(styles_1.StyledMobileButton, { variant: "outlined", size: size, color: "grey", ...restActionProps, children: name }, name));
|
|
9
|
-
}), (0, jsx_runtime_1.jsx)(styles_1.StyledSecondaryVisibleActions, { actions: actions, size: size })] }));
|
|
9
|
+
}), (0, jsx_runtime_1.jsx)(styles_1.StyledSecondaryVisibleActions, { actions: actions, size: size, isRenderActionDisabled: isRenderActionDisabled })] }));
|
|
10
10
|
};
|
|
11
11
|
exports.SecondaryVisibleActions = SecondaryVisibleActions;
|
|
@@ -9,6 +9,12 @@ export declare const StyledMobileButton: import("@emotion/styled/dist/declaratio
|
|
|
9
9
|
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
10
10
|
theme?: import("@emotion/react").Theme | undefined;
|
|
11
11
|
}, {}, {}>;
|
|
12
|
-
export declare const StyledSecondaryVisibleActions: import("@emotion/styled/dist/declarations/src/types").StyledComponent<
|
|
12
|
+
export declare const StyledSecondaryVisibleActions: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
13
|
+
actions: import("../../../ActionGroup").SecondaryVisibleAction[];
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
size?: import("../../../Button").ButtonSize | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
isRenderActionDisabled?: boolean | undefined;
|
|
18
|
+
} & {
|
|
13
19
|
theme?: import("@emotion/react").Theme | undefined;
|
|
14
20
|
}, {}, {}>;
|
|
@@ -3,6 +3,7 @@ import { type SecondaryAction } from '../../../ActionGroup';
|
|
|
3
3
|
import type { PageActionsProps } from '../types';
|
|
4
4
|
export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType>({ main, secondary, secondaryVisible, withCollapseOnLaptop, }: PageActionsProps<TMainActionComponent, TSecondaryActionComponent>) => {
|
|
5
5
|
disabledAction: boolean;
|
|
6
|
+
isRenderActionDisabled: boolean;
|
|
6
7
|
buttonClassnames: string;
|
|
7
8
|
isFocusedMode: boolean;
|
|
8
9
|
handleClick: () => void;
|
|
@@ -5,11 +5,13 @@ const react_1 = require("react");
|
|
|
5
5
|
const ActionGroup_1 = require("../../../ActionGroup");
|
|
6
6
|
const NextFeatureFlagsContext_1 = require("../../../ConfigProvider/NextFeatureFlagsContext");
|
|
7
7
|
const DashboardContext_1 = require("../../../DashboardContext");
|
|
8
|
+
const useViewportType_1 = require("../../../useViewportType");
|
|
8
9
|
const cn_1 = require("../../../utils/cn");
|
|
9
10
|
const constants_1 = require("../constants");
|
|
10
11
|
const useLogic = ({ main, secondary, secondaryVisible, withCollapseOnLaptop = false, }) => {
|
|
11
12
|
const { showFocusModeButtonOnDesktop, showFocusModeButtonOnLaptop } = (0, react_1.useContext)(NextFeatureFlagsContext_1.NextFeatureFlagsContext);
|
|
12
13
|
const { setFocusedMode, isFocusedMode } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
14
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
13
15
|
const { disabledAction } = (0, ActionGroup_1.useActionsState)({ main, secondary });
|
|
14
16
|
const buttonClassnames = (0, react_1.useMemo)(() => (0, cn_1.cn)({
|
|
15
17
|
[constants_1.focusModeButtonClassnames.isShowOnDesktop]: showFocusModeButtonOnDesktop,
|
|
@@ -61,6 +63,7 @@ const useLogic = ({ main, secondary, secondaryVisible, withCollapseOnLaptop = fa
|
|
|
61
63
|
}, [withCollapseOnLaptop]);
|
|
62
64
|
return {
|
|
63
65
|
disabledAction,
|
|
66
|
+
isRenderActionDisabled: isMobile,
|
|
64
67
|
buttonClassnames,
|
|
65
68
|
isFocusedMode,
|
|
66
69
|
handleClick,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './Accordion';
|
|
2
|
-
export { ActionGroup, type ActionGroupProps, type MainAction, useMainActions, } from './ActionGroup';
|
|
2
|
+
export { ActionGroup, type ActionElementProps, type ActionGroupProps, type ActionRenderContext, type MainAction, type NestedActionRenderContext, useMainActions, } from './ActionGroup';
|
|
3
3
|
export { AddressAutocomplete, type AddressAutocompleteProps, type AddressAutocompleteValue, } from './AddressAutocomplete';
|
|
4
4
|
export { alertClassnames, Alert, type AlertProps, type AlertSeverity, } from './Alert';
|
|
5
5
|
export { AsyncAutocomplete, type AsyncAutocompleteProps, } from './AsyncAutocomplete';
|