@instructure/ui-focusable 10.13.0 → 10.13.1-pr-snapshot-1741357986437
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/lib/Focusable/index.js +8 -11
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [10.13.1-pr-snapshot-1741357986437](https://github.com/instructure/instructure-ui/compare/v10.13.0...v10.13.1-pr-snapshot-1741357986437) (2025-03-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-focusable
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [10.13.0](https://github.com/instructure/instructure-ui/compare/v10.12.0...v10.13.0) (2025-03-06)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-focusable
|
package/lib/Focusable/index.js
CHANGED
|
@@ -5,13 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.Focusable = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var _addEventListener = require("@instructure/ui-dom-utils/lib/addEventListener.js");
|
|
10
|
-
var _containsActiveElement = require("@instructure/ui-dom-utils/lib/containsActiveElement.js");
|
|
11
|
-
var _findFocusable = require("@instructure/ui-dom-utils/lib/findFocusable.js");
|
|
8
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
12
9
|
var _console = require("@instructure/console");
|
|
13
10
|
var _props = require("./props");
|
|
14
|
-
var
|
|
11
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
15
12
|
/*
|
|
16
13
|
* The MIT License (MIT)
|
|
17
14
|
*
|
|
@@ -75,7 +72,7 @@ class Focusable extends _react.Component {
|
|
|
75
72
|
const focusable = this.focusable,
|
|
76
73
|
focused = this.focused;
|
|
77
74
|
this.addFocusableListeners(focused, focusable);
|
|
78
|
-
this._inputModeListener = (0,
|
|
75
|
+
this._inputModeListener = (0, _uiDomUtils.addInputModeListener)({
|
|
79
76
|
onInputModeChange: this.handleInputModeChange
|
|
80
77
|
});
|
|
81
78
|
this.setState({
|
|
@@ -125,9 +122,9 @@ class Focusable extends _react.Component {
|
|
|
125
122
|
addFocusableListeners(focused, focusable) {
|
|
126
123
|
if (!focusable) return;
|
|
127
124
|
if (focused && !this._blurListener) {
|
|
128
|
-
this._blurListener = (0,
|
|
125
|
+
this._blurListener = (0, _uiDomUtils.addEventListener)(focusable, 'blur', this.handleBlur, true);
|
|
129
126
|
} else if (!this._focusListener) {
|
|
130
|
-
this._focusListener = (0,
|
|
127
|
+
this._focusListener = (0, _uiDomUtils.addEventListener)(focusable, 'focus', this.handleFocus, true);
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
130
|
removeFocusableListeners() {
|
|
@@ -147,10 +144,10 @@ class Focusable extends _react.Component {
|
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
146
|
get focused() {
|
|
150
|
-
return (0,
|
|
147
|
+
return (0, _uiDomUtils.containsActiveElement)(this);
|
|
151
148
|
}
|
|
152
149
|
get focusable() {
|
|
153
|
-
const focusableArr = (0,
|
|
150
|
+
const focusableArr = (0, _uiDomUtils.findFocusable)(this, () => true, true) || [];
|
|
154
151
|
const focusableCount = focusableArr && focusableArr.length || 0;
|
|
155
152
|
(0, _console.logWarn)(focusableCount === 1, `[Focusable] Exactly one focusable child is required (${focusableCount} found).`);
|
|
156
153
|
const focusable = focusableArr ? focusableArr[0] : false;
|
|
@@ -205,7 +202,7 @@ class Focusable extends _react.Component {
|
|
|
205
202
|
attachRef: this.attachRef
|
|
206
203
|
});
|
|
207
204
|
return /*#__PURE__*/(0, _react.cloneElement)(rendered, {
|
|
208
|
-
ref: rendered.ref ? (0,
|
|
205
|
+
ref: rendered.ref ? (0, _uiUtils.createChainedFunction)(rendered.ref, this.attachRef) : this.attachRef
|
|
209
206
|
});
|
|
210
207
|
} else {
|
|
211
208
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-focusable",
|
|
3
|
-
"version": "10.13.
|
|
3
|
+
"version": "10.13.1-pr-snapshot-1741357986437",
|
|
4
4
|
"description": "A utility used to identify when an element receives focus.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "10.13.
|
|
27
|
-
"@instructure/ui-test-utils": "10.13.
|
|
26
|
+
"@instructure/ui-babel-preset": "10.13.1-pr-snapshot-1741357986437",
|
|
27
|
+
"@instructure/ui-test-utils": "10.13.1-pr-snapshot-1741357986437"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.26.0",
|
|
31
|
-
"@instructure/console": "10.13.
|
|
32
|
-
"@instructure/shared-types": "10.13.
|
|
33
|
-
"@instructure/ui-dom-utils": "10.13.
|
|
34
|
-
"@instructure/ui-react-utils": "10.13.
|
|
35
|
-
"@instructure/ui-utils": "10.13.
|
|
36
|
-
"@instructure/ui-view": "10.13.
|
|
31
|
+
"@instructure/console": "10.13.1-pr-snapshot-1741357986437",
|
|
32
|
+
"@instructure/shared-types": "10.13.1-pr-snapshot-1741357986437",
|
|
33
|
+
"@instructure/ui-dom-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
34
|
+
"@instructure/ui-react-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
35
|
+
"@instructure/ui-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
36
|
+
"@instructure/ui-view": "10.13.1-pr-snapshot-1741357986437",
|
|
37
37
|
"prop-types": "^15.8.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|