@wordpress/components 28.13.1-next.082ed6819.0 → 29.0.1-next.a9f418477.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 (586) hide show
  1. package/CHANGELOG.md +51 -2
  2. package/CONTRIBUTING.md +16 -16
  3. package/build/angle-picker-control/index.js +1 -1
  4. package/build/angle-picker-control/index.js.map +1 -1
  5. package/build/animation/index.js +0 -6
  6. package/build/animation/index.js.map +1 -1
  7. package/build/autocomplete/index.js +0 -1
  8. package/build/autocomplete/index.js.map +1 -1
  9. package/build/border-box-control/border-box-control-split-controls/component.js +1 -1
  10. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  11. package/build/border-control/border-control/component.js +2 -0
  12. package/build/border-control/border-control/component.js.map +1 -1
  13. package/build/box-control/all-input-control.js +1 -0
  14. package/build/box-control/all-input-control.js.map +1 -1
  15. package/build/box-control/axial-input-controls.js +1 -0
  16. package/build/box-control/axial-input-controls.js.map +1 -1
  17. package/build/box-control/index.js +22 -15
  18. package/build/box-control/index.js.map +1 -1
  19. package/build/box-control/input-controls.js +1 -0
  20. package/build/box-control/input-controls.js.map +1 -1
  21. package/build/box-control/types.js.map +1 -1
  22. package/build/circular-option-picker/circular-option-picker-actions.js +1 -0
  23. package/build/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  24. package/build/circular-option-picker/circular-option-picker-option.js +1 -0
  25. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  26. package/build/clipboard-button/index.js +5 -3
  27. package/build/clipboard-button/index.js.map +1 -1
  28. package/build/color-palette/index.native.js +0 -1
  29. package/build/color-palette/index.native.js.map +1 -1
  30. package/build/color-picker/input-with-slider.js +2 -2
  31. package/build/color-picker/input-with-slider.js.map +1 -1
  32. package/build/composite/item.js +0 -9
  33. package/build/composite/item.js.map +1 -1
  34. package/build/context/context-connect.js +0 -1
  35. package/build/context/context-connect.js.map +1 -1
  36. package/build/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  37. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  38. package/build/custom-gradient-picker/index.js +2 -0
  39. package/build/custom-gradient-picker/index.js.map +1 -1
  40. package/build/custom-gradient-picker/types.js.map +1 -1
  41. package/build/custom-select-control/index.js +8 -0
  42. package/build/custom-select-control/index.js.map +1 -1
  43. package/build/custom-select-control/types.js.map +1 -1
  44. package/build/drop-zone/index.js +19 -13
  45. package/build/drop-zone/index.js.map +1 -1
  46. package/build/drop-zone/types.js.map +1 -1
  47. package/build/dropdown-menu/index.js +1 -0
  48. package/build/dropdown-menu/index.js.map +1 -1
  49. package/build/duotone-picker/color-list-picker/index.js +9 -14
  50. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  51. package/build/external-link/index.js +0 -1
  52. package/build/external-link/index.js.map +1 -1
  53. package/build/font-size-picker/font-size-picker-select.js +1 -0
  54. package/build/font-size-picker/font-size-picker-select.js.map +1 -1
  55. package/build/font-size-picker/index.js +1 -0
  56. package/build/font-size-picker/index.js.map +1 -1
  57. package/build/form-file-upload/index.js +11 -1
  58. package/build/form-file-upload/index.js.map +1 -1
  59. package/build/form-file-upload/types.js.map +1 -1
  60. package/build/form-token-field/index.js +6 -1
  61. package/build/form-token-field/index.js.map +1 -1
  62. package/build/gradient-picker/index.js +2 -0
  63. package/build/gradient-picker/index.js.map +1 -1
  64. package/build/gradient-picker/types.js.map +1 -1
  65. package/build/icon/index.js +9 -0
  66. package/build/icon/index.js.map +1 -1
  67. package/build/index.js +0 -6
  68. package/build/index.js.map +1 -1
  69. package/build/menu/checkbox-item.js +5 -9
  70. package/build/menu/checkbox-item.js.map +1 -1
  71. package/build/menu/group-label.js +4 -1
  72. package/build/menu/group-label.js.map +1 -1
  73. package/build/menu/group.js +4 -1
  74. package/build/menu/group.js.map +1 -1
  75. package/build/menu/item-help-text.js +5 -0
  76. package/build/menu/item-help-text.js.map +1 -1
  77. package/build/menu/item-label.js +5 -0
  78. package/build/menu/item-label.js.map +1 -1
  79. package/build/menu/item.js +4 -8
  80. package/build/menu/item.js.map +1 -1
  81. package/build/menu/radio-item.js +5 -9
  82. package/build/menu/radio-item.js.map +1 -1
  83. package/build/menu/separator.js +5 -2
  84. package/build/menu/separator.js.map +1 -1
  85. package/build/modal/aria-helper.js +0 -1
  86. package/build/modal/aria-helper.js.map +1 -1
  87. package/build/modal/index.js +0 -1
  88. package/build/modal/index.js.map +1 -1
  89. package/build/number-control/index.js +8 -0
  90. package/build/number-control/index.js.map +1 -1
  91. package/build/number-control/types.js.map +1 -1
  92. package/build/range-control/index.js +2 -1
  93. package/build/range-control/index.js.map +1 -1
  94. package/build/range-control/mark.js +0 -1
  95. package/build/range-control/mark.js.map +1 -1
  96. package/build/range-control/styles/range-control-styles.js +33 -45
  97. package/build/range-control/styles/range-control-styles.js.map +1 -1
  98. package/build/resizable-box/index.js +9 -1
  99. package/build/resizable-box/index.js.map +1 -1
  100. package/build/slot-fill/bubbles-virtually/fill.js +8 -12
  101. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  102. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +6 -10
  103. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  104. package/build/slot-fill/bubbles-virtually/slot.js +4 -10
  105. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  106. package/build/slot-fill/types.js.map +1 -1
  107. package/build/style-provider/index.js +0 -1
  108. package/build/style-provider/index.js.map +1 -1
  109. package/build/tabs/tab.js +0 -17
  110. package/build/tabs/tab.js.map +1 -1
  111. package/build/toolbar/toolbar-button/index.js +2 -0
  112. package/build/toolbar/toolbar-button/index.js.map +1 -1
  113. package/build/tools-panel/tools-panel/component.js +2 -0
  114. package/build/tools-panel/tools-panel/component.js.map +1 -1
  115. package/build/tree-grid/cell.js +4 -1
  116. package/build/tree-grid/cell.js.map +1 -1
  117. package/build/tree-grid/types.js.map +1 -1
  118. package/build/unit-control/index.js +10 -1
  119. package/build/unit-control/index.js.map +1 -1
  120. package/build/unit-control/types.js.map +1 -1
  121. package/build-module/angle-picker-control/index.js +1 -1
  122. package/build-module/angle-picker-control/index.js.map +1 -1
  123. package/build-module/animation/index.js +1 -1
  124. package/build-module/animation/index.js.map +1 -1
  125. package/build-module/autocomplete/index.js +0 -1
  126. package/build-module/autocomplete/index.js.map +1 -1
  127. package/build-module/border-box-control/border-box-control-split-controls/component.js +1 -1
  128. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  129. package/build-module/border-control/border-control/component.js +2 -0
  130. package/build-module/border-control/border-control/component.js.map +1 -1
  131. package/build-module/box-control/all-input-control.js +1 -0
  132. package/build-module/box-control/all-input-control.js.map +1 -1
  133. package/build-module/box-control/axial-input-controls.js +1 -0
  134. package/build-module/box-control/axial-input-controls.js.map +1 -1
  135. package/build-module/box-control/index.js +22 -15
  136. package/build-module/box-control/index.js.map +1 -1
  137. package/build-module/box-control/input-controls.js +1 -0
  138. package/build-module/box-control/input-controls.js.map +1 -1
  139. package/build-module/box-control/types.js.map +1 -1
  140. package/build-module/circular-option-picker/circular-option-picker-actions.js +1 -0
  141. package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  142. package/build-module/circular-option-picker/circular-option-picker-option.js +1 -0
  143. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  144. package/build-module/clipboard-button/index.js +5 -3
  145. package/build-module/clipboard-button/index.js.map +1 -1
  146. package/build-module/color-palette/index.native.js +0 -1
  147. package/build-module/color-palette/index.native.js.map +1 -1
  148. package/build-module/color-picker/input-with-slider.js +2 -2
  149. package/build-module/color-picker/input-with-slider.js.map +1 -1
  150. package/build-module/composite/item.js +0 -9
  151. package/build-module/composite/item.js.map +1 -1
  152. package/build-module/context/context-connect.js +0 -1
  153. package/build-module/context/context-connect.js.map +1 -1
  154. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  155. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  156. package/build-module/custom-gradient-picker/index.js +2 -0
  157. package/build-module/custom-gradient-picker/index.js.map +1 -1
  158. package/build-module/custom-gradient-picker/types.js.map +1 -1
  159. package/build-module/custom-select-control/index.js +8 -0
  160. package/build-module/custom-select-control/index.js.map +1 -1
  161. package/build-module/custom-select-control/types.js.map +1 -1
  162. package/build-module/drop-zone/index.js +19 -13
  163. package/build-module/drop-zone/index.js.map +1 -1
  164. package/build-module/drop-zone/types.js.map +1 -1
  165. package/build-module/dropdown-menu/index.js +1 -0
  166. package/build-module/dropdown-menu/index.js.map +1 -1
  167. package/build-module/duotone-picker/color-list-picker/index.js +10 -15
  168. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  169. package/build-module/external-link/index.js +0 -1
  170. package/build-module/external-link/index.js.map +1 -1
  171. package/build-module/font-size-picker/font-size-picker-select.js +1 -0
  172. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
  173. package/build-module/font-size-picker/index.js +1 -0
  174. package/build-module/font-size-picker/index.js.map +1 -1
  175. package/build-module/form-file-upload/index.js +13 -2
  176. package/build-module/form-file-upload/index.js.map +1 -1
  177. package/build-module/form-file-upload/types.js.map +1 -1
  178. package/build-module/form-token-field/index.js +6 -1
  179. package/build-module/form-token-field/index.js.map +1 -1
  180. package/build-module/gradient-picker/index.js +2 -0
  181. package/build-module/gradient-picker/index.js.map +1 -1
  182. package/build-module/gradient-picker/types.js.map +1 -1
  183. package/build-module/icon/index.js +9 -0
  184. package/build-module/icon/index.js.map +1 -1
  185. package/build-module/index.js +1 -1
  186. package/build-module/index.js.map +1 -1
  187. package/build-module/menu/checkbox-item.js +5 -9
  188. package/build-module/menu/checkbox-item.js.map +1 -1
  189. package/build-module/menu/group-label.js +4 -1
  190. package/build-module/menu/group-label.js.map +1 -1
  191. package/build-module/menu/group.js +4 -1
  192. package/build-module/menu/group.js.map +1 -1
  193. package/build-module/menu/item-help-text.js +6 -1
  194. package/build-module/menu/item-help-text.js.map +1 -1
  195. package/build-module/menu/item-label.js +6 -1
  196. package/build-module/menu/item-label.js.map +1 -1
  197. package/build-module/menu/item.js +4 -8
  198. package/build-module/menu/item.js.map +1 -1
  199. package/build-module/menu/radio-item.js +5 -9
  200. package/build-module/menu/radio-item.js.map +1 -1
  201. package/build-module/menu/separator.js +5 -2
  202. package/build-module/menu/separator.js.map +1 -1
  203. package/build-module/modal/aria-helper.js +0 -1
  204. package/build-module/modal/aria-helper.js.map +1 -1
  205. package/build-module/modal/index.js +0 -1
  206. package/build-module/modal/index.js.map +1 -1
  207. package/build-module/number-control/index.js +8 -0
  208. package/build-module/number-control/index.js.map +1 -1
  209. package/build-module/number-control/types.js.map +1 -1
  210. package/build-module/range-control/index.js +2 -1
  211. package/build-module/range-control/index.js.map +1 -1
  212. package/build-module/range-control/mark.js +0 -1
  213. package/build-module/range-control/mark.js.map +1 -1
  214. package/build-module/range-control/styles/range-control-styles.js +33 -45
  215. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  216. package/build-module/resizable-box/index.js +9 -1
  217. package/build-module/resizable-box/index.js.map +1 -1
  218. package/build-module/slot-fill/bubbles-virtually/fill.js +9 -13
  219. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  220. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +6 -10
  221. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  222. package/build-module/slot-fill/bubbles-virtually/slot.js +4 -10
  223. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  224. package/build-module/slot-fill/types.js.map +1 -1
  225. package/build-module/style-provider/index.js +0 -1
  226. package/build-module/style-provider/index.js.map +1 -1
  227. package/build-module/tabs/tab.js +0 -15
  228. package/build-module/tabs/tab.js.map +1 -1
  229. package/build-module/toolbar/toolbar-button/index.js +2 -0
  230. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  231. package/build-module/tools-panel/tools-panel/component.js +2 -0
  232. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  233. package/build-module/tree-grid/cell.js +4 -1
  234. package/build-module/tree-grid/cell.js.map +1 -1
  235. package/build-module/tree-grid/types.js.map +1 -1
  236. package/build-module/unit-control/index.js +10 -1
  237. package/build-module/unit-control/index.js.map +1 -1
  238. package/build-module/unit-control/types.js.map +1 -1
  239. package/build-style/style-rtl.css +15 -11
  240. package/build-style/style.css +15 -11
  241. package/build-types/alignment-matrix-control/styles.d.ts.map +1 -1
  242. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
  243. package/build-types/animation/index.d.ts +1 -1
  244. package/build-types/animation/index.d.ts.map +1 -1
  245. package/build-types/base-control/hooks.d.ts +4 -4
  246. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  247. package/build-types/border-box-control/border-box-control/hook.d.ts +83 -83
  248. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +93 -93
  249. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +83 -83
  250. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +83 -83
  251. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  252. package/build-types/border-control/border-control/hook.d.ts +83 -83
  253. package/build-types/border-control/border-control-dropdown/hook.d.ts +83 -83
  254. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  255. package/build-types/box-control/all-input-control.d.ts.map +1 -1
  256. package/build-types/box-control/axial-input-controls.d.ts.map +1 -1
  257. package/build-types/box-control/index.d.ts +14 -13
  258. package/build-types/box-control/index.d.ts.map +1 -1
  259. package/build-types/box-control/input-controls.d.ts.map +1 -1
  260. package/build-types/box-control/stories/index.story.d.ts +852 -816
  261. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  262. package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -1
  263. package/build-types/box-control/styles/box-control-styles.d.ts +3 -2
  264. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  265. package/build-types/box-control/types.d.ts +16 -2
  266. package/build-types/box-control/types.d.ts.map +1 -1
  267. package/build-types/card/card/hook.d.ts +83 -83
  268. package/build-types/card/card-body/hook.d.ts +83 -83
  269. package/build-types/card/card-divider/hook.d.ts +84 -84
  270. package/build-types/card/card-footer/hook.d.ts +83 -83
  271. package/build-types/card/card-header/hook.d.ts +83 -83
  272. package/build-types/card/card-media/hook.d.ts +83 -83
  273. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  274. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  275. package/build-types/clipboard-button/index.d.ts.map +1 -1
  276. package/build-types/color-picker/styles.d.ts +3 -2
  277. package/build-types/color-picker/styles.d.ts.map +1 -1
  278. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  279. package/build-types/composite/index.d.ts.map +1 -1
  280. package/build-types/composite/item.d.ts.map +1 -1
  281. package/build-types/context/constants.d.ts.map +1 -1
  282. package/build-types/context/get-styled-class-name-from-key.d.ts +1 -9
  283. package/build-types/context/get-styled-class-name-from-key.d.ts.map +1 -1
  284. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  285. package/build-types/custom-gradient-picker/index.d.ts +1 -1
  286. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  287. package/build-types/custom-gradient-picker/types.d.ts +6 -0
  288. package/build-types/custom-gradient-picker/types.d.ts.map +1 -1
  289. package/build-types/custom-select-control/index.d.ts.map +1 -1
  290. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  291. package/build-types/custom-select-control/types.d.ts +7 -0
  292. package/build-types/custom-select-control/types.d.ts.map +1 -1
  293. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  294. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  295. package/build-types/date-time/date/styles.d.ts.map +1 -1
  296. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  297. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  298. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  299. package/build-types/date-time/time/styles.d.ts +8 -4
  300. package/build-types/date-time/time/styles.d.ts.map +1 -1
  301. package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
  302. package/build-types/drop-zone/index.d.ts +1 -1
  303. package/build-types/drop-zone/index.d.ts.map +1 -1
  304. package/build-types/drop-zone/types.d.ts +5 -0
  305. package/build-types/drop-zone/types.d.ts.map +1 -1
  306. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  307. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  308. package/build-types/elevation/hook.d.ts +83 -83
  309. package/build-types/flex/flex/hook.d.ts +83 -83
  310. package/build-types/flex/flex-block/hook.d.ts +83 -83
  311. package/build-types/flex/flex-item/hook.d.ts +83 -83
  312. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  313. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -1
  314. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
  315. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
  316. package/build-types/font-size-picker/index.d.ts.map +1 -1
  317. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  318. package/build-types/form-file-upload/index.d.ts +2 -1
  319. package/build-types/form-file-upload/index.d.ts.map +1 -1
  320. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  321. package/build-types/form-file-upload/types.d.ts +10 -8
  322. package/build-types/form-file-upload/types.d.ts.map +1 -1
  323. package/build-types/form-token-field/index.d.ts.map +1 -1
  324. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  325. package/build-types/gradient-picker/index.d.ts +1 -1
  326. package/build-types/gradient-picker/index.d.ts.map +1 -1
  327. package/build-types/gradient-picker/types.d.ts +6 -0
  328. package/build-types/gradient-picker/types.d.ts.map +1 -1
  329. package/build-types/grid/hook.d.ts +83 -83
  330. package/build-types/h-stack/hook.d.ts +83 -83
  331. package/build-types/heading/hook.d.ts +82 -82
  332. package/build-types/higher-order/with-fallback-styles/index.d.ts +2 -2
  333. package/build-types/higher-order/with-filters/index.d.ts +4 -4
  334. package/build-types/icon/index.d.ts +23 -7
  335. package/build-types/icon/index.d.ts.map +1 -1
  336. package/build-types/icon/stories/index.story.d.ts +7 -1
  337. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  338. package/build-types/index.d.ts +1 -1
  339. package/build-types/index.d.ts.map +1 -1
  340. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  341. package/build-types/item-group/item/hook.d.ts +83 -83
  342. package/build-types/item-group/item-group/hook.d.ts +83 -83
  343. package/build-types/lock-unlock.d.ts +2 -2
  344. package/build-types/menu/checkbox-item.d.ts.map +1 -1
  345. package/build-types/menu/group-label.d.ts.map +1 -1
  346. package/build-types/menu/group.d.ts.map +1 -1
  347. package/build-types/menu/index.d.ts.map +1 -1
  348. package/build-types/menu/item-help-text.d.ts.map +1 -1
  349. package/build-types/menu/item-label.d.ts.map +1 -1
  350. package/build-types/menu/item.d.ts.map +1 -1
  351. package/build-types/menu/radio-item.d.ts.map +1 -1
  352. package/build-types/menu/separator.d.ts.map +1 -1
  353. package/build-types/menu/styles.d.ts.map +1 -1
  354. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  355. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  356. package/build-types/navigator/navigator-back-button/hook.d.ts +92 -92
  357. package/build-types/navigator/navigator-button/hook.d.ts +92 -92
  358. package/build-types/number-control/index.d.ts +2 -1
  359. package/build-types/number-control/index.d.ts.map +1 -1
  360. package/build-types/number-control/stories/index.story.d.ts +2 -1
  361. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  362. package/build-types/number-control/types.d.ts +7 -0
  363. package/build-types/number-control/types.d.ts.map +1 -1
  364. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  365. package/build-types/progress-bar/styles.d.ts.map +1 -1
  366. package/build-types/range-control/index.d.ts +1 -1
  367. package/build-types/range-control/index.d.ts.map +1 -1
  368. package/build-types/range-control/mark.d.ts.map +1 -1
  369. package/build-types/range-control/styles/range-control-styles.d.ts +4 -3
  370. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  371. package/build-types/resizable-box/index.d.ts.map +1 -1
  372. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  373. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  374. package/build-types/scrollable/hook.d.ts +83 -83
  375. package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
  376. package/build-types/select-control/index.d.ts.map +1 -1
  377. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  378. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  379. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  380. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  381. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  382. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +1 -1
  383. package/build-types/slot-fill/types.d.ts +4 -3
  384. package/build-types/slot-fill/types.d.ts.map +1 -1
  385. package/build-types/spacer/hook.d.ts +83 -83
  386. package/build-types/spinner/styles.d.ts.map +1 -1
  387. package/build-types/surface/hook.d.ts +83 -83
  388. package/build-types/tabs/tab.d.ts +3 -0
  389. package/build-types/tabs/tab.d.ts.map +1 -1
  390. package/build-types/text/hook.d.ts +83 -83
  391. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  392. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  393. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  394. package/build-types/tools-panel/tools-panel/component.d.ts +2 -0
  395. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  396. package/build-types/tools-panel/tools-panel/hook.d.ts +83 -83
  397. package/build-types/tools-panel/tools-panel-header/hook.d.ts +83 -83
  398. package/build-types/tools-panel/tools-panel-item/hook.d.ts +83 -83
  399. package/build-types/tree-grid/cell.d.ts.map +1 -1
  400. package/build-types/tree-grid/types.d.ts +1 -1
  401. package/build-types/tree-grid/types.d.ts.map +1 -1
  402. package/build-types/truncate/hook.d.ts +83 -83
  403. package/build-types/unit-control/index.d.ts +3 -2
  404. package/build-types/unit-control/index.d.ts.map +1 -1
  405. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  406. package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -1
  407. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  408. package/build-types/unit-control/types.d.ts +7 -0
  409. package/build-types/unit-control/types.d.ts.map +1 -1
  410. package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
  411. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  412. package/build-types/utils/rtl.d.ts +1 -1
  413. package/build-types/utils/rtl.d.ts.map +1 -1
  414. package/build-types/v-stack/hook.d.ts +83 -83
  415. package/build-types/z-stack/styles.d.ts.map +1 -1
  416. package/package.json +20 -20
  417. package/src/alignment-matrix-control/stories/index.story.tsx +2 -2
  418. package/src/angle-picker-control/index.tsx +1 -1
  419. package/src/angle-picker-control/stories/index.story.tsx +2 -2
  420. package/src/animation/index.tsx +0 -1
  421. package/src/base-control/stories/index.story.tsx +1 -1
  422. package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -1
  423. package/src/border-box-control/stories/index.story.tsx +1 -1
  424. package/src/border-control/border-control/component.tsx +2 -0
  425. package/src/border-control/stories/index.story.tsx +1 -1
  426. package/src/box-control/README.md +80 -60
  427. package/src/box-control/all-input-control.tsx +1 -0
  428. package/src/box-control/axial-input-controls.tsx +1 -0
  429. package/src/box-control/docs-manifest.json +5 -0
  430. package/src/box-control/index.tsx +23 -15
  431. package/src/box-control/input-controls.tsx +1 -0
  432. package/src/box-control/stories/index.story.tsx +2 -1
  433. package/src/box-control/test/index.tsx +33 -26
  434. package/src/box-control/types.ts +71 -54
  435. package/src/button-group/stories/index.story.tsx +1 -1
  436. package/src/card/stories/index.story.tsx +2 -2
  437. package/src/checkbox-control/stories/index.story.tsx +1 -1
  438. package/src/circular-option-picker/circular-option-picker-actions.tsx +1 -0
  439. package/src/circular-option-picker/circular-option-picker-option.tsx +1 -0
  440. package/src/circular-option-picker/stories/index.story.tsx +2 -2
  441. package/src/circular-option-picker/style.scss +2 -2
  442. package/src/clipboard-button/index.tsx +5 -3
  443. package/src/color-palette/stories/index.story.tsx +3 -3
  444. package/src/color-picker/input-with-slider.tsx +1 -1
  445. package/src/color-picker/stories/index.story.tsx +2 -2
  446. package/src/combobox-control/stories/index.story.tsx +1 -1
  447. package/src/composite/item.tsx +1 -19
  448. package/src/composite/stories/index.story.tsx +3 -3
  449. package/src/confirm-dialog/stories/index.story.tsx +1 -1
  450. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +2 -0
  451. package/src/custom-gradient-picker/index.tsx +2 -0
  452. package/src/custom-gradient-picker/style.scss +1 -1
  453. package/src/custom-gradient-picker/types.ts +6 -0
  454. package/src/custom-select-control/README.md +2 -0
  455. package/src/custom-select-control/index.tsx +9 -0
  456. package/src/custom-select-control/stories/index.story.tsx +3 -2
  457. package/src/custom-select-control/test/index.tsx +13 -9
  458. package/src/custom-select-control/types.ts +7 -0
  459. package/src/custom-select-control-v2/stories/index.story.tsx +2 -2
  460. package/src/date-time/stories/date-time.story.tsx +4 -1
  461. package/src/date-time/stories/date.story.tsx +4 -1
  462. package/src/date-time/stories/time.story.tsx +4 -1
  463. package/src/dimension-control/stories/index.story.tsx +1 -1
  464. package/src/disabled/stories/index.story.tsx +3 -3
  465. package/src/divider/stories/index.story.tsx +1 -1
  466. package/src/draggable/stories/index.story.tsx +2 -2
  467. package/src/drop-zone/index.tsx +21 -24
  468. package/src/drop-zone/types.ts +5 -0
  469. package/src/dropdown/stories/index.story.tsx +7 -7
  470. package/src/dropdown-menu/index.tsx +4 -1
  471. package/src/dropdown-menu/stories/index.story.tsx +3 -3
  472. package/src/dropdown-menu/style.scss +1 -1
  473. package/src/duotone-picker/color-list-picker/index.tsx +8 -8
  474. package/src/duotone-picker/color-list-picker/style.scss +0 -6
  475. package/src/duotone-picker/stories/duotone-picker.story.tsx +1 -1
  476. package/src/flex/stories/index.story.tsx +1 -1
  477. package/src/font-size-picker/font-size-picker-select.tsx +1 -0
  478. package/src/font-size-picker/index.tsx +1 -0
  479. package/src/font-size-picker/stories/index.story.tsx +1 -1
  480. package/src/form-file-upload/README.md +58 -48
  481. package/src/form-file-upload/docs-manifest.json +5 -0
  482. package/src/form-file-upload/index.tsx +12 -1
  483. package/src/form-file-upload/stories/index.story.tsx +4 -3
  484. package/src/form-file-upload/test/index.tsx +5 -1
  485. package/src/form-file-upload/types.ts +10 -8
  486. package/src/form-token-field/README.md +1 -0
  487. package/src/form-token-field/index.tsx +7 -0
  488. package/src/form-token-field/stories/index.story.tsx +4 -2
  489. package/src/form-token-field/test/index.tsx +5 -1
  490. package/src/gradient-picker/README.md +8 -0
  491. package/src/gradient-picker/index.tsx +2 -0
  492. package/src/gradient-picker/stories/index.story.tsx +1 -1
  493. package/src/gradient-picker/types.ts +6 -0
  494. package/src/grid/stories/index.story.tsx +1 -1
  495. package/src/h-stack/stories/index.story.tsx +2 -2
  496. package/src/icon/README.md +22 -65
  497. package/src/icon/docs-manifest.json +5 -0
  498. package/src/icon/index.tsx +28 -13
  499. package/src/icon/stories/index.story.tsx +50 -8
  500. package/src/index.ts +1 -5
  501. package/src/input-control/stories/index.story.tsx +4 -4
  502. package/src/item-group/stories/index.story.tsx +2 -2
  503. package/src/menu/checkbox-item.tsx +9 -7
  504. package/src/menu/group-label.tsx +8 -1
  505. package/src/menu/group.tsx +8 -1
  506. package/src/menu/item-help-text.tsx +10 -1
  507. package/src/menu/item-label.tsx +10 -1
  508. package/src/menu/item.tsx +8 -6
  509. package/src/menu/radio-item.tsx +9 -7
  510. package/src/menu/separator.tsx +9 -2
  511. package/src/menu/stories/index.story.tsx +2 -2
  512. package/src/menu-group/stories/index.story.tsx +1 -1
  513. package/src/menu-item/stories/index.story.tsx +1 -1
  514. package/src/menu-items-choice/stories/index.story.tsx +1 -1
  515. package/src/menu-items-choice/style.scss +1 -0
  516. package/src/modal/stories/index.story.tsx +2 -2
  517. package/src/modal/test/index.tsx +2 -1
  518. package/src/navigable-container/stories/navigable-menu.story.tsx +1 -1
  519. package/src/navigable-container/stories/tabbable-container.story.tsx +1 -1
  520. package/src/navigation/stories/index.story.tsx +4 -4
  521. package/src/navigator/stories/index.story.tsx +3 -3
  522. package/src/number-control/README.md +2 -1
  523. package/src/number-control/index.tsx +9 -0
  524. package/src/number-control/stories/index.story.tsx +2 -1
  525. package/src/number-control/test/index.tsx +5 -1
  526. package/src/number-control/types.ts +7 -0
  527. package/src/panel/stories/index.story.tsx +1 -1
  528. package/src/placeholder/stories/index.story.tsx +3 -3
  529. package/src/popover/stories/index.story.tsx +11 -9
  530. package/src/query-controls/stories/index.story.tsx +6 -6
  531. package/src/radio-control/stories/index.story.tsx +1 -1
  532. package/src/radio-group/stories/index.story.tsx +3 -3
  533. package/src/range-control/index.tsx +1 -0
  534. package/src/range-control/mark.tsx +0 -1
  535. package/src/range-control/stories/index.story.tsx +7 -7
  536. package/src/range-control/styles/range-control-styles.ts +18 -19
  537. package/src/resizable-box/index.tsx +10 -0
  538. package/src/resizable-box/stories/index.story.tsx +1 -1
  539. package/src/resizable-box/style.scss +8 -0
  540. package/src/responsive-wrapper/stories/index.story.tsx +1 -1
  541. package/src/sandbox/stories/index.story.tsx +1 -1
  542. package/src/scrollable/stories/index.story.tsx +2 -1
  543. package/src/search-control/stories/index.story.tsx +1 -1
  544. package/src/select-control/stories/index.story.tsx +1 -1
  545. package/src/slot-fill/bubbles-virtually/fill.tsx +7 -11
  546. package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +2 -13
  547. package/src/slot-fill/bubbles-virtually/slot.tsx +4 -7
  548. package/src/slot-fill/stories/index.story.tsx +2 -2
  549. package/src/slot-fill/types.ts +4 -3
  550. package/src/snackbar/stories/index.story.tsx +4 -4
  551. package/src/snackbar/stories/list.story.tsx +2 -2
  552. package/src/surface/stories/index.story.tsx +1 -1
  553. package/src/tabs/tab.tsx +0 -18
  554. package/src/tabs/test/index.tsx +1492 -947
  555. package/src/text-control/stories/index.story.tsx +1 -1
  556. package/src/textarea-control/stories/index.story.tsx +1 -1
  557. package/src/theme/stories/index.story.tsx +1 -1
  558. package/src/toggle-control/stories/index.story.tsx +1 -1
  559. package/src/toggle-group-control/stories/index.story.tsx +1 -1
  560. package/src/toolbar/stories/index.story.tsx +1 -1
  561. package/src/toolbar/toolbar-button/index.tsx +2 -0
  562. package/src/tools-panel/stories/index.story.tsx +15 -3
  563. package/src/tools-panel/test/index.tsx +0 -17
  564. package/src/tools-panel/tools-panel/README.md +4 -0
  565. package/src/tools-panel/tools-panel/component.tsx +2 -0
  566. package/src/tooltip/stories/index.story.tsx +1 -1
  567. package/src/tree-grid/cell.tsx +5 -1
  568. package/src/tree-grid/stories/index.story.tsx +1 -1
  569. package/src/tree-grid/types.ts +1 -1
  570. package/src/tree-select/stories/index.story.tsx +1 -1
  571. package/src/unit-control/README.md +3 -3
  572. package/src/unit-control/index.tsx +11 -1
  573. package/src/unit-control/stories/index.story.tsx +5 -4
  574. package/src/unit-control/test/index.tsx +5 -1
  575. package/src/unit-control/types.ts +7 -0
  576. package/src/view/stories/index.story.tsx +1 -1
  577. package/src/visually-hidden/stories/index.story.tsx +1 -1
  578. package/src/z-stack/stories/index.story.tsx +1 -1
  579. package/tsconfig.tsbuildinfo +1 -1
  580. package/build/menu/use-temporary-focus-visible-fix.js +0 -27
  581. package/build/menu/use-temporary-focus-visible-fix.js.map +0 -1
  582. package/build-module/menu/use-temporary-focus-visible-fix.js +0 -20
  583. package/build-module/menu/use-temporary-focus-visible-fix.js.map +0 -1
  584. package/build-types/menu/use-temporary-focus-visible-fix.d.ts +0 -8
  585. package/build-types/menu/use-temporary-focus-visible-fix.d.ts.map +0 -1
  586. package/src/menu/use-temporary-focus-visible-fix.ts +0 -22
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_warning","_interopRequireDefault","_constants","_getStyledClassNameFromKey","contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","forwardRef","globalThis","SCRIPT_DEBUG","warn","mergedNamespace","CONNECT_STATIC_NAMESPACE","Array","isArray","Object","assign","Set","displayName","selector","getStyledClassNameFromKey","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"sources":["@wordpress/components/src/context/context-connect.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never,\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions,\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) {\n\t\treturn [];\n\t}\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,cAAcA,CAG7BC,SAIE,EACFC,SAAiB,EAChB;EACD,OAAOC,eAAe,CAAEF,SAAS,EAAEC,SAAS,EAAE;IAAEE,WAAW,EAAE;EAAK,CAAE,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACvCJ,SAA6C,EAC7CC,SAAi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nD;;EAEA;EACA,IAAKZ,SAAS,CAACuB,IAAI,IAAIvB,SAAS,CAACuB,IAAI,CAAEX,mCAAwB,CAAE,EAAG;IACnE;IACAU,UAAU,GAAGtB,SAAS,CAACuB,IAAI,CAAEX,mCAAwB,CAAE;EACxD;EAEA,OAAOU,UAAU;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAClCxB,SAAoB,EACpByB,KAAwB,EACd;EACV,IAAK,CAAEzB,SAAS,EAAG;IAClB,OAAO,KAAK;EACb;EAEA,IAAK,OAAOyB,KAAK,KAAK,QAAQ,EAAG;IAChC,OAAOJ,mBAAmB,CAAErB,SAAU,CAAC,CAAC0B,QAAQ,CAAED,KAAM,CAAC;EAC1D;EACA,IAAKZ,KAAK,CAACC,OAAO,CAAEW,KAAM,CAAC,EAAG;IAC7B,OAAOA,KAAK,CAACE,IAAI,CAAIC,MAAM,IAC1BP,mBAAmB,CAAErB,SAAU,CAAC,CAAC0B,QAAQ,CAAEE,MAAO,CACnD,CAAC;EACF;EAEA,OAAO,KAAK;AACb","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_warning","_interopRequireDefault","_constants","_getStyledClassNameFromKey","contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","forwardRef","globalThis","SCRIPT_DEBUG","warn","mergedNamespace","CONNECT_STATIC_NAMESPACE","Array","isArray","Object","assign","Set","displayName","selector","getStyledClassNameFromKey","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"sources":["@wordpress/components/src/context/context-connect.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never,\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions,\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) {\n\t\treturn [];\n\t}\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,cAAcA,CAG7BC,SAIE,EACFC,SAAiB,EAChB;EACD,OAAOC,eAAe,CAAEF,SAAS,EAAEC,SAAS,EAAE;IAAEE,WAAW,EAAE;EAAK,CAAE,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACvCJ,SAA6C,EAC7CC,SAAiB,EAChB;EACD,OAAOC,eAAe,CAAEF,SAAS,EAAEC,SAAU,CAAC;AAC/C;;AAEA;AACA;AACA;AACA,SAASC,eAAeA,CAIvBF,SAAY,EACZC,SAAiB,EACjBI,OAAW,EAIV;EACD,MAAMC,gBAAgB,GAAGD,OAAO,EAAEF,WAAW,GAC1C,IAAAI,mBAAU,EAA+BP,SAAU,CAAC,GACpDA,SAAS;EAEZ,IAAK,OAAOC,SAAS,KAAK,WAAW,EAAG;IACvCO,UAAA,CAAAC,YAAA,gBAAAC,gBAAI,EAAE,4CAA6C,CAAC;EACrD;;EAEA;EACA,IAAIC,eAAe,GAAGL,gBAAgB,CAAEM,mCAAwB,CAAE,IAAI,CACrEX,SAAS,CACT;;EAED;AACD;AACA;EACC,IAAKY,KAAK,CAACC,OAAO,CAAEb,SAAU,CAAC,EAAG;IACjCU,eAAe,GAAG,CAAE,GAAGA,eAAe,EAAE,GAAGV,SAAS,CAAE;EACvD;EACA,IAAK,OAAOA,SAAS,KAAK,QAAQ,E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AAO,CACnD,CAAC;EACF;EAEA,OAAO,KAAK;AACb","ignoreList":[]}
@@ -48,6 +48,7 @@ function ControlPointButton({
48
48
  "aria-describedby": descriptionId,
49
49
  "aria-haspopup": "true",
50
50
  "aria-expanded": isOpen,
51
+ __next40pxDefaultSize: true,
51
52
  className: (0, _clsx.default)('components-custom-gradient-picker__control-point-button', {
52
53
  'is-active': isOpen
53
54
  }),
@@ -228,6 +229,7 @@ function InsertPoint({
228
229
  isOpen,
229
230
  onToggle
230
231
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
232
+ __next40pxDefaultSize: true,
231
233
  "aria-expanded": isOpen,
232
234
  "aria-haspopup": "true",
233
235
  onClick: () => {
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_colord","_compose","_element","_i18n","_icons","_button","_hStack","_colorPicker","_visuallyHidden","_colorPalette","_utils","_constants","_dropdownContentWrapper","_jsxRuntime","ControlPointButton","isOpen","position","color","additionalProps","instanceId","useInstanceId","descriptionId","jsxs","Fragment","children","jsx","default","sprintf","__","className","clsx","VisuallyHidden","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","useMemo","placement","offset","resize","mergedClassName","CustomColorPickerDropdown","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveStateRef","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","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 clsx from 'clsx';\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: gradient position e.g: 70. 2: 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={ clsx(\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 = clsx(\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 controlPointMoveStateRef = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.current &&\n\t\t\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.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,KAAA,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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;IAAC,CACqB,CACtB;IACHM,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAE,GAAIK,cAAc,GAAI;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACD5C;EACH,CACD,CAAC;AAEJ;AACAhB,aAAa,CAAC6D,WAAW,GAAGA,WAAW;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAA1F,OAAA,GAEzBiB,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_colord","_compose","_element","_i18n","_icons","_button","_hStack","_colorPicker","_visuallyHidden","_colorPalette","_utils","_constants","_dropdownContentWrapper","_jsxRuntime","ControlPointButton","isOpen","position","color","additionalProps","instanceId","useInstanceId","descriptionId","jsxs","Fragment","children","jsx","default","sprintf","__","__next40pxDefaultSize","className","clsx","VisuallyHidden","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","useMemo","placement","offset","resize","mergedClassName","CustomColorPickerDropdown","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveStateRef","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","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 clsx from 'clsx';\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: gradient position e.g: 70. 2: 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\t__next40pxDefaultSize\n\t\t\t\tclassName={ clsx(\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 = clsx(\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 controlPointMoveStateRef = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.current &&\n\t\t\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.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\tcontrolPointMoveStateRef.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\t__next40pxDefaultSize\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,KAAA,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;AAYA,IAAAa,uBAAA,GAAAd,sBAAA,CAAAC,OAAA;AAA6E,IAAAc,WAAA,GAAAd,O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IK,cAAc,GAAI;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACD5C;EACH,CACD,CAAC;AAEJ;AACAhB,aAAa,CAAC6D,WAAW,GAAGA,WAAW;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAA3F,OAAA,GAEzBkB,aAAa","ignoreList":[]}
@@ -119,6 +119,7 @@ const GradientTypePicker = ({
119
119
  function CustomGradientPicker({
120
120
  value,
121
121
  onChange,
122
+ enableAlpha = true,
122
123
  __experimentalIsRenderedInSidebar = false
123
124
  }) {
124
125
  const {
@@ -147,6 +148,7 @@ function CustomGradientPicker({
147
148
  className: "components-custom-gradient-picker",
148
149
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_gradientBar.default, {
149
150
  __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
151
+ disableAlpha: !enableAlpha,
150
152
  background: background,
151
153
  hasGradient: hasGradient,
152
154
  value: controlPoints,
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_anglePickerControl","_interopRequireDefault","_gradientBar","_flex","_selectControl","_vStack","_utils","_serializer","_constants","_customGradientPickerStyles","_jsxRuntime","GradientAnglePicker","gradientAST","hasGradient","onChange","_gradientAST$orientat","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","serializeGradient","type","jsx","default","GradientTypePicker","onSetLinearGradient","undefined","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","__nextHasNoMarginBottom","className","label","__","labelPosition","options","GRADIENT_OPTIONS","size","CustomGradientPicker","__experimentalIsRenderedInSidebar","getGradientAstWithDefault","background","getLinearGradientRepresentation","controlPoints","colorStops","map","colorStop","color","getStopCssColor","position","parseInt","length","jsxs","VStack","spacing","children","newControlPoints","getGradientAstWithControlPoints","Flex","gap","SelectWrapper","AccessoryWrapper","_default","exports"],"sources":["@wordpress/components/src/custom-gradient-picker/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { type LinearGradientNode } from 'gradient-parser';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\nimport type {\n\tCustomGradientPickerProps,\n\tGradientAnglePickerProps,\n\tGradientTypePickerProps,\n} from './types';\n\nconst GradientAnglePicker = ( {\n\tgradientAST,\n\thasGradient,\n\tonChange,\n}: GradientAnglePickerProps ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle: number ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: `${ newAngle }`,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\tonChange={ onAngleChange }\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( {\n\tgradientAST,\n\thasGradient,\n\tonChange,\n}: GradientTypePickerProps ) => {\n\tconst { type } = gradientAST;\n\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: gradientAST.orientation\n\t\t\t\t\t? undefined\n\t\t\t\t\t: HORIZONTAL_GRADIENT_ORIENTATION,\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} satisfies LinearGradientNode )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next: string ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient ? type : undefined }\n\t\t/>\n\t);\n};\n\n/**\n * CustomGradientPicker is a React component that renders a UI for specifying\n * linear or radial gradients. Radial gradients are displayed in the picker as\n * a slice of the gradient from the center to the outside.\n *\n * ```jsx\n * import { CustomGradientPicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyCustomGradientPicker = () => {\n * const [ gradient, setGradient ] = useState();\n *\n * return (\n * <CustomGradientPicker\n *\t\t\tvalue={ gradient }\n *\t\t\tonChange={ setGradient }\n * />\n * );\n * };\n * ```\n */\nexport function CustomGradientPicker( {\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar = false,\n}: CustomGradientPickerProps ) {\n\tconst { gradientAST, hasGradient } = getGradientAstWithDefault( value );\n\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => {\n\t\treturn {\n\t\t\tcolor: getStopCssColor( colorStop ),\n\t\t\t// Although it's already been checked by `hasUnsupportedLength` in `getGradientAstWithDefault`,\n\t\t\t// TypeScript doesn't know that `colorStop.length` is not undefined here.\n\t\t\t// @ts-expect-error\n\t\t\tposition: parseInt( colorStop.length.value ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<VStack spacing={ 4 } className=\"components-custom-gradient-picker\">\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\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\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasG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AAA,EAACE,kBAAkB;UAClBd,WAAW,EAAGA,WAAa;UAC3BC,WAAW,EAAGA,WAAa;UAC3BC,QAAQ,EAAGA;QAAU,CACrB;MAAC,CACY,CAAC,eAChB,IAAAJ,WAAA,CAAAc,GAAA,EAACf,2BAAA,CAAAwD,gBAAgB;QAAAN,QAAA,EACd/C,WAAW,CAACW,IAAI,KAAK,iBAAiB,iBACvC,IAAAb,WAAA,CAAAc,GAAA,EAACb,mBAAmB;UACnBC,WAAW,EAAGA,WAAa;UAC3BC,WAAW,EAAGA,WAAa;UAC3BC,QAAQ,EAAGA;QAAU,CACrB;MACD,CACgB,CAAC;IAAA,CACd,CAAC;EAAA,CACA,CAAC;AAEX;AAAC,IAAAoD,QAAA,GAAAC,OAAA,CAAA1C,OAAA,GAEciB,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_anglePickerControl","_interopRequireDefault","_gradientBar","_flex","_selectControl","_vStack","_utils","_serializer","_constants","_customGradientPickerStyles","_jsxRuntime","GradientAnglePicker","gradientAST","hasGradient","onChange","_gradientAST$orientat","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","serializeGradient","type","jsx","default","GradientTypePicker","onSetLinearGradient","undefined","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","__nextHasNoMarginBottom","className","label","__","labelPosition","options","GRADIENT_OPTIONS","size","CustomGradientPicker","enableAlpha","__experimentalIsRenderedInSidebar","getGradientAstWithDefault","background","getLinearGradientRepresentation","controlPoints","colorStops","map","colorStop","color","getStopCssColor","position","parseInt","length","jsxs","VStack","spacing","children","disableAlpha","newControlPoints","getGradientAstWithControlPoints","Flex","gap","SelectWrapper","AccessoryWrapper","_default","exports"],"sources":["@wordpress/components/src/custom-gradient-picker/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { type LinearGradientNode } from 'gradient-parser';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\nimport type {\n\tCustomGradientPickerProps,\n\tGradientAnglePickerProps,\n\tGradientTypePickerProps,\n} from './types';\n\nconst GradientAnglePicker = ( {\n\tgradientAST,\n\thasGradient,\n\tonChange,\n}: GradientAnglePickerProps ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle: number ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: `${ newAngle }`,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\tonChange={ onAngleChange }\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( {\n\tgradientAST,\n\thasGradient,\n\tonChange,\n}: GradientTypePickerProps ) => {\n\tconst { type } = gradientAST;\n\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: gradientAST.orientation\n\t\t\t\t\t? undefined\n\t\t\t\t\t: HORIZONTAL_GRADIENT_ORIENTATION,\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} satisfies LinearGradientNode )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next: string ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient ? type : undefined }\n\t\t/>\n\t);\n};\n\n/**\n * CustomGradientPicker is a React component that renders a UI for specifying\n * linear or radial gradients. Radial gradients are displayed in the picker as\n * a slice of the gradient from the center to the outside.\n *\n * ```jsx\n * import { CustomGradientPicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyCustomGradientPicker = () => {\n * const [ gradient, setGradient ] = useState();\n *\n * return (\n * <CustomGradientPicker\n *\t\t\tvalue={ gradient }\n *\t\t\tonChange={ setGradient }\n * />\n * );\n * };\n * ```\n */\nexport function CustomGradientPicker( {\n\tvalue,\n\tonChange,\n\tenableAlpha = true,\n\t__experimentalIsRenderedInSidebar = false,\n}: CustomGradientPickerProps ) {\n\tconst { gradientAST, hasGradient } = getGradientAstWithDefault( value );\n\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => {\n\t\treturn {\n\t\t\tcolor: getStopCssColor( colorStop ),\n\t\t\t// Although it's already been checked by `hasUnsupportedLength` in `getGradientAstWithDefault`,\n\t\t\t// TypeScript doesn't know that `colorStop.length` is not undefined here.\n\t\t\t// @ts-expect-error\n\t\t\tposition: parseInt( colorStop.length.value ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<VStack spacing={ 4 } className=\"components-custom-gradient-picker\">\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tdisableAlpha={ ! enableAlpha }\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\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\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasGradient }\n\t\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D,aAAa;QAAAN,QAAA,eACb,IAAAlD,WAAA,CAAAc,GAAA,EAACE,kBAAkB;UAClBd,WAAW,EAAGA,WAAa;UAC3BC,WAAW,EAAGA,WAAa;UAC3BC,QAAQ,EAAGA;QAAU,CACrB;MAAC,CACY,CAAC,eAChB,IAAAJ,WAAA,CAAAc,GAAA,EAACf,2BAAA,CAAA0D,gBAAgB;QAAAP,QAAA,EACdhD,WAAW,CAACW,IAAI,KAAK,iBAAiB,iBACvC,IAAAb,WAAA,CAAAc,GAAA,EAACb,mBAAmB;UACnBC,WAAW,EAAGA,WAAa;UAC3BC,WAAW,EAAGA,WAAa;UAC3BC,QAAQ,EAAGA;QAAU,CACrB;MACD,CACgB,CAAC;IAAA,CACd,CAAC;EAAA,CACA,CAAC;AAEX;AAAC,IAAAsD,QAAA,GAAAC,OAAA,CAAA5C,OAAA,GAEciB,oBAAoB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/custom-gradient-picker/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type gradientParser from 'gradient-parser';\n\nexport type CustomGradientPickerProps = {\n\t/**\n\t * Start opting in to the new margin-free styles that will become the default\n\t * in a future version, currently scheduled to be WordPress 6.4. (The prop\n\t * can be safely removed once this happens.)\n\t *\n\t * @default false\n\t * @deprecated Default behavior since WP 6.5. Prop can be safely removed.\n\t * @ignore\n\t */\n\t__nextHasNoMargin?: boolean;\n\t/**\n\t * The current value of the gradient. Pass a css gradient string (See default value for example).\n\t * Optionally pass in a `null` value to specify no gradient is currently selected.\n\t *\n\t * @default 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'\n\t */\n\tvalue?: string | null;\n\t/**\n\t * The function called when a new gradient has been defined. It is passed to\n\t * the `currentGradient` as an argument.\n\t */\n\tonChange: ( currentGradient: string ) => void;\n\t/**\n\t * Whether this is rendered in the sidebar.\n\t *\n\t * @default false\n\t */\n\t__experimentalIsRenderedInSidebar?: boolean;\n};\n\nexport type GradientAnglePickerProps = {\n\tgradientAST:\n\t\t| gradientParser.LinearGradientNode\n\t\t| gradientParser.RepeatingLinearGradientNode;\n\thasGradient: boolean;\n\tonChange: ( gradient: string ) => void;\n};\n\nexport type GradientTypePickerProps = {\n\tgradientAST: gradientParser.GradientNode;\n\thasGradient: boolean;\n\tonChange: ( gradient: string ) => void;\n};\n\nexport type ControlPoint = { color: string; position: number };\n\nexport type CustomGradientBarProps = {\n\tbackground: React.CSSProperties[ 'background' ];\n\thasGradient: boolean;\n\tvalue: ControlPoint[];\n\tonChange: ( newControlPoints: ControlPoint[] ) => void;\n\tdisableInserter?: boolean;\n\tdisableAlpha?: boolean;\n\t__experimentalIsRenderedInSidebar?: boolean;\n};\n\nexport type CustomGradientBarIdleState = { id: 'IDLE' };\ntype CustomGradientBarMovingInserterState = {\n\tid: 'MOVING_INSERTER';\n\tinsertPosition: number;\n};\ntype CustomGradientBarInsertingControlPointState = {\n\tid: 'INSERTING_CONTROL_POINT';\n\tinsertPosition: number;\n};\ntype CustomGradientBarMovingControlPointState = { id: 'MOVING_CONTROL_POINT' };\n\nexport type CustomGradientBarReducerState =\n\t| CustomGradientBarIdleState\n\t| CustomGradientBarMovingInserterState\n\t| CustomGradientBarInsertingControlPointState\n\t| CustomGradientBarMovingControlPointState;\n\nexport type CustomGradientBarReducerAction =\n\t| { type: 'MOVE_INSERTER'; insertPosition: number }\n\t| { type: 'STOP_INSERTER_MOVE' }\n\t| { type: 'OPEN_INSERTER' }\n\t| { type: 'CLOSE_INSERTER' }\n\t| { type: 'START_CONTROL_CHANGE' }\n\t| { type: 'STOP_CONTROL_CHANGE' };\n\nexport type ControlPointButtonProps = {\n\tisOpen: boolean;\n\tposition: ControlPoint[ 'position' ];\n\tcolor: string;\n};\n\nexport type ControlPointsProps = {\n\tdisableRemove: boolean;\n\tdisableAlpha: boolean;\n\tgradientPickerDomRef: React.RefObject< HTMLDivElement >;\n\tignoreMarkerPosition?: number;\n\tvalue: ControlPoint[];\n\tonChange: ( controlPoints: ControlPoint[] ) => void;\n\tonStartControlPointChange: () => void;\n\tonStopControlPointChange: () => void;\n\t__experimentalIsRenderedInSidebar: boolean;\n};\n\nexport type ControlPointMoveState = {\n\tinitialPosition: number;\n\tindex: number;\n\tsignificantMoveHappened: boolean;\n\tlistenersActivated: boolean;\n};\n\nexport type InsertPointProps = {\n\tvalue: ControlPoint[];\n\tonChange: ( controlPoints: ControlPoint[] ) => void;\n\tonOpenInserter: () => void;\n\tonCloseInserter: () => void;\n\tinsertPosition: number;\n\tdisableAlpha: boolean;\n\t__experimentalIsRenderedInSidebar: boolean;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/custom-gradient-picker/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type gradientParser from 'gradient-parser';\n\nexport type CustomGradientPickerProps = {\n\t/**\n\t * Start opting in to the new margin-free styles that will become the default\n\t * in a future version, currently scheduled to be WordPress 6.4. (The prop\n\t * can be safely removed once this happens.)\n\t *\n\t * @default false\n\t * @deprecated Default behavior since WP 6.5. Prop can be safely removed.\n\t * @ignore\n\t */\n\t__nextHasNoMargin?: boolean;\n\t/**\n\t * The current value of the gradient. Pass a css gradient string (See default value for example).\n\t * Optionally pass in a `null` value to specify no gradient is currently selected.\n\t *\n\t * @default 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'\n\t */\n\tvalue?: string | null;\n\t/**\n\t * The function called when a new gradient has been defined. It is passed to\n\t * the `currentGradient` as an argument.\n\t */\n\tonChange: ( currentGradient: string ) => void;\n\t/**\n\t * Whether to enable alpha transparency options in the picker.\n\t *\n\t * @default true\n\t */\n\tenableAlpha?: boolean;\n\t/**\n\t * Whether this is rendered in the sidebar.\n\t *\n\t * @default false\n\t */\n\t__experimentalIsRenderedInSidebar?: boolean;\n};\n\nexport type GradientAnglePickerProps = {\n\tgradientAST:\n\t\t| gradientParser.LinearGradientNode\n\t\t| gradientParser.RepeatingLinearGradientNode;\n\thasGradient: boolean;\n\tonChange: ( gradient: string ) => void;\n};\n\nexport type GradientTypePickerProps = {\n\tgradientAST: gradientParser.GradientNode;\n\thasGradient: boolean;\n\tonChange: ( gradient: string ) => void;\n};\n\nexport type ControlPoint = { color: string; position: number };\n\nexport type CustomGradientBarProps = {\n\tbackground: React.CSSProperties[ 'background' ];\n\thasGradient: boolean;\n\tvalue: ControlPoint[];\n\tonChange: ( newControlPoints: ControlPoint[] ) => void;\n\tdisableInserter?: boolean;\n\tdisableAlpha?: boolean;\n\t__experimentalIsRenderedInSidebar?: boolean;\n};\n\nexport type CustomGradientBarIdleState = { id: 'IDLE' };\ntype CustomGradientBarMovingInserterState = {\n\tid: 'MOVING_INSERTER';\n\tinsertPosition: number;\n};\ntype CustomGradientBarInsertingControlPointState = {\n\tid: 'INSERTING_CONTROL_POINT';\n\tinsertPosition: number;\n};\ntype CustomGradientBarMovingControlPointState = { id: 'MOVING_CONTROL_POINT' };\n\nexport type CustomGradientBarReducerState =\n\t| CustomGradientBarIdleState\n\t| CustomGradientBarMovingInserterState\n\t| CustomGradientBarInsertingControlPointState\n\t| CustomGradientBarMovingControlPointState;\n\nexport type CustomGradientBarReducerAction =\n\t| { type: 'MOVE_INSERTER'; insertPosition: number }\n\t| { type: 'STOP_INSERTER_MOVE' }\n\t| { type: 'OPEN_INSERTER' }\n\t| { type: 'CLOSE_INSERTER' }\n\t| { type: 'START_CONTROL_CHANGE' }\n\t| { type: 'STOP_CONTROL_CHANGE' };\n\nexport type ControlPointButtonProps = {\n\tisOpen: boolean;\n\tposition: ControlPoint[ 'position' ];\n\tcolor: string;\n};\n\nexport type ControlPointsProps = {\n\tdisableRemove: boolean;\n\tdisableAlpha: boolean;\n\tgradientPickerDomRef: React.RefObject< HTMLDivElement >;\n\tignoreMarkerPosition?: number;\n\tvalue: ControlPoint[];\n\tonChange: ( controlPoints: ControlPoint[] ) => void;\n\tonStartControlPointChange: () => void;\n\tonStopControlPointChange: () => void;\n\t__experimentalIsRenderedInSidebar: boolean;\n};\n\nexport type ControlPointMoveState = {\n\tinitialPosition: number;\n\tindex: number;\n\tsignificantMoveHappened: boolean;\n\tlistenersActivated: boolean;\n};\n\nexport type InsertPointProps = {\n\tvalue: ControlPoint[];\n\tonChange: ( controlPoints: ControlPoint[] ) => void;\n\tonOpenInserter: () => void;\n\tonCloseInserter: () => void;\n\tinsertPosition: number;\n\tdisableAlpha: boolean;\n\t__experimentalIsRenderedInSidebar: boolean;\n};\n"],"mappings":"","ignoreList":[]}
@@ -13,6 +13,7 @@ var _customSelect = _interopRequireDefault(require("../custom-select-control-v2/
13
13
  var _item = _interopRequireDefault(require("../custom-select-control-v2/item"));
14
14
  var Styled = _interopRequireWildcard(require("../custom-select-control-v2/styles"));
15
15
  var _visuallyHidden = require("../visually-hidden");
16
+ var _deprecated36pxSize = require("../utils/deprecated-36px-size");
16
17
  var _jsxRuntime = require("react/jsx-runtime");
17
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -61,6 +62,7 @@ function getDescribedBy(currentValue, describedBy) {
61
62
  function CustomSelectControl(props) {
62
63
  const {
63
64
  __next40pxDefaultSize = false,
65
+ __shouldNotWarnDeprecated36pxSize,
64
66
  describedBy,
65
67
  options,
66
68
  onChange,
@@ -70,6 +72,12 @@ function CustomSelectControl(props) {
70
72
  showSelectedHint = false,
71
73
  ...restProps
72
74
  } = useDeprecatedProps(props);
75
+ (0, _deprecated36pxSize.maybeWarnDeprecated36pxSize)({
76
+ componentName: 'CustomSelectControl',
77
+ __next40pxDefaultSize,
78
+ size,
79
+ __shouldNotWarnDeprecated36pxSize
80
+ });
73
81
  const descriptionId = (0, _compose.useInstanceId)(CustomSelectControl, 'custom-select-control__description');
74
82
 
75
83
  // Forward props + store from v2 implementation
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_clsx","_interopRequireDefault","_compose","_i18n","_customSelect","_item","Styled","_visuallyHidden","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useDeprecatedProps","__experimentalShowSelectedHint","otherProps","showSelectedHint","applyOptionDeprecations","__experimentalHint","rest","hint","getDescribedBy","currentValue","describedBy","sprintf","__","CustomSelectControl","props","__next40pxDefaultSize","options","onChange","size","value","className","classNameProp","restProps","descriptionId","useInstanceId","store","useSelectStore","setValue","nextValue","nextOption","find","item","name","Promise","resolve","state","getState","changeObject","highlightedIndex","renderedItems","findIndex","inputValue","isOpen","open","selectedItem","type","defaultValue","children","map","key","style","withHint","jsxs","WithHintItemWrapper","jsx","WithHintItemHint","clsx","renderSelectedValueHint","selectedOptionHint","SelectedExperimentalHintWrapper","SelectedExperimentalHintItem","translatedSize","Fragment","renderSelectedValue","undefined","isLegacy","VisuallyHidden","id","_default","exports"],"sources":["@wordpress/components/src/custom-select-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport _CustomSelect from '../custom-select-control-v2/custom-select';\nimport CustomSelectItem from '../custom-select-control-v2/item';\nimport * as Styled from '../custom-select-control-v2/styles';\nimport type { CustomSelectProps, CustomSelectOption } from './types';\nimport { VisuallyHidden } from '../visually-hidden';\n\nfunction useDeprecatedProps< T extends CustomSelectOption >( {\n\t__experimentalShowSelectedHint,\n\t...otherProps\n}: CustomSelectProps< T > ) {\n\treturn {\n\t\tshowSelectedHint: __experimentalShowSelectedHint,\n\t\t...otherProps,\n\t};\n}\n\n// The removal of `__experimentalHint` in favour of `hint` doesn't happen in\n// the `useDeprecatedProps` hook in order not to break consumers that rely\n// on object identity (see https://github.com/WordPress/gutenberg/pull/63248#discussion_r1672213131)\nfunction applyOptionDeprecations( {\n\t__experimentalHint,\n\t...rest\n}: CustomSelectOption ) {\n\treturn {\n\t\thint: __experimentalHint,\n\t\t...rest,\n\t};\n}\n\nfunction getDescribedBy( currentValue: string, describedBy?: string ) {\n\tif ( describedBy ) {\n\t\treturn describedBy;\n\t}\n\n\t// translators: %s: The selected option.\n\treturn sprintf( __( 'Currently selected: %s' ), currentValue );\n}\n\nfunction CustomSelectControl< T extends CustomSelectOption >(\n\tprops: CustomSelectProps< T >\n) {\n\tconst {\n\t\t__next40pxDefaultSize = false,\n\t\tdescribedBy,\n\t\toptions,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tvalue,\n\t\tclassName: classNameProp,\n\t\tshowSelectedHint = false,\n\t\t...restProps\n\t} = useDeprecatedProps( props );\n\n\tconst descriptionId = useInstanceId(\n\t\tCustomSelectControl,\n\t\t'custom-select-control__description'\n\t);\n\n\t// Forward props + store from v2 implementation\n\tconst store = Ariakit.useSelectStore< string >( {\n\t\tasync setValue( nextValue ) {\n\t\t\tconst nextOption = options.find(\n\t\t\t\t( item ) => item.name === nextValue\n\t\t\t);\n\n\t\t\tif ( ! onChange || ! nextOption ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Executes the logic in a microtask after the popup is closed.\n\t\t\t// This is simply to ensure the isOpen state matches the one from the\n\t\t\t// previous legacy implementation.\n\t\t\tawait Promise.resolve();\n\t\t\tconst state = store.getState();\n\n\t\t\tconst changeObject = {\n\t\t\t\thighlightedIndex: state.renderedItems.findIndex(\n\t\t\t\t\t( item ) => item.value === nextValue\n\t\t\t\t),\n\t\t\t\tinputValue: '',\n\t\t\t\tisOpen: state.open,\n\t\t\t\tselectedItem: nextOption,\n\t\t\t\ttype: '',\n\t\t\t};\n\t\t\tonChange( changeObject );\n\t\t},\n\t\tvalue: value?.name,\n\t\t// Setting the first option as a default value when no value is provided\n\t\t// is already done natively by the underlying Ariakit component,\n\t\t// but doing this explicitly avoids the `onChange` callback from firing\n\t\t// on initial render, thus making this implementation closer to the v1.\n\t\tdefaultValue: options[ 0 ]?.name,\n\t} );\n\n\tconst children = options\n\t\t.map( applyOptionDeprecations )\n\t\t.map( ( { name, key, hint, style, className } ) => {\n\t\t\tconst withHint = (\n\t\t\t\t<Styled.WithHintItemWrapper>\n\t\t\t\t\t<span>{ name }</span>\n\t\t\t\t\t<Styled.WithHintItemHint\n\t\t\t\t\t\t// Keeping the classname for legacy reasons\n\t\t\t\t\t\tclassName=\"components-custom-select-control__item-hint\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ hint }\n\t\t\t\t\t</Styled.WithHintItemHint>\n\t\t\t\t</Styled.WithHintItemWrapper>\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<CustomSelectItem\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvalue={ name }\n\t\t\t\t\tchildren={ hint ? withHint : name }\n\t\t\t\t\tstyle={ style }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t// Keeping the classnames for legacy reasons\n\t\t\t\t\t\t'components-custom-select-control__item',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-hint': hint,\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\n\tconst { value: currentValue } = store.getState();\n\n\tconst renderSelectedValueHint = () => {\n\t\tconst selectedOptionHint = options\n\t\t\t?.map( applyOptionDeprecations )\n\t\t\t?.find( ( { name } ) => currentValue === name )?.hint;\n\n\t\treturn (\n\t\t\t<Styled.SelectedExperimentalHintWrapper>\n\t\t\t\t{ currentValue }\n\t\t\t\t{ selectedOptionHint && (\n\t\t\t\t\t<Styled.SelectedExperimentalHintItem\n\t\t\t\t\t\t// Keeping the classname for legacy reasons\n\t\t\t\t\t\tclassName=\"components-custom-select-control__hint\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ selectedOptionHint }\n\t\t\t\t\t</Styled.SelectedExperimentalHintItem>\n\t\t\t\t) }\n\t\t\t</Styled.SelectedExperimentalHintWrapper>\n\t\t);\n\t};\n\n\tconst translatedSize = ( () => {\n\t\tif (\n\t\t\t( __next40pxDefaultSize && size === 'default' ) ||\n\t\t\tsize === '__unstable-large'\n\t\t) {\n\t\t\treturn 'default';\n\t\t}\n\t\tif ( ! __next40pxDefaultSize && size === 'default' ) {\n\t\t\treturn 'compact';\n\t\t}\n\t\treturn size;\n\t} )();\n\n\treturn (\n\t\t<>\n\t\t\t<_CustomSelect\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\trenderSelectedValue={\n\t\t\t\t\tshowSelectedHint ? renderSelectedValueHint : undefined\n\t\t\t\t}\n\t\t\t\tsize={ translatedSize }\n\t\t\t\tstore={ store }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t// Keeping the classname for legacy reasons\n\t\t\t\t\t'components-custom-select-control',\n\t\t\t\t\tclassNameProp\n\t\t\t\t) }\n\t\t\t\tisLegacy\n\t\t\t\t{ ...restProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</_CustomSelect>\n\t\t\t<VisuallyHidden>\n\t\t\t\t<span id={ descriptionId }>\n\t\t\t\t\t{ getDescribedBy( currentValue, describedBy ) }\n\t\t\t\t</span>\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nexport default CustomSelectControl;\n"],"mappings":";;;;;;;AAG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E,WAAA,CAAAmF,QAAA;IAAAf,QAAA,gBACC,IAAApE,WAAA,CAAA2E,GAAA,EAAC/E,aAAA,CAAAW,OAAa;MACb,oBAAmBqC,aAAe;MAClCwC,mBAAmB,EAClB5D,gBAAgB,GAAGsD,uBAAuB,GAAGO,SAC7C;MACD9C,IAAI,EAAG2C,cAAgB;MACvBpC,KAAK,EAAGA,KAAO;MACfL,SAAS,EAAG,IAAAoC,aAAI;MACf;MACA,kCAAkC,EAClCnC,aACD,CAAG;MACH4C,QAAQ;MAAA,GACH3C,SAAS;MAAAyB,QAAA,EAEZA;IAAQ,CACI,CAAC,eAChB,IAAApE,WAAA,CAAA2E,GAAA,EAAC5E,eAAA,CAAAwF,cAAc;MAAAnB,QAAA,eACd,IAAApE,WAAA,CAAA2E,GAAA;QAAMa,EAAE,EAAG5C,aAAe;QAAAwB,QAAA,EACvBvC,cAAc,CAAEC,YAAY,EAAEC,WAAY;MAAC,CACxC;IAAC,CACQ,CAAC;EAAA,CAChB,CAAC;AAEL;AAAC,IAAA0D,QAAA,GAAAC,OAAA,CAAAnF,OAAA,GAEc2B,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_clsx","_interopRequireDefault","_compose","_i18n","_customSelect","_item","Styled","_visuallyHidden","_deprecated36pxSize","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useDeprecatedProps","__experimentalShowSelectedHint","otherProps","showSelectedHint","applyOptionDeprecations","__experimentalHint","rest","hint","getDescribedBy","currentValue","describedBy","sprintf","__","CustomSelectControl","props","__next40pxDefaultSize","__shouldNotWarnDeprecated36pxSize","options","onChange","size","value","className","classNameProp","restProps","maybeWarnDeprecated36pxSize","componentName","descriptionId","useInstanceId","store","useSelectStore","setValue","nextValue","nextOption","find","item","name","Promise","resolve","state","getState","changeObject","highlightedIndex","renderedItems","findIndex","inputValue","isOpen","open","selectedItem","type","defaultValue","children","map","key","style","withHint","jsxs","WithHintItemWrapper","jsx","WithHintItemHint","clsx","renderSelectedValueHint","selectedOptionHint","SelectedExperimentalHintWrapper","SelectedExperimentalHintItem","translatedSize","Fragment","renderSelectedValue","undefined","isLegacy","VisuallyHidden","id","_default","exports"],"sources":["@wordpress/components/src/custom-select-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport _CustomSelect from '../custom-select-control-v2/custom-select';\nimport CustomSelectItem from '../custom-select-control-v2/item';\nimport * as Styled from '../custom-select-control-v2/styles';\nimport type { CustomSelectProps, CustomSelectOption } from './types';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nfunction useDeprecatedProps< T extends CustomSelectOption >( {\n\t__experimentalShowSelectedHint,\n\t...otherProps\n}: CustomSelectProps< T > ) {\n\treturn {\n\t\tshowSelectedHint: __experimentalShowSelectedHint,\n\t\t...otherProps,\n\t};\n}\n\n// The removal of `__experimentalHint` in favour of `hint` doesn't happen in\n// the `useDeprecatedProps` hook in order not to break consumers that rely\n// on object identity (see https://github.com/WordPress/gutenberg/pull/63248#discussion_r1672213131)\nfunction applyOptionDeprecations( {\n\t__experimentalHint,\n\t...rest\n}: CustomSelectOption ) {\n\treturn {\n\t\thint: __experimentalHint,\n\t\t...rest,\n\t};\n}\n\nfunction getDescribedBy( currentValue: string, describedBy?: string ) {\n\tif ( describedBy ) {\n\t\treturn describedBy;\n\t}\n\n\t// translators: %s: The selected option.\n\treturn sprintf( __( 'Currently selected: %s' ), currentValue );\n}\n\nfunction CustomSelectControl< T extends CustomSelectOption >(\n\tprops: CustomSelectProps< T >\n) {\n\tconst {\n\t\t__next40pxDefaultSize = false,\n\t\t__shouldNotWarnDeprecated36pxSize,\n\t\tdescribedBy,\n\t\toptions,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tvalue,\n\t\tclassName: classNameProp,\n\t\tshowSelectedHint = false,\n\t\t...restProps\n\t} = useDeprecatedProps( props );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'CustomSelectControl',\n\t\t__next40pxDefaultSize,\n\t\tsize,\n\t\t__shouldNotWarnDeprecated36pxSize,\n\t} );\n\n\tconst descriptionId = useInstanceId(\n\t\tCustomSelectControl,\n\t\t'custom-select-control__description'\n\t);\n\n\t// Forward props + store from v2 implementation\n\tconst store = Ariakit.useSelectStore< string >( {\n\t\tasync setValue( nextValue ) {\n\t\t\tconst nextOption = options.find(\n\t\t\t\t( item ) => item.name === nextValue\n\t\t\t);\n\n\t\t\tif ( ! onChange || ! nextOption ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Executes the logic in a microtask after the popup is closed.\n\t\t\t// This is simply to ensure the isOpen state matches the one from the\n\t\t\t// previous legacy implementation.\n\t\t\tawait Promise.resolve();\n\t\t\tconst state = store.getState();\n\n\t\t\tconst changeObject = {\n\t\t\t\thighlightedIndex: state.renderedItems.findIndex(\n\t\t\t\t\t( item ) => item.value === nextValue\n\t\t\t\t),\n\t\t\t\tinputValue: '',\n\t\t\t\tisOpen: state.open,\n\t\t\t\tselectedItem: nextOption,\n\t\t\t\ttype: '',\n\t\t\t};\n\t\t\tonChange( changeObject );\n\t\t},\n\t\tvalue: value?.name,\n\t\t// Setting the first option as a default value when no value is provided\n\t\t// is already done natively by the underlying Ariakit component,\n\t\t// but doing this explicitly avoids the `onChange` callback from firing\n\t\t// on initial render, thus making this implementation closer to the v1.\n\t\tdefaultValue: options[ 0 ]?.name,\n\t} );\n\n\tconst children = options\n\t\t.map( applyOptionDeprecations )\n\t\t.map( ( { name, key, hint, style, className } ) => {\n\t\t\tconst withHint = (\n\t\t\t\t<Styled.WithHintItemWrapper>\n\t\t\t\t\t<span>{ name }</span>\n\t\t\t\t\t<Styled.WithHintItemHint\n\t\t\t\t\t\t// Keeping the classname for legacy reasons\n\t\t\t\t\t\tclassName=\"components-custom-select-control__item-hint\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ hint }\n\t\t\t\t\t</Styled.WithHintItemHint>\n\t\t\t\t</Styled.WithHintItemWrapper>\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<CustomSelectItem\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvalue={ name }\n\t\t\t\t\tchildren={ hint ? withHint : name }\n\t\t\t\t\tstyle={ style }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t// Keeping the classnames for legacy reasons\n\t\t\t\t\t\t'components-custom-select-control__item',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-hint': hint,\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\n\tconst { value: currentValue } = store.getState();\n\n\tconst renderSelectedValueHint = () => {\n\t\tconst selectedOptionHint = options\n\t\t\t?.map( applyOptionDeprecations )\n\t\t\t?.find( ( { name } ) => currentValue === name )?.hint;\n\n\t\treturn (\n\t\t\t<Styled.SelectedExperimentalHintWrapper>\n\t\t\t\t{ currentValue }\n\t\t\t\t{ selectedOptionHint && (\n\t\t\t\t\t<Styled.SelectedExperimentalHintItem\n\t\t\t\t\t\t// Keeping the classname for legacy reasons\n\t\t\t\t\t\tclassName=\"components-custom-select-control__hint\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ selectedOptionHint }\n\t\t\t\t\t</Styled.SelectedExperimentalHintItem>\n\t\t\t\t) }\n\t\t\t</Styled.SelectedExperimentalHintWrapper>\n\t\t);\n\t};\n\n\tconst translatedSize = ( () => {\n\t\tif (\n\t\t\t( __next40pxDefaultSize && size === 'default' ) ||\n\t\t\tsize === '__unstable-large'\n\t\t) {\n\t\t\treturn 'default';\n\t\t}\n\t\tif ( ! __next40pxDefaultSize && size === 'default' ) {\n\t\t\treturn 'compact';\n\t\t}\n\t\treturn size;\n\t} )();\n\n\treturn (\n\t\t<>\n\t\t\t<_CustomSelect\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\trenderSelectedValue={\n\t\t\t\t\tshowSelectedHint ? renderSelectedValueHint : undefined\n\t\t\t\t}\n\t\t\t\tsize={ translatedSize }\n\t\t\t\tstore={ store }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t// Keeping the classname for legacy reasons\n\t\t\t\t\t'components-custom-select-control',\n\t\t\t\t\tclassNameProp\n\t\t\t\t) }\n\t\t\t\tisLegacy\n\t\t\t\t{ ...restProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</_CustomSelect>\n\t\t\t<VisuallyHidden>\n\t\t\t\t<span id={ descriptionId }>\n\t\t\t\t\t{ getDescribedBy( currentValue, describedBy ) }\n\t\t\t\t</span>\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nexport default CustomSelectControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,aAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,KAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,MAAA,GAAAR,uBAAA,CAAAC,OAAA;AAEA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAT,OAAA;AAA4E,IAAAU,WAAA,GAAAV,OAAA;AAAA,SAAAW,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GA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AA8E,GAAA,EAAChF,eAAA,CAAA4F,cAAc;MAAAnB,QAAA,eACd,IAAAvE,WAAA,CAAA8E,GAAA;QAAMa,EAAE,EAAG5C,aAAe;QAAAwB,QAAA,EACvB1C,cAAc,CAAEC,YAAY,EAAEC,WAAY;MAAC,CACxC;IAAC,CACQ,CAAC;EAAA,CAChB,CAAC;AAEL;AAAC,IAAA6D,QAAA,GAAAC,OAAA,CAAAtF,OAAA,GAEc2B,mBAAmB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/custom-select-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { FocusEventHandler, MouseEventHandler } from 'react';\n\n/**\n * The object structure for the options array.\n */\nexport type CustomSelectOption = {\n\tkey: string;\n\tname: string;\n\tstyle?: React.CSSProperties;\n\tclassName?: string;\n\thint?: string;\n\t/**\n\t * Use the `hint` property instead\n\t * @deprecated\n\t * @ignore\n\t */\n\t__experimentalHint?: string;\n\t[ key: string ]: any;\n};\n\n/**\n * The object returned from the onChange event.\n */\ntype CustomSelectChangeObject< T extends CustomSelectOption > = {\n\thighlightedIndex?: number;\n\tinputValue?: string;\n\tisOpen?: boolean;\n\ttype?: string;\n\tselectedItem: T;\n};\n\nexport type CustomSelectProps< T extends CustomSelectOption > = {\n\t/**\n\t * Optional classname for the component.\n\t */\n\tclassName?: string;\n\t/**\n\t * Hide the label visually, while keeping available to assistive technology.\n\t */\n\thideLabelFromVision?: boolean;\n\t/**\n\t * Description for the select trigger button used by assistive technology.\n\t * If no value is passed, the text \"Currently selected: selectedItem.name\"\n\t * will be used fully translated.\n\t */\n\tdescribedBy?: string;\n\t/**\n\t * Label for the control.\n\t */\n\tlabel: string;\n\t/**\n\t * Function called with the control's internal state changes. The `selectedItem`\n\t * property contains the next selected item.\n\t */\n\tonChange?: ( newValue: CustomSelectChangeObject< NoInfer< T > > ) => void;\n\t/**\n\t * A handler for `blur` events on the trigger button.\n\t *\n\t * @ignore\n\t */\n\tonBlur?: FocusEventHandler< HTMLButtonElement >;\n\t/**\n\t * A handler for `focus` events on the trigger button.\n\t *\n\t * @ignore\n\t */\n\tonFocus?: FocusEventHandler< HTMLButtonElement >;\n\t/**\n\t * A handler for `mouseout` events on the trigger button.\n\t *\n\t * @ignore\n\t */\n\tonMouseOut?: MouseEventHandler< HTMLButtonElement >;\n\t/**\n\t * A handler for `mouseover` events on the trigger button.\n\t *\n\t * @ignore\n\t */\n\tonMouseOver?: MouseEventHandler< HTMLButtonElement >;\n\t/**\n\t * The list of options that can be chosen from.\n\t */\n\toptions: ReadonlyArray< T >;\n\t/**\n\t * The size of the control.\n\t *\n\t * @default 'default'\n\t */\n\tsize?: 'default' | 'small' | '__unstable-large';\n\t/**\n\t * Can be used to externally control the value of the control.\n\t */\n\tvalue?: NoInfer< T >;\n\t/**\n\t * Use the `showSelectedHint` property instead.\n\t * @deprecated\n\t * @ignore\n\t */\n\t__experimentalShowSelectedHint?: boolean;\n\t/**\n\t * Show the hint of the selected item in the trigger button.\n\t *\n\t * @default false\n\t */\n\tshowSelectedHint?: boolean;\n\t/**\n\t * Opt-in prop for an unconstrained width style which became the default in\n\t * WordPress 6.5. The prop is no longer needed and can be safely removed.\n\t *\n\t * @deprecated\n\t * @ignore\n\t */\n\t__nextUnconstrainedWidth?: boolean;\n\t/**\n\t * Start opting into the larger default height that will become the default size in a future version.\n\t *\n\t * @default false\n\t */\n\t__next40pxDefaultSize?: boolean;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/custom-select-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { FocusEventHandler, MouseEventHandler } from 'react';\n\n/**\n * The object structure for the options array.\n */\nexport type CustomSelectOption = {\n\tkey: string;\n\tname: string;\n\tstyle?: React.CSSProperties;\n\tclassName?: string;\n\thint?: string;\n\t/**\n\t * Use the `hint` property instead\n\t * @deprecated\n\t * @ignore\n\t */\n\t__experimentalHint?: string;\n\t[ key: string ]: any;\n};\n\n/**\n * The object returned from the onChange event.\n */\ntype CustomSelectChangeObject< T extends CustomSelectOption > = {\n\thighlightedIndex?: number;\n\tinputValue?: string;\n\tisOpen?: boolean;\n\ttype?: string;\n\tselectedItem: T;\n};\n\nexport type CustomSelectProps< T extends CustomSelectOption > = {\n\t/**\n\t * Optional classname for the component.\n\t */\n\tclassName?: string;\n\t/**\n\t * Hide the label visually, while keeping available to assistive technology.\n\t */\n\thideLabelFromVision?: boolean;\n\t/**\n\t * Description for the select trigger button used by assistive technology.\n\t * If no value is passed, the text \"Currently selected: selectedItem.name\"\n\t * will be used fully translated.\n\t */\n\tdescribedBy?: string;\n\t/**\n\t * Label for the control.\n\t */\n\tlabel: string;\n\t/**\n\t * Function called with the control's internal state changes. The `selectedItem`\n\t * property contains the next selected item.\n\t */\n\tonChange?: ( newValue: CustomSelectChangeObject< NoInfer< T > > ) => void;\n\t/**\n\t * A handler for `blur` events on the trigger button.\n\t *\n\t * @ignore\n\t */\n\tonBlur?: FocusEventHandler< HTMLButtonElement >;\n\t/**\n\t * A handler for `focus` events on the trigger button.\n\t *\n\t * @ignore\n\t */\n\tonFocus?: FocusEventHandler< HTMLButtonElement >;\n\t/**\n\t * A handler for `mouseout` events on the trigger button.\n\t *\n\t * @ignore\n\t */\n\tonMouseOut?: MouseEventHandler< HTMLButtonElement >;\n\t/**\n\t * A handler for `mouseover` events on the trigger button.\n\t *\n\t * @ignore\n\t */\n\tonMouseOver?: MouseEventHandler< HTMLButtonElement >;\n\t/**\n\t * The list of options that can be chosen from.\n\t */\n\toptions: ReadonlyArray< T >;\n\t/**\n\t * The size of the control.\n\t *\n\t * @default 'default'\n\t */\n\tsize?: 'default' | 'small' | '__unstable-large';\n\t/**\n\t * Can be used to externally control the value of the control.\n\t */\n\tvalue?: NoInfer< T >;\n\t/**\n\t * Use the `showSelectedHint` property instead.\n\t * @deprecated\n\t * @ignore\n\t */\n\t__experimentalShowSelectedHint?: boolean;\n\t/**\n\t * Show the hint of the selected item in the trigger button.\n\t *\n\t * @default false\n\t */\n\tshowSelectedHint?: boolean;\n\t/**\n\t * Opt-in prop for an unconstrained width style which became the default in\n\t * WordPress 6.5. The prop is no longer needed and can be safely removed.\n\t *\n\t * @deprecated\n\t * @ignore\n\t */\n\t__nextUnconstrainedWidth?: boolean;\n\t/**\n\t * Start opting into the larger default height that will become the default size in a future version.\n\t *\n\t * @default false\n\t */\n\t__next40pxDefaultSize?: boolean;\n\t/**\n\t * Do not throw a warning for the deprecated 36px default size.\n\t * For internal components of other components that already throw the warning.\n\t *\n\t * @ignore\n\t */\n\t__shouldNotWarnDeprecated36pxSize?: boolean;\n};\n"],"mappings":"","ignoreList":[]}
@@ -54,15 +54,19 @@ function DropZoneComponent({
54
54
  onFilesDrop,
55
55
  onHTMLDrop,
56
56
  onDrop,
57
+ isEligible = () => true,
57
58
  ...restProps
58
59
  }) {
59
60
  const [isDraggingOverDocument, setIsDraggingOverDocument] = (0, _element.useState)();
60
61
  const [isDraggingOverElement, setIsDraggingOverElement] = (0, _element.useState)();
61
- const [type, setType] = (0, _element.useState)();
62
+ const [isActive, setIsActive] = (0, _element.useState)();
62
63
  const ref = (0, _compose.__experimentalUseDropZone)({
63
64
  onDrop(event) {
64
- const files = event.dataTransfer ? (0, _dom.getFilesFromDataTransfer)(event.dataTransfer) : [];
65
- const html = event.dataTransfer?.getData('text/html');
65
+ if (!event.dataTransfer) {
66
+ return;
67
+ }
68
+ const files = (0, _dom.getFilesFromDataTransfer)(event.dataTransfer);
69
+ const html = event.dataTransfer.getData('text/html');
66
70
 
67
71
  /**
68
72
  * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
@@ -78,26 +82,29 @@ function DropZoneComponent({
78
82
  },
79
83
  onDragStart(event) {
80
84
  setIsDraggingOverDocument(true);
81
- let _type = 'default';
85
+ if (!event.dataTransfer) {
86
+ return;
87
+ }
82
88
 
83
89
  /**
84
90
  * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
85
91
  * The order of the checks is important to recognize the HTML drop.
86
92
  */
87
- if (event.dataTransfer?.types.includes('text/html')) {
88
- _type = 'html';
93
+ if (event.dataTransfer.types.includes('text/html')) {
94
+ setIsActive(!!onHTMLDrop);
89
95
  } else if (
90
96
  // Check for the types because sometimes the files themselves
91
97
  // are only available on drop.
92
- event.dataTransfer?.types.includes('Files') || (event.dataTransfer ? (0, _dom.getFilesFromDataTransfer)(event.dataTransfer) : []).length > 0) {
93
- _type = 'file';
98
+ event.dataTransfer.types.includes('Files') || (0, _dom.getFilesFromDataTransfer)(event.dataTransfer).length > 0) {
99
+ setIsActive(!!onFilesDrop);
100
+ } else {
101
+ setIsActive(!!onDrop && isEligible(event.dataTransfer));
94
102
  }
95
- setType(_type);
96
103
  },
97
104
  onDragEnd() {
98
105
  setIsDraggingOverElement(false);
99
106
  setIsDraggingOverDocument(false);
100
- setType(undefined);
107
+ setIsActive(undefined);
101
108
  },
102
109
  onDragEnter() {
103
110
  setIsDraggingOverElement(true);
@@ -107,10 +114,9 @@ function DropZoneComponent({
107
114
  }
108
115
  });
109
116
  const classes = (0, _clsx.default)('components-drop-zone', className, {
110
- 'is-active': (isDraggingOverDocument || isDraggingOverElement) && (type === 'file' && onFilesDrop || type === 'html' && onHTMLDrop || type === 'default' && onDrop),
117
+ 'is-active': isActive,
111
118
  'is-dragging-over-document': isDraggingOverDocument,
112
- 'is-dragging-over-element': isDraggingOverElement,
113
- [`is-dragging-${type}`]: !!type
119
+ 'is-dragging-over-element': isDraggingOverElement
114
120
  });
115
121
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
116
122
  ...restProps,
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_element","_icons","_dom","_compose","_jsxRuntime","DropZoneComponent","className","label","onFilesDrop","onHTMLDrop","onDrop","restProps","isDraggingOverDocument","setIsDraggingOverDocument","useState","isDraggingOverElement","setIsDraggingOverElement","type","setType","ref","useDropZone","event","files","dataTransfer","getFilesFromDataTransfer","html","getData","length","onDragStart","_type","types","includes","onDragEnd","undefined","onDragEnter","onDragLeave","classes","clsx","jsx","children","jsxs","Icon","icon","upload","__","_default","exports","default"],"sources":["@wordpress/components/src/drop-zone/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { upload, Icon } from '@wordpress/icons';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\nimport { __experimentalUseDropZone as useDropZone } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport type { DropType, DropZoneProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\n/**\n * `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.\n *\n * ```jsx\n * import { DropZone } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDropZone = () => {\n * const [ hasDropped, setHasDropped ] = useState( false );\n *\n * return (\n * <div>\n * { hasDropped ? 'Dropped!' : 'Drop something here' }\n * <DropZone\n * onFilesDrop={ () => setHasDropped( true ) }\n * onHTMLDrop={ () => setHasDropped( true ) }\n * onDrop={ () => setHasDropped( true ) }\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function DropZoneComponent( {\n\tclassName,\n\tlabel,\n\tonFilesDrop,\n\tonHTMLDrop,\n\tonDrop,\n\t...restProps\n}: WordPressComponentProps< DropZoneProps, 'div', false > ) {\n\tconst [ isDraggingOverDocument, setIsDraggingOverDocument ] =\n\t\tuseState< boolean >();\n\tconst [ isDraggingOverElement, setIsDraggingOverElement ] =\n\t\tuseState< boolean >();\n\tconst [ type, setType ] = useState< DropType >();\n\tconst ref = useDropZone( {\n\t\tonDrop( event ) {\n\t\t\tconst files = event.dataTransfer\n\t\t\t\t? getFilesFromDataTransfer( event.dataTransfer )\n\t\t\t\t: [];\n\t\t\tconst html = event.dataTransfer?.getData( 'text/html' );\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognize the HTML drop.\n\t\t\t */\n\t\t\tif ( html && onHTMLDrop ) {\n\t\t\t\tonHTMLDrop( html );\n\t\t\t} else if ( files.length && onFilesDrop ) {\n\t\t\t\tonFilesDrop( files );\n\t\t\t} else if ( onDrop ) {\n\t\t\t\tonDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragStart( event ) {\n\t\t\tsetIsDraggingOverDocument( true );\n\n\t\t\tlet _type: DropType = 'default';\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognize the HTML drop.\n\t\t\t */\n\t\t\tif ( event.dataTransfer?.types.includes( 'text/html' ) ) {\n\t\t\t\t_type = 'html';\n\t\t\t} else if (\n\t\t\t\t// Check for the types because sometimes the files themselves\n\t\t\t\t// are only available on drop.\n\t\t\t\tevent.dataTransfer?.types.includes( 'Files' ) ||\n\t\t\t\t( event.dataTransfer\n\t\t\t\t\t? getFilesFromDataTransfer( event.dataTransfer )\n\t\t\t\t\t: []\n\t\t\t\t).length > 0\n\t\t\t) {\n\t\t\t\t_type = 'file';\n\t\t\t}\n\n\t\t\tsetType( _type );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tsetIsDraggingOverElement( false );\n\t\t\tsetIsDraggingOverDocument( false );\n\t\t\tsetType( undefined );\n\t\t},\n\t\tonDragEnter() {\n\t\t\tsetIsDraggingOverElement( true );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tsetIsDraggingOverElement( false );\n\t\t},\n\t} );\n\n\tconst classes = clsx( 'components-drop-zone', className, {\n\t\t'is-active':\n\t\t\t( isDraggingOverDocument || isDraggingOverElement ) &&\n\t\t\t( ( type === 'file' && onFilesDrop ) ||\n\t\t\t\t( type === 'html' && onHTMLDrop ) ||\n\t\t\t\t( type === 'default' && onDrop ) ),\n\t\t'is-dragging-over-document': isDraggingOverDocument,\n\t\t'is-dragging-over-element': isDraggingOverElement,\n\t\t[ `is-dragging-${ type }` ]: !! type,\n\t} );\n\n\treturn (\n\t\t<div { ...restProps } ref={ ref } className={ classes }>\n\t\t\t<div className=\"components-drop-zone__content\">\n\t\t\t\t<div className=\"components-drop-zone__content-inner\">\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tclassName=\"components-drop-zone__content-icon\"\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"components-drop-zone__content-text\">\n\t\t\t\t\t\t{ label ? label : __( 'Drop files to upload' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default DropZoneComponent;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAA8E,IAAAM,WAAA,GAAAN,OAAA;AAZ9E;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,iBAAiBA,CAAE;EAClCC,SAAS;EACTC,KAAK;EACLC,WAAW;EACXC,UAAU;EACVC,MAAM;EACN,GAAGC;AACoD,CAAC,EAAG;EAC3D,MAAM,CAAEC,sBAAsB,EAAEC,yBAAyB,CAAE,GAC1D,IAAAC,iBAAQ,EAAY,CAAC;EACtB,MAAM,CAAEC,qBAAqB,EAAEC,wBAAwB,CAAE,GACxD,IAAAF,iBAAQ,EAAY,CAAC;EACtB,MAAM,CAAEG,IAAI,EAAEC,OAAO,CAAE,GAAG,IAAA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names":["_clsx","_interopRequireDefault","require","_i18n","_element","_icons","_dom","_compose","_jsxRuntime","DropZoneComponent","className","label","onFilesDrop","onHTMLDrop","onDrop","isEligible","restProps","isDraggingOverDocument","setIsDraggingOverDocument","useState","isDraggingOverElement","setIsDraggingOverElement","isActive","setIsActive","ref","useDropZone","event","dataTransfer","files","getFilesFromDataTransfer","html","getData","length","onDragStart","types","includes","onDragEnd","undefined","onDragEnter","onDragLeave","classes","clsx","jsx","children","jsxs","Icon","icon","upload","__","_default","exports","default"],"sources":["@wordpress/components/src/drop-zone/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { upload, Icon } from '@wordpress/icons';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\nimport { __experimentalUseDropZone as useDropZone } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport type { DropZoneProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\n/**\n * `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.\n *\n * ```jsx\n * import { DropZone } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDropZone = () => {\n * const [ hasDropped, setHasDropped ] = useState( false );\n *\n * return (\n * <div>\n * { hasDropped ? 'Dropped!' : 'Drop something here' }\n * <DropZone\n * onFilesDrop={ () => setHasDropped( true ) }\n * onHTMLDrop={ () => setHasDropped( true ) }\n * onDrop={ () => setHasDropped( true ) }\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function DropZoneComponent( {\n\tclassName,\n\tlabel,\n\tonFilesDrop,\n\tonHTMLDrop,\n\tonDrop,\n\tisEligible = () => true,\n\t...restProps\n}: WordPressComponentProps< DropZoneProps, 'div', false > ) {\n\tconst [ isDraggingOverDocument, setIsDraggingOverDocument ] =\n\t\tuseState< boolean >();\n\tconst [ isDraggingOverElement, setIsDraggingOverElement ] =\n\t\tuseState< boolean >();\n\tconst [ isActive, setIsActive ] = useState< boolean >();\n\tconst ref = useDropZone( {\n\t\tonDrop( event ) {\n\t\t\tif ( ! event.dataTransfer ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognize the HTML drop.\n\t\t\t */\n\t\t\tif ( html && onHTMLDrop ) {\n\t\t\t\tonHTMLDrop( html );\n\t\t\t} else if ( files.length && onFilesDrop ) {\n\t\t\t\tonFilesDrop( files );\n\t\t\t} else if ( onDrop ) {\n\t\t\t\tonDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragStart( event ) {\n\t\t\tsetIsDraggingOverDocument( true );\n\n\t\t\tif ( ! event.dataTransfer ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognize the HTML drop.\n\t\t\t */\n\t\t\tif ( event.dataTransfer.types.includes( 'text/html' ) ) {\n\t\t\t\tsetIsActive( !! onHTMLDrop );\n\t\t\t} else if (\n\t\t\t\t// Check for the types because sometimes the files themselves\n\t\t\t\t// are only available on drop.\n\t\t\t\tevent.dataTransfer.types.includes( 'Files' ) ||\n\t\t\t\tgetFilesFromDataTransfer( event.dataTransfer ).length > 0\n\t\t\t) {\n\t\t\t\tsetIsActive( !! onFilesDrop );\n\t\t\t} else {\n\t\t\t\tsetIsActive( !! onDrop && isEligible( event.dataTransfer ) );\n\t\t\t}\n\t\t},\n\t\tonDragEnd() {\n\t\t\tsetIsDraggingOverElement( false );\n\t\t\tsetIsDraggingOverDocument( false );\n\t\t\tsetIsActive( undefined );\n\t\t},\n\t\tonDragEnter() {\n\t\t\tsetIsDraggingOverElement( true );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tsetIsDraggingOverElement( false );\n\t\t},\n\t} );\n\n\tconst classes = clsx( 'components-drop-zone', className, {\n\t\t'is-active': isActive,\n\t\t'is-dragging-over-document': isDraggingOverDocument,\n\t\t'is-dragging-over-element': isDraggingOverElement,\n\t} );\n\n\treturn (\n\t\t<div { ...restProps } ref={ ref } className={ classes }>\n\t\t\t<div className=\"components-drop-zone__content\">\n\t\t\t\t<div className=\"components-drop-zone__content-inner\">\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tclassName=\"components-drop-zone__content-icon\"\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"components-drop-zone__content-text\">\n\t\t\t\t\t\t{ label ? label : __( 'Drop files to upload' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default DropZoneComponent;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAA8E,IAAAM,WAAA,GAAAN,OAAA;AAZ9E;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,iBAAiBA,CAAE;EAClCC,SAAS;EACTC,KAAK;EACLC,WAAW;EACXC,UAAU;EACVC,MAAM;EACNC,UAAU,GAAGA,CAAA,KAAM,IAAI;EACvB,GAAGC;AACoD,CAAC,EAAG;EAC3D,MAAM,CAAEC,sBAAsB,EAAEC,yBAAyB,CAAE,GAC1D,IAAAC,iBAAQ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AA,CAAAC,OAAA,GAEc1C,iBAAiB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/drop-zone/types.ts"],"sourcesContent":["export type DropType = 'file' | 'html' | 'default';\n\nexport type DropZoneProps = {\n\t/**\n\t * A CSS `class` to give to the wrapper element.\n\t */\n\tclassName?: string;\n\t/**\n\t * A string to be shown within the drop zone area.\n\t *\n\t * @default `__( 'Drop files to upload' )`\n\t */\n\tlabel?: string;\n\t/**\n\t * The function is generic drop handler called if the `onFilesDrop` or `onHTMLDrop` are not called.\n\t * It receives the drop `event` object as an argument.\n\t */\n\tonDrop?: ( event: DragEvent ) => void;\n\t/**\n\t * The function is called when dropping a file into the `DropZone`.\n\t * It receives an array of dropped files as an argument.\n\t */\n\tonFilesDrop?: ( files: File[] ) => void;\n\t/**\n\t * The function is called when dropping HTML into the `DropZone`.\n\t * It receives the HTML being dropped as an argument.\n\t */\n\tonHTMLDrop?: ( html: string ) => void;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/drop-zone/types.ts"],"sourcesContent":["export type DropType = 'file' | 'html' | 'default';\n\nexport type DropZoneProps = {\n\t/**\n\t * A CSS `class` to give to the wrapper element.\n\t */\n\tclassName?: string;\n\t/**\n\t * A string to be shown within the drop zone area.\n\t *\n\t * @default `__( 'Drop files to upload' )`\n\t */\n\tlabel?: string;\n\t/**\n\t * The function is generic drop handler called if the `onFilesDrop` or `onHTMLDrop` are not called.\n\t * It receives the drop `event` object as an argument.\n\t */\n\tonDrop?: ( event: DragEvent ) => void;\n\t/**\n\t * The function is called when dropping a file into the `DropZone`.\n\t * It receives an array of dropped files as an argument.\n\t */\n\tonFilesDrop?: ( files: File[] ) => void;\n\t/**\n\t * The function is called when dropping HTML into the `DropZone`.\n\t * It receives the HTML being dropped as an argument.\n\t */\n\tonHTMLDrop?: ( html: string ) => void;\n\t/**\n\t * A function to determine if the drop zone is eligible to handle the drop\n\t * data transfer items.\n\t */\n\tisEligible?: ( dataTransfer: DataTransfer ) => boolean;\n};\n"],"mappings":"","ignoreList":[]}
@@ -136,6 +136,7 @@ function UnconnectedDropdownMenu(dropdownMenuProps) {
136
136
  ...mergedMenuProps,
137
137
  role: "menu",
138
138
  children: [isFunction(children) ? children(props) : null, controlSets?.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
139
+ __next40pxDefaultSize: true,
139
140
  onClick: event => {
140
141
  event.stopPropagation();
141
142
  props.onClose();