@postenbring/hedwig-react
Version:
React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).
65 lines • 2.87 kB
TypeScript
import { forwardRef } from "react";
import { type MessageProps, type MessageTitleProps } from "../../message";
import { type ListProps } from "../../list";
interface ErrorSummaryHeadingPropsAutoFocus {
/**
* The heading will be focused when the component mounts
*
* On following errornous form submissions you should manually focus the heading
* e.g. by passing a ref and calling `ref.current.focus()`
*
* @default true
*/
autoFocus?: boolean;
}
interface ErrorSummaryHeadingPropsAs {
/**
* A heading level must be selected, or optionally opting out for a different element
*
* Use {@link ErrorSummaryHeadingPropsAsChild.asChild} if you need more control of the rendered element.
*/
as: "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "div" | "label" | "p";
asChild?: never;
}
interface ErrorSummaryHeadingPropsAsChild {
/**
* Change the default rendered element for the one passed as a child, merging their props and behavior.
*/
asChild: true;
as?: never;
}
export type ErrorSummaryHeadingProps = MessageTitleProps & ErrorSummaryHeadingPropsAutoFocus & (ErrorSummaryHeadingPropsAs | ErrorSummaryHeadingPropsAsChild);
export declare const ErrorSummaryHeading: import("react").ForwardRefExoticComponent<((MessageTitleProps & ErrorSummaryHeadingPropsAutoFocus & ErrorSummaryHeadingPropsAs) | (MessageTitleProps & ErrorSummaryHeadingPropsAutoFocus & ErrorSummaryHeadingPropsAsChild)) & import("react").RefAttributes<HTMLParagraphElement>>;
export interface ErrorSummaryListProps extends ListProps {
/**
* Sets the size of the items (font)
*
* @default "small"
*/
size?: ListProps["size"];
}
export declare const ErrorSummaryList: import("react").ForwardRefExoticComponent<ErrorSummaryListProps & import("react").RefAttributes<HTMLUListElement>>;
export interface ErrorSummaryItemProps extends React.HTMLAttributes<HTMLLIElement> {
/**
* A hash link to the element that the error message refers to
*
* Must start with "#" as it's passed to the `href` attribute of an anchor element
*
* @example "#email"
*/
href: `#${string}`;
/**
* Extra props to pass to the link element
*/
linkProps?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
}
export declare const ErrorSummaryItem: import("react").ForwardRefExoticComponent<ErrorSummaryItemProps & import("react").RefAttributes<HTMLLIElement>>;
export type ErrorSummaryProps = Omit<MessageProps, "variant" | "icon" | "iconClassName">;
export declare const ErrorSummary: ErrorSummaryType;
type ErrorSummaryType = ReturnType<typeof forwardRef<HTMLDivElement, ErrorSummaryProps>> & {
Heading: typeof ErrorSummaryHeading;
List: typeof ErrorSummaryList;
Item: typeof ErrorSummaryItem;
};
export {};
//# sourceMappingURL=error-summary.d.ts.map