@wordpress/components 23.4.0 → 23.6.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 (978) hide show
  1. package/CHANGELOG.md +54 -6
  2. package/build/animate/index.js +3 -1
  3. package/build/animate/index.js.map +1 -1
  4. package/build/animation/index.js.map +1 -1
  5. package/build/autocomplete/autocompleter-ui.js +46 -22
  6. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  7. package/build/autocomplete/get-default-use-items.js.map +1 -1
  8. package/build/autocomplete/index.js +51 -119
  9. package/build/autocomplete/index.js.map +1 -1
  10. package/build/autocomplete/types.js +6 -0
  11. package/build/autocomplete/types.js.map +1 -0
  12. package/build/circular-option-picker/index.js +63 -14
  13. package/build/circular-option-picker/index.js.map +1 -1
  14. package/build/circular-option-picker/types.js +6 -0
  15. package/build/circular-option-picker/types.js.map +1 -0
  16. package/build/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  17. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  18. package/build/custom-gradient-picker/gradient-bar/index.js +2 -0
  19. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  20. package/build/custom-gradient-picker/gradient-bar/utils.js +2 -0
  21. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  22. package/build/custom-gradient-picker/index.js +2 -0
  23. package/build/custom-gradient-picker/index.js.map +1 -1
  24. package/build/custom-gradient-picker/serializer.js +1 -0
  25. package/build/custom-gradient-picker/serializer.js.map +1 -1
  26. package/build/custom-gradient-picker/utils.js +2 -0
  27. package/build/custom-gradient-picker/utils.js.map +1 -1
  28. package/build/dimension-control/index.js +31 -5
  29. package/build/dimension-control/index.js.map +1 -1
  30. package/build/dimension-control/sizes.js +2 -4
  31. package/build/dimension-control/sizes.js.map +1 -1
  32. package/build/dimension-control/types.js +6 -0
  33. package/build/dimension-control/types.js.map +1 -0
  34. package/build/dropdown-menu/index.js +6 -2
  35. package/build/dropdown-menu/index.js.map +1 -1
  36. package/build/flex/flex/hook.js +3 -3
  37. package/build/flex/flex/hook.js.map +1 -1
  38. package/build/font-size-picker/index.js +2 -1
  39. package/build/font-size-picker/index.js.map +1 -1
  40. package/build/form-token-field/index.js +1 -1
  41. package/build/form-token-field/index.js.map +1 -1
  42. package/build/gradient-picker/index.js +2 -0
  43. package/build/gradient-picker/index.js.map +1 -1
  44. package/build/guide/icons.js.map +1 -1
  45. package/build/guide/index.js +46 -8
  46. package/build/guide/index.js.map +1 -1
  47. package/build/guide/page-control.js.map +1 -1
  48. package/build/guide/page.js.map +1 -1
  49. package/build/guide/types.js +6 -0
  50. package/build/guide/types.js.map +1 -0
  51. package/build/h-stack/utils.js +5 -5
  52. package/build/h-stack/utils.js.map +1 -1
  53. package/build/higher-order/navigate-regions/index.js +33 -3
  54. package/build/higher-order/navigate-regions/index.js.map +1 -1
  55. package/build/higher-order/with-constrained-tabbing/index.js +9 -0
  56. package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
  57. package/build/higher-order/with-fallback-styles/index.js +2 -2
  58. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  59. package/build/higher-order/with-filters/index.js +31 -7
  60. package/build/higher-order/with-filters/index.js.map +1 -1
  61. package/build/higher-order/with-focus-return/index.js +10 -10
  62. package/build/higher-order/with-focus-return/index.js.map +1 -1
  63. package/build/higher-order/with-notices/index.js +28 -25
  64. package/build/higher-order/with-notices/index.js.map +1 -1
  65. package/build/higher-order/with-notices/types.js +6 -0
  66. package/build/higher-order/with-notices/types.js.map +1 -0
  67. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  68. package/build/icon/index.js +1 -8
  69. package/build/icon/index.js.map +1 -1
  70. package/build/index.native.js +18 -9
  71. package/build/index.native.js.map +1 -1
  72. package/build/mobile/bottom-sheet/cell.native.js +1 -1
  73. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  74. package/build/mobile/bottom-sheet-text-control/index.native.js +4 -3
  75. package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  76. package/build/mobile/global-styles-context/utils.native.js +2 -1
  77. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  78. package/build/navigation/back-button/index.js +6 -5
  79. package/build/navigation/back-button/index.js.map +1 -1
  80. package/build/navigation/constants.js.map +1 -1
  81. package/build/navigation/context.js +7 -4
  82. package/build/navigation/context.js.map +1 -1
  83. package/build/navigation/group/context.js.map +1 -1
  84. package/build/navigation/group/index.js +5 -1
  85. package/build/navigation/group/index.js.map +1 -1
  86. package/build/navigation/index.js +49 -3
  87. package/build/navigation/index.js.map +1 -1
  88. package/build/navigation/item/base-content.js +0 -1
  89. package/build/navigation/item/base-content.js.map +1 -1
  90. package/build/navigation/item/base.js.map +1 -1
  91. package/build/navigation/item/index.js +5 -1
  92. package/build/navigation/item/index.js.map +1 -1
  93. package/build/navigation/item/use-navigation-tree-item.js +1 -1
  94. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  95. package/build/navigation/menu/context.js.map +1 -1
  96. package/build/navigation/menu/index.js +5 -1
  97. package/build/navigation/menu/index.js.map +1 -1
  98. package/build/navigation/menu/menu-title-search.js +8 -6
  99. package/build/navigation/menu/menu-title-search.js.map +1 -1
  100. package/build/navigation/menu/menu-title.js +4 -2
  101. package/build/navigation/menu/menu-title.js.map +1 -1
  102. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  103. package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  104. package/build/navigation/styles/navigation-styles.js +36 -36
  105. package/build/navigation/styles/navigation-styles.js.map +1 -1
  106. package/build/navigation/types.js +6 -0
  107. package/build/navigation/types.js.map +1 -0
  108. package/build/navigation/use-create-navigation-tree.js +7 -0
  109. package/build/navigation/use-create-navigation-tree.js.map +1 -1
  110. package/build/navigation/use-navigation-tree-nodes.js +3 -5
  111. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  112. package/build/navigation/utils.js.map +1 -1
  113. package/build/navigator/navigator-screen/component.js +5 -3
  114. package/build/navigator/navigator-screen/component.js.map +1 -1
  115. package/build/number-control/index.js +1 -3
  116. package/build/number-control/index.js.map +1 -1
  117. package/build/palette-edit/index.js +67 -27
  118. package/build/palette-edit/index.js.map +1 -1
  119. package/build/palette-edit/types.js +6 -0
  120. package/build/palette-edit/types.js.map +1 -0
  121. package/build/panel/body.js +15 -17
  122. package/build/panel/body.js.map +1 -1
  123. package/build/placeholder/index.js.map +1 -1
  124. package/build/query-controls/author-select.js +0 -4
  125. package/build/query-controls/author-select.js.map +1 -1
  126. package/build/query-controls/category-select.js +0 -4
  127. package/build/query-controls/category-select.js.map +1 -1
  128. package/build/query-controls/terms.js +30 -15
  129. package/build/query-controls/terms.js.map +1 -1
  130. package/build/range-control/index.js +1 -0
  131. package/build/range-control/index.js.map +1 -1
  132. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  133. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  134. package/build/responsive-wrapper/index.js +12 -13
  135. package/build/responsive-wrapper/index.js.map +1 -1
  136. package/build/select-control/index.js +19 -16
  137. package/build/select-control/index.js.map +1 -1
  138. package/build/toolbar/toolbar-button/index.js +32 -10
  139. package/build/toolbar/toolbar-button/index.js.map +1 -1
  140. package/build/toolbar/toolbar-button/toolbar-button-container.js +12 -4
  141. package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  142. package/build/toolbar/toolbar-button/types.js +6 -0
  143. package/build/toolbar/toolbar-button/types.js.map +1 -0
  144. package/build/toolbar/toolbar-context/index.js +4 -2
  145. package/build/toolbar/toolbar-context/index.js.map +1 -1
  146. package/build/tools-panel/context.js +2 -0
  147. package/build/tools-panel/context.js.map +1 -1
  148. package/build/tools-panel/tools-panel/hook.js +18 -12
  149. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  150. package/build/tools-panel/tools-panel-item/hook.js +14 -2
  151. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  152. package/build/tooltip/index.js +18 -6
  153. package/build/tooltip/index.js.map +1 -1
  154. package/build/tree-select/index.js.map +1 -1
  155. package/build/ui/context/context-system-provider.js +8 -4
  156. package/build/ui/context/context-system-provider.js.map +1 -1
  157. package/build/ui/context/get-styled-class-name-from-key.js +2 -2
  158. package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
  159. package/build/utils/font.js +3 -7
  160. package/build/utils/font.js.map +1 -1
  161. package/build/v-stack/hook.js +2 -0
  162. package/build/v-stack/hook.js.map +1 -1
  163. package/build-module/animate/index.js +3 -1
  164. package/build-module/animate/index.js.map +1 -1
  165. package/build-module/animation/index.js.map +1 -1
  166. package/build-module/autocomplete/autocompleter-ui.js +45 -24
  167. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  168. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  169. package/build-module/autocomplete/index.js +54 -122
  170. package/build-module/autocomplete/index.js.map +1 -1
  171. package/build-module/autocomplete/types.js +2 -0
  172. package/build-module/autocomplete/types.js.map +1 -0
  173. package/build-module/circular-option-picker/index.js +59 -16
  174. package/build-module/circular-option-picker/index.js.map +1 -1
  175. package/build-module/circular-option-picker/types.js +2 -0
  176. package/build-module/circular-option-picker/types.js.map +1 -0
  177. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  178. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  179. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
  180. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  181. package/build-module/custom-gradient-picker/gradient-bar/utils.js +2 -0
  182. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  183. package/build-module/custom-gradient-picker/index.js +1 -0
  184. package/build-module/custom-gradient-picker/index.js.map +1 -1
  185. package/build-module/custom-gradient-picker/serializer.js +1 -0
  186. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  187. package/build-module/custom-gradient-picker/utils.js +2 -0
  188. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  189. package/build-module/dimension-control/index.js +28 -3
  190. package/build-module/dimension-control/index.js.map +1 -1
  191. package/build-module/dimension-control/sizes.js +6 -5
  192. package/build-module/dimension-control/sizes.js.map +1 -1
  193. package/build-module/dimension-control/types.js +2 -0
  194. package/build-module/dimension-control/types.js.map +1 -0
  195. package/build-module/dropdown-menu/index.js +6 -2
  196. package/build-module/dropdown-menu/index.js.map +1 -1
  197. package/build-module/flex/flex/hook.js +3 -3
  198. package/build-module/flex/flex/hook.js.map +1 -1
  199. package/build-module/font-size-picker/index.js +2 -1
  200. package/build-module/font-size-picker/index.js.map +1 -1
  201. package/build-module/form-token-field/index.js +1 -1
  202. package/build-module/form-token-field/index.js.map +1 -1
  203. package/build-module/gradient-picker/index.js +1 -0
  204. package/build-module/gradient-picker/index.js.map +1 -1
  205. package/build-module/guide/icons.js.map +1 -1
  206. package/build-module/guide/index.js +45 -8
  207. package/build-module/guide/index.js.map +1 -1
  208. package/build-module/guide/page-control.js.map +1 -1
  209. package/build-module/guide/page.js +4 -0
  210. package/build-module/guide/page.js.map +1 -1
  211. package/build-module/guide/types.js +2 -0
  212. package/build-module/guide/types.js.map +1 -0
  213. package/build-module/h-stack/utils.js +5 -5
  214. package/build-module/h-stack/utils.js.map +1 -1
  215. package/build-module/higher-order/navigate-regions/index.js +33 -3
  216. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  217. package/build-module/higher-order/with-constrained-tabbing/index.js +9 -0
  218. package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
  219. package/build-module/higher-order/with-fallback-styles/index.js +2 -2
  220. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  221. package/build-module/higher-order/with-filters/index.js +31 -7
  222. package/build-module/higher-order/with-filters/index.js.map +1 -1
  223. package/build-module/higher-order/with-focus-return/index.js +10 -10
  224. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  225. package/build-module/higher-order/with-notices/index.js +29 -26
  226. package/build-module/higher-order/with-notices/index.js.map +1 -1
  227. package/build-module/higher-order/with-notices/types.js +2 -0
  228. package/build-module/higher-order/with-notices/types.js.map +1 -0
  229. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  230. package/build-module/icon/index.js +2 -9
  231. package/build-module/icon/index.js.map +1 -1
  232. package/build-module/index.native.js +1 -0
  233. package/build-module/index.native.js.map +1 -1
  234. package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
  235. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  236. package/build-module/mobile/bottom-sheet-text-control/index.native.js +4 -3
  237. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  238. package/build-module/mobile/global-styles-context/utils.native.js +2 -1
  239. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  240. package/build-module/navigation/back-button/index.js +4 -3
  241. package/build-module/navigation/back-button/index.js.map +1 -1
  242. package/build-module/navigation/constants.js.map +1 -1
  243. package/build-module/navigation/context.js +7 -4
  244. package/build-module/navigation/context.js.map +1 -1
  245. package/build-module/navigation/group/context.js +4 -0
  246. package/build-module/navigation/group/context.js.map +1 -1
  247. package/build-module/navigation/group/index.js +2 -1
  248. package/build-module/navigation/group/index.js.map +1 -1
  249. package/build-module/navigation/index.js +46 -3
  250. package/build-module/navigation/index.js.map +1 -1
  251. package/build-module/navigation/item/base-content.js +0 -1
  252. package/build-module/navigation/item/base-content.js.map +1 -1
  253. package/build-module/navigation/item/base.js.map +1 -1
  254. package/build-module/navigation/item/index.js +2 -1
  255. package/build-module/navigation/item/index.js.map +1 -1
  256. package/build-module/navigation/item/use-navigation-tree-item.js +1 -1
  257. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  258. package/build-module/navigation/menu/context.js +4 -0
  259. package/build-module/navigation/menu/context.js.map +1 -1
  260. package/build-module/navigation/menu/index.js +2 -1
  261. package/build-module/navigation/menu/index.js.map +1 -1
  262. package/build-module/navigation/menu/menu-title-search.js +8 -6
  263. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  264. package/build-module/navigation/menu/menu-title.js +4 -2
  265. package/build-module/navigation/menu/menu-title.js.map +1 -1
  266. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  267. package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  268. package/build-module/navigation/styles/navigation-styles.js +36 -36
  269. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  270. package/build-module/navigation/types.js +2 -0
  271. package/build-module/navigation/types.js.map +1 -0
  272. package/build-module/navigation/use-create-navigation-tree.js +7 -0
  273. package/build-module/navigation/use-create-navigation-tree.js.map +1 -1
  274. package/build-module/navigation/use-navigation-tree-nodes.js +2 -2
  275. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  276. package/build-module/navigation/utils.js.map +1 -1
  277. package/build-module/navigator/navigator-screen/component.js +5 -3
  278. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  279. package/build-module/number-control/index.js +1 -3
  280. package/build-module/number-control/index.js.map +1 -1
  281. package/build-module/palette-edit/index.js +65 -27
  282. package/build-module/palette-edit/index.js.map +1 -1
  283. package/build-module/palette-edit/types.js +2 -0
  284. package/build-module/palette-edit/types.js.map +1 -0
  285. package/build-module/panel/body.js +12 -12
  286. package/build-module/panel/body.js.map +1 -1
  287. package/build-module/placeholder/index.js.map +1 -1
  288. package/build-module/query-controls/author-select.js +0 -4
  289. package/build-module/query-controls/author-select.js.map +1 -1
  290. package/build-module/query-controls/category-select.js +1 -5
  291. package/build-module/query-controls/category-select.js.map +1 -1
  292. package/build-module/query-controls/terms.js +29 -16
  293. package/build-module/query-controls/terms.js.map +1 -1
  294. package/build-module/range-control/index.js +1 -0
  295. package/build-module/range-control/index.js.map +1 -1
  296. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +5 -5
  297. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  298. package/build-module/responsive-wrapper/index.js +12 -12
  299. package/build-module/responsive-wrapper/index.js.map +1 -1
  300. package/build-module/select-control/index.js +20 -17
  301. package/build-module/select-control/index.js.map +1 -1
  302. package/build-module/toolbar/toolbar-button/index.js +32 -9
  303. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  304. package/build-module/toolbar/toolbar-button/toolbar-button-container.js +12 -4
  305. package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  306. package/build-module/toolbar/toolbar-button/types.js +2 -0
  307. package/build-module/toolbar/toolbar-button/types.js.map +1 -0
  308. package/build-module/toolbar/toolbar-context/index.js +4 -2
  309. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  310. package/build-module/tools-panel/context.js +2 -0
  311. package/build-module/tools-panel/context.js.map +1 -1
  312. package/build-module/tools-panel/tools-panel/hook.js +18 -12
  313. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  314. package/build-module/tools-panel/tools-panel-item/hook.js +14 -2
  315. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  316. package/build-module/tooltip/index.js +16 -6
  317. package/build-module/tooltip/index.js.map +1 -1
  318. package/build-module/tree-select/index.js.map +1 -1
  319. package/build-module/ui/context/context-system-provider.js +7 -4
  320. package/build-module/ui/context/context-system-provider.js.map +1 -1
  321. package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
  322. package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
  323. package/build-module/utils/font.js +3 -6
  324. package/build-module/utils/font.js.map +1 -1
  325. package/build-module/v-stack/hook.js +2 -0
  326. package/build-module/v-stack/hook.js.map +1 -1
  327. package/build-style/style-rtl.css +15 -11
  328. package/build-style/style.css +15 -11
  329. package/build-types/alignment-matrix-control/types.d.ts +4 -4
  330. package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
  331. package/build-types/angle-picker-control/types.d.ts +2 -2
  332. package/build-types/angle-picker-control/types.d.ts.map +1 -1
  333. package/build-types/animate/index.d.ts +2 -2
  334. package/build-types/animate/index.d.ts.map +1 -1
  335. package/build-types/animation/index.d.ts +8 -1
  336. package/build-types/animation/index.d.ts.map +1 -1
  337. package/build-types/autocomplete/autocompleter-ui.d.ts +4 -0
  338. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -0
  339. package/build-types/autocomplete/get-default-use-items.d.ts +3 -0
  340. package/build-types/autocomplete/get-default-use-items.d.ts.map +1 -0
  341. package/build-types/autocomplete/index.d.ts +23 -0
  342. package/build-types/autocomplete/index.d.ts.map +1 -0
  343. package/build-types/autocomplete/test/index.d.ts +2 -0
  344. package/build-types/autocomplete/test/index.d.ts.map +1 -0
  345. package/build-types/autocomplete/types.d.ts +201 -0
  346. package/build-types/autocomplete/types.d.ts.map +1 -0
  347. package/build-types/base-control/types.d.ts +2 -2
  348. package/build-types/base-control/types.d.ts.map +1 -1
  349. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  350. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  351. package/build-types/border-box-control/styles.d.ts +3 -3
  352. package/build-types/border-box-control/styles.d.ts.map +1 -1
  353. package/build-types/border-box-control/types.d.ts +8 -8
  354. package/build-types/border-box-control/types.d.ts.map +1 -1
  355. package/build-types/border-box-control/utils.d.ts +5 -5
  356. package/build-types/border-box-control/utils.d.ts.map +1 -1
  357. package/build-types/border-control/border-control/hook.d.ts +3 -3
  358. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  359. package/build-types/border-control/border-control-dropdown/hook.d.ts +2 -2
  360. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  361. package/build-types/border-control/styles.d.ts +4 -4
  362. package/build-types/border-control/styles.d.ts.map +1 -1
  363. package/build-types/border-control/types.d.ts +6 -6
  364. package/build-types/border-control/types.d.ts.map +1 -1
  365. package/build-types/box-control/types.d.ts +6 -6
  366. package/build-types/box-control/types.d.ts.map +1 -1
  367. package/build-types/button/deprecated.d.ts +6 -6
  368. package/build-types/button/types.d.ts +10 -10
  369. package/build-types/button/types.d.ts.map +1 -1
  370. package/build-types/button-group/types.d.ts +1 -1
  371. package/build-types/button-group/types.d.ts.map +1 -1
  372. package/build-types/card/card/hook.d.ts +1 -1
  373. package/build-types/card/card/hook.d.ts.map +1 -1
  374. package/build-types/card/types.d.ts +10 -10
  375. package/build-types/card/types.d.ts.map +1 -1
  376. package/build-types/checkbox-control/types.d.ts +1 -1
  377. package/build-types/checkbox-control/types.d.ts.map +1 -1
  378. package/build-types/circular-option-picker/index.d.ts +56 -7
  379. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  380. package/build-types/circular-option-picker/stories/index.d.ts +14 -0
  381. package/build-types/circular-option-picker/stories/index.d.ts.map +1 -0
  382. package/build-types/circular-option-picker/types.d.ts +49 -0
  383. package/build-types/circular-option-picker/types.d.ts.map +1 -0
  384. package/build-types/color-indicator/types.d.ts +1 -1
  385. package/build-types/color-indicator/types.d.ts.map +1 -1
  386. package/build-types/color-list-picker/types.d.ts +2 -2
  387. package/build-types/color-list-picker/types.d.ts.map +1 -1
  388. package/build-types/color-palette/types.d.ts +7 -7
  389. package/build-types/color-palette/types.d.ts.map +1 -1
  390. package/build-types/color-palette/utils.d.ts +1 -1
  391. package/build-types/color-palette/utils.d.ts.map +1 -1
  392. package/build-types/color-picker/legacy-adapter.d.ts +1 -1
  393. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  394. package/build-types/color-picker/styles.d.ts +3 -3
  395. package/build-types/color-picker/types.d.ts +2 -2
  396. package/build-types/color-picker/types.d.ts.map +1 -1
  397. package/build-types/color-picker/use-deprecated-props.d.ts +2 -2
  398. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  399. package/build-types/combobox-control/types.d.ts +2 -2
  400. package/build-types/combobox-control/types.d.ts.map +1 -1
  401. package/build-types/confirm-dialog/component.d.ts +4 -4
  402. package/build-types/confirm-dialog/types.d.ts +5 -5
  403. package/build-types/confirm-dialog/types.d.ts.map +1 -1
  404. package/build-types/custom-gradient-picker/constants.d.ts +25 -0
  405. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -0
  406. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +8 -0
  407. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -0
  408. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +25 -0
  409. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -0
  410. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +10 -0
  411. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -0
  412. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +138 -0
  413. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -0
  414. package/build-types/custom-gradient-picker/index.d.ts +7 -0
  415. package/build-types/custom-gradient-picker/index.d.ts.map +1 -0
  416. package/build-types/custom-gradient-picker/serializer.d.ts +17 -0
  417. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -0
  418. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +11 -0
  419. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -0
  420. package/build-types/custom-gradient-picker/utils.d.ts +5 -0
  421. package/build-types/custom-gradient-picker/utils.d.ts.map +1 -0
  422. package/build-types/custom-select-control/styles.d.ts +1 -1
  423. package/build-types/custom-select-control/styles.d.ts.map +1 -1
  424. package/build-types/dashicon/types.d.ts +2 -2
  425. package/build-types/dashicon/types.d.ts.map +1 -1
  426. package/build-types/date-time/date-time/styles.d.ts +1 -4
  427. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  428. package/build-types/date-time/time/styles.d.ts +1 -1
  429. package/build-types/date-time/types.d.ts +4 -4
  430. package/build-types/date-time/types.d.ts.map +1 -1
  431. package/build-types/dimension-control/index.d.ts +28 -0
  432. package/build-types/dimension-control/index.d.ts.map +1 -0
  433. package/build-types/dimension-control/sizes.d.ts +26 -0
  434. package/build-types/dimension-control/sizes.d.ts.map +1 -0
  435. package/build-types/dimension-control/stories/index.d.ts +12 -0
  436. package/build-types/dimension-control/stories/index.d.ts.map +1 -0
  437. package/build-types/dimension-control/types.d.ts +47 -0
  438. package/build-types/dimension-control/types.d.ts.map +1 -0
  439. package/build-types/divider/types.d.ts +1 -1
  440. package/build-types/divider/types.d.ts.map +1 -1
  441. package/build-types/draggable/types.d.ts +1 -1
  442. package/build-types/draggable/types.d.ts.map +1 -1
  443. package/build-types/drop-zone/types.d.ts +2 -2
  444. package/build-types/drop-zone/types.d.ts.map +1 -1
  445. package/build-types/dropdown/types.d.ts +3 -3
  446. package/build-types/dropdown/types.d.ts.map +1 -1
  447. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  448. package/build-types/elevation/types.d.ts +1 -1
  449. package/build-types/elevation/types.d.ts.map +1 -1
  450. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  451. package/build-types/external-link/types.d.ts +1 -1
  452. package/build-types/external-link/types.d.ts.map +1 -1
  453. package/build-types/flex/types.d.ts +4 -4
  454. package/build-types/flex/types.d.ts.map +1 -1
  455. package/build-types/focal-point-picker/types.d.ts +7 -7
  456. package/build-types/focal-point-picker/types.d.ts.map +1 -1
  457. package/build-types/font-size-picker/index.d.ts.map +1 -1
  458. package/build-types/font-size-picker/stories/index.d.ts.map +1 -1
  459. package/build-types/font-size-picker/types.d.ts +9 -5
  460. package/build-types/font-size-picker/types.d.ts.map +1 -1
  461. package/build-types/form-file-upload/types.d.ts +1 -1
  462. package/build-types/form-file-upload/types.d.ts.map +1 -1
  463. package/build-types/form-toggle/types.d.ts +1 -1
  464. package/build-types/form-toggle/types.d.ts.map +1 -1
  465. package/build-types/form-token-field/index.d.ts.map +1 -1
  466. package/build-types/form-token-field/stories/index.d.ts +6 -0
  467. package/build-types/form-token-field/stories/index.d.ts.map +1 -1
  468. package/build-types/form-token-field/styles.d.ts +1 -1
  469. package/build-types/form-token-field/styles.d.ts.map +1 -1
  470. package/build-types/form-token-field/types.d.ts +1 -1
  471. package/build-types/form-token-field/types.d.ts.map +1 -1
  472. package/build-types/gradient-picker/index.d.ts +12 -0
  473. package/build-types/gradient-picker/index.d.ts.map +1 -0
  474. package/build-types/grid/types.d.ts +2 -2
  475. package/build-types/grid/types.d.ts.map +1 -1
  476. package/build-types/guide/icons.d.ts +5 -0
  477. package/build-types/guide/icons.d.ts.map +1 -0
  478. package/build-types/guide/index.d.ts +37 -0
  479. package/build-types/guide/index.d.ts.map +1 -0
  480. package/build-types/guide/page-control.d.ts +4 -0
  481. package/build-types/guide/page-control.d.ts.map +1 -0
  482. package/build-types/guide/page.d.ts +7 -0
  483. package/build-types/guide/page.d.ts.map +1 -0
  484. package/build-types/guide/stories/index.d.ts +9 -0
  485. package/build-types/guide/stories/index.d.ts.map +1 -0
  486. package/build-types/guide/test/index.d.ts +2 -0
  487. package/build-types/guide/test/index.d.ts.map +1 -0
  488. package/build-types/guide/types.d.ts +65 -0
  489. package/build-types/guide/types.d.ts.map +1 -0
  490. package/build-types/h-stack/stories/e2e/index.d.ts +9 -0
  491. package/build-types/h-stack/stories/e2e/index.d.ts.map +1 -0
  492. package/build-types/h-stack/types.d.ts +6 -6
  493. package/build-types/h-stack/types.d.ts.map +1 -1
  494. package/build-types/heading/hook.d.ts +1 -1
  495. package/build-types/heading/types.d.ts +2 -2
  496. package/build-types/heading/types.d.ts.map +1 -1
  497. package/build-types/higher-order/navigate-regions/index.d.ts +46 -0
  498. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -0
  499. package/build-types/higher-order/with-constrained-tabbing/index.d.ts +10 -1
  500. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
  501. package/build-types/higher-order/with-fallback-styles/index.d.ts +44 -0
  502. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -0
  503. package/build-types/higher-order/with-filters/index.d.ts +89 -0
  504. package/build-types/higher-order/with-filters/index.d.ts.map +1 -0
  505. package/build-types/higher-order/with-filters/test/index.d.ts +2 -0
  506. package/build-types/higher-order/with-filters/test/index.d.ts.map +1 -0
  507. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  508. package/build-types/higher-order/with-focus-return/index.d.ts +20 -0
  509. package/build-types/higher-order/with-focus-return/index.d.ts.map +1 -0
  510. package/build-types/higher-order/with-focus-return/test/index.d.ts +2 -0
  511. package/build-types/higher-order/with-focus-return/test/index.d.ts.map +1 -0
  512. package/build-types/higher-order/with-notices/index.d.ts +37 -0
  513. package/build-types/higher-order/with-notices/index.d.ts.map +1 -0
  514. package/build-types/higher-order/with-notices/test/index.d.ts +2 -0
  515. package/build-types/higher-order/with-notices/test/index.d.ts.map +1 -0
  516. package/build-types/higher-order/with-notices/types.d.ts +34 -0
  517. package/build-types/higher-order/with-notices/types.d.ts.map +1 -0
  518. package/build-types/higher-order/with-spoken-messages/index.d.ts +13 -2
  519. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  520. package/build-types/higher-order/with-spoken-messages/test/index.d.ts +2 -0
  521. package/build-types/higher-order/with-spoken-messages/test/index.d.ts.map +1 -0
  522. package/build-types/icon/index.d.ts +10 -6
  523. package/build-types/icon/index.d.ts.map +1 -1
  524. package/build-types/icon/test/index.d.ts +2 -0
  525. package/build-types/icon/test/index.d.ts.map +1 -0
  526. package/build-types/input-control/reducer/actions.d.ts +15 -15
  527. package/build-types/input-control/reducer/actions.d.ts.map +1 -1
  528. package/build-types/input-control/reducer/state.d.ts +1 -1
  529. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  530. package/build-types/input-control/styles/input-control-styles.d.ts +4 -4
  531. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  532. package/build-types/input-control/types.d.ts +7 -7
  533. package/build-types/input-control/types.d.ts.map +1 -1
  534. package/build-types/item-group/item/hook.d.ts +1 -1
  535. package/build-types/item-group/types.d.ts +2 -2
  536. package/build-types/item-group/types.d.ts.map +1 -1
  537. package/build-types/keyboard-shortcuts/types.d.ts +3 -3
  538. package/build-types/keyboard-shortcuts/types.d.ts.map +1 -1
  539. package/build-types/menu-group/types.d.ts +1 -1
  540. package/build-types/menu-group/types.d.ts.map +1 -1
  541. package/build-types/menu-item/index.d.ts +1 -1
  542. package/build-types/menu-items-choice/types.d.ts +2 -2
  543. package/build-types/menu-items-choice/types.d.ts.map +1 -1
  544. package/build-types/modal/types.d.ts +1 -1
  545. package/build-types/modal/types.d.ts.map +1 -1
  546. package/build-types/navigable-container/container.d.ts +1 -1
  547. package/build-types/navigable-container/menu.d.ts +1 -1
  548. package/build-types/navigable-container/tabbable.d.ts +1 -1
  549. package/build-types/navigation/back-button/index.d.ts +5 -0
  550. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  551. package/build-types/navigation/constants.d.ts +3 -0
  552. package/build-types/navigation/constants.d.ts.map +1 -0
  553. package/build-types/navigation/context.d.ts +5 -0
  554. package/build-types/navigation/context.d.ts.map +1 -0
  555. package/build-types/navigation/group/context.d.ts +8 -0
  556. package/build-types/navigation/group/context.d.ts.map +1 -0
  557. package/build-types/navigation/group/index.d.ts +5 -0
  558. package/build-types/navigation/group/index.d.ts.map +1 -0
  559. package/build-types/navigation/index.d.ts +46 -0
  560. package/build-types/navigation/index.d.ts.map +1 -0
  561. package/build-types/navigation/item/base-content.d.ts +4 -0
  562. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  563. package/build-types/navigation/item/base.d.ts +4 -0
  564. package/build-types/navigation/item/base.d.ts.map +1 -0
  565. package/build-types/navigation/item/index.d.ts +5 -0
  566. package/build-types/navigation/item/index.d.ts.map +1 -0
  567. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  568. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  569. package/build-types/navigation/menu/context.d.ts +8 -0
  570. package/build-types/navigation/menu/context.d.ts.map +1 -0
  571. package/build-types/navigation/menu/index.d.ts +5 -0
  572. package/build-types/navigation/menu/index.d.ts.map +1 -0
  573. package/build-types/navigation/menu/menu-title-search.d.ts +4 -0
  574. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  575. package/build-types/navigation/menu/menu-title.d.ts +4 -0
  576. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  577. package/build-types/navigation/menu/search-no-results-found.d.ts +4 -0
  578. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  579. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  580. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  581. package/build-types/navigation/stories/index.d.ts +18 -0
  582. package/build-types/navigation/stories/index.d.ts.map +1 -0
  583. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  584. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  585. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  586. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  587. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  588. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  589. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  590. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  591. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  592. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  593. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  594. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  595. package/build-types/navigation/styles/navigation-styles.d.ts +58 -0
  596. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  597. package/build-types/navigation/test/index.d.ts +2 -0
  598. package/build-types/navigation/test/index.d.ts.map +1 -0
  599. package/build-types/navigation/types.d.ts +267 -0
  600. package/build-types/navigation/types.d.ts.map +1 -0
  601. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  602. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  603. package/build-types/navigation/use-navigation-tree-nodes.d.ts +11 -0
  604. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  605. package/build-types/navigation/utils.d.ts +3 -0
  606. package/build-types/navigation/utils.d.ts.map +1 -0
  607. package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
  608. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
  609. package/build-types/navigator/navigator-button/component.d.ts +1 -1
  610. package/build-types/navigator/navigator-button/hook.d.ts +1 -1
  611. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  612. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  613. package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
  614. package/build-types/navigator/types.d.ts +12 -12
  615. package/build-types/navigator/types.d.ts.map +1 -1
  616. package/build-types/notice/types.d.ts +7 -7
  617. package/build-types/notice/types.d.ts.map +1 -1
  618. package/build-types/number-control/index.d.ts.map +1 -1
  619. package/build-types/number-control/types.d.ts +1 -1
  620. package/build-types/number-control/types.d.ts.map +1 -1
  621. package/build-types/palette-edit/index.d.ts +37 -0
  622. package/build-types/palette-edit/index.d.ts.map +1 -0
  623. package/build-types/palette-edit/stories/index.d.ts +13 -0
  624. package/build-types/palette-edit/stories/index.d.ts.map +1 -0
  625. package/build-types/palette-edit/styles.d.ts +51 -0
  626. package/build-types/palette-edit/styles.d.ts.map +1 -0
  627. package/build-types/palette-edit/test/index.d.ts +2 -0
  628. package/build-types/palette-edit/test/index.d.ts.map +1 -0
  629. package/build-types/palette-edit/types.d.ts +114 -0
  630. package/build-types/palette-edit/types.d.ts.map +1 -0
  631. package/build-types/panel/body.d.ts +9 -0
  632. package/build-types/panel/body.d.ts.map +1 -0
  633. package/build-types/panel/stories/index.d.ts +19 -0
  634. package/build-types/panel/stories/index.d.ts.map +1 -0
  635. package/build-types/panel/test/body.d.ts +2 -0
  636. package/build-types/panel/test/body.d.ts.map +1 -0
  637. package/build-types/panel/types.d.ts +73 -3
  638. package/build-types/panel/types.d.ts.map +1 -1
  639. package/build-types/placeholder/index.d.ts +1 -1
  640. package/build-types/placeholder/index.d.ts.map +1 -1
  641. package/build-types/placeholder/types.d.ts +2 -2
  642. package/build-types/placeholder/types.d.ts.map +1 -1
  643. package/build-types/popover/limit-shift.d.ts +2 -2
  644. package/build-types/popover/limit-shift.d.ts.map +1 -1
  645. package/build-types/popover/types.d.ts +10 -10
  646. package/build-types/popover/types.d.ts.map +1 -1
  647. package/build-types/popover/utils.d.ts +2 -2
  648. package/build-types/popover/utils.d.ts.map +1 -1
  649. package/build-types/query-controls/author-select.d.ts.map +1 -1
  650. package/build-types/query-controls/category-select.d.ts.map +1 -1
  651. package/build-types/query-controls/terms.d.ts.map +1 -1
  652. package/build-types/query-controls/types.d.ts +12 -12
  653. package/build-types/query-controls/types.d.ts.map +1 -1
  654. package/build-types/radio-control/types.d.ts +1 -1
  655. package/build-types/radio-control/types.d.ts.map +1 -1
  656. package/build-types/radio-group/index.d.ts +1 -1
  657. package/build-types/radio-group/radio/index.d.ts +1 -1
  658. package/build-types/range-control/index.d.ts +2 -2
  659. package/build-types/range-control/types.d.ts +17 -17
  660. package/build-types/range-control/types.d.ts.map +1 -1
  661. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  662. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  663. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  664. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  665. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  666. package/build-types/resizable-box/resize-tooltip/utils.d.ts +2 -2
  667. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  668. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  669. package/build-types/responsive-wrapper/stories/index.d.ts +10 -0
  670. package/build-types/responsive-wrapper/stories/index.d.ts.map +1 -1
  671. package/build-types/responsive-wrapper/types.d.ts +3 -3
  672. package/build-types/responsive-wrapper/types.d.ts.map +1 -1
  673. package/build-types/sandbox/types.d.ts +1 -1
  674. package/build-types/sandbox/types.d.ts.map +1 -1
  675. package/build-types/scrollable/types.d.ts +2 -2
  676. package/build-types/scrollable/types.d.ts.map +1 -1
  677. package/build-types/search-control/types.d.ts +1 -1
  678. package/build-types/search-control/types.d.ts.map +1 -1
  679. package/build-types/select-control/index.d.ts +2 -1
  680. package/build-types/select-control/index.d.ts.map +1 -1
  681. package/build-types/select-control/stories/index.d.ts +3 -3
  682. package/build-types/select-control/stories/index.d.ts.map +1 -1
  683. package/build-types/select-control/types.d.ts +44 -20
  684. package/build-types/select-control/types.d.ts.map +1 -1
  685. package/build-types/shortcut/types.d.ts +1 -1
  686. package/build-types/shortcut/types.d.ts.map +1 -1
  687. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  688. package/build-types/slot-fill/provider.d.ts +1 -0
  689. package/build-types/slot-fill/provider.d.ts.map +1 -1
  690. package/build-types/snackbar/types.d.ts +3 -3
  691. package/build-types/snackbar/types.d.ts.map +1 -1
  692. package/build-types/spacer/types.d.ts +1 -1
  693. package/build-types/spacer/types.d.ts.map +1 -1
  694. package/build-types/spinner/index.d.ts +1 -1
  695. package/build-types/style-provider/types.d.ts +1 -1
  696. package/build-types/style-provider/types.d.ts.map +1 -1
  697. package/build-types/surface/types.d.ts +2 -2
  698. package/build-types/surface/types.d.ts.map +1 -1
  699. package/build-types/tab-panel/stories/index.d.ts +1 -0
  700. package/build-types/tab-panel/stories/index.d.ts.map +1 -1
  701. package/build-types/tab-panel/types.d.ts +5 -5
  702. package/build-types/tab-panel/types.d.ts.map +1 -1
  703. package/build-types/text/types.d.ts +3 -3
  704. package/build-types/text/types.d.ts.map +1 -1
  705. package/build-types/text-control/types.d.ts +1 -1
  706. package/build-types/text-control/types.d.ts.map +1 -1
  707. package/build-types/text-highlight/types.d.ts +1 -1
  708. package/build-types/text-highlight/types.d.ts.map +1 -1
  709. package/build-types/textarea-control/types.d.ts +1 -1
  710. package/build-types/textarea-control/types.d.ts.map +1 -1
  711. package/build-types/theme/types.d.ts +3 -3
  712. package/build-types/theme/types.d.ts.map +1 -1
  713. package/build-types/tip/types.d.ts +1 -1
  714. package/build-types/tip/types.d.ts.map +1 -1
  715. package/build-types/toggle-control/types.d.ts +1 -1
  716. package/build-types/toggle-control/types.d.ts.map +1 -1
  717. package/build-types/toggle-group-control/types.d.ts +10 -10
  718. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  719. package/build-types/toolbar/toolbar/types.d.ts +1 -1
  720. package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
  721. package/build-types/toolbar/toolbar-button/index.d.ts +165 -11
  722. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  723. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +6 -1
  724. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
  725. package/build-types/toolbar/toolbar-button/types.d.ts +45 -0
  726. package/build-types/toolbar/toolbar-button/types.d.ts.map +1 -0
  727. package/build-types/toolbar/toolbar-context/index.d.ts +6 -1
  728. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  729. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +1 -1
  730. package/build-types/toolbar/toolbar-item/index.d.ts +1 -1
  731. package/build-types/tools-panel/context.d.ts.map +1 -1
  732. package/build-types/tools-panel/test/index.d.ts +2 -0
  733. package/build-types/tools-panel/test/index.d.ts.map +1 -0
  734. package/build-types/tools-panel/tools-panel/hook.d.ts +3 -1
  735. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  736. package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -1
  737. package/build-types/tools-panel/tools-panel-item/component.d.ts +1 -0
  738. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  739. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  740. package/build-types/tools-panel/types.d.ts +21 -19
  741. package/build-types/tools-panel/types.d.ts.map +1 -1
  742. package/build-types/tooltip/index.d.ts.map +1 -1
  743. package/build-types/tree-grid/types.d.ts +5 -5
  744. package/build-types/tree-grid/types.d.ts.map +1 -1
  745. package/build-types/tree-select/index.d.ts.map +1 -1
  746. package/build-types/tree-select/types.d.ts +4 -10
  747. package/build-types/tree-select/types.d.ts.map +1 -1
  748. package/build-types/truncate/types.d.ts +2 -2
  749. package/build-types/truncate/types.d.ts.map +1 -1
  750. package/build-types/ui/context/context-connect.d.ts +1 -1
  751. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  752. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  753. package/build-types/ui/context/wordpress-component.d.ts +3 -3
  754. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  755. package/build-types/ui/control-group/types.d.ts +2 -2
  756. package/build-types/ui/control-group/types.d.ts.map +1 -1
  757. package/build-types/ui/control-label/types.d.ts +1 -1
  758. package/build-types/ui/control-label/types.d.ts.map +1 -1
  759. package/build-types/ui/form-group/form-group-content.d.ts +1 -1
  760. package/build-types/ui/form-group/form-group-help.d.ts +1 -1
  761. package/build-types/ui/form-group/form-group-label.d.ts +1 -1
  762. package/build-types/ui/form-group/types.d.ts +5 -5
  763. package/build-types/ui/form-group/types.d.ts.map +1 -1
  764. package/build-types/ui/form-group/use-form-group.d.ts +3 -3
  765. package/build-types/ui/spinner/component.d.ts +1 -1
  766. package/build-types/ui/tooltip/content.d.ts +1 -1
  767. package/build-types/ui/tooltip/types.d.ts +2 -2
  768. package/build-types/ui/tooltip/types.d.ts.map +1 -1
  769. package/build-types/ui/utils/font-size.d.ts +1 -1
  770. package/build-types/ui/utils/font-size.d.ts.map +1 -1
  771. package/build-types/ui/utils/space.d.ts +1 -1
  772. package/build-types/ui/utils/space.d.ts.map +1 -1
  773. package/build-types/ui/utils/types.d.ts +4 -4
  774. package/build-types/ui/utils/types.d.ts.map +1 -1
  775. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  776. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  777. package/build-types/unit-control/types.d.ts +5 -5
  778. package/build-types/unit-control/types.d.ts.map +1 -1
  779. package/build-types/utils/breakpoint-values.d.ts +1 -1
  780. package/build-types/utils/colors-values.d.ts +1 -1
  781. package/build-types/utils/config-values.d.ts +9 -9
  782. package/build-types/utils/events.d.ts +1 -1
  783. package/build-types/utils/events.d.ts.map +1 -1
  784. package/build-types/utils/font-values.d.ts +1 -1
  785. package/build-types/utils/font.d.ts.map +1 -1
  786. package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
  787. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  788. package/build-types/utils/types.d.ts +4 -4
  789. package/build-types/utils/types.d.ts.map +1 -1
  790. package/build-types/v-stack/component.d.ts +1 -4
  791. package/build-types/v-stack/component.d.ts.map +1 -1
  792. package/build-types/v-stack/hook.d.ts.map +1 -1
  793. package/build-types/v-stack/stories/e2e/index.d.ts +9 -0
  794. package/build-types/v-stack/stories/e2e/index.d.ts.map +1 -0
  795. package/build-types/v-stack/stories/index.d.ts +1 -4
  796. package/build-types/v-stack/stories/index.d.ts.map +1 -1
  797. package/build-types/v-stack/types.d.ts +5 -3
  798. package/build-types/v-stack/types.d.ts.map +1 -1
  799. package/build-types/view/types.d.ts +1 -1
  800. package/build-types/view/types.d.ts.map +1 -1
  801. package/build-types/visually-hidden/types.d.ts +1 -1
  802. package/build-types/visually-hidden/types.d.ts.map +1 -1
  803. package/build-types/z-stack/types.d.ts +1 -1
  804. package/build-types/z-stack/types.d.ts.map +1 -1
  805. package/package.json +24 -22
  806. package/src/animate/index.js +3 -1
  807. package/src/autocomplete/README.md +51 -0
  808. package/src/autocomplete/autocompleter-ui.tsx +167 -0
  809. package/src/autocomplete/{get-default-use-items.js → get-default-use-items.tsx} +11 -6
  810. package/src/autocomplete/{index.js → index.tsx} +107 -141
  811. package/src/autocomplete/test/{index.js → index.tsx} +31 -20
  812. package/src/autocomplete/types.ts +220 -0
  813. package/src/border-control/test/index.js +0 -2
  814. package/src/button/style.scss +12 -1
  815. package/src/button/types.ts +2 -2
  816. package/src/circular-option-picker/README.md +141 -0
  817. package/src/circular-option-picker/{index.js → index.tsx} +74 -14
  818. package/src/circular-option-picker/stories/index.tsx +134 -0
  819. package/src/circular-option-picker/types.ts +69 -0
  820. package/src/color-palette/test/__snapshots__/index.tsx.snap +17 -15
  821. package/src/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  822. package/src/custom-gradient-picker/gradient-bar/index.js +2 -0
  823. package/src/custom-gradient-picker/gradient-bar/utils.js +2 -0
  824. package/src/custom-gradient-picker/index.js +2 -0
  825. package/src/custom-gradient-picker/serializer.js +2 -0
  826. package/src/custom-gradient-picker/utils.js +2 -0
  827. package/src/dimension-control/README.md +22 -55
  828. package/src/dimension-control/index.tsx +101 -0
  829. package/src/dimension-control/{sizes.js → sizes.ts} +8 -5
  830. package/src/dimension-control/stories/index.tsx +48 -0
  831. package/src/dimension-control/types.ts +48 -0
  832. package/src/dropdown-menu/index.js +6 -3
  833. package/src/flex/flex/hook.ts +2 -2
  834. package/src/font-size-picker/README.md +26 -20
  835. package/src/font-size-picker/index.tsx +2 -1
  836. package/src/font-size-picker/stories/index.tsx +1 -0
  837. package/src/font-size-picker/test/index.tsx +23 -0
  838. package/src/font-size-picker/types.ts +4 -0
  839. package/src/form-token-field/index.tsx +4 -1
  840. package/src/form-token-field/stories/index.tsx +13 -0
  841. package/src/form-token-field/test/index.tsx +80 -0
  842. package/src/gradient-picker/index.js +2 -0
  843. package/src/guide/README.md +17 -15
  844. package/src/guide/{icons.js → icons.tsx} +1 -1
  845. package/src/guide/{index.js → index.tsx} +47 -7
  846. package/src/guide/{page-control.js → page-control.tsx} +2 -1
  847. package/src/guide/{page.js → page.tsx} +8 -1
  848. package/src/guide/stories/{index.js → index.tsx} +11 -5
  849. package/src/guide/test/{index.js → index.tsx} +22 -4
  850. package/src/guide/types.ts +68 -0
  851. package/src/h-stack/README.md +2 -2
  852. package/src/h-stack/stories/e2e/index.tsx +36 -0
  853. package/src/h-stack/types.ts +2 -2
  854. package/src/h-stack/utils.ts +3 -3
  855. package/src/higher-order/navigate-regions/{index.js → index.tsx} +47 -11
  856. package/src/higher-order/navigate-regions/style.scss +2 -1
  857. package/src/higher-order/with-constrained-tabbing/index.tsx +30 -0
  858. package/src/higher-order/with-fallback-styles/{index.js → index.tsx} +22 -5
  859. package/src/higher-order/with-filters/{index.js → index.tsx} +44 -12
  860. package/src/higher-order/with-filters/test/{index.js → index.tsx} +5 -1
  861. package/src/higher-order/with-focus-return/index.tsx +74 -0
  862. package/src/higher-order/with-focus-return/test/{index.js → index.tsx} +2 -2
  863. package/src/higher-order/with-notices/README.md +4 -1
  864. package/src/higher-order/with-notices/index.tsx +116 -0
  865. package/src/higher-order/with-notices/test/{index.js → index.tsx} +11 -6
  866. package/src/higher-order/with-notices/types.ts +35 -0
  867. package/src/higher-order/with-spoken-messages/test/{index.js → index.tsx} +2 -1
  868. package/src/icon/index.tsx +11 -15
  869. package/src/icon/test/{index.js → index.tsx} +6 -2
  870. package/src/index.native.js +1 -0
  871. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +1 -1
  872. package/src/mobile/bottom-sheet/cell.native.js +1 -1
  873. package/src/mobile/bottom-sheet-text-control/README.md +8 -1
  874. package/src/mobile/bottom-sheet-text-control/index.native.js +2 -1
  875. package/src/mobile/global-styles-context/utils.native.js +1 -0
  876. package/src/mobile/link-settings/test/link-settings-navigation.native.js +1 -1
  877. package/src/navigation/README.md +16 -2
  878. package/src/navigation/back-button/{index.js → index.tsx} +22 -6
  879. package/src/navigation/{context.js → context.tsx} +8 -5
  880. package/src/navigation/group/context.tsx +15 -0
  881. package/src/navigation/group/{index.js → index.tsx} +9 -1
  882. package/src/navigation/{index.js → index.tsx} +63 -7
  883. package/src/navigation/item/{base-content.js → base-content.tsx} +5 -2
  884. package/src/navigation/item/{base.js → base.tsx} +3 -1
  885. package/src/navigation/item/{index.js → index.tsx} +8 -2
  886. package/src/navigation/item/{use-navigation-tree-item.js → use-navigation-tree-item.tsx} +9 -2
  887. package/src/navigation/menu/context.tsx +18 -0
  888. package/src/navigation/menu/{index.js → index.tsx} +5 -1
  889. package/src/navigation/menu/{menu-title-search.js → menu-title-search.tsx} +11 -7
  890. package/src/navigation/menu/{menu-title.js → menu-title.tsx} +5 -3
  891. package/src/navigation/menu/{search-no-results-found.js → search-no-results-found.tsx} +5 -1
  892. package/src/navigation/menu/{use-navigation-tree-menu.js → use-navigation-tree-menu.tsx} +3 -1
  893. package/src/navigation/stories/index.tsx +53 -0
  894. package/src/navigation/stories/utils/{controlled-state.js → controlled-state.tsx} +32 -13
  895. package/src/navigation/stories/utils/{default.js → default.tsx} +20 -6
  896. package/src/navigation/stories/utils/{group.js → group.tsx} +21 -7
  897. package/src/navigation/stories/utils/{hide-if-empty.js → hide-if-empty.tsx} +19 -6
  898. package/src/navigation/stories/utils/{more-examples.js → more-examples.tsx} +30 -12
  899. package/src/navigation/stories/utils/{search.js → search.tsx} +21 -7
  900. package/src/navigation/test/{index.js → index.tsx} +17 -4
  901. package/src/navigation/types.ts +325 -0
  902. package/src/navigation/{use-create-navigation-tree.js → use-create-navigation-tree.tsx} +37 -25
  903. package/src/navigation/{use-navigation-tree-nodes.js → use-navigation-tree-nodes.tsx} +10 -6
  904. package/src/navigation/{utils.js → utils.tsx} +2 -2
  905. package/src/navigator/navigator-screen/component.tsx +13 -7
  906. package/src/navigator/test/index.tsx +65 -22
  907. package/src/number-control/index.tsx +0 -2
  908. package/src/palette-edit/{index.js → index.tsx} +115 -48
  909. package/src/palette-edit/stories/index.tsx +82 -0
  910. package/src/palette-edit/test/{index.js → index.tsx} +15 -3
  911. package/src/palette-edit/types.ts +126 -0
  912. package/src/panel/README.md +53 -35
  913. package/src/panel/{body.js → body.tsx} +31 -17
  914. package/src/panel/stories/{index.js → index.tsx} +16 -6
  915. package/src/panel/test/{body.js → body.tsx} +12 -17
  916. package/src/panel/types.ts +78 -0
  917. package/src/placeholder/index.tsx +2 -6
  918. package/src/placeholder/test/index.tsx +1 -1
  919. package/src/placeholder/types.ts +2 -2
  920. package/src/popover/test/index.tsx +5 -2
  921. package/src/query-controls/author-select.tsx +1 -6
  922. package/src/query-controls/category-select.tsx +1 -6
  923. package/src/query-controls/terms.ts +29 -18
  924. package/src/range-control/index.tsx +7 -7
  925. package/src/range-control/types.ts +3 -3
  926. package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.ts +2 -1
  927. package/src/responsive-wrapper/README.md +8 -2
  928. package/src/responsive-wrapper/index.tsx +18 -17
  929. package/src/responsive-wrapper/stories/index.tsx +41 -0
  930. package/src/responsive-wrapper/style.scss +5 -11
  931. package/src/responsive-wrapper/types.ts +2 -2
  932. package/src/select-control/index.tsx +16 -16
  933. package/src/select-control/stories/index.tsx +24 -12
  934. package/src/select-control/types.ts +68 -40
  935. package/src/tab-panel/stories/index.tsx +41 -0
  936. package/src/tab-panel/test/index.tsx +794 -262
  937. package/src/tab-panel/types.ts +4 -4
  938. package/src/toolbar/toolbar-button/README.md +13 -1
  939. package/src/toolbar/toolbar-button/{index.js → index.tsx} +55 -20
  940. package/src/toolbar/toolbar-button/toolbar-button-container.tsx +13 -0
  941. package/src/toolbar/toolbar-button/types.ts +46 -0
  942. package/src/toolbar/toolbar-context/index.ts +15 -0
  943. package/src/tools-panel/context.ts +2 -0
  944. package/src/tools-panel/test/{index.js → index.tsx} +171 -61
  945. package/src/tools-panel/tools-panel/hook.ts +30 -11
  946. package/src/tools-panel/tools-panel-item/hook.ts +18 -2
  947. package/src/tools-panel/types.ts +12 -9
  948. package/src/tooltip/index.js +11 -1
  949. package/src/tree-grid/test/__snapshots__/index.tsx.snap +1 -1
  950. package/src/tree-select/index.tsx +5 -2
  951. package/src/tree-select/types.ts +6 -13
  952. package/src/ui/context/context-system-provider.js +7 -4
  953. package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
  954. package/src/utils/font.js +1 -6
  955. package/src/v-stack/README.md +2 -2
  956. package/src/v-stack/hook.ts +6 -4
  957. package/src/v-stack/stories/e2e/index.tsx +36 -0
  958. package/src/v-stack/stories/index.tsx +28 -7
  959. package/src/v-stack/test/__snapshots__/index.tsx.snap +20 -18
  960. package/src/v-stack/types.ts +5 -3
  961. package/tsconfig.json +1 -14
  962. package/tsconfig.tsbuildinfo +1 -1
  963. package/src/autocomplete/autocompleter-ui.js +0 -118
  964. package/src/dimension-control/index.js +0 -73
  965. package/src/higher-order/with-constrained-tabbing/index.js +0 -22
  966. package/src/higher-order/with-focus-return/index.js +0 -64
  967. package/src/higher-order/with-notices/index.js +0 -104
  968. package/src/navigation/group/context.js +0 -9
  969. package/src/navigation/menu/context.js +0 -11
  970. package/src/navigation/stories/index.js +0 -33
  971. package/src/toolbar/toolbar-button/toolbar-button-container.js +0 -6
  972. package/src/toolbar/toolbar-context/index.js +0 -10
  973. /package/src/animation/{index.js → index.tsx} +0 -0
  974. /package/src/higher-order/with-filters/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  975. /package/src/higher-order/with-spoken-messages/{index.js → index.tsx} +0 -0
  976. /package/src/navigation/{constants.js → constants.tsx} +0 -0
  977. /package/src/navigation/styles/{navigation-styles.js → navigation-styles.tsx} +0 -0
  978. /package/src/panel/test/__snapshots__/{body.js.snap → body.tsx.snap} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"names":["useCallback","useEffect","useMemo","useRef","useState","styles","useContextSystem","useCx","DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItems","default","optional","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","isMenuItemTypeEmpty","obj","Object","keys","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResetting","wasResetting","current","setPanelItems","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","deregisterPanelItem","index","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","classes","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","newMenuItems","resetAllItems","filters","resetAllFilter","push","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,WADD,EAECC,SAFD,EAGCC,OAHD,EAICC,MAJD,EAKCC,QALD,QAMO,oBANP;AAQA;AACA;AACA;;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AACA,SAASC,gBAAT,QAA0D,kBAA1D;AACA,SAASC,KAAT,QAAsB,0BAAtB;AASA,MAAMC,eAAe,GAAG,CAAxB;;AAEA,MAAMC,iBAAiB,GAAG,QAIQ;AAAA,MAJN;AAC3BC,IAAAA,UAD2B;AAE3BC,IAAAA,WAF2B;AAG3BC,IAAAA;AAH2B,GAIM;AACjC,QAAMC,SAA8B,GAAG;AAAEC,IAAAA,OAAO,EAAE,EAAX;AAAeC,IAAAA,QAAQ,EAAE;AAAzB,GAAvC;AAEAL,EAAAA,UAAU,CAACM,OAAX,CAAoB,SAA6C;AAAA;;AAAA,QAA3C;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,gBAAZ;AAA8BC,MAAAA;AAA9B,KAA2C;AAChE,UAAMC,KAAK,GAAGF,gBAAgB,GAAG,SAAH,GAAe,UAA7C,CADgE,CAGhE;AACA;AACA;;AACA,UAAMG,iBAAiB,GAAGT,gBAAH,aAAGA,gBAAH,gDAAGA,gBAAgB,CAAIQ,KAAJ,CAAnB,0DAAG,sBAA+BD,KAA/B,CAA1B;AACA,UAAMG,KAAK,GAAGD,iBAAiB,GAAGA,iBAAH,GAAuBJ,QAAQ,EAA9D;AAEAJ,IAAAA,SAAS,CAAEO,KAAF,CAAT,CAAoBD,KAApB,IAA8BR,WAAW,GAAG,KAAH,GAAWW,KAApD;AACA,GAVD;AAYA,SAAOT,SAAP;AACA,CApBD;;AAsBA,MAAMU,mBAAmB,GACxBC,GAD2B,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EAOCoB,OAPD,EAQCvB,UARD,EASCiC,iBATD,EAUCR,4BAVD,EAWCC,mCAXD,EAYCC,kCAZD,CAhB2B,CAA5B;AAgCA,SAAO,EACN,GAAGC,UADG;AAENP,IAAAA,YAFM;AAGNuD,IAAAA,YAHM;AAINX,IAAAA,aAJM;AAKNL,IAAAA,UALM;AAMNxC,IAAAA,SAAS,EAAEkC;AANL,GAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\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\tmenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && 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 isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` 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\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\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(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems ] );\n\n\t// Force a menu item to be checked.\n\t// This is intended for use with default panel items. They are displayed\n\t// separately to optional items and have different display states,\n\t// we need to update that when their value is customized.\n\tconst flagItemCustomization = useCallback(\n\t\t( label: string, group: ToolsPanelMenuItemKey = 'default' ) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\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, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\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\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.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}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\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(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\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...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\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\tisResetting.current = true;\n\n\t\t\t// Collect available reset filters from panel items.\n\t\t\tconst filters: Array< () => void > = [];\n\t\t\tpanelItems.forEach( ( item ) => {\n\t\t\t\tif ( item.resetAllFilter ) {\n\t\t\t\t\tfilters.push( item.resetAllFilter );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tresetAll( filters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAll, setMenuItems ] );\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 panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\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\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\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"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"names":["useCallback","useEffect","useMemo","useRef","useState","styles","useContextSystem","useCx","DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItems","default","optional","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","isMenuItemTypeEmpty","obj","Object","keys","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResetting","wasResetting","current","setPanelItems","resetAllFilters","setResetAllFilters","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","deregisterPanelItem","index","registerResetAllFilter","newFilter","filters","deregisterResetAllFilter","filterToRemove","filter","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","classes","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","newMenuItems","resetAllItems","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,WADD,EAECC,SAFD,EAGCC,OAHD,EAICC,MAJD,EAKCC,QALD,QAMO,oBANP;AAQA;AACA;AACA;;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AACA,SAASC,gBAAT,QAA0D,kBAA1D;AACA,SAASC,KAAT,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BALD,EAMC0B,iBAND,EAOC5E,SAPD,EAQCoB,OARD,EASCvB,UATD,EAUC6C,sBAVD,EAWCV,iBAXD,EAYCV,4BAZD,EAaCC,mCAbD,EAcCC,kCAdD,CAlB2B,CAA5B;AAoCA,SAAO,EACN,GAAGC,UADG;AAENP,IAAAA,YAFM;AAGN4D,IAAAA,YAHM;AAINR,IAAAA,aAJM;AAKNL,IAAAA,UALM;AAMNhD,IAAAA,SAAS,EAAE0C;AANL,GAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/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\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\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\tmenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && 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 isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` 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\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\tconst [ resetAllFilters, setResetAllFilters ] = useState<\n\t\tResetAllFilter[]\n\t>( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\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(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\tconst registerResetAllFilter = useCallback(\n\t\t( newFilter: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn [ ...filters, newFilter ];\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filterToRemove: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn filters.filter(\n\t\t\t\t\t( filter ) => filter !== filterToRemove\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems ] );\n\n\t// Force a menu item to be checked.\n\t// This is intended for use with default panel items. They are displayed\n\t// separately to optional items and have different display states,\n\t// we need to update that when their value is customized.\n\tconst flagItemCustomization = useCallback(\n\t\t( label: string, group: ToolsPanelMenuItemKey = 'default' ) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\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, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\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\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.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}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\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(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\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...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\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\tisResetting.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAllFilters, resetAll, setMenuItems ] );\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 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: !! panelItems.length,\n\t\t\tisResetting: isResetting.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\tpanelItems,\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"]}
