@astral/ui 4.30.0 → 4.31.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/Stepper/StepButton/StepButton.d.ts +7 -1
- package/components/Stepper/StepButton/StepButton.js +4 -2
- package/components/Stepper/StepButton/styles.d.ts +2 -1
- package/components/Stepper/StepIcon/StepIcon.d.ts +6 -2
- package/components/Stepper/StepIcon/StepIcon.js +11 -7
- package/components/Stepper/StepIcon/styles.js +1 -0
- package/components/Stepper/StepLabel/StepLabel.d.ts +7 -1
- package/components/Stepper/StepLabel/StepLabel.js +2 -2
- package/components/Stepper/constants.d.ts +1 -0
- package/components/Stepper/constants.js +1 -0
- package/node/components/Stepper/StepButton/StepButton.d.ts +7 -1
- package/node/components/Stepper/StepButton/StepButton.js +4 -2
- package/node/components/Stepper/StepButton/styles.d.ts +2 -1
- package/node/components/Stepper/StepIcon/StepIcon.d.ts +6 -2
- package/node/components/Stepper/StepIcon/StepIcon.js +11 -7
- package/node/components/Stepper/StepIcon/styles.js +1 -0
- package/node/components/Stepper/StepLabel/StepLabel.d.ts +7 -1
- package/node/components/Stepper/StepLabel/StepLabel.js +2 -2
- package/node/components/Stepper/constants.d.ts +1 -0
- package/node/components/Stepper/constants.js +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { StepLabelProps as MuiStepLabelProps } from '@mui/material/StepLabel';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
2
3
|
import type { WithoutEmotionSpecific } from '../../types/WithoutEmotionSpecific';
|
|
4
|
+
import { type StepIconProps } from '../StepIcon';
|
|
3
5
|
export type StepButtonProps = {
|
|
4
6
|
/**
|
|
5
7
|
* Если true, текущий шаг будет отображен как активный
|
|
@@ -9,5 +11,9 @@ export type StepButtonProps = {
|
|
|
9
11
|
* Функция, вызываемая при клике на элемент
|
|
10
12
|
*/
|
|
11
13
|
onClick: () => void;
|
|
12
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Кастомный компонент иконки
|
|
16
|
+
*/
|
|
17
|
+
icon?: (props: Omit<StepIconProps, 'icon'>) => ReactNode;
|
|
18
|
+
} & Omit<WithoutEmotionSpecific<MuiStepLabelProps>, 'icon'>;
|
|
13
19
|
export declare const StepButton: (props: StepButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,9 @@ import { stepperClassnames } from '../constants';
|
|
|
4
4
|
import { StepIcon } from '../StepIcon';
|
|
5
5
|
import { Button, StyledStepLabel } from './styles';
|
|
6
6
|
export const StepButton = (props) => {
|
|
7
|
-
const { isSelected, onClick, ...restProps } = props;
|
|
8
|
-
const stepIconRender = useCallback(({ active, completed, error
|
|
7
|
+
const { isSelected, onClick, icon: Icon, ...restProps } = props;
|
|
8
|
+
const stepIconRender = useCallback(({ active, completed, error }) => {
|
|
9
|
+
return (_jsx(StepIcon, { icon: Icon, isSelected: isSelected, active: active, completed: completed, error: error }));
|
|
10
|
+
}, [isSelected, Icon]);
|
|
9
11
|
return (_jsx(Button, { onClick: onClick, tabIndex: 1, className: stepperClassnames.stepButton, children: _jsx(StyledStepLabel, { StepIconComponent: stepIconRender, ...restProps }) }));
|
|
10
12
|
};
|
|
@@ -5,6 +5,7 @@ export declare const Button: import("../../styled").StyledComponent<{
|
|
|
5
5
|
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
6
6
|
export declare const StyledStepLabel: import("../../styled").StyledComponent<{
|
|
7
7
|
isSelected?: boolean | undefined;
|
|
8
|
-
|
|
8
|
+
icon?: ((props: Omit<import("../StepIcon").StepIconProps, "icon">) => import("react").ReactNode) | undefined;
|
|
9
|
+
} & Omit<import("../..").WithoutEmotionSpecific<import("@mui/material/StepLabel").StepLabelProps>, "icon"> & {
|
|
9
10
|
theme?: import("@emotion/react").Theme | undefined;
|
|
10
11
|
}, {}, {}>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { StepIconProps as MuiStepIconProps } from '@mui/material/StepIcon';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import { type WithoutEmotionSpecific } from '../../types/WithoutEmotionSpecific';
|
|
4
4
|
export type StepIconProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Является ли шаг в состоянии select
|
|
7
7
|
*/
|
|
8
8
|
isSelected?: boolean;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Кастомный компонент иконки
|
|
11
|
+
*/
|
|
12
|
+
icon?: (props: Omit<StepIconProps, 'icon'>) => ReactNode;
|
|
13
|
+
} & Omit<WithoutEmotionSpecific<MuiStepIconProps>, 'icon'>;
|
|
10
14
|
export declare const StepIcon: import("react").MemoExoticComponent<(props: StepIconProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
+
import { stepperClassnames } from '../constants';
|
|
3
4
|
import { ActiveIcon, DefaultIcon, ErrorIcon, SelectIcon, SuccessIcon, } from './styles';
|
|
4
5
|
export const StepIcon = memo((props) => {
|
|
5
|
-
const { active, completed, error, isSelected } = props;
|
|
6
|
+
const { active, completed, error, isSelected, icon: Icon } = props;
|
|
7
|
+
if (Icon) {
|
|
8
|
+
return (_jsx(Icon, { active: active, completed: completed, error: error, isSelected: isSelected, className: stepperClassnames.stepIcon }));
|
|
9
|
+
}
|
|
6
10
|
if (completed && error && isSelected) {
|
|
7
|
-
return _jsx(SelectIcon, { "$isError": true });
|
|
11
|
+
return _jsx(SelectIcon, { "$isError": true, className: stepperClassnames.stepIcon });
|
|
8
12
|
}
|
|
9
13
|
if (completed && isSelected) {
|
|
10
|
-
return _jsx(SelectIcon, {});
|
|
14
|
+
return _jsx(SelectIcon, { className: stepperClassnames.stepIcon });
|
|
11
15
|
}
|
|
12
16
|
if (error) {
|
|
13
|
-
return _jsx(ErrorIcon, {});
|
|
17
|
+
return _jsx(ErrorIcon, { className: stepperClassnames.stepIcon });
|
|
14
18
|
}
|
|
15
19
|
if (completed) {
|
|
16
|
-
return _jsx(SuccessIcon, {});
|
|
20
|
+
return _jsx(SuccessIcon, { className: stepperClassnames.stepIcon });
|
|
17
21
|
}
|
|
18
22
|
if (active) {
|
|
19
|
-
return _jsx(ActiveIcon, {
|
|
23
|
+
return _jsx(ActiveIcon, { className: stepperClassnames.stepIcon });
|
|
20
24
|
}
|
|
21
|
-
return _jsx(DefaultIcon, {});
|
|
25
|
+
return _jsx(DefaultIcon, { className: stepperClassnames.stepIcon });
|
|
22
26
|
});
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { StepLabelProps as MuiStepLabelProps } from '@mui/material/StepLabel';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
2
3
|
import { type WithoutEmotionSpecific } from '../../types/WithoutEmotionSpecific';
|
|
4
|
+
import { type StepIconProps } from '../StepIcon';
|
|
3
5
|
export type StepProps = {
|
|
4
6
|
/**
|
|
5
7
|
* Является ли шаг в состоянии select
|
|
6
8
|
*/
|
|
7
9
|
isSelected?: boolean;
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Кастомный компонент иконки
|
|
12
|
+
*/
|
|
13
|
+
icon?: (props: Omit<StepIconProps, 'icon'>) => ReactNode;
|
|
14
|
+
} & Omit<WithoutEmotionSpecific<MuiStepLabelProps>, 'icon'>;
|
|
9
15
|
export declare const StepLabel: (props: StepProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import MuiStepLabel from '@mui/material/StepLabel';
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { StepIcon } from '../StepIcon';
|
|
5
5
|
export const StepLabel = (props) => {
|
|
6
|
-
const { isSelected, ...restProps } = props;
|
|
7
|
-
const stepIconRender = useCallback(({ active, completed, error
|
|
6
|
+
const { isSelected, icon: Icon, ...restProps } = props;
|
|
7
|
+
const stepIconRender = useCallback(({ active, completed, error }) => (_jsx(StepIcon, { icon: Icon, isSelected: isSelected, active: active, completed: completed, error: error })), [isSelected]);
|
|
8
8
|
return _jsx(MuiStepLabel, { StepIconComponent: stepIconRender, ...restProps });
|
|
9
9
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { StepLabelProps as MuiStepLabelProps } from '@mui/material/StepLabel';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
2
3
|
import type { WithoutEmotionSpecific } from '../../types/WithoutEmotionSpecific';
|
|
4
|
+
import { type StepIconProps } from '../StepIcon';
|
|
3
5
|
export type StepButtonProps = {
|
|
4
6
|
/**
|
|
5
7
|
* Если true, текущий шаг будет отображен как активный
|
|
@@ -9,5 +11,9 @@ export type StepButtonProps = {
|
|
|
9
11
|
* Функция, вызываемая при клике на элемент
|
|
10
12
|
*/
|
|
11
13
|
onClick: () => void;
|
|
12
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Кастомный компонент иконки
|
|
16
|
+
*/
|
|
17
|
+
icon?: (props: Omit<StepIconProps, 'icon'>) => ReactNode;
|
|
18
|
+
} & Omit<WithoutEmotionSpecific<MuiStepLabelProps>, 'icon'>;
|
|
13
19
|
export declare const StepButton: (props: StepButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,8 +7,10 @@ const constants_1 = require("../constants");
|
|
|
7
7
|
const StepIcon_1 = require("../StepIcon");
|
|
8
8
|
const styles_1 = require("./styles");
|
|
9
9
|
const StepButton = (props) => {
|
|
10
|
-
const { isSelected, onClick, ...restProps } = props;
|
|
11
|
-
const stepIconRender = (0, react_1.useCallback)(({ active, completed, error
|
|
10
|
+
const { isSelected, onClick, icon: Icon, ...restProps } = props;
|
|
11
|
+
const stepIconRender = (0, react_1.useCallback)(({ active, completed, error }) => {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(StepIcon_1.StepIcon, { icon: Icon, isSelected: isSelected, active: active, completed: completed, error: error }));
|
|
13
|
+
}, [isSelected, Icon]);
|
|
12
14
|
return ((0, jsx_runtime_1.jsx)(styles_1.Button, { onClick: onClick, tabIndex: 1, className: constants_1.stepperClassnames.stepButton, children: (0, jsx_runtime_1.jsx)(styles_1.StyledStepLabel, { StepIconComponent: stepIconRender, ...restProps }) }));
|
|
13
15
|
};
|
|
14
16
|
exports.StepButton = StepButton;
|
|
@@ -5,6 +5,7 @@ export declare const Button: import("@emotion/styled/dist/declarations/src/types
|
|
|
5
5
|
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
6
6
|
export declare const StyledStepLabel: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
7
7
|
isSelected?: boolean | undefined;
|
|
8
|
-
|
|
8
|
+
icon?: ((props: Omit<import("../StepIcon").StepIconProps, "icon">) => import("react").ReactNode) | undefined;
|
|
9
|
+
} & Omit<import("../..").WithoutEmotionSpecific<import("@mui/material/StepLabel").StepLabelProps>, "icon"> & {
|
|
9
10
|
theme?: import("@emotion/react").Theme | undefined;
|
|
10
11
|
}, {}, {}>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { StepIconProps as MuiStepIconProps } from '@mui/material/StepIcon';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import { type WithoutEmotionSpecific } from '../../types/WithoutEmotionSpecific';
|
|
4
4
|
export type StepIconProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Является ли шаг в состоянии select
|
|
7
7
|
*/
|
|
8
8
|
isSelected?: boolean;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Кастомный компонент иконки
|
|
11
|
+
*/
|
|
12
|
+
icon?: (props: Omit<StepIconProps, 'icon'>) => ReactNode;
|
|
13
|
+
} & Omit<WithoutEmotionSpecific<MuiStepIconProps>, 'icon'>;
|
|
10
14
|
export declare const StepIcon: import("react").MemoExoticComponent<(props: StepIconProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -3,23 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StepIcon = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
6
7
|
const styles_1 = require("./styles");
|
|
7
8
|
exports.StepIcon = (0, react_1.memo)((props) => {
|
|
8
|
-
const { active, completed, error, isSelected } = props;
|
|
9
|
+
const { active, completed, error, isSelected, icon: Icon } = props;
|
|
10
|
+
if (Icon) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(Icon, { active: active, completed: completed, error: error, isSelected: isSelected, className: constants_1.stepperClassnames.stepIcon }));
|
|
12
|
+
}
|
|
9
13
|
if (completed && error && isSelected) {
|
|
10
|
-
return (0, jsx_runtime_1.jsx)(styles_1.SelectIcon, { "$isError": true });
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(styles_1.SelectIcon, { "$isError": true, className: constants_1.stepperClassnames.stepIcon });
|
|
11
15
|
}
|
|
12
16
|
if (completed && isSelected) {
|
|
13
|
-
return (0, jsx_runtime_1.jsx)(styles_1.SelectIcon, {});
|
|
17
|
+
return (0, jsx_runtime_1.jsx)(styles_1.SelectIcon, { className: constants_1.stepperClassnames.stepIcon });
|
|
14
18
|
}
|
|
15
19
|
if (error) {
|
|
16
|
-
return (0, jsx_runtime_1.jsx)(styles_1.ErrorIcon, {});
|
|
20
|
+
return (0, jsx_runtime_1.jsx)(styles_1.ErrorIcon, { className: constants_1.stepperClassnames.stepIcon });
|
|
17
21
|
}
|
|
18
22
|
if (completed) {
|
|
19
|
-
return (0, jsx_runtime_1.jsx)(styles_1.SuccessIcon, {});
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(styles_1.SuccessIcon, { className: constants_1.stepperClassnames.stepIcon });
|
|
20
24
|
}
|
|
21
25
|
if (active) {
|
|
22
|
-
return (0, jsx_runtime_1.jsx)(styles_1.ActiveIcon, {
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(styles_1.ActiveIcon, { className: constants_1.stepperClassnames.stepIcon });
|
|
23
27
|
}
|
|
24
|
-
return (0, jsx_runtime_1.jsx)(styles_1.DefaultIcon, {});
|
|
28
|
+
return (0, jsx_runtime_1.jsx)(styles_1.DefaultIcon, { className: constants_1.stepperClassnames.stepIcon });
|
|
25
29
|
});
|
|
@@ -32,4 +32,5 @@ exports.DefaultIcon = (0, styled_1.styled)(StepDefaultFillMd_1.StepDefaultFillMd
|
|
|
32
32
|
`;
|
|
33
33
|
exports.ActiveIcon = (0, styled_1.styled)(StepDefaultFillMd_1.StepDefaultFillMd) `
|
|
34
34
|
${({ theme }) => iconsSize(theme)};
|
|
35
|
+
color: ${({ theme }) => theme.palette.primary[800]};
|
|
35
36
|
`;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { StepLabelProps as MuiStepLabelProps } from '@mui/material/StepLabel';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
2
3
|
import { type WithoutEmotionSpecific } from '../../types/WithoutEmotionSpecific';
|
|
4
|
+
import { type StepIconProps } from '../StepIcon';
|
|
3
5
|
export type StepProps = {
|
|
4
6
|
/**
|
|
5
7
|
* Является ли шаг в состоянии select
|
|
6
8
|
*/
|
|
7
9
|
isSelected?: boolean;
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Кастомный компонент иконки
|
|
12
|
+
*/
|
|
13
|
+
icon?: (props: Omit<StepIconProps, 'icon'>) => ReactNode;
|
|
14
|
+
} & Omit<WithoutEmotionSpecific<MuiStepLabelProps>, 'icon'>;
|
|
9
15
|
export declare const StepLabel: (props: StepProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,8 +9,8 @@ const StepLabel_1 = __importDefault(require("@mui/material/StepLabel"));
|
|
|
9
9
|
const react_1 = require("react");
|
|
10
10
|
const StepIcon_1 = require("../StepIcon");
|
|
11
11
|
const StepLabel = (props) => {
|
|
12
|
-
const { isSelected, ...restProps } = props;
|
|
13
|
-
const stepIconRender = (0, react_1.useCallback)(({ active, completed, error
|
|
12
|
+
const { isSelected, icon: Icon, ...restProps } = props;
|
|
13
|
+
const stepIconRender = (0, react_1.useCallback)(({ active, completed, error }) => ((0, jsx_runtime_1.jsx)(StepIcon_1.StepIcon, { icon: Icon, isSelected: isSelected, active: active, completed: completed, error: error })), [isSelected]);
|
|
14
14
|
return (0, jsx_runtime_1.jsx)(StepLabel_1.default, { StepIconComponent: stepIconRender, ...restProps });
|
|
15
15
|
};
|
|
16
16
|
exports.StepLabel = StepLabel;
|
|
@@ -4,4 +4,5 @@ exports.stepperClassnames = void 0;
|
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.stepperClassnames = {
|
|
6
6
|
stepButton: (0, createUIKitClassname_1.createUIKitClassname)('stepper_stepButton'),
|
|
7
|
+
stepIcon: (0, createUIKitClassname_1.createUIKitClassname)('stepper_stepIcon'),
|
|
7
8
|
};
|