@cloudflare/component-text
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -6,3 +6,11 @@ # Change Log | ||
<a name="2.0.3"></a> | ||
<a name="2.0.4"></a> | ||
## [2.0.4](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-text@2.0.3...@cloudflare/component-text@2.0.4) (2018-07-12) | ||
**Note:** Version bump only for package @cloudflare/component-text | ||
<a name="2.0.3"></a> | ||
## [2.0.3](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-text@2.0.2...@cloudflare/component-text@2.0.3) (2018-07-03) | ||
@@ -15,3 +23,3 @@ | ||
<a name="2.0.2"></a> | ||
<a name="2.0.2"></a> | ||
## [2.0.2](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-text@2.0.1...@cloudflare/component-text@2.0.2) (2018-06-29) | ||
@@ -24,3 +32,3 @@ | ||
<a name="2.0.1"></a> | ||
<a name="2.0.1"></a> | ||
@@ -27,0 +35,0 @@ ## [2.0.1](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-text@2.0.0...@cloudflare/component-text@2.0.1) (2018-06-29) |
import Text from './Text'; | ||
export { Text }; |
@@ -1,13 +0,22 @@ | ||
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 _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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; } | ||
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); } } | ||
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; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { createStyledComponent } from '@cloudflare/style-container'; | ||
var fontSizes = { | ||
@@ -17,7 +26,5 @@ normal: 3, | ||
}; | ||
var lineHeights = { | ||
small: 1.25 | ||
}; | ||
var colors = { | ||
@@ -30,3 +37,2 @@ info: 'blue.4', | ||
}; | ||
var fontWeights = { | ||
@@ -37,3 +43,2 @@ normal: 400, | ||
}; | ||
var textAlign = { | ||
@@ -65,3 +70,5 @@ start: 'left', | ||
var Text = function (_React$Component) { | ||
var Text = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(Text, _React$Component); | ||
@@ -72,17 +79,14 @@ | ||
return _possibleConstructorReturn(this, (Text.__proto__ || Object.getPrototypeOf(Text)).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(Text).apply(this, arguments)); | ||
} | ||
_createClass(Text, [{ | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var _props = this.props, | ||
className = _props.className, | ||
children = _props.children; | ||
return React.createElement( | ||
'div', | ||
{ className: className }, | ||
children | ||
); | ||
var _this$props = this.props, | ||
className = _this$props.className, | ||
children = _this$props.children; | ||
return React.createElement("div", { | ||
className: className | ||
}, children); | ||
} | ||
@@ -103,3 +107,2 @@ }]); | ||
}; | ||
Text.defaultProps = { | ||
@@ -109,3 +112,2 @@ weight: 'normal' | ||
Text.displayName = 'Text'; | ||
export default createStyledComponent(styles, Text); |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.Text = undefined; | ||
Object.defineProperty(exports, "Text", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Text.default; | ||
} | ||
}); | ||
var _Text = require('./Text'); | ||
var _Text = _interopRequireDefault(require("./Text")); | ||
var _Text2 = _interopRequireDefault(_Text); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.Text = _Text2.default; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
124
lib/Text.js
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,25 +6,38 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _propTypes = require('prop-types'); | ||
var _styleContainer = require("@cloudflare/style-container"); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _styleContainer = require('@cloudflare/style-container'); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
const fontSizes = { | ||
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); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var fontSizes = { | ||
normal: 3, | ||
small: 2 | ||
}; | ||
const lineHeights = { | ||
var lineHeights = { | ||
small: 1.25 | ||
}; | ||
const colors = { | ||
var colors = { | ||
info: 'blue.4', | ||
@@ -36,4 +49,3 @@ success: 'green.5', | ||
}; | ||
const fontWeights = { | ||
var fontWeights = { | ||
normal: 400, | ||
@@ -43,4 +55,3 @@ bold: 700, | ||
}; | ||
const textAlign = { | ||
var textAlign = { | ||
start: 'left', | ||
@@ -52,35 +63,56 @@ center: 'center', | ||
const styles = ({ size, weight, align, type, case: textCase }) => ({ | ||
color: type && colors[type], | ||
lineHeight: size && lineHeights[size], | ||
fontSize: size && fontSizes[size], | ||
fontWeight: weight && fontWeights[weight], | ||
textAlign: align && textAlign[align], | ||
textTransform: textCase, | ||
'&:first-letter': { | ||
textTransform: textCase && textCase === 'titlecase' && 'capitalize' | ||
} | ||
}); | ||
var styles = function styles(_ref) { | ||
var size = _ref.size, | ||
weight = _ref.weight, | ||
align = _ref.align, | ||
type = _ref.type, | ||
textCase = _ref.case; | ||
return { | ||
color: type && colors[type], | ||
lineHeight: size && lineHeights[size], | ||
fontSize: size && fontSizes[size], | ||
fontWeight: weight && fontWeights[weight], | ||
textAlign: align && textAlign[align], | ||
textTransform: textCase, | ||
'&:first-letter': { | ||
textTransform: textCase && textCase === 'titlecase' && 'capitalize' | ||
} | ||
}; | ||
}; | ||
class Text extends _react2.default.Component { | ||
render() { | ||
const { className, children } = this.props; | ||
return _react2.default.createElement( | ||
'div', | ||
{ className: className }, | ||
children | ||
); | ||
var Text = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(Text, _React$Component); | ||
function Text() { | ||
_classCallCheck(this, Text); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(Text).apply(this, arguments)); | ||
} | ||
} | ||
_createClass(Text, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this$props = this.props, | ||
className = _this$props.className, | ||
children = _this$props.children; | ||
return _react.default.createElement("div", { | ||
className: className | ||
}, children); | ||
} | ||
}]); | ||
return Text; | ||
}(_react.default.Component); | ||
Text.propTypes = { | ||
size: _propTypes2.default.oneOf(['normal', 'small']), | ||
weight: _propTypes2.default.oneOf(['normal', 'semi-bold', 'bold']), | ||
align: _propTypes2.default.oneOf(['start', 'center', 'justify', 'end']), | ||
type: _propTypes2.default.oneOf(['info', 'success', 'warning', 'error', 'muted']), | ||
case: _propTypes2.default.oneOf(['capitalize', 'titlecase', 'lowercase', 'uppercase']), | ||
className: _propTypes2.default.string.isRequired, | ||
children: _propTypes2.default.node | ||
size: _propTypes.default.oneOf(['normal', 'small']), | ||
weight: _propTypes.default.oneOf(['normal', 'semi-bold', 'bold']), | ||
align: _propTypes.default.oneOf(['start', 'center', 'justify', 'end']), | ||
type: _propTypes.default.oneOf(['info', 'success', 'warning', 'error', 'muted']), | ||
case: _propTypes.default.oneOf(['capitalize', 'titlecase', 'lowercase', 'uppercase']), | ||
className: _propTypes.default.string.isRequired, | ||
children: _propTypes.default.node | ||
}; | ||
Text.defaultProps = { | ||
@@ -91,2 +123,4 @@ weight: 'normal' | ||
exports.default = (0, _styleContainer.createStyledComponent)(styles, Text); | ||
var _default = (0, _styleContainer.createStyledComponent)(styles, Text); | ||
exports.default = _default; |
{ | ||
"name": "@cloudflare/component-text", | ||
"description": "Cloudflare Text Component", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"main": "lib/index.js", | ||
@@ -15,3 +15,3 @@ "module": "es/index.js", | ||
"dependencies": { | ||
"@cloudflare/style-container": "^2.0.3", | ||
"@cloudflare/style-container": "^3.0.0", | ||
"prop-types": "^15.6.0" | ||
@@ -18,0 +18,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
24031
264
+ Added@cloudflare/intl-types@1.5.6(transitive)
+ Added@cloudflare/style-const@2.5.3(transitive)
+ Added@cloudflare/style-container@3.0.3(transitive)
+ Added@cloudflare/types@6.29.1(transitive)
+ Added@cloudflare/util-en-garde@8.0.10(transitive)
+ Addedfp-ts@2.16.9(transitive)
+ Addedio-ts@2.2.22(transitive)
- Removed@cloudflare/style-const@1.0.12(transitive)
- Removed@cloudflare/style-container@2.0.3(transitive)