@@ -31,6 +31,8 @@ export function useToolsPanelItem(props) {
31
31
  const {
32
32
  panelId: currentPanelId,
33
33
  menuItems,
34
+ registerResetAllFilter,
35
+ deregisterResetAllFilter,
34
36
  registerPanelItem,
35
37
  deregisterPanelItem,
36
38
  flagItemCustomization,
@@ -53,7 +55,6 @@ export function useToolsPanelItem(props) {
53
55
  hasValue: hasValueCallback,
54
56
  isShownByDefault,
55
57
  label,
56
- resetAllFilter: resetAllFilterCallback,
57
58
  panelId
58
59
  });
59
60
  }
@@ -63,7 +64,18 @@ export function useToolsPanelItem(props) {
63
64
  deregisterPanelItem(label);
64
65
  }
65
66
  };
66
- }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, resetAllFilterCallback, registerPanelItem, deregisterPanelItem]); // Note: `label` is used as a key when building menu item state in
67
+ }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);
68
+ useEffect(() => {
69
+ if (hasMatchingPanel) {
70
+ registerResetAllFilter(resetAllFilterCallback);
71
+ }
72
+
73
+ return () => {
74
+ if (hasMatchingPanel) {
75
+ deregisterResetAllFilter(resetAllFilterCallback);
76
+ }
77
+ };
78
+ }, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]); // Note: `label` is used as a key when building menu item state in
67
79
  // `ToolsPanel`.
