@fluentui/react-tabster 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230322-0439.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/.swcrc +2 -11
- package/CHANGELOG.json +48 -9
- package/CHANGELOG.md +20 -7
- package/lib/focus/constants.js +4 -4
- package/lib/focus/createCustomFocusIndicatorStyle.js +7 -7
- package/lib/focus/createFocusOutlineStyle.js +14 -14
- package/lib/focus/createFocusOutlineStyle.js.map +1 -1
- package/lib/focus/focusVisiblePolyfill.js +7 -7
- package/lib/focus/focusVisiblePolyfill.js.map +1 -1
- package/lib/focus/focusWithinPolyfill.js +6 -6
- package/lib/focus/index.js +4 -4
- package/lib/hooks/index.js +8 -8
- package/lib/hooks/useArrowNavigationGroup.js +8 -8
- package/lib/hooks/useArrowNavigationGroup.js.map +1 -1
- package/lib/hooks/useFocusFinders.js +19 -13
- package/lib/hooks/useFocusFinders.js.map +1 -1
- package/lib/hooks/useFocusVisible.js +6 -5
- package/lib/hooks/useFocusVisible.js.map +1 -1
- package/lib/hooks/useFocusWithin.js +4 -4
- package/lib/hooks/useFocusWithin.js.map +1 -1
- package/lib/hooks/useFocusableGroup.js +7 -7
- package/lib/hooks/useFocusableGroup.js.map +1 -1
- package/lib/hooks/useKeyboardNavAttribute.js +5 -5
- package/lib/hooks/useModalAttributes.js +5 -5
- package/lib/hooks/useTabster.js +5 -5
- package/lib/hooks/useTabster.js.map +1 -1
- package/lib/hooks/useTabsterAttributes.js +2 -2
- package/lib/index.js +3 -3
- package/lib-commonjs/focus/constants.js +4 -4
- package/lib-commonjs/focus/constants.js.map +1 -1
- package/lib-commonjs/focus/createCustomFocusIndicatorStyle.js +6 -6
- package/lib-commonjs/focus/createCustomFocusIndicatorStyle.js.map +1 -1
- package/lib-commonjs/focus/createFocusOutlineStyle.js +10 -10
- package/lib-commonjs/focus/createFocusOutlineStyle.js.map +1 -1
- package/lib-commonjs/focus/focusVisiblePolyfill.js +4 -4
- package/lib-commonjs/focus/focusVisiblePolyfill.js.map +1 -1
- package/lib-commonjs/focus/focusWithinPolyfill.js +4 -4
- package/lib-commonjs/focus/focusWithinPolyfill.js.map +1 -1
- package/lib-commonjs/focus/index.js.map +1 -1
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useArrowNavigationGroup.js +5 -5
- package/lib-commonjs/hooks/useArrowNavigationGroup.js.map +1 -1
- package/lib-commonjs/hooks/useFocusFinders.js +12 -6
- package/lib-commonjs/hooks/useFocusFinders.js.map +1 -1
- package/lib-commonjs/hooks/useFocusVisible.js +3 -2
- package/lib-commonjs/hooks/useFocusVisible.js.map +1 -1
- package/lib-commonjs/hooks/useFocusWithin.js +1 -1
- package/lib-commonjs/hooks/useFocusWithin.js.map +1 -1
- package/lib-commonjs/hooks/useFocusableGroup.js +4 -4
- package/lib-commonjs/hooks/useFocusableGroup.js.map +1 -1
- package/lib-commonjs/hooks/useKeyboardNavAttribute.js +1 -1
- package/lib-commonjs/hooks/useKeyboardNavAttribute.js.map +1 -1
- package/lib-commonjs/hooks/useModalAttributes.js +1 -1
- package/lib-commonjs/hooks/useModalAttributes.js.map +1 -1
- package/lib-commonjs/hooks/useTabster.js +1 -1
- package/lib-commonjs/hooks/useTabster.js.map +1 -1
- package/lib-commonjs/hooks/useTabsterAttributes.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +7 -6
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/hooks/useKeyboardNavAttribute.js"],"sourcesContent":["import { createKeyborg } from
|
1
|
+
{"version":3,"sources":["../../lib/hooks/useKeyboardNavAttribute.js"],"sourcesContent":["import { createKeyborg } from 'keyborg';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { KEYBOARD_NAV_ATTRIBUTE } from '../focus/constants';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n/**\n * Instantiates [keyborg](https://github.com/microsoft/keyborg) and adds `data-keyboard-nav`\n * attribute to a referenced element to ensure keyboard navigation awareness\n * synced to keyborg logic without having to cause a re-render on react tree.\n */\nexport function useKeyboardNavAttribute() {\n const {\n targetDocument\n } = useFluent();\n const keyborg = useMemo(() => targetDocument && createKeyborg(targetDocument.defaultView), [targetDocument]);\n const ref = useRef(null);\n useEffect(() => {\n if (keyborg) {\n setBooleanAttribute(ref, KEYBOARD_NAV_ATTRIBUTE, keyborg.isNavigatingWithKeyboard());\n const cb = next => {\n setBooleanAttribute(ref, KEYBOARD_NAV_ATTRIBUTE, next);\n };\n keyborg.subscribe(cb);\n return () => keyborg.unsubscribe(cb);\n }\n }, [keyborg]);\n return ref;\n}\nfunction setBooleanAttribute(elementRef, attribute, value) {\n if (!elementRef.current) {\n return;\n }\n if (value) {\n elementRef.current.setAttribute(attribute, '');\n } else {\n elementRef.current.removeAttribute(attribute);\n }\n}\n//# sourceMappingURL=useKeyboardNavAttribute.js.map"],"names":["useKeyboardNavAttribute","targetDocument","useFluent","keyborg","useMemo","createKeyborg","defaultView","ref","useRef","useEffect","setBooleanAttribute","KEYBOARD_NAV_ATTRIBUTE","isNavigatingWithKeyboard","cb","next","subscribe","unsubscribe","elementRef","attribute","value","current","setAttribute","removeAttribute"],"mappings":";;;;+BASgBA;;aAAAA;;yBATc;uBACa;2BACJ;qCACS;AAMzC,SAASA,0BAA0B;IACxC,MAAM,EACJC,eAAc,EACf,GAAGC,IAAAA,uCAAS;IACb,MAAMC,UAAUC,IAAAA,cAAO,EAAC,IAAMH,kBAAkBI,IAAAA,sBAAa,EAACJ,eAAeK,WAAW,GAAG;QAACL;KAAe;IAC3G,MAAMM,MAAMC,IAAAA,aAAM,EAAC,IAAI;IACvBC,IAAAA,gBAAS,EAAC,IAAM;QACd,IAAIN,SAAS;YACXO,oBAAoBH,KAAKI,iCAAsB,EAAER,QAAQS,wBAAwB;YACjF,MAAMC,KAAKC,CAAAA,OAAQ;gBACjBJ,oBAAoBH,KAAKI,iCAAsB,EAAEG;YACnD;YACAX,QAAQY,SAAS,CAACF;YAClB,OAAO,IAAMV,QAAQa,WAAW,CAACH;QACnC,CAAC;IACH,GAAG;QAACV;KAAQ;IACZ,OAAOI;AACT;AACA,SAASG,oBAAoBO,UAAU,EAAEC,SAAS,EAAEC,KAAK,EAAE;IACzD,IAAI,CAACF,WAAWG,OAAO,EAAE;QACvB;IACF,CAAC;IACD,IAAID,OAAO;QACTF,WAAWG,OAAO,CAACC,YAAY,CAACH,WAAW;IAC7C,OAAO;QACLD,WAAWG,OAAO,CAACE,eAAe,CAACJ;IACrC,CAAC;AACH,EACA,mDAAmD"}
|
@@ -18,7 +18,7 @@ const useModalAttributes = (options = {})=>{
|
|
18
18
|
(0, _tabster.getModalizer)(tabster);
|
19
19
|
(0, _tabster.getDeloser)(tabster);
|
20
20
|
}
|
21
|
-
const id = (0, _reactUtilities.useId)(
|
21
|
+
const id = (0, _reactUtilities.useId)('modal-', options.id);
|
22
22
|
const modalAttributes = (0, _useTabsterAttributes.useTabsterAttributes)({
|
23
23
|
deloser: {},
|
24
24
|
modalizer: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/hooks/useModalAttributes.js"],"sourcesContent":["import { useId } from
|
1
|
+
{"version":3,"sources":["../../lib/hooks/useModalAttributes.js"],"sourcesContent":["import { useId } from '@fluentui/react-utilities';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nimport { getDeloser, getModalizer } from 'tabster';\nimport { useTabster } from './useTabster';\n/**\n * Applies modal dialog behaviour through DOM attributes\n * Modal element will focus trap and hide other content on the page\n * The trigger element will be focused if focus is lost after the modal element is removed\n *\n * @returns DOM attributes to apply to the modal element and its trigger\n */\nexport const useModalAttributes = (options = {}) => {\n const {\n trapFocus,\n alwaysFocusable,\n legacyTrapFocus\n } = options;\n const tabster = useTabster();\n // Initializes the modalizer and deloser APIs\n if (tabster) {\n getModalizer(tabster);\n getDeloser(tabster);\n }\n const id = useId('modal-', options.id);\n const modalAttributes = useTabsterAttributes({\n deloser: {},\n modalizer: {\n id,\n isOthersAccessible: !trapFocus,\n isAlwaysAccessible: alwaysFocusable,\n isTrapped: legacyTrapFocus && trapFocus\n }\n });\n const triggerAttributes = useTabsterAttributes({\n deloser: {}\n });\n return {\n modalAttributes,\n triggerAttributes\n };\n};\n//# sourceMappingURL=useModalAttributes.js.map"],"names":["useModalAttributes","options","trapFocus","alwaysFocusable","legacyTrapFocus","tabster","useTabster","getModalizer","getDeloser","id","useId","modalAttributes","useTabsterAttributes","deloser","modalizer","isOthersAccessible","isAlwaysAccessible","isTrapped","triggerAttributes"],"mappings":";;;;+BAWaA;;aAAAA;;gCAXS;sCACe;yBACI;4BACd;AAQpB,MAAMA,qBAAqB,CAACC,UAAU,CAAC,CAAC,GAAK;IAClD,MAAM,EACJC,UAAS,EACTC,gBAAe,EACfC,gBAAe,EAChB,GAAGH;IACJ,MAAMI,UAAUC,IAAAA,sBAAU;IAC1B,6CAA6C;IAC7C,IAAID,SAAS;QACXE,IAAAA,qBAAY,EAACF;QACbG,IAAAA,mBAAU,EAACH;IACb,CAAC;IACD,MAAMI,KAAKC,IAAAA,qBAAK,EAAC,UAAUT,QAAQQ,EAAE;IACrC,MAAME,kBAAkBC,IAAAA,0CAAoB,EAAC;QAC3CC,SAAS,CAAC;QACVC,WAAW;YACTL;YACAM,oBAAoB,CAACb;YACrBc,oBAAoBb;YACpBc,WAAWb,mBAAmBF;QAChC;IACF;IACA,MAAMgB,oBAAoBN,IAAAA,0CAAoB,EAAC;QAC7CC,SAAS,CAAC;IACZ;IACA,OAAO;QACLF;QACAO;IACF;AACF,GACA,8CAA8C"}
|
@@ -13,7 +13,7 @@ const _tabster = require("tabster");
|
|
13
13
|
const _reactUtilities = require("@fluentui/react-utilities");
|
14
14
|
const useTabster = ()=>{
|
15
15
|
const { targetDocument } = (0, _reactSharedContexts.useFluent_unstable)();
|
16
|
-
const defaultView = targetDocument
|
16
|
+
const defaultView = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) || undefined;
|
17
17
|
const tabster = _react.useMemo(()=>{
|
18
18
|
if (!defaultView) {
|
19
19
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/hooks/useTabster.js"],"sourcesContent":["import * as React from
|
1
|
+
{"version":3,"sources":["../../lib/hooks/useTabster.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { createTabster, disposeTabster } from 'tabster';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n/**\n * Tries to get a tabster instance on the current window or creates a new one\n * Since Tabster is single instance only, feel free to call this hook to ensure Tabster exists if necessary\n *\n * @internal\n * @returns Tabster core instance\n */\nexport const useTabster = () => {\n const {\n targetDocument\n } = useFluent();\n const defaultView = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) || undefined;\n const tabster = React.useMemo(() => {\n if (!defaultView) {\n return null;\n }\n return createTabster(defaultView, {\n autoRoot: {},\n controlTab: false\n });\n }, [defaultView]);\n useIsomorphicLayoutEffect(() => {\n return () => {\n if (tabster) {\n disposeTabster(tabster);\n }\n };\n }, [tabster]);\n return tabster;\n};\n//# sourceMappingURL=useTabster.js.map"],"names":["useTabster","targetDocument","useFluent","defaultView","undefined","tabster","React","useMemo","createTabster","autoRoot","controlTab","useIsomorphicLayoutEffect","disposeTabster"],"mappings":";;;;+BAWaA;;aAAAA;;;6DAXU;qCACyB;yBACF;gCACJ;AAQnC,MAAMA,aAAa,IAAM;IAC9B,MAAM,EACJC,eAAc,EACf,GAAGC,IAAAA,uCAAS;IACb,MAAMC,cAAc,AAACF,CAAAA,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeE,WAAW,AAAD,KAAMC;IACpH,MAAMC,UAAUC,OAAMC,OAAO,CAAC,IAAM;QAClC,IAAI,CAACJ,aAAa;YAChB,OAAO,IAAI;QACb,CAAC;QACD,OAAOK,IAAAA,sBAAa,EAACL,aAAa;YAChCM,UAAU,CAAC;YACXC,YAAY,KAAK;QACnB;IACF,GAAG;QAACP;KAAY;IAChBQ,IAAAA,yCAAyB,EAAC,IAAM;QAC9B,OAAO,IAAM;YACX,IAAIN,SAAS;gBACXO,IAAAA,uBAAc,EAACP;YACjB,CAAC;QACH;IACF,GAAG;QAACA;KAAQ;IACZ,OAAOA;AACT,GACA,sCAAsC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../lib/hooks/useTabsterAttributes.js"],"sourcesContent":["import { getTabsterAttribute } from
|
1
|
+
{"version":3,"sources":["../../lib/hooks/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 */\nexport 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 return getTabsterAttribute(props);\n};\n//# sourceMappingURL=useTabsterAttributes.js.map"],"names":["useTabsterAttributes","props","useTabster","getTabsterAttribute"],"mappings":";;;;+BAMaA;;aAAAA;;yBANuB;4BACT;AAKpB,MAAMA,uBAAuBC,CAAAA,QAAS;IAC3C,qEAAqE;IACrE,iHAAiH;IACjHC,IAAAA,sBAAU;IACV,OAAOC,IAAAA,4BAAmB,EAACF;AAC7B,GACA,gDAAgD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes } from
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes } from './hooks/index';\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\nexport { applyFocusVisiblePolyfill } from './focus/index';\n//# sourceMappingURL=index.js.map"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill"],"mappings":";;;;;;;;;;;IAASA,uBAAuB,MAAvBA,8BAAuB;IAAEC,iBAAiB,MAAjBA,wBAAiB;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,eAAe,MAAfA,sBAAe;IAAEC,cAAc,MAAdA,qBAAc;IAAEC,uBAAuB,MAAvBA,8BAAuB;IAAEC,kBAAkB,MAAlBA,yBAAkB;IAAEC,oBAAoB,MAApBA,2BAAoB;IAC/JC,+BAA+B,MAA/BA,uCAA+B;IAAEC,uBAAuB,MAAvBA,+BAAuB;IACxDC,yBAAyB,MAAzBA,iCAAyB;;uBAF8I;wBACvG;CAEzE,iCAAiC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tabster",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230322-0439.1",
|
4
4
|
"description": "Utilities for focus management and facade for tabster",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -31,12 +31,12 @@
|
|
31
31
|
},
|
32
32
|
"dependencies": {
|
33
33
|
"@griffel/react": "^1.5.2",
|
34
|
-
"@fluentui/react-shared-contexts": "0.0.0-nightly-
|
35
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
36
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
34
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20230322-0439.1",
|
35
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230322-0439.1",
|
36
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230322-0439.1",
|
37
|
+
"@swc/helpers": "^0.4.14",
|
37
38
|
"keyborg": "^2.0.0",
|
38
|
-
"tabster": "^4.1.1"
|
39
|
-
"@swc/helpers": "^0.4.14"
|
39
|
+
"tabster": "^4.1.1"
|
40
40
|
},
|
41
41
|
"peerDependencies": {
|
42
42
|
"@types/react": ">=16.8.0 <19.0.0",
|
@@ -48,6 +48,7 @@
|
|
48
48
|
"exports": {
|
49
49
|
".": {
|
50
50
|
"types": "./dist/index.d.ts",
|
51
|
+
"node": "./lib-commonjs/index.js",
|
51
52
|
"import": "./lib/index.js",
|
52
53
|
"require": "./lib-commonjs/index.js"
|
53
54
|
},
|