@fluentui/react-tree 9.75.0-experimental.css-modules.20261031-810ab07afb.0 → 9.75.1-experimental.positioning-engine.20261103-19efe125d1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -19
- package/README.md +0 -12
- package/dist/index.d.cts +83 -6
- package/dist/index.d.ts +83 -6
- package/lib/Tree.js +1 -1
- package/lib/Tree.js.map +1 -1
- package/lib/TreeItemLayout.js +1 -1
- package/lib/TreeItemLayout.js.map +1 -1
- package/lib/components/FlatTree/useFlatTree.js +28 -3
- package/lib/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib/components/Tree/Tree.types.js +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 +6 -2
- package/lib/components/Tree/renderTree.js.map +1 -1
- package/lib/components/Tree/useTree.js +75 -6
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js +4 -1
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js +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 +13 -7
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +201 -30
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/hooks/useFlatTreeNavigation.js +3 -4
- package/lib/hooks/useFlatTreeNavigation.js.map +1 -1
- package/lib/hooks/useRootTree.js +3 -8
- package/lib/hooks/useRootTree.js.map +1 -1
- package/lib/hooks/useRovingTabIndexBase.js +108 -0
- package/lib/hooks/useRovingTabIndexBase.js.map +1 -0
- package/lib/hooks/useRovingTabIndexes.js +2 -61
- package/lib/hooks/useRovingTabIndexes.js.map +1 -1
- package/lib/hooks/useSubtree.js +1 -11
- package/lib/hooks/useSubtree.js.map +1 -1
- package/lib/hooks/useTreeNavigation.js +6 -84
- package/lib/hooks/useTreeNavigation.js.map +1 -1
- package/lib/hooks/useTreeNavigationBase.js +131 -0
- package/lib/hooks/useTreeNavigationBase.js.map +1 -0
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/queryTreeItemActions.js +29 -0
- package/lib/utils/queryTreeItemActions.js.map +1 -0
- package/lib-commonjs/Tree.cjs +3 -0
- package/lib-commonjs/Tree.cjs.map +1 -1
- package/lib-commonjs/TreeItemLayout.cjs +3 -0
- package/lib-commonjs/TreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTree.cjs +28 -3
- package/lib-commonjs/components/FlatTree/useFlatTree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/Tree.types.cjs +1 -1
- package/lib-commonjs/components/Tree/Tree.types.cjs.map +1 -1
- package/lib-commonjs/components/Tree/index.cjs +3 -0
- package/lib-commonjs/components/Tree/index.cjs.map +1 -1
- package/lib-commonjs/components/Tree/renderTree.cjs +1 -1
- package/lib-commonjs/components/Tree/renderTree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTree.cjs +68 -8
- package/lib-commonjs/components/Tree/useTree.cjs.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.cjs +4 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs +1 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/index.cjs +3 -0
- package/lib-commonjs/components/TreeItemLayout/index.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs +9 -6
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs +200 -32
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs.map +1 -1
- package/lib-commonjs/hooks/useFlatTreeNavigation.cjs +3 -4
- package/lib-commonjs/hooks/useFlatTreeNavigation.cjs.map +1 -1
- package/lib-commonjs/hooks/useRootTree.cjs +3 -8
- package/lib-commonjs/hooks/useRootTree.cjs.map +1 -1
- package/lib-commonjs/hooks/useRovingTabIndexBase.cjs +116 -0
- package/lib-commonjs/hooks/useRovingTabIndexBase.cjs.map +1 -0
- package/lib-commonjs/hooks/useRovingTabIndexes.cjs +2 -62
- package/lib-commonjs/hooks/useRovingTabIndexes.cjs.map +1 -1
- package/lib-commonjs/hooks/useSubtree.cjs +1 -11
- package/lib-commonjs/hooks/useSubtree.cjs.map +1 -1
- package/lib-commonjs/hooks/useTreeNavigation.cjs +5 -84
- package/lib-commonjs/hooks/useTreeNavigation.cjs.map +1 -1
- package/lib-commonjs/hooks/useTreeNavigationBase.cjs +140 -0
- package/lib-commonjs/hooks/useTreeNavigationBase.cjs.map +1 -0
- package/lib-commonjs/index.cjs +6 -0
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/utils/queryTreeItemActions.cjs +38 -0
- package/lib-commonjs/utils/queryTreeItemActions.cjs.map +1 -0
- package/package.json +17 -20
- package/lib/components/FlatTree/FlatTree.module.css +0 -7
- package/lib/components/FlatTree/useFlatTreeStyles.styles.css.js +0 -9
- package/lib/components/FlatTree/useFlatTreeStyles.styles.css.js.map +0 -1
- package/lib/components/FlatTree/useFlatTreeStyles.styles.raw.css.js +0 -9
- package/lib/components/FlatTree/useFlatTreeStyles.styles.raw.css.js.map +0 -1
- package/lib/components/Tree/Tree.module.css +0 -11
- package/lib/components/Tree/useTreeStyles.styles.css.js +0 -9
- package/lib/components/Tree/useTreeStyles.styles.css.js.map +0 -1
- package/lib/components/Tree/useTreeStyles.styles.raw.css.js +0 -9
- package/lib/components/Tree/useTreeStyles.styles.raw.css.js.map +0 -1
- package/lib/components/TreeItem/TreeItem.module.css +0 -65
- package/lib/components/TreeItem/useTreeItemStyles.styles.css.js +0 -17
- package/lib/components/TreeItem/useTreeItemStyles.styles.css.js.map +0 -1
- package/lib/components/TreeItem/useTreeItemStyles.styles.raw.css.js +0 -17
- package/lib/components/TreeItem/useTreeItemStyles.styles.raw.css.js.map +0 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.module.css +0 -137
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.js +0 -51
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.js.map +0 -1
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.css.js +0 -51
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.css.js.map +0 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.module.css +0 -149
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.css.js +0 -51
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.css.js.map +0 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.css.js +0 -51
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.css.js.map +0 -1
- package/lib-commonjs/components/FlatTree/FlatTree.module.css +0 -7
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.css.cjs +0 -28
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.css.cjs.map +0 -1
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.raw.css.cjs +0 -28
- package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.raw.css.cjs.map +0 -1
- package/lib-commonjs/components/Tree/Tree.module.css +0 -11
- package/lib-commonjs/components/Tree/useTreeStyles.styles.css.cjs +0 -28
- package/lib-commonjs/components/Tree/useTreeStyles.styles.css.cjs.map +0 -1
- package/lib-commonjs/components/Tree/useTreeStyles.styles.raw.css.cjs +0 -28
- package/lib-commonjs/components/Tree/useTreeStyles.styles.raw.css.cjs.map +0 -1
- package/lib-commonjs/components/TreeItem/TreeItem.module.css +0 -65
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.css.cjs +0 -36
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.css.cjs.map +0 -1
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.raw.css.cjs +0 -36
- package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.raw.css.cjs.map +0 -1
- package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.module.css +0 -137
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.cjs +0 -70
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.css.cjs.map +0 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.css.cjs +0 -70
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.css.cjs.map +0 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.module.css +0 -149
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.css.cjs +0 -70
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.css.cjs.map +0 -1
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.css.cjs +0 -70
- package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.css.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tree
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Tue, 03 Nov 2026 14:18:16 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [9.75.
|
|
7
|
+
## [9.75.1-experimental.positioning-engine.20261103-19efe125d1.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.
|
|
9
|
+
Tue, 03 Nov 2026 14:18:16 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.17.0..@fluentui/react-tree_v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
|
-
- Release 9.75.
|
|
15
|
-
- Bump @fluentui/keyboard-keys to v9.75.
|
|
16
|
-
- Bump @fluentui/react-aria to v9.75.
|
|
17
|
-
- Bump @fluentui/react-avatar to v9.75.
|
|
18
|
-
- Bump @fluentui/react-button to v9.75.
|
|
19
|
-
- Bump @fluentui/react-checkbox to v9.75.
|
|
20
|
-
- Bump @fluentui/react-context-selector to v9.75.
|
|
21
|
-
- Bump @fluentui/react-jsx-runtime to v9.75.
|
|
22
|
-
- Bump @fluentui/react-motion to v9.75.
|
|
23
|
-
- Bump @fluentui/react-motion-components-preview to v9.75.
|
|
24
|
-
- Bump @fluentui/react-radio to v9.75.
|
|
25
|
-
- Bump @fluentui/react-shared-contexts to v9.75.
|
|
26
|
-
- Bump @fluentui/react-tabster to v9.75.
|
|
27
|
-
- Bump @fluentui/react-theme to v9.75.
|
|
28
|
-
- Bump @fluentui/react-utilities to v9.75.
|
|
14
|
+
- Release 9.75.1-experimental.positioning-engine.20261103-19efe125d1 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
|
|
15
|
+
- Bump @fluentui/keyboard-keys to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-aria to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-avatar to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-button to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-checkbox to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
- Bump @fluentui/react-context-selector to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
21
|
+
- Bump @fluentui/react-jsx-runtime to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
22
|
+
- Bump @fluentui/react-motion to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
23
|
+
- Bump @fluentui/react-motion-components-preview to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
24
|
+
- Bump @fluentui/react-radio to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
25
|
+
- Bump @fluentui/react-shared-contexts to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
26
|
+
- Bump @fluentui/react-tabster to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
27
|
+
- Bump @fluentui/react-theme to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
28
|
+
- Bump @fluentui/react-utilities to v9.75.1-experimental.positioning-engine.20261103-19efe125d1.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
29
|
+
|
|
30
|
+
## [9.17.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.17.0)
|
|
31
|
+
|
|
32
|
+
Mon, 02 Nov 2026 13:22:59 GMT
|
|
33
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.16.10..@fluentui/react-tree_v9.17.0)
|
|
34
|
+
|
|
35
|
+
### Minor changes
|
|
36
|
+
|
|
37
|
+
- feat: expose useTreeBase_unstable and useTreeItemLayoutBase_unstable design-free base hooks ([PR #36932](https://github.com/microsoft/fluentui/pull/36932) by dmytrokirpa@microsoft.com)
|
|
29
38
|
|
|
30
39
|
## [9.16.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.16.10)
|
|
31
40
|
|
package/README.md
CHANGED
|
@@ -3,15 +3,3 @@
|
|
|
3
3
|
**React Tree components for [Fluent UI React](https://react.fluentui.dev/)**
|
|
4
4
|
|
|
5
5
|
These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
|
|
6
|
-
|
|
7
|
-
## Opt-in CSS Modules styles
|
|
8
|
-
|
|
9
|
-
Tree, FlatTree, TreeItem, TreeItemLayout, and TreeItemPersonaLayout have alternatives. TreeItem retains the custom-property fallback for indentation beyond ten levels.
|
|
10
|
-
|
|
11
|
-
The default components continue to use Griffel. An opt-in bundler resolver can replace
|
|
12
|
-
`use<Component>Styles.styles.js` with `use<Component>Styles.styles.css.js`
|
|
13
|
-
(and the corresponding `.ts` source modules). Keep the emitted CSS assets and process
|
|
14
|
-
their CSS Modules imports; all rules are in `@layer fluentui`. Apply the same selection
|
|
15
|
-
to client and server bundles. Within-package composed alternatives import their CSS
|
|
16
|
-
base hook explicitly. These alternatives do not make composed external components
|
|
17
|
-
Griffel-free. Browser, forced-colors, SSR, and full VRT parity require separate validation.
|
package/dist/index.d.cts
CHANGED
|
@@ -358,7 +358,12 @@ declare type MultiSelectValue = NonNullable<CheckboxProps['checked']>;
|
|
|
358
358
|
|
|
359
359
|
export declare const renderFlatTree_unstable: (state: FlatTreeState, contextValues: FlatTreeContextValues) => JSXElement;
|
|
360
360
|
|
|
361
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Render the final JSX of Tree.
|
|
363
|
+
*
|
|
364
|
+
* Without a collapse motion, as produced by `useTreeBase_unstable`, a closed subtree is not rendered.
|
|
365
|
+
*/
|
|
366
|
+
export declare const renderTree_unstable: (state: TreeState | TreeBaseState, contextValues: TreeContextValues) => JSXElement;
|
|
362
367
|
|
|
363
368
|
/**
|
|
364
369
|
* Render the final JSX of TreeItem
|
|
@@ -367,8 +372,11 @@ export declare const renderTreeItem_unstable: (state: TreeItemState, contextValu
|
|
|
367
372
|
|
|
368
373
|
/**
|
|
369
374
|
* Render the final JSX of TreeItemLayout
|
|
375
|
+
*
|
|
376
|
+
* The button context is only provided when the state carries one, which is not the case for the
|
|
377
|
+
* state produced by `useTreeItemLayoutBase_unstable`.
|
|
370
378
|
*/
|
|
371
|
-
export declare const renderTreeItemLayout_unstable: (state: TreeItemLayoutState) => JSXElement;
|
|
379
|
+
export declare const renderTreeItemLayout_unstable: (state: TreeItemLayoutState | TreeItemLayoutBaseState) => JSXElement;
|
|
372
380
|
|
|
373
381
|
/**
|
|
374
382
|
* Render the final JSX of TreeItemPersonaLayout
|
|
@@ -388,6 +396,23 @@ export declare type SubtreeContextValue = {
|
|
|
388
396
|
*/
|
|
389
397
|
export declare const Tree: ForwardRefComponent<TreeProps>;
|
|
390
398
|
|
|
399
|
+
/**
|
|
400
|
+
* Tree props accepted by `useTreeBase_unstable`, without design only props and the collapse motion.
|
|
401
|
+
*/
|
|
402
|
+
export declare type TreeBaseProps = Omit<TreeProps, 'appearance' | 'size' | 'collapseMotion'>;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Tree slots without any design dependency, used by `useTreeBase_unstable`.
|
|
406
|
+
*/
|
|
407
|
+
export declare type TreeBaseSlots = Pick<TreeSlots, 'root'>;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* State returned by `useTreeBase_unstable`, without design only state and the collapse motion.
|
|
411
|
+
*/
|
|
412
|
+
export declare type TreeBaseState = ComponentState<TreeBaseSlots> & {
|
|
413
|
+
open: boolean;
|
|
414
|
+
} & (DistributiveOmit<TreeContextValue, 'appearance' | 'size'> | SubtreeContextValue);
|
|
415
|
+
|
|
391
416
|
export declare type TreeCheckedChangeData = {
|
|
392
417
|
value: TreeItemValue;
|
|
393
418
|
checkedItems: Map<TreeItemValue, TreeSelectionValue>;
|
|
@@ -464,7 +489,7 @@ export declare type TreeItemContextValue = {
|
|
|
464
489
|
checked: TreeSelectionValue;
|
|
465
490
|
};
|
|
466
491
|
|
|
467
|
-
declare type TreeItemContextValues = {
|
|
492
|
+
export declare type TreeItemContextValues = {
|
|
468
493
|
treeItem: TreeItemContextValue;
|
|
469
494
|
};
|
|
470
495
|
|
|
@@ -479,7 +504,7 @@ export declare type TreeItemCSSProperties = React_2.CSSProperties & {
|
|
|
479
504
|
*/
|
|
480
505
|
export declare const TreeItemLayout: ForwardRefComponent<TreeItemLayoutProps>;
|
|
481
506
|
|
|
482
|
-
declare type TreeItemLayoutActionSlotProps = ExtractSlotProps<Slot<'div'> & {
|
|
507
|
+
export declare type TreeItemLayoutActionSlotProps = ExtractSlotProps<Slot<'div'> & {
|
|
483
508
|
/**
|
|
484
509
|
* Forces visibility of the aside/action content
|
|
485
510
|
*/
|
|
@@ -487,10 +512,29 @@ declare type TreeItemLayoutActionSlotProps = ExtractSlotProps<Slot<'div'> & {
|
|
|
487
512
|
onVisibilityChange?: EventHandler<TreeItemLayoutActionVisibilityChangeData>;
|
|
488
513
|
}>;
|
|
489
514
|
|
|
490
|
-
declare type TreeItemLayoutActionVisibilityChangeData = (EventData<'mouseover' | 'mouseout', MouseEvent> | EventData<'focus' | 'blur', FocusEvent> | EventData<'blur', React_2.FocusEvent>) & {
|
|
515
|
+
export declare type TreeItemLayoutActionVisibilityChangeData = (EventData<'mouseover' | 'mouseout', MouseEvent> | EventData<'focus' | 'blur', FocusEvent> | EventData<'blur', React_2.FocusEvent>) & {
|
|
491
516
|
visible: boolean;
|
|
492
517
|
};
|
|
493
518
|
|
|
519
|
+
/**
|
|
520
|
+
* TreeItemLayout props accepted by `useTreeItemLayoutBase_unstable`.
|
|
521
|
+
*/
|
|
522
|
+
export declare type TreeItemLayoutBaseProps = ComponentProps<Partial<TreeItemLayoutBaseSlots>>;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* TreeItemLayout slots without any design dependency, used by `useTreeItemLayoutBase_unstable`.
|
|
526
|
+
*
|
|
527
|
+
* The selector renders as a native `input`, of type `checkbox` or `radio` depending on the tree selection mode.
|
|
528
|
+
*/
|
|
529
|
+
export declare type TreeItemLayoutBaseSlots = Omit<TreeItemLayoutSlots, 'selector'> & {
|
|
530
|
+
selector?: Slot<'input'>;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* State returned by `useTreeItemLayoutBase_unstable`.
|
|
535
|
+
*/
|
|
536
|
+
export declare type TreeItemLayoutBaseState = ComponentState<TreeItemLayoutBaseSlots>;
|
|
537
|
+
|
|
494
538
|
export declare const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutSlots>;
|
|
495
539
|
|
|
496
540
|
/**
|
|
@@ -867,11 +911,31 @@ export declare function useHeadlessFlatTree_unstable<Props extends HeadlessTreeI
|
|
|
867
911
|
|
|
868
912
|
export declare const useSubtreeContext_unstable: () => SubtreeContextValue;
|
|
869
913
|
|
|
914
|
+
/**
|
|
915
|
+
* Create the state required to render Tree.
|
|
916
|
+
*
|
|
917
|
+
* The returned state can be modified with hooks such as useTreeStyles_unstable,
|
|
918
|
+
* before being passed to renderTree_unstable.
|
|
919
|
+
*
|
|
920
|
+
* @param props - props from this instance of Tree
|
|
921
|
+
* @param ref - reference to root HTMLElement of Tree
|
|
922
|
+
*/
|
|
870
923
|
export declare const useTree_unstable: (props: TreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
871
924
|
|
|
925
|
+
/**
|
|
926
|
+
* Base state hook for Tree, free of any design props, motion or focus management runtime.
|
|
927
|
+
*
|
|
928
|
+
* Arrow key navigation and the roving tab index are driven by plain DOM focus handling, and closed
|
|
929
|
+
* subtrees are not rendered as there is no collapse motion to unmount them.
|
|
930
|
+
*
|
|
931
|
+
* @param props - props from this instance of Tree
|
|
932
|
+
* @param ref - reference to root HTMLElement of Tree
|
|
933
|
+
*/
|
|
934
|
+
export declare const useTreeBase_unstable: (props: TreeBaseProps, ref: React_2.Ref<HTMLElement>) => TreeBaseState;
|
|
935
|
+
|
|
872
936
|
export declare const useTreeContext_unstable: <T>(selector: ContextSelector<TreeContextValue, T>) => T;
|
|
873
937
|
|
|
874
|
-
export declare function useTreeContextValues_unstable(state: TreeState): TreeContextValues;
|
|
938
|
+
export declare function useTreeContextValues_unstable(state: TreeState | TreeBaseState): TreeContextValues;
|
|
875
939
|
|
|
876
940
|
/**
|
|
877
941
|
* Create the state required to render TreeItem.
|
|
@@ -899,6 +963,19 @@ export declare function useTreeItemContextValues_unstable(state: TreeItemState):
|
|
|
899
963
|
*/
|
|
900
964
|
export declare const useTreeItemLayout_unstable: (props: TreeItemLayoutProps, ref: React_2.Ref<HTMLElement>) => TreeItemLayoutState;
|
|
901
965
|
|
|
966
|
+
/**
|
|
967
|
+
* Base state hook for TreeItemLayout, free of any focus management runtime and of the Fluent
|
|
968
|
+
* components used for the selector, the expand icon and the actions.
|
|
969
|
+
*
|
|
970
|
+
* The selector slot is rendered as a native `input`, of type `checkbox` in multiselect mode and
|
|
971
|
+
* `radio` in single selection mode, the expand icon has no default content, and the Tabster driven
|
|
972
|
+
* arrow key navigation of the actions is layered on by the wrapping `useTreeItemLayout_unstable` hook.
|
|
973
|
+
*
|
|
974
|
+
* @param props - props from this instance of TreeItemLayout
|
|
975
|
+
* @param ref - reference to root HTMLElement of TreeItemLayout
|
|
976
|
+
*/
|
|
977
|
+
export declare const useTreeItemLayoutBase_unstable: (props: TreeItemLayoutBaseProps, ref: React_2.Ref<HTMLElement>) => TreeItemLayoutBaseState;
|
|
978
|
+
|
|
902
979
|
/**
|
|
903
980
|
* Apply styling to the TreeItemLayout slots based on the state
|
|
904
981
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -358,7 +358,12 @@ declare type MultiSelectValue = NonNullable<CheckboxProps['checked']>;
|
|
|
358
358
|
|
|
359
359
|
export declare const renderFlatTree_unstable: (state: FlatTreeState, contextValues: FlatTreeContextValues) => JSXElement;
|
|
360
360
|
|
|
361
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Render the final JSX of Tree.
|
|
363
|
+
*
|
|
364
|
+
* Without a collapse motion, as produced by `useTreeBase_unstable`, a closed subtree is not rendered.
|
|
365
|
+
*/
|
|
366
|
+
export declare const renderTree_unstable: (state: TreeState | TreeBaseState, contextValues: TreeContextValues) => JSXElement;
|
|
362
367
|
|
|
363
368
|
/**
|
|
364
369
|
* Render the final JSX of TreeItem
|
|
@@ -367,8 +372,11 @@ export declare const renderTreeItem_unstable: (state: TreeItemState, contextValu
|
|
|
367
372
|
|
|
368
373
|
/**
|
|
369
374
|
* Render the final JSX of TreeItemLayout
|
|
375
|
+
*
|
|
376
|
+
* The button context is only provided when the state carries one, which is not the case for the
|
|
377
|
+
* state produced by `useTreeItemLayoutBase_unstable`.
|
|
370
378
|
*/
|
|
371
|
-
export declare const renderTreeItemLayout_unstable: (state: TreeItemLayoutState) => JSXElement;
|
|
379
|
+
export declare const renderTreeItemLayout_unstable: (state: TreeItemLayoutState | TreeItemLayoutBaseState) => JSXElement;
|
|
372
380
|
|
|
373
381
|
/**
|
|
374
382
|
* Render the final JSX of TreeItemPersonaLayout
|
|
@@ -388,6 +396,23 @@ export declare type SubtreeContextValue = {
|
|
|
388
396
|
*/
|
|
389
397
|
export declare const Tree: ForwardRefComponent<TreeProps>;
|
|
390
398
|
|
|
399
|
+
/**
|
|
400
|
+
* Tree props accepted by `useTreeBase_unstable`, without design only props and the collapse motion.
|
|
401
|
+
*/
|
|
402
|
+
export declare type TreeBaseProps = Omit<TreeProps, 'appearance' | 'size' | 'collapseMotion'>;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Tree slots without any design dependency, used by `useTreeBase_unstable`.
|
|
406
|
+
*/
|
|
407
|
+
export declare type TreeBaseSlots = Pick<TreeSlots, 'root'>;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* State returned by `useTreeBase_unstable`, without design only state and the collapse motion.
|
|
411
|
+
*/
|
|
412
|
+
export declare type TreeBaseState = ComponentState<TreeBaseSlots> & {
|
|
413
|
+
open: boolean;
|
|
414
|
+
} & (DistributiveOmit<TreeContextValue, 'appearance' | 'size'> | SubtreeContextValue);
|
|
415
|
+
|
|
391
416
|
export declare type TreeCheckedChangeData = {
|
|
392
417
|
value: TreeItemValue;
|
|
393
418
|
checkedItems: Map<TreeItemValue, TreeSelectionValue>;
|
|
@@ -464,7 +489,7 @@ export declare type TreeItemContextValue = {
|
|
|
464
489
|
checked: TreeSelectionValue;
|
|
465
490
|
};
|
|
466
491
|
|
|
467
|
-
declare type TreeItemContextValues = {
|
|
492
|
+
export declare type TreeItemContextValues = {
|
|
468
493
|
treeItem: TreeItemContextValue;
|
|
469
494
|
};
|
|
470
495
|
|
|
@@ -479,7 +504,7 @@ export declare type TreeItemCSSProperties = React_2.CSSProperties & {
|
|
|
479
504
|
*/
|
|
480
505
|
export declare const TreeItemLayout: ForwardRefComponent<TreeItemLayoutProps>;
|
|
481
506
|
|
|
482
|
-
declare type TreeItemLayoutActionSlotProps = ExtractSlotProps<Slot<'div'> & {
|
|
507
|
+
export declare type TreeItemLayoutActionSlotProps = ExtractSlotProps<Slot<'div'> & {
|
|
483
508
|
/**
|
|
484
509
|
* Forces visibility of the aside/action content
|
|
485
510
|
*/
|
|
@@ -487,10 +512,29 @@ declare type TreeItemLayoutActionSlotProps = ExtractSlotProps<Slot<'div'> & {
|
|
|
487
512
|
onVisibilityChange?: EventHandler<TreeItemLayoutActionVisibilityChangeData>;
|
|
488
513
|
}>;
|
|
489
514
|
|
|
490
|
-
declare type TreeItemLayoutActionVisibilityChangeData = (EventData<'mouseover' | 'mouseout', MouseEvent> | EventData<'focus' | 'blur', FocusEvent> | EventData<'blur', React_2.FocusEvent>) & {
|
|
515
|
+
export declare type TreeItemLayoutActionVisibilityChangeData = (EventData<'mouseover' | 'mouseout', MouseEvent> | EventData<'focus' | 'blur', FocusEvent> | EventData<'blur', React_2.FocusEvent>) & {
|
|
491
516
|
visible: boolean;
|
|
492
517
|
};
|
|
493
518
|
|
|
519
|
+
/**
|
|
520
|
+
* TreeItemLayout props accepted by `useTreeItemLayoutBase_unstable`.
|
|
521
|
+
*/
|
|
522
|
+
export declare type TreeItemLayoutBaseProps = ComponentProps<Partial<TreeItemLayoutBaseSlots>>;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* TreeItemLayout slots without any design dependency, used by `useTreeItemLayoutBase_unstable`.
|
|
526
|
+
*
|
|
527
|
+
* The selector renders as a native `input`, of type `checkbox` or `radio` depending on the tree selection mode.
|
|
528
|
+
*/
|
|
529
|
+
export declare type TreeItemLayoutBaseSlots = Omit<TreeItemLayoutSlots, 'selector'> & {
|
|
530
|
+
selector?: Slot<'input'>;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* State returned by `useTreeItemLayoutBase_unstable`.
|
|
535
|
+
*/
|
|
536
|
+
export declare type TreeItemLayoutBaseState = ComponentState<TreeItemLayoutBaseSlots>;
|
|
537
|
+
|
|
494
538
|
export declare const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutSlots>;
|
|
495
539
|
|
|
496
540
|
/**
|
|
@@ -867,11 +911,31 @@ export declare function useHeadlessFlatTree_unstable<Props extends HeadlessTreeI
|
|
|
867
911
|
|
|
868
912
|
export declare const useSubtreeContext_unstable: () => SubtreeContextValue;
|
|
869
913
|
|
|
914
|
+
/**
|
|
915
|
+
* Create the state required to render Tree.
|
|
916
|
+
*
|
|
917
|
+
* The returned state can be modified with hooks such as useTreeStyles_unstable,
|
|
918
|
+
* before being passed to renderTree_unstable.
|
|
919
|
+
*
|
|
920
|
+
* @param props - props from this instance of Tree
|
|
921
|
+
* @param ref - reference to root HTMLElement of Tree
|
|
922
|
+
*/
|
|
870
923
|
export declare const useTree_unstable: (props: TreeProps, ref: React_2.Ref<HTMLElement>) => TreeState;
|
|
871
924
|
|
|
925
|
+
/**
|
|
926
|
+
* Base state hook for Tree, free of any design props, motion or focus management runtime.
|
|
927
|
+
*
|
|
928
|
+
* Arrow key navigation and the roving tab index are driven by plain DOM focus handling, and closed
|
|
929
|
+
* subtrees are not rendered as there is no collapse motion to unmount them.
|
|
930
|
+
*
|
|
931
|
+
* @param props - props from this instance of Tree
|
|
932
|
+
* @param ref - reference to root HTMLElement of Tree
|
|
933
|
+
*/
|
|
934
|
+
export declare const useTreeBase_unstable: (props: TreeBaseProps, ref: React_2.Ref<HTMLElement>) => TreeBaseState;
|
|
935
|
+
|
|
872
936
|
export declare const useTreeContext_unstable: <T>(selector: ContextSelector<TreeContextValue, T>) => T;
|
|
873
937
|
|
|
874
|
-
export declare function useTreeContextValues_unstable(state: TreeState): TreeContextValues;
|
|
938
|
+
export declare function useTreeContextValues_unstable(state: TreeState | TreeBaseState): TreeContextValues;
|
|
875
939
|
|
|
876
940
|
/**
|
|
877
941
|
* Create the state required to render TreeItem.
|
|
@@ -899,6 +963,19 @@ export declare function useTreeItemContextValues_unstable(state: TreeItemState):
|
|
|
899
963
|
*/
|
|
900
964
|
export declare const useTreeItemLayout_unstable: (props: TreeItemLayoutProps, ref: React_2.Ref<HTMLElement>) => TreeItemLayoutState;
|
|
901
965
|
|
|
966
|
+
/**
|
|
967
|
+
* Base state hook for TreeItemLayout, free of any focus management runtime and of the Fluent
|
|
968
|
+
* components used for the selector, the expand icon and the actions.
|
|
969
|
+
*
|
|
970
|
+
* The selector slot is rendered as a native `input`, of type `checkbox` in multiselect mode and
|
|
971
|
+
* `radio` in single selection mode, the expand icon has no default content, and the Tabster driven
|
|
972
|
+
* arrow key navigation of the actions is layered on by the wrapping `useTreeItemLayout_unstable` hook.
|
|
973
|
+
*
|
|
974
|
+
* @param props - props from this instance of TreeItemLayout
|
|
975
|
+
* @param ref - reference to root HTMLElement of TreeItemLayout
|
|
976
|
+
*/
|
|
977
|
+
export declare const useTreeItemLayoutBase_unstable: (props: TreeItemLayoutBaseProps, ref: React_2.Ref<HTMLElement>) => TreeItemLayoutBaseState;
|
|
978
|
+
|
|
902
979
|
/**
|
|
903
980
|
* Apply styling to the TreeItemLayout slots based on the state
|
|
904
981
|
*/
|
package/lib/Tree.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Tree, renderTree_unstable, treeClassNames, useTreeContextValues_unstable, useTreeStyles_unstable, useTree_unstable } from "./components/Tree/index.js";
|
|
1
|
+
export { Tree, renderTree_unstable, treeClassNames, useTreeContextValues_unstable, useTreeBase_unstable, useTreeStyles_unstable, useTree_unstable } from "./components/Tree/index.js";
|
package/lib/Tree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Tree.ts"],"sourcesContent":["export type {\n TreeCheckedChangeData,\n TreeCheckedChangeEvent,\n TreeContextValues,\n TreeNavigationData_unstable,\n TreeNavigationEvent_unstable,\n TreeOpenChangeData,\n TreeOpenChangeEvent,\n TreeProps,\n TreeSelectionValue,\n TreeSlots,\n TreeState,\n TreeNavigationMode,\n TreeNavigationDataParam,\n} from './components/Tree/index';\nexport {\n Tree,\n renderTree_unstable,\n treeClassNames,\n useTreeContextValues_unstable,\n useTreeStyles_unstable,\n useTree_unstable,\n} from './components/Tree/index';\n"],"names":["Tree","renderTree_unstable","treeClassNames","useTreeContextValues_unstable","useTreeStyles_unstable","useTree_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/Tree.ts"],"sourcesContent":["export type {\n TreeBaseProps,\n TreeBaseSlots,\n TreeBaseState,\n TreeCheckedChangeData,\n TreeCheckedChangeEvent,\n TreeContextValues,\n TreeNavigationData_unstable,\n TreeNavigationEvent_unstable,\n TreeOpenChangeData,\n TreeOpenChangeEvent,\n TreeProps,\n TreeSelectionValue,\n TreeSlots,\n TreeState,\n TreeNavigationMode,\n TreeNavigationDataParam,\n} from './components/Tree/index';\nexport {\n Tree,\n renderTree_unstable,\n treeClassNames,\n useTreeContextValues_unstable,\n useTreeBase_unstable,\n useTreeStyles_unstable,\n useTree_unstable,\n} from './components/Tree/index';\n"],"names":["Tree","renderTree_unstable","treeClassNames","useTreeContextValues_unstable","useTreeBase_unstable","useTreeStyles_unstable","useTree_unstable"],"mappings":"AAkBA,SACEA,IAAI,EACJC,mBAAmB,EACnBC,cAAc,EACdC,6BAA6B,EAC7BC,oBAAoB,EACpBC,sBAAsB,EACtBC,gBAAgB,QACX,6BAA0B"}
|
package/lib/TreeItemLayout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TreeItemLayout, renderTreeItemLayout_unstable, treeItemLayoutClassNames, useTreeItemLayoutStyles_unstable, useTreeItemLayout_unstable } from "./components/TreeItemLayout/index.js";
|
|
1
|
+
export { TreeItemLayout, renderTreeItemLayout_unstable, treeItemLayoutClassNames, useTreeItemLayoutBase_unstable, useTreeItemLayoutStyles_unstable, useTreeItemLayout_unstable } from "./components/TreeItemLayout/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TreeItemLayout.ts"],"sourcesContent":["export type {\n TreeItemLayoutActionSlotProps,\n TreeItemLayoutActionVisibilityChangeData,\n TreeItemLayoutProps,\n TreeItemLayoutSlots,\n TreeItemLayoutState,\n} from './components/TreeItemLayout/index';\nexport {\n TreeItemLayout,\n renderTreeItemLayout_unstable,\n treeItemLayoutClassNames,\n useTreeItemLayoutStyles_unstable,\n useTreeItemLayout_unstable,\n} from './components/TreeItemLayout/index';\n"],"names":["TreeItemLayout","renderTreeItemLayout_unstable","treeItemLayoutClassNames","useTreeItemLayoutStyles_unstable","useTreeItemLayout_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/TreeItemLayout.ts"],"sourcesContent":["export type {\n TreeItemLayoutActionSlotProps,\n TreeItemLayoutActionVisibilityChangeData,\n TreeItemLayoutBaseProps,\n TreeItemLayoutBaseSlots,\n TreeItemLayoutBaseState,\n TreeItemLayoutProps,\n TreeItemLayoutSlots,\n TreeItemLayoutState,\n} from './components/TreeItemLayout/index';\nexport {\n TreeItemLayout,\n renderTreeItemLayout_unstable,\n treeItemLayoutClassNames,\n useTreeItemLayoutBase_unstable,\n useTreeItemLayoutStyles_unstable,\n useTreeItemLayout_unstable,\n} from './components/TreeItemLayout/index';\n"],"names":["TreeItemLayout","renderTreeItemLayout_unstable","treeItemLayoutClassNames","useTreeItemLayoutBase_unstable","useTreeItemLayoutStyles_unstable","useTreeItemLayout_unstable"],"mappings":"AAUA,SACEA,cAAc,EACdC,6BAA6B,EAC7BC,wBAAwB,EACxBC,8BAA8B,EAC9BC,gCAAgC,EAChCC,0BAA0B,QACrB,uCAAoC"}
|
|
@@ -7,6 +7,8 @@ import { useSubtree } from "../../hooks/useSubtree.js";
|
|
|
7
7
|
import { ImmutableSet } from "../../utils/ImmutableSet.js";
|
|
8
8
|
import { ImmutableMap } from "../../utils/ImmutableMap.js";
|
|
9
9
|
import { SubtreeContext } from "../../contexts/subtreeContext.js";
|
|
10
|
+
import { Collapse } from "@fluentui/react-motion-components-preview";
|
|
11
|
+
import { presenceMotionSlot } from "@fluentui/react-motion";
|
|
10
12
|
export const useFlatTree_unstable = (props, ref)=>{
|
|
11
13
|
const isRoot = React.useContext(SubtreeContext) === undefined;
|
|
12
14
|
// as level is static, this doesn't break rule of hooks
|
|
@@ -15,8 +17,9 @@ export const useFlatTree_unstable = (props, ref)=>{
|
|
|
15
17
|
return isRoot ? useRootFlatTree(props, ref) : useSubFlatTree(props, ref);
|
|
16
18
|
};
|
|
17
19
|
function useRootFlatTree(props, ref) {
|
|
20
|
+
const { appearance = 'subtle', size = 'medium' } = props;
|
|
18
21
|
const navigation = useFlatTreeNavigation(props.navigationMode);
|
|
19
|
-
|
|
22
|
+
const state = useRootTree({
|
|
20
23
|
...props,
|
|
21
24
|
onNavigation: useEventCallback((event, data)=>{
|
|
22
25
|
var _props_onNavigation;
|
|
@@ -25,7 +28,16 @@ function useRootFlatTree(props, ref) {
|
|
|
25
28
|
navigation.navigate(data);
|
|
26
29
|
}
|
|
27
30
|
})
|
|
28
|
-
}, useMergedRefs(ref, navigation.rootRef))
|
|
31
|
+
}, useMergedRefs(ref, navigation.rootRef));
|
|
32
|
+
return Object.assign(state, {
|
|
33
|
+
appearance,
|
|
34
|
+
size,
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
36
|
+
components: {
|
|
37
|
+
...state.components,
|
|
38
|
+
collapseMotion: Collapse
|
|
39
|
+
},
|
|
40
|
+
collapseMotion: undefined,
|
|
29
41
|
treeType: 'flat',
|
|
30
42
|
forceUpdateRovingTabIndex: navigation.forceUpdateRovingTabIndex
|
|
31
43
|
});
|
|
@@ -36,8 +48,21 @@ function useSubFlatTree(props, ref) {
|
|
|
36
48
|
Subtrees are not allowed in a FlatTree!
|
|
37
49
|
You cannot use a <FlatTree> component inside of another <FlatTree> nor a <Tree> component!`);
|
|
38
50
|
}
|
|
51
|
+
const state = useSubtree(props, ref);
|
|
39
52
|
return {
|
|
40
|
-
...
|
|
53
|
+
...state,
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
55
|
+
components: {
|
|
56
|
+
...state.components,
|
|
57
|
+
collapseMotion: Collapse
|
|
58
|
+
},
|
|
59
|
+
collapseMotion: presenceMotionSlot(props.collapseMotion, {
|
|
60
|
+
elementType: Collapse,
|
|
61
|
+
defaultProps: {
|
|
62
|
+
visible: state.open,
|
|
63
|
+
unmountOnExit: true
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
41
66
|
// ------ defaultTreeContextValue
|
|
42
67
|
level: 0,
|
|
43
68
|
contextType: 'root',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/FlatTree/useFlatTree.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useRootTree } from '../../hooks/useRootTree';\nimport type { FlatTreeProps, FlatTreeState } from './FlatTree.types';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFlatTreeNavigation } from '../../hooks/useFlatTreeNavigation';\nimport { useSubtree } from '../../hooks/useSubtree';\nimport { ImmutableSet } from '../../utils/ImmutableSet';\nimport { ImmutableMap } from '../../utils/ImmutableMap';\nimport { SubtreeContext } from '../../contexts/subtreeContext';\n\nexport const useFlatTree_unstable: (props: FlatTreeProps, ref: React.Ref<HTMLElement>) => FlatTreeState = (\n props,\n ref,\n) => {\n const isRoot = React.useContext(SubtreeContext) === undefined;\n // as level is static, this doesn't break rule of hooks\n // and if this becomes an issue later on, this can be easily converted\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isRoot ? useRootFlatTree(props, ref) : useSubFlatTree(props, ref);\n};\n\nfunction useRootFlatTree(props: FlatTreeProps, ref: React.Ref<HTMLElement>): FlatTreeState {\n const navigation = useFlatTreeNavigation(props.navigationMode);\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/FlatTree/useFlatTree.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useRootTree } from '../../hooks/useRootTree';\nimport type { FlatTreeProps, FlatTreeState } from './FlatTree.types';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFlatTreeNavigation } from '../../hooks/useFlatTreeNavigation';\nimport { useSubtree } from '../../hooks/useSubtree';\nimport { ImmutableSet } from '../../utils/ImmutableSet';\nimport { ImmutableMap } from '../../utils/ImmutableMap';\nimport { SubtreeContext } from '../../contexts/subtreeContext';\nimport { Collapse } from '@fluentui/react-motion-components-preview';\nimport { presenceMotionSlot } from '@fluentui/react-motion';\n\nexport const useFlatTree_unstable: (props: FlatTreeProps, ref: React.Ref<HTMLElement>) => FlatTreeState = (\n props,\n ref,\n) => {\n const isRoot = React.useContext(SubtreeContext) === undefined;\n // as level is static, this doesn't break rule of hooks\n // and if this becomes an issue later on, this can be easily converted\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isRoot ? useRootFlatTree(props, ref) : useSubFlatTree(props, ref);\n};\n\nfunction useRootFlatTree(props: FlatTreeProps, ref: React.Ref<HTMLElement>): FlatTreeState {\n const { appearance = 'subtle', size = 'medium' } = props;\n const navigation = useFlatTreeNavigation(props.navigationMode);\n const state = useRootTree(\n {\n ...props,\n onNavigation: useEventCallback((event, data) => {\n props.onNavigation?.(event, data);\n if (!event.isDefaultPrevented()) {\n navigation.navigate(data);\n }\n }),\n },\n useMergedRefs(ref, navigation.rootRef),\n );\n\n return Object.assign(state, {\n appearance,\n size,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, collapseMotion: Collapse },\n collapseMotion: undefined,\n treeType: 'flat',\n forceUpdateRovingTabIndex: navigation.forceUpdateRovingTabIndex,\n } as const);\n}\n\nfunction useSubFlatTree(props: FlatTreeProps, ref: React.Ref<HTMLElement>): FlatTreeState {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(/* #__DE-INDENT__ */ `\n @fluentui/react-tree [useFlatTree]:\n Subtrees are not allowed in a FlatTree!\n You cannot use a <FlatTree> component inside of another <FlatTree> nor a <Tree> component!\n `);\n }\n const state = useSubtree(props, ref);\n return {\n ...state,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, collapseMotion: Collapse },\n collapseMotion: presenceMotionSlot(props.collapseMotion, {\n elementType: Collapse,\n defaultProps: {\n visible: state.open,\n unmountOnExit: true,\n },\n }),\n // ------ defaultTreeContextValue\n level: 0,\n contextType: 'root',\n treeType: 'nested',\n selectionMode: 'none',\n openItems: ImmutableSet.empty,\n checkedItems: ImmutableMap.empty,\n requestTreeResponse: noop,\n forceUpdateRovingTabIndex: noop,\n appearance: 'subtle',\n size: 'medium',\n // ------ defaultTreeContextValue\n open: false,\n };\n}\n\nfunction noop() {\n /* do nothing */\n}\n"],"names":["React","useRootTree","useEventCallback","useMergedRefs","useFlatTreeNavigation","useSubtree","ImmutableSet","ImmutableMap","SubtreeContext","Collapse","presenceMotionSlot","useFlatTree_unstable","props","ref","isRoot","useContext","undefined","useRootFlatTree","useSubFlatTree","appearance","size","navigation","navigationMode","state","onNavigation","event","data","isDefaultPrevented","navigate","rootRef","Object","assign","components","collapseMotion","treeType","forceUpdateRovingTabIndex","process","env","NODE_ENV","Error","elementType","defaultProps","visible","open","unmountOnExit","level","contextType","selectionMode","openItems","empty","checkedItems","requestTreeResponse","noop"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,WAAW,QAAQ,6BAA0B;AAEtD,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AAC5E,SAASC,qBAAqB,QAAQ,uCAAoC;AAC1E,SAASC,UAAU,QAAQ,4BAAyB;AACpD,SAASC,YAAY,QAAQ,8BAA2B;AACxD,SAASC,YAAY,QAAQ,8BAA2B;AACxD,SAASC,cAAc,QAAQ,mCAAgC;AAC/D,SAASC,QAAQ,QAAQ,4CAA4C;AACrE,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,OAAO,MAAMC,uBAA6F,CACxGC,OACAC;IAEA,MAAMC,SAASd,MAAMe,UAAU,CAACP,oBAAoBQ;IACpD,uDAAuD;IACvD,sEAAsE;IACtE,sDAAsD;IACtD,OAAOF,SAASG,gBAAgBL,OAAOC,OAAOK,eAAeN,OAAOC;AACtE,EAAE;AAEF,SAASI,gBAAgBL,KAAoB,EAAEC,GAA2B;IACxE,MAAM,EAAEM,aAAa,QAAQ,EAAEC,OAAO,QAAQ,EAAE,GAAGR;IACnD,MAAMS,aAAajB,sBAAsBQ,MAAMU,cAAc;IAC7D,MAAMC,QAAQtB,YACZ;QACE,GAAGW,KAAK;QACRY,cAActB,iBAAiB,CAACuB,OAAOC;gBACrCd;aAAAA,sBAAAA,MAAMY,YAAY,cAAlBZ,0CAAAA,yBAAAA,OAAqBa,OAAOC;YAC5B,IAAI,CAACD,MAAME,kBAAkB,IAAI;gBAC/BN,WAAWO,QAAQ,CAACF;YACtB;QACF;IACF,GACAvB,cAAcU,KAAKQ,WAAWQ,OAAO;IAGvC,OAAOC,OAAOC,MAAM,CAACR,OAAO;QAC1BJ;QACAC;QACA,4DAA4D;QAC5DY,YAAY;YAAE,GAAGT,MAAMS,UAAU;YAAEC,gBAAgBxB;QAAS;QAC5DwB,gBAAgBjB;QAChBkB,UAAU;QACVC,2BAA2Bd,WAAWc,yBAAyB;IACjE;AACF;AAEA,SAASjB,eAAeN,KAAoB,EAAEC,GAA2B;IACvE,IAAIuB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,MAAM,IAAIC,MAA2B,CAAC;;0FAItC,CAAC;IACH;IACA,MAAMhB,QAAQlB,WAAWO,OAAOC;IAChC,OAAO;QACL,GAAGU,KAAK;QACR,4DAA4D;QAC5DS,YAAY;YAAE,GAAGT,MAAMS,UAAU;YAAEC,gBAAgBxB;QAAS;QAC5DwB,gBAAgBvB,mBAAmBE,MAAMqB,cAAc,EAAE;YACvDO,aAAa/B;YACbgC,cAAc;gBACZC,SAASnB,MAAMoB,IAAI;gBACnBC,eAAe;YACjB;QACF;QACA,iCAAiC;QACjCC,OAAO;QACPC,aAAa;QACbZ,UAAU;QACVa,eAAe;QACfC,WAAW1C,aAAa2C,KAAK;QAC7BC,cAAc3C,aAAa0C,KAAK;QAChCE,qBAAqBC;QACrBjB,2BAA2BiB;QAC3BjC,YAAY;QACZC,MAAM;QACN,iCAAiC;QACjCuB,MAAM;IACR;AACF;AAEA,SAASS;AACP,cAAc,GAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Tree/Tree.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { PresenceMotionSlotProps } from '@fluentui/react-motion';\nimport type { CollapseParams } from '@fluentui/react-motion-components-preview';\nimport type { ComponentProps, ComponentState, SelectionMode, Slot } from '@fluentui/react-utilities';\nimport type { TreeContextValue, SubtreeContextValue } from '../../contexts';\nimport type { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\nimport type { TreeItemValue } from '../TreeItem/TreeItem.types';\nimport type { CheckboxProps } from '@fluentui/react-checkbox';\nimport type { RadioProps } from '@fluentui/react-radio';\n\ntype MultiSelectValue = NonNullable<CheckboxProps['checked']>;\ntype SingleSelectValue = NonNullable<RadioProps['checked']>;\nexport type TreeSelectionValue = MultiSelectValue | SingleSelectValue;\n\nexport type TreeSlots = {\n root: Slot<'div'>;\n collapseMotion?: Slot<PresenceMotionSlotProps<CollapseParams>>;\n};\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationData_unstable = {\n target: HTMLElement;\n value: TreeItemValue;\n parentValue: TreeItemValue | undefined;\n} & (\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 = {\n open: boolean;\n openItems: Set<TreeItemValue>;\n value: TreeItemValue;\n target: HTMLElement;\n} & (\n | { event: React.MouseEvent<HTMLElement>; type: 'ExpandIconClick' }\n | { event: React.MouseEvent<HTMLElement>; type: 'Click' }\n /**\n * @deprecated\n * Use `type: 'Click'` instead of Enter,\n * an enter press will trigger a click event, which will trigger an open change,\n * so there is no need to have a separate type for it.\n */\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof Enter }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowRight }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowLeft }\n);\n\n/**\n * To avoid breaking changes on TreeNavigationData\n * we are creating a new type that extends the old one\n * and adds the new methods\n */\nexport type TreeNavigationDataParam = TreeNavigationData_unstable & {\n preventScroll(): void;\n isScrollPrevented(): boolean;\n};\n\nexport type TreeOpenChangeEvent = TreeOpenChangeData['event'];\n\nexport type TreeCheckedChangeData = {\n value: TreeItemValue;\n checkedItems: Map<TreeItemValue, TreeSelectionValue>;\n target: HTMLElement;\n event: React.ChangeEvent<HTMLElement>;\n type: 'Change';\n} & (\n | {\n selectionMode: 'multiselect';\n checked: MultiSelectValue;\n }\n | {\n selectionMode: 'single';\n checked: SingleSelectValue;\n }\n);\n\nexport type TreeCheckedChangeEvent = TreeCheckedChangeData['event'];\n\nexport type TreeContextValues = {\n tree: TreeContextValue | SubtreeContextValue;\n};\n\nexport type TreeNavigationMode = 'tree' | 'treegrid';\n\nexport type TreeProps = ComponentProps<TreeSlots> & {\n /**\n * Indicates how navigation between a treeitem and its actions work\n * - 'tree' (default): The default navigation, pressing right arrow key navigates inward the first inner children of a branch treeitem\n * - 'treegrid': Pressing right arrow key navigate towards the actions of a treeitem\n * @default 'tree'\n */\n navigationMode?: TreeNavigationMode;\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 * This refers to a list of ids of default opened items.\n * This property is ignored for subtrees.\n */\n defaultOpenItems?: 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 onNavigation?(event: TreeNavigationEvent_unstable, data: TreeNavigationDataParam): 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\n/**\n * State used in rendering Tree\n */\nexport type TreeState = ComponentState<TreeSlots> & {\n open: boolean;\n} & (TreeContextValue | SubtreeContextValue);\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tree/Tree.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { PresenceMotionSlotProps } from '@fluentui/react-motion';\nimport type { CollapseParams } from '@fluentui/react-motion-components-preview';\nimport type { ComponentProps, ComponentState, DistributiveOmit, SelectionMode, Slot } from '@fluentui/react-utilities';\nimport type { TreeContextValue, SubtreeContextValue } from '../../contexts';\nimport type { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\nimport type { TreeItemValue } from '../TreeItem/TreeItem.types';\nimport type { CheckboxProps } from '@fluentui/react-checkbox';\nimport type { RadioProps } from '@fluentui/react-radio';\n\ntype MultiSelectValue = NonNullable<CheckboxProps['checked']>;\ntype SingleSelectValue = NonNullable<RadioProps['checked']>;\nexport type TreeSelectionValue = MultiSelectValue | SingleSelectValue;\n\nexport type TreeSlots = {\n root: Slot<'div'>;\n collapseMotion?: Slot<PresenceMotionSlotProps<CollapseParams>>;\n};\n\n/**\n * Tree slots without any design dependency, used by `useTreeBase_unstable`.\n */\nexport type TreeBaseSlots = Pick<TreeSlots, 'root'>;\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationData_unstable = {\n target: HTMLElement;\n value: TreeItemValue;\n parentValue: TreeItemValue | undefined;\n} & (\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 = {\n open: boolean;\n openItems: Set<TreeItemValue>;\n value: TreeItemValue;\n target: HTMLElement;\n} & (\n | { event: React.MouseEvent<HTMLElement>; type: 'ExpandIconClick' }\n | { event: React.MouseEvent<HTMLElement>; type: 'Click' }\n /**\n * @deprecated\n * Use `type: 'Click'` instead of Enter,\n * an enter press will trigger a click event, which will trigger an open change,\n * so there is no need to have a separate type for it.\n */\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof Enter }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowRight }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowLeft }\n);\n\n/**\n * To avoid breaking changes on TreeNavigationData\n * we are creating a new type that extends the old one\n * and adds the new methods\n */\nexport type TreeNavigationDataParam = TreeNavigationData_unstable & {\n preventScroll(): void;\n isScrollPrevented(): boolean;\n};\n\nexport type TreeOpenChangeEvent = TreeOpenChangeData['event'];\n\nexport type TreeCheckedChangeData = {\n value: TreeItemValue;\n checkedItems: Map<TreeItemValue, TreeSelectionValue>;\n target: HTMLElement;\n event: React.ChangeEvent<HTMLElement>;\n type: 'Change';\n} & (\n | {\n selectionMode: 'multiselect';\n checked: MultiSelectValue;\n }\n | {\n selectionMode: 'single';\n checked: SingleSelectValue;\n }\n);\n\nexport type TreeCheckedChangeEvent = TreeCheckedChangeData['event'];\n\nexport type TreeContextValues = {\n tree: TreeContextValue | SubtreeContextValue;\n};\n\nexport type TreeNavigationMode = 'tree' | 'treegrid';\n\nexport type TreeProps = ComponentProps<TreeSlots> & {\n /**\n * Indicates how navigation between a treeitem and its actions work\n * - 'tree' (default): The default navigation, pressing right arrow key navigates inward the first inner children of a branch treeitem\n * - 'treegrid': Pressing right arrow key navigate towards the actions of a treeitem\n * @default 'tree'\n */\n navigationMode?: TreeNavigationMode;\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 * This refers to a list of ids of default opened items.\n * This property is ignored for subtrees.\n */\n defaultOpenItems?: 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 onNavigation?(event: TreeNavigationEvent_unstable, data: TreeNavigationDataParam): 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\n/**\n * State used in rendering Tree\n */\nexport type TreeState = ComponentState<TreeSlots> & {\n open: boolean;\n} & (TreeContextValue | SubtreeContextValue);\n\n/**\n * Tree props accepted by `useTreeBase_unstable`, without design only props and the collapse motion.\n */\nexport type TreeBaseProps = Omit<TreeProps, 'appearance' | 'size' | 'collapseMotion'>;\n\n/**\n * State returned by `useTreeBase_unstable`, without design only state and the collapse motion.\n */\nexport type TreeBaseState = ComponentState<TreeBaseSlots> & {\n open: boolean;\n} & (DistributiveOmit<TreeContextValue, 'appearance' | 'size'> | SubtreeContextValue);\n"],"names":[],"mappings":"AA8LA;;CAEC,GACD,WAEsF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Tree } from "./Tree.js";
|
|
2
|
-
export { useTree_unstable } from "./useTree.js";
|
|
2
|
+
export { useTreeBase_unstable, useTree_unstable } from "./useTree.js";
|
|
3
3
|
export { useTreeContextValues_unstable } from "./useTreeContextValues.js";
|
|
4
4
|
export { treeClassNames, useTreeStyles_unstable } from "./useTreeStyles.styles.js";
|
|
5
5
|
export { renderTree_unstable } from "./renderTree.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Tree/index.ts"],"sourcesContent":["export { Tree } from './Tree';\nexport type {\n TreeCheckedChangeData,\n TreeCheckedChangeEvent,\n TreeContextValues,\n TreeNavigationData_unstable,\n TreeNavigationEvent_unstable,\n TreeOpenChangeData,\n TreeOpenChangeEvent,\n TreeProps,\n TreeSelectionValue,\n TreeSlots,\n TreeState,\n TreeNavigationMode,\n TreeNavigationDataParam,\n} from './Tree.types';\nexport { useTree_unstable } from './useTree';\nexport { useTreeContextValues_unstable } from './useTreeContextValues';\nexport { treeClassNames, useTreeStyles_unstable } from './useTreeStyles.styles';\nexport { renderTree_unstable } from './renderTree';\n"],"names":["Tree","useTree_unstable","useTreeContextValues_unstable","treeClassNames","useTreeStyles_unstable","renderTree_unstable"],"mappings":"AAAA,SAASA,IAAI,QAAQ,YAAS;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tree/index.ts"],"sourcesContent":["export { Tree } from './Tree';\nexport type {\n TreeBaseProps,\n TreeBaseSlots,\n TreeBaseState,\n TreeCheckedChangeData,\n TreeCheckedChangeEvent,\n TreeContextValues,\n TreeNavigationData_unstable,\n TreeNavigationEvent_unstable,\n TreeOpenChangeData,\n TreeOpenChangeEvent,\n TreeProps,\n TreeSelectionValue,\n TreeSlots,\n TreeState,\n TreeNavigationMode,\n TreeNavigationDataParam,\n} from './Tree.types';\nexport { useTreeBase_unstable, useTree_unstable } from './useTree';\nexport { useTreeContextValues_unstable } from './useTreeContextValues';\nexport { treeClassNames, useTreeStyles_unstable } from './useTreeStyles.styles';\nexport { renderTree_unstable } from './renderTree';\n"],"names":["Tree","useTreeBase_unstable","useTree_unstable","useTreeContextValues_unstable","treeClassNames","useTreeStyles_unstable","renderTree_unstable"],"mappings":"AAAA,SAASA,IAAI,QAAQ,YAAS;AAmB9B,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,eAAY;AACnE,SAASC,6BAA6B,QAAQ,4BAAyB;AACvE,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,4BAAyB;AAChF,SAASC,mBAAmB,QAAQ,kBAAe"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
import { TreeProvider } from "../TreeProvider.js";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of Tree.
|
|
6
|
+
*
|
|
7
|
+
* Without a collapse motion, as produced by `useTreeBase_unstable`, a closed subtree is not rendered.
|
|
8
|
+
*/ export const renderTree_unstable = (state, contextValues)=>{
|
|
5
9
|
assertSlots(state);
|
|
6
10
|
return /*#__PURE__*/ _jsx(TreeProvider, {
|
|
7
11
|
value: contextValues.tree,
|
|
8
12
|
children: state.collapseMotion ? /*#__PURE__*/ _jsx(state.collapseMotion, {
|
|
9
13
|
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
10
|
-
}) : /*#__PURE__*/ _jsx(state.root, {})
|
|
14
|
+
}) : state.open ? /*#__PURE__*/ _jsx(state.root, {}) : null
|
|
11
15
|
});
|
|
12
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Tree/renderTree.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TreeContextValues, TreeSlots, TreeState } from '../Tree/Tree.types';\nimport { TreeProvider } from '../TreeProvider';\n\nexport const renderTree_unstable = (state: TreeState, contextValues: TreeContextValues): JSXElement => {\n assertSlots<TreeSlots>(state);\n return (\n <TreeProvider value={contextValues.tree}>\n {state.collapseMotion ? (\n <state.collapseMotion>\n <state.root />\n </state.collapseMotion>\n ) : (\n <state.root />\n )}\n </TreeProvider>\n );\n};\n"],"names":["assertSlots","TreeProvider","renderTree_unstable","state","contextValues","value","tree","collapseMotion","root"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GACjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,YAAY,QAAQ,qBAAkB;AAE/C,OAAO,MAAMC,sBAAsB,CAACC,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tree/renderTree.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TreeBaseState, TreeContextValues, TreeSlots, TreeState } from '../Tree/Tree.types';\nimport { TreeProvider } from '../TreeProvider';\n\n/**\n * Render the final JSX of Tree.\n *\n * Without a collapse motion, as produced by `useTreeBase_unstable`, a closed subtree is not rendered.\n */\nexport const renderTree_unstable = (state: TreeState | TreeBaseState, contextValues: TreeContextValues): JSXElement => {\n assertSlots<TreeSlots>(state);\n return (\n <TreeProvider value={contextValues.tree}>\n {state.collapseMotion ? (\n <state.collapseMotion>\n <state.root />\n </state.collapseMotion>\n ) : state.open ? (\n <state.root />\n ) : null}\n </TreeProvider>\n );\n};\n"],"names":["assertSlots","TreeProvider","renderTree_unstable","state","contextValues","value","tree","collapseMotion","root","open"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GACjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,YAAY,QAAQ,qBAAkB;AAE/C;;;;CAIC,GACD,OAAO,MAAMC,sBAAsB,CAACC,OAAkCC;IACpEJ,YAAuBG;IACvB,qBACE,KAACF;QAAaI,OAAOD,cAAcE,IAAI;kBACpCH,MAAMI,cAAc,iBACnB,KAACJ,MAAMI,cAAc;sBACnB,cAAA,KAACJ,MAAMK,IAAI;aAEXL,MAAMM,IAAI,iBACZ,KAACN,MAAMK,IAAI,QACT;;AAGV,EAAE"}
|