68
80
 
69
81
  const menuGroup = isShownByDefault ? 'default' : 'optional';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"names":["usePrevious","useCallback","useEffect","useMemo","styles","useToolsPanelContext","useContextSystem","useCx","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","wasValueSet","newValueSet","isShown","cx","classes","placeholderStyle","ToolsPanelItemPlaceholder","firstItemStyle","lastItemStyle","ToolsPanelItem"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,oBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,EAAiCC,OAAjC,QAAgD,oBAAhD;AAEA;AACA;AACA;;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AACA,SAASC,oBAAT,QAAqC,YAArC;AACA,SAASC,gBAAT,QAA0D,kBAA1D;AACA,SAASC,KAAT,QAAsB,0BAAtB;;AAGA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,OA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EAMFC,iBANE,EAOFC,mCAPE,EAQFC,kCARE,EASFjB,KATE,CAhBoB,CAAvB;AA4BA,SAAO,EACN,GAAGK,UADG;AAENyB,IAAAA,OAFM;AAGNjB,IAAAA,uBAHM;AAINhB,IAAAA,SAAS,EAAEmC;AAJL,GAAP;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\tconst hasValueCallback = useCallback( hasValue, [ panelId, hasValue ] );\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [\n\t\tpanelId,\n\t\tresetAllFilter,\n\t] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tresetAllFilter: resetAllFilterCallback,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tresetAllFilterCallback,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\tconst wasValueSet = usePrevious( isValueSet );\n\tconst newValueSet = isValueSet && ! wasValueSet;\n\n\t// Notify the panel when an item's value has been set.\n\t//\n\t// 1. For default controls, this is so \"reset\" appears beside its menu item.\n\t// 2. For optional controls, when the panel ID is `null`, it allows the\n\t// panel to ensure the item is toggled on for display in the menu, given the\n\t// value has been set external to the control.\n\tuseEffect( () => {\n\t\tif ( ! newValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShownByDefault || currentPanelId === null ) {\n\t\t\tflagItemCustomization( label, menuGroup );\n\t\t}\n\t}, [\n\t\tcurrentPanelId,\n\t\tnewValueSet,\n\t\tisShownByDefault,\n\t\tmenuGroup,\n\t\tlabel,\n\t\tflagItemCustomization,\n\t] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst placeholderStyle =\n\t\t\tshouldRenderPlaceholder &&\n\t\t\t! isShown &&\n\t\t\tstyles.ToolsPanelItemPlaceholder;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tplaceholderStyle,\n\t\t\tclassName,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"names":["usePrevious","useCallback","useEffect","useMemo","styles","useToolsPanelContext","useContextSystem","useCx","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerResetAllFilter","deregisterResetAllFilter","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","wasValueSet","newValueSet","isShown","cx","classes","placeholderStyle","ToolsPanelItemPlaceholder","firstItemStyle","lastItemStyle","ToolsPanelItem"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,oBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,EAAiCC,OAAjC,QAAgD,oBAAhD;AAEA;AACA;AACA;;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AACA,SAASC,oBAAT,QAAqC,YAArC;AACA,SAASC,gBAAT,QAA0D,kBAA1D;AACA,SAASC,KAAT,QAAsB,0BAAtB;;AAGA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,OAAO,SAASC,iBAAT,CACNC,KADM,EAEL;AAAA;;AACD,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,gBAAgB,GAAG,KAHd;AAILC,IAAAA,KAJK;AAKLC,IAAAA,OALK;AAMLC,IAAAA,cAAc,GAAGR,IANZ;AAOLS,IAAAA,UAPK;AAQLC,IAAAA,QARK;AASL,OAAGC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E,EAEFjB,uBAFE,EAGFlB,SAHE,EAIFoC,EAJE,EAKFjB,kBALE,EAMFC,iBANE,EAOFC,mCAPE,EAQFC,kCARE,EASFnB,KATE,CAhBoB,CAAvB;AA4BA,SAAO,EACN,GAAGK,UADG;AAEN2B,IAAAA,OAFM;AAGNjB,IAAAA,uBAHM;AAINlB,IAAAA,SAAS,EAAEqC;AAJL,GAAP;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\tconst hasValueCallback = useCallback( hasValue, [ panelId, hasValue ] );\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [\n\t\tpanelId,\n\t\tresetAllFilter,\n\t] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel ) {\n\t\t\tregisterResetAllFilter( resetAllFilterCallback );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( hasMatchingPanel ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilterCallback );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tresetAllFilterCallback,\n\t\thasMatchingPanel,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\tconst wasValueSet = usePrevious( isValueSet );\n\tconst newValueSet = isValueSet && ! wasValueSet;\n\n\t// Notify the panel when an item's value has been set.\n\t//\n\t// 1. For default controls, this is so \"reset\" appears beside its menu item.\n\t// 2. For optional controls, when the panel ID is `null`, it allows the\n\t// panel to ensure the item is toggled on for display in the menu, given the\n\t// value has been set external to the control.\n\tuseEffect( () => {\n\t\tif ( ! newValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShownByDefault || currentPanelId === null ) {\n\t\t\tflagItemCustomization( label, menuGroup );\n\t\t}\n\t}, [\n\t\tcurrentPanelId,\n\t\tnewValueSet,\n\t\tisShownByDefault,\n\t\tmenuGroup,\n\t\tlabel,\n\t\tflagItemCustomization,\n\t] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst placeholderStyle =\n\t\t\tshouldRenderPlaceholder &&\n\t\t\t! isShown &&\n\t\t\tstyles.ToolsPanelItemPlaceholder;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tplaceholderStyle,\n\t\t\tclassName,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"]}
@@ -1,9 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import { createElement } from "@wordpress/element";
2
3
  // @ts-nocheck
3
4
 
5
+ /**
6
+ * External dependencies
7
+ */
8
+ import classNames from 'classnames';
4
9
  /**
5
10
  * WordPress dependencies
6
11
  */
12
+
7
13
  import { Children, cloneElement, concatChildren, useEffect, useState } from '@wordpress/element';
8
14
  import { useDebounce, useMergeRefs } from '@wordpress/compose';
9
15
  /**
@@ -60,18 +66,20 @@ const addPopoverToGrandchildren = _ref3 => {
60
66
  offset,
61
67
  position,
62
68
  shortcut,
63
- text
69
+ text,
70
+ className,
71
+ ...props
64
72
  } = _ref3;
65
- return concatChildren(grandchildren, isOver && createElement(Popover, {
73
+ return concatChildren(grandchildren, isOver && createElement(Popover, _extends({
66
74
  focusOnMount: false,
67
75
  position: position,
68
- className: "components-tooltip",
76
+ className: classNames('components-tooltip', className),
69
77
  "aria-hidden": "true",
70
78
  animate: false,
71
79
  offset: offset,
72
80
  anchor: anchor,
73
81
  shift: true
74
- }, text, createElement(Shortcut, {
82
+ }, props), text, createElement(Shortcut, {
75
83
  className: "components-tooltip__shortcut",
76
84
  shortcut: shortcut
77
85
  })));
@@ -101,7 +109,8 @@ function Tooltip(props) {
101
109
  position = 'bottom middle',
102
110
  text,
103
111
  shortcut,
104
- delay = TOOLTIP_DELAY
112
+ delay = TOOLTIP_DELAY,
113
+ ...popoverProps
105
114
  } = props;
106
115
  /**
107
116
  * Whether a mouse is currently pressed, used in determining whether
@@ -253,7 +262,8 @@ function Tooltip(props) {
253
262
  };
254
263
  const childrenWithPopover = addPopoverToGrandchildren({
255
264
  grandchildren,
256
- ...popoverData
265
+ ...popoverData,
266
+ ...popoverProps
257
267
  });
258
268
  return getElementWithPopover({
259
269
  child,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tooltip/index.js"],"names":["Children","cloneElement","concatChildren","useEffect","useState","useDebounce","useMergeRefs","Popover","Shortcut","TOOLTIP_DELAY","eventCatcher","getDisabledElement","eventHandlers","child","childrenWithPopover","mergedRefs","children","ref","getRegularElement","addPopoverToGrandchildren","anchor","grandchildren","isOver","offset","position","shortcut","text","emitToChild","eventName","event","count","only","props","disabled","Tooltip","delay","isMouseDown","setIsMouseDown","setIsOver","delayedSetIsOver","popoverAnchor","setPopoverAnchor","existingChildRef","toArray","mergedChildRefs","createMouseDown","target","tagName","document","addEventListener","cancelIsMouseDown","createMouseUp","removeEventListener","createMouseEvent","type","createToggleIsOver","isDelayed","currentTarget","cancel","_isOver","includes","clearOnUnmount","process","env","NODE_ENV","console","error","onMouseEnter","onMouseLeave","onClick","onFocus","onBlur","onMouseDown","getElementWithPopover","popoverData"],"mappings":";AAAA;;AAEA;AACA;AACA;AACA,SACCA,QADD,EAECC,YAFD,EAGCC,cAHD,EAICC,SAJD,EAKCC,QALD,QAMO,oBANP;AAOA,SAASC,WAAT,EAAsBC,YAAtB,QAA0C,oBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,QAAP,MAAqB,aAArB;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAG,GAAtB;AAEP,MAAMC,YAAY,GAAG;AAAK,EAAA,SAAS,EAAC;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AAEd,kBAAkB,CAAE,SAAF,CAHN;AAIrBe,IAAAA,OAAO,EAAEf,kBAAkB,CAAE,SAAF,CAJN;AAKrBgB,IAAAA,MAAM,EAAEhB,kBAAkB,CAAE,QAAF,CALL;AAMrBiB,IAAAA,WAAW,EAAEnB,gBAAgB,CAAE,WAAF;AANR,GAAtB;AASA,QAAMxC,KAAK,GAAGb,QAAQ,CAAC+B,IAAT,CAAef,QAAf,CAAd;AACA,QAAM;AAAEA,IAAAA,QAAQ,EAAEK,aAAZ;AAA2BY,IAAAA;AAA3B,MAAwCpB,KAAK,CAACmB,KAApD;AACA,QAAMyC,qBAAqB,GAAGxC,QAAQ,GACnCtB,kBADmC,GAEnCO,iBAFH;AAIA,QAAMwD,WAAW,GAAG;AACnBtD,IAAAA,MAAM,EAAEoB,aADW;AAEnBlB,IAAAA,MAFmB;AAGnBC,IAAAA,MAAM,EAAE,CAHW;AAInBC,IAAAA,QAJmB;AAKnBC,IAAAA,QALmB;AAMnBC,IAAAA;AANmB,GAApB;AAQA,QAAMZ,mBAAmB,GAAGK,yBAAyB,CAAE;AACtDE,IAAAA,aADsD;AAEtD,OAAGqD;AAFmD,GAAF,CAArD;AAKA,SAAOD,qBAAqB,CAAE;AAC7B5D,IAAAA,KAD6B;AAE7BD,IAAAA,aAF6B;AAG7BE,IAAAA,mBAH6B;AAI7BC,IAAAA,UAAU,EAAE6B;AAJiB,GAAF,CAA5B;AAMA;;AAED,eAAeV,OAAf","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport {\n\tChildren,\n\tcloneElement,\n\tconcatChildren,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport { useDebounce, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Popover from '../popover';\nimport Shortcut from '../shortcut';\n\n/**\n * Time over children to wait before showing tooltip\n *\n * @type {number}\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst eventCatcher = <div className=\"event-catcher\" />;\n\nconst getDisabledElement = ( {\n\teventHandlers,\n\tchild,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement(\n\t\t<span className=\"disabled-element-wrapper\">\n\t\t\t{ cloneElement( eventCatcher, eventHandlers ) }\n\t\t\t{ cloneElement( child, {\n\t\t\t\tchildren: childrenWithPopover,\n\t\t\t\tref: mergedRefs,\n\t\t\t} ) }\n\t\t</span>,\n\t\t{ ...eventHandlers }\n\t);\n};\n\nconst getRegularElement = ( {\n\tchild,\n\teventHandlers,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement( child, {\n\t\t...eventHandlers,\n\t\tchildren: childrenWithPopover,\n\t\tref: mergedRefs,\n\t} );\n};\n\nconst addPopoverToGrandchildren = ( {\n\tanchor,\n\tgrandchildren,\n\tisOver,\n\toffset,\n\tposition,\n\tshortcut,\n\ttext,\n} ) =>\n\tconcatChildren(\n\t\tgrandchildren,\n\t\tisOver && (\n\t\t\t<Popover\n\t\t\t\tfocusOnMount={ false }\n\t\t\t\tposition={ position }\n\t\t\t\tclassName=\"components-tooltip\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tanimate={ false }\n\t\t\t\toffset={ offset }\n\t\t\t\tanchor={ anchor }\n\t\t\t\tshift\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t\t<Shortcut\n\t\t\t\t\tclassName=\"components-tooltip__shortcut\"\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t/>\n\t\t\t</Popover>\n\t\t)\n\t);\n\nconst emitToChild = ( children, eventName, event ) => {\n\tif ( Children.count( children ) !== 1 ) {\n\t\treturn;\n\t}\n\n\tconst child = Children.only( children );\n\n\t// If the underlying element is disabled, do not emit the event.\n\tif ( child.props.disabled ) {\n\t\treturn;\n\t}\n\n\tif ( typeof child.props[ eventName ] === 'function' ) {\n\t\tchild.props[ eventName ]( event );\n\t}\n};\n\nfunction Tooltip( props ) {\n\tconst {\n\t\tchildren,\n\t\tposition = 'bottom middle',\n\t\ttext,\n\t\tshortcut,\n\t\tdelay = TOOLTIP_DELAY,\n\t} = props;\n\t/**\n\t * Whether a mouse is currently pressed, used in determining whether\n\t * to handle a focus event as displaying the tooltip immediately.\n\t *\n\t * @type {boolean}\n\t */\n\tconst [ isMouseDown, setIsMouseDown ] = useState( false );\n\tconst [ isOver, setIsOver ] = useState( false );\n\tconst delayedSetIsOver = useDebounce( setIsOver, delay );\n\t// Using internal state (instead of a ref) for the popover anchor to make sure\n\t// that the component re-renders when the anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\t// Create a reference to the Tooltip's child, to be passed to the Popover\n\t// so that the Tooltip can be correctly positioned. Also, merge with the\n\t// existing ref for the first child, so that its ref is preserved.\n\tconst existingChildRef = Children.toArray( children )[ 0 ]?.ref;\n\tconst mergedChildRefs = useMergeRefs( [\n\t\tsetPopoverAnchor,\n\t\texistingChildRef,\n\t] );\n\n\tconst createMouseDown = ( event ) => {\n\t\t// In firefox, the mouse down event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Preserve original child callback behavior.\n\t\temitToChild( children, 'onMouseDown', event );\n\n\t\t// On mouse down, the next `mouseup` should revert the value of the\n\t\t// instance property and remove its own event handler. The bind is\n\t\t// made on the document since the `mouseup` might not occur within\n\t\t// the bounds of the element.\n\t\tdocument.addEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( true );\n\t};\n\n\tconst createMouseUp = ( event ) => {\n\t\t// In firefox, the mouse up event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\temitToChild( children, 'onMouseUp', event );\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( false );\n\t};\n\n\tconst createMouseEvent = ( type ) => {\n\t\tif ( type === 'mouseUp' ) return createMouseUp;\n\t\tif ( type === 'mouseDown' ) return createMouseDown;\n\t};\n\n\t/**\n\t * Prebound `isInMouseDown` handler, created as a constant reference to\n\t * assure ability to remove in component unmount.\n\t *\n\t * @type {Function}\n\t */\n\tconst cancelIsMouseDown = createMouseEvent( 'mouseUp' );\n\n\tconst createToggleIsOver = ( eventName, isDelayed ) => {\n\t\treturn ( event ) => {\n\t\t\t// Preserve original child callback behavior.\n\t\t\temitToChild( children, eventName, event );\n\n\t\t\t// Mouse events behave unreliably in React for disabled elements,\n\t\t\t// firing on mouseenter but not mouseleave. Further, the default\n\t\t\t// behavior for disabled elements in some browsers is to ignore\n\t\t\t// mouse events. Don't bother trying to handle them.\n\t\t\t//\n\t\t\t// See: https://github.com/facebook/react/issues/4251\n\t\t\tif ( event.currentTarget.disabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// A focus event will occur as a result of a mouse click, but it\n\t\t\t// should be disambiguated between interacting with the button and\n\t\t\t// using an explicit focus shift as a cue to display the tooltip.\n\t\t\tif ( 'focus' === event.type && isMouseDown ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Needed in case unsetting is over while delayed set pending, i.e.\n\t\t\t// quickly blur/mouseleave before delayedSetIsOver is called.\n\t\t\tdelayedSetIsOver.cancel();\n\n\t\t\tconst _isOver = [ 'focus', 'mouseenter' ].includes( event.type );\n\t\t\tif ( _isOver === isOver ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isDelayed ) {\n\t\t\t\tdelayedSetIsOver( _isOver );\n\t\t\t} else {\n\t\t\t\tsetIsOver( _isOver );\n\t\t\t}\n\t\t};\n\t};\n\tconst clearOnUnmount = () => {\n\t\tdelayedSetIsOver.cancel();\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t};\n\n\t// Ignore reason: updating the deps array here could cause unexpected changes in behavior.\n\t// Deferring until a more detailed investigation/refactor can be performed.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tuseEffect( () => clearOnUnmount, [] );\n\n\tif ( Children.count( children ) !== 1 ) {\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'Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\n\t\treturn children;\n\t}\n\n\tconst eventHandlers = {\n\t\tonMouseEnter: createToggleIsOver( 'onMouseEnter', true ),\n\t\tonMouseLeave: createToggleIsOver( 'onMouseLeave' ),\n\t\tonClick: createToggleIsOver( 'onClick' ),\n\t\tonFocus: createToggleIsOver( 'onFocus' ),\n\t\tonBlur: createToggleIsOver( 'onBlur' ),\n\t\tonMouseDown: createMouseEvent( 'mouseDown' ),\n\t};\n\n\tconst child = Children.only( children );\n\tconst { children: grandchildren, disabled } = child.props;\n\tconst getElementWithPopover = disabled\n\t\t? getDisabledElement\n\t\t: getRegularElement;\n\n\tconst popoverData = {\n\t\tanchor: popoverAnchor,\n\t\tisOver,\n\t\toffset: 4,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\t};\n\tconst childrenWithPopover = addPopoverToGrandchildren( {\n\t\tgrandchildren,\n\t\t...popoverData,\n\t} );\n\n\treturn getElementWithPopover( {\n\t\tchild,\n\t\teventHandlers,\n\t\tchildrenWithPopover,\n\t\tmergedRefs: mergedChildRefs,\n\t} );\n}\n\nexport default Tooltip;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tooltip/index.js"],"names":["classNames","Children","cloneElement","concatChildren","useEffect","useState","useDebounce","useMergeRefs","Popover","Shortcut","TOOLTIP_DELAY","eventCatcher","getDisabledElement","eventHandlers","child","childrenWithPopover","mergedRefs","children","ref","getRegularElement","addPopoverToGrandchildren","anchor","grandchildren","isOver","offset","position","shortcut","text","className","props","emitToChild","eventName","event","count","only","disabled","Tooltip","delay","popoverProps","isMouseDown","setIsMouseDown","setIsOver","delayedSetIsOver","popoverAnchor","setPopoverAnchor","existingChildRef","toArray","mergedChildRefs","createMouseDown","target","tagName","document","addEventListener","cancelIsMouseDown","createMouseUp","removeEventListener","createMouseEvent","type","createToggleIsOver","isDelayed","currentTarget","cancel","_isOver","includes","clearOnUnmount","process","env","NODE_ENV","console","error","onMouseEnter","onMouseLeave","onClick","onFocus","onBlur","onMouseDown","getElementWithPopover","popoverData"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,cAHD,EAICC,SAJD,EAKCC,QALD,QAMO,oBANP;AAOA,SAASC,WAAT,EAAsBC,YAAtB,QAA0C,oBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,QAAP,MAAqB,aAArB;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAG,GAAtB;AAEP,MAAMC,YAAY,GAAG;AAAK,EAAA,SAAS,EAAC;AAAf,EAArB;;AAEA,MAAMC,kBAAkB,GAAG,QAKpB;AAAA,MALsB;AAC5BC,IAAAA,aAD4B;AAE5BC,IAAAA,KAF4B;AAG5BC,IAAAA,mBAH4B;AAI5BC,IAAAA;AAJ4B,GAKtB;AACN,SAAOd,YAAY,CAClB;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGA,YAAY,CAAES,YAAF,EAAgBE,aAAhB,CADf,EAEGX,YAAY,CAAEY,KAAF,EAAS;AACtBG,IAAAA,QAAQ,EAAEF,mBADY;AAEtBG,IAAAA,GAAG,EAAEF;AAFiB,GAAT,CAFf,CADkB,EAQlB,EAAE,GAAGH;AAAL,GARkB,CAAnB;AAUA,CAhBD;;AAkBA,MAAMM,iBAAiB,GAAG,SA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CAACe,KAApD;AACA,QAAM+C,qBAAqB,GAAGzC,QAAQ,GACnCvB,kBADmC,GAEnCO,iBAFH;AAIA,QAAM0D,WAAW,GAAG;AACnBxD,IAAAA,MAAM,EAAEsB,aADW;AAEnBpB,IAAAA,MAFmB;AAGnBC,IAAAA,MAAM,EAAE,CAHW;AAInBC,IAAAA,QAJmB;AAKnBC,IAAAA,QALmB;AAMnBC,IAAAA;AANmB,GAApB;AAQA,QAAMZ,mBAAmB,GAAGK,yBAAyB,CAAE;AACtDE,IAAAA,aADsD;AAEtD,OAAGuD,WAFmD;AAGtD,OAAGvC;AAHmD,GAAF,CAArD;AAMA,SAAOsC,qBAAqB,CAAE;AAC7B9D,IAAAA,KAD6B;AAE7BD,IAAAA,aAF6B;AAG7BE,IAAAA,mBAH6B;AAI7BC,IAAAA,UAAU,EAAE+B;AAJiB,GAAF,CAA5B;AAMA;;AAED,eAAeX,OAAf","sourcesContent":["// @ts-nocheck\n\n/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tChildren,\n\tcloneElement,\n\tconcatChildren,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport { useDebounce, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Popover from '../popover';\nimport Shortcut from '../shortcut';\n\n/**\n * Time over children to wait before showing tooltip\n *\n * @type {number}\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst eventCatcher = <div className=\"event-catcher\" />;\n\nconst getDisabledElement = ( {\n\teventHandlers,\n\tchild,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement(\n\t\t<span className=\"disabled-element-wrapper\">\n\t\t\t{ cloneElement( eventCatcher, eventHandlers ) }\n\t\t\t{ cloneElement( child, {\n\t\t\t\tchildren: childrenWithPopover,\n\t\t\t\tref: mergedRefs,\n\t\t\t} ) }\n\t\t</span>,\n\t\t{ ...eventHandlers }\n\t);\n};\n\nconst getRegularElement = ( {\n\tchild,\n\teventHandlers,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement( child, {\n\t\t...eventHandlers,\n\t\tchildren: childrenWithPopover,\n\t\tref: mergedRefs,\n\t} );\n};\n\nconst addPopoverToGrandchildren = ( {\n\tanchor,\n\tgrandchildren,\n\tisOver,\n\toffset,\n\tposition,\n\tshortcut,\n\ttext,\n\tclassName,\n\t...props\n} ) =>\n\tconcatChildren(\n\t\tgrandchildren,\n\t\tisOver && (\n\t\t\t<Popover\n\t\t\t\tfocusOnMount={ false }\n\t\t\t\tposition={ position }\n\t\t\t\tclassName={ classNames( 'components-tooltip', className ) }\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tanimate={ false }\n\t\t\t\toffset={ offset }\n\t\t\t\tanchor={ anchor }\n\t\t\t\tshift\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t\t<Shortcut\n\t\t\t\t\tclassName=\"components-tooltip__shortcut\"\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t/>\n\t\t\t</Popover>\n\t\t)\n\t);\n\nconst emitToChild = ( children, eventName, event ) => {\n\tif ( Children.count( children ) !== 1 ) {\n\t\treturn;\n\t}\n\n\tconst child = Children.only( children );\n\n\t// If the underlying element is disabled, do not emit the event.\n\tif ( child.props.disabled ) {\n\t\treturn;\n\t}\n\n\tif ( typeof child.props[ eventName ] === 'function' ) {\n\t\tchild.props[ eventName ]( event );\n\t}\n};\n\nfunction Tooltip( props ) {\n\tconst {\n\t\tchildren,\n\t\tposition = 'bottom middle',\n\t\ttext,\n\t\tshortcut,\n\t\tdelay = TOOLTIP_DELAY,\n\t\t...popoverProps\n\t} = props;\n\t/**\n\t * Whether a mouse is currently pressed, used in determining whether\n\t * to handle a focus event as displaying the tooltip immediately.\n\t *\n\t * @type {boolean}\n\t */\n\tconst [ isMouseDown, setIsMouseDown ] = useState( false );\n\tconst [ isOver, setIsOver ] = useState( false );\n\tconst delayedSetIsOver = useDebounce( setIsOver, delay );\n\t// Using internal state (instead of a ref) for the popover anchor to make sure\n\t// that the component re-renders when the anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\t// Create a reference to the Tooltip's child, to be passed to the Popover\n\t// so that the Tooltip can be correctly positioned. Also, merge with the\n\t// existing ref for the first child, so that its ref is preserved.\n\tconst existingChildRef = Children.toArray( children )[ 0 ]?.ref;\n\tconst mergedChildRefs = useMergeRefs( [\n\t\tsetPopoverAnchor,\n\t\texistingChildRef,\n\t] );\n\n\tconst createMouseDown = ( event ) => {\n\t\t// In firefox, the mouse down event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Preserve original child callback behavior.\n\t\temitToChild( children, 'onMouseDown', event );\n\n\t\t// On mouse down, the next `mouseup` should revert the value of the\n\t\t// instance property and remove its own event handler. The bind is\n\t\t// made on the document since the `mouseup` might not occur within\n\t\t// the bounds of the element.\n\t\tdocument.addEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( true );\n\t};\n\n\tconst createMouseUp = ( event ) => {\n\t\t// In firefox, the mouse up event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\temitToChild( children, 'onMouseUp', event );\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( false );\n\t};\n\n\tconst createMouseEvent = ( type ) => {\n\t\tif ( type === 'mouseUp' ) return createMouseUp;\n\t\tif ( type === 'mouseDown' ) return createMouseDown;\n\t};\n\n\t/**\n\t * Prebound `isInMouseDown` handler, created as a constant reference to\n\t * assure ability to remove in component unmount.\n\t *\n\t * @type {Function}\n\t */\n\tconst cancelIsMouseDown = createMouseEvent( 'mouseUp' );\n\n\tconst createToggleIsOver = ( eventName, isDelayed ) => {\n\t\treturn ( event ) => {\n\t\t\t// Preserve original child callback behavior.\n\t\t\temitToChild( children, eventName, event );\n\n\t\t\t// Mouse events behave unreliably in React for disabled elements,\n\t\t\t// firing on mouseenter but not mouseleave. Further, the default\n\t\t\t// behavior for disabled elements in some browsers is to ignore\n\t\t\t// mouse events. Don't bother trying to handle them.\n\t\t\t//\n\t\t\t// See: https://github.com/facebook/react/issues/4251\n\t\t\tif ( event.currentTarget.disabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// A focus event will occur as a result of a mouse click, but it\n\t\t\t// should be disambiguated between interacting with the button and\n\t\t\t// using an explicit focus shift as a cue to display the tooltip.\n\t\t\tif ( 'focus' === event.type && isMouseDown ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Needed in case unsetting is over while delayed set pending, i.e.\n\t\t\t// quickly blur/mouseleave before delayedSetIsOver is called.\n\t\t\tdelayedSetIsOver.cancel();\n\n\t\t\tconst _isOver = [ 'focus', 'mouseenter' ].includes( event.type );\n\t\t\tif ( _isOver === isOver ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isDelayed ) {\n\t\t\t\tdelayedSetIsOver( _isOver );\n\t\t\t} else {\n\t\t\t\tsetIsOver( _isOver );\n\t\t\t}\n\t\t};\n\t};\n\tconst clearOnUnmount = () => {\n\t\tdelayedSetIsOver.cancel();\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t};\n\n\t// Ignore reason: updating the deps array here could cause unexpected changes in behavior.\n\t// Deferring until a more detailed investigation/refactor can be performed.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tuseEffect( () => clearOnUnmount, [] );\n\n\tif ( Children.count( children ) !== 1 ) {\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'Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\n\t\treturn children;\n\t}\n\n\tconst eventHandlers = {\n\t\tonMouseEnter: createToggleIsOver( 'onMouseEnter', true ),\n\t\tonMouseLeave: createToggleIsOver( 'onMouseLeave' ),\n\t\tonClick: createToggleIsOver( 'onClick' ),\n\t\tonFocus: createToggleIsOver( 'onFocus' ),\n\t\tonBlur: createToggleIsOver( 'onBlur' ),\n\t\tonMouseDown: createMouseEvent( 'mouseDown' ),\n\t};\n\n\tconst child = Children.only( children );\n\tconst { children: grandchildren, disabled } = child.props;\n\tconst getElementWithPopover = disabled\n\t\t? getDisabledElement\n\t\t: getRegularElement;\n\n\tconst popoverData = {\n\t\tanchor: popoverAnchor,\n\t\tisOver,\n\t\toffset: 4,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\t};\n\tconst childrenWithPopover = addPopoverToGrandchildren( {\n\t\tgrandchildren,\n\t\t...popoverData,\n\t\t...popoverProps,\n\t} );\n\n\treturn getElementWithPopover( {\n\t\tchild,\n\t\teventHandlers,\n\t\tchildrenWithPopover,\n\t\tmergedRefs: mergedChildRefs,\n\t} );\n}\n\nexport default Tooltip;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-select/index.tsx"],"names":["useMemo","decodeEntities","SelectControl","getSelectOptions","tree","level","flatMap","treeNode","value","id","label","repeat","name","children","TreeSelect","noOptionLabel","onChange","selectedId","props","options","filter","option"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,mBAA9B;;AAGA,SAASC,gBAAT,CAA2BC,IAA3B,EAAoE;AAAA,MAA3BC,KAA2B,uEAAnB,CAAmB;AACnE,SAAOD,IAAI,CAACE,OAAL,CA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*/\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, SelectOptions, Truthy } from './types';\n\nfunction getSelectOptions( tree: Tree[], level = 0 ): SelectOptions {\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 * @example\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\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 */\n\nexport function TreeSelect( {\n\tlabel,\n\tnoOptionLabel,\n\tonChange,\n\tselectedId,\n\ttree = [],\n\t...props\n}: TreeSelectProps ) {\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<SelectControl\n\t\t\t{ ...{ label, options, onChange } }\n\t\t\tvalue={ selectedId }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default TreeSelect;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-select/index.tsx"],"names":["useMemo","decodeEntities","SelectControl","getSelectOptions","tree","level","flatMap","treeNode","value","id","label","repeat","name","children","TreeSelect","noOptionLabel","onChange","selectedId","props","options","filter","option"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,mBAA9B;;AAGA,SAASC,gBAAT,CACCC,IADD,EAG+C;AAAA,MAD9CC,KAC8C,uEADtC,CACsC;AAC9C,SAAOD,IAAI,CAACE,OAAL,CAAgBC,QAAF,IAAgB,CACpC;AACCC,IAAAA,KAAK,EAAED,QAAQ,CAACE,EADjB;AAECC,IAAAA,KAAK,EACJ,SAASC,MAAT,CAAiBN,KAAK,GAAG,CAAzB,IAA+BJ,cAAc,CAAEM,QAAQ,CAACK,IAAX;AAH/C,GADoC,EAMpC,GAAGT,gBAAgB,CAAEI,QAAQ,CAACM,QAAT,IAAqB,EAAvB,EAA2BR,KAAK,GAAG,CAAnC,CANiB,CAA9B,CAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA,OAAO,SAASS,UAAT,OAOc;AAAA,MAPO;AAC3BJ,IAAAA,KAD2B;AAE3BK,IAAAA,aAF2B;AAG3BC,IAAAA,QAH2B;AAI3BC,IAAAA,UAJ2B;AAK3Bb,IAAAA,IAAI,GAAG,EALoB;AAM3B,OAAGc;AANwB,GAOP;AACpB,QAAMC,OAAO,GAAGnB,OAAO,CAAE,MAAM;AAC9B,WAAO,CACNe,aAAa,IAAI;AAAEP,MAAAA,KAAK,EAAE,EAAT;AAAaE,MAAAA,KAAK,EAAEK;AAApB,KADX,EAEN,GAAGZ,gBAAgB,CAAEC,IAAF,CAFb,EAGLgB,MAHK,CAGWC,MAAR,IAA8C,CAAC,CAAEA,MAHpD,CAAP;AAIA,GALsB,EAKpB,CAAEN,aAAF,EAAiBX,IAAjB,CALoB,CAAvB;AAOA,SACC,cAAC,aAAD;AACQM,IAAAA,KADR;AACeS,IAAAA,OADf;AACwBH,IAAAA,QADxB;AAEC,IAAA,KAAK,EAAGC;AAFT,KAGMC,KAHN,EADD;AAOA;AAED,eAAeJ,UAAf","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';\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 * @example\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\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 */\n\nexport function TreeSelect( {\n\tlabel,\n\tnoOptionLabel,\n\tonChange,\n\tselectedId,\n\ttree = [],\n\t...props\n}: TreeSelectProps ) {\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<SelectControl\n\t\t\t{ ...{ label, options, onChange } }\n\t\t\tvalue={ selectedId }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default TreeSelect;\n"]}
@@ -3,8 +3,9 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
+ import deepmerge from 'deepmerge';
6
7
  import fastDeepEqual from 'fast-deep-equal/es6';
7
- import { merge } from 'lodash';
8
+ import { isPlainObject } from 'is-plain-object';
8
9
  /**
9
10
  * WordPress dependencies
10
11
  */
@@ -45,7 +46,7 @@ function useContextSystemBridge(_ref) {
45
46
  }, [value]); // `parentContext` will always be memoized (i.e., the result of this hook itself)
