@instructure/ui-dialog 8.56.1 → 8.56.2-pr-snapshot-1721749364069
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/Dialog/index.js +12 -14
- package/lib/Dialog/props.js +2 -2
- 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
|
+
## [8.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-dialog
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-dialog
|
package/lib/Dialog/index.js
CHANGED
|
@@ -8,12 +8,10 @@ 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
|
|
13
|
-
var _findDOMNode = require("@instructure/ui-dom-utils/lib/findDOMNode.js");
|
|
14
|
-
var _requestAnimationFrame = require("@instructure/ui-dom-utils/lib/requestAnimationFrame.js");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
15
13
|
var _console = require("@instructure/console");
|
|
16
|
-
var
|
|
14
|
+
var _uiA11yUtils = require("@instructure/ui-a11y-utils");
|
|
17
15
|
var _props = require("./props");
|
|
18
16
|
const _excluded = ["open", "contentElement"],
|
|
19
17
|
_excluded2 = ["open", "contentElement"];
|
|
@@ -94,8 +92,8 @@ class Dialog extends _react.Component {
|
|
|
94
92
|
open = _this$props2.open,
|
|
95
93
|
contentElement = _this$props2.contentElement,
|
|
96
94
|
options = (0, _objectWithoutProperties2.default)(_this$props2, _excluded2);
|
|
97
|
-
this._raf.push((0,
|
|
98
|
-
this._focusRegion =
|
|
95
|
+
this._raf.push((0, _uiDomUtils.requestAnimationFrame)(() => {
|
|
96
|
+
this._focusRegion = _uiA11yUtils.FocusRegionManager.activateRegion(this.contentElement, {
|
|
99
97
|
...options
|
|
100
98
|
});
|
|
101
99
|
}));
|
|
@@ -105,7 +103,7 @@ class Dialog extends _react.Component {
|
|
|
105
103
|
contentElement = this.contentElement;
|
|
106
104
|
// setTimeout is used here to delay the blur after the mousedown event in FocusRegion for correct execution order
|
|
107
105
|
if (_focusRegion) {
|
|
108
|
-
|
|
106
|
+
_uiA11yUtils.FocusRegionManager.blurRegion(contentElement, _focusRegion.id);
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
focus() {
|
|
@@ -114,7 +112,7 @@ class Dialog extends _react.Component {
|
|
|
114
112
|
return;
|
|
115
113
|
}
|
|
116
114
|
if (this._focusRegion) {
|
|
117
|
-
|
|
115
|
+
_uiA11yUtils.FocusRegionManager.focusRegion(this.contentElement, this._focusRegion.id);
|
|
118
116
|
}
|
|
119
117
|
}
|
|
120
118
|
blur() {
|
|
@@ -125,21 +123,21 @@ class Dialog extends _react.Component {
|
|
|
125
123
|
this.close();
|
|
126
124
|
}
|
|
127
125
|
get contentElement() {
|
|
128
|
-
let contentElement = (0,
|
|
126
|
+
let contentElement = (0, _uiDomUtils.findDOMNode)(this.props.contentElement);
|
|
129
127
|
if (!contentElement) {
|
|
130
|
-
contentElement = (0,
|
|
128
|
+
contentElement = (0, _uiDomUtils.findDOMNode)(this.ref);
|
|
131
129
|
}
|
|
132
130
|
return contentElement;
|
|
133
131
|
}
|
|
134
132
|
get focused() {
|
|
135
|
-
return this.contentElement && this._focusRegion &&
|
|
133
|
+
return this.contentElement && this._focusRegion && _uiA11yUtils.FocusRegionManager.isFocused(this.contentElement, this._focusRegion.id);
|
|
136
134
|
}
|
|
137
135
|
render() {
|
|
138
|
-
const ElementType = (0,
|
|
136
|
+
const ElementType = (0, _uiReactUtils.getElementType)(Dialog, this.props);
|
|
139
137
|
|
|
140
138
|
// In case the HTML role attribute is explicitly passed, use props.role
|
|
141
139
|
const role = this.props.role || (this.props.label ? 'dialog' : void 0);
|
|
142
|
-
return this.props.open ? /*#__PURE__*/_react.default.createElement(ElementType, Object.assign({}, (0,
|
|
140
|
+
return this.props.open ? /*#__PURE__*/_react.default.createElement(ElementType, Object.assign({}, (0, _uiReactUtils.omitProps)(this.props, Dialog.allowedProps), {
|
|
143
141
|
role: role,
|
|
144
142
|
"aria-label": this.props.label,
|
|
145
143
|
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 _uiPropTypes = require("@instructure/ui-prop-types");
|
|
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([_uiPropTypes.element, _propTypes.default.arrayOf(_uiPropTypes.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.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
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.
|
|
28
|
-
"@instructure/ui-a11y-utils": "8.56.
|
|
29
|
-
"@instructure/ui-dom-utils": "8.56.
|
|
30
|
-
"@instructure/ui-react-utils": "8.56.
|
|
31
|
-
"@instructure/ui-testable": "8.56.
|
|
27
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
28
|
+
"@instructure/ui-a11y-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/ui-dom-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
31
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
|
32
32
|
"prop-types": "^15.8.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@instructure/console": "8.56.
|
|
36
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
37
|
-
"@instructure/ui-prop-types": "8.56.
|
|
35
|
+
"@instructure/console": "8.56.2-pr-snapshot-1721749364069",
|
|
36
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
37
|
+
"@instructure/ui-prop-types": "8.56.2-pr-snapshot-1721749364069",
|
|
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"
|