@wordpress/components 25.7.0 → 25.8.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 (607) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/build/animation/index.js +6 -0
  3. package/build/animation/index.js.map +1 -1
  4. package/build/border-control/border-control-dropdown/component.js +1 -1
  5. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  6. package/build/border-control/styles.js +20 -20
  7. package/build/border-control/styles.js.map +1 -1
  8. package/build/box-control/unit-control.js +1 -1
  9. package/build/box-control/unit-control.js.map +1 -1
  10. package/build/button/index.js +9 -1
  11. package/build/button/index.js.map +1 -1
  12. package/build/button/types.js.map +1 -1
  13. package/build/circular-option-picker/circular-option-picker-actions.js +53 -0
  14. package/build/circular-option-picker/circular-option-picker-actions.js.map +1 -0
  15. package/build/circular-option-picker/circular-option-picker-context.js +14 -0
  16. package/build/circular-option-picker/circular-option-picker-context.js.map +1 -0
  17. package/build/circular-option-picker/circular-option-picker-option-group.js +26 -0
  18. package/build/circular-option-picker/circular-option-picker-option-group.js.map +1 -0
  19. package/build/circular-option-picker/circular-option-picker-option.js +122 -0
  20. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -0
  21. package/build/circular-option-picker/circular-option-picker.js +172 -0
  22. package/build/circular-option-picker/circular-option-picker.js.map +1 -0
  23. package/build/circular-option-picker/index.js +29 -137
  24. package/build/circular-option-picker/index.js.map +1 -1
  25. package/build/circular-option-picker/types.js.map +1 -1
  26. package/build/color-palette/index.js +58 -19
  27. package/build/color-palette/index.js.map +1 -1
  28. package/build/color-palette/types.js.map +1 -1
  29. package/build/combobox-control/index.js +0 -3
  30. package/build/combobox-control/index.js.map +1 -1
  31. package/build/composite/index.js.map +1 -1
  32. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  33. package/build/date-time/time/timezone.js +1 -1
  34. package/build/date-time/time/timezone.js.map +1 -1
  35. package/build/dropdown/index.js +11 -23
  36. package/build/dropdown/index.js.map +1 -1
  37. package/build/dropdown/types.js.map +1 -1
  38. package/build/dropdown-menu/index.js +7 -1
  39. package/build/dropdown-menu/index.js.map +1 -1
  40. package/build/dropdown-menu/types.js.map +1 -1
  41. package/build/dropdown-menu-v2/styles.js +16 -16
  42. package/build/dropdown-menu-v2/styles.js.map +1 -1
  43. package/build/duotone-picker/color-list-picker/index.js +18 -3
  44. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  45. package/build/duotone-picker/duotone-picker.js +33 -1
  46. package/build/duotone-picker/duotone-picker.js.map +1 -1
  47. package/build/duotone-picker/types.js.map +1 -1
  48. package/build/focusable-iframe/index.js +0 -4
  49. package/build/focusable-iframe/index.js.map +1 -1
  50. package/build/focusable-iframe/types.js +6 -0
  51. package/build/focusable-iframe/types.js.map +1 -0
  52. package/build/form-token-field/index.js +6 -2
  53. package/build/form-token-field/index.js.map +1 -1
  54. package/build/form-token-field/types.js.map +1 -1
  55. package/build/gradient-picker/index.js +57 -15
  56. package/build/gradient-picker/index.js.map +1 -1
  57. package/build/gradient-picker/types.js.map +1 -1
  58. package/build/higher-order/navigate-regions/index.js.map +1 -1
  59. package/build/higher-order/with-focus-outside/index.js +1 -2
  60. package/build/higher-order/with-focus-outside/index.js.map +1 -1
  61. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  62. package/build/index.js +6 -0
  63. package/build/index.js.map +1 -1
  64. package/build/input-control/styles/input-control-styles.js +22 -22
  65. package/build/input-control/styles/input-control-styles.js.map +1 -1
  66. package/build/mobile/bottom-sheet/index.native.js +1 -0
  67. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  68. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  69. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  70. package/build/notice/index.js +19 -7
  71. package/build/notice/index.js.map +1 -1
  72. package/build/palette-edit/styles.js +10 -10
  73. package/build/palette-edit/styles.js.map +1 -1
  74. package/build/placeholder/index.js.map +1 -1
  75. package/build/popover/index.js +37 -83
  76. package/build/popover/index.js.map +1 -1
  77. package/build/popover/types.js.map +1 -1
  78. package/build/popover/utils.js +9 -41
  79. package/build/popover/utils.js.map +1 -1
  80. package/build/search-control/index.js +12 -3
  81. package/build/search-control/index.js.map +1 -1
  82. package/build/search-control/types.js.map +1 -1
  83. package/build/text/styles.js +7 -7
  84. package/build/text/styles.js.map +1 -1
  85. package/build/toggle-group-control/toggle-group-control/as-button-group.js +30 -45
  86. package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  87. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +40 -41
  88. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  89. package/build/toggle-group-control/toggle-group-control/component.js +10 -5
  90. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  91. package/build/toggle-group-control/toggle-group-control/styles.js +9 -16
  92. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  93. package/build/toggle-group-control/toggle-group-control/utils.js +44 -0
  94. package/build/toggle-group-control/toggle-group-control/utils.js.map +1 -0
  95. package/build/toggle-group-control/toggle-group-control-option-base/component.js +36 -17
  96. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  97. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +10 -8
  98. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  99. package/build/toggle-group-control/types.js.map +1 -1
  100. package/build/toolbar/toolbar/index.js +7 -1
  101. package/build/toolbar/toolbar/index.js.map +1 -1
  102. package/build/toolbar/toolbar-dropdown-menu/index.js +1 -3
  103. package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  104. package/build/toolbar/toolbar-group/index.js +16 -12
  105. package/build/toolbar/toolbar-group/index.js.map +1 -1
  106. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +0 -2
  107. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  108. package/build/toolbar/toolbar-group/toolbar-group-container.js +3 -1
  109. package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  110. package/build/toolbar/toolbar-group/types.js +6 -0
  111. package/build/toolbar/toolbar-group/types.js.map +1 -0
  112. package/build/toolbar/toolbar-item/index.js +1 -1
  113. package/build/toolbar/toolbar-item/index.js.map +1 -1
  114. package/build/tooltip/index.js +51 -225
  115. package/build/tooltip/index.js.map +1 -1
  116. package/build/tooltip/types.js +6 -0
  117. package/build/tooltip/types.js.map +1 -0
  118. package/build/ui/context/context-connect.js.map +1 -1
  119. package/build/ui/context/wordpress-component.js.map +1 -1
  120. package/build/unit-control/index.js.map +1 -1
  121. package/build/unit-control/styles/unit-control-styles.js +7 -7
  122. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  123. package/build/utils/colors-values.js +1 -1
  124. package/build/utils/colors-values.js.map +1 -1
  125. package/build/utils/use-deprecated-props.js.map +1 -1
  126. package/build-module/animation/index.js +1 -1
  127. package/build-module/animation/index.js.map +1 -1
  128. package/build-module/border-control/border-control-dropdown/component.js +1 -1
  129. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  130. package/build-module/border-control/styles.js +20 -20
  131. package/build-module/border-control/styles.js.map +1 -1
  132. package/build-module/box-control/unit-control.js +1 -1
  133. package/build-module/box-control/unit-control.js.map +1 -1
  134. package/build-module/button/index.js +9 -1
  135. package/build-module/button/index.js.map +1 -1
  136. package/build-module/button/types.js.map +1 -1
  137. package/build-module/circular-option-picker/circular-option-picker-actions.js +44 -0
  138. package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -0
  139. package/build-module/circular-option-picker/circular-option-picker-context.js +11 -0
  140. package/build-module/circular-option-picker/circular-option-picker-context.js.map +1 -0
  141. package/build-module/circular-option-picker/circular-option-picker-option-group.js +23 -0
  142. package/build-module/circular-option-picker/circular-option-picker-option-group.js.map +1 -0
  143. package/build-module/circular-option-picker/circular-option-picker-option.js +114 -0
  144. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -0
  145. package/build-module/circular-option-picker/circular-option-picker.js +165 -0
  146. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -0
  147. package/build-module/circular-option-picker/index.js +4 -132
  148. package/build-module/circular-option-picker/index.js.map +1 -1
  149. package/build-module/circular-option-picker/types.js.map +1 -1
  150. package/build-module/color-palette/index.js +58 -19
  151. package/build-module/color-palette/index.js.map +1 -1
  152. package/build-module/color-palette/types.js.map +1 -1
  153. package/build-module/combobox-control/index.js +0 -3
  154. package/build-module/combobox-control/index.js.map +1 -1
  155. package/build-module/composite/index.js +2 -0
  156. package/build-module/composite/index.js.map +1 -1
  157. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  158. package/build-module/date-time/time/timezone.js +1 -1
  159. package/build-module/date-time/time/timezone.js.map +1 -1
  160. package/build-module/dropdown/index.js +12 -24
  161. package/build-module/dropdown/index.js.map +1 -1
  162. package/build-module/dropdown/types.js.map +1 -1
  163. package/build-module/dropdown-menu/index.js +7 -1
  164. package/build-module/dropdown-menu/index.js.map +1 -1
  165. package/build-module/dropdown-menu/types.js.map +1 -1
  166. package/build-module/dropdown-menu-v2/styles.js +16 -16
  167. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  168. package/build-module/duotone-picker/color-list-picker/index.js +18 -3
  169. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  170. package/build-module/duotone-picker/duotone-picker.js +33 -1
  171. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  172. package/build-module/duotone-picker/types.js.map +1 -1
  173. package/build-module/focusable-iframe/index.js +2 -3
  174. package/build-module/focusable-iframe/index.js.map +1 -1
  175. package/build-module/focusable-iframe/types.js +2 -0
  176. package/build-module/focusable-iframe/types.js.map +1 -0
  177. package/build-module/form-token-field/index.js +6 -2
  178. package/build-module/form-token-field/index.js.map +1 -1
  179. package/build-module/form-token-field/types.js.map +1 -1
  180. package/build-module/gradient-picker/index.js +57 -15
  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/higher-order/navigate-regions/index.js.map +1 -1
  184. package/build-module/higher-order/with-focus-outside/index.js +1 -3
  185. package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
  186. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  187. package/build-module/index.js +1 -1
  188. package/build-module/index.js.map +1 -1
  189. package/build-module/input-control/styles/input-control-styles.js +23 -23
  190. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  191. package/build-module/mobile/bottom-sheet/index.native.js +1 -0
  192. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  193. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  194. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  195. package/build-module/notice/index.js +19 -7
  196. package/build-module/notice/index.js.map +1 -1
  197. package/build-module/palette-edit/styles.js +10 -10
  198. package/build-module/palette-edit/styles.js.map +1 -1
  199. package/build-module/placeholder/index.js.map +1 -1
  200. package/build-module/popover/index.js +38 -84
  201. package/build-module/popover/index.js.map +1 -1
  202. package/build-module/popover/types.js.map +1 -1
  203. package/build-module/popover/utils.js +8 -39
  204. package/build-module/popover/utils.js.map +1 -1
  205. package/build-module/search-control/index.js +12 -3
  206. package/build-module/search-control/index.js.map +1 -1
  207. package/build-module/search-control/types.js.map +1 -1
  208. package/build-module/text/styles.js +7 -7
  209. package/build-module/text/styles.js.map +1 -1
  210. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +32 -47
  211. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  212. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +41 -42
  213. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  214. package/build-module/toggle-group-control/toggle-group-control/component.js +10 -6
  215. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  216. package/build-module/toggle-group-control/toggle-group-control/styles.js +8 -14
  217. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  218. package/build-module/toggle-group-control/toggle-group-control/utils.js +42 -0
  219. package/build-module/toggle-group-control/toggle-group-control/utils.js.map +1 -0
  220. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +35 -16
  221. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  222. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -7
  223. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  224. package/build-module/toggle-group-control/types.js.map +1 -1
  225. package/build-module/toolbar/toolbar/index.js +7 -1
  226. package/build-module/toolbar/toolbar/index.js.map +1 -1
  227. package/build-module/toolbar/toolbar-dropdown-menu/index.js +5 -3
  228. package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  229. package/build-module/toolbar/toolbar-group/index.js +15 -12
  230. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  231. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +0 -2
  232. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  233. package/build-module/toolbar/toolbar-group/toolbar-group-container.js +3 -1
  234. package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  235. package/build-module/toolbar/toolbar-group/types.js +2 -0
  236. package/build-module/toolbar/toolbar-group/types.js.map +1 -0
  237. package/build-module/toolbar/toolbar-item/index.js +1 -1
  238. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  239. package/build-module/tooltip/index.js +53 -224
  240. package/build-module/tooltip/index.js.map +1 -1
  241. package/build-module/tooltip/types.js +2 -0
  242. package/build-module/tooltip/types.js.map +1 -0
  243. package/build-module/ui/context/context-connect.js.map +1 -1
  244. package/build-module/ui/context/wordpress-component.js.map +1 -1
  245. package/build-module/unit-control/index.js.map +1 -1
  246. package/build-module/unit-control/styles/unit-control-styles.js +7 -7
  247. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  248. package/build-module/utils/colors-values.js +1 -1
  249. package/build-module/utils/colors-values.js.map +1 -1
  250. package/build-module/utils/use-deprecated-props.js.map +1 -1
  251. package/build-style/style-rtl.css +35 -63
  252. package/build-style/style.css +35 -63
  253. package/build-types/animation/index.d.ts +1 -1
  254. package/build-types/animation/index.d.ts.map +1 -1
  255. package/build-types/base-control/hooks.d.ts +1 -1
  256. package/build-types/border-box-control/border-box-control/component.d.ts +1 -1
  257. package/build-types/border-box-control/border-box-control/hook.d.ts +46 -46
  258. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +51 -51
  259. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +1 -1
  260. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +46 -46
  261. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +46 -46
  262. package/build-types/border-box-control/stories/index.story.d.ts +2 -2
  263. package/build-types/border-control/border-control/hook.d.ts +45 -45
  264. package/build-types/border-control/border-control-dropdown/hook.d.ts +45 -45
  265. package/build-types/border-control/border-control-style-picker/hook.d.ts +45 -45
  266. package/build-types/border-control/stories/index.story.d.ts +6 -6
  267. package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
  268. package/build-types/button/deprecated.d.ts +16 -22
  269. package/build-types/button/deprecated.d.ts.map +1 -1
  270. package/build-types/button/index.d.ts.map +1 -1
  271. package/build-types/button/types.d.ts +0 -4
  272. package/build-types/button/types.d.ts.map +1 -1
  273. package/build-types/card/card/hook.d.ts +46 -46
  274. package/build-types/card/card-body/hook.d.ts +46 -46
  275. package/build-types/card/card-divider/hook.d.ts +47 -47
  276. package/build-types/card/card-footer/hook.d.ts +46 -46
  277. package/build-types/card/card-header/hook.d.ts +46 -46
  278. package/build-types/card/card-media/hook.d.ts +46 -46
  279. package/build-types/card/stories/index.story.d.ts +2 -2
  280. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts +7 -0
  281. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -0
  282. package/build-types/circular-option-picker/circular-option-picker-context.d.ts +7 -0
  283. package/build-types/circular-option-picker/circular-option-picker-context.d.ts.map +1 -0
  284. package/build-types/circular-option-picker/circular-option-picker-option-group.d.ts +7 -0
  285. package/build-types/circular-option-picker/circular-option-picker-option-group.d.ts.map +1 -0
  286. package/build-types/circular-option-picker/circular-option-picker-option.d.ts +4 -0
  287. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -0
  288. package/build-types/circular-option-picker/circular-option-picker.d.ts +11 -0
  289. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -0
  290. package/build-types/circular-option-picker/index.d.ts +5 -56
  291. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  292. package/build-types/circular-option-picker/stories/index.story.d.ts +3 -1
  293. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  294. package/build-types/circular-option-picker/test/index.d.ts +2 -0
  295. package/build-types/circular-option-picker/test/index.d.ts.map +1 -0
  296. package/build-types/circular-option-picker/types.d.ts +53 -1
  297. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  298. package/build-types/color-palette/index.d.ts +3 -19
  299. package/build-types/color-palette/index.d.ts.map +1 -1
  300. package/build-types/color-palette/stories/index.story.d.ts +3 -36
  301. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  302. package/build-types/color-palette/styles.d.ts +1 -1
  303. package/build-types/color-palette/types.d.ts +31 -1
  304. package/build-types/color-palette/types.d.ts.map +1 -1
  305. package/build-types/color-picker/component.d.ts +1 -1
  306. package/build-types/color-picker/stories/index.story.d.ts +1 -1
  307. package/build-types/color-picker/styles.d.ts +6 -6
  308. package/build-types/combobox-control/index.d.ts.map +1 -1
  309. package/build-types/combobox-control/stories/index.story.d.ts +2 -2
  310. package/build-types/composite/index.d.ts +14 -1
  311. package/build-types/composite/index.d.ts.map +1 -1
  312. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
  313. package/build-types/date-time/date/styles.d.ts +3 -3
  314. package/build-types/date-time/date-time/styles.d.ts +2 -2
  315. package/build-types/date-time/time/styles.d.ts +12 -12
  316. package/build-types/dropdown/index.d.ts.map +1 -1
  317. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  318. package/build-types/dropdown/types.d.ts +12 -4
  319. package/build-types/dropdown/types.d.ts.map +1 -1
  320. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  321. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  322. package/build-types/dropdown-menu/types.d.ts +22 -5
  323. package/build-types/dropdown-menu/types.d.ts.map +1 -1
  324. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  325. package/build-types/duotone-picker/duotone-picker.d.ts +1 -1
  326. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  327. package/build-types/duotone-picker/types.d.ts +31 -1
  328. package/build-types/duotone-picker/types.d.ts.map +1 -1
  329. package/build-types/elevation/hook.d.ts +46 -46
  330. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  331. package/build-types/flex/flex/hook.d.ts +46 -46
  332. package/build-types/flex/flex-block/hook.d.ts +46 -46
  333. package/build-types/flex/flex-item/hook.d.ts +46 -46
  334. package/build-types/focal-point-picker/stories/index.story.d.ts +8 -8
  335. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  336. package/build-types/focusable-iframe/index.d.ts +4 -5
  337. package/build-types/focusable-iframe/index.d.ts.map +1 -1
  338. package/build-types/focusable-iframe/types.d.ts +8 -0
  339. package/build-types/focusable-iframe/types.d.ts.map +1 -0
  340. package/build-types/font-size-picker/styles.d.ts +2 -2
  341. package/build-types/form-token-field/index.d.ts.map +1 -1
  342. package/build-types/form-token-field/types.d.ts +6 -0
  343. package/build-types/form-token-field/types.d.ts.map +1 -1
  344. package/build-types/gradient-picker/index.d.ts +1 -1
  345. package/build-types/gradient-picker/index.d.ts.map +1 -1
  346. package/build-types/gradient-picker/stories/index.story.d.ts +3 -36
  347. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  348. package/build-types/gradient-picker/types.d.ts +31 -1
  349. package/build-types/gradient-picker/types.d.ts.map +1 -1
  350. package/build-types/grid/hook.d.ts +46 -46
  351. package/build-types/h-stack/component.d.ts +1 -1
  352. package/build-types/h-stack/hook.d.ts +46 -46
  353. package/build-types/heading/hook.d.ts +45 -45
  354. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -1
  355. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -0
  356. package/build-types/higher-order/with-focus-outside/index.d.ts.map +1 -1
  357. package/build-types/higher-order/with-focus-outside/test/index.d.ts +2 -0
  358. package/build-types/higher-order/with-focus-outside/test/index.d.ts.map +1 -0
  359. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  360. package/build-types/index.d.ts +1 -1
  361. package/build-types/index.d.ts.map +1 -1
  362. package/build-types/isolated-event-container/test/index.d.ts +2 -0
  363. package/build-types/isolated-event-container/test/index.d.ts.map +1 -0
  364. package/build-types/item-group/item/hook.d.ts +46 -46
  365. package/build-types/item-group/item-group/hook.d.ts +46 -46
  366. package/build-types/menu-item/index.d.ts +1 -1
  367. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  368. package/build-types/navigable-container/menu.d.ts +1 -1
  369. package/build-types/navigation/back-button/index.d.ts +1 -1
  370. package/build-types/navigation/styles/navigation-styles.d.ts +5 -3
  371. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  372. package/build-types/navigator/navigator-back-button/component.d.ts +2 -3
  373. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  374. package/build-types/navigator/navigator-back-button/hook.d.ts +53 -54
  375. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  376. package/build-types/navigator/navigator-button/component.d.ts +2 -3
  377. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  378. package/build-types/navigator/navigator-button/hook.d.ts +53 -54
  379. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  380. package/build-types/navigator/navigator-to-parent-button/component.d.ts +2 -3
  381. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
  382. package/build-types/notice/index.d.ts.map +1 -1
  383. package/build-types/number-control/index.d.ts +3 -3
  384. package/build-types/number-control/stories/index.story.d.ts +3 -3
  385. package/build-types/palette-edit/styles.d.ts +4 -4
  386. package/build-types/palette-edit/styles.d.ts.map +1 -1
  387. package/build-types/placeholder/index.d.ts.map +1 -1
  388. package/build-types/popover/index.d.ts +1 -1
  389. package/build-types/popover/index.d.ts.map +1 -1
  390. package/build-types/popover/overlay-middlewares.d.ts +1 -1
  391. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  392. package/build-types/popover/types.d.ts +0 -4
  393. package/build-types/popover/types.d.ts.map +1 -1
  394. package/build-types/popover/utils.d.ts +2 -6
  395. package/build-types/popover/utils.d.ts.map +1 -1
  396. package/build-types/range-control/index.d.ts +1 -1
  397. package/build-types/range-control/styles/range-control-styles.d.ts +3 -3
  398. package/build-types/resizable-box/index.d.ts +1 -1
  399. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  400. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  401. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  402. package/build-types/scrollable/hook.d.ts +46 -46
  403. package/build-types/search-control/index.d.ts +4 -2
  404. package/build-types/search-control/index.d.ts.map +1 -1
  405. package/build-types/search-control/stories/index.story.d.ts +8 -4
  406. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  407. package/build-types/search-control/types.d.ts +12 -0
  408. package/build-types/search-control/types.d.ts.map +1 -1
  409. package/build-types/spacer/hook.d.ts +46 -46
  410. package/build-types/spinner/index.d.ts +1 -1
  411. package/build-types/surface/hook.d.ts +46 -46
  412. package/build-types/text/hook.d.ts +46 -46
  413. package/build-types/text/styles.d.ts.map +1 -1
  414. package/build-types/text-control/index.d.ts +3 -3
  415. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  416. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +2 -4
  417. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
  418. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +2 -4
  419. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  420. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -2
  421. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  422. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +1 -5
  423. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  424. package/build-types/toggle-group-control/toggle-group-control/utils.d.ts +18 -0
  425. package/build-types/toggle-group-control/toggle-group-control/utils.d.ts.map +1 -0
  426. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -1
  427. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +5 -1
  428. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  429. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +1 -0
  430. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  431. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  432. package/build-types/toggle-group-control/types.d.ts +13 -24
  433. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  434. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  435. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  436. package/build-types/toolbar/toolbar-button/index.d.ts +16 -22
  437. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  438. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +3 -1
  439. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -1
  440. package/build-types/toolbar/toolbar-group/index.d.ts +10 -14
  441. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -1
  442. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +3 -5
  443. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -1
  444. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +7 -5
  445. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -1
  446. package/build-types/toolbar/toolbar-group/types.d.ts +77 -0
  447. package/build-types/toolbar/toolbar-group/types.d.ts.map +1 -0
  448. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  449. package/build-types/tools-panel/tools-panel/hook.d.ts +46 -46
  450. package/build-types/tools-panel/tools-panel-header/hook.d.ts +46 -46
  451. package/build-types/tools-panel/tools-panel-item/hook.d.ts +46 -46
  452. package/build-types/tooltip/index.d.ts +8 -5
  453. package/build-types/tooltip/index.d.ts.map +1 -1
  454. package/build-types/tooltip/stories/index.story.d.ts +13 -0
  455. package/build-types/tooltip/stories/index.story.d.ts.map +1 -0
  456. package/build-types/tooltip/test/index.d.ts +2 -0
  457. package/build-types/tooltip/test/index.d.ts.map +1 -0
  458. package/build-types/tooltip/test/utils/index.d.ts +11 -0
  459. package/build-types/tooltip/test/utils/index.d.ts.map +1 -0
  460. package/build-types/tooltip/types.d.ts +61 -0
  461. package/build-types/tooltip/types.d.ts.map +1 -0
  462. package/build-types/truncate/hook.d.ts +46 -46
  463. package/build-types/ui/tooltip/content.d.ts +1 -1
  464. package/build-types/unit-control/index.d.ts +1 -1
  465. package/build-types/unit-control/index.d.ts.map +1 -1
  466. package/build-types/unit-control/styles/unit-control-styles.d.ts +3 -3
  467. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  468. package/build-types/unit-control/unit-select-control.d.ts +1 -1
  469. package/build-types/utils/use-deprecated-props.d.ts +1 -1
  470. package/build-types/v-stack/component.d.ts +1 -1
  471. package/build-types/v-stack/hook.d.ts +46 -46
  472. package/build-types/v-stack/stories/index.story.d.ts +2 -2
  473. package/package.json +19 -19
  474. package/src/animation/index.tsx +1 -0
  475. package/src/border-control/border-control/README.md +2 -2
  476. package/src/border-control/border-control-dropdown/component.tsx +1 -1
  477. package/src/border-control/styles.ts +7 -7
  478. package/src/border-control/test/index.js +79 -69
  479. package/src/box-control/unit-control.tsx +1 -1
  480. package/src/button/README.md +0 -6
  481. package/src/button/index.tsx +9 -1
  482. package/src/button/test/index.tsx +19 -0
  483. package/src/button/types.ts +0 -4
  484. package/src/circular-option-picker/README.md +14 -0
  485. package/src/circular-option-picker/circular-option-picker-actions.tsx +60 -0
  486. package/src/circular-option-picker/circular-option-picker-context.tsx +12 -0
  487. package/src/circular-option-picker/circular-option-picker-option-group.tsx +34 -0
  488. package/src/circular-option-picker/circular-option-picker-option.tsx +139 -0
  489. package/src/circular-option-picker/circular-option-picker.tsx +202 -0
  490. package/src/circular-option-picker/index.tsx +7 -174
  491. package/src/circular-option-picker/stories/index.story.tsx +34 -9
  492. package/src/circular-option-picker/style.scss +11 -7
  493. package/src/circular-option-picker/test/index.tsx +133 -0
  494. package/src/circular-option-picker/types.ts +64 -1
  495. package/src/color-palette/README.md +14 -0
  496. package/src/color-palette/index.tsx +69 -28
  497. package/src/color-palette/stories/index.story.tsx +16 -2
  498. package/src/color-palette/test/index.tsx +32 -30
  499. package/src/color-palette/types.ts +34 -1
  500. package/src/combobox-control/index.tsx +7 -5
  501. package/src/composite/{index.js → index.ts} +3 -0
  502. package/src/confirm-dialog/stories/index.story.js +13 -14
  503. package/src/confirm-dialog/test/index.js +10 -18
  504. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +1 -1
  505. package/src/custom-gradient-picker/gradient-bar/test/utils.ts +5 -5
  506. package/src/date-time/time/timezone.tsx +1 -1
  507. package/src/dropdown/README.md +13 -3
  508. package/src/dropdown/index.tsx +16 -34
  509. package/src/dropdown/stories/index.story.tsx +10 -7
  510. package/src/dropdown/types.ts +12 -4
  511. package/src/dropdown-menu/README.md +18 -0
  512. package/src/dropdown-menu/index.tsx +8 -1
  513. package/src/dropdown-menu/stories/index.story.tsx +5 -0
  514. package/src/dropdown-menu/types.ts +23 -6
  515. package/src/dropdown-menu-v2/styles.ts +1 -1
  516. package/src/duotone-picker/README.md +14 -0
  517. package/src/duotone-picker/color-list-picker/index.tsx +28 -12
  518. package/src/duotone-picker/duotone-picker.tsx +33 -0
  519. package/src/duotone-picker/types.ts +34 -1
  520. package/src/focusable-iframe/{index.js → index.tsx} +7 -4
  521. package/src/focusable-iframe/types.ts +9 -0
  522. package/src/form-token-field/README.md +1 -0
  523. package/src/form-token-field/index.tsx +5 -1
  524. package/src/form-token-field/style.scss +5 -9
  525. package/src/form-token-field/test/index.tsx +36 -1
  526. package/src/form-token-field/types.ts +7 -1
  527. package/src/gradient-picker/README.md +14 -0
  528. package/src/gradient-picker/index.tsx +60 -11
  529. package/src/gradient-picker/types.ts +34 -1
  530. package/src/higher-order/navigate-regions/index.tsx +5 -6
  531. package/src/higher-order/with-filters/test/index.tsx +36 -43
  532. package/src/higher-order/with-focus-outside/{index.js → index.tsx} +8 -5
  533. package/src/higher-order/with-focus-outside/test/{index.js → index.tsx} +13 -11
  534. package/src/higher-order/with-notices/test/index.tsx +1 -1
  535. package/src/higher-order/with-spoken-messages/index.tsx +7 -8
  536. package/src/index.ts +5 -1
  537. package/src/input-control/styles/input-control-styles.tsx +2 -2
  538. package/src/isolated-event-container/test/{index.js → index.tsx} +1 -1
  539. package/src/mobile/bottom-sheet/index.native.js +1 -0
  540. package/src/mobile/global-styles-context/index.native.js +7 -8
  541. package/src/modal/test/index.tsx +107 -0
  542. package/src/navigation/use-navigation-tree-nodes.tsx +1 -1
  543. package/src/notice/index.tsx +18 -6
  544. package/src/notice/style.scss +0 -1
  545. package/src/notice/test/__snapshots__/index.tsx.snap +9 -1
  546. package/src/palette-edit/styles.js +2 -1
  547. package/src/placeholder/index.tsx +1 -0
  548. package/src/placeholder/style.scss +2 -4
  549. package/src/popover/index.tsx +47 -110
  550. package/src/popover/test/index.tsx +3 -3
  551. package/src/popover/types.ts +0 -5
  552. package/src/popover/utils.ts +19 -67
  553. package/src/search-control/README.md +7 -0
  554. package/src/search-control/index.tsx +10 -1
  555. package/src/search-control/style.scss +14 -7
  556. package/src/search-control/types.ts +12 -0
  557. package/src/tab-panel/test/index.tsx +5 -0
  558. package/src/text/styles.js +2 -1
  559. package/src/theme/README.md +5 -5
  560. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +567 -59
  561. package/src/toggle-group-control/test/index.tsx +110 -56
  562. package/src/toggle-group-control/toggle-group-control/README.md +0 -1
  563. package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +39 -57
  564. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +52 -48
  565. package/src/toggle-group-control/toggle-group-control/component.tsx +12 -6
  566. package/src/toggle-group-control/toggle-group-control/styles.ts +2 -19
  567. package/src/toggle-group-control/toggle-group-control/utils.ts +50 -0
  568. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +70 -20
  569. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +17 -3
  570. package/src/toggle-group-control/types.ts +14 -32
  571. package/src/toolbar/stories/index.story.tsx +3 -5
  572. package/src/toolbar/test/toolbar-group.tsx +13 -7
  573. package/src/toolbar/toolbar/index.tsx +9 -1
  574. package/src/toolbar/toolbar-dropdown-menu/{index.js → index.tsx} +11 -4
  575. package/src/toolbar/toolbar-group/README.md +2 -2
  576. package/src/toolbar/toolbar-group/{index.js → index.tsx} +19 -14
  577. package/src/toolbar/toolbar-group/{toolbar-group-collapsed.js → toolbar-group-collapsed.tsx} +10 -4
  578. package/src/toolbar/toolbar-group/toolbar-group-container.tsx +16 -0
  579. package/src/toolbar/toolbar-group/types.ts +92 -0
  580. package/src/toolbar/toolbar-item/index.tsx +3 -1
  581. package/src/tooltip/README.md +31 -28
  582. package/src/tooltip/index.tsx +106 -0
  583. package/src/tooltip/stories/index.story.tsx +59 -0
  584. package/src/tooltip/style.scss +2 -27
  585. package/src/tooltip/test/index.tsx +335 -0
  586. package/src/tooltip/test/utils/index.tsx +20 -0
  587. package/src/tooltip/types.ts +61 -0
  588. package/src/ui/context/context-connect.ts +3 -3
  589. package/src/ui/context/wordpress-component.ts +4 -4
  590. package/src/unit-control/index.tsx +9 -4
  591. package/src/unit-control/styles/unit-control-styles.ts +3 -1
  592. package/src/unit-control/test/utils.ts +1 -1
  593. package/src/utils/colors-values.js +1 -1
  594. package/src/utils/use-deprecated-props.ts +1 -1
  595. package/tsconfig.tsbuildinfo +1 -1
  596. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +0 -78
  597. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +0 -1
  598. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +0 -76
  599. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +0 -1
  600. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts +0 -9
  601. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +0 -1
  602. package/src/color-palette/test/__snapshots__/index.tsx.snap +0 -288
  603. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +0 -84
  604. package/src/toolbar/toolbar-group/toolbar-group-container.js +0 -8
  605. package/src/tooltip/index.js +0 -293
  606. package/src/tooltip/stories/index.story.js +0 -85
  607. package/src/tooltip/test/index.js +0 -323
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","colord","useInstanceId","useEffect","useRef","useState","useMemo","__","sprintf","plus","Button","HStack","ColorPicker","VisuallyHidden","CustomColorPickerDropdown","addControlPoint","clampPercent","removeControlPoint","updateControlPointColor","updateControlPointColorByPosition","updateControlPointPosition","getHorizontalRelativeGradientPosition","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","createElement","Fragment","className","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","placement","offset","mergedClassName","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","onMouseMove","event","current","undefined","relativePosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","key","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","renderContent","enableAlpha","toRgbString","length","alignment","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","icon"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { HStack } from '../../h-stack';\nimport { ColorPicker } from '../../color-picker';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { CustomColorPickerDropdown } from '../../color-palette';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\nimport type { WordPressComponentProps } from '../../ui/context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\n\nfunction ControlPointButton( {\n\tisOpen,\n\tposition,\n\tcolor,\n\t...additionalProps\n}: WordPressComponentProps< ControlPointButtonProps, 'button', true > ) {\n\tconst instanceId = useInstanceId( ControlPointButton );\n\tconst descriptionId = `components-custom-gradient-picker__control-point-button-description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t// translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Gradient control point at position %1$s%% with color code %2$s.'\n\t\t\t\t\t),\n\t\t\t\t\tposition,\n\t\t\t\t\tcolor\n\t\t\t\t) }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'components-custom-gradient-picker__control-point-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isOpen,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nfunction GradientColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tclassName,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() =>\n\t\t\t( {\n\t\t\t\tplacement: 'bottom',\n\t\t\t\toffset: 8,\n\t\t\t} as const ),\n\t\t[]\n\t);\n\n\tconst mergedClassName = classnames(\n\t\t'components-custom-gradient-picker__control-point-dropdown',\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName={ mergedClassName }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n\t__experimentalIsRenderedInSidebar,\n}: ControlPointsProps ) {\n\tconst controlPointMoveState = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveState.current === undefined ||\n\t\t\tgradientPickerDomRef.current === null\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveState.current;\n\n\t\tif (\n\t\t\t! significantMoveHappened &&\n\t\t\tMath.abs( initialPosition - relativePosition ) >=\n\t\t\t\tMINIMUM_SIGNIFICANT_MOVE\n\t\t) {\n\t\t\tcontrolPointMoveState.current.significantMoveHappened = true;\n\t\t}\n\n\t\tonChange(\n\t\t\tupdateControlPointPosition( controlPoints, index, relativePosition )\n\t\t);\n\t};\n\n\tconst cleanEventListeners = () => {\n\t\tif (\n\t\t\twindow &&\n\t\t\twindow.removeEventListener &&\n\t\t\tcontrolPointMoveState.current &&\n\t\t\tcontrolPointMoveState.current.listenersActivated\n\t\t) {\n\t\t\twindow.removeEventListener( 'mousemove', onMouseMove );\n\t\t\twindow.removeEventListener( 'mouseup', cleanEventListeners );\n\t\t\tonStopControlPointChange();\n\t\t\tcontrolPointMoveState.current.listenersActivated = false;\n\t\t}\n\t};\n\n\t// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`\n\t// This memoization would prevent the event listeners from being properly cleaned.\n\t// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.\n\tconst cleanEventListenersRef = useRef< () => void >();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current?.();\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ controlPoints.map( ( point, index ) => {\n\t\t\t\tconst initialPosition = point?.position;\n\t\t\t\treturn (\n\t\t\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\t\t\tisRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current\n\t\t\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\twindow &&\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current = {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\t\t\tcleanEventListeners\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t\tevent.code === 'ArrowRight'\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolord(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor\n\t\t\t\t\t\t\t\t\t\t\t\t\t).toRgbString()\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ ! disableRemove &&\n\t\t\t\t\t\t\t\t\t\tcontrolPoints.length > 2 && (\n\t\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point-wrapper\"\n\t\t\t\t\t\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove Control Point'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nfunction InsertPoint( {\n\tvalue: controlPoints,\n\tonChange,\n\tonOpenInserter,\n\tonCloseInserter,\n\tinsertPosition,\n\tdisableAlpha,\n\t__experimentalIsRenderedInSidebar,\n}: InsertPointProps ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\tclassName=\"components-custom-gradient-picker__inserter\"\n\t\t\tonClose={ () => {\n\t\t\t\tonCloseInserter();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonCloseInserter();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( false );\n\t\t\t\t\t\t\tonOpenInserter();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"components-custom-gradient-picker__insert-point-dropdown\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\tstyle={\n\t\t\t\tinsertPosition !== null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,QAAQ,QAAQ;;AAE/B;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACzE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,yBAAyB,QAAQ,qBAAqB;AAE/D,SACCC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,uBAAuB,EACvBC,iCAAiC,EACjCC,0BAA0B,EAC1BC,qCAAqC,QAC/B,SAAS;AAChB,SACCC,wBAAwB,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,CAC7B,CACD,CAAC;UACDY,uBAAuB,CAAE,IAAK,CAAC;QAChC,CAAC,MAAM;UACN/C,QAAQ,CACP9B,iCAAiC,CAChC6B,aAAa,EACb8C,cAAc,EACd7F,MAAM,CAAE0B,KAAM,CAAC,CAACyD,WAAW,CAAC,CAC7B,CACD,CAAC;QACF;MACD;IAAG,CACH,CACC;IACHI,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAG,GAAGK,cAAgB,GAAE;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACDjC;EACH,CACD,CAAC;AAEJ;AACAf,aAAa,CAACiD,WAAW,GAAGA,WAAW;AAEvC,eAAejD,aAAa"}
1
+ {"version":3,"names":["classnames","colord","useInstanceId","useEffect","useRef","useState","useMemo","__","sprintf","plus","Button","HStack","ColorPicker","VisuallyHidden","CustomColorPickerDropdown","addControlPoint","clampPercent","removeControlPoint","updateControlPointColor","updateControlPointColorByPosition","updateControlPointPosition","getHorizontalRelativeGradientPosition","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","createElement","Fragment","className","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","placement","offset","mergedClassName","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","onMouseMove","event","current","undefined","relativePosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","key","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","renderContent","enableAlpha","toRgbString","length","alignment","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","icon"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { HStack } from '../../h-stack';\nimport { ColorPicker } from '../../color-picker';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { CustomColorPickerDropdown } from '../../color-palette';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\nimport type { WordPressComponentProps } from '../../ui/context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\n\nfunction ControlPointButton( {\n\tisOpen,\n\tposition,\n\tcolor,\n\t...additionalProps\n}: WordPressComponentProps< ControlPointButtonProps, 'button', true > ) {\n\tconst instanceId = useInstanceId( ControlPointButton );\n\tconst descriptionId = `components-custom-gradient-picker__control-point-button-description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t// translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Gradient control point at position %1$s%% with color code %2$s.'\n\t\t\t\t\t),\n\t\t\t\t\tposition,\n\t\t\t\t\tcolor\n\t\t\t\t) }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'components-custom-gradient-picker__control-point-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isOpen,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nfunction GradientColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tclassName,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() =>\n\t\t\t( {\n\t\t\t\tplacement: 'bottom',\n\t\t\t\toffset: 8,\n\t\t\t} ) as const,\n\t\t[]\n\t);\n\n\tconst mergedClassName = classnames(\n\t\t'components-custom-gradient-picker__control-point-dropdown',\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName={ mergedClassName }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n\t__experimentalIsRenderedInSidebar,\n}: ControlPointsProps ) {\n\tconst controlPointMoveState = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveState.current === undefined ||\n\t\t\tgradientPickerDomRef.current === null\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveState.current;\n\n\t\tif (\n\t\t\t! significantMoveHappened &&\n\t\t\tMath.abs( initialPosition - relativePosition ) >=\n\t\t\t\tMINIMUM_SIGNIFICANT_MOVE\n\t\t) {\n\t\t\tcontrolPointMoveState.current.significantMoveHappened = true;\n\t\t}\n\n\t\tonChange(\n\t\t\tupdateControlPointPosition( controlPoints, index, relativePosition )\n\t\t);\n\t};\n\n\tconst cleanEventListeners = () => {\n\t\tif (\n\t\t\twindow &&\n\t\t\twindow.removeEventListener &&\n\t\t\tcontrolPointMoveState.current &&\n\t\t\tcontrolPointMoveState.current.listenersActivated\n\t\t) {\n\t\t\twindow.removeEventListener( 'mousemove', onMouseMove );\n\t\t\twindow.removeEventListener( 'mouseup', cleanEventListeners );\n\t\t\tonStopControlPointChange();\n\t\t\tcontrolPointMoveState.current.listenersActivated = false;\n\t\t}\n\t};\n\n\t// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`\n\t// This memoization would prevent the event listeners from being properly cleaned.\n\t// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.\n\tconst cleanEventListenersRef = useRef< () => void >();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current?.();\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ controlPoints.map( ( point, index ) => {\n\t\t\t\tconst initialPosition = point?.position;\n\t\t\t\treturn (\n\t\t\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\t\t\tisRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current\n\t\t\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\twindow &&\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current = {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\t\t\tcleanEventListeners\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t\tevent.code === 'ArrowRight'\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolord(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor\n\t\t\t\t\t\t\t\t\t\t\t\t\t).toRgbString()\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ ! disableRemove &&\n\t\t\t\t\t\t\t\t\t\tcontrolPoints.length > 2 && (\n\t\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point-wrapper\"\n\t\t\t\t\t\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove Control Point'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nfunction InsertPoint( {\n\tvalue: controlPoints,\n\tonChange,\n\tonOpenInserter,\n\tonCloseInserter,\n\tinsertPosition,\n\tdisableAlpha,\n\t__experimentalIsRenderedInSidebar,\n}: InsertPointProps ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\tclassName=\"components-custom-gradient-picker__inserter\"\n\t\t\tonClose={ () => {\n\t\t\t\tonCloseInserter();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonCloseInserter();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( false );\n\t\t\t\t\t\t\tonOpenInserter();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"components-custom-gradient-picker__insert-point-dropdown\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\tstyle={\n\t\t\t\tinsertPosition !== null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,QAAQ,QAAQ;;AAE/B;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACzE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,yBAAyB,QAAQ,qBAAqB;AAE/D,SACCC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,uBAAuB,EACvBC,iCAAiC,EACjCC,0BAA0B,EAC1BC,qCAAqC,QAC/B,SAAS;AAChB,SACCC,wBAAwB,EACxBC,gCAAgC,QAC1B,aAAa;AAUpB,SAASC,kBAAkBA,CAAE;EAC5BC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACgE,CAAC,EAAG;EACvE,MAAMC,UAAU,GAAG3B,aAAa,CAAEsB,kBAAmB,CAAC;EACtD,MAAMM,aAAa,GAAI,uEAAuED,UAAY,EAAC;EAC3G,OACCE,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACrB,MAAM;IACN,cAAaF,OAAO;IACnB;I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,SAAS,EAAE;IACX,CAAC,GACDjC;EACH,CACD,CAAC;AAEJ;AACAf,aAAa,CAACiD,WAAW,GAAGA,WAAW;AAEvC,eAAejD,aAAa"}
@@ -32,7 +32,7 @@ const TimeZone = () => {
32
32
  const zoneAbbr = '' !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offset}`;
33
33
  const timezoneDetail = 'UTC' === timezone.string ? __('Coordinated Universal Time') : `(${zoneAbbr}) ${timezone.string.replace('_', ' ')}`;
34
34
  return createElement(Tooltip, {
35
- position: "top center",
35
+ placement: "top",
36
36
  text: timezoneDetail
37
37
  }, createElement(StyledComponent, {
38
38
  className: "components-datetime__timezone"
@@ -1 +1 @@
1
- {"version":3,"names":["__","getSettings","getDateSettings","Tooltip","TimeZone","StyledComponent","timezone","userTimezoneOffset","Date","getTimezoneOffset","Number","offset","offsetSymbol","zoneAbbr","abbr","isNaN","timezoneDetail","string","replace","createElement","position","text","className"],"sources":["@wordpress/components/src/date-time/time/timezone.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { getSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../../tooltip';\nimport { TimeZone as StyledComponent } from './styles';\n\n/**\n * Displays timezone information when user timezone is different from site\n * timezone.\n */\nconst TimeZone = () => {\n\tconst { timezone } = getDateSettings();\n\n\t// Convert timezone offset to hours.\n\tconst userTimezoneOffset = -1 * ( new Date().getTimezoneOffset() / 60 );\n\n\t// System timezone and user timezone match, nothing needed.\n\t// Compare as numbers because it comes over as string.\n\tif ( Number( timezone.offset ) === userTimezoneOffset ) {\n\t\treturn null;\n\t}\n\n\tconst offsetSymbol = Number( timezone.offset ) >= 0 ? '+' : '';\n\tconst zoneAbbr =\n\t\t'' !== timezone.abbr && isNaN( Number( timezone.abbr ) )\n\t\t\t? timezone.abbr\n\t\t\t: `UTC${ offsetSymbol }${ timezone.offset }`;\n\n\tconst timezoneDetail =\n\t\t'UTC' === timezone.string\n\t\t\t? __( 'Coordinated Universal Time' )\n\t\t\t: `(${ zoneAbbr }) ${ timezone.string.replace( '_', ' ' ) }`;\n\n\treturn (\n\t\t<Tooltip position=\"top center\" text={ timezoneDetail }>\n\t\t\t<StyledComponent className=\"components-datetime__timezone\">\n\t\t\t\t{ zoneAbbr }\n\t\t\t</StyledComponent>\n\t\t</Tooltip>\n\t);\n};\n\nexport default TimeZone;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,eAAe,QAAQ,iBAAiB;;AAEhE;AACA;AACA;AACA,OAAOC,OAAO,MAAM,eAAe;AACnC,SAASC,QAAQ,IAAIC,eAAe,QAAQ,UAAU;;AAEtD;AACA;AACA;AACA;AACA,MAAMD,QAAQ,GAAGA,CAAA,KAAM;EACtB,MAAM;IAAEE;EAAS,CAAC,GAAGJ,eAAe,CAAC,CAAC;;EAEtC;EACA,MAAMK,kBAAkB,GAAG,CAAC,CAAC,IAAK,IAAIC,IAAI,CAAC,CAAC,CAACC,iBAAiB,CAAC,CAAC,GAAG,EAAE,CAAE;;EAEvE;EACA;EACA,IAAKC,MAAM,CAAEJ,QAAQ,CAACK,MAAO,CAAC,KAAKJ,kBAAkB,EAAG;IACvD,OAAO,IAAI;EACZ;EAEA,MAAMK,YAAY,GAAGF,MAAM,CAAEJ,QAAQ,CAACK,MAAO,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE;EAC9D,MAAME,QAAQ,GACb,EAAE,KAAKP,QAAQ,CAACQ,IAAI,IAAIC,KAAK,CAAEL,MAAM,CAAEJ,QAAQ,CAACQ,IAAK,CAAE,CAAC,GACrDR,QAAQ,CAACQ,IAAI,GACZ,MAAMF,YAAc,GAAGN,QAAQ,CAACK,MAAQ,EAAC;EAE9C,MAAMK,cAAc,GACnB,KAAK,KAAKV,QAAQ,CAACW,MAAM,GACtBjB,EAAE,CAAE,4BAA6B,CAAC,GACjC,IAAIa,QAAU,KAAKP,QAAQ,CAACW,MAAM,CAACC,OAAO,CAAE,GAAG,EAAE,GAAI,CAAG,EAAC;EAE9D,OACCC,aAAA,CAAChB,OAAO;IAACiB,QAAQ,EAAC,YAAY;IAACC,IAAI,EAAGL;EAAgB,GACrDG,aAAA,CAACd,eAAe;IAACiB,SAAS,EAAC;EAA+B,GACvDT,QACc,CACT,CAAC;AAEZ,CAAC;AAED,eAAeT,QAAQ"}
1
+ {"version":3,"names":["__","getSettings","getDateSettings","Tooltip","TimeZone","StyledComponent","timezone","userTimezoneOffset","Date","getTimezoneOffset","Number","offset","offsetSymbol","zoneAbbr","abbr","isNaN","timezoneDetail","string","replace","createElement","placement","text","className"],"sources":["@wordpress/components/src/date-time/time/timezone.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { getSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../../tooltip';\nimport { TimeZone as StyledComponent } from './styles';\n\n/**\n * Displays timezone information when user timezone is different from site\n * timezone.\n */\nconst TimeZone = () => {\n\tconst { timezone } = getDateSettings();\n\n\t// Convert timezone offset to hours.\n\tconst userTimezoneOffset = -1 * ( new Date().getTimezoneOffset() / 60 );\n\n\t// System timezone and user timezone match, nothing needed.\n\t// Compare as numbers because it comes over as string.\n\tif ( Number( timezone.offset ) === userTimezoneOffset ) {\n\t\treturn null;\n\t}\n\n\tconst offsetSymbol = Number( timezone.offset ) >= 0 ? '+' : '';\n\tconst zoneAbbr =\n\t\t'' !== timezone.abbr && isNaN( Number( timezone.abbr ) )\n\t\t\t? timezone.abbr\n\t\t\t: `UTC${ offsetSymbol }${ timezone.offset }`;\n\n\tconst timezoneDetail =\n\t\t'UTC' === timezone.string\n\t\t\t? __( 'Coordinated Universal Time' )\n\t\t\t: `(${ zoneAbbr }) ${ timezone.string.replace( '_', ' ' ) }`;\n\n\treturn (\n\t\t<Tooltip placement=\"top\" text={ timezoneDetail }>\n\t\t\t<StyledComponent className=\"components-datetime__timezone\">\n\t\t\t\t{ zoneAbbr }\n\t\t\t</StyledComponent>\n\t\t</Tooltip>\n\t);\n};\n\nexport default TimeZone;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,eAAe,QAAQ,iBAAiB;;AAEhE;AACA;AACA;AACA,OAAOC,OAAO,MAAM,eAAe;AACnC,SAASC,QAAQ,IAAIC,eAAe,QAAQ,UAAU;;AAEtD;AACA;AACA;AACA;AACA,MAAMD,QAAQ,GAAGA,CAAA,KAAM;EACtB,MAAM;IAAEE;EAAS,CAAC,GAAGJ,eAAe,CAAC,CAAC;;EAEtC;EACA,MAAMK,kBAAkB,GAAG,CAAC,CAAC,IAAK,IAAIC,IAAI,CAAC,CAAC,CAACC,iBAAiB,CAAC,CAAC,GAAG,EAAE,CAAE;;EAEvE;EACA;EACA,IAAKC,MAAM,CAAEJ,QAAQ,CAACK,MAAO,CAAC,KAAKJ,kBAAkB,EAAG;IACvD,OAAO,IAAI;EACZ;EAEA,MAAMK,YAAY,GAAGF,MAAM,CAAEJ,QAAQ,CAACK,MAAO,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE;EAC9D,MAAME,QAAQ,GACb,EAAE,KAAKP,QAAQ,CAACQ,IAAI,IAAIC,KAAK,CAAEL,MAAM,CAAEJ,QAAQ,CAACQ,IAAK,CAAE,CAAC,GACrDR,QAAQ,CAACQ,IAAI,GACZ,MAAMF,YAAc,GAAGN,QAAQ,CAACK,MAAQ,EAAC;EAE9C,MAAMK,cAAc,GACnB,KAAK,KAAKV,QAAQ,CAACW,MAAM,GACtBjB,EAAE,CAAE,4BAA6B,CAAC,GACjC,IAAIa,QAAU,KAAKP,QAAQ,CAACW,MAAM,CAACC,OAAO,CAAE,GAAG,EAAE,GAAI,CAAG,EAAC;EAE9D,OACCC,aAAA,CAAChB,OAAO;IAACiB,SAAS,EAAC,KAAK;IAACC,IAAI,EAAGL;EAAgB,GAC/CG,aAAA,CAACd,eAAe;IAACiB,SAAS,EAAC;EAA+B,GACvDT,QACc,CACT,CAAC;AAEZ,CAAC;AAED,eAAeT,QAAQ"}
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useEffect, useRef, useState } from '@wordpress/element';
9
+ import { useRef, useState } from '@wordpress/element';
10
10
  import { useMergeRefs } from '@wordpress/compose';
11
11
  import deprecated from '@wordpress/deprecated';
12
12
 
@@ -14,16 +14,8 @@ import deprecated from '@wordpress/deprecated';
14
14
  * Internal dependencies
15
15
  */
16
16
  import { contextConnect, useContextSystem } from '../ui/context';
17
+ import { useControlledValue } from '../utils/hooks';
17
18
  import Popover from '../popover';
18
- function useObservableState(initialState, onStateChange) {
19
- const [state, setState] = useState(initialState);
20
- return [state, value => {
21
- setState(value);
22
- if (onStateChange) {
23
- onStateChange(value);
24
- }
25
- }];
26
- }
27
19
  const UnconnectedDropdown = (props, forwardedRef) => {
28
20
  const {
29
21
  renderContent,
@@ -37,6 +29,8 @@ const UnconnectedDropdown = (props, forwardedRef) => {
37
29
  onClose,
38
30
  onToggle,
39
31
  style,
32
+ open,
33
+ defaultOpen,
40
34
  // Deprecated props
41
35
  position,
42
36
  // From context system
@@ -54,15 +48,11 @@ const UnconnectedDropdown = (props, forwardedRef) => {
54
48
  // re-renders when the popover's anchor updates.
55
49
  const [fallbackPopoverAnchor, setFallbackPopoverAnchor] = useState(null);
56
50
  const containerRef = useRef();
57
- const [isOpen, setIsOpen] = useObservableState(false, onToggle);
58
- useEffect(() => () => {
59
- if (onToggle && isOpen) {
60
- onToggle(false);
61
- }
62
- }, [onToggle, isOpen]);
63
- function toggle() {
64
- setIsOpen(!isOpen);
65
- }
51
+ const [isOpen, setIsOpen] = useControlledValue({
52
+ defaultValue: defaultOpen,
53
+ value: open,
54
+ onChange: onToggle
55
+ });
66
56
 
67
57
  /**
68
58
  * Closes the popover when focus leaves it unless the toggle was pressed or
@@ -83,14 +73,12 @@ const UnconnectedDropdown = (props, forwardedRef) => {
83
73
  }
84
74
  }
85
75
  function close() {
86
- if (onClose) {
87
- onClose();
88
- }
76
+ onClose?.();
89
77
  setIsOpen(false);
90
78
  }
91
79
  const args = {
92
- isOpen,
93
- onToggle: toggle,
80
+ isOpen: !!isOpen,
81
+ onToggle: () => setIsOpen(!isOpen),
94
82
  onClose: close
95
83
  };
96
84
  const popoverPropsHaveAnchor = !!popoverProps?.anchor ||
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useEffect","useRef","useState","useMergeRefs","deprecated","contextConnect","useContextSystem","Popover","useObservableState","initialState","onStateChange","state","setState","value","UnconnectedDropdown","props","forwardedRef","renderContent","renderToggle","className","contentClassName","expandOnMobile","headerTitle","focusOnMount","popoverProps","onClose","onToggle","style","position","variant","undefined","since","alternative","hint","fallbackPopoverAnchor","setFallbackPopoverAnchor","containerRef","isOpen","setIsOpen","toggle","closeIfFocusOutside","current","ownerDocument","dialog","activeElement","closest","contains","close","args","popoverPropsHaveAnchor","anchor","anchorRef","getAnchorRect","anchorRect","createElement","ref","tabIndex","onFocusOutside","offset","Dropdown"],"sources":["@wordpress/components/src/dropdown/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, useContextSystem } from '../ui/context';\nimport Popover from '../popover';\nimport type { DropdownProps, DropdownInternalContext } from './types';\n\nfunction useObservableState(\n\tinitialState: boolean,\n\tonStateChange?: ( newState: boolean ) => void\n) {\n\tconst [ state, setState ] = useState( initialState );\n\treturn [\n\t\tstate,\n\t\t( value: boolean ) => {\n\t\t\tsetState( value );\n\t\t\tif ( onStateChange ) {\n\t\t\t\tonStateChange( value );\n\t\t\t}\n\t\t},\n\t] as const;\n}\n\nconst UnconnectedDropdown = (\n\tprops: DropdownProps,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\trenderContent,\n\t\trenderToggle,\n\t\tclassName,\n\t\tcontentClassName,\n\t\texpandOnMobile,\n\t\theaderTitle,\n\t\tfocusOnMount,\n\t\tpopoverProps,\n\t\tonClose,\n\t\tonToggle,\n\t\tstyle,\n\n\t\t// Deprecated props\n\t\tposition,\n\n\t\t// From context system\n\t\tvariant,\n\t} = useContextSystem< DropdownProps & DropdownInternalContext >(\n\t\tprops,\n\t\t'Dropdown'\n\t);\n\n\tif ( position !== undefined ) {\n\t\tdeprecated( '`position` prop in wp.components.Dropdown', {\n\t\t\tsince: '6.2',\n\t\t\talternative: '`popoverProps.placement` prop',\n\t\t\thint: 'Note that the `position` prop will override any values passed through the `popoverProps.placement` prop.',\n\t\t} );\n\t}\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ fallbackPopoverAnchor, setFallbackPopoverAnchor ] =\n\t\tuseState< HTMLDivElement | null >( null );\n\tconst containerRef = useRef< HTMLDivElement >();\n\tconst [ isOpen, setIsOpen ] = useObservableState( false, onToggle );\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tif ( onToggle && isOpen ) {\n\t\t\t\tonToggle( false );\n\t\t\t}\n\t\t},\n\t\t[ onToggle, isOpen ]\n\t);\n\n\tfunction toggle() {\n\t\tsetIsOpen( ! isOpen );\n\t}\n\n\t/**\n\t * Closes the popover when focus leaves it unless the toggle was pressed or\n\t * focus has moved to a separate dialog. The former is to let the toggle\n\t * handle closing the popover and the latter is to preserve presence in\n\t * case a dialog has opened, allowing focus to return when it's dismissed.\n\t */\n\tfunction closeIfFocusOutside() {\n\t\tif ( ! containerRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = containerRef.current;\n\t\tconst dialog =\n\t\t\townerDocument?.activeElement?.closest( '[role=\"dialog\"]' );\n\t\tif (\n\t\t\t! containerRef.current.contains( ownerDocument.activeElement ) &&\n\t\t\t( ! dialog || dialog.contains( containerRef.current ) )\n\t\t) {\n\t\t\tclose();\n\t\t}\n\t}\n\n\tfunction close() {\n\t\tif ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\t\tsetIsOpen( false );\n\t}\n\n\tconst args = { isOpen, onToggle: toggle, onClose: close };\n\tconst popoverPropsHaveAnchor =\n\t\t!! popoverProps?.anchor ||\n\t\t// Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and\n\t\t// be removed from `Popover` from WordPress 6.3\n\t\t!! popoverProps?.anchorRef ||\n\t\t!! popoverProps?.getAnchorRect ||\n\t\t!! popoverProps?.anchorRect;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ className }\n\t\t\tref={ useMergeRefs( [\n\t\t\t\tcontainerRef,\n\t\t\t\tforwardedRef,\n\t\t\t\tsetFallbackPopoverAnchor,\n\t\t\t] ) }\n\t\t\t// Some UAs focus the closest focusable parent when the toggle is\n\t\t\t// clicked. Making this div focusable ensures such UAs will focus\n\t\t\t// it and `closeIfFocusOutside` can tell if the toggle was clicked.\n\t\t\ttabIndex={ -1 }\n\t\t\tstyle={ style }\n\t\t>\n\t\t\t{ renderToggle( args ) }\n\t\t\t{ isOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tposition={ position }\n\t\t\t\t\tonClose={ close }\n\t\t\t\t\tonFocusOutside={ closeIfFocusOutside }\n\t\t\t\t\texpandOnMobile={ expandOnMobile }\n\t\t\t\t\theaderTitle={ headerTitle }\n\t\t\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t\t\t// This value is used to ensure that the dropdowns\n\t\t\t\t\t// align with the editor header by default.\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t\tanchor={\n\t\t\t\t\t\t! popoverPropsHaveAnchor\n\t\t\t\t\t\t\t? fallbackPopoverAnchor\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tvariant={ variant }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'components-dropdown__content',\n\t\t\t\t\t\tpopoverProps?.className,\n\t\t\t\t\t\tcontentClassName\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ renderContent( args ) }\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\n/**\n * Renders a button that opens a floating content modal when clicked.\n *\n * ```jsx\n * import { Button, Dropdown } from '@wordpress/components';\n *\n * const MyDropdown = () => (\n * <Dropdown\n * className=\"my-container-class-name\"\n * contentClassName=\"my-dropdown-content-classname\"\n * popoverProps={ { placement: 'bottom-start' } }\n * renderToggle={ ( { isOpen, onToggle } ) => (\n * <Button\n * variant=\"primary\"\n * onClick={ onToggle }\n * aria-expanded={ isOpen }\n * >\n * Toggle Dropdown!\n * </Button>\n * ) }\n * renderContent={ () => <div>This is the content of the dropdown.</div> }\n * />\n * );\n * ```\n */\nexport const Dropdown = contextConnect( UnconnectedDropdown, 'Dropdown' );\n\nexport default Dropdown;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AAGnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,SAASC,YAAY,QAAQ,oBAAoB;AACjD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,eAAe;AAChE,OAAOC,OAAO,MAAM,YAAY;AAGhC,SAASC,kBAAkBA,CAC1BC,YAAqB,EACrBC,aAA6C,EAC5C;EACD,MAAM,CAAEC,KAAK,EAAEC,QAAQ,CAAE,GAAGV,QAAQ,CAAEO,YAAa,CAAC;EACpD,OAAO,CACNE,KAAK,EACHE,KAAc,IAAM;IACrBD,QAAQ,CAAEC,KA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ACrBJ,SACH;IACDD,OAAO,EAAGA,OAAS;IAAA,GACdL,YAAY;IACjBL,SAAS,EAAGpB,UAAU,CACrB,8BAA8B,EAC9ByB,YAAY,EAAEL,SAAS,EACvBC,gBACD;EAAG,GAEDH,aAAa,CAAE+B,IAAK,CACd,CAEN,CAAC;AAER,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMW,QAAQ,GAAGtD,cAAc,CAAES,mBAAmB,EAAE,UAAW,CAAC;AAEzE,eAAe6C,QAAQ"}
1
+ {"version":3,"names":["classnames","useRef","useState","useMergeRefs","deprecated","contextConnect","useContextSystem","useControlledValue","Popover","UnconnectedDropdown","props","forwardedRef","renderContent","renderToggle","className","contentClassName","expandOnMobile","headerTitle","focusOnMount","popoverProps","onClose","onToggle","style","open","defaultOpen","position","variant","undefined","since","alternative","hint","fallbackPopoverAnchor","setFallbackPopoverAnchor","containerRef","isOpen","setIsOpen","defaultValue","value","onChange","closeIfFocusOutside","current","ownerDocument","dialog","activeElement","closest","contains","close","args","popoverPropsHaveAnchor","anchor","anchorRef","getAnchorRect","anchorRect","createElement","ref","tabIndex","onFocusOutside","offset","Dropdown"],"sources":["@wordpress/components/src/dropdown/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useState } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, useContextSystem } from '../ui/context';\nimport { useControlledValue } from '../utils/hooks';\nimport Popover from '../popover';\nimport type { DropdownProps, DropdownInternalContext } from './types';\n\nconst UnconnectedDropdown = (\n\tprops: DropdownProps,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\trenderContent,\n\t\trenderToggle,\n\t\tclassName,\n\t\tcontentClassName,\n\t\texpandOnMobile,\n\t\theaderTitle,\n\t\tfocusOnMount,\n\t\tpopoverProps,\n\t\tonClose,\n\t\tonToggle,\n\t\tstyle,\n\n\t\topen,\n\t\tdefaultOpen,\n\n\t\t// Deprecated props\n\t\tposition,\n\n\t\t// From context system\n\t\tvariant,\n\t} = useContextSystem< DropdownProps & DropdownInternalContext >(\n\t\tprops,\n\t\t'Dropdown'\n\t);\n\n\tif ( position !== undefined ) {\n\t\tdeprecated( '`position` prop in wp.components.Dropdown', {\n\t\t\tsince: '6.2',\n\t\t\talternative: '`popoverProps.placement` prop',\n\t\t\thint: 'Note that the `position` prop will override any values passed through the `popoverProps.placement` prop.',\n\t\t} );\n\t}\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ fallbackPopoverAnchor, setFallbackPopoverAnchor ] =\n\t\tuseState< HTMLDivElement | null >( null );\n\tconst containerRef = useRef< HTMLDivElement >();\n\n\tconst [ isOpen, setIsOpen ] = useControlledValue( {\n\t\tdefaultValue: defaultOpen,\n\t\tvalue: open,\n\t\tonChange: onToggle,\n\t} );\n\n\t/**\n\t * Closes the popover when focus leaves it unless the toggle was pressed or\n\t * focus has moved to a separate dialog. The former is to let the toggle\n\t * handle closing the popover and the latter is to preserve presence in\n\t * case a dialog has opened, allowing focus to return when it's dismissed.\n\t */\n\tfunction closeIfFocusOutside() {\n\t\tif ( ! containerRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = containerRef.current;\n\t\tconst dialog =\n\t\t\townerDocument?.activeElement?.closest( '[role=\"dialog\"]' );\n\t\tif (\n\t\t\t! containerRef.current.contains( ownerDocument.activeElement ) &&\n\t\t\t( ! dialog || dialog.contains( containerRef.current ) )\n\t\t) {\n\t\t\tclose();\n\t\t}\n\t}\n\n\tfunction close() {\n\t\tonClose?.();\n\t\tsetIsOpen( false );\n\t}\n\n\tconst args = {\n\t\tisOpen: !! isOpen,\n\t\tonToggle: () => setIsOpen( ! isOpen ),\n\t\tonClose: close,\n\t};\n\tconst popoverPropsHaveAnchor =\n\t\t!! popoverProps?.anchor ||\n\t\t// Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and\n\t\t// be removed from `Popover` from WordPress 6.3\n\t\t!! popoverProps?.anchorRef ||\n\t\t!! popoverProps?.getAnchorRect ||\n\t\t!! popoverProps?.anchorRect;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ className }\n\t\t\tref={ useMergeRefs( [\n\t\t\t\tcontainerRef,\n\t\t\t\tforwardedRef,\n\t\t\t\tsetFallbackPopoverAnchor,\n\t\t\t] ) }\n\t\t\t// Some UAs focus the closest focusable parent when the toggle is\n\t\t\t// clicked. Making this div focusable ensures such UAs will focus\n\t\t\t// it and `closeIfFocusOutside` can tell if the toggle was clicked.\n\t\t\ttabIndex={ -1 }\n\t\t\tstyle={ style }\n\t\t>\n\t\t\t{ renderToggle( args ) }\n\t\t\t{ isOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tposition={ position }\n\t\t\t\t\tonClose={ close }\n\t\t\t\t\tonFocusOutside={ closeIfFocusOutside }\n\t\t\t\t\texpandOnMobile={ expandOnMobile }\n\t\t\t\t\theaderTitle={ headerTitle }\n\t\t\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t\t\t// This value is used to ensure that the dropdowns\n\t\t\t\t\t// align with the editor header by default.\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t\tanchor={\n\t\t\t\t\t\t! popoverPropsHaveAnchor\n\t\t\t\t\t\t\t? fallbackPopoverAnchor\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tvariant={ variant }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'components-dropdown__content',\n\t\t\t\t\t\tpopoverProps?.className,\n\t\t\t\t\t\tcontentClassName\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ renderContent( args ) }\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\n/**\n * Renders a button that opens a floating content modal when clicked.\n *\n * ```jsx\n * import { Button, Dropdown } from '@wordpress/components';\n *\n * const MyDropdown = () => (\n * <Dropdown\n * className=\"my-container-class-name\"\n * contentClassName=\"my-dropdown-content-classname\"\n * popoverProps={ { placement: 'bottom-start' } }\n * renderToggle={ ( { isOpen, onToggle } ) => (\n * <Button\n * variant=\"primary\"\n * onClick={ onToggle }\n * aria-expanded={ isOpen }\n * >\n * Toggle Dropdown!\n * </Button>\n * ) }\n * renderContent={ () => <div>This is the content of the dropdown.</div> }\n * />\n * );\n * ```\n */\nexport const Dropdown = contextConnect( UnconnectedDropdown, 'Dropdown' );\n\nexport default Dropdown;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AAGnC;AACA;AACA;AACA,SAASC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AACrD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,eAAe;AAChE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,OAAOC,OAAO,MAAM,YAAY;AAGhC,MAAMC,mBAAmB,GAAGA,CAC3BC,KAAoB,EACpBC,YAAiC,KAC7B;EACJ,MAAM;IACLC,aAAa;IACbC,YAAY;IACZC,SAAS;IACTC,gBAAgB;IAChBC,cAAc;IACdC,WAAW;IACXC,YAAY;IACZC,YAAY;IACZC,OAAO;IACPC,QAAQ;IACRC,KAAK;IAELC,IAAI;IACJC,WAAW;IAEX;IACAC,QAAQ;IAER;IACAC;EACD,CAAC,GAAGpB,gBAAgB,CACnBI,KAAK,EACL,UACD,CAAC;EAED,IAAKe,QAAQ,KAAKE,SAAS,EAAG;IAC7BvB,UAAU,CAAE,2CAA2C,E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,SAAS,IAC1B,CAAC,CAAE/B,YAAY,EAAEgC,aAAa,IAC9B,CAAC,CAAEhC,YAAY,EAAEiC,UAAU;EAE5B,OACCC,aAAA;IACCvC,SAAS,EAAGA,SAAW;IACvBwC,GAAG,EAAGnD,YAAY,CAAE,CACnB8B,YAAY,EACZtB,YAAY,EACZqB,wBAAwB,CACvB;IACF;IACA;IACA;IAAA;IACAuB,QAAQ,EAAG,CAAC,CAAG;IACfjC,KAAK,EAAGA;EAAO,GAEbT,YAAY,CAAEkC,IAAK,CAAC,EACpBb,MAAM,IACPmB,aAAA,CAAC7C,OAAO;IACPiB,QAAQ,EAAGA,QAAU;IACrBL,OAAO,EAAG0B,KAAO;IACjBU,cAAc,EAAGjB,mBAAqB;IACtCvB,cAAc,EAAGA,cAAgB;IACjCC,WAAW,EAAGA,WAAa;IAC3BC,YAAY,EAAGA;IACf;IACA;IAAA;IACAuC,MAAM,EAAG,EAAI;IACbR,MAAM,EACL,CAAED,sBAAsB,GACrBjB,qBAAqB,GACrBJ,SACH;IACDD,OAAO,EAAGA,OAAS;IAAA,GACdP,YAAY;IACjBL,SAAS,EAAGd,UAAU,CACrB,8BAA8B,EAC9BmB,YAAY,EAAEL,SAAS,EACvBC,gBACD;EAAG,GAEDH,aAAa,CAAEmC,IAAK,CACd,CAEN,CAAC;AAER,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMW,QAAQ,GAAGrD,cAAc,CAAEI,mBAAmB,EAAE,UAAW,CAAC;AAEzE,eAAeiD,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/dropdown/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type Popover from '../popover';\nimport type { PopoverProps } from '../popover/types';\n\ntype CallbackProps = {\n\tisOpen: boolean;\n\tonToggle: () => void;\n\tonClose: () => void;\n};\n\nexport type DropdownContentWrapperProps = {\n\t/**\n\t * Amount of padding to apply on the dropdown content.\n\t *\n\t * @default 'small'\n\t */\n\tpaddingSize?: 'none' | 'small' | 'medium';\n};\n\nexport type DropdownProps = {\n\t/**\n\t * The className of the global container.\n\t */\n\tclassName?: string;\n\t/**\n\t * If you want to target the dropdown menu for styling purposes,\n\t * you need to provide a contentClassName because it's not being rendered\n\t * as a child of the container node.\n\t */\n\tcontentClassName?: string;\n\t/**\n\t * Opt-in prop to show popovers fullscreen on mobile.\n\t *\n\t * @default false\n\t */\n\texpandOnMobile?: boolean;\n\t/**\n\t * By default, the first tabbable element in the popover will receive focus\n\t * when it mounts. This is the same as setting this prop to \"firstElement\".\n\t * Specifying a true value will focus the container instead.\n\t * Specifying a false value disables the focus handling entirely\n\t * (this should only be done when an appropriately accessible\n\t * substitute behavior exists).\n\t *\n\t * @default 'firstElement'\n\t */\n\tfocusOnMount?: 'firstElement' | boolean;\n\t/**\n\t * Set this to customize the text that is shown in the dropdown's header\n\t * when it is fullscreen on mobile.\n\t */\n\theaderTitle?: string;\n\t/**\n\t * A callback invoked when the popover should be closed.\n\t */\n\tonClose?: () => void;\n\t/**\n\t * A callback invoked when the state of the popover changes\n\t * from open to closed and vice versa.\n\t * The callback receives a boolean as a parameter.\n\t * If true, the popover will open.\n\t * If false, the popover will close.\n\t */\n\tonToggle?: ( willOpen: boolean ) => void;\n\t/**\n\t * Properties of popoverProps object will be passed as props\n\t * to the Popover component.\n\t * Use this object to access properties/features\n\t * of the Popover component that are not already exposed\n\t * in the Dropdown component,\n\t * e.g.: the ability to have the popover without an arrow.\n\t */\n\tpopoverProps?: Omit<\n\t\tComponentPropsWithoutRef< typeof Popover >,\n\t\t'children'\n\t>;\n\t/**\n\t * A callback invoked to render the content of the dropdown menu.\n\t * Its first argument is the same as the renderToggle prop.\n\t */\n\trenderContent: ( props: CallbackProps ) => ReactNode;\n\t/**\n\t * A callback invoked to render the Dropdown Toggle Button.\n\t *\n\t * The first argument of the callback is an object\n\t * containing the following properties:\n\t *\n\t * - isOpen: whether the dropdown menu is opened or not\n\t * - onToggle: A function switching the dropdown menu's state\n\t * from open to closed and vice versa\n\t * - onClose: A function that closes the menu if invoked\n\t */\n\trenderToggle: ( props: CallbackProps ) => ReactNode;\n\t/**\n\t * The style of the global container.\n\t */\n\tstyle?: CSSProperties;\n\t/**\n\t * Legacy way to specify the popover's position with respect to its anchor.\n\t * For details about the possible values, see the `Popover` component's docs.\n\t * _Note: this prop is deprecated. Use the `popoverProps.placement` prop\n\t * instead._\n\t *\n\t * @deprecated\n\t */\n\tposition?: PopoverProps[ 'position' ];\n};\n\nexport type DropdownInternalContext = {\n\t/**\n\t * This variant can be used to change the appearance of the component in\n\t * specific contexts, ie. when rendered inside the `Toolbar` component.\n\t */\n\tvariant?: 'toolbar';\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/dropdown/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type Popover from '../popover';\nimport type { PopoverProps } from '../popover/types';\n\ntype CallbackProps = {\n\tisOpen: boolean;\n\tonToggle: () => void;\n\tonClose: () => void;\n};\n\nexport type DropdownContentWrapperProps = {\n\t/**\n\t * Amount of padding to apply on the dropdown content.\n\t *\n\t * @default 'small'\n\t */\n\tpaddingSize?: 'none' | 'small' | 'medium';\n};\n\nexport type DropdownProps = {\n\t/**\n\t * The className of the global container.\n\t */\n\tclassName?: string;\n\t/**\n\t * If you want to target the dropdown menu for styling purposes,\n\t * you need to provide a contentClassName because it's not being rendered\n\t * as a child of the container node.\n\t */\n\tcontentClassName?: string;\n\t/**\n\t * Opt-in prop to show popovers fullscreen on mobile.\n\t *\n\t * @default false\n\t */\n\texpandOnMobile?: boolean;\n\t/**\n\t * By default, the first tabbable element in the popover will receive focus\n\t * when it mounts. This is the same as setting this prop to \"firstElement\".\n\t * Specifying a true value will focus the container instead.\n\t * Specifying a false value disables the focus handling entirely\n\t * (this should only be done when an appropriately accessible\n\t * substitute behavior exists).\n\t *\n\t * @default 'firstElement'\n\t */\n\tfocusOnMount?: 'firstElement' | boolean;\n\t/**\n\t * Set this to customize the text that is shown in the dropdown's header\n\t * when it is fullscreen on mobile.\n\t */\n\theaderTitle?: string;\n\t/**\n\t * A callback invoked when the popover should be closed.\n\t */\n\tonClose?: () => void;\n\t/**\n\t * A callback invoked when the state of the dropdown changes\n\t * from open to closed and vice versa.\n\t */\n\tonToggle?: ( willOpen: boolean ) => void;\n\t/**\n\t * Properties of popoverProps object will be passed as props\n\t * to the Popover component.\n\t * Use this object to access properties/features\n\t * of the Popover component that are not already exposed\n\t * in the Dropdown component,\n\t * e.g.: the ability to have the popover without an arrow.\n\t */\n\tpopoverProps?: Omit<\n\t\tComponentPropsWithoutRef< typeof Popover >,\n\t\t'children'\n\t>;\n\t/**\n\t * A callback invoked to render the content of the dropdown menu.\n\t * Its first argument is the same as the renderToggle prop.\n\t */\n\trenderContent: ( props: CallbackProps ) => ReactNode;\n\t/**\n\t * A callback invoked to render the Dropdown Toggle Button.\n\t *\n\t * The first argument of the callback is an object\n\t * containing the following properties:\n\t *\n\t * - isOpen: whether the dropdown menu is opened or not\n\t * - onToggle: A function switching the dropdown menu's state\n\t * from open to closed and vice versa\n\t * - onClose: A function that closes the menu if invoked\n\t */\n\trenderToggle: ( props: CallbackProps ) => ReactNode;\n\t/**\n\t * The style of the global container.\n\t */\n\tstyle?: CSSProperties;\n\t/**\n\t * Legacy way to specify the popover's position with respect to its anchor.\n\t * For details about the possible values, see the `Popover` component's docs.\n\t * _Note: this prop is deprecated. Use the `popoverProps.placement` prop\n\t * instead._\n\t *\n\t * @deprecated\n\t */\n\tposition?: PopoverProps[ 'position' ];\n\t/**\n\t * The controlled open state of the dropdown.\n\t * Must be used in conjunction with `onToggle`.\n\t */\n\topen?: boolean;\n\t/**\n\t * The open state of the dropdown when initially rendered.\n\t * Use when you do not need to control its open state. It will be overridden\n\t * by the `open` prop if it is specified on the component's first render.\n\t */\n\tdefaultOpen?: boolean;\n};\n\nexport type DropdownInternalContext = {\n\t/**\n\t * This variant can be used to change the appearance of the component in\n\t * specific contexts, ie. when rendered inside the `Toolbar` component.\n\t */\n\tvariant?: 'toolbar';\n};\n"],"mappings":""}
@@ -42,6 +42,9 @@ function UnconnectedDropdownMenu(dropdownMenuProps) {
42
42
  disableOpenOnArrowDown = false,
43
43
  text,
44
44
  noIcons,
45
+ open,
46
+ defaultOpen,
47
+ onToggle: onToggleProp,
45
48
  // Context
46
49
  variant
47
50
  } = useContextSystem(dropdownMenuProps, 'DropdownMenu');
@@ -143,7 +146,10 @@ function UnconnectedDropdownMenu(dropdownMenuProps) {
143
146
  role: control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.role : 'menuitem',
144
147
  disabled: control.isDisabled
145
148
  }, control.title))));
146
- }
149
+ },
150
+ open: open,
151
+ defaultOpen: defaultOpen,
152
+ onToggle: onToggleProp
147
153
  });
148
154
  }
149
155
 
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","menu","contextConnectWithoutRef","useContextSystem","Button","Dropdown","NavigableMenu","mergeProps","defaultProps","props","mergedProps","className","isFunction","maybeFunc","UnconnectedDropdownMenu","dropdownMenuProps","children","controls","icon","label","popoverProps","toggleProps","menuProps","disableOpenOnArrowDown","text","noIcons","variant","length","controlSets","Array","isArray","mergedPopoverProps","createElement","renderToggle","isOpen","onToggle","_toggleProps$showTool","openOnArrowDown","event","code","preventDefault","as","Toggle","restToggleProps","mergedToggleProps","onClick","onKeyDown","showTooltip","renderContent","mergedMenuProps","role","flatMap","controlSet","indexOfSet","map","control","indexOfControl","key","join","stopPropagation","onClose","isActive","title","undefined","disabled","isDisabled","DropdownMenu"],"sources":["@wordpress/components/src/dropdown-menu/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { menu } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { contextConnectWithoutRef, useContextSystem } from '../ui/context';\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport { NavigableMenu } from '../navigable-container';\nimport type {\n\tDropdownMenuProps,\n\tDropdownOption,\n\tDropdownMenuInternalContext,\n} from './types';\n\nfunction mergeProps<\n\tT extends { className?: string; [ key: string ]: unknown }\n>( defaultProps: Partial< T > = {}, props: T = {} as T ) {\n\tconst mergedProps: T = {\n\t\t...defaultProps,\n\t\t...props,\n\t};\n\n\tif ( props.className && defaultProps.className ) {\n\t\tmergedProps.className = classnames(\n\t\t\tprops.className,\n\t\t\tdefaultProps.className\n\t\t);\n\t}\n\n\treturn mergedProps;\n}\n\nfunction isFunction( maybeFunc: unknown ): maybeFunc is () => void {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction UnconnectedDropdownMenu( dropdownMenuProps: DropdownMenuProps ) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tcontrols,\n\t\ticon = menu,\n\t\tlabel,\n\t\tpopoverProps,\n\t\ttoggleProps,\n\t\tmenuProps,\n\t\tdisableOpenOnArrowDown = false,\n\t\ttext,\n\t\tnoIcons,\n\n\t\t// Context\n\t\tvariant,\n\t} = useContextSystem< DropdownMenuProps & DropdownMenuInternalContext >(\n\t\tdropdownMenuProps,\n\t\t'DropdownMenu'\n\t);\n\n\tif ( ! controls?.length && ! isFunction( children ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: DropdownOption[][];\n\tif ( controls?.length ) {\n\t\t// @ts-expect-error The check below is needed because `DropdownMenus`\n\t\t// rendered by `ToolBarGroup` receive controls as a nested array.\n\t\tcontrolSets = controls;\n\t\tif ( ! Array.isArray( controlSets[ 0 ] ) ) {\n\t\t\t// This is not ideal, but at this point we know that `controls` is\n\t\t\t// not a nested array, even if TypeScript doesn't.\n\t\t\tcontrolSets = [ controls as DropdownOption[] ];\n\t\t}\n\t}\n\n\tconst mergedPopoverProps = mergeProps(\n\t\t{\n\t\t\tclassName: 'components-dropdown-menu__popover',\n\t\t\tvariant,\n\t\t},\n\t\tpopoverProps\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tclassName={ className }\n\t\t\tpopoverProps={ mergedPopoverProps }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\tconst openOnArrowDown = ( event: React.KeyboardEvent ) => {\n\t\t\t\t\tif ( disableOpenOnArrowDown ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! isOpen && event.code === 'ArrowDown' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst { as: Toggle = Button, ...restToggleProps } =\n\t\t\t\t\ttoggleProps ?? {};\n\n\t\t\t\tconst mergedToggleProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: classnames(\n\t\t\t\t\t\t\t'components-dropdown-menu__toggle',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-opened': isOpen,\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\trestToggleProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<Toggle\n\t\t\t\t\t\t{ ...mergedToggleProps }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t( ( event ) => {\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\tif ( mergedToggleProps.onClick ) {\n\t\t\t\t\t\t\t\t\tmergedToggleProps.onClick( event );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} ) as React.MouseEventHandler< HTMLButtonElement >\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonKeyDown={\n\t\t\t\t\t\t\t( ( event ) => {\n\t\t\t\t\t\t\t\topenOnArrowDown( event );\n\t\t\t\t\t\t\t\tif ( mergedToggleProps.onKeyDown ) {\n\t\t\t\t\t\t\t\t\tmergedToggleProps.onKeyDown( event );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} ) as React.KeyboardEventHandler< HTMLButtonElement >\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ttext={ text }\n\t\t\t\t\t\tshowTooltip={ toggleProps?.showTooltip ?? true }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ mergedToggleProps.children }\n\t\t\t\t\t</Toggle>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trenderContent={ ( props ) => {\n\t\t\t\tconst mergedMenuProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\t'aria-label': label,\n\t\t\t\t\t\tclassName: classnames(\n\t\t\t\t\t\t\t'components-dropdown-menu__menu',\n\t\t\t\t\t\t\t{ 'no-icons': noIcons }\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\tmenuProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<NavigableMenu { ...mergedMenuProps } role=\"menu\">\n\t\t\t\t\t\t{ isFunction( children ) ? children( props ) : null }\n\t\t\t\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\t\t\t\tcontrolSet.map( ( control, indexOfControl ) => (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tkey={ [\n\t\t\t\t\t\t\t\t\t\tindexOfSet,\n\t\t\t\t\t\t\t\t\t\tindexOfControl,\n\t\t\t\t\t\t\t\t\t].join() }\n\t\t\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\tprops.onClose();\n\t\t\t\t\t\t\t\t\t\tif ( control.onClick ) {\n\t\t\t\t\t\t\t\t\t\t\tcontrol.onClick();\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\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'components-dropdown-menu__menu-item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'has-separator':\n\t\t\t\t\t\t\t\t\t\t\t\tindexOfSet > 0 &&\n\t\t\t\t\t\t\t\t\t\t\t\tindexOfControl === 0,\n\t\t\t\t\t\t\t\t\t\t\t'is-active': control.isActive,\n\t\t\t\t\t\t\t\t\t\t\t'is-icon-only': ! control.title,\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\ticon={ control.icon }\n\t\t\t\t\t\t\t\t\tlabel={ control.label }\n\t\t\t\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemcheckbox' ||\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemradio'\n\t\t\t\t\t\t\t\t\t\t\t? control.isActive\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\trole={\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemcheckbox' ||\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemradio'\n\t\t\t\t\t\t\t\t\t\t\t? control.role\n\t\t\t\t\t\t\t\t\t\t\t: 'menuitem'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisabled={ control.isDisabled }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ control.title }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableMenu>\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n}\n\n/**\n *\n * The DropdownMenu displays a list of actions (each contained in a MenuItem,\n * MenuItemsChoice, or MenuGroup) in a compact way. It appears in a Popover\n * after the user has interacted with an element (a button or icon) or when\n * they perform a specific action.\n *\n * Render a Dropdown Menu with a set of controls:\n *\n * ```jsx\n * import { DropdownMenu } from '@wordpress/components';\n * import {\n * \tmore,\n * \tarrowLeft,\n * \tarrowRight,\n * \tarrowUp,\n * \tarrowDown,\n * } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu\n * \t\ticon={ more }\n * \t\tlabel=\"Select a direction\"\n * \t\tcontrols={ [\n * \t\t\t{\n * \t\t\t\ttitle: 'Up',\n * \t\t\t\ticon: arrowUp,\n * \t\t\t\tonClick: () => console.log( 'up' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Right',\n * \t\t\t\ticon: arrowRight,\n * \t\t\t\tonClick: () => console.log( 'right' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Down',\n * \t\t\t\ticon: arrowDown,\n * \t\t\t\tonClick: () => console.log( 'down' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Left',\n * \t\t\t\ticon: arrowLeft,\n * \t\t\t\tonClick: () => console.log( 'left' ),\n * \t\t\t},\n * \t\t] }\n * \t/>\n * );\n * ```\n *\n * Alternatively, specify a `children` function which returns elements valid for\n * use in a DropdownMenu: `MenuItem`, `MenuItemsChoice`, or `MenuGroup`.\n *\n * ```jsx\n * import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\n * import { more, arrowUp, arrowDown, trash } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu icon={ more } label=\"Select a direction\">\n * \t\t{ ( { onClose } ) => (\n * \t\t\t<>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ arrowUp } onClick={ onClose }>\n * \t\t\t\t\t\tMove Up\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t\t<MenuItem icon={ arrowDown } onClick={ onClose }>\n * \t\t\t\t\t\tMove Down\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ trash } onClick={ onClose }>\n * \t\t\t\t\t\tRemove\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t</>\n * \t\t) }\n * \t</DropdownMenu>\n * );\n * ```\n *\n */\nexport const DropdownMenu = contextConnectWithoutRef(\n\tUnconnectedDropdownMenu,\n\t'DropdownMenu'\n);\n\nexport default DropdownMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,SAASC,wBAAwB,EAAEC,gBAAgB,QAAQ,eAAe;AAC1E,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,aAAa,QAAQ,wBAAwB;AAOtD,SAASC,UAAUA,CAEhBC,YAA0B,GAAG,CAAC,CAAC,EAAEC,KAAQ,GAAG,CAAC,CAAM,EAAG;EACxD,MAAMC,WAAc,GAAG;IACtB,GAAGF,YAAY;IACf,GAAGC;EACJ,CAAC;EAED,IAAKA,KAAK,CAACE,SAAS,IAAIH,YAAY,CAACG,SAAS,EAAG;IAChDD,WAAW,CAACC,SAAS,GAAGX,UAAU,CACjCS,KAAK,CAACE,SAAS,EACfH,YAAY,CAACG,SACd,CAAC;EACF;EAEA,OAAOD,WAAW;AACnB;AAEA,SAASE,UAAUA,CAAEC,SAAkB,EAA4B;EAClE,OAAO,OAAOA,SAAS,KAAK,UAAU;AACvC;AAEA,SAASC,uBAAuBA,CAAEC,iBAAoC,EAAG;EACxE,MAAM;IACLC,QAAQ;IACRL,SAA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C,OAAO,EAAEC,cAAc,KACxCxB,aAAA,CAAC5B,MAAM;QACNqD,GAAG,EAAG,CACLJ,UAAU,EACVG,cAAc,CACd,CAACE,IAAI,CAAC,CAAG;QACVb,OAAO,EAAKP,KAAK,IAAM;UACtBA,KAAK,CAACqB,eAAe,CAAC,CAAC;UACvBlD,KAAK,CAACmD,OAAO,CAAC,CAAC;UACf,IAAKL,OAAO,CAACV,OAAO,EAAG;YACtBU,OAAO,CAACV,OAAO,CAAC,CAAC;UAClB;QACD,CAAG;QACHlC,SAAS,EAAGX,UAAU,CACrB,qCAAqC,EACrC;UACC,eAAe,EACdqD,UAAU,GAAG,CAAC,IACdG,cAAc,KAAK,CAAC;UACrB,WAAW,EAAED,OAAO,CAACM,QAAQ;UAC7B,cAAc,EAAE,CAAEN,OAAO,CAACO;QAC3B,CACD,CAAG;QACH5C,IAAI,EAAGqC,OAAO,CAACrC,IAAM;QACrBC,KAAK,EAAGoC,OAAO,CAACpC,KAAO;QACvB,gBACCoC,OAAO,CAACL,IAAI,KAAK,kBAAkB,IACnCK,OAAO,CAACL,IAAI,KAAK,eAAe,GAC7BK,OAAO,CAACM,QAAQ,GAChBE,SACH;QACDb,IAAI,EACHK,OAAO,CAACL,IAAI,KAAK,kBAAkB,IACnCK,OAAO,CAACL,IAAI,KAAK,eAAe,GAC7BK,OAAO,CAACL,IAAI,GACZ,UACH;QACDc,QAAQ,EAAGT,OAAO,CAACU;MAAY,GAE7BV,OAAO,CAACO,KACH,CACP,CACH,CACc,CAAC;IAElB;EAAG,CACH,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,YAAY,GAAGhE,wBAAwB,CACnDY,uBAAuB,EACvB,cACD,CAAC;AAED,eAAeoD,YAAY"}
1
+ {"version":3,"names":["classnames","menu","contextConnectWithoutRef","useContextSystem","Button","Dropdown","NavigableMenu","mergeProps","defaultProps","props","mergedProps","className","isFunction","maybeFunc","UnconnectedDropdownMenu","dropdownMenuProps","children","controls","icon","label","popoverProps","toggleProps","menuProps","disableOpenOnArrowDown","text","noIcons","open","defaultOpen","onToggle","onToggleProp","variant","length","controlSets","Array","isArray","mergedPopoverProps","createElement","renderToggle","isOpen","_toggleProps$showTool","openOnArrowDown","event","code","preventDefault","as","Toggle","restToggleProps","mergedToggleProps","onClick","onKeyDown","showTooltip","renderContent","mergedMenuProps","role","flatMap","controlSet","indexOfSet","map","control","indexOfControl","key","join","stopPropagation","onClose","isActive","title","undefined","disabled","isDisabled","DropdownMenu"],"sources":["@wordpress/components/src/dropdown-menu/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { menu } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { contextConnectWithoutRef, useContextSystem } from '../ui/context';\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport { NavigableMenu } from '../navigable-container';\nimport type {\n\tDropdownMenuProps,\n\tDropdownOption,\n\tDropdownMenuInternalContext,\n} from './types';\n\nfunction mergeProps<\n\tT extends { className?: string; [ key: string ]: unknown },\n>( defaultProps: Partial< T > = {}, props: T = {} as T ) {\n\tconst mergedProps: T = {\n\t\t...defaultProps,\n\t\t...props,\n\t};\n\n\tif ( props.className && defaultProps.className ) {\n\t\tmergedProps.className = classnames(\n\t\t\tprops.className,\n\t\t\tdefaultProps.className\n\t\t);\n\t}\n\n\treturn mergedProps;\n}\n\nfunction isFunction( maybeFunc: unknown ): maybeFunc is () => void {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction UnconnectedDropdownMenu( dropdownMenuProps: DropdownMenuProps ) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tcontrols,\n\t\ticon = menu,\n\t\tlabel,\n\t\tpopoverProps,\n\t\ttoggleProps,\n\t\tmenuProps,\n\t\tdisableOpenOnArrowDown = false,\n\t\ttext,\n\t\tnoIcons,\n\n\t\topen,\n\t\tdefaultOpen,\n\t\tonToggle: onToggleProp,\n\n\t\t// Context\n\t\tvariant,\n\t} = useContextSystem< DropdownMenuProps & DropdownMenuInternalContext >(\n\t\tdropdownMenuProps,\n\t\t'DropdownMenu'\n\t);\n\n\tif ( ! controls?.length && ! isFunction( children ) ) {\n\t\treturn null;\n\t}\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: DropdownOption[][];\n\tif ( controls?.length ) {\n\t\t// @ts-expect-error The check below is needed because `DropdownMenus`\n\t\t// rendered by `ToolBarGroup` receive controls as a nested array.\n\t\tcontrolSets = controls;\n\t\tif ( ! Array.isArray( controlSets[ 0 ] ) ) {\n\t\t\t// This is not ideal, but at this point we know that `controls` is\n\t\t\t// not a nested array, even if TypeScript doesn't.\n\t\t\tcontrolSets = [ controls as DropdownOption[] ];\n\t\t}\n\t}\n\n\tconst mergedPopoverProps = mergeProps(\n\t\t{\n\t\t\tclassName: 'components-dropdown-menu__popover',\n\t\t\tvariant,\n\t\t},\n\t\tpopoverProps\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tclassName={ className }\n\t\t\tpopoverProps={ mergedPopoverProps }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\tconst openOnArrowDown = ( event: React.KeyboardEvent ) => {\n\t\t\t\t\tif ( disableOpenOnArrowDown ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! isOpen && event.code === 'ArrowDown' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst { as: Toggle = Button, ...restToggleProps } =\n\t\t\t\t\ttoggleProps ?? {};\n\n\t\t\t\tconst mergedToggleProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: classnames(\n\t\t\t\t\t\t\t'components-dropdown-menu__toggle',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-opened': isOpen,\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\trestToggleProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<Toggle\n\t\t\t\t\t\t{ ...mergedToggleProps }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t( ( event ) => {\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\tif ( mergedToggleProps.onClick ) {\n\t\t\t\t\t\t\t\t\tmergedToggleProps.onClick( event );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} ) as React.MouseEventHandler< HTMLButtonElement >\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonKeyDown={\n\t\t\t\t\t\t\t( ( event ) => {\n\t\t\t\t\t\t\t\topenOnArrowDown( event );\n\t\t\t\t\t\t\t\tif ( mergedToggleProps.onKeyDown ) {\n\t\t\t\t\t\t\t\t\tmergedToggleProps.onKeyDown( event );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} ) as React.KeyboardEventHandler< HTMLButtonElement >\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ttext={ text }\n\t\t\t\t\t\tshowTooltip={ toggleProps?.showTooltip ?? true }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ mergedToggleProps.children }\n\t\t\t\t\t</Toggle>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trenderContent={ ( props ) => {\n\t\t\t\tconst mergedMenuProps = mergeProps(\n\t\t\t\t\t{\n\t\t\t\t\t\t'aria-label': label,\n\t\t\t\t\t\tclassName: classnames(\n\t\t\t\t\t\t\t'components-dropdown-menu__menu',\n\t\t\t\t\t\t\t{ 'no-icons': noIcons }\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\tmenuProps\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<NavigableMenu { ...mergedMenuProps } role=\"menu\">\n\t\t\t\t\t\t{ isFunction( children ) ? children( props ) : null }\n\t\t\t\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\t\t\t\tcontrolSet.map( ( control, indexOfControl ) => (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tkey={ [\n\t\t\t\t\t\t\t\t\t\tindexOfSet,\n\t\t\t\t\t\t\t\t\t\tindexOfControl,\n\t\t\t\t\t\t\t\t\t].join() }\n\t\t\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\tprops.onClose();\n\t\t\t\t\t\t\t\t\t\tif ( control.onClick ) {\n\t\t\t\t\t\t\t\t\t\t\tcontrol.onClick();\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\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'components-dropdown-menu__menu-item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'has-separator':\n\t\t\t\t\t\t\t\t\t\t\t\tindexOfSet > 0 &&\n\t\t\t\t\t\t\t\t\t\t\t\tindexOfControl === 0,\n\t\t\t\t\t\t\t\t\t\t\t'is-active': control.isActive,\n\t\t\t\t\t\t\t\t\t\t\t'is-icon-only': ! control.title,\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\ticon={ control.icon }\n\t\t\t\t\t\t\t\t\tlabel={ control.label }\n\t\t\t\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemcheckbox' ||\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemradio'\n\t\t\t\t\t\t\t\t\t\t\t? control.isActive\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\trole={\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemcheckbox' ||\n\t\t\t\t\t\t\t\t\t\tcontrol.role === 'menuitemradio'\n\t\t\t\t\t\t\t\t\t\t\t? control.role\n\t\t\t\t\t\t\t\t\t\t\t: 'menuitem'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisabled={ control.isDisabled }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ control.title }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableMenu>\n\t\t\t\t);\n\t\t\t} }\n\t\t\topen={ open }\n\t\t\tdefaultOpen={ defaultOpen }\n\t\t\tonToggle={ onToggleProp }\n\t\t/>\n\t);\n}\n\n/**\n *\n * The DropdownMenu displays a list of actions (each contained in a MenuItem,\n * MenuItemsChoice, or MenuGroup) in a compact way. It appears in a Popover\n * after the user has interacted with an element (a button or icon) or when\n * they perform a specific action.\n *\n * Render a Dropdown Menu with a set of controls:\n *\n * ```jsx\n * import { DropdownMenu } from '@wordpress/components';\n * import {\n * \tmore,\n * \tarrowLeft,\n * \tarrowRight,\n * \tarrowUp,\n * \tarrowDown,\n * } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu\n * \t\ticon={ more }\n * \t\tlabel=\"Select a direction\"\n * \t\tcontrols={ [\n * \t\t\t{\n * \t\t\t\ttitle: 'Up',\n * \t\t\t\ticon: arrowUp,\n * \t\t\t\tonClick: () => console.log( 'up' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Right',\n * \t\t\t\ticon: arrowRight,\n * \t\t\t\tonClick: () => console.log( 'right' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Down',\n * \t\t\t\ticon: arrowDown,\n * \t\t\t\tonClick: () => console.log( 'down' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Left',\n * \t\t\t\ticon: arrowLeft,\n * \t\t\t\tonClick: () => console.log( 'left' ),\n * \t\t\t},\n * \t\t] }\n * \t/>\n * );\n * ```\n *\n * Alternatively, specify a `children` function which returns elements valid for\n * use in a DropdownMenu: `MenuItem`, `MenuItemsChoice`, or `MenuGroup`.\n *\n * ```jsx\n * import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\n * import { more, arrowUp, arrowDown, trash } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu icon={ more } label=\"Select a direction\">\n * \t\t{ ( { onClose } ) => (\n * \t\t\t<>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ arrowUp } onClick={ onClose }>\n * \t\t\t\t\t\tMove Up\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t\t<MenuItem icon={ arrowDown } onClick={ onClose }>\n * \t\t\t\t\t\tMove Down\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ trash } onClick={ onClose }>\n * \t\t\t\t\t\tRemove\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t</>\n * \t\t) }\n * \t</DropdownMenu>\n * );\n * ```\n *\n */\nexport const DropdownMenu = contextConnectWithoutRef(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HrC,SAAS,EAAGX,UAAU,CACrB,qCAAqC,EACrC;UACC,eAAe,EACdwD,UAAU,GAAG,CAAC,IACdG,cAAc,KAAK,CAAC;UACrB,WAAW,EAAED,OAAO,CAACM,QAAQ;UAC7B,cAAc,EAAE,CAAEN,OAAO,CAACO;QAC3B,CACD,CAAG;QACH/C,IAAI,EAAGwC,OAAO,CAACxC,IAAM;QACrBC,KAAK,EAAGuC,OAAO,CAACvC,KAAO;QACvB,gBACCuC,OAAO,CAACL,IAAI,KAAK,kBAAkB,IACnCK,OAAO,CAACL,IAAI,KAAK,eAAe,GAC7BK,OAAO,CAACM,QAAQ,GAChBE,SACH;QACDb,IAAI,EACHK,OAAO,CAACL,IAAI,KAAK,kBAAkB,IACnCK,OAAO,CAACL,IAAI,KAAK,eAAe,GAC7BK,OAAO,CAACL,IAAI,GACZ,UACH;QACDc,QAAQ,EAAGT,OAAO,CAACU;MAAY,GAE7BV,OAAO,CAACO,KACH,CACP,CACH,CACc,CAAC;IAElB,CAAG;IACHvC,IAAI,EAAGA,IAAM;IACbC,WAAW,EAAGA,WAAa;IAC3BC,QAAQ,EAAGC;EAAc,CACzB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMwC,YAAY,GAAGnE,wBAAwB,CACnDY,uBAAuB,EACvB,cACD,CAAC;AAED,eAAeuD,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/dropdown-menu/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n/**\n * Internal dependencies\n */\nimport type { ButtonAsButtonProps } from '../button/types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { DropdownProps } from '../dropdown/types';\nimport type { Props as IconProps } from '../icon';\nimport type { NavigableMenuProps } from '../navigable-container/types';\n\nexport type DropdownOption = {\n\t/**\n\t * The Dashicon icon slug to be shown for the option.\n\t */\n\ticon?: IconProps[ 'icon' ];\n\t/**\n\t * A human-readable title to display for the option.\n\t */\n\ttitle: string;\n\t/**\n\t * Whether or not the option is disabled.\n\t *\n\t * @default false\n\t */\n\tisDisabled?: boolean;\n\t/**\n\t * A callback function to invoke when the option is selected.\n\t */\n\tonClick?: () => void;\n\t/**\n\t * Whether or not the control is currently active.\n\t */\n\tisActive?: boolean;\n\t/**\n\t * Text to use for the internal `Button` component's tooltip.\n\t */\n\tlabel?: string;\n\t/**\n\t * The role to apply to the option's HTML element\n\t */\n\trole?: HTMLElement[ 'role' ];\n};\n\ntype DropdownCallbackProps = {\n\tisOpen: boolean;\n\tonToggle: () => void;\n\tonClose: () => void;\n};\n\n// Manually including `as` prop because `WordPressComponentProps` polymorhpism\n// creates a union that is too large for TypeScript to handle.\ntype ToggleProps = Partial<\n\tOmit<\n\t\tWordPressComponentProps< ButtonAsButtonProps, 'button', false >,\n\t\t'label' | 'text'\n\t>\n> & {\n\tas?: React.ElementType | keyof JSX.IntrinsicElements;\n};\n\nexport type DropdownMenuProps = {\n\t/**\n\t * The Dashicon icon slug to be shown in the collapsed menu button.\n\t *\n\t * @default \"menu\"\n\t */\n\ticon?: IconProps[ 'icon' ] | null;\n\t/**\n\t * A human-readable label to present as accessibility text on the focused\n\t * collapsed menu button.\n\t */\n\tlabel: string;\n\t/**\n\t * A class name to apply to the dropdown menu's toggle element wrapper.\n\t */\n\tclassName?: string;\n\t/**\n\t * Properties of `popoverProps` object will be passed as props to the nested\n\t * `Popover` component.\n\t * Use this object to modify props available for the `Popover` component that\n\t * are not already exposed in the `DropdownMenu` component, e.g.: the\n\t * direction in which the popover should open relative to its parent node\n\t * set with `position` prop.\n\t */\n\tpopoverProps?: DropdownProps[ 'popoverProps' ];\n\t/**\n\t * Properties of `toggleProps` object will be passed as props to the nested\n\t * `Button` component in the `renderToggle` implementation of the `Dropdown`\n\t * component used internally.\n\t * Use this object to modify props available for the `Button` component that\n\t * are not already exposed in the `DropdownMenu` component, e.g.: the tooltip\n\t * text displayed on hover set with `tooltip` prop.\n\t */\n\ttoggleProps?: ToggleProps;\n\t/**\n\t * Properties of `menuProps` object will be passed as props to the nested\n\t * `NavigableMenu` component in the `renderContent` implementation of the\n\t * `Dropdown` component used internally.\n\t * Use this object to modify props available for the `NavigableMenu`\n\t * component that are not already exposed in the `DropdownMenu` component,\n\t * e.g.: the orientation of the menu set with `orientation` prop.\n\t */\n\tmenuProps?: Omit< Partial< NavigableMenuProps >, 'children' >;\n\t/**\n\t * In some contexts, the arrow down key used to open the dropdown menu might\n\t * need to be disabled—for example when that key is used to perform another\n\t * action.\n\t *\n\t * @default false\n\t */\n\tdisableOpenOnArrowDown?: boolean;\n\t/**\n\t * Text to display on the nested `Button` component in the `renderToggle`\n\t * implementation of the `Dropdown` component used internally.\n\t */\n\ttext?: string;\n\t/**\n\t * Whether or not `no-icons` should be added to the menu's `className`.\n\t */\n\tnoIcons?: boolean;\n\t/**\n\t * A [function render prop](https://reactjs.org/docs/render-props.html#using-props-other-than-render)\n\t * which should return an element or elements valid for use in a DropdownMenu:\n\t * `MenuItem`, `MenuItemsChoice`, or `MenuGroup`. Its first argument is a\n\t * props object including the same values as given to a `Dropdown`'s\n\t * `renderContent` (`isOpen`, `onToggle`, `onClose`).\n\t *\n\t * A valid DropdownMenu must specify a `controls` or `children` prop, or both.\n\t */\n\tchildren?: ( callbackProps: DropdownCallbackProps ) => ReactNode;\n\t/**\n\t * An array or nested array of objects describing the options to be shown in\n\t * the expanded menu. Each object should include an `icon` Dashicon slug\n\t * string, a human-readable `title` string, `isDisabled` boolean flag, and\n\t * an `onClick` function callback to invoke when the option is selected.\n\t *\n\t * A valid DropdownMenu must specify a `controls` or `children` prop, or both.\n\t */\n\tcontrols?: DropdownOption[] | DropdownOption[][];\n};\n\nexport type DropdownMenuInternalContext = {\n\t/**\n\t * This variant can be used to change the appearance of the component in\n\t * specific contexts, ie. when rendered inside the `Toolbar` component.\n\t */\n\tvariant?: 'toolbar';\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/dropdown-menu/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { HTMLAttributes, ReactNode } from 'react';\n/**\n * Internal dependencies\n */\nimport type { ButtonAsButtonProps } from '../button/types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { DropdownProps } from '../dropdown/types';\nimport type { Props as IconProps } from '../icon';\nimport type { NavigableMenuProps } from '../navigable-container/types';\n\nexport type DropdownOption = {\n\t/**\n\t * The icon to be shown for the option.\n\t */\n\ticon?: IconProps[ 'icon' ];\n\t/**\n\t * A human-readable title to display for the option.\n\t */\n\ttitle: string;\n\t/**\n\t * Whether or not the option is disabled.\n\t *\n\t * @default false\n\t */\n\tisDisabled?: boolean;\n\t/**\n\t * A callback function to invoke when the option is selected.\n\t */\n\tonClick?: ( event?: React.MouseEvent ) => void;\n\t/**\n\t * Whether or not the control is currently active.\n\t */\n\tisActive?: boolean;\n\t/**\n\t * Text to use for the internal `Button` component's tooltip.\n\t */\n\tlabel?: string;\n\t/**\n\t * The role to apply to the option's HTML element\n\t */\n\trole?: HTMLAttributes< HTMLElement >[ 'role' ];\n};\n\ntype DropdownCallbackProps = {\n\tisOpen: boolean;\n\tonToggle: () => void;\n\tonClose: () => void;\n};\n\n// Manually including `as` prop because `WordPressComponentProps` polymorphism\n// creates a union that is too large for TypeScript to handle.\ntype ToggleProps = Partial<\n\tOmit<\n\t\tWordPressComponentProps< ButtonAsButtonProps, 'button', false >,\n\t\t'label' | 'text'\n\t>\n> & {\n\tas?: React.ElementType | keyof JSX.IntrinsicElements;\n\t'data-toolbar-item'?: boolean;\n};\n\nexport type DropdownMenuProps = {\n\t/**\n\t * The icon to be shown in the collapsed menu button.\n\t *\n\t * @default \"menu\"\n\t */\n\ticon?: IconProps[ 'icon' ] | null;\n\t/**\n\t * A human-readable label to present as accessibility text on the focused\n\t * collapsed menu button.\n\t */\n\tlabel: string;\n\t/**\n\t * A class name to apply to the dropdown menu's toggle element wrapper.\n\t */\n\tclassName?: string;\n\t/**\n\t * Properties of `popoverProps` object will be passed as props to the nested\n\t * `Popover` component.\n\t * Use this object to modify props available for the `Popover` component that\n\t * are not already exposed in the `DropdownMenu` component, e.g.: the\n\t * direction in which the popover should open relative to its parent node\n\t * set with `position` prop.\n\t */\n\tpopoverProps?: DropdownProps[ 'popoverProps' ];\n\t/**\n\t * Properties of `toggleProps` object will be passed as props to the nested\n\t * `Button` component in the `renderToggle` implementation of the `Dropdown`\n\t * component used internally.\n\t * Use this object to modify props available for the `Button` component that\n\t * are not already exposed in the `DropdownMenu` component, e.g.: the tooltip\n\t * text displayed on hover set with `tooltip` prop.\n\t */\n\ttoggleProps?: ToggleProps;\n\t/**\n\t * Properties of `menuProps` object will be passed as props to the nested\n\t * `NavigableMenu` component in the `renderContent` implementation of the\n\t * `Dropdown` component used internally.\n\t * Use this object to modify props available for the `NavigableMenu`\n\t * component that are not already exposed in the `DropdownMenu` component,\n\t * e.g.: the orientation of the menu set with `orientation` prop.\n\t */\n\tmenuProps?: Omit< Partial< NavigableMenuProps >, 'children' >;\n\t/**\n\t * In some contexts, the arrow down key used to open the dropdown menu might\n\t * need to be disabled—for example when that key is used to perform another\n\t * action.\n\t *\n\t * @default false\n\t */\n\tdisableOpenOnArrowDown?: boolean;\n\t/**\n\t * Text to display on the nested `Button` component in the `renderToggle`\n\t * implementation of the `Dropdown` component used internally.\n\t */\n\ttext?: string;\n\t/**\n\t * Whether or not `no-icons` should be added to the menu's `className`.\n\t */\n\tnoIcons?: boolean;\n\t/**\n\t * A [function render prop](https://reactjs.org/docs/render-props.html#using-props-other-than-render)\n\t * which should return an element or elements valid for use in a DropdownMenu:\n\t * `MenuItem`, `MenuItemsChoice`, or `MenuGroup`. Its first argument is a\n\t * props object including the same values as given to a `Dropdown`'s\n\t * `renderContent` (`isOpen`, `onToggle`, `onClose`).\n\t *\n\t * A valid DropdownMenu must specify a `controls` or `children` prop, or both.\n\t */\n\tchildren?: ( callbackProps: DropdownCallbackProps ) => ReactNode;\n\t/**\n\t * An array or nested array of objects describing the options to be shown in\n\t * the expanded menu. Each object should include an `icon` Dashicon slug\n\t * string, a human-readable `title` string, `isDisabled` boolean flag, and\n\t * an `onClick` function callback to invoke when the option is selected.\n\t *\n\t * A valid DropdownMenu must specify a `controls` or `children` prop, or both.\n\t */\n\tcontrols?: DropdownOption[] | DropdownOption[][];\n\t/**\n\t * The controlled open state of the dropdown menu.\n\t * Must be used in conjunction with `onToggle`.\n\t */\n\topen?: boolean;\n\t/**\n\t * The open state of the dropdown menu when initially rendered.\n\t * Use when you do not need to control its open state. It will be overridden\n\t * by the `open` prop if it is specified on the component's first render.\n\t */\n\tdefaultOpen?: boolean;\n\t/**\n\t * A callback invoked when the state of the dropdown menu changes\n\t * from open to closed and vice versa.\n\t */\n\tonToggle?: ( willOpen: boolean ) => void;\n};\n\nexport type DropdownMenuInternalContext = {\n\t/**\n\t * This variant can be used to change the appearance of the component in\n\t * specific contexts, ie. when rendered inside the `Toolbar` component.\n\t */\n\tvariant?: 'toolbar';\n};\n"],"mappings":""}