@fluentui/react-utilities 0.0.0-nightly-20230124-0417.1 → 0.0.0-nightly-20230125-0418.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 +5 -5
- package/CHANGELOG.md +5 -5
- package/lib/hooks/useId.js +9 -0
- package/lib/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +9 -0
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-utilities_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Wed, 25 Jan 2023 04:25:47 GMT",
|
6
|
+
"tag": "@fluentui/react-utilities_v0.0.0-nightly-20230125-0418.1",
|
7
|
+
"version": "0.0.0-nightly-20230125-0418.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,8 +16,8 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-utilities",
|
19
|
-
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230125-0418.1",
|
20
|
+
"commit": "9ae3c86be8e1491c190d1b0c746d9ff238c36f75"
|
21
21
|
}
|
22
22
|
]
|
23
23
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Wed, 25 Jan 2023 04:25:47 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230125-0418.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly-20230125-0418.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.4.0..@fluentui/react-utilities_v0.0.0-nightly-
|
9
|
+
Wed, 25 Jan 2023 04:25:47 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.4.0..@fluentui/react-utilities_v0.0.0-nightly-20230125-0418.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230125-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/9ae3c86be8e1491c190d1b0c746d9ff238c36f75) by beachball)
|
16
16
|
|
17
17
|
## [9.4.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.4.0)
|
18
18
|
|
package/lib/hooks/useId.js
CHANGED
@@ -16,6 +16,15 @@ export function resetIdsForTests() {
|
|
16
16
|
*/
|
17
17
|
export function useId(prefix = 'fui-', providedId) {
|
18
18
|
const contextValue = useSSRContext();
|
19
|
+
// Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to
|
20
|
+
// prevent bundlers from complaining with older versions of React.
|
21
|
+
const _useId = React['use' + 'Id'];
|
22
|
+
if (_useId) {
|
23
|
+
return providedId || `${prefix}${_useId()}`;
|
24
|
+
}
|
25
|
+
// Hooks appear to be running conditionally, but they will always run in the same order since it's based on
|
26
|
+
// the version of React being used. This is safe to ignore.
|
27
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
19
28
|
return React.useMemo(() => {
|
20
29
|
if (providedId) {
|
21
30
|
return providedId;
|
package/lib/hooks/useId.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,sBAAsB,EAAEC,aAAa,QAAQ,cAAc;AAEpE;;;AAGA,OAAM,SAAUC,gBAAgB;EAC9BF,sBAAsB,CAACG,OAAO,GAAG,CAAC;AACpC;AAEA;;;;;;;;AAQA,OAAM,SAAUC,KAAK,CAACC,SAAiB,MAAM,EAAEC,UAAmB;EAChE,MAAMC,YAAY,GAAGN,aAAa,EAAE;EAEpC,OAAOF,KAAK,
|
1
|
+
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,sBAAsB,EAAEC,aAAa,QAAQ,cAAc;AAEpE;;;AAGA,OAAM,SAAUC,gBAAgB;EAC9BF,sBAAsB,CAACG,OAAO,GAAG,CAAC;AACpC;AAEA;;;;;;;;AAQA,OAAM,SAAUC,KAAK,CAACC,SAAiB,MAAM,EAAEC,UAAmB;EAChE,MAAMC,YAAY,GAAGN,aAAa,EAAE;EAEpC;EACA;EACA,MAAMO,MAAM,GAA8BT,KAAe,CAAC,KAAK,GAAG,IAAI,CAAC;EAEvE,IAAIS,MAAM,EAAE;IACV,OAAOF,UAAU,IAAI,GAAGD,MAAM,GAAGG,MAAM,EAAE,EAAE;;EAG7C;EACA;EACA;EACA,OAAOT,KAAK,CAACU,OAAO,CAAC,MAAK;IACxB,IAAIH,UAAU,EAAE;MACd,OAAOA,UAAU;;IAGnB,OAAO,GAAGD,MAAM,GAAG,EAAEE,YAAY,CAACJ,OAAO,EAAE;EAC7C,CAAC,EAAE,CAACE,MAAM,EAAEC,UAAU,EAAEC,YAAY,CAAC,CAAC;AACxC","names":["React","defaultSSRContextValue","useSSRContext","resetIdsForTests","current","useId","prefix","providedId","contextValue","_useId","useMemo"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useId.ts"],"sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\n\n/**\n * Resets generated IDs, should be used only in tests.\n */\nexport function resetIdsForTests(): void {\n defaultSSRContextValue.current = 0;\n}\n\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix: string = 'fui-', providedId?: string): string {\n const contextValue = useSSRContext();\n\n // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to\n // prevent bundlers from complaining with older versions of React.\n const _useId: () => string | undefined = (React as never)['use' + 'Id'];\n\n if (_useId) {\n return providedId || `${prefix}${_useId()}`;\n }\n\n // Hooks appear to be running conditionally, but they will always run in the same order since it's based on\n // the version of React being used. This is safe to ignore.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return React.useMemo(() => {\n if (providedId) {\n return providedId;\n }\n\n return `${prefix}${++contextValue.current}`;\n }, [prefix, providedId, contextValue]);\n}\n"]}
|
@@ -23,6 +23,15 @@ exports.resetIdsForTests = resetIdsForTests;
|
|
23
23
|
*/
|
24
24
|
function useId(prefix = 'fui-', providedId) {
|
25
25
|
const contextValue = index_1.useSSRContext();
|
26
|
+
// Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to
|
27
|
+
// prevent bundlers from complaining with older versions of React.
|
28
|
+
const _useId = React['use' + 'Id'];
|
29
|
+
if (_useId) {
|
30
|
+
return providedId || `${prefix}${_useId()}`;
|
31
|
+
}
|
32
|
+
// Hooks appear to be running conditionally, but they will always run in the same order since it's based on
|
33
|
+
// the version of React being used. This is safe to ignore.
|
34
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
26
35
|
return React.useMemo(() => {
|
27
36
|
if (providedId) {
|
28
37
|
return providedId;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AACA;AAEA;;;AAGA,SAAgBA,gBAAgB;EAC9BC,8BAAsB,CAACC,OAAO,GAAG,CAAC;AACpC;AAFAC;AAIA;;;;;;;;AAQA,SAAgBC,KAAK,CAACC,SAAiB,MAAM,EAAEC,UAAmB;EAChE,MAAMC,YAAY,GAAGN,qBAAa,EAAE;EAEpC,
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AAEA;;;AAGA,SAAgBA,gBAAgB;EAC9BC,8BAAsB,CAACC,OAAO,GAAG,CAAC;AACpC;AAFAC;AAIA;;;;;;;;AAQA,SAAgBC,KAAK,CAACC,SAAiB,MAAM,EAAEC,UAAmB;EAChE,MAAMC,YAAY,GAAGN,qBAAa,EAAE;EAEpC;EACA;EACA,MAAMO,MAAM,GAA8BC,KAAe,CAAC,KAAK,GAAG,IAAI,CAAC;EAEvE,IAAID,MAAM,EAAE;IACV,OAAOF,UAAU,IAAI,GAAGD,MAAM,GAAGG,MAAM,EAAE,EAAE;;EAG7C;EACA;EACA;EACA,OAAOC,KAAK,CAACC,OAAO,CAAC,MAAK;IACxB,IAAIJ,UAAU,EAAE;MACd,OAAOA,UAAU;;IAGnB,OAAO,GAAGD,MAAM,GAAG,EAAEE,YAAY,CAACL,OAAO,EAAE;EAC7C,CAAC,EAAE,CAACG,MAAM,EAAEC,UAAU,EAAEC,YAAY,CAAC,CAAC;AACxC;AArBAJ","names":["resetIdsForTests","index_1","current","exports","useId","prefix","providedId","contextValue","_useId","React","useMemo"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useId.ts"],"sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\n\n/**\n * Resets generated IDs, should be used only in tests.\n */\nexport function resetIdsForTests(): void {\n defaultSSRContextValue.current = 0;\n}\n\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix: string = 'fui-', providedId?: string): string {\n const contextValue = useSSRContext();\n\n // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to\n // prevent bundlers from complaining with older versions of React.\n const _useId: () => string | undefined = (React as never)['use' + 'Id'];\n\n if (_useId) {\n return providedId || `${prefix}${_useId()}`;\n }\n\n // Hooks appear to be running conditionally, but they will always run in the same order since it's based on\n // the version of React being used. This is safe to ignore.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return React.useMemo(() => {\n if (providedId) {\n return providedId;\n }\n\n return `${prefix}${++contextValue.current}`;\n }, [prefix, providedId, contextValue]);\n}\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230125-0418.1",
|
4
4
|
"description": "A set of general React-specific utilities.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"@fluentui/scripts-tasks": "*"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@fluentui/keyboard-keys": "0.0.0-nightly-
|
31
|
+
"@fluentui/keyboard-keys": "0.0.0-nightly-20230125-0418.1",
|
32
32
|
"tslib": "^2.1.0"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|