@wordpress/components 25.9.1 → 25.11.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 (369) 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/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  60. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  61. package/build/tabs/context.js +16 -0
  62. package/build/tabs/context.js.map +1 -0
  63. package/build/tabs/index.js +147 -0
  64. package/build/tabs/index.js.map +1 -0
  65. package/build/tabs/styles.js +38 -0
  66. package/build/tabs/styles.js.map +1 -0
  67. package/build/tabs/tab.js +46 -0
  68. package/build/tabs/tab.js.map +1 -0
  69. package/build/tabs/tablist.js +47 -0
  70. package/build/tabs/tablist.js.map +1 -0
  71. package/build/tabs/tabpanel.js +48 -0
  72. package/build/tabs/tabpanel.js.map +1 -0
  73. package/build/tabs/types.js +6 -0
  74. package/build/tabs/types.js.map +1 -0
  75. package/build/text/component.js +7 -6
  76. package/build/text/component.js.map +1 -1
  77. package/build/text/hook.js +6 -15
  78. package/build/text/hook.js.map +1 -1
  79. package/build/text/index.js.map +1 -1
  80. package/build/text/styles.js +7 -7
  81. package/build/text/styles.js.map +1 -1
  82. package/build/text/types.js.map +1 -1
  83. package/build/text/utils.js +17 -33
  84. package/build/text/utils.js.map +1 -1
  85. package/build/toggle-group-control/toggle-group-control-option-base/component.js +1 -0
  86. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  87. package/build/toolbar/toolbar/index.js +17 -10
  88. package/build/toolbar/toolbar/index.js.map +1 -1
  89. package/build/toolbar/toolbar/types.js.map +1 -1
  90. package/build/tools-panel/tools-panel-item/hook.js +2 -2
  91. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  92. package/build/tools-panel/types.js.map +1 -1
  93. package/build/tooltip/index.js +2 -2
  94. package/build/tooltip/index.js.map +1 -1
  95. package/build/unit-control/utils.js +108 -0
  96. package/build/unit-control/utils.js.map +1 -1
  97. package/build/utils/unit-values.js +1 -1
  98. package/build/utils/unit-values.js.map +1 -1
  99. package/build-module/alignment-matrix-control/cell.js +7 -4
  100. package/build-module/alignment-matrix-control/cell.js.map +1 -1
  101. package/build-module/alignment-matrix-control/index.js +27 -43
  102. package/build-module/alignment-matrix-control/index.js.map +1 -1
  103. package/build-module/alignment-matrix-control/utils.js +29 -8
  104. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  105. package/build-module/autocomplete/index.js +104 -52
  106. package/build-module/autocomplete/index.js.map +1 -1
  107. package/build-module/circular-option-picker/circular-option-picker-option.js +20 -39
  108. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  109. package/build-module/circular-option-picker/circular-option-picker.js +10 -31
  110. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
  111. package/build-module/circular-option-picker/types.js.map +1 -1
  112. package/build-module/color-palette/index.js +7 -2
  113. package/build-module/color-palette/index.js.map +1 -1
  114. package/build-module/color-picker/component.js +13 -3
  115. package/build-module/color-picker/component.js.map +1 -1
  116. package/build-module/color-picker/picker.js +78 -2
  117. package/build-module/color-picker/picker.js.map +1 -1
  118. package/build-module/color-picker/styles.js +8 -8
  119. package/build-module/color-picker/styles.js.map +1 -1
  120. package/build-module/color-picker/types.js.map +1 -1
  121. package/build-module/composite/v2.js +15 -0
  122. package/build-module/composite/v2.js.map +1 -0
  123. package/build-module/confirm-dialog/component.js +72 -7
  124. package/build-module/confirm-dialog/component.js.map +1 -1
  125. package/build-module/confirm-dialog/types.js.map +1 -1
  126. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +13 -4
  127. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  128. package/build-module/dropdown-menu-v2-ariakit/index.js +199 -0
  129. package/build-module/dropdown-menu-v2-ariakit/index.js.map +1 -0
  130. package/build-module/dropdown-menu-v2-ariakit/styles.js +136 -0
  131. package/build-module/dropdown-menu-v2-ariakit/styles.js.map +1 -0
  132. package/build-module/dropdown-menu-v2-ariakit/types.js +2 -0
  133. package/build-module/dropdown-menu-v2-ariakit/types.js.map +1 -0
  134. package/build-module/font-size-picker/utils.js +1 -1
  135. package/build-module/font-size-picker/utils.js.map +1 -1
  136. package/build-module/input-control/styles/input-control-styles.js +23 -23
  137. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  138. package/build-module/mobile/global-styles-context/utils.native.js +2 -2
  139. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  140. package/build-module/modal/index.js +47 -18
  141. package/build-module/modal/index.js.map +1 -1
  142. package/build-module/palette-edit/index.js +4 -0
  143. package/build-module/palette-edit/index.js.map +1 -1
  144. package/build-module/popover/index.js +34 -6
  145. package/build-module/popover/index.js.map +1 -1
  146. package/build-module/private-apis.js +18 -2
  147. package/build-module/private-apis.js.map +1 -1
  148. package/build-module/progress-bar/styles.js +5 -5
  149. package/build-module/progress-bar/styles.js.map +1 -1
  150. package/build-module/sandbox/index.js +1 -1
  151. package/build-module/sandbox/index.js.map +1 -1
  152. package/build-module/sandbox/index.native.js +1 -1
  153. package/build-module/sandbox/index.native.js.map +1 -1
  154. package/build-module/select-control/styles/select-control-styles.js +8 -8
  155. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  156. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  157. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  158. package/build-module/tabs/context.js +12 -0
  159. package/build-module/tabs/context.js.map +1 -0
  160. package/build-module/tabs/index.js +142 -0
  161. package/build-module/tabs/index.js.map +1 -0
  162. package/build-module/tabs/styles.js +36 -0
  163. package/build-module/tabs/styles.js.map +1 -0
  164. package/build-module/tabs/tab.js +43 -0
  165. package/build-module/tabs/tab.js.map +1 -0
  166. package/build-module/tabs/tablist.js +41 -0
  167. package/build-module/tabs/tablist.js.map +1 -0
  168. package/build-module/tabs/tabpanel.js +43 -0
  169. package/build-module/tabs/tabpanel.js.map +1 -0
  170. package/build-module/tabs/types.js +2 -0
  171. package/build-module/tabs/types.js.map +1 -0
  172. package/build-module/text/component.js +6 -6
  173. package/build-module/text/component.js.map +1 -1
  174. package/build-module/text/hook.js +11 -19
  175. package/build-module/text/hook.js.map +1 -1
  176. package/build-module/text/index.js.map +1 -1
  177. package/build-module/text/styles.js +7 -7
  178. package/build-module/text/styles.js.map +1 -1
  179. package/build-module/text/types.js.map +1 -1
  180. package/build-module/text/utils.js +17 -10
  181. package/build-module/text/utils.js.map +1 -1
  182. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +1 -0
  183. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  184. package/build-module/toolbar/toolbar/index.js +18 -11
  185. package/build-module/toolbar/toolbar/index.js.map +1 -1
  186. package/build-module/toolbar/toolbar/types.js.map +1 -1
  187. package/build-module/tools-panel/tools-panel-item/hook.js +2 -2
  188. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  189. package/build-module/tools-panel/types.js.map +1 -1
  190. package/build-module/tooltip/index.js +2 -2
  191. package/build-module/tooltip/index.js.map +1 -1
  192. package/build-module/unit-control/utils.js +108 -0
  193. package/build-module/unit-control/utils.js.map +1 -1
  194. package/build-module/utils/unit-values.js +1 -1
  195. package/build-module/utils/unit-values.js.map +1 -1
  196. package/build-style/style-rtl.css +17 -5
  197. package/build-style/style.css +17 -5
  198. package/build-types/alignment-matrix-control/cell.d.ts +1 -1
  199. package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
  200. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  201. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  202. package/build-types/alignment-matrix-control/utils.d.ts +9 -9
  203. package/build-types/alignment-matrix-control/utils.d.ts.map +1 -1
  204. package/build-types/autocomplete/index.d.ts.map +1 -1
  205. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  206. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  207. package/build-types/circular-option-picker/types.d.ts +4 -6
  208. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  209. package/build-types/color-palette/index.d.ts.map +1 -1
  210. package/build-types/color-picker/component.d.ts.map +1 -1
  211. package/build-types/color-picker/picker.d.ts +1 -1
  212. package/build-types/color-picker/picker.d.ts.map +1 -1
  213. package/build-types/color-picker/styles.d.ts.map +1 -1
  214. package/build-types/color-picker/types.d.ts +3 -0
  215. package/build-types/color-picker/types.d.ts.map +1 -1
  216. package/build-types/composite/v2.d.ts +12 -0
  217. package/build-types/composite/v2.d.ts.map +1 -0
  218. package/build-types/confirm-dialog/component.d.ts +70 -29
  219. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  220. package/build-types/confirm-dialog/stories/index.story.d.ts +11 -0
  221. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -0
  222. package/build-types/confirm-dialog/test/index.d.ts +2 -0
  223. package/build-types/confirm-dialog/test/index.d.ts.map +1 -0
  224. package/build-types/confirm-dialog/types.d.ts +32 -10
  225. package/build-types/confirm-dialog/types.d.ts.map +1 -1
  226. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  227. package/build-types/dropdown-menu-v2-ariakit/index.d.ts +11 -0
  228. package/build-types/dropdown-menu-v2-ariakit/index.d.ts.map +1 -0
  229. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts +16 -0
  230. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts.map +1 -0
  231. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts +88 -0
  232. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts.map +1 -0
  233. package/build-types/dropdown-menu-v2-ariakit/test/index.d.ts +2 -0
  234. package/build-types/dropdown-menu-v2-ariakit/test/index.d.ts.map +1 -0
  235. package/build-types/dropdown-menu-v2-ariakit/types.d.ts +174 -0
  236. package/build-types/dropdown-menu-v2-ariakit/types.d.ts.map +1 -0
  237. package/build-types/font-size-picker/utils.d.ts.map +1 -1
  238. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  239. package/build-types/modal/index.d.ts.map +1 -1
  240. package/build-types/palette-edit/index.d.ts.map +1 -1
  241. package/build-types/popover/index.d.ts +1 -1
  242. package/build-types/popover/index.d.ts.map +1 -1
  243. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  244. package/build-types/private-apis.d.ts.map +1 -1
  245. package/build-types/progress-bar/styles.d.ts.map +1 -1
  246. package/build-types/sandbox/index.d.ts.map +1 -1
  247. package/build-types/tabs/context.d.ts +8 -0
  248. package/build-types/tabs/context.d.ts.map +1 -0
  249. package/build-types/tabs/index.d.ts +13 -0
  250. package/build-types/tabs/index.d.ts.map +1 -0
  251. package/build-types/tabs/stories/index.story.d.ts +20 -0
  252. package/build-types/tabs/stories/index.story.d.ts.map +1 -0
  253. package/build-types/tabs/styles.d.ts +17 -0
  254. package/build-types/tabs/styles.d.ts.map +1 -0
  255. package/build-types/tabs/tab.d.ts +10 -0
  256. package/build-types/tabs/tab.d.ts.map +1 -0
  257. package/build-types/tabs/tablist.d.ts +7 -0
  258. package/build-types/tabs/tablist.d.ts.map +1 -0
  259. package/build-types/tabs/tabpanel.d.ts +7 -0
  260. package/build-types/tabs/tabpanel.d.ts.map +1 -0
  261. package/build-types/tabs/test/index.d.ts +2 -0
  262. package/build-types/tabs/test/index.d.ts.map +1 -0
  263. package/build-types/tabs/types.d.ts +134 -0
  264. package/build-types/tabs/types.d.ts.map +1 -0
  265. package/build-types/text/component.d.ts +4 -2
  266. package/build-types/text/component.d.ts.map +1 -1
  267. package/build-types/text/hook.d.ts +171 -165
  268. package/build-types/text/hook.d.ts.map +1 -1
  269. package/build-types/text/index.d.ts +2 -2
  270. package/build-types/text/index.d.ts.map +1 -1
  271. package/build-types/text/stories/index.story.d.ts +21 -0
  272. package/build-types/text/stories/index.story.d.ts.map +1 -0
  273. package/build-types/text/styles.d.ts +7 -7
  274. package/build-types/text/styles.d.ts.map +1 -1
  275. package/build-types/text/types.d.ts +1 -1
  276. package/build-types/text/types.d.ts.map +1 -1
  277. package/build-types/text/utils.d.ts +56 -61
  278. package/build-types/text/utils.d.ts.map +1 -1
  279. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  280. package/build-types/toolbar/stories/index.story.d.ts +5 -0
  281. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  282. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  283. package/build-types/toolbar/toolbar/types.d.ts +10 -0
  284. package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
  285. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  286. package/build-types/tools-panel/types.d.ts +2 -0
  287. package/build-types/tools-panel/types.d.ts.map +1 -1
  288. package/build-types/tooltip/index.d.ts.map +1 -1
  289. package/build-types/unit-control/utils.d.ts.map +1 -1
  290. package/package.json +21 -20
  291. package/src/alignment-matrix-control/cell.tsx +6 -2
  292. package/src/alignment-matrix-control/index.tsx +31 -54
  293. package/src/alignment-matrix-control/stories/index.story.tsx +3 -7
  294. package/src/alignment-matrix-control/test/index.tsx +117 -18
  295. package/src/alignment-matrix-control/utils.tsx +33 -9
  296. package/src/autocomplete/index.tsx +136 -77
  297. package/src/button/style.scss +1 -2
  298. package/src/circular-option-picker/circular-option-picker-option.tsx +24 -38
  299. package/src/circular-option-picker/circular-option-picker.tsx +11 -28
  300. package/src/circular-option-picker/types.ts +6 -5
  301. package/src/color-palette/index.tsx +6 -1
  302. package/src/color-picker/component.tsx +25 -3
  303. package/src/color-picker/picker.tsx +96 -2
  304. package/src/color-picker/styles.ts +0 -1
  305. package/src/color-picker/types.ts +3 -0
  306. package/src/composite/v2.ts +22 -0
  307. package/src/confirm-dialog/README.md +1 -1
  308. package/src/confirm-dialog/component.tsx +79 -13
  309. package/src/confirm-dialog/stories/{index.story.js → index.story.tsx} +26 -24
  310. package/src/confirm-dialog/test/{index.js → index.tsx} +3 -3
  311. package/src/confirm-dialog/types.ts +32 -12
  312. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +32 -25
  313. package/src/dimension-control/test/__snapshots__/index.test.js.snap +8 -8
  314. package/src/dropdown-menu-v2-ariakit/README.md +324 -0
  315. package/src/dropdown-menu-v2-ariakit/index.tsx +318 -0
  316. package/src/dropdown-menu-v2-ariakit/stories/index.story.tsx +506 -0
  317. package/src/dropdown-menu-v2-ariakit/styles.ts +297 -0
  318. package/src/dropdown-menu-v2-ariakit/test/index.tsx +1139 -0
  319. package/src/dropdown-menu-v2-ariakit/types.ts +186 -0
  320. package/src/font-size-picker/utils.ts +2 -1
  321. package/src/heading/stories/index.story.tsx +2 -4
  322. package/src/input-control/styles/input-control-styles.tsx +2 -2
  323. package/src/mobile/global-styles-context/utils.native.js +2 -2
  324. package/src/modal/index.tsx +58 -22
  325. package/src/modal/test/index.tsx +29 -0
  326. package/src/notice/style.scss +0 -1
  327. package/src/palette-edit/index.tsx +4 -0
  328. package/src/popover/index.tsx +99 -57
  329. package/src/popover/style.scss +9 -0
  330. package/src/private-apis.ts +31 -1
  331. package/src/progress-bar/styles.ts +19 -4
  332. package/src/sandbox/index.native.js +1 -1
  333. package/src/sandbox/index.tsx +3 -1
  334. package/src/select-control/styles/select-control-styles.ts +2 -2
  335. package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +1 -1
  336. package/src/tabs/README.md +242 -0
  337. package/src/tabs/context.ts +13 -0
  338. package/src/tabs/index.tsx +167 -0
  339. package/src/tabs/stories/index.story.tsx +352 -0
  340. package/src/tabs/styles.ts +103 -0
  341. package/src/tabs/tab.tsx +39 -0
  342. package/src/tabs/tablist.tsx +40 -0
  343. package/src/tabs/tabpanel.tsx +42 -0
  344. package/src/tabs/test/index.tsx +1133 -0
  345. package/src/tabs/types.ts +142 -0
  346. package/src/text/README.md +2 -2
  347. package/src/text/{component.js → component.tsx} +10 -6
  348. package/src/text/{hook.js → hook.ts} +12 -15
  349. package/src/text/stories/index.story.tsx +80 -0
  350. package/src/text/types.ts +1 -6
  351. package/src/text/{utils.js → utils.ts} +40 -14
  352. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +16 -0
  353. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +1 -0
  354. package/src/toolbar/stories/index.story.tsx +15 -0
  355. package/src/toolbar/test/index.tsx +8 -0
  356. package/src/toolbar/toolbar/README.md +9 -0
  357. package/src/toolbar/toolbar/index.tsx +21 -12
  358. package/src/toolbar/toolbar/style.scss +9 -0
  359. package/src/toolbar/toolbar/types.ts +10 -0
  360. package/src/tools-panel/tools-panel/README.md +3 -0
  361. package/src/tools-panel/tools-panel-item/hook.ts +4 -6
  362. package/src/tools-panel/types.ts +2 -0
  363. package/src/tooltip/index.tsx +2 -3
  364. package/src/unit-control/utils.ts +124 -0
  365. package/src/utils/unit-values.ts +1 -1
  366. package/tsconfig.tsbuildinfo +1 -1
  367. package/src/text/stories/index.story.js +0 -53
  368. /package/src/text/{index.js → index.ts} +0 -0
  369. /package/src/text/{styles.js → styles.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","colord","useInstanceId","useEffect","useRef","useState","useMemo","__","sprintf","plus","Button","HStack","ColorPicker","VisuallyHidden","CustomColorPickerDropdown","addControlPoint","clampPercent","removeControlPoint","updateControlPointColor","updateControlPointColorByPosition","updateControlPointPosition","getHorizontalRelativeGradientPosition","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","createElement","Fragment","className","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","placement","offset","mergedClassName","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","onMouseMove","event","current","undefined","relativePosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","key","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","renderContent","enableAlpha","toRgbString","length","alignment","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","icon"],"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":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,QAAQ,QAAQ;;AAE/B;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,EAAEC,MAAM,EAA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,CAAC,MAAM;UACNG,uBAAuB,CAAE,KAAM,CAAC;UAChCJ,cAAc,CAAC,CAAC;QACjB;QACAjB,QAAQ,CAAC,CAAC;MACX,CAAG;MACH1C,SAAS,EAAC,0DAA0D;MACpEgE,IAAI,EAAGxF;IAAM,CACb,CACC;IACHyE,aAAa,EAAGA,CAAA,KACfnD,aAAA,CAACnB,WAAW;MACXuE,WAAW,EAAG,CAAEvC,YAAc;MAC9BK,QAAQ,EAAKtB,KAAK,IAAM;QACvB,IAAK,CAAEoE,oBAAoB,EAAG;UAC7B9C,QAAQ,CACPlC,eAAe,CACdiC,aAAa,EACb8C,cAAc,EACd7F,MAAM,CAAE0B,KAAM,CAAC,CAACyD,WAAW,CAAC,CAC7B,CACD,CAAC;UACDY,uBAAuB,CAAE,IAAK,CAAC;QAChC,CAAC,MAAM;UACN/C,QAAQ,CACP9B,iCAAiC,CAChC6B,aAAa,EACb8C,cAAc,EACd7F,MAAM,CAAE0B,KAAM,CAAC,CAACyD,WAAW,CAAC,CAC7B,CACD,CAAC;QACF;MACD;IAAG,CACH,CACC;IACHI,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAG,GAAGK,cAAgB,GAAE;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACDjC;EACH,CACD,CAAC;AAEJ;AACAf,aAAa,CAACiD,WAAW,GAAGA,WAAW;AAEvC,eAAejD,aAAa"}
