mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
53 lines
1.1 KiB
Svelte
53 lines
1.1 KiB
Svelte
<script>
|
|
/**
|
|
* Specify the file name status
|
|
* @type {"uploading" | "edit" | "complete"}
|
|
*/
|
|
export let status = "uploading";
|
|
|
|
/** Specify the ARIA label used for the status icons */
|
|
export let iconDescription = "";
|
|
|
|
/** Set to `true` to indicate an invalid state */
|
|
export let invalid = false;
|
|
|
|
import Close from "../icons/Close.svelte";
|
|
import CheckmarkFilled from "../icons/CheckmarkFilled.svelte";
|
|
import WarningFilled from "../icons/WarningFilled.svelte";
|
|
import Loading from "../Loading/Loading.svelte";
|
|
</script>
|
|
|
|
{#if status === "uploading"}
|
|
<Loading
|
|
description="{iconDescription}"
|
|
{...$$restProps}
|
|
small
|
|
withOverlay="{false}"
|
|
/>
|
|
{/if}
|
|
|
|
{#if status === "edit"}
|
|
{#if invalid}
|
|
<WarningFilled class="bx--file-invalid" />
|
|
{/if}
|
|
<button
|
|
aria-label="{iconDescription}"
|
|
class:bx--file-close="{true}"
|
|
type="button"
|
|
tabindex="0"
|
|
{...$$restProps}
|
|
on:click
|
|
on:keydown
|
|
>
|
|
<Close />
|
|
</button>
|
|
{/if}
|
|
|
|
{#if status === "complete"}
|
|
<CheckmarkFilled
|
|
aria-label="{iconDescription}"
|
|
title="{iconDescription}"
|
|
class="bx--file-complete"
|
|
{...$$restProps}
|
|
/>
|
|
{/if}
|