@fluentui/react-tabster 9.26.14 → 9.26.15
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.md +13 -3
- package/lib/hooks/useFocusObserved.js +2 -1
- package/lib/hooks/useFocusObserved.js.map +1 -1
- package/lib/hooks/useMergeTabsterAttributes.js +4 -1
- package/lib/hooks/useMergeTabsterAttributes.js.map +1 -1
- package/lib-commonjs/hooks/useFocusObserved.js +2 -1
- package/lib-commonjs/hooks/useFocusObserved.js.map +1 -1
- package/lib-commonjs/hooks/useMergeTabsterAttributes.js +4 -1
- package/lib-commonjs/hooks/useMergeTabsterAttributes.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tabster
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 26 May 2026 09:33:29 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.26.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.26.15)
|
|
8
|
+
|
|
9
|
+
Tue, 26 May 2026 09:33:29 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.26.14..@fluentui/react-tabster_v9.26.15)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore: bump tabster to ^8.8.0 and keyborg to ^2.14.1 ([PR #36082](https://github.com/microsoft/fluentui/pull/36082) by 198982749+Copilot@users.noreply.github.com)
|
|
15
|
+
- Bump @fluentui/react-utilities to v9.26.4 ([PR #36246](https://github.com/microsoft/fluentui/pull/36246) by beachball)
|
|
16
|
+
|
|
7
17
|
## [9.26.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.26.14)
|
|
8
18
|
|
|
9
|
-
Thu, 23 Apr 2026
|
|
19
|
+
Thu, 23 Apr 2026 14:21:07 GMT
|
|
10
20
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.26.13..@fluentui/react-tabster_v9.26.14)
|
|
11
21
|
|
|
12
22
|
### Patches
|
|
13
23
|
|
|
14
24
|
- fix: mitigate hidden sideEffects by explicitly using type imports and decoupling useDangerousNeverHidden from tabster import path ([PR #35933](https://github.com/microsoft/fluentui/pull/35933) by martinhochel@microsoft.com)
|
|
15
|
-
- Bump @fluentui/react-utilities to v9.26.3 ([PR #
|
|
25
|
+
- Bump @fluentui/react-utilities to v9.26.3 ([PR #36035](https://github.com/microsoft/fluentui/pull/36035) by beachball)
|
|
16
26
|
|
|
17
27
|
## [9.26.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.26.13)
|
|
18
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useFocusObserved.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Types as TabsterTypes } from 'tabster';\nimport { getObservedElement } from 'tabster';\nimport { useTabster } from './useTabster';\n\ninterface UseFocusObservedOptions {\n /**\n * After timeout the focus attempt fails\n */\n timeout?: number;\n}\n\n/**\n * @param name - The observed element to focus\n * @param options - Options for the focus observed\n *\n * @returns Function that will focus an element\n */\nexport function useFocusObserved(\n name: string,\n options: UseFocusObservedOptions = {},\n): () => TabsterTypes.ObservedElementAsyncRequest<boolean> {\n const { timeout = 1000 } = options;\n const observedAPIRef = useTabster(getObservedElement);\n\n return React.useCallback(() => {\n const observerAPI = observedAPIRef.current;\n\n if (observerAPI) {\n return observerAPI.requestFocus(name, timeout);\n }\n\n return {\n result: Promise.resolve(false),\n cancel: () => null,\n };\n }, [observedAPIRef, name, timeout]);\n}\n"],"names":["React","getObservedElement","useTabster","useFocusObserved","name","options","timeout","observedAPIRef","useCallback","observerAPI","current","requestFocus","result","Promise","resolve","cancel"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,SAASC,UAAU,QAAQ,eAAe;AAS1C;;;;;CAKC,GACD,OAAO,SAASC,iBACdC,IAAY,EACZC,UAAmC,CAAC,CAAC;IAErC,MAAM,EAAEC,UAAU,IAAI,EAAE,GAAGD;IAC3B,MAAME,iBAAiBL,WAAWD;IAElC,OAAOD,MAAMQ,WAAW,CAAC;QACvB,MAAMC,cAAcF,eAAeG,OAAO;QAE1C,IAAID,aAAa;YACf,OAAOA,YAAYE,YAAY,CAACP,MAAME;QACxC;QAEA,OAAO;YACLM,QAAQC,QAAQC,OAAO,CAAC;YACxBC,QAAQ,IAAM;QAChB;IACF,GAAG;
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useFocusObserved.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Types as TabsterTypes } from 'tabster';\nimport { getObservedElement } from 'tabster';\nimport { useTabster } from './useTabster';\n\ninterface UseFocusObservedOptions {\n /**\n * After timeout the focus attempt fails\n */\n timeout?: number;\n}\n\n/**\n * @param name - The observed element to focus\n * @param options - Options for the focus observed\n *\n * @returns Function that will focus an element\n */\nexport function useFocusObserved(\n name: string,\n options: UseFocusObservedOptions = {},\n): () => TabsterTypes.ObservedElementAsyncRequest<boolean> {\n const { timeout = 1000 } = options;\n const observedAPIRef = useTabster(getObservedElement);\n\n return React.useCallback(() => {\n const observerAPI = observedAPIRef.current;\n\n if (observerAPI) {\n return observerAPI.requestFocus(name, timeout);\n }\n\n return {\n result: Promise.resolve(false),\n cancel: () => null,\n diagnostics: {},\n };\n }, [observedAPIRef, name, timeout]);\n}\n"],"names":["React","getObservedElement","useTabster","useFocusObserved","name","options","timeout","observedAPIRef","useCallback","observerAPI","current","requestFocus","result","Promise","resolve","cancel","diagnostics"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,SAASC,UAAU,QAAQ,eAAe;AAS1C;;;;;CAKC,GACD,OAAO,SAASC,iBACdC,IAAY,EACZC,UAAmC,CAAC,CAAC;IAErC,MAAM,EAAEC,UAAU,IAAI,EAAE,GAAGD;IAC3B,MAAME,iBAAiBL,WAAWD;IAElC,OAAOD,MAAMQ,WAAW,CAAC;QACvB,MAAMC,cAAcF,eAAeG,OAAO;QAE1C,IAAID,aAAa;YACf,OAAOA,YAAYE,YAAY,CAACP,MAAME;QACxC;QAEA,OAAO;YACLM,QAAQC,QAAQC,OAAO,CAAC;YACxBC,QAAQ,IAAM;YACdC,aAAa,CAAC;QAChB;IACF,GAAG;QAACT;QAAgBH;QAAME;KAAQ;AACpC"}
|
|
@@ -26,7 +26,7 @@ import { TABSTER_ATTRIBUTE_NAME } from 'tabster';
|
|
|
26
26
|
[TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined
|
|
27
27
|
}), // disable exhaustive-deps because we want to memoize the result of the reduction
|
|
28
28
|
// this is safe because the collection of attributes is not expected to change at runtime
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps, react-hooks/use-memo
|
|
30
30
|
stringAttributes);
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
@@ -50,9 +50,12 @@ import { TABSTER_ATTRIBUTE_NAME } from 'tabster';
|
|
|
50
50
|
*/ const useWarnIfUnstableAttributes = (attributes)=>{
|
|
51
51
|
'use no memo';
|
|
52
52
|
const initialAttributesRef = React.useRef(attributes);
|
|
53
|
+
// eslint-disable-next-line react-hooks/refs
|
|
53
54
|
let isStable = initialAttributesRef.current.length === attributes.length;
|
|
55
|
+
// eslint-disable-next-line react-hooks/refs
|
|
54
56
|
if (initialAttributesRef.current !== attributes && isStable) {
|
|
55
57
|
for(let i = 0; i < attributes.length; i++){
|
|
58
|
+
// eslint-disable-next-line react-hooks/refs
|
|
56
59
|
if (initialAttributesRef.current[i] !== attributes[i]) {
|
|
57
60
|
isStable = false;
|
|
58
61
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useMergeTabsterAttributes.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Types } from 'tabster';\nimport { TABSTER_ATTRIBUTE_NAME } from 'tabster';\n\n/**\n * Merges a collection of tabster attributes.\n *\n * ⚠️The attributes passed as arguments to this hook cannot change at runtime.\n * @internal\n * @param attributes - collection of tabster attributes from other react-tabster hooks\n * @returns single merged tabster attribute\n */\nexport const useMergedTabsterAttributes_unstable = (\n ...attributes: (Partial<Types.TabsterDOMAttribute> | null | undefined)[]\n): Types.TabsterDOMAttribute => {\n 'use no memo';\n\n const stringAttributes = attributes.reduce<string[]>((acc, curr) => {\n if (curr?.[TABSTER_ATTRIBUTE_NAME]) {\n acc.push(curr[TABSTER_ATTRIBUTE_NAME]);\n }\n return acc;\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n // ignoring rules of hooks because this is a condition based on the environment\n // it's safe to ignore the rule\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useWarnIfUnstableAttributes(stringAttributes);\n }\n\n return React.useMemo(\n () => ({\n [TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined,\n }),\n // disable exhaustive-deps because we want to memoize the result of the reduction\n // this is safe because the collection of attributes is not expected to change at runtime\n // eslint-disable-next-line react-hooks/exhaustive-deps\n stringAttributes,\n );\n};\n\n/**\n * Merges two JSON strings into one.\n */\nconst mergeJSONStrings = (a: string, b: string): string =>\n JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));\n\n/**\n * Tries to parse a JSON string and returns an object.\n * If the JSON string is invalid, an empty object is returned.\n */\nconst safelyParseJSON = (json: string): object => {\n try {\n return JSON.parse(json);\n } catch {\n return {};\n }\n};\n\n/**\n * Helper hook that ensures that the attributes passed to the hook are stable.\n * This is necessary because the attributes are expected to not change at runtime.\n *\n * This hook will console.warn if the attributes change at runtime.\n */\nconst useWarnIfUnstableAttributes = (attributes: string[]) => {\n 'use no memo';\n\n const initialAttributesRef = React.useRef(attributes);\n\n let isStable = initialAttributesRef.current.length === attributes.length;\n if (initialAttributesRef.current !== attributes && isStable) {\n for (let i = 0; i < attributes.length; i++) {\n if (initialAttributesRef.current[i] !== attributes[i]) {\n isStable = false;\n break;\n }\n }\n }\n React.useEffect(() => {\n if (!isStable) {\n const error = new Error();\n // eslint-disable-next-line no-console\n console.warn(/** #__DE-INDENT__ */ `\n @fluentui/react-tabster [useMergedTabsterAttributes]:\n The attributes passed to the hook changed at runtime.\n This might lead to unexpected behavior, please ensure that the attributes are stable.\n ${error.stack}\n `);\n }\n }, [isStable]);\n};\n"],"names":["React","TABSTER_ATTRIBUTE_NAME","useMergedTabsterAttributes_unstable","attributes","stringAttributes","reduce","acc","curr","push","process","env","NODE_ENV","useWarnIfUnstableAttributes","useMemo","length","mergeJSONStrings","undefined","a","b","JSON","stringify","Object","assign","safelyParseJSON","json","parse","initialAttributesRef","useRef","isStable","current","i","useEffect","error","Error","console","warn","stack"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,sBAAsB,QAAQ,UAAU;AAEjD;;;;;;;CAOC,GACD,OAAO,MAAMC,sCAAsC,CACjD,GAAGC;IAEH;IAEA,MAAMC,mBAAmBD,WAAWE,MAAM,CAAW,CAACC,KAAKC;QACzD,IAAIA,iBAAAA,2BAAAA,IAAM,CAACN,uBAAuB,EAAE;YAClCK,IAAIE,IAAI,CAACD,IAAI,CAACN,uBAAuB;QACvC;QACA,OAAOK;IACT,GAAG,EAAE;IAEL,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,+EAA+E;QAC/E,+BAA+B;QAC/B,sDAAsD;QACtDC,4BAA4BR;IAC9B;IAEA,OAAOJ,MAAMa,OAAO,CAClB,IAAO,CAAA;YACL,CAACZ,uBAAuB,EAAEG,iBAAiBU,MAAM,GAAG,IAAIV,iBAAiBC,MAAM,CAACU,oBAAoBC;QACtG,CAAA,GACA,iFAAiF;IACjF,yFAAyF;IACzF,
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useMergeTabsterAttributes.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Types } from 'tabster';\nimport { TABSTER_ATTRIBUTE_NAME } from 'tabster';\n\n/**\n * Merges a collection of tabster attributes.\n *\n * ⚠️The attributes passed as arguments to this hook cannot change at runtime.\n * @internal\n * @param attributes - collection of tabster attributes from other react-tabster hooks\n * @returns single merged tabster attribute\n */\nexport const useMergedTabsterAttributes_unstable = (\n ...attributes: (Partial<Types.TabsterDOMAttribute> | null | undefined)[]\n): Types.TabsterDOMAttribute => {\n 'use no memo';\n\n const stringAttributes = attributes.reduce<string[]>((acc, curr) => {\n if (curr?.[TABSTER_ATTRIBUTE_NAME]) {\n acc.push(curr[TABSTER_ATTRIBUTE_NAME]);\n }\n return acc;\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n // ignoring rules of hooks because this is a condition based on the environment\n // it's safe to ignore the rule\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useWarnIfUnstableAttributes(stringAttributes);\n }\n\n return React.useMemo(\n () => ({\n [TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined,\n }),\n // disable exhaustive-deps because we want to memoize the result of the reduction\n // this is safe because the collection of attributes is not expected to change at runtime\n // eslint-disable-next-line react-hooks/exhaustive-deps, react-hooks/use-memo\n stringAttributes,\n );\n};\n\n/**\n * Merges two JSON strings into one.\n */\nconst mergeJSONStrings = (a: string, b: string): string =>\n JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));\n\n/**\n * Tries to parse a JSON string and returns an object.\n * If the JSON string is invalid, an empty object is returned.\n */\nconst safelyParseJSON = (json: string): object => {\n try {\n return JSON.parse(json);\n } catch {\n return {};\n }\n};\n\n/**\n * Helper hook that ensures that the attributes passed to the hook are stable.\n * This is necessary because the attributes are expected to not change at runtime.\n *\n * This hook will console.warn if the attributes change at runtime.\n */\nconst useWarnIfUnstableAttributes = (attributes: string[]) => {\n 'use no memo';\n\n const initialAttributesRef = React.useRef(attributes);\n\n // eslint-disable-next-line react-hooks/refs\n let isStable = initialAttributesRef.current.length === attributes.length;\n // eslint-disable-next-line react-hooks/refs\n if (initialAttributesRef.current !== attributes && isStable) {\n for (let i = 0; i < attributes.length; i++) {\n // eslint-disable-next-line react-hooks/refs\n if (initialAttributesRef.current[i] !== attributes[i]) {\n isStable = false;\n break;\n }\n }\n }\n React.useEffect(() => {\n if (!isStable) {\n const error = new Error();\n // eslint-disable-next-line no-console\n console.warn(/** #__DE-INDENT__ */ `\n @fluentui/react-tabster [useMergedTabsterAttributes]:\n The attributes passed to the hook changed at runtime.\n This might lead to unexpected behavior, please ensure that the attributes are stable.\n ${error.stack}\n `);\n }\n }, [isStable]);\n};\n"],"names":["React","TABSTER_ATTRIBUTE_NAME","useMergedTabsterAttributes_unstable","attributes","stringAttributes","reduce","acc","curr","push","process","env","NODE_ENV","useWarnIfUnstableAttributes","useMemo","length","mergeJSONStrings","undefined","a","b","JSON","stringify","Object","assign","safelyParseJSON","json","parse","initialAttributesRef","useRef","isStable","current","i","useEffect","error","Error","console","warn","stack"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,sBAAsB,QAAQ,UAAU;AAEjD;;;;;;;CAOC,GACD,OAAO,MAAMC,sCAAsC,CACjD,GAAGC;IAEH;IAEA,MAAMC,mBAAmBD,WAAWE,MAAM,CAAW,CAACC,KAAKC;QACzD,IAAIA,iBAAAA,2BAAAA,IAAM,CAACN,uBAAuB,EAAE;YAClCK,IAAIE,IAAI,CAACD,IAAI,CAACN,uBAAuB;QACvC;QACA,OAAOK;IACT,GAAG,EAAE;IAEL,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,+EAA+E;QAC/E,+BAA+B;QAC/B,sDAAsD;QACtDC,4BAA4BR;IAC9B;IAEA,OAAOJ,MAAMa,OAAO,CAClB,IAAO,CAAA;YACL,CAACZ,uBAAuB,EAAEG,iBAAiBU,MAAM,GAAG,IAAIV,iBAAiBC,MAAM,CAACU,oBAAoBC;QACtG,CAAA,GACA,iFAAiF;IACjF,yFAAyF;IACzF,6EAA6E;IAC7EZ;AAEJ,EAAE;AAEF;;CAEC,GACD,MAAMW,mBAAmB,CAACE,GAAWC,IACnCC,KAAKC,SAAS,CAACC,OAAOC,MAAM,CAACC,gBAAgBN,IAAIM,gBAAgBL;AAEnE;;;CAGC,GACD,MAAMK,kBAAkB,CAACC;IACvB,IAAI;QACF,OAAOL,KAAKM,KAAK,CAACD;IACpB,EAAE,OAAM;QACN,OAAO,CAAC;IACV;AACF;AAEA;;;;;CAKC,GACD,MAAMZ,8BAA8B,CAACT;IACnC;IAEA,MAAMuB,uBAAuB1B,MAAM2B,MAAM,CAACxB;IAE1C,4CAA4C;IAC5C,IAAIyB,WAAWF,qBAAqBG,OAAO,CAACf,MAAM,KAAKX,WAAWW,MAAM;IACxE,4CAA4C;IAC5C,IAAIY,qBAAqBG,OAAO,KAAK1B,cAAcyB,UAAU;QAC3D,IAAK,IAAIE,IAAI,GAAGA,IAAI3B,WAAWW,MAAM,EAAEgB,IAAK;YAC1C,4CAA4C;YAC5C,IAAIJ,qBAAqBG,OAAO,CAACC,EAAE,KAAK3B,UAAU,CAAC2B,EAAE,EAAE;gBACrDF,WAAW;gBACX;YACF;QACF;IACF;IACA5B,MAAM+B,SAAS,CAAC;QACd,IAAI,CAACH,UAAU;YACb,MAAMI,QAAQ,IAAIC;YAClB,sCAAsC;YACtCC,QAAQC,IAAI,CAAC,mBAAmB,GAAG,CAAC;;;;QAIlC,EAAEH,MAAMI,KAAK,CAAC;MAChB,CAAC;QACH;IACF,GAAG;QAACR;KAAS;AACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useFocusObserved.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Types as TabsterTypes } from 'tabster';\nimport { getObservedElement } from 'tabster';\nimport { useTabster } from './useTabster';\n\ninterface UseFocusObservedOptions {\n /**\n * After timeout the focus attempt fails\n */\n timeout?: number;\n}\n\n/**\n * @param name - The observed element to focus\n * @param options - Options for the focus observed\n *\n * @returns Function that will focus an element\n */\nexport function useFocusObserved(\n name: string,\n options: UseFocusObservedOptions = {},\n): () => TabsterTypes.ObservedElementAsyncRequest<boolean> {\n const { timeout = 1000 } = options;\n const observedAPIRef = useTabster(getObservedElement);\n\n return React.useCallback(() => {\n const observerAPI = observedAPIRef.current;\n\n if (observerAPI) {\n return observerAPI.requestFocus(name, timeout);\n }\n\n return {\n result: Promise.resolve(false),\n cancel: () => null,\n };\n }, [observedAPIRef, name, timeout]);\n}\n"],"names":["useFocusObserved","name","options","timeout","observedAPIRef","useTabster","getObservedElement","React","useCallback","observerAPI","current","requestFocus","result","Promise","resolve","cancel"],"mappings":"AAAA;;;;;+BAoBgBA;;;eAAAA;;;;iEAlBO;yBAEY;4BACR;AAepB,SAASA,iBACdC,IAAY,EACZC,UAAmC,CAAC,CAAC;IAErC,MAAM,EAAEC,UAAU,IAAI,EAAE,GAAGD;IAC3B,MAAME,iBAAiBC,IAAAA,sBAAU,EAACC,2BAAkB;IAEpD,OAAOC,OAAMC,WAAW,CAAC;QACvB,MAAMC,cAAcL,eAAeM,OAAO;QAE1C,IAAID,aAAa;YACf,OAAOA,YAAYE,YAAY,CAACV,MAAME;QACxC;QAEA,OAAO;YACLS,QAAQC,QAAQC,OAAO,CAAC;YACxBC,QAAQ,IAAM;QAChB;IACF,GAAG;
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useFocusObserved.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Types as TabsterTypes } from 'tabster';\nimport { getObservedElement } from 'tabster';\nimport { useTabster } from './useTabster';\n\ninterface UseFocusObservedOptions {\n /**\n * After timeout the focus attempt fails\n */\n timeout?: number;\n}\n\n/**\n * @param name - The observed element to focus\n * @param options - Options for the focus observed\n *\n * @returns Function that will focus an element\n */\nexport function useFocusObserved(\n name: string,\n options: UseFocusObservedOptions = {},\n): () => TabsterTypes.ObservedElementAsyncRequest<boolean> {\n const { timeout = 1000 } = options;\n const observedAPIRef = useTabster(getObservedElement);\n\n return React.useCallback(() => {\n const observerAPI = observedAPIRef.current;\n\n if (observerAPI) {\n return observerAPI.requestFocus(name, timeout);\n }\n\n return {\n result: Promise.resolve(false),\n cancel: () => null,\n diagnostics: {},\n };\n }, [observedAPIRef, name, timeout]);\n}\n"],"names":["useFocusObserved","name","options","timeout","observedAPIRef","useTabster","getObservedElement","React","useCallback","observerAPI","current","requestFocus","result","Promise","resolve","cancel","diagnostics"],"mappings":"AAAA;;;;;+BAoBgBA;;;eAAAA;;;;iEAlBO;yBAEY;4BACR;AAepB,SAASA,iBACdC,IAAY,EACZC,UAAmC,CAAC,CAAC;IAErC,MAAM,EAAEC,UAAU,IAAI,EAAE,GAAGD;IAC3B,MAAME,iBAAiBC,IAAAA,sBAAU,EAACC,2BAAkB;IAEpD,OAAOC,OAAMC,WAAW,CAAC;QACvB,MAAMC,cAAcL,eAAeM,OAAO;QAE1C,IAAID,aAAa;YACf,OAAOA,YAAYE,YAAY,CAACV,MAAME;QACxC;QAEA,OAAO;YACLS,QAAQC,QAAQC,OAAO,CAAC;YACxBC,QAAQ,IAAM;YACdC,aAAa,CAAC;QAChB;IACF,GAAG;QAACZ;QAAgBH;QAAME;KAAQ;AACpC"}
|
|
@@ -30,7 +30,7 @@ const useMergedTabsterAttributes_unstable = (...attributes)=>{
|
|
|
30
30
|
[_tabster.TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined
|
|
31
31
|
}), // disable exhaustive-deps because we want to memoize the result of the reduction
|
|
32
32
|
// this is safe because the collection of attributes is not expected to change at runtime
|
|
33
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps, react-hooks/use-memo
|
|
34
34
|
stringAttributes);
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
@@ -54,9 +54,12 @@ const useMergedTabsterAttributes_unstable = (...attributes)=>{
|
|
|
54
54
|
*/ const useWarnIfUnstableAttributes = (attributes)=>{
|
|
55
55
|
'use no memo';
|
|
56
56
|
const initialAttributesRef = _react.useRef(attributes);
|
|
57
|
+
// eslint-disable-next-line react-hooks/refs
|
|
57
58
|
let isStable = initialAttributesRef.current.length === attributes.length;
|
|
59
|
+
// eslint-disable-next-line react-hooks/refs
|
|
58
60
|
if (initialAttributesRef.current !== attributes && isStable) {
|
|
59
61
|
for(let i = 0; i < attributes.length; i++){
|
|
62
|
+
// eslint-disable-next-line react-hooks/refs
|
|
60
63
|
if (initialAttributesRef.current[i] !== attributes[i]) {
|
|
61
64
|
isStable = false;
|
|
62
65
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useMergeTabsterAttributes.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Types } from 'tabster';\nimport { TABSTER_ATTRIBUTE_NAME } from 'tabster';\n\n/**\n * Merges a collection of tabster attributes.\n *\n * ⚠️The attributes passed as arguments to this hook cannot change at runtime.\n * @internal\n * @param attributes - collection of tabster attributes from other react-tabster hooks\n * @returns single merged tabster attribute\n */\nexport const useMergedTabsterAttributes_unstable = (\n ...attributes: (Partial<Types.TabsterDOMAttribute> | null | undefined)[]\n): Types.TabsterDOMAttribute => {\n 'use no memo';\n\n const stringAttributes = attributes.reduce<string[]>((acc, curr) => {\n if (curr?.[TABSTER_ATTRIBUTE_NAME]) {\n acc.push(curr[TABSTER_ATTRIBUTE_NAME]);\n }\n return acc;\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n // ignoring rules of hooks because this is a condition based on the environment\n // it's safe to ignore the rule\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useWarnIfUnstableAttributes(stringAttributes);\n }\n\n return React.useMemo(\n () => ({\n [TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined,\n }),\n // disable exhaustive-deps because we want to memoize the result of the reduction\n // this is safe because the collection of attributes is not expected to change at runtime\n // eslint-disable-next-line react-hooks/exhaustive-deps\n stringAttributes,\n );\n};\n\n/**\n * Merges two JSON strings into one.\n */\nconst mergeJSONStrings = (a: string, b: string): string =>\n JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));\n\n/**\n * Tries to parse a JSON string and returns an object.\n * If the JSON string is invalid, an empty object is returned.\n */\nconst safelyParseJSON = (json: string): object => {\n try {\n return JSON.parse(json);\n } catch {\n return {};\n }\n};\n\n/**\n * Helper hook that ensures that the attributes passed to the hook are stable.\n * This is necessary because the attributes are expected to not change at runtime.\n *\n * This hook will console.warn if the attributes change at runtime.\n */\nconst useWarnIfUnstableAttributes = (attributes: string[]) => {\n 'use no memo';\n\n const initialAttributesRef = React.useRef(attributes);\n\n let isStable = initialAttributesRef.current.length === attributes.length;\n if (initialAttributesRef.current !== attributes && isStable) {\n for (let i = 0; i < attributes.length; i++) {\n if (initialAttributesRef.current[i] !== attributes[i]) {\n isStable = false;\n break;\n }\n }\n }\n React.useEffect(() => {\n if (!isStable) {\n const error = new Error();\n // eslint-disable-next-line no-console\n console.warn(/** #__DE-INDENT__ */ `\n @fluentui/react-tabster [useMergedTabsterAttributes]:\n The attributes passed to the hook changed at runtime.\n This might lead to unexpected behavior, please ensure that the attributes are stable.\n ${error.stack}\n `);\n }\n }, [isStable]);\n};\n"],"names":["useMergedTabsterAttributes_unstable","attributes","stringAttributes","reduce","acc","curr","TABSTER_ATTRIBUTE_NAME","push","process","env","NODE_ENV","useWarnIfUnstableAttributes","React","useMemo","length","mergeJSONStrings","undefined","a","b","JSON","stringify","Object","assign","safelyParseJSON","json","parse","initialAttributesRef","useRef","isStable","current","i","useEffect","error","Error","console","warn","stack"],"mappings":"AAAA;;;;;+BAcaA;;;eAAAA;;;;iEAZU;yBAEgB;AAUhC,MAAMA,sCAAsC,CACjD,GAAGC;IAEH;IAEA,MAAMC,mBAAmBD,WAAWE,MAAM,CAAW,CAACC,KAAKC;QACzD,IAAIA,iBAAAA,2BAAAA,IAAM,CAACC,+BAAsB,CAAC,EAAE;YAClCF,IAAIG,IAAI,CAACF,IAAI,CAACC,+BAAsB,CAAC;QACvC;QACA,OAAOF;IACT,GAAG,EAAE;IAEL,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,+EAA+E;QAC/E,+BAA+B;QAC/B,sDAAsD;QACtDC,4BAA4BT;IAC9B;IAEA,OAAOU,OAAMC,OAAO,CAClB,IAAO,CAAA;YACL,CAACP,+BAAsB,CAAC,EAAEJ,iBAAiBY,MAAM,GAAG,IAAIZ,iBAAiBC,MAAM,CAACY,oBAAoBC;QACtG,CAAA,GACA,iFAAiF;IACjF,yFAAyF;IACzF,
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useMergeTabsterAttributes.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { Types } from 'tabster';\nimport { TABSTER_ATTRIBUTE_NAME } from 'tabster';\n\n/**\n * Merges a collection of tabster attributes.\n *\n * ⚠️The attributes passed as arguments to this hook cannot change at runtime.\n * @internal\n * @param attributes - collection of tabster attributes from other react-tabster hooks\n * @returns single merged tabster attribute\n */\nexport const useMergedTabsterAttributes_unstable = (\n ...attributes: (Partial<Types.TabsterDOMAttribute> | null | undefined)[]\n): Types.TabsterDOMAttribute => {\n 'use no memo';\n\n const stringAttributes = attributes.reduce<string[]>((acc, curr) => {\n if (curr?.[TABSTER_ATTRIBUTE_NAME]) {\n acc.push(curr[TABSTER_ATTRIBUTE_NAME]);\n }\n return acc;\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n // ignoring rules of hooks because this is a condition based on the environment\n // it's safe to ignore the rule\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useWarnIfUnstableAttributes(stringAttributes);\n }\n\n return React.useMemo(\n () => ({\n [TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined,\n }),\n // disable exhaustive-deps because we want to memoize the result of the reduction\n // this is safe because the collection of attributes is not expected to change at runtime\n // eslint-disable-next-line react-hooks/exhaustive-deps, react-hooks/use-memo\n stringAttributes,\n );\n};\n\n/**\n * Merges two JSON strings into one.\n */\nconst mergeJSONStrings = (a: string, b: string): string =>\n JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));\n\n/**\n * Tries to parse a JSON string and returns an object.\n * If the JSON string is invalid, an empty object is returned.\n */\nconst safelyParseJSON = (json: string): object => {\n try {\n return JSON.parse(json);\n } catch {\n return {};\n }\n};\n\n/**\n * Helper hook that ensures that the attributes passed to the hook are stable.\n * This is necessary because the attributes are expected to not change at runtime.\n *\n * This hook will console.warn if the attributes change at runtime.\n */\nconst useWarnIfUnstableAttributes = (attributes: string[]) => {\n 'use no memo';\n\n const initialAttributesRef = React.useRef(attributes);\n\n // eslint-disable-next-line react-hooks/refs\n let isStable = initialAttributesRef.current.length === attributes.length;\n // eslint-disable-next-line react-hooks/refs\n if (initialAttributesRef.current !== attributes && isStable) {\n for (let i = 0; i < attributes.length; i++) {\n // eslint-disable-next-line react-hooks/refs\n if (initialAttributesRef.current[i] !== attributes[i]) {\n isStable = false;\n break;\n }\n }\n }\n React.useEffect(() => {\n if (!isStable) {\n const error = new Error();\n // eslint-disable-next-line no-console\n console.warn(/** #__DE-INDENT__ */ `\n @fluentui/react-tabster [useMergedTabsterAttributes]:\n The attributes passed to the hook changed at runtime.\n This might lead to unexpected behavior, please ensure that the attributes are stable.\n ${error.stack}\n `);\n }\n }, [isStable]);\n};\n"],"names":["useMergedTabsterAttributes_unstable","attributes","stringAttributes","reduce","acc","curr","TABSTER_ATTRIBUTE_NAME","push","process","env","NODE_ENV","useWarnIfUnstableAttributes","React","useMemo","length","mergeJSONStrings","undefined","a","b","JSON","stringify","Object","assign","safelyParseJSON","json","parse","initialAttributesRef","useRef","isStable","current","i","useEffect","error","Error","console","warn","stack"],"mappings":"AAAA;;;;;+BAcaA;;;eAAAA;;;;iEAZU;yBAEgB;AAUhC,MAAMA,sCAAsC,CACjD,GAAGC;IAEH;IAEA,MAAMC,mBAAmBD,WAAWE,MAAM,CAAW,CAACC,KAAKC;QACzD,IAAIA,iBAAAA,2BAAAA,IAAM,CAACC,+BAAsB,CAAC,EAAE;YAClCF,IAAIG,IAAI,CAACF,IAAI,CAACC,+BAAsB,CAAC;QACvC;QACA,OAAOF;IACT,GAAG,EAAE;IAEL,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,+EAA+E;QAC/E,+BAA+B;QAC/B,sDAAsD;QACtDC,4BAA4BT;IAC9B;IAEA,OAAOU,OAAMC,OAAO,CAClB,IAAO,CAAA;YACL,CAACP,+BAAsB,CAAC,EAAEJ,iBAAiBY,MAAM,GAAG,IAAIZ,iBAAiBC,MAAM,CAACY,oBAAoBC;QACtG,CAAA,GACA,iFAAiF;IACjF,yFAAyF;IACzF,6EAA6E;IAC7Ed;AAEJ;AAEA;;CAEC,GACD,MAAMa,mBAAmB,CAACE,GAAWC,IACnCC,KAAKC,SAAS,CAACC,OAAOC,MAAM,CAACC,gBAAgBN,IAAIM,gBAAgBL;AAEnE;;;CAGC,GACD,MAAMK,kBAAkB,CAACC;IACvB,IAAI;QACF,OAAOL,KAAKM,KAAK,CAACD;IACpB,EAAE,OAAM;QACN,OAAO,CAAC;IACV;AACF;AAEA;;;;;CAKC,GACD,MAAMb,8BAA8B,CAACV;IACnC;IAEA,MAAMyB,uBAAuBd,OAAMe,MAAM,CAAC1B;IAE1C,4CAA4C;IAC5C,IAAI2B,WAAWF,qBAAqBG,OAAO,CAACf,MAAM,KAAKb,WAAWa,MAAM;IACxE,4CAA4C;IAC5C,IAAIY,qBAAqBG,OAAO,KAAK5B,cAAc2B,UAAU;QAC3D,IAAK,IAAIE,IAAI,GAAGA,IAAI7B,WAAWa,MAAM,EAAEgB,IAAK;YAC1C,4CAA4C;YAC5C,IAAIJ,qBAAqBG,OAAO,CAACC,EAAE,KAAK7B,UAAU,CAAC6B,EAAE,EAAE;gBACrDF,WAAW;gBACX;YACF;QACF;IACF;IACAhB,OAAMmB,SAAS,CAAC;QACd,IAAI,CAACH,UAAU;YACb,MAAMI,QAAQ,IAAIC;YAClB,sCAAsC;YACtCC,QAAQC,IAAI,CAAC,mBAAmB,GAAG,CAAC;;;;QAIlC,EAAEH,MAAMI,KAAK,CAAC;MAChB,CAAC;QACH;IACF,GAAG;QAACR;KAAS;AACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-tabster",
|
|
3
|
-
"version": "9.26.
|
|
3
|
+
"version": "9.26.15",
|
|
4
4
|
"description": "Utilities for focus management and facade for tabster",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@fluentui/react-shared-contexts": "^9.26.2",
|
|
16
16
|
"@fluentui/react-theme": "^9.2.1",
|
|
17
|
-
"@fluentui/react-utilities": "^9.26.
|
|
17
|
+
"@fluentui/react-utilities": "^9.26.4",
|
|
18
18
|
"@griffel/react": "^1.5.32",
|
|
19
19
|
"@swc/helpers": "^0.5.1",
|
|
20
|
-
"keyborg": "^2.
|
|
21
|
-
"tabster": "^8.
|
|
20
|
+
"keyborg": "^2.14.1",
|
|
21
|
+
"tabster": "^8.8.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@types/react": ">=16.14.0 <20.0.0",
|