Skip to content

Commit

Permalink
chore(Field.String): add inputMode type (#3111)
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker authored Dec 19, 2023
1 parent d12850d commit 25d276c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import DataValueReadwriteProperties from '../../data-value-readwrite-properties.
| `clear` | `boolean` | _(optional)_ True to have a clickable clear-icon for removing the active value. |
| `autoresize` | `boolean` | _(optional)_ For `multiline`, set true to expand when writing longer texts. |
| `autoComplete` | `on` or `string` | _(optional)_ For HTML `autocomplete` [attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete). |
| `inputMode` | `string` | _(optional)_ Define a [inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode). |
| `autoresizeMaxRows` | `boolean` | _(optional)_ For `multiline`, set how many rows of text can be shown at max. |
| `characterCounter` | `boolean` | _(optional)_ True to show a character counter. |
| `minLength` | `boolean` | _(optional)_ Validation for minimum length of the text (number of characters). |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('type definitions', () => {
const content = fs.readFileSync(file, 'utf-8')
expect(content).toContain('export interface InputProps')
expect(content).toContain(
"extends Omit<React.HTMLProps<HTMLElement>, 'ref'>,"
"extends Omit<React.HTMLProps<HTMLInputElement>, 'ref'>,"
)
expect(content).toContain('SpacingProps')
}
Expand Down
5 changes: 3 additions & 2 deletions packages/dnb-eufemia/src/components/input/Input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type InputSubmitButtonIcon =
| ((...args: any[]) => any);
export type InputChildren = React.ReactNode | ((...args: any[]) => any);
export interface InputProps
extends Omit<React.HTMLProps<HTMLElement>, 'ref'>,
extends Omit<React.HTMLProps<HTMLInputElement>, 'ref'>,
SpacingProps {
/**
* Choose between `text`, `number`, `email`, `password`, `url`, `tel` and `search`.
Expand Down Expand Up @@ -195,7 +195,8 @@ export default class Input extends React.Component<InputProps, any> {
static defaultProps: object;
render(): JSX.Element;
}
export interface SubmitButtonProps extends React.HTMLProps<HTMLElement> {
export interface SubmitButtonProps
extends React.HTMLProps<HTMLInputElement> {
id?: string;
/**
* The content value of the input.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type Props = FieldHelpProps &
clear?: boolean
autoresize?: boolean
autoComplete?: HTMLInputElement['autocomplete']
inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode']
autoresizeMaxRows?: number
characterCounter?: boolean
mask?: InputMaskedProps['mask']
Expand Down Expand Up @@ -89,6 +90,7 @@ function StringComponent(props: Props) {
name,
className,
autoComplete,
inputMode,
innerRef,
inputClassName,
layout,
Expand Down Expand Up @@ -128,6 +130,7 @@ function StringComponent(props: Props) {
id,
name,
autoComplete,
inputMode,
className: cn,
placeholder: placeholder,
suffix: help ? (
Expand Down

0 comments on commit 25d276c

Please sign in to comment.