@fluentui/react-portal-compat 9.0.94 → 9.0.95
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.json +28 -1
- package/CHANGELOG.md +13 -2
- package/lib/PortalCompatProvider.js +22 -22
- package/lib/PortalCompatProvider.js.map +1 -1
- package/lib-amd/PortalCompatProvider.js +33 -25
- package/lib-amd/PortalCompatProvider.js.map +1 -1
- package/lib-commonjs/PortalCompatProvider.js +33 -25
- package/lib-commonjs/PortalCompatProvider.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,34 @@
|
|
|
2
2
|
"name": "@fluentui/react-portal-compat",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 02 Oct 2023 08:53:04 GMT",
|
|
6
|
+
"tag": "@fluentui/react-portal-compat_v9.0.95",
|
|
7
|
+
"version": "9.0.95",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "olfedias@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-portal-compat",
|
|
13
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e",
|
|
14
|
+
"comment": "fix: handle multiple classes in PortalCompatProvider"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-portal-compat",
|
|
19
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.2",
|
|
20
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-portal-compat",
|
|
25
|
+
"comment": "Bump @fluentui/react-components to v9.33.0",
|
|
26
|
+
"commit": "18ddec93bdb85a009bc1392058c52b2ea336340e"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"date": "Tue, 26 Sep 2023 17:49:09 GMT",
|
|
6
33
|
"tag": "@fluentui/react-portal-compat_v9.0.94",
|
|
7
34
|
"version": "9.0.94",
|
|
8
35
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-portal-compat
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 02 Oct 2023 08:53:04 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.95](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal-compat_v9.0.95)
|
|
8
|
+
|
|
9
|
+
Mon, 02 Oct 2023 08:53:04 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal-compat_v9.0.94..@fluentui/react-portal-compat_v9.0.95)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix: handle multiple classes in PortalCompatProvider ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by olfedias@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-tabster to v9.13.2 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
16
|
+
- Bump @fluentui/react-components to v9.33.0 ([PR #29351](https://github.com/microsoft/fluentui/pull/29351) by beachball)
|
|
17
|
+
|
|
7
18
|
## [9.0.94](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal-compat_v9.0.94)
|
|
8
19
|
|
|
9
|
-
Tue, 26 Sep 2023 17:
|
|
20
|
+
Tue, 26 Sep 2023 17:49:09 GMT
|
|
10
21
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-portal-compat_v9.0.93..@fluentui/react-portal-compat_v9.0.94)
|
|
11
22
|
|
|
12
23
|
### Patches
|
|
@@ -2,35 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
import { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';
|
|
3
3
|
import { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';
|
|
4
4
|
import { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';
|
|
5
|
-
const CLASS_NAME_REGEX = new RegExp(`([^\\s]*${fluentProviderClassNames.root}\\w+)
|
|
6
|
-
export
|
|
7
|
-
const { children } = props;
|
|
5
|
+
const CLASS_NAME_REGEX = new RegExp(`([^\\s]*${fluentProviderClassNames.root}\\w+)`, 'g');
|
|
6
|
+
export function useProviderThemeClasses() {
|
|
8
7
|
const themeClassName = useThemeClassName();
|
|
9
|
-
const
|
|
8
|
+
const cssVariablesClasses = React.useMemo(// "themeClassName" may contain multiple classes while we want to add only classes that host CSS variables
|
|
10
9
|
// Keep in sync with "packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts"
|
|
11
10
|
()=>{
|
|
12
11
|
var _themeClassName_match;
|
|
13
|
-
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX))
|
|
12
|
+
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) !== null && _themeClassName_match !== void 0 ? _themeClassName_match : [];
|
|
14
13
|
}, [
|
|
15
14
|
themeClassName
|
|
16
15
|
]);
|
|
17
|
-
const registerPortalEl = React.useCallback((element)=>{
|
|
18
|
-
let disposeFocusVisiblePolyfill = ()=>undefined;
|
|
19
|
-
if (cssVariablesClassName) {
|
|
20
|
-
element.classList.add(cssVariablesClassName);
|
|
21
|
-
if (element.ownerDocument.defaultView) {
|
|
22
|
-
disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return ()=>{
|
|
26
|
-
if (cssVariablesClassName) {
|
|
27
|
-
element.classList.remove(cssVariablesClassName);
|
|
28
|
-
}
|
|
29
|
-
disposeFocusVisiblePolyfill();
|
|
30
|
-
};
|
|
31
|
-
}, [
|
|
32
|
-
cssVariablesClassName
|
|
33
|
-
]);
|
|
34
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
35
17
|
// This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle
|
|
36
18
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -46,6 +28,24 @@ export const PortalCompatProvider = (props)=>{
|
|
|
46
28
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
29
|
}, []);
|
|
48
30
|
}
|
|
31
|
+
return cssVariablesClasses;
|
|
32
|
+
}
|
|
33
|
+
export const PortalCompatProvider = (props)=>{
|
|
34
|
+
const { children } = props;
|
|
35
|
+
const cssVariablesClasses = useProviderThemeClasses();
|
|
36
|
+
const registerPortalEl = React.useCallback((element)=>{
|
|
37
|
+
let disposeFocusVisiblePolyfill = ()=>undefined;
|
|
38
|
+
element.classList.add(...cssVariablesClasses);
|
|
39
|
+
if (element.ownerDocument.defaultView) {
|
|
40
|
+
disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);
|
|
41
|
+
}
|
|
42
|
+
return ()=>{
|
|
43
|
+
element.classList.remove(...cssVariablesClasses);
|
|
44
|
+
disposeFocusVisiblePolyfill();
|
|
45
|
+
};
|
|
46
|
+
}, [
|
|
47
|
+
cssVariablesClasses
|
|
48
|
+
]);
|
|
49
49
|
return /*#__PURE__*/ React.createElement(PortalCompatContextProvider, {
|
|
50
50
|
value: registerPortalEl
|
|
51
51
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PortalCompatProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\n\nimport type { RegisterPortalFn } from '@fluentui/react-portal-compat-context';\n\nconst CLASS_NAME_REGEX = new RegExp(`([^\\\\s]*${fluentProviderClassNames.root}\\\\w+)
|
|
1
|
+
{"version":3,"sources":["PortalCompatProvider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\n\nimport type { RegisterPortalFn } from '@fluentui/react-portal-compat-context';\n\nconst CLASS_NAME_REGEX = new RegExp(`([^\\\\s]*${fluentProviderClassNames.root}\\\\w+)`, 'g');\n\nexport function useProviderThemeClasses(): string[] {\n const themeClassName = useThemeClassName();\n const cssVariablesClasses = React.useMemo<string[]>(\n // \"themeClassName\" may contain multiple classes while we want to add only classes that host CSS variables\n // Keep in sync with \"packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts\"\n () => themeClassName.match(CLASS_NAME_REGEX) ?? [],\n [themeClassName],\n );\n\n if (process.env.NODE_ENV !== 'production') {\n // This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (themeClassName === '') {\n // eslint-disable-next-line no-console\n console.warn(`\n PortalCompatProvider: \"useThemeClassName()\" hook returned an empty string\n =============================================\n Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.\n `);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n return cssVariablesClasses;\n}\n\nexport const PortalCompatProvider: React.FC<{ children?: React.ReactNode }> = props => {\n const { children } = props;\n const cssVariablesClasses = useProviderThemeClasses();\n\n const registerPortalEl = React.useCallback<RegisterPortalFn>(\n element => {\n let disposeFocusVisiblePolyfill: () => void = () => undefined;\n\n element.classList.add(...cssVariablesClasses);\n if (element.ownerDocument.defaultView) {\n disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);\n }\n\n return () => {\n element.classList.remove(...cssVariablesClasses);\n disposeFocusVisiblePolyfill();\n };\n },\n [cssVariablesClasses],\n );\n\n return <PortalCompatContextProvider value={registerPortalEl}>{children}</PortalCompatContextProvider>;\n};\n"],"names":["React","fluentProviderClassNames","useThemeClassName","PortalCompatContextProvider","applyFocusVisiblePolyfill","CLASS_NAME_REGEX","RegExp","root","useProviderThemeClasses","themeClassName","cssVariablesClasses","useMemo","match","process","env","NODE_ENV","useEffect","console","warn","PortalCompatProvider","props","children","registerPortalEl","useCallback","element","disposeFocusVisiblePolyfill","undefined","classList","add","ownerDocument","defaultView","remove","value"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,iBAAiB,QAAQ,6BAA6B;AACzF,SAASC,2BAA2B,QAAQ,wCAAwC;AACpF,SAASC,yBAAyB,QAAQ,0BAA0B;AAIpE,MAAMC,mBAAmB,IAAIC,OAAO,CAAC,QAAQ,EAAEL,yBAAyBM,IAAI,CAAC,KAAK,CAAC,EAAE;AAErF,OAAO,SAASC;IACd,MAAMC,iBAAiBP;IACvB,MAAMQ,sBAAsBV,MAAMW,OAAO,CACvC,0GAA0G;IAC1G,8GAA8G;IAC9G;YAAMF;eAAAA,CAAAA,wBAAAA,eAAeG,KAAK,CAACP,+BAArBI,mCAAAA,wBAA0C,EAAE;IAAD,GACjD;QAACA;KAAe;IAGlB,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,+GAA+G;QAC/G,sDAAsD;QACtDf,MAAMgB,SAAS,CAAC;YACd,IAAIP,mBAAmB,IAAI;gBACzB,sCAAsC;gBACtCQ,QAAQC,IAAI,CAAC,CAAC;;;;MAIhB,CAAC;YACD;QACA,uDAAuD;QACzD,GAAG,EAAE;IACP;IAEA,OAAOR;AACT;AAEA,OAAO,MAAMS,uBAAiEC,CAAAA;IAC5E,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IACrB,MAAMV,sBAAsBF;IAE5B,MAAMc,mBAAmBtB,MAAMuB,WAAW,CACxCC,CAAAA;QACE,IAAIC,8BAA0C,IAAMC;QAEpDF,QAAQG,SAAS,CAACC,GAAG,IAAIlB;QACzB,IAAIc,QAAQK,aAAa,CAACC,WAAW,EAAE;YACrCL,8BAA8BrB,0BAA0BoB,SAASA,QAAQK,aAAa,CAACC,WAAW;QACpG;QAEA,OAAO;YACLN,QAAQG,SAAS,CAACI,MAAM,IAAIrB;YAC5Be;QACF;IACF,GACA;QAACf;KAAoB;IAGvB,qBAAO,oBAACP;QAA4B6B,OAAOV;OAAmBD;AAChE,EAAE"}
|
|
@@ -11,41 +11,31 @@ define([
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", {
|
|
12
12
|
value: true
|
|
13
13
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
function _export(target, all) {
|
|
15
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: all[name]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
_export(exports, {
|
|
21
|
+
useProviderThemeClasses: function() {
|
|
22
|
+
return useProviderThemeClasses;
|
|
23
|
+
},
|
|
24
|
+
PortalCompatProvider: function() {
|
|
17
25
|
return PortalCompatProvider;
|
|
18
26
|
}
|
|
19
27
|
});
|
|
20
28
|
_react = /*#__PURE__*/ _interop_require_wildcard._(_react);
|
|
21
|
-
const CLASS_NAME_REGEX = new RegExp(`([^\\s]*${_reactcomponents.fluentProviderClassNames.root}\\w+)
|
|
22
|
-
|
|
23
|
-
const { children } = props;
|
|
29
|
+
const CLASS_NAME_REGEX = new RegExp(`([^\\s]*${_reactcomponents.fluentProviderClassNames.root}\\w+)`, 'g');
|
|
30
|
+
function useProviderThemeClasses() {
|
|
24
31
|
const themeClassName = (0, _reactcomponents.useThemeClassName)();
|
|
25
|
-
const
|
|
32
|
+
const cssVariablesClasses = _react.useMemo(// Keep in sync with "packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts"
|
|
26
33
|
()=>{
|
|
27
34
|
var _themeClassName_match;
|
|
28
|
-
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX))
|
|
35
|
+
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) !== null && _themeClassName_match !== void 0 ? _themeClassName_match : [];
|
|
29
36
|
}, [
|
|
30
37
|
themeClassName
|
|
31
38
|
]);
|
|
32
|
-
const registerPortalEl = _react.useCallback((element)=>{
|
|
33
|
-
let disposeFocusVisiblePolyfill = ()=>undefined;
|
|
34
|
-
if (cssVariablesClassName) {
|
|
35
|
-
element.classList.add(cssVariablesClassName);
|
|
36
|
-
if (element.ownerDocument.defaultView) {
|
|
37
|
-
disposeFocusVisiblePolyfill = (0, _reacttabster.applyFocusVisiblePolyfill)(element, element.ownerDocument.defaultView);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return ()=>{
|
|
41
|
-
if (cssVariablesClassName) {
|
|
42
|
-
element.classList.remove(cssVariablesClassName);
|
|
43
|
-
}
|
|
44
|
-
disposeFocusVisiblePolyfill();
|
|
45
|
-
};
|
|
46
|
-
}, [
|
|
47
|
-
cssVariablesClassName
|
|
48
|
-
]);
|
|
49
39
|
if (process.env.NODE_ENV !== 'production') {
|
|
50
40
|
// This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle
|
|
51
41
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -61,6 +51,24 @@ define([
|
|
|
61
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
52
|
}, []);
|
|
63
53
|
}
|
|
54
|
+
return cssVariablesClasses;
|
|
55
|
+
}
|
|
56
|
+
const PortalCompatProvider = (props)=>{
|
|
57
|
+
const { children } = props;
|
|
58
|
+
const cssVariablesClasses = useProviderThemeClasses();
|
|
59
|
+
const registerPortalEl = _react.useCallback((element)=>{
|
|
60
|
+
let disposeFocusVisiblePolyfill = ()=>undefined;
|
|
61
|
+
element.classList.add(...cssVariablesClasses);
|
|
62
|
+
if (element.ownerDocument.defaultView) {
|
|
63
|
+
disposeFocusVisiblePolyfill = (0, _reacttabster.applyFocusVisiblePolyfill)(element, element.ownerDocument.defaultView);
|
|
64
|
+
}
|
|
65
|
+
return ()=>{
|
|
66
|
+
element.classList.remove(...cssVariablesClasses);
|
|
67
|
+
disposeFocusVisiblePolyfill();
|
|
68
|
+
};
|
|
69
|
+
}, [
|
|
70
|
+
cssVariablesClasses
|
|
71
|
+
]);
|
|
64
72
|
return /*#__PURE__*/ _react.createElement(_reactportalcompatcontext.PortalCompatContextProvider, {
|
|
65
73
|
value: registerPortalEl
|
|
66
74
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PortalCompatProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\nconst CLASS_NAME_REGEX = new RegExp(`([^\\\\s]*${fluentProviderClassNames.root}\\\\w+)
|
|
1
|
+
{"version":3,"sources":["PortalCompatProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\nconst CLASS_NAME_REGEX = new RegExp(`([^\\\\s]*${fluentProviderClassNames.root}\\\\w+)`, 'g');\nexport function useProviderThemeClasses() {\n const themeClassName = useThemeClassName();\n const cssVariablesClasses = React.useMemo(// \"themeClassName\" may contain multiple classes while we want to add only classes that host CSS variables\n // Keep in sync with \"packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts\"\n ()=>{\n var _themeClassName_match;\n return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) !== null && _themeClassName_match !== void 0 ? _themeClassName_match : [];\n }, [\n themeClassName\n ]);\n if (process.env.NODE_ENV !== 'production') {\n // This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(()=>{\n if (themeClassName === '') {\n // eslint-disable-next-line no-console\n console.warn(`\n PortalCompatProvider: \"useThemeClassName()\" hook returned an empty string\n =============================================\n Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.\n `);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n return cssVariablesClasses;\n}\nexport const PortalCompatProvider = (props)=>{\n const { children } = props;\n const cssVariablesClasses = useProviderThemeClasses();\n const registerPortalEl = React.useCallback((element)=>{\n let disposeFocusVisiblePolyfill = ()=>undefined;\n element.classList.add(...cssVariablesClasses);\n if (element.ownerDocument.defaultView) {\n disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);\n }\n return ()=>{\n element.classList.remove(...cssVariablesClasses);\n disposeFocusVisiblePolyfill();\n };\n }, [\n cssVariablesClasses\n ]);\n return /*#__PURE__*/ React.createElement(PortalCompatContextProvider, {\n value: registerPortalEl\n }, children);\n};\n"],"names":["useProviderThemeClasses","PortalCompatProvider","CLASS_NAME_REGEX","RegExp","fluentProviderClassNames","root","themeClassName","useThemeClassName","cssVariablesClasses","React","useMemo","_themeClassName_match","match","process","env","NODE_ENV","useEffect","console","warn","props","children","registerPortalEl","useCallback","element","disposeFocusVisiblePolyfill","undefined","classList","add","ownerDocument","defaultView","applyFocusVisiblePolyfill","remove","createElement","PortalCompatContextProvider","value"],"mappings":";;;;IAAuB;IACqC;IAChB;IACF;;;;;;;;;;;;;QAE1BA,uBAAuB;mBAAvBA;;QA2BHC,oBAAoB;mBAApBA;;;;IA5Bb,MAAMC,mBAAmB,IAAIC,OAAO,CAAC,QAAQ,EAAEC,yCAAwB,CAACC,IAAI,CAAC,KAAK,CAAC,EAAE;IAC9E,SAASL;QACZ,MAAMM,iBAAiBC,IAAAA,kCAAiB;QACxC,MAAMC,sBAAsBC,OAAMC,OAAO,CACzC,8GAA8G;QAC9G;YACI,IAAIC;YACJ,OAAO,AAACA,CAAAA,wBAAwBL,eAAeM,KAAK,CAACV,iBAAgB,MAAO,QAAQS,0BAA0B,KAAK,IAAIA,wBAAwB,EAAE;QACrJ,GAAG;YACCL;SACH;QACD,IAAIO,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACvC,+GAA+G;YAC/G,sDAAsD;YACtDN,OAAMO,SAAS,CAAC;gBACZ,IAAIV,mBAAmB,IAAI;oBACvB,sCAAsC;oBACtCW,QAAQC,IAAI,CAAC,CAAC;;;;MAIxB,CAAC;gBACK;YACJ,uDAAuD;YACvD,GAAG,EAAE;QACT;QACA,OAAOV;IACX;IACO,MAAMP,uBAAuB,CAACkB;QACjC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;QACrB,MAAMX,sBAAsBR;QAC5B,MAAMqB,mBAAmBZ,OAAMa,WAAW,CAAC,CAACC;YACxC,IAAIC,8BAA8B,IAAIC;YACtCF,QAAQG,SAAS,CAACC,GAAG,IAAInB;YACzB,IAAIe,QAAQK,aAAa,CAACC,WAAW,EAAE;gBACnCL,8BAA8BM,IAAAA,uCAAyB,EAACP,SAASA,QAAQK,aAAa,CAACC,WAAW;YACtG;YACA,OAAO;gBACHN,QAAQG,SAAS,CAACK,MAAM,IAAIvB;gBAC5BgB;YACJ;QACJ,GAAG;YACChB;SACH;QACD,OAAO,WAAW,GAAGC,OAAMuB,aAAa,CAACC,qDAA2B,EAAE;YAClEC,OAAOb;QACX,GAAGD;IACP"}
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
useProviderThemeClasses: function() {
|
|
13
|
+
return useProviderThemeClasses;
|
|
14
|
+
},
|
|
15
|
+
PortalCompatProvider: function() {
|
|
8
16
|
return PortalCompatProvider;
|
|
9
17
|
}
|
|
10
18
|
});
|
|
@@ -13,34 +21,16 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
|
13
21
|
const _reactcomponents = require("@fluentui/react-components");
|
|
14
22
|
const _reactportalcompatcontext = require("@fluentui/react-portal-compat-context");
|
|
15
23
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
16
|
-
const CLASS_NAME_REGEX = new RegExp(`([^\\s]*${_reactcomponents.fluentProviderClassNames.root}\\w+)
|
|
17
|
-
|
|
18
|
-
const { children } = props;
|
|
24
|
+
const CLASS_NAME_REGEX = new RegExp(`([^\\s]*${_reactcomponents.fluentProviderClassNames.root}\\w+)`, 'g');
|
|
25
|
+
function useProviderThemeClasses() {
|
|
19
26
|
const themeClassName = (0, _reactcomponents.useThemeClassName)();
|
|
20
|
-
const
|
|
27
|
+
const cssVariablesClasses = _react.useMemo(// Keep in sync with "packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts"
|
|
21
28
|
()=>{
|
|
22
29
|
var _themeClassName_match;
|
|
23
|
-
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX))
|
|
30
|
+
return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) !== null && _themeClassName_match !== void 0 ? _themeClassName_match : [];
|
|
24
31
|
}, [
|
|
25
32
|
themeClassName
|
|
26
33
|
]);
|
|
27
|
-
const registerPortalEl = _react.useCallback((element)=>{
|
|
28
|
-
let disposeFocusVisiblePolyfill = ()=>undefined;
|
|
29
|
-
if (cssVariablesClassName) {
|
|
30
|
-
element.classList.add(cssVariablesClassName);
|
|
31
|
-
if (element.ownerDocument.defaultView) {
|
|
32
|
-
disposeFocusVisiblePolyfill = (0, _reacttabster.applyFocusVisiblePolyfill)(element, element.ownerDocument.defaultView);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return ()=>{
|
|
36
|
-
if (cssVariablesClassName) {
|
|
37
|
-
element.classList.remove(cssVariablesClassName);
|
|
38
|
-
}
|
|
39
|
-
disposeFocusVisiblePolyfill();
|
|
40
|
-
};
|
|
41
|
-
}, [
|
|
42
|
-
cssVariablesClassName
|
|
43
|
-
]);
|
|
44
34
|
if (process.env.NODE_ENV !== 'production') {
|
|
45
35
|
// This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle
|
|
46
36
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -56,6 +46,24 @@ const PortalCompatProvider = (props)=>{
|
|
|
56
46
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
47
|
}, []);
|
|
58
48
|
}
|
|
49
|
+
return cssVariablesClasses;
|
|
50
|
+
}
|
|
51
|
+
const PortalCompatProvider = (props)=>{
|
|
52
|
+
const { children } = props;
|
|
53
|
+
const cssVariablesClasses = useProviderThemeClasses();
|
|
54
|
+
const registerPortalEl = _react.useCallback((element)=>{
|
|
55
|
+
let disposeFocusVisiblePolyfill = ()=>undefined;
|
|
56
|
+
element.classList.add(...cssVariablesClasses);
|
|
57
|
+
if (element.ownerDocument.defaultView) {
|
|
58
|
+
disposeFocusVisiblePolyfill = (0, _reacttabster.applyFocusVisiblePolyfill)(element, element.ownerDocument.defaultView);
|
|
59
|
+
}
|
|
60
|
+
return ()=>{
|
|
61
|
+
element.classList.remove(...cssVariablesClasses);
|
|
62
|
+
disposeFocusVisiblePolyfill();
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
cssVariablesClasses
|
|
66
|
+
]);
|
|
59
67
|
return /*#__PURE__*/ _react.createElement(_reactportalcompatcontext.PortalCompatContextProvider, {
|
|
60
68
|
value: registerPortalEl
|
|
61
69
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PortalCompatProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\nconst CLASS_NAME_REGEX = new RegExp(`([^\\\\s]*${fluentProviderClassNames.root}\\\\w+)
|
|
1
|
+
{"version":3,"sources":["PortalCompatProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { fluentProviderClassNames, useThemeClassName } from '@fluentui/react-components';\nimport { PortalCompatContextProvider } from '@fluentui/react-portal-compat-context';\nimport { applyFocusVisiblePolyfill } from '@fluentui/react-tabster';\nconst CLASS_NAME_REGEX = new RegExp(`([^\\\\s]*${fluentProviderClassNames.root}\\\\w+)`, 'g');\nexport function useProviderThemeClasses() {\n const themeClassName = useThemeClassName();\n const cssVariablesClasses = React.useMemo(// \"themeClassName\" may contain multiple classes while we want to add only classes that host CSS variables\n // Keep in sync with \"packages/react-provider/src/components/FluentProvider/useFluentProviderThemeStyleTag.ts\"\n ()=>{\n var _themeClassName_match;\n return (_themeClassName_match = themeClassName.match(CLASS_NAME_REGEX)) !== null && _themeClassName_match !== void 0 ? _themeClassName_match : [];\n }, [\n themeClassName\n ]);\n if (process.env.NODE_ENV !== 'production') {\n // This if statement technically breaks the rules of hooks, but ENV variables never change during app lifecycle\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(()=>{\n if (themeClassName === '') {\n // eslint-disable-next-line no-console\n console.warn(`\n PortalCompatProvider: \"useThemeClassName()\" hook returned an empty string\n =============================================\n Make sure that PortalCompatProvider is rendered inside FluentProvider as a child.\n `);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n return cssVariablesClasses;\n}\nexport const PortalCompatProvider = (props)=>{\n const { children } = props;\n const cssVariablesClasses = useProviderThemeClasses();\n const registerPortalEl = React.useCallback((element)=>{\n let disposeFocusVisiblePolyfill = ()=>undefined;\n element.classList.add(...cssVariablesClasses);\n if (element.ownerDocument.defaultView) {\n disposeFocusVisiblePolyfill = applyFocusVisiblePolyfill(element, element.ownerDocument.defaultView);\n }\n return ()=>{\n element.classList.remove(...cssVariablesClasses);\n disposeFocusVisiblePolyfill();\n };\n }, [\n cssVariablesClasses\n ]);\n return /*#__PURE__*/ React.createElement(PortalCompatContextProvider, {\n value: registerPortalEl\n }, children);\n};\n"],"names":["useProviderThemeClasses","PortalCompatProvider","CLASS_NAME_REGEX","RegExp","fluentProviderClassNames","root","themeClassName","useThemeClassName","cssVariablesClasses","React","useMemo","_themeClassName_match","match","process","env","NODE_ENV","useEffect","console","warn","props","children","registerPortalEl","useCallback","element","disposeFocusVisiblePolyfill","undefined","classList","add","ownerDocument","defaultView","applyFocusVisiblePolyfill","remove","createElement","PortalCompatContextProvider","value"],"mappings":";;;;;;;;;;;IAKgBA,uBAAuB;eAAvBA;;IA2BHC,oBAAoB;eAApBA;;;;iEAhCU;iCACqC;0CAChB;8BACF;AAC1C,MAAMC,mBAAmB,IAAIC,OAAO,CAAC,QAAQ,EAAEC,yCAAwB,CAACC,IAAI,CAAC,KAAK,CAAC,EAAE;AAC9E,SAASL;IACZ,MAAMM,iBAAiBC,IAAAA,kCAAiB;IACxC,MAAMC,sBAAsBC,OAAMC,OAAO,CACzC,8GAA8G;IAC9G;QACI,IAAIC;QACJ,OAAO,AAACA,CAAAA,wBAAwBL,eAAeM,KAAK,CAACV,iBAAgB,MAAO,QAAQS,0BAA0B,KAAK,IAAIA,wBAAwB,EAAE;IACrJ,GAAG;QACCL;KACH;IACD,IAAIO,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACvC,+GAA+G;QAC/G,sDAAsD;QACtDN,OAAMO,SAAS,CAAC;YACZ,IAAIV,mBAAmB,IAAI;gBACvB,sCAAsC;gBACtCW,QAAQC,IAAI,CAAC,CAAC;;;;MAIxB,CAAC;YACK;QACJ,uDAAuD;QACvD,GAAG,EAAE;IACT;IACA,OAAOV;AACX;AACO,MAAMP,uBAAuB,CAACkB;IACjC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;IACrB,MAAMX,sBAAsBR;IAC5B,MAAMqB,mBAAmBZ,OAAMa,WAAW,CAAC,CAACC;QACxC,IAAIC,8BAA8B,IAAIC;QACtCF,QAAQG,SAAS,CAACC,GAAG,IAAInB;QACzB,IAAIe,QAAQK,aAAa,CAACC,WAAW,EAAE;YACnCL,8BAA8BM,IAAAA,uCAAyB,EAACP,SAASA,QAAQK,aAAa,CAACC,WAAW;QACtG;QACA,OAAO;YACHN,QAAQG,SAAS,CAACK,MAAM,IAAIvB;YAC5BgB;QACJ;IACJ,GAAG;QACChB;KACH;IACD,OAAO,WAAW,GAAGC,OAAMuB,aAAa,CAACC,qDAA2B,EAAE;QAClEC,OAAOb;IACX,GAAGD;AACP"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-portal-compat",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.95",
|
|
4
4
|
"description": "A package that contains compatibility layer for React Portals",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@fluentui/react-portal-compat-context": "^9.0.9",
|
|
38
|
-
"@fluentui/react-tabster": "^9.13.
|
|
38
|
+
"@fluentui/react-tabster": "^9.13.2",
|
|
39
39
|
"@swc/helpers": "^0.5.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@fluentui/react-components": "^9.
|
|
42
|
+
"@fluentui/react-components": "^9.33.0",
|
|
43
43
|
"@types/react": ">=16.14.0 <19.0.0",
|
|
44
44
|
"react": ">=16.14.0 <19.0.0"
|
|
45
45
|
},
|