mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
Adopts Standardize props and events #1621
This commit is contained in:
parent
00338eb6df
commit
d8d16a63d1
5 changed files with 130 additions and 87 deletions
33
types/TextInput/TextInput.svelte.d.ts
vendored
33
types/TextInput/TextInput.svelte.d.ts
vendored
|
@ -1,21 +1,18 @@
|
|||
import type { SvelteComponentTyped } from "svelte";
|
||||
import type { SvelteHTMLElements } from "svelte/elements";
|
||||
|
||||
type RestProps = SvelteHTMLElements["input"];
|
||||
export interface TextInputProps {
|
||||
/**
|
||||
* Set to "char" to enable display the character counter or "word" to display the word count.
|
||||
* @default undefined
|
||||
*/
|
||||
counter?: undefined;
|
||||
|
||||
export interface TextInputProps extends RestProps {
|
||||
/**
|
||||
* Set to `true` to disable the input
|
||||
* @default false
|
||||
*/
|
||||
disabled?: boolean;
|
||||
|
||||
/**
|
||||
* Set to "char" to enable display the character counter or "word" to display the word count.
|
||||
* @default undefined
|
||||
*/
|
||||
counter?: "char" | "word";
|
||||
|
||||
/**
|
||||
* Specify the helper text
|
||||
* @default ""
|
||||
|
@ -129,14 +126,22 @@ export interface TextInputProps extends RestProps {
|
|||
*/
|
||||
warnText?: string;
|
||||
|
||||
[key: `data-${string}`]: any;
|
||||
/**
|
||||
* Set HTML attributes on the `label` element
|
||||
* @default {}
|
||||
*/
|
||||
labelAttributes?: Record<string, string>;
|
||||
|
||||
/**
|
||||
* Set HTML attributes on the `input` element
|
||||
* @default {}
|
||||
*/
|
||||
inputAttributes?: Record<string, string>;
|
||||
}
|
||||
|
||||
export default class TextInput extends SvelteComponentTyped<
|
||||
TextInputProps,
|
||||
{
|
||||
change: CustomEvent<null | number | string>;
|
||||
input: CustomEvent<null | number | string>;
|
||||
click: WindowEventMap["click"];
|
||||
mouseover: WindowEventMap["mouseover"];
|
||||
mouseenter: WindowEventMap["mouseenter"];
|
||||
|
@ -146,6 +151,8 @@ export default class TextInput extends SvelteComponentTyped<
|
|||
focus: WindowEventMap["focus"];
|
||||
blur: WindowEventMap["blur"];
|
||||
paste: DocumentAndElementEventHandlersEventMap["paste"];
|
||||
input: CustomEvent<any>;
|
||||
change: CustomEvent<any>;
|
||||
},
|
||||
{ labelText: {} }
|
||||
{ helperText: {}; labelText: {} }
|
||||
> {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue