@wordpress/components 22.0.0 → 22.1.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 (356) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/build/angle-picker-control/index.js +3 -1
  3. package/build/angle-picker-control/index.js.map +1 -1
  4. package/build/autocomplete/index.js +7 -3
  5. package/build/autocomplete/index.js.map +1 -1
  6. package/build/border-box-control/border-box-control/component.js +1 -1
  7. package/build/border-box-control/border-box-control/component.js.map +1 -1
  8. package/build/border-box-control/border-box-control/hook.js +13 -1
  9. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  10. package/build/border-box-control/border-box-control-split-controls/hook.js +11 -1
  11. package/build/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
  12. package/build/border-control/border-control/component.js +2 -2
  13. package/build/border-control/border-control/component.js.map +1 -1
  14. package/build/border-control/border-control/hook.js +11 -1
  15. package/build/border-control/border-control/hook.js.map +1 -1
  16. package/build/border-control/border-control-dropdown/component.js +1 -1
  17. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  18. package/build/border-control/border-control-dropdown/hook.js +10 -2
  19. package/build/border-control/border-control-dropdown/hook.js.map +1 -1
  20. package/build/color-palette/index.js +1 -1
  21. package/build/color-palette/index.js.map +1 -1
  22. package/build/color-picker/input-with-slider.js +17 -3
  23. package/build/color-picker/input-with-slider.js.map +1 -1
  24. package/build/custom-select-control/index.js +5 -2
  25. package/build/custom-select-control/index.js.map +1 -1
  26. package/build/dashicon/index.js +17 -2
  27. package/build/dashicon/index.js.map +1 -1
  28. package/build/draggable/index.js +58 -38
  29. package/build/draggable/index.js.map +1 -1
  30. package/build/draggable/types.js +6 -0
  31. package/build/draggable/types.js.map +1 -0
  32. package/build/flex/flex/hook.js +2 -3
  33. package/build/flex/flex/hook.js.map +1 -1
  34. package/build/focal-point-picker/focal-point.js +2 -12
  35. package/build/focal-point-picker/focal-point.js.map +1 -1
  36. package/build/focal-point-picker/styles/focal-point-style.js +11 -51
  37. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  38. package/build/font-size-picker/constants.js +41 -0
  39. package/build/font-size-picker/constants.js.map +1 -0
  40. package/build/font-size-picker/font-size-picker-select.js +97 -0
  41. package/build/font-size-picker/font-size-picker-select.js.map +1 -0
  42. package/build/font-size-picker/font-size-picker-toggle-group.js +50 -0
  43. package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -0
  44. package/build/font-size-picker/index.js +39 -76
  45. package/build/font-size-picker/index.js.map +1 -1
  46. package/build/font-size-picker/utils.js +17 -89
  47. package/build/font-size-picker/utils.js.map +1 -1
  48. package/build/form-token-field/index.js +9 -6
  49. package/build/form-token-field/index.js.map +1 -1
  50. package/build/higher-order/navigate-regions/index.js +3 -0
  51. package/build/higher-order/navigate-regions/index.js.map +1 -1
  52. package/build/icon/index.js +3 -2
  53. package/build/icon/index.js.map +1 -1
  54. package/build/index.js +8 -0
  55. package/build/index.js.map +1 -1
  56. package/build/menu-group/index.js +17 -3
  57. package/build/menu-group/index.js.map +1 -1
  58. package/build/menu-group/types.js +6 -0
  59. package/build/menu-group/types.js.map +1 -0
  60. package/build/navigator/navigator-screen/component.js +9 -5
  61. package/build/navigator/navigator-screen/component.js.map +1 -1
  62. package/build/palette-edit/index.js +3 -1
  63. package/build/palette-edit/index.js.map +1 -1
  64. package/build/popover/index.js +8 -4
  65. package/build/popover/index.js.map +1 -1
  66. package/build/range-control/styles/range-control-styles.js +47 -57
  67. package/build/range-control/styles/range-control-styles.js.map +1 -1
  68. package/build/spinner/styles.js +4 -4
  69. package/build/spinner/styles.js.map +1 -1
  70. package/build/tab-panel/index.js +3 -4
  71. package/build/tab-panel/index.js.map +1 -1
  72. package/build/toggle-group-control/toggle-group-control/component.js +1 -0
  73. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  74. package/build/toggle-group-control/toggle-group-control/styles.js +11 -6
  75. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  76. package/build/tools-panel/styles.js +14 -14
  77. package/build/tools-panel/styles.js.map +1 -1
  78. package/build/tools-panel/tools-panel-item/hook.js +9 -5
  79. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  80. package/build/utils/colors-values.js +3 -2
  81. package/build/utils/colors-values.js.map +1 -1
  82. package/build/utils/input/base.js +2 -2
  83. package/build/utils/input/base.js.map +1 -1
  84. package/build/view/index.js.map +1 -1
  85. package/build-module/angle-picker-control/index.js +2 -1
  86. package/build-module/angle-picker-control/index.js.map +1 -1
  87. package/build-module/autocomplete/index.js +7 -3
  88. package/build-module/autocomplete/index.js.map +1 -1
  89. package/build-module/border-box-control/border-box-control/component.js +1 -1
  90. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  91. package/build-module/border-box-control/border-box-control/hook.js +13 -1
  92. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  93. package/build-module/border-box-control/border-box-control-split-controls/hook.js +11 -1
  94. package/build-module/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
  95. package/build-module/border-control/border-control/component.js +2 -2
  96. package/build-module/border-control/border-control/component.js.map +1 -1
  97. package/build-module/border-control/border-control/hook.js +11 -1
  98. package/build-module/border-control/border-control/hook.js.map +1 -1
  99. package/build-module/border-control/border-control-dropdown/component.js +1 -1
  100. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  101. package/build-module/border-control/border-control-dropdown/hook.js +10 -2
  102. package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
  103. package/build-module/color-palette/index.js +1 -1
  104. package/build-module/color-palette/index.js.map +1 -1
  105. package/build-module/color-picker/input-with-slider.js +17 -3
  106. package/build-module/color-picker/input-with-slider.js.map +1 -1
  107. package/build-module/custom-select-control/index.js +5 -2
  108. package/build-module/custom-select-control/index.js.map +1 -1
  109. package/build-module/dashicon/index.js +17 -2
  110. package/build-module/dashicon/index.js.map +1 -1
  111. package/build-module/draggable/index.js +59 -38
  112. package/build-module/draggable/index.js.map +1 -1
  113. package/build-module/draggable/types.js +2 -0
  114. package/build-module/draggable/types.js.map +1 -0
  115. package/build-module/flex/flex/hook.js +2 -3
  116. package/build-module/flex/flex/hook.js.map +1 -1
  117. package/build-module/focal-point-picker/focal-point.js +3 -13
  118. package/build-module/focal-point-picker/focal-point.js.map +1 -1
  119. package/build-module/focal-point-picker/styles/focal-point-style.js +6 -52
  120. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  121. package/build-module/font-size-picker/constants.js +31 -0
  122. package/build-module/font-size-picker/constants.js.map +1 -0
  123. package/build-module/font-size-picker/font-size-picker-select.js +83 -0
  124. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -0
  125. package/build-module/font-size-picker/font-size-picker-toggle-group.js +40 -0
  126. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -0
  127. package/build-module/font-size-picker/index.js +38 -76
  128. package/build-module/font-size-picker/index.js.map +1 -1
  129. package/build-module/font-size-picker/utils.js +15 -86
  130. package/build-module/font-size-picker/utils.js.map +1 -1
  131. package/build-module/form-token-field/index.js +9 -6
  132. package/build-module/form-token-field/index.js.map +1 -1
  133. package/build-module/higher-order/navigate-regions/index.js +3 -0
  134. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  135. package/build-module/icon/index.js +3 -2
  136. package/build-module/icon/index.js.map +1 -1
  137. package/build-module/index.js +1 -0
  138. package/build-module/index.js.map +1 -1
  139. package/build-module/menu-group/index.js +20 -2
  140. package/build-module/menu-group/index.js.map +1 -1
  141. package/build-module/menu-group/types.js +2 -0
  142. package/build-module/menu-group/types.js.map +1 -0
  143. package/build-module/navigator/navigator-screen/component.js +9 -5
  144. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  145. package/build-module/palette-edit/index.js +3 -1
  146. package/build-module/palette-edit/index.js.map +1 -1
  147. package/build-module/popover/index.js +8 -4
  148. package/build-module/popover/index.js.map +1 -1
  149. package/build-module/range-control/styles/range-control-styles.js +47 -57
  150. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  151. package/build-module/spinner/styles.js +4 -4
  152. package/build-module/spinner/styles.js.map +1 -1
  153. package/build-module/tab-panel/index.js +4 -5
  154. package/build-module/tab-panel/index.js.map +1 -1
  155. package/build-module/toggle-group-control/toggle-group-control/component.js +1 -0
  156. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  157. package/build-module/toggle-group-control/toggle-group-control/styles.js +12 -6
  158. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  159. package/build-module/tools-panel/styles.js +14 -14
  160. package/build-module/tools-panel/styles.js.map +1 -1
  161. package/build-module/tools-panel/tools-panel-item/hook.js +9 -5
  162. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  163. package/build-module/utils/colors-values.js +3 -2
  164. package/build-module/utils/colors-values.js.map +1 -1
  165. package/build-module/utils/input/base.js +2 -2
  166. package/build-module/utils/input/base.js.map +1 -1
  167. package/build-module/view/index.js.map +1 -1
  168. package/build-style/style-rtl.css +72 -44
  169. package/build-style/style.css +72 -44
  170. package/build-types/border-box-control/border-box-control/component.d.ts +4 -4
  171. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  172. package/build-types/border-box-control/border-box-control/hook.d.ts +6 -6
  173. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  174. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +4 -2
  175. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  176. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +3 -3
  177. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +5 -5
  178. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  179. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts +3 -2
  180. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  181. package/build-types/border-box-control/stories/index.d.ts +3 -3
  182. package/build-types/border-box-control/types.d.ts +5 -38
  183. package/build-types/border-box-control/types.d.ts.map +1 -1
  184. package/build-types/border-control/border-control/component.d.ts +4 -2
  185. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  186. package/build-types/border-control/border-control/hook.d.ts +5 -5
  187. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  188. package/build-types/border-control/border-control-dropdown/component.d.ts +3 -3
  189. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  190. package/build-types/border-control/border-control-dropdown/hook.d.ts +5 -5
  191. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  192. package/build-types/border-control/stories/index.d.ts +24 -12
  193. package/build-types/border-control/stories/index.d.ts.map +1 -1
  194. package/build-types/border-control/types.d.ts +10 -51
  195. package/build-types/border-control/types.d.ts.map +1 -1
  196. package/build-types/color-palette/index.d.ts +16 -2
  197. package/build-types/color-palette/index.d.ts.map +1 -1
  198. package/build-types/color-palette/stories/index.d.ts +31 -2
  199. package/build-types/color-palette/stories/index.d.ts.map +1 -1
  200. package/build-types/color-palette/types.d.ts +14 -10
  201. package/build-types/color-palette/types.d.ts.map +1 -1
  202. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  203. package/build-types/custom-select-control/index.d.ts.map +1 -1
  204. package/build-types/dashicon/index.d.ts +6 -1
  205. package/build-types/dashicon/index.d.ts.map +1 -1
  206. package/build-types/date-time/types.d.ts +0 -16
  207. package/build-types/date-time/types.d.ts.map +1 -1
  208. package/build-types/draggable/index.d.ts +42 -66
  209. package/build-types/draggable/index.d.ts.map +1 -1
  210. package/build-types/draggable/stories/index.d.ts +12 -0
  211. package/build-types/draggable/stories/index.d.ts.map +1 -0
  212. package/build-types/draggable/types.d.ts +58 -0
  213. package/build-types/draggable/types.d.ts.map +1 -0
  214. package/build-types/flex/flex/hook.d.ts.map +1 -1
  215. package/build-types/focal-point-picker/focal-point.d.ts.map +1 -1
  216. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  217. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +1 -12
  218. package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -1
  219. package/build-types/font-size-picker/constants.d.ts +15 -0
  220. package/build-types/font-size-picker/constants.d.ts.map +1 -0
  221. package/build-types/font-size-picker/font-size-picker-select.d.ts +5 -0
  222. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -0
  223. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts +5 -0
  224. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -0
  225. package/build-types/font-size-picker/index.d.ts.map +1 -1
  226. package/build-types/font-size-picker/types.d.ts +13 -13
  227. package/build-types/font-size-picker/types.d.ts.map +1 -1
  228. package/build-types/font-size-picker/utils.d.ts +6 -18
  229. package/build-types/font-size-picker/utils.d.ts.map +1 -1
  230. package/build-types/form-token-field/index.d.ts.map +1 -1
  231. package/build-types/icon/index.d.ts +1 -1
  232. package/build-types/icon/index.d.ts.map +1 -1
  233. package/build-types/menu-group/index.d.ts +21 -1
  234. package/build-types/menu-group/index.d.ts.map +1 -1
  235. package/build-types/menu-group/test/index.d.ts +2 -0
  236. package/build-types/menu-group/test/index.d.ts.map +1 -0
  237. package/build-types/menu-group/types.d.ts +23 -0
  238. package/build-types/menu-group/types.d.ts.map +1 -0
  239. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  240. package/build-types/popover/index.d.ts.map +1 -1
  241. package/build-types/tab-panel/index.d.ts.map +1 -1
  242. package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
  243. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +1 -2
  244. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  245. package/build-types/toggle-group-control/types.d.ts +2 -1
  246. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  247. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  248. package/build-types/unit-control/index.d.ts +1 -1
  249. package/build-types/utils/colors-values.d.ts +1 -0
  250. package/build-types/utils/colors-values.d.ts.map +1 -1
  251. package/build-types/view/index.d.ts +1 -1
  252. package/build-types/view/index.d.ts.map +1 -1
  253. package/package.json +17 -17
  254. package/src/angle-picker-control/index.js +2 -1
  255. package/src/autocomplete/index.js +12 -3
  256. package/src/autocomplete/style.scss +1 -1
  257. package/src/base-field/test/__snapshots__/index.js.snap +9 -7
  258. package/src/base-field/test/index.js +27 -15
  259. package/src/border-box-control/border-box-control/README.md +5 -17
  260. package/src/border-box-control/border-box-control/component.tsx +1 -1
  261. package/src/border-box-control/border-box-control/hook.ts +18 -4
  262. package/src/border-box-control/border-box-control-split-controls/hook.ts +10 -0
  263. package/src/border-box-control/types.ts +32 -58
  264. package/src/border-control/border-control/README.md +4 -17
  265. package/src/border-control/border-control/component.tsx +2 -2
  266. package/src/border-control/border-control/hook.ts +10 -0
  267. package/src/border-control/border-control-dropdown/component.tsx +7 -6
  268. package/src/border-control/border-control-dropdown/hook.ts +9 -1
  269. package/src/border-control/types.ts +43 -80
  270. package/src/card/test/__snapshots__/index.tsx.snap +64 -368
  271. package/src/card/test/index.tsx +2 -2
  272. package/src/checkbox-control/style.scss +3 -3
  273. package/src/color-palette/README.md +12 -16
  274. package/src/color-palette/index.tsx +1 -1
  275. package/src/color-palette/style.scss +1 -1
  276. package/src/color-palette/types.ts +14 -10
  277. package/src/color-picker/input-with-slider.tsx +13 -2
  278. package/src/custom-select-control/index.js +7 -0
  279. package/src/custom-select-control/stories/index.js +1 -0
  280. package/src/custom-select-control/style.scss +6 -1
  281. package/src/custom-select-control/test/index.js +39 -0
  282. package/src/dashicon/index.js +21 -2
  283. package/src/date-time/date/test/index.tsx +2 -2
  284. package/src/date-time/types.ts +0 -19
  285. package/src/divider/test/index.tsx +4 -4
  286. package/src/draggable/README.md +13 -18
  287. package/src/draggable/{index.js → index.tsx} +71 -47
  288. package/src/draggable/stories/index.tsx +83 -0
  289. package/src/draggable/types.ts +58 -0
  290. package/src/drop-zone/style.scss +1 -1
  291. package/src/flex/flex/hook.ts +0 -3
  292. package/src/flex/test/index.tsx +29 -3
  293. package/src/focal-point-picker/focal-point.tsx +2 -24
  294. package/src/focal-point-picker/styles/focal-point-style.ts +8 -32
  295. package/src/font-size-picker/constants.ts +37 -0
  296. package/src/font-size-picker/font-size-picker-select.tsx +98 -0
  297. package/src/font-size-picker/font-size-picker-toggle-group.tsx +41 -0
  298. package/src/font-size-picker/index.tsx +55 -118
  299. package/src/font-size-picker/test/index.tsx +253 -44
  300. package/src/font-size-picker/test/utils.ts +58 -98
  301. package/src/font-size-picker/types.ts +25 -16
  302. package/src/font-size-picker/utils.ts +16 -102
  303. package/src/form-toggle/style.scss +3 -3
  304. package/src/form-token-field/index.tsx +13 -5
  305. package/src/form-token-field/style.scss +2 -2
  306. package/src/form-token-field/test/index.tsx +6 -6
  307. package/src/higher-order/navigate-regions/index.js +4 -0
  308. package/src/higher-order/navigate-regions/style.scss +72 -20
  309. package/src/higher-order/with-notices/test/index.js +1 -1
  310. package/src/icon/index.tsx +3 -2
  311. package/src/icon/test/index.js +10 -0
  312. package/src/index.js +1 -0
  313. package/src/item-group/stories/index.js +1 -1
  314. package/src/menu-group/{index.js → index.tsx} +22 -3
  315. package/src/menu-group/test/{index.js → index.tsx} +0 -0
  316. package/src/menu-group/types.ts +23 -0
  317. package/src/menu-item/style.scss +1 -1
  318. package/src/mobile/bottom-sheet/test/range-cell.native.js +4 -4
  319. package/src/mobile/html-text-input/test/index.native.js +2 -2
  320. package/src/mobile/link-settings/test/edit.native.js +29 -29
  321. package/src/mobile/link-settings/test/link-settings-navigation.native.js +5 -5
  322. package/src/navigator/navigator-screen/component.tsx +8 -3
  323. package/src/notice/README.md +2 -1
  324. package/src/notice/style.scss +1 -1
  325. package/src/palette-edit/index.js +3 -0
  326. package/src/panel/style.scss +1 -1
  327. package/src/popover/index.tsx +18 -7
  328. package/src/range-control/styles/range-control-styles.ts +2 -2
  329. package/src/resizable-box/style.scss +2 -2
  330. package/src/scrollable/test/index.tsx +7 -3
  331. package/src/search-control/style.scss +1 -1
  332. package/src/snackbar/style.scss +2 -2
  333. package/src/spacer/test/index.tsx +33 -3
  334. package/src/spinner/styles.ts +1 -1
  335. package/src/surface/test/index.tsx +12 -12
  336. package/src/tab-panel/index.tsx +9 -6
  337. package/src/tab-panel/style.scss +4 -5
  338. package/src/text/test/index.tsx +4 -4
  339. package/src/toggle-group-control/stories/index.tsx +2 -0
  340. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +6 -8
  341. package/src/toggle-group-control/test/index.tsx +29 -17
  342. package/src/toggle-group-control/toggle-group-control/README.md +8 -1
  343. package/src/toggle-group-control/toggle-group-control/component.tsx +1 -1
  344. package/src/toggle-group-control/toggle-group-control/styles.ts +22 -16
  345. package/src/toggle-group-control/types.ts +2 -1
  346. package/src/tools-panel/styles.ts +1 -1
  347. package/src/tools-panel/tools-panel-item/hook.ts +6 -1
  348. package/src/tree-grid/test/index.js +12 -12
  349. package/src/truncate/test/index.tsx +9 -9
  350. package/src/ui/form-group/test/index.js +16 -17
  351. package/src/utils/colors-values.js +4 -2
  352. package/src/utils/hooks/stories/use-cx.js +1 -1
  353. package/src/utils/input/base.js +2 -2
  354. package/src/view/{index.js → index.ts} +0 -0
  355. package/tsconfig.tsbuildinfo +1 -1
  356. package/src/draggable/stories/index.js +0 -72
@@ -1,39 +1,63 @@
1
1
  import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
+ /**
4
+ * External dependencies
5
+ */
6
+
3
7
  /**
4
8
  * WordPress dependencies
5
9
  */
6
10
  import { throttle } from '@wordpress/compose';
7
11
  import { useEffect, useRef } from '@wordpress/element';
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+
8
16
  const dragImageClass = 'components-draggable__invisible-drag-image';
9
17
  const cloneWrapperClass = 'components-draggable__clone';
10
18
  const clonePadding = 0;
11
19
  const bodyClass = 'is-dragging-components-draggable';
12
20
  /**
13
- * @typedef RenderProp
14
- * @property {(event: import('react').DragEvent) => void} onDraggableStart `onDragStart` handler.
15
- * @property {(event: import('react').DragEvent) => void} onDraggableEnd `onDragEnd` handler.
21
+ * `Draggable` is a Component that provides a way to set up a cross-browser
22
+ * (including IE) customizable drag image and the transfer data for the drag
23
+ * event. It decouples the drag handle and the element to drag: use it by
24
+ * wrapping the component that will become the drag handle and providing the DOM
25
+ * ID of the element to drag.
26
+ *
27
+ * Note that the drag handle needs to declare the `draggable="true"` property
28
+ * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event
29
+ * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`
30
+ * takes care of the logic to setup the drag image and the transfer data, but is
31
+ * not concerned with creating an actual DOM element that is draggable.
32
+ *
33
+ * ```jsx
34
+ * import { Draggable, Panel, PanelBody } from '@wordpress/components';
35
+ * import { Icon, more } from '@wordpress/icons';
36
+ *
37
+ * const MyDraggable = () => (
38
+ * <div id="draggable-panel">
39
+ * <Panel header="Draggable panel">
40
+ * <PanelBody>
41
+ * <Draggable elementId="draggable-panel" transferData={ {} }>
42
+ * { ( { onDraggableStart, onDraggableEnd } ) => (
43
+ * <div
44
+ * className="example-drag-handle"
45
+ * draggable
46
+ * onDragStart={ onDraggableStart }
47
+ * onDragEnd={ onDraggableEnd }
48
+ * >
49
+ * <Icon icon={ more } />
50
+ * </div>
51
+ * ) }
52
+ * </Draggable>
53
+ * </PanelBody>
54
+ * </Panel>
55
+ * </div>
56
+ * );
57
+ * ```
16
58
  */
17
59
 
