@fluentui/react-tree 9.0.0-beta.3 → 9.0.0-beta.31
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 +1665 -1
- package/CHANGELOG.md +446 -2
- package/dist/index.d.ts +407 -129
- 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 +125 -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 -13
- 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 +64 -111
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js +14 -22
- 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 +16 -9
- package/lib/components/TreeItem/TreeItem.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js +1 -2
- 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 -25
- package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +159 -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 +8 -8
- 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 -21
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +107 -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 +9 -9
- 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 -27
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +42 -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 -15
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/contexts/treeItemContext.js +16 -10
- 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 +141 -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 +5 -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 +189 -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 +54 -29
- 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 +3 -5
- package/lib-commonjs/Tree.js.map +1 -1
- package/lib-commonjs/TreeItem.js +3 -5
- package/lib-commonjs/TreeItem.js.map +1 -1
- package/lib-commonjs/TreeItemLayout.js +3 -5
- package/lib-commonjs/TreeItemLayout.js.map +1 -1
- package/lib-commonjs/TreeItemPersonaLayout.js +3 -5
- 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 +122 -0
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js.map +1 -0
- package/lib-commonjs/components/Tree/Tree.js +17 -23
- package/lib-commonjs/components/Tree/Tree.js.map +1 -1
- package/lib-commonjs/components/Tree/Tree.types.js +1 -3
- package/lib-commonjs/components/Tree/Tree.types.js.map +1 -1
- package/lib-commonjs/components/Tree/index.js +8 -10
- package/lib-commonjs/components/Tree/index.js.map +1 -1
- package/lib-commonjs/components/Tree/renderTree.js +14 -19
- 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 +70 -115
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.js +19 -26
- 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.styles.js +41 -0
- package/lib-commonjs/components/Tree/useTreeStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TreeItem/TreeItem.js +17 -18
- package/lib-commonjs/components/TreeItem/TreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/TreeItem.types.js +3 -4
- package/lib-commonjs/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib-commonjs/components/TreeItem/index.js +8 -9
- package/lib-commonjs/components/TreeItem/index.js.map +1 -1
- package/lib-commonjs/components/TreeItem/renderTreeItem.js +14 -33
- package/lib-commonjs/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js +169 -250
- package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js +25 -20
- 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 +15 -16
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.js +1 -3
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/index.js +7 -9
- package/lib-commonjs/components/TreeItemLayout/index.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js +14 -28
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +113 -52
- 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 +17 -18
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js +1 -3
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/index.js +7 -9
- package/lib-commonjs/components/TreeItemPersonaLayout/index.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +17 -35
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +49 -61
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js +16 -15
- 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 +4 -6
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/treeContext.js +26 -18
- package/lib-commonjs/contexts/treeContext.js.map +1 -1
- package/lib-commonjs/contexts/treeItemContext.js +30 -13
- 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 +145 -0
- package/lib-commonjs/hooks/useRootTree.js.map +1 -0
- package/lib-commonjs/hooks/useRovingTabIndexes.js +36 -55
- 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 +53 -181
- 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 +47 -38
- package/lib-commonjs/utils/ImmutableSet.js.map +1 -1
- package/lib-commonjs/utils/assert.js +11 -9
- 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/utils/createHTMLElementWalker.js +75 -0
- package/lib-commonjs/utils/createHTMLElementWalker.js.map +1 -0
- package/lib-commonjs/utils/createHeadlessTree.js +203 -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 +21 -34
- 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 +16 -16
- package/lib-commonjs/utils/nextTypeAheadElement.js.map +1 -1
- package/lib-commonjs/utils/normalizeOpenItems.js +11 -9
- package/lib-commonjs/utils/normalizeOpenItems.js.map +1 -1
- package/lib-commonjs/utils/tokens.js +29 -20
- package/lib-commonjs/utils/tokens.js.map +1 -1
- package/lib-commonjs/utils/treeItemFilter.js +7 -7
- package/lib-commonjs/utils/treeItemFilter.js.map +1 -1
- package/package.json +26 -17
- 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 -49
- 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/createUnfilteredFlatTree.js +0 -77
- package/lib/utils/createUnfilteredFlatTree.js.map +0 -1
- package/lib/utils/createVisibleFlatTree.js +0 -80
- package/lib/utils/createVisibleFlatTree.js.map +0 -1
- package/lib-commonjs/components/Tree/useTreeStyles.js +0 -27
- package/lib-commonjs/components/Tree/useTreeStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.js +0 -210
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.js +0 -105
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js +0 -122
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js.map +0 -1
- package/lib-commonjs/hooks/index.js +0 -10
- package/lib-commonjs/hooks/index.js.map +0 -1
- package/lib-commonjs/hooks/useFlatTree.js +0 -56
- package/lib-commonjs/hooks/useFlatTree.js.map +0 -1
- package/lib-commonjs/hooks/useFlatTreeNavigation.js +0 -81
- package/lib-commonjs/hooks/useFlatTreeNavigation.js.map +0 -1
- package/lib-commonjs/hooks/useHTMLElementWalker.js +0 -88
- package/lib-commonjs/hooks/useHTMLElementWalker.js.map +0 -1
- package/lib-commonjs/hooks/useNestedTreeNavigation.js +0 -66
- package/lib-commonjs/hooks/useNestedTreeNavigation.js.map +0 -1
- package/lib-commonjs/hooks/useOpenItemsState.js +0 -29
- package/lib-commonjs/hooks/useOpenItemsState.js.map +0 -1
- package/lib-commonjs/utils/createUnfilteredFlatTree.js +0 -84
- package/lib-commonjs/utils/createUnfilteredFlatTree.js.map +0 -1
- package/lib-commonjs/utils/createVisibleFlatTree.js +0 -87
- package/lib-commonjs/utils/createVisibleFlatTree.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,177 @@
|
|
|
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`
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* const defaultItems = flattenTree_unstable([
|
|
59
|
+
* {
|
|
60
|
+
* children: <TreeItemLayout>level 1, item 1</TreeItemLayout>,
|
|
61
|
+
* subtree: [
|
|
62
|
+
* {
|
|
63
|
+
* children: <TreeItemLayout>level 2, item 1</TreeItemLayout>,
|
|
64
|
+
* },
|
|
65
|
+
* {
|
|
66
|
+
* children: <TreeItemLayout>level 2, item 2</TreeItemLayout>,
|
|
67
|
+
* },
|
|
68
|
+
* {
|
|
69
|
+
* children: <TreeItemLayout>level 2, item 3</TreeItemLayout>,
|
|
70
|
+
* },
|
|
71
|
+
* ],
|
|
72
|
+
* },
|
|
73
|
+
* {
|
|
74
|
+
* children: <TreeItemLayout>level 1, item 2</TreeItemLayout>,
|
|
75
|
+
* subtree: [
|
|
76
|
+
* {
|
|
77
|
+
* children: <TreeItemLayout>level 2, item 1</TreeItemLayout>,
|
|
78
|
+
* subtree: [
|
|
79
|
+
* {
|
|
80
|
+
* children: <TreeItemLayout>level 3, item 1</TreeItemLayout>,
|
|
81
|
+
* subtree: [
|
|
82
|
+
* {
|
|
83
|
+
* children: <TreeItemLayout>level 4, item 1</TreeItemLayout>,
|
|
84
|
+
* },
|
|
85
|
+
* ],
|
|
86
|
+
* },
|
|
87
|
+
* ],
|
|
88
|
+
* },
|
|
89
|
+
* ],
|
|
90
|
+
* },
|
|
91
|
+
* ]);
|
|
92
|
+
* ```
|
|
27
93
|
*/
|
|
28
|
-
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_unstable?(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
|
+
};
|
|
29
175
|
|
|
30
176
|
/**
|
|
31
177
|
* FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -37,13 +183,16 @@ export declare const flattenTree_unstable: (items: NestedTreeItem[]) => FlatTree
|
|
|
37
183
|
*
|
|
38
184
|
* On simple scenarios it is advised to simply use a nested structure instead.
|
|
39
185
|
*/
|
|
40
|
-
export declare type
|
|
186
|
+
export declare type HeadlessFlatTree<Props extends HeadlessFlatTreeItemProps> = {
|
|
41
187
|
/**
|
|
42
188
|
* returns the properties required for the Tree component to work properly.
|
|
43
189
|
* That includes:
|
|
44
190
|
* `openItems`, `onOpenChange`, `onNavigation_unstable` and `ref`
|
|
45
191
|
*/
|
|
46
|
-
getTreeProps(): FlatTreeProps
|
|
192
|
+
getTreeProps(): Required<Pick<FlatTreeProps, 'openItems' | 'onOpenChange' | 'onNavigation_unstable' | 'checkedItems' | 'onCheckedChange'>> & {
|
|
193
|
+
ref: React_2.Ref<HTMLDivElement>;
|
|
194
|
+
openItems: ImmutableSet<TreeItemValue>;
|
|
195
|
+
};
|
|
47
196
|
/**
|
|
48
197
|
* internal method used to react to an `onNavigation` event.
|
|
49
198
|
* This method ensures proper navigation on keyboard and mouse interaction.
|
|
@@ -57,7 +206,7 @@ export declare type FlatTree = {
|
|
|
57
206
|
* event.preventDefault();
|
|
58
207
|
* const nextItem = tree.getNextNavigableItem(data);
|
|
59
208
|
* // scroll to item using virtualization scroll mechanism
|
|
60
|
-
* if (nextItem &&
|
|
209
|
+
* if (nextItem && tree.getElementFromItem(nextItem)) {
|
|
61
210
|
* listRef.current.scrollToItem(nextItem.index);
|
|
62
211
|
* }
|
|
63
212
|
* // wait for scrolling to happen and then invoke navigate method
|
|
@@ -72,34 +221,85 @@ export declare type FlatTree = {
|
|
|
72
221
|
* returns next item to be focused on a navigation.
|
|
73
222
|
* This method is provided to decouple the element that needs to be focused from
|
|
74
223
|
* the action of focusing it itself.
|
|
224
|
+
*
|
|
225
|
+
* On the case of TypeAhead navigation this method returns the current item.
|
|
75
226
|
*/
|
|
76
|
-
getNextNavigableItem(data: TreeNavigationData_unstable):
|
|
227
|
+
getNextNavigableItem(visibleItems: HeadlessTreeItem<Props>[], data: TreeNavigationData_unstable): HeadlessTreeItem<Props> | undefined;
|
|
77
228
|
/**
|
|
78
|
-
*
|
|
229
|
+
* similar to getElementById but for FlatTreeItems
|
|
79
230
|
*/
|
|
80
|
-
|
|
231
|
+
getElementFromItem(item: HeadlessTreeItem<Props>): HTMLElement | null;
|
|
81
232
|
/**
|
|
82
|
-
*
|
|
233
|
+
* an iterable containing all visually available flat tree items
|
|
83
234
|
*/
|
|
84
|
-
items():
|
|
235
|
+
items(): IterableIterator<HeadlessTreeItem<Props>>;
|
|
85
236
|
};
|
|
86
237
|
|
|
87
|
-
export declare type
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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_unstable' | 'selectionMode' | 'onCheckedChange'> & Pick<TreeProps, 'defaultOpenItems' | 'openItems' | 'checkedItems'> & {
|
|
243
|
+
defaultCheckedItems?: TreeProps['checkedItems'];
|
|
244
|
+
};
|
|
245
|
+
|
|
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> = {
|
|
93
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'>;
|
|
94
259
|
};
|
|
95
260
|
|
|
96
|
-
|
|
97
|
-
|
|
261
|
+
declare type HeadlessTreeItemProps = Omit<TreeItemProps, 'itemType' | 'value'> & {
|
|
262
|
+
value: TreeItemValue;
|
|
263
|
+
itemType?: TreeItemType;
|
|
264
|
+
parentValue?: TreeItemValue;
|
|
98
265
|
};
|
|
99
266
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
+
};
|
|
103
303
|
|
|
104
304
|
declare interface ImmutableSet<Value> {
|
|
105
305
|
/**
|
|
@@ -125,12 +325,31 @@ declare interface ImmutableSet<Value> {
|
|
|
125
325
|
has(value: Value): boolean;
|
|
126
326
|
/** Iterates over values in the ImmutableSet. */
|
|
127
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>;
|
|
128
334
|
}
|
|
129
335
|
|
|
130
|
-
|
|
131
|
-
|
|
336
|
+
declare const ImmutableSet: {
|
|
337
|
+
empty: ImmutableSet<never>;
|
|
338
|
+
create: typeof createImmutableSet;
|
|
339
|
+
isImmutableSet: typeof isImmutableSet;
|
|
340
|
+
dangerouslyCreate_unstable: typeof dangerouslyCreateImmutableSet;
|
|
132
341
|
};
|
|
133
342
|
|
|
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;
|
|
352
|
+
|
|
134
353
|
export declare const renderTree_unstable: (state: TreeState, contextValues: TreeContextValues) => JSX.Element;
|
|
135
354
|
|
|
136
355
|
/**
|
|
@@ -148,58 +367,91 @@ export declare const renderTreeItemLayout_unstable: (state: TreeItemLayoutState)
|
|
|
148
367
|
*/
|
|
149
368
|
export declare const renderTreeItemPersonaLayout_unstable: (state: TreeItemPersonaLayoutState, contextValues: TreeItemPersonaLayoutContextValues) => JSX.Element;
|
|
150
369
|
|
|
370
|
+
declare type SingleSelectValue = NonNullable<RadioProps['checked']>;
|
|
371
|
+
|
|
151
372
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* and items that have children may be expanded or collapsed to show or hide the children.
|
|
155
|
-
* For example, in a file system navigator that uses a tree view to display folders and files,
|
|
156
|
-
* an item representing a folder can be expanded to reveal the contents of the folder,
|
|
157
|
-
* 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`.
|
|
158
375
|
*/
|
|
159
376
|
export declare const Tree: ForwardRefComponent<TreeProps>;
|
|
160
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
|
+
|
|
161
394
|
export declare const treeClassNames: SlotClassNames<TreeSlots>;
|
|
162
395
|
|
|
163
396
|
export declare type TreeContextValue = {
|
|
164
397
|
level: number;
|
|
398
|
+
selectionMode: 'none' | SelectionMode_2;
|
|
165
399
|
appearance: 'subtle' | 'subtle-alpha' | 'transparent';
|
|
166
400
|
size: 'small' | 'medium';
|
|
167
|
-
openItems: ImmutableSet<
|
|
401
|
+
openItems: ImmutableSet<TreeItemValue>;
|
|
402
|
+
checkedItems: ImmutableMap<TreeItemValue, 'mixed' | boolean>;
|
|
168
403
|
/**
|
|
169
|
-
*
|
|
404
|
+
* requests root Tree component to respond to some tree item event,
|
|
170
405
|
*/
|
|
171
|
-
|
|
172
|
-
requestNavigation(data: TreeNavigationData_unstable): void;
|
|
406
|
+
requestTreeResponse(request: TreeItemRequest): void;
|
|
173
407
|
};
|
|
174
408
|
|
|
175
|
-
declare type TreeContextValues = {
|
|
409
|
+
export declare type TreeContextValues = {
|
|
176
410
|
tree: TreeContextValue;
|
|
177
411
|
};
|
|
178
412
|
|
|
179
413
|
/**
|
|
180
|
-
* TreeItem component
|
|
414
|
+
* The `TreeItem` component represents a single item in a tree.
|
|
415
|
+
* It expects a certain order of children to work properly: the first child should be the node itself,
|
|
416
|
+
* and the second child should be a nested subtree in the form of another Tree component or a standalone TreeItem.
|
|
417
|
+
* This order follows the same order as document traversal for the TreeWalker API in JavaScript:
|
|
418
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker.
|
|
419
|
+
* The content and layout of a TreeItem can be defined using the TreeItemLayout or TreeItemPersonaLayout component,
|
|
420
|
+
* which should be used as a direct child of TreeItem.
|
|
421
|
+
*
|
|
422
|
+
* When a TreeItem has nested child subtree, an expand/collapse control is displayed,
|
|
423
|
+
* allowing the user to show or hide the children.
|
|
181
424
|
*/
|
|
182
425
|
export declare const TreeItem: ForwardRefComponent<TreeItemProps>;
|
|
183
426
|
|
|
184
427
|
export declare const treeItemClassNames: SlotClassNames<TreeItemSlots>;
|
|
185
428
|
|
|
186
|
-
declare type TreeItemContextValue = {
|
|
429
|
+
export declare type TreeItemContextValue = {
|
|
187
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;
|
|
188
441
|
};
|
|
189
442
|
|
|
190
443
|
declare type TreeItemContextValues = {
|
|
191
444
|
treeItem: TreeItemContextValue;
|
|
192
|
-
button: ButtonContextValue;
|
|
193
445
|
};
|
|
194
446
|
|
|
195
447
|
declare type TreeItemCSSProperties = React_2.CSSProperties & {
|
|
196
448
|
[treeItemLevelToken]?: string | number;
|
|
197
449
|
};
|
|
198
450
|
|
|
199
|
-
export declare type TreeItemId = string | number;
|
|
200
|
-
|
|
201
451
|
/**
|
|
202
|
-
* TreeItemLayout component
|
|
452
|
+
* The `TreeItemLayout` component is used as a child of `TreeItem` to define the content and layout of a tree item.
|
|
453
|
+
* It provides a consistent visual structure for tree items in a `Tree` component.
|
|
454
|
+
* This component should only be used as a direct child of `TreeItem`.
|
|
203
455
|
*/
|
|
204
456
|
export declare const TreeItemLayout: ForwardRefComponent<TreeItemLayoutProps>;
|
|
205
457
|
|
|
@@ -212,26 +464,50 @@ export declare type TreeItemLayoutProps = ComponentProps<Partial<TreeItemLayoutS
|
|
|
212
464
|
|
|
213
465
|
export declare type TreeItemLayoutSlots = {
|
|
214
466
|
root: Slot<'div'>;
|
|
467
|
+
/**
|
|
468
|
+
* Content. Children of the root slot are automatically rendered here
|
|
469
|
+
*/
|
|
470
|
+
main: NonNullable<Slot<'div'>>;
|
|
215
471
|
/**
|
|
216
472
|
* Icon slot that renders right before main content
|
|
217
473
|
*/
|
|
218
|
-
iconBefore?: Slot<'
|
|
474
|
+
iconBefore?: Slot<'div'>;
|
|
219
475
|
/**
|
|
220
476
|
* Icon slot that renders right after main content
|
|
221
477
|
*/
|
|
222
|
-
iconAfter?: Slot<'
|
|
223
|
-
|
|
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
|
+
aside?: Slot<'div'>;
|
|
485
|
+
/**
|
|
486
|
+
* actionable elements are normally buttons, menus, or other focusable elements.
|
|
487
|
+
* Those elements are only visibly available if the given tree item is currently active.
|
|
488
|
+
*/
|
|
489
|
+
actions?: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
490
|
+
/**
|
|
491
|
+
* Forces visibility of the aside/action content
|
|
492
|
+
*/
|
|
493
|
+
visible?: boolean;
|
|
494
|
+
}>>;
|
|
495
|
+
selector?: Slot<typeof Checkbox> | Slot<typeof Radio>;
|
|
224
496
|
};
|
|
225
497
|
|
|
226
498
|
/**
|
|
227
499
|
* State used in rendering TreeItemLayout
|
|
228
500
|
*/
|
|
229
|
-
export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots> &
|
|
501
|
+
export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots> & {
|
|
502
|
+
buttonContextValue: ButtonContextValue;
|
|
503
|
+
};
|
|
230
504
|
|
|
231
505
|
export declare const treeItemLevelToken: "--fluent-TreeItem--level";
|
|
232
506
|
|
|
233
507
|
/**
|
|
234
|
-
* TreeItemPersonaLayout component
|
|
508
|
+
* The `TreeItemPersonaLayout` component is used as a child of `TreeItem` to display a `TreeItem` with a media (typically an avatar) and a description.
|
|
509
|
+
* It provides a more visually appealing representation of a `TreeItem` and is typically used to display a list of people or topics.
|
|
510
|
+
* This component should only be used as a direct child of `TreeItem`.
|
|
235
511
|
*/
|
|
236
512
|
export declare const TreeItemPersonaLayout: ForwardRefComponent<TreeItemPersonaLayoutProps>;
|
|
237
513
|
|
|
@@ -246,140 +522,112 @@ declare type TreeItemPersonaLayoutContextValues = {
|
|
|
246
522
|
*/
|
|
247
523
|
export declare type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;
|
|
248
524
|
|
|
249
|
-
export declare type TreeItemPersonaLayoutSlots = {
|
|
250
|
-
root: Slot<'
|
|
525
|
+
export declare type TreeItemPersonaLayoutSlots = Pick<TreeItemLayoutSlots, 'actions' | 'aside' | 'expandIcon' | 'selector'> & {
|
|
526
|
+
root: NonNullable<Slot<'div'>>;
|
|
251
527
|
/**
|
|
252
528
|
* Avatar to display.
|
|
253
529
|
*/
|
|
254
|
-
media: NonNullable<Slot<'
|
|
255
|
-
/**
|
|
256
|
-
* Main text. Children of the root slot are automatically rendered here
|
|
257
|
-
*/
|
|
258
|
-
main: Slot<'span'>;
|
|
530
|
+
media: NonNullable<Slot<'div'>>;
|
|
259
531
|
/**
|
|
260
|
-
*
|
|
532
|
+
* Content. Children of the root slot are automatically rendered here
|
|
261
533
|
*/
|
|
262
|
-
|
|
534
|
+
main: NonNullable<Slot<'div'>>;
|
|
263
535
|
/**
|
|
264
|
-
*
|
|
536
|
+
* Secondary text that describes or complements the content
|
|
265
537
|
*/
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* A layout wrapper for the main and description slots
|
|
269
|
-
*/
|
|
270
|
-
content: Slot<'div'>;
|
|
538
|
+
description?: Slot<'div'>;
|
|
271
539
|
};
|
|
272
540
|
|
|
273
541
|
/**
|
|
274
542
|
* State used in rendering TreeItemPersonaLayout
|
|
275
543
|
*/
|
|
276
|
-
export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> &
|
|
544
|
+
export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> & {
|
|
277
545
|
avatarSize: AvatarSize;
|
|
546
|
+
buttonContextValue: ButtonContextValue;
|
|
278
547
|
};
|
|
279
548
|
|
|
280
549
|
/**
|
|
281
550
|
* TreeItem Props
|
|
282
551
|
*/
|
|
283
552
|
export declare type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
* This attribute is used to force the decision if a TreeItem is a leaf or not. By not providing this property
|
|
287
|
-
* this will be inferred by the presence of a subtree as part of the TreeItem children.
|
|
288
|
-
*/
|
|
289
|
-
leaf?: boolean;
|
|
553
|
+
itemType: TreeItemType;
|
|
554
|
+
value?: TreeItemValue;
|
|
290
555
|
};
|
|
291
556
|
|
|
292
|
-
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined
|
|
557
|
+
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined> & React_2.FC<React_2.ProviderProps<TreeItemContextValue | undefined>>;
|
|
558
|
+
|
|
559
|
+
declare type TreeItemRequest = {
|
|
560
|
+
itemType: TreeItemType;
|
|
561
|
+
} & (OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'> | TreeNavigationData_unstable | OmitWithoutExpanding<TreeCheckedChangeData, 'selectionMode' | 'checkedItems'>);
|
|
293
562
|
|
|
294
563
|
export declare type TreeItemSlots = {
|
|
295
564
|
root: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
296
565
|
style?: TreeItemCSSProperties;
|
|
297
566
|
}>>;
|
|
298
|
-
content: NonNullable<Slot<'div'>>;
|
|
299
|
-
subtree?: Slot<'span'>;
|
|
300
|
-
/**
|
|
301
|
-
* Expand icon slot,
|
|
302
|
-
* by default renders a chevron icon to indicate opening and closing
|
|
303
|
-
*/
|
|
304
|
-
expandIcon?: Slot<'span'>;
|
|
305
|
-
/**
|
|
306
|
-
* Actions slot that renders on the end of tree item
|
|
307
|
-
* when the item is hovered/focused
|
|
308
|
-
*/
|
|
309
|
-
actions?: Slot<'span'>;
|
|
310
567
|
};
|
|
311
568
|
|
|
312
569
|
/**
|
|
313
570
|
* State used in rendering TreeItem
|
|
314
571
|
*/
|
|
315
|
-
export declare type TreeItemState = ComponentState<TreeItemSlots> & {
|
|
316
|
-
open: boolean;
|
|
317
|
-
isLeaf: boolean;
|
|
572
|
+
export declare type TreeItemState = ComponentState<TreeItemSlots> & TreeItemContextValue & {
|
|
318
573
|
level: number;
|
|
319
|
-
|
|
320
|
-
* By design, a button included on the actions slot should be small
|
|
321
|
-
*/
|
|
322
|
-
buttonSize: 'small';
|
|
323
|
-
isActionsVisible: boolean;
|
|
574
|
+
itemType: TreeItemType;
|
|
324
575
|
};
|
|
325
576
|
|
|
577
|
+
declare type TreeItemType = 'leaf' | 'branch';
|
|
578
|
+
|
|
579
|
+
export declare type TreeItemValue = string | number;
|
|
580
|
+
|
|
326
581
|
export declare type TreeNavigationData_unstable = {
|
|
327
|
-
event: React_2.MouseEvent<HTMLElement>;
|
|
328
582
|
target: HTMLElement;
|
|
583
|
+
value: TreeItemValue;
|
|
584
|
+
} & ({
|
|
585
|
+
event: React_2.MouseEvent<HTMLElement>;
|
|
329
586
|
type: 'Click';
|
|
330
587
|
} | {
|
|
331
588
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
332
|
-
target: HTMLElement;
|
|
333
589
|
type: 'TypeAhead';
|
|
334
590
|
} | {
|
|
335
591
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
336
|
-
target: HTMLElement;
|
|
337
592
|
type: typeof ArrowRight;
|
|
338
593
|
} | {
|
|
339
594
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
340
|
-
target: HTMLElement;
|
|
341
595
|
type: typeof ArrowLeft;
|
|
342
596
|
} | {
|
|
343
597
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
344
|
-
target: HTMLElement;
|
|
345
598
|
type: typeof ArrowUp;
|
|
346
599
|
} | {
|
|
347
600
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
348
|
-
target: HTMLElement;
|
|
349
601
|
type: typeof ArrowDown;
|
|
350
602
|
} | {
|
|
351
603
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
352
|
-
target: HTMLElement;
|
|
353
604
|
type: typeof Home;
|
|
354
605
|
} | {
|
|
355
606
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
356
|
-
target: HTMLElement;
|
|
357
607
|
type: typeof End;
|
|
358
|
-
};
|
|
608
|
+
});
|
|
359
609
|
|
|
360
610
|
export declare type TreeNavigationEvent_unstable = TreeNavigationData_unstable['event'];
|
|
361
611
|
|
|
362
612
|
export declare type TreeOpenChangeData = {
|
|
363
613
|
open: boolean;
|
|
614
|
+
openItems: Set<TreeItemValue>;
|
|
615
|
+
value: TreeItemValue;
|
|
616
|
+
target: HTMLElement;
|
|
364
617
|
} & ({
|
|
365
618
|
event: React_2.MouseEvent<HTMLElement>;
|
|
366
|
-
target: HTMLElement;
|
|
367
619
|
type: 'ExpandIconClick';
|
|
368
620
|
} | {
|
|
369
621
|
event: React_2.MouseEvent<HTMLElement>;
|
|
370
|
-
target: HTMLElement;
|
|
371
622
|
type: 'Click';
|
|
372
623
|
} | {
|
|
373
624
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
374
|
-
target: HTMLElement;
|
|
375
625
|
type: typeof Enter;
|
|
376
626
|
} | {
|
|
377
627
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
378
|
-
target: HTMLElement;
|
|
379
628
|
type: typeof ArrowRight;
|
|
380
629
|
} | {
|
|
381
630
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
382
|
-
target: HTMLElement;
|
|
383
631
|
type: typeof ArrowLeft;
|
|
384
632
|
});
|
|
385
633
|
|
|
@@ -404,13 +652,12 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
404
652
|
* Controls the state of the open tree items.
|
|
405
653
|
* These property is ignored for subtrees.
|
|
406
654
|
*/
|
|
407
|
-
openItems?: Iterable<
|
|
655
|
+
openItems?: Iterable<TreeItemValue>;
|
|
408
656
|
/**
|
|
409
|
-
* This refers to a list of ids of opened
|
|
410
|
-
*
|
|
411
|
-
* These property is ignored for subtrees.
|
|
657
|
+
* This refers to a list of ids of default opened items.
|
|
658
|
+
* This property is ignored for subtrees.
|
|
412
659
|
*/
|
|
413
|
-
defaultOpenItems?: Iterable<
|
|
660
|
+
defaultOpenItems?: Iterable<TreeItemValue>;
|
|
414
661
|
/**
|
|
415
662
|
* Callback fired when the component changes value from open state.
|
|
416
663
|
* These property is ignored for subtrees.
|
|
@@ -430,18 +677,56 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
430
677
|
* @param data - A data object with relevant information,
|
|
431
678
|
*/
|
|
432
679
|
onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;
|
|
680
|
+
/**
|
|
681
|
+
* This refers to the selection mode of the tree.
|
|
682
|
+
* - undefined: No selection can be done.
|
|
683
|
+
* - 'single': Only one tree item can be selected, radio buttons are rendered.
|
|
684
|
+
* - 'multiselect': Multiple tree items can be selected, checkboxes are rendered.
|
|
685
|
+
*
|
|
686
|
+
* @default undefined
|
|
687
|
+
*/
|
|
688
|
+
selectionMode?: SelectionMode_2;
|
|
689
|
+
/**
|
|
690
|
+
* This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.
|
|
691
|
+
* Controls the state of the checked tree items.
|
|
692
|
+
* These property is ignored for subtrees.
|
|
693
|
+
*/
|
|
694
|
+
checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;
|
|
695
|
+
/**
|
|
696
|
+
* Callback fired when the component changes value from checked state.
|
|
697
|
+
* These property is ignored for subtrees.
|
|
698
|
+
*
|
|
699
|
+
* @param event - a React's Synthetic event
|
|
700
|
+
* @param data - A data object with relevant information,
|
|
701
|
+
* such as checked value and type of interaction that created the event.
|
|
702
|
+
*/
|
|
703
|
+
onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;
|
|
433
704
|
};
|
|
434
705
|
|
|
435
706
|
export declare const TreeProvider: Provider<TreeContextValue | undefined> & FC<ProviderProps<TreeContextValue | undefined>>;
|
|
436
707
|
|
|
437
|
-
export declare type
|
|
708
|
+
export declare type TreeSelectionValue = MultiSelectValue | SingleSelectValue;
|
|
709
|
+
|
|
710
|
+
declare type TreeSlots = {
|
|
438
711
|
root: Slot<'div'>;
|
|
439
712
|
};
|
|
713
|
+
export { TreeSlots as FlatTreeSlots }
|
|
714
|
+
export { TreeSlots }
|
|
440
715
|
|
|
441
716
|
/**
|
|
442
717
|
* State used in rendering Tree
|
|
443
718
|
*/
|
|
444
|
-
|
|
719
|
+
declare type TreeState = ComponentState<TreeSlots> & TreeContextValue & {
|
|
720
|
+
open: boolean;
|
|
721
|
+
};
|
|
722
|
+
export { TreeState as FlatTreeState }
|
|
723
|
+
export { TreeState }
|
|
724
|
+
|
|
725
|
+
export declare const useFlatTree_unstable: (props: FlatTreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
726
|
+
|
|
727
|
+
export declare const useFlatTreeContextValues_unstable: (state: TreeState) => TreeContextValues;
|
|
728
|
+
|
|
729
|
+
export declare const useFlatTreeStyles_unstable: (state: TreeState) => TreeState;
|
|
445
730
|
|
|
446
731
|
/**
|
|
447
732
|
* this hook provides FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -452,20 +737,11 @@ export declare type TreeState = ComponentState<TreeSlots> & TreeContextValue;
|
|
|
452
737
|
* It should be used on cases where more complex interactions with a Tree is required.
|
|
453
738
|
* On simple scenarios it is advised to simply use a nested structure instead.
|
|
454
739
|
*
|
|
455
|
-
* @param
|
|
740
|
+
* @param props - a list of tree items
|
|
456
741
|
* @param options - in case control over the internal openItems is required
|
|
457
742
|
*/
|
|
458
|
-
export declare function
|
|
743
|
+
export declare function useHeadlessFlatTree_unstable<Props extends HeadlessTreeItemProps>(props: Props[], options?: HeadlessFlatTreeOptions): HeadlessFlatTree<Props>;
|
|
459
744
|
|
|
460
|
-
/**
|
|
461
|
-
* Create the state required to render Tree.
|
|
462
|
-
*
|
|
463
|
-
* The returned state can be modified with hooks such as useTreeStyles_unstable,
|
|
464
|
-
* before being passed to renderTree_unstable.
|
|
465
|
-
*
|
|
466
|
-
* @param props - props from this instance of Tree
|
|
467
|
-
* @param ref - reference to root HTMLElement of Tree
|
|
468
|
-
*/
|
|
469
745
|
export declare const useTree_unstable: (props: TreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
470
746
|
|
|
471
747
|
export declare const useTreeContext_unstable: <T>(selector: ContextSelector<TreeContextValue, T>) => T;
|
|
@@ -481,9 +757,11 @@ export declare function useTreeContextValues_unstable(state: TreeState): TreeCon
|
|
|
481
757
|
* @param props - props from this instance of TreeItem
|
|
482
758
|
* @param ref - reference to root HTMLElement of TreeItem
|
|
483
759
|
*/
|
|
484
|
-
export declare
|
|
760
|
+
export declare function useTreeItem_unstable(props: TreeItemProps, ref: React_2.Ref<HTMLDivElement>): TreeItemState;
|
|
761
|
+
|
|
762
|
+
export declare const useTreeItemContext_unstable: <T>(selector: ContextSelector<TreeItemContextValue, T>) => T;
|
|
485
763
|
|
|
486
|
-
export declare
|
|
764
|
+
export declare function useTreeItemContextValues_unstable(state: TreeItemState): TreeItemContextValues;
|
|
487
765
|
|
|
488
766
|
/**
|
|
489
767
|
* Create the state required to render TreeItemLayout.
|