46
47
  // or the default value from when the `ComponentsContext` was originally
47
48
  // initialized (which will never change, it's a static variable)
48
- // so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless
49
+ // so this memoization will prevent `deepmerge()` from rerunning unless
49
50
  // the references to `value` change OR the `parentContext` has an actual material change
50
51
  // (because again, it's guaranteed to be memoized or a static reference to the empty object
51
52
  // so we know that the only changes for `parentContext` are material ones... i.e., why we
@@ -53,11 +54,13 @@ function useContextSystemBridge(_ref) {
53
54
  // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are
54
55
  // correctly warning when the `value` isn't being properly memoized. All of that to say
55
56
  // that this should be super safe to assume that `useMemo` will only run on actual
56
- // changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`!
57
+ // changes to the two dependencies, therefore saving us calls to `deepmerge()`!
57
58
 
58
59
  const config = useMemo(() => {
59
60
  // Deep clone `parentContext` to avoid mutating it later.
60
- return merge(JSON.parse(JSON.stringify(parentContext)), value);
61
+ return deepmerge(parentContext !== null && parentContext !== void 0 ? parentContext : {}, value !== null && value !== void 0 ? value : {}, {
62
+ isMergeableObject: isPlainObject
63
+ });
61
64
  }, [parentContext, value]);
62
65
  return config;
63
66
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/context-system-provider.js"],"names":["fastDeepEqual","merge","createContext","useContext","useRef","useMemo","memo","warn","useUpdateEffect","ComponentsContext","useComponentsContext","useContextSystemBridge","value","parentContext","valueRef","current","JSON","stringify","config","parse","BaseContextSystemProvider","children","contextValue","ContextSystemProvider"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,qBAA1B;AACA,SAASC,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,UAFD,EAGCC,MAHD,EAICC,OAJD,EAKCC,IALD,QAMO,oBANP;AAOA,OAAOC,IAAP,MAAiB,oBAAjB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,aAAhC;AAEA,OAAO,MAAMC,iBAAiB,GAAGP,aAAa;AAC7C;AAAqC,EADQ,CAAvC;AAGP,OAAO,MAAMQ,oBAAoB,GAAG,MAAMP,UAAU,CAAEM,iBAAF,CAA7C;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASE,sBAAT,OAA6C;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAC5C,QAAMC,aAAa,GAAGH,oBAAoB,EAA1C;AAEA,QAAMI,QAAQ,GAAGV,MAAM,CAAEQ,KAAF,CAAvB;AAEAJ,EAAAA,eAAe,CAAE,MAAM;AACtB,SACC;AACAR,IAAAA,aAAa,CAAEc,QAAQ,CAACC,OAAX,EAAoBH,KAApB,CAAb,IACA;AACAE,IAAAA,QAAQ,CAACC,OAAT,KAAqBH,KAJtB,EAKE;AACD,+FAAAL,IAAI,CAAG,gCAAgCS,IAAI,CAACC,SAAL,CAAgBL,KAAhB,CAAyB,EAA5D,CAAJ;AACA;AACD,GATc,EASZ,CAAEA,KAAF,CATY,CAAf,CAL4C,CAgB5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,QAAMM,MAAM,GAAGb,OAAO,CAAE,MAAM;AAC7B;AACA,WAAOJ,KAAK,CAAEe,IAAI,CAACG,KAAL,CAAYH,IAAI,CAACC,SAAL,CAAgBJ,aAAhB,CAAZ,CAAF,EAAiDD,KAAjD,CAAZ;AACA,GAHqB,EAGnB,CAAEC,aAAF,EAAiBD,KAAjB,CAHmB,CAAtB;AAKA,SAAOM,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,yBAAyB,GAAG,SAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYT,IAAAA;AAAZ,GAAyB;AAC5D,QAAMU,YAAY,GAAGX,sBAAsB,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAA3C;AAEA,SACC,cAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGU;AAApC,KACGD,QADH,CADD;AAKA,CARD;;AAUA,OAAO,MAAME,qBAAqB,GAAGjB,IAAI,CAAEc,yBAAF,CAAlC","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { merge } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../../utils';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tfastDeepEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn merge( JSON.parse( JSON.stringify( parentContext ) ), value );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/context-system-provider.js"],"names":["deepmerge","fastDeepEqual","isPlainObject","createContext","useContext","useRef","useMemo","memo","warn","useUpdateEffect","ComponentsContext","useComponentsContext","useContextSystemBridge","value","parentContext","valueRef","current","JSON","stringify","config","isMergeableObject","BaseContextSystemProvider","children","contextValue","ContextSystemProvider"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,WAAtB;AACA,OAAOC,aAAP,MAA0B,qBAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,UAFD,EAGCC,MAHD,EAICC,OAJD,EAKCC,IALD,QAMO,oBANP;AAOA,OAAOC,IAAP,MAAiB,oBAAjB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,aAAhC;AAEA,OAAO,MAAMC,iBAAiB,GAAGP,aAAa;AAC7C;AAAqC,EADQ,CAAvC;AAGP,OAAO,MAAMQ,oBAAoB,GAAG,MAAMP,UAAU,CAAEM,iBAAF,CAA7C;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASE,sBAAT,OAA6C;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAC5C,QAAMC,aAAa,GAAGH,oBAAoB,EAA1C;AAEA,QAAMI,QAAQ,GAAGV,MAAM,CAAEQ,KAAF,CAAvB;AAEAJ,EAAAA,eAAe,CAAE,MAAM;AACtB,SACC;AACAR,IAAAA,aAAa,CAAEc,QAAQ,CAACC,OAAX,EAAoBH,KAApB,CAAb,IACA;AACAE,IAAAA,QAAQ,CAACC,OAAT,KAAqBH,KAJtB,EAKE;AACD,+FAAAL,IAAI,CAAG,gCAAgCS,IAAI,CAACC,SAAL,CAAgBL,KAAhB,CAAyB,EAA5D,CAAJ;AACA;AACD,GATc,EASZ,CAAEA,KAAF,CATY,CAAf,CAL4C,CAgB5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,QAAMM,MAAM,GAAGb,OAAO,CAAE,MAAM;AAC7B;AACA,WAAON,SAAS,CAAEc,aAAF,aAAEA,aAAF,cAAEA,aAAF,GAAmB,EAAnB,EAAuBD,KAAvB,aAAuBA,KAAvB,cAAuBA,KAAvB,GAAgC,EAAhC,EAAoC;AACnDO,MAAAA,iBAAiB,EAAElB;AADgC,KAApC,CAAhB;AAGA,GALqB,EAKnB,CAAEY,aAAF,EAAiBD,KAAjB,CALmB,CAAtB;AAOA,SAAOM,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,yBAAyB,GAAG,SAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYT,IAAAA;AAAZ,GAAyB;AAC5D,QAAMU,YAAY,GAAGX,sBAAsB,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAA3C;AAEA,SACC,cAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGU;AAApC,KACGD,QADH,CADD;AAKA,CARD;;AAUA,OAAO,MAAME,qBAAqB,GAAGjB,IAAI,CAAEc,yBAAF,CAAlC","sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../../utils';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tfastDeepEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `deepmerge()` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn deepmerge( parentContext ?? {}, value ?? {}, {\n\t\t\tisMergeableObject: isPlainObject,\n\t\t} );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { kebabCase } from 'lodash';
4
+ import { paramCase as kebabCase } from 'change-case';
5
5
  import memoize from 'memize';
6
6
  /**
7
7
  * Generates the connected component CSS className based on the namespace.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/get-styled-class-name-from-key.ts"],"names":["kebabCase","memoize","getStyledClassName","namespace","kebab","getStyledClassNameFromKey"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,OAAOC,OAAP,MAAoB,QAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,CAA6BC,SAA7B,EAAyD;AACxD,QAAMC,KAAK,GAAGJ,SAAS,CAAEG,SAAF,CAAvB;AACA,SAAQ,cAAcC,KAAO,EAA7B;AACA;;AAED,OAAO,MAAMC,yBAAyB,GAAGJ,OAAO,CAAEC,kBAAF,CAAzC","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport memoize from 'memize';\n\n/**\n * Generates the connected component CSS className based on the namespace.\n *\n * @param namespace The name of the connected component.\n * @return The generated CSS className.\n */\nfunction getStyledClassName( namespace: string ): string {\n\tconst kebab = kebabCase( namespace );\n\treturn `components-${ kebab }`;\n}\n\nexport const getStyledClassNameFromKey = memoize( getStyledClassName );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/get-styled-class-name-from-key.ts"],"names":["paramCase","kebabCase","memoize","getStyledClassName","namespace","kebab","getStyledClassNameFromKey"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,IAAIC,SAAtB,QAAuC,aAAvC;AACA,OAAOC,OAAP,MAAoB,QAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,CAA6BC,SAA7B,EAAyD;AACxD,QAAMC,KAAK,GAAGJ,SAAS,CAAEG,SAAF,CAAvB;AACA,SAAQ,cAAcC,KAAO,EAA7B;AACA;;AAED,OAAO,MAAMC,yBAAyB,GAAGJ,OAAO,CAAEC,kBAAF,CAAzC","sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\nimport memoize from 'memize';\n\n/**\n * Generates the connected component CSS className based on the namespace.\n *\n * @param namespace The name of the connected component.\n * @return The generated CSS className.\n */\nfunction getStyledClassName( namespace: string ): string {\n\tconst kebab = kebabCase( namespace );\n\treturn `components-${ kebab }`;\n}\n\nexport const getStyledClassNameFromKey = memoize( getStyledClassName );\n"]}
@@ -1,11 +1,6 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
1
  /**
6
2
  * Internal dependencies
7
3
  */
8
-
9
4
  import FONT from './font-values';
10
5
  /**
11
6
  *
@@ -14,6 +9,8 @@ import FONT from './font-values';
14
9
  */
15
10
 
16
11
  export function font(value) {
17
- return get(FONT, value, '');
12
+ var _FONT$value;
13
+
14
+ return (_FONT$value = FONT[value]) !== null && _FONT$value !== void 0 ? _FONT$value : '';
18
15
  }
19
16
  //# sourceMappingURL=font.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/font.js"],"names":["get","FONT","font","value"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,eAAjB;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,IAAT,CAAeC,KAAf,EAAuB;AAC7B,SAAOH,GAAG,CAAEC,IAAF,EAAQE,KAAR,EAAe,EAAf,CAAV;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport FONT from './font-values';\n\n/**\n *\n * @param {keyof FONT} value Path of value from `FONT`\n * @return {string} Font rule value\n */\nexport function font( value ) {\n\treturn get( FONT, value, '' );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/font.js"],"names":["FONT","font","value"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAP,MAAiB,eAAjB;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,IAAT,CAAeC,KAAf,EAAuB;AAAA;;AAC7B,wBAAOF,IAAI,CAAEE,KAAF,CAAX,qDAAwB,EAAxB;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport FONT from './font-values';\n\n/**\n *\n * @param {keyof FONT} value Path of value from `FONT`\n * @return {string} Font rule value\n */\nexport function font( value ) {\n\treturn FONT[ value ] ?? '';\n}\n"]}
