@@ -6,16 +6,11 @@ import type { Equals } from "tsafe";
66import { fr } from "./lib" ;
77import { cx } from "./lib/tools/cx" ;
88import { createComponentI18nApi } from "./lib/i18n" ;
9-
10- // We make users import dsfr.css, so we don't need to import the scoped CSS
11- // but in the future if we have a complete component coverage it
12- // we could stop requiring users to import the hole CSS and only import on a
13- // per component basis.
149import "./dsfr/component/stepper/stepper.css" ;
1510
1611export type StepperProps = {
1712 className ?: string ;
18- step : number ;
13+ currentStep : number ;
1914 stepCount : number ;
2015 title : ReactNode ;
2116 nextTitle ?: ReactNode ;
@@ -25,7 +20,15 @@ export type StepperProps = {
2520/** @see <https://react-dsfr-components.etalab.studio/?path=/docs/components-stepper> */
2621export const Stepper = memo (
2722 forwardRef < HTMLDivElement , StepperProps > ( ( props , ref ) => {
28- const { className, step, stepCount, title, nextTitle, classes = { } , ...rest } = props ;
23+ const {
24+ className,
25+ currentStep,
26+ stepCount,
27+ title,
28+ nextTitle,
29+ classes = { } ,
30+ ...rest
31+ } = props ;
2932
3033 assert < Equals < keyof typeof rest , never > > ( ) ;
3134
@@ -35,13 +38,13 @@ export const Stepper = memo(
3538 < div className = { cx ( fr . cx ( "fr-stepper" ) , classes . root , className ) } ref = { ref } >
3639 < h2 className = { cx ( fr . cx ( "fr-stepper__title" ) , classes . title ) } >
3740 < span className = { cx ( fr . cx ( "fr-stepper__state" ) , classes . state ) } >
38- { t ( "progress" , { step , stepCount } ) }
41+ { t ( "progress" , { currentStep , stepCount } ) }
3942 </ span >
4043 { title }
4144 </ h2 >
4245 < div
4346 className = { cx ( fr . cx ( "fr-stepper__steps" ) , classes . steps ) }
44- data-fr-current-step = { step }
47+ data-fr-current-step = { currentStep }
4548 data-fr-steps = { stepCount }
4649 > </ div >
4750 { nextTitle !== undefined && (
@@ -60,8 +63,8 @@ const { useTranslation, addStepperTranslations } = createComponentI18nApi({
6063 "componentName" : symToStr ( { Stepper } ) ,
6164 "frMessages" : {
6265 /* spell-checker: disable */
63- "progress" : ( p : { step : number ; stepCount : number } ) =>
64- `Étape ${ p . step } sur ${ p . stepCount } ` ,
66+ "progress" : ( p : { currentStep : number ; stepCount : number } ) =>
67+ `Étape ${ p . currentStep } sur ${ p . stepCount } ` ,
6568 "next step" : `Étape suivante :`
6669 /* spell-checker: enable */
6770 }
@@ -70,7 +73,7 @@ const { useTranslation, addStepperTranslations } = createComponentI18nApi({
7073addStepperTranslations ( {
7174 "lang" : "en" ,
7275 "messages" : {
73- "progress" : ( { step , stepCount } ) => `Step ${ step } over ${ stepCount } ` ,
76+ "progress" : ( { currentStep , stepCount } ) => `Step ${ currentStep } over ${ stepCount } ` ,
7477 "next step" : "Next step: "
7578 }
7679} ) ;
0 commit comments