UNPKG

@chakra-ui/styled-system

Version:

Style function for css-in-js building component libraries

70 lines (63 loc) 1.55 kB
"use strict"; exports.__esModule = true; exports.others = void 0; var _utils = require("@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 = function getWithPriority(theme, key, styles) { var result = {}; var obj = (0, _utils.memoizedGet)(theme, key, {}); for (var prop in obj) { var isInStyles = prop in styles && styles[prop] != null; if (!isInStyles) result[prop] = obj[prop]; } return result; }; var others = { srOnly: { transform: function transform(value) { if (value === true) return srOnly; if (value === "focusable") return srFocusable; return {}; } }, layerStyle: { processResult: true, transform: function transform(value, theme, styles) { return getWithPriority(theme, "layerStyles." + value, styles); } }, textStyle: { processResult: true, transform: function transform(value, theme, styles) { return getWithPriority(theme, "textStyles." + value, styles); } }, apply: { processResult: true, transform: function transform(value, theme, styles) { return getWithPriority(theme, value, styles); } } }; exports.others = others; //# sourceMappingURL=others.js.map