@@ -6,11 +6,13 @@ import { useHStack } from '../h-stack';
6
6
  export function useVStack(props) {
7
7
  const {
8
8
  expanded = false,
9
+ alignment = 'stretch',
9
10
  ...otherProps
10
11
  } = useContextSystem(props, 'VStack');
11
12
  const hStackProps = useHStack({
12
13
  direction: 'column',
13
14
  expanded,
15
+ alignment,
14
16
  ...otherProps
15
17
  });
16
18
  return hStackProps;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/v-stack/hook.ts"],"names":["useContextSystem","useHStack","useVStack","props","expanded","otherProps","hStackProps","direction"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAA0D,eAA1D;AACA,SAASC,SAAT,QAA0B,YAA1B;AAGA,OAAO,SAASC,SAAT,CACNC,KADM,EAEL;AACD,QAAM;AAAEC,IAAAA,QAAQ,GAAG,KAAb;AAAoB,OAAGC;AAAvB,MAAsCL,gBAAgB,CAC3DG,KAD2D,EAE3D,QAF2D,CAA5D;AAKA,QAAMG,WAAW,GAAGL,SAAS,CAAE;AAC9BM,IAAAA,SAAS,EAAE,QADmB;AAE9BH,IAAAA,QAF8B;AAG9B,OAAGC;AAH2B,GAAF,CAA7B;AAMA,SAAOC,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useContextSystem, WordPressComponentProps } from '../ui/context';\nimport { useHStack } from '../h-stack';\nimport type { VStackProps } from './types';\n\nexport function useVStack(\n\tprops: WordPressComponentProps< VStackProps, 'div' >\n) {\n\tconst { expanded = false, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'VStack'\n\t);\n\n\tconst hStackProps = useHStack( {\n\t\tdirection: 'column',\n\t\texpanded,\n\t\t...otherProps,\n\t} );\n\n\treturn hStackProps;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/v-stack/hook.ts"],"names":["useContextSystem","useHStack","useVStack","props","expanded","alignment","otherProps","hStackProps","direction"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAA0D,eAA1D;AACA,SAASC,SAAT,QAA0B,YAA1B;AAGA,OAAO,SAASC,SAAT,CACNC,KADM,EAEL;AACD,QAAM;AACLC,IAAAA,QAAQ,GAAG,KADN;AAELC,IAAAA,SAAS,GAAG,SAFP;AAGL,OAAGC;AAHE,MAIFN,gBAAgB,CAAEG,KAAF,EAAS,QAAT,CAJpB;AAMA,QAAMI,WAAW,GAAGN,SAAS,CAAE;AAC9BO,IAAAA,SAAS,EAAE,QADmB;AAE9BJ,IAAAA,QAF8B;AAG9BC,IAAAA,SAH8B;AAI9B,OAAGC;AAJ2B,GAAF,CAA7B;AAOA,SAAOC,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useContextSystem, WordPressComponentProps } from '../ui/context';\nimport { useHStack } from '../h-stack';\nimport type { VStackProps } from './types';\n\nexport function useVStack(\n\tprops: WordPressComponentProps< VStackProps, 'div' >\n) {\n\tconst {\n\t\texpanded = false,\n\t\talignment = 'stretch',\n\t\t...otherProps\n\t} = useContextSystem( props, 'VStack' );\n\n\tconst hStackProps = useHStack( {\n\t\tdirection: 'column',\n\t\texpanded,\n\t\talignment,\n\t\t...otherProps,\n\t} );\n\n\treturn hStackProps;\n}\n"]}
