@fluentui/react-tree 9.16.10 → 9.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -2
- package/dist/index.d.cts +83 -6
- package/dist/index.d.ts +83 -6
- package/lib/Tree.js +1 -1
- package/lib/Tree.js.map +1 -1
- package/lib/TreeItemLayout.js +1 -1
- package/lib/TreeItemLayout.js.map +1 -1
- package/lib/components/FlatTree/useFlatTree.js +28 -3
- package/lib/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib/components/Tree/Tree.types.js +1 -1
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/index.js +1 -1
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/Tree/renderTree.js +6 -2
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/components/Tree/useTree.js +75 -6
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js +4 -1
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib/components/TreeItemLayout/index.js +1 -1
- package/lib/components/TreeItemLayout/index.js.map +1 -1
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js +13 -7
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +201 -30
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/hooks/useFlatTreeNavigation.js +3 -4
- package/lib/hooks/useFlatTreeNavigation.js.map +1 -1
- package/lib/hooks/useRootTree.js +3 -8
- package/lib/hooks/useRootTree.js.map +1 -1
- package/lib/hooks/useRovingTabIndexBase.js +108 -0
- package/lib/hooks/useRovingTabIndexBase.js.map +1 -0
- package/lib/hooks/useRovingTabIndexes.js +2 -61
- package/lib/hooks/useRovingTabIndexes.js.map +1 -1
- package/lib/hooks/useSubtree.js +1 -11
- package/lib/hooks/useSubtree.js.map +1 -1
- package/lib/hooks/useTreeNavigation.js +6 -84
- package/lib/hooks/useTreeNavigation.js.map +1 -1
- package/lib/hooks/useTreeNavigationBase.js +131 -0
- package/lib/hooks/useTreeNavigationBase.js.map +1 -0
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/queryTreeItemActions.js +29 -0
- package/lib/utils/queryTreeItemActions.js.map +1 -0
- package/lib-commonjs/Tree.cjs +3 -0
- package/lib-commonjs/Tree.cjs.map +1 -1
- package/lib-commonjs/TreeItemLayout.cjs +3 -0
- package/lib-commonjs/TreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTree.cjs +28 -3
- package/lib-commonjs/components/FlatTree/useFlatTree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/Tree.types.cjs +1 -1
- package/lib-commonjs/components/Tree/Tree.types.cjs.map +1 -1
- package/lib-commonjs/components/Tree/index.cjs +3 -0
- package/lib-commonjs/components/Tree/index.cjs.map +1 -1
- package/lib-commonjs/components/Tree/renderTree.cjs +1 -1
- package/lib-commonjs/components/Tree/renderTree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTree.cjs +68 -8
- package/lib-commonjs/components/Tree/useTree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.cjs +4 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/index.cjs +3 -0
- package/lib-commonjs/components/TreeItemLayout/index.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs +9 -6
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs +200 -32
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/hooks/useFlatTreeNavigation.cjs +3 -4
- package/lib-commonjs/hooks/useFlatTreeNavigation.cjs.map +1 -1
- package/lib-commonjs/hooks/useRootTree.cjs +3 -8
- package/lib-commonjs/hooks/useRootTree.cjs.map +1 -1
- package/lib-commonjs/hooks/useRovingTabIndexBase.cjs +116 -0
- package/lib-commonjs/hooks/useRovingTabIndexBase.cjs.map +1 -0
- package/lib-commonjs/hooks/useRovingTabIndexes.cjs +2 -62
- package/lib-commonjs/hooks/useRovingTabIndexes.cjs.map +1 -1
- package/lib-commonjs/hooks/useSubtree.cjs +1 -11
- package/lib-commonjs/hooks/useSubtree.cjs.map +1 -1
- package/lib-commonjs/hooks/useTreeNavigation.cjs +5 -84
- package/lib-commonjs/hooks/useTreeNavigation.cjs.map +1 -1
- package/lib-commonjs/hooks/useTreeNavigationBase.cjs +140 -0
- package/lib-commonjs/hooks/useTreeNavigationBase.cjs.map +1 -0
- package/lib-commonjs/index.cjs +6 -0
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/utils/queryTreeItemActions.cjs +38 -0
- package/lib-commonjs/utils/queryTreeItemActions.cjs.map +1 -0
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ const _getTreeItemValueFromElement = require("../utils/getTreeItemValueFromEleme
|
|
|
18
18
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
19
19
|
const _useHTMLElementWalkerRef = require("./useHTMLElementWalkerRef.cjs");
|
|
20
20
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
21
|
-
const
|
|
21
|
+
const _queryTreeItemActions = require("../utils/queryTreeItemActions.cjs");
|
|
22
22
|
function useFlatTreeNavigation(navigationMode = 'tree') {
|
|
23
23
|
'use no memo'; // justified: compiler would optimize useFlatTreeNavigation — manual opt-out to preserve runtime behavior
|
|
24
24
|
const { walkerRef, rootRef: walkerRootRef } = (0, _useHTMLElementWalkerRef.useHTMLElementWalkerRef)();
|
|
@@ -44,7 +44,7 @@ function useFlatTreeNavigation(navigationMode = 'tree') {
|
|
|
44
44
|
return (0, _nextTypeAheadElement.nextTypeAheadElement)(walkerRef.current, data.event.key);
|
|
45
45
|
case _tokens.treeDataTypes.ArrowLeft:
|
|
46
46
|
{
|
|
47
|
-
const actions =
|
|
47
|
+
const actions = (0, _queryTreeItemActions.queryTreeItemActions)(data.target);
|
|
48
48
|
if (navigationMode === 'treegrid' && (actions === null || actions === void 0 ? void 0 : actions.contains(data.target.ownerDocument.activeElement))) {
|
|
49
49
|
return data.target;
|
|
50
50
|
}
|
|
@@ -60,7 +60,7 @@ No parent element found for the current element:`, data.target);
|
|
|
60
60
|
case _tokens.treeDataTypes.ArrowRight:
|
|
61
61
|
{
|
|
62
62
|
if (navigationMode === 'treegrid') {
|
|
63
|
-
const actions =
|
|
63
|
+
const actions = (0, _queryTreeItemActions.queryTreeItemActions)(data.target);
|
|
64
64
|
if (actions) {
|
|
65
65
|
var _findFirstFocusable;
|
|
66
66
|
(_findFirstFocusable = findFirstFocusable(actions)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();
|
|
@@ -124,4 +124,3 @@ function parentElement(parentValue, treeWalker) {
|
|
|
124
124
|
}
|
|
125
125
|
return treeWalker.root.querySelector(`[${_getTreeItemValueFromElement.dataTreeItemValueAttrName}="${parentValue}"]`);
|
|
126
126
|
}
|
|
127
|
-
const queryActions = (target)=>target.querySelector(`:scope > .${_TreeItemLayout.treeItemLayoutClassNames.root} > .${_TreeItemLayout.treeItemLayoutClassNames.actions}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useFlatTreeNavigation.ts"],"sourcesContent":["'use client';\n\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TreeNavigationData_unstable } from '../Tree';\nimport { nextTypeAheadElement } from '../utils/nextTypeAheadElement';\nimport { treeDataTypes } from '../utils/tokens';\nimport { useRovingTabIndex } from './useRovingTabIndexes';\nimport type { HTMLElementWalker } from '../utils/createHTMLElementWalker';\nimport type { TreeItemValue } from '../TreeItem';\nimport { dataTreeItemValueAttrName } from '../utils/getTreeItemValueFromElement';\nimport * as React from 'react';\nimport { useHTMLElementWalkerRef } from './useHTMLElementWalkerRef';\nimport type { TreeNavigationMode } from '../components/Tree/Tree.types';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useFlatTreeNavigation.ts"],"sourcesContent":["'use client';\n\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TreeNavigationData_unstable } from '../Tree';\nimport { nextTypeAheadElement } from '../utils/nextTypeAheadElement';\nimport { treeDataTypes } from '../utils/tokens';\nimport { useRovingTabIndex } from './useRovingTabIndexes';\nimport type { HTMLElementWalker } from '../utils/createHTMLElementWalker';\nimport type { TreeItemValue } from '../TreeItem';\nimport { dataTreeItemValueAttrName } from '../utils/getTreeItemValueFromElement';\nimport * as React from 'react';\nimport { useHTMLElementWalkerRef } from './useHTMLElementWalkerRef';\nimport type { TreeNavigationMode } from '../components/Tree/Tree.types';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { queryTreeItemActions } from '../utils/queryTreeItemActions';\n\nexport function useFlatTreeNavigation(navigationMode: TreeNavigationMode = 'tree'): {\n navigate: (data: TreeNavigationData_unstable) => void;\n rootRef: React.RefCallback<HTMLElement>;\n forceUpdateRovingTabIndex: () => void;\n} {\n 'use no memo'; // justified: compiler would optimize useFlatTreeNavigation — manual opt-out to preserve runtime behavior\n\n const { walkerRef, rootRef: walkerRootRef } = useHTMLElementWalkerRef();\n const { rove, forceUpdate: forceUpdateRovingTabIndex, initialize: initializeRovingTabIndex } = useRovingTabIndex();\n const { findFirstFocusable } = useFocusFinders();\n\n const rootRefCallback: React.RefCallback<HTMLElement> = React.useCallback(\n root => {\n if (walkerRef.current && root) {\n initializeRovingTabIndex(walkerRef.current);\n }\n },\n [initializeRovingTabIndex, walkerRef],\n );\n\n function getNextElement(data: TreeNavigationData_unstable) {\n if (!walkerRef.current) {\n return null;\n }\n switch (data.type) {\n case treeDataTypes.Click:\n return data.target;\n case treeDataTypes.TypeAhead:\n walkerRef.current.currentElement = data.target;\n return nextTypeAheadElement(walkerRef.current, data.event.key);\n case treeDataTypes.ArrowLeft: {\n const actions = queryTreeItemActions(data.target);\n if (navigationMode === 'treegrid' && actions?.contains(data.target.ownerDocument.activeElement)) {\n return data.target;\n }\n const nextElement = parentElement(data.parentValue, walkerRef.current);\n if (!nextElement && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n /* #__DE-INDENT__ */ `\n @fluentui/react-tree [useFlatTreeNavigation]:\n \\'ArrowLeft\\' navigation was not possible.\n No parent element found for the current element:\n `,\n data.target,\n );\n }\n return nextElement;\n }\n case treeDataTypes.ArrowRight: {\n if (navigationMode === 'treegrid') {\n const actions = queryTreeItemActions(data.target);\n if (actions) {\n findFirstFocusable(actions)?.focus();\n }\n return null;\n }\n walkerRef.current.currentElement = data.target;\n const nextElement = firstChild(data.target, walkerRef.current);\n if (!nextElement && process.env.NODE_ENV !== 'production') {\n const ariaLevel = Number(data.target.getAttribute('aria-level'));\n // eslint-disable-next-line no-console\n console.warn(\n /* #__DE-INDENT__ */ `\n @fluentui/react-tree [useFlatTreeNavigation]:\n \\'ArrowRight\\' navigation was not possible.\n No element with \"aria-posinset=1\" and \"aria-level=${ariaLevel + 1}\"\n was found after the current element!\n `,\n data.target,\n );\n }\n return nextElement;\n }\n case treeDataTypes.End:\n walkerRef.current.currentElement = walkerRef.current.root;\n return walkerRef.current.lastChild();\n case treeDataTypes.Home:\n walkerRef.current.currentElement = walkerRef.current.root;\n return walkerRef.current.firstChild();\n case treeDataTypes.ArrowDown:\n walkerRef.current.currentElement = data.target;\n return walkerRef.current.nextElement();\n case treeDataTypes.ArrowUp:\n walkerRef.current.currentElement = data.target;\n return walkerRef.current.previousElement();\n }\n }\n const navigate = useEventCallback((data: TreeNavigationData_unstable) => {\n const nextElement = getNextElement(data);\n if (nextElement) {\n rove(nextElement);\n }\n });\n return {\n navigate,\n rootRef: useMergedRefs<HTMLElement>(walkerRootRef, rootRefCallback),\n forceUpdateRovingTabIndex,\n } as const;\n}\n\nfunction firstChild(target: HTMLElement, treeWalker: HTMLElementWalker): HTMLElement | null {\n const nextElement = treeWalker.nextElement();\n if (!nextElement) {\n return null;\n }\n const nextElementAriaPosInSet = nextElement.getAttribute('aria-posinset');\n const nextElementAriaLevel = nextElement.getAttribute('aria-level');\n const targetAriaLevel = target.getAttribute('aria-level');\n if (nextElementAriaPosInSet === '1' && Number(nextElementAriaLevel) === Number(targetAriaLevel) + 1) {\n return nextElement;\n }\n return null;\n}\n\nfunction parentElement(parentValue: TreeItemValue | undefined, treeWalker: HTMLElementWalker) {\n if (parentValue === undefined) {\n return null;\n }\n return treeWalker.root.querySelector<HTMLElement>(`[${dataTreeItemValueAttrName}=\"${parentValue}\"]`);\n}\n"],"names":["useEventCallback","useMergedRefs","nextTypeAheadElement","treeDataTypes","useRovingTabIndex","dataTreeItemValueAttrName","React","useHTMLElementWalkerRef","useFocusFinders","queryTreeItemActions","useFlatTreeNavigation","navigationMode","walkerRef","rootRef","walkerRootRef","rove","forceUpdate","forceUpdateRovingTabIndex","initialize","initializeRovingTabIndex","findFirstFocusable","rootRefCallback","useCallback","root","current","getNextElement","data","type","Click","target","TypeAhead","currentElement","event","key","ArrowLeft","actions","contains","ownerDocument","activeElement","nextElement","parentElement","parentValue","process","env","NODE_ENV","console","warn","ArrowRight","focus","firstChild","ariaLevel","Number","getAttribute","End","lastChild","Home","ArrowDown","ArrowUp","previousElement","navigate","treeWalker","nextElementAriaPosInSet","nextElementAriaLevel","targetAriaLevel","undefined","querySelector"],"mappings":"AAAA;;;;;+BAgBgBU;;;;;;;gCAdgC,4BAA4B;sCAEvC,mCAAgC;wBACvC,qBAAkB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,UAAUY,OAAO,CAACe,WAAW;YACtC,KAAKpC,qBAAAA,CAAcsD,OAAO;gBACxB7C,UAAUY,OAAO,CAACO,cAAc,GAAGL,KAAKG,MAAM;gBAC9C,OAAOjB,UAAUY,OAAO,CAACkC,eAAe;QAC5C;IACF;IACA,MAAMC,eAAW3D,gCAAAA,EAAiB,CAAC0B;QACjC,MAAMa,cAAcd,eAAeC;QACnC,IAAIa,aAAa;YACfxB,KAAKwB;QACP;IACF;IACA,OAAO;QACLoB;QACA9C,aAASZ,6BAAAA,EAA2Ba,eAAeO;QACnDJ;IACF;AACF;AAEA,SAASgC,WAAWpB,MAAmB,EAAE+B,UAA6B;IACpE,MAAMrB,cAAcqB,WAAWrB,WAAW;IAC1C,IAAI,CAACA,aAAa;QAChB,OAAO;IACT;IACA,MAAMsB,0BAA0BtB,YAAYa,YAAY,CAAC;IACzD,MAAMU,uBAAuBvB,YAAYa,YAAY,CAAC;IACtD,MAAMW,kBAAkBlC,OAAOuB,YAAY,CAAC;IAC5C,IAAIS,4BAA4B,OAAOV,OAAOW,0BAA0BX,OAAOY,mBAAmB,GAAG;QACnG,OAAOxB;IACT;IACA,OAAO;AACT;AAEA,SAASC,cAAcC,WAAsC,EAAEmB,UAA6B;IAC1F,IAAInB,gBAAgBuB,WAAW;QAC7B,OAAO;IACT;IACA,OAAOJ,WAAWrC,IAAI,CAAC0C,aAAa,CAAc,CAAC,CAAC,EAAE5D,sDAAAA,CAA0B,EAAE,EAAEoC,YAAY,EAAE,CAAC;AACrG"}
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "useRootTree", {
|
|
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
14
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
15
|
-
const _reactmotioncomponentspreview = require("@fluentui/react-motion-components-preview");
|
|
16
15
|
const _createCheckedItems = require("../utils/createCheckedItems.cjs");
|
|
17
16
|
const _tokens = require("../utils/tokens.cjs");
|
|
18
17
|
const _useControllableOpenItems = require("./useControllableOpenItems.cjs");
|
|
@@ -21,7 +20,7 @@ const _ImmutableMap = require("../utils/ImmutableMap.cjs");
|
|
|
21
20
|
function useRootTree(props, ref) {
|
|
22
21
|
var _props_navigationMode;
|
|
23
22
|
warnIfNoProperPropsRootTree(props);
|
|
24
|
-
const {
|
|
23
|
+
const { selectionMode = 'none' } = props;
|
|
25
24
|
const openItems = _react.useMemo(()=>_ImmutableSet.ImmutableSet.from(props.openItems), [
|
|
26
25
|
props.openItems
|
|
27
26
|
]);
|
|
@@ -78,15 +77,12 @@ function useRootTree(props, ref) {
|
|
|
78
77
|
});
|
|
79
78
|
return {
|
|
80
79
|
components: {
|
|
81
|
-
root: 'div'
|
|
82
|
-
collapseMotion: _reactmotioncomponentspreview.Collapse
|
|
80
|
+
root: 'div'
|
|
83
81
|
},
|
|
84
82
|
contextType: 'root',
|
|
85
83
|
selectionMode,
|
|
86
84
|
navigationMode: (_props_navigationMode = props.navigationMode) !== null && _props_navigationMode !== void 0 ? _props_navigationMode : 'tree',
|
|
87
85
|
open: true,
|
|
88
|
-
appearance,
|
|
89
|
-
size,
|
|
90
86
|
level: 1,
|
|
91
87
|
openItems,
|
|
92
88
|
checkedItems,
|
|
@@ -104,8 +100,7 @@ function useRootTree(props, ref) {
|
|
|
104
100
|
...props
|
|
105
101
|
}), {
|
|
106
102
|
elementType: 'div'
|
|
107
|
-
})
|
|
108
|
-
collapseMotion: undefined
|
|
103
|
+
})
|
|
109
104
|
};
|
|
110
105
|
}
|
|
111
106
|
function warnIfNoProperPropsRootTree(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useRootTree.ts"],"sourcesContent":["'use client';\n\nimport { getIntrinsicElementProps, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useRootTree.ts"],"sourcesContent":["'use client';\n\nimport { getIntrinsicElementProps, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { TreeBaseProps, TreeBaseState, TreeCheckedChangeData } from '../components/Tree/Tree.types';\nimport * as React from 'react';\nimport type { TreeContextValue, TreeItemRequest } from '../contexts/treeContext';\nimport { createCheckedItems } from '../utils/createCheckedItems';\nimport { treeDataTypes } from '../utils/tokens';\nimport { createNextOpenItems } from './useControllableOpenItems';\nimport { ImmutableSet } from '../utils/ImmutableSet';\nimport { ImmutableMap } from '../utils/ImmutableMap';\n\n/**\n * Create the state required to render the root level tree.\n *\n * @param props - props from this instance of tree\n * @param ref - reference to root HTMLElement of tree\n */\nexport function useRootTree(\n props: TreeBaseProps,\n ref: React.Ref<HTMLElement>,\n): Omit<TreeBaseState & Omit<TreeContextValue, 'appearance' | 'size'>, 'treeType'> {\n warnIfNoProperPropsRootTree(props);\n\n const { selectionMode = 'none' } = props;\n\n const openItems = React.useMemo(() => ImmutableSet.from(props.openItems), [props.openItems]);\n const checkedItems = React.useMemo(() => createCheckedItems(props.checkedItems), [props.checkedItems]);\n\n const requestOpenChange = (request: Extract<TreeItemRequest, { requestType: 'open' }>) => {\n props.onOpenChange?.(request.event, {\n ...request,\n openItems: ImmutableSet.dangerouslyGetInternalSet(createNextOpenItems(request, openItems)),\n });\n };\n\n const requestCheckedChange = (request: Extract<TreeItemRequest, { requestType: 'selection' }>) => {\n if (selectionMode === 'none') {\n return;\n }\n props.onCheckedChange?.(request.event, {\n ...request,\n selectionMode,\n checkedItems: ImmutableMap.dangerouslyGetInternalMap(checkedItems),\n // Casting is required here due to selection | multiselection spreading the union problem\n } as TreeCheckedChangeData);\n };\n\n const requestNavigation = (request: Extract<TreeItemRequest, { requestType: 'navigate' }>) => {\n let isScrollPrevented = false;\n props.onNavigation?.(request.event, {\n ...request,\n preventScroll: () => {\n isScrollPrevented = true;\n },\n isScrollPrevented: () => isScrollPrevented,\n });\n switch (request.type) {\n case treeDataTypes.ArrowDown:\n case treeDataTypes.ArrowUp:\n case treeDataTypes.Home:\n case treeDataTypes.End:\n // stop the default behavior of the event\n // which is to scroll the page\n request.event.preventDefault();\n }\n };\n\n const requestTreeResponse = useEventCallback((request: TreeItemRequest) => {\n switch (request.requestType) {\n case 'navigate':\n return requestNavigation(request);\n case 'open':\n return requestOpenChange(request);\n case 'selection':\n return requestCheckedChange(request);\n }\n });\n\n return {\n components: {\n root: 'div',\n },\n contextType: 'root',\n selectionMode,\n navigationMode: props.navigationMode ?? 'tree',\n open: true,\n level: 1,\n openItems,\n checkedItems,\n requestTreeResponse,\n forceUpdateRovingTabIndex: () => {\n // noop\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n role: 'tree',\n 'aria-multiselectable': selectionMode === 'multiselect' ? true : undefined,\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n\nfunction warnIfNoProperPropsRootTree(props: Pick<TreeBaseProps, 'aria-label' | 'aria-labelledby'>) {\n if (process.env.NODE_ENV === 'development') {\n if (!props['aria-label'] && !props['aria-labelledby']) {\n // eslint-disable-next-line no-console\n console.warn(/* #__DE-INDENT__ */ `\n @fluentui/react-tree [useRootTree]:\n Tree must have either a \\`aria-label\\` or \\`aria-labelledby\\` property defined\n `);\n }\n }\n}\n"],"names":["getIntrinsicElementProps","useEventCallback","slot","React","createCheckedItems","treeDataTypes","createNextOpenItems","ImmutableSet","ImmutableMap","useRootTree","props","ref","warnIfNoProperPropsRootTree","selectionMode","openItems","useMemo","from","checkedItems","requestOpenChange","request","onOpenChange","event","dangerouslyGetInternalSet","requestCheckedChange","onCheckedChange","dangerouslyGetInternalMap","requestNavigation","isScrollPrevented","onNavigation","preventScroll","type","ArrowDown","ArrowUp","Home","End","preventDefault","requestTreeResponse","requestType","components","root","contextType","navigationMode","open","level","forceUpdateRovingTab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kB,EAAE;YACrD,sCAAsC;YACtC0C,QAAQC,IAAI,CAAsB,CAAC;8EAGnC,CAAC;QACH;IACF;AACF"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
get useDOMFocusedElementChange () {
|
|
14
|
+
return useDOMFocusedElementChange;
|
|
15
|
+
},
|
|
16
|
+
get useRovingTabIndexBase () {
|
|
17
|
+
return useRovingTabIndexBase;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
21
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
23
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
24
|
+
const findTreeItemRoot = (element)=>{
|
|
25
|
+
let parent = element.parentElement;
|
|
26
|
+
while(parent && parent.getAttribute('role') !== 'tree'){
|
|
27
|
+
parent = parent.parentElement;
|
|
28
|
+
}
|
|
29
|
+
return parent;
|
|
30
|
+
};
|
|
31
|
+
const useDOMFocusedElementChange = (callback)=>{
|
|
32
|
+
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
33
|
+
const callbackRef = _react.useRef(callback);
|
|
34
|
+
_react.useEffect(()=>{
|
|
35
|
+
callbackRef.current = callback;
|
|
36
|
+
});
|
|
37
|
+
_react.useEffect(()=>{
|
|
38
|
+
var _activeElement_shadowRoot;
|
|
39
|
+
if (!targetDocument) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const listener = (event)=>{
|
|
43
|
+
var _event_composedPath_;
|
|
44
|
+
// The target is retargeted to the shadow host when focus moves within a shadow root
|
|
45
|
+
const target = (_event_composedPath_ = event.composedPath()[0]) !== null && _event_composedPath_ !== void 0 ? _event_composedPath_ : event.target;
|
|
46
|
+
callbackRef.current((0, _reactutilities.isHTMLElement)(target) ? target : undefined);
|
|
47
|
+
};
|
|
48
|
+
// Capture phase, so that consumers stopping the propagation of focus events do not desync the roving tab index
|
|
49
|
+
targetDocument.addEventListener('focusin', listener, true);
|
|
50
|
+
// Focus may have moved before the listener was attached, e.g. from a parent layout effect
|
|
51
|
+
let activeElement = targetDocument.activeElement;
|
|
52
|
+
while(activeElement === null || activeElement === void 0 ? void 0 : (_activeElement_shadowRoot = activeElement.shadowRoot) === null || _activeElement_shadowRoot === void 0 ? void 0 : _activeElement_shadowRoot.activeElement){
|
|
53
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
|
54
|
+
}
|
|
55
|
+
if ((0, _reactutilities.isHTMLElement)(activeElement)) {
|
|
56
|
+
callbackRef.current(activeElement);
|
|
57
|
+
}
|
|
58
|
+
return ()=>targetDocument.removeEventListener('focusin', listener, true);
|
|
59
|
+
}, [
|
|
60
|
+
targetDocument
|
|
61
|
+
]);
|
|
62
|
+
};
|
|
63
|
+
function useRovingTabIndexBase(useFocusedElementChange) {
|
|
64
|
+
const currentElementRef = _react.useRef(null);
|
|
65
|
+
const walkerRef = _react.useRef(null);
|
|
66
|
+
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
67
|
+
// The callback only runs on focus changes, never during render.
|
|
68
|
+
// eslint-disable-next-line react-hooks/refs
|
|
69
|
+
useFocusedElementChange((element)=>{
|
|
70
|
+
if ((element === null || element === void 0 ? void 0 : element.getAttribute('role')) === 'treeitem' && walkerRef.current && walkerRef.current.root.contains(element)) {
|
|
71
|
+
const treeitemRoot = findTreeItemRoot(element);
|
|
72
|
+
if (walkerRef.current.root !== treeitemRoot) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
rove(element);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const initialize = _react.useCallback((walker)=>{
|
|
79
|
+
walkerRef.current = walker;
|
|
80
|
+
walker.currentElement = walker.root;
|
|
81
|
+
let tabbableChild = walker.firstChild((element)=>element.tabIndex === 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP);
|
|
82
|
+
walker.currentElement = walker.root;
|
|
83
|
+
tabbableChild !== null && tabbableChild !== void 0 ? tabbableChild : tabbableChild = walker.firstChild();
|
|
84
|
+
if (!tabbableChild) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
tabbableChild.tabIndex = 0;
|
|
88
|
+
currentElementRef.current = tabbableChild;
|
|
89
|
+
let nextElement = null;
|
|
90
|
+
while((nextElement = walker.nextElement()) && nextElement !== tabbableChild){
|
|
91
|
+
nextElement.tabIndex = -1;
|
|
92
|
+
}
|
|
93
|
+
}, []);
|
|
94
|
+
const rove = _react.useCallback((nextElement, focusOptions)=>{
|
|
95
|
+
if (!currentElementRef.current) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
currentElementRef.current.tabIndex = -1;
|
|
99
|
+
nextElement.tabIndex = 0;
|
|
100
|
+
nextElement.focus(focusOptions);
|
|
101
|
+
currentElementRef.current = nextElement;
|
|
102
|
+
}, []);
|
|
103
|
+
const forceUpdate = _react.useCallback(()=>{
|
|
104
|
+
if ((currentElementRef.current === null || !(targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body.contains(currentElementRef.current))) && walkerRef.current) {
|
|
105
|
+
initialize(walkerRef.current);
|
|
106
|
+
}
|
|
107
|
+
}, [
|
|
108
|
+
targetDocument,
|
|
109
|
+
initialize
|
|
110
|
+
]);
|
|
111
|
+
return {
|
|
112
|
+
rove,
|
|
113
|
+
initialize,
|
|
114
|
+
forceUpdate
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useRovingTabIndexBase.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nimport type { HTMLElementWalker } from '../utils/createHTMLElementWalker';\n\n/**\n * Subscribes to focused element changes, invoking the callback with the newly focused element.\n *\n * @internal\n */\nexport type UseFocusedElementChange = (callback: (element: HTMLElement | undefined) => void) => void;\n\nconst findTreeItemRoot = (element: HTMLElement) => {\n let parent = element.parentElement;\n while (parent && parent.getAttribute('role') !== 'tree') {\n parent = parent.parentElement;\n }\n return parent;\n};\n\n/**\n * Plain DOM implementation of `UseFocusedElementChange`, free of any focus management runtime.\n *\n * @internal\n */\nexport const useDOMFocusedElementChange: UseFocusedElementChange = callback => {\n const { targetDocument } = useFluent();\n const callbackRef = React.useRef(callback);\n\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n const listener = (event: FocusEvent) => {\n // The target is retargeted to the shadow host when focus moves within a shadow root\n const target = event.composedPath()[0] ?? event.target;\n callbackRef.current(isHTMLElement(target) ? target : undefined);\n };\n // Capture phase, so that consumers stopping the propagation of focus events do not desync the roving tab index\n targetDocument.addEventListener('focusin', listener, true);\n\n // Focus may have moved before the listener was attached, e.g. from a parent layout effect\n let activeElement = targetDocument.activeElement;\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n if (isHTMLElement(activeElement)) {\n callbackRef.current(activeElement);\n }\n\n return () => targetDocument.removeEventListener('focusin', listener, true);\n }, [targetDocument]);\n};\n\n/**\n * https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex\n *\n * The focused element tracking is provided by the caller, so that the roving tab index can be\n * driven either by a focus management runtime or by plain DOM events.\n *\n * @internal\n */\nexport function useRovingTabIndexBase(useFocusedElementChange: UseFocusedElementChange): {\n rove: (nextElement: HTMLElement, focusOptions?: FocusOptions) => void;\n initialize: (walker: HTMLElementWalker) => void;\n forceUpdate: () => void;\n} {\n const currentElementRef = React.useRef<HTMLElement | null>(null);\n const walkerRef = React.useRef<HTMLElementWalker | null>(null);\n const { targetDocument } = useFluent();\n\n // The callback only runs on focus changes, never during render.\n // eslint-disable-next-line react-hooks/refs\n useFocusedElementChange(element => {\n if (element?.getAttribute('role') === 'treeitem' && walkerRef.current && walkerRef.current.root.contains(element)) {\n const treeitemRoot = findTreeItemRoot(element);\n if (walkerRef.current.root !== treeitemRoot) {\n return;\n }\n rove(element);\n }\n });\n\n const initialize = React.useCallback((walker: HTMLElementWalker) => {\n walkerRef.current = walker;\n walker.currentElement = walker.root;\n let tabbableChild = walker.firstChild(element =>\n element.tabIndex === 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP,\n );\n walker.currentElement = walker.root;\n tabbableChild ??= walker.firstChild();\n if (!tabbableChild) {\n return;\n }\n tabbableChild.tabIndex = 0;\n currentElementRef.current = tabbableChild;\n let nextElement: HTMLElement | null = null;\n while ((nextElement = walker.nextElement()) && nextElement !== tabbableChild) {\n nextElement.tabIndex = -1;\n }\n }, []);\n const rove = React.useCallback((nextElement: HTMLElement, focusOptions?: FocusOptions) => {\n if (!currentElementRef.current) {\n return;\n }\n currentElementRef.current.tabIndex = -1;\n nextElement.tabIndex = 0;\n nextElement.focus(focusOptions);\n currentElementRef.current = nextElement;\n }, []);\n\n const forceUpdate = React.useCallback(() => {\n if (\n (currentElementRef.current === null || !targetDocument?.body.contains(currentElementRef.current)) &&\n walkerRef.current\n ) {\n initialize(walkerRef.current);\n }\n }, [targetDocument, initialize]);\n\n return {\n rove,\n initialize,\n forceUpdate,\n };\n}\n"],"names":["React","useFluent_unstable","useFluent","isHTMLElement","findTreeItemRoot","element","parent","parentElement","getAttribute","useDOMFocusedElementChange","callback","targetDocument","callbackRef","useRef","useEffect","current","activeElement","listener","event","target","composedPath","undefined","addEventListener","shadowRoot","removeEventListener","useRovingTabIndexBase","useFocusedElementChange","currentElementRef","walkerRef","root","contains","treeitemRoot","rove","initialize","useCallback","walker","currentElement","tabbableChild","firstChild","tabIndex","NodeFilter","FILTER_ACCEPT","FILTER_SKIP","nextElement","focusOptions","focus","forceUpdate","body"],"mappings":"AAAA;;;;;;;;;;;;QA2BaS;;;;eAyCGgB;;;;iEAlEO,QAAQ;qCACiB,kCAAkC;gCACpD,4BAA4B;AAU1D,MAAMrB,mBAAmB,CAACC;IACxB,IAAIC,SAASD,QAAQE,aAAa;IAClC,MAAOD,UAAUA,OAAOE,YAAY,CAAC,YAAY,OAAQ;QACvDF,SAASA,OAAOC,aAAa;IAC/B;IACA,OAAOD;AACT;AAOO,mCAA4DI,CAAAA;IACjE,MAAM,EAAEC,cAAc,EAAE,OAAGT,uCAAAA;IAC3B,MAAMU,cAAcZ,OAAMa,MAAM,CAACH;IAEjCV,OAAMc,SAAS,CAAC;QACdF,YAAYG,OAAO,GAAGL;IACxB;IAEAV,OAAMc,SAAS,CAAC;YAcPE;QAbP,IAAI,CAACL,gBAAgB;YACnB;QACF;QACA,MAAMM,WAAW,CAACC;gBAEDA;YADf,oFAAoF;YACpF,MAAMC,SAAAA,CAASD,uBAAAA,MAAME,YAAY,EAAE,CAAC,EAAA,AAAE,MAAA,QAAvBF,yBAAAA,KAAAA,IAAAA,uBAA2BA,MAAMC,MAAM;YACtDP,YAAYG,OAAO,KAACZ,6BAAAA,EAAcgB,UAAUA,SAASE;QACvD;QACA,+GAA+G;QAC/GV,eAAeW,gBAAgB,CAAC,WAAWL,UAAU;QAErD,0FAA0F;QAC1F,IAAID,gBAAgBL,eAAeK,aAAa;QAChD,MAAOA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,6BAAAA,cAAeO,UAAU,AAAVA,MAAU,QAAzBP,8BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,0BAA2BA,aAA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AAOQ,WAAW,EAAA,CAAC,IAAMA,gBAAgBN,cAAe;YAC5EM,YAAYJ,QAAQ,GAAG,CAAC;QAC1B;IACF,GAAG,EAAE;IACL,MAAMP,OAAOhC,OAAMkC,WAAW,CAAC,CAACS,aAA0BC;QACxD,IAAI,CAACjB,kBAAkBZ,OAAO,EAAE;YAC9B;QACF;QACAY,kBAAkBZ,OAAO,CAACwB,QAAQ,GAAG,CAAC;QACtCI,YAAYJ,QAAQ,GAAG;QACvBI,YAAYE,KAAK,CAACD;QAClBjB,kBAAkBZ,OAAO,GAAG4B;IAC9B,GAAG,EAAE;IAEL,MAAMG,cAAc9C,OAAMkC,WAAW,CAAC;QACpC,IACGP,CAAAA,kBAAkBZ,OAAO,KAAK,QAAQ,EAACJ,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBoC,IAAI,CAACjB,QAAQ,CAACH,kBAAkBZ,QAAO,CAAA,CAAA,IAC/Fa,UAAUb,OAAO,EACjB;YACAkB,WAAWL,UAAUb,OAAO;QAC9B;IACF,GAAG;QAACJ;QAAgBsB;KAAW;IAE/B,OAAO;QACLD;QACAC;QACAa;IACF;AACF"}
|
|
@@ -9,68 +9,8 @@ Object.defineProperty(exports, "useRovingTabIndex", {
|
|
|
9
9
|
return useRovingTabIndex;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
|
-
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
15
12
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
16
|
-
const
|
|
17
|
-
let parent = element.parentElement;
|
|
18
|
-
while(parent && parent.getAttribute('role') !== 'tree'){
|
|
19
|
-
parent = parent.parentElement;
|
|
20
|
-
}
|
|
21
|
-
return parent;
|
|
22
|
-
};
|
|
13
|
+
const _useRovingTabIndexBase = require("./useRovingTabIndexBase.cjs");
|
|
23
14
|
function useRovingTabIndex() {
|
|
24
|
-
|
|
25
|
-
const walkerRef = _react.useRef(null);
|
|
26
|
-
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
27
|
-
(0, _reacttabster.useFocusedElementChange)((element)=>{
|
|
28
|
-
if ((element === null || element === void 0 ? void 0 : element.getAttribute('role')) === 'treeitem' && walkerRef.current && walkerRef.current.root.contains(element)) {
|
|
29
|
-
const treeitemRoot = findTreeItemRoot(element);
|
|
30
|
-
if (walkerRef.current.root !== treeitemRoot) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// eslint-disable-next-line react-hooks/immutability, react-hooks/preserve-manual-memoization
|
|
34
|
-
rove(element);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const initialize = _react.useCallback((walker)=>{
|
|
38
|
-
walkerRef.current = walker;
|
|
39
|
-
walker.currentElement = walker.root;
|
|
40
|
-
let tabbableChild = walker.firstChild((element)=>element.tabIndex === 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP);
|
|
41
|
-
walker.currentElement = walker.root;
|
|
42
|
-
tabbableChild !== null && tabbableChild !== void 0 ? tabbableChild : tabbableChild = walker.firstChild();
|
|
43
|
-
if (!tabbableChild) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
tabbableChild.tabIndex = 0;
|
|
47
|
-
currentElementRef.current = tabbableChild;
|
|
48
|
-
let nextElement = null;
|
|
49
|
-
while((nextElement = walker.nextElement()) && nextElement !== tabbableChild){
|
|
50
|
-
nextElement.tabIndex = -1;
|
|
51
|
-
}
|
|
52
|
-
}, []);
|
|
53
|
-
// eslint-disable-next-line react-hooks/preserve-manual-memoization
|
|
54
|
-
const rove = _react.useCallback((nextElement, focusOptions)=>{
|
|
55
|
-
if (!currentElementRef.current) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
currentElementRef.current.tabIndex = -1;
|
|
59
|
-
nextElement.tabIndex = 0;
|
|
60
|
-
nextElement.focus(focusOptions);
|
|
61
|
-
currentElementRef.current = nextElement;
|
|
62
|
-
}, []);
|
|
63
|
-
const forceUpdate = _react.useCallback(()=>{
|
|
64
|
-
if ((currentElementRef.current === null || !(targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body.contains(currentElementRef.current))) && walkerRef.current) {
|
|
65
|
-
initialize(walkerRef.current);
|
|
66
|
-
}
|
|
67
|
-
}, [
|
|
68
|
-
targetDocument,
|
|
69
|
-
initialize
|
|
70
|
-
]);
|
|
71
|
-
return {
|
|
72
|
-
rove,
|
|
73
|
-
initialize,
|
|
74
|
-
forceUpdate
|
|
75
|
-
};
|
|
15
|
+
return (0, _useRovingTabIndexBase.useRovingTabIndexBase)(_reacttabster.useFocusedElementChange);
|
|
76
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useRovingTabIndexes.ts"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useRovingTabIndexes.ts"],"sourcesContent":["'use client';\n\nimport { useFocusedElementChange } from '@fluentui/react-tabster';\nimport type { HTMLElementWalker } from '../utils/createHTMLElementWalker';\nimport { useRovingTabIndexBase } from './useRovingTabIndexBase';\n\n/**\n * https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex\n *\n * @internal\n */\nexport function useRovingTabIndex(): {\n rove: (nextElement: HTMLElement, focusOptions?: FocusOptions) => void;\n initialize: (walker: HTMLElementWalker) => void;\n forceUpdate: () => void;\n} {\n return useRovingTabIndexBase(useFocusedElementChange);\n}\n"],"names":["useFocusedElementChange","useRovingTabIndexBase","useRovingTabIndex"],"mappings":"AAAA;;;;;;;;;;;8BAEwC,0BAA0B;uCAE5B,6BAA0B;AAOzD,SAASE;IAKd,WAAOD,4CAAAA,EAAsBD,qCAAAA;AAC/B"}
|
|
@@ -11,8 +11,6 @@ Object.defineProperty(exports, "useSubtree", {
|
|
|
11
11
|
});
|
|
12
12
|
const _index = require("../contexts/index.cjs");
|
|
13
13
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
|
-
const _reactmotioncomponentspreview = require("@fluentui/react-motion-components-preview");
|
|
15
|
-
const _reactmotion = require("@fluentui/react-motion");
|
|
16
14
|
function useSubtree(props, ref) {
|
|
17
15
|
const subtreeRef = (0, _index.useTreeItemContext_unstable)((ctx)=>ctx.subtreeRef);
|
|
18
16
|
const { level: parentLevel } = (0, _index.useSubtreeContext_unstable)();
|
|
@@ -21,8 +19,7 @@ function useSubtree(props, ref) {
|
|
|
21
19
|
contextType: 'subtree',
|
|
22
20
|
open,
|
|
23
21
|
components: {
|
|
24
|
-
root: 'div'
|
|
25
|
-
collapseMotion: _reactmotioncomponentspreview.Collapse
|
|
22
|
+
root: 'div'
|
|
26
23
|
},
|
|
27
24
|
level: parentLevel + 1,
|
|
28
25
|
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
|
|
@@ -34,13 +31,6 @@ function useSubtree(props, ref) {
|
|
|
34
31
|
...props
|
|
35
32
|
}), {
|
|
36
33
|
elementType: 'div'
|
|
37
|
-
}),
|
|
38
|
-
collapseMotion: (0, _reactmotion.presenceMotionSlot)(props.collapseMotion, {
|
|
39
|
-
elementType: _reactmotioncomponentspreview.Collapse,
|
|
40
|
-
defaultProps: {
|
|
41
|
-
visible: open,
|
|
42
|
-
unmountOnExit: true
|
|
43
|
-
}
|
|
44
34
|
})
|
|
45
35
|
};
|
|
46
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useSubtree.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useSubtree.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport type { TreeBaseProps, TreeBaseState } from '../components/Tree/Tree.types';\nimport type { SubtreeContextValue } from '../contexts/index';\nimport { useSubtreeContext_unstable, useTreeItemContext_unstable } from '../contexts/index';\nimport { getIntrinsicElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render a sub-level tree.\n *\n * @param props - props from this instance of tree\n * @param ref - reference to root HTMLElement of tree\n */\nexport function useSubtree(\n props: TreeBaseProps,\n ref: React.Ref<HTMLElement>,\n): Omit<TreeBaseState & SubtreeContextValue, 'treeType'> {\n const subtreeRef = useTreeItemContext_unstable(ctx => ctx.subtreeRef);\n\n const { level: parentLevel } = useSubtreeContext_unstable();\n\n const open = useTreeItemContext_unstable(ctx => ctx.open);\n\n return {\n contextType: 'subtree',\n open,\n components: {\n root: 'div',\n },\n level: parentLevel + 1,\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, subtreeRef) as React.Ref<HTMLDivElement>,\n role: 'group',\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n}\n"],"names":["useSubtreeContext_unstable","useTreeItemContext_unstable","getIntrinsicElementProps","useMergedRefs","slot","useSubtree","props","ref","subtreeRef","ctx","level","parentLevel","open","contextType","components","root","always","role","elementType"],"mappings":"AAAA;;;;;+BAcgBK;;;;;;uBATwD,uBAAoB;gCAC9B,4BAA4B;AAQnF,oBACLC,KAAoB,EACpBC,GAA2B;IAE3B,MAAMC,iBAAaP,kCAAAA,EAA4BQ,CAAAA,MAAOA,IAAID,UAAU;IAEpE,MAAM,EAAEE,OAAOC,WAAW,EAAE,OAAGX,iCAAAA;IAE/B,MAAMY,WAAOX,kCAAAA,EAA4BQ,CAAAA,MAAOA,IAAIG,IAAI;IAExD,OAAO;QACLC,aAAa;QACbD;QACAE,YAAY;YACVC,MAAM;QACR;QACAL,OAAOC,cAAc;QACrBI,MAAMX,oBAAAA,CAAKY,MAAM,KACfd,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FK,SAAKJ,6BAAAA,EAAcI,KAAKC;YACxBS,MAAM;YACN,GAAGX,KAAK;QACV,IACA;YAAEY,aAAa;QAAM;IAEzB;AACF"}
|
|
@@ -9,91 +9,12 @@ Object.defineProperty(exports, "useTreeNavigation", {
|
|
|
9
9
|
return useTreeNavigation;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
|
-
const _nextTypeAheadElement = require("../utils/nextTypeAheadElement.cjs");
|
|
14
|
-
const _tokens = require("../utils/tokens.cjs");
|
|
15
|
-
const _useRovingTabIndexes = require("./useRovingTabIndexes.cjs");
|
|
16
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
17
|
-
const _useHTMLElementWalkerRef = require("./useHTMLElementWalkerRef.cjs");
|
|
18
|
-
const _reactutilities = require("@fluentui/react-utilities");
|
|
19
|
-
const _TreeItemLayout = require("../TreeItemLayout.cjs");
|
|
20
12
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
13
|
+
const _useTreeNavigationBase = require("./useTreeNavigationBase.cjs");
|
|
21
14
|
function useTreeNavigation(navigationMode = 'tree') {
|
|
22
|
-
'use no memo'; // justified: compiler would optimize useTreeNavigation — manual opt-out to preserve runtime behavior
|
|
23
|
-
const { rove, initialize: initializeRovingTabIndex, forceUpdate: forceUpdateRovingTabIndex } = (0, _useRovingTabIndexes.useRovingTabIndex)();
|
|
24
15
|
const { findFirstFocusable } = (0, _reacttabster.useFocusFinders)();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}, [
|
|
31
|
-
walkerRef,
|
|
32
|
-
initializeRovingTabIndex
|
|
33
|
-
]);
|
|
34
|
-
const getNextElement = (data)=>{
|
|
35
|
-
if (!walkerRef.current) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
switch(data.type){
|
|
39
|
-
case _tokens.treeDataTypes.Click:
|
|
40
|
-
return data.target;
|
|
41
|
-
case _tokens.treeDataTypes.TypeAhead:
|
|
42
|
-
walkerRef.current.currentElement = data.target;
|
|
43
|
-
return (0, _nextTypeAheadElement.nextTypeAheadElement)(walkerRef.current, data.event.key);
|
|
44
|
-
case _tokens.treeDataTypes.ArrowLeft:
|
|
45
|
-
{
|
|
46
|
-
const actions = queryActions(data.target);
|
|
47
|
-
if (navigationMode === 'treegrid' && (actions === null || actions === void 0 ? void 0 : actions.contains(data.target.ownerDocument.activeElement))) {
|
|
48
|
-
return data.target;
|
|
49
|
-
}
|
|
50
|
-
walkerRef.current.currentElement = data.target;
|
|
51
|
-
return walkerRef.current.parentElement();
|
|
52
|
-
}
|
|
53
|
-
case _tokens.treeDataTypes.ArrowRight:
|
|
54
|
-
if (navigationMode === 'treegrid') {
|
|
55
|
-
const actions = queryActions(data.target);
|
|
56
|
-
if (actions) {
|
|
57
|
-
var _findFirstFocusable;
|
|
58
|
-
(_findFirstFocusable = findFirstFocusable(actions)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
walkerRef.current.currentElement = data.target;
|
|
63
|
-
return walkerRef.current.firstChild();
|
|
64
|
-
case _tokens.treeDataTypes.End:
|
|
65
|
-
walkerRef.current.currentElement = walkerRef.current.root;
|
|
66
|
-
return lastChildRecursive(walkerRef.current);
|
|
67
|
-
case _tokens.treeDataTypes.Home:
|
|
68
|
-
walkerRef.current.currentElement = walkerRef.current.root;
|
|
69
|
-
return walkerRef.current.firstChild();
|
|
70
|
-
case _tokens.treeDataTypes.ArrowDown:
|
|
71
|
-
walkerRef.current.currentElement = data.target;
|
|
72
|
-
return walkerRef.current.nextElement();
|
|
73
|
-
case _tokens.treeDataTypes.ArrowUp:
|
|
74
|
-
walkerRef.current.currentElement = data.target;
|
|
75
|
-
return walkerRef.current.previousElement();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
function navigate(data, focusOptions) {
|
|
79
|
-
const nextElement = getNextElement(data);
|
|
80
|
-
if (nextElement) {
|
|
81
|
-
rove(nextElement, focusOptions);
|
|
82
|
-
}
|
|
83
|
-
return nextElement;
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
navigate,
|
|
87
|
-
treeRef: (0, _reactutilities.useMergedRefs)(walkerRootRef, rootRefCallback),
|
|
88
|
-
forceUpdateRovingTabIndex
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function lastChildRecursive(walker) {
|
|
92
|
-
let lastElement = null;
|
|
93
|
-
let nextElement = null;
|
|
94
|
-
while(nextElement = walker.lastChild()){
|
|
95
|
-
lastElement = nextElement;
|
|
96
|
-
}
|
|
97
|
-
return lastElement;
|
|
16
|
+
return (0, _useTreeNavigationBase.useTreeNavigationBase)(navigationMode, {
|
|
17
|
+
findFirstFocusable,
|
|
18
|
+
useFocusedElementChange: _reacttabster.useFocusedElementChange
|
|
19
|
+
});
|
|
98
20
|
}
|
|
99
|
-
const queryActions = (target)=>target.querySelector(`:scope > .${_TreeItemLayout.treeItemLayoutClassNames.root} > .${_TreeItemLayout.treeItemLayoutClassNames.actions}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useTreeNavigation.ts"],"sourcesContent":["'use client';\n\nimport type
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useTreeNavigation.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useFocusFinders, useFocusedElementChange } from '@fluentui/react-tabster';\nimport type { TreeNavigationData_unstable, TreeNavigationMode } from '../components/Tree/Tree.types';\nimport { useTreeNavigationBase } from './useTreeNavigationBase';\n\n/***\n * Hook used to manage navigation in the tree.\n *\n * @param navigationMode - the navigation mode of the tree, 'tree' (default) or 'treegrid'\n */\nexport function useTreeNavigation(navigationMode: TreeNavigationMode = 'tree'): {\n navigate: (data: TreeNavigationData_unstable, focusOptions?: FocusOptions) => HTMLElement | null;\n treeRef: React.RefCallback<HTMLElement>;\n forceUpdateRovingTabIndex: () => void;\n} {\n const { findFirstFocusable } = useFocusFinders();\n\n return useTreeNavigationBase(navigationMode, { findFirstFocusable, useFocusedElementChange });\n}\n"],"names":["useFocusFinders","useFocusedElementChange","useTreeNavigationBase","useTreeNavigation","navigationMode","findFirstFocusable"],"mappings":"AAAA;;;;;;;;;;;8BAGyD,0BAA0B;uCAE7C,6BAA0B;AAOzD,SAASG,kBAAkBC,iBAAqC,MAAM;IAK3E,MAAM,EAAEC,kBAAkB,EAAE,OAAGL,6BAAAA;IAE/B,WAAOE,4CAAAA,EAAsBE,gBAAgB;QAAEC;iCAAoBJ,qCAAAA;IAAwB;AAC7F"}
|