You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
<script lang="ts">
|
|
/**
|
|
* Eidos `Toast.Close` — composes the canonical `<IconButton>` via soma's
|
|
* `child` snippet (no bespoke close chrome — it inherits Button's chrome,
|
|
* focus ring and disabled). `rounded='full'` keeps the toast's round dismiss
|
|
* shape; `variant` / `color` defer to Button's canonical defaults. The
|
|
* accessible name routes through langs ("Cerrar"). A `child` snippet bypasses
|
|
* IconButton.
|
|
*/
|
|
import { ActiveEidos } from '$uix/eidos';
|
|
import * as Toast from '$soma/components/toast';
|
|
import { IconButton } from '$uix/eidos/components/icon-button';
|
|
import { SvgX } from '$uix/eidos/components/svg';
|
|
import type { ToastCloseProps } from './types';
|
|
|
|
let {
|
|
variant,
|
|
size,
|
|
color,
|
|
'aria-label': ariaLabel,
|
|
child: outerChild,
|
|
children,
|
|
...rest
|
|
}: ToastCloseProps = $props();
|
|
|
|
const eidos = ActiveEidos.require();
|
|
const resolvedSize = $derived(size ?? 'sm');
|
|
const closeLabel = $derived(ariaLabel ?? eidos.langs.ts('#?common.buttons.close|Close'));
|
|
</script>
|
|
|
|
<Toast.Close {...rest}>
|
|
{#snippet child({ props })}
|
|
{#if outerChild}
|
|
{@render outerChild({ props })}
|
|
{:else}
|
|
<IconButton {...props} {variant} size={resolvedSize} {color} rounded="full" aria-label={closeLabel}>
|
|
{#if children}{@render children()}{:else}<SvgX />{/if}
|
|
</IconButton>
|
|
{/if}
|
|
{/snippet}
|
|
</Toast.Close>
|