mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
chore: lift components folder
This commit is contained in:
parent
76df51674d
commit
2200b29b92
301 changed files with 57 additions and 76 deletions
33
src/ListBox/ListBox.svelte
Normal file
33
src/ListBox/ListBox.svelte
Normal file
|
@ -0,0 +1,33 @@
|
|||
<script>
|
||||
export let size = undefined; // "sm" | "xl"
|
||||
export let type = "default"; // "default" | "inline"
|
||||
export let disabled = false;
|
||||
export let invalid = false;
|
||||
export let invalidText = "";
|
||||
export let light = false;
|
||||
export let open = false;
|
||||
</script>
|
||||
|
||||
<div
|
||||
role="listbox"
|
||||
tabindex="-1"
|
||||
data-invalid={invalid || undefined}
|
||||
class:bx--list-box={true}
|
||||
class:bx--list-box--inline={type === 'inline'}
|
||||
class:bx--list-box--disabled={disabled}
|
||||
class:bx--list-box--expanded={open}
|
||||
class:bx--list-box--light={light}
|
||||
class={size && `bx--list-box--${size}`}
|
||||
{...$$restProps}
|
||||
on:keydown
|
||||
on:keydown={e => {
|
||||
if (e.key === 'Escape') {
|
||||
e.stopPropagation();
|
||||
}
|
||||
}}
|
||||
on:click|preventDefault|stopPropagation>
|
||||
<slot />
|
||||
</div>
|
||||
{#if invalid}
|
||||
<div class:bx--form-requirement={true}>{invalidText}</div>
|
||||
{/if}
|
Loading…
Add table
Add a link
Reference in a new issue