@fluentui/react-tree 9.0.0-beta.26 → 9.0.0-beta.27
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 +64 -1
- package/CHANGELOG.md +19 -2
- package/dist/index.d.ts +160 -96
- package/lib/FlatTree.js +1 -0
- package/lib/FlatTree.js.map +1 -0
- package/lib/components/FlatTree/FlatTree.js +13 -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 +6 -0
- package/lib/components/FlatTree/index.js.map +1 -0
- package/lib/{hooks → components/FlatTree}/useFlatControllableCheckedItems.js +10 -23
- 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/{hooks → components/FlatTree}/useFlatTreeNavigation.js +12 -12
- package/lib/components/FlatTree/useFlatTreeNavigation.js.map +1 -0
- package/lib/components/FlatTree/useFlatTreeStyles.styles.js +30 -0
- package/lib/components/FlatTree/useFlatTreeStyles.styles.js.map +1 -0
- package/lib/{hooks/useFlatTree.js → components/FlatTree/useHeadlessFlatTree.js} +8 -14
- package/lib/components/FlatTree/useHeadlessFlatTree.js.map +1 -0
- package/lib/components/Tree/Tree.js +4 -9
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/index.js +2 -2
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/{hooks/useNestedControllableCheckedItems.js → components/Tree/useControllableCheckedItems.js} +5 -18
- package/lib/components/Tree/useControllableCheckedItems.js.map +1 -0
- package/lib/components/Tree/useTree.js +38 -14
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/{hooks/useNestedTreeNavigation.js → components/Tree/useTreeNavigation.js} +6 -6
- package/lib/components/Tree/useTreeNavigation.js.map +1 -0
- package/lib/components/Tree/useTreeStyles.styles.js +2 -2
- package/lib/components/Tree/useTreeStyles.styles.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/renderTreeItem.js +2 -4
- package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +10 -56
- package/lib/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemContextValues.js +8 -16
- package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +49 -7
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +1 -1
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +6 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js +5 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -1
- package/lib/contexts/index.js +0 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/contexts/treeItemContext.js +5 -0
- package/lib/contexts/treeItemContext.js.map +1 -1
- package/lib/hooks/useControllableOpenItems.js +6 -3
- package/lib/hooks/useControllableOpenItems.js.map +1 -1
- package/lib/{components/Tree → hooks}/useRootTree.js +18 -25
- package/lib/hooks/useRootTree.js.map +1 -0
- package/lib/{components/Tree → hooks}/useSubtree.js +4 -4
- package/lib/hooks/useSubtree.js.map +1 -0
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/ImmutableMap.js +4 -0
- package/lib/utils/ImmutableMap.js.map +1 -1
- package/lib/utils/ImmutableSet.js +4 -0
- package/lib/utils/ImmutableSet.js.map +1 -1
- package/lib/utils/createCheckedItems.js +18 -0
- package/lib/utils/createCheckedItems.js.map +1 -0
- package/lib/utils/{createFlatTreeItems.js → createHeadlessTree.js} +45 -45
- 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.map +1 -1
- package/lib-commonjs/FlatTree.js +6 -0
- package/lib-commonjs/FlatTree.js.map +1 -0
- package/lib-commonjs/components/FlatTree/FlatTree.js +20 -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 +21 -0
- package/lib-commonjs/components/FlatTree/index.js.map +1 -0
- package/lib-commonjs/{hooks → components/FlatTree}/useFlatControllableCheckedItems.js +10 -23
- 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/{hooks → components/FlatTree}/useFlatTreeNavigation.js +12 -12
- package/lib-commonjs/components/FlatTree/useFlatTreeNavigation.js.map +1 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.js +53 -0
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.js.map +1 -0
- package/lib-commonjs/{hooks/useFlatTree.js → components/FlatTree/useHeadlessFlatTree.js} +10 -16
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js.map +1 -0
- package/lib-commonjs/components/Tree/Tree.js +3 -3
- package/lib-commonjs/components/Tree/Tree.js.map +1 -1
- package/lib-commonjs/components/Tree/index.js +2 -2
- package/lib-commonjs/components/Tree/index.js.map +1 -1
- package/lib-commonjs/{hooks/useNestedControllableCheckedItems.js → components/Tree/useControllableCheckedItems.js} +7 -20
- package/lib-commonjs/components/Tree/useControllableCheckedItems.js.map +1 -0
- package/lib-commonjs/components/Tree/useTree.js +38 -6
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/{hooks/useNestedTreeNavigation.js → components/Tree/useTreeNavigation.js} +8 -8
- package/lib-commonjs/components/Tree/useTreeNavigation.js.map +1 -0
- package/lib-commonjs/components/Tree/useTreeStyles.styles.js +2 -2
- package/lib-commonjs/components/Tree/useTreeStyles.styles.js.map +1 -1
- package/lib-commonjs/components/TreeItem/renderTreeItem.js +1 -3
- package/lib-commonjs/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js +9 -55
- package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js +8 -17
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +47 -5
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +6 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js +5 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/index.js +0 -1
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/treeItemContext.js +5 -0
- package/lib-commonjs/contexts/treeItemContext.js.map +1 -1
- package/lib-commonjs/hooks/useControllableOpenItems.js +3 -2
- package/lib-commonjs/hooks/useControllableOpenItems.js.map +1 -1
- package/lib-commonjs/{components/Tree → hooks}/useRootTree.js +15 -22
- package/lib-commonjs/hooks/useRootTree.js.map +1 -0
- package/lib-commonjs/{components/Tree → hooks}/useSubtree.js +10 -10
- package/lib-commonjs/hooks/useSubtree.js.map +1 -0
- package/lib-commonjs/index.js +10 -4
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/ImmutableMap.js +4 -0
- package/lib-commonjs/utils/ImmutableMap.js.map +1 -1
- package/lib-commonjs/utils/ImmutableSet.js +4 -0
- package/lib-commonjs/utils/ImmutableSet.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/{createFlatTreeItems.js → createHeadlessTree.js} +47 -47
- 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/package.json +8 -8
- package/lib/components/Tree/useRootTree.js.map +0 -1
- package/lib/components/Tree/useSubtree.js.map +0 -1
- package/lib/contexts/treeItemSlotsContext.js +0 -9
- package/lib/contexts/treeItemSlotsContext.js.map +0 -1
- package/lib/hooks/index.js +0 -5
- package/lib/hooks/index.js.map +0 -1
- package/lib/hooks/useFlatControllableCheckedItems.js.map +0 -1
- package/lib/hooks/useFlatTree.js.map +0 -1
- package/lib/hooks/useFlatTreeNavigation.js.map +0 -1
- package/lib/hooks/useNestedControllableCheckedItems.js.map +0 -1
- package/lib/hooks/useNestedTreeNavigation.js.map +0 -1
- package/lib/utils/createFlatTreeItems.js.map +0 -1
- package/lib-commonjs/components/Tree/useRootTree.js.map +0 -1
- package/lib-commonjs/components/Tree/useSubtree.js.map +0 -1
- package/lib-commonjs/contexts/treeItemSlotsContext.js +0 -25
- package/lib-commonjs/contexts/treeItemSlotsContext.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/useFlatControllableCheckedItems.js.map +0 -1
- package/lib-commonjs/hooks/useFlatTree.js.map +0 -1
- package/lib-commonjs/hooks/useFlatTreeNavigation.js.map +0 -1
- package/lib-commonjs/hooks/useNestedControllableCheckedItems.js.map +0 -1
- package/lib-commonjs/hooks/useNestedTreeNavigation.js.map +0 -1
- package/lib-commonjs/utils/createFlatTreeItems.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,70 @@
|
|
|
2
2
|
"name": "@fluentui/react-tree",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 25 Jul 2023 13:26:26 GMT",
|
|
6
|
+
"tag": "@fluentui/react-tree_v9.0.0-beta.27",
|
|
7
|
+
"version": "9.0.0-beta.27",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "ololubek@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-tree",
|
|
13
|
+
"commit": "1082207b08959996cd736725735cadc01d0849b0",
|
|
14
|
+
"comment": "chore: Update react-icons version to pick up fowardref change."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
18
|
+
"package": "@fluentui/react-tree",
|
|
19
|
+
"commit": "0d4d0ef8daebaf5b6ebbcce17e64e35488864e0e",
|
|
20
|
+
"comment": "chore: moves slots from TreeItem to TreeItemLayout"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
24
|
+
"package": "@fluentui/react-tree",
|
|
25
|
+
"commit": "c017e880f238c1f113ff7ff6e28560d77e7ea46b",
|
|
26
|
+
"comment": "feat: creates FlatTree component"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-tree",
|
|
31
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.14",
|
|
32
|
+
"commit": "c0c62f9383781f0dbebd800eaa2c64ef761075a2"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-tree",
|
|
37
|
+
"comment": "Bump @fluentui/react-button to v9.3.25",
|
|
38
|
+
"commit": "c0c62f9383781f0dbebd800eaa2c64ef761075a2"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-tree",
|
|
43
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.26",
|
|
44
|
+
"commit": "c0c62f9383781f0dbebd800eaa2c64ef761075a2"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-tree",
|
|
49
|
+
"comment": "Bump @fluentui/react-portal to v9.3.3",
|
|
50
|
+
"commit": "c0c62f9383781f0dbebd800eaa2c64ef761075a2"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-tree",
|
|
55
|
+
"comment": "Bump @fluentui/react-radio to v9.1.26",
|
|
56
|
+
"commit": "c0c62f9383781f0dbebd800eaa2c64ef761075a2"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"author": "beachball",
|
|
60
|
+
"package": "@fluentui/react-tree",
|
|
61
|
+
"comment": "Bump @fluentui/react-tabster to v9.11.0",
|
|
62
|
+
"commit": "c0c62f9383781f0dbebd800eaa2c64ef761075a2"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"date": "Thu, 20 Jul 2023 18:27:36 GMT",
|
|
6
69
|
"tag": "@fluentui/react-tree_v9.0.0-beta.26",
|
|
7
70
|
"version": "9.0.0-beta.26",
|
|
8
71
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tree
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 25 Jul 2023 13:26:26 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-beta.27](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.27)
|
|
8
|
+
|
|
9
|
+
Tue, 25 Jul 2023 13:26:26 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.26..@fluentui/react-tree_v9.0.0-beta.27)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- chore: Update react-icons version to pick up fowardref change. ([PR #28590](https://github.com/microsoft/fluentui/pull/28590) by ololubek@microsoft.com)
|
|
15
|
+
- chore: moves slots from TreeItem to TreeItemLayout ([PR #28621](https://github.com/microsoft/fluentui/pull/28621) by bernardo.sunderhus@gmail.com)
|
|
16
|
+
- feat: creates FlatTree component ([PR #28620](https://github.com/microsoft/fluentui/pull/28620) by bernardo.sunderhus@gmail.com)
|
|
17
|
+
- Bump @fluentui/react-avatar to v9.5.14 ([PR #28530](https://github.com/microsoft/fluentui/pull/28530) by beachball)
|
|
18
|
+
- Bump @fluentui/react-button to v9.3.25 ([PR #28530](https://github.com/microsoft/fluentui/pull/28530) by beachball)
|
|
19
|
+
- Bump @fluentui/react-checkbox to v9.1.26 ([PR #28530](https://github.com/microsoft/fluentui/pull/28530) by beachball)
|
|
20
|
+
- Bump @fluentui/react-portal to v9.3.3 ([PR #28530](https://github.com/microsoft/fluentui/pull/28530) by beachball)
|
|
21
|
+
- Bump @fluentui/react-radio to v9.1.26 ([PR #28530](https://github.com/microsoft/fluentui/pull/28530) by beachball)
|
|
22
|
+
- Bump @fluentui/react-tabster to v9.11.0 ([PR #28530](https://github.com/microsoft/fluentui/pull/28530) by beachball)
|
|
23
|
+
|
|
7
24
|
## [9.0.0-beta.26](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.26)
|
|
8
25
|
|
|
9
|
-
Thu, 20 Jul 2023 18:
|
|
26
|
+
Thu, 20 Jul 2023 18:27:36 GMT
|
|
10
27
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.25..@fluentui/react-tree_v9.0.0-beta.26)
|
|
11
28
|
|
|
12
29
|
### Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ 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
9
|
import { ButtonContextValue } from '@fluentui/react-button';
|
|
10
|
-
import
|
|
10
|
+
import { Checkbox } from '@fluentui/react-checkbox';
|
|
11
11
|
import { CheckboxProps } from '@fluentui/react-checkbox';
|
|
12
12
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
13
13
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
@@ -20,7 +20,7 @@ import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
|
20
20
|
import type { Home } from '@fluentui/keyboard-keys';
|
|
21
21
|
import { Provider } from 'react';
|
|
22
22
|
import { ProviderProps } from 'react';
|
|
23
|
-
import
|
|
23
|
+
import { Radio } from '@fluentui/react-radio';
|
|
24
24
|
import { RadioProps } from '@fluentui/react-radio';
|
|
25
25
|
import * as React_2 from 'react';
|
|
26
26
|
import { SelectionMode as SelectionMode_2 } from '@fluentui/react-utilities';
|
|
@@ -49,7 +49,7 @@ declare function dangerouslyCreateImmutableMap<Key, Value>(internalMap: Map<Key,
|
|
|
49
49
|
*/
|
|
50
50
|
declare function dangerouslyCreateImmutableSet<Value>(internalSet: Set<Value>): ImmutableSet<Value>;
|
|
51
51
|
|
|
52
|
-
declare type FlattenedTreeItem<Props extends TreeItemProps> =
|
|
52
|
+
declare type FlattenedTreeItem<Props extends TreeItemProps> = HeadlessFlatTreeItemProps & Props;
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Converts a nested structure to a flat one which can be consumed by `useFlatTreeItems`
|
|
@@ -91,7 +91,84 @@ declare type FlattenedTreeItem<Props extends TreeItemProps> = FlatTreeItemProps
|
|
|
91
91
|
* ]);
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
export declare const flattenTree_unstable: <Props extends TreeItemProps>(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
|
+
* FlatTree component - TODO: add more docs
|
|
103
|
+
*/
|
|
104
|
+
export declare const FlatTree: ForwardRefComponent<FlatTreeProps>;
|
|
105
|
+
|
|
106
|
+
export declare const flatTreeClassNames: SlotClassNames<TreeSlots>;
|
|
107
|
+
|
|
108
|
+
export declare type FlatTreeProps = ComponentProps<TreeSlots> & {
|
|
109
|
+
/**
|
|
110
|
+
* A tree item can have various appearances:
|
|
111
|
+
* - 'subtle' (default): The default tree item styles.
|
|
112
|
+
* - 'subtle-alpha': Minimizes emphasis on hovered or focused states.
|
|
113
|
+
* - 'transparent': Removes background color.
|
|
114
|
+
* @default 'subtle'
|
|
115
|
+
*/
|
|
116
|
+
appearance?: 'subtle' | 'subtle-alpha' | 'transparent';
|
|
117
|
+
/**
|
|
118
|
+
* Size of the tree item.
|
|
119
|
+
* @default 'medium'
|
|
120
|
+
*/
|
|
121
|
+
size?: 'small' | 'medium';
|
|
122
|
+
/**
|
|
123
|
+
* This refers to a list of ids of opened tree items.
|
|
124
|
+
* Controls the state of the open tree items.
|
|
125
|
+
* These property is ignored for subtrees.
|
|
126
|
+
*/
|
|
127
|
+
openItems?: Iterable<TreeItemValue>;
|
|
128
|
+
/**
|
|
129
|
+
* Callback fired when the component changes value from open state.
|
|
130
|
+
* These property is ignored for subtrees.
|
|
131
|
+
*
|
|
132
|
+
* @param event - a React's Synthetic event
|
|
133
|
+
* @param data - A data object with relevant information,
|
|
134
|
+
* such as open value and type of interaction that created the event.
|
|
135
|
+
*/
|
|
136
|
+
onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData): void;
|
|
137
|
+
/**
|
|
138
|
+
* Callback fired when navigation happens inside the component.
|
|
139
|
+
* These property is ignored for subtrees.
|
|
140
|
+
*
|
|
141
|
+
* FIXME: This method is not ideal, as navigation should be handled internally by tabster.
|
|
142
|
+
*
|
|
143
|
+
* @param event - a React's Synthetic event
|
|
144
|
+
* @param data - A data object with relevant information,
|
|
145
|
+
*/
|
|
146
|
+
onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;
|
|
147
|
+
/**
|
|
148
|
+
* This refers to the selection mode of the tree.
|
|
149
|
+
* - undefined: No selection can be done.
|
|
150
|
+
* - 'single': Only one tree item can be selected, radio buttons are rendered.
|
|
151
|
+
* - 'multiselect': Multiple tree items can be selected, checkboxes are rendered.
|
|
152
|
+
*
|
|
153
|
+
* @default undefined
|
|
154
|
+
*/
|
|
155
|
+
selectionMode?: SelectionMode_2;
|
|
156
|
+
/**
|
|
157
|
+
* This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.
|
|
158
|
+
* Controls the state of the checked tree items.
|
|
159
|
+
* These property is ignored for subtrees.
|
|
160
|
+
*/
|
|
161
|
+
checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;
|
|
162
|
+
/**
|
|
163
|
+
* Callback fired when the component changes value from checked state.
|
|
164
|
+
* These property is ignored for subtrees.
|
|
165
|
+
*
|
|
166
|
+
* @param event - a React's Synthetic event
|
|
167
|
+
* @param data - A data object with relevant information,
|
|
168
|
+
* such as checked value and type of interaction that created the event.
|
|
169
|
+
*/
|
|
170
|
+
onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;
|
|
171
|
+
};
|
|
95
172
|
|
|
96
173
|
/**
|
|
97
174
|
* FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -103,13 +180,16 @@ export declare const flattenTree_unstable: <Props extends TreeItemProps>(items:
|
|
|
103
180
|
*
|
|
104
181
|
* On simple scenarios it is advised to simply use a nested structure instead.
|
|
105
182
|
*/
|
|
106
|
-
export declare type
|
|
183
|
+
export declare type HeadlessFlatTree<Props extends HeadlessFlatTreeItemProps> = {
|
|
107
184
|
/**
|
|
108
185
|
* returns the properties required for the Tree component to work properly.
|
|
109
186
|
* That includes:
|
|
110
187
|
* `openItems`, `onOpenChange`, `onNavigation_unstable` and `ref`
|
|
111
188
|
*/
|
|
112
|
-
getTreeProps(): FlatTreeProps
|
|
189
|
+
getTreeProps(): Required<Pick<FlatTreeProps, 'openItems' | 'onOpenChange' | 'onNavigation_unstable' | 'checkedItems' | 'onCheckedChange'>> & {
|
|
190
|
+
ref: React_2.Ref<HTMLDivElement>;
|
|
191
|
+
openItems: ImmutableSet<TreeItemValue>;
|
|
192
|
+
};
|
|
113
193
|
/**
|
|
114
194
|
* internal method used to react to an `onNavigation` event.
|
|
115
195
|
* This method ensures proper navigation on keyboard and mouse interaction.
|
|
@@ -141,42 +221,42 @@ export declare type FlatTree<Props extends FlatTreeItemProps = FlatTreeItemProps
|
|
|
141
221
|
*
|
|
142
222
|
* On the case of TypeAhead navigation this method returns the current item.
|
|
143
223
|
*/
|
|
144
|
-
getNextNavigableItem(visibleItems:
|
|
224
|
+
getNextNavigableItem(visibleItems: HeadlessTreeItem<Props>[], data: TreeNavigationData_unstable): HeadlessTreeItem<Props> | undefined;
|
|
145
225
|
/**
|
|
146
226
|
* similar to getElementById but for FlatTreeItems
|
|
147
227
|
*/
|
|
148
|
-
getElementFromItem(item:
|
|
228
|
+
getElementFromItem(item: HeadlessTreeItem<Props>): HTMLElement | null;
|
|
149
229
|
/**
|
|
150
230
|
* an iterable containing all visually available flat tree items
|
|
151
231
|
*/
|
|
152
|
-
items(): IterableIterator<
|
|
232
|
+
items(): IterableIterator<HeadlessTreeItem<Props>>;
|
|
153
233
|
};
|
|
154
234
|
|
|
235
|
+
export declare type HeadlessFlatTreeItem<Props extends HeadlessFlatTreeItemProps> = HeadlessTreeItem<Props>;
|
|
236
|
+
|
|
237
|
+
export declare type HeadlessFlatTreeItemProps = HeadlessTreeItemProps;
|
|
238
|
+
|
|
239
|
+
export declare type HeadlessFlatTreeOptions = Pick<FlatTreeProps, 'onOpenChange' | 'onNavigation_unstable' | 'selectionMode' | 'onCheckedChange'> & Pick<TreeProps, 'defaultOpenItems' | 'openItems' | 'checkedItems' | 'defaultChecked'>;
|
|
240
|
+
|
|
155
241
|
/**
|
|
156
|
-
* The item that is returned by `
|
|
157
|
-
* `
|
|
242
|
+
* The item that is returned by `createHeadlessTree`, it represents a wrapper around the properties provided to
|
|
243
|
+
* `createHeadlessTree` but with extra information that might be useful on virtual tree scenarios
|
|
158
244
|
*/
|
|
159
|
-
|
|
245
|
+
declare type HeadlessTreeItem<Props extends HeadlessTreeItemProps> = {
|
|
160
246
|
index: number;
|
|
161
247
|
level: number;
|
|
162
248
|
childrenValues: TreeItemValue[];
|
|
163
249
|
value: TreeItemValue;
|
|
164
250
|
parentValue: TreeItemValue | undefined;
|
|
165
|
-
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Omit<Props, '
|
|
251
|
+
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Omit<Props, 'parentValue'>;
|
|
166
252
|
};
|
|
167
253
|
|
|
168
|
-
|
|
254
|
+
declare type HeadlessTreeItemProps = Omit<TreeItemProps, 'itemType' | 'value'> & {
|
|
169
255
|
value: TreeItemValue;
|
|
256
|
+
itemType?: TreeItemType;
|
|
170
257
|
parentValue?: TreeItemValue;
|
|
171
258
|
};
|
|
172
259
|
|
|
173
|
-
declare type FlatTreeOptions = Pick<TreeProps, 'openItems' | 'defaultOpenItems' | 'onOpenChange' | 'onNavigation_unstable' | 'selectionMode' | 'checkedItems' | 'defaultCheckedItems' | 'onCheckedChange'>;
|
|
174
|
-
|
|
175
|
-
export declare type FlatTreeProps = Required<Pick<TreeProps, 'openItems' | 'onOpenChange' | 'onNavigation_unstable' | 'checkedItems' | 'onCheckedChange'>> & {
|
|
176
|
-
ref: React_2.Ref<HTMLDivElement>;
|
|
177
|
-
openItems: ImmutableSet<TreeItemValue>;
|
|
178
|
-
};
|
|
179
|
-
|
|
180
260
|
declare interface ImmutableMap<Key, Value> {
|
|
181
261
|
clear(): ImmutableMap<Key, Value>;
|
|
182
262
|
delete(key: Key): ImmutableMap<Key, Value>;
|
|
@@ -210,6 +290,7 @@ declare interface ImmutableMap<Key, Value> {
|
|
|
210
290
|
declare const ImmutableMap: {
|
|
211
291
|
empty: ImmutableMap<never, never>;
|
|
212
292
|
create: typeof createImmutableMap;
|
|
293
|
+
isImmutableMap: typeof isImmutableMap;
|
|
213
294
|
dangerouslyCreate_unstable: typeof dangerouslyCreateImmutableMap;
|
|
214
295
|
};
|
|
215
296
|
|
|
@@ -248,19 +329,21 @@ declare interface ImmutableSet<Value> {
|
|
|
248
329
|
declare const ImmutableSet: {
|
|
249
330
|
empty: ImmutableSet<never>;
|
|
250
331
|
create: typeof createImmutableSet;
|
|
332
|
+
isImmutableSet: typeof isImmutableSet;
|
|
251
333
|
dangerouslyCreate_unstable: typeof dangerouslyCreateImmutableSet;
|
|
252
334
|
};
|
|
253
335
|
|
|
254
|
-
declare
|
|
336
|
+
declare function isImmutableMap<Key, Value>(value: unknown): value is ImmutableMap<Key, Value>;
|
|
255
337
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
};
|
|
338
|
+
declare function isImmutableSet<Value>(value: unknown): value is ImmutableSet<Value>;
|
|
339
|
+
|
|
340
|
+
declare type MultiSelectValue = NonNullable<CheckboxProps['checked']>;
|
|
260
341
|
|
|
261
342
|
declare type OmitWithoutExpanding<P, K extends string | number | symbol> = P extends unknown ? Omit<P, K> : P;
|
|
262
343
|
|
|
263
|
-
|
|
344
|
+
declare const renderTree_unstable: (state: TreeState, contextValues: TreeContextValues) => JSX.Element;
|
|
345
|
+
export { renderTree_unstable as renderFlatTree_unstable }
|
|
346
|
+
export { renderTree_unstable }
|
|
264
347
|
|
|
265
348
|
/**
|
|
266
349
|
* Render the final JSX of TreeItem
|
|
@@ -280,12 +363,7 @@ export declare const renderTreeItemPersonaLayout_unstable: (state: TreeItemPerso
|
|
|
280
363
|
declare type SingleSelectValue = NonNullable<RadioProps['checked']>;
|
|
281
364
|
|
|
282
365
|
/**
|
|
283
|
-
*
|
|
284
|
-
* Any item in the hierarchy may have child items,
|
|
285
|
-
* and items that have children may be expanded or collapsed to show or hide the children.
|
|
286
|
-
* For example, in a file system navigator that uses a tree view to display folders and files,
|
|
287
|
-
* an item representing a folder can be expanded to reveal the contents of the folder,
|
|
288
|
-
* which may be files, folders, or both.
|
|
366
|
+
* Tree component - TODO: add more docs
|
|
289
367
|
*/
|
|
290
368
|
export declare const Tree: ForwardRefComponent<TreeProps>;
|
|
291
369
|
|
|
@@ -319,7 +397,7 @@ export declare type TreeContextValue = {
|
|
|
319
397
|
requestTreeResponse(request: TreeItemRequest): void;
|
|
320
398
|
};
|
|
321
399
|
|
|
322
|
-
declare type TreeContextValues = {
|
|
400
|
+
export declare type TreeContextValues = {
|
|
323
401
|
tree: TreeContextValue;
|
|
324
402
|
};
|
|
325
403
|
|
|
@@ -337,27 +415,29 @@ declare type TreeContextValues = {
|
|
|
337
415
|
*/
|
|
338
416
|
export declare const TreeItem: ForwardRefComponent<TreeItemProps>;
|
|
339
417
|
|
|
340
|
-
export declare const treeItemClassNames: SlotClassNames<
|
|
418
|
+
export declare const treeItemClassNames: SlotClassNames<TreeItemSlots>;
|
|
341
419
|
|
|
342
|
-
declare type TreeItemContextValue = {
|
|
420
|
+
export declare type TreeItemContextValue = {
|
|
421
|
+
isActionsVisible: boolean;
|
|
422
|
+
isAsideVisible: boolean;
|
|
423
|
+
selectionRef: React_2.Ref<HTMLInputElement>;
|
|
424
|
+
actionsRef: React_2.Ref<HTMLDivElement>;
|
|
425
|
+
expandIconRef: React_2.Ref<HTMLDivElement>;
|
|
343
426
|
layoutRef: React_2.Ref<HTMLDivElement>;
|
|
344
427
|
subtreeRef: React_2.Ref<HTMLDivElement>;
|
|
345
428
|
itemType: TreeItemType;
|
|
346
|
-
value:
|
|
429
|
+
value: TreeItemValue;
|
|
347
430
|
open: boolean;
|
|
348
431
|
};
|
|
349
432
|
|
|
350
433
|
declare type TreeItemContextValues = {
|
|
351
434
|
treeItem: TreeItemContextValue;
|
|
352
|
-
treeItemSlots: TreeItemSlotsContextValue;
|
|
353
435
|
};
|
|
354
436
|
|
|
355
437
|
declare type TreeItemCSSProperties = React_2.CSSProperties & {
|
|
356
438
|
[treeItemLevelToken]?: string | number;
|
|
357
439
|
};
|
|
358
440
|
|
|
359
|
-
declare type TreeItemInternalSlot = Pick<TreeItemSlots, 'root'>;
|
|
360
|
-
|
|
361
441
|
/**
|
|
362
442
|
* The `TreeItemLayout` component is used as a child of `TreeItem` to define the content and layout of a tree item.
|
|
363
443
|
* It provides a consistent visual structure for tree items in a `Tree` component.
|
|
@@ -365,9 +445,7 @@ declare type TreeItemInternalSlot = Pick<TreeItemSlots, 'root'>;
|
|
|
365
445
|
*/
|
|
366
446
|
export declare const TreeItemLayout: ForwardRefComponent<TreeItemLayoutProps>;
|
|
367
447
|
|
|
368
|
-
export declare const treeItemLayoutClassNames: SlotClassNames<
|
|
369
|
-
|
|
370
|
-
declare type TreeItemLayoutInternalSlots = TreeItemLayoutSlots & TreeItemSlotsContextValue;
|
|
448
|
+
export declare const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutSlots>;
|
|
371
449
|
|
|
372
450
|
/**
|
|
373
451
|
* TreeItemLayout Props
|
|
@@ -388,12 +466,29 @@ export declare type TreeItemLayoutSlots = {
|
|
|
388
466
|
* Icon slot that renders right after main content
|
|
389
467
|
*/
|
|
390
468
|
iconAfter?: Slot<'div'>;
|
|
469
|
+
/**
|
|
470
|
+
* Expand icon slot,
|
|
471
|
+
* by default renders a chevron icon to indicate opening and closing
|
|
472
|
+
*/
|
|
473
|
+
expandIcon?: Slot<'div'>;
|
|
474
|
+
aside?: Slot<'div'>;
|
|
475
|
+
/**
|
|
476
|
+
* actionable elements are normally buttons, menus, or other focusable elements.
|
|
477
|
+
* Those elements are only visibly available if the given tree item is currently active.
|
|
478
|
+
*/
|
|
479
|
+
actions?: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
480
|
+
/**
|
|
481
|
+
* Forces visibility of the aside/action content
|
|
482
|
+
*/
|
|
483
|
+
visible?: boolean;
|
|
484
|
+
}>>;
|
|
485
|
+
selector?: Slot<typeof Checkbox> | Slot<typeof Radio>;
|
|
391
486
|
};
|
|
392
487
|
|
|
393
488
|
/**
|
|
394
489
|
* State used in rendering TreeItemLayout
|
|
395
490
|
*/
|
|
396
|
-
export declare type TreeItemLayoutState = ComponentState<
|
|
491
|
+
export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots> & {
|
|
397
492
|
buttonContextValue: ButtonContextValue;
|
|
398
493
|
};
|
|
399
494
|
|
|
@@ -406,20 +501,18 @@ export declare const treeItemLevelToken: "--fluent-TreeItem--level";
|
|
|
406
501
|
*/
|
|
407
502
|
export declare const TreeItemPersonaLayout: ForwardRefComponent<TreeItemPersonaLayoutProps>;
|
|
408
503
|
|
|
409
|
-
export declare const treeItemPersonaLayoutClassNames: SlotClassNames<
|
|
504
|
+
export declare const treeItemPersonaLayoutClassNames: SlotClassNames<TreeItemPersonaLayoutSlots>;
|
|
410
505
|
|
|
411
506
|
declare type TreeItemPersonaLayoutContextValues = {
|
|
412
507
|
avatar: AvatarContextValue;
|
|
413
508
|
};
|
|
414
509
|
|
|
415
|
-
declare type TreeItemPersonaLayoutInternalSlots = TreeItemPersonaLayoutSlots & Pick<TreeItemSlots, 'actions' | 'aside' | 'expandIcon'>;
|
|
416
|
-
|
|
417
510
|
/**
|
|
418
511
|
* TreeItemPersonaLayout Props
|
|
419
512
|
*/
|
|
420
513
|
export declare type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;
|
|
421
514
|
|
|
422
|
-
export declare type TreeItemPersonaLayoutSlots = {
|
|
515
|
+
export declare type TreeItemPersonaLayoutSlots = Pick<TreeItemLayoutSlots, 'actions' | 'aside' | 'expandIcon' | 'selector'> & {
|
|
423
516
|
root: NonNullable<Slot<'div'>>;
|
|
424
517
|
/**
|
|
425
518
|
* Avatar to display.
|
|
@@ -438,7 +531,7 @@ export declare type TreeItemPersonaLayoutSlots = {
|
|
|
438
531
|
/**
|
|
439
532
|
* State used in rendering TreeItemPersonaLayout
|
|
440
533
|
*/
|
|
441
|
-
export declare type TreeItemPersonaLayoutState = ComponentState<
|
|
534
|
+
export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> & {
|
|
442
535
|
avatarSize: AvatarSize;
|
|
443
536
|
buttonContextValue: ButtonContextValue;
|
|
444
537
|
};
|
|
@@ -461,40 +554,12 @@ export declare type TreeItemSlots = {
|
|
|
461
554
|
root: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
462
555
|
style?: TreeItemCSSProperties;
|
|
463
556
|
}>>;
|
|
464
|
-
/**
|
|
465
|
-
* Expand icon slot,
|
|
466
|
-
* by default renders a chevron icon to indicate opening and closing
|
|
467
|
-
*/
|
|
468
|
-
expandIcon?: Slot<'div'>;
|
|
469
|
-
aside?: Slot<'div'>;
|
|
470
|
-
/**
|
|
471
|
-
* actionable elements are normally buttons, menus, or other focusable elements.
|
|
472
|
-
* Those elements are only visibly available if the given tree item is currently active.
|
|
473
|
-
*/
|
|
474
|
-
actions?: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
475
|
-
/**
|
|
476
|
-
* Forces visibility of the aside/action content
|
|
477
|
-
*/
|
|
478
|
-
visible?: boolean;
|
|
479
|
-
}>>;
|
|
480
|
-
/**
|
|
481
|
-
* Selection indicator if selection type is checkbox
|
|
482
|
-
*/
|
|
483
|
-
checkboxIndicator?: Slot<typeof Checkbox>;
|
|
484
|
-
/**
|
|
485
|
-
* Selection indicator if selection type is radio
|
|
486
|
-
*/
|
|
487
|
-
radioIndicator?: Slot<typeof Radio>;
|
|
488
|
-
};
|
|
489
|
-
|
|
490
|
-
declare type TreeItemSlotsContextValue = Pick<TreeItemSlots, 'actions' | 'aside' | 'expandIcon'> & {
|
|
491
|
-
selector?: Slot<typeof Checkbox> | Slot<typeof Radio>;
|
|
492
557
|
};
|
|
493
558
|
|
|
494
559
|
/**
|
|
495
560
|
* State used in rendering TreeItem
|
|
496
561
|
*/
|
|
497
|
-
export declare type TreeItemState = ComponentState<
|
|
562
|
+
export declare type TreeItemState = ComponentState<TreeItemSlots> & TreeItemContextValue & {
|
|
498
563
|
level: number;
|
|
499
564
|
itemType: TreeItemType;
|
|
500
565
|
};
|
|
@@ -578,9 +643,8 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
578
643
|
*/
|
|
579
644
|
openItems?: Iterable<TreeItemValue>;
|
|
580
645
|
/**
|
|
581
|
-
* This refers to a list of ids of opened
|
|
582
|
-
*
|
|
583
|
-
* These property is ignored for subtrees.
|
|
646
|
+
* This refers to a list of ids of default opened items.
|
|
647
|
+
* This property is ignored for subtrees.
|
|
584
648
|
*/
|
|
585
649
|
defaultOpenItems?: Iterable<TreeItemValue>;
|
|
586
650
|
/**
|
|
@@ -618,8 +682,7 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
618
682
|
*/
|
|
619
683
|
checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;
|
|
620
684
|
/**
|
|
621
|
-
* This refers to a list of ids of checked
|
|
622
|
-
* Default value for the uncontrolled state of checked tree items.
|
|
685
|
+
* This refers to a list of ids of default checked items, or a list of tuples of ids and checked state.
|
|
623
686
|
* These property is ignored for subtrees.
|
|
624
687
|
*/
|
|
625
688
|
defaultCheckedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;
|
|
@@ -638,16 +701,24 @@ export declare const TreeProvider: Provider<TreeContextValue | undefined> & FC<P
|
|
|
638
701
|
|
|
639
702
|
export declare type TreeSelectionValue = MultiSelectValue | SingleSelectValue;
|
|
640
703
|
|
|
641
|
-
|
|
704
|
+
declare type TreeSlots = {
|
|
642
705
|
root: Slot<'div'>;
|
|
643
706
|
};
|
|
707
|
+
export { TreeSlots as FlatTreeSlots }
|
|
708
|
+
export { TreeSlots }
|
|
644
709
|
|
|
645
710
|
/**
|
|
646
711
|
* State used in rendering Tree
|
|
647
712
|
*/
|
|
648
|
-
|
|
713
|
+
declare type TreeState = ComponentState<TreeSlots> & TreeContextValue & {
|
|
649
714
|
open: boolean;
|
|
650
715
|
};
|
|
716
|
+
export { TreeState as FlatTreeState }
|
|
717
|
+
export { TreeState }
|
|
718
|
+
|
|
719
|
+
export declare const useFlatTree_unstable: (props: FlatTreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
720
|
+
|
|
721
|
+
export declare const useFlatTreeStyles_unstable: (state: TreeState) => TreeState;
|
|
651
722
|
|
|
652
723
|
/**
|
|
653
724
|
* this hook provides FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -661,22 +732,15 @@ export declare type TreeState = ComponentState<TreeSlots> & TreeContextValue & {
|
|
|
661
732
|
* @param flatTreeItemProps - a list of tree items
|
|
662
733
|
* @param options - in case control over the internal openItems is required
|
|
663
734
|
*/
|
|
664
|
-
export declare function
|
|
735
|
+
export declare function useHeadlessFlatTree_unstable<Props extends HeadlessTreeItemProps>(flatTreeItemProps: Props[], options?: HeadlessFlatTreeOptions): HeadlessFlatTree<Props>;
|
|
665
736
|
|
|
666
|
-
/**
|
|
667
|
-
* Create the state required to render Tree.
|
|
668
|
-
*
|
|
669
|
-
* The returned state can be modified with hooks such as useTreeStyles_unstable,
|
|
670
|
-
* before being passed to renderTree_unstable.
|
|
671
|
-
*
|
|
672
|
-
* @param props - props from this instance of Tree
|
|
673
|
-
* @param ref - reference to root HTMLElement of Tree
|
|
674
|
-
*/
|
|
675
737
|
export declare const useTree_unstable: (props: TreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
676
738
|
|
|
677
739
|
export declare const useTreeContext_unstable: <T>(selector: ContextSelector<TreeContextValue, T>) => T;
|
|
678
740
|
|
|
679
|
-
|
|
741
|
+
declare function useTreeContextValues_unstable(state: TreeState): TreeContextValues;
|
|
742
|
+
export { useTreeContextValues_unstable as useFlatTreeContextValues_unstable }
|
|
743
|
+
export { useTreeContextValues_unstable }
|
|
680
744
|
|
|
681
745
|
/**
|
|
682
746
|
* Create the state required to render TreeItem.
|
package/lib/FlatTree.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/FlatTree/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FlatTree.ts"],"sourcesContent":["export * from './components/FlatTree/index';\n"],"names":[],"mappings":"AAAA,cAAc,8BAA8B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useTreeContextValues_unstable as useFlatTreeContextValues_unstable, renderTree_unstable as renderFlatTree_unstable } from '../Tree/index';
|
|
3
|
+
import { useFlatTree_unstable } from './useFlatTree';
|
|
4
|
+
import { useFlatTreeStyles_unstable } from './useFlatTreeStyles.styles';
|
|
5
|
+
/**
|
|
6
|
+
* FlatTree component - TODO: add more docs
|
|
7
|
+
*/ export const FlatTree = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
8
|
+
const state = useFlatTree_unstable(props, ref);
|
|
9
|
+
const contextValues = useFlatTreeContextValues_unstable(state);
|
|
10
|
+
useFlatTreeStyles_unstable(state);
|
|
11
|
+
return renderFlatTree_unstable(state, contextValues);
|
|
12
|
+
});
|
|
13
|
+
FlatTree.displayName = 'FlatTree';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FlatTree.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FlatTreeProps } from './FlatTree.types';\nimport {\n useTreeContextValues_unstable as useFlatTreeContextValues_unstable,\n renderTree_unstable as renderFlatTree_unstable,\n} from '../Tree/index';\nimport { useFlatTree_unstable } from './useFlatTree';\nimport { useFlatTreeStyles_unstable } from './useFlatTreeStyles.styles';\n\n/**\n * FlatTree component - TODO: add more docs\n */\nexport const FlatTree: ForwardRefComponent<FlatTreeProps> = React.forwardRef((props, ref) => {\n const state = useFlatTree_unstable(props, ref);\n const contextValues = useFlatTreeContextValues_unstable(state);\n useFlatTreeStyles_unstable(state);\n return renderFlatTree_unstable(state, contextValues);\n});\n\nFlatTree.displayName = 'FlatTree';\n"],"names":["React","useTreeContextValues_unstable","useFlatTreeContextValues_unstable","renderTree_unstable","renderFlatTree_unstable","useFlatTree_unstable","useFlatTreeStyles_unstable","FlatTree","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,SACEC,iCAAiCC,iCAAiC,EAClEC,uBAAuBC,uBAAuB,QACzC,gBAAgB;AACvB,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,0BAA0B,QAAQ,6BAA6B;AAExE;;CAEC,GACD,OAAO,MAAMC,yBAA+CP,MAAMQ,UAAU,CAAC,CAACC,OAAOC,MAAQ;IAC3F,MAAMC,QAAQN,qBAAqBI,OAAOC;IAC1C,MAAME,gBAAgBV,kCAAkCS;IACxDL,2BAA2BK;IAC3B,OAAOP,wBAAwBO,OAAOC;AACxC,GAAG;AAEHL,SAASM,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FlatTree.types.ts"],"sourcesContent":["import type { ComponentProps, SelectionMode } from '@fluentui/react-utilities';\nimport type {\n TreeSlots,\n TreeState,\n TreeCheckedChangeData,\n TreeCheckedChangeEvent,\n TreeNavigationData_unstable,\n TreeNavigationEvent_unstable,\n TreeOpenChangeData,\n TreeOpenChangeEvent,\n TreeSelectionValue,\n} from '../Tree/index';\nimport type { TreeItemValue } from '../TreeItem/index';\n\nexport { TreeSlots as FlatTreeSlots, TreeState as FlatTreeState };\n\nexport type FlatTreeProps = ComponentProps<TreeSlots> & {\n /**\n * A tree item can have various appearances:\n * - 'subtle' (default): The default tree item styles.\n * - 'subtle-alpha': Minimizes emphasis on hovered or focused states.\n * - 'transparent': Removes background color.\n * @default 'subtle'\n */\n appearance?: 'subtle' | 'subtle-alpha' | 'transparent';\n /**\n * Size of the tree item.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n /**\n * This refers to a list of ids of opened tree items.\n * Controls the state of the open tree items.\n * These property is ignored for subtrees.\n */\n openItems?: Iterable<TreeItemValue>;\n /**\n * Callback fired when the component changes value from open state.\n * These property is ignored for subtrees.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n * such as open value and type of interaction that created the event.\n */\n onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData): void;\n\n /**\n * Callback fired when navigation happens inside the component.\n * These property is ignored for subtrees.\n *\n * FIXME: This method is not ideal, as navigation should be handled internally by tabster.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;\n\n /**\n * This refers to the selection mode of the tree.\n * - undefined: No selection can be done.\n * - 'single': Only one tree item can be selected, radio buttons are rendered.\n * - 'multiselect': Multiple tree items can be selected, checkboxes are rendered.\n *\n * @default undefined\n */\n selectionMode?: SelectionMode;\n /**\n * This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.\n * Controls the state of the checked tree items.\n * These property is ignored for subtrees.\n */\n checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;\n /**\n * Callback fired when the component changes value from checked state.\n * These property is ignored for subtrees.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n * such as checked value and type of interaction that created the event.\n */\n onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;\n};\n"],"names":[],"mappings":"AAAA,WAkFE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './FlatTree';
|
|
2
|
+
export * from './FlatTree.types';
|
|
3
|
+
export { renderTree_unstable as renderFlatTree_unstable, useTreeContextValues_unstable as useFlatTreeContextValues_unstable } from '../Tree/index';
|
|
4
|
+
export * from './useHeadlessFlatTree';
|
|
5
|
+
export * from './useFlatTree';
|
|
6
|
+
export * from './useFlatTreeStyles.styles';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './FlatTree';\nexport * from './FlatTree.types';\nexport {\n renderTree_unstable as renderFlatTree_unstable,\n useTreeContextValues_unstable as useFlatTreeContextValues_unstable,\n} from '../Tree/index';\nexport * from './useHeadlessFlatTree';\nexport * from './useFlatTree';\nexport * from './useFlatTreeStyles.styles';\n"],"names":["renderTree_unstable","renderFlatTree_unstable","useTreeContextValues_unstable","useFlatTreeContextValues_unstable"],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,mBAAmB;AACjC,SACEA,uBAAuBC,uBAAuB,EAC9CC,iCAAiCC,iCAAiC,QAC7D,gBAAgB;AACvB,cAAc,wBAAwB;AACtC,cAAc,gBAAgB;AAC9B,cAAc,6BAA6B"}
|