bits-ui
Version:
The headless components for Svelte.
21 lines (20 loc) • 526 B
JavaScript
export function styleToString(style) {
return Object.keys(style).reduce((str, key) => {
if (style[key] === undefined)
return str;
return `${str}${key}:${style[key]};`;
}, "");
}
export function getSrOnlyStyles() {
return styleToString({
position: "absolute",
width: "1px",
height: "1px",
padding: "0",
margin: "-1px",
overflow: "hidden",
clip: "rect(0, 0, 0, 0)",
whiteSpace: "nowrap",
borderWidth: "0",
});
}