mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
refactor(fileuploader): move reactive assignment
This commit is contained in:
parent
bb18cdf797
commit
d9c951f332
4 changed files with 9 additions and 17 deletions
|
@ -3,9 +3,9 @@
|
|||
export { className as class };
|
||||
export let style = undefined;
|
||||
|
||||
import { cx } from '../../lib';
|
||||
import SkeletonText from '../SkeletonText';
|
||||
import { ButtonSkeleton } from '../Button';
|
||||
import { cx } from '../../lib';
|
||||
</script>
|
||||
|
||||
<div on:click on:mouseover on:mouseenter on:mouseleave class={cx('--form-item', className)} {style}>
|
||||
|
|
|
@ -16,20 +16,12 @@
|
|||
import { cx } from '../../lib';
|
||||
|
||||
let inputRef = undefined;
|
||||
|
||||
$: _class = cx(
|
||||
'--btn',
|
||||
'--btn--sm',
|
||||
kind && `--btn--${kind}`,
|
||||
disabled && '--btn--disabled',
|
||||
className
|
||||
);
|
||||
</script>
|
||||
|
||||
<label
|
||||
tabindex={disabled ? '-1' : tabindex}
|
||||
aria-disabled={disabled}
|
||||
class={_class}
|
||||
class={cx('--btn', '--btn--sm', kind && `--btn--${kind}`, disabled && '--btn--disabled', className)}
|
||||
for={id}
|
||||
on:keydown
|
||||
on:keydown={({ key }) => {
|
||||
|
@ -54,8 +46,8 @@
|
|||
}
|
||||
}}
|
||||
on:click
|
||||
on:click={event => {
|
||||
event.target.value = null;
|
||||
on:click={({ target }) => {
|
||||
target.value = null;
|
||||
}}
|
||||
{id}
|
||||
{disabled}
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
<p class={cx('--file-filename')}>{name}</p>
|
||||
<span class={cx('--file__state-container')}>
|
||||
<Filename
|
||||
{iconDescription}
|
||||
{status}
|
||||
{invalid}
|
||||
on:keydown={({ key }) => {
|
||||
if (key === ' ' || key === 'Enter') {
|
||||
dispatch('delete', id);
|
||||
|
@ -36,7 +33,10 @@
|
|||
}}
|
||||
on:click={() => {
|
||||
dispatch('delete', id);
|
||||
}} />
|
||||
}}
|
||||
{iconDescription}
|
||||
{status}
|
||||
{invalid} />
|
||||
</span>
|
||||
{#if invalid && errorSubject}
|
||||
<div class={cx('--form-requirement')}>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</script>
|
||||
|
||||
{#if status === 'uploading'}
|
||||
<Loading description={iconDescription} withOverlay={false} small class={className} {style} />
|
||||
<Loading small description={iconDescription} withOverlay={false} class={className} {style} />
|
||||
{/if}
|
||||
|
||||
{#if status === 'edit'}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue