@fluentui/react-tree 9.16.9 → 9.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/dist/index.d.cts +83 -6
  3. package/dist/index.d.ts +83 -6
  4. package/lib/Tree.js +1 -1
  5. package/lib/Tree.js.map +1 -1
  6. package/lib/TreeItemLayout.js +1 -1
  7. package/lib/TreeItemLayout.js.map +1 -1
  8. package/lib/components/FlatTree/FlatTree.js.map +1 -1
  9. package/lib/components/FlatTree/FlatTree.types.js.map +1 -1
  10. package/lib/components/FlatTree/index.js.map +1 -1
  11. package/lib/components/FlatTree/renderFlatTree.js.map +1 -1
  12. package/lib/components/FlatTree/useFlatControllableCheckedItems.js.map +1 -1
  13. package/lib/components/FlatTree/useFlatTree.js +28 -3
  14. package/lib/components/FlatTree/useFlatTree.js.map +1 -1
  15. package/lib/components/FlatTree/useFlatTreeContextValues.js.map +1 -1
  16. package/lib/components/FlatTree/useFlatTreeStyles.styles.raw.js.map +1 -1
  17. package/lib/components/FlatTree/useHeadlessFlatTree.js.map +1 -1
  18. package/lib/components/FlatTreeItem/FlatTreeItem.js.map +1 -1
  19. package/lib/components/FlatTreeItem/FlatTreeItem.types.js.map +1 -1
  20. package/lib/components/FlatTreeItem/index.js.map +1 -1
  21. package/lib/components/Tree/Tree.js.map +1 -1
  22. package/lib/components/Tree/Tree.types.js +1 -1
  23. package/lib/components/Tree/Tree.types.js.map +1 -1
  24. package/lib/components/Tree/index.js +1 -1
  25. package/lib/components/Tree/index.js.map +1 -1
  26. package/lib/components/Tree/renderTree.js +8 -4
  27. package/lib/components/Tree/renderTree.js.map +1 -1
  28. package/lib/components/Tree/useNestedControllableCheckedItems.js.map +1 -1
  29. package/lib/components/Tree/useTree.js +75 -6
  30. package/lib/components/Tree/useTree.js.map +1 -1
  31. package/lib/components/Tree/useTreeContextValues.js +4 -1
  32. package/lib/components/Tree/useTreeContextValues.js.map +1 -1
  33. package/lib/components/Tree/useTreeStyles.styles.raw.js.map +1 -1
  34. package/lib/components/TreeItem/TreeItem.js.map +1 -1
  35. package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
  36. package/lib/components/TreeItem/index.js.map +1 -1
  37. package/lib/components/TreeItem/renderTreeItem.js +2 -2
  38. package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
  39. package/lib/components/TreeItem/useTreeItem.js +1 -1
  40. package/lib/components/TreeItem/useTreeItem.js.map +1 -1
  41. package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
  42. package/lib/components/TreeItem/useTreeItemStyles.styles.raw.js.map +1 -1
  43. package/lib/components/TreeItemChevron.js.map +1 -1
  44. package/lib/components/TreeItemLayout/TreeItemLayout.js.map +1 -1
  45. package/lib/components/TreeItemLayout/TreeItemLayout.types.js +1 -1
  46. package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
  47. package/lib/components/TreeItemLayout/index.js +1 -1
  48. package/lib/components/TreeItemLayout/index.js.map +1 -1
  49. package/lib/components/TreeItemLayout/renderTreeItemLayout.js +14 -8
  50. package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
  51. package/lib/components/TreeItemLayout/useTreeItemLayout.js +201 -30
  52. package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
  53. package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.js.map +1 -1
  54. package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.js.map +1 -1
  55. package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
  56. package/lib/components/TreeItemPersonaLayout/index.js.map +1 -1
  57. package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +2 -2
  58. package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
  59. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
  60. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.js.map +1 -1
  61. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.js.map +1 -1
  62. package/lib/components/TreeProvider.js.map +1 -1
  63. package/lib/contexts/index.js.map +1 -1
  64. package/lib/contexts/subtreeContext.js.map +1 -1
  65. package/lib/contexts/treeContext.js.map +1 -1
  66. package/lib/contexts/treeItemContext.js.map +1 -1
  67. package/lib/hooks/useControllableOpenItems.js.map +1 -1
  68. package/lib/hooks/useFlatTreeNavigation.js +3 -4
  69. package/lib/hooks/useFlatTreeNavigation.js.map +1 -1
  70. package/lib/hooks/useHTMLElementWalkerRef.js.map +1 -1
  71. package/lib/hooks/useRootTree.js +4 -9
  72. package/lib/hooks/useRootTree.js.map +1 -1
  73. package/lib/hooks/useRovingTabIndexBase.js +108 -0
  74. package/lib/hooks/useRovingTabIndexBase.js.map +1 -0
  75. package/lib/hooks/useRovingTabIndexes.js +2 -61
  76. package/lib/hooks/useRovingTabIndexes.js.map +1 -1
  77. package/lib/hooks/useSubtree.js +1 -11
  78. package/lib/hooks/useSubtree.js.map +1 -1
  79. package/lib/hooks/useTreeNavigation.js +6 -84
  80. package/lib/hooks/useTreeNavigation.js.map +1 -1
  81. package/lib/hooks/useTreeNavigationBase.js +131 -0
  82. package/lib/hooks/useTreeNavigationBase.js.map +1 -0
  83. package/lib/index.js +2 -2
  84. package/lib/index.js.map +1 -1
  85. package/lib/utils/ImmutableMap.js.map +1 -1
  86. package/lib/utils/ImmutableSet.js.map +1 -1
  87. package/lib/utils/assert.js.map +1 -1
  88. package/lib/utils/createCheckedItems.js.map +1 -1
  89. package/lib/utils/createHTMLElementWalker.js +2 -2
  90. package/lib/utils/createHTMLElementWalker.js.map +1 -1
  91. package/lib/utils/createHeadlessTree.js +4 -4
  92. package/lib/utils/createHeadlessTree.js.map +1 -1
  93. package/lib/utils/flattenTree.js.map +1 -1
  94. package/lib/utils/getTreeItemValueFromElement.js.map +1 -1
  95. package/lib/utils/nextTypeAheadElement.js.map +1 -1
  96. package/lib/utils/normalizeOpenItems.js.map +1 -1
  97. package/lib/utils/queryTreeItemActions.js +29 -0
  98. package/lib/utils/queryTreeItemActions.js.map +1 -0
  99. package/lib/utils/tokens.js.map +1 -1
  100. package/lib/utils/treeItemFilter.js.map +1 -1
  101. package/lib-commonjs/FlatTree.cjs +8 -8
  102. package/lib-commonjs/Tree.cjs +10 -7
  103. package/lib-commonjs/Tree.cjs.map +1 -1
  104. package/lib-commonjs/TreeItem.cjs +7 -7
  105. package/lib-commonjs/TreeItemLayout.cjs +9 -6
  106. package/lib-commonjs/TreeItemLayout.cjs.map +1 -1
  107. package/lib-commonjs/TreeItemPersonaLayout.cjs +6 -6
  108. package/lib-commonjs/components/FlatTree/FlatTree.cjs.map +1 -1
  109. package/lib-commonjs/components/FlatTree/FlatTree.types.cjs.map +1 -1
  110. package/lib-commonjs/components/FlatTree/index.cjs +8 -8
  111. package/lib-commonjs/components/FlatTree/index.cjs.map +1 -1
  112. package/lib-commonjs/components/FlatTree/renderFlatTree.cjs.map +1 -1
  113. package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.cjs +3 -3
  114. package/lib-commonjs/components/FlatTree/useFlatControllableCheckedItems.cjs.map +1 -1
  115. package/lib-commonjs/components/FlatTree/useFlatTree.cjs +28 -3
  116. package/lib-commonjs/components/FlatTree/useFlatTree.cjs.map +1 -1
  117. package/lib-commonjs/components/FlatTree/useFlatTreeContextValues.cjs.map +1 -1
  118. package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.cjs +3 -3
  119. package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.cjs.map +1 -1
  120. package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.raw.cjs +3 -3
  121. package/lib-commonjs/components/FlatTree/useFlatTreeStyles.styles.raw.cjs.map +1 -1
  122. package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.cjs.map +1 -1
  123. package/lib-commonjs/components/FlatTreeItem/FlatTreeItem.cjs.map +1 -1
  124. package/lib-commonjs/components/FlatTreeItem/FlatTreeItem.types.cjs.map +1 -1
  125. package/lib-commonjs/components/FlatTreeItem/index.cjs.map +1 -1
  126. package/lib-commonjs/components/Tree/Tree.cjs.map +1 -1
  127. package/lib-commonjs/components/Tree/Tree.types.cjs +1 -1
  128. package/lib-commonjs/components/Tree/Tree.types.cjs.map +1 -1
  129. package/lib-commonjs/components/Tree/index.cjs +10 -7
  130. package/lib-commonjs/components/Tree/index.cjs.map +1 -1
  131. package/lib-commonjs/components/Tree/renderTree.cjs +1 -1
  132. package/lib-commonjs/components/Tree/renderTree.cjs.map +1 -1
  133. package/lib-commonjs/components/Tree/useNestedControllableCheckedItems.cjs +3 -3
  134. package/lib-commonjs/components/Tree/useNestedControllableCheckedItems.cjs.map +1 -1
  135. package/lib-commonjs/components/Tree/useTree.cjs +68 -8
  136. package/lib-commonjs/components/Tree/useTree.cjs.map +1 -1
  137. package/lib-commonjs/components/Tree/useTreeContextValues.cjs +4 -1
  138. package/lib-commonjs/components/Tree/useTreeContextValues.cjs.map +1 -1
  139. package/lib-commonjs/components/Tree/useTreeStyles.styles.cjs +3 -3
  140. package/lib-commonjs/components/Tree/useTreeStyles.styles.cjs.map +1 -1
  141. package/lib-commonjs/components/Tree/useTreeStyles.styles.raw.cjs +3 -3
  142. package/lib-commonjs/components/Tree/useTreeStyles.styles.raw.cjs.map +1 -1
  143. package/lib-commonjs/components/TreeItem/TreeItem.cjs.map +1 -1
  144. package/lib-commonjs/components/TreeItem/TreeItem.types.cjs.map +1 -1
  145. package/lib-commonjs/components/TreeItem/index.cjs +7 -7
  146. package/lib-commonjs/components/TreeItem/index.cjs.map +1 -1
  147. package/lib-commonjs/components/TreeItem/renderTreeItem.cjs.map +1 -1
  148. package/lib-commonjs/components/TreeItem/useTreeItem.cjs +1 -1
  149. package/lib-commonjs/components/TreeItem/useTreeItem.cjs.map +1 -1
  150. package/lib-commonjs/components/TreeItem/useTreeItemContextValues.cjs.map +1 -1
  151. package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.cjs +3 -3
  152. package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.cjs.map +1 -1
  153. package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.raw.cjs +3 -3
  154. package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.raw.cjs.map +1 -1
  155. package/lib-commonjs/components/TreeItemChevron.cjs.map +1 -1
  156. package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.cjs.map +1 -1
  157. package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs +1 -1
  158. package/lib-commonjs/components/TreeItemLayout/TreeItemLayout.types.cjs.map +1 -1
  159. package/lib-commonjs/components/TreeItemLayout/index.cjs +9 -6
  160. package/lib-commonjs/components/TreeItemLayout/index.cjs.map +1 -1
  161. package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs +9 -6
  162. package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.cjs.map +1 -1
  163. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs +200 -32
  164. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.cjs.map +1 -1
  165. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.cjs +3 -3
  166. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.cjs.map +1 -1
  167. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.cjs +3 -3
  168. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.raw.cjs.map +1 -1
  169. package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.cjs.map +1 -1
  170. package/lib-commonjs/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.cjs.map +1 -1
  171. package/lib-commonjs/components/TreeItemPersonaLayout/index.cjs +6 -6
  172. package/lib-commonjs/components/TreeItemPersonaLayout/index.cjs.map +1 -1
  173. package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.cjs.map +1 -1
  174. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.cjs.map +1 -1
  175. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutContextValues.cjs.map +1 -1
  176. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.cjs +3 -3
  177. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.cjs.map +1 -1
  178. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.cjs +3 -3
  179. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.raw.cjs.map +1 -1
  180. package/lib-commonjs/components/TreeProvider.cjs +3 -3
  181. package/lib-commonjs/components/TreeProvider.cjs.map +1 -1
  182. package/lib-commonjs/contexts/index.cjs +7 -7
  183. package/lib-commonjs/contexts/index.cjs.map +1 -1
  184. package/lib-commonjs/contexts/subtreeContext.cjs +3 -3
  185. package/lib-commonjs/contexts/subtreeContext.cjs.map +1 -1
  186. package/lib-commonjs/contexts/treeContext.cjs +3 -3
  187. package/lib-commonjs/contexts/treeContext.cjs.map +1 -1
  188. package/lib-commonjs/contexts/treeItemContext.cjs +3 -3
  189. package/lib-commonjs/contexts/treeItemContext.cjs.map +1 -1
  190. package/lib-commonjs/hooks/useControllableOpenItems.cjs +3 -3
  191. package/lib-commonjs/hooks/useControllableOpenItems.cjs.map +1 -1
  192. package/lib-commonjs/hooks/useFlatTreeNavigation.cjs +3 -4
  193. package/lib-commonjs/hooks/useFlatTreeNavigation.cjs.map +1 -1
  194. package/lib-commonjs/hooks/useHTMLElementWalkerRef.cjs.map +1 -1
  195. package/lib-commonjs/hooks/useRootTree.cjs +4 -9
  196. package/lib-commonjs/hooks/useRootTree.cjs.map +1 -1
  197. package/lib-commonjs/hooks/useRovingTabIndexBase.cjs +116 -0
  198. package/lib-commonjs/hooks/useRovingTabIndexBase.cjs.map +1 -0
  199. package/lib-commonjs/hooks/useRovingTabIndexes.cjs +2 -62
  200. package/lib-commonjs/hooks/useRovingTabIndexes.cjs.map +1 -1
  201. package/lib-commonjs/hooks/useSubtree.cjs +1 -11
  202. package/lib-commonjs/hooks/useSubtree.cjs.map +1 -1
  203. package/lib-commonjs/hooks/useTreeNavigation.cjs +5 -84
  204. package/lib-commonjs/hooks/useTreeNavigation.cjs.map +1 -1
  205. package/lib-commonjs/hooks/useTreeNavigationBase.cjs +140 -0
  206. package/lib-commonjs/hooks/useTreeNavigationBase.cjs.map +1 -0
  207. package/lib-commonjs/index.cjs +46 -40
  208. package/lib-commonjs/index.cjs.map +1 -1
  209. package/lib-commonjs/utils/ImmutableMap.cjs.map +1 -1
  210. package/lib-commonjs/utils/ImmutableSet.cjs.map +1 -1
  211. package/lib-commonjs/utils/assert.cjs.map +1 -1
  212. package/lib-commonjs/utils/createCheckedItems.cjs.map +1 -1
  213. package/lib-commonjs/utils/createHTMLElementWalker.cjs +2 -2
  214. package/lib-commonjs/utils/createHTMLElementWalker.cjs.map +1 -1
  215. package/lib-commonjs/utils/createHeadlessTree.cjs +7 -7
  216. package/lib-commonjs/utils/createHeadlessTree.cjs.map +1 -1
  217. package/lib-commonjs/utils/flattenTree.cjs.map +1 -1
  218. package/lib-commonjs/utils/getTreeItemValueFromElement.cjs +3 -3
  219. package/lib-commonjs/utils/getTreeItemValueFromElement.cjs.map +1 -1
  220. package/lib-commonjs/utils/nextTypeAheadElement.cjs.map +1 -1
  221. package/lib-commonjs/utils/normalizeOpenItems.cjs.map +1 -1
  222. package/lib-commonjs/utils/queryTreeItemActions.cjs +38 -0
  223. package/lib-commonjs/utils/queryTreeItemActions.cjs.map +1 -0
  224. package/lib-commonjs/utils/tokens.cjs +4 -4
  225. package/lib-commonjs/utils/tokens.cjs.map +1 -1
  226. package/lib-commonjs/utils/treeItemFilter.cjs.map +1 -1
  227. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/TreeItemChevron.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { ChevronRight12Regular } from '@fluentui/react-icons';\nimport { durations, curves } from '@fluentui/react-motion';\nimport { useTreeItemContext_unstable } from '../contexts/treeItemContext';\n\nexport const TreeItemChevron = React.memo(() => {\n const open = useTreeItemContext_unstable(ctx => ctx.open);\n\n const { dir } = useFluent_unstable();\n\n const expandIconRotation = open ? 90 : dir !== 'rtl' ? 0 : 180;\n return (\n <ChevronRight12Regular\n style={{\n ...expandIconInlineStyles[expandIconRotation],\n transition: `transform ${durations.durationNormal}ms ${curves.curveEasyEaseMax}`,\n }}\n />\n );\n});\nTreeItemChevron.displayName = 'TreeItemChevron';\n\nconst expandIconInlineStyles = {\n 90: { transform: `rotate(90deg)` },\n 0: { transform: `rotate(0deg)` },\n 180: { transform: `rotate(180deg)` },\n} as const;\n"],"names":["React","useFluent_unstable","ChevronRight12Regular","durations","curves","useTreeItemContext_unstable","TreeItemChevron","memo","open","ctx","dir","expandIconRotation","style","expandIconInlineStyles","transition","durationNormal","curveEasyEaseMax","displayName","transform"],"mappings":"AAAA;;;;;+BAQaM;;;;;;;iEANU,QAAQ;qCACI,kCAAkC;4BAC/B,wBAAwB;6BAC5B,yBAAyB;iCACf,iCAA8B;AAEnE,wBAAMA,WAAAA,GAAkBN,OAAMO,IAAI,CAAC;IACxC,MAAMC,WAAOH,4CAAAA,EAA4BI,CAAAA,MAAOA,IAAID,IAAI;IAExD,MAAM,EAAEE,GAAG,EAAE,OAAGT,uCAAAA;IAEhB,MAAMU,qBAAqBH,OAAO,KAAKE,QAAQ,QAAQ,IAAI;IAC3D,OAAA,WAAA,GACE,OAAA,aAAA,CAACR,iCAAAA,EAAAA;QACCU,OAAO;YACL,GAAGC,sBAAsB,CAACF,mBAAmB;YAC7CG,YAAY,CAAC,UAAU,EAAEX,sBAAAA,CAAUY,cAAc,CAAC,GAAG,EAAEX,mBAAAA,CAAOY,gBAAgB,EAAE;QAClF;;AAGN,GAAG;AACHV,gBAAgBW,WAAW,GAAG;AAE9B,MAAMJ,yBAAyB;IAC7B,IAAI;QAAEK,WAAW,CAAC,aAAa,CAAC;IAAC;IACjC,GAAG;QAAEA,WAAW,CAAC,YAAY,CAAC;IAAC;IAC/B,KAAK;QAAEA,WAAW,CAAC,cAAc,CAAC;IAAC;AACrC"}
