@cloudflare/component-text 2.3.61 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +816 -2616
- package/es/Text.js +30 -26
- package/lib/Text.js +14 -8
- package/package.json +8 -8
package/es/Text.js
CHANGED
|
@@ -1,56 +1,60 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { createStyledComponent } from '@cloudflare/style-container';
|
|
4
|
-
|
|
4
|
+
var fontSizes = {
|
|
5
5
|
normal: 3,
|
|
6
6
|
small: 2
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
var lineHeights = {
|
|
9
9
|
small: 1.25
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
var colors = {
|
|
12
12
|
info: 'blue.4',
|
|
13
13
|
success: 'green.5',
|
|
14
14
|
warning: 'orange.6',
|
|
15
15
|
error: 'red.3',
|
|
16
16
|
muted: 'gray.4'
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
var fontWeights = {
|
|
19
19
|
normal: 400,
|
|
20
20
|
bold: 700,
|
|
21
21
|
'semi-bold': 600
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
var textAlign = {
|
|
24
24
|
start: 'left',
|
|
25
25
|
center: 'center',
|
|
26
26
|
justify: 'justify',
|
|
27
27
|
end: 'right'
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
textTransform: textCase
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
var styles = _ref => {
|
|
31
|
+
var {
|
|
32
|
+
size,
|
|
33
|
+
weight,
|
|
34
|
+
align,
|
|
35
|
+
type,
|
|
36
|
+
case: textCase
|
|
37
|
+
} = _ref;
|
|
38
|
+
return {
|
|
39
|
+
color: type && colors[type],
|
|
40
|
+
lineHeight: size && lineHeights[size],
|
|
41
|
+
fontSize: size && fontSizes[size],
|
|
42
|
+
fontWeight: weight && fontWeights[weight],
|
|
43
|
+
textAlign: align && textAlign[align],
|
|
44
|
+
textTransform: textCase,
|
|
45
|
+
'&:first-letter': {
|
|
46
|
+
textTransform: textCase && textCase === 'titlecase' && 'capitalize'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
47
50
|
|
|
48
51
|
class Text extends React.Component {
|
|
49
52
|
render() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
var {
|
|
54
|
+
className,
|
|
55
|
+
role,
|
|
56
|
+
children
|
|
57
|
+
} = this.props;
|
|
54
58
|
return /*#__PURE__*/React.createElement("div", {
|
|
55
59
|
className: className,
|
|
56
60
|
role: role
|
package/lib/Text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -19,17 +19,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
19
19
|
|
|
20
20
|
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); } }
|
|
21
21
|
|
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
|
+
|
|
28
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
27
29
|
|
|
28
|
-
function
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
29
31
|
|
|
30
|
-
function
|
|
32
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
31
33
|
|
|
32
|
-
function
|
|
34
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
|
+
|
|
36
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
37
|
|
|
34
38
|
var fontSizes = {
|
|
35
39
|
normal: 3,
|
|
@@ -79,10 +83,12 @@ var styles = function styles(_ref) {
|
|
|
79
83
|
var Text = /*#__PURE__*/function (_React$Component) {
|
|
80
84
|
_inherits(Text, _React$Component);
|
|
81
85
|
|
|
86
|
+
var _super = _createSuper(Text);
|
|
87
|
+
|
|
82
88
|
function Text() {
|
|
83
89
|
_classCallCheck(this, Text);
|
|
84
90
|
|
|
85
|
-
return
|
|
91
|
+
return _super.apply(this, arguments);
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
_createClass(Text, [{
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/component-text",
|
|
3
3
|
"description": "Cloudflare Text Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"author": "James Kyle <jkyle@cloudflare.com>",
|
|
8
8
|
"license": "BSD-3-Clause",
|
|
9
9
|
"publishConfig": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"access": "public",
|
|
11
|
+
"main": "lib/index.js",
|
|
12
|
+
"module": "es/index.js"
|
|
12
13
|
},
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"@cloudflare/
|
|
15
|
-
"@cloudflare/types": "^6.15.14",
|
|
15
|
+
"@cloudflare/types": "^6.15.15",
|
|
16
16
|
"prop-types": "^15.6.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
+
"@cloudflare/style-container": "^7.10.0",
|
|
19
20
|
"react": "^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"
|
|
20
21
|
},
|
|
21
22
|
"stratus": {
|
|
@@ -27,6 +28,5 @@
|
|
|
27
28
|
"test": "stratus test",
|
|
28
29
|
"test-coverage": "stratus test --coverage",
|
|
29
30
|
"test-watch": "stratus test --watch"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
31
|
+
}
|
|
32
|
+
}
|