@wordpress/components 29.0.1-next.a9f418477.0 → 29.1.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 (944) hide show
  1. package/CHANGELOG.md +50 -10
  2. package/LICENSE.md +1 -1
  3. package/build/alignment-matrix-control/icon.js +1 -0
  4. package/build/alignment-matrix-control/icon.js.map +1 -1
  5. package/build/alignment-matrix-control/index.js +1 -0
  6. package/build/alignment-matrix-control/index.js.map +1 -1
  7. package/build/autocomplete/autocompleter-ui.js +1 -0
  8. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  9. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  10. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  11. package/build/autocomplete/get-default-use-items.js +1 -0
  12. package/build/autocomplete/get-default-use-items.js.map +1 -1
  13. package/build/autocomplete/index.js +1 -0
  14. package/build/autocomplete/index.js.map +1 -1
  15. package/build/badge/index.js +64 -0
  16. package/build/badge/index.js.map +1 -0
  17. package/build/badge/types.js +6 -0
  18. package/build/badge/types.js.map +1 -0
  19. package/build/border-box-control/utils.js +1 -0
  20. package/build/border-box-control/utils.js.map +1 -1
  21. package/build/border-control/border-control-dropdown/component.js +1 -0
  22. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  23. package/build/border-control/border-control-style-picker/component.js +1 -0
  24. package/build/border-control/border-control-style-picker/component.js.map +1 -1
  25. package/build/box-control/index.js +18 -14
  26. package/build/box-control/index.js.map +1 -1
  27. package/build/box-control/input-control.js +222 -0
  28. package/build/box-control/input-control.js.map +1 -0
  29. package/build/box-control/types.js.map +1 -1
  30. package/build/box-control/utils.js +101 -48
  31. package/build/box-control/utils.js.map +1 -1
  32. package/build/button/index.native.js +1 -0
  33. package/build/button/index.native.js.map +1 -1
  34. package/build/button/types.js.map +1 -1
  35. package/build/button-group/index.js +10 -0
  36. package/build/button-group/index.js.map +1 -1
  37. package/build/button-group/types.js.map +1 -1
  38. package/build/color-indicator/index.native.js +1 -0
  39. package/build/color-indicator/index.native.js.map +1 -1
  40. package/build/color-palette/index.js +1 -0
  41. package/build/color-palette/index.js.map +1 -1
  42. package/build/color-palette/index.native.js +1 -0
  43. package/build/color-palette/index.native.js.map +1 -1
  44. package/build/color-palette/utils.js +1 -0
  45. package/build/color-palette/utils.js.map +1 -1
  46. package/build/combobox-control/index.js +1 -0
  47. package/build/combobox-control/index.js.map +1 -1
  48. package/build/composite/legacy/index.js +1 -0
  49. package/build/composite/legacy/index.js.map +1 -1
  50. package/build/context/context-connect.js +1 -0
  51. package/build/context/context-connect.js.map +1 -1
  52. package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  53. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  54. package/build/custom-gradient-picker/gradient-bar/index.js +1 -0
  55. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  56. package/build/custom-gradient-picker/gradient-bar/utils.js +1 -0
  57. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  58. package/build/custom-gradient-picker/index.js +1 -0
  59. package/build/custom-gradient-picker/index.js.map +1 -1
  60. package/build/custom-gradient-picker/serializer.js +1 -0
  61. package/build/custom-gradient-picker/serializer.js.map +1 -1
  62. package/build/custom-gradient-picker/utils.js +1 -0
  63. package/build/custom-gradient-picker/utils.js.map +1 -1
  64. package/build/custom-select-control/index.js +2 -3
  65. package/build/custom-select-control/index.js.map +1 -1
  66. package/build/custom-select-control-v2/custom-select.js +2 -3
  67. package/build/custom-select-control-v2/custom-select.js.map +1 -1
  68. package/build/dashicon/index.js +1 -0
  69. package/build/dashicon/index.js.map +1 -1
  70. package/build/date-time/date/index.js +2 -0
  71. package/build/date-time/date/index.js.map +1 -1
  72. package/build/date-time/date/use-lilius/index.js +1 -0
  73. package/build/date-time/date/use-lilius/index.js.map +1 -1
  74. package/build/date-time/time/index.js +1 -0
  75. package/build/date-time/time/index.js.map +1 -1
  76. package/build/dimension-control/index.js +2 -0
  77. package/build/dimension-control/index.js.map +1 -1
  78. package/build/dimension-control/sizes.js +1 -0
  79. package/build/dimension-control/sizes.js.map +1 -1
  80. package/build/draggable/index.js +1 -0
  81. package/build/draggable/index.js.map +1 -1
  82. package/build/draggable/index.native.js +1 -0
  83. package/build/draggable/index.native.js.map +1 -1
  84. package/build/dropdown-menu/index.js +1 -0
  85. package/build/dropdown-menu/index.js.map +1 -1
  86. package/build/dropdown-menu/index.native.js +1 -0
  87. package/build/dropdown-menu/index.native.js.map +1 -1
  88. package/build/duotone-picker/color-list-picker/index.js +1 -0
  89. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  90. package/build/duotone-picker/duotone-picker.js +1 -0
  91. package/build/duotone-picker/duotone-picker.js.map +1 -1
  92. package/build/duotone-picker/utils.js +1 -0
  93. package/build/duotone-picker/utils.js.map +1 -1
  94. package/build/external-link/index.js +1 -0
  95. package/build/external-link/index.js.map +1 -1
  96. package/build/font-size-picker/font-size-picker-select.js +1 -0
  97. package/build/font-size-picker/font-size-picker-select.js.map +1 -1
  98. package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
  99. package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  100. package/build/font-size-picker/index.js +1 -0
  101. package/build/font-size-picker/index.js.map +1 -1
  102. package/build/font-size-picker/index.native.js +1 -0
  103. package/build/font-size-picker/index.native.js.map +1 -1
  104. package/build/font-size-picker/styles.js +9 -9
  105. package/build/font-size-picker/styles.js.map +1 -1
  106. package/build/font-size-picker/utils.js +1 -0
  107. package/build/font-size-picker/utils.js.map +1 -1
  108. package/build/form-token-field/index.js +1 -0
  109. package/build/form-token-field/index.js.map +1 -1
  110. package/build/form-token-field/suggestions-list.js +1 -0
  111. package/build/form-token-field/suggestions-list.js.map +1 -1
  112. package/build/gradient-picker/index.js +1 -0
  113. package/build/gradient-picker/index.js.map +1 -1
  114. package/build/guide/index.js +1 -0
  115. package/build/guide/index.js.map +1 -1
  116. package/build/guide/page-control.js +1 -0
  117. package/build/guide/page-control.js.map +1 -1
  118. package/build/h-stack/hook.js +1 -0
  119. package/build/h-stack/hook.js.map +1 -1
  120. package/build/heading/hook.js +1 -1
  121. package/build/heading/hook.js.map +1 -1
  122. package/build/higher-order/navigate-regions/index.js +1 -0
  123. package/build/higher-order/navigate-regions/index.js.map +1 -1
  124. package/build/higher-order/with-fallback-styles/index.js +1 -0
  125. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  126. package/build/higher-order/with-filters/index.js +1 -0
  127. package/build/higher-order/with-filters/index.js.map +1 -1
  128. package/build/higher-order/with-notices/index.js +1 -0
  129. package/build/higher-order/with-notices/index.js.map +1 -1
  130. package/build/input-control/index.js +9 -0
  131. package/build/input-control/index.js.map +1 -1
  132. package/build/input-control/types.js.map +1 -1
  133. package/build/keyboard-shortcuts/index.js +1 -0
  134. package/build/keyboard-shortcuts/index.js.map +1 -1
  135. package/build/menu/checkbox-item.js +2 -0
  136. package/build/menu/checkbox-item.js.map +1 -1
  137. package/build/menu/index.js +25 -94
  138. package/build/menu/index.js.map +1 -1
  139. package/build/menu/item.js +10 -1
  140. package/build/menu/item.js.map +1 -1
  141. package/build/menu/popover.js +89 -0
  142. package/build/menu/popover.js.map +1 -0
  143. package/build/menu/radio-item.js +2 -0
  144. package/build/menu/radio-item.js.map +1 -1
  145. package/build/menu/styles.js +16 -16
  146. package/build/menu/styles.js.map +1 -1
  147. package/build/menu/submenu-trigger-item.js +58 -0
  148. package/build/menu/submenu-trigger-item.js.map +1 -0
  149. package/build/menu/trigger-button.js +45 -0
  150. package/build/menu/trigger-button.js.map +1 -0
  151. package/build/menu/types.js.map +1 -1
  152. package/build/menu-items-choice/index.js +1 -0
  153. package/build/menu-items-choice/index.js.map +1 -1
  154. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  155. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  156. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  157. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  158. package/build/mobile/bottom-sheet/picker-cell.native.js +1 -0
  159. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  160. package/build/mobile/bottom-sheet-select-control/index.native.js +1 -0
  161. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  162. package/build/mobile/color-settings/palette.screen.native.js +1 -0
  163. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  164. package/build/mobile/gradient/index.native.js +1 -0
  165. package/build/mobile/gradient/index.native.js.map +1 -1
  166. package/build/mobile/media-edit/index.native.js +1 -0
  167. package/build/mobile/media-edit/index.native.js.map +1 -1
  168. package/build/mobile/picker/index.android.js +1 -0
  169. package/build/mobile/picker/index.android.js.map +1 -1
  170. package/build/mobile/picker/index.ios.js +1 -0
  171. package/build/mobile/picker/index.ios.js.map +1 -1
  172. package/build/mobile/segmented-control/index.native.js +1 -0
  173. package/build/mobile/segmented-control/index.native.js.map +1 -1
  174. package/build/mobile/utils/get-px-from-css-unit.native.js +1 -0
  175. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  176. package/build/navigable-container/container.js +1 -0
  177. package/build/navigable-container/container.js.map +1 -1
  178. package/build/navigation/back-button/index.js +1 -0
  179. package/build/navigation/back-button/index.js.map +1 -1
  180. package/build/navigation/group/index.js +1 -0
  181. package/build/navigation/group/index.js.map +1 -1
  182. package/build/navigation/index.js +6 -0
  183. package/build/navigation/index.js.map +1 -1
  184. package/build/navigation/item/index.js +1 -0
  185. package/build/navigation/item/index.js.map +1 -1
  186. package/build/navigation/menu/menu-title-search.js +1 -0
  187. package/build/navigation/menu/menu-title-search.js.map +1 -1
  188. package/build/navigation/menu/search-no-results-found.js +1 -0
  189. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  190. package/build/navigation/styles/navigation-styles.js +12 -12
  191. package/build/navigation/styles/navigation-styles.js.map +1 -1
  192. package/build/navigator/navigator/component.js +1 -0
  193. package/build/navigator/navigator/component.js.map +1 -1
  194. package/build/navigator/navigator-screen/component.js +1 -0
  195. package/build/navigator/navigator-screen/component.js.map +1 -1
  196. package/build/navigator/utils/router.js +1 -0
  197. package/build/navigator/utils/router.js.map +1 -1
  198. package/build/notice/index.js +1 -0
  199. package/build/notice/index.js.map +1 -1
  200. package/build/notice/list.js +1 -0
  201. package/build/notice/list.js.map +1 -1
  202. package/build/notice/list.native.js +1 -0
  203. package/build/notice/list.native.js.map +1 -1
  204. package/build/number-control/index.js +1 -0
  205. package/build/number-control/index.js.map +1 -1
  206. package/build/palette-edit/index.js +2 -0
  207. package/build/palette-edit/index.js.map +1 -1
  208. package/build/panel/actions.native.js +1 -0
  209. package/build/panel/actions.native.js.map +1 -1
  210. package/build/private-apis.js +3 -1
  211. package/build/private-apis.js.map +1 -1
  212. package/build/query-controls/index.js +1 -0
  213. package/build/query-controls/index.js.map +1 -1
  214. package/build/query-controls/terms.js +1 -0
  215. package/build/query-controls/terms.js.map +1 -1
  216. package/build/radio-control/index.js +1 -0
  217. package/build/radio-control/index.js.map +1 -1
  218. package/build/radio-control/index.native.js +1 -0
  219. package/build/radio-control/index.native.js.map +1 -1
  220. package/build/radio-group/index.js +6 -0
  221. package/build/radio-group/index.js.map +1 -1
  222. package/build/radio-group/radio.js +2 -3
  223. package/build/radio-group/radio.js.map +1 -1
  224. package/build/range-control/rail.js +1 -0
  225. package/build/range-control/rail.js.map +1 -1
  226. package/build/range-control/styles/range-control-styles.js +28 -28
  227. package/build/range-control/styles/range-control-styles.js.map +1 -1
  228. package/build/resizable-box/index.js +1 -0
  229. package/build/resizable-box/index.js.map +1 -1
  230. package/build/sandbox/index.js +1 -0
  231. package/build/sandbox/index.js.map +1 -1
  232. package/build/sandbox/index.native.js +1 -0
  233. package/build/sandbox/index.native.js.map +1 -1
  234. package/build/search-control/index.native.js +1 -0
  235. package/build/search-control/index.native.js.map +1 -1
  236. package/build/select-control/index.js +10 -0
  237. package/build/select-control/index.js.map +1 -1
  238. package/build/select-control/types.js.map +1 -1
  239. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
  240. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  241. package/build/slot-fill/context.js +4 -3
  242. package/build/slot-fill/context.js.map +1 -1
  243. package/build/slot-fill/fill.js +10 -15
  244. package/build/slot-fill/fill.js.map +1 -1
  245. package/build/slot-fill/provider.js +42 -55
  246. package/build/slot-fill/provider.js.map +1 -1
  247. package/build/slot-fill/slot.js +32 -23
  248. package/build/slot-fill/slot.js.map +1 -1
  249. package/build/slot-fill/types.js.map +1 -1
  250. package/build/snackbar/index.js +1 -0
  251. package/build/snackbar/index.js.map +1 -1
  252. package/build/snackbar/list.js +1 -0
  253. package/build/snackbar/list.js.map +1 -1
  254. package/build/tab-panel/index.js +3 -3
  255. package/build/tab-panel/index.js.map +1 -1
  256. package/build/tabs/index.js +22 -4
  257. package/build/tabs/index.js.map +1 -1
  258. package/build/tabs/types.js.map +1 -1
  259. package/build/text/hook.js +6 -6
  260. package/build/text/hook.js.map +1 -1
  261. package/build/text/styles.js +7 -7
  262. package/build/text/styles.js.map +1 -1
  263. package/build/text/utils.js +1 -0
  264. package/build/text/utils.js.map +1 -1
  265. package/build/theme/color-algorithms.js +1 -0
  266. package/build/theme/color-algorithms.js.map +1 -1
  267. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +2 -3
  268. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  269. package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
  270. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  271. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  272. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  273. package/build/toolbar/toolbar-group/index.js +1 -0
  274. package/build/toolbar/toolbar-group/index.js.map +1 -1
  275. package/build/tools-panel/tools-panel/hook.js +1 -0
  276. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  277. package/build/tools-panel/tools-panel-header/component.js +1 -0
  278. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  279. package/build/tooltip/index.js +2 -3
  280. package/build/tooltip/index.js.map +1 -1
  281. package/build/tree-grid/index.js +1 -0
  282. package/build/tree-grid/index.js.map +1 -1
  283. package/build/tree-select/index.js +11 -2
  284. package/build/tree-select/index.js.map +1 -1
  285. package/build/tree-select/types.js.map +1 -1
  286. package/build/unit-control/index.js +1 -0
  287. package/build/unit-control/index.js.map +1 -1
  288. package/build/unit-control/index.native.js +1 -0
  289. package/build/unit-control/index.native.js.map +1 -1
  290. package/build/unit-control/unit-select-control.js +1 -0
  291. package/build/unit-control/unit-select-control.js.map +1 -1
  292. package/build/unit-control/utils.js +1 -0
  293. package/build/unit-control/utils.js.map +1 -1
  294. package/build/utils/colors-values.js +3 -0
  295. package/build/utils/colors-values.js.map +1 -1
  296. package/build/utils/config-values.js +0 -1
  297. package/build/utils/config-values.js.map +1 -1
  298. package/build/utils/get-valid-children.js +1 -0
  299. package/build/utils/get-valid-children.js.map +1 -1
  300. package/build/utils/hooks/use-animated-offset-rect.js +1 -0
  301. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
  302. package/build/utils/hooks/use-cx.js +1 -0
  303. package/build/utils/hooks/use-cx.js.map +1 -1
  304. package/build/utils/math.js +1 -0
  305. package/build/utils/math.js.map +1 -1
  306. package/build/utils/rtl.js +1 -0
  307. package/build/utils/rtl.js.map +1 -1
  308. package/build/utils/values.js +1 -0
  309. package/build/utils/values.js.map +1 -1
  310. package/build/z-stack/component.js +1 -0
  311. package/build/z-stack/component.js.map +1 -1
  312. package/build-module/alignment-matrix-control/icon.js +1 -0
  313. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  314. package/build-module/alignment-matrix-control/index.js +1 -0
  315. package/build-module/alignment-matrix-control/index.js.map +1 -1
  316. package/build-module/autocomplete/autocompleter-ui.js +1 -0
  317. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  318. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  319. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  320. package/build-module/autocomplete/get-default-use-items.js +1 -0
  321. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  322. package/build-module/autocomplete/index.js +1 -0
  323. package/build-module/autocomplete/index.js.map +1 -1
  324. package/build-module/badge/index.js +57 -0
  325. package/build-module/badge/index.js.map +1 -0
  326. package/build-module/badge/types.js +2 -0
  327. package/build-module/badge/types.js.map +1 -0
  328. package/build-module/border-box-control/utils.js +1 -0
  329. package/build-module/border-box-control/utils.js.map +1 -1
  330. package/build-module/border-control/border-control-dropdown/component.js +1 -0
  331. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  332. package/build-module/border-control/border-control-style-picker/component.js +1 -0
  333. package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
  334. package/build-module/box-control/index.js +20 -16
  335. package/build-module/box-control/index.js.map +1 -1
  336. package/build-module/box-control/input-control.js +214 -0
  337. package/build-module/box-control/input-control.js.map +1 -0
  338. package/build-module/box-control/types.js.map +1 -1
  339. package/build-module/box-control/utils.js +95 -46
  340. package/build-module/box-control/utils.js.map +1 -1
  341. package/build-module/button/index.native.js +1 -0
  342. package/build-module/button/index.native.js.map +1 -1
  343. package/build-module/button/types.js.map +1 -1
  344. package/build-module/button-group/index.js +10 -0
  345. package/build-module/button-group/index.js.map +1 -1
  346. package/build-module/button-group/types.js.map +1 -1
  347. package/build-module/color-indicator/index.native.js +1 -0
  348. package/build-module/color-indicator/index.native.js.map +1 -1
  349. package/build-module/color-palette/index.js +1 -0
  350. package/build-module/color-palette/index.js.map +1 -1
  351. package/build-module/color-palette/index.native.js +1 -0
  352. package/build-module/color-palette/index.native.js.map +1 -1
  353. package/build-module/color-palette/utils.js +1 -0
  354. package/build-module/color-palette/utils.js.map +1 -1
  355. package/build-module/combobox-control/index.js +1 -0
  356. package/build-module/combobox-control/index.js.map +1 -1
  357. package/build-module/composite/legacy/index.js +1 -0
  358. package/build-module/composite/legacy/index.js.map +1 -1
  359. package/build-module/context/context-connect.js +1 -0
  360. package/build-module/context/context-connect.js.map +1 -1
  361. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  362. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  363. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
  364. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  365. package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -0
  366. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  367. package/build-module/custom-gradient-picker/index.js +1 -0
  368. package/build-module/custom-gradient-picker/index.js.map +1 -1
  369. package/build-module/custom-gradient-picker/serializer.js +1 -0
  370. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  371. package/build-module/custom-gradient-picker/utils.js +1 -0
  372. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  373. package/build-module/custom-select-control/index.js +2 -3
  374. package/build-module/custom-select-control/index.js.map +1 -1
  375. package/build-module/custom-select-control-v2/custom-select.js +1 -2
  376. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  377. package/build-module/dashicon/index.js +1 -0
  378. package/build-module/dashicon/index.js.map +1 -1
  379. package/build-module/date-time/date/index.js +2 -0
  380. package/build-module/date-time/date/index.js.map +1 -1
  381. package/build-module/date-time/date/use-lilius/index.js +1 -0
  382. package/build-module/date-time/date/use-lilius/index.js.map +1 -1
  383. package/build-module/date-time/time/index.js +1 -0
  384. package/build-module/date-time/time/index.js.map +1 -1
  385. package/build-module/dimension-control/index.js +2 -0
  386. package/build-module/dimension-control/index.js.map +1 -1
  387. package/build-module/dimension-control/sizes.js +1 -0
  388. package/build-module/dimension-control/sizes.js.map +1 -1
  389. package/build-module/draggable/index.js +1 -0
  390. package/build-module/draggable/index.js.map +1 -1
  391. package/build-module/draggable/index.native.js +1 -0
  392. package/build-module/draggable/index.native.js.map +1 -1
  393. package/build-module/dropdown-menu/index.js +1 -0
  394. package/build-module/dropdown-menu/index.js.map +1 -1
  395. package/build-module/dropdown-menu/index.native.js +1 -0
  396. package/build-module/dropdown-menu/index.native.js.map +1 -1
  397. package/build-module/duotone-picker/color-list-picker/index.js +1 -0
  398. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  399. package/build-module/duotone-picker/duotone-picker.js +1 -0
  400. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  401. package/build-module/duotone-picker/utils.js +1 -0
  402. package/build-module/duotone-picker/utils.js.map +1 -1
  403. package/build-module/external-link/index.js +1 -0
  404. package/build-module/external-link/index.js.map +1 -1
  405. package/build-module/font-size-picker/font-size-picker-select.js +1 -0
  406. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
  407. package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
  408. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  409. package/build-module/font-size-picker/index.js +1 -0
  410. package/build-module/font-size-picker/index.js.map +1 -1
  411. package/build-module/font-size-picker/index.native.js +1 -0
  412. package/build-module/font-size-picker/index.native.js.map +1 -1
  413. package/build-module/font-size-picker/styles.js +9 -9
  414. package/build-module/font-size-picker/styles.js.map +1 -1
  415. package/build-module/font-size-picker/utils.js +1 -0
  416. package/build-module/font-size-picker/utils.js.map +1 -1
  417. package/build-module/form-token-field/index.js +1 -0
  418. package/build-module/form-token-field/index.js.map +1 -1
  419. package/build-module/form-token-field/suggestions-list.js +1 -0
  420. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  421. package/build-module/gradient-picker/index.js +1 -0
  422. package/build-module/gradient-picker/index.js.map +1 -1
  423. package/build-module/guide/index.js +1 -0
  424. package/build-module/guide/index.js.map +1 -1
  425. package/build-module/guide/page-control.js +1 -0
  426. package/build-module/guide/page-control.js.map +1 -1
  427. package/build-module/h-stack/hook.js +1 -0
  428. package/build-module/h-stack/hook.js.map +1 -1
  429. package/build-module/heading/hook.js +1 -1
  430. package/build-module/heading/hook.js.map +1 -1
  431. package/build-module/higher-order/navigate-regions/index.js +1 -0
  432. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  433. package/build-module/higher-order/with-fallback-styles/index.js +1 -0
  434. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  435. package/build-module/higher-order/with-filters/index.js +1 -0
  436. package/build-module/higher-order/with-filters/index.js.map +1 -1
  437. package/build-module/higher-order/with-notices/index.js +1 -0
  438. package/build-module/higher-order/with-notices/index.js.map +1 -1
  439. package/build-module/input-control/index.js +9 -0
  440. package/build-module/input-control/index.js.map +1 -1
  441. package/build-module/input-control/types.js.map +1 -1
  442. package/build-module/keyboard-shortcuts/index.js +1 -0
  443. package/build-module/keyboard-shortcuts/index.js.map +1 -1
  444. package/build-module/menu/checkbox-item.js +2 -0
  445. package/build-module/menu/checkbox-item.js.map +1 -1
  446. package/build-module/menu/index.js +28 -97
  447. package/build-module/menu/index.js.map +1 -1
  448. package/build-module/menu/item.js +10 -1
  449. package/build-module/menu/item.js.map +1 -1
  450. package/build-module/menu/popover.js +81 -0
  451. package/build-module/menu/popover.js.map +1 -0
  452. package/build-module/menu/radio-item.js +2 -0
  453. package/build-module/menu/radio-item.js.map +1 -1
  454. package/build-module/menu/styles.js +16 -16
  455. package/build-module/menu/styles.js.map +1 -1
  456. package/build-module/menu/submenu-trigger-item.js +50 -0
  457. package/build-module/menu/submenu-trigger-item.js.map +1 -0
  458. package/build-module/menu/trigger-button.js +37 -0
  459. package/build-module/menu/trigger-button.js.map +1 -0
  460. package/build-module/menu/types.js.map +1 -1
  461. package/build-module/menu-items-choice/index.js +1 -0
  462. package/build-module/menu-items-choice/index.js.map +1 -1
  463. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  464. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  465. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  466. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  467. package/build-module/mobile/bottom-sheet/picker-cell.native.js +1 -0
  468. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  469. package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -0
  470. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  471. package/build-module/mobile/color-settings/palette.screen.native.js +1 -0
  472. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  473. package/build-module/mobile/gradient/index.native.js +1 -0
  474. package/build-module/mobile/gradient/index.native.js.map +1 -1
  475. package/build-module/mobile/media-edit/index.native.js +1 -0
  476. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  477. package/build-module/mobile/picker/index.android.js +1 -0
  478. package/build-module/mobile/picker/index.android.js.map +1 -1
  479. package/build-module/mobile/picker/index.ios.js +1 -0
  480. package/build-module/mobile/picker/index.ios.js.map +1 -1
  481. package/build-module/mobile/segmented-control/index.native.js +1 -0
  482. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  483. package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -0
  484. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  485. package/build-module/navigable-container/container.js +1 -0
  486. package/build-module/navigable-container/container.js.map +1 -1
  487. package/build-module/navigation/back-button/index.js +1 -0
  488. package/build-module/navigation/back-button/index.js.map +1 -1
  489. package/build-module/navigation/group/index.js +1 -0
  490. package/build-module/navigation/group/index.js.map +1 -1
  491. package/build-module/navigation/index.js +6 -0
  492. package/build-module/navigation/index.js.map +1 -1
  493. package/build-module/navigation/item/index.js +1 -0
  494. package/build-module/navigation/item/index.js.map +1 -1
  495. package/build-module/navigation/menu/menu-title-search.js +1 -0
  496. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  497. package/build-module/navigation/menu/search-no-results-found.js +1 -0
  498. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  499. package/build-module/navigation/styles/navigation-styles.js +12 -12
  500. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  501. package/build-module/navigator/navigator/component.js +1 -0
  502. package/build-module/navigator/navigator/component.js.map +1 -1
  503. package/build-module/navigator/navigator-screen/component.js +1 -0
  504. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  505. package/build-module/navigator/utils/router.js +1 -0
  506. package/build-module/navigator/utils/router.js.map +1 -1
  507. package/build-module/notice/index.js +1 -0
  508. package/build-module/notice/index.js.map +1 -1
  509. package/build-module/notice/list.js +1 -0
  510. package/build-module/notice/list.js.map +1 -1
  511. package/build-module/notice/list.native.js +1 -0
  512. package/build-module/notice/list.native.js.map +1 -1
  513. package/build-module/number-control/index.js +1 -0
  514. package/build-module/number-control/index.js.map +1 -1
  515. package/build-module/palette-edit/index.js +2 -0
  516. package/build-module/palette-edit/index.js.map +1 -1
  517. package/build-module/panel/actions.native.js +1 -0
  518. package/build-module/panel/actions.native.js.map +1 -1
  519. package/build-module/private-apis.js +3 -1
  520. package/build-module/private-apis.js.map +1 -1
  521. package/build-module/query-controls/index.js +1 -0
  522. package/build-module/query-controls/index.js.map +1 -1
  523. package/build-module/query-controls/terms.js +1 -0
  524. package/build-module/query-controls/terms.js.map +1 -1
  525. package/build-module/radio-control/index.js +1 -0
  526. package/build-module/radio-control/index.js.map +1 -1
  527. package/build-module/radio-control/index.native.js +1 -0
  528. package/build-module/radio-control/index.native.js.map +1 -1
  529. package/build-module/radio-group/index.js +6 -0
  530. package/build-module/radio-group/index.js.map +1 -1
  531. package/build-module/radio-group/radio.js +1 -2
  532. package/build-module/radio-group/radio.js.map +1 -1
  533. package/build-module/range-control/rail.js +1 -0
  534. package/build-module/range-control/rail.js.map +1 -1
  535. package/build-module/range-control/styles/range-control-styles.js +28 -28
  536. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  537. package/build-module/resizable-box/index.js +1 -0
  538. package/build-module/resizable-box/index.js.map +1 -1
  539. package/build-module/sandbox/index.js +1 -0
  540. package/build-module/sandbox/index.js.map +1 -1
  541. package/build-module/sandbox/index.native.js +1 -0
  542. package/build-module/sandbox/index.native.js.map +1 -1
  543. package/build-module/search-control/index.native.js +1 -0
  544. package/build-module/search-control/index.native.js.map +1 -1
  545. package/build-module/select-control/index.js +10 -0
  546. package/build-module/select-control/index.js.map +1 -1
  547. package/build-module/select-control/types.js.map +1 -1
  548. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
  549. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  550. package/build-module/slot-fill/context.js +5 -3
  551. package/build-module/slot-fill/context.js.map +1 -1
  552. package/build-module/slot-fill/fill.js +10 -15
  553. package/build-module/slot-fill/fill.js.map +1 -1
  554. package/build-module/slot-fill/provider.js +42 -55
  555. package/build-module/slot-fill/provider.js.map +1 -1
  556. package/build-module/slot-fill/slot.js +33 -24
  557. package/build-module/slot-fill/slot.js.map +1 -1
  558. package/build-module/slot-fill/types.js.map +1 -1
  559. package/build-module/snackbar/index.js +1 -0
  560. package/build-module/snackbar/index.js.map +1 -1
  561. package/build-module/snackbar/list.js +1 -0
  562. package/build-module/snackbar/list.js.map +1 -1
  563. package/build-module/tab-panel/index.js +2 -2
  564. package/build-module/tab-panel/index.js.map +1 -1
  565. package/build-module/tabs/index.js +22 -4
  566. package/build-module/tabs/index.js.map +1 -1
  567. package/build-module/tabs/types.js.map +1 -1
  568. package/build-module/text/hook.js +6 -6
  569. package/build-module/text/hook.js.map +1 -1
  570. package/build-module/text/styles.js +7 -7
  571. package/build-module/text/styles.js.map +1 -1
  572. package/build-module/text/utils.js +1 -0
  573. package/build-module/text/utils.js.map +1 -1
  574. package/build-module/theme/color-algorithms.js +1 -0
  575. package/build-module/theme/color-algorithms.js.map +1 -1
  576. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +1 -2
  577. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  578. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
  579. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  580. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  581. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  582. package/build-module/toolbar/toolbar-group/index.js +1 -0
  583. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  584. package/build-module/tools-panel/tools-panel/hook.js +1 -0
  585. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  586. package/build-module/tools-panel/tools-panel-header/component.js +1 -0
  587. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  588. package/build-module/tooltip/index.js +1 -2
  589. package/build-module/tooltip/index.js.map +1 -1
  590. package/build-module/tree-grid/index.js +1 -0
  591. package/build-module/tree-grid/index.js.map +1 -1
  592. package/build-module/tree-select/index.js +11 -2
  593. package/build-module/tree-select/index.js.map +1 -1
  594. package/build-module/tree-select/types.js.map +1 -1
  595. package/build-module/unit-control/index.js +1 -0
  596. package/build-module/unit-control/index.js.map +1 -1
  597. package/build-module/unit-control/index.native.js +1 -0
  598. package/build-module/unit-control/index.native.js.map +1 -1
  599. package/build-module/unit-control/unit-select-control.js +1 -0
  600. package/build-module/unit-control/unit-select-control.js.map +1 -1
  601. package/build-module/unit-control/utils.js +1 -0
  602. package/build-module/unit-control/utils.js.map +1 -1
  603. package/build-module/utils/colors-values.js +3 -0
  604. package/build-module/utils/colors-values.js.map +1 -1
  605. package/build-module/utils/config-values.js +0 -1
  606. package/build-module/utils/config-values.js.map +1 -1
  607. package/build-module/utils/get-valid-children.js +1 -0
  608. package/build-module/utils/get-valid-children.js.map +1 -1
  609. package/build-module/utils/hooks/use-animated-offset-rect.js +1 -0
  610. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
  611. package/build-module/utils/hooks/use-cx.js +1 -0
  612. package/build-module/utils/hooks/use-cx.js.map +1 -1
  613. package/build-module/utils/math.js +1 -0
  614. package/build-module/utils/math.js.map +1 -1
  615. package/build-module/utils/rtl.js +1 -0
  616. package/build-module/utils/rtl.js.map +1 -1
  617. package/build-module/utils/values.js +1 -0
  618. package/build-module/utils/values.js.map +1 -1
  619. package/build-module/z-stack/component.js +1 -0
  620. package/build-module/z-stack/component.js.map +1 -1
  621. package/build-style/style-rtl.css +60 -13
  622. package/build-style/style.css +60 -13
  623. package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
  624. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  625. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  626. package/build-types/animate/stories/index.story.d.ts +7 -7
  627. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  628. package/build-types/badge/index.d.ts +8 -0
  629. package/build-types/badge/index.d.ts.map +1 -0
  630. package/build-types/badge/stories/index.story.d.ts +17 -0
  631. package/build-types/badge/stories/index.story.d.ts.map +1 -0
  632. package/build-types/badge/test/index.d.ts +2 -0
  633. package/build-types/badge/test/index.d.ts.map +1 -0
  634. package/build-types/badge/types.d.ts +13 -0
  635. package/build-types/badge/types.d.ts.map +1 -0
  636. package/build-types/base-control/stories/index.story.d.ts +1 -1
  637. package/build-types/border-box-control/stories/index.story.d.ts +1 -1
  638. package/build-types/border-control/stories/index.story.d.ts +5 -5
  639. package/build-types/box-control/index.d.ts +1 -1
  640. package/build-types/box-control/index.d.ts.map +1 -1
  641. package/build-types/box-control/input-control.d.ts +3 -0
  642. package/build-types/box-control/input-control.d.ts.map +1 -0
  643. package/build-types/box-control/stories/index.story.d.ts +356 -11
  644. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  645. package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
  646. package/build-types/box-control/types.d.ts +26 -1
  647. package/build-types/box-control/types.d.ts.map +1 -1
  648. package/build-types/box-control/utils.d.ts +49 -15
  649. package/build-types/box-control/utils.d.ts.map +1 -1
  650. package/build-types/button/stories/e2e/index.story.d.ts +1 -1
  651. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  652. package/build-types/button/stories/index.story.d.ts +25 -7
  653. package/build-types/button/stories/index.story.d.ts.map +1 -1
  654. package/build-types/button/types.d.ts +6 -4
  655. package/build-types/button/types.d.ts.map +1 -1
  656. package/build-types/button-group/index.d.ts +3 -1
  657. package/build-types/button-group/index.d.ts.map +1 -1
  658. package/build-types/button-group/stories/index.story.d.ts +6 -0
  659. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  660. package/build-types/button-group/types.d.ts +7 -0
  661. package/build-types/button-group/types.d.ts.map +1 -1
  662. package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
  663. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  664. package/build-types/color-palette/stories/index.story.d.ts +3 -3
  665. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  666. package/build-types/color-picker/styles.d.ts +2 -2
  667. package/build-types/color-picker/styles.d.ts.map +1 -1
  668. package/build-types/combobox-control/stories/index.story.d.ts +4 -4
  669. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  670. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  671. package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
  672. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  673. package/build-types/custom-select-control/stories/index.story.d.ts +3 -3
  674. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  675. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  676. package/build-types/custom-select-control-v2/stories/index.story.d.ts +3 -3
  677. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  678. package/build-types/date-time/date/index.d.ts.map +1 -1
  679. package/build-types/date-time/stories/time.story.d.ts +1 -1
  680. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  681. package/build-types/date-time/time/styles.d.ts +4 -4
  682. package/build-types/dimension-control/index.d.ts.map +1 -1
  683. package/build-types/dimension-control/stories/index.story.d.ts +1 -1
  684. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  685. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  686. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  687. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
  688. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
  689. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
  690. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
  691. package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
  692. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  693. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  694. package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
  695. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  696. package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
  697. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  698. package/build-types/guide/stories/index.story.d.ts +1 -1
  699. package/build-types/guide/stories/index.story.d.ts.map +1 -1
  700. package/build-types/icon/stories/index.story.d.ts +4 -4
  701. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  702. package/build-types/input-control/index.d.ts +1 -0
  703. package/build-types/input-control/index.d.ts.map +1 -1
  704. package/build-types/input-control/stories/index.story.d.ts +7 -7
  705. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  706. package/build-types/input-control/types.d.ts +11 -2
  707. package/build-types/input-control/types.d.ts.map +1 -1
  708. package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
  709. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  710. package/build-types/menu/checkbox-item.d.ts.map +1 -1
  711. package/build-types/menu/index.d.ts +10 -1
  712. package/build-types/menu/index.d.ts.map +1 -1
  713. package/build-types/menu/item.d.ts.map +1 -1
  714. package/build-types/menu/popover.d.ts +3 -0
  715. package/build-types/menu/popover.d.ts.map +1 -0
  716. package/build-types/menu/radio-item.d.ts.map +1 -1
  717. package/build-types/menu/stories/index.story.d.ts +9 -9
  718. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  719. package/build-types/menu/submenu-trigger-item.d.ts +3 -0
  720. package/build-types/menu/submenu-trigger-item.d.ts.map +1 -0
  721. package/build-types/menu/trigger-button.d.ts +3 -0
  722. package/build-types/menu/trigger-button.d.ts.map +1 -0
  723. package/build-types/menu/types.d.ts +208 -57
  724. package/build-types/menu/types.d.ts.map +1 -1
  725. package/build-types/menu-group/stories/index.story.d.ts +1 -1
  726. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  727. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  728. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  729. package/build-types/navigation/back-button/index.d.ts.map +1 -1
  730. package/build-types/navigation/index.d.ts.map +1 -1
  731. package/build-types/navigation/item/index.d.ts.map +1 -1
  732. package/build-types/navigation/stories/index.story.d.ts +6 -6
  733. package/build-types/navigation/stories/index.story.d.ts.map +1 -1
  734. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  735. package/build-types/notice/stories/index.story.d.ts +4 -4
  736. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  737. package/build-types/number-control/index.d.ts +1 -1
  738. package/build-types/number-control/index.d.ts.map +1 -1
  739. package/build-types/number-control/stories/index.story.d.ts +2 -2
  740. package/build-types/palette-edit/index.d.ts.map +1 -1
  741. package/build-types/palette-edit/stories/index.story.d.ts +2 -2
  742. package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
  743. package/build-types/private-apis.d.ts.map +1 -1
  744. package/build-types/progress-bar/stories/index.story.d.ts +1 -1
  745. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  746. package/build-types/query-controls/stories/index.story.d.ts +1 -1
  747. package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
  748. package/build-types/radio-group/index.d.ts.map +1 -1
  749. package/build-types/radio-group/radio.d.ts.map +1 -1
  750. package/build-types/range-control/index.d.ts +1 -1
  751. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  752. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  753. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  754. package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
  755. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  756. package/build-types/sandbox/stories/index.story.d.ts +1 -1
  757. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  758. package/build-types/search-control/stories/index.story.d.ts +1 -1
  759. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  760. package/build-types/select-control/index.d.ts +1 -0
  761. package/build-types/select-control/index.d.ts.map +1 -1
  762. package/build-types/select-control/stories/index.story.d.ts +5 -5
  763. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  764. package/build-types/select-control/types.d.ts +1 -1
  765. package/build-types/select-control/types.d.ts.map +1 -1
  766. package/build-types/shortcut/stories/index.story.d.ts +1 -1
  767. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  768. package/build-types/slot-fill/context.d.ts.map +1 -1
  769. package/build-types/slot-fill/fill.d.ts.map +1 -1
  770. package/build-types/slot-fill/provider.d.ts.map +1 -1
  771. package/build-types/slot-fill/slot.d.ts.map +1 -1
  772. package/build-types/slot-fill/types.d.ts +13 -11
  773. package/build-types/slot-fill/types.d.ts.map +1 -1
  774. package/build-types/tab-panel/index.d.ts.map +1 -1
  775. package/build-types/tab-panel/stories/index.story.d.ts +4 -4
  776. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  777. package/build-types/tabs/index.d.ts +21 -4
  778. package/build-types/tabs/index.d.ts.map +1 -1
  779. package/build-types/tabs/stories/index.story.d.ts +10 -10
  780. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  781. package/build-types/tabs/types.d.ts +13 -13
  782. package/build-types/tabs/types.d.ts.map +1 -1
  783. package/build-types/text/stories/index.story.d.ts +3 -3
  784. package/build-types/theme/stories/index.story.d.ts +1 -1
  785. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  786. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  787. package/build-types/toolbar/stories/index.story.d.ts +3 -3
  788. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  789. package/build-types/tooltip/index.d.ts.map +1 -1
  790. package/build-types/tooltip/stories/index.story.d.ts +1 -1
  791. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  792. package/build-types/tree-grid/stories/index.story.d.ts +1 -1
  793. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  794. package/build-types/tree-select/index.d.ts +3 -2
  795. package/build-types/tree-select/index.d.ts.map +1 -1
  796. package/build-types/tree-select/stories/index.story.d.ts +1 -1
  797. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  798. package/build-types/tree-select/types.d.ts +5 -1
  799. package/build-types/tree-select/types.d.ts.map +1 -1
  800. package/build-types/unit-control/index.d.ts +1 -1
  801. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  802. package/build-types/utils/colors-values.d.ts +3 -0
  803. package/build-types/utils/colors-values.d.ts.map +1 -1
  804. package/build-types/utils/config-values.d.ts +0 -1
  805. package/build-types/v-stack/stories/index.story.d.ts +1 -1
  806. package/package.json +19 -19
  807. package/src/alignment-matrix-control/README.md +16 -15
  808. package/src/angle-picker-control/README.md +10 -9
  809. package/src/badge/README.md +24 -0
  810. package/src/badge/docs-manifest.json +5 -0
  811. package/src/badge/index.tsx +67 -0
  812. package/src/badge/stories/index.story.tsx +54 -0
  813. package/src/badge/styles.scss +49 -0
  814. package/src/badge/test/index.tsx +45 -0
  815. package/src/badge/types.ts +12 -0
  816. package/src/base-control/README.md +22 -21
  817. package/src/box-control/README.md +41 -24
  818. package/src/box-control/index.tsx +28 -14
  819. package/src/box-control/input-control.tsx +299 -0
  820. package/src/box-control/stories/index.story.tsx +12 -0
  821. package/src/box-control/types.ts +27 -1
  822. package/src/box-control/utils.ts +122 -60
  823. package/src/button/README.md +110 -220
  824. package/src/button/docs-manifest.json +5 -0
  825. package/src/button/stories/best-practices.mdx +31 -0
  826. package/src/button/stories/index.story.tsx +18 -0
  827. package/src/button/style.scss +9 -10
  828. package/src/button/test/index.tsx +9 -2
  829. package/src/button/types.ts +6 -4
  830. package/src/button-group/README.md +4 -0
  831. package/src/button-group/index.tsx +11 -1
  832. package/src/button-group/stories/index.story.tsx +8 -1
  833. package/src/button-group/types.ts +7 -0
  834. package/src/custom-select-control/index.tsx +1 -1
  835. package/src/custom-select-control-v2/custom-select.tsx +1 -2
  836. package/src/custom-select-control-v2/stories/index.story.tsx +4 -0
  837. package/src/date-time/date/index.tsx +1 -0
  838. package/src/dimension-control/index.tsx +1 -0
  839. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  840. package/src/disabled/stories/index.story.tsx +1 -0
  841. package/src/drop-zone/stories/index.story.tsx +7 -1
  842. package/src/font-size-picker/styles.ts +1 -0
  843. package/src/form-file-upload/README.md +22 -21
  844. package/src/gradient-picker/README.md +36 -35
  845. package/src/heading/hook.ts +1 -1
  846. package/src/heading/test/__snapshots__/index.tsx.snap +4 -4
  847. package/src/icon/README.md +9 -8
  848. package/src/input-control/README.md +1 -0
  849. package/src/input-control/index.tsx +10 -0
  850. package/src/input-control/stories/index.story.tsx +6 -1
  851. package/src/input-control/test/index.js +9 -3
  852. package/src/input-control/types.ts +11 -2
  853. package/src/menu/checkbox-item.tsx +2 -1
  854. package/src/menu/index.tsx +61 -165
  855. package/src/menu/item.tsx +17 -2
  856. package/src/menu/popover.tsx +103 -0
  857. package/src/menu/radio-item.tsx +2 -1
  858. package/src/menu/stories/index.story.tsx +533 -381
  859. package/src/menu/styles.ts +1 -1
  860. package/src/menu/submenu-trigger-item.tsx +61 -0
  861. package/src/menu/test/index.tsx +266 -182
  862. package/src/menu/trigger-button.tsx +46 -0
  863. package/src/menu/types.ts +210 -63
  864. package/src/modal/stories/index.story.tsx +4 -1
  865. package/src/navigation/back-button/index.tsx +1 -0
  866. package/src/navigation/index.tsx +7 -0
  867. package/src/navigation/item/index.tsx +2 -0
  868. package/src/navigation/styles/navigation-styles.tsx +3 -2
  869. package/src/navigation/test/index.tsx +4 -0
  870. package/src/navigator/test/index.tsx +4 -0
  871. package/src/number-control/index.tsx +1 -0
  872. package/src/palette-edit/index.tsx +1 -0
  873. package/src/panel/stories/index.story.tsx +3 -3
  874. package/src/private-apis.ts +2 -0
  875. package/src/radio-group/index.tsx +12 -1
  876. package/src/radio-group/radio.tsx +1 -2
  877. package/src/range-control/styles/range-control-styles.ts +8 -4
  878. package/src/select-control/README.md +3 -0
  879. package/src/select-control/index.tsx +10 -0
  880. package/src/select-control/stories/index.story.tsx +2 -0
  881. package/src/select-control/test/select-control.tsx +7 -1
  882. package/src/select-control/types.ts +1 -0
  883. package/src/slot-fill/context.ts +5 -3
  884. package/src/slot-fill/fill.ts +10 -15
  885. package/src/slot-fill/provider.tsx +63 -64
  886. package/src/slot-fill/slot.tsx +40 -27
  887. package/src/slot-fill/types.ts +23 -11
  888. package/src/style.scss +1 -0
  889. package/src/tab-panel/index.tsx +1 -2
  890. package/src/tab-panel/stories/index.story.tsx +4 -0
  891. package/src/tabs/README.md +151 -187
  892. package/src/tabs/docs-manifest.json +22 -0
  893. package/src/tabs/index.tsx +21 -4
  894. package/src/tabs/stories/best-practices.mdx +99 -0
  895. package/src/tabs/stories/index.story.tsx +5 -0
  896. package/src/tabs/types.ts +13 -14
  897. package/src/text/hook.ts +2 -2
  898. package/src/text/styles.ts +1 -1
  899. package/src/text/test/__snapshots__/index.tsx.snap +3 -3
  900. package/src/text/test/index.tsx +1 -1
  901. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +24 -24
  902. package/src/toggle-group-control/test/index.tsx +7 -1
  903. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +1 -2
  904. package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
  905. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +6 -6
  906. package/src/tooltip/index.tsx +1 -2
  907. package/src/tree-grid/stories/index.story.tsx +2 -0
  908. package/src/tree-select/README.md +144 -28
  909. package/src/tree-select/docs-manifest.json +5 -0
  910. package/src/tree-select/index.tsx +11 -2
  911. package/src/tree-select/stories/index.story.tsx +1 -0
  912. package/src/tree-select/types.ts +8 -1
  913. package/src/utils/colors-values.js +3 -0
  914. package/src/utils/config-values.js +0 -1
  915. package/tsconfig.json +0 -3
  916. package/tsconfig.tsbuildinfo +1 -1
  917. package/build/box-control/all-input-control.js +0 -91
  918. package/build/box-control/all-input-control.js.map +0 -1
  919. package/build/box-control/axial-input-controls.js +0 -125
  920. package/build/box-control/axial-input-controls.js.map +0 -1
  921. package/build/box-control/input-controls.js +0 -133
  922. package/build/box-control/input-controls.js.map +0 -1
  923. package/build/slot-fill/use-slot.js +0 -32
  924. package/build/slot-fill/use-slot.js.map +0 -1
  925. package/build-module/box-control/all-input-control.js +0 -84
  926. package/build-module/box-control/all-input-control.js.map +0 -1
  927. package/build-module/box-control/axial-input-controls.js +0 -116
  928. package/build-module/box-control/axial-input-controls.js.map +0 -1
  929. package/build-module/box-control/input-controls.js +0 -124
  930. package/build-module/box-control/input-controls.js.map +0 -1
  931. package/build-module/slot-fill/use-slot.js +0 -24
  932. package/build-module/slot-fill/use-slot.js.map +0 -1
  933. package/build-types/box-control/all-input-control.d.ts +0 -3
  934. package/build-types/box-control/all-input-control.d.ts.map +0 -1
  935. package/build-types/box-control/axial-input-controls.d.ts +0 -3
  936. package/build-types/box-control/axial-input-controls.d.ts.map +0 -1
  937. package/build-types/box-control/input-controls.d.ts +0 -3
  938. package/build-types/box-control/input-controls.d.ts.map +0 -1
  939. package/build-types/slot-fill/use-slot.d.ts +0 -10
  940. package/build-types/slot-fill/use-slot.d.ts.map +0 -1
  941. package/src/box-control/all-input-control.tsx +0 -110
  942. package/src/box-control/axial-input-controls.tsx +0 -165
  943. package/src/box-control/input-controls.tsx +0 -167
  944. package/src/slot-fill/use-slot.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_toolbarButton","_toolbarGroupContainer","_toolbarGroupCollapsed","_toolbarContext","_jsxRuntime","isNestedArray","arr","Array","isArray","ToolbarGroup","controls","children","className","isCollapsed","title","props","accessibleToolbarState","useContext","ToolbarContext","length","finalClassName","clsx","controlSets","jsx","default","label","jsxs","flatMap","controlSet","indexOfSet","map","control","indexOfControl","containerClassName","undefined","join","_default","exports"],"sources":["@wordpress/components/src/toolbar/toolbar-group/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ToolbarButton from '../toolbar-button';\nimport ToolbarGroupContainer from './toolbar-group-container';\nimport ToolbarGroupCollapsed from './toolbar-group-collapsed';\nimport ToolbarContext from '../toolbar-context';\nimport type { ToolbarGroupProps, ToolbarGroupControls } from './types';\n\nfunction isNestedArray< T = any >( arr: T[] | T[][] ): arr is T[][] {\n\treturn Array.isArray( arr ) && Array.isArray( arr[ 0 ] );\n}\n\n/**\n * Renders a collapsible group of controls\n *\n * The `controls` prop accepts an array of sets. A set is an array of controls.\n * Controls have the following shape:\n *\n * ```\n * {\n * icon: string,\n * title: string,\n * subscript: string,\n * onClick: Function,\n * isActive: boolean,\n * isDisabled: boolean\n * }\n * ```\n *\n * For convenience it is also possible to pass only an array of controls. It is\n * then assumed this is the only set.\n *\n * Either `controls` or `children` is required, otherwise this components\n * renders nothing.\n *\n * @param props Component props.\n * @param [props.controls] The controls to render in this toolbar.\n * @param [props.children] Any other things to render inside the toolbar besides the controls.\n * @param [props.className] Class to set on the container div.\n * @param [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.\n * @param [props.title] ARIA label for dropdown menu if is collapsed.\n */\nfunction ToolbarGroup( {\n\tcontrols = [],\n\tchildren,\n\tclassName,\n\tisCollapsed,\n\ttitle,\n\t...props\n}: ToolbarGroupProps ) {\n\t// It'll contain state if `ToolbarGroup` is being used within\n\t// `<Toolbar label=\"label\" />`\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ( ! controls || ! controls.length ) && ! children ) {\n\t\treturn null;\n\t}\n\n\tconst finalClassName = clsx(\n\t\t// Unfortunately, there's legacy code referencing to `.components-toolbar`\n\t\t// So we can't get rid of it\n\t\taccessibleToolbarState\n\t\t\t? 'components-toolbar-group'\n\t\t\t: 'components-toolbar',\n\t\tclassName\n\t);\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: ToolbarGroupControls[][];\n\tif ( isNestedArray( controls ) ) {\n\t\tcontrolSets = controls;\n\t} else {\n\t\tcontrolSets = [ controls ];\n\t}\n\n\tif ( isCollapsed ) {\n\t\treturn (\n\t\t\t<ToolbarGroupCollapsed\n\t\t\t\tlabel={ title }\n\t\t\t\tcontrols={ controlSets }\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tchildren={ children }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarGroupContainer className={ finalClassName } { ...props }>\n\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\tcontrolSet.map( ( control, indexOfControl: number ) => (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tkey={ [ indexOfSet, indexOfControl ].join() }\n\t\t\t\t\t\tcontainerClassName={\n\t\t\t\t\t\t\tindexOfSet > 0 && indexOfControl === 0\n\t\t\t\t\t\t\t\t? 'has-left-divider'\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...control }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t) }\n\t\t\t{ children }\n\t\t</ToolbarGroupContainer>\n\t);\n}\n\nexport default ToolbarGroup;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,sBAAA,GA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J,QAAQ,EAAGY,WAAa;MACxBV,SAAS,EAAGQ,cAAgB;MAC5BT,QAAQ,EAAGA,QAAU;MAAA,GAChBI;IAAK,CACV,CAAC;EAEJ;EAEA,oBACC,IAAAX,WAAA,CAAAsB,IAAA,EAACzB,sBAAA,CAAAuB,OAAqB;IAACZ,SAAS,EAAGQ,cAAgB;IAAA,GAAML,KAAK;IAAAJ,QAAA,GAC3DW,WAAW,EAAEK,OAAO,CAAE,CAAEC,UAAU,EAAEC,UAAU,KAC/CD,UAAU,CAACE,GAAG,CAAE,CAAEC,OAAO,EAAEC,cAAsB,kBAChD,IAAA5B,WAAA,CAAAmB,GAAA,EAACvB,cAAA,CAAAwB,OAAa;MAEbS,kBAAkB,EACjBJ,UAAU,GAAG,CAAC,IAAIG,cAAc,KAAK,CAAC,GACnC,kBAAkB,GAClBE,SACH;MAAA,GACIH;IAAO,GANN,CAAEF,UAAU,EAAEG,cAAc,CAAE,CAACG,IAAI,CAAC,CAO1C,CACA,CACH,CAAC,EACCxB,QAAQ;EAAA,CACY,CAAC;AAE1B;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEcf,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_toolbarButton","_toolbarGroupContainer","_toolbarGroupCollapsed","_toolbarContext","_jsxRuntime","isNestedArray","arr","Array","isArray","ToolbarGroup","controls","children","className","isCollapsed","title","props","accessibleToolbarState","useContext","ToolbarContext","length","finalClassName","clsx","controlSets","jsx","default","label","jsxs","flatMap","controlSet","indexOfSet","map","control","indexOfControl","containerClassName","undefined","join","_default","exports"],"sources":["@wordpress/components/src/toolbar/toolbar-group/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ToolbarButton from '../toolbar-button';\nimport ToolbarGroupContainer from './toolbar-group-container';\nimport ToolbarGroupCollapsed from './toolbar-group-collapsed';\nimport ToolbarContext from '../toolbar-context';\nimport type { ToolbarGroupProps, ToolbarGroupControls } from './types';\n\nfunction isNestedArray< T = any >( arr: T[] | T[][] ): arr is T[][] {\n\treturn Array.isArray( arr ) && Array.isArray( arr[ 0 ] );\n}\n\n/**\n * Renders a collapsible group of controls\n *\n * The `controls` prop accepts an array of sets. A set is an array of controls.\n * Controls have the following shape:\n *\n * ```\n * {\n * icon: string,\n * title: string,\n * subscript: string,\n * onClick: Function,\n * isActive: boolean,\n * isDisabled: boolean\n * }\n * ```\n *\n * For convenience it is also possible to pass only an array of controls. It is\n * then assumed this is the only set.\n *\n * Either `controls` or `children` is required, otherwise this components\n * renders nothing.\n *\n * @param props Component props.\n * @param [props.controls] The controls to render in this toolbar.\n * @param [props.children] Any other things to render inside the toolbar besides the controls.\n * @param [props.className] Class to set on the container div.\n * @param [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.\n * @param [props.title] ARIA label for dropdown menu if is collapsed.\n */\nfunction ToolbarGroup( {\n\tcontrols = [],\n\tchildren,\n\tclassName,\n\tisCollapsed,\n\ttitle,\n\t...props\n}: ToolbarGroupProps ) {\n\t// It'll contain state if `ToolbarGroup` is being used within\n\t// `<Toolbar label=\"label\" />`\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ( ! controls || ! controls.length ) && ! children ) {\n\t\treturn null;\n\t}\n\n\tconst finalClassName = clsx(\n\t\t// Unfortunately, there's legacy code referencing to `.components-toolbar`\n\t\t// So we can't get rid of it\n\t\taccessibleToolbarState\n\t\t\t? 'components-toolbar-group'\n\t\t\t: 'components-toolbar',\n\t\tclassName\n\t);\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: ToolbarGroupControls[][];\n\tif ( isNestedArray( controls ) ) {\n\t\tcontrolSets = controls;\n\t} else {\n\t\tcontrolSets = [ controls ];\n\t}\n\n\tif ( isCollapsed ) {\n\t\treturn (\n\t\t\t<ToolbarGroupCollapsed\n\t\t\t\tlabel={ title }\n\t\t\t\tcontrols={ controlSets }\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tchildren={ children }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarGroupContainer className={ finalClassName } { ...props }>\n\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\tcontrolSet.map( ( control, indexOfControl: number ) => (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tkey={ [ indexOfSet, indexOfControl ].join() }\n\t\t\t\t\t\tcontainerClassName={\n\t\t\t\t\t\t\tindexOfSet > 0 && indexOfControl === 0\n\t\t\t\t\t\t\t\t? 'has-left-divider'\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...control }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t) }\n\t\t\t{ children }\n\t\t</ToolbarGroupContainer>\n\t);\n}\n\nexport default ToolbarGroup;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,sBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,sBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAAgD,IAAAM,WAAA,GAAAN,OAAA;AAhBhD;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASO,aAAaA,CAAaC,GAAgB,EAAiB;EACnE,OAAOC,KAAK,CAACC,OAAO,CAAEF,GAAI,CAAC,IAAIC,KAAK,CAACC,OAAO,CAAEF,GAAG,CAAE,CAAC,CAAG,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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MAEbS,kBAAkB,EACjBJ,UAAU,GAAG,CAAC,IAAIG,cAAc,KAAK,CAAC,GACnC,kBAAkB,GAClBE,SACH;MAAA,GACIH;IAAO,GANN,CAAEF,UAAU,EAAEG,cAAc,CAAE,CAACG,IAAI,CAAC,CAO1C,CACA,CACH,CAAC,EACCxB,QAAQ;EAAA,CACY,CAAC;AAE1B;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEcf,YAAY","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","styles","_interopRequireWildcard","_context","_useCx","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DEFAULT_COLUMNS","emptyMenuItems","optional","emptyState","panelItems","menuItemOrder","menuItems","generateMenuItems","shouldReset","currentMenuItems","newMenuItems","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","key","keys","panelItemsReducer","action","type","newItems","existingIndex","findIndex","oldItem","item","splice","push","index","menuItemOrderReducer","includes","menuItemsReducer","state","oldValue","currentItem","find","menuGroup","panelReducer","resetAllFiltersReducer","filters","filter","f","isMenuItemTypeEmpty","obj","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","useContextSystem","isResettingRef","useRef","wasResetting","current","useEffect","panelDispatch","useReducer","undefined","resetAllFilters","dispatchResetAllFilters","registerPanelItem","useCallback","deregisterPanelItem","registerResetAllFilter","deregisterResetAllFilter","flagItemCustomization","areAllOptionalControlsHidden","useMemo","values","every","isSelected","cx","useCx","classes","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","resetAllItems","getFirstVisibleItemLabel","items","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","hasMenuItems","panelContext","isResetting"],"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseReducer,\n\tuseRef,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\ntype PanelItemsState = {\n\tpanelItems: ToolsPanelItem[];\n\tmenuItemOrder: string[];\n\tmenuItems: ToolsPanelMenuItems;\n};\n\ntype PanelItemsAction =\n\t| { type: 'REGISTER_PANEL'; item: ToolsPanelItem }\n\t| { type: 'UNREGISTER_PANEL'; label: string }\n\t| {\n\t\t\ttype: 'UPDATE_VALUE';\n\t\t\tgroup: ToolsPanelMenuItemKey;\n\t\t\tlabel: string;\n\t\t\tvalue: boolean;\n\t }\n\t| { type: 'TOGGLE_VALUE'; label: string }\n\t| { type: 'RESET_ALL' };\n\nfunction emptyMenuItems(): ToolsPanelMenuItems {\n\treturn { default: {}, optional: {} };\n}\n\nfunction emptyState(): PanelItemsState {\n\treturn { panelItems: [], menuItemOrder: [], menuItems: emptyMenuItems() };\n}\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n\tmenuItemOrder,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst newMenuItems: ToolsPanelMenuItems = emptyMenuItems();\n\tconst menuItems: ToolsPanelMenuItems = emptyMenuItems();\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tnewMenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\t// Loop the known, previously registered items first to maintain menu order.\n\tmenuItemOrder.forEach( ( key ) => {\n\t\tif ( newMenuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\n\t\tif ( newMenuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\t// Loop newMenuItems object adding any that aren't in the known items order.\n\tObject.keys( newMenuItems.default ).forEach( ( key ) => {\n\t\tif ( ! menuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\t} );\n\n\tObject.keys( newMenuItems.optional ).forEach( ( key ) => {\n\t\tif ( ! menuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\treturn menuItems;\n};\n\nfunction panelItemsReducer(\n\tpanelItems: ToolsPanelItem[],\n\taction: PanelItemsAction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL': {\n\t\t\tconst newItems = [ ...panelItems ];\n\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t// and optional groups.\n\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t( oldItem ) => oldItem.label === action.item.label\n\t\t\t);\n\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t}\n\t\t\tnewItems.push( action.item );\n\t\t\treturn newItems;\n\t\t}\n\t\tcase 'UNREGISTER_PANEL': {\n\t\t\tconst index = panelItems.findIndex(\n\t\t\t\t( item ) => item.label === action.label\n\t\t\t);\n\t\t\tif ( index !== -1 ) {\n\t\t\t\tconst newItems = [ ...panelItems ];\n\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\treturn newItems;\n\t\t\t}\n\t\t\treturn panelItems;\n\t\t}\n\t\tdefault:\n\t\t\treturn panelItems;\n\t}\n}\n\nfunction menuItemOrderReducer(\n\tmenuItemOrder: string[],\n\taction: PanelItemsAction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL': {\n\t\t\t// Track the initial order of item registration. This is used for\n\t\t\t// maintaining menu item order later.\n\t\t\tif ( menuItemOrder.includes( action.item.label ) ) {\n\t\t\t\treturn menuItemOrder;\n\t\t\t}\n\n\t\t\treturn [ ...menuItemOrder, action.item.label ];\n\t\t}\n\t\tdefault:\n\t\t\treturn menuItemOrder;\n\t}\n}\n\nfunction menuItemsReducer( state: PanelItemsState, action: PanelItemsAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL':\n\t\tcase 'UNREGISTER_PANEL':\n\t\t\t// generate new menu items from original `menuItems` and updated `panelItems` and `menuItemOrder`\n\t\t\treturn generateMenuItems( {\n\t\t\t\tcurrentMenuItems: state.menuItems,\n\t\t\t\tpanelItems: state.panelItems,\n\t\t\t\tmenuItemOrder: state.menuItemOrder,\n\t\t\t\tshouldReset: false,\n\t\t\t} );\n\t\tcase 'RESET_ALL':\n\t\t\treturn generateMenuItems( {\n\t\t\t\tpanelItems: state.panelItems,\n\t\t\t\tmenuItemOrder: state.menuItemOrder,\n\t\t\t\tshouldReset: true,\n\t\t\t} );\n\t\tcase 'UPDATE_VALUE': {\n\t\t\tconst oldValue = state.menuItems[ action.group ][ action.label ];\n\t\t\tif ( action.value === oldValue ) {\n\t\t\t\treturn state.menuItems;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...state.menuItems,\n\t\t\t\t[ action.group ]: {\n\t\t\t\t\t...state.menuItems[ action.group ],\n\t\t\t\t\t[ action.label ]: action.value,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'TOGGLE_VALUE': {\n\t\t\tconst currentItem = state.panelItems.find(\n\t\t\t\t( item ) => item.label === action.label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn state.menuItems;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...state.menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...state.menuItems[ menuGroup ],\n\t\t\t\t\t[ action.label ]:\n\t\t\t\t\t\t! state.menuItems[ menuGroup ][ action.label ],\n\t\t\t\t},\n\t\t\t};\n\t\t\treturn newMenuItems;\n\t\t}\n\n\t\tdefault:\n\t\t\treturn state.menuItems;\n\t}\n}\n\nfunction panelReducer( state: PanelItemsState, action: PanelItemsAction ) {\n\tconst panelItems = panelItemsReducer( state.panelItems, action );\n\tconst menuItemOrder = menuItemOrderReducer( state.menuItemOrder, action );\n\t// `menuItemsReducer` is a bit unusual because it generates new state from original `menuItems`\n\t// and the updated `panelItems` and `menuItemOrder`.\n\tconst menuItems = menuItemsReducer(\n\t\t{ panelItems, menuItemOrder, menuItems: state.menuItems },\n\t\taction\n\t);\n\n\treturn { panelItems, menuItemOrder, menuItems };\n}\n\nfunction resetAllFiltersReducer(\n\tfilters: ResetAllFilter[],\n\taction: { type: 'REGISTER' | 'UNREGISTER'; filter: ResetAllFilter }\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER':\n\t\t\treturn [ ...filters, action.filter ];\n\t\tcase 'UNREGISTER':\n\t\t\treturn filters.filter( ( f ) => f !== action.filter );\n\t\tdefault:\n\t\t\treturn filters;\n\t}\n}\n\nconst isMenuItemTypeEmpty = (\n\tobj: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResettingRef = useRef( false );\n\tconst wasResetting = isResettingRef.current;\n\n\t// `isResettingRef` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResettingRef.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ { panelItems, menuItems }, panelDispatch ] = useReducer(\n\t\tpanelReducer,\n\t\tundefined,\n\t\temptyState\n\t);\n\n\tconst [ resetAllFilters, dispatchResetAllFilters ] = useReducer(\n\t\tresetAllFiltersReducer,\n\t\t[]\n\t);\n\n\tconst registerPanelItem = useCallback( ( item: ToolsPanelItem ) => {\n\t\t// Add item to panel items.\n\t\tpanelDispatch( { type: 'REGISTER_PANEL', item } );\n\t}, [] );\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback( ( label: string ) => {\n\t\t// When switching selections between components injecting matching\n\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t// deregistration of the first panel doesn't occur until after the\n\t\t// registration of the next.\n\t\tpanelDispatch( { type: 'UNREGISTER_PANEL', label } );\n\t}, [] );\n\n\tconst registerResetAllFilter = useCallback( ( filter: ResetAllFilter ) => {\n\t\tdispatchResetAllFilters( { type: 'REGISTER', filter } );\n\t}, [] );\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filter: ResetAllFilter ) => {\n\t\t\tdispatchResetAllFilters( { type: 'UNREGISTER', filter } );\n\t\t},\n\t\t[]\n\t);\n\n\t// Updates the status of the panel’s menu items. For default items the\n\t// value represents whether it differs from the default and for optional\n\t// items whether the item is shown.\n\tconst flagItemCustomization = useCallback(\n\t\t(\n\t\t\tvalue: boolean,\n\t\t\tlabel: string,\n\t\t\tgroup: ToolsPanelMenuItemKey = 'default'\n\t\t) => {\n\t\t\tpanelDispatch( { type: 'UPDATE_VALUE', group, label, value } );\n\t\t},\n\t\t[]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst areAllOptionalControlsHidden = useMemo( () => {\n\t\treturn (\n\t\t\tisMenuItemTypeEmpty( menuItems.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems.optional ) &&\n\t\t\tObject.values( menuItems.optional ).every(\n\t\t\t\t( isSelected ) => ! isSelected\n\t\t\t)\n\t\t);\n\t}, [ menuItems ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tareAllOptionalControlsHidden && styles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [ areAllOptionalControlsHidden, className, cx, hasInnerWrapper ] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback( ( label: string ) => {\n\t\tpanelDispatch( { type: 'TOGGLE_VALUE', label } );\n\t}, [] );\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResettingRef.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tpanelDispatch( { type: 'RESET_ALL' } );\n\t}, [ resetAllFilters, resetAll ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst hasMenuItems = panelItems.length > 0;\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems,\n\t\t\tisResetting: isResettingRef.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\thasMenuItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\theadingLevel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAWA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAiD,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAA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B,EACxBqB,kBAAkB,EAClBpB,qBAAqB,EACrBqB,iBAAiB,EACjBzF,SAAS,EACT8C,OAAO,EACP6C,YAAY,EACZzB,sBAAsB,EACtBH,iBAAiB,EACjBf,4BAA4B,EAC5BC,mCAAmC,EACnCC,kCAAkC,CAEpC,CAAC;EAED,OAAO;IACN,GAAGC,UAAU;IACbP,YAAY;IACZgD,YAAY;IACZT,aAAa;IACbD,UAAU;IACVvC,SAAS,EAAEiC;EACZ,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","styles","_interopRequireWildcard","_context","_useCx","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DEFAULT_COLUMNS","emptyMenuItems","optional","emptyState","panelItems","menuItemOrder","menuItems","generateMenuItems","shouldReset","currentMenuItems","newMenuItems","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","key","keys","panelItemsReducer","action","type","newItems","existingIndex","findIndex","oldItem","item","splice","push","index","menuItemOrderReducer","includes","menuItemsReducer","state","oldValue","currentItem","find","menuGroup","panelReducer","resetAllFiltersReducer","filters","filter","f","isMenuItemTypeEmpty","obj","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","useContextSystem","isResettingRef","useRef","wasResetting","current","useEffect","panelDispatch","useReducer","undefined","resetAllFilters","dispatchResetAllFilters","registerPanelItem","useCallback","deregisterPanelItem","registerResetAllFilter","deregisterResetAllFilter","flagItemCustomization","areAllOptionalControlsHidden","useMemo","values","every","isSelected","cx","useCx","classes","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","resetAllItems","getFirstVisibleItemLabel","items","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","hasMenuItems","panelContext","isResetting"],"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseReducer,\n\tuseRef,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\ntype PanelItemsState = {\n\tpanelItems: ToolsPanelItem[];\n\tmenuItemOrder: string[];\n\tmenuItems: ToolsPanelMenuItems;\n};\n\ntype PanelItemsAction =\n\t| { type: 'REGISTER_PANEL'; item: ToolsPanelItem }\n\t| { type: 'UNREGISTER_PANEL'; label: string }\n\t| {\n\t\t\ttype: 'UPDATE_VALUE';\n\t\t\tgroup: ToolsPanelMenuItemKey;\n\t\t\tlabel: string;\n\t\t\tvalue: boolean;\n\t }\n\t| { type: 'TOGGLE_VALUE'; label: string }\n\t| { type: 'RESET_ALL' };\n\nfunction emptyMenuItems(): ToolsPanelMenuItems {\n\treturn { default: {}, optional: {} };\n}\n\nfunction emptyState(): PanelItemsState {\n\treturn { panelItems: [], menuItemOrder: [], menuItems: emptyMenuItems() };\n}\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n\tmenuItemOrder,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst newMenuItems: ToolsPanelMenuItems = emptyMenuItems();\n\tconst menuItems: ToolsPanelMenuItems = emptyMenuItems();\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tnewMenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\t// Loop the known, previously registered items first to maintain menu order.\n\tmenuItemOrder.forEach( ( key ) => {\n\t\tif ( newMenuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\n\t\tif ( newMenuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\t// Loop newMenuItems object adding any that aren't in the known items order.\n\tObject.keys( newMenuItems.default ).forEach( ( key ) => {\n\t\tif ( ! menuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\t} );\n\n\tObject.keys( newMenuItems.optional ).forEach( ( key ) => {\n\t\tif ( ! menuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\treturn menuItems;\n};\n\nfunction panelItemsReducer(\n\tpanelItems: ToolsPanelItem[],\n\taction: PanelItemsAction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL': {\n\t\t\tconst newItems = [ ...panelItems ];\n\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t// and optional groups.\n\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t( oldItem ) => oldItem.label === action.item.label\n\t\t\t);\n\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t}\n\t\t\tnewItems.push( action.item );\n\t\t\treturn newItems;\n\t\t}\n\t\tcase 'UNREGISTER_PANEL': {\n\t\t\tconst index = panelItems.findIndex(\n\t\t\t\t( item ) => item.label === action.label\n\t\t\t);\n\t\t\tif ( index !== -1 ) {\n\t\t\t\tconst newItems = [ ...panelItems ];\n\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\treturn newItems;\n\t\t\t}\n\t\t\treturn panelItems;\n\t\t}\n\t\tdefault:\n\t\t\treturn panelItems;\n\t}\n}\n\nfunction menuItemOrderReducer(\n\tmenuItemOrder: string[],\n\taction: PanelItemsAction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL': {\n\t\t\t// Track the initial order of item registration. This is used for\n\t\t\t// maintaining menu item order later.\n\t\t\tif ( menuItemOrder.includes( action.item.label ) ) {\n\t\t\t\treturn menuItemOrder;\n\t\t\t}\n\n\t\t\treturn [ ...menuItemOrder, action.item.label ];\n\t\t}\n\t\tdefault:\n\t\t\treturn menuItemOrder;\n\t}\n}\n\nfunction menuItemsReducer( state: PanelItemsState, action: PanelItemsAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL':\n\t\tcase 'UNREGISTER_PANEL':\n\t\t\t// generate new menu items from original `menuItems` and updated `panelItems` and `menuItemOrder`\n\t\t\treturn generateMenuItems( {\n\t\t\t\tcurrentMenuItems: state.menuItems,\n\t\t\t\tpanelItems: state.panelItems,\n\t\t\t\tmenuItemOrder: state.menuItemOrder,\n\t\t\t\tshouldReset: false,\n\t\t\t} );\n\t\tcase 'RESET_ALL':\n\t\t\treturn generateMenuItems( {\n\t\t\t\tpanelItems: state.panelItems,\n\t\t\t\tmenuItemOrder: state.menuItemOrder,\n\t\t\t\tshouldReset: true,\n\t\t\t} );\n\t\tcase 'UPDATE_VALUE': {\n\t\t\tconst oldValue = state.menuItems[ action.group ][ action.label ];\n\t\t\tif ( action.value === oldValue ) {\n\t\t\t\treturn state.menuItems;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...state.menuItems,\n\t\t\t\t[ action.group ]: {\n\t\t\t\t\t...state.menuItems[ action.group ],\n\t\t\t\t\t[ action.label ]: action.value,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'TOGGLE_VALUE': {\n\t\t\tconst currentItem = state.panelItems.find(\n\t\t\t\t( item ) => item.label === action.label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn state.menuItems;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...state.menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...state.menuItems[ menuGroup ],\n\t\t\t\t\t[ action.label ]:\n\t\t\t\t\t\t! state.menuItems[ menuGroup ][ action.label ],\n\t\t\t\t},\n\t\t\t};\n\t\t\treturn newMenuItems;\n\t\t}\n\n\t\tdefault:\n\t\t\treturn state.menuItems;\n\t}\n}\n\nfunction panelReducer( state: PanelItemsState, action: PanelItemsAction ) {\n\tconst panelItems = panelItemsReducer( state.panelItems, action );\n\tconst menuItemOrder = menuItemOrderReducer( state.menuItemOrder, action );\n\t// `menuItemsReducer` is a bit unusual because it generates new state from original `menuItems`\n\t// and the updated `panelItems` and `menuItemOrder`.\n\tconst menuItems = menuItemsReducer(\n\t\t{ panelItems, menuItemOrder, menuItems: state.menuItems },\n\t\taction\n\t);\n\n\treturn { panelItems, menuItemOrder, menuItems };\n}\n\nfunction resetAllFiltersReducer(\n\tfilters: ResetAllFilter[],\n\taction: { type: 'REGISTER' | 'UNREGISTER'; filter: ResetAllFilter }\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER':\n\t\t\treturn [ ...filters, action.filter ];\n\t\tcase 'UNREGISTER':\n\t\t\treturn filters.filter( ( f ) => f !== action.filter );\n\t\tdefault:\n\t\t\treturn filters;\n\t}\n}\n\nconst isMenuItemTypeEmpty = (\n\tobj: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResettingRef = useRef( false );\n\tconst wasResetting = isResettingRef.current;\n\n\t// `isResettingRef` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResettingRef.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ { panelItems, menuItems }, panelDispatch ] = useReducer(\n\t\tpanelReducer,\n\t\tundefined,\n\t\temptyState\n\t);\n\n\tconst [ resetAllFilters, dispatchResetAllFilters ] = useReducer(\n\t\tresetAllFiltersReducer,\n\t\t[]\n\t);\n\n\tconst registerPanelItem = useCallback( ( item: ToolsPanelItem ) => {\n\t\t// Add item to panel items.\n\t\tpanelDispatch( { type: 'REGISTER_PANEL', item } );\n\t}, [] );\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback( ( label: string ) => {\n\t\t// When switching selections between components injecting matching\n\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t// deregistration of the first panel doesn't occur until after the\n\t\t// registration of the next.\n\t\tpanelDispatch( { type: 'UNREGISTER_PANEL', label } );\n\t}, [] );\n\n\tconst registerResetAllFilter = useCallback( ( filter: ResetAllFilter ) => {\n\t\tdispatchResetAllFilters( { type: 'REGISTER', filter } );\n\t}, [] );\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filter: ResetAllFilter ) => {\n\t\t\tdispatchResetAllFilters( { type: 'UNREGISTER', filter } );\n\t\t},\n\t\t[]\n\t);\n\n\t// Updates the status of the panel’s menu items. For default items the\n\t// value represents whether it differs from the default and for optional\n\t// items whether the item is shown.\n\tconst flagItemCustomization = useCallback(\n\t\t(\n\t\t\tvalue: boolean,\n\t\t\tlabel: string,\n\t\t\tgroup: ToolsPanelMenuItemKey = 'default'\n\t\t) => {\n\t\t\tpanelDispatch( { type: 'UPDATE_VALUE', group, label, value } );\n\t\t},\n\t\t[]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst areAllOptionalControlsHidden = useMemo( () => {\n\t\treturn (\n\t\t\tisMenuItemTypeEmpty( menuItems.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems.optional ) &&\n\t\t\tObject.values( menuItems.optional ).every(\n\t\t\t\t( isSelected ) => ! isSelected\n\t\t\t)\n\t\t);\n\t}, [ menuItems ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tareAllOptionalControlsHidden && styles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [ areAllOptionalControlsHidden, className, cx, hasInnerWrapper ] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback( ( label: string ) => {\n\t\tpanelDispatch( { type: 'TOGGLE_VALUE', label } );\n\t}, [] );\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResettingRef.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tpanelDispatch( { type: 'RESET_ALL' } );\n\t}, [ resetAllFilters, resetAll ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst hasMenuItems = panelItems.length > 0;\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems,\n\t\t\tisResetting: isResettingRef.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\thasMenuItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\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C,YAAY,EACZzB,sBAAsB,EACtBH,iBAAiB,EACjBf,4BAA4B,EAC5BC,mCAAmC,EACnCC,kCAAkC,CAEpC,CAAC;EAED,OAAO;IACN,GAAGC,UAAU;IACbP,YAAY;IACZgD,YAAY;IACZT,aAAa;IACbD,UAAU;IACVvC,SAAS,EAAEiC;EACZ,CAAC;AACF","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_a11y","require","_icons","_i18n","_dropdownMenu","_interopRequireDefault","_menuGroup","_menuItem","_hStack","_heading","_hook","_context","_styles","_jsxRuntime","DefaultControlsGroup","itemClassName","items","toggleItem","length","resetSuffix","jsx","ResetLabel","children","__","Fragment","map","label","hasValue","default","className","role","sprintf","onClick","speak","suffix","icon","check","isSelected","OptionalControlsGroup","itemLabel","_x","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","defaultControlsItemClassName","dropdownMenuClassName","hasMenuItems","headingClassName","headingLevel","labelText","menuItems","resetAll","dropdownMenuProps","headerProps","useToolsPanelHeader","defaultItems","Object","entries","optionalItems","optional","dropDownMenuIcon","plus","moreVertical","dropDownMenuLabelText","dropdownMenuDescriptionText","undefined","canResetAll","some","jsxs","HStack","ref","Heading","level","menuProps","toggleProps","size","description","variant","ConnectedToolsPanelHeader","contextConnect","_default","exports"],"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { check, moreVertical, plus } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport MenuGroup from '../../menu-group';\nimport MenuItem from '../../menu-item';\nimport { HStack } from '../../h-stack';\nimport { Heading } from '../../heading';\nimport { useToolsPanelHeader } from './hook';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { ResetLabel } from '../styles';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst DefaultControlsGroup = ( {\n\titemClassName,\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\tconst resetSuffix = <ResetLabel aria-hidden>{ __( 'Reset' ) }</ResetLabel>;\n\n\treturn (\n\t\t<>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tif ( hasValue ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t__( 'Reset %s' ),\n\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsuffix={ resetSuffix }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ check }\n\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\taria-disabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ items.map( ( [ label, isSelected ] ) => {\n\t\t\t\tconst itemLabel = isSelected\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being hidden and reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Hide and reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control to display e.g. \"Padding\".\n\t\t\t\t\t\t\t_x( 'Show %s', 'input control' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ isSelected ? check : null }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( isSelected ) {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s hidden and reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s is now visible' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdefaultControlsItemClassName,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\theadingLevel = 2,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\tdropdownMenuProps,\n\t\t...headerProps\n\t} = useToolsPanelHeader( props );\n\n\tif ( ! labelText ) {\n\t\treturn null;\n\t}\n\n\tconst defaultItems = Object.entries( menuItems?.default || {} );\n\tconst optionalItems = Object.entries( menuItems?.optional || {} );\n\tconst dropDownMenuIcon = areAllOptionalControlsHidden ? plus : moreVertical;\n\tconst dropDownMenuLabelText = sprintf(\n\t\t// translators: %s: The name of the tool e.g. \"Color\" or \"Typography\".\n\t\t_x( '%s options', 'Button label to reveal tool panel options' ),\n\t\tlabelText\n\t);\n\tconst dropdownMenuDescriptionText = areAllOptionalControlsHidden\n\t\t? __( 'All options are currently hidden' )\n\t\t: undefined;\n\n\tconst canResetAll = [ ...defaultItems, ...optionalItems ].some(\n\t\t( [ , isSelected ] ) => isSelected\n\t);\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ headingLevel } className={ headingClassName }>\n\t\t\t\t{ labelText }\n\t\t\t</Heading>\n\t\t\t{ hasMenuItems && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\t{ ...dropdownMenuProps }\n\t\t\t\t\ticon={ dropDownMenuIcon }\n\t\t\t\t\tlabel={ dropDownMenuLabelText }\n\t\t\t\t\tmenuProps={ { className: dropdownMenuClassName } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\tdescription: dropdownMenuDescriptionText,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup label={ labelText }>\n\t\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\t\titemClassName={\n\t\t\t\t\t\t\t\t\t\tdefaultControlsItemClassName\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<OptionalControlsGroup\n\t\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\taria-disabled={ ! canResetAll }\n\t\t\t\t\t\t\t\t\t// @ts-expect-error - TODO: If this \"tertiary\" style is something we really want to allow on MenuItem,\n\t\t\t\t\t\t\t\t\t// we should rename it and explicitly allow it as an official API. All the other Button variants\n\t\t\t\t\t\t\t\t\t// don't make sense in a MenuItem context, and should be disallowed.\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif ( canResetAll ) {\n\t\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'All options reset' ),\n\t\t\t\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset all' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\nconst ConnectedToolsPanelHeader = contextConnect(\n\tToolsPanelHeader,\n\t'ToolsPanelHeader'\n);\n\nexport default ConnectedToolsPanelHeader;\n"],"mappings":";;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,SAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AAEA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAAuC,IAAAY,WAAA,GAAAZ,OAAA;AAvBvC;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAeA,MAAMa,oBAAoB,GAAGA,CAAE;EAC9BC,aAAa;E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EAChB,kBACD,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAtD,OAAA,GAEamD,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["_a11y","require","_icons","_i18n","_dropdownMenu","_interopRequireDefault","_menuGroup","_menuItem","_hStack","_heading","_hook","_context","_styles","_jsxRuntime","DefaultControlsGroup","itemClassName","items","toggleItem","length","resetSuffix","jsx","ResetLabel","children","__","Fragment","map","label","hasValue","default","className","role","sprintf","onClick","speak","suffix","icon","check","isSelected","OptionalControlsGroup","itemLabel","_x","ToolsPanelHeader","props","forwardedRef","areAllOptionalControlsHidden","defaultControlsItemClassName","dropdownMenuClassName","hasMenuItems","headingClassName","headingLevel","labelText","menuItems","resetAll","dropdownMenuProps","headerProps","useToolsPanelHeader","defaultItems","Object","entries","optionalItems","optional","dropDownMenuIcon","plus","moreVertical","dropDownMenuLabelText","dropdownMenuDescriptionText","undefined","canResetAll","some","jsxs","HStack","ref","Heading","level","menuProps","toggleProps","size","description","variant","ConnectedToolsPanelHeader","contextConnect","_default","exports"],"sources":["@wordpress/components/src/tools-panel/tools-panel-header/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { check, moreVertical, plus } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport MenuGroup from '../../menu-group';\nimport MenuItem from '../../menu-item';\nimport { HStack } from '../../h-stack';\nimport { Heading } from '../../heading';\nimport { useToolsPanelHeader } from './hook';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { ResetLabel } from '../styles';\nimport type {\n\tToolsPanelControlsGroupProps,\n\tToolsPanelHeaderProps,\n} from '../types';\n\nconst DefaultControlsGroup = ( {\n\titemClassName,\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\tconst resetSuffix = <ResetLabel aria-hidden>{ __( 'Reset' ) }</ResetLabel>;\n\n\treturn (\n\t\t<>\n\t\t\t{ items.map( ( [ label, hasValue ] ) => {\n\t\t\t\tif ( hasValue ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t__( 'Reset %s' ),\n\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsuffix={ resetSuffix }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ check }\n\t\t\t\t\t\tclassName={ itemClassName }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\taria-disabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n};\n\nconst OptionalControlsGroup = ( {\n\titems,\n\ttoggleItem,\n}: ToolsPanelControlsGroupProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ items.map( ( [ label, isSelected ] ) => {\n\t\t\t\tconst itemLabel = isSelected\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control being hidden and reset e.g. \"Padding\".\n\t\t\t\t\t\t\t__( 'Hide and reset %s' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the control to display e.g. \"Padding\".\n\t\t\t\t\t\t\t_x( 'Show %s', 'input control' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ label }\n\t\t\t\t\t\ticon={ isSelected ? check : null }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tlabel={ itemLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( isSelected ) {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s hidden and reset to default' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: The name of the control being reset e.g. \"Padding\".\n\t\t\t\t\t\t\t\t\t\t__( '%s is now visible' ),\n\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttoggleItem( label );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n};\n\nconst ToolsPanelHeader = (\n\tprops: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tareAllOptionalControlsHidden,\n\t\tdefaultControlsItemClassName,\n\t\tdropdownMenuClassName,\n\t\thasMenuItems,\n\t\theadingClassName,\n\t\theadingLevel = 2,\n\t\tlabel: labelText,\n\t\tmenuItems,\n\t\tresetAll,\n\t\ttoggleItem,\n\t\tdropdownMenuProps,\n\t\t...headerProps\n\t} = useToolsPanelHeader( props );\n\n\tif ( ! labelText ) {\n\t\treturn null;\n\t}\n\n\tconst defaultItems = Object.entries( menuItems?.default || {} );\n\tconst optionalItems = Object.entries( menuItems?.optional || {} );\n\tconst dropDownMenuIcon = areAllOptionalControlsHidden ? plus : moreVertical;\n\tconst dropDownMenuLabelText = sprintf(\n\t\t// translators: %s: The name of the tool e.g. \"Color\" or \"Typography\".\n\t\t_x( '%s options', 'Button label to reveal tool panel options' ),\n\t\tlabelText\n\t);\n\tconst dropdownMenuDescriptionText = areAllOptionalControlsHidden\n\t\t? __( 'All options are currently hidden' )\n\t\t: undefined;\n\n\tconst canResetAll = [ ...defaultItems, ...optionalItems ].some(\n\t\t( [ , isSelected ] ) => isSelected\n\t);\n\n\treturn (\n\t\t<HStack { ...headerProps } ref={ forwardedRef }>\n\t\t\t<Heading level={ headingLevel } className={ headingClassName }>\n\t\t\t\t{ labelText }\n\t\t\t</Heading>\n\t\t\t{ hasMenuItems && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\t{ ...dropdownMenuProps }\n\t\t\t\t\ticon={ dropDownMenuIcon }\n\t\t\t\t\tlabel={ dropDownMenuLabelText }\n\t\t\t\t\tmenuProps={ { className: dropdownMenuClassName } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\tdescription: dropdownMenuDescriptionText,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup label={ labelText }>\n\t\t\t\t\t\t\t\t<DefaultControlsGroup\n\t\t\t\t\t\t\t\t\titems={ defaultItems }\n\t\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\t\titemClassName={\n\t\t\t\t\t\t\t\t\t\tdefaultControlsItemClassName\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<OptionalControlsGroup\n\t\t\t\t\t\t\t\t\titems={ optionalItems }\n\t\t\t\t\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\taria-disabled={ ! canResetAll }\n\t\t\t\t\t\t\t\t\t// @ts-expect-error - TODO: If this \"tertiary\" style is something we really want to allow on MenuItem,\n\t\t\t\t\t\t\t\t\t// we should rename it and explicitly allow it as an official API. All the other Button variants\n\t\t\t\t\t\t\t\t\t// don't make sense in a MenuItem context, and should be disallowed.\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif ( canResetAll ) {\n\t\t\t\t\t\t\t\t\t\t\tresetAll();\n\t\t\t\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'All options reset' ),\n\t\t\t\t\t\t\t\t\t\t\t\t'assertive'\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset all' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\nconst ConnectedToolsPanelHeader = contextConnect(\n\tToolsPanelHeader,\n\t'ToolsPanelHeader'\n);\n\nexport default ConnectedToolsPanelHeader;\n"],"mappings":";;;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,SAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AAEA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAAuC,IAAAY,WAAA,GAAAZ,OAAA;AAvBvC;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAeA,MAAMa,oBAAoB,GAAGA,CAAE;EAC9BC,aAAa;EACbC,KAAK;EACLC;AAC6B,CAAC,KAAM;EACpC,IAAK,CAAED,KAAK,CAACE,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,MAAMC,WAAW,gBAAG,IAAAN,WAAA,CAAAO,GAAA,EAACR,OAAA,CAAAS,UAAU;IAAC,mBAAW;IAAAC,QAAA,EAAG,IAAAC,QAAE,EAAE,OAAQ;EAAC,CAAc,CA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,WAAA,CAAAW,QAAA;QAAAF,QAAA,gBACC,IAAAT,WAAA,CAAAwD,IAAA,EAAC/D,UAAA,CAAAsB,OAAS;UAACF,KAAK,EAAGwB,SAAW;UAAA5B,QAAA,gBAC7B,IAAAT,WAAA,CAAAO,GAAA,EAACN,oBAAoB;YACpBE,KAAK,EAAGwC,YAAc;YACtBvC,UAAU,EAAGA,UAAY;YACzBF,aAAa,EACZ8B;UACA,CACD,CAAC,eACF,IAAAhC,WAAA,CAAAO,GAAA,EAACkB,qBAAqB;YACrBtB,KAAK,EAAG2C,aAAe;YACvB1C,UAAU,EAAGA;UAAY,CACzB,CAAC;QAAA,CACQ,CAAC,eACZ,IAAAJ,WAAA,CAAAO,GAAA,EAACd,UAAA,CAAAsB,OAAS;UAAAN,QAAA,eACT,IAAAT,WAAA,CAAAO,GAAA,EAACb,SAAA,CAAAqB,OAAQ;YACR,iBAAgB,CAAEuC;YAClB;YACA;YACA;YAAA;YACAW,OAAO,EAAC,UAAU;YAClB9C,OAAO,EAAGA,CAAA,KAAM;cACf,IAAKmC,WAAW,EAAG;gBAClBf,QAAQ,CAAC,CAAC;gBACV,IAAAnB,WAAK,EACJ,IAAAV,QAAE,EAAE,mBAAoB,CAAC,EACzB,WACD,CAAC;cACF;YACD,CAAG;YAAAD,QAAA,EAED,IAAAC,QAAE,EAAE,WAAY;UAAC,CACV;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY,CACd;EAAA,CACM,CAAC;AAEX,CAAC;AAED,MAAMwD,yBAAyB,GAAG,IAAAC,uBAAc,EAC/CvC,gBAAgB,EAChB,kBACD,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAtD,OAAA,GAEamD,yBAAyB","ignoreList":[]}
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = exports.Tooltip = exports.TOOLTIP_DELAY = void 0;
8
- var _react = _interopRequireWildcard(require("@ariakit/react"));
9
- var Ariakit = _react;
8
+ var Ariakit = _interopRequireWildcard(require("@ariakit/react"));
10
9
  var _clsx = _interopRequireDefault(require("clsx"));
11
10
  var _compose = require("@wordpress/compose");
12
11
  var _element = require("@wordpress/element");
@@ -84,7 +83,7 @@ function UnforwardedTooltip(props, ref) {
84
83
  placement: computedPlacement,
85
84
  showTimeout: delay
86
85
  });
87
- const mounted = (0, _react.useStoreState)(tooltipStore, 'mounted');
86
+ const mounted = Ariakit.useStoreState(tooltipStore, 'mounted');
88
87
  if (isNestedInTooltip) {
89
88
  return isOnlyChild ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Ariakit.Role, {
90
89
  ...restProps,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","Ariakit","_clsx","_interopRequireDefault","_compose","_element","_deprecated","_shortcut","_utils","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TooltipInternalContext","createContext","isNestedInTooltip","TOOLTIP_DELAY","exports","CONTEXT_VALUE","UnforwardedTooltip","props","ref","children","className","delay","hideOnClick","placement","position","shortcut","text","restProps","useContext","baseId","useInstanceId","Tooltip","describedById","undefined","isOnlyChild","Children","count","process","env","NODE_ENV","console","error","computedPlacement","positionToPlacement","deprecated","since","alternative","tooltipStore","useTooltipStore","showTimeout","mounted","useStoreState","jsx","Role","render","addDescribedById","element","cloneElement","jsxs","Provider","value","TooltipAnchor","onClick","hide","store","clsx","unmountOnHide","gutter","id","overflowPadding","forwardRef","_default"],"sources":["@wordpress/components/src/tooltip/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport { useStoreState } from '@ariakit/react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tChildren,\n\tuseContext,\n\tcreateContext,\n\tforwardRef,\n\tcloneElement,\n} from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tTooltipProps,\n\tTooltipInternalContext as TooltipInternalContextType,\n} from './types';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\n\nconst TooltipInternalContext = createContext< TooltipInternalContextType >( {\n\tisNestedInTooltip: false,\n} );\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst CONTEXT_VALUE = {\n\tisNestedInTooltip: true,\n};\n\nfunction UnforwardedTooltip(\n\tprops: TooltipProps,\n\tref: React.ForwardedRef< any >\n) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tdelay = TOOLTIP_DELAY,\n\t\thideOnClick = true,\n\t\tplacement,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\n\t\t...restProps\n\t} = props;\n\n\tconst { isNestedInTooltip } = useContext( TooltipInternalContext );\n\n\tconst baseId = useInstanceId( Tooltip, 'tooltip' );\n\tconst describedById = text || shortcut ? baseId : undefined;\n\n\tconst isOnlyChild = Children.count( children ) === 1;\n\t// console error if more than one child element is added\n\tif ( ! isOnlyChild ) {\n\t\tif ( 'development' === process.env.NODE_ENV ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'wp-components.Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\t}\n\n\t// Compute tooltip's placement:\n\t// - give priority to `placement` prop, if defined\n\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t// - finally, fallback to the default placement: 'bottom'\n\tlet computedPlacement;\n\tif ( placement !== undefined ) {\n\t\tcomputedPlacement = placement;\n\t} else if ( position !== undefined ) {\n\t\tcomputedPlacement = positionToPlacement( position );\n\t\tdeprecated( '`position` prop in wp.components.tooltip', {\n\t\t\tsince: '6.4',\n\t\t\talternative: '`placement` prop',\n\t\t} );\n\t}\n\tcomputedPlacement = computedPlacement || 'bottom';\n\n\tconst tooltipStore = Ariakit.useTooltipStore( {\n\t\tplacement: computedPlacement,\n\t\tshowTimeout: delay,\n\t} );\n\tconst mounted = useStoreState( tooltipStore, 'mounted' );\n\n\tif ( isNestedInTooltip ) {\n\t\treturn isOnlyChild ? (\n\t\t\t<Ariakit.Role { ...restProps } render={ children } />\n\t\t) : (\n\t\t\tchildren\n\t\t);\n\t}\n\n\t// TODO: this is a temporary workaround to minimize the effects of the\n\t// Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n\t// the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n\t// The `aria-describedby` attribute is added only if the anchor doesn't have\n\t// one already, and if the tooltip text is not the same as the anchor's\n\t// `aria-label`\n\t// See: https://github.com/WordPress/gutenberg/pull/64066\n\t// See: https://github.com/WordPress/gutenberg/pull/65989\n\tfunction addDescribedById( element: React.ReactElement ) {\n\t\treturn describedById &&\n\t\t\tmounted &&\n\t\t\telement.props[ 'aria-describedby' ] === undefined &&\n\t\t\telement.props[ 'aria-label' ] !== text\n\t\t\t? cloneElement( element, { 'aria-describedby': describedById } )\n\t\t\t: element;\n\t}\n\n\treturn (\n\t\t<TooltipInternalContext.Provider value={ CONTEXT_VALUE }>\n\t\t\t<Ariakit.TooltipAnchor\n\t\t\t\tonClick={ hideOnClick ? tooltipStore.hide : undefined }\n\t\t\t\tstore={ tooltipStore }\n\t\t\t\trender={\n\t\t\t\t\tisOnlyChild ? addDescribedById( children ) : undefined\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t{ isOnlyChild ? undefined : children }\n\t\t\t</Ariakit.TooltipAnchor>\n\t\t\t{ isOnlyChild && ( text || shortcut ) && (\n\t\t\t\t<Ariakit.Tooltip\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\tclassName={ clsx( 'components-tooltip', className ) }\n\t\t\t\t\tunmountOnHide\n\t\t\t\t\tgutter={ 4 }\n\t\t\t\t\tid={ describedById }\n\t\t\t\t\toverflowPadding={ 0.5 }\n\t\t\t\t\tstore={ tooltipStore }\n\t\t\t\t>\n\t\t\t\t\t{ text }\n\t\t\t\t\t{ shortcut && (\n\t\t\t\t\t\t<Shortcut\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\ttext ? 'components-tooltip__shortcut' : ''\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Ariakit.Tooltip>\n\t\t\t) }\n\t\t</TooltipInternalContext.Provider>\n\t);\n}\nexport const Tooltip = forwardRef( UnforwardedTooltip );\n\nexport default Tooltip;\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,IAAAC,OAAA,GAAAH,MAAA;AAE1C,IAAAI,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAOA,IAAAM,WAAA,GAAAH,sBAAA,CAAAH,OAAA;AASA,IAAAO,SAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAuD,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAA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AAA,GAAG,IAAAuC,mBAAU,EAAEtD,kBAAmB,CAAC;AAAC,IAAAuD,QAAA,GAAAzD,OAAA,CAAAlB,OAAA,GAEzCmC,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_clsx","_interopRequireDefault","_compose","_element","_deprecated","_shortcut","_utils","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TooltipInternalContext","createContext","isNestedInTooltip","TOOLTIP_DELAY","exports","CONTEXT_VALUE","UnforwardedTooltip","props","ref","children","className","delay","hideOnClick","placement","position","shortcut","text","restProps","useContext","baseId","useInstanceId","Tooltip","describedById","undefined","isOnlyChild","Children","count","process","env","NODE_ENV","console","error","computedPlacement","positionToPlacement","deprecated","since","alternative","tooltipStore","useTooltipStore","showTimeout","mounted","useStoreState","jsx","Role","render","addDescribedById","element","cloneElement","jsxs","Provider","value","TooltipAnchor","onClick","hide","store","clsx","unmountOnHide","gutter","id","overflowPadding","forwardRef","_default"],"sources":["@wordpress/components/src/tooltip/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tChildren,\n\tuseContext,\n\tcreateContext,\n\tforwardRef,\n\tcloneElement,\n} from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tTooltipProps,\n\tTooltipInternalContext as TooltipInternalContextType,\n} from './types';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\n\nconst TooltipInternalContext = createContext< TooltipInternalContextType >( {\n\tisNestedInTooltip: false,\n} );\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst CONTEXT_VALUE = {\n\tisNestedInTooltip: true,\n};\n\nfunction UnforwardedTooltip(\n\tprops: TooltipProps,\n\tref: React.ForwardedRef< any >\n) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tdelay = TOOLTIP_DELAY,\n\t\thideOnClick = true,\n\t\tplacement,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\n\t\t...restProps\n\t} = props;\n\n\tconst { isNestedInTooltip } = useContext( TooltipInternalContext );\n\n\tconst baseId = useInstanceId( Tooltip, 'tooltip' );\n\tconst describedById = text || shortcut ? baseId : undefined;\n\n\tconst isOnlyChild = Children.count( children ) === 1;\n\t// console error if more than one child element is added\n\tif ( ! isOnlyChild ) {\n\t\tif ( 'development' === process.env.NODE_ENV ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'wp-components.Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\t}\n\n\t// Compute tooltip's placement:\n\t// - give priority to `placement` prop, if defined\n\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t// - finally, fallback to the default placement: 'bottom'\n\tlet computedPlacement;\n\tif ( placement !== undefined ) {\n\t\tcomputedPlacement = placement;\n\t} else if ( position !== undefined ) {\n\t\tcomputedPlacement = positionToPlacement( position );\n\t\tdeprecated( '`position` prop in wp.components.tooltip', {\n\t\t\tsince: '6.4',\n\t\t\talternative: '`placement` prop',\n\t\t} );\n\t}\n\tcomputedPlacement = computedPlacement || 'bottom';\n\n\tconst tooltipStore = Ariakit.useTooltipStore( {\n\t\tplacement: computedPlacement,\n\t\tshowTimeout: delay,\n\t} );\n\tconst mounted = Ariakit.useStoreState( tooltipStore, 'mounted' );\n\n\tif ( isNestedInTooltip ) {\n\t\treturn isOnlyChild ? (\n\t\t\t<Ariakit.Role { ...restProps } render={ children } />\n\t\t) : (\n\t\t\tchildren\n\t\t);\n\t}\n\n\t// TODO: this is a temporary workaround to minimize the effects of the\n\t// Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n\t// the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n\t// The `aria-describedby` attribute is added only if the anchor doesn't have\n\t// one already, and if the tooltip text is not the same as the anchor's\n\t// `aria-label`\n\t// See: https://github.com/WordPress/gutenberg/pull/64066\n\t// See: https://github.com/WordPress/gutenberg/pull/65989\n\tfunction addDescribedById( element: React.ReactElement ) {\n\t\treturn describedById &&\n\t\t\tmounted &&\n\t\t\telement.props[ 'aria-describedby' ] === undefined &&\n\t\t\telement.props[ 'aria-label' ] !== text\n\t\t\t? cloneElement( element, { 'aria-describedby': describedById } )\n\t\t\t: element;\n\t}\n\n\treturn (\n\t\t<TooltipInternalContext.Provider value={ CONTEXT_VALUE }>\n\t\t\t<Ariakit.TooltipAnchor\n\t\t\t\tonClick={ hideOnClick ? tooltipStore.hide : undefined }\n\t\t\t\tstore={ tooltipStore }\n\t\t\t\trender={\n\t\t\t\t\tisOnlyChild ? addDescribedById( children ) : undefined\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t{ isOnlyChild ? undefined : children }\n\t\t\t</Ariakit.TooltipAnchor>\n\t\t\t{ isOnlyChild && ( text || shortcut ) && (\n\t\t\t\t<Ariakit.Tooltip\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\tclassName={ clsx( 'components-tooltip', className ) }\n\t\t\t\t\tunmountOnHide\n\t\t\t\t\tgutter={ 4 }\n\t\t\t\t\tid={ describedById }\n\t\t\t\t\toverflowPadding={ 0.5 }\n\t\t\t\t\tstore={ tooltipStore }\n\t\t\t\t>\n\t\t\t\t\t{ text }\n\t\t\t\t\t{ shortcut && (\n\t\t\t\t\t\t<Shortcut\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\ttext ? 'components-tooltip__shortcut' : ''\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Ariakit.Tooltip>\n\t\t\t) }\n\t\t</TooltipInternal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+D,GAAA,EAACzE,OAAO,CAACkF,aAAa;MACrBC,OAAO,EAAGxC,WAAW,GAAGyB,YAAY,CAACgB,IAAI,GAAG9B,SAAW;MACvD+B,KAAK,EAAGjB,YAAc;MACtBO,MAAM,EACLpB,WAAW,GAAGqB,gBAAgB,CAAEpC,QAAS,CAAC,GAAGc,SAC7C;MACDf,GAAG,EAAGA,GAAK;MAAAC,QAAA,EAETe,WAAW,GAAGD,SAAS,GAAGd;IAAQ,CACd,CAAC,EACtBe,WAAW,KAAMR,IAAI,IAAID,QAAQ,CAAE,iBACpC,IAAApC,WAAA,CAAAqE,IAAA,EAAC/E,OAAO,CAACoD,OAAO;MAAA,GACVJ,SAAS;MACdP,SAAS,EAAG,IAAA6C,aAAI,EAAE,oBAAoB,EAAE7C,SAAU,CAAG;MACrD8C,aAAa;MACbC,MAAM,EAAG,CAAG;MACZC,EAAE,EAAGpC,aAAe;MACpBqC,eAAe,EAAG,GAAK;MACvBL,KAAK,EAAGjB,YAAc;MAAA5B,QAAA,GAEpBO,IAAI,EACJD,QAAQ,iBACT,IAAApC,WAAA,CAAA+D,GAAA,EAACjE,SAAA,CAAAS,OAAQ;QACRwB,SAAS,EACRM,IAAI,GAAG,8BAA8B,GAAG,EACxC;QACDD,QAAQ,EAAGA;MAAU,CACrB,CACD;IAAA,CACe,CACjB;EAAA,CAC+B,CAAC;AAEpC;AACO,MAAMM,OAAO,GAAAjB,OAAA,CAAAiB,OAAA,GAAG,IAAAuC,mBAAU,EAAEtD,kBAAmB,CAAC;AAAC,IAAAuD,QAAA,GAAAzD,OAAA,CAAAlB,OAAA,GAEzCmC,OAAO","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_dom","require","_element","_keycodes","_rovingTabIndex","_interopRequireDefault","_jsxRuntime","_row","_cell","_item","getRowFocusables","rowElement","focusablesInRow","focus","focusable","find","sequential","filter","closest","UnforwardedTreeGrid","children","onExpandRow","onCollapseRow","onFocusRow","applicationAriaLabel","props","ref","onKeyDown","useCallback","event","keyCode","metaKey","ctrlKey","altKey","hasModifierKeyPressed","UP","DOWN","LEFT","RIGHT","HOME","END","includes","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","length","_activeRow$getAttribu","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","ariaLevel","focusableItems","nextRowIndex","focusablesInNextRow","jsx","default","role","TreeGrid","exports","forwardRef","_default"],"sources":["@wordpress/components/src/tree-grid/index.tsx"],"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 '../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\t( activeRow.getAttribute( 'data-expanded' ) === 'false' ||\n\t\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( 'data-expanded' ) ===\n\t\t\t\t\t\t\t\t'true' ||\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( 'data-expanded' ) ===\n\t\t\t\t\t\t\t\t'false' ||\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AA4XzD,IAAAM,IAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,KAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,KAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AAxYA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,gBAAgBA,CAAEC,UAAuB,EAAG;EACpD,MAAMC,eAAe,GAAGC,UAAK,CAACC,SAAS,CAACC,IAAI,CAAEJ,UAAU,EAAE;IACzDK,UAAU,EAAE;EACb,CAAE,CAAC;EAEH,OAAOJ,eAAe,CAACK,MAAM,CAAIH,SAAS,IAAM;IAC/C,OAAOA,SAAS,CAACI,OAAO,CAAE,cAAe,CAAC,KAAKP,UAAU;EAC1D,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA,SAASQ,mBAAmBA,CAC3B;EACCC,QAAQ;EACRC,WAAW,GAAGA,CAAA,KAAM,CAAC,CAAC;EACtBC,aAAa,GAAGA,CAAA,KAAM,CAAC,CAAC;EACxBC,UAAU,GAAGA,CAAA,KAAM,CAAC,CAAC;EACrBC,oBAAoB;EACpB,GAAGC;AACsD,CAAC,EAC3D;AACAC,GAA2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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;AACO,MAAMyD,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,IAAAE,mBAAU,EAAE5D,mBAAoB,CAAC;AAAC,IAAA6D,QAAA,GAAAF,OAAA,CAAAH,OAAA,GAE3CE,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["_dom","require","_element","_keycodes","_rovingTabIndex","_interopRequireDefault","_jsxRuntime","_row","_cell","_item","getRowFocusables","rowElement","focusablesInRow","focus","focusable","find","sequential","filter","closest","UnforwardedTreeGrid","children","onExpandRow","onCollapseRow","onFocusRow","applicationAriaLabel","props","ref","onKeyDown","useCallback","event","keyCode","metaKey","ctrlKey","altKey","hasModifierKeyPressed","UP","DOWN","LEFT","RIGHT","HOME","END","includes","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","length","_activeRow$getAttribu","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","ariaLevel","focusableItems","nextRowIndex","focusablesInNextRow","jsx","default","role","TreeGrid","exports","forwardRef","_default"],"sources":["@wordpress/components/src/tree-grid/index.tsx"],"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 '../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\t( activeRow.getAttribute( 'data-expanded' ) === 'false' ||\n\t\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( 'data-expanded' ) ===\n\t\t\t\t\t\t\t\t'true' ||\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( 'data-expanded' ) ===\n\t\t\t\t\t\t\t\t'false' ||\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAyD,IAAAK,WAAA,GAAAL,OAAA;AA4XzD,IAAAM,IAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,KAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,KAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AAxYA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,gBAAgBA,CAAEC,UAAuB,EAAG;EACpD,MAAMC,eAAe,GAAGC,UA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,eAAA,CAAAuE,OAAuB;IAAAvD,QAAA,eAMvB,IAAAd,WAAA,CAAAoE,GAAA;MAAKE,IAAI,EAAC,aAAa;MAAC,cAAapD,oBAAsB;MAAAJ,QAAA,eAC1D,IAAAd,WAAA,CAAAoE,GAAA;QAAA,GACMjD,KAAK;QACVmD,IAAI,EAAC,UAAU;QACfjD,SAAS,EAAGA,SAAW;QACvBD,GAAG,EAAGA,GAAK;QAAAN,QAAA,eAEX,IAAAd,WAAA,CAAAoE,GAAA;UAAAtD,QAAA,EAASA;QAAQ,CAAS;MAAC,CACrB;IAAC,CACJ;EAAC,CACkB,CAAC;EAE3B;AACD;;AAEA;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;AACO,MAAMyD,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,IAAAE,mBAAU,EAAE5D,mBAAoB,CAAC;AAAC,IAAA6D,QAAA,GAAAF,OAAA,CAAAH,OAAA,GAE3CE,QAAQ","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  Object.defineProperty(exports, "__esModule", {
@@ -10,6 +11,7 @@ var _htmlEntities = require("@wordpress/html-entities");
10
11
  var _selectControl = require("../select-control");
11
12
  var _useDeprecatedProps = require("../utils/use-deprecated-props");
12
13
  var _context = require("../context");
14
+ var _deprecated36pxSize = require("../utils/deprecated-36px-size");
13
15
  var _jsxRuntime = require("react/jsx-runtime");
14
16
  /**
15
17
  * WordPress dependencies
@@ -36,11 +38,11 @@ function getSelectOptions(tree, level = 0) {
36
38
  }
37
39
 
38
40
  /**
39
- * TreeSelect component is used to generate select input fields.
41
+ * Generates a hierarchical select input.
40
42
  *
41
43
  * ```jsx
44
+ * import { useState } from 'react';
42
45
  * import { TreeSelect } from '@wordpress/components';
43
- * import { useState } from '@wordpress/element';
44
46
  *
45
47
  * const MyTreeSelect = () => {
46
48
  * const [ page, setPage ] = useState( 'p21' );
@@ -48,6 +50,7 @@ function getSelectOptions(tree, level = 0) {
48
50
  * return (
49
51
  * <TreeSelect
50
52
  * __nextHasNoMarginBottom
53
+ * __next40pxDefaultSize
51
54
  * label="Parent page"
52
55
  * noOptionLabel="No parent page"
53
56
  * onChange={ ( newPage ) => setPage( newPage ) }
@@ -98,9 +101,15 @@ function TreeSelect(props) {
98
101
  label: noOptionLabel
99
102
  }, ...getSelectOptions(tree)].filter(option => !!option);
100
103
  }, [noOptionLabel, tree]);
104
+ (0, _deprecated36pxSize.maybeWarnDeprecated36pxSize)({
105
+ componentName: 'TreeSelect',
106
+ size: restProps.size,
107
+ __next40pxDefaultSize: restProps.__next40pxDefaultSize
108
+ });
101
109
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ContextSystemProvider, {
102
110
  value: CONTEXT_VALUE,
103
111
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectControl.SelectControl, {
112
+ __shouldNotWarnDeprecated36pxSize: true,
104
113
  label,
105
114
  options,
106
115
  onChange,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_htmlEntities","_selectControl","_useDeprecatedProps","_context","_jsxRuntime","CONTEXT_VALUE","BaseControl","_overrides","__associatedWPComponentName","getSelectOptions","tree","level","flatMap","treeNode","value","id","label","repeat","decodeEntities","name","children","TreeSelect","props","noOptionLabel","onChange","selectedId","restProps","useDeprecated36pxDefaultSizeProp","options","useMemo","filter","option","jsx","ContextSystemProvider","SelectControl","_default","exports","default"],"sources":["@wordpress/components/src/tree-select/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { SelectControl } from '../select-control';\nimport type { TreeSelectProps, Tree, Truthy } from './types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { ContextSystemProvider } from '../context';\n\nconst CONTEXT_VALUE = {\n\tBaseControl: {\n\t\t// Temporary during deprecation grace period: Overrides the underlying `__associatedWPComponentName`\n\t\t// via the context system to override the value set by SelectControl.\n\t\t_overrides: { __associatedWPComponentName: 'TreeSelect' },\n\t},\n};\n\nfunction getSelectOptions(\n\ttree: Tree[],\n\tlevel = 0\n): NonNullable< TreeSelectProps[ 'options' ] > {\n\treturn tree.flatMap( ( treeNode ) => [\n\t\t{\n\t\t\tvalue: treeNode.id,\n\t\t\tlabel:\n\t\t\t\t'\\u00A0'.repeat( level * 3 ) + decodeEntities( treeNode.name ),\n\t\t},\n\t\t...getSelectOptions( treeNode.children || [], level + 1 ),\n\t] );\n}\n\n/**\n * TreeSelect component is used to generate select input fields.\n *\n * ```jsx\n * import { TreeSelect } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTreeSelect = () => {\n * \tconst [ page, setPage ] = useState( 'p21' );\n *\n * \treturn (\n * \t\t<TreeSelect\n * \t\t\t__nextHasNoMarginBottom\n * \t\t\tlabel=\"Parent page\"\n * \t\t\tnoOptionLabel=\"No parent page\"\n * \t\t\tonChange={ ( newPage ) => setPage( newPage ) }\n * \t\t\tselectedId={ page }\n * \t\t\ttree={ [\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 1',\n * \t\t\t\t\tid: 'p1',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{ name: 'Descend 1 of page 1', id: 'p11' },\n * \t\t\t\t\t\t{ name: 'Descend 2 of page 1', id: 'p12' },\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 2',\n * \t\t\t\t\tid: 'p2',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{\n * \t\t\t\t\t\t\tname: 'Descend 1 of page 2',\n * \t\t\t\t\t\t\tid: 'p21',\n * \t\t\t\t\t\t\tchildren: [\n * \t\t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\t\tname: 'Descend 1 of Descend 1 of page 2',\n * \t\t\t\t\t\t\t\t\tid: 'p211',\n * \t\t\t\t\t\t\t\t},\n * \t\t\t\t\t\t\t],\n * \t\t\t\t\t\t},\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t] }\n * \t\t/>\n * \t);\n * }\n * ```\n */\nexport function TreeSelect( props: TreeSelectProps ) {\n\tconst {\n\t\tlabel,\n\t\tnoOptionLabel,\n\t\tonChange,\n\t\tselectedId,\n\t\ttree = [],\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp( props );\n\n\tconst options = useMemo( () => {\n\t\treturn [\n\t\t\tnoOptionLabel && { value: '', label: noOptionLabel },\n\t\t\t...getSelectOptions( tree ),\n\t\t].filter( < T, >( option: T ): option is Truthy< T > => !! option );\n\t}, [ noOptionLabel, tree ] );\n\n\treturn (\n\t\t<ContextSystemProvider value={ CONTEXT_VALUE }>\n\t\t\t<SelectControl\n\t\t\t\t{ ...{ label, options, onChange } }\n\t\t\t\tvalue={ selectedId }\n\t\t\t\t{ ...restProps }\n\t\t\t/>\n\t\t</ContextSystemProvider>\n\t);\n}\n\nexport default TreeSelect;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAmD,IAAAK,WAAA,GAAAL,OAAA;AAZnD;AACA;AACA;;AAIA;AACA;AACA;;AAMA,MAAMM,aAAa,GAAG;EACrBC,WAAW,EAAE;IACZ;IACA;IACAC,UAAU,EAAE;MAAEC,2BAA2B,E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KAAK,EAAGT,aAAe;IAAAe,QAAA,eAC7C,IAAAhB,WAAA,CAAA4B,GAAA,EAAC/B,cAAA,CAAAiC,aAAa;MACNlB,KAAK;MAAEY,OAAO;MAAEJ,QAAQ;MAC/BV,KAAK,EAAGW,UAAY;MAAA,GACfC;IAAS,CACd;EAAC,CACoB,CAAC;AAE1B;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEchB,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_htmlEntities","_selectControl","_useDeprecatedProps","_context","_deprecated36pxSize","_jsxRuntime","CONTEXT_VALUE","BaseControl","_overrides","__associatedWPComponentName","getSelectOptions","tree","level","flatMap","treeNode","value","id","label","repeat","decodeEntities","name","children","TreeSelect","props","noOptionLabel","onChange","selectedId","restProps","useDeprecated36pxDefaultSizeProp","options","useMemo","filter","option","maybeWarnDeprecated36pxSize","componentName","size","__next40pxDefaultSize","jsx","ContextSystemProvider","SelectControl","__shouldNotWarnDeprecated36pxSize","_default","exports","default"],"sources":["@wordpress/components/src/tree-select/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { SelectControl } from '../select-control';\nimport type { TreeSelectProps, Tree, Truthy } from './types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { ContextSystemProvider } from '../context';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst CONTEXT_VALUE = {\n\tBaseControl: {\n\t\t// Temporary during deprecation grace period: Overrides the underlying `__associatedWPComponentName`\n\t\t// via the context system to override the value set by SelectControl.\n\t\t_overrides: { __associatedWPComponentName: 'TreeSelect' },\n\t},\n};\n\nfunction getSelectOptions(\n\ttree: Tree[],\n\tlevel = 0\n): NonNullable< TreeSelectProps[ 'options' ] > {\n\treturn tree.flatMap( ( treeNode ) => [\n\t\t{\n\t\t\tvalue: treeNode.id,\n\t\t\tlabel:\n\t\t\t\t'\\u00A0'.repeat( level * 3 ) + decodeEntities( treeNode.name ),\n\t\t},\n\t\t...getSelectOptions( treeNode.children || [], level + 1 ),\n\t] );\n}\n\n/**\n * Generates a hierarchical select input.\n *\n * ```jsx\n * import { useState } from 'react';\n * import { TreeSelect } from '@wordpress/components';\n *\n * const MyTreeSelect = () => {\n * \tconst [ page, setPage ] = useState( 'p21' );\n *\n * \treturn (\n * \t\t<TreeSelect\n * \t\t\t__nextHasNoMarginBottom\n * \t\t\t__next40pxDefaultSize\n * \t\t\tlabel=\"Parent page\"\n * \t\t\tnoOptionLabel=\"No parent page\"\n * \t\t\tonChange={ ( newPage ) => setPage( newPage ) }\n * \t\t\tselectedId={ page }\n * \t\t\ttree={ [\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 1',\n * \t\t\t\t\tid: 'p1',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{ name: 'Descend 1 of page 1', id: 'p11' },\n * \t\t\t\t\t\t{ name: 'Descend 2 of page 1', id: 'p12' },\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 2',\n * \t\t\t\t\tid: 'p2',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{\n * \t\t\t\t\t\t\tname: 'Descend 1 of page 2',\n * \t\t\t\t\t\t\tid: 'p21',\n * \t\t\t\t\t\t\tchildren: [\n * \t\t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\t\tname: 'Descend 1 of Descend 1 of page 2',\n * \t\t\t\t\t\t\t\t\tid: 'p211',\n * \t\t\t\t\t\t\t\t},\n * \t\t\t\t\t\t\t],\n * \t\t\t\t\t\t},\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t] }\n * \t\t/>\n * \t);\n * }\n * ```\n */\nexport function TreeSelect( props: TreeSelectProps ) {\n\tconst {\n\t\tlabel,\n\t\tnoOptionLabel,\n\t\tonChange,\n\t\tselectedId,\n\t\ttree = [],\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp( props );\n\n\tconst options = useMemo( () => {\n\t\treturn [\n\t\t\tnoOptionLabel && { value: '', label: noOptionLabel },\n\t\t\t...getSelectOptions( tree ),\n\t\t].filter( < T, >( option: T ): option is Truthy< T > => !! option );\n\t}, [ noOptionLabel, tree ] );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'TreeSelect',\n\t\tsize: restProps.size,\n\t\t__next40pxDefaultSize: restProps.__next40pxDefaultSize,\n\t} );\n\n\treturn (\n\t\t<ContextSystemProvider value={ CONTEXT_VALUE }>\n\t\t\t<SelectControl\n\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t{ ...{ label, options, onChange } }\n\t\t\t\tvalue={ selectedId }\n\t\t\t\t{ ...restProps }\n\t\t\t/>\n\t\t</ContextSystemProvider>\n\t);\n}\n\nexport default TreeSelect;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AAA4E,IAAAM,WAAA,GAAAN,OAAA;AAb5E;AACA;AACA;;AAIA;AACA;AACA;;AAOA,MAAMO,aAAa,GAAG;EACrBC,WAAW,EAAE;IACZ;IACA;IACAC,UAAU,EAAE;MAAEC,2BAA2B,EAAE;IAAa;EACzD;AACD,CAAC;AAED,SAASC,gBAAgBA,CACxBC,IAAY,EACZC,KAAK,GAAG,CAAC,EACqC;EAC9C,OAAOD,IAAI,CAACE,OAAO,CAAIC,QAAQ,IAAM,CACpC;IACCC,KAAK,EAAED,QAAQ,CAACE,EAAE;IAClBC,KAAK,EACJ,QAAQ,CAACC,MAAM,CAAEN,KAAK,GAAG,CAAE,CAAC,GAAG,IA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1BvB,KAAK;MAAEY,OAAO;MAAEJ,QAAQ;MAC/BV,KAAK,EAAGW,UAAY;MAAA,GACfC;IAAS,CACd;EAAC,CACoB,CAAC;AAE1B;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcrB,UAAU","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/tree-select/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { SelectControlSingleSelectionProps } from '../select-control/types';\n\nexport type Truthy< T > = T extends false | '' | 0 | null | undefined\n\t? never\n\t: T;\n\nexport interface Tree {\n\tid: string;\n\tname: string;\n\tchildren?: Tree[];\n}\n\n// `TreeSelect` inherits props from `SelectControl`, but only\n// in single selection mode (ie. when the `multiple` prop is not defined).\nexport interface TreeSelectProps\n\textends Omit< SelectControlSingleSelectionProps, 'value' | 'multiple' > {\n\t/**\n\t * If this property is added, an option will be added with this label to represent empty selection.\n\t */\n\tnoOptionLabel?: string;\n\t/**\n\t * An array containing the tree objects with the possible nodes the user can select.\n\t */\n\ttree?: Tree[];\n\t/**\n\t * The id of the currently selected node.\n\t */\n\tselectedId?: SelectControlSingleSelectionProps[ 'value' ];\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/tree-select/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { SelectControlSingleSelectionProps } from '../select-control/types';\n\nexport type Truthy< T > = T extends false | '' | 0 | null | undefined\n\t? never\n\t: T;\n\nexport interface Tree {\n\tid: string;\n\tname: string;\n\tchildren?: Tree[];\n}\n\n// `TreeSelect` inherits props from `SelectControl`, but only\n// in single selection mode (ie. when the `multiple` prop is not defined).\nexport interface TreeSelectProps\n\textends Omit<\n\t\tSelectControlSingleSelectionProps,\n\t\t'value' | 'multiple' | 'onChange'\n\t> {\n\t/**\n\t * If this property is added, an option will be added with this label to represent empty selection.\n\t */\n\tnoOptionLabel?: string;\n\t/**\n\t * A function that receives the value of the new option that is being selected as input.\n\t */\n\tonChange?: SelectControlSingleSelectionProps[ 'onChange' ];\n\t/**\n\t * An array containing the tree objects with the possible nodes the user can select.\n\t */\n\ttree?: Tree[];\n\t/**\n\t * The id of the currently selected node.\n\t */\n\tselectedId?: SelectControlSingleSelectionProps[ 'value' ];\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");