UNPKG

@mitcsutt/kiln-forms

Version:

Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui

18 lines (17 loc) • 998 B
import type { ReactElement, ReactNode } from 'react'; import type { OptionMapping, UiOption } from '../../../hooks/useOptionMapping.js'; import type { Primitive } from '../../../kit/contracts.js'; /** * Ui options with each option's swatch as its leading glyph (`icon`), for a control that has no * swatch of its own per option but has that slot (ChipGroup, SegmentedControl). The slot sets * its glyph about 1.2× the label, so the swatch goes a size down to match a `ToggleChip`'s. * Options without a swatch are passed through as they are. */ export declare function withSwatchIcons<V extends Primitive>(mapping: OptionMapping<V>): (UiOption & { icon?: ReactNode; })[]; /** * A many-of field's chosen options in view mode: one tag each, with the option's swatch, or * `undefined` when none are chosen (so `FieldView` shows `messages.notProvided`). */ export declare function optionTags<V extends Primitive>(values: readonly V[], mapping: OptionMapping<V>): ReactElement | undefined;