@wordpress/components 19.10.0 → 19.11.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 (420) hide show
  1. package/CHANGELOG.md +24 -6
  2. package/build/border-box-control/border-box-control/component.js +22 -7
  3. package/build/border-box-control/border-box-control/component.js.map +1 -1
  4. package/build/border-box-control/border-box-control-linked-button/hook.js +3 -2
  5. package/build/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
  6. package/build/border-box-control/border-box-control-split-controls/component.js +21 -8
  7. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  8. package/build/border-box-control/border-box-control-visualizer/hook.js +3 -2
  9. package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  10. package/build/border-box-control/styles.js +11 -15
  11. package/build/border-box-control/styles.js.map +1 -1
  12. package/build/border-control/border-control/component.js +5 -3
  13. package/build/border-control/border-control/component.js.map +1 -1
  14. package/build/border-control/border-control/hook.js +6 -3
  15. package/build/border-control/border-control/hook.js.map +1 -1
  16. package/build/border-control/border-control-dropdown/component.js +6 -2
  17. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  18. package/build/border-control/border-control-dropdown/hook.js +5 -5
  19. package/build/border-control/border-control-dropdown/hook.js.map +1 -1
  20. package/build/border-control/styles.js +58 -29
  21. package/build/border-control/styles.js.map +1 -1
  22. package/build/button/index.native.js +16 -2
  23. package/build/button/index.native.js.map +1 -1
  24. package/build/button-group/index.js +24 -7
  25. package/build/button-group/index.js.map +1 -1
  26. package/build/{flyout → button-group}/types.js +0 -0
  27. package/build/button-group/types.js.map +1 -0
  28. package/build/checkbox-control/index.js +34 -7
  29. package/build/checkbox-control/index.js.map +1 -1
  30. package/build/checkbox-control/types.js +6 -0
  31. package/build/checkbox-control/types.js.map +1 -0
  32. package/build/color-palette/index.js +5 -12
  33. package/build/color-palette/index.js.map +1 -1
  34. package/build/date-time/date.js +43 -19
  35. package/build/date-time/date.js.map +1 -1
  36. package/build/date-time/index.js +28 -3
  37. package/build/date-time/index.js.map +1 -1
  38. package/build/date-time/time.js +42 -40
  39. package/build/date-time/time.js.map +1 -1
  40. package/build/date-time/timezone.js +4 -3
  41. package/build/date-time/timezone.js.map +1 -1
  42. package/build/date-time/types.js +6 -0
  43. package/build/date-time/types.js.map +1 -0
  44. package/build/date-time/utils.js +6 -4
  45. package/build/date-time/utils.js.map +1 -1
  46. package/build/disabled/index.js +1 -1
  47. package/build/disabled/index.js.map +1 -1
  48. package/build/draggable/index.native.js +223 -0
  49. package/build/draggable/index.native.js.map +1 -0
  50. package/build/dropdown/index.js +7 -5
  51. package/build/dropdown/index.js.map +1 -1
  52. package/build/focal-point-picker/index.native.js +3 -3
  53. package/build/focal-point-picker/index.native.js.map +1 -1
  54. package/build/index.js +0 -8
  55. package/build/index.js.map +1 -1
  56. package/build/index.native.js +16 -0
  57. package/build/index.native.js.map +1 -1
  58. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  59. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  60. package/build/mobile/bottom-sheet/index.native.js +1 -1
  61. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  62. package/build/mobile/bottom-sheet-select-control/index.native.js +3 -2
  63. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  64. package/build/mobile/html-text-input/index.native.js +19 -8
  65. package/build/mobile/html-text-input/index.native.js.map +1 -1
  66. package/build/mobile/keyboard-aware-flat-list/index.android.js +28 -5
  67. package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  68. package/build/mobile/keyboard-aware-flat-list/index.ios.js +47 -24
  69. package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  70. package/build/palette-edit/index.js +38 -7
  71. package/build/palette-edit/index.js.map +1 -1
  72. package/build/popover/index.js +223 -277
  73. package/build/popover/index.js.map +1 -1
  74. package/build/resizable-box/resize-tooltip/utils.js +5 -8
  75. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  76. package/build/sandbox/index.native.js +1 -1
  77. package/build/sandbox/index.native.js.map +1 -1
  78. package/build/select-control/styles/select-control-styles.js +14 -11
  79. package/build/select-control/styles/select-control-styles.js.map +1 -1
  80. package/build/toggle-group-control/toggle-group-control/component.js +1 -3
  81. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  82. package/build/tooltip/index.js +2 -2
  83. package/build/tooltip/index.js.map +1 -1
  84. package/build-module/border-box-control/border-box-control/component.js +22 -7
  85. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  86. package/build-module/border-box-control/border-box-control-linked-button/hook.js +3 -2
  87. package/build-module/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
  88. package/build-module/border-box-control/border-box-control-split-controls/component.js +21 -8
  89. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  90. package/build-module/border-box-control/border-box-control-visualizer/hook.js +3 -2
  91. package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  92. package/build-module/border-box-control/styles.js +9 -15
  93. package/build-module/border-box-control/styles.js.map +1 -1
  94. package/build-module/border-control/border-control/component.js +5 -3
  95. package/build-module/border-control/border-control/component.js.map +1 -1
  96. package/build-module/border-control/border-control/hook.js +6 -3
  97. package/build-module/border-control/border-control/hook.js.map +1 -1
  98. package/build-module/border-control/border-control-dropdown/component.js +6 -2
  99. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  100. package/build-module/border-control/border-control-dropdown/hook.js +5 -5
  101. package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
  102. package/build-module/border-control/styles.js +56 -29
  103. package/build-module/border-control/styles.js.map +1 -1
  104. package/build-module/button/index.native.js +16 -3
  105. package/build-module/button/index.native.js.map +1 -1
  106. package/build-module/button-group/index.js +27 -7
  107. package/build-module/button-group/index.js.map +1 -1
  108. package/build-module/{flyout → button-group}/types.js +0 -0
  109. package/build-module/{flyout → button-group}/types.js.map +0 -0
  110. package/build-module/checkbox-control/index.js +31 -7
  111. package/build-module/checkbox-control/index.js.map +1 -1
  112. package/build-module/checkbox-control/types.js +2 -0
  113. package/{build/flyout → build-module/checkbox-control}/types.js.map +0 -0
  114. package/build-module/color-palette/index.js +5 -11
  115. package/build-module/color-palette/index.js.map +1 -1
  116. package/build-module/date-time/date.js +44 -19
  117. package/build-module/date-time/date.js.map +1 -1
  118. package/build-module/date-time/index.js +28 -4
  119. package/build-module/date-time/index.js.map +1 -1
  120. package/build-module/date-time/time.js +43 -41
  121. package/build-module/date-time/time.js.map +1 -1
  122. package/build-module/date-time/timezone.js +4 -3
  123. package/build-module/date-time/timezone.js.map +1 -1
  124. package/build-module/date-time/types.js +2 -0
  125. package/build-module/date-time/types.js.map +1 -0
  126. package/build-module/date-time/utils.js +6 -4
  127. package/build-module/date-time/utils.js.map +1 -1
  128. package/build-module/disabled/index.js +1 -1
  129. package/build-module/disabled/index.js.map +1 -1
  130. package/build-module/draggable/index.native.js +206 -0
  131. package/build-module/draggable/index.native.js.map +1 -0
  132. package/build-module/dropdown/index.js +7 -5
  133. package/build-module/dropdown/index.js.map +1 -1
  134. package/build-module/focal-point-picker/index.native.js +3 -3
  135. package/build-module/focal-point-picker/index.native.js.map +1 -1
  136. package/build-module/index.js +0 -1
  137. package/build-module/index.js.map +1 -1
  138. package/build-module/index.native.js +2 -1
  139. package/build-module/index.native.js.map +1 -1
  140. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  141. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  142. package/build-module/mobile/bottom-sheet/index.native.js +1 -1
  143. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  144. package/build-module/mobile/bottom-sheet-select-control/index.native.js +3 -2
  145. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  146. package/build-module/mobile/html-text-input/index.native.js +20 -9
  147. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  148. package/build-module/mobile/keyboard-aware-flat-list/index.android.js +21 -5
  149. package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  150. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +42 -25
  151. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  152. package/build-module/palette-edit/index.js +37 -7
  153. package/build-module/palette-edit/index.js.map +1 -1
  154. package/build-module/popover/index.js +225 -279
  155. package/build-module/popover/index.js.map +1 -1
  156. package/build-module/resizable-box/resize-tooltip/utils.js +4 -5
  157. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  158. package/build-module/sandbox/index.native.js +1 -1
  159. package/build-module/sandbox/index.native.js.map +1 -1
  160. package/build-module/select-control/styles/select-control-styles.js +14 -11
  161. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  162. package/build-module/toggle-group-control/toggle-group-control/component.js +2 -3
  163. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  164. package/build-module/tooltip/index.js +2 -2
  165. package/build-module/tooltip/index.js.map +1 -1
  166. package/build-style/style-rtl.css +31 -170
  167. package/build-style/style.css +27 -170
  168. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  169. package/build-types/border-box-control/border-box-control/hook.d.ts +3 -1
  170. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  171. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  172. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  173. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +3 -1
  174. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  175. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  176. package/build-types/border-box-control/styles.d.ts +2 -2
  177. package/build-types/border-box-control/styles.d.ts.map +1 -1
  178. package/build-types/border-box-control/types.d.ts +40 -13
  179. package/build-types/border-box-control/types.d.ts.map +1 -1
  180. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  181. package/build-types/border-control/border-control/hook.d.ts +2 -1
  182. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  183. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  184. package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -0
  185. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  186. package/build-types/border-control/styles.d.ts +2 -1
  187. package/build-types/border-control/styles.d.ts.map +1 -1
  188. package/build-types/border-control/types.d.ts +18 -6
  189. package/build-types/border-control/types.d.ts.map +1 -1
  190. package/build-types/button-group/index.d.ts +25 -0
  191. package/build-types/button-group/index.d.ts.map +1 -0
  192. package/build-types/button-group/stories/index.d.ts +12 -0
  193. package/build-types/button-group/stories/index.d.ts.map +1 -0
  194. package/build-types/button-group/types.d.ts +11 -0
  195. package/build-types/button-group/types.d.ts.map +1 -0
  196. package/build-types/checkbox-control/index.d.ts +26 -0
  197. package/build-types/checkbox-control/index.d.ts.map +1 -0
  198. package/build-types/checkbox-control/stories/index.d.ts +13 -0
  199. package/build-types/checkbox-control/stories/index.d.ts.map +1 -0
  200. package/build-types/checkbox-control/types.d.ts +35 -0
  201. package/build-types/checkbox-control/types.d.ts.map +1 -0
  202. package/build-types/color-palette/index.d.ts.map +1 -1
  203. package/build-types/color-picker/styles.d.ts +1 -1
  204. package/build-types/date-time/date.d.ts +24 -0
  205. package/build-types/date-time/date.d.ts.map +1 -0
  206. package/build-types/date-time/index.d.ts +35 -0
  207. package/build-types/date-time/index.d.ts.map +1 -0
  208. package/build-types/date-time/stories/date.d.ts +14 -0
  209. package/build-types/date-time/stories/date.d.ts.map +1 -0
  210. package/build-types/date-time/stories/index.d.ts +14 -0
  211. package/build-types/date-time/stories/index.d.ts.map +1 -0
  212. package/build-types/date-time/stories/time.d.ts +12 -0
  213. package/build-types/date-time/stories/time.d.ts.map +1 -0
  214. package/build-types/date-time/stories/utils.d.ts +3 -0
  215. package/build-types/date-time/stories/utils.d.ts.map +1 -0
  216. package/build-types/date-time/test/date.d.ts +2 -0
  217. package/build-types/date-time/test/date.d.ts.map +1 -0
  218. package/build-types/date-time/test/time.d.ts +2 -0
  219. package/build-types/date-time/test/time.d.ts.map +1 -0
  220. package/build-types/date-time/test/utils.d.ts +2 -0
  221. package/build-types/date-time/test/utils.d.ts.map +1 -0
  222. package/build-types/date-time/time.d.ts +25 -0
  223. package/build-types/date-time/time.d.ts.map +1 -0
  224. package/build-types/date-time/timezone.d.ts +8 -0
  225. package/build-types/date-time/timezone.d.ts.map +1 -0
  226. package/build-types/date-time/types.d.ts +91 -0
  227. package/build-types/date-time/types.d.ts.map +1 -0
  228. package/build-types/date-time/utils.d.ts +15 -0
  229. package/build-types/date-time/utils.d.ts.map +1 -0
  230. package/build-types/dropdown/index.d.ts.map +1 -1
  231. package/build-types/input-control/index.d.ts +1 -1
  232. package/build-types/input-control/stories/index.d.ts +5 -5
  233. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  234. package/build-types/popover/index.d.ts +5 -7
  235. package/build-types/popover/index.d.ts.map +1 -1
  236. package/build-types/resizable-box/index.d.ts +1 -1
  237. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  238. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  239. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  240. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  241. package/build-types/tooltip/index.d.ts.map +1 -1
  242. package/package.json +19 -19
  243. package/src/autocomplete/style.scss +1 -1
  244. package/src/border-box-control/border-box-control/README.md +10 -14
  245. package/src/border-box-control/border-box-control/component.tsx +21 -4
  246. package/src/border-box-control/border-box-control-linked-button/hook.ts +10 -6
  247. package/src/border-box-control/border-box-control-split-controls/component.tsx +24 -7
  248. package/src/border-box-control/border-box-control-visualizer/hook.ts +11 -6
  249. package/src/border-box-control/stories/index.js +1 -0
  250. package/src/border-box-control/styles.ts +15 -8
  251. package/src/border-box-control/types.ts +40 -14
  252. package/src/border-control/border-control/README.md +0 -7
  253. package/src/border-control/border-control/component.tsx +4 -2
  254. package/src/border-control/border-control/hook.ts +5 -2
  255. package/src/border-control/border-control-dropdown/component.tsx +18 -11
  256. package/src/border-control/border-control-dropdown/hook.ts +7 -5
  257. package/src/border-control/stories/index.js +1 -0
  258. package/src/border-control/styles.ts +82 -22
  259. package/src/border-control/types.ts +18 -6
  260. package/src/button/index.native.js +33 -18
  261. package/src/button-group/index.tsx +47 -0
  262. package/src/button-group/stories/index.tsx +41 -0
  263. package/src/button-group/types.ts +11 -0
  264. package/src/checkbox-control/README.md +10 -8
  265. package/src/checkbox-control/{index.js → index.tsx} +49 -14
  266. package/src/checkbox-control/stories/{index.js → index.tsx} +49 -27
  267. package/src/checkbox-control/types.ts +36 -0
  268. package/src/circular-option-picker/style.scss +1 -0
  269. package/src/color-palette/index.js +6 -13
  270. package/src/color-palette/style.scss +3 -18
  271. package/src/date-time/README.md +13 -10
  272. package/src/date-time/{date.js → date.tsx} +49 -20
  273. package/src/date-time/{index.js → index.tsx} +31 -5
  274. package/src/date-time/stories/date.tsx +73 -0
  275. package/src/date-time/stories/index.tsx +75 -0
  276. package/src/date-time/stories/time.tsx +51 -0
  277. package/src/date-time/stories/utils.ts +9 -0
  278. package/src/date-time/test/{date.js → date.tsx} +3 -2
  279. package/src/date-time/test/{time.js → time.tsx} +34 -19
  280. package/src/date-time/test/{utils.js → utils.ts} +1 -1
  281. package/src/date-time/{time.js → time.tsx} +57 -46
  282. package/src/date-time/{timezone.js → timezone.tsx} +4 -3
  283. package/src/date-time/types.ts +106 -0
  284. package/src/date-time/utils.ts +20 -0
  285. package/src/disabled/index.js +1 -1
  286. package/src/draggable/index.native.js +215 -0
  287. package/src/draggable/style.native.scss +3 -0
  288. package/src/dropdown/index.js +9 -4
  289. package/src/dropdown/style.scss +1 -1
  290. package/src/focal-point-picker/index.native.js +3 -3
  291. package/src/form-file-upload/test/index.js +8 -4
  292. package/src/index.js +0 -1
  293. package/src/index.native.js +1 -0
  294. package/src/item-group/stories/index.js +22 -18
  295. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  296. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +1 -1
  297. package/src/mobile/bottom-sheet/index.native.js +1 -1
  298. package/src/mobile/bottom-sheet-select-control/index.native.js +7 -2
  299. package/src/mobile/html-text-input/index.native.js +45 -29
  300. package/src/mobile/html-text-input/style.android.scss +1 -15
  301. package/src/mobile/html-text-input/style.ios.scss +1 -15
  302. package/src/mobile/html-text-input/{style-common.native.scss → style.scss} +16 -0
  303. package/src/mobile/keyboard-aware-flat-list/index.android.js +15 -5
  304. package/src/mobile/keyboard-aware-flat-list/index.ios.js +75 -46
  305. package/src/navigator/stories/index.js +16 -10
  306. package/src/palette-edit/index.js +37 -9
  307. package/src/palette-edit/style.scss +0 -7
  308. package/src/palette-edit/test/index.js +63 -0
  309. package/src/panel/README.md +1 -1
  310. package/src/placeholder/test/index.js +7 -0
  311. package/src/popover/README.md +7 -9
  312. package/src/popover/index.js +242 -371
  313. package/src/popover/style.scss +20 -190
  314. package/src/popover/test/__snapshots__/index.js.snap +6 -18
  315. package/src/resizable-box/resize-tooltip/utils.ts +4 -5
  316. package/src/sandbox/index.native.js +1 -1
  317. package/src/select-control/styles/select-control-styles.ts +6 -3
  318. package/src/tab-panel/style.scss +1 -1
  319. package/src/toggle-group-control/test/__snapshots__/index.js.snap +4 -10
  320. package/src/toggle-group-control/toggle-group-control/component.tsx +7 -3
  321. package/src/tooltip/index.js +8 -2
  322. package/src/tooltip/style.scss +2 -4
  323. package/src/tooltip/test/index.native.js +1 -1
  324. package/src/unit-control/test/index.tsx +84 -4
  325. package/tsconfig.json +6 -2
  326. package/tsconfig.tsbuildinfo +1 -1
  327. package/build/flyout/context.js +0 -23
  328. package/build/flyout/context.js.map +0 -1
  329. package/build/flyout/flyout/component.js +0 -106
  330. package/build/flyout/flyout/component.js.map +0 -1
  331. package/build/flyout/flyout/hook.js +0 -53
  332. package/build/flyout/flyout/hook.js.map +0 -1
  333. package/build/flyout/flyout/index.js +0 -24
  334. package/build/flyout/flyout/index.js.map +0 -1
  335. package/build/flyout/flyout-content/component.js +0 -65
  336. package/build/flyout/flyout-content/component.js.map +0 -1
  337. package/build/flyout/flyout-content/index.js +0 -16
  338. package/build/flyout/flyout-content/index.js.map +0 -1
  339. package/build/flyout/index.js +0 -16
  340. package/build/flyout/index.js.map +0 -1
  341. package/build/flyout/styles.js +0 -46
  342. package/build/flyout/styles.js.map +0 -1
  343. package/build/flyout/utils.js +0 -36
  344. package/build/flyout/utils.js.map +0 -1
  345. package/build/mobile/html-text-input/container.android.js +0 -41
  346. package/build/mobile/html-text-input/container.android.js.map +0 -1
  347. package/build/mobile/html-text-input/container.ios.js +0 -60
  348. package/build/mobile/html-text-input/container.ios.js.map +0 -1
  349. package/build/popover/utils.js +0 -322
  350. package/build/popover/utils.js.map +0 -1
  351. package/build-module/flyout/context.js +0 -11
  352. package/build-module/flyout/context.js.map +0 -1
  353. package/build-module/flyout/flyout/component.js +0 -89
  354. package/build-module/flyout/flyout/component.js.map +0 -1
  355. package/build-module/flyout/flyout/hook.js +0 -44
  356. package/build-module/flyout/flyout/hook.js.map +0 -1
  357. package/build-module/flyout/flyout/index.js +0 -3
  358. package/build-module/flyout/flyout/index.js.map +0 -1
  359. package/build-module/flyout/flyout-content/component.js +0 -51
  360. package/build-module/flyout/flyout-content/component.js.map +0 -1
  361. package/build-module/flyout/flyout-content/index.js +0 -2
  362. package/build-module/flyout/flyout-content/index.js.map +0 -1
  363. package/build-module/flyout/index.js +0 -2
  364. package/build-module/flyout/index.js.map +0 -1
  365. package/build-module/flyout/styles.js +0 -27
  366. package/build-module/flyout/styles.js.map +0 -1
  367. package/build-module/flyout/utils.js +0 -25
  368. package/build-module/flyout/utils.js.map +0 -1
  369. package/build-module/mobile/html-text-input/container.android.js +0 -29
  370. package/build-module/mobile/html-text-input/container.android.js.map +0 -1
  371. package/build-module/mobile/html-text-input/container.ios.js +0 -48
  372. package/build-module/mobile/html-text-input/container.ios.js.map +0 -1
  373. package/build-module/popover/utils.js +0 -308
  374. package/build-module/popover/utils.js.map +0 -1
  375. package/build-types/flyout/context.d.ts +0 -6
  376. package/build-types/flyout/context.d.ts.map +0 -1
  377. package/build-types/flyout/flyout/component.d.ts +0 -21
  378. package/build-types/flyout/flyout/component.d.ts.map +0 -1
  379. package/build-types/flyout/flyout/hook.d.ts +0 -270
  380. package/build-types/flyout/flyout/hook.d.ts.map +0 -1
  381. package/build-types/flyout/flyout/index.d.ts +0 -3
  382. package/build-types/flyout/flyout/index.d.ts.map +0 -1
  383. package/build-types/flyout/flyout-content/component.d.ts +0 -3
  384. package/build-types/flyout/flyout-content/component.d.ts.map +0 -1
  385. package/build-types/flyout/flyout-content/index.d.ts +0 -2
  386. package/build-types/flyout/flyout-content/index.d.ts.map +0 -1
  387. package/build-types/flyout/index.d.ts +0 -2
  388. package/build-types/flyout/index.d.ts.map +0 -1
  389. package/build-types/flyout/styles.d.ts +0 -22
  390. package/build-types/flyout/styles.d.ts.map +0 -1
  391. package/build-types/flyout/types.d.ts +0 -80
  392. package/build-types/flyout/types.d.ts.map +0 -1
  393. package/build-types/flyout/utils.d.ts +0 -8
  394. package/build-types/flyout/utils.d.ts.map +0 -1
  395. package/build-types/popover/utils.d.ts +0 -70
  396. package/build-types/popover/utils.d.ts.map +0 -1
  397. package/src/button-group/index.js +0 -17
  398. package/src/button-group/stories/index.js +0 -21
  399. package/src/date-time/stories/date.js +0 -17
  400. package/src/date-time/stories/index.js +0 -91
  401. package/src/date-time/stories/time.js +0 -32
  402. package/src/date-time/utils.js +0 -18
  403. package/src/flyout/context.js +0 -10
  404. package/src/flyout/flyout/README.md +0 -98
  405. package/src/flyout/flyout/component.js +0 -111
  406. package/src/flyout/flyout/hook.js +0 -45
  407. package/src/flyout/flyout/index.js +0 -2
  408. package/src/flyout/flyout-content/component.js +0 -53
  409. package/src/flyout/flyout-content/index.js +0 -1
  410. package/src/flyout/index.js +0 -1
  411. package/src/flyout/stories/index.js +0 -24
  412. package/src/flyout/styles.ts +0 -41
  413. package/src/flyout/test/__snapshots__/index.js.snap +0 -186
  414. package/src/flyout/test/index.js +0 -103
  415. package/src/flyout/types.ts +0 -84
  416. package/src/flyout/utils.js +0 -23
  417. package/src/mobile/html-text-input/container.android.js +0 -23
  418. package/src/mobile/html-text-input/container.ios.js +0 -50
  419. package/src/popover/test/utils.js +0 -304
  420. package/src/popover/utils.js +0 -396
