@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.
Files changed (99) hide show
  1. package/components/DashboardContext/DashboardContext.d.ts +2 -0
  2. package/components/DashboardContext/DashboardContext.js +2 -0
  3. package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.d.ts +2 -2
  4. package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +4 -1
  5. package/components/DashboardLayout/DashboardLayout.d.ts +1 -1
  6. package/components/DashboardLayout/DashboardLayout.js +2 -2
  7. package/components/DashboardLayout/Header/Header.js +28 -3
  8. package/components/DashboardLayout/Header/constants.d.ts +5 -1
  9. package/components/DashboardLayout/Header/constants.js +5 -1
  10. package/components/DashboardLayout/Header/styles.d.ts +4 -3
  11. package/components/DashboardLayout/Header/styles.js +66 -24
  12. package/components/DashboardLayout/Header/useLogic/useLogic.d.ts +4 -1
  13. package/components/DashboardLayout/Header/useLogic/useLogic.js +16 -11
  14. package/components/DashboardLayout/types.d.ts +5 -0
  15. package/components/DashboardSidebar/DashboardSidebar.js +17 -2
  16. package/components/DashboardSidebar/constants.d.ts +1 -0
  17. package/components/DashboardSidebar/constants.js +1 -0
  18. package/components/DashboardSidebar/styles.js +1 -1
  19. package/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
  20. package/components/DashboardSidebar/useLogic/useLogic.js +5 -6
  21. package/components/MenuOrganization/OrganizationButton/OrganizationButton.js +1 -1
  22. package/components/MenuOrganization/constants.d.ts +1 -0
  23. package/components/MenuOrganization/constants.js +1 -0
  24. package/components/NewStepper/NewStepper.js +1 -1
  25. package/components/NewStepper/Step/Label/Label.d.ts +1 -2
  26. package/components/NewStepper/Step/Label/Label.js +2 -2
  27. package/components/NewStepper/Step/Label/styles.js +5 -0
  28. package/components/NewStepper/Step/Step.js +2 -2
  29. package/components/NewStepper/Step/styles.js +9 -0
  30. package/components/NewStepper/StepperContext/StepperContext.d.ts +0 -1
  31. package/components/NewStepper/StepperContext/StepperContext.js +0 -1
  32. package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +1 -1
  33. package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +1 -3
  34. package/components/NewStepper/constants.d.ts +1 -0
  35. package/components/NewStepper/constants.js +1 -0
  36. package/components/NewStepper/styles.js +11 -1
  37. package/components/Profile/Profile.js +1 -1
  38. package/components/Profile/constants.d.ts +3 -0
  39. package/components/Profile/constants.js +3 -0
  40. package/hook-form/FormWizard/FormWizard.js +4 -3
  41. package/hook-form/FormWizard/styles.d.ts +1 -4
  42. package/hook-form/FormWizard/styles.js +4 -6
  43. package/hook-form/FormWizard/useLogic/useLogic.d.ts +5 -6
  44. package/hook-form/FormWizard/useLogic/useLogic.js +4 -5
  45. package/hook-form/useFormWizard/useFormWizard.js +4 -2
  46. package/node/components/DashboardContext/DashboardContext.d.ts +2 -0
  47. package/node/components/DashboardContext/DashboardContext.js +2 -0
  48. package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.d.ts +2 -2
  49. package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +4 -1
  50. package/node/components/DashboardLayout/DashboardLayout.d.ts +1 -1
  51. package/node/components/DashboardLayout/DashboardLayout.js +2 -2
  52. package/node/components/DashboardLayout/Header/Header.js +27 -2
  53. package/node/components/DashboardLayout/Header/constants.d.ts +5 -1
  54. package/node/components/DashboardLayout/Header/constants.js +5 -1
  55. package/node/components/DashboardLayout/Header/styles.d.ts +4 -3
  56. package/node/components/DashboardLayout/Header/styles.js +74 -32
  57. package/node/components/DashboardLayout/Header/useLogic/useLogic.d.ts +4 -1
  58. package/node/components/DashboardLayout/Header/useLogic/useLogic.js +15 -10
  59. package/node/components/DashboardLayout/types.d.ts +5 -0
  60. package/node/components/DashboardSidebar/DashboardSidebar.js +17 -2
  61. package/node/components/DashboardSidebar/constants.d.ts +1 -0
  62. package/node/components/DashboardSidebar/constants.js +1 -0
  63. package/node/components/DashboardSidebar/styles.js +1 -1
  64. package/node/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
  65. package/node/components/DashboardSidebar/useLogic/useLogic.js +4 -5
  66. package/node/components/MenuOrganization/OrganizationButton/OrganizationButton.js +1 -1
  67. package/node/components/MenuOrganization/constants.d.ts +1 -0
  68. package/node/components/MenuOrganization/constants.js +1 -0
  69. package/node/components/NewStepper/NewStepper.js +1 -1
  70. package/node/components/NewStepper/Step/Label/Label.d.ts +1 -2
  71. package/node/components/NewStepper/Step/Label/Label.js +2 -2
  72. package/node/components/NewStepper/Step/Label/styles.js +5 -0
  73. package/node/components/NewStepper/Step/Step.js +2 -2
  74. package/node/components/NewStepper/Step/styles.js +56 -47
  75. package/node/components/NewStepper/StepperContext/StepperContext.d.ts +0 -1
  76. package/node/components/NewStepper/StepperContext/StepperContext.js +0 -1
  77. package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +1 -1
  78. package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +1 -3
  79. package/node/components/NewStepper/constants.d.ts +1 -0
  80. package/node/components/NewStepper/constants.js +2 -1
  81. package/node/components/NewStepper/styles.js +10 -0
  82. package/node/components/Profile/Profile.js +1 -1
  83. package/node/components/Profile/constants.d.ts +3 -0
  84. package/node/components/Profile/constants.js +3 -0
  85. package/node/hook-form/FormWizard/FormWizard.js +3 -2
  86. package/node/hook-form/FormWizard/styles.d.ts +1 -4
  87. package/node/hook-form/FormWizard/styles.js +5 -7
  88. package/node/hook-form/FormWizard/useLogic/useLogic.d.ts +5 -6
  89. package/node/hook-form/FormWizard/useLogic/useLogic.js +4 -5
  90. package/node/hook-form/useFormWizard/useFormWizard.js +4 -2
  91. package/package.json +1 -1
  92. package/components/NewStepper/Step/Label/useLogic/index.d.ts +0 -1
  93. package/components/NewStepper/Step/Label/useLogic/index.js +0 -1
  94. package/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +0 -7
  95. package/components/NewStepper/Step/Label/useLogic/useLogic.js +0 -7
  96. package/node/components/NewStepper/Step/Label/useLogic/index.d.ts +0 -1
  97. package/node/components/NewStepper/Step/Label/useLogic/index.js +0 -17
  98. package/node/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +0 -7
  99. 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
