mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
Merge pull request #330 from IBM/search-disabled
feat(search): support disabled state
This commit is contained in:
commit
856086dc71
4 changed files with 20 additions and 0 deletions
|
@ -3464,6 +3464,7 @@ import { Search } from "carbon-components-svelte";
|
||||||
| size | <code>"sm" | "lg"</code> | -- |
|
| size | <code>"sm" | "lg"</code> | -- |
|
||||||
| skeleton | <code>boolean</code> | false |
|
| skeleton | <code>boolean</code> | false |
|
||||||
| light | <code>boolean</code> | false |
|
| light | <code>boolean</code> | false |
|
||||||
|
| disabled | <code>boolean</code> | false |
|
||||||
| value | <code>string</code> | "" |
|
| value | <code>string</code> | "" |
|
||||||
| type | <code>string</code> | "text" |
|
| type | <code>string</code> | "text" |
|
||||||
| placeholder | <code>string</code> | "Search..." |
|
| placeholder | <code>string</code> | "Search..." |
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
|
|
||||||
<Search size="sm" />
|
<Search size="sm" />
|
||||||
|
|
||||||
|
### Disabled
|
||||||
|
|
||||||
|
<Search disabled />
|
||||||
|
|
||||||
### Skeleton
|
### Skeleton
|
||||||
|
|
||||||
<Search skeleton />
|
<Search skeleton />
|
|
@ -23,6 +23,12 @@
|
||||||
*/
|
*/
|
||||||
export let light = false;
|
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
|
* Specify the value of the search input
|
||||||
* @type {string} [value="text"]
|
* @type {string} [value="text"]
|
||||||
|
@ -96,6 +102,7 @@
|
||||||
<div
|
<div
|
||||||
class:bx--search="{true}"
|
class:bx--search="{true}"
|
||||||
class:bx--search--light="{light}"
|
class:bx--search--light="{light}"
|
||||||
|
class:bx--search--disabled="{disabled}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
class="bx--search--{size} {$$restProps.class}"
|
class="bx--search--{size} {$$restProps.class}"
|
||||||
>
|
>
|
||||||
|
@ -108,6 +115,7 @@
|
||||||
class:bx--search-input="{true}"
|
class:bx--search-input="{true}"
|
||||||
autofocus="{autofocus}"
|
autofocus="{autofocus}"
|
||||||
autocomplete="{autocomplete}"
|
autocomplete="{autocomplete}"
|
||||||
|
disabled="{disabled}"
|
||||||
id="{id}"
|
id="{id}"
|
||||||
placeholder="{placeholder}"
|
placeholder="{placeholder}"
|
||||||
type="{type}"
|
type="{type}"
|
||||||
|
@ -121,6 +129,7 @@
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
aria-label="{closeButtonLabelText}"
|
aria-label="{closeButtonLabelText}"
|
||||||
|
disabled="{disabled}"
|
||||||
class:bx--search-close="{true}"
|
class:bx--search-close="{true}"
|
||||||
class:bx--search-close--hidden="{value === ''}"
|
class:bx--search-close--hidden="{value === ''}"
|
||||||
on:click
|
on:click
|
||||||
|
|
6
types/index.d.ts
vendored
6
types/index.d.ts
vendored
|
@ -3408,6 +3408,12 @@ export class Search extends CarbonSvelteComponent {
|
||||||
*/
|
*/
|
||||||
light?: boolean;
|
light?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to `true` to disable the search input
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
disabled?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the value of the search input
|
* Specify the value of the search input
|
||||||
* @default ""
|
* @default ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue