@wordpress/components 21.1.0 → 21.2.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 (309) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/build/border-box-control/utils.js +42 -2
  3. package/build/border-box-control/utils.js.map +1 -1
  4. package/build/combobox-control/index.js +0 -1
  5. package/build/combobox-control/index.js.map +1 -1
  6. package/build/custom-select-control/index.js +4 -2
  7. package/build/custom-select-control/index.js.map +1 -1
  8. package/build/draggable/index.js +3 -6
  9. package/build/draggable/index.js.map +1 -1
  10. package/build/font-size-picker/index.js +46 -55
  11. package/build/font-size-picker/index.js.map +1 -1
  12. package/build/font-size-picker/styles.js +73 -0
  13. package/build/font-size-picker/styles.js.map +1 -0
  14. package/build/font-size-picker/types.js +6 -0
  15. package/build/font-size-picker/types.js.map +1 -0
  16. package/build/font-size-picker/utils.js +17 -15
  17. package/build/font-size-picker/utils.js.map +1 -1
  18. package/build/form-token-field/token-input.js +20 -1
  19. package/build/form-token-field/token-input.js.map +1 -1
  20. package/build/index.js +12 -0
  21. package/build/index.js.map +1 -1
  22. package/build/menu-item/index.js +4 -3
  23. package/build/menu-item/index.js.map +1 -1
  24. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +10 -3
  25. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  26. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -3
  27. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  28. package/build/mobile/bottom-sheet/sub-sheet/index.native.js +4 -1
  29. package/build/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  30. package/build/mobile/color-settings/index.native.js +3 -1
  31. package/build/mobile/color-settings/index.native.js.map +1 -1
  32. package/build/mobile/color-settings/picker-screen.native.js +3 -1
  33. package/build/mobile/color-settings/picker-screen.native.js.map +1 -1
  34. package/build/mobile/image/index.native.js +3 -1
  35. package/build/mobile/image/index.native.js.map +1 -1
  36. package/build/mobile/keyboard-avoiding-view/index.ios.js +3 -1
  37. package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  38. package/build/mobile/link-picker/index.native.js +3 -1
  39. package/build/mobile/link-picker/index.native.js.map +1 -1
  40. package/build/mobile/link-picker/link-picker-results.native.js +3 -1
  41. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  42. package/build/mobile/link-picker/link-picker-screen.native.js +3 -1
  43. package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  44. package/build/mobile/link-settings/index.native.js +24 -6
  45. package/build/mobile/link-settings/index.native.js.map +1 -1
  46. package/build/mobile/link-settings/link-settings-screen.native.js +3 -1
  47. package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  48. package/build/mobile/segmented-control/index.native.js +6 -2
  49. package/build/mobile/segmented-control/index.native.js.map +1 -1
  50. package/build/mobile/utils/use-unit-converter-to-mobile.native.js +6 -2
  51. package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  52. package/build/navigator/navigator-screen/component.js +8 -1
  53. package/build/navigator/navigator-screen/component.js.map +1 -1
  54. package/build/notice/index.native.js +15 -19
  55. package/build/notice/index.native.js.map +1 -1
  56. package/build/notice/list.native.js +2 -3
  57. package/build/notice/list.native.js.map +1 -1
  58. package/build/palette-edit/index.js +1 -1
  59. package/build/palette-edit/index.js.map +1 -1
  60. package/build/popover/index.js +29 -32
  61. package/build/popover/index.js.map +1 -1
  62. package/build/popover/limit-shift.js +145 -0
  63. package/build/popover/limit-shift.js.map +1 -0
  64. package/build/popover/utils.js +55 -15
  65. package/build/popover/utils.js.map +1 -1
  66. package/build/resizable-box/resize-tooltip/utils.js +12 -14
  67. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  68. package/build/sandbox/index.js +13 -8
  69. package/build/sandbox/index.js.map +1 -1
  70. package/build/sandbox/index.native.js +3 -1
  71. package/build/sandbox/index.native.js.map +1 -1
  72. package/build/search-control/index.native.js +6 -2
  73. package/build/search-control/index.native.js.map +1 -1
  74. package/build/slot-fill/bubbles-virtually/slot-fill-context.js +8 -2
  75. package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  76. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +31 -41
  77. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  78. package/build/slot-fill/bubbles-virtually/use-slot-fills.js +39 -0
  79. package/build/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -0
  80. package/build/slot-fill/bubbles-virtually/use-slot.js +13 -4
  81. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  82. package/build/slot-fill/index.js +8 -0
  83. package/build/slot-fill/index.js.map +1 -1
  84. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  85. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  86. package/build/tools-panel/styles.js +27 -12
  87. package/build/tools-panel/styles.js.map +1 -1
  88. package/build/tools-panel/tools-panel-header/component.js +19 -6
  89. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  90. package/build/tools-panel/tools-panel-header/hook.js +4 -0
  91. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  92. package/build-module/border-box-control/utils.js +36 -1
  93. package/build-module/border-box-control/utils.js.map +1 -1
  94. package/build-module/combobox-control/index.js +0 -1
  95. package/build-module/combobox-control/index.js.map +1 -1
  96. package/build-module/custom-select-control/index.js +2 -1
  97. package/build-module/custom-select-control/index.js.map +1 -1
  98. package/build-module/draggable/index.js +2 -5
  99. package/build-module/draggable/index.js.map +1 -1
  100. package/build-module/font-size-picker/index.js +45 -53
  101. package/build-module/font-size-picker/index.js.map +1 -1
  102. package/build-module/font-size-picker/styles.js +62 -0
  103. package/build-module/font-size-picker/styles.js.map +1 -0
  104. package/build-module/font-size-picker/types.js +2 -0
  105. package/build-module/font-size-picker/types.js.map +1 -0
  106. package/build-module/font-size-picker/utils.js +21 -15
  107. package/build-module/font-size-picker/utils.js.map +1 -1
  108. package/build-module/form-token-field/token-input.js +21 -2
  109. package/build-module/form-token-field/token-input.js.map +1 -1
  110. package/build-module/index.js +2 -2
  111. package/build-module/index.js.map +1 -1
  112. package/build-module/menu-item/index.js +4 -3
  113. package/build-module/menu-item/index.js.map +1 -1
  114. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +10 -3
  115. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  116. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -3
  117. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  118. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +4 -1
  119. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  120. package/build-module/mobile/color-settings/index.native.js +3 -1
  121. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  122. package/build-module/mobile/color-settings/picker-screen.native.js +3 -1
  123. package/build-module/mobile/color-settings/picker-screen.native.js.map +1 -1
  124. package/build-module/mobile/image/index.native.js +3 -1
  125. package/build-module/mobile/image/index.native.js.map +1 -1
  126. package/build-module/mobile/keyboard-avoiding-view/index.ios.js +3 -1
  127. package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  128. package/build-module/mobile/link-picker/index.native.js +3 -1
  129. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  130. package/build-module/mobile/link-picker/link-picker-results.native.js +3 -1
  131. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  132. package/build-module/mobile/link-picker/link-picker-screen.native.js +3 -1
  133. package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  134. package/build-module/mobile/link-settings/index.native.js +24 -6
  135. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  136. package/build-module/mobile/link-settings/link-settings-screen.native.js +3 -1
  137. package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  138. package/build-module/mobile/segmented-control/index.native.js +6 -2
  139. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  140. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +6 -2
  141. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  142. package/build-module/navigator/navigator-screen/component.js +8 -1
  143. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  144. package/build-module/notice/index.native.js +16 -21
  145. package/build-module/notice/index.native.js.map +1 -1
  146. package/build-module/notice/list.native.js +3 -3
  147. package/build-module/notice/list.native.js.map +1 -1
  148. package/build-module/palette-edit/index.js +1 -1
  149. package/build-module/palette-edit/index.js.map +1 -1
  150. package/build-module/popover/index.js +31 -35
  151. package/build-module/popover/index.js.map +1 -1
  152. package/build-module/popover/limit-shift.js +136 -0
  153. package/build-module/popover/limit-shift.js.map +1 -0
  154. package/build-module/popover/utils.js +55 -15
  155. package/build-module/popover/utils.js.map +1 -1
  156. package/build-module/resizable-box/resize-tooltip/utils.js +13 -15
  157. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  158. package/build-module/sandbox/index.js +13 -8
  159. package/build-module/sandbox/index.js.map +1 -1
  160. package/build-module/sandbox/index.native.js +3 -1
  161. package/build-module/sandbox/index.native.js.map +1 -1
  162. package/build-module/search-control/index.native.js +6 -2
  163. package/build-module/search-control/index.native.js.map +1 -1
  164. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +7 -2
  165. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  166. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +30 -42
  167. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  168. package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js +27 -0
  169. package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -0
  170. package/build-module/slot-fill/bubbles-virtually/use-slot.js +13 -5
  171. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  172. package/build-module/slot-fill/index.js +1 -0
  173. package/build-module/slot-fill/index.js.map +1 -1
  174. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +7 -7
  175. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  176. package/build-module/tools-panel/styles.js +23 -12
  177. package/build-module/tools-panel/styles.js.map +1 -1
  178. package/build-module/tools-panel/tools-panel-header/component.js +19 -7
  179. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  180. package/build-module/tools-panel/tools-panel-header/hook.js +4 -0
  181. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  182. package/build-style/style-rtl.css +14 -100
  183. package/build-style/style.css +14 -100
  184. package/build-types/border-box-control/utils.d.ts +1 -3
  185. package/build-types/border-box-control/utils.d.ts.map +1 -1
  186. package/build-types/custom-select-control/index.d.ts +13 -0
  187. package/build-types/custom-select-control/index.d.ts.map +1 -0
  188. package/build-types/custom-select-control/styles.d.ts +9 -0
  189. package/build-types/custom-select-control/styles.d.ts.map +1 -0
  190. package/build-types/draggable/index.d.ts.map +1 -1
  191. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  192. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +3 -3
  193. package/build-types/font-size-picker/index.d.ts +5 -0
  194. package/build-types/font-size-picker/index.d.ts.map +1 -0
  195. package/build-types/font-size-picker/stories/e2e/index.d.ts +16 -0
  196. package/build-types/font-size-picker/stories/e2e/index.d.ts.map +1 -0
  197. package/build-types/font-size-picker/stories/index.d.ts +31 -0
  198. package/build-types/font-size-picker/stories/index.d.ts.map +1 -0
  199. package/build-types/font-size-picker/styles.d.ts +27 -0
  200. package/build-types/font-size-picker/styles.d.ts.map +1 -0
  201. package/build-types/font-size-picker/test/index.d.ts +2 -0
  202. package/build-types/font-size-picker/test/index.d.ts.map +1 -0
  203. package/build-types/font-size-picker/test/utils.d.ts +2 -0
  204. package/build-types/font-size-picker/test/utils.d.ts.map +1 -0
  205. package/build-types/font-size-picker/types.d.ts +93 -0
  206. package/build-types/font-size-picker/types.d.ts.map +1 -0
  207. package/build-types/font-size-picker/utils.d.ts +41 -0
  208. package/build-types/font-size-picker/utils.d.ts.map +1 -0
  209. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  210. package/build-types/menu-item/index.d.ts.map +1 -1
  211. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  212. package/build-types/popover/index.d.ts.map +1 -1
  213. package/build-types/popover/limit-shift.d.ts +87 -0
  214. package/build-types/popover/limit-shift.d.ts.map +1 -0
  215. package/build-types/popover/test/index.d.ts +2 -0
  216. package/build-types/popover/test/index.d.ts.map +1 -0
  217. package/build-types/popover/types.d.ts +1 -1
  218. package/build-types/popover/types.d.ts.map +1 -1
  219. package/build-types/popover/utils.d.ts.map +1 -1
  220. package/build-types/range-control/types.d.ts +0 -32
  221. package/build-types/range-control/types.d.ts.map +1 -1
  222. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +2 -2
  223. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -1
  224. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  225. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +2 -0
  226. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts.map +1 -0
  227. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  228. package/build-types/slot-fill/index.d.ts +1 -0
  229. package/build-types/slot-fill/index.d.ts.map +1 -1
  230. package/build-types/spinner/index.d.ts +1 -1
  231. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +1 -1
  232. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  233. package/build-types/tools-panel/styles.d.ts +6 -0
  234. package/build-types/tools-panel/styles.d.ts.map +1 -1
  235. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  236. package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -0
  237. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  238. package/build-types/tools-panel/types.d.ts +1 -0
  239. package/build-types/tools-panel/types.d.ts.map +1 -1
  240. package/package.json +19 -18
  241. package/src/alignment-matrix-control/test/index.js +17 -62
  242. package/src/border-box-control/test/utils.js +48 -0
  243. package/src/border-box-control/utils.ts +44 -1
  244. package/src/combobox-control/index.js +0 -5
  245. package/src/custom-select-control/index.js +2 -1
  246. package/src/draggable/index.js +2 -5
  247. package/src/font-size-picker/{index.js → index.tsx} +113 -79
  248. package/src/font-size-picker/stories/e2e/{index.js → index.tsx} +13 -4
  249. package/src/font-size-picker/stories/{index.js → index.tsx} +42 -36
  250. package/src/font-size-picker/styles.ts +44 -0
  251. package/src/font-size-picker/test/{index.js → index.tsx} +1 -1
  252. package/src/font-size-picker/test/{utils.js → utils.ts} +6 -2
  253. package/src/font-size-picker/types.ts +98 -0
  254. package/src/font-size-picker/{utils.js → utils.ts} +51 -27
  255. package/src/form-token-field/test/index.tsx +22 -1
  256. package/src/form-token-field/token-input.tsx +25 -3
  257. package/src/index.js +2 -1
  258. package/src/menu-item/README.md +7 -0
  259. package/src/menu-item/index.js +11 -5
  260. package/src/menu-item/style.scss +1 -0
  261. package/src/menu-item/test/index.js +36 -0
  262. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +9 -0
  263. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +11 -0
  264. package/src/mobile/bottom-sheet/sub-sheet/index.native.js +3 -0
  265. package/src/mobile/color-settings/index.native.js +3 -0
  266. package/src/mobile/color-settings/picker-screen.native.js +3 -0
  267. package/src/mobile/image/index.native.js +3 -0
  268. package/src/mobile/keyboard-avoiding-view/index.ios.js +3 -0
  269. package/src/mobile/link-picker/index.native.js +3 -0
  270. package/src/mobile/link-picker/link-picker-results.native.js +3 -0
  271. package/src/mobile/link-picker/link-picker-screen.native.js +3 -0
  272. package/src/mobile/link-settings/index.native.js +18 -0
  273. package/src/mobile/link-settings/link-settings-screen.native.js +3 -0
  274. package/src/mobile/segmented-control/index.native.js +6 -0
  275. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +6 -0
  276. package/src/navigator/navigator-screen/component.tsx +8 -1
  277. package/src/navigator/test/index.js +119 -54
  278. package/src/notice/index.native.js +17 -20
  279. package/src/notice/list.native.js +7 -3
  280. package/src/palette-edit/index.js +1 -1
  281. package/src/placeholder/style.scss +3 -3
  282. package/src/popover/index.tsx +26 -42
  283. package/src/popover/limit-shift.ts +205 -0
  284. package/src/popover/test/index.tsx +230 -0
  285. package/src/popover/types.ts +1 -0
  286. package/src/popover/utils.ts +58 -16
  287. package/src/range-control/types.ts +0 -33
  288. package/src/resizable-box/resize-tooltip/utils.ts +13 -13
  289. package/src/sandbox/index.js +13 -7
  290. package/src/sandbox/index.native.js +3 -0
  291. package/src/search-control/index.native.js +6 -0
  292. package/src/slot-fill/bubbles-virtually/slot-fill-context.js +6 -2
  293. package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +51 -58
  294. package/src/slot-fill/bubbles-virtually/use-slot-fills.js +24 -0
  295. package/src/slot-fill/bubbles-virtually/use-slot.js +11 -6
  296. package/src/slot-fill/index.js +1 -0
  297. package/src/style.scss +0 -1
  298. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +1 -0
  299. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +9 -7
  300. package/src/tools-panel/stories/index.js +27 -0
  301. package/src/tools-panel/styles.ts +28 -1
  302. package/src/tools-panel/tools-panel-header/component.tsx +12 -5
  303. package/src/tools-panel/tools-panel-header/hook.ts +5 -0
  304. package/src/tools-panel/types.ts +1 -0
  305. package/tsconfig.json +0 -2
  306. package/tsconfig.tsbuildinfo +1 -1
  307. package/src/font-size-picker/style.scss +0 -78
  308. package/src/popover/test/__snapshots__/index.js.snap +0 -34
  309. package/src/popover/test/index.js +0 -164
