@fluentui/react-tree 9.0.0-beta.11 → 9.0.0-beta.13
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 +195 -1
- package/CHANGELOG.md +46 -2
- package/dist/index.d.ts +189 -100
- package/lib/TreeItemAside.js +2 -0
- package/lib/TreeItemAside.js.map +1 -0
- package/lib/components/Tree/Tree.js +1 -1
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/index.js +1 -1
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/Tree/renderTree.js +1 -1
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/components/Tree/useRootTree.js +160 -0
- package/lib/components/Tree/useRootTree.js.map +1 -0
- package/lib/components/Tree/useSubtree.js +40 -0
- package/lib/components/Tree/useSubtree.js.map +1 -0
- package/lib/components/Tree/useTree.js +2 -95
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js +2 -4
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/Tree/useTreeStyles.styles.js +30 -0
- package/lib/components/Tree/useTreeStyles.styles.js.map +1 -0
- package/lib/components/TreeItem/TreeItem.js +2 -2
- package/lib/components/TreeItem/TreeItem.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/index.js +1 -1
- package/lib/components/TreeItem/index.js.map +1 -1
- package/lib/components/TreeItem/renderTreeItem.js +2 -5
- package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +65 -175
- package/lib/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemContextValues.js +25 -11
- package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemStyles.styles.js +102 -0
- package/lib/components/TreeItem/useTreeItemStyles.styles.js.map +1 -0
- package/lib/components/TreeItemAside/TreeItemAside.js +15 -0
- package/lib/components/TreeItemAside/TreeItemAside.js.map +1 -0
- package/lib/components/TreeItemAside/TreeItemAside.types.js +2 -0
- package/lib/components/TreeItemAside/TreeItemAside.types.js.map +1 -0
- package/lib/components/TreeItemAside/index.js +6 -0
- package/lib/components/TreeItemAside/index.js.map +1 -0
- package/lib/components/TreeItemAside/renderTreeItemAside.js +19 -0
- package/lib/components/TreeItemAside/renderTreeItemAside.js.map +1 -0
- package/lib/components/TreeItemAside/useTreeItemAside.js +35 -0
- package/lib/components/TreeItemAside/useTreeItemAside.js.map +1 -0
- package/lib/components/TreeItemAside/useTreeItemAsideStyles.styles.js +47 -0
- package/lib/components/TreeItemAside/useTreeItemAsideStyles.styles.js.map +1 -0
- package/lib/components/TreeItemChevron.js +27 -0
- package/lib/components/TreeItemChevron.js.map +1 -0
- package/lib/components/TreeItemLayout/TreeItemLayout.js +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib/components/TreeItemLayout/index.js +1 -1
- package/lib/components/TreeItemLayout/index.js.map +1 -1
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js +1 -4
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +16 -11
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js +138 -0
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js.map +1 -0
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/index.js +1 -1
- package/lib/components/TreeItemPersonaLayout/index.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +2 -5
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +16 -20
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/{useTreeItemPersonaLayoutStyles.js → useTreeItemPersonaLayoutStyles.styles.js} +51 -30
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -0
- package/lib/contexts/treeContext.js +1 -2
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/contexts/treeItemContext.js +12 -4
- package/lib/contexts/treeItemContext.js.map +1 -1
- package/lib/hooks/useFlatTree.js +9 -9
- package/lib/hooks/useFlatTree.js.map +1 -1
- package/lib/hooks/useFlatTreeNavigation.js +15 -13
- package/lib/hooks/useFlatTreeNavigation.js.map +1 -1
- package/lib/hooks/useNestedTreeNavigation.js +9 -9
- package/lib/hooks/useNestedTreeNavigation.js.map +1 -1
- package/lib/hooks/useOpenItemsState.js +3 -4
- package/lib/hooks/useOpenItemsState.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/createFlatTreeItems.js +32 -21
- package/lib/utils/createFlatTreeItems.js.map +1 -1
- package/lib/utils/flattenTree.js +4 -29
- package/lib/utils/flattenTree.js.map +1 -1
- package/lib/utils/tokens.js +11 -11
- package/lib/utils/tokens.js.map +1 -1
- package/lib-commonjs/TreeItemAside.js +9 -0
- package/lib-commonjs/TreeItemAside.js.map +1 -0
- package/lib-commonjs/components/Tree/Tree.js +2 -2
- package/lib-commonjs/components/Tree/Tree.js.map +1 -1
- package/lib-commonjs/components/Tree/index.js +1 -1
- package/lib-commonjs/components/Tree/index.js.map +1 -1
- package/lib-commonjs/components/Tree/renderTree.js +1 -1
- package/lib-commonjs/components/Tree/renderTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useRootTree.js +151 -0
- package/lib-commonjs/components/Tree/useRootTree.js.map +1 -0
- package/lib-commonjs/components/Tree/useSubtree.js +41 -0
- package/lib-commonjs/components/Tree/useSubtree.js.map +1 -0
- package/lib-commonjs/components/Tree/useTree.js +4 -89
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.js +2 -3
- package/lib-commonjs/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib-commonjs/components/Tree/{useTreeStyles.js → useTreeStyles.styles.js} +21 -4
- package/lib-commonjs/components/Tree/useTreeStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TreeItem/TreeItem.js +2 -2
- package/lib-commonjs/components/TreeItem/TreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/index.js +1 -1
- package/lib-commonjs/components/TreeItem/index.js.map +1 -1
- package/lib-commonjs/components/TreeItem/renderTreeItem.js +2 -5
- package/lib-commonjs/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js +60 -165
- package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js +16 -15
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.js +208 -0
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TreeItemAside/TreeItemAside.js +21 -0
- package/lib-commonjs/components/TreeItemAside/TreeItemAside.js.map +1 -0
- package/lib-commonjs/components/TreeItemAside/TreeItemAside.types.js +7 -0
- package/lib-commonjs/components/TreeItemAside/TreeItemAside.types.js.map +1 -0
- package/lib-commonjs/components/TreeItemAside/index.js +13 -0
- package/lib-commonjs/components/TreeItemAside/index.js.map +1 -0
- package/lib-commonjs/components/TreeItemAside/renderTreeItemAside.js +22 -0
- package/lib-commonjs/components/TreeItemAside/renderTreeItemAside.js.map +1 -0
- package/lib-commonjs/components/TreeItemAside/useTreeItemAside.js +33 -0
- package/lib-commonjs/components/TreeItemAside/useTreeItemAside.js.map +1 -0
- package/lib-commonjs/components/TreeItemAside/useTreeItemAsideStyles.styles.js +92 -0
- package/lib-commonjs/components/TreeItemAside/useTreeItemAsideStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TreeItemChevron.js +35 -0
- package/lib-commonjs/components/TreeItemChevron.js.map +1 -0
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.js +2 -2
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/index.js +1 -1
- package/lib-commonjs/components/TreeItemLayout/index.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js +1 -2
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +14 -9
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js +223 -0
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js +2 -2
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/index.js +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/index.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +2 -3
- package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +14 -14
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/{useTreeItemPersonaLayoutStyles.js → useTreeItemPersonaLayoutStyles.styles.js} +91 -45
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -0
- package/lib-commonjs/contexts/treeContext.js +1 -2
- package/lib-commonjs/contexts/treeContext.js.map +1 -1
- package/lib-commonjs/contexts/treeItemContext.js +12 -4
- package/lib-commonjs/contexts/treeItemContext.js.map +1 -1
- package/lib-commonjs/hooks/useFlatTree.js +9 -9
- package/lib-commonjs/hooks/useFlatTree.js.map +1 -1
- package/lib-commonjs/hooks/useFlatTreeNavigation.js +15 -13
- package/lib-commonjs/hooks/useFlatTreeNavigation.js.map +1 -1
- package/lib-commonjs/hooks/useNestedTreeNavigation.js +9 -9
- package/lib-commonjs/hooks/useNestedTreeNavigation.js.map +1 -1
- package/lib-commonjs/hooks/useOpenItemsState.js +3 -6
- package/lib-commonjs/hooks/useOpenItemsState.js.map +1 -1
- package/lib-commonjs/index.js +6 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/createFlatTreeItems.js +33 -25
- package/lib-commonjs/utils/createFlatTreeItems.js.map +1 -1
- package/lib-commonjs/utils/flattenTree.js +8 -37
- package/lib-commonjs/utils/flattenTree.js.map +1 -1
- package/lib-commonjs/utils/tokens.js +10 -10
- package/lib-commonjs/utils/tokens.js.map +1 -1
- package/package.json +15 -14
- package/.swcrc +0 -30
- package/lib/components/Tree/useTreeStyles.js +0 -20
- 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.map +0 -1
- package/lib-commonjs/components/Tree/useTreeStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.js +0 -375
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.js +0 -143
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.js.map +0 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ArrowRight } from '@fluentui/keyboard-keys';
|
|
|
6
6
|
import { 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
10
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
11
11
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
12
12
|
import { ContextSelector } from '@fluentui/react-context-selector';
|
|
@@ -21,6 +21,9 @@ import { ProviderProps } from 'react';
|
|
|
21
21
|
import * as React_2 from 'react';
|
|
22
22
|
import type { Slot } from '@fluentui/react-utilities';
|
|
23
23
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
24
|
+
import { SlotRenderFunction } from '@fluentui/react-utilities';
|
|
25
|
+
|
|
26
|
+
declare type FlattenedTreeItem<Props extends TreeItemProps<unknown>> = FlatTreeItemProps<NonNullable<Props['value']>> & Props;
|
|
24
27
|
|
|
25
28
|
/**
|
|
26
29
|
* Converts a nested structure to a flat one which can be consumed by `useFlatTreeItems`
|
|
@@ -62,7 +65,7 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
|
62
65
|
* ]);
|
|
63
66
|
* ```
|
|
64
67
|
*/
|
|
65
|
-
export declare const flattenTree_unstable: (items: NestedTreeItem[]) =>
|
|
68
|
+
export declare const flattenTree_unstable: <Props extends TreeItemProps<unknown>>(items: NestedTreeItem<Props>[]) => FlattenedTreeItem<Props>[];
|
|
66
69
|
|
|
67
70
|
/**
|
|
68
71
|
* FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -74,13 +77,13 @@ export declare const flattenTree_unstable: (items: NestedTreeItem[]) => FlatTree
|
|
|
74
77
|
*
|
|
75
78
|
* On simple scenarios it is advised to simply use a nested structure instead.
|
|
76
79
|
*/
|
|
77
|
-
export declare type FlatTree = {
|
|
80
|
+
export declare type FlatTree<Props extends FlatTreeItemProps<unknown> = FlatTreeItemProps> = {
|
|
78
81
|
/**
|
|
79
82
|
* returns the properties required for the Tree component to work properly.
|
|
80
83
|
* That includes:
|
|
81
84
|
* `openItems`, `onOpenChange`, `onNavigation_unstable` and `ref`
|
|
82
85
|
*/
|
|
83
|
-
getTreeProps(): FlatTreeProps
|
|
86
|
+
getTreeProps(): FlatTreeProps<Props['value']>;
|
|
84
87
|
/**
|
|
85
88
|
* internal method used to react to an `onNavigation` event.
|
|
86
89
|
* This method ensures proper navigation on keyboard and mouse interaction.
|
|
@@ -104,7 +107,7 @@ export declare type FlatTree = {
|
|
|
104
107
|
* };
|
|
105
108
|
*```
|
|
106
109
|
*/
|
|
107
|
-
navigate(data: TreeNavigationData_unstable): void;
|
|
110
|
+
navigate(data: TreeNavigationData_unstable<Props['value']>): void;
|
|
108
111
|
/**
|
|
109
112
|
* returns next item to be focused on a navigation.
|
|
110
113
|
* This method is provided to decouple the element that needs to be focused from
|
|
@@ -112,23 +115,43 @@ export declare type FlatTree = {
|
|
|
112
115
|
*
|
|
113
116
|
* On the case of TypeAhead navigation this method returns the current item.
|
|
114
117
|
*/
|
|
115
|
-
getNextNavigableItem(visibleItems: FlatTreeItem[], data: TreeNavigationData_unstable): FlatTreeItem | undefined;
|
|
118
|
+
getNextNavigableItem(visibleItems: FlatTreeItem<Props>[], data: TreeNavigationData_unstable<Props['value']>): FlatTreeItem<Props> | undefined;
|
|
116
119
|
/**
|
|
117
120
|
* an iterable containing all visually available flat tree items
|
|
118
121
|
*/
|
|
119
|
-
items(): IterableIterator<FlatTreeItem
|
|
122
|
+
items(): IterableIterator<FlatTreeItem<Props>>;
|
|
120
123
|
};
|
|
121
124
|
|
|
122
|
-
|
|
125
|
+
/**
|
|
126
|
+
* The item that is returned by `useFlatTree`, it represents a wrapper around the properties provided to
|
|
127
|
+
* `useFlatTree` but with extra information that might be useful on flat tree scenarios
|
|
128
|
+
*/
|
|
129
|
+
export declare type FlatTreeItem<Props extends FlatTreeItemProps<unknown> = FlatTreeItemProps> = {
|
|
130
|
+
index: number;
|
|
131
|
+
level: number;
|
|
132
|
+
childrenSize: number;
|
|
133
|
+
value: Props['value'];
|
|
134
|
+
parentValue: Props['parentValue'];
|
|
135
|
+
/**
|
|
136
|
+
* A reference to the element that will render the `TreeItem`,
|
|
137
|
+
* this is necessary for nodes with parents (to ensure child to parent navigation),
|
|
138
|
+
* if a node has no parent then this reference will be null.
|
|
139
|
+
*/
|
|
140
|
+
ref: React_2.RefObject<HTMLDivElement>;
|
|
141
|
+
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Omit<Props, 'parentValue'>;
|
|
142
|
+
};
|
|
123
143
|
|
|
124
|
-
export declare type FlatTreeItemProps = TreeItemProps & {
|
|
125
|
-
|
|
126
|
-
|
|
144
|
+
export declare type FlatTreeItemProps<Value = string> = Omit<TreeItemProps<Value>, 'itemType'> & Partial<Pick<TreeItemProps<Value>, 'itemType'>> & {
|
|
145
|
+
value: Value;
|
|
146
|
+
parentValue?: Value;
|
|
127
147
|
};
|
|
128
148
|
|
|
129
|
-
|
|
149
|
+
declare type FlatTreeOptions<Props extends FlatTreeItemProps<unknown> = FlatTreeItemProps> = Pick<TreeProps<Props['value']>, 'openItems' | 'defaultOpenItems' | 'onOpenChange' | 'onNavigation_unstable'>;
|
|
150
|
+
|
|
151
|
+
export declare type FlatTreeProps<Value = string> = Required<Pick<TreeProps<Value>, 'openItems' | 'onOpenChange' | 'onNavigation_unstable'>> & {
|
|
130
152
|
ref: React_2.Ref<HTMLDivElement>;
|
|
131
|
-
|
|
153
|
+
openItems: ImmutableSet<Value>;
|
|
154
|
+
};
|
|
132
155
|
|
|
133
156
|
declare interface ImmutableSet<Value> {
|
|
134
157
|
/**
|
|
@@ -156,23 +179,11 @@ declare interface ImmutableSet<Value> {
|
|
|
156
179
|
[Symbol.iterator](): IterableIterator<Value>;
|
|
157
180
|
}
|
|
158
181
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* Used internally on createFlatTreeItems and VisibleFlatTreeItemGenerator
|
|
162
|
-
* to ensure required properties when building a FlatTreeITem
|
|
163
|
-
*/
|
|
164
|
-
declare type MutableFlatTreeItem = {
|
|
165
|
-
parentId?: string;
|
|
166
|
-
childrenSize: number;
|
|
167
|
-
index: number;
|
|
168
|
-
id: string;
|
|
169
|
-
level: number;
|
|
170
|
-
getTreeItemProps(): Required<Pick<TreeItemProps, 'id' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'leaf'>> & TreeItemProps;
|
|
182
|
+
export declare type NestedTreeItem<Props extends TreeItemProps<unknown>> = Omit<Props, 'subtree' | 'itemType'> & {
|
|
183
|
+
subtree?: NestedTreeItem<Props>[];
|
|
171
184
|
};
|
|
172
185
|
|
|
173
|
-
|
|
174
|
-
subtree?: NestedTreeItem[];
|
|
175
|
-
};
|
|
186
|
+
declare type OmitWithoutExpanding<P, K extends string | number | symbol> = P extends unknown ? Omit<P, K> : P;
|
|
176
187
|
|
|
177
188
|
export declare const renderTree_unstable: (state: TreeState, contextValues: TreeContextValues) => JSX.Element;
|
|
178
189
|
|
|
@@ -181,6 +192,11 @@ export declare const renderTree_unstable: (state: TreeState, contextValues: Tree
|
|
|
181
192
|
*/
|
|
182
193
|
export declare const renderTreeItem_unstable: (state: TreeItemState, contextValues: TreeItemContextValues) => JSX.Element;
|
|
183
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Render the final JSX of TreeItemAside
|
|
197
|
+
*/
|
|
198
|
+
export declare const renderTreeItemAside_unstable: (state: TreeItemAsideState) => JSX.Element | null;
|
|
199
|
+
|
|
184
200
|
/**
|
|
185
201
|
* Render the final JSX of TreeItemLayout
|
|
186
202
|
*/
|
|
@@ -199,7 +215,22 @@ export declare const renderTreeItemPersonaLayout_unstable: (state: TreeItemPerso
|
|
|
199
215
|
* an item representing a folder can be expanded to reveal the contents of the folder,
|
|
200
216
|
* which may be files, folders, or both.
|
|
201
217
|
*/
|
|
202
|
-
export declare const Tree:
|
|
218
|
+
export declare const Tree: React_2.ForwardRefExoticComponent<Omit<TreeSlots, "root"> & Omit<{
|
|
219
|
+
as?: "div" | undefined;
|
|
220
|
+
} & Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
221
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React_2.RefObject<HTMLDivElement> | null | undefined;
|
|
222
|
+
} & {
|
|
223
|
+
children?: React_2.ReactNode | SlotRenderFunction<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
224
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React_2.RefObject<HTMLDivElement> | null | undefined;
|
|
225
|
+
}>;
|
|
226
|
+
}, "ref"> & {
|
|
227
|
+
appearance?: "transparent" | "subtle" | "subtle-alpha" | undefined;
|
|
228
|
+
size?: "small" | "medium" | undefined;
|
|
229
|
+
openItems?: Iterable<string> | undefined;
|
|
230
|
+
defaultOpenItems?: Iterable<string> | undefined;
|
|
231
|
+
onOpenChange?(event: React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement, MouseEvent>, data: TreeOpenChangeData<string>): void;
|
|
232
|
+
onNavigation_unstable?(event: React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement, MouseEvent>, data: TreeNavigationData_unstable<string>): void;
|
|
233
|
+
} & React_2.RefAttributes<HTMLDivElement>> & (<Value = string>(props: TreeProps<Value>) => JSX.Element);
|
|
203
234
|
|
|
204
235
|
export declare const treeClassNames: SlotClassNames<TreeSlots>;
|
|
205
236
|
|
|
@@ -207,12 +238,11 @@ export declare type TreeContextValue = {
|
|
|
207
238
|
level: number;
|
|
208
239
|
appearance: 'subtle' | 'subtle-alpha' | 'transparent';
|
|
209
240
|
size: 'small' | 'medium';
|
|
210
|
-
openItems: ImmutableSet<
|
|
241
|
+
openItems: ImmutableSet<unknown>;
|
|
211
242
|
/**
|
|
212
|
-
*
|
|
243
|
+
* requests root Tree component to respond to some tree item event,
|
|
213
244
|
*/
|
|
214
|
-
|
|
215
|
-
requestNavigation(data: TreeNavigationData_unstable): void;
|
|
245
|
+
requestTreeResponse(request: TreeItemRequest<unknown>): void;
|
|
216
246
|
};
|
|
217
247
|
|
|
218
248
|
declare type TreeContextValues = {
|
|
@@ -228,28 +258,84 @@ declare type TreeContextValues = {
|
|
|
228
258
|
* The content and layout of a TreeItem can be defined using the TreeItemLayout or TreeItemPersonaLayout component,
|
|
229
259
|
* which should be used as a direct child of TreeItem.
|
|
230
260
|
*
|
|
231
|
-
* When a TreeItem has
|
|
261
|
+
* When a TreeItem has nested child subtree, an expand/collapse control is displayed,
|
|
232
262
|
* allowing the user to show or hide the children.
|
|
233
263
|
*/
|
|
234
|
-
export declare const TreeItem:
|
|
264
|
+
export declare const TreeItem: React_2.ForwardRefExoticComponent<Omit<Partial<TreeItemSlots>, "root"> & Omit<{
|
|
265
|
+
as?: "div" | undefined;
|
|
266
|
+
} & Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
267
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React_2.RefObject<HTMLDivElement> | null | undefined;
|
|
268
|
+
} & {
|
|
269
|
+
children?: React_2.ReactNode | SlotRenderFunction<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
|
|
270
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React_2.RefObject<HTMLDivElement> | null | undefined;
|
|
271
|
+
}>;
|
|
272
|
+
} & {
|
|
273
|
+
style?: TreeItemCSSProperties | undefined;
|
|
274
|
+
}, "ref"> & {
|
|
275
|
+
value?: string | undefined;
|
|
276
|
+
itemType: TreeItemType;
|
|
277
|
+
} & React_2.RefAttributes<HTMLDivElement>> & (<Value = string>(props: TreeItemProps<Value>) => JSX.Element);
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* TreeItemAside component - represents a custom set of actionable elements that will be visible when a certain
|
|
281
|
+
* `TreeItem` is currently "active".
|
|
282
|
+
*/
|
|
283
|
+
export declare const TreeItemAside: ForwardRefComponent<TreeItemAsideProps>;
|
|
284
|
+
|
|
285
|
+
export declare const treeItemAsideClassNames: SlotClassNames<TreeItemAsideSlots>;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* TreeItemAside Props
|
|
289
|
+
*/
|
|
290
|
+
export declare type TreeItemAsideProps = ComponentProps<TreeItemAsideSlots> & {
|
|
291
|
+
/**
|
|
292
|
+
* boolean indicating if the aside content should behave as "actions"
|
|
293
|
+
*
|
|
294
|
+
* actionable elements are normally buttons, menus, or other focusable elements.
|
|
295
|
+
* Those elements are only visibly available if the given tree item is currently active.
|
|
296
|
+
*/
|
|
297
|
+
actions?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Forces visibility of the aside content, even if they're actions
|
|
300
|
+
*/
|
|
301
|
+
visible?: true;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export declare type TreeItemAsideSlots = {
|
|
305
|
+
root: Slot<'div'>;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* State used in rendering TreeItemAside
|
|
310
|
+
*/
|
|
311
|
+
export declare type TreeItemAsideState = ComponentState<TreeItemAsideSlots> & {
|
|
312
|
+
actions: boolean;
|
|
313
|
+
visible: boolean;
|
|
314
|
+
buttonContextValue: ButtonContextValue;
|
|
315
|
+
};
|
|
235
316
|
|
|
236
317
|
export declare const treeItemClassNames: SlotClassNames<TreeItemSlots>;
|
|
237
318
|
|
|
238
319
|
declare type TreeItemContextValue = {
|
|
239
320
|
isActionsVisible: boolean;
|
|
321
|
+
isAsideVisible: boolean;
|
|
322
|
+
actionsRef: React_2.Ref<HTMLDivElement>;
|
|
323
|
+
expandIconRef: React_2.Ref<HTMLDivElement>;
|
|
324
|
+
layoutRef: React_2.Ref<HTMLDivElement>;
|
|
325
|
+
subtreeRef: React_2.Ref<HTMLDivElement>;
|
|
326
|
+
value: unknown;
|
|
327
|
+
itemType: TreeItemType;
|
|
328
|
+
open: boolean;
|
|
240
329
|
};
|
|
241
330
|
|
|
242
331
|
declare type TreeItemContextValues = {
|
|
243
332
|
treeItem: TreeItemContextValue;
|
|
244
|
-
button: ButtonContextValue;
|
|
245
333
|
};
|
|
246
334
|
|
|
247
335
|
declare type TreeItemCSSProperties = React_2.CSSProperties & {
|
|
248
336
|
[treeItemLevelToken]?: string | number;
|
|
249
337
|
};
|
|
250
338
|
|
|
251
|
-
export declare type TreeItemId = string;
|
|
252
|
-
|
|
253
339
|
/**
|
|
254
340
|
* The `TreeItemLayout` component is used as a child of `TreeItem` to define the content and layout of a tree item.
|
|
255
341
|
* It provides a consistent visual structure for tree items in a `Tree` component.
|
|
@@ -266,21 +352,25 @@ export declare type TreeItemLayoutProps = ComponentProps<Partial<TreeItemLayoutS
|
|
|
266
352
|
|
|
267
353
|
export declare type TreeItemLayoutSlots = {
|
|
268
354
|
root: Slot<'div'>;
|
|
355
|
+
/**
|
|
356
|
+
* Expand icon slot,
|
|
357
|
+
* by default renders a chevron icon to indicate opening and closing
|
|
358
|
+
*/
|
|
359
|
+
expandIcon?: Slot<'div'>;
|
|
269
360
|
/**
|
|
270
361
|
* Icon slot that renders right before main content
|
|
271
362
|
*/
|
|
272
|
-
iconBefore?: Slot<'
|
|
363
|
+
iconBefore?: Slot<'div'>;
|
|
273
364
|
/**
|
|
274
365
|
* Icon slot that renders right after main content
|
|
275
366
|
*/
|
|
276
|
-
iconAfter?: Slot<'
|
|
277
|
-
aside?: Slot<'span'>;
|
|
367
|
+
iconAfter?: Slot<'div'>;
|
|
278
368
|
};
|
|
279
369
|
|
|
280
370
|
/**
|
|
281
371
|
* State used in rendering TreeItemLayout
|
|
282
372
|
*/
|
|
283
|
-
export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots
|
|
373
|
+
export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots>;
|
|
284
374
|
|
|
285
375
|
export declare const treeItemLevelToken: "--fluent-TreeItem--level";
|
|
286
376
|
|
|
@@ -303,120 +393,101 @@ declare type TreeItemPersonaLayoutContextValues = {
|
|
|
303
393
|
export declare type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;
|
|
304
394
|
|
|
305
395
|
export declare type TreeItemPersonaLayoutSlots = {
|
|
306
|
-
root: Slot<'
|
|
396
|
+
root: NonNullable<Slot<'div'>>;
|
|
397
|
+
/**
|
|
398
|
+
* Expand icon slot,
|
|
399
|
+
* by default renders a chevron icon to indicate opening and closing
|
|
400
|
+
*/
|
|
401
|
+
expandIcon?: Slot<'div'>;
|
|
307
402
|
/**
|
|
308
403
|
* Avatar to display.
|
|
309
404
|
*/
|
|
310
|
-
media: NonNullable<Slot<'
|
|
405
|
+
media: NonNullable<Slot<'div'>>;
|
|
311
406
|
/**
|
|
312
407
|
* Main text. Children of the root slot are automatically rendered here
|
|
313
408
|
*/
|
|
314
|
-
main: Slot<'
|
|
409
|
+
main: NonNullable<Slot<'div'>>;
|
|
315
410
|
/**
|
|
316
411
|
* Secondary text that describes or complements the main text
|
|
317
412
|
*/
|
|
318
|
-
description?: Slot<'
|
|
319
|
-
/**
|
|
320
|
-
* aside text that works as extra textual information
|
|
321
|
-
*/
|
|
322
|
-
aside?: Slot<'span'>;
|
|
413
|
+
description?: Slot<'div'>;
|
|
323
414
|
/**
|
|
324
415
|
* A layout wrapper for the main and description slots
|
|
325
416
|
*/
|
|
326
|
-
content: Slot<'div'
|
|
417
|
+
content: NonNullable<Slot<'div'>>;
|
|
327
418
|
};
|
|
328
419
|
|
|
329
420
|
/**
|
|
330
421
|
* State used in rendering TreeItemPersonaLayout
|
|
331
422
|
*/
|
|
332
|
-
export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> &
|
|
423
|
+
export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> & {
|
|
333
424
|
avatarSize: AvatarSize;
|
|
334
425
|
};
|
|
335
426
|
|
|
336
427
|
/**
|
|
337
428
|
* TreeItem Props
|
|
338
429
|
*/
|
|
339
|
-
export declare type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
* This attribute is used to force the decision if a TreeItem is a leaf or not. By not providing this property
|
|
343
|
-
* this will be inferred by the presence of a subtree as part of the TreeItem children.
|
|
344
|
-
*/
|
|
345
|
-
leaf?: boolean;
|
|
430
|
+
export declare type TreeItemProps<Value = string> = ComponentProps<Partial<TreeItemSlots>> & {
|
|
431
|
+
value?: Value;
|
|
432
|
+
itemType: TreeItemType;
|
|
346
433
|
};
|
|
347
434
|
|
|
348
|
-
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined
|
|
435
|
+
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined> & React_2.FC<React_2.ProviderProps<TreeItemContextValue | undefined>>;
|
|
436
|
+
|
|
437
|
+
declare type TreeItemRequest<Value> = {
|
|
438
|
+
itemType: TreeItemType;
|
|
439
|
+
} & (OmitWithoutExpanding<TreeOpenChangeData<Value>, 'open' | 'target'> | OmitWithoutExpanding<TreeNavigationData_unstable<Value>, 'target'>);
|
|
349
440
|
|
|
350
441
|
export declare type TreeItemSlots = {
|
|
351
442
|
root: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
352
443
|
style?: TreeItemCSSProperties;
|
|
353
444
|
}>>;
|
|
354
|
-
content: NonNullable<Slot<'div'>>;
|
|
355
|
-
subtree?: Slot<'span'>;
|
|
356
|
-
/**
|
|
357
|
-
* Expand icon slot,
|
|
358
|
-
* by default renders a chevron icon to indicate opening and closing
|
|
359
|
-
*/
|
|
360
|
-
expandIcon?: Slot<'span'>;
|
|
361
|
-
/**
|
|
362
|
-
* Actions slot that renders on the end of tree item
|
|
363
|
-
* when the item is hovered/focused
|
|
364
|
-
*/
|
|
365
|
-
actions?: Slot<'span'>;
|
|
366
445
|
};
|
|
367
446
|
|
|
368
447
|
/**
|
|
369
448
|
* State used in rendering TreeItem
|
|
370
449
|
*/
|
|
371
|
-
export declare type TreeItemState = ComponentState<TreeItemSlots> & {
|
|
372
|
-
open: boolean;
|
|
373
|
-
isLeaf: boolean;
|
|
450
|
+
export declare type TreeItemState = ComponentState<TreeItemSlots> & TreeItemContextValue & {
|
|
374
451
|
level: number;
|
|
375
|
-
|
|
376
|
-
* By design, a button included on the actions slot should be small
|
|
377
|
-
*/
|
|
378
|
-
buttonSize: 'small';
|
|
379
|
-
isActionsVisible: boolean;
|
|
452
|
+
itemType: TreeItemType;
|
|
380
453
|
};
|
|
381
454
|
|
|
382
|
-
|
|
383
|
-
|
|
455
|
+
declare type TreeItemType = 'leaf' | 'branch';
|
|
456
|
+
|
|
457
|
+
export declare type TreeNavigationData_unstable<Value = string> = {
|
|
458
|
+
value: Value;
|
|
384
459
|
target: HTMLElement;
|
|
460
|
+
} & ({
|
|
461
|
+
event: React_2.MouseEvent<HTMLElement>;
|
|
385
462
|
type: 'Click';
|
|
386
463
|
} | {
|
|
387
464
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
388
|
-
target: HTMLElement;
|
|
389
465
|
type: 'TypeAhead';
|
|
390
466
|
} | {
|
|
391
467
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
392
|
-
target: HTMLElement;
|
|
393
468
|
type: typeof ArrowRight;
|
|
394
469
|
} | {
|
|
395
470
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
396
|
-
target: HTMLElement;
|
|
397
471
|
type: typeof ArrowLeft;
|
|
398
472
|
} | {
|
|
399
473
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
400
|
-
target: HTMLElement;
|
|
401
474
|
type: typeof ArrowUp;
|
|
402
475
|
} | {
|
|
403
476
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
404
|
-
target: HTMLElement;
|
|
405
477
|
type: typeof ArrowDown;
|
|
406
478
|
} | {
|
|
407
479
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
408
|
-
target: HTMLElement;
|
|
409
480
|
type: typeof Home;
|
|
410
481
|
} | {
|
|
411
482
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
412
|
-
target: HTMLElement;
|
|
413
483
|
type: typeof End;
|
|
414
|
-
};
|
|
484
|
+
});
|
|
415
485
|
|
|
416
486
|
export declare type TreeNavigationEvent_unstable = TreeNavigationData_unstable['event'];
|
|
417
487
|
|
|
418
|
-
export declare type TreeOpenChangeData = {
|
|
488
|
+
export declare type TreeOpenChangeData<Value = string> = {
|
|
419
489
|
open: boolean;
|
|
490
|
+
value: Value;
|
|
420
491
|
} & ({
|
|
421
492
|
event: React_2.MouseEvent<HTMLElement>;
|
|
422
493
|
target: HTMLElement;
|
|
@@ -441,7 +512,7 @@ export declare type TreeOpenChangeData = {
|
|
|
441
512
|
|
|
442
513
|
export declare type TreeOpenChangeEvent = TreeOpenChangeData['event'];
|
|
443
514
|
|
|
444
|
-
export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
515
|
+
export declare type TreeProps<Value = string> = ComponentProps<TreeSlots> & {
|
|
445
516
|
/**
|
|
446
517
|
* A tree item can have various appearances:
|
|
447
518
|
* - 'subtle' (default): The default tree item styles.
|
|
@@ -460,13 +531,13 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
460
531
|
* Controls the state of the open tree items.
|
|
461
532
|
* These property is ignored for subtrees.
|
|
462
533
|
*/
|
|
463
|
-
openItems?: Iterable<
|
|
534
|
+
openItems?: Iterable<Value>;
|
|
464
535
|
/**
|
|
465
536
|
* This refers to a list of ids of opened tree items.
|
|
466
537
|
* Default value for the uncontrolled state of open tree items.
|
|
467
538
|
* These property is ignored for subtrees.
|
|
468
539
|
*/
|
|
469
|
-
defaultOpenItems?: Iterable<
|
|
540
|
+
defaultOpenItems?: Iterable<Value>;
|
|
470
541
|
/**
|
|
471
542
|
* Callback fired when the component changes value from open state.
|
|
472
543
|
* These property is ignored for subtrees.
|
|
@@ -475,7 +546,7 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
475
546
|
* @param data - A data object with relevant information,
|
|
476
547
|
* such as open value and type of interaction that created the event.
|
|
477
548
|
*/
|
|
478
|
-
onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData): void;
|
|
549
|
+
onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData<Value>): void;
|
|
479
550
|
/**
|
|
480
551
|
* Callback fired when navigation happens inside the component.
|
|
481
552
|
* These property is ignored for subtrees.
|
|
@@ -485,7 +556,7 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
485
556
|
* @param event - a React's Synthetic event
|
|
486
557
|
* @param data - A data object with relevant information,
|
|
487
558
|
*/
|
|
488
|
-
onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;
|
|
559
|
+
onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable<Value>): void;
|
|
489
560
|
};
|
|
490
561
|
|
|
491
562
|
export declare const TreeProvider: Provider<TreeContextValue | undefined> & FC<ProviderProps<TreeContextValue | undefined>>;
|
|
@@ -497,7 +568,9 @@ export declare type TreeSlots = {
|
|
|
497
568
|
/**
|
|
498
569
|
* State used in rendering Tree
|
|
499
570
|
*/
|
|
500
|
-
export declare type TreeState = ComponentState<TreeSlots> & TreeContextValue
|
|
571
|
+
export declare type TreeState = ComponentState<TreeSlots> & TreeContextValue & {
|
|
572
|
+
open: boolean;
|
|
573
|
+
};
|
|
501
574
|
|
|
502
575
|
/**
|
|
503
576
|
* this hook provides FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
|
|
@@ -511,7 +584,7 @@ export declare type TreeState = ComponentState<TreeSlots> & TreeContextValue;
|
|
|
511
584
|
* @param flatTreeItemProps - a list of tree items
|
|
512
585
|
* @param options - in case control over the internal openItems is required
|
|
513
586
|
*/
|
|
514
|
-
export declare function useFlatTree_unstable(flatTreeItemProps:
|
|
587
|
+
export declare function useFlatTree_unstable<Props extends FlatTreeItemProps<unknown> = FlatTreeItemProps>(flatTreeItemProps: Props[], options?: FlatTreeOptions<Props>): FlatTree<Props>;
|
|
515
588
|
|
|
516
589
|
/**
|
|
517
590
|
* Create the state required to render Tree.
|
|
@@ -537,9 +610,25 @@ export declare function useTreeContextValues_unstable(state: TreeState): TreeCon
|
|
|
537
610
|
* @param props - props from this instance of TreeItem
|
|
538
611
|
* @param ref - reference to root HTMLElement of TreeItem
|
|
539
612
|
*/
|
|
540
|
-
export declare
|
|
613
|
+
export declare function useTreeItem_unstable<Value = string>(props: TreeItemProps<Value>, ref: React_2.Ref<HTMLDivElement>): TreeItemState;
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Create the state required to render TreeItemAside.
|
|
617
|
+
*
|
|
618
|
+
* The returned state can be modified with hooks such as useTreeItemAsideStyles_unstable,
|
|
619
|
+
* before being passed to renderTreeItemAside_unstable.
|
|
620
|
+
*
|
|
621
|
+
* @param props - props from this instance of TreeItemAside
|
|
622
|
+
* @param ref - reference to root HTMLElement of TreeItemAside
|
|
623
|
+
*/
|
|
624
|
+
export declare const useTreeItemAside_unstable: (props: TreeItemAsideProps, ref: React_2.Ref<HTMLElement>) => TreeItemAsideState;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Apply styling to the TreeItemAside slots based on the state
|
|
628
|
+
*/
|
|
629
|
+
export declare const useTreeItemAsideStyles_unstable: (state: TreeItemAsideState) => TreeItemAsideState;
|
|
541
630
|
|
|
542
|
-
export declare const useTreeItemContext_unstable: () =>
|
|
631
|
+
export declare const useTreeItemContext_unstable: <T>(selector: ContextSelector<TreeItemContextValue, T>) => T;
|
|
543
632
|
|
|
544
633
|
/**
|
|
545
634
|
* Create the state required to render TreeItemLayout.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../src/TreeItemAside.ts"],"sourcesContent":["export * from './components/TreeItemAside/index';\n"],"mappings":"AAAA,cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useTree_unstable } from './useTree';
|
|
3
3
|
import { renderTree_unstable } from './renderTree';
|
|
4
|
-
import { useTreeStyles_unstable } from './useTreeStyles';
|
|
4
|
+
import { useTreeStyles_unstable } from './useTreeStyles.styles';
|
|
5
5
|
import { useTreeContextValues_unstable } from './useTreeContextValues';
|
|
6
6
|
/**
|
|
7
7
|
* A tree view widget presents a hierarchical list.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useTree_unstable","renderTree_unstable","useTreeStyles_unstable","useTreeContextValues_unstable","Tree","forwardRef","props","ref","state","contextValues","displayName"],"sources":["../../../src/components/Tree/Tree.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTree_unstable } from './useTree';\nimport { renderTree_unstable } from './renderTree';\nimport { useTreeStyles_unstable } from './useTreeStyles';\nimport type { TreeProps } from './Tree.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTreeContextValues_unstable } from './useTreeContextValues';\n\n/**\n * A tree view widget presents a hierarchical list.\n * Any item in the hierarchy may have child items,\n * and items that have children may be expanded or collapsed to show or hide the children.\n * For example, in a file system navigator that uses a tree view to display folders and files,\n * an item representing a folder can be expanded to reveal the contents of the folder,\n * which may be files, folders, or both.\n */\nexport const Tree
|
|
1
|
+
{"version":3,"names":["React","useTree_unstable","renderTree_unstable","useTreeStyles_unstable","useTreeContextValues_unstable","Tree","forwardRef","props","ref","state","contextValues","displayName"],"sources":["../../../src/components/Tree/Tree.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTree_unstable } from './useTree';\nimport { renderTree_unstable } from './renderTree';\nimport { useTreeStyles_unstable } from './useTreeStyles.styles';\nimport type { TreeProps } from './Tree.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTreeContextValues_unstable } from './useTreeContextValues';\n\n/**\n * A tree view widget presents a hierarchical list.\n * Any item in the hierarchy may have child items,\n * and items that have children may be expanded or collapsed to show or hide the children.\n * For example, in a file system navigator that uses a tree view to display folders and files,\n * an item representing a folder can be expanded to reveal the contents of the folder,\n * which may be files, folders, or both.\n */\nexport const Tree = React.forwardRef((props, ref) => {\n const state = useTree_unstable(props, ref);\n useTreeStyles_unstable(state);\n const contextValues = useTreeContextValues_unstable(state);\n return renderTree_unstable(state, contextValues);\n}) as ForwardRefComponent<TreeProps> & (<Value = string>(props: TreeProps<Value>) => JSX.Element);\n\nTree.displayName = 'Tree';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,sBAAsB,QAAQ;AAGvC,SAASC,6BAA6B,QAAQ;AAE9C;;;;;;;;AAQA,OAAO,MAAMC,IAAA,gBAAOL,KAAA,CAAMM,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACnD,MAAMC,KAAA,GAAQR,gBAAA,CAAiBM,KAAA,EAAOC,GAAA;EACtCL,sBAAA,CAAuBM,KAAA;EACvB,MAAMC,aAAA,GAAgBN,6BAAA,CAA8BK,KAAA;EACpD,OAAOP,mBAAA,CAAoBO,KAAA,EAAOC,aAAA;AACpC;AAEAL,IAAA,CAAKM,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React"],"sources":["../../../src/components/Tree/Tree.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TreeContextValue } from '../../contexts/treeContext';\nimport { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\
|
|
1
|
+
{"version":3,"names":["React"],"sources":["../../../src/components/Tree/Tree.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TreeContextValue } from '../../contexts/treeContext';\nimport { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\n\nexport type TreeSlots = {\n root: Slot<'div'>;\n};\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationData_unstable<Value = string> = { value: Value; target: HTMLElement } & (\n | { event: React.MouseEvent<HTMLElement>; type: 'Click' }\n | { event: React.KeyboardEvent<HTMLElement>; type: 'TypeAhead' }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowRight }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowLeft }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowUp }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowDown }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof Home }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof End }\n);\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationEvent_unstable = TreeNavigationData_unstable['event'];\n\nexport type TreeOpenChangeData<Value = string> = { open: boolean; value: Value } & (\n | {\n event: React.MouseEvent<HTMLElement>;\n target: HTMLElement;\n type: 'ExpandIconClick';\n }\n | {\n event: React.MouseEvent<HTMLElement>;\n target: HTMLElement;\n type: 'Click';\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof Enter;\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof ArrowRight;\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof ArrowLeft;\n }\n);\n\nexport type TreeOpenChangeEvent = TreeOpenChangeData['event'];\n\nexport type TreeContextValues = {\n tree: TreeContextValue;\n};\n\nexport type TreeProps<Value = string> = 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<Value>;\n /**\n * This refers to a list of ids of opened tree items.\n * Default value for the uncontrolled state of open tree items.\n * These property is ignored for subtrees.\n */\n defaultOpenItems?: Iterable<Value>;\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<Value>): 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<Value>): void;\n};\n\n/**\n * State used in rendering Tree\n */\nexport type TreeState = ComponentState<TreeSlots> &\n TreeContextValue & {\n open: boolean;\n };\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
|
|
@@ -2,6 +2,6 @@ export * from './Tree';
|
|
|
2
2
|
export * from './Tree.types';
|
|
3
3
|
export * from './renderTree';
|
|
4
4
|
export * from './useTree';
|
|
5
|
-
export * from './useTreeStyles';
|
|
5
|
+
export * from './useTreeStyles.styles';
|
|
6
6
|
export * from './useTreeContextValues';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/components/Tree/index.ts"],"sourcesContent":["export * from './Tree';\nexport * from './Tree.types';\nexport * from './renderTree';\nexport * from './useTree';\nexport * from './useTreeStyles';\nexport * from './useTreeContextValues';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/Tree/index.ts"],"sourcesContent":["export * from './Tree';\nexport * from './Tree.types';\nexport * from './renderTree';\nexport * from './useTree';\nexport * from './useTreeStyles.styles';\nexport * from './useTreeContextValues';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
|
@@ -8,6 +8,6 @@ export const renderTree_unstable = (state, contextValues) => {
|
|
|
8
8
|
} = getSlotsNext(state);
|
|
9
9
|
return /*#__PURE__*/createElement(TreeProvider, {
|
|
10
10
|
value: contextValues.tree
|
|
11
|
-
}, /*#__PURE__*/createElement(slots.root, slotProps.root, slotProps.root.children));
|
|
11
|
+
}, state.open && /*#__PURE__*/createElement(slots.root, slotProps.root, slotProps.root.children));
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=renderTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createElement","getSlotsNext","TreeProvider","renderTree_unstable","state","contextValues","slots","slotProps","value","tree","root","children"],"sources":["../../../src/components/Tree/renderTree.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { TreeState, TreeSlots, TreeContextValues } from './Tree.types';\nimport { TreeProvider } from '../../contexts';\n\nexport const renderTree_unstable = (state: TreeState, contextValues: TreeContextValues) => {\n const { slots, slotProps } = getSlotsNext<TreeSlots>(state);\n
|
|
1
|
+
{"version":3,"names":["createElement","getSlotsNext","TreeProvider","renderTree_unstable","state","contextValues","slots","slotProps","value","tree","open","root","children"],"sources":["../../../src/components/Tree/renderTree.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { TreeState, TreeSlots, TreeContextValues } from './Tree.types';\nimport { TreeProvider } from '../../contexts';\n\nexport const renderTree_unstable = (state: TreeState, contextValues: TreeContextValues) => {\n const { slots, slotProps } = getSlotsNext<TreeSlots>(state);\n return (\n <TreeProvider value={contextValues.tree}>\n {state.open && <slots.root {...slotProps.root}>{slotProps.root.children}</slots.root>}\n </TreeProvider>\n );\n};\n"],"mappings":"AAAA,2BACA,yBAEA,SAASA,aAAa,QAAQ;AAC9B,SAASC,YAAY,QAAQ;AAE7B,SAASC,YAAY,QAAQ;AAE7B,OAAO,MAAMC,mBAAA,GAAsBA,CAACC,KAAA,EAAkBC,aAAA,KAAqC;EACzF,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGN,YAAA,CAAwBG,KAAA;EACrD,oBACEJ,aAVJ,CAUKE,YAAA;IAAaM,KAAA,EAAOH,aAAA,CAAcI;KAChCL,KAAA,CAAMM,IAAI,iBAAIV,aAXrB,CAWsBM,KAAA,CAAMK,IAAI,EAAKJ,SAAA,CAAUI,IAAI,EAAGJ,SAAA,CAAUI,IAAI,CAACC,QAAQ;AAG7E"}
|