@fluentui/react-tabster 9.21.1 → 9.21.3
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/focus/createFocusOutlineStyle.js +2 -2
- package/lib/focus/createFocusOutlineStyle.js.map +1 -1
- package/lib/hooks/{useKeyborg.js → useKeyborgRef.js} +12 -7
- package/lib/hooks/useKeyborgRef.js.map +1 -0
- package/lib/hooks/useOnKeyboardNavigationChange.js +7 -4
- package/lib/hooks/useOnKeyboardNavigationChange.js.map +1 -1
- package/lib/hooks/useSetKeyboardNavigation.js +5 -4
- package/lib/hooks/useSetKeyboardNavigation.js.map +1 -1
- package/lib-commonjs/focus/createFocusOutlineStyle.js +2 -2
- package/lib-commonjs/focus/createFocusOutlineStyle.js.map +1 -1
- package/lib-commonjs/hooks/{useKeyborg.js → useKeyborgRef.js} +14 -9
- package/lib-commonjs/hooks/useKeyborgRef.js.map +1 -0
- package/lib-commonjs/hooks/useOnKeyboardNavigationChange.js +7 -4
- package/lib-commonjs/hooks/useOnKeyboardNavigationChange.js.map +1 -1
- package/lib-commonjs/hooks/useSetKeyboardNavigation.js +5 -4
- package/lib-commonjs/hooks/useSetKeyboardNavigation.js.map +1 -1
- package/package.json +4 -4
- package/lib/hooks/useKeyborg.js.map +0 -1
- package/lib-commonjs/hooks/useKeyborg.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,32 @@
|
|
1
1
|
# Change Log - @fluentui/react-tabster
|
2
2
|
|
3
|
-
This log was last generated on Mon,
|
3
|
+
This log was last generated on Mon, 20 May 2024 12:36:41 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.21.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.21.3)
|
8
|
+
|
9
|
+
Mon, 20 May 2024 12:36:41 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.21.2..@fluentui/react-tabster_v9.21.3)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: bump @griffel/react ([PR #31258](https://github.com/microsoft/fluentui/pull/31258) by olfedias@microsoft.com)
|
15
|
+
- Bump @fluentui/react-shared-contexts to v9.19.0 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
16
|
+
- Bump @fluentui/react-utilities to v9.18.9 ([PR #26682](https://github.com/microsoft/fluentui/pull/26682) by beachball)
|
17
|
+
|
18
|
+
## [9.21.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.21.2)
|
19
|
+
|
20
|
+
Thu, 09 May 2024 19:35:12 GMT
|
21
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.21.1..@fluentui/react-tabster_v9.21.2)
|
22
|
+
|
23
|
+
### Patches
|
24
|
+
|
25
|
+
- fix: replace internal useKeyborg() with useKeyborgRef() ([PR #31295](https://github.com/microsoft/fluentui/pull/31295) by olfedias@microsoft.com)
|
26
|
+
|
7
27
|
## [9.21.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.21.1)
|
8
28
|
|
9
|
-
Mon, 06 May 2024 12:
|
29
|
+
Mon, 06 May 2024 12:55:01 GMT
|
10
30
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.21.0..@fluentui/react-tabster_v9.21.1)
|
11
31
|
|
12
32
|
### Patches
|
@@ -35,11 +35,11 @@ import { defaultOptions } from './constants';
|
|
35
35
|
position: 'absolute',
|
36
36
|
pointerEvents: 'none',
|
37
37
|
zIndex: 1,
|
38
|
-
...shorthands.borderStyle('solid'),
|
38
|
+
/* eslint-disable deprecation/deprecation */ ...shorthands.borderStyle('solid'),
|
39
39
|
...shorthands.borderWidth(outlineWidth),
|
40
40
|
...shorthands.borderRadius(outlineRadius),
|
41
41
|
...shorthands.borderColor(outlineColor),
|
42
|
-
top: getOutlinePosition(options, 'top'),
|
42
|
+
/* eslint-enable deprecation/deprecation */ top: getOutlinePosition(options, 'top'),
|
43
43
|
right: getOutlinePosition(options, 'right'),
|
44
44
|
bottom: getOutlinePosition(options, 'bottom'),
|
45
45
|
left: getOutlinePosition(options, 'left')
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createFocusOutlineStyle.ts"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { shorthands } from '@griffel/react';\nimport type { GriffelStyle } from '@griffel/react';\nimport {\n createCustomFocusIndicatorStyle,\n CreateCustomFocusIndicatorStyleOptions,\n} from './createCustomFocusIndicatorStyle';\nimport { defaultOptions } from './constants';\n\nexport type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;\nexport type FocusOutlineStyleOptions = {\n /**\n * Only property not supported by the native CSS `outline`, if this is no longer needed\n * we can just go native instead\n */\n outlineRadius: string;\n outlineColor: string;\n outlineWidth: string;\n outlineOffset?: string | FocusOutlineOffset;\n};\nexport interface CreateFocusOutlineStyleOptions extends Omit<CreateCustomFocusIndicatorStyleOptions, 'enableOutline'> {\n style?: Partial<FocusOutlineStyleOptions>;\n\n /**\n * Enables the browser default outline style\n */\n enableOutline?: boolean;\n}\n\n/**\n * Get the position of the focus outline\n *\n * @param options - Configures the style of the focus outline\n * @param position - The position of the focus outline\n * @returns CSS value for the position of the focus outline\n */\nfunction getOutlinePosition(\n { outlineWidth, outlineOffset }: FocusOutlineStyleOptions,\n position: 'top' | 'bottom' | 'left' | 'right',\n) {\n const offsetValue = (outlineOffset as FocusOutlineOffset)?.[position] || outlineOffset;\n\n if (!outlineOffset) {\n return `calc(${outlineWidth} * -1)`;\n }\n\n return `calc(0px - ${outlineWidth} - ${offsetValue})`;\n}\n\n/**\n * NOTE: the element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configures the style of the focus outline\n * @returns focus outline styles object\n */\nconst getFocusOutlineStyles = (options: FocusOutlineStyleOptions): GriffelStyle => {\n const { outlineRadius, outlineColor, outlineWidth } = options;\n\n return {\n ...shorthands.borderColor('transparent'),\n '@media (forced-colors: active)': {\n '::after': {\n ...shorthands.borderColor('Highlight'),\n },\n },\n '::after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n zIndex: 1,\n\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(outlineWidth),\n ...shorthands.borderRadius(outlineRadius),\n ...shorthands.borderColor(outlineColor),\n\n top: getOutlinePosition(options, 'top'),\n right: getOutlinePosition(options, 'right'),\n bottom: getOutlinePosition(options, 'bottom'),\n left: getOutlinePosition(options, 'left'),\n },\n };\n};\n\n/**\n * NOTE: The element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configure the style of the focus outline\n * @returns focus outline styles object for @see makeStyles\n */\nexport const createFocusOutlineStyle = ({\n enableOutline = false,\n selector = defaultOptions.selector,\n customizeSelector,\n style = defaultOptions.style,\n}: CreateFocusOutlineStyleOptions = defaultOptions): GriffelStyle => ({\n ':focus': {\n outlineStyle: enableOutline ? undefined : 'none',\n },\n ':focus-visible': {\n outlineStyle: enableOutline ? undefined : 'none',\n },\n\n ...createCustomFocusIndicatorStyle(\n getFocusOutlineStyles({\n outlineColor: tokens.colorStrokeFocus2,\n outlineRadius: tokens.borderRadiusMedium,\n // FIXME: tokens.strokeWidthThick causes some weird bugs\n outlineWidth: '2px',\n ...style,\n }),\n { selector, customizeSelector },\n ),\n});\n"],"names":["tokens","shorthands","createCustomFocusIndicatorStyle","defaultOptions","getOutlinePosition","outlineWidth","outlineOffset","position","offsetValue","getFocusOutlineStyles","options","outlineRadius","outlineColor","borderColor","content","pointerEvents","zIndex","borderStyle","borderWidth","borderRadius","top","right","bottom","left","createFocusOutlineStyle","enableOutline","selector","customizeSelector","style","outlineStyle","undefined","colorStrokeFocus2","borderRadiusMedium"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,SACEC,+BAA+B,QAE1B,oCAAoC;AAC3C,SAASC,cAAc,QAAQ,cAAc;AAsB7C;;;;;;CAMC,GACD,SAASC,mBACP,EAAEC,YAAY,EAAEC,aAAa,EAA4B,EACzDC,QAA6C;IAE7C,MAAMC,cAAc,CAACF,0BAAAA,oCAAD,AAACA,aAAsC,CAACC,SAAS,KAAID;IAEzE,IAAI,CAACA,eAAe;QAClB,OAAO,CAAC,KAAK,EAAED,aAAa,MAAM,CAAC;IACrC;IAEA,OAAO,CAAC,WAAW,EAAEA,aAAa,GAAG,EAAEG,YAAY,CAAC,CAAC;AACvD;AAEA;;;;;;CAMC,GACD,MAAMC,wBAAwB,CAACC;IAC7B,MAAM,EAAEC,aAAa,EAAEC,YAAY,EAAEP,YAAY,EAAE,GAAGK;IAEtD,OAAO;QACL,GAAGT,WAAWY,WAAW,CAAC,cAAc;QACxC,kCAAkC;YAChC,WAAW;gBACT,GAAGZ,WAAWY,WAAW,CAAC,YAAY;YACxC;QACF;QACA,WAAW;YACTC,SAAS;YACTP,UAAU;YACVQ,eAAe;YACfC,QAAQ;YAER,GAAGf,WAAWgB,WAAW,CAAC,QAAQ;YAClC,GAAGhB,WAAWiB,WAAW,CAACb,aAAa;YACvC,GAAGJ,WAAWkB,YAAY,CAACR,cAAc;YACzC,GAAGV,WAAWY,WAAW,CAACD,aAAa;
|
1
|
+
{"version":3,"sources":["createFocusOutlineStyle.ts"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { shorthands } from '@griffel/react';\nimport type { GriffelStyle } from '@griffel/react';\nimport {\n createCustomFocusIndicatorStyle,\n CreateCustomFocusIndicatorStyleOptions,\n} from './createCustomFocusIndicatorStyle';\nimport { defaultOptions } from './constants';\n\nexport type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;\nexport type FocusOutlineStyleOptions = {\n /**\n * Only property not supported by the native CSS `outline`, if this is no longer needed\n * we can just go native instead\n */\n outlineRadius: string;\n outlineColor: string;\n outlineWidth: string;\n outlineOffset?: string | FocusOutlineOffset;\n};\nexport interface CreateFocusOutlineStyleOptions extends Omit<CreateCustomFocusIndicatorStyleOptions, 'enableOutline'> {\n style?: Partial<FocusOutlineStyleOptions>;\n\n /**\n * Enables the browser default outline style\n */\n enableOutline?: boolean;\n}\n\n/**\n * Get the position of the focus outline\n *\n * @param options - Configures the style of the focus outline\n * @param position - The position of the focus outline\n * @returns CSS value for the position of the focus outline\n */\nfunction getOutlinePosition(\n { outlineWidth, outlineOffset }: FocusOutlineStyleOptions,\n position: 'top' | 'bottom' | 'left' | 'right',\n) {\n const offsetValue = (outlineOffset as FocusOutlineOffset)?.[position] || outlineOffset;\n\n if (!outlineOffset) {\n return `calc(${outlineWidth} * -1)`;\n }\n\n return `calc(0px - ${outlineWidth} - ${offsetValue})`;\n}\n\n/**\n * NOTE: the element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configures the style of the focus outline\n * @returns focus outline styles object\n */\nconst getFocusOutlineStyles = (options: FocusOutlineStyleOptions): GriffelStyle => {\n const { outlineRadius, outlineColor, outlineWidth } = options;\n\n return {\n ...shorthands.borderColor('transparent'),\n '@media (forced-colors: active)': {\n '::after': {\n ...shorthands.borderColor('Highlight'),\n },\n },\n '::after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n zIndex: 1,\n\n /* eslint-disable deprecation/deprecation */\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(outlineWidth),\n ...shorthands.borderRadius(outlineRadius),\n ...shorthands.borderColor(outlineColor),\n /* eslint-enable deprecation/deprecation */\n\n top: getOutlinePosition(options, 'top'),\n right: getOutlinePosition(options, 'right'),\n bottom: getOutlinePosition(options, 'bottom'),\n left: getOutlinePosition(options, 'left'),\n },\n };\n};\n\n/**\n * NOTE: The element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configure the style of the focus outline\n * @returns focus outline styles object for @see makeStyles\n */\nexport const createFocusOutlineStyle = ({\n enableOutline = false,\n selector = defaultOptions.selector,\n customizeSelector,\n style = defaultOptions.style,\n}: CreateFocusOutlineStyleOptions = defaultOptions): GriffelStyle => ({\n ':focus': {\n outlineStyle: enableOutline ? undefined : 'none',\n },\n ':focus-visible': {\n outlineStyle: enableOutline ? undefined : 'none',\n },\n\n ...createCustomFocusIndicatorStyle(\n getFocusOutlineStyles({\n outlineColor: tokens.colorStrokeFocus2,\n outlineRadius: tokens.borderRadiusMedium,\n // FIXME: tokens.strokeWidthThick causes some weird bugs\n outlineWidth: '2px',\n ...style,\n }),\n { selector, customizeSelector },\n ),\n});\n"],"names":["tokens","shorthands","createCustomFocusIndicatorStyle","defaultOptions","getOutlinePosition","outlineWidth","outlineOffset","position","offsetValue","getFocusOutlineStyles","options","outlineRadius","outlineColor","borderColor","content","pointerEvents","zIndex","borderStyle","borderWidth","borderRadius","top","right","bottom","left","createFocusOutlineStyle","enableOutline","selector","customizeSelector","style","outlineStyle","undefined","colorStrokeFocus2","borderRadiusMedium"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,SACEC,+BAA+B,QAE1B,oCAAoC;AAC3C,SAASC,cAAc,QAAQ,cAAc;AAsB7C;;;;;;CAMC,GACD,SAASC,mBACP,EAAEC,YAAY,EAAEC,aAAa,EAA4B,EACzDC,QAA6C;IAE7C,MAAMC,cAAc,CAACF,0BAAAA,oCAAD,AAACA,aAAsC,CAACC,SAAS,KAAID;IAEzE,IAAI,CAACA,eAAe;QAClB,OAAO,CAAC,KAAK,EAAED,aAAa,MAAM,CAAC;IACrC;IAEA,OAAO,CAAC,WAAW,EAAEA,aAAa,GAAG,EAAEG,YAAY,CAAC,CAAC;AACvD;AAEA;;;;;;CAMC,GACD,MAAMC,wBAAwB,CAACC;IAC7B,MAAM,EAAEC,aAAa,EAAEC,YAAY,EAAEP,YAAY,EAAE,GAAGK;IAEtD,OAAO;QACL,GAAGT,WAAWY,WAAW,CAAC,cAAc;QACxC,kCAAkC;YAChC,WAAW;gBACT,GAAGZ,WAAWY,WAAW,CAAC,YAAY;YACxC;QACF;QACA,WAAW;YACTC,SAAS;YACTP,UAAU;YACVQ,eAAe;YACfC,QAAQ;YAER,0CAA0C,GAC1C,GAAGf,WAAWgB,WAAW,CAAC,QAAQ;YAClC,GAAGhB,WAAWiB,WAAW,CAACb,aAAa;YACvC,GAAGJ,WAAWkB,YAAY,CAACR,cAAc;YACzC,GAAGV,WAAWY,WAAW,CAACD,aAAa;YACvC,yCAAyC,GAEzCQ,KAAKhB,mBAAmBM,SAAS;YACjCW,OAAOjB,mBAAmBM,SAAS;YACnCY,QAAQlB,mBAAmBM,SAAS;YACpCa,MAAMnB,mBAAmBM,SAAS;QACpC;IACF;AACF;AAEA;;;;;;CAMC,GACD,OAAO,MAAMc,0BAA0B,CAAC,EACtCC,gBAAgB,KAAK,EACrBC,WAAWvB,eAAeuB,QAAQ,EAClCC,iBAAiB,EACjBC,QAAQzB,eAAeyB,KAAK,EACG,GAAGzB,cAAc,GAAoB,CAAA;QACpE,UAAU;YACR0B,cAAcJ,gBAAgBK,YAAY;QAC5C;QACA,kBAAkB;YAChBD,cAAcJ,gBAAgBK,YAAY;QAC5C;QAEA,GAAG5B,gCACDO,sBAAsB;YACpBG,cAAcZ,OAAO+B,iBAAiB;YACtCpB,eAAeX,OAAOgC,kBAAkB;YACxC,wDAAwD;YACxD3B,cAAc;YACd,GAAGuB,KAAK;QACV,IACA;YAAEF;YAAUC;QAAkB,EAC/B;IACH,CAAA,EAAG"}
|
@@ -5,15 +5,20 @@ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts
|
|
5
5
|
* @internal
|
6
6
|
* Instantiates [keyborg](https://github.com/microsoft/keyborg)
|
7
7
|
* @returns - keyborg instance
|
8
|
-
*/ export function
|
8
|
+
*/ export function useKeyborgRef() {
|
9
9
|
const { targetDocument } = useFluent();
|
10
|
-
const
|
11
|
-
targetDocument
|
12
|
-
]);
|
10
|
+
const keyborgRef = React.useRef(null);
|
13
11
|
React.useEffect(()=>{
|
14
|
-
|
12
|
+
if (targetDocument) {
|
13
|
+
const keyborg = createKeyborg(targetDocument.defaultView);
|
14
|
+
keyborgRef.current = keyborg;
|
15
|
+
return ()=>{
|
16
|
+
disposeKeyborg(keyborg);
|
17
|
+
keyborgRef.current = null;
|
18
|
+
};
|
19
|
+
}
|
15
20
|
}, [
|
16
|
-
|
21
|
+
targetDocument
|
17
22
|
]);
|
18
|
-
return
|
23
|
+
return keyborgRef;
|
19
24
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useKeyborgRef.ts"],"sourcesContent":["import * as React from 'react';\nimport { createKeyborg, disposeKeyborg, type Keyborg } from 'keyborg';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * @internal\n * Instantiates [keyborg](https://github.com/microsoft/keyborg)\n * @returns - keyborg instance\n */\nexport function useKeyborgRef() {\n const { targetDocument } = useFluent();\n const keyborgRef = React.useRef<Keyborg | null>(null);\n\n React.useEffect(() => {\n if (targetDocument) {\n const keyborg = createKeyborg(targetDocument.defaultView!);\n keyborgRef.current = keyborg;\n\n return () => {\n disposeKeyborg(keyborg);\n keyborgRef.current = null;\n };\n }\n }, [targetDocument]);\n\n return keyborgRef;\n}\n"],"names":["React","createKeyborg","disposeKeyborg","useFluent_unstable","useFluent","useKeyborgRef","targetDocument","keyborgRef","useRef","useEffect","keyborg","defaultView","current"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAEC,cAAc,QAAsB,UAAU;AACtE,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF;;;;CAIC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,cAAc,EAAE,GAAGF;IAC3B,MAAMG,aAAaP,MAAMQ,MAAM,CAAiB;IAEhDR,MAAMS,SAAS,CAAC;QACd,IAAIH,gBAAgB;YAClB,MAAMI,UAAUT,cAAcK,eAAeK,WAAW;YACxDJ,WAAWK,OAAO,GAAGF;YAErB,OAAO;gBACLR,eAAeQ;gBACfH,WAAWK,OAAO,GAAG;YACvB;QACF;IACF,GAAG;QAACN;KAAe;IAEnB,OAAOC;AACT"}
|
@@ -1,25 +1,28 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { useEventCallback } from '@fluentui/react-utilities';
|
3
|
-
import {
|
3
|
+
import { useKeyborgRef } from './useKeyborgRef';
|
4
4
|
/**
|
5
5
|
* Instantiates [keyborg](https://github.com/microsoft/keyborg) and subscribes to changes
|
6
6
|
* in the keyboard navigation mode.
|
7
7
|
*
|
8
8
|
* @param callback - called every time the keyboard navigation state changes
|
9
9
|
*/ export function useOnKeyboardNavigationChange(callback) {
|
10
|
-
const
|
10
|
+
const keyborgRef = useKeyborgRef();
|
11
11
|
const eventCallback = useEventCallback(callback);
|
12
12
|
React.useEffect(()=>{
|
13
|
+
const keyborg = keyborgRef.current;
|
13
14
|
if (keyborg) {
|
14
15
|
const cb = (next)=>{
|
15
16
|
eventCallback(next);
|
16
17
|
};
|
17
18
|
keyborg.subscribe(cb);
|
18
19
|
cb(keyborg.isNavigatingWithKeyboard());
|
19
|
-
return ()=>
|
20
|
+
return ()=>{
|
21
|
+
keyborg.unsubscribe(cb);
|
22
|
+
};
|
20
23
|
}
|
21
24
|
}, [
|
22
|
-
|
25
|
+
keyborgRef,
|
23
26
|
eventCallback
|
24
27
|
]);
|
25
28
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOnKeyboardNavigationChange.ts"],"sourcesContent":["import
|
1
|
+
{"version":3,"sources":["useOnKeyboardNavigationChange.ts"],"sourcesContent":["import type { KeyborgCallback } from 'keyborg';\nimport * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\n\nimport { useKeyborgRef } from './useKeyborgRef';\n\n/**\n * Instantiates [keyborg](https://github.com/microsoft/keyborg) and subscribes to changes\n * in the keyboard navigation mode.\n *\n * @param callback - called every time the keyboard navigation state changes\n */\nexport function useOnKeyboardNavigationChange(callback: (isNavigatingWithKeyboard: boolean) => void) {\n const keyborgRef = useKeyborgRef();\n const eventCallback = useEventCallback(callback);\n\n React.useEffect(() => {\n const keyborg = keyborgRef.current;\n\n if (keyborg) {\n const cb: KeyborgCallback = next => {\n eventCallback(next);\n };\n\n keyborg.subscribe(cb);\n cb(keyborg.isNavigatingWithKeyboard());\n\n return () => {\n keyborg.unsubscribe(cb);\n };\n }\n }, [keyborgRef, eventCallback]);\n}\n"],"names":["React","useEventCallback","useKeyborgRef","useOnKeyboardNavigationChange","callback","keyborgRef","eventCallback","useEffect","keyborg","current","cb","next","subscribe","isNavigatingWithKeyboard","unsubscribe"],"mappings":"AACA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ,4BAA4B;AAE7D,SAASC,aAAa,QAAQ,kBAAkB;AAEhD;;;;;CAKC,GACD,OAAO,SAASC,8BAA8BC,QAAqD;IACjG,MAAMC,aAAaH;IACnB,MAAMI,gBAAgBL,iBAAiBG;IAEvCJ,MAAMO,SAAS,CAAC;QACd,MAAMC,UAAUH,WAAWI,OAAO;QAElC,IAAID,SAAS;YACX,MAAME,KAAsBC,CAAAA;gBAC1BL,cAAcK;YAChB;YAEAH,QAAQI,SAAS,CAACF;YAClBA,GAAGF,QAAQK,wBAAwB;YAEnC,OAAO;gBACLL,QAAQM,WAAW,CAACJ;YACtB;QACF;IACF,GAAG;QAACL;QAAYC;KAAc;AAChC"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import {
|
2
|
+
import { useKeyborgRef } from './useKeyborgRef';
|
3
3
|
/**
|
4
4
|
*/ export function useSetKeyboardNavigation() {
|
5
|
-
const
|
5
|
+
const keyborgRef = useKeyborgRef();
|
6
6
|
return React.useCallback((isNavigatingWithKeyboard)=>{
|
7
|
-
|
7
|
+
var _keyborgRef_current;
|
8
|
+
(_keyborgRef_current = keyborgRef.current) === null || _keyborgRef_current === void 0 ? void 0 : _keyborgRef_current.setVal(isNavigatingWithKeyboard);
|
8
9
|
}, [
|
9
|
-
|
10
|
+
keyborgRef
|
10
11
|
]);
|
11
12
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useSetKeyboardNavigation.ts"],"sourcesContent":["import * as React from 'react';\nimport {
|
1
|
+
{"version":3,"sources":["useSetKeyboardNavigation.ts"],"sourcesContent":["import * as React from 'react';\nimport { useKeyborgRef } from './useKeyborgRef';\n\n/**\n */\nexport function useSetKeyboardNavigation() {\n const keyborgRef = useKeyborgRef();\n\n return React.useCallback(\n (isNavigatingWithKeyboard: boolean) => {\n keyborgRef.current?.setVal(isNavigatingWithKeyboard);\n },\n [keyborgRef],\n );\n}\n"],"names":["React","useKeyborgRef","useSetKeyboardNavigation","keyborgRef","useCallback","isNavigatingWithKeyboard","current","setVal"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,QAAQ,kBAAkB;AAEhD;CACC,GACD,OAAO,SAASC;IACd,MAAMC,aAAaF;IAEnB,OAAOD,MAAMI,WAAW,CACtB,CAACC;YACCF;SAAAA,sBAAAA,WAAWG,OAAO,cAAlBH,0CAAAA,oBAAoBI,MAAM,CAACF;IAC7B,GACA;QAACF;KAAW;AAEhB"}
|
@@ -45,11 +45,11 @@ const _constants = require("./constants");
|
|
45
45
|
position: 'absolute',
|
46
46
|
pointerEvents: 'none',
|
47
47
|
zIndex: 1,
|
48
|
-
..._react.shorthands.borderStyle('solid'),
|
48
|
+
/* eslint-disable deprecation/deprecation */ ..._react.shorthands.borderStyle('solid'),
|
49
49
|
..._react.shorthands.borderWidth(outlineWidth),
|
50
50
|
..._react.shorthands.borderRadius(outlineRadius),
|
51
51
|
..._react.shorthands.borderColor(outlineColor),
|
52
|
-
top: getOutlinePosition(options, 'top'),
|
52
|
+
/* eslint-enable deprecation/deprecation */ top: getOutlinePosition(options, 'top'),
|
53
53
|
right: getOutlinePosition(options, 'right'),
|
54
54
|
bottom: getOutlinePosition(options, 'bottom'),
|
55
55
|
left: getOutlinePosition(options, 'left')
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createFocusOutlineStyle.js"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { shorthands } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from './createCustomFocusIndicatorStyle';\nimport { defaultOptions } from './constants';\n/**\n * Get the position of the focus outline\n *\n * @param options - Configures the style of the focus outline\n * @param position - The position of the focus outline\n * @returns CSS value for the position of the focus outline\n */ function getOutlinePosition({ outlineWidth, outlineOffset }, position) {\n const offsetValue = (outlineOffset === null || outlineOffset === void 0 ? void 0 : outlineOffset[position]) || outlineOffset;\n if (!outlineOffset) {\n return `calc(${outlineWidth} * -1)`;\n }\n return `calc(0px - ${outlineWidth} - ${offsetValue})`;\n}\n/**\n * NOTE: the element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configures the style of the focus outline\n * @returns focus outline styles object\n */ const getFocusOutlineStyles = (options)=>{\n const { outlineRadius, outlineColor, outlineWidth } = options;\n return {\n ...shorthands.borderColor('transparent'),\n '@media (forced-colors: active)': {\n '::after': {\n ...shorthands.borderColor('Highlight')\n }\n },\n '::after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n zIndex: 1,\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(outlineWidth),\n ...shorthands.borderRadius(outlineRadius),\n ...shorthands.borderColor(outlineColor),\n top: getOutlinePosition(options, 'top'),\n right: getOutlinePosition(options, 'right'),\n bottom: getOutlinePosition(options, 'bottom'),\n left: getOutlinePosition(options, 'left')\n }\n };\n};\n/**\n * NOTE: The element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configure the style of the focus outline\n * @returns focus outline styles object for @see makeStyles\n */ export const createFocusOutlineStyle = ({ enableOutline = false, selector = defaultOptions.selector, customizeSelector, style = defaultOptions.style } = defaultOptions)=>({\n ':focus': {\n outlineStyle: enableOutline ? undefined : 'none'\n },\n ':focus-visible': {\n outlineStyle: enableOutline ? undefined : 'none'\n },\n ...createCustomFocusIndicatorStyle(getFocusOutlineStyles({\n outlineColor: tokens.colorStrokeFocus2,\n outlineRadius: tokens.borderRadiusMedium,\n // FIXME: tokens.strokeWidthThick causes some weird bugs\n outlineWidth: '2px',\n ...style\n }), {\n selector,\n customizeSelector\n })\n });\n"],"names":["createFocusOutlineStyle","getOutlinePosition","outlineWidth","outlineOffset","position","offsetValue","getFocusOutlineStyles","options","outlineRadius","outlineColor","shorthands","borderColor","content","pointerEvents","zIndex","borderStyle","borderWidth","borderRadius","top","right","bottom","left","enableOutline","selector","defaultOptions","customizeSelector","style","outlineStyle","undefined","createCustomFocusIndicatorStyle","tokens","colorStrokeFocus2","borderRadiusMedium"],"mappings":";;;;+BAsDiBA;;;eAAAA;;;4BAtDM;uBACI;iDACqB;2BACjB;AAC/B;;;;;;CAMC,GAAG,SAASC,mBAAmB,EAAEC,YAAY,EAAEC,aAAa,EAAE,EAAEC,QAAQ;IACrE,MAAMC,cAAc,AAACF,CAAAA,kBAAkB,QAAQA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,aAAa,CAACC,SAAS,AAAD,KAAMD;IAC/G,IAAI,CAACA,eAAe;QAChB,OAAO,CAAC,KAAK,EAAED,aAAa,MAAM,CAAC;IACvC;IACA,OAAO,CAAC,WAAW,EAAEA,aAAa,GAAG,EAAEG,YAAY,CAAC,CAAC;AACzD;AACA;;;;;;CAMC,GAAG,MAAMC,wBAAwB,CAACC;IAC/B,MAAM,EAAEC,aAAa,EAAEC,YAAY,EAAEP,YAAY,EAAE,GAAGK;IACtD,OAAO;QACH,GAAGG,iBAAU,CAACC,WAAW,CAAC,cAAc;QACxC,kCAAkC;YAC9B,WAAW;gBACP,GAAGD,iBAAU,CAACC,WAAW,CAAC,YAAY;YAC1C;QACJ;QACA,WAAW;YACPC,SAAS;YACTR,UAAU;YACVS,eAAe;YACfC,QAAQ;YACR,GAAGJ,iBAAU,CAACK,WAAW,CAAC,QAAQ;
|
1
|
+
{"version":3,"sources":["createFocusOutlineStyle.js"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { shorthands } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from './createCustomFocusIndicatorStyle';\nimport { defaultOptions } from './constants';\n/**\n * Get the position of the focus outline\n *\n * @param options - Configures the style of the focus outline\n * @param position - The position of the focus outline\n * @returns CSS value for the position of the focus outline\n */ function getOutlinePosition({ outlineWidth, outlineOffset }, position) {\n const offsetValue = (outlineOffset === null || outlineOffset === void 0 ? void 0 : outlineOffset[position]) || outlineOffset;\n if (!outlineOffset) {\n return `calc(${outlineWidth} * -1)`;\n }\n return `calc(0px - ${outlineWidth} - ${offsetValue})`;\n}\n/**\n * NOTE: the element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configures the style of the focus outline\n * @returns focus outline styles object\n */ const getFocusOutlineStyles = (options)=>{\n const { outlineRadius, outlineColor, outlineWidth } = options;\n return {\n ...shorthands.borderColor('transparent'),\n '@media (forced-colors: active)': {\n '::after': {\n ...shorthands.borderColor('Highlight')\n }\n },\n '::after': {\n content: '\"\"',\n position: 'absolute',\n pointerEvents: 'none',\n zIndex: 1,\n /* eslint-disable deprecation/deprecation */ ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(outlineWidth),\n ...shorthands.borderRadius(outlineRadius),\n ...shorthands.borderColor(outlineColor),\n /* eslint-enable deprecation/deprecation */ top: getOutlinePosition(options, 'top'),\n right: getOutlinePosition(options, 'right'),\n bottom: getOutlinePosition(options, 'bottom'),\n left: getOutlinePosition(options, 'left')\n }\n };\n};\n/**\n * NOTE: The element with the focus outline needs to have `position: relative` so that the\n * pseudo element can be properly positioned.\n *\n * @param options - Configure the style of the focus outline\n * @returns focus outline styles object for @see makeStyles\n */ export const createFocusOutlineStyle = ({ enableOutline = false, selector = defaultOptions.selector, customizeSelector, style = defaultOptions.style } = defaultOptions)=>({\n ':focus': {\n outlineStyle: enableOutline ? undefined : 'none'\n },\n ':focus-visible': {\n outlineStyle: enableOutline ? undefined : 'none'\n },\n ...createCustomFocusIndicatorStyle(getFocusOutlineStyles({\n outlineColor: tokens.colorStrokeFocus2,\n outlineRadius: tokens.borderRadiusMedium,\n // FIXME: tokens.strokeWidthThick causes some weird bugs\n outlineWidth: '2px',\n ...style\n }), {\n selector,\n customizeSelector\n })\n });\n"],"names":["createFocusOutlineStyle","getOutlinePosition","outlineWidth","outlineOffset","position","offsetValue","getFocusOutlineStyles","options","outlineRadius","outlineColor","shorthands","borderColor","content","pointerEvents","zIndex","borderStyle","borderWidth","borderRadius","top","right","bottom","left","enableOutline","selector","defaultOptions","customizeSelector","style","outlineStyle","undefined","createCustomFocusIndicatorStyle","tokens","colorStrokeFocus2","borderRadiusMedium"],"mappings":";;;;+BAsDiBA;;;eAAAA;;;4BAtDM;uBACI;iDACqB;2BACjB;AAC/B;;;;;;CAMC,GAAG,SAASC,mBAAmB,EAAEC,YAAY,EAAEC,aAAa,EAAE,EAAEC,QAAQ;IACrE,MAAMC,cAAc,AAACF,CAAAA,kBAAkB,QAAQA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,aAAa,CAACC,SAAS,AAAD,KAAMD;IAC/G,IAAI,CAACA,eAAe;QAChB,OAAO,CAAC,KAAK,EAAED,aAAa,MAAM,CAAC;IACvC;IACA,OAAO,CAAC,WAAW,EAAEA,aAAa,GAAG,EAAEG,YAAY,CAAC,CAAC;AACzD;AACA;;;;;;CAMC,GAAG,MAAMC,wBAAwB,CAACC;IAC/B,MAAM,EAAEC,aAAa,EAAEC,YAAY,EAAEP,YAAY,EAAE,GAAGK;IACtD,OAAO;QACH,GAAGG,iBAAU,CAACC,WAAW,CAAC,cAAc;QACxC,kCAAkC;YAC9B,WAAW;gBACP,GAAGD,iBAAU,CAACC,WAAW,CAAC,YAAY;YAC1C;QACJ;QACA,WAAW;YACPC,SAAS;YACTR,UAAU;YACVS,eAAe;YACfC,QAAQ;YACR,0CAA0C,GAAG,GAAGJ,iBAAU,CAACK,WAAW,CAAC,QAAQ;YAC/E,GAAGL,iBAAU,CAACM,WAAW,CAACd,aAAa;YACvC,GAAGQ,iBAAU,CAACO,YAAY,CAACT,cAAc;YACzC,GAAGE,iBAAU,CAACC,WAAW,CAACF,aAAa;YACvC,yCAAyC,GAAGS,KAAKjB,mBAAmBM,SAAS;YAC7EY,OAAOlB,mBAAmBM,SAAS;YACnCa,QAAQnB,mBAAmBM,SAAS;YACpCc,MAAMpB,mBAAmBM,SAAS;QACtC;IACJ;AACJ;AAOW,MAAMP,0BAA0B,CAAC,EAAEsB,gBAAgB,KAAK,EAAEC,WAAWC,yBAAc,CAACD,QAAQ,EAAEE,iBAAiB,EAAEC,QAAQF,yBAAc,CAACE,KAAK,EAAE,GAAGF,yBAAc,GAAI,CAAA;QACvK,UAAU;YACNG,cAAcL,gBAAgBM,YAAY;QAC9C;QACA,kBAAkB;YACdD,cAAcL,gBAAgBM,YAAY;QAC9C;QACA,GAAGC,IAAAA,gEAA+B,EAACvB,sBAAsB;YACrDG,cAAcqB,kBAAM,CAACC,iBAAiB;YACtCvB,eAAesB,kBAAM,CAACE,kBAAkB;YACxC,wDAAwD;YACxD9B,cAAc;YACd,GAAGwB,KAAK;QACZ,IAAI;YACAH;YACAE;QACJ,EAAE;IACN,CAAA"}
|
@@ -2,25 +2,30 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
Object.defineProperty(exports, "
|
5
|
+
Object.defineProperty(exports, "useKeyborgRef", {
|
6
6
|
enumerable: true,
|
7
7
|
get: function() {
|
8
|
-
return
|
8
|
+
return useKeyborgRef;
|
9
9
|
}
|
10
10
|
});
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
13
|
const _keyborg = require("keyborg");
|
14
14
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
15
|
-
function
|
15
|
+
function useKeyborgRef() {
|
16
16
|
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
17
|
-
const
|
18
|
-
targetDocument
|
19
|
-
]);
|
17
|
+
const keyborgRef = _react.useRef(null);
|
20
18
|
_react.useEffect(()=>{
|
21
|
-
|
19
|
+
if (targetDocument) {
|
20
|
+
const keyborg = (0, _keyborg.createKeyborg)(targetDocument.defaultView);
|
21
|
+
keyborgRef.current = keyborg;
|
22
|
+
return ()=>{
|
23
|
+
(0, _keyborg.disposeKeyborg)(keyborg);
|
24
|
+
keyborgRef.current = null;
|
25
|
+
};
|
26
|
+
}
|
22
27
|
}, [
|
23
|
-
|
28
|
+
targetDocument
|
24
29
|
]);
|
25
|
-
return
|
30
|
+
return keyborgRef;
|
26
31
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useKeyborgRef.js"],"sourcesContent":["import * as React from 'react';\nimport { createKeyborg, disposeKeyborg } from 'keyborg';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n/**\n * @internal\n * Instantiates [keyborg](https://github.com/microsoft/keyborg)\n * @returns - keyborg instance\n */ export function useKeyborgRef() {\n const { targetDocument } = useFluent();\n const keyborgRef = React.useRef(null);\n React.useEffect(()=>{\n if (targetDocument) {\n const keyborg = createKeyborg(targetDocument.defaultView);\n keyborgRef.current = keyborg;\n return ()=>{\n disposeKeyborg(keyborg);\n keyborgRef.current = null;\n };\n }\n }, [\n targetDocument\n ]);\n return keyborgRef;\n}\n"],"names":["useKeyborgRef","targetDocument","useFluent","keyborgRef","React","useRef","useEffect","keyborg","createKeyborg","defaultView","current","disposeKeyborg"],"mappings":";;;;+BAOoBA;;;eAAAA;;;;iEAPG;yBACuB;qCACE;AAKrC,SAASA;IAChB,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,aAAaC,OAAMC,MAAM,CAAC;IAChCD,OAAME,SAAS,CAAC;QACZ,IAAIL,gBAAgB;YAChB,MAAMM,UAAUC,IAAAA,sBAAa,EAACP,eAAeQ,WAAW;YACxDN,WAAWO,OAAO,GAAGH;YACrB,OAAO;gBACHI,IAAAA,uBAAc,EAACJ;gBACfJ,WAAWO,OAAO,GAAG;YACzB;QACJ;IACJ,GAAG;QACCT;KACH;IACD,OAAOE;AACX"}
|
@@ -11,21 +11,24 @@ Object.defineProperty(exports, "useOnKeyboardNavigationChange", {
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
13
|
const _reactutilities = require("@fluentui/react-utilities");
|
14
|
-
const
|
14
|
+
const _useKeyborgRef = require("./useKeyborgRef");
|
15
15
|
function useOnKeyboardNavigationChange(callback) {
|
16
|
-
const
|
16
|
+
const keyborgRef = (0, _useKeyborgRef.useKeyborgRef)();
|
17
17
|
const eventCallback = (0, _reactutilities.useEventCallback)(callback);
|
18
18
|
_react.useEffect(()=>{
|
19
|
+
const keyborg = keyborgRef.current;
|
19
20
|
if (keyborg) {
|
20
21
|
const cb = (next)=>{
|
21
22
|
eventCallback(next);
|
22
23
|
};
|
23
24
|
keyborg.subscribe(cb);
|
24
25
|
cb(keyborg.isNavigatingWithKeyboard());
|
25
|
-
return ()=>
|
26
|
+
return ()=>{
|
27
|
+
keyborg.unsubscribe(cb);
|
28
|
+
};
|
26
29
|
}
|
27
30
|
}, [
|
28
|
-
|
31
|
+
keyborgRef,
|
29
32
|
eventCallback
|
30
33
|
]);
|
31
34
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOnKeyboardNavigationChange.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport {
|
1
|
+
{"version":3,"sources":["useOnKeyboardNavigationChange.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useKeyborgRef } from './useKeyborgRef';\n/**\n * Instantiates [keyborg](https://github.com/microsoft/keyborg) and subscribes to changes\n * in the keyboard navigation mode.\n *\n * @param callback - called every time the keyboard navigation state changes\n */ export function useOnKeyboardNavigationChange(callback) {\n const keyborgRef = useKeyborgRef();\n const eventCallback = useEventCallback(callback);\n React.useEffect(()=>{\n const keyborg = keyborgRef.current;\n if (keyborg) {\n const cb = (next)=>{\n eventCallback(next);\n };\n keyborg.subscribe(cb);\n cb(keyborg.isNavigatingWithKeyboard());\n return ()=>{\n keyborg.unsubscribe(cb);\n };\n }\n }, [\n keyborgRef,\n eventCallback\n ]);\n}\n"],"names":["useOnKeyboardNavigationChange","callback","keyborgRef","useKeyborgRef","eventCallback","useEventCallback","React","useEffect","keyborg","current","cb","next","subscribe","isNavigatingWithKeyboard","unsubscribe"],"mappings":";;;;+BAQoBA;;;eAAAA;;;;iEARG;gCACU;+BACH;AAMnB,SAASA,8BAA8BC,QAAQ;IACtD,MAAMC,aAAaC,IAAAA,4BAAa;IAChC,MAAMC,gBAAgBC,IAAAA,gCAAgB,EAACJ;IACvCK,OAAMC,SAAS,CAAC;QACZ,MAAMC,UAAUN,WAAWO,OAAO;QAClC,IAAID,SAAS;YACT,MAAME,KAAK,CAACC;gBACRP,cAAcO;YAClB;YACAH,QAAQI,SAAS,CAACF;YAClBA,GAAGF,QAAQK,wBAAwB;YACnC,OAAO;gBACHL,QAAQM,WAAW,CAACJ;YACxB;QACJ;IACJ,GAAG;QACCR;QACAE;KACH;AACL"}
|
@@ -10,12 +10,13 @@ Object.defineProperty(exports, "useSetKeyboardNavigation", {
|
|
10
10
|
});
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
|
-
const
|
13
|
+
const _useKeyborgRef = require("./useKeyborgRef");
|
14
14
|
function useSetKeyboardNavigation() {
|
15
|
-
const
|
15
|
+
const keyborgRef = (0, _useKeyborgRef.useKeyborgRef)();
|
16
16
|
return _react.useCallback((isNavigatingWithKeyboard)=>{
|
17
|
-
|
17
|
+
var _keyborgRef_current;
|
18
|
+
(_keyborgRef_current = keyborgRef.current) === null || _keyborgRef_current === void 0 ? void 0 : _keyborgRef_current.setVal(isNavigatingWithKeyboard);
|
18
19
|
}, [
|
19
|
-
|
20
|
+
keyborgRef
|
20
21
|
]);
|
21
22
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useSetKeyboardNavigation.js"],"sourcesContent":["import * as React from 'react';\nimport {
|
1
|
+
{"version":3,"sources":["useSetKeyboardNavigation.js"],"sourcesContent":["import * as React from 'react';\nimport { useKeyborgRef } from './useKeyborgRef';\n/**\n */ export function useSetKeyboardNavigation() {\n const keyborgRef = useKeyborgRef();\n return React.useCallback((isNavigatingWithKeyboard)=>{\n var _keyborgRef_current;\n (_keyborgRef_current = keyborgRef.current) === null || _keyborgRef_current === void 0 ? void 0 : _keyborgRef_current.setVal(isNavigatingWithKeyboard);\n }, [\n keyborgRef\n ]);\n}\n"],"names":["useSetKeyboardNavigation","keyborgRef","useKeyborgRef","React","useCallback","isNavigatingWithKeyboard","_keyborgRef_current","current","setVal"],"mappings":";;;;+BAGoBA;;;eAAAA;;;;iEAHG;+BACO;AAEnB,SAASA;IAChB,MAAMC,aAAaC,IAAAA,4BAAa;IAChC,OAAOC,OAAMC,WAAW,CAAC,CAACC;QACtB,IAAIC;QACHA,CAAAA,sBAAsBL,WAAWM,OAAO,AAAD,MAAO,QAAQD,wBAAwB,KAAK,IAAI,KAAK,IAAIA,oBAAoBE,MAAM,CAACH;IAChI,GAAG;QACCJ;KACH;AACL"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tabster",
|
3
|
-
"version": "9.21.
|
3
|
+
"version": "9.21.3",
|
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,10 +31,10 @@
|
|
31
31
|
"@fluentui/scripts-tasks": "*"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"@fluentui/react-shared-contexts": "^9.
|
34
|
+
"@fluentui/react-shared-contexts": "^9.19.0",
|
35
35
|
"@fluentui/react-theme": "^9.1.19",
|
36
|
-
"@fluentui/react-utilities": "^9.18.
|
37
|
-
"@griffel/react": "^1.5.
|
36
|
+
"@fluentui/react-utilities": "^9.18.9",
|
37
|
+
"@griffel/react": "^1.5.22",
|
38
38
|
"@swc/helpers": "^0.5.1",
|
39
39
|
"keyborg": "^2.6.0",
|
40
40
|
"tabster": "^7.1.2"
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["useKeyborg.ts"],"sourcesContent":["import * as React from 'react';\nimport { createKeyborg, disposeKeyborg } from 'keyborg';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * @internal\n * Instantiates [keyborg](https://github.com/microsoft/keyborg)\n * @returns - keyborg instance\n */\nexport function useKeyborg() {\n const { targetDocument } = useFluent();\n const keyborg = React.useMemo(() => targetDocument && createKeyborg(targetDocument.defaultView!), [targetDocument]);\n\n React.useEffect(() => {\n return () => keyborg && disposeKeyborg(keyborg);\n }, [keyborg]);\n\n return keyborg;\n}\n"],"names":["React","createKeyborg","disposeKeyborg","useFluent_unstable","useFluent","useKeyborg","targetDocument","keyborg","useMemo","defaultView","useEffect"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,aAAa,EAAEC,cAAc,QAAQ,UAAU;AACxD,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF;;;;CAIC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,cAAc,EAAE,GAAGF;IAC3B,MAAMG,UAAUP,MAAMQ,OAAO,CAAC,IAAMF,kBAAkBL,cAAcK,eAAeG,WAAW,GAAI;QAACH;KAAe;IAElHN,MAAMU,SAAS,CAAC;QACd,OAAO,IAAMH,WAAWL,eAAeK;IACzC,GAAG;QAACA;KAAQ;IAEZ,OAAOA;AACT"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["useKeyborg.js"],"sourcesContent":["import * as React from 'react';\nimport { createKeyborg, disposeKeyborg } from 'keyborg';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n/**\n * @internal\n * Instantiates [keyborg](https://github.com/microsoft/keyborg)\n * @returns - keyborg instance\n */ export function useKeyborg() {\n const { targetDocument } = useFluent();\n const keyborg = React.useMemo(()=>targetDocument && createKeyborg(targetDocument.defaultView), [\n targetDocument\n ]);\n React.useEffect(()=>{\n return ()=>keyborg && disposeKeyborg(keyborg);\n }, [\n keyborg\n ]);\n return keyborg;\n}\n"],"names":["useKeyborg","targetDocument","useFluent","keyborg","React","useMemo","createKeyborg","defaultView","useEffect","disposeKeyborg"],"mappings":";;;;+BAOoBA;;;eAAAA;;;;iEAPG;yBACuB;qCACE;AAKrC,SAASA;IAChB,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAMC,UAAUC,OAAMC,OAAO,CAAC,IAAIJ,kBAAkBK,IAAAA,sBAAa,EAACL,eAAeM,WAAW,GAAG;QAC3FN;KACH;IACDG,OAAMI,SAAS,CAAC;QACZ,OAAO,IAAIL,WAAWM,IAAAA,uBAAc,EAACN;IACzC,GAAG;QACCA;KACH;IACD,OAAOA;AACX"}
|