import type { ReactElement, HTMLAttributes, Ref } from "react"; import type SlInputElement from "@shoelace-style/shoelace/dist/components/input/input.js"; import { SlBlurEvent, SlChangeEvent, SlClearEvent, SlFocusEvent, SlInputEvent, SlInvalidEvent, } from "../events"; export type { SlInputElement }; export type SlInputBlurEvent = SlBlurEvent; export type SlInputChangeEvent = SlChangeEvent; export type SlInputClearEvent = SlClearEvent; export type SlInputFocusEvent = SlFocusEvent; export type SlInputInputEvent = SlInputEvent; export type SlInputInvalidEvent = SlInvalidEvent; export interface SlInputProps extends HTMLAttributes { ref?: Ref; /** * */ title?: string; /** * The type of input. Works the same as a native `` element, but only a subset of types are supported. Defaults * to `text`. */ type?: | "date" | "datetime-local" | "email" | "number" | "password" | "search" | "tel" | "text" | "time" | "url"; /** * The name of the input, submitted as a name/value pair with form data. */ name?: string; /** * The current value of the input, submitted as a name/value pair with form data. */ value?: string; /** * The input's size. */ size?: "small" | "medium" | "large"; /** * Draws a filled input. */ filled?: boolean; /** * Draws a pill-style input with rounded edges. */ pill?: boolean; /** * The input's label. If you need to display HTML, use the `label` slot instead. */ label?: string; /** * The input's help text. If you need to display HTML, use the `help-text` slot instead. */ helpText?: string; /** * Adds a clear button when the input is not empty. */ clearable?: boolean; /** * Disables the input. */ disabled?: boolean; /** * Placeholder text to show as a hint when the input is empty. */ placeholder?: string; /** * Makes the input readonly. */ readonly?: boolean; /** * Adds a button to toggle the password's visibility. Only applies to password types. */ passwordToggle?: boolean; /** * Determines whether or not the password is currently visible. Only applies to password input types. */ passwordVisible?: boolean; /** * Hides the browser's built-in increment/decrement spin buttons for number inputs. */ noSpinButtons?: boolean; /** * By default, form controls are associated with the nearest containing `
` element. This attribute allows you * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in * the same document or shadow root for this to work. */ form?: string; /** * Makes the input a required field. */ required?: boolean; /** * A regular expression pattern to validate input against. */ pattern?: string; /** * The minimum length of input that will be considered valid. */ minlength?: number; /** * The maximum length of input that will be considered valid. */ maxlength?: number; /** * The input's minimum value. Only applies to date and number input types. */ min?: number | string; /** * The input's maximum value. Only applies to date and number input types. */ max?: number | string; /** * Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is * implied, allowing any numeric value. Only applies to date and number input types. */ step?: number | "any"; /** * Controls whether and how text input is automatically capitalized as it is entered by the user. */ autocapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters"; /** * Indicates whether the browser's autocorrect feature is on or off. */ autocorrect?: "off" | "on"; /** * Specifies what permission the browser has to provide assistance in filling out form field values. Refer to * [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for available values. */ autocomplete?: string; /** * Indicates that the input should receive focus on page load. */ autofocus?: boolean; /** * Used to customize the label or icon of the Enter key on virtual keyboards. */ enterkeyhint?: | "enter" | "done" | "go" | "next" | "previous" | "search" | "send"; /** * Enables spell checking on the input. */ spellcheck?: boolean; /** * Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual * keyboard on supportive devices. */ inputmode?: | "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url"; /** * Emitted when the control loses focus. */ onSlBlur?: (event: SlInputBlurEvent) => void; /** * Emitted when the control loses focus. */ onSlBlurCapture?: (event: SlInputBlurEvent) => void; /** * Emitted when an alteration to the control's value is committed by the user. */ onSlChange?: (event: SlInputChangeEvent) => void; /** * Emitted when an alteration to the control's value is committed by the user. */ onSlChangeCapture?: (event: SlInputChangeEvent) => void; /** * Emitted when the clear button is activated. */ onSlClear?: (event: SlInputClearEvent) => void; /** * Emitted when the clear button is activated. */ onSlClearCapture?: (event: SlInputClearEvent) => void; /** * Emitted when the control gains focus. */ onSlFocus?: (event: SlInputFocusEvent) => void; /** * Emitted when the control gains focus. */ onSlFocusCapture?: (event: SlInputFocusEvent) => void; /** * Emitted when the control receives input. */ onSlInput?: (event: SlInputInputEvent) => void; /** * Emitted when the control receives input. */ onSlInputCapture?: (event: SlInputInputEvent) => void; /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ onSlInvalid?: (event: SlInputInvalidEvent) => void; /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ onSlInvalidCapture?: (event: SlInputInvalidEvent) => void; } /** * Inputs collect data from the user. */ export default function SlInput( props: SlInputProps, ): ReactElement;