import { type ComponentPropsWithoutRef, type ReactNode } from 'react'; import type { ColorTone } from '../../../../constant/color'; import type { SlotIconComponent } from '../../../types/side-slot'; import type { ButtonTheme } from '../../action/button'; import { type CalloutNotificationProps, type CalloutNotificationWidth } from './CalloutNotification'; type NotificationType = 'floating' | 'full-width' | 'message' | 'callout'; type NotificationColor = Extract; type NotificationSize = 'desktop' | 'mobile'; /** 텍스트 링크(`supportTextLink`)를 여는 대상. `'_blank'`이면 새 탭 + `rel="noopener noreferrer"`. */ type NotificationLinkTarget = '_self' | '_blank'; interface NotificationAction { /** * 액션 버튼 텍스트 */ label: string; /** * 액션 버튼 클릭 이벤트 핸들러 */ onClick?: () => void; /** * 액션 버튼 색상. `ButtonTheme` 중 알림에서 허용하는 4가지만 지원한다. * @default 'text' */ hierarchy?: Extract; } interface NotificationProps extends Omit, 'title'> { /** * 알림 유형 (floating: 측면에 표시되는 알림, full-width: 전체 너비 알림) * @default 'floating' */ type?: NotificationType; /** * 알림 제목 텍스트 (callout 유형에서는 안내 텍스트로 사용) */ title?: ReactNode; /** * 알림 본문 텍스트 (선택사항) */ supportingText?: ReactNode; /** * 알림 아이콘 컴포넌트 (지정하지 않으면 color에 따라 기본 아이콘 사용) */ icon?: SlotIconComponent; /** * 알림 색상 스타일 * @default 'neutral' */ color?: NotificationColor; /** * 닫기 버튼 클릭 이벤트 핸들러 */ onClose?: () => void; /** * 닫기 버튼 숨김 여부 * `true`이면 floating 타입은 autoClose 미지정 시 3초 후 자동으로 닫힘 (onClose 호출, 끄려면 `autoClose={0}`) * @default false */ hideCloseButton?: boolean; /** * 추가 CSS 클래스 */ className?: string; /** * 액션 버튼 영역 (선택사항) * NotificationAction[] */ actions?: NotificationAction[]; /** * 자동 닫기 시간 (밀리초 단위, 0이면 자동으로 닫히지 않음) * floating, full-width, message 타입에서 동작 (floating + hideCloseButton은 미지정 시 3초) * @default 0 */ autoClose?: number; /** * 다시보지 않기 이벤트 핸들러 (선택사항) * message, full-width 타입에서 사용 가능 */ onHidePermanently?: () => void; /** * 다시보지 않기 버튼의 라벨 (선택사항) * message, full-width 타입에서 사용 가능하며 `onHidePermanently`를 지정했을 때만 렌더된다. * * 기본값은 타입별로 다르다 — message는 `'다시 보지 않기'`, full-width는 `'다시보지 않기'`. * 표기가 통일되어 있지 않은 것은 현행 유지이며, 통일은 별도 결정 사항이다. */ hidePermanentlyLabel?: ReactNode; /** * supportingText 에 연결할 링크 URL (선택사항) * full-width 타입에서만 사용 가능. http/https(상대경로 포함) URL만 링크로 렌더하고 그 외는 텍스트로 렌더한다. */ supportTextLink?: string; /** * 텍스트 링크를 여는 대상 (선택사항). `'_blank'`이면 새 탭 + `rel="noopener noreferrer"` * full-width 타입에서만 사용 가능 * @default '_self' */ supportTextLinkTarget?: NotificationLinkTarget; /** * 너비 동작 (선택사항) * callout 타입에서만 사용 가능. 미지정 시 부모 너비를 채운다(100%). 'fit' 은 콘텐츠 너비에 맞춘다 */ width?: CalloutNotificationWidth; /** * Portal 마운트 여부. `floating` 타입에서만 동작한다. * * 기본값 `false`에서는 부모 JSX 트리 안에 카드로 그대로 렌더된다. * `true`로 설정하면 자동으로 document.body의 `.ncua-floating-notification-host` * 호스트에 createPortal로 마운트되어 우측 상단에 노출되고 LIFO로 스택된다 * — 최신 토스트가 상단에 노출되고 이전 토스트들이 아래로 12px씩 겹쳐 쌓인다 * (vanilla `Notification.show()`와 동일, `--ncua-floating-notification-stack-overlap` * 변수로 조정 가능). * * @default false */ portal?: boolean; } declare const Notification: import("react").ForwardRefExoticComponent>; export type { NotificationType, NotificationColor, NotificationSize, NotificationLinkTarget, NotificationAction, NotificationProps, }; export type { CalloutNotificationProps, CalloutNotificationWidth }; export { Notification };