import "./filter_chip.css"; import type * as React from "react"; import { type ReactNode } from "react"; import { useRender } from "@base-ui/react/use-render"; import { type ColumnFilterValue, type FilterableColumn } from "./column_filter"; import { type StyleProps } from "./style_props"; import type { PopoverSide, PopoverAlign } from "./popover"; interface FilterChipBase extends StyleProps { /** Translated. */ clearLabel?: string; side?: PopoverSide; align?: PopoverAlign; /** For an editor that closes on Save. */ open?: boolean; onOpenChange?: (open: boolean) => void; /** * Cancel / Save for an editor that commits instead of applying live; one with its own bottom * actions gets a second band. */ footer?: ReactNode; /** So a driver reaches this facet rather than another sharing its word. */ testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } interface FilterChipComposedProps extends FilterChipBase { /** Alone when inactive ("Owner"), prefixed when active ("Owner: Maria, James"). */ label: string; /** * After "Label: ": a string (`rangeSummary` / `selectSummary`) or a node (avatars, dots). Empty * renders the inactive pill. */ summary?: ReactNode; /** The rows the summary holds, drawn after it as a `Count`. */ count?: number; /** The × shows whenever a summary is present; it is the only clear. */ onClear?: () => void; /** The summary states the view's own default rather than a narrowing (a status opening on the open work): * the pill keeps its resting ink. */ resting?: boolean; /** * The consumer owns the value. A render function receives `close`; only single-select closes on * action. */ children: ReactNode | ((api: { close: () => void; }) => ReactNode); column?: never; value?: never; onChange?: never; } /** * One register column: its `type` picks the editor and its words label the pill. Turn the value * into conditions with `columnFilterToConditions`. */ interface FilterChipColumnProps extends FilterChipBase { column: FilterableColumn; value: ColumnFilterValue | undefined; onChange: (value: ColumnFilterValue | undefined) => void; label?: never; summary?: never; count?: never; onClear?: never; children?: never; } export type FilterChipProps = FilterChipComposedProps | FilterChipColumnProps; /** "Maria, James" up to `max`, else "N selected"; `undefined` when empty. */ export declare function selectSummary(selected: string[], options: { value: string; label: string; }[], opts?: { max?: number; }): string | undefined; /** * A toolbar filter pill: "Label ⌄" inactive, "Label: summary" with × active; the editor brings its * own actions. With `footer` and controlled `open` it wraps a non-filter value pill. With `column` * it draws a register column, `type` picking the control (`columnFilterToConditions` for the * query). */ export declare function FilterChip(props: FilterChipProps): React.JSX.Element; export {};