mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-23 16:13:04 +00:00
111 lines
3.5 KiB
TypeScript
111 lines
3.5 KiB
TypeScript
'use client'
|
|
|
|
import { AlertDialog as AlertDialogPrimitive } from 'radix-ui'
|
|
import * as React from 'react'
|
|
|
|
import { Button } from '@/components/ui/button'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
export const AlertDialog = (props: React.ComponentProps<typeof AlertDialogPrimitive.Root>) => (
|
|
<AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
|
|
)
|
|
|
|
export const AlertDialogTrigger = (
|
|
props: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>,
|
|
) => <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
|
|
const AlertDialogPortal = (props: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) => (
|
|
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
|
)
|
|
|
|
const AlertDialogOverlay = ({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) => (
|
|
<AlertDialogPrimitive.Overlay
|
|
data-slot="alert-dialog-overlay"
|
|
className={cn(
|
|
'fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
|
|
export const AlertDialogContent = ({
|
|
className,
|
|
size = 'default',
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
|
|
size?: 'default' | 'sm'
|
|
}) => (
|
|
<AlertDialogPortal>
|
|
<AlertDialogOverlay />
|
|
<AlertDialogPrimitive.Content
|
|
data-slot="alert-dialog-content"
|
|
data-size={size}
|
|
className={cn(
|
|
'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
</AlertDialogPortal>
|
|
)
|
|
|
|
export const AlertDialogHeader = ({ className, ...props }: React.ComponentProps<'div'>) => (
|
|
<div
|
|
data-slot="alert-dialog-header"
|
|
className={cn('grid gap-1.5 text-center sm:text-left', className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
|
|
export const AlertDialogFooter = ({ className, ...props }: React.ComponentProps<'div'>) => (
|
|
<div
|
|
data-slot="alert-dialog-footer"
|
|
className={cn(
|
|
'-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end',
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
|
|
export const AlertDialogTitle = ({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) => (
|
|
<AlertDialogPrimitive.Title
|
|
data-slot="alert-dialog-title"
|
|
className={cn('text-base font-medium', className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
|
|
export const AlertDialogDescription = ({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) => (
|
|
<AlertDialogPrimitive.Description
|
|
data-slot="alert-dialog-description"
|
|
className={cn('text-sm text-balance text-muted-foreground md:text-pretty', className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
|
|
export const AlertDialogCancel = ({
|
|
className,
|
|
variant = 'outline',
|
|
size = 'default',
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
|
|
Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) => (
|
|
<Button variant={variant} size={size} asChild>
|
|
<AlertDialogPrimitive.Cancel
|
|
data-slot="alert-dialog-cancel"
|
|
className={cn(className)}
|
|
{...props}
|
|
/>
|
|
</Button>
|
|
)
|