@@ -315,7 +315,6 @@
315
315
  }
316
316
  .components-button.is-secondary:hover:not(:disabled), .components-button.is-tertiary:hover:not(:disabled) {
317
317
  color: var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1));
318
- box-shadow: inset 0 0 0 1px var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1));
319
318
  }
320
319
  .components-button.is-secondary:disabled, .components-button.is-secondary[aria-disabled=true], .components-button.is-secondary[aria-disabled=true]:hover, .components-button.is-tertiary:disabled, .components-button.is-tertiary[aria-disabled=true], .components-button.is-tertiary[aria-disabled=true]:hover {
321
320
  color: #828282;
@@ -332,12 +331,21 @@
332
331
  color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
333
332
  background: transparent;
334
333
  }
334
+ .components-button.is-secondary:hover:not(:disabled) {
335
+ box-shadow: inset 0 0 0 1px var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1));
336
+ }
335
337
  .components-button.is-tertiary {
336
338
  white-space: nowrap;
337
339
  color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
338
340
  background: transparent;
339
341
  padding: 6px;
340
342
  }
343
+ .components-button.is-tertiary:hover:not(:disabled) {
344
+ background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
345
+ }
346
+ .components-button.is-tertiary:active:not(:disabled) {
347
+ background: rgba(var(--wp-admin-theme-color--rgb), 0.08);
348
+ }
341
349
  .components-button.is-tertiary .dashicon {
342
350
  display: inline-block;
343
351
  flex: 0 0 auto;
@@ -1664,6 +1672,7 @@ body.is-dragging-components-draggable {
1664
1672
  .is-focusing-regions.is-distraction-free .interface-interface-skeleton__header .edit-post-header,
1665
1673
  .is-focusing-regions .interface-interface-skeleton__sidebar .edit-post-layout__toggle-sidebar-panel,
1666
1674
  .is-focusing-regions .interface-interface-skeleton__actions .edit-post-layout__toggle-publish-panel,
1675
+ .is-focusing-regions .interface-interface-skeleton__actions .edit-post-layout__toggle-entities-saved-states-panel,
1667
1676
  .is-focusing-regions .editor-post-publish-panel {
1668
1677
  outline: 4px solid var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
1669
1678
  outline-offset: -4px;
@@ -2747,20 +2756,15 @@ See https://bugs.webkit.org/show_bug.cgi?id=187903. */
2747
2756
  .components-responsive-wrapper {
2748
2757
  position: relative;
2749
2758
  max-width: 100%;
2750
- }
2751
- .components-responsive-wrapper, .components-responsive-wrapper > span {
2752
- display: block;
2759
+ display: flex;
2760
+ align-items: center;
2761
+ justify-content: center;
2753
2762
  }
2754
2763
 
2755
2764
  .components-responsive-wrapper__content {
2756
- position: absolute;
2757
- top: 0;
2758
- left: 0;
2759
- bottom: 0;
2760
- right: 0;
2765
+ display: block;
2766
+ max-width: 100%;
2761
2767
  width: 100%;
2762
- height: 100%;
2763
- margin: auto;
2764
2768
  }
2765
2769
 
2766
2770
  .components-sandbox {
@@ -315,7 +315,6 @@
315
315
  }
316
316
  .components-button.is-secondary:hover:not(:disabled), .components-button.is-tertiary:hover:not(:disabled) {
317
317
  color: var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1));
318
- box-shadow: inset 0 0 0 1px var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1));
319
318
  }
