@fluentui/react-tabster 0.0.0-nightly-20230627-0414.1 → 0.0.0-nightly-20230703-0415.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +47 -9
- package/CHANGELOG.md +25 -7
- package/dist/index.d.ts +16 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useFocusObserved.js +25 -0
- package/lib/hooks/useFocusObserved.js.map +1 -0
- package/lib/hooks/useFocusVisible.js +2 -2
- package/lib/hooks/useFocusVisible.js.map +1 -1
- package/lib/hooks/useObservedElement.js +16 -0
- package/lib/hooks/useObservedElement.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/hooks/index.js +2 -0
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useFocusObserved.js +30 -0
- package/lib-commonjs/hooks/useFocusObserved.js.map +1 -0
- package/lib-commonjs/hooks/useFocusVisible.js +2 -2
- package/lib-commonjs/hooks/useFocusVisible.js.map +1 -1
- package/lib-commonjs/hooks/useObservedElement.js +24 -0
- package/lib-commonjs/hooks/useObservedElement.js.map +1 -0
- package/lib-commonjs/index.js +2 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-tabster",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-tabster_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Mon, 03 Jul 2023 04:22:10 GMT",
|
6
|
+
"tag": "@fluentui/react-tabster_v0.0.0-nightly-20230703-0415.1",
|
7
|
+
"version": "0.0.0-nightly-20230703-0415.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,20 +16,58 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-tabster",
|
19
|
-
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230703-0415.1",
|
20
|
+
"commit": "d923e322c01699d8e3055246caefabba09153ac9"
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"author": "beachball",
|
24
24
|
"package": "@fluentui/react-tabster",
|
25
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
26
|
-
"commit": "
|
25
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230703-0415.1",
|
26
|
+
"commit": "d923e322c01699d8e3055246caefabba09153ac9"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"author": "beachball",
|
30
30
|
"package": "@fluentui/react-tabster",
|
31
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
32
|
-
"commit": "
|
31
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230703-0415.1",
|
32
|
+
"commit": "d923e322c01699d8e3055246caefabba09153ac9"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"date": "Wed, 28 Jun 2023 11:12:33 GMT",
|
39
|
+
"tag": "@fluentui/react-tabster_v9.9.1",
|
40
|
+
"version": "9.9.1",
|
41
|
+
"comments": {
|
42
|
+
"none": [
|
43
|
+
{
|
44
|
+
"author": "martinhochel@microsoft.com",
|
45
|
+
"package": "@fluentui/react-tabster",
|
46
|
+
"commit": "fbe878e9c9785588197481f172c42c2c0a230292",
|
47
|
+
"comment": "fix: update .npmignore to unify v8 packages and exclude project.json"
|
48
|
+
}
|
49
|
+
],
|
50
|
+
"patch": [
|
51
|
+
{
|
52
|
+
"author": "beachball",
|
53
|
+
"package": "@fluentui/react-tabster",
|
54
|
+
"comment": "Bump @fluentui/react-utilities to v9.10.0",
|
55
|
+
"commit": "08de131d5f3346e001dcd8d2f0f3809c698f16d7"
|
56
|
+
}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"date": "Tue, 27 Jun 2023 11:21:22 GMT",
|
62
|
+
"tag": "@fluentui/react-tabster_v9.9.0",
|
63
|
+
"version": "9.9.0",
|
64
|
+
"comments": {
|
65
|
+
"minor": [
|
66
|
+
{
|
67
|
+
"author": "lingfangao@hotmail.com",
|
68
|
+
"package": "@fluentui/react-tabster",
|
69
|
+
"commit": "1c7e6451a11fb9c59e344df616394a320e8031c4",
|
70
|
+
"comment": "feat: Observed element hooks"
|
33
71
|
}
|
34
72
|
]
|
35
73
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,20 +1,38 @@
|
|
1
1
|
# Change Log - @fluentui/react-tabster
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 03 Jul 2023 04:22:10 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230703-0415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v0.0.0-nightly-20230703-0415.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.
|
9
|
+
Mon, 03 Jul 2023 04:22:10 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.9.1..@fluentui/react-tabster_v0.0.0-nightly-20230703-0415.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
16
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230703-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/d923e322c01699d8e3055246caefabba09153ac9) by beachball)
|
16
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230703-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/d923e322c01699d8e3055246caefabba09153ac9) by beachball)
|
17
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230703-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/d923e322c01699d8e3055246caefabba09153ac9) by beachball)
|
18
|
+
|
19
|
+
## [9.9.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.9.1)
|
20
|
+
|
21
|
+
Wed, 28 Jun 2023 11:12:33 GMT
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.9.0..@fluentui/react-tabster_v9.9.1)
|
23
|
+
|
24
|
+
### Patches
|
25
|
+
|
26
|
+
- Bump @fluentui/react-utilities to v9.10.0 ([PR #28320](https://github.com/microsoft/fluentui/pull/28320) by beachball)
|
27
|
+
|
28
|
+
## [9.9.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.9.0)
|
29
|
+
|
30
|
+
Tue, 27 Jun 2023 11:21:22 GMT
|
31
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.8.1..@fluentui/react-tabster_v9.9.0)
|
32
|
+
|
33
|
+
### Minor changes
|
34
|
+
|
35
|
+
- feat: Observed element hooks ([PR #28291](https://github.com/microsoft/fluentui/pull/28291) by lingfangao@hotmail.com)
|
18
36
|
|
19
37
|
## [9.8.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.8.1)
|
20
38
|
|
package/dist/index.d.ts
CHANGED
@@ -128,6 +128,20 @@ export declare const useFocusFinders: () => {
|
|
128
128
|
findPrevFocusable: (currentElement: HTMLElement, options?: Pick<Partial<Types.FindNextProps>, 'container'>) => HTMLElement | null | undefined;
|
129
129
|
};
|
130
130
|
|
131
|
+
/**
|
132
|
+
*
|
133
|
+
* @param name - The observed element to focus
|
134
|
+
* @returns Function that will focus the
|
135
|
+
*/
|
136
|
+
export declare function useFocusObserved(name: string, options?: UseFocusObservedOptions): () => Types.ObservedElementAsyncRequest<boolean>;
|
137
|
+
|
138
|
+
declare interface UseFocusObservedOptions {
|
139
|
+
/**
|
140
|
+
* After timeout the focus attempt fails
|
141
|
+
*/
|
142
|
+
timeout?: number;
|
143
|
+
}
|
144
|
+
|
131
145
|
export declare function useFocusVisible<TElement extends HTMLElement = HTMLElement>(options?: UseFocusVisibleOptions): React_2.RefObject<TElement>;
|
132
146
|
|
133
147
|
declare type UseFocusVisibleOptions = {
|
@@ -185,6 +199,8 @@ export declare interface UseModalAttributesOptions {
|
|
185
199
|
id?: string;
|
186
200
|
}
|
187
201
|
|
202
|
+
export declare function useObservedElement(name: string | string[]): Types.TabsterDOMAttribute;
|
203
|
+
|
188
204
|
/**
|
189
205
|
* @internal
|
190
206
|
* Hook that returns tabster attributes while ensuring tabster exists
|
package/lib/hooks/index.js
CHANGED
package/lib/hooks/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusVisible';\nexport * from './useFocusWithin';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\n"],"names":[],"mappings":"AAAA,cAAc,4BAA4B;AAC1C,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,4BAA4B;AAC1C,cAAc,uBAAuB;AACrC,cAAc,yBAAyB"}
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusVisible';\nexport * from './useFocusWithin';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\nexport * from './useObservedElement';\nexport * from './useFocusObserved';\n"],"names":[],"mappings":"AAAA,cAAc,4BAA4B;AAC1C,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,4BAA4B;AAC1C,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC,cAAc,uBAAuB;AACrC,cAAc,qBAAqB"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { getObservedElement } from 'tabster';
|
3
|
+
import { useTabster } from './useTabster';
|
4
|
+
/**
|
5
|
+
*
|
6
|
+
* @param name - The observed element to focus
|
7
|
+
* @returns Function that will focus the
|
8
|
+
*/ export function useFocusObserved(name, options = {}) {
|
9
|
+
const { timeout =1000 } = options;
|
10
|
+
const tabster = useTabster();
|
11
|
+
const observedAPI = tabster ? getObservedElement(tabster) : null;
|
12
|
+
return React.useCallback(()=>{
|
13
|
+
if (observedAPI) {
|
14
|
+
return observedAPI.requestFocus(name, timeout);
|
15
|
+
}
|
16
|
+
return {
|
17
|
+
result: Promise.resolve(false),
|
18
|
+
cancel: ()=>null
|
19
|
+
};
|
20
|
+
}, [
|
21
|
+
observedAPI,
|
22
|
+
name,
|
23
|
+
timeout
|
24
|
+
]);
|
25
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useFocusObserved.ts"],"sourcesContent":["import * as React from 'react';\nimport { getObservedElement, Types as TabsterTypes } 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 *\n * @param name - The observed element to focus\n * @returns Function that will focus the\n */\nexport function useFocusObserved(\n name: string,\n options: UseFocusObservedOptions = {},\n): () => TabsterTypes.ObservedElementAsyncRequest<boolean> {\n const { timeout = 1000 } = options;\n const tabster = useTabster();\n\n const observedAPI = tabster ? getObservedElement(tabster) : null;\n\n return React.useCallback(() => {\n if (observedAPI) {\n return observedAPI.requestFocus(name, timeout);\n }\n\n return { result: Promise.resolve(false), cancel: () => null };\n }, [observedAPI, name, timeout]);\n}\n"],"names":["React","getObservedElement","useTabster","useFocusObserved","name","options","timeout","tabster","observedAPI","useCallback","requestFocus","result","Promise","resolve","cancel"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,kBAAkB,QAA+B,UAAU;AACpE,SAASC,UAAU,QAAQ,eAAe;AAS1C;;;;CAIC,GACD,OAAO,SAASC,iBACdC,IAAY,EACZC,UAAmC,CAAC,CAAC,EACoB;IACzD,MAAM,EAAEC,SAAU,KAAI,EAAE,GAAGD;IAC3B,MAAME,UAAUL;IAEhB,MAAMM,cAAcD,UAAUN,mBAAmBM,WAAW,IAAI;IAEhE,OAAOP,MAAMS,WAAW,CAAC,IAAM;QAC7B,IAAID,aAAa;YACf,OAAOA,YAAYE,YAAY,CAACN,MAAME;QACxC,CAAC;QAED,OAAO;YAAEK,QAAQC,QAAQC,OAAO,CAAC,KAAK;YAAGC,QAAQ,IAAM,IAAI;QAAC;IAC9D,GAAG;QAACN;QAAaJ;QAAME;KAAQ;AACjC,CAAC"}
|
@@ -2,10 +2,10 @@ import * as React from 'react';
|
|
2
2
|
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
3
3
|
import { applyFocusVisiblePolyfill } from '../focus/focusVisiblePolyfill';
|
4
4
|
export function useFocusVisible(options = {}) {
|
5
|
-
const
|
5
|
+
const contextValue = useFluent();
|
6
6
|
const scopeRef = React.useRef(null);
|
7
7
|
var _options_targetDocument;
|
8
|
-
const targetDocument = (_options_targetDocument = options.targetDocument) !== null && _options_targetDocument !== void 0 ? _options_targetDocument :
|
8
|
+
const targetDocument = (_options_targetDocument = options.targetDocument) !== null && _options_targetDocument !== void 0 ? _options_targetDocument : contextValue.targetDocument;
|
9
9
|
React.useEffect(()=>{
|
10
10
|
if ((targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) && scopeRef.current) {
|
11
11
|
return applyFocusVisiblePolyfill(scopeRef.current, targetDocument.defaultView);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFocusVisible.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nimport { applyFocusVisiblePolyfill } from '../focus/focusVisiblePolyfill';\n\ntype UseFocusVisibleOptions = {\n targetDocument?: Document;\n};\n\nexport function useFocusVisible<TElement extends HTMLElement = HTMLElement>(options: UseFocusVisibleOptions = {}) {\n const
|
1
|
+
{"version":3,"sources":["useFocusVisible.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nimport { applyFocusVisiblePolyfill } from '../focus/focusVisiblePolyfill';\n\ntype UseFocusVisibleOptions = {\n targetDocument?: Document;\n};\n\nexport function useFocusVisible<TElement extends HTMLElement = HTMLElement>(options: UseFocusVisibleOptions = {}) {\n const contextValue = useFluent();\n const scopeRef = React.useRef<TElement>(null);\n\n const targetDocument = options.targetDocument ?? contextValue.targetDocument;\n\n React.useEffect(() => {\n if (targetDocument?.defaultView && scopeRef.current) {\n return applyFocusVisiblePolyfill(scopeRef.current, targetDocument.defaultView);\n }\n }, [scopeRef, targetDocument]);\n\n return scopeRef;\n}\n"],"names":["React","useFluent_unstable","useFluent","applyFocusVisiblePolyfill","useFocusVisible","options","contextValue","scopeRef","useRef","targetDocument","useEffect","defaultView","current"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF,SAASC,yBAAyB,QAAQ,gCAAgC;AAM1E,OAAO,SAASC,gBAA4DC,UAAkC,CAAC,CAAC,EAAE;IAChH,MAAMC,eAAeJ;IACrB,MAAMK,WAAWP,MAAMQ,MAAM,CAAW,IAAI;QAErBH;IAAvB,MAAMI,iBAAiBJ,CAAAA,0BAAAA,QAAQI,cAAc,cAAtBJ,qCAAAA,0BAA0BC,aAAaG,cAAc;IAE5ET,MAAMU,SAAS,CAAC,IAAM;QACpB,IAAID,CAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBE,WAAW,AAAD,KAAKJ,SAASK,OAAO,EAAE;YACnD,OAAOT,0BAA0BI,SAASK,OAAO,EAAEH,eAAeE,WAAW;QAC/E,CAAC;IACH,GAAG;QAACJ;QAAUE;KAAe;IAE7B,OAAOF;AACT,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { useTabster } from './useTabster';
|
2
|
+
import { getObservedElement } from 'tabster';
|
3
|
+
import { useTabsterAttributes } from './useTabsterAttributes';
|
4
|
+
export function useObservedElement(name) {
|
5
|
+
const tabster = useTabster();
|
6
|
+
if (tabster) {
|
7
|
+
getObservedElement(tabster);
|
8
|
+
}
|
9
|
+
return useTabsterAttributes({
|
10
|
+
observed: {
|
11
|
+
names: Array.isArray(name) ? name : [
|
12
|
+
name
|
13
|
+
]
|
14
|
+
}
|
15
|
+
});
|
16
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useObservedElement.ts"],"sourcesContent":["import { useTabster } from './useTabster';\nimport { getObservedElement, Types as TabsterTypes } from 'tabster';\nimport { useTabsterAttributes } from './useTabsterAttributes';\n\nexport function useObservedElement(name: string | string[]): TabsterTypes.TabsterDOMAttribute {\n const tabster = useTabster();\n if (tabster) {\n getObservedElement(tabster);\n }\n\n return useTabsterAttributes({ observed: { names: Array.isArray(name) ? name : [name] } });\n}\n"],"names":["useTabster","getObservedElement","useTabsterAttributes","useObservedElement","name","tabster","observed","names","Array","isArray"],"mappings":"AAAA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,kBAAkB,QAA+B,UAAU;AACpE,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,OAAO,SAASC,mBAAmBC,IAAuB,EAAoC;IAC5F,MAAMC,UAAUL;IAChB,IAAIK,SAAS;QACXJ,mBAAmBI;IACrB,CAAC;IAED,OAAOH,qBAAqB;QAAEI,UAAU;YAAEC,OAAOC,MAAMC,OAAO,CAACL,QAAQA,OAAO;gBAACA;aAAK;QAAC;IAAE;AACzF,CAAC"}
|
package/lib/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes } from './hooks/index';
|
1
|
+
export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, useObservedElement, useFocusObserved } from './hooks/index';
|
2
2
|
export { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';
|
3
3
|
export { applyFocusVisiblePolyfill } from './focus/index';
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useFocusVisible,\n useFocusWithin,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n\nexport { applyFocusVisiblePolyfill } from './focus/index';\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,cAAc,EACdC,uBAAuB,EACvBC,kBAAkB,EAClBC,oBAAoB,
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useFocusVisible,\n useFocusWithin,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n useObservedElement,\n useFocusObserved,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n\nexport { applyFocusVisiblePolyfill } from './focus/index';\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","useObservedElement","useFocusObserved","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,cAAc,EACdC,uBAAuB,EACvBC,kBAAkB,EAClBC,oBAAoB,EACpBC,kBAAkB,EAClBC,gBAAgB,QACX,gBAAgB;AAOvB,SAASC,+BAA+B,EAAEC,uBAAuB,QAAQ,gBAAgB;AASzF,SAASC,yBAAyB,QAAQ,gBAAgB"}
|
@@ -11,3 +11,5 @@ _exportStar(require("./useFocusWithin"), exports);
|
|
11
11
|
_exportStar(require("./useKeyboardNavAttribute"), exports);
|
12
12
|
_exportStar(require("./useModalAttributes"), exports);
|
13
13
|
_exportStar(require("./useTabsterAttributes"), exports);
|
14
|
+
_exportStar(require("./useObservedElement"), exports);
|
15
|
+
_exportStar(require("./useFocusObserved"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusVisible';\nexport * from './useFocusWithin';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA"}
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './useArrowNavigationGroup';\nexport * from './useFocusableGroup';\nexport * from './useFocusFinders';\nexport * from './useFocusVisible';\nexport * from './useFocusWithin';\nexport * from './useKeyboardNavAttribute';\nexport * from './useModalAttributes';\nexport * from './useTabsterAttributes';\nexport * from './useObservedElement';\nexport * from './useFocusObserved';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "useFocusObserved", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>useFocusObserved
|
8
|
+
});
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _tabster = require("tabster");
|
12
|
+
const _useTabster = require("./useTabster");
|
13
|
+
function useFocusObserved(name, options = {}) {
|
14
|
+
const { timeout =1000 } = options;
|
15
|
+
const tabster = (0, _useTabster.useTabster)();
|
16
|
+
const observedAPI = tabster ? (0, _tabster.getObservedElement)(tabster) : null;
|
17
|
+
return _react.useCallback(()=>{
|
18
|
+
if (observedAPI) {
|
19
|
+
return observedAPI.requestFocus(name, timeout);
|
20
|
+
}
|
21
|
+
return {
|
22
|
+
result: Promise.resolve(false),
|
23
|
+
cancel: ()=>null
|
24
|
+
};
|
25
|
+
}, [
|
26
|
+
observedAPI,
|
27
|
+
name,
|
28
|
+
timeout
|
29
|
+
]);
|
30
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useFocusObserved.js"],"sourcesContent":["import * as React from 'react';\nimport { getObservedElement } from 'tabster';\nimport { useTabster } from './useTabster';\n/**\n *\n * @param name - The observed element to focus\n * @returns Function that will focus the\n */ export function useFocusObserved(name, options = {}) {\n const { timeout =1000 } = options;\n const tabster = useTabster();\n const observedAPI = tabster ? getObservedElement(tabster) : null;\n return React.useCallback(()=>{\n if (observedAPI) {\n return observedAPI.requestFocus(name, timeout);\n }\n return {\n result: Promise.resolve(false),\n cancel: ()=>null\n };\n }, [\n observedAPI,\n name,\n timeout\n ]);\n}\n"],"names":["useFocusObserved","name","options","timeout","tabster","useTabster","observedAPI","getObservedElement","React","useCallback","requestFocus","result","Promise","resolve","cancel"],"mappings":";;;;+BAOoBA;;aAAAA;;;6DAPG;yBACY;4BACR;AAKhB,SAASA,iBAAiBC,IAAI,EAAEC,UAAU,CAAC,CAAC,EAAE;IACrD,MAAM,EAAEC,SAAS,KAAI,EAAG,GAAGD;IAC3B,MAAME,UAAUC,IAAAA,sBAAU;IAC1B,MAAMC,cAAcF,UAAUG,IAAAA,2BAAkB,EAACH,WAAW,IAAI;IAChE,OAAOI,OAAMC,WAAW,CAAC,IAAI;QACzB,IAAIH,aAAa;YACb,OAAOA,YAAYI,YAAY,CAACT,MAAME;QAC1C,CAAC;QACD,OAAO;YACHQ,QAAQC,QAAQC,OAAO,CAAC,KAAK;YAC7BC,QAAQ,IAAI,IAAI;QACpB;IACJ,GAAG;QACCR;QACAL;QACAE;KACH;AACL"}
|
@@ -11,10 +11,10 @@ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
11
|
const _reactSharedContexts = require("@fluentui/react-shared-contexts");
|
12
12
|
const _focusVisiblePolyfill = require("../focus/focusVisiblePolyfill");
|
13
13
|
function useFocusVisible(options = {}) {
|
14
|
-
const
|
14
|
+
const contextValue = (0, _reactSharedContexts.useFluent_unstable)();
|
15
15
|
const scopeRef = _react.useRef(null);
|
16
16
|
var _options_targetDocument;
|
17
|
-
const targetDocument = (_options_targetDocument = options.targetDocument) !== null && _options_targetDocument !== void 0 ? _options_targetDocument :
|
17
|
+
const targetDocument = (_options_targetDocument = options.targetDocument) !== null && _options_targetDocument !== void 0 ? _options_targetDocument : contextValue.targetDocument;
|
18
18
|
_react.useEffect(()=>{
|
19
19
|
if ((targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) && scopeRef.current) {
|
20
20
|
return (0, _focusVisiblePolyfill.applyFocusVisiblePolyfill)(scopeRef.current, targetDocument.defaultView);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFocusVisible.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { applyFocusVisiblePolyfill } from '../focus/focusVisiblePolyfill';\nexport function useFocusVisible(options = {}) {\n const
|
1
|
+
{"version":3,"sources":["useFocusVisible.js"],"sourcesContent":["import * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { applyFocusVisiblePolyfill } from '../focus/focusVisiblePolyfill';\nexport function useFocusVisible(options = {}) {\n const contextValue = useFluent();\n const scopeRef = React.useRef(null);\n var _options_targetDocument;\n const targetDocument = (_options_targetDocument = options.targetDocument) !== null && _options_targetDocument !== void 0 ? _options_targetDocument : contextValue.targetDocument;\n React.useEffect(()=>{\n if ((targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) && scopeRef.current) {\n return applyFocusVisiblePolyfill(scopeRef.current, targetDocument.defaultView);\n }\n }, [\n scopeRef,\n targetDocument\n ]);\n return scopeRef;\n}\n"],"names":["useFocusVisible","options","contextValue","useFluent","scopeRef","React","useRef","_options_targetDocument","targetDocument","useEffect","defaultView","current","applyFocusVisiblePolyfill"],"mappings":";;;;+BAGgBA;;aAAAA;;;6DAHO;qCACyB;sCACN;AACnC,SAASA,gBAAgBC,UAAU,CAAC,CAAC,EAAE;IAC1C,MAAMC,eAAeC,IAAAA,uCAAS;IAC9B,MAAMC,WAAWC,OAAMC,MAAM,CAAC,IAAI;IAClC,IAAIC;IACJ,MAAMC,iBAAiB,AAACD,CAAAA,0BAA0BN,QAAQO,cAAc,AAAD,MAAO,IAAI,IAAID,4BAA4B,KAAK,IAAIA,0BAA0BL,aAAaM,cAAc;IAChLH,OAAMI,SAAS,CAAC,IAAI;QAChB,IAAI,AAACD,CAAAA,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeE,WAAW,AAAD,KAAMN,SAASO,OAAO,EAAE;YAClH,OAAOC,IAAAA,+CAAyB,EAACR,SAASO,OAAO,EAAEH,eAAeE,WAAW;QACjF,CAAC;IACL,GAAG;QACCN;QACAI;KACH;IACD,OAAOJ;AACX"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "useObservedElement", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>useObservedElement
|
8
|
+
});
|
9
|
+
const _useTabster = require("./useTabster");
|
10
|
+
const _tabster = require("tabster");
|
11
|
+
const _useTabsterAttributes = require("./useTabsterAttributes");
|
12
|
+
function useObservedElement(name) {
|
13
|
+
const tabster = (0, _useTabster.useTabster)();
|
14
|
+
if (tabster) {
|
15
|
+
(0, _tabster.getObservedElement)(tabster);
|
16
|
+
}
|
17
|
+
return (0, _useTabsterAttributes.useTabsterAttributes)({
|
18
|
+
observed: {
|
19
|
+
names: Array.isArray(name) ? name : [
|
20
|
+
name
|
21
|
+
]
|
22
|
+
}
|
23
|
+
});
|
24
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useObservedElement.js"],"sourcesContent":["import { useTabster } from './useTabster';\nimport { getObservedElement } from 'tabster';\nimport { useTabsterAttributes } from './useTabsterAttributes';\nexport function useObservedElement(name) {\n const tabster = useTabster();\n if (tabster) {\n getObservedElement(tabster);\n }\n return useTabsterAttributes({\n observed: {\n names: Array.isArray(name) ? name : [\n name\n ]\n }\n });\n}\n"],"names":["useObservedElement","name","tabster","useTabster","getObservedElement","useTabsterAttributes","observed","names","Array","isArray"],"mappings":";;;;+BAGgBA;;aAAAA;;4BAHW;yBACQ;sCACE;AAC9B,SAASA,mBAAmBC,IAAI,EAAE;IACrC,MAAMC,UAAUC,IAAAA,sBAAU;IAC1B,IAAID,SAAS;QACTE,IAAAA,2BAAkB,EAACF;IACvB,CAAC;IACD,OAAOG,IAAAA,0CAAoB,EAAC;QACxBC,UAAU;YACNC,OAAOC,MAAMC,OAAO,CAACR,QAAQA,OAAO;gBAChCA;aACH;QACL;IACJ;AACJ"}
|
package/lib-commonjs/index.js
CHANGED
@@ -17,6 +17,8 @@ _export(exports, {
|
|
17
17
|
useKeyboardNavAttribute: ()=>_index.useKeyboardNavAttribute,
|
18
18
|
useModalAttributes: ()=>_index.useModalAttributes,
|
19
19
|
useTabsterAttributes: ()=>_index.useTabsterAttributes,
|
20
|
+
useObservedElement: ()=>_index.useObservedElement,
|
21
|
+
useFocusObserved: ()=>_index.useFocusObserved,
|
20
22
|
createCustomFocusIndicatorStyle: ()=>_index1.createCustomFocusIndicatorStyle,
|
21
23
|
createFocusOutlineStyle: ()=>_index1.createFocusOutlineStyle,
|
22
24
|
applyFocusVisiblePolyfill: ()=>_index1.applyFocusVisiblePolyfill
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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"],"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;
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { useArrowNavigationGroup, useFocusableGroup, useFocusFinders, useFocusVisible, useFocusWithin, useKeyboardNavAttribute, useModalAttributes, useTabsterAttributes, useObservedElement, useFocusObserved } from './hooks/index';\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\nexport { applyFocusVisiblePolyfill } from './focus/index';\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","useObservedElement","useFocusObserved","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;IAAEC,kBAAkB,MAAlBA,yBAAkB;IAAEC,gBAAgB,MAAhBA,uBAAgB;IACrMC,+BAA+B,MAA/BA,uCAA+B;IAAEC,uBAAuB,MAAvBA,+BAAuB;IACxDC,yBAAyB,MAAzBA,iCAAyB;;uBAFoL;wBAC7I"}
|
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-20230703-0415.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,9 +31,9 @@
|
|
31
31
|
"@fluentui/scripts-tasks": "*"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
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-20230703-0415.1",
|
35
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230703-0415.1",
|
36
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230703-0415.1",
|
37
37
|
"@griffel/react": "^1.5.7",
|
38
38
|
"@swc/helpers": "^0.4.14",
|
39
39
|
"keyborg": "^2.0.0",
|