@fluentui/react-tree 0.0.0-nightly-20230310-0421.1 → 9.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +33 -42
- package/CHANGELOG.md +20 -15
- package/dist/index.d.ts +80 -22
- package/lib/Tree.js.map +1 -1
- package/lib/TreeItem.js.map +1 -1
- package/lib/TreeItemLayout.js.map +1 -1
- package/lib/TreeItemPersonaLayout.js.map +1 -1
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/Tree/useTreeStyles.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/index.js.map +1 -1
- package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemStyles.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib/components/TreeItemLayout/index.js.map +1 -1
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/index.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js.map +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/contexts/treeItemContext.js.map +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useFlatTree.js +49 -0
- package/lib/hooks/useFlatTree.js.map +1 -0
- package/lib/hooks/useFlatTreeNavigation.js +6 -6
- package/lib/hooks/useFlatTreeNavigation.js.map +1 -1
- package/lib/hooks/useHTMLElementWalker.js.map +1 -1
- package/lib/hooks/useNestedTreeNavigation.js.map +1 -1
- package/lib/hooks/useOpenItemsState.js.map +1 -1
- package/lib/hooks/useRovingTabIndexes.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/ImmutableSet.js.map +1 -1
- package/lib/utils/assert.js.map +1 -1
- package/lib/utils/createUnfilteredFlatTree.js +77 -0
- package/lib/utils/createUnfilteredFlatTree.js.map +1 -0
- package/lib/utils/createVisibleFlatTree.js +80 -0
- package/lib/utils/createVisibleFlatTree.js.map +1 -0
- package/lib/utils/flattenTree.js.map +1 -1
- package/lib/utils/nextTypeAheadElement.js.map +1 -1
- package/lib/utils/normalizeOpenItems.js.map +1 -1
- package/lib/utils/tokens.js.map +1 -1
- package/lib/utils/treeItemFilter.js.map +1 -1
- package/lib-commonjs/Tree.js.map +1 -1
- package/lib-commonjs/TreeItem.js.map +1 -1
- package/lib-commonjs/TreeItemLayout.js.map +1 -1
- package/lib-commonjs/TreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/Tree/Tree.js.map +1 -1
- package/lib-commonjs/components/Tree/Tree.types.js.map +1 -1
- package/lib-commonjs/components/Tree/index.js.map +1 -1
- package/lib-commonjs/components/Tree/renderTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeStyles.js.map +1 -1
- package/lib-commonjs/components/TreeItem/TreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib-commonjs/components/TreeItem/index.js.map +1 -1
- package/lib-commonjs/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/index.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/index.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js.map +1 -1
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/treeContext.js.map +1 -1
- package/lib-commonjs/contexts/treeItemContext.js.map +1 -1
- package/lib-commonjs/hooks/index.js +1 -1
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useFlatTree.js +56 -0
- package/lib-commonjs/hooks/useFlatTree.js.map +1 -0
- package/lib-commonjs/hooks/useFlatTreeNavigation.js +6 -6
- package/lib-commonjs/hooks/useFlatTreeNavigation.js.map +1 -1
- package/lib-commonjs/hooks/useHTMLElementWalker.js.map +1 -1
- package/lib-commonjs/hooks/useNestedTreeNavigation.js.map +1 -1
- package/lib-commonjs/hooks/useOpenItemsState.js.map +1 -1
- package/lib-commonjs/hooks/useRovingTabIndexes.js.map +1 -1
- package/lib-commonjs/index.js +3 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/ImmutableSet.js.map +1 -1
- package/lib-commonjs/utils/assert.js.map +1 -1
- package/lib-commonjs/utils/createUnfilteredFlatTree.js +84 -0
- package/lib-commonjs/utils/createUnfilteredFlatTree.js.map +1 -0
- package/lib-commonjs/utils/createVisibleFlatTree.js +87 -0
- package/lib-commonjs/utils/createVisibleFlatTree.js.map +1 -0
- package/lib-commonjs/utils/flattenTree.js.map +1 -1
- package/lib-commonjs/utils/nextTypeAheadElement.js.map +1 -1
- package/lib-commonjs/utils/normalizeOpenItems.js.map +1 -1
- package/lib-commonjs/utils/tokens.js.map +1 -1
- package/lib-commonjs/utils/treeItemFilter.js.map +1 -1
- package/package.json +19 -13
- package/lib/hooks/useFlatTreeItems.js +0 -134
- package/lib/hooks/useFlatTreeItems.js.map +0 -1
- package/lib-commonjs/hooks/useFlatTreeItems.js +0 -141
- package/lib-commonjs/hooks/useFlatTreeItems.js.map +0 -1
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Tree","treeClassNames","renderTree_unstable","useTreeStyles_unstable","useTree_unstable","useTreeContextValues_unstable","TreeProvider","useTreeContext_unstable","useTreeItemContext_unstable","TreeItemProvider","treeItemLevelToken","TreeItem","treeItemClassNames","renderTreeItem_unstable","useTreeItemStyles_unstable","useTreeItem_unstable","TreeItemLayout","treeItemLayoutClassNames","renderTreeItemLayout_unstable","useTreeItemLayoutStyles_unstable","useTreeItemLayout_unstable","TreeItemPersonaLayout","treeItemPersonaLayoutClassNames","renderTreeItemPersonaLayout_unstable","useTreeItemPersonaLayoutStyles_unstable","useTreeItemPersonaLayout_unstable","
|
|
1
|
+
{"version":3,"names":["Tree","treeClassNames","renderTree_unstable","useTreeStyles_unstable","useTree_unstable","useTreeContextValues_unstable","TreeProvider","useTreeContext_unstable","useTreeItemContext_unstable","TreeItemProvider","treeItemLevelToken","TreeItem","treeItemClassNames","renderTreeItem_unstable","useTreeItemStyles_unstable","useTreeItem_unstable","TreeItemLayout","treeItemLayoutClassNames","renderTreeItemLayout_unstable","useTreeItemLayoutStyles_unstable","useTreeItemLayout_unstable","TreeItemPersonaLayout","treeItemPersonaLayoutClassNames","renderTreeItemPersonaLayout_unstable","useTreeItemPersonaLayoutStyles_unstable","useTreeItemPersonaLayout_unstable","useFlatTree_unstable","flattenTree_unstable"],"sources":["../src/packages/react-components/react-tree/src/index.ts"],"sourcesContent":["export {\n Tree,\n treeClassNames,\n renderTree_unstable,\n useTreeStyles_unstable,\n useTree_unstable,\n useTreeContextValues_unstable,\n} from './Tree';\nexport type {\n TreeProps,\n TreeState,\n TreeSlots,\n TreeOpenChangeData,\n TreeOpenChangeEvent,\n TreeNavigationEvent_unstable,\n TreeNavigationData_unstable,\n TreeItemId,\n} from './Tree';\n\nexport { TreeProvider, useTreeContext_unstable, useTreeItemContext_unstable, TreeItemProvider } from './contexts';\nexport type { TreeContextValue } from './contexts';\n\nexport { treeItemLevelToken } from './utils/tokens';\n\nexport {\n TreeItem,\n treeItemClassNames,\n renderTreeItem_unstable,\n useTreeItemStyles_unstable,\n useTreeItem_unstable,\n} from './TreeItem';\nexport type { TreeItemProps, TreeItemState, TreeItemSlots } from './TreeItem';\n\nexport {\n TreeItemLayout,\n treeItemLayoutClassNames,\n renderTreeItemLayout_unstable,\n useTreeItemLayoutStyles_unstable,\n useTreeItemLayout_unstable,\n} from './TreeItemLayout';\nexport type { TreeItemLayoutProps, TreeItemLayoutSlots, TreeItemLayoutState } from './TreeItemLayout';\n\nexport {\n TreeItemPersonaLayout,\n treeItemPersonaLayoutClassNames,\n renderTreeItemPersonaLayout_unstable,\n useTreeItemPersonaLayoutStyles_unstable,\n useTreeItemPersonaLayout_unstable,\n} from './TreeItemPersonaLayout';\nexport type {\n TreeItemPersonaLayoutProps,\n TreeItemPersonaLayoutSlots,\n TreeItemPersonaLayoutState,\n} from './TreeItemPersonaLayout';\n\nexport { useFlatTree_unstable } from './hooks/index';\nexport type { FlatTreeItem, FlatTreeItemProps, FlatTreeProps, FlatTree } from './hooks/index';\n\nexport { flattenTree_unstable } from './utils/flattenTree';\nexport type { NestedTreeItem } from './utils/flattenTree';\n"],"mappings":"AAAA,SACEA,IAAI,EACJC,cAAc,EACdC,mBAAmB,EACnBC,sBAAsB,EACtBC,gBAAgB,EAChBC,6BAA6B,QACxB,QAAQ;AAYf,SAASC,YAAY,EAAEC,uBAAuB,EAAEC,2BAA2B,EAAEC,gBAAgB,QAAQ,YAAY;AAGjH,SAASC,kBAAkB,QAAQ,gBAAgB;AAEnD,SACEC,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,oBAAoB,QACf,YAAY;AAGnB,SACEC,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,kBAAkB;AAGzB,SACEC,qBAAqB,EACrBC,+BAA+B,EAC/BC,oCAAoC,EACpCC,uCAAuC,EACvCC,iCAAiC,QAC5B,yBAAyB;AAOhC,SAASC,oBAAoB,QAAQ,eAAe;AAGpD,SAASC,oBAAoB,QAAQ,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["emptyImmutableSet","createImmutableSet","iterable","internalSet","Set","dangerouslyCreateImmutableSet","size","add","value","nextSet","clear","delete","has","Symbol","iterator"],"sources":["
|
|
1
|
+
{"version":3,"names":["emptyImmutableSet","createImmutableSet","iterable","internalSet","Set","dangerouslyCreateImmutableSet","size","add","value","nextSet","clear","delete","has","Symbol","iterator"],"sources":["../src/packages/react-components/react-tree/src/utils/ImmutableSet.ts"],"sourcesContent":["export interface ImmutableSet<Value> {\n /**\n * The number of (unique) elements in a ImmutableSet.\n */\n readonly size: number;\n /**\n * Creates a new ImmutableSet containing all previous element plus the one provided as argument\n * @param value - new value to be included in the new ImmutableSet instance\n */\n add(value: Value): ImmutableSet<Value>;\n /**\n * Returns a reference to ImmutableSet.emptySet\n */\n clear(): ImmutableSet<Value>;\n /**\n * Creates a new ImmutableSet with the original items and removes a specified value from the new ImmutableSet.\n */\n delete(value: Value): ImmutableSet<Value>;\n /**\n * @returns a boolean indicating whether an element with the specified value exists in the ImmutableSet or not.\n */\n has(value: Value): boolean;\n /** Iterates over values in the ImmutableSet. */\n [Symbol.iterator](): IterableIterator<Value>;\n}\n\nexport const emptyImmutableSet = createImmutableSet<never>();\n\n/**\n * properly creates an ImmutableSet instance from an iterable\n */\nexport function createImmutableSet<Value>(iterable?: Iterable<Value>): ImmutableSet<Value> {\n const internalSet = new Set(iterable);\n return dangerouslyCreateImmutableSet(internalSet);\n}\n/**\n * Avoid using *dangerouslyCreateImmutableSet*, since this method will expose internally used set, use createImmutableSet instead,\n * @param internalSet - a set that is used internally to store values.\n */\nexport function dangerouslyCreateImmutableSet<Value>(internalSet: Set<Value>): ImmutableSet<Value> {\n return {\n size: internalSet.size,\n add(value) {\n const nextSet = new Set(internalSet);\n nextSet.add(value);\n return dangerouslyCreateImmutableSet(nextSet);\n },\n clear() {\n return emptyImmutableSet;\n },\n delete(value) {\n const nextSet = new Set(internalSet);\n nextSet.delete(value);\n return dangerouslyCreateImmutableSet(nextSet);\n },\n has(value) {\n return internalSet.has(value);\n },\n [Symbol.iterator]() {\n return internalSet[Symbol.iterator]();\n },\n };\n}\n"],"mappings":"AA0BA,OAAO,MAAMA,iBAAiB,gBAAGC,kBAAkB,EAAS;AAE5D;;;AAGA,OAAM,SAAUA,kBAAkBA,CAAQC,QAA0B;EAClE,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAACF,QAAQ,CAAC;EACrC,OAAOG,6BAA6B,CAACF,WAAW,CAAC;AACnD;AACA;;;;AAIA,OAAM,SAAUE,6BAA6BA,CAAQF,WAAuB;EAC1E,OAAO;IACLG,IAAI,EAAEH,WAAW,CAACG,IAAI;IACtBC,GAAGA,CAACC,KAAK;MACP,MAAMC,OAAO,GAAG,IAAIL,GAAG,CAACD,WAAW,CAAC;MACpCM,OAAO,CAACF,GAAG,CAACC,KAAK,CAAC;MAClB,OAAOH,6BAA6B,CAACI,OAAO,CAAC;IAC/C,CAAC;IACDC,KAAKA,CAAA;MACH,OAAOV,iBAAiB;IAC1B,CAAC;IACDW,MAAMA,CAACH,KAAK;MACV,MAAMC,OAAO,GAAG,IAAIL,GAAG,CAACD,WAAW,CAAC;MACpCM,OAAO,CAACE,MAAM,CAACH,KAAK,CAAC;MACrB,OAAOH,6BAA6B,CAACI,OAAO,CAAC;IAC/C,CAAC;IACDG,GAAGA,CAACJ,KAAK;MACP,OAAOL,WAAW,CAACS,GAAG,CAACJ,KAAK,CAAC;IAC/B,CAAC;IACD,CAACK,MAAM,CAACC,QAAQ,IAAC;MACf,OAAOX,WAAW,CAACU,MAAM,CAACC,QAAQ,CAAC,EAAE;IACvC;GACD;AACH"}
|
package/lib/utils/assert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["assertIsDefinedRef","refObject","msg","current","undefined","process","env","NODE_ENV","TypeError"],"sources":["
|
|
1
|
+
{"version":3,"names":["assertIsDefinedRef","refObject","msg","current","undefined","process","env","NODE_ENV","TypeError"],"sources":["../src/packages/react-components/react-tree/src/utils/assert.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function assertIsDefinedRef<V>(\n refObject: React.RefObject<V | null | undefined>,\n msg = `assertIsDefinedRef: reference not properly defined ${refObject}`,\n): asserts refObject is React.MutableRefObject<V> {\n // eslint-disable-next-line eqeqeq\n if (refObject.current == undefined && process.env.NODE_ENV === 'development') {\n throw new TypeError(msg);\n }\n}\n"],"mappings":"AAEA,OAAM,SAAUA,kBAAkBA,CAChCC,SAAgD,EAChDC,GAAG,GAAG,sDAAsDD,SAAS,EAAE;EAEvE;EACA,IAAIA,SAAS,CAACE,OAAO,IAAIC,SAAS,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;IAC5E,MAAM,IAAIC,SAAS,CAACN,GAAG,CAAC;;AAE5B"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* creates a list of flat tree items
|
|
3
|
+
* and provides a map to access each item by id
|
|
4
|
+
*/
|
|
5
|
+
export function createUnfilteredFlatTree(flatTreeItemProps) {
|
|
6
|
+
var _a;
|
|
7
|
+
const root = createRootFlatTreeItem();
|
|
8
|
+
const itemsPerId = new Map([[root.id, root]]);
|
|
9
|
+
const items = [];
|
|
10
|
+
for (let index = 0; index < flatTreeItemProps.length; index++) {
|
|
11
|
+
const {
|
|
12
|
+
parentId = flatTreeRootParentId,
|
|
13
|
+
...treeItemProps
|
|
14
|
+
} = flatTreeItemProps[index];
|
|
15
|
+
const nextItemProps = flatTreeItemProps[index + 1];
|
|
16
|
+
const currentParent = itemsPerId.get(parentId);
|
|
17
|
+
if (!currentParent) {
|
|
18
|
+
if (process.env.NODE_ENV === 'development') {
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.error(`useFlatTree: item ${flatTreeItemProps[index].id} not properly initialized, make sure provided items are organized`);
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
const isLeaf = (nextItemProps === null || nextItemProps === void 0 ? void 0 : nextItemProps.parentId) !== treeItemProps.id;
|
|
25
|
+
const currentLevel = ((_a = currentParent.level) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
26
|
+
const currentChildrenSize = ++currentParent.childrenSize;
|
|
27
|
+
const flatTreeItem = {
|
|
28
|
+
id: treeItemProps.id,
|
|
29
|
+
getTreeItemProps: () => ({
|
|
30
|
+
...treeItemProps,
|
|
31
|
+
'aria-level': currentLevel,
|
|
32
|
+
'aria-posinset': currentChildrenSize,
|
|
33
|
+
'aria-setsize': currentParent.childrenSize,
|
|
34
|
+
leaf: isLeaf
|
|
35
|
+
}),
|
|
36
|
+
level: currentLevel,
|
|
37
|
+
parentId,
|
|
38
|
+
childrenSize: 0,
|
|
39
|
+
index: -1
|
|
40
|
+
};
|
|
41
|
+
itemsPerId.set(flatTreeItem.id, flatTreeItem);
|
|
42
|
+
items.push(flatTreeItem);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
items,
|
|
46
|
+
itemsPerId
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export const flatTreeRootParentId = '__fuiFlatTreeRoot';
|
|
50
|
+
function createRootFlatTreeItem() {
|
|
51
|
+
return {
|
|
52
|
+
id: flatTreeRootParentId,
|
|
53
|
+
getTreeItemProps: () => {
|
|
54
|
+
if (process.env.NODE_ENV === 'development') {
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
56
|
+
console.error('useFlatTree: internal error, trying to access treeitem props from invalid root element');
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
id: flatTreeRootParentId,
|
|
60
|
+
'aria-setsize': -1,
|
|
61
|
+
'aria-level': -1,
|
|
62
|
+
'aria-posinset': -1,
|
|
63
|
+
leaf: true
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
childrenSize: 0,
|
|
67
|
+
get index() {
|
|
68
|
+
if (process.env.NODE_ENV === 'development') {
|
|
69
|
+
// eslint-disable-next-line no-console
|
|
70
|
+
console.error('useFlatTree: internal error, trying to access treeitem props from invalid root element');
|
|
71
|
+
}
|
|
72
|
+
return -1;
|
|
73
|
+
},
|
|
74
|
+
level: 0
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=createUnfilteredFlatTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createUnfilteredFlatTree","flatTreeItemProps","root","createRootFlatTreeItem","itemsPerId","Map","id","items","index","length","parentId","flatTreeRootParentId","treeItemProps","nextItemProps","currentParent","get","process","env","NODE_ENV","console","error","isLeaf","currentLevel","_a","level","currentChildrenSize","childrenSize","flatTreeItem","getTreeItemProps","leaf","set","push"],"sources":["../src/packages/react-components/react-tree/src/utils/createUnfilteredFlatTree.ts"],"sourcesContent":["import { FlatTreeItem, FlatTreeItemProps } from '../hooks/useFlatTree';\n\n/**\n * @internal\n */\nexport type UnfilteredFlatTree = {\n items: FlatTreeItem[];\n itemsPerId: Map<string, FlatTreeItem>;\n};\n\n/**\n * creates a list of flat tree items\n * and provides a map to access each item by id\n */\nexport function createUnfilteredFlatTree(flatTreeItemProps: FlatTreeItemProps[]): UnfilteredFlatTree {\n const root = createRootFlatTreeItem();\n const itemsPerId = new Map<string, FlatTreeItem>([[root.id, root]]);\n const items: FlatTreeItem[] = [];\n\n for (let index = 0; index < flatTreeItemProps.length; index++) {\n const { parentId = flatTreeRootParentId, ...treeItemProps } = flatTreeItemProps[index];\n\n const nextItemProps = flatTreeItemProps[index + 1] as FlatTreeItemProps | undefined;\n const currentParent = itemsPerId.get(parentId);\n if (!currentParent) {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error(\n `useFlatTree: item ${flatTreeItemProps[index].id} not properly initialized, make sure provided items are organized`,\n );\n }\n break;\n }\n const isLeaf = nextItemProps?.parentId !== treeItemProps.id;\n const currentLevel = (currentParent.level ?? 0) + 1;\n const currentChildrenSize = ++currentParent.childrenSize;\n\n const flatTreeItem: FlatTreeItem = {\n id: treeItemProps.id,\n getTreeItemProps: () => ({\n ...treeItemProps,\n 'aria-level': currentLevel,\n 'aria-posinset': currentChildrenSize,\n 'aria-setsize': currentParent.childrenSize,\n leaf: isLeaf,\n }),\n level: currentLevel,\n parentId,\n childrenSize: 0,\n index: -1,\n };\n itemsPerId.set(flatTreeItem.id, flatTreeItem);\n items.push(flatTreeItem);\n }\n\n return { items, itemsPerId };\n}\n\nexport const flatTreeRootParentId = '__fuiFlatTreeRoot';\n\nfunction createRootFlatTreeItem(): FlatTreeItem {\n return {\n id: flatTreeRootParentId,\n getTreeItemProps: () => {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('useFlatTree: internal error, trying to access treeitem props from invalid root element');\n }\n return { id: flatTreeRootParentId, 'aria-setsize': -1, 'aria-level': -1, 'aria-posinset': -1, leaf: true };\n },\n childrenSize: 0,\n get index() {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('useFlatTree: internal error, trying to access treeitem props from invalid root element');\n }\n return -1;\n },\n level: 0,\n };\n}\n"],"mappings":"AAUA;;;;AAIA,OAAM,SAAUA,wBAAwBA,CAACC,iBAAsC;;EAC7E,MAAMC,IAAI,GAAGC,sBAAsB,EAAE;EACrC,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAAuB,CAAC,CAACH,IAAI,CAACI,EAAE,EAAEJ,IAAI,CAAC,CAAC,CAAC;EACnE,MAAMK,KAAK,GAAmB,EAAE;EAEhC,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGP,iBAAiB,CAACQ,MAAM,EAAED,KAAK,EAAE,EAAE;IAC7D,MAAM;MAAEE,QAAQ,GAAGC,oBAAoB;MAAE,GAAGC;IAAa,CAAE,GAAGX,iBAAiB,CAACO,KAAK,CAAC;IAEtF,MAAMK,aAAa,GAAGZ,iBAAiB,CAACO,KAAK,GAAG,CAAC,CAAkC;IACnF,MAAMM,aAAa,GAAGV,UAAU,CAACW,GAAG,CAACL,QAAQ,CAAC;IAC9C,IAAI,CAACI,aAAa,EAAE;MAClB,IAAIE,OAAO,CAAC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AAE,EAAEK,oBAAoB;QAAE,cAAc,EAAE,CAAC,CAAC;QAAE,YAAY,EAAE,CAAC,CAAC;QAAE,eAAe,EAAE,CAAC,CAAC;QAAEkB,IAAI,EAAE;MAAI,CAAE;IAC5G,CAAC;IACDH,YAAY,EAAE,CAAC;IACf,IAAIlB,KAAKA,CAAA;MACP,IAAIQ,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;QAC1C;QACAC,OAAO,CAACC,KAAK,CAAC,wFAAwF,CAAC;;MAEzG,OAAO,CAAC,CAAC;IACX,CAAC;IACDI,KAAK,EAAE;GACR;AACH"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { flatTreeRootParentId } from './createUnfilteredFlatTree';
|
|
2
|
+
import { treeDataTypes } from './tokens';
|
|
3
|
+
/**
|
|
4
|
+
* creates methods that depend on the unfilteredFlatTree and the current available openItems
|
|
5
|
+
*/
|
|
6
|
+
export function createVisibleFlatTree(unfilteredFlatTree, openItems) {
|
|
7
|
+
let visibleItems = null;
|
|
8
|
+
const getNextNavigableItem = data => {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
const item = unfilteredFlatTree.itemsPerId.get(data.target.id);
|
|
11
|
+
if (!item || !visibleItems) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
switch (data.type) {
|
|
15
|
+
case treeDataTypes.arrowLeft:
|
|
16
|
+
return item.parentId ? (_a = unfilteredFlatTree.itemsPerId.get(item.parentId)) !== null && _a !== void 0 ? _a : null : null;
|
|
17
|
+
case treeDataTypes.arrowRight:
|
|
18
|
+
return (_b = visibleItems[item.index + 1]) !== null && _b !== void 0 ? _b : null;
|
|
19
|
+
case treeDataTypes.end:
|
|
20
|
+
return visibleItems[visibleItems.length - 1];
|
|
21
|
+
case treeDataTypes.home:
|
|
22
|
+
return visibleItems[0];
|
|
23
|
+
case treeDataTypes.arrowDown:
|
|
24
|
+
return (_c = visibleItems[item.index + 1]) !== null && _c !== void 0 ? _c : null;
|
|
25
|
+
case treeDataTypes.arrowUp:
|
|
26
|
+
return (_d = visibleItems[item.index - 1]) !== null && _d !== void 0 ? _d : null;
|
|
27
|
+
default:
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function* makeVisibleItemsGenerator() {
|
|
32
|
+
var _a;
|
|
33
|
+
visibleItems = [];
|
|
34
|
+
for (let index = 0, visibleIndex = 0; index < unfilteredFlatTree.items.length; index++) {
|
|
35
|
+
const item = unfilteredFlatTree.items[index];
|
|
36
|
+
const parent = unfilteredFlatTree.itemsPerId.get((_a = item.parentId) !== null && _a !== void 0 ? _a : flatTreeRootParentId);
|
|
37
|
+
if (!parent) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
if (isFlatTreeItemVisible(item, {
|
|
41
|
+
openItems,
|
|
42
|
+
unfilteredFlatTree
|
|
43
|
+
})) {
|
|
44
|
+
item.index = visibleIndex++;
|
|
45
|
+
visibleItems.push({
|
|
46
|
+
...item
|
|
47
|
+
});
|
|
48
|
+
yield item;
|
|
49
|
+
} else {
|
|
50
|
+
index += parent.childrenSize - 1 + item.childrenSize;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
getNextNavigableItem,
|
|
56
|
+
items: () => {
|
|
57
|
+
return visibleItems || makeVisibleItemsGenerator();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function isFlatTreeItemVisible(item, {
|
|
62
|
+
openItems,
|
|
63
|
+
unfilteredFlatTree: flatTree
|
|
64
|
+
}) {
|
|
65
|
+
if (item.level === 1) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
while (item.parentId && item.parentId !== flatTreeRootParentId) {
|
|
69
|
+
if (!openItems.has(item.parentId)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const parent = flatTree.itemsPerId.get(item.parentId);
|
|
73
|
+
if (!parent) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
item = parent;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=createVisibleFlatTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["flatTreeRootParentId","treeDataTypes","createVisibleFlatTree","unfilteredFlatTree","openItems","visibleItems","getNextNavigableItem","data","item","itemsPerId","get","target","id","type","arrowLeft","parentId","_a","arrowRight","_b","index","end","length","home","arrowDown","_c","arrowUp","_d","makeVisibleItemsGenerator","visibleIndex","items","parent","isFlatTreeItemVisible","push","childrenSize","flatTree","level","has"],"sources":["../src/packages/react-components/react-tree/src/utils/createVisibleFlatTree.ts"],"sourcesContent":["import { FlatTree, FlatTreeItem } from '../hooks/useFlatTree';\nimport { TreeItemId, TreeNavigationData_unstable } from '../Tree';\nimport { flatTreeRootParentId, UnfilteredFlatTree } from './createUnfilteredFlatTree';\nimport { ImmutableSet } from './ImmutableSet';\nimport { treeDataTypes } from './tokens';\n\n/**\n * creates methods that depend on the unfilteredFlatTree and the current available openItems\n */\nexport function createVisibleFlatTree(\n unfilteredFlatTree: UnfilteredFlatTree,\n openItems: ImmutableSet<TreeItemId>,\n): Pick<FlatTree, 'items' | 'getNextNavigableItem'> {\n let visibleItems: FlatTreeItem[] | null = null;\n\n const getNextNavigableItem = (data: TreeNavigationData_unstable): FlatTreeItem | null => {\n const item = unfilteredFlatTree.itemsPerId.get(data.target.id);\n if (!item || !visibleItems) {\n return null;\n }\n switch (data.type) {\n case treeDataTypes.arrowLeft:\n return item.parentId ? unfilteredFlatTree.itemsPerId.get(item.parentId) ?? null : null;\n case treeDataTypes.arrowRight:\n return visibleItems[item.index + 1] ?? null;\n case treeDataTypes.end:\n return visibleItems[visibleItems.length - 1];\n case treeDataTypes.home:\n return visibleItems[0];\n case treeDataTypes.arrowDown:\n return visibleItems[item.index + 1] ?? null;\n case treeDataTypes.arrowUp:\n return visibleItems[item.index - 1] ?? null;\n default:\n return null;\n }\n };\n\n function* makeVisibleItemsGenerator() {\n visibleItems = [];\n for (let index = 0, visibleIndex = 0; index < unfilteredFlatTree.items.length; index++) {\n const item = unfilteredFlatTree.items[index];\n const parent = unfilteredFlatTree.itemsPerId.get(item.parentId ?? flatTreeRootParentId);\n if (!parent) {\n break;\n }\n if (isFlatTreeItemVisible(item, { openItems, unfilteredFlatTree })) {\n item.index = visibleIndex++;\n visibleItems.push({ ...item });\n yield item;\n } else {\n index += parent.childrenSize - 1 + item.childrenSize;\n }\n }\n }\n\n return {\n getNextNavigableItem,\n items: () => {\n return visibleItems || makeVisibleItemsGenerator();\n },\n };\n}\n\nfunction isFlatTreeItemVisible(\n item: FlatTreeItem,\n {\n openItems,\n unfilteredFlatTree: flatTree,\n }: {\n openItems: ImmutableSet<TreeItemId>;\n unfilteredFlatTree: UnfilteredFlatTree;\n },\n) {\n if (item.level === 1) {\n return true;\n }\n while (item.parentId && item.parentId !== flatTreeRootParentId) {\n if (!openItems.has(item.parentId)) {\n return false;\n }\n const parent = flatTree.itemsPerId.get(item.parentId);\n if (!parent) {\n return false;\n }\n item = parent;\n }\n\n return true;\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,QAA4B,4BAA4B;AAErF,SAASC,aAAa,QAAQ,UAAU;AAExC;;;AAGA,OAAM,SAAUC,qBAAqBA,CACnCC,kBAAsC,EACtCC,SAAmC;EAEnC,IAAIC,YAAY,GAA0B,IAAI;EAE9C,MAAMC,oBAAoB,GAAIC,IAAiC,IAAyB;;IACtF,MAAMC,IAAI,GAAGL,kBAAkB,CAACM,UAAU,CAACC,GAAG,CAACH,IAAI,CAACI,MAAM,CAACC,EAAE,CAAC;IAC9D,IAAI,CAACJ,IAAI,IAAI,CAACH,YAAY,EAAE;MAC1B,OAAO,IAAI;;IAEb,QAAQE,IAAI,CAACM,IAAI;MACf,KAAKZ,aAAa,CAACa,SAAS;QAC1B,OAAON,IAAI,CAACO,QAAQ,GAA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;MACvF,IAAI,CAAC8B,MAAM,EAAE;QACX;;MAEF,IAAIC,qBAAqB,CAACvB,IAAI,EAAE;QAAEJ,SAAS;QAAED;MAAkB,CAAE,CAAC,EAAE;QAClEK,IAAI,CAACW,KAAK,GAAGS,YAAY,EAAE;QAC3BvB,YAAY,CAAC2B,IAAI,CAAC;UAAE,GAAGxB;QAAI,CAAE,CAAC;QAC9B,MAAMA,IAAI;OACX,MAAM;QACLW,KAAK,IAAIW,MAAM,CAACG,YAAY,GAAG,CAAC,GAAGzB,IAAI,CAACyB,YAAY;;;EAG1D;EAEA,OAAO;IACL3B,oBAAoB;IACpBuB,KAAK,EAAEA,CAAA,KAAK;MACV,OAAOxB,YAAY,IAAIsB,yBAAyB,EAAE;IACpD;GACD;AACH;AAEA,SAASI,qBAAqBA,CAC5BvB,IAAkB,EAClB;EACEJ,SAAS;EACTD,kBAAkB,EAAE+B;AAAQ,CAI7B;EAED,IAAI1B,IAAI,CAAC2B,KAAK,KAAK,CAAC,EAAE;IACpB,OAAO,IAAI;;EAEb,OAAO3B,IAAI,CAACO,QAAQ,IAAIP,IAAI,CAACO,QAAQ,KAAKf,oBAAoB,EAAE;IAC9D,IAAI,CAACI,SAAS,CAACgC,GAAG,CAAC5B,IAAI,CAACO,QAAQ,CAAC,EAAE;MACjC,OAAO,KAAK;;IAEd,MAAMe,MAAM,GAAGI,QAAQ,CAACzB,UAAU,CAACC,GAAG,CAACF,IAAI,CAACO,QAAQ,CAAC;IACrD,IAAI,CAACe,MAAM,EAAE;MACX,OAAO,KAAK;;IAEdtB,IAAI,GAAGsB,MAAM;;EAGf,OAAO,IAAI;AACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["count","flattenTreeRecursive_unstable","items","parent","level","flatTreeItems","index","length","subtree","item","flatTreeItem","parentId","id","_a","leaf","undefined","push","flattenTree_unstable"],"sources":["
|
|
1
|
+
{"version":3,"names":["count","flattenTreeRecursive_unstable","items","parent","level","flatTreeItems","index","length","subtree","item","flatTreeItem","parentId","id","_a","leaf","undefined","push","flattenTree_unstable"],"sources":["../src/packages/react-components/react-tree/src/utils/flattenTree.ts"],"sourcesContent":["import { FlatTreeItemProps } from '../hooks/useFlatTree';\nimport { TreeItemProps } from '../TreeItem';\n\nexport type NestedTreeItem = Omit<TreeItemProps, 'subtree'> & {\n subtree?: NestedTreeItem[];\n};\n\nlet count = 1;\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction flattenTreeRecursive_unstable(\n items: NestedTreeItem[],\n parent?: FlatTreeItemProps,\n level = 1,\n): FlatTreeItemProps[] {\n const flatTreeItems: FlatTreeItemProps[] = [];\n for (let index = 0; index < items.length; index++) {\n const { subtree, ...item } = items[index];\n const flatTreeItem: FlatTreeItemProps = {\n 'aria-level': level,\n 'aria-posinset': index + 1,\n 'aria-setsize': items.length,\n parentId: parent?.id,\n id: item.id ?? `fui-FlatTreeItem-${count++}`,\n leaf: subtree === undefined,\n ...item,\n };\n flatTreeItems.push(flatTreeItem);\n if (subtree !== undefined) {\n flatTreeItems.push(...flattenTreeRecursive_unstable(subtree, flatTreeItem, level + 1));\n }\n }\n return flatTreeItems;\n}\n\n/**\n * Converts a nested structure to a flat one which can be consumed by `useFlatTreeItems`\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const flattenTree_unstable: (items: NestedTreeItem[]) => FlatTreeItemProps[] = flattenTreeRecursive_unstable;\n"],"mappings":"AAOA,IAAIA,KAAK,GAAG,CAAC;AAEb;AACA,SAASC,6BAA6BA,CACpCC,KAAuB,EACvBC,MAA0B,EAC1BC,KAAK,GAAG,CAAC;;EAET,MAAMC,aAAa,GAAwB,EAAE;EAC7C,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGJ,KAAK,CAACK,MAAM,EAAED,KAAK,EAAE,EAAE;IACjD,MAAM;MAAEE,OAAO;MAAE,GAAGC;IAAI,CAAE,GAAGP,KAAK,CAACI,KAAK,CAAC;IACzC,MAAMI,YAAY,GAAsB;MACtC,YAAY,EAAEN,KAAK;MACnB,eAAe,EAAEE,KAAK,GAAG,CAAC;MAC1B,cAAc,EAAEJ,KAAK,CAACK,MAAM;MAC5BI,QAAQ,EAAER,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAES,EAAE;MACpBA,EAAE,EAAE,CAAAC,EAAA,GAAAJ,IAAI,CAACG,EAAE,cAAAC,EAAA,cAAAA,EAAA,GAAI,oBAAoBb,KAAK,EAAE,EAAE;MAC5Cc,IAAI,EAAEN,OAAO,KAAKO,SAAS;MAC3B,GAAGN;KACJ;IACDJ,aAAa,CAACW,IAAI,CAACN,YAAY,CAAC;IAChC,IAAIF,OAAO,KAAKO,SAAS,EAAE;MACzBV,aAAa,CAACW,IAAI,CAAC,GAAGf,6BAA6B,CAACO,OAAO,EAAEE,YAAY,EAAEN,KAAK,GAAG,CAAC,CAAC,CAAC;;;EAG1F,OAAOC,aAAa;AACtB;AAEA;;;AAGA;AACA,OAAO,MAAMY,oBAAoB,GAAqDhB,6BAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["nextTypeAheadElement","treeWalker","key","keyToLowerCase","toLowerCase","typeAheadFilter","element","_a","textContent","trim","charAt","NodeFilter","FILTER_ACCEPT","FILTER_SKIP","nextElement","currentElement","root"],"sources":["
|
|
1
|
+
{"version":3,"names":["nextTypeAheadElement","treeWalker","key","keyToLowerCase","toLowerCase","typeAheadFilter","element","_a","textContent","trim","charAt","NodeFilter","FILTER_ACCEPT","FILTER_SKIP","nextElement","currentElement","root"],"sources":["../src/packages/react-components/react-tree/src/utils/nextTypeAheadElement.ts"],"sourcesContent":["import { HTMLElementWalker } from '../hooks/useHTMLElementWalker';\n\nexport function nextTypeAheadElement(treeWalker: HTMLElementWalker, key: string) {\n const keyToLowerCase = key.toLowerCase();\n const typeAheadFilter = (element: HTMLElement) => {\n return element.textContent?.trim().charAt(0).toLowerCase() === keyToLowerCase\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_SKIP;\n };\n let nextElement = treeWalker.nextElement(typeAheadFilter);\n if (!nextElement) {\n treeWalker.currentElement = treeWalker.root;\n nextElement = treeWalker.nextElement(typeAheadFilter);\n }\n return nextElement;\n}\n"],"mappings":"AAEA,OAAM,SAAUA,oBAAoBA,CAACC,UAA6B,EAAEC,GAAW;EAC7E,MAAMC,cAAc,GAAGD,GAAG,CAACE,WAAW,EAAE;EACxC,MAAMC,eAAe,GAAIC,OAAoB,IAAI;;IAC/C,OAAO,EAAAC,EAAA,GAAAD,OAAO,CAACE,WAAW,cAAAD,EAAA,uBAAAA,EAAA,CAAEE,IAAI,GAAGC,MAAM,CAAC,CAAC,EAAEN,WAAW,EAAE,MAAKD,cAAc,GACzEQ,UAAU,CAACC,aAAa,GACxBD,UAAU,CAACE,WAAW;EAC5B,CAAC;EACD,IAAIC,WAAW,GAAGb,UAAU,CAACa,WAAW,CAACT,eAAe,CAAC;EACzD,IAAI,CAACS,WAAW,EAAE;IAChBb,UAAU,CAACc,cAAc,GAAGd,UAAU,CAACe,IAAI;IAC3CF,WAAW,GAAGb,UAAU,CAACa,WAAW,CAACT,eAAe,CAAC;;EAEvD,OAAOS,WAAW;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeOpenItems","openSubtrees","options","keepUndefined","undefined","Array","isArray"],"sources":["
|
|
1
|
+
{"version":3,"names":["normalizeOpenItems","openSubtrees","options","keepUndefined","undefined","Array","isArray"],"sources":["../src/packages/react-components/react-tree/src/utils/normalizeOpenItems.ts"],"sourcesContent":["export function normalizeOpenItems(\n openSubtrees?: string | string[],\n options?: {\n keepUndefined?: false;\n },\n): string[];\n\nexport function normalizeOpenItems(\n openSubtrees?: string | string[],\n options?: {\n keepUndefined: true;\n },\n): string[] | undefined;\n\nexport function normalizeOpenItems(\n openSubtrees?: string | string[],\n options?: {\n keepUndefined?: boolean;\n },\n): string[] | undefined {\n if (!openSubtrees) {\n return options?.keepUndefined ? undefined : [];\n }\n return Array.isArray(openSubtrees) ? openSubtrees : [openSubtrees];\n}\n"],"mappings":"AAcA,OAAM,SAAUA,kBAAkBA,CAChCC,YAAgC,EAChCC,OAEC;EAED,IAAI,CAACD,YAAY,EAAE;IACjB,OAAO,CAAAC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,aAAa,IAAGC,SAAS,GAAG,EAAE;;EAEhD,OAAOC,KAAK,CAACC,OAAO,CAACL,YAAY,CAAC,GAAGA,YAAY,GAAG,CAACA,YAAY,CAAC;AACpE"}
|
package/lib/utils/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","treeItemLevelToken","treeAvatarSize","medium","small","treeDataTypes","arrowLeft","arrowRight","enter","click","expandIconClick","end","home","arrowUp","arrowDown","typeAhead"],"sources":["
|
|
1
|
+
{"version":3,"names":["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","treeItemLevelToken","treeAvatarSize","medium","small","treeDataTypes","arrowLeft","arrowRight","enter","click","expandIconClick","end","home","arrowUp","arrowDown","typeAhead"],"sources":["../src/packages/react-components/react-tree/src/utils/tokens.ts"],"sourcesContent":["import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Home } from '@fluentui/keyboard-keys';\nimport { TreeNavigationData_unstable, TreeOpenChangeData } from '../Tree';\n\nexport const treeItemLevelToken = '--fluent-TreeItem--level' as const;\n\nexport const treeAvatarSize = {\n medium: 32,\n small: 24,\n} as const;\n\nexport const treeDataTypes: {\n readonly [K in Uncapitalize<TreeOpenChangeData['type'] | TreeNavigationData_unstable['type']>]: Capitalize<K>;\n} = {\n arrowLeft: ArrowLeft,\n arrowRight: ArrowRight,\n enter: 'Enter',\n click: 'Click',\n expandIconClick: 'ExpandIconClick',\n end: End,\n home: Home,\n arrowUp: ArrowUp,\n arrowDown: ArrowDown,\n typeAhead: 'TypeAhead',\n};\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,OAAO,EAAEC,GAAG,EAAEC,IAAI,QAAQ,yBAAyB;AAG9F,OAAO,MAAMC,kBAAkB,GAAG,0BAAmC;AAErE,OAAO,MAAMC,cAAc,GAAG;EAC5BC,MAAM,EAAE,EAAE;EACVC,KAAK,EAAE;CACC;AAEV,OAAO,MAAMC,aAAa,GAEtB;EACFC,SAAS,EAAEV,SAAS;EACpBW,UAAU,EAAEV,UAAU;EACtBW,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE,OAAO;EACdC,eAAe,EAAE,iBAAiB;EAClCC,GAAG,EAAEZ,GAAG;EACRa,IAAI,EAAEZ,IAAI;EACVa,OAAO,EAAEf,OAAO;EAChBgB,SAAS,EAAEnB,SAAS;EACpBoB,SAAS,EAAE;CACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["treeItemFilter","element","getAttribute","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"sources":["
|
|
1
|
+
{"version":3,"names":["treeItemFilter","element","getAttribute","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"sources":["../src/packages/react-components/react-tree/src/utils/treeItemFilter.ts"],"sourcesContent":["export const treeItemFilter = (element: HTMLElement) => {\n return element.getAttribute('role') === 'treeitem' ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAIC,OAAoB,IAAI;EACrD,OAAOA,OAAO,CAACC,YAAY,CAAC,MAAM,CAAC,KAAK,UAAU,GAAGC,UAAU,CAACC,aAAa,GAAGD,UAAU,CAACE,WAAW;AACxG,CAAC"}
|
package/lib-commonjs/Tree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-tree/src/Tree.ts"],"sourcesContent":["export * from './components/Tree/index';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,6BAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-tree/src/TreeItem.ts"],"sourcesContent":["export * from './components/TreeItem/index';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,iCAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-tree/src/TreeItemLayout.ts"],"sourcesContent":["export * from './components/TreeItemLayout/index';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,uCAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-tree/src/TreeItemPersonaLayout.ts"],"sourcesContent":["export * from './components/TreeItemPersonaLayout/index';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,8CAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","require","useTree_1","renderTree_1","useTreeStyles_1","useTreeContextValues_1","exports","Tree","forwardRef","props","ref","state","useTree_unstable","useTreeStyles_unstable","contextValues","useTreeContextValues_unstable","renderTree_unstable","displayName"],"sources":["
|
|
1
|
+
{"version":3,"names":["React","require","useTree_1","renderTree_1","useTreeStyles_1","useTreeContextValues_1","exports","Tree","forwardRef","props","ref","state","useTree_unstable","useTreeStyles_unstable","contextValues","useTreeContextValues_unstable","renderTree_unstable","displayName"],"sources":["../src/packages/react-components/react-tree/src/components/Tree/Tree.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTree_unstable } from './useTree';\nimport { renderTree_unstable } from './renderTree';\nimport { useTreeStyles_unstable } from './useTreeStyles';\nimport type { TreeProps } from './Tree.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTreeContextValues_unstable } from './useTreeContextValues';\n\n/**\n * A tree view widget presents a hierarchical list.\n * Any item in the hierarchy may have child items,\n * and items that have children may be expanded or collapsed to show or hide the children.\n * For example, in a file system navigator that uses a tree view to display folders and files,\n * an item representing a folder can be expanded to reveal the contents of the folder,\n * which may be files, folders, or both.\n */\nexport const Tree: ForwardRefComponent<TreeProps> = React.forwardRef((props, ref) => {\n const state = useTree_unstable(props, ref);\n useTreeStyles_unstable(state);\n const contextValues = useTreeContextValues_unstable(state);\n return renderTree_unstable(state, contextValues);\n});\n\nTree.displayName = 'Tree';\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,SAAA,gBAAAD,OAAA;AACA,MAAAE,YAAA,gBAAAF,OAAA;AACA,MAAAG,eAAA,gBAAAH,OAAA;AAGA,MAAAI,sBAAA,gBAAAJ,OAAA;AAEA;;;;;;;;AAQaK,OAAA,CAAAC,IAAI,gBAAmCP,KAAK,CAACQ,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAClF,MAAMC,KAAK,GAAGT,SAAA,CAAAU,gBAAgB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAC1CN,eAAA,CAAAS,sBAAsB,CAACF,KAAK,CAAC;EAC7B,MAAMG,aAAa,GAAGT,sBAAA,CAAAU,6BAA6B,CAACJ,KAAK,CAAC;EAC1D,OAAOR,YAAA,CAAAa,mBAAmB,CAACL,KAAK,EAAEG,aAAa,CAAC;AAClD,CAAC,CAAC;AAEFR,OAAA,CAAAC,IAAI,CAACU,WAAW,GAAG,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["
|
|
1
|
+
{"version":3,"names":[],"sources":["../src/packages/react-components/react-tree/src/components/Tree/Tree.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TreeContextValue } from '../../contexts/treeContext';\nimport { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\n\nexport type TreeSlots = {\n root: Slot<'div'>;\n};\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationData_unstable =\n | { event: React.MouseEvent<HTMLElement>; target: HTMLElement; type: 'Click' }\n | { event: React.KeyboardEvent<HTMLElement>; target: HTMLElement; type: 'TypeAhead' }\n | { event: React.KeyboardEvent<HTMLElement>; target: HTMLElement; type: typeof ArrowRight }\n | { event: React.KeyboardEvent<HTMLElement>; target: HTMLElement; type: typeof ArrowLeft }\n | { event: React.KeyboardEvent<HTMLElement>; target: HTMLElement; type: typeof ArrowUp }\n | { event: React.KeyboardEvent<HTMLElement>; target: HTMLElement; type: typeof ArrowDown }\n | { event: React.KeyboardEvent<HTMLElement>; target: HTMLElement; type: typeof Home }\n | { event: React.KeyboardEvent<HTMLElement>; target: HTMLElement; type: typeof End };\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationEvent_unstable = TreeNavigationData_unstable['event'];\n\nexport type TreeOpenChangeData = { open: boolean } & (\n | {\n event: React.MouseEvent<HTMLElement>;\n target: HTMLElement;\n type: 'ExpandIconClick';\n }\n | {\n event: React.MouseEvent<HTMLElement>;\n target: HTMLElement;\n type: 'Click';\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof Enter;\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof ArrowRight;\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof ArrowLeft;\n }\n);\n\nexport type TreeOpenChangeEvent = TreeOpenChangeData['event'];\n\nexport type TreeContextValues = {\n tree: TreeContextValue;\n};\n\nexport type TreeItemId = string | number;\n\nexport type TreeProps = ComponentProps<TreeSlots> & {\n /**\n * A tree item can have various appearances:\n * - 'subtle' (default): The default tree item styles.\n * - 'subtle-alpha': Minimizes emphasis on hovered or focused states.\n * - 'transparent': Removes background color.\n * @default 'subtle'\n */\n appearance?: 'subtle' | 'subtle-alpha' | 'transparent';\n /**\n * Size of the tree item.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n /**\n * This refers to a list of ids of opened tree items.\n * Controls the state of the open tree items.\n * These property is ignored for subtrees.\n */\n openItems?: Iterable<TreeItemId>;\n /**\n * This refers to a list of ids of opened tree items.\n * Default value for the uncontrolled state of open tree items.\n * These property is ignored for subtrees.\n */\n defaultOpenItems?: Iterable<TreeItemId>;\n /**\n * Callback fired when the component changes value from open state.\n * These property is ignored for subtrees.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n * such as open value and type of interaction that created the event.\n */\n onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData): void;\n\n /**\n * Callback fired when navigation happens inside the component.\n * These property is ignored for subtrees.\n *\n * FIXME: This method is not ideal, as navigation should be handled internally by tabster.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;\n};\n\n/**\n * State used in rendering Tree\n */\nexport type TreeState = ComponentState<TreeSlots> & TreeContextValue;\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-tree/src/components/Tree/index.ts"],"sourcesContent":["export * from './Tree';\nexport * from './Tree.types';\nexport * from './renderTree';\nexport * from './useTree';\nexport * from './useTreeStyles';\nexport * from './useTreeContextValues';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,YAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,kBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,kBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,eAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,qBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,4BAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","require","react_utilities_1","contexts_1","renderTree_unstable","state","contextValues","slots","slotProps","getSlots","createElement","TreeProvider","value","tree","root","children","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["React","require","react_utilities_1","contexts_1","renderTree_unstable","state","contextValues","slots","slotProps","getSlots","createElement","TreeProvider","value","tree","root","children","exports"],"sources":["../src/packages/react-components/react-tree/src/components/Tree/renderTree.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TreeState, TreeSlots, TreeContextValues } from './Tree.types';\nimport { TreeProvider } from '../../contexts';\n\nexport const renderTree_unstable = (state: TreeState, contextValues: TreeContextValues) => {\n const { slots, slotProps } = getSlots<TreeSlots>(state);\n\n return (\n <TreeProvider value={contextValues.tree}>\n <slots.root {...slotProps.root}>{slotProps.root.children}</slots.root>\n </TreeProvider>\n );\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAEA,MAAAE,UAAA,gBAAAF,OAAA;AAEO,MAAMG,mBAAmB,GAAGA,CAACC,KAAgB,EAAEC,aAAgC,KAAI;EACxF,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGN,iBAAA,CAAAO,QAAQ,CAAYJ,KAAK,CAAC;EAEvD,OACEL,KAAA,CAAAU,aAAA,CAACP,UAAA,CAAAQ,YAAY;IAACC,KAAK,EAAEN,aAAa,CAACO;EAAI,GACrCb,KAAA,CAAAU,aAAA,CAACH,KAAK,CAACO,IAAI;IAAA,GAAKN,SAAS,CAACM;EAAI,GAAGN,SAAS,CAACM,IAAI,CAACC,QAAQ,CAAc,CACzD;AAEnB,CAAC;AARYC,OAAA,CAAAZ,mBAAmB,GAAAA,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["react_utilities_1","require","contexts_1","hooks_1","tokens_1","useTree_unstable","props","ref","isSubtree","useTreeContext_unstable","ctx","level","useSubtree","useRootTree","exports","contextAppearance","appearance","contextSize","size","parentLevel","openItems","requestOpenChange","requestNavigation","components","root","getNativeElementProps","role","warnIfNoProperPropsRootTree","updateOpenItems","useOpenItemsState","navigate","navigationRef","useNestedTreeNavigation","useEventCallback","data","_a","onOpenChange","call","event","isDefaultPrevented","onNavigation_unstable","type","treeDataTypes","arrowDown","arrowUp","preventDefault","useMergedRefs","process","env","NODE_ENV","console","warn"],"sources":["
|
|
1
|
+
{"version":3,"names":["react_utilities_1","require","contexts_1","hooks_1","tokens_1","useTree_unstable","props","ref","isSubtree","useTreeContext_unstable","ctx","level","useSubtree","useRootTree","exports","contextAppearance","appearance","contextSize","size","parentLevel","openItems","requestOpenChange","requestNavigation","components","root","getNativeElementProps","role","warnIfNoProperPropsRootTree","updateOpenItems","useOpenItemsState","navigate","navigationRef","useNestedTreeNavigation","useEventCallback","data","_a","onOpenChange","call","event","isDefaultPrevented","onNavigation_unstable","type","treeDataTypes","arrowDown","arrowUp","preventDefault","useMergedRefs","process","env","NODE_ENV","console","warn"],"sources":["../src/packages/react-components/react-tree/src/components/Tree/useTree.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { TreeOpenChangeData, TreeProps, TreeState, TreeNavigationData_unstable } from './Tree.types';\nimport { useTreeContext_unstable } from '../../contexts';\nimport { useNestedTreeNavigation, useOpenItemsState } from '../../hooks';\nimport { treeDataTypes } from '../../utils/tokens';\n\n/**\n * Create the state required to render Tree.\n *\n * The returned state can be modified with hooks such as useTreeStyles_unstable,\n * before being passed to renderTree_unstable.\n *\n * @param props - props from this instance of Tree\n * @param ref - reference to root HTMLElement of Tree\n */\nexport const useTree_unstable = (props: TreeProps, ref: React.Ref<HTMLElement>): TreeState => {\n const isSubtree = useTreeContext_unstable(ctx => ctx.level > 0);\n // as isSubtree is static, this doesn't break rule of hooks\n // and if this becomes an issue later on, this can be easily converted\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isSubtree ? useSubtree(props, ref) : useRootTree(props, ref);\n};\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 */\nfunction useSubtree(props: TreeProps, ref: React.Ref<HTMLElement>): TreeState {\n const contextAppearance = useTreeContext_unstable(ctx => ctx.appearance);\n const contextSize = useTreeContext_unstable(ctx => ctx.size);\n\n const { appearance = contextAppearance ?? 'subtle', size = contextSize ?? 'medium' } = props;\n\n const parentLevel = useTreeContext_unstable(ctx => ctx.level);\n const openItems = useTreeContext_unstable(ctx => ctx.openItems);\n const requestOpenChange = useTreeContext_unstable(ctx => ctx.requestOpenChange);\n const requestNavigation = useTreeContext_unstable(ctx => ctx.requestNavigation);\n\n return {\n components: {\n root: 'div',\n },\n appearance,\n size,\n level: parentLevel + 1,\n root: getNativeElementProps('div', {\n ref,\n role: 'group',\n ...props,\n }),\n openItems,\n requestOpenChange,\n requestNavigation,\n };\n}\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 */\nfunction useRootTree(props: TreeProps, ref: React.Ref<HTMLElement>): TreeState {\n warnIfNoProperPropsRootTree(props);\n\n const { appearance = 'subtle', size = 'medium' } = props;\n\n const [openItems, updateOpenItems] = useOpenItemsState(props);\n const [navigate, navigationRef] = useNestedTreeNavigation();\n\n const requestOpenChange = useEventCallback((data: TreeOpenChangeData) => {\n props.onOpenChange?.(data.event, data);\n if (data.event.isDefaultPrevented()) {\n return;\n }\n return updateOpenItems(data);\n });\n\n const requestNavigation = useEventCallback((data: TreeNavigationData_unstable) => {\n props.onNavigation_unstable?.(data.event, data);\n if (data.event.isDefaultPrevented()) {\n return;\n }\n navigate(data);\n if (data.type === treeDataTypes.arrowDown || data.type === treeDataTypes.arrowUp) {\n data.event.preventDefault();\n }\n });\n\n return {\n components: {\n root: 'div',\n },\n appearance,\n size,\n level: 1,\n openItems,\n requestOpenChange,\n requestNavigation,\n root: getNativeElementProps('div', {\n ref: useMergedRefs(navigationRef, ref),\n role: 'tree',\n ...props,\n }),\n };\n}\n\nfunction warnIfNoProperPropsRootTree(props: Pick<TreeProps, '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('Tree must have either a `aria-label` or `aria-labelledby` property defined');\n }\n }\n}\n"],"mappings":";;;;;;AACA,MAAAA,iBAAA,gBAAAC,OAAA;AAEA,MAAAC,UAAA,gBAAAD,OAAA;AACA,MAAAE,OAAA,gBAAAF,OAAA;AACA,MAAAG,QAAA,gBAAAH,OAAA;AAEA;;;;;;;;;AASO,MAAMI,gBAAgB,GAAGA,CAACC,KAAgB,EAAEC,GAA2B,KAAe;EAC3F,MAAMC,SAAS,GAAGN,UAAA,CAAAO,uBAAuB,CAACC,GAAG,IAAIA,GAAG,CAACC,KAAK,GAAG,CAAC,CAAC;EAC/D;EACA;EACA;EACA,OAAOH,SAAS,GAAGI,UAAU,CAACN,KAAK,EAAEC,GAAG,CAAC,GAAGM,WAAW,CAACP,KAAK,EAAEC,GAAG,CAAC;AACrE,CAAC;AANYO,OAAA,CAAAT,gBAAgB,GAAAA,gBAAA;AAQ7B;;;;;;AAMA,SAASO,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ACjBE,IAAI,EAAExB,iBAAA,CAAAyB,qBAAqB,CAAC,KAAK,EAAE;MACjClB,GAAG,EAAEP,iBAAA,CAAA8C,aAAa,CAACf,aAAa,EAAExB,GAAG,CAAC;MACtCmB,IAAI,EAAE,MAAM;MACZ,GAAGpB;KACJ;GACF;AACH;AAEA,SAASqB,2BAA2BA,CAACrB,KAAwD;EAC3F,IAAIyC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,EAAE;IAC1C,IAAI,CAAC3C,KAAK,CAAC,YAAY,CAAC,IAAI,CAACA,KAAK,CAAC,iBAAiB,CAAC,EAAE;MACrD;MACA4C,OAAO,CAACC,IAAI,CAAC,4EAA4E,CAAC;;;AAGhG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useTreeContextValues_unstable","state","openItems","level","appearance","size","requestOpenChange","requestNavigation","tree","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["useTreeContextValues_unstable","state","openItems","level","appearance","size","requestOpenChange","requestNavigation","tree","exports"],"sources":["../src/packages/react-components/react-tree/src/components/Tree/useTreeContextValues.ts"],"sourcesContent":["import { TreeContextValue } from '../../contexts';\nimport type { TreeContextValues, TreeState } from './Tree.types';\n\nexport function useTreeContextValues_unstable(state: TreeState): TreeContextValues {\n const { openItems, level, appearance, size, requestOpenChange, requestNavigation } = state;\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const tree: TreeContextValue = {\n appearance,\n size,\n level,\n openItems,\n requestOpenChange,\n requestNavigation,\n };\n\n return { tree };\n}\n"],"mappings":";;;;;;AAGA,SAAgBA,6BAA6BA,CAACC,KAAgB;EAC5D,MAAM;IAAEC,SAAS;IAAEC,KAAK;IAAEC,UAAU;IAAEC,IAAI;IAAEC,iBAAiB;IAAEC;EAAiB,CAAE,GAAGN,KAAK;EAC1F;;;;EAIA,MAAMO,IAAI,GAAqB;IAC7BJ,UAAU;IACVC,IAAI;IACJF,KAAK;IACLD,SAAS;IACTI,iBAAiB;IACjBC;GACD;EAED,OAAO;IAAEC;EAAI,CAAE;AACjB;AAhBAC,OAAA,CAAAT,6BAAA,GAAAA,6BAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["react_1","require","react_theme_1","exports","treeClassNames","root","useStyles","__styles","mc9l5x","Beiy3e4","Belr9w4","d","useTreeStyles_unstable","state","styles","className","mergeClasses"],"sources":["
|
|
1
|
+
{"version":3,"names":["react_1","require","react_theme_1","exports","treeClassNames","root","useStyles","__styles","mc9l5x","Beiy3e4","Belr9w4","d","useTreeStyles_unstable","state","styles","className","mergeClasses"],"sources":["../src/packages/react-components/react-tree/src/components/Tree/useTreeStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport type { TreeSlots, TreeState } from './Tree.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\n\nexport const treeClassNames: SlotClassNames<TreeSlots> = {\n root: 'fui-Tree',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n rowGap: tokens.spacingVerticalXXS,\n },\n});\n\nexport const useTreeStyles_unstable = (state: TreeState): TreeState => {\n const styles = useStyles();\n state.root.className = mergeClasses(treeClassNames.root, styles.root, state.root.className);\n\n return state;\n};\n"],"mappings":";;;;;;AAAA,MAAAA,OAAA,gBAAAC,OAAA;AAGA,MAAAC,aAAA,gBAAAD,OAAA;AAEaE,OAAA,CAAAC,cAAc,GAA8B;EACvDC,IAAI,EAAE;CACP;AAED,MAAMC,SAAS,gBAAGN,OAAA,CAAAO,QAAU;EAAAF,IAAA;IAAAG,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAM1B;AAEK,MAAMC,sBAAsB,GAAIC,KAAgB,IAAe;EACpE,MAAMC,MAAM,GAAGR,SAAS,EAAE;EAC1BO,KAAK,CAACR,IAAI,CAACU,SAAS,GAAGf,OAAA,CAAAgB,YAAY,CAACb,OAAA,CAAAC,cAAc,CAACC,IAAI,EAAES,MAAM,CAACT,IAAI,EAAEQ,KAAK,CAACR,IAAI,CAACU,SAAS,CAAC;EAE3F,OAAOF,KAAK;AACd,CAAC;AALYV,OAAA,CAAAS,sBAAsB,GAAAA,sBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","require","useTreeItem_1","renderTreeItem_1","useTreeItemStyles_1","useTreeItemContextValues_1","exports","TreeItem","forwardRef","props","ref","state","useTreeItem_unstable","useTreeItemStyles_unstable","contextValues","useTreeItemContextValues_unstable","renderTreeItem_unstable","displayName"],"sources":["
|
|
1
|
+
{"version":3,"names":["React","require","useTreeItem_1","renderTreeItem_1","useTreeItemStyles_1","useTreeItemContextValues_1","exports","TreeItem","forwardRef","props","ref","state","useTreeItem_unstable","useTreeItemStyles_unstable","contextValues","useTreeItemContextValues_unstable","renderTreeItem_unstable","displayName"],"sources":["../src/packages/react-components/react-tree/src/components/TreeItem/TreeItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTreeItem_unstable } from './useTreeItem';\nimport { renderTreeItem_unstable } from './renderTreeItem';\nimport { useTreeItemStyles_unstable } from './useTreeItemStyles';\nimport type { TreeItemProps } from './TreeItem.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTreeItemContextValues_unstable } from './useTreeItemContextValues';\n\n/**\n * TreeItem component - TODO: add more docs\n */\nexport const TreeItem: ForwardRefComponent<TreeItemProps> = React.forwardRef((props, ref) => {\n const state = useTreeItem_unstable(props, ref);\n\n useTreeItemStyles_unstable(state);\n const contextValues = useTreeItemContextValues_unstable(state);\n return renderTreeItem_unstable(state, contextValues);\n});\n\nTreeItem.displayName = 'TreeItem';\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,aAAA,gBAAAD,OAAA;AACA,MAAAE,gBAAA,gBAAAF,OAAA;AACA,MAAAG,mBAAA,gBAAAH,OAAA;AAGA,MAAAI,0BAAA,gBAAAJ,OAAA;AAEA;;;AAGaK,OAAA,CAAAC,QAAQ,gBAAuCP,KAAK,CAACQ,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAC1F,MAAMC,KAAK,GAAGT,aAAA,CAAAU,oBAAoB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAE9CN,mBAAA,CAAAS,0BAA0B,CAACF,KAAK,CAAC;EACjC,MAAMG,aAAa,GAAGT,0BAAA,CAAAU,iCAAiC,CAACJ,KAAK,CAAC;EAC9D,OAAOR,gBAAA,CAAAa,uBAAuB,CAACL,KAAK,EAAEG,aAAa,CAAC;AACtD,CAAC,CAAC;AAEFR,OAAA,CAAAC,QAAQ,CAACU,WAAW,GAAG,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["tokens_1","require"],"sources":["
|
|
1
|
+
{"version":3,"names":["tokens_1","require"],"sources":["../src/packages/react-components/react-tree/src/components/TreeItem/TreeItem.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, ExtractSlotProps, Slot } from '@fluentui/react-utilities';\nimport type { ButtonContextValue } from '@fluentui/react-button';\nimport type { TreeItemContextValue } from '../../contexts';\nimport { treeItemLevelToken } from '../../utils/tokens';\nimport * as React from 'react';\n\nexport type TreeItemCSSProperties = React.CSSProperties & { [treeItemLevelToken]?: string | number };\n\nexport type TreeItemSlots = {\n root: Slot<ExtractSlotProps<Slot<'div'> & { style?: TreeItemCSSProperties }>>;\n content: NonNullable<Slot<'div'>>;\n subtree?: Slot<'span'>;\n /**\n * Expand icon slot,\n * by default renders a chevron icon to indicate opening and closing\n */\n expandIcon?: Slot<'span'>;\n /**\n * Actions slot that renders on the end of tree item\n * when the item is hovered/focused\n */\n actions?: Slot<'span'>;\n};\n\nexport type TreeItemContextValues = {\n treeItem: TreeItemContextValue;\n button: ButtonContextValue;\n};\n\n/**\n * TreeItem Props\n */\nexport type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {\n /**\n * If a TreeItem is a leaf, it'll not present the `expandIcon` slot by default.\n * This attribute is used to force the decision if a TreeItem is a leaf or not. By not providing this property\n * this will be inferred by the presence of a subtree as part of the TreeItem children.\n */\n leaf?: boolean;\n};\n\n/**\n * State used in rendering TreeItem\n */\nexport type TreeItemState = ComponentState<TreeItemSlots> & {\n open: boolean;\n isLeaf: boolean;\n level: number;\n /**\n * By design, a button included on the actions slot should be small\n */\n buttonSize: 'small';\n isActionsVisible: boolean;\n};\n"],"mappings":";;;;;AAGA,MAAAA,QAAA,gBAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-tree/src/components/TreeItem/index.ts"],"sourcesContent":["export * from './TreeItem';\nexport * from './TreeItem.types';\nexport * from './renderTreeItem';\nexport * from './useTreeItem';\nexport * from './useTreeItemStyles';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,gBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,sBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,sBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,mBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","require","react_utilities_1","contexts_1","react_button_1","renderTreeItem_unstable","state","contextValues","slots","slotProps","getSlots","createElement","TreeItemProvider","value","treeItem","root","content","expandIcon","children","ButtonContextProvider","button","actions","open","subtree","exports"],"sources":["
|
|
1
|
+
{"version":3,"names":["React","require","react_utilities_1","contexts_1","react_button_1","renderTreeItem_unstable","state","contextValues","slots","slotProps","getSlots","createElement","TreeItemProvider","value","treeItem","root","content","expandIcon","children","ButtonContextProvider","button","actions","open","subtree","exports"],"sources":["../src/packages/react-components/react-tree/src/components/TreeItem/renderTreeItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TreeItemState, TreeItemSlots, TreeItemContextValues } from './TreeItem.types';\nimport { TreeItemProvider } from '../../contexts';\nimport { ButtonContextProvider } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of TreeItem\n */\nexport const renderTreeItem_unstable = (state: TreeItemState, contextValues: TreeItemContextValues) => {\n const { slots, slotProps } = getSlots<TreeItemSlots>(state);\n\n return (\n <TreeItemProvider value={contextValues.treeItem}>\n <slots.root {...slotProps.root}>\n <slots.content {...slotProps.content}>\n {slots.expandIcon && <slots.expandIcon {...slotProps.expandIcon} />}\n {slotProps.content.children}\n <ButtonContextProvider value={contextValues.button}>\n {slots.actions && <slots.actions {...slotProps.actions} />}\n </ButtonContextProvider>\n </slots.content>\n {state.open && slots.subtree && <slots.subtree {...slotProps.subtree} />}\n </slots.root>\n </TreeItemProvider>\n );\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAEA,MAAAE,UAAA,gBAAAF,OAAA;AACA,MAAAG,cAAA,gBAAAH,OAAA;AAEA;;;AAGO,MAAMI,uBAAuB,GAAGA,CAACC,KAAoB,EAAEC,aAAoC,KAAI;EACpG,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGP,iBAAA,CAAAQ,QAAQ,CAAgBJ,KAAK,CAAC;EAE3D,OACEN,KAAA,CAAAW,aAAA,CAACR,UAAA,CAAAS,gBAAgB;IAACC,KAAK,EAAEN,aAAa,CAACO;EAAQ,GAC7Cd,KAAA,CAAAW,aAAA,CAACH,KAAK,CAACO,IAAI;IAAA,GAAKN,SAAS,CAACM;EAAI,GAC5Bf,KAAA,CAAAW,aAAA,CAACH,KAAK,CAACQ,OAAO;IAAA,GAAKP,SAAS,CAACO;EAAO,GACjCR,KAAK,CAACS,UAAU,IAAIjB,KAAA,CAAAW,aAAA,CAACH,KAAK,CAACS,UAAU;IAAA,GAAKR,SAAS,CAACQ;EAAU,EAAI,EAClER,SAAS,CAACO,OAAO,CAACE,QAAQ,EAC3BlB,KAAA,CAAAW,aAAA,CAACP,cAAA,CAAAe,qBAAqB;IAACN,KAAK,EAAEN,aAAa,CAACa;EAAM,GAC/CZ,KAAK,CAACa,OAAO,IAAIrB,KAAA,CAAAW,aAAA,CAACH,KAAK,CAACa,OAAO;IAAA,GAAKZ,SAAS,CAACY;EAAO,EAAI,CACpC,CACV,EACff,KAAK,CAACgB,IAAI,IAAId,KAAK,CAACe,OAAO,IAAIvB,KAAA,CAAAW,aAAA,CAACH,KAAK,CAACe,OAAO;IAAA,GAAKd,SAAS,CAACc;EAAO,EAAI,CAC7D,CACI;AAEvB,CAAC;AAjBYC,OAAA,CAAAnB,uBAAuB,GAAAA,uBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","require","react_utilities_1","react_icons_1","react_shared_contexts_1","react_utilities_2","useTreeItemStyles_1","keyboard_keys_1","react_utilities_3","react_portal_1","index_1","tokens_1","useTreeItem_unstable","props","ref","children","subtreeChildren","Children","toArray","contextLevel","useTreeContext_unstable","ctx","level","content","subtree","expandIcon","leaf","isLeaf","undefined","actions","as","onClick","onKeyDown","rest","requestOpenChange","requestNavigation","id","useId","isBranch","open","openItems","has","dir","targetDocument","useFluent_unstable","expandIconRotation","actionsRef","useRef","expandIconRef","subtreeRef","handleArrowRight","event","type","treeDataTypes","arrowRight","target","currentTarget","handleArrowLeft","arrowLeft","handleEnter","enter","handleClick","useEventCallback","isEventFromActions","current","elementContains","isEventFromSubtree","isFromExpandIcon","expandIconClick","click","handleKeyDown","isDefaultPrevented","key","Enter","ArrowRight","ArrowLeft","End","end","Home","home","ArrowUp","arrowUp","ArrowDown","arrowDown","isTypeAheadCharacter","length","match","altKey","ctrlKey","metaKey","typeAhead","isActionsVisible","setActionsVisible","useState","showActions","hideActions","useEffect","handleFocusOut","relatedTarget","addEventListener","passive","removeEventListener","buttonSize","components","root","resolveShorthand","required","Boolean","defaultProps","useMergedRefs","isResolvedShorthand","getNativeElementProps","tabIndex","role","onMouseOver","onFocus","onMouseOut","onBlur","createElement","ChevronRight12Regular","style","expandIconInlineStyles","exports"],"sources":["../../../../../../../../../packages/react-components/react-tree/src/components/TreeItem/useTreeItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, isResolvedShorthand, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { ChevronRight12Regular } from '@fluentui/react-icons';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { expandIconInlineStyles } from './useTreeItemStyles';\nimport { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\nimport { useMergedRefs } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\nimport type { TreeItemProps, TreeItemState } from './TreeItem.types';\nimport { useTreeContext_unstable } from '../../contexts/index';\nimport { treeDataTypes } from '../../utils/tokens';\n\n/**\n * Create the state required to render TreeItem.\n *\n * The returned state can be modified with hooks such as useTreeItemStyles_unstable,\n * before being passed to renderTreeItem_unstable.\n *\n * @param props - props from this instance of TreeItem\n * @param ref - reference to root HTMLElement of TreeItem\n */\nexport const useTreeItem_unstable = (props: TreeItemProps, ref: React.Ref<HTMLDivElement>): TreeItemState => {\n const [children, subtreeChildren] = React.Children.toArray(props.children);\n\n const contextLevel = useTreeContext_unstable(ctx => ctx.level);\n const {\n content,\n subtree,\n expandIcon,\n leaf: isLeaf = subtreeChildren === undefined,\n actions,\n as = 'div',\n onClick,\n onKeyDown,\n ['aria-level']: level = contextLevel,\n ...rest\n } = props;\n\n const requestOpenChange = useTreeContext_unstable(ctx => ctx.requestOpenChange);\n const requestNavigation = useTreeContext_unstable(ctx => ctx.requestNavigation);\n\n const id = useId('fui-TreeItem-', props.id);\n\n const isBranch = !isLeaf;\n\n const open = useTreeContext_unstable(ctx => isBranch && ctx.openItems.has(id));\n const { dir, targetDocument } = useFluent_unstable();\n const expandIconRotation = open ? 90 : dir !== 'rtl' ? 0 : 180;\n\n const actionsRef = React.useRef<HTMLElement>(null);\n const expandIconRef = React.useRef<HTMLElement>(null);\n const subtreeRef = React.useRef<HTMLElement>(null);\n\n const handleArrowRight = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!open && isBranch) {\n return requestOpenChange({ event, open: true, type: treeDataTypes.arrowRight, target: event.currentTarget });\n }\n if (open && isBranch) {\n return requestNavigation({ event, type: treeDataTypes.arrowRight, target: event.currentTarget });\n }\n };\n const handleArrowLeft = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (open && isBranch) {\n return requestOpenChange({ event, open: false, type: treeDataTypes.arrowLeft, target: event.currentTarget });\n }\n if (!open && level > 1) {\n return requestNavigation({ event, target: event.currentTarget, type: treeDataTypes.arrowLeft });\n }\n };\n const handleEnter = (event: React.KeyboardEvent<HTMLDivElement>) => {\n requestOpenChange({ event, open: isLeaf ? open : !open, type: treeDataTypes.enter, target: event.currentTarget });\n };\n\n const handleClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n\n const isEventFromActions = actionsRef.current && elementContains(actionsRef.current, event.target as Node);\n if (isEventFromActions) {\n return;\n }\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (isEventFromSubtree) {\n return;\n }\n const isFromExpandIcon = expandIconRef.current && elementContains(expandIconRef.current, event.target as Node);\n requestOpenChange({\n event,\n open: isLeaf ? open : !open,\n type: isFromExpandIcon ? treeDataTypes.expandIconClick : treeDataTypes.click,\n target: event.currentTarget,\n });\n requestNavigation({ event, target: event.currentTarget, type: treeDataTypes.click });\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.currentTarget !== event.target) {\n return;\n }\n if (event.isDefaultPrevented()) {\n return;\n }\n switch (event.key) {\n case Enter:\n return handleEnter(event);\n case ArrowRight:\n return handleArrowRight(event);\n case ArrowLeft:\n return handleArrowLeft(event);\n case End:\n return requestNavigation({ event, type: treeDataTypes.end, target: event.currentTarget });\n case Home:\n return requestNavigation({ event, type: treeDataTypes.home, target: event.currentTarget });\n case ArrowUp:\n return requestNavigation({ event, type: treeDataTypes.arrowUp, target: event.currentTarget });\n case ArrowDown:\n return requestNavigation({ event, type: treeDataTypes.arrowDown, target: event.currentTarget });\n }\n const isTypeAheadCharacter =\n event.key.length === 1 && event.key.match(/\\w/) && !event.altKey && !event.ctrlKey && !event.metaKey;\n if (isTypeAheadCharacter) {\n return requestNavigation({ event, target: event.currentTarget, type: treeDataTypes.typeAhead });\n }\n });\n\n const [isActionsVisible, setActionsVisible] = React.useState(false);\n const showActions = useEventCallback((event: React.SyntheticEvent) => {\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (!isEventFromSubtree) {\n setActionsVisible(true);\n }\n });\n const hideActions = useEventCallback((event: React.SyntheticEvent) => {\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (!isEventFromSubtree) {\n setActionsVisible(false);\n }\n });\n\n // Listens to focusout event on the document to ensure treeitem actions visibility on portal scenarios\n // TODO: find a better way to ensure this behavior\n React.useEffect(() => {\n if (actionsRef.current) {\n const handleFocusOut = (event: FocusEvent) => {\n setActionsVisible(elementContains(actionsRef.current, event.relatedTarget as Node));\n };\n targetDocument?.addEventListener('focusout', handleFocusOut, { passive: true });\n return () => {\n targetDocument?.removeEventListener('focusout', handleFocusOut);\n };\n }\n }, [targetDocument]);\n\n return {\n isLeaf,\n open,\n level,\n buttonSize: 'small',\n isActionsVisible: actions ? isActionsVisible : false,\n components: {\n content: 'div',\n root: 'div',\n expandIcon: 'span',\n actions: 'span',\n subtree: 'span',\n },\n subtree: resolveShorthand(subtree, {\n required: Boolean(subtreeChildren),\n defaultProps: {\n children: subtreeChildren,\n ref: useMergedRefs(subtreeRef, isResolvedShorthand(subtree) ? subtree.ref : undefined),\n },\n }),\n content: resolveShorthand(content, {\n required: true,\n defaultProps: {\n children,\n },\n }),\n root: getNativeElementProps(as, {\n tabIndex: -1,\n ...rest,\n id,\n ref,\n children: null,\n 'aria-level': level,\n 'aria-expanded': isBranch ? open : undefined,\n role: 'treeitem',\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n onMouseOver: actions ? showActions : undefined,\n onFocus: actions ? showActions : undefined,\n onMouseOut: actions ? hideActions : undefined,\n onBlur: actions ? hideActions : undefined,\n }),\n expandIcon: resolveShorthand(expandIcon, {\n required: isBranch,\n defaultProps: {\n children: <ChevronRight12Regular style={expandIconInlineStyles[expandIconRotation]} />,\n 'aria-hidden': true,\n ref: useMergedRefs(isResolvedShorthand(expandIcon) ? expandIcon.ref : undefined, expandIconRef),\n },\n }),\n actions: resolveShorthand(actions, {\n defaultProps: {\n ref: useMergedRefs(isResolvedShorthand(actions) ? actions.ref : undefined, actionsRef),\n },\n }),\n };\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AACA,MAAAE,aAAA,gBAAAF,OAAA;AACA,MAAAG,uBAAA,gBAAAH,OAAA;AACA,MAAAI,iBAAA,gBAAAJ,OAAA;AACA,MAAAK,mBAAA,gBAAAL,OAAA;AACA,MAAAM,eAAA,gBAAAN,OAAA;AACA,MAAAO,iBAAA,gBAAAP,OAAA;AACA,MAAAQ,cAAA,gBAAAR,OAAA;AAEA,MAAAS,OAAA,gBAAAT,OAAA;AACA,MAAAU,QAAA,gBAAAV,OAAA;AAEA;;;;;;;;;AASO,MAAMW,oBAAoB,GAAGA,CAACC,KAAoB,EAAEC,GAA8B,KAAmB;EAC1G,MAAM,CAACC,QAAQ,EAAEC,eAAe,CAAC,GAAGhB,KAAK,C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C5CqF,IAAI,EAAE,UAAU;MAChBlF,OAAO,EAAE8B,WAAW;MACpB7B,SAAS,EAAEsC,aAAa;MACxB4C,WAAW,EAAErF,OAAO,GAAGiE,WAAW,GAAGlE,SAAS;MAC9CuF,OAAO,EAAEtF,OAAO,GAAGiE,WAAW,GAAGlE,SAAS;MAC1CwF,UAAU,EAAEvF,OAAO,GAAGkE,WAAW,GAAGnE,SAAS;MAC7CyF,MAAM,EAAExF,OAAO,GAAGkE,WAAW,GAAGnE;KACjC,CAAC;IACFH,UAAU,EAAEvB,iBAAA,CAAAuG,gBAAgB,CAAChF,UAAU,EAAE;MACvCiF,QAAQ,EAAEpE,QAAQ;MAClBsE,YAAY,EAAE;QACZ7F,QAAQ,EAAEf,KAAA,CAAAsH,aAAA,CAACnH,aAAA,CAAAoH,qBAAqB;UAACC,KAAK,EAAElH,mBAAA,CAAAmH,sBAAsB,CAAC5E,kBAAkB;QAAC,EAAI;QACtF,aAAa,EAAE,IAAI;QACnB/B,GAAG,EAAEN,iBAAA,CAAAqG,aAAa,CAAC3G,iBAAA,CAAA4G,mBAAmB,CAACrF,UAAU,CAAC,GAAGA,UAAU,CAACX,GAAG,GAAGc,SAAS,EAAEoB,aAAa;;KAEjG,CAAC;IACFnB,OAAO,EAAE3B,iBAAA,CAAAuG,gBAAgB,CAAC5E,OAAO,EAAE;MACjC+E,YAAY,EAAE;QACZ9F,GAAG,EAAEN,iBAAA,CAAAqG,aAAa,CAAC3G,iBAAA,CAAA4G,mBAAmB,CAACjF,OAAO,CAAC,GAAGA,OAAO,CAACf,GAAG,GAAGc,SAAS,EAAEkB,UAAU;;KAExF;GACF;AACH,CAAC;AA5LY4E,OAAA,CAAA9G,oBAAoB,GAAAA,oBAAA"}
|
|
1
|
+
{"version":3,"names":["React","require","react_utilities_1","react_icons_1","react_shared_contexts_1","react_utilities_2","useTreeItemStyles_1","keyboard_keys_1","react_utilities_3","react_portal_1","index_1","tokens_1","useTreeItem_unstable","props","ref","children","subtreeChildren","Children","toArray","contextLevel","useTreeContext_unstable","ctx","level","content","subtree","expandIcon","leaf","isLeaf","undefined","actions","as","onClick","onKeyDown","rest","requestOpenChange","requestNavigation","id","useId","isBranch","open","openItems","has","dir","targetDocument","useFluent_unstable","expandIconRotation","actionsRef","useRef","expandIconRef","subtreeRef","handleArrowRight","event","type","treeDataTypes","arrowRight","target","currentTarget","handleArrowLeft","arrowLeft","handleEnter","enter","handleClick","useEventCallback","isEventFromActions","current","elementContains","isEventFromSubtree","isFromExpandIcon","expandIconClick","click","handleKeyDown","isDefaultPrevented","key","Enter","ArrowRight","ArrowLeft","End","end","Home","home","ArrowUp","arrowUp","ArrowDown","arrowDown","isTypeAheadCharacter","length","match","altKey","ctrlKey","metaKey","typeAhead","isActionsVisible","setActionsVisible","useState","showActions","hideActions","useEffect","handleFocusOut","relatedTarget","addEventListener","passive","removeEventListener","buttonSize","components","root","resolveShorthand","required","Boolean","defaultProps","useMergedRefs","isResolvedShorthand","getNativeElementProps","tabIndex","role","onMouseOver","onFocus","onMouseOut","onBlur","createElement","ChevronRight12Regular","style","expandIconInlineStyles","exports"],"sources":["../src/packages/react-components/react-tree/src/components/TreeItem/useTreeItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, isResolvedShorthand, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { ChevronRight12Regular } from '@fluentui/react-icons';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { expandIconInlineStyles } from './useTreeItemStyles';\nimport { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\nimport { useMergedRefs } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\nimport type { TreeItemProps, TreeItemState } from './TreeItem.types';\nimport { useTreeContext_unstable } from '../../contexts/index';\nimport { treeDataTypes } from '../../utils/tokens';\n\n/**\n * Create the state required to render TreeItem.\n *\n * The returned state can be modified with hooks such as useTreeItemStyles_unstable,\n * before being passed to renderTreeItem_unstable.\n *\n * @param props - props from this instance of TreeItem\n * @param ref - reference to root HTMLElement of TreeItem\n */\nexport const useTreeItem_unstable = (props: TreeItemProps, ref: React.Ref<HTMLDivElement>): TreeItemState => {\n const [children, subtreeChildren] = React.Children.toArray(props.children);\n\n const contextLevel = useTreeContext_unstable(ctx => ctx.level);\n const {\n content,\n subtree,\n expandIcon,\n leaf: isLeaf = subtreeChildren === undefined,\n actions,\n as = 'div',\n onClick,\n onKeyDown,\n ['aria-level']: level = contextLevel,\n ...rest\n } = props;\n\n const requestOpenChange = useTreeContext_unstable(ctx => ctx.requestOpenChange);\n const requestNavigation = useTreeContext_unstable(ctx => ctx.requestNavigation);\n\n const id = useId('fui-TreeItem-', props.id);\n\n const isBranch = !isLeaf;\n\n const open = useTreeContext_unstable(ctx => isBranch && ctx.openItems.has(id));\n const { dir, targetDocument } = useFluent_unstable();\n const expandIconRotation = open ? 90 : dir !== 'rtl' ? 0 : 180;\n\n const actionsRef = React.useRef<HTMLElement>(null);\n const expandIconRef = React.useRef<HTMLElement>(null);\n const subtreeRef = React.useRef<HTMLElement>(null);\n\n const handleArrowRight = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!open && isBranch) {\n return requestOpenChange({ event, open: true, type: treeDataTypes.arrowRight, target: event.currentTarget });\n }\n if (open && isBranch) {\n return requestNavigation({ event, type: treeDataTypes.arrowRight, target: event.currentTarget });\n }\n };\n const handleArrowLeft = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (open && isBranch) {\n return requestOpenChange({ event, open: false, type: treeDataTypes.arrowLeft, target: event.currentTarget });\n }\n if (!open && level > 1) {\n return requestNavigation({ event, target: event.currentTarget, type: treeDataTypes.arrowLeft });\n }\n };\n const handleEnter = (event: React.KeyboardEvent<HTMLDivElement>) => {\n requestOpenChange({ event, open: isLeaf ? open : !open, type: treeDataTypes.enter, target: event.currentTarget });\n };\n\n const handleClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n\n const isEventFromActions = actionsRef.current && elementContains(actionsRef.current, event.target as Node);\n if (isEventFromActions) {\n return;\n }\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (isEventFromSubtree) {\n return;\n }\n const isFromExpandIcon = expandIconRef.current && elementContains(expandIconRef.current, event.target as Node);\n requestOpenChange({\n event,\n open: isLeaf ? open : !open,\n type: isFromExpandIcon ? treeDataTypes.expandIconClick : treeDataTypes.click,\n target: event.currentTarget,\n });\n requestNavigation({ event, target: event.currentTarget, type: treeDataTypes.click });\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.currentTarget !== event.target) {\n return;\n }\n if (event.isDefaultPrevented()) {\n return;\n }\n switch (event.key) {\n case Enter:\n return handleEnter(event);\n case ArrowRight:\n return handleArrowRight(event);\n case ArrowLeft:\n return handleArrowLeft(event);\n case End:\n return requestNavigation({ event, type: treeDataTypes.end, target: event.currentTarget });\n case Home:\n return requestNavigation({ event, type: treeDataTypes.home, target: event.currentTarget });\n case ArrowUp:\n return requestNavigation({ event, type: treeDataTypes.arrowUp, target: event.currentTarget });\n case ArrowDown:\n return requestNavigation({ event, type: treeDataTypes.arrowDown, target: event.currentTarget });\n }\n const isTypeAheadCharacter =\n event.key.length === 1 && event.key.match(/\\w/) && !event.altKey && !event.ctrlKey && !event.metaKey;\n if (isTypeAheadCharacter) {\n return requestNavigation({ event, target: event.currentTarget, type: treeDataTypes.typeAhead });\n }\n });\n\n const [isActionsVisible, setActionsVisible] = React.useState(false);\n const showActions = useEventCallback((event: React.SyntheticEvent) => {\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (!isEventFromSubtree) {\n setActionsVisible(true);\n }\n });\n const hideActions = useEventCallback((event: React.SyntheticEvent) => {\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (!isEventFromSubtree) {\n setActionsVisible(false);\n }\n });\n\n // Listens to focusout event on the document to ensure treeitem actions visibility on portal scenarios\n // TODO: find a better way to ensure this behavior\n React.useEffect(() => {\n if (actionsRef.current) {\n const handleFocusOut = (event: FocusEvent) => {\n setActionsVisible(elementContains(actionsRef.current, event.relatedTarget as Node));\n };\n targetDocument?.addEventListener('focusout', handleFocusOut, { passive: true });\n return () => {\n targetDocument?.removeEventListener('focusout', handleFocusOut);\n };\n }\n }, [targetDocument]);\n\n return {\n isLeaf,\n open,\n level,\n buttonSize: 'small',\n isActionsVisible: actions ? isActionsVisible : false,\n components: {\n content: 'div',\n root: 'div',\n expandIcon: 'span',\n actions: 'span',\n subtree: 'span',\n },\n subtree: resolveShorthand(subtree, {\n required: Boolean(subtreeChildren),\n defaultProps: {\n children: subtreeChildren,\n ref: useMergedRefs(subtreeRef, isResolvedShorthand(subtree) ? subtree.ref : undefined),\n },\n }),\n content: resolveShorthand(content, {\n required: true,\n defaultProps: {\n children,\n },\n }),\n root: getNativeElementProps(as, {\n tabIndex: -1,\n ...rest,\n id,\n ref,\n children: null,\n 'aria-level': level,\n 'aria-expanded': isBranch ? open : undefined,\n role: 'treeitem',\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n onMouseOver: actions ? showActions : undefined,\n onFocus: actions ? showActions : undefined,\n onMouseOut: actions ? hideActions : undefined,\n onBlur: actions ? hideActions : undefined,\n }),\n expandIcon: resolveShorthand(expandIcon, {\n required: isBranch,\n defaultProps: {\n children: <ChevronRight12Regular style={expandIconInlineStyles[expandIconRotation]} />,\n 'aria-hidden': true,\n ref: useMergedRefs(isResolvedShorthand(expandIcon) ? expandIcon.ref : undefined, expandIconRef),\n },\n }),\n actions: resolveShorthand(actions, {\n defaultProps: {\n ref: useMergedRefs(isResolvedShorthand(actions) ? actions.ref : undefined, actionsRef),\n },\n }),\n };\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAA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