mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
breaking(text-input): use native bind:value
, dispatch instead of forward change
, input
events (#1065)
Use the native `bind:value` to fix two-way reactivity. As a result, "type" is read through `$$restProps` because it cannot be dynamic when using `bind:value`. Extend value type to include `null` for the "number" type. This is similar to how `NumberInput` works; `null` represents "no value."
This commit is contained in:
parent
30a5f2c201
commit
989e0f4c65
5 changed files with 92 additions and 72 deletions
17
types/TextInput/TextInput.svelte.d.ts
vendored
17
types/TextInput/TextInput.svelte.d.ts
vendored
|
@ -10,16 +10,13 @@ export interface TextInputProps
|
|||
size?: "sm" | "xl";
|
||||
|
||||
/**
|
||||
* Specify the input value
|
||||
* Specify the input value.
|
||||
*
|
||||
* `value` will be set to `null` if type="number"
|
||||
* and the value is empty.
|
||||
* @default ""
|
||||
*/
|
||||
value?: number | string;
|
||||
|
||||
/**
|
||||
* Specify the input type
|
||||
* @default ""
|
||||
*/
|
||||
type?: string;
|
||||
value?: null | number | string;
|
||||
|
||||
/**
|
||||
* Specify the placeholder text
|
||||
|
@ -121,12 +118,12 @@ export interface TextInputProps
|
|||
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"];
|
||||
mouseleave: WindowEventMap["mouseleave"];
|
||||
change: WindowEventMap["change"];
|
||||
input: WindowEventMap["input"];
|
||||
keydown: WindowEventMap["keydown"];
|
||||
keyup: WindowEventMap["keyup"];
|
||||
focus: WindowEventMap["focus"];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue