@wordpress/components 19.16.0 → 19.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/CHANGELOG.md +40 -4
  2. package/build/base-control/index.js +6 -3
  3. package/build/base-control/index.js.map +1 -1
  4. package/build/base-control/styles/base-control-styles.js +8 -8
  5. package/build/base-control/styles/base-control-styles.js.map +1 -1
  6. package/build/border-control/styles.js +17 -25
  7. package/build/border-control/styles.js.map +1 -1
  8. package/build/box-control/all-input-control.js +2 -27
  9. package/build/box-control/all-input-control.js.map +1 -1
  10. package/build/box-control/index.js +10 -5
  11. package/build/box-control/index.js.map +1 -1
  12. package/build/box-control/styles/box-control-styles.js +17 -9
  13. package/build/box-control/styles/box-control-styles.js.map +1 -1
  14. package/build/box-control/utils.js +35 -0
  15. package/build/box-control/utils.js.map +1 -1
  16. package/build/color-picker/styles.js +10 -8
  17. package/build/color-picker/styles.js.map +1 -1
  18. package/build/combobox-control/index.js +14 -6
  19. package/build/combobox-control/index.js.map +1 -1
  20. package/build/custom-select-control/index.js +3 -1
  21. package/build/custom-select-control/index.js.map +1 -1
  22. package/build/date-time/time/index.js +6 -2
  23. package/build/date-time/time/index.js.map +1 -1
  24. package/build/date-time/time/styles.js +17 -24
  25. package/build/date-time/time/styles.js.map +1 -1
  26. package/build/external-link/index.js +6 -0
  27. package/build/external-link/index.js.map +1 -1
  28. package/build/flex/flex/component.js +9 -9
  29. package/build/flex/flex/component.js.map +1 -1
  30. package/build/flex/flex/hook.js +6 -16
  31. package/build/flex/flex/hook.js.map +1 -1
  32. package/build/flex/flex/index.js.map +1 -1
  33. package/build/flex/flex-block/component.js +9 -9
  34. package/build/flex/flex-block/component.js.map +1 -1
  35. package/build/flex/flex-block/hook.js +0 -4
  36. package/build/flex/flex-block/hook.js.map +1 -1
  37. package/build/flex/flex-block/index.js.map +1 -1
  38. package/build/flex/flex-item/component.js +9 -9
  39. package/build/flex/flex-item/component.js.map +1 -1
  40. package/build/flex/flex-item/hook.js +1 -5
  41. package/build/flex/flex-item/hook.js.map +1 -1
  42. package/build/flex/flex-item/index.js.map +1 -1
  43. package/build/flex/index.js.map +1 -1
  44. package/build/flex/styles.js +5 -5
  45. package/build/flex/styles.js.map +1 -1
  46. package/build/focal-point-picker/styles/focal-point-picker-style.js +22 -22
  47. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  48. package/build/focal-point-picker/styles/focal-point-style.js +5 -5
  49. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  50. package/build/font-size-picker/index.js +15 -6
  51. package/build/font-size-picker/index.js.map +1 -1
  52. package/build/form-token-field/index.js +6 -2
  53. package/build/form-token-field/index.js.map +1 -1
  54. package/build/form-token-field/suggestions-list.js +19 -6
  55. package/build/form-token-field/suggestions-list.js.map +1 -1
  56. package/build/index.js +7 -1
  57. package/build/index.js.map +1 -1
  58. package/build/input-control/input-base.js +1 -2
  59. package/build/input-control/input-base.js.map +1 -1
  60. package/build/input-control/reducer/actions.js +3 -1
  61. package/build/input-control/reducer/actions.js.map +1 -1
  62. package/build/input-control/reducer/reducer.js +28 -11
  63. package/build/input-control/reducer/reducer.js.map +1 -1
  64. package/build/input-control/reducer/state.js.map +1 -1
  65. package/build/input-control/styles/input-control-styles.js +26 -26
  66. package/build/input-control/styles/input-control-styles.js.map +1 -1
  67. package/build/mobile/global-styles-context/utils.native.js +23 -3
  68. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  69. package/build/mobile/image/index.native.js +23 -2
  70. package/build/mobile/image/index.native.js.map +1 -1
  71. package/build/mobile/link-picker/link-picker-screen.native.js +10 -4
  72. package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  73. package/build/mobile/picker/index.ios.js +16 -3
  74. package/build/mobile/picker/index.ios.js.map +1 -1
  75. package/build/placeholder/index.js +11 -14
  76. package/build/placeholder/index.js.map +1 -1
  77. package/build/placeholder/types.js +6 -0
  78. package/build/placeholder/types.js.map +1 -0
  79. package/build/popover/index.js +113 -62
  80. package/build/popover/index.js.map +1 -1
  81. package/build/range-control/styles/range-control-styles.js +40 -40
  82. package/build/range-control/styles/range-control-styles.js.map +1 -1
  83. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  84. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  85. package/build/select-control/styles/select-control-styles.js +6 -6
  86. package/build/select-control/styles/select-control-styles.js.map +1 -1
  87. package/build/style-provider/index.js +10 -7
  88. package/build/style-provider/index.js.map +1 -1
  89. package/build/style-provider/types.js +6 -0
  90. package/build/style-provider/types.js.map +1 -0
  91. package/build/swatch/index.js +2 -0
  92. package/build/swatch/index.js.map +1 -1
  93. package/build/swatch/types.js +6 -0
  94. package/build/swatch/types.js.map +1 -0
  95. package/build/text/hook.js +5 -8
  96. package/build/text/hook.js.map +1 -1
  97. package/build/tools-panel/styles.js +13 -10
  98. package/build/tools-panel/styles.js.map +1 -1
  99. package/build/tools-panel/tools-panel/hook.js +1 -1
  100. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  101. package/build/ui/tooltip/styles.js +4 -4
  102. package/build/ui/tooltip/styles.js.map +1 -1
  103. package/build/unit-control/styles/unit-control-styles.js +34 -9
  104. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  105. package/build/utils/base-label.js +24 -0
  106. package/build/utils/base-label.js.map +1 -0
  107. package/build/utils/box-sizing.js +22 -0
  108. package/build/utils/box-sizing.js.map +1 -0
  109. package/build/utils/style-mixins.js +16 -0
  110. package/build/utils/style-mixins.js.map +1 -1
  111. package/build-module/base-control/index.js +7 -5
  112. package/build-module/base-control/index.js.map +1 -1
  113. package/build-module/base-control/styles/base-control-styles.js +9 -9
  114. package/build-module/base-control/styles/base-control-styles.js.map +1 -1
  115. package/build-module/border-control/styles.js +18 -26
  116. package/build-module/border-control/styles.js.map +1 -1
  117. package/build-module/box-control/all-input-control.js +3 -28
  118. package/build-module/box-control/all-input-control.js.map +1 -1
  119. package/build-module/box-control/index.js +4 -4
  120. package/build-module/box-control/index.js.map +1 -1
  121. package/build-module/box-control/styles/box-control-styles.js +18 -10
  122. package/build-module/box-control/styles/box-control-styles.js.map +1 -1
  123. package/build-module/box-control/utils.js +33 -0
  124. package/build-module/box-control/utils.js.map +1 -1
  125. package/build-module/color-picker/styles.js +9 -8
  126. package/build-module/color-picker/styles.js.map +1 -1
  127. package/build-module/combobox-control/index.js +13 -6
  128. package/build-module/combobox-control/index.js.map +1 -1
  129. package/build-module/custom-select-control/index.js +2 -1
  130. package/build-module/custom-select-control/index.js.map +1 -1
  131. package/build-module/date-time/time/index.js +6 -3
  132. package/build-module/date-time/time/index.js.map +1 -1
  133. package/build-module/date-time/time/styles.js +15 -21
  134. package/build-module/date-time/time/styles.js.map +1 -1
  135. package/build-module/external-link/index.js +6 -0
  136. package/build-module/external-link/index.js.map +1 -1
  137. package/build-module/flex/flex/component.js +9 -9
  138. package/build-module/flex/flex/component.js.map +1 -1
  139. package/build-module/flex/flex/hook.js +6 -15
  140. package/build-module/flex/flex/hook.js.map +1 -1
  141. package/build-module/flex/flex/index.js.map +1 -1
  142. package/build-module/flex/flex-block/component.js +9 -9
  143. package/build-module/flex/flex-block/component.js.map +1 -1
  144. package/build-module/flex/flex-block/hook.js +0 -4
  145. package/build-module/flex/flex-block/hook.js.map +1 -1
  146. package/build-module/flex/flex-block/index.js.map +1 -1
  147. package/build-module/flex/flex-item/component.js +9 -9
  148. package/build-module/flex/flex-item/component.js.map +1 -1
  149. package/build-module/flex/flex-item/hook.js +1 -5
  150. package/build-module/flex/flex-item/hook.js.map +1 -1
  151. package/build-module/flex/flex-item/index.js.map +1 -1
  152. package/build-module/flex/index.js.map +1 -1
  153. package/build-module/flex/styles.js +5 -5
  154. package/build-module/flex/styles.js.map +1 -1
  155. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +22 -22
  156. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  157. package/build-module/focal-point-picker/styles/focal-point-style.js +5 -5
  158. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  159. package/build-module/font-size-picker/index.js +14 -6
  160. package/build-module/font-size-picker/index.js.map +1 -1
  161. package/build-module/form-token-field/index.js +5 -2
  162. package/build-module/form-token-field/index.js.map +1 -1
  163. package/build-module/form-token-field/suggestions-list.js +19 -6
  164. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  165. package/build-module/index.js +1 -1
  166. package/build-module/index.js.map +1 -1
  167. package/build-module/input-control/input-base.js +1 -2
  168. package/build-module/input-control/input-base.js.map +1 -1
  169. package/build-module/input-control/reducer/actions.js +1 -0
  170. package/build-module/input-control/reducer/actions.js.map +1 -1
  171. package/build-module/input-control/reducer/reducer.js +28 -11
  172. package/build-module/input-control/reducer/reducer.js.map +1 -1
  173. package/build-module/input-control/reducer/state.js.map +1 -1
  174. package/build-module/input-control/styles/input-control-styles.js +27 -27
  175. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  176. package/build-module/mobile/global-styles-context/utils.native.js +23 -4
  177. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  178. package/build-module/mobile/image/index.native.js +25 -4
  179. package/build-module/mobile/image/index.native.js.map +1 -1
  180. package/build-module/mobile/link-picker/link-picker-screen.native.js +11 -4
  181. package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  182. package/build-module/mobile/picker/index.ios.js +14 -3
  183. package/build-module/mobile/picker/index.ios.js.map +1 -1
  184. package/build-module/placeholder/index.js +10 -15
  185. package/build-module/placeholder/index.js.map +1 -1
  186. package/build-module/placeholder/types.js +2 -0
  187. package/build-module/placeholder/types.js.map +1 -0
  188. package/build-module/popover/index.js +112 -62
  189. package/build-module/popover/index.js.map +1 -1
  190. package/build-module/range-control/styles/range-control-styles.js +40 -40
  191. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  192. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  193. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  194. package/build-module/select-control/styles/select-control-styles.js +6 -6
  195. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  196. package/build-module/style-provider/index.js +10 -5
  197. package/build-module/style-provider/index.js.map +1 -1
  198. package/build-module/style-provider/types.js +2 -0
  199. package/build-module/style-provider/types.js.map +1 -0
  200. package/build-module/swatch/index.js +2 -0
  201. package/build-module/swatch/index.js.map +1 -1
  202. package/build-module/swatch/types.js +2 -0
  203. package/build-module/swatch/types.js.map +1 -0
  204. package/build-module/text/hook.js +5 -7
  205. package/build-module/text/hook.js.map +1 -1
  206. package/build-module/tools-panel/styles.js +12 -11
  207. package/build-module/tools-panel/styles.js.map +1 -1
  208. package/build-module/tools-panel/tools-panel/hook.js +1 -1
  209. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  210. package/build-module/ui/tooltip/styles.js +4 -4
  211. package/build-module/ui/tooltip/styles.js.map +1 -1
  212. package/build-module/unit-control/styles/unit-control-styles.js +35 -9
  213. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  214. package/build-module/utils/base-label.js +18 -0
  215. package/build-module/utils/base-label.js.map +1 -0
  216. package/build-module/utils/box-sizing.js +16 -0
  217. package/build-module/utils/box-sizing.js.map +1 -0
  218. package/build-module/utils/style-mixins.js +2 -0
  219. package/build-module/utils/style-mixins.js.map +1 -1
  220. package/build-style/style-rtl.css +50 -30
  221. package/build-style/style.css +52 -30
  222. package/build-types/base-control/index.d.ts +4 -3
  223. package/build-types/base-control/index.d.ts.map +1 -1
  224. package/build-types/base-control/stories/index.d.ts +1 -1
  225. package/build-types/base-control/stories/index.d.ts.map +1 -1
  226. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  227. package/build-types/base-control/types.d.ts +0 -1
  228. package/build-types/base-control/types.d.ts.map +1 -1
  229. package/build-types/border-control/styles.d.ts.map +1 -1
  230. package/build-types/color-picker/color-display.d.ts +13 -0
  231. package/build-types/color-picker/color-display.d.ts.map +1 -0
  232. package/build-types/color-picker/styles.d.ts.map +1 -1
  233. package/build-types/date-time/time/index.d.ts.map +1 -1
  234. package/build-types/date-time/time/styles.d.ts +0 -4
  235. package/build-types/date-time/time/styles.d.ts.map +1 -1
  236. package/build-types/external-link/index.d.ts.map +1 -1
  237. package/build-types/flex/flex/component.d.ts +5 -4
  238. package/build-types/flex/flex/component.d.ts.map +1 -1
  239. package/build-types/flex/flex/hook.d.ts +5 -2
  240. package/build-types/flex/flex/hook.d.ts.map +1 -1
  241. package/build-types/flex/flex/index.d.ts +2 -2
  242. package/build-types/flex/flex/index.d.ts.map +1 -1
  243. package/build-types/flex/flex-block/component.d.ts +5 -4
  244. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  245. package/build-types/flex/flex-block/hook.d.ts +6 -3
  246. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  247. package/build-types/flex/flex-block/index.d.ts +2 -2
  248. package/build-types/flex/flex-block/index.d.ts.map +1 -1
  249. package/build-types/flex/flex-item/component.d.ts +5 -4
  250. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  251. package/build-types/flex/flex-item/hook.d.ts +6 -3
  252. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  253. package/build-types/flex/flex-item/index.d.ts +2 -2
  254. package/build-types/flex/flex-item/index.d.ts.map +1 -1
  255. package/build-types/flex/index.d.ts +3 -3
  256. package/build-types/flex/index.d.ts.map +1 -1
  257. package/build-types/flex/stories/index.d.ts +13 -0
  258. package/build-types/flex/stories/index.d.ts.map +1 -0
  259. package/build-types/flex/styles.d.ts +5 -5
  260. package/build-types/flex/styles.d.ts.map +1 -1
  261. package/build-types/flex/test/index.d.ts +2 -0
  262. package/build-types/flex/test/index.d.ts.map +1 -0
  263. package/build-types/flex/types.d.ts +15 -11
  264. package/build-types/flex/types.d.ts.map +1 -1
  265. package/build-types/flyout/context.d.ts +6 -0
  266. package/build-types/flyout/context.d.ts.map +1 -0
  267. package/build-types/flyout/flyout/component.d.ts +21 -0
  268. package/build-types/flyout/flyout/component.d.ts.map +1 -0
  269. package/build-types/flyout/flyout/hook.d.ts +270 -0
  270. package/build-types/flyout/flyout/hook.d.ts.map +1 -0
  271. package/build-types/flyout/flyout/index.d.ts +3 -0
  272. package/build-types/flyout/flyout/index.d.ts.map +1 -0
  273. package/build-types/flyout/flyout-content/component.d.ts +3 -0
  274. package/build-types/flyout/flyout-content/component.d.ts.map +1 -0
  275. package/build-types/flyout/flyout-content/index.d.ts +2 -0
  276. package/build-types/flyout/flyout-content/index.d.ts.map +1 -0
  277. package/build-types/flyout/index.d.ts +2 -0
  278. package/build-types/flyout/index.d.ts.map +1 -0
  279. package/build-types/flyout/styles.d.ts +22 -0
  280. package/build-types/flyout/styles.d.ts.map +1 -0
  281. package/build-types/flyout/types.d.ts +80 -0
  282. package/build-types/flyout/types.d.ts.map +1 -0
  283. package/build-types/flyout/utils.d.ts +8 -0
  284. package/build-types/flyout/utils.d.ts.map +1 -0
  285. package/build-types/form-token-field/index.d.ts.map +1 -1
  286. package/build-types/form-token-field/stories/index.d.ts +6 -0
  287. package/build-types/form-token-field/stories/index.d.ts.map +1 -1
  288. package/build-types/form-token-field/suggestions-list.d.ts +1 -1
  289. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  290. package/build-types/form-token-field/types.d.ts +15 -3
  291. package/build-types/form-token-field/types.d.ts.map +1 -1
  292. package/build-types/input-control/input-base.d.ts.map +1 -1
  293. package/build-types/input-control/reducer/actions.d.ts +3 -1
  294. package/build-types/input-control/reducer/actions.d.ts.map +1 -1
  295. package/build-types/input-control/reducer/reducer.d.ts +2 -2
  296. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  297. package/build-types/input-control/reducer/state.d.ts +2 -2
  298. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  299. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  300. package/build-types/placeholder/index.d.ts +16 -0
  301. package/build-types/placeholder/index.d.ts.map +1 -0
  302. package/build-types/placeholder/stories/index.d.ts +12 -0
  303. package/build-types/placeholder/stories/index.d.ts.map +1 -0
  304. package/build-types/placeholder/types.d.ts +47 -0
  305. package/build-types/placeholder/types.d.ts.map +1 -0
  306. package/build-types/popover/index.d.ts +1 -1
  307. package/build-types/popover/index.d.ts.map +1 -1
  308. package/build-types/popover/utils.d.ts +70 -0
  309. package/build-types/popover/utils.d.ts.map +1 -0
  310. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  311. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  312. package/build-types/style-provider/index.d.ts +7 -4
  313. package/build-types/style-provider/index.d.ts.map +1 -1
  314. package/build-types/style-provider/types.d.ts +15 -0
  315. package/build-types/style-provider/types.d.ts.map +1 -0
  316. package/build-types/swatch/index.d.ts +5 -0
  317. package/build-types/swatch/index.d.ts.map +1 -0
  318. package/build-types/swatch/types.d.ts +11 -0
  319. package/build-types/swatch/types.d.ts.map +1 -0
  320. package/build-types/text/hook.d.ts.map +1 -1
  321. package/build-types/tools-panel/styles.d.ts +1 -1
  322. package/build-types/tools-panel/styles.d.ts.map +1 -1
  323. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  324. package/build-types/ui/tooltip/styles.d.ts.map +1 -1
  325. package/build-types/unit-control/index.d.ts +1 -1
  326. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  327. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  328. package/build-types/unit-control/types.d.ts +1 -7
  329. package/build-types/unit-control/types.d.ts.map +1 -1
  330. package/build-types/utils/base-label.d.ts +2 -0
  331. package/build-types/utils/base-label.d.ts.map +1 -0
  332. package/build-types/utils/box-sizing.d.ts +2 -0
  333. package/build-types/utils/box-sizing.d.ts.map +1 -0
  334. package/build-types/utils/hooks/use-combined-ref.d.ts +8 -0
  335. package/build-types/utils/hooks/use-combined-ref.d.ts.map +1 -0
  336. package/build-types/utils/style-mixins.d.ts +2 -0
  337. package/package.json +17 -17
  338. package/src/base-control/index.tsx +5 -3
  339. package/src/base-control/stories/index.tsx +1 -0
  340. package/src/base-control/styles/base-control-styles.ts +9 -5
  341. package/src/base-control/types.ts +0 -1
  342. package/src/border-control/styles.ts +2 -1
  343. package/src/box-control/all-input-control.js +3 -27
  344. package/src/box-control/index.js +5 -6
  345. package/src/box-control/styles/box-control-styles.js +1 -2
  346. package/src/box-control/utils.js +32 -0
  347. package/src/color-picker/styles.ts +3 -0
  348. package/src/combobox-control/README.md +7 -0
  349. package/src/combobox-control/index.js +14 -4
  350. package/src/combobox-control/stories/index.js +49 -5
  351. package/src/custom-gradient-picker/style.scss +0 -12
  352. package/src/custom-select-control/index.js +3 -2
  353. package/src/custom-select-control/style.scss +1 -5
  354. package/src/date-time/time/index.tsx +7 -5
  355. package/src/date-time/time/styles.ts +3 -6
  356. package/src/external-link/index.tsx +10 -0
  357. package/src/flex/flex/README.md +19 -13
  358. package/src/flex/flex/{component.js → component.tsx} +15 -10
  359. package/src/flex/flex/{hook.js → hook.ts} +14 -13
  360. package/src/flex/flex/{index.js → index.ts} +0 -0
  361. package/src/flex/flex-block/README.md +3 -3
  362. package/src/flex/flex-block/{component.js → component.tsx} +15 -10
  363. package/src/flex/flex-block/{hook.js → hook.ts} +5 -5
  364. package/src/flex/flex-block/{index.js → index.ts} +0 -0
  365. package/src/flex/flex-item/README.md +6 -5
  366. package/src/flex/flex-item/{component.js → component.tsx} +15 -10
  367. package/src/flex/flex-item/{hook.js → hook.ts} +10 -7
  368. package/src/flex/flex-item/{index.js → index.ts} +0 -0
  369. package/src/flex/{index.js → index.ts} +0 -0
  370. package/src/flex/stories/index.tsx +81 -0
  371. package/src/flex/{styles.js → styles.ts} +0 -0
  372. package/src/flex/test/__snapshots__/{index.js.snap → index.tsx.snap} +49 -9
  373. package/src/flex/test/index.tsx +84 -0
  374. package/src/flex/types.ts +15 -11
  375. package/src/focal-point-picker/styles/focal-point-picker-style.js +0 -5
  376. package/src/focal-point-picker/styles/focal-point-style.js +0 -1
  377. package/src/font-size-picker/index.js +18 -7
  378. package/src/font-size-picker/stories/index.js +6 -0
  379. package/src/form-token-field/README.md +2 -1
  380. package/src/form-token-field/index.tsx +5 -2
  381. package/src/form-token-field/stories/index.tsx +14 -0
  382. package/src/form-token-field/style.scss +0 -5
  383. package/src/form-token-field/suggestions-list.tsx +21 -12
  384. package/src/form-token-field/types.ts +16 -2
  385. package/src/index.js +4 -1
  386. package/src/input-control/input-base.tsx +0 -1
  387. package/src/input-control/reducer/actions.ts +3 -1
  388. package/src/input-control/reducer/reducer.ts +27 -10
  389. package/src/input-control/reducer/state.ts +7 -2
  390. package/src/input-control/styles/input-control-styles.tsx +3 -1
  391. package/src/input-control/test/index.js +20 -4
  392. package/src/mobile/global-styles-context/utils.native.js +21 -4
  393. package/src/mobile/image/index.native.js +27 -2
  394. package/src/mobile/link-picker/link-picker-screen.native.js +12 -4
  395. package/src/mobile/picker/index.ios.js +16 -0
  396. package/src/mobile/picker/styles.native.scss +8 -0
  397. package/src/panel/style.scss +4 -1
  398. package/src/placeholder/README.md +49 -9
  399. package/src/placeholder/{index.js → index.tsx} +27 -23
  400. package/src/placeholder/stories/index.tsx +64 -0
  401. package/src/placeholder/style.scss +0 -4
  402. package/src/placeholder/types.ts +48 -0
  403. package/src/popover/README.md +7 -0
  404. package/src/popover/index.js +144 -70
  405. package/src/popover/stories/index.js +199 -98
  406. package/src/popover/style.scss +60 -6
  407. package/src/popover/test/index.js +23 -1
  408. package/src/range-control/styles/range-control-styles.ts +0 -12
  409. package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +1 -1
  410. package/src/select-control/styles/select-control-styles.ts +0 -1
  411. package/src/style-provider/index.tsx +41 -0
  412. package/src/style-provider/types.ts +15 -0
  413. package/src/swatch/{index.js → index.tsx} +4 -1
  414. package/src/swatch/types.ts +11 -0
  415. package/src/text/hook.js +5 -3
  416. package/src/toggle-group-control/test/__snapshots__/index.js.snap +24 -0
  417. package/src/tools-panel/styles.ts +7 -16
  418. package/src/tools-panel/test/__snapshots__/index.js.snap +2 -11
  419. package/src/tools-panel/tools-panel/hook.ts +6 -1
  420. package/src/ui/tooltip/styles.js +1 -0
  421. package/src/ui/tooltip/test/__snapshots__/index.js.snap +1 -0
  422. package/src/unit-control/stories/index.tsx +16 -23
  423. package/src/unit-control/styles/unit-control-styles.ts +93 -41
  424. package/src/unit-control/types.ts +1 -7
  425. package/src/utils/base-label.ts +13 -0
  426. package/src/utils/box-sizing.ts +14 -0
  427. package/src/utils/style-mixins.js +2 -0
  428. package/tsconfig.json +2 -0
  429. package/tsconfig.tsbuildinfo +1 -1
  430. package/src/flex/stories/index.js +0 -29
  431. package/src/flex/test/index.js +0 -77
  432. package/src/placeholder/stories/index.js +0 -44
  433. package/src/popover/stories/_utils.js +0 -64
  434. package/src/style-provider/index.js +0 -31