@@ -0,0 +1,205 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type {
5
+ Axis,
6
+ Coords,
7
+ Placement,
8
+ Side,
9
+ MiddlewareArguments,
10
+ } from '@floating-ui/react-dom';
11
+
12
+ /**
13
+ * Parts of this source were derived and modified from `floating-ui`,
14
+ * released under the MIT license.
15
+ *
16
+ * https://github.com/floating-ui/floating-ui
17
+ *
18
+ * Copyright (c) 2021 Floating UI contributors
19
+ *
20
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ * of this software and associated documentation files (the "Software"), to deal
22
+ * in the Software without restriction, including without limitation the rights
23
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ * copies of the Software, and to permit persons to whom the Software is
25
+ * furnished to do so, subject to the following conditions:
26
+ *
27
+ * The above copyright notice and this permission notice shall be included in all
28
+ * copies or substantial portions of the Software.
29
+ *
30
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
+ * SOFTWARE.
37
+ */
38
+
39
+ /**
40
+ * Custom limiter function for the `shift` middleware.
41
+ * This function is mostly identical default `limitShift` from ``@floating-ui`;
42
+ * the only difference is that, when computing the min/max shift limits, it
43
+ * also takes into account the iframe offset that is added by the
44
+ * custom "frameOffset" middleware.
45
+ *
46
+ * All unexported types and functions are also from the `@floating-ui` library,
47
+ * and have been copied to this file for convenience.
48
+ */
49
+
50
+ type LimitShiftOffset =
51
+ | ( ( args: MiddlewareArguments ) =>
52
+ | number
53
+ | {
54
+ /**
55
+ * Offset the limiting of the axis that runs along the alignment of the
56
+ * floating element.
57
+ */
58
+ mainAxis?: number;
59
+ /**
60
+ * Offset the limiting of the axis that runs along the side of the
61
+ * floating element.
62
+ */
63
+ crossAxis?: number;
64
+ } )
65
+ | number
66
+ | {
67
+ /**
68
+ * Offset the limiting of the axis that runs along the alignment of the
69
+ * floating element.
70
+ */
71
+ mainAxis?: number;
72
+ /**
73
+ * Offset the limiting of the axis that runs along the side of the
74
+ * floating element.
75
+ */
76
+ crossAxis?: number;
77
+ };
78
+
79
+ type LimitShiftOptions = {
80
+ /**
81
+ * Offset when limiting starts. `0` will limit when the opposite edges of the
82
+ * reference and floating elements are aligned.
83
+ * - positive = start limiting earlier
84
+ * - negative = start limiting later
85
+ */
86
+ offset: LimitShiftOffset;
87
+ /**
88
+ * Whether to limit the axis that runs along the alignment of the floating
89
+ * element.
90
+ */
91
+ mainAxis: boolean;
92
+ /**
93
+ * Whether to limit the axis that runs along the side of the floating element.
94
+ */
95
+ crossAxis: boolean;
96
+ };
97
+
98
+ function getSide( placement: Placement ): Side {
99
+ return placement.split( '-' )[ 0 ] as Side;
100
+ }
101
+
102
+ function getMainAxisFromPlacement( placement: Placement ): Axis {
103
+ return [ 'top', 'bottom' ].includes( getSide( placement ) ) ? 'x' : 'y';
104
+ }
105
+
106
+ function getCrossAxis( axis: Axis ): Axis {
107
+ return axis === 'x' ? 'y' : 'x';
108
+ }
109
+
110
+ export const limitShift = (
111
+ options: Partial< LimitShiftOptions > = {}
112
+ ): {
113
+ options: Partial< LimitShiftOffset >;
114
+ fn: ( middlewareArguments: MiddlewareArguments ) => Coords;
115
+ } => ( {
116
+ options,
117
+ fn( middlewareArguments ) {
118
+ const { x, y, placement, rects, middlewareData } = middlewareArguments;
119
+ const {
120
+ offset = 0,
121
+ mainAxis: checkMainAxis = true,
122
+ crossAxis: checkCrossAxis = true,
123
+ } = options;
124
+
125
+ const coords = { x, y };
126
+ const mainAxis = getMainAxisFromPlacement( placement );
127
+ const crossAxis = getCrossAxis( mainAxis );
128
+
129
+ let mainAxisCoord = coords[ mainAxis ];
130
+ let crossAxisCoord = coords[ crossAxis ];
131
+
132
+ const rawOffset =
133
+ typeof offset === 'function'
134
+ ? offset( middlewareArguments )
135
+ : offset;
136
+ const computedOffset =
137
+ typeof rawOffset === 'number'
138
+ ? { mainAxis: rawOffset, crossAxis: 0 }
139
+ : { mainAxis: 0, crossAxis: 0, ...rawOffset };
140
+
141
+ // At the moment of writing, this is the only difference
142
+ // with the `limitShift` function from `@floating-ui`.
143
+ // This offset needs to be added to all min/max limits
144
+ // in order to make the shift-limiting work as expected.
145
+ const additionalFrameOffset = {
146
+ x: 0,
147
+ y: 0,
148
+ ...middlewareData.frameOffset?.amount,
149
+ };
150
+
151
+ if ( checkMainAxis ) {
152
+ const len = mainAxis === 'y' ? 'height' : 'width';
153
+ const limitMin =
154
+ rects.reference[ mainAxis ] -
155
+ rects.floating[ len ] +
156
+ computedOffset.mainAxis +
157
+ additionalFrameOffset[ mainAxis ];
158
+ const limitMax =
159
+ rects.reference[ mainAxis ] +
160
+ rects.reference[ len ] -
161
+ computedOffset.mainAxis +
162
+ additionalFrameOffset[ mainAxis ];
163
+
164
+ if ( mainAxisCoord < limitMin ) {
165
+ mainAxisCoord = limitMin;
166
+ } else if ( mainAxisCoord > limitMax ) {
167
+ mainAxisCoord = limitMax;
168
+ }
169
+ }
170
+
171
+ if ( checkCrossAxis ) {
172
+ const len = mainAxis === 'y' ? 'width' : 'height';
173
+ const isOriginSide = [ 'top', 'left' ].includes(
174
+ getSide( placement )
175
+ );
176
+ const limitMin =
177
+ rects.reference[ crossAxis ] -
178
+ rects.floating[ len ] +
179
+ ( isOriginSide
180
+ ? middlewareData.offset?.[ crossAxis ] ?? 0
181
+ : 0 ) +
182
+ ( isOriginSide ? 0 : computedOffset.crossAxis ) +
183
+ additionalFrameOffset[ crossAxis ];
184
+ const limitMax =
185
+ rects.reference[ crossAxis ] +
186
+ rects.reference[ len ] +
187
+ ( isOriginSide
188
+ ? 0
189
+ : middlewareData.offset?.[ crossAxis ] ?? 0 ) -
190
+ ( isOriginSide ? computedOffset.crossAxis : 0 ) +
191
+ additionalFrameOffset[ crossAxis ];
192
+
193
+ if ( crossAxisCoord < limitMin ) {
194
+ crossAxisCoord = limitMin;
195
+ } else if ( crossAxisCoord > limitMax ) {
196
+ crossAxisCoord = limitMax;
197
+ }
198
+ }
199
+
200
+ return {
201
+ [ mainAxis ]: mainAxisCoord,
202
+ [ crossAxis ]: crossAxisCoord,
203
+ } as Coords;
204
+ },
205
+ } );
@@ -0,0 +1,230 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+ import type { CSSProperties } from 'react';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ import { useState } from '@wordpress/element';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { positionToPlacement, placementToMotionAnimationProps } from '../utils';
16
+ import Popover from '..';
17
+ import type { PopoverProps } from '../types';
18
+
19
+ type PositionToPlacementTuple = [
20
+ NonNullable< PopoverProps[ 'position' ] >,
21
+ NonNullable< PopoverProps[ 'placement' ] >
22
+ ];
23
+ type PlacementToAnimationOriginTuple = [
24
+ NonNullable< PopoverProps[ 'placement' ] >,
25
+ number,
26
+ number
27
+ ];
28
+ type PlacementToInitialTranslationTuple = [
29
+ NonNullable< PopoverProps[ 'placement' ] >,
30
+ 'translateY' | 'translateX',
31
+ CSSProperties[ 'translate' ]
32
+ ];
33
+
34
+ // There's no matching `placement` for 'middle center' positions,
35
+ // fallback to 'bottom' (same as `floating-ui`'s default.)
36
+ const FALLBACK_FOR_MIDDLE_CENTER_POSITIONS = 'bottom';
37
+
38
+ const ALL_POSITIONS_TO_EXPECTED_PLACEMENTS: PositionToPlacementTuple[] = [
39
+ // Format: [yAxis]
40
+ [ 'middle', FALLBACK_FOR_MIDDLE_CENTER_POSITIONS ],
41
+ [ 'bottom', 'bottom' ],
42
+ [ 'top', 'top' ],
43
+ // Format: [yAxis] [xAxis]
44
+ [ 'middle left', 'left' ],
45
+ [ 'middle center', FALLBACK_FOR_MIDDLE_CENTER_POSITIONS ],
46
+ [ 'middle right', 'right' ],
47
+ [ 'bottom left', 'bottom-end' ],
48
+ [ 'bottom center', 'bottom' ],
49
+ [ 'bottom right', 'bottom-start' ],
50
+ [ 'top left', 'top-end' ],
51
+ [ 'top center', 'top' ],
52
+ [ 'top right', 'top-start' ],
53
+ // Format: [yAxis] [xAxis] [corner]
54
+ [ 'middle left left', 'left' ],
55
+ [ 'middle left right', 'left' ],
56
+ [ 'middle left bottom', 'left-end' ],
57
+ [ 'middle left top', 'left-start' ],
58
+ [ 'middle center left', FALLBACK_FOR_MIDDLE_CENTER_POSITIONS ],
59
+ [ 'middle center right', FALLBACK_FOR_MIDDLE_CENTER_POSITIONS ],
60
+ [ 'middle center bottom', FALLBACK_FOR_MIDDLE_CENTER_POSITIONS ],
61
+ [ 'middle center top', FALLBACK_FOR_MIDDLE_CENTER_POSITIONS ],
62
+ [ 'middle right left', 'right' ],
63
+ [ 'middle right right', 'right' ],
64
+ [ 'middle right bottom', 'right-end' ],
65
+ [ 'middle right top', 'right-start' ],
66
+ [ 'bottom left left', 'bottom-end' ],
67
+ [ 'bottom left right', 'bottom-end' ],
68
+ [ 'bottom left bottom', 'bottom-end' ],
69
+ [ 'bottom left top', 'bottom-end' ],
70
+ [ 'bottom center left', 'bottom' ],
71
+ [ 'bottom center right', 'bottom' ],
72
+ [ 'bottom center bottom', 'bottom' ],
73
+ [ 'bottom center top', 'bottom' ],
74
+ [ 'bottom right left', 'bottom-start' ],
75
+ [ 'bottom right right', 'bottom-start' ],
76
+ [ 'bottom right bottom', 'bottom-start' ],
77
+ [ 'bottom right top', 'bottom-start' ],
78
+ [ 'top left left', 'top-end' ],
79
+ [ 'top left right', 'top-end' ],
80
+ [ 'top left bottom', 'top-end' ],
81
+ [ 'top left top', 'top-end' ],
82
+ [ 'top center left', 'top' ],
83
+ [ 'top center right', 'top' ],
84
+ [ 'top center bottom', 'top' ],
85
+ [ 'top center top', 'top' ],
86
+ [ 'top right left', 'top-start' ],
87
+ [ 'top right right', 'top-start' ],
88
+ [ 'top right bottom', 'top-start' ],
89
+ [ 'top right top', 'top-start' ],
90
+ ];
91
+
92
+ describe( 'Popover', () => {
93
+ describe( 'Component', () => {
94
+ describe( 'basic behavior', () => {
95
+ it( 'should render content', () => {
96
+ render( <Popover>Hello</Popover> );
97
+
98
+ expect( screen.getByText( 'Hello' ) ).toBeInTheDocument();
99
+ } );
100
+
101
+ it( 'should forward additional props to portaled element', () => {
102
+ render( <Popover role="tooltip">Hello</Popover> );
103
+
104
+ expect( screen.getByRole( 'tooltip' ) ).toBeInTheDocument();
105
+ } );
106
+ } );
107
+
108
+ describe( 'anchor', () => {
109
+ it( 'should render correctly when anchor is provided', () => {
110
+ const PopoverWithAnchor = ( args: PopoverProps ) => {
111
+ // Use internal state instead of a ref to make sure that the component
112
+ // re-renders when the popover's anchor updates.
113
+ const [ anchor, setAnchor ] =
114
+ useState< HTMLParagraphElement | null >( null );
115
+
116
+ return (
117
+ <div>
118
+ <p ref={ setAnchor }>Anchor</p>
119
+ <Popover { ...args } anchor={ anchor } />
120
+ </div>
121
+ );
122
+ };
123
+
124
+ render(
125
+ <PopoverWithAnchor>Popover content</PopoverWithAnchor>
126
+ );
127
+
128
+ expect(
129
+ screen.getByText( 'Popover content' )
130
+ ).toBeInTheDocument();
131
+ } );
132
+ } );
133
+
134
+ describe( 'focus behavior', () => {
135
+ it( 'should focus the popover by default when opened', () => {
136
+ render( <Popover>Popover content</Popover> );
137
+
138
+ expect(
139
+ screen.getByText( 'Popover content' ).parentElement
140
+ ).toHaveFocus();
141
+ } );
142
+
143
+ it( 'should allow focus-on-open behavior to be disabled', () => {
144
+ render(
145
+ <Popover focusOnMount={ false }>Popover content</Popover>
146
+ );
147
+
148
+ expect( document.body ).toHaveFocus();
149
+ } );
150
+ } );
151
+ } );
152
+
153
+ describe( 'positionToPlacement', () => {
154
+ it.each( ALL_POSITIONS_TO_EXPECTED_PLACEMENTS )(
155
+ 'converts `%s` to `%s`',
156
+ ( inputPosition, expectedPlacement ) => {
157
+ expect( positionToPlacement( inputPosition ) ).toEqual(
158
+ expectedPlacement
159
+ );
160
+ }
161
+ );
162
+ } );
163
+
164
+ describe( 'placementToMotionAnimationProps', () => {
165
+ describe( 'animation origin', () => {
166
+ it.each( [
167
+ [ 'top', 0.5, 1 ],
168
+ [ 'top-start', 0, 1 ],
169
+ [ 'top-end', 1, 1 ],
170
+ [ 'right', 0, 0.5 ],
171
+ [ 'right-start', 0, 0 ],
172
+ [ 'right-end', 0, 1 ],
173
+ [ 'bottom', 0.5, 0 ],
174
+ [ 'bottom-start', 0, 0 ],
175
+ [ 'bottom-end', 1, 0 ],
176
+ [ 'left', 1, 0.5 ],
177
+ [ 'left-start', 1, 0 ],
178
+ [ 'left-end', 1, 1 ],
179
+ ] as PlacementToAnimationOriginTuple[] )(
180
+ 'for the `%s` placement computes an animation origin of (%d, %d)',
181
+ ( inputPlacement, expectedOriginX, expectedOriginY ) => {
182
+ expect(
183
+ placementToMotionAnimationProps( inputPlacement )
184
+ ).toEqual(
185
+ expect.objectContaining( {
186
+ style: expect.objectContaining( {
187
+ originX: expectedOriginX,
188
+ originY: expectedOriginY,
189
+ } ),
190
+ } )
191
+ );
192
+ }
193
+ );
194
+ } );
195
+ describe( 'initial translation', () => {
196
+ it.each( [
197
+ [ 'top', 'translateY', '2em' ],
198
+ [ 'top-start', 'translateY', '2em' ],
199
+ [ 'top-end', 'translateY', '2em' ],
200
+ [ 'right', 'translateX', '-2em' ],
201
+ [ 'right-start', 'translateX', '-2em' ],
202
+ [ 'right-end', 'translateX', '-2em' ],
203
+ [ 'bottom', 'translateY', '-2em' ],
204
+ [ 'bottom-start', 'translateY', '-2em' ],
205
+ [ 'bottom-end', 'translateY', '-2em' ],
206
+ [ 'left', 'translateX', '2em' ],
207
+ [ 'left-start', 'translateX', '2em' ],
208
+ [ 'left-end', 'translateX', '2em' ],
209
+ ] as PlacementToInitialTranslationTuple[] )(
210
+ 'for the `%s` placement computes an initial `%s` of `%s',
211
+ (
212
+ inputPlacement,
213
+ expectedTranslationProp,
214
+ expectedTranslationValue
215
+ ) => {
216
+ expect(
217
+ placementToMotionAnimationProps( inputPlacement )
218
+ ).toEqual(
219
+ expect.objectContaining( {
220
+ initial: expect.objectContaining( {
221
+ [ expectedTranslationProp ]:
222
+ expectedTranslationValue,
223
+ } ),
224
+ } )
225
+ );
226
+ }
227
+ );
228
+ } );
229
+ } );
230
+ } );
@@ -121,6 +121,7 @@ export type PopoverProps = {
121
121
  * _Note: this prop is deprecated. Use the `placement` prop instead._
122
122
  */
123
123
  position?:
124
+ | `${ PositionYAxis }`
124
125
  | `${ PositionYAxis } ${ PositionXAxis }`
125
126
  | `${ PositionYAxis } ${ PositionXAxis } ${ PositionCorner }`;
126
127
  /**
@@ -14,6 +14,62 @@ import type {
14
14
  PopoverAnchorRefTopBottom,
15
15
  } from './types';
16
16
 
17
+ const POSITION_TO_PLACEMENT: Record<
18
+ NonNullable< PopoverProps[ 'position' ] >,
19
+ NonNullable< PopoverProps[ 'placement' ] >
20
+ > = {
21
+ bottom: 'bottom',
22
+ top: 'top',
23
+ 'middle left': 'left',
24
+ 'middle right': 'right',
25
+ 'bottom left': 'bottom-end',
26
+ 'bottom center': 'bottom',
27
+ 'bottom right': 'bottom-start',
28
+ 'top left': 'top-end',
29
+ 'top center': 'top',
30
+ 'top right': 'top-start',
31
+ 'middle left left': 'left',
32
+ 'middle left right': 'left',
33
+ 'middle left bottom': 'left-end',
34
+ 'middle left top': 'left-start',
35
+ 'middle right left': 'right',
36
+ 'middle right right': 'right',
37
+ 'middle right bottom': 'right-end',
38
+ 'middle right top': 'right-start',
39
+ 'bottom left left': 'bottom-end',
40
+ 'bottom left right': 'bottom-end',
41
+ 'bottom left bottom': 'bottom-end',
42
+ 'bottom left top': 'bottom-end',
43
+ 'bottom center left': 'bottom',
44
+ 'bottom center right': 'bottom',
45
+ 'bottom center bottom': 'bottom',
46
+ 'bottom center top': 'bottom',
47
+ 'bottom right left': 'bottom-start',
48
+ 'bottom right right': 'bottom-start',
49
+ 'bottom right bottom': 'bottom-start',
50
+ 'bottom right top': 'bottom-start',
51
+ 'top left left': 'top-end',
52
+ 'top left right': 'top-end',
53
+ 'top left bottom': 'top-end',
54
+ 'top left top': 'top-end',
55
+ 'top center left': 'top',
56
+ 'top center right': 'top',
57
+ 'top center bottom': 'top',
58
+ 'top center top': 'top',
59
+ 'top right left': 'top-start',
60
+ 'top right right': 'top-start',
61
+ 'top right bottom': 'top-start',
62
+ 'top right top': 'top-start',
63
+ // `middle`/`middle center [corner?]` positions are associated to a fallback
64
+ // `bottom` placement because there aren't any corresponding placement values.
65
+ middle: 'bottom',
66
+ 'middle center': 'bottom',
67
+ 'middle center bottom': 'bottom',
68
+ 'middle center left': 'bottom',
69
+ 'middle center right': 'bottom',
70
+ 'middle center top': 'bottom',
71
+ };
72
+
17
73
  /**
18
74
  * Converts the `Popover`'s legacy "position" prop to the new "placement" prop
19
75
  * (used by `floating-ui`).
@@ -23,22 +79,8 @@ import type {
23
79
  */
24
80
  export const positionToPlacement = (
25
81
  position: NonNullable< PopoverProps[ 'position' ] >
26
- ): NonNullable< PopoverProps[ 'placement' ] > => {
27
- const [ x, y, z ] = position.split( ' ' );
28
-
29
- if ( [ 'top', 'bottom' ].includes( x ) ) {
30
- let suffix = '';
31
- if ( ( !! z && z === 'left' ) || y === 'right' ) {
32
- suffix = '-start';
33
- } else if ( ( !! z && z === 'right' ) || y === 'left' ) {
34
- suffix = '-end';
35
- }
36
-
37
- return ( x + suffix ) as NonNullable< PopoverProps[ 'placement' ] >;
38
- }
39
-
40
- return y as NonNullable< PopoverProps[ 'placement' ] >;
41
- };
82
+ ): NonNullable< PopoverProps[ 'placement' ] > =>
83
+ POSITION_TO_PLACEMENT[ position ] ?? 'bottom';
42
84
 
