Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cloudflare/component-text

Package Overview
Dependencies
Maintainers
25
Versions
510
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudflare/component-text - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

<a name="1.0.7"></a>
## [1.0.7](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-text@1.0.6...@cloudflare/component-text@1.0.7) (2018-06-05)
**Note:** Version bump only for package @cloudflare/component-text
<a name="1.0.6"></a>

@@ -8,0 +16,0 @@ ## [1.0.6](http://stash.cfops.it:7999/www/cf-ux/compare/@cloudflare/component-text@1.0.5...@cloudflare/component-text@1.0.6) (2018-05-25)

24

es/index.js

@@ -1,8 +0,22 @@

import TextUnstyled from './Text';
import TextTheme from './TextTheme';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TextTheme = exports.TextUnstyled = exports.Text = undefined;
import { applyTheme } from '@cloudflare/style-container';
var _Text = require('./Text');
var Text = applyTheme(TextUnstyled, TextTheme);
var _Text2 = _interopRequireDefault(_Text);
export { Text, TextUnstyled, TextTheme };
var _TextTheme = require('./TextTheme');
var _TextTheme2 = _interopRequireDefault(_TextTheme);
var _index = require('@cloudflare/style-container/src/index.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Text = (0, _index.applyTheme)(_Text2.default, _TextTheme2.default);
exports.Text = Text;
exports.TextUnstyled = _Text2.default;
exports.TextTheme = _TextTheme2.default;

@@ -0,3 +1,23 @@

Object.defineProperty(exports, "__esModule", {
value: true
});
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; }; }();
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _index = require('@cloudflare/style-container/src/index.js');
var _capitalize = require('capitalize');
var _capitalize2 = _interopRequireDefault(_capitalize);
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"); } }

@@ -9,10 +29,5 @@

import React from 'react';
import PropTypes from 'prop-types';
import { createComponent } from '@cloudflare/style-container';
import capitalizeWord from 'capitalize';
var capitalize = function capitalize(str) {
return str.split('-').map(function (w) {
return capitalizeWord(w);
return (0, _capitalize2.default)(w);
}).join('');

@@ -57,3 +72,3 @@ };

return React.createElement(
return _react2.default.createElement(
'div',

@@ -67,12 +82,12 @@ { className: className },

return Text;
}(React.Component);
}(_react2.default.Component);
Text.propTypes = {
size: PropTypes.oneOf(['normal', 'small']),
weight: PropTypes.oneOf(['normal', 'semi-bold', 'bold']),
align: PropTypes.oneOf(['start', 'center', 'justify', 'end']),
type: PropTypes.oneOf(['info', 'success', 'warning', 'error', 'muted']),
case: PropTypes.oneOf(['capitalize', 'titlecase', 'lowercase', 'uppercase']),
className: PropTypes.string.isRequired,
children: PropTypes.node
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
};

@@ -85,2 +100,2 @@

export default createComponent(styles, Text);
exports.default = (0, _index.createComponent)(styles, Text);

@@ -1,2 +0,6 @@

export default (function (baseTheme) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (baseTheme) {
return {

@@ -23,2 +27,2 @@ fontSizeNormal: '1em',

};
});
};

@@ -16,7 +16,7 @@ 'use strict';

var _styleContainer = require('@cloudflare/style-container');
var _index = require('@cloudflare/style-container/src/index.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const Text = (0, _styleContainer.applyTheme)(_Text2.default, _TextTheme2.default);
var Text = (0, _index.applyTheme)(_Text2.default, _TextTheme2.default);

@@ -23,0 +23,0 @@ exports.Text = Text;

@@ -7,2 +7,4 @@ 'use strict';

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; }; }();
var _react = require('react');

@@ -16,3 +18,3 @@

var _styleContainer = require('@cloudflare/style-container');
var _index = require('@cloudflare/style-container/src/index.js');

@@ -25,27 +27,61 @@ var _capitalize = require('capitalize');