@@ -29,22 +29,18 @@ const PlaceholderIllustration = createElement(SVG, {
29
29
  /**
30
30
  * Renders a placeholder. Normally used by blocks to render their empty state.
31
31
  *
32
- * @param {Object} props The component props.
33
- * @param {WPIcon} props.icon An icon rendered before the label.
34
- * @param {WPElement} props.children Children to be rendered.
35
- * @param {string} props.label Title of the placeholder.
36
- * @param {string} props.instructions Instructions of the placeholder.
37
- * @param {string} props.className Class to set on the container div.
38
- * @param {Object} props.notices A rendered notices list.
39
- * @param {Object} props.preview Preview to be rendered in the placeholder.
40
- * @param {boolean} props.isColumnLayout Whether a column layout should be used.
41
- * @param {boolean} props.withIllustration Whether to add an illustration to the placeholder.
32
+ * ```jsx
33
+ * import { Placeholder } from '@wordpress/components';
34
+ * import { more } from '@wordpress/icons';
42
35
  *
43
- * @return {Object} The rendered placeholder.
36
+ * const MyPlaceholder = () => <Placeholder icon={ more } label="Placeholder" />;
37
+ * ```
44
38
  */
45
39
 
46
- function Placeholder(_ref) {
47
- let {
40
+ export function Placeholder( // ref is omitted until we have `WordPressComponentPropsWithoutRef` or add
41
+ // ref forwarding to Placeholder.
42
+ props) {
43
+ const {
48
44
  icon,
49
45
  children,
50
46
  label,
@@ -55,7 +51,7 @@ function Placeholder(_ref) {
55
51
  isColumnLayout,
56
52
  withIllustration,
57
53
  ...additionalProps
58
- } = _ref;
54
+ } = props;
59
55
  const [resizeListener, {
60
56
  width
61
57
  }] = useResizeObserver(); // Since `useResizeObserver` will report a width of `null` until after the
@@ -89,6 +85,5 @@ function Placeholder(_ref) {
89
85
  className: "components-placeholder__instructions"
90
86
  }, instructions), children));
91
87
  }
92
-
93
88
  export default Placeholder;
94
89
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/placeholder/index.js"],"names":["classnames","useResizeObserver","SVG","Path","Icon","PlaceholderIllustration","Placeholder","icon","children","label","instructions","className","notices","preview","isColumnLayout","withIllustration","additionalProps","resizeListener","width","modifierClassNames","classes","fieldsetClasses"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,oBAAlC;AACA,SAASC,GAAT,EAAcC,IAAd,QAA0B,uBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,SAAjB;AAEA,MAAMC,uBAAuB,GAC5B,cAAC,GAAD;AACC,EAAA,SAAS,EAAC,sCADX;AAEC,EAAA,IAAI,EAAC,MAFN;AAGC,EAAA,KAAK,EAAC,4BAHP;AAIC,EAAA,OAAO,EAAC,WAJT;AAKC,EAAA,mBAAmB,EAAC;AALrB,GAOC,cAAC,IAAD;AAAM,EAAA,YAAY,EAAC,oBAAnB;AAAwC,EAAA,CAAC,EAAC;AAA1C,EAPD,CADD;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,WAAT,OAWI;AAAA,MAXkB;AACrBC,IAAAA,IADqB;AAErBC,IAAAA,QAFqB;AAGrBC,IAAAA,KAHqB;AAIrBC,IAAAA,YAJqB;AAKrBC,IAAAA,SALqB;AAMrBC,IAAAA,OANqB;AAOrBC,IAAAA,OAPqB;AAQrBC,IAAAA,cARqB;AASrBC,IAAAA,gBATqB;AAUrB,OAAGC;AAVkB,GAWlB;AACH,QAAM,CAAEC,cAAF,EAAkB;AAAEC,IAAAA;AAAF,GAAlB,IAAgCjB,iBAAiB,EAAvD,CADG,CAGH;AACA;;AACA,MAAIkB,kBAAJ;;AACA,MAAK,OAAOD,KAAP,KAAiB,QAAtB,EAAiC;AAChCC,IAAAA,kBAAkB,GAAG;AACpB,kBAAYD,KAAK,IAAI,GADD;AAEpB,mBAAaA,KAAK,IAAI,GAAT,IAAgBA,KAAK,GAAG,GAFjB;AAGpB,kBAAYA,KAAK,GAAG;AAHA,KAArB;AAKA;;AAED,QAAME,OAAO,GAAGpB,UAAU,CACzB,wBADyB,EAEzBW,SAFyB,EAGzBQ,kBAHyB,EAIzBJ,gBAAgB,GAAG,kBAAH,GAAwB,IAJf,CAA1B;AAMA,QAAMM,eAAe,GAAGrB,UAAU,CAAE,kCAAF,EAAsC;AACvE,wBAAoBc;AADmD,GAAtC,CAAlC;AAGA,SACC,kCAAUE,eAAV;AAA4B,IAAA,SAAS,EAAGI;AAAxC,MACGL,gBAAgB,GAAGV,uBAAH,GAA6B,IADhD,EAEGY,cAFH,EAGGL,OAHH,EAIGC,OAAO,IACR;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,OADH,CALF,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGN;AAAb,IADD,EAEGE,KAFH,CATD,EAaC;AAAU,IAAA,SAAS,EAAGY;AAAtB,KACG,CAAC,CAAEX,YAAH,IACD;AAAQ,IAAA,SAAS,EAAC;AAAlB,KACGA,YADH,CAFF,EAMGF,QANH,CAbD,CADD;AAwBA;;AAED,eAAeF,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useResizeObserver } from '@wordpress/compose';\nimport { SVG, Path } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\n\nconst PlaceholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\n/**\n * Renders a placeholder. Normally used by blocks to render their empty state.\n *\n * @param {Object} props The component props.\n * @param {WPIcon} props.icon An icon rendered before the label.\n * @param {WPElement} props.children Children to be rendered.\n * @param {string} props.label Title of the placeholder.\n * @param {string} props.instructions Instructions of the placeholder.\n * @param {string} props.className Class to set on the container div.\n * @param {Object} props.notices A rendered notices list.\n * @param {Object} props.preview Preview to be rendered in the placeholder.\n * @param {boolean} props.isColumnLayout Whether a column layout should be used.\n * @param {boolean} props.withIllustration Whether to add an illustration to the placeholder.\n *\n * @return {Object} The rendered placeholder.\n */\nfunction Placeholder( {\n\ticon,\n\tchildren,\n\tlabel,\n\tinstructions,\n\tclassName,\n\tnotices,\n\tpreview,\n\tisColumnLayout,\n\twithIllustration,\n\t...additionalProps\n} ) {\n\tconst [ resizeListener, { width } ] = useResizeObserver();\n\n\t// Since `useResizeObserver` will report a width of `null` until after the\n\t// first render, avoid applying any modifier classes until width is known.\n\tlet modifierClassNames;\n\tif ( typeof width === 'number' ) {\n\t\tmodifierClassNames = {\n\t\t\t'is-large': width >= 480,\n\t\t\t'is-medium': width >= 160 && width < 480,\n\t\t\t'is-small': width < 160,\n\t\t};\n\t}\n\n\tconst classes = classnames(\n\t\t'components-placeholder',\n\t\tclassName,\n\t\tmodifierClassNames,\n\t\twithIllustration ? 'has-illustration' : null\n\t);\n\tconst fieldsetClasses = classnames( 'components-placeholder__fieldset', {\n\t\t'is-column-layout': isColumnLayout,\n\t} );\n\treturn (\n\t\t<div { ...additionalProps } className={ classes }>\n\t\t\t{ withIllustration ? PlaceholderIllustration : null }\n\t\t\t{ resizeListener }\n\t\t\t{ notices }\n\t\t\t{ preview && (\n\t\t\t\t<div className=\"components-placeholder__preview\">\n\t\t\t\t\t{ preview }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-placeholder__label\">\n\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t{ label }\n\t\t\t</div>\n\t\t\t<fieldset className={ fieldsetClasses }>\n\t\t\t\t{ !! instructions && (\n\t\t\t\t\t<legend className=\"components-placeholder__instructions\">\n\t\t\t\t\t\t{ instructions }\n\t\t\t\t\t</legend>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t</fieldset>\n\t\t</div>\n\t);\n}\n\nexport default Placeholder;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/placeholder/index.tsx"],"names":["classnames","useResizeObserver","SVG","Path","Icon","PlaceholderIllustration","Placeholder","props","icon","children","label","instructions","className","notices","preview","isColumnLayout","withIllustration","additionalProps","resizeListener","width","modifierClassNames","classes","fieldsetClasses"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,oBAAlC;AACA,SAASC,GAAT,EAAcC,IAAd,QAA0B,uBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,SAAjB;AAIA,MAAMC,uBAAuB,GAC5B,cAAC,GAAD;AACC,EAAA,SAAS,EAAC,sCADX;AAEC,EAAA,IAAI,EAAC,MAFN;AAGC,EAAA,KAAK,EAAC,4BAHP;AAIC,EAAA,OAAO,EAAC,WAJT;AAKC,EAAA,mBAAmB,EAAC;AALrB,GAOC,cAAC,IAAD;AAAM,EAAA,YAAY,EAAC,oBAAnB;AAAwC,EAAA,CAAC,EAAC;AAA1C,EAPD,CADD;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SA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GF,QANH,CAbD,CADD;AAwBA;AAED,eAAeH,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useResizeObserver } from '@wordpress/compose';\nimport { SVG, Path } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\nimport type { PlaceholderProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst PlaceholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\n/**\n * Renders a placeholder. Normally used by blocks to render their empty state.\n *\n * ```jsx\n * import { Placeholder } from '@wordpress/components';\n * import { more } from '@wordpress/icons';\n *\n * const MyPlaceholder = () => <Placeholder icon={ more } label=\"Placeholder\" />;\n * ```\n */\nexport function Placeholder< IconProps = unknown >(\n\t// ref is omitted until we have `WordPressComponentPropsWithoutRef` or add\n\t// ref forwarding to Placeholder.\n\tprops: Omit<\n\t\tWordPressComponentProps< PlaceholderProps< IconProps >, 'div', false >,\n\t\t'ref'\n\t>\n) {\n\tconst {\n\t\ticon,\n\t\tchildren,\n\t\tlabel,\n\t\tinstructions,\n\t\tclassName,\n\t\tnotices,\n\t\tpreview,\n\t\tisColumnLayout,\n\t\twithIllustration,\n\t\t...additionalProps\n\t} = props;\n\tconst [ resizeListener, { width } ] = useResizeObserver();\n\n\t// Since `useResizeObserver` will report a width of `null` until after the\n\t// first render, avoid applying any modifier classes until width is known.\n\tlet modifierClassNames;\n\tif ( typeof width === 'number' ) {\n\t\tmodifierClassNames = {\n\t\t\t'is-large': width >= 480,\n\t\t\t'is-medium': width >= 160 && width < 480,\n\t\t\t'is-small': width < 160,\n\t\t};\n\t}\n\n\tconst classes = classnames(\n\t\t'components-placeholder',\n\t\tclassName,\n\t\tmodifierClassNames,\n\t\twithIllustration ? 'has-illustration' : null\n\t);\n\tconst fieldsetClasses = classnames( 'components-placeholder__fieldset', {\n\t\t'is-column-layout': isColumnLayout,\n\t} );\n\treturn (\n\t\t<div { ...additionalProps } className={ classes }>\n\t\t\t{ withIllustration ? PlaceholderIllustration : null }\n\t\t\t{ resizeListener }\n\t\t\t{ notices }\n\t\t\t{ preview && (\n\t\t\t\t<div className=\"components-placeholder__preview\">\n\t\t\t\t\t{ preview }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-placeholder__label\">\n\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t{ label }\n\t\t\t</div>\n\t\t\t<fieldset className={ fieldsetClasses }>\n\t\t\t\t{ !! instructions && (\n\t\t\t\t\t<legend className=\"components-placeholder__instructions\">\n\t\t\t\t\t\t{ instructions }\n\t\t\t\t\t</legend>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t</fieldset>\n\t\t</div>\n\t);\n}\n\nexport default Placeholder;\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -15,6 +15,7 @@ import { useRef, useLayoutEffect, forwardRef, createContext, useContext, useMemo
15
15
  import { useViewportMatch, useMergeRefs, __experimentalUseDialog as useDialog } from '@wordpress/compose';
16
16
  import { close } from '@wordpress/icons';
17
17
  import deprecated from '@wordpress/deprecated';
18
+ import { Path, SVG } from '@wordpress/primitives';
18
19
  /**
19
20
  * Internal dependencies
20
21
  */
@@ -29,7 +30,25 @@ import { getAnimateClassName } from '../animate';
29
30
  * @type {string}
30
31
  */
31
32
 
32
- const SLOT_NAME = 'Popover';
33
+ const SLOT_NAME = 'Popover'; // An SVG displaying a triangle facing down, filled with a solid
34
+ // color and bordered in such a way to create an arrow-like effect.
35
+ // Keeping the SVG's viewbox squared simplify the arrow positioning
36
+ // calculations.
37
+
38
+ const ArrowTriangle = props => createElement(SVG, _extends({}, props, {
39
+ xmlns: "http://www.w3.org/2000/svg",
40
+ viewBox: `0 0 100 100`,
41
+ className: "components-popover__triangle",
42
+ role: "presentation"
43
+ }), createElement(Path, {
44
+ className: "components-popover__triangle-bg",
45
+ d: "M 0 0 L 50 50 L 100 0"
46
+ }), createElement(Path, {
47
+ className: "components-popover__triangle-border",
48
+ d: "M 0 0 L 50 50 L 100 0",
49
+ vectorEffect: "non-scaling-stroke"
50
+ }));
51
+
33
52
  const slotNameContext = createContext();
34
53
 
35
54
  const positionToPlacement = position => {
@@ -79,7 +98,7 @@ const placementToAnimationOrigin = placement => {
79
98
  return x + ' ' + y;
80
99
  };
81
100
 
82
- const Popover = (_ref, ref) => {
101
+ const Popover = (_ref, forwardedRef) => {
83
102
  let {
84
103
  range,
85
104
  animate = true,
@@ -90,7 +109,7 @@ const Popover = (_ref, ref) => {
90
109
  noArrow = true,
91
110
  isAlternate,
92
111
  position,
93
- placement = 'bottom-start',
112
+ placement: placementProp = 'bottom-start',
94
113
  offset,
95
114
  focusOnMount = 'firstElement',
96
115
  anchorRef,
@@ -100,7 +119,7 @@ const Popover = (_ref, ref) => {
100
119
  onFocusOutside,
101
120
  __unstableSlotName = SLOT_NAME,
102
121
  __unstableObserveElement,
103
- __unstableForcePosition,
122
+ __unstableForcePosition = false,
104
123
  __unstableShift = false,
105
124
  ...contentProps
106
125
  } = _ref;
@@ -117,26 +136,30 @@ const Popover = (_ref, ref) => {
117
136
  const isMobileViewport = useViewportMatch('medium', '<');
118
137
  const isExpanded = expandOnMobile && isMobileViewport;
119
138
  const hasArrow = !isExpanded && !noArrow;
120
- const usedPlacement = position ? positionToPlacement(position) : placement;
139
+ const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp;
121
140
  const ownerDocument = useMemo(() => {
141
+ var _documentToReturn;
142
+
143
+ let documentToReturn;
144
+
122
145
  if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
123
- return anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
146
+ documentToReturn = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
124
147
  } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.startContainer) {
125
- return anchorRef.startContainer.ownerDocument;
148
+ documentToReturn = anchorRef.startContainer.ownerDocument;
126
149
  } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
127
- return anchorRef.current.ownerDocument;
150
+ documentToReturn = anchorRef.current.ownerDocument;
128
151
  } else if (anchorRef) {
129
152
  // This one should be deprecated.
130
- return anchorRef.ownerDocument;
153
+ documentToReturn = anchorRef.ownerDocument;
131
154
  } else if (anchorRect && anchorRect !== null && anchorRect !== void 0 && anchorRect.ownerDocument) {
132
- return anchorRect.ownerDocument;
155
+ documentToReturn = anchorRect.ownerDocument;
133
156
  } else if (getAnchorRect) {
134
- var _getAnchorRect$ownerD, _getAnchorRect;
157
+ var _getAnchorRect;
135
158
 
136
- return (_getAnchorRect$ownerD = (_getAnchorRect = getAnchorRect(anchorRefFallback.current)) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument) !== null && _getAnchorRect$ownerD !== void 0 ? _getAnchorRect$ownerD : document;
159
+ documentToReturn = (_getAnchorRect = getAnchorRect(anchorRefFallback.current)) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument;
137
160
  }
138
161
 
139
- return document;
162
+ return (_documentToReturn = documentToReturn) !== null && _documentToReturn !== void 0 ? _documentToReturn : document;
140
163
  }, [anchorRef, anchorRect, getAnchorRect]);
141
164
  /**
142
165
  * Offsets the position of the popover when the anchor is inside an iframe.
@@ -156,22 +179,35 @@ const Popover = (_ref, ref) => {
156
179
 
157
180
  const iframeRect = frameElement.getBoundingClientRect();
158
181
  return {
159
- name: 'iframeOffset',
160
-
161
- fn(_ref2) {
162
- let {
163
- x,
164
- y
165
- } = _ref2;
166
- return {
167
- x: x + iframeRect.left,
168
- y: y + iframeRect.top
169
- };
170
- }
171
-
182
+ x: iframeRect.left,
183
+ y: iframeRect.top
172
184
  };
173
185
  }, [ownerDocument]);
174
- const middlewares = [frameOffset, offset ? offsetMiddleware(offset) : undefined, __unstableForcePosition ? undefined : flip(), __unstableForcePosition ? undefined : size({
186
+ const middleware = [frameOffset || offset ? offsetMiddleware(_ref2 => {
187
+ let {
188
+ placement: currentPlacement
189
+ } = _ref2;
190
+
191
+ if (!frameOffset) {
192
+ return offset;
193
+ }
194
+
195
+ const isTopBottomPlacement = currentPlacement.includes('top') || currentPlacement.includes('bottom'); // The main axis should represent the gap between the
196
+ // floating element and the reference element. The cross
197
+ // axis is always perpendicular to the main axis.
198
+
199
+ const mainAxis = isTopBottomPlacement ? 'y' : 'x';
200
+ const crossAxis = mainAxis === 'x' ? 'y' : 'x'; // When the popover is before the reference, subtract the offset,
201
+ // of the main axis else add it.
202
+
203
+ const hasBeforePlacement = currentPlacement.includes('top') || currentPlacement.includes('left');
204
+ const mainAxisModifier = hasBeforePlacement ? -1 : 1;
205
+ const normalizedOffset = offset ? offset : 0;
206
+ return {
207
+ mainAxis: normalizedOffset + frameOffset[mainAxis] * mainAxisModifier,
208
+ crossAxis: frameOffset[crossAxis]
209
+ };
210
+ }) : undefined, __unstableForcePosition ? undefined : flip(), __unstableForcePosition ? undefined : size({
175
211
  apply(sizeProps) {
176
212
  const {
177
213
  height
@@ -216,35 +252,42 @@ const Popover = (_ref, ref) => {
216
252
  onClose: onDialogClose
217
253
  });
218
254
  const {
255
+ // Positioning coordinates
219
256
  x,
220
257
  y,
258
+ // Callback refs (not regular refs). This allows the position to be updated.
259
+ // when either elements change.
221
260
  reference,
222
261
  floating,
223
- strategy,
262
+ // Object with "regular" refs to both "reference" and "floating"
224
263
  refs,
264
+ // Type of CSS position property to use (absolute or fixed)
265
+ strategy,
225
266
  update,
226
- placement: placementData,
267
+ placement: computedPlacement,
227
268
  middlewareData: {
228
269
  arrow: arrowData = {}
229
270
  }
230
271
  } = useFloating({
231
- placement: usedPlacement,
232
- middleware: middlewares
233
- });
234
- const staticSide = {
235
- top: 'bottom',
236
- right: 'left',
237
- bottom: 'top',
238
- left: 'right'
239
- }[placementData.split('-')[0]];
240
- const mergedRefs = useMergeRefs([floating, dialogRef, ref]); // Updates references
272
+ placement: normalizedPlacementFromProps,
273
+ middleware
274
+ }); // Update the `reference`'s ref.
275
+ //
276
+ // In floating-ui's terms:
277
+ // - "reference" refers to the popover's anchor element.
278
+ // - "floating" refers the floating popover's element.
279
+ // A floating element can also be positioned relative to a virtual element,
280
+ // instead of a real one. A virtual element is represented by an object
281
+ // with the `getBoundingClientRect()` function (like real elements).
282
+ // See https://floating-ui.com/docs/virtual-elements for more info.
241
283
 
242
284
  useLayoutEffect(() => {
243
- // No ref or position have been passed
244
- let usedRef;
285
+ let resultingReferenceRef;
245
286
 
246
287
  if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
247
- usedRef = {
288
+ // Create a virtual element for the ref. The expectation is that
289
+ // if anchorRef.top is defined, then anchorRef.bottom is defined too.
290
+ resultingReferenceRef = {
248
291
  getBoundingClientRect() {
249
292
  const topRect = anchorRef.top.getBoundingClientRect();
250
293
  const bottomRect = anchorRef.bottom.getBoundingClientRect();
@@ -253,18 +296,23 @@ const Popover = (_ref, ref) => {
253
296
 
254
297
  };
255
298
  } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
256
- usedRef = anchorRef.current;
299
+ // Standard React ref.
300
+ resultingReferenceRef = anchorRef.current;
257
301
  } else if (anchorRef) {
258
- usedRef = anchorRef;
302
+ // If `anchorRef` holds directly the element's value (no `current` key)
303
+ // This is a weird scenario and should be deprecated.
304
+ resultingReferenceRef = anchorRef;
259
305
  } else if (anchorRect) {
260
- usedRef = {
306
+ // Create a virtual element for the ref.
307
+ resultingReferenceRef = {
261
308
  getBoundingClientRect() {
262
309
  return anchorRect;
263
310
  }
264
311
 
265
312
  };
266
313
  } else if (getAnchorRect) {
267
- usedRef = {
314
+ // Create a virtual element for the ref.
315
+ resultingReferenceRef = {
268
316
  getBoundingClientRect() {
269
317
  var _rect$x, _rect$y, _rect$width, _rect$height;
270
318
 
@@ -274,21 +322,23 @@ const Popover = (_ref, ref) => {
274
322
 
275
323
  };
276
324
  } else if (anchorRefFallback.current) {
277
- usedRef = anchorRefFallback.current;
325
+ // If no explicit ref is passed via props, fall back to
326
+ // anchoring to the popover's parent node.
327
+ resultingReferenceRef = anchorRefFallback.current.parentNode;
278
328
  }
279
329
 
280
- if (!usedRef) {
330
+ if (!resultingReferenceRef) {
281
331
  return;
282
332
  }
283
333
 
284
- reference(usedRef);
334
+ reference(resultingReferenceRef);
285
335
 
286
336
  if (!refs.floating.current) {
287
337
  return;
288
338
  }
289
339
 
290
- return autoUpdate(usedRef, refs.floating.current, update);
291
- }, [anchorRef, anchorRect, getAnchorRect]); // This is only needed for a smoth transition when moving blocks.
340
+ return autoUpdate(resultingReferenceRef, refs.floating.current, update);
341
+ }, [anchorRef, anchorRect, getAnchorRect]); // This is only needed for a smooth transition when moving blocks.
292
342
 
293
343
  useLayoutEffect(() => {
294
344
  if (!__unstableObserveElement) {
@@ -302,7 +352,9 @@ const Popover = (_ref, ref) => {
302
352
  return () => {
303
353
  observer.disconnect();
304
354
  };
305
- }, [__unstableObserveElement]); // If we're using getAnchorRect, we need to update the position as we scroll the iframe.
355
+ }, [__unstableObserveElement]); // If the reference element is in a different ownerDocument (e.g. iFrame),
356
+ // we need to manually update the floating's position as the reference's owner
357
+ // document scrolls.
306
358
 
307
359
  useLayoutEffect(() => {
308
360
  if (ownerDocument === document) {
@@ -316,8 +368,9 @@ const Popover = (_ref, ref) => {
316
368
 
317
369
  const animateClassName = !!animate && getAnimateClassName({
318
370
  type: 'appear',
319
- origin: placementToAnimationOrigin(placementData)
320
- }); // Disable reason: We care to capture the _bubbled_ events from inputs
371
+ origin: placementToAnimationOrigin(computedPlacement)
372
+ });
373
+ const mergedFloatingRef = useMergeRefs([floating, dialogRef, forwardedRef]); // Disable reason: We care to capture the _bubbled_ events from inputs
321
374
  // within popover as inferring close intent.
322
375
 
323
376
  let content = // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
@@ -328,7 +381,7 @@ const Popover = (_ref, ref) => {
328
381
  'is-alternate': isAlternate
329
382
  })
330
383
  }, contentProps, {
331
- ref: mergedRefs
384
+ ref: mergedFloatingRef
332
385
  }, dialogProps, {
333
386
  tabIndex: "-1",
334
387
  style: isExpanded ? undefined : {
@@ -347,16 +400,13 @@ const Popover = (_ref, ref) => {
347
400
  })), createElement("div", {
348
401
  className: "components-popover__content"
349
402
  }, children), hasArrow && createElement("div", {
350
- className: "components-popover__arrow",
351
403
  ref: arrowRef,
404
+ className: ['components-popover__arrow', `is-${computedPlacement.split('-')[0]}`].join(' '),
352
405
  style: {
353
- left: !(arrowData !== null && arrowData !== void 0 && arrowData.x) || Number.isNaN(arrowData === null || arrowData === void 0 ? void 0 : arrowData.x) ? 0 : arrowData.x,
354
- top: !(arrowData !== null && arrowData !== void 0 && arrowData.y) || Number.isNaN(arrowData === null || arrowData === void 0 ? void 0 : arrowData.y) ? 0 : arrowData.y,
355
- right: undefined,
356
- bottom: undefined,
357
- [staticSide]: '-4px'
406
+ left: Number.isFinite(arrowData === null || arrowData === void 0 ? void 0 : arrowData.x) ? `${arrowData.x}px` : '',
407
+ top: Number.isFinite(arrowData === null || arrowData === void 0 ? void 0 : arrowData.y) ? `${arrowData.y}px` : ''
358
408
  }
359
- }));
409
+ }, createElement(ArrowTriangle, null)));
360
410
 
361
411
  if (slot.ref) {
362
412
  content = createElement(Fill, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["classnames","useFloating","flip","shift","autoUpdate","arrow","offset","offsetMiddleware","limitShift","size","useRef","useLayoutEffect","forwardRef","createContext","useContext","useMemo","useViewportMatch","useMergeRefs","__experimentalUseDialog","useDialog","close","deprecated","Button","ScrollLock","Slot","Fill","useSlot","getAnimateClassName","SLOT_NAME","slotNameContext","positionToPlacement","position","x","y","z","split","includes","suffix","placementToAnimationOrigin","placement","a","b","Popover","ref","range","animate","headerTitle","onClose","children","className","noArrow","isAlternate","focusOnMount","anchorRef","anchorRect","getAnchorRect","expandOnMobile","onFocusOutside","__unstableSlotName","__unstableObserveElement","__unstableForcePosition","__unstableShift","contentProps","since","version","arrowRef","anchorRefFallback","isMobileViewport","isExpanded","hasArrow","usedPlacement","ownerDocument","top","startContainer","current","document","frameOffset","defaultView","frameElement","undefined","iframeRect","getBoundingClientRect","name","fn","left","middlewares","apply","sizeProps","height","refs","floating","Object","assign","firstChild","style","maxHeight","overflow","crossAxis","limiter","padding","element","filter","m","slotName","slot","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","reference","strategy","update","placementData","middlewareData","arrowData","middleware","staticSide","right","bottom","mergedRefs","usedRef","topRect","bottomRect","window","DOMRect","width","rect","observer","MutationObserver","observe","attributes","disconnect","addEventListener","removeEventListener","animateClassName","origin","content","Number","isNaN","PopoverContainer","PopoverSlot","__unstableSlotNameProvider","Provider"],"mappings":";;AAAA;;AACA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SACCC,WADD,EAECC,IAFD,EAGCC,KAHD,EAICC,UAJD,EAKCC,KALD,EAMCC,MAAM,IAAIC,gBANX,EAOCC,UAPD,EAQCC,IARD,QASO,wBATP;AAWA;AACA;AACA;;AACA,SACCC,MADD,EAECC,eAFD,EAGCC,UAHD,EAICC,aAJD,EAKCC,UALD,EAMCC,OAND,QAOO,oBAPP;AAQA,SACCC,gBADD,EAECC,YAFD,EAGCC,uBAAuB,IAAIC,SAH5B,QAIO,oBAJP;AAKA,SAASC,KAAT,QAAsB,kBAAtB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,SAASC,IAAT,E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G,EAAGxE;AAAZ,KAAkCwE,OAAlC,CAAP;AACA,CAjUD;;AAmUA,MAAMG,gBAAgB,GAAGjI,UAAU,CAAE8B,OAAF,CAAnC;;AAEA,SAASoG,WAAT,QAA4CnG,GAA5C,EAAkD;AAAA,MAA5B;AAAEuC,IAAAA,IAAI,GAAGtD;AAAT,GAA4B;AACjD,SACC,cAAC,IAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAGsD,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGvC;AAJP,IADD;AAQA;;AAEDkG,gBAAgB,CAACrH,IAAjB,GAAwBZ,UAAU,CAAEkI,WAAF,CAAlC;AACAD,gBAAgB,CAACE,0BAAjB,GAA8ClH,eAAe,CAACmH,QAA9D;AAEA,eAAeH,gBAAf","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport {\n\tuseFloating,\n\tflip,\n\tshift,\n\tautoUpdate,\n\tarrow,\n\toffset as offsetMiddleware,\n\tlimitShift,\n\tsize,\n} from '@floating-ui/react-dom';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n} from '@wordpress/element';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { close } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ScrollLock from '../scroll-lock';\nimport { Slot, Fill, useSlot } from '../slot-fill';\nimport { getAnimateClassName } from '../animate';\n\n/**\n * Name of slot in which popover should fill.\n *\n * @type {string}\n */\nconst SLOT_NAME = 'Popover';\n\nconst slotNameContext = createContext();\n\nconst positionToPlacement = ( position ) => {\n\tconst [ x, y, z ] = position.split( ' ' );\n\n\tif ( [ 'top', 'bottom' ].includes( x ) ) {\n\t\tlet suffix = '';\n\t\tif ( ( !! z && z === 'left' ) || y === 'right' ) {\n\t\t\tsuffix = '-start';\n\t\t} else if ( ( !! z && z === 'right' ) || y === 'left' ) {\n\t\t\tsuffix = '-end';\n\t\t}\n\t\treturn x + suffix;\n\t}\n\n\treturn y;\n};\n\nconst placementToAnimationOrigin = ( placement ) => {\n\tconst [ a, b ] = placement.split( '-' );\n\n\tlet x, y;\n\tif ( a === 'top' || a === 'bottom' ) {\n\t\tx = a === 'top' ? 'bottom' : 'top';\n\t\ty = 'middle';\n\t\tif ( b === 'start' ) {\n\t\t\ty = 'left';\n\t\t} else if ( b === 'end' ) {\n\t\t\ty = 'right';\n\t\t}\n\t}\n\n\tif ( a === 'left' || a === 'right' ) {\n\t\tx = 'center';\n\t\ty = a === 'left' ? 'right' : 'left';\n\t\tif ( b === 'start' ) {\n\t\t\tx = 'top';\n\t\t} else if ( b === 'end' ) {\n\t\t\tx = 'bottom';\n\t\t}\n\t}\n\n\treturn x + ' ' + y;\n};\n\nconst Popover = (\n\t{\n\t\trange,\n\t\tanimate = true,\n\t\theaderTitle,\n\t\tonClose,\n\t\tchildren,\n\t\tclassName,\n\t\tnoArrow = true,\n\t\tisAlternate,\n\t\tposition,\n\t\tplacement = 'bottom-start',\n\t\toffset,\n\t\tfocusOnMount = 'firstElement',\n\t\tanchorRef,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\texpandOnMobile,\n\t\tonFocusOutside,\n\t\t__unstableSlotName = SLOT_NAME,\n\t\t__unstableObserveElement,\n\t\t__unstableForcePosition,\n\t\t__unstableShift = false,\n\t\t...contentProps\n\t},\n\tref\n) => {\n\tif ( range ) {\n\t\tdeprecated( 'range prop in Popover component', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\n\tconst arrowRef = useRef( null );\n\tconst anchorRefFallback = useRef( null );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isExpanded = expandOnMobile && isMobileViewport;\n\tconst hasArrow = ! isExpanded && ! noArrow;\n\tconst usedPlacement = position\n\t\t? positionToPlacement( position )\n\t\t: placement;\n\n\tconst ownerDocument = useMemo( () => {\n\t\tif ( anchorRef?.top ) {\n\t\t\treturn anchorRef?.top.ownerDocument;\n\t\t} else if ( anchorRef?.startContainer ) {\n\t\t\treturn anchorRef.startContainer.ownerDocument;\n\t\t} else if ( anchorRef?.current ) {\n\t\t\treturn anchorRef.current.ownerDocument;\n\t\t} else if ( anchorRef ) {\n\t\t\t// This one should be deprecated.\n\t\t\treturn anchorRef.ownerDocument;\n\t\t} else if ( anchorRect && anchorRect?.ownerDocument ) {\n\t\t\treturn anchorRect.ownerDocument;\n\t\t} else if ( getAnchorRect ) {\n\t\t\treturn (\n\t\t\t\tgetAnchorRect( anchorRefFallback.current )?.ownerDocument ??\n\t\t\t\tdocument\n\t\t\t);\n\t\t}\n\n\t\treturn document;\n\t}, [ anchorRef, anchorRect, getAnchorRect ] );\n\n\t/**\n\t * Offsets the position of the popover when the anchor is inside an iframe.\n\t */\n\tconst frameOffset = useMemo( () => {\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst { frameElement } = defaultView;\n\n\t\tif ( ! frameElement || ownerDocument === document ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst iframeRect = frameElement.getBoundingClientRect();\n\t\treturn {\n\t\t\tname: 'iframeOffset',\n\t\t\tfn( { x, y } ) {\n\t\t\t\treturn {\n\t\t\t\t\tx: x + iframeRect.left,\n\t\t\t\t\ty: y + iframeRect.top,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}, [ ownerDocument ] );\n\n\tconst middlewares = [\n\t\tframeOffset,\n\t\toffset ? offsetMiddleware( offset ) : undefined,\n\t\t__unstableForcePosition ? undefined : flip(),\n\t\t__unstableForcePosition\n\t\t\t? undefined\n\t\t\t: size( {\n\t\t\t\t\tapply( sizeProps ) {\n\t\t\t\t\t\tconst { height } = sizeProps;\n\t\t\t\t\t\tif ( ! refs.floating.current ) return;\n\t\t\t\t\t\t// Reduce the height of the popover to the available space.\n\t\t\t\t\t\tObject.assign( refs.floating.current.firstChild.style, {\n\t\t\t\t\t\t\tmaxHeight: `${ height }px`,\n\t\t\t\t\t\t\toverflow: 'auto',\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t } ),\n\t\t__unstableShift\n\t\t\t? shift( {\n\t\t\t\t\tcrossAxis: true,\n\t\t\t\t\tlimiter: limitShift(),\n\t\t\t\t\tpadding: 1, // Necessary to avoid flickering at the edge of the viewport.\n\t\t\t } )\n\t\t\t: undefined,\n\t\thasArrow ? arrow( { element: arrowRef } ) : undefined,\n\t].filter( ( m ) => !! m );\n\tconst slotName = useContext( slotNameContext ) || __unstableSlotName;\n\tconst slot = useSlot( slotName );\n\n\tlet onDialogClose;\n\n\tif ( onClose || onFocusOutside ) {\n\t\tonDialogClose = ( type, event ) => {\n\t\t\t// Ideally the popover should have just a single onClose prop and\n\t\t\t// not three props that potentially do the same thing.\n\t\t\tif ( type === 'focus-outside' && onFocusOutside ) {\n\t\t\t\tonFocusOutside( event );\n\t\t\t} else if ( onClose ) {\n\t\t\t\tonClose();\n\t\t\t}\n\t\t};\n\t}\n\n\tconst [ dialogRef, dialogProps ] = useDialog( {\n\t\tfocusOnMount,\n\t\t__unstableOnClose: onDialogClose,\n\t\tonClose: onDialogClose,\n\t} );\n\n\tconst {\n\t\tx,\n\t\ty,\n\t\treference,\n\t\tfloating,\n\t\tstrategy,\n\t\trefs,\n\t\tupdate,\n\t\tplacement: placementData,\n\t\tmiddlewareData: { arrow: arrowData = {} },\n\t} = useFloating( {\n\t\tplacement: usedPlacement,\n\t\tmiddleware: middlewares,\n\t} );\n\tconst staticSide = {\n\t\ttop: 'bottom',\n\t\tright: 'left',\n\t\tbottom: 'top',\n\t\tleft: 'right',\n\t}[ placementData.split( '-' )[ 0 ] ];\n\tconst mergedRefs = useMergeRefs( [ floating, dialogRef, ref ] );\n\n\t// Updates references\n\tuseLayoutEffect( () => {\n\t\t// No ref or position have been passed\n\t\tlet usedRef;\n\t\tif ( anchorRef?.top ) {\n\t\t\tusedRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\tconst topRect = anchorRef.top.getBoundingClientRect();\n\t\t\t\t\tconst bottomRect = anchorRef.bottom.getBoundingClientRect();\n\t\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\t\ttopRect.x,\n\t\t\t\t\t\ttopRect.y,\n\t\t\t\t\t\ttopRect.width,\n\t\t\t\t\t\tbottomRect.bottom - topRect.top\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( anchorRef?.current ) {\n\t\t\tusedRef = anchorRef.current;\n\t\t} else if ( anchorRef ) {\n\t\t\tusedRef = anchorRef;\n\t\t} else if ( anchorRect ) {\n\t\t\tusedRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\treturn anchorRect;\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( getAnchorRect ) {\n\t\t\tusedRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\tconst rect = getAnchorRect( anchorRefFallback.current );\n\t\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\t\trect.x ?? rect.left,\n\t\t\t\t\t\trect.y ?? rect.top,\n\t\t\t\t\t\trect.width ?? rect.right - rect.left,\n\t\t\t\t\t\trect.height ?? rect.bottom - rect.top\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( anchorRefFallback.current ) {\n\t\t\tusedRef = anchorRefFallback.current;\n\t\t}\n\n\t\tif ( ! usedRef ) {\n\t\t\treturn;\n\t\t}\n\n\t\treference( usedRef );\n\n\t\tif ( ! refs.floating.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn autoUpdate( usedRef, refs.floating.current, update );\n\t}, [ anchorRef, anchorRect, getAnchorRect ] );\n\n\t// This is only needed for a smoth transition when moving blocks.\n\tuseLayoutEffect( () => {\n\t\tif ( ! __unstableObserveElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( update );\n\t\tobserver.observe( __unstableObserveElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ __unstableObserveElement ] );\n\n\t// If we're using getAnchorRect, we need to update the position as we scroll the iframe.\n\tuseLayoutEffect( () => {\n\t\tif ( ownerDocument === document ) {\n\t\t\treturn;\n\t\t}\n\n\t\townerDocument.addEventListener( 'scroll', update );\n\t\treturn () => ownerDocument.removeEventListener( 'scroll', update );\n\t}, [ ownerDocument ] );\n\n\t/** @type {false | string} */\n\tconst animateClassName =\n\t\t!! animate &&\n\t\tgetAnimateClassName( {\n\t\t\ttype: 'appear',\n\t\t\torigin: placementToAnimationOrigin( placementData ),\n\t\t} );\n\n\t// Disable reason: We care to capture the _bubbled_ events from inputs\n\t// within popover as inferring close intent.\n\n\tlet content = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-popover',\n\t\t\t\tclassName,\n\t\t\t\tanimateClassName,\n\t\t\t\t{\n\t\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t\t'is-alternate': isAlternate,\n\t\t\t\t}\n\t\t\t) }\n\t\t\t{ ...contentProps }\n\t\t\tref={ mergedRefs }\n\t\t\t{ ...dialogProps }\n\t\t\ttabIndex=\"-1\"\n\t\t\tstyle={\n\t\t\t\tisExpanded\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tposition: strategy,\n\t\t\t\t\t\t\tleft: Number.isNaN( x ) ? 0 : x,\n\t\t\t\t\t\t\ttop: Number.isNaN( y ) ? 0 : y,\n\t\t\t\t\t }\n\t\t\t}\n\t\t>\n\t\t\t{ isExpanded && <ScrollLock /> }\n\t\t\t{ isExpanded && (\n\t\t\t\t<div className=\"components-popover__header\">\n\t\t\t\t\t<span className=\"components-popover__header-title\">\n\t\t\t\t\t\t{ headerTitle }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"components-popover__close\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-popover__content\">{ children }</div>\n\t\t\t{ hasArrow && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-popover__arrow\"\n\t\t\t\t\tref={ arrowRef }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft:\n\t\t\t\t\t\t\t! arrowData?.x || Number.isNaN( arrowData?.x )\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: arrowData.x,\n\t\t\t\t\t\ttop:\n\t\t\t\t\t\t\t! arrowData?.y || Number.isNaN( arrowData?.y )\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: arrowData.y,\n\t\t\t\t\t\tright: undefined,\n\t\t\t\t\t\tbottom: undefined,\n\t\t\t\t\t\t[ staticSide ]: '-4px',\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n\n\tif ( slot.ref ) {\n\t\tcontent = <Fill name={ slotName }>{ content }</Fill>;\n\t}\n\n\tif ( anchorRef || anchorRect ) {\n\t\treturn content;\n\t}\n\n\treturn <span ref={ anchorRefFallback }>{ content }</span>;\n};\n\nconst PopoverContainer = forwardRef( Popover );\n\nfunction PopoverSlot( { name = SLOT_NAME }, ref ) {\n\treturn (\n\t\t<Slot\n\t\t\tbubblesVirtually\n\t\t\tname={ name }\n\t\t\tclassName=\"popover-slot\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nPopoverContainer.Slot = forwardRef( PopoverSlot );\nPopoverContainer.__unstableSlotNameProvider = slotNameContext.Provider;\n\nexport default PopoverContainer;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["classnames","useFloating","flip","shift","autoUpdate","arrow","offset","offsetMiddleware","limitShift","size","useRef","useLayoutEffect","forwardRef","createContext","useContext","useMemo","useViewportMatch","useMergeRefs","__experimentalUseDialog","useDialog","close","deprecated","Path","SVG","Button","ScrollLock","Slot","Fill","useSlot","getAnimateClassName","SLOT_NAME","ArrowTriangle","props","slotNameContext","positionToPlacement","position","x","y","z","split","includes","suffix","placementToAnimationOrigin","placement","a","b","Popover","forwardedRef","range","animate","headerTitle","onClose","children","className","noArrow","isAlternate","placementProp","focusOnMount","anchorRef","anchorRect","getAnchorRect","expandOnMobile","onFocusOutside","__unstableSlotName","__unstableObserveElement","__unstableForcePosition","__unstableShift","contentProps","since","version","arrowRef","anchorRefFallback","isMobileViewport","isExpanded","hasArrow","normalizedPlacementFromProps","ownerDocument","documentToReturn","top","startContainer","current","document","frameOffset","defaultView","frameElement","undefined","iframeRect","getBoundingClientRect","left","middleware","currentPlacement","isTopBottomPlacement","mainAxis","crossAxis","hasBeforePlacement","mainAxisModifier","normalizedOffset","apply","sizeProps","height","refs","floating","Object","assign","firstChild","style","maxHeight","overflow","limiter","padding","element","filter","m","slotName","slot","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","reference","strategy","update","computedPlacement","middlewareData","arrowData","resultingReferenceRef","topRect","bottomRect","bottom","window","DOMRect","width","rect","right","parentNode","observer","MutationObserver","observe","attributes","disconnect","addEventListener","removeEventListener","animateClassName","origin","mergedFloatingRef","content","Number","isNaN","join","isFinite","ref","PopoverContainer","PopoverSlot","name","__unstableSlotNameProvider","Provider"],"mappings":";;AAAA;;AACA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SACCC,WADD,EAECC,IAFD,EAGCC,KAHD,EAICC,UAJD,EAKCC,KALD,EAMCC,MAAM,IAAIC,gBANX,EAOCC,UAPD,EAQCC,IARD,QASO,wBATP;AAWA;AACA;AACA;;AACA,SACCC,MADD,EAECC,eAFD,EAGCC,UA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,CAACsC,GAAV,EAAgB;AACfL,IAAAA,OAAO,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAGlC;AAAb,OAA0BkC,OAA1B,CAAV;AACA;;AAED,MAAKzF,SAAS,IAAIC,UAAlB,EAA+B;AAC9B,WAAOwF,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAG5E;AAAZ,KAAkC4E,OAAlC,CAAP;AACA,CAlXD;;AAoXA,MAAMM,gBAAgB,GAAG7I,UAAU,CAAEkC,OAAF,CAAnC;;AAEA,SAAS4G,WAAT,QAA4CF,GAA5C,EAAkD;AAAA,MAA5B;AAAEG,IAAAA,IAAI,GAAG7H;AAAT,GAA4B;AACjD,SACC,cAAC,IAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAG6H,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGH;AAJP,IADD;AAQA;;AAEDC,gBAAgB,CAAC/H,IAAjB,GAAwBd,UAAU,CAAE8I,WAAF,CAAlC;AACAD,gBAAgB,CAACG,0BAAjB,GAA8C3H,eAAe,CAAC4H,QAA9D;AAEA,eAAeJ,gBAAf","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport {\n\tuseFloating,\n\tflip,\n\tshift,\n\tautoUpdate,\n\tarrow,\n\toffset as offsetMiddleware,\n\tlimitShift,\n\tsize,\n} from '@floating-ui/react-dom';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n} from '@wordpress/element';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { close } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { Path, SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ScrollLock from '../scroll-lock';\nimport { Slot, Fill, useSlot } from '../slot-fill';\nimport { getAnimateClassName } from '../animate';\n\n/**\n * Name of slot in which popover should fill.\n *\n * @type {string}\n */\nconst SLOT_NAME = 'Popover';\n\n// An SVG displaying a triangle facing down, filled with a solid\n// color and bordered in such a way to create an arrow-like effect.\n// Keeping the SVG's viewbox squared simplify the arrow positioning\n// calculations.\nconst ArrowTriangle = ( props ) => (\n\t<SVG\n\t\t{ ...props }\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox={ `0 0 100 100` }\n\t\tclassName=\"components-popover__triangle\"\n\t\trole=\"presentation\"\n\t>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-bg\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t/>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-border\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t/>\n\t</SVG>\n);\n\nconst slotNameContext = createContext();\n\nconst positionToPlacement = ( position ) => {\n\tconst [ x, y, z ] = position.split( ' ' );\n\n\tif ( [ 'top', 'bottom' ].includes( x ) ) {\n\t\tlet suffix = '';\n\t\tif ( ( !! z && z === 'left' ) || y === 'right' ) {\n\t\t\tsuffix = '-start';\n\t\t} else if ( ( !! z && z === 'right' ) || y === 'left' ) {\n\t\t\tsuffix = '-end';\n\t\t}\n\t\treturn x + suffix;\n\t}\n\n\treturn y;\n};\n\nconst placementToAnimationOrigin = ( placement ) => {\n\tconst [ a, b ] = placement.split( '-' );\n\n\tlet x, y;\n\tif ( a === 'top' || a === 'bottom' ) {\n\t\tx = a === 'top' ? 'bottom' : 'top';\n\t\ty = 'middle';\n\t\tif ( b === 'start' ) {\n\t\t\ty = 'left';\n\t\t} else if ( b === 'end' ) {\n\t\t\ty = 'right';\n\t\t}\n\t}\n\n\tif ( a === 'left' || a === 'right' ) {\n\t\tx = 'center';\n\t\ty = a === 'left' ? 'right' : 'left';\n\t\tif ( b === 'start' ) {\n\t\t\tx = 'top';\n\t\t} else if ( b === 'end' ) {\n\t\t\tx = 'bottom';\n\t\t}\n\t}\n\n\treturn x + ' ' + y;\n};\n\nconst Popover = (\n\t{\n\t\trange,\n\t\tanimate = true,\n\t\theaderTitle,\n\t\tonClose,\n\t\tchildren,\n\t\tclassName,\n\t\tnoArrow = true,\n\t\tisAlternate,\n\t\tposition,\n\t\tplacement: placementProp = 'bottom-start',\n\t\toffset,\n\t\tfocusOnMount = 'firstElement',\n\t\tanchorRef,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\texpandOnMobile,\n\t\tonFocusOutside,\n\t\t__unstableSlotName = SLOT_NAME,\n\t\t__unstableObserveElement,\n\t\t__unstableForcePosition = false,\n\t\t__unstableShift = false,\n\t\t...contentProps\n\t},\n\tforwardedRef\n) => {\n\tif ( range ) {\n\t\tdeprecated( 'range prop in Popover component', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\n\tconst arrowRef = useRef( null );\n\tconst anchorRefFallback = useRef( null );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isExpanded = expandOnMobile && isMobileViewport;\n\tconst hasArrow = ! isExpanded && ! noArrow;\n\tconst normalizedPlacementFromProps = position\n\t\t? positionToPlacement( position )\n\t\t: placementProp;\n\n\tconst ownerDocument = useMemo( () => {\n\t\tlet documentToReturn;\n\n\t\tif ( anchorRef?.top ) {\n\t\t\tdocumentToReturn = anchorRef?.top.ownerDocument;\n\t\t} else if ( anchorRef?.startContainer ) {\n\t\t\tdocumentToReturn = anchorRef.startContainer.ownerDocument;\n\t\t} else if ( anchorRef?.current ) {\n\t\t\tdocumentToReturn = anchorRef.current.ownerDocument;\n\t\t} else if ( anchorRef ) {\n\t\t\t// This one should be deprecated.\n\t\t\tdocumentToReturn = anchorRef.ownerDocument;\n\t\t} else if ( anchorRect && anchorRect?.ownerDocument ) {\n\t\t\tdocumentToReturn = anchorRect.ownerDocument;\n\t\t} else if ( getAnchorRect ) {\n\t\t\tdocumentToReturn = getAnchorRect(\n\t\t\t\tanchorRefFallback.current\n\t\t\t)?.ownerDocument;\n\t\t}\n\n\t\treturn documentToReturn ?? document;\n\t}, [ anchorRef, anchorRect, getAnchorRect ] );\n\n\t/**\n\t * Offsets the position of the popover when the anchor is inside an iframe.\n\t */\n\tconst frameOffset = useMemo( () => {\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst { frameElement } = defaultView;\n\n\t\tif ( ! frameElement || ownerDocument === document ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst iframeRect = frameElement.getBoundingClientRect();\n\t\treturn { x: iframeRect.left, y: iframeRect.top };\n\t}, [ ownerDocument ] );\n\n\tconst middleware = [\n\t\tframeOffset || offset\n\t\t\t? offsetMiddleware( ( { placement: currentPlacement } ) => {\n\t\t\t\t\tif ( ! frameOffset ) {\n\t\t\t\t\t\treturn offset;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isTopBottomPlacement =\n\t\t\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\t\t\tcurrentPlacement.includes( 'bottom' );\n\n\t\t\t\t\t// The main axis should represent the gap between the\n\t\t\t\t\t// floating element and the reference element. The cross\n\t\t\t\t\t// axis is always perpendicular to the main axis.\n\t\t\t\t\tconst mainAxis = isTopBottomPlacement ? 'y' : 'x';\n\t\t\t\t\tconst crossAxis = mainAxis === 'x' ? 'y' : 'x';\n\n\t\t\t\t\t// When the popover is before the reference, subtract the offset,\n\t\t\t\t\t// of the main axis else add it.\n\t\t\t\t\tconst hasBeforePlacement =\n\t\t\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\t\t\tcurrentPlacement.includes( 'left' );\n\t\t\t\t\tconst mainAxisModifier = hasBeforePlacement ? -1 : 1;\n\t\t\t\t\tconst normalizedOffset = offset ? offset : 0;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmainAxis:\n\t\t\t\t\t\t\tnormalizedOffset +\n\t\t\t\t\t\t\tframeOffset[ mainAxis ] * mainAxisModifier,\n\t\t\t\t\t\tcrossAxis: frameOffset[ crossAxis ],\n\t\t\t\t\t};\n\t\t\t } )\n\t\t\t: undefined,\n\t\t__unstableForcePosition ? undefined : flip(),\n\t\t__unstableForcePosition\n\t\t\t? undefined\n\t\t\t: size( {\n\t\t\t\t\tapply( sizeProps ) {\n\t\t\t\t\t\tconst { height } = sizeProps;\n\t\t\t\t\t\tif ( ! refs.floating.current ) return;\n\t\t\t\t\t\t// Reduce the height of the popover to the available space.\n\t\t\t\t\t\tObject.assign( refs.floating.current.firstChild.style, {\n\t\t\t\t\t\t\tmaxHeight: `${ height }px`,\n\t\t\t\t\t\t\toverflow: 'auto',\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t } ),\n\t\t__unstableShift\n\t\t\t? shift( {\n\t\t\t\t\tcrossAxis: true,\n\t\t\t\t\tlimiter: limitShift(),\n\t\t\t\t\tpadding: 1, // Necessary to avoid flickering at the edge of the viewport.\n\t\t\t } )\n\t\t\t: undefined,\n\t\thasArrow ? arrow( { element: arrowRef } ) : undefined,\n\t].filter( ( m ) => !! m );\n\tconst slotName = useContext( slotNameContext ) || __unstableSlotName;\n\tconst slot = useSlot( slotName );\n\n\tlet onDialogClose;\n\n\tif ( onClose || onFocusOutside ) {\n\t\tonDialogClose = ( type, event ) => {\n\t\t\t// Ideally the popover should have just a single onClose prop and\n\t\t\t// not three props that potentially do the same thing.\n\t\t\tif ( type === 'focus-outside' && onFocusOutside ) {\n\t\t\t\tonFocusOutside( event );\n\t\t\t} else if ( onClose ) {\n\t\t\t\tonClose();\n\t\t\t}\n\t\t};\n\t}\n\n\tconst [ dialogRef, dialogProps ] = useDialog( {\n\t\tfocusOnMount,\n\t\t__unstableOnClose: onDialogClose,\n\t\tonClose: onDialogClose,\n\t} );\n\n\tconst {\n\t\t// Positioning coordinates\n\t\tx,\n\t\ty,\n\t\t// Callback refs (not regular refs). This allows the position to be updated.\n\t\t// when either elements change.\n\t\treference,\n\t\tfloating,\n\t\t// Object with \"regular\" refs to both \"reference\" and \"floating\"\n\t\trefs,\n\t\t// Type of CSS position property to use (absolute or fixed)\n\t\tstrategy,\n\t\tupdate,\n\t\tplacement: computedPlacement,\n\t\tmiddlewareData: { arrow: arrowData = {} },\n\t} = useFloating( { placement: normalizedPlacementFromProps, middleware } );\n\n\t// Update the `reference`'s ref.\n\t//\n\t// In floating-ui's terms:\n\t// - \"reference\" refers to the popover's anchor element.\n\t// - \"floating\" refers the floating popover's element.\n\t// A floating element can also be positioned relative to a virtual element,\n\t// instead of a real one. A virtual element is represented by an object\n\t// with the `getBoundingClientRect()` function (like real elements).\n\t// See https://floating-ui.com/docs/virtual-elements for more info.\n\tuseLayoutEffect( () => {\n\t\tlet resultingReferenceRef;\n\n\t\tif ( anchorRef?.top ) {\n\t\t\t// Create a virtual element for the ref. The expectation is that\n\t\t\t// if anchorRef.top is defined, then anchorRef.bottom is defined too.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\tconst topRect = anchorRef.top.getBoundingClientRect();\n\t\t\t\t\tconst bottomRect = anchorRef.bottom.getBoundingClientRect();\n\t\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\t\ttopRect.x,\n\t\t\t\t\t\ttopRect.y,\n\t\t\t\t\t\ttopRect.width,\n\t\t\t\t\t\tbottomRect.bottom - topRect.top\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( anchorRef?.current ) {\n\t\t\t// Standard React ref.\n\t\t\tresultingReferenceRef = anchorRef.current;\n\t\t} else if ( anchorRef ) {\n\t\t\t// If `anchorRef` holds directly the element's value (no `current` key)\n\t\t\t// This is a weird scenario and should be deprecated.\n\t\t\tresultingReferenceRef = anchorRef;\n\t\t} else if ( anchorRect ) {\n\t\t\t// Create a virtual element for the ref.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\treturn anchorRect;\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( getAnchorRect ) {\n\t\t\t// Create a virtual element for the ref.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\tconst rect = getAnchorRect( anchorRefFallback.current );\n\t\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\t\trect.x ?? rect.left,\n\t\t\t\t\t\trect.y ?? rect.top,\n\t\t\t\t\t\trect.width ?? rect.right - rect.left,\n\t\t\t\t\t\trect.height ?? rect.bottom - rect.top\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( anchorRefFallback.current ) {\n\t\t\t// If no explicit ref is passed via props, fall back to\n\t\t\t// anchoring to the popover's parent node.\n\t\t\tresultingReferenceRef = anchorRefFallback.current.parentNode;\n\t\t}\n\n\t\tif ( ! resultingReferenceRef ) {\n\t\t\treturn;\n\t\t}\n\n\t\treference( resultingReferenceRef );\n\n\t\tif ( ! refs.floating.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn autoUpdate(\n\t\t\tresultingReferenceRef,\n\t\t\trefs.floating.current,\n\t\t\tupdate\n\t\t);\n\t}, [ anchorRef, anchorRect, getAnchorRect ] );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\tuseLayoutEffect( () => {\n\t\tif ( ! __unstableObserveElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( update );\n\t\tobserver.observe( __unstableObserveElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ __unstableObserveElement ] );\n\n\t// If the reference element is in a different ownerDocument (e.g. iFrame),\n\t// we need to manually update the floating's position as the reference's owner\n\t// document scrolls.\n\tuseLayoutEffect( () => {\n\t\tif ( ownerDocument === document ) {\n\t\t\treturn;\n\t\t}\n\n\t\townerDocument.addEventListener( 'scroll', update );\n\t\treturn () => ownerDocument.removeEventListener( 'scroll', update );\n\t}, [ ownerDocument ] );\n\n\t/** @type {false | string} */\n\tconst animateClassName =\n\t\t!! animate &&\n\t\tgetAnimateClassName( {\n\t\t\ttype: 'appear',\n\t\t\torigin: placementToAnimationOrigin( computedPlacement ),\n\t\t} );\n\n\tconst mergedFloatingRef = useMergeRefs( [\n\t\tfloating,\n\t\tdialogRef,\n\t\tforwardedRef,\n\t] );\n\n\t// Disable reason: We care to capture the _bubbled_ events from inputs\n\t// within popover as inferring close intent.\n\n\tlet content = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-popover',\n\t\t\t\tclassName,\n\t\t\t\tanimateClassName,\n\t\t\t\t{\n\t\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t\t'is-alternate': isAlternate,\n\t\t\t\t}\n\t\t\t) }\n\t\t\t{ ...contentProps }\n\t\t\tref={ mergedFloatingRef }\n\t\t\t{ ...dialogProps }\n\t\t\ttabIndex=\"-1\"\n\t\t\tstyle={\n\t\t\t\tisExpanded\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tposition: strategy,\n\t\t\t\t\t\t\tleft: Number.isNaN( x ) ? 0 : x,\n\t\t\t\t\t\t\ttop: Number.isNaN( y ) ? 0 : y,\n\t\t\t\t\t }\n\t\t\t}\n\t\t>\n\t\t\t{ /* Prevents scroll on the document */ }\n\t\t\t{ isExpanded && <ScrollLock /> }\n\t\t\t{ isExpanded && (\n\t\t\t\t<div className=\"components-popover__header\">\n\t\t\t\t\t<span className=\"components-popover__header-title\">\n\t\t\t\t\t\t{ headerTitle }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"components-popover__close\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-popover__content\">{ children }</div>\n\t\t\t{ hasArrow && (\n\t\t\t\t<div\n\t\t\t\t\tref={ arrowRef }\n\t\t\t\t\tclassName={ [\n\t\t\t\t\t\t'components-popover__arrow',\n\t\t\t\t\t\t`is-${ computedPlacement.split( '-' )[ 0 ] }`,\n\t\t\t\t\t].join( ' ' ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft: Number.isFinite( arrowData?.x )\n\t\t\t\t\t\t\t? `${ arrowData.x }px`\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\ttop: Number.isFinite( arrowData?.y )\n\t\t\t\t\t\t\t? `${ arrowData.y }px`\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<ArrowTriangle />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n\n\tif ( slot.ref ) {\n\t\tcontent = <Fill name={ slotName }>{ content }</Fill>;\n\t}\n\n\tif ( anchorRef || anchorRect ) {\n\t\treturn content;\n\t}\n\n\treturn <span ref={ anchorRefFallback }>{ content }</span>;\n};\n\nconst PopoverContainer = forwardRef( Popover );\n\nfunction PopoverSlot( { name = SLOT_NAME }, ref ) {\n\treturn (\n\t\t<Slot\n\t\t\tbubblesVirtually\n\t\t\tname={ name }\n\t\t\tclassName=\"popover-slot\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nPopoverContainer.Slot = forwardRef( PopoverSlot );\nPopoverContainer.__unstableSlotNameProvider = slotNameContext.Provider;\n\nexport default PopoverContainer;\n"]}