@wordpress/components 23.3.2 → 23.4.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 (710) hide show
  1. package/CHANGELOG.md +20 -5
  2. package/build/alignment-matrix-control/utils.js +4 -4
  3. package/build/alignment-matrix-control/utils.js.map +1 -1
  4. package/build/angle-picker-control/angle-circle.js +37 -29
  5. package/build/angle-picker-control/angle-circle.js.map +1 -1
  6. package/build/angle-picker-control/index.js +44 -9
  7. package/build/angle-picker-control/index.js.map +1 -1
  8. package/build/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
  9. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  10. package/build/{base-field → angle-picker-control}/types.js +0 -0
  11. package/build/angle-picker-control/types.js.map +1 -0
  12. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  13. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  14. package/build/base-control/hooks.js +1 -1
  15. package/build/base-control/hooks.js.map +1 -1
  16. package/build/border-box-control/utils.js +1 -1
  17. package/build/border-box-control/utils.js.map +1 -1
  18. package/build/box-control/all-input-control.js +2 -2
  19. package/build/box-control/all-input-control.js.map +1 -1
  20. package/build/box-control/axial-input-controls.js +1 -1
  21. package/build/box-control/axial-input-controls.js.map +1 -1
  22. package/build/box-control/icon.js.map +1 -1
  23. package/build/box-control/index.js +32 -3
  24. package/build/box-control/index.js.map +1 -1
  25. package/build/box-control/input-controls.js +5 -5
  26. package/build/box-control/input-controls.js.map +1 -1
  27. package/build/box-control/linked-button.js.map +1 -1
  28. package/build/box-control/styles/box-control-icon-styles.js +28 -28
  29. package/build/box-control/styles/box-control-icon-styles.js.map +1 -1
  30. package/build/box-control/styles/box-control-styles.js +23 -23
  31. package/build/box-control/styles/box-control-styles.js.map +1 -1
  32. package/build/box-control/styles/box-control-visualizer-styles.js +19 -19
  33. package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  34. package/build/box-control/types.js +6 -0
  35. package/build/box-control/types.js.map +1 -0
  36. package/build/box-control/unit-control.js.map +1 -1
  37. package/build/box-control/utils.js +23 -23
  38. package/build/box-control/utils.js.map +1 -1
  39. package/build/color-palette/index.js +8 -3
  40. package/build/color-palette/index.js.map +1 -1
  41. package/build/combobox-control/index.js +68 -12
  42. package/build/combobox-control/index.js.map +1 -1
  43. package/build/combobox-control/styles.js +2 -2
  44. package/build/combobox-control/styles.js.map +1 -1
  45. package/build/combobox-control/types.js +6 -0
  46. package/build/combobox-control/types.js.map +1 -0
  47. package/build/custom-gradient-picker/index.js +0 -1
  48. package/build/custom-gradient-picker/index.js.map +1 -1
  49. package/build/date-time/time/index.js +1 -1
  50. package/build/date-time/time/index.js.map +1 -1
  51. package/build/date-time/utils.js +1 -1
  52. package/build/date-time/utils.js.map +1 -1
  53. package/build/draggable/index.js +2 -2
  54. package/build/draggable/index.js.map +1 -1
  55. package/build/focal-point-picker/utils.js +3 -3
  56. package/build/focal-point-picker/utils.js.map +1 -1
  57. package/build/font-size-picker/utils.js +2 -2
  58. package/build/font-size-picker/utils.js.map +1 -1
  59. package/build/gradient-picker/index.js +9 -4
  60. package/build/gradient-picker/index.js.map +1 -1
  61. package/build/input-control/reducer/reducer.js +5 -5
  62. package/build/input-control/reducer/reducer.js.map +1 -1
  63. package/build/input-control/utils.js +1 -1
  64. package/build/input-control/utils.js.map +1 -1
  65. package/build/menu-items-choice/index.js +40 -3
  66. package/build/menu-items-choice/index.js.map +1 -1
  67. package/build/menu-items-choice/types.js +6 -0
  68. package/build/menu-items-choice/types.js.map +1 -0
  69. package/build/modal/index.js +41 -3
  70. package/build/modal/index.js.map +1 -1
  71. package/build/palette-edit/index.js +4 -1
  72. package/build/palette-edit/index.js.map +1 -1
  73. package/build/panel/header.js +9 -0
  74. package/build/panel/header.js.map +1 -1
  75. package/build/panel/index.js +21 -3
  76. package/build/panel/index.js.map +1 -1
  77. package/build/panel/row.js +10 -4
  78. package/build/panel/row.js.map +1 -1
  79. package/build/panel/types.js +6 -0
  80. package/build/panel/types.js.map +1 -0
  81. package/build/popover/index.js +15 -3
  82. package/build/popover/index.js.map +1 -1
  83. package/build/popover/overlay-middlewares.js +46 -0
  84. package/build/popover/overlay-middlewares.js.map +1 -0
  85. package/build/popover/utils.js +45 -6
  86. package/build/popover/utils.js.map +1 -1
  87. package/build/query-controls/terms.js +1 -1
  88. package/build/query-controls/terms.js.map +1 -1
  89. package/build/range-control/utils.js +4 -4
  90. package/build/range-control/utils.js.map +1 -1
  91. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
  92. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  93. package/build/resizable-box/resize-tooltip/utils.js +14 -14
  94. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  95. package/build/snackbar/index.js +2 -2
  96. package/build/snackbar/index.js.map +1 -1
  97. package/build/toolbar/toolbar/index.js +25 -14
  98. package/build/toolbar/toolbar/index.js.map +1 -1
  99. package/build/toolbar/toolbar/toolbar-container.js +5 -4
  100. package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
  101. package/build/toolbar/toolbar/types.js +6 -0
  102. package/build/toolbar/toolbar/types.js.map +1 -0
  103. package/build/toolbar/toolbar-button/index.js +2 -0
  104. package/build/toolbar/toolbar-button/index.js.map +1 -1
  105. package/build/toolbar/toolbar-button/toolbar-button-container.js +1 -0
  106. package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  107. package/build/toolbar/toolbar-context/index.js +2 -0
  108. package/build/toolbar/toolbar-context/index.js.map +1 -1
  109. package/build/toolbar/toolbar-dropdown-menu/index.js +2 -0
  110. package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  111. package/build/toolbar/toolbar-group/index.js +2 -0
  112. package/build/toolbar/toolbar-group/index.js.map +1 -1
  113. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
  114. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  115. package/build/toolbar/toolbar-group/toolbar-group-container.js +1 -0
  116. package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  117. package/build/toolbar/toolbar-item/index.js +2 -0
  118. package/build/toolbar/toolbar-item/index.js.map +1 -1
  119. package/build/tools-panel/tools-panel/component.js +61 -5
  120. package/build/tools-panel/tools-panel/component.js.map +1 -1
  121. package/build/tools-panel/tools-panel/hook.js +4 -2
  122. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  123. package/build/tools-panel/tools-panel-header/component.js +2 -1
  124. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  125. package/build/tools-panel/tools-panel-header/hook.js +2 -0
  126. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  127. package/build/tools-panel/tools-panel-item/component.js +5 -4
  128. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  129. package/build/tools-panel/tools-panel-item/hook.js +4 -2
  130. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  131. package/build/tree-grid/cell.js +15 -4
  132. package/build/tree-grid/cell.js.map +1 -1
  133. package/build/tree-grid/index.js +81 -19
  134. package/build/tree-grid/index.js.map +1 -1
  135. package/build/tree-grid/item.js +14 -3
  136. package/build/tree-grid/item.js.map +1 -1
  137. package/build/tree-grid/roving-tab-index-context.js +1 -1
  138. package/build/tree-grid/roving-tab-index-context.js.map +1 -1
  139. package/build/tree-grid/roving-tab-index-item.js +13 -6
  140. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  141. package/build/tree-grid/roving-tab-index.js +0 -3
  142. package/build/tree-grid/roving-tab-index.js.map +1 -1
  143. package/build/tree-grid/row.js +20 -18
  144. package/build/tree-grid/row.js.map +1 -1
  145. package/build/tree-grid/types.js +6 -0
  146. package/build/tree-grid/types.js.map +1 -0
  147. package/build/ui/context/context-connect.js +7 -7
  148. package/build/ui/context/context-connect.js.map +1 -1
  149. package/build/ui/context/get-styled-class-name-from-key.js +1 -1
  150. package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
  151. package/build/ui/utils/get-valid-children.js +1 -1
  152. package/build/ui/utils/get-valid-children.js.map +1 -1
  153. package/build/ui/utils/space.js +1 -1
  154. package/build/ui/utils/space.js.map +1 -1
  155. package/build/unit-control/index.js +2 -2
  156. package/build/unit-control/index.js.map +1 -1
  157. package/build/unit-control/utils.js +20 -20
  158. package/build/unit-control/utils.js.map +1 -1
  159. package/build/utils/events.js +4 -4
  160. package/build/utils/events.js.map +1 -1
  161. package/build/utils/hooks/use-controlled-state.js +2 -2
  162. package/build/utils/hooks/use-controlled-state.js.map +1 -1
  163. package/build/utils/hooks/use-controlled-value.js +4 -4
  164. package/build/utils/hooks/use-controlled-value.js.map +1 -1
  165. package/build/utils/hooks/use-latest-ref.js +1 -1
  166. package/build/utils/hooks/use-latest-ref.js.map +1 -1
  167. package/build/utils/unit-values.js +3 -3
  168. package/build/utils/unit-values.js.map +1 -1
  169. package/build-module/alignment-matrix-control/utils.js +4 -4
  170. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  171. package/build-module/angle-picker-control/angle-circle.js +37 -29
  172. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  173. package/build-module/angle-picker-control/index.js +42 -8
  174. package/build-module/angle-picker-control/index.js.map +1 -1
  175. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
  176. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  177. package/build-module/{base-field → angle-picker-control}/types.js +0 -0
  178. package/build-module/{base-field → angle-picker-control}/types.js.map +0 -0
  179. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  180. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  181. package/build-module/base-control/hooks.js +1 -1
  182. package/build-module/base-control/hooks.js.map +1 -1
  183. package/build-module/border-box-control/utils.js +1 -1
  184. package/build-module/border-box-control/utils.js.map +1 -1
  185. package/build-module/box-control/all-input-control.js +2 -2
  186. package/build-module/box-control/all-input-control.js.map +1 -1
  187. package/build-module/box-control/axial-input-controls.js +1 -1
  188. package/build-module/box-control/axial-input-controls.js.map +1 -1
  189. package/build-module/box-control/icon.js.map +1 -1
  190. package/build-module/box-control/index.js +31 -3
  191. package/build-module/box-control/index.js.map +1 -1
  192. package/build-module/box-control/input-controls.js +5 -5
  193. package/build-module/box-control/input-controls.js.map +1 -1
  194. package/build-module/box-control/linked-button.js.map +1 -1
  195. package/build-module/box-control/styles/box-control-icon-styles.js +28 -28
  196. package/build-module/box-control/styles/box-control-icon-styles.js.map +1 -1
  197. package/build-module/box-control/styles/box-control-styles.js +23 -23
  198. package/build-module/box-control/styles/box-control-styles.js.map +1 -1
  199. package/build-module/box-control/styles/box-control-visualizer-styles.js +19 -19
  200. package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  201. package/build-module/box-control/types.js +2 -0
  202. package/{build/base-field → build-module/box-control}/types.js.map +0 -0
  203. package/build-module/box-control/unit-control.js.map +1 -1
  204. package/build-module/box-control/utils.js +23 -23
  205. package/build-module/box-control/utils.js.map +1 -1
  206. package/build-module/color-palette/index.js +8 -3
  207. package/build-module/color-palette/index.js.map +1 -1
  208. package/build-module/combobox-control/index.js +68 -12
  209. package/build-module/combobox-control/index.js.map +1 -1
  210. package/build-module/combobox-control/styles.js +2 -2
  211. package/build-module/combobox-control/styles.js.map +1 -1
  212. package/build-module/combobox-control/types.js +2 -0
  213. package/build-module/{resizable-box/styles/resizable-box.styles.js.map → combobox-control/types.js.map} +0 -0
  214. package/build-module/custom-gradient-picker/index.js +0 -1
  215. package/build-module/custom-gradient-picker/index.js.map +1 -1
  216. package/build-module/date-time/time/index.js +1 -1
  217. package/build-module/date-time/time/index.js.map +1 -1
  218. package/build-module/date-time/utils.js +1 -1
  219. package/build-module/date-time/utils.js.map +1 -1
  220. package/build-module/draggable/index.js +2 -2
  221. package/build-module/draggable/index.js.map +1 -1
  222. package/build-module/focal-point-picker/utils.js +3 -3
  223. package/build-module/focal-point-picker/utils.js.map +1 -1
  224. package/build-module/font-size-picker/utils.js +2 -2
  225. package/build-module/font-size-picker/utils.js.map +1 -1
  226. package/build-module/gradient-picker/index.js +9 -4
  227. package/build-module/gradient-picker/index.js.map +1 -1
  228. package/build-module/input-control/reducer/reducer.js +5 -5
  229. package/build-module/input-control/reducer/reducer.js.map +1 -1
  230. package/build-module/input-control/utils.js +1 -1
  231. package/build-module/input-control/utils.js.map +1 -1
  232. package/build-module/menu-items-choice/index.js +40 -4
  233. package/build-module/menu-items-choice/index.js.map +1 -1
  234. package/build-module/menu-items-choice/types.js +2 -0
  235. package/{build/resizable-box/styles/resizable-box.styles.js.map → build-module/menu-items-choice/types.js.map} +0 -0
  236. package/build-module/modal/index.js +41 -4
  237. package/build-module/modal/index.js.map +1 -1
  238. package/build-module/palette-edit/index.js +4 -1
  239. package/build-module/palette-edit/index.js.map +1 -1
  240. package/build-module/panel/header.js +9 -0
  241. package/build-module/panel/header.js.map +1 -1
  242. package/build-module/panel/index.js +20 -2
  243. package/build-module/panel/index.js.map +1 -1
  244. package/build-module/panel/row.js +9 -3
  245. package/build-module/panel/row.js.map +1 -1
  246. package/build-module/panel/types.js +2 -0
  247. package/build-module/panel/types.js.map +1 -0
  248. package/build-module/popover/index.js +14 -4
  249. package/build-module/popover/index.js.map +1 -1
  250. package/build-module/popover/overlay-middlewares.js +38 -0
  251. package/build-module/popover/overlay-middlewares.js.map +1 -0
  252. package/build-module/popover/utils.js +41 -5
  253. package/build-module/popover/utils.js.map +1 -1
  254. package/build-module/query-controls/terms.js +1 -1
  255. package/build-module/query-controls/terms.js.map +1 -1
  256. package/build-module/range-control/utils.js +4 -4
  257. package/build-module/range-control/utils.js.map +1 -1
  258. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
  259. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  260. package/build-module/resizable-box/resize-tooltip/utils.js +14 -14
  261. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  262. package/build-module/snackbar/index.js +2 -2
  263. package/build-module/snackbar/index.js.map +1 -1
  264. package/build-module/toolbar/toolbar/index.js +25 -13
  265. package/build-module/toolbar/toolbar/index.js.map +1 -1
  266. package/build-module/toolbar/toolbar/toolbar-container.js +4 -3
  267. package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
  268. package/build-module/toolbar/toolbar/types.js +2 -0
  269. package/build-module/toolbar/toolbar/types.js.map +1 -0
  270. package/build-module/toolbar/toolbar-button/index.js +1 -0
  271. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  272. package/build-module/toolbar/toolbar-button/toolbar-button-container.js +1 -0
  273. package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  274. package/build-module/toolbar/toolbar-context/index.js +2 -0
  275. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  276. package/build-module/toolbar/toolbar-dropdown-menu/index.js +1 -0
  277. package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  278. package/build-module/toolbar/toolbar-group/index.js +1 -0
  279. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  280. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +1 -0
  281. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  282. package/build-module/toolbar/toolbar-group/toolbar-group-container.js +1 -0
  283. package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  284. package/build-module/toolbar/toolbar-item/index.js +1 -0
  285. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  286. package/build-module/tools-panel/tools-panel/component.js +59 -4
  287. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  288. package/build-module/tools-panel/tools-panel/hook.js +4 -2
  289. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  290. package/build-module/tools-panel/tools-panel-header/component.js +2 -1
  291. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  292. package/build-module/tools-panel/tools-panel-header/hook.js +2 -0
  293. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  294. package/build-module/tools-panel/tools-panel-item/component.js +3 -3
  295. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  296. package/build-module/tools-panel/tools-panel-item/hook.js +5 -2
  297. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  298. package/build-module/tree-grid/cell.js +16 -4
  299. package/build-module/tree-grid/cell.js.map +1 -1
  300. package/build-module/tree-grid/index.js +81 -21
  301. package/build-module/tree-grid/index.js.map +1 -1
  302. package/build-module/tree-grid/item.js +14 -2
  303. package/build-module/tree-grid/item.js.map +1 -1
  304. package/build-module/tree-grid/roving-tab-index-context.js +1 -1
  305. package/build-module/tree-grid/roving-tab-index-context.js.map +1 -1
  306. package/build-module/tree-grid/roving-tab-index-item.js +11 -4
  307. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  308. package/build-module/tree-grid/roving-tab-index.js +0 -3
  309. package/build-module/tree-grid/roving-tab-index.js.map +1 -1
  310. package/build-module/tree-grid/row.js +22 -17
  311. package/build-module/tree-grid/row.js.map +1 -1
  312. package/build-module/tree-grid/types.js +2 -0
  313. package/build-module/tree-grid/types.js.map +1 -0
  314. package/build-module/ui/context/context-connect.js +7 -7
  315. package/build-module/ui/context/context-connect.js.map +1 -1
  316. package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
  317. package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
  318. package/build-module/ui/utils/get-valid-children.js +1 -1
  319. package/build-module/ui/utils/get-valid-children.js.map +1 -1
  320. package/build-module/ui/utils/space.js +1 -1
  321. package/build-module/ui/utils/space.js.map +1 -1
  322. package/build-module/unit-control/index.js +2 -2
  323. package/build-module/unit-control/index.js.map +1 -1
  324. package/build-module/unit-control/utils.js +20 -20
  325. package/build-module/unit-control/utils.js.map +1 -1
  326. package/build-module/utils/events.js +4 -4
  327. package/build-module/utils/events.js.map +1 -1
  328. package/build-module/utils/hooks/use-controlled-state.js +2 -2
  329. package/build-module/utils/hooks/use-controlled-state.js.map +1 -1
  330. package/build-module/utils/hooks/use-controlled-value.js +4 -4
  331. package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
  332. package/build-module/utils/hooks/use-latest-ref.js +1 -1
  333. package/build-module/utils/hooks/use-latest-ref.js.map +1 -1
  334. package/build-module/utils/unit-values.js +3 -3
  335. package/build-module/utils/unit-values.js.map +1 -1
  336. package/build-style/style-rtl.css +5 -0
  337. package/build-style/style.css +5 -0
  338. package/build-types/alignment-matrix-control/utils.d.ts +4 -4
  339. package/build-types/angle-picker-control/angle-circle.d.ts +6 -0
  340. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -0
  341. package/build-types/angle-picker-control/index.d.ts +29 -0
  342. package/build-types/angle-picker-control/index.d.ts.map +1 -0
  343. package/build-types/angle-picker-control/stories/index.d.ts +15 -0
  344. package/build-types/angle-picker-control/stories/index.d.ts.map +1 -0
  345. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +20 -0
  346. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
  347. package/build-types/angle-picker-control/types.d.ts +26 -0
  348. package/build-types/angle-picker-control/types.d.ts.map +1 -0
  349. package/build-types/base-control/hooks.d.ts +1 -1
  350. package/build-types/border-box-control/border-box-control/component.d.ts +1 -1
  351. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  352. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +1 -1
  353. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
  354. package/build-types/border-box-control/stories/index.d.ts +1 -1
  355. package/build-types/{base-field → border-box-control}/test/index.d.ts +0 -0
  356. package/build-types/border-box-control/test/index.d.ts.map +1 -0
  357. package/build-types/border-box-control/test/utils.d.ts +2 -0
  358. package/build-types/border-box-control/test/utils.d.ts.map +1 -0
  359. package/build-types/box-control/all-input-control.d.ts +4 -0
  360. package/build-types/box-control/all-input-control.d.ts.map +1 -0
  361. package/build-types/box-control/axial-input-controls.d.ts +4 -0
  362. package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
  363. package/build-types/box-control/icon.d.ts +8 -0
  364. package/build-types/box-control/icon.d.ts.map +1 -0
  365. package/build-types/box-control/index.d.ts +31 -0
  366. package/build-types/box-control/index.d.ts.map +1 -0
  367. package/build-types/box-control/input-controls.d.ts +4 -0
  368. package/build-types/box-control/input-controls.d.ts.map +1 -0
  369. package/build-types/box-control/linked-button.d.ts +9 -0
  370. package/build-types/box-control/linked-button.d.ts.map +1 -0
  371. package/build-types/box-control/styles/box-control-icon-styles.d.ts +42 -0
  372. package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -0
  373. package/build-types/box-control/styles/box-control-styles.d.ts +42 -0
  374. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -0
  375. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
  376. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
  377. package/build-types/box-control/test/index.d.ts +2 -0
  378. package/build-types/box-control/test/index.d.ts.map +1 -0
  379. package/build-types/box-control/types.d.ts +99 -0
  380. package/build-types/box-control/types.d.ts.map +1 -0
  381. package/build-types/box-control/unit-control.d.ts +4 -0
  382. package/build-types/box-control/unit-control.d.ts.map +1 -0
  383. package/build-types/box-control/utils.d.ts +84 -0
  384. package/build-types/box-control/utils.d.ts.map +1 -0
  385. package/build-types/color-palette/index.d.ts +3 -1
  386. package/build-types/color-palette/index.d.ts.map +1 -1
  387. package/build-types/color-palette/stories/index.d.ts +6 -2
  388. package/build-types/color-palette/stories/index.d.ts.map +1 -1
  389. package/build-types/color-palette/types.d.ts +8 -0
  390. package/build-types/color-palette/types.d.ts.map +1 -1
  391. package/build-types/combobox-control/index.d.ts +51 -0
  392. package/build-types/combobox-control/index.d.ts.map +1 -0
  393. package/build-types/combobox-control/stories/index.d.ts +18 -0
  394. package/build-types/combobox-control/stories/index.d.ts.map +1 -0
  395. package/build-types/combobox-control/styles.d.ts +8 -0
  396. package/build-types/combobox-control/styles.d.ts.map +1 -0
  397. package/build-types/combobox-control/test/index.d.ts +2 -0
  398. package/build-types/combobox-control/test/index.d.ts.map +1 -0
  399. package/build-types/combobox-control/types.d.ts +62 -0
  400. package/build-types/combobox-control/types.d.ts.map +1 -0
  401. package/build-types/date-time/utils.d.ts +1 -1
  402. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  403. package/build-types/focal-point-picker/utils.d.ts +3 -3
  404. package/build-types/font-size-picker/utils.d.ts +2 -2
  405. package/build-types/input-control/reducer/reducer.d.ts +3 -3
  406. package/build-types/input-control/utils.d.ts +1 -1
  407. package/build-types/menu-items-choice/index.d.ts +38 -0
  408. package/build-types/menu-items-choice/index.d.ts.map +1 -0
  409. package/build-types/menu-items-choice/stories/index.d.ts +12 -0
  410. package/build-types/menu-items-choice/stories/index.d.ts.map +1 -0
  411. package/build-types/menu-items-choice/types.d.ts +53 -0
  412. package/build-types/menu-items-choice/types.d.ts.map +1 -0
  413. package/build-types/modal/index.d.ts.map +1 -1
  414. package/build-types/modal/types.d.ts +2 -0
  415. package/build-types/modal/types.d.ts.map +1 -1
  416. package/build-types/panel/header.d.ts +13 -0
  417. package/build-types/panel/header.d.ts.map +1 -0
  418. package/build-types/panel/index.d.ts +21 -0
  419. package/build-types/panel/index.d.ts.map +1 -0
  420. package/build-types/panel/row.d.ts +12 -0
  421. package/build-types/panel/row.d.ts.map +1 -0
  422. package/build-types/panel/test/header.d.ts +2 -0
  423. package/build-types/panel/test/header.d.ts.map +1 -0
  424. package/build-types/panel/test/index.d.ts +2 -0
  425. package/build-types/{base-field → panel}/test/index.d.ts.map +1 -1
  426. package/build-types/panel/test/row.d.ts +2 -0
  427. package/build-types/panel/test/row.d.ts.map +1 -0
  428. package/build-types/panel/types.d.ts +38 -0
  429. package/build-types/panel/types.d.ts.map +1 -0
  430. package/build-types/popover/index.d.ts.map +1 -1
  431. package/build-types/popover/overlay-middlewares.d.ts +9 -0
  432. package/build-types/popover/overlay-middlewares.d.ts.map +1 -0
  433. package/build-types/popover/stories/index.d.ts.map +1 -1
  434. package/build-types/popover/types.d.ts +3 -2
  435. package/build-types/popover/types.d.ts.map +1 -1
  436. package/build-types/popover/utils.d.ts +12 -4
  437. package/build-types/popover/utils.d.ts.map +1 -1
  438. package/build-types/query-controls/terms.d.ts +1 -1
  439. package/build-types/range-control/utils.d.ts +4 -4
  440. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +5 -4
  441. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  442. package/build-types/resizable-box/resize-tooltip/utils.d.ts +6 -6
  443. package/build-types/toolbar/index.d.ts +7 -0
  444. package/build-types/toolbar/index.d.ts.map +1 -0
  445. package/build-types/toolbar/stories/index.d.ts +14 -0
  446. package/build-types/toolbar/stories/index.d.ts.map +1 -0
  447. package/build-types/toolbar/test/index.d.ts +2 -0
  448. package/build-types/toolbar/test/index.d.ts.map +1 -0
  449. package/build-types/toolbar/test/toolbar-group.d.ts +2 -0
  450. package/build-types/toolbar/test/toolbar-group.d.ts.map +1 -0
  451. package/build-types/toolbar/toolbar/index.d.ts +25 -0
  452. package/build-types/toolbar/toolbar/index.d.ts.map +1 -0
  453. package/build-types/toolbar/toolbar/toolbar-container.d.ts +5 -0
  454. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -0
  455. package/build-types/toolbar/toolbar/types.d.ts +15 -0
  456. package/build-types/toolbar/toolbar/types.d.ts.map +1 -0
  457. package/build-types/toolbar/toolbar-button/index.d.ts +12 -0
  458. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -0
  459. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +3 -0
  460. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -0
  461. package/build-types/toolbar/toolbar-context/index.d.ts +3 -0
  462. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -0
  463. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +3 -0
  464. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -0
  465. package/build-types/toolbar/toolbar-group/index.d.ts +39 -0
  466. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -0
  467. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +7 -0
  468. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -0
  469. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +7 -0
  470. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -0
  471. package/build-types/toolbar/toolbar-item/index.d.ts +7 -0
  472. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -0
  473. package/build-types/tools-panel/stories/index.d.ts +17 -0
  474. package/build-types/tools-panel/stories/index.d.ts.map +1 -0
  475. package/build-types/tools-panel/tools-panel/component.d.ts +54 -2
  476. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  477. package/build-types/tools-panel/tools-panel/hook.d.ts +2 -1
  478. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  479. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  480. package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -1
  481. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  482. package/build-types/tools-panel/tools-panel-item/component.d.ts +2 -2
  483. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  484. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  485. package/build-types/tools-panel/types.d.ts +42 -15
  486. package/build-types/tools-panel/types.d.ts.map +1 -1
  487. package/build-types/tree-grid/cell.d.ts +13 -0
  488. package/build-types/tree-grid/cell.d.ts.map +1 -0
  489. package/build-types/tree-grid/index.d.ts +70 -0
  490. package/build-types/tree-grid/index.d.ts.map +1 -0
  491. package/build-types/tree-grid/item.d.ts +12 -0
  492. package/build-types/tree-grid/item.d.ts.map +1 -0
  493. package/build-types/tree-grid/roving-tab-index-context.d.ts +10 -0
  494. package/build-types/tree-grid/roving-tab-index-context.d.ts.map +1 -0
  495. package/build-types/tree-grid/roving-tab-index-item.d.ts +5 -0
  496. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -0
  497. package/build-types/tree-grid/roving-tab-index.d.ts +10 -0
  498. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -0
  499. package/build-types/tree-grid/row.d.ts +12 -0
  500. package/build-types/tree-grid/row.d.ts.map +1 -0
  501. package/build-types/tree-grid/stories/index.d.ts +13 -0
  502. package/build-types/tree-grid/stories/index.d.ts.map +1 -0
  503. package/build-types/tree-grid/test/cell.d.ts +2 -0
  504. package/build-types/tree-grid/test/cell.d.ts.map +1 -0
  505. package/build-types/tree-grid/test/index.d.ts +2 -0
  506. package/build-types/tree-grid/test/index.d.ts.map +1 -0
  507. package/build-types/tree-grid/test/roving-tab-index-item.d.ts +2 -0
  508. package/build-types/tree-grid/test/roving-tab-index-item.d.ts.map +1 -0
  509. package/build-types/tree-grid/test/roving-tab-index.d.ts +2 -0
  510. package/build-types/tree-grid/test/roving-tab-index.d.ts.map +1 -0
  511. package/build-types/tree-grid/test/row.d.ts +2 -0
  512. package/build-types/tree-grid/test/row.d.ts.map +1 -0
  513. package/build-types/tree-grid/types.d.ts +109 -0
  514. package/build-types/tree-grid/types.d.ts.map +1 -0
  515. package/build-types/ui/context/context-connect.d.ts +7 -7
  516. package/build-types/ui/context/get-styled-class-name-from-key.d.ts +1 -1
  517. package/build-types/ui/utils/get-valid-children.d.ts +1 -1
  518. package/build-types/ui/utils/space.d.ts +1 -1
  519. package/build-types/unit-control/index.d.ts +1 -1
  520. package/build-types/unit-control/utils.d.ts +20 -20
  521. package/build-types/utils/events.d.ts +2 -2
  522. package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
  523. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  524. package/build-types/utils/hooks/use-controlled-value.d.ts +4 -4
  525. package/build-types/utils/hooks/use-latest-ref.d.ts +1 -1
  526. package/build-types/utils/unit-values.d.ts +3 -3
  527. package/package.json +19 -19
  528. package/src/alignment-matrix-control/utils.tsx +4 -4
  529. package/src/angle-picker-control/README.md +17 -14
  530. package/src/angle-picker-control/{angle-circle.js → angle-circle.tsx} +44 -12
  531. package/src/angle-picker-control/{index.js → index.tsx} +54 -10
  532. package/src/angle-picker-control/stories/index.tsx +57 -0
  533. package/src/angle-picker-control/styles/{angle-picker-control-styles.js → angle-picker-control-styles.tsx} +5 -1
  534. package/src/angle-picker-control/types.ts +29 -0
  535. package/src/autocomplete/autocompleter-ui.native.js +1 -0
  536. package/src/base-control/hooks.ts +1 -1
  537. package/src/border-box-control/test/{index.js → index.tsx} +76 -102
  538. package/src/border-box-control/test/{utils.js → utils.ts} +20 -0
  539. package/src/border-box-control/utils.ts +1 -1
  540. package/src/box-control/README.md +17 -26
  541. package/src/box-control/{all-input-control.js → all-input-control.tsx} +10 -6
  542. package/src/box-control/{axial-input-controls.js → axial-input-controls.tsx} +29 -24
  543. package/src/box-control/{icon.js → icon.tsx} +9 -4
  544. package/src/box-control/{index.js → index.tsx} +43 -8
  545. package/src/box-control/{input-controls.js → input-controls.tsx} +26 -16
  546. package/src/box-control/{linked-button.js → linked-button.tsx} +4 -1
  547. package/src/box-control/styles/{box-control-icon-styles.js → box-control-icon-styles.ts} +1 -1
  548. package/src/box-control/styles/{box-control-styles.js → box-control-styles.ts} +10 -2
  549. package/src/box-control/styles/{box-control-visualizer-styles.js → box-control-visualizer-styles.ts} +6 -2
  550. package/src/box-control/test/{index.js → index.tsx} +12 -9
  551. package/src/box-control/types.ts +121 -0
  552. package/src/box-control/{unit-control.js → unit-control.tsx} +9 -2
  553. package/src/box-control/{utils.js → utils.ts} +47 -38
  554. package/src/button/test/index.tsx +38 -30
  555. package/src/color-palette/README.md +7 -0
  556. package/src/color-palette/index.tsx +6 -1
  557. package/src/color-palette/types.ts +8 -0
  558. package/src/combobox-control/README.md +8 -15
  559. package/src/combobox-control/{index.js → index.tsx} +91 -19
  560. package/src/combobox-control/stories/index.tsx +114 -0
  561. package/src/combobox-control/styles.ts +4 -1
  562. package/src/combobox-control/test/{index.js → index.tsx} +9 -7
  563. package/src/combobox-control/types.ts +69 -0
  564. package/src/custom-gradient-picker/index.js +0 -1
  565. package/src/custom-select-control/stories/index.js +1 -1
  566. package/src/date-time/time/index.tsx +1 -1
  567. package/src/date-time/utils.ts +1 -1
  568. package/src/draggable/index.tsx +2 -2
  569. package/src/dropdown-menu/test/index.js +3 -11
  570. package/src/focal-point-picker/utils.ts +3 -3
  571. package/src/font-size-picker/utils.ts +2 -2
  572. package/src/gradient-picker/README.md +8 -0
  573. package/src/gradient-picker/index.js +6 -1
  574. package/src/input-control/reducer/reducer.ts +5 -5
  575. package/src/input-control/utils.ts +1 -1
  576. package/src/menu-items-choice/index.tsx +83 -0
  577. package/src/menu-items-choice/stories/index.tsx +79 -0
  578. package/src/menu-items-choice/types.ts +54 -0
  579. package/src/modal/index.tsx +45 -1
  580. package/src/modal/style.scss +8 -0
  581. package/src/modal/types.ts +2 -0
  582. package/src/palette-edit/index.js +4 -1
  583. package/src/panel/README.md +2 -2
  584. package/src/panel/header.tsx +20 -0
  585. package/src/panel/index.tsx +48 -0
  586. package/src/panel/row.tsx +37 -0
  587. package/src/panel/stories/index.js +22 -0
  588. package/src/panel/test/__snapshots__/{header.js.snap → header.tsx.snap} +0 -0
  589. package/src/panel/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  590. package/src/panel/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
  591. package/src/panel/test/{header.js → header.tsx} +1 -1
  592. package/src/panel/test/{index.js → index.tsx} +6 -4
  593. package/src/panel/test/{row.js → row.tsx} +4 -2
  594. package/src/panel/types.ts +38 -0
  595. package/src/popover/README.md +4 -1
  596. package/src/popover/index.tsx +17 -1
  597. package/src/popover/overlay-middlewares.tsx +29 -0
  598. package/src/popover/stories/index.tsx +7 -1
  599. package/src/popover/test/index.tsx +29 -21
  600. package/src/popover/types.ts +4 -2
  601. package/src/popover/utils.ts +39 -3
  602. package/src/query-controls/terms.ts +1 -1
  603. package/src/range-control/utils.ts +4 -4
  604. package/src/resizable-box/resize-tooltip/styles/{resize-tooltip.styles.js → resize-tooltip.styles.ts} +0 -0
  605. package/src/resizable-box/resize-tooltip/utils.ts +14 -14
  606. package/src/snackbar/index.tsx +2 -2
  607. package/src/toolbar/stories/{index.js → index.tsx} +39 -26
  608. package/src/toolbar/test/{index.js → index.tsx} +0 -0
  609. package/src/toolbar/test/{toolbar-group.js → toolbar-group.tsx} +2 -2
  610. package/src/toolbar/toolbar/README.md +7 -2
  611. package/src/toolbar/toolbar/{index.js → index.tsx} +33 -12
  612. package/src/toolbar/toolbar/{toolbar-container.js → toolbar-container.tsx} +9 -2
  613. package/src/toolbar/toolbar/types.ts +15 -0
  614. package/src/toolbar/toolbar-button/index.js +2 -0
  615. package/src/toolbar/toolbar-button/toolbar-button-container.js +2 -0
  616. package/src/toolbar/toolbar-context/index.js +2 -0
  617. package/src/toolbar/toolbar-dropdown-menu/index.js +2 -0
  618. package/src/toolbar/toolbar-group/index.js +2 -0
  619. package/src/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
  620. package/src/toolbar/toolbar-group/toolbar-group-container.js +2 -0
  621. package/src/toolbar/toolbar-item/index.js +2 -0
  622. package/src/tools-panel/stories/{index.js → index.tsx} +196 -95
  623. package/src/tools-panel/test/index.js +6 -6
  624. package/src/tools-panel/tools-panel/README.md +12 -4
  625. package/src/tools-panel/tools-panel/component.tsx +57 -3
  626. package/src/tools-panel/tools-panel/hook.ts +4 -2
  627. package/src/tools-panel/tools-panel-header/README.md +7 -0
  628. package/src/tools-panel/tools-panel-header/component.tsx +2 -1
  629. package/src/tools-panel/tools-panel-header/hook.ts +6 -4
  630. package/src/tools-panel/tools-panel-item/README.md +6 -4
  631. package/src/tools-panel/tools-panel-item/component.tsx +4 -4
  632. package/src/tools-panel/tools-panel-item/hook.ts +4 -2
  633. package/src/tools-panel/types.ts +43 -15
  634. package/src/tree-grid/README.md +18 -58
  635. package/src/tree-grid/cell.tsx +41 -0
  636. package/src/tree-grid/{index.js → index.tsx} +111 -35
  637. package/src/tree-grid/item.tsx +32 -0
  638. package/src/tree-grid/{roving-tab-index-context.js → roving-tab-index-context.ts} +9 -1
  639. package/src/tree-grid/roving-tab-index-item.tsx +50 -0
  640. package/src/tree-grid/{roving-tab-index.js → roving-tab-index.tsx} +7 -5
  641. package/src/tree-grid/row.tsx +47 -0
  642. package/src/tree-grid/stories/index.tsx +144 -0
  643. package/src/tree-grid/test/__snapshots__/{cell.js.snap → cell.tsx.snap} +0 -0
  644. package/src/tree-grid/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  645. package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.js.snap → roving-tab-index-item.tsx.snap} +0 -0
  646. package/src/tree-grid/test/__snapshots__/{roving-tab-index.js.snap → roving-tab-index.tsx.snap} +0 -0
  647. package/src/tree-grid/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
  648. package/src/tree-grid/test/{cell.js → cell.tsx} +7 -4
  649. package/src/tree-grid/test/{index.js → index.tsx} +13 -5
  650. package/src/tree-grid/test/{roving-tab-index-item.js → roving-tab-index-item.tsx} +7 -4
  651. package/src/tree-grid/test/{roving-tab-index.js → roving-tab-index.tsx} +0 -0
  652. package/src/tree-grid/test/{row.js → row.tsx} +4 -4
  653. package/src/tree-grid/types.ts +116 -0
  654. package/src/ui/context/context-connect.ts +7 -7
  655. package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
  656. package/src/ui/utils/get-valid-children.ts +1 -1
  657. package/src/ui/utils/space.ts +1 -1
  658. package/src/unit-control/index.tsx +2 -2
  659. package/src/unit-control/utils.ts +20 -20
  660. package/src/utils/events.ts +4 -4
  661. package/src/utils/hooks/use-controlled-state.js +2 -2
  662. package/src/utils/hooks/use-controlled-value.ts +4 -4
  663. package/src/utils/hooks/use-latest-ref.ts +1 -1
  664. package/src/utils/unit-values.ts +3 -3
  665. package/tsconfig.json +1 -7
  666. package/tsconfig.tsbuildinfo +1 -1
  667. package/build/base-field/hook.js +0 -54
  668. package/build/base-field/hook.js.map +0 -1
  669. package/build/base-field/index.js +0 -14
  670. package/build/base-field/index.js.map +0 -1
  671. package/build/base-field/styles.js +0 -33
  672. package/build/base-field/styles.js.map +0 -1
  673. package/build/resizable-box/styles/resizable-box.styles.js +0 -2
  674. package/build-module/base-field/hook.js +0 -37
  675. package/build-module/base-field/hook.js.map +0 -1
  676. package/build-module/base-field/index.js +0 -2
  677. package/build-module/base-field/index.js.map +0 -1
  678. package/build-module/base-field/styles.js +0 -18
  679. package/build-module/base-field/styles.js.map +0 -1
  680. package/build-module/resizable-box/styles/resizable-box.styles.js +0 -2
  681. package/build-types/base-field/hook.d.ts +0 -270
  682. package/build-types/base-field/hook.d.ts.map +0 -1
  683. package/build-types/base-field/index.d.ts +0 -2
  684. package/build-types/base-field/index.d.ts.map +0 -1
  685. package/build-types/base-field/styles.d.ts +0 -6
  686. package/build-types/base-field/styles.d.ts.map +0 -1
  687. package/build-types/base-field/types.d.ts +0 -29
  688. package/build-types/base-field/types.d.ts.map +0 -1
  689. package/build-types/resizable-box/styles/resizable-box.styles.d.ts +0 -1
  690. package/build-types/resizable-box/styles/resizable-box.styles.d.ts.map +0 -1
  691. package/src/angle-picker-control/stories/index.js +0 -29
  692. package/src/base-field/README.md +0 -66
  693. package/src/base-field/hook.ts +0 -51
  694. package/src/base-field/index.ts +0 -1
  695. package/src/base-field/styles.ts +0 -86
  696. package/src/base-field/test/__snapshots__/index.tsx.snap +0 -141
  697. package/src/base-field/test/index.tsx +0 -84
  698. package/src/base-field/types.ts +0 -29
  699. package/src/combobox-control/stories/index.js +0 -339
  700. package/src/menu-items-choice/index.js +0 -43
  701. package/src/panel/header.js +0 -10
  702. package/src/panel/index.js +0 -26
  703. package/src/panel/row.js +0 -20
  704. package/src/resizable-box/styles/resizable-box.styles.js +0 -0
  705. package/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js +0 -246
  706. package/src/tree-grid/cell.js +0 -24
  707. package/src/tree-grid/item.js +0 -20
  708. package/src/tree-grid/roving-tab-index-item.js +0 -33
  709. package/src/tree-grid/row.js +0 -31
  710. package/src/tree-grid/stories/index.js +0 -106
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/component.tsx"],"names":["useToolsPanelItem","View","contextConnect","ToolsPanelItem","props","forwardedRef","children","isShown","shouldRenderPlaceholder","toolsPanelItemProps","ConnectedToolsPanelItem"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,QAAlC;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;;AAGA;AACA;AACA,MAAMC,cAAc,GAAG,CACtBC,KADsB,EAEtBC,YAFsB,KAGlB;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,OAFK;AAGLC,IAAAA,uBAHK;AAIL,OAAGC;AAJE,MAKFT,iBAAiB,CAAEI,KAAF,CALrB;;AAOA,MAAK,CAAEG,OAAP,EAAiB;AAChB,WAAOC,uBAAuB,GAC7B,cAAC,IAAD,eAAWC,mBAAX;AAAiC,MAAA,GAAG,EAAGJ;AAAvC,OAD6B,GAE1B,IAFJ;AAGA;;AAED,SACC,cAAC,IAAD,eAAWI,mBAAX;AAAiC,IAAA,GAAG,EAAGJ;AAAvC,MACGC,QADH,CADD;AAKA,CAtBD;;AAwBA,MAAMI,uBAAuB,GAAGR,cAAc,CAC7CC,cAD6C,EAE7C,gBAF6C,CAA9C;AAKA,eAAeO,uBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelItem } from './hook';\nimport { View } from '../../view';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelItemProps } from '../types';\n\n// This wraps controls to be conditionally displayed within a tools panel. It\n// prevents props being applied to HTML elements that would make them invalid.\nconst ToolsPanelItem = (\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\t...toolsPanelItemProps\n\t} = useToolsPanelItem( props );\n\n\tif ( ! isShown ) {\n\t\treturn shouldRenderPlaceholder ? (\n\t\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef } />\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef }>\n\t\t\t{ children }\n\t\t</View>\n\t);\n};\n\nconst ConnectedToolsPanelItem = contextConnect(\n\tToolsPanelItem,\n\t'ToolsPanelItem'\n);\n\nexport default ConnectedToolsPanelItem;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/component.tsx"],"names":["useToolsPanelItem","View","contextConnect","UnconnectedToolsPanelItem","props","forwardedRef","children","isShown","shouldRenderPlaceholder","toolsPanelItemProps","ToolsPanelItem"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,QAAlC;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;;AAGA;AACA;AACA,MAAMC,yBAAyB,GAAG,CACjCC,KADiC,EAEjCC,YAFiC,KAG7B;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,OAFK;AAGLC,IAAAA,uBAHK;AAIL,OAAGC;AAJE,MAKFT,iBAAiB,CAAEI,KAAF,CALrB;;AAOA,MAAK,CAAEG,OAAP,EAAiB;AAChB,WAAOC,uBAAuB,GAC7B,cAAC,IAAD,eAAWC,mBAAX;AAAiC,MAAA,GAAG,EAAGJ;AAAvC,OAD6B,GAE1B,IAFJ;AAGA;;AAED,SACC,cAAC,IAAD,eAAWI,mBAAX;AAAiC,IAAA,GAAG,EAAGJ;AAAvC,MACGC,QADH,CADD;AAKA,CAtBD;;AAwBA,OAAO,MAAMI,cAAc,GAAGR,cAAc,CAC3CC,yBAD2C,EAE3C,gBAF2C,CAArC;AAKP,eAAeO,cAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelItem } from './hook';\nimport { View } from '../../view';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelItemProps } from '../types';\n\n// This wraps controls to be conditionally displayed within a tools panel. It\n// prevents props being applied to HTML elements that would make them invalid.\nconst UnconnectedToolsPanelItem = (\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\t...toolsPanelItemProps\n\t} = useToolsPanelItem( props );\n\n\tif ( ! isShown ) {\n\t\treturn shouldRenderPlaceholder ? (\n\t\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef } />\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<View { ...toolsPanelItemProps } ref={ forwardedRef }>\n\t\t\t{ children }\n\t\t</View>\n\t);\n};\n\nexport const ToolsPanelItem = contextConnect(\n\tUnconnectedToolsPanelItem,\n\t'ToolsPanelItem'\n);\n\nexport default ToolsPanelItem;\n"]}
@@ -11,16 +11,19 @@ import * as styles from '../styles';
11
11
  import { useToolsPanelContext } from '../context';
