// Copyright 2025 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import { AlertDialog } from 'radix-ui'; import type { FC, MouseEvent, ReactNode } from 'react'; import React, { memo } from 'react'; import { AxoButton } from './AxoButton.dom.js'; import { tw } from './tw.dom.js'; import { AxoBaseDialog } from './_internal/AxoBaseDialog.dom.js'; import { AxoScrollArea } from './AxoScrollArea.dom.js'; import type { AxoSymbol } from './AxoSymbol.dom.js'; const Namespace = 'AxoAlertDialog'; const { useContentEscapeBehavior } = AxoBaseDialog; /** * Displays a menu located at the pointer, triggered by a right click or a long press. * * Note: For menus that are triggered by a normal button press, you should use * `AxoDropdownMenu`. * * @example Anatomy * ```tsx * * * * * * * * * * * * * * * ``` */ export namespace AxoAlertDialog { /** * Component: * -------------------------------- */ export type RootProps = AxoBaseDialog.RootProps; export const Root: FC = memo(props => { return ( {props.children} ); }); Root.displayName = `${Namespace}.Root`; /** * Component: * -------------------------------- */ export type TriggerProps = AxoBaseDialog.TriggerProps; export const Trigger: FC = memo(props => { return {props.children}; }); Trigger.displayName = `${Namespace}.Trigger`; /** * Component: * -------------------------------- */ export type ContentEscape = AxoBaseDialog.ContentEscape; export type ContentProps = Readonly<{ escape: ContentEscape; children: ReactNode; }>; export const Content: FC = memo(props => { const handleContentEscapeEvent = useContentEscapeBehavior(props.escape); return ( {props.children} ); }); Content.displayName = `${Namespace}.Content`; /** * Component: * --------------------------------- */ export type BodyProps = Readonly<{ children: ReactNode; }>; export const Body: FC = memo(props => { return (
{props.children}
); }); Body.displayName = `${Namespace}.Body`; /** * Component: * --------------------------------- */ export type FooterProps = Readonly<{ children: ReactNode; }>; export const Footer: FC = memo(props => { return
{props.children}
; }); Footer.displayName = `${Namespace}.Footer`; /** * Component: * --------------------------------- */ export type TitleProps = Readonly<{ screenReaderOnly?: boolean; children: ReactNode; }>; export const Title: FC = memo(props => { return ( {props.children} ); }); Title.displayName = `${Namespace}.Title`; /** * Component: * --------------------------------------- */ export type DescriptionProps = Readonly<{ children: ReactNode; }>; export const Description: FC = memo(props => { return ( {props.children} ); }); Description.displayName = `${Namespace}.Description`; /** * Component: * ---------------------------------- */ export type CancelProps = Readonly<{ children: ReactNode; }>; export const Cancel: FC = memo(props => { return ( {props.children} ); }); Cancel.displayName = `${Namespace}.Cancel`; /** * Component: * ---------------------------------- */ export type ActionVariant = 'primary' | 'secondary' | 'destructive'; export type ActionProps = Readonly<{ variant: ActionVariant; symbol?: AxoSymbol.InlineGlyphName; arrow?: boolean; onClick: (event: MouseEvent) => void; children: ReactNode; }>; export const Action: FC = memo(props => { return ( {props.children} ); }); Action.displayName = `${Namespace}.Action`; }