@fluentui/react-aria 0.0.0-nightly-20240430-0406.1 → 0.0.0-nightly-20240502-0405.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,23 +1,23 @@
1
1
  # Change Log - @fluentui/react-aria
2
2
 
3
- This log was last generated on Tue, 30 Apr 2024 04:21:52 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 02 May 2024 04:21:57 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20240430-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v0.0.0-nightly-20240430-0406.1)
7
+ ## [0.0.0-nightly-20240502-0405.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v0.0.0-nightly-20240502-0405.1)
8
8
 
9
- Tue, 30 Apr 2024 04:21:52 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.10.5..@fluentui/react-aria_v0.0.0-nightly-20240430-0406.1)
9
+ Thu, 02 May 2024 04:21:57 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-aria_v9.10.5..@fluentui/react-aria_v0.0.0-nightly-20240502-0405.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20240430-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/7b15f81487e6599238af033c9da52974bae7c7c7) by beachball)
16
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240430-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/7b15f81487e6599238af033c9da52974bae7c7c7) by beachball)
17
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20240430-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/7b15f81487e6599238af033c9da52974bae7c7c7) by beachball)
18
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20240430-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/7b15f81487e6599238af033c9da52974bae7c7c7) by beachball)
19
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20240430-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/7b15f81487e6599238af033c9da52974bae7c7c7) by beachball)
20
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20240430-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/7b15f81487e6599238af033c9da52974bae7c7c7) by beachball)
15
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20240502-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/a4d942fed844dbf02dbda091f13228505ad622c6) by beachball)
16
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240502-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/a4d942fed844dbf02dbda091f13228505ad622c6) by beachball)
17
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20240502-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/a4d942fed844dbf02dbda091f13228505ad622c6) by beachball)
18
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20240502-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/a4d942fed844dbf02dbda091f13228505ad622c6) by beachball)
19
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20240502-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/a4d942fed844dbf02dbda091f13228505ad622c6) by beachball)
20
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20240502-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/a4d942fed844dbf02dbda091f13228505ad622c6) by beachball)
21
21
 
22
22
  ## [9.10.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-aria_v9.10.5)
23
23
 
package/dist/index.d.ts CHANGED
@@ -10,6 +10,13 @@ import type { UnionToIntersection } from '@fluentui/react-utilities';
10
10
  */
11
11
  export declare const ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE = "data-activedescendant-focusvisible";
12
12
 
13
+ export declare type ActiveDescendantChangeEvent = CustomEvent<ActiveDescendantChangeEventDetail>;
14
+
15
+ declare interface ActiveDescendantChangeEventDetail {
16
+ id: string;
17
+ previousId: string | null;
18
+ }
19
+
13
20
  export declare const ActiveDescendantContextProvider: React_2.Provider<ActiveDescendantContextValue | undefined>;
14
21
 
