@fluentui/react-tree 9.75.0-experimental.css-modules.20261031-810ab07afb.0 → 9.75.1-experimental.css-modules.20261103-d6c85ee2a9.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +28 -19
  2. package/README.md +1 -1
  3. package/dist/index.d.cts +83 -6
  4. package/dist/index.d.ts +83 -6
  5. package/lib/Tree.js +1 -1
  6. package/lib/Tree.js.map +1 -1
  7. package/lib/TreeItemLayout.js +1 -1
  8. package/lib/TreeItemLayout.js.map +1 -1
  9. package/lib/components/FlatTree/FlatTree.module.css +1 -1
  10. package/lib/components/FlatTree/useFlatTree.js +28 -3
  11. package/lib/components/FlatTree/useFlatTree.js.map +1 -1
  12. package/lib/components/Tree/Tree.module.css +1 -1
  13. package/lib/components/Tree/Tree.types.js +1 -1
  14. package/lib/components/Tree/Tree.types.js.map +1 -1
  15. package/lib/components/Tree/index.js +1 -1
  16. package/lib/components/Tree/index.js.map +1 -1
  17. package/lib/components/Tree/renderTree.js +6 -2
  18. package/lib/components/Tree/renderTree.js.map +1 -1
  19. package/lib/components/Tree/useTree.js +75 -6
  20. package/lib/components/Tree/useTree.js.map +1 -1
  21. package/lib/components/Tree/useTreeContextValues.js +4 -1
  22. package/lib/components/Tree/useTreeContextValues.js.map +1 -1
  23. package/lib/components/TreeItem/TreeItem.module.css +1 -1
  24. package/lib/components/TreeItemLayout/TreeItemLayout.module.css +1 -1
  25. package/lib/components/TreeItemLayout/TreeItemLayout.types.js +1 -1
  26. package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
  27. package/lib/components/TreeItemLayout/index.js +1 -1
  28. package/lib/components/TreeItemLayout/index.js.map +1 -1
  29. package/lib/components/TreeItemLayout/renderTreeItemLayout.js +13 -7
  30. package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
  31. package/lib/components/TreeItemLayout/useTreeItemLayout.js +201 -30
  32. package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
  33. package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.module.css +1 -1
  34. package/lib/hooks/useFlatTreeNavigation.js +3 -4
  35. package/lib/hooks/useFlatTreeNavigation.js.map +1 -1
  36. package/lib/hooks/useRootTree.js +3 -8
  37. package/lib/hooks/useRootTree.js.map +1 -1
  38. package/lib/hooks/useRovingTabIndexBase.js +108 -0
  39. package/lib/hooks/useRovingTabIndexBase.js.map +1 -0
  40. package/lib/hooks/useRovingTabIndexes.js +2 -61
  41. package/lib/hooks/useRovingTabIndexes.js.map +1 -1
  42. package/lib/hooks/useSubtree.js +1 -11
  43. package/lib/hooks/useSubtree.js.map +1 -1
  44. package/lib/hooks/useTreeNavigation.js +6 -84
  45. package/lib/hooks/useTreeNavigation.js.map +1 -1
  46. package/lib/hooks/useTreeNavigationBase.js +131 -0
  47. package/lib/hooks/useTreeNavigationBase.js.map +1 -0
  48. package/lib/index.js +2 -2
  49. package/lib/index.js.map +1 -1
  50. package/lib/utils/queryTreeItemActions.js +29 -0
  51. package/lib/utils/queryTreeItemActions.js.map +1 -0
  52. package/lib-commonjs/Tree.cjs +3 -0
  53. package/lib-commonjs/Tree.cjs.map +1 -1
  54. package/lib-commonjs/TreeItemLayout.cjs +3 -0
  55. package/lib-commonjs/TreeItemLayout.cjs.map +1 -1
  56. package/lib-commonjs/components/FlatTree/FlatTree.module.css +1 -1
  57. package/lib-commonjs/components/FlatTree/useFlatTree.cjs +28 -3
  58. package/lib-commonjs/components/FlatTree/useFlatTree.cjs.map +1 -1
  59. package/lib-commonjs/components/Tree/Tree.module.css +1 -1
  60. package/lib-commonjs/components/Tree/Tree.types.cjs +1 -1
  61. package/lib-commonjs/components/Tree/Tree.types.cjs.map +1 -1
  62. package/lib-commonjs/components/Tree/index.cjs +3 -0
  63. package/lib-commonjs/components/Tree/index.cjs.map +1 -1
  64. package/lib-commonjs/components/Tree/renderTree.cjs +1 -1
  65. package/lib-commonjs/components/Tree/renderTree.cjs.map +1 -1
  66. package/lib-commonjs/components/Tree/useTree.cjs +68 -8
  67. package/lib-commonjs/components/Tree/useTree.cjs.map +1 -1
  68. package/lib-commonjs/components/Tree/useTreeContextValues.cjs +4 -1
  69. package/lib-commonjs/components/Tree/useTreeContextValues.cjs.map +1 -1
  70. package/lib-commonjs/components/TreeItem/TreeItem.module.css +1 -1
  71. package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.module.css +1 -1
  72. package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs +1 -1
  73. package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs.map +1 -1
  74. package/lib-commonjs/components/TreeItemLayout/index.cjs +3 -0
  75. package/lib-commonjs/components/TreeItemLayout/index.cjs.map +1 -1
  76. package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs +9 -6
  77. package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs.map +1 -1
  78. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs +200 -32
  79. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs.map +1 -1
  80. package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.module.css +1 -1
  81. package/lib-commonjs/hooks/useFlatTreeNavigation.cjs +3 -4
  82. package/lib-commonjs/hooks/useFlatTreeNavigation.cjs.map +1 -1
  83. package/lib-commonjs/hooks/useRootTree.cjs +3 -8
  84. package/lib-commonjs/hooks/useRootTree.cjs.map +1 -1
  85. package/lib-commonjs/hooks/useRovingTabIndexBase.cjs +116 -0
  86. package/lib-commonjs/hooks/useRovingTabIndexBase.cjs.map +1 -0
  87. package/lib-commonjs/hooks/useRovingTabIndexes.cjs +2 -62
  88. package/lib-commonjs/hooks/useRovingTabIndexes.cjs.map +1 -1
  89. package/lib-commonjs/hooks/useSubtree.cjs +1 -11
  90. package/lib-commonjs/hooks/useSubtree.cjs.map +1 -1
  91. package/lib-commonjs/hooks/useTreeNavigation.cjs +5 -84
  92. package/lib-commonjs/hooks/useTreeNavigation.cjs.map +1 -1
  93. package/lib-commonjs/hooks/useTreeNavigationBase.cjs +140 -0
  94. package/lib-commonjs/hooks/useTreeNavigationBase.cjs.map +1 -0
  95. package/lib-commonjs/index.cjs +6 -0
  96. package/lib-commonjs/index.cjs.map +1 -1
  97. package/lib-commonjs/utils/queryTreeItemActions.cjs +38 -0
  98. package/lib-commonjs/utils/queryTreeItemActions.cjs.map +1 -0
  99. package/package.json +15 -15
