@wordpress/components 23.8.0 → 24.0.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 (389) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/CONTRIBUTING.md +65 -1
  3. package/README.md +1 -3
  4. package/build/autocomplete/autocompleter-ui.js +0 -2
  5. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  6. package/build/autocomplete/index.js +2 -0
  7. package/build/autocomplete/index.js.map +1 -1
  8. package/build/button/index.js +2 -0
  9. package/build/button/index.js.map +1 -1
  10. package/build/card/card-media/component.js +2 -1
  11. package/build/card/card-media/component.js.map +1 -1
  12. package/build/checkbox-control/index.js +2 -2
  13. package/build/checkbox-control/index.js.map +1 -1
  14. package/build/color-palette/index.native.js +12 -0
  15. package/build/color-palette/index.native.js.map +1 -1
  16. package/build/combobox-control/index.js +7 -5
  17. package/build/combobox-control/index.js.map +1 -1
  18. package/build/combobox-control/styles.js +3 -3
  19. package/build/combobox-control/styles.js.map +1 -1
  20. package/build/custom-gradient-picker/index.native.js +3 -1
  21. package/build/custom-gradient-picker/index.native.js.map +1 -1
  22. package/build/dimension-control/index.js +1 -1
  23. package/build/dimension-control/index.js.map +1 -1
  24. package/build/draggable/index.js +8 -8
  25. package/build/draggable/index.js.map +1 -1
  26. package/build/form-token-field/index.js +5 -3
  27. package/build/form-token-field/index.js.map +1 -1
  28. package/build/form-token-field/styles.js +3 -3
  29. package/build/form-token-field/styles.js.map +1 -1
  30. package/build/index.js.map +1 -1
  31. package/build/mobile/bottom-sheet/cell.native.js +6 -6
  32. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  33. package/build/mobile/color-settings/palette.screen.native.js +0 -8
  34. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  35. package/build/mobile/global-styles-context/index.native.js +13 -1
  36. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  37. package/build/mobile/global-styles-context/utils.native.js +21 -4
  38. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  39. package/build/mobile/link-picker/link-picker-results.native.js +3 -1
  40. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  41. package/build/mobile/segmented-control/index.native.js +4 -2
  42. package/build/mobile/segmented-control/index.native.js.map +1 -1
  43. package/build/modal/index.js +2 -1
  44. package/build/modal/index.js.map +1 -1
  45. package/build/navigable-container/container.js +39 -19
  46. package/build/navigable-container/container.js.map +1 -1
  47. package/build/navigable-container/index.js.map +1 -1
  48. package/build/navigable-container/menu.js +37 -5
  49. package/build/navigable-container/menu.js.map +1 -1
  50. package/build/navigable-container/tabbable.js +45 -4
  51. package/build/navigable-container/tabbable.js.map +1 -1
  52. package/build/navigable-container/types.js +6 -0
  53. package/build/navigable-container/types.js.map +1 -0
  54. package/build/navigator/navigator-screen/component.js +1 -1
  55. package/build/navigator/navigator-screen/component.js.map +1 -1
  56. package/build/palette-edit/index.js +34 -12
  57. package/build/palette-edit/index.js.map +1 -1
  58. package/build/popover/index.js +1 -8
  59. package/build/popover/index.js.map +1 -1
  60. package/build/private-apis.js +4 -1
  61. package/build/private-apis.js.map +1 -1
  62. package/build/sandbox/index.native.js +10 -3
  63. package/build/sandbox/index.native.js.map +1 -1
  64. package/build/slot-fill/bubbles-virtually/fill.js +2 -1
  65. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  66. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +45 -35
  67. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  68. package/build/slot-fill/bubbles-virtually/use-slot.js +11 -26
  69. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  70. package/build/slot-fill/fill.js +7 -31
  71. package/build/slot-fill/fill.js.map +1 -1
  72. package/build/slot-fill/index.js +20 -7
  73. package/build/slot-fill/index.js.map +1 -1
  74. package/build/slot-fill/provider.js +0 -6
  75. package/build/slot-fill/provider.js.map +1 -1
  76. package/build/slot-fill/slot.js +0 -5
  77. package/build/slot-fill/slot.js.map +1 -1
  78. package/build/spinner/styles.js +4 -4
  79. package/build/spinner/styles.js.map +1 -1
  80. package/build/tab-panel/index.js.map +1 -1
  81. package/build/theme/color-algorithms.js +1 -1
  82. package/build/theme/color-algorithms.js.map +1 -1
  83. package/build/toolbar/toolbar-button/index.js +1 -2
  84. package/build/toolbar/toolbar-button/index.js.map +1 -1
  85. package/build/toolbar/toolbar-item/index.js +4 -2
  86. package/build/toolbar/toolbar-item/index.js.map +1 -1
  87. package/build/tree-grid/index.js +3 -3
  88. package/build/tree-grid/index.js.map +1 -1
  89. package/build/utils/colors-values.js +3 -3
  90. package/build/utils/colors-values.js.map +1 -1
  91. package/build/utils/use-deprecated-props.js +35 -0
  92. package/build/utils/use-deprecated-props.js.map +1 -0
  93. package/build/view/component.js +1 -2
  94. package/build/view/component.js.map +1 -1
  95. package/build-module/autocomplete/autocompleter-ui.js +1 -3
  96. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  97. package/build-module/autocomplete/index.js +3 -3
  98. package/build-module/autocomplete/index.js.map +1 -1
  99. package/build-module/button/index.js +2 -0
  100. package/build-module/button/index.js.map +1 -1
  101. package/build-module/card/card-media/component.js +2 -1
  102. package/build-module/card/card-media/component.js.map +1 -1
  103. package/build-module/checkbox-control/index.js +2 -2
  104. package/build-module/checkbox-control/index.js.map +1 -1
  105. package/build-module/color-palette/index.native.js +13 -1
  106. package/build-module/color-palette/index.native.js.map +1 -1
  107. package/build-module/combobox-control/index.js +6 -5
  108. package/build-module/combobox-control/index.js.map +1 -1
  109. package/build-module/combobox-control/styles.js +3 -3
  110. package/build-module/combobox-control/styles.js.map +1 -1
  111. package/build-module/custom-gradient-picker/index.native.js +3 -1
  112. package/build-module/custom-gradient-picker/index.native.js.map +1 -1
  113. package/build-module/dimension-control/index.js +1 -1
  114. package/build-module/dimension-control/index.js.map +1 -1
  115. package/build-module/draggable/index.js +8 -8
  116. package/build-module/draggable/index.js.map +1 -1
  117. package/build-module/form-token-field/index.js +4 -3
  118. package/build-module/form-token-field/index.js.map +1 -1
  119. package/build-module/form-token-field/styles.js +3 -3
  120. package/build-module/form-token-field/styles.js.map +1 -1
  121. package/build-module/index.js.map +1 -1
  122. package/build-module/mobile/bottom-sheet/cell.native.js +6 -5
  123. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  124. package/build-module/mobile/color-settings/palette.screen.native.js +0 -8
  125. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  126. package/build-module/mobile/global-styles-context/index.native.js +13 -1
  127. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  128. package/build-module/mobile/global-styles-context/utils.native.js +21 -3
  129. package/build-module/mobile/global-styles-context/utils.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/segmented-control/index.native.js +4 -2
  133. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  134. package/build-module/modal/index.js +2 -1
  135. package/build-module/modal/index.js.map +1 -1
  136. package/build-module/navigable-container/container.js +43 -19
  137. package/build-module/navigable-container/container.js.map +1 -1
  138. package/build-module/navigable-container/index.js +0 -2
  139. package/build-module/navigable-container/index.js.map +1 -1
  140. package/build-module/navigable-container/menu.js +36 -4
  141. package/build-module/navigable-container/menu.js.map +1 -1
  142. package/build-module/navigable-container/tabbable.js +44 -3
  143. package/build-module/navigable-container/tabbable.js.map +1 -1
  144. package/build-module/navigable-container/types.js +2 -0
  145. package/build-module/navigable-container/types.js.map +1 -0
  146. package/build-module/navigator/navigator-screen/component.js +1 -1
  147. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  148. package/build-module/palette-edit/index.js +34 -13
  149. package/build-module/palette-edit/index.js.map +1 -1
  150. package/build-module/popover/index.js +1 -8
  151. package/build-module/popover/index.js.map +1 -1
  152. package/build-module/private-apis.js +3 -1
  153. package/build-module/private-apis.js.map +1 -1
  154. package/build-module/sandbox/index.native.js +10 -3
  155. package/build-module/sandbox/index.native.js.map +1 -1
  156. package/build-module/slot-fill/bubbles-virtually/fill.js +2 -1
  157. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  158. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +46 -36
  159. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  160. package/build-module/slot-fill/bubbles-virtually/use-slot.js +12 -27
  161. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  162. package/build-module/slot-fill/fill.js +7 -31
  163. package/build-module/slot-fill/fill.js.map +1 -1
  164. package/build-module/slot-fill/index.js +17 -8
  165. package/build-module/slot-fill/index.js.map +1 -1
  166. package/build-module/slot-fill/provider.js +0 -6
  167. package/build-module/slot-fill/provider.js.map +1 -1
  168. package/build-module/slot-fill/slot.js +0 -5
  169. package/build-module/slot-fill/slot.js.map +1 -1
  170. package/build-module/spinner/styles.js +4 -4
  171. package/build-module/spinner/styles.js.map +1 -1
  172. package/build-module/tab-panel/index.js.map +1 -1
  173. package/build-module/theme/color-algorithms.js +1 -1
  174. package/build-module/theme/color-algorithms.js.map +1 -1
  175. package/build-module/toolbar/toolbar-button/index.js +1 -2
  176. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  177. package/build-module/toolbar/toolbar-item/index.js +5 -2
  178. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  179. package/build-module/tree-grid/index.js +3 -3
  180. package/build-module/tree-grid/index.js.map +1 -1
  181. package/build-module/utils/colors-values.js +3 -3
  182. package/build-module/utils/colors-values.js.map +1 -1
  183. package/build-module/utils/use-deprecated-props.js +25 -0
  184. package/build-module/utils/use-deprecated-props.js.map +1 -0
  185. package/build-module/view/component.js +1 -2
  186. package/build-module/view/component.js.map +1 -1
  187. package/build-style/style-rtl.css +83 -70
  188. package/build-style/style.css +83 -70
  189. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  190. package/build-types/autocomplete/index.d.ts.map +1 -1
  191. package/build-types/autocomplete/types.d.ts +2 -18
  192. package/build-types/autocomplete/types.d.ts.map +1 -1
  193. package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
  194. package/build-types/button/deprecated.d.ts +12 -6
  195. package/build-types/button/deprecated.d.ts.map +1 -1
  196. package/build-types/button/index.d.ts.map +1 -1
  197. package/build-types/button/types.d.ts +7 -0
  198. package/build-types/button/types.d.ts.map +1 -1
  199. package/build-types/card/card-media/component.d.ts +2 -1
  200. package/build-types/card/card-media/component.d.ts.map +1 -1
  201. package/build-types/card/stories/index.d.ts +21 -1
  202. package/build-types/card/stories/index.d.ts.map +1 -1
  203. package/build-types/checkbox-control/index.d.ts.map +1 -1
  204. package/build-types/color-palette/styles.d.ts +1 -1
  205. package/build-types/color-picker/styles.d.ts +3 -3
  206. package/build-types/combobox-control/index.d.ts +1 -1
  207. package/build-types/combobox-control/index.d.ts.map +1 -1
  208. package/build-types/combobox-control/stories/index.d.ts.map +1 -1
  209. package/build-types/combobox-control/styles.d.ts +1 -1
  210. package/build-types/combobox-control/types.d.ts +8 -1
  211. package/build-types/combobox-control/types.d.ts.map +1 -1
  212. package/build-types/date-time/date/styles.d.ts +1 -1
  213. package/build-types/date-time/time/styles.d.ts +4 -4
  214. package/build-types/dimension-control/index.d.ts +1 -1
  215. package/build-types/draggable/index.d.ts +1 -1
  216. package/build-types/draggable/index.d.ts.map +1 -1
  217. package/build-types/draggable/stories/index.d.ts +8 -0
  218. package/build-types/draggable/stories/index.d.ts.map +1 -1
  219. package/build-types/draggable/types.d.ts +7 -0
  220. package/build-types/draggable/types.d.ts.map +1 -1
  221. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  222. package/build-types/form-token-field/index.d.ts.map +1 -1
  223. package/build-types/form-token-field/styles.d.ts +1 -1
  224. package/build-types/form-token-field/types.d.ts +8 -1
  225. package/build-types/form-token-field/types.d.ts.map +1 -1
  226. package/build-types/index.d.ts +1 -0
  227. package/build-types/index.d.ts.map +1 -1
  228. package/build-types/modal/index.d.ts.map +1 -1
  229. package/build-types/navigable-container/container.d.ts +20 -1
  230. package/build-types/navigable-container/container.d.ts.map +1 -1
  231. package/build-types/navigable-container/index.d.ts +5 -2
  232. package/build-types/navigable-container/index.d.ts.map +1 -1
  233. package/build-types/navigable-container/menu.d.ts +45 -11
  234. package/build-types/navigable-container/menu.d.ts.map +1 -1
  235. package/build-types/navigable-container/stories/navigable-menu.d.ts +12 -0
  236. package/build-types/navigable-container/stories/navigable-menu.d.ts.map +1 -0
  237. package/build-types/navigable-container/stories/tabbable-container.d.ts +12 -0
  238. package/build-types/navigable-container/stories/tabbable-container.d.ts.map +1 -0
  239. package/build-types/navigable-container/tabbable.d.ts +52 -9
  240. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  241. package/build-types/navigable-container/test/navigable-menu.d.ts +2 -0
  242. package/build-types/navigable-container/test/navigable-menu.d.ts.map +1 -0
  243. package/build-types/navigable-container/test/tababble-container.d.ts +2 -0
  244. package/build-types/navigable-container/test/tababble-container.d.ts.map +1 -0
  245. package/build-types/navigable-container/types.d.ts +61 -0
  246. package/build-types/navigable-container/types.d.ts.map +1 -0
  247. package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
  248. package/build-types/navigator/navigator-back-button/component.d.ts +2 -1
  249. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  250. package/build-types/navigator/navigator-back-button/hook.d.ts +2 -1
  251. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  252. package/build-types/navigator/navigator-button/component.d.ts +2 -1
  253. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  254. package/build-types/navigator/navigator-button/hook.d.ts +2 -1
  255. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  256. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  257. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  258. package/build-types/navigator/navigator-to-parent-button/component.d.ts +2 -1
  259. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
  260. package/build-types/number-control/index.d.ts +1 -1
  261. package/build-types/number-control/stories/index.d.ts +1 -1
  262. package/build-types/palette-edit/index.d.ts +1 -1
  263. package/build-types/palette-edit/index.d.ts.map +1 -1
  264. package/build-types/palette-edit/stories/index.d.ts.map +1 -1
  265. package/build-types/palette-edit/styles.d.ts +16 -10
  266. package/build-types/palette-edit/styles.d.ts.map +1 -1
  267. package/build-types/palette-edit/types.d.ts +8 -0
  268. package/build-types/palette-edit/types.d.ts.map +1 -1
  269. package/build-types/popover/index.d.ts +1 -1
  270. package/build-types/popover/index.d.ts.map +1 -1
  271. package/build-types/popover/stories/e2e/index.d.ts +1 -1
  272. package/build-types/private-apis.d.ts.map +1 -1
  273. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  274. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  275. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  276. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  277. package/build-types/slot-fill/fill.d.ts +4 -2
  278. package/build-types/slot-fill/fill.d.ts.map +1 -1
  279. package/build-types/slot-fill/index.d.ts +14 -3
  280. package/build-types/slot-fill/index.d.ts.map +1 -1
  281. package/build-types/slot-fill/provider.d.ts +0 -2
  282. package/build-types/slot-fill/provider.d.ts.map +1 -1
  283. package/build-types/slot-fill/slot.d.ts.map +1 -1
  284. package/build-types/spinner/styles.d.ts.map +1 -1
  285. package/build-types/toolbar/stories/index.d.ts.map +1 -1
  286. package/build-types/toolbar/toolbar-button/index.d.ts +12 -6
  287. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  288. package/build-types/toolbar/toolbar-item/index.d.ts +6 -4
  289. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  290. package/build-types/tree-grid/index.d.ts.map +1 -1
  291. package/build-types/tree-grid/types.d.ts +7 -0
  292. package/build-types/tree-grid/types.d.ts.map +1 -1
  293. package/build-types/ui/context/wordpress-component.d.ts +1 -1
  294. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  295. package/build-types/unit-control/index.d.ts +1 -1
  296. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  297. package/build-types/utils/use-deprecated-props.d.ts +9 -0
  298. package/build-types/utils/use-deprecated-props.d.ts.map +1 -0
  299. package/build-types/view/component.d.ts +1 -1
  300. package/build-types/view/component.d.ts.map +1 -1
  301. package/package.json +21 -22
  302. package/src/autocomplete/README.md +82 -54
  303. package/src/autocomplete/autocompleter-ui.tsx +0 -2
  304. package/src/autocomplete/index.tsx +1 -2
  305. package/src/autocomplete/types.ts +3 -19
  306. package/src/button/index.tsx +2 -0
  307. package/src/button/style.scss +13 -6
  308. package/src/button/types.ts +7 -0
  309. package/src/card/card-media/README.md +1 -1
  310. package/src/card/card-media/component.tsx +2 -1
  311. package/src/card/stories/index.tsx +47 -26
  312. package/src/checkbox-control/index.tsx +6 -2
  313. package/src/checkbox-control/style.scss +1 -4
  314. package/src/color-palette/index.native.js +20 -1
  315. package/src/color-picker/test/index.tsx +99 -99
  316. package/src/combobox-control/index.tsx +24 -18
  317. package/src/combobox-control/stories/index.tsx +0 -1
  318. package/src/combobox-control/styles.ts +4 -4
  319. package/src/combobox-control/types.ts +8 -1
  320. package/src/custom-gradient-picker/index.native.js +1 -1
  321. package/src/custom-gradient-picker/style.scss +2 -2
  322. package/src/dimension-control/README.md +1 -1
  323. package/src/dimension-control/index.tsx +1 -1
  324. package/src/draggable/README.md +8 -1
  325. package/src/draggable/index.tsx +7 -10
  326. package/src/draggable/stories/index.tsx +69 -33
  327. package/src/draggable/types.ts +7 -0
  328. package/src/form-toggle/style.scss +1 -5
  329. package/src/form-token-field/index.tsx +7 -3
  330. package/src/form-token-field/styles.ts +4 -4
  331. package/src/form-token-field/types.ts +8 -1
  332. package/src/index.ts +1 -0
  333. package/src/mobile/bottom-sheet/cell.native.js +4 -5
  334. package/src/mobile/color-settings/palette.screen.native.js +0 -7
  335. package/src/mobile/global-styles-context/index.native.js +12 -1
  336. package/src/mobile/global-styles-context/utils.native.js +18 -3
  337. package/src/mobile/link-picker/link-picker-results.native.js +3 -0
  338. package/src/mobile/segmented-control/index.native.js +2 -2
  339. package/src/modal/index.tsx +6 -1
  340. package/src/modal/style.scss +21 -13
  341. package/src/navigable-container/README.md +24 -13
  342. package/src/navigable-container/{container.js → container.tsx} +57 -27
  343. package/src/navigable-container/{index.js → index.tsx} +0 -1
  344. package/src/navigable-container/menu.tsx +100 -0
  345. package/src/navigable-container/stories/{navigable-menu.js → navigable-menu.tsx} +15 -10
  346. package/src/navigable-container/stories/{tabbable-container.js → tabbable-container.tsx} +15 -6
  347. package/src/navigable-container/tabbable.tsx +92 -0
  348. package/src/navigable-container/test/{navigable-menu.js → navigable-menu.tsx} +3 -1
  349. package/src/navigable-container/test/{tababble-container.js → tababble-container.tsx} +53 -24
  350. package/src/navigable-container/types.ts +76 -0
  351. package/src/navigator/navigator-screen/component.tsx +1 -1
  352. package/src/palette-edit/index.tsx +45 -7
  353. package/src/palette-edit/stories/index.tsx +4 -0
  354. package/src/palette-edit/types.ts +11 -0
  355. package/src/popover/index.tsx +2 -15
  356. package/src/private-apis.ts +2 -0
  357. package/src/sandbox/index.native.js +12 -1
  358. package/src/slot-fill/bubbles-virtually/fill.js +2 -1
  359. package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +46 -60
  360. package/src/slot-fill/bubbles-virtually/use-slot.js +14 -41
  361. package/src/slot-fill/fill.js +4 -26
  362. package/src/slot-fill/index.js +14 -8
  363. package/src/slot-fill/provider.js +0 -6
  364. package/src/slot-fill/slot.js +0 -5
  365. package/src/snackbar/style.scss +2 -1
  366. package/src/spinner/styles.ts +2 -0
  367. package/src/style.scss +6 -0
  368. package/src/tab-panel/index.tsx +1 -1
  369. package/src/theme/color-algorithms.ts +1 -1
  370. package/src/theme/stories/index.tsx +1 -1
  371. package/src/theme/test/color-algorithms.ts +2 -2
  372. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +4 -4
  373. package/src/toolbar/stories/index.tsx +26 -24
  374. package/src/toolbar/toolbar-button/index.tsx +10 -13
  375. package/src/toolbar/toolbar-item/{index.js → index.tsx} +12 -3
  376. package/src/tree-grid/README.md +18 -0
  377. package/src/tree-grid/index.tsx +7 -2
  378. package/src/tree-grid/types.ts +7 -0
  379. package/src/ui/context/wordpress-component.ts +1 -1
  380. package/src/utils/colors-values.js +3 -3
  381. package/src/utils/theme-variables.scss +4 -4
  382. package/src/utils/use-deprecated-props.ts +29 -0
  383. package/src/view/component.tsx +2 -2
  384. package/tsconfig.json +3 -2
  385. package/tsconfig.tsbuildinfo +1 -1
  386. package/src/CONTRIBUTING.md +0 -78
  387. package/src/README.md +0 -20
  388. package/src/navigable-container/menu.js +0 -62
  389. package/src/navigable-container/tabbable.js +0 -46
