UNPKG

@chakra-ui/styled-system

Version:

Style function for css-in-js building component libraries

58 lines (53 loc) 1.31 kB
import { memoizedGet as get } from "@chakra-ui/utils"; var srOnly = { border: "0px", clip: "rect(0, 0, 0, 0)", width: "1px", height: "1px", margin: "-1px", padding: "0px", overflow: "hidden", whiteSpace: "nowrap", position: "absolute" }; var srFocusable = { position: "static", width: "auto", height: "auto", clip: "auto", padding: "0", margin: "0", overflow: "visible", whiteSpace: "normal" }; var getWithPriority = (theme, key, styles) => { var result = {}; var obj = get(theme, key, {}); for (var prop in obj) { var isInStyles = prop in styles && styles[prop] != null; if (!isInStyles) result[prop] = obj[prop]; } return result; }; export var others = { srOnly: { transform(value) { if (value === true) return srOnly; if (value === "focusable") return srFocusable; return {}; } }, layerStyle: { processResult: true, transform: (value, theme, styles) => getWithPriority(theme, "layerStyles." + value, styles) }, textStyle: { processResult: true, transform: (value, theme, styles) => getWithPriority(theme, "textStyles." + value, styles) }, apply: { processResult: true, transform: (value, theme, styles) => getWithPriority(theme, value, styles) } }; //# sourceMappingURL=others.js.map