12
12
  import { useContextSystem } from '../../ui/context';
13
13
  import { useCx } from '../../utils/hooks/use-cx';
14
+
15
+ const noop = () => {};
16
+
14
17
  export function useToolsPanelItem(props) {
15
18
  var _menuItems$menuGroup, _menuItems$menuGroup2, _menuItems$menuGroup3;
16
19
 
17
20
  const {
18
21
  className,
19
22
  hasValue,
20
- isShownByDefault,
23
+ isShownByDefault = false,
21
24
  label,
22
25
  panelId,
23
- resetAllFilter,
26
+ resetAllFilter = noop,
24
27
  onDeselect,
25
28
  onSelect,
26
29
  ...otherProps
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"names":["usePrevious","useCallback","useEffect","useMemo","styles","useToolsPanelContext","useContextSystem","useCx","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","wasValueSet","newValueSet","isShown","cx","classes","placeholderStyle","ToolsPanelItemPlaceholder","firstItemStyle","lastItemStyle","ToolsPanelItem"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,oBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,EAAiCC,OAAjC,QAAgD,oBAAhD;AAEA;AACA;AACA;;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AACA,SAASC,oBAAT,QAAqC,YAArC;AACA,SAASC,gBAAT,QAA0D,kBAA1D;AACA,SAASC,KAAT,QAAsB,0BAAtB;AAGA,OAAO,SAASC,iBAAT,CACNC,KADM,EAEL;AAAA;;AACD,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,OALK;AAMLC,IAAAA,cANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,QARK;AASL,OAAGC;AATE,MAUFZ,gBAAgB,CAAEG,KAAF,EAAS,gBAAT,CAVpB;AAYA,QAAM;AACLK,IAAAA,OAAO,EAAEK,cADJ;AAELC,IAAAA,SAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,mBAJK;AAKLC,IAAAA,qBALK;AAML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GFE,YAHE,EAIFd,WAJE,EAKFgB,UALE,EAMFH,kBANE,EAOFpB,QAPE,EAQFD,UARE,CAfM,CAAT,CA3GC,CAqID;AACA;AACA;;AACA,QAAM2B,OAAO,GAAG/B,gBAAgB,GAC7B,CAAAQ,SAAS,SAAT,IAAAA,SAAS,WAAT,qCAAAA,SAAS,CAAIe,SAAJ,CAAT,gFAA4BtB,KAA5B,OAAwC0B,SADX,GAE7BH,iBAFH;AAIA,QAAMQ,EAAE,GAAGrC,KAAK,EAAhB;AACA,QAAMsC,OAAO,GAAG1C,OAAO,CAAE,MAAM;AAC9B,UAAM2C,gBAAgB,GACrBpB,uBAAuB,IACvB,CAAEiB,OADF,IAEAvC,MAAM,CAAC2C,yBAHR;AAIA,UAAMC,cAAc,GACnBrB,kBAAkB,KAAKd,KAAvB,IAAgCgB,mCADjC;AAEA,UAAMoB,aAAa,GAClBrB,iBAAiB,KAAKf,KAAtB,IAA+BiB,kCADhC;AAEA,WAAOc,EAAE,CACRxC,MAAM,CAAC8C,cADC,EAERJ,gBAFQ,EAGRpC,SAHQ,EAIRsC,cAJQ,EAKRC,aALQ,CAAT;AAOA,GAhBsB,EAgBpB,CACFN,OADE,EAEFjB,uBAFE,EAGFhB,SAHE,EAIFkC,EAJE,EAKFjB,kBALE,EAMFC,iBANE,EAOFC,mCAPE,EAQFC,kCARE,EASFjB,KATE,CAhBoB,CAAvB;AA4BA,SAAO,EACN,GAAGK,UADG;AAENyB,IAAAA,OAFM;AAGNjB,IAAAA,uBAHM;AAINhB,IAAAA,SAAS,EAAEmC;AAJL,GAAP;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\tconst hasValueCallback = useCallback( hasValue, [ panelId, hasValue ] );\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [\n\t\tpanelId,\n\t\tresetAllFilter,\n\t] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tresetAllFilter: resetAllFilterCallback,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tresetAllFilterCallback,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\tconst wasValueSet = usePrevious( isValueSet );\n\tconst newValueSet = isValueSet && ! wasValueSet;\n\n\t// Notify the panel when an item's value has been set.\n\t//\n\t// 1. For default controls, this is so \"reset\" appears beside its menu item.\n\t// 2. For optional controls, when the panel ID is `null`, it allows the\n\t// panel to ensure the item is toggled on for display in the menu, given the\n\t// value has been set external to the control.\n\tuseEffect( () => {\n\t\tif ( ! newValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShownByDefault || currentPanelId === null ) {\n\t\t\tflagItemCustomization( label, menuGroup );\n\t\t}\n\t}, [\n\t\tcurrentPanelId,\n\t\tnewValueSet,\n\t\tisShownByDefault,\n\t\tmenuGroup,\n\t\tlabel,\n\t\tflagItemCustomization,\n\t] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst placeholderStyle =\n\t\t\tshouldRenderPlaceholder &&\n\t\t\t! isShown &&\n\t\t\tstyles.ToolsPanelItemPlaceholder;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tplaceholderStyle,\n\t\t\tclassName,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"names":["usePrevious","useCallback","useEffect","useMemo","styles","useToolsPanelContext","useContextSystem","useCx","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","wasValueSet","newValueSet","isShown","cx","classes","placeholderStyle","ToolsPanelItemPlaceholder","firstItemStyle","lastItemStyle","ToolsPanelItem"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,oBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,EAAiCC,OAAjC,QAAgD,oBAAhD;AAEA;AACA;AACA;;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AACA,SAASC,oBAAT,QAAqC,YAArC;AACA,SAASC,gBAAT,QAA0D,kBAA1D;AACA,SAASC,KAAT,QAAsB,0BAAtB;;AAGA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,OAAO,SAASC,iBAAT,CACNC,KADM,EAEL;AAAA;;AACD,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,gBAAgB,GAAG,KAHd;AAILC,IAAAA,KAJK;AAKLC,IAAAA,OALK;AAMLC,IAAAA,cAAc,GAAGR,IANZ;AAOLS,IAAAA,UAPK;AAQLC,IAAAA,QARK;AASL,OAAGC;AATE,MAUFb,gBAAgB,CAAEI,KAAF,EAAS,gBAAT,CAVpB;AAYA,QAAM;AACLK,IAAAA,OAAO,EAAEK,cADJ;AAELC,IAAAA,SAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,mBAJK;AAKLC,IAAAA,qBALK;AAMLC,IAAAA,WANK;AAOLC,IAAAA,4BAA4B,EAAEC,uBAPzB;AAQLC,IAAAA,kBARK;AASLC,IAAAA,iBATK;AAULC,IAAAA,mCAVK;AAWLC,IAAAA;AAXK,MAYF1B,oBAAoB,EAZxB;AAcA,QAAM2B,gBAAgB,GAAG/B,WAAW,CAAEW,QAAF,EAAY,CAAEG,OAAF,EAAWH,QAAX,CAAZ,CAApC;AACA,QAAMqB,sBAAsB,GAAGhC,WAAW,CAAEe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AAE,GAAGtC,KAAK,EAAhB;AACA,QAAMuC,OAAO,GAAG3C,OAAO,CAAE,MAAM;AAC9B,UAAM4C,gBAAgB,GACrBpB,uBAAuB,IACvB,CAAEiB,OADF,IAEAxC,MAAM,CAAC4C,yBAHR;AAIA,UAAMC,cAAc,GACnBrB,kBAAkB,KAAKd,KAAvB,IAAgCgB,mCADjC;AAEA,UAAMoB,aAAa,GAClBrB,iBAAiB,KAAKf,KAAtB,IAA+BiB,kCADhC;AAEA,WAAOc,EAAE,CACRzC,MAAM,CAAC+C,cADC,EAERJ,gBAFQ,EAGRpC,SAHQ,EAIRsC,cAJQ,EAKRC,aALQ,CAAT;AAOA,GAhBsB,EAgBpB,CACFN,OADE,EAEFjB,uBAFE,EAGFhB,SAHE,EAIFkC,EAJE,EAKFjB,kBALE,EAMFC,iBANE,EAOFC,mCAPE,EAQFC,kCARE,EASFjB,KATE,CAhBoB,CAAvB;AA4BA,SAAO,EACN,GAAGK,UADG;AAENyB,IAAAA,OAFM;AAGNjB,IAAAA,uBAHM;AAINhB,IAAAA,SAAS,EAAEmC;AAJL,GAAP;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\tconst hasValueCallback = useCallback( hasValue, [ panelId, hasValue ] );\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [\n\t\tpanelId,\n\t\tresetAllFilter,\n\t] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tresetAllFilter: resetAllFilterCallback,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tresetAllFilterCallback,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\tconst wasValueSet = usePrevious( isValueSet );\n\tconst newValueSet = isValueSet && ! wasValueSet;\n\n\t// Notify the panel when an item's value has been set.\n\t//\n\t// 1. For default controls, this is so \"reset\" appears beside its menu item.\n\t// 2. For optional controls, when the panel ID is `null`, it allows the\n\t// panel to ensure the item is toggled on for display in the menu, given the\n\t// value has been set external to the control.\n\tuseEffect( () => {\n\t\tif ( ! newValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShownByDefault || currentPanelId === null ) {\n\t\t\tflagItemCustomization( label, menuGroup );\n\t\t}\n\t}, [\n\t\tcurrentPanelId,\n\t\tnewValueSet,\n\t\tisShownByDefault,\n\t\tmenuGroup,\n\t\tlabel,\n\t\tflagItemCustomization,\n\t] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst placeholderStyle =\n\t\t\tshouldRenderPlaceholder &&\n\t\t\t! isShown &&\n\t\t\tstyles.ToolsPanelItemPlaceholder;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tplaceholderStyle,\n\t\t\tclassName,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { createElement } from "@wordpress/element";
2
+ import { createElement, Fragment } from "@wordpress/element";
3
3
 
4
4
  /**
5
5
  * WordPress dependencies
@@ -10,7 +10,8 @@ import { forwardRef } from '@wordpress/element';
10
10
  */
11
11
 
12
12
  import TreeGridItem from './item';
13
- export default forwardRef(function TreeGridCell(_ref, ref) {
13
+
14
+ function UnforwardedTreeGridCell(_ref, ref) {
14
15
  let {
15
16
  children,
16
17
  withoutGridItem = false,
@@ -18,8 +19,19 @@ export default forwardRef(function TreeGridCell(_ref, ref) {
18
19
  } = _ref;
19
20
  return createElement("td", _extends({}, props, {
20
21
  role: "gridcell"
21
- }), withoutGridItem ? children : createElement(TreeGridItem, {
22
+ }), withoutGridItem ? createElement(Fragment, null, children) : createElement(TreeGridItem, {
22
23
  ref: ref
23
24
  }, children));
24
- });
25
+ }
26
+ /**
27
+ * `TreeGridCell` is used to create a tree hierarchy.
28
+ * It is not a visually styled component, but instead helps with adding
29
+ * keyboard navigation and roving tab index behaviors to tree grid structures.
30
+ *
31
+ * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
32
+ */
33
+
34
+
35
+ export const TreeGridCell = forwardRef(UnforwardedTreeGridCell);
36
+ export default TreeGridCell;
25
37
  //# sourceMappingURL=cell.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/cell.js"],"names":["forwardRef","TreeGridItem","TreeGridCell","ref","children","withoutGridItem","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,QAAzB;AAEA,eAAeD,UAAU,CAAE,SAASE,YAAT,OAE1BC,GAF0B,EAGzB;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,eAAe,GAAG,KAA9B;AAAqC,OAAGC;AAAxC,GAEC;AACD,SACC,iCAASA,KAAT;AAAiB,IAAA,IAAI,EAAC;AAAtB,MACGD,eAAe,GAChBD,QADgB,GAGhB,cAAC,YAAD;AAAc,IAAA,GAAG,EAAGD;AAApB,KAA4BC,QAA5B,CAJF,CADD;AASA,CAbwB,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TreeGridItem from './item';\n\nexport default forwardRef( function TreeGridCell(\n\t{ children, withoutGridItem = false, ...props },\n\tref\n) {\n\treturn (\n\t\t<td { ...props } role=\"gridcell\">\n\t\t\t{ withoutGridItem ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<TreeGridItem ref={ ref }>{ children }</TreeGridItem>\n\t\t\t) }\n\t\t</td>\n\t);\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/cell.tsx"],"names":["forwardRef","TreeGridItem","UnforwardedTreeGridCell","ref","children","withoutGridItem","props","TreeGridCell"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,QAAzB;;AAIA,SAASC,uBAAT,OAMCC,GAND,EAOE;AAAA,MAND;AACCC,IAAAA,QADD;AAECC,IAAAA,eAAe,GAAG,KAFnB;AAGC,OAAGC;AAHJ,GAMC;AACD,SACC,iCAASA,KAAT;AAAiB,IAAA,IAAI,EAAC;AAAtB,MACGD,eAAe,GAChB,8BAAID,QAAJ,CADgB,GAGhB,cAAC,YAAD;AAAc,IAAA,GAAG,EAAGD;AAApB,KAA4BC,QAA5B,CAJF,CADD;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMG,YAAY,GAAGP,UAAU,CAAEE,uBAAF,CAA/B;AAEP,eAAeK,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TreeGridItem from './item';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { TreeGridCellProps } from './types';\n\nfunction UnforwardedTreeGridCell(\n\t{\n\t\tchildren,\n\t\twithoutGridItem = false,\n\t\t...props\n\t}: WordPressComponentProps< TreeGridCellProps, 'td', false >,\n\tref: React.ForwardedRef< any >\n) {\n\treturn (\n\t\t<td { ...props } role=\"gridcell\">\n\t\t\t{ withoutGridItem ? (\n\t\t\t\t<>{ children }</>\n\t\t\t) : (\n\t\t\t\t<TreeGridItem ref={ ref }>{ children }</TreeGridItem>\n\t\t\t) }\n\t\t</td>\n\t);\n}\n\n/**\n * `TreeGridCell` is used to create a tree hierarchy.\n * It is not a visually styled component, but instead helps with adding\n * keyboard navigation and roving tab index behaviors to tree grid structures.\n *\n * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}\n */\nexport const TreeGridCell = forwardRef( UnforwardedTreeGridCell );\n\nexport default TreeGridCell;\n"]}
@@ -12,24 +12,19 @@ import { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';
12
12
  */
13
13
 
14
14
  import RovingTabIndexContainer from './roving-tab-index';
15
+
15
16
  /**
16
17
  * Return focusables in a row element, excluding those from other branches
17
18
  * nested within the row.
18
19
  *
19
- * @param {Element} rowElement The DOM element representing the row.
20
+ * @param rowElement The DOM element representing the row.
20
21
  *
21
- * @return {Array | undefined} The array of focusables in the row.
22
+ * @return The array of focusables in the row.
22
23
  */
23
-
24
24
  function getRowFocusables(rowElement) {
25
25
  const focusablesInRow = focus.focusable.find(rowElement, {
26
26
  sequential: true
27
27
  });
28
-
29
- if (!focusablesInRow || !focusablesInRow.length) {
30
- return;
31
- }
32
-
33
28
  return focusablesInRow.filter(focusable => {
34
29
  return focusable.closest('[role="row"]') === rowElement;
35
30
  });
@@ -37,18 +32,12 @@ function getRowFocusables(rowElement) {
37
32
  /**
38
33
  * Renders both a table and tbody element, used to create a tree hierarchy.
39
34
  *
40
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
41
- * @param {Object} props Component props.
42
- * @param {WPElement} props.children Children to be rendered.
43
- * @param {Function} props.onExpandRow Callback to fire when row is expanded.
44
- * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
45
- * @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
46
- * @param {string} props.applicationAriaLabel Label to use for the application role.
47
- * @param {Object} ref A ref to the underlying DOM table element.
48
35
  */
49
36
 
50
37
 
51
- function TreeGrid(_ref, ref) {
38
+ function UnforwardedTreeGrid(_ref,
39
+ /** A ref to the underlying DOM table element. */
40
+ ref) {
52
41
  let {
53
42
  children,
54
43
  onExpandRow = () => {},
@@ -81,12 +70,17 @@ function TreeGrid(_ref, ref) {
81
70
  currentTarget: treeGridElement
82
71
  } = event;
83
72
 
84
- if (!treeGridElement.contains(activeElement)) {
73
+ if (!activeElement || !treeGridElement.contains(activeElement)) {
85
74
  return;
86
75
  } // Calculate the columnIndex of the active element.
87
76
 
88
77
 
89
78
  const activeRow = activeElement.closest('[role="row"]');
79
+
80
+ if (!activeRow) {
81
+ return;
82
+ }
83
+
90
84
  const focusablesInRow = getRowFocusables(activeRow);
91
85
  const currentColumnIndex = focusablesInRow.indexOf(activeElement);
92
86
  const canExpandCollapse = 0 === currentColumnIndex;
@@ -116,13 +110,15 @@ function TreeGrid(_ref, ref) {
116
110
  } // If a row is focused, and it is collapsed, moves to the parent row (if there is one).
117
111
 
118
112
 
119
- const level = Math.max(parseInt((_activeRow$getAttribu = activeRow === null || activeRow === void 0 ? void 0 : activeRow.getAttribute('aria-level')) !== null && _activeRow$getAttribu !== void 0 ? _activeRow$getAttribu : 1, 10) - 1, 1);
113
+ const level = Math.max(parseInt((_activeRow$getAttribu = activeRow === null || activeRow === void 0 ? void 0 : activeRow.getAttribute('aria-level')) !== null && _activeRow$getAttribu !== void 0 ? _activeRow$getAttribu : '1', 10) - 1, 1);
120
114
  const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
121
115
  let parentRow = activeRow;
122
116
  const currentRowIndex = rows.indexOf(activeRow);
123
117
 
124
118
  for (let i = currentRowIndex; i >= 0; i--) {
125
- if (parseInt(rows[i].getAttribute('aria-level'), 10) === level) {
119
+ const ariaLevel = rows[i].getAttribute('aria-level');
120
+
121
+ if (ariaLevel !== null && parseInt(ariaLevel, 10) === level) {
126
122
  parentRow = rows[i];
127
123
  break;
128
124
  }
@@ -264,8 +260,72 @@ function TreeGrid(_ref, ref) {
264
260
  }), createElement("tbody", null, children))));
265
261
  /* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */
266
262
  }
263
+ /**
264
+ * `TreeGrid` is used to create a tree hierarchy.
265
+ * It is not a visually styled component, but instead helps with adding
266
+ * keyboard navigation and roving tab index behaviors to tree grid structures.
267
+ *
268
+ * A tree grid is a hierarchical 2 dimensional UI component, for example it could be
269
+ * used to implement a file system browser.
270
+ *
271
+ * A tree grid allows the user to navigate using arrow keys.
272
+ * Up/down to navigate vertically across rows, and left/right to navigate horizontally
273
+ * between focusables in a row.
274
+ *
275
+ * The `TreeGrid` renders both a `table` and `tbody` element, and is intended to be used
276
+ * with `TreeGridRow` (`tr`) and `TreeGridCell` (`td`) to build out a grid.
277
+ *
278
+ * ```jsx
279
+ * function TreeMenu() {
280
+ * return (
281
+ * <TreeGrid>
282
+ * <TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }>
283
+ * <TreeGridCell>
284
+ * { ( props ) => (
285
+ * <Button onClick={ onSelect } { ...props }>Select</Button>
286
+ * ) }
287
+ * </TreeGridCell>
288
+ * <TreeGridCell>
289
+ * { ( props ) => (
290
+ * <Button onClick={ onMove } { ...props }>Move</Button>
291
+ * ) }
292
+ * </TreeGridCell>
293
+ * </TreeGridRow>
294
+ * <TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }>
295
+ * <TreeGridCell>
296
+ * { ( props ) => (
297
+ * <Button onClick={ onSelect } { ...props }>Select</Button>
298
+ * ) }
299
+ * </TreeGridCell>
300
+ * <TreeGridCell>
301
+ * { ( props ) => (
302
+ * <Button onClick={ onMove } { ...props }>Move</Button>
303
+ * ) }
304
+ * </TreeGridCell>
305
+ * </TreeGridRow>
306
+ * <TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }>
307
+ * <TreeGridCell>
308
+ * { ( props ) => (
309
+ * <Button onClick={ onSelect } { ...props }>Select</Button>
310
+ * ) }
311
+ * </TreeGridCell>
312
+ * <TreeGridCell>
313
+ * { ( props ) => (
314
+ * <Button onClick={ onMove } { ...props }>Move</Button>
315
+ * ) }
316
+ * </TreeGridCell>
317
+ * </TreeGridRow>
318
+ * </TreeGrid>
319
+ * );
320
+ * }
321
+ * ```
322
+ *
323
+ * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
324
+ */
325
+
267
326
 
268
- export default forwardRef(TreeGrid);
327
+ export const TreeGrid = forwardRef(UnforwardedTreeGrid);
328
+ export default TreeGrid;
269
329
  export { default as TreeGridRow } from './row';
270
330
  export { default as TreeGridCell } from './cell';
271
331
  export { default as TreeGridItem } from './item';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/index.js"],"names":["focus","forwardRef","useCallback","UP","DOWN","LEFT","RIGHT","HOME","END","RovingTabIndexContainer","getRowFocusables","rowElement","focusablesInRow","focusable","find","sequential","length","filter","closest","TreeGrid","ref","children","onExpandRow","onCollapseRow","onFocusRow","applicationAriaLabel","props","onKeyDown","event","keyCode","metaKey","ctrlKey","altKey","hasModifierKeyPressed","includes","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","focusableItems","nextRowIndex","focusablesInNextRow","default","TreeGridRow","TreeGridCell","TreeGridItem"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAAT,EAAqBC,WAArB,QAAwC,oBAAxC;AACA,SAASC,EAAT,EAAaC,IAAb,EAAmBC,IAAnB,EAAyBC,KAAzB,EAAgCC,IAAhC,EAAsCC,GAAtC,QAAiD,qBAAjD;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,oBAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,UAA3B,EAAwC;AACvC,QAAMC,eAAe,GAAGZ,KAAK,CAACa,SAAN,CAAgBC,IAAhB,CAAsBH,UAAtB,EAAkC;AACzDI,IAAAA,UAAU,EAAE;AAD6C,GAAlC,CAAxB;;AAIA,MAAK,CAAEH,eAAF,IAAqB,CAAEA,eAAe,CAACI,MAA5C,EAAqD;AACpD;AACA;;AAED,SAAOJ,eAAe,CAACK,MAAhB,CAA0BJ,SAAF,IAAiB;AAC/C,WAAOA,SAAS,CAACK,OAAV,CAAmB,cAAnB,MAAwC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,IAAA,GAAG,EAAGP;AAJP,MAMC,6BAASC,QAAT,CAND,CADD,CAND,CADD;AAmBA;AACA;;AAED,eAAepB,UAAU,CAAEkB,QAAF,CAAzB;AACA,SAAS6C,OAAO,IAAIC,WAApB,QAAuC,OAAvC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,QAAxC;AACA,SAASF,OAAO,IAAIG,YAApB,QAAwC,QAAxC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { forwardRef, useCallback } from '@wordpress/element';\nimport { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexContainer from './roving-tab-index';\n\n/**\n * Return focusables in a row element, excluding those from other branches\n * nested within the row.\n *\n * @param {Element} rowElement The DOM element representing the row.\n *\n * @return {Array | undefined} The array of focusables in the row.\n */\nfunction getRowFocusables( rowElement ) {\n\tconst focusablesInRow = focus.focusable.find( rowElement, {\n\t\tsequential: true,\n\t} );\n\n\tif ( ! focusablesInRow || ! focusablesInRow.length ) {\n\t\treturn;\n\t}\n\n\treturn focusablesInRow.filter( ( focusable ) => {\n\t\treturn focusable.closest( '[role=\"row\"]' ) === rowElement;\n\t} );\n}\n\n/**\n * Renders both a table and tbody element, used to create a tree hierarchy.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n * @param {Object} props Component props.\n * @param {WPElement} props.children Children to be rendered.\n * @param {Function} props.onExpandRow Callback to fire when row is expanded.\n * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.\n * @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.\n * @param {string} props.applicationAriaLabel Label to use for the application role.\n * @param {Object} ref A ref to the underlying DOM table element.\n */\nfunction TreeGrid(\n\t{\n\t\tchildren,\n\t\tonExpandRow = () => {},\n\t\tonCollapseRow = () => {},\n\t\tonFocusRow = () => {},\n\t\tapplicationAriaLabel,\n\t\t...props\n\t},\n\tref\n) {\n\tconst onKeyDown = useCallback(\n\t\t( event ) => {\n\t\t\tconst { keyCode, metaKey, ctrlKey, altKey } = event;\n\n\t\t\t// The shift key is intentionally absent from the following list,\n\t\t\t// to enable shift + up/down to select items from the list.\n\t\t\tconst hasModifierKeyPressed = metaKey || ctrlKey || altKey;\n\n\t\t\tif (\n\t\t\t\thasModifierKeyPressed ||\n\t\t\t\t! [ UP, DOWN, LEFT, RIGHT, HOME, END ].includes( keyCode )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The event will be handled, stop propagation.\n\t\t\tevent.stopPropagation();\n\n\t\t\tconst { activeElement } = document;\n\t\t\tconst { currentTarget: treeGridElement } = event;\n\t\t\tif ( ! treeGridElement.contains( activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Calculate the columnIndex of the active element.\n\t\t\tconst activeRow = activeElement.closest( '[role=\"row\"]' );\n\t\t\tconst focusablesInRow = getRowFocusables( activeRow );\n\t\t\tconst currentColumnIndex = focusablesInRow.indexOf( activeElement );\n\t\t\tconst canExpandCollapse = 0 === currentColumnIndex;\n\t\t\tconst cannotFocusNextColumn =\n\t\t\t\tcanExpandCollapse &&\n\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'false' &&\n\t\t\t\tkeyCode === RIGHT;\n\n\t\t\tif ( [ LEFT, RIGHT ].includes( keyCode ) ) {\n\t\t\t\t// Calculate to the next element.\n\t\t\t\tlet nextIndex;\n\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\tnextIndex = Math.max( 0, currentColumnIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextIndex = Math.min(\n\t\t\t\t\t\tcurrentColumnIndex + 1,\n\t\t\t\t\t\tfocusablesInRow.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is at the left most column.\n\t\t\t\tif ( canExpandCollapse ) {\n\t\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\t\t// Left:\n\t\t\t\t\t\t// If a row is focused, and it is expanded, collapses the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'true'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonCollapseRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, moves to the parent row (if there is one).\n\t\t\t\t\t\tconst level = Math.max(\n\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\tactiveRow?.getAttribute( 'aria-level' ) ?? 1,\n\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t) - 1,\n\t\t\t\t\t\t\t1\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst rows = Array.from(\n\t\t\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet parentRow = activeRow;\n\t\t\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\t\t\tfor ( let i = currentRowIndex; i >= 0; i-- ) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\t\trows[ i ].getAttribute( 'aria-level' ),\n\t\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t\t) === level\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tparentRow = rows[ i ];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetRowFocusables( parentRow )?.[ 0 ]?.focus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( keyCode === RIGHT ) {\n\t\t\t\t\t\t// Right:\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, expands the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\t\t\t\t\t\t'false'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonExpandRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is expanded, focuses the next cell in the row.\n\t\t\t\t\t\tconst focusableItems = getRowFocusables( activeRow );\n\t\t\t\t\t\tif ( focusableItems.length > 0 ) {\n\t\t\t\t\t\t\tfocusableItems[ nextIndex ]?.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start reading text on continued use of left/right arrow\n\t\t\t\t\t// keys.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.\n\t\t\t\tif ( cannotFocusNextColumn ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfocusablesInRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( [ UP, DOWN ].includes( keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === UP ) {\n\t\t\t\t\tnextRowIndex = Math.max( 0, currentRowIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = Math.min(\n\t\t\t\t\t\tcurrentRowIndex + 1,\n\t\t\t\t\t\trows.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( [ HOME, END ].includes( keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === HOME ) {\n\t\t\t\t\tnextRowIndex = 0;\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = rows.length - 1;\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ onExpandRow, onCollapseRow, onFocusRow ]\n\t);\n\n\t/* Disable reason: A treegrid is implemented using a table element. */\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<RovingTabIndexContainer>\n\t\t\t{\n\t\t\t\t// Prevent browser mode from triggering in NVDA by wrapping List View\n\t\t\t\t// in a role=application wrapper.\n\t\t\t\t// see: https://github.com/WordPress/gutenberg/issues/43729\n\t\t\t }\n\t\t\t<div role=\"application\" aria-label={ applicationAriaLabel }>\n\t\t\t\t<table\n\t\t\t\t\t{ ...props }\n\t\t\t\t\trole=\"treegrid\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\tref={ ref }\n\t\t\t\t>\n\t\t\t\t\t<tbody>{ children }</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</RovingTabIndexContainer>\n\t);\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( TreeGrid );\nexport { default as TreeGridRow } from './row';\nexport { default as TreeGridCell } from './cell';\nexport { default as TreeGridItem } from './item';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/index.tsx"],"names":["focus","forwardRef","useCallback","UP","DOWN","LEFT","RIGHT","HOME","END","RovingTabIndexContainer","getRowFocusables","rowElement","focusablesInRow","focusable","find","sequential","filter","closest","UnforwardedTreeGrid","ref","children","onExpandRow","onCollapseRow","onFocusRow","applicationAriaLabel","props","onKeyDown","event","keyCode","metaKey","ctrlKey","altKey","hasModifierKeyPressed","includes","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","length","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","ariaLevel","focusableItems","nextRowIndex","focusablesInNextRow","TreeGrid","default","TreeGridRow","TreeGridCell","TreeGridItem"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAAT,EAAqBC,WAArB,QAAwC,oBAAxC;AACA,SAASC,EAAT,EAAaC,IAAb,EAAmBC,IAAnB,EAAyBC,KAAzB,EAAgCC,IAAhC,EAAsCC,GAAtC,QAAiD,q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B,CAAElB,SAAF,CAAnB,CAAiC9C,KAAjC,GA5C+D,CA8C/D;AACA;;AACAuB,MAAAA,UAAU,CAAEI,KAAF,EAASa,SAAT,EAAoBc,IAAI,CAAES,YAAF,CAAxB,CAAV,CAhD+D,CAkD/D;AACA;;AACApC,MAAAA,KAAK,CAACwB,cAAN;AACA;AACD,GApP2B,EAqP5B,CAAE9B,WAAF,EAAeC,aAAf,EAA8BC,UAA9B,CArP4B,CAA7B;AAwPA;;AACA;;AACA,SACC,cAAC,uBAAD,QAMC;AAAK,IAAA,IAAI,EAAC,aAAV;AAAwB,kBAAaC;AAArC,KACC,oCACMC,KADN;AAEC,IAAA,IAAI,EAAC,UAFN;AAGC,IAAA,SAAS,EAAGC,SAHb;AAIC,IAAA,GAAG,EAAGP;AAJP,MAMC,6BAASC,QAAT,CAND,CADD,CAND,CADD;AAmBA;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAM6C,QAAQ,GAAGhE,UAAU,CAAEiB,mBAAF,CAA3B;AAEP,eAAe+C,QAAf;AACA,SAASC,OAAO,IAAIC,WAApB,QAAuC,OAAvC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,QAAxC;AACA,SAASF,OAAO,IAAIG,YAApB,QAAwC,QAAxC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { forwardRef, useCallback } from '@wordpress/element';\nimport { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexContainer from './roving-tab-index';\nimport type { TreeGridProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * Return focusables in a row element, excluding those from other branches\n * nested within the row.\n *\n * @param rowElement The DOM element representing the row.\n *\n * @return The array of focusables in the row.\n */\nfunction getRowFocusables( rowElement: HTMLElement ) {\n\tconst focusablesInRow = focus.focusable.find( rowElement, {\n\t\tsequential: true,\n\t} );\n\n\treturn focusablesInRow.filter( ( focusable ) => {\n\t\treturn focusable.closest( '[role=\"row\"]' ) === rowElement;\n\t} );\n}\n\n/**\n * Renders both a table and tbody element, used to create a tree hierarchy.\n *\n */\nfunction UnforwardedTreeGrid(\n\t{\n\t\tchildren,\n\t\tonExpandRow = () => {},\n\t\tonCollapseRow = () => {},\n\t\tonFocusRow = () => {},\n\t\tapplicationAriaLabel,\n\t\t...props\n\t}: WordPressComponentProps< TreeGridProps, 'table', false >,\n\t/** A ref to the underlying DOM table element. */\n\tref: React.ForwardedRef< HTMLTableElement >\n) {\n\tconst onKeyDown = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLTableElement > ) => {\n\t\t\tconst { keyCode, metaKey, ctrlKey, altKey } = event;\n\n\t\t\t// The shift key is intentionally absent from the following list,\n\t\t\t// to enable shift + up/down to select items from the list.\n\t\t\tconst hasModifierKeyPressed = metaKey || ctrlKey || altKey;\n\n\t\t\tif (\n\t\t\t\thasModifierKeyPressed ||\n\t\t\t\t! ( [ UP, DOWN, LEFT, RIGHT, HOME, END ] as number[] ).includes(\n\t\t\t\t\tkeyCode\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The event will be handled, stop propagation.\n\t\t\tevent.stopPropagation();\n\n\t\t\tconst { activeElement } = document;\n\t\t\tconst { currentTarget: treeGridElement } = event;\n\n\t\t\tif (\n\t\t\t\t! activeElement ||\n\t\t\t\t! treeGridElement.contains( activeElement )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Calculate the columnIndex of the active element.\n\t\t\tconst activeRow =\n\t\t\t\tactiveElement.closest< HTMLElement >( '[role=\"row\"]' );\n\n\t\t\tif ( ! activeRow ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst focusablesInRow = getRowFocusables( activeRow );\n\t\t\tconst currentColumnIndex = focusablesInRow.indexOf(\n\t\t\t\tactiveElement as HTMLElement\n\t\t\t);\n\t\t\tconst canExpandCollapse = 0 === currentColumnIndex;\n\t\t\tconst cannotFocusNextColumn =\n\t\t\t\tcanExpandCollapse &&\n\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'false' &&\n\t\t\t\tkeyCode === RIGHT;\n\n\t\t\tif ( ( [ LEFT, RIGHT ] as number[] ).includes( keyCode ) ) {\n\t\t\t\t// Calculate to the next element.\n\t\t\t\tlet nextIndex;\n\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\tnextIndex = Math.max( 0, currentColumnIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextIndex = Math.min(\n\t\t\t\t\t\tcurrentColumnIndex + 1,\n\t\t\t\t\t\tfocusablesInRow.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is at the left most column.\n\t\t\t\tif ( canExpandCollapse ) {\n\t\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\t\t// Left:\n\t\t\t\t\t\t// If a row is focused, and it is expanded, collapses the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'true'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonCollapseRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, moves to the parent row (if there is one).\n\t\t\t\t\t\tconst level = Math.max(\n\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\tactiveRow?.getAttribute( 'aria-level' ) ?? '1',\n\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t) - 1,\n\t\t\t\t\t\t\t1\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst rows = Array.from(\n\t\t\t\t\t\t\ttreeGridElement.querySelectorAll< HTMLElement >(\n\t\t\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet parentRow = activeRow;\n\t\t\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\t\t\tfor ( let i = currentRowIndex; i >= 0; i-- ) {\n\t\t\t\t\t\t\tconst ariaLevel =\n\t\t\t\t\t\t\t\trows[ i ].getAttribute( 'aria-level' );\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tariaLevel !== null &&\n\t\t\t\t\t\t\t\tparseInt( ariaLevel, 10 ) === level\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tparentRow = rows[ i ];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetRowFocusables( parentRow )?.[ 0 ]?.focus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( keyCode === RIGHT ) {\n\t\t\t\t\t\t// Right:\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, expands the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\t\t\t\t\t\t'false'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonExpandRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is expanded, focuses the next cell in the row.\n\t\t\t\t\t\tconst focusableItems = getRowFocusables( activeRow );\n\t\t\t\t\t\tif ( focusableItems.length > 0 ) {\n\t\t\t\t\t\t\tfocusableItems[ nextIndex ]?.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start reading text on continued use of left/right arrow\n\t\t\t\t\t// keys.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.\n\t\t\t\tif ( cannotFocusNextColumn ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfocusablesInRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( ( [ UP, DOWN ] as number[] ).includes( keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll< HTMLElement >(\n\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === UP ) {\n\t\t\t\t\tnextRowIndex = Math.max( 0, currentRowIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = Math.min(\n\t\t\t\t\t\tcurrentRowIndex + 1,\n\t\t\t\t\t\trows.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( ( [ HOME, END ] as number[] ).includes( keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll< HTMLElement >(\n\t\t\t\t\t\t'[role=\"row\"]'\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === HOME ) {\n\t\t\t\t\tnextRowIndex = 0;\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = rows.length - 1;\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ onExpandRow, onCollapseRow, onFocusRow ]\n\t);\n\n\t/* Disable reason: A treegrid is implemented using a table element. */\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<RovingTabIndexContainer>\n\t\t\t{\n\t\t\t\t// Prevent browser mode from triggering in NVDA by wrapping List View\n\t\t\t\t// in a role=application wrapper.\n\t\t\t\t// see: https://github.com/WordPress/gutenberg/issues/43729\n\t\t\t }\n\t\t\t<div role=\"application\" aria-label={ applicationAriaLabel }>\n\t\t\t\t<table\n\t\t\t\t\t{ ...props }\n\t\t\t\t\trole=\"treegrid\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\tref={ ref }\n\t\t\t\t>\n\t\t\t\t\t<tbody>{ children }</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</RovingTabIndexContainer>\n\t);\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\n/**\n * `TreeGrid` is used to create a tree hierarchy.\n * It is not a visually styled component, but instead helps with adding\n * keyboard navigation and roving tab index behaviors to tree grid structures.\n *\n * A tree grid is a hierarchical 2 dimensional UI component, for example it could be\n * used to implement a file system browser.\n *\n * A tree grid allows the user to navigate using arrow keys.\n * Up/down to navigate vertically across rows, and left/right to navigate horizontally\n * between focusables in a row.\n *\n * The `TreeGrid` renders both a `table` and `tbody` element, and is intended to be used\n * with `TreeGridRow` (`tr`) and `TreeGridCell` (`td`) to build out a grid.\n *\n * ```jsx\n * function TreeMenu() {\n * \treturn (\n * \t\t<TreeGrid>\n * \t\t\t<TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t\t<TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t\t<TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onSelect } { ...props }>Select</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t\t<TreeGridCell>\n * \t\t\t\t\t{ ( props ) => (\n * \t\t\t\t\t\t<Button onClick={ onMove } { ...props }>Move</Button>\n * \t\t\t\t\t) }\n * \t\t\t\t</TreeGridCell>\n * \t\t\t</TreeGridRow>\n * \t\t</TreeGrid>\n * \t);\n * }\n * ```\n *\n * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}\n */\nexport const TreeGrid = forwardRef( UnforwardedTreeGrid );\n\nexport default TreeGrid;\nexport { default as TreeGridRow } from './row';\nexport { default as TreeGridCell } from './cell';\nexport { default as TreeGridItem } from './item';\n"]}
@@ -10,7 +10,8 @@ import { forwardRef } from '@wordpress/element';
10
10
  */
11
11
 
12
12
  import RovingTabIndexItem from './roving-tab-index-item';
13
- export default forwardRef(function TreeGridItem(_ref, ref) {
13
+
14
+ function UnforwardedTreeGridItem(_ref, ref) {
14
15
  let {
15
16
  children,
16
17
  ...props
@@ -18,5 +19,16 @@ export default forwardRef(function TreeGridItem(_ref, ref) {
18
19
  return createElement(RovingTabIndexItem, _extends({
19
20
  ref: ref
20
21
  }, props), children);
21
- });
22
+ }
23
+ /**
24
+ * `TreeGridItem` is used to create a tree hierarchy.
25
+ * It is not a visually styled component, but instead helps with adding
26
+ * keyboard navigation and roving tab index behaviors to tree grid structures.
27
+ *
28
+ * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
29
+ */
30
+
31
+
32
+ export const TreeGridItem = forwardRef(UnforwardedTreeGridItem);
33
+ export default TreeGridItem;
22
34
  //# sourceMappingURL=item.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/item.js"],"names":["forwardRef","RovingTabIndexItem","TreeGridItem","ref","children","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AAEA,eAAeD,UAAU,CAAE,SAASE,YAAT,OAE1BC,GAF0B,EAGzB;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAEC;AACD,SACC,cAAC,kBAAD;AAAoB,IAAA,GAAG,EAAGF;AAA1B,KAAqCE,KAArC,GACGD,QADH,CADD;AAKA,CATwB,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexItem from './roving-tab-index-item';\n\nexport default forwardRef( function TreeGridItem(\n\t{ children, ...props },\n\tref\n) {\n\treturn (\n\t\t<RovingTabIndexItem ref={ ref } { ...props }>\n\t\t\t{ children }\n\t\t</RovingTabIndexItem>\n\t);\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/item.tsx"],"names":["forwardRef","RovingTabIndexItem","UnforwardedTreeGridItem","ref","children","props","TreeGridItem"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;;AAGA,SAASC,uBAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAEC;AACD,SACC,cAAC,kBAAD;AAAoB,IAAA,GAAG,EAAGF;AAA1B,KAAqCE,KAArC,GACGD,QADH,CADD;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAME,YAAY,GAAGN,UAAU,CAAEE,uBAAF,CAA/B;AAEP,eAAeI,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexItem from './roving-tab-index-item';\nimport type { RovingTabIndexItemProps } from './types';\n\nfunction UnforwardedTreeGridItem(\n\t{ children, ...props }: RovingTabIndexItemProps,\n\tref: React.ForwardedRef< any >\n) {\n\treturn (\n\t\t<RovingTabIndexItem ref={ ref } { ...props }>\n\t\t\t{ children }\n\t\t</RovingTabIndexItem>\n\t);\n}\n\n/**\n * `TreeGridItem` is used to create a tree hierarchy.\n * It is not a visually styled component, but instead helps with adding\n * keyboard navigation and roving tab index behaviors to tree grid structures.\n *\n * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}\n */\nexport const TreeGridItem = forwardRef( UnforwardedTreeGridItem );\n\nexport default TreeGridItem;\n"]}
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createContext, useContext } from '@wordpress/element';
5
- const RovingTabIndexContext = createContext();
5
+ const RovingTabIndexContext = createContext(undefined);
6
6
  export const useRovingTabIndexContext = () => useContext(RovingTabIndexContext);
7
7
  export const RovingTabIndexProvider = RovingTabIndexContext.Provider;
8
8
  //# sourceMappingURL=roving-tab-index-context.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index-context.js"],"names":["createContext","useContext","RovingTabIndexContext","useRovingTabIndexContext","RovingTabIndexProvider","Provider"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,oBAA1C;AAEA,MAAMC,qBAAqB,GAAGF,aAAa,EAA3C;AACA,OAAO,MAAMG,wBAAwB,GAAG,MACvCF,UAAU,CAAEC,qBAAF,CADJ;AAEP,OAAO,MAAME,sBAAsB,GAAGF,qBAAqB,CAACG,QAArD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nconst RovingTabIndexContext = createContext();\nexport const useRovingTabIndexContext = () =>\n\tuseContext( RovingTabIndexContext );\nexport const RovingTabIndexProvider = RovingTabIndexContext.Provider;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index-context.ts"],"names":["createContext","useContext","RovingTabIndexContext","undefined","useRovingTabIndexContext","RovingTabIndexProvider","Provider"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,oBAA1C;AAEA,MAAMC,qBAAqB,GAAGF,aAAa,CAQxCG,SARwC,CAA3C;AASA,OAAO,MAAMC,wBAAwB,GAAG,MACvCH,UAAU,CAAEC,qBAAF,CADJ;AAEP,OAAO,MAAMG,sBAAsB,GAAGH,qBAAqB,CAACI,QAArD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nconst RovingTabIndexContext = createContext<\n\t| {\n\t\t\tlastFocusedElement: HTMLElement | undefined;\n\t\t\tsetLastFocusedElement: React.Dispatch<\n\t\t\t\tReact.SetStateAction< HTMLElement | undefined >\n\t\t\t>;\n\t }\n\t| undefined\n>( undefined );\nexport const useRovingTabIndexContext = () =>\n\tuseContext( RovingTabIndexContext );\nexport const RovingTabIndexProvider = RovingTabIndexContext.Provider;\n"]}
@@ -9,14 +9,15 @@ import { useRef, forwardRef } from '@wordpress/element';
9
9
  */
10
10
 
11
11
  import { useRovingTabIndexContext } from './roving-tab-index-context';
12
- export default forwardRef(function RovingTabIndexItem(_ref, forwardedRef) {
12
+ export const RovingTabIndexItem = forwardRef(function UnforwardedRovingTabIndexItem(_ref, forwardedRef) {
13
13
  let {
14
14
  children,
15
15
  as: Component,
16
16
  ...props
17
17
  } = _ref;
18
18
  const localRef = useRef();
19
- const ref = forwardedRef || localRef;
19
+ const ref = forwardedRef || localRef; // @ts-expect-error - We actually want to throw an error if this is undefined.
20
+
20
21
  const {
21
22
  lastFocusedElement,
22
23
  setLastFocusedElement
@@ -24,10 +25,14 @@ export default forwardRef(function RovingTabIndexItem(_ref, forwardedRef) {
24
25
  let tabIndex;
25
26
 
26
27
  if (lastFocusedElement) {
27
- tabIndex = lastFocusedElement === ref.current ? 0 : -1;
28
+ tabIndex = lastFocusedElement === ( // TODO: The original implementation simply used `ref.current` here, assuming
29
+ // that a forwarded ref would always be an object, which is not necessarily true.
30
+ // This workaround maintains the original runtime behavior in a type-safe way,
31
+ // but should be revisited.
32
+ 'current' in ref ? ref.current : undefined) ? 0 : -1;
28
33
  }
29
34
 
30
- const onFocus = event => setLastFocusedElement(event.target);
35
+ const onFocus = event => setLastFocusedElement === null || setLastFocusedElement === void 0 ? void 0 : setLastFocusedElement(event.target);
31
36
 
32
37
  const allProps = {
33
38
  ref,
@@ -40,6 +45,8 @@ export default forwardRef(function RovingTabIndexItem(_ref, forwardedRef) {
40
45
  return children(allProps);
41
46
  }
42
47
 
48
+ if (!Component) return null;
43
49
  return createElement(Component, allProps, children);
44
50
  });
51
+ export default RovingTabIndexItem;
45
52
  //# sourceMappingURL=roving-tab-index-item.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index-item.js"],"names":["useRef","forwardRef","useRovingTabIndexContext","RovingTabIndexItem","forwardedRef","children","as","Component","props","localRef","ref","lastFocusedElement","setLastFocusedElement","tabIndex","current","onFocus","event","target","allProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,UAAjB,QAAmC,oBAAnC;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AAEA,eAAeD,UAAU,CAAE,SAASE,kBAAT,OAE1BC,YAF0B,EAGzB;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAE,EAAEC,SAAhB;AAA2B,OAAGC;AAA9B,GAEC;AACD,QAAMC,QAAQ,GAAGT,MAAM,EAAvB;AACA,QAAMU,GAAG,GAAGN,YAAY,IAAIK,QAA5B;AACA,QAAM;AAAEE,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MACLV,wBAAwB,EADzB;AAEA,MAAIW,QAAJ;;AAEA,MAAKF,kBAAL,EAA0B;AACzBE,IAAAA,QAAQ,GAAGF,kBAAkB,KAAKD,GAAG,CAACI,OAA3B,GAAqC,CAArC,GAAyC,CAAC,CAArD;AACA;;AAED,QAAMC,OAAO,GAAKC,KAAF,IAAaJ,qBAAqB,CAAEI,KAAK,CAACC,MAAR,CAAlD;;AACA,QAAMC,QAAQ,GAAG;AAAER,IAAAA,GAAF;AAAOG,IAAAA,QAAP;AAAiBE,IAAAA,OAAjB;AAA0B,OAAGP;AAA7B,GAAjB;;AAEA,MAAK,OAAOH,QAAP,KAAoB,UAAzB,EAAsC;AACrC,WAAOA,QAAQ,CAAEa,QAAF,CAAf;AACA;;AAED,SAAO,cAAC,SAAD,EAAgBA,QAAhB,EAA6Bb,QAA7B,CAAP;AACA,CAtBwB,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useRovingTabIndexContext } from './roving-tab-index-context';\n\nexport default forwardRef( function RovingTabIndexItem(\n\t{ children, as: Component, ...props },\n\tforwardedRef\n) {\n\tconst localRef = useRef();\n\tconst ref = forwardedRef || localRef;\n\tconst { lastFocusedElement, setLastFocusedElement } =\n\t\tuseRovingTabIndexContext();\n\tlet tabIndex;\n\n\tif ( lastFocusedElement ) {\n\t\ttabIndex = lastFocusedElement === ref.current ? 0 : -1;\n\t}\n\n\tconst onFocus = ( event ) => setLastFocusedElement( event.target );\n\tconst allProps = { ref, tabIndex, onFocus, ...props };\n\n\tif ( typeof children === 'function' ) {\n\t\treturn children( allProps );\n\t}\n\n\treturn <Component { ...allProps }>{ children }</Component>;\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index-item.tsx"],"names":["useRef","forwardRef","useRovingTabIndexContext","RovingTabIndexItem","UnforwardedRovingTabIndexItem","forwardedRef","children","as","Component","props","localRef","ref","lastFocusedElement","setLastFocusedElement","tabIndex","current","undefined","onFocus","event","target","allProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,UAAjB,QAAmC,oBAAnC;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AAGA,OAAO,MAAMC,kBAAkB,GAAGF,UAAU,CAC3C,SAASG,6BAAT,OAECC,YAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAE,EAAEC,SAAhB;AAA2B,OAAGC;AAA9B,GAEC;AACD,QAAMC,QAAQ,GAAGV,MAAM,EAAvB;AACA,QAAMW,GAAG,GAAGN,YAAY,IAAIK,QAA5B,CAFC,CAGD;;AACA,QAAM;AAAEE,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MACLX,wBAAwB,EADzB;AAEA,MAAIY,QAAJ;;AAEA,MAAKF,kBAAL,EAA0B;AACzBE,IAAAA,QAAQ,GACPF,kBAAkB,OAClB;AACA;AACA;AACA;AACE,iBAAaD,GAAb,GAAmBA,GAAG,CAACI,OAAvB,GAAiCC,SALjB,CAAlB,GAMG,CANH,GAOG,CAAC,CARL;AASA;;AAED,QAAMC,OAA+C,GAAKC,KAAF,IACvDL,qBADuD,aACvDA,qBADuD,uBACvDA,qBAAqB,CAAIK,KAAK,CAACC,MAAV,CADtB;;AAEA,QAAMC,QAAQ,GAAG;AAAET,IAAAA,GAAF;AAAOG,IAAAA,QAAP;AAAiBG,IAAAA,OAAjB;AAA0B,OAAGR;AAA7B,GAAjB;;AAEA,MAAK,OAAOH,QAAP,KAAoB,UAAzB,EAAsC;AACrC,WAAOA,QAAQ,CAAEc,QAAF,CAAf;AACA;;AAED,MAAK,CAAEZ,SAAP,EAAmB,OAAO,IAAP;AAEnB,SAAO,cAAC,SAAD,EAAgBY,QAAhB,EAA6Bd,QAA7B,CAAP;AACA,CAnC0C,CAArC;AAsCP,eAAeH,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useRovingTabIndexContext } from './roving-tab-index-context';\nimport type { RovingTabIndexItemProps } from './types';\n\nexport const RovingTabIndexItem = forwardRef(\n\tfunction UnforwardedRovingTabIndexItem(\n\t\t{ children, as: Component, ...props }: RovingTabIndexItemProps,\n\t\tforwardedRef: React.ForwardedRef< any >\n\t) {\n\t\tconst localRef = useRef< any >();\n\t\tconst ref = forwardedRef || localRef;\n\t\t// @ts-expect-error - We actually want to throw an error if this is undefined.\n\t\tconst { lastFocusedElement, setLastFocusedElement } =\n\t\t\tuseRovingTabIndexContext();\n\t\tlet tabIndex;\n\n\t\tif ( lastFocusedElement ) {\n\t\t\ttabIndex =\n\t\t\t\tlastFocusedElement ===\n\t\t\t\t// TODO: The original implementation simply used `ref.current` here, assuming\n\t\t\t\t// that a forwarded ref would always be an object, which is not necessarily true.\n\t\t\t\t// This workaround maintains the original runtime behavior in a type-safe way,\n\t\t\t\t// but should be revisited.\n\t\t\t\t( 'current' in ref ? ref.current : undefined )\n\t\t\t\t\t? 0\n\t\t\t\t\t: -1;\n\t\t}\n\n\t\tconst onFocus: React.FocusEventHandler< HTMLElement > = ( event ) =>\n\t\t\tsetLastFocusedElement?.( event.target );\n\t\tconst allProps = { ref, tabIndex, onFocus, ...props };\n\n\t\tif ( typeof children === 'function' ) {\n\t\t\treturn children( allProps );\n\t\t}\n\n\t\tif ( ! Component ) return null;\n\n\t\treturn <Component { ...allProps }>{ children }</Component>;\n\t}\n);\n\nexport default RovingTabIndexItem;\n"]}
@@ -13,9 +13,6 @@ import { RovingTabIndexProvider } from './roving-tab-index-context';
13
13
  * Provider for adding roving tab index behaviors to tree grid structures.
14
14
  *
15
15
  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
16
- *
17
- * @param {Object} props Component props.
18
- * @param {WPElement} props.children Children to be rendered
19
16
  */
20
17
 
21
18
  export default function RovingTabIndex(_ref) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index.js"],"names":["useState","useMemo","RovingTabIndexProvider","RovingTabIndex","children","lastFocusedElement","setLastFocusedElement","providerValue"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,4BAAvC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,cAAT,OAAwC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACtD,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgDN,QAAQ,EAA9D,CADsD,CAGtD;AACA;AACA;;AACA,QAAMO,aAAa,GAAGN,OAAO,CAC5B,OAAQ;AAAEI,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,GAAR,CAD4B,EAE5B,CAAED,kBAAF,CAF4B,CAA7B;AAKA,SACC,cAAC,sBAAD;AAAwB,IAAA,KAAK,EAAGE;AAAhC,KACGH,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { RovingTabIndexProvider } from './roving-tab-index-context';\n\n/**\n * Provider for adding roving tab index behaviors to tree grid structures.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n *\n * @param {Object} props Component props.\n * @param {WPElement} props.children Children to be rendered\n */\nexport default function RovingTabIndex( { children } ) {\n\tconst [ lastFocusedElement, setLastFocusedElement ] = useState();\n\n\t// Use `useMemo` to avoid creation of a new object for the providerValue\n\t// on every render. Only create a new object when the `lastFocusedElement`\n\t// value changes.\n\tconst providerValue = useMemo(\n\t\t() => ( { lastFocusedElement, setLastFocusedElement } ),\n\t\t[ lastFocusedElement ]\n\t);\n\n\treturn (\n\t\t<RovingTabIndexProvider value={ providerValue }>\n\t\t\t{ children }\n\t\t</RovingTabIndexProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index.tsx"],"names":["useState","useMemo","RovingTabIndexProvider","RovingTabIndex","children","lastFocusedElement","setLastFocusedElement","providerValue"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,4BAAvC;AAEA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,cAAT,OAIX;AAAA,MAJoC;AACvCC,IAAAA;AADuC,GAIpC;AACH,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IACLN,QAAQ,EADT,CADG,CAIH;AACA;AACA;;AACA,QAAMO,aAAa,GAAGN,OAAO,CAC5B,OAAQ;AAAEI,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,GAAR,CAD4B,EAE5B,CAAED,kBAAF,CAF4B,CAA7B;AAKA,SACC,cAAC,sBAAD;AAAwB,IAAA,KAAK,EAAGE;AAAhC,KACGH,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { RovingTabIndexProvider } from './roving-tab-index-context';\n\n/**\n * Provider for adding roving tab index behaviors to tree grid structures.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n */\nexport default function RovingTabIndex( {\n\tchildren,\n}: {\n\tchildren: React.ReactNode;\n} ) {\n\tconst [ lastFocusedElement, setLastFocusedElement ] =\n\t\tuseState< HTMLElement >();\n\n\t// Use `useMemo` to avoid creation of a new object for the providerValue\n\t// on every render. Only create a new object when the `lastFocusedElement`\n\t// value changes.\n\tconst providerValue = useMemo(\n\t\t() => ( { lastFocusedElement, setLastFocusedElement } ),\n\t\t[ lastFocusedElement ]\n\t);\n\n\treturn (\n\t\t<RovingTabIndexProvider value={ providerValue }>\n\t\t\t{ children }\n\t\t</RovingTabIndexProvider>\n\t);\n}\n"]}
@@ -5,8 +5,11 @@ import { createElement } from "@wordpress/element";
5
5
  * WordPress dependencies
6
6
  */
7
7
  import { forwardRef } from '@wordpress/element';
8
+ /**
9
+ * Internal dependencies
10
+ */
8
11
 
9
- function TreeGridRow(_ref, ref) {
12
+ function UnforwardedTreeGridRow(_ref, ref) {
10
13
  let {
11
14
  children,
12
15
  level,
@@ -15,22 +18,24 @@ function TreeGridRow(_ref, ref) {
15
18
  isExpanded,
16
19
  ...props
17
20
  } = _ref;
18
- return (// Disable reason: Due to an error in the ARIA 1.1 specification, the
19
- // aria-posinset and aria-setsize properties are not supported on row
20
- // elements. This is being corrected in ARIA 1.2. Consequently, the
21
- // linting rule fails when validating this markup.
22
- //
23
- // eslint-disable-next-line jsx-a11y/role-supports-aria-props
24
- createElement("tr", _extends({}, props, {
25
- ref: ref,
26
- role: "row",
27
- "aria-level": level,
28
- "aria-posinset": positionInSet,
29
- "aria-setsize": setSize,
30
- "aria-expanded": isExpanded
31
- }), children)
32
- );
21
+ return createElement("tr", _extends({}, props, {
22
+ ref: ref,
23
+ role: "row",
24
+ "aria-level": level,
25
+ "aria-posinset": positionInSet,
26
+ "aria-setsize": setSize,
27
+ "aria-expanded": isExpanded
28
+ }), children);
33
29
  }
30
+ /**
31
+ * `TreeGridRow` is used to create a tree hierarchy.
32
+ * It is not a visually styled component, but instead helps with adding
33
+ * keyboard navigation and roving tab index behaviors to tree grid structures.
34
+ *
35
+ * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
36
+ */
37
+
34
38
 
35
- export default forwardRef(TreeGridRow);
39
+ export const TreeGridRow = forwardRef(UnforwardedTreeGridRow);
40
+ export default TreeGridRow;
36
41
  //# sourceMappingURL=row.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/row.js"],"names":["forwardRef","TreeGridRow","ref","children","level","positionInSet","setSize","isExpanded","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;;AAEA,SAASC,WAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,KAAZ;AAAmBC,IAAAA,aAAnB;AAAkCC,IAAAA,OAAlC;AAA2CC,IAAAA,UAA3C;AAAuD,OAAGC;AAA1D,GAEC;AACD,SACC;AACA;AACA;AACA;AACA;AACA;AACA,qCACMA,KADN;AAEC,MAAA,GAAG,EAAGN,GAFP;AAGC,MAAA,IAAI,EAAC,KAHN;AAIC,oBAAaE,KAJd;AAKC,uBAAgBC,aALjB;AAMC,sBAAeC,OANhB;AAOC,uBAAgBC;AAPjB,QASGJ,QATH;AAPD;AAmBA;;AAED,eAAeH,UAAU,CAAEC,WAAF,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\nfunction TreeGridRow(\n\t{ children, level, positionInSet, setSize, isExpanded, ...props },\n\tref\n) {\n\treturn (\n\t\t// Disable reason: Due to an error in the ARIA 1.1 specification, the\n\t\t// aria-posinset and aria-setsize properties are not supported on row\n\t\t// elements. This is being corrected in ARIA 1.2. Consequently, the\n\t\t// linting rule fails when validating this markup.\n\t\t//\n\t\t// eslint-disable-next-line jsx-a11y/role-supports-aria-props\n\t\t<tr\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\trole=\"row\"\n\t\t\taria-level={ level }\n\t\t\taria-posinset={ positionInSet }\n\t\t\taria-setsize={ setSize }\n\t\t\taria-expanded={ isExpanded }\n\t\t>\n\t\t\t{ children }\n\t\t</tr>\n\t);\n}\n\nexport default forwardRef( TreeGridRow );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/row.tsx"],"names":["forwardRef","UnforwardedTreeGridRow","ref","children","level","positionInSet","setSize","isExpanded","props","TreeGridRow"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AAIA,SAASC,sBAAT,OASCC,GATD,EAUE;AAAA,MATD;AACCC,IAAAA,QADD;AAECC,IAAAA,KAFD;AAGCC,IAAAA,aAHD;AAICC,IAAAA,OAJD;AAKCC,IAAAA,UALD;AAMC,OAAGC;AANJ,GASC;AACD,SACC,iCACMA,KADN;AAEC,IAAA,GAAG,EAAGN,GAFP;AAGC,IAAA,IAAI,EAAC,KAHN;AAIC,kBAAaE,KAJd;AAKC,qBAAgBC,aALjB;AAMC,oBAAeC,OANhB;AAOC,qBAAgBC;AAPjB,MASGJ,QATH,CADD;AAaA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMM,WAAW,GAAGT,UAAU,CAAEC,sBAAF,CAA9B;AAEP,eAAeQ,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { TreeGridRowProps } from './types';\n\nfunction UnforwardedTreeGridRow(\n\t{\n\t\tchildren,\n\t\tlevel,\n\t\tpositionInSet,\n\t\tsetSize,\n\t\tisExpanded,\n\t\t...props\n\t}: WordPressComponentProps< TreeGridRowProps, 'tr', false >,\n\tref: React.ForwardedRef< HTMLTableRowElement >\n) {\n\treturn (\n\t\t<tr\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\trole=\"row\"\n\t\t\taria-level={ level }\n\t\t\taria-posinset={ positionInSet }\n\t\t\taria-setsize={ setSize }\n\t\t\taria-expanded={ isExpanded }\n\t\t>\n\t\t\t{ children }\n\t\t</tr>\n\t);\n}\n\n/**\n * `TreeGridRow` is used to create a tree hierarchy.\n * It is not a visually styled component, but instead helps with adding\n * keyboard navigation and roving tab index behaviors to tree grid structures.\n *\n * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}\n */\nexport const TreeGridRow = forwardRef( UnforwardedTreeGridRow );\n\nexport default TreeGridRow;\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map