Skip to content

Commit

Permalink
(fix) O3-4268 Show Number input steppers in the number field (#449)
Browse files Browse the repository at this point in the history
* (fix) O3-4268 Show Number input steppers in the number field

* refactored OR to nullish coalescing
  • Loading branch information
Muta-Jonathan authored Dec 17, 2024
1 parent 39c7051 commit 987f82c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/inputs/number/number.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ const NumberField: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
onBlur={onBlur}
allowEmpty={true}
size="lg"
hideSteppers={true}
hideSteppers={field.hideSteppers ?? false}
onWheel={(e) => e.target.blur()}
disabled={field.isDisabled}
readOnly={isTrue(field.readonly)}
className={classNames(styles.controlWidthConstrained, styles.boldedLabel)}
warn={warnings.length > 0}
warnText={warnings[0]?.message}
step={0.01}
step={field.questionOptions.step ?? 0.01}
/>
</Layer>
)
Expand Down
5 changes: 5 additions & 0 deletions src/types/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export interface FormField {
questionInfo?: string;
historicalExpression?: string;
constrainMaxWidth?: boolean;
hideSteppers?: boolean;
/** @deprecated */
inlineMultiCheckbox?: boolean;
meta?: QuestionMetaProps;
Expand Down Expand Up @@ -143,6 +144,10 @@ export interface FormQuestionOptions {
*/
max?: string;
min?: string;
/**
* specifies the increment or decrement step for number field values
*/
step?: number;
/**
* maxLength and maxLength are used to validate text field length
*/
Expand Down

0 comments on commit 987f82c

Please sign in to comment.