@wordpress/components 29.0.0 → 29.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (469) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/LICENSE.md +1 -1
  3. package/build/badge/index.js +64 -0
  4. package/build/badge/index.js.map +1 -0
  5. package/build/badge/types.js +6 -0
  6. package/build/badge/types.js.map +1 -0
  7. package/build/box-control/index.js +5 -1
  8. package/build/box-control/index.js.map +1 -1
  9. package/build/box-control/input-control.js +90 -29
  10. package/build/box-control/input-control.js.map +1 -1
  11. package/build/box-control/types.js.map +1 -1
  12. package/build/box-control/utils.js +50 -0
  13. package/build/box-control/utils.js.map +1 -1
  14. package/build/button-group/index.js +10 -0
  15. package/build/button-group/index.js.map +1 -1
  16. package/build/button-group/types.js.map +1 -1
  17. package/build/custom-select-control/index.js +3 -5
  18. package/build/custom-select-control/index.js.map +1 -1
  19. package/build/custom-select-control-v2/custom-select.js +2 -3
  20. package/build/custom-select-control-v2/custom-select.js.map +1 -1
  21. package/build/date-time/date/index.js +1 -0
  22. package/build/date-time/date/index.js.map +1 -1
  23. package/build/dimension-control/index.js +1 -0
  24. package/build/dimension-control/index.js.map +1 -1
  25. package/build/font-size-picker/styles.js +9 -9
  26. package/build/font-size-picker/styles.js.map +1 -1
  27. package/build/heading/hook.js +1 -1
  28. package/build/heading/hook.js.map +1 -1
  29. package/build/input-control/index.js +9 -0
  30. package/build/input-control/index.js.map +1 -1
  31. package/build/input-control/types.js.map +1 -1
  32. package/build/menu/checkbox-item.js +2 -0
  33. package/build/menu/checkbox-item.js.map +1 -1
  34. package/build/menu/index.js +25 -94
  35. package/build/menu/index.js.map +1 -1
  36. package/build/menu/item.js +10 -1
  37. package/build/menu/item.js.map +1 -1
  38. package/build/menu/popover.js +89 -0
  39. package/build/menu/popover.js.map +1 -0
  40. package/build/menu/radio-item.js +2 -0
  41. package/build/menu/radio-item.js.map +1 -1
  42. package/build/menu/submenu-trigger-item.js +58 -0
  43. package/build/menu/submenu-trigger-item.js.map +1 -0
  44. package/build/menu/trigger-button.js +45 -0
  45. package/build/menu/trigger-button.js.map +1 -0
  46. package/build/menu/types.js.map +1 -1
  47. package/build/navigation/back-button/index.js +1 -0
  48. package/build/navigation/back-button/index.js.map +1 -1
  49. package/build/navigation/index.js +6 -0
  50. package/build/navigation/index.js.map +1 -1
  51. package/build/navigation/item/index.js +1 -0
  52. package/build/navigation/item/index.js.map +1 -1
  53. package/build/number-control/index.js +1 -0
  54. package/build/number-control/index.js.map +1 -1
  55. package/build/palette-edit/index.js +1 -0
  56. package/build/palette-edit/index.js.map +1 -1
  57. package/build/private-apis.js +3 -1
  58. package/build/private-apis.js.map +1 -1
  59. package/build/radio-group/index.js +6 -0
  60. package/build/radio-group/index.js.map +1 -1
  61. package/build/radio-group/radio.js +2 -3
  62. package/build/radio-group/radio.js.map +1 -1
  63. package/build/range-control/styles/range-control-styles.js +28 -28
  64. package/build/range-control/styles/range-control-styles.js.map +1 -1
  65. package/build/select-control/index.js +9 -0
  66. package/build/select-control/index.js.map +1 -1
  67. package/build/select-control/types.js.map +1 -1
  68. package/build/slot-fill/context.js +4 -3
  69. package/build/slot-fill/context.js.map +1 -1
  70. package/build/slot-fill/fill.js +10 -15
  71. package/build/slot-fill/fill.js.map +1 -1
  72. package/build/slot-fill/provider.js +41 -55
  73. package/build/slot-fill/provider.js.map +1 -1
  74. package/build/slot-fill/slot.js +31 -23
  75. package/build/slot-fill/slot.js.map +1 -1
  76. package/build/slot-fill/types.js.map +1 -1
  77. package/build/tab-panel/index.js +2 -3
  78. package/build/tab-panel/index.js.map +1 -1
  79. package/build/tabs/index.js +21 -4
  80. package/build/tabs/index.js.map +1 -1
  81. package/build/tabs/types.js.map +1 -1
  82. package/build/text/hook.js +6 -6
  83. package/build/text/hook.js.map +1 -1
  84. package/build/text/styles.js +7 -7
  85. package/build/text/styles.js.map +1 -1
  86. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +2 -3
  87. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  88. package/build/tooltip/index.js +2 -3
  89. package/build/tooltip/index.js.map +1 -1
  90. package/build/tree-select/index.js +10 -2
  91. package/build/tree-select/index.js.map +1 -1
  92. package/build/tree-select/types.js.map +1 -1
  93. package/build-module/badge/index.js +57 -0
  94. package/build-module/badge/index.js.map +1 -0
  95. package/build-module/badge/types.js +2 -0
  96. package/build-module/badge/types.js.map +1 -0
  97. package/build-module/box-control/index.js +5 -1
  98. package/build-module/box-control/index.js.map +1 -1
  99. package/build-module/box-control/input-control.js +92 -31
  100. package/build-module/box-control/input-control.js.map +1 -1
  101. package/build-module/box-control/types.js.map +1 -1
  102. package/build-module/box-control/utils.js +47 -0
  103. package/build-module/box-control/utils.js.map +1 -1
  104. package/build-module/button-group/index.js +10 -0
  105. package/build-module/button-group/index.js.map +1 -1
  106. package/build-module/button-group/types.js.map +1 -1
  107. package/build-module/custom-select-control/index.js +3 -5
  108. package/build-module/custom-select-control/index.js.map +1 -1
  109. package/build-module/custom-select-control-v2/custom-select.js +1 -2
  110. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  111. package/build-module/date-time/date/index.js +1 -0
  112. package/build-module/date-time/date/index.js.map +1 -1
  113. package/build-module/dimension-control/index.js +1 -0
  114. package/build-module/dimension-control/index.js.map +1 -1
  115. package/build-module/font-size-picker/styles.js +9 -9
  116. package/build-module/font-size-picker/styles.js.map +1 -1
  117. package/build-module/heading/hook.js +1 -1
  118. package/build-module/heading/hook.js.map +1 -1
  119. package/build-module/input-control/index.js +9 -0
  120. package/build-module/input-control/index.js.map +1 -1
  121. package/build-module/input-control/types.js.map +1 -1
  122. package/build-module/menu/checkbox-item.js +2 -0
  123. package/build-module/menu/checkbox-item.js.map +1 -1
  124. package/build-module/menu/index.js +28 -97
  125. package/build-module/menu/index.js.map +1 -1
  126. package/build-module/menu/item.js +10 -1
  127. package/build-module/menu/item.js.map +1 -1
  128. package/build-module/menu/popover.js +81 -0
  129. package/build-module/menu/popover.js.map +1 -0
  130. package/build-module/menu/radio-item.js +2 -0
  131. package/build-module/menu/radio-item.js.map +1 -1
  132. package/build-module/menu/submenu-trigger-item.js +50 -0
  133. package/build-module/menu/submenu-trigger-item.js.map +1 -0
  134. package/build-module/menu/trigger-button.js +37 -0
  135. package/build-module/menu/trigger-button.js.map +1 -0
  136. package/build-module/menu/types.js.map +1 -1
  137. package/build-module/navigation/back-button/index.js +1 -0
  138. package/build-module/navigation/back-button/index.js.map +1 -1
  139. package/build-module/navigation/index.js +6 -0
  140. package/build-module/navigation/index.js.map +1 -1
  141. package/build-module/navigation/item/index.js +1 -0
  142. package/build-module/navigation/item/index.js.map +1 -1
  143. package/build-module/number-control/index.js +1 -0
  144. package/build-module/number-control/index.js.map +1 -1
  145. package/build-module/palette-edit/index.js +1 -0
  146. package/build-module/palette-edit/index.js.map +1 -1
  147. package/build-module/private-apis.js +3 -1
  148. package/build-module/private-apis.js.map +1 -1
  149. package/build-module/radio-group/index.js +6 -0
  150. package/build-module/radio-group/index.js.map +1 -1
  151. package/build-module/radio-group/radio.js +1 -2
  152. package/build-module/radio-group/radio.js.map +1 -1
  153. package/build-module/range-control/styles/range-control-styles.js +28 -28
  154. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  155. package/build-module/select-control/index.js +9 -0
  156. package/build-module/select-control/index.js.map +1 -1
  157. package/build-module/select-control/types.js.map +1 -1
  158. package/build-module/slot-fill/context.js +5 -3
  159. package/build-module/slot-fill/context.js.map +1 -1
  160. package/build-module/slot-fill/fill.js +10 -15
  161. package/build-module/slot-fill/fill.js.map +1 -1
  162. package/build-module/slot-fill/provider.js +41 -55
  163. package/build-module/slot-fill/provider.js.map +1 -1
  164. package/build-module/slot-fill/slot.js +32 -24
  165. package/build-module/slot-fill/slot.js.map +1 -1
  166. package/build-module/slot-fill/types.js.map +1 -1
  167. package/build-module/tab-panel/index.js +1 -2
  168. package/build-module/tab-panel/index.js.map +1 -1
  169. package/build-module/tabs/index.js +21 -4
  170. package/build-module/tabs/index.js.map +1 -1
  171. package/build-module/tabs/types.js.map +1 -1
  172. package/build-module/text/hook.js +6 -6
  173. package/build-module/text/hook.js.map +1 -1
  174. package/build-module/text/styles.js +7 -7
  175. package/build-module/text/styles.js.map +1 -1
  176. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +1 -2
  177. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  178. package/build-module/tooltip/index.js +1 -2
  179. package/build-module/tooltip/index.js.map +1 -1
  180. package/build-module/tree-select/index.js +10 -2
  181. package/build-module/tree-select/index.js.map +1 -1
  182. package/build-module/tree-select/types.js.map +1 -1
  183. package/build-style/style-rtl.css +60 -13
  184. package/build-style/style.css +60 -13
  185. package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
  186. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  187. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  188. package/build-types/animate/stories/index.story.d.ts +7 -7
  189. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  190. package/build-types/badge/index.d.ts +8 -0
  191. package/build-types/badge/index.d.ts.map +1 -0
  192. package/build-types/badge/stories/index.story.d.ts +17 -0
  193. package/build-types/badge/stories/index.story.d.ts.map +1 -0
  194. package/build-types/badge/test/index.d.ts +2 -0
  195. package/build-types/badge/test/index.d.ts.map +1 -0
  196. package/build-types/badge/types.d.ts +13 -0
  197. package/build-types/badge/types.d.ts.map +1 -0
  198. package/build-types/base-control/stories/index.story.d.ts +1 -1
  199. package/build-types/border-box-control/stories/index.story.d.ts +1 -1
  200. package/build-types/border-control/stories/index.story.d.ts +5 -5
  201. package/build-types/box-control/index.d.ts +1 -1
  202. package/build-types/box-control/index.d.ts.map +1 -1
  203. package/build-types/box-control/input-control.d.ts +1 -1
  204. package/build-types/box-control/input-control.d.ts.map +1 -1
  205. package/build-types/box-control/stories/index.story.d.ts +356 -11
  206. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  207. package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
  208. package/build-types/box-control/types.d.ts +17 -0
  209. package/build-types/box-control/types.d.ts.map +1 -1
  210. package/build-types/box-control/utils.d.ts +27 -1
  211. package/build-types/box-control/utils.d.ts.map +1 -1
  212. package/build-types/button/stories/e2e/index.story.d.ts +1 -1
  213. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  214. package/build-types/button/stories/index.story.d.ts +7 -7
  215. package/build-types/button/stories/index.story.d.ts.map +1 -1
  216. package/build-types/button-group/index.d.ts +3 -1
  217. package/build-types/button-group/index.d.ts.map +1 -1
  218. package/build-types/button-group/stories/index.story.d.ts +6 -0
  219. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  220. package/build-types/button-group/types.d.ts +7 -0
  221. package/build-types/button-group/types.d.ts.map +1 -1
  222. package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
  223. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  224. package/build-types/color-palette/stories/index.story.d.ts +3 -3
  225. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  226. package/build-types/color-picker/styles.d.ts +2 -2
  227. package/build-types/color-picker/styles.d.ts.map +1 -1
  228. package/build-types/combobox-control/stories/index.story.d.ts +4 -4
  229. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  230. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  231. package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
  232. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  233. package/build-types/custom-select-control/stories/index.story.d.ts +3 -3
  234. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  235. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  236. package/build-types/custom-select-control-v2/stories/index.story.d.ts +3 -3
  237. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  238. package/build-types/date-time/date/index.d.ts.map +1 -1
  239. package/build-types/date-time/stories/time.story.d.ts +1 -1
  240. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  241. package/build-types/date-time/time/styles.d.ts +4 -4
  242. package/build-types/dimension-control/index.d.ts.map +1 -1
  243. package/build-types/dimension-control/stories/index.story.d.ts +1 -1
  244. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  245. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  246. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  247. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
  248. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
  249. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
  250. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
  251. package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
  252. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  253. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  254. package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
  255. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  256. package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
  257. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  258. package/build-types/guide/stories/index.story.d.ts +1 -1
  259. package/build-types/guide/stories/index.story.d.ts.map +1 -1
  260. package/build-types/icon/stories/index.story.d.ts +4 -4
  261. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  262. package/build-types/input-control/index.d.ts +1 -0
  263. package/build-types/input-control/index.d.ts.map +1 -1
  264. package/build-types/input-control/stories/index.story.d.ts +7 -7
  265. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  266. package/build-types/input-control/types.d.ts +11 -2
  267. package/build-types/input-control/types.d.ts.map +1 -1
  268. package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
  269. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  270. package/build-types/menu/checkbox-item.d.ts.map +1 -1
  271. package/build-types/menu/index.d.ts +10 -1
  272. package/build-types/menu/index.d.ts.map +1 -1
  273. package/build-types/menu/item.d.ts.map +1 -1
  274. package/build-types/menu/popover.d.ts +3 -0
  275. package/build-types/menu/popover.d.ts.map +1 -0
  276. package/build-types/menu/radio-item.d.ts.map +1 -1
  277. package/build-types/menu/stories/index.story.d.ts +9 -9
  278. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  279. package/build-types/menu/submenu-trigger-item.d.ts +3 -0
  280. package/build-types/menu/submenu-trigger-item.d.ts.map +1 -0
  281. package/build-types/menu/trigger-button.d.ts +3 -0
  282. package/build-types/menu/trigger-button.d.ts.map +1 -0
  283. package/build-types/menu/types.d.ts +208 -57
  284. package/build-types/menu/types.d.ts.map +1 -1
  285. package/build-types/menu-group/stories/index.story.d.ts +1 -1
  286. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  287. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  288. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  289. package/build-types/navigation/back-button/index.d.ts.map +1 -1
  290. package/build-types/navigation/index.d.ts.map +1 -1
  291. package/build-types/navigation/item/index.d.ts.map +1 -1
  292. package/build-types/navigation/stories/index.story.d.ts +6 -6
  293. package/build-types/navigation/stories/index.story.d.ts.map +1 -1
  294. package/build-types/notice/stories/index.story.d.ts +4 -4
  295. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  296. package/build-types/number-control/index.d.ts +1 -1
  297. package/build-types/number-control/index.d.ts.map +1 -1
  298. package/build-types/number-control/stories/index.story.d.ts +2 -2
  299. package/build-types/palette-edit/index.d.ts.map +1 -1
  300. package/build-types/palette-edit/stories/index.story.d.ts +2 -2
  301. package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
  302. package/build-types/private-apis.d.ts.map +1 -1
  303. package/build-types/progress-bar/stories/index.story.d.ts +1 -1
  304. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  305. package/build-types/query-controls/stories/index.story.d.ts +1 -1
  306. package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
  307. package/build-types/radio-group/index.d.ts.map +1 -1
  308. package/build-types/radio-group/radio.d.ts.map +1 -1
  309. package/build-types/range-control/index.d.ts +1 -1
  310. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  311. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  312. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  313. package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
  314. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  315. package/build-types/sandbox/stories/index.story.d.ts +1 -1
  316. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  317. package/build-types/search-control/stories/index.story.d.ts +1 -1
  318. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  319. package/build-types/select-control/index.d.ts +1 -0
  320. package/build-types/select-control/index.d.ts.map +1 -1
  321. package/build-types/select-control/stories/index.story.d.ts +5 -5
  322. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  323. package/build-types/select-control/types.d.ts +1 -1
  324. package/build-types/select-control/types.d.ts.map +1 -1
  325. package/build-types/shortcut/stories/index.story.d.ts +1 -1
  326. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  327. package/build-types/slot-fill/context.d.ts.map +1 -1
  328. package/build-types/slot-fill/fill.d.ts.map +1 -1
  329. package/build-types/slot-fill/provider.d.ts.map +1 -1
  330. package/build-types/slot-fill/slot.d.ts.map +1 -1
  331. package/build-types/slot-fill/types.d.ts +13 -11
  332. package/build-types/slot-fill/types.d.ts.map +1 -1
  333. package/build-types/tab-panel/index.d.ts.map +1 -1
  334. package/build-types/tab-panel/stories/index.story.d.ts +4 -4
  335. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  336. package/build-types/tabs/index.d.ts +21 -4
  337. package/build-types/tabs/index.d.ts.map +1 -1
  338. package/build-types/tabs/stories/index.story.d.ts +10 -10
  339. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  340. package/build-types/tabs/types.d.ts +13 -13
  341. package/build-types/tabs/types.d.ts.map +1 -1
  342. package/build-types/text/stories/index.story.d.ts +3 -3
  343. package/build-types/theme/stories/index.story.d.ts +1 -1
  344. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  345. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  346. package/build-types/toolbar/stories/index.story.d.ts +3 -3
  347. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  348. package/build-types/tooltip/index.d.ts.map +1 -1
  349. package/build-types/tooltip/stories/index.story.d.ts +1 -1
  350. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  351. package/build-types/tree-grid/stories/index.story.d.ts +1 -1
  352. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  353. package/build-types/tree-select/index.d.ts +3 -2
  354. package/build-types/tree-select/index.d.ts.map +1 -1
  355. package/build-types/tree-select/stories/index.story.d.ts +1 -1
  356. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  357. package/build-types/tree-select/types.d.ts +5 -1
  358. package/build-types/tree-select/types.d.ts.map +1 -1
  359. package/build-types/unit-control/index.d.ts +1 -1
  360. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  361. package/build-types/v-stack/stories/index.story.d.ts +1 -1
  362. package/package.json +19 -19
  363. package/src/alignment-matrix-control/README.md +16 -15
  364. package/src/angle-picker-control/README.md +10 -9
  365. package/src/badge/README.md +24 -0
  366. package/src/badge/docs-manifest.json +5 -0
  367. package/src/badge/index.tsx +67 -0
  368. package/src/badge/stories/index.story.tsx +54 -0
  369. package/src/badge/styles.scss +49 -0
  370. package/src/badge/test/index.tsx +45 -0
  371. package/src/badge/types.ts +12 -0
  372. package/src/base-control/README.md +22 -21
  373. package/src/box-control/README.md +41 -24
  374. package/src/box-control/index.tsx +4 -0
  375. package/src/box-control/input-control.tsx +142 -40
  376. package/src/box-control/stories/index.story.tsx +12 -0
  377. package/src/box-control/types.ts +18 -0
  378. package/src/box-control/utils.ts +60 -0
  379. package/src/button/README.md +51 -50
  380. package/src/button/style.scss +9 -10
  381. package/src/button/test/index.tsx +9 -2
  382. package/src/button-group/README.md +4 -0
  383. package/src/button-group/index.tsx +11 -1
  384. package/src/button-group/stories/index.story.tsx +8 -1
  385. package/src/button-group/types.ts +7 -0
  386. package/src/custom-select-control/index.tsx +3 -3
  387. package/src/custom-select-control-v2/custom-select.tsx +1 -2
  388. package/src/custom-select-control-v2/stories/index.story.tsx +4 -0
  389. package/src/date-time/date/index.tsx +1 -0
  390. package/src/dimension-control/index.tsx +1 -0
  391. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  392. package/src/disabled/stories/index.story.tsx +1 -0
  393. package/src/drop-zone/stories/index.story.tsx +7 -1
  394. package/src/font-size-picker/styles.ts +1 -0
  395. package/src/form-file-upload/README.md +22 -21
  396. package/src/gradient-picker/README.md +36 -35
  397. package/src/heading/hook.ts +1 -1
  398. package/src/heading/test/__snapshots__/index.tsx.snap +4 -4
  399. package/src/icon/README.md +9 -8
  400. package/src/input-control/README.md +1 -0
  401. package/src/input-control/index.tsx +10 -0
  402. package/src/input-control/stories/index.story.tsx +6 -1
  403. package/src/input-control/test/index.js +9 -3
  404. package/src/input-control/types.ts +11 -2
  405. package/src/menu/checkbox-item.tsx +2 -1
  406. package/src/menu/index.tsx +61 -165
  407. package/src/menu/item.tsx +17 -2
  408. package/src/menu/popover.tsx +103 -0
  409. package/src/menu/radio-item.tsx +2 -1
  410. package/src/menu/stories/index.story.tsx +533 -381
  411. package/src/menu/submenu-trigger-item.tsx +61 -0
  412. package/src/menu/test/index.tsx +266 -182
  413. package/src/menu/trigger-button.tsx +46 -0
  414. package/src/menu/types.ts +210 -63
  415. package/src/modal/stories/index.story.tsx +4 -1
  416. package/src/navigation/back-button/index.tsx +1 -0
  417. package/src/navigation/index.tsx +7 -0
  418. package/src/navigation/item/index.tsx +2 -0
  419. package/src/navigation/test/index.tsx +4 -0
  420. package/src/navigator/test/index.tsx +4 -0
  421. package/src/number-control/index.tsx +1 -0
  422. package/src/palette-edit/index.tsx +1 -0
  423. package/src/panel/stories/index.story.tsx +3 -3
  424. package/src/private-apis.ts +2 -0
  425. package/src/radio-group/index.tsx +12 -1
  426. package/src/radio-group/radio.tsx +1 -2
  427. package/src/range-control/styles/range-control-styles.ts +8 -4
  428. package/src/select-control/README.md +3 -0
  429. package/src/select-control/index.tsx +10 -0
  430. package/src/select-control/stories/index.story.tsx +2 -0
  431. package/src/select-control/test/select-control.tsx +7 -1
  432. package/src/select-control/types.ts +1 -0
  433. package/src/slot-fill/context.ts +5 -3
  434. package/src/slot-fill/fill.ts +10 -15
  435. package/src/slot-fill/provider.tsx +63 -64
  436. package/src/slot-fill/slot.tsx +40 -27
  437. package/src/slot-fill/types.ts +23 -11
  438. package/src/style.scss +1 -0
  439. package/src/tab-panel/index.tsx +1 -2
  440. package/src/tab-panel/stories/index.story.tsx +4 -0
  441. package/src/tabs/README.md +151 -187
  442. package/src/tabs/docs-manifest.json +22 -0
  443. package/src/tabs/index.tsx +21 -4
  444. package/src/tabs/stories/best-practices.mdx +99 -0
  445. package/src/tabs/stories/index.story.tsx +5 -0
  446. package/src/tabs/types.ts +13 -14
  447. package/src/text/hook.ts +2 -2
  448. package/src/text/styles.ts +1 -1
  449. package/src/text/test/__snapshots__/index.tsx.snap +3 -3
  450. package/src/text/test/index.tsx +1 -1
  451. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +2 -2
  452. package/src/toggle-group-control/test/index.tsx +7 -1
  453. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +1 -2
  454. package/src/tooltip/index.tsx +1 -2
  455. package/src/tree-grid/stories/index.story.tsx +2 -0
  456. package/src/tree-select/README.md +144 -28
  457. package/src/tree-select/docs-manifest.json +5 -0
  458. package/src/tree-select/index.tsx +11 -2
  459. package/src/tree-select/stories/index.story.tsx +1 -0
  460. package/src/tree-select/types.ts +8 -1
  461. package/tsconfig.json +0 -3
  462. package/tsconfig.tsbuildinfo +1 -1
  463. package/build/slot-fill/use-slot.js +0 -32
  464. package/build/slot-fill/use-slot.js.map +0 -1
  465. package/build-module/slot-fill/use-slot.js +0 -24
  466. package/build-module/slot-fill/use-slot.js.map +0 -1
  467. package/build-types/slot-fill/use-slot.d.ts +0 -10
  468. package/build-types/slot-fill/use-slot.d.ts.map +0 -1
  469. package/src/slot-fill/use-slot.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"names":["BaseControl","Button","HStack","space","COLORS","Container","_styled","process","env","NODE_ENV","target","label","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","Header","HeaderToggle","HeaderLabel","VisualLabel","HeaderHint","gray"],"sources":["@wordpress/components/src/font-size-picker/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { HStack } from '../h-stack';\nimport { space } from '../utils/space';\nimport { COLORS } from '../utils';\n\nexport const Container = styled.fieldset`\n\tborder: 0;\n\tmargin: 0;\n\tpadding: 0;\n`;\n\nexport const Header = styled( HStack )`\n\theight: ${ space( 4 ) };\n`;\n\nexport const HeaderToggle = styled( Button )`\n\tmargin-top: ${ space( -1 ) };\n`;\n\nexport const HeaderLabel = styled( BaseControl.VisualLabel )`\n\tdisplay: flex;\n\tgap: ${ space( 1 ) };\n\tjustify-content: flex-start;\n\tmargin-bottom: 0;\n`;\n\nexport const HeaderHint = styled.span`\n\tcolor: ${ COLORS.gray[ 700 ] };\n`;\n"],"mappings":";;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,iBAAiB;AACzC,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,MAAM,QAAQ,UAAU;AAEjC,OAAO,MAAMC,SAAS,gBAAAC,OAA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l","Button","HStack","space","COLORS","Container","_styled","process","env","NODE_ENV","target","label","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","Header","HeaderToggle","HeaderLabel","VisualLabel","HeaderHint","gray"],"sources":["@wordpress/components/src/font-size-picker/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { HStack } from '../h-stack';\nimport { space } from '../utils/space';\nimport { COLORS } from '../utils';\n\nexport const Container = styled.fieldset`\n\tborder: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tdisplay: contents;\n`;\n\nexport const Header = styled( HStack )`\n\theight: ${ space( 4 ) };\n`;\n\nexport const HeaderToggle = styled( Button )`\n\tmargin-top: ${ space( -1 ) };\n`;\n\nexport const HeaderLabel = styled( BaseControl.VisualLabel )`\n\tdisplay: flex;\n\tgap: ${ space( 1 ) };\n\tjustify-content: flex-start;\n\tmargin-bottom: 0;\n`;\n\nexport const HeaderHint = styled.span`\n\tcolor: ${ COLORS.gray[ 700 ] };\n`;\n"],"mappings":";;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,iBAAiB;AACzC,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,MAAM,QAAQ,UAAU;AAEjC,OAAO,MAAMC,SAAS,gBAAAC,OAAA,aAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,GAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAG,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,EAKrB;AAED,OAAO,MAAMC,MAAM,gBAAGX,OAAA,CAAQJ,MAAM,EAAAK,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,YAC1BR,KAAK,CAAE,CAAE,CAAC,SAAAI,OAAA,CAAAC,GAAA,CAAAC,QAAA,o7CACrB;AAED,OAAO,MAAMS,YAAY,gBAAGZ,OAAA,CAAQL,MAAM,EAAAM,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,gBAC5BR,KAAK,CAAE,CAAC,CAAE,CAAC,SAAAI,OAAA,CAAAC,GAAA,CAAAC,QAAA,o7CAC1B;AAED,OAAO,MAAMU,WAAW,gBAAGb,OAAA,CAAQN,WAAW,CAACoB,WAAW,EAAAb,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,sBAEnDR,KAAK,CAAE,CAAE,CAAC,oDAAAI,OAAA,CAAAC,GAAA,CAAAC,QAAA,o7CAGlB;AAED,OAAO,MAAMY,UAAU,gBAAAf,OAAA,SAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,aACZP,MAAM,CAACkB,IAAI,CAAE,GAAG,CAAE,SAAAf,OAAA,CAAAC,GAAA,CAAAC,QAAA,o7CAC5B","ignoreList":[]}
