@astral/ui 4.50.0 → 4.52.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/DashboardContext/DashboardContext.d.ts +2 -0
- package/components/DashboardContext/DashboardContext.js +2 -0
- package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.d.ts +2 -2
- package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +4 -1
- package/components/DashboardLayout/DashboardLayout.d.ts +1 -1
- package/components/DashboardLayout/DashboardLayout.js +2 -2
- package/components/DashboardLayout/Header/Header.js +28 -3
- package/components/DashboardLayout/Header/constants.d.ts +5 -1
- package/components/DashboardLayout/Header/constants.js +5 -1
- package/components/DashboardLayout/Header/styles.d.ts +4 -3
- package/components/DashboardLayout/Header/styles.js +66 -24
- package/components/DashboardLayout/Header/useLogic/useLogic.d.ts +4 -1
- package/components/DashboardLayout/Header/useLogic/useLogic.js +16 -11
- package/components/DashboardLayout/types.d.ts +5 -0
- package/components/DashboardSidebar/DashboardSidebar.js +17 -2
- package/components/DashboardSidebar/constants.d.ts +1 -0
- package/components/DashboardSidebar/constants.js +1 -0
- package/components/DashboardSidebar/styles.js +1 -1
- package/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
- package/components/DashboardSidebar/useLogic/useLogic.js +5 -6
- package/components/MenuOrganization/OrganizationButton/OrganizationButton.js +1 -1
- package/components/MenuOrganization/constants.d.ts +1 -0
- package/components/MenuOrganization/constants.js +1 -0
- package/components/NewStepper/NewStepper.js +1 -1
- package/components/NewStepper/Step/Label/Label.d.ts +1 -2
- package/components/NewStepper/Step/Label/Label.js +2 -2
- package/components/NewStepper/Step/Label/styles.js +5 -0
- package/components/NewStepper/Step/Step.js +2 -2
- package/components/NewStepper/Step/styles.js +9 -0
- package/components/NewStepper/StepperContext/StepperContext.d.ts +0 -1
- package/components/NewStepper/StepperContext/StepperContext.js +0 -1
- package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +1 -1
- package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +1 -3
- package/components/NewStepper/constants.d.ts +1 -0
- package/components/NewStepper/constants.js +1 -0
- package/components/NewStepper/styles.js +11 -1
- package/components/Profile/Profile.js +1 -1
- package/components/Profile/constants.d.ts +3 -0
- package/components/Profile/constants.js +3 -0
- package/hook-form/FormWizard/FormWizard.js +4 -3
- package/hook-form/FormWizard/styles.d.ts +1 -4
- package/hook-form/FormWizard/styles.js +4 -6
- package/hook-form/FormWizard/useLogic/useLogic.d.ts +5 -6
- package/hook-form/FormWizard/useLogic/useLogic.js +4 -5
- package/hook-form/useFormWizard/useFormWizard.js +4 -2
- package/node/components/DashboardContext/DashboardContext.d.ts +2 -0
- package/node/components/DashboardContext/DashboardContext.js +2 -0
- package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.d.ts +2 -2
- package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +4 -1
- package/node/components/DashboardLayout/DashboardLayout.d.ts +1 -1
- package/node/components/DashboardLayout/DashboardLayout.js +2 -2
- package/node/components/DashboardLayout/Header/Header.js +27 -2
- package/node/components/DashboardLayout/Header/constants.d.ts +5 -1
- package/node/components/DashboardLayout/Header/constants.js +5 -1
- package/node/components/DashboardLayout/Header/styles.d.ts +4 -3
- package/node/components/DashboardLayout/Header/styles.js +74 -32
- package/node/components/DashboardLayout/Header/useLogic/useLogic.d.ts +4 -1
- package/node/components/DashboardLayout/Header/useLogic/useLogic.js +15 -10
- package/node/components/DashboardLayout/types.d.ts +5 -0
- package/node/components/DashboardSidebar/DashboardSidebar.js +17 -2
- package/node/components/DashboardSidebar/constants.d.ts +1 -0
- package/node/components/DashboardSidebar/constants.js +1 -0
- package/node/components/DashboardSidebar/styles.js +1 -1
- package/node/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
- package/node/components/DashboardSidebar/useLogic/useLogic.js +4 -5
- package/node/components/MenuOrganization/OrganizationButton/OrganizationButton.js +1 -1
- package/node/components/MenuOrganization/constants.d.ts +1 -0
- package/node/components/MenuOrganization/constants.js +1 -0
- package/node/components/NewStepper/NewStepper.js +1 -1
- package/node/components/NewStepper/Step/Label/Label.d.ts +1 -2
- package/node/components/NewStepper/Step/Label/Label.js +2 -2
- package/node/components/NewStepper/Step/Label/styles.js +5 -0
- package/node/components/NewStepper/Step/Step.js +2 -2
- package/node/components/NewStepper/Step/styles.js +56 -47
- package/node/components/NewStepper/StepperContext/StepperContext.d.ts +0 -1
- package/node/components/NewStepper/StepperContext/StepperContext.js +0 -1
- package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +1 -1
- package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +1 -3
- package/node/components/NewStepper/constants.d.ts +1 -0
- package/node/components/NewStepper/constants.js +2 -1
- package/node/components/NewStepper/styles.js +10 -0
- package/node/components/Profile/Profile.js +1 -1
- package/node/components/Profile/constants.d.ts +3 -0
- package/node/components/Profile/constants.js +3 -0
- package/node/hook-form/FormWizard/FormWizard.js +3 -2
- package/node/hook-form/FormWizard/styles.d.ts +1 -4
- package/node/hook-form/FormWizard/styles.js +5 -7
- package/node/hook-form/FormWizard/useLogic/useLogic.d.ts +5 -6
- package/node/hook-form/FormWizard/useLogic/useLogic.js +4 -5
- package/node/hook-form/useFormWizard/useFormWizard.js +4 -2
- package/package.json +1 -1
- package/components/NewStepper/Step/Label/useLogic/index.d.ts +0 -1
- package/components/NewStepper/Step/Label/useLogic/index.js +0 -1
- package/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +0 -7
- package/components/NewStepper/Step/Label/useLogic/useLogic.js +0 -7
- package/node/components/NewStepper/Step/Label/useLogic/index.d.ts +0 -1
- package/node/components/NewStepper/Step/Label/useLogic/index.js +0 -17
- package/node/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +0 -7
- package/node/components/NewStepper/Step/Label/useLogic/useLogic.js +0 -11
|
@@ -5,31 +5,36 @@ const react_1 = require("react");
|
|
|
5
5
|
const DashboardContext_1 = require("../../../DashboardContext");
|
|
6
6
|
const DashboardSidebarProvider_1 = require("../../../DashboardSidebarProvider");
|
|
7
7
|
const useViewportType_1 = require("../../../useViewportType");
|
|
8
|
-
const classNames_1 = require("../../../utils/classNames");
|
|
9
|
-
const constants_1 = require("../constants");
|
|
10
8
|
const useLogic = ({ profile, menuOrganization }) => {
|
|
11
|
-
const { isFocusedMode, isLoading, hasMenuOrganizationRef, alertHeight } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
9
|
+
const { isFocusedMode, isLoading, hasMenuOrganizationRef, hasProfileRef, alertHeight, mobileHeaderPriorityFeature, } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
12
10
|
const { collapsedIn, onToggleSidebar, isPinned } = (0, react_1.useContext)(DashboardSidebarProvider_1.DashboardSidebarContext);
|
|
13
11
|
(0, react_1.useEffect)(() => {
|
|
14
12
|
hasMenuOrganizationRef.current = Boolean(menuOrganization);
|
|
15
|
-
|
|
13
|
+
hasProfileRef.current = Boolean(profile);
|
|
14
|
+
}, [menuOrganization, profile]);
|
|
16
15
|
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
17
16
|
const hasMenu = Boolean(profile?.menu || profile?.menuList);
|
|
18
|
-
const isShowProfile = (Boolean(profile) && !isMobile) ||
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const isShowProfile = (Boolean(profile) && !isMobile) ||
|
|
18
|
+
(hasMenu && isMobile && mobileHeaderPriorityFeature === 'profile');
|
|
19
|
+
const isShowExitButton = isMobile &&
|
|
20
|
+
!hasMenu &&
|
|
21
|
+
Boolean(profile?.exitButton) &&
|
|
22
|
+
mobileHeaderPriorityFeature === 'profile';
|
|
23
|
+
const headerStyle = {
|
|
24
|
+
'--alert-height': `${alertHeight}px`,
|
|
25
|
+
};
|
|
23
26
|
return {
|
|
24
27
|
isShowExitButton,
|
|
25
28
|
isShowProfile,
|
|
26
29
|
isMobile,
|
|
27
30
|
isFocusedMode,
|
|
31
|
+
mobileHeaderPriorityFeature,
|
|
28
32
|
isLoading,
|
|
29
33
|
collapsedIn,
|
|
30
34
|
onToggleSidebar,
|
|
31
35
|
alertHeight,
|
|
32
|
-
|
|
36
|
+
isPinned,
|
|
37
|
+
headerStyle,
|
|
33
38
|
};
|
|
34
39
|
};
|
|
35
40
|
exports.useLogic = useLogic;
|
|
@@ -10,4 +10,9 @@ export type DashboardLayoutProps = {
|
|
|
10
10
|
* Если true, отображается состояние загрузки
|
|
11
11
|
*/
|
|
12
12
|
isLoading?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Элемент, отображаемый в мобильном хедере.
|
|
15
|
+
* Второстепенный будет помещен в sidebar.
|
|
16
|
+
*/
|
|
17
|
+
mobileHeaderPriorityFeature?: 'profile' | 'menuOrg';
|
|
13
18
|
};
|
|
@@ -6,17 +6,32 @@ const react_1 = require("react");
|
|
|
6
6
|
const DashboardSidebarSkeleton_1 = require("../DashboardSidebarSkeleton");
|
|
7
7
|
const NavMenu_1 = require("../NavMenu");
|
|
8
8
|
const PinButton_1 = require("../PinButton");
|
|
9
|
+
const cva_1 = require("../utils/cva");
|
|
9
10
|
const getInertProps_1 = require("../utils/getInertProps");
|
|
11
|
+
const constants_1 = require("./constants");
|
|
10
12
|
const SidebarNav_1 = require("./SidebarNav");
|
|
11
13
|
const styles_1 = require("./styles");
|
|
12
14
|
const useLogic_1 = require("./useLogic");
|
|
15
|
+
const sidebar = (0, cva_1.cva)('', {
|
|
16
|
+
variants: {
|
|
17
|
+
hasProfile: {
|
|
18
|
+
true: constants_1.dashboardSidebarClassnames.hasProfile,
|
|
19
|
+
},
|
|
20
|
+
hasMenuOrganization: {
|
|
21
|
+
true: constants_1.dashboardSidebarClassnames.hasMenuOrganization,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
13
25
|
/**
|
|
14
26
|
* Основной sidebar приложения
|
|
15
27
|
*/
|
|
16
28
|
exports.DashboardSidebar = (0, react_1.forwardRef)((props, ref) => {
|
|
17
|
-
const { isPinned, isMobile, collapsedIn, onTogglePin, onMouseEnter, onMouseLeave, alertHeight, classnames,
|
|
29
|
+
const { isPinned, isMobile, collapsedIn, onTogglePin, onMouseEnter, onMouseLeave, alertHeight, classnames, menu, header, isLoading, hasMenuOrganization, hasProfile, } = (0, useLogic_1.useLogic)(props);
|
|
18
30
|
if (isLoading) {
|
|
19
31
|
return (0, jsx_runtime_1.jsx)(DashboardSidebarSkeleton_1.DashboardSidebarSkeleton, {});
|
|
20
32
|
}
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { "$isPinned": isPinned, "$alertHeight": alertHeight, className:
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { "$isPinned": isPinned, "$alertHeight": alertHeight, className: sidebar({
|
|
34
|
+
hasProfile,
|
|
35
|
+
hasMenuOrganization,
|
|
36
|
+
}), children: (0, jsx_runtime_1.jsx)(styles_1.SidebarRoot, { ref: ref, "$isPinned": isPinned, "$collapsedIn": collapsedIn, className: classnames, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ...(0, getInertProps_1.getInertProps)(isMobile && !isPinned), children: (0, jsx_runtime_1.jsxs)(styles_1.StyledPaper, { variant: "outlined", children: [(0, jsx_runtime_1.jsxs)(styles_1.SidebarContent, { "$collapsedIn": collapsedIn, "$isPinned": isPinned, "$hasHeader": Boolean(header), children: [header && (0, jsx_runtime_1.jsx)(styles_1.SidebarHeader, { children: header }), (0, jsx_runtime_1.jsx)(SidebarNav_1.SidebarNav, { menu: (0, jsx_runtime_1.jsx)(NavMenu_1.NavMenu, { collapsedIn: collapsedIn, items: menu.items }) })] }), (0, jsx_runtime_1.jsx)(styles_1.Footer, { children: (0, jsx_runtime_1.jsx)(PinButton_1.PinButton, { isPinned: isPinned, collapsedIn: collapsedIn, onClick: onTogglePin }) })] }) }) }));
|
|
22
37
|
});
|
|
@@ -4,6 +4,7 @@ exports.LABEL_WIDTH = exports.dashboardSidebarClassnames = void 0;
|
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.dashboardSidebarClassnames = {
|
|
6
6
|
root: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-sidebar'),
|
|
7
|
+
hasProfile: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-sidebar_has-profile'),
|
|
7
8
|
hasMenuOrganization: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-sidebar_has-menu-organization'),
|
|
8
9
|
};
|
|
9
10
|
exports.LABEL_WIDTH = {
|
|
@@ -38,7 +38,7 @@ exports.Wrapper = (0, styled_1.styled)('div', {
|
|
|
38
38
|
});
|
|
39
39
|
}};
|
|
40
40
|
|
|
41
|
-
&.${constants_4.dashboardSidebarClassnames.hasMenuOrganization} {
|
|
41
|
+
&.${constants_4.dashboardSidebarClassnames.hasMenuOrganization}, &.${constants_4.dashboardSidebarClassnames.hasProfile} {
|
|
42
42
|
top: ${({ $alertHeight }) => `calc(${$alertHeight}px + ${constants_2.HEADER_HEIGHT_MOBILE} + ${OrganizationButton_1.MOBILE_BUTTON_HEIGHT}) `};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -13,7 +13,7 @@ const constants_1 = require("../constants");
|
|
|
13
13
|
const useLogic = (props) => {
|
|
14
14
|
const { className, menu, header, isLoading } = props;
|
|
15
15
|
const { onToggleSidebar, isPinned, onTogglePin, collapsedIn, setIsPopupOpen, } = (0, react_1.useContext)(DashboardSidebarProvider_1.DashboardSidebarContext);
|
|
16
|
-
const { alertHeight, isLoading: isDashboardLoading, hasMenuOrganizationRef, } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
16
|
+
const { alertHeight, isLoading: isDashboardLoading, hasMenuOrganizationRef, hasProfileRef, mobileHeaderPriorityFeature, } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
17
17
|
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
18
18
|
const hoverTimerRef = (0, react_1.useRef)(null);
|
|
19
19
|
const theme = (0, useTheme_1.useTheme)();
|
|
@@ -83,9 +83,6 @@ const useLogic = (props) => {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
}, [collapsedIn, isPinned]);
|
|
86
|
-
const wrapperClassnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)({
|
|
87
|
-
[constants_1.dashboardSidebarClassnames.hasMenuOrganization]: hasMenuOrganizationRef.current,
|
|
88
|
-
}), [hasMenuOrganizationRef.current]);
|
|
89
86
|
const classnames = (0, classNames_1.classNames)(className, constants_1.dashboardSidebarClassnames.root);
|
|
90
87
|
return {
|
|
91
88
|
isPinned,
|
|
@@ -99,7 +96,9 @@ const useLogic = (props) => {
|
|
|
99
96
|
header,
|
|
100
97
|
isLoading: isLoading || isDashboardLoading,
|
|
101
98
|
classnames,
|
|
102
|
-
|
|
99
|
+
hasMenuOrganization: hasMenuOrganizationRef.current &&
|
|
100
|
+
mobileHeaderPriorityFeature === 'profile',
|
|
101
|
+
hasProfile: hasProfileRef.current && mobileHeaderPriorityFeature === 'menuOrg',
|
|
103
102
|
};
|
|
104
103
|
};
|
|
105
104
|
exports.useLogic = useLogic;
|
|
@@ -16,7 +16,7 @@ exports.OrganizationButton = (0, react_1.forwardRef)(({ onClick, isOpen, current
|
|
|
16
16
|
});
|
|
17
17
|
const renderButton = () => ((0, jsx_runtime_1.jsx)(styles_2.StyledButton, { ref: ref, variant: "text", disabled: isDisabled, onClick: onClick, className: constants_1.menuOrganizationClassnames.button, endIcon: (0, jsx_runtime_1.jsx)(styles_2.StyledChevron, { isActive: isOpen, width: 24, height: 24 }), children: renderPreview ? (renderPreview(currentOrganization, {
|
|
18
18
|
className: hidePersonalDataClassname,
|
|
19
|
-
})) : ((0, jsx_runtime_1.jsxs)(styles_2.Container, { className: hidePersonalDataClassname, children: [(0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { variant: "h6", component: "div", children: name }), (0, jsx_runtime_1.jsxs)(styles_1.OrganizationData, { children: [(0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u0418\u041D\u041D ", inn] }), kpp && ((0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u041A\u041F\u041F ", kpp] }))] })] })) }));
|
|
19
|
+
})) : ((0, jsx_runtime_1.jsxs)(styles_2.Container, { className: hidePersonalDataClassname, children: [(0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { variant: "h6", component: "div", children: name }), (0, jsx_runtime_1.jsxs)(styles_1.OrganizationData, { className: constants_1.menuOrganizationClassnames.organizationData, children: [(0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u0418\u041D\u041D ", inn] }), kpp && ((0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u041A\u041F\u041F ", kpp] }))] })] })) }));
|
|
20
20
|
if (isDisabled && disabledReason) {
|
|
21
21
|
return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: disabledReason, withoutContainer: false, placement: "bottom", children: renderButton() }));
|
|
22
22
|
}
|
|
@@ -9,4 +9,5 @@ exports.menuOrganizationClassnames = {
|
|
|
9
9
|
root: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization'),
|
|
10
10
|
errorPlaceholder: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__error-placeholder'),
|
|
11
11
|
button: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__button'),
|
|
12
|
+
organizationData: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__organization-data'),
|
|
12
13
|
};
|
|
@@ -25,7 +25,7 @@ const stepper = (0, cva_1.cva)(constants_1.stepperClassnames.root, {
|
|
|
25
25
|
});
|
|
26
26
|
const NewStepper = (props) => {
|
|
27
27
|
const { containerRef, stepperConnector, stepperAlternativeLabel, activeStep, onClickPrevStep, onClickStep, orientation, className, children, } = (0, useLogic_1.useLogic)(props);
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)(StepperContext_1.StepperContextProvider, { orientation: orientation, activeStep: activeStep,
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(StepperContext_1.StepperContextProvider, { orientation: orientation, activeStep: activeStep, connector: stepperConnector, alternativeLabel: stepperAlternativeLabel, onClickPrevStep: onClickPrevStep, onClickStep: onClickStep, children: (0, jsx_runtime_1.jsx)(styles_1.Wrapper, { ref: containerRef, role: "group", className: (0, classNames_1.classNames)(stepper({
|
|
29
29
|
alternativeLabel: stepperAlternativeLabel,
|
|
30
30
|
connector: stepperConnector,
|
|
31
31
|
orientation,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
type LabelProps = {
|
|
3
3
|
label: ReactNode;
|
|
4
|
-
stepId: number;
|
|
5
4
|
isActiveStep?: boolean;
|
|
6
5
|
};
|
|
7
|
-
export declare const Label: ({ label,
|
|
6
|
+
export declare const Label: ({ label, isActiveStep }: LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export {};
|
|
@@ -7,7 +7,7 @@ const Typography_1 = require("../../../Typography");
|
|
|
7
7
|
const Fade_1 = require("../../../transitions/Fade");
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const styles_1 = require("./styles");
|
|
10
|
-
const Label = ({ label,
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(styles_1.DesktopLabel, { className: constants_1.stepClassnames.label, children: label }), (0, jsx_runtime_1.jsxs)(styles_1.MobileLabelGroup, { className: constants_1.stepClassnames.labelMobile, children: [(0, jsx_runtime_1.jsx)(Collapse_1.Collapse, { in: !isActiveStep, orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(Fade_1.Fade, { in: !isActiveStep, children: (0, jsx_runtime_1.jsx)(styles_1.MobileCompactLabel, { className: constants_1.stepClassnames.label,
|
|
10
|
+
const Label = ({ label, isActiveStep }) => {
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(styles_1.DesktopLabel, { className: constants_1.stepClassnames.label, variant: "caption", children: label }), (0, jsx_runtime_1.jsxs)(styles_1.MobileLabelGroup, { className: constants_1.stepClassnames.labelMobile, children: [(0, jsx_runtime_1.jsx)(Collapse_1.Collapse, { in: !isActiveStep, orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(Fade_1.Fade, { in: !isActiveStep, children: (0, jsx_runtime_1.jsx)(styles_1.MobileCompactLabel, { className: constants_1.stepClassnames.label, component: "span" }) }) }), (0, jsx_runtime_1.jsx)(Collapse_1.Collapse, { in: isActiveStep, orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(Fade_1.Fade, { in: isActiveStep, children: (0, jsx_runtime_1.jsx)(Typography_1.Typography, { className: constants_1.stepClassnames.label, children: label }) }) })] })] }));
|
|
12
12
|
};
|
|
13
13
|
exports.Label = Label;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DesktopLabel = exports.MobileCompactLabel = exports.MobileLabelGroup = void 0;
|
|
4
4
|
const styled_1 = require("../../../styled");
|
|
5
5
|
const Typography_1 = require("../../../Typography");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
exports.MobileLabelGroup = styled_1.styled.div `
|
|
7
8
|
display: none;
|
|
8
9
|
|
|
@@ -13,6 +14,10 @@ exports.MobileLabelGroup = styled_1.styled.div `
|
|
|
13
14
|
`;
|
|
14
15
|
exports.MobileCompactLabel = (0, styled_1.styled)(Typography_1.Typography) `
|
|
15
16
|
display: inline-block;
|
|
17
|
+
|
|
18
|
+
&::before {
|
|
19
|
+
content: counter(${constants_1.STEPPER_ORDER_COUNTER_NAME});
|
|
20
|
+
}
|
|
16
21
|
`;
|
|
17
22
|
exports.DesktopLabel = (0, styled_1.styled)(Typography_1.Typography) `
|
|
18
23
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
@@ -56,7 +56,7 @@ const connector = (0, cva_1.cva)(constants_1.stepClassnames.connector, {
|
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
const Step = (props) => {
|
|
59
|
-
const { isCompletedStep, isRenderButton, handleClick, connectorVariant, alternativeLabel, orientation,
|
|
59
|
+
const { isCompletedStep, isRenderButton, handleClick, connectorVariant, alternativeLabel, orientation, children, isError, isWarning, icon, className, label, isRenderVerticalLineConnector, isRenderHorizontalLineConnector, isDisabled, isActiveStep, } = (0, useLogic_1.useLogic)(props);
|
|
60
60
|
const StepContent = isRenderButton ? styles_1.StyledButton : styles_1.StepContentWrapper;
|
|
61
61
|
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "data-active-step": isActiveStep, className: (0, classNames_1.classNames)(step({
|
|
62
62
|
isError,
|
|
@@ -68,7 +68,7 @@ const Step = (props) => {
|
|
|
68
68
|
isDisabled,
|
|
69
69
|
}), className), children: [(0, jsx_runtime_1.jsxs)(StepContent, { variant: "text", onClick: handleClick, disabled: isDisabled, className: (0, classNames_1.classNames)(constants_1.stepClassnames.content, {
|
|
70
70
|
[constants_1.stepClassnames.active]: isActiveStep,
|
|
71
|
-
}), children: [(0, jsx_runtime_1.jsxs)(styles_1.LabelWrapper, { className: constants_1.stepClassnames.labelContainer, children: [(0, jsx_runtime_1.jsx)(styles_1.IconWrapper, { className: constants_1.stepClassnames.iconContainer, children: (0, jsx_runtime_1.jsx)(StepIcon_1.StepIcon, { icon: icon, isActive: isActiveStep, isCompleted: isCompletedStep, isError: isError, isWarning: isWarning }) }), (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label,
|
|
71
|
+
}), children: [(0, jsx_runtime_1.jsxs)(styles_1.LabelWrapper, { className: constants_1.stepClassnames.labelContainer, children: [(0, jsx_runtime_1.jsx)(styles_1.IconWrapper, { className: constants_1.stepClassnames.iconContainer, children: (0, jsx_runtime_1.jsx)(StepIcon_1.StepIcon, { icon: icon, isActive: isActiveStep, isCompleted: isCompletedStep, isError: isError, isWarning: isWarning }) }), (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label, isActiveStep: isActiveStep }), connectorVariant === 'arrow' && ((0, jsx_runtime_1.jsx)(styles_1.ArrowConnector, { className: connector({
|
|
72
72
|
connector: connectorVariant,
|
|
73
73
|
alternativeLabel,
|
|
74
74
|
orientation,
|
|
@@ -5,73 +5,82 @@ const NextOutlineMd_1 = require("../../../icons/NextOutlineMd");
|
|
|
5
5
|
const Button_1 = require("../../Button");
|
|
6
6
|
const styled_1 = require("../../styled");
|
|
7
7
|
const constants_1 = require("../../Typography/constants");
|
|
8
|
-
const constants_2 = require("../
|
|
9
|
-
const constants_3 = require("
|
|
8
|
+
const constants_2 = require("../constants");
|
|
9
|
+
const constants_3 = require("../StepIcon/constants");
|
|
10
|
+
const constants_4 = require("./constants");
|
|
10
11
|
exports.Wrapper = styled_1.styled.div `
|
|
12
|
+
counter-increment: ${constants_2.STEPPER_ORDER_COUNTER_NAME};
|
|
13
|
+
|
|
11
14
|
display: flex;
|
|
12
15
|
gap: ${({ theme }) => theme.microSpacing(5)};
|
|
13
16
|
align-items: center;
|
|
14
17
|
|
|
15
|
-
&.${
|
|
18
|
+
&.${constants_4.stepClassnames.alternativeLabel} {
|
|
16
19
|
position: relative;
|
|
17
20
|
|
|
18
21
|
flex: 1;
|
|
19
22
|
flex-direction: column;
|
|
20
23
|
|
|
21
|
-
& .${
|
|
24
|
+
& .${constants_4.stepClassnames.labelContainer} {
|
|
22
25
|
flex-direction: column;
|
|
23
26
|
|
|
24
27
|
text-align: center;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
&:first-of-type {
|
|
28
|
-
& .${
|
|
31
|
+
& .${constants_4.stepClassnames.connector} {
|
|
29
32
|
display: none;
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
&.${
|
|
35
|
-
& .${
|
|
37
|
+
&.${constants_4.stepClassnames.connectorArrow} {
|
|
38
|
+
& .${constants_4.stepClassnames.content} {
|
|
36
39
|
padding: ${({ theme }) => theme.microSpacing(5, 0)};
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
&:not(:first-of-type) .${
|
|
42
|
+
&:not(:first-of-type) .${constants_4.stepClassnames.content} {
|
|
40
43
|
margin-left: ${({ theme }) => theme.spacing(2)};
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
&:last-of-type .${
|
|
46
|
+
&:last-of-type .${constants_4.stepClassnames.connector} {
|
|
44
47
|
display: none;
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
&.${
|
|
49
|
-
&.${
|
|
50
|
-
& .${
|
|
51
|
+
&.${constants_4.stepClassnames.connectorLine} {
|
|
52
|
+
&.${constants_4.stepClassnames.orientationHorizontal} {
|
|
53
|
+
& .${constants_4.stepClassnames.content} {
|
|
51
54
|
align-items: center;
|
|
52
55
|
|
|
53
56
|
padding: ${({ theme }) => theme.spacing(0, 1)};
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
|
|
57
|
-
&.${
|
|
58
|
-
& .${
|
|
60
|
+
&.${constants_4.stepClassnames.alternativeLabel} {
|
|
61
|
+
& .${constants_4.stepClassnames.content} {
|
|
59
62
|
padding: ${({ theme }) => theme.microSpacing(3, 0)};
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
&.${
|
|
65
|
-
|
|
67
|
+
&.${constants_4.stepClassnames.orientationVertical} {
|
|
68
|
+
|
|
69
|
+
& .${constants_4.stepClassnames.label} {
|
|
70
|
+
font-size: ${({ theme }) => theme.typography.body1.fontSize};
|
|
71
|
+
line-height: ${({ theme }) => theme.typography.body1.lineHeight};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
& .${constants_4.stepClassnames.content} {
|
|
66
75
|
padding: ${({ theme }) => theme.spacing(1, 0, 0)};
|
|
67
76
|
}
|
|
68
77
|
|
|
69
|
-
& .${
|
|
78
|
+
& .${constants_4.stepClassnames.connector}:not(.${constants_4.stepClassnames.hasDescription}) {
|
|
70
79
|
margin-bottom: ${({ theme }) => theme.microSpacing(1)};
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
&:last-of-type {
|
|
74
|
-
& .${
|
|
83
|
+
& .${constants_4.stepClassnames.description} {
|
|
75
84
|
min-height: 0;
|
|
76
85
|
margin: 0;
|
|
77
86
|
padding-left: ${({ theme }) => theme.spacing(6)};
|
|
@@ -83,49 +92,49 @@ exports.Wrapper = styled_1.styled.div `
|
|
|
83
92
|
}
|
|
84
93
|
}
|
|
85
94
|
|
|
86
|
-
& .${
|
|
95
|
+
& .${constants_4.stepClassnames.connector} {
|
|
87
96
|
display: none;
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
&:last-of-type {
|
|
92
|
-
& .${
|
|
101
|
+
& .${constants_4.stepClassnames.content} {
|
|
93
102
|
padding: ${({ theme }) => theme.spacing(1, 0)};
|
|
94
103
|
|
|
95
|
-
& .${
|
|
104
|
+
& .${constants_4.stepClassnames.description} {
|
|
96
105
|
margin-bottom: 0;
|
|
97
106
|
}
|
|
98
107
|
}
|
|
99
108
|
}
|
|
100
109
|
|
|
101
|
-
& .${
|
|
110
|
+
& .${constants_4.stepClassnames.labelMobile} {
|
|
102
111
|
display: none;
|
|
103
112
|
}
|
|
104
113
|
|
|
105
|
-
& .${
|
|
114
|
+
& .${constants_4.stepClassnames.label} {
|
|
106
115
|
display: block;
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
118
|
}
|
|
110
119
|
|
|
111
|
-
& .${
|
|
112
|
-
&.${
|
|
113
|
-
& .${
|
|
120
|
+
& .${constants_4.stepClassnames.content} {
|
|
121
|
+
&.${constants_4.stepClassnames.active} {
|
|
122
|
+
& .${constants_4.stepClassnames.label} {
|
|
114
123
|
color: ${({ theme }) => theme.palette.grey[900]};
|
|
115
124
|
}
|
|
116
125
|
|
|
117
|
-
& .${
|
|
126
|
+
& .${constants_3.stepIconClassnames.root} {
|
|
118
127
|
color: ${({ theme }) => theme.palette.primary[800]};
|
|
119
128
|
|
|
120
|
-
&.${
|
|
129
|
+
&.${constants_3.stepIconClassnames.success} {
|
|
121
130
|
color: ${({ theme }) => theme.palette.success[800]};
|
|
122
131
|
}
|
|
123
132
|
|
|
124
|
-
&.${
|
|
133
|
+
&.${constants_3.stepIconClassnames.error} {
|
|
125
134
|
color: ${({ theme }) => theme.palette.error[800]};
|
|
126
135
|
}
|
|
127
136
|
|
|
128
|
-
&.${
|
|
137
|
+
&.${constants_3.stepIconClassnames.warning} {
|
|
129
138
|
color: ${({ theme }) => theme.palette.warning[800]};
|
|
130
139
|
}
|
|
131
140
|
}
|
|
@@ -135,7 +144,7 @@ exports.Wrapper = styled_1.styled.div `
|
|
|
135
144
|
exports.IconWrapper = styled_1.styled.div `
|
|
136
145
|
display: flex;
|
|
137
146
|
|
|
138
|
-
& .${
|
|
147
|
+
& .${constants_3.stepIconClassnames.root} {
|
|
139
148
|
width: 20px;
|
|
140
149
|
height: 20px;
|
|
141
150
|
|
|
@@ -145,19 +154,19 @@ exports.IconWrapper = styled_1.styled.div `
|
|
|
145
154
|
duration: theme.transitions.duration.shorter,
|
|
146
155
|
})};
|
|
147
156
|
|
|
148
|
-
&.${
|
|
157
|
+
&.${constants_3.stepIconClassnames.active} {
|
|
149
158
|
color: ${({ theme }) => theme.palette.primary[800]};
|
|
150
159
|
}
|
|
151
160
|
|
|
152
|
-
&.${
|
|
161
|
+
&.${constants_3.stepIconClassnames.success} {
|
|
153
162
|
color: ${({ theme }) => theme.palette.success[800]};
|
|
154
163
|
}
|
|
155
164
|
|
|
156
|
-
&.${
|
|
165
|
+
&.${constants_3.stepIconClassnames.error} {
|
|
157
166
|
color: ${({ theme }) => theme.palette.error[800]};
|
|
158
167
|
}
|
|
159
168
|
|
|
160
|
-
&.${
|
|
169
|
+
&.${constants_3.stepIconClassnames.warning} {
|
|
161
170
|
color: ${({ theme }) => theme.palette.warning[800]};
|
|
162
171
|
}
|
|
163
172
|
|
|
@@ -185,14 +194,14 @@ exports.LineConnector = styled_1.styled.div `
|
|
|
185
194
|
|
|
186
195
|
border-top: 2px solid ${({ theme }) => theme.palette.grey[300]};
|
|
187
196
|
|
|
188
|
-
&.${
|
|
197
|
+
&.${constants_4.stepClassnames.alternativeLabel} {
|
|
189
198
|
position: absolute;
|
|
190
199
|
top: 15px;
|
|
191
200
|
right: calc(50% + 14px);
|
|
192
201
|
left: calc(-50% + 14px);
|
|
193
202
|
}
|
|
194
203
|
|
|
195
|
-
&.${
|
|
204
|
+
&.${constants_4.stepClassnames.orientationVertical} {
|
|
196
205
|
min-height: 16px;
|
|
197
206
|
|
|
198
207
|
/* Смещение необходимо для центрирования линии относительно иконки, т.к. линия шириной 2px, то для выравнивания необходимо число не кратное 2ум */
|
|
@@ -255,22 +264,22 @@ exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
|
255
264
|
&:hover {
|
|
256
265
|
background: transparent;
|
|
257
266
|
|
|
258
|
-
& .${
|
|
267
|
+
& .${constants_4.stepClassnames.label} {
|
|
259
268
|
color: ${({ theme }) => theme.palette.grey[700]};
|
|
260
269
|
}
|
|
261
270
|
|
|
262
|
-
& .${
|
|
271
|
+
& .${constants_3.stepIconClassnames.root} {
|
|
263
272
|
color: ${({ theme }) => theme.palette.primary[700]};
|
|
264
273
|
|
|
265
|
-
&.${
|
|
274
|
+
&.${constants_3.stepIconClassnames.success} {
|
|
266
275
|
color: ${({ theme }) => theme.palette.success[700]};
|
|
267
276
|
}
|
|
268
277
|
|
|
269
|
-
&.${
|
|
278
|
+
&.${constants_3.stepIconClassnames.error} {
|
|
270
279
|
color: ${({ theme }) => theme.palette.error[700]};
|
|
271
280
|
}
|
|
272
281
|
|
|
273
|
-
&.${
|
|
282
|
+
&.${constants_3.stepIconClassnames.warning} {
|
|
274
283
|
color: ${({ theme }) => theme.palette.warning[700]};
|
|
275
284
|
}
|
|
276
285
|
}
|
|
@@ -278,22 +287,22 @@ exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
|
278
287
|
|
|
279
288
|
&:active {
|
|
280
289
|
background: transparent;
|
|
281
|
-
& .${
|
|
290
|
+
& .${constants_4.stepClassnames.label} {
|
|
282
291
|
color: ${({ theme }) => theme.palette.grey[900]};
|
|
283
292
|
}
|
|
284
293
|
|
|
285
|
-
& .${
|
|
294
|
+
& .${constants_3.stepIconClassnames.root} {
|
|
286
295
|
color: ${({ theme }) => theme.palette.primary[800]};
|
|
287
296
|
|
|
288
|
-
&.${
|
|
297
|
+
&.${constants_3.stepIconClassnames.success} {
|
|
289
298
|
color: ${({ theme }) => theme.palette.success[800]};
|
|
290
299
|
}
|
|
291
300
|
|
|
292
|
-
&.${
|
|
301
|
+
&.${constants_3.stepIconClassnames.error} {
|
|
293
302
|
color: ${({ theme }) => theme.palette.error[800]};
|
|
294
303
|
}
|
|
295
304
|
|
|
296
|
-
&.${
|
|
305
|
+
&.${constants_3.stepIconClassnames.warning} {
|
|
297
306
|
color: ${({ theme }) => theme.palette.warning[700]};
|
|
298
307
|
}
|
|
299
308
|
}
|
package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { type StepperContextProps } from '../StepperContext';
|
|
|
3
3
|
type Props = StepperContextProps & {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
};
|
|
6
|
-
export declare const StepperContextProvider: ({ children, orientation, activeStep,
|
|
6
|
+
export declare const StepperContextProvider: ({ children, orientation, activeStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js
CHANGED
|
@@ -4,11 +4,10 @@ exports.StepperContextProvider = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const StepperContext_1 = require("../StepperContext");
|
|
7
|
-
const StepperContextProvider = ({ children, orientation, activeStep,
|
|
7
|
+
const StepperContextProvider = ({ children, orientation, activeStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }) => {
|
|
8
8
|
const contextValue = (0, react_1.useMemo)(() => ({
|
|
9
9
|
activeStep,
|
|
10
10
|
orientation,
|
|
11
|
-
setActiveStep,
|
|
12
11
|
connector,
|
|
13
12
|
alternativeLabel,
|
|
14
13
|
onClickPrevStep,
|
|
@@ -16,7 +15,6 @@ const StepperContextProvider = ({ children, orientation, activeStep, setActiveSt
|
|
|
16
15
|
}), [
|
|
17
16
|
activeStep,
|
|
18
17
|
orientation,
|
|
19
|
-
setActiveStep,
|
|
20
18
|
connector,
|
|
21
19
|
alternativeLabel,
|
|
22
20
|
onClickPrevStep,
|
|
@@ -6,6 +6,7 @@ export declare const stepperClassnames: {
|
|
|
6
6
|
orientationVertical: string;
|
|
7
7
|
alternativeLabel: string;
|
|
8
8
|
};
|
|
9
|
+
export declare const STEPPER_ORDER_COUNTER_NAME = "astral-ui-stepper-order";
|
|
9
10
|
/**
|
|
10
11
|
* Задержка перед scrollIntoView после смены activeStep, что бы анимация появления текста завершилась
|
|
11
12
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MOBILE_ACTIVE_STEP_SCROLL_DEFER_MS = exports.stepperClassnames = void 0;
|
|
3
|
+
exports.MOBILE_ACTIVE_STEP_SCROLL_DEFER_MS = exports.STEPPER_ORDER_COUNTER_NAME = exports.stepperClassnames = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.stepperClassnames = {
|
|
6
6
|
root: (0, createUIKitClassname_1.createUIKitClassname)('stepper'),
|
|
@@ -10,6 +10,7 @@ exports.stepperClassnames = {
|
|
|
10
10
|
orientationVertical: (0, createUIKitClassname_1.createUIKitClassname)('stepper_orientation-vertical'),
|
|
11
11
|
alternativeLabel: (0, createUIKitClassname_1.createUIKitClassname)('stepper_alternative-label'),
|
|
12
12
|
};
|
|
13
|
+
exports.STEPPER_ORDER_COUNTER_NAME = 'astral-ui-stepper-order';
|
|
13
14
|
/**
|
|
14
15
|
* Задержка перед scrollIntoView после смены activeStep, что бы анимация появления текста завершилась
|
|
15
16
|
*/
|
|
@@ -4,6 +4,8 @@ exports.Wrapper = void 0;
|
|
|
4
4
|
const styled_1 = require("../styled");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
6
|
exports.Wrapper = styled_1.styled.div `
|
|
7
|
+
counter-reset: ${constants_1.STEPPER_ORDER_COUNTER_NAME} 0;
|
|
8
|
+
|
|
7
9
|
display: flex;
|
|
8
10
|
align-items: flex-start;
|
|
9
11
|
|
|
@@ -30,8 +32,16 @@ exports.Wrapper = styled_1.styled.div `
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
35
|
+
/* Убираем видимую полосу прокрутки в firefox */
|
|
36
|
+
scrollbar-width: none;
|
|
37
|
+
|
|
33
38
|
overflow-x: auto;
|
|
34
39
|
|
|
35
40
|
width: 100%;
|
|
41
|
+
|
|
42
|
+
/* Убираем видимую полосу прокрутки в chrome */
|
|
43
|
+
&::-webkit-scrollbar {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
36
46
|
}
|
|
37
47
|
`;
|