@wordpress/components 25.9.1 → 25.11.1-next.f8d8eceb.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 (364) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/build/alignment-matrix-control/cell.js +8 -5
  3. package/build/alignment-matrix-control/cell.js.map +1 -1
  4. package/build/alignment-matrix-control/index.js +27 -43
  5. package/build/alignment-matrix-control/index.js.map +1 -1
  6. package/build/alignment-matrix-control/utils.js +29 -9
  7. package/build/alignment-matrix-control/utils.js.map +1 -1
  8. package/build/autocomplete/index.js +104 -52
  9. package/build/autocomplete/index.js.map +1 -1
  10. package/build/circular-option-picker/circular-option-picker-option.js +20 -39
  11. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  12. package/build/circular-option-picker/circular-option-picker.js +11 -32
  13. package/build/circular-option-picker/circular-option-picker.js.map +1 -1
  14. package/build/circular-option-picker/types.js.map +1 -1
  15. package/build/color-palette/index.js +7 -2
  16. package/build/color-palette/index.js.map +1 -1
  17. package/build/color-picker/component.js +12 -2
  18. package/build/color-picker/component.js.map +1 -1
  19. package/build/color-picker/picker.js +77 -1
  20. package/build/color-picker/picker.js.map +1 -1
  21. package/build/color-picker/styles.js +8 -8
  22. package/build/color-picker/styles.js.map +1 -1
  23. package/build/color-picker/types.js.map +1 -1
  24. package/build/composite/v2.js +43 -0
  25. package/build/composite/v2.js.map +1 -0
  26. package/build/confirm-dialog/component.js +74 -8
  27. package/build/confirm-dialog/component.js.map +1 -1
  28. package/build/confirm-dialog/types.js.map +1 -1
  29. package/build/custom-gradient-picker/gradient-bar/control-points.js +13 -4
  30. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  31. package/build/dropdown-menu-v2-ariakit/index.js +217 -0
  32. package/build/dropdown-menu-v2-ariakit/index.js.map +1 -0
  33. package/build/dropdown-menu-v2-ariakit/styles.js +157 -0
  34. package/build/dropdown-menu-v2-ariakit/styles.js.map +1 -0
  35. package/build/dropdown-menu-v2-ariakit/types.js +6 -0
  36. package/build/dropdown-menu-v2-ariakit/types.js.map +1 -0
  37. package/build/font-size-picker/utils.js +1 -1
  38. package/build/font-size-picker/utils.js.map +1 -1
  39. package/build/input-control/styles/input-control-styles.js +23 -23
  40. package/build/input-control/styles/input-control-styles.js.map +1 -1
  41. package/build/mobile/global-styles-context/utils.native.js +1 -1
  42. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  43. package/build/modal/index.js +45 -16
  44. package/build/modal/index.js.map +1 -1
  45. package/build/palette-edit/index.js +4 -0
  46. package/build/palette-edit/index.js.map +1 -1
  47. package/build/popover/index.js +34 -6
  48. package/build/popover/index.js.map +1 -1
  49. package/build/private-apis.js +18 -2
  50. package/build/private-apis.js.map +1 -1
  51. package/build/progress-bar/styles.js +5 -5
  52. package/build/progress-bar/styles.js.map +1 -1
  53. package/build/sandbox/index.js +1 -1
  54. package/build/sandbox/index.js.map +1 -1
  55. package/build/sandbox/index.native.js +1 -1
  56. package/build/sandbox/index.native.js.map +1 -1
  57. package/build/select-control/styles/select-control-styles.js +8 -8
  58. package/build/select-control/styles/select-control-styles.js.map +1 -1
  59. package/build/tabs/context.js +16 -0
  60. package/build/tabs/context.js.map +1 -0
  61. package/build/tabs/index.js +147 -0
  62. package/build/tabs/index.js.map +1 -0
  63. package/build/tabs/styles.js +38 -0
  64. package/build/tabs/styles.js.map +1 -0
  65. package/build/tabs/tab.js +46 -0
  66. package/build/tabs/tab.js.map +1 -0
  67. package/build/tabs/tablist.js +47 -0
  68. package/build/tabs/tablist.js.map +1 -0
  69. package/build/tabs/tabpanel.js +48 -0
  70. package/build/tabs/tabpanel.js.map +1 -0
  71. package/build/tabs/types.js +6 -0
  72. package/build/tabs/types.js.map +1 -0
  73. package/build/text/component.js +7 -6
  74. package/build/text/component.js.map +1 -1
  75. package/build/text/hook.js +6 -15
  76. package/build/text/hook.js.map +1 -1
  77. package/build/text/index.js.map +1 -1
  78. package/build/text/styles.js +7 -7
  79. package/build/text/styles.js.map +1 -1
  80. package/build/text/types.js.map +1 -1
  81. package/build/text/utils.js +17 -33
  82. package/build/text/utils.js.map +1 -1
  83. package/build/toggle-group-control/toggle-group-control-option-base/component.js +1 -0
  84. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  85. package/build/toolbar/toolbar/index.js +17 -10
  86. package/build/toolbar/toolbar/index.js.map +1 -1
  87. package/build/toolbar/toolbar/types.js.map +1 -1
  88. package/build/tools-panel/tools-panel-item/hook.js +2 -2
  89. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  90. package/build/tools-panel/types.js.map +1 -1
  91. package/build/tooltip/index.js +2 -2
  92. package/build/tooltip/index.js.map +1 -1
  93. package/build/unit-control/utils.js +108 -0
  94. package/build/unit-control/utils.js.map +1 -1
  95. package/build/utils/unit-values.js +1 -1
  96. package/build/utils/unit-values.js.map +1 -1
  97. package/build-module/alignment-matrix-control/cell.js +7 -4
  98. package/build-module/alignment-matrix-control/cell.js.map +1 -1
  99. package/build-module/alignment-matrix-control/index.js +27 -43
  100. package/build-module/alignment-matrix-control/index.js.map +1 -1
  101. package/build-module/alignment-matrix-control/utils.js +29 -8
  102. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  103. package/build-module/autocomplete/index.js +104 -52
  104. package/build-module/autocomplete/index.js.map +1 -1
  105. package/build-module/circular-option-picker/circular-option-picker-option.js +20 -39
  106. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  107. package/build-module/circular-option-picker/circular-option-picker.js +10 -31
  108. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
  109. package/build-module/circular-option-picker/types.js.map +1 -1
  110. package/build-module/color-palette/index.js +7 -2
  111. package/build-module/color-palette/index.js.map +1 -1
  112. package/build-module/color-picker/component.js +13 -3
  113. package/build-module/color-picker/component.js.map +1 -1
  114. package/build-module/color-picker/picker.js +78 -2
  115. package/build-module/color-picker/picker.js.map +1 -1
  116. package/build-module/color-picker/styles.js +8 -8
  117. package/build-module/color-picker/styles.js.map +1 -1
  118. package/build-module/color-picker/types.js.map +1 -1
  119. package/build-module/composite/v2.js +15 -0
  120. package/build-module/composite/v2.js.map +1 -0
  121. package/build-module/confirm-dialog/component.js +72 -7
  122. package/build-module/confirm-dialog/component.js.map +1 -1
  123. package/build-module/confirm-dialog/types.js.map +1 -1
  124. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +13 -4
  125. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  126. package/build-module/dropdown-menu-v2-ariakit/index.js +199 -0
  127. package/build-module/dropdown-menu-v2-ariakit/index.js.map +1 -0
  128. package/build-module/dropdown-menu-v2-ariakit/styles.js +136 -0
  129. package/build-module/dropdown-menu-v2-ariakit/styles.js.map +1 -0
  130. package/build-module/dropdown-menu-v2-ariakit/types.js +2 -0
  131. package/build-module/dropdown-menu-v2-ariakit/types.js.map +1 -0
  132. package/build-module/font-size-picker/utils.js +1 -1
  133. package/build-module/font-size-picker/utils.js.map +1 -1
  134. package/build-module/input-control/styles/input-control-styles.js +23 -23
  135. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  136. package/build-module/mobile/global-styles-context/utils.native.js +2 -2
  137. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  138. package/build-module/modal/index.js +47 -18
  139. package/build-module/modal/index.js.map +1 -1
  140. package/build-module/palette-edit/index.js +4 -0
  141. package/build-module/palette-edit/index.js.map +1 -1
  142. package/build-module/popover/index.js +34 -6
  143. package/build-module/popover/index.js.map +1 -1
  144. package/build-module/private-apis.js +18 -2
  145. package/build-module/private-apis.js.map +1 -1
  146. package/build-module/progress-bar/styles.js +5 -5
  147. package/build-module/progress-bar/styles.js.map +1 -1
  148. package/build-module/sandbox/index.js +1 -1
  149. package/build-module/sandbox/index.js.map +1 -1
  150. package/build-module/sandbox/index.native.js +1 -1
  151. package/build-module/sandbox/index.native.js.map +1 -1
  152. package/build-module/select-control/styles/select-control-styles.js +8 -8
  153. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  154. package/build-module/tabs/context.js +12 -0
  155. package/build-module/tabs/context.js.map +1 -0
  156. package/build-module/tabs/index.js +142 -0
  157. package/build-module/tabs/index.js.map +1 -0
  158. package/build-module/tabs/styles.js +36 -0
  159. package/build-module/tabs/styles.js.map +1 -0
  160. package/build-module/tabs/tab.js +43 -0
  161. package/build-module/tabs/tab.js.map +1 -0
  162. package/build-module/tabs/tablist.js +41 -0
  163. package/build-module/tabs/tablist.js.map +1 -0
  164. package/build-module/tabs/tabpanel.js +43 -0
  165. package/build-module/tabs/tabpanel.js.map +1 -0
  166. package/build-module/tabs/types.js +2 -0
  167. package/build-module/tabs/types.js.map +1 -0
  168. package/build-module/text/component.js +6 -6
  169. package/build-module/text/component.js.map +1 -1
  170. package/build-module/text/hook.js +11 -19
  171. package/build-module/text/hook.js.map +1 -1
  172. package/build-module/text/index.js.map +1 -1
  173. package/build-module/text/styles.js +7 -7
  174. package/build-module/text/styles.js.map +1 -1
  175. package/build-module/text/types.js.map +1 -1
  176. package/build-module/text/utils.js +17 -10
  177. package/build-module/text/utils.js.map +1 -1
  178. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +1 -0
  179. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  180. package/build-module/toolbar/toolbar/index.js +18 -11
  181. package/build-module/toolbar/toolbar/index.js.map +1 -1
  182. package/build-module/toolbar/toolbar/types.js.map +1 -1
  183. package/build-module/tools-panel/tools-panel-item/hook.js +2 -2
  184. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  185. package/build-module/tools-panel/types.js.map +1 -1
  186. package/build-module/tooltip/index.js +2 -2
  187. package/build-module/tooltip/index.js.map +1 -1
  188. package/build-module/unit-control/utils.js +108 -0
  189. package/build-module/unit-control/utils.js.map +1 -1
  190. package/build-module/utils/unit-values.js +1 -1
  191. package/build-module/utils/unit-values.js.map +1 -1
  192. package/build-style/style-rtl.css +17 -5
  193. package/build-style/style.css +17 -5
  194. package/build-types/alignment-matrix-control/cell.d.ts +1 -1
  195. package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
  196. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  197. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  198. package/build-types/alignment-matrix-control/utils.d.ts +9 -9
  199. package/build-types/alignment-matrix-control/utils.d.ts.map +1 -1
  200. package/build-types/autocomplete/index.d.ts.map +1 -1
  201. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  202. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  203. package/build-types/circular-option-picker/types.d.ts +4 -6
  204. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  205. package/build-types/color-palette/index.d.ts.map +1 -1
  206. package/build-types/color-picker/component.d.ts.map +1 -1
  207. package/build-types/color-picker/picker.d.ts +1 -1
  208. package/build-types/color-picker/picker.d.ts.map +1 -1
  209. package/build-types/color-picker/styles.d.ts.map +1 -1
  210. package/build-types/color-picker/types.d.ts +3 -0
  211. package/build-types/color-picker/types.d.ts.map +1 -1
  212. package/build-types/composite/v2.d.ts +12 -0
  213. package/build-types/composite/v2.d.ts.map +1 -0
  214. package/build-types/confirm-dialog/component.d.ts +70 -29
  215. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  216. package/build-types/confirm-dialog/stories/index.story.d.ts +11 -0
  217. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -0
  218. package/build-types/confirm-dialog/test/index.d.ts +2 -0
  219. package/build-types/confirm-dialog/test/index.d.ts.map +1 -0
  220. package/build-types/confirm-dialog/types.d.ts +32 -10
  221. package/build-types/confirm-dialog/types.d.ts.map +1 -1
  222. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  223. package/build-types/dropdown-menu-v2-ariakit/index.d.ts +11 -0
  224. package/build-types/dropdown-menu-v2-ariakit/index.d.ts.map +1 -0
  225. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts +16 -0
  226. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts.map +1 -0
  227. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts +88 -0
  228. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts.map +1 -0
  229. package/build-types/dropdown-menu-v2-ariakit/test/index.d.ts +2 -0
  230. package/build-types/dropdown-menu-v2-ariakit/test/index.d.ts.map +1 -0
  231. package/build-types/dropdown-menu-v2-ariakit/types.d.ts +174 -0
  232. package/build-types/dropdown-menu-v2-ariakit/types.d.ts.map +1 -0
  233. package/build-types/font-size-picker/utils.d.ts.map +1 -1
  234. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  235. package/build-types/modal/index.d.ts.map +1 -1
  236. package/build-types/palette-edit/index.d.ts.map +1 -1
  237. package/build-types/popover/index.d.ts +1 -1
  238. package/build-types/popover/index.d.ts.map +1 -1
  239. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  240. package/build-types/private-apis.d.ts.map +1 -1
  241. package/build-types/progress-bar/styles.d.ts.map +1 -1
  242. package/build-types/sandbox/index.d.ts.map +1 -1
  243. package/build-types/tabs/context.d.ts +8 -0
  244. package/build-types/tabs/context.d.ts.map +1 -0
  245. package/build-types/tabs/index.d.ts +13 -0
  246. package/build-types/tabs/index.d.ts.map +1 -0
  247. package/build-types/tabs/stories/index.story.d.ts +20 -0
  248. package/build-types/tabs/stories/index.story.d.ts.map +1 -0
  249. package/build-types/tabs/styles.d.ts +17 -0
  250. package/build-types/tabs/styles.d.ts.map +1 -0
  251. package/build-types/tabs/tab.d.ts +10 -0
  252. package/build-types/tabs/tab.d.ts.map +1 -0
  253. package/build-types/tabs/tablist.d.ts +7 -0
  254. package/build-types/tabs/tablist.d.ts.map +1 -0
  255. package/build-types/tabs/tabpanel.d.ts +7 -0
  256. package/build-types/tabs/tabpanel.d.ts.map +1 -0
  257. package/build-types/tabs/test/index.d.ts +2 -0
  258. package/build-types/tabs/test/index.d.ts.map +1 -0
  259. package/build-types/tabs/types.d.ts +134 -0
  260. package/build-types/tabs/types.d.ts.map +1 -0
  261. package/build-types/text/component.d.ts +4 -2
  262. package/build-types/text/component.d.ts.map +1 -1
  263. package/build-types/text/hook.d.ts +171 -165
  264. package/build-types/text/hook.d.ts.map +1 -1
  265. package/build-types/text/index.d.ts +2 -2
  266. package/build-types/text/index.d.ts.map +1 -1
  267. package/build-types/text/stories/index.story.d.ts +21 -0
  268. package/build-types/text/stories/index.story.d.ts.map +1 -0
  269. package/build-types/text/styles.d.ts +7 -7
  270. package/build-types/text/styles.d.ts.map +1 -1
  271. package/build-types/text/types.d.ts +1 -1
  272. package/build-types/text/types.d.ts.map +1 -1
  273. package/build-types/text/utils.d.ts +56 -61
  274. package/build-types/text/utils.d.ts.map +1 -1
  275. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  276. package/build-types/toolbar/stories/index.story.d.ts +5 -0
  277. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  278. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  279. package/build-types/toolbar/toolbar/types.d.ts +10 -0
  280. package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
  281. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  282. package/build-types/tools-panel/types.d.ts +2 -0
  283. package/build-types/tools-panel/types.d.ts.map +1 -1
  284. package/build-types/tooltip/index.d.ts.map +1 -1
  285. package/build-types/unit-control/utils.d.ts.map +1 -1
  286. package/package.json +21 -20
  287. package/src/alignment-matrix-control/cell.tsx +6 -2
  288. package/src/alignment-matrix-control/index.tsx +31 -54
  289. package/src/alignment-matrix-control/stories/index.story.tsx +3 -7
  290. package/src/alignment-matrix-control/test/index.tsx +117 -18
  291. package/src/alignment-matrix-control/utils.tsx +33 -9
  292. package/src/autocomplete/index.tsx +136 -77
  293. package/src/button/style.scss +1 -2
  294. package/src/circular-option-picker/circular-option-picker-option.tsx +24 -38
  295. package/src/circular-option-picker/circular-option-picker.tsx +11 -28
  296. package/src/circular-option-picker/types.ts +6 -5
  297. package/src/color-palette/index.tsx +6 -1
  298. package/src/color-picker/component.tsx +25 -3
  299. package/src/color-picker/picker.tsx +96 -2
  300. package/src/color-picker/styles.ts +0 -1
  301. package/src/color-picker/types.ts +3 -0
  302. package/src/composite/v2.ts +22 -0
  303. package/src/confirm-dialog/README.md +1 -1
  304. package/src/confirm-dialog/component.tsx +79 -13
  305. package/src/confirm-dialog/stories/{index.story.js → index.story.tsx} +26 -24
  306. package/src/confirm-dialog/test/{index.js → index.tsx} +3 -3
  307. package/src/confirm-dialog/types.ts +32 -12
  308. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +32 -25
  309. package/src/dimension-control/test/__snapshots__/index.test.js.snap +8 -8
  310. package/src/dropdown-menu-v2-ariakit/README.md +324 -0
  311. package/src/dropdown-menu-v2-ariakit/index.tsx +318 -0
  312. package/src/dropdown-menu-v2-ariakit/stories/index.story.tsx +506 -0
  313. package/src/dropdown-menu-v2-ariakit/styles.ts +297 -0
  314. package/src/dropdown-menu-v2-ariakit/test/index.tsx +1139 -0
  315. package/src/dropdown-menu-v2-ariakit/types.ts +186 -0
  316. package/src/font-size-picker/utils.ts +2 -1
  317. package/src/heading/stories/index.story.tsx +2 -4
  318. package/src/input-control/styles/input-control-styles.tsx +2 -2
  319. package/src/mobile/global-styles-context/utils.native.js +2 -2
  320. package/src/modal/index.tsx +58 -22
  321. package/src/modal/test/index.tsx +29 -0
  322. package/src/notice/style.scss +0 -1
  323. package/src/palette-edit/index.tsx +4 -0
  324. package/src/popover/index.tsx +99 -57
  325. package/src/popover/style.scss +9 -0
  326. package/src/private-apis.ts +31 -1
  327. package/src/progress-bar/styles.ts +19 -4
  328. package/src/sandbox/index.native.js +1 -1
  329. package/src/sandbox/index.tsx +3 -1
  330. package/src/select-control/styles/select-control-styles.ts +2 -2
  331. package/src/tabs/README.md +242 -0
  332. package/src/tabs/context.ts +13 -0
  333. package/src/tabs/index.tsx +167 -0
  334. package/src/tabs/stories/index.story.tsx +352 -0
  335. package/src/tabs/styles.ts +103 -0
  336. package/src/tabs/tab.tsx +39 -0
  337. package/src/tabs/tablist.tsx +40 -0
  338. package/src/tabs/tabpanel.tsx +42 -0
  339. package/src/tabs/test/index.tsx +1133 -0
  340. package/src/tabs/types.ts +142 -0
  341. package/src/text/README.md +2 -2
  342. package/src/text/{component.js → component.tsx} +10 -6
  343. package/src/text/{hook.js → hook.ts} +12 -15
  344. package/src/text/stories/index.story.tsx +80 -0
  345. package/src/text/types.ts +1 -6
  346. package/src/text/{utils.js → utils.ts} +40 -14
  347. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +16 -0
  348. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +1 -0
  349. package/src/toolbar/stories/index.story.tsx +15 -0
  350. package/src/toolbar/test/index.tsx +8 -0
  351. package/src/toolbar/toolbar/README.md +9 -0
  352. package/src/toolbar/toolbar/index.tsx +21 -12
  353. package/src/toolbar/toolbar/style.scss +9 -0
  354. package/src/toolbar/toolbar/types.ts +10 -0
  355. package/src/tools-panel/tools-panel/README.md +3 -0
  356. package/src/tools-panel/tools-panel-item/hook.ts +4 -6
  357. package/src/tools-panel/types.ts +2 -0
  358. package/src/tooltip/index.tsx +2 -3
  359. package/src/unit-control/utils.ts +124 -0
  360. package/src/utils/unit-values.ts +1 -1
  361. package/tsconfig.tsbuildinfo +1 -1
  362. package/src/text/stories/index.story.js +0 -53
  363. /package/src/text/{index.js → index.ts} +0 -0
  364. /package/src/text/{styles.js → styles.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_modal","_interopRequireDefault","_context","_flex","_button","_text","_vStack","styles","_interopRequireWildcard","_useCx","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ConfirmDialog","props","forwardedRef","isOpen","isOpenProp","onConfirm","onCancel","children","confirmButtonText","cancelButtonText","otherProps","useContextSystem","cx","useCx","wrapperClassName","wrapper","cancelButtonRef","useRef","confirmButtonRef","setIsOpen","useState","shouldSelfClose","setShouldSelfClose","useEffect","isIsOpenSet","handleEvent","useCallback","callback","event","handleEnter","isConfirmOrCancelButton","target","current","cancelLabel","__","confirmLabel","_react","createElement","Fragment","onRequestClose","onKeyDown","closeButtonLabel","isDismissible","ref","overlayClassName","__experimentalHideHeader","VStack","spacing","Text","Flex","direction","justify","variant","onClick","_default","contextConnect","exports"],"sources":["@wordpress/components/src/confirm-dialog/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, KeyboardEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport type { OwnProps, DialogInputEvent } from './types';\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem, contextConnect } from '../context';\nimport { Flex } from '../flex';\nimport Button from '../button';\nimport { Text } from '../text';\nimport { VStack } from '../v-stack';\nimport * as styles from './styles';\nimport { useCx } from '../utils/hooks/use-cx';\n\nfunction ConfirmDialog(\n\tprops: WordPressComponentProps< OwnProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tisOpen: isOpenProp,\n\t\tonConfirm,\n\t\tonCancel,\n\t\tchildren,\n\t\tconfirmButtonText,\n\t\tcancelButtonText,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ConfirmDialog' );\n\n\tconst cx = useCx();\n\tconst wrapperClassName = cx( styles.wrapper );\n\tconst cancelButtonRef = useRef();\n\tconst confirmButtonRef = useRef();\n\n\tconst [ isOpen, setIsOpen ] = useState< boolean >();\n\tconst [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();\n\n\tuseEffect( () => {\n\t\t// We only allow the dialog to close itself if `isOpenProp` is *not* set.\n\t\t// If `isOpenProp` is set, then it (probably) means it's controlled by a\n\t\t// parent component. In that case, `shouldSelfClose` might do more harm than\n\t\t// good, so we disable it.\n\t\tconst isIsOpenSet = typeof isOpenProp !== 'undefined';\n\t\tsetIsOpen( isIsOpenSet ? isOpenProp : true );\n\t\tsetShouldSelfClose( ! isIsOpenSet );\n\t}, [ isOpenProp ] );\n\n\tconst handleEvent = useCallback(\n\t\t( callback?: ( event: DialogInputEvent ) => void ) =>\n\t\t\t( event: DialogInputEvent ) => {\n\t\t\t\tcallback?.( event );\n\t\t\t\tif ( shouldSelfClose ) {\n\t\t\t\t\tsetIsOpen( false );\n\t\t\t\t}\n\t\t\t},\n\t\t[ shouldSelfClose, setIsOpen ]\n\t);\n\n\tconst handleEnter = useCallback(\n\t\t( event: KeyboardEvent< HTMLDivElement > ) => {\n\t\t\t// Avoid triggering the 'confirm' action when a button is focused,\n\t\t\t// as this can cause a double submission.\n\t\t\tconst isConfirmOrCancelButton =\n\t\t\t\tevent.target === cancelButtonRef.current ||\n\t\t\t\tevent.target === confirmButtonRef.current;\n\n\t\t\tif ( ! isConfirmOrCancelButton && event.key === 'Enter' ) {\n\t\t\t\thandleEvent( onConfirm )( event );\n\t\t\t}\n\t\t},\n\t\t[ handleEvent, onConfirm ]\n\t);\n\n\tconst cancelLabel = cancelButtonText ?? __( 'Cancel' );\n\tconst confirmLabel = confirmButtonText ?? __( 'OK' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tonRequestClose={ handleEvent( onCancel ) }\n\t\t\t\t\tonKeyDown={ handleEnter }\n\t\t\t\t\tcloseButtonLabel={ cancelLabel }\n\t\t\t\t\tisDismissible={ true }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\toverlayClassName={ wrapperClassName }\n\t\t\t\t\t__experimentalHideHeader\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 8 }>\n\t\t\t\t\t\t<Text>{ children }</Text>\n\t\t\t\t\t\t<Flex direction=\"row\" justify=\"flex-end\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tref={ cancelButtonRef }\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onCancel ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ cancelLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tref={ confirmButtonRef }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onConfirm ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</VStack>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default contextConnect( ConfirmDialog, 'ConfirmDialog' );\n"],"mappings":";;;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAC,uBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAA8C,SAAAY,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA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AA,GAEc,IAAAC,uBAAc,EAAEvD,aAAa,EAAE,eAAgB,CAAC;AAAAwD,OAAA,CAAAvE,OAAA,GAAAqE,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_element","_modal","_interopRequireDefault","_context","_flex","_button","_text","_vStack","styles","_interopRequireWildcard","_useCx","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UnconnectedConfirmDialog","props","forwardedRef","isOpen","isOpenProp","onConfirm","onCancel","children","confirmButtonText","cancelButtonText","otherProps","useContextSystem","cx","useCx","wrapperClassName","wrapper","cancelButtonRef","useRef","confirmButtonRef","setIsOpen","useState","shouldSelfClose","setShouldSelfClose","useEffect","isIsOpenSet","handleEvent","useCallback","callback","event","handleEnter","isConfirmOrCancelButton","target","current","cancelLabel","__","confirmLabel","_react","createElement","Fragment","onRequestClose","onKeyDown","closeButtonLabel","isDismissible","ref","overlayClassName","__experimentalHideHeader","VStack","spacing","Text","Flex","direction","justify","variant","onClick","ConfirmDialog","contextConnect","exports","_default"],"sources":["@wordpress/components/src/confirm-dialog/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport type { ConfirmDialogProps, DialogInputEvent } from './types';\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem, contextConnect } from '../context';\nimport { Flex } from '../flex';\nimport Button from '../button';\nimport { Text } from '../text';\nimport { VStack } from '../v-stack';\nimport * as styles from './styles';\nimport { useCx } from '../utils/hooks/use-cx';\n\nconst UnconnectedConfirmDialog = (\n\tprops: WordPressComponentProps< ConfirmDialogProps, 'div', false >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tisOpen: isOpenProp,\n\t\tonConfirm,\n\t\tonCancel,\n\t\tchildren,\n\t\tconfirmButtonText,\n\t\tcancelButtonText,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ConfirmDialog' );\n\n\tconst cx = useCx();\n\tconst wrapperClassName = cx( styles.wrapper );\n\tconst cancelButtonRef = useRef();\n\tconst confirmButtonRef = useRef();\n\n\tconst [ isOpen, setIsOpen ] = useState< boolean >();\n\tconst [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();\n\n\tuseEffect( () => {\n\t\t// We only allow the dialog to close itself if `isOpenProp` is *not* set.\n\t\t// If `isOpenProp` is set, then it (probably) means it's controlled by a\n\t\t// parent component. In that case, `shouldSelfClose` might do more harm than\n\t\t// good, so we disable it.\n\t\tconst isIsOpenSet = typeof isOpenProp !== 'undefined';\n\t\tsetIsOpen( isIsOpenSet ? isOpenProp : true );\n\t\tsetShouldSelfClose( ! isIsOpenSet );\n\t}, [ isOpenProp ] );\n\n\tconst handleEvent = useCallback(\n\t\t( callback?: ( event: DialogInputEvent ) => void ) =>\n\t\t\t( event: DialogInputEvent ) => {\n\t\t\t\tcallback?.( event );\n\t\t\t\tif ( shouldSelfClose ) {\n\t\t\t\t\tsetIsOpen( false );\n\t\t\t\t}\n\t\t\t},\n\t\t[ shouldSelfClose, setIsOpen ]\n\t);\n\n\tconst handleEnter = useCallback(\n\t\t( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t\t// Avoid triggering the 'confirm' action when a button is focused,\n\t\t\t// as this can cause a double submission.\n\t\t\tconst isConfirmOrCancelButton =\n\t\t\t\tevent.target === cancelButtonRef.current ||\n\t\t\t\tevent.target === confirmButtonRef.current;\n\n\t\t\tif ( ! isConfirmOrCancelButton && event.key === 'Enter' ) {\n\t\t\t\thandleEvent( onConfirm )( event );\n\t\t\t}\n\t\t},\n\t\t[ handleEvent, onConfirm ]\n\t);\n\n\tconst cancelLabel = cancelButtonText ?? __( 'Cancel' );\n\tconst confirmLabel = confirmButtonText ?? __( 'OK' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tonRequestClose={ handleEvent( onCancel ) }\n\t\t\t\t\tonKeyDown={ handleEnter }\n\t\t\t\t\tcloseButtonLabel={ cancelLabel }\n\t\t\t\t\tisDismissible={ true }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\toverlayClassName={ wrapperClassName }\n\t\t\t\t\t__experimentalHideHeader\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 8 }>\n\t\t\t\t\t\t<Text>{ children }</Text>\n\t\t\t\t\t\t<Flex direction=\"row\" justify=\"flex-end\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tref={ cancelButtonRef }\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onCancel ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ cancelLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tref={ confirmButtonRef }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onConfirm ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</VStack>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\n/**\n * `ConfirmDialog` is built of top of [`Modal`](/packages/components/src/modal/README.md)\n * and displays a confirmation dialog, with _confirm_ and _cancel_ buttons.\n * The dialog is confirmed by clicking the _confirm_ button or by pressing the `Enter` key.\n * It is cancelled (closed) by clicking the _cancel_ button, by pressing the `ESC` key, or by\n * clicking outside the dialog focus (i.e, the overlay).\n *\n * `ConfirmDialog` has two main implicit modes: controlled and uncontrolled.\n *\n * UnControlled:\n *\n * Allows the component to be used standalone, just by declaring it as part of another React's component render method:\n * - It will be automatically open (displayed) upon mounting;\n * - It will be automatically closed when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);\n * - `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself.\n *\n * Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like:\n *\n * ```jsx\n * import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n *\n * function Example() {\n * \treturn (\n * \t\t<ConfirmDialog onConfirm={ () => console.debug( ' Confirmed! ' ) }>\n * \t\t\tAre you sure? <strong>This action cannot be undone!</strong>\n * \t\t</ConfirmDialog>\n * \t);\n * }\n * ```\n *\n *\n * Controlled mode:\n * Let the parent component control when the dialog is open/closed. It's activated when a\n * boolean value is passed to `isOpen`:\n * - It will not be automatically closed. You need to let it know when to open/close by updating the value of the `isOpen` prop;\n * - Both `onConfirm` and the `onCancel` callbacks are mandatory props in this mode;\n * - You'll want to update the state that controls `isOpen` by updating it from the `onCancel` and `onConfirm` callbacks.\n *\n *```jsx\n * import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * function Example() {\n * \tconst [ isOpen, setIsOpen ] = useState( true );\n *\n * \tconst handleConfirm = () => {\n * \t\tconsole.debug( 'Confirmed!' );\n * \t\tsetIsOpen( false );\n * \t};\n *\n * \tconst handleCancel = () => {\n * \t\tconsole.debug( 'Cancelled!' );\n * \t\tsetIsOpen( false );\n * \t};\n *\n * \treturn (\n * \t\t<ConfirmDialog\n * \t\t\tisOpen={ isOpen }\n * \t\t\tonConfirm={ handleConfirm }\n * \t\t\tonCancel={ handleCancel }\n * \t\t>\n * \t\t\tAre you sure? <strong>This action cannot be undone!</strong>\n * \t\t</ConfirmDialog>\n * \t);\n * }\n * ```\n */\nexport const ConfirmDialog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aAAA,EAAC/D,OAAA,CAAAwE,MAAM;IAACC,OAAO,EAAG;EAAG,GACpB,IAAAX,MAAA,CAAAC,aAAA,EAAChE,KAAA,CAAA2E,IAAI,QAAGzC,QAAgB,CAAC,EACzB,IAAA6B,MAAA,CAAAC,aAAA,EAAClE,KAAA,CAAA8E,IAAI;IAACC,SAAS,EAAC,KAAK;IAACC,OAAO,EAAC;EAAU,GACvC,IAAAf,MAAA,CAAAC,aAAA,EAACjE,OAAA,CAAAa,OAAM;IACN0D,GAAG,EAAG3B,eAAiB;IACvBoC,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAG5B,WAAW,CAAEnB,QAAS;EAAG,GAEjC2B,WACK,CAAC,EACT,IAAAG,MAAA,CAAAC,aAAA,EAACjE,OAAA,CAAAa,OAAM;IACN0D,GAAG,EAAGzB,gBAAkB;IACxBkC,OAAO,EAAC,SAAS;IACjBC,OAAO,EAAG5B,WAAW,CAAEpB,SAAU;EAAG,GAElC8B,YACK,CACH,CACC,CACF,CAEP,CAAC;AAEL,CAAC;;AAED;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;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,MAAMmB,aAAa,GAAG,IAAAC,uBAAc,EAC1CvD,wBAAwB,EACxB,eACD,CAAC;AAACwD,OAAA,CAAAF,aAAA,GAAAA,aAAA;AAAA,IAAAG,QAAA,GACaH,aAAa;AAAAE,OAAA,CAAAvE,OAAA,GAAAwE,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/confirm-dialog/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { MouseEvent, KeyboardEvent, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { ModalProps } from '../modal/types';\n\nexport type DialogInputEvent =\n\t| Parameters< ModalProps[ 'onRequestClose' ] >[ 0 ]\n\t| KeyboardEvent< HTMLDivElement >\n\t| MouseEvent< HTMLButtonElement >;\n\ntype BaseProps = {\n\tchildren: ReactNode;\n\tonConfirm: ( event: DialogInputEvent ) => void;\n\tconfirmButtonText?: string;\n\tcancelButtonText?: string;\n};\n\ntype ControlledProps = BaseProps & {\n\tonCancel: ( event: DialogInputEvent ) => void;\n\tisOpen: boolean;\n};\n\ntype UncontrolledProps = BaseProps & {\n\tonCancel?: ( event: DialogInputEvent ) => void;\n\tisOpen?: never;\n};\n\nexport type OwnProps = ControlledProps | UncontrolledProps;\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/confirm-dialog/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { MouseEvent, KeyboardEvent, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { ModalProps } from '../modal/types';\n\nexport type DialogInputEvent =\n\t| Parameters< ModalProps[ 'onRequestClose' ] >[ 0 ]\n\t| KeyboardEvent< HTMLDivElement >\n\t| MouseEvent< HTMLButtonElement >;\n\nexport type ConfirmDialogProps = {\n\t/**\n\t * The actual message for the dialog. It's passed as children and any valid `ReactNode` is accepted.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * The callback that's called when the user confirms.\n\t * A confirmation can happen when the `OK` button is clicked or when `Enter` is pressed.\n\t */\n\tonConfirm: ( event: DialogInputEvent ) => void;\n\t/**\n\t * The optional custom text to display as the confirmation button's label.\n\t */\n\tconfirmButtonText?: string;\n\t/**\n\t * The optional custom text to display as the cancellation button's label.\n\t */\n\tcancelButtonText?: string;\n\t/**\n\t * The callback that's called when the user cancels. A cancellation can happen\n\t * when the `Cancel` button is clicked, when the `ESC` key is pressed, or when\n\t * a click outside of the dialog focus is detected (i.e. in the overlay).\n\t *\n\t * It's not required if `isOpen` is not set (uncontrolled mode), as the component\n\t * will take care of closing itself, but you can still pass a callback if something\n\t * must be done upon cancelling (the component will still close itself in this case).\n\t *\n\t * If `isOpen` is set (controlled mode), then it's required, and you need to set\n\t * the state that defines `isOpen` to `false` as part of this callback if you want the\n\t * dialog to close when the user cancels.\n\t */\n\tonCancel?: ( event: DialogInputEvent ) => void;\n\t/**\n\t * Defines if the dialog is open (displayed) or closed (not rendered/displayed).\n\t * It also implicitly toggles the controlled mode if set or the uncontrolled mode if it's not set.\n\t */\n\tisOpen?: boolean;\n};\n"],"mappings":""}
@@ -19,6 +19,7 @@ var _visuallyHidden = require("../../visually-hidden");
19
19
  var _colorPalette = require("../../color-palette");
20
20
  var _utils = require("./utils");
21
21
  var _constants = require("./constants");
22
+ var _dropdownContentWrapper = _interopRequireDefault(require("../../dropdown/dropdown-content-wrapper"));
22
23
  /**
23
24
  * External dependencies
24
25
  */
@@ -62,7 +63,11 @@ function GradientColorPickerDropdown({
62
63
  // Open the popover below the gradient control/insertion point
63
64
  const popoverProps = (0, _element.useMemo)(() => ({
64
65
  placement: 'bottom',
65
- offset: 8
66
+ offset: 8,
67
+ // Disabling resize as it would otherwise cause the popover to show
68
+ // scrollbars while dragging the color picker's handle close to the
69
+ // popover edge.
70
+ resize: false
66
71
  }), []);
67
72
  const mergedClassName = (0, _classnames.default)('components-custom-gradient-picker__control-point-dropdown', className);
68
73
  return (0, _react.createElement)(_colorPalette.CustomColorPickerDropdown, {
@@ -172,7 +177,9 @@ function ControlPoints({
172
177
  }),
173
178
  renderContent: ({
174
179
  onClose
175
- }) => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_colorPicker.ColorPicker, {
180
+ }) => (0, _react.createElement)(_dropdownContentWrapper.default, {
181
+ paddingSize: "none"
182
+ }, (0, _react.createElement)(_colorPicker.ColorPicker, {
176
183
  enableAlpha: !disableAlpha,
177
184
  color: point.color,
178
185
  onChange: color => {
@@ -229,7 +236,9 @@ function InsertPoint({
229
236
  className: "components-custom-gradient-picker__insert-point-dropdown",
230
237
  icon: _icons.plus
231
238
  }),
232
- renderContent: () => (0, _react.createElement)(_colorPicker.ColorPicker, {
239
+ renderContent: () => (0, _react.createElement)(_dropdownContentWrapper.default, {
240
+ paddingSize: "none"
241
+ }, (0, _react.createElement)(_colorPicker.ColorPicker, {
233
242
  enableAlpha: !disableAlpha,
234
243
  onChange: color => {
235
244
  if (!alreadyInsertedPoint) {
@@ -239,7 +248,7 @@ function InsertPoint({
239
248
  onChange((0, _utils.updateControlPointColorByPosition)(controlPoints, insertPosition, (0, _colord.colord)(color).toRgbString()));
240
249
  }
241
250
  }
242
- }),
251
+ })),
243
252
  style: insertPosition !== null ? {
244
253
  left: `${insertPosition}%`,
245
254
  transform: 'translateX( -50% )'
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_colord","_compose","_element","_i18n","_icons","_button","_hStack","_colorPicker","_visuallyHidden","_colorPalette","_utils","_constants","ControlPointButton","isOpen","position","color","additionalProps","instanceId","useInstanceId","descriptionId","_react","createElement","Fragment","default","sprintf","__","className","classnames","VisuallyHidden","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","useMemo","placement","offset","mergedClassName","CustomColorPickerDropdown","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","useRef","onMouseMove","event","current","undefined","relativePosition","getHorizontalRelativeGradientPosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","MINIMUM_SIGNIFICANT_MOVE","updateControlPointPosition","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","useEffect","map","point","key","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","clampPercent","KEYBOARD_CONTROL_POINT_VARIATION","renderContent","ColorPicker","enableAlpha","updateControlPointColor","colord","toRgbString","length","HStack","alignment","removeControlPoint","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","useState","icon","plus","addControlPoint","updateControlPointColorByPosition","_default","exports"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { HStack } from '../../h-stack';\nimport { ColorPicker } from '../../color-picker';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { CustomColorPickerDropdown } from '../../color-palette';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\nimport type { WordPressComponentProps } from '../../context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\n\nfunction ControlPointButton( {\n\tisOpen,\n\tposition,\n\tcolor,\n\t...additionalProps\n}: WordPressComponentProps< ControlPointButtonProps, 'button', true > ) {\n\tconst instanceId = useInstanceId( ControlPointButton );\n\tconst descriptionId = `components-custom-gradient-picker__control-point-button-description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t// translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Gradient control point at position %1$s%% with color code %2$s.'\n\t\t\t\t\t),\n\t\t\t\t\tposition,\n\t\t\t\t\tcolor\n\t\t\t\t) }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'components-custom-gradient-picker__control-point-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isOpen,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nfunction GradientColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tclassName,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() =>\n\t\t\t( {\n\t\t\t\tplacement: 'bottom',\n\t\t\t\toffset: 8,\n\t\t\t} ) as const,\n\t\t[]\n\t);\n\n\tconst mergedClassName = classnames(\n\t\t'components-custom-gradient-picker__control-point-dropdown',\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName={ mergedClassName }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n\t__experimentalIsRenderedInSidebar,\n}: ControlPointsProps ) {\n\tconst controlPointMoveState = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveState.current === undefined ||\n\t\t\tgradientPickerDomRef.current === null\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveState.current;\n\n\t\tif (\n\t\t\t! significantMoveHappened &&\n\t\t\tMath.abs( initialPosition - relativePosition ) >=\n\t\t\t\tMINIMUM_SIGNIFICANT_MOVE\n\t\t) {\n\t\t\tcontrolPointMoveState.current.significantMoveHappened = true;\n\t\t}\n\n\t\tonChange(\n\t\t\tupdateControlPointPosition( controlPoints, index, relativePosition )\n\t\t);\n\t};\n\n\tconst cleanEventListeners = () => {\n\t\tif (\n\t\t\twindow &&\n\t\t\twindow.removeEventListener &&\n\t\t\tcontrolPointMoveState.current &&\n\t\t\tcontrolPointMoveState.current.listenersActivated\n\t\t) {\n\t\t\twindow.removeEventListener( 'mousemove', onMouseMove );\n\t\t\twindow.removeEventListener( 'mouseup', cleanEventListeners );\n\t\t\tonStopControlPointChange();\n\t\t\tcontrolPointMoveState.current.listenersActivated = false;\n\t\t}\n\t};\n\n\t// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`\n\t// This memoization would prevent the event listeners from being properly cleaned.\n\t// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.\n\tconst cleanEventListenersRef = useRef< () => void >();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current?.();\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ controlPoints.map( ( point, index ) => {\n\t\t\t\tconst initialPosition = point?.position;\n\t\t\t\treturn (\n\t\t\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\t\t\tisRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current\n\t\t\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\twindow &&\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current = {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\t\t\tcleanEventListeners\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t\tevent.code === 'ArrowRight'\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolord(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor\n\t\t\t\t\t\t\t\t\t\t\t\t\t).toRgbString()\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ ! disableRemove &&\n\t\t\t\t\t\t\t\t\t\tcontrolPoints.length > 2 && (\n\t\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point-wrapper\"\n\t\t\t\t\t\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove Control Point'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nfunction InsertPoint( {\n\tvalue: controlPoints,\n\tonChange,\n\tonOpenInserter,\n\tonCloseInserter,\n\tinsertPosition,\n\tdisableAlpha,\n\t__experimentalIsRenderedInSidebar,\n}: InsertPointProps ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\tclassName=\"components-custom-gradient-picker__inserter\"\n\t\t\tonClose={ () => {\n\t\t\t\tonCloseInserter();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonCloseInserter();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( false );\n\t\t\t\t\t\t\tonOpenInserter();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"components-custom-gradient-picker__insert-point-dropdown\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\tstyle={\n\t\t\t\tinsertPosition !== null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AAEA,IAAAW,MAAA,GAAAX,OAAA;AASA,IAAAY,UAAA,GAAAZ,OAAA;AAhCA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AA6BA,SAASa,kBAAkBA,CAAE;EAC5BC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACgE,CAAC,EAAG;EACvE,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEN,kBAAmB,CAAC;EACtD,MAAMO,aAAa,GAAI,uEAAuEF,UAAY,EAAC;EAC3G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AAM,CACb,CACC;IACHtB,aAAa,EAAGA,CAAA,KACf,IAAAlE,MAAA,CAAAC,aAAA,EAACd,YAAA,CAAAgF,WAAW;MACXC,WAAW,EAAG,CAAE/C,YAAc;MAC9BK,QAAQ,EAAK/B,KAAK,IAAM;QACvB,IAAK,CAAEyF,oBAAoB,EAAG;UAC7B1D,QAAQ,CACP,IAAA+D,sBAAe,EACdhE,aAAa,EACb0D,cAAc,EACd,IAAAb,cAAM,EAAE3E,KAAM,CAAC,CAAC4E,WAAW,CAAC,CAC7B,CACD,CAAC;UACDc,uBAAuB,CAAE,IAAK,CAAC;QAChC,CAAC,MAAM;UACN3D,QAAQ,CACP,IAAAgE,wCAAiC,EAChCjE,aAAa,EACb0D,cAAc,EACd,IAAAb,cAAM,EAAE3E,KAAM,CAAC,CAAC4E,WAAW,CAAC,CAC7B,CACD,CAAC;QACF;MACD;IAAG,CACH,CACC;IACHM,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAG,GAAGK,cAAgB,GAAE;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACD5C;EACH,CACD,CAAC;AAEJ;AACAhB,aAAa,CAAC6D,WAAW,GAAGA,WAAW;AAAC,IAAAW,QAAA,GAEzBxE,aAAa;AAAAyE,OAAA,CAAAzF,OAAA,GAAAwF,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_colord","_compose","_element","_i18n","_icons","_button","_hStack","_colorPicker","_visuallyHidden","_colorPalette","_utils","_constants","_dropdownContentWrapper","ControlPointButton","isOpen","position","color","additionalProps","instanceId","useInstanceId","descriptionId","_react","createElement","Fragment","default","sprintf","__","className","classnames","VisuallyHidden","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","useMemo","placement","offset","resize","mergedClassName","CustomColorPickerDropdown","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","useRef","onMouseMove","event","current","undefined","relativePosition","getHorizontalRelativeGradientPosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","MINIMUM_SIGNIFICANT_MOVE","updateControlPointPosition","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","useEffect","map","point","key","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","clampPercent","KEYBOARD_CONTROL_POINT_VARIATION","renderContent","paddingSize","ColorPicker","enableAlpha","updateControlPointColor","colord","toRgbString","length","HStack","alignment","removeControlPoint","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","useState","icon","plus","addControlPoint","updateControlPointColorByPosition","_default","exports"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { HStack } from '../../h-stack';\nimport { ColorPicker } from '../../color-picker';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { CustomColorPickerDropdown } from '../../color-palette';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\nimport type { WordPressComponentProps } from '../../context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nfunction ControlPointButton( {\n\tisOpen,\n\tposition,\n\tcolor,\n\t...additionalProps\n}: WordPressComponentProps< ControlPointButtonProps, 'button', true > ) {\n\tconst instanceId = useInstanceId( ControlPointButton );\n\tconst descriptionId = `components-custom-gradient-picker__control-point-button-description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t// translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Gradient control point at position %1$s%% with color code %2$s.'\n\t\t\t\t\t),\n\t\t\t\t\tposition,\n\t\t\t\t\tcolor\n\t\t\t\t) }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'components-custom-gradient-picker__control-point-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isOpen,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nfunction GradientColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tclassName,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() =>\n\t\t\t( {\n\t\t\t\tplacement: 'bottom',\n\t\t\t\toffset: 8,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t} ) as const,\n\t\t[]\n\t);\n\n\tconst mergedClassName = classnames(\n\t\t'components-custom-gradient-picker__control-point-dropdown',\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName={ mergedClassName }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n\t__experimentalIsRenderedInSidebar,\n}: ControlPointsProps ) {\n\tconst controlPointMoveState = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveState.current === undefined ||\n\t\t\tgradientPickerDomRef.current === null\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveState.current;\n\n\t\tif (\n\t\t\t! significantMoveHappened &&\n\t\t\tMath.abs( initialPosition - relativePosition ) >=\n\t\t\t\tMINIMUM_SIGNIFICANT_MOVE\n\t\t) {\n\t\t\tcontrolPointMoveState.current.significantMoveHappened = true;\n\t\t}\n\n\t\tonChange(\n\t\t\tupdateControlPointPosition( controlPoints, index, relativePosition )\n\t\t);\n\t};\n\n\tconst cleanEventListeners = () => {\n\t\tif (\n\t\t\twindow &&\n\t\t\twindow.removeEventListener &&\n\t\t\tcontrolPointMoveState.current &&\n\t\t\tcontrolPointMoveState.current.listenersActivated\n\t\t) {\n\t\t\twindow.removeEventListener( 'mousemove', onMouseMove );\n\t\t\twindow.removeEventListener( 'mouseup', cleanEventListeners );\n\t\t\tonStopControlPointChange();\n\t\t\tcontrolPointMoveState.current.listenersActivated = false;\n\t\t}\n\t};\n\n\t// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`\n\t// This memoization would prevent the event listeners from being properly cleaned.\n\t// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.\n\tconst cleanEventListenersRef = useRef< () => void >();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current?.();\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ controlPoints.map( ( point, index ) => {\n\t\t\t\tconst initialPosition = point?.position;\n\t\t\t\treturn (\n\t\t\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\t\t\tisRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current\n\t\t\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\twindow &&\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current = {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\t\t\tcleanEventListeners\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t\tevent.code === 'ArrowRight'\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolord(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor\n\t\t\t\t\t\t\t\t\t\t\t\t\t).toRgbString()\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ ! disableRemove &&\n\t\t\t\t\t\t\t\t\t\tcontrolPoints.length > 2 && (\n\t\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point-wrapper\"\n\t\t\t\t\t\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove Control Point'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nfunction InsertPoint( {\n\tvalue: controlPoints,\n\tonChange,\n\tonOpenInserter,\n\tonCloseInserter,\n\tinsertPosition,\n\tdisableAlpha,\n\t__experimentalIsRenderedInSidebar,\n}: InsertPointProps ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\tclassName=\"components-custom-gradient-picker__inserter\"\n\t\t\tonClose={ () => {\n\t\t\t\tonCloseInserter();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonCloseInserter();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( false );\n\t\t\t\t\t\t\tonOpenInserter();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"components-custom-gradient-picker__insert-point-dropdown\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t\tstyle={\n\t\t\t\tinsertPosition !== null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IA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CACP,IAAAiE,wCAAiC,EAChClE,aAAa,EACb2D,cAAc,EACd,IAAAb,cAAM,EAAE7E,KAAM,CAAC,CAAC8E,WAAW,CAAC,CAC7B,CACD,CAAC;QACF;MACD;IAAG,CACH,CACsB,CACtB;IACHM,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAG,GAAGK,cAAgB,GAAE;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACD7C;EACH,CACD,CAAC;AAEJ;AACAhB,aAAa,CAAC8D,WAAW,GAAGA,WAAW;AAAC,IAAAW,QAAA,GAEzBzE,aAAa;AAAA0E,OAAA,CAAA3F,OAAA,GAAA0F,QAAA"}
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DropdownMenuSeparator = exports.DropdownMenuRadioItem = exports.DropdownMenuItem = exports.DropdownMenuGroupLabel = exports.DropdownMenuGroup = exports.DropdownMenuContext = exports.DropdownMenuCheckboxItem = exports.DropdownMenu = void 0;
8
+ var _react = require("react");
9
+ var Ariakit = _interopRequireWildcard(require("@ariakit/react"));
10
+ var _element = require("@wordpress/element");
11
+ var _i18n = require("@wordpress/i18n");
12
+ var _icons = require("@wordpress/icons");
13
+ var _primitives = require("@wordpress/primitives");
14
+ var _context = require("../context");
15
+ var _icon = _interopRequireDefault(require("../icon"));
16
+ var Styled = _interopRequireWildcard(require("./styles"));
17
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+ /**
20
+ * External dependencies
21
+ */
22
+ // eslint-disable-next-line no-restricted-imports
23
+
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+
28
+ /**
29
+ * Internal dependencies
30
+ */
31
+
32
+ const DropdownMenuContext = (0, _element.createContext)(undefined);
33
+ exports.DropdownMenuContext = DropdownMenuContext;
34
+ const DropdownMenuItem = (0, _element.forwardRef)(function DropdownMenuItem({
35
+ prefix,
36
+ suffix,
37
+ children,
38
+ hideOnClick = true,
39
+ ...props
40
+ }, ref) {
41
+ const dropdownMenuContext = (0, _element.useContext)(DropdownMenuContext);
42
+ return (0, _react.createElement)(Styled.DropdownMenuItem, {
43
+ ref: ref,
44
+ ...props,
45
+ hideOnClick: hideOnClick,
46
+ store: dropdownMenuContext?.store
47
+ }, prefix && (0, _react.createElement)(Styled.ItemPrefixWrapper, null, prefix), children, suffix && (0, _react.createElement)(Styled.ItemSuffixWrapper, null, suffix));
48
+ });
49
+ exports.DropdownMenuItem = DropdownMenuItem;
50
+ const DropdownMenuCheckboxItem = (0, _element.forwardRef)(function DropdownMenuCheckboxItem({
51
+ suffix,
52
+ children,
53
+ hideOnClick = false,
54
+ ...props
55
+ }, ref) {
56
+ const dropdownMenuContext = (0, _element.useContext)(DropdownMenuContext);
57
+ return (0, _react.createElement)(Styled.DropdownMenuCheckboxItem, {
58
+ ref: ref,
59
+ ...props,
60
+ hideOnClick: hideOnClick,
61
+ store: dropdownMenuContext?.store
62
+ }, (0, _react.createElement)(Ariakit.MenuItemCheck, {
63
+ store: dropdownMenuContext?.store,
64
+ render: (0, _react.createElement)(Styled.ItemPrefixWrapper, null)
65
+ }, (0, _react.createElement)(_icon.default, {
66
+ icon: _icons.check,
67
+ size: 24
68
+ })), children, suffix && (0, _react.createElement)(Styled.ItemSuffixWrapper, null, suffix));
69
+ });
70
+ exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem;
71
+ const DropdownMenuRadioItem = (0, _element.forwardRef)(function DropdownMenuRadioItem({
72
+ suffix,
73
+ children,
74
+ hideOnClick = false,
75
+ ...props
76
+ }, ref) {
77
+ const dropdownMenuContext = (0, _element.useContext)(DropdownMenuContext);
78
+ return (0, _react.createElement)(Styled.DropdownMenuRadioItem, {
79
+ ref: ref,
80
+ ...props,
81
+ hideOnClick: hideOnClick,
82
+ store: dropdownMenuContext?.store
83
+ }, (0, _react.createElement)(Ariakit.MenuItemCheck, {
84
+ store: dropdownMenuContext?.store,
85
+ render: (0, _react.createElement)(Styled.ItemPrefixWrapper, null)
86
+ }, (0, _react.createElement)(_primitives.SVG, {
87
+ viewBox: "0 0 24 24",
88
+ xmlns: "http://www.w3.org/2000/svg"
89
+ }, (0, _react.createElement)(_primitives.Circle, {
90
+ cx: 12,
91
+ cy: 12,
92
+ r: 3,
93
+ fill: "currentColor"
94
+ }))), children, suffix);
95
+ });
96
+ exports.DropdownMenuRadioItem = DropdownMenuRadioItem;
97
+ const DropdownMenuGroup = (0, _element.forwardRef)(function DropdownMenuGroup(props, ref) {
98
+ const dropdownMenuContext = (0, _element.useContext)(DropdownMenuContext);
99
+ return (0, _react.createElement)(Styled.DropdownMenuGroup, {
100
+ ref: ref,
101
+ ...props,
102
+ store: dropdownMenuContext?.store
103
+ });
104
+ });
105
+ exports.DropdownMenuGroup = DropdownMenuGroup;
106
+ const DropdownMenuGroupLabel = (0, _element.forwardRef)(function DropdownMenuGroupLabel(props, ref) {
107
+ const dropdownMenuContext = (0, _element.useContext)(DropdownMenuContext);
108
+ return (0, _react.createElement)(Styled.DropdownMenuGroupLabel, {
109
+ ref: ref,
110
+ ...props,
111
+ store: dropdownMenuContext?.store
112
+ });
113
+ });
114
+ exports.DropdownMenuGroupLabel = DropdownMenuGroupLabel;
115
+ const UnconnectedDropdownMenu = (props, ref) => {
116
+ var _props$placement, _trigger$props$suffix;
117
+ const {
118
+ // Store props
119
+ open,
120
+ defaultOpen = false,
121
+ onOpenChange,
122
+ placement,
123
+ // Menu trigger props
124
+ trigger,
125
+ // Menu props
126
+ gutter,
127
+ children,
128
+ shift,
129
+ modal = true,
130
+ hideOnEscape = true,
131
+ // From internal components context
132
+ variant,
133
+ // Rest
134
+ ...otherProps
135
+ } = (0, _context.useContextSystem)(props, 'DropdownMenu');
136
+ const parentContext = (0, _element.useContext)(DropdownMenuContext);
137
+ const computedDirection = (0, _i18n.isRTL)() ? 'rtl' : 'ltr';
138
+
139
+ // If an explicit value for the `placement` prop is not passed,
140
+ // apply a default placement of `bottom-start` for the root dropdown,
141
+ // and of `right-start` for nested dropdowns.
142
+ let computedPlacement = (_props$placement = props.placement) !== null && _props$placement !== void 0 ? _props$placement : parentContext?.store ? 'right-start' : 'bottom-start';
143
+ // Swap left/right in case of RTL direction
144
+ if (computedDirection === 'rtl') {
145
+ if (/right/.test(computedPlacement)) {
146
+ computedPlacement = computedPlacement.replace('right', 'left');
147
+ } else if (/left/.test(computedPlacement)) {
148
+ computedPlacement = computedPlacement.replace('left', 'right');
149
+ }
150
+ }
151
+ const dropdownMenuStore = Ariakit.useMenuStore({
152
+ parent: parentContext?.store,
153
+ open,
154
+ defaultOpen,
155
+ placement: computedPlacement,
156
+ focusLoop: true,
157
+ setOpen(willBeOpen) {
158
+ onOpenChange?.(willBeOpen);
159
+ },
160
+ rtl: computedDirection === 'rtl'
161
+ });
162
+ const contextValue = (0, _element.useMemo)(() => ({
163
+ store: dropdownMenuStore,
164
+ variant
165
+ }), [dropdownMenuStore, variant]);
166
+
167
+ // Extract the side from the applied placement — useful for animations.
168
+ const appliedPlacementSide = dropdownMenuStore.useState('placement').split('-')[0];
169
+ if (dropdownMenuStore.parent && !((0, _element.isValidElement)(trigger) && DropdownMenuItem === trigger.type)) {
170
+ // eslint-disable-next-line no-console
171
+ console.warn('For nested DropdownMenus, the `trigger` should always be a `DropdownMenuItem`.');
172
+ }
173
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(Ariakit.MenuButton, {
174
+ ref: ref,
175
+ store: dropdownMenuStore,
176
+ render: dropdownMenuStore.parent ? (0, _element.cloneElement)(trigger, {
177
+ // Add submenu arrow, unless a `suffix` is explicitly specified
178
+ suffix: (_trigger$props$suffix = trigger.props.suffix) !== null && _trigger$props$suffix !== void 0 ? _trigger$props$suffix : (0, _react.createElement)(Styled.SubmenuChevronIcon, {
179
+ "aria-hidden": "true",
180
+ icon: _icons.chevronRightSmall,
181
+ size: 24
182
+ })
183
+ }) : trigger
184
+ }), (0, _react.createElement)(Styled.DropdownMenu, {
185
+ ...otherProps,
186
+ modal: modal,
187
+ store: dropdownMenuStore,
188
+ gutter: gutter !== null && gutter !== void 0 ? gutter : dropdownMenuStore.parent ? 16 : 8,
189
+ shift: shift !== null && shift !== void 0 ? shift : dropdownMenuStore.parent ? -8 : 0,
190
+ hideOnHoverOutside: false,
191
+ "data-side": appliedPlacementSide,
192
+ variant: variant,
193
+ wrapperProps: {
194
+ dir: computedDirection,
195
+ style: {
196
+ direction: computedDirection
197
+ }
198
+ },
199
+ hideOnEscape: hideOnEscape,
200
+ unmountOnHide: true
201
+ }, (0, _react.createElement)(DropdownMenuContext.Provider, {
202
+ value: contextValue
203
+ }, children)));
204
+ };
205
+ const DropdownMenu = (0, _context.contextConnect)(UnconnectedDropdownMenu, 'DropdownMenu');
206
+ exports.DropdownMenu = DropdownMenu;
207
+ const DropdownMenuSeparator = (0, _element.forwardRef)(function DropdownMenuSeparator(props, ref) {
208
+ const dropdownMenuContext = (0, _element.useContext)(DropdownMenuContext);
209
+ return (0, _react.createElement)(Styled.DropdownMenuSeparator, {
210
+ ref: ref,
211
+ ...props,
212
+ store: dropdownMenuContext?.store,
213
+ variant: dropdownMenuContext?.variant
214
+ });
215
+ });
216
+ exports.DropdownMenuSeparator = DropdownMenuSeparator;
217
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_element","_i18n","_icons","_primitives","_context","_icon","_interopRequireDefault","Styled","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","DropdownMenuContext","createContext","undefined","exports","DropdownMenuItem","forwardRef","prefix","suffix","children","hideOnClick","props","ref","dropdownMenuContext","useContext","_react","createElement","store","ItemPrefixWrapper","ItemSuffixWrapper","DropdownMenuCheckboxItem","MenuItemCheck","render","icon","check","size","DropdownMenuRadioItem","SVG","viewBox","xmlns","Circle","cx","cy","r","fill","DropdownMenuGroup","DropdownMenuGroupLabel","UnconnectedDropdownMenu","_props$placement","_trigger$props$suffix","open","defaultOpen","onOpenChange","placement","trigger","gutter","shift","modal","hideOnEscape","variant","otherProps","useContextSystem","parentContext","computedDirection","isRTL","computedPlacement","test","replace","dropdownMenuStore","useMenuStore","parent","focusLoop","setOpen","willBeOpen","rtl","contextValue","useMemo","appliedPlacementSide","useState","split","isValidElement","type","console","warn","Fragment","MenuButton","cloneElement","SubmenuChevronIcon","chevronRightSmall","DropdownMenu","hideOnHoverOutside","wrapperProps","dir","style","direction","unmountOnHide","Provider","value","contextConnect","DropdownMenuSeparator"],"sources":["@wordpress/components/src/dropdown-menu-v2-ariakit/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n\tcloneElement,\n\tisValidElement,\n} from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\nimport { check, chevronRightSmall } from '@wordpress/icons';\nimport { SVG, Circle } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, contextConnect } from '../context';\nimport type { WordPressComponentProps } from '../context';\nimport Icon from '../icon';\nimport type {\n\tDropdownMenuContext as DropdownMenuContextType,\n\tDropdownMenuProps,\n\tDropdownMenuGroupProps,\n\tDropdownMenuGroupLabelProps,\n\tDropdownMenuItemProps,\n\tDropdownMenuCheckboxItemProps,\n\tDropdownMenuRadioItemProps,\n\tDropdownMenuSeparatorProps,\n} from './types';\nimport * as Styled from './styles';\n\nexport const DropdownMenuContext = createContext<\n\tDropdownMenuContextType | undefined\n>( undefined );\n\nexport const DropdownMenuItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< DropdownMenuItemProps, 'div', false >\n>( function DropdownMenuItem(\n\t{ prefix, suffix, children, hideOnClick = true, ...props },\n\tref\n) {\n\tconst dropdownMenuContext = useContext( DropdownMenuContext );\n\n\treturn (\n\t\t<Styled.DropdownMenuItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ dropdownMenuContext?.store }\n\t\t>\n\t\t\t{ prefix && (\n\t\t\t\t<Styled.ItemPrefixWrapper>{ prefix }</Styled.ItemPrefixWrapper>\n\t\t\t) }\n\t\t\t{ children }\n\t\t\t{ suffix && (\n\t\t\t\t<Styled.ItemSuffixWrapper>{ suffix }</Styled.ItemSuffixWrapper>\n\t\t\t) }\n\t\t</Styled.DropdownMenuItem>\n\t);\n} );\n\nexport const DropdownMenuCheckboxItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< DropdownMenuCheckboxItemProps, 'div', false >\n>( function DropdownMenuCheckboxItem(\n\t{ suffix, children, hideOnClick = false, ...props },\n\tref\n) {\n\tconst dropdownMenuContext = useContext( DropdownMenuContext );\n\n\treturn (\n\t\t<Styled.DropdownMenuCheckboxItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ dropdownMenuContext?.store }\n\t\t>\n\t\t\t<Ariakit.MenuItemCheck\n\t\t\t\tstore={ dropdownMenuContext?.store }\n\t\t\t\trender={ <Styled.ItemPrefixWrapper /> }\n\t\t\t>\n\t\t\t\t<Icon icon={ check } size={ 24 } />\n\t\t\t</Ariakit.MenuItemCheck>\n\n\t\t\t{ children }\n\t\t\t{ suffix && (\n\t\t\t\t<Styled.ItemSuffixWrapper>{ suffix }</Styled.ItemSuffixWrapper>\n\t\t\t) }\n\t\t</Styled.DropdownMenuCheckboxItem>\n\t);\n} );\n\nexport const DropdownMenuRadioItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< DropdownMenuRadioItemProps, 'div', false >\n>( function DropdownMenuRadioItem(\n\t{ suffix, children, hideOnClick = false, ...props },\n\tref\n) {\n\tconst dropdownMenuContext = useContext( DropdownMenuContext );\n\n\treturn (\n\t\t<Styled.DropdownMenuRadioItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ dropdownMenuContext?.store }\n\t\t>\n\t\t\t<Ariakit.MenuItemCheck\n\t\t\t\tstore={ dropdownMenuContext?.store }\n\t\t\t\trender={ <Styled.ItemPrefixWrapper /> }\n\t\t\t>\n\t\t\t\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t<Circle\n\t\t\t\t\t\tcx={ 12 }\n\t\t\t\t\t\tcy={ 12 }\n\t\t\t\t\t\tr={ 3 }\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t></Circle>\n\t\t\t\t</SVG>\n\t\t\t</Ariakit.MenuItemCheck>\n\t\t\t{ children }\n\t\t\t{ suffix }\n\t\t</Styled.DropdownMenuRadioItem>\n\t);\n} );\n\nexport const DropdownMenuGroup = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< DropdownMenuGroupProps, 'div', false >\n>( function DropdownMenuGroup( props, ref ) {\n\tconst dropdownMenuContext = useContext( DropdownMenuContext );\n\treturn (\n\t\t<Styled.DropdownMenuGroup\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tstore={ dropdownMenuContext?.store }\n\t\t/>\n\t);\n} );\n\nexport const DropdownMenuGroupLabel = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< DropdownMenuGroupLabelProps, 'div', false >\n>( function DropdownMenuGroupLabel( props, ref ) {\n\tconst dropdownMenuContext = useContext( DropdownMenuContext );\n\treturn (\n\t\t<Styled.DropdownMenuGroupLabel\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tstore={ dropdownMenuContext?.store }\n\t\t/>\n\t);\n} );\n\nconst UnconnectedDropdownMenu = (\n\tprops: WordPressComponentProps< DropdownMenuProps, 'div', false >,\n\tref: React.ForwardedRef< HTMLDivElement >\n) => {\n\tconst {\n\t\t// Store props\n\t\topen,\n\t\tdefaultOpen = false,\n\t\tonOpenChange,\n\t\tplacement,\n\n\t\t// Menu trigger props\n\t\ttrigger,\n\n\t\t// Menu props\n\t\tgutter,\n\t\tchildren,\n\t\tshift,\n\t\tmodal = true,\n\t\thideOnEscape = true,\n\n\t\t// From internal components context\n\t\tvariant,\n\n\t\t// Rest\n\t\t...otherProps\n\t} = useContextSystem<\n\t\ttypeof props & Pick< DropdownMenuContextType, 'variant' >\n\t>( props, 'DropdownMenu' );\n\n\tconst parentContext = useContext( DropdownMenuContext );\n\n\tconst computedDirection = isRTL() ? 'rtl' : 'ltr';\n\n\t// If an explicit value for the `placement` prop is not passed,\n\t// apply a default placement of `bottom-start` for the root dropdown,\n\t// and of `right-start` for nested dropdowns.\n\tlet computedPlacement =\n\t\tprops.placement ??\n\t\t( parentContext?.store ? 'right-start' : 'bottom-start' );\n\t// Swap left/right in case of RTL direction\n\tif ( computedDirection === 'rtl' ) {\n\t\tif ( /right/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'right',\n\t\t\t\t'left'\n\t\t\t) as typeof computedPlacement;\n\t\t} else if ( /left/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'left',\n\t\t\t\t'right'\n\t\t\t) as typeof computedPlacement;\n\t\t}\n\t}\n\n\tconst dropdownMenuStore = Ariakit.useMenuStore( {\n\t\tparent: parentContext?.store,\n\t\topen,\n\t\tdefaultOpen,\n\t\tplacement: computedPlacement,\n\t\tfocusLoop: true,\n\t\tsetOpen( willBeOpen ) {\n\t\t\tonOpenChange?.( willBeOpen );\n\t\t},\n\t\trtl: computedDirection === 'rtl',\n\t} );\n\n\tconst contextValue = useMemo(\n\t\t() => ( { store: dropdownMenuStore, variant } ),\n\t\t[ dropdownMenuStore, variant ]\n\t);\n\n\t// Extract the side from the applied placement — useful for animations.\n\tconst appliedPlacementSide = dropdownMenuStore\n\t\t.useState( 'placement' )\n\t\t.split( '-' )[ 0 ];\n\n\tif (\n\t\tdropdownMenuStore.parent &&\n\t\t! ( isValidElement( trigger ) && DropdownMenuItem === trigger.type )\n\t) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t'For nested DropdownMenus, the `trigger` should always be a `DropdownMenuItem`.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Menu trigger */ }\n\t\t\t<Ariakit.MenuButton\n\t\t\t\tref={ ref }\n\t\t\t\tstore={ dropdownMenuStore }\n\t\t\t\trender={\n\t\t\t\t\tdropdownMenuStore.parent\n\t\t\t\t\t\t? cloneElement( trigger, {\n\t\t\t\t\t\t\t\t// Add submenu arrow, unless a `suffix` is explicitly specified\n\t\t\t\t\t\t\t\tsuffix: trigger.props.suffix ?? (\n\t\t\t\t\t\t\t\t\t<Styled.SubmenuChevronIcon\n\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\ticon={ chevronRightSmall }\n\t\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t } )\n\t\t\t\t\t\t: trigger\n\t\t\t\t}\n\t\t\t/>\n\n\t\t\t{ /* Menu popover */ }\n\t\t\t<Styled.DropdownMenu\n\t\t\t\t{ ...otherProps }\n\t\t\t\tmodal={ modal }\n\t\t\t\tstore={ dropdownMenuStore }\n\t\t\t\tgutter={ gutter ?? ( dropdownMenuStore.parent ? 16 : 8 ) }\n\t\t\t\tshift={ shift ?? ( dropdownMenuStore.parent ? -8 : 0 ) }\n\t\t\t\thideOnHoverOutside={ false }\n\t\t\t\tdata-side={ appliedPlacementSide }\n\t\t\t\tvariant={ variant }\n\t\t\t\twrapperProps={ {\n\t\t\t\t\tdir: computedDirection,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tdirection: computedDirection,\n\t\t\t\t\t},\n\t\t\t\t} }\n\t\t\t\thideOnEscape={ hideOnEscape }\n\t\t\t\tunmountOnHide\n\t\t\t>\n\t\t\t\t<DropdownMenuContext.Provider value={ contextValue }>\n\t\t\t\t\t{ children }\n\t\t\t\t</DropdownMenuContext.Provider>\n\t\t\t</Styled.DropdownMenu>\n\t\t</>\n\t);\n};\nexport const DropdownMenu = contextConnect(\n\tUnconnectedDropdownMenu,\n\t'DropdownMenu'\n);\n\nexport const DropdownMenuSeparator = forwardRef<\n\tHTMLHRElement,\n\tWordPressComponentProps< DropdownMenuSeparatorProps, 'hr', false >\n>( function DropdownMenuSeparator( props, ref ) {\n\tconst dropdownMenuContext = useContext( DropdownMenuContext );\n\treturn (\n\t\t<Styled.DropdownMenuSeparator\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tstore={ dropdownMenuContext?.store }\n\t\t\tvariant={ dropdownMenuContext?.variant }\n\t\t/>\n\t);\n} );\n"],"mappings":";;;;;;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