goobs-frontend
Version:
A comprehensive React-based libary for building modern web applications
61 lines • 2.69 kB
TypeScript
import { default as React, ReactNode } from 'react';
export interface DetailFieldProps {
/** The field label (rendered as the `<dt>` term). */
label: ReactNode;
/** The field value (rendered as the `<dd>` description). */
value: ReactNode;
/** Render the value in a monospace font (IDs, codes, IP/MAC/OID). */
mono?: boolean;
/** Optional accent color for the value text. */
valueColor?: string;
/**
* When true and `value` is null / undefined / empty-string, the whole
* field renders nothing — absorbs the `{x && (<><label/><value/></>)}`
* conditional that wraps optional rows in the reference shell.
*/
hideWhenEmpty?: boolean;
}
/**
* Read-only label/value couplet rendered as a `<dt>`/`<dd>` pair wrapped in a
* `<div>` — valid `<dl>` content, so it slots into `<DetailGrid>` (or any
* definition list) while also working standalone. `hideWhenEmpty` renders
* nothing for null/undefined/empty values, `mono` switches the value to the
* mono stack, and `valueColor` overrides the value color inline.
*/
declare const DetailField: React.ForwardRefExoticComponent<DetailFieldProps & React.RefAttributes<HTMLDivElement>>;
export interface DetailGridFieldDescriptor {
label: ReactNode;
value: ReactNode;
mono?: boolean;
valueColor?: string;
hideWhenEmpty?: boolean;
}
export interface DetailGridProps {
/**
* Declarative field list. When provided, each descriptor renders as a
* `DetailField`. Mutually exclusive in practice with `children` (a
* descriptor list is the common case; children is the escape hatch for
* custom value nodes that don't fit the descriptor shape).
*/
fields?: DetailGridFieldDescriptor[];
/** Min column width forwarded to the underlying FieldGrid. Default `'200px'`. */
minColWidth?: string;
/** Gap forwarded to the underlying FieldGrid. */
gap?: string;
/** Optional accessible label for the definition list group. */
ariaLabel?: string;
className?: string;
/** `DetailField` children, used when `fields` is not supplied. */
children?: ReactNode;
}
/**
* Responsive definition-list grid of `DetailField` couplets: composes
* `FieldGrid` for the column track (min column width via `minColWidth`,
* default 200px) but renders as a `<dl>` so the block is one semantic group
* of term/description pairs. Populate via the `fields` array or by nesting
* `<DetailField>` children.
*/
declare const DetailGrid: React.ForwardRefExoticComponent<DetailGridProps & React.RefAttributes<HTMLDListElement>>;
export { DetailField, DetailGrid };
export default DetailField;
//# sourceMappingURL=index.d.ts.map