calcite-react
Version:
Calcite components for React
253 lines (203 loc) • 9.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.CalciteFigure = exports.CalciteLi = exports.CalciteUl = exports.CalciteOl = exports.CalciteH6 = exports.CalciteH5 = exports.CalciteH4 = exports.CalciteH3 = exports.CalciteH2 = exports.CalciteH1 = exports.CalciteA = exports.CalciteP = exports.CalciteBody = exports.CalciteHtml = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _helpers = require("../utils/helpers");
var _CalciteThemeProvider = require("../CalciteThemeProvider");
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
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; }
// Calcite components
// Icons
// Third party libraries
var CalciteHtml = _styledComponents.default.html.withConfig({
displayName: "CalciteHtml",
componentId: "sc-1pkt4xd-0"
})(["height:100%;font-size:100%;font-family:'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif;"]);
exports.CalciteHtml = CalciteHtml;
CalciteHtml.defaultProps = {
theme: _CalciteThemeProvider.CalciteTheme
};
CalciteHtml.displayName = 'CalciteHtml';
var CalciteBody = _styledComponents.default.body.withConfig({
displayName: "CalciteBody",
componentId: "sc-1pkt4xd-1"
})(["min-height:100%;margin:0;tracking:0;font-family:'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif;line-height:1.55rem;color:#4c4c4c;background-color:#ffffff;-webkit-font-smoothing:subpixel-antialiased;font-feature-settings:'kern';font-kerning:normal;text-rendering:optimizeLegibility;font-feature-settings:'liga' 1,'calt' 0;"]);
exports.CalciteBody = CalciteBody;
CalciteBody.defaultProps = {
theme: _CalciteThemeProvider.CalciteTheme
};
CalciteBody.displayName = 'CalciteBody';
var CalciteP = _styledComponents.default.p.withConfig({
displayName: "CalciteP",
componentId: "sc-1pkt4xd-2"
})(["margin-top:0;margin-bottom:1.55rem;"]);
exports.CalciteP = CalciteP;
CalciteP.defaultProps = {
theme: _CalciteThemeProvider.CalciteTheme
};
CalciteP.displayName = 'CalciteP';
var CalciteA = _styledComponents.default.a.withConfig({
displayName: "CalciteA",
componentId: "sc-1pkt4xd-3"
})(["color:", ";text-decoration:none;cursor:pointer;&:hover{color:", ";text-decoration:underline;}"], function (props) {
return props.theme.linkColor;
}, function (props) {
return props.theme.linkHover;
});
exports.CalciteA = CalciteA;
CalciteA.defaultProps = {
theme: _CalciteThemeProvider.CalciteTheme
};
CalciteA.displayName = 'CalciteA';
var baseH = _styledComponents.default.h1.withConfig({
displayName: "baseH",
componentId: "sc-1pkt4xd-4"
})(["font-weight:300;font-style:normal;margin:0 0 ", " 0;"], function (props) {
return props.theme.baseline;
});
baseH.defaultProps = {
theme: _CalciteThemeProvider.CalciteTheme
};
var H1 = (0, _styledComponents.default)(baseH).withConfig({
displayName: "H1",
componentId: "sc-1pkt4xd-5"
})(["", ";"], (0, _helpers.fontSize)(5));
var CalciteH1 = function CalciteH1(_ref) {
var children = _ref.children,
props = _objectWithoutProperties(_ref, ["children"]);
return _react.default.createElement(H1, props, children);
};
exports.CalciteH1 = CalciteH1;
CalciteH1.displayName = 'CalciteH1';
var H2 = (0, _styledComponents.default)(baseH).withConfig({
displayName: "H2",
componentId: "sc-1pkt4xd-6"
})(["", ";"], (0, _helpers.fontSize)(4));
var CalciteH2 = function CalciteH2(_ref2) {
var children = _ref2.children,
props = _objectWithoutProperties(_ref2, ["children"]);
return _react.default.createElement(H2, _extends({
as: "h2"
}, props), children);
};
exports.CalciteH2 = CalciteH2;
CalciteH2.displayName = 'CalciteH2';
var H3 = (0, _styledComponents.default)(baseH).withConfig({
displayName: "H3",
componentId: "sc-1pkt4xd-7"
})(["", ";"], (0, _helpers.fontSize)(3));
var CalciteH3 = function CalciteH3(_ref3) {
var children = _ref3.children,
props = _objectWithoutProperties(_ref3, ["children"]);
return _react.default.createElement(H3, _extends({
as: "h3"
}, props), children);
};
exports.CalciteH3 = CalciteH3;
CalciteH3.displayName = 'CalciteH3';
var H4 = (0, _styledComponents.default)(baseH).withConfig({
displayName: "H4",
componentId: "sc-1pkt4xd-8"
})(["", ";"], (0, _helpers.fontSize)(2));
var CalciteH4 = function CalciteH4(_ref4) {
var children = _ref4.children,
props = _objectWithoutProperties(_ref4, ["children"]);
return _react.default.createElement(H4, _extends({
as: "h4"
}, props), children);
};
exports.CalciteH4 = CalciteH4;
CalciteH4.displayName = 'CalciteH4';
var H5 = (0, _styledComponents.default)(baseH).withConfig({
displayName: "H5",
componentId: "sc-1pkt4xd-9"
})(["", ";"], (0, _helpers.fontSize)(1));
var CalciteH5 = function CalciteH5(_ref5) {
var children = _ref5.children,
props = _objectWithoutProperties(_ref5, ["children"]);
return _react.default.createElement(H5, _extends({
as: "h5"
}, props), children);
};
exports.CalciteH5 = CalciteH5;
CalciteH5.displayName = 'CalciteH5';
var H6 = (0, _styledComponents.default)(baseH).withConfig({
displayName: "H6",
componentId: "sc-1pkt4xd-10"
})(["", ";"], (0, _helpers.fontSize)(0));
var CalciteH6 = function CalciteH6(_ref6) {
var children = _ref6.children,
props = _objectWithoutProperties(_ref6, ["children"]);
return _react.default.createElement(H6, _extends({
as: "h6"
}, props), children);
};
exports.CalciteH6 = CalciteH6;
CalciteH6.displayName = 'CalciteH6';
var BaseList = _styledComponents.default.div.withConfig({
displayName: "BaseList",
componentId: "sc-1pkt4xd-11"
})(["margin-top:0;margin-bottom:", ";padding:0;list-style-position:inside;margin-bottom:", ";margin-left:", ";", ";html[dir='rtl'] &{margin-left:initial;margin-right:", ";}ul,ol{margin-bottom:0;}", ";"], function (props) {
return props.theme.baseline;
}, function (props) {
return props.theme.baseline;
}, function (props) {
return (0, _helpers.unitCalc)(props.theme.baseline, 2, '/');
}, (0, _helpers.fontSize)(-1), function (props) {
return (0, _helpers.unitCalc)(props.theme.baseline, 2, '/');
}, function (props) {
return props.plain && (0, _styledComponents.css)(["margin-left:0;list-style:none;html[dir='rtl'] &{margin-left:initial;margin-right:0;}li{margin-left:0;html[dir='rtl'] &{margin-left:initial;margin-right:0;}}"]);
});
BaseList.defaultProps = {
theme: _CalciteThemeProvider.CalciteTheme
};
var CalciteOl = function CalciteOl(_ref7) {
var children = _ref7.children,
props = _objectWithoutProperties(_ref7, ["children"]);
return _react.default.createElement(BaseList, _extends({
as: "ol"
}, props), children);
};
exports.CalciteOl = CalciteOl;
CalciteOl.displayName = 'CalciteOl';
var CalciteUl = function CalciteUl(_ref8) {
var children = _ref8.children,
props = _objectWithoutProperties(_ref8, ["children"]);
return _react.default.createElement(BaseList, _extends({
as: "ul"
}, props), children);
};
exports.CalciteUl = CalciteUl;
CalciteUl.displayName = 'CalciteUl';
var CalciteLi = _styledComponents.default.li.withConfig({
displayName: "CalciteLi",
componentId: "sc-1pkt4xd-12"
})(["list-style-position:outside;margin:", " 0 ", " 1.5rem;html[dir='rtl'] &{margin:", " 1.5rem ", " 0;}ul,ol{margin-bottom:0;}"], function (props) {
return (0, _helpers.unitCalc)(props.theme.baseline, 4, '/');
}, function (props) {
return (0, _helpers.unitCalc)(props.theme.baseline, 4, '/');
}, function (props) {
return (0, _helpers.unitCalc)(props.theme.baseline, 4, '/');
}, function (props) {
return (0, _helpers.unitCalc)(props.theme.baseline, 4, '/');
});
exports.CalciteLi = CalciteLi;
CalciteLi.defaultProps = {
theme: _CalciteThemeProvider.CalciteTheme
};
CalciteLi.displayName = 'CalciteLi';
var CalciteFigure = _styledComponents.default.figure.withConfig({
displayName: "CalciteFigure",
componentId: "sc-1pkt4xd-13"
})(["margin:0 0 1.55rem 0;"]);
exports.CalciteFigure = CalciteFigure;
CalciteFigure.defaultProps = {
theme: _CalciteThemeProvider.CalciteTheme
};
CalciteFigure.displayName = 'CalciteFigure';