@wordpress/components 25.7.0 → 25.8.1

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 (630) hide show
  1. package/CHANGELOG.md +66 -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/index.js +6 -1
  34. package/build/date-time/time/index.js.map +1 -1
  35. package/build/date-time/time/timezone.js +1 -1
  36. package/build/date-time/time/timezone.js.map +1 -1
  37. package/build/dropdown/index.js +11 -23
  38. package/build/dropdown/index.js.map +1 -1
  39. package/build/dropdown/types.js.map +1 -1
  40. package/build/dropdown-menu/index.js +7 -1
  41. package/build/dropdown-menu/index.js.map +1 -1
  42. package/build/dropdown-menu/types.js.map +1 -1
  43. package/build/dropdown-menu-v2/styles.js +16 -16
  44. package/build/dropdown-menu-v2/styles.js.map +1 -1
  45. package/build/duotone-picker/color-list-picker/index.js +18 -3
  46. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  47. package/build/duotone-picker/duotone-picker.js +33 -1
  48. package/build/duotone-picker/duotone-picker.js.map +1 -1
  49. package/build/duotone-picker/types.js.map +1 -1
  50. package/build/focusable-iframe/index.js +0 -4
  51. package/build/focusable-iframe/index.js.map +1 -1
  52. package/build/focusable-iframe/types.js +6 -0
  53. package/build/focusable-iframe/types.js.map +1 -0
  54. package/build/form-token-field/index.js +6 -2
  55. package/build/form-token-field/index.js.map +1 -1
  56. package/build/form-token-field/types.js.map +1 -1
  57. package/build/gradient-picker/index.js +57 -15
  58. package/build/gradient-picker/index.js.map +1 -1
  59. package/build/gradient-picker/types.js.map +1 -1
  60. package/build/higher-order/navigate-regions/index.js.map +1 -1
  61. package/build/higher-order/with-focus-outside/index.js +1 -2
  62. package/build/higher-order/with-focus-outside/index.js.map +1 -1
  63. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  64. package/build/index.js +6 -0
  65. package/build/index.js.map +1 -1
  66. package/build/input-control/styles/input-control-styles.js +22 -22
  67. package/build/input-control/styles/input-control-styles.js.map +1 -1
  68. package/build/mobile/bottom-sheet/index.native.js +1 -0
  69. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  70. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  71. package/build/modal/index.js +12 -3
  72. package/build/modal/index.js.map +1 -1
  73. package/build/modal/types.js.map +1 -1
  74. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  75. package/build/notice/index.js +19 -7
  76. package/build/notice/index.js.map +1 -1
  77. package/build/palette-edit/styles.js +10 -10
  78. package/build/palette-edit/styles.js.map +1 -1
  79. package/build/placeholder/index.js +10 -4
  80. package/build/placeholder/index.js.map +1 -1
  81. package/build/popover/index.js +37 -83
  82. package/build/popover/index.js.map +1 -1
  83. package/build/popover/types.js.map +1 -1
  84. package/build/popover/utils.js +9 -41
  85. package/build/popover/utils.js.map +1 -1
  86. package/build/search-control/index.js +12 -3
  87. package/build/search-control/index.js.map +1 -1
  88. package/build/search-control/types.js.map +1 -1
  89. package/build/text/styles.js +7 -7
  90. package/build/text/styles.js.map +1 -1
  91. package/build/toggle-group-control/toggle-group-control/as-button-group.js +30 -45
  92. package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  93. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +40 -41
  94. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  95. package/build/toggle-group-control/toggle-group-control/component.js +10 -5
  96. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  97. package/build/toggle-group-control/toggle-group-control/styles.js +9 -16
  98. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  99. package/build/toggle-group-control/toggle-group-control/utils.js +44 -0
  100. package/build/toggle-group-control/toggle-group-control/utils.js.map +1 -0
  101. package/build/toggle-group-control/toggle-group-control-option-base/component.js +36 -17
  102. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  103. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +10 -8
  104. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  105. package/build/toggle-group-control/types.js.map +1 -1
  106. package/build/toolbar/toolbar/index.js +7 -1
  107. package/build/toolbar/toolbar/index.js.map +1 -1
  108. package/build/toolbar/toolbar-dropdown-menu/index.js +1 -3
  109. package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  110. package/build/toolbar/toolbar-group/index.js +16 -12
  111. package/build/toolbar/toolbar-group/index.js.map +1 -1
  112. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +0 -2
  113. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  114. package/build/toolbar/toolbar-group/toolbar-group-container.js +3 -1
  115. package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  116. package/build/toolbar/toolbar-group/types.js +6 -0
  117. package/build/toolbar/toolbar-group/types.js.map +1 -0
  118. package/build/toolbar/toolbar-item/index.js +1 -1
  119. package/build/toolbar/toolbar-item/index.js.map +1 -1
  120. package/build/tooltip/index.js +51 -225
  121. package/build/tooltip/index.js.map +1 -1
  122. package/build/tooltip/types.js +6 -0
  123. package/build/tooltip/types.js.map +1 -0
  124. package/build/ui/context/context-connect.js.map +1 -1
  125. package/build/ui/context/wordpress-component.js.map +1 -1
  126. package/build/unit-control/index.js.map +1 -1
  127. package/build/unit-control/styles/unit-control-styles.js +7 -7
  128. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  129. package/build/utils/colors-values.js +1 -1
  130. package/build/utils/colors-values.js.map +1 -1
  131. package/build/utils/use-deprecated-props.js.map +1 -1
  132. package/build-module/animation/index.js +1 -1
  133. package/build-module/animation/index.js.map +1 -1
  134. package/build-module/border-control/border-control-dropdown/component.js +1 -1
  135. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  136. package/build-module/border-control/styles.js +20 -20
  137. package/build-module/border-control/styles.js.map +1 -1
  138. package/build-module/box-control/unit-control.js +1 -1
  139. package/build-module/box-control/unit-control.js.map +1 -1
  140. package/build-module/button/index.js +9 -1
  141. package/build-module/button/index.js.map +1 -1
  142. package/build-module/button/types.js.map +1 -1
  143. package/build-module/circular-option-picker/circular-option-picker-actions.js +44 -0
  144. package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -0
  145. package/build-module/circular-option-picker/circular-option-picker-context.js +11 -0
  146. package/build-module/circular-option-picker/circular-option-picker-context.js.map +1 -0
  147. package/build-module/circular-option-picker/circular-option-picker-option-group.js +23 -0
  148. package/build-module/circular-option-picker/circular-option-picker-option-group.js.map +1 -0
  149. package/build-module/circular-option-picker/circular-option-picker-option.js +114 -0
  150. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -0
  151. package/build-module/circular-option-picker/circular-option-picker.js +165 -0
  152. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -0
  153. package/build-module/circular-option-picker/index.js +4 -132
  154. package/build-module/circular-option-picker/index.js.map +1 -1
  155. package/build-module/circular-option-picker/types.js.map +1 -1
  156. package/build-module/color-palette/index.js +58 -19
  157. package/build-module/color-palette/index.js.map +1 -1
  158. package/build-module/color-palette/types.js.map +1 -1
  159. package/build-module/combobox-control/index.js +0 -3
  160. package/build-module/combobox-control/index.js.map +1 -1
  161. package/build-module/composite/index.js +2 -0
  162. package/build-module/composite/index.js.map +1 -1
  163. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  164. package/build-module/date-time/time/index.js +6 -1
  165. package/build-module/date-time/time/index.js.map +1 -1
  166. package/build-module/date-time/time/timezone.js +1 -1
  167. package/build-module/date-time/time/timezone.js.map +1 -1
  168. package/build-module/dropdown/index.js +12 -24
  169. package/build-module/dropdown/index.js.map +1 -1
  170. package/build-module/dropdown/types.js.map +1 -1
  171. package/build-module/dropdown-menu/index.js +7 -1
  172. package/build-module/dropdown-menu/index.js.map +1 -1
  173. package/build-module/dropdown-menu/types.js.map +1 -1
  174. package/build-module/dropdown-menu-v2/styles.js +16 -16
  175. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  176. package/build-module/duotone-picker/color-list-picker/index.js +18 -3
  177. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  178. package/build-module/duotone-picker/duotone-picker.js +33 -1
  179. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  180. package/build-module/duotone-picker/types.js.map +1 -1
  181. package/build-module/focusable-iframe/index.js +2 -3
  182. package/build-module/focusable-iframe/index.js.map +1 -1
  183. package/build-module/focusable-iframe/types.js +2 -0
  184. package/build-module/focusable-iframe/types.js.map +1 -0
  185. package/build-module/form-token-field/index.js +6 -2
  186. package/build-module/form-token-field/index.js.map +1 -1
  187. package/build-module/form-token-field/types.js.map +1 -1
  188. package/build-module/gradient-picker/index.js +57 -15
  189. package/build-module/gradient-picker/index.js.map +1 -1
  190. package/build-module/gradient-picker/types.js.map +1 -1
  191. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  192. package/build-module/higher-order/with-focus-outside/index.js +1 -3
  193. package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
  194. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  195. package/build-module/index.js +1 -1
  196. package/build-module/index.js.map +1 -1
  197. package/build-module/input-control/styles/input-control-styles.js +23 -23
  198. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  199. package/build-module/mobile/bottom-sheet/index.native.js +1 -0
  200. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  201. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  202. package/build-module/modal/index.js +12 -3
  203. package/build-module/modal/index.js.map +1 -1
  204. package/build-module/modal/types.js.map +1 -1
  205. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  206. package/build-module/notice/index.js +19 -7
  207. package/build-module/notice/index.js.map +1 -1
  208. package/build-module/palette-edit/styles.js +10 -10
  209. package/build-module/palette-edit/styles.js.map +1 -1
  210. package/build-module/placeholder/index.js +11 -4
  211. package/build-module/placeholder/index.js.map +1 -1
  212. package/build-module/popover/index.js +38 -84
  213. package/build-module/popover/index.js.map +1 -1
  214. package/build-module/popover/types.js.map +1 -1
  215. package/build-module/popover/utils.js +8 -39
  216. package/build-module/popover/utils.js.map +1 -1
  217. package/build-module/search-control/index.js +12 -3
  218. package/build-module/search-control/index.js.map +1 -1
  219. package/build-module/search-control/types.js.map +1 -1
  220. package/build-module/text/styles.js +7 -7
  221. package/build-module/text/styles.js.map +1 -1
  222. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +32 -47
  223. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  224. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +41 -42
  225. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  226. package/build-module/toggle-group-control/toggle-group-control/component.js +10 -6
  227. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  228. package/build-module/toggle-group-control/toggle-group-control/styles.js +8 -14
  229. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  230. package/build-module/toggle-group-control/toggle-group-control/utils.js +42 -0
  231. package/build-module/toggle-group-control/toggle-group-control/utils.js.map +1 -0
  232. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +35 -16
  233. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  234. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -7
  235. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  236. package/build-module/toggle-group-control/types.js.map +1 -1
  237. package/build-module/toolbar/toolbar/index.js +7 -1
  238. package/build-module/toolbar/toolbar/index.js.map +1 -1
  239. package/build-module/toolbar/toolbar-dropdown-menu/index.js +5 -3
  240. package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  241. package/build-module/toolbar/toolbar-group/index.js +15 -12
  242. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  243. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +0 -2
  244. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  245. package/build-module/toolbar/toolbar-group/toolbar-group-container.js +3 -1
  246. package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  247. package/build-module/toolbar/toolbar-group/types.js +2 -0
  248. package/build-module/toolbar/toolbar-group/types.js.map +1 -0
  249. package/build-module/toolbar/toolbar-item/index.js +1 -1
  250. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  251. package/build-module/tooltip/index.js +53 -224
  252. package/build-module/tooltip/index.js.map +1 -1
  253. package/build-module/tooltip/types.js +2 -0
  254. package/build-module/tooltip/types.js.map +1 -0
  255. package/build-module/ui/context/context-connect.js.map +1 -1
  256. package/build-module/ui/context/wordpress-component.js.map +1 -1
  257. package/build-module/unit-control/index.js.map +1 -1
  258. package/build-module/unit-control/styles/unit-control-styles.js +7 -7
  259. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  260. package/build-module/utils/colors-values.js +1 -1
  261. package/build-module/utils/colors-values.js.map +1 -1
  262. package/build-module/utils/use-deprecated-props.js.map +1 -1
  263. package/build-style/style-rtl.css +35 -73
  264. package/build-style/style.css +35 -73
  265. package/build-types/animation/index.d.ts +1 -1
  266. package/build-types/animation/index.d.ts.map +1 -1
  267. package/build-types/base-control/hooks.d.ts +1 -1
  268. package/build-types/border-box-control/border-box-control/component.d.ts +1 -1
  269. package/build-types/border-box-control/border-box-control/hook.d.ts +46 -46
  270. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +51 -51
  271. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +1 -1
  272. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +46 -46
  273. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +46 -46
  274. package/build-types/border-box-control/stories/index.story.d.ts +2 -2
  275. package/build-types/border-control/border-control/hook.d.ts +45 -45
  276. package/build-types/border-control/border-control-dropdown/hook.d.ts +45 -45
  277. package/build-types/border-control/border-control-style-picker/hook.d.ts +45 -45
  278. package/build-types/border-control/stories/index.story.d.ts +6 -6
  279. package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
  280. package/build-types/button/deprecated.d.ts +16 -22
  281. package/build-types/button/deprecated.d.ts.map +1 -1
  282. package/build-types/button/index.d.ts.map +1 -1
  283. package/build-types/button/types.d.ts +0 -4
  284. package/build-types/button/types.d.ts.map +1 -1
  285. package/build-types/card/card/hook.d.ts +46 -46
  286. package/build-types/card/card-body/hook.d.ts +46 -46
  287. package/build-types/card/card-divider/hook.d.ts +47 -47
  288. package/build-types/card/card-footer/hook.d.ts +46 -46
  289. package/build-types/card/card-header/hook.d.ts +46 -46
  290. package/build-types/card/card-media/hook.d.ts +46 -46
  291. package/build-types/card/stories/index.story.d.ts +2 -2
  292. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts +7 -0
  293. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -0
  294. package/build-types/circular-option-picker/circular-option-picker-context.d.ts +7 -0
  295. package/build-types/circular-option-picker/circular-option-picker-context.d.ts.map +1 -0
  296. package/build-types/circular-option-picker/circular-option-picker-option-group.d.ts +7 -0
  297. package/build-types/circular-option-picker/circular-option-picker-option-group.d.ts.map +1 -0
  298. package/build-types/circular-option-picker/circular-option-picker-option.d.ts +4 -0
  299. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -0
  300. package/build-types/circular-option-picker/circular-option-picker.d.ts +11 -0
  301. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -0
  302. package/build-types/circular-option-picker/index.d.ts +5 -56
  303. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  304. package/build-types/circular-option-picker/stories/index.story.d.ts +3 -1
  305. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  306. package/build-types/circular-option-picker/test/index.d.ts +2 -0
  307. package/build-types/circular-option-picker/test/index.d.ts.map +1 -0
  308. package/build-types/circular-option-picker/types.d.ts +53 -1
  309. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  310. package/build-types/color-palette/index.d.ts +3 -19
  311. package/build-types/color-palette/index.d.ts.map +1 -1
  312. package/build-types/color-palette/stories/index.story.d.ts +3 -36
  313. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  314. package/build-types/color-palette/styles.d.ts +1 -1
  315. package/build-types/color-palette/types.d.ts +31 -1
  316. package/build-types/color-palette/types.d.ts.map +1 -1
  317. package/build-types/color-picker/component.d.ts +1 -1
  318. package/build-types/color-picker/stories/index.story.d.ts +1 -1
  319. package/build-types/color-picker/styles.d.ts +6 -6
  320. package/build-types/combobox-control/index.d.ts.map +1 -1
  321. package/build-types/combobox-control/stories/index.story.d.ts +2 -2
  322. package/build-types/composite/index.d.ts +14 -1
  323. package/build-types/composite/index.d.ts.map +1 -1
  324. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
  325. package/build-types/date-time/date/styles.d.ts +3 -3
  326. package/build-types/date-time/date-time/styles.d.ts +2 -2
  327. package/build-types/date-time/time/index.d.ts.map +1 -1
  328. package/build-types/date-time/time/styles.d.ts +12 -12
  329. package/build-types/dropdown/index.d.ts.map +1 -1
  330. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  331. package/build-types/dropdown/types.d.ts +12 -4
  332. package/build-types/dropdown/types.d.ts.map +1 -1
  333. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  334. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  335. package/build-types/dropdown-menu/types.d.ts +22 -5
  336. package/build-types/dropdown-menu/types.d.ts.map +1 -1
  337. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  338. package/build-types/duotone-picker/duotone-picker.d.ts +1 -1
  339. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  340. package/build-types/duotone-picker/types.d.ts +31 -1
  341. package/build-types/duotone-picker/types.d.ts.map +1 -1
  342. package/build-types/elevation/hook.d.ts +46 -46
  343. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  344. package/build-types/flex/flex/hook.d.ts +46 -46
  345. package/build-types/flex/flex-block/hook.d.ts +46 -46
  346. package/build-types/flex/flex-item/hook.d.ts +46 -46
  347. package/build-types/focal-point-picker/stories/index.story.d.ts +8 -8
  348. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  349. package/build-types/focusable-iframe/index.d.ts +4 -5
  350. package/build-types/focusable-iframe/index.d.ts.map +1 -1
  351. package/build-types/focusable-iframe/types.d.ts +8 -0
  352. package/build-types/focusable-iframe/types.d.ts.map +1 -0
  353. package/build-types/font-size-picker/styles.d.ts +2 -2
  354. package/build-types/form-token-field/index.d.ts.map +1 -1
  355. package/build-types/form-token-field/types.d.ts +6 -0
  356. package/build-types/form-token-field/types.d.ts.map +1 -1
  357. package/build-types/gradient-picker/index.d.ts +1 -1
  358. package/build-types/gradient-picker/index.d.ts.map +1 -1
  359. package/build-types/gradient-picker/stories/index.story.d.ts +3 -36
  360. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  361. package/build-types/gradient-picker/types.d.ts +31 -1
  362. package/build-types/gradient-picker/types.d.ts.map +1 -1
  363. package/build-types/grid/hook.d.ts +46 -46
  364. package/build-types/h-stack/component.d.ts +1 -1
  365. package/build-types/h-stack/hook.d.ts +46 -46
  366. package/build-types/heading/hook.d.ts +45 -45
  367. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -1
  368. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -0
  369. package/build-types/higher-order/with-focus-outside/index.d.ts.map +1 -1
  370. package/build-types/higher-order/with-focus-outside/test/index.d.ts +2 -0
  371. package/build-types/higher-order/with-focus-outside/test/index.d.ts.map +1 -0
  372. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  373. package/build-types/index.d.ts +1 -1
  374. package/build-types/index.d.ts.map +1 -1
  375. package/build-types/isolated-event-container/test/index.d.ts +2 -0
  376. package/build-types/isolated-event-container/test/index.d.ts.map +1 -0
  377. package/build-types/item-group/item/hook.d.ts +46 -46
  378. package/build-types/item-group/item-group/hook.d.ts +46 -46
  379. package/build-types/menu-item/index.d.ts +1 -1
  380. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  381. package/build-types/modal/index.d.ts.map +1 -1
  382. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  383. package/build-types/modal/types.d.ts +1 -1
  384. package/build-types/modal/types.d.ts.map +1 -1
  385. package/build-types/navigable-container/menu.d.ts +1 -1
  386. package/build-types/navigation/back-button/index.d.ts +1 -1
  387. package/build-types/navigation/styles/navigation-styles.d.ts +5 -3
  388. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  389. package/build-types/navigator/navigator-back-button/component.d.ts +2 -3
  390. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  391. package/build-types/navigator/navigator-back-button/hook.d.ts +53 -54
  392. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  393. package/build-types/navigator/navigator-button/component.d.ts +2 -3
  394. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  395. package/build-types/navigator/navigator-button/hook.d.ts +53 -54
  396. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  397. package/build-types/navigator/navigator-to-parent-button/component.d.ts +2 -3
  398. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
  399. package/build-types/notice/index.d.ts.map +1 -1
  400. package/build-types/number-control/index.d.ts +3 -3
  401. package/build-types/number-control/stories/index.story.d.ts +3 -3
  402. package/build-types/palette-edit/styles.d.ts +4 -4
  403. package/build-types/palette-edit/styles.d.ts.map +1 -1
  404. package/build-types/placeholder/index.d.ts.map +1 -1
  405. package/build-types/popover/index.d.ts +1 -1
  406. package/build-types/popover/index.d.ts.map +1 -1
  407. package/build-types/popover/overlay-middlewares.d.ts +1 -1
  408. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  409. package/build-types/popover/types.d.ts +0 -4
  410. package/build-types/popover/types.d.ts.map +1 -1
  411. package/build-types/popover/utils.d.ts +2 -6
  412. package/build-types/popover/utils.d.ts.map +1 -1
  413. package/build-types/range-control/index.d.ts +1 -1
  414. package/build-types/range-control/styles/range-control-styles.d.ts +3 -3
  415. package/build-types/resizable-box/index.d.ts +1 -1
  416. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  417. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  418. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  419. package/build-types/scrollable/hook.d.ts +46 -46
  420. package/build-types/search-control/index.d.ts +4 -2
  421. package/build-types/search-control/index.d.ts.map +1 -1
  422. package/build-types/search-control/stories/index.story.d.ts +8 -4
  423. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  424. package/build-types/search-control/types.d.ts +12 -0
  425. package/build-types/search-control/types.d.ts.map +1 -1
  426. package/build-types/spacer/hook.d.ts +46 -46
  427. package/build-types/spinner/index.d.ts +1 -1
  428. package/build-types/surface/hook.d.ts +46 -46
  429. package/build-types/text/hook.d.ts +46 -46
  430. package/build-types/text/styles.d.ts.map +1 -1
  431. package/build-types/text-control/index.d.ts +3 -3
  432. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  433. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +2 -4
  434. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
  435. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +2 -4
  436. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  437. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -2
  438. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  439. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +1 -5
  440. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  441. package/build-types/toggle-group-control/toggle-group-control/utils.d.ts +18 -0
  442. package/build-types/toggle-group-control/toggle-group-control/utils.d.ts.map +1 -0
  443. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -1
  444. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +5 -1
  445. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  446. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +1 -0
  447. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  448. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  449. package/build-types/toggle-group-control/types.d.ts +13 -24
  450. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  451. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  452. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  453. package/build-types/toolbar/toolbar-button/index.d.ts +16 -22
  454. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  455. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +3 -1
  456. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -1
  457. package/build-types/toolbar/toolbar-group/index.d.ts +10 -14
  458. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -1
  459. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +3 -5
  460. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -1
  461. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +7 -5
  462. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -1
  463. package/build-types/toolbar/toolbar-group/types.d.ts +77 -0
  464. package/build-types/toolbar/toolbar-group/types.d.ts.map +1 -0
  465. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  466. package/build-types/tools-panel/tools-panel/hook.d.ts +46 -46
  467. package/build-types/tools-panel/tools-panel-header/hook.d.ts +46 -46
  468. package/build-types/tools-panel/tools-panel-item/hook.d.ts +46 -46
  469. package/build-types/tooltip/index.d.ts +8 -5
  470. package/build-types/tooltip/index.d.ts.map +1 -1
  471. package/build-types/tooltip/stories/index.story.d.ts +13 -0
  472. package/build-types/tooltip/stories/index.story.d.ts.map +1 -0
  473. package/build-types/tooltip/test/index.d.ts +2 -0
  474. package/build-types/tooltip/test/index.d.ts.map +1 -0
  475. package/build-types/tooltip/test/utils/index.d.ts +11 -0
  476. package/build-types/tooltip/test/utils/index.d.ts.map +1 -0
  477. package/build-types/tooltip/types.d.ts +61 -0
  478. package/build-types/tooltip/types.d.ts.map +1 -0
  479. package/build-types/truncate/hook.d.ts +46 -46
  480. package/build-types/ui/tooltip/content.d.ts +1 -1
  481. package/build-types/unit-control/index.d.ts +1 -1
  482. package/build-types/unit-control/index.d.ts.map +1 -1
  483. package/build-types/unit-control/styles/unit-control-styles.d.ts +3 -3
  484. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  485. package/build-types/unit-control/unit-select-control.d.ts +1 -1
  486. package/build-types/utils/use-deprecated-props.d.ts +1 -1
  487. package/build-types/v-stack/component.d.ts +1 -1
  488. package/build-types/v-stack/hook.d.ts +46 -46
  489. package/build-types/v-stack/stories/index.story.d.ts +2 -2
  490. package/package.json +20 -20
  491. package/src/animation/index.tsx +1 -0
  492. package/src/border-control/border-control/README.md +2 -2
  493. package/src/border-control/border-control-dropdown/component.tsx +1 -1
  494. package/src/border-control/styles.ts +7 -7
  495. package/src/border-control/test/index.js +79 -69
  496. package/src/box-control/unit-control.tsx +1 -1
  497. package/src/button/README.md +0 -6
  498. package/src/button/index.tsx +9 -1
  499. package/src/button/test/index.tsx +19 -0
  500. package/src/button/types.ts +0 -4
  501. package/src/circular-option-picker/README.md +14 -0
  502. package/src/circular-option-picker/circular-option-picker-actions.tsx +60 -0
  503. package/src/circular-option-picker/circular-option-picker-context.tsx +12 -0
  504. package/src/circular-option-picker/circular-option-picker-option-group.tsx +34 -0
  505. package/src/circular-option-picker/circular-option-picker-option.tsx +139 -0
  506. package/src/circular-option-picker/circular-option-picker.tsx +202 -0
  507. package/src/circular-option-picker/index.tsx +7 -174
  508. package/src/circular-option-picker/stories/index.story.tsx +34 -9
  509. package/src/circular-option-picker/style.scss +11 -7
  510. package/src/circular-option-picker/test/index.tsx +133 -0
  511. package/src/circular-option-picker/types.ts +64 -1
  512. package/src/color-palette/README.md +14 -0
  513. package/src/color-palette/index.tsx +69 -28
  514. package/src/color-palette/stories/index.story.tsx +16 -2
  515. package/src/color-palette/test/index.tsx +32 -30
  516. package/src/color-palette/types.ts +34 -1
  517. package/src/combobox-control/index.tsx +7 -5
  518. package/src/composite/{index.js → index.ts} +3 -0
  519. package/src/confirm-dialog/stories/index.story.js +13 -14
  520. package/src/confirm-dialog/test/index.js +10 -18
  521. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +1 -1
  522. package/src/custom-gradient-picker/gradient-bar/test/utils.ts +5 -5
  523. package/src/date-time/time/index.tsx +8 -1
  524. package/src/date-time/time/timezone.tsx +1 -1
  525. package/src/dropdown/README.md +13 -3
  526. package/src/dropdown/index.tsx +16 -34
  527. package/src/dropdown/stories/index.story.tsx +10 -7
  528. package/src/dropdown/types.ts +12 -4
  529. package/src/dropdown-menu/README.md +18 -0
  530. package/src/dropdown-menu/index.tsx +8 -1
  531. package/src/dropdown-menu/stories/index.story.tsx +5 -0
  532. package/src/dropdown-menu/types.ts +23 -6
  533. package/src/dropdown-menu-v2/styles.ts +1 -1
  534. package/src/duotone-picker/README.md +14 -0
  535. package/src/duotone-picker/color-list-picker/index.tsx +28 -12
  536. package/src/duotone-picker/duotone-picker.tsx +33 -0
  537. package/src/duotone-picker/types.ts +34 -1
  538. package/src/focusable-iframe/{index.js → index.tsx} +7 -4
  539. package/src/focusable-iframe/types.ts +9 -0
  540. package/src/form-token-field/README.md +1 -0
  541. package/src/form-token-field/index.tsx +5 -1
  542. package/src/form-token-field/style.scss +5 -9
  543. package/src/form-token-field/test/index.tsx +36 -1
  544. package/src/form-token-field/types.ts +7 -1
  545. package/src/gradient-picker/README.md +14 -0
  546. package/src/gradient-picker/index.tsx +60 -11
  547. package/src/gradient-picker/types.ts +34 -1
  548. package/src/higher-order/navigate-regions/index.tsx +5 -6
  549. package/src/higher-order/with-filters/test/index.tsx +36 -43
  550. package/src/higher-order/with-focus-outside/{index.js → index.tsx} +8 -5
  551. package/src/higher-order/with-focus-outside/test/{index.js → index.tsx} +13 -11
  552. package/src/higher-order/with-notices/test/index.tsx +1 -1
  553. package/src/higher-order/with-spoken-messages/index.tsx +7 -8
  554. package/src/index.ts +5 -1
  555. package/src/input-control/styles/input-control-styles.tsx +2 -2
  556. package/src/isolated-event-container/test/{index.js → index.tsx} +1 -1
  557. package/src/mobile/bottom-sheet/index.native.js +1 -0
  558. package/src/mobile/global-styles-context/index.native.js +7 -8
  559. package/src/modal/README.md +7 -1
  560. package/src/modal/index.tsx +27 -3
  561. package/src/modal/stories/index.story.tsx +2 -1
  562. package/src/modal/test/index.tsx +231 -0
  563. package/src/modal/types.ts +3 -1
  564. package/src/navigation/use-navigation-tree-nodes.tsx +1 -1
  565. package/src/notice/index.tsx +18 -6
  566. package/src/notice/style.scss +0 -1
  567. package/src/notice/test/__snapshots__/index.tsx.snap +9 -1
  568. package/src/palette-edit/styles.js +2 -1
  569. package/src/placeholder/index.tsx +16 -8
  570. package/src/placeholder/style.scss +2 -16
  571. package/src/placeholder/test/index.tsx +34 -15
  572. package/src/popover/index.tsx +47 -110
  573. package/src/popover/test/index.tsx +3 -3
  574. package/src/popover/types.ts +0 -5
  575. package/src/popover/utils.ts +19 -67
  576. package/src/search-control/README.md +7 -0
  577. package/src/search-control/index.tsx +10 -1
  578. package/src/search-control/style.scss +14 -7
  579. package/src/search-control/types.ts +12 -0
  580. package/src/tab-panel/test/index.tsx +5 -0
  581. package/src/text/styles.js +2 -1
  582. package/src/theme/README.md +5 -5
  583. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +567 -59
  584. package/src/toggle-group-control/test/index.tsx +110 -56
  585. package/src/toggle-group-control/toggle-group-control/README.md +0 -1
  586. package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +39 -57
  587. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +52 -48
  588. package/src/toggle-group-control/toggle-group-control/component.tsx +12 -6
  589. package/src/toggle-group-control/toggle-group-control/styles.ts +2 -19
  590. package/src/toggle-group-control/toggle-group-control/utils.ts +50 -0
  591. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +70 -20
  592. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +17 -3
  593. package/src/toggle-group-control/types.ts +14 -32
  594. package/src/toolbar/stories/index.story.tsx +3 -5
  595. package/src/toolbar/test/toolbar-group.tsx +13 -7
  596. package/src/toolbar/toolbar/index.tsx +9 -1
  597. package/src/toolbar/toolbar-dropdown-menu/{index.js → index.tsx} +11 -4
  598. package/src/toolbar/toolbar-group/README.md +2 -2
  599. package/src/toolbar/toolbar-group/{index.js → index.tsx} +19 -14
  600. package/src/toolbar/toolbar-group/{toolbar-group-collapsed.js → toolbar-group-collapsed.tsx} +10 -4
  601. package/src/toolbar/toolbar-group/toolbar-group-container.tsx +16 -0
  602. package/src/toolbar/toolbar-group/types.ts +92 -0
  603. package/src/toolbar/toolbar-item/index.tsx +3 -1
  604. package/src/tooltip/README.md +31 -28
  605. package/src/tooltip/index.tsx +106 -0
  606. package/src/tooltip/stories/index.story.tsx +59 -0
  607. package/src/tooltip/style.scss +2 -27
  608. package/src/tooltip/test/index.tsx +335 -0
  609. package/src/tooltip/test/utils/index.tsx +20 -0
  610. package/src/tooltip/types.ts +61 -0
  611. package/src/ui/context/context-connect.ts +3 -3
  612. package/src/ui/context/wordpress-component.ts +4 -4
  613. package/src/unit-control/index.tsx +9 -4
  614. package/src/unit-control/styles/unit-control-styles.ts +3 -1
  615. package/src/unit-control/test/utils.ts +1 -1
  616. package/src/utils/colors-values.js +1 -1
  617. package/src/utils/use-deprecated-props.ts +1 -1
  618. package/tsconfig.tsbuildinfo +1 -1
  619. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +0 -78
  620. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +0 -1
  621. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +0 -76
  622. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +0 -1
  623. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts +0 -9
  624. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +0 -1
  625. package/src/color-palette/test/__snapshots__/index.tsx.snap +0 -288
  626. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +0 -84
  627. package/src/toolbar/toolbar-group/toolbar-group-container.js +0 -8
  628. package/src/tooltip/index.js +0 -293
  629. package/src/tooltip/stories/index.story.js +0 -85
  630. package/src/tooltip/test/index.js +0 -323
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_compose","_deprecated","_context","_popover","useObservableState","initialState","onStateChange","state","setState","useState","value","UnconnectedDropdown","props","forwardedRef","renderContent","renderToggle","className","contentClassName","expandOnMobile","headerTitle","focusOnMount","popoverProps","onClose","onToggle","style","position","variant","useContextSystem","undefined","deprecated","since","alternative","hint","fallbackPopoverAnchor","setFallbackPopoverAnchor","containerRef","useRef","isOpen","setIsOpen","useEffect","toggle","closeIfFocusOutside","current","ownerDocument","dialog","activeElement","closest","contains","close","args","popoverPropsHaveAnchor","anchor","anchorRef","getAnchorRect","anchorRect","createElement","ref","useMergeRefs","tabIndex","default","onFocusOutside","offset","classnames","Dropdown","contextConnect","exports","_default"],"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":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAKA,SAASO,kBAAkBA,CAC1BC,YAAqB,EACrBC,aAA6C,EAC5C;EACD,MAAM,CAAEC,KAAK,EAAEC,QAAQ,CAAE,GAAG,IAAAC,iBAAQ,EAAEJ,YAAa,CAAC;EACpD,OAAO,CACNE,KAAK,EACHG,KAAc,IAAM;IACrBF,QAAQ,CAAEE,KAAM,CAAC;IACjB,IAAKJ,aAAa,EAAG;MACpBA,aAAa,CAAEI,KAAM,CAAC;IACvB;EACD,CAAC,CACD;AACF;AAEA,MAAMC,mBAAmB,GAAGA,CAC3BC,KAAoB,EACpBC,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AY;IACjBL,SAAS,EAAG,IAAA8C,mBAAU,EACrB,8BAA8B,EAC9BzC,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;AACO,MAAMc,QAAQ,GAAG,IAAAC,uBAAc,EAAErD,mBAAmB,EAAE,UAAW,CAAC;AAACsD,OAAA,CAAAF,QAAA,GAAAA,QAAA;AAAA,IAAAG,QAAA,GAE3DH,QAAQ;AAAAE,OAAA,CAAAN,OAAA,GAAAO,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_compose","_deprecated","_context","_hooks","_popover","UnconnectedDropdown","props","forwardedRef","renderContent","renderToggle","className","contentClassName","expandOnMobile","headerTitle","focusOnMount","popoverProps","onClose","onToggle","style","open","defaultOpen","position","variant","useContextSystem","undefined","deprecated","since","alternative","hint","fallbackPopoverAnchor","setFallbackPopoverAnchor","useState","containerRef","useRef","isOpen","setIsOpen","useControlledValue","defaultValue","value","onChange","closeIfFocusOutside","current","ownerDocument","dialog","activeElement","closest","contains","close","args","popoverPropsHaveAnchor","anchor","anchorRef","getAnchorRect","anchorRect","createElement","ref","useMergeRefs","tabIndex","default","onFocusOutside","offset","classnames","Dropdown","contextConnect","exports","_default"],"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":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAL,sBAAA,CAAAF,OAAA;AAlBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAMA,MAAMQ,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,CA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AAC;AAAC2D,OAAA,CAAAF,QAAA,GAAAA,QAAA;AAAA,IAAAG,QAAA,GAE3DH,QAAQ;AAAAE,OAAA,CAAAN,OAAA,GAAAO,QAAA"}
@@ -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":""}
@@ -50,6 +50,9 @@ function UnconnectedDropdownMenu(dropdownMenuProps) {
50
50
  disableOpenOnArrowDown = false,
51
51
  text,
52
52
  noIcons,
53
+ open,
54
+ defaultOpen,
55
+ onToggle: onToggleProp,
53
56
  // Context
54
57
  variant
55
58
  } = (0, _context.useContextSystem)(dropdownMenuProps, 'DropdownMenu');