@@ -10,7 +10,7 @@ export function useHeading(props) {
10
10
  const {
11
11
  as: asProp,
12
12
  level = 2,
13
- color = COLORS.gray[900],
13
+ color = COLORS.theme.foreground,
14
14
  isBlock = true,
15
15
  weight = CONFIG.fontWeightHeading,
16
16
  ...otherProps
@@ -1 +1 @@
1
- {"version":3,"names":["useContextSystem","useText","getHeadingFontSize","CONFIG","COLORS","useHeading","props","as","asProp","level","color","gray","isBlock","weight","fontWeightHeading","otherProps","a11yProps","role","parseInt","textProps","size"],"sources":["@wordpress/components/src/heading/hook.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport { useText } from '../text';\nimport { getHeadingFontSize } from '../utils/font-size';\nimport { CONFIG, COLORS } from '../utils';\nimport type { HeadingProps } from './types';\n\nexport function useHeading(\n\tprops: WordPressComponentProps< HeadingProps, 'h1' >\n) {\n\tconst {\n\t\tas: asProp,\n\t\tlevel = 2,\n\t\tcolor = COLORS.gray[ 900 ],\n\t\tisBlock = true,\n\t\tweight = CONFIG.fontWeightHeading as import('react').CSSProperties[ 'fontWeight' ],\n\t\t...otherProps\n\t} = useContextSystem( props, 'Heading' );\n\n\tconst as = ( asProp || `h${ level }` ) as keyof JSX.IntrinsicElements;\n\n\tconst a11yProps: {\n\t\trole?: string;\n\t\t'aria-level'?: number;\n\t} = {};\n\tif ( typeof as === 'string' && as[ 0 ] !== 'h' ) {\n\t\t// If not a semantic `h` element, add a11y props:\n\t\ta11yProps.role = 'heading';\n\t\ta11yProps[ 'aria-level' ] =\n\t\t\ttypeof level === 'string' ? parseInt( level ) : level;\n\t}\n\n\tconst textProps = useText( {\n\t\tcolor,\n\t\tisBlock,\n\t\tweight,\n\t\tsize: getHeadingFontSize( level ),\n\t\t...otherProps,\n\t} );\n\n\treturn { ...textProps, ...a11yProps, as };\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,MAAM,EAAEC,MAAM,QAAQ,UAAU;AAGzC,OAAO,SAASC,UAAUA,CACzBC,KAAoD,EACnD;EACD,MAAM;IACLC,EAAE,EAAEC,MAAM;IACVC,KAAK,GAAG,CAAC;IACTC,KAAK,GAAGN,MAAM,CAACO,IAAI,CAAE,GAAG,CAAE;IAC1BC,OAAO,GAAG,IAAI;IACdC,MAAM,GAAGV,MAAM,CAACW,iBAAkE;IAClF,GAAGC;EACJ,CAAC,GAAGf,gBAAgB,CAAEM,KAAK,EAAE,SAAU,CAAC;EAExC,MAAMC,EAAE,GAAKC,MAAM,IAAI,IAAKC,KAAK,EAAoC;EAErE,MAAMO,SAGL,GAAG,CAAC,CAAC;EACN,IAAK,OAAOT,EAAE,KAAK,QAAQ,IAAIA,EAAE,CAAE,CAAC,CAAE,KAAK,GAAG,EAAG;IAChD;IACAS,SAAS,CAACC,IAAI,GAAG,SAAS;IAC1BD,SAAS,CAAE,YAAY,CAAE,GACxB,OAAOP,KAAK,KAAK,QAAQ,GAAGS,QAAQ,CAAET,KAAM,CAAC,GAAGA,KAAK;EACvD;EAEA,MAAMU,SAAS,GAAGlB,OAAO,CAAE;IAC1BS,KAAK;IACLE,OAAO;IACPC,MAAM;IACNO,IAAI,EAAElB,kBAAkB,CAAEO,KAAM,CAAC;IACjC,GAAGM;EACJ,CAAE,CAAC;EAEH,OAAO;IAAE,GAAGI,SAAS;IAAE,GAAGH,SAAS;IAAET;EAAG,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"names":["useContextSystem","useText","getHeadingFontSize","CONFIG","COLORS","useHeading","props","as","asProp","level","color","theme","foreground","isBlock","weight","fontWeightHeading","otherProps","a11yProps","role","parseInt","textProps","size"],"sources":["@wordpress/components/src/heading/hook.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport { useText } from '../text';\nimport { getHeadingFontSize } from '../utils/font-size';\nimport { CONFIG, COLORS } from '../utils';\nimport type { HeadingProps } from './types';\n\nexport function useHeading(\n\tprops: WordPressComponentProps< HeadingProps, 'h1' >\n) {\n\tconst {\n\t\tas: asProp,\n\t\tlevel = 2,\n\t\tcolor = COLORS.theme.foreground,\n\t\tisBlock = true,\n\t\tweight = CONFIG.fontWeightHeading as import('react').CSSProperties[ 'fontWeight' ],\n\t\t...otherProps\n\t} = useContextSystem( props, 'Heading' );\n\n\tconst as = ( asProp || `h${ level }` ) as keyof JSX.IntrinsicElements;\n\n\tconst a11yProps: {\n\t\trole?: string;\n\t\t'aria-level'?: number;\n\t} = {};\n\tif ( typeof as === 'string' && as[ 0 ] !== 'h' ) {\n\t\t// If not a semantic `h` element, add a11y props:\n\t\ta11yProps.role = 'heading';\n\t\ta11yProps[ 'aria-level' ] =\n\t\t\ttypeof level === 'string' ? parseInt( level ) : level;\n\t}\n\n\tconst textProps = useText( {\n\t\tcolor,\n\t\tisBlock,\n\t\tweight,\n\t\tsize: getHeadingFontSize( level ),\n\t\t...otherProps,\n\t} );\n\n\treturn { ...textProps, ...a11yProps, as };\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,OAAO,QAAQ,SAAS;AACjC,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,MAAM,EAAEC,MAAM,QAAQ,UAAU;AAGzC,OAAO,SAASC,UAAUA,CACzBC,KAAoD,EACnD;EACD,MAAM;IACLC,EAAE,EAAEC,MAAM;IACVC,KAAK,GAAG,CAAC;IACTC,KAAK,GAAGN,MAAM,CAACO,KAAK,CAACC,UAAU;IAC/BC,OAAO,GAAG,IAAI;IACdC,MAAM,GAAGX,MAAM,CAACY,iBAAkE;IAClF,GAAGC;EACJ,CAAC,GAAGhB,gBAAgB,CAAEM,KAAK,EAAE,SAAU,CAAC;EAExC,MAAMC,EAAE,GAAKC,MAAM,IAAI,IAAKC,KAAK,EAAoC;EAErE,MAAMQ,SAGL,GAAG,CAAC,CAAC;EACN,IAAK,OAAOV,EAAE,KAAK,QAAQ,IAAIA,EAAE,CAAE,CAAC,CAAE,KAAK,GAAG,EAAG;IAChD;IACAU,SAAS,CAACC,IAAI,GAAG,SAAS;IAC1BD,SAAS,CAAE,YAAY,CAAE,GACxB,OAAOR,KAAK,KAAK,QAAQ,GAAGU,QAAQ,CAAEV,KAAM,CAAC,GAAGA,KAAK;EACvD;EAEA,MAAMW,SAAS,GAAGnB,OAAO,CAAE;IAC1BS,KAAK;IACLG,OAAO;IACPC,MAAM;IACNO,IAAI,EAAEnB,kBAAkB,CAAEO,KAAM,CAAC;IACjC,GAAGO;EACJ,CAAE,CAAC;EAEH,OAAO;IAAE,GAAGI,SAAS;IAAE,GAAGH,SAAS;IAAEV;EAAG,CAAC;AAC1C","ignoreList":[]}
@@ -17,6 +17,7 @@ import { space } from '../utils/space';
17
17
  import { useDraft } from './utils';
18
18
  import BaseControl from '../base-control';
19
19
  import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
20
+ import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';
20
21
  import { jsx as _jsx } from "react/jsx-runtime";
21
22
  const noop = () => {};
22
23
  function useUniqueId(idProp) {
@@ -27,6 +28,7 @@ function useUniqueId(idProp) {
27
28
  export function UnforwardedInputControl(props, ref) {
28
29
  const {
29
30
  __next40pxDefaultSize,
31
+ __shouldNotWarnDeprecated36pxSize,
30
32
  __unstableStateReducer: stateReducer = state => state,
31
33
  __unstableInputWidth,
32
34
  className,
@@ -57,6 +59,12 @@ export function UnforwardedInputControl(props, ref) {
57
59
  const helpProp = !!help ? {
58
60
  'aria-describedby': `${id}__help`
59
61
  } : {};
62
+ maybeWarnDeprecated36pxSize({
63
+ componentName: 'InputControl',
64
+ __next40pxDefaultSize,
65
+ size,
66
+ __shouldNotWarnDeprecated36pxSize
67
+ });
60
68
  return /*#__PURE__*/_jsx(BaseControl, {
61
69
  className: classes,
62
70
  help: help,
@@ -110,6 +118,7 @@ export function UnforwardedInputControl(props, ref) {
110
118
  *
111
119
  * return (
112
120
  * <InputControl
121
+ * __next40pxDefaultSize
113
122
  * value={ value }
114
123
  * onChange={ ( nextValue ) => setValue( nextValue ?? '' ) }
115
124
  * />
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useInstanceId","forwardRef","InputBase","InputField","space","useDraft","BaseControl","useDeprecated36pxDefaultSizeProp","jsx","_jsx","noop","useUniqueId","idProp","instanceId","InputControl","id","UnforwardedInputControl","props","ref","__next40pxDefaultSize","__unstableStateReducer","stateReducer","state","__unstableInputWidth","className","disabled","help","hideLabelFromVision","isPressEnterToChange","label","labelPosition","onChange","onValidate","onKeyDown","prefix","size","style","suffix","value","restProps","classes","draftHookProps","onBlur","helpProp","__nextHasNoMarginBottom","children","gap","justify","paddingInlineStart","undefined","paddingInlineEnd"],"sources":["@wordpress/components/src/input-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InputBase from './input-base';\nimport InputField from './input-field';\nimport type { InputControlProps } from './types';\nimport { space } from '../utils/space';\nimport { useDraft } from './utils';\nimport BaseControl from '../base-control';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nconst noop = () => {};\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( InputControl );\n\tconst id = `inspector-input-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nexport function UnforwardedInputControl(\n\tprops: InputControlProps,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__next40pxDefaultSize,\n\t\t__unstableStateReducer: stateReducer = ( state ) => state,\n\t\t__unstableInputWidth,\n\t\tclassName,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision = false,\n\t\tid: idProp,\n\t\tisPressEnterToChange = false,\n\t\tlabel,\n\t\tlabelPosition = 'top',\n\t\tonChange = noop,\n\t\tonValidate = noop,\n\t\tonKeyDown = noop,\n\t\tprefix,\n\t\tsize = 'default',\n\t\tstyle,\n\t\tsuffix,\n\t\tvalue,\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp< InputControlProps >( props );\n\n\tconst id = useUniqueId( idProp );\n\tconst classes = clsx( 'components-input-control', className );\n\n\tconst draftHookProps = useDraft( {\n\t\tvalue,\n\t\tonBlur: restProps.onBlur,\n\t\tonChange,\n\t} );\n\n\tconst helpProp = !! help ? { 'aria-describedby': `${ id }__help` } : {};\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName={ classes }\n\t\t\thelp={ help }\n\t\t\tid={ id }\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t<InputBase\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tgap={ 3 }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\tid={ id }\n\t\t\t\tjustify=\"left\"\n\t\t\t\tlabel={ label }\n\t\t\t\tlabelPosition={ labelPosition }\n\t\t\t\tprefix={ prefix }\n\t\t\t\tsize={ size }\n\t\t\t\tstyle={ style }\n\t\t\t\tsuffix={ suffix }\n\t\t\t>\n\t\t\t\t<InputField\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t{ ...helpProp }\n\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\tclassName=\"components-input-control__input\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tid={ id }\n\t\t\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\tonValidate={ onValidate }\n\t\t\t\t\tpaddingInlineStart={ prefix ? space( 1 ) : undefined }\n\t\t\t\t\tpaddingInlineEnd={ suffix ? space( 1 ) : undefined }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tsize={ size }\n\t\t\t\t\tstateReducer={ stateReducer }\n\t\t\t\t\t{ ...draftHookProps }\n\t\t\t\t/>\n\t\t\t</InputBase>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * InputControl components let users enter and edit text. This is an experimental component\n * intended to (in time) merge with or replace `TextControl`.\n *\n * ```jsx\n * import { __experimentalInputControl as InputControl } from '@wordpress/components';\n * import { useState } from 'react';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '' );\n *\n * return (\n * \t<InputControl\n * \t\tvalue={ value }\n * \t\tonChange={ ( nextValue ) => setValue( nextValue ?? '' ) }\n * \t/>\n * );\n * };\n * ```\n */\nexport const InputControl = forwardRef( UnforwardedInputControl );\n\nexport default InputControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AAGvB;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,UAAU,MAAM,eAAe;AAEtC,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,QAAQ,QAAQ,SAAS;AAClC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,SAASC,gCAAgC,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjF,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,WAAWA,CAAEC,MAAe,EAAG;EACvC,MAAMC,UAAU,GAAGb,aAAa,CAAEc,YAAa,CAAC;EAChD,MAAMC,EAAE,GAAG,2BAA4BF,UAAU,EAAG;EAEpD,OAAOD,MAAM,IAAIG,EAAE;AACpB;AAEA,OAAO,SAASC,uBAAuBA,CACtCC,KAAwB,EACxBC,GAAqC,EACpC;EACD,MAAM;IACLC,qBAAqB;IACrBC,sBAAsB,EAAEC,YAAY,GAAKC,KAAK,IAAMA,KAAK;IACzDC,oBAAoB;IACpBC,SAAS;IACTC,QAAQ,GAAG,KAAK;IAChBC,IAAI;IACJC,mBAAmB,GAAG,KAAK;IAC3BZ,EAAE,EAAEH,MAAM;IACVgB,oBAAoB,GAAG,KAAK;IAC5BC,KAAK;IACLC,aAAa,GAAG,KAAK;IACrBC,QAAQ,GAAGrB,IAAI;IACf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AQ,EAAGA,QAAU;QACrBV,EAAE,EAAGA,EAAI;QACTa,oBAAoB,EAAGA,oBAAsB;QAC7CK,SAAS,EAAGA,SAAW;QACvBD,UAAU,EAAGA,UAAY;QACzBgB,kBAAkB,EAAGd,MAAM,GAAG9B,KAAK,CAAE,CAAE,CAAC,GAAG6C,SAAW;QACtDC,gBAAgB,EAAGb,MAAM,GAAGjC,KAAK,CAAE,CAAE,CAAC,GAAG6C,SAAW;QACpD/B,GAAG,EAAGA,GAAK;QACXiB,IAAI,EAAGA,IAAM;QACbd,YAAY,EAAGA,YAAc;QAAA,GACxBoB;MAAc,CACnB;IAAC,CACQ;EAAC,CACA,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM3B,YAAY,GAAGb,UAAU,CAAEe,uBAAwB,CAAC;AAEjE,eAAeF,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useInstanceId","forwardRef","InputBase","InputField","space","useDraft","BaseControl","useDeprecated36pxDefaultSizeProp","maybeWarnDeprecated36pxSize","jsx","_jsx","noop","useUniqueId","idProp","instanceId","InputControl","id","UnforwardedInputControl","props","ref","__next40pxDefaultSize","__shouldNotWarnDeprecated36pxSize","__unstableStateReducer","stateReducer","state","__unstableInputWidth","className","disabled","help","hideLabelFromVision","isPressEnterToChange","label","labelPosition","onChange","onValidate","onKeyDown","prefix","size","style","suffix","value","restProps","classes","draftHookProps","onBlur","helpProp","componentName","__nextHasNoMarginBottom","children","gap","justify","paddingInlineStart","undefined","paddingInlineEnd"],"sources":["@wordpress/components/src/input-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InputBase from './input-base';\nimport InputField from './input-field';\nimport type { InputControlProps } from './types';\nimport { space } from '../utils/space';\nimport { useDraft } from './utils';\nimport BaseControl from '../base-control';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst noop = () => {};\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( InputControl );\n\tconst id = `inspector-input-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nexport function UnforwardedInputControl(\n\tprops: InputControlProps,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__next40pxDefaultSize,\n\t\t__shouldNotWarnDeprecated36pxSize,\n\t\t__unstableStateReducer: stateReducer = ( state ) => state,\n\t\t__unstableInputWidth,\n\t\tclassName,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision = false,\n\t\tid: idProp,\n\t\tisPressEnterToChange = false,\n\t\tlabel,\n\t\tlabelPosition = 'top',\n\t\tonChange = noop,\n\t\tonValidate = noop,\n\t\tonKeyDown = noop,\n\t\tprefix,\n\t\tsize = 'default',\n\t\tstyle,\n\t\tsuffix,\n\t\tvalue,\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp< InputControlProps >( props );\n\n\tconst id = useUniqueId( idProp );\n\tconst classes = clsx( 'components-input-control', className );\n\n\tconst draftHookProps = useDraft( {\n\t\tvalue,\n\t\tonBlur: restProps.onBlur,\n\t\tonChange,\n\t} );\n\n\tconst helpProp = !! help ? { 'aria-describedby': `${ id }__help` } : {};\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'InputControl',\n\t\t__next40pxDefaultSize,\n\t\tsize,\n\t\t__shouldNotWarnDeprecated36pxSize,\n\t} );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName={ classes }\n\t\t\thelp={ help }\n\t\t\tid={ id }\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t<InputBase\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tgap={ 3 }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\tid={ id }\n\t\t\t\tjustify=\"left\"\n\t\t\t\tlabel={ label }\n\t\t\t\tlabelPosition={ labelPosition }\n\t\t\t\tprefix={ prefix }\n\t\t\t\tsize={ size }\n\t\t\t\tstyle={ style }\n\t\t\t\tsuffix={ suffix }\n\t\t\t>\n\t\t\t\t<InputField\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t{ ...helpProp }\n\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\tclassName=\"components-input-control__input\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tid={ id }\n\t\t\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\tonValidate={ onValidate }\n\t\t\t\t\tpaddingInlineStart={ prefix ? space( 1 ) : undefined }\n\t\t\t\t\tpaddingInlineEnd={ suffix ? space( 1 ) : undefined }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tsize={ size }\n\t\t\t\t\tstateReducer={ stateReducer }\n\t\t\t\t\t{ ...draftHookProps }\n\t\t\t\t/>\n\t\t\t</InputBase>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * InputControl components let users enter and edit text. This is an experimental component\n * intended to (in time) merge with or replace `TextControl`.\n *\n * ```jsx\n * import { __experimentalInputControl as InputControl } from '@wordpress/components';\n * import { useState } from 'react';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '' );\n *\n * return (\n * \t<InputControl\n * \t\t\t__next40pxDefaultSize\n * \t\tvalue={ value }\n * \t\tonChange={ ( nextValue ) => setValue( nextValue ?? '' ) }\n * \t/>\n * );\n * };\n * ```\n */\nexport const InputControl = forwardRef( UnforwardedInputControl );\n\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,SAAS,EAAGA,SAAW;QACvBD,UAAU,EAAGA,UAAY;QACzBiB,kBAAkB,EAAGf,MAAM,GAAGhC,KAAK,CAAE,CAAE,CAAC,GAAGgD,SAAW;QACtDC,gBAAgB,EAAGd,MAAM,GAAGnC,KAAK,CAAE,CAAE,CAAC,GAAGgD,SAAW;QACpDjC,GAAG,EAAGA,GAAK;QACXkB,IAAI,EAAGA,IAAM;QACbd,YAAY,EAAGA,YAAc;QAAA,GACxBoB;MAAc,CACnB;IAAC,CACQ;EAAC,CACA,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM5B,YAAY,GAAGd,UAAU,CAAEgB,uBAAwB,CAAC;AAEjE,eAAeF,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/input-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tCSSProperties,\n\tReactNode,\n\tSyntheticEvent,\n\tHTMLInputTypeAttribute,\n} from 'react';\nimport type { useDrag } from '@use-gesture/react';\n\n/**\n * Internal dependencies\n */\nimport type { StateReducer } from './reducer/state';\nimport type { WordPressComponentProps } from '../context';\nimport type { FlexProps } from '../flex/types';\nimport type { BaseControlProps } from '../base-control/types';\n\nexport type LabelPosition = 'top' | 'bottom' | 'side' | 'edge';\n\nexport type DragDirection = 'n' | 's' | 'e' | 'w';\n\nexport type DragProps = Parameters< Parameters< typeof useDrag >[ 0 ] >[ 0 ];\n\nexport type Size = 'default' | 'small' | 'compact' | '__unstable-large';\n\ninterface BaseProps {\n\t/**\n\t * Deprecated. Use `__next40pxDefaultSize` instead.\n\t *\n\t * @default false\n\t * @deprecated\n\t * @ignore\n\t */\n\t__next36pxDefaultSize?: boolean;\n\t/**\n\t * Start opting into the larger default height that will become the default size in a future version.\n\t *\n\t * @default false\n\t */\n\t__next40pxDefaultSize?: boolean;\n\t__unstableInputWidth?: CSSProperties[ 'width' ];\n\t/**\n\t * If true, the label will only be visible to screen readers.\n\t *\n\t * @default false\n\t */\n\thideLabelFromVision?: boolean;\n\t/**\n\t * The position of the label.\n\t *\n\t * @default 'top'\n\t */\n\tlabelPosition?: LabelPosition;\n\t/**\n\t * Adjusts the size of the input.\n\t *\n\t * @default 'default'\n\t */\n\tsize?: Size;\n}\n\nexport type InputChangeCallback< P = {} > = (\n\tnextValue: string | undefined,\n\textra: { event: SyntheticEvent } & P\n) => void;\n\nexport interface InputFieldProps\n\textends Omit< BaseProps, '__next36pxDefaultSize' > {\n\t/**\n\t * Determines the drag axis.\n\t *\n\t * @default 'n'\n\t */\n\tdragDirection?: DragDirection;\n\t/**\n\t * If `isDragEnabled` is true, this controls the amount of `px` to have been dragged before\n\t * the drag gesture is actually triggered.\n\t *\n\t * @default 10\n\t */\n\tdragThreshold?: number;\n\t/**\n\t * If true, enables mouse drag gestures.\n\t *\n\t * @default false\n\t */\n\tisDragEnabled?: boolean;\n\t/**\n\t * If true, the `ENTER` key press is required in order to trigger an `onChange`.\n\t * If enabled, a change is also triggered when tabbing away (`onBlur`).\n\t *\n\t * @default false\n\t */\n\tisPressEnterToChange?: boolean;\n\t/**\n\t * A function that receives the value of the input.\n\t */\n\tonChange?: InputChangeCallback;\n\tonValidate?: (\n\t\tnextValue: string,\n\t\tevent?: SyntheticEvent< HTMLInputElement >\n\t) => void;\n\tpaddingInlineStart?: CSSProperties[ 'paddingInlineStart' ];\n\tpaddingInlineEnd?: CSSProperties[ 'paddingInlineEnd' ];\n\tstateReducer?: StateReducer;\n\t/**\n\t * The current value of the input.\n\t */\n\tvalue?: string;\n\tonDragEnd?: ( dragProps: DragProps ) => void;\n\tonDragStart?: ( dragProps: DragProps ) => void;\n\tonDrag?: ( dragProps: DragProps ) => void;\n\t/**\n\t * Type of the input element to render.\n\t *\n\t * @default 'text'\n\t */\n\ttype?: HTMLInputTypeAttribute;\n}\n\nexport interface InputBaseProps extends BaseProps, FlexProps {\n\tchildren: ReactNode;\n\t/**\n\t * Renders an element on the left side of the input.\n\t *\n\t * By default, the prefix is aligned with the edge of the input border, with no padding.\n\t * If you want to apply standard padding in accordance with the size variant, wrap the element in\n\t * the provided `<InputControlPrefixWrapper>` component.\n\t *\n\t * @example\n\t * import {\n\t * __experimentalInputControl as InputControl,\n\t * __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t * } from '@wordpress/components';\n\t *\n\t * <InputControl\n\t * prefix={<InputControlPrefixWrapper>@</InputControlPrefixWrapper>}\n\t * />\n\t */\n\tprefix?: ReactNode;\n\t/**\n\t * Renders an element on the right side of the input.\n\t *\n\t * By default, the suffix is aligned with the edge of the input border, with no padding.\n\t * If you want to apply standard padding in accordance with the size variant, wrap the element in\n\t * the provided `<InputControlSuffixWrapper>` component.\n\t *\n\t * @example\n\t * import {\n\t * __experimentalInputControl as InputControl,\n\t * __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\t * } from '@wordpress/components';\n\t *\n\t * <InputControl\n\t * suffix={<InputControlSuffixWrapper>%</InputControlSuffixWrapper>}\n\t * />\n\t */\n\tsuffix?: ReactNode;\n\t/**\n\t * If true, the `input` will be disabled.\n\t *\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * If this property is added, a label will be generated using label property as the content.\n\t */\n\tlabel?: ReactNode;\n\t/**\n\t * Whether to hide the border when not focused.\n\t *\n\t * @default false\n\t */\n\tisBorderless?: boolean;\n}\n\nexport interface InputControlProps\n\textends Omit<\n\t\t\tInputBaseProps,\n\t\t\t'children' | 'isBorderless' | keyof FlexProps\n\t\t>,\n\t\tPick< BaseControlProps, 'help' >,\n\t\t/**\n\t\t * The `prefix` prop in `WordPressComponentProps< InputFieldProps, 'input', false >` comes from the\n\t\t * `HTMLInputAttributes` and clashes with the one from `InputBaseProps`. So we have to omit it from\n\t\t * `WordPressComponentProps< InputFieldProps, 'input', false >` in order that `InputBaseProps[ 'prefix' ]`\n\t\t * be the only prefix prop. Otherwise it tries to do a union of the two prefix properties and you end up\n\t\t * with an unresolvable type.\n\t\t *\n\t\t * `paddingInlineStart`, and `paddingInlineEnd` are managed internally by\n\t\t * the InputControl, but the rest of the props for InputField are passed through.\n\t\t */\n\t\tOmit<\n\t\t\tWordPressComponentProps< InputFieldProps, 'input', false >,\n\t\t\t| 'stateReducer'\n\t\t\t| 'prefix'\n\t\t\t| 'paddingInlineStart'\n\t\t\t| 'paddingInlineEnd'\n\t\t> {\n\t__unstableStateReducer?: InputFieldProps[ 'stateReducer' ];\n}\n\nexport interface InputControlLabelProps {\n\tchildren: ReactNode;\n\thideLabelFromVision?: BaseProps[ 'hideLabelFromVision' ];\n\tlabelPosition?: BaseProps[ 'labelPosition' ];\n\tsize?: BaseProps[ 'size' ];\n}\n\nexport type PrefixSuffixWrapperProps = {\n\t/**\n\t * The content to be inserted.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Internal prop used to control the padding size of the wrapper.\n\t *\n\t * @ignore\n\t */\n\tsize?: BaseProps[ 'size' ];\n\t/**\n\t * Internal prop used to control the padding size of the wrapper.\n\t *\n\t * @ignore\n\t */\n\t__next40pxDefaultSize?: BaseProps[ '__next40pxDefaultSize' ];\n\t/**\n\t * Adjust the wrapper based on the prefix or suffix content.\n\t *\n\t * - `'default'`: Standard padding for text content.\n\t * - `'icon'`: For icons.\n\t * - `'control'`: For controls, like buttons or selects.\n\t *\n\t * @default 'default'\n\t */\n\tvariant?: 'default' | 'icon' | 'control';\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/input-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tCSSProperties,\n\tReactNode,\n\tSyntheticEvent,\n\tHTMLInputTypeAttribute,\n} from 'react';\nimport type { useDrag } from '@use-gesture/react';\n\n/**\n * Internal dependencies\n */\nimport type { StateReducer } from './reducer/state';\nimport type { WordPressComponentProps } from '../context';\nimport type { FlexProps } from '../flex/types';\nimport type { BaseControlProps } from '../base-control/types';\n\nexport type LabelPosition = 'top' | 'bottom' | 'side' | 'edge';\n\nexport type DragDirection = 'n' | 's' | 'e' | 'w';\n\nexport type DragProps = Parameters< Parameters< typeof useDrag >[ 0 ] >[ 0 ];\n\nexport type Size = 'default' | 'small' | 'compact' | '__unstable-large';\n\ninterface BaseProps {\n\t/**\n\t * Deprecated. Use `__next40pxDefaultSize` instead.\n\t *\n\t * @default false\n\t * @deprecated\n\t * @ignore\n\t */\n\t__next36pxDefaultSize?: boolean;\n\t/**\n\t * Start opting into the larger default height that will become the default size in a future version.\n\t *\n\t * @default false\n\t */\n\t__next40pxDefaultSize?: boolean;\n\t/**\n\t * Do not throw a warning for the deprecated 36px default size.\n\t * For internal components of other components that already throw the warning.\n\t *\n\t * @ignore\n\t */\n\t__shouldNotWarnDeprecated36pxSize?: boolean;\n\t__unstableInputWidth?: CSSProperties[ 'width' ];\n\t/**\n\t * If true, the label will only be visible to screen readers.\n\t *\n\t * @default false\n\t */\n\thideLabelFromVision?: boolean;\n\t/**\n\t * The position of the label.\n\t *\n\t * @default 'top'\n\t */\n\tlabelPosition?: LabelPosition;\n\t/**\n\t * Adjusts the size of the input.\n\t *\n\t * @default 'default'\n\t */\n\tsize?: Size;\n}\n\nexport type InputChangeCallback< P = {} > = (\n\tnextValue: string | undefined,\n\textra: { event: SyntheticEvent } & P\n) => void;\n\nexport interface InputFieldProps\n\textends Omit< BaseProps, '__next36pxDefaultSize' > {\n\t/**\n\t * Determines the drag axis.\n\t *\n\t * @default 'n'\n\t */\n\tdragDirection?: DragDirection;\n\t/**\n\t * If `isDragEnabled` is true, this controls the amount of `px` to have been dragged before\n\t * the drag gesture is actually triggered.\n\t *\n\t * @default 10\n\t */\n\tdragThreshold?: number;\n\t/**\n\t * If true, enables mouse drag gestures.\n\t *\n\t * @default false\n\t */\n\tisDragEnabled?: boolean;\n\t/**\n\t * If true, the `ENTER` key press is required in order to trigger an `onChange`.\n\t * If enabled, a change is also triggered when tabbing away (`onBlur`).\n\t *\n\t * @default false\n\t */\n\tisPressEnterToChange?: boolean;\n\t/**\n\t * A function that receives the value of the input.\n\t */\n\tonChange?: InputChangeCallback;\n\tonValidate?: (\n\t\tnextValue: string,\n\t\tevent?: SyntheticEvent< HTMLInputElement >\n\t) => void;\n\tpaddingInlineStart?: CSSProperties[ 'paddingInlineStart' ];\n\tpaddingInlineEnd?: CSSProperties[ 'paddingInlineEnd' ];\n\tstateReducer?: StateReducer;\n\t/**\n\t * The current value of the input.\n\t */\n\tvalue?: string;\n\tonDragEnd?: ( dragProps: DragProps ) => void;\n\tonDragStart?: ( dragProps: DragProps ) => void;\n\tonDrag?: ( dragProps: DragProps ) => void;\n\t/**\n\t * Type of the input element to render.\n\t *\n\t * @default 'text'\n\t */\n\ttype?: HTMLInputTypeAttribute;\n}\n\nexport interface InputBaseProps extends BaseProps, FlexProps {\n\tchildren: ReactNode;\n\t/**\n\t * Renders an element on the left side of the input.\n\t *\n\t * By default, the prefix is aligned with the edge of the input border, with no padding.\n\t * If you want to apply standard padding in accordance with the size variant, wrap the element in\n\t * the provided `<InputControlPrefixWrapper>` component.\n\t *\n\t * ```jsx\n\t * import {\n\t * __experimentalInputControl as InputControl,\n\t * __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t * } from '@wordpress/components';\n\t *\n\t * <InputControl\n\t * prefix={<InputControlPrefixWrapper>@</InputControlPrefixWrapper>}\n\t * />\n\t * ```\n\t */\n\tprefix?: ReactNode;\n\t/**\n\t * Renders an element on the right side of the input.\n\t *\n\t * By default, the suffix is aligned with the edge of the input border, with no padding.\n\t * If you want to apply standard padding in accordance with the size variant, wrap the element in\n\t * the provided `<InputControlSuffixWrapper>` component.\n\t *\n\t * ```jsx\n\t * import {\n\t * __experimentalInputControl as InputControl,\n\t * __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\t * } from '@wordpress/components';\n\t *\n\t * <InputControl\n\t * suffix={<InputControlSuffixWrapper>%</InputControlSuffixWrapper>}\n\t * />\n\t * ```\n\t */\n\tsuffix?: ReactNode;\n\t/**\n\t * If true, the `input` will be disabled.\n\t *\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * If this property is added, a label will be generated using label property as the content.\n\t */\n\tlabel?: ReactNode;\n\t/**\n\t * Whether to hide the border when not focused.\n\t *\n\t * @default false\n\t */\n\tisBorderless?: boolean;\n}\n\nexport interface InputControlProps\n\textends Omit<\n\t\t\tInputBaseProps,\n\t\t\t'children' | 'isBorderless' | keyof FlexProps\n\t\t>,\n\t\tPick< BaseControlProps, 'help' >,\n\t\t/**\n\t\t * The `prefix` prop in `WordPressComponentProps< InputFieldProps, 'input', false >` comes from the\n\t\t * `HTMLInputAttributes` and clashes with the one from `InputBaseProps`. So we have to omit it from\n\t\t * `WordPressComponentProps< InputFieldProps, 'input', false >` in order that `InputBaseProps[ 'prefix' ]`\n\t\t * be the only prefix prop. Otherwise it tries to do a union of the two prefix properties and you end up\n\t\t * with an unresolvable type.\n\t\t *\n\t\t * `paddingInlineStart`, and `paddingInlineEnd` are managed internally by\n\t\t * the InputControl, but the rest of the props for InputField are passed through.\n\t\t */\n\t\tOmit<\n\t\t\tWordPressComponentProps< InputFieldProps, 'input', false >,\n\t\t\t| 'stateReducer'\n\t\t\t| 'prefix'\n\t\t\t| 'paddingInlineStart'\n\t\t\t| 'paddingInlineEnd'\n\t\t> {\n\t__unstableStateReducer?: InputFieldProps[ 'stateReducer' ];\n}\n\nexport interface InputControlLabelProps {\n\tchildren: ReactNode;\n\thideLabelFromVision?: BaseProps[ 'hideLabelFromVision' ];\n\tlabelPosition?: BaseProps[ 'labelPosition' ];\n\tsize?: BaseProps[ 'size' ];\n}\n\nexport type PrefixSuffixWrapperProps = {\n\t/**\n\t * The content to be inserted.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Internal prop used to control the padding size of the wrapper.\n\t *\n\t * @ignore\n\t */\n\tsize?: BaseProps[ 'size' ];\n\t/**\n\t * Internal prop used to control the padding size of the wrapper.\n\t *\n\t * @ignore\n\t */\n\t__next40pxDefaultSize?: BaseProps[ '__next40pxDefaultSize' ];\n\t/**\n\t * Adjust the wrapper based on the prefix or suffix content.\n\t *\n\t * - `'default'`: Standard padding for text content.\n\t * - `'icon'`: For icons.\n\t * - `'control'`: For controls, like buttons or selects.\n\t *\n\t * @default 'default'\n\t */\n\tvariant?: 'default' | 'icon' | 'control';\n};\n"],"mappings":"","ignoreList":[]}
@@ -19,6 +19,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
19
  export const MenuCheckboxItem = forwardRef(function MenuCheckboxItem({
20
20
  suffix,
21
21
  children,
22
+ disabled = false,
22
23
  hideOnClick = false,
23
24
  ...props
24
25
  }, ref) {
@@ -30,6 +31,7 @@ export const MenuCheckboxItem = forwardRef(function MenuCheckboxItem({
30
31
  ref: ref,
31
32
  ...props,
32
33
  accessibleWhenDisabled: true,
34
+ disabled: disabled,
33
35
  hideOnClick: hideOnClick,
34
36
  store: menuContext.store,
35
37
  children: [/*#__PURE__*/_jsx(Ariakit.MenuItemCheck, {
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","forwardRef","useContext","Icon","check","MenuContext","Styled","jsx","_jsx","jsxs","_jsxs","MenuCheckboxItem","suffix","children","hideOnClick","props","ref","menuContext","store","Error","accessibleWhenDisabled","MenuItemCheck","render","ItemPrefixWrapper","style","width","height","icon","size","MenuItemContentWrapper","MenuItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/checkbox-item.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\nimport { Icon, check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport type { MenuCheckboxItemProps } from './types';\nimport * as Styled from './styles';\n\nexport const MenuCheckboxItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuCheckboxItemProps, 'div', false >\n>( function MenuCheckboxItem(\n\t{ suffix, children, hideOnClick = false, ...props },\n\tref\n) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.CheckboxItem can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuCheckboxItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ menuContext.store }\n\t\t>\n\t\t\t<Ariakit.MenuItemCheck\n\t\t\t\tstore={ menuContext.store }\n\t\t\t\trender={ <Styled.ItemPrefixWrapper /> }\n\t\t\t\t// Override some ariakit inline styles\n\t\t\t\tstyle={ { width: 'auto', height: 'auto' } }\n\t\t\t>\n\t\t\t\t<Icon icon={ check } size={ 24 } />\n\t\t\t</Ariakit.MenuItemCheck>\n\n\t\t\t<Styled.MenuItemContentWrapper>\n\t\t\t\t<Styled.MenuItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.MenuItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\t\t\t<Styled.ItemSuffixWrapper>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t</Styled.ItemSuffixWrapper>\n\t\t\t\t) }\n\t\t\t</Styled.MenuItemContentWrapper>\n\t\t</Styled.MenuCheckboxItem>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;AAC3D,SAASC,IAAI,EAAEC,KAAK,QAAQ,kBAAkB;;AAE9C;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,WAAW;AAEvC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAA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ef","useContext","Icon","check","MenuContext","Styled","jsx","_jsx","jsxs","_jsxs","MenuCheckboxItem","suffix","children","disabled","hideOnClick","props","ref","menuContext","store","Error","accessibleWhenDisabled","MenuItemCheck","render","ItemPrefixWrapper","style","width","height","icon","size","MenuItemContentWrapper","MenuItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/checkbox-item.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\nimport { Icon, check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport type { MenuCheckboxItemProps } from './types';\nimport * as Styled from './styles';\n\nexport const MenuCheckboxItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuCheckboxItemProps, 'div', false >\n>( function MenuCheckboxItem(\n\t{ suffix, children, disabled = false, hideOnClick = false, ...props },\n\tref\n) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.CheckboxItem can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuCheckboxItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ disabled }\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ menuContext.store }\n\t\t>\n\t\t\t<Ariakit.MenuItemCheck\n\t\t\t\tstore={ menuContext.store }\n\t\t\t\trender={ <Styled.ItemPrefixWrapper /> }\n\t\t\t\t// Override some ariakit inline styles\n\t\t\t\tstyle={ { width: 'auto', height: 'auto' } }\n\t\t\t>\n\t\t\t\t<Icon icon={ check } size={ 24 } />\n\t\t\t</Ariakit.MenuItemCheck>\n\n\t\t\t<Styled.MenuItemContentWrapper>\n\t\t\t\t<Styled.MenuItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.MenuItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\t\t\t<Styled.ItemSuffixWrapper>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t</Styled.ItemSuffixWrapper>\n\t\t\t\t) }\n\t\t\t</Styled.MenuItemContentWrapper>\n\t\t</Styled.MenuCheckboxItem>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;AAC3D,SAASC,IAAI,EAAEC,KAAK,QAAQ,kBAAkB;;AAE9C;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,WAAW;AAEvC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnC,OAAO,MAAMC,gBAAgB,GAAGV,UAAU,CAGvC,SAASU,gBAAgBA,CAC3B;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,QAAQ,GAAG,KAAK;EAAEC,WAAW,GAAG,KAAK;EAAE,GAAGC;AAAM,CAAC,EACrEC,GAAG,EACF;EACD,MAAMC,WAAW,GAAGhB,UAAU,CAAEG,WAAY,CAAC;EAE7C,IAAK,CAAEa,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,gEACD,CAAC;EACF;EAEA,oBACCV,KAAA,CAACJ,MAAM,CAACK,gBAAgB;IACvBM,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVK,sBAAsB;IACtBP,QAAQ,EAAGA,QAAU;IACrBC,WAAW,EAAGA,WAAa;IAC3BI,KAAK,EAAGD,WAAW,CAACC,KAAO;IAAAN,QAAA,gBAE3BL,IAAA,CAACR,OAAO,CAACsB,aAAa;MACrBH,KAAK,EAAGD,WAAW,CAACC,KAAO;MAC3BI,MAAM,eAAGf,IAAA,CAACF,MAAM,CAACkB,iBAAiB,IAAE;MACpC;MAAA;MACAC,KAAK,EAAG;QAAEC,KAAK,EAAE,MAAM;QAAEC,MAAM,EAAE;MAAO,CAAG;MAAAd,QAAA,eAE3CL,IAAA,CAACL,IAAI;QAACyB,IAAI,EAAGxB,KAAO;QAACyB,IAAI,EAAG;MAAI,CAAE;IAAC,CACb,CAAC,eAExBnB,KAAA,CAACJ,MAAM,CAACwB,sBAAsB;MAAAjB,QAAA,gBAC7BL,IAAA,CAACF,MAAM,CAACyB,uBAAuB;QAAAlB,QAAA,EAC5BA;MAAQ,CACqB,CAAC,EAE/BD,MAAM,iBACPJ,IAAA,CAACF,MAAM,CAAC0B,iBAAiB;QAAAnB,QAAA,EACtBD;MAAM,CACiB,CAC1B;IAAA,CAC6B,CAAC;EAAA,CACR,CAAC;AAE5B,CAAE,CAAC","ignoreList":[]}
@@ -2,20 +2,17 @@
2
2
  * External dependencies
3
3
  */
4
4
  import * as Ariakit from '@ariakit/react';
5
- import { useStoreState } from '@ariakit/react';
6
5
 
7
6
  /**
8
7
  * WordPress dependencies
9
8
  */
10
- import { useContext, useMemo, cloneElement, isValidElement, useCallback } from '@wordpress/element';
11
- import { isRTL } from '@wordpress/i18n';
12
- import { chevronRightSmall } from '@wordpress/icons';
9
+ import { useContext, useMemo } from '@wordpress/element';
10
+ import { isRTL as isRTLFn } from '@wordpress/i18n';
13
11
 
14
12
  /**
15
13
  * Internal dependencies
16
14
  */
17
- import { useContextSystem, contextConnect } from '../context';
18
- import * as Styled from './styles';
15
+ import { useContextSystem, contextConnectWithoutRef } from '../context';
19
16
  import { MenuContext } from './context';
20
17
  import { MenuItem } from './item';
21
18
  import { MenuCheckboxItem } from './checkbox-item';
@@ -25,36 +22,29 @@ import { MenuGroupLabel } from './group-label';
25
22
  import { MenuSeparator } from './separator';
26
23
  import { MenuItemLabel } from './item-label';
27
24
  import { MenuItemHelpText } from './item-help-text';
28
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
29
- const UnconnectedMenu = (props, ref) => {
30
- var _props$placement;
25
+ import { MenuTriggerButton } from './trigger-button';
26
+ import { MenuSubmenuTriggerItem } from './submenu-trigger-item';
27
+ import { MenuPopover } from './popover';
28
+ import { jsx as _jsx } from "react/jsx-runtime";
29
+ const UnconnectedMenu = props => {
31
30
  const {
32
- // Store props
33
- open,
31
+ children,
34
32
  defaultOpen = false,
33
+ open,
35
34
  onOpenChange,
36
35
  placement,
37
- // Menu trigger props
38
- trigger,
39
- // Menu props
40
- gutter,
41
- children,
42
- shift,
43
- modal = true,
44
36
  // From internal components context
45
- variant,
46
- // Rest
47
- ...otherProps
37
+ variant
48
38
  } = useContextSystem(props, 'Menu');
49
39
  const parentContext = useContext(MenuContext);
50
- const computedDirection = isRTL() ? 'rtl' : 'ltr';
40
+ const rtl = isRTLFn();
51
41
 
52
42
  // If an explicit value for the `placement` prop is not passed,
53
43
  // apply a default placement of `bottom-start` for the root menu popover,
54
44
  // and of `right-start` for nested menu popovers.
55
- let computedPlacement = (_props$placement = props.placement) !== null && _props$placement !== void 0 ? _props$placement : parentContext?.store ? 'right-start' : 'bottom-start';
45
+ let computedPlacement = placement !== null && placement !== void 0 ? placement : parentContext?.store ? 'right-start' : 'bottom-start';
56
46
  // Swap left/right in case of RTL direction
57
- if (computedDirection === 'rtl') {
47
+ if (rtl) {
58
48
  if (/right/.test(computedPlacement)) {
59
49
  computedPlacement = computedPlacement.replace('right', 'left');
60
50
  } else if (/left/.test(computedPlacement)) {
@@ -70,86 +60,18 @@ const UnconnectedMenu = (props, ref) => {
70
60
  setOpen(willBeOpen) {
71
61
  onOpenChange?.(willBeOpen);
72
62
  },
73
- rtl: computedDirection === 'rtl'
63
+ rtl
74
64
  });
75
65
  const contextValue = useMemo(() => ({
76
66
  store: menuStore,
77
67
  variant
78
68
  }), [menuStore, variant]);
79
-
80
- // Extract the side from the applied placement — useful for animations.
81
- // Using `currentPlacement` instead of `placement` to make sure that we
82
- // use the final computed placement (including "flips" etc).
83
- const appliedPlacementSide = useStoreState(menuStore, 'currentPlacement').split('-')[0];
84
- if (menuStore.parent && !(isValidElement(trigger) && MenuItem === trigger.type)) {
85
- // eslint-disable-next-line no-console
86
- console.warn('For nested Menus, the `trigger` should always be a `MenuItem`.');
87
- }
88
- const hideOnEscape = useCallback(event => {
89
- // Pressing Escape can cause unexpected consequences (ie. exiting
90
- // full screen mode on MacOs, close parent modals...).
91
- event.preventDefault();
92
- // Returning `true` causes the menu to hide.
93
- return true;
94
- }, []);
95
- const wrapperProps = useMemo(() => ({
96
- dir: computedDirection,
97
- style: {
98
- direction: computedDirection
99
- }
100
- }), [computedDirection]);
101
- return /*#__PURE__*/_jsxs(_Fragment, {
102
- children: [/*#__PURE__*/_jsx(Ariakit.MenuButton, {
103
- ref: ref,
104
- store: menuStore,
105
- render: menuStore.parent ? cloneElement(trigger, {
106
- // Add submenu arrow, unless a `suffix` is explicitly specified
107
- suffix: /*#__PURE__*/_jsxs(_Fragment, {
108
- children: [trigger.props.suffix, /*#__PURE__*/_jsx(Styled.SubmenuChevronIcon, {
109
- "aria-hidden": "true",
110
- icon: chevronRightSmall,
111
- size: 24,
112
- preserveAspectRatio: "xMidYMid slice"
113
- })]
114
- })
115
- }) : trigger
116
- }), /*#__PURE__*/_jsx(Ariakit.Menu, {
117
- ...otherProps,
118
- modal: modal,
119
- store: menuStore
120
- // Root menu has an 8px distance from its trigger,
121
- // otherwise 0 (which causes the submenu to slightly overlap)
122
- ,
123
- gutter: gutter !== null && gutter !== void 0 ? gutter : menuStore.parent ? 0 : 8
124
- // Align nested menu by the same (but opposite) amount
125
- // as the menu container's padding.
126
- ,
127
- shift: shift !== null && shift !== void 0 ? shift : menuStore.parent ? -4 : 0,
128
- hideOnHoverOutside: false,
129
- "data-side": appliedPlacementSide,
130
- wrapperProps: wrapperProps,
131
- hideOnEscape: hideOnEscape,
132
- unmountOnHide: true,
133
- render: renderProps =>
134
- /*#__PURE__*/
135
- // Two wrappers are needed for the entry animation, where the menu
136
- // container scales with a different factor than its contents.
137
- // The {...renderProps} are passed to the inner wrapper, so that the
138
- // menu element is the direct parent of the menu item elements.
139
- _jsx(Styled.MenuPopoverOuterWrapper, {
140
- variant: variant,
141
- children: /*#__PURE__*/_jsx(Styled.MenuPopoverInnerWrapper, {
142
- ...renderProps
143
- })
144
- }),
145
- children: /*#__PURE__*/_jsx(MenuContext.Provider, {
146
- value: contextValue,
147
- children: children
148
- })
149
- })]
69
+ return /*#__PURE__*/_jsx(MenuContext.Provider, {
70
+ value: contextValue,
71
+ children: children
150
72
  });
151
73
  };
152
- export const Menu = Object.assign(contextConnect(UnconnectedMenu, 'Menu'), {
74
+ export const Menu = Object.assign(contextConnectWithoutRef(UnconnectedMenu, 'Menu'), {
153
75
  Context: Object.assign(MenuContext, {
154
76
  displayName: 'Menu.Context'
155
77
  }),
@@ -176,6 +98,15 @@ export const Menu = Object.assign(contextConnect(UnconnectedMenu, 'Menu'), {
176
98
  }),
177
99
  ItemHelpText: Object.assign(MenuItemHelpText, {
178
100
  displayName: 'Menu.ItemHelpText'
101
+ }),
102
+ Popover: Object.assign(MenuPopover, {
103
+ displayName: 'Menu.Popover'
104
+ }),
105
+ TriggerButton: Object.assign(MenuTriggerButton, {
106
+ displayName: 'Menu.TriggerButton'
107
+ }),
108
+ SubmenuTriggerItem: Object.assign(MenuSubmenuTriggerItem, {
109
+ displayName: 'Menu.SubmenuTriggerItem'
179
110
  })
180
111
  });
181
112
  export default Menu;
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","useStoreState","useContext","useMemo","cloneElement","isValidElement","useCallback","isRTL","chevronRightSmall","useContextSystem","contextConnect","Styled","MenuContext","MenuItem","MenuCheckboxItem","MenuRadioItem","MenuGroup","MenuGroupLabel","MenuSeparator","MenuItemLabel","MenuItemHelpText","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","UnconnectedMenu","props","ref","_props$placement","open","defaultOpen","onOpenChange","placement","trigger","gutter","children","shift","modal","variant","otherProps","parentContext","computedDirection","computedPlacement","store","test","replace","menuStore","useMenuStore","parent","focusLoop","setOpen","willBeOpen","rtl","contextValue","appliedPlacementSide","split","type","console","warn","hideOnEscape","event","preventDefault","wrapperProps","dir","style","direction","MenuButton","render","suffix","SubmenuChevronIcon","icon","size","preserveAspectRatio","Menu","hideOnHoverOutside","unmountOnHide","renderProps","MenuPopoverOuterWrapper","MenuPopoverInnerWrapper","Provider","value","Object","assign","Context","displayName","Item","RadioItem","CheckboxItem","Group","GroupLabel","Separator","ItemLabel","ItemHelpText"],"sources":["@wordpress/components/src/menu/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport { useStoreState } from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseMemo,\n\tcloneElement,\n\tisValidElement,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\nimport { chevronRightSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, contextConnect } from '../context';\nimport type { WordPressComponentProps } from '../context';\nimport type { MenuContext as MenuContextType, MenuProps } from './types';\nimport * as Styled from './styles';\nimport { MenuContext } from './context';\nimport { MenuItem } from './item';\nimport { MenuCheckboxItem } from './checkbox-item';\nimport { MenuRadioItem } from './radio-item';\nimport { MenuGroup } from './group';\nimport { MenuGroupLabel } from './group-label';\nimport { MenuSeparator } from './separator';\nimport { MenuItemLabel } from './item-label';\nimport { MenuItemHelpText } from './item-help-text';\n\nconst UnconnectedMenu = (\n\tprops: WordPressComponentProps< MenuProps, 'div', false >,\n\tref: React.ForwardedRef< HTMLDivElement >\n) => {\n\tconst {\n\t\t// Store props\n\t\topen,\n\t\tdefaultOpen = false,\n\t\tonOpenChange,\n\t\tplacement,\n\n\t\t// Menu trigger props\n\t\ttrigger,\n\n\t\t// Menu props\n\t\tgutter,\n\t\tchildren,\n\t\tshift,\n\t\tmodal = true,\n\n\t\t// From internal components context\n\t\tvariant,\n\n\t\t// Rest\n\t\t...otherProps\n\t} = useContextSystem< typeof props & Pick< MenuContextType, 'variant' > >(\n\t\tprops,\n\t\t'Menu'\n\t);\n\n\tconst parentContext = useContext( MenuContext );\n\n\tconst computedDirection = isRTL() ? 'rtl' : 'ltr';\n\n\t// If an explicit value for the `placement` prop is not passed,\n\t// apply a default placement of `bottom-start` for the root menu popover,\n\t// and of `right-start` for nested menu popovers.\n\tlet computedPlacement =\n\t\tprops.placement ??\n\t\t( parentContext?.store ? 'right-start' : 'bottom-start' );\n\t// Swap left/right in case of RTL direction\n\tif ( computedDirection === 'rtl' ) {\n\t\tif ( /right/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'right',\n\t\t\t\t'left'\n\t\t\t) as typeof computedPlacement;\n\t\t} else if ( /left/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'left',\n\t\t\t\t'right'\n\t\t\t) as typeof computedPlacement;\n\t\t}\n\t}\n\n\tconst menuStore = Ariakit.useMenuStore( {\n\t\tparent: parentContext?.store,\n\t\topen,\n\t\tdefaultOpen,\n\t\tplacement: computedPlacement,\n\t\tfocusLoop: true,\n\t\tsetOpen( willBeOpen ) {\n\t\t\tonOpenChange?.( willBeOpen );\n\t\t},\n\t\trtl: computedDirection === 'rtl',\n\t} );\n\n\tconst contextValue = useMemo(\n\t\t() => ( { store: menuStore, variant } ),\n\t\t[ menuStore, variant ]\n\t);\n\n\t// Extract the side from the applied placement — useful for animations.\n\t// Using `currentPlacement` instead of `placement` to make sure that we\n\t// use the final computed placement (including \"flips\" etc).\n\tconst appliedPlacementSide = useStoreState(\n\t\tmenuStore,\n\t\t'currentPlacement'\n\t).split( '-' )[ 0 ];\n\n\tif (\n\t\tmenuStore.parent &&\n\t\t! ( isValidElement( trigger ) && MenuItem === trigger.type )\n\t) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t'For nested Menus, the `trigger` should always be a `MenuItem`.'\n\t\t);\n\t}\n\n\tconst hideOnEscape = useCallback(\n\t\t( event: React.KeyboardEvent< Element > ) => {\n\t\t\t// Pressing Escape can cause unexpected consequences (ie. exiting\n\t\t\t// full screen mode on MacOs, close parent modals...).\n\t\t\tevent.preventDefault();\n\t\t\t// Returning `true` causes the menu to hide.\n\t\t\treturn true;\n\t\t},\n\t\t[]\n\t);\n\n\tconst wrapperProps = useMemo(\n\t\t() => ( {\n\t\t\tdir: computedDirection,\n\t\t\tstyle: {\n\t\t\t\tdirection:\n\t\t\t\t\tcomputedDirection as React.CSSProperties[ 'direction' ],\n\t\t\t},\n\t\t} ),\n\t\t[ computedDirection ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Menu trigger */ }\n\t\t\t<Ariakit.MenuButton\n\t\t\t\tref={ ref }\n\t\t\t\tstore={ menuStore }\n\t\t\t\trender={\n\t\t\t\t\tmenuStore.parent\n\t\t\t\t\t\t? cloneElement( trigger, {\n\t\t\t\t\t\t\t\t// Add submenu arrow, unless a `suffix` is explicitly specified\n\t\t\t\t\t\t\t\tsuffix: (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ trigger.props.suffix }\n\t\t\t\t\t\t\t\t\t\t<Styled.SubmenuChevronIcon\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ chevronRightSmall }\n\t\t\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid slice\"\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),\n\t\t\t\t\t\t } )\n\t\t\t\t\t\t: trigger\n\t\t\t\t}\n\t\t\t/>\n\n\t\t\t{ /* Menu popover */ }\n\t\t\t<Ariakit.Menu\n\t\t\t\t{ ...otherProps }\n\t\t\t\tmodal={ modal }\n\t\t\t\tstore={ menuStore }\n\t\t\t\t// Root menu has an 8px distance from its trigger,\n\t\t\t\t// otherwise 0 (which causes the submenu to slightly overlap)\n\t\t\t\tgutter={ gutter ?? ( menuStore.parent ? 0 : 8 ) }\n\t\t\t\t// Align nested menu by the same (but opposite) amount\n\t\t\t\t// as the menu container's padding.\n\t\t\t\tshift={ shift ?? ( menuStore.parent ? -4 : 0 ) }\n\t\t\t\thideOnHoverOutside={ false }\n\t\t\t\tdata-side={ appliedPlacementSide }\n\t\t\t\twrapperProps={ wrapperProps }\n\t\t\t\thideOnEscape={ hideOnEscape }\n\t\t\t\tunmountOnHide\n\t\t\t\trender={ ( renderProps ) => (\n\t\t\t\t\t// Two wrappers are needed for the entry animation, where the menu\n\t\t\t\t\t// container scales with a different factor than its contents.\n\t\t\t\t\t// The {...renderProps} are passed to the inner wrapper, so that the\n\t\t\t\t\t// menu element is the direct parent of the menu item elements.\n\t\t\t\t\t<Styled.MenuPopoverOuterWrapper variant={ variant }>\n\t\t\t\t\t\t<Styled.MenuPopoverInnerWrapper { ...renderProps } />\n\t\t\t\t\t</Styled.MenuPopoverOuterWrapper>\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<MenuContext.Provider value={ contextValue }>\n\t\t\t\t\t{ children }\n\t\t\t\t</MenuContext.Provider>\n\t\t\t</Ariakit.Menu>\n\t\t</>\n\t);\n};\n\nexport const Menu = Object.assign( contextConnect( UnconnectedMenu, 'Menu' ), {\n\tContext: Object.assign( MenuContext, {\n\t\tdisplayName: 'Menu.Context',\n\t} ),\n\tItem: Object.assign( MenuItem, {\n\t\tdisplayName: 'Menu.Item',\n\t} ),\n\tRadioItem: Object.assign( MenuRadioItem, {\n\t\tdisplayName: 'Menu.RadioItem',\n\t} ),\n\tCheckboxItem: Object.assign( MenuCheckboxItem, {\n\t\tdisplayName: 'Menu.CheckboxItem',\n\t} ),\n\tGroup: Object.assign( MenuGroup, {\n\t\tdisplayName: 'Menu.Group',\n\t} ),\n\tGroupLabel: Object.assign( MenuGroupLabel, {\n\t\tdisplayName: 'Menu.GroupLabel',\n\t} ),\n\tSeparator: Object.assign( MenuSeparator, {\n\t\tdisplayName: 'Menu.Separator',\n\t} ),\n\tItemLabel: Object.assign( MenuItemLabel, {\n\t\tdisplayName: 'Menu.ItemLabel',\n\t} ),\n\tItemHelpText: Object.assign( MenuItemHelpText, {\n\t\tdisplayName: 'Menu.ItemHelpText',\n\t} ),\n} );\n\nexport default Menu;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,SAASC,aAAa,QAAQ,gBAAgB;;AAE9C;AACA;AACA;AACA,SACCC,UAAU,EACVC,OAAO,EACPC,YAAY,EACZC,cAAc,EACdC,WAAW,QACL,oBAAoB;AAC3B,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,iBAAiB,QAAQ,kBAAkB;;AAEpD;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,YAAY;AAG7D,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,WAAW,QAAQ,WAAW;AACvC,SAASC,QAAQ,QAAQ,QAAQ;AACjC,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,aAAa,QAAQ,cAAc;AAC5C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,aAAa,QAAQ,cAAc;AAC5C,SAASC,gBAAgB,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpD,MAAMC,eAAe,GAAGA,CACvBC,KAAyD,EACzDC,GAAyC,KACrC;EAAA,IAAAC,gBAAA;EACJ,MAAM;IACL;IACAC,IAAI;IACJC,WAAW,GAAG,KAAK;IACnBC,YAAY;IACZC,SAAS;IAET;IACAC,OAA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CwE,WAAW,EAAE;EACd,CAAE,CAAC;EACHI,KAAK,EAAEP,MAAM,CAACC,MAAM,CAAEpE,SAAS,EAAE;IAChCsE,WAAW,EAAE;EACd,CAAE,CAAC;EACHK,UAAU,EAAER,MAAM,CAACC,MAAM,CAAEnE,cAAc,EAAE;IAC1CqE,WAAW,EAAE;EACd,CAAE,CAAC;EACHM,SAAS,EAAET,MAAM,CAACC,MAAM,CAAElE,aAAa,EAAE;IACxCoE,WAAW,EAAE;EACd,CAAE,CAAC;EACHO,SAAS,EAAEV,MAAM,CAACC,MAAM,CAAEjE,aAAa,EAAE;IACxCmE,WAAW,EAAE;EACd,CAAE,CAAC;EACHQ,YAAY,EAAEX,MAAM,CAACC,MAAM,CAAEhE,gBAAgB,EAAE;IAC9CkE,WAAW,EAAE;EACd,CAAE;AACH,CAAE,CAAC;AAEH,eAAeX,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["Ariakit","useContext","useMemo","isRTL","isRTLFn","useContextSystem","contextConnectWithoutRef","MenuContext","MenuItem","MenuCheckboxItem","MenuRadioItem","MenuGroup","MenuGroupLabel","MenuSeparator","MenuItemLabel","MenuItemHelpText","MenuTriggerButton","MenuSubmenuTriggerItem","MenuPopover","jsx","_jsx","UnconnectedMenu","props","children","defaultOpen","open","onOpenChange","placement","variant","parentContext","rtl","computedPlacement","store","test","replace","menuStore","useMenuStore","parent","focusLoop","setOpen","willBeOpen","contextValue","Provider","value","Menu","Object","assign","Context","displayName","Item","RadioItem","CheckboxItem","Group","GroupLabel","Separator","ItemLabel","ItemHelpText","Popover","TriggerButton","SubmenuTriggerItem"],"sources":["@wordpress/components/src/menu/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo } from '@wordpress/element';\nimport { isRTL as isRTLFn } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, contextConnectWithoutRef } from '../context';\nimport type { MenuContext as MenuContextType, MenuProps } from './types';\nimport { MenuContext } from './context';\nimport { MenuItem } from './item';\nimport { MenuCheckboxItem } from './checkbox-item';\nimport { MenuRadioItem } from './radio-item';\nimport { MenuGroup } from './group';\nimport { MenuGroupLabel } from './group-label';\nimport { MenuSeparator } from './separator';\nimport { MenuItemLabel } from './item-label';\nimport { MenuItemHelpText } from './item-help-text';\nimport { MenuTriggerButton } from './trigger-button';\nimport { MenuSubmenuTriggerItem } from './submenu-trigger-item';\nimport { MenuPopover } from './popover';\n\nconst UnconnectedMenu = ( props: MenuProps ) => {\n\tconst {\n\t\tchildren,\n\t\tdefaultOpen = false,\n\t\topen,\n\t\tonOpenChange,\n\t\tplacement,\n\n\t\t// From internal components context\n\t\tvariant,\n\t} = useContextSystem<\n\t\t// @ts-expect-error TODO: missing 'className' in MenuProps\n\t\ttypeof props & Pick< MenuContextType, 'variant' >\n\t>( props, 'Menu' );\n\n\tconst parentContext = useContext( MenuContext );\n\n\tconst rtl = isRTLFn();\n\n\t// If an explicit value for the `placement` prop is not passed,\n\t// apply a default placement of `bottom-start` for the root menu popover,\n\t// and of `right-start` for nested menu popovers.\n\tlet computedPlacement =\n\t\tplacement ?? ( parentContext?.store ? 'right-start' : 'bottom-start' );\n\t// Swap left/right in case of RTL direction\n\tif ( rtl ) {\n\t\tif ( /right/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'right',\n\t\t\t\t'left'\n\t\t\t) as typeof computedPlacement;\n\t\t} else if ( /left/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'left',\n\t\t\t\t'right'\n\t\t\t) as typeof computedPlacement;\n\t\t}\n\t}\n\n\tconst menuStore = Ariakit.useMenuStore( {\n\t\tparent: parentContext?.store,\n\t\topen,\n\t\tdefaultOpen,\n\t\tplacement: computedPlacement,\n\t\tfocusLoop: true,\n\t\tsetOpen( willBeOpen ) {\n\t\t\tonOpenChange?.( willBeOpen );\n\t\t},\n\t\trtl,\n\t} );\n\n\tconst contextValue = useMemo(\n\t\t() => ( { store: menuStore, variant } ),\n\t\t[ menuStore, variant ]\n\t);\n\n\treturn (\n\t\t<MenuContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</MenuContext.Provider>\n\t);\n};\n\nexport const Menu = Object.assign(\n\tcontextConnectWithoutRef( UnconnectedMenu, 'Menu' ),\n\t{\n\t\tContext: Object.assign( MenuContext, {\n\t\t\tdisplayName: 'Menu.Context',\n\t\t} ),\n\t\tItem: Object.assign( MenuItem, {\n\t\t\tdisplayName: 'Menu.Item',\n\t\t} ),\n\t\tRadioItem: Object.assign( MenuRadioItem, {\n\t\t\tdisplayName: 'Menu.RadioItem',\n\t\t} ),\n\t\tCheckboxItem: Object.assign( MenuCheckboxItem, {\n\t\t\tdisplayName: 'Menu.CheckboxItem',\n\t\t} ),\n\t\tGroup: Object.assign( MenuGroup, {\n\t\t\tdisplayName: 'Menu.Group',\n\t\t} ),\n\t\tGroupLabel: Object.assign( MenuGroupLabel, {\n\t\t\tdisplayName: 'Menu.GroupLabel',\n\t\t} ),\n\t\tSeparator: Object.assign( MenuSeparator, {\n\t\t\tdisplayName: 'Menu.Separator',\n\t\t} ),\n\t\tItemLabel: Object.assign( MenuItemLabel, {\n\t\t\tdisplayName: 'Menu.ItemLabel',\n\t\t} ),\n\t\tItemHelpText: Object.assign( MenuItemHelpText, {\n\t\t\tdisplayName: 'Menu.ItemHelpText',\n\t\t} ),\n\t\tPopover: Object.assign( MenuPopover, {\n\t\t\tdisplayName: 'Menu.Popover',\n\t\t} ),\n\t\tTriggerButton: Object.assign( MenuTriggerButton, {\n\t\t\tdisplayName: 'Menu.TriggerButton',\n\t\t} ),\n\t\tSubmenuTriggerItem: Object.assign( MenuSubmenuTriggerItem, {\n\t\t\tdisplayName: 'Menu.SubmenuTriggerItem',\n\t\t} ),\n\t}\n);\n\nexport default Menu;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,K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,SAAS,EAAE;IAChCqC,WAAW,EAAE;EACd,CAAE,CAAC;EACHK,UAAU,EAAER,MAAM,CAACC,MAAM,CAAElC,cAAc,EAAE;IAC1CoC,WAAW,EAAE;EACd,CAAE,CAAC;EACHM,SAAS,EAAET,MAAM,CAACC,MAAM,CAAEjC,aAAa,EAAE;IACxCmC,WAAW,EAAE;EACd,CAAE,CAAC;EACHO,SAAS,EAAEV,MAAM,CAACC,MAAM,CAAEhC,aAAa,EAAE;IACxCkC,WAAW,EAAE;EACd,CAAE,CAAC;EACHQ,YAAY,EAAEX,MAAM,CAACC,MAAM,CAAE/B,gBAAgB,EAAE;IAC9CiC,WAAW,EAAE;EACd,CAAE,CAAC;EACHS,OAAO,EAAEZ,MAAM,CAACC,MAAM,CAAE5B,WAAW,EAAE;IACpC8B,WAAW,EAAE;EACd,CAAE,CAAC;EACHU,aAAa,EAAEb,MAAM,CAACC,MAAM,CAAE9B,iBAAiB,EAAE;IAChDgC,WAAW,EAAE;EACd,CAAE,CAAC;EACHW,kBAAkB,EAAEd,MAAM,CAACC,MAAM,CAAE7B,sBAAsB,EAAE;IAC1D+B,WAAW,EAAE;EACd,CAAE;AACH,CACD,CAAC;AAED,eAAeJ,IAAI","ignoreList":[]}
@@ -14,19 +14,28 @@ export const MenuItem = forwardRef(function MenuItem({
14
14
  prefix,
15
15
  suffix,
16
16
  children,
17
+ disabled = false,
17
18
  hideOnClick = true,
19
+ store,
18
20
  ...props
19
21
  }, ref) {
20
22
  const menuContext = useContext(MenuContext);
21
23
  if (!menuContext?.store) {
22
24
  throw new Error('Menu.Item can only be rendered inside a Menu component');
23
25
  }
26
+
27
+ // In most cases, the menu store will be retrieved from context (ie. the store
28
+ // created by the top-level menu component). But in rare cases (ie.
29
+ // `Menu.SubmenuTriggerItem`), the context store wouldn't be correct. This is
30
+ // why the component accepts a `store` prop to override the context store.
31
+ const computedStore = store !== null && store !== void 0 ? store : menuContext.store;
24
32
  return /*#__PURE__*/_jsxs(Styled.MenuItem, {
25
33
  ref: ref,
26
34
  ...props,
27
35
  accessibleWhenDisabled: true,
36
+ disabled: disabled,
28
37
  hideOnClick: hideOnClick,
29
- store: menuContext.store,
38
+ store: computedStore,
30
39
  children: [/*#__PURE__*/_jsx(Styled.ItemPrefixWrapper, {
31
40
  children: prefix
32
41
  }), /*#__PURE__*/_jsxs(Styled.MenuItemContentWrapper, {
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","useContext","Styled","MenuContext","jsx","_jsx","jsxs","_jsxs","MenuItem","prefix","suffix","children","hideOnClick","props","ref","menuContext","store","Error","accessibleWhenDisabled","ItemPrefixWrapper","MenuItemContentWrapper","MenuItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/item.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport type { MenuItemProps } from './types';\nimport * as Styled from './styles';\nimport { MenuContext } from './context';\n\nexport const MenuItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuItemProps, 'div', false >\n>( function MenuItem(\n\t{ prefix, suffix, children, hideOnClick = true, ...props },\n\tref\n) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.Item can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ menuContext.store }\n\t\t>\n\t\t\t<Styled.ItemPrefixWrapper>{ prefix }</Styled.ItemPrefixWrapper>\n\n\t\t\t<Styled.MenuItemContentWrapper>\n\t\t\t\t<Styled.MenuItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.MenuItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\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,CAAC;AAEpB,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","useContext","Styled","MenuContext","jsx","_jsx","jsxs","_jsxs","MenuItem","prefix","suffix","children","disabled","hideOnClick","store","props","ref","menuContext","Error","computedStore","accessibleWhenDisabled","ItemPrefixWrapper","MenuItemContentWrapper","MenuItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/item.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport type { MenuItemProps } from './types';\nimport * as Styled from './styles';\nimport { MenuContext } from './context';\n\nexport const MenuItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuItemProps, 'div', false >\n>( function MenuItem(\n\t{\n\t\tprefix,\n\t\tsuffix,\n\t\tchildren,\n\t\tdisabled = false,\n\t\thideOnClick = true,\n\t\tstore,\n\t\t...props\n\t},\n\tref\n) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.Item can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\t// In most cases, the menu store will be retrieved from context (ie. the store\n\t// created by the top-level menu component). But in rare cases (ie.\n\t// `Menu.SubmenuTriggerItem`), the context store wouldn't be correct. This is\n\t// why the component accepts a `store` prop to override the context store.\n\tconst computedStore = store ?? menuContext.store;\n\n\treturn (\n\t\t<Styled.MenuItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ disabled }\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ computedStore }\n\t\t>\n\t\t\t<Styled.ItemPrefixWrapper>{ prefix }</Styled.ItemPrefixWrapper>\n\n\t\t\t<Styled.MenuItemContentWrapper>\n\t\t\t\t<Styled.MenuItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.MenuItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\t\t\t<Styled.ItemSuffixWrapper>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t</Styled.ItemSuffixWrapper>\n\t\t\t\t) }\n\t\t\t</Styled.MenuItemContentWrapper>\n\t\t</Styled.MenuItem>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAGA,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,WAAW,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExC,OAAO,MAAMC,QAAQ,GAAGR,UAAU,CAG/B,SAASQ,QAAQA,CACnB;EACCC,MAAM;EACNC,MAAM;EACNC,QAAQ;EACRC,QAAQ,GAAG,KAAK;EAChBC,WAAW,GAAG,IAAI;EAClBC,KAAK;EACL,GAAGC;AACJ,CAAC,EACDC,GAAG,EACF;EACD,MAAMC,WAAW,GAAGhB,UAAU,CAAEE,WAAY,CAAC;EAE7C,IAAK,CAAEc,WAAW,EAAEH,KAAK,EAAG;IAC3B,MAAM,IAAII,KAAK,CACd,wDACD,CAAC;EACF;;EAEA;EACA;EACA;EACA;EACA,MAAMC,aAAa,GAAGL,KAAK,aAALA,KAAK,cAALA,KAAK,GAAIG,WAAW,CAACH,KAAK;EAEhD,oBACCP,KAAA,CAACL,MAAM,CAACM,QAAQ;IACfQ,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVK,sBAAsB;IACtBR,QAAQ,EAAGA,QAAU;IACrBC,WAAW,EAAGA,WAAa;IAC3BC,KAAK,EAAGK,aAAe;IAAAR,QAAA,gBAEvBN,IAAA,CAACH,MAAM,CAACmB,iBAAiB;MAAAV,QAAA,EAAGF;IAAM,CAA4B,CAAC,eAE/DF,KAAA,CAACL,MAAM,CAACoB,sBAAsB;MAAAX,QAAA,gBAC7BN,IAAA,CAACH,MAAM,CAACqB,uBAAuB;QAAAZ,QAAA,EAC5BA;MAAQ,CACqB,CAAC,EAE/BD,MAAM,iBACPL,IAAA,CAACH,MAAM,CAACsB,iBAAiB;QAAAb,QAAA,EACtBD;MAAM,CACiB,CAC1B;IAAA,CAC6B,CAAC;EAAA,CAChB,CAAC;AAEpB,CAAE,CAAC","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import * as Ariakit from '@ariakit/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useContext, useMemo, forwardRef, useCallback } from '@wordpress/element';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ import * as Styled from './styles';
16
+ import { MenuContext } from './context';
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ export const MenuPopover = forwardRef(function MenuPopover({
19
+ gutter,
20
+ children,
21
+ shift,
22
+ modal = true,
23
+ ...otherProps
24
+ }, ref) {
25
+ const menuContext = useContext(MenuContext);
26
+
27
+ // Extract the side from the applied placement — useful for animations.
28
+ // Using `currentPlacement` instead of `placement` to make sure that we
29
+ // use the final computed placement (including "flips" etc).
30
+ const appliedPlacementSide = Ariakit.useStoreState(menuContext?.store, 'currentPlacement')?.split('-')[0];
31
+ const hideOnEscape = useCallback(event => {
32
+ // Pressing Escape can cause unexpected consequences (ie. exiting
33
+ // full screen mode on MacOs, close parent modals...).
34
+ event.preventDefault();
35
+ // Returning `true` causes the menu to hide.
36
+ return true;
37
+ }, []);
38
+ const computedDirection = Ariakit.useStoreState(menuContext?.store, 'rtl') ? 'rtl' : 'ltr';
39
+ const wrapperProps = useMemo(() => ({
40
+ dir: computedDirection,
41
+ style: {
42
+ direction: computedDirection
43
+ }
44
+ }), [computedDirection]);
45
+ if (!menuContext?.store) {
46
+ throw new Error('Menu.Popover can only be rendered inside a Menu component');
47
+ }
48
+ return /*#__PURE__*/_jsx(Ariakit.Menu, {
49
+ ...otherProps,
50
+ ref: ref,
51
+ modal: modal,
52
+ store: menuContext.store
53
+ // Root menu has an 8px distance from its trigger,
54
+ // otherwise 0 (which causes the submenu to slightly overlap)
55
+ ,
56
+ gutter: gutter !== null && gutter !== void 0 ? gutter : menuContext.store.parent ? 0 : 8
57
+ // Align nested menu by the same (but opposite) amount
58
+ // as the menu container's padding.
59
+ ,
60
+ shift: shift !== null && shift !== void 0 ? shift : menuContext.store.parent ? -4 : 0,
61
+ hideOnHoverOutside: false,
62
+ "data-side": appliedPlacementSide,
63
+ wrapperProps: wrapperProps,
64
+ hideOnEscape: hideOnEscape,
65
+ unmountOnHide: true,
66
+ render: renderProps =>
67
+ /*#__PURE__*/
68
+ // Two wrappers are needed for the entry animation, where the menu
69
+ // container scales with a different factor than its contents.
70
+ // The {...renderProps} are passed to the inner wrapper, so that the
71
+ // menu element is the direct parent of the menu item elements.
72
+ _jsx(Styled.MenuPopoverOuterWrapper, {
73
+ variant: menuContext.variant,
74
+ children: /*#__PURE__*/_jsx(Styled.MenuPopoverInnerWrapper, {
75
+ ...renderProps
76
+ })
77
+ }),
78
+ children: children
79
+ });
80
+ });
81
+ //# sourceMappingURL=popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Ariakit","useContext","useMemo","forwardRef","useCallback","Styled","MenuContext","jsx","_jsx","MenuPopover","gutter","children","shift","modal","otherProps","ref","menuContext","appliedPlacementSide","useStoreState","store","split","hideOnEscape","event","preventDefault","computedDirection","wrapperProps","dir","style","direction","Error","Menu","parent","hideOnHoverOutside","unmountOnHide","render","renderProps","MenuPopoverOuterWrapper","variant","MenuPopoverInnerWrapper"],"sources":["@wordpress/components/src/menu/popover.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseMemo,\n\tforwardRef,\n\tuseCallback,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport type { MenuPopoverProps } from './types';\nimport * as Styled from './styles';\nimport { MenuContext } from './context';\n\nexport const MenuPopover = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuPopoverProps, 'div', false >\n>( function MenuPopover(\n\t{ gutter, children, shift, modal = true, ...otherProps },\n\tref\n) {\n\tconst menuContext = useContext( MenuContext );\n\n\t// Extract the side from the applied placement — useful for animations.\n\t// Using `currentPlacement` instead of `placement` to make sure that we\n\t// use the final computed placement (including \"flips\" etc).\n\tconst appliedPlacementSide = Ariakit.useStoreState(\n\t\tmenuContext?.store,\n\t\t'currentPlacement'\n\t)?.split( '-' )[ 0 ];\n\n\tconst hideOnEscape = useCallback(\n\t\t( event: React.KeyboardEvent< Element > ) => {\n\t\t\t// Pressing Escape can cause unexpected consequences (ie. exiting\n\t\t\t// full screen mode on MacOs, close parent modals...).\n\t\t\tevent.preventDefault();\n\t\t\t// Returning `true` causes the menu to hide.\n\t\t\treturn true;\n\t\t},\n\t\t[]\n\t);\n\n\tconst computedDirection = Ariakit.useStoreState( menuContext?.store, 'rtl' )\n\t\t? 'rtl'\n\t\t: 'ltr';\n\n\tconst wrapperProps = useMemo(\n\t\t() => ( {\n\t\t\tdir: computedDirection,\n\t\t\tstyle: {\n\t\t\t\tdirection:\n\t\t\t\t\tcomputedDirection as React.CSSProperties[ 'direction' ],\n\t\t\t},\n\t\t} ),\n\t\t[ computedDirection ]\n\t);\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.Popover can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Ariakit.Menu\n\t\t\t{ ...otherProps }\n\t\t\tref={ ref }\n\t\t\tmodal={ modal }\n\t\t\tstore={ menuContext.store }\n\t\t\t// Root menu has an 8px distance from its trigger,\n\t\t\t// otherwise 0 (which causes the submenu to slightly overlap)\n\t\t\tgutter={ gutter ?? ( menuContext.store.parent ? 0 : 8 ) }\n\t\t\t// Align nested menu by the same (but opposite) amount\n\t\t\t// as the menu container's padding.\n\t\t\tshift={ shift ?? ( menuContext.store.parent ? -4 : 0 ) }\n\t\t\thideOnHoverOutside={ false }\n\t\t\tdata-side={ appliedPlacementSide }\n\t\t\twrapperProps={ wrapperProps }\n\t\t\thideOnEscape={ hideOnEscape }\n\t\t\tunmountOnHide\n\t\t\trender={ ( renderProps ) => (\n\t\t\t\t// Two wrappers are needed for the entry animation, where the menu\n\t\t\t\t// container scales with a different factor than its contents.\n\t\t\t\t// The {...renderProps} are passed to the inner wrapper, so that the\n\t\t\t\t// menu element is the direct parent of the menu item elements.\n\t\t\t\t<Styled.MenuPopoverOuterWrapper variant={ menuContext.variant }>\n\t\t\t\t\t<Styled.MenuPopoverInnerWrapper { ...renderProps } />\n\t\t\t\t</Styled.MenuPopoverOuterWrapper>\n\t\t\t) }\n\t\t>\n\t\t\t{ children }\n\t\t</Ariakit.Menu>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SACCC,UAAU,EACVC,OAAO,EACPC,UAAU,EACVC,WAAW,QACL,oBAAoB;;AAE3B;AACA;AACA;;AAGA,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,WAAW,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExC,OAAO,MAAMC,WAAW,GAAGN,UAAU,CAGlC,SAASM,WAAWA,CACtB;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,KAAK;EAAEC,KAAK,GAAG,IAAI;EAAE,GAAGC;AAAW,CAAC,EACxDC,GAAG,EACF;EACD,MAAMC,WAAW,GAAGf,UAAU,CAAEK,WAAY,CAAC;;EAE7C;EACA;EACA;EACA,MAAMW,oBAAoB,GAAGjB,OAAO,CAACkB,aAAa,CACjDF,WAAW,EAAEG,KAAK,EAClB,kBACD,CAAC,EAAEC,KAAK,CAAE,GAAI,CAAC,CAAE,CAAC,CAAE;EAEpB,MAAMC,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QAAA,GAAMH;MAAW,CAAI;IAAC,CACtB,CAC9B;IAAAxB,QAAA,EAEDA;EAAQ,CACG,CAAC;AAEjB,CAAE,CAAC","ignoreList":[]}
@@ -29,6 +29,7 @@ const radioCheck = /*#__PURE__*/_jsx(SVG, {
29
29
  export const MenuRadioItem = forwardRef(function MenuRadioItem({
30
30
  suffix,
31
31
  children,
32
+ disabled = false,
32
33
  hideOnClick = false,
33
34
  ...props
34
35
  }, ref) {
@@ -40,6 +41,7 @@ export const MenuRadioItem = forwardRef(function MenuRadioItem({
40
41
  ref: ref,
41
42
  ...props,
42
43
  accessibleWhenDisabled: true,
44
+ disabled: disabled,
43
45
  hideOnClick: hideOnClick,
44
46
  store: menuContext.store,
45
47
  children: [/*#__PURE__*/_jsx(Ariakit.MenuItemCheck, {