- }, [menuOrganization]);
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) || (hasMenu && isMobile);
19
- const isShowExitButton = isMobile && !hasMenu && Boolean(profile?.exitButton);
20
- const menuOrganizationClassnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)({
21
- [constants_1.dashboardLayoutHeaderClassnames.mobileMenuOrganizationVisible]: isPinned,
22
- }), [isPinned]);
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
- menuOrganizationClassnames,
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, wrapperClassnames, menu, header, isLoading, } = (0, useLogic_1.useLogic)(props);
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: wrapperClassnames, 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 }) })] }) }) }));
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
  });
@@ -1,5 +1,6 @@
1
1
  export declare const dashboardSidebarClassnames: {
2
2
  root: string;
3
+ hasProfile: string;
3
4
  hasMenuOrganization: string;
4
5
  };
5
6
  export declare const LABEL_WIDTH: {
@@ -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
  }
@@ -28,5 +28,6 @@ export declare const useLogic: (props: DashboardSidebarProps) => {
28
28
  header: import("react").ReactNode;
29
29
  isLoading: boolean;
30
30
  classnames: string;
31
- wrapperClassnames: string;
31
+ hasMenuOrganization: boolean | null;
32
+ hasProfile: boolean | null;
32
33
  };
@@ -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
- wrapperClassnames,
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
  }
