@instructure/ui-buttons 8.33.1 → 8.33.2-snapshot-5
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 +8 -0
- package/es/BaseButton/BaseButtonLocator.js +3 -2
- package/es/BaseButton/index.js +44 -80
- package/es/BaseButton/locator.js +1 -0
- package/es/BaseButton/props.js +1 -0
- package/es/BaseButton/styles.js +12 -17
- package/es/BaseButton/theme.js +17 -17
- package/es/Button/ButtonLocator.js +2 -2
- package/es/Button/index.js +17 -26
- package/es/Button/props.js +1 -0
- package/es/Button/theme.js +1 -0
- package/es/CloseButton/CloseButtonLocator.js +3 -1
- package/es/CloseButton/index.js +14 -28
- package/es/CloseButton/locator.js +1 -0
- package/es/CloseButton/props.js +1 -0
- package/es/CloseButton/styles.js +3 -5
- package/es/CloseButton/theme.js +3 -3
- package/es/CondensedButton/CondensedButtonLocator.js +2 -2
- package/es/CondensedButton/index.js +13 -22
- package/es/CondensedButton/props.js +1 -0
- package/es/CondensedButton/theme.js +1 -0
- package/es/IconButton/IconButtonLocator.js +2 -2
- package/es/IconButton/index.js +18 -27
- package/es/IconButton/props.js +1 -0
- package/es/IconButton/theme.js +1 -0
- package/es/ToggleButton/ToggleButtonLocator.js +9 -8
- package/es/ToggleButton/index.js +14 -23
- package/es/ToggleButton/props.js +1 -0
- package/es/index.js +1 -0
- package/lib/BaseButton/BaseButtonLocator.js +1 -5
- package/lib/BaseButton/index.js +44 -97
- package/lib/BaseButton/locator.js +0 -2
- package/lib/BaseButton/props.js +1 -4
- package/lib/BaseButton/styles.js +12 -18
- package/lib/BaseButton/theme.js +17 -20
- package/lib/Button/ButtonLocator.js +1 -5
- package/lib/Button/index.js +16 -36
- package/lib/Button/locator.js +0 -2
- package/lib/Button/props.js +1 -4
- package/lib/Button/theme.js +0 -2
- package/lib/CloseButton/CloseButtonLocator.js +1 -3
- package/lib/CloseButton/index.js +14 -40
- package/lib/CloseButton/locator.js +0 -2
- package/lib/CloseButton/props.js +1 -4
- package/lib/CloseButton/styles.js +3 -6
- package/lib/CloseButton/theme.js +3 -4
- package/lib/CondensedButton/CondensedButtonLocator.js +1 -5
- package/lib/CondensedButton/index.js +12 -31
- package/lib/CondensedButton/locator.js +0 -2
- package/lib/CondensedButton/props.js +1 -4
- package/lib/CondensedButton/theme.js +0 -2
- package/lib/IconButton/IconButtonLocator.js +1 -5
- package/lib/IconButton/index.js +17 -37
- package/lib/IconButton/locator.js +0 -2
- package/lib/IconButton/props.js +1 -4
- package/lib/IconButton/theme.js +0 -2
- package/lib/ToggleButton/ToggleButtonLocator.js +5 -10
- package/lib/ToggleButton/index.js +13 -32
- package/lib/ToggleButton/props.js +1 -4
- package/lib/index.js +0 -6
- package/package.json +20 -20
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Button/index.d.ts +2 -2
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CloseButtonLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _index = require("./index");
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _index = require("./index");
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
36
34
|
const CloseButtonLocator = (0, _locator.locator)(_index.CloseButton.selector);
|
|
37
35
|
exports.CloseButtonLocator = CloseButtonLocator;
|
package/lib/CloseButton/index.js
CHANGED
|
@@ -1,40 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.CloseButton = void 0;
|
|
9
|
-
|
|
10
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
var _IconXSolid = require("@instructure/ui-icons/lib/IconXSolid.js");
|
|
15
|
-
|
|
16
11
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
17
|
-
|
|
18
12
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
19
|
-
|
|
20
13
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
21
|
-
|
|
22
14
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
23
|
-
|
|
24
15
|
var _emotion = require("@instructure/emotion");
|
|
25
|
-
|
|
26
16
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
27
|
-
|
|
28
17
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
29
|
-
|
|
30
18
|
var _BaseButton = require("../BaseButton");
|
|
31
|
-
|
|
32
19
|
var _props = require("./props");
|
|
33
|
-
|
|
34
20
|
const _excluded = ["screenReaderLabel", "elementRef", "size", "onClick", "margin", "placement", "offset", "type", "as", "href", "cursor", "tabIndex", "styles"];
|
|
35
|
-
|
|
36
21
|
var _dec, _dec2, _class, _class2;
|
|
37
|
-
|
|
38
22
|
/**
|
|
39
23
|
---
|
|
40
24
|
category: components
|
|
@@ -45,55 +29,46 @@ let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
|
|
|
45
29
|
constructor() {
|
|
46
30
|
super(...arguments);
|
|
47
31
|
this.ref = null;
|
|
48
|
-
|
|
49
32
|
this.handleRef = el => {
|
|
50
33
|
const elementRef = this.props.elementRef;
|
|
51
|
-
|
|
52
34
|
if (typeof elementRef === 'function') {
|
|
53
35
|
elementRef(el);
|
|
54
36
|
}
|
|
55
37
|
};
|
|
56
38
|
}
|
|
57
|
-
|
|
58
39
|
componentDidMount() {
|
|
59
40
|
var _this$props$makeStyle, _this$props;
|
|
60
|
-
|
|
61
41
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
62
42
|
}
|
|
63
|
-
|
|
64
43
|
componentDidUpdate() {
|
|
65
44
|
var _this$props$makeStyle2, _this$props2;
|
|
66
|
-
|
|
67
45
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
68
46
|
}
|
|
69
|
-
|
|
70
47
|
get interaction() {
|
|
71
48
|
return (0, _getInteraction.getInteraction)({
|
|
72
49
|
props: this.props
|
|
73
50
|
});
|
|
74
51
|
}
|
|
75
|
-
|
|
76
52
|
get color() {
|
|
77
53
|
const color = this.props.color;
|
|
78
54
|
return color === 'primary' ? 'secondary' : color;
|
|
79
55
|
}
|
|
80
|
-
|
|
81
56
|
render() {
|
|
82
57
|
const _this$props3 = this.props,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
58
|
+
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
59
|
+
elementRef = _this$props3.elementRef,
|
|
60
|
+
size = _this$props3.size,
|
|
61
|
+
onClick = _this$props3.onClick,
|
|
62
|
+
margin = _this$props3.margin,
|
|
63
|
+
placement = _this$props3.placement,
|
|
64
|
+
offset = _this$props3.offset,
|
|
65
|
+
type = _this$props3.type,
|
|
66
|
+
as = _this$props3.as,
|
|
67
|
+
href = _this$props3.href,
|
|
68
|
+
cursor = _this$props3.cursor,
|
|
69
|
+
tabIndex = _this$props3.tabIndex,
|
|
70
|
+
styles = _this$props3.styles,
|
|
71
|
+
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
97
72
|
return (0, _emotion.jsx)("span", Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
98
73
|
css: styles === null || styles === void 0 ? void 0 : styles.closeButton,
|
|
99
74
|
ref: el => this.ref = el
|
|
@@ -114,7 +89,6 @@ let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
|
|
|
114
89
|
tabIndex: tabIndex
|
|
115
90
|
}, (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, screenReaderLabel)));
|
|
116
91
|
}
|
|
117
|
-
|
|
118
92
|
}, _class2.displayName = "CloseButton", _class2.componentId = 'CloseButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
119
93
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
120
94
|
interaction: void 0,
|
package/lib/CloseButton/props.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _emotion = require("@instructure/emotion");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,6 +30,7 @@ var _emotion = require("@instructure/emotion");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
const propTypes = {
|
|
38
35
|
screenReaderLabel: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired,
|
|
39
36
|
color: _propTypes.default.oneOf(['primary', 'primary-inverse']),
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -41,24 +40,23 @@ exports.default = void 0;
|
|
|
41
40
|
*/
|
|
42
41
|
const generateStyle = (componentTheme, props) => {
|
|
43
42
|
const placement = props.placement,
|
|
44
|
-
|
|
43
|
+
offset = props.offset;
|
|
45
44
|
const offsetValueMap = {
|
|
46
45
|
none: 0,
|
|
47
46
|
'x-small': componentTheme.offsetXSmall,
|
|
48
47
|
small: componentTheme.offsetSmall,
|
|
49
48
|
medium: componentTheme.offsetMedium
|
|
50
49
|
};
|
|
51
|
-
|
|
52
50
|
const getOffsetStyle = () => {
|
|
53
51
|
const offsetValue = offsetValueMap[offset];
|
|
54
|
-
return {
|
|
52
|
+
return {
|
|
53
|
+
...(offsetValue !== 0 && {
|
|
55
54
|
top: offsetValue
|
|
56
55
|
}),
|
|
57
56
|
insetInlineStart: placement === 'start' ? offsetValue : 'auto',
|
|
58
57
|
insetInlineEnd: placement === 'end' ? offsetValue : 'auto'
|
|
59
58
|
};
|
|
60
59
|
};
|
|
61
|
-
|
|
62
60
|
return {
|
|
63
61
|
closeButton: {
|
|
64
62
|
label: 'closeButton',
|
|
@@ -73,6 +71,5 @@ const generateStyle = (componentTheme, props) => {
|
|
|
73
71
|
}
|
|
74
72
|
};
|
|
75
73
|
};
|
|
76
|
-
|
|
77
74
|
var _default = generateStyle;
|
|
78
75
|
exports.default = _default;
|
package/lib/CloseButton/theme.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,16 +35,16 @@ exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const spacing = theme.spacing,
|
|
39
|
-
|
|
38
|
+
stacking = theme.stacking;
|
|
40
39
|
const componentVariables = {
|
|
41
40
|
offsetMedium: spacing === null || spacing === void 0 ? void 0 : spacing.medium,
|
|
42
41
|
offsetSmall: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
43
42
|
offsetXSmall: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
|
|
44
43
|
zIndex: stacking === null || stacking === void 0 ? void 0 : stacking.above
|
|
45
44
|
};
|
|
46
|
-
return {
|
|
45
|
+
return {
|
|
46
|
+
...componentVariables
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
|
|
50
49
|
var _default = generateComponentTheme;
|
|
51
50
|
exports.default = _default;
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CondensedButtonLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _uiTestQueries = require("@instructure/ui-test-queries");
|
|
11
|
-
|
|
12
9
|
var _index = require("./index");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,13 +30,13 @@ var _index = require("./index");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
38
35
|
const CondensedButtonLocator = (0, _locator.locator)(_index.CondensedButton.selector, {
|
|
39
36
|
click: async function (element) {
|
|
40
37
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
41
38
|
args[_key - 1] = arguments[_key];
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
return (await (0, _uiTestQueries.find)(element, 'a,button,[role="button"]')).click(...args);
|
|
45
41
|
}
|
|
46
42
|
});
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.CondensedButton = void 0;
|
|
11
|
-
|
|
12
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
17
|
-
|
|
18
12
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
19
|
-
|
|
20
13
|
var _emotion = require("@instructure/emotion");
|
|
21
|
-
|
|
22
14
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
23
|
-
|
|
24
15
|
var _BaseButton = require("../BaseButton");
|
|
25
|
-
|
|
26
16
|
var _props = require("./props");
|
|
27
|
-
|
|
28
17
|
const _excluded = ["children", "type", "size", "elementRef", "as", "interaction", "color", "margin", "cursor", "href", "renderIcon"];
|
|
29
|
-
|
|
30
18
|
var _dec, _dec2, _class, _class2;
|
|
31
|
-
|
|
32
19
|
/**
|
|
33
20
|
---
|
|
34
21
|
category: components
|
|
@@ -41,39 +28,34 @@ let CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _de
|
|
|
41
28
|
super(...arguments);
|
|
42
29
|
this._baseButton = null;
|
|
43
30
|
this.ref = null;
|
|
44
|
-
|
|
45
31
|
this.handleRef = el => {
|
|
46
32
|
const elementRef = this.props.elementRef;
|
|
47
33
|
this.ref = el;
|
|
48
|
-
|
|
49
34
|
if (typeof elementRef === 'function') {
|
|
50
35
|
elementRef(el);
|
|
51
36
|
}
|
|
52
37
|
};
|
|
53
38
|
}
|
|
54
|
-
|
|
55
39
|
get focused() {
|
|
56
40
|
return this._baseButton && this._baseButton.focused;
|
|
57
41
|
}
|
|
58
|
-
|
|
59
42
|
focus() {
|
|
60
43
|
this._baseButton && this._baseButton.focus();
|
|
61
44
|
}
|
|
62
|
-
|
|
63
45
|
render() {
|
|
64
46
|
const _this$props = this.props,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
47
|
+
children = _this$props.children,
|
|
48
|
+
type = _this$props.type,
|
|
49
|
+
size = _this$props.size,
|
|
50
|
+
elementRef = _this$props.elementRef,
|
|
51
|
+
as = _this$props.as,
|
|
52
|
+
interaction = _this$props.interaction,
|
|
53
|
+
color = _this$props.color,
|
|
54
|
+
margin = _this$props.margin,
|
|
55
|
+
cursor = _this$props.cursor,
|
|
56
|
+
href = _this$props.href,
|
|
57
|
+
renderIcon = _this$props.renderIcon,
|
|
58
|
+
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
77
59
|
const themeOverride = this.props.themeOverride;
|
|
78
60
|
return /*#__PURE__*/_react.default.createElement(_BaseButton.BaseButton, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
79
61
|
isCondensed: true,
|
|
@@ -95,7 +77,6 @@ let CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _de
|
|
|
95
77
|
}
|
|
96
78
|
}), children);
|
|
97
79
|
}
|
|
98
|
-
|
|
99
80
|
}, _class2.displayName = "CondensedButton", _class2.componentId = 'CondensedButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
100
81
|
type: 'button',
|
|
101
82
|
size: 'medium',
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _emotion = require("@instructure/emotion");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,6 +30,7 @@ var _emotion = require("@instructure/emotion");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
const propTypes = {
|
|
38
35
|
children: _propTypes.default.node,
|
|
39
36
|
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -11,5 +10,4 @@ Object.defineProperty(exports, "default", {
|
|
|
11
10
|
return _theme.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
var _theme = _interopRequireDefault(require("../BaseButton/theme"));
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.IconButtonLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _uiTestQueries = require("@instructure/ui-test-queries");
|
|
11
|
-
|
|
12
9
|
var _index = require("./index");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,13 +30,13 @@ var _index = require("./index");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
38
35
|
const IconButtonLocator = (0, _locator.locator)(_index.IconButton.selector, {
|
|
39
36
|
click: async function (element) {
|
|
40
37
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
41
38
|
args[_key - 1] = arguments[_key];
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
return (await (0, _uiTestQueries.find)(element, 'a,button,[role="button"]')).click(...args);
|
|
45
41
|
}
|
|
46
42
|
});
|
package/lib/IconButton/index.js
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.IconButton = void 0;
|
|
11
|
-
|
|
12
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
17
|
-
|
|
18
12
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
19
|
-
|
|
20
13
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
21
|
-
|
|
22
14
|
var _emotion = require("@instructure/emotion");
|
|
23
|
-
|
|
24
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
25
|
-
|
|
26
16
|
var _BaseButton = require("../BaseButton");
|
|
27
|
-
|
|
28
17
|
var _props = require("./props");
|
|
29
|
-
|
|
30
18
|
const _excluded = ["children", "renderIcon", "screenReaderLabel", "type", "size", "elementRef", "as", "interaction", "color", "focusColor", "shape", "withBackground", "withBorder", "margin", "cursor", "href"];
|
|
31
|
-
|
|
32
19
|
var _dec, _dec2, _class, _class2;
|
|
33
|
-
|
|
34
20
|
/**
|
|
35
21
|
---
|
|
36
22
|
category: components
|
|
@@ -43,44 +29,39 @@ let IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 =
|
|
|
43
29
|
super(...arguments);
|
|
44
30
|
this._baseButton = null;
|
|
45
31
|
this.ref = null;
|
|
46
|
-
|
|
47
32
|
this.handleRef = el => {
|
|
48
33
|
const elementRef = this.props.elementRef;
|
|
49
34
|
this.ref = el;
|
|
50
|
-
|
|
51
35
|
if (typeof elementRef === 'function') {
|
|
52
36
|
elementRef(el);
|
|
53
37
|
}
|
|
54
38
|
};
|
|
55
39
|
}
|
|
56
|
-
|
|
57
40
|
get focused() {
|
|
58
41
|
return this._baseButton && this._baseButton.focused;
|
|
59
42
|
}
|
|
60
|
-
|
|
61
43
|
focus() {
|
|
62
44
|
this._baseButton && this._baseButton.focus();
|
|
63
45
|
}
|
|
64
|
-
|
|
65
46
|
render() {
|
|
66
47
|
const _this$props = this.props,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
48
|
+
children = _this$props.children,
|
|
49
|
+
renderIcon = _this$props.renderIcon,
|
|
50
|
+
screenReaderLabel = _this$props.screenReaderLabel,
|
|
51
|
+
type = _this$props.type,
|
|
52
|
+
size = _this$props.size,
|
|
53
|
+
elementRef = _this$props.elementRef,
|
|
54
|
+
as = _this$props.as,
|
|
55
|
+
interaction = _this$props.interaction,
|
|
56
|
+
color = _this$props.color,
|
|
57
|
+
focusColor = _this$props.focusColor,
|
|
58
|
+
shape = _this$props.shape,
|
|
59
|
+
withBackground = _this$props.withBackground,
|
|
60
|
+
withBorder = _this$props.withBorder,
|
|
61
|
+
margin = _this$props.margin,
|
|
62
|
+
cursor = _this$props.cursor,
|
|
63
|
+
href = _this$props.href,
|
|
64
|
+
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
84
65
|
const themeOverride = this.props.themeOverride;
|
|
85
66
|
return /*#__PURE__*/_react.default.createElement(_BaseButton.BaseButton, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
86
67
|
type: type,
|
|
@@ -103,7 +84,6 @@ let IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 =
|
|
|
103
84
|
}
|
|
104
85
|
}), /*#__PURE__*/_react.default.createElement(_ScreenReaderContent.ScreenReaderContent, null, screenReaderLabel));
|
|
105
86
|
}
|
|
106
|
-
|
|
107
87
|
}, _class2.displayName = "IconButton", _class2.componentId = 'IconButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
108
88
|
type: 'button',
|
|
109
89
|
size: 'medium',
|
package/lib/IconButton/props.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _emotion = require("@instructure/emotion");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,6 +30,7 @@ var _emotion = require("@instructure/emotion");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
const propTypes = {
|
|
38
35
|
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
39
36
|
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
package/lib/IconButton/theme.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -11,5 +10,4 @@ Object.defineProperty(exports, "default", {
|
|
|
11
10
|
return _theme.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
var _theme = _interopRequireDefault(require("../BaseButton/theme"));
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ToggleButtonLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _uiTestQueries = require("@instructure/ui-test-queries");
|
|
11
|
-
|
|
12
9
|
var _TooltipLocator = require("@instructure/ui-tooltip/lib/Tooltip/TooltipLocator");
|
|
13
|
-
|
|
14
10
|
var _index = require("./index");
|
|
15
|
-
|
|
16
11
|
/*
|
|
17
12
|
* The MIT License (MIT)
|
|
18
13
|
*
|
|
@@ -36,16 +31,17 @@ var _index = require("./index");
|
|
|
36
31
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
32
|
* SOFTWARE.
|
|
38
33
|
*/
|
|
34
|
+
|
|
39
35
|
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
40
36
|
// eslint-disable-next-line no-restricted-imports
|
|
37
|
+
|
|
41
38
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
42
39
|
const ToggleButtonLocator = (0, _locator.locator)(_index.ToggleButton.selector, {
|
|
43
40
|
findTooltipContent: async function () {
|
|
44
41
|
const _parseQueryArguments = (0, _uiTestQueries.parseQueryArguments)(...arguments),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
element = _parseQueryArguments.element,
|
|
43
|
+
selector = _parseQueryArguments.selector,
|
|
44
|
+
options = _parseQueryArguments.options;
|
|
49
45
|
const tooltip = await _TooltipLocator.TooltipLocator.find(element, options);
|
|
50
46
|
return tooltip ? tooltip.findContent(selector, options) : null;
|
|
51
47
|
},
|
|
@@ -53,7 +49,6 @@ const ToggleButtonLocator = (0, _locator.locator)(_index.ToggleButton.selector,
|
|
|
53
49
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
54
50
|
args[_key - 1] = arguments[_key];
|
|
55
51
|
}
|
|
56
|
-
|
|
57
52
|
return (await (0, _uiTestQueries.find)(element, 'a,button,[role="button"]')).click(...args);
|
|
58
53
|
}
|
|
59
54
|
});
|