@instructure/ui-buttons 8.10.1 → 8.10.2-snapshot.22
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/BaseButton/index.js +42 -38
- package/es/Button/index.js +3 -1
- package/es/CloseButton/index.js +28 -16
- package/es/CondensedButton/index.js +22 -14
- package/es/IconButton/index.js +27 -19
- package/es/ToggleButton/index.js +24 -15
- package/lib/BaseButton/index.js +42 -38
- package/lib/Button/index.js +3 -1
- package/lib/CloseButton/index.js +28 -16
- package/lib/CondensedButton/index.js +22 -14
- package/lib/IconButton/index.js +27 -19
- package/lib/ToggleButton/index.js +24 -15
- package/package.json +22 -21
- package/src/BaseButton/index.tsx +6 -5
- package/src/BaseButton/props.ts +1 -1
- package/src/Button/index.tsx +5 -5
- package/src/Button/props.ts +1 -1
- package/src/CloseButton/index.tsx +8 -1
- package/src/CloseButton/props.ts +1 -1
- package/src/CondensedButton/index.tsx +8 -1
- package/src/CondensedButton/props.ts +1 -1
- package/src/IconButton/index.tsx +8 -1
- package/src/IconButton/props.ts +1 -1
- package/src/ToggleButton/index.tsx +8 -1
- package/src/ToggleButton/props.ts +1 -1
- package/types/BaseButton/index.d.ts +5 -4
- package/types/BaseButton/index.d.ts.map +1 -1
- package/types/BaseButton/props.d.ts +1 -1
- package/types/BaseButton/props.d.ts.map +1 -1
- package/types/Button/index.d.ts +4 -3
- package/types/Button/index.d.ts.map +1 -1
- package/types/Button/props.d.ts +1 -1
- package/types/Button/props.d.ts.map +1 -1
- package/types/CloseButton/index.d.ts +4 -2
- package/types/CloseButton/index.d.ts.map +1 -1
- package/types/CloseButton/props.d.ts +1 -1
- package/types/CloseButton/props.d.ts.map +1 -1
- package/types/CondensedButton/index.d.ts +4 -2
- package/types/CondensedButton/index.d.ts.map +1 -1
- package/types/CondensedButton/props.d.ts +1 -1
- package/types/CondensedButton/props.d.ts.map +1 -1
- package/types/IconButton/index.d.ts +4 -2
- package/types/IconButton/index.d.ts.map +1 -1
- package/types/IconButton/props.d.ts +1 -1
- package/types/IconButton/props.d.ts.map +1 -1
- package/types/ToggleButton/index.d.ts +4 -2
- package/types/ToggleButton/index.d.ts.map +1 -1
- package/types/ToggleButton/props.d.ts +1 -1
- package/types/ToggleButton/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/BaseButton/index.js
CHANGED
|
@@ -49,10 +49,14 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
49
49
|
constructor(...args) {
|
|
50
50
|
super(...args);
|
|
51
51
|
this._rootElement = null;
|
|
52
|
+
this.ref = null;
|
|
52
53
|
|
|
53
54
|
this.handleElementRef = el => {
|
|
55
|
+
var _this$props$elementRe, _this$props;
|
|
56
|
+
|
|
54
57
|
this._rootElement = el;
|
|
55
|
-
this.
|
|
58
|
+
this.ref = el;
|
|
59
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
56
60
|
};
|
|
57
61
|
|
|
58
62
|
this.handleClick = event => {
|
|
@@ -71,10 +75,10 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
71
75
|
};
|
|
72
76
|
|
|
73
77
|
this.handleKeyDown = event => {
|
|
74
|
-
const _this$
|
|
75
|
-
onClick = _this$
|
|
76
|
-
onKeyDown = _this$
|
|
77
|
-
href = _this$
|
|
78
|
+
const _this$props2 = this.props,
|
|
79
|
+
onClick = _this$props2.onClick,
|
|
80
|
+
onKeyDown = _this$props2.onKeyDown,
|
|
81
|
+
href = _this$props2.href;
|
|
78
82
|
const interaction = this.interaction;
|
|
79
83
|
onKeyDown(event); // behave like a button when space key is pressed
|
|
80
84
|
|
|
@@ -113,9 +117,9 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
get hasOnlyIconVisible() {
|
|
116
|
-
const _this$
|
|
117
|
-
children = _this$
|
|
118
|
-
renderIcon = _this$
|
|
120
|
+
const _this$props3 = this.props,
|
|
121
|
+
children = _this$props3.children,
|
|
122
|
+
renderIcon = _this$props3.renderIcon;
|
|
119
123
|
return !!(renderIcon && !hasVisibleChildren(children));
|
|
120
124
|
}
|
|
121
125
|
|
|
@@ -142,10 +146,10 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
get focusColor() {
|
|
145
|
-
const _this$
|
|
146
|
-
color = _this$
|
|
147
|
-
focusColor = _this$
|
|
148
|
-
withBackground = _this$
|
|
149
|
+
const _this$props4 = this.props,
|
|
150
|
+
color = _this$props4.color,
|
|
151
|
+
focusColor = _this$props4.focusColor,
|
|
152
|
+
withBackground = _this$props4.withBackground; // Give user specified focusColor preference
|
|
149
153
|
|
|
150
154
|
if (focusColor) {
|
|
151
155
|
return focusColor;
|
|
@@ -171,10 +175,10 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
171
175
|
}
|
|
172
176
|
|
|
173
177
|
renderChildren() {
|
|
174
|
-
const _this$
|
|
175
|
-
renderIcon = _this$
|
|
176
|
-
children = _this$
|
|
177
|
-
styles = _this$
|
|
178
|
+
const _this$props5 = this.props,
|
|
179
|
+
renderIcon = _this$props5.renderIcon,
|
|
180
|
+
children = _this$props5.children,
|
|
181
|
+
styles = _this$props5.styles;
|
|
178
182
|
const wrappedChildren = jsx("span", {
|
|
179
183
|
css: styles === null || styles === void 0 ? void 0 : styles.children
|
|
180
184
|
}, children);
|
|
@@ -202,28 +206,28 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
render() {
|
|
205
|
-
const _this$
|
|
206
|
-
type = _this$
|
|
207
|
-
size = _this$
|
|
208
|
-
elementRef = _this$
|
|
209
|
-
as = _this$
|
|
210
|
-
href = _this$
|
|
211
|
-
color = _this$
|
|
212
|
-
focusColor = _this$
|
|
213
|
-
textAlign = _this$
|
|
214
|
-
shape = _this$
|
|
215
|
-
display = _this$
|
|
216
|
-
withBackground = _this$
|
|
217
|
-
withBorder = _this$
|
|
218
|
-
isCondensed = _this$
|
|
219
|
-
margin = _this$
|
|
220
|
-
cursor = _this$
|
|
221
|
-
onClick = _this$
|
|
222
|
-
renderIcon = _this$
|
|
223
|
-
tabIndex = _this$
|
|
224
|
-
styles = _this$
|
|
225
|
-
makeStyles = _this$
|
|
226
|
-
props = _objectWithoutProperties(_this$
|
|
209
|
+
const _this$props6 = this.props,
|
|
210
|
+
type = _this$props6.type,
|
|
211
|
+
size = _this$props6.size,
|
|
212
|
+
elementRef = _this$props6.elementRef,
|
|
213
|
+
as = _this$props6.as,
|
|
214
|
+
href = _this$props6.href,
|
|
215
|
+
color = _this$props6.color,
|
|
216
|
+
focusColor = _this$props6.focusColor,
|
|
217
|
+
textAlign = _this$props6.textAlign,
|
|
218
|
+
shape = _this$props6.shape,
|
|
219
|
+
display = _this$props6.display,
|
|
220
|
+
withBackground = _this$props6.withBackground,
|
|
221
|
+
withBorder = _this$props6.withBorder,
|
|
222
|
+
isCondensed = _this$props6.isCondensed,
|
|
223
|
+
margin = _this$props6.margin,
|
|
224
|
+
cursor = _this$props6.cursor,
|
|
225
|
+
onClick = _this$props6.onClick,
|
|
226
|
+
renderIcon = _this$props6.renderIcon,
|
|
227
|
+
tabIndex = _this$props6.tabIndex,
|
|
228
|
+
styles = _this$props6.styles,
|
|
229
|
+
makeStyles = _this$props6.makeStyles,
|
|
230
|
+
props = _objectWithoutProperties(_this$props6, _excluded);
|
|
227
231
|
|
|
228
232
|
const isDisabled = this.isDisabled,
|
|
229
233
|
isEnabled = this.isEnabled,
|
package/es/Button/index.js
CHANGED
|
@@ -44,10 +44,12 @@ let Button = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable()
|
|
|
44
44
|
constructor(...args) {
|
|
45
45
|
super(...args);
|
|
46
46
|
this._buttonComponent = null;
|
|
47
|
+
this.ref = null;
|
|
47
48
|
|
|
48
49
|
this.handleElementRef = el => {
|
|
49
50
|
const elementRef = this.props.elementRef;
|
|
50
|
-
|
|
51
|
+
this.ref = el;
|
|
52
|
+
elementRef === null || elementRef === void 0 ? void 0 : elementRef(el);
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
this.handleButtonRef = component => {
|
package/es/CloseButton/index.js
CHANGED
|
@@ -45,6 +45,18 @@ category: components
|
|
|
45
45
|
---
|
|
46
46
|
**/
|
|
47
47
|
let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class CloseButton extends Component {
|
|
48
|
+
constructor(...args) {
|
|
49
|
+
super(...args);
|
|
50
|
+
this.ref = null;
|
|
51
|
+
|
|
52
|
+
this.handleRef = el => {
|
|
53
|
+
var _this$props$elementRe, _this$props;
|
|
54
|
+
|
|
55
|
+
this.ref = el;
|
|
56
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
componentDidMount() {
|
|
49
61
|
this.props.makeStyles();
|
|
50
62
|
}
|
|
@@ -65,27 +77,27 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
65
77
|
}
|
|
66
78
|
|
|
67
79
|
render() {
|
|
68
|
-
const _this$
|
|
69
|
-
screenReaderLabel = _this$
|
|
70
|
-
elementRef = _this$
|
|
71
|
-
size = _this$
|
|
72
|
-
onClick = _this$
|
|
73
|
-
margin = _this$
|
|
74
|
-
placement = _this$
|
|
75
|
-
offset = _this$
|
|
76
|
-
type = _this$
|
|
77
|
-
as = _this$
|
|
78
|
-
href = _this$
|
|
79
|
-
cursor = _this$
|
|
80
|
-
tabIndex = _this$
|
|
81
|
-
styles = _this$
|
|
82
|
-
props = _objectWithoutProperties(_this$
|
|
80
|
+
const _this$props2 = this.props,
|
|
81
|
+
screenReaderLabel = _this$props2.screenReaderLabel,
|
|
82
|
+
elementRef = _this$props2.elementRef,
|
|
83
|
+
size = _this$props2.size,
|
|
84
|
+
onClick = _this$props2.onClick,
|
|
85
|
+
margin = _this$props2.margin,
|
|
86
|
+
placement = _this$props2.placement,
|
|
87
|
+
offset = _this$props2.offset,
|
|
88
|
+
type = _this$props2.type,
|
|
89
|
+
as = _this$props2.as,
|
|
90
|
+
href = _this$props2.href,
|
|
91
|
+
cursor = _this$props2.cursor,
|
|
92
|
+
tabIndex = _this$props2.tabIndex,
|
|
93
|
+
styles = _this$props2.styles,
|
|
94
|
+
props = _objectWithoutProperties(_this$props2, _excluded);
|
|
83
95
|
|
|
84
96
|
return jsx("span", Object.assign({}, passthroughProps(props), {
|
|
85
97
|
css: styles === null || styles === void 0 ? void 0 : styles.closeButton
|
|
86
98
|
}), jsx(BaseButton, {
|
|
87
99
|
renderIcon: IconXSolid,
|
|
88
|
-
elementRef:
|
|
100
|
+
elementRef: this.handleRef,
|
|
89
101
|
interaction: this.interaction,
|
|
90
102
|
type: type,
|
|
91
103
|
color: this.color,
|
|
@@ -44,6 +44,14 @@ let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = t
|
|
|
44
44
|
constructor(...args) {
|
|
45
45
|
super(...args);
|
|
46
46
|
this._baseButton = null;
|
|
47
|
+
this.ref = null;
|
|
48
|
+
|
|
49
|
+
this.handleRef = el => {
|
|
50
|
+
var _this$props$elementRe, _this$props;
|
|
51
|
+
|
|
52
|
+
this.ref = el;
|
|
53
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
54
|
+
};
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
get focused() {
|
|
@@ -55,19 +63,19 @@ let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = t
|
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
render() {
|
|
58
|
-
const _this$
|
|
59
|
-
children = _this$
|
|
60
|
-
type = _this$
|
|
61
|
-
size = _this$
|
|
62
|
-
elementRef = _this$
|
|
63
|
-
as = _this$
|
|
64
|
-
interaction = _this$
|
|
65
|
-
color = _this$
|
|
66
|
-
margin = _this$
|
|
67
|
-
cursor = _this$
|
|
68
|
-
href = _this$
|
|
69
|
-
renderIcon = _this$
|
|
70
|
-
props = _objectWithoutProperties(_this$
|
|
66
|
+
const _this$props2 = this.props,
|
|
67
|
+
children = _this$props2.children,
|
|
68
|
+
type = _this$props2.type,
|
|
69
|
+
size = _this$props2.size,
|
|
70
|
+
elementRef = _this$props2.elementRef,
|
|
71
|
+
as = _this$props2.as,
|
|
72
|
+
interaction = _this$props2.interaction,
|
|
73
|
+
color = _this$props2.color,
|
|
74
|
+
margin = _this$props2.margin,
|
|
75
|
+
cursor = _this$props2.cursor,
|
|
76
|
+
href = _this$props2.href,
|
|
77
|
+
renderIcon = _this$props2.renderIcon,
|
|
78
|
+
props = _objectWithoutProperties(_this$props2, _excluded);
|
|
71
79
|
|
|
72
80
|
const themeOverride = this.props.themeOverride;
|
|
73
81
|
return /*#__PURE__*/React.createElement(BaseButton, Object.assign({}, passthroughProps(props), {
|
|
@@ -76,7 +84,7 @@ let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = t
|
|
|
76
84
|
withBorder: false,
|
|
77
85
|
type: type,
|
|
78
86
|
size: size,
|
|
79
|
-
elementRef:
|
|
87
|
+
elementRef: this.handleRef,
|
|
80
88
|
as: as,
|
|
81
89
|
interaction: interaction,
|
|
82
90
|
color: color,
|
package/es/IconButton/index.js
CHANGED
|
@@ -45,6 +45,14 @@ let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testab
|
|
|
45
45
|
constructor(...args) {
|
|
46
46
|
super(...args);
|
|
47
47
|
this._baseButton = null;
|
|
48
|
+
this.ref = null;
|
|
49
|
+
|
|
50
|
+
this.handleRef = el => {
|
|
51
|
+
var _this$props$elementRe, _this$props;
|
|
52
|
+
|
|
53
|
+
this.ref = el;
|
|
54
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
55
|
+
};
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
get focused() {
|
|
@@ -56,30 +64,30 @@ let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testab
|
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
render() {
|
|
59
|
-
const _this$
|
|
60
|
-
children = _this$
|
|
61
|
-
renderIcon = _this$
|
|
62
|
-
screenReaderLabel = _this$
|
|
63
|
-
type = _this$
|
|
64
|
-
size = _this$
|
|
65
|
-
elementRef = _this$
|
|
66
|
-
as = _this$
|
|
67
|
-
interaction = _this$
|
|
68
|
-
color = _this$
|
|
69
|
-
focusColor = _this$
|
|
70
|
-
shape = _this$
|
|
71
|
-
withBackground = _this$
|
|
72
|
-
withBorder = _this$
|
|
73
|
-
margin = _this$
|
|
74
|
-
cursor = _this$
|
|
75
|
-
href = _this$
|
|
76
|
-
props = _objectWithoutProperties(_this$
|
|
67
|
+
const _this$props2 = this.props,
|
|
68
|
+
children = _this$props2.children,
|
|
69
|
+
renderIcon = _this$props2.renderIcon,
|
|
70
|
+
screenReaderLabel = _this$props2.screenReaderLabel,
|
|
71
|
+
type = _this$props2.type,
|
|
72
|
+
size = _this$props2.size,
|
|
73
|
+
elementRef = _this$props2.elementRef,
|
|
74
|
+
as = _this$props2.as,
|
|
75
|
+
interaction = _this$props2.interaction,
|
|
76
|
+
color = _this$props2.color,
|
|
77
|
+
focusColor = _this$props2.focusColor,
|
|
78
|
+
shape = _this$props2.shape,
|
|
79
|
+
withBackground = _this$props2.withBackground,
|
|
80
|
+
withBorder = _this$props2.withBorder,
|
|
81
|
+
margin = _this$props2.margin,
|
|
82
|
+
cursor = _this$props2.cursor,
|
|
83
|
+
href = _this$props2.href,
|
|
84
|
+
props = _objectWithoutProperties(_this$props2, _excluded);
|
|
77
85
|
|
|
78
86
|
const themeOverride = this.props.themeOverride;
|
|
79
87
|
return /*#__PURE__*/React.createElement(BaseButton, Object.assign({}, passthroughProps(props), {
|
|
80
88
|
type: type,
|
|
81
89
|
size: size,
|
|
82
|
-
elementRef:
|
|
90
|
+
elementRef: this.handleRef,
|
|
83
91
|
as: as,
|
|
84
92
|
interaction: interaction,
|
|
85
93
|
color: color,
|
package/es/ToggleButton/index.js
CHANGED
|
@@ -41,6 +41,15 @@ category: components
|
|
|
41
41
|
let ToggleButton = (_dec = testable(), _dec(_class = (_temp = _class2 = class ToggleButton extends Component {
|
|
42
42
|
constructor(props) {
|
|
43
43
|
super(props);
|
|
44
|
+
this.ref = null;
|
|
45
|
+
|
|
46
|
+
this.handleRef = el => {
|
|
47
|
+
var _this$props$elementRe, _this$props;
|
|
48
|
+
|
|
49
|
+
this.ref = el;
|
|
50
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
51
|
+
};
|
|
52
|
+
|
|
44
53
|
this.state = {
|
|
45
54
|
isShowingTooltip: props.isShowingTooltip || false
|
|
46
55
|
};
|
|
@@ -51,20 +60,20 @@ let ToggleButton = (_dec = testable(), _dec(_class = (_temp = _class2 = class To
|
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
render() {
|
|
54
|
-
const _this$
|
|
55
|
-
as = _this$
|
|
56
|
-
color = _this$
|
|
57
|
-
elementRef = _this$
|
|
58
|
-
size = _this$
|
|
59
|
-
interaction = _this$
|
|
60
|
-
mountNode = _this$
|
|
61
|
-
renderIcon = _this$
|
|
62
|
-
renderTooltipContent = _this$
|
|
63
|
-
screenReaderLabel = _this$
|
|
64
|
-
status = _this$
|
|
65
|
-
placement = _this$
|
|
66
|
-
onClick = _this$
|
|
67
|
-
props = _objectWithoutProperties(_this$
|
|
63
|
+
const _this$props2 = this.props,
|
|
64
|
+
as = _this$props2.as,
|
|
65
|
+
color = _this$props2.color,
|
|
66
|
+
elementRef = _this$props2.elementRef,
|
|
67
|
+
size = _this$props2.size,
|
|
68
|
+
interaction = _this$props2.interaction,
|
|
69
|
+
mountNode = _this$props2.mountNode,
|
|
70
|
+
renderIcon = _this$props2.renderIcon,
|
|
71
|
+
renderTooltipContent = _this$props2.renderTooltipContent,
|
|
72
|
+
screenReaderLabel = _this$props2.screenReaderLabel,
|
|
73
|
+
status = _this$props2.status,
|
|
74
|
+
placement = _this$props2.placement,
|
|
75
|
+
onClick = _this$props2.onClick,
|
|
76
|
+
props = _objectWithoutProperties(_this$props2, _excluded);
|
|
68
77
|
|
|
69
78
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
70
79
|
renderTip: renderTooltipContent,
|
|
@@ -89,7 +98,7 @@ let ToggleButton = (_dec = testable(), _dec(_class = (_temp = _class2 = class To
|
|
|
89
98
|
withBorder: false,
|
|
90
99
|
color: color,
|
|
91
100
|
size: size,
|
|
92
|
-
elementRef:
|
|
101
|
+
elementRef: this.handleRef,
|
|
93
102
|
as: as,
|
|
94
103
|
onClick: onClick,
|
|
95
104
|
interaction: interaction,
|
package/lib/BaseButton/index.js
CHANGED
|
@@ -50,10 +50,14 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
50
50
|
constructor(...args) {
|
|
51
51
|
super(...args);
|
|
52
52
|
this._rootElement = null;
|
|
53
|
+
this.ref = null;
|
|
53
54
|
|
|
54
55
|
this.handleElementRef = el => {
|
|
56
|
+
var _this$props$elementRe, _this$props;
|
|
57
|
+
|
|
55
58
|
this._rootElement = el;
|
|
56
|
-
this.
|
|
59
|
+
this.ref = el;
|
|
60
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
57
61
|
};
|
|
58
62
|
|
|
59
63
|
this.handleClick = event => {
|
|
@@ -72,10 +76,10 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
72
76
|
};
|
|
73
77
|
|
|
74
78
|
this.handleKeyDown = event => {
|
|
75
|
-
const _this$
|
|
76
|
-
onClick = _this$
|
|
77
|
-
onKeyDown = _this$
|
|
78
|
-
href = _this$
|
|
79
|
+
const _this$props2 = this.props,
|
|
80
|
+
onClick = _this$props2.onClick,
|
|
81
|
+
onKeyDown = _this$props2.onKeyDown,
|
|
82
|
+
href = _this$props2.href;
|
|
79
83
|
const interaction = this.interaction;
|
|
80
84
|
onKeyDown(event); // behave like a button when space key is pressed
|
|
81
85
|
|
|
@@ -114,9 +118,9 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
get hasOnlyIconVisible() {
|
|
117
|
-
const _this$
|
|
118
|
-
children = _this$
|
|
119
|
-
renderIcon = _this$
|
|
121
|
+
const _this$props3 = this.props,
|
|
122
|
+
children = _this$props3.children,
|
|
123
|
+
renderIcon = _this$props3.renderIcon;
|
|
120
124
|
return !!(renderIcon && !(0, _hasVisibleChildren.hasVisibleChildren)(children));
|
|
121
125
|
}
|
|
122
126
|
|
|
@@ -143,10 +147,10 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
get focusColor() {
|
|
146
|
-
const _this$
|
|
147
|
-
color = _this$
|
|
148
|
-
focusColor = _this$
|
|
149
|
-
withBackground = _this$
|
|
150
|
+
const _this$props4 = this.props,
|
|
151
|
+
color = _this$props4.color,
|
|
152
|
+
focusColor = _this$props4.focusColor,
|
|
153
|
+
withBackground = _this$props4.withBackground; // Give user specified focusColor preference
|
|
150
154
|
|
|
151
155
|
if (focusColor) {
|
|
152
156
|
return focusColor;
|
|
@@ -172,10 +176,10 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
renderChildren() {
|
|
175
|
-
const _this$
|
|
176
|
-
renderIcon = _this$
|
|
177
|
-
children = _this$
|
|
178
|
-
styles = _this$
|
|
179
|
+
const _this$props5 = this.props,
|
|
180
|
+
renderIcon = _this$props5.renderIcon,
|
|
181
|
+
children = _this$props5.children,
|
|
182
|
+
styles = _this$props5.styles;
|
|
179
183
|
const wrappedChildren = (0, _emotion.jsx)("span", {
|
|
180
184
|
css: styles === null || styles === void 0 ? void 0 : styles.children
|
|
181
185
|
}, children);
|
|
@@ -203,28 +207,28 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
render() {
|
|
206
|
-
const _this$
|
|
207
|
-
type = _this$
|
|
208
|
-
size = _this$
|
|
209
|
-
elementRef = _this$
|
|
210
|
-
as = _this$
|
|
211
|
-
href = _this$
|
|
212
|
-
color = _this$
|
|
213
|
-
focusColor = _this$
|
|
214
|
-
textAlign = _this$
|
|
215
|
-
shape = _this$
|
|
216
|
-
display = _this$
|
|
217
|
-
withBackground = _this$
|
|
218
|
-
withBorder = _this$
|
|
219
|
-
isCondensed = _this$
|
|
220
|
-
margin = _this$
|
|
221
|
-
cursor = _this$
|
|
222
|
-
onClick = _this$
|
|
223
|
-
renderIcon = _this$
|
|
224
|
-
tabIndex = _this$
|
|
225
|
-
styles = _this$
|
|
226
|
-
makeStyles = _this$
|
|
227
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
210
|
+
const _this$props6 = this.props,
|
|
211
|
+
type = _this$props6.type,
|
|
212
|
+
size = _this$props6.size,
|
|
213
|
+
elementRef = _this$props6.elementRef,
|
|
214
|
+
as = _this$props6.as,
|
|
215
|
+
href = _this$props6.href,
|
|
216
|
+
color = _this$props6.color,
|
|
217
|
+
focusColor = _this$props6.focusColor,
|
|
218
|
+
textAlign = _this$props6.textAlign,
|
|
219
|
+
shape = _this$props6.shape,
|
|
220
|
+
display = _this$props6.display,
|
|
221
|
+
withBackground = _this$props6.withBackground,
|
|
222
|
+
withBorder = _this$props6.withBorder,
|
|
223
|
+
isCondensed = _this$props6.isCondensed,
|
|
224
|
+
margin = _this$props6.margin,
|
|
225
|
+
cursor = _this$props6.cursor,
|
|
226
|
+
onClick = _this$props6.onClick,
|
|
227
|
+
renderIcon = _this$props6.renderIcon,
|
|
228
|
+
tabIndex = _this$props6.tabIndex,
|
|
229
|
+
styles = _this$props6.styles,
|
|
230
|
+
makeStyles = _this$props6.makeStyles,
|
|
231
|
+
props = (0, _objectWithoutProperties2.default)(_this$props6, _excluded);
|
|
228
232
|
const isDisabled = this.isDisabled,
|
|
229
233
|
isEnabled = this.isEnabled,
|
|
230
234
|
isReadOnly = this.isReadOnly;
|
package/lib/Button/index.js
CHANGED
|
@@ -41,10 +41,12 @@ let Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0,
|
|
|
41
41
|
constructor(...args) {
|
|
42
42
|
super(...args);
|
|
43
43
|
this._buttonComponent = null;
|
|
44
|
+
this.ref = null;
|
|
44
45
|
|
|
45
46
|
this.handleElementRef = el => {
|
|
46
47
|
const elementRef = this.props.elementRef;
|
|
47
|
-
|
|
48
|
+
this.ref = el;
|
|
49
|
+
elementRef === null || elementRef === void 0 ? void 0 : elementRef(el);
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
this.handleButtonRef = component => {
|
package/lib/CloseButton/index.js
CHANGED
|
@@ -41,6 +41,18 @@ category: components
|
|
|
41
41
|
---
|
|
42
42
|
**/
|
|
43
43
|
let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class CloseButton extends _react.Component {
|
|
44
|
+
constructor(...args) {
|
|
45
|
+
super(...args);
|
|
46
|
+
this.ref = null;
|
|
47
|
+
|
|
48
|
+
this.handleRef = el => {
|
|
49
|
+
var _this$props$elementRe, _this$props;
|
|
50
|
+
|
|
51
|
+
this.ref = el;
|
|
52
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
44
56
|
componentDidMount() {
|
|
45
57
|
this.props.makeStyles();
|
|
46
58
|
}
|
|
@@ -61,26 +73,26 @@ let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
|
|
|
61
73
|
}
|
|
62
74
|
|
|
63
75
|
render() {
|
|
64
|
-
const _this$
|
|
65
|
-
screenReaderLabel = _this$
|
|
66
|
-
elementRef = _this$
|
|
67
|
-
size = _this$
|
|
68
|
-
onClick = _this$
|
|
69
|
-
margin = _this$
|
|
70
|
-
placement = _this$
|
|
71
|
-
offset = _this$
|
|
72
|
-
type = _this$
|
|
73
|
-
as = _this$
|
|
74
|
-
href = _this$
|
|
75
|
-
cursor = _this$
|
|
76
|
-
tabIndex = _this$
|
|
77
|
-
styles = _this$
|
|
78
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
76
|
+
const _this$props2 = this.props,
|
|
77
|
+
screenReaderLabel = _this$props2.screenReaderLabel,
|
|
78
|
+
elementRef = _this$props2.elementRef,
|
|
79
|
+
size = _this$props2.size,
|
|
80
|
+
onClick = _this$props2.onClick,
|
|
81
|
+
margin = _this$props2.margin,
|
|
82
|
+
placement = _this$props2.placement,
|
|
83
|
+
offset = _this$props2.offset,
|
|
84
|
+
type = _this$props2.type,
|
|
85
|
+
as = _this$props2.as,
|
|
86
|
+
href = _this$props2.href,
|
|
87
|
+
cursor = _this$props2.cursor,
|
|
88
|
+
tabIndex = _this$props2.tabIndex,
|
|
89
|
+
styles = _this$props2.styles,
|
|
90
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
|
|
79
91
|
return (0, _emotion.jsx)("span", Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
80
92
|
css: styles === null || styles === void 0 ? void 0 : styles.closeButton
|
|
81
93
|
}), (0, _emotion.jsx)(_BaseButton.BaseButton, {
|
|
82
94
|
renderIcon: _IconXSolid.IconXSolid,
|
|
83
|
-
elementRef:
|
|
95
|
+
elementRef: this.handleRef,
|
|
84
96
|
interaction: this.interaction,
|
|
85
97
|
type: type,
|
|
86
98
|
color: this.color,
|