@danxbot/ui 25.1.0 → 25.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10226 -10176
- package/dist/index.js.map +1 -1
- package/dist/types/components/chart/ShareBar.d.ts +1 -1
- package/dist/types/components/chart/share-bar-labels.d.ts +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The smallest clear space, in px, left between two direct labels that sit side by side. */
|
|
2
|
+
export declare const LABEL_GAP = 4;
|
|
3
|
+
/** One direct label as laid out. All lengths are px, measured from the bar's LEFT edge (physical, also in RTL). */
|
|
4
|
+
export interface LabelBox {
|
|
5
|
+
key: string;
|
|
6
|
+
share: number;
|
|
7
|
+
/** Offset of the label's centre (its segment's centre) from the bar's left edge. */
|
|
8
|
+
center: number;
|
|
9
|
+
/** Width of the printed label. */
|
|
10
|
+
width: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The keys of the labels that must NOT be drawn: one whose box (`center ± width / 2`) leaves `[0, barWidth]`
|
|
14
|
+
* (a clipping ancestor would cut it to a wrong number), or that comes within `LABEL_GAP` of a larger-share
|
|
15
|
+
* label already kept. The larger share wins a contested spot, so the answer does not depend on input order.
|
|
16
|
+
*/
|
|
17
|
+
export declare function labelsToDrop(boxes: readonly LabelBox[], barWidth: number): Set<string>;
|