@@ -41,31 +41,52 @@ const meta: ComponentMeta< typeof Card > = {
41
41
  export default meta;
42
42
 
43
43
  const Template: ComponentStory< typeof Card > = ( args ) => (
44
- <Card { ...args }>
45
- <CardHeader>
46
- <Heading>CardHeader</Heading>
47
- </CardHeader>
48
- <CardBody>
49
- <Text>CardBody</Text>
50
- </CardBody>
51
- <CardBody>
52
- <Text>CardBody (before CardDivider)</Text>
53
- </CardBody>
54
- <CardDivider />
55
- <CardBody>
56
- <Text>CardBody (after CardDivider)</Text>
57
- </CardBody>
58
- <CardMedia>
59
- <img
60
- alt="Card Media"
61
- src="https://images.unsplash.com/photo-1566125882500-87e10f726cdc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1867&q=80"
62
- />
63
- </CardMedia>
64
- <CardFooter>
65
- <Text>CardFooter</Text>
66
- <Button variant="secondary">Action Button</Button>
67
- </CardFooter>
68
- </Card>
44
+ <Card { ...args } />
69
45
  );
70
46
 
71
- export const Default: ComponentStory< typeof Card > = Template.bind( {} );
47
+ export const Default = Template.bind( {} );
48
+ Default.args = {
49
+ children: (
50
+ <>
51
+ <CardHeader>
52
+ <Heading>CardHeader</Heading>
53
+ </CardHeader>
54
+ <CardBody>
55
+ <Text>CardBody</Text>
56
+ </CardBody>
57
+ <CardBody>
58
+ <Text>CardBody (before CardDivider)</Text>
59
+ </CardBody>
60
+ <CardDivider />
61
+ <CardBody>
62
+ <Text>CardBody (after CardDivider)</Text>
63
+ </CardBody>
64
+ <CardMedia>
65
+ <img
66
+ alt="Card Media"
67
+ src="https://images.unsplash.com/photo-1566125882500-87e10f726cdc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1867&q=80"
68
+ />
69
+ </CardMedia>
70
+ <CardFooter>
71
+ <Text>CardFooter</Text>
72
+ <Button variant="secondary">Action Button</Button>
73
+ </CardFooter>
74
+ </>
75
+ ),
76
+ };
77
+
78
+ /**
79
+ * `CardMedia` provides a container for full-bleed content within a `Card`,
80
+ * such as images, video, or even just a background color. The corners will be rounded if necessary.
81
+ */
82
+ export const FullBleedContent = Template.bind( {} );
83
+ FullBleedContent.args = {
84
+ ...Default.args,
85
+ children: (
86
+ <CardMedia>
87
+ <div style={ { padding: 16, background: 'beige' } }>
88
+ Some full bleed content
89
+ </div>
90
+ </CardMedia>
91
+ ),
92
+ };
@@ -50,6 +50,7 @@ export function CheckboxControl(
50
50
  checked,
51
51
  indeterminate,
52
52
  help,
53
+ id: idProp,
53
54
  onChange,
54
55
  ...additionalProps
55
56
  } = props;
@@ -81,8 +82,11 @@ export function CheckboxControl(
81
82
  },
82
83
  [ checked, indeterminate ]
83
84
  );
