diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 8272c01d..f708aa4c 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -4167,27 +4167,26 @@ None. ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :---------- | :--------------- | :------- | :---------------------------------------- | ------------------------------------------------ | --------------------------------------------- | -| ref | let | Yes | null | HTMLInputElement | null | Obtain a reference to the input HTML element | -| value | let | Yes | number | string | "" | Specify the input value | -| size | let | No | "sm" | "xl" | undefined | Set the size of the input | -| type | let | No | string | "" | Specify the input type | -| placeholder | let | No | string | "" | Specify the placeholder text | -| light | let | No | boolean | false | Set to `true` to enable the light variant | -| disabled | let | No | boolean | false | Set to `true` to disable the input | -| helperText | let | No | string | "" | Specify the helper text | -| id | let | No | string | "ccs-" + Math.random().toString(36) | Set an id for the input element | -| name | let | No | string | undefined | Specify a name attribute for the input | -| labelText | let | No | string | "" | Specify the label text | -| hideLabel | let | No | boolean | false | Set to `true` to visually hide the label text | -| invalid | let | No | boolean | false | Set to `true` to indicate an invalid state | -| invalidText | let | No | string | "" | Specify the invalid state text | -| warn | let | No | boolean | false | Set to `true` to indicate an warning state | -| warnText | let | No | string | "" | Specify the warning state text | -| required | let | No | boolean | false | Set to `true` to mark the field as required | -| inline | let | No | boolean | false | Set to `true` to use the inline variant | -| readonly | let | No | boolean | false | Set to `true` to use the read-only variant | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :---------- | :--------------- | :------- | :-------------------------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | +| ref | let | Yes | null | HTMLInputElement | null | Obtain a reference to the input HTML element | +| value | let | Yes | null | number | string | "" | Specify the input value.

`value` will be set to `null` if type="number"
and the value is empty. | +| size | let | No | "sm" | "xl" | undefined | Set the size of the input | +| placeholder | let | No | string | "" | Specify the placeholder text | +| light | let | No | boolean | false | Set to `true` to enable the light variant | +| disabled | let | No | boolean | false | Set to `true` to disable the input | +| helperText | let | No | string | "" | Specify the helper text | +| id | let | No | string | "ccs-" + Math.random().toString(36) | Set an id for the input element | +| name | let | No | string | undefined | Specify a name attribute for the input | +| labelText | let | No | string | "" | Specify the label text | +| hideLabel | let | No | boolean | false | Set to `true` to visually hide the label text | +| invalid | let | No | boolean | false | Set to `true` to indicate an invalid state | +| invalidText | let | No | string | "" | Specify the invalid state text | +| warn | let | No | boolean | false | Set to `true` to indicate an warning state | +| warnText | let | No | string | "" | Specify the warning state text | +| required | let | No | boolean | false | Set to `true` to mark the field as required | +| inline | let | No | boolean | false | Set to `true` to use the inline variant | +| readonly | let | No | boolean | false | Set to `true` to use the read-only variant | ### Slots @@ -4197,18 +4196,18 @@ None. ### Events -| Event name | Type | Detail | -| :--------- | :-------- | :----- | -| click | forwarded | -- | -| mouseover | forwarded | -- | -| mouseenter | forwarded | -- | -| mouseleave | forwarded | -- | -| change | forwarded | -- | -| input | forwarded | -- | -| keydown | forwarded | -- | -| keyup | forwarded | -- | -| focus | forwarded | -- | -| blur | forwarded | -- | +| Event name | Type | Detail | +| :--------- | :--------- | :-------------------------------------------- | +| change | dispatched | null | number | string | +| input | dispatched | null | number | string | +| click | forwarded | -- | +| mouseover | forwarded | -- | +| mouseenter | forwarded | -- | +| mouseleave | forwarded | -- | +| keydown | forwarded | -- | +| keyup | forwarded | -- | +| focus | forwarded | -- | +| blur | forwarded | -- | ## `TextInputSkeleton` diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 8983f063..b816f45f 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -11571,25 +11571,14 @@ { "name": "value", "kind": "let", - "description": "Specify the input value", - "type": "number | string", + "description": "Specify the input value.\n\n`value` will be set to `null` if type=\"number\"\nand the value is empty.", + "type": "null | number | string", "value": "\"\"", "isFunction": false, "isFunctionDeclaration": false, "constant": false, "reactive": true }, - { - "name": "type", - "kind": "let", - "description": "Specify the input type", - "type": "string", - "value": "\"\"", - "isFunction": false, - "isFunctionDeclaration": false, - "constant": false, - "reactive": false - }, { "name": "placeholder", "kind": "let", @@ -11775,12 +11764,20 @@ } ], "events": [ + { + "type": "dispatched", + "name": "change", + "detail": "null | number | string" + }, + { + "type": "dispatched", + "name": "input", + "detail": "null | number | string" + }, { "type": "forwarded", "name": "click", "element": "div" }, { "type": "forwarded", "name": "mouseover", "element": "div" }, { "type": "forwarded", "name": "mouseenter", "element": "div" }, { "type": "forwarded", "name": "mouseleave", "element": "div" }, - { "type": "forwarded", "name": "change", "element": "input" }, - { "type": "forwarded", "name": "input", "element": "input" }, { "type": "forwarded", "name": "keydown", "element": "input" }, { "type": "forwarded", "name": "keyup", "element": "input" }, { "type": "forwarded", "name": "focus", "element": "input" }, diff --git a/src/TextInput/TextInput.svelte b/src/TextInput/TextInput.svelte index b353b6b4..d3a95249 100644 --- a/src/TextInput/TextInput.svelte +++ b/src/TextInput/TextInput.svelte @@ -1,4 +1,9 @@ - + ; + input: CustomEvent; 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"];