UNPKG

@postenbring/hedwig-react

Version:

React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).

57 lines 2.16 kB
import { forwardRef } from "react"; export type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, "children">; export declare const BoxCloseButton: import("react").ForwardRefExoticComponent<BoxCloseButtonProps & import("react").RefAttributes<HTMLButtonElement>>; export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> { children?: React.ReactNode; /** * Posten/Bring-spesific variant of the box. NB: warning variant is deprecated, use data-color="warning" instead. * * @default "light-grey" */ variant?: "light-grey" | "lighter" | "white" /** @deprecated use data-color="warning" instead */ | "warning"; /** * Color variant of the box * */ "data-color"?: "neutral" | "info" | "success" | "warning" | "error"; /** * If `true`, a close button will be shown. * Use when you want to control the close button using the BoxCloseButton component. * * @default false */ closeable?: boolean; /** * Callback fired when the component requests to be closed. * If not set, the component will be closed without any user interaction. * * If set, and the handler returns non-true value, the component will not be closed. * Use this if you want to control the closing of the component, using the `closed` prop * * If set, and the handler returns the true, the component will be closed. * Use this with `window.confirm()` to ask the user to confirm closing the component. */ onClose?: () => boolean | unknown; /** * If `true`, the box will be closed and hidden from view */ closed?: boolean; /** * Props applied to the close button element. */ closeButtonProps?: BoxCloseButtonProps; /** * Change the default rendered element for the one passed as a child, merging their props and behavior. * * @default false */ asChild?: boolean; } export declare const Box: BoxType; type BoxType = ReturnType<typeof forwardRef<HTMLDivElement, BoxProps>> & { CloseButton: typeof BoxCloseButton; }; export {}; //# sourceMappingURL=box.d.ts.map