@heycar-uikit/core
Version:
The React UI library from HeyCar
67 lines (57 loc) • 4.23 kB
JavaScript
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');
var cn = require('classnames');
var Typography_constants = require('./Typography.constants.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function () {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
var styles = {"typography":"typography__typography_1kfjd","display1":"typography__display1_1kfjd","display2":"typography__display2_1kfjd","h1":"typography__h1_1kfjd","h2":"typography__h2_1kfjd","h3":"typography__h3_1kfjd","h4":"typography__h4_1kfjd","h5":"typography__h5_1kfjd","h6":"typography__h6_1kfjd","subheading1":"typography__subheading1_1kfjd","subheading2":"typography__subheading2_1kfjd","subheading3":"typography__subheading3_1kfjd","subheading4":"typography__subheading4_1kfjd","body1":"typography__body1_1kfjd","body2":"typography__body2_1kfjd","body3":"typography__body3_1kfjd","body4":"typography__body4_1kfjd","caption1":"typography__caption1_1kfjd","caption2":"typography__caption2_1kfjd","caption3":"typography__caption3_1kfjd","caption4":"typography__caption4_1kfjd","caption5":"typography__caption5_1kfjd","overline1":"typography__overline1_1kfjd","overline2":"typography__overline2_1kfjd","button1":"typography__button1_1kfjd","button2":"typography__button2_1kfjd","button3":"typography__button3_1kfjd","buttonLink1":"typography__buttonLink1_1kfjd","buttonLink2":"typography__buttonLink2_1kfjd","buttonLink3":"typography__buttonLink3_1kfjd"};
require('./styles/variant.css');
var Typography = function (_a) {
var _b = _a.variant, variant = _b === void 0 ? 'body3' : _b, className = _a.className, _c = _a.Component, Component = _c === void 0 ? Typography_constants.defaultVariantMapping[variant] : _c, children = _a.children, dataTestId = _a.dataTestId, restProps = __rest(_a, ["variant", "className", "Component", "children", "dataTestId"]);
var classNames = cn__default["default"](styles.typography, styles[variant], className);
return (React__default["default"].createElement(Component, __assign({ className: classNames, "data-test-id": dataTestId }, restProps), children));
};
Typography.displayName = 'Typography';
exports.Typography = Typography;
exports["default"] = Typography;