@fluentui/react-aria 9.9.1 → 9.10.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.md CHANGED
@@ -1,12 +1,37 @@
1
1
  # Change Log - @fluentui/react-aria
2
2
 
3
- This log was last generated on Wed, 28 Feb 2024 02:28:41 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 15 Mar 2024 21:37:57 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.10.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.10.1)
8
+
9
+ Fri, 15 Mar 2024 21:37:57 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.10.0..@fluentui/react-aria_v9.10.1)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-shared-contexts to v9.15.1 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
15
+ - Bump @fluentui/react-jsx-runtime to v9.0.33 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
16
+ - Bump @fluentui/react-tabster to v9.19.4 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
17
+ - Bump @fluentui/react-utilities to v9.18.4 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
18
+
19
+ ## [9.10.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.10.0)
20
+
21
+ Thu, 07 Mar 2024 19:33:21 GMT
22
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.9.1..@fluentui/react-aria_v9.10.0)
23
+
24
+ ### Minor changes
25
+
26
+ - feat: active descendants imperative handle to toggle attribute ([PR #30716](https://github.com/microsoft/fluentui/pull/30716) by bernardo.sunderhus@gmail.com)
27
+ - Bump @fluentui/react-shared-contexts to v9.15.0 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
28
+ - Bump @fluentui/react-jsx-runtime to v9.0.32 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
29
+ - Bump @fluentui/react-tabster to v9.19.3 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
30
+ - Bump @fluentui/react-utilities to v9.18.3 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
31
+
7
32
  ## [9.9.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.9.1)
8
33
 
9
- Wed, 28 Feb 2024 02:28:41 GMT
34
+ Wed, 28 Feb 2024 02:34:19 GMT
10
35
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.9.0..@fluentui/react-aria_v9.9.1)
11
36
 
12
37
  ### Patches
package/dist/index.d.ts CHANGED
@@ -25,6 +25,8 @@ export declare interface ActiveDescendantImperativeRef {
25
25
  blur: () => void;
26
26
  active: () => string | undefined;
27
27
  focus: (id: string) => void;
28
+ hideAttributes: () => void;
29
+ showAttributes: () => void;
28
30
  }
29
31
 
30
32
  export declare interface ActiveDescendantOptions {
@@ -9,7 +9,9 @@ const activeDescendantContextDefaultValue = {
9
9
  focus: noop,
10
10
  last: noop,
11
11
  next: noop,
12
- prev: noop
12
+ prev: noop,
13
+ showAttributes: noop,
14
+ hideAttributes: noop
13
15
  }
14
16
  };
15
17
  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 last: noop,\n next: noop,\n prev: 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","last","next","prev","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,MAAMT;QACNU,MAAMV;QACNW,MAAMX;IACR;AACF;AAEA,MAAMY,0BAA0Bb,MAAMc,aAAa,CAA2CZ;AAE9F,OAAO,MAAMa,kCAAkCF,wBAAwBG,QAAQ,CAAC;AAChF,OAAO,MAAMC,6BAA6B;QACxCjB;WAAAA,CAAAA,oBAAAA,MAAMkB,UAAU,CAACL,sCAAjBb,+BAAAA,oBAA6CG;AAAkC,EAAE;AACnF,OAAO,MAAMgB,sCAAsC,IAAM,CAAC,CAACnB,MAAMkB,UAAU,CAACL,yBAAyB"}
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 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","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,MAAMT;QACNU,MAAMV;QACNW,MAAMX;QACNY,gBAAgBZ;QAChBa,gBAAgBb;IAClB;AACF;AAEA,MAAMc,0BAA0Bf,MAAMgB,aAAa,CAA2Cd;AAE9F,OAAO,MAAMe,kCAAkCF,wBAAwBG,QAAQ,CAAC;AAChF,OAAO,MAAMC,6BAA6B;QACxCnB;WAAAA,CAAAA,oBAAAA,MAAMoB,UAAU,CAACL,sCAAjBf,+BAAAA,oBAA6CG;AAAkC,EAAE;AACnF,OAAO,MAAMkB,sCAAsC,IAAM,CAAC,CAACrB,MAAMoB,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\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"}
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 hideAttributes: () => void;\n showAttributes: () => 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"}
@@ -9,6 +9,20 @@ export function useActiveDescendant(options) {
9
9
  const focusVisibleRef = React.useRef(false);
10
10
  const activeIdRef = React.useRef(null);
11
11
  const activeParentRef = React.useRef(null);
12
+ const attributeVisibilityRef = React.useRef(true);
13
+ const removeAttribute = React.useCallback(()=>{
14
+ var _activeParentRef_current;
15
+ (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.removeAttribute('aria-activedescendant');
16
+ }, []);
17
+ const setAttribute = React.useCallback((id)=>{
18
+ if (id) {
19
+ activeIdRef.current = id;
20
+ }
21
+ if (attributeVisibilityRef.current && activeIdRef.current) {
22
+ var _activeParentRef_current;
23
+ (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.setAttribute('aria-activedescendant', activeIdRef.current);
24
+ }
25
+ }, []);
12
26
  useOnKeyboardNavigationChange((isNavigatingWithKeyboard)=>{
13
27
  focusVisibleRef.current = isNavigatingWithKeyboard;
14
28
  const active = getActiveDescendant();
@@ -33,35 +47,32 @@ export function useActiveDescendant(options) {
33
47
  listboxRef
34
48
  ]);
35
49
  const blurActiveDescendant = React.useCallback(()=>{
36
- var _activeParentRef_current;
37
50
  const active = getActiveDescendant();
38
51
  if (active) {
39
52
  active.removeAttribute(ACTIVEDESCENDANT_ATTRIBUTE);
40
53
  active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);
41
54
  }
42
- (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.removeAttribute('aria-activedescendant');
55
+ removeAttribute();
43
56
  activeIdRef.current = null;
44
57
  }, [
45
- activeParentRef,
46
- getActiveDescendant
58
+ getActiveDescendant,
59
+ removeAttribute
47
60
  ]);
48
61
  const focusActiveDescendant = React.useCallback((nextActive)=>{
49
- var _activeParentRef_current;
50
62
  if (!nextActive) {
51
63
  return;
52
64
  }
53
65
  blurActiveDescendant();
54
66
  scrollIntoView(nextActive, listboxRef.current);
55
- (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.setAttribute('aria-activedescendant', nextActive.id);
56
- activeIdRef.current = nextActive.id;
67
+ setAttribute(nextActive.id);
57
68
  nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');
58
69
  if (focusVisibleRef.current) {
59
70
  nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
60
71
  }
61
72
  }, [
62
- activeParentRef,
63
73
  listboxRef,
64
- blurActiveDescendant
74
+ blurActiveDescendant,
75
+ setAttribute
65
76
  ]);
66
77
  const controller = React.useMemo(()=>({
67
78
  first: ({ passive } = {})=>{
@@ -124,10 +135,20 @@ export function useActiveDescendant(options) {
124
135
  focusActiveDescendant(target);
125
136
  }
126
137
  return target === null || target === void 0 ? void 0 : target.id;
138
+ },
139
+ showAttributes () {
140
+ attributeVisibilityRef.current = true;
141
+ setAttribute();
142
+ },
143
+ hideAttributes () {
144
+ attributeVisibilityRef.current = false;
145
+ removeAttribute();
127
146
  }
128
147
  }), [
129
148
  optionWalker,
130
149
  listboxRef,
150
+ setAttribute,
151
+ removeAttribute,
131
152
  focusActiveDescendant,
132
153
  blurActiveDescendant,
133
154
  getActiveDescendant
@@ -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\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 activeParentRef = React.useRef<TActiveParentElement>(null);\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 activeParentRef.current?.removeAttribute('aria-activedescendant');\n activeIdRef.current = null;\n }, [activeParentRef, getActiveDescendant]);\n\n const focusActiveDescendant = React.useCallback(\n (nextActive: HTMLElement | null) => {\n if (!nextActive) {\n return;\n }\n\n blurActiveDescendant();\n\n scrollIntoView(nextActive, listboxRef.current);\n activeParentRef.current?.setAttribute('aria-activedescendant', nextActive.id);\n activeIdRef.current = nextActive.id;\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n\n if (focusVisibleRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\n },\n [activeParentRef, listboxRef, blurActiveDescendant],\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\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\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 }),\n [optionWalker, listboxRef, focusActiveDescendant, blurActiveDescendant, getActiveDescendant],\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","useActiveDescendant","options","imperativeRef","matchOption","matchOptionUnstable","focusVisibleRef","useRef","activeIdRef","activeParentRef","isNavigatingWithKeyboard","current","active","getActiveDescendant","setAttribute","removeAttribute","listboxRef","optionWalker","listboxCallbackRef","useCallback","querySelector","blurActiveDescendant","focusActiveDescendant","nextActive","id","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","focus","target","find","predicate","startFrom","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;AAElD,OAAO,SAASC,oBACdC,OAAgC;IAEhC,MAAM,EAAEC,aAAa,EAAEC,aAAaC,mBAAmB,EAAE,GAAGH;IAC5D,MAAMI,kBAAkBb,MAAMc,MAAM,CAAC;IACrC,MAAMC,cAAcf,MAAMc,MAAM,CAAgB;IAChD,MAAME,kBAAkBhB,MAAMc,MAAM,CAAuB;IAE3DX,8BAA8Bc,CAAAA;QAC5BJ,gBAAgBK,OAAO,GAAGD;QAC1B,MAAME,SAASC;QACf,IAAI,CAACD,QAAQ;YACX;QACF;QAEA,IAAIF,0BAA0B;YAC5BE,OAAOE,YAAY,CAACf,yCAAyC;QAC/D,OAAO;YACLa,OAAOG,eAAe,CAAChB;QACzB;IACF;IAEA,MAAMK,cAAcV,iBAAiBW;IACrC,MAAMW,aAAavB,MAAMc,MAAM,CAAkB;IACjD,MAAM,EAAEU,YAAY,EAAEC,kBAAkB,EAAE,GAAGrB,gBAAiC;QAAEO;IAAY;IAC5F,MAAMS,sBAAsBpB,MAAM0B,WAAW,CAAC;YACrCH;QAAP,QAAOA,sBAAAA,WAAWL,OAAO,cAAlBK,0CAAAA,oBAAoBI,aAAa,CAAc,CAAC,CAAC,EAAEZ,YAAYG,OAAO,CA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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\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 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 activeIdRef.current = null;\n }, [getActiveDescendant, removeAttribute]);\n\n const focusActiveDescendant = React.useCallback(\n (nextActive: HTMLElement | null) => {\n if (!nextActive) {\n return;\n }\n\n blurActiveDescendant();\n\n scrollIntoView(nextActive, listboxRef.current);\n setAttribute(nextActive.id);\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n\n if (focusVisibleRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\n },\n [listboxRef, 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\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\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","useActiveDescendant","options","imperativeRef","matchOption","matchOptionUnstable","focusVisibleRef","useRef","activeIdRef","activeParentRef","attributeVisibilityRef","removeAttribute","useCallback","current","setAttribute","id","isNavigatingWithKeyboard","active","getActiveDescendant","listboxRef","optionWalker","listboxCallbackRef","querySelector","blurActiveDescendant","focusActiveDescendant","nextActive","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","focus","target","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;AAElD,OAAO,SAASC,oBACdC,OAAgC;IAEhC,MAAM,EAAEC,aAAa,EAAEC,aAAaC,mBAAmB,EAAE,GAAGH;IAC5D,MAAMI,kBAAkBb,MAAMc,MAAM,CAAC;IACrC,MAAMC,cAAcf,MAAMc,MAAM,CAAgB;IAChD,MAA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OX,aAAaa,IAAI;gBAE9B,IAAI,CAACJ,SAAS;oBACZL,sBAAsBO;gBACxB;gBAEA,OAAOA,iBAAAA,2BAAAA,KAAMhB,EAAE;YACjB;YACAmB,MAAM;gBACJX;YACF;YACAN,QAAQ;oBACCC;gBAAP,QAAOA,uBAAAA,mCAAAA,2CAAAA,qBAAuBH,EAAE;YAClC;YAEAoB,OAAO,CAACpB;gBACN,IAAI,CAACI,WAAWN,OAAO,EAAE;oBACvB;gBACF;gBAEA,MAAMuB,SAASjB,WAAWN,OAAO,CAACS,aAAa,CAAc,CAAC,CAAC,EAAEP,GAAG,CAAC;gBACrE,IAAIqB,QAAQ;oBACVZ,sBAAsBY;gBACxB;YACF;YAEAC,MAAKC,SAAS,EAAE,EAAET,OAAO,EAAEU,SAAS,EAAE,GAAG,CAAC,CAAC;gBACzC,MAAMH,SAAShB,aAAaiB,IAAI,CAACC,WAAWC;gBAC5C,IAAI,CAACV,SAAS;oBACZL,sBAAsBY;gBACxB;gBAEA,OAAOA,mBAAAA,6BAAAA,OAAQrB,EAAE;YACnB;YACAyB;gBACE9B,uBAAuBG,OAAO,GAAG;gBACjCC;YACF;YACA2B;gBACE/B,uBAAuBG,OAAO,GAAG;gBACjCF;YACF;QACF,CAAA,GACA;QACES;QACAD;QACAL;QACAH;QACAa;QACAD;QACAL;KACD;IAGHzB,MAAMiD,mBAAmB,CAACvC,eAAe,IAAMuB;IAE/C,OAAO;QAAEP,YAAYxB,cAAcwB,YAAYE;QAAqBZ;QAAiBiB;IAAW;AAClG"}
@@ -15,11 +15,11 @@ _export(exports, {
15
15
  renderAriaLiveAnnouncer_unstable: function() {
16
16
  return _renderAriaLiveAnnouncer.renderAriaLiveAnnouncer_unstable;
17
17
  },
18
- useAriaLiveAnnouncer_unstable: function() {
19
- return _useAriaLiveAnnouncer.useAriaLiveAnnouncer_unstable;
20
- },
21
18
  useAriaLiveAnnouncerContextValues_unstable: function() {
22
19
  return _useAriaLiveAnnouncerContextValues.useAriaLiveAnnouncerContextValues_unstable;
20
+ },
21
+ useAriaLiveAnnouncer_unstable: function() {
22
+ return _useAriaLiveAnnouncer.useAriaLiveAnnouncer_unstable;
23
23
  }
24
24
  });
25
25
  const _AriaLiveAnnouncer = require("./AriaLiveAnnouncer");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { AriaLiveAnnouncer } from './AriaLiveAnnouncer';\nexport { renderAriaLiveAnnouncer_unstable } from './renderAriaLiveAnnouncer';\nexport { useAriaLiveAnnouncer_unstable } from './useAriaLiveAnnouncer';\nexport { useAriaLiveAnnouncerContextValues_unstable } from './useAriaLiveAnnouncerContextValues';\n"],"names":["AriaLiveAnnouncer","renderAriaLiveAnnouncer_unstable","useAriaLiveAnnouncer_unstable","useAriaLiveAnnouncerContextValues_unstable"],"mappings":";;;;;;;;;;;IAASA,iBAAiB;eAAjBA,oCAAiB;;IACjBC,gCAAgC;eAAhCA,yDAAgC;;IAChCC,6BAA6B;eAA7BA,mDAA6B;;IAC7BC,0CAA0C;eAA1CA,6EAA0C;;;mCAHjB;yCACe;sCACH;mDACa"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { AriaLiveAnnouncer } from './AriaLiveAnnouncer';\nexport { renderAriaLiveAnnouncer_unstable } from './renderAriaLiveAnnouncer';\nexport { useAriaLiveAnnouncer_unstable } from './useAriaLiveAnnouncer';\nexport { useAriaLiveAnnouncerContextValues_unstable } from './useAriaLiveAnnouncerContextValues';\n"],"names":["AriaLiveAnnouncer","renderAriaLiveAnnouncer_unstable","useAriaLiveAnnouncerContextValues_unstable","useAriaLiveAnnouncer_unstable"],"mappings":";;;;;;;;;;;IAASA,iBAAiB;eAAjBA,oCAAiB;;IACjBC,gCAAgC;eAAhCA,yDAAgC;;IAEhCC,0CAA0C;eAA1CA,6EAA0C;;IAD1CC,6BAA6B;eAA7BA,mDAA6B;;;mCAFJ;yCACe;sCACH;mDACa"}
@@ -31,7 +31,9 @@ const activeDescendantContextDefaultValue = {
31
31
  focus: noop,
32
32
  last: noop,
33
33
  next: noop,
34
- prev: noop
34
+ prev: noop,
35
+ showAttributes: noop,
36
+ hideAttributes: noop
35
37
  }
36
38
  };
37
39
  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 last: noop,\n next: noop,\n prev: 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","last","next","prev","ActiveDescendantContext","React","createContext","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAeaA,+BAA+B;eAA/BA;;IACAC,0BAA0B;eAA1BA;;IAIAC,mCAAmC;eAAnCA;;;;iEApBU;AACvB,MAAMC,OAAO,IAAIC;AACjB,MAAMC,sCAAsC;IACxCC,YAAY;QACRC,QAAQJ;QACRK,MAAML;QACNM,MAAMN;QACNO,OAAOP;QACPQ,OAAOR;QACPS,MAAMT;QACNU,MAAMV;QACNW,MAAMX;IACV;AACJ;AACA,MAAMY,wCAA0BC,OAAMC,aAAa,CAACb;AAC7C,MAAMJ,kCAAkCe,wBAAwBG,QAAQ;AACxE,MAAMjB,6BAA6B;IACtC,IAAIkB;IACJ,OAAO,AAACA,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,wBAAuB,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBd;AAC1I;AACO,MAAMH,sCAAsC,IAAI,CAAC,CAACc,OAAMI,UAAU,CAACL"}
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 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","last","next","prev","showAttributes","hideAttributes","ActiveDescendantContext","React","createContext","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAiBaA,+BAA+B;eAA/BA;;IACAC,0BAA0B;eAA1BA;;IAIAC,mCAAmC;eAAnCA;;;;iEAtBU;AACvB,MAAMC,OAAO,IAAIC;AACjB,MAAMC,sCAAsC;IACxCC,YAAY;QACRC,QAAQJ;QACRK,MAAML;QACNM,MAAMN;QACNO,OAAOP;QACPQ,OAAOR;QACPS,MAAMT;QACNU,MAAMV;QACNW,MAAMX;QACNY,gBAAgBZ;QAChBa,gBAAgBb;IACpB;AACJ;AACA,MAAMc,wCAA0BC,OAAMC,aAAa,CAACf;AAC7C,MAAMJ,kCAAkCiB,wBAAwBG,QAAQ;AACxE,MAAMnB,6BAA6B;IACtC,IAAIoB;IACJ,OAAO,AAACA,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,wBAAuB,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBhB;AAC1I;AACO,MAAMH,sCAAsC,IAAI,CAAC,CAACgB,OAAMI,UAAU,CAACL"}
@@ -20,6 +20,20 @@ function useActiveDescendant(options) {
20
20
  const focusVisibleRef = _react.useRef(false);
21
21
  const activeIdRef = _react.useRef(null);
22
22
  const activeParentRef = _react.useRef(null);
23
+ const attributeVisibilityRef = _react.useRef(true);
24
+ const removeAttribute = _react.useCallback(()=>{
25
+ var _activeParentRef_current;
26
+ (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.removeAttribute('aria-activedescendant');
27
+ }, []);
28
+ const setAttribute = _react.useCallback((id)=>{
29
+ if (id) {
30
+ activeIdRef.current = id;
31
+ }
32
+ if (attributeVisibilityRef.current && activeIdRef.current) {
33
+ var _activeParentRef_current;
34
+ (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.setAttribute('aria-activedescendant', activeIdRef.current);
35
+ }
36
+ }, []);
23
37
  (0, _reacttabster.useOnKeyboardNavigationChange)((isNavigatingWithKeyboard)=>{
24
38
  focusVisibleRef.current = isNavigatingWithKeyboard;
25
39
  const active = getActiveDescendant();
@@ -44,35 +58,32 @@ function useActiveDescendant(options) {
44
58
  listboxRef
45
59
  ]);
46
60
  const blurActiveDescendant = _react.useCallback(()=>{
47
- var _activeParentRef_current;
48
61
  const active = getActiveDescendant();
49
62
  if (active) {
50
63
  active.removeAttribute(_constants.ACTIVEDESCENDANT_ATTRIBUTE);
51
64
  active.removeAttribute(_constants.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);
52
65
  }
53
- (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.removeAttribute('aria-activedescendant');
66
+ removeAttribute();
54
67
  activeIdRef.current = null;
55
68
  }, [
56
- activeParentRef,
57
- getActiveDescendant
69
+ getActiveDescendant,
70
+ removeAttribute
58
71
  ]);
59
72
  const focusActiveDescendant = _react.useCallback((nextActive)=>{
60
- var _activeParentRef_current;
61
73
  if (!nextActive) {
62
74
  return;
63
75
  }
64
76
  blurActiveDescendant();
65
77
  (0, _scrollIntoView.scrollIntoView)(nextActive, listboxRef.current);
66
- (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.setAttribute('aria-activedescendant', nextActive.id);
67
- activeIdRef.current = nextActive.id;
78
+ setAttribute(nextActive.id);
68
79
  nextActive.setAttribute(_constants.ACTIVEDESCENDANT_ATTRIBUTE, '');
69
80
  if (focusVisibleRef.current) {
70
81
  nextActive.setAttribute(_constants.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
71
82
  }
72
83
  }, [
73
- activeParentRef,
74
84
  listboxRef,
75
- blurActiveDescendant
85
+ blurActiveDescendant,
86
+ setAttribute
76
87
  ]);
77
88
  const controller = _react.useMemo(()=>({
78
89
  first: ({ passive } = {})=>{
@@ -135,10 +146,20 @@ function useActiveDescendant(options) {
135
146
  focusActiveDescendant(target);
136
147
  }
137
148
  return target === null || target === void 0 ? void 0 : target.id;
149
+ },
150
+ showAttributes () {
151
+ attributeVisibilityRef.current = true;
152
+ setAttribute();
153
+ },
154
+ hideAttributes () {
155
+ attributeVisibilityRef.current = false;
156
+ removeAttribute();
138
157
  }
139
158
  }), [
140
159
  optionWalker,
141
160
  listboxRef,
161
+ setAttribute,
162
+ removeAttribute,
142
163
  focusActiveDescendant,
143
164
  blurActiveDescendant,
144
165
  getActiveDescendant
@@ -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 function useActiveDescendant(options) {\n const { imperativeRef, matchOption: matchOptionUnstable } = options;\n const focusVisibleRef = React.useRef(false);\n const activeIdRef = React.useRef(null);\n const activeParentRef = React.useRef(null);\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 var _activeParentRef_current;\n const active = getActiveDescendant();\n if (active) {\n active.removeAttribute(ACTIVEDESCENDANT_ATTRIBUTE);\n active.removeAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE);\n }\n (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.removeAttribute('aria-activedescendant');\n activeIdRef.current = null;\n }, [\n activeParentRef,\n getActiveDescendant\n ]);\n const focusActiveDescendant = React.useCallback((nextActive)=>{\n var _activeParentRef_current;\n if (!nextActive) {\n return;\n }\n blurActiveDescendant();\n scrollIntoView(nextActive, listboxRef.current);\n (_activeParentRef_current = activeParentRef.current) === null || _activeParentRef_current === void 0 ? void 0 : _activeParentRef_current.setAttribute('aria-activedescendant', nextActive.id);\n activeIdRef.current = nextActive.id;\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n if (focusVisibleRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\n }, [\n activeParentRef,\n listboxRef,\n blurActiveDescendant\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 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 }), [\n optionWalker,\n listboxRef,\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":["useActiveDescendant","options","imperativeRef","matchOption","matchOptionUnstable","focusVisibleRef","React","useRef","activeIdRef","activeParentRef","useOnKeyboardNavigationChange","isNavigatingWithKeyboard","current","active","getActiveDescendant","setAttribute","ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","removeAttribute","useEventCallback","listboxRef","optionWalker","listboxCallbackRef","useOptionWalker","useCallback","_listboxRef_current","querySelector","blurActiveDescendant","_activeParentRef_current","ACTIVEDESCENDANT_ATTRIBUTE","focusActiveDescendant","nextActive","scrollIntoView","id","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","_getActiveDescendant","focus","target","find","predicate","startFrom","useImperativeHandle","useMergedRefs"],"mappings":";;;;+BAMgBA;;;eAAAA;;;;iEANO;gCACyB;8BACF;iCACd;2BACoD;gCACrD;AACxB,SAASA,oBAAoBC,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;IACrCG,IAAAA,2CAA6B,EAAC,CAACC;QAC3BN,gBAAgBO,OAAO,GAAGD;QAC1B,MAAME,SAASC;QACf,IAAI,CAACD,QAAQ;YACT;QACJ;QACA,IAAIF,0BAA0B;YAC1BE,OAAOE,YAAY,CAACC,kDAAuC,EAAE;QACjE,OAAO;YACHH,OAAOI,eAAe,CAACD,kDAAuC;QAClE;IACJ;IACA,MAAMb,cAAce,IAAAA,gCAAgB,EAACd;IACrC,MAAMe,aAAab,OAAMC,MAAM,CAAC;IAChC,MAAM,EAAEa,YAAY,EAAEC,kBAAkB,EAAE,GAAGC,IAAAA,gCAAe,EAAC;QACzDnB;IACJ;IACA,MAAMW,sBAAsBR,OAAMiB,WAAW,CAAC;QAC1C,IAAIC;QACJ,OAAO,AAACA,CAAAA,sBAAsBL,WAAWP,OAAO,AAAD,MAAO,QAAQY,wBAAwB,KAAK,IAAI,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AAE,EAAEV,OAAO,EAAEW,SAAS,EAAE,GAAG,CAAC,CAAC;gBACxC,MAAMH,SAASxB,aAAayB,IAAI,CAACC,WAAWC;gBAC5C,IAAI,CAACX,SAAS;oBACVP,sBAAsBe;gBAC1B;gBACA,OAAOA,WAAW,QAAQA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOZ,EAAE;YACpE;QACJ,CAAA,GAAI;QACJZ;QACAD;QACAU;QACAH;QACAZ;KACH;IACDR,OAAM0C,mBAAmB,CAAC9C,eAAe,IAAI+B;IAC7C,OAAO;QACHd,YAAY8B,IAAAA,6BAAa,EAAC9B,YAAYE;QACtCZ;QACAwB;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 function useActiveDescendant(options) {\n const { imperativeRef, matchOption: matchOptionUnstable } = options;\n const focusVisibleRef = React.useRef(false);\n const activeIdRef = 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 activeIdRef.current = null;\n }, [\n getActiveDescendant,\n removeAttribute\n ]);\n const focusActiveDescendant = React.useCallback((nextActive)=>{\n if (!nextActive) {\n return;\n }\n blurActiveDescendant();\n scrollIntoView(nextActive, listboxRef.current);\n setAttribute(nextActive.id);\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n if (focusVisibleRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\n }, [\n listboxRef,\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 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":["useActiveDescendant","options","imperativeRef","matchOption","matchOptionUnstable","focusVisibleRef","React","useRef","activeIdRef","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","focusActiveDescendant","nextActive","scrollIntoView","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","_getActiveDescendant","focus","target","find","predicate","startFrom","showAttributes","hideAttributes","useImperativeHandle","useMergedRefs"],"mappings":";;;;+BAMgBA;;;eAAAA;;;;iEANO;gCACyB;8BACF;iCACd;2BACoD;gCACrD;AACxB,SAASA,oBAAoBC,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,MAAMG,yBAAyBJ,OAAMC,MAAM,CAAC;IAC5C,MAAMI,kBAAkBL,OAAMM,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,eAAeT,OAAMM,WAAW,CAAC,CAACI;QACpC,IAAIA,IAAI;YACJR,YAAYM,OAAO,GAAGE;QAC1B;QACA,IAAIN,uBAAuBI,OAAO,IAAIN,YAAYM,OAAO,EAAE;YACvD,IAAID;YACHA,CAAAA,2BAA2BJ,gBAAgBK,OAAO,AAAD,MAAO,QAAQD,6BAA6B,KAAK,IAAI,KAAK,IAAIA,yBAAyBE,YAAY,CAAC,yBAAyBP,YAAYM,OAAO;QACtM;IACJ,GAAG,EAAE;IACLG,IAAAA,2CAA6B,EAAC,CAACC;QAC3Bb,gBAAgBS,OAAO,GAAGI;QAC1B,MAAMC,SAASC;QACf,IAAI,CAACD,QAAQ;YACT;QACJ;QACA,IAAID,0BAA0B;YAC1BC,OAAOJ,YAAY,CAACM,kDAAuC,EAAE;QACjE,OAAO;YACHF,OAAOR,eAAe,CAACU,kDAAuC;QAClE;IACJ;IACA,MAAMlB,cAAcm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YACJ;YACAC,MAAMC,SAAS,EAAE,EAAEV,OAAO,EAAEW,SAAS,EAAE,GAAG,CAAC,CAAC;gBACxC,MAAMH,SAASrB,aAAasB,IAAI,CAACC,WAAWC;gBAC5C,IAAI,CAACX,SAAS;oBACVN,sBAAsBc;gBAC1B;gBACA,OAAOA,WAAW,QAAQA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAO7B,EAAE;YACpE;YACAiC;gBACIvC,uBAAuBI,OAAO,GAAG;gBACjCC;YACJ;YACAmC;gBACIxC,uBAAuBI,OAAO,GAAG;gBACjCH;YACJ;QACJ,CAAA,GAAI;QACJa;QACAD;QACAR;QACAJ;QACAoB;QACAF;QACAT;KACH;IACDd,OAAM6C,mBAAmB,CAACjD,eAAe,IAAIgC;IAC7C,OAAO;QACHX,YAAY6B,IAAAA,6BAAa,EAAC7B,YAAYE;QACtChB;QACAyB;IACJ;AACJ"}
@@ -9,38 +9,38 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- useARIAButtonShorthand: function() {
13
- return _index.useARIAButtonShorthand;
14
- },
15
- useARIAButtonProps: function() {
16
- return _index.useARIAButtonProps;
17
- },
18
- useActiveDescendant: function() {
19
- return _activedescendant.useActiveDescendant;
20
- },
21
12
  ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE: function() {
22
13
  return _activedescendant.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE;
23
14
  },
24
15
  ActiveDescendantContextProvider: function() {
25
16
  return _activedescendant.ActiveDescendantContextProvider;
26
17
  },
27
- useActiveDescendantContext: function() {
28
- return _activedescendant.useActiveDescendantContext;
29
- },
30
- useHasParentActiveDescendantContext: function() {
31
- return _activedescendant.useHasParentActiveDescendantContext;
32
- },
33
18
  AriaLiveAnnouncer: function() {
34
19
  return _index1.AriaLiveAnnouncer;
35
20
  },
36
21
  renderAriaLiveAnnouncer_unstable: function() {
37
22
  return _index1.renderAriaLiveAnnouncer_unstable;
38
23
  },
39
- useAriaLiveAnnouncer_unstable: function() {
40
- return _index1.useAriaLiveAnnouncer_unstable;
24
+ useARIAButtonProps: function() {
25
+ return _index.useARIAButtonProps;
26
+ },
27
+ useARIAButtonShorthand: function() {
28
+ return _index.useARIAButtonShorthand;
29
+ },
30
+ useActiveDescendant: function() {
31
+ return _activedescendant.useActiveDescendant;
32
+ },
33
+ useActiveDescendantContext: function() {
34
+ return _activedescendant.useActiveDescendantContext;
41
35
  },
42
36
  useAriaLiveAnnouncerContextValues_unstable: function() {
43
37
  return _index1.useAriaLiveAnnouncerContextValues_unstable;
38
+ },
39
+ useAriaLiveAnnouncer_unstable: function() {
40
+ return _index1.useAriaLiveAnnouncer_unstable;
41
+ },
42
+ useHasParentActiveDescendantContext: function() {
43
+ return _activedescendant.useHasParentActiveDescendantContext;
44
44
  }
45
45
  });
46
46
  const _index = require("./button/index");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { // eslint-disable-next-line deprecation/deprecation\nuseARIAButtonShorthand, useARIAButtonProps } from './button/index';\nexport { useActiveDescendant, ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, ActiveDescendantContextProvider, useActiveDescendantContext, useHasParentActiveDescendantContext } from './activedescendant';\nexport { AriaLiveAnnouncer, renderAriaLiveAnnouncer_unstable, useAriaLiveAnnouncer_unstable, useAriaLiveAnnouncerContextValues_unstable } from './AriaLiveAnnouncer/index';\n"],"names":["useARIAButtonShorthand","useARIAButtonProps","useActiveDescendant","ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","ActiveDescendantContextProvider","useActiveDescendantContext","useHasParentActiveDescendantContext","AriaLiveAnnouncer","renderAriaLiveAnnouncer_unstable","useAriaLiveAnnouncer_unstable","useAriaLiveAnnouncerContextValues_unstable"],"mappings":";;;;;;;;;;;IACAA,sBAAsB;eAAtBA,6BAAsB;;IAAEC,kBAAkB;eAAlBA,yBAAkB;;IACjCC,mBAAmB;eAAnBA,qCAAmB;;IAAEC,uCAAuC;eAAvCA,yDAAuC;;IAAEC,+BAA+B;eAA/BA,iDAA+B;;IAAEC,0BAA0B;eAA1BA,4CAA0B;;IAAEC,mCAAmC;eAAnCA,qDAAmC;;IAC9JC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,gCAAgC;eAAhCA,wCAAgC;;IAAEC,6BAA6B;eAA7BA,qCAA6B;;IAAEC,0CAA0C;eAA1CA,kDAA0C;;;uBAFrF;kCAC6H;wBAChC"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { // eslint-disable-next-line deprecation/deprecation\nuseARIAButtonShorthand, useARIAButtonProps } from './button/index';\nexport { useActiveDescendant, ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, ActiveDescendantContextProvider, useActiveDescendantContext, useHasParentActiveDescendantContext } from './activedescendant';\nexport { AriaLiveAnnouncer, renderAriaLiveAnnouncer_unstable, useAriaLiveAnnouncer_unstable, useAriaLiveAnnouncerContextValues_unstable } from './AriaLiveAnnouncer/index';\n"],"names":["ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","ActiveDescendantContextProvider","AriaLiveAnnouncer","renderAriaLiveAnnouncer_unstable","useARIAButtonProps","useARIAButtonShorthand","useActiveDescendant","useActiveDescendantContext","useAriaLiveAnnouncerContextValues_unstable","useAriaLiveAnnouncer_unstable","useHasParentActiveDescendantContext"],"mappings":";;;;;;;;;;;IAE8BA,uCAAuC;eAAvCA,yDAAuC;;IAAEC,+BAA+B;eAA/BA,iDAA+B;;IAC7FC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,gCAAgC;eAAhCA,wCAAgC;;IAFpCC,kBAAkB;eAAlBA,yBAAkB;;IAA1CC,sBAAsB;eAAtBA,6BAAsB;;IACbC,mBAAmB;eAAnBA,qCAAmB;;IAA4EC,0BAA0B;eAA1BA,4CAA0B;;IACrCC,0CAA0C;eAA1CA,kDAA0C;;IAAzEC,6BAA6B;eAA7BA,qCAA6B;;IADyCC,mCAAmC;eAAnCA,qDAAmC;;;uBADrH;kCAC6H;wBAChC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-aria",
3
- "version": "9.9.1",
3
+ "version": "9.10.1",
4
4
  "description": "React helper to ensure ARIA",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -34,10 +34,10 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@fluentui/keyboard-keys": "^9.0.7",
37
- "@fluentui/react-shared-contexts": "^9.14.1",
38
- "@fluentui/react-jsx-runtime": "^9.0.31",
39
- "@fluentui/react-tabster": "^9.19.2",
40
- "@fluentui/react-utilities": "^9.18.2",
37
+ "@fluentui/react-shared-contexts": "^9.15.1",
38
+ "@fluentui/react-jsx-runtime": "^9.0.33",
39
+ "@fluentui/react-tabster": "^9.19.4",
40
+ "@fluentui/react-utilities": "^9.18.4",
41
41
  "@swc/helpers": "^0.5.1"
42
42
  },
43
43
  "peerDependencies": {