import * as React from 'react'; import { TextLink } from '../text-link'; import type { ButtonProps } from '../button'; /** * Represents the type of a banner. * 'neutral' accepts a custom icon, the rest do not. * @default 'neutral' */ export type BannerType = 'neutral' | SystemBannerType; /** * Predefined system types for banners. * Each type has its own preset icon. */ export type SystemBannerType = 'info' | 'upgrade' | 'experiment' | 'warning' | 'error' | 'success'; type BaseAction = { variant: 'primary' | 'tertiary'; label: string; } & Pick; type ActionButton = BaseAction & { type: 'button'; } & Omit, 'className'>; type ActionLink = BaseAction & { type: 'link'; } & Omit, 'className'>; /** * Represents an action that can be taken from the banner. * Can be either a button or a link, sharing common properties from BaseAction. */ type Action = ActionButton | ActionLink; /** * Configuration for inline links within the banner description. * Extends TextLink component props with a required label. */ type InlineLink = { label: string; } & React.ComponentProps; type WithCloseButton = { closeLabel?: string; onClose: () => void; }; type WithoutCloseButton = { closeLabel?: never; onClose?: never; }; /** * Controls the close button behavior. * If none is provided, the banner will not have a close button. */ type CloseButton = WithCloseButton | WithoutCloseButton; type BaseBanner = { id?: string; title?: React.ReactNode; description: Exclude; children?: React.ReactNode; action?: Action | React.ReactNode; inlineLinks?: InlineLink[]; } & CloseButton; /** * Configuration for neutral banners. * Can include either an image, an icon, or neither, but never both. */ type NeutralBanner = BaseBanner & { type: Extract; } & ({ image: React.ReactElement; icon?: never; } | { icon: React.ReactElement; image?: never; } | { image?: never; icon?: never; }); /** * Configuration for system banners. * Cannot include custom images or icons as they use preset ones. */ type SystemBanner = BaseBanner & { type: SystemBannerType; image?: never; icon?: never; }; type BannerProps = NeutralBanner | SystemBanner; declare const Banner: React.ForwardRefExoticComponent>; declare function ActionButton({ type, label, ...props }: ActionButton): React.JSX.Element; declare function ActionLink({ type, label, variant, ...props }: ActionLink): React.JSX.Element; export { Banner }; export type { BannerProps };