UNPKG

@netdata/netdata-ui

Version:
91 lines 4.57 kB
var _excluded = ["background", "height", "onClick", "round", "size"], _excluded2 = ["round", "hollow", "flavour", "borderColor", "onClick", "padding", "size", "tiny", "position", "zIndex", "justifyContent", "alignItems", "background", "semi"]; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; } import styled from "styled-components"; import Flex from "../templates/flex"; import getPillBackground from "./mixins/background"; import { getPillColor } from "./mixins/colors"; import getPillPadding from "./mixins/padding"; export var MasterCardContainer = styled(Flex).attrs(function (_ref) { var background = _ref.background, height = _ref.height, onClick = _ref.onClick, _ref$round = _ref.round, round = _ref$round === void 0 ? 999 : _ref$round, size = _ref.size, props = _objectWithoutPropertiesLoose(_ref, _excluded); return _objectSpread(_objectSpread({ background: background }, onClick && { cursor: "pointer" }), {}, { position: "relative", round: round, size: size }, props); }).withConfig({ displayName: "styled__MasterCardContainer", componentId: "sc-1pihee3-0" })(["-webkit-user-select:", ";-ms-user-select:", ";user-select:", ";*{cursor:", ";}"], function (_ref2) { var noUserSelection = _ref2.noUserSelection; return noUserSelection ? "none" : "auto"; }, function (_ref3) { var noUserSelection = _ref3.noUserSelection; return noUserSelection ? "none" : "auto"; }, function (_ref4) { var noUserSelection = _ref4.noUserSelection; return noUserSelection ? "none" : "auto"; }, function (_ref5) { var onClick = _ref5.onClick; return onClick ? "pointer" : "inherit"; }); export var PillContainer = styled(Flex).attrs(function (_ref6) { var _ref6$round = _ref6.round, round = _ref6$round === void 0 ? true : _ref6$round, hollow = _ref6.hollow, flavour = _ref6.flavour, borderColor = _ref6.borderColor, onClick = _ref6.onClick, padding = _ref6.padding, size = _ref6.size, tiny = _ref6.tiny, position = _ref6.position, zIndex = _ref6.zIndex, _ref6$justifyContent = _ref6.justifyContent, justifyContent = _ref6$justifyContent === void 0 ? "center" : _ref6$justifyContent, _ref6$alignItems = _ref6.alignItems, alignItems = _ref6$alignItems === void 0 ? "center" : _ref6$alignItems, background = _ref6.background, semi = _ref6.semi, rest = _objectWithoutPropertiesLoose(_ref6, _excluded2); return _objectSpread(_objectSpread({ padding: getPillPadding(padding, size, tiny), round: round === false ? 1 : round === true ? 7.5 : round, border: { side: "all", color: borderColor || getPillColor(semi ? "hollow" : "border", flavour), size: "1px" } }, onClick && { cursor: "pointer" }), {}, { justifyContent: justifyContent, alignItems: alignItems, position: position, zIndex: zIndex, background: getPillBackground({ background: background, flavour: flavour, hollow: hollow, semi: semi }) }, rest); }).withConfig({ displayName: "styled__PillContainer", componentId: "sc-1pihee3-1" })([""]);