@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
@@ -3,12 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = Draggable;
6
+ exports.Draggable = Draggable;
7
+ exports.default = void 0;
7
8
 
8
9
  var _element = require("@wordpress/element");
9
10
 
10
11
  var _compose = require("@wordpress/compose");
11
12
 
13
+ /**
14
+ * External dependencies
15
+ */
16
+
12
17
  /**
13
18
  * WordPress dependencies
14
19
  */
@@ -17,27 +22,43 @@ const cloneWrapperClass = 'components-draggable__clone';
17
22
  const clonePadding = 0;
18
23
  const bodyClass = 'is-dragging-components-draggable';
19
24
  /**
20
- * @typedef RenderProp
21
- * @property {(event: import('react').DragEvent) => void} onDraggableStart `onDragStart` handler.
22
- * @property {(event: import('react').DragEvent) => void} onDraggableEnd `onDragEnd` handler.
23
- */
24
-
25
- /**
26
- * @typedef Props
27
- * @property {(props: RenderProp) => JSX.Element | null} children Children.
28
- * @property {(event: import('react').DragEvent) => void} [onDragStart] Callback when dragging starts.
29
- * @property {(event: import('react').DragEvent) => void} [onDragOver] Callback when dragging happens over the document.
30
- * @property {(event: import('react').DragEvent) => void} [onDragEnd] Callback when dragging ends.
31
- * @property {string} [cloneClassname] Classname for the cloned element.
32
- * @property {string} [elementId] ID for the element.
33
- * @property {any} [transferData] Transfer data for the drag event.
34
- * @property {string} [__experimentalTransferDataType] The transfer data type to set.
35
- * @property {import('react').ReactNode} __experimentalDragComponent Component to show when dragging.
36
- */
37
-
38
- /**
39
- * @param {Props} props
40
- * @return {JSX.Element} A draggable component.
25
+ * `Draggable` is a Component that provides a way to set up a cross-browser
26
+ * (including IE) customizable drag image and the transfer data for the drag
27
+ * event. It decouples the drag handle and the element to drag: use it by
28
+ * wrapping the component that will become the drag handle and providing the DOM
29
+ * ID of the element to drag.
30
+ *
31
+ * Note that the drag handle needs to declare the `draggable="true"` property
32
+ * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event
33
+ * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`
34
+ * takes care of the logic to setup the drag image and the transfer data, but is
35
+ * not concerned with creating an actual DOM element that is draggable.
36
+ *
37
+ * ```jsx
38
+ * import { Draggable, Panel, PanelBody } from '@wordpress/components';
39
+ * import { Icon, more } from '@wordpress/icons';
40
+ *
41
+ * const MyDraggable = () => (
42
+ * <div id="draggable-panel">
43
+ * <Panel header="Draggable panel">
44
+ * <PanelBody>
45
+ * <Draggable elementId="draggable-panel" transferData={ {} }>
46
+ * { ( { onDraggableStart, onDraggableEnd } ) => (
47
+ * <div
48
+ * className="example-drag-handle"
49
+ * draggable
50
+ * onDragStart={ onDraggableStart }
51
+ * onDragEnd={ onDraggableEnd }
52
+ * >
53
+ * <Icon icon={ more } />
54
+ * </div>
55
+ * ) }
56
+ * </Draggable>
57
+ * </PanelBody>
58
+ * </Panel>
59
+ * </div>
60
+ * );
61
+ * ```
41
62
  */
42
63
 
