@ringcentral/juno 2.46.0 → 2.52.0
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { useRcPortalWindowContext } from '../../contexts/PortalWindowContext';
|
|
2
3
|
import { useId } from '../useId';
|
|
3
4
|
export var visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n";
|
|
4
5
|
/**
|
|
@@ -14,7 +15,9 @@ export var visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px
|
|
|
14
15
|
export var useAnnouncer = function (id) {
|
|
15
16
|
var _id = useId(id ? "rc-announcer-" + id : 'rc-announcer', !id);
|
|
16
17
|
var ref = useRef(null);
|
|
18
|
+
var _a = useRcPortalWindowContext().externalWindow, externalWindow = _a === void 0 ? window : _a;
|
|
17
19
|
useEffect(function () {
|
|
20
|
+
var document = externalWindow.document;
|
|
18
21
|
var el = document.createElement('div');
|
|
19
22
|
ref.current = el;
|
|
20
23
|
el.id = _id;
|
|
@@ -34,7 +37,7 @@ export var useAnnouncer = function (id) {
|
|
|
34
37
|
}
|
|
35
38
|
});
|
|
36
39
|
};
|
|
37
|
-
}, [_id]);
|
|
40
|
+
}, [_id, externalWindow]);
|
|
38
41
|
/** announce method, call with message that want let reader speak */
|
|
39
42
|
var announce = useCallback(function (message) {
|
|
40
43
|
var el = ref.current;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var react_1 = require("react");
|
|
4
|
+
var PortalWindowContext_1 = require("../../contexts/PortalWindowContext");
|
|
4
5
|
var useId_1 = require("../useId");
|
|
5
6
|
exports.visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n";
|
|
6
7
|
/**
|
|
@@ -16,7 +17,9 @@ exports.visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1
|
|
|
16
17
|
exports.useAnnouncer = function (id) {
|
|
17
18
|
var _id = useId_1.useId(id ? "rc-announcer-" + id : 'rc-announcer', !id);
|
|
18
19
|
var ref = react_1.useRef(null);
|
|
20
|
+
var _a = PortalWindowContext_1.useRcPortalWindowContext().externalWindow, externalWindow = _a === void 0 ? window : _a;
|
|
19
21
|
react_1.useEffect(function () {
|
|
22
|
+
var document = externalWindow.document;
|
|
20
23
|
var el = document.createElement('div');
|
|
21
24
|
ref.current = el;
|
|
22
25
|
el.id = _id;
|
|
@@ -36,7 +39,7 @@ exports.useAnnouncer = function (id) {
|
|
|
36
39
|
}
|
|
37
40
|
});
|
|
38
41
|
};
|
|
39
|
-
}, [_id]);
|
|
42
|
+
}, [_id, externalWindow]);
|
|
40
43
|
/** announce method, call with message that want let reader speak */
|
|
41
44
|
var announce = react_1.useCallback(function (message) {
|
|
42
45
|
var el = ref.current;
|