@@ -151,7 +154,10 @@ function UnconnectedDropdownMenu(dropdownMenuProps) {
151
154
  role: control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.role : 'menuitem',
152
155
  disabled: control.isDisabled
153
156
  }, control.title))));
154
- }
157
+ },
158
+ open: open,
159
+ defaultOpen: defaultOpen,
160
+ onToggle: onToggleProp
155
161
  });
156
162
  }
157
163
 
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_icons","_context","_button","_dropdown","_navigableContainer","mergeProps","defaultProps","props","mergedProps","className","classnames","isFunction","maybeFunc","UnconnectedDropdownMenu","dropdownMenuProps","children","controls","icon","menu","label","popoverProps","toggleProps","menuProps","disableOpenOnArrowDown","text","noIcons","variant","useContextSystem","length","controlSets","Array","isArray","mergedPopoverProps","_element","createElement","default","renderToggle","isOpen","onToggle","_toggleProps$showTool","openOnArrowDown","event","code","preventDefault","as","Toggle","Button","restToggleProps","mergedToggleProps","onClick","onKeyDown","showTooltip","renderContent","mergedMenuProps","NavigableMenu","role","flatMap","controlSet","indexOfSet","map","control","indexOfControl","key","join","stopPropagation","onClose","isActive","title","undefined","disabled","isDisabled","DropdownMenu","contextConnectWithoutRef","exports","_default"],"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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAWA,SAASM,UAAUA,CAEhBC,YAA0B,GAAG,CAAC,CAAC,EAAEC,KAAQ,GAAG,CAAC,CAAM,EAAG;EACxD,MAAM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AI,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;AACO,MAAMI,YAAY,GAAG,IAAAC,iCAAwB,EACnD3D,uBAAuB,EACvB,cACD,CAAC;AAAC4D,OAAA,CAAAF,YAAA,GAAAA,YAAA;AAAA,IAAAG,QAAA,GAEaH,YAAY;AAAAE,OAAA,CAAAtC,OAAA,GAAAuC,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_icons","_context","_button","_dropdown","_navigableContainer","mergeProps","defaultProps","props","mergedProps","className","classnames","isFunction","maybeFunc","UnconnectedDropdownMenu","dropdownMenuProps","children","controls","icon","menu","label","popoverProps","toggleProps","menuProps","disableOpenOnArrowDown","text","noIcons","open","defaultOpen","onToggle","onToggleProp","variant","useContextSystem","length","controlSets","Array","isArray","mergedPopoverProps","_element","createElement","default","renderToggle","isOpen","_toggleProps$showTool","openOnArrowDown","event","code","preventDefault","as","Toggle","Button","restToggleProps","mergedToggleProps","onClick","onKeyDown","showTooltip","renderContent","mergedMenuProps","NavigableMenu","role","flatMap","controlSet","indexOfSet","map","control","indexOfControl","key","join","stopPropagation","onClose","isActive","title","undefined","disabled","isDisabled","DropdownMenu","contextConnectWithoutRef","exports","_default"],"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(\n\tUnconnectedDropdownMenu,\n\t'DropdownMenu'\n);\n\nexport default DropdownMenu;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAWA,SAASM,UAAUA,CAEhBC,YAA0B,GAAG,CAAC,CAAC,EAAEC,KAAQ,GAAG,CAAC,CAAM,EAAG;EACxD,MAAMC,WAAc,GAAG;IACtB,GAAGF,YAAY;IACf,GAAGC;EACJ,C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,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;IACH5C,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;AACO,MAAM6C,YAAY,GAAG,IAAAC,iCAAwB,EACnD9D,uBAAuB,EACvB,cACD,CAAC;AAAC+D,OAAA,CAAAF,YAAA,GAAAA,YAAA;AAAA,IAAAG,QAAA,GAEaH,YAAY;AAAAE,OAAA,CAAArC,OAAA,GAAAsC,QAAA"}
@@ -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":""}