@instructure/ui-buttons 10.26.1 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -1
- package/es/BaseButton/index.js +9 -6
- package/es/BaseButton/props.js +1 -26
- package/es/Button/index.js +6 -6
- package/es/Button/props.js +1 -20
- package/es/CloseButton/index.js +12 -8
- package/es/CloseButton/props.js +1 -18
- package/es/CondensedButton/index.js +6 -6
- package/es/CondensedButton/props.js +1 -17
- package/es/IconButton/index.js +7 -6
- package/es/IconButton/props.js +1 -21
- package/es/ToggleButton/index.js +10 -6
- package/es/ToggleButton/props.js +1 -19
- package/lib/BaseButton/index.js +8 -5
- package/lib/BaseButton/props.js +1 -27
- package/lib/Button/index.js +5 -5
- package/lib/Button/props.js +1 -21
- package/lib/CloseButton/index.js +11 -7
- package/lib/CloseButton/props.js +1 -19
- package/lib/CondensedButton/index.js +5 -5
- package/lib/CondensedButton/props.js +1 -18
- package/lib/IconButton/index.js +6 -5
- package/lib/IconButton/props.js +1 -22
- package/lib/ToggleButton/index.js +10 -5
- package/lib/ToggleButton/props.js +1 -20
- package/package.json +20 -23
- package/src/BaseButton/index.tsx +7 -4
- package/src/BaseButton/props.ts +3 -40
- package/src/Button/index.tsx +6 -5
- package/src/Button/props.ts +2 -33
- package/src/CloseButton/index.tsx +6 -6
- package/src/CloseButton/props.ts +3 -25
- package/src/CondensedButton/index.tsx +2 -4
- package/src/CondensedButton/props.ts +3 -22
- package/src/IconButton/index.tsx +3 -4
- package/src/IconButton/props.ts +2 -33
- package/src/ToggleButton/index.tsx +2 -5
- package/src/ToggleButton/props.ts +2 -31
- package/tsconfig.build.json +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/BaseButton/index.d.ts +1 -2
- package/types/BaseButton/index.d.ts.map +1 -1
- package/types/BaseButton/props.d.ts +3 -4
- package/types/BaseButton/props.d.ts.map +1 -1
- package/types/Button/index.d.ts +1 -19
- package/types/Button/index.d.ts.map +1 -1
- package/types/Button/props.d.ts +3 -4
- package/types/Button/props.d.ts.map +1 -1
- package/types/CloseButton/index.d.ts +1 -17
- package/types/CloseButton/index.d.ts.map +1 -1
- package/types/CloseButton/props.d.ts +3 -4
- package/types/CloseButton/props.d.ts.map +1 -1
- package/types/CondensedButton/index.d.ts +1 -16
- package/types/CondensedButton/index.d.ts.map +1 -1
- package/types/CondensedButton/props.d.ts +3 -4
- package/types/CondensedButton/props.d.ts.map +1 -1
- package/types/IconButton/index.d.ts +1 -20
- package/types/IconButton/index.d.ts.map +1 -1
- package/types/IconButton/props.d.ts +3 -4
- package/types/IconButton/props.d.ts.map +1 -1
- package/types/ToggleButton/index.d.ts +0 -16
- package/types/ToggleButton/index.d.ts.map +1 -1
- package/types/ToggleButton/props.d.ts +2 -3
- package/types/ToggleButton/props.d.ts.map +1 -1
package/lib/Button/index.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Button = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
11
10
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
12
11
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
13
12
|
var _emotion = require("@instructure/emotion");
|
|
@@ -16,7 +15,7 @@ var _BaseButton = require("../BaseButton");
|
|
|
16
15
|
var _props = require("./props");
|
|
17
16
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
18
17
|
const _excluded = ["children", "type", "size", "as", "color", "focusColor", "display", "textAlign", "withBackground", "margin", "cursor", "href", "renderIcon"];
|
|
19
|
-
var _dec,
|
|
18
|
+
var _dec, _class, _Button;
|
|
20
19
|
/*
|
|
21
20
|
* The MIT License (MIT)
|
|
22
21
|
*
|
|
@@ -46,7 +45,7 @@ category: components
|
|
|
46
45
|
---
|
|
47
46
|
**/
|
|
48
47
|
// needed for listing the available theme variables on docs page
|
|
49
|
-
let Button = exports.Button = (_dec = (0, _emotion.withStyle)(null, _theme.default),
|
|
48
|
+
let Button = exports.Button = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec(_class = (_Button = class Button extends _react.Component {
|
|
50
49
|
constructor(...args) {
|
|
51
50
|
super(...args);
|
|
52
51
|
this._buttonComponent = null;
|
|
@@ -109,10 +108,11 @@ let Button = exports.Button = (_dec = (0, _emotion.withStyle)(null, _theme.defau
|
|
|
109
108
|
};
|
|
110
109
|
return (0, _jsxRuntime.jsx)(_BaseButton.BaseButton, {
|
|
111
110
|
...buttonProps,
|
|
111
|
+
"data-cid": "Button",
|
|
112
112
|
children: children
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
}, _Button.displayName = "Button", _Button.componentId = 'Button', _Button.
|
|
115
|
+
}, _Button.displayName = "Button", _Button.componentId = 'Button', _Button.allowedProps = _props.allowedProps, _Button.defaultProps = {
|
|
116
116
|
type: 'button',
|
|
117
117
|
size: 'medium',
|
|
118
118
|
as: 'button',
|
|
@@ -124,5 +124,5 @@ let Button = exports.Button = (_dec = (0, _emotion.withStyle)(null, _theme.defau
|
|
|
124
124
|
withBackground: true,
|
|
125
125
|
margin: '0',
|
|
126
126
|
cursor: 'pointer'
|
|
127
|
-
}, _Button)) || _class)
|
|
127
|
+
}, _Button)) || _class);
|
|
128
128
|
var _default = exports.default = Button;
|
package/lib/Button/props.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
exports.allowedProps = void 0;
|
|
9
7
|
/*
|
|
10
8
|
* The MIT License (MIT)
|
|
11
9
|
*
|
|
@@ -30,22 +28,4 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
30
28
|
* SOFTWARE.
|
|
31
29
|
*/
|
|
32
30
|
|
|
33
|
-
const propTypes = exports.propTypes = {
|
|
34
|
-
children: _propTypes.default.node,
|
|
35
|
-
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
36
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
37
|
-
elementRef: _propTypes.default.func,
|
|
38
|
-
as: _propTypes.default.elementType,
|
|
39
|
-
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
40
|
-
color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
|
|
41
|
-
focusColor: _propTypes.default.oneOf(['info', 'inverse']),
|
|
42
|
-
display: _propTypes.default.oneOf(['inline-block', 'block']),
|
|
43
|
-
textAlign: _propTypes.default.oneOf(['start', 'center']),
|
|
44
|
-
withBackground: _propTypes.default.bool,
|
|
45
|
-
margin: _propTypes.default.string,
|
|
46
|
-
cursor: _propTypes.default.string,
|
|
47
|
-
href: _propTypes.default.string,
|
|
48
|
-
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
49
|
-
onClick: _propTypes.default.func
|
|
50
|
-
};
|
|
51
31
|
const allowedProps = exports.allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'textAlign', 'type', 'withBackground', 'onClick'];
|
package/lib/CloseButton/index.js
CHANGED
|
@@ -9,7 +9,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _IconXSolid = require("@instructure/ui-icons/lib/IconXSolid.js");
|
|
11
11
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
12
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
13
12
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
14
13
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
15
14
|
var _emotion = require("@instructure/emotion");
|
|
@@ -19,7 +18,7 @@ var _BaseButton = require("../BaseButton");
|
|
|
19
18
|
var _props = require("./props");
|
|
20
19
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
21
20
|
const _excluded = ["screenReaderLabel", "elementRef", "size", "onClick", "margin", "placement", "offset", "type", "as", "href", "cursor", "tabIndex", "styles"];
|
|
22
|
-
var _dec,
|
|
21
|
+
var _dec, _class, _CloseButton;
|
|
23
22
|
/*
|
|
24
23
|
* The MIT License (MIT)
|
|
25
24
|
*
|
|
@@ -48,7 +47,7 @@ var _dec, _dec2, _class, _CloseButton;
|
|
|
48
47
|
category: components
|
|
49
48
|
---
|
|
50
49
|
**/
|
|
51
|
-
let CloseButton = exports.CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
50
|
+
let CloseButton = exports.CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_CloseButton = class CloseButton extends _react.Component {
|
|
52
51
|
constructor(...args) {
|
|
53
52
|
super(...args);
|
|
54
53
|
this.ref = null;
|
|
@@ -95,13 +94,17 @@ let CloseButton = exports.CloseButton = (_dec = (0, _emotion.withStyle)(_styles.
|
|
|
95
94
|
return (0, _jsxRuntime.jsx)("span", {
|
|
96
95
|
...(0, _passthroughProps.passthroughProps)(props),
|
|
97
96
|
css: styles === null || styles === void 0 ? void 0 : styles.closeButton,
|
|
98
|
-
ref: el =>
|
|
97
|
+
ref: el => {
|
|
98
|
+
this.ref = el;
|
|
99
|
+
},
|
|
99
100
|
children: (0, _jsxRuntime.jsx)(_BaseButton.BaseButton, {
|
|
100
101
|
renderIcon: _IconXSolid.IconXSolid,
|
|
101
102
|
elementRef: this.handleRef,
|
|
102
103
|
interaction: this.interaction,
|
|
103
104
|
type: type,
|
|
104
|
-
|
|
105
|
+
...(this.color ? {
|
|
106
|
+
color: this.color
|
|
107
|
+
} : {}),
|
|
105
108
|
size: size,
|
|
106
109
|
onClick: onClick,
|
|
107
110
|
margin: margin,
|
|
@@ -111,13 +114,14 @@ let CloseButton = exports.CloseButton = (_dec = (0, _emotion.withStyle)(_styles.
|
|
|
111
114
|
href: href,
|
|
112
115
|
cursor: cursor,
|
|
113
116
|
tabIndex: tabIndex,
|
|
117
|
+
"data-cid": "CloseButton",
|
|
114
118
|
children: (0, _jsxRuntime.jsx)(_ScreenReaderContent.ScreenReaderContent, {
|
|
115
119
|
children: screenReaderLabel
|
|
116
120
|
})
|
|
117
121
|
})
|
|
118
122
|
});
|
|
119
123
|
}
|
|
120
|
-
}, _CloseButton.displayName = "CloseButton", _CloseButton.componentId = 'CloseButton', _CloseButton.
|
|
124
|
+
}, _CloseButton.displayName = "CloseButton", _CloseButton.componentId = 'CloseButton', _CloseButton.allowedProps = _props.allowedProps, _CloseButton.defaultProps = {
|
|
121
125
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
122
126
|
interaction: void 0,
|
|
123
127
|
type: 'button',
|
|
@@ -127,5 +131,5 @@ let CloseButton = exports.CloseButton = (_dec = (0, _emotion.withStyle)(_styles.
|
|
|
127
131
|
margin: '0',
|
|
128
132
|
as: 'button',
|
|
129
133
|
cursor: 'pointer'
|
|
130
|
-
}, _CloseButton)) || _class)
|
|
134
|
+
}, _CloseButton)) || _class);
|
|
131
135
|
var _default = exports.default = CloseButton;
|
package/lib/CloseButton/props.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
exports.allowedProps = void 0;
|
|
9
7
|
/*
|
|
10
8
|
* The MIT License (MIT)
|
|
11
9
|
*
|
|
@@ -30,20 +28,4 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
30
28
|
* SOFTWARE.
|
|
31
29
|
*/
|
|
32
30
|
|
|
33
|
-
const propTypes = exports.propTypes = {
|
|
34
|
-
screenReaderLabel: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired,
|
|
35
|
-
color: _propTypes.default.oneOf(['primary', 'primary-inverse']),
|
|
36
|
-
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
37
|
-
elementRef: _propTypes.default.func,
|
|
38
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
39
|
-
onClick: _propTypes.default.func,
|
|
40
|
-
margin: _propTypes.default.string,
|
|
41
|
-
placement: _propTypes.default.oneOf(['start', 'end', 'static']),
|
|
42
|
-
offset: _propTypes.default.oneOf(['none', 'x-small', 'small', 'medium']),
|
|
43
|
-
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
44
|
-
as: _propTypes.default.elementType,
|
|
45
|
-
href: _propTypes.default.string,
|
|
46
|
-
cursor: _propTypes.default.string,
|
|
47
|
-
tabIndex: _propTypes.default.number
|
|
48
|
-
};
|
|
49
31
|
const allowedProps = exports.allowedProps = ['as', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'offset', 'onClick', 'placement', 'screenReaderLabel', 'size', 'tabIndex', 'type'];
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.CondensedButton = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
11
10
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
12
11
|
var _emotion = require("@instructure/emotion");
|
|
13
12
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -15,7 +14,7 @@ var _BaseButton = require("../BaseButton");
|
|
|
15
14
|
var _props = require("./props");
|
|
16
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
16
|
const _excluded = ["children", "type", "size", "elementRef", "as", "interaction", "color", "margin", "cursor", "href", "renderIcon", "display"];
|
|
18
|
-
var _dec,
|
|
17
|
+
var _dec, _class, _CondensedButton;
|
|
19
18
|
/*
|
|
20
19
|
* The MIT License (MIT)
|
|
21
20
|
*
|
|
@@ -45,7 +44,7 @@ category: components
|
|
|
45
44
|
---
|
|
46
45
|
**/
|
|
47
46
|
// needed for listing the available theme variables on docs page
|
|
48
|
-
let CondensedButton = exports.CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default),
|
|
47
|
+
let CondensedButton = exports.CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec(_class = (_CondensedButton = class CondensedButton extends _react.Component {
|
|
49
48
|
constructor(...args) {
|
|
50
49
|
super(...args);
|
|
51
50
|
this._baseButton = null;
|
|
@@ -100,10 +99,11 @@ let CondensedButton = exports.CondensedButton = (_dec = (0, _emotion.withStyle)(
|
|
|
100
99
|
ref: component => {
|
|
101
100
|
this._baseButton = component;
|
|
102
101
|
},
|
|
102
|
+
"data-cid": "CondensedButton",
|
|
103
103
|
children: children
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
}, _CondensedButton.displayName = "CondensedButton", _CondensedButton.componentId = 'CondensedButton', _CondensedButton.
|
|
106
|
+
}, _CondensedButton.displayName = "CondensedButton", _CondensedButton.componentId = 'CondensedButton', _CondensedButton.allowedProps = _props.allowedProps, _CondensedButton.defaultProps = {
|
|
107
107
|
type: 'button',
|
|
108
108
|
size: 'medium',
|
|
109
109
|
as: 'button',
|
|
@@ -113,5 +113,5 @@ let CondensedButton = exports.CondensedButton = (_dec = (0, _emotion.withStyle)(
|
|
|
113
113
|
margin: '0',
|
|
114
114
|
cursor: 'pointer',
|
|
115
115
|
display: 'inline-block'
|
|
116
|
-
}, _CondensedButton)) || _class)
|
|
116
|
+
}, _CondensedButton)) || _class);
|
|
117
117
|
var _default = exports.default = CondensedButton;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
exports.allowedProps = void 0;
|
|
9
7
|
/*
|
|
10
8
|
* The MIT License (MIT)
|
|
11
9
|
*
|
|
@@ -30,19 +28,4 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
30
28
|
* SOFTWARE.
|
|
31
29
|
*/
|
|
32
30
|
|
|
33
|
-
const propTypes = exports.propTypes = {
|
|
34
|
-
children: _propTypes.default.node,
|
|
35
|
-
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
36
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
37
|
-
elementRef: _propTypes.default.func,
|
|
38
|
-
as: _propTypes.default.elementType,
|
|
39
|
-
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
40
|
-
color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary']),
|
|
41
|
-
margin: _propTypes.default.string,
|
|
42
|
-
cursor: _propTypes.default.string,
|
|
43
|
-
href: _propTypes.default.string,
|
|
44
|
-
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
45
|
-
onClick: _propTypes.default.func,
|
|
46
|
-
display: _propTypes.default.oneOf(['inline-block', 'block'])
|
|
47
|
-
};
|
|
48
31
|
const allowedProps = exports.allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'type', 'onClick', 'display'];
|
package/lib/IconButton/index.js
CHANGED
|
@@ -7,16 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.IconButton = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
11
10
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
12
11
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
12
|
+
var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
|
|
13
13
|
var _emotion = require("@instructure/emotion");
|
|
14
14
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
15
15
|
var _BaseButton = require("../BaseButton");
|
|
16
16
|
var _props = require("./props");
|
|
17
17
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
18
18
|
const _excluded = ["children", "renderIcon", "screenReaderLabel", "type", "size", "elementRef", "as", "interaction", "color", "focusColor", "shape", "withBackground", "withBorder", "margin", "cursor", "href"];
|
|
19
|
-
var _dec,
|
|
19
|
+
var _dec, _class, _IconButton;
|
|
20
20
|
/*
|
|
21
21
|
* The MIT License (MIT)
|
|
22
22
|
*
|
|
@@ -46,7 +46,7 @@ category: components
|
|
|
46
46
|
---
|
|
47
47
|
**/
|
|
48
48
|
// needed for listing the available theme variables on docs page
|
|
49
|
-
let IconButton = exports.IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default),
|
|
49
|
+
let IconButton = exports.IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec(_class = (_IconButton = class IconButton extends _react.Component {
|
|
50
50
|
constructor(...args) {
|
|
51
51
|
super(...args);
|
|
52
52
|
this._baseButton = null;
|
|
@@ -105,12 +105,13 @@ let IconButton = exports.IconButton = (_dec = (0, _emotion.withStyle)(null, _the
|
|
|
105
105
|
ref: component => {
|
|
106
106
|
this._baseButton = component;
|
|
107
107
|
},
|
|
108
|
+
"data-cid": (0, _combineDataCid.combineDataCid)('IconButton', this.props),
|
|
108
109
|
children: (0, _jsxRuntime.jsx)(_ScreenReaderContent.ScreenReaderContent, {
|
|
109
110
|
children: screenReaderLabel
|
|
110
111
|
})
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
|
-
}, _IconButton.displayName = "IconButton", _IconButton.componentId = 'IconButton', _IconButton.
|
|
114
|
+
}, _IconButton.displayName = "IconButton", _IconButton.componentId = 'IconButton', _IconButton.allowedProps = _props.allowedProps, _IconButton.defaultProps = {
|
|
114
115
|
type: 'button',
|
|
115
116
|
size: 'medium',
|
|
116
117
|
as: 'button',
|
|
@@ -122,5 +123,5 @@ let IconButton = exports.IconButton = (_dec = (0, _emotion.withStyle)(null, _the
|
|
|
122
123
|
withBorder: true,
|
|
123
124
|
margin: '0',
|
|
124
125
|
cursor: 'pointer'
|
|
125
|
-
}, _IconButton)) || _class)
|
|
126
|
+
}, _IconButton)) || _class);
|
|
126
127
|
var _default = exports.default = IconButton;
|
package/lib/IconButton/props.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
exports.allowedProps = void 0;
|
|
9
7
|
/*
|
|
10
8
|
* The MIT License (MIT)
|
|
11
9
|
*
|
|
@@ -30,23 +28,4 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
30
28
|
* SOFTWARE.
|
|
31
29
|
*/
|
|
32
30
|
|
|
33
|
-
const propTypes = exports.propTypes = {
|
|
34
|
-
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
35
|
-
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
36
|
-
screenReaderLabel: _propTypes.default.string.isRequired,
|
|
37
|
-
type: _propTypes.default.oneOf(['button', 'submit', 'reset']),
|
|
38
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
39
|
-
elementRef: _propTypes.default.func,
|
|
40
|
-
as: _propTypes.default.elementType,
|
|
41
|
-
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
42
|
-
color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
|
|
43
|
-
focusColor: _propTypes.default.oneOf(['info', 'inverse']),
|
|
44
|
-
shape: _propTypes.default.oneOf(['rectangle', 'circle']),
|
|
45
|
-
withBackground: _propTypes.default.bool,
|
|
46
|
-
withBorder: _propTypes.default.bool,
|
|
47
|
-
margin: _propTypes.default.string,
|
|
48
|
-
cursor: _propTypes.default.string,
|
|
49
|
-
href: _propTypes.default.string,
|
|
50
|
-
onClick: _propTypes.default.func
|
|
51
|
-
};
|
|
52
31
|
const allowedProps = exports.allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'screenReaderLabel', 'shape', 'size', 'type', 'withBackground', 'withBorder', 'onClick'];
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.ToggleButton = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
11
10
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
12
11
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
13
12
|
var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
|
|
@@ -15,7 +14,6 @@ var _IconButton = require("../IconButton");
|
|
|
15
14
|
var _props = require("./props");
|
|
16
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
16
|
const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"];
|
|
18
|
-
var _dec, _class, _ToggleButton;
|
|
19
17
|
/*
|
|
20
18
|
* The MIT License (MIT)
|
|
21
19
|
*
|
|
@@ -44,7 +42,8 @@ var _dec, _class, _ToggleButton;
|
|
|
44
42
|
category: components
|
|
45
43
|
---
|
|
46
44
|
**/
|
|
47
|
-
|
|
45
|
+
|
|
46
|
+
class ToggleButton extends _react.Component {
|
|
48
47
|
constructor(props) {
|
|
49
48
|
super(props);
|
|
50
49
|
this.ref = null;
|
|
@@ -106,11 +105,17 @@ let ToggleButton = exports.ToggleButton = (_dec = (0, _testable.testable)(), _de
|
|
|
106
105
|
onClick: onClick,
|
|
107
106
|
interaction: interaction,
|
|
108
107
|
"aria-pressed": status === 'pressed',
|
|
108
|
+
"data-cid": "ToggleButton",
|
|
109
109
|
children: (0, _callRenderProp.callRenderProp)(renderIcon)
|
|
110
110
|
})
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
}
|
|
113
|
+
}
|
|
114
|
+
exports.ToggleButton = ToggleButton;
|
|
115
|
+
ToggleButton.displayName = "ToggleButton";
|
|
116
|
+
ToggleButton.componentId = 'ToggleButton';
|
|
117
|
+
ToggleButton.allowedProps = _props.allowedProps;
|
|
118
|
+
ToggleButton.defaultProps = {
|
|
114
119
|
size: 'medium',
|
|
115
120
|
as: 'button',
|
|
116
121
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
@@ -119,5 +124,5 @@ let ToggleButton = exports.ToggleButton = (_dec = (0, _testable.testable)(), _de
|
|
|
119
124
|
color: 'secondary',
|
|
120
125
|
placement: 'top center',
|
|
121
126
|
constrain: 'window'
|
|
122
|
-
}
|
|
127
|
+
};
|
|
123
128
|
var _default = exports.default = ToggleButton;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
|
|
6
|
+
exports.allowedProps = void 0;
|
|
10
7
|
/*
|
|
11
8
|
* The MIT License (MIT)
|
|
12
9
|
*
|
|
@@ -31,20 +28,4 @@ var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes
|
|
|
31
28
|
* SOFTWARE.
|
|
32
29
|
*/
|
|
33
30
|
|
|
34
|
-
const propTypes = exports.propTypes = {
|
|
35
|
-
screenReaderLabel: _propTypes.default.string.isRequired,
|
|
36
|
-
renderTooltipContent: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
37
|
-
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
38
|
-
status: _propTypes.default.oneOf(['pressed', 'unpressed']).isRequired,
|
|
39
|
-
as: _propTypes.default.elementType,
|
|
40
|
-
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
41
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
42
|
-
elementRef: _propTypes.default.func,
|
|
43
|
-
onClick: _propTypes.default.func,
|
|
44
|
-
color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
|
|
45
|
-
isShowingTooltip: _propTypes.default.bool,
|
|
46
|
-
mountNode: _PositionPropTypes.PositionPropTypes.mountNode,
|
|
47
|
-
placement: _PositionPropTypes.PositionPropTypes.placement,
|
|
48
|
-
constrain: _PositionPropTypes.PositionPropTypes.constrain
|
|
49
|
-
};
|
|
50
31
|
const allowedProps = exports.allowedProps = ['as', 'color', 'constrain', 'elementRef', 'interaction', 'isShowingTooltip', 'mountNode', 'onClick', 'placement', 'renderIcon', 'renderTooltipContent', 'screenReaderLabel', 'size', 'status'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-buttons",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "Accessible button components",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,36 +23,33 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "
|
|
27
|
-
"@instructure/ui-babel-preset": "
|
|
28
|
-
"@instructure/ui-themes": "
|
|
26
|
+
"@instructure/ui-axe-check": "11.0.0",
|
|
27
|
+
"@instructure/ui-babel-preset": "11.0.0",
|
|
28
|
+
"@instructure/ui-themes": "11.0.0",
|
|
29
29
|
"@testing-library/jest-dom": "^6.6.3",
|
|
30
|
-
"@testing-library/react": "
|
|
30
|
+
"@testing-library/react": "15.0.7",
|
|
31
31
|
"@testing-library/user-event": "^14.6.1",
|
|
32
32
|
"vitest": "^3.2.2"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.27.6",
|
|
36
|
-
"@instructure/console": "
|
|
37
|
-
"@instructure/emotion": "
|
|
38
|
-
"@instructure/shared-types": "
|
|
39
|
-
"@instructure/ui-a11y-content": "
|
|
40
|
-
"@instructure/ui-a11y-utils": "
|
|
41
|
-
"@instructure/ui-color-utils": "
|
|
42
|
-
"@instructure/ui-dom-utils": "
|
|
43
|
-
"@instructure/ui-icons": "
|
|
44
|
-
"@instructure/ui-position": "
|
|
45
|
-
"@instructure/ui-
|
|
46
|
-
"@instructure/ui-
|
|
47
|
-
"@instructure/ui-
|
|
48
|
-
"@instructure/ui-
|
|
49
|
-
"
|
|
50
|
-
"@instructure/ui-view": "10.26.1",
|
|
51
|
-
"keycode": "^2",
|
|
52
|
-
"prop-types": "^15.8.1"
|
|
36
|
+
"@instructure/console": "11.0.0",
|
|
37
|
+
"@instructure/emotion": "11.0.0",
|
|
38
|
+
"@instructure/shared-types": "11.0.0",
|
|
39
|
+
"@instructure/ui-a11y-content": "11.0.0",
|
|
40
|
+
"@instructure/ui-a11y-utils": "11.0.0",
|
|
41
|
+
"@instructure/ui-color-utils": "11.0.0",
|
|
42
|
+
"@instructure/ui-dom-utils": "11.0.0",
|
|
43
|
+
"@instructure/ui-icons": "11.0.0",
|
|
44
|
+
"@instructure/ui-position": "11.0.0",
|
|
45
|
+
"@instructure/ui-react-utils": "11.0.0",
|
|
46
|
+
"@instructure/ui-tooltip": "11.0.0",
|
|
47
|
+
"@instructure/ui-utils": "11.0.0",
|
|
48
|
+
"@instructure/ui-view": "11.0.0",
|
|
49
|
+
"keycode": "^2"
|
|
53
50
|
},
|
|
54
51
|
"peerDependencies": {
|
|
55
|
-
"react": ">=
|
|
52
|
+
"react": ">=18 <=19"
|
|
56
53
|
},
|
|
57
54
|
"publishConfig": {
|
|
58
55
|
"access": "public"
|
package/src/BaseButton/index.tsx
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
import keycode from 'keycode'
|
|
27
27
|
|
|
28
|
-
import { testable } from '@instructure/ui-testable'
|
|
29
28
|
import {
|
|
30
29
|
getElementType,
|
|
31
30
|
getInteraction,
|
|
@@ -36,14 +35,18 @@ import { isActiveElement } from '@instructure/ui-dom-utils'
|
|
|
36
35
|
import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
|
|
37
36
|
import { View } from '@instructure/ui-view'
|
|
38
37
|
import type { ViewProps } from '@instructure/ui-view'
|
|
38
|
+
|
|
39
|
+
// TODO these have to be imported in separate lines because otherwise `isSafari` will be missing from the babel build
|
|
40
|
+
// this bug is very likely caused by `babel-plugin-transform-imports` and can be reverted once it is removed from the codebase
|
|
39
41
|
import { isSafari } from '@instructure/ui-utils'
|
|
42
|
+
import { combineDataCid } from '@instructure/ui-utils'
|
|
40
43
|
|
|
41
44
|
import { withStyle } from '@instructure/emotion'
|
|
42
45
|
|
|
43
46
|
import generateStyles from './styles'
|
|
44
47
|
import generateComponentTheme from './theme'
|
|
45
48
|
|
|
46
|
-
import {
|
|
49
|
+
import { allowedProps } from './props'
|
|
47
50
|
import type { BaseButtonProps, BaseButtonStyleProps } from './props'
|
|
48
51
|
|
|
49
52
|
/**
|
|
@@ -53,11 +56,9 @@ category: components/utilities
|
|
|
53
56
|
**/
|
|
54
57
|
|
|
55
58
|
@withStyle(generateStyles, generateComponentTheme)
|
|
56
|
-
@testable()
|
|
57
59
|
class BaseButton extends Component<BaseButtonProps> {
|
|
58
60
|
static readonly componentId = 'BaseButton'
|
|
59
61
|
|
|
60
|
-
static propTypes = propTypes
|
|
61
62
|
static allowedProps = allowedProps
|
|
62
63
|
static defaultProps = {
|
|
63
64
|
type: 'button',
|
|
@@ -285,6 +286,7 @@ class BaseButton extends Component<BaseButtonProps> {
|
|
|
285
286
|
if ((onClick && as && needsZeroTabIndex) || (isSafari() && as)) {
|
|
286
287
|
tabIndexValue = tabIndex || 0
|
|
287
288
|
}
|
|
289
|
+
|
|
288
290
|
return (
|
|
289
291
|
<View
|
|
290
292
|
{...passthroughProps(props)}
|
|
@@ -309,6 +311,7 @@ class BaseButton extends Component<BaseButtonProps> {
|
|
|
309
311
|
disabled={isDisabled || isReadOnly}
|
|
310
312
|
css={styles?.baseButton}
|
|
311
313
|
withFocusOutline={withFocusOutline}
|
|
314
|
+
data-cid={combineDataCid('BaseButton', this.props)}
|
|
312
315
|
>
|
|
313
316
|
<span css={styles?.content}>{this.renderChildren()}</span>
|
|
314
317
|
</View>
|
package/src/BaseButton/props.ts
CHANGED
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
26
|
import type { InteractionType } from '@instructure/ui-react-utils'
|
|
29
27
|
import type {
|
|
30
28
|
Spacing,
|
|
@@ -35,10 +33,9 @@ import type {
|
|
|
35
33
|
ToProp,
|
|
36
34
|
AsElementType,
|
|
37
35
|
BaseButtonTheme,
|
|
38
|
-
OtherHTMLAttributes
|
|
39
|
-
PropValidators
|
|
36
|
+
OtherHTMLAttributes
|
|
40
37
|
} from '@instructure/shared-types'
|
|
41
|
-
import type { Cursor } from '@instructure/
|
|
38
|
+
import type { Cursor } from '@instructure/shared-types'
|
|
42
39
|
import type { ViewProps } from '@instructure/ui-view'
|
|
43
40
|
import { Renderable } from '@instructure/shared-types'
|
|
44
41
|
|
|
@@ -196,40 +193,6 @@ type BaseButtonStyle = ComponentStyle<
|
|
|
196
193
|
| 'iconWrapper'
|
|
197
194
|
| 'childrenWrapper'
|
|
198
195
|
>
|
|
199
|
-
|
|
200
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
201
|
-
children: PropTypes.node,
|
|
202
|
-
type: PropTypes.oneOf(['button', 'submit', 'reset']),
|
|
203
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
204
|
-
elementRef: PropTypes.func,
|
|
205
|
-
as: PropTypes.elementType,
|
|
206
|
-
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
207
|
-
color: PropTypes.oneOf([
|
|
208
|
-
'primary',
|
|
209
|
-
'primary-inverse',
|
|
210
|
-
'secondary',
|
|
211
|
-
'success',
|
|
212
|
-
'danger',
|
|
213
|
-
'ai-primary',
|
|
214
|
-
'ai-secondary'
|
|
215
|
-
]),
|
|
216
|
-
focusColor: PropTypes.oneOf(['info', 'inverse']),
|
|
217
|
-
display: PropTypes.oneOf(['inline-block', 'block']),
|
|
218
|
-
textAlign: PropTypes.oneOf(['start', 'center']),
|
|
219
|
-
shape: PropTypes.oneOf(['rectangle', 'circle']),
|
|
220
|
-
withBackground: PropTypes.bool,
|
|
221
|
-
withBorder: PropTypes.bool,
|
|
222
|
-
isCondensed: PropTypes.bool,
|
|
223
|
-
margin: PropTypes.string,
|
|
224
|
-
cursor: PropTypes.string,
|
|
225
|
-
href: PropTypes.string,
|
|
226
|
-
onClick: PropTypes.func,
|
|
227
|
-
onKeyDown: PropTypes.func,
|
|
228
|
-
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
229
|
-
tabIndex: PropTypes.number,
|
|
230
|
-
withFocusOutline: PropTypes.bool
|
|
231
|
-
}
|
|
232
|
-
|
|
233
196
|
const allowedProps: AllowedPropKeys = [
|
|
234
197
|
'as',
|
|
235
198
|
'children',
|
|
@@ -260,4 +223,4 @@ export type {
|
|
|
260
223
|
BaseButtonStyleProps,
|
|
261
224
|
BaseButtonStyle
|
|
262
225
|
}
|
|
263
|
-
export {
|
|
226
|
+
export { allowedProps }
|