const capitalize = str => str.split('-').map(w => (0, _capitalize2.default)(w)).join('');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
const styles = ({ theme, size, weight, align, type, case: textCase }) => ({
color: type && theme[`color${capitalize(type)}`],
lineHeight: size && theme[`lineHeight${capitalize(size)}`],
fontSize: size && theme[`fontSize${capitalize(size)}`],
fontWeight: weight && theme[`fontWeight${capitalize(weight)}`],
textAlign: align && theme[`textAlign${capitalize(align)}`],
textTransform: textCase && theme[`textTransform${capitalize(textCase)}`],
'&:first-letter': {
textTransform: textCase && theme[`textTransform${capitalize(textCase)}:first-letter`]
}
});
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; }
class Text extends _react2.default.Component {
render() {
const { className, children } = this.props;
return _react2.default.createElement(
'div',
{ className: className },
children
);
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 capitalize = function capitalize(str) {
return str.split('-').map(function (w) {
return (0, _capitalize2.default)(w);
}).join('');
};
var styles = function styles(_ref) {
var theme = _ref.theme,
size = _ref.size,
weight = _ref.weight,
align = _ref.align,
type = _ref.type,
textCase = _ref.case;
return {
color: type && theme['color' + capitalize(type)],
lineHeight: size && theme['lineHeight' + capitalize(size)],
fontSize: size && theme['fontSize' + capitalize(size)],
fontWeight: weight && theme['fontWeight' + capitalize(weight)],
textAlign: align && theme['textAlign' + capitalize(align)],
textTransform: textCase && theme['textTransform' + capitalize(textCase)],
'&:first-letter': {
textTransform: textCase && theme['textTransform' + capitalize(textCase) + ':first-letter']
}
};
};
var Text = function (_React$Component) {
_inherits(Text, _React$Component);
function Text() {
_classCallCheck(this, Text);
return _possibleConstructorReturn(this, (Text.__proto__ || Object.getPrototypeOf(Text)).apply(this, arguments));
}
}
_createClass(Text, [{
key: 'render',
value: function render() {
var _props = this.props,
className = _props.className,
children = _props.children;
return _react2.default.createElement(
'div',
{ className: className },
children
);
}
}]);
return Text;
}(_react2.default.Component);
Text.propTypes = {

@@ -66,2 +102,2 @@ size: _propTypes2.default.oneOf(['normal', 'small']),

exports.default = (0, _styleContainer.createComponent)(styles, Text);
exports.default = (0, _index.createComponent)(styles, Text);

@@ -7,22 +7,24 @@ 'use strict';

exports.default = baseTheme => ({
fontSizeNormal: '1em',
fontSizeSmall: '.8em',
fontWeightNormal: 400,
fontWeightBold: 700,
fontWeightSemiBold: 600,
lineHeightSmall: 1.3,
textAlignStart: 'left',
textAlignCenter: 'center',
textAlignJustify: 'justify',
textAlignEnd: 'right',
textTransformCapitalize: 'capitalize',
'textTransformTitlecase:first-letter': 'capitalize',
textTransformLowercase: 'lowercase',
textTransformUppercase: 'uppercase',
colorInfo: baseTheme.colors.blue[4],
colorSuccess: baseTheme.colors.green[5],
colorWarning: baseTheme.colors.orange[6],
colorError: baseTheme.colors.red[3],
colorMuted: baseTheme.colors.gray[4]
});
exports.default = function (baseTheme) {
return {
fontSizeNormal: '1em',
fontSizeSmall: '.8em',
fontWeightNormal: 400,
fontWeightBold: 700,
fontWeightSemiBold: 600,
lineHeightSmall: 1.3,
textAlignStart: 'left',
textAlignCenter: 'center',
textAlignJustify: 'justify',
textAlignEnd: 'right',
textTransformCapitalize: 'capitalize',
'textTransformTitlecase:first-letter': 'capitalize',
textTransformLowercase: 'lowercase',
textTransformUppercase: 'uppercase',
colorInfo: baseTheme.colors.blue[4],
colorSuccess: baseTheme.colors.green[5],
colorWarning: baseTheme.colors.orange[6],
colorError: baseTheme.colors.red[3],
colorMuted: baseTheme.colors.gray[4]
};
};
{
"name": "@cloudflare/component-text",
"description": "Cloudflare Text Component",
"version": "1.0.6",
"version": "1.0.7",
"main": "lib/index.js",

@@ -15,3 +15,3 @@ "module": "es/index.js",

"dependencies": {
"@cloudflare/style-container": "^1.0.6",
"@cloudflare/style-container": "^1.0.7",
"capitalize": "^1.0.0",

@@ -18,0 +18,0 @@ "prop-types": "^15.6.0"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc