mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 02:41:05 +00:00
refactor(components): remove exported "props"
Closes #17 - Forward events - Adds style prop, removes exported props
This commit is contained in:
parent
94a11920bd
commit
1286b9901d
31 changed files with 120 additions and 105 deletions
|
@ -2,14 +2,14 @@
|
|||
let className = undefined;
|
||||
export { className as class };
|
||||
export let small = false;
|
||||
export let props = {};
|
||||
export let style = undefined;
|
||||
|
||||
import { cx } from '../../lib';
|
||||
|
||||
const _class = cx('--skeleton', !small && '--search--xl', small && '--search--sm', className);
|
||||
</script>
|
||||
|
||||
<div {...props} class={_class}>
|
||||
<div on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||
<span class={cx('--label')} />
|
||||
<div class={cx('--search-input')} />
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
export let size = small ? 'sm' : 'xl';
|
||||
export let light = false;
|
||||
export let id = Math.random();
|
||||
export let props = {};
|
||||
export let style = undefined;
|
||||
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import Search16 from 'carbon-icons-svelte/lib/Search16';
|
||||
|
@ -33,27 +33,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
$: hasContent = value !== '';
|
||||
$: _clearClass = cx('--search-close', !hasContent && '--search-close--hidden');
|
||||
$: _clearClass = cx('--search-close', value === '' && '--search-close--hidden');
|
||||
</script>
|
||||
|
||||
<div class={_class}>
|
||||
<div class={_class} {style}>
|
||||
<Search16 class={cx('--search-magnifier')} />
|
||||
<label for={id} class={cx('--label')}>{labelText}</label>
|
||||
<input
|
||||
{...props}
|
||||
bind:this={inputRef}
|
||||
role="searchbox"
|
||||
class={cx('--search-input')}
|
||||
placeholder={placeHolderText}
|
||||
{type}
|
||||
{id}
|
||||
{value}
|
||||
on:change
|
||||
on:input
|
||||
on:input={event => {
|
||||
value = event.target.value;
|
||||
}} />
|
||||
}}
|
||||
{type}
|
||||
{id}
|
||||
{value} />
|
||||
<button
|
||||
type="button"
|
||||
class={_clearClass}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue