@instructure/ui-buttons 8.56.0 → 9.0.1-snapshot-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 -0
- package/es/BaseButton/index.js +1 -16
- package/es/BaseButton/props.js +1 -3
- package/es/CloseButton/props.js +1 -3
- package/lib/BaseButton/index.js +1 -16
- package/lib/BaseButton/props.js +1 -3
- package/lib/CloseButton/props.js +1 -3
- package/package.json +19 -19
- package/src/BaseButton/index.tsx +1 -26
- package/src/BaseButton/props.ts +2 -6
- package/src/CloseButton/props.ts +2 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/BaseButton/index.d.ts +0 -2
- package/types/BaseButton/index.d.ts.map +1 -1
- package/types/BaseButton/props.d.ts +1 -2
- package/types/BaseButton/props.d.ts.map +1 -1
- package/types/CloseButton/index.d.ts +2 -2
- package/types/CloseButton/props.d.ts +1 -2
- package/types/CloseButton/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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
|
+
## [9.0.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v9.0.0...v9.0.1-snapshot-0) (2024-05-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-buttons
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [9.0.0](https://github.com/instructure/instructure-ui/compare/v8.56.0...v9.0.0) (2024-05-09)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **ui-buttons,ui-text:** remove deprecated prop values ([f6b27d8](https://github.com/instructure/instructure-ui/commit/f6b27d84fe9dfbd2987dc5af7edefb093bcb4e1b))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **ui-buttons,ui-text:** deprecated property values has been removed
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [8.56.0](https://github.com/instructure/instructure-ui/compare/v8.55.1...v8.56.0) (2024-05-06)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @instructure/ui-buttons
|
package/es/BaseButton/index.js
CHANGED
|
@@ -28,7 +28,6 @@ var _dec, _dec2, _class, _class2;
|
|
|
28
28
|
/** @jsx jsx */
|
|
29
29
|
import React, { Component } from 'react';
|
|
30
30
|
import keycode from 'keycode';
|
|
31
|
-
import { warn } from '@instructure/console';
|
|
32
31
|
import { testable } from '@instructure/ui-testable';
|
|
33
32
|
import { getElementType, getInteraction, passthroughProps, callRenderProp } from '@instructure/ui-react-utils';
|
|
34
33
|
import { isActiveElement } from '@instructure/ui-dom-utils';
|
|
@@ -100,9 +99,6 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
100
99
|
var _this$props$makeStyle2, _this$props3;
|
|
101
100
|
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
|
|
102
101
|
}
|
|
103
|
-
get _rootElement() {
|
|
104
|
-
return this.ref;
|
|
105
|
-
}
|
|
106
102
|
get makeStylesVariables() {
|
|
107
103
|
return {
|
|
108
104
|
isDisabled: this.isDisabled,
|
|
@@ -132,16 +128,6 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
132
128
|
get isEnabled() {
|
|
133
129
|
return this.interaction === 'enabled';
|
|
134
130
|
}
|
|
135
|
-
|
|
136
|
-
// TODO: delete once the type of tabIndex is changed to number only
|
|
137
|
-
get tabIndex() {
|
|
138
|
-
const tabIndex = this.props.tabIndex;
|
|
139
|
-
if (typeof tabIndex === 'string') {
|
|
140
|
-
warn(false, 'The `string` value for `tabIndex` is deprecated. Only `number` type will be accepted from V9.0.0.');
|
|
141
|
-
return parseInt(tabIndex);
|
|
142
|
-
}
|
|
143
|
-
return tabIndex;
|
|
144
|
-
}
|
|
145
131
|
get focusColor() {
|
|
146
132
|
const _this$props5 = this.props,
|
|
147
133
|
color = _this$props5.color,
|
|
@@ -222,7 +208,6 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
222
208
|
const isDisabled = this.isDisabled,
|
|
223
209
|
isEnabled = this.isEnabled,
|
|
224
210
|
isReadOnly = this.isReadOnly;
|
|
225
|
-
const tabIndexNumber = this.tabIndex;
|
|
226
211
|
return jsx(View, Object.assign({}, passthroughProps(props), {
|
|
227
212
|
as: this.elementType,
|
|
228
213
|
focusColor: this.focusColor,
|
|
@@ -241,7 +226,7 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
|
|
|
241
226
|
onClick: this.handleClick,
|
|
242
227
|
onKeyDown: this.handleKeyDown,
|
|
243
228
|
role: onClick && as !== 'button' ? 'button' : void 0,
|
|
244
|
-
tabIndex: onClick && as ?
|
|
229
|
+
tabIndex: onClick && as ? tabIndex || 0 : tabIndex,
|
|
245
230
|
disabled: isDisabled || isReadOnly,
|
|
246
231
|
css: isEnabled ? styles === null || styles === void 0 ? void 0 : styles.baseButton : null
|
|
247
232
|
}), jsx("span", {
|
package/es/BaseButton/props.js
CHANGED
|
@@ -45,9 +45,7 @@ const propTypes = {
|
|
|
45
45
|
onClick: PropTypes.func,
|
|
46
46
|
onKeyDown: PropTypes.func,
|
|
47
47
|
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
48
|
-
|
|
49
|
-
// TODO: remove string type in v9
|
|
50
|
-
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
48
|
+
tabIndex: PropTypes.number
|
|
51
49
|
};
|
|
52
50
|
const allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'isCondensed', 'margin', 'onClick', 'onKeyDown', 'renderIcon', 'shape', 'size', 'tabIndex', 'textAlign', 'type', 'withBackground', 'withBorder'];
|
|
53
51
|
export { propTypes, allowedProps };
|
package/es/CloseButton/props.js
CHANGED
|
@@ -38,9 +38,7 @@ const propTypes = {
|
|
|
38
38
|
as: PropTypes.elementType,
|
|
39
39
|
href: PropTypes.string,
|
|
40
40
|
cursor: PropTypes.string,
|
|
41
|
-
|
|
42
|
-
// TODO: remove string type in v9
|
|
43
|
-
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
41
|
+
tabIndex: PropTypes.number
|
|
44
42
|
};
|
|
45
43
|
const allowedProps = ['as', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'offset', 'onClick', 'placement', 'screenReaderLabel', 'size', 'tabIndex', 'type'];
|
|
46
44
|
export { propTypes, allowedProps };
|
package/lib/BaseButton/index.js
CHANGED
|
@@ -9,7 +9,6 @@ exports.default = exports.BaseButton = void 0;
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
12
|
-
var _console = require("@instructure/console");
|
|
13
12
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
14
13
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
15
14
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
@@ -110,9 +109,6 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
110
109
|
var _this$props$makeStyle2, _this$props3;
|
|
111
110
|
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
|
|
112
111
|
}
|
|
113
|
-
get _rootElement() {
|
|
114
|
-
return this.ref;
|
|
115
|
-
}
|
|
116
112
|
get makeStylesVariables() {
|
|
117
113
|
return {
|
|
118
114
|
isDisabled: this.isDisabled,
|
|
@@ -142,16 +138,6 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
142
138
|
get isEnabled() {
|
|
143
139
|
return this.interaction === 'enabled';
|
|
144
140
|
}
|
|
145
|
-
|
|
146
|
-
// TODO: delete once the type of tabIndex is changed to number only
|
|
147
|
-
get tabIndex() {
|
|
148
|
-
const tabIndex = this.props.tabIndex;
|
|
149
|
-
if (typeof tabIndex === 'string') {
|
|
150
|
-
(0, _console.warn)(false, 'The `string` value for `tabIndex` is deprecated. Only `number` type will be accepted from V9.0.0.');
|
|
151
|
-
return parseInt(tabIndex);
|
|
152
|
-
}
|
|
153
|
-
return tabIndex;
|
|
154
|
-
}
|
|
155
141
|
get focusColor() {
|
|
156
142
|
const _this$props5 = this.props,
|
|
157
143
|
color = _this$props5.color,
|
|
@@ -232,7 +218,6 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
232
218
|
const isDisabled = this.isDisabled,
|
|
233
219
|
isEnabled = this.isEnabled,
|
|
234
220
|
isReadOnly = this.isReadOnly;
|
|
235
|
-
const tabIndexNumber = this.tabIndex;
|
|
236
221
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
237
222
|
as: this.elementType,
|
|
238
223
|
focusColor: this.focusColor,
|
|
@@ -251,7 +236,7 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
251
236
|
onClick: this.handleClick,
|
|
252
237
|
onKeyDown: this.handleKeyDown,
|
|
253
238
|
role: onClick && as !== 'button' ? 'button' : void 0,
|
|
254
|
-
tabIndex: onClick && as ?
|
|
239
|
+
tabIndex: onClick && as ? tabIndex || 0 : tabIndex,
|
|
255
240
|
disabled: isDisabled || isReadOnly,
|
|
256
241
|
css: isEnabled ? styles === null || styles === void 0 ? void 0 : styles.baseButton : null
|
|
257
242
|
}), (0, _emotion.jsx)("span", {
|
package/lib/BaseButton/props.js
CHANGED
|
@@ -52,8 +52,6 @@ const propTypes = exports.propTypes = {
|
|
|
52
52
|
onClick: _propTypes.default.func,
|
|
53
53
|
onKeyDown: _propTypes.default.func,
|
|
54
54
|
renderIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
55
|
-
|
|
56
|
-
// TODO: remove string type in v9
|
|
57
|
-
tabIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
55
|
+
tabIndex: _propTypes.default.number
|
|
58
56
|
};
|
|
59
57
|
const allowedProps = exports.allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'isCondensed', 'margin', 'onClick', 'onKeyDown', 'renderIcon', 'shape', 'size', 'tabIndex', 'textAlign', 'type', 'withBackground', 'withBorder'];
|
package/lib/CloseButton/props.js
CHANGED
|
@@ -45,8 +45,6 @@ const propTypes = exports.propTypes = {
|
|
|
45
45
|
as: _propTypes.default.elementType,
|
|
46
46
|
href: _propTypes.default.string,
|
|
47
47
|
cursor: _propTypes.default.string,
|
|
48
|
-
|
|
49
|
-
// TODO: remove string type in v9
|
|
50
|
-
tabIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
48
|
+
tabIndex: _propTypes.default.number
|
|
51
49
|
};
|
|
52
50
|
const allowedProps = exports.allowedProps = ['as', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'offset', 'onClick', 'placement', 'screenReaderLabel', 'size', 'tabIndex', 'type'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-buttons",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1-snapshot-0",
|
|
4
4
|
"description": "Accessible button components",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "
|
|
27
|
-
"@instructure/ui-babel-preset": "
|
|
28
|
-
"@instructure/ui-test-utils": "
|
|
29
|
-
"@instructure/ui-themes": "
|
|
26
|
+
"@instructure/ui-axe-check": "9.0.1-snapshot-0",
|
|
27
|
+
"@instructure/ui-babel-preset": "9.0.1-snapshot-0",
|
|
28
|
+
"@instructure/ui-test-utils": "9.0.1-snapshot-0",
|
|
29
|
+
"@instructure/ui-themes": "9.0.1-snapshot-0",
|
|
30
30
|
"@testing-library/jest-dom": "^6.1.4",
|
|
31
31
|
"@testing-library/react": "^14.1.2",
|
|
32
32
|
"@testing-library/user-event": "^14.5.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.23.2",
|
|
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-react-utils": "
|
|
46
|
-
"@instructure/ui-testable": "
|
|
47
|
-
"@instructure/ui-tooltip": "
|
|
48
|
-
"@instructure/ui-utils": "
|
|
49
|
-
"@instructure/ui-view": "
|
|
36
|
+
"@instructure/console": "9.0.1-snapshot-0",
|
|
37
|
+
"@instructure/emotion": "9.0.1-snapshot-0",
|
|
38
|
+
"@instructure/shared-types": "9.0.1-snapshot-0",
|
|
39
|
+
"@instructure/ui-a11y-content": "9.0.1-snapshot-0",
|
|
40
|
+
"@instructure/ui-a11y-utils": "9.0.1-snapshot-0",
|
|
41
|
+
"@instructure/ui-color-utils": "9.0.1-snapshot-0",
|
|
42
|
+
"@instructure/ui-dom-utils": "9.0.1-snapshot-0",
|
|
43
|
+
"@instructure/ui-icons": "9.0.1-snapshot-0",
|
|
44
|
+
"@instructure/ui-position": "9.0.1-snapshot-0",
|
|
45
|
+
"@instructure/ui-react-utils": "9.0.1-snapshot-0",
|
|
46
|
+
"@instructure/ui-testable": "9.0.1-snapshot-0",
|
|
47
|
+
"@instructure/ui-tooltip": "9.0.1-snapshot-0",
|
|
48
|
+
"@instructure/ui-utils": "9.0.1-snapshot-0",
|
|
49
|
+
"@instructure/ui-view": "9.0.1-snapshot-0",
|
|
50
50
|
"keycode": "^2.2.1",
|
|
51
51
|
"prop-types": "^15.8.1"
|
|
52
52
|
},
|
package/src/BaseButton/index.tsx
CHANGED
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
import React, { Component } from 'react'
|
|
27
27
|
import keycode from 'keycode'
|
|
28
28
|
|
|
29
|
-
import { warn } from '@instructure/console'
|
|
30
29
|
import { testable } from '@instructure/ui-testable'
|
|
31
30
|
import {
|
|
32
31
|
getElementType,
|
|
@@ -87,14 +86,6 @@ class BaseButton extends Component<BaseButtonProps> {
|
|
|
87
86
|
this.props.makeStyles?.(this.makeStylesVariables)
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
get _rootElement() {
|
|
91
|
-
console.warn(
|
|
92
|
-
'_rootElement property is deprecated and will be removed in v9, please use ref instead'
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
return this.ref
|
|
96
|
-
}
|
|
97
|
-
|
|
98
89
|
get makeStylesVariables(): BaseButtonStyleProps {
|
|
99
90
|
return {
|
|
100
91
|
isDisabled: this.isDisabled,
|
|
@@ -127,20 +118,6 @@ class BaseButton extends Component<BaseButtonProps> {
|
|
|
127
118
|
return this.interaction === 'enabled'
|
|
128
119
|
}
|
|
129
120
|
|
|
130
|
-
// TODO: delete once the type of tabIndex is changed to number only
|
|
131
|
-
get tabIndex() {
|
|
132
|
-
const { tabIndex } = this.props
|
|
133
|
-
|
|
134
|
-
if (typeof tabIndex === 'string') {
|
|
135
|
-
warn(
|
|
136
|
-
false,
|
|
137
|
-
'The `string` value for `tabIndex` is deprecated. Only `number` type will be accepted from V9.0.0.'
|
|
138
|
-
)
|
|
139
|
-
return parseInt(tabIndex)
|
|
140
|
-
}
|
|
141
|
-
return tabIndex
|
|
142
|
-
}
|
|
143
|
-
|
|
144
121
|
get focusColor() {
|
|
145
122
|
const { color, focusColor, withBackground } = this.props
|
|
146
123
|
|
|
@@ -280,8 +257,6 @@ class BaseButton extends Component<BaseButtonProps> {
|
|
|
280
257
|
|
|
281
258
|
const { isDisabled, isEnabled, isReadOnly } = this
|
|
282
259
|
|
|
283
|
-
const tabIndexNumber = this.tabIndex
|
|
284
|
-
|
|
285
260
|
return (
|
|
286
261
|
<View
|
|
287
262
|
{...passthroughProps(props)}
|
|
@@ -302,7 +277,7 @@ class BaseButton extends Component<BaseButtonProps> {
|
|
|
302
277
|
onClick={this.handleClick}
|
|
303
278
|
onKeyDown={this.handleKeyDown}
|
|
304
279
|
role={onClick && as !== 'button' ? 'button' : undefined}
|
|
305
|
-
tabIndex={onClick && as ?
|
|
280
|
+
tabIndex={onClick && as ? tabIndex || 0 : tabIndex}
|
|
306
281
|
disabled={isDisabled || isReadOnly}
|
|
307
282
|
css={isEnabled ? styles?.baseButton : null}
|
|
308
283
|
>
|
package/src/BaseButton/props.ts
CHANGED
|
@@ -152,13 +152,11 @@ type BaseButtonOwnProps = {
|
|
|
152
152
|
*/
|
|
153
153
|
renderIcon?: Renderable
|
|
154
154
|
|
|
155
|
-
// Deprecated `string` tabIndex type
|
|
156
155
|
/**
|
|
157
156
|
* Specifies the tabindex of the `Button`.
|
|
158
157
|
*
|
|
159
|
-
* (`string` type is __deprecated__, use `number`)
|
|
160
158
|
*/
|
|
161
|
-
tabIndex?: number
|
|
159
|
+
tabIndex?: number
|
|
162
160
|
}
|
|
163
161
|
|
|
164
162
|
type BaseButtonStyleProps = {
|
|
@@ -213,9 +211,7 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
213
211
|
onClick: PropTypes.func,
|
|
214
212
|
onKeyDown: PropTypes.func,
|
|
215
213
|
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
216
|
-
|
|
217
|
-
// TODO: remove string type in v9
|
|
218
|
-
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
214
|
+
tabIndex: PropTypes.number
|
|
219
215
|
}
|
|
220
216
|
|
|
221
217
|
const allowedProps: AllowedPropKeys = [
|
package/src/CloseButton/props.ts
CHANGED
|
@@ -115,13 +115,11 @@ type CloseButtonOwnProps = {
|
|
|
115
115
|
*/
|
|
116
116
|
cursor?: Cursor
|
|
117
117
|
|
|
118
|
-
// Deprecated `string` tabIndex type
|
|
119
118
|
/**
|
|
120
119
|
* Specifies the tabindex of the `CloseButton`.
|
|
121
120
|
*
|
|
122
|
-
* (`string` type is __deprecated__, use `number`)
|
|
123
121
|
*/
|
|
124
|
-
tabIndex?: number
|
|
122
|
+
tabIndex?: number
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
type PropKeys = keyof CloseButtonOwnProps
|
|
@@ -150,9 +148,7 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
150
148
|
as: PropTypes.elementType,
|
|
151
149
|
href: PropTypes.string,
|
|
152
150
|
cursor: PropTypes.string,
|
|
153
|
-
|
|
154
|
-
// TODO: remove string type in v9
|
|
155
|
-
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
151
|
+
tabIndex: PropTypes.number
|
|
156
152
|
}
|
|
157
153
|
|
|
158
154
|
const allowedProps: AllowedPropKeys = [
|