@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
@@ -9,12 +9,52 @@ import { more } from '@wordpress/icons';
9
9
  const MyPlaceholder = () => <Placeholder icon={ more } label="Placeholder" />;
10
10
  ```
11
11
 
12
- ### Props
13
-
14
- | Name | Type | Default | Description |
15
- | ---------------- | ------------------- | ----------- | ----------------------------------------------------------------- |
16
- | `icon` | `string, WPElement` | `undefined` | If provided, renders an icon next to the label. |
17
- | `label` | `string` | `undefined` | Renders a label for the placeholder. |
18
- | `instructions` | `string` | `undefined` | Renders instruction text below label. |
19
- | `isColumnLayout` | `bool` | `false` | Changes placeholder children layout from flex-row to flex-column. |
20
- | `withIllustration`| `bool` | `false` | Outputs a placeholder illustration. |
12
+ ## Props
13
+
14
+ ### `className`: `string`
15
+
16
+ Class to set on the container div.
17
+
18
+ - Required: No
19
+
20
+ ### `icon`: `string|Function|WPComponent|null`
21
+
22
+ If provided, renders an icon next to the label.
23
+
24
+ - Required: No
25
+
26
+ ### `instructions`: `string`
27
+
28
+ Instructions of the placeholder.
29
+
30
+ - Required: No
31
+
32
+ ### `isColumnLayout`: `boolean`
33
+
34
+ Changes placeholder children layout from flex-row to flex-column.
35
+
36
+ - Required: No
37
+
38
+ ### `label`: `string`
39
+
40
+ Title of the placeholder.
41
+
42
+ - Required: Yes
43
+
44
+ ### `notices`: `ReactNode`
45
+
46
+ A rendered notices list
47
+
48
+ - Required: No
49
+
50
+ ### `preview`: `ReactNode`
51
+
52
+ Preview to be rendered in the placeholder.
53
+
54
+ - Required: No
55
+
56
+ ### `withIllustration`: `boolean`
57
+
58
+ Outputs a placeholder illustration.
59
+
60
+ - Required: No
@@ -13,6 +13,8 @@ import { SVG, Path } from '@wordpress/primitives';
13
13
  * Internal dependencies
14
14
  */
15
15
  import Icon from '../icon';
16
+ import type { PlaceholderProps } from './types';
17
+ import type { WordPressComponentProps } from '../ui/context';
16
18
 
17
19
  const PlaceholderIllustration = (
18
20
  <SVG
@@ -29,31 +31,33 @@ const PlaceholderIllustration = (
29
31
  /**
30
32
  * Renders a placeholder. Normally used by blocks to render their empty state.
31
33
  *
32
- * @param {Object} props The component props.
33
- * @param {WPIcon} props.icon An icon rendered before the label.
34
- * @param {WPElement} props.children Children to be rendered.
35
- * @param {string} props.label Title of the placeholder.
36
- * @param {string} props.instructions Instructions of the placeholder.
37
- * @param {string} props.className Class to set on the container div.
38
- * @param {Object} props.notices A rendered notices list.
39
- * @param {Object} props.preview Preview to be rendered in the placeholder.
40
- * @param {boolean} props.isColumnLayout Whether a column layout should be used.
41
- * @param {boolean} props.withIllustration Whether to add an illustration to the placeholder.
34
+ * ```jsx
35
+ * import { Placeholder } from '@wordpress/components';
36
+ * import { more } from '@wordpress/icons';
42
37
  *