package/CHANGELOG.md CHANGED
@@ -1,31 +1,40 @@
1
1
  # Change Log - @fluentui/react-tree
2
2
 
3
- <!-- This log was last generated on Sat, 31 Oct 2026 11:08:41 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Tue, 03 Nov 2026 14:02:48 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [9.75.0-experimental.css-modules.20261031-810ab07afb.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
7
+ ## [9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0)
8
8
 
9
- Sat, 31 Oct 2026 11:08:41 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.16.10..@fluentui/react-tree_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
9
+ Tue, 03 Nov 2026 14:02:48 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.17.0..@fluentui/react-tree_v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0)
11
11
 
12
12
  ### Changes
13
13
 
14
- - Release 9.75.0-experimental.css-modules.20261031-810ab07afb ([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.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
16
- - Bump @fluentui/react-aria to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
17
- - Bump @fluentui/react-avatar to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
18
- - Bump @fluentui/react-button to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
19
- - Bump @fluentui/react-checkbox to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
20
- - Bump @fluentui/react-context-selector to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
21
- - Bump @fluentui/react-jsx-runtime to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
22
- - Bump @fluentui/react-motion to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
23
- - Bump @fluentui/react-motion-components-preview to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
24
- - Bump @fluentui/react-radio to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
25
- - Bump @fluentui/react-shared-contexts to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
26
- - Bump @fluentui/react-tabster to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
27
- - Bump @fluentui/react-theme to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
28
- - Bump @fluentui/react-utilities to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
14
+ - Release 9.75.1-experimental.css-modules.20261103-d6c85ee2a9 ([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.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
16
+ - Bump @fluentui/react-aria to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
17
+ - Bump @fluentui/react-avatar to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
18
+ - Bump @fluentui/react-button to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
19
+ - Bump @fluentui/react-checkbox to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
20
+ - Bump @fluentui/react-context-selector to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
21
+ - Bump @fluentui/react-jsx-runtime to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
22
+ - Bump @fluentui/react-motion to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
23
+ - Bump @fluentui/react-motion-components-preview to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
24
+ - Bump @fluentui/react-radio to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
25
+ - Bump @fluentui/react-shared-contexts to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
26
+ - Bump @fluentui/react-tabster to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
27
+ - Bump @fluentui/react-theme to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
28
+ - Bump @fluentui/react-utilities to v9.75.1-experimental.css-modules.20261103-d6c85ee2a9.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
@@ -11,7 +11,7 @@ Tree, FlatTree, TreeItem, TreeItemLayout, and TreeItemPersonaLayout have alterna
11
11
  The default components continue to use Griffel. An opt-in bundler resolver can replace
12
12
  `use<Component>Styles.styles.js` with `use<Component>Styles.styles.css.js`
13
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
14
+ their CSS Modules imports; all rules are in `@layer fluent`. Apply the same selection
15
15
  to client and server bundles. Within-package composed alternatives import their CSS
16
16
  base hook explicitly. These alternatives do not make composed external components
17
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
- export declare const renderTree_unstable: (state: TreeState, contextValues: TreeContextValues) => JSXElement;
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
- export declare const renderTree_unstable: (state: TreeState, contextValues: TreeContextValues) => JSXElement;
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":"AAeA,SACEA,IAAI,EACJC,mBAAmB,EACnBC,cAAc,EACdC,6BAA6B,EAC7BC,sBAAsB,EACtBC,gBAAgB,QACX,6BAA0B"}
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"}
@@ -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":"AAOA,SACEA,cAAc,EACdC,6BAA6B,EAC7BC,wBAAwB,EACxBC,gCAAgC,EAChCC,0BAA0B,QACrB,uCAAoC"}
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"}
@@ -1,4 +1,4 @@
1
- @layer fluentui {
1
+ @layer fluent {
2
2
  .root {
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -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
- return Object.assign(useRootTree({
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
- ...useSubtree(props, ref),
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\n return Object.assign(\n 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 treeType: 'flat',\n forceUpdateRovingTabIndex: navigation.forceUpdateRovingTabIndex,\n } as const,\n );\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 return {\n ...useSubtree(props, ref),\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","useFlatTree_unstable","props","ref","isRoot","useContext","undefined","useRootFlatTree","useSubFlatTree","navigation","navigationMode","Object","assign","onNavigation","event","data","isDefaultPrevented","navigate","rootRef","treeType","forceUpdateRovingTabIndex","process","env","NODE_ENV","Error","level","contextType","selectionMode","openItems","empty","checkedItems","requestTreeResponse","noop","appearance","size","open"],"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;AAE/D,OAAO,MAAMC,uBAA6F,CACxGC,OACAC;IAEA,MAAMC,SAASZ,MAAMa,UAAU,CAACL,oBAAoBM;IACpD,uDAAuD;IACvD,sEAAsE;IACtE,sDAAsD;IACtD,OAAOF,SAASG,gBAAgBL,OAAOC,OAAOK,eAAeN,OAAOC;AACtE,EAAE;AAEF,SAASI,gBAAgBL,KAAoB,EAAEC,GAA2B;IACxE,MAAMM,aAAab,sBAAsBM,MAAMQ,cAAc;IAE7D,OAAOC,OAAOC,MAAM,CAClBnB,YACE;QACE,GAAGS,KAAK;QACRW,cAAcnB,iBAAiB,CAACoB,OAAOC;gBACrCb;aAAAA,sBAAAA,MAAMW,YAAY,cAAlBX,0CAAAA,yBAAAA,OAAqBY,OAAOC;YAC5B,IAAI,CAACD,MAAME,kBAAkB,IAAI;gBAC/BP,WAAWQ,QAAQ,CAACF;YACtB;QACF;IACF,GACApB,cAAcQ,KAAKM,WAAWS,OAAO,IAEvC;QACEC,UAAU;QACVC,2BAA2BX,WAAWW,yBAAyB;IACjE;AAEJ;AAEA,SAASZ,eAAeN,KAAoB,EAAEC,GAA2B;IACvE,IAAIkB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,MAAM,IAAIC,MAA2B,CAAC;;0FAItC,CAAC;IACH;IACA,OAAO;QACL,GAAG3B,WAAWK,OAAOC,IAAI;QACzB,iCAAiC;QACjCsB,OAAO;QACPC,aAAa;QACbP,UAAU;QACVQ,eAAe;QACfC,WAAW9B,aAAa+B,KAAK;QAC7BC,cAAc/B,aAAa8B,KAAK;QAChCE,qBAAqBC;QACrBZ,2BAA2BY;QAC3BC,YAAY;QACZC,MAAM;QACN,iCAAiC;QACjCC,MAAM;IACR;AACF;AAEA,SAASH;AACP,cAAc,GAChB"}
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,4 +1,4 @@
1
- @layer fluentui {
1
+ @layer fluent {
2
2
  .root {
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -1,3 +1,3 @@
1
1
  /**
2
- * State used in rendering Tree
2
+ * State returned by `useTreeBase_unstable`, without design only state and the collapse motion.
3
3
  */ export { };
@@ -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":"AA6KA;;CAEC,GACD,WAE6C"}
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;AAgB9B,SAASC,gBAAgB,QAAQ,eAAY;AAC7C,SAASC,6BAA6B,QAAQ,4BAAyB;AACvE,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,4BAAyB;AAChF,SAASC,mBAAmB,QAAQ,kBAAe"}
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
- export const renderTree_unstable = (state, contextValues)=>{
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,OAAkBC;IACpDJ,YAAuBG;IACvB,qBACE,KAACF;QAAaI,OAAOD,cAAcE,IAAI;kBACpCH,MAAMI,cAAc,iBACnB,KAACJ,MAAMI,cAAc;sBACnB,cAAA,KAACJ,MAAMK,IAAI;2BAGb,KAACL,MAAMK,IAAI;;AAInB,EAAE"}
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"}