@instructure/ui-dialog 8.56.2-pr-snapshot-1721749364069 → 8.56.2
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 +1 -1
- package/lib/Dialog/index.js +14 -12
- package/lib/Dialog/props.js +2 -2
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
## [8.56.2
|
|
6
|
+
## [8.56.2](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2) (2024-08-06)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-dialog
|
|
9
9
|
|
package/lib/Dialog/index.js
CHANGED
|
@@ -8,10 +8,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.Dialog = void 0;
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
12
|
+
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
13
|
+
var _findDOMNode = require("@instructure/ui-dom-utils/lib/findDOMNode.js");
|
|
14
|
+
var _requestAnimationFrame = require("@instructure/ui-dom-utils/lib/requestAnimationFrame.js");
|
|
13
15
|
var _console = require("@instructure/console");
|
|
14
|
-
var
|
|
16
|
+
var _FocusRegionManager = require("@instructure/ui-a11y-utils/lib/FocusRegionManager.js");
|
|
15
17
|
var _props = require("./props");
|
|
16
18
|
const _excluded = ["open", "contentElement"],
|
|
17
19
|
_excluded2 = ["open", "contentElement"];
|
|
@@ -92,8 +94,8 @@ class Dialog extends _react.Component {
|
|
|
92
94
|
open = _this$props2.open,
|
|
93
95
|
contentElement = _this$props2.contentElement,
|
|
94
96
|
options = (0, _objectWithoutProperties2.default)(_this$props2, _excluded2);
|
|
95
|
-
this._raf.push((0,
|
|
96
|
-
this._focusRegion =
|
|
97
|
+
this._raf.push((0, _requestAnimationFrame.requestAnimationFrame)(() => {
|
|
98
|
+
this._focusRegion = _FocusRegionManager.FocusRegionManager.activateRegion(this.contentElement, {
|
|
97
99
|
...options
|
|
98
100
|
});
|
|
99
101
|
}));
|
|
@@ -103,7 +105,7 @@ class Dialog extends _react.Component {
|
|
|
103
105
|
contentElement = this.contentElement;
|
|
104
106
|
// setTimeout is used here to delay the blur after the mousedown event in FocusRegion for correct execution order
|
|
105
107
|
if (_focusRegion) {
|
|
106
|
-
|
|
108
|
+
_FocusRegionManager.FocusRegionManager.blurRegion(contentElement, _focusRegion.id);
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
focus() {
|
|
@@ -112,7 +114,7 @@ class Dialog extends _react.Component {
|
|
|
112
114
|
return;
|
|
113
115
|
}
|
|
114
116
|
if (this._focusRegion) {
|
|
115
|
-
|
|
117
|
+
_FocusRegionManager.FocusRegionManager.focusRegion(this.contentElement, this._focusRegion.id);
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
blur() {
|
|
@@ -123,21 +125,21 @@ class Dialog extends _react.Component {
|
|
|
123
125
|
this.close();
|
|
124
126
|
}
|
|
125
127
|
get contentElement() {
|
|
126
|
-
let contentElement = (0,
|
|
128
|
+
let contentElement = (0, _findDOMNode.findDOMNode)(this.props.contentElement);
|
|
127
129
|
if (!contentElement) {
|
|
128
|
-
contentElement = (0,
|
|
130
|
+
contentElement = (0, _findDOMNode.findDOMNode)(this.ref);
|
|
129
131
|
}
|
|
130
132
|
return contentElement;
|
|
131
133
|
}
|
|
132
134
|
get focused() {
|
|
133
|
-
return this.contentElement && this._focusRegion &&
|
|
135
|
+
return this.contentElement && this._focusRegion && _FocusRegionManager.FocusRegionManager.isFocused(this.contentElement, this._focusRegion.id);
|
|
134
136
|
}
|
|
135
137
|
render() {
|
|
136
|
-
const ElementType = (0,
|
|
138
|
+
const ElementType = (0, _getElementType.getElementType)(Dialog, this.props);
|
|
137
139
|
|
|
138
140
|
// In case the HTML role attribute is explicitly passed, use props.role
|
|
139
141
|
const role = this.props.role || (this.props.label ? 'dialog' : void 0);
|
|
140
|
-
return this.props.open ? /*#__PURE__*/_react.default.createElement(ElementType, Object.assign({}, (0,
|
|
142
|
+
return this.props.open ? /*#__PURE__*/_react.default.createElement(ElementType, Object.assign({}, (0, _omitProps.omitProps)(this.props, Dialog.allowedProps), {
|
|
141
143
|
role: role,
|
|
142
144
|
"aria-label": this.props.label,
|
|
143
145
|
className: this.props.className // eslint-disable-line react/prop-types
|
package/lib/Dialog/props.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var _element = require("@instructure/ui-prop-types/lib/element.js");
|
|
10
10
|
/*
|
|
11
11
|
* The MIT License (MIT)
|
|
12
12
|
*
|
|
@@ -63,7 +63,7 @@ const propTypes = exports.propTypes = {
|
|
|
63
63
|
* An element, function returning an element, or array of elements that will not be hidden from
|
|
64
64
|
* the screen reader when the focus region is active
|
|
65
65
|
*/
|
|
66
|
-
liveRegion: _propTypes.default.oneOfType([
|
|
66
|
+
liveRegion: _propTypes.default.oneOfType([_element.element, _propTypes.default.arrayOf(_element.element), _propTypes.default.func]),
|
|
67
67
|
/**
|
|
68
68
|
* When set to true, or it is an array that includes the 'keyboard' string,
|
|
69
69
|
* the keyboard and screenreader focus is trapped; when set to 'screenreader'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-dialog",
|
|
3
|
-
"version": "8.56.2
|
|
3
|
+
"version": "8.56.2",
|
|
4
4
|
"description": "A utility component for managing keyboard accessibility and screen reader behavior",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.23.2",
|
|
27
|
-
"@instructure/shared-types": "8.56.2
|
|
28
|
-
"@instructure/ui-a11y-utils": "8.56.2
|
|
29
|
-
"@instructure/ui-dom-utils": "8.56.2
|
|
30
|
-
"@instructure/ui-react-utils": "8.56.2
|
|
31
|
-
"@instructure/ui-testable": "8.56.2
|
|
27
|
+
"@instructure/shared-types": "8.56.2",
|
|
28
|
+
"@instructure/ui-a11y-utils": "8.56.2",
|
|
29
|
+
"@instructure/ui-dom-utils": "8.56.2",
|
|
30
|
+
"@instructure/ui-react-utils": "8.56.2",
|
|
31
|
+
"@instructure/ui-testable": "8.56.2",
|
|
32
32
|
"prop-types": "^15.8.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@instructure/console": "8.56.2
|
|
36
|
-
"@instructure/ui-babel-preset": "8.56.2
|
|
37
|
-
"@instructure/ui-prop-types": "8.56.2
|
|
35
|
+
"@instructure/console": "8.56.2",
|
|
36
|
+
"@instructure/ui-babel-preset": "8.56.2",
|
|
37
|
+
"@instructure/ui-prop-types": "8.56.2",
|
|
38
38
|
"@testing-library/jest-dom": "^6.1.4",
|
|
39
39
|
"@testing-library/react": "^14.1.2",
|
|
40
40
|
"@testing-library/user-event": "^14.5.1"
|