1
+ {"version":3,"sources":["../../src/components/TreeItemChevron.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { ChevronRight12Regular } from '@fluentui/react-icons';\nimport { durations, curves } from '@fluentui/react-motion';\nimport { useTreeItemContext_unstable } from '../contexts/treeItemContext';\n\nexport const TreeItemChevron = React.memo(() => {\n const open = useTreeItemContext_unstable(ctx => ctx.open);\n\n const { dir } = useFluent_unstable();\n\n const expandIconRotation = open ? 90 : dir !== 'rtl' ? 0 : 180;\n return (\n <ChevronRight12Regular\n style={{\n ...expandIconInlineStyles[expandIconRotation],\n transition: `transform ${durations.durationNormal}ms ${curves.curveEasyEaseMax}`,\n }}\n />\n );\n});\nTreeItemChevron.displayName = 'TreeItemChevron';\n\nconst expandIconInlineStyles = {\n 90: { transform: `rotate(90deg)` },\n 0: { transform: `rotate(0deg)` },\n 180: { transform: `rotate(180deg)` },\n} as const;\n"],"names":["React","useFluent_unstable","ChevronRight12Regular","durations","curves","useTreeItemContext_unstable","TreeItemChevron","memo","open","ctx","dir","expandIconRotation","style","expandIconInlineStyles","transition","durationNormal","curveEasyEaseMax","displayName","transform"],"mappings":"AAAA;;;;;+BAQaM;;;;;;;iEANU,QAAQ;qCACI,kCAAkC;4BAC/B,wBAAwB;6BAC5B,yBAAyB;iCACf,iCAA8B;AAEnE,wBAAMA,WAAAA,GAAkBN,OAAMO,IAAI,CAAC;IACxC,MAAMC,WAAOH,4CAAAA,EAA4BI,CAAAA,MAAOA,IAAID,IAAI;IAExD,MAAM,EAAEE,GAAG,EAAE,OAAGT,uCAAAA;IAEhB,MAAMU,qBAAqBH,OAAO,KAAKE,QAAQ,QAAQ,IAAI;IAC3D,OAAA,WAAA,GACE,OAAA,aAAA,CAACR,iCAAAA,EAAAA;QACCU,OAAO;YACL,GAAGC,sBAAsB,CAACF,mBAAmB;YAC7CG,YAAY,CAAC,UAAU,EAAEX,sBAAAA,CAAUY,cAAc,CAAC,GAAG,EAAEX,mBAAAA,CAAOY,gBAAgB,EAAE;QAClF;;AAGN,GAAG;AACHV,gBAAgBW,WAAW,GAAG;AAE9B,MAAMJ,yBAAyB;IAC7B,IAAI;QAAEK,WAAW,CAAC,aAAa,CAAC;IAAC;IACjC,GAAG;QAAEA,WAAW,CAAC,YAAY,CAAC;IAAC;IAC/B,KAAK;QAAEA,WAAW,CAAC,cAAc,CAAC;IAAC;AACrC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/TreeItemLayout/TreeItemLayout.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useTreeItemLayout_unstable } from './useTreeItemLayout';\nimport { renderTreeItemLayout_unstable } from './renderTreeItemLayout';\nimport { useTreeItemLayoutStyles_unstable } from './useTreeItemLayoutStyles.styles';\nimport type { TreeItemLayoutProps } from './TreeItemLayout.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * The `TreeItemLayout` component is used as a child of `TreeItem` to define the content and layout of a tree item.\n * It provides a consistent visual structure for tree items in a `Tree` component.\n * This component should only be used as a direct child of `TreeItem`.\n */\nexport const TreeItemLayout: ForwardRefComponent<TreeItemLayoutProps> = React.forwardRef((props, ref) => {\n const state = useTreeItemLayout_unstable(props, ref);\n\n useTreeItemLayoutStyles_unstable(state);\n useCustomStyleHook_unstable('useTreeItemLayoutStyles_unstable')(state);\n\n return renderTreeItemLayout_unstable(state);\n});\n\nTreeItemLayout.displayName = 'TreeItemLayout';\n"],"names":["React","useTreeItemLayout_unstable","renderTreeItemLayout_unstable","useTreeItemLayoutStyles_unstable","useCustomStyleHook_unstable","TreeItemLayout","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;mCACY,yBAAsB;sCACnB,4BAAyB;+CACtB,sCAAmC;qCAGxC,kCAAkC;AAOvE,MAAMK,iBAAAA,WAAAA,GAA2DL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,YAAQR,6CAAAA,EAA2BM,OAAOC;QAEhDL,+DAAAA,EAAiCM;QACjCL,gDAAAA,EAA4B,oCAAoCK;IAEhE,WAAOP,mDAAAA,EAA8BO;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../src/components/TreeItemLayout/TreeItemLayout.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useTreeItemLayout_unstable } from './useTreeItemLayout';\nimport { renderTreeItemLayout_unstable } from './renderTreeItemLayout';\nimport { useTreeItemLayoutStyles_unstable } from './useTreeItemLayoutStyles.styles';\nimport type { TreeItemLayoutProps } from './TreeItemLayout.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * The `TreeItemLayout` component is used as a child of `TreeItem` to define the content and layout of a tree item.\n * It provides a consistent visual structure for tree items in a `Tree` component.\n * This component should only be used as a direct child of `TreeItem`.\n */\nexport const TreeItemLayout: ForwardRefComponent<TreeItemLayoutProps> = React.forwardRef((props, ref) => {\n const state = useTreeItemLayout_unstable(props, ref);\n\n useTreeItemLayoutStyles_unstable(state);\n useCustomStyleHook_unstable('useTreeItemLayoutStyles_unstable')(state);\n\n return renderTreeItemLayout_unstable(state);\n});\n\nTreeItemLayout.displayName = 'TreeItemLayout';\n"],"names":["React","useTreeItemLayout_unstable","renderTreeItemLayout_unstable","useTreeItemLayoutStyles_unstable","useCustomStyleHook_unstable","TreeItemLayout","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;mCACY,yBAAsB;sCACnB,4BAAyB;+CACtB,sCAAmC;qCAGxC,kCAAkC;AAOvE,MAAMK,iBAAAA,WAAAA,GAA2DL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,YAAQR,6CAAAA,EAA2BM,OAAOC;QAEhDL,+DAAAA,EAAiCM;QACjCL,gDAAAA,EAA4B,oCAAoCK;IAEhE,WAAOP,mDAAAA,EAA8BO;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * State used in rendering TreeItemLayout
2
+ * State returned by `useTreeItemLayoutBase_unstable`.
3
3
  */ "use strict";
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/TreeItemLayout/TreeItemLayout.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type {\n Slot,\n ComponentProps,\n ComponentState,\n ExtractSlotProps,\n EventData,\n EventHandler,\n} from '@fluentui/react-utilities';\nimport type { ButtonContextValue } from '@fluentui/react-button';\nimport type { Checkbox } from '@fluentui/react-checkbox';\nimport type { Radio } from '@fluentui/react-radio';\n\nexport type TreeItemLayoutActionVisibilityChangeData = (\n | EventData<'mouseover' | 'mouseout', MouseEvent>\n | EventData<'focus' | 'blur', FocusEvent>\n | EventData<'blur', React.FocusEvent>\n) & { visible: boolean };\n\nexport type TreeItemLayoutActionSlotProps = ExtractSlotProps<\n Slot<'div'> & {\n /**\n * Forces visibility of the aside/action content\n */\n visible?: boolean;\n onVisibilityChange?: EventHandler<TreeItemLayoutActionVisibilityChangeData>;\n }\n>;\n\nexport type TreeItemLayoutSlots = {\n root: Slot<'div'>;\n /**\n * Content. Children of the root slot are automatically rendered here\n */\n main: 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 /**\n * Aside content is normally used to render a badge or other non-actionable content\n */\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` and `aside` slots are positioned on the exact same spot,\n * so they won't be visible at the same time.\n * `aside` slot is visible by default meanwhile `actions` slot are only visible when the tree item is active.\n *\n * `actions` slot supports a `visible` prop to force visibility of the actions.\n */\n actions?: Slot<TreeItemLayoutActionSlotProps>;\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":"AAuEA;;CAEC,GACD,WAEE"}
1
+ {"version":3,"sources":["../../../src/components/TreeItemLayout/TreeItemLayout.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type {\n Slot,\n ComponentProps,\n ComponentState,\n ExtractSlotProps,\n EventData,\n EventHandler,\n} from '@fluentui/react-utilities';\nimport type { ButtonContextValue } from '@fluentui/react-button';\nimport type { Checkbox } from '@fluentui/react-checkbox';\nimport type { Radio } from '@fluentui/react-radio';\n\nexport type TreeItemLayoutActionVisibilityChangeData = (\n | EventData<'mouseover' | 'mouseout', MouseEvent>\n | EventData<'focus' | 'blur', FocusEvent>\n | EventData<'blur', React.FocusEvent>\n) & { visible: boolean };\n\nexport type TreeItemLayoutActionSlotProps = ExtractSlotProps<\n Slot<'div'> & {\n /**\n * Forces visibility of the aside/action content\n */\n visible?: boolean;\n onVisibilityChange?: EventHandler<TreeItemLayoutActionVisibilityChangeData>;\n }\n>;\n\nexport type TreeItemLayoutSlots = {\n root: Slot<'div'>;\n /**\n * Content. Children of the root slot are automatically rendered here\n */\n main: 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 /**\n * Aside content is normally used to render a badge or other non-actionable content\n */\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` and `aside` slots are positioned on the exact same spot,\n * so they won't be visible at the same time.\n * `aside` slot is visible by default meanwhile `actions` slot are only visible when the tree item is active.\n *\n * `actions` slot supports a `visible` prop to force visibility of the actions.\n */\n actions?: Slot<TreeItemLayoutActionSlotProps>;\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\n/**\n * TreeItemLayout slots without any design dependency, used by `useTreeItemLayoutBase_unstable`.\n *\n * The selector renders as a native `input`, of type `checkbox` or `radio` depending on the tree selection mode.\n */\nexport type TreeItemLayoutBaseSlots = Omit<TreeItemLayoutSlots, 'selector'> & {\n selector?: Slot<'input'>;\n};\n\n/**\n * TreeItemLayout props accepted by `useTreeItemLayoutBase_unstable`.\n */\nexport type TreeItemLayoutBaseProps = ComponentProps<Partial<TreeItemLayoutBaseSlots>>;\n\n/**\n * State returned by `useTreeItemLayoutBase_unstable`.\n */\nexport type TreeItemLayoutBaseState = ComponentState<TreeItemLayoutBaseSlots>;\n"],"names":[],"mappings":"AA4FA;;CAEC,GACD,WAA8E"}
@@ -5,23 +5,26 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- TreeItemLayout: function() {
12
+ get TreeItemLayout () {
13
13
  return _TreeItemLayout.TreeItemLayout;
14
14
  },
15
- renderTreeItemLayout_unstable: function() {
15
+ get renderTreeItemLayout_unstable () {
16
16
  return _renderTreeItemLayout.renderTreeItemLayout_unstable;
17
17
  },
18
- treeItemLayoutClassNames: function() {
18
+ get treeItemLayoutClassNames () {
19
19
  return _useTreeItemLayoutStylesstyles.treeItemLayoutClassNames;
20
20
  },
21
- useTreeItemLayoutStyles_unstable: function() {
21
+ get useTreeItemLayoutBase_unstable () {
22
+ return _useTreeItemLayout.useTreeItemLayoutBase_unstable;
23
+ },
24
+ get useTreeItemLayoutStyles_unstable () {
22
25
  return _useTreeItemLayoutStylesstyles.useTreeItemLayoutStyles_unstable;
23
26
  },
24
- useTreeItemLayout_unstable: function() {
27
+ get useTreeItemLayout_unstable () {
25
28
  return _useTreeItemLayout.useTreeItemLayout_unstable;
26
29
  }
27
30
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/TreeItemLayout/index.ts"],"sourcesContent":["export { TreeItemLayout } from './TreeItemLayout';\nexport type {\n TreeItemLayoutActionSlotProps,\n TreeItemLayoutActionVisibilityChangeData,\n TreeItemLayoutProps,\n TreeItemLayoutSlots,\n TreeItemLayoutState,\n} from './TreeItemLayout.types';\nexport { renderTreeItemLayout_unstable } from './renderTreeItemLayout';\nexport { useTreeItemLayout_unstable } from './useTreeItemLayout';\nexport { treeItemLayoutClassNames, useTreeItemLayoutStyles_unstable } from './useTreeItemLayoutStyles.styles';\n"],"names":["TreeItemLayout","renderTreeItemLayout_unstable","useTreeItemLayout_unstable","treeItemLayoutClassNames","useTreeItemLayoutStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,8BAAc;;;eAQdC,mDAA6B;;;eAE7BE,uDAAwB;;;eAAEC,+DAAgC;;;eAD1DF,6CAA0B;;;gCATJ,sBAAmB;sCAQJ,4BAAyB;mCAC5B,yBAAsB;+CACU,sCAAmC"}
1
+ {"version":3,"sources":["../../../src/components/TreeItemLayout/index.ts"],"sourcesContent":["export { TreeItemLayout } from './TreeItemLayout';\nexport type {\n TreeItemLayoutActionSlotProps,\n TreeItemLayoutActionVisibilityChangeData,\n TreeItemLayoutBaseProps,\n TreeItemLayoutBaseSlots,\n TreeItemLayoutBaseState,\n TreeItemLayoutProps,\n TreeItemLayoutSlots,\n TreeItemLayoutState,\n} from './TreeItemLayout.types';\nexport { renderTreeItemLayout_unstable } from './renderTreeItemLayout';\nexport { useTreeItemLayoutBase_unstable, useTreeItemLayout_unstable } from './useTreeItemLayout';\nexport { treeItemLayoutClassNames, useTreeItemLayoutStyles_unstable } from './useTreeItemLayoutStyles.styles';\n"],"names":["TreeItemLayout","renderTreeItemLayout_unstable","useTreeItemLayoutBase_unstable","useTreeItemLayout_unstable","treeItemLayoutClassNames","useTreeItemLayoutStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,8BAAc;;;eAWdC,mDAA6B;;;eAE7BG,uDAAwB;;;eADxBF,iDAA8B;;;eACJG,+DAAgC;;;eAD1BF,6CAA0B;;;gCAZpC,sBAAmB;sCAWJ,4BAAyB;mCACI,yBAAsB;+CACtB,sCAAmC"}
@@ -13,6 +13,12 @@ const _reactutilities = require("@fluentui/react-utilities");
13
13
  const _reactbutton = require("@fluentui/react-button");
14
14
  const renderTreeItemLayout_unstable = (state)=>{
15
15
  (0, _reactutilities.assertSlots)(state);
16
+ const actionsAndAside = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
17
+ children: [
18
+ state.actions && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.actions, {}),
19
+ state.aside && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.aside, {})
20
+ ]
21
+ });
16
22
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
17
23
  children: [
18
24
  state.expandIcon && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.expandIcon, {}),
@@ -22,13 +28,10 @@ const renderTreeItemLayout_unstable = (state)=>{
22
28
  children: state.root.children
23
29
  }),
24
30
  state.iconAfter && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.iconAfter, {}),
25
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactbutton.ButtonContextProvider, {
31
+ 'buttonContextValue' in state ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactbutton.ButtonContextProvider, {
26
32
  value: state.buttonContextValue,
27
- children: [
28
- state.actions && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.actions, {}),
29
- state.aside && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.aside, {})
30
- ]
31
- })
33
+ children: actionsAndAside
34
+ }) : actionsAndAside
32
35
  ]
