diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index e565a00a..a02e420f 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -3011,12 +3011,14 @@ None. | :------------------- | :--------------- | :------- | :---------------------------------------- | ------------------------------------------------ | ------------------------------------------------------- | | ref | let | Yes | null | HTMLInputElement | null | Obtain a reference to the input HTML element | | value | let | Yes | string | "" | Specify the value of the search input | +| expanded | let | Yes | boolean | false | Set to `true to expand the search input | | small | let | No | boolean | false | -- | | size | let | No | "sm" | "lg" | "xl" | "xl" | Specify the size of the search input | | searchClass | let | No | string | "" | Specify the class name passed to the outer div element | | skeleton | let | No | boolean | false | Set to `true` to display the skeleton state | | light | let | No | boolean | false | Set to `true` to enable the light variant | | disabled | let | No | boolean | false | Set to `true` to disable the search input | +| expandable | let | No | boolean | false | Set to `true` to enable the expandable variant | | type | let | No | string | "text" | Specify the `type` attribute of the search input | | placeholder | let | No | string | "Search..." | Specify the `placeholder` attribute of the search input | | autocomplete | let | No | "on" | "off" | "off" | Specify the `autocomplete` attribute | @@ -3031,18 +3033,20 @@ None. ### Events -| Event name | Type | Detail | -| :--------- | :--------- | :----- | -| click | forwarded | -- | -| mouseover | forwarded | -- | -| mouseenter | forwarded | -- | -| mouseleave | forwarded | -- | -| change | forwarded | -- | -| input | forwarded | -- | -| focus | forwarded | -- | -| blur | forwarded | -- | -| keydown | forwarded | -- | -| clear | dispatched | -- | +| Event name | Type | Detail | +| :--------- | :--------- | :--------------- | +| expand | dispatched | any | +| collapse | dispatched | any | +| click | forwarded | -- | +| mouseover | forwarded | -- | +| mouseenter | forwarded | -- | +| mouseleave | forwarded | -- | +| change | forwarded | -- | +| input | forwarded | -- | +| focus | forwarded | -- | +| blur | forwarded | -- | +| keydown | forwarded | -- | +| clear | dispatched | -- | ## `SearchSkeleton` diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index bccb25f4..bd20b4fb 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -7801,6 +7801,26 @@ "constant": false, "reactive": false }, + { + "name": "expandable", + "kind": "let", + "description": "Set to `true` to enable the expandable variant", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": false + }, + { + "name": "expanded", + "kind": "let", + "description": "Set to `true to expand the search input", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": true + }, { "name": "value", "kind": "let", @@ -7894,6 +7914,8 @@ ], "slots": [], "events": [ + { "type": "dispatched", "name": "expand", "detail": "any" }, + { "type": "dispatched", "name": "collapse", "detail": "any" }, { "type": "forwarded", "name": "click", "element": "SearchSkeleton" }, { "type": "forwarded", diff --git a/docs/src/pages/components/Search.svx b/docs/src/pages/components/Search.svx index af600573..af5315c4 100644 --- a/docs/src/pages/components/Search.svx +++ b/docs/src/pages/components/Search.svx @@ -23,6 +23,10 @@ The "clear" event is dispatched when clicking the "X" button in the search input console.log('clear')}/> +### Expandable variant + + + ### Light variant @@ -35,7 +39,7 @@ The "clear" event is dispatched when clicking the "X" button in the search input -### Disabled +### Disabled state diff --git a/src/Search/Search.svelte b/src/Search/Search.svelte index 0f5eca6d..17cc0024 100644 --- a/src/Search/Search.svelte +++ b/src/Search/Search.svelte @@ -1,8 +1,12 @@ {#if skeleton} @@ -101,9 +98,17 @@ class:bx--search--sm="{size === 'sm' || small}" class:bx--search--lg="{size === 'lg'}" class:bx--search--xl="{size === 'xl'}" + class:bx--search--expandable="{expandable}" + class:bx--search--expanded="{expanded}" class="{searchClass}" > -
+