mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
Merge branch 'master' of github.com:IBM/carbon-components-svelte
This commit is contained in:
commit
626fd99e55
4 changed files with 18 additions and 6 deletions
|
@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
<!-- ## Unreleased -->
|
<!-- ## Unreleased -->
|
||||||
|
|
||||||
|
## [0.25.1](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.25.1) - 2020-11-28
|
||||||
|
|
||||||
|
**Fixes**
|
||||||
|
|
||||||
|
- set `selectedResultIndex` in HeaderSearch when clicking a result ([PR #430](https://github.com/IBM/carbon-components-svelte/pull/430), [issue #429](https://github.com/IBM/carbon-components-svelte/issues/429))
|
||||||
|
|
||||||
## [0.25.0](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.25.0) - 2020-11-27
|
## [0.25.0](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.25.0) - 2020-11-27
|
||||||
|
|
||||||
**Features**
|
**Features**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Component Index
|
# Component Index
|
||||||
|
|
||||||
> 155 components exported from carbon-components-svelte@0.25.0.
|
> 155 components exported from carbon-components-svelte@0.25.1.
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "carbon-components-svelte",
|
"name": "carbon-components-svelte",
|
||||||
"version": "0.25.0",
|
"version": "0.25.1",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"author": "IBM",
|
"author": "IBM",
|
||||||
"description": "Svelte implementation of the Carbon Design System",
|
"description": "Svelte implementation of the Carbon Design System",
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
/** Specify the selected result index */
|
/** Specify the selected result index */
|
||||||
export let selectedResultIndex = 0;
|
export let selectedResultIndex = 0;
|
||||||
|
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher, tick } from "svelte";
|
||||||
import Close20 from "carbon-icons-svelte/lib/Close20/Close20.svelte";
|
import Close20 from "carbon-icons-svelte/lib/Close20/Close20.svelte";
|
||||||
import Search20 from "carbon-icons-svelte/lib/Search20/Search20.svelte";
|
import Search20 from "carbon-icons-svelte/lib/Search20/Search20.svelte";
|
||||||
|
|
||||||
|
@ -223,12 +223,13 @@
|
||||||
on:focus
|
on:focus
|
||||||
on:blur
|
on:blur
|
||||||
on:keydown
|
on:keydown
|
||||||
on:keydown="{({ key }) => {
|
on:keydown="{(e) => {
|
||||||
switch (key) {
|
switch (e.key) {
|
||||||
case 'Enter':
|
case 'Enter':
|
||||||
selectResult();
|
selectResult();
|
||||||
break;
|
break;
|
||||||
case 'ArrowDown':
|
case 'ArrowDown':
|
||||||
|
e.preventDefault();
|
||||||
if (selectedResultIndex === results.length - 1) {
|
if (selectedResultIndex === results.length - 1) {
|
||||||
selectedResultIndex = 0;
|
selectedResultIndex = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,6 +237,7 @@
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'ArrowUp':
|
case 'ArrowUp':
|
||||||
|
e.preventDefault();
|
||||||
if (selectedResultIndex === 0) {
|
if (selectedResultIndex === 0) {
|
||||||
selectedResultIndex = results.length - 1;
|
selectedResultIndex = results.length - 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -270,7 +272,11 @@
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
href="{result.href}"
|
href="{result.href}"
|
||||||
class:selected="{selectedId === `search-menuitem-${i}`}"
|
class:selected="{selectedId === `search-menuitem-${i}`}"
|
||||||
on:click|preventDefault="{selectResult}"
|
on:click|preventDefault="{async () => {
|
||||||
|
selectedResultIndex = i;
|
||||||
|
await tick();
|
||||||
|
selectResult();
|
||||||
|
}}"
|
||||||
>
|
>
|
||||||
<slot result="{result}" index="{i}">
|
<slot result="{result}" index="{i}">
|
||||||
{result.text}
|
{result.text}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue