@astral/ui 4.49.0 → 4.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/NewStepper/NewStepper.d.ts +2 -0
- package/components/NewStepper/NewStepper.js +30 -0
- package/components/NewStepper/Step/Description/Description.d.ts +7 -0
- package/components/NewStepper/Step/Description/Description.js +8 -0
- package/components/NewStepper/Step/Description/index.d.ts +1 -0
- package/components/NewStepper/Step/Description/index.js +1 -0
- package/components/NewStepper/Step/Description/styles.d.ts +11 -0
- package/components/NewStepper/Step/Description/styles.js +18 -0
- package/components/NewStepper/Step/Label/Label.d.ts +8 -0
- package/components/NewStepper/Step/Label/Label.js +9 -0
- package/components/NewStepper/Step/Label/index.d.ts +1 -0
- package/components/NewStepper/Step/Label/index.js +1 -0
- package/components/NewStepper/Step/Label/styles.d.ts +25 -0
- package/components/NewStepper/Step/Label/styles.js +18 -0
- package/components/NewStepper/Step/Label/useLogic/index.d.ts +1 -0
- package/components/NewStepper/Step/Label/useLogic/index.js +1 -0
- package/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +7 -0
- package/components/NewStepper/Step/Label/useLogic/useLogic.js +7 -0
- package/components/NewStepper/Step/Step.d.ts +2 -0
- package/components/NewStepper/Step/Step.js +80 -0
- package/components/NewStepper/Step/constants.d.ts +28 -0
- package/components/NewStepper/Step/constants.js +25 -0
- package/components/NewStepper/Step/index.d.ts +3 -0
- package/components/NewStepper/Step/index.js +2 -0
- package/components/NewStepper/Step/styles.d.ts +38 -0
- package/components/NewStepper/Step/styles.js +303 -0
- package/components/NewStepper/Step/types.d.ts +44 -0
- package/components/NewStepper/Step/types.js +1 -0
- package/components/NewStepper/Step/useLogic/index.d.ts +1 -0
- package/components/NewStepper/Step/useLogic/index.js +1 -0
- package/components/NewStepper/Step/useLogic/useLogic.d.ts +23 -0
- package/components/NewStepper/Step/useLogic/useLogic.js +55 -0
- package/components/NewStepper/StepIcon/StepIcon.d.ts +28 -0
- package/components/NewStepper/StepIcon/StepIcon.js +34 -0
- package/components/NewStepper/StepIcon/constants.d.ts +7 -0
- package/components/NewStepper/StepIcon/constants.js +8 -0
- package/components/NewStepper/StepIcon/index.d.ts +2 -0
- package/components/NewStepper/StepIcon/index.js +2 -0
- package/components/NewStepper/StepperContext/StepperContext.d.ts +11 -0
- package/components/NewStepper/StepperContext/StepperContext.js +10 -0
- package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +7 -0
- package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +23 -0
- package/components/NewStepper/StepperContext/StepperContextProvider/index.d.ts +1 -0
- package/components/NewStepper/StepperContext/StepperContextProvider/index.js +1 -0
- package/components/NewStepper/StepperContext/index.d.ts +2 -0
- package/components/NewStepper/StepperContext/index.js +2 -0
- package/components/NewStepper/constants.d.ts +12 -0
- package/components/NewStepper/constants.js +13 -0
- package/components/NewStepper/index.d.ts +4 -0
- package/components/NewStepper/index.js +3 -0
- package/components/NewStepper/public.d.ts +4 -0
- package/components/NewStepper/public.js +3 -0
- package/components/NewStepper/styles.d.ts +5 -0
- package/components/NewStepper/styles.js +34 -0
- package/components/NewStepper/types.d.ts +33 -0
- package/components/NewStepper/types.js +1 -0
- package/components/NewStepper/useLogic/index.d.ts +1 -0
- package/components/NewStepper/useLogic/index.js +1 -0
- package/components/NewStepper/useLogic/useLogic.d.ts +15 -0
- package/components/NewStepper/useLogic/useLogic.js +47 -0
- package/components/NewStepper/useLogic/utils/index.d.ts +1 -0
- package/components/NewStepper/useLogic/utils/index.js +1 -0
- package/components/NewStepper/useLogic/utils/validateStepperProps/index.d.ts +1 -0
- package/components/NewStepper/useLogic/utils/validateStepperProps/index.js +1 -0
- package/components/NewStepper/useLogic/utils/validateStepperProps/validateStepperProps.d.ts +5 -0
- package/components/NewStepper/useLogic/utils/validateStepperProps/validateStepperProps.js +16 -0
- package/components/Stepper/Stepper.d.ts +3 -0
- package/components/Stepper/Stepper.js +3 -0
- package/components/StepperWizard/StepperWizard.d.ts +3 -0
- package/components/StepperWizard/StepperWizard.js +3 -0
- package/components/Typography/Typography.js +1 -1
- package/components/Typography/constants.d.ts +1 -0
- package/components/Typography/constants.js +2 -0
- package/node/components/NewStepper/NewStepper.d.ts +2 -0
- package/node/components/NewStepper/NewStepper.js +34 -0
- package/node/components/NewStepper/Step/Description/Description.d.ts +7 -0
- package/node/components/NewStepper/Step/Description/Description.js +12 -0
- package/node/components/NewStepper/Step/Description/index.d.ts +1 -0
- package/node/components/NewStepper/Step/Description/index.js +17 -0
- package/node/components/NewStepper/Step/Description/styles.d.ts +11 -0
- package/node/components/NewStepper/Step/Description/styles.js +21 -0
- package/node/components/NewStepper/Step/Label/Label.d.ts +8 -0
- package/node/components/NewStepper/Step/Label/Label.js +13 -0
- package/node/components/NewStepper/Step/Label/index.d.ts +1 -0
- package/node/components/NewStepper/Step/Label/index.js +5 -0
- package/node/components/NewStepper/Step/Label/styles.d.ts +25 -0
- package/node/components/NewStepper/Step/Label/styles.js +21 -0
- package/node/components/NewStepper/Step/Label/useLogic/index.d.ts +1 -0
- package/node/components/NewStepper/Step/Label/useLogic/index.js +17 -0
- package/node/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +7 -0
- package/node/components/NewStepper/Step/Label/useLogic/useLogic.js +11 -0
- package/node/components/NewStepper/Step/Step.d.ts +2 -0
- package/node/components/NewStepper/Step/Step.js +84 -0
- package/node/components/NewStepper/Step/constants.d.ts +28 -0
- package/node/components/NewStepper/Step/constants.js +28 -0
- package/node/components/NewStepper/Step/index.d.ts +3 -0
- package/node/components/NewStepper/Step/index.js +7 -0
- package/node/components/NewStepper/Step/styles.d.ts +38 -0
- package/node/components/NewStepper/Step/styles.js +306 -0
- package/node/components/NewStepper/Step/types.d.ts +44 -0
- package/node/components/NewStepper/Step/types.js +2 -0
- package/node/components/NewStepper/Step/useLogic/index.d.ts +1 -0
- package/node/components/NewStepper/Step/useLogic/index.js +17 -0
- package/node/components/NewStepper/Step/useLogic/useLogic.d.ts +23 -0
- package/node/components/NewStepper/Step/useLogic/useLogic.js +59 -0
- package/node/components/NewStepper/StepIcon/StepIcon.d.ts +28 -0
- package/node/components/NewStepper/StepIcon/StepIcon.js +38 -0
- package/node/components/NewStepper/StepIcon/constants.d.ts +7 -0
- package/node/components/NewStepper/StepIcon/constants.js +11 -0
- package/node/components/NewStepper/StepIcon/index.d.ts +2 -0
- package/node/components/NewStepper/StepIcon/index.js +7 -0
- package/node/components/NewStepper/StepperContext/StepperContext.d.ts +11 -0
- package/node/components/NewStepper/StepperContext/StepperContext.js +13 -0
- package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +7 -0
- package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +27 -0
- package/node/components/NewStepper/StepperContext/StepperContextProvider/index.d.ts +1 -0
- package/node/components/NewStepper/StepperContext/StepperContextProvider/index.js +17 -0
- package/node/components/NewStepper/StepperContext/index.d.ts +2 -0
- package/node/components/NewStepper/StepperContext/index.js +18 -0
- package/node/components/NewStepper/constants.d.ts +12 -0
- package/node/components/NewStepper/constants.js +16 -0
- package/node/components/NewStepper/index.d.ts +4 -0
- package/node/components/NewStepper/index.js +10 -0
- package/node/components/NewStepper/public.d.ts +4 -0
- package/node/components/NewStepper/public.js +10 -0
- package/node/components/NewStepper/styles.d.ts +5 -0
- package/node/components/NewStepper/styles.js +37 -0
- package/node/components/NewStepper/types.d.ts +33 -0
- package/node/components/NewStepper/types.js +2 -0
- package/node/components/NewStepper/useLogic/index.d.ts +1 -0
- package/node/components/NewStepper/useLogic/index.js +17 -0
- package/node/components/NewStepper/useLogic/useLogic.d.ts +15 -0
- package/node/components/NewStepper/useLogic/useLogic.js +51 -0
- package/node/components/NewStepper/useLogic/utils/index.d.ts +1 -0
- package/node/components/NewStepper/useLogic/utils/index.js +17 -0
- package/node/components/NewStepper/useLogic/utils/validateStepperProps/index.d.ts +1 -0
- package/node/components/NewStepper/useLogic/utils/validateStepperProps/index.js +17 -0
- package/node/components/NewStepper/useLogic/utils/validateStepperProps/validateStepperProps.d.ts +5 -0
- package/node/components/NewStepper/useLogic/utils/validateStepperProps/validateStepperProps.js +20 -0
- package/node/components/Stepper/Stepper.d.ts +3 -0
- package/node/components/Stepper/Stepper.js +3 -0
- package/node/components/StepperWizard/StepperWizard.d.ts +3 -0
- package/node/components/StepperWizard/StepperWizard.js +3 -0
- package/node/components/Typography/Typography.js +1 -1
- package/node/components/Typography/constants.d.ts +1 -0
- package/node/components/Typography/constants.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { styled } from '../styled';
|
|
2
|
+
import { stepperClassnames } from './constants';
|
|
3
|
+
export const Wrapper = styled.div `
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: flex-start;
|
|
6
|
+
|
|
7
|
+
&.${stepperClassnames.orientationHorizontal} {
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
|
|
10
|
+
&.${stepperClassnames.arrowConnector} {
|
|
11
|
+
align-items: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.${stepperClassnames.lineConnector} {
|
|
15
|
+
&:not(.${stepperClassnames.alternativeLabel}) {
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.${stepperClassnames.orientationVertical} {
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
|
|
24
|
+
&.${stepperClassnames.lineConnector} {
|
|
25
|
+
gap: ${({ theme }) => theme.microSpacing(1)};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
30
|
+
overflow-x: auto;
|
|
31
|
+
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type StepperProps = {
|
|
3
|
+
activeStep?: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Тип соединителя между шагами
|
|
7
|
+
*/
|
|
8
|
+
connector?: 'arrow' | 'line';
|
|
9
|
+
orientation?: 'horizontal' | 'vertical';
|
|
10
|
+
/**
|
|
11
|
+
* Отображение названия шага под иконкой
|
|
12
|
+
*
|
|
13
|
+
* Работает только с `orientation="horizontal"` и типом `connector: "line"`.
|
|
14
|
+
*/
|
|
15
|
+
alternativeLabel?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Функция вызываемая при клике на предыдущий шаг. Делает кликабельными только предыдущие шаги.
|
|
18
|
+
*/
|
|
19
|
+
onClickPrevStep?: (index: number) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Функция вызываемая при клике на шаг. Делает все шаги кликабельными.
|
|
22
|
+
*/
|
|
23
|
+
onClickStep?: (index: number) => void;
|
|
24
|
+
/**
|
|
25
|
+
* @example
|
|
26
|
+
* <NewStepper>
|
|
27
|
+
* <Step label="Step 1" stepId={1} />
|
|
28
|
+
* <Step label="Step 2" stepId={2} />
|
|
29
|
+
* <Step label="Step 3" stepId={3} />
|
|
30
|
+
* </NewStepper>
|
|
31
|
+
*/
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StepperProps } from '../types';
|
|
3
|
+
type UseLogicParams = StepperProps;
|
|
4
|
+
export declare const useLogic: ({ orientation, connector, alternativeLabel, activeStep, onClickPrevStep, onClickStep, className, children, }: UseLogicParams) => {
|
|
5
|
+
containerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
6
|
+
stepperConnector: "line" | "arrow";
|
|
7
|
+
stepperAlternativeLabel: boolean;
|
|
8
|
+
activeStep: number;
|
|
9
|
+
onClickPrevStep: ((index: number) => void) | undefined;
|
|
10
|
+
orientation: "horizontal" | "vertical";
|
|
11
|
+
onClickStep: ((index: number) => void) | undefined;
|
|
12
|
+
className: string | undefined;
|
|
13
|
+
children: import("react").ReactNode;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useViewportType } from '../../useViewportType';
|
|
3
|
+
import { MOBILE_ACTIVE_STEP_SCROLL_DEFER_MS } from '../constants';
|
|
4
|
+
import { validateStepperProps } from './utils';
|
|
5
|
+
export const useLogic = ({ orientation = 'horizontal', connector = 'line', alternativeLabel = false, activeStep = 0, onClickPrevStep, onClickStep, className, children, }) => {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
validateStepperProps({ orientation, connector, alternativeLabel });
|
|
8
|
+
}, []);
|
|
9
|
+
const { isMobile } = useViewportType();
|
|
10
|
+
// На разрешении sm и ниже connector line + alternativeLabel выглядит как connector arrow без alternativeLabel
|
|
11
|
+
const isMobileDisplayStepper = isMobile && orientation === 'horizontal' && connector === 'line';
|
|
12
|
+
const stepperConnector = isMobileDisplayStepper ? 'arrow' : connector;
|
|
13
|
+
const stepperAlternativeLabel = isMobileDisplayStepper
|
|
14
|
+
? false
|
|
15
|
+
: alternativeLabel;
|
|
16
|
+
const containerRef = useRef(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!isMobile || !containerRef.current) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const container = containerRef.current;
|
|
22
|
+
const runScroll = () => {
|
|
23
|
+
const activeStepElement = container.querySelector('[data-active-step="true"]');
|
|
24
|
+
if (activeStepElement) {
|
|
25
|
+
activeStepElement.scrollIntoView({
|
|
26
|
+
behavior: 'smooth',
|
|
27
|
+
block: 'nearest',
|
|
28
|
+
inline: 'center',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
runScroll();
|
|
34
|
+
}, MOBILE_ACTIVE_STEP_SCROLL_DEFER_MS);
|
|
35
|
+
}, [activeStep, isMobile, orientation]);
|
|
36
|
+
return {
|
|
37
|
+
containerRef,
|
|
38
|
+
stepperConnector,
|
|
39
|
+
stepperAlternativeLabel,
|
|
40
|
+
activeStep,
|
|
41
|
+
onClickPrevStep,
|
|
42
|
+
orientation,
|
|
43
|
+
onClickStep,
|
|
44
|
+
className,
|
|
45
|
+
children,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validateStepperProps';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validateStepperProps';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validateStepperProps';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validateStepperProps';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noConsole: Сообщение для интеграторов */
|
|
2
|
+
import type { StepperProps } from '../../../types';
|
|
3
|
+
type ValidateStepperPropsParams = Pick<StepperProps, 'orientation' | 'connector' | 'alternativeLabel'>;
|
|
4
|
+
export declare const validateStepperProps: ({ orientation, connector, alternativeLabel, }: ValidateStepperPropsParams) => void;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const VALID_COMBINATIONS = [
|
|
2
|
+
{ orientation: 'horizontal', connector: 'line', alternativeLabel: true },
|
|
3
|
+
{ orientation: 'vertical', connector: 'line', alternativeLabel: false },
|
|
4
|
+
{ orientation: 'horizontal', connector: 'arrow', alternativeLabel: false },
|
|
5
|
+
];
|
|
6
|
+
export const validateStepperProps = ({ orientation, connector, alternativeLabel, }) => {
|
|
7
|
+
const isValid = VALID_COMBINATIONS.some((combo) => combo.orientation === orientation &&
|
|
8
|
+
combo.connector === connector &&
|
|
9
|
+
combo.alternativeLabel === alternativeLabel);
|
|
10
|
+
if (!isValid) {
|
|
11
|
+
console.error('Stepper: Неподдерживаемая комбинация параметров. Допустимые варианты:\n' +
|
|
12
|
+
'1) orientation="horizontal", connector="line", alternativeLabel=true\n' +
|
|
13
|
+
'2) orientation="vertical", connector="line", alternativeLabel=false\n' +
|
|
14
|
+
'3) orientation="horizontal", connector="arrow", alternativeLabel=false');
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -8,5 +8,8 @@ type ConnectorProp = `${ConnectorTypes}` | ReactElement<StepConnectorProps> | nu
|
|
|
8
8
|
export type StepperProps = Omit<StepperPropsWithoutEmotionSpecific, 'connector'> & {
|
|
9
9
|
connector?: ConnectorProp;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Причина отказа от поддержки: Отказ от MUI. Используйте компонент `NewStepper`.
|
|
13
|
+
*/
|
|
11
14
|
export declare const Stepper: (props: StepperProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
export {};
|
|
@@ -2,6 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { ArrowConnector } from './ArrowConnector';
|
|
4
4
|
import { StyledStepper } from './styles';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Причина отказа от поддержки: Отказ от MUI. Используйте компонент `NewStepper`.
|
|
7
|
+
*/
|
|
5
8
|
export const Stepper = (props) => {
|
|
6
9
|
const { connector, ...restProps } = props;
|
|
7
10
|
const connectorMemo = useMemo(() => {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Step, StepButton, StepLabel, Stepper } from '../Stepper';
|
|
3
3
|
import { useLogic } from './useLogic';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Причина отказа от поддержки: Отказ от MUI. Используйте компонент `NewStepper`.
|
|
6
|
+
*/
|
|
4
7
|
export const StepperWizard = (props) => {
|
|
5
8
|
const { clickableSteps, normalSteps, getStepButtonProps, getStepLabelProps } = useLogic(props);
|
|
6
9
|
const { steps, onClickPrevStep, ...stepperProps } = props;
|
|
@@ -6,7 +6,7 @@ import { useTypographyColor } from './hooks';
|
|
|
6
6
|
import { TypographyWrapper } from './styles';
|
|
7
7
|
export const Typography = forwardRef(({ children, color, colorIntensity = '800', component, withoutCalt, className, ...props }, ref) => {
|
|
8
8
|
const typographyColor = useTypographyColor({ color, colorIntensity });
|
|
9
|
-
return (_jsx(TypographyWrapper, { ref: ref, ...props, component: component, color: typographyColor, className: classNames(className, {
|
|
9
|
+
return (_jsx(TypographyWrapper, { ref: ref, ...props, component: component, color: typographyColor, className: classNames(typographyClassnames.root, className, {
|
|
10
10
|
[typographyClassnames.withoutCalt]: withoutCalt,
|
|
11
11
|
}), children: children }));
|
|
12
12
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NewStepper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const classNames_1 = require("../utils/classNames");
|
|
6
|
+
const cva_1 = require("../utils/cva");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const StepperContext_1 = require("./StepperContext");
|
|
9
|
+
const styles_1 = require("./styles");
|
|
10
|
+
const useLogic_1 = require("./useLogic");
|
|
11
|
+
const stepper = (0, cva_1.cva)(constants_1.stepperClassnames.root, {
|
|
12
|
+
variants: {
|
|
13
|
+
orientation: {
|
|
14
|
+
horizontal: constants_1.stepperClassnames.orientationHorizontal,
|
|
15
|
+
vertical: constants_1.stepperClassnames.orientationVertical,
|
|
16
|
+
},
|
|
17
|
+
alternativeLabel: {
|
|
18
|
+
true: constants_1.stepperClassnames.alternativeLabel,
|
|
19
|
+
},
|
|
20
|
+
connector: {
|
|
21
|
+
arrow: constants_1.stepperClassnames.arrowConnector,
|
|
22
|
+
line: constants_1.stepperClassnames.lineConnector,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const NewStepper = (props) => {
|
|
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({
|
|
29
|
+
alternativeLabel: stepperAlternativeLabel,
|
|
30
|
+
connector: stepperConnector,
|
|
31
|
+
orientation,
|
|
32
|
+
}), className), children: children }) }));
|
|
33
|
+
};
|
|
34
|
+
exports.NewStepper = NewStepper;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Description = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styles_1 = require("./styles");
|
|
6
|
+
const Description = ({ children, className }) => {
|
|
7
|
+
if (typeof children === 'string') {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledTypography, { variant: "caption", className: className, children: children }));
|
|
9
|
+
}
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledTypography, { component: "div", className: className, children: children }));
|
|
11
|
+
};
|
|
12
|
+
exports.Description = Description;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Description';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./Description"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledTypography: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../../Typography/types").TypographyPropsBase & {
|
|
3
|
+
color?: import("../../../Typography").TypographyColor | undefined;
|
|
4
|
+
variant?: import("../../../Typography").TypographyVariant | undefined;
|
|
5
|
+
colorIntensity?: import("../../../Typography").Intensity | undefined;
|
|
6
|
+
component?: import("../../../Typography/types").ComponentProp | undefined;
|
|
7
|
+
isUpperCase?: boolean | undefined;
|
|
8
|
+
withoutCalt?: boolean | undefined;
|
|
9
|
+
} & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLSpanElement> & {
|
|
10
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
11
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyledTypography = void 0;
|
|
4
|
+
const styled_1 = require("../../../styled");
|
|
5
|
+
const Typography_1 = require("../../../Typography");
|
|
6
|
+
exports.StyledTypography = (0, styled_1.styled)(Typography_1.Typography) `
|
|
7
|
+
min-height: 22px;
|
|
8
|
+
margin-bottom: ${({ theme }) => theme.microSpacing(1)};
|
|
9
|
+
margin-left: 9px;
|
|
10
|
+
padding-left: 13px;
|
|
11
|
+
|
|
12
|
+
text-align: start;
|
|
13
|
+
|
|
14
|
+
border-left: 2px solid ${({ theme }) => theme.palette.grey[300]};
|
|
15
|
+
|
|
16
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
17
|
+
margin-bottom: 0;
|
|
18
|
+
margin-left: 11px;
|
|
19
|
+
padding-left: 15px;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Label = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Collapse_1 = require("../../../Collapse");
|
|
6
|
+
const Typography_1 = require("../../../Typography");
|
|
7
|
+
const Fade_1 = require("../../../transitions/Fade");
|
|
8
|
+
const constants_1 = require("../constants");
|
|
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 }) }) })] })] }));
|
|
12
|
+
};
|
|
13
|
+
exports.Label = Label;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from './Label';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const MobileLabelGroup: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const MobileCompactLabel: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../../Typography/types").TypographyPropsBase & {
|
|
7
|
+
color?: import("../../../Typography").TypographyColor | undefined;
|
|
8
|
+
variant?: import("../../../Typography").TypographyVariant | undefined;
|
|
9
|
+
colorIntensity?: import("../../../Typography").Intensity | undefined;
|
|
10
|
+
component?: import("../../../Typography/types").ComponentProp | undefined;
|
|
11
|
+
isUpperCase?: boolean | undefined;
|
|
12
|
+
withoutCalt?: boolean | undefined;
|
|
13
|
+
} & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLSpanElement> & {
|
|
14
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
15
|
+
}, {}, {}>;
|
|
16
|
+
export declare const DesktopLabel: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../../Typography/types").TypographyPropsBase & {
|
|
17
|
+
color?: import("../../../Typography").TypographyColor | undefined;
|
|
18
|
+
variant?: import("../../../Typography").TypographyVariant | undefined;
|
|
19
|
+
colorIntensity?: import("../../../Typography").Intensity | undefined;
|
|
20
|
+
component?: import("../../../Typography/types").ComponentProp | undefined;
|
|
21
|
+
isUpperCase?: boolean | undefined;
|
|
22
|
+
withoutCalt?: boolean | undefined;
|
|
23
|
+
} & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLSpanElement> & {
|
|
24
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
25
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DesktopLabel = exports.MobileCompactLabel = exports.MobileLabelGroup = void 0;
|
|
4
|
+
const styled_1 = require("../../../styled");
|
|
5
|
+
const Typography_1 = require("../../../Typography");
|
|
6
|
+
exports.MobileLabelGroup = styled_1.styled.div `
|
|
7
|
+
display: none;
|
|
8
|
+
|
|
9
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
exports.MobileCompactLabel = (0, styled_1.styled)(Typography_1.Typography) `
|
|
15
|
+
display: inline-block;
|
|
16
|
+
`;
|
|
17
|
+
exports.DesktopLabel = (0, styled_1.styled)(Typography_1.Typography) `
|
|
18
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1,17 @@
|
|
|
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);
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Step = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const classNames_1 = require("../../utils/classNames");
|
|
6
|
+
const cva_1 = require("../../utils/cva");
|
|
7
|
+
const StepIcon_1 = require("../StepIcon");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const Description_1 = require("./Description");
|
|
10
|
+
const Label_1 = require("./Label");
|
|
11
|
+
const styles_1 = require("./styles");
|
|
12
|
+
const useLogic_1 = require("./useLogic");
|
|
13
|
+
const step = (0, cva_1.cva)(constants_1.stepClassnames.root, {
|
|
14
|
+
variants: {
|
|
15
|
+
isError: {
|
|
16
|
+
true: constants_1.stepClassnames.error,
|
|
17
|
+
},
|
|
18
|
+
isCompleted: {
|
|
19
|
+
true: constants_1.stepClassnames.completed,
|
|
20
|
+
},
|
|
21
|
+
connector: {
|
|
22
|
+
arrow: constants_1.stepClassnames.connectorArrow,
|
|
23
|
+
line: constants_1.stepClassnames.connectorLine,
|
|
24
|
+
},
|
|
25
|
+
activeStep: {
|
|
26
|
+
true: constants_1.stepClassnames.active,
|
|
27
|
+
},
|
|
28
|
+
alternativeLabel: {
|
|
29
|
+
true: constants_1.stepClassnames.alternativeLabel,
|
|
30
|
+
},
|
|
31
|
+
orientation: {
|
|
32
|
+
horizontal: constants_1.stepClassnames.orientationHorizontal,
|
|
33
|
+
vertical: constants_1.stepClassnames.orientationVertical,
|
|
34
|
+
},
|
|
35
|
+
isDisabled: {
|
|
36
|
+
true: constants_1.stepClassnames.disabled,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const connector = (0, cva_1.cva)(constants_1.stepClassnames.connector, {
|
|
41
|
+
variants: {
|
|
42
|
+
connector: {
|
|
43
|
+
arrow: constants_1.stepClassnames.connectorArrow,
|
|
44
|
+
line: constants_1.stepClassnames.connectorLine,
|
|
45
|
+
},
|
|
46
|
+
alternativeLabel: {
|
|
47
|
+
true: constants_1.stepClassnames.alternativeLabel,
|
|
48
|
+
},
|
|
49
|
+
orientation: {
|
|
50
|
+
horizontal: constants_1.stepClassnames.orientationHorizontal,
|
|
51
|
+
vertical: constants_1.stepClassnames.orientationVertical,
|
|
52
|
+
},
|
|
53
|
+
hasDescription: {
|
|
54
|
+
true: constants_1.stepClassnames.hasDescription,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
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);
|
|
60
|
+
const StepContent = isRenderButton ? styles_1.StyledButton : styles_1.StepContentWrapper;
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "data-active-step": isActiveStep, className: (0, classNames_1.classNames)(step({
|
|
62
|
+
isError,
|
|
63
|
+
isCompleted: isCompletedStep,
|
|
64
|
+
connector: connectorVariant,
|
|
65
|
+
activeStep: isActiveStep,
|
|
66
|
+
alternativeLabel,
|
|
67
|
+
orientation,
|
|
68
|
+
isDisabled,
|
|
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
|
+
[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({
|
|
72
|
+
connector: connectorVariant,
|
|
73
|
+
alternativeLabel,
|
|
74
|
+
orientation,
|
|
75
|
+
}) }))] }), children && ((0, jsx_runtime_1.jsx)(Description_1.Description, { className: constants_1.stepClassnames.description, children: children })), isRenderVerticalLineConnector && ((0, jsx_runtime_1.jsx)(styles_1.LineConnector, { className: connector({
|
|
76
|
+
connector: connectorVariant,
|
|
77
|
+
orientation,
|
|
78
|
+
}) }))] }), isRenderHorizontalLineConnector && ((0, jsx_runtime_1.jsx)(styles_1.LineConnector, { className: connector({
|
|
79
|
+
connector: connectorVariant,
|
|
80
|
+
alternativeLabel,
|
|
81
|
+
orientation,
|
|
82
|
+
}) }))] }));
|
|
83
|
+
};
|
|
84
|
+
exports.Step = Step;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const stepStateClassnames: {
|
|
2
|
+
active: string;
|
|
3
|
+
completed: string;
|
|
4
|
+
error: string;
|
|
5
|
+
warning: string;
|
|
6
|
+
disabled: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const stepClassnames: {
|
|
9
|
+
active: string;
|
|
10
|
+
completed: string;
|
|
11
|
+
error: string;
|
|
12
|
+
warning: string;
|
|
13
|
+
disabled: string;
|
|
14
|
+
root: string;
|
|
15
|
+
label: string;
|
|
16
|
+
description: string;
|
|
17
|
+
iconContainer: string;
|
|
18
|
+
connector: string;
|
|
19
|
+
connectorLine: string;
|
|
20
|
+
connectorArrow: string;
|
|
21
|
+
alternativeLabel: string;
|
|
22
|
+
orientationHorizontal: string;
|
|
23
|
+
orientationVertical: string;
|
|
24
|
+
labelContainer: string;
|
|
25
|
+
labelMobile: string;
|
|
26
|
+
content: string;
|
|
27
|
+
hasDescription: string;
|
|
28
|
+
};
|