@@ -6,19 +6,19 @@ import { createElement } from "@wordpress/element";
6
6
  * External dependencies
7
7
  */
8
8
  import classnames from 'classnames';
9
+ import { useFloating, flip, shift, autoUpdate, arrow, offset as offsetMiddleware, limitShift, size } from '@floating-ui/react-dom';
9
10
  /**
10
11
  * WordPress dependencies
11
12
  */
12
13
 
13
- import { useRef, useState, useLayoutEffect, forwardRef, createContext, useContext } from '@wordpress/element';
14
- import { getRectangleFromRange } from '@wordpress/dom';
15
- import { useViewportMatch, useResizeObserver, useMergeRefs, __experimentalUseDialog as useDialog } from '@wordpress/compose';
14
+ import { useRef, useLayoutEffect, forwardRef, createContext, useContext, useMemo } from '@wordpress/element';
15
+ import { useViewportMatch, useMergeRefs, __experimentalUseDialog as useDialog } from '@wordpress/compose';
16
16
  import { close } from '@wordpress/icons';
17
+ import deprecated from '@wordpress/deprecated';
17
18
  /**
18
19
  * Internal dependencies
19
20
  */
20
21
 
21
- import { computePopoverPosition, offsetIframe } from './utils';
22
22
  import Button from '../button';