43
85
  /**
44
86
  * @typedef AnimationOrigin
@@ -290,39 +290,6 @@ export type UseControlledRangeValueArgs = {
290
290
  value: number | null;
291
291
  };
292
292
 
293
- export type UseDebouncedHoverInteractionArgs = {
294
- /**
295
- * A callback function invoked when the element is hidden.
296
- *
297
- * @default () => {}
298
- */
299
- onHide?: () => void;
300
- /**
301
- * A callback function invoked when the mouse is moved out of the element.
302
- *
303
- * @default () => {}
304
- */
305
- onMouseLeave?: MouseEventHandler< HTMLInputElement >;
306
- /**
307
- * A callback function invoked when the mouse is moved.
308
- *
309
- * @default () => {}
310
- */
311
- onMouseMove?: MouseEventHandler< HTMLInputElement >;
312
- /**
313
- * A callback function invoked when the element is shown.
314
- *
315
- * @default () => {}
316
- */
317
- onShow?: () => void;
318
- /**
319
- * Timeout before the element is shown or hidden.
320
- *
321
- * @default 300
322
- */
323
- timeout?: number;
324
- };
325
-
326
293
  export type UseMarksArgs = NumericProps & {
327
294
  marks: RangeMarks;
328
295
  step: number;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useEffect, useRef, useState } from '@wordpress/element';
