grommet
Version:
focus on the essential experience
47 lines (46 loc) • 3.17 kB
JavaScript
;
exports.__esModule = true;
exports.StyledStackLayer = exports.StyledStack = void 0;
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _utils = require("../../utils");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
var fillStyle = (0, _styledComponents.css)(["", " ", " flex-grow:1;display:flex;"], function (props) {
return props.fillContainer === true || props.fillContainer === 'horizontal' ? "\n width: 100%;\n max-width: none;\n " : '';
}, function (props) {
return props.fillContainer === true || props.fillContainer === 'vertical' ? 'height: 100%;' : '';
});
var StyledStack = exports.StyledStack = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
displayName: "StyledStack",
componentId: "sc-ajspsk-0"
})(["position:relative;", " ", " ", ""], _utils.genericStyles, function (props) {
return props.fillContainer && fillStyle;
}, function (props) {
return props.theme.stack && props.theme.stack.extend;
});
var styleMap = {
fill: "\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n ",
center: "\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n ",
left: "\n top: 50%;\n left: 0;\n transform: translateY(-50%);\n ",
right: "\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n ",
top: "\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n ",
bottom: "\n bottom: 0;\n left: 50%;\n transform: translateX(-50%);\n ",
'top-left': "\n top: 0;\n left: 0;\n ",
'bottom-left': "\n bottom: 0;\n left: 0;\n ",
'top-right': "\n top: 0;\n right: 0;\n ",
'bottom-right': "\n bottom: 0;\n right: 0;\n "
};
var StyledStackLayer = exports.StyledStackLayer = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
displayName: "StyledStack__StyledStackLayer",
componentId: "sc-ajspsk-1"
})(["position:", ";", " ", " ", " ", ""], function (props) {
return props.guiding ? 'relative' : 'absolute';
}, function (props) {
return props.guiding && 'display: block;';
}, function (props) {
return !props.guiding && styleMap[props.anchor || 'fill'] + ";";
}, function (props) {
return props.fillContainer && "\n width: 100%;\n height: 100%;\n ";
}, function (props) {
return !props.interactive && "pointer-events: none;";
});