compote-ui
Version:
An opinionated UI component library for Svelte, built on top of [Ark UI](https://ark-ui.com) with additional components and features not available in the core Ark UI library.
20 lines (19 loc) • 990 B
TypeScript
/**
* Value handling for numeric range filters (`inNumberRange`): the filter value is a
* `[min, max]` tuple where either bound may be `undefined`.
*/
export type RangeFilterValue = [number | undefined, number | undefined];
/** Bounds edited in the UI but not committed yet; `null` means the bound was cleared. */
export type PendingRange = {
min?: number | null;
max?: number | null;
};
/** The `[min, max]` bounds of a range filter value, or both undefined when there is none. */
export declare function rangeBounds(filterValue: unknown): RangeFilterValue;
/**
* The filter value after committing `pending` edits onto the current filter value. A bound
* that wasn't edited keeps its current (live) value, so a stale bound can't come back after
* the filter was changed elsewhere. Returns `undefined` when both bounds are empty, which
* removes the filter.
*/
export declare function mergeRangeFilter(current: unknown, pending: PendingRange): RangeFilterValue | undefined;