import { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
import { cx } from '../../../common/utils/styleUtils';
import style from './PanelUtils.module.scss';
export function Header({ children }: { children: ReactNode }) {
return
{children}
;
}
export function SubHeader({ children }: { children: ReactNode }) {
return {children}
;
}
export function Title({ children }: { children: ReactNode }) {
return {children}
;
}
type AllowedTags = 'div' | 'form';
type SectionProps = {
as?: C;
children: ReactNode;
} & React.JSX.IntrinsicElements[C];
export function Section({ as, className, children, ...props }: SectionProps) {
const Element = as ?? 'div';
return (
)}>
{children}
);
}
export function Indent({ as, className, children, ...props }: SectionProps) {
const Element = as ?? 'div';
return (
)}>
{children}
);
}
export function Paragraph({ children }: { children: ReactNode }) {
return {children}
;
}
export function Card({ children, className, ...props }: { children: ReactNode } & React.JSX.IntrinsicElements['div']) {
return (
{children}
);
}
export function Table({ className, children }: { className?: string; children: ReactNode }) {
return (
);
}
export interface EmptyStateProps {
title: string;
description?: ReactNode;
action?: ReactNode;
}
export function EmptyState({ title, description, action }: EmptyStateProps) {
return (
{title}
{description &&
{description}
}
{action &&
{action}
}
);
}
export function TableEmpty(props: EmptyStateProps) {
return (
|
|
);
}
export function ListGroup({ className, children }: { className?: string; children: ReactNode }) {
return ;
}
export function ListItem({ children, interactive = false }: { children: ReactNode; interactive?: boolean }) {
return {children};
}
export function Field({
title,
description,
error,
descriptionTone = 'default',
}: {
title: ReactNode;
description: ReactNode;
error?: string;
descriptionTone?: 'default' | 'warning';
}) {
return (
{title}
{error &&
{error}}
{!error && description &&
{description}}
);
}
export function Description({ children, tone = 'default' }: { children: ReactNode; tone?: 'default' | 'warning' }) {
return {children}
;
}
export function Highlight({ children }: { children: ReactNode }) {
return {children};
}
export function BlockQuote({ children }: { children: ReactNode }) {
return {children}
;
}
export function Error({ children, className }: PropsWithChildren & React.JSX.IntrinsicElements['div']) {
return {children}
;
}
export function Divider() {
return
;
}
export function Loader({ isLoading }: { isLoading: boolean }) {
if (!isLoading) {
return null;
}
return (
);
}
type AllowedInlineTags = 'div' | 'td';
type InlineProps = {
as?: C;
relation?: 'inner' | 'component' | 'section';
align?: 'start' | 'end' | 'apart';
wrap?: 'wrap' | 'nowrap';
} & Omit;
export function InlineElements({
children,
as,
relation = 'component',
align = 'start',
wrap = 'nowrap',
className,
...elementProps
}: PropsWithChildren>) {
const Element = as ?? 'div';
return (
)}
className={cx([style.inlineElements, style[relation], style[align], style[wrap], className])}
>
{children}
);
}