18
- /**
19
- * @typedef Props
20
- * @property {(props: RenderProp) => JSX.Element | null} children Children.
21
- * @property {(event: import('react').DragEvent) => void} [onDragStart] Callback when dragging starts.
22
- * @property {(event: import('react').DragEvent) => void} [onDragOver] Callback when dragging happens over the document.
23
- * @property {(event: import('react').DragEvent) => void} [onDragEnd] Callback when dragging ends.
24
- * @property {string} [cloneClassname] Classname for the cloned element.
25
- * @property {string} [elementId] ID for the element.
26
- * @property {any} [transferData] Transfer data for the drag event.
27
- * @property {string} [__experimentalTransferDataType] The transfer data type to set.
28
- * @property {import('react').ReactNode} __experimentalDragComponent Component to show when dragging.
29
- */
30
-
31
- /**
32
- * @param {Props} props
33
- * @return {JSX.Element} A draggable component.
34
- */
35
-
36
- export default function Draggable(_ref) {
60
+ export function Draggable(_ref) {
37
61
  let {
38
62
  children,
39
63
  onDragStart,
@@ -45,14 +69,12 @@ export default function Draggable(_ref) {
45
69
  __experimentalTransferDataType: transferDataType = 'text',
46
70
  __experimentalDragComponent: dragComponent
47
71
  } = _ref;
48
-
49
- /** @type {import('react').MutableRefObject<HTMLDivElement | null>} */
50
72
  const dragComponentRef = useRef(null);
51
73
  const cleanup = useRef(() => {});
52
74
  /**
53
75
  * Removes the element clone, resets cursor, and removes drag listener.
54
76
  *
55
- * @param {import('react').DragEvent} event The non-custom DragEvent.
77
+ * @param event The non-custom DragEvent.
56
78
  */
57
79
 
58
80
  function end(event) {
@@ -71,20 +93,19 @@ export default function Draggable(_ref) {
71
93
  * - Sets transfer data.
72
94
  * - Adds dragover listener.
73
95
  *
74
- * @param {import('react').DragEvent} event The non-custom DragEvent.
96
+ * @param event The non-custom DragEvent.
75
97
  */
76
98
 
77
99
 
78
100
  function start(event) {
79
- // @ts-ignore We know that ownerDocument does exist on an Element
80
101
  const {
81
102
  ownerDocument
82
103
  } = event.target;
83
104
  event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));
84
105
  const cloneWrapper = ownerDocument.createElement('div'); // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.
85
106
 
86
- cloneWrapper.style.top = 0;
87
- cloneWrapper.style.left = 0;
107
+ cloneWrapper.style.top = '0';
108
+ cloneWrapper.style.left = '0';
88
109
  const dragImage = ownerDocument.createElement('div'); // Set a fake drag image to avoid browser defaults. Remove from DOM
89
110
  // right after. event.dataTransfer.setDragImage is not supported yet in
90
111
  // IE, we need to check for its existence first.
@@ -120,8 +141,8 @@ export default function Draggable(_ref) {
120
141
 
121
142
  const elementRect = element.getBoundingClientRect();
122
143
  const elementWrapper = element.parentNode;
123
- const elementTopOffset = parseInt(elementRect.top, 10);
124
- const elementLeftOffset = parseInt(elementRect.left, 10);
144
+ const elementTopOffset = elementRect.top;
145
+ const elementLeftOffset = elementRect.left;
125
146
  cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;
126
147
  const clone = element.cloneNode(true);
127
148
  clone.id = `clone-${elementId}`; // Position clone right over the original element (20px padding).
@@ -130,18 +151,19 @@ export default function Draggable(_ref) {
130
151
  y = elementTopOffset - clonePadding;
131
152
  cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`; // Hack: Remove iFrames as it's causing the embeds drag clone to freeze.
132
153
 
133
- Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode.removeChild(child));
154
+ Array.from(clone.querySelectorAll('iframe')).forEach(child => {
155
+ var _child$parentNode;
156
+
157
+ return (_child$parentNode = child.parentNode) === null || _child$parentNode === void 0 ? void 0 : _child$parentNode.removeChild(child);
158
+ });
134
159
  cloneWrapper.appendChild(clone); // Inject the cloneWrapper into the DOM.
135
160
 
136
- elementWrapper.appendChild(cloneWrapper);
161
+ elementWrapper === null || elementWrapper === void 0 ? void 0 : elementWrapper.appendChild(cloneWrapper);
137
162
  } // Mark the current cursor coordinates.
138
163
 
139
164
 
140
165
  let cursorLeft = event.clientX;
141
166
  let cursorTop = event.clientY;
142
- /**
143
- * @param {import('react').DragEvent<Element>} e
144
- */
145
167
 
146
168
  function over(e) {
147
169
  // Skip doing any work if mouse has not moved.
@@ -172,8 +194,6 @@ export default function Draggable(_ref) {
172
194
  // https://reactjs.org/docs/events.html#event-pooling
173
195
 
174
196
  event.persist();
175
- /** @type {number | undefined} */
176
-
177
197
  let timerId;
178
198
 
179
199
  if (onDragStart) {
@@ -211,4 +231,5 @@ export default function Draggable(_ref) {
211
231
  ref: dragComponentRef
212
232
  }, dragComponent));
213
233
  }
234
+ export default Draggable;
214
235
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/draggable/index.js"],"names":["throttle","useEffect","useRef","dragImageClass","cloneWrapperClass","clonePadding","bodyClass","Draggable","children","onDragStart","onDragOver","onDragEnd","cloneClassname","elementId","transferData","__experimentalTransferDataType","transferDataType","__experimentalDragComponent","dragComponent","dragComponentRef","cleanup","end","event","preventDefault","current","start","ownerDocument","target","dataTransfer","setData","JSON","stringify","cloneWrapper","createElement","style","top","left","dragImage","setDragImage","classList","add","body","appendChild","x","y","clientX","clientY","transform","clonedDragComponent","innerHTML","element","getElementById","elementRect","getBoundingClientRect","elementWrapper","parentNode","elementTopOffset","parseInt","elementLeftOffset","width","clone","cloneNode","id","Array","from","querySelectorAll","forEach","child","removeChild","cursorLeft","cursorTop","over","e","nextX","nextY","throttledDragOver","addEventListener","persist","timerId","setTimeout","remove","removeEventListener","clearTimeout","onDraggableStart","onDraggableEnd","display"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AAEA,MAAMC,cAAc,GAAG,4CAAvB;AACA,MAAMC,iBAAiB,GAAG,6BAA1B;AACA,MAAMC,YAAY,GAAG,CAArB;AACA,MAAMC,SAAS,GAAG,kCAAlB;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AACA,eAAe,SAASC,SAAT,OAUX;AAAA,MAV+B;AAClCC,IAAAA,QADkC;AAElCC,IAAAA,WAFkC;AAGlCC,IAAAA,UAHkC;AAIlCC,IAAAA,SAJkC;AAKlCC,IAAAA,cALkC;AAMlCC,IAAAA,SANkC;AAOlCC,IAAAA,YAPkC;AAQlCC,IAAAA,8BAA8B,EAAEC,gBAAgB,GAAG,MARjB;AASlCC,IAAAA,2BAA2B,EAAEC;AATK,GAU/B;;AACH;AACA,QAAMC,gBAAgB,GAAGjB,MAAM,CAAE,IAAF,CAA/B;AACA,QAAMkB,OAAO,GAAGlB,MAAM,CAAE,MAAM,CAAE,CAAV,CAAtB;AAEA;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AAa,IACd;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,KAAK,EAAG;AAAEmE,MAAAA,OAAO,EAAE;AAAX,KAFT;AAGC,IAAA,GAAG,EAAGlE;AAHP,KAKGD,aALH,CANF,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\n\nconst dragImageClass = 'components-draggable__invisible-drag-image';\nconst cloneWrapperClass = 'components-draggable__clone';\nconst clonePadding = 0;\nconst bodyClass = 'is-dragging-components-draggable';\n\n/**\n * @typedef RenderProp\n * @property {(event: import('react').DragEvent) => void} onDraggableStart `onDragStart` handler.\n * @property {(event: import('react').DragEvent) => void} onDraggableEnd `onDragEnd` handler.\n */\n\n/**\n * @typedef Props\n * @property {(props: RenderProp) => JSX.Element | null} children Children.\n * @property {(event: import('react').DragEvent) => void} [onDragStart] Callback when dragging starts.\n * @property {(event: import('react').DragEvent) => void} [onDragOver] Callback when dragging happens over the document.\n * @property {(event: import('react').DragEvent) => void} [onDragEnd] Callback when dragging ends.\n * @property {string} [cloneClassname] Classname for the cloned element.\n * @property {string} [elementId] ID for the element.\n * @property {any} [transferData] Transfer data for the drag event.\n * @property {string} [__experimentalTransferDataType] The transfer data type to set.\n * @property {import('react').ReactNode} __experimentalDragComponent Component to show when dragging.\n */\n\n/**\n * @param {Props} props\n * @return {JSX.Element} A draggable component.\n */\nexport default function Draggable( {\n\tchildren,\n\tonDragStart,\n\tonDragOver,\n\tonDragEnd,\n\tcloneClassname,\n\telementId,\n\ttransferData,\n\t__experimentalTransferDataType: transferDataType = 'text',\n\t__experimentalDragComponent: dragComponent,\n} ) {\n\t/** @type {import('react').MutableRefObject<HTMLDivElement | null>} */\n\tconst dragComponentRef = useRef( null );\n\tconst cleanup = useRef( () => {} );\n\n\t/**\n\t * Removes the element clone, resets cursor, and removes drag listener.\n\t *\n\t * @param {import('react').DragEvent} event The non-custom DragEvent.\n\t */\n\tfunction end( event ) {\n\t\tevent.preventDefault();\n\t\tcleanup.current();\n\n\t\tif ( onDragEnd ) {\n\t\t\tonDragEnd( event );\n\t\t}\n\t}\n\n\t/**\n\t * This method does a couple of things:\n\t *\n\t * - Clones the current element and spawns clone over original element.\n\t * - Adds a fake temporary drag image to avoid browser defaults.\n\t * - Sets transfer data.\n\t * - Adds dragover listener.\n\t *\n\t * @param {import('react').DragEvent} event The non-custom DragEvent.\n\t */\n\tfunction start( event ) {\n\t\t// @ts-ignore We know that ownerDocument does exist on an Element\n\t\tconst { ownerDocument } = event.target;\n\n\t\tevent.dataTransfer.setData(\n\t\t\ttransferDataType,\n\t\t\tJSON.stringify( transferData )\n\t\t);\n\n\t\tconst cloneWrapper = ownerDocument.createElement( 'div' );\n\t\t// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n\t\tcloneWrapper.style.top = 0;\n\t\tcloneWrapper.style.left = 0;\n\n\t\tconst dragImage = ownerDocument.createElement( 'div' );\n\n\t\t// Set a fake drag image to avoid browser defaults. Remove from DOM\n\t\t// right after. event.dataTransfer.setDragImage is not supported yet in\n\t\t// IE, we need to check for its existence first.\n\t\tif ( 'function' === typeof event.dataTransfer.setDragImage ) {\n\t\t\tdragImage.classList.add( dragImageClass );\n\t\t\townerDocument.body.appendChild( dragImage );\n\t\t\tevent.dataTransfer.setDragImage( dragImage, 0, 0 );\n\t\t}\n\n\t\tcloneWrapper.classList.add( cloneWrapperClass );\n\n\t\tif ( cloneClassname ) {\n\t\t\tcloneWrapper.classList.add( cloneClassname );\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\t// If a dragComponent is defined, the following logic will clone the\n\t\t// HTML node and inject it into the cloneWrapper.\n\t\tif ( dragComponentRef.current ) {\n\t\t\t// Position dragComponent at the same position as the cursor.\n\t\t\tx = event.clientX;\n\t\t\ty = event.clientY;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\tconst clonedDragComponent = ownerDocument.createElement( 'div' );\n\t\t\tclonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n\t\t\tcloneWrapper.appendChild( clonedDragComponent );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t} else {\n\t\t\tconst element = ownerDocument.getElementById( elementId );\n\n\t\t\t// Prepare element clone and append to element wrapper.\n\t\t\tconst elementRect = element.getBoundingClientRect();\n\t\t\tconst elementWrapper = element.parentNode;\n\t\t\tconst elementTopOffset = parseInt( elementRect.top, 10 );\n\t\t\tconst elementLeftOffset = parseInt( elementRect.left, 10 );\n\n\t\t\tcloneWrapper.style.width = `${\n\t\t\t\telementRect.width + clonePadding * 2\n\t\t\t}px`;\n\n\t\t\tconst clone = element.cloneNode( true );\n\t\t\tclone.id = `clone-${ elementId }`;\n\n\t\t\t// Position clone right over the original element (20px padding).\n\t\t\tx = elementLeftOffset - clonePadding;\n\t\t\ty = elementTopOffset - clonePadding;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\t// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n\t\t\tArray.from( clone.querySelectorAll( 'iframe' ) ).forEach(\n\t\t\t\t( child ) => child.parentNode.removeChild( child )\n\t\t\t);\n\n\t\t\tcloneWrapper.appendChild( clone );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\telementWrapper.appendChild( cloneWrapper );\n\t\t}\n\n\t\t// Mark the current cursor coordinates.\n\t\tlet cursorLeft = event.clientX;\n\t\tlet cursorTop = event.clientY;\n\n\t\t/**\n\t\t * @param {import('react').DragEvent<Element>} e\n\t\t */\n\t\tfunction over( e ) {\n\t\t\t// Skip doing any work if mouse has not moved.\n\t\t\tif ( cursorLeft === e.clientX && cursorTop === e.clientY ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextX = x + e.clientX - cursorLeft;\n\t\t\tconst nextY = y + e.clientY - cursorTop;\n\t\t\tcloneWrapper.style.transform = `translate( ${ nextX }px, ${ nextY }px )`;\n\t\t\tcursorLeft = e.clientX;\n\t\t\tcursorTop = e.clientY;\n\t\t\tx = nextX;\n\t\t\ty = nextY;\n\t\t\tif ( onDragOver ) {\n\t\t\t\tonDragOver( e );\n\t\t\t}\n\t\t}\n\n\t\t// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n\t\t// note that browsers may throttle raf below 60fps in certain conditions.\n\t\t// @ts-ignore\n\t\tconst throttledDragOver = throttle( over, 16 );\n\n\t\townerDocument.addEventListener( 'dragover', throttledDragOver );\n\n\t\t// Update cursor to 'grabbing', document wide.\n\t\townerDocument.body.classList.add( bodyClass );\n\n\t\t// Allow the Synthetic Event to be accessed from asynchronous code.\n\t\t// https://reactjs.org/docs/events.html#event-pooling\n\t\tevent.persist();\n\n\t\t/** @type {number | undefined} */\n\t\tlet timerId;\n\n\t\tif ( onDragStart ) {\n\t\t\ttimerId = setTimeout( () => onDragStart( event ) );\n\t\t}\n\n\t\tcleanup.current = () => {\n\t\t\t// Remove drag clone.\n\t\t\tif ( cloneWrapper && cloneWrapper.parentNode ) {\n\t\t\t\tcloneWrapper.parentNode.removeChild( cloneWrapper );\n\t\t\t}\n\n\t\t\tif ( dragImage && dragImage.parentNode ) {\n\t\t\t\tdragImage.parentNode.removeChild( dragImage );\n\t\t\t}\n\n\t\t\t// Reset cursor.\n\t\t\townerDocument.body.classList.remove( bodyClass );\n\n\t\t\townerDocument.removeEventListener( 'dragover', throttledDragOver );\n\n\t\t\tclearTimeout( timerId );\n\t\t};\n\t}\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tcleanup.current();\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ children( {\n\t\t\t\tonDraggableStart: start,\n\t\t\t\tonDraggableEnd: end,\n\t\t\t} ) }\n\t\t\t{ dragComponent && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-draggable-drag-component-root\"\n\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\tref={ dragComponentRef }\n\t\t\t\t>\n\t\t\t\t\t{ dragComponent }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/draggable/index.tsx"],"names":["throttle","useEffect","useRef","dragImageClass","cloneWrapperClass","clonePadding","bodyClass","Draggable","children","onDragStart","onDragOver","onDragEnd","cloneClassname","elementId","transferData","__experimentalTransferDataType","transferDataType","__experimentalDragComponent","dragComponent","dragComponentRef","cleanup","end","event","preventDefault","current","start","ownerDocument","target","dataTransfer","setData","JSON","stringify","cloneWrapper","createElement","style","top","left","dragImage","setDragImage","classList","add","body","appendChild","x","y","clientX","clientY","transform","clonedDragComponent","innerHTML","element","getElementById","elementRect","getBoundingClientRect","elementWrapper","parentNode","elementTopOffset","elementLeftOffset","width","clone","cloneNode","id","Array","from","querySelectorAll","forEach","child","removeChild","cursorLeft","cursorTop","over","e","nextX","nextY","throttledDragOver","addEventListener","persist","timerId","setTimeout","remove","removeEventListener","clearTimeout","onDraggableStart","onDraggableEnd","display"],"mappings":";;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AAGA,MAAMC,cAAc,GAAG,4CAAvB;AACA,MAAMC,iBAAiB,GAAG,6BAA1B;AACA,MAAMC,YAAY,GAAG,CAArB;AACA,MAAMC,SAAS,GAAG,kCAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,OAUa;AAAA,MAVO;AAC1BC,IAAAA,QAD0B;AAE1BC,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d,CAAmC,UAAnC,EAA+CN,iBAA/C;AAEAO,MAAAA,YAAY,CAAEJ,OAAF,CAAZ;AACA,KAhBD;AAiBA;;AAED5E,EAAAA,SAAS,CACR,MAAM,MAAM;AACXmB,IAAAA,OAAO,CAACI,OAAR;AACA,GAHO,EAIR,EAJQ,CAAT;AAOA,SACC,8BACGhB,QAAQ,CAAE;AACX0E,IAAAA,gBAAgB,EAAEzD,KADP;AAEX0D,IAAAA,cAAc,EAAE9D;AAFL,GAAF,CADX,EAKGH,aAAa,IACd;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,KAAK,EAAG;AAAEkE,MAAAA,OAAO,EAAE;AAAX,KAFT;AAGC,IAAA,GAAG,EAAGjE;AAHP,KAKGD,aALH,CANF,CADD;AAiBA;AAED,eAAeX,SAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { DragEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DraggableProps } from './types';\n\nconst dragImageClass = 'components-draggable__invisible-drag-image';\nconst cloneWrapperClass = 'components-draggable__clone';\nconst clonePadding = 0;\nconst bodyClass = 'is-dragging-components-draggable';\n\n/**\n * `Draggable` is a Component that provides a way to set up a cross-browser\n * (including IE) customizable drag image and the transfer data for the drag\n * event. It decouples the drag handle and the element to drag: use it by\n * wrapping the component that will become the drag handle and providing the DOM\n * ID of the element to drag.\n *\n * Note that the drag handle needs to declare the `draggable=\"true\"` property\n * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event\n * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`\n * takes care of the logic to setup the drag image and the transfer data, but is\n * not concerned with creating an actual DOM element that is draggable.\n *\n * ```jsx\n * import { Draggable, Panel, PanelBody } from '@wordpress/components';\n * import { Icon, more } from '@wordpress/icons';\n *\n * const MyDraggable = () => (\n * <div id=\"draggable-panel\">\n * <Panel header=\"Draggable panel\">\n * <PanelBody>\n * <Draggable elementId=\"draggable-panel\" transferData={ {} }>\n * { ( { onDraggableStart, onDraggableEnd } ) => (\n * <div\n * className=\"example-drag-handle\"\n * draggable\n * onDragStart={ onDraggableStart }\n * onDragEnd={ onDraggableEnd }\n * >\n * <Icon icon={ more } />\n * </div>\n * ) }\n * </Draggable>\n * </PanelBody>\n * </Panel>\n * </div>\n * );\n * ```\n */\nexport function Draggable( {\n\tchildren,\n\tonDragStart,\n\tonDragOver,\n\tonDragEnd,\n\tcloneClassname,\n\telementId,\n\ttransferData,\n\t__experimentalTransferDataType: transferDataType = 'text',\n\t__experimentalDragComponent: dragComponent,\n}: DraggableProps ) {\n\tconst dragComponentRef = useRef< HTMLDivElement >( null );\n\tconst cleanup = useRef( () => {} );\n\n\t/**\n\t * Removes the element clone, resets cursor, and removes drag listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction end( event: DragEvent ) {\n\t\tevent.preventDefault();\n\t\tcleanup.current();\n\n\t\tif ( onDragEnd ) {\n\t\t\tonDragEnd( event );\n\t\t}\n\t}\n\n\t/**\n\t * This method does a couple of things:\n\t *\n\t * - Clones the current element and spawns clone over original element.\n\t * - Adds a fake temporary drag image to avoid browser defaults.\n\t * - Sets transfer data.\n\t * - Adds dragover listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction start( event: DragEvent ) {\n\t\tconst { ownerDocument } = event.target as HTMLElement;\n\n\t\tevent.dataTransfer.setData(\n\t\t\ttransferDataType,\n\t\t\tJSON.stringify( transferData )\n\t\t);\n\n\t\tconst cloneWrapper = ownerDocument.createElement( 'div' );\n\t\t// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n\t\tcloneWrapper.style.top = '0';\n\t\tcloneWrapper.style.left = '0';\n\n\t\tconst dragImage = ownerDocument.createElement( 'div' );\n\n\t\t// Set a fake drag image to avoid browser defaults. Remove from DOM\n\t\t// right after. event.dataTransfer.setDragImage is not supported yet in\n\t\t// IE, we need to check for its existence first.\n\t\tif ( 'function' === typeof event.dataTransfer.setDragImage ) {\n\t\t\tdragImage.classList.add( dragImageClass );\n\t\t\townerDocument.body.appendChild( dragImage );\n\t\t\tevent.dataTransfer.setDragImage( dragImage, 0, 0 );\n\t\t}\n\n\t\tcloneWrapper.classList.add( cloneWrapperClass );\n\n\t\tif ( cloneClassname ) {\n\t\t\tcloneWrapper.classList.add( cloneClassname );\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\t// If a dragComponent is defined, the following logic will clone the\n\t\t// HTML node and inject it into the cloneWrapper.\n\t\tif ( dragComponentRef.current ) {\n\t\t\t// Position dragComponent at the same position as the cursor.\n\t\t\tx = event.clientX;\n\t\t\ty = event.clientY;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\tconst clonedDragComponent = ownerDocument.createElement( 'div' );\n\t\t\tclonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n\t\t\tcloneWrapper.appendChild( clonedDragComponent );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t} else {\n\t\t\tconst element = ownerDocument.getElementById(\n\t\t\t\telementId\n\t\t\t) as HTMLElement;\n\n\t\t\t// Prepare element clone and append to element wrapper.\n\t\t\tconst elementRect = element.getBoundingClientRect();\n\t\t\tconst elementWrapper = element.parentNode;\n\t\t\tconst elementTopOffset = elementRect.top;\n\t\t\tconst elementLeftOffset = elementRect.left;\n\n\t\t\tcloneWrapper.style.width = `${\n\t\t\t\telementRect.width + clonePadding * 2\n\t\t\t}px`;\n\n\t\t\tconst clone = element.cloneNode( true ) as HTMLElement;\n\t\t\tclone.id = `clone-${ elementId }`;\n\n\t\t\t// Position clone right over the original element (20px padding).\n\t\t\tx = elementLeftOffset - clonePadding;\n\t\t\ty = elementTopOffset - clonePadding;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\t// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n\t\t\tArray.from< HTMLIFrameElement >(\n\t\t\t\tclone.querySelectorAll( 'iframe' )\n\t\t\t).forEach( ( child ) => child.parentNode?.removeChild( child ) );\n\n\t\t\tcloneWrapper.appendChild( clone );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\telementWrapper?.appendChild( cloneWrapper );\n\t\t}\n\n\t\t// Mark the current cursor coordinates.\n\t\tlet cursorLeft = event.clientX;\n\t\tlet cursorTop = event.clientY;\n\n\t\tfunction over( e: DragEvent ) {\n\t\t\t// Skip doing any work if mouse has not moved.\n\t\t\tif ( cursorLeft === e.clientX && cursorTop === e.clientY ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextX = x + e.clientX - cursorLeft;\n\t\t\tconst nextY = y + e.clientY - cursorTop;\n\t\t\tcloneWrapper.style.transform = `translate( ${ nextX }px, ${ nextY }px )`;\n\t\t\tcursorLeft = e.clientX;\n\t\t\tcursorTop = e.clientY;\n\t\t\tx = nextX;\n\t\t\ty = nextY;\n\t\t\tif ( onDragOver ) {\n\t\t\t\tonDragOver( e );\n\t\t\t}\n\t\t}\n\n\t\t// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n\t\t// note that browsers may throttle raf below 60fps in certain conditions.\n\t\t// @ts-ignore\n\t\tconst throttledDragOver = throttle( over, 16 );\n\n\t\townerDocument.addEventListener( 'dragover', throttledDragOver );\n\n\t\t// Update cursor to 'grabbing', document wide.\n\t\townerDocument.body.classList.add( bodyClass );\n\n\t\t// Allow the Synthetic Event to be accessed from asynchronous code.\n\t\t// https://reactjs.org/docs/events.html#event-pooling\n\t\tevent.persist();\n\n\t\tlet timerId: number | undefined;\n\n\t\tif ( onDragStart ) {\n\t\t\ttimerId = setTimeout( () => onDragStart( event ) );\n\t\t}\n\n\t\tcleanup.current = () => {\n\t\t\t// Remove drag clone.\n\t\t\tif ( cloneWrapper && cloneWrapper.parentNode ) {\n\t\t\t\tcloneWrapper.parentNode.removeChild( cloneWrapper );\n\t\t\t}\n\n\t\t\tif ( dragImage && dragImage.parentNode ) {\n\t\t\t\tdragImage.parentNode.removeChild( dragImage );\n\t\t\t}\n\n\t\t\t// Reset cursor.\n\t\t\townerDocument.body.classList.remove( bodyClass );\n\n\t\t\townerDocument.removeEventListener( 'dragover', throttledDragOver );\n\n\t\t\tclearTimeout( timerId );\n\t\t};\n\t}\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tcleanup.current();\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ children( {\n\t\t\t\tonDraggableStart: start,\n\t\t\t\tonDraggableEnd: end,\n\t\t\t} ) }\n\t\t\t{ dragComponent && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-draggable-drag-component-root\"\n\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\tref={ dragComponentRef }\n\t\t\t\t>\n\t\t\t\t\t{ dragComponent }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Draggable;\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -51,7 +51,6 @@ export function useFlex(props) {
51
51
  const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp];
52
52
  const direction = useResponsiveValue(directionAsArray);
53
53
  const isColumn = typeof direction === 'string' && !!direction.includes('column');
54
- const isReverse = typeof direction === 'string' && direction.includes('reverse');
55
54
  const cx = useCx();
56
55
  const classes = useMemo(() => {
57
56
  const base = /*#__PURE__*/css({
@@ -62,9 +61,9 @@ export function useFlex(props) {
62
61
  justifyContent: justify,
63
62
  height: isColumn && expanded ? '100%' : undefined,
64
63
  width: !isColumn && expanded ? '100%' : undefined
65
- }, process.env.NODE_ENV === "production" ? "" : ";label:base;", process.env.NODE_ENV === "production" ? "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XHRcdGJhc2UsXG5cdFx0XHRpc0NvbHVtbiA/IHN0eWxlcy5JdGVtc0NvbHVtbiA6IHN0eWxlcy5JdGVtc1Jvdyxcblx0XHRcdGNsYXNzTmFtZVxuXHRcdCk7XG5cdH0sIFtcblx0XHRhbGlnbixcblx0XHRjbGFzc05hbWUsXG5cdFx0Y3gsXG5cdFx0ZGlyZWN0aW9uLFxuXHRcdGV4cGFuZGVkLFxuXHRcdGdhcCxcblx0XHRpc0NvbHVtbixcblx0XHRpc1JldmVyc2UsXG5cdFx0anVzdGlmeSxcblx0XHR3cmFwLFxuXHRdICk7XG5cblx0cmV0dXJuIHsgLi4ub3RoZXJQcm9wcywgY2xhc3NOYW1lOiBjbGFzc2VzLCBpc0NvbHVtbiB9O1xufVxuIl19 */");
64
+ }, process.env.NODE_ENV === "production" ? "" : ";label:base;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZmxleC9mbGV4L2hvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBK0RlIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZmxleC9mbGV4L2hvb2sudHMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbi8qKlxuICogV29yZFByZXNzIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyB1c2VNZW1vIH0gZnJvbSAnQHdvcmRwcmVzcy9lbGVtZW50JztcbmltcG9ydCBkZXByZWNhdGVkIGZyb20gJ0B3b3JkcHJlc3MvZGVwcmVjYXRlZCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9yd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5cdFx0XHRmbGV4V3JhcDogd3JhcCA/ICd3cmFwJyA6IHVuZGVmaW5lZCxcblx0XHRcdGdhcDogc3BhY2UoIGdhcCApLFxuXHRcdFx0anVzdGlmeUNvbnRlbnQ6IGp1c3RpZnksXG5cdFx0XHRoZWlnaHQ6IGlzQ29sdW1uICYmIGV4cGFuZGVkID8gJzEwMCUnIDogdW5kZWZpbmVkLFxuXHRcdFx0d2lkdGg6ICEgaXNDb2x1bW4gJiYgZXhwYW5kZWQgPyAnMTAwJScgOiB1bmRlZmluZWQsXG5cdFx0fSApO1xuXG5cdFx0cmV0dXJuIGN4KFxuXHRcdFx0c3R5bGVzLkZsZXgsXG5cdFx0XHRiYXNlLFxuXHRcdFx0aXNDb2x1bW4gPyBzdHlsZXMuSXRlbXNDb2x1bW4gOiBzdHlsZXMuSXRlbXNSb3csXG5cdFx0XHRjbGFzc05hbWVcblx0XHQpO1xuXHR9LCBbXG5cdFx0YWxpZ24sXG5cdFx0Y2xhc3NOYW1lLFxuXHRcdGN4LFxuXHRcdGRpcmVjdGlvbixcblx0XHRleHBhbmRlZCxcblx0XHRnYXAsXG5cdFx0aXNDb2x1bW4sXG5cdFx0anVzdGlmeSxcblx0XHR3cmFwLFxuXHRdICk7XG5cblx0cmV0dXJuIHsgLi4ub3RoZXJQcm9wcywgY2xhc3NOYW1lOiBjbGFzc2VzLCBpc0NvbHVtbiB9O1xufVxuIl19 */");
66
65
  return cx(styles.Flex, base, isColumn ? styles.ItemsColumn : styles.ItemsRow, className);
67
- }, [align, className, cx, direction, expanded, gap, isColumn, isReverse, justify, wrap]);
66
+ }, [align, className, cx, direction, expanded, gap, isColumn, justify, wrap]);
68
67
  return { ...otherProps,
69
68
  className: classes,
70
69
  isColumn
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/flex/flex/hook.ts"],"names":["css","useMemo","deprecated","useContextSystem","useResponsiveValue","space","styles","useCx","useDeprecatedProps","props","isReversed","otherProps","alternative","since","direction","useFlex","align","className","directionProp","expanded","gap","justify","wrap","directionAsArray","Array","isArray","isColumn","includes","isReverse","cx","classes","base","alignItems","flexDirection","flexWrap","undefined","justifyContent","height","width","Flex","ItemsColumn","ItemsRow"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAA0D,kBAA1D;AACA,SAASC,kBAAT,QAAmC,qCAAnC;AACA,SAASC,KAAT,QAAsB,sBAAtB;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AACA,SAASC,KAAT,QAAsB,aAAtB;;AAGA,SAASC,kBAAT,CACCC,KADD,EAE+C;AAC9C,QAAM;AAAEC,IAAAA,UAAF;AAAc,OAAGC;AAAjB,MAAgCF,KAAtC;;AAEA,MAAK,OAAOC,UAAP,KAAsB,WAA3B,EAAyC;AACxCR,IAAAA,UAAU,CAAE,iBAAF,EAAqB;AAC9BU,MAAAA,WAAW,EAAE,kDADiB;AAE9BC,MAAAA,KAAK,EAAE;AAFuB,KAArB,CAAV;AAIA,WAAO,EACN,GAAGF,UADG;AAENG,MAAAA,SAAS,EAAEJ,UAAU,GAAG,aAAH,GAAmB;AAFlC,KAAP;AAIA;;AAED,SAAOC,UAAP;AACA;;AAED,OAAO,SAASI,OAAT,CAAkBN,KAAlB,EAAuE;AAC7E,QAAM;AACLO,IAAAA,KAAK,GAAG,QADH;AAELC,IAAAA,SAFK;AAGLH,IAAAA,SAAS,EAAEI,aAAa,GAAG,KAHtB;AAILC,IAAAA,QAAQ,GAAG,IAJN;AAKLC,IAAAA,GAAG,GAAG,CALD;AAMLC,IAAAA,OAAO,GAAG,eANL;AAOLC,IAAAA,IAAI,GAAG,KAPF;AAQL,OAAGX;AARE,MASFR,gBAAgB,CAAEK,kBAAkB,CAAEC,KAAF,CAApB,EAA+B,MAA/B,CATpB;AAW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CAAvB;AA8BA,SAAO,EAAE,GAAGX,UAAL;AAAiBM,IAAAA,SAAS,EAAEa,OAA5B;AAAqCJ,IAAAA;AAArC,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useResponsiveValue } from '../../ui/utils/use-responsive-value';\nimport { space } from '../../ui/utils/space';\nimport * as styles from '../styles';\nimport { useCx } from '../../utils';\nimport type { FlexProps } from '../types';\n\nfunction useDeprecatedProps(\n\tprops: WordPressComponentProps< FlexProps, 'div' >\n): WordPressComponentProps< FlexProps, 'div' > {\n\tconst { isReversed, ...otherProps } = props;\n\n\tif ( typeof isReversed !== 'undefined' ) {\n\t\tdeprecated( 'Flex isReversed', {\n\t\t\talternative: 'Flex direction=\"row-reverse\" or \"column-reverse\"',\n\t\t\tsince: '5.9',\n\t\t} );\n\t\treturn {\n\t\t\t...otherProps,\n\t\t\tdirection: isReversed ? 'row-reverse' : 'row',\n\t\t};\n\t}\n\n\treturn otherProps;\n}\n\nexport function useFlex( props: WordPressComponentProps< FlexProps, 'div' > ) {\n\tconst {\n\t\talign = 'center',\n\t\tclassName,\n\t\tdirection: directionProp = 'row',\n\t\texpanded = true,\n\t\tgap = 2,\n\t\tjustify = 'space-between',\n\t\twrap = false,\n\t\t...otherProps\n\t} = useContextSystem( useDeprecatedProps( props ), 'Flex' );\n\n\tconst directionAsArray = Array.isArray( directionProp )\n\t\t? directionProp\n\t\t: [ directionProp ];\n\tconst direction = useResponsiveValue( directionAsArray );\n\n\tconst isColumn =\n\t\ttypeof direction === 'string' && !! direction.includes( 'column' );\n\tconst isReverse =\n\t\ttypeof direction === 'string' && direction.includes( 'reverse' );\n\n\tconst cx = useCx();\n\n\tconst classes = useMemo( () => {\n\t\tconst base = css( {\n\t\t\talignItems: isColumn ? 'normal' : align,\n\t\t\tflexDirection: direction,\n\t\t\tflexWrap: wrap ? 'wrap' : undefined,\n\t\t\tgap: space( gap ),\n\t\t\tjustifyContent: justify,\n\t\t\theight: isColumn && expanded ? '100%' : undefined,\n\t\t\twidth: ! isColumn && expanded ? '100%' : undefined,\n\t\t} );\n\n\t\treturn cx(\n\t\t\tstyles.Flex,\n\t\t\tbase,\n\t\t\tisColumn ? styles.ItemsColumn : styles.ItemsRow,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\talign,\n\t\tclassName,\n\t\tcx,\n\t\tdirection,\n\t\texpanded,\n\t\tgap,\n\t\tisColumn,\n\t\tisReverse,\n\t\tjustify,\n\t\twrap,\n\t] );\n\n\treturn { ...otherProps, className: classes, isColumn };\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/flex/flex/hook.ts"],"names":["css","useMemo","deprecated","useContextSystem","useResponsiveValue","space","styles","useCx","useDeprecatedProps","props","isReversed","otherProps","alternative","since","direction","useFlex","align","className","directionProp","expanded","gap","justify","wrap","directionAsArray","Array","isArray","isColumn","includes","cx","classes","base","alignItems","flexDirection","flexWrap","undefined","justifyContent","height","width","Flex","ItemsColumn","ItemsRow"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAA0D,kBAA1D;AACA,SAASC,kBAAT,QAAmC,qCAAnC;AACA,SAASC,KAAT,QAAsB,sBAAtB;AACA,OAAO,KAAKC,MAAZ,MAAwB,WAAxB;AACA,SAASC,KAAT,QAAsB,aAAtB;;AAGA,SAASC,kBAAT,CACCC,KADD,EAE+C;AAC9C,QAAM;AAAEC,IAAAA,UAAF;AAAc,OAAGC;AAAjB,MAAgCF,KAAtC;;AAEA,MAAK,OAAOC,UAAP,KAAsB,WAA3B,EAAy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JO;AAKjBe,MAAAA,cAAc,EAAEd,OALC;AAMjBe,MAAAA,MAAM,EAAEV,QAAQ,IAAIP,QAAZ,GAAuB,MAAvB,GAAgCe,SANvB;AAOjBG,MAAAA,KAAK,EAAE,CAAEX,QAAF,IAAcP,QAAd,GAAyB,MAAzB,GAAkCe;AAPxB,KAAF,0iHAAhB;AAUA,WAAON,EAAE,CACRtB,MAAM,CAACgC,IADC,EAERR,IAFQ,EAGRJ,QAAQ,GAAGpB,MAAM,CAACiC,WAAV,GAAwBjC,MAAM,CAACkC,QAH/B,EAIRvB,SAJQ,CAAT;AAMA,GAjBsB,EAiBpB,CACFD,KADE,EAEFC,SAFE,EAGFW,EAHE,EAIFd,SAJE,EAKFK,QALE,EAMFC,GANE,EAOFM,QAPE,EAQFL,OARE,EASFC,IATE,CAjBoB,CAAvB;AA6BA,SAAO,EAAE,GAAGX,UAAL;AAAiBM,IAAAA,SAAS,EAAEY,OAA5B;AAAqCH,IAAAA;AAArC,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useResponsiveValue } from '../../ui/utils/use-responsive-value';\nimport { space } from '../../ui/utils/space';\nimport * as styles from '../styles';\nimport { useCx } from '../../utils';\nimport type { FlexProps } from '../types';\n\nfunction useDeprecatedProps(\n\tprops: WordPressComponentProps< FlexProps, 'div' >\n): WordPressComponentProps< FlexProps, 'div' > {\n\tconst { isReversed, ...otherProps } = props;\n\n\tif ( typeof isReversed !== 'undefined' ) {\n\t\tdeprecated( 'Flex isReversed', {\n\t\t\talternative: 'Flex direction=\"row-reverse\" or \"column-reverse\"',\n\t\t\tsince: '5.9',\n\t\t} );\n\t\treturn {\n\t\t\t...otherProps,\n\t\t\tdirection: isReversed ? 'row-reverse' : 'row',\n\t\t};\n\t}\n\n\treturn otherProps;\n}\n\nexport function useFlex( props: WordPressComponentProps< FlexProps, 'div' > ) {\n\tconst {\n\t\talign = 'center',\n\t\tclassName,\n\t\tdirection: directionProp = 'row',\n\t\texpanded = true,\n\t\tgap = 2,\n\t\tjustify = 'space-between',\n\t\twrap = false,\n\t\t...otherProps\n\t} = useContextSystem( useDeprecatedProps( props ), 'Flex' );\n\n\tconst directionAsArray = Array.isArray( directionProp )\n\t\t? directionProp\n\t\t: [ directionProp ];\n\tconst direction = useResponsiveValue( directionAsArray );\n\n\tconst isColumn =\n\t\ttypeof direction === 'string' && !! direction.includes( 'column' );\n\n\tconst cx = useCx();\n\n\tconst classes = useMemo( () => {\n\t\tconst base = css( {\n\t\t\talignItems: isColumn ? 'normal' : align,\n\t\t\tflexDirection: direction,\n\t\t\tflexWrap: wrap ? 'wrap' : undefined,\n\t\t\tgap: space( gap ),\n\t\t\tjustifyContent: justify,\n\t\t\theight: isColumn && expanded ? '100%' : undefined,\n\t\t\twidth: ! isColumn && expanded ? '100%' : undefined,\n\t\t} );\n\n\t\treturn cx(\n\t\t\tstyles.Flex,\n\t\t\tbase,\n\t\t\tisColumn ? styles.ItemsColumn : styles.ItemsRow,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\talign,\n\t\tclassName,\n\t\tcx,\n\t\tdirection,\n\t\texpanded,\n\t\tgap,\n\t\tisColumn,\n\t\tjustify,\n\t\twrap,\n\t] );\n\n\treturn { ...otherProps, className: classes, isColumn };\n}\n"]}
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
4
4
  /**
5
5
  * Internal dependencies
6
6
  */
7
- import { FocalPointWrapper, PointerIconPathFill, PointerIconPathOutline, PointerIconSVG } from './styles/focal-point-style';
7
+ import { PointerCircle } from './styles/focal-point-style';
8
8
  /**
9
9
  * External dependencies
10
10
  */
@@ -21,19 +21,9 @@ export default function FocalPoint(_ref) {
21
21
  left,
22
22
  top
23
23
  };
24
- return createElement(FocalPointWrapper, _extends({}, props, {
24
+ return createElement(PointerCircle, _extends({}, props, {
25
25
  className: classes,
26
26
  style: style
27
- }), createElement(PointerIconSVG, {
28
- className: "components-focal-point-picker__icon",
29
- xmlns: "http://www.w3.org/2000/svg",
30
- viewBox: "0 0 30 30"
31
- }, createElement(PointerIconPathOutline, {
32
- className: "components-focal-point-picker__icon-outline",
33
- d: "M15 1C7.3 1 1 7.3 1 15s6.3 14 14 14 14-6.3 14-14S22.7 1 15 1zm0 22c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8z"
34
- }), createElement(PointerIconPathFill, {
35
- className: "components-focal-point-picker__icon-fill",
36
- d: "M15 3C8.4 3 3 8.4 3 15s5.4 12 12 12 12-5.4 12-12S21.6 3 15 3zm0 22C9.5 25 5 20.5 5 15S9.5 5 15 5s10 4.5 10 10-4.5 10-10 10z"
37
- })));
27
+ }));
38
28
  }
39
29
  //# sourceMappingURL=focal-point.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/focal-point-picker/focal-point.tsx"],"names":["FocalPointWrapper","PointerIconPathFill","PointerIconPathOutline","PointerIconSVG","classnames","FocalPoint","left","top","props","classes","style"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,mBAFD,EAGCC,sBAHD,EAICC,cAJD,QAKO,4BALP;AAOA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAIA,eAAe,SAASC,UAAT,OAIwC;AAAA,MAJnB;AACnCC,IAAAA,IAAI,GAAG,KAD4B;AAEnCC,IAAAA,GAAG,GAAG,KAF6B;AAGnC,OAAGC;AAHgC,GAImB;AACtD,QAAMC,OAAO,GAAGL,UAAU,CACzB,+CADyB,CAA1B;AAIA,QAAMM,KAAK,GAAG;AAAEJ,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAd;AAEA,SACC,cAAC,iBAAD,eAAwBC,KAAxB;AAAgC,IAAA,SAAS,EAAGC,OAA5C;AAAsD,IAAA,KAAK,EAAGC;AAA9D,MACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,KAAK,EAAC,4BAFP;AAGC,IAAA,OAAO,EAAC;AAHT,KAKC,cAAC,sBAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,CAAC,EAAC;AAFH,IALD,EASC,cAAC,mBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,CAAC,EAAC;AAFH,IATD,CADD,CADD;AAkBA","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tFocalPointWrapper,\n\tPointerIconPathFill,\n\tPointerIconPathOutline,\n\tPointerIconSVG,\n} from './styles/focal-point-style';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { FocalPointProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nexport default function FocalPoint( {\n\tleft = '50%',\n\ttop = '50%',\n\t...props\n}: WordPressComponentProps< FocalPointProps, 'div' > ) {\n\tconst classes = classnames(\n\t\t'components-focal-point-picker__icon_container'\n\t);\n\n\tconst style = { left, top };\n\n\treturn (\n\t\t<FocalPointWrapper { ...props } className={ classes } style={ style }>\n\t\t\t<PointerIconSVG\n\t\t\t\tclassName=\"components-focal-point-picker__icon\"\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\tviewBox=\"0 0 30 30\"\n\t\t\t>\n\t\t\t\t<PointerIconPathOutline\n\t\t\t\t\tclassName=\"components-focal-point-picker__icon-outline\"\n\t\t\t\t\td=\"M15 1C7.3 1 1 7.3 1 15s6.3 14 14 14 14-6.3 14-14S22.7 1 15 1zm0 22c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8z\"\n\t\t\t\t/>\n\t\t\t\t<PointerIconPathFill\n\t\t\t\t\tclassName=\"components-focal-point-picker__icon-fill\"\n\t\t\t\t\td=\"M15 3C8.4 3 3 8.4 3 15s5.4 12 12 12 12-5.4 12-12S21.6 3 15 3zm0 22C9.5 25 5 20.5 5 15S9.5 5 15 5s10 4.5 10 10-4.5 10-10 10z\"\n\t\t\t\t/>\n\t\t\t</PointerIconSVG>\n\t\t</FocalPointWrapper>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/focal-point-picker/focal-point.tsx"],"names":["PointerCircle","classnames","FocalPoint","left","top","props","classes","style"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,4BAA9B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAIA,eAAe,SAASC,UAAT,OAIwC;AAAA,MAJnB;AACnCC,IAAAA,IAAI,GAAG,KAD4B;AAEnCC,IAAAA,GAAG,GAAG,KAF6B;AAGnC,OAAGC;AAHgC,GAImB;AACtD,QAAMC,OAAO,GAAGL,UAAU,CACzB,+CADyB,CAA1B;AAIA,QAAMM,KAAK,GAAG;AAAEJ,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAd;AAEA,SAAO,cAAC,aAAD,eAAoBC,KAApB;AAA4B,IAAA,SAAS,EAAGC,OAAxC;AAAkD,IAAA,KAAK,EAAGC;AAA1D,KAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { PointerCircle } from './styles/focal-point-style';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { FocalPointProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nexport default function FocalPoint( {\n\tleft = '50%',\n\ttop = '50%',\n\t...props\n}: WordPressComponentProps< FocalPointProps, 'div' > ) {\n\tconst classes = classnames(\n\t\t'components-focal-point-picker__icon_container'\n\t);\n\n\tconst style = { left, top };\n\n\treturn <PointerCircle { ...props } className={ classes } style={ style } />;\n}\n"]}
@@ -1,63 +1,17 @@
1
1
  import _styled from "@emotion/styled/base";
2
2
 
3
- function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
4
-
5
3
  /**
6
4
  * External dependencies
7
5
  */
8
-
9
- /**
10
- * WordPress dependencies
11
- */
12
- import { Path, SVG } from '@wordpress/primitives';
13
- /**
14
- * Internal dependencies
15
- */
16
-
17
- import { COLORS } from '../../utils';
18
- export const FocalPointWrapper = _styled("div", process.env.NODE_ENV === "production" ? {
19
- target: "e19snlhg3"
6
+ export const PointerCircle = _styled("div", process.env.NODE_ENV === "production" ? {
7
+ target: "e19snlhg0"
20
8
  } : {
21
- target: "e19snlhg3",
22
- label: "FocalPointWrapper"
23
- })("background-color:transparent;cursor:grab;height:30px;margin:-15px 0 0 -15px;opacity:0.8;position:absolute;user-select:none;width:30px;will-change:transform;z-index:10000;", _ref => {
9
+ target: "e19snlhg0",
10
+ label: "PointerCircle"
11
+ })("background-color:transparent;cursor:grab;height:48px;margin:-24px 0 0 -24px;position:absolute;user-select:none;width:48px;will-change:transform;z-index:10000;background:rgba( 255, 255, 255, 0.6 );border-radius:50%;backdrop-filter:blur( 4px );box-shadow:rgb( 0 0 0 / 20% ) 0px 0px 10px;", _ref => {
24
12
  let {
25
13
  isDragging
26
14
  } = _ref;
27
15
  return isDragging && 'cursor: grabbing;';
28
- }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlMkMiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy9mb2NhbC1wb2ludC1waWNrZXIvc3R5bGVzL2ZvY2FsLXBvaW50LXN0eWxlLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcb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5cdGZpbGw6IHdoaXRlO1xuYDtcblxuZXhwb3J0IGNvbnN0IFBvaW50ZXJJY29uUGF0aEZpbGwgPSBzdHlsZWQoIFBhdGggKWBcblx0ZmlsbDogJHsgQ09MT1JTLnVpLnRoZW1lIH07XG5gO1xuIl19 */"));
29
- export const PointerIconSVG = /*#__PURE__*/_styled(SVG, process.env.NODE_ENV === "production" ? {
30
- target: "e19snlhg2"
31
- } : {
32
- target: "e19snlhg2",
33
- label: "PointerIconSVG"
34
- })(process.env.NODE_ENV === "production" ? {
35
- name: "qkx60y",
36
- styles: "display:block;height:100%;left:0;position:absolute;top:0;width:100%"
37
- } : {
38
- name: "qkx60y",
39
- styles: "display:block;height:100%;left:0;position:absolute;top:0;width:100%",
40
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErQjJDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IFBhdGgsIFNWRyB9IGZyb20gJ0B3b3JkcHJlc3MvcHJpbWl0aXZlcyc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IENPTE9SUyB9IGZyb20gJy4uLy4uL3V0aWxzJztcblxuZXhwb3J0IGNvbnN0IEZvY2FsUG9pbnRXcmFwcGVyID0gc3R5bGVkLmRpdmBcblx0YmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG5cdGN1cnNvcjogZ3JhYjtcblx0aGVpZ2h0OiAzMHB4O1xuXHRtYXJnaW46IC0xNXB4IDAgMCAtMTVweDtcblx0b3BhY2l0eTogMC44O1xuXHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdHVzZXItc2VsZWN0OiBub25lO1xuXHR3aWR0aDogMzBweDtcblx0d2lsbC1jaGFuZ2U6IHRyYW5zZm9ybTtcblx0ei1pbmRleDogMTAwMDA7XG5cblx0JHsgKCB7IGlzRHJhZ2dpbmcgfTogeyBpc0RyYWdnaW5nOiBib29sZWFuIH0gKSA9PlxuXHRcdGlzRHJhZ2dpbmcgJiYgJ2N1cnNvcjogZ3JhYmJpbmc7JyB9XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25TVkcgPSBzdHlsZWQoIFNWRyApYFxuXHRkaXNwbGF5OiBibG9jaztcblx0aGVpZ2h0OiAxMDAlO1xuXHRsZWZ0OiAwO1xuXHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdHRvcDogMDtcblx0d2lkdGg6IDEwMCU7XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25QYXRoT3V0bGluZSA9IHN0eWxlZCggUGF0aCApYFxuXHRmaWxsOiB3aGl0ZTtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb2ludGVySWNvblBhdGhGaWxsID0gc3R5bGVkKCBQYXRoIClgXG5cdGZpbGw6ICR7IENPTE9SUy51aS50aGVtZSB9O1xuYDtcbiJdfQ== */",
41
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
42
- });
43
- export const PointerIconPathOutline = /*#__PURE__*/_styled(Path, process.env.NODE_ENV === "production" ? {
44
- target: "e19snlhg1"
45
- } : {
46
- target: "e19snlhg1",
47
- label: "PointerIconPathOutline"
48
- })(process.env.NODE_ENV === "production" ? {
49
- name: "1b3qpiw",
50
- styles: "fill:white"
51
- } : {
52
- name: "1b3qpiw",
53
- styles: "fill:white",
54
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF3Q29EIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IFBhdGgsIFNWRyB9IGZyb20gJ0B3b3JkcHJlc3MvcHJpbWl0aXZlcyc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IENPTE9SUyB9IGZyb20gJy4uLy4uL3V0aWxzJztcblxuZXhwb3J0IGNvbnN0IEZvY2FsUG9pbnRXcmFwcGVyID0gc3R5bGVkLmRpdmBcblx0YmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG5cdGN1cnNvcjogZ3JhYjtcblx0aGVpZ2h0OiAzMHB4O1xuXHRtYXJnaW46IC0xNXB4IDAgMCAtMTVweDtcblx0b3BhY2l0eTogMC44O1xuXHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdHVzZXItc2VsZWN0OiBub25lO1xuXHR3aWR0aDogMzBweDtcblx0d2lsbC1jaGFuZ2U6IHRyYW5zZm9ybTtcblx0ei1pbmRleDogMTAwMDA7XG5cblx0JHsgKCB7IGlzRHJhZ2dpbmcgfTogeyBpc0RyYWdnaW5nOiBib29sZWFuIH0gKSA9PlxuXHRcdGlzRHJhZ2dpbmcgJiYgJ2N1cnNvcjogZ3JhYmJpbmc7JyB9XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25TVkcgPSBzdHlsZWQoIFNWRyApYFxuXHRkaXNwbGF5OiBibG9jaztcblx0aGVpZ2h0OiAxMDAlO1xuXHRsZWZ0OiAwO1xuXHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdHRvcDogMDtcblx0d2lkdGg6IDEwMCU7XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25QYXRoT3V0bGluZSA9IHN0eWxlZCggUGF0aCApYFxuXHRmaWxsOiB3aGl0ZTtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb2ludGVySWNvblBhdGhGaWxsID0gc3R5bGVkKCBQYXRoIClgXG5cdGZpbGw6ICR7IENPTE9SUy51aS50aGVtZSB9O1xuYDtcbiJdfQ== */",
55
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
56
- });
57
- export const PointerIconPathFill = /*#__PURE__*/_styled(Path, process.env.NODE_ENV === "production" ? {
58
- target: "e19snlhg0"
59
- } : {
60
- target: "e19snlhg0",
61
- label: "PointerIconPathFill"
62
- })("fill:", COLORS.ui.theme, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0Q2lEIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9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2lkdGg6IDEwMCU7XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25QYXRoT3V0bGluZSA9IHN0eWxlZCggUGF0aCApYFxuXHRmaWxsOiB3aGl0ZTtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb2ludGVySWNvblBhdGhGaWxsID0gc3R5bGVkKCBQYXRoIClgXG5cdGZpbGw6ICR7IENPTE9SUy51aS50aGVtZSB9O1xuYDtcbiJdfQ== */"));
16
+ }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLdUMiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy9mb2NhbC1wb2ludC1waWNrZXIvc3R5bGVzL2ZvY2FsLXBvaW50LXN0eWxlLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckNpcmNsZSA9IHN0eWxlZC5kaXZgXG5cdGJhY2tncm91bmQtY29sb3I6IHRyYW5zcGFyZW50O1xuXHRjdXJzb3I6IGdyYWI7XG5cdGhlaWdodDogNDhweDtcblx0bWFyZ2luOiAtMjRweCAwIDAgLTI0cHg7XG5cdHBvc2l0aW9uOiBhYnNvbHV0ZTtcblx0dXNlci1zZWxlY3Q6IG5vbmU7XG5cdHdpZHRoOiA0OHB4O1xuXHR3aWxsLWNoYW5nZTogdHJhbnNmb3JtO1xuXHR6LWluZGV4OiAxMDAwMDtcblx0YmFja2dyb3VuZDogcmdiYSggMjU1LCAyNTUsIDI1NSwgMC42ICk7XG5cdGJvcmRlci1yYWRpdXM6IDUwJTtcblx0YmFja2Ryb3AtZmlsdGVyOiBibHVyKCA0cHggKTtcblx0Ym94LXNoYWRvdzogcmdiKCAwIDAgMCAvIDIwJSApIDBweCAwcHggMTBweDtcblxuXHQkeyAoIHsgaXNEcmFnZ2luZyB9OiB7IGlzRHJhZ2dpbmc6IGJvb2xlYW4gfSApID0+XG5cdFx0aXNEcmFnZ2luZyAmJiAnY3Vyc29yOiBncmFiYmluZzsnIH1cbmA7XG4iXX0= */"));
63
17
  //# sourceMappingURL=focal-point-style.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/focal-point-picker/styles/focal-point-style.ts"],"names":["Path","SVG","COLORS","FocalPointWrapper","isDragging","PointerIconSVG","PointerIconPathOutline","PointerIconPathFill","ui","theme"],"mappings":";;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,aAAvB;AAEA,OAAO,MAAMC,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,iLAY1B;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACFA,UAAU,IAAI,mBADZ;AAAA,CAZ0B,yoDAAvB;AAgBP,OAAO,MAAMC,cAAc,GAAG,qBAAQJ,GAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAApB;AASP,OAAO,MAAMK,sBAAsB,GAAG,qBAAQN,IAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA5B;AAIP,OAAO,MAAMO,mBAAmB,GAAG,qBAAQP,IAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,UACtBE,MAAM,CAACM,EAAP,CAAUC,KADY,6oDAAzB","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport { COLORS } from '../../utils';\n\nexport const FocalPointWrapper = styled.div`\n\tbackground-color: transparent;\n\tcursor: grab;\n\theight: 30px;\n\tmargin: -15px 0 0 -15px;\n\topacity: 0.8;\n\tposition: absolute;\n\tuser-select: none;\n\twidth: 30px;\n\twill-change: transform;\n\tz-index: 10000;\n\n\t${ ( { isDragging }: { isDragging: boolean } ) =>\n\t\tisDragging && 'cursor: grabbing;' }\n`;\n\nexport const PointerIconSVG = styled( SVG )`\n\tdisplay: block;\n\theight: 100%;\n\tleft: 0;\n\tposition: absolute;\n\ttop: 0;\n\twidth: 100%;\n`;\n\nexport const PointerIconPathOutline = styled( Path )`\n\tfill: white;\n`;\n\nexport const PointerIconPathFill = styled( Path )`\n\tfill: ${ COLORS.ui.theme };\n`;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/focal-point-picker/styles/focal-point-style.ts"],"names":["PointerCircle","isDragging"],"mappings":";;AAAA;AACA;AACA;AAGA,OAAO,MAAMA,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,oSAetB;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACFA,UAAU,IAAI,mBADZ;AAAA,CAfsB,6qCAAnB","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\nexport const PointerCircle = styled.div`\n\tbackground-color: transparent;\n\tcursor: grab;\n\theight: 48px;\n\tmargin: -24px 0 0 -24px;\n\tposition: absolute;\n\tuser-select: none;\n\twidth: 48px;\n\twill-change: transform;\n\tz-index: 10000;\n\tbackground: rgba( 255, 255, 255, 0.6 );\n\tborder-radius: 50%;\n\tbackdrop-filter: blur( 4px );\n\tbox-shadow: rgb( 0 0 0 / 20% ) 0px 0px 10px;\n\n\t${ ( { isDragging }: { isDragging: boolean } ) =>\n\t\tisDragging && 'cursor: grabbing;' }\n`;\n"]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ /**
6
+ * List of T-shirt abbreviations.
7
+ *
8
+ * When there are 5 font sizes or fewer, we assume that the font sizes are
9
+ * ordered by size and show T-shirt labels.
10
+ */
11
+
12
+ export const T_SHIRT_ABBREVIATIONS = [
13
+ /* translators: S stands for 'small' and is a size label. */
14
+ __('S'),
15
+ /* translators: M stands for 'medium' and is a size label. */
16
+ __('M'),
17
+ /* translators: L stands for 'large' and is a size label. */
18
+ __('L'),
19
+ /* translators: XL stands for 'extra large' and is a size label. */
20
+ __('XL'),
21
+ /* translators: XXL stands for 'extra extra large' and is a size label. */
22
+ __('XXL')];
23
+ /**
24
+ * List of T-shirt names.
25
+ *
26
+ * When there are 5 font sizes or fewer, we assume that the font sizes are
27
+ * ordered by size and show T-shirt labels.
28
+ */
29
+
30
+ export const T_SHIRT_NAMES = [__('Small'), __('Medium'), __('Large'), __('Extra Large'), __('Extra Extra Large')];
31
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/font-size-picker/constants.ts"],"names":["__","T_SHIRT_ABBREVIATIONS","T_SHIRT_NAMES"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,qBAAqB,GAAG;AACpC;AACAD,EAAE,CAAE,GAAF,CAFkC;AAGpC;AACAA,EAAE,CAAE,GAAF,CAJkC;AAKpC;AACAA,EAAE,CAAE,GAAF,CANkC;AAOpC;AACAA,EAAE,CAAE,IAAF,CARkC;AASpC;AACAA,EAAE,CAAE,KAAF,CAVkC,CAA9B;AAaP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,aAAa,GAAG,CAC5BF,EAAE,CAAE,OAAF,CAD0B,EAE5BA,EAAE,CAAE,QAAF,CAF0B,EAG5BA,EAAE,CAAE,OAAF,CAH0B,EAI5BA,EAAE,CAAE,aAAF,CAJ0B,EAK5BA,EAAE,CAAE,mBAAF,CAL0B,CAAtB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * List of T-shirt abbreviations.\n *\n * When there are 5 font sizes or fewer, we assume that the font sizes are\n * ordered by size and show T-shirt labels.\n */\nexport const T_SHIRT_ABBREVIATIONS = [\n\t/* translators: S stands for 'small' and is a size label. */\n\t__( 'S' ),\n\t/* translators: M stands for 'medium' and is a size label. */\n\t__( 'M' ),\n\t/* translators: L stands for 'large' and is a size label. */\n\t__( 'L' ),\n\t/* translators: XL stands for 'extra large' and is a size label. */\n\t__( 'XL' ),\n\t/* translators: XXL stands for 'extra extra large' and is a size label. */\n\t__( 'XXL' ),\n];\n\n/**\n * List of T-shirt names.\n *\n * When there are 5 font sizes or fewer, we assume that the font sizes are\n * ordered by size and show T-shirt labels.\n */\nexport const T_SHIRT_NAMES = [\n\t__( 'Small' ),\n\t__( 'Medium' ),\n\t__( 'Large' ),\n\t__( 'Extra Large' ),\n\t__( 'Extra Extra Large' ),\n];\n"]}
@@ -0,0 +1,83 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __, sprintf } from '@wordpress/i18n';
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+
11
+ import CustomSelectControl from '../custom-select-control';
12
+ import { parseQuantityAndUnitFromRawValue } from '../unit-control';
13
+ import { getCommonSizeUnit, isSimpleCssValue } from './utils';
14
+ const DEFAULT_OPTION = {
15
+ key: 'default',
16
+ name: __('Default'),
17
+ value: undefined
18
+ };
19
+ const CUSTOM_OPTION = {
20
+ key: 'custom',
21
+ name: __('Custom')
22
+ };
23
+
24
+ const FontSizePickerSelect = props => {
25
+ var _options$find;
26
+
27
+ const {
28
+ fontSizes,
29
+ value,
30
+ disableCustomFontSizes,
31
+ size,
32
+ onChange,
33
+ onSelectCustom
34
+ } = props;
35
+ const areAllSizesSameUnit = !!getCommonSizeUnit(fontSizes);
36
+ const options = [DEFAULT_OPTION, ...fontSizes.map(fontSize => {
37
+ let hint;
38
+
39
+ if (areAllSizesSameUnit) {
40
+ const [quantity] = parseQuantityAndUnitFromRawValue(fontSize.size);
41
+
42
+ if (quantity !== undefined) {
43
+ hint = String(quantity);
44
+ }
45
+ } else if (isSimpleCssValue(fontSize.size)) {
46
+ hint = String(fontSize.size);
47
+ }
48
+
49
+ return {
50
+ key: fontSize.slug,
51
+ name: fontSize.name || fontSize.slug,
52
+ value: fontSize.size,
53
+ __experimentalHint: hint
54
+ };
55
+ }), ...(disableCustomFontSizes ? [] : [CUSTOM_OPTION])];
56
+ const selectedOption = value ? (_options$find = options.find(option => option.value === value)) !== null && _options$find !== void 0 ? _options$find : CUSTOM_OPTION : DEFAULT_OPTION;
57
+ return createElement(CustomSelectControl, {
58
+ __nextUnconstrainedWidth: true,
59
+ className: "components-font-size-picker__select",
60
+ label: __('Font size'),
61
+ hideLabelFromVision: true,
62
+ describedBy: sprintf( // translators: %s: Currently selected font size.
63
+ __('Currently selected font size: %s'), selectedOption.name),
64
+ options: options,
65
+ value: selectedOption,
66
+ __experimentalShowSelectedHint: true,
67
+ onChange: _ref => {
68
+ let {
69
+ selectedItem
70
+ } = _ref;
71
+
72
+ if (selectedItem === CUSTOM_OPTION) {
73
+ onSelectCustom();
74
+ } else {
75
+ onChange(selectedItem.value);
76
+ }
77
+ },
78
+ size: size
79
+ });
80
+ };
81
+
82
+ export default FontSizePickerSelect;
83
+ //# sourceMappingURL=font-size-picker-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/font-size-picker/font-size-picker-select.tsx"],"names":["__","sprintf","CustomSelectControl","parseQuantityAndUnitFromRawValue","getCommonSizeUnit","isSimpleCssValue","DEFAULT_OPTION","key","name","value","undefined","CUSTOM_OPTION","FontSizePickerSelect","props","fontSizes","disableCustomFontSizes","size","onChange","onSelectCustom","areAllSizesSameUnit","options","map","fontSize","hint","quantity","String","slug","__experimentalHint","selectedOption","find","option","selectedItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,SAASC,gCAAT,QAAiD,iBAAjD;AAKA,SAASC,iBAAT,EAA4BC,gBAA5B,QAAoD,SAApD;AAEA,MAAMC,cAA0C,GAAG;AAClDC,EAAAA,GAAG,EAAE,SAD6C;AAElDC,EAAAA,IAAI,EAAER,EAAE,CAAE,SAAF,CAF0C;AAGlDS,EAAAA,KAAK,EAAEC;AAH2C,CAAnD;AAMA,MAAMC,aAAyC,GAAG;AACjDJ,EAAAA,GAAG,EAAE,QAD4C;AAEjDC,EAAAA,IAAI,EAAER,EAAE,CAAE,QAAF;AAFyC,CAAlD;;AAKA,MAAMY,oBAAoB,GAAKC,KAAF,IAAwC;AAAA;;AACpE,QAAM;AACLC,IAAAA,SADK;AAELL,IAAAA,KAFK;AAGLM,IAAAA,sBAHK;AAILC,IAAAA,IAJK;AAKLC,IAAAA,QALK;AAMLC,IAAAA;AANK,MAOFL,KAPJ;AASA,QAAMM,mBAAmB,GAAG,CAAC,CAAEf,iBAAiB,CAAEU,SAAF,CAAhD;AAEA,QAAMM,OAAqC,GAAG,CAC7Cd,cAD6C,EAE7C,GAAGQ,SAAS,CAACO,GAAV,CAAiBC,QAAF,IAAgB;AACjC,QAAIC,IAAJ;;AACA,QAAKJ,mBAAL,EAA2B;AAC1B,YAAM,CAAEK,QAAF,IAAerB,gCAAgC,CACpDmB,QAAQ,CAACN,IAD2C,CAArD;;AAGA,UAAKQ,QAAQ,KAAKd,SAAlB,EAA8B;AAC7Ba,QAAAA,IAAI,GAAGE,MAAM,CAAED,QAAF,CAAb;AACA;AACD,KAPD,MAOO,IAAKnB,gBAAgB,CAAEiB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BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport CustomSelectControl from '../custom-select-control';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control';\nimport type {\n\tFontSizePickerSelectProps,\n\tFontSizePickerSelectOption,\n} from './types';\nimport { getCommonSizeUnit, isSimpleCssValue } from './utils';\n\nconst DEFAULT_OPTION: FontSizePickerSelectOption = {\n\tkey: 'default',\n\tname: __( 'Default' ),\n\tvalue: undefined,\n};\n\nconst CUSTOM_OPTION: FontSizePickerSelectOption = {\n\tkey: 'custom',\n\tname: __( 'Custom' ),\n};\n\nconst FontSizePickerSelect = ( props: FontSizePickerSelectProps ) => {\n\tconst {\n\t\tfontSizes,\n\t\tvalue,\n\t\tdisableCustomFontSizes,\n\t\tsize,\n\t\tonChange,\n\t\tonSelectCustom,\n\t} = props;\n\n\tconst areAllSizesSameUnit = !! getCommonSizeUnit( fontSizes );\n\n\tconst options: FontSizePickerSelectOption[] = [\n\t\tDEFAULT_OPTION,\n\t\t...fontSizes.map( ( fontSize ) => {\n\t\t\tlet hint;\n\t\t\tif ( areAllSizesSameUnit ) {\n\t\t\t\tconst [ quantity ] = parseQuantityAndUnitFromRawValue(\n\t\t\t\t\tfontSize.size\n\t\t\t\t);\n\t\t\t\tif ( quantity !== undefined ) {\n\t\t\t\t\thint = String( quantity );\n\t\t\t\t}\n\t\t\t} else if ( isSimpleCssValue( fontSize.size ) ) {\n\t\t\t\thint = String( fontSize.size );\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tkey: fontSize.slug,\n\t\t\t\tname: fontSize.name || fontSize.slug,\n\t\t\t\tvalue: fontSize.size,\n\t\t\t\t__experimentalHint: hint,\n\t\t\t};\n\t\t} ),\n\t\t...( disableCustomFontSizes ? [] : [ CUSTOM_OPTION ] ),\n\t];\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) ?? CUSTOM_OPTION\n\t\t: DEFAULT_OPTION;\n\n\treturn (\n\t\t<CustomSelectControl\n\t\t\t__nextUnconstrainedWidth\n\t\t\tclassName=\"components-font-size-picker__select\"\n\t\t\tlabel={ __( 'Font size' ) }\n\t\t\thideLabelFromVision\n\t\t\tdescribedBy={ sprintf(\n\t\t\t\t// translators: %s: Currently selected font size.\n\t\t\t\t__( 'Currently selected font size: %s' ),\n\t\t\t\tselectedOption.name\n\t\t\t) }\n\t\t\toptions={ options }\n\t\t\tvalue={ selectedOption }\n\t\t\t__experimentalShowSelectedHint\n\t\t\tonChange={ ( {\n\t\t\t\tselectedItem,\n\t\t\t}: {\n\t\t\t\tselectedItem: FontSizePickerSelectOption;\n\t\t\t} ) => {\n\t\t\t\tif ( selectedItem === CUSTOM_OPTION ) {\n\t\t\t\t\tonSelectCustom();\n\t\t\t\t} else {\n\t\t\t\t\tonChange( selectedItem.value );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tsize={ size }\n\t\t/>\n\t);\n};\n\nexport default FontSizePickerSelect;\n"]}