@@ -5,4 +5,5 @@ export declare const menuOrganizationClassnames: {
5
5
  root: string;
6
6
  errorPlaceholder: string;
7
7
  button: string;
8
+ organizationData: string;
8
9
  };
@@ -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, setActiveStep: () => undefined, 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({
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, stepId, isActiveStep }: LabelProps) => import("react/jsx-runtime").JSX.Element;
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, stepId, 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, 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, children: stepId }) }) }), (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 }) }) })] })] }));
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, stepId, children, isError, isWarning, icon, className, label, isRenderVerticalLineConnector, isRenderHorizontalLineConnector, isDisabled, isActiveStep, } = (0, useLogic_1.useLogic)(props);
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, stepId: stepId, isActiveStep: isActiveStep }), connectorVariant === 'arrow' && ((0, jsx_runtime_1.jsx)(styles_1.ArrowConnector, { className: connector({
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("../StepIcon/constants");
9
- const constants_3 = require("./constants");
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
- &.${constants_3.stepClassnames.alternativeLabel} {
18
+ &.${constants_4.stepClassnames.alternativeLabel} {
16
19
  position: relative;
17
20
 
18
21
  flex: 1;
19
22
  flex-direction: column;
20
23
 
21
- & .${constants_3.stepClassnames.labelContainer} {
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
- & .${constants_3.stepClassnames.connector} {
31
+ & .${constants_4.stepClassnames.connector} {
29
32
  display: none;
30
33
  }
31
34
  }
32
35
  }
33
36
 
34
- &.${constants_3.stepClassnames.connectorArrow} {
35
- & .${constants_3.stepClassnames.content} {
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) .${constants_3.stepClassnames.content} {
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 .${constants_3.stepClassnames.connector} {
46
+ &:last-of-type .${constants_4.stepClassnames.connector} {
44
47
  display: none;
45
48
  }
46
49
  }
47
50
 
48
- &.${constants_3.stepClassnames.connectorLine} {
49
- &.${constants_3.stepClassnames.orientationHorizontal} {
50
- & .${constants_3.stepClassnames.content} {
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
- &.${constants_3.stepClassnames.alternativeLabel} {
58
- & .${constants_3.stepClassnames.content} {
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
- &.${constants_3.stepClassnames.orientationVertical} {
65
- & .${constants_3.stepClassnames.content} {
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
- & .${constants_3.stepClassnames.connector}:not(.${constants_3.stepClassnames.hasDescription}) {
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
- & .${constants_3.stepClassnames.description} {
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
- & .${constants_3.stepClassnames.connector} {
95
+ & .${constants_4.stepClassnames.connector} {
87
96
  display: none;
88
97
  }
89
98
  }
90
99
 
91
100
  &:last-of-type {
92
- & .${constants_3.stepClassnames.content} {
101
+ & .${constants_4.stepClassnames.content} {
93
102
  padding: ${({ theme }) => theme.spacing(1, 0)};
94
103
 
95
- & .${constants_3.stepClassnames.description} {
104
+ & .${constants_4.stepClassnames.description} {
96
105
  margin-bottom: 0;
97
106
  }
98
107
  }
99
108
  }
100
109
 
101
- & .${constants_3.stepClassnames.labelMobile} {
110
+ & .${constants_4.stepClassnames.labelMobile} {
102
111
  display: none;
103
112
  }
104
113
 
105
- & .${constants_3.stepClassnames.label} {
114
+ & .${constants_4.stepClassnames.label} {
106
115
  display: block;
107
116
  }
108
117
  }
109
118
  }
110
119
 
111
- & .${constants_3.stepClassnames.content} {
112
- &.${constants_3.stepClassnames.active} {
113
- & .${constants_3.stepClassnames.label} {
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
- & .${constants_2.stepIconClassnames.root} {
126
+ & .${constants_3.stepIconClassnames.root} {
118
127
  color: ${({ theme }) => theme.palette.primary[800]};
119
128
 
120
- &.${constants_2.stepIconClassnames.success} {
129
+ &.${constants_3.stepIconClassnames.success} {
121
130
  color: ${({ theme }) => theme.palette.success[800]};
122
131
  }
123
132
 
124
- &.${constants_2.stepIconClassnames.error} {
133
+ &.${constants_3.stepIconClassnames.error} {
125
134
  color: ${({ theme }) => theme.palette.error[800]};
126
135
  }
127
136
 
128
- &.${constants_2.stepIconClassnames.warning} {
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
- & .${constants_2.stepIconClassnames.root} {
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
- &.${constants_2.stepIconClassnames.active} {
157
+ &.${constants_3.stepIconClassnames.active} {
149
158
  color: ${({ theme }) => theme.palette.primary[800]};
150
159
  }
151
160
 
152
- &.${constants_2.stepIconClassnames.success} {
161
+ &.${constants_3.stepIconClassnames.success} {
153
162
  color: ${({ theme }) => theme.palette.success[800]};
154
163
  }
155
164
 
156
- &.${constants_2.stepIconClassnames.error} {
165
+ &.${constants_3.stepIconClassnames.error} {
157
166
  color: ${({ theme }) => theme.palette.error[800]};
158
167
  }
159
168
 
160
- &.${constants_2.stepIconClassnames.warning} {
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
- &.${constants_3.stepClassnames.alternativeLabel} {
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
- &.${constants_3.stepClassnames.orientationVertical} {
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
- & .${constants_3.stepClassnames.label} {
267
+ & .${constants_4.stepClassnames.label} {
259
268
  color: ${({ theme }) => theme.palette.grey[700]};
260
269
  }
261
270
 
262
- & .${constants_2.stepIconClassnames.root} {
271
+ & .${constants_3.stepIconClassnames.root} {
263
272
  color: ${({ theme }) => theme.palette.primary[700]};
264
273
 
265
- &.${constants_2.stepIconClassnames.success} {
274
+ &.${constants_3.stepIconClassnames.success} {
266
275
  color: ${({ theme }) => theme.palette.success[700]};
267
276
  }
268
277
 
269
- &.${constants_2.stepIconClassnames.error} {
278
+ &.${constants_3.stepIconClassnames.error} {
270
279
  color: ${({ theme }) => theme.palette.error[700]};
271
280
  }
272
281
 
273
- &.${constants_2.stepIconClassnames.warning} {
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
- & .${constants_3.stepClassnames.label} {
290
+ & .${constants_4.stepClassnames.label} {
282
291
  color: ${({ theme }) => theme.palette.grey[900]};
283
292
  }
284
293
 
285
- & .${constants_2.stepIconClassnames.root} {
294
+ & .${constants_3.stepIconClassnames.root} {
286
295
  color: ${({ theme }) => theme.palette.primary[800]};
287
296
 
288
- &.${constants_2.stepIconClassnames.success} {
297
+ &.${constants_3.stepIconClassnames.success} {
289
298
  color: ${({ theme }) => theme.palette.success[800]};
290
299
  }
291
300
 
292
- &.${constants_2.stepIconClassnames.error} {
301
+ &.${constants_3.stepIconClassnames.error} {
293
302
  color: ${({ theme }) => theme.palette.error[800]};
294
303
  }
295
304
 
296
- &.${constants_2.stepIconClassnames.warning} {
305
+ &.${constants_3.stepIconClassnames.warning} {
297
306
  color: ${({ theme }) => theme.palette.warning[700]};
298
307
  }
299
308
  }
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export type StepperContextProps = {
3
3
  activeStep: number;
4
- setActiveStep: (step: number) => void;
5
4
  orientation: 'horizontal' | 'vertical';
6
5
  connector: 'arrow' | 'line';
7
6
  alternativeLabel: boolean;
@@ -4,7 +4,6 @@ exports.StepperContext = void 0;
4
4
  const react_1 = require("react");
5
5
  exports.StepperContext = (0, react_1.createContext)({
6
6
  activeStep: 0,
7
- setActiveStep: () => undefined,
8
7
  orientation: 'horizontal',
9
8
  connector: 'line',
10
9
  alternativeLabel: false,
@@ -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, setActiveStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const StepperContextProvider: ({ children, orientation, activeStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }: Props) => import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -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, setActiveStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }) => {
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
  `;