mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
parent
4888d09479
commit
7a21a3150e
2 changed files with 12 additions and 9 deletions
|
@ -41,10 +41,6 @@
|
|||
display: flex;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
:global(.loader) {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<Layout>
|
||||
|
@ -53,7 +49,7 @@
|
|||
<Button kind="secondary" {disabled}>Cancel</Button>
|
||||
{#if disabled}
|
||||
<InlineLoading
|
||||
class="loader"
|
||||
style="margin-left: 1rem;"
|
||||
description={loadingDescription}
|
||||
status={success ? 'finished' : 'active'}
|
||||
aria-live={ariaLive} />
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
export let description = undefined;
|
||||
export let iconDescription = undefined;
|
||||
export let successDelay = 1500;
|
||||
export let props = {};
|
||||
export let style = undefined;
|
||||
|
||||
import { createEventDispatcher, onDestroy } from 'svelte';
|
||||
import CheckmarkFilled16 from 'carbon-icons-svelte/lib/CheckmarkFilled16';
|
||||
|
@ -20,19 +20,26 @@
|
|||
|
||||
onDestroy(() => {
|
||||
if (timeoutId !== undefined) {
|
||||
clearTimeout(timeoutId);
|
||||
window.clearTimeout(timeoutId);
|
||||
timeoutId = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
$: if (status === 'finished') {
|
||||
timeoutId = setTimeout(() => {
|
||||
timeoutId = window.setTimeout(() => {
|
||||
dispatch('success');
|
||||
}, successDelay);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div {...props} class={_class} aria-live={$$props['aria-live'] || 'assertive'}>
|
||||
<div
|
||||
on:click
|
||||
on:mouseover
|
||||
on:mouseenter
|
||||
on:mouseleave
|
||||
{style}
|
||||
class={_class}
|
||||
aria-live={$$props['aria-live'] || 'assertive'}>
|
||||
<div class={cx('--inline-loading__animation')}>
|
||||
{#if status === 'error'}
|
||||
<Error20 class={cx('--inline-loading--error')} />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue