@instructure/ui-byline 8.8.1-snapshot.3 → 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/Byline/index.js +12 -49
- package/{src/Byline/types.ts → es/Byline/props.js} +32 -11
- package/lib/Byline/index.js +12 -49
- package/lib/Byline/props.js +69 -0
- package/package.json +11 -12
- package/src/Byline/index.tsx +14 -46
- package/src/Byline/props.ts +87 -0
- package/src/Byline/styles.ts +1 -1
- package/src/index.ts +1 -1
- package/types/Byline/index.d.ts +19 -35
- package/types/Byline/index.d.ts.map +1 -1
- package/types/Byline/props.d.ts +20 -0
- package/types/Byline/props.d.ts.map +1 -0
- package/types/Byline/styles.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/LICENSE.md +0 -27
- package/es/Byline/types.js +0 -1
- package/lib/Byline/types.js +0 -1
- package/types/Byline/types.d.ts +0 -13
- package/types/Byline/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-byline
|
package/es/Byline/index.js
CHANGED
|
@@ -26,12 +26,12 @@ 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 { omitProps } from '@instructure/ui-react-utils';
|
|
31
30
|
import { View } from '@instructure/ui-view';
|
|
32
|
-
import { withStyle, jsx
|
|
31
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
33
32
|
import generateStyle from './styles';
|
|
34
33
|
import generateComponentTheme from './theme';
|
|
34
|
+
import { propTypes, allowedProps } from './props';
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
---
|
|
@@ -48,65 +48,28 @@ let Byline = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_cla
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
render() {
|
|
51
|
+
var _this$props$styles, _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
52
|
+
|
|
51
53
|
const passthroughProps = View.omitViewProps(omitProps(this.props, Byline.propTypes), Byline);
|
|
52
54
|
return jsx(View, Object.assign({}, passthroughProps, {
|
|
53
55
|
elementRef: this.props.elementRef,
|
|
54
|
-
css: this.props.styles.byline,
|
|
56
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.byline,
|
|
55
57
|
as: "figure",
|
|
56
58
|
margin: this.props.margin,
|
|
57
|
-
maxWidth: this.props.styles.maxWidth
|
|
59
|
+
maxWidth: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.maxWidth
|
|
58
60
|
}), jsx("div", {
|
|
59
|
-
css: this.props.styles.figure
|
|
61
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.figure
|
|
60
62
|
}, this.props.children), jsx("figcaption", {
|
|
61
|
-
css: this.props.styles.caption
|
|
63
|
+
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.caption
|
|
62
64
|
}, this.props.title && jsx("span", {
|
|
63
|
-
css: this.props.styles.title
|
|
65
|
+
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.title
|
|
64
66
|
}, this.props.title), this.props.description && jsx("div", {
|
|
65
|
-
css: this.props.styles.description
|
|
67
|
+
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.description
|
|
66
68
|
}, this.props.description)));
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
}, _class2.displayName = "Byline", _class2.componentId = 'Byline', _class2.propTypes = {
|
|
70
|
-
|
|
71
|
-
makeStyles: PropTypes.func,
|
|
72
|
-
// eslint-disable-next-line react/require-default-props
|
|
73
|
-
styles: PropTypes.object,
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* the Byline visual/object
|
|
77
|
-
*/
|
|
78
|
-
children: PropTypes.node.isRequired,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* the Byline title
|
|
82
|
-
*/
|
|
83
|
-
title: PropTypes.node,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* the Byline description
|
|
87
|
-
*/
|
|
88
|
-
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* how should the title and description align
|
|
92
|
-
*/
|
|
93
|
-
alignContent: PropTypes.oneOf(['top', 'center']),
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
97
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
98
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
99
|
-
*/
|
|
100
|
-
margin: ThemeablePropTypes.spacing,
|
|
101
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
102
|
-
elementRef: PropTypes.func
|
|
103
|
-
}, _class2.defaultProps = {
|
|
104
|
-
alignContent: 'center',
|
|
105
|
-
elementRef: void 0,
|
|
106
|
-
margin: void 0,
|
|
107
|
-
title: void 0,
|
|
108
|
-
size: void 0,
|
|
109
|
-
description: void 0
|
|
71
|
+
}, _class2.displayName = "Byline", _class2.componentId = 'Byline', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
72
|
+
alignContent: 'center'
|
|
110
73
|
}, _temp)) || _class);
|
|
111
74
|
export default Byline;
|
|
112
75
|
export { Byline };
|
|
@@ -21,16 +21,37 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
25
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
/**
|
|
28
|
+
* the Byline visual/object
|
|
29
|
+
*/
|
|
30
|
+
children: PropTypes.node.isRequired,
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
/**
|
|
33
|
+
* the Byline title
|
|
34
|
+
*/
|
|
35
|
+
title: PropTypes.node,
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* the Byline description
|
|
39
|
+
*/
|
|
40
|
+
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* how should the title and description align
|
|
44
|
+
*/
|
|
45
|
+
alignContent: PropTypes.oneOf(['top', 'center']),
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
49
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
50
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
51
|
+
*/
|
|
52
|
+
margin: ThemeablePropTypes.spacing,
|
|
53
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
54
|
+
elementRef: PropTypes.func
|
|
55
|
+
};
|
|
56
|
+
const allowedProps = ['alignContent', 'children', 'description', 'elementRef', 'margin', 'size', 'title'];
|
|
57
|
+
export { propTypes, allowedProps };
|
package/lib/Byline/index.js
CHANGED
|
@@ -9,8 +9,6 @@ exports.Byline = 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 _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
15
13
|
|
|
16
14
|
var _View = require("@instructure/ui-view/lib/View");
|
|
@@ -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
|
/**
|
|
@@ -38,66 +38,29 @@ let Byline = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
render() {
|
|
41
|
+
var _this$props$styles, _this$props$styles2, _this$props$styles3, _this$props$styles4, _this$props$styles5, _this$props$styles6;
|
|
42
|
+
|
|
41
43
|
const passthroughProps = _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Byline.propTypes), Byline);
|
|
42
44
|
|
|
43
45
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, passthroughProps, {
|
|
44
46
|
elementRef: this.props.elementRef,
|
|
45
|
-
css: this.props.styles.byline,
|
|
47
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.byline,
|
|
46
48
|
as: "figure",
|
|
47
49
|
margin: this.props.margin,
|
|
48
|
-
maxWidth: this.props.styles.maxWidth
|
|
50
|
+
maxWidth: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.maxWidth
|
|
49
51
|
}), (0, _emotion.jsx)("div", {
|
|
50
|
-
css: this.props.styles.figure
|
|
52
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.figure
|
|
51
53
|
}, this.props.children), (0, _emotion.jsx)("figcaption", {
|
|
52
|
-
css: this.props.styles.caption
|
|
54
|
+
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.caption
|
|
53
55
|
}, this.props.title && (0, _emotion.jsx)("span", {
|
|
54
|
-
css: this.props.styles.title
|
|
56
|
+
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.title
|
|
55
57
|
}, this.props.title), this.props.description && (0, _emotion.jsx)("div", {
|
|
56
|
-
css: this.props.styles.description
|
|
58
|
+
css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.description
|
|
57
59
|
}, this.props.description)));
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
}, _class2.displayName = "Byline", _class2.componentId = 'Byline', _class2.propTypes = {
|
|
61
|
-
|
|
62
|
-
makeStyles: _propTypes.default.func,
|
|
63
|
-
// eslint-disable-next-line react/require-default-props
|
|
64
|
-
styles: _propTypes.default.object,
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* the Byline visual/object
|
|
68
|
-
*/
|
|
69
|
-
children: _propTypes.default.node.isRequired,
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* the Byline title
|
|
73
|
-
*/
|
|
74
|
-
title: _propTypes.default.node,
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* the Byline description
|
|
78
|
-
*/
|
|
79
|
-
description: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* how should the title and description align
|
|
83
|
-
*/
|
|
84
|
-
alignContent: _propTypes.default.oneOf(['top', 'center']),
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
88
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
89
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
90
|
-
*/
|
|
91
|
-
margin: _emotion.ThemeablePropTypes.spacing,
|
|
92
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
93
|
-
elementRef: _propTypes.default.func
|
|
94
|
-
}, _class2.defaultProps = {
|
|
95
|
-
alignContent: 'center',
|
|
96
|
-
elementRef: void 0,
|
|
97
|
-
margin: void 0,
|
|
98
|
-
title: void 0,
|
|
99
|
-
size: void 0,
|
|
100
|
-
description: void 0
|
|
62
|
+
}, _class2.displayName = "Byline", _class2.componentId = 'Byline', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
63
|
+
alignContent: 'center'
|
|
101
64
|
}, _temp)) || _class);
|
|
102
65
|
exports.Byline = Byline;
|
|
103
66
|
var _default = Byline;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
var _emotion = require("@instructure/emotion");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
const propTypes = {
|
|
38
|
+
/**
|
|
39
|
+
* the Byline visual/object
|
|
40
|
+
*/
|
|
41
|
+
children: _propTypes.default.node.isRequired,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* the Byline title
|
|
45
|
+
*/
|
|
46
|
+
title: _propTypes.default.node,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* the Byline description
|
|
50
|
+
*/
|
|
51
|
+
description: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* how should the title and description align
|
|
55
|
+
*/
|
|
56
|
+
alignContent: _propTypes.default.oneOf(['top', 'center']),
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
60
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
61
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
62
|
+
*/
|
|
63
|
+
margin: _emotion.ThemeablePropTypes.spacing,
|
|
64
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
65
|
+
elementRef: _propTypes.default.func
|
|
66
|
+
};
|
|
67
|
+
exports.propTypes = propTypes;
|
|
68
|
+
const allowedProps = ['alignContent', 'children', 'description', 'elementRef', 'margin', 'size', 'title'];
|
|
69
|
+
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-byline",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "A Byline component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/emotion": "8.
|
|
29
|
-
"@instructure/
|
|
30
|
-
"@instructure/ui-
|
|
31
|
-
"@instructure/ui-
|
|
28
|
+
"@instructure/emotion": "8.9.0",
|
|
29
|
+
"@instructure/shared-types": "8.9.0",
|
|
30
|
+
"@instructure/ui-react-utils": "8.9.0",
|
|
31
|
+
"@instructure/ui-testable": "8.9.0",
|
|
32
|
+
"@instructure/ui-view": "8.9.0",
|
|
32
33
|
"prop-types": "^15"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@instructure/
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-themes": "8.8.1-snapshot.3+d5d6d4cd8"
|
|
36
|
+
"@instructure/ui-babel-preset": "8.9.0",
|
|
37
|
+
"@instructure/ui-color-utils": "8.9.0",
|
|
38
|
+
"@instructure/ui-test-utils": "8.9.0",
|
|
39
|
+
"@instructure/ui-themes": "8.9.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=16.8 <=17"
|
|
@@ -44,6 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"sideEffects": false
|
|
48
|
-
"gitHead": "d5d6d4cd8f300e8635c69248f5d794c002269e08"
|
|
47
|
+
"sideEffects": false
|
|
49
48
|
}
|
package/src/Byline/index.tsx
CHANGED
|
@@ -24,16 +24,17 @@
|
|
|
24
24
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
26
|
import { Component } from 'react'
|
|
27
|
-
import PropTypes from 'prop-types'
|
|
28
27
|
|
|
29
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
30
29
|
import { View } from '@instructure/ui-view'
|
|
31
30
|
|
|
32
|
-
import { withStyle, jsx
|
|
31
|
+
import { withStyle, jsx } from '@instructure/emotion'
|
|
33
32
|
|
|
34
33
|
import generateStyle from './styles'
|
|
35
34
|
import generateComponentTheme from './theme'
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
import { propTypes, allowedProps } from './props'
|
|
37
|
+
import type { BylineProps } from './props'
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
---
|
|
@@ -45,44 +46,10 @@ category: components
|
|
|
45
46
|
class Byline extends Component<BylineProps> {
|
|
46
47
|
static readonly componentId = 'Byline'
|
|
47
48
|
|
|
48
|
-
static propTypes =
|
|
49
|
-
|
|
50
|
-
makeStyles: PropTypes.func,
|
|
51
|
-
// eslint-disable-next-line react/require-default-props
|
|
52
|
-
styles: PropTypes.object,
|
|
53
|
-
/**
|
|
54
|
-
* the Byline visual/object
|
|
55
|
-
*/
|
|
56
|
-
children: PropTypes.node.isRequired,
|
|
57
|
-
/**
|
|
58
|
-
* the Byline title
|
|
59
|
-
*/
|
|
60
|
-
title: PropTypes.node,
|
|
61
|
-
/**
|
|
62
|
-
* the Byline description
|
|
63
|
-
*/
|
|
64
|
-
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
65
|
-
/**
|
|
66
|
-
* how should the title and description align
|
|
67
|
-
*/
|
|
68
|
-
alignContent: PropTypes.oneOf(['top', 'center']),
|
|
69
|
-
/**
|
|
70
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
71
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
72
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
73
|
-
*/
|
|
74
|
-
margin: ThemeablePropTypes.spacing,
|
|
75
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
76
|
-
elementRef: PropTypes.func
|
|
77
|
-
}
|
|
78
|
-
|
|
49
|
+
static propTypes = propTypes
|
|
50
|
+
static allowedProps = allowedProps
|
|
79
51
|
static defaultProps = {
|
|
80
|
-
alignContent: 'center'
|
|
81
|
-
elementRef: undefined,
|
|
82
|
-
margin: undefined,
|
|
83
|
-
title: undefined,
|
|
84
|
-
size: undefined,
|
|
85
|
-
description: undefined
|
|
52
|
+
alignContent: 'center'
|
|
86
53
|
}
|
|
87
54
|
|
|
88
55
|
componentDidMount() {
|
|
@@ -106,18 +73,19 @@ class Byline extends Component<BylineProps> {
|
|
|
106
73
|
<View
|
|
107
74
|
{...passthroughProps}
|
|
108
75
|
elementRef={this.props.elementRef}
|
|
109
|
-
css={this.props.styles
|
|
76
|
+
css={this.props.styles?.byline}
|
|
110
77
|
as="figure"
|
|
111
78
|
margin={this.props.margin}
|
|
112
|
-
|
|
79
|
+
// @ts-expect-error TODO: fix
|
|
80
|
+
maxWidth={this.props.styles?.maxWidth}
|
|
113
81
|
>
|
|
114
|
-
<div css={this.props.styles
|
|
115
|
-
<figcaption css={this.props.styles
|
|
82
|
+
<div css={this.props.styles?.figure}>{this.props.children}</div>
|
|
83
|
+
<figcaption css={this.props.styles?.caption}>
|
|
116
84
|
{this.props.title && (
|
|
117
|
-
<span css={this.props.styles
|
|
85
|
+
<span css={this.props.styles?.title}>{this.props.title}</span>
|
|
118
86
|
)}
|
|
119
87
|
{this.props.description && (
|
|
120
|
-
<div css={this.props.styles
|
|
88
|
+
<div css={this.props.styles?.description}>
|
|
121
89
|
{this.props.description}
|
|
122
90
|
</div>
|
|
123
91
|
)}
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import { ThemeablePropTypes } from '@instructure/emotion'
|
|
29
|
+
|
|
30
|
+
import type { Spacing, WithStyleProps } from '@instructure/emotion'
|
|
31
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
32
|
+
|
|
33
|
+
type BylineOwnProps = {
|
|
34
|
+
children: React.ReactNode
|
|
35
|
+
title?: React.ReactNode
|
|
36
|
+
description?: string | React.ReactNode
|
|
37
|
+
alignContent?: 'top' | 'center'
|
|
38
|
+
margin?: Spacing
|
|
39
|
+
size?: 'small' | 'medium' | 'large'
|
|
40
|
+
elementRef?: (...args: any[]) => any
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type PropKeys = keyof BylineOwnProps
|
|
44
|
+
|
|
45
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
46
|
+
|
|
47
|
+
type BylineProps = BylineOwnProps & WithStyleProps
|
|
48
|
+
|
|
49
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
50
|
+
/**
|
|
51
|
+
* the Byline visual/object
|
|
52
|
+
*/
|
|
53
|
+
children: PropTypes.node.isRequired,
|
|
54
|
+
/**
|
|
55
|
+
* the Byline title
|
|
56
|
+
*/
|
|
57
|
+
title: PropTypes.node,
|
|
58
|
+
/**
|
|
59
|
+
* the Byline description
|
|
60
|
+
*/
|
|
61
|
+
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
62
|
+
/**
|
|
63
|
+
* how should the title and description align
|
|
64
|
+
*/
|
|
65
|
+
alignContent: PropTypes.oneOf(['top', 'center']),
|
|
66
|
+
/**
|
|
67
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
68
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
69
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
70
|
+
*/
|
|
71
|
+
margin: ThemeablePropTypes.spacing,
|
|
72
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
73
|
+
elementRef: PropTypes.func
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const allowedProps: AllowedPropKeys = [
|
|
77
|
+
'alignContent',
|
|
78
|
+
'children',
|
|
79
|
+
'description',
|
|
80
|
+
'elementRef',
|
|
81
|
+
'margin',
|
|
82
|
+
'size',
|
|
83
|
+
'title'
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
export type { BylineProps }
|
|
87
|
+
export { propTypes, allowedProps }
|
package/src/Byline/styles.ts
CHANGED
package/src/index.ts
CHANGED
package/types/Byline/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 { BylineProps } from './
|
|
4
|
+
import type { BylineProps } from './props';
|
|
6
5
|
/**
|
|
7
6
|
---
|
|
8
7
|
category: components
|
|
@@ -10,41 +9,26 @@ category: components
|
|
|
10
9
|
**/
|
|
11
10
|
declare class Byline extends Component<BylineProps> {
|
|
12
11
|
static readonly componentId = "Byline";
|
|
13
|
-
static propTypes: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
alignContent: PropTypes.Requireable<string>;
|
|
32
|
-
/**
|
|
33
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
34
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
35
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
36
|
-
*/
|
|
37
|
-
margin: (props: any, propName: any, componentName: any, location: any) => any;
|
|
38
|
-
size: PropTypes.Requireable<string>;
|
|
39
|
-
elementRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
|
-
};
|
|
12
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
13
|
+
children: import("react").ReactNode;
|
|
14
|
+
title?: import("react").ReactNode;
|
|
15
|
+
description?: import("react").ReactNode;
|
|
16
|
+
alignContent?: "top" | "center" | undefined;
|
|
17
|
+
margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
|
|
18
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
19
|
+
elementRef?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
static allowedProps: readonly (keyof {
|
|
22
|
+
children: import("react").ReactNode;
|
|
23
|
+
title?: import("react").ReactNode;
|
|
24
|
+
description?: import("react").ReactNode;
|
|
25
|
+
alignContent?: "top" | "center" | undefined;
|
|
26
|
+
margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
|
|
27
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
28
|
+
elementRef?: ((...args: any[]) => any) | undefined;
|
|
29
|
+
})[];
|
|
41
30
|
static defaultProps: {
|
|
42
31
|
alignContent: string;
|
|
43
|
-
elementRef: undefined;
|
|
44
|
-
margin: undefined;
|
|
45
|
-
title: undefined;
|
|
46
|
-
size: undefined;
|
|
47
|
-
description: undefined;
|
|
48
32
|
};
|
|
49
33
|
componentDidMount(): void;
|
|
50
34
|
componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Byline/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Byline/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;GAIG;AAEH,cACM,MAAO,SAAQ,SAAS,CAAC,WAAW,CAAC;IACzC,MAAM,CAAC,QAAQ,CAAC,WAAW,YAAW;IAEtC,MAAM,CAAC,SAAS;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;MAElB;IAED,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAKjD,MAAM;CA8BP;AAED,eAAe,MAAM,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Spacing, WithStyleProps } from '@instructure/emotion';
|
|
3
|
+
import type { PropValidators } from '@instructure/shared-types';
|
|
4
|
+
declare type BylineOwnProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
description?: string | React.ReactNode;
|
|
8
|
+
alignContent?: 'top' | 'center';
|
|
9
|
+
margin?: Spacing;
|
|
10
|
+
size?: 'small' | 'medium' | 'large';
|
|
11
|
+
elementRef?: (...args: any[]) => any;
|
|
12
|
+
};
|
|
13
|
+
declare type PropKeys = keyof BylineOwnProps;
|
|
14
|
+
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
15
|
+
declare type BylineProps = BylineOwnProps & WithStyleProps;
|
|
16
|
+
declare const propTypes: PropValidators<PropKeys>;
|
|
17
|
+
declare const allowedProps: AllowedPropKeys;
|
|
18
|
+
export type { BylineProps };
|
|
19
|
+
export { propTypes, allowedProps };
|
|
20
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Byline/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE/D,aAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;IACtC,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;CACrC,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,cAAc,CAAA;AAEpC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,WAAW,GAAG,cAAc,GAAG,cAAc,CAAA;AAElD,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAyBvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAQnB,CAAA;AAED,YAAY,EAAE,WAAW,EAAE,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
package/types/Byline/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/Byline/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/Byline/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/types/Byline/types.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { Spacing } from '@instructure/emotion';
|
|
3
|
-
export declare type BylineProps = {
|
|
4
|
-
makeStyles?: (...args: any[]) => any;
|
|
5
|
-
styles?: any;
|
|
6
|
-
title?: React.ReactNode;
|
|
7
|
-
description?: string | React.ReactNode;
|
|
8
|
-
alignContent?: 'top' | 'center';
|
|
9
|
-
margin?: Spacing;
|
|
10
|
-
size?: 'small' | 'medium' | 'large';
|
|
11
|
-
elementRef?: (...args: any[]) => any;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Byline/types.ts"],"names":[],"mappings":";AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,oBAAY,WAAW,GAAG;IACxB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;IACtC,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;CACrC,CAAA"}
|