@hig/typography
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
@@ -37,57 +37,88 @@ import { cx, css } from 'emotion'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var Typography = function Typography(props) { | ||
var onElementType = function onElementType() { | ||
var elementType = props.elementType, | ||
variant = props.variant; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
if (elementType) { | ||
return elementType; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Typography = function (_Component) { | ||
_inherits(Typography, _Component); | ||
function Typography() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, Typography); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return ["h1", "h2", "h3"].includes(variant) ? variant : "p"; | ||
}; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Typography.__proto__ || Object.getPrototypeOf(Typography)).call.apply(_ref, [this].concat(args))), _this), _this.elementType = function () { | ||
var _this$props = _this.props, | ||
elementType = _this$props.elementType, | ||
variant = _this$props.variant; | ||
var align = props.align, | ||
children = props.children, | ||
fontWeight = props.fontWeight, | ||
variant = props.variant, | ||
customStylesheet = props.stylesheet, | ||
elementType = props.elementType, | ||
typographyRef = props.typographyRef, | ||
otherProps = _objectWithoutProperties(props, ["align", "children", "fontWeight", "variant", "stylesheet", "elementType", "typographyRef"]); | ||
var className = otherProps.className; | ||
if (elementType) { | ||
return elementType; | ||
} | ||
return ["h1", "h2", "h3"].includes(variant) ? variant : "p"; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
return React.createElement( | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref) { | ||
var resolvedRoles = _ref.resolvedRoles; | ||
_createClass(Typography, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this2 = this; | ||
var styles = stylesheet(_extends({ | ||
stylesheet: customStylesheet, | ||
align: align, | ||
fontWeight: fontWeight, | ||
variant: variant | ||
}, props), resolvedRoles); | ||
var _props = this.props, | ||
align = _props.align, | ||
children = _props.children, | ||
fontWeight = _props.fontWeight, | ||
variant = _props.variant, | ||
customStylesheet = _props.stylesheet, | ||
elementType = _props.elementType, | ||
typographyRef = _props.typographyRef, | ||
otherProps = _objectWithoutProperties(_props, ["align", "children", "fontWeight", "variant", "stylesheet", "elementType", "typographyRef"]); | ||
var ElementType = onElementType(); | ||
var className = otherProps.className; | ||
return React.createElement( | ||
ElementType, | ||
_extends({}, otherProps, { | ||
className: cx(css(styles.typography), className), | ||
ref: typographyRef | ||
}), | ||
children | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref2) { | ||
var resolvedRoles = _ref2.resolvedRoles; | ||
var styles = stylesheet(_extends({ | ||
stylesheet: customStylesheet, | ||
align: align, | ||
fontWeight: fontWeight, | ||
variant: variant | ||
}, _this2.props), resolvedRoles); | ||
var ElementType = _this2.elementType(); | ||
return React.createElement( | ||
ElementType, | ||
_extends({}, otherProps, { | ||
className: cx(css(styles.typography), className), | ||
ref: typographyRef | ||
}), | ||
children | ||
); | ||
} | ||
); | ||
} | ||
); | ||
}; | ||
}]); | ||
Typography.displayName = "Typography"; | ||
return Typography; | ||
}(Component); | ||
@@ -94,0 +125,0 @@ Typography.propTypes = { |
@@ -7,3 +7,4 @@ 'use strict'; | ||
var React = _interopDefault(require('react')); | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
@@ -44,57 +45,88 @@ var emotion = require('emotion'); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var Typography = function Typography(props) { | ||
var onElementType = function onElementType() { | ||
var elementType = props.elementType, | ||
variant = props.variant; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
if (elementType) { | ||
return elementType; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Typography = function (_Component) { | ||
_inherits(Typography, _Component); | ||
function Typography() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, Typography); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return ["h1", "h2", "h3"].includes(variant) ? variant : "p"; | ||
}; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Typography.__proto__ || Object.getPrototypeOf(Typography)).call.apply(_ref, [this].concat(args))), _this), _this.elementType = function () { | ||
var _this$props = _this.props, | ||
elementType = _this$props.elementType, | ||
variant = _this$props.variant; | ||
var align = props.align, | ||
children = props.children, | ||
fontWeight = props.fontWeight, | ||
variant = props.variant, | ||
customStylesheet = props.stylesheet, | ||
elementType = props.elementType, | ||
typographyRef = props.typographyRef, | ||
otherProps = _objectWithoutProperties(props, ["align", "children", "fontWeight", "variant", "stylesheet", "elementType", "typographyRef"]); | ||
var className = otherProps.className; | ||
if (elementType) { | ||
return elementType; | ||
} | ||
return ["h1", "h2", "h3"].includes(variant) ? variant : "p"; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
return React.createElement( | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref) { | ||
var resolvedRoles = _ref.resolvedRoles; | ||
_createClass(Typography, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this2 = this; | ||
var styles = stylesheet(_extends({ | ||
stylesheet: customStylesheet, | ||
align: align, | ||
fontWeight: fontWeight, | ||
variant: variant | ||
}, props), resolvedRoles); | ||
var _props = this.props, | ||
align = _props.align, | ||
children = _props.children, | ||
fontWeight = _props.fontWeight, | ||
variant = _props.variant, | ||
customStylesheet = _props.stylesheet, | ||
elementType = _props.elementType, | ||
typographyRef = _props.typographyRef, | ||
otherProps = _objectWithoutProperties(_props, ["align", "children", "fontWeight", "variant", "stylesheet", "elementType", "typographyRef"]); | ||
var ElementType = onElementType(); | ||
var className = otherProps.className; | ||
return React.createElement( | ||
ElementType, | ||
_extends({}, otherProps, { | ||
className: emotion.cx(emotion.css(styles.typography), className), | ||
ref: typographyRef | ||
}), | ||
children | ||
return React__default.createElement( | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref2) { | ||
var resolvedRoles = _ref2.resolvedRoles; | ||
var styles = stylesheet(_extends({ | ||
stylesheet: customStylesheet, | ||
align: align, | ||
fontWeight: fontWeight, | ||
variant: variant | ||
}, _this2.props), resolvedRoles); | ||
var ElementType = _this2.elementType(); | ||
return React__default.createElement( | ||
ElementType, | ||
_extends({}, otherProps, { | ||
className: emotion.cx(emotion.css(styles.typography), className), | ||
ref: typographyRef | ||
}), | ||
children | ||
); | ||
} | ||
); | ||
} | ||
); | ||
}; | ||
}]); | ||
Typography.displayName = "Typography"; | ||
return Typography; | ||
}(React.Component); | ||
@@ -101,0 +133,0 @@ Typography.propTypes = { |
@@ -0,1 +1,13 @@ | ||
# [@hig/typography-v1.2.2](https://github.com/Autodesk/hig/compare/@hig/typography@1.2.1...@hig/typography@1.2.2) (2022-01-12) | ||
### Bug Fixes | ||
* Forcing semantic release by editing readmes ([d39b61f](https://github.com/Autodesk/hig/commit/d39b61f)) | ||
### Reverts | ||
* "Revert "Revert "feat : Migrate all repository to React v17.0 """ ([bf78986](https://github.com/Autodesk/hig/commit/bf78986)) | ||
# [@hig/typography-v1.2.1](https://github.com/Autodesk/hig/compare/@hig/typography@1.2.0...@hig/typography@1.2.1) (2022-01-12) | ||
@@ -2,0 +14,0 @@ |
{ | ||
"name": "@hig/typography", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "HIG Typography components", | ||
@@ -32,5 +32,5 @@ "author": "Autodesk Inc.", | ||
"peerDependencies": { | ||
"@hig/theme-context": "^3.0.2", | ||
"@hig/theme-context": "^3.0.3", | ||
"@hig/theme-data": "^2.22.0", | ||
"react": "^17.0.0" | ||
"react": "^15.4.1 || ^16.3.2" | ||
}, | ||
@@ -37,0 +37,0 @@ "scripts": { |
@@ -7,2 +7,3 @@ # Typography | ||
## Getting started | ||
@@ -9,0 +10,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24557
392
51