@instructure/ui-text 8.8.1-snapshot.8 → 8.9.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 +6 -0
- package/es/Text/index.js +13 -36
- package/es/Text/props.js +46 -0
- package/lib/Text/index.js +13 -36
- package/lib/Text/props.js +57 -0
- package/package.json +9 -10
- package/src/Text/index.tsx +8 -59
- package/src/Text/{types.ts → props.ts} +66 -6
- package/src/Text/styles.ts +1 -1
- package/src/index.ts +1 -1
- package/types/Text/index.d.ts +27 -29
- package/types/Text/index.d.ts.map +1 -1
- package/types/Text/{types.d.ts → props.d.ts} +13 -7
- package/types/Text/props.d.ts.map +1 -0
- package/types/Text/styles.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/LICENSE.md +0 -27
- package/es/Text/types.js +0 -1
- package/lib/Text/types.js +0 -1
- package/types/Text/types.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
|
|
11
|
+
|
|
6
12
|
# [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @instructure/ui-text
|
package/es/Text/index.js
CHANGED
|
@@ -26,70 +26,47 @@ var _dec, _class, _class2, _temp;
|
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import { Component } from 'react';
|
|
29
|
-
import PropTypes from 'prop-types';
|
|
30
29
|
import { passthroughProps, getElementType } from '@instructure/ui-react-utils';
|
|
31
30
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
32
31
|
import generateStyle from './styles';
|
|
33
32
|
import generateComponentTheme from './theme';
|
|
34
|
-
|
|
33
|
+
import { allowedProps, propTypes } from './props';
|
|
35
34
|
/**
|
|
36
35
|
---
|
|
37
36
|
category: components
|
|
38
37
|
---
|
|
39
38
|
**/
|
|
39
|
+
|
|
40
40
|
let Text = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Text extends Component {
|
|
41
41
|
componentDidMount() {
|
|
42
|
-
|
|
42
|
+
var _this$props$makeStyle, _this$props;
|
|
43
|
+
|
|
44
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
46
|
-
|
|
48
|
+
var _this$props$makeStyle2, _this$props2;
|
|
49
|
+
|
|
50
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
render() {
|
|
54
|
+
var _this$props$styles;
|
|
55
|
+
|
|
50
56
|
const children = this.props.children;
|
|
51
57
|
const ElementType = getElementType(Text, this.props);
|
|
52
58
|
return jsx(ElementType, Object.assign({}, passthroughProps(this.props), {
|
|
53
|
-
css: this.props.styles.text,
|
|
59
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.text,
|
|
54
60
|
ref: this.props.elementRef
|
|
55
61
|
}), children);
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
}, _class2.displayName = "Text", _class2.componentId = 'Text', _class2.propTypes = {
|
|
59
|
-
/**
|
|
60
|
-
* the element type to render as
|
|
61
|
-
*/
|
|
62
|
-
as: PropTypes.elementType,
|
|
63
|
-
children: PropTypes.node,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Color of the text
|
|
67
|
-
*/
|
|
68
|
-
color: PropTypes.oneOf(['primary', 'secondary', 'brand', 'success', 'warning', 'danger', 'alert', 'primary-inverse', 'secondary-inverse']),
|
|
69
|
-
elementRef: PropTypes.func,
|
|
70
|
-
fontStyle: PropTypes.oneOf(['italic', 'normal']),
|
|
71
|
-
letterSpacing: PropTypes.oneOf(['normal', 'condensed', 'expanded']),
|
|
72
|
-
lineHeight: PropTypes.oneOf(['default', 'fit', 'condensed', 'double']),
|
|
73
|
-
size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
|
|
74
|
-
transform: PropTypes.oneOf(['none', 'capitalize', 'uppercase', 'lowercase']),
|
|
75
|
-
weight: PropTypes.oneOf(['normal', 'light', 'bold']),
|
|
76
|
-
wrap: PropTypes.oneOf(['normal', 'break-word']),
|
|
77
|
-
// eslint-disable-next-line react/require-default-props
|
|
78
|
-
makeStyles: PropTypes.func,
|
|
79
|
-
// eslint-disable-next-line react/require-default-props
|
|
80
|
-
styles: PropTypes.object
|
|
81
|
-
}, _class2.defaultProps = {
|
|
64
|
+
}, _class2.displayName = "Text", _class2.componentId = 'Text', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
82
65
|
as: 'span',
|
|
83
66
|
wrap: 'normal',
|
|
84
67
|
size: 'medium',
|
|
85
68
|
letterSpacing: 'normal',
|
|
86
|
-
children: null
|
|
87
|
-
elementRef: void 0,
|
|
88
|
-
color: void 0,
|
|
89
|
-
transform: void 0,
|
|
90
|
-
lineHeight: void 0,
|
|
91
|
-
fontStyle: void 0,
|
|
92
|
-
weight: void 0
|
|
69
|
+
children: null
|
|
93
70
|
}, _temp)) || _class);
|
|
94
71
|
export default Text;
|
|
95
72
|
export { Text };
|
package/es/Text/props.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
const propTypes = {
|
|
26
|
+
/**
|
|
27
|
+
* the element type to render as
|
|
28
|
+
*/
|
|
29
|
+
as: PropTypes.elementType,
|
|
30
|
+
children: PropTypes.node,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Color of the text
|
|
34
|
+
*/
|
|
35
|
+
color: PropTypes.oneOf(['primary', 'secondary', 'brand', 'success', 'warning', 'danger', 'alert', 'primary-inverse', 'secondary-inverse']),
|
|
36
|
+
elementRef: PropTypes.func,
|
|
37
|
+
fontStyle: PropTypes.oneOf(['italic', 'normal']),
|
|
38
|
+
letterSpacing: PropTypes.oneOf(['normal', 'condensed', 'expanded']),
|
|
39
|
+
lineHeight: PropTypes.oneOf(['default', 'fit', 'condensed', 'double']),
|
|
40
|
+
size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
|
|
41
|
+
transform: PropTypes.oneOf(['none', 'capitalize', 'uppercase', 'lowercase']),
|
|
42
|
+
weight: PropTypes.oneOf(['normal', 'light', 'bold']),
|
|
43
|
+
wrap: PropTypes.oneOf(['normal', 'break-word'])
|
|
44
|
+
};
|
|
45
|
+
const allowedProps = ['as', 'children', 'color', 'elementRef', 'fontStyle', 'letterSpacing', 'lineHeight', 'size', 'transform', 'weight', 'wrap'];
|
|
46
|
+
export { propTypes, allowedProps };
|
package/lib/Text/index.js
CHANGED
|
@@ -9,8 +9,6 @@ exports.Text = exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
15
13
|
|
|
16
14
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
@@ -21,6 +19,8 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
21
19
|
|
|
22
20
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
23
21
|
|
|
22
|
+
var _props = require("./props");
|
|
23
|
+
|
|
24
24
|
var _dec, _class, _class2, _temp;
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -30,57 +30,34 @@ category: components
|
|
|
30
30
|
**/
|
|
31
31
|
let Text = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Text extends _react.Component {
|
|
32
32
|
componentDidMount() {
|
|
33
|
-
|
|
33
|
+
var _this$props$makeStyle, _this$props;
|
|
34
|
+
|
|
35
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
37
|
-
|
|
39
|
+
var _this$props$makeStyle2, _this$props2;
|
|
40
|
+
|
|
41
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
render() {
|
|
45
|
+
var _this$props$styles;
|
|
46
|
+
|
|
41
47
|
const children = this.props.children;
|
|
42
48
|
const ElementType = (0, _getElementType.getElementType)(Text, this.props);
|
|
43
49
|
return (0, _emotion.jsx)(ElementType, Object.assign({}, (0, _passthroughProps.passthroughProps)(this.props), {
|
|
44
|
-
css: this.props.styles.text,
|
|
50
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.text,
|
|
45
51
|
ref: this.props.elementRef
|
|
46
52
|
}), children);
|
|
47
53
|
}
|
|
48
54
|
|
|
49
|
-
}, _class2.displayName = "Text", _class2.componentId = 'Text', _class2.propTypes = {
|
|
50
|
-
/**
|
|
51
|
-
* the element type to render as
|
|
52
|
-
*/
|
|
53
|
-
as: _propTypes.default.elementType,
|
|
54
|
-
children: _propTypes.default.node,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Color of the text
|
|
58
|
-
*/
|
|
59
|
-
color: _propTypes.default.oneOf(['primary', 'secondary', 'brand', 'success', 'warning', 'danger', 'alert', 'primary-inverse', 'secondary-inverse']),
|
|
60
|
-
elementRef: _propTypes.default.func,
|
|
61
|
-
fontStyle: _propTypes.default.oneOf(['italic', 'normal']),
|
|
62
|
-
letterSpacing: _propTypes.default.oneOf(['normal', 'condensed', 'expanded']),
|
|
63
|
-
lineHeight: _propTypes.default.oneOf(['default', 'fit', 'condensed', 'double']),
|
|
64
|
-
size: _propTypes.default.oneOf(['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
|
|
65
|
-
transform: _propTypes.default.oneOf(['none', 'capitalize', 'uppercase', 'lowercase']),
|
|
66
|
-
weight: _propTypes.default.oneOf(['normal', 'light', 'bold']),
|
|
67
|
-
wrap: _propTypes.default.oneOf(['normal', 'break-word']),
|
|
68
|
-
// eslint-disable-next-line react/require-default-props
|
|
69
|
-
makeStyles: _propTypes.default.func,
|
|
70
|
-
// eslint-disable-next-line react/require-default-props
|
|
71
|
-
styles: _propTypes.default.object
|
|
72
|
-
}, _class2.defaultProps = {
|
|
55
|
+
}, _class2.displayName = "Text", _class2.componentId = 'Text', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
73
56
|
as: 'span',
|
|
74
57
|
wrap: 'normal',
|
|
75
58
|
size: 'medium',
|
|
76
59
|
letterSpacing: 'normal',
|
|
77
|
-
children: null
|
|
78
|
-
elementRef: void 0,
|
|
79
|
-
color: void 0,
|
|
80
|
-
transform: void 0,
|
|
81
|
-
lineHeight: void 0,
|
|
82
|
-
fontStyle: void 0,
|
|
83
|
-
weight: void 0
|
|
60
|
+
children: null
|
|
84
61
|
}, _temp)) || _class);
|
|
85
62
|
exports.Text = Text;
|
|
86
63
|
var _default = Text;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* The MIT License (MIT)
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
16
|
+
*
|
|
17
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
* in the Software without restriction, including without limitation the rights
|
|
20
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
* furnished to do so, subject to the following conditions:
|
|
23
|
+
*
|
|
24
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
* copies or substantial portions of the Software.
|
|
26
|
+
*
|
|
27
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
* SOFTWARE.
|
|
34
|
+
*/
|
|
35
|
+
const propTypes = {
|
|
36
|
+
/**
|
|
37
|
+
* the element type to render as
|
|
38
|
+
*/
|
|
39
|
+
as: _propTypes.default.elementType,
|
|
40
|
+
children: _propTypes.default.node,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Color of the text
|
|
44
|
+
*/
|
|
45
|
+
color: _propTypes.default.oneOf(['primary', 'secondary', 'brand', 'success', 'warning', 'danger', 'alert', 'primary-inverse', 'secondary-inverse']),
|
|
46
|
+
elementRef: _propTypes.default.func,
|
|
47
|
+
fontStyle: _propTypes.default.oneOf(['italic', 'normal']),
|
|
48
|
+
letterSpacing: _propTypes.default.oneOf(['normal', 'condensed', 'expanded']),
|
|
49
|
+
lineHeight: _propTypes.default.oneOf(['default', 'fit', 'condensed', 'double']),
|
|
50
|
+
size: _propTypes.default.oneOf(['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
|
|
51
|
+
transform: _propTypes.default.oneOf(['none', 'capitalize', 'uppercase', 'lowercase']),
|
|
52
|
+
weight: _propTypes.default.oneOf(['normal', 'light', 'bold']),
|
|
53
|
+
wrap: _propTypes.default.oneOf(['normal', 'break-word'])
|
|
54
|
+
};
|
|
55
|
+
exports.propTypes = propTypes;
|
|
56
|
+
const allowedProps = ['as', 'children', 'color', 'elementRef', 'fontStyle', 'letterSpacing', 'lineHeight', 'size', 'transform', 'weight', 'wrap'];
|
|
57
|
+
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-text",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "A component for styling textual content",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.
|
|
29
|
-
"@instructure/emotion": "8.
|
|
30
|
-
"@instructure/shared-types": "8.
|
|
31
|
-
"@instructure/ui-react-utils": "8.
|
|
28
|
+
"@instructure/console": "8.9.0",
|
|
29
|
+
"@instructure/emotion": "8.9.0",
|
|
30
|
+
"@instructure/shared-types": "8.9.0",
|
|
31
|
+
"@instructure/ui-react-utils": "8.9.0",
|
|
32
32
|
"prop-types": "^15"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@instructure/ui-babel-preset": "8.
|
|
36
|
-
"@instructure/ui-test-utils": "8.
|
|
37
|
-
"@instructure/ui-themes": "8.
|
|
35
|
+
"@instructure/ui-babel-preset": "8.9.0",
|
|
36
|
+
"@instructure/ui-test-utils": "8.9.0",
|
|
37
|
+
"@instructure/ui-themes": "8.9.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=16.8 <=17"
|
|
@@ -42,6 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"sideEffects": false
|
|
46
|
-
"gitHead": "7b83164f4c5872f3a217e010563f59bf584ae4fc"
|
|
45
|
+
"sideEffects": false
|
|
47
46
|
}
|
package/src/Text/index.tsx
CHANGED
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
26
|
import { Component } from 'react'
|
|
27
|
-
import PropTypes from 'prop-types'
|
|
28
27
|
|
|
29
28
|
import { passthroughProps, getElementType } from '@instructure/ui-react-utils'
|
|
30
29
|
|
|
31
30
|
import { withStyle, jsx } from '@instructure/emotion'
|
|
32
31
|
import generateStyle from './styles'
|
|
33
32
|
import generateComponentTheme from './theme'
|
|
34
|
-
import { TextProps } from './
|
|
33
|
+
import type { TextProps } from './props'
|
|
34
|
+
import { allowedProps, propTypes } from './props'
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
---
|
|
@@ -42,75 +42,24 @@ category: components
|
|
|
42
42
|
class Text extends Component<TextProps> {
|
|
43
43
|
static readonly componentId = 'Text'
|
|
44
44
|
|
|
45
|
-
static
|
|
46
|
-
|
|
47
|
-
* the element type to render as
|
|
48
|
-
*/
|
|
49
|
-
as: PropTypes.elementType,
|
|
50
|
-
children: PropTypes.node,
|
|
51
|
-
/**
|
|
52
|
-
* Color of the text
|
|
53
|
-
*/
|
|
54
|
-
color: PropTypes.oneOf([
|
|
55
|
-
'primary',
|
|
56
|
-
'secondary',
|
|
57
|
-
'brand',
|
|
58
|
-
'success',
|
|
59
|
-
'warning',
|
|
60
|
-
'danger',
|
|
61
|
-
'alert',
|
|
62
|
-
'primary-inverse',
|
|
63
|
-
'secondary-inverse'
|
|
64
|
-
]),
|
|
65
|
-
elementRef: PropTypes.func,
|
|
66
|
-
fontStyle: PropTypes.oneOf(['italic', 'normal']),
|
|
67
|
-
letterSpacing: PropTypes.oneOf(['normal', 'condensed', 'expanded']),
|
|
68
|
-
lineHeight: PropTypes.oneOf(['default', 'fit', 'condensed', 'double']),
|
|
69
|
-
size: PropTypes.oneOf([
|
|
70
|
-
'x-small',
|
|
71
|
-
'small',
|
|
72
|
-
'medium',
|
|
73
|
-
'large',
|
|
74
|
-
'x-large',
|
|
75
|
-
'xx-large'
|
|
76
|
-
]),
|
|
77
|
-
transform: PropTypes.oneOf([
|
|
78
|
-
'none',
|
|
79
|
-
'capitalize',
|
|
80
|
-
'uppercase',
|
|
81
|
-
'lowercase'
|
|
82
|
-
]),
|
|
83
|
-
weight: PropTypes.oneOf(['normal', 'light', 'bold']),
|
|
84
|
-
wrap: PropTypes.oneOf(['normal', 'break-word']),
|
|
85
|
-
// eslint-disable-next-line react/require-default-props
|
|
86
|
-
makeStyles: PropTypes.func,
|
|
87
|
-
// eslint-disable-next-line react/require-default-props
|
|
88
|
-
styles: PropTypes.object
|
|
89
|
-
} as const
|
|
45
|
+
static allowedProps = allowedProps
|
|
46
|
+
static propTypes = propTypes
|
|
90
47
|
|
|
91
48
|
static defaultProps = {
|
|
92
49
|
as: 'span',
|
|
93
50
|
wrap: 'normal',
|
|
94
51
|
size: 'medium',
|
|
95
52
|
letterSpacing: 'normal',
|
|
96
|
-
children: null
|
|
97
|
-
elementRef: undefined,
|
|
98
|
-
color: undefined,
|
|
99
|
-
transform: undefined,
|
|
100
|
-
lineHeight: undefined,
|
|
101
|
-
fontStyle: undefined,
|
|
102
|
-
weight: undefined
|
|
53
|
+
children: null
|
|
103
54
|
} as const
|
|
104
55
|
|
|
105
56
|
componentDidMount() {
|
|
106
|
-
|
|
107
|
-
this.props.makeStyles()
|
|
57
|
+
this.props.makeStyles?.()
|
|
108
58
|
}
|
|
109
59
|
|
|
110
60
|
// @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
|
|
111
61
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
112
|
-
|
|
113
|
-
this.props.makeStyles()
|
|
62
|
+
this.props.makeStyles?.()
|
|
114
63
|
}
|
|
115
64
|
|
|
116
65
|
render() {
|
|
@@ -122,7 +71,7 @@ class Text extends Component<TextProps> {
|
|
|
122
71
|
<ElementType
|
|
123
72
|
//@ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
|
|
124
73
|
{...passthroughProps(this.props)}
|
|
125
|
-
css={this.props.styles
|
|
74
|
+
css={this.props.styles?.text}
|
|
126
75
|
ref={this.props.elementRef}
|
|
127
76
|
>
|
|
128
77
|
{children}
|
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
import React from 'react'
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
24
26
|
|
|
25
|
-
import type {
|
|
26
|
-
import {
|
|
27
|
+
import type { PropValidators, AsElementType } from '@instructure/shared-types'
|
|
28
|
+
import type { WithStyleProps } from '@instructure/emotion'
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
type TextOwnProps = {
|
|
29
31
|
as?: AsElementType
|
|
30
32
|
color?:
|
|
31
33
|
| 'primary'
|
|
@@ -45,7 +47,65 @@ export type TextProps = {
|
|
|
45
47
|
transform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase'
|
|
46
48
|
weight?: 'normal' | 'light' | 'bold'
|
|
47
49
|
wrap?: 'normal' | 'break-word'
|
|
48
|
-
|
|
49
|
-
styles?: any
|
|
50
|
-
children?: ReactNode
|
|
50
|
+
children?: React.ReactNode
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
type PropKeys = keyof TextOwnProps
|
|
54
|
+
|
|
55
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
56
|
+
|
|
57
|
+
type TextProps = TextOwnProps & WithStyleProps
|
|
58
|
+
|
|
59
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
60
|
+
/**
|
|
61
|
+
* the element type to render as
|
|
62
|
+
*/
|
|
63
|
+
as: PropTypes.elementType,
|
|
64
|
+
children: PropTypes.node,
|
|
65
|
+
/**
|
|
66
|
+
* Color of the text
|
|
67
|
+
*/
|
|
68
|
+
color: PropTypes.oneOf([
|
|
69
|
+
'primary',
|
|
70
|
+
'secondary',
|
|
71
|
+
'brand',
|
|
72
|
+
'success',
|
|
73
|
+
'warning',
|
|
74
|
+
'danger',
|
|
75
|
+
'alert',
|
|
76
|
+
'primary-inverse',
|
|
77
|
+
'secondary-inverse'
|
|
78
|
+
]),
|
|
79
|
+
elementRef: PropTypes.func,
|
|
80
|
+
fontStyle: PropTypes.oneOf(['italic', 'normal']),
|
|
81
|
+
letterSpacing: PropTypes.oneOf(['normal', 'condensed', 'expanded']),
|
|
82
|
+
lineHeight: PropTypes.oneOf(['default', 'fit', 'condensed', 'double']),
|
|
83
|
+
size: PropTypes.oneOf([
|
|
84
|
+
'x-small',
|
|
85
|
+
'small',
|
|
86
|
+
'medium',
|
|
87
|
+
'large',
|
|
88
|
+
'x-large',
|
|
89
|
+
'xx-large'
|
|
90
|
+
]),
|
|
91
|
+
transform: PropTypes.oneOf(['none', 'capitalize', 'uppercase', 'lowercase']),
|
|
92
|
+
weight: PropTypes.oneOf(['normal', 'light', 'bold']),
|
|
93
|
+
wrap: PropTypes.oneOf(['normal', 'break-word'])
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const allowedProps: AllowedPropKeys = [
|
|
97
|
+
'as',
|
|
98
|
+
'children',
|
|
99
|
+
'color',
|
|
100
|
+
'elementRef',
|
|
101
|
+
'fontStyle',
|
|
102
|
+
'letterSpacing',
|
|
103
|
+
'lineHeight',
|
|
104
|
+
'size',
|
|
105
|
+
'transform',
|
|
106
|
+
'weight',
|
|
107
|
+
'wrap'
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
export type { TextProps }
|
|
111
|
+
export { propTypes, allowedProps }
|
package/src/Text/styles.ts
CHANGED
package/src/index.ts
CHANGED
package/types/Text/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@instructure/emotion';
|
|
5
|
-
import { TextProps } from './
|
|
4
|
+
import type { TextProps } from './props';
|
|
6
5
|
/**
|
|
7
6
|
---
|
|
8
7
|
category: components
|
|
@@ -10,39 +9,38 @@ category: components
|
|
|
10
9
|
**/
|
|
11
10
|
declare class Text extends Component<TextProps> {
|
|
12
11
|
static readonly componentId = "Text";
|
|
13
|
-
static
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
static allowedProps: readonly (keyof {
|
|
13
|
+
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
14
|
+
color?: "primary" | "secondary" | "brand" | "success" | "warning" | "danger" | "alert" | "primary-inverse" | "secondary-inverse" | undefined;
|
|
15
|
+
elementRef?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
fontStyle?: "italic" | "normal" | undefined;
|
|
17
|
+
letterSpacing?: "normal" | "condensed" | "expanded" | undefined;
|
|
18
|
+
lineHeight?: "condensed" | "default" | "fit" | "double" | undefined;
|
|
19
|
+
size?: "small" | "x-small" | "medium" | "large" | "x-large" | "xx-large" | undefined;
|
|
20
|
+
transform?: "none" | "capitalize" | "uppercase" | "lowercase" | undefined;
|
|
21
|
+
weight?: "normal" | "light" | "bold" | undefined;
|
|
22
|
+
wrap?: "normal" | "break-word" | undefined;
|
|
23
|
+
children?: import("react").ReactNode;
|
|
24
|
+
})[];
|
|
25
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
26
|
+
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
27
|
+
color?: "primary" | "secondary" | "brand" | "success" | "warning" | "danger" | "alert" | "primary-inverse" | "secondary-inverse" | undefined;
|
|
28
|
+
elementRef?: ((...args: any[]) => any) | undefined;
|
|
29
|
+
fontStyle?: "italic" | "normal" | undefined;
|
|
30
|
+
letterSpacing?: "normal" | "condensed" | "expanded" | undefined;
|
|
31
|
+
lineHeight?: "condensed" | "default" | "fit" | "double" | undefined;
|
|
32
|
+
size?: "small" | "x-small" | "medium" | "large" | "x-large" | "xx-large" | undefined;
|
|
33
|
+
transform?: "none" | "capitalize" | "uppercase" | "lowercase" | undefined;
|
|
34
|
+
weight?: "normal" | "light" | "bold" | undefined;
|
|
35
|
+
wrap?: "normal" | "break-word" | undefined;
|
|
36
|
+
children?: import("react").ReactNode;
|
|
37
|
+
}>;
|
|
34
38
|
static defaultProps: {
|
|
35
39
|
readonly as: "span";
|
|
36
40
|
readonly wrap: "normal";
|
|
37
41
|
readonly size: "medium";
|
|
38
42
|
readonly letterSpacing: "normal";
|
|
39
43
|
readonly children: null;
|
|
40
|
-
readonly elementRef: undefined;
|
|
41
|
-
readonly color: undefined;
|
|
42
|
-
readonly transform: undefined;
|
|
43
|
-
readonly lineHeight: undefined;
|
|
44
|
-
readonly fontStyle: undefined;
|
|
45
|
-
readonly weight: undefined;
|
|
46
44
|
};
|
|
47
45
|
componentDidMount(): void;
|
|
48
46
|
componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Text/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Text/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxC;;;;GAIG;AACH,cACM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,YAAY;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;MAMT;IAEV,iBAAiB;IAKjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAIjD,MAAM;CAgBP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AsElementType } from '@instructure/shared-types';
|
|
3
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PropValidators, AsElementType } from '@instructure/shared-types';
|
|
3
|
+
import type { WithStyleProps } from '@instructure/emotion';
|
|
4
|
+
declare type TextOwnProps = {
|
|
4
5
|
as?: AsElementType;
|
|
5
6
|
color?: 'primary' | 'secondary' | 'brand' | 'success' | 'warning' | 'danger' | 'alert' | 'primary-inverse' | 'secondary-inverse';
|
|
6
7
|
elementRef?: (...args: any[]) => any;
|
|
@@ -11,8 +12,13 @@ export declare type TextProps = {
|
|
|
11
12
|
transform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase';
|
|
12
13
|
weight?: 'normal' | 'light' | 'bold';
|
|
13
14
|
wrap?: 'normal' | 'break-word';
|
|
14
|
-
|
|
15
|
-
styles?: any;
|
|
16
|
-
children?: ReactNode;
|
|
15
|
+
children?: React.ReactNode;
|
|
17
16
|
};
|
|
18
|
-
|
|
17
|
+
declare type PropKeys = keyof TextOwnProps;
|
|
18
|
+
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
19
|
+
declare type TextProps = TextOwnProps & WithStyleProps;
|
|
20
|
+
declare const propTypes: PropValidators<PropKeys>;
|
|
21
|
+
declare const allowedProps: AllowedPropKeys;
|
|
22
|
+
export type { TextProps };
|
|
23
|
+
export { propTypes, allowedProps };
|
|
24
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Text/props.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,aAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,KAAK,CAAC,EACF,SAAS,GACT,WAAW,GACX,OAAO,GACP,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,GACP,iBAAiB,GACjB,mBAAmB,CAAA;IACvB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC/B,aAAa,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAA;IACnD,UAAU,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,CAAA;IACvD,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAA;IACxE,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,CAAA;IAC7D,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACpC,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,YAAY,CAAA;AAElC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,SAAS,GAAG,YAAY,GAAG,cAAc,CAAA;AAE9C,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAmCvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAYnB,CAAA;AAED,YAAY,EAAE,SAAS,EAAE,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
package/types/Text/styles.d.ts
CHANGED
package/types/index.d.ts
CHANGED
package/LICENSE.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: The MIT License (MIT)
|
|
3
|
-
category: Getting Started
|
|
4
|
-
order: 9
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# The MIT License (MIT)
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
-
|
|
11
|
-
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions.**
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|
package/es/Text/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/Text/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Text/types.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,oBAAY,SAAS,GAAG;IACtB,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,KAAK,CAAC,EACF,SAAS,GACT,WAAW,GACX,OAAO,GACP,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,GACP,iBAAiB,GACjB,mBAAmB,CAAA;IACvB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC/B,aAAa,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAA;IACnD,UAAU,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,CAAA;IACvD,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAA;IACxE,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,CAAA;IAC7D,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACpC,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IAC9B,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA"}
|