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