23
23
  import ScrollLock from '../scroll-lock';
24
24
  import { Slot, Fill, useSlot } from '../slot-fill';
@@ -32,322 +32,167 @@ import { getAnimateClassName } from '../animate';
32
32
  const SLOT_NAME = 'Popover';
33
33
  const slotNameContext = createContext();
34
34
 
35
- function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
36
- let anchorRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
37
- let container = arguments.length > 4 ? arguments[4] : undefined;
35
+ const positionToPlacement = position => {
36
+ const [x, y, z] = position.split(' ');
38
37
 
39
- if (anchorRect) {
40
- return anchorRect;
41
- }
38
+ if (['top', 'bottom'].includes(x)) {
39
+ let suffix = '';
42
40
 
43
- if (getAnchorRect) {
44
- if (!anchorRefFallback.current) {
45
- return;
41
+ if (!!z && z === 'left' || y === 'right') {
42
+ suffix = '-start';
43
+ } else if (!!z && z === 'right' || y === 'left') {
44
+ suffix = '-end';
46
45
  }
47
46
 
48
- const rect = getAnchorRect(anchorRefFallback.current);
49
- return offsetIframe(rect, rect.ownerDocument || anchorRefFallback.current.ownerDocument, container);
47
+ return x + suffix;
50
48
  }
51
49
 
52
- if (anchorRef !== false) {
53
- if (!anchorRef || !window.Range || !window.Element || !window.DOMRect) {
54
- return;
55
- } // Duck-type to check if `anchorRef` is an instance of Range
56
- // `anchorRef instanceof window.Range` checks will break across document boundaries
57
- // such as in an iframe.
58
-
50
+ return y;
51
+ };
59
52
 
60
- if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.cloneRange) === 'function') {
61
- return offsetIframe(getRectangleFromRange(anchorRef), anchorRef.endContainer.ownerDocument, container);
62
- } // Duck-type to check if `anchorRef` is an instance of Element
63
- // `anchorRef instanceof window.Element` checks will break across document boundaries
64
- // such as in an iframe.
53
+ const placementToAnimationOrigin = placement => {
54
+ const [a, b] = placement.split('-');
55
+ let x, y;
65
56
 
57
+ if (a === 'top' || a === 'bottom') {
58
+ x = a === 'top' ? 'bottom' : 'top';
59
+ y = 'middle';
66
60
 
67
- if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.getBoundingClientRect) === 'function') {
68
- const rect = offsetIframe(anchorRef.getBoundingClientRect(), anchorRef.ownerDocument, container);
69
- return rect;
61
+ if (b === 'start') {
62
+ y = 'left';
63
+ } else if (b === 'end') {
64
+ y = 'right';
70
65
  }
71
-
72
- const {
73
- top,
74
- bottom
75
- } = anchorRef;
76
- const topRect = top.getBoundingClientRect();
77
- const bottomRect = bottom.getBoundingClientRect();
78
- return offsetIframe(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument, container);
79
66
  }
80
67
 
81
- if (!anchorRefFallback.current) {
82
- return;
83
- }
84
-
85
- const {
86
- parentNode
87
- } = anchorRefFallback.current;
88
- return offsetIframe(parentNode.getBoundingClientRect(), parentNode.ownerDocument, container);
89
- }
90
- /**
91
- * Sets or removes an element attribute.
92
- *
93
- * @param {Element} element The element to modify.
94
- * @param {string} name The attribute name to set or remove.
95
- * @param {?string} value The value to set. A falsy value will remove the
96
- * attribute.
97
- */
98
-
68
+ if (a === 'left' || a === 'right') {
69
+ x = 'center';
70
+ y = a === 'left' ? 'right' : 'left';
99
71
 
100
- function setAttribute(element, name, value) {
101
- if (!value) {
102
- if (element.hasAttribute(name)) {
103
- element.removeAttribute(name);
72
+ if (b === 'start') {
73
+ x = 'top';
74
+ } else if (b === 'end') {
75
+ x = 'bottom';
104
76
  }
105
- } else if (element.getAttribute(name) !== value) {
106
- element.setAttribute(name, value);
107
77
  }
108
- }
109
- /**
110
- * Sets or removes an element style property.
111
- *
112
- * @param {Element} element The element to modify.
113
- * @param {string} property The property to set or remove.
114
- * @param {?string} value The value to set. A falsy value will remove the
115
- * property.
116
- */
117
-
118
-
119
- function setStyle(element, property) {
120
- let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
121
-
122
- if (element.style[property] !== value) {
123
- element.style[property] = value;
124
- }
125
- }
126
- /**
127
- * Sets or removes an element class.
128
- *
129
- * @param {Element} element The element to modify.
130
- * @param {string} name The class to set or remove.
131
- * @param {boolean} toggle True to set the class, false to remove.
132
- */
133
-
134
78
 
135
- function setClass(element, name, toggle) {
136
- if (toggle) {
137
- if (!element.classList.contains(name)) {
138
- element.classList.add(name);
139
- }
140
- } else if (element.classList.contains(name)) {
141
- element.classList.remove(name);
142
- }
143
- }
144
-
145
- function getAnchorDocument(anchor) {
146
- if (!anchor) {
147
- return;
148
- }
149
-
150
- if (anchor.endContainer) {
151
- return anchor.endContainer.ownerDocument;
152
- }
153
-
154
- if (anchor.top) {
155
- return anchor.top.ownerDocument;
156
- }
157
-
158
- return anchor.ownerDocument;
159
- }
79
+ return x + ' ' + y;
80
+ };
160
81
 
161
82
  const Popover = (_ref, ref) => {
162
83
  let {
84
+ range,
85
+ animate = true,
163
86
  headerTitle,
164
87
  onClose,
165
88
  children,
166
89
  className,
167
90
  noArrow = true,
168
91
  isAlternate,
169
- // Disable reason: We generate the `...contentProps` rest as remainder
170
- // of props which aren't explicitly handled by this component.
171
-
172
- /* eslint-disable no-unused-vars */
173
- position = 'bottom right',
174
- range,
92
+ position,
93
+ placement = 'bottom-start',
94
+ offset,
175
95
  focusOnMount = 'firstElement',
176
96
  anchorRef,
177
97
  anchorRect,
178
98
  getAnchorRect,
179
99
  expandOnMobile,
180
- animate = true,
181
100
  onFocusOutside,
182
- __unstableStickyBoundaryElement,
183
101
  __unstableSlotName = SLOT_NAME,
184
102
  __unstableObserveElement,
185
- __unstableBoundaryParent,
186
103
  __unstableForcePosition,
187
- __unstableForceXAlignment,
188
- __unstableEditorCanvasWrapper,
189
-
190
- /* eslint-enable no-unused-vars */
191
104
  ...contentProps
192
105
  } = _ref;
193
- const anchorRefFallback = useRef(null);
194
- const contentRef = useRef(null);
195
- const containerRef = useRef();
196
- const isMobileViewport = useViewportMatch('medium', '<');
197
- const [animateOrigin, setAnimateOrigin] = useState();
198
106
 
199
- const slotName = useContext(slotNameContext) || __unstableSlotName;
107
+ if (range) {
108
+ deprecated('range prop in Popover component', {
109
+ since: '6.1',
110
+ version: '6.3'
111
+ });
112
+ }
200
113
 
201
- const slot = useSlot(slotName);
114
+ const arrowRef = useRef(null);
115
+ const isMobileViewport = useViewportMatch('medium', '<');
202
116
  const isExpanded = expandOnMobile && isMobileViewport;
203
- const [containerResizeListener, contentSize] = useResizeObserver();
204
- noArrow = isExpanded || noArrow;
205
- useLayoutEffect(() => {
206
- if (isExpanded) {
207
- setClass(containerRef.current, 'is-without-arrow', noArrow);
208
- setClass(containerRef.current, 'is-alternate', isAlternate);
209
- setAttribute(containerRef.current, 'data-x-axis');
210
- setAttribute(containerRef.current, 'data-y-axis');
211
- setStyle(containerRef.current, 'top');
212
- setStyle(containerRef.current, 'left');
213
- setStyle(contentRef.current, 'maxHeight');
214
- setStyle(contentRef.current, 'maxWidth');
215
- return;
117
+ const hasArrow = !isExpanded && !noArrow;
118
+ const usedPlacement = position ? positionToPlacement(position) : placement;
119
+ /**
120
+ * Offsets the the position of the popover when the anchor is inside an iframe.
121
+ */
122
+
123
+ const frameOffset = useMemo(() => {
124
+ let ownerDocument = document;
125
+
126
+ if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
127
+ ownerDocument = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
128
+ } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.startContainer) {
129
+ ownerDocument = anchorRef.startContainer.ownerDocument;
130
+ } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
131
+ ownerDocument = anchorRef.current.ownerDocument;
132
+ } else if (anchorRef) {
133
+ // This one should be deprecated.
134
+ ownerDocument = anchorRef.ownerDocument;
135
+ } else if (anchorRect && anchorRect !== null && anchorRect !== void 0 && anchorRect.ownerDocument) {
136
+ ownerDocument = anchorRect.ownerDocument;
137
+ } else if (getAnchorRect) {
138
+ var _getAnchorRect$ownerD, _getAnchorRect;
139
+
140
+ ownerDocument = (_getAnchorRect$ownerD = (_getAnchorRect = getAnchorRect()) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument) !== null && _getAnchorRect$ownerD !== void 0 ? _getAnchorRect$ownerD : document;
216
141
  }
217
142
 
218
- const refresh = () => {
219
- if (!containerRef.current || !contentRef.current) {
220
- return;
221
- }
222
-
223
- let anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, containerRef.current);
224
-
225
- if (!anchor) {
226
- return;
227
- }
228
-
229
- const {
230
- offsetParent,
231
- ownerDocument
232
- } = containerRef.current;
233
- let relativeOffsetTop = 0; // If there is a positioned ancestor element that is not the body,
234
- // subtract the position from the anchor rect. If the position of
235
- // the popover is fixed, the offset parent is null or the body
236
- // element, in which case the position is relative to the viewport.
237
- // See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
238
-
239
- if (offsetParent && offsetParent !== ownerDocument.body) {
240
- const offsetParentRect = offsetParent.getBoundingClientRect();
241
- relativeOffsetTop = offsetParentRect.top;
242
- anchor = new window.DOMRect(anchor.left - offsetParentRect.left, anchor.top - offsetParentRect.top, anchor.width, anchor.height);
243
- }
244
-
245
- let boundaryElement;
246
-
247
- if (__unstableBoundaryParent) {
248
- boundaryElement = containerRef.current.parentElement;
249
- }
250
-
251
- const usedContentSize = !contentSize.height ? contentRef.current.getBoundingClientRect() : contentSize;
252
- const {
253
- popoverTop,
254
- popoverLeft,
255
- xAxis,
256
- yAxis,
257
- contentHeight,
258
- contentWidth
259
- } = computePopoverPosition(anchor, usedContentSize, position, __unstableStickyBoundaryElement, containerRef.current, relativeOffsetTop, boundaryElement, __unstableForcePosition, __unstableForceXAlignment, __unstableEditorCanvasWrapper);
260
-
261
- if (typeof popoverTop === 'number' && typeof popoverLeft === 'number') {
262
- setStyle(containerRef.current, 'top', popoverTop + 'px');
263
- setStyle(containerRef.current, 'left', popoverLeft + 'px');
264
- }
265
-
266
- setClass(containerRef.current, 'is-without-arrow', noArrow || xAxis === 'center' && yAxis === 'middle');
267
- setClass(containerRef.current, 'is-alternate', isAlternate);
268
- setAttribute(containerRef.current, 'data-x-axis', xAxis);
269
- setAttribute(containerRef.current, 'data-y-axis', yAxis);
270
- setStyle(contentRef.current, 'maxHeight', typeof contentHeight === 'number' ? contentHeight + 'px' : '');
271
- setStyle(contentRef.current, 'maxWidth', typeof contentWidth === 'number' ? contentWidth + 'px' : ''); // Compute the animation position.
272
-
273
- const yAxisMapping = {
274
- top: 'bottom',
275
- bottom: 'top'
276
- };
277
- const xAxisMapping = {
278
- left: 'right',
279
- right: 'left'
280
- };
281
- const animateYAxis = yAxisMapping[yAxis] || 'middle';
282
- const animateXAxis = xAxisMapping[xAxis] || 'center';
283
- setAnimateOrigin(animateXAxis + ' ' + animateYAxis);
284
- };
285
-
286
- refresh();
287
- const {
288
- ownerDocument
289
- } = containerRef.current;
290
143
  const {
291
144
  defaultView
292
145
  } = ownerDocument;
293
- /*
294
- * There are sometimes we need to reposition or resize the popover that
295
- * are not handled by the resize/scroll window events (i.e. CSS changes
296
- * in the layout that changes the position of the anchor).
297
- *
298
- * For these situations, we refresh the popover every 0.5s
299
- */
300
-
301
- const intervalHandle = defaultView.setInterval(refresh, 500);
302
- let rafId;
303
-
304
- const refreshOnAnimationFrame = () => {
305
- defaultView.cancelAnimationFrame(rafId);
306
- rafId = defaultView.requestAnimationFrame(refresh);
307
- }; // Sometimes a click trigger a layout change that affects the popover
308
- // position. This is an opportunity to immediately refresh rather than
309
- // at the interval.
310
-
311
-
312
- defaultView.addEventListener('click', refreshOnAnimationFrame);
313
- defaultView.addEventListener('resize', refresh);
314
- defaultView.addEventListener('scroll', refresh, true);
315
- const anchorDocument = getAnchorDocument(anchorRef); // If the anchor is within an iframe, the popover position also needs
316
- // to refrest when the iframe content is scrolled or resized.
317
-
318
- if (anchorDocument && anchorDocument !== ownerDocument) {
319
- anchorDocument.defaultView.addEventListener('resize', refresh);
320
- anchorDocument.defaultView.addEventListener('scroll', refresh, true);
146
+ const {
147
+ frameElement
148
+ } = defaultView;
149
+
150
+ if (!frameElement || ownerDocument === document) {
151
+ return undefined;
321
152
  }
322
153
 
323
- let observer;
154
+ const iframeRect = frameElement.getBoundingClientRect();
155
+ return {
156
+ name: 'iframeOffset',
157
+
158
+ fn(_ref2) {
159
+ let {
160
+ x,
161
+ y
162
+ } = _ref2;
163
+ return {
164
+ x: x + iframeRect.left,
165
+ y: y + iframeRect.top
166
+ };
167
+ }
324
168
 
325
- if (__unstableObserveElement) {
326
- observer = new defaultView.MutationObserver(refresh);
327
- observer.observe(__unstableObserveElement, {
328
- attributes: true
169
+ };
170
+ }, [anchorRef, anchorRect, getAnchorRect]);
171
+ const middlewares = [frameOffset, offset ? offsetMiddleware(offset) : undefined, __unstableForcePosition ? undefined : flip(), __unstableForcePosition ? undefined : size({
172
+ apply(_ref3) {
173
+ let {
174
+ width,
175
+ height
176
+ } = _ref3;
177
+ if (!refs.floating.current) return;
178
+ Object.assign(refs.floating.current.firstChild.style, {
179
+ maxWidth: `${width}px`,
180
+ maxHeight: `${height}px`,
181
+ overflow: 'auto'
329
182
  });
330
183
  }
331
184
 
332
- return () => {
333
- defaultView.clearInterval(intervalHandle);
334
- defaultView.removeEventListener('resize', refresh);
335
- defaultView.removeEventListener('scroll', refresh, true);
336
- defaultView.removeEventListener('click', refreshOnAnimationFrame);
337
- defaultView.cancelAnimationFrame(rafId);
338
-
339
- if (anchorDocument && anchorDocument !== ownerDocument) {
340
- var _anchorDocument$defau, _anchorDocument$defau2;
185
+ }),, shift({
186
+ crossAxis: true,
187
+ limiter: limitShift()
188
+ }), hasArrow ? arrow({
189
+ element: arrowRef
190
+ }) : undefined].filter(m => !!m);
191
+ const anchorRefFallback = useRef(null);
341
192
 
342
- (_anchorDocument$defau = anchorDocument.defaultView) === null || _anchorDocument$defau === void 0 ? void 0 : _anchorDocument$defau.removeEventListener('resize', refresh);
343
- (_anchorDocument$defau2 = anchorDocument.defaultView) === null || _anchorDocument$defau2 === void 0 ? void 0 : _anchorDocument$defau2.removeEventListener('scroll', refresh, true);
344
- }
193
+ const slotName = useContext(slotNameContext) || __unstableSlotName;
345
194
 
346
- if (observer) {
347
- observer.disconnect();
348
- }
349
- };
350
- }, [isExpanded, anchorRect, getAnchorRect, anchorRef, position, contentSize, __unstableStickyBoundaryElement, __unstableObserveElement, __unstableBoundaryParent]);
195
+ const slot = useSlot(slotName);
351
196
 
352
197
  const onDialogClose = (type, event) => {
353
198
  // Ideally the popover should have just a single onClose prop and
@@ -364,12 +209,104 @@ const Popover = (_ref, ref) => {
364
209
  __unstableOnClose: onDialogClose,
365
210
  onClose: onDialogClose
366
211
  });
367
- const mergedRefs = useMergeRefs([containerRef, dialogRef, ref]);
212
+ const {
213
+ x,
214
+ y,
215
+ reference,
216
+ floating,
217
+ strategy,
218
+ refs,
219
+ update,
220
+ placement: placementData,
221
+ middlewareData: {
222
+ arrow: arrowData = {}
223
+ }
224
+ } = useFloating({
225
+ placement: usedPlacement,
226
+ middleware: middlewares
227
+ });
228
+ const staticSide = {
229
+ top: 'bottom',
230
+ right: 'left',
231
+ bottom: 'top',
232
+ left: 'right'
233
+ }[placementData.split('-')[0]];
234
+ const mergedRefs = useMergeRefs([floating, dialogRef, ref]); // Updates references
235
+
236
+ useLayoutEffect(() => {
237
+ // No ref or position have been passed
238
+ let usedRef;
239
+
240
+ if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
241
+ usedRef = {
242
+ getBoundingClientRect() {
243
+ const topRect = anchorRef.top.getBoundingClientRect();
244
+ const bottomRect = anchorRef.bottom.getBoundingClientRect();
245
+ return new window.DOMRect(topRect.x, topRect.y, topRect.width, bottomRect.bottom - topRect.top);
246
+ }
247
+
248
+ };
249
+ } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
250
+ usedRef = anchorRef.current;
251
+ } else if (anchorRef) {
252
+ usedRef = anchorRef;
253
+ } else if (anchorRect) {
254
+ usedRef = {
255
+ getBoundingClientRect() {
256
+ return anchorRect;
257
+ }
258
+
259
+ };
260
+ } else if (getAnchorRect) {
261
+ usedRef = {
262
+ getBoundingClientRect() {
263
+ var _rect$x, _rect$y, _rect$height, _rect$width;
264
+
265
+ const rect = getAnchorRect();
266
+ return { ...rect,
267
+ x: (_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left,
268
+ y: (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top,
269
+ height: (_rect$height = rect.height) !== null && _rect$height !== void 0 ? _rect$height : rect.bottom - rect.top,
270
+ width: (_rect$width = rect.width) !== null && _rect$width !== void 0 ? _rect$width : rect.right - rect.left
271
+ };
272
+ }
273
+
274
+ };
275
+ } else if (anchorRefFallback.current) {
276
+ usedRef = anchorRefFallback.current;
277
+ }
278
+
279
+ if (!usedRef) {
280
+ return;
281
+ }
282
+
283
+ reference(usedRef);
284
+
285
+ if (!refs.floating.current) {
286
+ return;
287
+ }
288
+
289
+ return autoUpdate(usedRef, refs.floating.current, update);
290
+ }, [anchorRef, anchorRect, getAnchorRect]); // This is only needed for a smoth transition when moving blocks.
291
+
292
+ useLayoutEffect(() => {
293
+ if (!__unstableObserveElement) {
294
+ return;
295
+ }
296
+
297
+ const observer = new window.MutationObserver(update);
298
+ observer.observe(__unstableObserveElement, {
299
+ attributes: true
300
+ });
301
+ return () => {
302
+ observer.disconnect();
303
+ };
304
+ }, [__unstableObserveElement]);
368
305
  /** @type {false | string} */
369
306
 
370
- const animateClassName = Boolean(animate && animateOrigin) && getAnimateClassName({
307
+ const animateClassName = !!animate && getAnimateClassName({
371
308
  type: 'appear',
372
- origin: animateOrigin
309
+ origin: placementToAnimationOrigin(placementData)
373
310
  }); // Disable reason: We care to capture the _bubbled_ events from inputs
374
311
  // within popover as inferring close intent.
375
312
 
@@ -378,13 +315,17 @@ const Popover = (_ref, ref) => {
378
315
  createElement("div", _extends({
379
316
  className: classnames('components-popover', className, animateClassName, {
380
317
  'is-expanded': isExpanded,
381
- 'is-without-arrow': noArrow,
382
318
  'is-alternate': isAlternate
383
319
  })
384
320
  }, contentProps, {
385
321
  ref: mergedRefs
386
322
  }, dialogProps, {
387
- tabIndex: "-1"
323
+ tabIndex: "-1",
324
+ style: isExpanded ? undefined : {
325
+ position: strategy,
326
+ left: Number.isNaN(x) ? 0 : x,
327
+ top: Number.isNaN(y) ? 0 : y
328
+ }
388
329
  }), isExpanded && createElement(ScrollLock, null), isExpanded && createElement("div", {
389
330
  className: "components-popover__header"
390
331
  }, createElement("span", {
@@ -394,13 +335,18 @@ const Popover = (_ref, ref) => {
394
335
  icon: close,
395
336
  onClick: onClose
396
337
  })), createElement("div", {
397
- ref: contentRef,
398
338
  className: "components-popover__content"
399
- }, createElement("div", {
339
+ }, children), hasArrow && createElement("div", {
340
+ className: "components-popover__arrow",
341
+ ref: arrowRef,
400
342
  style: {
401
- position: 'relative'
343
+ left: !(arrowData !== null && arrowData !== void 0 && arrowData.x) || Number.isNaN(arrowData === null || arrowData === void 0 ? void 0 : arrowData.x) ? 0 : arrowData.x,
344
+ top: !(arrowData !== null && arrowData !== void 0 && arrowData.y) || Number.isNaN(arrowData === null || arrowData === void 0 ? void 0 : arrowData.y) ? 0 : arrowData.y,
345
+ right: undefined,
346
+ bottom: undefined,
347
+ [staticSide]: '-4px'
402
348
  }
403
- }, containerResizeListener, children)));
349
+ }));
404
350
 
405
351
  if (slot.ref) {
406
352
  content = createElement(Fill, {
@@ -419,10 +365,10 @@ const Popover = (_ref, ref) => {
419
365
 
420
366
  const PopoverContainer = forwardRef(Popover);
421
367
 
422
- function PopoverSlot(_ref2, ref) {
368
+ function PopoverSlot(_ref4, ref) {
423
369
  let {
424
370
  name = SLOT_NAME
425
- } = _ref2;
371
+ } = _ref4;
426
372
  return createElement(Slot, {
427
373
  bubblesVirtually: true,
428
374
  name: name,