@fluentui/react-tabster 9.17.0 → 9.17.2
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 +22 -2
- package/lib/hooks/useMergeTabsterAttributes.js +4 -5
- package/lib/hooks/useMergeTabsterAttributes.js.map +1 -1
- package/lib/hooks/useTabsterAttributes.js +8 -2
- package/lib/hooks/useTabsterAttributes.js.map +1 -1
- package/lib-commonjs/hooks/useMergeTabsterAttributes.js +4 -5
- package/lib-commonjs/hooks/useMergeTabsterAttributes.js.map +1 -1
- package/lib-commonjs/hooks/useTabsterAttributes.js +8 -1
- package/lib-commonjs/hooks/useTabsterAttributes.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,32 @@
|
|
1
1
|
# Change Log - @fluentui/react-tabster
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Wed, 17 Jan 2024 16:13:10 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.17.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.17.2)
|
8
|
+
|
9
|
+
Wed, 17 Jan 2024 16:13:10 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.17.1..@fluentui/react-tabster_v9.17.2)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: use Types.TabsterAttributeName in useTabsterAttributes() ([PR #30321](https://github.com/microsoft/fluentui/pull/30321) by olfedias@microsoft.com)
|
15
|
+
- Bump @fluentui/react-utilities to v9.16.0 ([PR #30339](https://github.com/microsoft/fluentui/pull/30339) by beachball)
|
16
|
+
|
17
|
+
## [9.17.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.17.1)
|
18
|
+
|
19
|
+
Tue, 16 Jan 2024 13:14:10 GMT
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.17.0..@fluentui/react-tabster_v9.17.1)
|
21
|
+
|
22
|
+
### Patches
|
23
|
+
|
24
|
+
- fix: memoize tabster attributes ([PR #30289](https://github.com/microsoft/fluentui/pull/30289) by lingfangao@hotmail.com)
|
25
|
+
- fix: correct version of @types/react-dom peer dep that matches for 16.x ([PR #30259](https://github.com/microsoft/fluentui/pull/30259) by mgodbolt@microsoft.com)
|
26
|
+
|
7
27
|
## [9.17.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.17.0)
|
8
28
|
|
9
|
-
Mon, 08 Jan 2024 16:
|
29
|
+
Mon, 08 Jan 2024 16:24:26 GMT
|
10
30
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.16.1..@fluentui/react-tabster_v9.17.0)
|
11
31
|
|
12
32
|
### Minor changes
|
@@ -9,18 +9,17 @@ import { Types } from 'tabster';
|
|
9
9
|
* @returns single merged tabster attribute
|
10
10
|
*/ export const useMergedTabsterAttributes_unstable = (...attributes)=>{
|
11
11
|
const stringAttributes = attributes.map((attribute)=>attribute[Types.TabsterAttributeName]).filter(Boolean);
|
12
|
-
|
12
|
+
return React.useMemo(()=>{
|
13
13
|
let attribute = stringAttributes[0];
|
14
14
|
attributes.shift();
|
15
15
|
for (const attr of stringAttributes){
|
16
16
|
attribute = mergeAttributes(attribute, attr);
|
17
17
|
}
|
18
|
-
return
|
18
|
+
return {
|
19
|
+
[Types.TabsterAttributeName]: attribute
|
20
|
+
};
|
19
21
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
20
22
|
}, stringAttributes);
|
21
|
-
return {
|
22
|
-
[Types.TabsterAttributeName]: mergedStrigAttribute
|
23
|
-
};
|
24
23
|
};
|
25
24
|
function mergeAttributes(a, b) {
|
26
25
|
if (!b) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useMergeTabsterAttributes.ts"],"sourcesContent":["import * as React from 'react';\nimport { Types } 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: Types.TabsterDOMAttribute[]\n) => Types.TabsterDOMAttribute = (...attributes) => {\n const stringAttributes = attributes\n .map(attribute => attribute[Types.TabsterAttributeName])\n .filter(Boolean) as string[];\n\n
|
1
|
+
{"version":3,"sources":["useMergeTabsterAttributes.ts"],"sourcesContent":["import * as React from 'react';\nimport { Types } 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: Types.TabsterDOMAttribute[]\n) => Types.TabsterDOMAttribute = (...attributes) => {\n const stringAttributes = attributes\n .map(attribute => attribute[Types.TabsterAttributeName])\n .filter(Boolean) as string[];\n\n return React.useMemo(() => {\n let attribute = stringAttributes[0];\n attributes.shift();\n\n for (const attr of stringAttributes) {\n attribute = mergeAttributes(attribute, attr);\n }\n\n return { [Types.TabsterAttributeName]: attribute };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, stringAttributes);\n};\n\nfunction mergeAttributes(a: string, b?: string): string {\n if (!b) {\n return a;\n }\n\n let aParsed = {};\n let bParsed = {};\n if (a) {\n try {\n aParsed = JSON.parse(a);\n // eslint-disable-next-line no-empty\n } catch {}\n }\n\n if (b) {\n try {\n bParsed = JSON.parse(b);\n // eslint-disable-next-line no-empty\n } catch {}\n }\n\n return JSON.stringify({ ...aParsed, ...bParsed });\n}\n"],"names":["React","Types","useMergedTabsterAttributes_unstable","attributes","stringAttributes","map","attribute","TabsterAttributeName","filter","Boolean","useMemo","shift","attr","mergeAttributes","a","b","aParsed","bParsed","JSON","parse","stringify"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,KAAK,QAAQ,UAAU;AAEhC;;;;;;;CAOC,GACD,OAAO,MAAMC,sCAEoB,CAAC,GAAGC;IACnC,MAAMC,mBAAmBD,WACtBE,GAAG,CAACC,CAAAA,YAAaA,SAAS,CAACL,MAAMM,oBAAoB,CAAC,EACtDC,MAAM,CAACC;IAEV,OAAOT,MAAMU,OAAO,CAAC;QACnB,IAAIJ,YAAYF,gBAAgB,CAAC,EAAE;QACnCD,WAAWQ,KAAK;QAEhB,KAAK,MAAMC,QAAQR,iBAAkB;YACnCE,YAAYO,gBAAgBP,WAAWM;QACzC;QAEA,OAAO;YAAE,CAACX,MAAMM,oBAAoB,CAAC,EAAED;QAAU;IACjD,uDAAuD;IACzD,GAAGF;AACL,EAAE;AAEF,SAASS,gBAAgBC,CAAS,EAAEC,CAAU;IAC5C,IAAI,CAACA,GAAG;QACN,OAAOD;IACT;IAEA,IAAIE,UAAU,CAAC;IACf,IAAIC,UAAU,CAAC;IACf,IAAIH,GAAG;QACL,IAAI;YACFE,UAAUE,KAAKC,KAAK,CAACL;QACrB,oCAAoC;QACtC,EAAE,OAAM,CAAC;IACX;IAEA,IAAIC,GAAG;QACL,IAAI;YACFE,UAAUC,KAAKC,KAAK,CAACJ;QACrB,oCAAoC;QACtC,EAAE,OAAM,CAAC;IACX;IAEA,OAAOG,KAAKE,SAAS,CAAC;QAAE,GAAGJ,OAAO;QAAE,GAAGC,OAAO;IAAC;AACjD"}
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { getTabsterAttribute } from 'tabster';
|
1
|
+
import { getTabsterAttribute, Types as TabsterTypes } from 'tabster';
|
2
2
|
import { useTabster } from './useTabster';
|
3
|
+
import * as React from 'react';
|
3
4
|
/**
|
4
5
|
* @internal
|
5
6
|
* Hook that returns tabster attributes while ensuring tabster exists
|
@@ -7,5 +8,10 @@ import { useTabster } from './useTabster';
|
|
7
8
|
// A tabster instance is not necessary to generate tabster attributes
|
8
9
|
// but calling the hook will ensure that a tabster instance exists internally and avoids consumers doing the same
|
9
10
|
useTabster();
|
10
|
-
|
11
|
+
const strAttr = getTabsterAttribute(props, true);
|
12
|
+
return React.useMemo(()=>({
|
13
|
+
[TabsterTypes.TabsterAttributeName]: strAttr
|
14
|
+
}), [
|
15
|
+
strAttr
|
16
|
+
]);
|
11
17
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useTabsterAttributes.ts"],"sourcesContent":["import { getTabsterAttribute, Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\n\n/**\n * @internal\n * Hook that returns tabster attributes while ensuring tabster exists\n */\nexport const useTabsterAttributes = (props: TabsterTypes.TabsterAttributeProps): TabsterTypes.TabsterDOMAttribute => {\n // A tabster instance is not necessary to generate tabster attributes\n // but calling the hook will ensure that a tabster instance exists internally and avoids consumers doing the same\n useTabster();\n\n
|
1
|
+
{"version":3,"sources":["useTabsterAttributes.ts"],"sourcesContent":["import { getTabsterAttribute, Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\nimport * as React from 'react';\n\n/**\n * @internal\n * Hook that returns tabster attributes while ensuring tabster exists\n */\nexport const useTabsterAttributes = (props: TabsterTypes.TabsterAttributeProps): TabsterTypes.TabsterDOMAttribute => {\n // A tabster instance is not necessary to generate tabster attributes\n // but calling the hook will ensure that a tabster instance exists internally and avoids consumers doing the same\n useTabster();\n\n const strAttr = getTabsterAttribute(props, true);\n\n return React.useMemo(\n () => ({\n [TabsterTypes.TabsterAttributeName]: strAttr,\n }),\n [strAttr],\n );\n};\n"],"names":["getTabsterAttribute","Types","TabsterTypes","useTabster","React","useTabsterAttributes","props","strAttr","useMemo","TabsterAttributeName"],"mappings":"AAAA,SAASA,mBAAmB,EAAEC,SAASC,YAAY,QAAQ,UAAU;AACrE,SAASC,UAAU,QAAQ,eAAe;AAC1C,YAAYC,WAAW,QAAQ;AAE/B;;;CAGC,GACD,OAAO,MAAMC,uBAAuB,CAACC;IACnC,qEAAqE;IACrE,iHAAiH;IACjHH;IAEA,MAAMI,UAAUP,oBAAoBM,OAAO;IAE3C,OAAOF,MAAMI,OAAO,CAClB,IAAO,CAAA;YACL,CAACN,aAAaO,oBAAoB,CAAC,EAAEF;QACvC,CAAA,GACA;QAACA;KAAQ;AAEb,EAAE"}
|
@@ -13,18 +13,17 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _tabster = require("tabster");
|
14
14
|
const useMergedTabsterAttributes_unstable = (...attributes)=>{
|
15
15
|
const stringAttributes = attributes.map((attribute)=>attribute[_tabster.Types.TabsterAttributeName]).filter(Boolean);
|
16
|
-
|
16
|
+
return _react.useMemo(()=>{
|
17
17
|
let attribute = stringAttributes[0];
|
18
18
|
attributes.shift();
|
19
19
|
for (const attr of stringAttributes){
|
20
20
|
attribute = mergeAttributes(attribute, attr);
|
21
21
|
}
|
22
|
-
return
|
22
|
+
return {
|
23
|
+
[_tabster.Types.TabsterAttributeName]: attribute
|
24
|
+
};
|
23
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
24
26
|
}, stringAttributes);
|
25
|
-
return {
|
26
|
-
[_tabster.Types.TabsterAttributeName]: mergedStrigAttribute
|
27
|
-
};
|
28
27
|
};
|
29
28
|
function mergeAttributes(a, b) {
|
30
29
|
if (!b) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useMergeTabsterAttributes.js"],"sourcesContent":["import * as React from 'react';\nimport { Types } from 'tabster';\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 */ export const useMergedTabsterAttributes_unstable = (...attributes)=>{\n const stringAttributes = attributes.map((attribute)=>attribute[Types.TabsterAttributeName]).filter(Boolean);\n
|
1
|
+
{"version":3,"sources":["useMergeTabsterAttributes.js"],"sourcesContent":["import * as React from 'react';\nimport { Types } from 'tabster';\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 */ export const useMergedTabsterAttributes_unstable = (...attributes)=>{\n const stringAttributes = attributes.map((attribute)=>attribute[Types.TabsterAttributeName]).filter(Boolean);\n return React.useMemo(()=>{\n let attribute = stringAttributes[0];\n attributes.shift();\n for (const attr of stringAttributes){\n attribute = mergeAttributes(attribute, attr);\n }\n return {\n [Types.TabsterAttributeName]: attribute\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, stringAttributes);\n};\nfunction mergeAttributes(a, b) {\n if (!b) {\n return a;\n }\n let aParsed = {};\n let bParsed = {};\n if (a) {\n try {\n aParsed = JSON.parse(a);\n // eslint-disable-next-line no-empty\n } catch {}\n }\n if (b) {\n try {\n bParsed = JSON.parse(b);\n // eslint-disable-next-line no-empty\n } catch {}\n }\n return JSON.stringify({\n ...aParsed,\n ...bParsed\n });\n}\n"],"names":["useMergedTabsterAttributes_unstable","attributes","stringAttributes","map","attribute","Types","TabsterAttributeName","filter","Boolean","React","useMemo","shift","attr","mergeAttributes","a","b","aParsed","bParsed","JSON","parse","stringify"],"mappings":";;;;+BASiBA;;;eAAAA;;;;iEATM;yBACD;AAQX,MAAMA,sCAAsC,CAAC,GAAGC;IACvD,MAAMC,mBAAmBD,WAAWE,GAAG,CAAC,CAACC,YAAYA,SAAS,CAACC,cAAK,CAACC,oBAAoB,CAAC,EAAEC,MAAM,CAACC;IACnG,OAAOC,OAAMC,OAAO,CAAC;QACjB,IAAIN,YAAYF,gBAAgB,CAAC,EAAE;QACnCD,WAAWU,KAAK;QAChB,KAAK,MAAMC,QAAQV,iBAAiB;YAChCE,YAAYS,gBAAgBT,WAAWQ;QAC3C;QACA,OAAO;YACH,CAACP,cAAK,CAACC,oBAAoB,CAAC,EAAEF;QAClC;IACJ,uDAAuD;IACvD,GAAGF;AACP;AACA,SAASW,gBAAgBC,CAAC,EAAEC,CAAC;IACzB,IAAI,CAACA,GAAG;QACJ,OAAOD;IACX;IACA,IAAIE,UAAU,CAAC;IACf,IAAIC,UAAU,CAAC;IACf,IAAIH,GAAG;QACH,IAAI;YACAE,UAAUE,KAAKC,KAAK,CAACL;QACzB,oCAAoC;QACpC,EAAE,OAAO,CAAC;IACd;IACA,IAAIC,GAAG;QACH,IAAI;YACAE,UAAUC,KAAKC,KAAK,CAACJ;QACzB,oCAAoC;QACpC,EAAE,OAAO,CAAC;IACd;IACA,OAAOG,KAAKE,SAAS,CAAC;QAClB,GAAGJ,OAAO;QACV,GAAGC,OAAO;IACd;AACJ"}
|
@@ -8,11 +8,18 @@ Object.defineProperty(exports, "useTabsterAttributes", {
|
|
8
8
|
return useTabsterAttributes;
|
9
9
|
}
|
10
10
|
});
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
11
12
|
const _tabster = require("tabster");
|
12
13
|
const _useTabster = require("./useTabster");
|
14
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
15
|
const useTabsterAttributes = (props)=>{
|
14
16
|
// A tabster instance is not necessary to generate tabster attributes
|
15
17
|
// but calling the hook will ensure that a tabster instance exists internally and avoids consumers doing the same
|
16
18
|
(0, _useTabster.useTabster)();
|
17
|
-
|
19
|
+
const strAttr = (0, _tabster.getTabsterAttribute)(props, true);
|
20
|
+
return _react.useMemo(()=>({
|
21
|
+
[_tabster.Types.TabsterAttributeName]: strAttr
|
22
|
+
}), [
|
23
|
+
strAttr
|
24
|
+
]);
|
18
25
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useTabsterAttributes.js"],"sourcesContent":["import { getTabsterAttribute } from 'tabster';\nimport { useTabster } from './useTabster';\n/**\n * @internal\n * Hook that returns tabster attributes while ensuring tabster exists\n */ export const useTabsterAttributes = (props)=>{\n // A tabster instance is not necessary to generate tabster attributes\n // but calling the hook will ensure that a tabster instance exists internally and avoids consumers doing the same\n useTabster();\n
|
1
|
+
{"version":3,"sources":["useTabsterAttributes.js"],"sourcesContent":["import { getTabsterAttribute, Types as TabsterTypes } from 'tabster';\nimport { useTabster } from './useTabster';\nimport * as React from 'react';\n/**\n * @internal\n * Hook that returns tabster attributes while ensuring tabster exists\n */ export const useTabsterAttributes = (props)=>{\n // A tabster instance is not necessary to generate tabster attributes\n // but calling the hook will ensure that a tabster instance exists internally and avoids consumers doing the same\n useTabster();\n const strAttr = getTabsterAttribute(props, true);\n return React.useMemo(()=>({\n [TabsterTypes.TabsterAttributeName]: strAttr\n }), [\n strAttr\n ]);\n};\n"],"names":["useTabsterAttributes","props","useTabster","strAttr","getTabsterAttribute","React","useMemo","TabsterTypes","TabsterAttributeName"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;yBAN0C;4BAChC;iEACJ;AAIZ,MAAMA,uBAAuB,CAACC;IACrC,qEAAqE;IACrE,iHAAiH;IACjHC,IAAAA,sBAAU;IACV,MAAMC,UAAUC,IAAAA,4BAAmB,EAACH,OAAO;IAC3C,OAAOI,OAAMC,OAAO,CAAC,IAAK,CAAA;YAClB,CAACC,cAAY,CAACC,oBAAoB,CAAC,EAAEL;QACzC,CAAA,GAAI;QACJA;KACH;AACL"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tabster",
|
3
|
-
"version": "9.17.
|
3
|
+
"version": "9.17.2",
|
4
4
|
"description": "Utilities for focus management and facade for tabster",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"dependencies": {
|
34
34
|
"@fluentui/react-shared-contexts": "^9.13.2",
|
35
35
|
"@fluentui/react-theme": "^9.1.16",
|
36
|
-
"@fluentui/react-utilities": "^9.
|
36
|
+
"@fluentui/react-utilities": "^9.16.0",
|
37
37
|
"@griffel/react": "^1.5.14",
|
38
38
|
"@swc/helpers": "^0.5.1",
|
39
39
|
"keyborg": "^2.3.0",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
},
|
42
42
|
"peerDependencies": {
|
43
43
|
"@types/react": ">=16.14.0 <19.0.0",
|
44
|
-
"@types/react-dom": ">=16.
|
44
|
+
"@types/react-dom": ">=16.9.0 <19.0.0",
|
45
45
|
"react": ">=16.14.0 <19.0.0",
|
46
46
|
"react-dom": ">=16.14.0 <19.0.0"
|
47
47
|
},
|