let
| Yes | number
| 0
| Specify the selected result index |
+| ref | let
| Yes | null | HTMLInputElement
| null
| Obtain a reference to the input HTML element |
+| active | let
| Yes | boolean
| false
| Set to `true` to activate and focus the search bar |
+| value | let
| Yes | string
| ""
| Specify the search input value |
+| results | let
| No | HeaderSearchResult[]
| []
| Render a list of search results |
+
+### Slots
+
+| Slot name | Default | Props | Fallback |
+| :-------- | :------ | :---------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------ |
+| -- | Yes | { result: HeaderSearchResult; index: number }
| {result.text}
{#if result.description}<span>– {result.description}</span>{/if}
|
+
+### Events
+
+| Event name | Type | Detail |
+| :--------- | :--------- | :---------------------------------------------------------------------------------------------- |
+| active | dispatched | any
|
+| inactive | dispatched | any
|
+| clear | dispatched | any
|
+| select | dispatched | { value: string; selectedResultIndex: number; selectedResult: HeaderSearchResult }
|
+| change | forwarded | -- |
+| input | forwarded | -- |
+| focus | forwarded | -- |
+| blur | forwarded | -- |
+| keydown | forwarded | -- |
+
## `HeaderUtilities`
### Props
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index 7a1cdbea..4411396f 100644
--- a/docs/src/COMPONENT_API.json
+++ b/docs/src/COMPONENT_API.json
@@ -1,5 +1,5 @@
{
- "total": 154,
+ "total": 155,
"components": [
{
"moduleName": "SkeletonText",
@@ -10258,6 +10258,93 @@
"typedefs": [],
"rest_props": { "type": "Element", "name": "button" }
},
+ {
+ "moduleName": "HeaderSearch",
+ "filePath": "/src/UIShell/HeaderSearch.svelte",
+ "props": [
+ {
+ "name": "value",
+ "kind": "let",
+ "description": "Specify the search input value",
+ "type": "string",
+ "value": "\"\"",
+ "isFunction": false,
+ "constant": false,
+ "reactive": true
+ },
+ {
+ "name": "active",
+ "kind": "let",
+ "description": "Set to `true` to activate and focus the search bar",
+ "type": "boolean",
+ "value": "false",
+ "isFunction": false,
+ "constant": false,
+ "reactive": true
+ },
+ {
+ "name": "ref",
+ "kind": "let",
+ "description": "Obtain a reference to the input HTML element",
+ "type": "null | HTMLInputElement",
+ "value": "null",
+ "isFunction": false,
+ "constant": false,
+ "reactive": true
+ },
+ {
+ "name": "results",
+ "kind": "let",
+ "description": "Render a list of search results",
+ "type": "HeaderSearchResult[]",
+ "value": "[]",
+ "isFunction": false,
+ "constant": false,
+ "reactive": false
+ },
+ {
+ "name": "selectedResultIndex",
+ "kind": "let",
+ "description": "Specify the selected result index",
+ "type": "number",
+ "value": "0",
+ "isFunction": false,
+ "constant": false,
+ "reactive": true
+ }
+ ],
+ "slots": [
+ {
+ "name": "__default__",
+ "default": true,
+ "fallback": "{result.text}\n {#if result.description}– {result.description}{/if}",
+ "slot_props": "{ result: HeaderSearchResult; index: number }"
+ }
+ ],
+ "events": [
+ { "type": "dispatched", "name": "active", "detail": "any" },
+ { "type": "dispatched", "name": "inactive", "detail": "any" },
+ { "type": "dispatched", "name": "clear", "detail": "any" },
+ {
+ "type": "dispatched",
+ "name": "select",
+ "detail": "{ value: string; selectedResultIndex: number; selectedResult: HeaderSearchResult }"
+ },
+ { "type": "forwarded", "name": "change", "element": "input" },
+ { "type": "forwarded", "name": "input", "element": "input" },
+ { "type": "forwarded", "name": "focus", "element": "input" },
+ { "type": "forwarded", "name": "blur", "element": "input" },
+ { "type": "forwarded", "name": "keydown", "element": "input" }
+ ],
+ "typedefs": [
+ {
+ "type": "{ href: string; text: string; description?: string; }",
+ "name": "HeaderSearchResult",
+ "ts": "interface HeaderSearchResult { href: string; text: string; description?: string; }"
+ }
+ ],
+ "rest_props": { "type": "Element", "name": "input" }
+ },
{
"moduleName": "UnorderedList",
"filePath": "/src/UnorderedList/UnorderedList.svelte",
diff --git a/docs/src/pages/components/UIShell.svx b/docs/src/pages/components/UIShell.svx
index 46eea0ee..33a18b98 100644
--- a/docs/src/pages/components/UIShell.svx
+++ b/docs/src/pages/components/UIShell.svx
@@ -4,7 +4,7 @@
components: ["Header",
"HeaderAction",
"HeaderActionLink",
-"HeaderActionSearch",
+"HeaderSearch",
"HeaderNav",
"HeaderNavItem",
"HeaderNavMenu",
@@ -34,6 +34,10 @@ components: ["Header",
active: {active}
+value: {value}
+selectedResultIndex: {selectedResultIndex}
++ Click the button and search for something. Dispatched events are + logged below: +
+{JSON.stringify(rest, null, 2)}+ {/if} +