@fluentui/react-tree 9.0.0-beta.26 → 9.0.0-beta.28

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 (169) hide show
  1. package/CHANGELOG.json +85 -1
  2. package/CHANGELOG.md +29 -2
  3. package/dist/index.d.ts +160 -96
  4. package/lib/FlatTree.js +1 -0
  5. package/lib/FlatTree.js.map +1 -0
  6. package/lib/components/FlatTree/FlatTree.js +13 -0
  7. package/lib/components/FlatTree/FlatTree.js.map +1 -0
  8. package/lib/components/FlatTree/FlatTree.types.js +1 -0
  9. package/lib/components/FlatTree/FlatTree.types.js.map +1 -0
  10. package/lib/components/FlatTree/index.js +6 -0
  11. package/lib/components/FlatTree/index.js.map +1 -0
  12. package/lib/{hooks → components/FlatTree}/useFlatControllableCheckedItems.js +10 -23
  13. package/lib/components/FlatTree/useFlatControllableCheckedItems.js.map +1 -0
  14. package/lib/components/FlatTree/useFlatTree.js +3 -0
  15. package/lib/components/FlatTree/useFlatTree.js.map +1 -0
  16. package/lib/{hooks → components/FlatTree}/useFlatTreeNavigation.js +12 -12
  17. package/lib/components/FlatTree/useFlatTreeNavigation.js.map +1 -0
  18. package/lib/components/FlatTree/useFlatTreeStyles.styles.js +30 -0
  19. package/lib/components/FlatTree/useFlatTreeStyles.styles.js.map +1 -0
  20. package/lib/{hooks/useFlatTree.js → components/FlatTree/useHeadlessFlatTree.js} +8 -14
  21. package/lib/components/FlatTree/useHeadlessFlatTree.js.map +1 -0
  22. package/lib/components/Tree/Tree.js +4 -9
  23. package/lib/components/Tree/Tree.js.map +1 -1
  24. package/lib/components/Tree/Tree.types.js.map +1 -1
  25. package/lib/components/Tree/index.js +2 -2
  26. package/lib/components/Tree/index.js.map +1 -1
  27. package/lib/components/Tree/renderTree.js.map +1 -1
  28. package/lib/{hooks/useNestedControllableCheckedItems.js → components/Tree/useControllableCheckedItems.js} +5 -18
  29. package/lib/components/Tree/useControllableCheckedItems.js.map +1 -0
  30. package/lib/components/Tree/useTree.js +38 -14
  31. package/lib/components/Tree/useTree.js.map +1 -1
  32. package/lib/components/Tree/useTreeContextValues.js.map +1 -1
  33. package/lib/{hooks/useNestedTreeNavigation.js → components/Tree/useTreeNavigation.js} +6 -6
  34. package/lib/components/Tree/useTreeNavigation.js.map +1 -0
  35. package/lib/components/Tree/useTreeStyles.styles.js +2 -2
  36. package/lib/components/Tree/useTreeStyles.styles.js.map +1 -1
  37. package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
  38. package/lib/components/TreeItem/renderTreeItem.js +2 -4
  39. package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
  40. package/lib/components/TreeItem/useTreeItem.js +10 -56
  41. package/lib/components/TreeItem/useTreeItem.js.map +1 -1
  42. package/lib/components/TreeItem/useTreeItemContextValues.js +8 -16
  43. package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
  44. package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
  45. package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
  46. package/lib/components/TreeItemLayout/useTreeItemLayout.js +50 -7
  47. package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
  48. package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
  49. package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +1 -1
  50. package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
  51. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +6 -1
  52. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
  53. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js +5 -1
  54. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -1
  55. package/lib/contexts/index.js +0 -1
  56. package/lib/contexts/index.js.map +1 -1
  57. package/lib/contexts/treeContext.js.map +1 -1
  58. package/lib/contexts/treeItemContext.js +5 -0
  59. package/lib/contexts/treeItemContext.js.map +1 -1
  60. package/lib/hooks/useControllableOpenItems.js +6 -3
  61. package/lib/hooks/useControllableOpenItems.js.map +1 -1
  62. package/lib/{components/Tree → hooks}/useRootTree.js +18 -25
  63. package/lib/hooks/useRootTree.js.map +1 -0
  64. package/lib/{components/Tree → hooks}/useSubtree.js +4 -4
  65. package/lib/hooks/useSubtree.js.map +1 -0
  66. package/lib/index.js +2 -2
  67. package/lib/index.js.map +1 -1
  68. package/lib/utils/ImmutableMap.js +4 -0
  69. package/lib/utils/ImmutableMap.js.map +1 -1
  70. package/lib/utils/ImmutableSet.js +4 -0
  71. package/lib/utils/ImmutableSet.js.map +1 -1
  72. package/lib/utils/createCheckedItems.js +18 -0
  73. package/lib/utils/createCheckedItems.js.map +1 -0
  74. package/lib/utils/{createFlatTreeItems.js → createHeadlessTree.js} +45 -45
  75. package/lib/utils/createHeadlessTree.js.map +1 -0
  76. package/lib/utils/createOpenItems.js +10 -0
  77. package/lib/utils/createOpenItems.js.map +1 -0
  78. package/lib/utils/flattenTree.js.map +1 -1
  79. package/lib-commonjs/FlatTree.js +6 -0
  80. package/lib-commonjs/FlatTree.js.map +1 -0
  81. package/lib-commonjs/components/FlatTree/FlatTree.js +20 -0
  82. package/lib-commonjs/components/FlatTree/FlatTree.js.map +1 -0
  83. package/lib-commonjs/components/FlatTree/FlatTree.types.js +4 -0
  84. package/lib-commonjs/components/FlatTree/FlatTree.types.js.map +1 -0
  85. package/lib-commonjs/components/FlatTree/index.js +21 -0
  86. package/lib-commonjs/components/FlatTree/index.js.map +1 -0
  87. package/lib-commonjs/{hooks → components/FlatTree}/useFlatControllableCheckedItems.js +10 -23
  88. package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.js.map +1 -0
  89. package/lib-commonjs/components/FlatTree/useFlatTree.js +12 -0
  90. package/lib-commonjs/components/FlatTree/useFlatTree.js.map +1 -0
  91. package/lib-commonjs/{hooks → components/FlatTree}/useFlatTreeNavigation.js +12 -12
  92. package/lib-commonjs/components/FlatTree/useFlatTreeNavigation.js.map +1 -0
  93. package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.js +53 -0
  94. package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.js.map +1 -0
  95. package/lib-commonjs/{hooks/useFlatTree.js → components/FlatTree/useHeadlessFlatTree.js} +10 -16
  96. package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js.map +1 -0
  97. package/lib-commonjs/components/Tree/Tree.js +3 -3
  98. package/lib-commonjs/components/Tree/Tree.js.map +1 -1
  99. package/lib-commonjs/components/Tree/index.js +2 -2
  100. package/lib-commonjs/components/Tree/index.js.map +1 -1
  101. package/lib-commonjs/{hooks/useNestedControllableCheckedItems.js → components/Tree/useControllableCheckedItems.js} +7 -20
  102. package/lib-commonjs/components/Tree/useControllableCheckedItems.js.map +1 -0
  103. package/lib-commonjs/components/Tree/useTree.js +38 -6
  104. package/lib-commonjs/components/Tree/useTree.js.map +1 -1
  105. package/lib-commonjs/{hooks/useNestedTreeNavigation.js → components/Tree/useTreeNavigation.js} +8 -8
  106. package/lib-commonjs/components/Tree/useTreeNavigation.js.map +1 -0
  107. package/lib-commonjs/components/Tree/useTreeStyles.styles.js +2 -2
  108. package/lib-commonjs/components/Tree/useTreeStyles.styles.js.map +1 -1
  109. package/lib-commonjs/components/TreeItem/renderTreeItem.js +1 -3
  110. package/lib-commonjs/components/TreeItem/renderTreeItem.js.map +1 -1
  111. package/lib-commonjs/components/TreeItem/useTreeItem.js +9 -55
  112. package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
  113. package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js +8 -17
  114. package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js.map +1 -1
  115. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +48 -5
  116. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
  117. package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +1 -1
  118. package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
  119. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +6 -1
  120. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
  121. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js +5 -1
  122. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -1
  123. package/lib-commonjs/contexts/index.js +0 -1
  124. package/lib-commonjs/contexts/index.js.map +1 -1
  125. package/lib-commonjs/contexts/treeItemContext.js +5 -0
  126. package/lib-commonjs/contexts/treeItemContext.js.map +1 -1
  127. package/lib-commonjs/hooks/useControllableOpenItems.js +3 -2
  128. package/lib-commonjs/hooks/useControllableOpenItems.js.map +1 -1
  129. package/lib-commonjs/{components/Tree → hooks}/useRootTree.js +15 -22
  130. package/lib-commonjs/hooks/useRootTree.js.map +1 -0
  131. package/lib-commonjs/{components/Tree → hooks}/useSubtree.js +10 -10
  132. package/lib-commonjs/hooks/useSubtree.js.map +1 -0
  133. package/lib-commonjs/index.js +10 -4
  134. package/lib-commonjs/index.js.map +1 -1
  135. package/lib-commonjs/utils/ImmutableMap.js +4 -0
  136. package/lib-commonjs/utils/ImmutableMap.js.map +1 -1
  137. package/lib-commonjs/utils/ImmutableSet.js +4 -0
  138. package/lib-commonjs/utils/ImmutableSet.js.map +1 -1
  139. package/lib-commonjs/utils/createCheckedItems.js +26 -0
  140. package/lib-commonjs/utils/createCheckedItems.js.map +1 -0
  141. package/lib-commonjs/utils/{createFlatTreeItems.js → createHeadlessTree.js} +47 -47
  142. package/lib-commonjs/utils/createHeadlessTree.js.map +1 -0
  143. package/lib-commonjs/utils/createOpenItems.js +18 -0
  144. package/lib-commonjs/utils/createOpenItems.js.map +1 -0
  145. package/package.json +8 -8
  146. package/lib/components/Tree/useRootTree.js.map +0 -1
  147. package/lib/components/Tree/useSubtree.js.map +0 -1
  148. package/lib/contexts/treeItemSlotsContext.js +0 -9
  149. package/lib/contexts/treeItemSlotsContext.js.map +0 -1
  150. package/lib/hooks/index.js +0 -5
  151. package/lib/hooks/index.js.map +0 -1
  152. package/lib/hooks/useFlatControllableCheckedItems.js.map +0 -1
  153. package/lib/hooks/useFlatTree.js.map +0 -1
  154. package/lib/hooks/useFlatTreeNavigation.js.map +0 -1
  155. package/lib/hooks/useNestedControllableCheckedItems.js.map +0 -1
  156. package/lib/hooks/useNestedTreeNavigation.js.map +0 -1
  157. package/lib/utils/createFlatTreeItems.js.map +0 -1
  158. package/lib-commonjs/components/Tree/useRootTree.js.map +0 -1
  159. package/lib-commonjs/components/Tree/useSubtree.js.map +0 -1
  160. package/lib-commonjs/contexts/treeItemSlotsContext.js +0 -25
  161. package/lib-commonjs/contexts/treeItemSlotsContext.js.map +0 -1
  162. package/lib-commonjs/hooks/index.js +0 -10
  163. package/lib-commonjs/hooks/index.js.map +0 -1
  164. package/lib-commonjs/hooks/useFlatControllableCheckedItems.js.map +0 -1
  165. package/lib-commonjs/hooks/useFlatTree.js.map +0 -1
  166. package/lib-commonjs/hooks/useFlatTreeNavigation.js.map +0 -1
  167. package/lib-commonjs/hooks/useNestedControllableCheckedItems.js.map +0 -1
  168. package/lib-commonjs/hooks/useNestedTreeNavigation.js.map +0 -1
  169. package/lib-commonjs/utils/createFlatTreeItems.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["TreeItem.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, ExtractSlotProps, Slot } from '@fluentui/react-utilities';\nimport type { TreeItemContextValue } from '../../contexts';\nimport { treeItemLevelToken } from '../../utils/tokens';\nimport * as React from 'react';\nimport { TreeItemSlotsContextValue } from '../../contexts/treeItemSlotsContext';\nimport type { Checkbox } from '@fluentui/react-checkbox';\nimport type { Radio } from '@fluentui/react-radio';\n\nexport type TreeItemCSSProperties = React.CSSProperties & { [treeItemLevelToken]?: string | number };\n\nexport type TreeItemType = 'leaf' | 'branch';\n\nexport type TreeItemSlots = {\n root: Slot<ExtractSlotProps<Slot<'div'> & { style?: TreeItemCSSProperties }>>;\n /**\n * Expand icon slot,\n * by default renders a chevron icon to indicate opening and closing\n */\n expandIcon?: Slot<'div'>;\n aside?: Slot<'div'>;\n /**\n * actionable elements are normally buttons, menus, or other focusable elements.\n * Those elements are only visibly available if the given tree item is currently active.\n */\n actions?: Slot<\n ExtractSlotProps<\n Slot<'div'> & {\n /**\n * Forces visibility of the aside/action content\n */\n visible?: boolean;\n }\n >\n >;\n /**\n * Selection indicator if selection type is checkbox\n */\n checkboxIndicator?: Slot<typeof Checkbox>;\n /**\n * Selection indicator if selection type is radio\n */\n radioIndicator?: Slot<typeof Radio>;\n};\n\nexport type TreeItemInternalSlot = Pick<TreeItemSlots, 'root'>;\n\nexport type TreeItemValue = string | number;\n\nexport type TreeItemContextValues = {\n treeItem: TreeItemContextValue;\n treeItemSlots: TreeItemSlotsContextValue;\n};\n\n/**\n * TreeItem Props\n */\nexport type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {\n itemType: TreeItemType;\n value?: TreeItemValue;\n};\n\n/**\n * State used in rendering TreeItem\n */\nexport type TreeItemState = ComponentState<TreeItemInternalSlot> &\n TreeItemContextValue &\n TreeItemSlotsContextValue & {\n level: number;\n itemType: TreeItemType;\n };\n"],"names":["React"],"mappings":"AAGA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["TreeItem.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, ExtractSlotProps, Slot } from '@fluentui/react-utilities';\nimport type { TreeItemContextValue } from '../../contexts';\nimport { treeItemLevelToken } from '../../utils/tokens';\nimport * as React from 'react';\n\nexport type TreeItemCSSProperties = React.CSSProperties & { [treeItemLevelToken]?: string | number };\n\nexport type TreeItemType = 'leaf' | 'branch';\n\nexport type TreeItemSlots = {\n root: Slot<ExtractSlotProps<Slot<'div'> & { style?: TreeItemCSSProperties }>>;\n};\n\nexport type TreeItemValue = string | number;\n\nexport type TreeItemContextValues = {\n treeItem: TreeItemContextValue;\n};\n\n/**\n * TreeItem Props\n */\nexport type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {\n itemType: TreeItemType;\n value?: TreeItemValue;\n};\n\n/**\n * State used in rendering TreeItem\n */\nexport type TreeItemState = ComponentState<TreeItemSlots> &\n TreeItemContextValue & {\n level: number;\n itemType: TreeItemType;\n };\n"],"names":["React"],"mappings":"AAGA,YAAYA,WAAW,QAAQ"}
