import * as react from 'react'; import { ReactNode, HTMLAttributes, FormEventHandler } from 'react'; import * as react_jsx_runtime from 'react/jsx-runtime'; type ToastOptions = Partial>; declare function show(title: ReactNode, options?: Partial>): string; declare function success(title: ReactNode, options?: ToastOptions): string; declare function error(title: ReactNode, options?: ToastOptions): string; declare function warning(title: ReactNode, options?: ToastOptions): string; declare function info(title: ReactNode, options?: ToastOptions): string; declare function loading(title: ReactNode, options?: ToastOptions): string; declare function dismiss(id: string): void; declare function dismissAll(): void; interface ToastConfig { /** * App-level error → message parser used by `toast.fromError`. This is where * domain knowledge (API envelopes, axios shapes, i18n) belongs — the * component library never parses domain errors itself. Must be pure: under * SSR every request shares the same registration. */ formatError?: (error: unknown) => ReactNode; } /** * One-time app-level wiring for `toast.fromError`. Call once at startup: * * ```ts * import { getErrorMessage } from '@arkite/utils' // or your own parser * toast.configure({ formatError: getErrorMessage }) * ``` * * Module-level by design: the imperative `toast` also runs outside React * (event handlers, stores), so configuration cannot live in a provider. */ declare function configure(next: ToastConfig): void; interface ToastFromErrorOptions extends ToastOptions { /** Toast title (e.g. `'儲存失敗'`); the parsed error message becomes the description */ prefix?: ReactNode; } /** * Error-to-toast shorthand for `catch` blocks: * * ```ts * catch (err) { * toast.fromError(err, { prefix: '儲存失敗' }) * } * ``` * * Renders a destructive toast with `prefix` as the title and the parsed error * message as the description. Parsing is app-supplied via * `toast.configure({ formatError })`; unconfigured, only `Error#message` / * plain strings are used. When no message can be derived, the prefix alone is * shown (or `String(error)` if there is no prefix either). * * Deliberately out of scope (app-layer concerns, keep them there): * error reporting/logging hooks (Sentry, console) and burst dedupe. */ declare function fromError(err: unknown, options?: ToastFromErrorOptions): string; declare const toast: { show: typeof show; success: typeof success; error: typeof error; warning: typeof warning; info: typeof info; loading: typeof loading; fromError: typeof fromError; configure: typeof configure; dismiss: typeof dismiss; dismissAll: typeof dismissAll; }; type ToastVariant = 'default' | 'success' | 'warning' | 'info' | 'destructive' /** @deprecated use `'destructive'` instead — removed in v1.0 */ | 'error'; type ToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center'; interface ToastData { id: string; title?: ReactNode; description?: ReactNode; variant?: ToastVariant; duration?: number; action?: { label: string; onClick: () => void; }; /** Show a loading spinner instead of the variant icon. */ isLoading?: boolean; } interface ToastProps extends ToastData { onClose: () => void; className?: string; } /** Individual toast notification with auto-dismiss and variant styling. */ declare function Toast({ id: _id, title, description, variant, duration, action, isLoading, onClose, className, }: ToastProps): react_jsx_runtime.JSX.Element; interface ToastContainerProps { position?: ToastPosition; className?: string; } /** Fixed-position container that renders active toasts from the toast store. */ declare const ToastContainer: react.ForwardRefExoticComponent>; type ShorthandOptions = ToastOptions | ReactNode; declare function useToast(): ((options: Omit) => string) & { show: (title: ReactNode, options?: ShorthandOptions) => string; success: (title: ReactNode, options?: ShorthandOptions) => string; error: (title: ReactNode, options?: ShorthandOptions) => string; warning: (title: ReactNode, options?: ShorthandOptions) => string; info: (title: ReactNode, options?: ShorthandOptions) => string; loading: (title: ReactNode, options?: ToastOptions) => string; fromError: (err: unknown, options?: ToastFromErrorOptions) => string; dismiss: (id: string) => void; dismissAll: () => void; /** @deprecated Use `dismissAll()` instead — removed in v1.0. */ clear: () => void; }; type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'full'; interface ModalProps extends Omit, 'title' | 'onSubmit'> { /** Whether the modal is open */ open: boolean; /** Callback when modal should close */ onClose: () => void; /** Modal title */ title?: ReactNode; /** Modal description */ description?: ReactNode; /** Modal size */ size?: ModalSize; /** Show close button */ showCloseButton?: boolean; /** Close on backdrop click */ closeOnBackdropClick?: boolean; /** Close on escape key */ closeOnEscape?: boolean; /** Footer content */ footer?: ReactNode; /** * Form dialogs: wraps header/body/footer in a `
` and fires on submit, * so a `type="submit"` button in `footer` submits the fields in `children` * without `form=""` attribute plumbing. Call `e.preventDefault()` * yourself (or use a server action) as with any React form. */ onSubmit?: FormEventHandler; } /** Modal dialog overlay with title, description, and action footer. */ declare const Modal: react.ForwardRefExoticComponent>; type ModalHeaderProps = HTMLAttributes; /** Header section for a modal with border separator. */ declare const ModalHeader: react.ForwardRefExoticComponent>; type ModalBodyProps = HTMLAttributes; /** Body content area of a modal. */ declare const ModalBody: react.ForwardRefExoticComponent>; type ModalFooterProps = HTMLAttributes; /** Footer section of a modal, typically used for action buttons. */ declare const ModalFooter: react.ForwardRefExoticComponent>; type DrawerPosition = 'left' | 'right' | 'top' | 'bottom'; type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full'; interface DrawerProps extends Omit, 'title'> { /** Whether the drawer is open */ open: boolean; /** Callback when drawer should close */ onClose: () => void; /** Drawer position */ position?: DrawerPosition; /** Drawer size */ size?: DrawerSize; /** Drawer title */ title?: ReactNode; /** Drawer description */ description?: ReactNode; /** Show close button */ showCloseButton?: boolean; /** Close on backdrop click */ closeOnBackdropClick?: boolean; /** Close on escape key */ closeOnEscape?: boolean; /** Footer content */ footer?: ReactNode; } /** * Sliding panel overlay that opens from any edge of the viewport. * * **In context:** [Detail + Drawer Edit](https://ui.foson.co/storybook/?path=/docs/recipes-detail-drawer-edit--docs) */ declare const Drawer: react.ForwardRefExoticComponent>; type DrawerHeaderProps = HTMLAttributes; /** Header section for a custom Drawer layout. */ declare const DrawerHeader: react.ForwardRefExoticComponent>; type DrawerBodyProps = HTMLAttributes; /** Scrollable body section for a custom Drawer layout. */ declare const DrawerBody: react.ForwardRefExoticComponent>; type DrawerFooterProps = HTMLAttributes; /** Footer section for a custom Drawer layout with right-aligned actions. */ declare const DrawerFooter: react.ForwardRefExoticComponent>; export { toast as A, useToast as B, Drawer as D, type ModalSize as M, type ToastData as T, type ToastContainerProps as a, DrawerBody as b, type DrawerBodyProps as c, DrawerFooter as d, type DrawerFooterProps as e, DrawerHeader as f, type DrawerHeaderProps as g, type DrawerPosition as h, type DrawerProps as i, type DrawerSize as j, Modal as k, ModalBody as l, type ModalBodyProps as m, ModalFooter as n, type ModalFooterProps as o, ModalHeader as p, type ModalHeaderProps as q, type ModalProps as r, Toast as s, type ToastConfig as t, ToastContainer as u, type ToastFromErrorOptions as v, type ToastOptions as w, type ToastPosition as x, type ToastProps as y, type ToastVariant as z };