@hig/rich-text
Advanced tools
Comparing version 1.0.1 to 1.1.0
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { css } from 'emotion'; | ||
import { css, cx } from 'emotion'; | ||
import ThemeContext from '@hig/theme-context'; | ||
@@ -81,2 +81,4 @@ | ||
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; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -108,10 +110,17 @@ | ||
var _props = _this2.props, | ||
children = _props.children, | ||
dangerouslySetInnerHTML = _props.dangerouslySetInnerHTML, | ||
otherProps = _objectWithoutProperties(_props, ["children", "dangerouslySetInnerHTML"]); | ||
var className = otherProps.className; | ||
var styles = stylesheet(resolvedRoles); | ||
return _this2.props.children ? React.createElement( | ||
return children ? React.createElement( | ||
"div", | ||
{ className: css(styles.richText) }, | ||
_this2.props.children | ||
{ className: cx(css(styles.richText), className) }, | ||
children | ||
) : React.createElement("div", { | ||
className: css(styles.richText), | ||
dangerouslySetInnerHTML: _this2.props.dangerouslySetInnerHTML // eslint-disable-line react/no-danger | ||
className: cx(css(styles.richText), className), | ||
dangerouslySetInnerHTML: dangerouslySetInnerHTML // eslint-disable-line react/no-danger | ||
}); | ||
@@ -118,0 +127,0 @@ } |
@@ -88,2 +88,4 @@ 'use strict'; | ||
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; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -115,10 +117,17 @@ | ||
var _props = _this2.props, | ||
children = _props.children, | ||
dangerouslySetInnerHTML = _props.dangerouslySetInnerHTML, | ||
otherProps = _objectWithoutProperties(_props, ["children", "dangerouslySetInnerHTML"]); | ||
var className = otherProps.className; | ||
var styles = stylesheet(resolvedRoles); | ||
return _this2.props.children ? React__default.createElement( | ||
return children ? React__default.createElement( | ||
"div", | ||
{ className: emotion.css(styles.richText) }, | ||
_this2.props.children | ||
{ className: emotion.cx(emotion.css(styles.richText), className) }, | ||
children | ||
) : React__default.createElement("div", { | ||
className: emotion.css(styles.richText), | ||
dangerouslySetInnerHTML: _this2.props.dangerouslySetInnerHTML // eslint-disable-line react/no-danger | ||
className: emotion.cx(emotion.css(styles.richText), className), | ||
dangerouslySetInnerHTML: dangerouslySetInnerHTML // eslint-disable-line react/no-danger | ||
}); | ||
@@ -125,0 +134,0 @@ } |
@@ -0,1 +1,8 @@ | ||
# [@hig/rich-text-v1.1.0](https://github.com/Autodesk/hig/compare/@hig/rich-text@1.0.1...@hig/rich-text@1.1.0) (2020-02-21) | ||
### Features | ||
* allow className to be passed down ([2b6bb16](https://github.com/Autodesk/hig/commit/2b6bb16)) | ||
# [@hig/rich-text-v1.0.1](https://github.com/Autodesk/hig/compare/@hig/rich-text@1.0.0...@hig/rich-text@1.0.1) (2019-03-13) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@hig/rich-text", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "HIG RichText", | ||
@@ -31,7 +31,7 @@ "author": "Autodesk Inc.", | ||
"@hig/semantic-release-config": "^0.1.0", | ||
"@hig/text-link": "^1.0.1" | ||
"@hig/text-link": "^1.1.0" | ||
}, | ||
"peerDependencies": { | ||
"@hig/theme-context": "^2.1.3", | ||
"@hig/theme-data": "^2.3.3", | ||
"@hig/theme-context": "^3.0.0", | ||
"@hig/theme-data": "^2.14.0", | ||
"react": "^15.4.1 || ^16.3.2" | ||
@@ -38,0 +38,0 @@ }, |
@@ -28,1 +28,5 @@ # Rich Text | ||
``` | ||
## Custom CSS | ||
Use the `className` prop to pass in a css class name to the outermost container of the component. The class name will also pass down to most of the other styled elements within the component. |
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
18147
515
296
32