Skip to content

Commit

Permalink
Ensure that TextField can't be of type number
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph committed Nov 16, 2023
1 parent 140d6e4 commit 17c6722
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/components/form/fields/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright Oxide Computer Company
*/
import cn from 'classnames'
import { useId } from 'react'
import { useId, type HTMLInputTypeAttribute } from 'react'
import {
Controller,
type Control,
Expand All @@ -30,10 +30,10 @@ import { ErrorMessage } from './ErrorMessage'
export interface TextFieldProps<
TFieldValues extends FieldValues,
TName extends FieldPath<TFieldValues>,
> extends UITextFieldProps {
> extends Omit<UITextFieldProps, 'type'> {
name: TName
/** HTML type attribute, defaults to text */
type?: string
type?: Omit<HTMLInputTypeAttribute, 'number'>
/** Will default to name if not provided */
label?: string
/**
Expand Down Expand Up @@ -134,7 +134,7 @@ export const TextFieldInner = <
<UITextField
id={id}
title={label}
type={type}
type={type as string}
error={!!error}
aria-labelledby={cn(`${id}-label`, {
[`${id}-help-text`]: !!description,
Expand Down

0 comments on commit 17c6722

Please sign in to comment.