@astral/ui 4.50.0 → 4.51.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 (47) hide show
  1. package/components/NewStepper/NewStepper.js +1 -1
  2. package/components/NewStepper/Step/Label/Label.d.ts +1 -2
  3. package/components/NewStepper/Step/Label/Label.js +2 -2
  4. package/components/NewStepper/Step/Label/styles.js +5 -0
  5. package/components/NewStepper/Step/Step.js +2 -2
  6. package/components/NewStepper/Step/styles.js +9 -0
  7. package/components/NewStepper/StepperContext/StepperContext.d.ts +0 -1
  8. package/components/NewStepper/StepperContext/StepperContext.js +0 -1
  9. package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +1 -1
  10. package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +1 -3
  11. package/components/NewStepper/constants.d.ts +1 -0
  12. package/components/NewStepper/constants.js +1 -0
  13. package/components/NewStepper/styles.js +11 -1
  14. package/hook-form/FormWizard/FormWizard.js +4 -3
  15. package/hook-form/FormWizard/styles.d.ts +1 -4
  16. package/hook-form/FormWizard/styles.js +4 -6
  17. package/hook-form/FormWizard/useLogic/useLogic.d.ts +5 -6
  18. package/hook-form/FormWizard/useLogic/useLogic.js +4 -5
  19. package/hook-form/useFormWizard/useFormWizard.js +4 -2
  20. package/node/components/NewStepper/NewStepper.js +1 -1
  21. package/node/components/NewStepper/Step/Label/Label.d.ts +1 -2
  22. package/node/components/NewStepper/Step/Label/Label.js +2 -2
  23. package/node/components/NewStepper/Step/Label/styles.js +5 -0
  24. package/node/components/NewStepper/Step/Step.js +2 -2
  25. package/node/components/NewStepper/Step/styles.js +56 -47
  26. package/node/components/NewStepper/StepperContext/StepperContext.d.ts +0 -1
  27. package/node/components/NewStepper/StepperContext/StepperContext.js +0 -1
  28. package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +1 -1
  29. package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +1 -3
  30. package/node/components/NewStepper/constants.d.ts +1 -0
  31. package/node/components/NewStepper/constants.js +2 -1
  32. package/node/components/NewStepper/styles.js +10 -0
  33. package/node/hook-form/FormWizard/FormWizard.js +3 -2
  34. package/node/hook-form/FormWizard/styles.d.ts +1 -4
  35. package/node/hook-form/FormWizard/styles.js +5 -7
  36. package/node/hook-form/FormWizard/useLogic/useLogic.d.ts +5 -6
  37. package/node/hook-form/FormWizard/useLogic/useLogic.js +4 -5
  38. package/node/hook-form/useFormWizard/useFormWizard.js +4 -2
  39. package/package.json +1 -1
  40. package/components/NewStepper/Step/Label/useLogic/index.d.ts +0 -1
  41. package/components/NewStepper/Step/Label/useLogic/index.js +0 -1
  42. package/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +0 -7
  43. package/components/NewStepper/Step/Label/useLogic/useLogic.js +0 -7
  44. package/node/components/NewStepper/Step/Label/useLogic/index.d.ts +0 -1
  45. package/node/components/NewStepper/Step/Label/useLogic/index.js +0 -17
  46. package/node/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +0 -7
  47. package/node/components/NewStepper/Step/Label/useLogic/useLogic.js +0 -11
@@ -22,7 +22,7 @@ const stepper = cva(stepperClassnames.root, {
22
22
  });