33
36
  });
34
37
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/TreeItemLayout/renderTreeItemLayout.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { 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): JSXElement => {\n assertSlots<TreeItemLayoutSlots>(state);\n\n return (\n <state.root>\n {state.expandIcon && <state.expandIcon />}\n {state.selector && <state.selector />}\n {state.iconBefore && <state.iconBefore />}\n <state.main>{state.root.children}</state.main>\n {state.iconAfter && <state.iconAfter />}\n <ButtonContextProvider value={state.buttonContextValue}>\n {state.actions && <state.actions />}\n {state.aside && <state.aside />}\n </ButtonContextProvider>\n </state.root>\n );\n};\n"],"names":["assertSlots","ButtonContextProvider","renderTreeItemLayout_unstable","state","root","expandIcon","selector","iconBefore","main","children","iconAfter","value","buttonContextValue","actions","aside"],"mappings":";;;;+BAUaE;;;;;;4BATb,iCAAiD;gCACrB,4BAA4B;6BAGlB,yBAAyB;AAKxD,sCAAsC,CAACC;QAC5CH,2BAAAA,EAAiCG;IAEjC,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,UAAU,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,UAAU,EAAA,CAAA;YACrCF,MAAMG,QAAQ,IAAA,WAAA,GAAI,mBAAA,EAACH,MAAMG,QAAQ,EAAA,CAAA;YACjCH,MAAMI,UAAU,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,UAAU,EAAA,CAAA;8BACtC,eAAA,EAACJ,MAAMK,IAAI,EAAA;0BAAEL,MAAMC,IAAI,CAACK,QAAQ;;YAC/BN,MAAMO,SAAS,IAAA,WAAA,OAAI,eAAA,EAACP,MAAMO,SAAS,EAAA,CAAA;8BACpC,gBAAA,EAACT,kCAAAA,EAAAA;gBAAsBU,OAAOR,MAAMS,kBAAkB;;oBACnDT,MAAMU,OAAO,IAAA,WAAA,OAAI,eAAA,EAACV,MAAMU,OAAO,EAAA,CAAA;oBAC/BV,MAAMW,KAAK,IAAA,WAAA,OAAI,eAAA,EAACX,MAAMW,KAAK,EAAA,CAAA;;;;;AAIpC,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/TreeItemLayout/renderTreeItemLayout.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TreeItemLayoutBaseState, TreeItemLayoutState, TreeItemLayoutSlots } from './TreeItemLayout.types';\nimport { ButtonContextProvider } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of TreeItemLayout\n *\n * The button context is only provided when the state carries one, which is not the case for the\n * state produced by `useTreeItemLayoutBase_unstable`.\n */\nexport const renderTreeItemLayout_unstable = (state: TreeItemLayoutState | TreeItemLayoutBaseState): JSXElement => {\n assertSlots<TreeItemLayoutSlots>(state);\n\n const actionsAndAside = (\n <>\n {state.actions && <state.actions />}\n {state.aside && <state.aside />}\n </>\n );\n\n return (\n <state.root>\n {state.expandIcon && <state.expandIcon />}\n {state.selector && <state.selector />}\n {state.iconBefore && <state.iconBefore />}\n <state.main>{state.root.children}</state.main>\n {state.iconAfter && <state.iconAfter />}\n {'buttonContextValue' in state ? (\n <ButtonContextProvider value={state.buttonContextValue}>{actionsAndAside}</ButtonContextProvider>\n ) : (\n actionsAndAside\n )}\n </state.root>\n );\n};\n"],"names":["assertSlots","ButtonContextProvider","renderTreeItemLayout_unstable","state","actionsAndAside","actions","aside","root","expandIcon","selector","iconBefore","main","children","iconAfter","value","buttonContextValue"],"mappings":";;;;+BAaaE;;;;;;;gCAZb,gDAAiD,GACjD,SAASF,WAAW,QAAQ,4BAA4B;6BAGlB,yBAAyB;AAQxD,sCAAsC,CAACG;QAC5CH,2BAAAA,EAAiCG;IAEjC,MAAMC,kBAAAA,WAAAA,OACJ,gBAAA,EAAA,oBAAA,EAAA;;YACGD,MAAME,OAAO,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,OAAO,EAAA,CAAA;YAC/BF,MAAMG,KAAK,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,KAAK,EAAA,CAAA;;;IAIhC,OAAA,WAAA,OACE,gBAAA,EAACH,MAAMI,IAAI,EAAA;;YACRJ,MAAMK,UAAU,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,UAAU,EAAA,CAAA;YACrCL,MAAMM,QAAQ,IAAA,WAAA,GAAI,mBAAA,EAACN,MAAMM,QAAQ,EAAA,CAAA;YACjCN,MAAMO,UAAU,IAAA,WAAA,OAAI,eAAA,EAACP,MAAMO,UAAU,EAAA,CAAA;8BACtC,eAAA,EAACP,MAAMQ,IAAI,EAAA;0BAAER,MAAMI,IAAI,CAACK,QAAQ;;YAC/BT,MAAMU,SAAS,IAAA,WAAA,OAAI,eAAA,EAACV,MAAMU,SAAS,EAAA,CAAA;YACnC,wBAAwBV,QAAAA,WAAAA,OACvB,eAAA,EAACF,kCAAAA,EAAAA;gBAAsBa,OAAOX,MAAMY,kBAAkB;0BAAGX;iBAEzDA;;;AAIR,EAAE"}
@@ -3,9 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "useTreeItemLayout_unstable", {
7
- enumerable: true,
8
- get: function() {
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: Object.getOwnPropertyDescriptor(all, name).get
10
+ });
11
+ }
12
+ _export(exports, {
13
+ get useTreeItemLayoutBase_unstable () {
14
+ return useTreeItemLayoutBase_unstable;
15
+ },
16
+ get useTreeItemLayout_unstable () {
9
17
  return useTreeItemLayout_unstable;
10
18
  }
11
19
  });
