From 0a7d48e2131bfd764c14747bd4e5f93cedba38d5 Mon Sep 17 00:00:00 2001 From: lilyvc <45168453+lilyvc@users.noreply.github.com> Date: Wed, 22 May 2024 13:45:29 +0100 Subject: [PATCH] support read only --- packages/lab/src/stepper-input/StepperInput.tsx | 8 ++++---- packages/lab/src/stepper-input/useStepperInput.ts | 2 ++ .../lab/stories/stepper-input/stepper-input.stories.tsx | 9 +++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/lab/src/stepper-input/StepperInput.tsx b/packages/lab/src/stepper-input/StepperInput.tsx index 3b6bd5221a3..0c2c745cc29 100644 --- a/packages/lab/src/stepper-input/StepperInput.tsx +++ b/packages/lab/src/stepper-input/StepperInput.tsx @@ -11,7 +11,7 @@ import stepperInputCss from "./StepperInput.css"; const withBaseName = makePrefixer("saltStepperInput"); export interface StepperInputProps - extends Omit { + extends Omit { /** * A multiplier applied to the `step` when the value is incremented or decremented using the PageDown/PageUp keys. */ @@ -65,12 +65,12 @@ export interface StepperInputProps export const StepperInput = forwardRef( function StepperInput(props, ref) { const { - textAlign = "left", className, hideButtons, onBlur, onChange, onFocus, + readOnly, ...rest } = props; @@ -91,10 +91,10 @@ export const StepperInput = forwardRef( onBlur={onBlur} onFocus={onFocus} ref={inputRef} - textAlign={textAlign} + readOnly={readOnly} {...getInputProps(rest)} /> - {!hideButtons && ( + {!hideButtons && !readOnly && (