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.
svelte-kit-vice/src/uix/terra/dialog/components/dialog-description.svelte

59 lines
1.4 KiB

<script lang="ts">
/**
* # Dialog Description
*
* Descripción opcional del diálogo que provee contexto adicional.
*
* ## Uso
* ```svelte
* <DialogContent>
* <DialogTitle>Confirmar acción</DialogTitle>
* <DialogDescription>
* Esta acción no se puede deshacer. ¿Estás seguro?
* </DialogDescription>
* <!-- acciones -->
* </DialogContent>
* ```
*
* ## Propiedades
* - `id`: string - ID del elemento
*
* ## Selectores CSS
* ```
* [data-terra-dialog-description] → Descripción del diálogo
* ```
*
* ## Estilos
* Renderiza un elemento `<div>` asociado al diálogo.
*/
import { readableActive, writableActive, mergeProps } from '$terra/utils';
import { DialogDescriptionState } from '../dialog.svelte';
import type { DialogDescriptionProps } from '../types';
import { createId } from '$terra/utils';
const uid = $props.id();
let {
id = createId(uid),
children,
child,
ref = $bindable(null),
...restProps
}: DialogDescriptionProps = $props();
const descriptionState = DialogDescriptionState.create({
id: readableActive(() => id),
ref: writableActive(() => ref, (v) => (ref = v)),
});
const mergedProps = $derived(mergeProps(restProps, descriptionState.props));
</script>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<div {...mergedProps} bind:this={ref}>
{@render children?.()}
</div>
{/if}

Powered by TurnKey Linux.