4
+ import { useCallback, useEffect, useRef, useState } from '@wordpress/element';
5
5
  import { useResizeObserver } from '@wordpress/compose';
6
6
 
7
7
  const noop = () => {};
@@ -84,23 +84,23 @@ export function useResizeLabel( {
84
84
  */
85
85
  const moveTimeoutRef = useRef< number >();
86
86
 
87
- const unsetMoveXY = () => {
88
- /*
89
- * If axis is controlled, we will avoid resetting the moveX and moveY values.
90
- * This will allow for the preferred axis values to persist in the label.
91
- */
92
- if ( isAxisControlled ) return;
93
- setMoveX( false );
94
- setMoveY( false );
95
- };
87
+ const debounceUnsetMoveXY = useCallback( () => {
88
+ const unsetMoveXY = () => {
89
+ /*
90
+ * If axis is controlled, we will avoid resetting the moveX and moveY values.
91
+ * This will allow for the preferred axis values to persist in the label.
92
+ */
93
+ if ( isAxisControlled ) return;
94
+ setMoveX( false );
95
+ setMoveY( false );
96
+ };
96
97
 
97
- const debounceUnsetMoveXY = () => {
98
98
  if ( moveTimeoutRef.current ) {
99
99
  window.clearTimeout( moveTimeoutRef.current );
100
100
  }
101
101
 
102
102
  moveTimeoutRef.current = window.setTimeout( unsetMoveXY, fadeTimeout );
103
- };
103
+ }, [ fadeTimeout, isAxisControlled ] );
104
104
 
105
105
  useEffect( () => {
106
106
  /*
@@ -143,7 +143,7 @@ export function useResizeLabel( {
143
143
 
144
144
  onResize( { width, height } );
145
145
  debounceUnsetMoveXY();
146
- }, [ width, height ] );
146
+ }, [ width, height, onResize, debounceUnsetMoveXY ] );
147
147
 
148
148
  const label = getSizeLabel( {
149
149
  axis,
@@ -205,32 +205,38 @@ export default function Sandbox( {
205
205
  setHeight( data.height );
206
206
  }
207
207
 
208
- const { ownerDocument } = ref.current;
208
+ const iframe = ref.current;
209
+ const { ownerDocument } = iframe;
209
210
  const { defaultView } = ownerDocument;
210
211
 
211
212
  // This used to be registered using <iframe onLoad={} />, but it made the iframe blank
212
213
  // after reordering the containing block. See these two issues for more details:
213
214
  // https://github.com/WordPress/gutenberg/issues/6146
214
215
  // https://github.com/facebook/react/issues/18752
215
- ref.current.addEventListener( 'load', tryNoForceSandbox, false );
216
+ iframe.addEventListener( 'load', tryNoForceSandbox, false );
216
217
  defaultView.addEventListener( 'message', checkMessageForResize );
217
218
 
218
219
  return () => {
219
- ref.current?.removeEventListener(
220
- 'load',
221
- tryNoForceSandbox,
222
- false
223
- );
220
+ iframe?.removeEventListener( 'load', tryNoForceSandbox, false );
224
221
  defaultView.addEventListener( 'message', checkMessageForResize );
225
222
  };
223
+ // Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
224
+ // See https://github.com/WordPress/gutenberg/pull/44378
225
+ // eslint-disable-next-line react-hooks/exhaustive-deps
226
226
  }, [] );
227
227
 
228
228
  useEffect( () => {
229
229
  trySandbox();
230
+ // Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
231
+ // See https://github.com/WordPress/gutenberg/pull/44378
232
+ // eslint-disable-next-line react-hooks/exhaustive-deps
230
233
  }, [ title, styles, scripts ] );
231
234
 
232
235
  useEffect( () => {
233
236
  trySandbox( true );
237
+ // Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
238
+ // See https://github.com/WordPress/gutenberg/pull/44378
239
+ // eslint-disable-next-line react-hooks/exhaustive-deps
234
240
  }, [ html, type ] );
235
241
 
236
242
  return (
@@ -282,6 +282,9 @@ function Sandbox( {
282
282
 
283
283
  useEffect( () => {
284
284
  updateContentHtml();
285
+ // Disable reason: deferring this refactor to the native team.
286
+ // see https://github.com/WordPress/gutenberg/pull/41166
287
+ // eslint-disable-next-line react-hooks/exhaustive-deps
285
288
  }, [ html, title, type, styles, scripts ] );
286
289
 
287
290
  useEffect( () => {