@frontify/fondue-charts
Version:
Frontify's data viz library
16 lines (15 loc) • 654 B
JavaScript
import { useState as L, useEffect as n } from "react";
import { LABEL_TITLE_STYLE as m, LABEL_VALUE_STYLE as T, LABEL_PERCENTAGE_STYLE as W } from "../components/consts.es.js";
import "@visx/scale";
import { getSVGTextDimensions as t } from "../../common/helpers/getSVGTextDimensions.es.js";
const u = (i, e, o) => {
const [s, d] = L({ labelWidth: 0, valueWidth: 0, percentageWidth: 0 });
return n(() => {
const h = t(i, m).width ?? 0, E = t(e, T).width ?? 0, r = t(o, W).width ?? 0;
d({ labelWidth: h, valueWidth: E, percentageWidth: r });
}, [i, e, o]), s;
};
export {
u as useTextWidths
};
//# sourceMappingURL=useTextWidths.es.js.map