@@ -1,13 +1,11 @@
1
1
  /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
2
  import { getSlotsNext } from '@fluentui/react-utilities';
3
- import { TreeItemProvider, TreeItemSlotsProvider } from '../../contexts';
3
+ import { TreeItemProvider } from '../../contexts';
4
4
  /**
5
5
  * Render the final JSX of TreeItem
6
6
  */ export const renderTreeItem_unstable = (state, contextValues)=>{
7
7
  const { slots , slotProps } = getSlotsNext(state);
8
8
  return /*#__PURE__*/ createElement(slots.root, slotProps.root, /*#__PURE__*/ createElement(TreeItemProvider, {
9
9
  value: contextValues.treeItem
10
- }, /*#__PURE__*/ createElement(TreeItemSlotsProvider, {
11
- value: contextValues.treeItemSlots
12
- }, slotProps.root.children)));
10
+ }, slotProps.root.children));
13
11
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderTreeItem.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { TreeItemState, TreeItemContextValues, TreeItemInternalSlot } from './TreeItem.types';\nimport { TreeItemProvider, TreeItemSlotsProvider } from '../../contexts';\n\n/**\n * Render the final JSX of TreeItem\n */\nexport const renderTreeItem_unstable = (state: TreeItemState, contextValues: TreeItemContextValues) => {\n const { slots, slotProps } = getSlotsNext<TreeItemInternalSlot>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <TreeItemProvider value={contextValues.treeItem}>\n <TreeItemSlotsProvider value={contextValues.treeItemSlots}>{slotProps.root.children}</TreeItemSlotsProvider>\n </TreeItemProvider>\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","TreeItemProvider","TreeItemSlotsProvider","renderTreeItem_unstable","state","contextValues","slots","slotProps","root","value","treeItem","treeItemSlots","children"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,gBAAgB,EAAEC,qBAAqB,QAAQ,iBAAiB;AAEzE;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAsBC,gBAAyC;IACrG,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGP,aAAmCI;IAEhE,qBACE,AAdJ,cAcKE,MAAME,IAAI,EAAKD,UAAUC,IAAI,gBAC5B,AAfN,cAeOP;QAAiBQ,OAAOJ,cAAcK,QAAQ;qBAC7C,AAhBR,cAgBSR;QAAsBO,OAAOJ,cAAcM,aAAa;OAAGJ,UAAUC,IAAI,CAACI,QAAQ;AAI3F,EAAE"}
1
+ {"version":3,"sources":["renderTreeItem.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { TreeItemState, TreeItemContextValues, TreeItemSlots } from './TreeItem.types';\nimport { TreeItemProvider } from '../../contexts';\n\n/**\n * Render the final JSX of TreeItem\n */\nexport const renderTreeItem_unstable = (state: TreeItemState, contextValues: TreeItemContextValues) => {\n const { slots, slotProps } = getSlotsNext<TreeItemSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <TreeItemProvider value={contextValues.treeItem}>{slotProps.root.children}</TreeItemProvider>\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","TreeItemProvider","renderTreeItem_unstable","state","contextValues","slots","slotProps","root","value","treeItem","children"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAsBC,gBAAyC;IACrG,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGN,aAA4BG;IAEzD,qBACE,AAdJ,cAcKE,MAAME,IAAI,EAAKD,UAAUC,IAAI,gBAC5B,AAfN,cAeON;QAAiBO,OAAOJ,cAAcK,QAAQ;OAAGH,UAAUC,IAAI,CAACG,QAAQ;AAG/E,EAAE"}
@@ -1,10 +1,9 @@
1
1
  import * as React from 'react';
2
- import { getNativeElementProps, isResolvedShorthand, resolveShorthand, useControllableState, useId, useMergedRefs } from '@fluentui/react-utilities';
2
+ import { getNativeElementProps, useId, useMergedRefs } from '@fluentui/react-utilities';
3
3
  import { useEventCallback } from '@fluentui/react-utilities';
4
4
  import { elementContains } from '@fluentui/react-portal';
5
5
  import { useTreeContext_unstable } from '../../contexts/index';
6
6
  import { dataTreeItemValueAttrName } from '../../utils/getTreeItemValueFromElement';
7
- import { TreeItemChevron } from '../TreeItemChevron';
8
7
  import { Space } from '@fluentui/keyboard-keys';
9
8
  import { treeDataTypes } from '../../utils/tokens';
10
9
  /**
@@ -18,24 +17,12 @@ import { treeDataTypes } from '../../utils/tokens';
18
17
  */ export function useTreeItem_unstable(props, ref) {
19
18
  var _props_value;
20
19
  const contextLevel = useTreeContext_unstable((ctx)=>ctx.level);
20
+ // note, if the value is not externally provided,
21
+ // then selection and expansion will not work properly
21
22
  const value = useId('fuiTreeItemValue-', (_props_value = props.value) === null || _props_value === void 0 ? void 0 : _props_value.toString());
22
- const { onClick , onKeyDown , as ='div' , itemType ='leaf' , 'aria-level': level = contextLevel , expandIcon , aside , ...rest } = props;
23
+ const { onClick , onKeyDown , as ='div' , itemType ='leaf' , 'aria-level': level = contextLevel , ...rest } = props;
23
24
  const requestTreeResponse = useTreeContext_unstable((ctx)=>ctx.requestTreeResponse);
24
- const [isActionsVisibleExternal, actions] = isResolvedShorthand(props.actions) ? [
25
- props.actions.visible,
26
- {
27
- ...props.actions,
28
- visible: undefined
29
- }
30
- ] : [
31
- undefined,
32
- props.actions
33
- ];
34
- const [isActionsVisible, setActionsVisible] = useControllableState({
35
- state: isActionsVisibleExternal,
36
- defaultState: false,
37
- initialState: false
38
- });
25
+ const [isActionsVisible, setActionsVisible] = React.useState(false);
39
26
  const [isAsideVisible, setAsideVisible] = React.useState(true);
40
27
  const handleActionsRef = (actionsElement)=>{
41
28
  setAsideVisible(actionsElement === null);
@@ -49,8 +36,6 @@ import { treeDataTypes } from '../../utils/tokens';
49
36
  var _ctx_checkedItems_get;
50
37
  const checked = useTreeContext_unstable((ctx)=>(_ctx_checkedItems_get = ctx.checkedItems.get(value)) !== null && _ctx_checkedItems_get !== void 0 ? _ctx_checkedItems_get : false);
51
38
  const selectionMode = useTreeContext_unstable((ctx)=>ctx.selectionMode);
52
- const actionsRefs = useMergedRefs(isResolvedShorthand(actions) ? actions.ref : undefined, handleActionsRef, actionsRef);
53
- const expandIconRefs = useMergedRefs(isResolvedShorthand(expandIcon) ? expandIcon.ref : undefined, expandIconRef);
54
39
  const handleClick = useEventCallback((event)=>{
55
40
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
56
41
  if (event.isDefaultPrevented()) {
@@ -150,40 +135,21 @@ import { treeDataTypes } from '../../utils/tokens';
150
135
  });
151
136
  });
152
137
  const isBranch = itemType === 'branch';
153
- const actionsSlot = React.useMemo(()=>isActionsVisible ? resolveShorthand(actions) : undefined, [
154
- actions,
155
- isActionsVisible
156
- ]);
157
- if (actionsSlot) {
158
- actionsSlot.ref = actionsRefs;
159
- }
160
- const asideSlot = React.useMemo(()=>isAsideVisible ? resolveShorthand(aside) : undefined, [
161
- aside,
162
- isAsideVisible
163
- ]);
164
- const expandIconSlot = React.useMemo(()=>resolveShorthand(expandIcon, {
165
- required: isBranch,
166
- defaultProps: {
167
- children: /*#__PURE__*/ React.createElement(TreeItemChevron, null),
168
- 'aria-hidden': true
169
- }
170
- }), [
171
- expandIcon,
172
- isBranch
173
- ]);
174
- if (expandIconSlot) {
175
- expandIconSlot.ref = expandIconRefs;
176
- }
177
138
  return {
178
139
  value,
179
140
  open,
180
141
  subtreeRef,
181
142
  layoutRef,
143
+ selectionRef,
144
+ expandIconRef,
145
+ actionsRef: useMergedRefs(handleActionsRef, actionsRef),
182
146
  itemType,
183
147
  level,
184
148
  components: {
185
149
  root: 'div'
186
150
  },
151
+ isAsideVisible,
152
+ isActionsVisible,
187
153
  root: getNativeElementProps(as, {
188
154
  tabIndex: -1,
189
155
  ...rest,
@@ -201,18 +167,6 @@ import { treeDataTypes } from '../../utils/tokens';
201
167
  onMouseOut: handleActionsInvisible,
202
168
  onBlur: handleActionsInvisible,
203
169
  onChange: handleChange
204
- }),
205
- actions: actionsSlot,
206
- aside: asideSlot,
207
- expandIcon: expandIconSlot,
208
- selector: selectionMode === 'none' ? undefined : resolveShorthand(selectionMode === 'multiselect' ? props.checkboxIndicator : props.radioIndicator, {
209
- required: true,
210
- defaultProps: {
211
- checked,
212
- tabIndex: -1,
213
- 'aria-hidden': true,
214
- ref: selectionRef
215
- }
216
170
  })
217
171
  };
218
172
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useTreeItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getNativeElementProps,\n isResolvedShorthand,\n resolveShorthand,\n useControllableState,\n useId,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\nimport type { TreeItemProps, TreeItemSlots, TreeItemState } from './TreeItem.types';\nimport { useTreeContext_unstable } from '../../contexts/index';\nimport { dataTreeItemValueAttrName } from '../../utils/getTreeItemValueFromElement';\nimport { TreeItemChevron } from '../TreeItemChevron';\nimport { Space } from '@fluentui/keyboard-keys';\nimport { treeDataTypes } from '../../utils/tokens';\n\n/**\n * Create the state required to render TreeItem.\n *\n * The returned state can be modified with hooks such as useTreeItemStyles_unstable,\n * before being passed to renderTreeItem_unstable.\n *\n * @param props - props from this instance of TreeItem\n * @param ref - reference to root HTMLElement of TreeItem\n */\nexport function useTreeItem_unstable(props: TreeItemProps, ref: React.Ref<HTMLDivElement>): TreeItemState {\n const contextLevel = useTreeContext_unstable(ctx => ctx.level);\n\n const value = useId('fuiTreeItemValue-', props.value?.toString());\n\n const {\n onClick,\n onKeyDown,\n as = 'div',\n itemType = 'leaf',\n 'aria-level': level = contextLevel,\n expandIcon,\n aside,\n ...rest\n } = props;\n\n const requestTreeResponse = useTreeContext_unstable(ctx => ctx.requestTreeResponse);\n\n const [isActionsVisibleExternal, actions]: [boolean | undefined, TreeItemSlots['actions']] = isResolvedShorthand(\n props.actions,\n )\n ? // .visible prop should not be propagated to the DOM\n [props.actions.visible, { ...props.actions, visible: undefined }]\n : [undefined, props.actions];\n\n const [isActionsVisible, setActionsVisible] = useControllableState({\n state: isActionsVisibleExternal,\n defaultState: false,\n initialState: false,\n });\n const [isAsideVisible, setAsideVisible] = React.useState(true);\n\n const handleActionsRef = (actionsElement: HTMLDivElement | null) => {\n setAsideVisible(actionsElement === null);\n };\n\n const actionsRef = React.useRef<HTMLDivElement>(null);\n const expandIconRef = React.useRef<HTMLDivElement>(null);\n const layoutRef = React.useRef<HTMLDivElement>(null);\n const subtreeRef = React.useRef<HTMLDivElement>(null);\n const selectionRef = React.useRef<HTMLInputElement>(null);\n\n const open = useTreeContext_unstable(ctx => ctx.openItems.has(value));\n const checked = useTreeContext_unstable(ctx => ctx.checkedItems.get(value) ?? false);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n\n const actionsRefs = useMergedRefs(\n isResolvedShorthand(actions) ? actions.ref : undefined,\n handleActionsRef,\n actionsRef,\n );\n const expandIconRefs = useMergedRefs(isResolvedShorthand(expandIcon) ? expandIcon.ref : undefined, expandIconRef);\n\n const handleClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (event.isDefaultPrevented()) {\n return;\n }\n const isEventFromActions = actionsRef.current && elementContains(actionsRef.current, event.target as Node);\n if (isEventFromActions) {\n return;\n }\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (isEventFromSubtree) {\n return;\n }\n const isEventFromSelection = selectionRef.current && elementContains(selectionRef.current, event.target as Node);\n if (isEventFromSelection) {\n return;\n }\n const isFromExpandIcon = expandIconRef.current && elementContains(expandIconRef.current, event.target as Node);\n requestTreeResponse({\n event,\n value,\n itemType,\n target: event.currentTarget,\n type: isFromExpandIcon ? treeDataTypes.ExpandIconClick : treeDataTypes.Click,\n });\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n // Ignore keyboard events that do not originate from the current tree item.\n if (event.isDefaultPrevented() || event.currentTarget !== event.target) {\n return;\n }\n switch (event.key) {\n case Space:\n if (selectionMode !== 'none') {\n selectionRef.current?.click();\n event.preventDefault();\n }\n return;\n case treeDataTypes.End:\n case treeDataTypes.Home:\n case treeDataTypes.Enter:\n case treeDataTypes.ArrowUp:\n case treeDataTypes.ArrowDown:\n case treeDataTypes.ArrowLeft:\n case treeDataTypes.ArrowRight:\n return requestTreeResponse({ event, target: event.currentTarget, value, itemType, type: event.key });\n }\n const isTypeAheadCharacter =\n event.key.length === 1 && event.key.match(/\\w/) && !event.altKey && !event.ctrlKey && !event.metaKey;\n if (isTypeAheadCharacter) {\n requestTreeResponse({ event, target: event.currentTarget, value, itemType, type: treeDataTypes.TypeAhead });\n }\n });\n\n const handleActionsVisible = useEventCallback((event: React.FocusEvent | React.MouseEvent) => {\n const isTargetFromSubtree = Boolean(\n subtreeRef.current && elementContains(subtreeRef.current, event.target as Node),\n );\n if (!isTargetFromSubtree) {\n setActionsVisible(true);\n }\n });\n\n const handleActionsInvisible = useEventCallback((event: React.FocusEvent | React.MouseEvent) => {\n const isTargetFromSubtree = Boolean(\n subtreeRef.current && elementContains(subtreeRef.current, event.target as Node),\n );\n const isRelatedTargetFromActions = Boolean(\n actionsRef.current && elementContains(actionsRef.current, event.relatedTarget as Node),\n );\n if (isRelatedTargetFromActions) {\n return setActionsVisible(true);\n }\n if (!isTargetFromSubtree) {\n return setActionsVisible(false);\n }\n });\n\n const handleChange = useEventCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n if (event.isDefaultPrevented()) {\n return;\n }\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (isEventFromSubtree) {\n return;\n }\n requestTreeResponse({ event, value, itemType, type: 'Change', target: event.currentTarget });\n });\n\n const isBranch = itemType === 'branch';\n\n const actionsSlot = React.useMemo(\n () => (isActionsVisible ? resolveShorthand(actions) : undefined),\n [actions, isActionsVisible],\n );\n if (actionsSlot) {\n actionsSlot.ref = actionsRefs;\n }\n const asideSlot = React.useMemo(\n () => (isAsideVisible ? resolveShorthand(aside) : undefined),\n [aside, isAsideVisible],\n );\n const expandIconSlot = React.useMemo(\n () =>\n resolveShorthand(expandIcon, {\n required: isBranch,\n defaultProps: {\n children: <TreeItemChevron />,\n 'aria-hidden': true,\n },\n }),\n [expandIcon, isBranch],\n );\n if (expandIconSlot) {\n expandIconSlot.ref = expandIconRefs;\n }\n\n return {\n value,\n open,\n subtreeRef,\n layoutRef,\n itemType,\n level,\n components: {\n root: 'div',\n },\n root: getNativeElementProps(as, {\n tabIndex: -1,\n ...rest,\n ref,\n role: 'treeitem',\n 'aria-level': level,\n [dataTreeItemValueAttrName]: value,\n 'aria-checked': selectionMode === 'multiselect' ? checked : undefined,\n 'aria-selected': selectionMode === 'single' ? checked : undefined,\n 'aria-expanded': isBranch ? open : undefined,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n onMouseOver: handleActionsVisible,\n onFocus: handleActionsVisible,\n onMouseOut: handleActionsInvisible,\n onBlur: handleActionsInvisible,\n onChange: handleChange,\n }),\n actions: actionsSlot,\n aside: asideSlot,\n expandIcon: expandIconSlot,\n selector:\n selectionMode === 'none'\n ? undefined\n : resolveShorthand(selectionMode === 'multiselect' ? props.checkboxIndicator : props.radioIndicator, {\n required: true,\n defaultProps: {\n checked,\n tabIndex: -1,\n 'aria-hidden': true,\n ref: selectionRef,\n // onChange: handleChange,\n },\n }),\n };\n}\n"],"names":["React","getNativeElementProps","isResolvedShorthand","resolveShorthand","useControllableState","useId","useMergedRefs","useEventCallback","elementContains","useTreeContext_unstable","dataTreeItemValueAttrName","TreeItemChevron","Space","treeDataTypes","useTreeItem_unstable","props","ref","contextLevel","ctx","level","value","toString","onClick","onKeyDown","as","itemType","expandIcon","aside","rest","requestTreeResponse","isActionsVisibleExternal","actions","visible","undefined","isActionsVisible","setActionsVisible","state","defaultState","initialState","isAsideVisible","setAsideVisible","useState","handleActionsRef","actionsElement","actionsRef","useRef","expandIconRef","layoutRef","subtreeRef","selectionRef","open","openItems","has","checked","checkedItems","get","selectionMode","actionsRefs","expandIconRefs","handleClick","event","isDefaultPrevented","isEventFromActions","current","target","isEventFromSubtree","isEventFromSelection","isFromExpandIcon","currentTarget","type","ExpandIconClick","Click","handleKeyDown","key","click","preventDefault","End","Home","Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","isTypeAheadCharacter","length","match","altKey","ctrlKey","metaKey","TypeAhead","handleActionsVisible","isTargetFromSubtree","Boolean","handleActionsInvisible","isRelatedTargetFromActions","relatedTarget","handleChange","isBranch","actionsSlot","useMemo","asideSlot","expandIconSlot","required","defaultProps","children","components","root","tabIndex","role","onMouseOver","onFocus","onMouseOut","onBlur","onChange","selector","checkboxIndicator","radioIndicator"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,qBAAqB,EACrBC,mBAAmB,EACnBC,gBAAgB,EAChBC,oBAAoB,EACp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BpC,iBAAiBwB,SAASM,SAAS,EAC3D;QAACN;QAAOY;KAAe;IAEzB,MAAM8D,iBAAiBrG,MAAMmG,OAAO,CAClC,IACEhG,iBAAiBuB,YAAY;YAC3B4E,UAAUL;YACVM,cAAc;gBACZC,wBAAU,oBAAC7F;gBACX,eAAe,IAAI;YACrB;QACF,IACF;QAACe;QAAYuE;KAAS;IAExB,IAAII,gBAAgB;QAClBA,eAAerF,GAAG,GAAG0C;IACvB,CAAC;IAED,OAAO;QACLtC;QACA8B;QACAF;QACAD;QACAtB;QACAN;QACAsF,YAAY;YACVC,MAAM;QACR;QACAA,MAAMzG,sBAAsBuB,IAAI;YAC9BmF,UAAU,CAAC;YACX,GAAG/E,IAAI;YACPZ;YACA4F,MAAM;YACN,cAAczF;YACd,CAACT,0BAA0B,EAAEU;YAC7B,gBAAgBoC,kBAAkB,gBAAgBH,UAAUpB,SAAS;YACrE,iBAAiBuB,kBAAkB,WAAWH,UAAUpB,SAAS;YACjE,iBAAiBgE,WAAW/C,OAAOjB,SAAS;YAC5CX,SAASqC;YACTpC,WAAWiD;YACXqC,aAAanB;YACboB,SAASpB;YACTqB,YAAYlB;YACZmB,QAAQnB;YACRoB,UAAUjB;QACZ;QACAjE,SAASmE;QACTvE,OAAOyE;QACP1E,YAAY2E;QACZa,UACE1D,kBAAkB,SACdvB,YACA9B,iBAAiBqD,kBAAkB,gBAAgBzC,MAAMoG,iBAAiB,GAAGpG,MAAMqG,cAAc,EAAE;YACjGd,UAAU,IAAI;YACdC,cAAc;gBACZlD;gBACAsD,UAAU,CAAC;gBACX,eAAe,IAAI;gBACnB3F,KAAKiC;YAEP;QACF,EAAE;IACV;AACF,CAAC"}
1
+ {"version":3,"sources":["useTreeItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useId, useMergedRefs } from '@fluentui/react-utilities';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\nimport type { TreeItemProps, TreeItemState } from './TreeItem.types';\nimport { useTreeContext_unstable } from '../../contexts/index';\nimport { dataTreeItemValueAttrName } from '../../utils/getTreeItemValueFromElement';\nimport { Space } from '@fluentui/keyboard-keys';\nimport { treeDataTypes } from '../../utils/tokens';\n\n/**\n * Create the state required to render TreeItem.\n *\n * The returned state can be modified with hooks such as useTreeItemStyles_unstable,\n * before being passed to renderTreeItem_unstable.\n *\n * @param props - props from this instance of TreeItem\n * @param ref - reference to root HTMLElement of TreeItem\n */\nexport function useTreeItem_unstable(props: TreeItemProps, ref: React.Ref<HTMLDivElement>): TreeItemState {\n const contextLevel = useTreeContext_unstable(ctx => ctx.level);\n\n // note, if the value is not externally provided,\n // then selection and expansion will not work properly\n const value = useId('fuiTreeItemValue-', props.value?.toString());\n\n const { onClick, onKeyDown, as = 'div', itemType = 'leaf', 'aria-level': level = contextLevel, ...rest } = props;\n\n const requestTreeResponse = useTreeContext_unstable(ctx => ctx.requestTreeResponse);\n\n const [isActionsVisible, setActionsVisible] = React.useState(false);\n const [isAsideVisible, setAsideVisible] = React.useState(true);\n\n const handleActionsRef = (actionsElement: HTMLDivElement | null) => {\n setAsideVisible(actionsElement === null);\n };\n\n const actionsRef = React.useRef<HTMLDivElement>(null);\n const expandIconRef = React.useRef<HTMLDivElement>(null);\n const layoutRef = React.useRef<HTMLDivElement>(null);\n const subtreeRef = React.useRef<HTMLDivElement>(null);\n const selectionRef = React.useRef<HTMLInputElement>(null);\n\n const open = useTreeContext_unstable(ctx => ctx.openItems.has(value));\n const checked = useTreeContext_unstable(ctx => ctx.checkedItems.get(value) ?? false);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n\n const handleClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (event.isDefaultPrevented()) {\n return;\n }\n const isEventFromActions = actionsRef.current && elementContains(actionsRef.current, event.target as Node);\n if (isEventFromActions) {\n return;\n }\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (isEventFromSubtree) {\n return;\n }\n const isEventFromSelection = selectionRef.current && elementContains(selectionRef.current, event.target as Node);\n if (isEventFromSelection) {\n return;\n }\n const isFromExpandIcon = expandIconRef.current && elementContains(expandIconRef.current, event.target as Node);\n requestTreeResponse({\n event,\n value,\n itemType,\n target: event.currentTarget,\n type: isFromExpandIcon ? treeDataTypes.ExpandIconClick : treeDataTypes.Click,\n });\n });\n\n const handleKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n // Ignore keyboard events that do not originate from the current tree item.\n if (event.isDefaultPrevented() || event.currentTarget !== event.target) {\n return;\n }\n switch (event.key) {\n case Space:\n if (selectionMode !== 'none') {\n selectionRef.current?.click();\n event.preventDefault();\n }\n return;\n case treeDataTypes.End:\n case treeDataTypes.Home:\n case treeDataTypes.Enter:\n case treeDataTypes.ArrowUp:\n case treeDataTypes.ArrowDown:\n case treeDataTypes.ArrowLeft:\n case treeDataTypes.ArrowRight:\n return requestTreeResponse({ event, target: event.currentTarget, value, itemType, type: event.key });\n }\n const isTypeAheadCharacter =\n event.key.length === 1 && event.key.match(/\\w/) && !event.altKey && !event.ctrlKey && !event.metaKey;\n if (isTypeAheadCharacter) {\n requestTreeResponse({ event, target: event.currentTarget, value, itemType, type: treeDataTypes.TypeAhead });\n }\n });\n\n const handleActionsVisible = useEventCallback((event: React.FocusEvent | React.MouseEvent) => {\n const isTargetFromSubtree = Boolean(\n subtreeRef.current && elementContains(subtreeRef.current, event.target as Node),\n );\n if (!isTargetFromSubtree) {\n setActionsVisible(true);\n }\n });\n\n const handleActionsInvisible = useEventCallback((event: React.FocusEvent | React.MouseEvent) => {\n const isTargetFromSubtree = Boolean(\n subtreeRef.current && elementContains(subtreeRef.current, event.target as Node),\n );\n const isRelatedTargetFromActions = Boolean(\n actionsRef.current && elementContains(actionsRef.current, event.relatedTarget as Node),\n );\n if (isRelatedTargetFromActions) {\n return setActionsVisible(true);\n }\n if (!isTargetFromSubtree) {\n return setActionsVisible(false);\n }\n });\n\n const handleChange = useEventCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n if (event.isDefaultPrevented()) {\n return;\n }\n const isEventFromSubtree = subtreeRef.current && elementContains(subtreeRef.current, event.target as Node);\n if (isEventFromSubtree) {\n return;\n }\n requestTreeResponse({ event, value, itemType, type: 'Change', target: event.currentTarget });\n });\n\n const isBranch = itemType === 'branch';\n return {\n value,\n open,\n subtreeRef,\n layoutRef,\n selectionRef,\n expandIconRef,\n actionsRef: useMergedRefs(handleActionsRef, actionsRef),\n itemType,\n level,\n components: {\n root: 'div',\n },\n isAsideVisible,\n isActionsVisible,\n root: getNativeElementProps(as, {\n tabIndex: -1,\n ...rest,\n ref,\n role: 'treeitem',\n 'aria-level': level,\n [dataTreeItemValueAttrName]: value,\n 'aria-checked': selectionMode === 'multiselect' ? checked : undefined,\n 'aria-selected': selectionMode === 'single' ? checked : undefined,\n 'aria-expanded': isBranch ? open : undefined,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n onMouseOver: handleActionsVisible,\n onFocus: handleActionsVisible,\n onMouseOut: handleActionsInvisible,\n onBlur: handleActionsInvisible,\n onChange: handleChange,\n }),\n };\n}\n"],"names":["React","getNativeElementProps","useId","useMergedRefs","useEventCallback","elementContains","useTreeContext_unstable","dataTreeItemValueAttrName","Space","treeDataTypes","useTreeItem_unstable","props","ref","contextLevel","ctx","level","value","toString","onClick","onKeyDown","as","itemType","rest","requestTreeResponse","isActionsVisible","setActionsVisible","useState","isAsideVisible","setAsideVisible","handleActionsRef","actionsElement","actionsRef","useRef","expandIconRef","layoutRef","subtreeRef","selectionRef","open","openItems","has","checked","checkedItems","get","selectionMode","handleClick","event","isDefaultPrevented","isEventFromActions","current","target","isEventFromSubtree","isEventFromSelection","isFromExpandIcon","currentTarget","type","ExpandIconClick","Click","handleKeyDown","key","click","preventDefault","End","Home","Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","isTypeAheadCharacter","length","match","altKey","ctrlKey","metaKey","TypeAhead","handleActionsVisible","isTargetFromSubtree","Boolean","handleActionsInvisible","isRelatedTargetFromActions","relatedTarget","handleChange","isBranch","components","root","tabIndex","role","undefined","onMouseOver","onFocus","onMouseOut","onBlur","onChange"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,KAAK,EAAEC,aAAa,QAAQ,4BAA4B;AACxF,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,eAAe,QAAQ,yBAAyB;AAEzD,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAASC,yBAAyB,QAAQ,0CAA0C;AACpF,SAASC,KAAK,QAAQ,0BAA0B;AAChD,SAASC,aAAa,QAAQ,qBAAqB;AAEnD;;;;;;;;CAQC,GACD,OAAO,SAASC,qBAAqBC,KAAoB,EAAEC,GAA8B,EAAiB;QAK/DD;IAJzC,MAAME,eAAeP,wBAAwBQ,CAAAA,MAAOA,IAAIC,KAAK;IAE7D,iDAAiD;IACjD,sDAAsD;IACtD,MAAMC,QAAQd,MAAM,qBAAqBS,CAAAA,eAAAA,MAAMK,KAAK,cAAXL,0BAAAA,KAAAA,IAAAA,aAAaM;IAEtD,MAAM,EAAEC,QAAO,EAAEC,UAAS,EAAEC,IAAK,MAAK,EAAEC,UAAW,OAAM,EAAE,cAAcN,QAAQF,YAAY,CAAA,EAAE,GAAGS,MAAM,GAAGX;IAE3G,MAAMY,sBAAsBjB,wBAAwBQ,CAAAA,MAAOA,IAAIS,mBAAmB;IAElF,MAAM,CAACC,kBAAkBC,kBAAkB,GAAGzB,MAAM0B,QAAQ,CAAC,KAAK;IAClE,MAAM,CAACC,gBAAgBC,gBAAgB,GAAG5B,MAAM0B,QAAQ,CAAC,IAAI;IAE7D,MAAMG,mBAAmB,CAACC,iBAA0C;QAClEF,gBAAgBE,mBAAmB,IAAI;IACzC;IAEA,MAAMC,aAAa/B,MAAMgC,MAAM,CAAiB,IAAI;IACpD,MAAMC,gBAAgBjC,MAAMg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Te,YAAYZ;YACZa,QAAQb;YACRc,UAAUX;QACZ;IACF;AACF,CAAC"}
@@ -1,6 +1,5 @@
1
- import * as React from 'react';
2
1
  export function useTreeItemContextValues_unstable(state) {
3
- const { value , itemType , layoutRef , subtreeRef , open , actions , aside , expandIcon , selector } = state;
2
+ const { value , itemType , layoutRef , subtreeRef , open , expandIconRef , actionsRef , isActionsVisible , isAsideVisible , selectionRef } = state;
4
3
  /**
5
4
  * This context is created with "@fluentui/react-context-selector",
6
5
  * there is no sense to memoize it
@@ -9,21 +8,14 @@ export function useTreeItemContextValues_unstable(state) {
9
8
  itemType,
10
9
  layoutRef,
11
10
  subtreeRef,
12
- open
11
+ open,
12
+ selectionRef,
13
+ isActionsVisible,
14
+ isAsideVisible,
15
+ actionsRef,
16
+ expandIconRef
13
17
  };
14
- const treeItemSlots = React.useMemo(()=>({
15
- actions,
16
- aside,
17
- expandIcon,
18
- selector
19
- }), [
20
- actions,
21
- aside,
22
- expandIcon,
23
- selector
24
- ]);
25
18
  return {
26
- treeItem,
27
- treeItemSlots
19
+ treeItem
28
20
  };
29
21
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["useTreeItemContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TreeItemContextValues, TreeItemState } from './TreeItem.types';\nimport type { TreeItemContextValue, TreeItemSlotsContextValue } from '../../contexts';\n\nexport function useTreeItemContextValues_unstable(state: TreeItemState): TreeItemContextValues {\n const { value, itemType, layoutRef, subtreeRef, open, actions, aside, expandIcon, selector } = state;\n\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const treeItem: TreeItemContextValue = {\n value,\n itemType,\n layoutRef,\n subtreeRef,\n open,\n };\n\n const treeItemSlots: TreeItemSlotsContextValue = React.useMemo(\n () => ({ actions, aside, expandIcon, selector }),\n [actions, aside, expandIcon, selector],\n );\n\n return { treeItem, treeItemSlots };\n}\n"],"names":["React","useTreeItemContextValues_unstable","state","value","itemType","layoutRef","subtreeRef","open","actions","aside","expandIcon","selector","treeItem","treeItemSlots","useMemo"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B,OAAO,SAASC,kCAAkCC,KAAoB,EAAyB;IAC7F,MAAM,EAAEC,MAAK,EAAEC,SAAQ,EAAEC,UAAS,EAAEC,WAAU,EAAEC,KAAI,EAAEC,QAAO,EAAEC,MAAK,EAAEC,WAAU,EAAEC,SAAQ,EAAE,GAAGT;IAE/F;;;GAGC,GACD,MAAMU,WAAiC;QACrCT;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,MAAMM,gBAA2Cb,MAAMc,OAAO,CAC5D,IAAO,CAAA;YAAEN;YAASC;YAAOC;YAAYC;QAAS,CAAA,GAC9C;QAACH;QAASC;QAAOC;QAAYC;KAAS;IAGxC,OAAO;QAAEC;QAAUC;IAAc;AACnC,CAAC"}
1
+ {"version":3,"sources":["useTreeItemContextValues.ts"],"sourcesContent":["import type { TreeItemContextValues, TreeItemState } from './TreeItem.types';\nimport type { TreeItemContextValue } from '../../contexts';\n\nexport function useTreeItemContextValues_unstable(state: TreeItemState): TreeItemContextValues {\n const {\n value,\n itemType,\n layoutRef,\n subtreeRef,\n open,\n expandIconRef,\n actionsRef,\n isActionsVisible,\n isAsideVisible,\n selectionRef,\n } = state;\n\n /**\n * This context is created with \"@fluentui/react-context-selector\",\n * there is no sense to memoize it\n */\n const treeItem: TreeItemContextValue = {\n value,\n itemType,\n layoutRef,\n subtreeRef,\n open,\n selectionRef,\n isActionsVisible,\n isAsideVisible,\n actionsRef,\n expandIconRef,\n };\n\n return { treeItem };\n}\n"],"names":["useTreeItemContextValues_unstable","state","value","itemType","layoutRef","subtreeRef","open","expandIconRef","actionsRef","isActionsVisible","isAsideVisible","selectionRef","treeItem"],"mappings":"AAGA,OAAO,SAASA,kCAAkCC,KAAoB,EAAyB;IAC7F,MAAM,EACJC,MAAK,EACLC,SAAQ,EACRC,UAAS,EACTC,WAAU,EACVC,KAAI,EACJC,cAAa,EACbC,WAAU,EACVC,iBAAgB,EAChBC,eAAc,EACdC,aAAY,EACb,GAAGV;IAEJ;;;GAGC,GACD,MAAMW,WAAiC;QACrCV;QACAC;QACAC;QACAC;QACAC;QACAK;QACAF;QACAC;QACAF;QACAD;IACF;IAEA,OAAO;QAAEK;IAAS;AACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["TreeItemLayout.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { ButtonContextValue } from '@fluentui/react-button';\nimport { TreeItemSlotsContextValue } from '../../contexts/treeItemSlotsContext';\n\nexport type TreeItemLayoutSlots = {\n root: Slot<'div'>;\n /**\n * Content. Children of the root slot are automatically rendered here\n */\n content: NonNullable<Slot<'div'>>;\n /**\n * Icon slot that renders right before main content\n */\n iconBefore?: Slot<'div'>;\n /**\n * Icon slot that renders right after main content\n */\n iconAfter?: Slot<'div'>;\n};\n\nexport type TreeItemLayoutInternalSlots = TreeItemLayoutSlots & TreeItemSlotsContextValue;\n\n/**\n * TreeItemLayout Props\n */\nexport type TreeItemLayoutProps = ComponentProps<Partial<TreeItemLayoutSlots>>;\n\n/**\n * State used in rendering TreeItemLayout\n */\nexport type TreeItemLayoutState = ComponentState<TreeItemLayoutInternalSlots> & {\n buttonContextValue: ButtonContextValue;\n};\n"],"names":[],"mappings":"AAAA,WAgCE"}
1
+ {"version":3,"sources":["TreeItemLayout.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, ExtractSlotProps, Slot } from '@fluentui/react-utilities';\nimport { ButtonContextValue } from '@fluentui/react-button';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport { Radio } from '@fluentui/react-radio';\n\nexport type TreeItemLayoutSlots = {\n root: Slot<'div'>;\n /**\n * Content. Children of the root slot are automatically rendered here\n */\n content: NonNullable<Slot<'div'>>;\n /**\n * Icon slot that renders right before main content\n */\n iconBefore?: Slot<'div'>;\n /**\n * Icon slot that renders right after main content\n */\n iconAfter?: Slot<'div'>;\n /**\n * Expand icon slot,\n * by default renders a chevron icon to indicate opening and closing\n */\n expandIcon?: Slot<'div'>;\n aside?: Slot<'div'>;\n /**\n * actionable elements are normally buttons, menus, or other focusable elements.\n * Those elements are only visibly available if the given tree item is currently active.\n */\n actions?: Slot<\n ExtractSlotProps<\n Slot<'div'> & {\n /**\n * Forces visibility of the aside/action content\n */\n visible?: boolean;\n }\n >\n >;\n selector?: Slot<typeof Checkbox> | Slot<typeof Radio>;\n};\n\n/**\n * TreeItemLayout Props\n */\nexport type TreeItemLayoutProps = ComponentProps<Partial<TreeItemLayoutSlots>>;\n\n/**\n * State used in rendering TreeItemLayout\n */\nexport type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots> & {\n buttonContextValue: ButtonContextValue;\n};\n"],"names":[],"mappings":"AAAA,WAoDE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["renderTreeItemLayout.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { TreeItemLayoutState, TreeItemLayoutInternalSlots } from './TreeItemLayout.types';\nimport { ButtonContextProvider } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of TreeItemLayout\n */\nexport const renderTreeItemLayout_unstable = (state: TreeItemLayoutState) => {\n const { slots, slotProps } = getSlotsNext<TreeItemLayoutInternalSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.expandIcon && <slots.expandIcon {...slotProps.expandIcon} />}\n {slots.selector && <slots.selector {...slotProps.selector} />}\n {slots.iconBefore && <slots.iconBefore {...slotProps.iconBefore} />}\n <slots.content {...slotProps.content}>{slotProps.root.children}</slots.content>\n {slots.iconAfter && <slots.iconAfter {...slotProps.iconAfter} />}\n <ButtonContextProvider value={state.buttonContextValue}>\n {slots.actions && <slots.actions {...slotProps.actions} />}\n {slots.aside && <slots.aside {...slotProps.aside} />}\n </ButtonContextProvider>\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","ButtonContextProvider","renderTreeItemLayout_unstable","state","slots","slotProps","root","expandIcon","selector","iconBefore","content","children","iconAfter","value","buttonContextValue","actions","aside"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC,QAA+B;IAC3E,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGL,aAA0CG;IAEvE,qBACE,AAdJ,cAcKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BF,MAAMG,UAAU,kBAAI,AAf3B,cAe4BH,MAAMG,UAAU,EAAKF,UAAUE,UAAU,GAC9DH,MAAMI,QAAQ,kBAAI,AAhBzB,cAgB0BJ,MAAMI,QAAQ,EAAKH,UAAUG,QAAQ,GACxDJ,MAAMK,UAAU,kBAAI,AAjB3B,cAiB4BL,MAAMK,UAAU,EAAKJ,UAAUI,UAAU,iBAC/D,AAlBN,cAkBOL,MAAMM,OAAO,EAAKL,UAAUK,OAAO,EAAGL,UAAUC,IAAI,CAACK,QAAQ,GAC7DP,MAAMQ,SAAS,kBAAI,AAnB1B,cAmB2BR,MAAMQ,SAAS,EAAKP,UAAUO,SAAS,iBAC5D,AApBN,cAoBOX;QAAsBY,OAAOV,MAAMW,kBAAkB;OACnDV,MAAMW,OAAO,kBAAI,AArB1B,cAqB2BX,MAAMW,OAAO,EAAKV,UAAUU,OAAO,GACrDX,MAAMY,KAAK,kBAAI,AAtBxB,cAsByBZ,MAAMY,KAAK,EAAKX,UAAUW,KAAK;AAIxD,EAAE"}
1
+ {"version":3,"sources":["renderTreeItemLayout.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { TreeItemLayoutState, TreeItemLayoutSlots } from './TreeItemLayout.types';\nimport { ButtonContextProvider } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of TreeItemLayout\n */\nexport const renderTreeItemLayout_unstable = (state: TreeItemLayoutState) => {\n const { slots, slotProps } = getSlotsNext<TreeItemLayoutSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.expandIcon && <slots.expandIcon {...slotProps.expandIcon} />}\n {slots.selector && <slots.selector {...slotProps.selector} />}\n {slots.iconBefore && <slots.iconBefore {...slotProps.iconBefore} />}\n <slots.content {...slotProps.content}>{slotProps.root.children}</slots.content>\n {slots.iconAfter && <slots.iconAfter {...slotProps.iconAfter} />}\n <ButtonContextProvider value={state.buttonContextValue}>\n {slots.actions && <slots.actions {...slotProps.actions} />}\n {slots.aside && <slots.aside {...slotProps.aside} />}\n </ButtonContextProvider>\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","ButtonContextProvider","renderTreeItemLayout_unstable","state","slots","slotProps","root","expandIcon","selector","iconBefore","content","children","iconAfter","value","buttonContextValue","actions","aside"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC,QAA+B;IAC3E,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGL,aAAkCG;IAE/D,qBACE,AAdJ,cAcKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BF,MAAMG,UAAU,kBAAI,AAf3B,cAe4BH,MAAMG,UAAU,EAAKF,UAAUE,UAAU,GAC9DH,MAAMI,QAAQ,kBAAI,AAhBzB,cAgB0BJ,MAAMI,QAAQ,EAAKH,UAAUG,QAAQ,GACxDJ,MAAMK,UAAU,kBAAI,AAjB3B,cAiB4BL,MAAMK,UAAU,EAAKJ,UAAUI,UAAU,iBAC/D,AAlBN,cAkBOL,MAAMM,OAAO,EAAKL,UAAUK,OAAO,EAAGL,UAAUC,IAAI,CAACK,QAAQ,GAC7DP,MAAMQ,SAAS,kBAAI,AAnB1B,cAmB2BR,MAAMQ,SAAS,EAAKP,UAAUO,SAAS,iBAC5D,AApBN,cAoBOX;QAAsBY,OAAOV,MAAMW,kBAAkB;OACnDV,MAAMW,OAAO,kBAAI,AArB1B,cAqB2BX,MAAMW,OAAO,EAAKV,UAAUU,OAAO,GACrDX,MAAMY,KAAK,kBAAI,AAtBxB,cAsByBZ,MAAMY,KAAK,EAAKX,UAAUW,KAAK;AAIxD,EAAE"}
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
- import { getNativeElementProps, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';
3
- import { useTreeItemContext_unstable, useTreeContext_unstable, useTreeItemSlotsContext_unstable } from '../../contexts';
2
+ import { getNativeElementProps, isResolvedShorthand, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';
3
+ import { useTreeItemContext_unstable, useTreeContext_unstable } from '../../contexts';
4
4
  import { Checkbox } from '@fluentui/react-checkbox';
5
5
  import { Radio } from '@fluentui/react-radio';
6
+ import { TreeItemChevron } from '../TreeItemChevron';
6
7
  /**
7
8
  * Create the state required to render TreeItemLayout.
8
9
  *
@@ -13,9 +14,43 @@ import { Radio } from '@fluentui/react-radio';
13
14
  * @param ref - reference to root HTMLElement of TreeItemLayout
14
15
  */ export const useTreeItemLayout_unstable = (props, ref)=>{
15
16
  const { content , iconAfter , iconBefore , as ='span' } = props;
16
- const { actions , aside , expandIcon , selector } = useTreeItemSlotsContext_unstable();
17
17
  const layoutRef = useTreeItemContext_unstable((ctx)=>ctx.layoutRef);
18
18
  const selectionMode = useTreeContext_unstable((ctx)=>ctx.selectionMode);
19
+ const [isActionsVisibleExternal, actionsShorthand] = isResolvedShorthand(props.actions) ? [
20
+ props.actions.visible,
21
+ {
22
+ ...props.actions,
23
+ visible: undefined
24
+ }
25
+ ] : [
26
+ undefined,
27
+ props.actions
28
+ ];
29
+ const isActionsVisible = useTreeItemContext_unstable((ctx)=>ctx.isActionsVisible) || isActionsVisibleExternal;
30
+ const isAsideVisible = useTreeItemContext_unstable((ctx)=>ctx.isAsideVisible);
31
+ const selectionRef = useTreeItemContext_unstable((ctx)=>ctx.selectionRef);
32
+ const expandIconRef = useTreeItemContext_unstable((ctx)=>ctx.expandIconRef);
33
+ const actionsRef = useTreeItemContext_unstable((ctx)=>ctx.actionsRef);
34
+ const value = useTreeItemContext_unstable((ctx)=>ctx.value);
35
+ var _ctx_checkedItems_get;
36
+ const checked = useTreeContext_unstable((ctx)=>(_ctx_checkedItems_get = ctx.checkedItems.get(value)) !== null && _ctx_checkedItems_get !== void 0 ? _ctx_checkedItems_get : false);
37
+ const isBranch = useTreeItemContext_unstable((ctx)=>ctx.itemType === 'branch');
38
+ const expandIcon = resolveShorthand(props.expandIcon, {
39
+ required: isBranch,
40
+ defaultProps: {
41
+ children: /*#__PURE__*/ React.createElement(TreeItemChevron, null),
42
+ 'aria-hidden': true
43
+ }
44
+ });
45
+ const expandIconRefs = useMergedRefs(expandIcon === null || expandIcon === void 0 ? void 0 : expandIcon.ref, expandIconRef);
46
+ if (expandIcon) {
47
+ expandIcon.ref = expandIconRefs;
48
+ }
49
+ const actions = isActionsVisible ? resolveShorthand(actionsShorthand) : undefined;
50
+ const actionsRefs = useMergedRefs(actions === null || actions === void 0 ? void 0 : actions.ref, actionsRef);
51
+ if (actions) {
52
+ actions.ref = actionsRefs;
53
+ }
19
54
  return {
20
55
  components: {
21
56
  root: 'div',
@@ -48,9 +83,17 @@ import { Radio } from '@fluentui/react-radio';
48
83
  'aria-hidden': true
49
84
  }
50
85
  }),
51
- aside: resolveShorthand(aside),
52
- actions: resolveShorthand(actions),
53
- expandIcon: resolveShorthand(expandIcon),
54
- selector: resolveShorthand(selector)
86
+ aside: isAsideVisible ? resolveShorthand(props.aside) : undefined,
87
+ actions,
88
+ expandIcon,
89
+ selector: resolveShorthand(props.selector, {
90
+ required: selectionMode !== 'none',
91
+ defaultProps: {
92
+ checked,
93
+ tabIndex: -1,
94
+ 'aria-hidden': true,
95
+ ref: selectionRef
96
+ }
97
+ })
55
98
  };
56
99
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useTreeItemLayout.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport { useTreeItemContext_unstable, useTreeContext_unstable, useTreeItemSlotsContext_unstable } from '../../contexts';\nimport type { TreeItemLayoutProps, TreeItemLayoutState } from './TreeItemLayout.types';\nimport { Checkbox, CheckboxProps } from '@fluentui/react-checkbox';\nimport { Radio, RadioProps } from '@fluentui/react-radio';\n\n/**\n * Create the state required to render TreeItemLayout.\n *\n * The returned state can be modified with hooks such as useTreeItemLayoutStyles_unstable,\n * before being passed to renderTreeItemLayout_unstable.\n *\n * @param props - props from this instance of TreeItemLayout\n * @param ref - reference to root HTMLElement of TreeItemLayout\n */\nexport const useTreeItemLayout_unstable = (\n props: TreeItemLayoutProps,\n ref: React.Ref<HTMLElement>,\n): TreeItemLayoutState => {\n const { content, iconAfter, iconBefore, as = 'span' } = props;\n\n const { actions, aside, expandIcon, selector } = useTreeItemSlotsContext_unstable();\n\n const layoutRef = useTreeItemContext_unstable(ctx => ctx.layoutRef);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n\n return {\n components: {\n root: 'div',\n expandIcon: 'div',\n iconBefore: 'div',\n content: 'div',\n iconAfter: 'div',\n actions: 'div',\n aside: 'div',\n // Casting here to a union between checkbox and radio\n selector: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n },\n buttonContextValue: { size: 'small' },\n root: getNativeElementProps(as, { ...props, ref: useMergedRefs(ref, layoutRef) }),\n iconBefore: resolveShorthand(iconBefore, { defaultProps: { 'aria-hidden': true } }),\n content: resolveShorthand(content, { required: true }),\n iconAfter: resolveShorthand(iconAfter, { defaultProps: { 'aria-hidden': true } }),\n aside: resolveShorthand(aside),\n actions: resolveShorthand(actions),\n expandIcon: resolveShorthand(expandIcon),\n selector: resolveShorthand(selector),\n };\n};\n"],"names":["React","getNativeElementProps","resolveShorthand","useMergedRefs","useTreeItemContext_unstable","useTreeContext_unstable","useTreeItemSlotsContext_unstable","Checkbox","Radio","useTreeItemLayout_unstable","props","ref","content","iconAfter","iconBefore","as","actions","aside","expandIcon","selector","layoutRef","ctx","selectionMode","components","root","buttonContextValue","size","defaultProps","required"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AACnG,SAASC,2BAA2B,EAAEC,uBAAuB,EAAEC,gCAAgC,QAAQ,iBAAiB;AAExH,SAASC,QAAQ,QAAuB,2BAA2B;AACnE,SAASC,KAAK,QAAoB,wBAAwB;AAE1D;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC,MACwB;IACxB,MAAM,EAAEC,QAAO,EAAEC,UAAS,EAAEC,WAAU,EAAEC,IAAK,OAAM,EAAE,GAAGL;IAExD,MAAM,EAAEM,QAAO,EAAEC,MAAK,EAAEC,WAAU,EAAEC,SAAQ,EAAE,GAAGb;IAEjD,MAAMc,YAAYhB,4BAA4BiB,CAAAA,MAAOA,IAAID,SAAS;IAClE,MAAME,gBAAgBjB,wBAAwBgB,CAAAA,MAAOA,IAAIC,aAAa;IAEtE,OAAO;QACLC,YAAY;YACVC,MAAM;YACNN,YAAY;YACZJ,YAAY;YACZF,SAAS;YACTC,WAAW;YACXG,SAAS;YACTC,OAAO;YACP,qDAAqD;YACrDE,UAAWG,kBAAkB,gBAAgBf,WAAWC,KAAK;QAC/D;QACAiB,oBAAoB;YAAEC,MAAM;QAAQ;QACpCF,MAAMvB,sBAAsBc,IAAI;YAAE,GAAGL,KAAK;YAAEC,KAAKR,cAAcQ,KAAKS;QAAW;QAC/EN,YAAYZ,iBAAiBY,YAAY;YAAEa,cAAc;gBAAE,eAAe,IAAI;YAAC;QAAE;QACjFf,SAASV,iBAAiBU,SAAS;YAAEgB,UAAU,IAAI;QAAC;QACpDf,WAAWX,iBAAiBW,WAAW;YAAEc,cAAc;gBAAE,eAAe,IAAI;YAAC;QAAE;QAC/EV,OAAOf,iBAAiBe;QACxBD,SAASd,iBAAiBc;QAC1BE,YAAYhB,iBAAiBgB;QAC7BC,UAAUjB,iBAAiBiB;IAC7B;AACF,EAAE"}
1
+ {"version":3,"sources":["useTreeItemLayout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, isResolvedShorthand, resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport { useTreeItemContext_unstable, useTreeContext_unstable } from '../../contexts';\nimport type { TreeItemLayoutProps, TreeItemLayoutSlots, TreeItemLayoutState } from './TreeItemLayout.types';\nimport { Checkbox, CheckboxProps } from '@fluentui/react-checkbox';\nimport { Radio, RadioProps } from '@fluentui/react-radio';\nimport { TreeItemChevron } from '../TreeItemChevron';\n\n/**\n * Create the state required to render TreeItemLayout.\n *\n * The returned state can be modified with hooks such as useTreeItemLayoutStyles_unstable,\n * before being passed to renderTreeItemLayout_unstable.\n *\n * @param props - props from this instance of TreeItemLayout\n * @param ref - reference to root HTMLElement of TreeItemLayout\n */\nexport const useTreeItemLayout_unstable = (\n props: TreeItemLayoutProps,\n ref: React.Ref<HTMLElement>,\n): TreeItemLayoutState => {\n const { content, iconAfter, iconBefore, as = 'span' } = props;\n\n const layoutRef = useTreeItemContext_unstable(ctx => ctx.layoutRef);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n\n const [isActionsVisibleExternal, actionsShorthand]: [boolean | undefined, TreeItemLayoutSlots['actions']] =\n isResolvedShorthand(props.actions)\n ? // .visible prop should not be propagated to the DOM\n [props.actions.visible, { ...props.actions, visible: undefined }]\n : [undefined, props.actions];\n\n const isActionsVisible = useTreeItemContext_unstable(ctx => ctx.isActionsVisible) || isActionsVisibleExternal;\n const isAsideVisible = useTreeItemContext_unstable(ctx => ctx.isAsideVisible);\n const selectionRef = useTreeItemContext_unstable(ctx => ctx.selectionRef);\n const expandIconRef = useTreeItemContext_unstable(ctx => ctx.expandIconRef);\n const actionsRef = useTreeItemContext_unstable(ctx => ctx.actionsRef);\n const value = useTreeItemContext_unstable(ctx => ctx.value);\n const checked = useTreeContext_unstable(ctx => ctx.checkedItems.get(value) ?? false);\n const isBranch = useTreeItemContext_unstable(ctx => ctx.itemType === 'branch');\n\n const expandIcon = resolveShorthand(props.expandIcon, {\n required: isBranch,\n defaultProps: {\n children: <TreeItemChevron />,\n 'aria-hidden': true,\n },\n });\n\n const expandIconRefs = useMergedRefs(expandIcon?.ref, expandIconRef);\n if (expandIcon) {\n expandIcon.ref = expandIconRefs;\n }\n\n const actions = isActionsVisible ? resolveShorthand(actionsShorthand) : undefined;\n\n const actionsRefs = useMergedRefs(actions?.ref, actionsRef);\n if (actions) {\n actions.ref = actionsRefs;\n }\n\n return {\n components: {\n root: 'div',\n expandIcon: 'div',\n iconBefore: 'div',\n content: 'div',\n iconAfter: 'div',\n actions: 'div',\n aside: 'div',\n // Casting here to a union between checkbox and radio\n selector: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n },\n buttonContextValue: { size: 'small' },\n root: getNativeElementProps(as, { ...props, ref: useMergedRefs(ref, layoutRef) }),\n iconBefore: resolveShorthand(iconBefore, { defaultProps: { 'aria-hidden': true } }),\n content: resolveShorthand(content, { required: true }),\n iconAfter: resolveShorthand(iconAfter, { defaultProps: { 'aria-hidden': true } }),\n aside: isAsideVisible ? resolveShorthand(props.aside) : undefined,\n actions,\n expandIcon,\n selector: resolveShorthand(props.selector, {\n required: selectionMode !== 'none',\n defaultProps: {\n checked,\n tabIndex: -1,\n 'aria-hidden': true,\n ref: selectionRef,\n },\n }),\n };\n};\n"],"names":["React","getNativeElementProps","isResolvedShorthand","resolveShorthand","useMergedRefs","useTreeItemContext_unstable","useTreeContext_unstable","Checkbox","Radio","TreeItemChevron","useTreeItemLayout_unstable","props","ref","content","iconAfter","iconBefore","as","layoutRef","ctx","selectionMode","isActionsVisibleExternal","actionsShorthand","actions","visible","undefined","isActionsVisible","isAsideVisible","selectionRef","expandIconRef","actionsRef","value","checked","checkedItems","get","isBranch","itemType","expandIcon","required","defaultProps","children","expandIconRefs","actionsRefs","components","root","aside","selector","buttonContextValue","size","tabIndex"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,mBAAmB,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AACxH,SAASC,2BAA2B,EAAEC,uBAAuB,QAAQ,iBAAiB;AAEtF,SAASC,QAAQ,QAAuB,2BAA2B;AACnE,SAASC,KAAK,QAAoB,wBAAwB;AAC1D,SAASC,eAAe,QAAQ,qBAAqB;AAErD;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC,MACwB;IACxB,MAAM,EAAEC,QAAO,EAAEC,UAAS,EAAEC,WAAU,EAAEC,IAAK,OAAM,EAAE,GAAGL;IAExD,MAAMM,YAAYZ,4BAA4Ba,CAAAA,MAAOA,IAAID,SAAS;IAClE,MAAME,gBAAgBb,wBAAwBY,CAAAA,MAAOA,IAAIC,aAAa;IAEtE,MAAM,CAACC,0BAA0BC,iBAAiB,GAChDnB,oBAAoBS,MAAMW,OAAO,IAE7B;QAACX,MAAMW,OAAO,CAACC,OAAO;QAAE;YAAE,GAAGZ,MAAMW,OAAO;YAAEC,SAASC;QAAU;KAAE,GACjE;QAACA;QAAWb,MAAMW,OAAO;KAAC;IAEhC,MAAMG,mBAAmBpB,4BAA4Ba,CAAAA,MAAOA,IAAIO,gBAAgB,KAAKL;IACrF,MAAMM,iBAAiBrB,4BAA4Ba,CAAAA,MAAOA,IAAIQ,cAAc;IAC5E,MAAMC,eAAetB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Y,YAAY;YAAEuB,cAAc;gBAAE,eAAe,IAAI;YAAC;QAAE;QACjFzB,SAASV,iBAAiBU,SAAS;YAAEwB,UAAU,IAAI;QAAC;QACpDvB,WAAWX,iBAAiBW,WAAW;YAAEwB,cAAc;gBAAE,eAAe,IAAI;YAAC;QAAE;QAC/EM,OAAOlB,iBAAiBvB,iBAAiBQ,MAAMiC,KAAK,IAAIpB,SAAS;QACjEF;QACAc;QACAS,UAAU1C,iBAAiBQ,MAAMkC,QAAQ,EAAE;YACzCR,UAAUlB,kBAAkB;YAC5BmB,cAAc;gBACZP;gBACAiB,UAAU,CAAC;gBACX,eAAe,IAAI;gBACnBpC,KAAKe;YACP;QACF;IACF;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["TreeItemPersonaLayout.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { AvatarContextValue, AvatarSize } from '@fluentui/react-avatar';\nimport { ButtonContextValue } from '@fluentui/react-button';\nimport { TreeItemSlots } from '../TreeItem/TreeItem.types';\n\nexport type TreeItemPersonaLayoutContextValues = {\n avatar: AvatarContextValue;\n};\n\nexport type TreeItemPersonaLayoutSlots = {\n root: NonNullable<Slot<'div'>>;\n /**\n * Avatar to display.\n */\n media: NonNullable<Slot<'div'>>;\n /**\n * Content. Children of the root slot are automatically rendered here\n */\n content: NonNullable<Slot<'div'>>;\n /**\n * Secondary text that describes or complements the content\n */\n description?: Slot<'div'>;\n};\n\nexport type TreeItemPersonaLayoutInternalSlots = TreeItemPersonaLayoutSlots &\n Pick<TreeItemSlots, 'actions' | 'aside' | 'expandIcon'>;\n\n/**\n * TreeItemPersonaLayout Props\n */\nexport type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;\n\n/**\n * State used in rendering TreeItemPersonaLayout\n */\nexport type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutInternalSlots> & {\n avatarSize: AvatarSize;\n buttonContextValue: ButtonContextValue;\n};\n"],"names":[],"mappings":"AAAA,WAuCE"}
1
+ {"version":3,"sources":["TreeItemPersonaLayout.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { AvatarContextValue, AvatarSize } from '@fluentui/react-avatar';\nimport { ButtonContextValue } from '@fluentui/react-button';\nimport { TreeItemLayoutSlots } from '../TreeItemLayout/TreeItemLayout.types';\n\nexport type TreeItemPersonaLayoutContextValues = {\n avatar: AvatarContextValue;\n};\n\nexport type TreeItemPersonaLayoutSlots = Pick<TreeItemLayoutSlots, 'actions' | 'aside' | 'expandIcon' | 'selector'> & {\n root: NonNullable<Slot<'div'>>;\n /**\n * Avatar to display.\n */\n media: NonNullable<Slot<'div'>>;\n /**\n * Content. Children of the root slot are automatically rendered here\n */\n content: NonNullable<Slot<'div'>>;\n /**\n * Secondary text that describes or complements the content\n */\n description?: Slot<'div'>;\n};\n\n/**\n * TreeItemPersonaLayout Props\n */\nexport type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;\n\n/**\n * State used in rendering TreeItemPersonaLayout\n */\nexport type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> & {\n avatarSize: AvatarSize;\n buttonContextValue: ButtonContextValue;\n};\n"],"names":[],"mappings":"AAAA,WAoCE"}
@@ -6,7 +6,7 @@ import { ButtonContextProvider } from '@fluentui/react-button';
6
6
  * Render the final JSX of TreeItemPersonaLayout
7
7
  */ export const renderTreeItemPersonaLayout_unstable = (state, contextValues)=>{
8
8
  const { slots , slotProps } = getSlotsNext(state);
9
- return /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.expandIcon && /*#__PURE__*/ createElement(slots.expandIcon, slotProps.expandIcon), /*#__PURE__*/ createElement(AvatarContextProvider, {
9
+ return /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.expandIcon && /*#__PURE__*/ createElement(slots.expandIcon, slotProps.expandIcon), slots.selector && /*#__PURE__*/ createElement(slots.selector, slotProps.selector), /*#__PURE__*/ createElement(AvatarContextProvider, {
10
10
  value: contextValues.avatar
11
11
  }, /*#__PURE__*/ createElement(slots.media, slotProps.media)), /*#__PURE__*/ createElement(slots.content, slotProps.content), slots.description && /*#__PURE__*/ createElement(slots.description, slotProps.description), /*#__PURE__*/ createElement(ButtonContextProvider, {
12
12
  value: state.buttonContextValue
@@ -1 +1 @@
1
- {"version":3,"sources":["renderTreeItemPersonaLayout.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type {\n TreeItemPersonaLayoutState,\n TreeItemPersonaLayoutContextValues,\n TreeItemPersonaLayoutInternalSlots,\n} from './TreeItemPersonaLayout.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\nimport { ButtonContextProvider } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of TreeItemPersonaLayout\n */\nexport const renderTreeItemPersonaLayout_unstable = (\n state: TreeItemPersonaLayoutState,\n contextValues: TreeItemPersonaLayoutContextValues,\n) => {\n const { slots, slotProps } = getSlotsNext<TreeItemPersonaLayoutInternalSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.expandIcon && <slots.expandIcon {...slotProps.expandIcon} />}\n <AvatarContextProvider value={contextValues.avatar}>\n <slots.media {...slotProps.media} />\n </AvatarContextProvider>\n <slots.content {...slotProps.content} />\n {slots.description && <slots.description {...slotProps.description} />}\n <ButtonContextProvider value={state.buttonContextValue}>\n {slots.actions && <slots.actions {...slotProps.actions} />}\n {slots.aside && <slots.aside {...slotProps.aside} />}\n </ButtonContextProvider>\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","AvatarContextProvider","ButtonContextProvider","renderTreeItemPersonaLayout_unstable","state","contextValues","slots","slotProps","root","expandIcon","value","avatar","media","content","description","buttonContextValue","actions","aside"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AAMzD,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D;;CAEC,GACD,OAAO,MAAMC,uCAAuC,CAClDC,OACAC,gBACG;IACH,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGP,aAAiDI;IAE9E,qBACE,AAtBJ,cAsBKE,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BF,MAAMG,UAAU,kBAAI,AAvB3B,cAuB4BH,MAAMG,UAAU,EAAKF,UAAUE,UAAU,iBAC/D,AAxBN,cAwBOR;QAAsBS,OAAOL,cAAcM,MAAM;qBAChD,AAzBR,cAyBSL,MAAMM,KAAK,EAAKL,UAAUK,KAAK,kBAElC,AA3BN,cA2BON,MAAMO,OAAO,EAAKN,UAAUM,OAAO,GACnCP,MAAMQ,WAAW,kBAAI,AA5B5B,cA4B6BR,MAAMQ,WAAW,EAAKP,UAAUO,WAAW,iBAClE,AA7BN,cA6BOZ;QAAsBQ,OAAON,MAAMW,kBAAkB;OACnDT,MAAMU,OAAO,kBAAI,AA9B1B,cA8B2BV,MAAMU,OAAO,EAAKT,UAAUS,OAAO,GACrDV,MAAMW,KAAK,kBAAI,AA/BxB,cA+ByBX,MAAMW,KAAK,EAAKV,UAAUU,KAAK;AAIxD,EAAE"}
1
+ {"version":3,"sources":["renderTreeItemPersonaLayout.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type {\n TreeItemPersonaLayoutState,\n TreeItemPersonaLayoutContextValues,\n TreeItemPersonaLayoutSlots,\n} from './TreeItemPersonaLayout.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\nimport { ButtonContextProvider } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of TreeItemPersonaLayout\n */\nexport const renderTreeItemPersonaLayout_unstable = (\n state: TreeItemPersonaLayoutState,\n contextValues: TreeItemPersonaLayoutContextValues,\n) => {\n const { slots, slotProps } = getSlotsNext<TreeItemPersonaLayoutSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.expandIcon && <slots.expandIcon {...slotProps.expandIcon} />}\n {slots.selector && <slots.selector {...slotProps.selector} />}\n <AvatarContextProvider value={contextValues.avatar}>\n <slots.media {...slotProps.media} />\n </AvatarContextProvider>\n <slots.content {...slotProps.content} />\n {slots.description && <slots.description {...slotProps.description} />}\n <ButtonContextProvider value={state.buttonContextValue}>\n {slots.actions && <slots.actions {...slotProps.actions} />}\n {slots.aside && <slots.aside {...slotProps.aside} />}\n </ButtonContextProvider>\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","AvatarContextProvider","ButtonContextProvider","renderTreeItemPersonaLayout_unstable","state","contextValues","slots","slotProps","root","expandIcon","selector","value","avatar","media","content","description","buttonContextValue","actions","aside"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AAMzD,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D;;CAEC,GACD,OAAO,MAAMC,uCAAuC,CAClDC,OACAC,gBACG;IACH,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGP,aAAyCI;IAEtE,qBACE,AAtBJ,cAsBKE,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BF,MAAMG,UAAU,kBAAI,AAvB3B,cAuB4BH,MAAMG,UAAU,EAAKF,UAAUE,UAAU,GAC9DH,MAAMI,QAAQ,kBAAI,AAxBzB,cAwB0BJ,MAAMI,QAAQ,EAAKH,UAAUG,QAAQ,iBACzD,AAzBN,cAyBOT;QAAsBU,OAAON,cAAcO,MAAM;qBAChD,AA1BR,cA0BSN,MAAMO,KAAK,EAAKN,UAAUM,KAAK,kBAElC,AA5BN,cA4BOP,MAAMQ,OAAO,EAAKP,UAAUO,OAAO,GACnCR,MAAMS,WAAW,kBAAI,AA7B5B,cA6B6BT,MAAMS,WAAW,EAAKR,UAAUQ,WAAW,iBAClE,AA9BN,cA8BOb;QAAsBS,OAAOP,MAAMY,kBAAkB;OACnDV,MAAMW,OAAO,kBAAI,AA/B1B,cA+B2BX,MAAMW,OAAO,EAAKV,UAAUU,OAAO,GACrDX,MAAMY,KAAK,kBAAI,AAhCxB,cAgCyBZ,MAAMY,KAAK,EAAKX,UAAUW,KAAK;AAIxD,EAAE"}
@@ -3,6 +3,8 @@ import { resolveShorthand } from '@fluentui/react-utilities';
3
3
  import { useTreeContext_unstable } from '../../contexts';
4
4
  import { treeAvatarSize } from '../../utils/tokens';
5
5
  import { useTreeItemLayout_unstable } from '../TreeItemLayout/useTreeItemLayout';
6
+ import { Checkbox } from '@fluentui/react-checkbox';
7
+ import { Radio } from '@fluentui/react-radio';
6
8
  /**
7
9
  * Create the state required to render TreeItemPersonaLayout.
8
10
  *
@@ -19,6 +21,7 @@ import { useTreeItemLayout_unstable } from '../TreeItemLayout/useTreeItemLayout'
19
21
  iconAfter: null
20
22
  }, ref);
21
23
  const size = useTreeContext_unstable((ctx)=>ctx.size);
24
+ const selectionMode = useTreeContext_unstable((ctx)=>ctx.selectionMode);
22
25
  return {
23
26
  ...treeItemLayoutState,
24
27
  components: {
@@ -28,7 +31,9 @@ import { useTreeItemLayout_unstable } from '../TreeItemLayout/useTreeItemLayout'
28
31
  root: 'div',
29
32
  media: 'div',
30
33
  aside: 'div',
31
- actions: 'div'
34
+ actions: 'div',
35
+ // Casting here to a union between checkbox and radio
36
+ selector: selectionMode === 'multiselect' ? Checkbox : Radio
32
37
  },
33
38
  avatarSize: treeAvatarSize[size],
34
39
  content: resolveShorthand(content, {
@@ -1 +1 @@
1
- {"version":3,"sources":["useTreeItemPersonaLayout.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TreeItemPersonaLayoutProps, TreeItemPersonaLayoutState } from './TreeItemPersonaLayout.types';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { useTreeContext_unstable } from '../../contexts';\nimport { treeAvatarSize } from '../../utils/tokens';\nimport { useTreeItemLayout_unstable } from '../TreeItemLayout/useTreeItemLayout';\n\n/**\n * Create the state required to render TreeItemPersonaLayout.\n *\n * The returned state can be modified with hooks such as useTreeItemPersonaLayoutStyles_unstable,\n * before being passed to renderTreeItemPersonaLayout_unstable.\n *\n * @param props - props from this instance of TreeItemPersonaLayout\n * @param ref - reference to root HTMLElement of TreeItemPersonaLayout\n */\nexport const useTreeItemPersonaLayout_unstable = (\n props: TreeItemPersonaLayoutProps,\n ref: React.Ref<HTMLSpanElement>,\n): TreeItemPersonaLayoutState => {\n const { media, children, content, description } = props;\n\n const treeItemLayoutState = useTreeItemLayout_unstable(\n {\n ...props,\n iconBefore: null,\n iconAfter: null,\n },\n ref,\n );\n\n const size = useTreeContext_unstable(ctx => ctx.size);\n return {\n ...treeItemLayoutState,\n components: {\n expandIcon: 'div',\n content: 'div',\n description: 'div',\n root: 'div',\n media: 'div',\n aside: 'div',\n actions: 'div',\n },\n avatarSize: treeAvatarSize[size],\n content: resolveShorthand(content, { required: true, defaultProps: { children } }),\n media: resolveShorthand(media, { required: true }),\n description: resolveShorthand(description),\n };\n};\n"],"names":["React","resolveShorthand","useTreeContext_unstable","treeAvatarSize","useTreeItemLayout_unstable","useTreeItemPersonaLayout_unstable","props","ref","media","children","content","description","treeItemLayoutState","iconBefore","iconAfter","size","ctx","components","expandIcon","root","aside","actions","avatarSize","required","defaultProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,uBAAuB,QAAQ,iBAAiB;AACzD,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,0BAA0B,QAAQ,sCAAsC;AAEjF;;;;;;;;CAQC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC,OACAC,MAC+B;IAC/B,MAAM,EAAEC,MAAK,EAAEC,SAAQ,EAAEC,QAAO,EAAEC,YAAW,EAAE,GAAGL;IAElD,MAAMM,sBAAsBR,2BAC1B;QACE,GAAGE,KAAK;QACRO,YAAY,IAAI;QAChBC,WAAW,IAAI;IACjB,GACAP;IAGF,MAAMQ,OAAOb,wBAAwBc,CAAAA,MAAOA,IAAID,IAAI;IACpD,OAAO;QACL,GAAGH,mBAAmB;QACtBK,YAAY;YACVC,YAAY;YACZR,SAAS;YACTC,aAAa;YACbQ,MAAM;YACNX,OAAO;YACPY,OAAO;YACPC,SAAS;QACX;QACAC,YAAYnB,cAAc,CAACY,KAAK;QAChCL,SAAST,iBAAiBS,SAAS;YAAEa,UAAU,IAAI;YAAEC,cAAc;gBAAEf;YAAS;QAAE;QAChFD,OAAOP,iBAAiBO,OAAO;YAAEe,UAAU,IAAI;QAAC;QAChDZ,aAAaV,iBAAiBU;IAChC;AACF,EAAE"}
1
+ {"version":3,"sources":["useTreeItemPersonaLayout.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TreeItemPersonaLayoutProps, TreeItemPersonaLayoutState } from './TreeItemPersonaLayout.types';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { useTreeContext_unstable } from '../../contexts';\nimport { treeAvatarSize } from '../../utils/tokens';\nimport { useTreeItemLayout_unstable } from '../TreeItemLayout/useTreeItemLayout';\nimport { Checkbox, CheckboxProps } from '@fluentui/react-checkbox';\nimport { Radio, RadioProps } from '@fluentui/react-radio';\n\n/**\n * Create the state required to render TreeItemPersonaLayout.\n *\n * The returned state can be modified with hooks such as useTreeItemPersonaLayoutStyles_unstable,\n * before being passed to renderTreeItemPersonaLayout_unstable.\n *\n * @param props - props from this instance of TreeItemPersonaLayout\n * @param ref - reference to root HTMLElement of TreeItemPersonaLayout\n */\nexport const useTreeItemPersonaLayout_unstable = (\n props: TreeItemPersonaLayoutProps,\n ref: React.Ref<HTMLSpanElement>,\n): TreeItemPersonaLayoutState => {\n const { media, children, content, description } = props;\n\n const treeItemLayoutState = useTreeItemLayout_unstable(\n {\n ...props,\n iconBefore: null,\n iconAfter: null,\n },\n ref,\n );\n\n const size = useTreeContext_unstable(ctx => ctx.size);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n\n return {\n ...treeItemLayoutState,\n components: {\n expandIcon: 'div',\n content: 'div',\n description: 'div',\n root: 'div',\n media: 'div',\n aside: 'div',\n actions: 'div',\n // Casting here to a union between checkbox and radio\n selector: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n },\n avatarSize: treeAvatarSize[size],\n content: resolveShorthand(content, { required: true, defaultProps: { children } }),\n media: resolveShorthand(media, { required: true }),\n description: resolveShorthand(description),\n };\n};\n"],"names":["React","resolveShorthand","useTreeContext_unstable","treeAvatarSize","useTreeItemLayout_unstable","Checkbox","Radio","useTreeItemPersonaLayout_unstable","props","ref","media","children","content","description","treeItemLayoutState","iconBefore","iconAfter","size","ctx","selectionMode","components","expandIcon","root","aside","actions","selector","avatarSize","required","defaultProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,uBAAuB,QAAQ,iBAAiB;AACzD,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,0BAA0B,QAAQ,sCAAsC;AACjF,SAASC,QAAQ,QAAuB,2BAA2B;AACnE,SAASC,KAAK,QAAoB,wBAAwB;AAE1D;;;;;;;;CAQC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC,OACAC,MAC+B;IAC/B,MAAM,EAAEC,MAAK,EAAEC,SAAQ,EAAEC,QAAO,EAAEC,YAAW,EAAE,GAAGL;IAElD,MAAMM,sBAAsBV,2BAC1B;QACE,GAAGI,KAAK;QACRO,YAAY,IAAI;QAChBC,WAAW,IAAI;IACjB,GACAP;IAGF,MAAMQ,OAAOf,wBAAwBgB,CAAAA,MAAOA,IAAID,IAAI;IACpD,MAAME,gBAAgBjB,wBAAwBgB,CAAAA,MAAOA,IAAIC,aAAa;IAEtE,OAAO;QACL,GAAGL,mBAAmB;QACtBM,YAAY;YACVC,YAAY;YACZT,SAAS;YACTC,aAAa;YACbS,MAAM;YACNZ,OAAO;YACPa,OAAO;YACPC,SAAS;YACT,qDAAqD;YACrDC,UAAWN,kBAAkB,gBAAgBd,WAAWC,KAAK;QAC/D;QACAoB,YAAYvB,cAAc,CAACc,KAAK;QAChCL,SAASX,iBAAiBW,SAAS;YAAEe,UAAU,IAAI;YAAEC,cAAc;gBAAEjB;YAAS;QAAE;QAChFD,OAAOT,iBAAiBS,OAAO;YAAEiB,UAAU,IAAI;QAAC;QAChDd,aAAaZ,iBAAiBY;IAChC;AACF,EAAE"}
@@ -9,7 +9,8 @@ export const treeItemPersonaLayoutClassNames = {
9
9
  content: 'fui-TreeItemPersonaLayout__content',
10
10
  expandIcon: 'fui-TreeItemPersonaLayout__expandIcon',
11
11
  aside: 'fui-TreeItemPersonaLayout__aside',
12
- actions: 'fui-TreeItemPersonaLayout__actions'
12
+ actions: 'fui-TreeItemPersonaLayout__actions',
13
+ selector: 'fui-TreeItemPersonaLayout__selector'
13
14
  };
14
15
  /**
15
16
  * Styles for the root slot
@@ -201,6 +202,9 @@ export const useTreeItemPersonaLayoutStyles_unstable = state => {
201
202
  if (state.expandIcon) {
202
203
  state.expandIcon.className = mergeClasses(treeItemPersonaLayoutClassNames.expandIcon, expandIconStyles.base, state.expandIcon.className);
203
204
  }
205
+ if (state.selector) {
206
+ state.selector.className = mergeClasses(treeItemPersonaLayoutClassNames.selector, state.selector.className);
207
+ }
204
208
  return state;
205
209
  };
206
210
  //# sourceMappingURL=useTreeItemPersonaLayoutStyles.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","treeItemLevelToken","useTreeItemContext_unstable","treeItemPersonaLayoutClassNames","root","media","description","content","expandIcon","aside","actions","useRootStyles","base","mc9l5x","wkccdc","Budl1dq","zoa1oz","Bt984gj","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","lj723h","ecr2s2","zt0xaq","Bi91k9c","Jwef8y","tbva4x","leaf","uwmqm3","branch","d","a","h","useMediaStyles","a9b677","Bqenvij","Ijaq50","Br312pm","nk6f5a","Bw0ie65","z8tnut","z189sj","Byoj8tv","useContentStyles","withDescription","useDescriptionStyles","useActionsStyles","Frg6f3","qhf8xq","Bj3rh1h","useAsideStyles","i8kkvl","Belr9w4","useExpandIconStyles","Brf1p80","Bf4jedk","B7ck84d","sj55zd","Bh6795r","Bnnss6s","xawz","useTreeItemPersonaLayoutStyles_unstable","state","rootStyles","mediaStyles","descriptionStyles","actionsStyles","asideStyles","expandIconStyles","contentStyles","itemType","ctx","className"],"sources":["useTreeItemPersonaLayoutStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { treeItemLevelToken } from '../../utils/tokens';\nimport { useTreeItemContext_unstable } from '../../contexts/treeItemContext';\nexport const treeItemPersonaLayoutClassNames = {\n root: 'fui-TreeItemPersonaLayout',\n media: 'fui-TreeItemPersonaLayout__media',\n description: 'fui-TreeItemPersonaLayout__description',\n content: 'fui-TreeItemPersonaLayout__content',\n expandIcon: 'fui-TreeItemPersonaLayout__expandIcon',\n aside: 'fui-TreeItemPersonaLayout__aside',\n actions: 'fui-TreeItemPersonaLayout__actions'\n};\n/**\n * Styles for the root slot\n */ const useRootStyles = makeStyles({\n base: {\n display: 'grid',\n gridTemplateRows: '1fr auto',\n gridTemplateColumns: 'auto auto 1fr auto',\n gridTemplateAreas: `\n \"expandIcon media content aside\"\n \"expandIcon media description aside\"\n `,\n alignItems: 'center',\n ...typographyStyles.body1,\n ':active': {\n color: tokens.colorNeutralForeground2Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n // TODO: stop using treeItemPersonaLayoutClassNames.expandIcon for styling\n [`& .${treeItemPersonaLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Pressed\n }\n },\n ':hover': {\n color: tokens.colorNeutralForeground2Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n // TODO: stop using treeItemPersonaLayoutClassNames.expandIcon for styling\n [`& .${treeItemPersonaLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Hover\n }\n }\n },\n leaf: {\n paddingLeft: `calc(var(${treeItemLevelToken}, 1) * ${tokens.spacingHorizontalXXL})`\n },\n branch: {\n paddingLeft: `calc((var(${treeItemLevelToken}, 1) - 1) * ${tokens.spacingHorizontalXXL})`\n }\n});\n/**\n * Styles for the expand icon slot\n */ const useMediaStyles = makeStyles({\n base: {\n display: 'flex',\n alignItems: 'center',\n width: '32px',\n height: '32px',\n ...shorthands.gridArea('media'),\n ...shorthands.padding(0, tokens.spacingHorizontalXS, 0, tokens.spacingHorizontalXXS)\n }\n});\nconst useContentStyles = makeStyles({\n base: {\n ...shorthands.gridArea('content'),\n ...shorthands.padding(tokens.spacingVerticalMNudge, tokens.spacingHorizontalXS, tokens.spacingVerticalMNudge, tokens.spacingHorizontalS)\n },\n withDescription: {\n ...shorthands.padding(tokens.spacingVerticalMNudge, tokens.spacingHorizontalXS, 0, tokens.spacingHorizontalS)\n }\n});\nconst useDescriptionStyles = makeStyles({\n base: {\n ...shorthands.gridArea('description'),\n ...typographyStyles.caption1,\n ...shorthands.padding(0, tokens.spacingHorizontalXS, tokens.spacingVerticalMNudge, tokens.spacingHorizontalS)\n }\n});\n/**\n * Styles for the action icon slot\n */ const useActionsStyles = makeStyles({\n base: {\n display: 'flex',\n marginLeft: 'auto',\n position: 'relative',\n zIndex: 1,\n ...shorthands.gridArea('aside'),\n ...shorthands.padding(0, tokens.spacingHorizontalS)\n }\n});\n/**\n * Styles for the action icon slot\n */ const useAsideStyles = makeStyles({\n base: {\n display: 'flex',\n marginLeft: 'auto',\n alignItems: 'center',\n zIndex: 0,\n ...shorthands.gridArea('aside'),\n ...shorthands.padding(0, tokens.spacingHorizontalM),\n ...shorthands.gap(tokens.spacingHorizontalXS)\n }\n});\n/**\n * Styles for the expand icon slot\n */ const useExpandIconStyles = makeStyles({\n base: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '24px',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground3,\n ...shorthands.gridArea('expandIcon'),\n ...shorthands.flex(0, 0, 'auto'),\n ...shorthands.padding(tokens.spacingVerticalXS, 0)\n }\n});\n/**\n * Apply styling to the TreeItemPersonaLayout slots based on the state\n */ export const useTreeItemPersonaLayoutStyles_unstable = (state)=>{\n const rootStyles = useRootStyles();\n const mediaStyles = useMediaStyles();\n const descriptionStyles = useDescriptionStyles();\n const actionsStyles = useActionsStyles();\n const asideStyles = useAsideStyles();\n const expandIconStyles = useExpandIconStyles();\n const contentStyles = useContentStyles();\n const itemType = useTreeItemContext_unstable((ctx)=>ctx.itemType);\n state.root.className = mergeClasses(treeItemPersonaLayoutClassNames.root, rootStyles.base, rootStyles[itemType], state.root.className);\n state.media.className = mergeClasses(treeItemPersonaLayoutClassNames.media, mediaStyles.base, state.media.className);\n if (state.content) {\n state.content.className = mergeClasses(treeItemPersonaLayoutClassNames.content, contentStyles.base, state.description && contentStyles.withDescription, state.content.className);\n }\n if (state.description) {\n state.description.className = mergeClasses(treeItemPersonaLayoutClassNames.description, descriptionStyles.base, state.description.className);\n }\n if (state.actions) {\n state.actions.className = mergeClasses(treeItemPersonaLayoutClassNames.actions, actionsStyles.base, state.actions.className);\n }\n if (state.aside) {\n state.aside.className = mergeClasses(treeItemPersonaLayoutClassNames.aside, asideStyles.base, state.aside.className);\n }\n if (state.expandIcon) {\n state.expandIcon.className = mergeClasses(treeItemPersonaLayoutClassNames.expandIcon, expandIconStyles.base, state.expandIcon.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAE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AAW,EAAE4D,iBAAiB,CAACtD,IAAI,EAAEmD,KAAK,CAACzD,WAAW,CAACmE,SAAS,CAAC;EAChJ;EACA,IAAIV,KAAK,CAACrD,OAAO,EAAE;IACfqD,KAAK,CAACrD,OAAO,CAAC+D,SAAS,GAAG5E,YAAY,CAACM,+BAA+B,CAACO,OAAO,EAAEyD,aAAa,CAACvD,IAAI,EAAEmD,KAAK,CAACrD,OAAO,CAAC+D,SAAS,CAAC;EAChI;EACA,IAAIV,KAAK,CAACtD,KAAK,EAAE;IACbsD,KAAK,CAACtD,KAAK,CAACgE,SAAS,GAAG5E,YAAY,CAACM,+BAA+B,CAACM,KAAK,EAAE2D,WAAW,CAACxD,IAAI,EAAEmD,KAAK,CAACtD,KAAK,CAACgE,SAAS,CAAC;EACxH;EACA,IAAIV,KAAK,CAACvD,UAAU,EAAE;IAClBuD,KAAK,CAACvD,UAAU,CAACiE,SAAS,GAAG5E,YAAY,CAACM,+BAA+B,CAACK,UAAU,EAAE6D,gBAAgB,CAACzD,IAAI,EAAEmD,KAAK,CAACvD,UAAU,CAACiE,SAAS,CAAC;EAC5I;EACA,OAAOV,KAAK;AAChB,CAAC"}
1
+ {"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","treeItemLevelToken","useTreeItemContext_unstable","treeItemPersonaLayoutClassNames","root","media","description","content","expandIcon","aside","actions","selector","useRootStyles","base","mc9l5x","wkccdc","Budl1dq","zoa1oz","Bt984gj","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","lj723h","ecr2s2","zt0xaq","Bi91k9c","Jwef8y","tbva4x","leaf","uwmqm3","branch","d","a","h","useMediaStyles","a9b677","Bqenvij","Ijaq50","Br312pm","nk6f5a","Bw0ie65","z8tnut","z189sj","Byoj8tv","useContentStyles","withDescription","useDescriptionStyles","useActionsStyles","Frg6f3","qhf8xq","Bj3rh1h","useAsideStyles","i8kkvl","Belr9w4","useExpandIconStyles","Brf1p80","Bf4jedk","B7ck84d","sj55zd","Bh6795r","Bnnss6s","xawz","useTreeItemPersonaLayoutStyles_unstable","state","rootStyles","mediaStyles","descriptionStyles","actionsStyles","asideStyles","expandIconStyles","contentStyles","itemType","ctx","className"],"sources":["useTreeItemPersonaLayoutStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { treeItemLevelToken } from '../../utils/tokens';\nimport { useTreeItemContext_unstable } from '../../contexts/treeItemContext';\nexport const treeItemPersonaLayoutClassNames = {\n root: 'fui-TreeItemPersonaLayout',\n media: 'fui-TreeItemPersonaLayout__media',\n description: 'fui-TreeItemPersonaLayout__description',\n content: 'fui-TreeItemPersonaLayout__content',\n expandIcon: 'fui-TreeItemPersonaLayout__expandIcon',\n aside: 'fui-TreeItemPersonaLayout__aside',\n actions: 'fui-TreeItemPersonaLayout__actions',\n selector: 'fui-TreeItemPersonaLayout__selector'\n};\n/**\n * Styles for the root slot\n */ const useRootStyles = makeStyles({\n base: {\n display: 'grid',\n gridTemplateRows: '1fr auto',\n gridTemplateColumns: 'auto auto 1fr auto',\n gridTemplateAreas: `\n \"expandIcon media content aside\"\n \"expandIcon media description aside\"\n `,\n alignItems: 'center',\n ...typographyStyles.body1,\n ':active': {\n color: tokens.colorNeutralForeground2Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n // TODO: stop using treeItemPersonaLayoutClassNames.expandIcon for styling\n [`& .${treeItemPersonaLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Pressed\n }\n },\n ':hover': {\n color: tokens.colorNeutralForeground2Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n // TODO: stop using treeItemPersonaLayoutClassNames.expandIcon for styling\n [`& .${treeItemPersonaLayoutClassNames.expandIcon}`]: {\n color: tokens.colorNeutralForeground3Hover\n }\n }\n },\n leaf: {\n paddingLeft: `calc(var(${treeItemLevelToken}, 1) * ${tokens.spacingHorizontalXXL})`\n },\n branch: {\n paddingLeft: `calc((var(${treeItemLevelToken}, 1) - 1) * ${tokens.spacingHorizontalXXL})`\n }\n});\n/**\n * Styles for the expand icon slot\n */ const useMediaStyles = makeStyles({\n base: {\n display: 'flex',\n alignItems: 'center',\n width: '32px',\n height: '32px',\n ...shorthands.gridArea('media'),\n ...shorthands.padding(0, tokens.spacingHorizontalXS, 0, tokens.spacingHorizontalXXS)\n }\n});\nconst useContentStyles = makeStyles({\n base: {\n ...shorthands.gridArea('content'),\n ...shorthands.padding(tokens.spacingVerticalMNudge, tokens.spacingHorizontalXS, tokens.spacingVerticalMNudge, tokens.spacingHorizontalS)\n },\n withDescription: {\n ...shorthands.padding(tokens.spacingVerticalMNudge, tokens.spacingHorizontalXS, 0, tokens.spacingHorizontalS)\n }\n});\nconst useDescriptionStyles = makeStyles({\n base: {\n ...shorthands.gridArea('description'),\n ...typographyStyles.caption1,\n ...shorthands.padding(0, tokens.spacingHorizontalXS, tokens.spacingVerticalMNudge, tokens.spacingHorizontalS)\n }\n});\n/**\n * Styles for the action icon slot\n */ const useActionsStyles = makeStyles({\n base: {\n display: 'flex',\n marginLeft: 'auto',\n position: 'relative',\n zIndex: 1,\n ...shorthands.gridArea('aside'),\n ...shorthands.padding(0, tokens.spacingHorizontalS)\n }\n});\n/**\n * Styles for the action icon slot\n */ const useAsideStyles = makeStyles({\n base: {\n display: 'flex',\n marginLeft: 'auto',\n alignItems: 'center',\n zIndex: 0,\n ...shorthands.gridArea('aside'),\n ...shorthands.padding(0, tokens.spacingHorizontalM),\n ...shorthands.gap(tokens.spacingHorizontalXS)\n }\n});\n/**\n * Styles for the expand icon slot\n */ const useExpandIconStyles = makeStyles({\n base: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: '24px',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground3,\n ...shorthands.gridArea('expandIcon'),\n ...shorthands.flex(0, 0, 'auto'),\n ...shorthands.padding(tokens.spacingVerticalXS, 0)\n }\n});\n/**\n * Apply styling to the TreeItemPersonaLayout slots based on the state\n */ export const useTreeItemPersonaLayoutStyles_unstable = (state)=>{\n const rootStyles = useRootStyles();\n const mediaStyles = useMediaStyles();\n const descriptionStyles = useDescriptionStyles();\n const actionsStyles = useActionsStyles();\n const asideStyles = useAsideStyles();\n const expandIconStyles = useExpandIconStyles();\n const contentStyles = useContentStyles();\n const itemType = useTreeItemContext_unstable((ctx)=>ctx.itemType);\n state.root.className = mergeClasses(treeItemPersonaLayoutClassNames.root, rootStyles.base, rootStyles[itemType], state.root.className);\n state.media.className = mergeClasses(treeItemPersonaLayoutClassNames.media, mediaStyles.base, state.media.className);\n if (state.content) {\n state.content.className = mergeClasses(treeItemPersonaLayoutClassNames.content, contentStyles.base, state.description && contentStyles.withDescription, state.content.className);\n }\n if (state.description) {\n state.description.className = mergeClasses(treeItemPersonaLayoutClassNames.description, descriptionStyles.base, state.description.className);\n }\n if (state.actions) {\n state.actions.className = mergeClasses(treeItemPersonaLayoutClassNames.actions, actionsStyles.base, state.actions.className);\n }\n if (state.aside) {\n state.aside.className = mergeClasses(treeItemPersonaLayoutClassNames.aside, asideStyles.base, state.aside.className);\n }\n if (state.expandIcon) {\n state.expandIcon.className = mergeClasses(treeItemPersonaLayoutClassNames.expandIcon, expandIconStyles.base, state.expandIcon.className);\n }\n if (state.selector) {\n state.selector.className = mergeClasses(treeItemPersonaLayoutClassNames.selector, state.selector.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,OAAO,MAAMC,+BAA+B,GAAG;EAC3CC,IAAI,EAAE,2BAA2B;EACjCC,KAAK,EAAE,kCAAkC;EACzCC,WAAW,EAAE,wCAAwC;EACrDC,OAAO,EAAE,oCAAoC;EAC7CC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CAACgE,SAAS,CAAC;EAChI;EACA,IAAIV,KAAK,CAACvD,KAAK,EAAE;IACbuD,KAAK,CAACvD,KAAK,CAACiE,SAAS,GAAG7E,YAAY,CAACM,+BAA+B,CAACM,KAAK,EAAE4D,WAAW,CAACxD,IAAI,EAAEmD,KAAK,CAACvD,KAAK,CAACiE,SAAS,CAAC;EACxH;EACA,IAAIV,KAAK,CAACxD,UAAU,EAAE;IAClBwD,KAAK,CAACxD,UAAU,CAACkE,SAAS,GAAG7E,YAAY,CAACM,+BAA+B,CAACK,UAAU,EAAE8D,gBAAgB,CAACzD,IAAI,EAAEmD,KAAK,CAACxD,UAAU,CAACkE,SAAS,CAAC;EAC5I;EACA,IAAIV,KAAK,CAACrD,QAAQ,EAAE;IAChBqD,KAAK,CAACrD,QAAQ,CAAC+D,SAAS,GAAG7E,YAAY,CAACM,+BAA+B,CAACQ,QAAQ,EAAEqD,KAAK,CAACrD,QAAQ,CAAC+D,SAAS,CAAC;EAC/G;EACA,OAAOV,KAAK;AAChB,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export * from './treeContext';
2
2
  export * from './treeItemContext';
3
- export * from './treeItemSlotsContext';
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './treeContext';\nexport * from './treeItemContext';\nexport * from './treeItemSlotsContext';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,yBAAyB"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './treeContext';\nexport * from './treeItemContext';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB"}