feat(search): support disabled state

This commit is contained in:
Eric Liu 2020-10-14 16:00:19 -07:00
commit e4766591d5
4 changed files with 20 additions and 0 deletions

View file

@ -3464,6 +3464,7 @@ import { Search } from "carbon-components-svelte";
| size | <code>"sm" &#124; "lg"</code> | -- |
| skeleton | <code>boolean</code> | false |
| light | <code>boolean</code> | false |
| disabled | <code>boolean</code> | false |
| value | <code>string</code> | "" |
| type | <code>string</code> | "text" |
| placeholder | <code>string</code> | "Search..." |

View file

@ -23,6 +23,10 @@
<Search size="sm" />
### Disabled
<Search disabled />
### Skeleton
<Search skeleton />

View file

@ -23,6 +23,12 @@
*/
export let light = false;
/**
* Set to `true` to disable the search input
* @type {boolean} [disabled=false]
*/
export let disabled = false;
/**
* Specify the value of the search input
* @type {string} [value="text"]
@ -96,6 +102,7 @@
<div
class:bx--search="{true}"
class:bx--search--light="{light}"
class:bx--search--disabled="{disabled}"
{...$$restProps}
class="bx--search--{size} {$$restProps.class}"
>
@ -108,6 +115,7 @@
class:bx--search-input="{true}"
autofocus="{autofocus}"
autocomplete="{autocomplete}"
disabled="{disabled}"
id="{id}"
placeholder="{placeholder}"
type="{type}"
@ -121,6 +129,7 @@
<button
type="button"
aria-label="{closeButtonLabelText}"
disabled="{disabled}"
class:bx--search-close="{true}"
class:bx--search-close--hidden="{value === ''}"
on:click

6
types/index.d.ts vendored
View file

@ -3408,6 +3408,12 @@ export class Search extends CarbonSvelteComponent {
*/
light?: boolean;
/**
* Set to `true` to disable the search input
* @default false
*/
disabled?: boolean;
/**
* Specify the value of the search input
* @default ""