/*! * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * The text of the overflow counter tag. Whole thousands round to a `K` suffix * - `1500` becomes `2K` - so the counter keeps a bounded width no matter how * large the selection grows. */ export declare const formatOverflowCount: (count: number) => string; /** * Every text the counter could show at its widest for a selection of `total` * options. K formatting makes the width non-monotonic - "+999" is wider than * "+1K" - so the reserve has to measure both the widest sub-thousand text and * the full count rather than the full count alone. */ export declare const getOverflowCounterMeasureTexts: (total: number) => string[]; type ComboboxOverflowMeasurements = { /** Widths of every selected tag, in selection order. */ tagWidths: number[]; /** Width of the widest counter tag the current selection could need. */ counterWidth: number; /** Content width of the wrapping value container. */ containerWidth: number; /** Column gap between tags. */ gap: number; /** Maximum number of rows the tags may wrap into. */ maxRows: number; }; /** * How many tags fit within `maxRows` rows of the value container, mirroring * the greedy line breaking of `flex-wrap`. When they all fit, the count is the * number of tags and no counter is needed; otherwise the result leaves room * for the counter tag on the last permitted row. */ export declare const computeVisibleTagCount: ({ tagWidths, counterWidth, containerWidth, gap, maxRows, }: ComboboxOverflowMeasurements) => number; type UseComboboxMultiValueOverflowOptions = { /** Undefined leaves the selection unbounded and skips all measuring. */ maxRows: number | undefined; /** Number of selected options rendered as tags. */ tagCount: number; /** * Anything that changes tag widths without changing the container size, such * as the selection itself or the control size, so those changes re-measure. */ measureKey: string; }; /** * Caps the rows of selected tags in a multi select control. All tags stay * rendered; the ones past `visibleCount` are taken out of the layout by the * stylesheet but stay measurable, so the computation is stable across passes. * Width comes from a `ResizeObserver` on the value container, and everything * else from `measureKey`. */ export declare const useComboboxMultiValueOverflow: ({ maxRows, tagCount, measureKey, }: UseComboboxMultiValueOverflowOptions) => { containerRef: import("react").RefObject; visibleCount: number | null; }; export {}; //# sourceMappingURL=use-combobox-multi-value-overflow.d.ts.map