@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
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/placeholder/index.js"],"names":["PlaceholderIllustration","Placeholder","icon","children","label","instructions","className","notices","preview","isColumnLayout","withIllustration","additionalProps","resizeListener","width","modifierClassNames","classes","fieldsetClasses"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,uBAAuB,GAC5B,4BAAC,eAAD;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,4BAAC,gBAAD;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,IAAgC,iCAAtC,CADG,CAGH;AACA;;AACA,MAAIC,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,GAAG,yBACf,wBADe,EAEfT,SAFe,EAGfQ,kBAHe,EAIfJ,gBAAgB,GAAG,kBAAH,GAAwB,IAJzB,CAAhB;AAMA,QAAMM,eAAe,GAAG,yBAAY,kCAAZ,EAAgD;AACvE,wBAAoBP;AADmD,GAAhD,CAAxB;AAGA,SACC,8DAAUE,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,4BAAC,aAAD;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;;eAEcF,W","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":["PlaceholderIllustration","Placeholder","props","icon","children","label","instructions","className","notices","preview","isColumnLayout","withIllustration","additionalProps","resizeListener","width","modifierClassNames","classes","fieldsetClasses"],"mappings":";;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAKA,MAAMA,uBAAuB,GAC5B,4BAAC,eAAD;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,4BAAC,gBAAD;AAAM,EAAA,YAAY,EAAC,oBAAnB;AAAwC,EAAA,CAAC,EAAC;AAA1C,EAPD,CADD;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,WAAT,EACN;AACA;AACAC,KAHM,EAOL;AACD,QAAM;AACLC,IAAAA,IADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,KAHK;AAILC,IAAAA,YAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA,OANK;AAOLC,IAAAA,OAPK;AAQLC,IAAAA,cARK;AASLC,IAAAA,gBATK;AAUL,OAAGC;AAVE,MAWFV,KAXJ;AAYA,QAAM,CAAEW,cAAF,EAAkB;AAAEC,IAAAA;AAAF,GAAlB,IAAgC,iCAAtC,CAbC,CAeD;AACA;;AACA,MAAIC,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,GAAG,yBACf,wBADe,EAEfT,SAFe,EAGfQ,kBAHe,EAIfJ,gBAAgB,GAAG,kBAAH,GAAwB,IAJzB,CAAhB;AAMA,QAAMM,eAAe,GAAG,yBAAY,kCAAZ,EAAgD;AACvE,wBAAoBP;AADmD,GAAhD,CAAxB;AAGA,SACC,8DAAUE,eAAV;AAA4B,IAAA,SAAS,EAAGI;AAAxC,MACGL,gBAAgB,GAAGX,uBAAH,GAA6B,IADhD,EAEGa,cAFH,EAGGL,OAHH,EAIGC,OAAO,IACR;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,OADH,CALF,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,aAAD;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;;eAEcH,W","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,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -21,6 +21,8 @@ var _icons = require("@wordpress/icons");
21
21
 
22
22
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
23
23
 
24
+ var _primitives = require("@wordpress/primitives");
25
+
24
26
  var _button = _interopRequireDefault(require("../button"));
25
27
 
26
28
  var _scrollLock = _interopRequireDefault(require("../scroll-lock"));
@@ -48,7 +50,25 @@ var _animate = require("../animate");
48
50
  *
49
51
  * @type {string}
50
52
  */
51
- const SLOT_NAME = 'Popover';
53
+ const SLOT_NAME = 'Popover'; // An SVG displaying a triangle facing down, filled with a solid
54
+ // color and bordered in such a way to create an arrow-like effect.
55
+ // Keeping the SVG's viewbox squared simplify the arrow positioning
56
+ // calculations.
57
+
58
+ const ArrowTriangle = props => (0, _element.createElement)(_primitives.SVG, (0, _extends2.default)({}, props, {
59
+ xmlns: "http://www.w3.org/2000/svg",
60
+ viewBox: `0 0 100 100`,
61
+ className: "components-popover__triangle",
62
+ role: "presentation"
63
+ }), (0, _element.createElement)(_primitives.Path, {
64
+ className: "components-popover__triangle-bg",
65
+ d: "M 0 0 L 50 50 L 100 0"
66
+ }), (0, _element.createElement)(_primitives.Path, {
67
+ className: "components-popover__triangle-border",
68
+ d: "M 0 0 L 50 50 L 100 0",
69
+ vectorEffect: "non-scaling-stroke"
70
+ }));
71
+
52
72
  const slotNameContext = (0, _element.createContext)();
