/** * Copyright 2025 LY Corporation * * LY Corporation licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ import * as React from 'react'; import * as DialogPrimitive from '@radix-ui/react-dialog'; import { Slot } from '@radix-ui/react-slot'; import type { VariantProps } from 'class-variance-authority'; import { cva } from 'class-variance-authority'; import { ALERT_DEFAULT_ICON } from '../constants'; import { cn } from '../lib/utils'; import type { Radius } from '../types'; import { Button } from './button'; import { Icon } from './icon'; import { ScrollArea, ScrollBar } from './scroll-area'; import useTheme from './use-theme'; const Dialog = DialogPrimitive.Root; const DialogTrigger = React.forwardRef< React.ElementRef, DialogPrimitive.DialogTriggerProps & React.ComponentPropsWithoutRef >(({ variant = 'outline', children, ...props }, ref) => { if (props.asChild) { return ( {children} ); } return ( ); }); DialogTrigger.displayName = DialogPrimitive.DialogTrigger.displayName; const DialogPortal = DialogPrimitive.Portal; const DialogClose = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ variant, ...props }, ref) => ( ); }); DialogContent.displayName = DialogPrimitive.Content.displayName; const dialogIconVariants = cva('dialog-icon', { variants: { variant: { default: 'dialog-icon-default', warning: 'dialog-icon-warning', success: 'dialog-icon-success', error: 'dialog-icon-error', informative: 'dialog-icon-informative', }, }, defaultVariants: { variant: 'default', }, }); const DialogIcon = ( props: React.ComponentPropsWithoutRef & VariantProps, ) => { const { className, name, size = 32, variant, ...rest } = props; return ( ); }; DialogIcon.displayName = 'DialogIcon'; const DialogHeader = ({ className, ...props }: React.HTMLAttributes) => (
); DialogHeader.displayName = 'DialogHeader'; const dialogFooterVariants = cva('dialog-footer', { variants: { align: { left: 'dialog-footer-left', right: 'dialog-footer-right', center: 'dialog-footer-center', between: 'dialog-footer-between', full: 'dialog-footer-full', }, defaultVariants: { align: 'right', }, }, }); interface DialogBodyProps extends React.HTMLAttributes { asChild?: boolean; } const DialogBody = ({ asChild, className, ...props }: DialogBodyProps) => { const Comp = asChild ? Slot : 'div'; return ( ); }; DialogBody.displayName = 'DialogBody'; interface DialogFooterProps extends React.HTMLAttributes { align?: 'left' | 'right' | 'center' | 'between' | 'full'; } const DialogFooter = ({ align = 'right', className, ...props }: DialogFooterProps) => (
); DialogFooter.displayName = 'DialogFooter'; const DialogTitle = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DialogTitle.displayName = DialogPrimitive.Title.displayName; const DialogDescription = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogBody, DialogFooter, DialogTitle, DialogDescription, DialogIcon, };