UNPKG

reactware

Version:

Reactware is an open source toolkit for developing desktop PWA with HTML, CSS, and JS

191 lines (143 loc) 5.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = _interopRequireDefault(require("react")); var _propTypes = _interopRequireDefault(require("prop-types")); var _styledComponents = _interopRequireWildcard(require("styled-components")); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _templateObject11() { var data = _taggedTemplateLiteral(["\n display: inline-block;\n position: relative;\n"]); _templateObject11 = function _templateObject11() { return data; }; return data; } function _templateObject10() { var data = _taggedTemplateLiteral(["height: ", ";"]); _templateObject10 = function _templateObject10() { return data; }; return data; } function _templateObject9() { var data = _taggedTemplateLiteral(["width: ", ";"]); _templateObject9 = function _templateObject9() { return data; }; return data; } function _templateObject8() { var data = _taggedTemplateLiteral(["bottom: ", ";"]); _templateObject8 = function _templateObject8() { return data; }; return data; } function _templateObject7() { var data = _taggedTemplateLiteral(["right: ", ";"]); _templateObject7 = function _templateObject7() { return data; }; return data; } function _templateObject6() { var data = _taggedTemplateLiteral(["left: ", ";"]); _templateObject6 = function _templateObject6() { return data; }; return data; } function _templateObject5() { var data = _taggedTemplateLiteral(["top: ", ";"]); _templateObject5 = function _templateObject5() { return data; }; return data; } function _templateObject4() { var data = _taggedTemplateLiteral(["top: ", ";"]); _templateObject4 = function _templateObject4() { return data; }; return data; } function _templateObject3() { var data = _taggedTemplateLiteral(["position: fixed;"]); _templateObject3 = function _templateObject3() { return data; }; return data; } function _templateObject2() { var data = _taggedTemplateLiteral(["position: absolute;"]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject() { var data = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n"]); _templateObject = function _templateObject() { return data; }; return data; } function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } var AbsoluteStyled = _styledComponents.default.div(_templateObject(), function (props) { return props.absolute && (0, _styledComponents.css)(_templateObject2()); }, function (props) { return props.fixed && (0, _styledComponents.css)(_templateObject3()); }, function (props) { return props.top && (0, _styledComponents.css)(_templateObject4(), props.top); }, function (props) { return props.top && (0, _styledComponents.css)(_templateObject5(), props.top); }, function (props) { return props.left && (0, _styledComponents.css)(_templateObject6(), props.left); }, function (props) { return props.right && (0, _styledComponents.css)(_templateObject7(), props.right); }, function (props) { return props.bottom && (0, _styledComponents.css)(_templateObject8(), props.bottom); }, function (props) { return props.width && (0, _styledComponents.css)(_templateObject9(), props.width); }, function (props) { return props.height && (0, _styledComponents.css)(_templateObject10(), props.height); }); var RelativeStyled = _styledComponents.default.div(_templateObject11()); var Absolute = function Absolute(props) { var children = props.children, wrap = props.wrap, rest = _objectWithoutProperties(props, ["children", "wrap"]); if (wrap) { return _react.default.createElement(RelativeStyled, null, _react.default.createElement(AbsoluteStyled, rest, children)); } return _react.default.createElement(AbsoluteStyled, rest, children); }; Absolute.propTypes = { absolute: _propTypes.default.bool, fixed: _propTypes.default.bool, wrap: _propTypes.default.bool, top: _propTypes.default.string, left: _propTypes.default.string, bottom: _propTypes.default.string, right: _propTypes.default.string, width: _propTypes.default.string, height: _propTypes.default.string }; Absolute.defaultProps = { absolute: null, fixed: null, wrap: null, top: null, left: null, bottom: null, right: null, width: null, height: null }; var _default = Absolute; exports.default = _default;