320
319
  .components-button.is-secondary:disabled, .components-button.is-secondary[aria-disabled=true], .components-button.is-secondary[aria-disabled=true]:hover, .components-button.is-tertiary:disabled, .components-button.is-tertiary[aria-disabled=true], .components-button.is-tertiary[aria-disabled=true]:hover {
321
320
  color: #828282;
@@ -332,12 +331,21 @@
332
331
  color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
333
332
  background: transparent;
334
333
  }
334
+ .components-button.is-secondary:hover:not(:disabled) {
335
+ box-shadow: inset 0 0 0 1px var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #006ba1));
336
+ }
335
337
  .components-button.is-tertiary {
336
338
  white-space: nowrap;
337
339
  color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
338
340
  background: transparent;
339
341
  padding: 6px;
340
342
  }
343
+ .components-button.is-tertiary:hover:not(:disabled) {
344
+ background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
345
+ }
346
+ .components-button.is-tertiary:active:not(:disabled) {
347
+ background: rgba(var(--wp-admin-theme-color--rgb), 0.08);
348
+ }
341
349
  .components-button.is-tertiary .dashicon {
342
350
  display: inline-block;
343
351
  flex: 0 0 auto;
@@ -1667,6 +1675,7 @@ body.is-dragging-components-draggable {
1667
1675
  .is-focusing-regions.is-distraction-free .interface-interface-skeleton__header .edit-post-header,
1668
1676
  .is-focusing-regions .interface-interface-skeleton__sidebar .edit-post-layout__toggle-sidebar-panel,
1669
1677
  .is-focusing-regions .interface-interface-skeleton__actions .edit-post-layout__toggle-publish-panel,
1678
+ .is-focusing-regions .interface-interface-skeleton__actions .edit-post-layout__toggle-entities-saved-states-panel,
1670
1679
  .is-focusing-regions .editor-post-publish-panel {
1671
1680
  outline: 4px solid var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
1672
1681
  outline-offset: -4px;
@@ -2757,20 +2766,15 @@ See https://bugs.webkit.org/show_bug.cgi?id=187903. */
2757
2766
  .components-responsive-wrapper {
2758
2767
  position: relative;
2759
2768
  max-width: 100%;
2760
- }
2761
- .components-responsive-wrapper, .components-responsive-wrapper > span {
2762
- display: block;
2769
+ display: flex;
2770
+ align-items: center;
2771
+ justify-content: center;
2763
2772
  }
2764
2773
 
2765
2774
  .components-responsive-wrapper__content {
2766
- position: absolute;
2767
- top: 0;
2768
- right: 0;
2769
- bottom: 0;
2770
- left: 0;
2775
+ display: block;
2776
+ max-width: 100%;
2771
2777
  width: 100%;
2772
- height: 100%;
2773
- margin: auto;
2774
2778
  }
2775
2779
 
2776
2780
  .components-sandbox {