@wordpress/components 23.5.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 (898) hide show
  1. package/CHANGELOG.md +40 -7
  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 +5 -5
  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 +25 -91
  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/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  13. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  14. package/build/custom-gradient-picker/gradient-bar/index.js +2 -0
  15. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  16. package/build/custom-gradient-picker/gradient-bar/utils.js +2 -0
  17. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  18. package/build/custom-gradient-picker/index.js +2 -0
  19. package/build/custom-gradient-picker/index.js.map +1 -1
  20. package/build/custom-gradient-picker/serializer.js +1 -0
  21. package/build/custom-gradient-picker/serializer.js.map +1 -1
  22. package/build/custom-gradient-picker/utils.js +2 -0
  23. package/build/custom-gradient-picker/utils.js.map +1 -1
  24. package/build/dimension-control/index.js +31 -5
  25. package/build/dimension-control/index.js.map +1 -1
  26. package/build/dimension-control/sizes.js +2 -4
  27. package/build/dimension-control/sizes.js.map +1 -1
  28. package/build/dimension-control/types.js +6 -0
  29. package/build/dimension-control/types.js.map +1 -0
  30. package/build/flex/flex/hook.js +3 -3
  31. package/build/flex/flex/hook.js.map +1 -1
  32. package/build/font-size-picker/index.js +2 -1
  33. package/build/font-size-picker/index.js.map +1 -1
  34. package/build/form-token-field/index.js +1 -1
  35. package/build/form-token-field/index.js.map +1 -1
  36. package/build/gradient-picker/index.js +2 -0
  37. package/build/gradient-picker/index.js.map +1 -1
  38. package/build/guide/icons.js.map +1 -1
  39. package/build/guide/index.js +46 -8
  40. package/build/guide/index.js.map +1 -1
  41. package/build/guide/page-control.js.map +1 -1
  42. package/build/guide/page.js.map +1 -1
  43. package/build/guide/types.js +6 -0
  44. package/build/guide/types.js.map +1 -0
  45. package/build/h-stack/utils.js +5 -5
  46. package/build/h-stack/utils.js.map +1 -1
  47. package/build/higher-order/navigate-regions/index.js +33 -3
  48. package/build/higher-order/navigate-regions/index.js.map +1 -1
  49. package/build/higher-order/with-fallback-styles/index.js +2 -2
  50. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  51. package/build/higher-order/with-filters/index.js +31 -7
  52. package/build/higher-order/with-filters/index.js.map +1 -1
  53. package/build/higher-order/with-focus-return/index.js +10 -10
  54. package/build/higher-order/with-focus-return/index.js.map +1 -1
  55. package/build/higher-order/with-notices/index.js +28 -25
  56. package/build/higher-order/with-notices/index.js.map +1 -1
  57. package/build/higher-order/with-notices/types.js +6 -0
  58. package/build/higher-order/with-notices/types.js.map +1 -0
  59. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  60. package/build/icon/index.js +1 -8
  61. package/build/icon/index.js.map +1 -1
  62. package/build/index.native.js +18 -9
  63. package/build/index.native.js.map +1 -1
  64. package/build/mobile/bottom-sheet/cell.native.js +1 -1
  65. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  66. package/build/mobile/bottom-sheet-text-control/index.native.js +4 -3
  67. package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  68. package/build/navigation/back-button/index.js +6 -5
  69. package/build/navigation/back-button/index.js.map +1 -1
  70. package/build/navigation/constants.js.map +1 -1
  71. package/build/navigation/context.js +7 -4
  72. package/build/navigation/context.js.map +1 -1
  73. package/build/navigation/group/context.js.map +1 -1
  74. package/build/navigation/group/index.js +5 -1
  75. package/build/navigation/group/index.js.map +1 -1
  76. package/build/navigation/index.js +49 -3
  77. package/build/navigation/index.js.map +1 -1
  78. package/build/navigation/item/base-content.js +0 -1
  79. package/build/navigation/item/base-content.js.map +1 -1
  80. package/build/navigation/item/base.js.map +1 -1
  81. package/build/navigation/item/index.js +5 -1
  82. package/build/navigation/item/index.js.map +1 -1
  83. package/build/navigation/item/use-navigation-tree-item.js +1 -1
  84. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  85. package/build/navigation/menu/context.js.map +1 -1
  86. package/build/navigation/menu/index.js +5 -1
  87. package/build/navigation/menu/index.js.map +1 -1
  88. package/build/navigation/menu/menu-title-search.js +8 -6
  89. package/build/navigation/menu/menu-title-search.js.map +1 -1
  90. package/build/navigation/menu/menu-title.js +4 -2
  91. package/build/navigation/menu/menu-title.js.map +1 -1
  92. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  93. package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  94. package/build/navigation/styles/navigation-styles.js +36 -36
  95. package/build/navigation/styles/navigation-styles.js.map +1 -1
  96. package/build/navigation/types.js +6 -0
  97. package/build/navigation/types.js.map +1 -0
  98. package/build/navigation/use-create-navigation-tree.js +7 -0
  99. package/build/navigation/use-create-navigation-tree.js.map +1 -1
  100. package/build/navigation/use-navigation-tree-nodes.js +3 -5
  101. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  102. package/build/navigation/utils.js.map +1 -1
  103. package/build/navigator/navigator-screen/component.js +5 -3
  104. package/build/navigator/navigator-screen/component.js.map +1 -1
  105. package/build/number-control/index.js +1 -3
  106. package/build/number-control/index.js.map +1 -1
  107. package/build/palette-edit/index.js +67 -27
  108. package/build/palette-edit/index.js.map +1 -1
  109. package/build/palette-edit/types.js +6 -0
  110. package/build/palette-edit/types.js.map +1 -0
  111. package/build/panel/body.js +15 -17
  112. package/build/panel/body.js.map +1 -1
  113. package/build/placeholder/index.js.map +1 -1
  114. package/build/query-controls/author-select.js +0 -4
  115. package/build/query-controls/author-select.js.map +1 -1
  116. package/build/query-controls/category-select.js +0 -4
  117. package/build/query-controls/category-select.js.map +1 -1
  118. package/build/query-controls/terms.js +30 -15
  119. package/build/query-controls/terms.js.map +1 -1
  120. package/build/range-control/index.js.map +1 -1
  121. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  122. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  123. package/build/responsive-wrapper/index.js +12 -13
  124. package/build/responsive-wrapper/index.js.map +1 -1
  125. package/build/select-control/index.js +19 -16
  126. package/build/select-control/index.js.map +1 -1
  127. package/build/toolbar/toolbar-button/index.js +32 -10
  128. package/build/toolbar/toolbar-button/index.js.map +1 -1
  129. package/build/toolbar/toolbar-button/toolbar-button-container.js +12 -4
  130. package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  131. package/build/toolbar/toolbar-button/types.js +6 -0
  132. package/build/toolbar/toolbar-button/types.js.map +1 -0
  133. package/build/toolbar/toolbar-context/index.js +4 -2
  134. package/build/toolbar/toolbar-context/index.js.map +1 -1
  135. package/build/tooltip/index.js +18 -6
  136. package/build/tooltip/index.js.map +1 -1
  137. package/build/tree-select/index.js.map +1 -1
  138. package/build/ui/context/get-styled-class-name-from-key.js +2 -2
  139. package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
  140. package/build/utils/font.js +3 -7
  141. package/build/utils/font.js.map +1 -1
  142. package/build/v-stack/hook.js +2 -0
  143. package/build/v-stack/hook.js.map +1 -1
  144. package/build-module/animate/index.js +3 -1
  145. package/build-module/animate/index.js.map +1 -1
  146. package/build-module/animation/index.js.map +1 -1
  147. package/build-module/autocomplete/autocompleter-ui.js +6 -6
  148. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  149. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  150. package/build-module/autocomplete/index.js +28 -94
  151. package/build-module/autocomplete/index.js.map +1 -1
  152. package/build-module/autocomplete/types.js +2 -0
  153. package/build-module/autocomplete/types.js.map +1 -0
  154. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  155. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  156. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
  157. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  158. package/build-module/custom-gradient-picker/gradient-bar/utils.js +2 -0
  159. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  160. package/build-module/custom-gradient-picker/index.js +1 -0
  161. package/build-module/custom-gradient-picker/index.js.map +1 -1
  162. package/build-module/custom-gradient-picker/serializer.js +1 -0
  163. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  164. package/build-module/custom-gradient-picker/utils.js +2 -0
  165. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  166. package/build-module/dimension-control/index.js +28 -3
  167. package/build-module/dimension-control/index.js.map +1 -1
  168. package/build-module/dimension-control/sizes.js +6 -5
  169. package/build-module/dimension-control/sizes.js.map +1 -1
  170. package/build-module/dimension-control/types.js +2 -0
  171. package/build-module/dimension-control/types.js.map +1 -0
  172. package/build-module/flex/flex/hook.js +3 -3
  173. package/build-module/flex/flex/hook.js.map +1 -1
  174. package/build-module/font-size-picker/index.js +2 -1
  175. package/build-module/font-size-picker/index.js.map +1 -1
  176. package/build-module/form-token-field/index.js +1 -1
  177. package/build-module/form-token-field/index.js.map +1 -1
  178. package/build-module/gradient-picker/index.js +1 -0
  179. package/build-module/gradient-picker/index.js.map +1 -1
  180. package/build-module/guide/icons.js.map +1 -1
  181. package/build-module/guide/index.js +45 -8
  182. package/build-module/guide/index.js.map +1 -1
  183. package/build-module/guide/page-control.js.map +1 -1
  184. package/build-module/guide/page.js +4 -0
  185. package/build-module/guide/page.js.map +1 -1
  186. package/build-module/guide/types.js +2 -0
  187. package/build-module/guide/types.js.map +1 -0
  188. package/build-module/h-stack/utils.js +5 -5
  189. package/build-module/h-stack/utils.js.map +1 -1
  190. package/build-module/higher-order/navigate-regions/index.js +33 -3
  191. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  192. package/build-module/higher-order/with-fallback-styles/index.js +2 -2
  193. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  194. package/build-module/higher-order/with-filters/index.js +31 -7
  195. package/build-module/higher-order/with-filters/index.js.map +1 -1
  196. package/build-module/higher-order/with-focus-return/index.js +10 -10
  197. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  198. package/build-module/higher-order/with-notices/index.js +29 -26
  199. package/build-module/higher-order/with-notices/index.js.map +1 -1
  200. package/build-module/higher-order/with-notices/types.js +2 -0
  201. package/build-module/higher-order/with-notices/types.js.map +1 -0
  202. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  203. package/build-module/icon/index.js +2 -9
  204. package/build-module/icon/index.js.map +1 -1
  205. package/build-module/index.native.js +1 -0
  206. package/build-module/index.native.js.map +1 -1
  207. package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
  208. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  209. package/build-module/mobile/bottom-sheet-text-control/index.native.js +4 -3
  210. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  211. package/build-module/navigation/back-button/index.js +4 -3
  212. package/build-module/navigation/back-button/index.js.map +1 -1
  213. package/build-module/navigation/constants.js.map +1 -1
  214. package/build-module/navigation/context.js +7 -4
  215. package/build-module/navigation/context.js.map +1 -1
  216. package/build-module/navigation/group/context.js +4 -0
  217. package/build-module/navigation/group/context.js.map +1 -1
  218. package/build-module/navigation/group/index.js +2 -1
  219. package/build-module/navigation/group/index.js.map +1 -1
  220. package/build-module/navigation/index.js +46 -3
  221. package/build-module/navigation/index.js.map +1 -1
  222. package/build-module/navigation/item/base-content.js +0 -1
  223. package/build-module/navigation/item/base-content.js.map +1 -1
  224. package/build-module/navigation/item/base.js.map +1 -1
  225. package/build-module/navigation/item/index.js +2 -1
  226. package/build-module/navigation/item/index.js.map +1 -1
  227. package/build-module/navigation/item/use-navigation-tree-item.js +1 -1
  228. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  229. package/build-module/navigation/menu/context.js +4 -0
  230. package/build-module/navigation/menu/context.js.map +1 -1
  231. package/build-module/navigation/menu/index.js +2 -1
  232. package/build-module/navigation/menu/index.js.map +1 -1
  233. package/build-module/navigation/menu/menu-title-search.js +8 -6
  234. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  235. package/build-module/navigation/menu/menu-title.js +4 -2
  236. package/build-module/navigation/menu/menu-title.js.map +1 -1
  237. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  238. package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  239. package/build-module/navigation/styles/navigation-styles.js +36 -36
  240. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  241. package/build-module/navigation/types.js +2 -0
  242. package/build-module/navigation/types.js.map +1 -0
  243. package/build-module/navigation/use-create-navigation-tree.js +7 -0
  244. package/build-module/navigation/use-create-navigation-tree.js.map +1 -1
  245. package/build-module/navigation/use-navigation-tree-nodes.js +2 -2
  246. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  247. package/build-module/navigation/utils.js.map +1 -1
  248. package/build-module/navigator/navigator-screen/component.js +5 -3
  249. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  250. package/build-module/number-control/index.js +1 -3
  251. package/build-module/number-control/index.js.map +1 -1
  252. package/build-module/palette-edit/index.js +65 -27
  253. package/build-module/palette-edit/index.js.map +1 -1
  254. package/build-module/palette-edit/types.js +2 -0
  255. package/build-module/palette-edit/types.js.map +1 -0
  256. package/build-module/panel/body.js +12 -12
  257. package/build-module/panel/body.js.map +1 -1
  258. package/build-module/placeholder/index.js.map +1 -1
  259. package/build-module/query-controls/author-select.js +0 -4
  260. package/build-module/query-controls/author-select.js.map +1 -1
  261. package/build-module/query-controls/category-select.js +1 -5
  262. package/build-module/query-controls/category-select.js.map +1 -1
  263. package/build-module/query-controls/terms.js +29 -16
  264. package/build-module/query-controls/terms.js.map +1 -1
  265. package/build-module/range-control/index.js.map +1 -1
  266. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +5 -5
  267. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  268. package/build-module/responsive-wrapper/index.js +12 -12
  269. package/build-module/responsive-wrapper/index.js.map +1 -1
  270. package/build-module/select-control/index.js +20 -17
  271. package/build-module/select-control/index.js.map +1 -1
  272. package/build-module/toolbar/toolbar-button/index.js +32 -9
  273. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  274. package/build-module/toolbar/toolbar-button/toolbar-button-container.js +12 -4
  275. package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  276. package/build-module/toolbar/toolbar-button/types.js +2 -0
  277. package/build-module/toolbar/toolbar-button/types.js.map +1 -0
  278. package/build-module/toolbar/toolbar-context/index.js +4 -2
  279. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  280. package/build-module/tooltip/index.js +16 -6
  281. package/build-module/tooltip/index.js.map +1 -1
  282. package/build-module/tree-select/index.js.map +1 -1
  283. package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
  284. package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
  285. package/build-module/utils/font.js +3 -6
  286. package/build-module/utils/font.js.map +1 -1
  287. package/build-module/v-stack/hook.js +2 -0
  288. package/build-module/v-stack/hook.js.map +1 -1
  289. package/build-style/style-rtl.css +14 -11
  290. package/build-style/style.css +14 -11
  291. package/build-types/alignment-matrix-control/types.d.ts +4 -4
  292. package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
  293. package/build-types/angle-picker-control/types.d.ts +2 -2
  294. package/build-types/angle-picker-control/types.d.ts.map +1 -1
  295. package/build-types/animate/index.d.ts +2 -2
  296. package/build-types/animate/index.d.ts.map +1 -1
  297. package/build-types/animation/index.d.ts +8 -1
  298. package/build-types/animation/index.d.ts.map +1 -1
  299. package/build-types/autocomplete/autocompleter-ui.d.ts +4 -0
  300. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -0
  301. package/build-types/autocomplete/get-default-use-items.d.ts +3 -0
  302. package/build-types/autocomplete/get-default-use-items.d.ts.map +1 -0
  303. package/build-types/autocomplete/index.d.ts +23 -0
  304. package/build-types/autocomplete/index.d.ts.map +1 -0
  305. package/build-types/autocomplete/test/index.d.ts +2 -0
  306. package/build-types/autocomplete/test/index.d.ts.map +1 -0
  307. package/build-types/autocomplete/types.d.ts +201 -0
  308. package/build-types/autocomplete/types.d.ts.map +1 -0
  309. package/build-types/base-control/types.d.ts +2 -2
  310. package/build-types/base-control/types.d.ts.map +1 -1
  311. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  312. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  313. package/build-types/border-box-control/styles.d.ts +3 -3
  314. package/build-types/border-box-control/styles.d.ts.map +1 -1
  315. package/build-types/border-box-control/types.d.ts +8 -8
  316. package/build-types/border-box-control/types.d.ts.map +1 -1
  317. package/build-types/border-box-control/utils.d.ts +5 -5
  318. package/build-types/border-box-control/utils.d.ts.map +1 -1
  319. package/build-types/border-control/border-control/hook.d.ts +3 -3
  320. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  321. package/build-types/border-control/border-control-dropdown/hook.d.ts +2 -2
  322. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  323. package/build-types/border-control/styles.d.ts +4 -4
  324. package/build-types/border-control/styles.d.ts.map +1 -1
  325. package/build-types/border-control/types.d.ts +6 -6
  326. package/build-types/border-control/types.d.ts.map +1 -1
  327. package/build-types/box-control/types.d.ts +6 -6
  328. package/build-types/box-control/types.d.ts.map +1 -1
  329. package/build-types/button/deprecated.d.ts +6 -6
  330. package/build-types/button/types.d.ts +10 -10
  331. package/build-types/button/types.d.ts.map +1 -1
  332. package/build-types/button-group/types.d.ts +1 -1
  333. package/build-types/button-group/types.d.ts.map +1 -1
  334. package/build-types/card/card/hook.d.ts +1 -1
  335. package/build-types/card/card/hook.d.ts.map +1 -1
  336. package/build-types/card/types.d.ts +10 -10
  337. package/build-types/card/types.d.ts.map +1 -1
  338. package/build-types/checkbox-control/types.d.ts +1 -1
  339. package/build-types/checkbox-control/types.d.ts.map +1 -1
  340. package/build-types/circular-option-picker/types.d.ts +4 -4
  341. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  342. package/build-types/color-indicator/types.d.ts +1 -1
  343. package/build-types/color-indicator/types.d.ts.map +1 -1
  344. package/build-types/color-list-picker/types.d.ts +2 -2
  345. package/build-types/color-list-picker/types.d.ts.map +1 -1
  346. package/build-types/color-palette/types.d.ts +7 -7
  347. package/build-types/color-palette/types.d.ts.map +1 -1
  348. package/build-types/color-palette/utils.d.ts +1 -1
  349. package/build-types/color-palette/utils.d.ts.map +1 -1
  350. package/build-types/color-picker/legacy-adapter.d.ts +1 -1
  351. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  352. package/build-types/color-picker/styles.d.ts +3 -3
  353. package/build-types/color-picker/types.d.ts +2 -2
  354. package/build-types/color-picker/types.d.ts.map +1 -1
  355. package/build-types/color-picker/use-deprecated-props.d.ts +2 -2
  356. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  357. package/build-types/combobox-control/types.d.ts +2 -2
  358. package/build-types/combobox-control/types.d.ts.map +1 -1
  359. package/build-types/confirm-dialog/component.d.ts +4 -4
  360. package/build-types/confirm-dialog/types.d.ts +5 -5
  361. package/build-types/confirm-dialog/types.d.ts.map +1 -1
  362. package/build-types/custom-gradient-picker/constants.d.ts +25 -0
  363. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -0
  364. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +8 -0
  365. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -0
  366. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +25 -0
  367. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -0
  368. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +10 -0
  369. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -0
  370. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +138 -0
  371. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -0
  372. package/build-types/custom-gradient-picker/index.d.ts +7 -0
  373. package/build-types/custom-gradient-picker/index.d.ts.map +1 -0
  374. package/build-types/custom-gradient-picker/serializer.d.ts +17 -0
  375. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -0
  376. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +11 -0
  377. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -0
  378. package/build-types/custom-gradient-picker/utils.d.ts +5 -0
  379. package/build-types/custom-gradient-picker/utils.d.ts.map +1 -0
  380. package/build-types/custom-select-control/styles.d.ts +1 -1
  381. package/build-types/custom-select-control/styles.d.ts.map +1 -1
  382. package/build-types/dashicon/types.d.ts +2 -2
  383. package/build-types/dashicon/types.d.ts.map +1 -1
  384. package/build-types/date-time/date-time/styles.d.ts +1 -4
  385. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  386. package/build-types/date-time/time/styles.d.ts +1 -1
  387. package/build-types/date-time/types.d.ts +4 -4
  388. package/build-types/date-time/types.d.ts.map +1 -1
  389. package/build-types/dimension-control/index.d.ts +28 -0
  390. package/build-types/dimension-control/index.d.ts.map +1 -0
  391. package/build-types/dimension-control/sizes.d.ts +26 -0
  392. package/build-types/dimension-control/sizes.d.ts.map +1 -0
  393. package/build-types/dimension-control/stories/index.d.ts +12 -0
  394. package/build-types/dimension-control/stories/index.d.ts.map +1 -0
  395. package/build-types/dimension-control/types.d.ts +47 -0
  396. package/build-types/dimension-control/types.d.ts.map +1 -0
  397. package/build-types/divider/types.d.ts +1 -1
  398. package/build-types/divider/types.d.ts.map +1 -1
  399. package/build-types/draggable/types.d.ts +1 -1
  400. package/build-types/draggable/types.d.ts.map +1 -1
  401. package/build-types/drop-zone/types.d.ts +2 -2
  402. package/build-types/drop-zone/types.d.ts.map +1 -1
  403. package/build-types/dropdown/types.d.ts +3 -3
  404. package/build-types/dropdown/types.d.ts.map +1 -1
  405. package/build-types/elevation/types.d.ts +1 -1
  406. package/build-types/elevation/types.d.ts.map +1 -1
  407. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  408. package/build-types/external-link/types.d.ts +1 -1
  409. package/build-types/external-link/types.d.ts.map +1 -1
  410. package/build-types/flex/types.d.ts +4 -4
  411. package/build-types/flex/types.d.ts.map +1 -1
  412. package/build-types/focal-point-picker/types.d.ts +7 -7
  413. package/build-types/focal-point-picker/types.d.ts.map +1 -1
  414. package/build-types/font-size-picker/index.d.ts.map +1 -1
  415. package/build-types/font-size-picker/stories/index.d.ts.map +1 -1
  416. package/build-types/font-size-picker/types.d.ts +9 -5
  417. package/build-types/font-size-picker/types.d.ts.map +1 -1
  418. package/build-types/form-file-upload/types.d.ts +1 -1
  419. package/build-types/form-file-upload/types.d.ts.map +1 -1
  420. package/build-types/form-toggle/types.d.ts +1 -1
  421. package/build-types/form-toggle/types.d.ts.map +1 -1
  422. package/build-types/form-token-field/index.d.ts.map +1 -1
  423. package/build-types/form-token-field/stories/index.d.ts +6 -0
  424. package/build-types/form-token-field/stories/index.d.ts.map +1 -1
  425. package/build-types/form-token-field/styles.d.ts +1 -1
  426. package/build-types/form-token-field/styles.d.ts.map +1 -1
  427. package/build-types/form-token-field/types.d.ts +1 -1
  428. package/build-types/form-token-field/types.d.ts.map +1 -1
  429. package/build-types/gradient-picker/index.d.ts +12 -0
  430. package/build-types/gradient-picker/index.d.ts.map +1 -0
  431. package/build-types/grid/types.d.ts +2 -2
  432. package/build-types/grid/types.d.ts.map +1 -1
  433. package/build-types/guide/icons.d.ts +5 -0
  434. package/build-types/guide/icons.d.ts.map +1 -0
  435. package/build-types/guide/index.d.ts +37 -0
  436. package/build-types/guide/index.d.ts.map +1 -0
  437. package/build-types/guide/page-control.d.ts +4 -0
  438. package/build-types/guide/page-control.d.ts.map +1 -0
  439. package/build-types/guide/page.d.ts +7 -0
  440. package/build-types/guide/page.d.ts.map +1 -0
  441. package/build-types/guide/stories/index.d.ts +9 -0
  442. package/build-types/guide/stories/index.d.ts.map +1 -0
  443. package/build-types/guide/test/index.d.ts +2 -0
  444. package/build-types/guide/test/index.d.ts.map +1 -0
  445. package/build-types/guide/types.d.ts +65 -0
  446. package/build-types/guide/types.d.ts.map +1 -0
  447. package/build-types/h-stack/types.d.ts +6 -6
  448. package/build-types/h-stack/types.d.ts.map +1 -1
  449. package/build-types/heading/hook.d.ts +1 -1
  450. package/build-types/heading/types.d.ts +2 -2
  451. package/build-types/heading/types.d.ts.map +1 -1
  452. package/build-types/higher-order/navigate-regions/index.d.ts +46 -0
  453. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -0
  454. package/build-types/higher-order/with-fallback-styles/index.d.ts +44 -0
  455. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -0
  456. package/build-types/higher-order/with-filters/index.d.ts +89 -0
  457. package/build-types/higher-order/with-filters/index.d.ts.map +1 -0
  458. package/build-types/higher-order/with-filters/test/index.d.ts +2 -0
  459. package/build-types/higher-order/with-filters/test/index.d.ts.map +1 -0
  460. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  461. package/build-types/higher-order/with-focus-return/index.d.ts +20 -0
  462. package/build-types/higher-order/with-focus-return/index.d.ts.map +1 -0
  463. package/build-types/higher-order/with-focus-return/test/index.d.ts +2 -0
  464. package/build-types/higher-order/with-focus-return/test/index.d.ts.map +1 -0
  465. package/build-types/higher-order/with-notices/index.d.ts +37 -0
  466. package/build-types/higher-order/with-notices/index.d.ts.map +1 -0
  467. package/build-types/higher-order/with-notices/test/index.d.ts +2 -0
  468. package/build-types/higher-order/with-notices/test/index.d.ts.map +1 -0
  469. package/build-types/higher-order/with-notices/types.d.ts +34 -0
  470. package/build-types/higher-order/with-notices/types.d.ts.map +1 -0
  471. package/build-types/higher-order/with-spoken-messages/index.d.ts +13 -2
  472. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  473. package/build-types/higher-order/with-spoken-messages/test/index.d.ts +2 -0
  474. package/build-types/higher-order/with-spoken-messages/test/index.d.ts.map +1 -0
  475. package/build-types/icon/index.d.ts +10 -6
  476. package/build-types/icon/index.d.ts.map +1 -1
  477. package/build-types/icon/test/index.d.ts +2 -0
  478. package/build-types/icon/test/index.d.ts.map +1 -0
  479. package/build-types/input-control/reducer/actions.d.ts +15 -15
  480. package/build-types/input-control/reducer/actions.d.ts.map +1 -1
  481. package/build-types/input-control/reducer/state.d.ts +1 -1
  482. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  483. package/build-types/input-control/styles/input-control-styles.d.ts +4 -4
  484. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  485. package/build-types/input-control/types.d.ts +7 -7
  486. package/build-types/input-control/types.d.ts.map +1 -1
  487. package/build-types/item-group/item/hook.d.ts +1 -1
  488. package/build-types/item-group/types.d.ts +2 -2
  489. package/build-types/item-group/types.d.ts.map +1 -1
  490. package/build-types/keyboard-shortcuts/types.d.ts +3 -3
  491. package/build-types/keyboard-shortcuts/types.d.ts.map +1 -1
  492. package/build-types/menu-group/types.d.ts +1 -1
  493. package/build-types/menu-group/types.d.ts.map +1 -1
  494. package/build-types/menu-item/index.d.ts +1 -1
  495. package/build-types/menu-items-choice/types.d.ts +2 -2
  496. package/build-types/menu-items-choice/types.d.ts.map +1 -1
  497. package/build-types/modal/types.d.ts +1 -1
  498. package/build-types/modal/types.d.ts.map +1 -1
  499. package/build-types/navigable-container/container.d.ts +1 -1
  500. package/build-types/navigable-container/menu.d.ts +1 -1
  501. package/build-types/navigable-container/tabbable.d.ts +1 -1
  502. package/build-types/navigation/back-button/index.d.ts +5 -0
  503. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  504. package/build-types/navigation/constants.d.ts +3 -0
  505. package/build-types/navigation/constants.d.ts.map +1 -0
  506. package/build-types/navigation/context.d.ts +5 -0
  507. package/build-types/navigation/context.d.ts.map +1 -0
  508. package/build-types/navigation/group/context.d.ts +8 -0
  509. package/build-types/navigation/group/context.d.ts.map +1 -0
  510. package/build-types/navigation/group/index.d.ts +5 -0
  511. package/build-types/navigation/group/index.d.ts.map +1 -0
  512. package/build-types/navigation/index.d.ts +46 -0
  513. package/build-types/navigation/index.d.ts.map +1 -0
  514. package/build-types/navigation/item/base-content.d.ts +4 -0
  515. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  516. package/build-types/navigation/item/base.d.ts +4 -0
  517. package/build-types/navigation/item/base.d.ts.map +1 -0
  518. package/build-types/navigation/item/index.d.ts +5 -0
  519. package/build-types/navigation/item/index.d.ts.map +1 -0
  520. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  521. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  522. package/build-types/navigation/menu/context.d.ts +8 -0
  523. package/build-types/navigation/menu/context.d.ts.map +1 -0
  524. package/build-types/navigation/menu/index.d.ts +5 -0
  525. package/build-types/navigation/menu/index.d.ts.map +1 -0
  526. package/build-types/navigation/menu/menu-title-search.d.ts +4 -0
  527. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  528. package/build-types/navigation/menu/menu-title.d.ts +4 -0
  529. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  530. package/build-types/navigation/menu/search-no-results-found.d.ts +4 -0
  531. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  532. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  533. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  534. package/build-types/navigation/stories/index.d.ts +18 -0
  535. package/build-types/navigation/stories/index.d.ts.map +1 -0
  536. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  537. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  538. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  539. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  540. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  541. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  542. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  543. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  544. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  545. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  546. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  547. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  548. package/build-types/navigation/styles/navigation-styles.d.ts +58 -0
  549. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  550. package/build-types/navigation/test/index.d.ts +2 -0
  551. package/build-types/navigation/test/index.d.ts.map +1 -0
  552. package/build-types/navigation/types.d.ts +267 -0
  553. package/build-types/navigation/types.d.ts.map +1 -0
  554. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  555. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  556. package/build-types/navigation/use-navigation-tree-nodes.d.ts +11 -0
  557. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  558. package/build-types/navigation/utils.d.ts +3 -0
  559. package/build-types/navigation/utils.d.ts.map +1 -0
  560. package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
  561. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
  562. package/build-types/navigator/navigator-button/component.d.ts +1 -1
  563. package/build-types/navigator/navigator-button/hook.d.ts +1 -1
  564. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  565. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  566. package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
  567. package/build-types/navigator/types.d.ts +12 -12
  568. package/build-types/navigator/types.d.ts.map +1 -1
  569. package/build-types/notice/types.d.ts +7 -7
  570. package/build-types/notice/types.d.ts.map +1 -1
  571. package/build-types/number-control/index.d.ts.map +1 -1
  572. package/build-types/number-control/types.d.ts +1 -1
  573. package/build-types/number-control/types.d.ts.map +1 -1
  574. package/build-types/palette-edit/index.d.ts +37 -0
  575. package/build-types/palette-edit/index.d.ts.map +1 -0
  576. package/build-types/palette-edit/stories/index.d.ts +13 -0
  577. package/build-types/palette-edit/stories/index.d.ts.map +1 -0
  578. package/build-types/palette-edit/styles.d.ts +51 -0
  579. package/build-types/palette-edit/styles.d.ts.map +1 -0
  580. package/build-types/palette-edit/test/index.d.ts +2 -0
  581. package/build-types/palette-edit/test/index.d.ts.map +1 -0
  582. package/build-types/palette-edit/types.d.ts +114 -0
  583. package/build-types/palette-edit/types.d.ts.map +1 -0
  584. package/build-types/panel/body.d.ts +9 -0
  585. package/build-types/panel/body.d.ts.map +1 -0
  586. package/build-types/panel/stories/index.d.ts +19 -0
  587. package/build-types/panel/stories/index.d.ts.map +1 -0
  588. package/build-types/panel/test/body.d.ts +2 -0
  589. package/build-types/panel/test/body.d.ts.map +1 -0
  590. package/build-types/panel/types.d.ts +73 -3
  591. package/build-types/panel/types.d.ts.map +1 -1
  592. package/build-types/placeholder/index.d.ts +1 -1
  593. package/build-types/placeholder/index.d.ts.map +1 -1
  594. package/build-types/placeholder/types.d.ts +2 -2
  595. package/build-types/placeholder/types.d.ts.map +1 -1
  596. package/build-types/popover/limit-shift.d.ts +2 -2
  597. package/build-types/popover/limit-shift.d.ts.map +1 -1
  598. package/build-types/popover/types.d.ts +10 -10
  599. package/build-types/popover/types.d.ts.map +1 -1
  600. package/build-types/popover/utils.d.ts +2 -2
  601. package/build-types/popover/utils.d.ts.map +1 -1
  602. package/build-types/query-controls/author-select.d.ts.map +1 -1
  603. package/build-types/query-controls/category-select.d.ts.map +1 -1
  604. package/build-types/query-controls/terms.d.ts.map +1 -1
  605. package/build-types/query-controls/types.d.ts +12 -12
  606. package/build-types/query-controls/types.d.ts.map +1 -1
  607. package/build-types/radio-control/types.d.ts +1 -1
  608. package/build-types/radio-control/types.d.ts.map +1 -1
  609. package/build-types/radio-group/index.d.ts +1 -1
  610. package/build-types/radio-group/radio/index.d.ts +1 -1
  611. package/build-types/range-control/index.d.ts +2 -2
  612. package/build-types/range-control/index.d.ts.map +1 -1
  613. package/build-types/range-control/types.d.ts +17 -17
  614. package/build-types/range-control/types.d.ts.map +1 -1
  615. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  616. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  617. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  618. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  619. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  620. package/build-types/resizable-box/resize-tooltip/utils.d.ts +2 -2
  621. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  622. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  623. package/build-types/responsive-wrapper/stories/index.d.ts +10 -0
  624. package/build-types/responsive-wrapper/stories/index.d.ts.map +1 -1
  625. package/build-types/responsive-wrapper/types.d.ts +3 -3
  626. package/build-types/responsive-wrapper/types.d.ts.map +1 -1
  627. package/build-types/sandbox/types.d.ts +1 -1
  628. package/build-types/sandbox/types.d.ts.map +1 -1
  629. package/build-types/scrollable/types.d.ts +2 -2
  630. package/build-types/scrollable/types.d.ts.map +1 -1
  631. package/build-types/search-control/types.d.ts +1 -1
  632. package/build-types/search-control/types.d.ts.map +1 -1
  633. package/build-types/select-control/index.d.ts +2 -1
  634. package/build-types/select-control/index.d.ts.map +1 -1
  635. package/build-types/select-control/stories/index.d.ts +3 -3
  636. package/build-types/select-control/stories/index.d.ts.map +1 -1
  637. package/build-types/select-control/types.d.ts +44 -20
  638. package/build-types/select-control/types.d.ts.map +1 -1
  639. package/build-types/shortcut/types.d.ts +1 -1
  640. package/build-types/shortcut/types.d.ts.map +1 -1
  641. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  642. package/build-types/slot-fill/provider.d.ts +1 -0
  643. package/build-types/slot-fill/provider.d.ts.map +1 -1
  644. package/build-types/snackbar/types.d.ts +3 -3
  645. package/build-types/snackbar/types.d.ts.map +1 -1
  646. package/build-types/spacer/types.d.ts +1 -1
  647. package/build-types/spacer/types.d.ts.map +1 -1
  648. package/build-types/spinner/index.d.ts +1 -1
  649. package/build-types/style-provider/types.d.ts +1 -1
  650. package/build-types/style-provider/types.d.ts.map +1 -1
  651. package/build-types/surface/types.d.ts +2 -2
  652. package/build-types/surface/types.d.ts.map +1 -1
  653. package/build-types/tab-panel/types.d.ts +5 -5
  654. package/build-types/tab-panel/types.d.ts.map +1 -1
  655. package/build-types/text/types.d.ts +3 -3
  656. package/build-types/text/types.d.ts.map +1 -1
  657. package/build-types/text-control/types.d.ts +1 -1
  658. package/build-types/text-control/types.d.ts.map +1 -1
  659. package/build-types/text-highlight/types.d.ts +1 -1
  660. package/build-types/text-highlight/types.d.ts.map +1 -1
  661. package/build-types/textarea-control/types.d.ts +1 -1
  662. package/build-types/textarea-control/types.d.ts.map +1 -1
  663. package/build-types/theme/types.d.ts +3 -3
  664. package/build-types/theme/types.d.ts.map +1 -1
  665. package/build-types/tip/types.d.ts +1 -1
  666. package/build-types/tip/types.d.ts.map +1 -1
  667. package/build-types/toggle-control/types.d.ts +1 -1
  668. package/build-types/toggle-control/types.d.ts.map +1 -1
  669. package/build-types/toggle-group-control/types.d.ts +10 -10
  670. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  671. package/build-types/toolbar/toolbar/types.d.ts +1 -1
  672. package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
  673. package/build-types/toolbar/toolbar-button/index.d.ts +165 -11
  674. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  675. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +6 -1
  676. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
  677. package/build-types/toolbar/toolbar-button/types.d.ts +45 -0
  678. package/build-types/toolbar/toolbar-button/types.d.ts.map +1 -0
  679. package/build-types/toolbar/toolbar-context/index.d.ts +6 -1
  680. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  681. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +1 -1
  682. package/build-types/toolbar/toolbar-item/index.d.ts +1 -1
  683. package/build-types/tools-panel/types.d.ts +11 -11
  684. package/build-types/tools-panel/types.d.ts.map +1 -1
  685. package/build-types/tooltip/index.d.ts.map +1 -1
  686. package/build-types/tree-grid/types.d.ts +5 -5
  687. package/build-types/tree-grid/types.d.ts.map +1 -1
  688. package/build-types/tree-select/index.d.ts.map +1 -1
  689. package/build-types/tree-select/types.d.ts +4 -10
  690. package/build-types/tree-select/types.d.ts.map +1 -1
  691. package/build-types/truncate/types.d.ts +2 -2
  692. package/build-types/truncate/types.d.ts.map +1 -1
  693. package/build-types/ui/context/context-connect.d.ts +1 -1
  694. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  695. package/build-types/ui/context/wordpress-component.d.ts +3 -3
  696. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  697. package/build-types/ui/control-group/types.d.ts +2 -2
  698. package/build-types/ui/control-group/types.d.ts.map +1 -1
  699. package/build-types/ui/control-label/types.d.ts +1 -1
  700. package/build-types/ui/control-label/types.d.ts.map +1 -1
  701. package/build-types/ui/form-group/form-group-content.d.ts +1 -1
  702. package/build-types/ui/form-group/form-group-help.d.ts +1 -1
  703. package/build-types/ui/form-group/form-group-label.d.ts +1 -1
  704. package/build-types/ui/form-group/types.d.ts +5 -5
  705. package/build-types/ui/form-group/types.d.ts.map +1 -1
  706. package/build-types/ui/form-group/use-form-group.d.ts +3 -3
  707. package/build-types/ui/spinner/component.d.ts +1 -1
  708. package/build-types/ui/tooltip/content.d.ts +1 -1
  709. package/build-types/ui/tooltip/types.d.ts +2 -2
  710. package/build-types/ui/tooltip/types.d.ts.map +1 -1
  711. package/build-types/ui/utils/font-size.d.ts +1 -1
  712. package/build-types/ui/utils/font-size.d.ts.map +1 -1
  713. package/build-types/ui/utils/space.d.ts +1 -1
  714. package/build-types/ui/utils/space.d.ts.map +1 -1
  715. package/build-types/ui/utils/types.d.ts +4 -4
  716. package/build-types/ui/utils/types.d.ts.map +1 -1
  717. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  718. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  719. package/build-types/unit-control/types.d.ts +5 -5
  720. package/build-types/unit-control/types.d.ts.map +1 -1
  721. package/build-types/utils/breakpoint-values.d.ts +1 -1
  722. package/build-types/utils/colors-values.d.ts +1 -1
  723. package/build-types/utils/config-values.d.ts +9 -9
  724. package/build-types/utils/events.d.ts +1 -1
  725. package/build-types/utils/events.d.ts.map +1 -1
  726. package/build-types/utils/font-values.d.ts +1 -1
  727. package/build-types/utils/font.d.ts.map +1 -1
  728. package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
  729. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  730. package/build-types/utils/types.d.ts +4 -4
  731. package/build-types/utils/types.d.ts.map +1 -1
  732. package/build-types/v-stack/component.d.ts +1 -4
  733. package/build-types/v-stack/component.d.ts.map +1 -1
  734. package/build-types/v-stack/hook.d.ts.map +1 -1
  735. package/build-types/v-stack/stories/index.d.ts +1 -4
  736. package/build-types/v-stack/stories/index.d.ts.map +1 -1
  737. package/build-types/v-stack/types.d.ts +5 -3
  738. package/build-types/v-stack/types.d.ts.map +1 -1
  739. package/build-types/view/types.d.ts +1 -1
  740. package/build-types/view/types.d.ts.map +1 -1
  741. package/build-types/visually-hidden/types.d.ts +1 -1
  742. package/build-types/visually-hidden/types.d.ts.map +1 -1
  743. package/build-types/z-stack/types.d.ts +1 -1
  744. package/build-types/z-stack/types.d.ts.map +1 -1
  745. package/package.json +20 -20
  746. package/src/animate/index.js +3 -1
  747. package/src/autocomplete/README.md +51 -0
  748. package/src/autocomplete/{autocompleter-ui.js → autocompleter-ui.tsx} +21 -10
  749. package/src/autocomplete/{get-default-use-items.js → get-default-use-items.tsx} +11 -6
  750. package/src/autocomplete/{index.js → index.tsx} +77 -111
  751. package/src/autocomplete/test/{index.js → index.tsx} +31 -20
  752. package/src/autocomplete/types.ts +220 -0
  753. package/src/border-control/test/index.js +0 -2
  754. package/src/button/style.scss +12 -1
  755. package/src/button/types.ts +2 -2
  756. package/src/circular-option-picker/types.ts +1 -1
  757. package/src/color-palette/test/__snapshots__/index.tsx.snap +16 -14
  758. package/src/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  759. package/src/custom-gradient-picker/gradient-bar/index.js +2 -0
  760. package/src/custom-gradient-picker/gradient-bar/utils.js +2 -0
  761. package/src/custom-gradient-picker/index.js +2 -0
  762. package/src/custom-gradient-picker/serializer.js +2 -0
  763. package/src/custom-gradient-picker/utils.js +2 -0
  764. package/src/dimension-control/README.md +22 -55
  765. package/src/dimension-control/index.tsx +101 -0
  766. package/src/dimension-control/{sizes.js → sizes.ts} +8 -5
  767. package/src/dimension-control/stories/index.tsx +48 -0
  768. package/src/dimension-control/types.ts +48 -0
  769. package/src/flex/flex/hook.ts +2 -2
  770. package/src/font-size-picker/README.md +26 -20
  771. package/src/font-size-picker/index.tsx +2 -1
  772. package/src/font-size-picker/stories/index.tsx +1 -0
  773. package/src/font-size-picker/test/index.tsx +23 -0
  774. package/src/font-size-picker/types.ts +4 -0
  775. package/src/form-token-field/index.tsx +4 -1
  776. package/src/form-token-field/stories/index.tsx +13 -0
  777. package/src/form-token-field/test/index.tsx +80 -0
  778. package/src/gradient-picker/index.js +2 -0
  779. package/src/guide/README.md +17 -15
  780. package/src/guide/{icons.js → icons.tsx} +1 -1
  781. package/src/guide/{index.js → index.tsx} +47 -7
  782. package/src/guide/{page-control.js → page-control.tsx} +2 -1
  783. package/src/guide/{page.js → page.tsx} +8 -1
  784. package/src/guide/stories/{index.js → index.tsx} +11 -5
  785. package/src/guide/test/{index.js → index.tsx} +22 -4
  786. package/src/guide/types.ts +68 -0
  787. package/src/h-stack/README.md +2 -2
  788. package/src/h-stack/types.ts +2 -2
  789. package/src/h-stack/utils.ts +3 -3
  790. package/src/higher-order/navigate-regions/{index.js → index.tsx} +47 -11
  791. package/src/higher-order/with-fallback-styles/{index.js → index.tsx} +22 -5
  792. package/src/higher-order/with-filters/{index.js → index.tsx} +44 -12
  793. package/src/higher-order/with-filters/test/{index.js → index.tsx} +5 -1
  794. package/src/higher-order/with-focus-return/index.tsx +74 -0
  795. package/src/higher-order/with-focus-return/test/{index.js → index.tsx} +2 -2
  796. package/src/higher-order/with-notices/README.md +4 -1
  797. package/src/higher-order/with-notices/index.tsx +116 -0
  798. package/src/higher-order/with-notices/test/{index.js → index.tsx} +11 -6
  799. package/src/higher-order/with-notices/types.ts +35 -0
  800. package/src/higher-order/with-spoken-messages/test/{index.js → index.tsx} +2 -1
  801. package/src/icon/index.tsx +11 -15
  802. package/src/icon/test/{index.js → index.tsx} +6 -2
  803. package/src/index.native.js +1 -0
  804. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +1 -1
  805. package/src/mobile/bottom-sheet/cell.native.js +1 -1
  806. package/src/mobile/bottom-sheet-text-control/README.md +8 -1
  807. package/src/mobile/bottom-sheet-text-control/index.native.js +2 -1
  808. package/src/mobile/link-settings/test/link-settings-navigation.native.js +1 -1
  809. package/src/navigation/README.md +16 -2
  810. package/src/navigation/back-button/{index.js → index.tsx} +22 -6
  811. package/src/navigation/{context.js → context.tsx} +8 -5
  812. package/src/navigation/group/context.tsx +15 -0
  813. package/src/navigation/group/{index.js → index.tsx} +9 -1
  814. package/src/navigation/{index.js → index.tsx} +63 -7
  815. package/src/navigation/item/{base-content.js → base-content.tsx} +5 -2
  816. package/src/navigation/item/{base.js → base.tsx} +3 -1
  817. package/src/navigation/item/{index.js → index.tsx} +8 -2
  818. package/src/navigation/item/{use-navigation-tree-item.js → use-navigation-tree-item.tsx} +9 -2
  819. package/src/navigation/menu/context.tsx +18 -0
  820. package/src/navigation/menu/{index.js → index.tsx} +5 -1
  821. package/src/navigation/menu/{menu-title-search.js → menu-title-search.tsx} +11 -7
  822. package/src/navigation/menu/{menu-title.js → menu-title.tsx} +5 -3
  823. package/src/navigation/menu/{search-no-results-found.js → search-no-results-found.tsx} +5 -1
  824. package/src/navigation/menu/{use-navigation-tree-menu.js → use-navigation-tree-menu.tsx} +3 -1
  825. package/src/navigation/stories/index.tsx +53 -0
  826. package/src/navigation/stories/utils/{controlled-state.js → controlled-state.tsx} +32 -13
  827. package/src/navigation/stories/utils/{default.js → default.tsx} +20 -6
  828. package/src/navigation/stories/utils/{group.js → group.tsx} +21 -7
  829. package/src/navigation/stories/utils/{hide-if-empty.js → hide-if-empty.tsx} +19 -6
  830. package/src/navigation/stories/utils/{more-examples.js → more-examples.tsx} +30 -12
  831. package/src/navigation/stories/utils/{search.js → search.tsx} +21 -7
  832. package/src/navigation/test/{index.js → index.tsx} +17 -4
  833. package/src/navigation/types.ts +325 -0
  834. package/src/navigation/{use-create-navigation-tree.js → use-create-navigation-tree.tsx} +37 -25
  835. package/src/navigation/{use-navigation-tree-nodes.js → use-navigation-tree-nodes.tsx} +10 -6
  836. package/src/navigation/{utils.js → utils.tsx} +2 -2
  837. package/src/navigator/navigator-screen/component.tsx +13 -7
  838. package/src/navigator/test/index.tsx +65 -22
  839. package/src/number-control/index.tsx +0 -2
  840. package/src/palette-edit/{index.js → index.tsx} +115 -48
  841. package/src/palette-edit/stories/index.tsx +82 -0
  842. package/src/palette-edit/test/{index.js → index.tsx} +15 -3
  843. package/src/palette-edit/types.ts +126 -0
  844. package/src/panel/README.md +53 -35
  845. package/src/panel/{body.js → body.tsx} +31 -17
  846. package/src/panel/stories/{index.js → index.tsx} +16 -6
  847. package/src/panel/test/{body.js → body.tsx} +12 -17
  848. package/src/panel/types.ts +78 -0
  849. package/src/placeholder/index.tsx +2 -6
  850. package/src/placeholder/test/index.tsx +1 -1
  851. package/src/placeholder/types.ts +2 -2
  852. package/src/popover/test/index.tsx +5 -2
  853. package/src/query-controls/author-select.tsx +1 -6
  854. package/src/query-controls/category-select.tsx +1 -6
  855. package/src/query-controls/terms.ts +29 -18
  856. package/src/range-control/index.tsx +2 -6
  857. package/src/range-control/types.ts +3 -3
  858. package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.ts +2 -1
  859. package/src/responsive-wrapper/README.md +8 -2
  860. package/src/responsive-wrapper/index.tsx +18 -17
  861. package/src/responsive-wrapper/stories/index.tsx +41 -0
  862. package/src/responsive-wrapper/style.scss +5 -11
  863. package/src/responsive-wrapper/types.ts +2 -2
  864. package/src/select-control/index.tsx +16 -16
  865. package/src/select-control/stories/index.tsx +24 -12
  866. package/src/select-control/types.ts +68 -40
  867. package/src/tab-panel/types.ts +4 -4
  868. package/src/toolbar/toolbar-button/README.md +13 -1
  869. package/src/toolbar/toolbar-button/{index.js → index.tsx} +55 -20
  870. package/src/toolbar/toolbar-button/toolbar-button-container.tsx +13 -0
  871. package/src/toolbar/toolbar-button/types.ts +46 -0
  872. package/src/toolbar/toolbar-context/index.ts +15 -0
  873. package/src/tooltip/index.js +11 -1
  874. package/src/tree-select/index.tsx +5 -2
  875. package/src/tree-select/types.ts +6 -13
  876. package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
  877. package/src/utils/font.js +1 -6
  878. package/src/v-stack/README.md +2 -2
  879. package/src/v-stack/hook.ts +6 -4
  880. package/src/v-stack/stories/index.tsx +28 -7
  881. package/src/v-stack/test/__snapshots__/index.tsx.snap +20 -18
  882. package/src/v-stack/types.ts +5 -3
  883. package/tsconfig.json +1 -14
  884. package/tsconfig.tsbuildinfo +1 -1
  885. package/src/dimension-control/index.js +0 -73
  886. package/src/higher-order/with-focus-return/index.js +0 -64
  887. package/src/higher-order/with-notices/index.js +0 -104
  888. package/src/navigation/group/context.js +0 -9
  889. package/src/navigation/menu/context.js +0 -11
  890. package/src/navigation/stories/index.js +0 -33
  891. package/src/toolbar/toolbar-button/toolbar-button-container.js +0 -6
  892. package/src/toolbar/toolbar-context/index.js +0 -10
  893. /package/src/animation/{index.js → index.tsx} +0 -0
  894. /package/src/higher-order/with-filters/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  895. /package/src/higher-order/with-spoken-messages/{index.js → index.tsx} +0 -0
  896. /package/src/navigation/{constants.js → constants.tsx} +0 -0
  897. /package/src/navigation/styles/{navigation-styles.js → navigation-styles.tsx} +0 -0
  898. /package/src/panel/test/__snapshots__/{body.js.snap → body.tsx.snap} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/h-stack/utils.ts"],"names":["isValueDefined","H_ALIGNMENTS","bottom","align","justify","bottomLeft","bottomRight","center","edge","left","right","stretch","top","topLeft","topRight","V_ALIGNMENTS","getAlignmentProps","alignment","direction","isVertical","props","alignmentProps"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;AAGA,SAASA,cAAT,QAA+B,iBAA/B;AAEA,MAAMC,YAAwB,GAAG;AAChCC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,KAAK,EAAE,UAAT;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GADwB;AAEhCC,EAAAA,UAAU,EAAE;AAAEF,IAAAA,KAAK,EAAE,YAAT;AAAuBC,IAAAA,OAAO,EAAE;AAAhC,GAFoB;AAGhCE,EAAAA,WAAW,EAAE;AAAEH,IAAAA,KAAK,EAAE,UAAT;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GAHmB;AAIhCG,EAAAA,MAAM,EAAE;AAAEJ,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GAJwB;AAKhCI,EAAAA,IAAI,EAAE;AAAEL,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GAL0B;AAMhCK,EAAAA,IAAI,EAAE;AAAEN,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GAN0B;AAOhCM,EAAAA,KAAK,EAAE;AAAEP,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OA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AAE;AAAER,IAAAA,OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC,GAT2B;AAUhCU,EAAAA,OAAO,EAAE;AAAET,IAAAA,OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC,GAVuB;AAWhCW,EAAAA,QAAQ,EAAE;AAAEV,IAAAA,OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC;AAXsB,CAAjC;AAcA,OAAO,SAASa,iBAAT,CACNC,SADM,EAGW;AAAA,MADjBC,SACiB,uEADU,KACV;;AACjB,MAAK,CAAElB,cAAc,CAAEiB,SAAF,CAArB,EAAqC;AACpC,WAAO,EAAP;AACA;;AACD,QAAME,UAAU,GAAGD,SAAS,KAAK,QAAjC;AACA,QAAME,KAAK,GAAGD,UAAU,GAAGJ,YAAH,GAAkBd,YAA1C;AAEA,QAAMoB,cAAc,GACnBJ,SAAS,IAAIG,KAAb,GACGA,KAAK,CAAEH,SAAF,CADR,GAEG;AAAEd,IAAAA,KAAK,EAAEc;AAAT,GAHJ;AAKA,SAAOI,cAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n/**\n * Internal dependencies\n */\nimport type { FlexDirection } from '../flex/types';\nimport type { HStackAlignment, AlignmentProps, Alignments } from './types';\nimport { isValueDefined } from '../utils/values';\n\nconst H_ALIGNMENTS: Alignments = {\n\tbottom: { align: 'flex-end', justify: 'center' },\n\tbottomLeft: { align: 'flex-start', justify: 'flex-end' },\n\tbottomRight: { align: 'flex-end', justify: 'flex-end' },\n\tcenter: { align: 'center', justify: 'center' },\n\tedge: { align: 'center', justify: 'space-between' },\n\tleft: { align: 'center', justify: 'flex-start' },\n\tright: { align: 'center', justify: 'flex-end' },\n\tstretch: { align: 'stretch' },\n\ttop: { align: 'flex-start', justify: 'center' },\n\ttopLeft: { align: 'flex-start', justify: 'flex-start' },\n\ttopRight: { align: 'flex-start', justify: 'flex-end' },\n};\n\nconst V_ALIGNMENTS: Alignments = {\n\tbottom: { justify: 'flex-end', align: 'center' },\n\tbottomLeft: { justify: 'flex-start', align: 'flex-end' },\n\tbottomRight: { justify: 'flex-end', align: 'flex-end' },\n\tcenter: { justify: 'center', align: 'center' },\n\tedge: { justify: 'space-between', align: 'center' },\n\tleft: { justify: 'center', align: 'flex-start' },\n\tright: { justify: 'center', align: 'flex-end' },\n\tstretch: { justify: 'stretch' },\n\ttop: { justify: 'flex-start', align: 'center' },\n\ttopLeft: { justify: 'flex-start', align: 'flex-start' },\n\ttopRight: { justify: 'flex-start', align: 'flex-end' },\n};\n\nexport function getAlignmentProps(\n\talignment: HStackAlignment | CSSProperties[ 'alignItems' ],\n\tdirection: FlexDirection = 'row'\n): AlignmentProps {\n\tif ( ! isValueDefined( alignment ) ) {\n\t\treturn {};\n\t}\n\tconst isVertical = direction === 'column';\n\tconst props = isVertical ? V_ALIGNMENTS : H_ALIGNMENTS;\n\n\tconst alignmentProps =\n\t\talignment in props\n\t\t\t? props[ alignment as keyof typeof props ]\n\t\t\t: { align: alignment };\n\n\treturn alignmentProps;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/h-stack/utils.ts"],"names":["isValueDefined","H_ALIGNMENTS","bottom","align","justify","bottomLeft","bottomRight","center","edge","left","right","stretch","top","topLeft","topRight","V_ALIGNMENTS","getAlignmentProps","alignment","direction","isVertical","props","alignmentProps"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;AAGA,SAASA,cAAT,QAA+B,iBAA/B;AAEA,MAAMC,YAAwB,GAAG;AAChCC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,KAAK,EAAE,UAAT;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GADwB;AAEhCC,EAAAA,UAAU,EAAE;AAAEF,IAAAA,KAAK,EAAE,UAAT;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GAFoB;AAGhCE,EAAAA,WAAW,EAAE;AAAEH,IAAAA,KAAK,EAAE,UAA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AAAA,KAAK,EAAE;AAA5B,GAJwB;AAKhCK,EAAAA,IAAI,EAAE;AAAEJ,IAAAA,OAAO,EAAE,eAAX;AAA4BD,IAAAA,KAAK,EAAE;AAAnC,GAL0B;AAMhCM,EAAAA,IAAI,EAAE;AAAEL,IAAAA,OAAO,EAAE,QAAX;AAAqBD,IAAAA,KAAK,EAAE;AAA5B,GAN0B;AAOhCO,EAAAA,KAAK,EAAE;AAAEN,IAAAA,OAAO,EAAE,QAAX;AAAqBD,IAAAA,KAAK,EAAE;AAA5B,GAPyB;AAQhCQ,EAAAA,OAAO,EAAE;AAAER,IAAAA,KAAK,EAAE;AAAT,GARuB;AAShCS,EAAAA,GAAG,EAAE;AAAER,IAAAA,OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC,GAT2B;AAUhCU,EAAAA,OAAO,EAAE;AAAET,IAAAA,OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC,GAVuB;AAWhCW,EAAAA,QAAQ,EAAE;AAAEV,IAAAA,OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC;AAXsB,CAAjC;AAcA,OAAO,SAASa,iBAAT,CACNC,SADM,EAGW;AAAA,MADjBC,SACiB,uEADU,KACV;;AACjB,MAAK,CAAElB,cAAc,CAAEiB,SAAF,CAArB,EAAqC;AACpC,WAAO,EAAP;AACA;;AACD,QAAME,UAAU,GAAGD,SAAS,KAAK,QAAjC;AACA,QAAME,KAAK,GAAGD,UAAU,GAAGJ,YAAH,GAAkBd,YAA1C;AAEA,QAAMoB,cAAc,GACnBJ,SAAS,IAAIG,KAAb,GACGA,KAAK,CAAEH,SAAF,CADR,GAEG;AAAEd,IAAAA,KAAK,EAAEc;AAAT,GAHJ;AAKA,SAAOI,cAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n/**\n * Internal dependencies\n */\nimport type { FlexDirection } from '../flex/types';\nimport type { HStackAlignment, AlignmentProps, Alignments } from './types';\nimport { isValueDefined } from '../utils/values';\n\nconst H_ALIGNMENTS: Alignments = {\n\tbottom: { align: 'flex-end', justify: 'center' },\n\tbottomLeft: { align: 'flex-end', justify: 'flex-start' },\n\tbottomRight: { align: 'flex-end', justify: 'flex-end' },\n\tcenter: { align: 'center', justify: 'center' },\n\tedge: { align: 'center', justify: 'space-between' },\n\tleft: { align: 'center', justify: 'flex-start' },\n\tright: { align: 'center', justify: 'flex-end' },\n\tstretch: { align: 'stretch' },\n\ttop: { align: 'flex-start', justify: 'center' },\n\ttopLeft: { align: 'flex-start', justify: 'flex-start' },\n\ttopRight: { align: 'flex-start', justify: 'flex-end' },\n};\n\nconst V_ALIGNMENTS: Alignments = {\n\tbottom: { justify: 'flex-end', align: 'center' },\n\tbottomLeft: { justify: 'flex-end', align: 'flex-start' },\n\tbottomRight: { justify: 'flex-end', align: 'flex-end' },\n\tcenter: { justify: 'center', align: 'center' },\n\tedge: { justify: 'space-between', align: 'center' },\n\tleft: { justify: 'center', align: 'flex-start' },\n\tright: { justify: 'center', align: 'flex-end' },\n\tstretch: { align: 'stretch' },\n\ttop: { justify: 'flex-start', align: 'center' },\n\ttopLeft: { justify: 'flex-start', align: 'flex-start' },\n\ttopRight: { justify: 'flex-start', align: 'flex-end' },\n};\n\nexport function getAlignmentProps(\n\talignment: HStackAlignment | CSSProperties[ 'alignItems' ],\n\tdirection: FlexDirection = 'row'\n): AlignmentProps {\n\tif ( ! isValueDefined( alignment ) ) {\n\t\treturn {};\n\t}\n\tconst isVertical = direction === 'column';\n\tconst props = isVertical ? V_ALIGNMENTS : H_ALIGNMENTS;\n\n\tconst alignmentProps =\n\t\talignment in props\n\t\t\t? props[ alignment as keyof typeof props ]\n\t\t\t: { align: alignment };\n\n\treturn alignmentProps;\n}\n"]}
@@ -27,11 +27,13 @@ const defaultShortcuts = {
27
27
  };
28
28
  export function useNavigateRegions() {
29
29
  let shortcuts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultShortcuts;
30
- const ref = useRef();
30
+ const ref = useRef(null);
31
31
  const [isFocusingRegions, setIsFocusingRegions] = useState(false);
32
32
 
33
33
  function focusRegion(offset) {
34
- const regions = Array.from(ref.current.querySelectorAll('[role="region"][tabindex="-1"]'));
34
+ var _ref$current$querySel, _ref$current, _ref$current2, _ref$current2$ownerDo, _ref$current2$ownerDo2;
35
+
36
+ const regions = Array.from((_ref$current$querySel = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelectorAll('[role="region"][tabindex="-1"]')) !== null && _ref$current$querySel !== void 0 ? _ref$current$querySel : []);
35
37
 
36
38
  if (!regions.length) {
37
39
  return;
@@ -39,7 +41,8 @@ export function useNavigateRegions() {
39
41
 
40
42
  let nextRegion = regions[0]; // Based off the current element, use closest to determine the wrapping region since this operates up the DOM. Also, match tabindex to avoid edge cases with regions we do not want.
41
43
 
42
- const selectedIndex = regions.indexOf(ref.current.ownerDocument.activeElement.closest('[role="region"][tabindex="-1"]'));
44
+ const wrappingRegion = (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$ownerDo = _ref$current2.ownerDocument) === null || _ref$current2$ownerDo === void 0 ? void 0 : (_ref$current2$ownerDo2 = _ref$current2$ownerDo.activeElement) === null || _ref$current2$ownerDo2 === void 0 ? void 0 : _ref$current2$ownerDo2.closest('[role="region"][tabindex="-1"]');
45
+ const selectedIndex = wrappingRegion ? regions.indexOf(wrappingRegion) : -1;
43
46
 
44
47
  if (selectedIndex !== -1) {
45
48
  let nextIndex = selectedIndex + offset;
@@ -88,6 +91,33 @@ export function useNavigateRegions() {
88
91
 
89
92
  };
90
93
  }
94
+ /**
95
+ * `navigateRegions` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html)
96
+ * adding keyboard navigation to switch between the different DOM elements marked as "regions" (role="region").
97
+ * These regions should be focusable (By adding a tabIndex attribute for example). For better accessibility,
98
+ * these elements must be properly labelled to briefly describe the purpose of the content in the region.
99
+ * For more details, see "Landmark Roles" in the [WAI-ARIA specification](https://www.w3.org/TR/wai-aria/)
100
+ * and "Landmark Regions" in the [ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/).
101
+ *
102
+ * ```jsx
103
+ * import { navigateRegions } from '@wordpress/components';
104
+ *
105
+ * const MyComponentWithNavigateRegions = navigateRegions( () => (
106
+ * <div>
107
+ * <div role="region" tabIndex="-1" aria-label="Header">
108
+ * Header
109
+ * </div>
110
+ * <div role="region" tabIndex="-1" aria-label="Content">
111
+ * Content
112
+ * </div>
113
+ * <div role="region" tabIndex="-1" aria-label="Sidebar">
114
+ * Sidebar
115
+ * </div>
116
+ * </div>
117
+ * ) );
118
+ * ```
119
+ */
120
+
91
121
  export default createHigherOrderComponent(Component => _ref3 => {
92
122
  let {
93
123
  shortcuts,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/higher-order/navigate-regions/index.js"],"names":["useState","useRef","createHigherOrderComponent","useRefEffect","useMergeRefs","isKeyboardEvent","defaultShortcuts","previous","modifier","character","next","useNavigateRegions","shortcuts","ref","isFocusingRegions","setIsFocusingRegions","focusRegion","offset","regions","Array","from","current","querySelectorAll","length","nextRegion","selectedIndex","indexOf","ownerDocument","activeElement","closest","nextIndex","focus","clickRef","element","onClick","addEventListener","removeEventListener","className","onKeyDown","event","some","Component","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,oBAAjC;AACA,SACCC,0BADD,EAECC,YAFD,EAGCC,YAHD,QAIO,oBAJP;AAKA,SAASC,eAAT,QAAgC,qBAAhC;AAEA,MAAMC,gBAAgB,GAAG;AACxBC,EAAAA,QAAQ,EAAE,CACT;AACCC,IAAAA,QAAQ,EAAE,WADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GADS,EAKT;AACCD,IAAAA,QAAQ,EAAE,WADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GALS,EAST;AACCD,IAAA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A,SAAF;AAAa,OAAG8B;AAAhB,GAAF;AAAA,SAEE,qBAAU/B,kBAAkB,CAAEC,SAAF,CAA5B,EACC,cAAC,SAAD,EAAgB8B,KAAhB,CADD,CAFF;AAAA,CAFuC,EAQxC,iBARwC,CAAzC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tcreateHigherOrderComponent,\n\tuseRefEffect,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\nconst defaultShortcuts = {\n\tprevious: [\n\t\t{\n\t\t\tmodifier: 'ctrlShift',\n\t\t\tcharacter: '`',\n\t\t},\n\t\t{\n\t\t\tmodifier: 'ctrlShift',\n\t\t\tcharacter: '~',\n\t\t},\n\t\t{\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'p',\n\t\t},\n\t],\n\tnext: [\n\t\t{\n\t\t\tmodifier: 'ctrl',\n\t\t\tcharacter: '`',\n\t\t},\n\t\t{\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'n',\n\t\t},\n\t],\n};\n\nexport function useNavigateRegions( shortcuts = defaultShortcuts ) {\n\tconst ref = useRef();\n\tconst [ isFocusingRegions, setIsFocusingRegions ] = useState( false );\n\n\tfunction focusRegion( offset ) {\n\t\tconst regions = Array.from(\n\t\t\tref.current.querySelectorAll( '[role=\"region\"][tabindex=\"-1\"]' )\n\t\t);\n\t\tif ( ! regions.length ) {\n\t\t\treturn;\n\t\t}\n\t\tlet nextRegion = regions[ 0 ];\n\t\t// Based off the current element, use closest to determine the wrapping region since this operates up the DOM. Also, match tabindex to avoid edge cases with regions we do not want.\n\t\tconst selectedIndex = regions.indexOf(\n\t\t\tref.current.ownerDocument.activeElement.closest(\n\t\t\t\t'[role=\"region\"][tabindex=\"-1\"]'\n\t\t\t)\n\t\t);\n\t\tif ( selectedIndex !== -1 ) {\n\t\t\tlet nextIndex = selectedIndex + offset;\n\t\t\tnextIndex = nextIndex === -1 ? regions.length - 1 : nextIndex;\n\t\t\tnextIndex = nextIndex === regions.length ? 0 : nextIndex;\n\t\t\tnextRegion = regions[ nextIndex ];\n\t\t}\n\n\t\tnextRegion.focus();\n\t\tsetIsFocusingRegions( true );\n\t}\n\n\tconst clickRef = useRefEffect(\n\t\t( element ) => {\n\t\t\tfunction onClick() {\n\t\t\t\tsetIsFocusingRegions( false );\n\t\t\t}\n\n\t\t\telement.addEventListener( 'click', onClick );\n\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'click', onClick );\n\t\t\t};\n\t\t},\n\t\t[ setIsFocusingRegions ]\n\t);\n\n\treturn {\n\t\tref: useMergeRefs( [ ref, clickRef ] ),\n\t\tclassName: isFocusingRegions ? 'is-focusing-regions' : '',\n\t\tonKeyDown( event ) {\n\t\t\tif (\n\t\t\t\tshortcuts.previous.some( ( { modifier, character } ) => {\n\t\t\t\t\treturn isKeyboardEvent[ modifier ]( event, character );\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\tfocusRegion( -1 );\n\t\t\t} else if (\n\t\t\t\tshortcuts.next.some( ( { modifier, character } ) => {\n\t\t\t\t\treturn isKeyboardEvent[ modifier ]( event, character );\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\tfocusRegion( 1 );\n\t\t\t}\n\t\t},\n\t};\n}\n\nexport default createHigherOrderComponent(\n\t( Component ) =>\n\t\t( { shortcuts, ...props } ) =>\n\t\t\t(\n\t\t\t\t<div { ...useNavigateRegions( shortcuts ) }>\n\t\t\t\t\t<Component { ...props } />\n\t\t\t\t</div>\n\t\t\t),\n\t'navigateRegions'\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/higher-order/navigate-regions/index.tsx"],"names":["useState","useRef","createHigherOrderComponent","useRefEffect","useMergeRefs","isKeyboardEvent","defaultShortcuts","previous","modifier","character","next","useNavigateRegions","shortcuts","ref","isFocusingRegions","setIsFocusingRegions","focusRegion","offset","regions","Array","from","current","querySelectorAll","length","nextRegion","wrappingRegion","ownerDocument","activeElement","closest","selectedIndex","indexOf","nextIndex","focus","clickRef","element","onClick","addEventListener","removeEventListener","className","onKeyDown","event","some","Component","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,oBAAjC;AACA,SACCC,0BADD,EAECC,YAFD,EAGCC,YAHD,QAIO,oBAJP;AAKA,SAASC,eAAT,QAAgC,qBAAhC;AAGA,MAAMC,gBAAgB,GAAG;AACxBC,EAAAA,QAAQ,EAAE,CACT;AACCC,IAAAA,QAAQ,EAAE,WADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GADS,EAKT;AACCD,IAAAA,QAAQ,EAAE,WADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GALS,EAST;AACCD,IAAAA,QAAQ,EAAE,QADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GATS,CADc;AAexBC,EAAAA,IAAI,EAAE,CACL;AACCF,IAAAA,QAAQ,EAAE,MADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GADK,EAKL;AACCD,IAAAA,QAAQ,EAAE,QADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GALK;AAfkB,CAAzB;AAgCA,OAAO,SAASE,kBAAT,GAAuE;AAAA,MAA1CC,SAA0C,uEAAnBN,gBAAmB;AAC7E,QAAMO,GAAG,GAAGZ,MAAM,CAAoB,IAApB,CAAlB;AACA,QAAM,CAAEa,iBAAF,EAAqBC,oBAArB,IAA8Cf,QAAQ,CAAE,KAAF,CAA5D;;AAEA,WAASgB,WAAT,CAAsBC,MAAtB,EAAuC;AAAA;;AACtC,UAAMC,OAAO,GAAGC,KAAK,CAACC,IAAN,0CACfP,GAAG,CAACQ,OADW,iDACf,aAAaC,gBAAb,CACC,gCADD,CADe,yEAGV,EAHU,CAAhB;;AAKA,QAAK,CAAEJ,OAAO,CAACK,MAAf,EAAwB;AACvB;AACA;;AACD,QAAIC,UAAU,GAAGN,OAAO,CAAE,CAAF,CAAxB,CATsC,CAU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,IAAnB,CAAyB,QAA+B;AAAA,YAA7B;AAAEjC,UAAAA,QAAF;AAAYC,UAAAA;AAAZ,SAA6B;AACvD,eAAOJ,eAAe,CAAEG,QAAF,CAAf,CAA6BgC,KAA7B,EAAoC/B,SAApC,CAAP;AACA,OAFD,CADD,EAIE;AACDO,QAAAA,WAAW,CAAE,CAAC,CAAH,CAAX;AACA,OAND,MAMO,IACNJ,SAAS,CAACF,IAAV,CAAe+B,IAAf,CAAqB,SAA+B;AAAA,YAA7B;AAAEjC,UAAAA,QAAF;AAAYC,UAAAA;AAAZ,SAA6B;AACnD,eAAOJ,eAAe,CAAEG,QAAF,CAAf,CAA6BgC,KAA7B,EAAoC/B,SAApC,CAAP;AACA,OAFD,CADM,EAIL;AACDO,QAAAA,WAAW,CAAE,CAAF,CAAX;AACA;AACD;;AAjBK,GAAP;AAmBA;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,eAAed,0BAA0B,CACtCwC,SAAF,IACC;AAAA,MAAE;AAAE9B,IAAAA,SAAF;AAAa,OAAG+B;AAAhB,GAAF;AAAA,SAEE,qBAAUhC,kBAAkB,CAAEC,SAAF,CAA5B,EACC,cAAC,SAAD,EAAgB+B,KAAhB,CADD,CAFF;AAAA,CAFuC,EAQxC,iBARwC,CAAzC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tcreateHigherOrderComponent,\n\tuseRefEffect,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\nimport type { WPKeycodeModifier } from '@wordpress/keycodes';\n\nconst defaultShortcuts = {\n\tprevious: [\n\t\t{\n\t\t\tmodifier: 'ctrlShift',\n\t\t\tcharacter: '`',\n\t\t},\n\t\t{\n\t\t\tmodifier: 'ctrlShift',\n\t\t\tcharacter: '~',\n\t\t},\n\t\t{\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'p',\n\t\t},\n\t] as const,\n\tnext: [\n\t\t{\n\t\t\tmodifier: 'ctrl',\n\t\t\tcharacter: '`',\n\t\t},\n\t\t{\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'n',\n\t\t},\n\t] as const,\n};\n\ntype Shortcuts = {\n\tprevious: readonly { modifier: WPKeycodeModifier; character: string }[];\n\tnext: readonly { modifier: WPKeycodeModifier; character: string }[];\n};\n\nexport function useNavigateRegions( shortcuts: Shortcuts = defaultShortcuts ) {\n\tconst ref = useRef< HTMLDivElement >( null );\n\tconst [ isFocusingRegions, setIsFocusingRegions ] = useState( false );\n\n\tfunction focusRegion( offset: number ) {\n\t\tconst regions = Array.from(\n\t\t\tref.current?.querySelectorAll< HTMLElement >(\n\t\t\t\t'[role=\"region\"][tabindex=\"-1\"]'\n\t\t\t) ?? []\n\t\t);\n\t\tif ( ! regions.length ) {\n\t\t\treturn;\n\t\t}\n\t\tlet nextRegion = regions[ 0 ];\n\t\t// Based off the current element, use closest to determine the wrapping region since this operates up the DOM. Also, match tabindex to avoid edge cases with regions we do not want.\n\t\tconst wrappingRegion =\n\t\t\tref.current?.ownerDocument?.activeElement?.closest< HTMLElement >(\n\t\t\t\t'[role=\"region\"][tabindex=\"-1\"]'\n\t\t\t);\n\t\tconst selectedIndex = wrappingRegion\n\t\t\t? regions.indexOf( wrappingRegion )\n\t\t\t: -1;\n\t\tif ( selectedIndex !== -1 ) {\n\t\t\tlet nextIndex = selectedIndex + offset;\n\t\t\tnextIndex = nextIndex === -1 ? regions.length - 1 : nextIndex;\n\t\t\tnextIndex = nextIndex === regions.length ? 0 : nextIndex;\n\t\t\tnextRegion = regions[ nextIndex ];\n\t\t}\n\n\t\tnextRegion.focus();\n\t\tsetIsFocusingRegions( true );\n\t}\n\n\tconst clickRef = useRefEffect(\n\t\t( element ) => {\n\t\t\tfunction onClick() {\n\t\t\t\tsetIsFocusingRegions( false );\n\t\t\t}\n\n\t\t\telement.addEventListener( 'click', onClick );\n\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'click', onClick );\n\t\t\t};\n\t\t},\n\t\t[ setIsFocusingRegions ]\n\t);\n\n\treturn {\n\t\tref: useMergeRefs( [ ref, clickRef ] ),\n\t\tclassName: isFocusingRegions ? 'is-focusing-regions' : '',\n\t\tonKeyDown( event: React.KeyboardEvent< HTMLDivElement > ) {\n\t\t\tif (\n\t\t\t\tshortcuts.previous.some( ( { modifier, character } ) => {\n\t\t\t\t\treturn isKeyboardEvent[ modifier ]( event, character );\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\tfocusRegion( -1 );\n\t\t\t} else if (\n\t\t\t\tshortcuts.next.some( ( { modifier, character } ) => {\n\t\t\t\t\treturn isKeyboardEvent[ modifier ]( event, character );\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\tfocusRegion( 1 );\n\t\t\t}\n\t\t},\n\t};\n}\n\n/**\n * `navigateRegions` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html)\n * adding keyboard navigation to switch between the different DOM elements marked as \"regions\" (role=\"region\").\n * These regions should be focusable (By adding a tabIndex attribute for example). For better accessibility,\n * these elements must be properly labelled to briefly describe the purpose of the content in the region.\n * For more details, see \"Landmark Roles\" in the [WAI-ARIA specification](https://www.w3.org/TR/wai-aria/)\n * and \"Landmark Regions\" in the [ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/).\n *\n * ```jsx\n * import { navigateRegions } from '@wordpress/components';\n *\n * const MyComponentWithNavigateRegions = navigateRegions( () => (\n * \t<div>\n * \t\t<div role=\"region\" tabIndex=\"-1\" aria-label=\"Header\">\n * \t\t\tHeader\n * \t\t</div>\n * \t\t<div role=\"region\" tabIndex=\"-1\" aria-label=\"Content\">\n * \t\t\tContent\n * \t\t</div>\n * \t\t<div role=\"region\" tabIndex=\"-1\" aria-label=\"Sidebar\">\n * \t\t\tSidebar\n * \t\t</div>\n * \t</div>\n * ) );\n * ```\n */\nexport default createHigherOrderComponent(\n\t( Component ) =>\n\t\t( { shortcuts, ...props } ) =>\n\t\t\t(\n\t\t\t\t<div { ...useNavigateRegions( shortcuts ) }>\n\t\t\t\t\t<Component { ...props } />\n\t\t\t\t</div>\n\t\t\t),\n\t'navigateRegions'\n);\n"]}
@@ -13,8 +13,8 @@ import { Component } from '@wordpress/element';
13
13
  import { createHigherOrderComponent } from '@wordpress/compose';
14
14
  export default (mapNodeToProps => createHigherOrderComponent(WrappedComponent => {
15
15
  return class extends Component {
16
- constructor() {
17
- super(...arguments);
16
+ constructor(props) {
17
+ super(props);
18
18
  this.nodeRef = this.props.node;
19
19
  this.state = {
20
20
  fallbackStyles: undefined,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/higher-order/with-fallback-styles/index.js"],"names":["fastDeepEqual","Component","createHigherOrderComponent","mapNodeToProps","WrappedComponent","constructor","arguments","nodeRef","props","node","state","fallbackStyles","undefined","grabStylesCompleted","bindRef","bind","componentDidMount","grabFallbackStyles","componentDidUpdate","newFallbackStyles","setState","Object","values","every","Boolean","render","wrappedComponent"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,qBAA1B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA,gBAAiBC,cAAF,IACdD,0BAA0B,CAAIE,gBAAF,IAAwB;AACnD,SAAO,cAAcH,SAAd,CAAwB;AAC9BI,IAAAA,WAAW,GAAG;AACb,YAAO,GAAGC,SAAV;AACA,WAAKC,OAAL,GAAe,KAAKC,KAAL,CAAWC,IAA1B;AACA,WAAKC,KAAL,GAAa;AACZC,QAAAA,cAAc,EAAEC,SADJ;AAEZC,QAAAA,mBAAmB,EAAE;AAFT,OAAb;AAKA,WAAKC,OAAL,GAAe,KAAKA,OAAL,CAAaC,IAAb,CAAmB,IAAnB,CAAf;AACA;;AAEDD,IAAAA,OAAO,CAAEL,IAAF,EAAS;AACf,UAAK,CAAEA,IAAP,EAAc;AACb;AACA;;AACD,WAAKF,OAAL,GAAeE,IAAf;AACA;;AAEDO,IAAAA,iBAAiB,GAAG;AACnB,WAAKC,kBAAL;AACA;;AAEDC,IAAAA,kBAAkB,GAAG;AACpB,WAAKD,kBAAL;AACA;;AAEDA,IAAAA,kBAAkB,GAAG;AACpB,YAAM;AAAEJ,QAAAA,mBAAF;AAAuBF,QAAAA;AAAvB,UAA0C,KAAKD,KAArD;;AACA,UAAK,KAAKH,OAAL,IAAgB,CAAEM,mBAAvB,EAA6C;AAC5C,cAAMM,iBAAiB,GAAGhB,cAAc,CACvC,KAAKI,OADkC,EAEvC,KAAKC,KAFkC,CAAxC;;AAKA,YACC,CAAER,aAAa,CAAEmB,iBAAF,EAAqBR,cAArB,CADhB,EAEE;AACD,eAAKS,QAAL,CAAe;AACdT,YAAAA,cAAc,EAAEQ,iBADF;AAEdN,YAAAA,mBAAmB,EAClBQ,MAAM,CAACC,MAAP,CAAeH,iBAAf,EAAmCI,KAAnC,CACCC,OADD;AAHa,WAAf;AAOA;AACD;AACD;;AAEDC,IAAAA,MAAM,GAAG;AACR,YAAMC,gBAAgB,GACrB,cAAC,gBAAD,eACM,KAAKlB,KADX,EAEM,KAAKE,KAAL,CAAWC,cAFjB,EADD;AAMA,aAAO,KAAKH,KAAL,CAAWC,IAAX,GACNiB,gBADM,GAGN;AAAK,QAAA,GAAG,EAAG,KAAKZ;AAAhB,cAA6BY,gBAA7B,MAHD;AAKA;;AA7D6B,GAA/B;AA+DA,CAhEyB,EAgEvB,oBAhEuB,CAD3B","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\nexport default ( mapNodeToProps ) =>\n\tcreateHigherOrderComponent( ( WrappedComponent ) => {\n\t\treturn class extends Component {\n\t\t\tconstructor() {\n\t\t\t\tsuper( ...arguments );\n\t\t\t\tthis.nodeRef = this.props.node;\n\t\t\t\tthis.state = {\n\t\t\t\t\tfallbackStyles: undefined,\n\t\t\t\t\tgrabStylesCompleted: false,\n\t\t\t\t};\n\n\t\t\t\tthis.bindRef = this.bindRef.bind( this );\n\t\t\t}\n\n\t\t\tbindRef( node ) {\n\t\t\t\tif ( ! node ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.nodeRef = node;\n\t\t\t}\n\n\t\t\tcomponentDidMount() {\n\t\t\t\tthis.grabFallbackStyles();\n\t\t\t}\n\n\t\t\tcomponentDidUpdate() {\n\t\t\t\tthis.grabFallbackStyles();\n\t\t\t}\n\n\t\t\tgrabFallbackStyles() {\n\t\t\t\tconst { grabStylesCompleted, fallbackStyles } = this.state;\n\t\t\t\tif ( this.nodeRef && ! grabStylesCompleted ) {\n\t\t\t\t\tconst newFallbackStyles = mapNodeToProps(\n\t\t\t\t\t\tthis.nodeRef,\n\t\t\t\t\t\tthis.props\n\t\t\t\t\t);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! fastDeepEqual( newFallbackStyles, fallbackStyles )\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.setState( {\n\t\t\t\t\t\t\tfallbackStyles: newFallbackStyles,\n\t\t\t\t\t\t\tgrabStylesCompleted:\n\t\t\t\t\t\t\t\tObject.values( newFallbackStyles ).every(\n\t\t\t\t\t\t\t\t\tBoolean\n\t\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\n\t\t\trender() {\n\t\t\t\tconst wrappedComponent = (\n\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t{ ...this.props }\n\t\t\t\t\t\t{ ...this.state.fallbackStyles }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t\treturn this.props.node ? (\n\t\t\t\t\twrappedComponent\n\t\t\t\t) : (\n\t\t\t\t\t<div ref={ this.bindRef }> { wrappedComponent } </div>\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, 'withFallbackStyles' );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/higher-order/with-fallback-styles/index.tsx"],"names":["fastDeepEqual","Component","createHigherOrderComponent","mapNodeToProps","WrappedComponent","constructor","props","nodeRef","node","state","fallbackStyles","undefined","grabStylesCompleted","bindRef","bind","componentDidMount","grabFallbackStyles","componentDidUpdate","newFallbackStyles","setState","Object","values","every","Boolean","render","wrappedComponent"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,qBAA1B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAYA,gBACCC,cADc,IAMdD,0BAA0B,CAAIE,gBAAF,IAAwB;AACnD,SAAO,cAAcH,SAAd,CAAwC;AAG9CI,IAAAA,WAAW,CAAEC,KAAF,EAAiB;AAC3B,YAAOA,KAAP;AACA,WAAKC,OAAL,GAAe,KAAKD,KAAL,CAAWE,IAA1B;AACA,WAAKC,KAAL,GAAa;AACZC,QAAAA,cAAc,EAAEC,SADJ;AAEZC,QAAAA,mBAAmB,EAAE;AAFT,OAAb;AAKA,WAAKC,OAAL,GAAe,KAAKA,OAAL,CAAaC,IAAb,CAAmB,IAAnB,CAAf;AACA;;AAEDD,IAAAA,OAAO,CAAEL,IAAF,EAAyB;AAC/B,UAAK,CAAEA,IAAP,EAAc;AACb;AACA;;AACD,WAAKD,OAAL,GAAeC,IAAf;AACA;;AAEDO,IAAAA,iBAAiB,GAAG;AACnB,WAAKC,kBAAL;AACA;;AAEDC,IAAAA,kBAAkB,GAAG;AACpB,WAAKD,kBAAL;AACA;;AAEDA,IAAAA,kBAAkB,GAAG;AACpB,YAAM;AAAEJ,QAAAA,mBAAF;AAAuBF,QAAAA;AAAvB,UAA0C,KAAKD,KAArD;;AACA,UAAK,KAAKF,OAAL,IAAgB,CAAEK,mBAAvB,EAA6C;AAC5C,cAAMM,iBAAiB,GAAGf,cAAc,CACvC,KAAKI,OADkC,EAEvC,KAAKD,KAFkC,CAAxC;;AAKA,YACC,CAAEN,aAAa,CAAEkB,iBAAF,EAAqBR,cAArB,CADhB,EAEE;AACD,eAAKS,QAAL,CAAe;AACdT,YAAAA,cAAc,EAAEQ,iBADF;AAEdN,YAAAA,mBAAmB,EAClBQ,MAAM,CAACC,MAAP,CAAeH,iBAAf,EAAmCI,KAAnC,CACCC,OADD;AAHa,WAAf;AAOA;AACD;AACD;;AAEDC,IAAAA,MAAM,GAAG;AACR,YAAMC,gBAAgB,GACrB,cAAC,gBAAD,eACM,KAAKnB,KADX,EAEM,KAAKG,KAAL,CAAWC,cAFjB,EADD;AAMA,aAAO,KAAKJ,KAAL,CAAWE,IAAX,GACNiB,gBADM,GAGN;AAAK,QAAA,GAAG,EAAG,KAAKZ;AAAhB,cAA6BY,gBAA7B,MAHD;AAKA;;AA/D6C,GAA/C;AAiEA,CAlEyB,EAkEvB,oBAlEuB,CAN3B","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\ntype Props = {\n\tnode?: HTMLElement;\n\t[ key: string ]: any;\n};\n\ntype State = {\n\tfallbackStyles?: { [ key: string ]: any };\n\tgrabStylesCompleted: boolean;\n};\n\nexport default (\n\tmapNodeToProps: (\n\t\tnode: HTMLElement,\n\t\tprops: Props\n\t) => { [ key: string ]: any }\n) =>\n\tcreateHigherOrderComponent( ( WrappedComponent ) => {\n\t\treturn class extends Component< Props, State > {\n\t\t\tnodeRef?: HTMLElement;\n\n\t\t\tconstructor( props: Props ) {\n\t\t\t\tsuper( props );\n\t\t\t\tthis.nodeRef = this.props.node;\n\t\t\t\tthis.state = {\n\t\t\t\t\tfallbackStyles: undefined,\n\t\t\t\t\tgrabStylesCompleted: false,\n\t\t\t\t};\n\n\t\t\t\tthis.bindRef = this.bindRef.bind( this );\n\t\t\t}\n\n\t\t\tbindRef( node: HTMLDivElement ) {\n\t\t\t\tif ( ! node ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.nodeRef = node;\n\t\t\t}\n\n\t\t\tcomponentDidMount() {\n\t\t\t\tthis.grabFallbackStyles();\n\t\t\t}\n\n\t\t\tcomponentDidUpdate() {\n\t\t\t\tthis.grabFallbackStyles();\n\t\t\t}\n\n\t\t\tgrabFallbackStyles() {\n\t\t\t\tconst { grabStylesCompleted, fallbackStyles } = this.state;\n\t\t\t\tif ( this.nodeRef && ! grabStylesCompleted ) {\n\t\t\t\t\tconst newFallbackStyles = mapNodeToProps(\n\t\t\t\t\t\tthis.nodeRef,\n\t\t\t\t\t\tthis.props\n\t\t\t\t\t);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! fastDeepEqual( newFallbackStyles, fallbackStyles )\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.setState( {\n\t\t\t\t\t\t\tfallbackStyles: newFallbackStyles,\n\t\t\t\t\t\t\tgrabStylesCompleted:\n\t\t\t\t\t\t\t\tObject.values( newFallbackStyles ).every(\n\t\t\t\t\t\t\t\t\tBoolean\n\t\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\n\t\t\trender() {\n\t\t\t\tconst wrappedComponent = (\n\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t{ ...this.props }\n\t\t\t\t\t\t{ ...this.state.fallbackStyles }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t\treturn this.props.node ? (\n\t\t\t\t\twrappedComponent\n\t\t\t\t) : (\n\t\t\t\t\t<div ref={ this.bindRef }> { wrappedComponent } </div>\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, 'withFallbackStyles' );\n"]}
@@ -13,9 +13,35 @@ const ANIMATION_FRAME_PERIOD = 16;
13
13
  * to be mounted. When a filter is added or removed that matches the hook name,
14
14
  * the wrapped component re-renders.
15
15
  *
16
- * @param {string} hookName Hook name exposed to be used by filters.
16
+ * @param hookName Hook name exposed to be used by filters.
17
17
  *
18
- * @return {Function} Higher-order component factory.
18
+ * @return Higher-order component factory.
19
+ *
20
+ * ```jsx
21
+ * import { withFilters } from '@wordpress/components';
22
+ * import { addFilter } from '@wordpress/hooks';
23
+ *
24
+ * const MyComponent = ( { title } ) => <h1>{ title }</h1>;
25
+ *
26
+ * const ComponentToAppend = () => <div>Appended component</div>;
27
+ *
28
+ * function withComponentAppended( FilteredComponent ) {
29
+ * return ( props ) => (
30
+ * <>
31
+ * <FilteredComponent { ...props } />
32
+ * <ComponentToAppend />
33
+ * </>
34
+ * );
35
+ * }
36
+ *
37
+ * addFilter(
38
+ * 'MyHookName',
39
+ * 'my-plugin/with-component-appended',
40
+ * withComponentAppended
41
+ * );
42
+ *
43
+ * const MyComponentWithFilters = withFilters( 'MyHookName' )( MyComponent );
44
+ * ```
19
45
  */
20
46
 
21
47
  export default function withFilters(hookName) {
@@ -25,8 +51,6 @@ export default function withFilters(hookName) {
25
51
  * The component definition with current filters applied. Each instance
26
52
  * reuse this shared reference as an optimization to avoid excessive
27
53
  * calls to `applyFilters` when many instances exist.
28
- *
29
- * @type {?Component}
30
54
  */
31
55
 
32
56
  let FilteredComponent;
@@ -42,8 +66,8 @@ export default function withFilters(hookName) {
42
66
  }
43
67
 
44
68
  class FilteredComponentRenderer extends Component {
45
- constructor() {
46
- super(...arguments);
69
+ constructor(props) {
70
+ super(props);
47
71
  ensureFilteredComponent();
48
72
  }
49
73
 
@@ -93,7 +117,7 @@ export default function withFilters(hookName) {
93
117
  * mounted instance should re-render with the new filters having been
94
118
  * applied to the original component.
95
119
  *
96
- * @param {string} updatedHookName Name of the hook that was updated.
120
+ * @param updatedHookName Name of the hook that was updated.
97
121
  */
98
122
 
99
123
  function onHooksUpdated(updatedHookName) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/higher-order/with-filters/index.js"],"names":["Component","addAction","applyFilters","removeAction","createHigherOrderComponent","debounce","ANIMATION_FRAME_PERIOD","withFilters","hookName","OriginalComponent","namespace","FilteredComponent","ensureFilteredComponent","undefined","FilteredComponentRenderer","constructor","arguments","componentDidMount","instances","push","length","onHooksUpdated","componentWillUnmount","filter","instance","render","props","throttledForceUpdate","forEach","forceUpdate","updatedHookName"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,YAApB,EAAkCC,YAAlC,QAAsD,kBAAtD;AACA,SAASC,0BAAT,EAAqCC,QAArC,QAAqD,oBAArD;AAEA,MAAMC,sBAAsB,GAAG,EAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,WAAT,CAAsBC,QAAtB,EAAiC;AAC/C,SAAOJ,0BAA0B,CAAIK,iBAAF,IAAyB;AAC3D,UAAMC,SAAS,GAAG,uBAAuBF,QAAzC;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;;AACE,QAAIG,iBAAJ;AAEA;AACF;AACA;AACA;;AACE,aAASC,uBAAT,GAAmC;AAClC,UAAKD,iBAAiB,KAAKE,SAA3B,EAAuC;AACtCF,QAAAA,iBAAiB,GAAGT,YAAY,CAAEM,QAAF,EAAYC,iBAAZ,CAAhC;AACA;AACD;;AAED,UAAMK,yBAAN,SAAwCd,SAAxC,CAAkD;AACjDe,MAAAA,WAAW,GAAG;AACb,cAAO,GAAGC,SAAV;AAEAJ,QAAAA,uBAAuB;AACvB;;AAEDK,MAAAA,iBAAiB,GAAG;AACnBH,QAAAA,yBAAyB,CAACI,SAA1B,CAAoCC,IAApC,CAA0C,IAA1C,EADmB,CAGnB;AACA;;AACA,YAAKL,yBAAyB,CAACI,SAA1B,CAAoCE,MAApC,KAA+C,CAApD,EAAwD;AACvDnB,UAAAA,SAAS,CAAE,aAAF,EAAiBS,SAAjB,EAA4BW,cAA5B,CAAT;AACApB,UAAAA,SAAS,CAAE,WAAF,EAAeS,SAAf,EAA0BW,cAA1B,CAAT;AACA;AACD;;AAEDC,MAAAA,oBAAoB,GAAG;AACtBR,QAAAA,yBAAyB,CAACI,SAA1B,GACCJ,yBAAyB,CAACI,SAA1B,CAAoCK,MAApC,CACGC,QAAF,IAAgBA,QAAQ,KAAK,IAD9B,CADD,CADsB,CAMtB;AACA;;AACA,YAAKV,yBAAyB,CAACI,SAA1B,CAAoCE,MAApC,KAA+C,CAApD,EAAwD;AACvDjB,UAAAA,YAAY,CAAE,aAAF,EAAiBO,SAAjB,CAAZ;AACAP,UAAAA,YAAY,CAAE,WAAF,EAAeO,SAAf,CAAZ;AACA;AACD;;AAEDe,MAAAA,MAAM,GAAG;AACR,eAAO,cAAC,iBAAD,EAAwB,KAAKC,KAA7B,CAAP;AACA;;AAlCgD;;AAqClDZ,IAAAA,yBAAyB,CAACI,SAA1B,GAAsC,EAAtC;AAEA;AACF;AACA;AACA;;AACE,UAAMS,oBAAoB,GAAGtB,QAAQ,CAAE,MAAM;AAC5C;AACA;AACAM,MAAAA,iBAAiB,GAAGT,YAAY,CAAEM,QAAF,EAAYC,iBAAZ,CAAhC,CAH4C,CAK5C;;AACAK,MAAAA,yBAAyB,CAACI,SAA1B,CAAoCU,OAApC,CAA+CJ,QAAF,IAAgB;AAC5DA,QAAAA,QAAQ,CAACK,WAAT;AACA,OAFD;AAGA,KAToC,EASlCvB,sBATkC,CAArC;AAWA;AACF;AACA;AACA;AACA;AACA;AACA;;AACE,aAASe,cAAT,CAAyBS,eAAzB,EAA2C;AAC1C,UAAKA,eAAe,KAAKtB,QAAzB,EAAoC;AACnCmB,QAAAA,oBAAoB;AACpB;AACD;;AAED,WAAOb,yBAAP;AACA,GA1FgC,EA0F9B,aA1F8B,CAAjC;AA2FA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { addAction, applyFilters, removeAction } from '@wordpress/hooks';\nimport { createHigherOrderComponent, debounce } from '@wordpress/compose';\n\nconst ANIMATION_FRAME_PERIOD = 16;\n\n/**\n * Creates a higher-order component which adds filtering capability to the\n * wrapped component. Filters get applied when the original component is about\n * to be mounted. When a filter is added or removed that matches the hook name,\n * the wrapped component re-renders.\n *\n * @param {string} hookName Hook name exposed to be used by filters.\n *\n * @return {Function} Higher-order component factory.\n */\nexport default function withFilters( hookName ) {\n\treturn createHigherOrderComponent( ( OriginalComponent ) => {\n\t\tconst namespace = 'core/with-filters/' + hookName;\n\n\t\t/**\n\t\t * The component definition with current filters applied. Each instance\n\t\t * reuse this shared reference as an optimization to avoid excessive\n\t\t * calls to `applyFilters` when many instances exist.\n\t\t *\n\t\t * @type {?Component}\n\t\t */\n\t\tlet FilteredComponent;\n\n\t\t/**\n\t\t * Initializes the FilteredComponent variable once, if not already\n\t\t * assigned. Subsequent calls are effectively a noop.\n\t\t */\n\t\tfunction ensureFilteredComponent() {\n\t\t\tif ( FilteredComponent === undefined ) {\n\t\t\t\tFilteredComponent = applyFilters( hookName, OriginalComponent );\n\t\t\t}\n\t\t}\n\n\t\tclass FilteredComponentRenderer extends Component {\n\t\t\tconstructor() {\n\t\t\t\tsuper( ...arguments );\n\n\t\t\t\tensureFilteredComponent();\n\t\t\t}\n\n\t\t\tcomponentDidMount() {\n\t\t\t\tFilteredComponentRenderer.instances.push( this );\n\n\t\t\t\t// If there were previously no mounted instances for components\n\t\t\t\t// filtered on this hook, add the hook handler.\n\t\t\t\tif ( FilteredComponentRenderer.instances.length === 1 ) {\n\t\t\t\t\taddAction( 'hookRemoved', namespace, onHooksUpdated );\n\t\t\t\t\taddAction( 'hookAdded', namespace, onHooksUpdated );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcomponentWillUnmount() {\n\t\t\t\tFilteredComponentRenderer.instances =\n\t\t\t\t\tFilteredComponentRenderer.instances.filter(\n\t\t\t\t\t\t( instance ) => instance !== this\n\t\t\t\t\t);\n\n\t\t\t\t// If this was the last of the mounted components filtered on\n\t\t\t\t// this hook, remove the hook handler.\n\t\t\t\tif ( FilteredComponentRenderer.instances.length === 0 ) {\n\t\t\t\t\tremoveAction( 'hookRemoved', namespace );\n\t\t\t\t\tremoveAction( 'hookAdded', namespace );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trender() {\n\t\t\t\treturn <FilteredComponent { ...this.props } />;\n\t\t\t}\n\t\t}\n\n\t\tFilteredComponentRenderer.instances = [];\n\n\t\t/**\n\t\t * Updates the FilteredComponent definition, forcing a render for each\n\t\t * mounted instance. This occurs a maximum of once per animation frame.\n\t\t */\n\t\tconst throttledForceUpdate = debounce( () => {\n\t\t\t// Recreate the filtered component, only after delay so that it's\n\t\t\t// computed once, even if many filters added.\n\t\t\tFilteredComponent = applyFilters( hookName, OriginalComponent );\n\n\t\t\t// Force each instance to render.\n\t\t\tFilteredComponentRenderer.instances.forEach( ( instance ) => {\n\t\t\t\tinstance.forceUpdate();\n\t\t\t} );\n\t\t}, ANIMATION_FRAME_PERIOD );\n\n\t\t/**\n\t\t * When a filter is added or removed for the matching hook name, each\n\t\t * mounted instance should re-render with the new filters having been\n\t\t * applied to the original component.\n\t\t *\n\t\t * @param {string} updatedHookName Name of the hook that was updated.\n\t\t */\n\t\tfunction onHooksUpdated( updatedHookName ) {\n\t\t\tif ( updatedHookName === hookName ) {\n\t\t\t\tthrottledForceUpdate();\n\t\t\t}\n\t\t}\n\n\t\treturn FilteredComponentRenderer;\n\t}, 'withFilters' );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/higher-order/with-filters/index.tsx"],"names":["Component","addAction","applyFilters","removeAction","createHigherOrderComponent","debounce","ANIMATION_FRAME_PERIOD","withFilters","hookName","OriginalComponent","namespace","FilteredComponent","ensureFilteredComponent","undefined","FilteredComponentRenderer","constructor","props","componentDidMount","instances","push","length","onHooksUpdated","componentWillUnmount","filter","instance","render","throttledForceUpdate","forEach","forceUpdate","updatedHookName"],"mappings":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AAAA,yBAAyB,CAACI,SAA1B,GACCJ,yBAAyB,CAACI,SAA1B,CAAoCK,MAApC,CACGC,QAAF,IAAgBA,QAAQ,KAAK,IAD9B,CADD,CADsB,CAMtB;AACA;;AACA,YAAKV,yBAAyB,CAACI,SAA1B,CAAoCE,MAApC,KAA+C,CAApD,EAAwD;AACvDjB,UAAAA,YAAY,CAAE,aAAF,EAAiBO,SAAjB,CAAZ;AACAP,UAAAA,YAAY,CAAE,WAAF,EAAeO,SAAf,CAAZ;AACA;AACD;;AAEDe,MAAAA,MAAM,GAAG;AACR,eAAO,cAAC,iBAAD,EAAwB,KAAKT,KAA7B,CAAP;AACA;;AApCgD;;AAuClDF,IAAAA,yBAAyB,CAACI,SAA1B,GAAsC,EAAtC;AAEA;AACF;AACA;AACA;;AACE,UAAMQ,oBAAoB,GAAGrB,QAAQ,CAAE,MAAM;AAC5C;AACA;AACAM,MAAAA,iBAAiB,GAAGT,YAAY,CAC/BM,QAD+B,EAE/BC,iBAF+B,CAAhC,CAH4C,CAQ5C;;AACAK,MAAAA,yBAAyB,CAACI,SAA1B,CAAoCS,OAApC,CAA+CH,QAAF,IAAgB;AAC5DA,QAAAA,QAAQ,CAACI,WAAT;AACA,OAFD;AAGA,KAZoC,EAYlCtB,sBAZkC,CAArC;AAcA;AACF;AACA;AACA;AACA;AACA;AACA;;AACE,aAASe,cAAT,CAAyBQ,eAAzB,EAAmD;AAClD,UAAKA,eAAe,KAAKrB,QAAzB,EAAoC;AACnCkB,QAAAA,oBAAoB;AACpB;AACD;;AAED,WAAOZ,yBAAP;AACA,GAhGgC,EAgG9B,aAhG8B,CAAjC;AAiGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { addAction, applyFilters, removeAction } from '@wordpress/hooks';\nimport { createHigherOrderComponent, debounce } from '@wordpress/compose';\n\nconst ANIMATION_FRAME_PERIOD = 16;\n\n/**\n * Creates a higher-order component which adds filtering capability to the\n * wrapped component. Filters get applied when the original component is about\n * to be mounted. When a filter is added or removed that matches the hook name,\n * the wrapped component re-renders.\n *\n * @param hookName Hook name exposed to be used by filters.\n *\n * @return Higher-order component factory.\n *\n * ```jsx\n * import { withFilters } from '@wordpress/components';\n * import { addFilter } from '@wordpress/hooks';\n *\n * const MyComponent = ( { title } ) => <h1>{ title }</h1>;\n *\n * const ComponentToAppend = () => <div>Appended component</div>;\n *\n * function withComponentAppended( FilteredComponent ) {\n * \treturn ( props ) => (\n * \t\t<>\n * \t\t\t<FilteredComponent { ...props } />\n * \t\t\t<ComponentToAppend />\n * \t\t</>\n * \t);\n * }\n *\n * addFilter(\n * \t'MyHookName',\n * \t'my-plugin/with-component-appended',\n * \twithComponentAppended\n * );\n *\n * const MyComponentWithFilters = withFilters( 'MyHookName' )( MyComponent );\n * ```\n */\nexport default function withFilters( hookName: string ) {\n\treturn createHigherOrderComponent( ( OriginalComponent ) => {\n\t\tconst namespace = 'core/with-filters/' + hookName;\n\n\t\t/**\n\t\t * The component definition with current filters applied. Each instance\n\t\t * reuse this shared reference as an optimization to avoid excessive\n\t\t * calls to `applyFilters` when many instances exist.\n\t\t */\n\t\tlet FilteredComponent: React.ComponentType;\n\n\t\t/**\n\t\t * Initializes the FilteredComponent variable once, if not already\n\t\t * assigned. Subsequent calls are effectively a noop.\n\t\t */\n\t\tfunction ensureFilteredComponent() {\n\t\t\tif ( FilteredComponent === undefined ) {\n\t\t\t\tFilteredComponent = applyFilters(\n\t\t\t\t\thookName,\n\t\t\t\t\tOriginalComponent\n\t\t\t\t) as React.ComponentType;\n\t\t\t}\n\t\t}\n\n\t\tclass FilteredComponentRenderer extends Component {\n\t\t\tstatic instances: FilteredComponentRenderer[];\n\n\t\t\tconstructor( props: { [ key: string ]: any } ) {\n\t\t\t\tsuper( props );\n\n\t\t\t\tensureFilteredComponent();\n\t\t\t}\n\n\t\t\tcomponentDidMount() {\n\t\t\t\tFilteredComponentRenderer.instances.push( this );\n\n\t\t\t\t// If there were previously no mounted instances for components\n\t\t\t\t// filtered on this hook, add the hook handler.\n\t\t\t\tif ( FilteredComponentRenderer.instances.length === 1 ) {\n\t\t\t\t\taddAction( 'hookRemoved', namespace, onHooksUpdated );\n\t\t\t\t\taddAction( 'hookAdded', namespace, onHooksUpdated );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcomponentWillUnmount() {\n\t\t\t\tFilteredComponentRenderer.instances =\n\t\t\t\t\tFilteredComponentRenderer.instances.filter(\n\t\t\t\t\t\t( instance ) => instance !== this\n\t\t\t\t\t);\n\n\t\t\t\t// If this was the last of the mounted components filtered on\n\t\t\t\t// this hook, remove the hook handler.\n\t\t\t\tif ( FilteredComponentRenderer.instances.length === 0 ) {\n\t\t\t\t\tremoveAction( 'hookRemoved', namespace );\n\t\t\t\t\tremoveAction( 'hookAdded', namespace );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trender() {\n\t\t\t\treturn <FilteredComponent { ...this.props } />;\n\t\t\t}\n\t\t}\n\n\t\tFilteredComponentRenderer.instances = [];\n\n\t\t/**\n\t\t * Updates the FilteredComponent definition, forcing a render for each\n\t\t * mounted instance. This occurs a maximum of once per animation frame.\n\t\t */\n\t\tconst throttledForceUpdate = debounce( () => {\n\t\t\t// Recreate the filtered component, only after delay so that it's\n\t\t\t// computed once, even if many filters added.\n\t\t\tFilteredComponent = applyFilters(\n\t\t\t\thookName,\n\t\t\t\tOriginalComponent\n\t\t\t) as React.ComponentType;\n\n\t\t\t// Force each instance to render.\n\t\t\tFilteredComponentRenderer.instances.forEach( ( instance ) => {\n\t\t\t\tinstance.forceUpdate();\n\t\t\t} );\n\t\t}, ANIMATION_FRAME_PERIOD );\n\n\t\t/**\n\t\t * When a filter is added or removed for the matching hook name, each\n\t\t * mounted instance should re-render with the new filters having been\n\t\t * applied to the original component.\n\t\t *\n\t\t * @param updatedHookName Name of the hook that was updated.\n\t\t */\n\t\tfunction onHooksUpdated( updatedHookName: string ) {\n\t\t\tif ( updatedHookName === hookName ) {\n\t\t\t\tthrottledForceUpdate();\n\t\t\t}\n\t\t}\n\n\t\treturn FilteredComponentRenderer;\n\t}, 'withFilters' );\n}\n"]}
@@ -10,30 +10,30 @@ import deprecated from '@wordpress/deprecated';
10
10
  * Returns true if the given object is component-like. An object is component-
11
11
  * like if it is an instance of wp.element.Component, or is a function.
12
12
  *
13
- * @param {*} object Object to test.
13
+ * @param object Object to test.
14
14
  *
15
- * @return {boolean} Whether object is component-like.
15
+ * @return Whether object is component-like.
16
16
  */
17
17
 
18
18
  function isComponentLike(object) {
19
19
  return object instanceof Component || typeof object === 'function';
20
20
  }
21
+
21
22
  /**
22
23
  * Higher Order Component used to be used to wrap disposable elements like
23
24
  * sidebars, modals, dropdowns. When mounting the wrapped component, we track a
24
25
  * reference to the current active element so we know where to restore focus
25
26
  * when the component is unmounted.
26
27
  *
27
- * @param {(WPComponent|Object)} options The component to be enhanced with
28
- * focus return behavior, or an object
29
- * describing the component and the
30
- * focus return characteristics.
28
+ * @param options The component to be enhanced with
29
+ * focus return behavior, or an object
30
+ * describing the component and the
31
+ * focus return characteristics.
31
32
  *
32
- * @return {Function} Higher Order Component with the focus restauration behaviour.
33
+ * @return Higher Order Component with the focus restauration behaviour.
33
34
  */
34
-
35
-
36
- export default createHigherOrderComponent(options => {
35
+ export default createHigherOrderComponent( // @ts-expect-error TODO: Reconcile with intended `createHigherOrderComponent` types
36
+ options => {
37
37
  const HoC = function () {
38
38
  let {
39
39
  onFocusReturn
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/higher-order/with-focus-return/index.js"],"names":["Component","createHigherOrderComponent","useFocusReturn","deprecated","isComponentLike","object","options","HoC","onFocusReturn","WrappedComponent","WithFocusReturn","props","ref","Provider","children","since","hint"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,0BAAT,EAAqCC,cAArC,QAA2D,oBAA3D;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,eAAT,CAA0BC,MAA1B,EAAmC;AAClC,SAAOA,MAAM,YAAYL,SAAlB,IAA+B,OAAOK,MAAP,KAAkB,UAAxD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAeJ,0BAA0B,CAAIK,OAAF,IAAe;AACzD,QAAMC,GAAG,GACR;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF,uEAAsB,EAAtB;AAAA,WACEC,gBAAF,IAAwB;AACvB,YAAMC,eAAe,GAAKC,KAAF,IAAa;AACpC,cAAMC,GAAG,GAAGV,cAAc,CAAEM,aAAF,CAA1B;AACA,eACC;AAAK,UAAA,GAAG,EAAGI;AAAX,WACC,cAAC,gBAAD,EAAuBD,KAAvB,CADD,CADD;AAKA,OAPD;;AASA,aAAOD,eAAP;AACA,KAZD;AAAA,GADD;;AAeA,MAAKN,eAAe,CAAEE,OAAF,CAApB,EAAkC;AACjC,UAAMG,gBAAgB,GAAGH,OAAzB;AACA,WAAOC,GAAG,GAAIE,gBAAJ,CAAV;AACA;;AAED,SAAOF,GAAG,CAAED,OAAF,CAAV;AACA,CAtBwC,EAsBtC,iBAtBsC,CAAzC;AAwBA,OAAO,MAAMO,QAAQ,GAAG,QAAoB;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;AAC3CX,EAAAA,UAAU,CAAE,6CAAF,EAAiD;AAC1DY,IAAAA,KAAK,EAAE,KADmD;AAE1DC,IAAAA,IAAI,EAAE;AAFoD,GAAjD,CAAV;AAKA,SAAOF,QAAP;AACA,CAPM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { createHigherOrderComponent, useFocusReturn } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Returns true if the given object is component-like. An object is component-\n * like if it is an instance of wp.element.Component, or is a function.\n *\n * @param {*} object Object to test.\n *\n * @return {boolean} Whether object is component-like.\n */\nfunction isComponentLike( object ) {\n\treturn object instanceof Component || typeof object === 'function';\n}\n\n/**\n * Higher Order Component used to be used to wrap disposable elements like\n * sidebars, modals, dropdowns. When mounting the wrapped component, we track a\n * reference to the current active element so we know where to restore focus\n * when the component is unmounted.\n *\n * @param {(WPComponent|Object)} options The component to be enhanced with\n * focus return behavior, or an object\n * describing the component and the\n * focus return characteristics.\n *\n * @return {Function} Higher Order Component with the focus restauration behaviour.\n */\nexport default createHigherOrderComponent( ( options ) => {\n\tconst HoC =\n\t\t( { onFocusReturn } = {} ) =>\n\t\t( WrappedComponent ) => {\n\t\t\tconst WithFocusReturn = ( props ) => {\n\t\t\t\tconst ref = useFocusReturn( onFocusReturn );\n\t\t\t\treturn (\n\t\t\t\t\t<div ref={ ref }>\n\t\t\t\t\t\t<WrappedComponent { ...props } />\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\treturn WithFocusReturn;\n\t\t};\n\n\tif ( isComponentLike( options ) ) {\n\t\tconst WrappedComponent = options;\n\t\treturn HoC()( WrappedComponent );\n\t}\n\n\treturn HoC( options );\n}, 'withFocusReturn' );\n\nexport const Provider = ( { children } ) => {\n\tdeprecated( 'wp.components.FocusReturnProvider component', {\n\t\tsince: '5.7',\n\t\thint: 'This provider is not used anymore. You can just remove it from your codebase',\n\t} );\n\n\treturn children;\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/higher-order/with-focus-return/index.tsx"],"names":["Component","createHigherOrderComponent","useFocusReturn","deprecated","isComponentLike","object","options","HoC","onFocusReturn","WrappedComponent","WithFocusReturn","props","ref","Provider","children","since","hint"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,0BAAT,EAAqCC,cAArC,QAA2D,oBAA3D;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,eAAT,CAA0BC,MAA1B,EAAuE;AACtE,SAAOA,MAAM,YAAYL,SAAlB,IAA+B,OAAOK,MAAP,KAAkB,UAAxD;AACA;;AAMD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeJ,0BAA0B,EACxC;AACEK,OAAF,IAAwD;AACvD,QAAMC,GAAG,GACR;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF,uEAA6B,EAA7B;AAAA,WACEC,gBAAF,IAA6C;AAC5C,YAAMC,eAAe,GACpBC,KADuB,IAEnB;AACJ,cAAMC,GAAG,GAAGV,cAAc,CAAEM,aAAF,CAA1B;AACA,eACC;AAAK,UAAA,GAAG,EAAGI;AAAX,WACC,cAAC,gBAAD,EAAuBD,KAAvB,CADD,CADD;AAKA,OATD;;AAWA,aAAOD,eAAP;AACA,KAdD;AAAA,GADD;;AAiBA,MAAKN,eAAe,CAAEE,OAAF,CAApB,EAAkC;AACjC,UAAMG,gBAAgB,GAAGH,OAAzB;AACA,WAAOC,GAAG,GAAIE,gBAAJ,CAAV;AACA;;AAED,SAAOF,GAAG,CAAED,OAAF,CAAV;AACA,CA1BuC,EA2BxC,iBA3BwC,CAAzC;AA8BA,OAAO,MAAMO,QAAQ,GAAG,QAAmD;AAAA,MAAjD;AAAEC,IAAAA;AAAF,GAAiD;AAC1EX,EAAAA,UAAU,CAAE,6CAAF,EAAiD;AAC1DY,IAAAA,KAAK,EAAE,KADmD;AAE1DC,IAAAA,IAAI,EAAE;AAFoD,GAAjD,CAAV;AAKA,SAAOF,QAAP;AACA,CAPM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { createHigherOrderComponent, useFocusReturn } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Returns true if the given object is component-like. An object is component-\n * like if it is an instance of wp.element.Component, or is a function.\n *\n * @param object Object to test.\n *\n * @return Whether object is component-like.\n */\nfunction isComponentLike( object: any ): object is React.ComponentType {\n\treturn object instanceof Component || typeof object === 'function';\n}\n\ntype Props = {\n\tonFocusReturn?: () => void;\n};\n\n/**\n * Higher Order Component used to be used to wrap disposable elements like\n * sidebars, modals, dropdowns. When mounting the wrapped component, we track a\n * reference to the current active element so we know where to restore focus\n * when the component is unmounted.\n *\n * @param options The component to be enhanced with\n * focus return behavior, or an object\n * describing the component and the\n * focus return characteristics.\n *\n * @return Higher Order Component with the focus restauration behaviour.\n */\nexport default createHigherOrderComponent(\n\t// @ts-expect-error TODO: Reconcile with intended `createHigherOrderComponent` types\n\t( options: WPComponent | Record< string, unknown > ) => {\n\t\tconst HoC =\n\t\t\t( { onFocusReturn }: Props = {} ) =>\n\t\t\t( WrappedComponent: React.ComponentType ) => {\n\t\t\t\tconst WithFocusReturn = (\n\t\t\t\t\tprops: Record< string, unknown >\n\t\t\t\t) => {\n\t\t\t\t\tconst ref = useFocusReturn( onFocusReturn );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div ref={ ref }>\n\t\t\t\t\t\t\t<WrappedComponent { ...props } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\treturn WithFocusReturn;\n\t\t\t};\n\n\t\tif ( isComponentLike( options ) ) {\n\t\t\tconst WrappedComponent = options;\n\t\t\treturn HoC()( WrappedComponent );\n\t\t}\n\n\t\treturn HoC( options );\n\t},\n\t'withFocusReturn'\n);\n\nexport const Provider = ( { children }: { children: React.ReactNode } ) => {\n\tdeprecated( 'wp.components.FocusReturnProvider component', {\n\t\tsince: '5.7',\n\t\thint: 'This provider is not used anymore. You can just remove it from your codebase',\n\t} );\n\n\treturn children;\n};\n"]}
@@ -16,23 +16,40 @@ import { createHigherOrderComponent } from '@wordpress/compose';
16
16
  */
17
17
 
18
18
  import NoticeList from '../../notice/list';
19
+
19
20
  /**
20
21
  * Override the default edit UI to include notices if supported.
21
22
  *
22
- * @param {WPComponent} OriginalComponent Original component.
23
+ * Wrapping the original component with `withNotices` encapsulates the component
24
+ * with the additional props `noticeOperations` and `noticeUI`.
25
+ *
26
+ * ```jsx
27
+ * import { withNotices, Button } from '@wordpress/components';
28
+ *
29
+ * const MyComponentWithNotices = withNotices(
30
+ * ( { noticeOperations, noticeUI } ) => {
31
+ * const addError = () =>
32
+ * noticeOperations.createErrorNotice( 'Error message' );
33
+ * return (
34
+ * <div>
35
+ * { noticeUI }
36
+ * <Button variant="secondary" onClick={ addError }>
37
+ * Add error
38
+ * </Button>
39
+ * </div>
40
+ * );
41
+ * }
42
+ * );
43
+ * ```
23
44
  *
24
- * @return {WPComponent} Wrapped component.
45
+ * @param OriginalComponent Original component.
46
+ *
47
+ * @return Wrapped component.
25
48
  */
26
-
27
49
  export default createHigherOrderComponent(OriginalComponent => {
28
50
  function Component(props, ref) {
29
51
  const [noticeList, setNoticeList] = useState([]);
30
52
  const noticeOperations = useMemo(() => {
31
- /**
32
- * Function passed down as a prop that adds a new notice.
33
- *
34
- * @param {Object} notice Notice to add.
35
- */
36
53
  const createNotice = notice => {
37
54
  const noticeToAdd = notice.id ? notice : { ...notice,
38
55
  id: uuid()
@@ -42,31 +59,16 @@ export default createHigherOrderComponent(OriginalComponent => {
42
59
 
43
60
  return {
44
61
  createNotice,
45
-
46
- /**
47
- * Function passed as a prop that adds a new error notice.
48
- *
49
- * @param {string} msg Error message of the notice.
50
- */
51
62
  createErrorNotice: msg => {
63
+ // @ts-expect-error TODO: Missing `id`, potentially a bug
52
64
  createNotice({
53
65
  status: 'error',
54
66
  content: msg
55
67
  });
56
68
  },
57
-
58
- /**
59
- * Removes a notice by id.
60
- *
61
- * @param {string} id Id of the notice to remove.
62
- */
63
69
  removeNotice: id => {
64
70
  setNoticeList(current => current.filter(notice => notice.id !== id));
65
71
  },
66
-
67
- /**
68
- * Removes all notices
69
- */
70
72
  removeAllNotices: () => {
71
73
  setNoticeList([]);
72
74
  }
@@ -86,7 +88,8 @@ export default createHigherOrderComponent(OriginalComponent => {
86
88
  })) : createElement(OriginalComponent, propsOut);
87
89
  }
88
90
 
89
- let isForwardRef;
91
+ let isForwardRef; // @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().
92
+
90
93
  const {
91
94
  render
92
95
  } = OriginalComponent; // Returns a forwardRef if OriginalComponent appears to be a forwardRef.
@@ -97,5 +100,5 @@ export default createHigherOrderComponent(OriginalComponent => {
97
100
  }
98
101
 
99
102
  return Component;
100
- });
103
+ }, 'withNotices');
101
104
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/higher-order/with-notices/index.js"],"names":["v4","uuid","forwardRef","useState","useMemo","createHigherOrderComponent","NoticeList","OriginalComponent","Component","props","ref","noticeList","setNoticeList","noticeOperations","createNotice","notice","noticeToAdd","id","current","createErrorNotice","msg","status","content","removeNotice","filter","removeAllNotices","propsOut","noticeUI","length","isForwardRef","render"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAE,IAAIC,IAAf,QAA2B,MAA3B;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,QAArB,EAA+BC,OAA/B,QAA8C,oBAA9C;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,mBAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeD,0BAA0B,CAAIE,iBAAF,IAAyB;AACnE,WAASC,SAAT,CAAoBC,KAApB,EAA2BC,GAA3B,EAAiC;AAChC,UAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgCT,QAAQ,CAAE,EAAF,CAA9C;AAEA,UAAMU,gBAAgB,GAAGT,OAAO,CAAE,MAAM;AACvC;AACH;AACA;AACA;AACA;AACG,YAAMU,YAAY,GAAKC,MAAF,IAAc;AAClC,cAAMC,WAAW,GAAGD,MAAM,CAACE,EAAP,GACjBF,MADiB,GAEjB,EAAE,GAAGA,MAAL;AAAaE,UAAAA,EAAE,EAAEhB,IAAI;AAArB,SAFH;AAGAW,QAAAA,aAAa,CAAIM,OAAF,IAAe,CA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WAAO3B,UAAU,CAAEM,SAAF,CAAjB;AACA;;AACD,SAAOA,SAAP;AACA,CAhFwC,CAAzC","sourcesContent":["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\n\n/**\n * Override the default edit UI to include notices if supported.\n *\n * @param {WPComponent} OriginalComponent Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport default createHigherOrderComponent( ( OriginalComponent ) => {\n\tfunction Component( props, ref ) {\n\t\tconst [ noticeList, setNoticeList ] = useState( [] );\n\n\t\tconst noticeOperations = useMemo( () => {\n\t\t\t/**\n\t\t\t * Function passed down as a prop that adds a new notice.\n\t\t\t *\n\t\t\t * @param {Object} notice Notice to add.\n\t\t\t */\n\t\t\tconst createNotice = ( notice ) => {\n\t\t\t\tconst noticeToAdd = notice.id\n\t\t\t\t\t? notice\n\t\t\t\t\t: { ...notice, id: uuid() };\n\t\t\t\tsetNoticeList( ( current ) => [ ...current, noticeToAdd ] );\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tcreateNotice,\n\n\t\t\t\t/**\n\t\t\t\t * Function passed as a prop that adds a new error notice.\n\t\t\t\t *\n\t\t\t\t * @param {string} msg Error message of the notice.\n\t\t\t\t */\n\t\t\t\tcreateErrorNotice: ( msg ) => {\n\t\t\t\t\tcreateNotice( {\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\tcontent: msg,\n\t\t\t\t\t} );\n\t\t\t\t},\n\n\t\t\t\t/**\n\t\t\t\t * Removes a notice by id.\n\t\t\t\t *\n\t\t\t\t * @param {string} id Id of the notice to remove.\n\t\t\t\t */\n\t\t\t\tremoveNotice: ( id ) => {\n\t\t\t\t\tsetNoticeList( ( current ) =>\n\t\t\t\t\t\tcurrent.filter( ( notice ) => notice.id !== id )\n\t\t\t\t\t);\n\t\t\t\t},\n\n\t\t\t\t/**\n\t\t\t\t * Removes all notices\n\t\t\t\t */\n\t\t\t\tremoveAllNotices: () => {\n\t\t\t\t\tsetNoticeList( [] );\n\t\t\t\t},\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst propsOut = {\n\t\t\t...props,\n\t\t\tnoticeList,\n\t\t\tnoticeOperations,\n\t\t\tnoticeUI: noticeList.length > 0 && (\n\t\t\t\t<NoticeList\n\t\t\t\t\tclassName=\"components-with-notices-ui\"\n\t\t\t\t\tnotices={ noticeList }\n\t\t\t\t\tonRemove={ noticeOperations.removeNotice }\n\t\t\t\t/>\n\t\t\t),\n\t\t};\n\n\t\treturn isForwardRef ? (\n\t\t\t<OriginalComponent { ...propsOut } ref={ ref } />\n\t\t) : (\n\t\t\t<OriginalComponent { ...propsOut } />\n\t\t);\n\t}\n\n\tlet isForwardRef;\n\tconst { render } = OriginalComponent;\n\t// Returns a forwardRef if OriginalComponent appears to be a forwardRef.\n\tif ( typeof render === 'function' ) {\n\t\tisForwardRef = true;\n\t\treturn forwardRef( Component );\n\t}\n\treturn Component;\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/higher-order/with-notices/index.tsx"],"names":["v4","uuid","forwardRef","useState","useMemo","createHigherOrderComponent","NoticeList","OriginalComponent","Component","props","ref","noticeList","setNoticeList","noticeOperations","createNotice","notice","noticeToAdd","id","current","createErrorNotice","msg","status","content","removeNotice","filter","removeAllNotices","propsOut","noticeUI","length","isForwardRef","render"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAE,IAAIC,IAAf,QAA2B,MAA3B;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,QAArB,EAA+BC,OAA/B,QAA8C,oBAA9C;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,mBAAvB;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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QAAA,SAAS,EAAC,4BADX;AAEC,QAAA,OAAO,EAAGjB,UAFX;AAGC,QAAA,QAAQ,EAAGE,gBAAgB,CAACU;AAH7B;AALe,KAAjB;AAaA,WAAOM,YAAY,GAClB,cAAC,iBAAD,eAAwBH,QAAxB;AAAmC,MAAA,GAAG,EAAGhB;AAAzC,OADkB,GAGlB,cAAC,iBAAD,EAAwBgB,QAAxB,CAHD;AAKA;;AAED,MAAIG,YAAJ,CA5DmE,CA6DnE;;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAavB,iBAAnB,CA9DmE,CA+DnE;;AACA,MAAK,OAAOuB,MAAP,KAAkB,UAAvB,EAAoC;AACnCD,IAAAA,YAAY,GAAG,IAAf;AACA,WAAO3B,UAAU,CAAEM,SAAF,CAAjB;AACA;;AACD,SAAOA,SAAP;AACA,CArEwC,EAqEtC,aArEsC,CAAzC","sourcesContent":["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport type { WithNoticeProps } from './types';\n\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent( ( OriginalComponent ) => {\n\tfunction Component(\n\t\tprops: { [ key: string ]: any },\n\t\tref: React.ForwardedRef< any >\n\t) {\n\t\tconst [ noticeList, setNoticeList ] = useState<\n\t\t\tWithNoticeProps[ 'noticeList' ]\n\t\t>( [] );\n\n\t\tconst noticeOperations = useMemo<\n\t\t\tWithNoticeProps[ 'noticeOperations' ]\n\t\t>( () => {\n\t\t\tconst createNotice: WithNoticeProps[ 'noticeOperations' ][ 'createNotice' ] =\n\t\t\t\t( notice ) => {\n\t\t\t\t\tconst noticeToAdd = notice.id\n\t\t\t\t\t\t? notice\n\t\t\t\t\t\t: { ...notice, id: uuid() };\n\t\t\t\t\tsetNoticeList( ( current ) => [ ...current, noticeToAdd ] );\n\t\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tcreateNotice,\n\t\t\t\tcreateErrorNotice: ( msg ) => {\n\t\t\t\t\t// @ts-expect-error TODO: Missing `id`, potentially a bug\n\t\t\t\t\tcreateNotice( {\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\tcontent: msg,\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\tremoveNotice: ( id ) => {\n\t\t\t\t\tsetNoticeList( ( current ) =>\n\t\t\t\t\t\tcurrent.filter( ( notice ) => notice.id !== id )\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tremoveAllNotices: () => {\n\t\t\t\t\tsetNoticeList( [] );\n\t\t\t\t},\n\t\t\t};\n\t\t}, [] );\n\n\t\tconst propsOut = {\n\t\t\t...props,\n\t\t\tnoticeList,\n\t\t\tnoticeOperations,\n\t\t\tnoticeUI: noticeList.length > 0 && (\n\t\t\t\t<NoticeList\n\t\t\t\t\tclassName=\"components-with-notices-ui\"\n\t\t\t\t\tnotices={ noticeList }\n\t\t\t\t\tonRemove={ noticeOperations.removeNotice }\n\t\t\t\t/>\n\t\t\t),\n\t\t};\n\n\t\treturn isForwardRef ? (\n\t\t\t<OriginalComponent { ...propsOut } ref={ ref } />\n\t\t) : (\n\t\t\t<OriginalComponent { ...propsOut } />\n\t\t);\n\t}\n\n\tlet isForwardRef: boolean;\n\t// @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().\n\tconst { render } = OriginalComponent;\n\t// Returns a forwardRef if OriginalComponent appears to be a forwardRef.\n\tif ( typeof render === 'function' ) {\n\t\tisForwardRef = true;\n\t\treturn forwardRef( Component );\n\t}\n\treturn Component;\n}, 'withNotices' );\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/higher-order/with-spoken-messages/index.js"],"names":["createHigherOrderComponent","useDebounce","speak","Component","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,0BAAT,EAAqCC,WAArC,QAAwD,oBAAxD;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeF,0BAA0B,CACtCG,SAAF,IAAmBC,KAAF,IAEf,cAAC,SAAD,eACMA,KADN;AAEC,EAAA,KAAK,EAAGF,KAFT;AAGC,EAAA,cAAc,EAAGD,WAAW,CAAEC,KAAF,EAAS,GAAT;AAH7B,GAHsC,EASxC,oBATwC,CAAzC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/** @typedef {import('@wordpress/element').WPComponent} WPComponent */\n\n/**\n * A Higher Order Component used to be provide speak and debounced speak\n * functions.\n *\n * @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak\n *\n * @param {WPComponent} Component The component to be wrapped.\n *\n * @return {WPComponent} The wrapped component.\n */\nexport default createHigherOrderComponent(\n\t( Component ) => ( props ) =>\n\t\t(\n\t\t\t<Component\n\t\t\t\t{ ...props }\n\t\t\t\tspeak={ speak }\n\t\t\t\tdebouncedSpeak={ useDebounce( speak, 500 ) }\n\t\t\t/>\n\t\t),\n\t'withSpokenMessages'\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/higher-order/with-spoken-messages/index.tsx"],"names":["createHigherOrderComponent","useDebounce","speak","Component","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,0BAAT,EAAqCC,WAArC,QAAwD,oBAAxD;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeF,0BAA0B,CACtCG,SAAF,IAAmBC,KAAF,IAEf,cAAC,SAAD,eACMA,KADN;AAEC,EAAA,KAAK,EAAGF,KAFT;AAGC,EAAA,cAAc,EAAGD,WAAW,CAAEC,KAAF,EAAS,GAAT;AAH7B,GAHsC,EASxC,oBATwC,CAAzC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/** @typedef {import('@wordpress/element').WPComponent} WPComponent */\n\n/**\n * A Higher Order Component used to be provide speak and debounced speak\n * functions.\n *\n * @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak\n *\n * @param {WPComponent} Component The component to be wrapped.\n *\n * @return {WPComponent} The wrapped component.\n */\nexport default createHigherOrderComponent(\n\t( Component ) => ( props ) =>\n\t\t(\n\t\t\t<Component\n\t\t\t\t{ ...props }\n\t\t\t\tspeak={ speak }\n\t\t\t\tdebouncedSpeak={ useDebounce( speak, 500 ) }\n\t\t\t/>\n\t\t),\n\t'withSpokenMessages'\n);\n"]}
@@ -7,7 +7,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { cloneElement, createElement, Component, isValidElement } from '@wordpress/element';
10
+ import { cloneElement, createElement, isValidElement } from '@wordpress/element';
11
11
  import { SVG } from '@wordpress/primitives';
12
12
  /**
13
13
  * Internal dependencies
@@ -35,14 +35,7 @@ function Icon(_ref) {
35
35
  }
36
36
 
37
37
  if ('function' === typeof icon) {
38
- if (icon.prototype instanceof Component) {
39
- return createElement(icon, {
40
- size,
41
- ...additionalProps
42
- });
43
- }
44
-
45
- return icon({
38
+ return createElement(icon, {
46
39
  size,
47
40
  ...additionalProps
48
41
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/icon/index.tsx"],"names":["cloneElement","createElement","Component","isValidElement","SVG","Dashicon","Icon","icon","size","additionalProps","type","prototype","appliedProps","props","width","height"],"mappings":";;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,YADD,EAECC,aAFD,EAGCC,SAHD,EAICC,cAJD,QAKO,oBALP;AAMA,SAASC,GAAT,QAAoB,uBAApB;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,aAArB;;AA6BA,SAASC,IAAT,OAIgB;AAAA,MAJI;AACnBC,IAAAA,IAAI,GAAG,IADY;AAEnBC,IAAAA,IAAI,GAAG,aAAa,OAAOD,IAApB,GAA2B,EAA3B,GAAgC,EAFpB;AAGnB,OAAGE;AAHgB,GAIJ;;AACf,MAAK,aAAa,OAAOF,IAAzB,EAAgC;AAC/B,WACC,cAAC,QAAD;AACC,MAAA,IAAI,EAAGA,IADR;AAEC,MAAA,IAAI,EAAGC;AAFR,OAGQC,eAHR,EADD;AAOA;;AAED,MAAKN,cAAc,CAAEI,IAAF,CAAd,IAA0BF,QAAQ,KAAKE,IAAI,CAACG,IAAjD,EAAwD;AACvD,WAAOV,YAAY,CAAEO,IAAF,EAAQ,EAC1B,GAAGE;AADuB,KAAR,CAAnB;AAGA;;AAED,MAAK,eAAe,OAAOF,IAA3B,EAAkC;AACjC,QAAKA,IAAI,CAACI,SAAL,YAA0BT,SAA/B,EAA2C;AAC1C,aAAOD,aAAa,CAAEM,IAAF,EAAQ;AAC3BC,QAAAA,IAD2B;AAE3B,WAAGC;AAFwB,OAAR,CAApB;AAIA;;AAED,WAASF,IAAF,CAA+C;AACrDC,MAAAA,IADqD;AAErD,SAAGC;AAFkD,KAA/C,CAAP;AAIA;;AAED,MAAKF,IAAI,KAAMA,IAAI,CAACG,IAAL,KAAc,KAAd,IAAuBH,IAAI,CAACG,IAAL,KAAcN,GAA3C,CAAT,EAA4D;AAC3D,UAAMQ,YAAY,GAAG,EACpB,GAAGL,IAAI,CAACM,KADY;AAEpBC,MAAAA,KAAK,EAAEN,IAFa;AAGpBO,MAAAA,MAAM,EAAEP,IAHY;AAIpB,SAAGC;AAJiB,KAArB;AAOA,WAAO,cAAC,GAAD,EAAUG,YAAV,CAAP;AACA;;AAED,MAAKT,cAAc,CAAEI,IAAF,CAAnB,EAA8B;AAC7B,WAAOP,YAAY,CAAEO,IAAF,EAAQ;AAC1B;AACAC,MAAAA,IAF0B;AAG1B,SAAGC;AAHuB,KAAR,CAAnB;AAKA;;AAED,SAAOF,IAAP;AACA;;AAED,eAAeD,IAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentType, HTMLProps, SVGProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateElement,\n\tComponent,\n\tisValidElement,\n} from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Dashicon from '../dashicon';\nimport type { IconKey as DashiconIconKey } from '../dashicon/types';\n\nexport type IconType< P > = DashiconIconKey | ComponentType< P > | JSX.Element;\n\ninterface BaseProps< P > {\n\t/**\n\t * The icon to render. Supported values are: Dashicons (specified as\n\t * strings), functions, Component instances and `null`.\n\t *\n\t * @default null\n\t */\n\ticon?: IconType< P > | null;\n\t/**\n\t * The size (width and height) of the icon.\n\t *\n\t * @default `20` when a Dashicon is rendered, `24` for all other icons.\n\t */\n\tsize?: number;\n}\n\ntype AdditionalProps< T > = T extends ComponentType< infer U >\n\t? U\n\t: T extends DashiconIconKey\n\t? SVGProps< SVGSVGElement >\n\t: {};\n\nexport type Props< P > = BaseProps< P > & AdditionalProps< IconType< P > >;\n\nfunction Icon< P >( {\n\ticon = null,\n\tsize = 'string' === typeof icon ? 20 : 24,\n\t...additionalProps\n}: Props< P > ) {\n\tif ( 'string' === typeof icon ) {\n\t\treturn (\n\t\t\t<Dashicon\n\t\t\t\ticon={ icon }\n\t\t\t\tsize={ size }\n\t\t\t\t{ ...( additionalProps as HTMLProps< HTMLSpanElement > ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isValidElement( icon ) && Dashicon === icon.type ) {\n\t\treturn cloneElement( icon, {\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( 'function' === typeof icon ) {\n\t\tif ( icon.prototype instanceof Component ) {\n\t\t\treturn createElement( icon, {\n\t\t\t\tsize,\n\t\t\t\t...additionalProps,\n\t\t\t} as unknown as P );\n\t\t}\n\n\t\treturn ( icon as ( ...args: any[] ) => JSX.Element )( {\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( icon && ( icon.type === 'svg' || icon.type === SVG ) ) {\n\t\tconst appliedProps = {\n\t\t\t...icon.props,\n\t\t\twidth: size,\n\t\t\theight: size,\n\t\t\t...additionalProps,\n\t\t};\n\n\t\treturn <SVG { ...appliedProps } />;\n\t}\n\n\tif ( isValidElement( icon ) ) {\n\t\treturn cloneElement( icon, {\n\t\t\t// @ts-ignore Just forwarding the size prop along\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\treturn icon;\n}\n\nexport default Icon;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/icon/index.tsx"],"names":["cloneElement","createElement","isValidElement","SVG","Dashicon","Icon","icon","size","additionalProps","type","appliedProps","props","width","height"],"mappings":";;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,YADD,EAECC,aAFD,EAGCC,cAHD,QAIO,oBAJP;AAKA,SAASC,GAAT,QAAoB,uBAApB;AAEA;AACA;AACA;;AACA,OAAO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* WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateElement,\n\tisValidElement,\n} from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Dashicon from '../dashicon';\nimport type { IconKey as DashiconIconKey } from '../dashicon/types';\n\nexport type IconType =\n\t| DashiconIconKey\n\t| ComponentType< { size?: number } >\n\t| ( ( props: { size?: number } ) => JSX.Element )\n\t| JSX.Element;\n\ninterface BaseProps {\n\t/**\n\t * The icon to render. Supported values are: Dashicons (specified as\n\t * strings), functions, Component instances and `null`.\n\t *\n\t * @default null\n\t */\n\ticon?: IconType | null;\n\t/**\n\t * The size (width and height) of the icon.\n\t *\n\t * @default `20` when a Dashicon is rendered, `24` for all other icons.\n\t */\n\tsize?: number;\n}\n\ntype AdditionalProps< T > = T extends ComponentType< infer U >\n\t? U\n\t: T extends DashiconIconKey\n\t? SVGProps< SVGSVGElement >\n\t: {};\n\nexport type Props = BaseProps & AdditionalProps< IconType >;\n\nfunction Icon( {\n\ticon = null,\n\tsize = 'string' === typeof icon ? 20 : 24,\n\t...additionalProps\n}: Props ) {\n\tif ( 'string' === typeof icon ) {\n\t\treturn (\n\t\t\t<Dashicon\n\t\t\t\ticon={ icon }\n\t\t\t\tsize={ size }\n\t\t\t\t{ ...( additionalProps as HTMLProps< HTMLSpanElement > ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isValidElement( icon ) && Dashicon === icon.type ) {\n\t\treturn cloneElement( icon, {\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( 'function' === typeof icon ) {\n\t\treturn createElement( icon, {\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( icon && ( icon.type === 'svg' || icon.type === SVG ) ) {\n\t\tconst appliedProps = {\n\t\t\t...icon.props,\n\t\t\twidth: size,\n\t\t\theight: size,\n\t\t\t...additionalProps,\n\t\t};\n\n\t\treturn <SVG { ...appliedProps } />;\n\t}\n\n\tif ( isValidElement( icon ) ) {\n\t\treturn cloneElement( icon, {\n\t\t\t// @ts-ignore Just forwarding the size prop along\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\treturn icon;\n}\n\nexport default Icon;\n"]}
@@ -13,6 +13,7 @@ export { default as Spinner } from './spinner';
13
13
  export { createSlotFill, Slot, Fill, Provider as SlotFillProvider } from './slot-fill';
14
14
  export { default as __experimentalStyleProvider } from './style-provider';
15
15
  export { default as BaseControl } from './base-control';
16
+ export { hasSplitBorders as __experimentalHasSplitBorders } from './border-box-control/utils';
16
17
  export { default as TextareaControl } from './textarea-control';
17
18
  export { default as PanelBody } from './panel/body';
18
19
  export { default as PanelActions } from './panel/actions';