84
- const instanceId = useInstanceId( CheckboxControl );
85
- const id = `inspector-checkbox-control-${ instanceId }`;
85
+ const id = useInstanceId(
86
+ CheckboxControl,
87
+ 'inspector-checkbox-control',
88
+ idProp
89
+ );
86
90
  const onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>
87
91
  onChange( event.target.checked );
88
92
 
@@ -27,10 +27,7 @@ $checkbox-input-size-sm: 24px; // Width & height for small viewports.
27
27
  @include reduce-motion("transition");
28
28
 
29
29
  &:focus {
30
- box-shadow: 0 0 0 ($border-width * 2) $white, 0 0 0 ($border-width * 2 + $border-width-focus) $components-color-accent;
31
-
32
- // Only visible in Windows High Contrast mode.
33
- outline: 2px solid transparent;
30
+ @include button-style-outset__focus(var(--wp-admin-theme-color));
34
31
  }
35
32
 
36
33
  &:checked,
@@ -15,7 +15,7 @@ import {
15
15
  /**
16
16
  * WordPress dependencies
17
17
  */
18
- import { __ } from '@wordpress/i18n';
18
+ import { __, sprintf } from '@wordpress/i18n';
19
19
  import { useRef, useEffect } from '@wordpress/element';
20
20
  import { usePreferredColorSchemeStyle } from '@wordpress/compose';
21
21
 
@@ -175,6 +175,22 @@ function ColorPalette( {
175
175
  }
176
176
  }
177
177
 
178
+ function getColorGradientName( value ) {
179
+ const fallbackName = sprintf(
180
+ /* translators: %s: the hex color value */
181
+ __( 'Unlabeled color. %s' ),
182
+ value
183
+ );
184
+ const foundColorName = isGradientSegment
185
+ ? defaultSettings.gradients?.find(
186
+ ( gradient ) => gradient.gradient === value
187
+ )
188
+ : defaultSettings.allColors?.find(
189
+ ( color ) => color.color === value
190
+ );
191
+ return foundColorName ? foundColorName?.name : fallbackName;
192
+ }
193
+
178
194
  function onColorPress( color ) {
179
195
  deselectCustomGradient();
180
196
  performAnimation( color );
@@ -251,6 +267,8 @@ function ColorPalette( {
251
267
  const scaleValue = isSelected( color )
252
268
  ? scaleInterpolation
253
269
  : 1;
270
+ const colorName = getColorGradientName( color );
271
+
254
272
  return (
255
273
  <View key={ `${ color }-${ isSelected( color ) }` }>
256
274
  <TouchableWithoutFeedback
@@ -260,6 +278,7 @@ function ColorPalette( {
260
278
  selected: isSelected( color ),
261
279
  } }
262
280
  accessibilityHint={ color }
281
+ accessibilityLabel={ colorName }
263
282
  testID={ color }
264
283
  >
265
284
  <Animated.View
@@ -1,49 +1,14 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render, fireEvent, waitFor } from '@testing-library/react';
4
+ import { screen, render } from '@testing-library/react';
5
+ import userEvent from '@testing-library/user-event';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
10
  import { ColorPicker } from '..';
10
11
 
11
- /**
12
- * Ordinarily we'd try to select the component by role but the slider role appears
13
- * on several elements and we'd end up encoding assumptions about order when
14
- * trying to select the appropriate element. We might as well just use the class name
15
- * on the container which will be more durable if, for example, the order changes.
16
- */
17
- function getSaturation( container: HTMLElement ) {
18
- return container.querySelector(
19
- '.react-colorful__saturation .react-colorful__interactive'
20
- );
21
- }
22
-
23
- type PageXPageY = { pageX: number; pageY: number };
24
-
25
- // Fix to pass `pageX` and `pageY`
26
- // See https://github.com/testing-library/react-testing-library/issues/268
27
- class FakeMouseEvent extends MouseEvent {
28
- constructor( type: MouseEvent[ 'type' ], values?: PageXPageY ) {
29
- super( type, { buttons: 1, bubbles: true, ...values } );
30
-
31
- Object.assign( this, {
32
- pageX: values?.pageX ?? 0,
33
- pageY: values?.pageY ?? 0,
34
- } );
35
- }
36
- }
37
-
38
- function moveReactColorfulSlider(
39
- sliderElement: Element,
40
- from: PageXPageY,
41
- to: PageXPageY
42
- ) {
43
- fireEvent( sliderElement, new FakeMouseEvent( 'mousedown', from ) );
44
- fireEvent( sliderElement, new FakeMouseEvent( 'mousemove', to ) );
45
- }
46
-
47
12
  const hslaMatcher = expect.objectContaining( {
48
13
  h: expect.any( Number ),
49
14
  s: expect.any( Number ),
@@ -73,99 +38,134 @@ const legacyColorMatcher = {
73
38
  describe( 'ColorPicker', () => {
74
39
  describe( 'legacy props', () => {
75
40
  it( 'should fire onChangeComplete with the legacy color format', async () => {
41
+ const user = userEvent.setup();
76
42
  const onChangeComplete = jest.fn();
77
- const color = '#fff';
43
+ const color = '#000';
78
44
 
79
- const { container } = render(
45
+ render(
80
46
  <ColorPicker
81
47
  onChangeComplete={ onChangeComplete }
82
48
  color={ color }
49
+ enableAlpha={ false }
83
50
  />
84
51
  );
85
52
 
86
- const saturation = getSaturation( container );
87
-
88
- if ( saturation === null ) {
89
- throw new Error( 'The saturation slider could not be found' );
90
- }
53
+ const formatSelector = screen.getByRole( 'combobox' );
54
+ expect( formatSelector ).toBeVisible();
91
55
 
92
- expect( saturation ).toBeInTheDocument();
56
+ await user.selectOptions( formatSelector, 'hex' );
93
57
 
94
- moveReactColorfulSlider(
95
- saturation,
96
- { pageX: 0, pageY: 0 },
97
- { pageX: 10, pageY: 10 }
98
- );
58
+ const hexInput = screen.getByRole( 'textbox' );
59
+ expect( hexInput ).toBeVisible();
99
60
 
100
- await waitFor( () =>
101
- expect( onChangeComplete ).toHaveBeenCalled()
102
- );
61
+ await user.clear( hexInput );
62
+ await user.type( hexInput, '1ab' );
103
63
 
104
- expect( onChangeComplete ).toHaveBeenCalledWith(
64
+ expect( onChangeComplete ).toHaveBeenCalledTimes( 3 );
65
+ expect( onChangeComplete ).toHaveBeenLastCalledWith(
105
66
  legacyColorMatcher
106
67
  );
107
68
  } );
108
69
  } );
70
+ describe( 'Hex input', () => {
71
+ it( 'should fire onChange with the correct value from the hex input', async () => {
72
+ const user = userEvent.setup();
73
+ const onChange = jest.fn();
74
+ const color = '#000';
75
+
76
+ render(
77
+ <ColorPicker
78
+ onChange={ onChange }
79
+ color={ color }
80
+ enableAlpha={ false }
81
+ />
82
+ );
83
+
84
+ const formatSelector = screen.getByRole( 'combobox' );
85
+ expect( formatSelector ).toBeVisible();
86
+
87
+ await user.selectOptions( formatSelector, 'hex' );
109
88
 
110
- it( 'should fire onChange with the string value', async () => {
111
- const onChange = jest.fn();
112
- const color = 'rgba(1, 1, 1, 0.5)';
89
+ const hexInput = screen.getByRole( 'textbox' );
90
+ expect( hexInput ).toBeVisible();
113
91
 
114
- const { container } = render(
115
- <ColorPicker onChange={ onChange } color={ color } enableAlpha />
116
- );
92
+ await user.clear( hexInput );
93
+ await user.type( hexInput, '1ab' );
117
94
 
118
- const saturation = getSaturation( container );
95
+ expect( onChange ).toHaveBeenCalledTimes( 3 );
96
+ expect( onChange ).toHaveBeenLastCalledWith( '#11aabb' );
97
+ } );
98
+ } );
119
99
 
120
- if ( saturation === null ) {
121
- throw new Error( 'The saturation slider could not be found' );
122
- }
100
+ describe.each( [
101
+ [ 'red', 'Red', '#7dffff' ],
102
+ [ 'green', 'Green', '#ff7dff' ],
103
+ [ 'blue', 'Blue', '#ffff7d' ],
104
+ ] )( 'RGB inputs', ( colorInput, inputLabel, expected ) => {
105
+ it( `should fire onChange with the correct value when the ${ colorInput } value is updated`, async () => {
106
+ const user = userEvent.setup();
107
+ const onChange = jest.fn();
108
+ const color = '#fff';
123
109
 
124
- expect( saturation ).toBeInTheDocument();
110
+ render(
111
+ <ColorPicker
112
+ onChange={ onChange }
113
+ color={ color }
114
+ enableAlpha={ false }
115
+ />
116
+ );
125
117
 
126
- moveReactColorfulSlider(
127
- saturation,
128
- { pageX: 0, pageY: 0 },
129
- { pageX: 10, pageY: 10 }
130
- );
118
+ const formatSelector = screen.getByRole( 'combobox' );
119
+ expect( formatSelector ).toBeVisible();
131
120
 
132
- await waitFor( () => expect( onChange ).toHaveBeenCalled() );
121
+ await user.selectOptions( formatSelector, 'rgb' );
133
122
 
134
- expect( onChange ).toHaveBeenCalledWith(
135
- expect.stringMatching( /^#([a-fA-F0-9]{8})$/ )
136
- );
137
- } );
123
+ const inputElement = screen.getByRole( 'spinbutton', {
124
+ name: inputLabel,
125
+ } );
126
+ expect( inputElement ).toBeVisible();
138
127
 
139
- it( 'should fire onChange with the HSL value', async () => {
140
- const onChange = jest.fn();
141
- const color = 'hsla(125, 20%, 50%, 0.5)';
128
+ await user.clear( inputElement );
129
+ await user.type( inputElement, '125' );
142
130
 
143
- const { container } = render(
144
- <ColorPicker
145
- onChange={ onChange }
146
- color={ color }
147
- enableAlpha={ false }
148
- />
149
- );
131
+ expect( onChange ).toHaveBeenCalledTimes( 4 );
132
+ expect( onChange ).toHaveBeenLastCalledWith( expected );
133
+ } );
134
+ } );
150
135
 
151
- const saturation = getSaturation( container );
136
+ describe.each( [
137
+ [ 'hue', 'Hue', '#aad52a' ],
138
+ [ 'saturation', 'Saturation', '#20dfdf' ],
139
+ [ 'lightness', 'Lightness', '#95eaea' ],
140
+ ] )( 'HSL inputs', ( colorInput, inputLabel, expected ) => {
141
+ it( `should fire onChange with the correct value when the ${ colorInput } value is updated`, async () => {
142
+ const user = userEvent.setup();
143
+ const onChange = jest.fn();
144
+ const color = '#2ad5d5';
145
+
146
+ render(
147
+ <ColorPicker
148
+ onChange={ onChange }
149
+ color={ color }
150
+ enableAlpha={ false }
151
+ />
152
+ );
152
153
 
153
- if ( saturation === null ) {
154
- throw new Error( 'The saturation slider could not be found' );
155
- }
154
+ const formatSelector = screen.getByRole( 'combobox' );
155
+ expect( formatSelector ).toBeVisible();
156
156
 
157
- expect( saturation ).toBeInTheDocument();
157
+ await user.selectOptions( formatSelector, 'hsl' );
158
158
 
159
- moveReactColorfulSlider(
160
- saturation,
161
- { pageX: 0, pageY: 0 },
162
- { pageX: 10, pageY: 10 }
163
- );
159
+ const inputElement = screen.getByRole( 'spinbutton', {
160
+ name: inputLabel,
161
+ } );
162
+ expect( inputElement ).toBeVisible();
164
163
 
165
- await waitFor( () => expect( onChange ).toHaveBeenCalled() );
164
+ await user.clear( inputElement );
165
+ await user.type( inputElement, '75' );
166
166
 
167
- expect( onChange ).toHaveBeenCalledWith(
168
- expect.stringMatching( /^#([a-fA-F0-9]{6})$/ )
169
- );
167
+ expect( onChange ).toHaveBeenCalledTimes( 3 );
168
+ expect( onChange ).toHaveBeenLastCalledWith( expected );
169
+ } );
170
170
  } );
171
171
  } );
@@ -32,6 +32,7 @@ import { useControlledValue } from '../utils/hooks';
32
32
  import { normalizeTextString } from '../utils/strings';
33
33
  import type { ComboboxControlOption, ComboboxControlProps } from './types';
34
34
  import type { TokenInputProps } from '../form-token-field/types';
35
+ import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
35
36
 
36
37
  const noop = () => {};
37
38
 
@@ -104,23 +105,28 @@ const getIndexOfMatchingSuggestion = (
104
105
  * }
105
106
  * ```
106
107
  */
107
- function ComboboxControl( {
108
- __nextHasNoMarginBottom = false,
109
- __next36pxDefaultSize = false,
110
- value: valueProp,
111
- label,
112
- options,
113
- onChange: onChangeProp,
114
- onFilterValueChange = noop,
115
- hideLabelFromVision,
116
- help,
117
- allowReset = true,
118
- className,
119
- messages = {
120
- selected: __( 'Item selected.' ),
121
- },
122
- __experimentalRenderItem,
123
- }: ComboboxControlProps ) {
108
+ function ComboboxControl( props: ComboboxControlProps ) {
109
+ const {
110
+ __nextHasNoMarginBottom = false,
111
+ __next40pxDefaultSize = false,
112
+ value: valueProp,
113
+ label,
114
+ options,
115
+ onChange: onChangeProp,
116
+ onFilterValueChange = noop,
117
+ hideLabelFromVision,
118
+ help,
119
+ allowReset = true,
120
+ className,
121
+ messages = {
122
+ selected: __( 'Item selected.' ),
123
+ },
124
+ __experimentalRenderItem,
125
+ } = useDeprecated36pxDefaultSizeProp< ComboboxControlProps >(
126
+ props,
127
+ 'wp.components.ComboboxControl'
128
+ );
129
+
124
130
  const [ value, setValue ] = useControlledValue( {
125
131
  value: valueProp,
126
132
  onChange: onChangeProp,
@@ -314,7 +320,7 @@ function ComboboxControl( {
314
320
  onKeyDown={ onKeyDown }
315
321
  >
316
322
  <InputWrapperFlex
317
- __next36pxDefaultSize={ __next36pxDefaultSize }
323
+ __next40pxDefaultSize={ __next40pxDefaultSize }
318
324
  >
319
325
  <FlexBlock>
320
326
  <TokenInput
@@ -65,7 +65,6 @@ const Template: ComponentStory< typeof ComboboxControl > = ( {
65
65
  };
66
66
  export const Default = Template.bind( {} );
67
67
  Default.args = {
68
- __next36pxDefaultSize: false,
69
68
  allowReset: false,
70
69
  label: 'Select a country',
71
70
  options: countryOptions,
@@ -12,9 +12,9 @@ import { space } from '../ui/utils/space';
12
12
  import type { ComboboxControlProps } from './types';
13
13
 
14
14
  const deprecatedDefaultSize = ( {
15
- __next36pxDefaultSize,
16
- }: Pick< ComboboxControlProps, '__next36pxDefaultSize' > ) =>
17
- ! __next36pxDefaultSize &&
15
+ __next40pxDefaultSize,
16
+ }: Pick< ComboboxControlProps, '__next40pxDefaultSize' > ) =>
17
+ ! __next40pxDefaultSize &&
18
18
  css`
19
19
  height: 28px; // 30px - 2px vertical borders on parent container
20
20
  padding-left: ${ space( 1 ) };
@@ -22,7 +22,7 @@ const deprecatedDefaultSize = ( {
22
22
  `;
23
23
 
24
24
  export const InputWrapperFlex = styled( Flex )`
25
- height: 34px; // 36px - 2px vertical borders on parent container
25
+ height: 38px; // 40px - 2px vertical borders on parent container
26
26
  padding-left: ${ space( 2 ) };
27
27
  padding-right: ${ space( 2 ) };
28
28
 
@@ -26,11 +26,18 @@ export type ComboboxControlProps = Pick<
26
26
  item: ComboboxControlOption;
27
27
  } ) => React.ReactNode;
28
28
  /**
29
- * Start opting into the larger default height that will become the default size in a future version.
29
+ * Deprecated. Use `__next40pxDefaultSize` instead.
30
30
  *
31
31
  * @default false
32
+ * @deprecated
32
33
  */
33
34
  __next36pxDefaultSize?: boolean;
35
+ /**
36
+ * Start opting into the larger default height that will become the default size in a future version.
37
+ *
38
+ * @default false
39
+ */
40
+ __next40pxDefaultSize?: boolean;
34
41
  /**
35
42
  * Show a reset button to clear the input.
36
43
  *
@@ -25,7 +25,7 @@ function CustomGradientPicker( { setColor, currentValue, isGradientColor } ) {
25
25
  const [ currentColor, setCurrentColor ] = useState( currentValue );
26
26
 
27
27
  const { getGradientType, gradients, gradientOptions } = colorsUtils;
28
- const gradientAST = getGradientAstWithDefault( currentColor );
28
+ const { gradientAST } = getGradientAstWithDefault( currentColor );
29
29
  const gradientType = getGradientType( currentColor );
30
30
 
31
31
  function isLinearGradient( type ) {
@@ -76,14 +76,14 @@ $components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 1
76
76
  padding: 0;
77
77
 
78
78
  // Shadow and stroke.
79
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $white, 0 0 $border-width-focus 0 rgba($black, 0.25);
79
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $white, 0 0 $border-width-focus-fallback 0 rgba($black, 0.25);
80
80
 
81
81
  // Windows High Contrast mode will show this outline, but not the box-shadow.
82
82
  outline: 2px solid transparent;
83
83
 
84
84
  &:focus,
85
85
  &.is-active {
86
- box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus) * 2) $white, 0 0 $border-width-focus 0 rgba($black, 0.25);
86
+ box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus) * 2) $white, 0 0 $border-width-focus-fallback 0 rgba($black, 0.25);
87
87
 
88
88
  // Windows High Contrast mode will show this outline, but not the box-shadow.
89
89
  outline: $border-width-tab solid transparent;
@@ -9,8 +9,8 @@ This feature is still experimental. “Experimental” means this is an early im
9
9
  ## Usage
10
10
 
11
11
  ```jsx
12
- import { useState } from 'react';
13
12
  import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components';
13
+ import { useState } from '@wordpress/element';
14
14
 
15
15
  export default function MyCustomDimensionControl() {
16
16
  const [ paddingSize, setPaddingSize ] = useState( '' );
@@ -23,8 +23,8 @@ import type { SelectControlSingleSelectionProps } from '../select-control/types'
23
23
  * This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
24
24
  *
25
25
  * ```jsx
26
- * import { useState } from 'react';
27
26
  * import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components';
27
+ * import { useState } from '@wordpress/element';
28
28
  *
29
29
  * export default function MyCustomDimensionControl() {
30
30
  * const [ paddingSize, setPaddingSize ] = useState( '' );
@@ -8,9 +8,16 @@ Note that the drag handle needs to declare the `draggable="true"` property and b
8
8
 
9
9
  The component accepts the following props:
10
10
 
11
+ ### `appendToOwnerDocument`: `boolean`
12
+
13
+ Whether to append the cloned element to the `ownerDocument` body. By default, elements sourced by id are appended to the element's wrapper.
14
+
15
+ - Required: No
16
+ - Default: `false`
17
+
11
18
  ### `elementId`: `string`
12
19
 
13
- The HTML id of the element to clone on drag
20
+ The HTML id of the element to clone on drag.
14
21
 
15
22
  - Required: Yes
16
23
 
@@ -63,6 +63,7 @@ export function Draggable( {
63
63
  onDragStart,
64
64
  onDragOver,
65
65
  onDragEnd,
66
+ appendToOwnerDocument = false,
66
67
  cloneClassname,
67
68
  elementId,
68
69
  transferData,
@@ -173,7 +174,11 @@ export function Draggable( {
173
174
  cloneWrapper.appendChild( clone );
174
175
 
175
176
  // Inject the cloneWrapper into the DOM.
176
- elementWrapper?.appendChild( cloneWrapper );
177
+ if ( appendToOwnerDocument ) {
178
+ ownerDocument.body.appendChild( cloneWrapper );
179
+ } else {
180
+ elementWrapper?.appendChild( cloneWrapper );
181
+ }
177
182
  }
178
183
 
179
184
  // Mark the current cursor coordinates.
@@ -207,14 +212,8 @@ export function Draggable( {
207
212
  // Update cursor to 'grabbing', document wide.
208
213
  ownerDocument.body.classList.add( bodyClass );
209
214
 
210
- // Allow the Synthetic Event to be accessed from asynchronous code.
211
- // https://reactjs.org/docs/events.html#event-pooling
212
- event.persist();
213
-
214
- let timerId: number | undefined;
215
-
216
215
  if ( onDragStart ) {
217
- timerId = setTimeout( () => onDragStart( event ) );
216
+ onDragStart( event );
218
217
  }
219
218
 
220
219
  cleanup.current = () => {
@@ -231,8 +230,6 @@ export function Draggable( {
231
230
  ownerDocument.body.classList.remove( bodyClass );
232
231
 
233
232
  ownerDocument.removeEventListener( 'dragover', throttledDragOver );
234
-
235
- clearTimeout( timerId );
236
233
  };
237
234
  }
238
235