diff --git a/.changeset/brown-queens-trade.md b/.changeset/brown-queens-trade.md new file mode 100644 index 000000000..411519120 --- /dev/null +++ b/.changeset/brown-queens-trade.md @@ -0,0 +1,6 @@ +--- +"@mochi-ui/stepper": minor +"@mochi-ui/theme": minor +--- + +Fix Stepper component diff --git a/packages/components/stepper/src/step-indicator.tsx b/packages/components/stepper/src/step-indicator.tsx index 1418b8786..46f8d181b 100644 --- a/packages/components/stepper/src/step-indicator.tsx +++ b/packages/components/stepper/src/step-indicator.tsx @@ -3,7 +3,8 @@ import { stepper } from '@mochi-ui/theme' import { CheckLine, CloseLine, SpinnerLine } from '@mochi-ui/icons' import { useStepperContext } from './context' -const { stepIndicatorClsx } = stepper +const { stepIndicatorClsx, stepIndicatorIconClsx, stepIndicatorLoadingClsx } = + stepper interface StepIndicatorProps extends PropsWithChildren { className?: string @@ -19,13 +20,13 @@ const StepIndicator = forwardRef( let children = null if (isLoading) { status = 'loading' - children = + children = } else if (isError) { status = 'error' - children = + children = } else if (stepStatus === 'complete') { status = 'success' - children = + children = } else { status = stepStatus children = step diff --git a/packages/components/stepper/src/step-separator.tsx b/packages/components/stepper/src/step-separator.tsx index 26d687e6e..348aa738f 100644 --- a/packages/components/stepper/src/step-separator.tsx +++ b/packages/components/stepper/src/step-separator.tsx @@ -23,6 +23,6 @@ const StepSeparator = forwardRef( }, ) -StepSeparator.displayName = 'StepTitle' +StepSeparator.displayName = 'StepSeparator' export { StepSeparator, type StepSeparatorProps } diff --git a/packages/theme/src/components/stepper.ts b/packages/theme/src/components/stepper.ts index df38f25c2..03f3f9fbf 100644 --- a/packages/theme/src/components/stepper.ts +++ b/packages/theme/src/components/stepper.ts @@ -52,6 +52,15 @@ const stepIndicatorClsx = ({ className, ) +const stepIndicatorIconClsx = ({ + className = '', +}: { className?: string } = {}) => clsx('w-4 h-4 text-text-contrast', className) + +const stepIndicatorLoadingClsx = ({ + className = '', +}: { className?: string } = {}) => + clsx('w-full h-full text-primary-solid', className) + const stepContentClsx = ({ className = '' }: { className?: string } = {}) => clsx('flex flex-col space-y-0.5', className) @@ -59,7 +68,7 @@ const stepTitleClsx = ({ className = '' }: { className?: string } = {}) => clsx('', className) const stepDescriptionClsx = ({ className = '' }: { className?: string } = {}) => - clsx('', className) + clsx('font-normal', className) const stepSeparatorClsx = ({ className = '', @@ -85,6 +94,8 @@ const stepper = { stepperCva, stepClsx, stepIndicatorClsx, + stepIndicatorIconClsx, + stepIndicatorLoadingClsx, stepContentClsx, stepTitleClsx, stepDescriptionClsx,