@instructure/ui-billboard 8.14.0 → 8.14.1-snapshot.7
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/LICENSE.md +27 -0
- package/es/Billboard/index.js +25 -24
- package/es/Billboard/props.js +0 -57
- package/lib/Billboard/index.js +25 -24
- package/lib/Billboard/props.js +0 -57
- package/package.json +14 -13
- package/src/Billboard/index.tsx +10 -17
- package/src/Billboard/props.ts +44 -42
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Billboard/index.d.ts +16 -15
- package/types/Billboard/index.d.ts.map +1 -1
- package/types/Billboard/props.d.ts +52 -5
- package/types/Billboard/props.d.ts.map +1 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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/Billboard/index.js
CHANGED
|
@@ -38,6 +38,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
38
38
|
---
|
|
39
39
|
category: components
|
|
40
40
|
---
|
|
41
|
+
@tsProps
|
|
41
42
|
**/
|
|
42
43
|
let Billboard = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Billboard extends Component {
|
|
43
44
|
constructor() {
|
|
@@ -68,19 +69,23 @@ let Billboard = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
componentDidMount() {
|
|
71
|
-
|
|
72
|
+
var _this$props$makeStyle, _this$props2;
|
|
73
|
+
|
|
74
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
componentDidUpdate(
|
|
75
|
-
|
|
77
|
+
componentDidUpdate() {
|
|
78
|
+
var _this$props$makeStyle2, _this$props3;
|
|
79
|
+
|
|
80
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
renderHeading() {
|
|
79
|
-
const _this$
|
|
80
|
-
headingLevel = _this$
|
|
81
|
-
headingAs = _this$
|
|
82
|
-
heading = _this$
|
|
83
|
-
styles = _this$
|
|
84
|
+
const _this$props4 = this.props,
|
|
85
|
+
headingLevel = _this$props4.headingLevel,
|
|
86
|
+
headingAs = _this$props4.headingAs,
|
|
87
|
+
heading = _this$props4.heading,
|
|
88
|
+
styles = _this$props4.styles;
|
|
84
89
|
return jsx("span", {
|
|
85
90
|
css: styles === null || styles === void 0 ? void 0 : styles.heading
|
|
86
91
|
}, jsx(Heading, {
|
|
@@ -90,10 +95,6 @@ let Billboard = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
|
90
95
|
}, heading));
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
get heroIsFunction() {
|
|
94
|
-
return typeof this.props.hero === 'function';
|
|
95
|
-
}
|
|
96
|
-
|
|
97
98
|
get SVGIconSize() {
|
|
98
99
|
const size = this.props.size; // serve up appropriate SVGIcon size for each Billboard size
|
|
99
100
|
|
|
@@ -107,7 +108,7 @@ let Billboard = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
renderHero() {
|
|
110
|
-
if (this.
|
|
111
|
+
if (typeof this.props.hero === 'function') {
|
|
111
112
|
return this.props.hero(this.SVGIconSize);
|
|
112
113
|
} else {
|
|
113
114
|
return this.props.hero;
|
|
@@ -115,11 +116,11 @@ let Billboard = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
renderContent() {
|
|
118
|
-
const _this$
|
|
119
|
-
heading = _this$
|
|
120
|
-
message = _this$
|
|
121
|
-
hero = _this$
|
|
122
|
-
styles = _this$
|
|
119
|
+
const _this$props5 = this.props,
|
|
120
|
+
heading = _this$props5.heading,
|
|
121
|
+
message = _this$props5.message,
|
|
122
|
+
hero = _this$props5.hero,
|
|
123
|
+
styles = _this$props5.styles;
|
|
123
124
|
return jsx("span", {
|
|
124
125
|
css: styles === null || styles === void 0 ? void 0 : styles.content
|
|
125
126
|
}, hero && jsx("span", {
|
|
@@ -130,12 +131,12 @@ let Billboard = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_
|
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
render() {
|
|
133
|
-
const _this$
|
|
134
|
-
href = _this$
|
|
135
|
-
disabled = _this$
|
|
136
|
-
readOnly = _this$
|
|
137
|
-
margin = _this$
|
|
138
|
-
styles = _this$
|
|
134
|
+
const _this$props6 = this.props,
|
|
135
|
+
href = _this$props6.href,
|
|
136
|
+
disabled = _this$props6.disabled,
|
|
137
|
+
readOnly = _this$props6.readOnly,
|
|
138
|
+
margin = _this$props6.margin,
|
|
139
|
+
styles = _this$props6.styles;
|
|
139
140
|
const Element = getElementType(Billboard, this.props);
|
|
140
141
|
return jsx(View, {
|
|
141
142
|
as: "div",
|
package/es/Billboard/props.js
CHANGED
|
@@ -24,75 +24,18 @@
|
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
26
|
const propTypes = {
|
|
27
|
-
/**
|
|
28
|
-
* Provide an <Img> component or Instructure Icon for the hero image
|
|
29
|
-
*/
|
|
30
27
|
hero: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* If you're using an icon, this prop will size it. Also sets the font-size
|
|
34
|
-
* of the headline and message.
|
|
35
|
-
*/
|
|
36
28
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* the element type to render as
|
|
40
|
-
*/
|
|
41
29
|
as: PropTypes.elementType,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* provides a reference to the underlying html root element
|
|
45
|
-
*/
|
|
46
30
|
elementRef: PropTypes.func,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The headline for the Billboard. Is styled as an h1 element by default
|
|
50
|
-
*/
|
|
51
31
|
heading: PropTypes.string,
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Choose the appropriately semantic tag for the heading
|
|
55
|
-
*/
|
|
56
32
|
headingAs: PropTypes.oneOf(['h1', 'h2', 'h3', 'span']),
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Choose the font-size for the heading (see the Heading component)
|
|
60
|
-
*/
|
|
61
33
|
headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4']),
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Instructions or information for the Billboard. Note: you should not pass
|
|
65
|
-
* interactive content to this prop if you are also providing an `href` or
|
|
66
|
-
* `onClick`. That would cause the Billboard to render as a button or link
|
|
67
|
-
* and would result in nested interactive content.
|
|
68
|
-
*/
|
|
69
34
|
message: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* If you add an onClick prop, the Billboard renders as a clickable button
|
|
73
|
-
*/
|
|
74
35
|
onClick: PropTypes.func,
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* If `href` is provided, Billboard will render as a link
|
|
78
|
-
*/
|
|
79
36
|
href: PropTypes.string,
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Whether or not to disable the billboard
|
|
83
|
-
*/
|
|
84
37
|
disabled: PropTypes.bool,
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Works just like disabled but keeps the same styles as if it were active
|
|
88
|
-
*/
|
|
89
38
|
readOnly: PropTypes.bool,
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
93
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
94
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
95
|
-
*/
|
|
96
39
|
margin: ThemeablePropTypes.spacing
|
|
97
40
|
};
|
|
98
41
|
const allowedProps = ['hero', 'size', 'as', 'elementRef', 'heading', 'headingAs', 'headingLevel', 'message', 'onClick', 'href', 'disabled', 'readOnly', 'margin'];
|
package/lib/Billboard/index.js
CHANGED
|
@@ -33,6 +33,7 @@ var _dec, _class, _class2, _temp;
|
|
|
33
33
|
---
|
|
34
34
|
category: components
|
|
35
35
|
---
|
|
36
|
+
@tsProps
|
|
36
37
|
**/
|
|
37
38
|
let Billboard = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Billboard extends _react.Component {
|
|
38
39
|
constructor() {
|
|
@@ -63,19 +64,23 @@ let Billboard = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
componentDidMount() {
|
|
66
|
-
|
|
67
|
+
var _this$props$makeStyle, _this$props2;
|
|
68
|
+
|
|
69
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
componentDidUpdate(
|
|
70
|
-
|
|
72
|
+
componentDidUpdate() {
|
|
73
|
+
var _this$props$makeStyle2, _this$props3;
|
|
74
|
+
|
|
75
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
renderHeading() {
|
|
74
|
-
const _this$
|
|
75
|
-
headingLevel = _this$
|
|
76
|
-
headingAs = _this$
|
|
77
|
-
heading = _this$
|
|
78
|
-
styles = _this$
|
|
79
|
+
const _this$props4 = this.props,
|
|
80
|
+
headingLevel = _this$props4.headingLevel,
|
|
81
|
+
headingAs = _this$props4.headingAs,
|
|
82
|
+
heading = _this$props4.heading,
|
|
83
|
+
styles = _this$props4.styles;
|
|
79
84
|
return (0, _emotion.jsx)("span", {
|
|
80
85
|
css: styles === null || styles === void 0 ? void 0 : styles.heading
|
|
81
86
|
}, (0, _emotion.jsx)(_Heading.Heading, {
|
|
@@ -85,10 +90,6 @@ let Billboard = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
85
90
|
}, heading));
|
|
86
91
|
}
|
|
87
92
|
|
|
88
|
-
get heroIsFunction() {
|
|
89
|
-
return typeof this.props.hero === 'function';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
93
|
get SVGIconSize() {
|
|
93
94
|
const size = this.props.size; // serve up appropriate SVGIcon size for each Billboard size
|
|
94
95
|
|
|
@@ -102,7 +103,7 @@ let Billboard = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
renderHero() {
|
|
105
|
-
if (this.
|
|
106
|
+
if (typeof this.props.hero === 'function') {
|
|
106
107
|
return this.props.hero(this.SVGIconSize);
|
|
107
108
|
} else {
|
|
108
109
|
return this.props.hero;
|
|
@@ -110,11 +111,11 @@ let Billboard = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
renderContent() {
|
|
113
|
-
const _this$
|
|
114
|
-
heading = _this$
|
|
115
|
-
message = _this$
|
|
116
|
-
hero = _this$
|
|
117
|
-
styles = _this$
|
|
114
|
+
const _this$props5 = this.props,
|
|
115
|
+
heading = _this$props5.heading,
|
|
116
|
+
message = _this$props5.message,
|
|
117
|
+
hero = _this$props5.hero,
|
|
118
|
+
styles = _this$props5.styles;
|
|
118
119
|
return (0, _emotion.jsx)("span", {
|
|
119
120
|
css: styles === null || styles === void 0 ? void 0 : styles.content
|
|
120
121
|
}, hero && (0, _emotion.jsx)("span", {
|
|
@@ -125,12 +126,12 @@ let Billboard = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
render() {
|
|
128
|
-
const _this$
|
|
129
|
-
href = _this$
|
|
130
|
-
disabled = _this$
|
|
131
|
-
readOnly = _this$
|
|
132
|
-
margin = _this$
|
|
133
|
-
styles = _this$
|
|
129
|
+
const _this$props6 = this.props,
|
|
130
|
+
href = _this$props6.href,
|
|
131
|
+
disabled = _this$props6.disabled,
|
|
132
|
+
readOnly = _this$props6.readOnly,
|
|
133
|
+
margin = _this$props6.margin,
|
|
134
|
+
styles = _this$props6.styles;
|
|
134
135
|
const Element = (0, _getElementType.getElementType)(Billboard, this.props);
|
|
135
136
|
return (0, _emotion.jsx)(_View.View, {
|
|
136
137
|
as: "div",
|
package/lib/Billboard/props.js
CHANGED
|
@@ -35,75 +35,18 @@ var _emotion = require("@instructure/emotion");
|
|
|
35
35
|
* SOFTWARE.
|
|
36
36
|
*/
|
|
37
37
|
const propTypes = {
|
|
38
|
-
/**
|
|
39
|
-
* Provide an <Img> component or Instructure Icon for the hero image
|
|
40
|
-
*/
|
|
41
38
|
hero: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* If you're using an icon, this prop will size it. Also sets the font-size
|
|
45
|
-
* of the headline and message.
|
|
46
|
-
*/
|
|
47
39
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* the element type to render as
|
|
51
|
-
*/
|
|
52
40
|
as: _propTypes.default.elementType,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* provides a reference to the underlying html root element
|
|
56
|
-
*/
|
|
57
41
|
elementRef: _propTypes.default.func,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The headline for the Billboard. Is styled as an h1 element by default
|
|
61
|
-
*/
|
|
62
42
|
heading: _propTypes.default.string,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Choose the appropriately semantic tag for the heading
|
|
66
|
-
*/
|
|
67
43
|
headingAs: _propTypes.default.oneOf(['h1', 'h2', 'h3', 'span']),
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Choose the font-size for the heading (see the Heading component)
|
|
71
|
-
*/
|
|
72
44
|
headingLevel: _propTypes.default.oneOf(['h1', 'h2', 'h3', 'h4']),
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Instructions or information for the Billboard. Note: you should not pass
|
|
76
|
-
* interactive content to this prop if you are also providing an `href` or
|
|
77
|
-
* `onClick`. That would cause the Billboard to render as a button or link
|
|
78
|
-
* and would result in nested interactive content.
|
|
79
|
-
*/
|
|
80
45
|
message: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* If you add an onClick prop, the Billboard renders as a clickable button
|
|
84
|
-
*/
|
|
85
46
|
onClick: _propTypes.default.func,
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* If `href` is provided, Billboard will render as a link
|
|
89
|
-
*/
|
|
90
47
|
href: _propTypes.default.string,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Whether or not to disable the billboard
|
|
94
|
-
*/
|
|
95
48
|
disabled: _propTypes.default.bool,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Works just like disabled but keeps the same styles as if it were active
|
|
99
|
-
*/
|
|
100
49
|
readOnly: _propTypes.default.bool,
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
104
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
105
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
106
|
-
*/
|
|
107
50
|
margin: _emotion.ThemeablePropTypes.spacing
|
|
108
51
|
};
|
|
109
52
|
exports.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-billboard",
|
|
3
|
-
"version": "8.14.
|
|
3
|
+
"version": "8.14.1-snapshot.7+845d7ec6c",
|
|
4
4
|
"description": "A UI component to display empty states, 404 pages, redirects, etc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/ui-babel-preset": "8.14.
|
|
28
|
-
"@instructure/ui-color-utils": "8.14.
|
|
29
|
-
"@instructure/ui-icons": "8.14.
|
|
30
|
-
"@instructure/ui-test-utils": "8.14.
|
|
31
|
-
"@instructure/ui-themes": "8.14.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.14.1-snapshot.7+845d7ec6c",
|
|
28
|
+
"@instructure/ui-color-utils": "8.14.1-snapshot.7+845d7ec6c",
|
|
29
|
+
"@instructure/ui-icons": "8.14.1-snapshot.7+845d7ec6c",
|
|
30
|
+
"@instructure/ui-test-utils": "8.14.1-snapshot.7+845d7ec6c",
|
|
31
|
+
"@instructure/ui-themes": "8.14.1-snapshot.7+845d7ec6c"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.13.10",
|
|
35
|
-
"@instructure/emotion": "8.14.
|
|
36
|
-
"@instructure/shared-types": "8.14.
|
|
37
|
-
"@instructure/ui-heading": "8.14.
|
|
38
|
-
"@instructure/ui-img": "8.14.
|
|
39
|
-
"@instructure/ui-react-utils": "8.14.
|
|
40
|
-
"@instructure/ui-view": "8.14.
|
|
35
|
+
"@instructure/emotion": "8.14.1-snapshot.7+845d7ec6c",
|
|
36
|
+
"@instructure/shared-types": "8.14.1-snapshot.7+845d7ec6c",
|
|
37
|
+
"@instructure/ui-heading": "8.14.1-snapshot.7+845d7ec6c",
|
|
38
|
+
"@instructure/ui-img": "8.14.1-snapshot.7+845d7ec6c",
|
|
39
|
+
"@instructure/ui-react-utils": "8.14.1-snapshot.7+845d7ec6c",
|
|
40
|
+
"@instructure/ui-view": "8.14.1-snapshot.7+845d7ec6c",
|
|
41
41
|
"prop-types": "^15"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -46,5 +46,6 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"sideEffects": false
|
|
49
|
+
"sideEffects": false,
|
|
50
|
+
"gitHead": "845d7ec6c159d8946b22caa9d8fb3d0175167a6f"
|
|
50
51
|
}
|
package/src/Billboard/index.tsx
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
|
-
import { Component } from 'react'
|
|
26
|
+
import { Component, MouseEvent } from 'react'
|
|
27
27
|
|
|
28
28
|
import { Heading } from '@instructure/ui-heading'
|
|
29
29
|
import { View } from '@instructure/ui-view'
|
|
@@ -39,12 +39,14 @@ import generateStyle from './styles'
|
|
|
39
39
|
import generateComponentTheme from './theme'
|
|
40
40
|
|
|
41
41
|
import { propTypes, allowedProps } from './props'
|
|
42
|
-
import type { BillboardProps } from './props'
|
|
42
|
+
import type { BillboardProps, HeroIconSize } from './props'
|
|
43
|
+
import type { ViewProps } from '@instructure/ui-view'
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
---
|
|
46
47
|
category: components
|
|
47
48
|
---
|
|
49
|
+
@tsProps
|
|
48
50
|
**/
|
|
49
51
|
@withStyle(generateStyle, generateComponentTheme)
|
|
50
52
|
class Billboard extends Component<BillboardProps> {
|
|
@@ -75,14 +77,11 @@ class Billboard extends Component<BillboardProps> {
|
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
componentDidMount() {
|
|
78
|
-
|
|
79
|
-
this.props.makeStyles()
|
|
80
|
+
this.props.makeStyles?.()
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
|
|
85
|
-
this.props.makeStyles()
|
|
83
|
+
componentDidUpdate() {
|
|
84
|
+
this.props.makeStyles?.()
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
renderHeading() {
|
|
@@ -97,11 +96,7 @@ class Billboard extends Component<BillboardProps> {
|
|
|
97
96
|
)
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
get
|
|
101
|
-
return typeof this.props.hero === 'function'
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
get SVGIconSize() {
|
|
99
|
+
get SVGIconSize(): HeroIconSize {
|
|
105
100
|
const size = this.props.size
|
|
106
101
|
|
|
107
102
|
// serve up appropriate SVGIcon size for each Billboard size
|
|
@@ -115,8 +110,7 @@ class Billboard extends Component<BillboardProps> {
|
|
|
115
110
|
}
|
|
116
111
|
|
|
117
112
|
renderHero() {
|
|
118
|
-
if (this.
|
|
119
|
-
// @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
|
|
113
|
+
if (typeof this.props.hero === 'function') {
|
|
120
114
|
return this.props.hero(this.SVGIconSize)
|
|
121
115
|
} else {
|
|
122
116
|
return this.props.hero
|
|
@@ -137,8 +131,7 @@ class Billboard extends Component<BillboardProps> {
|
|
|
137
131
|
)
|
|
138
132
|
}
|
|
139
133
|
|
|
140
|
-
|
|
141
|
-
handleClick = (e) => {
|
|
134
|
+
handleClick = (e: MouseEvent<ViewProps>): void => {
|
|
142
135
|
const { readOnly, onClick } = this.props
|
|
143
136
|
|
|
144
137
|
if (readOnly) {
|
package/src/Billboard/props.ts
CHANGED
|
@@ -37,93 +37,95 @@ import type {
|
|
|
37
37
|
OtherHTMLAttributes,
|
|
38
38
|
PropValidators
|
|
39
39
|
} from '@instructure/shared-types'
|
|
40
|
-
|
|
40
|
+
import type { ViewProps } from '@instructure/ui-view'
|
|
41
|
+
import React, { MouseEvent } from 'react'
|
|
42
|
+
type HeroIconSize = 'medium' | 'x-large' | 'large'
|
|
41
43
|
type BillboardOwnProps = {
|
|
42
|
-
hero?: React.ReactElement | ((...args: any[]) => any)
|
|
43
|
-
size?: 'small' | 'medium' | 'large'
|
|
44
|
-
as?: AsElementType
|
|
45
|
-
elementRef?: (element: Element | null) => void
|
|
46
|
-
heading?: string
|
|
47
|
-
headingAs?: 'h1' | 'h2' | 'h3' | 'span'
|
|
48
|
-
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4'
|
|
49
|
-
message?: React.ReactNode | ((...args: any[]) => any)
|
|
50
|
-
onClick?: (...args: any[]) => any
|
|
51
|
-
href?: string
|
|
52
|
-
disabled?: boolean
|
|
53
|
-
readOnly?: boolean
|
|
54
|
-
margin?: Spacing
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
type PropKeys = keyof BillboardOwnProps
|
|
58
|
-
|
|
59
|
-
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
60
|
-
|
|
61
|
-
type BillboardProps = BillboardOwnProps &
|
|
62
|
-
WithStyleProps<BillboardTheme, BillboardStyle> &
|
|
63
|
-
OtherHTMLAttributes<BillboardOwnProps>
|
|
64
|
-
|
|
65
|
-
type BillboardStyle = ComponentStyle<
|
|
66
|
-
'billboard' | 'content' | 'hero' | 'heading' | 'message'
|
|
67
|
-
>
|
|
68
|
-
|
|
69
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
70
44
|
/**
|
|
71
45
|
* Provide an <Img> component or Instructure Icon for the hero image
|
|
72
46
|
*/
|
|
73
|
-
hero
|
|
47
|
+
hero?: React.ReactElement | ((iconSize: HeroIconSize) => React.ReactElement)
|
|
74
48
|
/**
|
|
75
49
|
* If you're using an icon, this prop will size it. Also sets the font-size
|
|
76
50
|
* of the headline and message.
|
|
77
51
|
*/
|
|
78
|
-
size
|
|
52
|
+
size?: 'small' | 'medium' | 'large'
|
|
79
53
|
/**
|
|
80
54
|
* the element type to render as
|
|
81
55
|
*/
|
|
82
|
-
as
|
|
56
|
+
as?: AsElementType
|
|
83
57
|
/**
|
|
84
58
|
* provides a reference to the underlying html root element
|
|
85
59
|
*/
|
|
86
|
-
elementRef:
|
|
60
|
+
elementRef?: (element: Element | null) => void
|
|
87
61
|
/**
|
|
88
62
|
* The headline for the Billboard. Is styled as an h1 element by default
|
|
89
63
|
*/
|
|
90
|
-
heading
|
|
64
|
+
heading?: string
|
|
91
65
|
/**
|
|
92
66
|
* Choose the appropriately semantic tag for the heading
|
|
93
67
|
*/
|
|
94
|
-
headingAs
|
|
68
|
+
headingAs?: 'h1' | 'h2' | 'h3' | 'span'
|
|
95
69
|
/**
|
|
96
70
|
* Choose the font-size for the heading (see the Heading component)
|
|
97
71
|
*/
|
|
98
|
-
headingLevel
|
|
72
|
+
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4'
|
|
99
73
|
/**
|
|
100
74
|
* Instructions or information for the Billboard. Note: you should not pass
|
|
101
75
|
* interactive content to this prop if you are also providing an `href` or
|
|
102
76
|
* `onClick`. That would cause the Billboard to render as a button or link
|
|
103
77
|
* and would result in nested interactive content.
|
|
104
78
|
*/
|
|
105
|
-
message
|
|
79
|
+
message?: React.ReactNode | (() => React.ReactNode)
|
|
106
80
|
/**
|
|
107
81
|
* If you add an onClick prop, the Billboard renders as a clickable button
|
|
108
82
|
*/
|
|
109
|
-
onClick:
|
|
83
|
+
onClick?: (e: MouseEvent<ViewProps>) => void
|
|
110
84
|
/**
|
|
111
85
|
* If `href` is provided, Billboard will render as a link
|
|
112
86
|
*/
|
|
113
|
-
href
|
|
87
|
+
href?: string
|
|
114
88
|
/**
|
|
115
89
|
* Whether or not to disable the billboard
|
|
116
90
|
*/
|
|
117
|
-
disabled
|
|
91
|
+
disabled?: boolean
|
|
118
92
|
/**
|
|
119
93
|
* Works just like disabled but keeps the same styles as if it were active
|
|
120
94
|
*/
|
|
121
|
-
readOnly
|
|
95
|
+
readOnly?: boolean
|
|
122
96
|
/**
|
|
123
97
|
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
124
98
|
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
125
99
|
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
126
100
|
*/
|
|
101
|
+
margin?: Spacing
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
type PropKeys = keyof BillboardOwnProps
|
|
105
|
+
|
|
106
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
107
|
+
|
|
108
|
+
type BillboardProps = BillboardOwnProps &
|
|
109
|
+
WithStyleProps<BillboardTheme, BillboardStyle> &
|
|
110
|
+
OtherHTMLAttributes<BillboardOwnProps>
|
|
111
|
+
|
|
112
|
+
type BillboardStyle = ComponentStyle<
|
|
113
|
+
'billboard' | 'content' | 'hero' | 'heading' | 'message'
|
|
114
|
+
>
|
|
115
|
+
|
|
116
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
117
|
+
hero: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
118
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
119
|
+
as: PropTypes.elementType,
|
|
120
|
+
elementRef: PropTypes.func,
|
|
121
|
+
heading: PropTypes.string,
|
|
122
|
+
headingAs: PropTypes.oneOf(['h1', 'h2', 'h3', 'span']),
|
|
123
|
+
headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4']),
|
|
124
|
+
message: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
125
|
+
onClick: PropTypes.func,
|
|
126
|
+
href: PropTypes.string,
|
|
127
|
+
disabled: PropTypes.bool,
|
|
128
|
+
readOnly: PropTypes.bool,
|
|
127
129
|
margin: ThemeablePropTypes.spacing
|
|
128
130
|
}
|
|
129
131
|
|
|
@@ -143,5 +145,5 @@ const allowedProps: AllowedPropKeys = [
|
|
|
143
145
|
'margin'
|
|
144
146
|
]
|
|
145
147
|
|
|
146
|
-
export type { BillboardProps, BillboardStyle }
|
|
148
|
+
export type { BillboardProps, BillboardStyle, HeroIconSize }
|
|
147
149
|
export { propTypes, allowedProps }
|