@fluentui/react-aria 9.12.1 → 9.13.0
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 +14 -2
- package/dist/index.d.ts +8 -3
- package/lib/activedescendant/ActiveDescendantContext.js +4 -1
- package/lib/activedescendant/ActiveDescendantContext.js.map +1 -1
- package/lib/activedescendant/types.js.map +1 -1
- package/lib/activedescendant/useActiveDescendant.js +35 -3
- package/lib/activedescendant/useActiveDescendant.js.map +1 -1
- package/lib-commonjs/activedescendant/ActiveDescendantContext.js +4 -1
- package/lib-commonjs/activedescendant/ActiveDescendantContext.js.map +1 -1
- package/lib-commonjs/activedescendant/useActiveDescendant.js +35 -3
- package/lib-commonjs/activedescendant/useActiveDescendant.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-aria
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 01 Jul 2024 20:25:54 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.13.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.13.0)
|
|
8
|
+
|
|
9
|
+
Mon, 01 Jul 2024 20:25:54 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.12.1..@fluentui/react-aria_v9.13.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: add options to manually show/hide focus visibility on active descendants, and scroll the active item into view ([PR #31415](https://github.com/microsoft/fluentui/pull/31415) by sarah.higley@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.40 ([PR #31861](https://github.com/microsoft/fluentui/pull/31861) by beachball)
|
|
16
|
+
- Bump @fluentui/react-tabster to v9.22.1 ([PR #31861](https://github.com/microsoft/fluentui/pull/31861) by beachball)
|
|
17
|
+
- Bump @fluentui/react-utilities to v9.18.11 ([PR #31861](https://github.com/microsoft/fluentui/pull/31861) by beachball)
|
|
18
|
+
|
|
7
19
|
## [9.12.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.12.1)
|
|
8
20
|
|
|
9
|
-
Mon, 17 Jun 2024 07:
|
|
21
|
+
Mon, 17 Jun 2024 07:34:17 GMT
|
|
10
22
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.12.0..@fluentui/react-aria_v9.12.1)
|
|
11
23
|
|
|
12
24
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -33,12 +33,17 @@ export declare interface ActiveDescendantImperativeRef {
|
|
|
33
33
|
active: () => string | undefined;
|
|
34
34
|
focus: (id: string) => void;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @returns true if the last active descendant was focused
|
|
36
|
+
* @deprecated This function is not used internally anymore and will be removed in the future
|
|
38
37
|
*/
|
|
39
|
-
focusLastActive: () =>
|
|
38
|
+
focusLastActive: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Scrolls the active option into view, if it still exists
|
|
41
|
+
*/
|
|
42
|
+
scrollActiveIntoView: () => void;
|
|
40
43
|
hideAttributes: () => void;
|
|
41
44
|
showAttributes: () => void;
|
|
45
|
+
hideFocusVisibleAttributes: () => void;
|
|
46
|
+
showFocusVisibleAttributes: () => void;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
export declare interface ActiveDescendantOptions {
|
|
@@ -8,11 +8,14 @@ const activeDescendantContextDefaultValue = {
|
|
|
8
8
|
first: noop,
|
|
9
9
|
focus: noop,
|
|
10
10
|
focusLastActive: noop,
|
|
11
|
+
scrollActiveIntoView: noop,
|
|
11
12
|
last: noop,
|
|
12
13
|
next: noop,
|
|
13
14
|
prev: noop,
|
|
14
15
|
showAttributes: noop,
|
|
15
|
-
hideAttributes: noop
|
|
16
|
+
hideAttributes: noop,
|
|
17
|
+
showFocusVisibleAttributes: noop,
|
|
18
|
+
hideFocusVisibleAttributes: noop
|
|
16
19
|
}
|
|
17
20
|
};
|
|
18
21
|
const ActiveDescendantContext = React.createContext(undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ActiveDescendantContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { ActiveDescendantImperativeRef } from './types';\n\nexport type ActiveDescendantContextValue = {\n controller: ActiveDescendantImperativeRef;\n};\n\nconst noop = () => undefined;\n\nconst activeDescendantContextDefaultValue: ActiveDescendantContextValue = {\n controller: {\n active: noop,\n blur: noop,\n find: noop,\n first: noop,\n focus: noop,\n focusLastActive: noop,\n last: noop,\n next: noop,\n prev: noop,\n showAttributes: noop,\n hideAttributes: noop,\n },\n};\n\nconst ActiveDescendantContext = React.createContext<ActiveDescendantContextValue | undefined>(undefined);\n\nexport const ActiveDescendantContextProvider = ActiveDescendantContext.Provider;\nexport const useActiveDescendantContext = () =>\n React.useContext(ActiveDescendantContext) ?? activeDescendantContextDefaultValue;\nexport const useHasParentActiveDescendantContext = () => !!React.useContext(ActiveDescendantContext);\n"],"names":["React","noop","undefined","activeDescendantContextDefaultValue","controller","active","blur","find","first","focus","focusLastActive","last","next","prev","showAttributes","hideAttributes","ActiveDescendantContext","createContext","ActiveDescendantContextProvider","Provider","useActiveDescendantContext","useContext","useHasParentActiveDescendantContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAO/B,MAAMC,OAAO,IAAMC;AAEnB,MAAMC,sCAAoE;IACxEC,YAAY;QACVC,QAAQJ;QACRK,MAAML;QACNM,MAAMN;QACNO,OAAOP;QACPQ,OAAOR;QACPS,iBAAiBT;QACjBU,
|
|
1
|
+
{"version":3,"sources":["ActiveDescendantContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { ActiveDescendantImperativeRef } from './types';\n\nexport type ActiveDescendantContextValue = {\n controller: ActiveDescendantImperativeRef;\n};\n\nconst noop = () => undefined;\n\nconst activeDescendantContextDefaultValue: ActiveDescendantContextValue = {\n controller: {\n active: noop,\n blur: noop,\n find: noop,\n first: noop,\n focus: noop,\n focusLastActive: noop,\n scrollActiveIntoView: noop,\n last: noop,\n next: noop,\n prev: noop,\n showAttributes: noop,\n hideAttributes: noop,\n showFocusVisibleAttributes: noop,\n hideFocusVisibleAttributes: noop,\n },\n};\n\nconst ActiveDescendantContext = React.createContext<ActiveDescendantContextValue | undefined>(undefined);\n\nexport const ActiveDescendantContextProvider = ActiveDescendantContext.Provider;\nexport const useActiveDescendantContext = () =>\n React.useContext(ActiveDescendantContext) ?? activeDescendantContextDefaultValue;\nexport const useHasParentActiveDescendantContext = () => !!React.useContext(ActiveDescendantContext);\n"],"names":["React","noop","undefined","activeDescendantContextDefaultValue","controller","active","blur","find","first","focus","focusLastActive","scrollActiveIntoView","last","next","prev","showAttributes","hideAttributes","showFocusVisibleAttributes","hideFocusVisibleAttributes","ActiveDescendantContext","createContext","ActiveDescendantContextProvider","Provider","useActiveDescendantContext","useContext","useHasParentActiveDescendantContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAO/B,MAAMC,OAAO,IAAMC;AAEnB,MAAMC,sCAAoE;IACxEC,YAAY;QACVC,QAAQJ;QACRK,MAAML;QACNM,MAAMN;QACNO,OAAOP;QACPQ,OAAOR;QACPS,iBAAiBT;QACjBU,sBAAsBV;QACtBW,MAAMX;QACNY,MAAMZ;QACNa,MAAMb;QACNc,gBAAgBd;QAChBe,gBAAgBf;QAChBgB,4BAA4BhB;QAC5BiB,4BAA4BjB;IAC9B;AACF;AAEA,MAAMkB,0BAA0BnB,MAAMoB,aAAa,CAA2ClB;AAE9F,OAAO,MAAMmB,kCAAkCF,wBAAwBG,QAAQ,CAAC;AAChF,OAAO,MAAMC,6BAA6B;QACxCvB;WAAAA,CAAAA,oBAAAA,MAAMwB,UAAU,CAACL,sCAAjBnB,+BAAAA,oBAA6CG;AAAkC,EAAE;AACnF,OAAO,MAAMsB,sCAAsC,IAAM,CAAC,CAACzB,MAAMwB,UAAU,CAACL,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport interface ActiveDescendantImperativeRef {\n first: (options?: IteratorOptions) => string | undefined;\n last: (options?: IteratorOptions) => string | undefined;\n next: (options?: IteratorOptions) => string | undefined;\n prev: (options?: IteratorOptions) => string | undefined;\n find: (predicate: (id: string) => boolean, options?: IteratorOptions & FindOptions) => string | undefined;\n blur: () => void;\n active: () => string | undefined;\n focus: (id: string) => void;\n /**\n *
|
|
1
|
+
{"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport interface ActiveDescendantImperativeRef {\n first: (options?: IteratorOptions) => string | undefined;\n last: (options?: IteratorOptions) => string | undefined;\n next: (options?: IteratorOptions) => string | undefined;\n prev: (options?: IteratorOptions) => string | undefined;\n find: (predicate: (id: string) => boolean, options?: IteratorOptions & FindOptions) => string | undefined;\n blur: () => void;\n active: () => string | undefined;\n focus: (id: string) => void;\n /**\n * @deprecated This function is not used internally anymore and will be removed in the future\n */\n focusLastActive: () => void;\n /**\n * Scrolls the active option into view, if it still exists\n */\n scrollActiveIntoView: () => void;\n hideAttributes: () => void;\n showAttributes: () => void;\n hideFocusVisibleAttributes: () => void;\n showFocusVisibleAttributes: () => void;\n}\n\nexport interface ActiveDescendantOptions {\n /**\n * @param el - HTML element to test\n * @returns whether the element can be an active descendant\n */\n matchOption: (el: HTMLElement) => boolean;\n /**\n * Forward imperative refs when exposing functionality from a React component\n */\n imperativeRef?: React.RefObject<ActiveDescendantImperativeRef>;\n}\n\nexport interface FindOptions {\n /**\n * Starts the search from a specific id\n */\n startFrom?: string;\n}\n\nexport interface UseActiveDescendantReturn<\n TActiveParentElement extends HTMLElement = HTMLElement,\n TListboxElement extends HTMLElement = HTMLElement,\n> {\n /**\n * Attach this to the element that contains all active descendants\n */\n listboxRef: React.Ref<TListboxElement>;\n /**\n * Attach this to the element that has an active descendant\n */\n activeParentRef: React.Ref<TActiveParentElement>;\n /**\n * Imperative functions to manage active descendants within the listboxRef\n */\n controller: ActiveDescendantImperativeRef;\n}\n\nexport interface IteratorOptions {\n /**\n * When passive, the active descendant is changed\n * @default false\n */\n passive?: boolean;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -13,6 +13,7 @@ export const createActiveDescendantChangeEvent = (detail)=>new CustomEvent('acti
|
|
|
13
13
|
export function useActiveDescendant(options) {
|
|
14
14
|
const { imperativeRef, matchOption: matchOptionUnstable } = options;
|
|
15
15
|
const focusVisibleRef = React.useRef(false);
|
|
16
|
+
const shouldShowFocusVisibleAttrRef = React.useRef(true);
|
|
16
17
|
const activeIdRef = React.useRef(null);
|
|
17
18
|
const lastActiveIdRef = React.useRef(null);
|
|
18
19
|
const activeParentRef = React.useRef(null);
|
|
@@ -36,7 +37,7 @@ export function useActiveDescendant(options) {
|
|
|
36
37
|
if (!active) {
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
if (isNavigatingWithKeyboard) {
|
|
40
|
+
if (isNavigatingWithKeyboard && shouldShowFocusVisibleAttrRef.current) {
|
|
40
41
|
active.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
|
|
41
42
|
} else {
|
|
42
43
|
active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);
|
|
@@ -53,6 +54,20 @@ export function useActiveDescendant(options) {
|
|
|
53
54
|
}, [
|
|
54
55
|
listboxRef
|
|
55
56
|
]);
|
|
57
|
+
const setShouldShowFocusVisibleAttribute = React.useCallback((shouldShow)=>{
|
|
58
|
+
shouldShowFocusVisibleAttrRef.current = shouldShow;
|
|
59
|
+
const active = getActiveDescendant();
|
|
60
|
+
if (!active) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (shouldShow && focusVisibleRef.current) {
|
|
64
|
+
active.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
|
|
65
|
+
} else {
|
|
66
|
+
active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);
|
|
67
|
+
}
|
|
68
|
+
}, [
|
|
69
|
+
getActiveDescendant
|
|
70
|
+
]);
|
|
56
71
|
const blurActiveDescendant = React.useCallback(()=>{
|
|
57
72
|
const active = getActiveDescendant();
|
|
58
73
|
if (active) {
|
|
@@ -76,7 +91,7 @@ export function useActiveDescendant(options) {
|
|
|
76
91
|
scrollIntoView(nextActive);
|
|
77
92
|
setAttribute(nextActive.id);
|
|
78
93
|
nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');
|
|
79
|
-
if (focusVisibleRef.current) {
|
|
94
|
+
if (focusVisibleRef.current && shouldShowFocusVisibleAttrRef.current) {
|
|
80
95
|
nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
|
|
81
96
|
}
|
|
82
97
|
const event = createActiveDescendantChangeEvent({
|
|
@@ -160,6 +175,16 @@ export function useActiveDescendant(options) {
|
|
|
160
175
|
}
|
|
161
176
|
return target === null || target === void 0 ? void 0 : target.id;
|
|
162
177
|
},
|
|
178
|
+
scrollActiveIntoView: ()=>{
|
|
179
|
+
if (!listboxRef.current) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const active = getActiveDescendant();
|
|
183
|
+
if (!active) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
scrollIntoView(active);
|
|
187
|
+
},
|
|
163
188
|
showAttributes () {
|
|
164
189
|
attributeVisibilityRef.current = true;
|
|
165
190
|
setAttribute();
|
|
@@ -167,6 +192,12 @@ export function useActiveDescendant(options) {
|
|
|
167
192
|
hideAttributes () {
|
|
168
193
|
attributeVisibilityRef.current = false;
|
|
169
194
|
removeAttribute();
|
|
195
|
+
},
|
|
196
|
+
showFocusVisibleAttributes () {
|
|
197
|
+
setShouldShowFocusVisibleAttribute(true);
|
|
198
|
+
},
|
|
199
|
+
hideFocusVisibleAttributes () {
|
|
200
|
+
setShouldShowFocusVisibleAttribute(false);
|
|
170
201
|
}
|
|
171
202
|
}), [
|
|
172
203
|
optionWalker,
|
|
@@ -175,7 +206,8 @@ export function useActiveDescendant(options) {
|
|
|
175
206
|
removeAttribute,
|
|
176
207
|
focusActiveDescendant,
|
|
177
208
|
blurActiveDescendant,
|
|
178
|
-
getActiveDescendant
|
|
209
|
+
getActiveDescendant,
|
|
210
|
+
setShouldShowFocusVisibleAttribute
|
|
179
211
|
]);
|
|
180
212
|
React.useImperativeHandle(imperativeRef, ()=>controller);
|
|
181
213
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useActiveDescendant.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useOnKeyboardNavigationChange } from '@fluentui/react-tabster';\nimport { useOptionWalker } from './useOptionWalker';\nimport type { ActiveDescendantImperativeRef, ActiveDescendantOptions, UseActiveDescendantReturn } from './types';\nimport { ACTIVEDESCENDANT_ATTRIBUTE, ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE } from './constants';\nimport { scrollIntoView } from './scrollIntoView';\n\ninterface ActiveDescendantChangeEventDetail {\n id: string;\n previousId: string | null;\n}\n\nexport type ActiveDescendantChangeEvent = CustomEvent<ActiveDescendantChangeEventDetail>;\n\nexport const createActiveDescendantChangeEvent = (\n detail: ActiveDescendantChangeEventDetail,\n): ActiveDescendantChangeEvent =>\n new CustomEvent<ActiveDescendantChangeEventDetail>('activedescendantchange', {\n bubbles: true,\n cancelable: false,\n composed: true,\n detail,\n });\n\nexport function useActiveDescendant<TActiveParentElement extends HTMLElement, TListboxElement extends HTMLElement>(\n options: ActiveDescendantOptions,\n): UseActiveDescendantReturn<TActiveParentElement, TListboxElement> {\n const { imperativeRef, matchOption: matchOptionUnstable } = options;\n const focusVisibleRef = React.useRef(false);\n const activeIdRef = React.useRef<string | null>(null);\n const lastActiveIdRef = React.useRef<string | null>(null);\n const activeParentRef = React.useRef<TActiveParentElement>(null);\n const attributeVisibilityRef = React.useRef(true);\n\n const removeAttribute = React.useCallback(() => {\n activeParentRef.current?.removeAttribute('aria-activedescendant');\n }, []);\n const setAttribute = React.useCallback((id?: string) => {\n if (id) {\n activeIdRef.current = id;\n }\n if (attributeVisibilityRef.current && activeIdRef.current) {\n activeParentRef.current?.setAttribute('aria-activedescendant', activeIdRef.current);\n }\n }, []);\n\n useOnKeyboardNavigationChange(isNavigatingWithKeyboard => {\n focusVisibleRef.current = isNavigatingWithKeyboard;\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n\n if (isNavigatingWithKeyboard) {\n active.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n } else {\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n });\n\n const matchOption = useEventCallback(matchOptionUnstable);\n const listboxRef = React.useRef<TListboxElement>(null);\n const { optionWalker, listboxCallbackRef } = useOptionWalker<TListboxElement>({ matchOption });\n const getActiveDescendant = React.useCallback(() => {\n return listboxRef.current?.querySelector<HTMLElement>(`#${activeIdRef.current}`);\n }, [listboxRef]);\n\n const blurActiveDescendant = React.useCallback(() => {\n const active = getActiveDescendant();\n if (active) {\n active.removeAttribute(ACTIVEDESCENDANT_ATTRIBUTE);\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n\n removeAttribute();\n lastActiveIdRef.current = activeIdRef.current;\n activeIdRef.current = null;\n return active?.id ?? null;\n }, [getActiveDescendant, removeAttribute]);\n\n const focusActiveDescendant = React.useCallback(\n (nextActive: HTMLElement | null) => {\n if (!nextActive) {\n return;\n }\n\n const previousActiveId = blurActiveDescendant();\n\n scrollIntoView(nextActive);\n setAttribute(nextActive.id);\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n\n if (focusVisibleRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\n\n const event = createActiveDescendantChangeEvent({ id: nextActive.id, previousId: previousActiveId });\n nextActive.dispatchEvent(event);\n },\n [blurActiveDescendant, setAttribute],\n );\n\n const controller: ActiveDescendantImperativeRef = React.useMemo(\n () => ({\n first: ({ passive } = {}) => {\n const first = optionWalker.first();\n if (!passive) {\n focusActiveDescendant(first);\n }\n\n return first?.id;\n },\n last: ({ passive } = {}) => {\n const last = optionWalker.last();\n if (!passive) {\n focusActiveDescendant(last);\n }\n\n return last?.id;\n },\n next: ({ passive } = {}) => {\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n\n optionWalker.setCurrent(active);\n const next = optionWalker.next();\n if (!passive) {\n focusActiveDescendant(next);\n }\n\n return next?.id;\n },\n prev: ({ passive } = {}) => {\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n\n optionWalker.setCurrent(active);\n const next = optionWalker.prev();\n\n if (!passive) {\n focusActiveDescendant(next);\n }\n\n return next?.id;\n },\n blur: () => {\n blurActiveDescendant();\n },\n active: () => {\n return getActiveDescendant()?.id;\n },\n focus: (id: string) => {\n if (!listboxRef.current) {\n return;\n }\n\n const target = listboxRef.current.querySelector<HTMLElement>(`#${id}`);\n if (target) {\n focusActiveDescendant(target);\n }\n },\n focusLastActive: () => {\n if (!listboxRef.current || !lastActiveIdRef.current) {\n return;\n }\n\n const target = listboxRef.current.querySelector<HTMLElement>(`#${lastActiveIdRef.current}`);\n if (target) {\n focusActiveDescendant(target);\n return true;\n }\n },\n find(predicate, { passive, startFrom } = {}) {\n const target = optionWalker.find(predicate, startFrom);\n if (!passive) {\n focusActiveDescendant(target);\n }\n\n return target?.id;\n },\n showAttributes() {\n attributeVisibilityRef.current = true;\n setAttribute();\n },\n hideAttributes() {\n attributeVisibilityRef.current = false;\n removeAttribute();\n },\n }),\n [\n optionWalker,\n listboxRef,\n setAttribute,\n removeAttribute,\n focusActiveDescendant,\n blurActiveDescendant,\n getActiveDescendant,\n ],\n );\n\n React.useImperativeHandle(imperativeRef, () => controller);\n\n return { listboxRef: useMergedRefs(listboxRef, listboxCallbackRef), activeParentRef, controller };\n}\n"],"names":["React","useEventCallback","useMergedRefs","useOnKeyboardNavigationChange","useOptionWalker","ACTIVEDESCENDANT_ATTRIBUTE","ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","scrollIntoView","createActiveDescendantChangeEvent","detail","CustomEvent","bubbles","cancelable","composed","useActiveDescendant","options","imperativeRef","matchOption","matchOptionUnstable","focusVisibleRef","useRef","activeIdRef","lastActiveIdRef","activeParentRef","attributeVisibilityRef","removeAttribute","useCallback","current","setAttribute","id","isNavigatingWithKeyboard","active","getActiveDescendant","listboxRef","optionWalker","listboxCallbackRef","querySelector","blurActiveDescendant","focusActiveDescendant","nextActive","previousActiveId","event","previousId","dispatchEvent","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","focus","target","focusLastActive","find","predicate","startFrom","showAttributes","hideAttributes","useImperativeHandle"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AAC5E,SAASC,6BAA6B,QAAQ,0BAA0B;AACxE,SAASC,eAAe,QAAQ,oBAAoB;AAEpD,SAASC,0BAA0B,EAAEC,uCAAuC,QAAQ,cAAc;AAClG,SAASC,cAAc,QAAQ,mBAAmB;AASlD,OAAO,MAAMC,oCAAoC,CAC/CC,SAEA,IAAIC,YAA+C,0BAA0B;QAC3EC,SAAS;QACTC,YAAY;QACZC,UAAU;QACVJ;IACF,GAAG;AAEL,OAAO,SAASK,oBACdC,OAAgC;IAEhC,MAAM,EAAEC,aAAa,EAAEC,aAAaC,mBAAmB,EAAE,GAAGH;IAC5D,MAAMI,kBAAkBnB,MAAMoB,MAAM,CAAC;IACrC,MAAMC,cAAcrB,MAAMoB,MAAM,CAAgB;IAChD,MAAME,k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,uBAAuBG,OAAO,GAAG;gBACjCC;YACF;YACAgC;gBACEpC,uBAAuBG,OAAO,GAAG;gBACjCF;YACF;QACF,CAAA,GACA;QACES;QACAD;QACAL;QACAH;QACAa;QACAD;QACAL;KACD;IAGHhC,MAAM6D,mBAAmB,CAAC7C,eAAe,IAAM4B;IAE/C,OAAO;QAAEX,YAAY/B,cAAc+B,YAAYE;QAAqBZ;QAAiBqB;IAAW;AAClG"}
|
|
1
|
+
{"version":3,"sources":["useActiveDescendant.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useOnKeyboardNavigationChange } from '@fluentui/react-tabster';\nimport { useOptionWalker } from './useOptionWalker';\nimport type { ActiveDescendantImperativeRef, ActiveDescendantOptions, UseActiveDescendantReturn } from './types';\nimport { ACTIVEDESCENDANT_ATTRIBUTE, ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE } from './constants';\nimport { scrollIntoView } from './scrollIntoView';\n\ninterface ActiveDescendantChangeEventDetail {\n id: string;\n previousId: string | null;\n}\n\nexport type ActiveDescendantChangeEvent = CustomEvent<ActiveDescendantChangeEventDetail>;\n\nexport const createActiveDescendantChangeEvent = (\n detail: ActiveDescendantChangeEventDetail,\n): ActiveDescendantChangeEvent =>\n new CustomEvent<ActiveDescendantChangeEventDetail>('activedescendantchange', {\n bubbles: true,\n cancelable: false,\n composed: true,\n detail,\n });\n\nexport function useActiveDescendant<TActiveParentElement extends HTMLElement, TListboxElement extends HTMLElement>(\n options: ActiveDescendantOptions,\n): UseActiveDescendantReturn<TActiveParentElement, TListboxElement> {\n const { imperativeRef, matchOption: matchOptionUnstable } = options;\n const focusVisibleRef = React.useRef(false);\n const shouldShowFocusVisibleAttrRef = React.useRef(true);\n const activeIdRef = React.useRef<string | null>(null);\n const lastActiveIdRef = React.useRef<string | null>(null);\n const activeParentRef = React.useRef<TActiveParentElement>(null);\n const attributeVisibilityRef = React.useRef(true);\n\n const removeAttribute = React.useCallback(() => {\n activeParentRef.current?.removeAttribute('aria-activedescendant');\n }, []);\n\n const setAttribute = React.useCallback((id?: string) => {\n if (id) {\n activeIdRef.current = id;\n }\n if (attributeVisibilityRef.current && activeIdRef.current) {\n activeParentRef.current?.setAttribute('aria-activedescendant', activeIdRef.current);\n }\n }, []);\n\n useOnKeyboardNavigationChange(isNavigatingWithKeyboard => {\n focusVisibleRef.current = isNavigatingWithKeyboard;\n\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n\n if (isNavigatingWithKeyboard && shouldShowFocusVisibleAttrRef.current) {\n active.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n } else {\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n });\n\n const matchOption = useEventCallback(matchOptionUnstable);\n const listboxRef = React.useRef<TListboxElement>(null);\n const { optionWalker, listboxCallbackRef } = useOptionWalker<TListboxElement>({ matchOption });\n\n const getActiveDescendant = React.useCallback(() => {\n return listboxRef.current?.querySelector<HTMLElement>(`#${activeIdRef.current}`);\n }, [listboxRef]);\n\n const setShouldShowFocusVisibleAttribute = React.useCallback(\n (shouldShow: boolean) => {\n shouldShowFocusVisibleAttrRef.current = shouldShow;\n\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n\n if (shouldShow && focusVisibleRef.current) {\n active.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n } else {\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n },\n [getActiveDescendant],\n );\n\n const blurActiveDescendant = React.useCallback(() => {\n const active = getActiveDescendant();\n if (active) {\n active.removeAttribute(ACTIVEDESCENDANT_ATTRIBUTE);\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n\n removeAttribute();\n lastActiveIdRef.current = activeIdRef.current;\n activeIdRef.current = null;\n return active?.id ?? null;\n }, [getActiveDescendant, removeAttribute]);\n\n const focusActiveDescendant = React.useCallback(\n (nextActive: HTMLElement | null) => {\n if (!nextActive) {\n return;\n }\n\n const previousActiveId = blurActiveDescendant();\n\n scrollIntoView(nextActive);\n setAttribute(nextActive.id);\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n\n if (focusVisibleRef.current && shouldShowFocusVisibleAttrRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\n\n const event = createActiveDescendantChangeEvent({ id: nextActive.id, previousId: previousActiveId });\n nextActive.dispatchEvent(event);\n },\n [blurActiveDescendant, setAttribute],\n );\n\n const controller: ActiveDescendantImperativeRef = React.useMemo(\n () => ({\n first: ({ passive } = {}) => {\n const first = optionWalker.first();\n if (!passive) {\n focusActiveDescendant(first);\n }\n\n return first?.id;\n },\n last: ({ passive } = {}) => {\n const last = optionWalker.last();\n if (!passive) {\n focusActiveDescendant(last);\n }\n\n return last?.id;\n },\n next: ({ passive } = {}) => {\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n\n optionWalker.setCurrent(active);\n const next = optionWalker.next();\n if (!passive) {\n focusActiveDescendant(next);\n }\n\n return next?.id;\n },\n prev: ({ passive } = {}) => {\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n\n optionWalker.setCurrent(active);\n const next = optionWalker.prev();\n\n if (!passive) {\n focusActiveDescendant(next);\n }\n\n return next?.id;\n },\n blur: () => {\n blurActiveDescendant();\n },\n active: () => {\n return getActiveDescendant()?.id;\n },\n focus: (id: string) => {\n if (!listboxRef.current) {\n return;\n }\n\n const target = listboxRef.current.querySelector<HTMLElement>(`#${id}`);\n if (target) {\n focusActiveDescendant(target);\n }\n },\n focusLastActive: () => {\n if (!listboxRef.current || !lastActiveIdRef.current) {\n return;\n }\n\n const target = listboxRef.current.querySelector<HTMLElement>(`#${lastActiveIdRef.current}`);\n if (target) {\n focusActiveDescendant(target);\n return true;\n }\n },\n find(predicate, { passive, startFrom } = {}) {\n const target = optionWalker.find(predicate, startFrom);\n if (!passive) {\n focusActiveDescendant(target);\n }\n\n return target?.id;\n },\n scrollActiveIntoView: () => {\n if (!listboxRef.current) {\n return;\n }\n\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n\n scrollIntoView(active);\n },\n showAttributes() {\n attributeVisibilityRef.current = true;\n setAttribute();\n },\n hideAttributes() {\n attributeVisibilityRef.current = false;\n removeAttribute();\n },\n showFocusVisibleAttributes() {\n setShouldShowFocusVisibleAttribute(true);\n },\n hideFocusVisibleAttributes() {\n setShouldShowFocusVisibleAttribute(false);\n },\n }),\n [\n optionWalker,\n listboxRef,\n setAttribute,\n removeAttribute,\n focusActiveDescendant,\n blurActiveDescendant,\n getActiveDescendant,\n setShouldShowFocusVisibleAttribute,\n ],\n );\n\n React.useImperativeHandle(imperativeRef, () => controller);\n\n return { listboxRef: useMergedRefs(listboxRef, listboxCallbackRef), activeParentRef, controller };\n}\n"],"names":["React","useEventCallback","useMergedRefs","useOnKeyboardNavigationChange","useOptionWalker","ACTIVEDESCENDANT_ATTRIBUTE","ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","scrollIntoView","createActiveDescendantChangeEvent","detail","CustomEvent","bubbles","cancelable","composed","useActiveDescendant","options","imperativeRef","matchOption","matchOptionUnstable","focusVisibleRef","useRef","shouldShowFocusVisibleAttrRef","activeIdRef","lastActiveIdRef","activeParentRef","attributeVisibilityRef","removeAttribute","useCallback","current","setAttribute","id","isNavigatingWithKeyboard","active","getActiveDescendant","listboxRef","optionWalker","listboxCallbackRef","querySelector","setShouldShowFocusVisibleAttribute","shouldShow","blurActiveDescendant","focusActiveDescendant","nextActive","previousActiveId","event","previousId","dispatchEvent","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","focus","target","focusLastActive","find","predicate","startFrom","scrollActiveIntoView","showAttributes","hideAttributes","showFocusVisibleAttributes","hideFocusVisibleAttributes","useImperativeHandle"],"mappings":"AAAA,YAAYA,WAA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EH;QACAD;QACAL;QACAH;QACAe;QACAD;QACAP;QACAK;KACD;IAGHtC,MAAMmE,mBAAmB,CAACnD,eAAe,IAAM+B;IAE/C,OAAO;QAAEb,YAAYhC,cAAcgC,YAAYE;QAAqBZ;QAAiBuB;IAAW;AAClG"}
|
|
@@ -30,11 +30,14 @@ const activeDescendantContextDefaultValue = {
|
|
|
30
30
|
first: noop,
|
|
31
31
|
focus: noop,
|
|
32
32
|
focusLastActive: noop,
|
|
33
|
+
scrollActiveIntoView: noop,
|
|
33
34
|
last: noop,
|
|
34
35
|
next: noop,
|
|
35
36
|
prev: noop,
|
|
36
37
|
showAttributes: noop,
|
|
37
|
-
hideAttributes: noop
|
|
38
|
+
hideAttributes: noop,
|
|
39
|
+
showFocusVisibleAttributes: noop,
|
|
40
|
+
hideFocusVisibleAttributes: noop
|
|
38
41
|
}
|
|
39
42
|
};
|
|
40
43
|
const ActiveDescendantContext = /*#__PURE__*/ _react.createContext(undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ActiveDescendantContext.js"],"sourcesContent":["import * as React from 'react';\nconst noop = ()=>undefined;\nconst activeDescendantContextDefaultValue = {\n controller: {\n active: noop,\n blur: noop,\n find: noop,\n first: noop,\n focus: noop,\n focusLastActive: noop,\n last: noop,\n next: noop,\n prev: noop,\n showAttributes: noop,\n hideAttributes: noop\n }\n};\nconst ActiveDescendantContext = React.createContext(undefined);\nexport const ActiveDescendantContextProvider = ActiveDescendantContext.Provider;\nexport const useActiveDescendantContext = ()=>{\n var _React_useContext;\n return (_React_useContext = React.useContext(ActiveDescendantContext)) !== null && _React_useContext !== void 0 ? _React_useContext : activeDescendantContextDefaultValue;\n};\nexport const useHasParentActiveDescendantContext = ()=>!!React.useContext(ActiveDescendantContext);\n"],"names":["ActiveDescendantContextProvider","useActiveDescendantContext","useHasParentActiveDescendantContext","noop","undefined","activeDescendantContextDefaultValue","controller","active","blur","find","first","focus","focusLastActive","last","next","prev","showAttributes","hideAttributes","ActiveDescendantContext","React","createContext","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["ActiveDescendantContext.js"],"sourcesContent":["import * as React from 'react';\nconst noop = ()=>undefined;\nconst activeDescendantContextDefaultValue = {\n controller: {\n active: noop,\n blur: noop,\n find: noop,\n first: noop,\n focus: noop,\n focusLastActive: noop,\n scrollActiveIntoView: noop,\n last: noop,\n next: noop,\n prev: noop,\n showAttributes: noop,\n hideAttributes: noop,\n showFocusVisibleAttributes: noop,\n hideFocusVisibleAttributes: noop\n }\n};\nconst ActiveDescendantContext = React.createContext(undefined);\nexport const ActiveDescendantContextProvider = ActiveDescendantContext.Provider;\nexport const useActiveDescendantContext = ()=>{\n var _React_useContext;\n return (_React_useContext = React.useContext(ActiveDescendantContext)) !== null && _React_useContext !== void 0 ? _React_useContext : activeDescendantContextDefaultValue;\n};\nexport const useHasParentActiveDescendantContext = ()=>!!React.useContext(ActiveDescendantContext);\n"],"names":["ActiveDescendantContextProvider","useActiveDescendantContext","useHasParentActiveDescendantContext","noop","undefined","activeDescendantContextDefaultValue","controller","active","blur","find","first","focus","focusLastActive","scrollActiveIntoView","last","next","prev","showAttributes","hideAttributes","showFocusVisibleAttributes","hideFocusVisibleAttributes","ActiveDescendantContext","React","createContext","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAqBaA,+BAA+B;eAA/BA;;IACAC,0BAA0B;eAA1BA;;IAIAC,mCAAmC;eAAnCA;;;;iEA1BU;AACvB,MAAMC,OAAO,IAAIC;AACjB,MAAMC,sCAAsC;IACxCC,YAAY;QACRC,QAAQJ;QACRK,MAAML;QACNM,MAAMN;QACNO,OAAOP;QACPQ,OAAOR;QACPS,iBAAiBT;QACjBU,sBAAsBV;QACtBW,MAAMX;QACNY,MAAMZ;QACNa,MAAMb;QACNc,gBAAgBd;QAChBe,gBAAgBf;QAChBgB,4BAA4BhB;QAC5BiB,4BAA4BjB;IAChC;AACJ;AACA,MAAMkB,wCAA0BC,OAAMC,aAAa,CAACnB;AAC7C,MAAMJ,kCAAkCqB,wBAAwBG,QAAQ;AACxE,MAAMvB,6BAA6B;IACtC,IAAIwB;IACJ,OAAO,AAACA,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,wBAAuB,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBpB;AAC1I;AACO,MAAMH,sCAAsC,IAAI,CAAC,CAACoB,OAAMI,UAAU,CAACL"}
|
|
@@ -32,6 +32,7 @@ const createActiveDescendantChangeEvent = (detail)=>new CustomEvent('activedesce
|
|
|
32
32
|
function useActiveDescendant(options) {
|
|
33
33
|
const { imperativeRef, matchOption: matchOptionUnstable } = options;
|
|
34
34
|
const focusVisibleRef = _react.useRef(false);
|
|
35
|
+
const shouldShowFocusVisibleAttrRef = _react.useRef(true);
|
|
35
36
|
const activeIdRef = _react.useRef(null);
|
|
36
37
|
const lastActiveIdRef = _react.useRef(null);
|
|
37
38
|
const activeParentRef = _react.useRef(null);
|
|
@@ -55,7 +56,7 @@ function useActiveDescendant(options) {
|
|
|
55
56
|
if (!active) {
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
|
-
if (isNavigatingWithKeyboard) {
|
|
59
|
+
if (isNavigatingWithKeyboard && shouldShowFocusVisibleAttrRef.current) {
|
|
59
60
|
active.setAttribute(_constants.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
|
|
60
61
|
} else {
|
|
61
62
|
active.removeAttribute(_constants.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);
|
|
@@ -72,6 +73,20 @@ function useActiveDescendant(options) {
|
|
|
72
73
|
}, [
|
|
73
74
|
listboxRef
|
|
74
75
|
]);
|
|
76
|
+
const setShouldShowFocusVisibleAttribute = _react.useCallback((shouldShow)=>{
|
|
77
|
+
shouldShowFocusVisibleAttrRef.current = shouldShow;
|
|
78
|
+
const active = getActiveDescendant();
|
|
79
|
+
if (!active) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (shouldShow && focusVisibleRef.current) {
|
|
83
|
+
active.setAttribute(_constants.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
|
|
84
|
+
} else {
|
|
85
|
+
active.removeAttribute(_constants.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);
|
|
86
|
+
}
|
|
87
|
+
}, [
|
|
88
|
+
getActiveDescendant
|
|
89
|
+
]);
|
|
75
90
|
const blurActiveDescendant = _react.useCallback(()=>{
|
|
76
91
|
const active = getActiveDescendant();
|
|
77
92
|
if (active) {
|
|
@@ -95,7 +110,7 @@ function useActiveDescendant(options) {
|
|
|
95
110
|
(0, _scrollIntoView.scrollIntoView)(nextActive);
|
|
96
111
|
setAttribute(nextActive.id);
|
|
97
112
|
nextActive.setAttribute(_constants.ACTIVEDESCENDANT_ATTRIBUTE, '');
|
|
98
|
-
if (focusVisibleRef.current) {
|
|
113
|
+
if (focusVisibleRef.current && shouldShowFocusVisibleAttrRef.current) {
|
|
99
114
|
nextActive.setAttribute(_constants.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
|
|
100
115
|
}
|
|
101
116
|
const event = createActiveDescendantChangeEvent({
|
|
@@ -179,6 +194,16 @@ function useActiveDescendant(options) {
|
|
|
179
194
|
}
|
|
180
195
|
return target === null || target === void 0 ? void 0 : target.id;
|
|
181
196
|
},
|
|
197
|
+
scrollActiveIntoView: ()=>{
|
|
198
|
+
if (!listboxRef.current) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const active = getActiveDescendant();
|
|
202
|
+
if (!active) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
(0, _scrollIntoView.scrollIntoView)(active);
|
|
206
|
+
},
|
|
182
207
|
showAttributes () {
|
|
183
208
|
attributeVisibilityRef.current = true;
|
|
184
209
|
setAttribute();
|
|
@@ -186,6 +211,12 @@ function useActiveDescendant(options) {
|
|
|
186
211
|
hideAttributes () {
|
|
187
212
|
attributeVisibilityRef.current = false;
|
|
188
213
|
removeAttribute();
|
|
214
|
+
},
|
|
215
|
+
showFocusVisibleAttributes () {
|
|
216
|
+
setShouldShowFocusVisibleAttribute(true);
|
|
217
|
+
},
|
|
218
|
+
hideFocusVisibleAttributes () {
|
|
219
|
+
setShouldShowFocusVisibleAttribute(false);
|
|
189
220
|
}
|
|
190
221
|
}), [
|
|
191
222
|
optionWalker,
|
|
@@ -194,7 +225,8 @@ function useActiveDescendant(options) {
|
|
|
194
225
|
removeAttribute,
|
|
195
226
|
focusActiveDescendant,
|
|
196
227
|
blurActiveDescendant,
|
|
197
|
-
getActiveDescendant
|
|
228
|
+
getActiveDescendant,
|
|
229
|
+
setShouldShowFocusVisibleAttribute
|
|
198
230
|
]);
|
|
199
231
|
_react.useImperativeHandle(imperativeRef, ()=>controller);
|
|
200
232
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useActiveDescendant.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useOnKeyboardNavigationChange } from '@fluentui/react-tabster';\nimport { useOptionWalker } from './useOptionWalker';\nimport { ACTIVEDESCENDANT_ATTRIBUTE, ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE } from './constants';\nimport { scrollIntoView } from './scrollIntoView';\nexport const createActiveDescendantChangeEvent = (detail)=>new CustomEvent('activedescendantchange', {\n bubbles: true,\n cancelable: false,\n composed: true,\n detail\n });\nexport function useActiveDescendant(options) {\n const { imperativeRef, matchOption: matchOptionUnstable } = options;\n const focusVisibleRef = React.useRef(false);\n const activeIdRef = React.useRef(null);\n const lastActiveIdRef = React.useRef(null);\n const activeParentRef = React.useRef(null);\n const attributeVisibilityRef = React.useRef(true);\n const removeAttribute = React.useCallback(()=>{\n var _activeParentRef_current;\n (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.removeAttribute('aria-activedescendant');\n }, []);\n const setAttribute = React.useCallback((id)=>{\n if (id) {\n activeIdRef.current = id;\n }\n if (attributeVisibilityRef.current && activeIdRef.current) {\n var _activeParentRef_current;\n (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.setAttribute('aria-activedescendant', activeIdRef.current);\n }\n }, []);\n useOnKeyboardNavigationChange((isNavigatingWithKeyboard)=>{\n focusVisibleRef.current = isNavigatingWithKeyboard;\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n if (isNavigatingWithKeyboard) {\n active.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n } else {\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n });\n const matchOption = useEventCallback(matchOptionUnstable);\n const listboxRef = React.useRef(null);\n const { optionWalker, listboxCallbackRef } = useOptionWalker({\n matchOption\n });\n const getActiveDescendant = React.useCallback(()=>{\n var _listboxRef_current;\n return (_listboxRef_current = listboxRef.current) === null || _listboxRef_current === void 0 ? void 0 : _listboxRef_current.querySelector(`#${activeIdRef.current}`);\n }, [\n listboxRef\n ]);\n const blurActiveDescendant = React.useCallback(()=>{\n const active = getActiveDescendant();\n if (active) {\n active.removeAttribute(ACTIVEDESCENDANT_ATTRIBUTE);\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n removeAttribute();\n lastActiveIdRef.current = activeIdRef.current;\n activeIdRef.current = null;\n var _active_id;\n return (_active_id = active === null || active === void 0 ? void 0 : active.id) !== null && _active_id !== void 0 ? _active_id : null;\n }, [\n getActiveDescendant,\n removeAttribute\n ]);\n const focusActiveDescendant = React.useCallback((nextActive)=>{\n if (!nextActive) {\n return;\n }\n const previousActiveId = blurActiveDescendant();\n scrollIntoView(nextActive);\n setAttribute(nextActive.id);\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n if (focusVisibleRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\n const event = createActiveDescendantChangeEvent({\n id: nextActive.id,\n previousId: previousActiveId\n });\n nextActive.dispatchEvent(event);\n }, [\n blurActiveDescendant,\n setAttribute\n ]);\n const controller = React.useMemo(()=>({\n first: ({ passive } = {})=>{\n const first = optionWalker.first();\n if (!passive) {\n focusActiveDescendant(first);\n }\n return first === null || first === void 0 ? void 0 : first.id;\n },\n last: ({ passive } = {})=>{\n const last = optionWalker.last();\n if (!passive) {\n focusActiveDescendant(last);\n }\n return last === null || last === void 0 ? void 0 : last.id;\n },\n next: ({ passive } = {})=>{\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n optionWalker.setCurrent(active);\n const next = optionWalker.next();\n if (!passive) {\n focusActiveDescendant(next);\n }\n return next === null || next === void 0 ? void 0 : next.id;\n },\n prev: ({ passive } = {})=>{\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n optionWalker.setCurrent(active);\n const next = optionWalker.prev();\n if (!passive) {\n focusActiveDescendant(next);\n }\n return next === null || next === void 0 ? void 0 : next.id;\n },\n blur: ()=>{\n blurActiveDescendant();\n },\n active: ()=>{\n var _getActiveDescendant;\n return (_getActiveDescendant = getActiveDescendant()) === null || _getActiveDescendant === void 0 ? void 0 : _getActiveDescendant.id;\n },\n focus: (id)=>{\n if (!listboxRef.current) {\n return;\n }\n const target = listboxRef.current.querySelector(`#${id}`);\n if (target) {\n focusActiveDescendant(target);\n }\n },\n focusLastActive: ()=>{\n if (!listboxRef.current || !lastActiveIdRef.current) {\n return;\n }\n const target = listboxRef.current.querySelector(`#${lastActiveIdRef.current}`);\n if (target) {\n focusActiveDescendant(target);\n return true;\n }\n },\n find (predicate, { passive, startFrom } = {}) {\n const target = optionWalker.find(predicate, startFrom);\n if (!passive) {\n focusActiveDescendant(target);\n }\n return target === null || target === void 0 ? void 0 : target.id;\n },\n showAttributes () {\n attributeVisibilityRef.current = true;\n setAttribute();\n },\n hideAttributes () {\n attributeVisibilityRef.current = false;\n removeAttribute();\n }\n }), [\n optionWalker,\n listboxRef,\n setAttribute,\n removeAttribute,\n focusActiveDescendant,\n blurActiveDescendant,\n getActiveDescendant\n ]);\n React.useImperativeHandle(imperativeRef, ()=>controller);\n return {\n listboxRef: useMergedRefs(listboxRef, listboxCallbackRef),\n activeParentRef,\n controller\n };\n}\n"],"names":["createActiveDescendantChangeEvent","useActiveDescendant","detail","CustomEvent","bubbles","cancelable","composed","options","imperativeRef","matchOption","matchOptionUnstable","focusVisibleRef","React","useRef","activeIdRef","lastActiveIdRef","activeParentRef","attributeVisibilityRef","removeAttribute","useCallback","_activeParentRef_current","current","setAttribute","id","useOnKeyboardNavigationChange","isNavigatingWithKeyboard","active","getActiveDescendant","ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","useEventCallback","listboxRef","optionWalker","listboxCallbackRef","useOptionWalker","_listboxRef_current","querySelector","blurActiveDescendant","ACTIVEDESCENDANT_ATTRIBUTE","_active_id","focusActiveDescendant","nextActive","previousActiveId","scrollIntoView","event","previousId","dispatchEvent","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","_getActiveDescendant","focus","target","focusLastActive","find","predicate","startFrom","showAttributes","hideAttributes","useImperativeHandle","useMergedRefs"],"mappings":";;;;;;;;;;;IAMaA,iCAAiC;eAAjCA;;IAMGC,mBAAmB;eAAnBA;;;;iEAZO;gCACyB;8BACF;iCACd;2BACoD;gCACrD;AACxB,MAAMD,oCAAoC,CAACE,SAAS,IAAIC,YAAY,0BAA0B;QAC7FC,SAAS;QACTC,YAAY;QACZC,UAAU;QACVJ;IACJ;AACG,SAASD,oBAAoBM,OAAO;IACvC,MAAM,EAAEC,aAAa,EAAEC,aAAaC,mBAAmB,EAAE,GAAGH;IAC5D,MAAMI,kBAAkBC,OAAMC,MAAM,CAAC;IACrC,MAAMC,cAAcF,OAAMC,MAAM,CAAC;IACjC,MAAME,kBAAkBH,OAAMC,MAAM,CAAC;IACrC,MA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OAAO,EAAE;oBACjD;gBACJ;gBACA,MAAMoC,SAAS3B,WAAWT,OAAO,CAACc,aAAa,CAAC,CAAC,CAAC,EAAEpB,gBAAgBM,OAAO,CAAC,CAAC;gBAC7E,IAAIoC,QAAQ;oBACRlB,sBAAsBkB;oBACtB,OAAO;gBACX;YACJ;YACAE,MAAMC,SAAS,EAAE,EAAEX,OAAO,EAAEY,SAAS,EAAE,GAAG,CAAC,CAAC;gBACxC,MAAMJ,SAAS1B,aAAa4B,IAAI,CAACC,WAAWC;gBAC5C,IAAI,CAACZ,SAAS;oBACVV,sBAAsBkB;gBAC1B;gBACA,OAAOA,WAAW,QAAQA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOlC,EAAE;YACpE;YACAuC;gBACI7C,uBAAuBI,OAAO,GAAG;gBACjCC;YACJ;YACAyC;gBACI9C,uBAAuBI,OAAO,GAAG;gBACjCH;YACJ;QACJ,CAAA,GAAI;QACJa;QACAD;QACAR;QACAJ;QACAqB;QACAH;QACAT;KACH;IACDf,OAAMoD,mBAAmB,CAACxD,eAAe,IAAIsC;IAC7C,OAAO;QACHhB,YAAYmC,IAAAA,6BAAa,EAACnC,YAAYE;QACtChB;QACA8B;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"sources":["useActiveDescendant.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useOnKeyboardNavigationChange } from '@fluentui/react-tabster';\nimport { useOptionWalker } from './useOptionWalker';\nimport { ACTIVEDESCENDANT_ATTRIBUTE, ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE } from './constants';\nimport { scrollIntoView } from './scrollIntoView';\nexport const createActiveDescendantChangeEvent = (detail)=>new CustomEvent('activedescendantchange', {\n bubbles: true,\n cancelable: false,\n composed: true,\n detail\n });\nexport function useActiveDescendant(options) {\n const { imperativeRef, matchOption: matchOptionUnstable } = options;\n const focusVisibleRef = React.useRef(false);\n const shouldShowFocusVisibleAttrRef = React.useRef(true);\n const activeIdRef = React.useRef(null);\n const lastActiveIdRef = React.useRef(null);\n const activeParentRef = React.useRef(null);\n const attributeVisibilityRef = React.useRef(true);\n const removeAttribute = React.useCallback(()=>{\n var _activeParentRef_current;\n (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.removeAttribute('aria-activedescendant');\n }, []);\n const setAttribute = React.useCallback((id)=>{\n if (id) {\n activeIdRef.current = id;\n }\n if (attributeVisibilityRef.current && activeIdRef.current) {\n var _activeParentRef_current;\n (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.setAttribute('aria-activedescendant', activeIdRef.current);\n }\n }, []);\n useOnKeyboardNavigationChange((isNavigatingWithKeyboard)=>{\n focusVisibleRef.current = isNavigatingWithKeyboard;\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n if (isNavigatingWithKeyboard && shouldShowFocusVisibleAttrRef.current) {\n active.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n } else {\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n });\n const matchOption = useEventCallback(matchOptionUnstable);\n const listboxRef = React.useRef(null);\n const { optionWalker, listboxCallbackRef } = useOptionWalker({\n matchOption\n });\n const getActiveDescendant = React.useCallback(()=>{\n var _listboxRef_current;\n return (_listboxRef_current = listboxRef.current) === null || _listboxRef_current === void 0 ? void 0 : _listboxRef_current.querySelector(`#${activeIdRef.current}`);\n }, [\n listboxRef\n ]);\n const setShouldShowFocusVisibleAttribute = React.useCallback((shouldShow)=>{\n shouldShowFocusVisibleAttrRef.current = shouldShow;\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n if (shouldShow && focusVisibleRef.current) {\n active.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n } else {\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n }, [\n getActiveDescendant\n ]);\n const blurActiveDescendant = React.useCallback(()=>{\n const active = getActiveDescendant();\n if (active) {\n active.removeAttribute(ACTIVEDESCENDANT_ATTRIBUTE);\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n removeAttribute();\n lastActiveIdRef.current = activeIdRef.current;\n activeIdRef.current = null;\n var _active_id;\n return (_active_id = active === null || active === void 0 ? void 0 : active.id) !== null && _active_id !== void 0 ? _active_id : null;\n }, [\n getActiveDescendant,\n removeAttribute\n ]);\n const focusActiveDescendant = React.useCallback((nextActive)=>{\n if (!nextActive) {\n return;\n }\n const previousActiveId = blurActiveDescendant();\n scrollIntoView(nextActive);\n setAttribute(nextActive.id);\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n if (focusVisibleRef.current && shouldShowFocusVisibleAttrRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\n const event = createActiveDescendantChangeEvent({\n id: nextActive.id,\n previousId: previousActiveId\n });\n nextActive.dispatchEvent(event);\n }, [\n blurActiveDescendant,\n setAttribute\n ]);\n const controller = React.useMemo(()=>({\n first: ({ passive } = {})=>{\n const first = optionWalker.first();\n if (!passive) {\n focusActiveDescendant(first);\n }\n return first === null || first === void 0 ? void 0 : first.id;\n },\n last: ({ passive } = {})=>{\n const last = optionWalker.last();\n if (!passive) {\n focusActiveDescendant(last);\n }\n return last === null || last === void 0 ? void 0 : last.id;\n },\n next: ({ passive } = {})=>{\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n optionWalker.setCurrent(active);\n const next = optionWalker.next();\n if (!passive) {\n focusActiveDescendant(next);\n }\n return next === null || next === void 0 ? void 0 : next.id;\n },\n prev: ({ passive } = {})=>{\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n optionWalker.setCurrent(active);\n const next = optionWalker.prev();\n if (!passive) {\n focusActiveDescendant(next);\n }\n return next === null || next === void 0 ? void 0 : next.id;\n },\n blur: ()=>{\n blurActiveDescendant();\n },\n active: ()=>{\n var _getActiveDescendant;\n return (_getActiveDescendant = getActiveDescendant()) === null || _getActiveDescendant === void 0 ? void 0 : _getActiveDescendant.id;\n },\n focus: (id)=>{\n if (!listboxRef.current) {\n return;\n }\n const target = listboxRef.current.querySelector(`#${id}`);\n if (target) {\n focusActiveDescendant(target);\n }\n },\n focusLastActive: ()=>{\n if (!listboxRef.current || !lastActiveIdRef.current) {\n return;\n }\n const target = listboxRef.current.querySelector(`#${lastActiveIdRef.current}`);\n if (target) {\n focusActiveDescendant(target);\n return true;\n }\n },\n find (predicate, { passive, startFrom } = {}) {\n const target = optionWalker.find(predicate, startFrom);\n if (!passive) {\n focusActiveDescendant(target);\n }\n return target === null || target === void 0 ? void 0 : target.id;\n },\n scrollActiveIntoView: ()=>{\n if (!listboxRef.current) {\n return;\n }\n const active = getActiveDescendant();\n if (!active) {\n return;\n }\n scrollIntoView(active);\n },\n showAttributes () {\n attributeVisibilityRef.current = true;\n setAttribute();\n },\n hideAttributes () {\n attributeVisibilityRef.current = false;\n removeAttribute();\n },\n showFocusVisibleAttributes () {\n setShouldShowFocusVisibleAttribute(true);\n },\n hideFocusVisibleAttributes () {\n setShouldShowFocusVisibleAttribute(false);\n }\n }), [\n optionWalker,\n listboxRef,\n setAttribute,\n removeAttribute,\n focusActiveDescendant,\n blurActiveDescendant,\n getActiveDescendant,\n setShouldShowFocusVisibleAttribute\n ]);\n React.useImperativeHandle(imperativeRef, ()=>controller);\n return {\n listboxRef: useMergedRefs(listboxRef, listboxCallbackRef),\n activeParentRef,\n controller\n };\n}\n"],"names":["createActiveDescendantChangeEvent","useActiveDescendant","detail","CustomEvent","bubbles","cancelable","composed","options","imperativeRef","matchOption","matchOptionUnstable","focusVisibleRef","React","useRef","shouldShowFocusVisibleAttrRef","activeIdRef","lastActiveIdRef","activeParentRef","attributeVisibilityRef","removeAttribute","useCallback","_activeParentRef_current","current","setAttribute","id","useOnKeyboardNavigationChange","isNavigatingWithKeyboard","active","getActiveDescendant","ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","useEventCallback","listboxRef","optionWalker","listboxCallbackRef","useOptionWalker","_listboxRef_current","querySelector","setShouldShowFocusVisibleAttribute","shouldShow","blurActiveDescendant","ACTIVEDESCENDANT_ATTRIBUTE","_active_id","focusActiveDescendant","nextActive","previousActiveId","scrollIntoView","event","previousId","dispatchEvent","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","_getActiveDescendant","focus","target","focusLastActive","find","predicate","startFrom","scrollActiveIntoView","showAttributes","hideAttributes","showFocusVisibleAttributes","hideFocusVisibleAttributes","useImperativeHandle","useMergedRefs"],"mappings":";;;;;;;;;;;IAMaA,iCAAiC;eAAjCA;;IAMGC,mBAAmB;eAAnBA;;;;iEAZO;gCACyB;8BACF;iCACd;2BACoD;gCACrD;AACxB,MAAMD,oCAAoC,CAACE,SAAS,IAAIC,YAAY,0BAA0B;QAC7FC,SAAS;QACTC,YAAY;QACZC,UAAU;QACVJ;IACJ;AACG,SAASD,oBAAoBM,OAAO;IACvC,MAAM,EAAEC,aAAa,EAAEC,aAAaC,mBAAmB,EAAE,GAAGH;IAC5D,MAAMI,kBAAkBC,OAAMC,MAAM,CAAC;IACrC,MAAMC,gCAAgCF,OAAMC,MAAM,CAAC;IACnD,MAAME,cAAcH,OAAMC,MAAM,CAAC;IACjC,MAAMG,kBAAkBJ,OAAMC,MAAM,CAAC;IACrC,MAAMI,kBAAkBL,OAAMC,MAAM,CAAC;IACrC,MAAMK,yBAAyBN,OAAMC,MAAM,CAAC;IAC5C,MAAMM,kBAAkBP,OAAMQ,WAAW,CAAC;QACtC,IAAIC;QACHA,CAAAA,2BAA2BJ,gBAAgBK,OAAO,AAAD,MAAO,QAAQD,6BAA6B,KAAK,IAAI,KAAK,IAAIA,yBAAyBF,eAAe,CAAC;IAC7J,GAAG,EAAE;IACL,MAAMI,eAAeX,OAAMQ,WAAW,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b,IAAI,CAAC9B,WAAWT,OAAO,IAAI,CAACN,gBAAgBM,OAAO,EAAE;oBACjD;gBACJ;gBACA,MAAMsC,SAAS7B,WAAWT,OAAO,CAACc,aAAa,CAAC,CAAC,CAAC,EAAEpB,gBAAgBM,OAAO,CAAC,CAAC;gBAC7E,IAAIsC,QAAQ;oBACRlB,sBAAsBkB;oBACtB,OAAO;gBACX;YACJ;YACAE,MAAMC,SAAS,EAAE,EAAEX,OAAO,EAAEY,SAAS,EAAE,GAAG,CAAC,CAAC;gBACxC,MAAMJ,SAAS5B,aAAa8B,IAAI,CAACC,WAAWC;gBAC5C,IAAI,CAACZ,SAAS;oBACVV,sBAAsBkB;gBAC1B;gBACA,OAAOA,WAAW,QAAQA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOpC,EAAE;YACpE;YACAyC,sBAAsB;gBAClB,IAAI,CAAClC,WAAWT,OAAO,EAAE;oBACrB;gBACJ;gBACA,MAAMK,SAASC;gBACf,IAAI,CAACD,QAAQ;oBACT;gBACJ;gBACAkB,IAAAA,8BAAc,EAAClB;YACnB;YACAuC;gBACIhD,uBAAuBI,OAAO,GAAG;gBACjCC;YACJ;YACA4C;gBACIjD,uBAAuBI,OAAO,GAAG;gBACjCH;YACJ;YACAiD;gBACI/B,mCAAmC;YACvC;YACAgC;gBACIhC,mCAAmC;YACvC;QACJ,CAAA,GAAI;QACJL;QACAD;QACAR;QACAJ;QACAuB;QACAH;QACAX;QACAS;KACH;IACDzB,OAAM0D,mBAAmB,CAAC9D,eAAe,IAAIyC;IAC7C,OAAO;QACHlB,YAAYwC,IAAAA,6BAAa,EAACxC,YAAYE;QACtChB;QACAgC;IACJ;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-aria",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.13.0",
|
|
4
4
|
"description": "React helper to ensure ARIA",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@fluentui/keyboard-keys": "^9.0.7",
|
|
36
36
|
"@fluentui/react-shared-contexts": "^9.19.0",
|
|
37
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
38
|
-
"@fluentui/react-tabster": "^9.22.
|
|
39
|
-
"@fluentui/react-utilities": "^9.18.
|
|
37
|
+
"@fluentui/react-jsx-runtime": "^9.0.40",
|
|
38
|
+
"@fluentui/react-tabster": "^9.22.1",
|
|
39
|
+
"@fluentui/react-utilities": "^9.18.11",
|
|
40
40
|
"@swc/helpers": "^0.5.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|