1
+ {"version":3,"names":["classnames","colord","useInstanceId","useEffect","useRef","useState","useMemo","__","sprintf","plus","Button","HStack","ColorPicker","VisuallyHidden","CustomColorPickerDropdown","addControlPoint","clampPercent","removeControlPoint","updateControlPointColor","updateControlPointColorByPosition","updateControlPointPosition","getHorizontalRelativeGradientPosition","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","DropdownContentWrapper","ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","createElement","Fragment","className","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","placement","offset","resize","mergedClassName","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","onMouseMove","event","current","undefined","relativePosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","key","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","renderContent","paddingSize","enableAlpha","toRgbString","length","alignment","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","icon"],"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":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,QAAQ,QAAQ;;AAE/B;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,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AAgBgB,MAAQ;MACxB,iBAAc,MAAM;MACpBoD,OAAO,EAAGA,CAAA,KAAM;QACf,IAAKpD,MAAM,EAAG;UACbsE,eAAe,CAAC,CAAC;QAClB,CAAC,MAAM;UACNG,uBAAuB,CAAE,KAAM,CAAC;UAChCJ,cAAc,CAAC,CAAC;QACjB;QACAlB,QAAQ,CAAC,CAAC;MACX,CAAG;MACH3C,SAAS,EAAC,0DAA0D;MACpEkE,IAAI,EAAG3F;IAAM,CACb,CACC;IACH2E,aAAa,EAAGA,CAAA,KACfpD,aAAA,CAACR,sBAAsB;MAAC6D,WAAW,EAAC;IAAM,GACzCrD,aAAA,CAACpB,WAAW;MACX0E,WAAW,EAAG,CAAExC,YAAc;MAC9BK,QAAQ,EAAKvB,KAAK,IAAM;QACvB,IAAK,CAAEsE,oBAAoB,EAAG;UAC7B/C,QAAQ,CACPpC,eAAe,CACdmC,aAAa,EACb+C,cAAc,EACdhG,MAAM,CAAE2B,KAAM,CAAC,CAAC2D,WAAW,CAAC,CAC7B,CACD,CAAC;UACDY,uBAAuB,CAAE,IAAK,CAAC;QAChC,CAAC,MAAM;UACNhD,QAAQ,CACPhC,iCAAiC,CAChC+B,aAAa,EACb+C,cAAc,EACdhG,MAAM,CAAE2B,KAAM,CAAC,CAAC2D,WAAW,CAAC,CAC7B,CACD,CAAC;QACF;MACD;IAAG,CACH,CACsB,CACtB;IACHI,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAG,GAAGK,cAAgB,GAAE;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACDlC;EACH,CACD,CAAC;AAEJ;AACAf,aAAa,CAACkD,WAAW,GAAGA,WAAW;AAEvC,eAAelD,aAAa"}
@@ -0,0 +1,199 @@
1
+ import { createElement, Fragment } from "react";
2
+ /**
3
+ * External dependencies
4
+ */
5
+ // eslint-disable-next-line no-restricted-imports
6
+ import * as Ariakit from '@ariakit/react';
7
+
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+ import { forwardRef, createContext, useContext, useMemo, cloneElement, isValidElement } from '@wordpress/element';
12
+ import { isRTL } from '@wordpress/i18n';
13
+ import { check, chevronRightSmall } from '@wordpress/icons';
14
+ import { SVG, Circle } from '@wordpress/primitives';
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+ import { useContextSystem, contextConnect } from '../context';
20
+ import Icon from '../icon';
21
+ import * as Styled from './styles';
22
+ export const DropdownMenuContext = createContext(undefined);
23
+ export const DropdownMenuItem = forwardRef(function DropdownMenuItem({
24
+ prefix,
25
+ suffix,
26
+ children,
27
+ hideOnClick = true,
28
+ ...props
29
+ }, ref) {
30
+ const dropdownMenuContext = useContext(DropdownMenuContext);
31
+ return createElement(Styled.DropdownMenuItem, {
32
+ ref: ref,
33
+ ...props,
34
+ hideOnClick: hideOnClick,
35
+ store: dropdownMenuContext?.store
36
+ }, prefix && createElement(Styled.ItemPrefixWrapper, null, prefix), children, suffix && createElement(Styled.ItemSuffixWrapper, null, suffix));
37
+ });
38
+ export const DropdownMenuCheckboxItem = forwardRef(function DropdownMenuCheckboxItem({
39
+ suffix,
40
+ children,
41
+ hideOnClick = false,
42
+ ...props
43
+ }, ref) {
44
+ const dropdownMenuContext = useContext(DropdownMenuContext);
45
+ return createElement(Styled.DropdownMenuCheckboxItem, {
46
+ ref: ref,
47
+ ...props,
48
+ hideOnClick: hideOnClick,
49
+ store: dropdownMenuContext?.store
50
+ }, createElement(Ariakit.MenuItemCheck, {
51
+ store: dropdownMenuContext?.store,
52
+ render: createElement(Styled.ItemPrefixWrapper, null)
53
+ }, createElement(Icon, {
54
+ icon: check,
55
+ size: 24
56
+ })), children, suffix && createElement(Styled.ItemSuffixWrapper, null, suffix));
57
+ });
58
+ export const DropdownMenuRadioItem = forwardRef(function DropdownMenuRadioItem({
59
+ suffix,
60
+ children,
61
+ hideOnClick = false,
62
+ ...props
63
+ }, ref) {
64
+ const dropdownMenuContext = useContext(DropdownMenuContext);
65
+ return createElement(Styled.DropdownMenuRadioItem, {
66
+ ref: ref,
67
+ ...props,
68
+ hideOnClick: hideOnClick,
69
+ store: dropdownMenuContext?.store
70
+ }, createElement(Ariakit.MenuItemCheck, {
71
+ store: dropdownMenuContext?.store,
72
+ render: createElement(Styled.ItemPrefixWrapper, null)
73
+ }, createElement(SVG, {
74
+ viewBox: "0 0 24 24",
75
+ xmlns: "http://www.w3.org/2000/svg"
76
+ }, createElement(Circle, {
77
+ cx: 12,
78
+ cy: 12,
79
+ r: 3,
80
+ fill: "currentColor"
81
+ }))), children, suffix);
82
+ });
83
+ export const DropdownMenuGroup = forwardRef(function DropdownMenuGroup(props, ref) {
84
+ const dropdownMenuContext = useContext(DropdownMenuContext);
85
+ return createElement(Styled.DropdownMenuGroup, {
86
+ ref: ref,
87
+ ...props,
88
+ store: dropdownMenuContext?.store
89
+ });
90
+ });
91
+ export const DropdownMenuGroupLabel = forwardRef(function DropdownMenuGroupLabel(props, ref) {
92
+ const dropdownMenuContext = useContext(DropdownMenuContext);
93
+ return createElement(Styled.DropdownMenuGroupLabel, {
94
+ ref: ref,
95
+ ...props,
96
+ store: dropdownMenuContext?.store
97
+ });
98
+ });
99
+ const UnconnectedDropdownMenu = (props, ref) => {
100
+ var _props$placement, _trigger$props$suffix;
101
+ const {
102
+ // Store props
103
+ open,
104
+ defaultOpen = false,
105
+ onOpenChange,
106
+ placement,
107
+ // Menu trigger props
108
+ trigger,
109
+ // Menu props
110
+ gutter,
111
+ children,
112
+ shift,
113
+ modal = true,
114
+ hideOnEscape = true,
115
+ // From internal components context
116
+ variant,
117
+ // Rest
118
+ ...otherProps
119
+ } = useContextSystem(props, 'DropdownMenu');
120
+ const parentContext = useContext(DropdownMenuContext);
121
+ const computedDirection = isRTL() ? 'rtl' : 'ltr';
122
+
123
+ // If an explicit value for the `placement` prop is not passed,
124
+ // apply a default placement of `bottom-start` for the root dropdown,
125
+ // and of `right-start` for nested dropdowns.
126
+ let computedPlacement = (_props$placement = props.placement) !== null && _props$placement !== void 0 ? _props$placement : parentContext?.store ? 'right-start' : 'bottom-start';
127
+ // Swap left/right in case of RTL direction
128
+ if (computedDirection === 'rtl') {
129
+ if (/right/.test(computedPlacement)) {
130
+ computedPlacement = computedPlacement.replace('right', 'left');
131
+ } else if (/left/.test(computedPlacement)) {
132
+ computedPlacement = computedPlacement.replace('left', 'right');
133
+ }
134
+ }
135
+ const dropdownMenuStore = Ariakit.useMenuStore({
136
+ parent: parentContext?.store,
137
+ open,
138
+ defaultOpen,
139
+ placement: computedPlacement,
140
+ focusLoop: true,
141
+ setOpen(willBeOpen) {
142
+ onOpenChange?.(willBeOpen);
143
+ },
144
+ rtl: computedDirection === 'rtl'
145
+ });
146
+ const contextValue = useMemo(() => ({
147
+ store: dropdownMenuStore,
148
+ variant
149
+ }), [dropdownMenuStore, variant]);
150
+
151
+ // Extract the side from the applied placement — useful for animations.
152
+ const appliedPlacementSide = dropdownMenuStore.useState('placement').split('-')[0];
153
+ if (dropdownMenuStore.parent && !(isValidElement(trigger) && DropdownMenuItem === trigger.type)) {
154
+ // eslint-disable-next-line no-console
155
+ console.warn('For nested DropdownMenus, the `trigger` should always be a `DropdownMenuItem`.');
156
+ }
157
+ return createElement(Fragment, null, createElement(Ariakit.MenuButton, {
158
+ ref: ref,
159
+ store: dropdownMenuStore,
160
+ render: dropdownMenuStore.parent ? cloneElement(trigger, {
161
+ // Add submenu arrow, unless a `suffix` is explicitly specified
162
+ suffix: (_trigger$props$suffix = trigger.props.suffix) !== null && _trigger$props$suffix !== void 0 ? _trigger$props$suffix : createElement(Styled.SubmenuChevronIcon, {
163
+ "aria-hidden": "true",
164
+ icon: chevronRightSmall,
165
+ size: 24
166
+ })
167
+ }) : trigger
168
+ }), createElement(Styled.DropdownMenu, {
169
+ ...otherProps,
170
+ modal: modal,
171
+ store: dropdownMenuStore,
172
+ gutter: gutter !== null && gutter !== void 0 ? gutter : dropdownMenuStore.parent ? 16 : 8,
173
+ shift: shift !== null && shift !== void 0 ? shift : dropdownMenuStore.parent ? -8 : 0,
174
+ hideOnHoverOutside: false,
175
+ "data-side": appliedPlacementSide,
176
+ variant: variant,
177
+ wrapperProps: {
178
+ dir: computedDirection,
179
+ style: {
180
+ direction: computedDirection
181
+ }
182
+ },
183
+ hideOnEscape: hideOnEscape,
184
+ unmountOnHide: true
185
+ }, createElement(DropdownMenuContext.Provider, {
186
+ value: contextValue
187
+ }, children)));
188
+ };
189
+ export const DropdownMenu = contextConnect(UnconnectedDropdownMenu, 'DropdownMenu');
190
+ export const DropdownMenuSeparator = forwardRef(function DropdownMenuSeparator(props, ref) {
191
+ const dropdownMenuContext = useContext(DropdownMenuContext);
192
+ return createElement(Styled.DropdownMenuSeparator, {
193
+ ref: ref,
194
+ ...props,
195
+ store: dropdownMenuContext?.store,
196
+ variant: dropdownMenuContext?.variant
197
+ });
198
+ });
199
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Ariakit","forwardRef","createContext","useContext","useMemo","cloneElement","isValidElement","isRTL","check","chevronRightSmall","SVG","Circle","useContextSystem","contextConnect","Icon","Styled","DropdownMenuContext","undefined","DropdownMenuItem","prefix","suffix","children","hideOnClick","props","ref","dropdownMenuContext","createElement","store","ItemPrefixWrapper","ItemSuffixWrapper","DropdownMenuCheckboxItem","MenuItemCheck","render","icon","size","DropdownMenuRadioItem","viewBox","xmlns","cx","cy","r","fill","DropdownMenuGroup","DropdownMenuGroupLabel","UnconnectedDropdownMenu","_props$placement","_trigger$props$suffix","open","defaultOpen","onOpenChange","placement","trigger","gutter","shift","modal","hideOnEscape","variant","otherProps","parentContext","computedDirection","computedPlacement","test","replace","dropdownMenuStore","useMenuStore","parent","focusLoop","setOpen","willBeOpen","rtl","contextValue","appliedPlacementSide","useState","split","type","console","warn","Fragment","MenuButton","SubmenuChevronIcon","DropdownMenu","hideOnHoverOutside","wrapperProps","dir","style","direction","unmountOnHide","Provider","value","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":";AAAA;AACA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SACCC,UAAU,EACVC,aAAa,EACbC,UAAU,EACVC,OAAO,EACPC,YAAY,EACZC,cAAc,QACR,oBAAoB;AAC3B,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,KAAK,EAAEC,iBAAiB,QAAQ,kBAAkB;AAC3D,SAASC,GAAG,EAAEC,MAAM,QAAQ,uBAAuB;;AAEnD;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,YAAY;AAE7D,OAAOC,IAAI,MAAM,SAAS;AAW1B,OAAO,KAAKC,MAAM,MAAM,UAAU;AAElC,OAAO,MAAMC,mBAAmB,GAAGd,aAAa,CAE7Ce,SAAU,CAAC;AAEd,OAAO,MAAMC,gBAAgB,GAAGjB,UAAU,CAGvC,SAASiB,gBAAgBA,CAC3B;EAAEC,MAAM;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,WAAW,GAAG,IAAI;EAAE,GAAGC;AAAM,CAAC,EAC1DC,GAAG,EACF;EACD,MAAMC,mBAAmB,GAAGtB,UAAU,CAAEa,mBAAoB,CAAC;EAE7D,OACCU,aAAA,CAACX,MAAM,CAACG,gBAAgB;IACvBM,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVD,WAAW,EAAGA,WAAa;IAC3BK,KAAK,EAAGF,mBAAmB,EAAEE;EAAO,GAElCR,MAAM,IACPO,aAAA,CAACX,MAAM,CAACa,iBAAiB,QAAGT,MAAkC,CAC9D,EACCE,QAAQ,EACRD,MAAM,IACPM,aAAA,CAACX,MAAM,CAACc,iBAAiB,QAAGT,MAAkC,CAEvC,CAAC;AAE5B,CAAE,CAAC;AAE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