43
64
  function Draggable(_ref) {
@@ -52,14 +73,12 @@ function Draggable(_ref) {
52
73
  __experimentalTransferDataType: transferDataType = 'text',
53
74
  __experimentalDragComponent: dragComponent
54
75
  } = _ref;
55
-
56
- /** @type {import('react').MutableRefObject<HTMLDivElement | null>} */
57
76
  const dragComponentRef = (0, _element.useRef)(null);
58
77
  const cleanup = (0, _element.useRef)(() => {});
59
78
  /**
60
79
  * Removes the element clone, resets cursor, and removes drag listener.
61
80
  *
62
- * @param {import('react').DragEvent} event The non-custom DragEvent.
81
+ * @param event The non-custom DragEvent.
63
82
  */
64
83
 
65
84
  function end(event) {
@@ -78,20 +97,19 @@ function Draggable(_ref) {
78
97
  * - Sets transfer data.
79
98
  * - Adds dragover listener.
80
99
  *
81
- * @param {import('react').DragEvent} event The non-custom DragEvent.
100
+ * @param event The non-custom DragEvent.
82
101
  */
83
102
 
84
103
 
85
104
  function start(event) {
86
- // @ts-ignore We know that ownerDocument does exist on an Element
87
105
  const {
88
106
  ownerDocument
89
107
  } = event.target;
90
108
  event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));
91
109
  const cloneWrapper = ownerDocument.createElement('div'); // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.
92
110
 
93
- cloneWrapper.style.top = 0;
94
- cloneWrapper.style.left = 0;
111
+ cloneWrapper.style.top = '0';
112
+ cloneWrapper.style.left = '0';
95
113
  const dragImage = ownerDocument.createElement('div'); // Set a fake drag image to avoid browser defaults. Remove from DOM
96
114
  // right after. event.dataTransfer.setDragImage is not supported yet in
97
115
  // IE, we need to check for its existence first.
@@ -127,8 +145,8 @@ function Draggable(_ref) {
127
145
 
128
146
  const elementRect = element.getBoundingClientRect();
129
147
  const elementWrapper = element.parentNode;
130
- const elementTopOffset = parseInt(elementRect.top, 10);
131
- const elementLeftOffset = parseInt(elementRect.left, 10);
148
+ const elementTopOffset = elementRect.top;
149
+ const elementLeftOffset = elementRect.left;
132
150
  cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;
133
151
  const clone = element.cloneNode(true);
134
152
  clone.id = `clone-${elementId}`; // Position clone right over the original element (20px padding).
@@ -137,18 +155,19 @@ function Draggable(_ref) {
137
155
  y = elementTopOffset - clonePadding;
138
156
  cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`; // Hack: Remove iFrames as it's causing the embeds drag clone to freeze.
139
157
 
140
- Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode.removeChild(child));
158
+ Array.from(clone.querySelectorAll('iframe')).forEach(child => {
159
+ var _child$parentNode;
160
+
161
+ return (_child$parentNode = child.parentNode) === null || _child$parentNode === void 0 ? void 0 : _child$parentNode.removeChild(child);
162
+ });
141
163
  cloneWrapper.appendChild(clone); // Inject the cloneWrapper into the DOM.
142
164
 
143
- elementWrapper.appendChild(cloneWrapper);
165
+ elementWrapper === null || elementWrapper === void 0 ? void 0 : elementWrapper.appendChild(cloneWrapper);
144
166
  } // Mark the current cursor coordinates.
145
167
 
146
168
 
147
169
  let cursorLeft = event.clientX;
148
170
  let cursorTop = event.clientY;
149
- /**
150
- * @param {import('react').DragEvent<Element>} e
151
- */
152
171
 
153
172
  function over(e) {
154
173
  // Skip doing any work if mouse has not moved.
@@ -179,8 +198,6 @@ function Draggable(_ref) {
179
198
  // https://reactjs.org/docs/events.html#event-pooling
180
199
 
181
200
  event.persist();
182
- /** @type {number | undefined} */
183
-
184
201
  let timerId;
185
202
 
186
203
  if (onDragStart) {
@@ -218,4 +235,7 @@ function Draggable(_ref) {
218
235
  ref: dragComponentRef
219
236
  }, dragComponent));
220
237
  }
238
+
239
+ var _default = Draggable;
240
+ exports.default = _default;
221
241
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/draggable/index.js"],"names":["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":";;;;;;;AAIA;;AADA;;AAHA;AACA;AACA;AAIA,MAAMA,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;;AACe,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,GAAG,qBAAQ,IAAR,CAAzB;AACA,QAAMC,OAAO,GAAG,qBAAQ,MAAM,CAAE,CAAhB,CAAhB;AAEA;AACD;AACA;AACA;AACA;;AACC,WAASC,GAAT,CAAcC,KAAd,EAAsB;AACrBA,IAAAA,KAAK,CAACC,cAAN;AACAH,IAAAA,OA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AKGD,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":["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":";;;;;;;;AASA;;AADA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AASA,MAAMA,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;;AACO,SAASC,SAAT,OAUa;AAAA,MAVO;AAC1BC,IAAAA,QAD0B;AAE1BC,IAAAA,WAF0B;AAG1BC,IAAAA,UAH0B;AAI1BC,IAAAA,SAJ0B;AAK1BC,IAAAA,cAL0B;AAM1BC,IAAAA,SAN0B;AAO1BC,IAAAA,YAP0B;AAQ1BC,IAAAA,8BAA8B,EAAEC,gBAAgB,GAAG,MARzB;AAS1BC,IAAAA,2BAA2B,EAAEC;AATH,GAUP;AACnB,QAAMC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,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;;eAEcX,S","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,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -71,7 +71,6 @@ function useFlex(props) {
71
71
  const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp];
72
72
  const direction = (0, _useResponsiveValue.useResponsiveValue)(directionAsArray);
73
73
  const isColumn = typeof direction === 'string' && !!direction.includes('column');
74
- const isReverse = typeof direction === 'string' && direction.includes('reverse');
75
74
  const cx = (0, _utils.useCx)();
76
75
  const classes = (0, _element.useMemo)(() => {
77
76
  const base = /*#__PURE__*/(0, _react.css)({
@@ -82,9 +81,9 @@ function useFlex(props) {
82
81
  justifyContent: justify,
83
82
  height: isColumn && expanded ? '100%' : undefined,
84
83
  width: !isColumn && expanded ? '100%' : undefined
85
- }, process.env.NODE_ENV === "production" ? "" : ";label:base;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZmxleC9mbGV4L2hvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBaUVlI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bWUsXG5cdFx0Y3gsXG5cdFx0ZGlyZWN0aW9uLFxuXHRcdGV4cGFuZGVkLFxuXHRcdGdhcCxcblx0XHRpc0NvbHVtbixcblx0XHRpc1JldmVyc2UsXG5cdFx0anVzdGlmeSxcblx0XHR3cmFwLFxuXHRdICk7XG5cblx0cmV0dXJuIHsgLi4ub3RoZXJQcm9wcywgY2xhc3NOYW1lOiBjbGFzc2VzLCBpc0NvbHVtbiB9O1xufVxuIl19 */");
84
+ }, process.env.NODE_ENV === "production" ? "" : ";label:base;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZmxleC9mbGV4L2hvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBK0RlIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZmxleC9mbGV4L2hvb2sudHMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbi8qKlxuICogV29yZFByZXNzIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyB1c2VNZW1vIH0gZnJvbSAnQHdvcmRwcmVzcy9lbGVtZW50JztcbmltcG9ydCBkZXByZWNhdGVkIGZyb20gJ0B3b3JkcHJlc3MvZGVwcmVjYXRlZCc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZUNvbnRleHRTeXN0ZW0sIFdvcmRQcmVzc0NvbXBvbmVudFByb3BzIH0gZnJvbSAnLi4vLi4vdWkvY29udGV4dCc7XG5pbXBvcnQgeyB1c2VSZXNwb25zaXZlVmFsdWUgfSBmcm9tICcuLi8uLi91aS91dGlscy91c2U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1uICYmIGV4cGFuZGVkID8gJzEwMCUnIDogdW5kZWZpbmVkLFxuXHRcdFx0d2lkdGg6ICEgaXNDb2x1bW4gJiYgZXhwYW5kZWQgPyAnMTAwJScgOiB1bmRlZmluZWQsXG5cdFx0fSApO1xuXG5cdFx0cmV0dXJuIGN4KFxuXHRcdFx0c3R5bGVzLkZsZXgsXG5cdFx0XHRiYXNlLFxuXHRcdFx0aXNDb2x1bW4gPyBzdHlsZXMuSXRlbXNDb2x1bW4gOiBzdHlsZXMuSXRlbXNSb3csXG5cdFx0XHRjbGFzc05hbWVcblx0XHQpO1xuXHR9LCBbXG5cdFx0YWxpZ24sXG5cdFx0Y2xhc3NOYW1lLFxuXHRcdGN4LFxuXHRcdGRpcmVjdGlvbixcblx0XHRleHBhbmRlZCxcblx0XHRnYXAsXG5cdFx0aXNDb2x1bW4sXG5cdFx0anVzdGlmeSxcblx0XHR3cmFwLFxuXHRdICk7XG5cblx0cmV0dXJuIHsgLi4ub3RoZXJQcm9wcywgY2xhc3NOYW1lOiBjbGFzc2VzLCBpc0NvbHVtbiB9O1xufVxuIl19 */");
86
85
  return cx(styles.Flex, base, isColumn ? styles.ItemsColumn : styles.ItemsRow, className);
87
- }, [align, className, cx, direction, expanded, gap, isColumn, isReverse, justify, wrap]);
86
+ }, [align, className, cx, direction, expanded, gap, isColumn, justify, wrap]);
88
87
  return { ...otherProps,
89
88
  className: classes,
90
89
  isColumn
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/flex/flex/hook.ts"],"names":["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","styles","Flex","ItemsColumn","ItemsRow"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;;;;;AAlBA;AACA;AACA;;AAGA;AACA;AACA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,MAAAA,UAAU,EAAEN,QAAQ,GAAG,QAAH,GAAcV,KADjB;AAEjBiB,MAAAA,aAAa,EAAEnB,SAFE;AAGjBoB,MAAAA,QAAQ,EAAEZ,IAAI,GAAG,MAAH,GAAYa,SAHT;AAIjBf,MAAAA,GAAG,EAAE,kBAAOA,GAAP,CAJY;AAKjBgB,MAAAA,cAAc,EAAEf,OALC;AAMjBgB,MAAAA,MAAM,EAAEX,QAAQ,IAAIP,QAAZ,GAAuB,MAAvB,GAAgCgB,SANvB;AAOjBG,MAAAA,KAAK,EAAE,CAAEZ,QAAF,IAAcP,QAAd,GAAyB,MAAzB,GAAkCgB;AAPxB,KAAL,0rHAAb;AAUA,WAAON,EAAE,CACRU,MAAM,CAACC,IADC,EAERT,IAFQ,EAGRL,QAAQ,GAAGa,MAAM,CAACE,WAAV,GAAwBF,MAAM,CAACG,QAH/B,EAIRzB,SAJQ,CAAT;AAMA,GAjBe,EAiBb,CACFD,KADE,EAEFC,SAFE,EAGFY,EAHE,EAIFf,SAJE,EAKFK,QALE,EAMFC,GANE,EAOFM,QAPE,EAQFE,SARE,EASFP,OATE,EAUFC,IAVE,CAjBa,CAAhB;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":["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","styles","Flex","ItemsColumn","ItemsRow"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;;;;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAQA,SAASA,kBAAT,CACCC,KADD,EAE+C;AAC9C,QAAM;AAAEC,IAAAA,UAAF;AAAc,OAAGC;AAAjB,MAAgCF,KAAtC;;AAEA,MAAK,OAAOC,UAAP,KAAsB,WAA3B,EAAyC;AACxC,6BAAY,iBAAZ,EAA+B;AAC9BE,MAAAA,WAAW,EAAE,kDADiB;AAE9BC,MAAAA,KAAK,EAAE;AAFuB,KAA/B;AAIA,WAAO,EACN,GAAGF,UADG;AAENG,MAAAA,SAAS,EAAEJ,UAAU,GAAG,aAAH,GAAmB;AAFlC,KAAP;AAIA;;AAED,SAAOC,UAAP;AACA;;AAEM,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,MASF,+BAAkBH,kBAAkB,CAAEC,KAAF,CAApC,EAA+C,MAA/C,CATJ;AAWA,QAAMc,gBAAgB,GAAGC,KAAK,CAACC,OAAN,CAAeP,aAAf,IACtBA,aADsB,GAEtB,CAAEA,aAAF,CAFH;AAGA,QAAMJ,SAAS,GAAG,4CAAoBS,gBAApB,CAAlB;AAEA,QAAMG,QAAQ,GACb,OAAOZ,SAAP,KAAqB,QAArB,IAAiC,CAAC,CAAEA,SAAS,CAACa,QAAV,CAAoB,QAApB,CADrC;AAGA,QAAMC,EAAE,GAAG,mBAAX;AAEA,QAAMC,OAAO,GAAG,sBAAS,MAAM;AAC9B,UAAMC,IAAI,gBAAG,gBAAK;AACjBC,MAAAA,UAAU,EAAEL,QAAQ,GAAG,QAAH,GAAcV,KADjB;AAEjBgB,MAAAA,aAAa,EAAElB,SAFE;AAGjBmB,MAAAA,QAAQ,EAAEX,IAAI,GAAG,MAAH,GAAYY,SAHT;AAIjBd,MAAAA,GAAG,EAAE,kBAAOA,GAAP,CAJY;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,KAAL,0iHAAb;AAUA,WAAON,EAAE,CACRU,MAAM,CAACC,IADC,EAERT,IAFQ,EAGRJ,QAAQ,GAAGY,MAAM,CAACE,WAAV,GAAwBF,MAAM,CAACG,QAH/B,EAIRxB,SAJQ,CAAT;AAMA,GAjBe,EAiBb,CACFD,KADE,EAEFC,SAFE,EAGFW,EAHE,EAIFd,SAJE,EAKFK,QALE,EAMFC,GANE,EAOFM,QAPE,EAQFL,OARE,EASFC,IATE,CAjBa,CAAhB;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"]}
@@ -33,19 +33,9 @@ function FocalPoint(_ref) {
33
33
  left,
34
34
  top
35
35
  };
36
- return (0, _element.createElement)(_focalPointStyle.FocalPointWrapper, (0, _extends2.default)({}, props, {
36
+ return (0, _element.createElement)(_focalPointStyle.PointerCircle, (0, _extends2.default)({}, props, {
37
37
  className: classes,
38
38
  style: style
39
- }), (0, _element.createElement)(_focalPointStyle.PointerIconSVG, {
40
- className: "components-focal-point-picker__icon",
41
- xmlns: "http://www.w3.org/2000/svg",
42
- viewBox: "0 0 30 30"
43
- }, (0, _element.createElement)(_focalPointStyle.PointerIconPathOutline, {
44
- className: "components-focal-point-picker__icon-outline",
45
- 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"
46
- }), (0, _element.createElement)(_focalPointStyle.PointerIconPathFill, {
47
- className: "components-focal-point-picker__icon-fill",
48
- 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"
49
- })));
39
+ }));
50
40
  }
51
41
  //# sourceMappingURL=focal-point.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/focal-point-picker/focal-point.tsx"],"names":["FocalPoint","left","top","props","classes","style"],"mappings":";;;;;;;;;;;;;AAGA;;AAUA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAKe,SAASA,UAAT,OAIwC;AAAA,MAJnB;AACnCC,IAAAA,IAAI,GAAG,KAD4B;AAEnCC,IAAAA,GAAG,GAAG,KAF6B;AAGnC,OAAGC;AAHgC,GAImB;AACtD,QAAMC,OAAO,GAAG,yBACf,+CADe,CAAhB;AAIA,QAAMC,KAAK,GAAG;AAAEJ,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAd;AAEA,SACC,4BAAC,kCAAD,6BAAwBC,KAAxB;AAAgC,IAAA,SAAS,EAAGC,OAA5C;AAAsD,IAAA,KAAK,EAAGC;AAA9D,MACC,4BAAC,+BAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,KAAK,EAAC,4BAFP;AAGC,IAAA,OAAO,EAAC;AAHT,KAKC,4BAAC,uCAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,CAAC,EAAC;AAFH,IALD,EASC,4BAAC,oCAAD;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":["FocalPoint","left","top","props","classes","style"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAKe,SAASA,UAAT,OAIwC;AAAA,MAJnB;AACnCC,IAAAA,IAAI,GAAG,KAD4B;AAEnCC,IAAAA,GAAG,GAAG,KAF6B;AAGnC,OAAGC;AAHgC,GAImB;AACtD,QAAMC,OAAO,GAAG,yBACf,+CADe,CAAhB;AAIA,QAAMC,KAAK,GAAG;AAAEJ,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAd;AAEA,SAAO,4BAAC,8BAAD,6BAAoBC,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"]}
@@ -5,63 +5,23 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.PointerIconSVG = exports.PointerIconPathOutline = exports.PointerIconPathFill = exports.FocalPointWrapper = void 0;
8
+ exports.PointerCircle = void 0;
9
9
 
10
10
  var _base = _interopRequireDefault(require("@emotion/styled/base"));
11
11
 
12
- var _primitives = require("@wordpress/primitives");
13
-
14
- var _utils = require("../../utils");
15
-
16
- 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)."; }
17
-
18
- const FocalPointWrapper = (0, _base.default)("div", process.env.NODE_ENV === "production" ? {
19
- target: "e19snlhg3"
12
+ /**
13
+ * External dependencies
14
+ */
15
+ const PointerCircle = (0, _base.default)("div", process.env.NODE_ENV === "production" ? {
16
+ target: "e19snlhg0"
20
17
  } : {
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 => {
18
+ target: "e19snlhg0",
19
+ label: "PointerCircle"
20
+ })("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
21
  let {
25
22
  isDragging
26
23
  } = _ref;
27
24
  return isDragging && 'cursor: grabbing;';
28
- }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuY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GRpc3BsYXk6IGJsb2NrO1xuXHRoZWlnaHQ6IDEwMCU7XG5cdGxlZnQ6IDA7XG5cdHBvc2l0aW9uOiBhYnNvbHV0ZTtcblx0dG9wOiAwO1xuXHR3aWR0aDogMTAwJTtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb2ludGVySWNvblBhdGhPdXRsaW5lID0gc3R5bGVkKCBQYXRoIClgXG5cdGZpbGw6IHdoaXRlO1xuYDtcblxuZXhwb3J0IGNvbnN0IFBvaW50ZXJJY29uUGF0aEZpbGwgPSBzdHlsZWQoIFBhdGggKWBcblx0ZmlsbDogJHsgQ09MT1JTLnVpLnRoZW1lIH07XG5gO1xuIl19 */"));
29
- exports.FocalPointWrapper = FocalPointWrapper;
30
- const PointerIconSVG = ( /*#__PURE__*/0, _base.default)(_primitives.SVG, process.env.NODE_ENV === "production" ? {
31
- target: "e19snlhg2"
32
- } : {
33
- target: "e19snlhg2",
34
- label: "PointerIconSVG"
35
- })(process.env.NODE_ENV === "production" ? {
36
- name: "qkx60y",
37
- styles: "display:block;height:100%;left:0;position:absolute;top:0;width:100%"
38
- } : {
39
- name: "qkx60y",
40
- styles: "display:block;height:100%;left:0;position:absolute;top:0;width:100%",
41
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErQjJDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQgZnJvbS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GVySWNvblBhdGhGaWxsID0gc3R5bGVkKCBQYXRoIClgXG5cdGZpbGw6ICR7IENPTE9SUy51aS50aGVtZSB9O1xuYDtcbiJdfQ== */",
42
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
43
- });
44
- exports.PointerIconSVG = PointerIconSVG;
45
- const PointerIconPathOutline = ( /*#__PURE__*/0, _base.default)(_primitives.Path, process.env.NODE_ENV === "production" ? {
46
- target: "e19snlhg1"
47
- } : {
48
- target: "e19snlhg1",
49
- label: "PointerIconPathOutline"
50
- })(process.env.NODE_ENV === "production" ? {
51
- name: "1b3qpiw",
52
- styles: "fill:white"
53
- } : {
54
- name: "1b3qpiw",
55
- styles: "fill:white",
56
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF3Q29EIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IFBhdGgsIFNWRyB9IGZyb20gJ0B3b3JkcHJlc3MvcHJpbWl0aXZlcyc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IENPTE9SUyB9IGZyb20gJy4uLy4uL3V0aWxzJztcblxuZXhwb3J0IGNvbnN0IEZvY2FsUG9pbnRXcmFwcGVyID0gc3R5bGVkLmRpdmBcblx0YmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG5cdGN1cnNvcjogZ3JhYjtcblx0aGVpZ2h0OiAzMHB4O1xuXHRtYXJnaW46IC0xNXB4IDAgMCAtMTVweDtcblx0b3BhY2l0eTogMC44O1xuXHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdHVzZXItc2VsZWN0OiBub25lO1xuXHR3aWR0aDogMzBweDtcblx0d2lsbC1jaGFuZ2U6IHRyYW5zZm9ybTtcblx0ei1pbmRleDogMTAwMDA7XG5cblx0JHsgKCB7IGlzRHJhZ2dpbmcgfTogeyBpc0RyYWdnaW5nOiBib29sZWFuIH0gKSA9PlxuXHRcdGlzRHJhZ2dpbmcgJiYgJ2N1cnNvcjogZ3JhYmJpbmc7JyB9XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25TVkcgPSBzdHlsZWQoIFNWRyApYFxuXHRkaXNwbGF5OiBibG9jaztcblx0aGVpZ2h0OiAxMDAlO1xuXHRsZWZ0OiAwO1xuXHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdHRvcDogMDtcblx0d2lkdGg6IDEwMCU7XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25QYXRoT3V0bGluZSA9IHN0eWxlZCggUGF0aCApYFxuXHRmaWxsOiB3aGl0ZTtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb2ludGVySWNvblBhdGhGaWxsID0gc3R5bGVkKCBQYXRoIClgXG5cdGZpbGw6ICR7IENPTE9SUy51aS50aGVtZSB9O1xuYDtcbiJdfQ== */",
57
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
58
- });
59
- exports.PointerIconPathOutline = PointerIconPathOutline;
60
- const PointerIconPathFill = ( /*#__PURE__*/0, _base.default)(_primitives.Path, process.env.NODE_ENV === "production" ? {
61
- target: "e19snlhg0"
62
- } : {
63
- target: "e19snlhg0",
64
- label: "PointerIconPathFill"
65
- })("fill:", _utils.COLORS.ui.theme, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0Q2lEIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IFBhdGgsIFNWRyB9IGZyb20gJ0B3b3JkcHJlc3MvcHJpbWl0aXZlcyc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IENPTE9SUyB9IGZyb20gJy4uLy4uL3V0aWxzJztcblxuZXhwb3J0IGNvbnN0IEZvY2FsUG9pbnRXcmFwcGVyID0gc3R5bGVkLmRpdmBcblx0YmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG5cdGN1cnNvcjogZ3JhYjtcblx0aGVpZ2h0OiAzMHB4O1xuXHRtYXJnaW46IC0xNXB4IDAgMCAtMTVweDtcblx0b3BhY2l0eTogMC44O1xuXHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdHVzZXItc2VsZWN0OiBub25lO1xuXHR3aWR0aDogMzBweDtcblx0d2lsbC1jaGFuZ2U6IHRyYW5zZm9ybTtcblx0ei1pbmRleDogMTAwMDA7XG5cblx0JHsgKCB7IGlzRHJhZ2dpbmcgfTogeyBpc0RyYWdnaW5nOiBib29sZWFuIH0gKSA9PlxuXHRcdGlzRHJhZ2dpbmcgJiYgJ2N1cnNvcjogZ3JhYmJpbmc7JyB9XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25TVkcgPSBzdHlsZWQoIFNWRyApYFxuXHRkaXNwbGF5OiBibG9jaztcblx0aGVpZ2h0OiAxMDAlO1xuXHRsZWZ0OiAwO1xuXHRwb3NpdGlvbjogYWJzb2x1dGU7XG5cdHRvcDogMDtcblx0d2lkdGg6IDEwMCU7XG5gO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckljb25QYXRoT3V0bGluZSA9IHN0eWxlZCggUGF0aCApYFxuXHRmaWxsOiB3aGl0ZTtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb2ludGVySWNvblBhdGhGaWxsID0gc3R5bGVkKCBQYXRoIClgXG5cdGZpbGw6ICR7IENPTE9SUy51aS50aGVtZSB9O1xuYDtcbiJdfQ== */"));
66
- exports.PointerIconPathFill = PointerIconPathFill;
25
+ }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZm9jYWwtcG9pbnQtcGlja2VyL3N0eWxlcy9mb2NhbC1wb2ludC1zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLdUMiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy9mb2NhbC1wb2ludC1waWNrZXIvc3R5bGVzL2ZvY2FsLXBvaW50LXN0eWxlLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5leHBvcnQgY29uc3QgUG9pbnRlckNpcmNsZSA9IHN0eWxlZC5kaXZgXG5cdGJhY2tncm91bmQtY29sb3I6IHRyYW5zcGFyZW50O1xuXHRjdXJzb3I6IGdyYWI7XG5cdGhlaWdodDogNDhweDtcblx0bWFyZ2luOiAtMjRweCAwIDAgLTI0cHg7XG5cdHBvc2l0aW9uOiBhYnNvbHV0ZTtcblx0dXNlci1zZWxlY3Q6IG5vbmU7XG5cdHdpZHRoOiA0OHB4O1xuXHR3aWxsLWNoYW5nZTogdHJhbnNmb3JtO1xuXHR6LWluZGV4OiAxMDAwMDtcblx0YmFja2dyb3VuZDogcmdiYSggMjU1LCAyNTUsIDI1NSwgMC42ICk7XG5cdGJvcmRlci1yYWRpdXM6IDUwJTtcblx0YmFja2Ryb3AtZmlsdGVyOiBibHVyKCA0cHggKTtcblx0Ym94LXNoYWRvdzogcmdiKCAwIDAgMCAvIDIwJSApIDBweCAwcHggMTBweDtcblxuXHQkeyAoIHsgaXNEcmFnZ2luZyB9OiB7IGlzRHJhZ2dpbmc6IGJvb2xlYW4gfSApID0+XG5cdFx0aXNEcmFnZ2luZyAmJiAnY3Vyc29yOiBncmFiYmluZzsnIH1cbmA7XG4iXX0= */"));
26
+ exports.PointerCircle = PointerCircle;
67
27
  //# sourceMappingURL=focal-point-style.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/focal-point-picker/styles/focal-point-style.ts"],"names":["FocalPointWrapper","isDragging","PointerIconSVG","SVG","PointerIconPathOutline","Path","PointerIconPathFill","COLORS","ui","theme"],"mappings":";;;;;;;;;;;AAQA;;AAKA;;;;AAEO,MAAMA,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,iLAY1B;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACFA,UAAU,IAAI,mBADZ;AAAA,CAZ0B,yoDAAvB;;AAgBA,MAAMC,cAAc,GAAG,iCAAQC,eAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAApB;;AASA,MAAMC,sBAAsB,GAAG,iCAAQC,gBAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA5B;;AAIA,MAAMC,mBAAmB,GAAG,iCAAQD,gBAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,UACtBE,cAAOC,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;AAGO,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,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.T_SHIRT_NAMES = exports.T_SHIRT_ABBREVIATIONS = void 0;
7
+
8
+ var _i18n = require("@wordpress/i18n");
9
+
10
+ /**
11
+ * WordPress dependencies
12
+ */
13
+
14
+ /**
15
+ * List of T-shirt abbreviations.
16
+ *
17
+ * When there are 5 font sizes or fewer, we assume that the font sizes are
18
+ * ordered by size and show T-shirt labels.
19
+ */
20
+ const T_SHIRT_ABBREVIATIONS = [
21
+ /* translators: S stands for 'small' and is a size label. */
22
+ (0, _i18n.__)('S'),
23
+ /* translators: M stands for 'medium' and is a size label. */
24
+ (0, _i18n.__)('M'),
25
+ /* translators: L stands for 'large' and is a size label. */
26
+ (0, _i18n.__)('L'),
27
+ /* translators: XL stands for 'extra large' and is a size label. */
28
+ (0, _i18n.__)('XL'),
29
+ /* translators: XXL stands for 'extra extra large' and is a size label. */
30
+ (0, _i18n.__)('XXL')];
31
+ /**
32
+ * List of T-shirt names.
33
+ *
34
+ * When there are 5 font sizes or fewer, we assume that the font sizes are
35
+ * ordered by size and show T-shirt labels.
36
+ */
37
+
38
+ exports.T_SHIRT_ABBREVIATIONS = T_SHIRT_ABBREVIATIONS;
39
+ const T_SHIRT_NAMES = [(0, _i18n.__)('Small'), (0, _i18n.__)('Medium'), (0, _i18n.__)('Large'), (0, _i18n.__)('Extra Large'), (0, _i18n.__)('Extra Extra Large')];
40
+ exports.T_SHIRT_NAMES = T_SHIRT_NAMES;
41
+ //# 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":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,qBAAqB,GAAG;AACpC;AACA,cAAI,GAAJ,CAFoC;AAGpC;AACA,cAAI,GAAJ,CAJoC;AAKpC;AACA,cAAI,GAAJ,CANoC;AAOpC;AACA,cAAI,IAAJ,CARoC;AASpC;AACA,cAAI,KAAJ,CAVoC,CAA9B;AAaP;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,aAAa,GAAG,CAC5B,cAAI,OAAJ,CAD4B,EAE5B,cAAI,QAAJ,CAF4B,EAG5B,cAAI,OAAJ,CAH4B,EAI5B,cAAI,aAAJ,CAJ4B,EAK5B,cAAI,mBAAJ,CAL4B,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,97 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _i18n = require("@wordpress/i18n");
13
+
14
+ var _customSelectControl = _interopRequireDefault(require("../custom-select-control"));
15
+
16
+ var _unitControl = require("../unit-control");
17
+
18
+ var _utils = require("./utils");
19
+
20
+ /**
21
+ * WordPress dependencies
22
+ */
23
+
24
+ /**
25
+ * Internal dependencies
26
+ */
27
+ const DEFAULT_OPTION = {
28
+ key: 'default',
29
+ name: (0, _i18n.__)('Default'),
30
+ value: undefined
31
+ };
32
+ const CUSTOM_OPTION = {
33
+ key: 'custom',
34
+ name: (0, _i18n.__)('Custom')
35
+ };
36
+
37
+ const FontSizePickerSelect = props => {
38
+ var _options$find;
39
+
40
+ const {
41
+ fontSizes,
42
+ value,
43
+ disableCustomFontSizes,
44
+ size,
45
+ onChange,
46
+ onSelectCustom
47
+ } = props;
48
+ const areAllSizesSameUnit = !!(0, _utils.getCommonSizeUnit)(fontSizes);
49
+ const options = [DEFAULT_OPTION, ...fontSizes.map(fontSize => {
50
+ let hint;
51
+
52
+ if (areAllSizesSameUnit) {
53
+ const [quantity] = (0, _unitControl.parseQuantityAndUnitFromRawValue)(fontSize.size);
54
+
55
+ if (quantity !== undefined) {
56
+ hint = String(quantity);
57
+ }
58
+ } else if ((0, _utils.isSimpleCssValue)(fontSize.size)) {
59
+ hint = String(fontSize.size);
60
+ }
61
+
62
+ return {
63
+ key: fontSize.slug,
64
+ name: fontSize.name || fontSize.slug,
65
+ value: fontSize.size,
66
+ __experimentalHint: hint
67
+ };
68
+ }), ...(disableCustomFontSizes ? [] : [CUSTOM_OPTION])];
69
+ const selectedOption = value ? (_options$find = options.find(option => option.value === value)) !== null && _options$find !== void 0 ? _options$find : CUSTOM_OPTION : DEFAULT_OPTION;
70
+ return (0, _element.createElement)(_customSelectControl.default, {
71
+ __nextUnconstrainedWidth: true,
72
+ className: "components-font-size-picker__select",
73
+ label: (0, _i18n.__)('Font size'),
74
+ hideLabelFromVision: true,
75
+ describedBy: (0, _i18n.sprintf)( // translators: %s: Currently selected font size.
76
+ (0, _i18n.__)('Currently selected font size: %s'), selectedOption.name),
77
+ options: options,
78
+ value: selectedOption,
79
+ __experimentalShowSelectedHint: true,
80
+ onChange: _ref => {
81
+ let {
82
+ selectedItem
83
+ } = _ref;
84
+
85
+ if (selectedItem === CUSTOM_OPTION) {
86
+ onSelectCustom();
87
+ } else {
88
+ onChange(selectedItem.value);
89
+ }
90
+ },
91
+ size: size
92
+ });
93
+ };
94
+
95
+ var _default = FontSizePickerSelect;
96
+ exports.default = _default;
97
+ //# 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":["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":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;AASA,MAAMA,cAA0C,GAAG;AAClDC,EAAAA,GAAG,EAAE,SAD6C;AAElDC,EAAAA,IAAI,EAAE,cAAI,SAAJ,CAF4C;AAGlDC,EAAAA,KAAK,EAAEC;AAH2C,CAAnD;AAMA,MAAMC,aAAyC,GAAG;AACjDJ,EAAAA,GAAG,EAAE,QAD4C;AAEjDC,EAAAA,IAAI,EAAE,cAAI,QAAJ;AAF2C,CAAlD;;AAKA,MAAMI,oBAAoB,GAAKC,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C,qCAFX;AAGC,IAAA,KAAK,EAAG,cAAI,WAAJ,CAHT;AAIC,IAAA,mBAAmB,MAJpB;AAKC,IAAA,WAAW,EAAG,oBACb;AACA,kBAAI,kCAAJ,CAFa,EAGbsB,cAAc,CAACpB,IAHF,CALf;AAUC,IAAA,OAAO,EAAGY,OAVX;AAWC,IAAA,KAAK,EAAGQ,cAXT;AAYC,IAAA,8BAA8B,MAZ/B;AAaC,IAAA,QAAQ,EAAG,QAIJ;AAAA,UAJM;AACZG,QAAAA;AADY,OAIN;;AACN,UAAKA,YAAY,KAAKpB,aAAtB,EAAsC;AACrCO,QAAAA,cAAc;AACd,OAFD,MAEO;AACND,QAAAA,QAAQ,CAAEc,YAAY,CAACtB,KAAf,CAAR;AACA;AACD,KAvBF;AAwBC,IAAA,IAAI,EAAGO;AAxBR,IADD;AA4BA,CApED;;eAsEeJ,oB","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"]}