@fluentui/react-tree 9.0.0-beta.9 → 9.0.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.json +1558 -8
- package/CHANGELOG.md +421 -9
- package/LICENSE +1 -1
- package/dist/index.d.ts +367 -132
- package/lib/FlatTree.js +1 -0
- package/lib/FlatTree.js.map +1 -0
- package/lib/Tree.js +0 -1
- package/lib/Tree.js.map +1 -1
- package/lib/TreeItem.js +0 -1
- package/lib/TreeItem.js.map +1 -1
- package/lib/TreeItemLayout.js +0 -1
- package/lib/TreeItemLayout.js.map +1 -1
- package/lib/TreeItemPersonaLayout.js +0 -1
- package/lib/TreeItemPersonaLayout.js.map +1 -1
- package/lib/components/FlatTree/FlatTree.js +17 -0
- package/lib/components/FlatTree/FlatTree.js.map +1 -0
- package/lib/components/FlatTree/FlatTree.types.js +1 -0
- package/lib/components/FlatTree/FlatTree.types.js.map +1 -0
- package/lib/components/FlatTree/index.js +7 -0
- package/lib/components/FlatTree/index.js.map +1 -0
- package/lib/components/FlatTree/renderFlatTree.js +2 -0
- package/lib/components/FlatTree/renderFlatTree.js.map +1 -0
- package/lib/components/FlatTree/useFlatControllableCheckedItems.js +76 -0
- package/lib/components/FlatTree/useFlatControllableCheckedItems.js.map +1 -0
- package/lib/components/FlatTree/useFlatTree.js +3 -0
- package/lib/components/FlatTree/useFlatTree.js.map +1 -0
- package/lib/components/FlatTree/useFlatTreeContextValues.js +2 -0
- package/lib/components/FlatTree/useFlatTreeContextValues.js.map +1 -0
- package/lib/components/FlatTree/useFlatTreeNavigation.js +74 -0
- package/lib/components/FlatTree/useFlatTreeNavigation.js.map +1 -0
- package/lib/components/FlatTree/useFlatTreeStyles.styles.js +20 -0
- package/lib/components/FlatTree/useFlatTreeStyles.styles.js.map +1 -0
- package/lib/components/FlatTree/useHeadlessFlatTree.js +124 -0
- package/lib/components/FlatTree/useHeadlessFlatTree.js.map +1 -0
- package/lib/components/Tree/Tree.js +9 -15
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/Tree.types.js +1 -2
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/index.js +2 -3
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/Tree/renderTree.js +7 -11
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/components/Tree/useNestedControllableCheckedItems.js +22 -0
- package/lib/components/Tree/useNestedControllableCheckedItems.js.map +1 -0
- package/lib/components/Tree/useTree.js +63 -111
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js +16 -24
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/Tree/useTreeNavigation.js +52 -0
- package/lib/components/Tree/useTreeNavigation.js.map +1 -0
- package/lib/components/Tree/{useTreeStyles.js → useTreeStyles.styles.js} +7 -3
- package/lib/components/Tree/useTreeStyles.styles.js.map +1 -0
- package/lib/components/TreeItem/TreeItem.js +7 -9
- package/lib/components/TreeItem/TreeItem.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js +0 -1
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/index.js +2 -2
- package/lib/components/TreeItem/index.js.map +1 -1
- package/lib/components/TreeItem/renderTreeItem.js +7 -15
- package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +161 -234
- package/lib/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemContextValues.js +20 -16
- package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemStyles.styles.js +100 -0
- package/lib/components/TreeItem/useTreeItemStyles.styles.js.map +1 -0
- package/lib/components/TreeItemChevron.js +24 -0
- package/lib/components/TreeItemChevron.js.map +1 -0
- package/lib/components/TreeItemLayout/TreeItemLayout.js +5 -7
- package/lib/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js +1 -2
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib/components/TreeItemLayout/index.js +1 -2
- package/lib/components/TreeItemLayout/index.js.map +1 -1
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js +8 -13
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +109 -40
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js +237 -0
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js.map +1 -0
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js +6 -8
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js +1 -2
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/index.js +1 -2
- package/lib/components/TreeItemPersonaLayout/index.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +10 -15
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +41 -48
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js +9 -10
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js +210 -0
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -0
- package/lib/contexts/index.js +0 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/treeContext.js +13 -14
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/contexts/treeItemContext.js +16 -8
- package/lib/contexts/treeItemContext.js.map +1 -1
- package/lib/hooks/useControllableOpenItems.js +28 -0
- package/lib/hooks/useControllableOpenItems.js.map +1 -0
- package/lib/hooks/useRootTree.js +147 -0
- package/lib/hooks/useRootTree.js.map +1 -0
- package/lib/hooks/useRovingTabIndexes.js +30 -49
- package/lib/hooks/useRovingTabIndexes.js.map +1 -1
- package/lib/hooks/useSubtree.js +41 -0
- package/lib/hooks/useSubtree.js.map +1 -0
- package/lib/index.js +3 -4
- package/lib/index.js.map +1 -1
- package/lib/utils/ImmutableMap.js +41 -0
- package/lib/utils/ImmutableMap.js.map +1 -0
- package/lib/utils/ImmutableSet.js +42 -33
- package/lib/utils/ImmutableSet.js.map +1 -1
- package/lib/utils/assert.js +4 -5
- package/lib/utils/assert.js.map +1 -1
- package/lib/utils/createCheckedItems.js +18 -0
- package/lib/utils/createCheckedItems.js.map +1 -0
- package/lib/utils/createHTMLElementWalker.js +67 -0
- package/lib/utils/createHTMLElementWalker.js.map +1 -0
- package/lib/utils/createHeadlessTree.js +188 -0
- package/lib/utils/createHeadlessTree.js.map +1 -0
- package/lib/utils/createOpenItems.js +10 -0
- package/lib/utils/createOpenItems.js.map +1 -0
- package/lib/utils/flattenTree.js +15 -49
- package/lib/utils/flattenTree.js.map +1 -1
- package/lib/utils/getTreeItemValueFromElement.js +4 -0
- package/lib/utils/getTreeItemValueFromElement.js.map +1 -0
- package/lib/utils/nextTypeAheadElement.js +11 -12
- package/lib/utils/nextTypeAheadElement.js.map +1 -1
- package/lib/utils/normalizeOpenItems.js +6 -5
- package/lib/utils/normalizeOpenItems.js.map +1 -1
- package/lib/utils/tokens.js +14 -14
- package/lib/utils/tokens.js.map +1 -1
- package/lib/utils/treeItemFilter.js +2 -3
- package/lib/utils/treeItemFilter.js.map +1 -1
- package/lib-commonjs/FlatTree.js +6 -0
- package/lib-commonjs/FlatTree.js.map +1 -0
- package/lib-commonjs/Tree.js +0 -3
- package/lib-commonjs/Tree.js.map +1 -1
- package/lib-commonjs/TreeItem.js +0 -3
- package/lib-commonjs/TreeItem.js.map +1 -1
- package/lib-commonjs/TreeItemLayout.js +0 -3
- package/lib-commonjs/TreeItemLayout.js.map +1 -1
- package/lib-commonjs/TreeItemPersonaLayout.js +0 -3
- package/lib-commonjs/TreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/FlatTree/FlatTree.js +21 -0
- package/lib-commonjs/components/FlatTree/FlatTree.js.map +1 -0
- package/lib-commonjs/components/FlatTree/FlatTree.types.js +4 -0
- package/lib-commonjs/components/FlatTree/FlatTree.types.js.map +1 -0
- package/lib-commonjs/components/FlatTree/index.js +12 -0
- package/lib-commonjs/components/FlatTree/index.js.map +1 -0
- package/lib-commonjs/components/FlatTree/renderFlatTree.js +10 -0
- package/lib-commonjs/components/FlatTree/renderFlatTree.js.map +1 -0
- package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.js +91 -0
- package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.js.map +1 -0
- package/lib-commonjs/components/FlatTree/useFlatTree.js +12 -0
- package/lib-commonjs/components/FlatTree/useFlatTree.js.map +1 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeContextValues.js +10 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeContextValues.js.map +1 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeNavigation.js +82 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeNavigation.js.map +1 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.js +36 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.js.map +1 -0
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js +121 -0
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js.map +1 -0
- package/lib-commonjs/components/Tree/Tree.js +4 -6
- package/lib-commonjs/components/Tree/Tree.js.map +1 -1
- package/lib-commonjs/components/Tree/Tree.types.js +0 -5
- package/lib-commonjs/components/Tree/Tree.types.js.map +1 -1
- package/lib-commonjs/components/Tree/index.js +2 -5
- package/lib-commonjs/components/Tree/index.js.map +1 -1
- package/lib-commonjs/components/Tree/renderTree.js +6 -9
- package/lib-commonjs/components/Tree/renderTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useNestedControllableCheckedItems.js +37 -0
- package/lib-commonjs/components/Tree/useNestedControllableCheckedItems.js.map +1 -0
- package/lib-commonjs/components/Tree/useTree.js +53 -85
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.js +9 -10
- package/lib-commonjs/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeNavigation.js +60 -0
- package/lib-commonjs/components/Tree/useTreeNavigation.js.map +1 -0
- package/lib-commonjs/components/Tree/{useTreeStyles.js → useTreeStyles.styles.js} +10 -7
- package/lib-commonjs/components/Tree/useTreeStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TreeItem/TreeItem.js +3 -5
- package/lib-commonjs/components/TreeItem/TreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/TreeItem.types.js +0 -3
- package/lib-commonjs/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib-commonjs/components/TreeItem/index.js +2 -4
- package/lib-commonjs/components/TreeItem/index.js.map +1 -1
- package/lib-commonjs/components/TreeItem/renderTreeItem.js +6 -12
- package/lib-commonjs/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js +111 -170
- package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js +19 -18
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.js +202 -0
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TreeItemChevron.js +33 -0
- package/lib-commonjs/components/TreeItemChevron.js.map +1 -0
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.js +3 -5
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.js +0 -3
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/index.js +1 -4
- package/lib-commonjs/components/TreeItemLayout/index.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js +8 -9
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +92 -18
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js +392 -0
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js +3 -5
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js +0 -3
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/index.js +1 -4
- package/lib-commonjs/components/TreeItemPersonaLayout/index.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +9 -10
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +29 -26
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js +1 -3
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js +379 -0
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -0
- package/lib-commonjs/contexts/index.js +0 -3
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/treeContext.js +7 -7
- package/lib-commonjs/contexts/treeContext.js.map +1 -1
- package/lib-commonjs/contexts/treeItemContext.js +15 -6
- package/lib-commonjs/contexts/treeItemContext.js.map +1 -1
- package/lib-commonjs/hooks/useControllableOpenItems.js +39 -0
- package/lib-commonjs/hooks/useControllableOpenItems.js.map +1 -0
- package/lib-commonjs/hooks/useRootTree.js +151 -0
- package/lib-commonjs/hooks/useRootTree.js.map +1 -0
- package/lib-commonjs/hooks/useRovingTabIndexes.js +9 -31
- package/lib-commonjs/hooks/useRovingTabIndexes.js.map +1 -1
- package/lib-commonjs/hooks/useSubtree.js +45 -0
- package/lib-commonjs/hooks/useSubtree.js.map +1 -0
- package/lib-commonjs/index.js +11 -7
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/ImmutableMap.js +49 -0
- package/lib-commonjs/utils/ImmutableMap.js.map +1 -0
- package/lib-commonjs/utils/ImmutableSet.js +28 -20
- package/lib-commonjs/utils/ImmutableSet.js.map +1 -1
- package/lib-commonjs/utils/assert.js +1 -3
- package/lib-commonjs/utils/assert.js.map +1 -1
- package/lib-commonjs/utils/createCheckedItems.js +26 -0
- package/lib-commonjs/utils/createCheckedItems.js.map +1 -0
- package/lib-commonjs/{hooks/useHTMLElementWalker.js → utils/createHTMLElementWalker.js} +3 -27
- package/lib-commonjs/utils/createHTMLElementWalker.js.map +1 -0
- package/lib-commonjs/utils/createHeadlessTree.js +202 -0
- package/lib-commonjs/utils/createHeadlessTree.js.map +1 -0
- package/lib-commonjs/utils/createOpenItems.js +18 -0
- package/lib-commonjs/utils/createOpenItems.js.map +1 -0
- package/lib-commonjs/utils/flattenTree.js +4 -40
- package/lib-commonjs/utils/flattenTree.js.map +1 -1
- package/lib-commonjs/utils/getTreeItemValueFromElement.js +18 -0
- package/lib-commonjs/utils/getTreeItemValueFromElement.js.map +1 -0
- package/lib-commonjs/utils/nextTypeAheadElement.js +1 -3
- package/lib-commonjs/utils/nextTypeAheadElement.js.map +1 -1
- package/lib-commonjs/utils/normalizeOpenItems.js +1 -3
- package/lib-commonjs/utils/normalizeOpenItems.js.map +1 -1
- package/lib-commonjs/utils/tokens.js +12 -13
- package/lib-commonjs/utils/tokens.js.map +1 -1
- package/lib-commonjs/utils/treeItemFilter.js +1 -3
- package/lib-commonjs/utils/treeItemFilter.js.map +1 -1
- package/package.json +31 -31
- package/.swcrc +0 -30
- package/lib/components/Tree/useTreeStyles.js.map +0 -1
- package/lib/components/TreeItem/useTreeItemStyles.js +0 -203
- package/lib/components/TreeItem/useTreeItemStyles.js.map +0 -1
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.js +0 -98
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.js.map +0 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js +0 -115
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js.map +0 -1
- package/lib/hooks/index.js +0 -4
- package/lib/hooks/index.js.map +0 -1
- package/lib/hooks/useFlatTree.js +0 -77
- package/lib/hooks/useFlatTree.js.map +0 -1
- package/lib/hooks/useFlatTreeNavigation.js +0 -74
- package/lib/hooks/useFlatTreeNavigation.js.map +0 -1
- package/lib/hooks/useHTMLElementWalker.js +0 -80
- package/lib/hooks/useHTMLElementWalker.js.map +0 -1
- package/lib/hooks/useNestedTreeNavigation.js +0 -59
- package/lib/hooks/useNestedTreeNavigation.js.map +0 -1
- package/lib/hooks/useOpenItemsState.js +0 -22
- package/lib/hooks/useOpenItemsState.js.map +0 -1
- package/lib/utils/createFlatTreeItems.js +0 -109
- package/lib/utils/createFlatTreeItems.js.map +0 -1
- package/lib-commonjs/components/Tree/useTreeStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.js +0 -375
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.js +0 -143
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js +0 -186
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js.map +0 -1
- package/lib-commonjs/hooks/index.js +0 -11
- package/lib-commonjs/hooks/index.js.map +0 -1
- package/lib-commonjs/hooks/useFlatTree.js +0 -86
- package/lib-commonjs/hooks/useFlatTree.js.map +0 -1
- package/lib-commonjs/hooks/useFlatTreeNavigation.js +0 -82
- package/lib-commonjs/hooks/useFlatTreeNavigation.js.map +0 -1
- package/lib-commonjs/hooks/useHTMLElementWalker.js.map +0 -1
- package/lib-commonjs/hooks/useNestedTreeNavigation.js +0 -69
- package/lib-commonjs/hooks/useNestedTreeNavigation.js.map +0 -1
- package/lib-commonjs/hooks/useOpenItemsState.js +0 -39
- package/lib-commonjs/hooks/useOpenItemsState.js.map +0 -1
- package/lib-commonjs/utils/createFlatTreeItems.js +0 -126
- package/lib-commonjs/utils/createFlatTreeItems.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,56 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
|
|
3
|
-
import { ArrowDown } from '@fluentui/keyboard-keys';
|
|
4
|
-
import { ArrowLeft } from '@fluentui/keyboard-keys';
|
|
5
|
-
import { ArrowRight } from '@fluentui/keyboard-keys';
|
|
6
|
-
import { ArrowUp } from '@fluentui/keyboard-keys';
|
|
3
|
+
import type { ArrowDown } from '@fluentui/keyboard-keys';
|
|
4
|
+
import type { ArrowLeft } from '@fluentui/keyboard-keys';
|
|
5
|
+
import type { ArrowRight } from '@fluentui/keyboard-keys';
|
|
6
|
+
import type { ArrowUp } from '@fluentui/keyboard-keys';
|
|
7
7
|
import type { AvatarContextValue } from '@fluentui/react-avatar';
|
|
8
8
|
import type { AvatarSize } from '@fluentui/react-avatar';
|
|
9
|
-
import
|
|
9
|
+
import { ButtonContextValue } from '@fluentui/react-button';
|
|
10
|
+
import { Checkbox } from '@fluentui/react-checkbox';
|
|
11
|
+
import { CheckboxProps } from '@fluentui/react-checkbox';
|
|
10
12
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
11
13
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
12
14
|
import { ContextSelector } from '@fluentui/react-context-selector';
|
|
13
|
-
import { End } from '@fluentui/keyboard-keys';
|
|
14
|
-
import { Enter } from '@fluentui/keyboard-keys';
|
|
15
|
+
import type { End } from '@fluentui/keyboard-keys';
|
|
16
|
+
import type { Enter } from '@fluentui/keyboard-keys';
|
|
15
17
|
import type { ExtractSlotProps } from '@fluentui/react-utilities';
|
|
16
18
|
import { FC } from 'react';
|
|
17
19
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
18
|
-
import { Home } from '@fluentui/keyboard-keys';
|
|
20
|
+
import type { Home } from '@fluentui/keyboard-keys';
|
|
19
21
|
import { Provider } from 'react';
|
|
20
22
|
import { ProviderProps } from 'react';
|
|
23
|
+
import { Radio } from '@fluentui/react-radio';
|
|
24
|
+
import { RadioProps } from '@fluentui/react-radio';
|
|
21
25
|
import * as React_2 from 'react';
|
|
26
|
+
import { SelectionMode as SelectionMode_2 } from '@fluentui/react-utilities';
|
|
22
27
|
import type { Slot } from '@fluentui/react-utilities';
|
|
23
28
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
24
29
|
|
|
30
|
+
/**
|
|
31
|
+
* properly creates an ImmutableMap instance from an iterable
|
|
32
|
+
*/
|
|
33
|
+
declare function createImmutableMap<Key, Value>(iterable?: Iterable<[Key, Value]>): ImmutableMap<Key, Value>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* properly creates an ImmutableSet instance from an iterable
|
|
37
|
+
*/
|
|
38
|
+
declare function createImmutableSet<Value>(iterable?: Iterable<Value>): ImmutableSet<Value>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Avoid using *dangerouslyCreateImmutableMap*, since this method will expose internally used set, use createImmutableMap instead,
|
|
42
|
+
* @param internalMap - a set that is used internally to store values.
|
|
43
|
+
*/
|
|
44
|
+
declare function dangerouslyCreateImmutableMap<Key, Value>(internalMap: Map<Key, Value>): ImmutableMap<Key, Value>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Avoid using *dangerouslyCreateImmutableSet*, since this method will expose internally used set, use createImmutableSet instead,
|
|
48
|
+
* @param internalSet - a set that is used internally to store values.
|
|
49
|
+
*/
|
|
50
|
+
declare function dangerouslyCreateImmutableSet<Value>(internalSet: Set<Value>): ImmutableSet<Value>;
|
|
51
|
+
|
|
52
|
+
declare type FlattenedTreeItem<Props extends TreeItemProps> = HeadlessFlatTreeItemProps & Props;
|
|
53
|
+
|
|
25
54
|
/**
|
|
26
55
|
* Converts a nested structure to a flat one which can be consumed by `useFlatTreeItems`
|
|
27
56
|
* @example
|
|
@@ -62,7 +91,87 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
|
62
91
|
* ]);
|
|
63
92
|
* ```
|
|
64
93
|
*/
|
|
65
|
-
export declare const flattenTree_unstable: (items:
|
|
94
|
+
export declare const flattenTree_unstable: <Props extends TreeItemProps>(items: FlattenTreeItem<Props>[]) => FlattenedTreeItem<Props>[];
|
|
95
|
+
|
|
96
|
+
export declare type FlattenTreeItem<Props extends TreeItemProps> = Omit<Props, 'subtree' | 'itemType'> & {
|
|
97
|
+
value: TreeItemValue;
|
|
98
|
+
subtree?: FlattenTreeItem<Props>[];
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The `FlatTree` component is a variation of the `Tree` component that deals with a flattened data structure.
|
|
103
|
+
*
|
|
104
|
+
* It should be used on cases where more complex interactions with a Tree is required.
|
|
105
|
+
* On simple scenarios it is advised to simply use a nested structure instead.
|
|
106
|
+
*/
|
|
107
|
+
export declare const FlatTree: ForwardRefComponent<FlatTreeProps>;
|
|
108
|
+
|
|
109
|
+
export declare const flatTreeClassNames: SlotClassNames<TreeSlots>;
|
|
110
|
+
|
|
111
|
+
export declare type FlatTreeProps = ComponentProps<TreeSlots> & {
|
|
112
|
+
/**
|
|
113
|
+
* A tree item can have various appearances:
|
|
114
|
+
* - 'subtle' (default): The default tree item styles.
|
|
115
|
+
* - 'subtle-alpha': Minimizes emphasis on hovered or focused states.
|
|
116
|
+
* - 'transparent': Removes background color.
|
|
117
|
+
* @default 'subtle'
|
|
118
|
+
*/
|
|
119
|
+
appearance?: 'subtle' | 'subtle-alpha' | 'transparent';
|
|
120
|
+
/**
|
|
121
|
+
* Size of the tree item.
|
|
122
|
+
* @default 'medium'
|
|
123
|
+
*/
|
|
124
|
+
size?: 'small' | 'medium';
|
|
125
|
+
/**
|
|
126
|
+
* This refers to a list of ids of opened tree items.
|
|
127
|
+
* Controls the state of the open tree items.
|
|
128
|
+
* These property is ignored for subtrees.
|
|
129
|
+
*/
|
|
130
|
+
openItems?: Iterable<TreeItemValue>;
|
|
131
|
+
/**
|
|
132
|
+
* Callback fired when the component changes value from open state.
|
|
133
|
+
* These property is ignored for subtrees.
|
|
134
|
+
*
|
|
135
|
+
* @param event - a React's Synthetic event
|
|
136
|
+
* @param data - A data object with relevant information,
|
|
137
|
+
* such as open value and type of interaction that created the event.
|
|
138
|
+
*/
|
|
139
|
+
onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData): void;
|
|
140
|
+
/**
|
|
141
|
+
* Callback fired when navigation happens inside the component.
|
|
142
|
+
* These property is ignored for subtrees.
|
|
143
|
+
*
|
|
144
|
+
* FIXME: This method is not ideal, as navigation should be handled internally by tabster.
|
|
145
|
+
*
|
|
146
|
+
* @param event - a React's Synthetic event
|
|
147
|
+
* @param data - A data object with relevant information,
|
|
148
|
+
*/
|
|
149
|
+
onNavigation?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;
|
|
150
|
+
/**
|
|
151
|
+
* This refers to the selection mode of the tree.
|
|
152
|
+
* - undefined: No selection can be done.
|
|
153
|
+
* - 'single': Only one tree item can be selected, radio buttons are rendered.
|
|
154
|
+
* - 'multiselect': Multiple tree items can be selected, checkboxes are rendered.
|
|
155
|
+
*
|
|
156
|
+
* @default undefined
|
|
157
|
+
*/
|
|
158
|
+
selectionMode?: SelectionMode_2;
|
|
159
|
+
/**
|
|
160
|
+
* This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.
|
|
161
|
+
* Controls the state of the checked tree items.
|
|
162
|
+
* These property is ignored for subtrees.
|
|
163
|
+
*/
|
|
164
|
+
checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;
|
|
165
|
+
/**
|
|
166
|
+
* Callback fired when the component changes value from checked state.
|
|
167
|
+
* These property is ignored for subtrees.
|
|
168
|
+
*
|
|
169
|
+
* @param event - a React's Synthetic event
|
|
170
|
+
* @param data - A data object with relevant information,
|
|
171
|
+
* such as checked value and type of interaction that created the event.
|
|
172
|
+
*/
|
|
173
|
+
onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;
|
|
174
|
+
};
|
|
66
175
|
|
|
67
176
|
/**
|
|
68
177
|
* FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -74,13 +183,16 @@ export declare const flattenTree_unstable: (items: NestedTreeItem[]) => FlatTree
|
|
|
74
183
|
*
|
|
75
184
|
* On simple scenarios it is advised to simply use a nested structure instead.
|
|
76
185
|
*/
|
|
77
|
-
export declare type
|
|
186
|
+
export declare type HeadlessFlatTree<Props extends HeadlessFlatTreeItemProps> = {
|
|
78
187
|
/**
|
|
79
188
|
* returns the properties required for the Tree component to work properly.
|
|
80
189
|
* That includes:
|
|
81
190
|
* `openItems`, `onOpenChange`, `onNavigation_unstable` and `ref`
|
|
82
191
|
*/
|
|
83
|
-
getTreeProps(): FlatTreeProps
|
|
192
|
+
getTreeProps(): Required<Pick<FlatTreeProps, 'openItems' | 'onOpenChange' | 'onNavigation' | 'checkedItems' | 'onCheckedChange'>> & {
|
|
193
|
+
ref: React_2.Ref<HTMLDivElement>;
|
|
194
|
+
openItems: ImmutableSet<TreeItemValue>;
|
|
195
|
+
};
|
|
84
196
|
/**
|
|
85
197
|
* internal method used to react to an `onNavigation` event.
|
|
86
198
|
* This method ensures proper navigation on keyboard and mouse interaction.
|
|
@@ -94,7 +206,7 @@ export declare type FlatTree = {
|
|
|
94
206
|
* event.preventDefault();
|
|
95
207
|
* const nextItem = tree.getNextNavigableItem(data);
|
|
96
208
|
* // scroll to item using virtualization scroll mechanism
|
|
97
|
-
* if (nextItem &&
|
|
209
|
+
* if (nextItem && tree.getElementFromItem(nextItem)) {
|
|
98
210
|
* listRef.current.scrollToItem(nextItem.index);
|
|
99
211
|
* }
|
|
100
212
|
* // wait for scrolling to happen and then invoke navigate method
|
|
@@ -112,23 +224,82 @@ export declare type FlatTree = {
|
|
|
112
224
|
*
|
|
113
225
|
* On the case of TypeAhead navigation this method returns the current item.
|
|
114
226
|
*/
|
|
115
|
-
getNextNavigableItem(visibleItems:
|
|
227
|
+
getNextNavigableItem(visibleItems: HeadlessTreeItem<Props>[], data: TreeNavigationData_unstable): HeadlessTreeItem<Props> | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* similar to getElementById but for FlatTreeItems
|
|
230
|
+
*/
|
|
231
|
+
getElementFromItem(item: HeadlessTreeItem<Props>): HTMLElement | null;
|
|
116
232
|
/**
|
|
117
233
|
* an iterable containing all visually available flat tree items
|
|
118
234
|
*/
|
|
119
|
-
items(): IterableIterator<
|
|
235
|
+
items(): IterableIterator<HeadlessTreeItem<Props>>;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export declare type HeadlessFlatTreeItem<Props extends HeadlessFlatTreeItemProps> = HeadlessTreeItem<Props>;
|
|
239
|
+
|
|
240
|
+
export declare type HeadlessFlatTreeItemProps = HeadlessTreeItemProps;
|
|
241
|
+
|
|
242
|
+
export declare type HeadlessFlatTreeOptions = Pick<FlatTreeProps, 'onOpenChange' | 'onNavigation' | 'selectionMode' | 'onCheckedChange'> & Pick<TreeProps, 'defaultOpenItems' | 'openItems' | 'checkedItems'> & {
|
|
243
|
+
defaultCheckedItems?: TreeProps['checkedItems'];
|
|
120
244
|
};
|
|
121
245
|
|
|
122
|
-
|
|
246
|
+
/**
|
|
247
|
+
* The item that is returned by `createHeadlessTree`, it represents a wrapper around the properties provided to
|
|
248
|
+
* `createHeadlessTree` but with extra information that might be useful on virtual tree scenarios
|
|
249
|
+
*/
|
|
250
|
+
declare type HeadlessTreeItem<Props extends HeadlessTreeItemProps> = {
|
|
251
|
+
level: number;
|
|
252
|
+
index: number;
|
|
253
|
+
position: number;
|
|
254
|
+
childrenValues: TreeItemValue[];
|
|
255
|
+
value: TreeItemValue;
|
|
256
|
+
parentValue: TreeItemValue | undefined;
|
|
257
|
+
itemType: TreeItemType;
|
|
258
|
+
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Omit<Props, 'parentValue'>;
|
|
259
|
+
};
|
|
123
260
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
261
|
+
declare type HeadlessTreeItemProps = Omit<TreeItemProps, 'itemType' | 'value'> & {
|
|
262
|
+
value: TreeItemValue;
|
|
263
|
+
itemType?: TreeItemType;
|
|
264
|
+
parentValue?: TreeItemValue;
|
|
127
265
|
};
|
|
128
266
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
267
|
+
declare interface ImmutableMap<Key, Value> {
|
|
268
|
+
clear(): ImmutableMap<Key, Value>;
|
|
269
|
+
delete(key: Key): ImmutableMap<Key, Value>;
|
|
270
|
+
/**
|
|
271
|
+
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
|
|
272
|
+
* @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
|
|
273
|
+
*/
|
|
274
|
+
get(key: Key): Value | undefined;
|
|
275
|
+
/**
|
|
276
|
+
* @returns boolean indicating whether an element with the specified key exists or not.
|
|
277
|
+
*/
|
|
278
|
+
has(key: Key): boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
|
|
281
|
+
*/
|
|
282
|
+
set(key: Key, value: Value): ImmutableMap<Key, Value>;
|
|
283
|
+
/**
|
|
284
|
+
* @returns the number of elements in the Map.
|
|
285
|
+
*/
|
|
286
|
+
readonly size: number;
|
|
287
|
+
/** Iterates over entries in the Map. */
|
|
288
|
+
[Symbol.iterator](): IterableIterator<[Key, Value]>;
|
|
289
|
+
/**
|
|
290
|
+
* @internal
|
|
291
|
+
* Exposes the internal map used to store values.
|
|
292
|
+
* This is an internal API and should not be used directly.
|
|
293
|
+
*/
|
|
294
|
+
dangerouslyGetInternalMap_unstable(): Map<Key, Value>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
declare const ImmutableMap: {
|
|
298
|
+
empty: ImmutableMap<never, never>;
|
|
299
|
+
create: typeof createImmutableMap;
|
|
300
|
+
isImmutableMap: typeof isImmutableMap;
|
|
301
|
+
dangerouslyCreate_unstable: typeof dangerouslyCreateImmutableMap;
|
|
302
|
+
};
|
|
132
303
|
|
|
133
304
|
declare interface ImmutableSet<Value> {
|
|
134
305
|
/**
|
|
@@ -154,25 +325,30 @@ declare interface ImmutableSet<Value> {
|
|
|
154
325
|
has(value: Value): boolean;
|
|
155
326
|
/** Iterates over values in the ImmutableSet. */
|
|
156
327
|
[Symbol.iterator](): IterableIterator<Value>;
|
|
328
|
+
/**
|
|
329
|
+
* @internal
|
|
330
|
+
* Exposes the internal set used to store values.
|
|
331
|
+
* This is an internal API and should not be used directly.
|
|
332
|
+
*/
|
|
333
|
+
dangerouslyGetInternalSet_unstable(): Set<Value>;
|
|
157
334
|
}
|
|
158
335
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
declare type MutableFlatTreeItem = {
|
|
165
|
-
parentId?: string;
|
|
166
|
-
childrenSize: number;
|
|
167
|
-
index: number;
|
|
168
|
-
id: string;
|
|
169
|
-
level: number;
|
|
170
|
-
getTreeItemProps(): Required<Pick<TreeItemProps, 'id' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'leaf'>> & TreeItemProps;
|
|
336
|
+
declare const ImmutableSet: {
|
|
337
|
+
empty: ImmutableSet<never>;
|
|
338
|
+
create: typeof createImmutableSet;
|
|
339
|
+
isImmutableSet: typeof isImmutableSet;
|
|
340
|
+
dangerouslyCreate_unstable: typeof dangerouslyCreateImmutableSet;
|
|
171
341
|
};
|
|
172
342
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
343
|
+
declare function isImmutableMap<Key, Value>(value: unknown): value is ImmutableMap<Key, Value>;
|
|
344
|
+
|
|
345
|
+
declare function isImmutableSet<Value>(value: unknown): value is ImmutableSet<Value>;
|
|
346
|
+
|
|
347
|
+
declare type MultiSelectValue = NonNullable<CheckboxProps['checked']>;
|
|
348
|
+
|
|
349
|
+
declare type OmitWithoutExpanding<P, K extends string | number | symbol> = P extends unknown ? Omit<P, K> : P;
|
|
350
|
+
|
|
351
|
+
export declare const renderFlatTree_unstable: (state: TreeState, contextValues: TreeContextValues) => JSX.Element;
|
|
176
352
|
|
|
177
353
|
export declare const renderTree_unstable: (state: TreeState, contextValues: TreeContextValues) => JSX.Element;
|
|
178
354
|
|
|
@@ -191,31 +367,46 @@ export declare const renderTreeItemLayout_unstable: (state: TreeItemLayoutState)
|
|
|
191
367
|
*/
|
|
192
368
|
export declare const renderTreeItemPersonaLayout_unstable: (state: TreeItemPersonaLayoutState, contextValues: TreeItemPersonaLayoutContextValues) => JSX.Element;
|
|
193
369
|
|
|
370
|
+
declare type SingleSelectValue = NonNullable<RadioProps['checked']>;
|
|
371
|
+
|
|
194
372
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* and items that have children may be expanded or collapsed to show or hide the children.
|
|
198
|
-
* For example, in a file system navigator that uses a tree view to display folders and files,
|
|
199
|
-
* an item representing a folder can be expanded to reveal the contents of the folder,
|
|
200
|
-
* which may be files, folders, or both.
|
|
373
|
+
* The `Tree` component renders nested items in a hierarchical structure.
|
|
374
|
+
* Use it with `TreeItem` component and layouts components `TreeItemLayout` or `TreeItemPersonaLayout`.
|
|
201
375
|
*/
|
|
202
376
|
export declare const Tree: ForwardRefComponent<TreeProps>;
|
|
203
377
|
|
|
378
|
+
export declare type TreeCheckedChangeData = {
|
|
379
|
+
value: TreeItemValue;
|
|
380
|
+
checkedItems: Map<TreeItemValue, TreeSelectionValue>;
|
|
381
|
+
target: HTMLElement;
|
|
382
|
+
event: React_2.ChangeEvent<HTMLElement>;
|
|
383
|
+
type: 'Change';
|
|
384
|
+
} & ({
|
|
385
|
+
selectionMode: 'multiselect';
|
|
386
|
+
checked: MultiSelectValue;
|
|
387
|
+
} | {
|
|
388
|
+
selectionMode: 'single';
|
|
389
|
+
checked: SingleSelectValue;
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
export declare type TreeCheckedChangeEvent = TreeCheckedChangeData['event'];
|
|
393
|
+
|
|
204
394
|
export declare const treeClassNames: SlotClassNames<TreeSlots>;
|
|
205
395
|
|
|
206
396
|
export declare type TreeContextValue = {
|
|
207
397
|
level: number;
|
|
398
|
+
selectionMode: 'none' | SelectionMode_2;
|
|
208
399
|
appearance: 'subtle' | 'subtle-alpha' | 'transparent';
|
|
209
400
|
size: 'small' | 'medium';
|
|
210
|
-
openItems: ImmutableSet<
|
|
401
|
+
openItems: ImmutableSet<TreeItemValue>;
|
|
402
|
+
checkedItems: ImmutableMap<TreeItemValue, 'mixed' | boolean>;
|
|
211
403
|
/**
|
|
212
|
-
*
|
|
404
|
+
* requests root Tree component to respond to some tree item event,
|
|
213
405
|
*/
|
|
214
|
-
|
|
215
|
-
requestNavigation(data: TreeNavigationData_unstable): void;
|
|
406
|
+
requestTreeResponse(request: TreeItemRequest): void;
|
|
216
407
|
};
|
|
217
408
|
|
|
218
|
-
declare type TreeContextValues = {
|
|
409
|
+
export declare type TreeContextValues = {
|
|
219
410
|
tree: TreeContextValue;
|
|
220
411
|
};
|
|
221
412
|
|
|
@@ -228,28 +419,35 @@ declare type TreeContextValues = {
|
|
|
228
419
|
* The content and layout of a TreeItem can be defined using the TreeItemLayout or TreeItemPersonaLayout component,
|
|
229
420
|
* which should be used as a direct child of TreeItem.
|
|
230
421
|
*
|
|
231
|
-
* When a TreeItem has
|
|
422
|
+
* When a TreeItem has nested child subtree, an expand/collapse control is displayed,
|
|
232
423
|
* allowing the user to show or hide the children.
|
|
233
424
|
*/
|
|
234
425
|
export declare const TreeItem: ForwardRefComponent<TreeItemProps>;
|
|
235
426
|
|
|
236
427
|
export declare const treeItemClassNames: SlotClassNames<TreeItemSlots>;
|
|
237
428
|
|
|
238
|
-
declare type TreeItemContextValue = {
|
|
429
|
+
export declare type TreeItemContextValue = {
|
|
239
430
|
isActionsVisible: boolean;
|
|
431
|
+
isAsideVisible: boolean;
|
|
432
|
+
selectionRef: React_2.Ref<HTMLInputElement>;
|
|
433
|
+
actionsRef: React_2.Ref<HTMLDivElement>;
|
|
434
|
+
expandIconRef: React_2.Ref<HTMLDivElement>;
|
|
435
|
+
layoutRef: React_2.Ref<HTMLDivElement>;
|
|
436
|
+
subtreeRef: React_2.Ref<HTMLDivElement>;
|
|
437
|
+
itemType: TreeItemType;
|
|
438
|
+
value: TreeItemValue;
|
|
439
|
+
open: boolean;
|
|
440
|
+
checked: TreeSelectionValue;
|
|
240
441
|
};
|
|
241
442
|
|
|
242
443
|
declare type TreeItemContextValues = {
|
|
243
444
|
treeItem: TreeItemContextValue;
|
|
244
|
-
button: ButtonContextValue;
|
|
245
445
|
};
|
|
246
446
|
|
|
247
447
|
declare type TreeItemCSSProperties = React_2.CSSProperties & {
|
|
248
448
|
[treeItemLevelToken]?: string | number;
|
|
249
449
|
};
|
|
250
450
|
|
|
251
|
-
export declare type TreeItemId = string;
|
|
252
|
-
|
|
253
451
|
/**
|
|
254
452
|
* The `TreeItemLayout` component is used as a child of `TreeItem` to define the content and layout of a tree item.
|
|
255
453
|
* It provides a consistent visual structure for tree items in a `Tree` component.
|
|
@@ -266,21 +464,53 @@ export declare type TreeItemLayoutProps = ComponentProps<Partial<TreeItemLayoutS
|
|
|
266
464
|
|
|
267
465
|
export declare type TreeItemLayoutSlots = {
|
|
268
466
|
root: Slot<'div'>;
|
|
467
|
+
/**
|
|
468
|
+
* Content. Children of the root slot are automatically rendered here
|
|
469
|
+
*/
|
|
470
|
+
main: NonNullable<Slot<'div'>>;
|
|
269
471
|
/**
|
|
270
472
|
* Icon slot that renders right before main content
|
|
271
473
|
*/
|
|
272
|
-
iconBefore?: Slot<'
|
|
474
|
+
iconBefore?: Slot<'div'>;
|
|
273
475
|
/**
|
|
274
476
|
* Icon slot that renders right after main content
|
|
275
477
|
*/
|
|
276
|
-
iconAfter?: Slot<'
|
|
277
|
-
|
|
478
|
+
iconAfter?: Slot<'div'>;
|
|
479
|
+
/**
|
|
480
|
+
* Expand icon slot,
|
|
481
|
+
* by default renders a chevron icon to indicate opening and closing
|
|
482
|
+
*/
|
|
483
|
+
expandIcon?: Slot<'div'>;
|
|
484
|
+
/**
|
|
485
|
+
* Aside content is normally used to render a badge or other non-actionable content
|
|
486
|
+
* It is aria-hidden by default and is only meant to be used as visual aid.
|
|
487
|
+
*/
|
|
488
|
+
aside?: Slot<'div'>;
|
|
489
|
+
/**
|
|
490
|
+
* Actionable elements are normally buttons, menus, or other focusable elements.
|
|
491
|
+
* Those elements are only visibly available if the given tree item is currently active.
|
|
492
|
+
*
|
|
493
|
+
* `actions` and `aside` slots are positioned on the exact same spot,
|
|
494
|
+
* so they won't be visible at the same time.
|
|
495
|
+
* `aside` slot is visible by default meanwhile `actions` slot are only visible when the tree item is active.
|
|
496
|
+
*
|
|
497
|
+
* `actions` slot supports a `visible` prop to force visibility of the actions.
|
|
498
|
+
*/
|
|
499
|
+
actions?: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
500
|
+
/**
|
|
501
|
+
* Forces visibility of the aside/action content
|
|
502
|
+
*/
|
|
503
|
+
visible?: boolean;
|
|
504
|
+
}>>;
|
|
505
|
+
selector?: Slot<typeof Checkbox> | Slot<typeof Radio>;
|
|
278
506
|
};
|
|
279
507
|
|
|
280
508
|
/**
|
|
281
509
|
* State used in rendering TreeItemLayout
|
|
282
510
|
*/
|
|
283
|
-
export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots> &
|
|
511
|
+
export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots> & {
|
|
512
|
+
buttonContextValue: ButtonContextValue;
|
|
513
|
+
};
|
|
284
514
|
|
|
285
515
|
export declare const treeItemLevelToken: "--fluent-TreeItem--level";
|
|
286
516
|
|
|
@@ -302,35 +532,28 @@ declare type TreeItemPersonaLayoutContextValues = {
|
|
|
302
532
|
*/
|
|
303
533
|
export declare type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;
|
|
304
534
|
|
|
305
|
-
export declare type TreeItemPersonaLayoutSlots = {
|
|
306
|
-
root: Slot<'
|
|
535
|
+
export declare type TreeItemPersonaLayoutSlots = Pick<TreeItemLayoutSlots, 'actions' | 'aside' | 'expandIcon' | 'selector'> & {
|
|
536
|
+
root: NonNullable<Slot<'div'>>;
|
|
307
537
|
/**
|
|
308
538
|
* Avatar to display.
|
|
309
539
|
*/
|
|
310
|
-
media: NonNullable<Slot<'
|
|
311
|
-
/**
|
|
312
|
-
* Main text. Children of the root slot are automatically rendered here
|
|
313
|
-
*/
|
|
314
|
-
main: Slot<'span'>;
|
|
315
|
-
/**
|
|
316
|
-
* Secondary text that describes or complements the main text
|
|
317
|
-
*/
|
|
318
|
-
description?: Slot<'span'>;
|
|
540
|
+
media: NonNullable<Slot<'div'>>;
|
|
319
541
|
/**
|
|
320
|
-
*
|
|
542
|
+
* Content. Children of the root slot are automatically rendered here
|
|
321
543
|
*/
|
|
322
|
-
|
|
544
|
+
main: NonNullable<Slot<'div'>>;
|
|
323
545
|
/**
|
|
324
|
-
*
|
|
546
|
+
* Secondary text that describes or complements the content
|
|
325
547
|
*/
|
|
326
|
-
|
|
548
|
+
description?: Slot<'div'>;
|
|
327
549
|
};
|
|
328
550
|
|
|
329
551
|
/**
|
|
330
552
|
* State used in rendering TreeItemPersonaLayout
|
|
331
553
|
*/
|
|
332
|
-
export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> &
|
|
554
|
+
export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> & {
|
|
333
555
|
avatarSize: AvatarSize;
|
|
556
|
+
buttonContextValue: ButtonContextValue;
|
|
334
557
|
};
|
|
335
558
|
|
|
336
559
|
/**
|
|
@@ -338,104 +561,86 @@ export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaL
|
|
|
338
561
|
*/
|
|
339
562
|
export declare type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {
|
|
340
563
|
/**
|
|
341
|
-
*
|
|
342
|
-
* This attribute is used to force the decision if a TreeItem is a leaf or not. By not providing this property
|
|
343
|
-
* this will be inferred by the presence of a subtree as part of the TreeItem children.
|
|
564
|
+
* A tree item can be a leaf or a branch
|
|
344
565
|
*/
|
|
345
|
-
|
|
566
|
+
itemType: TreeItemType;
|
|
567
|
+
value?: TreeItemValue;
|
|
346
568
|
};
|
|
347
569
|
|
|
348
|
-
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined
|
|
570
|
+
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined> & React_2.FC<React_2.ProviderProps<TreeItemContextValue | undefined>>;
|
|
571
|
+
|
|
572
|
+
declare type TreeItemRequest = {
|
|
573
|
+
itemType: TreeItemType;
|
|
574
|
+
} & (OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'> | TreeNavigationData_unstable | OmitWithoutExpanding<TreeCheckedChangeData, 'selectionMode' | 'checkedItems'>);
|
|
349
575
|
|
|
350
576
|
export declare type TreeItemSlots = {
|
|
351
577
|
root: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
352
578
|
style?: TreeItemCSSProperties;
|
|
353
579
|
}>>;
|
|
354
|
-
content: NonNullable<Slot<'div'>>;
|
|
355
|
-
subtree?: Slot<'span'>;
|
|
356
|
-
/**
|
|
357
|
-
* Expand icon slot,
|
|
358
|
-
* by default renders a chevron icon to indicate opening and closing
|
|
359
|
-
*/
|
|
360
|
-
expandIcon?: Slot<'span'>;
|
|
361
|
-
/**
|
|
362
|
-
* Actions slot that renders on the end of tree item
|
|
363
|
-
* when the item is hovered/focused
|
|
364
|
-
*/
|
|
365
|
-
actions?: Slot<'span'>;
|
|
366
580
|
};
|
|
367
581
|
|
|
368
582
|
/**
|
|
369
583
|
* State used in rendering TreeItem
|
|
370
584
|
*/
|
|
371
|
-
export declare type TreeItemState = ComponentState<TreeItemSlots> & {
|
|
372
|
-
open: boolean;
|
|
373
|
-
isLeaf: boolean;
|
|
585
|
+
export declare type TreeItemState = ComponentState<TreeItemSlots> & TreeItemContextValue & {
|
|
374
586
|
level: number;
|
|
375
|
-
|
|
376
|
-
* By design, a button included on the actions slot should be small
|
|
377
|
-
*/
|
|
378
|
-
buttonSize: 'small';
|
|
379
|
-
isActionsVisible: boolean;
|
|
587
|
+
itemType: TreeItemType;
|
|
380
588
|
};
|
|
381
589
|
|
|
590
|
+
declare type TreeItemType = 'leaf' | 'branch';
|
|
591
|
+
|
|
592
|
+
export declare type TreeItemValue = string | number;
|
|
593
|
+
|
|
382
594
|
export declare type TreeNavigationData_unstable = {
|
|
383
|
-
event: React_2.MouseEvent<HTMLElement>;
|
|
384
595
|
target: HTMLElement;
|
|
596
|
+
value: TreeItemValue;
|
|
597
|
+
} & ({
|
|
598
|
+
event: React_2.MouseEvent<HTMLElement>;
|
|
385
599
|
type: 'Click';
|
|
386
600
|
} | {
|
|
387
601
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
388
|
-
target: HTMLElement;
|
|
389
602
|
type: 'TypeAhead';
|
|
390
603
|
} | {
|
|
391
604
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
392
|
-
target: HTMLElement;
|
|
393
605
|
type: typeof ArrowRight;
|
|
394
606
|
} | {
|
|
395
607
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
396
|
-
target: HTMLElement;
|
|
397
608
|
type: typeof ArrowLeft;
|
|
398
609
|
} | {
|
|
399
610
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
400
|
-
target: HTMLElement;
|
|
401
611
|
type: typeof ArrowUp;
|
|
402
612
|
} | {
|
|
403
613
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
404
|
-
target: HTMLElement;
|
|
405
614
|
type: typeof ArrowDown;
|
|
406
615
|
} | {
|
|
407
616
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
408
|
-
target: HTMLElement;
|
|
409
617
|
type: typeof Home;
|
|
410
618
|
} | {
|
|
411
619
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
412
|
-
target: HTMLElement;
|
|
413
620
|
type: typeof End;
|
|
414
|
-
};
|
|
621
|
+
});
|
|
415
622
|
|
|
416
623
|
export declare type TreeNavigationEvent_unstable = TreeNavigationData_unstable['event'];
|
|
417
624
|
|
|
418
625
|
export declare type TreeOpenChangeData = {
|
|
419
626
|
open: boolean;
|
|
627
|
+
openItems: Set<TreeItemValue>;
|
|
628
|
+
value: TreeItemValue;
|
|
629
|
+
target: HTMLElement;
|
|
420
630
|
} & ({
|
|
421
631
|
event: React_2.MouseEvent<HTMLElement>;
|
|
422
|
-
target: HTMLElement;
|
|
423
632
|
type: 'ExpandIconClick';
|
|
424
633
|
} | {
|
|
425
634
|
event: React_2.MouseEvent<HTMLElement>;
|
|
426
|
-
target: HTMLElement;
|
|
427
635
|
type: 'Click';
|
|
428
636
|
} | {
|
|
429
637
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
430
|
-
target: HTMLElement;
|
|
431
638
|
type: typeof Enter;
|
|
432
639
|
} | {
|
|
433
640
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
434
|
-
target: HTMLElement;
|
|
435
641
|
type: typeof ArrowRight;
|
|
436
642
|
} | {
|
|
437
643
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
438
|
-
target: HTMLElement;
|
|
439
644
|
type: typeof ArrowLeft;
|
|
440
645
|
});
|
|
441
646
|
|
|
@@ -460,13 +665,12 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
460
665
|
* Controls the state of the open tree items.
|
|
461
666
|
* These property is ignored for subtrees.
|
|
462
667
|
*/
|
|
463
|
-
openItems?: Iterable<
|
|
668
|
+
openItems?: Iterable<TreeItemValue>;
|
|
464
669
|
/**
|
|
465
|
-
* This refers to a list of ids of opened
|
|
466
|
-
*
|
|
467
|
-
* These property is ignored for subtrees.
|
|
670
|
+
* This refers to a list of ids of default opened items.
|
|
671
|
+
* This property is ignored for subtrees.
|
|
468
672
|
*/
|
|
469
|
-
defaultOpenItems?: Iterable<
|
|
673
|
+
defaultOpenItems?: Iterable<TreeItemValue>;
|
|
470
674
|
/**
|
|
471
675
|
* Callback fired when the component changes value from open state.
|
|
472
676
|
* These property is ignored for subtrees.
|
|
@@ -485,19 +689,57 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
485
689
|
* @param event - a React's Synthetic event
|
|
486
690
|
* @param data - A data object with relevant information,
|
|
487
691
|
*/
|
|
488
|
-
|
|
692
|
+
onNavigation?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;
|
|
693
|
+
/**
|
|
694
|
+
* This refers to the selection mode of the tree.
|
|
695
|
+
* - undefined: No selection can be done.
|
|
696
|
+
* - 'single': Only one tree item can be selected, radio buttons are rendered.
|
|
697
|
+
* - 'multiselect': Multiple tree items can be selected, checkboxes are rendered.
|
|
698
|
+
*
|
|
699
|
+
* @default undefined
|
|
700
|
+
*/
|
|
701
|
+
selectionMode?: SelectionMode_2;
|
|
702
|
+
/**
|
|
703
|
+
* This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.
|
|
704
|
+
* Controls the state of the checked tree items.
|
|
705
|
+
* These property is ignored for subtrees.
|
|
706
|
+
*/
|
|
707
|
+
checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;
|
|
708
|
+
/**
|
|
709
|
+
* Callback fired when the component changes value from checked state.
|
|
710
|
+
* These property is ignored for subtrees.
|
|
711
|
+
*
|
|
712
|
+
* @param event - a React's Synthetic event
|
|
713
|
+
* @param data - A data object with relevant information,
|
|
714
|
+
* such as checked value and type of interaction that created the event.
|
|
715
|
+
*/
|
|
716
|
+
onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;
|
|
489
717
|
};
|
|
490
718
|
|
|
491
719
|
export declare const TreeProvider: Provider<TreeContextValue | undefined> & FC<ProviderProps<TreeContextValue | undefined>>;
|
|
492
720
|
|
|
493
|
-
export declare type
|
|
721
|
+
export declare type TreeSelectionValue = MultiSelectValue | SingleSelectValue;
|
|
722
|
+
|
|
723
|
+
declare type TreeSlots = {
|
|
494
724
|
root: Slot<'div'>;
|
|
495
725
|
};
|
|
726
|
+
export { TreeSlots as FlatTreeSlots }
|
|
727
|
+
export { TreeSlots }
|
|
496
728
|
|
|
497
729
|
/**
|
|
498
730
|
* State used in rendering Tree
|
|
499
731
|
*/
|
|
500
|
-
|
|
732
|
+
declare type TreeState = ComponentState<TreeSlots> & TreeContextValue & {
|
|
733
|
+
open: boolean;
|
|
734
|
+
};
|
|
735
|
+
export { TreeState as FlatTreeState }
|
|
736
|
+
export { TreeState }
|
|
737
|
+
|
|
738
|
+
export declare const useFlatTree_unstable: (props: FlatTreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
739
|
+
|
|
740
|
+
export declare const useFlatTreeContextValues_unstable: (state: TreeState) => TreeContextValues;
|
|
741
|
+
|
|
742
|
+
export declare const useFlatTreeStyles_unstable: (state: TreeState) => TreeState;
|
|
501
743
|
|
|
502
744
|
/**
|
|
503
745
|
* this hook provides FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -508,20 +750,11 @@ export declare type TreeState = ComponentState<TreeSlots> & TreeContextValue;
|
|
|
508
750
|
* It should be used on cases where more complex interactions with a Tree is required.
|
|
509
751
|
* On simple scenarios it is advised to simply use a nested structure instead.
|
|
510
752
|
*
|
|
511
|
-
* @param
|
|
753
|
+
* @param props - a list of tree items
|
|
512
754
|
* @param options - in case control over the internal openItems is required
|
|
513
755
|
*/
|
|
514
|
-
export declare function
|
|
756
|
+
export declare function useHeadlessFlatTree_unstable<Props extends HeadlessTreeItemProps>(props: Props[], options?: HeadlessFlatTreeOptions): HeadlessFlatTree<Props>;
|
|
515
757
|
|
|
516
|
-
/**
|
|
517
|
-
* Create the state required to render Tree.
|
|
518
|
-
*
|
|
519
|
-
* The returned state can be modified with hooks such as useTreeStyles_unstable,
|
|
520
|
-
* before being passed to renderTree_unstable.
|
|
521
|
-
*
|
|
522
|
-
* @param props - props from this instance of Tree
|
|
523
|
-
* @param ref - reference to root HTMLElement of Tree
|
|
524
|
-
*/
|
|
525
758
|
export declare const useTree_unstable: (props: TreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
526
759
|
|
|
527
760
|
export declare const useTreeContext_unstable: <T>(selector: ContextSelector<TreeContextValue, T>) => T;
|
|
@@ -537,9 +770,11 @@ export declare function useTreeContextValues_unstable(state: TreeState): TreeCon
|
|
|
537
770
|
* @param props - props from this instance of TreeItem
|
|
538
771
|
* @param ref - reference to root HTMLElement of TreeItem
|
|
539
772
|
*/
|
|
540
|
-
export declare
|
|
773
|
+
export declare function useTreeItem_unstable(props: TreeItemProps, ref: React_2.Ref<HTMLDivElement>): TreeItemState;
|
|
774
|
+
|
|
775
|
+
export declare const useTreeItemContext_unstable: <T>(selector: ContextSelector<TreeItemContextValue, T>) => T;
|
|
541
776
|
|
|
542
|
-
export declare
|
|
777
|
+
export declare function useTreeItemContextValues_unstable(state: TreeItemState): TreeItemContextValues;
|
|
543
778
|
|
|
544
779
|
/**
|
|
545
780
|
* Create the state required to render TreeItemLayout.
|