mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
parent
211885bad7
commit
2fc884caca
2 changed files with 49 additions and 57 deletions
|
@ -116,7 +116,6 @@
|
|||
import WarningFilled from "../icons/WarningFilled.svelte";
|
||||
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
||||
import ListBox from "../ListBox/ListBox.svelte";
|
||||
import ListBoxField from "../ListBox/ListBoxField.svelte";
|
||||
import ListBoxMenu from "../ListBox/ListBoxMenu.svelte";
|
||||
import ListBoxMenuIcon from "../ListBox/ListBoxMenuIcon.svelte";
|
||||
import ListBoxMenuItem from "../ListBox/ListBoxMenuItem.svelte";
|
||||
|
@ -254,22 +253,12 @@
|
|||
{warn}
|
||||
{warnText}
|
||||
>
|
||||
<ListBoxField
|
||||
role="button"
|
||||
aria-expanded={open}
|
||||
on:click={async () => {
|
||||
if (disabled) return;
|
||||
open = true;
|
||||
await tick();
|
||||
ref.focus();
|
||||
}}
|
||||
{id}
|
||||
{disabled}
|
||||
{translateWithId}
|
||||
>
|
||||
<div class:bx--list-box__field={true}>
|
||||
<input
|
||||
bind:this={ref}
|
||||
bind:value
|
||||
type="text"
|
||||
role="combobox"
|
||||
tabindex="0"
|
||||
autocomplete="off"
|
||||
aria-autocomplete="list"
|
||||
|
@ -287,6 +276,10 @@
|
|||
class:bx--text-input={true}
|
||||
class:bx--text-input--light={light}
|
||||
class:bx--text-input--empty={value === ""}
|
||||
on:click={() => {
|
||||
if (disabled) return;
|
||||
open = true;
|
||||
}}
|
||||
on:input={({ target }) => {
|
||||
if (!open && target.value.length > 0) {
|
||||
open = true;
|
||||
|
@ -384,7 +377,7 @@
|
|||
{translateWithId}
|
||||
{open}
|
||||
/>
|
||||
</ListBoxField>
|
||||
</div>
|
||||
{#if open}
|
||||
<ListBoxMenu aria-label={ariaLabel} {id} on:scroll bind:ref={listRef}>
|
||||
{#each filteredItems as item, i (item.id)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue