@frontify/fondue
Version:
Design system of Frontify
34 lines (33 loc) • 978 B
JavaScript
import { Children as g } from "react";
const i = {
/**
* Recursively iterators through Children
* returns all instances of string amended together
*
*/
getLabel: (t) => {
let o = "";
const p = (r) => {
g.map(r, (e) => {
typeof e == "string" ? o += e : e != null && e.props && p(e == null ? void 0 : e.props.children);
});
};
return p(t), o;
},
/**
* Accesses the window object and copies the computed style
* of the element
*
*/
copyStyles: (t) => ({
fontSize: window.getComputedStyle(t).getPropertyValue("font-size"),
lineHeight: window.getComputedStyle(t).getPropertyValue("line-height"),
letterSpacing: window.getComputedStyle(t).getPropertyValue("letter-spacing"),
minWidth: window.getComputedStyle(t).getPropertyValue("width"),
fontWeight: window.getComputedStyle(t).getPropertyValue("font-weight")
})
};
export {
i as EditableTextHelper
};
//# sourceMappingURL=helper.es.js.map