import { clsx } from "clsx"; import { FC, PropsWithChildren } from "react"; import { TextTooltip } from "../../components/TextTooltip.js"; export type FormFieldLayoutProps = { label?: string; // TODO - allow ReactNode for inline links and other formatting? description?: string; layout?: "col" | "row" | "reverse-row"; // If set, label won't wrap children and won't be clickable. This is useful for some custom fields where outer label leads to too large clickable area. standaloneLabel?: boolean; tooltip?: string; }; export const FieldLayout: FC> = ({ label, description, standaloneLabel, layout = "col", tooltip, children, }) => { const OuterTag = standaloneLabel ? "div" : "label"; const InnerTag = standaloneLabel ? "label" : "div"; let labelEl: JSX.Element | null = null; if (label) { labelEl = ( {label} ); } if (labelEl && tooltip) { labelEl = ( {labelEl} ); } // TODO - use