23
23
  export const NewStepper = (props) => {
24
24
  const { containerRef, stepperConnector, stepperAlternativeLabel, activeStep, onClickPrevStep, onClickStep, orientation, className, children, } = useLogic(props);
25
- return (_jsx(StepperContextProvider, { orientation: orientation, activeStep: activeStep, setActiveStep: () => undefined, connector: stepperConnector, alternativeLabel: stepperAlternativeLabel, onClickPrevStep: onClickPrevStep, onClickStep: onClickStep, children: _jsx(Wrapper, { ref: containerRef, role: "group", className: classNames(stepper({
25
+ return (_jsx(StepperContextProvider, { orientation: orientation, activeStep: activeStep, connector: stepperConnector, alternativeLabel: stepperAlternativeLabel, onClickPrevStep: onClickPrevStep, onClickStep: onClickStep, children: _jsx(Wrapper, { ref: containerRef, role: "group", className: classNames(stepper({
26
26
  alternativeLabel: stepperAlternativeLabel,
27
27
  connector: stepperConnector,
28
28
  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 {};
@@ -4,6 +4,6 @@ import { Typography } from '../../../Typography';
4
4
  import { Fade } from '../../../transitions/Fade';
5
5
  import { stepClassnames } from '../constants';
6
6
  import { DesktopLabel, MobileCompactLabel, MobileLabelGroup } from './styles';
7
- export const Label = ({ label, stepId, isActiveStep }) => {
8
- return (_jsxs(_Fragment, { children: [_jsx(DesktopLabel, { className: stepClassnames.label, children: label }), _jsxs(MobileLabelGroup, { className: stepClassnames.labelMobile, children: [_jsx(Collapse, { in: !isActiveStep, orientation: "horizontal", children: _jsx(Fade, { in: !isActiveStep, children: _jsx(MobileCompactLabel, { className: stepClassnames.label, children: stepId }) }) }), _jsx(Collapse, { in: isActiveStep, orientation: "horizontal", children: _jsx(Fade, { in: isActiveStep, children: _jsx(Typography, { className: stepClassnames.label, children: label }) }) })] })] }));
7
+ export const Label = ({ label, isActiveStep }) => {
8
+ return (_jsxs(_Fragment, { children: [_jsx(DesktopLabel, { className: stepClassnames.label, variant: "caption", children: label }), _jsxs(MobileLabelGroup, { className: stepClassnames.labelMobile, children: [_jsx(Collapse, { in: !isActiveStep, orientation: "horizontal", children: _jsx(Fade, { in: !isActiveStep, children: _jsx(MobileCompactLabel, { className: stepClassnames.label, component: "span" }) }) }), _jsx(Collapse, { in: isActiveStep, orientation: "horizontal", children: _jsx(Fade, { in: isActiveStep, children: _jsx(Typography, { className: stepClassnames.label, children: label }) }) })] })] }));
9
9
  };
@@ -1,5 +1,6 @@
1
1
  import { styled } from '../../../styled';
2
2
  import { Typography } from '../../../Typography';
3
+ import { STEPPER_ORDER_COUNTER_NAME } from '../../constants';
3
4
  export const MobileLabelGroup = styled.div `
4
5
  display: none;
5
6
 
@@ -10,6 +11,10 @@ export const MobileLabelGroup = styled.div `
10
11
  `;
11
12
  export const MobileCompactLabel = styled(Typography) `
12
13
  display: inline-block;
14
+
15
+ &::before {
16
+ content: counter(${STEPPER_ORDER_COUNTER_NAME});
17
+ }
13
18
  `;
14
19
  export const DesktopLabel = styled(Typography) `
15
20
  ${({ theme }) => theme.breakpoints.down('sm')} {
@@ -53,7 +53,7 @@ const connector = cva(stepClassnames.connector, {
53
53
  },
54
54
  });
55
55
  export const Step = (props) => {
56
- const { isCompletedStep, isRenderButton, handleClick, connectorVariant, alternativeLabel, orientation, stepId, children, isError, isWarning, icon, className, label, isRenderVerticalLineConnector, isRenderHorizontalLineConnector, isDisabled, isActiveStep, } = useLogic(props);
56
+ const { isCompletedStep, isRenderButton, handleClick, connectorVariant, alternativeLabel, orientation, children, isError, isWarning, icon, className, label, isRenderVerticalLineConnector, isRenderHorizontalLineConnector, isDisabled, isActiveStep, } = useLogic(props);
57
57
  const StepContent = isRenderButton ? StyledButton : StepContentWrapper;
58
58
  return (_jsxs(Wrapper, { "data-active-step": isActiveStep, className: classNames(step({
59
59
  isError,
@@ -65,7 +65,7 @@ export const Step = (props) => {
65
65
  isDisabled,
66
66
  }), className), children: [_jsxs(StepContent, { variant: "text", onClick: handleClick, disabled: isDisabled, className: classNames(stepClassnames.content, {
67
67
  [stepClassnames.active]: isActiveStep,
68
- }), children: [_jsxs(LabelWrapper, { className: stepClassnames.labelContainer, children: [_jsx(IconWrapper, { className: stepClassnames.iconContainer, children: _jsx(StepIcon, { icon: icon, isActive: isActiveStep, isCompleted: isCompletedStep, isError: isError, isWarning: isWarning }) }), _jsx(Label, { label: label, stepId: stepId, isActiveStep: isActiveStep }), connectorVariant === 'arrow' && (_jsx(ArrowConnector, { className: connector({
68
+ }), children: [_jsxs(LabelWrapper, { className: stepClassnames.labelContainer, children: [_jsx(IconWrapper, { className: stepClassnames.iconContainer, children: _jsx(StepIcon, { icon: icon, isActive: isActiveStep, isCompleted: isCompletedStep, isError: isError, isWarning: isWarning }) }), _jsx(Label, { label: label, isActiveStep: isActiveStep }), connectorVariant === 'arrow' && (_jsx(ArrowConnector, { className: connector({
69
69
  connector: connectorVariant,
70
70
  alternativeLabel,
71
71
  orientation,
@@ -2,9 +2,12 @@ import { NextOutlineMd } from '../../../icons/NextOutlineMd';
2
2
  import { Button } from '../../Button';
3
3
  import { styled } from '../../styled';
4
4
  import { typographyClassnames } from '../../Typography/constants';
5
+ import { STEPPER_ORDER_COUNTER_NAME } from '../constants';
5
6
  import { stepIconClassnames } from '../StepIcon/constants';
6
7
  import { stepClassnames } from './constants';
7
8
  export const Wrapper = styled.div `
9
+ counter-increment: ${STEPPER_ORDER_COUNTER_NAME};
10
+
8
11
  display: flex;
9
12
  gap: ${({ theme }) => theme.microSpacing(5)};
10
13
  align-items: center;
@@ -59,6 +62,12 @@ export const Wrapper = styled.div `
59
62
  }
60
63
 
61
64
  &.${stepClassnames.orientationVertical} {
65
+
66
+ & .${stepClassnames.label} {
67
+ font-size: ${({ theme }) => theme.typography.body1.fontSize};
68
+ line-height: ${({ theme }) => theme.typography.body1.lineHeight};
69
+ }
70
+
62
71
  & .${stepClassnames.content} {
63
72
  padding: ${({ theme }) => theme.spacing(1, 0, 0)};
64
73
  }
@@ -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;
@@ -1,7 +1,6 @@
1
1
  import { createContext } from 'react';
2
2
  export const StepperContext = createContext({
3
3
  activeStep: 0,
4
- setActiveStep: () => undefined,
5
4
  orientation: 'horizontal',
6
5
  connector: 'line',
7
6
  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 {};
@@ -1,11 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { StepperContext } from '../StepperContext';
4
- export const StepperContextProvider = ({ children, orientation, activeStep, setActiveStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }) => {
4
+ export const StepperContextProvider = ({ children, orientation, activeStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }) => {
5
5
  const contextValue = useMemo(() => ({
6
6
  activeStep,
7
7
  orientation,
8
- setActiveStep,
9
8
  connector,
10
9
  alternativeLabel,
11
10
  onClickPrevStep,
@@ -13,7 +12,6 @@ export const StepperContextProvider = ({ children, orientation, activeStep, setA
13
12
  }), [
14
13
  activeStep,
15
14
  orientation,
16
- setActiveStep,
17
15
  connector,
18
16
  alternativeLabel,
19
17
  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
  */
@@ -7,6 +7,7 @@ export const stepperClassnames = {
7
7
  orientationVertical: createUIKitClassname('stepper_orientation-vertical'),
8
8
  alternativeLabel: createUIKitClassname('stepper_alternative-label'),
9
9
  };
10
+ export const STEPPER_ORDER_COUNTER_NAME = 'astral-ui-stepper-order';
10
11
  /**
11
12
  * Задержка перед scrollIntoView после смены activeStep, что бы анимация появления текста завершилась
12
13
  */
@@ -1,6 +1,8 @@
1
1
  import { styled } from '../styled';
2
- import { stepperClassnames } from './constants';
2
+ import { STEPPER_ORDER_COUNTER_NAME, stepperClassnames } from './constants';
3
3
  export const Wrapper = styled.div `
4
+ counter-reset: ${STEPPER_ORDER_COUNTER_NAME} 0;
5
+
4
6
  display: flex;
5
7
  align-items: flex-start;
6
8
 
@@ -27,8 +29,16 @@ export const Wrapper = styled.div `
27
29
  }
28
30
 
29
31
  ${({ theme }) => theme.breakpoints.down('sm')} {
32
+ /* Убираем видимую полосу прокрутки в firefox */
33
+ scrollbar-width: none;
34
+
30
35
  overflow-x: auto;
31
36
 
32
37
  width: 100%;
38
+
39
+ /* Убираем видимую полосу прокрутки в chrome */
40
+ &::-webkit-scrollbar {
41
+ display: none;
42
+ }
33
43
  }
34
44
  `;
@@ -1,14 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ContentState } from '../../components/ContentState';
3
+ import { Step } from '../../components/NewStepper';
3
4
  import { Form } from '../Form';
4
5
  import { Footer } from './Footer';
5
- import { BeforeContentWrapper, FormContent, StyledStepperWizard, Wrapper, } from './styles';
6
+ import { BeforeContentWrapper, FormContent, StyledNewStepper, Wrapper, } from './styles';
6
7
  import { useLogic } from './useLogic';
7
8
  /**
8
9
  * FormWizard предназначен для построения форм со степпером.
9
10
  */
10
11
  export const FormWizard = (props) => {
11
- const { Component, footerProps, stepWizardProps } = useLogic(props);
12
+ const { Component, footerProps, activeStep, steps } = useLogic(props);
12
13
  const { className, isFirstStep, isLastStep, isDisabled, isLoading, isError, form, customFooter, errorMsg, onRetry, onClickStep, onPrevStep, onSubmit, onSubmitError, beforeContent, } = props;
13
14
  const renderFooter = () => {
14
15
  if (customFooter) {
@@ -22,7 +23,7 @@ export const FormWizard = (props) => {
22
23
  }
23
24
  return (_jsx(Footer, { isDisabled: isDisabled, isFirstStep: isFirstStep, isLastStep: isLastStep, onPrevStep: onPrevStep, ...footerProps }));
24
25
  };
25
- return (_jsxs(Wrapper, { className: className, children: [beforeContent && (_jsx(BeforeContentWrapper, { children: beforeContent })), _jsx(StyledStepperWizard, { connector: "arrow", onClickPrevStep: onClickStep, ...stepWizardProps }), _jsx(ContentState, { isLoading: isLoading, isError: isError,
26
+ return (_jsxs(Wrapper, { className: className, children: [beforeContent && (_jsx(BeforeContentWrapper, { children: beforeContent })), _jsx(StyledNewStepper, { connector: "arrow", onClickPrevStep: onClickStep, activeStep: activeStep, children: steps.map((step) => (_jsx(Step, { ...step }, step.stepId))) }), _jsx(ContentState, { isLoading: isLoading, isError: isError,
26
27
  // biome-ignore lint/suspicious/noTsIgnore: onRetry не требуется, если форма не инициализируется данными, получаемыми с backend
27
28
  // @ts-ignore
28
29
  errorState: { errorList: [errorMsg || ''], onRetry }, children: _jsxs(Form, { form: form, isDisabled: isDisabled, onSubmit: form.handleSubmit(onSubmit, onSubmitError), children: [_jsx(FormContent, { children: _jsx(Component, {}) }), renderFooter()] }) })] }));
@@ -7,10 +7,7 @@ export declare const BeforeContentWrapper: import("../../components/styled").Sty
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
8
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
9
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
- export declare const StyledStepperWizard: import("../../components/styled").StyledComponent<Omit<import("../..").StepperProps, "children"> & {
11
- steps: import("../../components/StepperWizard").StepWizard[];
12
- onClickPrevStep?: ((index: number) => void) | undefined;
13
- } & {
10
+ export declare const StyledNewStepper: import("../../components/styled").StyledComponent<import("../../components/NewStepper").StepperProps & {
14
11
  theme?: import("@emotion/react").Theme | undefined;
15
12
  }, {}, {}>;
16
13
  export declare const FormContent: import("../../components/styled").StyledComponent<{
@@ -1,4 +1,4 @@
1
- import { StepperWizard } from '../../components/StepperWizard';
1
+ import { NewStepper } from '../../components/NewStepper';
2
2
  import { styled } from '../../components/styled';
3
3
  export const Wrapper = styled.section `
4
4
  display: flex;
@@ -13,14 +13,12 @@ export const BeforeContentWrapper = styled.div `
13
13
  padding: ${({ theme }) => theme.spacing(0, 4)};
14
14
  }
15
15
  `;
16
- export const StyledStepperWizard = styled(StepperWizard) `
17
- margin-bottom: ${({ theme }) => theme.spacing(4)};
16
+ export const StyledNewStepper = styled(NewStepper) `
17
+ margin-bottom: ${({ theme }) => theme.spacing(5)};
18
18
  padding: ${({ theme }) => theme.spacing(0, 6)};
19
19
 
20
20
  ${({ theme }) => theme.breakpoints.down('sm')} {
21
- overflow-x: auto;
22
-
23
- margin-bottom: ${({ theme }) => theme.spacing(6)};
21
+ margin-bottom: ${({ theme }) => theme.spacing(4)};
24
22
  padding: ${({ theme }) => theme.spacing(0, 4)};
25
23
  }
26
24
  `;
@@ -3,12 +3,11 @@ import { type FormWizardProps } from '../FormWizard';
3
3
  type UseLogicParams<TFormValues extends Record<string, unknown>> = FormWizardProps<TFormValues>;
4
4
  export declare const useLogic: <TFormValues extends Record<string, unknown>>({ currentStepId, steps, submitButtonText, isLastStep, }: UseLogicParams<TFormValues>) => {
5
5
  Component: import("react").FunctionComponent<{}>;
6
- stepWizardProps: {
7
- activeStep: number;
8
- steps: {
9
- label: string;
10
- }[];
11
- };
6
+ steps: {
7
+ label: string;
8
+ stepId: number;
9
+ }[];
10
+ activeStep: number;
12
11
  footerProps: {
13
12
  prevButtonText: string;
14
13
  submitButtonText: string;
@@ -5,17 +5,16 @@ export const useLogic = ({ currentStepId, steps, submitButtonText, isLastStep, }
5
5
  ? steps?.findIndex(({ id }) => Object.is(id, currentStepId))
6
6
  : 0, [currentStepId, steps]);
7
7
  const currentStep = steps[indexStep];
8
- const stepsByLabel = steps.map(({ label }) => ({
8
+ const stepsByLabel = steps.map(({ label }, index) => ({
9
9
  label,
10
+ stepId: index,
10
11
  }));
11
12
  const prevButtonText = currentStep.prevButtonText || DEFAULT_PREV_BUTTON_TEXT;
12
13
  const nextButtonText = currentStep.nextButtonText || DEFAULT_NEXT_BUTTON_TEXT;
13
14
  return {
14
15
  Component: currentStep.component,
15
- stepWizardProps: {
16
- activeStep: indexStep,
17
- steps: stepsByLabel,
18
- },
16
+ steps: stepsByLabel,
17
+ activeStep: indexStep,
19
18
  footerProps: {
20
19
  prevButtonText,
21
20
  submitButtonText: isLastStep ? submitButtonText : nextButtonText,
@@ -65,8 +65,10 @@ export const useFormWizard = ({ initialStepId, defaultValues, isDisabled, steps,
65
65
  return;
66
66
  };
67
67
  const handleClickStep = (index) => {
68
- const stepId = steps[index].id;
69
- setCurrentStepId(stepId);
68
+ if (index < 0 || index >= visibleSteps.length) {
69
+ return;
70
+ }
71
+ setCurrentStepId(visibleSteps[index].id);
70
72
  };
71
73
  const handlePrevStep = () => {
72
74
  if (isFirstStep) {
@@ -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
  `;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FormWizard = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ContentState_1 = require("../../components/ContentState");
6
+ const NewStepper_1 = require("../../components/NewStepper");
6
7
  const Form_1 = require("../Form");
7
8
  const Footer_1 = require("./Footer");
8
9
  const styles_1 = require("./styles");
@@ -11,7 +12,7 @@ const useLogic_1 = require("./useLogic");
11
12
  * FormWizard предназначен для построения форм со степпером.
12
13
  */
13
14
  const FormWizard = (props) => {
14
- const { Component, footerProps, stepWizardProps } = (0, useLogic_1.useLogic)(props);
15
+ const { Component, footerProps, activeStep, steps } = (0, useLogic_1.useLogic)(props);
15
16
  const { className, isFirstStep, isLastStep, isDisabled, isLoading, isError, form, customFooter, errorMsg, onRetry, onClickStep, onPrevStep, onSubmit, onSubmitError, beforeContent, } = props;
16
17
  const renderFooter = () => {
17
18
  if (customFooter) {
@@ -25,7 +26,7 @@ const FormWizard = (props) => {
25
26
  }
26
27
  return ((0, jsx_runtime_1.jsx)(Footer_1.Footer, { isDisabled: isDisabled, isFirstStep: isFirstStep, isLastStep: isLastStep, onPrevStep: onPrevStep, ...footerProps }));
27
28
  };
28
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, children: [beforeContent && ((0, jsx_runtime_1.jsx)(styles_1.BeforeContentWrapper, { children: beforeContent })), (0, jsx_runtime_1.jsx)(styles_1.StyledStepperWizard, { connector: "arrow", onClickPrevStep: onClickStep, ...stepWizardProps }), (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isLoading: isLoading, isError: isError,
29
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, children: [beforeContent && ((0, jsx_runtime_1.jsx)(styles_1.BeforeContentWrapper, { children: beforeContent })), (0, jsx_runtime_1.jsx)(styles_1.StyledNewStepper, { connector: "arrow", onClickPrevStep: onClickStep, activeStep: activeStep, children: steps.map((step) => ((0, jsx_runtime_1.jsx)(NewStepper_1.Step, { ...step }, step.stepId))) }), (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isLoading: isLoading, isError: isError,
29
30
  // biome-ignore lint/suspicious/noTsIgnore: onRetry не требуется, если форма не инициализируется данными, получаемыми с backend
30
31
  // @ts-ignore
31
32
  errorState: { errorList: [errorMsg || ''], onRetry }, children: (0, jsx_runtime_1.jsxs)(Form_1.Form, { form: form, isDisabled: isDisabled, onSubmit: form.handleSubmit(onSubmit, onSubmitError), children: [(0, jsx_runtime_1.jsx)(styles_1.FormContent, { children: (0, jsx_runtime_1.jsx)(Component, {}) }), renderFooter()] }) })] }));
@@ -7,10 +7,7 @@ export declare const BeforeContentWrapper: import("@emotion/styled/dist/declarat
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
8
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
9
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
- export declare const StyledStepperWizard: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Omit<import("../..").StepperProps, "children"> & {
11
- steps: import("../../components/StepperWizard").StepWizard[];
12
- onClickPrevStep?: ((index: number) => void) | undefined;
13
- } & {
10
+ export declare const StyledNewStepper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../components/NewStepper").StepperProps & {
14
11
  theme?: import("@emotion/react").Theme | undefined;
15
12
  }, {}, {}>;
16
13
  export declare const FormContent: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormContent = exports.StyledStepperWizard = exports.BeforeContentWrapper = exports.Wrapper = void 0;
4
- const StepperWizard_1 = require("../../components/StepperWizard");
3
+ exports.FormContent = exports.StyledNewStepper = exports.BeforeContentWrapper = exports.Wrapper = void 0;
4
+ const NewStepper_1 = require("../../components/NewStepper");
5
5
  const styled_1 = require("../../components/styled");
6
6
  exports.Wrapper = styled_1.styled.section `
7
7
  display: flex;
@@ -16,14 +16,12 @@ exports.BeforeContentWrapper = styled_1.styled.div `
16
16
  padding: ${({ theme }) => theme.spacing(0, 4)};
17
17
  }
18
18
  `;
19
- exports.StyledStepperWizard = (0, styled_1.styled)(StepperWizard_1.StepperWizard) `
20
- margin-bottom: ${({ theme }) => theme.spacing(4)};
19
+ exports.StyledNewStepper = (0, styled_1.styled)(NewStepper_1.NewStepper) `
20
+ margin-bottom: ${({ theme }) => theme.spacing(5)};
21
21
  padding: ${({ theme }) => theme.spacing(0, 6)};
22
22
 
23
23
  ${({ theme }) => theme.breakpoints.down('sm')} {
24
- overflow-x: auto;
25
-
26
- margin-bottom: ${({ theme }) => theme.spacing(6)};
24
+ margin-bottom: ${({ theme }) => theme.spacing(4)};
27
25
  padding: ${({ theme }) => theme.spacing(0, 4)};
28
26
  }
29
27
  `;
@@ -3,12 +3,11 @@ import { type FormWizardProps } from '../FormWizard';
3
3
  type UseLogicParams<TFormValues extends Record<string, unknown>> = FormWizardProps<TFormValues>;
4
4
  export declare const useLogic: <TFormValues extends Record<string, unknown>>({ currentStepId, steps, submitButtonText, isLastStep, }: UseLogicParams<TFormValues>) => {
5
5
  Component: import("react").FunctionComponent<{}>;
6
- stepWizardProps: {
7
- activeStep: number;
8
- steps: {
9
- label: string;
10
- }[];
11
- };
6
+ steps: {
7
+ label: string;
8
+ stepId: number;
9
+ }[];
10
+ activeStep: number;
12
11
  footerProps: {
13
12
  prevButtonText: string;
14
13
  submitButtonText: string;
@@ -8,17 +8,16 @@ const useLogic = ({ currentStepId, steps, submitButtonText, isLastStep, }) => {
8
8
  ? steps?.findIndex(({ id }) => Object.is(id, currentStepId))
9
9
  : 0, [currentStepId, steps]);
10
10
  const currentStep = steps[indexStep];
11
- const stepsByLabel = steps.map(({ label }) => ({
11
+ const stepsByLabel = steps.map(({ label }, index) => ({
12
12
  label,
13
+ stepId: index,
13
14
  }));
14
15
  const prevButtonText = currentStep.prevButtonText || constants_1.DEFAULT_PREV_BUTTON_TEXT;
15
16
  const nextButtonText = currentStep.nextButtonText || constants_1.DEFAULT_NEXT_BUTTON_TEXT;
16
17
  return {
17
18
  Component: currentStep.component,
18
- stepWizardProps: {
19
- activeStep: indexStep,
20
- steps: stepsByLabel,
21
- },
19
+ steps: stepsByLabel,
20
+ activeStep: indexStep,
22
21
  footerProps: {
23
22
  prevButtonText,
24
23
  submitButtonText: isLastStep ? submitButtonText : nextButtonText,
@@ -68,8 +68,10 @@ const useFormWizard = ({ initialStepId, defaultValues, isDisabled, steps, autoSa
68
68
  return;
69
69
  };
70
70
  const handleClickStep = (index) => {
71
- const stepId = steps[index].id;
72
- setCurrentStepId(stepId);
71
+ if (index < 0 || index >= visibleSteps.length) {
72
+ return;
73
+ }
74
+ setCurrentStepId(visibleSteps[index].id);
73
75
  };
74
76
  const handlePrevStep = () => {
75
77
  if (isFirstStep) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.50.0",
3
+ "version": "4.51.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {
@@ -1 +0,0 @@
1
- export * from './useLogic';
@@ -1 +0,0 @@
1
- export * from './useLogic';
@@ -1,7 +0,0 @@
1
- type UseLogicParams = {
2
- stepId: number;
3
- };
4
- export declare const useLogic: ({ stepId }: UseLogicParams) => {
5
- isStepActive: boolean;
6
- };
7
- export {};
@@ -1,7 +0,0 @@
1
- import { useContext } from 'react';
2
- import { StepperContext } from '../../../StepperContext';
3
- export const useLogic = ({ stepId }) => {
4
- const { activeStep } = useContext(StepperContext);
5
- const isStepActive = activeStep === stepId;
6
- return { isStepActive };
7
- };
@@ -1 +0,0 @@
1
- export * from './useLogic';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./useLogic"), exports);
@@ -1,7 +0,0 @@
1
- type UseLogicParams = {
2
- stepId: number;
3
- };
4
- export declare const useLogic: ({ stepId }: UseLogicParams) => {
5
- isStepActive: boolean;
6
- };
7
- export {};
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useLogic = void 0;
4
- const react_1 = require("react");
5
- const StepperContext_1 = require("../../../StepperContext");
6
- const useLogic = ({ stepId }) => {
7
- const { activeStep } = (0, react_1.useContext)(StepperContext_1.StepperContext);
8
- const isStepActive = activeStep === stepId;
9
- return { isStepActive };
10
- };
11
- exports.useLogic = useLogic;