@instructure/ui-buttons 8.10.1 → 8.10.3-snapshot.3
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 +4 -0
- package/LICENSE.md +27 -0
- package/es/BaseButton/index.js +42 -38
- package/es/Button/index.js +3 -1
- package/es/CloseButton/index.js +28 -16
- package/es/CondensedButton/index.js +22 -14
- package/es/IconButton/index.js +27 -19
- package/es/ToggleButton/index.js +24 -15
- package/lib/BaseButton/index.js +42 -38
- package/lib/Button/index.js +3 -1
- package/lib/CloseButton/index.js +28 -16
- package/lib/CondensedButton/index.js +22 -14
- package/lib/IconButton/index.js +27 -19
- package/lib/ToggleButton/index.js +24 -15
- package/package.json +22 -21
- package/src/BaseButton/index.tsx +6 -5
- package/src/BaseButton/props.ts +1 -1
- package/src/Button/index.tsx +5 -5
- package/src/Button/props.ts +1 -1
- package/src/CloseButton/index.tsx +8 -1
- package/src/CloseButton/props.ts +1 -1
- package/src/CondensedButton/index.tsx +8 -1
- package/src/CondensedButton/props.ts +1 -1
- package/src/IconButton/index.tsx +8 -1
- package/src/IconButton/props.ts +1 -1
- package/src/ToggleButton/index.tsx +8 -1
- package/src/ToggleButton/props.ts +1 -1
- package/types/BaseButton/BaseButtonLocator.d.ts +64 -64
- package/types/BaseButton/index.d.ts +5 -4
- package/types/BaseButton/index.d.ts.map +1 -1
- package/types/BaseButton/props.d.ts +1 -1
- package/types/BaseButton/props.d.ts.map +1 -1
- package/types/Button/ButtonLocator.d.ts +64 -64
- package/types/Button/index.d.ts +4 -3
- package/types/Button/index.d.ts.map +1 -1
- package/types/Button/locator.d.ts +64 -64
- package/types/Button/props.d.ts +1 -1
- package/types/Button/props.d.ts.map +1 -1
- package/types/CloseButton/CloseButtonLocator.d.ts +64 -64
- package/types/CloseButton/index.d.ts +4 -2
- package/types/CloseButton/index.d.ts.map +1 -1
- package/types/CloseButton/props.d.ts +1 -1
- package/types/CloseButton/props.d.ts.map +1 -1
- package/types/CondensedButton/CondensedButtonLocator.d.ts +64 -64
- package/types/CondensedButton/index.d.ts +4 -2
- package/types/CondensedButton/index.d.ts.map +1 -1
- package/types/CondensedButton/props.d.ts +1 -1
- package/types/CondensedButton/props.d.ts.map +1 -1
- package/types/IconButton/IconButtonLocator.d.ts +64 -64
- package/types/IconButton/index.d.ts +4 -2
- package/types/IconButton/index.d.ts.map +1 -1
- package/types/IconButton/props.d.ts +1 -1
- package/types/IconButton/props.d.ts.map +1 -1
- package/types/ToggleButton/ToggleButtonLocator.d.ts +64 -64
- package/types/ToggleButton/index.d.ts +4 -2
- package/types/ToggleButton/index.d.ts.map +1 -1
- package/types/ToggleButton/props.d.ts +1 -1
- package/types/ToggleButton/props.d.ts.map +1 -1
|
@@ -39,6 +39,14 @@ let CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _de
|
|
|
39
39
|
constructor(...args) {
|
|
40
40
|
super(...args);
|
|
41
41
|
this._baseButton = null;
|
|
42
|
+
this.ref = null;
|
|
43
|
+
|
|
44
|
+
this.handleRef = el => {
|
|
45
|
+
var _this$props$elementRe, _this$props;
|
|
46
|
+
|
|
47
|
+
this.ref = el;
|
|
48
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
49
|
+
};
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
get focused() {
|
|
@@ -50,19 +58,19 @@ let CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _de
|
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
render() {
|
|
53
|
-
const _this$
|
|
54
|
-
children = _this$
|
|
55
|
-
type = _this$
|
|
56
|
-
size = _this$
|
|
57
|
-
elementRef = _this$
|
|
58
|
-
as = _this$
|
|
59
|
-
interaction = _this$
|
|
60
|
-
color = _this$
|
|
61
|
-
margin = _this$
|
|
62
|
-
cursor = _this$
|
|
63
|
-
href = _this$
|
|
64
|
-
renderIcon = _this$
|
|
65
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
61
|
+
const _this$props2 = this.props,
|
|
62
|
+
children = _this$props2.children,
|
|
63
|
+
type = _this$props2.type,
|
|
64
|
+
size = _this$props2.size,
|
|
65
|
+
elementRef = _this$props2.elementRef,
|
|
66
|
+
as = _this$props2.as,
|
|
67
|
+
interaction = _this$props2.interaction,
|
|
68
|
+
color = _this$props2.color,
|
|
69
|
+
margin = _this$props2.margin,
|
|
70
|
+
cursor = _this$props2.cursor,
|
|
71
|
+
href = _this$props2.href,
|
|
72
|
+
renderIcon = _this$props2.renderIcon,
|
|
73
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
|
|
66
74
|
const themeOverride = this.props.themeOverride;
|
|
67
75
|
return /*#__PURE__*/_react.default.createElement(_BaseButton.BaseButton, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
68
76
|
isCondensed: true,
|
|
@@ -70,7 +78,7 @@ let CondensedButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _de
|
|
|
70
78
|
withBorder: false,
|
|
71
79
|
type: type,
|
|
72
80
|
size: size,
|
|
73
|
-
elementRef:
|
|
81
|
+
elementRef: this.handleRef,
|
|
74
82
|
as: as,
|
|
75
83
|
interaction: interaction,
|
|
76
84
|
color: color,
|
package/lib/IconButton/index.js
CHANGED
|
@@ -41,6 +41,14 @@ let IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 =
|
|
|
41
41
|
constructor(...args) {
|
|
42
42
|
super(...args);
|
|
43
43
|
this._baseButton = null;
|
|
44
|
+
this.ref = null;
|
|
45
|
+
|
|
46
|
+
this.handleRef = el => {
|
|
47
|
+
var _this$props$elementRe, _this$props;
|
|
48
|
+
|
|
49
|
+
this.ref = el;
|
|
50
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
51
|
+
};
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
get focused() {
|
|
@@ -52,29 +60,29 @@ let IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec2 =
|
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
render() {
|
|
55
|
-
const _this$
|
|
56
|
-
children = _this$
|
|
57
|
-
renderIcon = _this$
|
|
58
|
-
screenReaderLabel = _this$
|
|
59
|
-
type = _this$
|
|
60
|
-
size = _this$
|
|
61
|
-
elementRef = _this$
|
|
62
|
-
as = _this$
|
|
63
|
-
interaction = _this$
|
|
64
|
-
color = _this$
|
|
65
|
-
focusColor = _this$
|
|
66
|
-
shape = _this$
|
|
67
|
-
withBackground = _this$
|
|
68
|
-
withBorder = _this$
|
|
69
|
-
margin = _this$
|
|
70
|
-
cursor = _this$
|
|
71
|
-
href = _this$
|
|
72
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
63
|
+
const _this$props2 = this.props,
|
|
64
|
+
children = _this$props2.children,
|
|
65
|
+
renderIcon = _this$props2.renderIcon,
|
|
66
|
+
screenReaderLabel = _this$props2.screenReaderLabel,
|
|
67
|
+
type = _this$props2.type,
|
|
68
|
+
size = _this$props2.size,
|
|
69
|
+
elementRef = _this$props2.elementRef,
|
|
70
|
+
as = _this$props2.as,
|
|
71
|
+
interaction = _this$props2.interaction,
|
|
72
|
+
color = _this$props2.color,
|
|
73
|
+
focusColor = _this$props2.focusColor,
|
|
74
|
+
shape = _this$props2.shape,
|
|
75
|
+
withBackground = _this$props2.withBackground,
|
|
76
|
+
withBorder = _this$props2.withBorder,
|
|
77
|
+
margin = _this$props2.margin,
|
|
78
|
+
cursor = _this$props2.cursor,
|
|
79
|
+
href = _this$props2.href,
|
|
80
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
|
|
73
81
|
const themeOverride = this.props.themeOverride;
|
|
74
82
|
return /*#__PURE__*/_react.default.createElement(_BaseButton.BaseButton, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
|
|
75
83
|
type: type,
|
|
76
84
|
size: size,
|
|
77
|
-
elementRef:
|
|
85
|
+
elementRef: this.handleRef,
|
|
78
86
|
as: as,
|
|
79
87
|
interaction: interaction,
|
|
80
88
|
color: color,
|
|
@@ -37,6 +37,15 @@ category: components
|
|
|
37
37
|
let ToggleButton = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _class2 = class ToggleButton extends _react.Component {
|
|
38
38
|
constructor(props) {
|
|
39
39
|
super(props);
|
|
40
|
+
this.ref = null;
|
|
41
|
+
|
|
42
|
+
this.handleRef = el => {
|
|
43
|
+
var _this$props$elementRe, _this$props;
|
|
44
|
+
|
|
45
|
+
this.ref = el;
|
|
46
|
+
(_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
|
|
47
|
+
};
|
|
48
|
+
|
|
40
49
|
this.state = {
|
|
41
50
|
isShowingTooltip: props.isShowingTooltip || false
|
|
42
51
|
};
|
|
@@ -47,20 +56,20 @@ let ToggleButton = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _cl
|
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
render() {
|
|
50
|
-
const _this$
|
|
51
|
-
as = _this$
|
|
52
|
-
color = _this$
|
|
53
|
-
elementRef = _this$
|
|
54
|
-
size = _this$
|
|
55
|
-
interaction = _this$
|
|
56
|
-
mountNode = _this$
|
|
57
|
-
renderIcon = _this$
|
|
58
|
-
renderTooltipContent = _this$
|
|
59
|
-
screenReaderLabel = _this$
|
|
60
|
-
status = _this$
|
|
61
|
-
placement = _this$
|
|
62
|
-
onClick = _this$
|
|
63
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
59
|
+
const _this$props2 = this.props,
|
|
60
|
+
as = _this$props2.as,
|
|
61
|
+
color = _this$props2.color,
|
|
62
|
+
elementRef = _this$props2.elementRef,
|
|
63
|
+
size = _this$props2.size,
|
|
64
|
+
interaction = _this$props2.interaction,
|
|
65
|
+
mountNode = _this$props2.mountNode,
|
|
66
|
+
renderIcon = _this$props2.renderIcon,
|
|
67
|
+
renderTooltipContent = _this$props2.renderTooltipContent,
|
|
68
|
+
screenReaderLabel = _this$props2.screenReaderLabel,
|
|
69
|
+
status = _this$props2.status,
|
|
70
|
+
placement = _this$props2.placement,
|
|
71
|
+
onClick = _this$props2.onClick,
|
|
72
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
|
|
64
73
|
return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
65
74
|
renderTip: renderTooltipContent,
|
|
66
75
|
on: ['hover', 'focus'],
|
|
@@ -84,7 +93,7 @@ let ToggleButton = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _cl
|
|
|
84
93
|
withBorder: false,
|
|
85
94
|
color: color,
|
|
86
95
|
size: size,
|
|
87
|
-
elementRef:
|
|
96
|
+
elementRef: this.handleRef,
|
|
88
97
|
as: as,
|
|
89
98
|
onClick: onClick,
|
|
90
99
|
interaction: interaction,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-buttons",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.3-snapshot.3+2ee813492",
|
|
4
4
|
"description": "Accessible button components",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,28 +24,28 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/ui-babel-preset": "8.10.
|
|
28
|
-
"@instructure/ui-test-locator": "8.10.
|
|
29
|
-
"@instructure/ui-test-queries": "8.10.
|
|
30
|
-
"@instructure/ui-test-utils": "8.10.
|
|
31
|
-
"@instructure/ui-themes": "8.10.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.10.3-snapshot.3+2ee813492",
|
|
28
|
+
"@instructure/ui-test-locator": "8.10.3-snapshot.3+2ee813492",
|
|
29
|
+
"@instructure/ui-test-queries": "8.10.3-snapshot.3+2ee813492",
|
|
30
|
+
"@instructure/ui-test-utils": "8.10.3-snapshot.3+2ee813492",
|
|
31
|
+
"@instructure/ui-themes": "8.10.3-snapshot.3+2ee813492"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.13.10",
|
|
35
|
-
"@instructure/console": "8.10.
|
|
36
|
-
"@instructure/emotion": "8.10.
|
|
37
|
-
"@instructure/shared-types": "8.10.
|
|
38
|
-
"@instructure/ui-a11y-content": "8.10.
|
|
39
|
-
"@instructure/ui-a11y-utils": "8.10.
|
|
40
|
-
"@instructure/ui-color-utils": "8.10.
|
|
41
|
-
"@instructure/ui-dom-utils": "8.10.
|
|
42
|
-
"@instructure/ui-icons": "8.10.
|
|
43
|
-
"@instructure/ui-position": "8.10.
|
|
44
|
-
"@instructure/ui-react-utils": "8.10.
|
|
45
|
-
"@instructure/ui-testable": "8.10.
|
|
46
|
-
"@instructure/ui-tooltip": "8.10.
|
|
47
|
-
"@instructure/ui-utils": "8.10.
|
|
48
|
-
"@instructure/ui-view": "8.10.
|
|
35
|
+
"@instructure/console": "8.10.3-snapshot.3+2ee813492",
|
|
36
|
+
"@instructure/emotion": "8.10.3-snapshot.3+2ee813492",
|
|
37
|
+
"@instructure/shared-types": "8.10.3-snapshot.3+2ee813492",
|
|
38
|
+
"@instructure/ui-a11y-content": "8.10.3-snapshot.3+2ee813492",
|
|
39
|
+
"@instructure/ui-a11y-utils": "8.10.3-snapshot.3+2ee813492",
|
|
40
|
+
"@instructure/ui-color-utils": "8.10.3-snapshot.3+2ee813492",
|
|
41
|
+
"@instructure/ui-dom-utils": "8.10.3-snapshot.3+2ee813492",
|
|
42
|
+
"@instructure/ui-icons": "8.10.3-snapshot.3+2ee813492",
|
|
43
|
+
"@instructure/ui-position": "8.10.3-snapshot.3+2ee813492",
|
|
44
|
+
"@instructure/ui-react-utils": "8.10.3-snapshot.3+2ee813492",
|
|
45
|
+
"@instructure/ui-testable": "8.10.3-snapshot.3+2ee813492",
|
|
46
|
+
"@instructure/ui-tooltip": "8.10.3-snapshot.3+2ee813492",
|
|
47
|
+
"@instructure/ui-utils": "8.10.3-snapshot.3+2ee813492",
|
|
48
|
+
"@instructure/ui-view": "8.10.3-snapshot.3+2ee813492",
|
|
49
49
|
"keycode": "^2",
|
|
50
50
|
"prop-types": "^15"
|
|
51
51
|
},
|
|
@@ -55,5 +55,6 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"sideEffects": false
|
|
58
|
+
"sideEffects": false,
|
|
59
|
+
"gitHead": "2ee8134925b02efbc5d39662a8b1edb2c83a420d"
|
|
59
60
|
}
|
package/src/BaseButton/index.tsx
CHANGED
|
@@ -79,7 +79,9 @@ class BaseButton extends Component<BaseButtonProps> {
|
|
|
79
79
|
onKeyDown: (event) => {}
|
|
80
80
|
} as const
|
|
81
81
|
|
|
82
|
-
_rootElement = null
|
|
82
|
+
_rootElement: Element | null = null
|
|
83
|
+
|
|
84
|
+
ref: Element | null = null
|
|
83
85
|
|
|
84
86
|
componentDidMount() {
|
|
85
87
|
// @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
|
|
@@ -153,11 +155,10 @@ class BaseButton extends Component<BaseButtonProps> {
|
|
|
153
155
|
this._rootElement && this._rootElement.focus()
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
handleElementRef = (el) => {
|
|
158
|
+
handleElementRef = (el: Element | null) => {
|
|
158
159
|
this._rootElement = el
|
|
159
|
-
|
|
160
|
-
this.props.elementRef(el)
|
|
160
|
+
this.ref = el
|
|
161
|
+
this.props.elementRef?.(el)
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'event' implicitly has an 'any' type.
|
package/src/BaseButton/props.ts
CHANGED
|
@@ -43,7 +43,7 @@ type BaseButtonOwnProps = {
|
|
|
43
43
|
children?: React.ReactNode
|
|
44
44
|
type?: 'button' | 'submit' | 'reset'
|
|
45
45
|
size?: 'small' | 'medium' | 'large'
|
|
46
|
-
elementRef?: (
|
|
46
|
+
elementRef?: (element: Element | null) => void
|
|
47
47
|
as?: AsElementType
|
|
48
48
|
interaction?: InteractionType
|
|
49
49
|
color?: 'primary' | 'primary-inverse' | 'secondary' | 'success' | 'danger'
|
package/src/Button/index.tsx
CHANGED
|
@@ -66,6 +66,8 @@ class Button extends Component<ButtonProps> {
|
|
|
66
66
|
|
|
67
67
|
_buttonComponent = null
|
|
68
68
|
|
|
69
|
+
ref: Element | null = null
|
|
70
|
+
|
|
69
71
|
get focused() {
|
|
70
72
|
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
|
71
73
|
return this._buttonComponent && this._buttonComponent.focused
|
|
@@ -76,12 +78,10 @@ class Button extends Component<ButtonProps> {
|
|
|
76
78
|
this._buttonComponent && this._buttonComponent.focus()
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
handleElementRef = (el) => {
|
|
81
|
+
handleElementRef = (el: Element | null) => {
|
|
81
82
|
const { elementRef } = this.props
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
elementRef(el)
|
|
83
|
+
this.ref = el
|
|
84
|
+
elementRef?.(el)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'component' implicitly has an 'any' type... Remove this comment to see the full error message
|
package/src/Button/props.ts
CHANGED
|
@@ -38,7 +38,7 @@ type ButtonOwnProps = {
|
|
|
38
38
|
children?: React.ReactNode
|
|
39
39
|
type?: 'button' | 'submit' | 'reset'
|
|
40
40
|
size?: 'small' | 'medium' | 'large'
|
|
41
|
-
elementRef?: (
|
|
41
|
+
elementRef?: (element: Element | null) => void
|
|
42
42
|
as?: AsElementType
|
|
43
43
|
interaction?: 'enabled' | 'disabled' | 'readonly'
|
|
44
44
|
color?: 'primary' | 'primary-inverse' | 'secondary' | 'success' | 'danger'
|
|
@@ -64,6 +64,13 @@ class CloseButton extends Component<CloseButtonProps> {
|
|
|
64
64
|
cursor: 'pointer'
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
ref: Element | null = null
|
|
68
|
+
|
|
69
|
+
handleRef = (el: Element | null) => {
|
|
70
|
+
this.ref = el
|
|
71
|
+
this.props.elementRef?.(el)
|
|
72
|
+
}
|
|
73
|
+
|
|
67
74
|
componentDidMount() {
|
|
68
75
|
// @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
|
|
69
76
|
this.props.makeStyles()
|
|
@@ -106,7 +113,7 @@ class CloseButton extends Component<CloseButtonProps> {
|
|
|
106
113
|
<span {...passthroughProps(props)} css={styles?.closeButton}>
|
|
107
114
|
<BaseButton
|
|
108
115
|
renderIcon={IconXSolid}
|
|
109
|
-
elementRef={
|
|
116
|
+
elementRef={this.handleRef}
|
|
110
117
|
interaction={this.interaction}
|
|
111
118
|
type={type}
|
|
112
119
|
color={this.color}
|
package/src/CloseButton/props.ts
CHANGED
|
@@ -40,7 +40,7 @@ type CloseButtonOwnProps = {
|
|
|
40
40
|
screenReaderLabel: string | React.ReactNode
|
|
41
41
|
color?: 'primary' | 'primary-inverse'
|
|
42
42
|
interaction?: 'enabled' | 'disabled' | 'readonly'
|
|
43
|
-
elementRef?: (
|
|
43
|
+
elementRef?: (element: Element | null) => void
|
|
44
44
|
size?: 'small' | 'medium' | 'large'
|
|
45
45
|
onClick?: (...args: any[]) => any
|
|
46
46
|
margin?: Spacing
|
|
@@ -63,6 +63,13 @@ class CondensedButton extends Component<CondensedButtonProps> {
|
|
|
63
63
|
|
|
64
64
|
_baseButton = null
|
|
65
65
|
|
|
66
|
+
ref: Element | null = null
|
|
67
|
+
|
|
68
|
+
handleRef = (el: Element | null) => {
|
|
69
|
+
this.ref = el
|
|
70
|
+
this.props.elementRef?.(el)
|
|
71
|
+
}
|
|
72
|
+
|
|
66
73
|
get focused() {
|
|
67
74
|
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
|
68
75
|
return this._baseButton && this._baseButton.focused
|
|
@@ -99,7 +106,7 @@ class CondensedButton extends Component<CondensedButtonProps> {
|
|
|
99
106
|
withBorder={false}
|
|
100
107
|
type={type}
|
|
101
108
|
size={size}
|
|
102
|
-
elementRef={
|
|
109
|
+
elementRef={this.handleRef}
|
|
103
110
|
as={as}
|
|
104
111
|
interaction={interaction}
|
|
105
112
|
color={color}
|
|
@@ -38,7 +38,7 @@ type CondensedButtonOwnProps = {
|
|
|
38
38
|
children?: React.ReactNode
|
|
39
39
|
type?: 'button' | 'submit' | 'reset'
|
|
40
40
|
size?: 'small' | 'medium' | 'large'
|
|
41
|
-
elementRef?: (
|
|
41
|
+
elementRef?: (element: Element | null) => void
|
|
42
42
|
as?: AsElementType
|
|
43
43
|
interaction?: 'enabled' | 'disabled' | 'readonly'
|
|
44
44
|
color?: 'primary' | 'primary-inverse'
|
package/src/IconButton/index.tsx
CHANGED
|
@@ -68,6 +68,13 @@ class IconButton extends Component<IconButtonProps> {
|
|
|
68
68
|
|
|
69
69
|
_baseButton = null
|
|
70
70
|
|
|
71
|
+
ref: Element | null = null
|
|
72
|
+
|
|
73
|
+
handleRef = (el: Element | null) => {
|
|
74
|
+
this.ref = el
|
|
75
|
+
this.props.elementRef?.(el)
|
|
76
|
+
}
|
|
77
|
+
|
|
71
78
|
get focused() {
|
|
72
79
|
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
|
73
80
|
return this._baseButton && this._baseButton.focused
|
|
@@ -106,7 +113,7 @@ class IconButton extends Component<IconButtonProps> {
|
|
|
106
113
|
{...passthroughProps(props)}
|
|
107
114
|
type={type}
|
|
108
115
|
size={size}
|
|
109
|
-
elementRef={
|
|
116
|
+
elementRef={this.handleRef}
|
|
110
117
|
as={as}
|
|
111
118
|
interaction={interaction}
|
|
112
119
|
color={color}
|
package/src/IconButton/props.ts
CHANGED
|
@@ -40,7 +40,7 @@ type IconButtonOwnProps = {
|
|
|
40
40
|
screenReaderLabel: string
|
|
41
41
|
type?: 'button' | 'submit' | 'reset'
|
|
42
42
|
size?: 'small' | 'medium' | 'large'
|
|
43
|
-
elementRef?: (
|
|
43
|
+
elementRef?: (element: Element | null) => void
|
|
44
44
|
as?: AsElementType
|
|
45
45
|
interaction?: 'enabled' | 'disabled' | 'readonly'
|
|
46
46
|
color?: 'primary' | 'primary-inverse' | 'secondary' | 'success' | 'danger'
|
|
@@ -69,6 +69,13 @@ class ToggleButton extends Component<ToggleButtonProps> {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
ref: Element | null = null
|
|
73
|
+
|
|
74
|
+
handleRef = (el: Element | null) => {
|
|
75
|
+
this.ref = el
|
|
76
|
+
this.props.elementRef?.(el)
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
get isShowingTooltip() {
|
|
73
80
|
return typeof this.props.isShowingTooltip === 'undefined'
|
|
74
81
|
? // @ts-expect-error ts-migrate(2339) FIXME: Property 'isShowingTooltip' does not exist on type... Remove this comment to see the full error message
|
|
@@ -118,7 +125,7 @@ class ToggleButton extends Component<ToggleButtonProps> {
|
|
|
118
125
|
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
|
119
126
|
color={color}
|
|
120
127
|
size={size}
|
|
121
|
-
elementRef={
|
|
128
|
+
elementRef={this.handleRef}
|
|
122
129
|
as={as}
|
|
123
130
|
onClick={onClick}
|
|
124
131
|
interaction={interaction}
|
|
@@ -42,7 +42,7 @@ type ToggleButtonOwnProps = {
|
|
|
42
42
|
as?: AsElementType
|
|
43
43
|
interaction?: 'enabled' | 'disabled' | 'readonly'
|
|
44
44
|
size?: 'small' | 'medium' | 'large'
|
|
45
|
-
elementRef?: (
|
|
45
|
+
elementRef?: (element: Element | null) => void
|
|
46
46
|
onClick?: (...args: any[]) => any
|
|
47
47
|
color?: string
|
|
48
48
|
isShowingTooltip?: boolean
|