@@ -18,14 +26,91 @@ const _reactradio = require("@fluentui/react-radio");
18
26
  const _TreeItemChevron = require("../TreeItemChevron.cjs");
19
27
  const _reacttabster = require("@fluentui/react-tabster");
20
28
  const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
29
+ const _queryTreeItemActions = require("../../utils/queryTreeItemActions.cjs");
21
30
  const useTreeItemLayout_unstable = (props, ref)=>{
22
- const { main, iconAfter, iconBefore } = props;
23
- const layoutRef = (0, _index.useTreeItemContext_unstable)((ctx)=>ctx.layoutRef);
31
+ const { selector: selectorProp, ...baseProps } = props;
32
+ const isNavigatingWithKeyboard = (0, _reacttabster.useIsNavigatingWithKeyboard)();
33
+ const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
34
+ const state = useTreeItemLayoutBase(// the Fluent selector itself is resolved below.
35
+ {
36
+ ...baseProps,
37
+ selector: selectorProp === undefined || selectorProp === null ? selectorProp : {}
38
+ }, ref, targetDocument, isNavigatingWithKeyboard);
24
39
  const selectionMode = (0, _index.useTreeContext_unstable)((ctx)=>ctx.selectionMode);
25
40
  const navigationMode = (0, _index.useTreeContext_unstable)((ctx)=>{
26
41
  var _ctx_navigationMode;
27
42
  return (_ctx_navigationMode = ctx.navigationMode) !== null && _ctx_navigationMode !== void 0 ? _ctx_navigationMode : 'tree';
28
43
  });
44
+ const selectionRef = (0, _index.useTreeItemContext_unstable)((ctx)=>ctx.selectionRef);
45
+ const checked = (0, _index.useTreeItemContext_unstable)((ctx)=>ctx.checked);
46
+ const expandIconRef = (0, _index.useTreeItemContext_unstable)((ctx)=>ctx.expandIconRef);
47
+ // Link the selector to the main content unless the consumer provided an accessible name
48
+ const selectorShorthand = (0, _reactutilities.isResolvedShorthand)(selectorProp) ? selectorProp : undefined;
49
+ const selectorAriaLabelledBy = (selectorShorthand === null || selectorShorthand === void 0 ? void 0 : selectorShorthand['aria-label']) || (selectorShorthand === null || selectorShorthand === void 0 ? void 0 : selectorShorthand['aria-labelledby']) ? undefined : state.main.id;
50
+ const selector = _reactutilities.slot.optional(selectorProp, {
51
+ renderByDefault: selectionMode !== 'none',
52
+ defaultProps: {
53
+ checked,
54
+ tabIndex: -1,
55
+ ref: selectionRef,
56
+ 'aria-labelledby': selectorAriaLabelledBy
57
+ },
58
+ elementType: selectionMode === 'multiselect' ? _reactcheckbox.Checkbox : _reactradio.Radio
59
+ });
60
+ // Checkbox and Radio slot props omit `ref` from their type, but consumers can still provide it.
61
+ const selectorConsumerRef = selector && selector.ref;
62
+ const selectorRef = (0, _reactutilities.useMergedRefs)(selectorConsumerRef, selectionRef);
63
+ const selectorWithRef = selector && {
64
+ ...selector,
65
+ ref: selectorRef
66
+ };
67
+ const arrowNavigationProps = (0, _reacttabster.useArrowNavigationGroup)({
68
+ circular: navigationMode === 'tree',
69
+ axis: 'horizontal'
70
+ });
71
+ const expandIcon = state.expandIcon ? _reactutilities.slot.optional(props.expandIcon, {
72
+ renderByDefault: true,
73
+ defaultProps: {
74
+ 'aria-hidden': true,
75
+ children: /*#__PURE__*/ _react.createElement(_TreeItemChevron.TreeItemChevron, null),
76
+ ref: expandIconRef
77
+ },
78
+ elementType: 'div'
79
+ }) : undefined;
80
+ const expandIconRefWithConsumer = (0, _reactutilities.useMergedRefs)(expandIcon === null || expandIcon === void 0 ? void 0 : expandIcon.ref, expandIconRef);
81
+ const expandIconWithRef = expandIcon && {
82
+ ...expandIcon,
83
+ ref: expandIconRefWithConsumer
84
+ };
85
+ return {
86
+ ...state,
87
+ components: {
88
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
89
+ ...state.components,
90
+ // Casting here to a union between checkbox and radio
91
+ selector: selectionMode === 'multiselect' ? _reactcheckbox.Checkbox : _reactradio.Radio
92
+ },
93
+ buttonContextValue: {
94
+ size: 'small'
95
+ },
96
+ // Consumer props keep winning over the navigation attributes, matching the base slot ordering.
97
+ actions: state.actions && {
98
+ ...arrowNavigationProps,
99
+ ...state.actions
100
+ },
101
+ expandIcon: expandIconWithRef,
102
+ selector: selectorWithRef
103
+ };
104
+ };
105
+ const useTreeItemLayoutBase_unstable = (props, ref)=>{
106
+ const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
107
+ const isNavigatingWithKeyboard = useDOMKeyboardNavigation(targetDocument, Boolean(props.actions));
108
+ return useTreeItemLayoutBase(props, ref, targetDocument, isNavigatingWithKeyboard);
109
+ };
110
+ function useTreeItemLayoutBase(props, ref, targetDocument, isNavigatingWithKeyboard) {
111
+ const { main, iconAfter, iconBefore } = props;
112
+ const layoutRef = (0, _index.useTreeItemContext_unstable)((ctx)=>ctx.layoutRef);
113
+ const selectionMode = (0, _index.useTreeContext_unstable)((ctx)=>ctx.selectionMode);
29
114
  const [isActionsVisibleFromProps, onActionVisibilityChange] = (0, _reactutilities.isResolvedShorthand)(props.actions) ? [
30
115
  props.actions.visible,
31
116
  props.actions.onVisibilityChange
@@ -50,16 +135,37 @@ const useTreeItemLayout_unstable = (props, ref)=>{
50
135
  // Link the selector to the main content unless the consumer provided an accessible name
51
136
  const selectorShorthand = (0, _reactutilities.isResolvedShorthand)(props.selector) ? props.selector : undefined;
52
137
  const selectorAriaLabelledBy = (selectorShorthand === null || selectorShorthand === void 0 ? void 0 : selectorShorthand['aria-label']) || (selectorShorthand === null || selectorShorthand === void 0 ? void 0 : selectorShorthand['aria-labelledby']) ? undefined : mainContentId;
53
- const selector = _reactutilities.slot.optional(props.selector, {
138
+ // The mixed state of a native checkbox can only be set through its `indeterminate` DOM property.
139
+ const selectorInputRef = _react.useRef(null);
140
+ (0, _reactutilities.useIsomorphicLayoutEffect)(()=>{
141
+ if (selectorInputRef.current) {
142
+ selectorInputRef.current.indeterminate = checked === 'mixed';
143
+ }
144
+ });
145
+ const selectorSlot = _reactutilities.slot.optional(props.selector, {
54
146
  renderByDefault: selectionMode !== 'none',
55
147
  defaultProps: {
56
- checked,
148
+ type: selectionMode === 'multiselect' ? 'checkbox' : 'radio',
149
+ checked: checked === true,
57
150
  tabIndex: -1,
58
- ref: selectionRef,
59
- 'aria-labelledby': selectorAriaLabelledBy
151
+ 'aria-labelledby': selectorAriaLabelledBy,
152
+ // Changes bubble up to the tree item, which owns the selection state.
153
+ onChange: noop
60
154
  },
61
- elementType: selectionMode === 'multiselect' ? _reactcheckbox.Checkbox : _reactradio.Radio
155
+ elementType: 'input'
156
+ });
157
+ const selectorRef = (0, _reactutilities.useMergedRefs)(selectorSlot === null || selectorSlot === void 0 ? void 0 : selectorSlot.ref, selectionRef, selectorInputRef);
158
+ // Clicking a native checkbox clears `indeterminate`, which no commit restores if the change is rejected
159
+ const handleSelectorChange = (0, _reactutilities.useEventCallback)((event)=>{
160
+ var _selectorSlot_onChange;
161
+ selectorSlot === null || selectorSlot === void 0 ? void 0 : (_selectorSlot_onChange = selectorSlot.onChange) === null || _selectorSlot_onChange === void 0 ? void 0 : _selectorSlot_onChange.call(selectorSlot, event);
162
+ event.currentTarget.indeterminate = checked === 'mixed';
62
163
  });
164
+ const selector = selectorSlot && {
165
+ ...selectorSlot,
166
+ ref: selectorRef,
167
+ onChange: handleSelectorChange
168
+ };
63
169
  const mainSlot = _reactutilities.slot.always(main, {
64
170
  defaultProps: {
65
171
  id: selector ? mainContentId : undefined
@@ -90,8 +196,7 @@ const useTreeItemLayout_unstable = (props, ref)=>{
90
196
  setIsActionsVisible,
91
197
  onActionVisibilityChange
92
198
  ]);
93
- const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
94
- const isNavigatingWithKeyboard = (0, _reacttabster.useIsNavigatingWithKeyboard)();
199
+ const hasActions = Boolean(props.actions);
95
200
  const setActionsInvisibleIfNotFromSubtree = _react.useCallback((event)=>{
96
201
  const isRelatedTargetFromActions = ()=>Boolean(actionsRefInternal.current && (0, _reactutilities.elementContains)(actionsRefInternal.current, event.relatedTarget));
97
202
  const isRelatedTargetFromTreeItem = ()=>Boolean(treeItemRef.current && (0, _reactutilities.elementContains)(treeItemRef.current, event.relatedTarget));
@@ -136,20 +241,18 @@ const useTreeItemLayout_unstable = (props, ref)=>{
136
241
  isNavigatingWithKeyboard,
137
242
  targetDocument
138
243
  ]);
139
- const expandIconRefs = (0, _reactutilities.useMergedRefs)(expandIconRef);
140
- const expandIcon = _reactutilities.slot.optional(props.expandIcon, {
244
+ const expandIconSlot = _reactutilities.slot.optional(props.expandIcon, {
141
245
  renderByDefault: isBranch,
142
246
  defaultProps: {
143
- children: /*#__PURE__*/ _react.createElement(_TreeItemChevron.TreeItemChevron, null),
144
- 'aria-hidden': true,
145
- ref: expandIconRefs
247
+ 'aria-hidden': true
146
248
  },
147
249
  elementType: 'div'
148
250
  });
149
- const arrowNavigationProps = (0, _reacttabster.useArrowNavigationGroup)({
150
- circular: navigationMode === 'tree',
151
- axis: 'horizontal'
152
- });
251
+ const expandIconRefs = (0, _reactutilities.useMergedRefs)(expandIconSlot === null || expandIconSlot === void 0 ? void 0 : expandIconSlot.ref, expandIconRef);
252
+ const expandIcon = expandIconSlot && {
253
+ ...expandIconSlot,
254
+ ref: expandIconRefs
255
+ };
153
256
  const handleActionsBlur = (0, _reactutilities.useEventCallback)((event)=>{
154
257
  if ((0, _reactutilities.isResolvedShorthand)(props.actions)) {
155
258
  var _props_actions_onBlur, _props_actions;
@@ -163,17 +266,24 @@ const useTreeItemLayout_unstable = (props, ref)=>{
163
266
  });
164
267
  setIsActionsVisible(isRelatedTargetFromActions);
165
268
  });
166
- const actionsRefs = (0, _reactutilities.useMergedRefs)(actionsRef, actionsRefInternal);
167
- const actions = isActionsVisible ? _reactutilities.slot.optional(props.actions, {
269
+ const actionsSlot = isActionsVisible ? _reactutilities.slot.optional(props.actions, {
168
270
  defaultProps: {
169
- ...arrowNavigationProps,
170
271
  role: 'toolbar',
171
- ref: actionsRefs,
172
272
  onBlur: handleActionsBlur
173
273
  },
174
274
  elementType: 'div'
175
275
  }) : undefined;
176
- const hasActions = Boolean(props.actions);
276
+ // The internal refs are merged after slot resolution, so that a consumer provided ref does not override them
277
+ const actionsRefs = (0, _reactutilities.useMergedRefs)(actionsSlot === null || actionsSlot === void 0 ? void 0 : actionsSlot.ref, actionsRef, actionsRefInternal, _queryTreeItemActions.registerTreeItemActions);
278
+ const actions = actionsSlot && {
279
+ ...actionsSlot,
280
+ ref: actionsRefs
281
+ };
282
+ if (actions) {
283
+ // .visible .onVisibilityChange are consumed above and should not be propagated to the DOM
284
+ delete actions.visible;
285
+ delete actions.onVisibilityChange;
286
+ }
177
287
  _react.useEffect(()=>{
178
288
  if (treeItemRef.current && hasActions) {
179
289
  const treeItemElement = treeItemRef.current;
@@ -207,11 +317,7 @@ const useTreeItemLayout_unstable = (props, ref)=>{
207
317
  iconAfter: 'div',
208
318
  actions: 'div',
209
319
  aside: 'div',
210
- // Casting here to a union between checkbox and radio
211
- selector: selectionMode === 'multiselect' ? _reactcheckbox.Checkbox : _reactradio.Radio
212
- },
213
- buttonContextValue: {
214
- size: 'small'
320
+ selector: 'input'
215
321
  },
216
322
  root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
217
323
  ...props,
@@ -236,7 +342,69 @@ const useTreeItemLayout_unstable = (props, ref)=>{
236
342
  expandIcon,
237
343
  selector
238
344
  };
239
- };
345
+ }
346
+ /**
347
+ * Keyboard modality trackers shared by every base layout of a document, so that the number of
348
+ * document listeners does not grow with the number of mounted tree items.
349
+ */ const domKeyboardNavigationTrackers = new WeakMap();
350
+ // Only pointer activation switches the modality, so that hovering does not discard keyboard focus
351
+ const DOM_POINTER_EVENTS = [
352
+ 'pointerdown',
353
+ 'mousedown',
354
+ 'touchstart'
355
+ ];
356
+ function subscribeToDOMKeyboardNavigation(targetDocument) {
357
+ let tracker = domKeyboardNavigationTrackers.get(targetDocument);
358
+ if (!tracker) {
359
+ const onKeyDown = ()=>{
360
+ state.isNavigatingWithKeyboard = true;
361
+ };
362
+ const onPointerInteraction = ()=>{
363
+ state.isNavigatingWithKeyboard = false;
364
+ };
365
+ const state = {
366
+ isNavigatingWithKeyboard: false,
367
+ subscribers: 0,
368
+ dispose: ()=>{
369
+ targetDocument.removeEventListener('keydown', onKeyDown, true);
370
+ DOM_POINTER_EVENTS.forEach((type)=>targetDocument.removeEventListener(type, onPointerInteraction, true));
371
+ domKeyboardNavigationTrackers.delete(targetDocument);
372
+ }
373
+ };
374
+ targetDocument.addEventListener('keydown', onKeyDown, true);
375
+ DOM_POINTER_EVENTS.forEach((type)=>targetDocument.addEventListener(type, onPointerInteraction, true));
376
+ domKeyboardNavigationTrackers.set(targetDocument, state);
377
+ tracker = state;
378
+ }
379
+ tracker.subscribers++;
380
+ return tracker;
381
+ }
382
+ function useDOMKeyboardNavigation(targetDocument, enabled) {
383
+ const trackerRef = _react.useRef(null);
384
+ _react.useEffect(()=>{
385
+ if (!targetDocument || !enabled) {
386
+ return;
387
+ }
388
+ const tracker = subscribeToDOMKeyboardNavigation(targetDocument);
389
+ trackerRef.current = tracker;
390
+ return ()=>{
391
+ trackerRef.current = null;
392
+ if (--tracker.subscribers === 0) {
393
+ tracker.dispose();
394
+ }
395
+ };
396
+ }, [
397
+ targetDocument,
398
+ enabled
399
+ ]);
400
+ return _react.useCallback(()=>{
401
+ var _ref;
402
+ var _trackerRef_current;
403
+ return (_ref = (_trackerRef_current = trackerRef.current) === null || _trackerRef_current === void 0 ? void 0 : _trackerRef_current.isNavigatingWithKeyboard) !== null && _ref !== void 0 ? _ref : false;
404
+ }, []);
405
+ }
406
+ function noop() {
407
+ /* noop */ }
240
408
  function assertIsRefObject(ref) {
241
409
  if (process.env.NODE_ENV !== 'production') {
242
410
  if (typeof ref !== 'object' || ref === null || !('current' in ref)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/TreeItemLayout/useTreeItemLayout.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isResolvedShorthand,\n useMergedRefs,\n slot,\n useEventCallback,\n elementContains,\n useControllableState,\n useId,\n} from '@fluentui/react-utilities';\nimport { useTreeItemContext_unstable, useTreeContext_unstable } from '../../contexts';\nimport type {\n TreeItemLayoutActionSlotProps,\n TreeItemLayoutActionVisibilityChangeData,\n TreeItemLayoutProps,\n TreeItemLayoutState,\n} from './TreeItemLayout.types';\nimport type { CheckboxProps } from '@fluentui/react-checkbox';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport type { RadioProps } from '@fluentui/react-radio';\nimport { Radio } from '@fluentui/react-radio';\nimport { TreeItemChevron } from '../TreeItemChevron';\nimport { useArrowNavigationGroup, useIsNavigatingWithKeyboard } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\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 { main, iconAfter, iconBefore } = props;\n\n const layoutRef = useTreeItemContext_unstable(ctx => ctx.layoutRef);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n const navigationMode = useTreeContext_unstable(ctx => ctx.navigationMode ?? 'tree');\n\n const [isActionsVisibleFromProps, onActionVisibilityChange]: [\n TreeItemLayoutActionSlotProps['visible'],\n TreeItemLayoutActionSlotProps['onVisibilityChange'],\n ] = isResolvedShorthand(props.actions)\n ? // .visible .onVisibilityChange prop should not be propagated to the DOM\n [props.actions.visible, props.actions.onVisibilityChange]\n : [undefined, undefined];\n\n const [isActionsVisible, setIsActionsVisible] = useControllableState({\n state: isActionsVisibleFromProps,\n initialState: false,\n });\n\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 actionsRefInternal = React.useRef<HTMLDivElement>(null);\n const treeItemRef = useTreeItemContext_unstable(ctx => ctx.treeItemRef);\n const subtreeRef = useTreeItemContext_unstable(ctx => ctx.subtreeRef);\n const checked = useTreeItemContext_unstable(ctx => ctx.checked);\n const isBranch = useTreeItemContext_unstable(ctx => ctx.itemType === 'branch');\n\n const mainShorthand = isResolvedShorthand(main) ? main : undefined;\n const mainContentId = useId('fui-TreeItemLayout__main-', mainShorthand?.id);\n\n // Link the selector to the main content unless the consumer provided an accessible name\n const selectorShorthand = isResolvedShorthand(props.selector) ? props.selector : undefined;\n const selectorAriaLabelledBy =\n selectorShorthand?.['aria-label'] || selectorShorthand?.['aria-labelledby'] ? undefined : mainContentId;\n\n const selector = slot.optional(props.selector, {\n renderByDefault: selectionMode !== 'none',\n defaultProps: {\n checked,\n tabIndex: -1,\n ref: selectionRef,\n 'aria-labelledby': selectorAriaLabelledBy,\n // casting here to a union between checkbox and radio\n // since ref is not present on the selector signature\n // FIXME: look into Slot type to see if we can make this work\n } as CheckboxProps | RadioProps,\n elementType: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n });\n const mainSlot = slot.always(main, {\n defaultProps: { id: selector ? mainContentId : undefined },\n elementType: 'div',\n });\n\n // FIXME: Asserting is required here, as converting this to RefObject on context type would be a breaking change\n // eslint-disable-next-line react-hooks/refs\n assertIsRefObject(treeItemRef);\n // FIXME: Asserting is required here, as converting this to RefObject on context type would be a breaking change\n // eslint-disable-next-line react-hooks/refs\n assertIsRefObject(subtreeRef);\n\n const setActionsVisibleIfNotFromSubtree = React.useCallback(\n (event: MouseEvent | FocusEvent) => {\n const isTargetFromSubtree = Boolean(\n subtreeRef.current && elementContains(subtreeRef.current, event.target as Node),\n );\n if (!isTargetFromSubtree) {\n onActionVisibilityChange?.(event, {\n visible: true,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(true);\n }\n },\n [subtreeRef, setIsActionsVisible, onActionVisibilityChange],\n );\n\n const { targetDocument } = useFluent();\n const isNavigatingWithKeyboard = useIsNavigatingWithKeyboard();\n\n const setActionsInvisibleIfNotFromSubtree = React.useCallback(\n (event: FocusEvent | MouseEvent) => {\n const isRelatedTargetFromActions = () =>\n Boolean(actionsRefInternal.current && elementContains(actionsRefInternal.current, event.relatedTarget as Node));\n const isRelatedTargetFromTreeItem = () =>\n Boolean(treeItemRef.current && elementContains(treeItemRef.current, event.relatedTarget as Node));\n const isTargetFromActions = () => Boolean(actionsRefInternal.current?.contains(event.target as Node));\n if (isRelatedTargetFromActions()) {\n onActionVisibilityChange?.(event, {\n visible: true,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(true);\n return;\n }\n if (isTargetFromActions() && isRelatedTargetFromTreeItem()) {\n return;\n }\n // when a mouseout event happens during keyboard interaction\n // we should not hide the actions if the activeElement is the treeitem or an action\n // as the focus on the treeitem takes precedence over the mouseout event\n if (\n event.type === 'mouseout' &&\n isNavigatingWithKeyboard() &&\n (targetDocument?.activeElement === treeItemRef.current ||\n elementContains(actionsRefInternal.current, targetDocument?.activeElement as Node))\n ) {\n return;\n }\n onActionVisibilityChange?.(event, {\n visible: false,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(false);\n },\n [setIsActionsVisible, onActionVisibilityChange, treeItemRef, isNavigatingWithKeyboard, targetDocument],\n );\n\n const expandIconRefs = useMergedRefs(expandIconRef);\n const expandIcon = slot.optional(props.expandIcon, {\n renderByDefault: isBranch,\n defaultProps: {\n children: <TreeItemChevron />,\n 'aria-hidden': true,\n ref: expandIconRefs,\n },\n elementType: 'div',\n });\n const arrowNavigationProps = useArrowNavigationGroup({ circular: navigationMode === 'tree', axis: 'horizontal' });\n\n const handleActionsBlur = useEventCallback((event: React.FocusEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.actions)) {\n props.actions.onBlur?.(event);\n }\n const isRelatedTargetFromActions = Boolean(elementContains(event.currentTarget, event.relatedTarget as Node));\n onActionVisibilityChange?.(event, {\n visible: isRelatedTargetFromActions,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n setIsActionsVisible(isRelatedTargetFromActions);\n });\n\n const actionsRefs = useMergedRefs(actionsRef, actionsRefInternal);\n const actions = isActionsVisible\n ? slot.optional(props.actions, {\n defaultProps: {\n ...arrowNavigationProps,\n role: 'toolbar',\n ref: actionsRefs,\n onBlur: handleActionsBlur,\n },\n elementType: 'div',\n })\n : undefined;\n\n const hasActions = Boolean(props.actions);\n\n React.useEffect(() => {\n if (treeItemRef.current && hasActions) {\n const treeItemElement = treeItemRef.current;\n\n const handleMouseOver = setActionsVisibleIfNotFromSubtree;\n const handleMouseOut = setActionsInvisibleIfNotFromSubtree;\n const handleFocus = setActionsVisibleIfNotFromSubtree;\n const handleBlur = setActionsInvisibleIfNotFromSubtree;\n\n treeItemElement.addEventListener('mouseover', handleMouseOver);\n treeItemElement.addEventListener('mouseout', handleMouseOut);\n treeItemElement.addEventListener('focus', handleFocus);\n treeItemElement.addEventListener('blur', handleBlur);\n\n return () => {\n treeItemElement.removeEventListener('mouseover', handleMouseOver);\n treeItemElement.removeEventListener('mouseout', handleMouseOut);\n treeItemElement.removeEventListener('focus', handleFocus);\n treeItemElement.removeEventListener('blur', handleBlur);\n };\n }\n }, [hasActions, treeItemRef, setActionsVisibleIfNotFromSubtree, setActionsInvisibleIfNotFromSubtree]);\n\n return {\n components: {\n root: 'div',\n expandIcon: 'div',\n iconBefore: 'div',\n main: '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: slot.always(\n getIntrinsicElementProps('div', {\n ...props,\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, layoutRef) as React.Ref<HTMLDivElement>,\n }),\n {\n elementType: 'div',\n },\n ),\n iconBefore: slot.optional(iconBefore, { elementType: 'div' }),\n main: mainSlot,\n iconAfter: slot.optional(iconAfter, { elementType: 'div' }),\n aside: !isActionsVisible ? slot.optional(props.aside, { elementType: 'div' }) : undefined,\n actions,\n expandIcon,\n selector,\n };\n};\n\nfunction assertIsRefObject<Value>(ref?: React.Ref<Value>): asserts ref is React.RefObject<Value> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof ref !== 'object' || ref === null || !('current' in ref)) {\n throw new Error(`\n @fluentui/react-tree [${useTreeItemLayout_unstable.name}]:\n Internal Error: contextual ref is not a RefObject! Please report this bug immediately, as contextual refs should be RefObjects.\n `);\n }\n }\n}\n"],"names":["React","getIntrinsicElementProps","isResolvedShorthand","useMergedRefs","slot","useEventCallback","elementContains","useControllableState","useId","useTreeItemContext_unstable","useTreeContext_unstable","Checkbox","Radio","TreeItemChevron","useArrowNavigationGroup","useIsNavigatingWithKeyboard","useFluent_unstable","useFluent","useTreeItemLayout_unstable","props","ref","main","iconAfter","iconBefore","layoutRef","ctx","selectionMode","navigationMode","isActionsVisibleFromProps","onActionVisibilityChange","actions","visible","onVisibilityChange","undefined","isActionsVisible","setIsActionsVisible","state","initialState","selectionRef","expandIconRef","actionsRef","actionsRefInternal","useRef","treeItemRef","subtreeRef","checked","isBranch","itemType","mainShorthand","mainContentId","id","selectorShorthand","selector","selectorAriaLabelledBy","optional","renderByDefault","defaultProps","tabIndex","elementType","mainSlot","always","assertIsRefObject","setActionsVisibleIfNotFromSubtree","useCallback","event","isTargetFromSubtree","Boolean","current","target","type","defaultPrevented","targetDocument","isNavigatingWithKeyboard","setActionsInvisibleIfNotFromSubtree","isRelatedTargetFromActions","relatedTarget","isRelatedTargetFromTreeItem","isTargetFromActions","contains","activeElement","expandIconRefs","expandIcon","children","arrowNavigationProps","circular","axis","handleActionsBlur","onBlur","currentTarget","actionsRefs","role","hasActions","useEffect","treeItemElement","handleMouseOver","handleMouseOut","handleFocus","handleBlur","addEventListener","removeEventListener","components","root","aside","buttonContextValue","size","process","env","NODE_ENV","Error","name"],"mappings":"AAAA;;;;;+BAqCakB;;;;;;;iEAnCU,QAAQ;gCAUxB,4BAA4B;uBACkC,0BAAiB;+BAQ7D,2BAA2B;4BAE9B,wBAAwB;iCACd,wBAAqB;8BACgB,0BAA0B;qCAC/C,kCAAkC;AAW3E,mCAAmC,CACxCC,OACAC;IAEA,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAE,GAAGJ;IAExC,MAAMK,YAAYf,sCAAAA,EAA4BgB,CAAAA,MAAOA,IAAID,SAAS;IAClE,MAAME,oBAAgBhB,8BA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O,CAACpE,mBAAmB9B,oBAAAA,CAAKkD,QAAQ,CAACnC,MAAMmF,KAAK,EAAE;YAAE5C,aAAa;QAAM,KAAKzB;QAChFH;QACAmD;QACA7B;IACF;AACF,EAAE;AAEF,SAASS,kBAAyBzC,GAAsB;IACtD,IAAIqF,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,OAAOvF,QAAQ,YAAYA,QAAQ,QAAQ,CAAE,CAAA,aAAaA,GAAAA,CAAE,EAAI;YAClE,MAAM,IAAIwF,MAAM,CAAC;8BACO,EAAE1F,2BAA2B2F,IAAI,CAAC;;MAE1D,CAAC;QACH;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/components/TreeItemLayout/useTreeItemLayout.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n getIntrinsicElementProps,\n isResolvedShorthand,\n useMergedRefs,\n slot,\n useEventCallback,\n elementContains,\n useControllableState,\n useId,\n useIsomorphicLayoutEffect,\n} from '@fluentui/react-utilities';\nimport { useTreeItemContext_unstable, useTreeContext_unstable } from '../../contexts';\nimport type {\n TreeItemLayoutActionSlotProps,\n TreeItemLayoutActionVisibilityChangeData,\n TreeItemLayoutBaseProps,\n TreeItemLayoutBaseState,\n TreeItemLayoutProps,\n TreeItemLayoutState,\n} from './TreeItemLayout.types';\nimport type { CheckboxProps } from '@fluentui/react-checkbox';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport type { RadioProps } from '@fluentui/react-radio';\nimport { Radio } from '@fluentui/react-radio';\nimport { TreeItemChevron } from '../TreeItemChevron';\nimport { useArrowNavigationGroup, useIsNavigatingWithKeyboard } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { registerTreeItemActions } from '../../utils/queryTreeItemActions';\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 { selector: selectorProp, ...baseProps } = props;\n const isNavigatingWithKeyboard = useIsNavigatingWithKeyboard();\n const { targetDocument } = useFluent();\n const state = useTreeItemLayoutBase(\n // The base hook only needs to know whether the consumer provided or disabled the selector,\n // the Fluent selector itself is resolved below.\n { ...baseProps, selector: selectorProp === undefined || selectorProp === null ? selectorProp : {} },\n ref,\n targetDocument,\n isNavigatingWithKeyboard,\n );\n\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n const navigationMode = useTreeContext_unstable(ctx => ctx.navigationMode ?? 'tree');\n const selectionRef = useTreeItemContext_unstable(ctx => ctx.selectionRef);\n const checked = useTreeItemContext_unstable(ctx => ctx.checked);\n const expandIconRef = useTreeItemContext_unstable(ctx => ctx.expandIconRef);\n\n // Link the selector to the main content unless the consumer provided an accessible name\n const selectorShorthand = isResolvedShorthand(selectorProp) ? selectorProp : undefined;\n const selectorAriaLabelledBy =\n selectorShorthand?.['aria-label'] || selectorShorthand?.['aria-labelledby'] ? undefined : state.main.id;\n\n const selector = slot.optional(selectorProp, {\n renderByDefault: selectionMode !== 'none',\n defaultProps: {\n checked,\n tabIndex: -1,\n ref: selectionRef,\n 'aria-labelledby': selectorAriaLabelledBy,\n // casting here to a union between checkbox and radio\n // since ref is not present on the selector signature\n // FIXME: look into Slot type to see if we can make this work\n } as CheckboxProps | RadioProps,\n elementType: (selectionMode === 'multiselect' ? Checkbox : Radio) as React.ElementType<CheckboxProps | RadioProps>,\n });\n // Checkbox and Radio slot props omit `ref` from their type, but consumers can still provide it.\n const selectorConsumerRef = selector && (selector as typeof selector & { ref?: React.Ref<HTMLInputElement> }).ref;\n const selectorRef = useMergedRefs(selectorConsumerRef, selectionRef);\n const selectorWithRef = selector && { ...selector, ref: selectorRef };\n\n const arrowNavigationProps = useArrowNavigationGroup({ circular: navigationMode === 'tree', axis: 'horizontal' });\n const expandIcon = state.expandIcon\n ? slot.optional(props.expandIcon, {\n renderByDefault: true,\n defaultProps: {\n 'aria-hidden': true,\n children: <TreeItemChevron />,\n ref: expandIconRef,\n },\n elementType: 'div',\n })\n : undefined;\n const expandIconRefWithConsumer = useMergedRefs(expandIcon?.ref, expandIconRef);\n const expandIconWithRef = expandIcon && { ...expandIcon, ref: expandIconRefWithConsumer };\n\n return {\n ...state,\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...state.components,\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 // Consumer props keep winning over the navigation attributes, matching the base slot ordering.\n actions: state.actions && { ...arrowNavigationProps, ...state.actions },\n expandIcon: expandIconWithRef,\n selector: selectorWithRef,\n };\n};\n\n/**\n * Base state hook for TreeItemLayout, free of any focus management runtime and of the Fluent\n * components used for the selector, the expand icon and the actions.\n *\n * The selector slot is rendered as a native `input`, of type `checkbox` in multiselect mode and\n * `radio` in single selection mode, the expand icon has no default content, and the Tabster driven\n * arrow key navigation of the actions is layered on by the wrapping `useTreeItemLayout_unstable` hook.\n *\n * @param props - props from this instance of TreeItemLayout\n * @param ref - reference to root HTMLElement of TreeItemLayout\n */\nexport const useTreeItemLayoutBase_unstable = (\n props: TreeItemLayoutBaseProps,\n ref: React.Ref<HTMLElement>,\n): TreeItemLayoutBaseState => {\n const { targetDocument } = useFluent();\n const isNavigatingWithKeyboard = useDOMKeyboardNavigation(targetDocument, Boolean(props.actions));\n\n return useTreeItemLayoutBase(props, ref, targetDocument, isNavigatingWithKeyboard);\n};\n\nfunction useTreeItemLayoutBase(\n props: TreeItemLayoutBaseProps,\n ref: React.Ref<HTMLElement>,\n targetDocument: Document | undefined,\n isNavigatingWithKeyboard: () => boolean,\n): TreeItemLayoutBaseState {\n const { main, iconAfter, iconBefore } = props;\n\n const layoutRef = useTreeItemContext_unstable(ctx => ctx.layoutRef);\n const selectionMode = useTreeContext_unstable(ctx => ctx.selectionMode);\n\n const [isActionsVisibleFromProps, onActionVisibilityChange]: [\n TreeItemLayoutActionSlotProps['visible'],\n TreeItemLayoutActionSlotProps['onVisibilityChange'],\n ] = isResolvedShorthand(props.actions)\n ? // .visible .onVisibilityChange prop should not be propagated to the DOM\n [props.actions.visible, props.actions.onVisibilityChange]\n : [undefined, undefined];\n\n const [isActionsVisible, setIsActionsVisible] = useControllableState({\n state: isActionsVisibleFromProps,\n initialState: false,\n });\n\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 actionsRefInternal = React.useRef<HTMLDivElement>(null);\n const treeItemRef = useTreeItemContext_unstable(ctx => ctx.treeItemRef);\n const subtreeRef = useTreeItemContext_unstable(ctx => ctx.subtreeRef);\n const checked = useTreeItemContext_unstable(ctx => ctx.checked);\n const isBranch = useTreeItemContext_unstable(ctx => ctx.itemType === 'branch');\n\n const mainShorthand = isResolvedShorthand(main) ? main : undefined;\n const mainContentId = useId('fui-TreeItemLayout__main-', mainShorthand?.id);\n\n // Link the selector to the main content unless the consumer provided an accessible name\n const selectorShorthand = isResolvedShorthand(props.selector) ? props.selector : undefined;\n const selectorAriaLabelledBy =\n selectorShorthand?.['aria-label'] || selectorShorthand?.['aria-labelledby'] ? undefined : mainContentId;\n\n // The mixed state of a native checkbox can only be set through its `indeterminate` DOM property.\n const selectorInputRef = React.useRef<HTMLInputElement>(null);\n useIsomorphicLayoutEffect(() => {\n if (selectorInputRef.current) {\n selectorInputRef.current.indeterminate = checked === 'mixed';\n }\n });\n\n const selectorSlot = slot.optional(props.selector, {\n renderByDefault: selectionMode !== 'none',\n defaultProps: {\n type: selectionMode === 'multiselect' ? 'checkbox' : 'radio',\n checked: checked === true,\n tabIndex: -1,\n 'aria-labelledby': selectorAriaLabelledBy,\n // Changes bubble up to the tree item, which owns the selection state.\n onChange: noop,\n },\n elementType: 'input',\n });\n const selectorRef = useMergedRefs(selectorSlot?.ref, selectionRef, selectorInputRef);\n // Clicking a native checkbox clears `indeterminate`, which no commit restores if the change is rejected\n const handleSelectorChange = useEventCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n selectorSlot?.onChange?.(event);\n event.currentTarget.indeterminate = checked === 'mixed';\n });\n const selector = selectorSlot && { ...selectorSlot, ref: selectorRef, onChange: handleSelectorChange };\n const mainSlot = slot.always(main, {\n defaultProps: { id: selector ? mainContentId : undefined },\n elementType: 'div',\n });\n\n // FIXME: Asserting is required here, as converting this to RefObject on context type would be a breaking change\n // eslint-disable-next-line react-hooks/refs\n assertIsRefObject(treeItemRef);\n // FIXME: Asserting is required here, as converting this to RefObject on context type would be a breaking change\n // eslint-disable-next-line react-hooks/refs\n assertIsRefObject(subtreeRef);\n\n const setActionsVisibleIfNotFromSubtree = React.useCallback(\n (event: MouseEvent | FocusEvent) => {\n const isTargetFromSubtree = Boolean(\n subtreeRef.current && elementContains(subtreeRef.current, event.target as Node),\n );\n if (!isTargetFromSubtree) {\n onActionVisibilityChange?.(event, {\n visible: true,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(true);\n }\n },\n [subtreeRef, setIsActionsVisible, onActionVisibilityChange],\n );\n\n const hasActions = Boolean(props.actions);\n\n const setActionsInvisibleIfNotFromSubtree = React.useCallback(\n (event: FocusEvent | MouseEvent) => {\n const isRelatedTargetFromActions = () =>\n Boolean(actionsRefInternal.current && elementContains(actionsRefInternal.current, event.relatedTarget as Node));\n const isRelatedTargetFromTreeItem = () =>\n Boolean(treeItemRef.current && elementContains(treeItemRef.current, event.relatedTarget as Node));\n const isTargetFromActions = () => Boolean(actionsRefInternal.current?.contains(event.target as Node));\n if (isRelatedTargetFromActions()) {\n onActionVisibilityChange?.(event, {\n visible: true,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(true);\n return;\n }\n if (isTargetFromActions() && isRelatedTargetFromTreeItem()) {\n return;\n }\n // when a mouseout event happens during keyboard interaction\n // we should not hide the actions if the activeElement is the treeitem or an action\n // as the focus on the treeitem takes precedence over the mouseout event\n if (\n event.type === 'mouseout' &&\n isNavigatingWithKeyboard() &&\n (targetDocument?.activeElement === treeItemRef.current ||\n elementContains(actionsRefInternal.current, targetDocument?.activeElement as Node))\n ) {\n return;\n }\n onActionVisibilityChange?.(event, {\n visible: false,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n if (event.defaultPrevented) {\n return;\n }\n setIsActionsVisible(false);\n },\n [setIsActionsVisible, onActionVisibilityChange, treeItemRef, isNavigatingWithKeyboard, targetDocument],\n );\n\n const expandIconSlot = slot.optional(props.expandIcon, {\n renderByDefault: isBranch,\n defaultProps: {\n 'aria-hidden': true,\n },\n elementType: 'div',\n });\n const expandIconRefs = useMergedRefs(expandIconSlot?.ref, expandIconRef);\n const expandIcon = expandIconSlot && { ...expandIconSlot, ref: expandIconRefs };\n const handleActionsBlur = useEventCallback((event: React.FocusEvent<HTMLDivElement>) => {\n if (isResolvedShorthand(props.actions)) {\n props.actions.onBlur?.(event);\n }\n const isRelatedTargetFromActions = Boolean(elementContains(event.currentTarget, event.relatedTarget as Node));\n onActionVisibilityChange?.(event, {\n visible: isRelatedTargetFromActions,\n event,\n type: event.type,\n } as Extract<TreeItemLayoutActionVisibilityChangeData, { event: typeof event }>);\n setIsActionsVisible(isRelatedTargetFromActions);\n });\n\n const actionsSlot = isActionsVisible\n ? slot.optional(props.actions, {\n defaultProps: {\n role: 'toolbar',\n onBlur: handleActionsBlur,\n },\n elementType: 'div',\n })\n : undefined;\n // The internal refs are merged after slot resolution, so that a consumer provided ref does not override them\n const actionsRefs = useMergedRefs(actionsSlot?.ref, actionsRef, actionsRefInternal, registerTreeItemActions);\n const actions = actionsSlot && { ...actionsSlot, ref: actionsRefs };\n if (actions) {\n // .visible .onVisibilityChange are consumed above and should not be propagated to the DOM\n delete actions.visible;\n delete actions.onVisibilityChange;\n }\n\n React.useEffect(() => {\n if (treeItemRef.current && hasActions) {\n const treeItemElement = treeItemRef.current;\n\n const handleMouseOver = setActionsVisibleIfNotFromSubtree;\n const handleMouseOut = setActionsInvisibleIfNotFromSubtree;\n const handleFocus = setActionsVisibleIfNotFromSubtree;\n const handleBlur = setActionsInvisibleIfNotFromSubtree;\n\n treeItemElement.addEventListener('mouseover', handleMouseOver);\n treeItemElement.addEventListener('mouseout', handleMouseOut);\n treeItemElement.addEventListener('focus', handleFocus);\n treeItemElement.addEventListener('blur', handleBlur);\n\n return () => {\n treeItemElement.removeEventListener('mouseover', handleMouseOver);\n treeItemElement.removeEventListener('mouseout', handleMouseOut);\n treeItemElement.removeEventListener('focus', handleFocus);\n treeItemElement.removeEventListener('blur', handleBlur);\n };\n }\n }, [hasActions, treeItemRef, setActionsVisibleIfNotFromSubtree, setActionsInvisibleIfNotFromSubtree]);\n\n return {\n components: {\n root: 'div',\n expandIcon: 'div',\n iconBefore: 'div',\n main: 'div',\n iconAfter: 'div',\n actions: 'div',\n aside: 'div',\n selector: 'input',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ...props,\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, layoutRef) as React.Ref<HTMLDivElement>,\n }),\n {\n elementType: 'div',\n },\n ),\n iconBefore: slot.optional(iconBefore, { elementType: 'div' }),\n main: mainSlot,\n iconAfter: slot.optional(iconAfter, { elementType: 'div' }),\n aside: !isActionsVisible ? slot.optional(props.aside, { elementType: 'div' }) : undefined,\n actions,\n expandIcon,\n selector,\n };\n}\n\ntype DOMKeyboardNavigationTracker = {\n isNavigatingWithKeyboard: boolean;\n subscribers: number;\n dispose: () => void;\n};\n\n/**\n * Keyboard modality trackers shared by every base layout of a document, so that the number of\n * document listeners does not grow with the number of mounted tree items.\n */\nconst domKeyboardNavigationTrackers = new WeakMap<Document, DOMKeyboardNavigationTracker>();\n\n// Only pointer activation switches the modality, so that hovering does not discard keyboard focus\nconst DOM_POINTER_EVENTS = ['pointerdown', 'mousedown', 'touchstart'] as const;\n\nfunction subscribeToDOMKeyboardNavigation(targetDocument: Document): DOMKeyboardNavigationTracker {\n let tracker = domKeyboardNavigationTrackers.get(targetDocument);\n if (!tracker) {\n const onKeyDown = () => {\n state.isNavigatingWithKeyboard = true;\n };\n const onPointerInteraction = () => {\n state.isNavigatingWithKeyboard = false;\n };\n const state: DOMKeyboardNavigationTracker = {\n isNavigatingWithKeyboard: false,\n subscribers: 0,\n dispose: () => {\n targetDocument.removeEventListener('keydown', onKeyDown, true);\n DOM_POINTER_EVENTS.forEach(type => targetDocument.removeEventListener(type, onPointerInteraction, true));\n domKeyboardNavigationTrackers.delete(targetDocument);\n },\n };\n\n targetDocument.addEventListener('keydown', onKeyDown, true);\n DOM_POINTER_EVENTS.forEach(type => targetDocument.addEventListener(type, onPointerInteraction, true));\n domKeyboardNavigationTrackers.set(targetDocument, state);\n tracker = state;\n }\n tracker.subscribers++;\n return tracker;\n}\n\nfunction useDOMKeyboardNavigation(targetDocument: Document | undefined, enabled: boolean): () => boolean {\n const trackerRef = React.useRef<DOMKeyboardNavigationTracker | null>(null);\n\n React.useEffect(() => {\n if (!targetDocument || !enabled) {\n return;\n }\n\n const tracker = subscribeToDOMKeyboardNavigation(targetDocument);\n trackerRef.current = tracker;\n\n return () => {\n trackerRef.current = null;\n if (--tracker.subscribers === 0) {\n tracker.dispose();\n }\n };\n }, [targetDocument, enabled]);\n\n return React.useCallback(() => trackerRef.current?.isNavigatingWithKeyboard ?? false, []);\n}\n\nfunction noop() {\n /* noop */\n}\n\nfunction assertIsRefObject<Value>(ref?: React.Ref<Value>): asserts ref is React.RefObject<Value> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof ref !== 'object' || ref === null || !('current' in ref)) {\n throw new Error(`\n @fluentui/react-tree [${useTreeItemLayout_unstable.name}]:\n Internal Error: contextual ref is not a RefObject! Please report this bug immediately, as contextual refs should be RefObjects.\n `);\n }\n }\n}\n"],"names":["React","getIntrinsicElementProps","isResolvedShorthand","useMergedRefs","slot","useEventCallback","elementContains","useControllableState","useId","useIsomorphicLayoutEffect","useTreeItemContext_unstable","useTreeContext_unstable","Checkbox","Radio","TreeItemChevron","useArrowNavigationGroup","useIsNavigatingWithKeyboard","useFluent_unstable","useFluent","registerTreeItemActions","useTreeItemLayout_unstable","props","ref","selector","selectorProp","baseProps","isNavigatingWithKeyboard","targetDocument","state","useTreeItemLayoutBase","undefined","selectionMode","ctx","navigationMode","selectionRef","checked","expandIconRef","selectorShorthand","selectorAriaLabelledBy","main","id","optional","renderByDefault","defaultProps","tabIndex","elementType","selectorConsumerRef","selectorRef","selectorWithRef","arrowNavigationProps","circular","axis","expandIcon","children","expandIconRefWithConsumer","expandIconWithRef","components","buttonContextValue","size","actions","useTreeItemLayoutBase_unstable","useDOMKeyboardNavigation","Boolean","iconAfter","iconBefore","layoutRef","isActionsVisibleFromProps","onActionVisibilityChange","visible","onVisibilityChange","isActionsVisible","setIsActionsVisible","initialState","actionsRef","actionsRefInternal","useRef","treeItemRef","subtreeRef","isBranch","itemType","mainShorthand","mainContentId","selectorInputRef","current","indeterminate","selectorSlot","type","onChange","noop","handleSelectorChange","event","currentTarget","mainSlot","always","assertIsRefObject","setActionsVisibleIfNotFromSubtree","useCallback","isTargetFromSubtree","target","defaultPrevented","hasActions","setActionsInvisibleIfNotFromSubtree","isRelatedTargetFromActions","relatedTarget","isRelatedTargetFromTreeItem","isTargetFromActions","contains","activeElement","expandIconSlot","expandIconRefs","handleActionsBlur","onBlur","actionsSlot","role","actionsRefs","useEffect","treeItemElement","handleMouseOver","handleMouseOut","handleFocus","handleBlur","addEventListener","removeEventListener","root","aside","domKeyboardNavigationTrackers","WeakMap","DOM_POINTER_EVENTS","subscribeToDOMKeyboardNavigation","tracker","get","onKeyDown","onPointerInteraction","subscribers","dispose","forEach","delete","set","enabled","trackerRef","process","env","NODE_ENV","Error","name"],"mappings":"AAAA;;;;;;;;;;;;;eAgIa4D;;QAvFAxC;;;;;iEAvCU,QAAQ;gCAWxB,4BAA4B;uBACkC,0BAAiB;+BAU7D,2BAA2B;4BAE9B,wBAAwB;iCACd,wBAAqB;8BACgB,0BAA0B;qCAC/C,kCAAkC;sCAC1C,sCAAmC;AAWpE,mCAAmC,CACxCC,OACAC;IAEA,MAAM,EAAEC,UAAUC,YAAY,EAAE,GAAGC,WAAW,GAAGJ;IACjD,MAAMK,+BAA2BV,yCAAAA;IACjC,MAAM,EAAEW,cAAc,EAAE,OAAGT,uCAAAA;IAC3B,MAAMU,QAAQC,sBACZ,AACA,gDAAgD,2CAD2C;IAE3F;QAAE,GAAGJ,SAAS;QAAEF,UAAUC,iBAAiBM,aAAaN,iBAAiB,OAAOA,eAAe,CAAC;IAAE,GAClGF,KACAK,gBACAD;IAGF,MAAMK,oBAAgBpB,8BAAAA,EAAwBqB,CAAAA,MAAOA,IAAID,aAAa;IACtE,MAAME,qBAAiBtB,8BAAAA,EAAwBqB,CAAAA;YAAOA;gBAAAA,sBAAAA,IAAIC,cAAAA,AAAc,MAAA,QAAlBD,wBAAAA,KAAAA,IAAAA,sBAAsB;;IAC5E,MAAME,mBAAexB,kCAAAA,EAA4BsB,CAAAA,MAAOA,IAAIE,YAAY;IACxE,MAAMC,cAAUzB,kCAAAA,EAA4BsB,CAAAA,MAAOA,IAAIG,OAAO;IAC9D,MAAMC,oBAAgB1B,kCAAAA,EAA4BsB,CAAAA,MAAOA,IAAII,aAAa;IAE1E,wFAAwF;IACxF,MAAMC,wBAAoBnC,mCAAAA,EAAoBsB,gBA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G,SAAS;YAC/B;QACF;QAEA,MAAMT,UAAUD,iCAAiCrG;QACjDgH,WAAWxD,OAAO,GAAG8C;QAErB,OAAO;YACLU,WAAWxD,OAAO,GAAG;YACrB,IAAI,EAAE8C,QAAQI,WAAW,KAAK,GAAG;gBAC/BJ,QAAQK,OAAO;YACjB;QACF;IACF,GAAG;QAAC3G;QAAgB+G;KAAQ;IAE5B,OAAO1I,OAAMgG,WAAW,CAAC;;YAAM2C;wBAAAA,sBAAAA,WAAWxD,OAAAA,AAAO,MAAA,QAAlBwD,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAoBjH,wBAAAA,AAAwB,MAAA,QAAA,SAAA,KAAA,IAAA,OAAI;OAAO,EAAE;AAC1F;AAEA,SAAS8D;AACP,QAAQ,GACV;AAEA,SAASM,kBAAyBxE,GAAsB;IACtD,IAAIsH,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,OAAOxH,QAAQ,YAAYA,QAAQ,QAAQ,CAAE,CAAA,aAAaA,GAAAA,CAAE,EAAI;YAClE,MAAM,IAAIyH,MAAM,CAAC;8BACO,EAAE3H,2BAA2B4H,IAAI,CAAC;;MAE1D,CAAC;QACH;IACF;AACF"}
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
  function _export(target, all) {
7
7
  for(var name in all)Object.defineProperty(target, name, {
8
8
  enumerable: true,
9
- get: all[name]
9
+ get: Object.getOwnPropertyDescriptor(all, name).get
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- treeItemLayoutClassNames: function() {
13
+ get treeItemLayoutClassNames () {
14
14
  return treeItemLayoutClassNames;
15
15
  },
16
- useTreeItemLayoutStyles_unstable: function() {
16
+ get useTreeItemLayoutStyles_unstable () {
17
17
  return useTreeItemLayoutStyles_unstable;
18
18
  }
19
19
  });