@fluentui/react-portal-compat-context 0.0.0-nightly-20220503-0421.1
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 +26 -0
- package/CHANGELOG.md +14 -0
- package/LICENSE +15 -0
- package/README.md +48 -0
- package/Spec.md +63 -0
- package/dist/index.d.ts +9 -0
- package/lib/PortalCompatContext.d.ts +4 -0
- package/lib/PortalCompatContext.js +10 -0
- package/lib/PortalCompatContext.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/types.d.ts +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib-commonjs/PortalCompatContext.d.ts +4 -0
- package/lib-commonjs/PortalCompatContext.js +21 -0
- package/lib-commonjs/PortalCompatContext.js.map +1 -0
- package/lib-commonjs/index.d.ts +2 -0
- package/lib-commonjs/index.js +22 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/types.d.ts +1 -0
- package/lib-commonjs/types.js +6 -0
- package/lib-commonjs/types.js.map +1 -0
- package/package.json +45 -0
package/CHANGELOG.json
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"name": "@fluentui/react-portal-compat-context",
|
3
|
+
"entries": [
|
4
|
+
{
|
5
|
+
"date": "Tue, 03 May 2022 04:34:44 GMT",
|
6
|
+
"tag": "@fluentui/react-portal-compat-context_v0.0.0-nightly-20220503-0421.1",
|
7
|
+
"version": "0.0.0-nightly-20220503-0421.1",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "email not defined",
|
12
|
+
"package": "@fluentui/react-portal-compat-context",
|
13
|
+
"commit": "not available",
|
14
|
+
"comment": "Release nightly v9"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "olfedias@microsoft.com",
|
18
|
+
"package": "@fluentui/react-portal-compat-context",
|
19
|
+
"commit": "280cf2336d814d7380d5cbf4999ce56da763919c",
|
20
|
+
"comment": "initial release"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
package/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Change Log - @fluentui/react-portal-compat-context
|
2
|
+
|
3
|
+
This log was last generated on Tue, 03 May 2022 04:34:44 GMT and should not be manually modified.
|
4
|
+
|
5
|
+
<!-- Start content -->
|
6
|
+
|
7
|
+
## [0.0.0-nightly-20220503-0421.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-portal-compat-context_v0.0.0-nightly-20220503-0421.1)
|
8
|
+
|
9
|
+
Tue, 03 May 2022 04:34:44 GMT
|
10
|
+
|
11
|
+
### Changes
|
12
|
+
|
13
|
+
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by email not defined)
|
14
|
+
- initial release ([PR #22510](https://github.com/microsoft/fluentui/pull/22510) by olfedias@microsoft.com)
|
package/LICENSE
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
@fluentui/react-portal-compat-context
|
2
|
+
|
3
|
+
Copyright (c) Microsoft Corporation
|
4
|
+
|
5
|
+
All rights reserved.
|
6
|
+
|
7
|
+
MIT License
|
8
|
+
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
|
+
|
15
|
+
Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
|
package/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# @fluentui/react-portal-compat-context
|
2
|
+
|
3
|
+
This package contains the React Context for compat layer in `@fluentui/react-portal-compat`.
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
|
7
|
+
```sh
|
8
|
+
yarn add @fluentui/react-portal-compat-context
|
9
|
+
```
|
10
|
+
|
11
|
+
### Usage
|
12
|
+
|
13
|
+
> **Note:** These APIs are intended to be used by library developers, please use `@fluentui/react-portal-compat` if you need Portal compatibility.
|
14
|
+
>
|
15
|
+
> `PortalCompatContextProvider` and `usePortalCompat()` are exported APIs for implementing compat layer.
|
16
|
+
|
17
|
+
```tsx
|
18
|
+
import { PortalCompatContextProvider, usePortalCompat } from '@fluentui/react-portal-compat-context';
|
19
|
+
|
20
|
+
function Consumer() {
|
21
|
+
const registerEl = usePortalCompat();
|
22
|
+
|
23
|
+
React.useEffect(() => {
|
24
|
+
const portalEl = document.createElement('div');
|
25
|
+
|
26
|
+
return registerEl(portalEl);
|
27
|
+
}, [registerEl]);
|
28
|
+
|
29
|
+
return null;
|
30
|
+
}
|
31
|
+
|
32
|
+
function App() {
|
33
|
+
const registerEl = React.useCallback((portalEl: HTMLElement) => {
|
34
|
+
// do something...
|
35
|
+
console.log(portalEl);
|
36
|
+
|
37
|
+
return () => {
|
38
|
+
// do something for cleanups...
|
39
|
+
};
|
40
|
+
}, []);
|
41
|
+
|
42
|
+
return (
|
43
|
+
<PortalCompatContextProvider value={registerEl}>
|
44
|
+
<Consumer />
|
45
|
+
</PortalCompatContextProvider>
|
46
|
+
);
|
47
|
+
}
|
48
|
+
```
|
package/Spec.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# @fluentui/react-portal-compat-context Spec
|
2
|
+
|
3
|
+
## Background
|
4
|
+
|
5
|
+
_Description and use cases of this component_
|
6
|
+
|
7
|
+
## Prior Art
|
8
|
+
|
9
|
+
_Include background research done for this component_
|
10
|
+
|
11
|
+
- _Link to Open UI research_
|
12
|
+
- _Link to comparison of v7 and v0_
|
13
|
+
- _Link to GitHub epic issue for the converged component_
|
14
|
+
|
15
|
+
## Sample Code
|
16
|
+
|
17
|
+
_Provide some representative example code that uses the proposed API for the component_
|
18
|
+
|
19
|
+
## Variants
|
20
|
+
|
21
|
+
_Describe visual or functional variants of this control, if applicable. For example, a slider could have a 2D variant._
|
22
|
+
|
23
|
+
## API
|
24
|
+
|
25
|
+
_List the **Props** and **Slots** proposed for the component. Ideally this would just be a link to the component's `.types.ts` file_
|
26
|
+
|
27
|
+
## Structure
|
28
|
+
|
29
|
+
- _**Public**_
|
30
|
+
- _**Internal**_
|
31
|
+
- _**DOM** - how the component will be rendered as HTML elements_
|
32
|
+
|
33
|
+
## Migration
|
34
|
+
|
35
|
+
_Describe what will need to be done to upgrade from the existing implementations:_
|
36
|
+
|
37
|
+
- _Migration from v8_
|
38
|
+
- _Migration from v0_
|
39
|
+
|
40
|
+
## Behaviors
|
41
|
+
|
42
|
+
_Explain how the component will behave in use, including:_
|
43
|
+
|
44
|
+
- _Component States_
|
45
|
+
- _Interaction_
|
46
|
+
- _Keyboard_
|
47
|
+
- _Cursor_
|
48
|
+
- _Touch_
|
49
|
+
- _Screen readers_
|
50
|
+
|
51
|
+
## Accessibility
|
52
|
+
|
53
|
+
Base accessibility information is included in the design document. After the spec is filled and review, outcomes from it need to be communicated to design and incorporated in the design document.
|
54
|
+
|
55
|
+
- Decide whether to use **native element** or folow **ARIA** and provide reasons
|
56
|
+
- Identify the **[ARIA](https://www.w3.org/TR/wai-aria-practices-1.2/) pattern** and, if the component is listed there, follow its specification as possible.
|
57
|
+
- Identify accessibility **variants**, the `role` ([ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#role_definitions)) of the component, its `slots` and `aria-*` props.
|
58
|
+
- Describe the **keyboard navigation**: Tab Oder and Arrow Key Navigation. Describe any other keyboard **shortcuts** used
|
59
|
+
- Specify texts for **state change announcements** - [ARIA live regions
|
60
|
+
](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) (number of available items in dropdown, error messages, confirmations, ...)
|
61
|
+
- Identify UI parts that appear on **hover or focus** and specify keyboard and screen reader interaction with them
|
62
|
+
- List cases when **focus** needs to be **trapped** in sections of the UI (for dialogs and popups or for hierarchical navigation)
|
63
|
+
- List cases when **focus** needs to be **moved programatically** (if parts of the UI are appearing/disappearing or other cases)
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
import * as React_2 from 'react';
|
2
|
+
|
3
|
+
export declare const PortalCompatContextProvider: React_2.Provider<RegisterPortalFn>;
|
4
|
+
|
5
|
+
export declare type RegisterPortalFn = (el: HTMLElement) => () => void;
|
6
|
+
|
7
|
+
export declare function usePortalCompat(): RegisterPortalFn;
|
8
|
+
|
9
|
+
export { }
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
var PortalCompatContext = /*#__PURE__*/React.createContext( // eslint-disable-next-line @typescript-eslint/no-empty-function
|
3
|
+
function () {
|
4
|
+
return function () {};
|
5
|
+
});
|
6
|
+
export var PortalCompatContextProvider = PortalCompatContext.Provider;
|
7
|
+
export function usePortalCompat() {
|
8
|
+
return React.useContext(PortalCompatContext);
|
9
|
+
}
|
10
|
+
//# sourceMappingURL=PortalCompatContext.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["PortalCompatContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,IAAM,mBAAmB,gBAAG,KAAK,CAAC,aAAN,EAC1B;AACA,YAAA;AAAM,SAAA,YAAA,CAAA,CAAA;AAAQ,CAFY,CAA5B;AAKA,OAAO,IAAM,2BAA2B,GAAG,mBAAmB,CAAC,QAAxD;AAEP,OAAM,SAAU,eAAV,GAAyB;AAC7B,SAAO,KAAK,CAAC,UAAN,CAAiB,mBAAjB,CAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { RegisterPortalFn } from './types';\n\nconst PortalCompatContext = React.createContext<RegisterPortalFn>(\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n () => () => {},\n);\n\nexport const PortalCompatContextProvider = PortalCompatContext.Provider;\n\nexport function usePortalCompat() {\n return React.useContext(PortalCompatContext);\n}\n"],"sourceRoot":"../src/"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { PortalCompatContextProvider, usePortalCompat } from './PortalCompatContext';\nexport type { RegisterPortalFn } from './types';\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
3
|
+
{
|
4
|
+
"tsdocVersion": "0.12",
|
5
|
+
"toolPackages": [
|
6
|
+
{
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
8
|
+
"packageVersion": "7.18.1"
|
9
|
+
}
|
10
|
+
]
|
11
|
+
}
|
package/lib/types.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export declare type RegisterPortalFn = (el: HTMLElement) => () => void;
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"../src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["export type RegisterPortalFn = (el: HTMLElement) => () => void;\n"]}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.usePortalCompat = exports.PortalCompatContextProvider = void 0;
|
7
|
+
|
8
|
+
var React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
var PortalCompatContext = /*#__PURE__*/React.createContext( // eslint-disable-next-line @typescript-eslint/no-empty-function
|
11
|
+
function () {
|
12
|
+
return function () {};
|
13
|
+
});
|
14
|
+
exports.PortalCompatContextProvider = PortalCompatContext.Provider;
|
15
|
+
|
16
|
+
function usePortalCompat() {
|
17
|
+
return React.useContext(PortalCompatContext);
|
18
|
+
}
|
19
|
+
|
20
|
+
exports.usePortalCompat = usePortalCompat;
|
21
|
+
//# sourceMappingURL=PortalCompatContext.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["PortalCompatContext.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAGA,IAAM,mBAAmB,gBAAG,KAAK,CAAC,aAAN,EAC1B;AACA,YAAA;AAAM,SAAA,YAAA,CAAA,CAAA;AAAQ,CAFY,CAA5B;AAKa,OAAA,CAAA,2BAAA,GAA8B,mBAAmB,CAAC,QAAlD;;AAEb,SAAgB,eAAhB,GAA+B;AAC7B,SAAO,KAAK,CAAC,UAAN,CAAiB,mBAAjB,CAAP;AACD;;AAFD,OAAA,CAAA,eAAA,GAAA,eAAA","sourcesContent":["import * as React from 'react';\nimport type { RegisterPortalFn } from './types';\n\nconst PortalCompatContext = React.createContext<RegisterPortalFn>(\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n () => () => {},\n);\n\nexport const PortalCompatContextProvider = PortalCompatContext.Provider;\n\nexport function usePortalCompat() {\n return React.useContext(PortalCompatContext);\n}\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.usePortalCompat = exports.PortalCompatContextProvider = void 0;
|
7
|
+
|
8
|
+
var PortalCompatContext_1 = /*#__PURE__*/require("./PortalCompatContext");
|
9
|
+
|
10
|
+
Object.defineProperty(exports, "PortalCompatContextProvider", {
|
11
|
+
enumerable: true,
|
12
|
+
get: function () {
|
13
|
+
return PortalCompatContext_1.PortalCompatContextProvider;
|
14
|
+
}
|
15
|
+
});
|
16
|
+
Object.defineProperty(exports, "usePortalCompat", {
|
17
|
+
enumerable: true,
|
18
|
+
get: function () {
|
19
|
+
return PortalCompatContext_1.usePortalCompat;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,qBAAA,CAAA,2BAAA;AAA2B;AAA3B,CAAA;AAA6B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,qBAAA,CAAA,eAAA;AAAe;AAAf,CAAA","sourcesContent":["export { PortalCompatContextProvider, usePortalCompat } from './PortalCompatContext';\nexport type { RegisterPortalFn } from './types';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare type RegisterPortalFn = (el: HTMLElement) => () => void;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
|
package/package.json
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"name": "@fluentui/react-portal-compat-context",
|
3
|
+
"version": "0.0.0-nightly-20220503-0421.1",
|
4
|
+
"description": "A package that holds React context for compatibility of React Contexts",
|
5
|
+
"main": "lib-commonjs/index.js",
|
6
|
+
"module": "lib/index.js",
|
7
|
+
"typings": "lib/index.d.ts",
|
8
|
+
"sideEffects": false,
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "https://github.com/microsoft/fluentui"
|
12
|
+
},
|
13
|
+
"license": "MIT",
|
14
|
+
"scripts": {
|
15
|
+
"build": "just-scripts build",
|
16
|
+
"clean": "just-scripts clean",
|
17
|
+
"code-style": "just-scripts code-style",
|
18
|
+
"just": "just-scripts",
|
19
|
+
"lint": "just-scripts lint",
|
20
|
+
"start": "yarn storybook",
|
21
|
+
"test": "jest --passWithNoTests",
|
22
|
+
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
23
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-portal-compat-context/src && yarn docs",
|
24
|
+
"storybook": "node ../../scripts/storybook/runner",
|
25
|
+
"type-check": "tsc -b tsconfig.json"
|
26
|
+
},
|
27
|
+
"devDependencies": {
|
28
|
+
"@fluentui/eslint-plugin": "*",
|
29
|
+
"@fluentui/scripts": "^1.0.0"
|
30
|
+
},
|
31
|
+
"dependencies": {
|
32
|
+
"tslib": "^2.1.0"
|
33
|
+
},
|
34
|
+
"peerDependencies": {
|
35
|
+
"@types/react": ">=16.8.0 <18.0.0",
|
36
|
+
"react": ">=16.8.0 <18.0.0"
|
37
|
+
},
|
38
|
+
"beachball": {
|
39
|
+
"disallowedChangeTypes": [
|
40
|
+
"major",
|
41
|
+
"minor",
|
42
|
+
"patch"
|
43
|
+
]
|
44
|
+
}
|
45
|
+
}
|