53
73
 
54
74
  const positionToPlacement = position => {
@@ -98,7 +118,7 @@ const placementToAnimationOrigin = placement => {
98
118
  return x + ' ' + y;
99
119
  };
100
120
 
101
- const Popover = (_ref, ref) => {
121
+ const Popover = (_ref, forwardedRef) => {
102
122
  let {
103
123
  range,
104
124
  animate = true,
@@ -109,7 +129,7 @@ const Popover = (_ref, ref) => {
109
129
  noArrow = true,
110
130
  isAlternate,
111
131
  position,
112
- placement = 'bottom-start',
132
+ placement: placementProp = 'bottom-start',
113
133
  offset,
114
134
  focusOnMount = 'firstElement',
115
135
  anchorRef,
@@ -119,7 +139,7 @@ const Popover = (_ref, ref) => {
119
139
  onFocusOutside,
120
140
  __unstableSlotName = SLOT_NAME,
121
141
  __unstableObserveElement,
122
- __unstableForcePosition,
142
+ __unstableForcePosition = false,
123
143
  __unstableShift = false,
124
144
  ...contentProps
125
145
  } = _ref;
@@ -136,26 +156,30 @@ const Popover = (_ref, ref) => {
136
156
  const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
137
157
  const isExpanded = expandOnMobile && isMobileViewport;
138
158
  const hasArrow = !isExpanded && !noArrow;
139
- const usedPlacement = position ? positionToPlacement(position) : placement;
159
+ const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp;
140
160
  const ownerDocument = (0, _element.useMemo)(() => {
161
+ var _documentToReturn;
162
+
163
+ let documentToReturn;
164
+
141
165
  if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
142
- return anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
166
+ documentToReturn = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
143
167
  } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.startContainer) {
144
- return anchorRef.startContainer.ownerDocument;
168
+ documentToReturn = anchorRef.startContainer.ownerDocument;
145
169
  } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
146
- return anchorRef.current.ownerDocument;
170
+ documentToReturn = anchorRef.current.ownerDocument;
147
171
  } else if (anchorRef) {
148
172
  // This one should be deprecated.
149
- return anchorRef.ownerDocument;
173
+ documentToReturn = anchorRef.ownerDocument;
150
174
  } else if (anchorRect && anchorRect !== null && anchorRect !== void 0 && anchorRect.ownerDocument) {
151
- return anchorRect.ownerDocument;
175
+ documentToReturn = anchorRect.ownerDocument;
152
176
  } else if (getAnchorRect) {
153
- var _getAnchorRect$ownerD, _getAnchorRect;
177
+ var _getAnchorRect;
154
178
 
155
- return (_getAnchorRect$ownerD = (_getAnchorRect = getAnchorRect(anchorRefFallback.current)) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument) !== null && _getAnchorRect$ownerD !== void 0 ? _getAnchorRect$ownerD : document;
179
+ documentToReturn = (_getAnchorRect = getAnchorRect(anchorRefFallback.current)) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument;
156
180
  }
157
181
 
158
- return document;
182
+ return (_documentToReturn = documentToReturn) !== null && _documentToReturn !== void 0 ? _documentToReturn : document;
159
183
  }, [anchorRef, anchorRect, getAnchorRect]);
160
184
  /**
161
185
  * Offsets the position of the popover when the anchor is inside an iframe.
@@ -175,22 +199,35 @@ const Popover = (_ref, ref) => {
175
199
 
176
200
  const iframeRect = frameElement.getBoundingClientRect();
177
201
  return {
178
- name: 'iframeOffset',
179
-
180
- fn(_ref2) {
181
- let {
182
- x,
183
- y
184
- } = _ref2;
185
- return {
186
- x: x + iframeRect.left,
187
- y: y + iframeRect.top
188
- };
189
- }
190
-
202
+ x: iframeRect.left,
203
+ y: iframeRect.top
191
204
  };
192
205
  }, [ownerDocument]);
193
- const middlewares = [frameOffset, offset ? (0, _reactDom.offset)(offset) : undefined, __unstableForcePosition ? undefined : (0, _reactDom.flip)(), __unstableForcePosition ? undefined : (0, _reactDom.size)({
206
+ const middleware = [frameOffset || offset ? (0, _reactDom.offset)(_ref2 => {
207
+ let {
208
+ placement: currentPlacement
209
+ } = _ref2;
210
+
211
+ if (!frameOffset) {
212
+ return offset;
213
+ }
214
+
215
+ const isTopBottomPlacement = currentPlacement.includes('top') || currentPlacement.includes('bottom'); // The main axis should represent the gap between the
216
+ // floating element and the reference element. The cross
217
+ // axis is always perpendicular to the main axis.
218
+
219
+ const mainAxis = isTopBottomPlacement ? 'y' : 'x';
220
+ const crossAxis = mainAxis === 'x' ? 'y' : 'x'; // When the popover is before the reference, subtract the offset,
221
+ // of the main axis else add it.
222
+
223
+ const hasBeforePlacement = currentPlacement.includes('top') || currentPlacement.includes('left');
224
+ const mainAxisModifier = hasBeforePlacement ? -1 : 1;
225
+ const normalizedOffset = offset ? offset : 0;
226
+ return {
227
+ mainAxis: normalizedOffset + frameOffset[mainAxis] * mainAxisModifier,
228
+ crossAxis: frameOffset[crossAxis]
229
+ };
230
+ }) : undefined, __unstableForcePosition ? undefined : (0, _reactDom.flip)(), __unstableForcePosition ? undefined : (0, _reactDom.size)({
194
231
  apply(sizeProps) {
195
232
  const {
196
233
  height
@@ -235,35 +272,42 @@ const Popover = (_ref, ref) => {
235
272
  onClose: onDialogClose
236
273
  });
237
274
  const {
275
+ // Positioning coordinates
238
276
  x,
239
277
  y,
278
+ // Callback refs (not regular refs). This allows the position to be updated.
279
+ // when either elements change.
240
280
  reference,
241
281
  floating,
242
- strategy,
282
+ // Object with "regular" refs to both "reference" and "floating"
243
283
  refs,
284
+ // Type of CSS position property to use (absolute or fixed)
285
+ strategy,
244
286
  update,
245
- placement: placementData,
287
+ placement: computedPlacement,
246
288
  middlewareData: {
247
289
  arrow: arrowData = {}
248
290
  }
249
291
  } = (0, _reactDom.useFloating)({
250
- placement: usedPlacement,
251
- middleware: middlewares
252
- });
253
- const staticSide = {
254
- top: 'bottom',
255
- right: 'left',
256
- bottom: 'top',
257
- left: 'right'
258
- }[placementData.split('-')[0]];
259
- const mergedRefs = (0, _compose.useMergeRefs)([floating, dialogRef, ref]); // Updates references
292
+ placement: normalizedPlacementFromProps,
293
+ middleware
294
+ }); // Update the `reference`'s ref.
295
+ //
296
+ // In floating-ui's terms:
297
+ // - "reference" refers to the popover's anchor element.
298
+ // - "floating" refers the floating popover's element.
299
+ // A floating element can also be positioned relative to a virtual element,
300
+ // instead of a real one. A virtual element is represented by an object
301
+ // with the `getBoundingClientRect()` function (like real elements).
302
+ // See https://floating-ui.com/docs/virtual-elements for more info.
260
303
 
261
304
  (0, _element.useLayoutEffect)(() => {
262
- // No ref or position have been passed
263
- let usedRef;
305
+ let resultingReferenceRef;
264
306
 
265
307
  if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
266
- usedRef = {
308
+ // Create a virtual element for the ref. The expectation is that
309
+ // if anchorRef.top is defined, then anchorRef.bottom is defined too.
310
+ resultingReferenceRef = {
267
311
  getBoundingClientRect() {
268
312
  const topRect = anchorRef.top.getBoundingClientRect();
269
313
  const bottomRect = anchorRef.bottom.getBoundingClientRect();
@@ -272,18 +316,23 @@ const Popover = (_ref, ref) => {
272
316
 
273
317
  };
274
318
  } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
275
- usedRef = anchorRef.current;
319
+ // Standard React ref.
320
+ resultingReferenceRef = anchorRef.current;
276
321
  } else if (anchorRef) {
277
- usedRef = anchorRef;
322
+ // If `anchorRef` holds directly the element's value (no `current` key)
323
+ // This is a weird scenario and should be deprecated.
324
+ resultingReferenceRef = anchorRef;
278
325
  } else if (anchorRect) {
279
- usedRef = {
326
+ // Create a virtual element for the ref.
327
+ resultingReferenceRef = {
280
328
  getBoundingClientRect() {
281
329
  return anchorRect;
282
330
  }
283
331
 
284
332
  };
285
333
  } else if (getAnchorRect) {
286
- usedRef = {
334
+ // Create a virtual element for the ref.
335
+ resultingReferenceRef = {
287
336
  getBoundingClientRect() {
288
337
  var _rect$x, _rect$y, _rect$width, _rect$height;
289
338
 
@@ -293,21 +342,23 @@ const Popover = (_ref, ref) => {
293
342
 
294
343
  };
295
344
  } else if (anchorRefFallback.current) {
296
- usedRef = anchorRefFallback.current;
345
+ // If no explicit ref is passed via props, fall back to
346
+ // anchoring to the popover's parent node.
347
+ resultingReferenceRef = anchorRefFallback.current.parentNode;
297
348
  }
298
349
 
299
- if (!usedRef) {
350
+ if (!resultingReferenceRef) {
300
351
  return;
301
352
  }
302
353
 
303
- reference(usedRef);
354
+ reference(resultingReferenceRef);
304
355
 
305
356
  if (!refs.floating.current) {
306
357
  return;
307
358
  }
308
359
 
309
- return (0, _reactDom.autoUpdate)(usedRef, refs.floating.current, update);
310
- }, [anchorRef, anchorRect, getAnchorRect]); // This is only needed for a smoth transition when moving blocks.
360
+ return (0, _reactDom.autoUpdate)(resultingReferenceRef, refs.floating.current, update);
361
+ }, [anchorRef, anchorRect, getAnchorRect]); // This is only needed for a smooth transition when moving blocks.
311
362
 
312
363
  (0, _element.useLayoutEffect)(() => {
313
364
  if (!__unstableObserveElement) {
@@ -321,7 +372,9 @@ const Popover = (_ref, ref) => {
321
372
  return () => {
322
373
  observer.disconnect();
323
374
  };
324
- }, [__unstableObserveElement]); // If we're using getAnchorRect, we need to update the position as we scroll the iframe.
375
+ }, [__unstableObserveElement]); // If the reference element is in a different ownerDocument (e.g. iFrame),
376
+ // we need to manually update the floating's position as the reference's owner
377
+ // document scrolls.
325
378
 
326
379
  (0, _element.useLayoutEffect)(() => {
327
380
  if (ownerDocument === document) {
@@ -335,8 +388,9 @@ const Popover = (_ref, ref) => {
335
388
 
336
389
  const animateClassName = !!animate && (0, _animate.getAnimateClassName)({
337
390
  type: 'appear',
338
- origin: placementToAnimationOrigin(placementData)
339
- }); // Disable reason: We care to capture the _bubbled_ events from inputs
391
+ origin: placementToAnimationOrigin(computedPlacement)
392
+ });
393
+ const mergedFloatingRef = (0, _compose.useMergeRefs)([floating, dialogRef, forwardedRef]); // Disable reason: We care to capture the _bubbled_ events from inputs
340
394
  // within popover as inferring close intent.
341
395
 
342
396
  let content = // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
@@ -347,7 +401,7 @@ const Popover = (_ref, ref) => {
347
401
  'is-alternate': isAlternate
348
402
  })
349
403
  }, contentProps, {
350
- ref: mergedRefs
404
+ ref: mergedFloatingRef
351
405
  }, dialogProps, {
352
406
  tabIndex: "-1",
353
407
  style: isExpanded ? undefined : {
@@ -366,16 +420,13 @@ const Popover = (_ref, ref) => {
366
420
  })), (0, _element.createElement)("div", {
367
421
  className: "components-popover__content"
368
422
  }, children), hasArrow && (0, _element.createElement)("div", {
369
- className: "components-popover__arrow",
370
423
  ref: arrowRef,
424
+ className: ['components-popover__arrow', `is-${computedPlacement.split('-')[0]}`].join(' '),
371
425
  style: {
372
- left: !(arrowData !== null && arrowData !== void 0 && arrowData.x) || Number.isNaN(arrowData === null || arrowData === void 0 ? void 0 : arrowData.x) ? 0 : arrowData.x,
373
- top: !(arrowData !== null && arrowData !== void 0 && arrowData.y) || Number.isNaN(arrowData === null || arrowData === void 0 ? void 0 : arrowData.y) ? 0 : arrowData.y,
374
- right: undefined,
375
- bottom: undefined,
376
- [staticSide]: '-4px'
426
+ left: Number.isFinite(arrowData === null || arrowData === void 0 ? void 0 : arrowData.x) ? `${arrowData.x}px` : '',
427
+ top: Number.isFinite(arrowData === null || arrowData === void 0 ? void 0 : arrowData.y) ? `${arrowData.y}px` : ''
377
428
  }
378
- }));
429
+ }, (0, _element.createElement)(ArrowTriangle, null)));
379
430
 
380
431
  if (slot.ref) {
381
432
  content = (0, _element.createElement)(_slotFill.Fill, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["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","offset","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","arrow","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","close","PopoverContainer","PopoverSlot","Slot","__unstableSlotNameProvider","Provider"],"mappings":";;;;;;;;;AAmBA;;;;AAfA;;AACA;;AAsBA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAzCA;;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAiBA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,SAAlB;AAEA,MAAMC,eAAe,GAAG,6BAAxB;;AAEA,MAAMC,mBAAmB,GAAKC,QAAF,IAAgB;AAC3C,QAAM,CAAEC,CAAF,EAAKC,CAAL,EAAQC,CAAR,IAAcH,QAAQ,CAACI,KAAT,CAAgB,GAAhB,CAApB;;AAEA,MAAK,CAAE,KAAF,EAAS,QAAT,EAAoBC,QAApB,CAA8BJ,CAA9B,CAAL,EAAyC;AACxC,QAAIK,MAAM,GAAG,EAAb;;AACA,QAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,MAAhB,IAA4BD,CAAC,KA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KAAkB4G,MAAM,CAACC,KAAP,CAAcxB,SAAd,aAAcA,SAAd,uBAAcA,SAAS,CAAErF,CAAzB,CAAlB,GACG,CADH,GAEGqF,SAAS,CAACrF,CARP;AASPwF,MAAAA,KAAK,EAAEzC,SATA;AAUP0C,MAAAA,MAAM,EAAE1C,SAVD;AAWP,OAAEwC,UAAF,GAAgB;AAXT;AAHT,IAvCF,CAHD;;AA+DA,MAAKf,IAAI,CAAC9D,GAAV,EAAgB;AACfiG,IAAAA,OAAO,GAAG,4BAAC,cAAD;AAAM,MAAA,IAAI,EAAGpC;AAAb,OAA0BoC,OAA1B,CAAV;AACA;;AAED,MAAKtF,SAAS,IAAIC,UAAlB,EAA+B;AAC9B,WAAOqF,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAGzE;AAAZ,KAAkCyE,OAAlC,CAAP;AACA,CAjUD;;AAmUA,MAAMI,gBAAgB,GAAG,yBAAYtG,OAAZ,CAAzB;;AAEA,SAASuG,WAAT,QAA4CtG,GAA5C,EAAkD;AAAA,MAA5B;AAAEwC,IAAAA,IAAI,GAAGvD;AAAT,GAA4B;AACjD,SACC,4BAAC,cAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAGuD,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGxC;AAJP,IADD;AAQA;;AAEDqG,gBAAgB,CAACE,IAAjB,GAAwB,yBAAYD,WAAZ,CAAxB;AACAD,gBAAgB,CAACG,0BAAjB,GAA8CtH,eAAe,CAACuH,QAA9D;eAEeJ,gB","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":["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","offset","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","arrow","arrowData","resultingReferenceRef","topRect","bottomRect","bottom","window","DOMRect","width","rect","right","parentNode","observer","MutationObserver","observe","attributes","disconnect","addEventListener","removeEventListener","animateClassName","origin","mergedFloatingRef","content","Number","isNaN","close","join","isFinite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,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAGgI,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGH;AAJP,IADD;AAQA;;AAEDC,gBAAgB,CAACG,IAAjB,GAAwB,yBAAYF,WAAZ,CAAxB;AACAD,gBAAgB,CAACI,0BAAjB,GAA8C/H,eAAe,CAACgI,QAA9D;eAEeL,gB","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"]}