1<script lang="ts" module>
 2	import { type VariantProps, tv } from 'tailwind-variants';
 3
 4	export const alertVariants = tv({
 5		base: 'relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',
 6		variants: {
 7			variant: {
 8				default: 'bg-card text-card-foreground',
 9				destructive:
10					'text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current'
11			}
12		},
13		defaultVariants: {
14			variant: 'default'
15		}
16	});
17
18	export type AlertVariant = VariantProps<typeof alertVariants>['variant'];
19</script>
20
21<script lang="ts">
22	import type { HTMLAttributes } from 'svelte/elements';
23	import { cn, type WithElementRef } from '$lib/components/ui/utils.js';
24
25	let {
26		ref = $bindable(null),
27		class: className,
28		variant = 'default',
29		children,
30		...restProps
31	}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
32		variant?: AlertVariant;
33	} = $props();
34</script>
35
36<div
37	bind:this={ref}
38	data-slot="alert"
39	class={cn(alertVariants({ variant }), className)}
40	{...restProps}
41	role="alert"
42>
43	{@render children?.()}
44</div>