@stratakit/bricks
Version:
Small, modular components for StrataKit
35 lines (34 loc) • 1.42 kB
TypeScript
import * as React from "react";
import { useCollectionStore } from "@ariakit/react/collection";
import type { CollectionProps } from "@ariakit/react/collection";
/**
* Ariakit’s unexported `CollectionStoreItem` type inferred.
* @private
*/
export type CollectionStoreItem = NonNullable<ReturnType<ReturnType<typeof useCollectionStore>["item"]>>;
/**
* An extension of `CollectionStoreItem` to track element and control types.
* @private
*/
export interface FieldCollectionStoreItem extends CollectionStoreItem {
/** The type of field element being tracked */
elementType: "label" | "control" | "description" | "error";
/** If a control, the type of control. */
controlType?: "textlike" | "checkable";
}
/**
* A collection that tracks labels, controls, and descriptions which provides
* information about IDs, placement of labels, and control types.
* @private
*/
export declare function FieldCollection(props: Pick<CollectionProps, "render">): import("react/jsx-runtime").JSX.Element;
/**
* Control type context for the field.
* @private
*/
export declare const FieldControlTypeContext: React.Context<React.Dispatch<React.SetStateAction<"textlike" | "checkable" | undefined>> | undefined>;
/**
* Sets the control type for the field. Necessary for layout.
* @private
*/
export declare function useFieldControlType(controlType: NonNullable<FieldCollectionStoreItem["controlType"]>): void;