43
- * @return {Object} The rendered placeholder.
38
+ * const MyPlaceholder = () => <Placeholder icon={ more } label="Placeholder" />;
39
+ * ```
44
40
  */
45
- function Placeholder( {
46
- icon,
47
- children,
48
- label,
49
- instructions,
50
- className,
51
- notices,
52
- preview,
53
- isColumnLayout,
54
- withIllustration,
55
- ...additionalProps
56
- } ) {
41
+ export function Placeholder< IconProps = unknown >(
42
+ // ref is omitted until we have `WordPressComponentPropsWithoutRef` or add
43
+ // ref forwarding to Placeholder.
44
+ props: Omit<
45
+ WordPressComponentProps< PlaceholderProps< IconProps >, 'div', false >,
46
+ 'ref'
47
+ >
48
+ ) {
49
+ const {
50
+ icon,
51
+ children,
52
+ label,
53
+ instructions,
54
+ className,
55
+ notices,
56
+ preview,
57
+ isColumnLayout,
58
+ withIllustration,
59
+ ...additionalProps
60
+ } = props;
57
61
  const [ resizeListener, { width } ] = useResizeObserver();
58
62
 
59
63
  // Since `useResizeObserver` will report a width of `null` until after the
@@ -0,0 +1,64 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { starEmpty, starFilled, styles, wordpress } from '@wordpress/icons';
10
+ import { useState } from '@wordpress/element';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import Placeholder from '../';
16
+ import TextControl from '../../text-control';
17
+
18
+ const ICONS = { starEmpty, starFilled, styles, wordpress };
19
+
20
+ const meta: ComponentMeta< typeof Placeholder > = {
21
+ component: Placeholder,
22
+ title: 'Components/Placeholder',
23
+ argTypes: {
24
+ children: { control: { type: null } },
25
+ notices: { control: { type: null } },
26
+ preview: { control: { type: null } },
27
+ icon: {
28
+ control: { type: 'select' },
29
+ options: Object.keys( ICONS ),
30
+ mapping: ICONS,
31
+ },
32
+ },
33
+ parameters: {
34
+ controls: { expanded: true },
35
+ docs: { source: { state: 'open' } },
36
+ },
37
+ };
38
+ export default meta;
39
+
40
+ const Template: ComponentStory< typeof Placeholder > = ( args ) => {
41
+ const [ value, setValue ] = useState( '' );
42
+
43
+ return (
44
+ <Placeholder { ...args }>
45
+ <div>
46
+ <TextControl
47
+ label="Sample Field"
48
+ placeholder="Enter something here"
49
+ value={ value }
50
+ onChange={ setValue }
51
+ />
52
+ </div>
53
+ </Placeholder>
54
+ );
55
+ };
56
+
57
+ export const Default: ComponentStory< typeof Placeholder > = Template.bind(
58
+ {}
59
+ );
60
+ Default.args = {
61
+ icon: 'wordpress',
62
+ label: 'My Placeholder Label',
63
+ instructions: 'Here are instructions you should follow',
64
+ };
@@ -27,10 +27,6 @@
27
27
  box-shadow: inset 0 0 0 $border-width $gray-900;
28
28
  outline: 1px solid transparent; // Shown for Windows 10 High Contrast mode.
29
29
 
30
- .components-base-control__label {
31
- font-size: $default-font-size;
32
- }
33
-
34
30
  &.has-illustration {
35
31
  background: none;
36
32
  border: none;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ReactNode } from 'react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import type { IconType } from '../icon';
10
+
11
+ export type PlaceholderProps< IconProps = unknown > = {
12
+ /**
13
+ * The children elements.
14
+ */
15
+ children?: ReactNode;
16
+ /**
17
+ * Class to set on the container div.
18
+ */
19
+ className?: string;
20
+ /**
21
+ * If provided, renders an icon next to the label.
22
+ */
23
+ icon?: IconType< IconProps >;
24
+ /**
25
+ * Instructions of the placeholder.
26
+ */
27
+ instructions?: string;
28
+ /**
29
+ * Changes placeholder children layout from flex-row to flex-column.
30
+ */
31
+ isColumnLayout?: boolean;
32
+ /**
33
+ * Title of the placeholder.
34
+ */
35
+ label?: string;
36
+ /**
37
+ * A rendered notices list
38
+ */
39
+ notices?: ReactNode;
40
+ /**
41
+ * Preview to be rendered in the placeholder.
42
+ */
43
+ preview?: ReactNode;
44
+ /**
45
+ * Outputs a placeholder illustration.
46
+ */
47
+ withIllustration?: boolean;
48
+ };
@@ -71,6 +71,13 @@ Each of these base placements has an alignment in the form -start and -end. For
71
71
  - Required: No
72
72
  - Default: `"bottom-start"`
73
73
 
74
+ ### offset
75
+
76
+ The distance (in pixels) between the anchor and popover.
77
+
78
+ - Type: `Number`
79
+ - Required: No
80
+
74
81
  ### children
75
82
 
76
83
  The content to be displayed within the popover.
@@ -32,6 +32,7 @@ import {
32
32
  } from '@wordpress/compose';
33
33
  import { close } from '@wordpress/icons';
34
34
  import deprecated from '@wordpress/deprecated';
35
+ import { Path, SVG } from '@wordpress/primitives';
35
36
 
36
37
  /**
37
38
  * Internal dependencies
@@ -48,6 +49,30 @@ import { getAnimateClassName } from '../animate';
48
49
  */
49
50
  const SLOT_NAME = 'Popover';
50
51
 
52
+ // An SVG displaying a triangle facing down, filled with a solid
53
+ // color and bordered in such a way to create an arrow-like effect.
54
+ // Keeping the SVG's viewbox squared simplify the arrow positioning
55
+ // calculations.
56
+ const ArrowTriangle = ( props ) => (
57
+ <SVG
58
+ { ...props }
59
+ xmlns="http://www.w3.org/2000/svg"
60
+ viewBox={ `0 0 100 100` }
61
+ className="components-popover__triangle"
62
+ role="presentation"
63
+ >
64
+ <Path
65
+ className="components-popover__triangle-bg"
66
+ d="M 0 0 L 50 50 L 100 0"
67
+ />
68
+ <Path
69
+ className="components-popover__triangle-border"
70
+ d="M 0 0 L 50 50 L 100 0"
71
+ vectorEffect="non-scaling-stroke"
72
+ />
73
+ </SVG>
74
+ );
75
+
51
76
  const slotNameContext = createContext();
52
77
 
53
78
  const positionToPlacement = ( position ) => {
@@ -104,7 +129,7 @@ const Popover = (
104
129
  noArrow = true,
105
130
  isAlternate,
106
131
  position,
107
- placement = 'bottom-start',
132
+ placement: placementProp = 'bottom-start',
108
133
  offset,
109
134
  focusOnMount = 'firstElement',
110
135
  anchorRef,
@@ -114,11 +139,11 @@ const Popover = (
114
139
  onFocusOutside,
115
140
  __unstableSlotName = SLOT_NAME,
116
141
  __unstableObserveElement,
117
- __unstableForcePosition,
142
+ __unstableForcePosition = false,
118
143
  __unstableShift = false,
119
144
  ...contentProps
120
145
  },
121
- ref
146
+ forwardedRef
122
147
  ) => {
123
148
  if ( range ) {
124
149
  deprecated( 'range prop in Popover component', {
@@ -129,33 +154,35 @@ const Popover = (
129
154
 
130
155
  const arrowRef = useRef( null );
131
156
  const anchorRefFallback = useRef( null );
157
+
132
158
  const isMobileViewport = useViewportMatch( 'medium', '<' );
133
159
  const isExpanded = expandOnMobile && isMobileViewport;
134
160
  const hasArrow = ! isExpanded && ! noArrow;
135
- const usedPlacement = position
161
+ const normalizedPlacementFromProps = position
136
162
  ? positionToPlacement( position )
137
- : placement;
163
+ : placementProp;
138
164
 
139
165
  const ownerDocument = useMemo( () => {
166
+ let documentToReturn;
167
+
140
168
  if ( anchorRef?.top ) {
141
- return anchorRef?.top.ownerDocument;
169
+ documentToReturn = anchorRef?.top.ownerDocument;
142
170
  } else if ( anchorRef?.startContainer ) {
143
- return anchorRef.startContainer.ownerDocument;
171
+ documentToReturn = anchorRef.startContainer.ownerDocument;
144
172
  } else if ( anchorRef?.current ) {
145
- return anchorRef.current.ownerDocument;
173
+ documentToReturn = anchorRef.current.ownerDocument;
146
174
  } else if ( anchorRef ) {
147
175
  // This one should be deprecated.
148
- return anchorRef.ownerDocument;
176
+ documentToReturn = anchorRef.ownerDocument;
149
177
  } else if ( anchorRect && anchorRect?.ownerDocument ) {
150
- return anchorRect.ownerDocument;
178
+ documentToReturn = anchorRect.ownerDocument;
151
179
  } else if ( getAnchorRect ) {
152
- return (
153
- getAnchorRect( anchorRefFallback.current )?.ownerDocument ??
154
- document
155
- );
180
+ documentToReturn = getAnchorRect(
181
+ anchorRefFallback.current
182
+ )?.ownerDocument;
156
183
  }
157
184
 
158
- return document;
185
+ return documentToReturn ?? document;
159
186
  }, [ anchorRef, anchorRect, getAnchorRect ] );
160
187
 
161
188
  /**
@@ -170,20 +197,42 @@ const Popover = (
170
197
  }
171
198
 
172
199
  const iframeRect = frameElement.getBoundingClientRect();
173
- return {
174
- name: 'iframeOffset',
175
- fn( { x, y } ) {
176
- return {
177
- x: x + iframeRect.left,
178
- y: y + iframeRect.top,
179
- };
180
- },
181
- };
200
+ return { x: iframeRect.left, y: iframeRect.top };
182
201
  }, [ ownerDocument ] );
183
202
 
184
- const middlewares = [
185
- frameOffset,
186
- offset ? offsetMiddleware( offset ) : undefined,
203
+ const middleware = [
204
+ frameOffset || offset
205
+ ? offsetMiddleware( ( { placement: currentPlacement } ) => {
206
+ if ( ! frameOffset ) {
207
+ return offset;
208
+ }
209
+
210
+ const isTopBottomPlacement =
211
+ currentPlacement.includes( 'top' ) ||
212
+ currentPlacement.includes( 'bottom' );
213
+
214
+ // The main axis should represent the gap between the
215
+ // floating element and the reference element. The cross
216
+ // axis is always perpendicular to the main axis.
217
+ const mainAxis = isTopBottomPlacement ? 'y' : 'x';
218
+ const crossAxis = mainAxis === 'x' ? 'y' : 'x';
219
+
220
+ // When the popover is before the reference, subtract the offset,
221
+ // of the main axis else add it.
222
+ const hasBeforePlacement =
223
+ currentPlacement.includes( 'top' ) ||
224
+ currentPlacement.includes( 'left' );
225
+ const mainAxisModifier = hasBeforePlacement ? -1 : 1;
226
+ const normalizedOffset = offset ? offset : 0;
227
+
228
+ return {
229
+ mainAxis:
230
+ normalizedOffset +
231
+ frameOffset[ mainAxis ] * mainAxisModifier,
232
+ crossAxis: frameOffset[ crossAxis ],
233
+ };
234
+ } )
235
+ : undefined,
187
236
  __unstableForcePosition ? undefined : flip(),
188
237
  __unstableForcePosition
189
238
  ? undefined
@@ -231,33 +280,38 @@ const Popover = (
231
280
  } );
232
281
 
233
282
  const {
283
+ // Positioning coordinates
234
284
  x,
235
285
  y,
286
+ // Callback refs (not regular refs). This allows the position to be updated.
287
+ // when either elements change.
236
288
  reference,
237
289
  floating,
238
- strategy,
290
+ // Object with "regular" refs to both "reference" and "floating"
239
291
  refs,
292
+ // Type of CSS position property to use (absolute or fixed)
293
+ strategy,
240
294
  update,
241
- placement: placementData,
295
+ placement: computedPlacement,
242
296
  middlewareData: { arrow: arrowData = {} },
243
- } = useFloating( {
244
- placement: usedPlacement,
245
- middleware: middlewares,
246
- } );
247
- const staticSide = {
248
- top: 'bottom',
249
- right: 'left',
250
- bottom: 'top',
251
- left: 'right',
252
- }[ placementData.split( '-' )[ 0 ] ];
253
- const mergedRefs = useMergeRefs( [ floating, dialogRef, ref ] );
254
-
255
- // Updates references
297
+ } = useFloating( { placement: normalizedPlacementFromProps, middleware } );
298
+
299
+ // Update the `reference`'s ref.
300
+ //
301
+ // In floating-ui's terms:
302
+ // - "reference" refers to the popover's anchor element.
303
+ // - "floating" refers the floating popover's element.
304
+ // A floating element can also be positioned relative to a virtual element,
305
+ // instead of a real one. A virtual element is represented by an object
306
+ // with the `getBoundingClientRect()` function (like real elements).
307
+ // See https://floating-ui.com/docs/virtual-elements for more info.
256
308
  useLayoutEffect( () => {
257
- // No ref or position have been passed
258
- let usedRef;
309
+ let resultingReferenceRef;
310
+
259
311
  if ( anchorRef?.top ) {
260
- usedRef = {
312
+ // Create a virtual element for the ref. The expectation is that
313
+ // if anchorRef.top is defined, then anchorRef.bottom is defined too.
314
+ resultingReferenceRef = {
261
315
  getBoundingClientRect() {
262
316
  const topRect = anchorRef.top.getBoundingClientRect();
263
317
  const bottomRect = anchorRef.bottom.getBoundingClientRect();
@@ -270,17 +324,22 @@ const Popover = (
270
324
  },
271
325
  };
272
326
  } else if ( anchorRef?.current ) {
273
- usedRef = anchorRef.current;
327
+ // Standard React ref.
328
+ resultingReferenceRef = anchorRef.current;
274
329
  } else if ( anchorRef ) {
275
- usedRef = anchorRef;
330
+ // If `anchorRef` holds directly the element's value (no `current` key)
331
+ // This is a weird scenario and should be deprecated.
332
+ resultingReferenceRef = anchorRef;
276
333
  } else if ( anchorRect ) {
277
- usedRef = {
334
+ // Create a virtual element for the ref.
335
+ resultingReferenceRef = {
278
336
  getBoundingClientRect() {
279
337
  return anchorRect;
280
338
  },
281
339
  };
282
340
  } else if ( getAnchorRect ) {
283
- usedRef = {
341
+ // Create a virtual element for the ref.
342
+ resultingReferenceRef = {
284
343
  getBoundingClientRect() {
285
344
  const rect = getAnchorRect( anchorRefFallback.current );
286
345
  return new window.DOMRect(
@@ -292,23 +351,29 @@ const Popover = (
292
351
  },
293
352
  };
294
353
  } else if ( anchorRefFallback.current ) {
295
- usedRef = anchorRefFallback.current;
354
+ // If no explicit ref is passed via props, fall back to
355
+ // anchoring to the popover's parent node.
356
+ resultingReferenceRef = anchorRefFallback.current.parentNode;
296
357
  }
297
358
 
298
- if ( ! usedRef ) {
359
+ if ( ! resultingReferenceRef ) {
299
360
  return;
300
361
  }
301
362
 
302
- reference( usedRef );
363
+ reference( resultingReferenceRef );
303
364
 
304
365
  if ( ! refs.floating.current ) {
305
366
  return;
306
367
  }
307
368
 
308
- return autoUpdate( usedRef, refs.floating.current, update );
369
+ return autoUpdate(
370
+ resultingReferenceRef,
371
+ refs.floating.current,
372
+ update
373
+ );
309
374
  }, [ anchorRef, anchorRect, getAnchorRect ] );
310
375
 
311
- // This is only needed for a smoth transition when moving blocks.
376
+ // This is only needed for a smooth transition when moving blocks.
312
377
  useLayoutEffect( () => {
313
378
  if ( ! __unstableObserveElement ) {
314
379
  return;
@@ -321,7 +386,9 @@ const Popover = (
321
386
  };
322
387
  }, [ __unstableObserveElement ] );
323
388
 
324
- // If we're using getAnchorRect, we need to update the position as we scroll the iframe.
389
+ // If the reference element is in a different ownerDocument (e.g. iFrame),
390
+ // we need to manually update the floating's position as the reference's owner
391
+ // document scrolls.
325
392
  useLayoutEffect( () => {
326
393
  if ( ownerDocument === document ) {
327
394
  return;
@@ -336,9 +403,15 @@ const Popover = (
336
403
  !! animate &&
337
404
  getAnimateClassName( {
338
405
  type: 'appear',
339
- origin: placementToAnimationOrigin( placementData ),
406
+ origin: placementToAnimationOrigin( computedPlacement ),
340
407
  } );
341
408
 
409
+ const mergedFloatingRef = useMergeRefs( [
410
+ floating,
411
+ dialogRef,
412
+ forwardedRef,
413
+ ] );
414
+
342
415
  // Disable reason: We care to capture the _bubbled_ events from inputs
343
416
  // within popover as inferring close intent.
344
417
 
@@ -356,7 +429,7 @@ const Popover = (
356
429
  }
357
430
  ) }
358
431
  { ...contentProps }
359
- ref={ mergedRefs }
432
+ ref={ mergedFloatingRef }
360
433
  { ...dialogProps }
361
434
  tabIndex="-1"
362
435
  style={
@@ -369,6 +442,7 @@ const Popover = (
369
442
  }
370
443
  }
371
444
  >
445
+ { /* Prevents scroll on the document */ }
372
446
  { isExpanded && <ScrollLock /> }
373
447
  { isExpanded && (
374
448
  <div className="components-popover__header">
@@ -385,22 +459,22 @@ const Popover = (
385
459
  <div className="components-popover__content">{ children }</div>
386
460
  { hasArrow && (
387
461
  <div
388
- className="components-popover__arrow"
389
462
  ref={ arrowRef }
463
+ className={ [
464
+ 'components-popover__arrow',
465
+ `is-${ computedPlacement.split( '-' )[ 0 ] }`,
466
+ ].join( ' ' ) }
390
467
  style={ {
391
- left:
392
- ! arrowData?.x || Number.isNaN( arrowData?.x )
393
- ? 0
394
- : arrowData.x,
395
- top:
396
- ! arrowData?.y || Number.isNaN( arrowData?.y )
397
- ? 0
398
- : arrowData.y,
399
- right: undefined,
400
- bottom: undefined,
401
- [ staticSide ]: '-4px',
468
+ left: Number.isFinite( arrowData?.x )
469
+ ? `${ arrowData.x }px`
470
+ : '',
471
+ top: Number.isFinite( arrowData?.y )
472
+ ? `${ arrowData.y }px`
473
+ : '',
402
474
  } }
403
- />
475
+ >
476
+ <ArrowTriangle />
477
+ </div>
404
478
  ) }
405
479
  </div>
406
480
  );