import { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
import { IoAdd } from 'react-icons/io5';
import Button from '../../../common/components/buttons/Button';
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 function TableEmpty({ label, handleClick }: { label?: string; handleClick?: () => void }) {
return (
|
{label ?? 'No data yet'}
{handleClick && (
)}
|
);
}
export function ListGroup({ className, children }: { className?: string; children: ReactNode }) {
return ;
}
export function ListItem({ children }: { children: ReactNode }) {
return {children};
}
export function Field({ title, description, error }: { title: string; description: string; error?: string }) {
return (
{title}
{error && {error}}
{!error && description && {description}}
);
}
export function Description({ children }: { children: ReactNode }) {
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}
);
}