@instructure/ui-buttons 8.25.1-snapshot-10 → 8.25.1-snapshot-13
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 +1 -1
- package/es/BaseButton/index.js +87 -87
- package/es/Button/index.js +33 -34
- package/es/CloseButton/index.js +24 -25
- package/es/CondensedButton/index.js +25 -26
- package/es/IconButton/index.js +28 -29
- package/es/ToggleButton/index.js +22 -27
- package/lib/BaseButton/index.js +87 -87
- package/lib/Button/index.js +33 -34
- package/lib/CloseButton/index.js +25 -26
- package/lib/CondensedButton/index.js +26 -27
- package/lib/IconButton/index.js +29 -30
- package/lib/ToggleButton/index.js +22 -27
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.25.1-snapshot-
|
|
6
|
+
## [8.25.1-snapshot-13](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-13) (2022-06-22)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-buttons
|
|
9
9
|
|
package/es/BaseButton/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["type", "size", "elementRef", "as", "href", "color", "focusColor", "textAlign", "shape", "display", "withBackground", "withBorder", "isCondensed", "margin", "cursor", "onClick", "renderIcon", "tabIndex", "styles", "makeStyles"];
|
|
3
3
|
|
|
4
|
-
var _dec, _dec2, _class;
|
|
4
|
+
var _dec, _dec2, _class, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -47,39 +47,76 @@ category: components/utilities
|
|
|
47
47
|
---
|
|
48
48
|
@tsProps
|
|
49
49
|
**/
|
|
50
|
-
let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class BaseButton extends Component {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class BaseButton extends Component {
|
|
51
|
+
constructor() {
|
|
52
|
+
super(...arguments);
|
|
53
|
+
this.ref = null;
|
|
54
|
+
|
|
55
|
+
this.handleElementRef = el => {
|
|
56
|
+
const elementRef = this.props.elementRef;
|
|
57
|
+
this.ref = el;
|
|
58
|
+
|
|
59
|
+
if (typeof elementRef === 'function') {
|
|
60
|
+
elementRef(el);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
this.handleClick = event => {
|
|
65
|
+
const onClick = this.props.onClick;
|
|
66
|
+
const interaction = this.interaction;
|
|
67
|
+
|
|
68
|
+
if (interaction !== 'enabled') {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (typeof onClick === 'function') {
|
|
75
|
+
onClick(event);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
this.handleKeyDown = event => {
|
|
80
|
+
const _this$props = this.props,
|
|
81
|
+
onClick = _this$props.onClick,
|
|
82
|
+
onKeyDown = _this$props.onKeyDown,
|
|
83
|
+
href = _this$props.href;
|
|
84
|
+
const interaction = this.interaction;
|
|
85
|
+
|
|
86
|
+
if (typeof onKeyDown === 'function') {
|
|
87
|
+
onKeyDown(event);
|
|
88
|
+
} // behave like a button when space key is pressed
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
const _keycode$codes = keycode.codes,
|
|
92
|
+
space = _keycode$codes.space,
|
|
93
|
+
enter = _keycode$codes.enter;
|
|
94
|
+
|
|
95
|
+
if (this.elementType !== 'button' && [space, enter].includes(event.keyCode)) {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
|
|
99
|
+
if (typeof onClick === 'function' && interaction === 'enabled') {
|
|
100
|
+
onClick(event);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (href) {
|
|
104
|
+
this.ref && this.ref.click();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
72
109
|
|
|
73
110
|
componentDidMount() {
|
|
74
|
-
var _this$props$makeStyle, _this$
|
|
111
|
+
var _this$props$makeStyle, _this$props2;
|
|
75
112
|
|
|
76
|
-
(_this$props$makeStyle = (_this$
|
|
113
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStylesVariables);
|
|
77
114
|
}
|
|
78
115
|
|
|
79
116
|
componentDidUpdate() {
|
|
80
|
-
var _this$props$makeStyle2, _this$
|
|
117
|
+
var _this$props$makeStyle2, _this$props3;
|
|
81
118
|
|
|
82
|
-
(_this$props$makeStyle2 = (_this$
|
|
119
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
|
|
83
120
|
}
|
|
84
121
|
|
|
85
122
|
get _rootElement() {
|
|
@@ -94,9 +131,9 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
94
131
|
}
|
|
95
132
|
|
|
96
133
|
get hasOnlyIconVisible() {
|
|
97
|
-
const _this$
|
|
98
|
-
children = _this$
|
|
99
|
-
renderIcon = _this$
|
|
134
|
+
const _this$props4 = this.props,
|
|
135
|
+
children = _this$props4.children,
|
|
136
|
+
renderIcon = _this$props4.renderIcon;
|
|
100
137
|
return !!(renderIcon && !hasVisibleChildren(children));
|
|
101
138
|
}
|
|
102
139
|
|
|
@@ -135,10 +172,10 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
135
172
|
}
|
|
136
173
|
|
|
137
174
|
get focusColor() {
|
|
138
|
-
const _this$
|
|
139
|
-
color = _this$
|
|
140
|
-
focusColor = _this$
|
|
141
|
-
withBackground = _this$
|
|
175
|
+
const _this$props5 = this.props,
|
|
176
|
+
color = _this$props5.color,
|
|
177
|
+
focusColor = _this$props5.focusColor,
|
|
178
|
+
withBackground = _this$props5.withBackground; // Give user specified focusColor preference
|
|
142
179
|
|
|
143
180
|
if (focusColor) {
|
|
144
181
|
return focusColor;
|
|
@@ -163,58 +200,6 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
163
200
|
this.ref && this.ref.focus();
|
|
164
201
|
}
|
|
165
202
|
|
|
166
|
-
handleElementRef = el => {
|
|
167
|
-
const elementRef = this.props.elementRef;
|
|
168
|
-
this.ref = el;
|
|
169
|
-
|
|
170
|
-
if (typeof elementRef === 'function') {
|
|
171
|
-
elementRef(el);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
handleClick = event => {
|
|
175
|
-
const onClick = this.props.onClick;
|
|
176
|
-
const interaction = this.interaction;
|
|
177
|
-
|
|
178
|
-
if (interaction !== 'enabled') {
|
|
179
|
-
event.preventDefault();
|
|
180
|
-
event.stopPropagation();
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (typeof onClick === 'function') {
|
|
185
|
-
onClick(event);
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
handleKeyDown = event => {
|
|
189
|
-
const _this$props5 = this.props,
|
|
190
|
-
onClick = _this$props5.onClick,
|
|
191
|
-
onKeyDown = _this$props5.onKeyDown,
|
|
192
|
-
href = _this$props5.href;
|
|
193
|
-
const interaction = this.interaction;
|
|
194
|
-
|
|
195
|
-
if (typeof onKeyDown === 'function') {
|
|
196
|
-
onKeyDown(event);
|
|
197
|
-
} // behave like a button when space key is pressed
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const _keycode$codes = keycode.codes,
|
|
201
|
-
space = _keycode$codes.space,
|
|
202
|
-
enter = _keycode$codes.enter;
|
|
203
|
-
|
|
204
|
-
if (this.elementType !== 'button' && [space, enter].includes(event.keyCode)) {
|
|
205
|
-
event.preventDefault();
|
|
206
|
-
event.stopPropagation();
|
|
207
|
-
|
|
208
|
-
if (typeof onClick === 'function' && interaction === 'enabled') {
|
|
209
|
-
onClick(event);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (href) {
|
|
213
|
-
this.ref && this.ref.click();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
203
|
renderChildren() {
|
|
219
204
|
const _this$props6 = this.props,
|
|
220
205
|
renderIcon = _this$props6.renderIcon,
|
|
@@ -300,6 +285,21 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
300
285
|
}, this.renderChildren()));
|
|
301
286
|
}
|
|
302
287
|
|
|
303
|
-
}
|
|
288
|
+
}, _class2.displayName = "BaseButton", _class2.componentId = 'BaseButton', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
289
|
+
type: 'button',
|
|
290
|
+
size: 'medium',
|
|
291
|
+
as: 'button',
|
|
292
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
293
|
+
interaction: void 0,
|
|
294
|
+
color: 'secondary',
|
|
295
|
+
shape: 'rectangle',
|
|
296
|
+
display: 'inline-block',
|
|
297
|
+
textAlign: 'start',
|
|
298
|
+
withBackground: true,
|
|
299
|
+
withBorder: true,
|
|
300
|
+
isCondensed: false,
|
|
301
|
+
margin: '0',
|
|
302
|
+
cursor: 'pointer'
|
|
303
|
+
}, _class2)) || _class) || _class);
|
|
304
304
|
export { BaseButton };
|
|
305
305
|
export default BaseButton;
|
package/es/Button/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["children", "type", "size", "as", "color", "focusColor", "display", "textAlign", "withBackground", "margin", "cursor", "href", "renderIcon"];
|
|
3
3
|
|
|
4
|
-
var _dec, _dec2, _class;
|
|
4
|
+
var _dec, _dec2, _class, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -41,26 +41,25 @@ category: components
|
|
|
41
41
|
@tsProps
|
|
42
42
|
**/
|
|
43
43
|
// needed for listing the available theme variables on docs page
|
|
44
|
-
let Button = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class Button extends Component {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ref = null;
|
|
44
|
+
let Button = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class Button extends Component {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this._buttonComponent = null;
|
|
48
|
+
this.ref = null;
|
|
49
|
+
|
|
50
|
+
this.handleElementRef = el => {
|
|
51
|
+
const elementRef = this.props.elementRef;
|
|
52
|
+
this.ref = el;
|
|
53
|
+
|
|
54
|
+
if (typeof elementRef === 'function') {
|
|
55
|
+
elementRef(el);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
this.handleButtonRef = component => {
|
|
60
|
+
this._buttonComponent = component;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
64
63
|
|
|
65
64
|
get focused() {
|
|
66
65
|
return this._buttonComponent && this._buttonComponent.focused;
|
|
@@ -70,18 +69,6 @@ let Button = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable()
|
|
|
70
69
|
this._buttonComponent && this._buttonComponent.focus();
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
handleElementRef = el => {
|
|
74
|
-
const elementRef = this.props.elementRef;
|
|
75
|
-
this.ref = el;
|
|
76
|
-
|
|
77
|
-
if (typeof elementRef === 'function') {
|
|
78
|
-
elementRef(el);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
handleButtonRef = component => {
|
|
82
|
-
this._buttonComponent = component;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
72
|
render() {
|
|
86
73
|
const _this$props = this.props,
|
|
87
74
|
children = _this$props.children,
|
|
@@ -124,6 +111,18 @@ let Button = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable()
|
|
|
124
111
|
return /*#__PURE__*/React.createElement(BaseButton, buttonProps, children);
|
|
125
112
|
}
|
|
126
113
|
|
|
127
|
-
}
|
|
114
|
+
}, _class2.displayName = "Button", _class2.componentId = 'Button', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
115
|
+
type: 'button',
|
|
116
|
+
size: 'medium',
|
|
117
|
+
as: 'button',
|
|
118
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
119
|
+
interaction: void 0,
|
|
120
|
+
color: 'secondary',
|
|
121
|
+
display: 'inline-block',
|
|
122
|
+
textAlign: 'center',
|
|
123
|
+
withBackground: true,
|
|
124
|
+
margin: '0',
|
|
125
|
+
cursor: 'pointer'
|
|
126
|
+
}, _class2)) || _class) || _class);
|
|
128
127
|
export default Button;
|
|
129
128
|
export { Button };
|
package/es/CloseButton/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["screenReaderLabel", "elementRef", "size", "onClick", "margin", "placement", "offset", "type", "as", "href", "cursor", "tabIndex", "styles"];
|
|
3
3
|
|
|
4
|
-
var _dec, _dec2, _class;
|
|
4
|
+
var _dec, _dec2, _class, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -45,30 +45,19 @@ category: components
|
|
|
45
45
|
---
|
|
46
46
|
@tsProps
|
|
47
47
|
**/
|
|
48
|
-
let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class CloseButton extends Component {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
static allowedProps = allowedProps;
|
|
53
|
-
static defaultProps = {
|
|
54
|
-
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
55
|
-
interaction: void 0,
|
|
56
|
-
type: 'button',
|
|
57
|
-
placement: 'static',
|
|
58
|
-
offset: 'x-small',
|
|
59
|
-
size: 'small',
|
|
60
|
-
margin: '0',
|
|
61
|
-
as: 'button',
|
|
62
|
-
cursor: 'pointer'
|
|
63
|
-
};
|
|
64
|
-
ref = null;
|
|
65
|
-
handleRef = el => {
|
|
66
|
-
const elementRef = this.props.elementRef;
|
|
48
|
+
let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class CloseButton extends Component {
|
|
49
|
+
constructor() {
|
|
50
|
+
super(...arguments);
|
|
51
|
+
this.ref = null;
|
|
67
52
|
|
|
68
|
-
|
|
69
|
-
elementRef
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
this.handleRef = el => {
|
|
54
|
+
const elementRef = this.props.elementRef;
|
|
55
|
+
|
|
56
|
+
if (typeof elementRef === 'function') {
|
|
57
|
+
elementRef(el);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
72
61
|
|
|
73
62
|
componentDidMount() {
|
|
74
63
|
var _this$props$makeStyle, _this$props;
|
|
@@ -131,6 +120,16 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
131
120
|
}, jsx(ScreenReaderContent, null, screenReaderLabel)));
|
|
132
121
|
}
|
|
133
122
|
|
|
134
|
-
}
|
|
123
|
+
}, _class2.displayName = "CloseButton", _class2.componentId = 'CloseButton', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
124
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
125
|
+
interaction: void 0,
|
|
126
|
+
type: 'button',
|
|
127
|
+
placement: 'static',
|
|
128
|
+
offset: 'x-small',
|
|
129
|
+
size: 'small',
|
|
130
|
+
margin: '0',
|
|
131
|
+
as: 'button',
|
|
132
|
+
cursor: 'pointer'
|
|
133
|
+
}, _class2)) || _class) || _class);
|
|
135
134
|
export default CloseButton;
|
|
136
135
|
export { CloseButton };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["children", "type", "size", "elementRef", "as", "interaction", "color", "margin", "cursor", "href", "renderIcon"];
|
|
3
3
|
|
|
4
|
-
var _dec, _dec2, _class;
|
|
4
|
+
var _dec, _dec2, _class, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -41,31 +41,21 @@ category: components
|
|
|
41
41
|
@tsProps
|
|
42
42
|
**/
|
|
43
43
|
// needed for listing the available theme variables on docs page
|
|
44
|
-
let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class CondensedButton extends Component {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
static defaultProps = {
|
|
50
|
-
type: 'button',
|
|
51
|
-
size: 'medium',
|
|
52
|
-
as: 'button',
|
|
53
|
-
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
54
|
-
interaction: void 0,
|
|
55
|
-
color: 'primary',
|
|
56
|
-
margin: '0',
|
|
57
|
-
cursor: 'pointer'
|
|
58
|
-
};
|
|
59
|
-
_baseButton = null;
|
|
60
|
-
ref = null;
|
|
61
|
-
handleRef = el => {
|
|
62
|
-
const elementRef = this.props.elementRef;
|
|
63
|
-
this.ref = el;
|
|
44
|
+
let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class CondensedButton extends Component {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this._baseButton = null;
|
|
48
|
+
this.ref = null;
|
|
64
49
|
|
|
65
|
-
|
|
66
|
-
elementRef
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
this.handleRef = el => {
|
|
51
|
+
const elementRef = this.props.elementRef;
|
|
52
|
+
this.ref = el;
|
|
53
|
+
|
|
54
|
+
if (typeof elementRef === 'function') {
|
|
55
|
+
elementRef(el);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
69
59
|
|
|
70
60
|
get focused() {
|
|
71
61
|
return this._baseButton && this._baseButton.focused;
|
|
@@ -112,6 +102,15 @@ let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = t
|
|
|
112
102
|
}), children);
|
|
113
103
|
}
|
|
114
104
|
|
|
115
|
-
}
|
|
105
|
+
}, _class2.displayName = "CondensedButton", _class2.componentId = 'CondensedButton', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
106
|
+
type: 'button',
|
|
107
|
+
size: 'medium',
|
|
108
|
+
as: 'button',
|
|
109
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
110
|
+
interaction: void 0,
|
|
111
|
+
color: 'primary',
|
|
112
|
+
margin: '0',
|
|
113
|
+
cursor: 'pointer'
|
|
114
|
+
}, _class2)) || _class) || _class);
|
|
116
115
|
export default CondensedButton;
|
|
117
116
|
export { CondensedButton };
|
package/es/IconButton/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["children", "renderIcon", "screenReaderLabel", "type", "size", "elementRef", "as", "interaction", "color", "focusColor", "shape", "withBackground", "withBorder", "margin", "cursor", "href"];
|
|
3
3
|
|
|
4
|
-
var _dec, _dec2, _class;
|
|
4
|
+
var _dec, _dec2, _class, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -42,34 +42,21 @@ category: components
|
|
|
42
42
|
@tsProps
|
|
43
43
|
**/
|
|
44
44
|
// needed for listing the available theme variables on docs page
|
|
45
|
-
let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class IconButton extends Component {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
static defaultProps = {
|
|
51
|
-
type: 'button',
|
|
52
|
-
size: 'medium',
|
|
53
|
-
as: 'button',
|
|
54
|
-
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
55
|
-
interaction: void 0,
|
|
56
|
-
color: 'secondary',
|
|
57
|
-
shape: 'rectangle',
|
|
58
|
-
withBackground: true,
|
|
59
|
-
withBorder: true,
|
|
60
|
-
margin: '0',
|
|
61
|
-
cursor: 'pointer'
|
|
62
|
-
};
|
|
63
|
-
_baseButton = null;
|
|
64
|
-
ref = null;
|
|
65
|
-
handleRef = el => {
|
|
66
|
-
const elementRef = this.props.elementRef;
|
|
67
|
-
this.ref = el;
|
|
45
|
+
let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class IconButton extends Component {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
this._baseButton = null;
|
|
49
|
+
this.ref = null;
|
|
68
50
|
|
|
69
|
-
|
|
70
|
-
elementRef
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
this.handleRef = el => {
|
|
52
|
+
const elementRef = this.props.elementRef;
|
|
53
|
+
this.ref = el;
|
|
54
|
+
|
|
55
|
+
if (typeof elementRef === 'function') {
|
|
56
|
+
elementRef(el);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
73
60
|
|
|
74
61
|
get focused() {
|
|
75
62
|
return this._baseButton && this._baseButton.focused;
|
|
@@ -122,6 +109,18 @@ let IconButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = testab
|
|
|
122
109
|
}), /*#__PURE__*/React.createElement(ScreenReaderContent, null, screenReaderLabel));
|
|
123
110
|
}
|
|
124
111
|
|
|
125
|
-
}
|
|
112
|
+
}, _class2.displayName = "IconButton", _class2.componentId = 'IconButton', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
113
|
+
type: 'button',
|
|
114
|
+
size: 'medium',
|
|
115
|
+
as: 'button',
|
|
116
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
117
|
+
interaction: void 0,
|
|
118
|
+
color: 'secondary',
|
|
119
|
+
shape: 'rectangle',
|
|
120
|
+
withBackground: true,
|
|
121
|
+
withBorder: true,
|
|
122
|
+
margin: '0',
|
|
123
|
+
cursor: 'pointer'
|
|
124
|
+
}, _class2)) || _class) || _class);
|
|
126
125
|
export default IconButton;
|
|
127
126
|
export { IconButton };
|
package/es/ToggleButton/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"];
|
|
3
3
|
|
|
4
|
-
var _dec, _class;
|
|
4
|
+
var _dec, _class, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -39,38 +39,24 @@ category: components
|
|
|
39
39
|
---
|
|
40
40
|
@tsProps
|
|
41
41
|
**/
|
|
42
|
-
let ToggleButton = (_dec = testable(), _dec(_class = class ToggleButton extends Component {
|
|
43
|
-
static displayName = "ToggleButton";
|
|
44
|
-
static componentId = 'ToggleButton';
|
|
45
|
-
static propTypes = propTypes;
|
|
46
|
-
static allowedProps = allowedProps;
|
|
47
|
-
static defaultProps = {
|
|
48
|
-
size: 'medium',
|
|
49
|
-
as: 'button',
|
|
50
|
-
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
51
|
-
interaction: void 0,
|
|
52
|
-
mountNode: null,
|
|
53
|
-
color: 'secondary',
|
|
54
|
-
placement: 'top center',
|
|
55
|
-
constrain: 'window'
|
|
56
|
-
};
|
|
57
|
-
|
|
42
|
+
let ToggleButton = (_dec = testable(), _dec(_class = (_class2 = class ToggleButton extends Component {
|
|
58
43
|
constructor(props) {
|
|
59
44
|
super(props);
|
|
45
|
+
this.ref = null;
|
|
46
|
+
|
|
47
|
+
this.handleRef = el => {
|
|
48
|
+
const elementRef = this.props.elementRef;
|
|
49
|
+
|
|
50
|
+
if (typeof elementRef === 'function') {
|
|
51
|
+
elementRef(el);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
60
55
|
this.state = {
|
|
61
56
|
isShowingTooltip: props.isShowingTooltip || false
|
|
62
57
|
};
|
|
63
58
|
}
|
|
64
59
|
|
|
65
|
-
ref = null;
|
|
66
|
-
handleRef = el => {
|
|
67
|
-
const elementRef = this.props.elementRef;
|
|
68
|
-
|
|
69
|
-
if (typeof elementRef === 'function') {
|
|
70
|
-
elementRef(el);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
60
|
get isShowingTooltip() {
|
|
75
61
|
return typeof this.props.isShowingTooltip === 'undefined' ? this.state.isShowingTooltip : this.props.isShowingTooltip;
|
|
76
62
|
}
|
|
@@ -123,6 +109,15 @@ let ToggleButton = (_dec = testable(), _dec(_class = class ToggleButton extends
|
|
|
123
109
|
}), callRenderProp(renderIcon)));
|
|
124
110
|
}
|
|
125
111
|
|
|
126
|
-
}
|
|
112
|
+
}, _class2.displayName = "ToggleButton", _class2.componentId = 'ToggleButton', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
113
|
+
size: 'medium',
|
|
114
|
+
as: 'button',
|
|
115
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
116
|
+
interaction: void 0,
|
|
117
|
+
mountNode: null,
|
|
118
|
+
color: 'secondary',
|
|
119
|
+
placement: 'top center',
|
|
120
|
+
constrain: 'window'
|
|
121
|
+
}, _class2)) || _class);
|
|
127
122
|
export { ToggleButton };
|
|
128
123
|
export default ToggleButton;
|
package/lib/BaseButton/index.js
CHANGED
|
@@ -43,7 +43,7 @@ var _props = require("./props");
|
|
|
43
43
|
|
|
44
44
|
const _excluded = ["type", "size", "elementRef", "as", "href", "color", "focusColor", "textAlign", "shape", "display", "withBackground", "withBorder", "isCondensed", "margin", "cursor", "onClick", "renderIcon", "tabIndex", "styles", "makeStyles"];
|
|
45
45
|
|
|
46
|
-
var _dec, _dec2, _class;
|
|
46
|
+
var _dec, _dec2, _class, _class2;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
---
|
|
@@ -51,39 +51,76 @@ category: components/utilities
|
|
|
51
51
|
---
|
|
52
52
|
@tsProps
|
|
53
53
|
**/
|
|
54
|
-
let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class BaseButton extends _react.Component {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class BaseButton extends _react.Component {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
57
|
+
this.ref = null;
|
|
58
|
+
|
|
59
|
+
this.handleElementRef = el => {
|
|
60
|
+
const elementRef = this.props.elementRef;
|
|
61
|
+
this.ref = el;
|
|
62
|
+
|
|
63
|
+
if (typeof elementRef === 'function') {
|
|
64
|
+
elementRef(el);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
this.handleClick = event => {
|
|
69
|
+
const onClick = this.props.onClick;
|
|
70
|
+
const interaction = this.interaction;
|
|
71
|
+
|
|
72
|
+
if (interaction !== 'enabled') {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (typeof onClick === 'function') {
|
|
79
|
+
onClick(event);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
this.handleKeyDown = event => {
|
|
84
|
+
const _this$props = this.props,
|
|
85
|
+
onClick = _this$props.onClick,
|
|
86
|
+
onKeyDown = _this$props.onKeyDown,
|
|
87
|
+
href = _this$props.href;
|
|
88
|
+
const interaction = this.interaction;
|
|
89
|
+
|
|
90
|
+
if (typeof onKeyDown === 'function') {
|
|
91
|
+
onKeyDown(event);
|
|
92
|
+
} // behave like a button when space key is pressed
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
const _keycode$codes = _keycode.default.codes,
|
|
96
|
+
space = _keycode$codes.space,
|
|
97
|
+
enter = _keycode$codes.enter;
|
|
98
|
+
|
|
99
|
+
if (this.elementType !== 'button' && [space, enter].includes(event.keyCode)) {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
event.stopPropagation();
|
|
102
|
+
|
|
103
|
+
if (typeof onClick === 'function' && interaction === 'enabled') {
|
|
104
|
+
onClick(event);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (href) {
|
|
108
|
+
this.ref && this.ref.click();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
76
113
|
|
|
77
114
|
componentDidMount() {
|
|
78
|
-
var _this$props$makeStyle, _this$
|
|
115
|
+
var _this$props$makeStyle, _this$props2;
|
|
79
116
|
|
|
80
|
-
(_this$props$makeStyle = (_this$
|
|
117
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStylesVariables);
|
|
81
118
|
}
|
|
82
119
|
|
|
83
120
|
componentDidUpdate() {
|
|
84
|
-
var _this$props$makeStyle2, _this$
|
|
121
|
+
var _this$props$makeStyle2, _this$props3;
|
|
85
122
|
|
|
86
|
-
(_this$props$makeStyle2 = (_this$
|
|
123
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
|
|
87
124
|
}
|
|
88
125
|
|
|
89
126
|
get _rootElement() {
|
|
@@ -98,9 +135,9 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
98
135
|
}
|
|
99
136
|
|
|
100
137
|
get hasOnlyIconVisible() {
|
|
101
|
-
const _this$
|
|
102
|
-
children = _this$
|
|
103
|
-
renderIcon = _this$
|
|
138
|
+
const _this$props4 = this.props,
|
|
139
|
+
children = _this$props4.children,
|
|
140
|
+
renderIcon = _this$props4.renderIcon;
|
|
104
141
|
return !!(renderIcon && !(0, _hasVisibleChildren.hasVisibleChildren)(children));
|
|
105
142
|
}
|
|
106
143
|
|
|
@@ -139,10 +176,10 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
139
176
|
}
|
|
140
177
|
|
|
141
178
|
get focusColor() {
|
|
142
|
-
const _this$
|
|
143
|
-
color = _this$
|
|
144
|
-
focusColor = _this$
|
|
145
|
-
withBackground = _this$
|
|
179
|
+
const _this$props5 = this.props,
|
|
180
|
+
color = _this$props5.color,
|
|
181
|
+
focusColor = _this$props5.focusColor,
|
|
182
|
+
withBackground = _this$props5.withBackground; // Give user specified focusColor preference
|
|
146
183
|
|
|
147
184
|
if (focusColor) {
|
|
148
185
|
return focusColor;
|
|
@@ -167,58 +204,6 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
167
204
|
this.ref && this.ref.focus();
|
|
168
205
|
}
|
|
169
206
|
|
|
170
|
-
handleElementRef = el => {
|
|
171
|
-
const elementRef = this.props.elementRef;
|
|
172
|
-
this.ref = el;
|
|
173
|
-
|
|
174
|
-
if (typeof elementRef === 'function') {
|
|
175
|
-
elementRef(el);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
handleClick = event => {
|
|
179
|
-
const onClick = this.props.onClick;
|
|
180
|
-
const interaction = this.interaction;
|
|
181
|
-
|
|
182
|
-
if (interaction !== 'enabled') {
|
|
183
|
-
event.preventDefault();
|
|
184
|
-
event.stopPropagation();
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (typeof onClick === 'function') {
|
|
189
|
-
onClick(event);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
handleKeyDown = event => {
|
|
193
|
-
const _this$props5 = this.props,
|
|
194
|
-
onClick = _this$props5.onClick,
|
|
195
|
-
onKeyDown = _this$props5.onKeyDown,
|
|
196
|
-
href = _this$props5.href;
|
|
197
|
-
const interaction = this.interaction;
|
|
198
|
-
|
|
199
|
-
if (typeof onKeyDown === 'function') {
|
|
200
|
-
onKeyDown(event);
|
|
201
|
-
} // behave like a button when space key is pressed
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const _keycode$codes = _keycode.default.codes,
|
|
205
|
-
space = _keycode$codes.space,
|
|
206
|
-
enter = _keycode$codes.enter;
|
|
207
|
-
|
|
208
|
-
if (this.elementType !== 'button' && [space, enter].includes(event.keyCode)) {
|
|
209
|
-
event.preventDefault();
|
|
210
|
-
event.stopPropagation();
|
|
211
|
-
|
|
212
|
-
if (typeof onClick === 'function' && interaction === 'enabled') {
|
|
213
|
-
onClick(event);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (href) {
|
|
217
|
-
this.ref && this.ref.click();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
207
|
renderChildren() {
|
|
223
208
|
const _this$props6 = this.props,
|
|
224
209
|
renderIcon = _this$props6.renderIcon,
|
|
@@ -303,7 +288,22 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
303
288
|
}, this.renderChildren()));
|
|
304
289
|
}
|
|
305
290
|
|
|
306
|
-
}
|
|
291
|
+
}, _class2.displayName = "BaseButton", _class2.componentId = 'BaseButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
292
|
+
type: 'button',
|
|
293
|
+
size: 'medium',
|
|
294
|
+
as: 'button',
|
|
295
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
296
|
+
interaction: void 0,
|
|
297
|
+
color: 'secondary',
|
|
298
|
+
shape: 'rectangle',
|
|
299
|
+
display: 'inline-block',
|
|
300
|
+
textAlign: 'start',
|
|
301
|
+
withBackground: true,
|
|
302
|
+
withBorder: true,
|
|
303
|
+
isCondensed: false,
|
|
304
|
+
margin: '0',
|
|
305
|
+
cursor: 'pointer'
|
|
306
|
+
}, _class2)) || _class) || _class);
|
|
307
307
|
exports.BaseButton = BaseButton;
|
|
308
308
|
var _default = BaseButton;
|
|
309
309
|
exports.default = _default;
|
package/lib/Button/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var _props = require("./props");
|
|
|
29
29
|
|
|
30
30
|
const _excluded = ["children", "type", "size", "as", "color", "focusColor", "display", "textAlign", "withBackground", "margin", "cursor", "href", "renderIcon"];
|
|
31
31
|
|
|
32
|
-
var _dec, _dec2, _class;
|
|
32
|
+
var _dec, _dec2, _class, _class2;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
---
|
|
@@ -38,26 +38,25 @@ category: components
|
|
|
38
38
|
@tsProps
|
|
39
39
|
**/
|
|
40
40
|
// needed for listing the available theme variables on docs page
|
|
41
|
-
let Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class Button extends _react.Component {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
ref = null;
|
|
41
|
+
let Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class Button extends _react.Component {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(...arguments);
|
|
44
|
+
this._buttonComponent = null;
|
|
45
|
+
this.ref = null;
|
|
46
|
+
|
|
47
|
+
this.handleElementRef = el => {
|
|
48
|
+
const elementRef = this.props.elementRef;
|
|
49
|
+
this.ref = el;
|
|
50
|
+
|
|
51
|
+
if (typeof elementRef === 'function') {
|
|
52
|
+
elementRef(el);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
this.handleButtonRef = component => {
|
|
57
|
+
this._buttonComponent = component;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
61
60
|
|
|
62
61
|
get focused() {
|
|
63
62
|
return this._buttonComponent && this._buttonComponent.focused;
|
|
@@ -67,18 +66,6 @@ let Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0,
|
|
|
67
66
|
this._buttonComponent && this._buttonComponent.focus();
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
handleElementRef = el => {
|
|
71
|
-
const elementRef = this.props.elementRef;
|
|
72
|
-
this.ref = el;
|
|
73
|
-
|
|
74
|
-
if (typeof elementRef === 'function') {
|
|
75
|
-
elementRef(el);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
handleButtonRef = component => {
|
|
79
|
-
this._buttonComponent = component;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
69
|
render() {
|
|
83
70
|
const _this$props = this.props,
|
|
84
71
|
children = _this$props.children,
|
|
@@ -120,7 +107,19 @@ let Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0,
|
|
|
120
107
|
return /*#__PURE__*/_react.default.createElement(_BaseButton.BaseButton, buttonProps, children);
|
|
121
108
|
}
|
|
122
109
|
|
|
123
|
-
}
|
|
110
|
+
}, _class2.displayName = "Button", _class2.componentId = 'Button', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
111
|
+
type: 'button',
|
|
112
|
+
size: 'medium',
|
|
113
|
+
as: 'button',
|
|
114
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
115
|
+
interaction: void 0,
|
|
116
|
+
color: 'secondary',
|
|
117
|
+
display: 'inline-block',
|
|
118
|
+
textAlign: 'center',
|
|
119
|
+
withBackground: true,
|
|
120
|
+
margin: '0',
|
|
121
|
+
cursor: 'pointer'
|
|
122
|
+
}, _class2)) || _class) || _class);
|
|
124
123
|
exports.Button = Button;
|
|
125
124
|
var _default = Button;
|
|
126
125
|
exports.default = _default;
|
package/lib/CloseButton/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var _props = require("./props");
|
|
|
33
33
|
|
|
34
34
|
const _excluded = ["screenReaderLabel", "elementRef", "size", "onClick", "margin", "placement", "offset", "type", "as", "href", "cursor", "tabIndex", "styles"];
|
|
35
35
|
|
|
36
|
-
var _dec, _dec2, _class;
|
|
36
|
+
var _dec, _dec2, _class, _class2;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
---
|
|
@@ -41,30 +41,19 @@ category: components
|
|
|
41
41
|
---
|
|
42
42
|
@tsProps
|
|
43
43
|
**/
|
|
44
|
-
let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class CloseButton extends _react.Component {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
as: 'button',
|
|
58
|
-
cursor: 'pointer'
|
|
59
|
-
};
|
|
60
|
-
ref = null;
|
|
61
|
-
handleRef = el => {
|
|
62
|
-
const elementRef = this.props.elementRef;
|
|
63
|
-
|
|
64
|
-
if (typeof elementRef === 'function') {
|
|
65
|
-
elementRef(el);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
44
|
+
let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class CloseButton extends _react.Component {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this.ref = null;
|
|
48
|
+
|
|
49
|
+
this.handleRef = el => {
|
|
50
|
+
const elementRef = this.props.elementRef;
|
|
51
|
+
|
|
52
|
+
if (typeof elementRef === 'function') {
|
|
53
|
+
elementRef(el);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
68
57
|
|
|
69
58
|
componentDidMount() {
|
|
70
59
|
var _this$props$makeStyle, _this$props;
|
|
@@ -126,7 +115,17 @@ let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
|
|
|
126
115
|
}, (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, screenReaderLabel)));
|
|
127
116
|
}
|
|
128
117
|
|
|
129
|
-
}
|
|
118
|
+
}, _class2.displayName = "CloseButton", _class2.componentId = 'CloseButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
119
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
120
|
+
interaction: void 0,
|
|
121
|
+
type: 'button',
|
|
122
|
+
placement: 'static',
|
|
123
|
+
offset: 'x-small',
|
|
124
|
+
size: 'small',
|
|
125
|
+
margin: '0',
|
|
126
|
+
as: 'button',
|
|
127
|
+
cursor: 'pointer'
|
|
128
|
+
}, _class2)) || _class) || _class);
|
|
130
129
|
exports.CloseButton = CloseButton;
|
|
131
130
|
var _default = CloseButton;
|
|
132
131
|
exports.default = _default;
|
|
@@ -27,7 +27,7 @@ var _props = require("./props");
|
|
|
27
27
|
|
|
28
28
|
const _excluded = ["children", "type", "size", "elementRef", "as", "interaction", "color", "margin", "cursor", "href", "renderIcon"];
|
|
29
29
|
|
|
30
|
-
var _dec, _dec2, _class;
|
|
30
|
+
var _dec, _dec2, _class, _class2;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
---
|
|
@@ -36,31 +36,21 @@ category: components
|
|
|
36
36
|
@tsProps
|
|
37
37
|
**/
|
|
38
38
|
// needed for listing the available theme variables on docs page
|
|
39
|
-
let CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class CondensedButton extends _react.Component {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
_baseButton = null;
|
|
55
|
-
ref = null;
|
|
56
|
-
handleRef = el => {
|
|
57
|
-
const elementRef = this.props.elementRef;
|
|
58
|
-
this.ref = el;
|
|
59
|
-
|
|
60
|
-
if (typeof elementRef === 'function') {
|
|
61
|
-
elementRef(el);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
39
|
+
let CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class CondensedButton extends _react.Component {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
this._baseButton = null;
|
|
43
|
+
this.ref = null;
|
|
44
|
+
|
|
45
|
+
this.handleRef = el => {
|
|
46
|
+
const elementRef = this.props.elementRef;
|
|
47
|
+
this.ref = el;
|
|
48
|
+
|
|
49
|
+
if (typeof elementRef === 'function') {
|
|
50
|
+
elementRef(el);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
64
54
|
|
|
65
55
|
get focused() {
|
|
66
56
|
return this._baseButton && this._baseButton.focused;
|
|
@@ -106,7 +96,16 @@ let CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _de
|
|
|
106
96
|
}), children);
|
|
107
97
|
}
|
|
108
98
|
|
|
109
|
-
}
|
|
99
|
+
}, _class2.displayName = "CondensedButton", _class2.componentId = 'CondensedButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
100
|
+
type: 'button',
|
|
101
|
+
size: 'medium',
|
|
102
|
+
as: 'button',
|
|
103
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
104
|
+
interaction: void 0,
|
|
105
|
+
color: 'primary',
|
|
106
|
+
margin: '0',
|
|
107
|
+
cursor: 'pointer'
|
|
108
|
+
}, _class2)) || _class) || _class);
|
|
110
109
|
exports.CondensedButton = CondensedButton;
|
|
111
110
|
var _default = CondensedButton;
|
|
112
111
|
exports.default = _default;
|
package/lib/IconButton/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var _props = require("./props");
|
|
|
29
29
|
|
|
30
30
|
const _excluded = ["children", "renderIcon", "screenReaderLabel", "type", "size", "elementRef", "as", "interaction", "color", "focusColor", "shape", "withBackground", "withBorder", "margin", "cursor", "href"];
|
|
31
31
|
|
|
32
|
-
var _dec, _dec2, _class;
|
|
32
|
+
var _dec, _dec2, _class, _class2;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
---
|
|
@@ -38,34 +38,21 @@ category: components
|
|
|
38
38
|
@tsProps
|
|
39
39
|
**/
|
|
40
40
|
// needed for listing the available theme variables on docs page
|
|
41
|
-
let IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class IconButton extends _react.Component {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
margin: '0',
|
|
57
|
-
cursor: 'pointer'
|
|
58
|
-
};
|
|
59
|
-
_baseButton = null;
|
|
60
|
-
ref = null;
|
|
61
|
-
handleRef = el => {
|
|
62
|
-
const elementRef = this.props.elementRef;
|
|
63
|
-
this.ref = el;
|
|
64
|
-
|
|
65
|
-
if (typeof elementRef === 'function') {
|
|
66
|
-
elementRef(el);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
41
|
+
let IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class IconButton extends _react.Component {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(...arguments);
|
|
44
|
+
this._baseButton = null;
|
|
45
|
+
this.ref = null;
|
|
46
|
+
|
|
47
|
+
this.handleRef = el => {
|
|
48
|
+
const elementRef = this.props.elementRef;
|
|
49
|
+
this.ref = el;
|
|
50
|
+
|
|
51
|
+
if (typeof elementRef === 'function') {
|
|
52
|
+
elementRef(el);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
69
56
|
|
|
70
57
|
get focused() {
|
|
71
58
|
return this._baseButton && this._baseButton.focused;
|
|
@@ -117,7 +104,19 @@ let IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 =
|
|
|
117
104
|
}), /*#__PURE__*/_react.default.createElement(_ScreenReaderContent.ScreenReaderContent, null, screenReaderLabel));
|
|
118
105
|
}
|
|
119
106
|
|
|
120
|
-
}
|
|
107
|
+
}, _class2.displayName = "IconButton", _class2.componentId = 'IconButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
108
|
+
type: 'button',
|
|
109
|
+
size: 'medium',
|
|
110
|
+
as: 'button',
|
|
111
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
112
|
+
interaction: void 0,
|
|
113
|
+
color: 'secondary',
|
|
114
|
+
shape: 'rectangle',
|
|
115
|
+
withBackground: true,
|
|
116
|
+
withBorder: true,
|
|
117
|
+
margin: '0',
|
|
118
|
+
cursor: 'pointer'
|
|
119
|
+
}, _class2)) || _class) || _class);
|
|
121
120
|
exports.IconButton = IconButton;
|
|
122
121
|
var _default = IconButton;
|
|
123
122
|
exports.default = _default;
|
|
@@ -27,7 +27,7 @@ var _props = require("./props");
|
|
|
27
27
|
|
|
28
28
|
const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"];
|
|
29
29
|
|
|
30
|
-
var _dec, _class;
|
|
30
|
+
var _dec, _class, _class2;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
---
|
|
@@ -35,38 +35,24 @@ category: components
|
|
|
35
35
|
---
|
|
36
36
|
@tsProps
|
|
37
37
|
**/
|
|
38
|
-
let ToggleButton = (_dec = (0, _testable.testable)(), _dec(_class = class ToggleButton extends _react.Component {
|
|
39
|
-
static displayName = "ToggleButton";
|
|
40
|
-
static componentId = 'ToggleButton';
|
|
41
|
-
static propTypes = _props.propTypes;
|
|
42
|
-
static allowedProps = _props.allowedProps;
|
|
43
|
-
static defaultProps = {
|
|
44
|
-
size: 'medium',
|
|
45
|
-
as: 'button',
|
|
46
|
-
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
47
|
-
interaction: void 0,
|
|
48
|
-
mountNode: null,
|
|
49
|
-
color: 'secondary',
|
|
50
|
-
placement: 'top center',
|
|
51
|
-
constrain: 'window'
|
|
52
|
-
};
|
|
53
|
-
|
|
38
|
+
let ToggleButton = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = class ToggleButton extends _react.Component {
|
|
54
39
|
constructor(props) {
|
|
55
40
|
super(props);
|
|
41
|
+
this.ref = null;
|
|
42
|
+
|
|
43
|
+
this.handleRef = el => {
|
|
44
|
+
const elementRef = this.props.elementRef;
|
|
45
|
+
|
|
46
|
+
if (typeof elementRef === 'function') {
|
|
47
|
+
elementRef(el);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
56
51
|
this.state = {
|
|
57
52
|
isShowingTooltip: props.isShowingTooltip || false
|
|
58
53
|
};
|
|
59
54
|
}
|
|
60
55
|
|
|
61
|
-
ref = null;
|
|
62
|
-
handleRef = el => {
|
|
63
|
-
const elementRef = this.props.elementRef;
|
|
64
|
-
|
|
65
|
-
if (typeof elementRef === 'function') {
|
|
66
|
-
elementRef(el);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
56
|
get isShowingTooltip() {
|
|
71
57
|
return typeof this.props.isShowingTooltip === 'undefined' ? this.state.isShowingTooltip : this.props.isShowingTooltip;
|
|
72
58
|
}
|
|
@@ -118,7 +104,16 @@ let ToggleButton = (_dec = (0, _testable.testable)(), _dec(_class = class Toggle
|
|
|
118
104
|
}), (0, _callRenderProp.callRenderProp)(renderIcon)));
|
|
119
105
|
}
|
|
120
106
|
|
|
121
|
-
}
|
|
107
|
+
}, _class2.displayName = "ToggleButton", _class2.componentId = 'ToggleButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
108
|
+
size: 'medium',
|
|
109
|
+
as: 'button',
|
|
110
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
111
|
+
interaction: void 0,
|
|
112
|
+
mountNode: null,
|
|
113
|
+
color: 'secondary',
|
|
114
|
+
placement: 'top center',
|
|
115
|
+
constrain: 'window'
|
|
116
|
+
}, _class2)) || _class);
|
|
122
117
|
exports.ToggleButton = ToggleButton;
|
|
123
118
|
var _default = ToggleButton;
|
|
124
119
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-buttons",
|
|
3
|
-
"version": "8.25.1-snapshot-
|
|
3
|
+
"version": "8.25.1-snapshot-13",
|
|
4
4
|
"description": "Accessible button components",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,28 +23,28 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.25.1-snapshot-
|
|
27
|
-
"@instructure/ui-test-locator": "8.25.1-snapshot-
|
|
28
|
-
"@instructure/ui-test-queries": "8.25.1-snapshot-
|
|
29
|
-
"@instructure/ui-test-utils": "8.25.1-snapshot-
|
|
30
|
-
"@instructure/ui-themes": "8.25.1-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.25.1-snapshot-13",
|
|
27
|
+
"@instructure/ui-test-locator": "8.25.1-snapshot-13",
|
|
28
|
+
"@instructure/ui-test-queries": "8.25.1-snapshot-13",
|
|
29
|
+
"@instructure/ui-test-utils": "8.25.1-snapshot-13",
|
|
30
|
+
"@instructure/ui-themes": "8.25.1-snapshot-13"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/console": "8.25.1-snapshot-
|
|
35
|
-
"@instructure/emotion": "8.25.1-snapshot-
|
|
36
|
-
"@instructure/shared-types": "8.25.1-snapshot-
|
|
37
|
-
"@instructure/ui-a11y-content": "8.25.1-snapshot-
|
|
38
|
-
"@instructure/ui-a11y-utils": "8.25.1-snapshot-
|
|
39
|
-
"@instructure/ui-color-utils": "8.25.1-snapshot-
|
|
40
|
-
"@instructure/ui-dom-utils": "8.25.1-snapshot-
|
|
41
|
-
"@instructure/ui-icons": "8.25.1-snapshot-
|
|
42
|
-
"@instructure/ui-position": "8.25.1-snapshot-
|
|
43
|
-
"@instructure/ui-react-utils": "8.25.1-snapshot-
|
|
44
|
-
"@instructure/ui-testable": "8.25.1-snapshot-
|
|
45
|
-
"@instructure/ui-tooltip": "8.25.1-snapshot-
|
|
46
|
-
"@instructure/ui-utils": "8.25.1-snapshot-
|
|
47
|
-
"@instructure/ui-view": "8.25.1-snapshot-
|
|
34
|
+
"@instructure/console": "8.25.1-snapshot-13",
|
|
35
|
+
"@instructure/emotion": "8.25.1-snapshot-13",
|
|
36
|
+
"@instructure/shared-types": "8.25.1-snapshot-13",
|
|
37
|
+
"@instructure/ui-a11y-content": "8.25.1-snapshot-13",
|
|
38
|
+
"@instructure/ui-a11y-utils": "8.25.1-snapshot-13",
|
|
39
|
+
"@instructure/ui-color-utils": "8.25.1-snapshot-13",
|
|
40
|
+
"@instructure/ui-dom-utils": "8.25.1-snapshot-13",
|
|
41
|
+
"@instructure/ui-icons": "8.25.1-snapshot-13",
|
|
42
|
+
"@instructure/ui-position": "8.25.1-snapshot-13",
|
|
43
|
+
"@instructure/ui-react-utils": "8.25.1-snapshot-13",
|
|
44
|
+
"@instructure/ui-testable": "8.25.1-snapshot-13",
|
|
45
|
+
"@instructure/ui-tooltip": "8.25.1-snapshot-13",
|
|
46
|
+
"@instructure/ui-utils": "8.25.1-snapshot-13",
|
|
47
|
+
"@instructure/ui-view": "8.25.1-snapshot-13",
|
|
48
48
|
"keycode": "^2",
|
|
49
49
|
"prop-types": "^15"
|
|
50
50
|
},
|