@instructure/ui-dialog 8.11.2-snapshot.3 → 8.11.2-snapshot.45
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/es/Dialog/index.js +10 -7
- package/lib/Dialog/index.js +10 -7
- package/package.json +11 -11
- package/src/Dialog/index.tsx +11 -5
- package/types/Dialog/index.d.ts +1 -1
- package/types/Dialog/index.d.ts.map +1 -1
package/es/Dialog/index.js
CHANGED
|
@@ -44,12 +44,9 @@ class Dialog extends Component {
|
|
|
44
44
|
this._raf = [];
|
|
45
45
|
this._focusRegion = null;
|
|
46
46
|
this.ref = null;
|
|
47
|
-
this._root = null;
|
|
48
47
|
|
|
49
48
|
this.getRef = el => {
|
|
50
|
-
const elementRef = this.props.elementRef;
|
|
51
|
-
|
|
52
|
-
this._root = el;
|
|
49
|
+
const elementRef = this.props.elementRef;
|
|
53
50
|
this.ref = el;
|
|
54
51
|
|
|
55
52
|
if (typeof elementRef === 'function') {
|
|
@@ -58,6 +55,10 @@ class Dialog extends Component {
|
|
|
58
55
|
};
|
|
59
56
|
}
|
|
60
57
|
|
|
58
|
+
get _root() {
|
|
59
|
+
return this.ref;
|
|
60
|
+
}
|
|
61
|
+
|
|
61
62
|
componentDidMount() {
|
|
62
63
|
if (this.props.open) {
|
|
63
64
|
this.open();
|
|
@@ -141,7 +142,7 @@ class Dialog extends Component {
|
|
|
141
142
|
let contentElement = findDOMNode(this.props.contentElement);
|
|
142
143
|
|
|
143
144
|
if (!contentElement) {
|
|
144
|
-
contentElement = findDOMNode(this.
|
|
145
|
+
contentElement = findDOMNode(this.ref);
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
return contentElement;
|
|
@@ -152,9 +153,11 @@ class Dialog extends Component {
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
render() {
|
|
155
|
-
const ElementType = getElementType(Dialog, this.props);
|
|
156
|
+
const ElementType = getElementType(Dialog, this.props); // In case the HTML role attribute is explicitly passed, use props.role
|
|
157
|
+
|
|
158
|
+
const role = this.props.role || (this.props.label ? 'dialog' : void 0);
|
|
156
159
|
return this.props.open ? /*#__PURE__*/React.createElement(ElementType, Object.assign({}, omitProps(this.props, Dialog.allowedProps), {
|
|
157
|
-
role:
|
|
160
|
+
role: role,
|
|
158
161
|
"aria-label": this.props.label,
|
|
159
162
|
className: this.props.className // eslint-disable-line react/prop-types
|
|
160
163
|
,
|
package/lib/Dialog/index.js
CHANGED
|
@@ -42,12 +42,9 @@ class Dialog extends _react.Component {
|
|
|
42
42
|
this._raf = [];
|
|
43
43
|
this._focusRegion = null;
|
|
44
44
|
this.ref = null;
|
|
45
|
-
this._root = null;
|
|
46
45
|
|
|
47
46
|
this.getRef = el => {
|
|
48
|
-
const elementRef = this.props.elementRef;
|
|
49
|
-
|
|
50
|
-
this._root = el;
|
|
47
|
+
const elementRef = this.props.elementRef;
|
|
51
48
|
this.ref = el;
|
|
52
49
|
|
|
53
50
|
if (typeof elementRef === 'function') {
|
|
@@ -56,6 +53,10 @@ class Dialog extends _react.Component {
|
|
|
56
53
|
};
|
|
57
54
|
}
|
|
58
55
|
|
|
56
|
+
get _root() {
|
|
57
|
+
return this.ref;
|
|
58
|
+
}
|
|
59
|
+
|
|
59
60
|
componentDidMount() {
|
|
60
61
|
if (this.props.open) {
|
|
61
62
|
this.open();
|
|
@@ -139,7 +140,7 @@ class Dialog extends _react.Component {
|
|
|
139
140
|
let contentElement = (0, _findDOMNode.findDOMNode)(this.props.contentElement);
|
|
140
141
|
|
|
141
142
|
if (!contentElement) {
|
|
142
|
-
contentElement = (0, _findDOMNode.findDOMNode)(this.
|
|
143
|
+
contentElement = (0, _findDOMNode.findDOMNode)(this.ref);
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
return contentElement;
|
|
@@ -150,9 +151,11 @@ class Dialog extends _react.Component {
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
render() {
|
|
153
|
-
const ElementType = (0, _getElementType.getElementType)(Dialog, this.props);
|
|
154
|
+
const ElementType = (0, _getElementType.getElementType)(Dialog, this.props); // In case the HTML role attribute is explicitly passed, use props.role
|
|
155
|
+
|
|
156
|
+
const role = this.props.role || (this.props.label ? 'dialog' : void 0);
|
|
154
157
|
return this.props.open ? /*#__PURE__*/_react.default.createElement(ElementType, Object.assign({}, (0, _omitProps.omitProps)(this.props, Dialog.allowedProps), {
|
|
155
|
-
role:
|
|
158
|
+
role: role,
|
|
156
159
|
"aria-label": this.props.label,
|
|
157
160
|
className: this.props.className // eslint-disable-line react/prop-types
|
|
158
161
|
,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-dialog",
|
|
3
|
-
"version": "8.11.2-snapshot.
|
|
3
|
+
"version": "8.11.2-snapshot.45+e3249d228",
|
|
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
|
"type": "commonjs",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/shared-types": "8.11.2-snapshot.
|
|
29
|
-
"@instructure/ui-a11y-utils": "8.11.2-snapshot.
|
|
30
|
-
"@instructure/ui-dom-utils": "8.11.2-snapshot.
|
|
31
|
-
"@instructure/ui-react-utils": "8.11.2-snapshot.
|
|
32
|
-
"@instructure/ui-testable": "8.11.2-snapshot.
|
|
28
|
+
"@instructure/shared-types": "8.11.2-snapshot.45+e3249d228",
|
|
29
|
+
"@instructure/ui-a11y-utils": "8.11.2-snapshot.45+e3249d228",
|
|
30
|
+
"@instructure/ui-dom-utils": "8.11.2-snapshot.45+e3249d228",
|
|
31
|
+
"@instructure/ui-react-utils": "8.11.2-snapshot.45+e3249d228",
|
|
32
|
+
"@instructure/ui-testable": "8.11.2-snapshot.45+e3249d228",
|
|
33
33
|
"prop-types": "^15"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@instructure/console": "8.11.2-snapshot.
|
|
37
|
-
"@instructure/ui-babel-preset": "8.11.2-snapshot.
|
|
38
|
-
"@instructure/ui-prop-types": "8.11.2-snapshot.
|
|
39
|
-
"@instructure/ui-test-utils": "8.11.2-snapshot.
|
|
36
|
+
"@instructure/console": "8.11.2-snapshot.45+e3249d228",
|
|
37
|
+
"@instructure/ui-babel-preset": "8.11.2-snapshot.45+e3249d228",
|
|
38
|
+
"@instructure/ui-prop-types": "8.11.2-snapshot.45+e3249d228",
|
|
39
|
+
"@instructure/ui-test-utils": "8.11.2-snapshot.45+e3249d228"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=16.8 <=17"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false,
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e3249d228eabac5bb98ff5d22e5881f2fe042606"
|
|
49
49
|
}
|
package/src/Dialog/index.tsx
CHANGED
|
@@ -66,8 +66,13 @@ class Dialog extends Component<DialogProps> {
|
|
|
66
66
|
_raf: RequestAnimationFrameType[] = []
|
|
67
67
|
_focusRegion = null
|
|
68
68
|
ref: Element | null = null
|
|
69
|
-
_root
|
|
69
|
+
get _root() {
|
|
70
|
+
console.warn(
|
|
71
|
+
'_root property is deprecated and will be removed in v9, please use ref instead'
|
|
72
|
+
)
|
|
70
73
|
|
|
74
|
+
return this.ref
|
|
75
|
+
}
|
|
71
76
|
componentDidMount() {
|
|
72
77
|
if (this.props.open) {
|
|
73
78
|
this.open()
|
|
@@ -157,8 +162,6 @@ class Dialog extends Component<DialogProps> {
|
|
|
157
162
|
getRef = (el: Element | null) => {
|
|
158
163
|
const { elementRef } = this.props
|
|
159
164
|
|
|
160
|
-
// TODO: deprecate _root? ref should be enough
|
|
161
|
-
this._root = el
|
|
162
165
|
this.ref = el
|
|
163
166
|
|
|
164
167
|
if (typeof elementRef === 'function') {
|
|
@@ -170,7 +173,7 @@ class Dialog extends Component<DialogProps> {
|
|
|
170
173
|
let contentElement = findDOMNode(this.props.contentElement)
|
|
171
174
|
|
|
172
175
|
if (!contentElement) {
|
|
173
|
-
contentElement = findDOMNode(this.
|
|
176
|
+
contentElement = findDOMNode(this.ref)
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
return contentElement
|
|
@@ -188,11 +191,14 @@ class Dialog extends Component<DialogProps> {
|
|
|
188
191
|
render() {
|
|
189
192
|
const ElementType = getElementType(Dialog, this.props)
|
|
190
193
|
|
|
194
|
+
// In case the HTML role attribute is explicitly passed, use props.role
|
|
195
|
+
const role = this.props.role || (this.props.label ? 'dialog' : undefined)
|
|
196
|
+
|
|
191
197
|
return this.props.open ? (
|
|
192
198
|
<ElementType
|
|
193
199
|
// @ts-expect-error TODO: `ref` prop causes: "Expression produces a union type that is too complex to represent.ts(2590)"
|
|
194
200
|
{...omitProps(this.props, Dialog.allowedProps)}
|
|
195
|
-
role={
|
|
201
|
+
role={role}
|
|
196
202
|
aria-label={this.props.label}
|
|
197
203
|
className={this.props.className} // eslint-disable-line react/prop-types
|
|
198
204
|
ref={this.getRef}
|
package/types/Dialog/index.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ declare class Dialog extends Component<DialogProps> {
|
|
|
63
63
|
_raf: RequestAnimationFrameType[];
|
|
64
64
|
_focusRegion: null;
|
|
65
65
|
ref: Element | null;
|
|
66
|
-
_root: Element | null;
|
|
66
|
+
get _root(): Element | null;
|
|
67
67
|
componentDidMount(): void;
|
|
68
68
|
componentDidUpdate(prevProps: any): void;
|
|
69
69
|
componentWillUnmount(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Dialog/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,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