15
22
  export declare type ActiveDescendantContextValue = {
@@ -4,6 +4,12 @@ import { useOnKeyboardNavigationChange } from '@fluentui/react-tabster';
4
4
  import { useOptionWalker } from './useOptionWalker';
5
5
  import { ACTIVEDESCENDANT_ATTRIBUTE, ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE } from './constants';
6
6
  import { scrollIntoView } from './scrollIntoView';
7
+ export const createActiveDescendantChangeEvent = (detail)=>new CustomEvent('activedescendantchange', {
8
+ bubbles: true,
9
+ cancelable: false,
10
+ composed: true,
11
+ detail
12
+ });
7
13
  export function useActiveDescendant(options) {
8
14
  const { imperativeRef, matchOption: matchOptionUnstable } = options;
9
15
  const focusVisibleRef = React.useRef(false);
@@ -56,6 +62,8 @@ export function useActiveDescendant(options) {
56
62
  removeAttribute();
57
63
  lastActiveIdRef.current = activeIdRef.current;
58
64
  activeIdRef.current = null;
65
+ var _active_id;
66
+ return (_active_id = active === null || active === void 0 ? void 0 : active.id) !== null && _active_id !== void 0 ? _active_id : null;
59
67
  }, [
60
68
  getActiveDescendant,
61
69
  removeAttribute
@@ -64,13 +72,18 @@ export function useActiveDescendant(options) {
64
72
  if (!nextActive) {
65
73
  return;
66
74
  }
67
- blurActiveDescendant();
75
+ const previousActiveId = blurActiveDescendant();
68
76
  scrollIntoView(nextActive);
69
77
  setAttribute(nextActive.id);
70
78
  nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');
71
79
  if (focusVisibleRef.current) {
72
80
  nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
73
81
  }
82
+ const event = createActiveDescendantChangeEvent({
83
+ id: nextActive.id,
84
+ previousId: previousActiveId
85
+ });
86
+ nextActive.dispatchEvent(event);
74
87
  }, [
75
88
  blurActiveDescendant,
76
89
  setAttribute
@@ -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 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 }, [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);\n setAttribute(nextActive.id);\n nextActive.setAttribute(ACTIVEDESCENDANT_ATTRIBUTE, '');\n\n if (focusVisibleRef.current) {\n nextActive.setAttribute(ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');\n }\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","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","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,EAAE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,IAAI,CAACC,WAAWC;gBAC5C,IAAI,CAACX,SAAS;oBACZL,sBAAsBY;gBACxB;gBAEA,OAAOA,mBAAAA,6BAAAA,OAAQrB,EAAE;YACnB;YACA0B;gBACE/B,uBAAuBG,OAAO,GAAG;gBACjCC;YACF;YACA4B;gBACEhC,uBAAuBG,OAAO,GAAG;gBACjCF;YACF;QACF,CAAA,GACA;QACES;QACAD;QACAL;QACAH;QACAa;QACAD;QACAL;KACD;IAGH1B,MAAMmD,mBAAmB,CAACzC,eAAe,IAAMwB;IAE/C,OAAO;QAAEP,YAAYzB,cAAcyB,YAAYE;QAAqBZ;QAAiBiB;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 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,kBAAkBtB,MAAMoB,MAAM,CAAgB;IACpD,MAAMG,kBAA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C,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"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n // eslint-disable-next-line deprecation/deprecation\n useARIAButtonShorthand,\n useARIAButtonProps,\n} from './button/index';\nexport {\n useActiveDescendant,\n ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE,\n ActiveDescendantContextProvider,\n useActiveDescendantContext,\n useHasParentActiveDescendantContext,\n} from './activedescendant';\nexport type {\n ActiveDescendantImperativeRef,\n ActiveDescendantOptions,\n ActiveDescendantContextValue,\n} from './activedescendant';\nexport type {\n ARIAButtonSlotProps,\n ARIAButtonProps,\n ARIAButtonResultProps,\n ARIAButtonType,\n ARIAButtonElement,\n ARIAButtonElementIntersection,\n ARIAButtonAlteredProps,\n} from './button/index';\n\nexport {\n AriaLiveAnnouncer,\n renderAriaLiveAnnouncer_unstable,\n useAriaLiveAnnouncer_unstable,\n useAriaLiveAnnouncerContextValues_unstable,\n} from './AriaLiveAnnouncer/index';\nexport type { AriaLiveAnnouncerProps, AriaLiveAnnouncerState } from './AriaLiveAnnouncer/index';\n"],"names":["useARIAButtonShorthand","useARIAButtonProps","useActiveDescendant","ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","ActiveDescendantContextProvider","useActiveDescendantContext","useHasParentActiveDescendantContext","AriaLiveAnnouncer","renderAriaLiveAnnouncer_unstable","useAriaLiveAnnouncer_unstable","useAriaLiveAnnouncerContextValues_unstable"],"mappings":"AAAA,SACE,mDAAmD;AACnDA,sBAAsB,EACtBC,kBAAkB,QACb,iBAAiB;AACxB,SACEC,mBAAmB,EACnBC,uCAAuC,EACvCC,+BAA+B,EAC/BC,0BAA0B,EAC1BC,mCAAmC,QAC9B,qBAAqB;AAgB5B,SACEC,iBAAiB,EACjBC,gCAAgC,EAChCC,6BAA6B,EAC7BC,0CAA0C,QACrC,4BAA4B"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n // eslint-disable-next-line deprecation/deprecation\n useARIAButtonShorthand,\n useARIAButtonProps,\n} from './button/index';\nexport {\n useActiveDescendant,\n ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE,\n ActiveDescendantContextProvider,\n useActiveDescendantContext,\n useHasParentActiveDescendantContext,\n} from './activedescendant';\nexport type {\n ActiveDescendantImperativeRef,\n ActiveDescendantOptions,\n ActiveDescendantContextValue,\n ActiveDescendantChangeEvent,\n} from './activedescendant';\nexport type {\n ARIAButtonSlotProps,\n ARIAButtonProps,\n ARIAButtonResultProps,\n ARIAButtonType,\n ARIAButtonElement,\n ARIAButtonElementIntersection,\n ARIAButtonAlteredProps,\n} from './button/index';\n\nexport {\n AriaLiveAnnouncer,\n renderAriaLiveAnnouncer_unstable,\n useAriaLiveAnnouncer_unstable,\n useAriaLiveAnnouncerContextValues_unstable,\n} from './AriaLiveAnnouncer/index';\nexport type { AriaLiveAnnouncerProps, AriaLiveAnnouncerState } from './AriaLiveAnnouncer/index';\n"],"names":["useARIAButtonShorthand","useARIAButtonProps","useActiveDescendant","ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE","ActiveDescendantContextProvider","useActiveDescendantContext","useHasParentActiveDescendantContext","AriaLiveAnnouncer","renderAriaLiveAnnouncer_unstable","useAriaLiveAnnouncer_unstable","useAriaLiveAnnouncerContextValues_unstable"],"mappings":"AAAA,SACE,mDAAmD;AACnDA,sBAAsB,EACtBC,kBAAkB,QACb,iBAAiB;AACxB,SACEC,mBAAmB,EACnBC,uCAAuC,EACvCC,+BAA+B,EAC/BC,0BAA0B,EAC1BC,mCAAmC,QAC9B,qBAAqB;AAiB5B,SACEC,iBAAiB,EACjBC,gCAAgC,EAChCC,6BAA6B,EAC7BC,0CAA0C,QACrC,4BAA4B"}
@@ -2,9 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "useActiveDescendant", {
6
- enumerable: true,
7
- get: function() {
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ createActiveDescendantChangeEvent: function() {
13
+ return createActiveDescendantChangeEvent;
14
+ },
15
+ useActiveDescendant: function() {
8
16
  return useActiveDescendant;
9
17
  }
10
18
  });
@@ -15,6 +23,12 @@ const _reacttabster = require("@fluentui/react-tabster");
15
23
  const _useOptionWalker = require("./useOptionWalker");
16
24
  const _constants = require("./constants");
17
25
  const _scrollIntoView = require("./scrollIntoView");
26
+ const createActiveDescendantChangeEvent = (detail)=>new CustomEvent('activedescendantchange', {
27
+ bubbles: true,
28
+ cancelable: false,
29
+ composed: true,
30
+ detail
31
+ });
18
32
  function useActiveDescendant(options) {
19
33
  const { imperativeRef, matchOption: matchOptionUnstable } = options;
20
34
  const focusVisibleRef = _react.useRef(false);
@@ -67,6 +81,8 @@ function useActiveDescendant(options) {
67
81
  removeAttribute();
68
82
  lastActiveIdRef.current = activeIdRef.current;
69
83
  activeIdRef.current = null;
84
+ var _active_id;
85
+ return (_active_id = active === null || active === void 0 ? void 0 : active.id) !== null && _active_id !== void 0 ? _active_id : null;
70
86
  }, [
71
87
  getActiveDescendant,
72
88
  removeAttribute
@@ -75,13 +91,18 @@ function useActiveDescendant(options) {
75
91
  if (!nextActive) {
76
92
  return;
77
93
  }
78
- blurActiveDescendant();
94
+ const previousActiveId = blurActiveDescendant();
79
95
  (0, _scrollIntoView.scrollIntoView)(nextActive);
80
96
  setAttribute(nextActive.id);
81
97
  nextActive.setAttribute(_constants.ACTIVEDESCENDANT_ATTRIBUTE, '');
82
98
  if (focusVisibleRef.current) {
83
99
  nextActive.setAttribute(_constants.ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE, '');
84
100
  }
101
+ const event = createActiveDescendantChangeEvent({
102
+ id: nextActive.id,
103
+ previousId: previousActiveId
104
+ });
105
+ nextActive.dispatchEvent(event);
85
106
  }, [
86
107
  blurActiveDescendant,
87
108
  setAttribute
@@ -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 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 }, [\n getActiveDescendant,\n removeAttribute\n ]);\n const focusActiveDescendant = React.useCallback((nextActive)=>{\n if (!nextActive) {\n return;\n }\n 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 }, [\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":["useActiveDescendant","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","focusActiveDescendant","nextActive","scrollIntoView","controller","useMemo","first","passive","last","next","setCurrent","prev","blur","_getActiveDescendant","focus","target","focusLastActive","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,kBAAkBJ,OAAMC,MAAM,CAAC;IACrC,MAAMI,yBAAyBL,OAAMC,MAAM,CAAC;IAC5C,MAAMK,kBAAkBN,OAAMO,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,eAAeV,OAAMO,WAAW,CAAC,CAACI;QACpC,IAAIA,IAAI;YACJT,YAAYO,OAAO,GAAGE;QAC1B;QACA,IAAIN,uBAAuBI,OAAO,IAAIP,YAAYO,OAAO,EAAE;YACvD,IAAID;YACHA,CAAAA,2BAA2BJ,gBAAgBK,OAAO,AAAD,MAAO,QAAQD,6BAA6B,KAAK,IAAI,KAAK,IAAIA,yBAAyBE,YAAY,CAAC,yBAAyBR,YAAYO,OAAO;QACtM;IACJ,GAAG,EAAE;IACLG,IAAAA,2CAA6B,EAAC,CAACC;QAC3Bd,gBAAgBU,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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Z,GAAG,CAAC;gBACxD,IAAI6B,QAAQ;oBACRd,sBAAsBc;gBAC1B;YACJ;YACAC,iBAAiB;gBACb,IAAI,CAACvB,WAAWT,OAAO,IAAI,CAACN,gBAAgBM,OAAO,EAAE;oBACjD;gBACJ;gBACA,MAAM+B,SAAStB,WAAWT,OAAO,CAACc,aAAa,CAAC,CAAC,CAAC,EAAEpB,gBAAgBM,OAAO,CAAC,CAAC;gBAC7E,IAAI+B,QAAQ;oBACRd,sBAAsBc;oBACtB,OAAO;gBACX;YACJ;YACAE,MAAMC,SAAS,EAAE,EAAEX,OAAO,EAAEY,SAAS,EAAE,GAAG,CAAC,CAAC;gBACxC,MAAMJ,SAASrB,aAAauB,IAAI,CAACC,WAAWC;gBAC5C,IAAI,CAACZ,SAAS;oBACVN,sBAAsBc;gBAC1B;gBACA,OAAOA,WAAW,QAAQA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAO7B,EAAE;YACpE;YACAkC;gBACIxC,uBAAuBI,OAAO,GAAG;gBACjCC;YACJ;YACAoC;gBACIzC,uBAAuBI,OAAO,GAAG;gBACjCH;YACJ;QACJ,CAAA,GAAI;QACJa;QACAD;QACAR;QACAJ;QACAoB;QACAF;QACAT;KACH;IACDf,OAAM+C,mBAAmB,CAACnD,eAAe,IAAIiC;IAC7C,OAAO;QACHX,YAAY8B,IAAAA,6BAAa,EAAC9B,YAAYE;QACtChB;QACAyB;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 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,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AAK,IAAIA,qBAAqBhC,EAAE;YACxI;YACAiC,OAAO,CAACjC;gBACJ,IAAI,CAACO,WAAWT,OAAO,EAAE;oBACrB;gBACJ;gBACA,MAAMoC,SAAS3B,WAAWT,OAAO,CAACc,aAAa,CAAC,CAAC,CAAC,EAAEZ,GAAG,CAAC;gBACxD,IAAIkC,QAAQ;oBACRlB,sBAAsBkB;gBAC1B;YACJ;YACAC,iBAAiB;gBACb,IAAI,CAAC5B,WAAWT,OAAO,IAAI,CAACN,gBAAgBM,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-aria",
3
- "version": "0.0.0-nightly-20240430-0406.1",
3
+ "version": "0.0.0-nightly-20240502-0405.1",
4
4
  "description": "React helper to ensure ARIA",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -28,16 +28,16 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@fluentui/eslint-plugin": "*",
31
- "@fluentui/react-conformance": "0.0.0-nightly-20240430-0406.1",
31
+ "@fluentui/react-conformance": "0.0.0-nightly-20240502-0405.1",
32
32
  "@fluentui/scripts-api-extractor": "*",
33
33
  "@fluentui/scripts-tasks": "*"
34
34
  },
35
35
  "dependencies": {
36
- "@fluentui/keyboard-keys": "0.0.0-nightly-20240430-0406.1",
37
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20240430-0406.1",
38
- "@fluentui/react-jsx-runtime": "0.0.0-nightly-20240430-0406.1",
39
- "@fluentui/react-tabster": "0.0.0-nightly-20240430-0406.1",
40
- "@fluentui/react-utilities": "0.0.0-nightly-20240430-0406.1",
36
+ "@fluentui/keyboard-keys": "0.0.0-nightly-20240502-0405.1",
37
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20240502-0405.1",
38
+ "@fluentui/react-jsx-runtime": "0.0.0-nightly-20240502-0405.1",
39
+ "@fluentui/react-tabster": "0.0.0-nightly-20240502-0405.1",
40
+ "@fluentui/react-utilities": "0.0.0-nightly-20240502-0405.1",
41
41
  "@swc/helpers": "^0.5.1"
42
42
  },
43
43
  "peerDependencies": {