@wordpress/edit-site 5.4.0 → 5.6.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 (339) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +12 -3
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/new-template-part.js +8 -7
  5. package/build/components/add-new-template/new-template-part.js.map +1 -1
  6. package/build/components/add-new-template/new-template.js +19 -16
  7. package/build/components/add-new-template/new-template.js.map +1 -1
  8. package/build/components/app/index.js +4 -2
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/editor-canvas.js +2 -1
  11. package/build/components/block-editor/editor-canvas.js.map +1 -1
  12. package/build/components/editor/index.js +5 -7
  13. package/build/components/editor/index.js.map +1 -1
  14. package/build/components/global-styles/border-panel.js +20 -159
  15. package/build/components/global-styles/border-panel.js.map +1 -1
  16. package/build/components/global-styles/context-menu.js +13 -11
  17. package/build/components/global-styles/context-menu.js.map +1 -1
  18. package/build/components/global-styles/dimensions-panel.js +41 -487
  19. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  20. package/build/components/global-styles/duotone-panel.js +78 -0
  21. package/build/components/global-styles/duotone-panel.js.map +1 -0
  22. package/build/components/global-styles/filter-utils.js +17 -0
  23. package/build/components/global-styles/filter-utils.js.map +1 -0
  24. package/build/components/global-styles/hooks.js +11 -26
  25. package/build/components/global-styles/hooks.js.map +1 -1
  26. package/build/components/global-styles/preview.js +9 -5
  27. package/build/components/global-styles/preview.js.map +1 -1
  28. package/build/components/global-styles/screen-block-list.js +6 -11
  29. package/build/components/global-styles/screen-block-list.js.map +1 -1
  30. package/build/components/global-styles/screen-border.js +14 -6
  31. package/build/components/global-styles/screen-border.js.map +1 -1
  32. package/build/components/global-styles/screen-filters.js +46 -0
  33. package/build/components/global-styles/screen-filters.js.map +1 -0
  34. package/build/components/global-styles/screen-layout.js +13 -5
  35. package/build/components/global-styles/screen-layout.js.map +1 -1
  36. package/build/components/global-styles/screen-root.js +2 -1
  37. package/build/components/global-styles/screen-root.js.map +1 -1
  38. package/build/components/global-styles/screen-style-variations.js +2 -1
  39. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  40. package/build/components/global-styles/screen-variations.js +1 -1
  41. package/build/components/global-styles/screen-variations.js.map +1 -1
  42. package/build/components/global-styles/shadow-panel.js +6 -4
  43. package/build/components/global-styles/shadow-panel.js.map +1 -1
  44. package/build/components/global-styles/typography-panel.js +2 -5
  45. package/build/components/global-styles/typography-panel.js.map +1 -1
  46. package/build/components/global-styles/ui.js +7 -1
  47. package/build/components/global-styles/ui.js.map +1 -1
  48. package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
  49. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  50. package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
  51. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  52. package/build/components/keyboard-shortcuts/global.js +48 -0
  53. package/build/components/keyboard-shortcuts/global.js.map +1 -0
  54. package/build/components/keyboard-shortcuts/index.js +67 -0
  55. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  56. package/build/components/keyboard-shortcuts/register.js +153 -0
  57. package/build/components/keyboard-shortcuts/register.js.map +1 -0
  58. package/build/components/layout/index.js +12 -1
  59. package/build/components/layout/index.js.map +1 -1
  60. package/build/components/list/added-by.js +127 -136
  61. package/build/components/list/added-by.js.map +1 -1
  62. package/build/components/list/index.js +2 -1
  63. package/build/components/list/index.js.map +1 -1
  64. package/build/components/list/table.js +9 -7
  65. package/build/components/list/table.js.map +1 -1
  66. package/build/components/routes/link.js +4 -1
  67. package/build/components/routes/link.js.map +1 -1
  68. package/build/components/save-hub/index.js +82 -0
  69. package/build/components/save-hub/index.js.map +1 -0
  70. package/build/components/save-panel/index.js +11 -1
  71. package/build/components/save-panel/index.js.map +1 -1
  72. package/build/components/sidebar/index.js +27 -17
  73. package/build/components/sidebar/index.js.map +1 -1
  74. package/build/components/sidebar-button/index.js +30 -0
  75. package/build/components/sidebar-button/index.js.map +1 -0
  76. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
  77. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  78. package/build/components/sidebar-navigation-screen/index.js +14 -11
  79. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-screen-main/index.js +16 -16
  81. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  82. package/build/components/sidebar-navigation-screen-navigation-item/index.js +22 -26
  83. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  84. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +97 -14
  85. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  86. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  87. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  88. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  89. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  90. package/build/components/sidebar-navigation-screen-template/index.js +66 -27
  91. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  92. package/build/components/sidebar-navigation-screen-templates/index.js +30 -17
  93. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  94. package/build/components/sidebar-navigation-screen-templates-browse/index.js +14 -10
  95. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  96. package/build/components/site-hub/index.js +3 -1
  97. package/build/components/site-hub/index.js.map +1 -1
  98. package/build/components/style-book/index.js +151 -21
  99. package/build/components/style-book/index.js.map +1 -1
  100. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
  101. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  102. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  103. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  104. package/build/components/sync-state-with-url/use-sync-path-with-url.js +67 -18
  105. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  106. package/build/components/template-details/index.js +5 -10
  107. package/build/components/template-details/index.js.map +1 -1
  108. package/build/components/template-part-converter/convert-to-regular.js +8 -12
  109. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  110. package/build/components/template-part-converter/convert-to-template-part.js +2 -2
  111. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  112. package/build/components/template-part-converter/index.js +19 -14
  113. package/build/components/template-part-converter/index.js.map +1 -1
  114. package/build/components/use-edited-entity-record/index.js +6 -6
  115. package/build/components/use-edited-entity-record/index.js.map +1 -1
  116. package/build/index.js +13 -22
  117. package/build/index.js.map +1 -1
  118. package/build/store/actions.js +2 -2
  119. package/build/store/actions.js.map +1 -1
  120. package/build/utils/get-is-list-page.js +1 -1
  121. package/build/utils/get-is-list-page.js.map +1 -1
  122. package/build/utils/history.js +8 -2
  123. package/build/utils/history.js.map +1 -1
  124. package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
  125. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  126. package/build-module/components/add-new-template/new-template-part.js +8 -7
  127. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  128. package/build-module/components/add-new-template/new-template.js +21 -17
  129. package/build-module/components/add-new-template/new-template.js.map +1 -1
  130. package/build-module/components/app/index.js +3 -2
  131. package/build-module/components/app/index.js.map +1 -1
  132. package/build-module/components/block-editor/editor-canvas.js +2 -1
  133. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  134. package/build-module/components/editor/index.js +5 -6
  135. package/build-module/components/editor/index.js.map +1 -1
  136. package/build-module/components/global-styles/border-panel.js +21 -157
  137. package/build-module/components/global-styles/border-panel.js.map +1 -1
  138. package/build-module/components/global-styles/context-menu.js +14 -11
  139. package/build-module/components/global-styles/context-menu.js.map +1 -1
  140. package/build-module/components/global-styles/dimensions-panel.js +43 -480
  141. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  142. package/build-module/components/global-styles/duotone-panel.js +67 -0
  143. package/build-module/components/global-styles/duotone-panel.js.map +1 -0
  144. package/build-module/components/global-styles/filter-utils.js +9 -0
  145. package/build-module/components/global-styles/filter-utils.js.map +1 -0
  146. package/build-module/components/global-styles/hooks.js +11 -26
  147. package/build-module/components/global-styles/hooks.js.map +1 -1
  148. package/build-module/components/global-styles/preview.js +10 -6
  149. package/build-module/components/global-styles/preview.js.map +1 -1
  150. package/build-module/components/global-styles/screen-block-list.js +6 -8
  151. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  152. package/build-module/components/global-styles/screen-border.js +12 -3
  153. package/build-module/components/global-styles/screen-border.js.map +1 -1
  154. package/build-module/components/global-styles/screen-filters.js +33 -0
  155. package/build-module/components/global-styles/screen-filters.js.map +1 -0
  156. package/build-module/components/global-styles/screen-layout.js +11 -2
  157. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  158. package/build-module/components/global-styles/screen-root.js +2 -1
  159. package/build-module/components/global-styles/screen-root.js.map +1 -1
  160. package/build-module/components/global-styles/screen-style-variations.js +2 -1
  161. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  162. package/build-module/components/global-styles/screen-variations.js +1 -1
  163. package/build-module/components/global-styles/screen-variations.js.map +1 -1
  164. package/build-module/components/global-styles/shadow-panel.js +6 -4
  165. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  166. package/build-module/components/global-styles/typography-panel.js +2 -5
  167. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  168. package/build-module/components/global-styles/ui.js +6 -1
  169. package/build-module/components/global-styles/ui.js.map +1 -1
  170. package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
  171. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  172. package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
  173. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  174. package/build-module/components/keyboard-shortcuts/global.js +37 -0
  175. package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
  176. package/build-module/components/keyboard-shortcuts/index.js +65 -0
  177. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  178. package/build-module/components/keyboard-shortcuts/register.js +141 -0
  179. package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
  180. package/build-module/components/layout/index.js +10 -1
  181. package/build-module/components/layout/index.js.map +1 -1
  182. package/build-module/components/list/added-by.js +126 -138
  183. package/build-module/components/list/added-by.js.map +1 -1
  184. package/build-module/components/list/index.js +2 -1
  185. package/build-module/components/list/index.js.map +1 -1
  186. package/build-module/components/list/table.js +9 -7
  187. package/build-module/components/list/table.js.map +1 -1
  188. package/build-module/components/routes/link.js +5 -2
  189. package/build-module/components/routes/link.js.map +1 -1
  190. package/build-module/components/save-hub/index.js +68 -0
  191. package/build-module/components/save-hub/index.js.map +1 -0
  192. package/build-module/components/save-panel/index.js +8 -1
  193. package/build-module/components/save-panel/index.js.map +1 -1
  194. package/build-module/components/sidebar/index.js +24 -19
  195. package/build-module/components/sidebar/index.js.map +1 -1
  196. package/build-module/components/sidebar-button/index.js +18 -0
  197. package/build-module/components/sidebar-button/index.js.map +1 -0
  198. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
  199. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  200. package/build-module/components/sidebar-navigation-screen/index.js +12 -12
  201. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  202. package/build-module/components/sidebar-navigation-screen-main/index.js +16 -16
  203. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  204. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +24 -30
  205. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  206. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +91 -14
  207. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  208. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  209. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  210. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  211. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  212. package/build-module/components/sidebar-navigation-screen-template/index.js +67 -30
  213. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  214. package/build-module/components/sidebar-navigation-screen-templates/index.js +28 -18
  215. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  216. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +13 -10
  217. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  218. package/build-module/components/site-hub/index.js +3 -1
  219. package/build-module/components/site-hub/index.js.map +1 -1
  220. package/build-module/components/style-book/index.js +152 -25
  221. package/build-module/components/style-book/index.js.map +1 -1
  222. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
  223. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  224. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  225. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  226. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
  227. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  228. package/build-module/components/template-details/index.js +5 -9
  229. package/build-module/components/template-details/index.js.map +1 -1
  230. package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
  231. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  232. package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
  233. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  234. package/build-module/components/template-part-converter/index.js +20 -15
  235. package/build-module/components/template-part-converter/index.js.map +1 -1
  236. package/build-module/components/use-edited-entity-record/index.js +6 -6
  237. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  238. package/build-module/index.js +16 -23
  239. package/build-module/index.js.map +1 -1
  240. package/build-module/store/actions.js +2 -2
  241. package/build-module/store/actions.js.map +1 -1
  242. package/build-module/utils/get-is-list-page.js +1 -1
  243. package/build-module/utils/get-is-list-page.js.map +1 -1
  244. package/build-module/utils/history.js +9 -3
  245. package/build-module/utils/history.js.map +1 -1
  246. package/build-style/style-rtl.css +203 -143
  247. package/build-style/style.css +203 -143
  248. package/package.json +31 -31
  249. package/src/components/add-new-template/add-custom-template-modal.js +14 -10
  250. package/src/components/add-new-template/new-template-part.js +7 -9
  251. package/src/components/add-new-template/new-template.js +60 -38
  252. package/src/components/add-new-template/style.scss +12 -6
  253. package/src/components/app/index.js +9 -6
  254. package/src/components/block-editor/editor-canvas.js +2 -1
  255. package/src/components/block-editor/style.scss +1 -1
  256. package/src/components/editor/index.js +62 -65
  257. package/src/components/editor/style.scss +0 -6
  258. package/src/components/global-styles/border-panel.js +24 -199
  259. package/src/components/global-styles/context-menu.js +18 -12
  260. package/src/components/global-styles/dimensions-panel.js +43 -577
  261. package/src/components/global-styles/duotone-panel.js +82 -0
  262. package/src/components/global-styles/filter-utils.js +9 -0
  263. package/src/components/global-styles/hooks.js +12 -36
  264. package/src/components/global-styles/preview.js +155 -140
  265. package/src/components/global-styles/screen-block-list.js +6 -11
  266. package/src/components/global-styles/screen-border.js +10 -3
  267. package/src/components/global-styles/screen-filters.js +27 -0
  268. package/src/components/global-styles/screen-layout.js +9 -2
  269. package/src/components/global-styles/screen-root.js +1 -1
  270. package/src/components/global-styles/screen-style-variations.js +5 -1
  271. package/src/components/global-styles/screen-variations.js +0 -1
  272. package/src/components/global-styles/shadow-panel.js +4 -3
  273. package/src/components/global-styles/style.scss +10 -0
  274. package/src/components/global-styles/typography-panel.js +5 -7
  275. package/src/components/global-styles/ui.js +6 -1
  276. package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
  277. package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
  278. package/src/components/keyboard-shortcuts/global.js +35 -0
  279. package/src/components/keyboard-shortcuts/index.js +70 -0
  280. package/src/components/keyboard-shortcuts/register.js +157 -0
  281. package/src/components/layout/index.js +19 -0
  282. package/src/components/layout/style.scss +9 -4
  283. package/src/components/list/added-by.js +152 -155
  284. package/src/components/list/index.js +3 -1
  285. package/src/components/list/style.scss +5 -13
  286. package/src/components/list/table.js +11 -9
  287. package/src/components/routes/link.js +9 -2
  288. package/src/components/save-hub/index.js +78 -0
  289. package/src/components/save-hub/style.scss +15 -0
  290. package/src/components/save-panel/index.js +8 -1
  291. package/src/components/sidebar/index.js +33 -16
  292. package/src/components/sidebar/style.scss +4 -3
  293. package/src/components/sidebar-button/index.js +21 -0
  294. package/src/components/sidebar-button/style.scss +24 -0
  295. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
  296. package/src/components/sidebar-edit-mode/style.scss +16 -0
  297. package/src/components/sidebar-navigation-item/style.scss +1 -23
  298. package/src/components/sidebar-navigation-screen/index.js +37 -38
  299. package/src/components/sidebar-navigation-screen/style.scss +16 -9
  300. package/src/components/sidebar-navigation-screen-main/index.js +24 -11
  301. package/src/components/sidebar-navigation-screen-navigation-item/index.js +39 -26
  302. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +99 -12
  303. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  304. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  305. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
  306. package/src/components/sidebar-navigation-screen-template/index.js +89 -30
  307. package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
  308. package/src/components/sidebar-navigation-screen-templates/index.js +29 -14
  309. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
  310. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -6
  311. package/src/components/site-hub/index.js +5 -1
  312. package/src/components/site-hub/style.scss +5 -1
  313. package/src/components/style-book/index.js +234 -55
  314. package/src/components/style-book/style.scss +1 -45
  315. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
  316. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  317. package/src/components/sync-state-with-url/use-sync-path-with-url.js +77 -17
  318. package/src/components/template-details/index.js +4 -8
  319. package/src/components/template-part-converter/convert-to-regular.js +10 -17
  320. package/src/components/template-part-converter/convert-to-template-part.js +9 -16
  321. package/src/components/template-part-converter/index.js +28 -12
  322. package/src/components/use-edited-entity-record/index.js +26 -18
  323. package/src/index.js +11 -22
  324. package/src/store/actions.js +2 -2
  325. package/src/store/test/actions.js +0 -2
  326. package/src/style.scss +3 -1
  327. package/src/utils/get-is-list-page.js +1 -1
  328. package/src/utils/history.js +13 -9
  329. package/build/components/navigation-inspector/index.js +0 -161
  330. package/build/components/navigation-inspector/index.js.map +0 -1
  331. package/build/components/navigation-inspector/navigation-menu.js +0 -62
  332. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  333. package/build-module/components/navigation-inspector/index.js +0 -146
  334. package/build-module/components/navigation-inspector/index.js.map +0 -1
  335. package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
  336. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  337. package/src/components/navigation-inspector/index.js +0 -191
  338. package/src/components/navigation-inspector/navigation-menu.js +0 -66
  339. package/src/components/navigation-inspector/style.scss +0 -46
@@ -4,18 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = BorderPanel;
7
- exports.useHasBorderPanel = useHasBorderPanel;
8
7
 
9
8
  var _element = require("@wordpress/element");
10
9
 
11
10
  var _blockEditor = require("@wordpress/block-editor");
12
11
 
13
- var _components = require("@wordpress/components");
14
-
15
- var _i18n = require("@wordpress/i18n");
16
-
17
- var _hooks = require("./hooks");
18
-
19
12
  var _privateApis = require("../../private-apis");
20
13
 
21
14
  /**
@@ -26,167 +19,35 @@ var _privateApis = require("../../private-apis");
26
19
  * Internal dependencies
27
20
  */
28
21
  const {
22
+ useGlobalStyle,
29
23
  useGlobalSetting,
30
- useGlobalStyle
24
+ useSettingsForBlockElement,
25
+ BorderPanel: StylesBorderPanel
31
26
  } = (0, _privateApis.unlock)(_blockEditor.privateApis);
32
27
 
33
- function useHasBorderPanel(name) {
34
- const controls = [useHasBorderColorControl(name), useHasBorderRadiusControl(name), useHasBorderStyleControl(name), useHasBorderWidthControl(name)];
35
- return controls.some(Boolean);
36
- }
37
-
38
- function useHasBorderColorControl(name) {
39
- const supports = (0, _hooks.useSupportedStyles)(name);
40
- return useGlobalSetting('border.color', name)[0] && supports.includes('borderColor');
41
- }
42
-
43
- function useHasBorderRadiusControl(name) {
44
- const supports = (0, _hooks.useSupportedStyles)(name);
45
- return useGlobalSetting('border.radius', name)[0] && supports.includes('borderRadius');
46
- }
47
-
48
- function useHasBorderStyleControl(name) {
49
- const supports = (0, _hooks.useSupportedStyles)(name);
50
- return useGlobalSetting('border.style', name)[0] && supports.includes('borderStyle');
51
- }
52
-
53
- function useHasBorderWidthControl(name) {
54
- const supports = (0, _hooks.useSupportedStyles)(name);
55
- return useGlobalSetting('border.width', name)[0] && supports.includes('borderWidth');
56
- }
57
-
58
- function applyFallbackStyle(border) {
59
- if (!border) {
60
- return border;
61
- }
62
-
63
- if (!border.style && (border.color || border.width)) {
64
- return { ...border,
65
- style: 'solid'
66
- };
67
- }
68
-
69
- return border;
70
- }
71
-
72
- function applyAllFallbackStyles(border) {
73
- if (!border) {
74
- return border;
75
- }
76
-
77
- if ((0, _components.__experimentalHasSplitBorders)(border)) {
78
- return {
79
- top: applyFallbackStyle(border.top),
80
- right: applyFallbackStyle(border.right),
81
- bottom: applyFallbackStyle(border.bottom),
82
- left: applyFallbackStyle(border.left)
83
- };
84
- }
85
-
86
- return applyFallbackStyle(border);
87
- }
88
-
89
28
  function BorderPanel(_ref) {
90
29
  let {
91
30
  name,
92
31
  variation = ''
93
32
  } = _ref;
94
- const prefix = variation ? `variations.${variation}.` : ''; // To better reflect if the user has customized a value we need to
95
- // ensure the style value being checked is from the `user` origin.
96
-
97
- const [userBorderStyles] = useGlobalStyle(`${prefix}border`, name, 'user');
98
- const [border, setBorder] = useGlobalStyle(`${prefix}border`, name);
99
- const colors = (0, _hooks.useColorsPerOrigin)(name);
100
- const showBorderColor = useHasBorderColorControl(name);
101
- const showBorderStyle = useHasBorderStyleControl(name);
102
- const showBorderWidth = useHasBorderWidthControl(name); // Border radius.
33
+ let prefixParts = [];
103
34
 
104
- const showBorderRadius = useHasBorderRadiusControl(name);
105
- const [borderRadiusValues, setBorderRadius] = useGlobalStyle(`${prefix}border.radius`, name);
106
-
107
- const hasBorderRadius = () => {
108
- const borderValues = userBorderStyles === null || userBorderStyles === void 0 ? void 0 : userBorderStyles.radius;
109
-
110
- if (typeof borderValues === 'object') {
111
- return Object.entries(borderValues).some(Boolean);
112
- }
113
-
114
- return !!borderValues;
115
- };
116
-
117
- const resetBorder = () => {
118
- if (hasBorderRadius()) {
119
- return setBorder({
120
- radius: userBorderStyles.radius
121
- });
122
- }
123
-
124
- setBorder(undefined);
125
- };
126
-
127
- const resetAll = (0, _element.useCallback)(() => setBorder(undefined), [setBorder]);
128
- const onBorderChange = (0, _element.useCallback)(newBorder => {
129
- // Ensure we have a visible border style when a border width or
130
- // color is being selected.
131
- const newBorderWithStyle = applyAllFallbackStyles(newBorder); // As we can't conditionally generate styles based on if other
132
- // style properties have been set we need to force split border
133
- // definitions for user set border styles. Border radius is derived
134
- // from the same property i.e. `border.radius` if it is a string
135
- // that is used. The longhand border radii styles are only generated
136
- // if that property is an object.
137
- //
138
- // For borders (color, style, and width) those are all properties on
139
- // the `border` style property. This means if the theme.json defined
140
- // split borders and the user condenses them into a flat border or
141
- // vice-versa we'd get both sets of styles which would conflict.
142
-
143
- const updatedBorder = !(0, _components.__experimentalHasSplitBorders)(newBorderWithStyle) ? {
144
- top: newBorderWithStyle,
145
- right: newBorderWithStyle,
146
- bottom: newBorderWithStyle,
147
- left: newBorderWithStyle
148
- } : {
149
- color: null,
150
- style: null,
151
- width: null,
152
- ...newBorderWithStyle
153
- }; // As radius is maintained separately to color, style, and width
154
- // maintain its value. Undefined values here will be cleaned when
155
- // global styles are saved.
35
+ if (variation) {
36
+ prefixParts = ['variations', variation].concat(prefixParts);
37
+ }
156
38
 
157
- setBorder({
158
- radius: border === null || border === void 0 ? void 0 : border.radius,
159
- ...updatedBorder
160
- });
161
- }, [setBorder]);
162
- return (0, _element.createElement)(_components.__experimentalToolsPanel, {
163
- label: (0, _i18n.__)('Border'),
164
- resetAll: resetAll
165
- }, (showBorderWidth || showBorderColor) && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
166
- hasValue: () => (0, _components.__experimentalIsDefinedBorder)(userBorderStyles),
167
- label: (0, _i18n.__)('Border'),
168
- onDeselect: () => resetBorder(),
169
- isShownByDefault: true
170
- }, (0, _element.createElement)(_components.__experimentalBorderBoxControl, {
171
- colors: colors,
172
- enableAlpha: true,
173
- enableStyle: showBorderStyle,
174
- onChange: onBorderChange,
175
- popoverOffset: 40,
176
- popoverPlacement: "left-start",
177
- value: border,
178
- __experimentalIsRenderedInSidebar: true,
179
- size: '__unstable-large'
180
- })), showBorderRadius && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
181
- hasValue: hasBorderRadius,
182
- label: (0, _i18n.__)('Radius'),
183
- onDeselect: () => setBorderRadius(undefined),
184
- isShownByDefault: true
185
- }, (0, _element.createElement)(_blockEditor.__experimentalBorderRadiusControl, {
186
- values: borderRadiusValues,
187
- onChange: value => {
188
- setBorderRadius(value || undefined);
189
- }
190
- })));
39
+ const prefix = prefixParts.join('.');
40
+ const [style] = useGlobalStyle(prefix, name, 'user', false);
41
+ const [inheritedStyle, setStyle] = useGlobalStyle(prefix, name, 'all', {
42
+ shouldDecodeEncode: false
43
+ });
44
+ const [rawSettings] = useGlobalSetting('', name);
45
+ const settings = useSettingsForBlockElement(rawSettings, name);
46
+ return (0, _element.createElement)(StylesBorderPanel, {
47
+ inheritedValue: inheritedStyle,
48
+ value: style,
49
+ onChange: setStyle,
50
+ settings: settings
51
+ });
191
52
  }
192
53
  //# sourceMappingURL=border-panel.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["useGlobalSetting","useGlobalStyle","blockEditorPrivateApis","useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","applyFallbackStyle","border","style","color","width","applyAllFallbackStyles","top","right","bottom","left","BorderPanel","variation","prefix","userBorderStyles","setBorder","colors","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetBorder","undefined","resetAll","onBorderChange","newBorder","newBorderWithStyle","updatedBorder","value"],"mappings":";;;;;;;;AAcA;;AAXA;;AAIA;;AAQA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAeA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuC,yBAAQC,wBAAR,CAA7C;;AAEO,SAASC,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,IAAF,CADR,EAEhBG,yBAAyB,CAAEH,IAAF,CAFT,EAGhBI,wBAAwB,CAAEJ,IAAF,CAHR,EAIhBK,wBAAwB,CAAEL,IAAF,CAJR,CAAjB;AAOA,SAAOC,QAAQ,CAACK,IAAT,CAAeC,OAAf,CAAP;AACA;;AAED,SAASL,wBAAT,CAAmCF,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,+BAAoBR,IAApB,CAAjB;AACA,SACCJ,gBAAgB,CAAE,cAAF,EAAkBI,IAAlB,CAAhB,CAA0C,CAA1C,KACAQ,QAAQ,CAACC,QAAT,CAAmB,aAAnB,CAFD;AAIA;;AAED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AEX,eAAe,IAAIF,eAArB,KACD,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAG,MAAM,+CAAiBH,gBAAjB,CADlB;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,MAAMc,WAAW,EAH/B;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,0CAAD;AACC,IAAA,MAAM,EAAGZ,MADV;AAEC,IAAA,WAAW,EAAG,IAFf;AAGC,IAAA,WAAW,EAAGE,eAHf;AAIC,IAAA,QAAQ,EAAGa,cAJZ;AAKC,IAAA,aAAa,EAAG,EALjB;AAMC,IAAA,gBAAgB,EAAC,YANlB;AAOC,IAAA,KAAK,EAAG7B,MAPT;AAQC,IAAA,iCAAiC,EAAG,IARrC;AASC,IAAA,IAAI,EAAG;AATR,IAND,CAFF,EAqBGkB,gBAAgB,IACjB,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAGG,eADZ;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,MAAMD,eAAe,CAAEO,SAAF,CAHnC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,8CAAD;AACC,IAAA,MAAM,EAAGR,kBADV;AAEC,IAAA,QAAQ,EAAKc,KAAF,IAAa;AACvBb,MAAAA,eAAe,CAAEa,KAAK,IAAIN,SAAX,CAAf;AACA;AAJF,IAND,CAtBF,CADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderRadiusControl as BorderRadiusControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( ! border.style && ( border.color || border.width ) ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nexport default function BorderPanel( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useGlobalStyle(\n\t\t`${ prefix }border`,\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ border, setBorder ] = useGlobalStyle( `${ prefix }border`, name );\n\tconst colors = useColorsPerOrigin( name );\n\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useGlobalStyle(\n\t\t`${ prefix }border.radius`,\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: userBorderStyles.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );\n\tconst onBorderChange = useCallback(\n\t\t( newBorder ) => {\n\t\t\t// Ensure we have a visible border style when a border width or\n\t\t\t// color is being selected.\n\t\t\tconst newBorderWithStyle = applyAllFallbackStyles( newBorder );\n\n\t\t\t// As we can't conditionally generate styles based on if other\n\t\t\t// style properties have been set we need to force split border\n\t\t\t// definitions for user set border styles. Border radius is derived\n\t\t\t// from the same property i.e. `border.radius` if it is a string\n\t\t\t// that is used. The longhand border radii styles are only generated\n\t\t\t// if that property is an object.\n\t\t\t//\n\t\t\t// For borders (color, style, and width) those are all properties on\n\t\t\t// the `border` style property. This means if the theme.json defined\n\t\t\t// split borders and the user condenses them into a flat border or\n\t\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\t\tconst updatedBorder = ! hasSplitBorders( newBorderWithStyle )\n\t\t\t\t? {\n\t\t\t\t\t\ttop: newBorderWithStyle,\n\t\t\t\t\t\tright: newBorderWithStyle,\n\t\t\t\t\t\tbottom: newBorderWithStyle,\n\t\t\t\t\t\tleft: newBorderWithStyle,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tcolor: null,\n\t\t\t\t\t\tstyle: null,\n\t\t\t\t\t\twidth: null,\n\t\t\t\t\t\t...newBorderWithStyle,\n\t\t\t\t };\n\n\t\t\t// As radius is maintained separately to color, style, and width\n\t\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t\t// global styles are saved.\n\t\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t\t},\n\t\t[ setBorder ]\n\t);\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( userBorderStyles ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetBorderRadius( value || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["useGlobalStyle","useGlobalSetting","useSettingsForBlockElement","BorderPanel","StylesBorderPanel","blockEditorPrivateApis","name","variation","prefixParts","concat","prefix","join","style","inheritedStyle","setStyle","shouldDecodeEncode","rawSettings","settings"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAM;AACLA,EAAAA,cADK;AAELC,EAAAA,gBAFK;AAGLC,EAAAA,0BAHK;AAILC,EAAAA,WAAW,EAAEC;AAJR,IAKF,yBAAQC,wBAAR,CALJ;;AAOe,SAASF,WAAT,OAAiD;AAAA,MAA3B;AAAEG,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AAC/D,MAAIC,WAAW,GAAG,EAAlB;;AACA,MAAKD,SAAL,EAAiB;AAChBC,IAAAA,WAAW,GAAG,CAAE,YAAF,EAAgBD,SAAhB,EAA4BE,MAA5B,CAAoCD,WAApC,CAAd;AACA;;AACD,QAAME,MAAM,GAAGF,WAAW,CAACG,IAAZ,CAAkB,GAAlB,CAAf;AAEA,QAAM,CAAEC,KAAF,IAAYZ,cAAc,CAAEU,MAAF,EAAUJ,IAAV,EAAgB,MAAhB,EAAwB,KAAxB,CAAhC;AACA,QAAM,CAAEO,cAAF,EAAkBC,QAAlB,IAA+Bd,cAAc,CAAEU,MAAF,EAAUJ,IAAV,EAAgB,KAAhB,EAAuB;AACzES,IAAAA,kBAAkB,EAAE;AADqD,GAAvB,CAAnD;AAGA,QAAM,CAAEC,WAAF,IAAkBf,gBAAgB,CAAE,EAAF,EAAMK,IAAN,CAAxC;AACA,QAAMW,QAAQ,GAAGf,0BAA0B,CAAEc,WAAF,EAAeV,IAAf,CAA3C;AAEA,SACC,4BAAC,iBAAD;AACC,IAAA,cAAc,EAAGO,cADlB;AAEC,IAAA,KAAK,EAAGD,KAFT;AAGC,IAAA,QAAQ,EAAGE,QAHZ;AAIC,IAAA,QAAQ,EAAGG;AAJZ,IADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseGlobalStyle,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tBorderPanel: StylesBorderPanel,\n} = unlock( blockEditorPrivateApis );\n\nexport default function BorderPanel( { name, variation = '' } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', false );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ rawSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\n\treturn (\n\t\t<StylesBorderPanel\n\t\t\tinheritedValue={ inheritedStyle }\n\t\t\tvalue={ style }\n\t\t\tonChange={ setStyle }\n\t\t\tsettings={ settings }\n\t\t/>\n\t);\n}\n"]}
@@ -19,11 +19,9 @@ var _coreData = require("@wordpress/core-data");
19
19
 
20
20
  var _blockEditor = require("@wordpress/block-editor");
21
21
 
22
- var _borderPanel = require("./border-panel");
23
-
24
22
  var _colorUtils = require("./color-utils");
25
23
 
26
- var _dimensionsPanel = require("./dimensions-panel");
24
+ var _filterUtils = require("./filter-utils");
27
25
 
28
26
  var _variationsPanel = require("./variations-panel");
29
27
 
@@ -37,8 +35,6 @@ var _shadowPanel = require("./shadow-panel");
37
35
 
38
36
  var _privateApis = require("../../private-apis");
39
37
 
40
- var _hooks = require("./hooks");
41
-
42
38
  /**
43
39
  * WordPress dependencies
44
40
  */
@@ -47,9 +43,11 @@ var _hooks = require("./hooks");
47
43
  * Internal dependencies
48
44
  */
49
45
  const {
46
+ useHasDimensionsPanel,
50
47
  useHasTypographyPanel,
48
+ useHasBorderPanel,
51
49
  useGlobalSetting,
52
- overrideSettingsWithSupports
50
+ useSettingsForBlockElement
53
51
  } = (0, _privateApis.unlock)(_blockEditor.privateApis);
54
52
 
55
53
  function ContextMenu(_ref) {
@@ -58,13 +56,13 @@ function ContextMenu(_ref) {
58
56
  parentMenu = ''
59
57
  } = _ref;
60
58
  const [rawSettings] = useGlobalSetting('', name);
61
- const supports = (0, _hooks.useSupportedStyles)(name);
62
- const settings = (0, _element.useMemo)(() => overrideSettingsWithSupports(rawSettings, supports), [rawSettings, supports]);
59
+ const settings = useSettingsForBlockElement(rawSettings, name);
63
60
  const hasTypographyPanel = useHasTypographyPanel(settings);
64
61
  const hasColorPanel = (0, _colorUtils.useHasColorPanel)(name);
65
- const hasBorderPanel = (0, _borderPanel.useHasBorderPanel)(name);
62
+ const hasBorderPanel = useHasBorderPanel(settings);
66
63
  const hasEffectsPanel = (0, _shadowPanel.useHasShadowControl)(name);
67
- const hasDimensionsPanel = (0, _dimensionsPanel.useHasDimensionsPanel)(name);
64
+ const hasFilterPanel = (0, _filterUtils.useHasFilterPanel)(name);
65
+ const hasDimensionsPanel = useHasDimensionsPanel(settings);
68
66
  const hasLayoutPanel = hasDimensionsPanel;
69
67
  const hasVariationsPanel = (0, _variationsPanel.useHasVariationsPanel)(name, parentMenu);
70
68
  const {
@@ -101,7 +99,11 @@ function ContextMenu(_ref) {
101
99
  icon: _icons.shadow,
102
100
  path: parentMenu + '/effects',
103
101
  "aria-label": (0, _i18n.__)('Shadow')
104
- }, (0, _i18n.__)('Shadow')), hasLayoutPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
102
+ }, (0, _i18n.__)('Shadow')), hasFilterPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
103
+ icon: _icons.filter,
104
+ path: parentMenu + '/filters',
105
+ "aria-label": (0, _i18n.__)('Filters styles')
106
+ }, (0, _i18n.__)('Filters')), hasLayoutPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
105
107
  icon: _icons.layout,
106
108
  path: parentMenu + '/layout',
107
109
  "aria-label": (0, _i18n.__)('Layout styles')
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["useHasTypographyPanel","useGlobalSetting","overrideSettingsWithSupports","blockEditorPrivateApis","ContextMenu","name","parentMenu","rawSettings","supports","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasEffectsPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","undefined","_links","isBlocksPanel","includes","typography","color","border","shadow","layout","chevronLeft","chevronRight"],"mappings":";;;;;;;AAwBA;;AArBA;;AAQA;;AASA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtCA;AACA;AACA;;AAwBA;AACA;AACA;AAYA,MAAM;AACLA,EAAAA,qBADK;AAELC,EAAAA,gBAFK;AAGLC,EAAAA;AAHK,IAIF,yBAAQC,wBAAR,CAJJ;;AAMA,SAASC,WAAT,OAAkD;AAAA,MAA5B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAU,GAAG;AAAr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C,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGX,UAAU,GAAG,MADrB;AAEC,kBAAa,cAAI,sBAAJ;AAFd,KAIC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,oBAAD,QACG,cAAI,sBAAJ,CADH,CADD,EAIC,4BAAC,0CAAD;AACC,IAAA,IAAI,EACH,qBACG2B,kBADH,GAEGC;AAJL,IAJD,CAJD,CADD,CAND,CAFD,EA4BC,4BAAC,uBAAD,OA5BD,CAlDF,CADD,CADD;AAsFA;;eAEc9B,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\tFlexItem,\n\tCardBody,\n\tCardDivider,\n} from '@wordpress/components';\nimport {\n\ttypography,\n\tborder,\n\tshadow,\n\tcolor,\n\tlayout,\n\tchevronLeft,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasVariationsPanel } from './variations-panel';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { ScreenVariations } from './screen-variations';\nimport { useHasShadowControl } from './shadow-panel';\nimport { unlock } from '../../private-apis';\nimport { useSupportedStyles } from './hooks';\n\nconst {\n\tuseHasTypographyPanel,\n\tuseGlobalSetting,\n\toverrideSettingsWithSupports,\n} = unlock( blockEditorPrivateApis );\n\nfunction ContextMenu( { name, parentMenu = '' } ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', name );\n\tconst supports = useSupportedStyles( name );\n\tconst settings = useMemo(\n\t\t() => overrideSettingsWithSupports( rawSettings, supports ),\n\t\t[ rawSettings, supports ]\n\t);\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( name );\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst hasEffectsPanel = useHasShadowControl( name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( name );\n\tconst hasLayoutPanel = hasDimensionsPanel;\n\tconst hasVariationsPanel = useHasVariationsPanel( name, parentMenu );\n\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\n\tconst isBlocksPanel =\n\t\tparentMenu.includes( 'blocks' ) &&\n\t\t! parentMenu.includes( 'variations' );\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ hasTypographyPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\tpath={ parentMenu + '/typography' }\n\t\t\t\t\t\taria-label={ __( 'Typography styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasColorPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ color }\n\t\t\t\t\t\tpath={ parentMenu + '/colors' }\n\t\t\t\t\t\taria-label={ __( 'Colors styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasBorderPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ border }\n\t\t\t\t\t\tpath={ parentMenu + '/border' }\n\t\t\t\t\t\taria-label={ __( 'Border' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Border' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasEffectsPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ shadow }\n\t\t\t\t\t\tpath={ parentMenu + '/effects' }\n\t\t\t\t\t\taria-label={ __( 'Shadow' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasLayoutPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\tpath={ parentMenu + '/layout' }\n\t\t\t\t\t\taria-label={ __( 'Layout styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasVariationsPanel && (\n\t\t\t\t\t<ScreenVariations name={ name } path={ parentMenu } />\n\t\t\t\t) }\n\t\t\t\t{ isBlocksPanel && canEditCSS && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<Spacer as=\"p\" paddingTop={ 2 } marginBottom={ 4 }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Add your own CSS to customize the block appearance.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\t\t\t\tpath={ parentMenu + '/css' }\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default ContextMenu;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","blockEditorPrivateApis","ContextMenu","name","parentMenu","rawSettings","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasEffectsPanel","hasFilterPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","undefined","_links","isBlocksPanel","includes","typography","color","border","shadow","filter","layout","chevronLeft","chevronRight"],"mappings":";;;;;;;;;AAGA;;AAQA;;AAUA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA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AJ;AAHd,KAKG,cAAI,QAAJ,CALH,CA/CF,EAuDGU,kBAAkB,IACnB,4BAAC,kCAAD;AAAkB,IAAA,IAAI,EAAGX,IAAzB;AAAgC,IAAA,IAAI,EAAGC;AAAvC,IAxDF,EA0DGoB,aAAa,IAAIT,UAAjB,IACD,qDACC,4BAAC,uBAAD,OADD,EAEC,4BAAC,oBAAD,QACC,4BAAC,gCAAD;AAAQ,IAAA,EAAE,EAAC,GAAX;AAAe,IAAA,UAAU,EAAG,CAA5B;AAAgC,IAAA,YAAY,EAAG;AAA/C,KACG,cACD,qDADC,CADH,CADD,EAMC,4BAAC,mCAAD,QACC,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGX,UAAU,GAAG,MADrB;AAEC,kBAAa,cAAI,sBAAJ;AAFd,KAIC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,oBAAD,QACG,cAAI,sBAAJ,CADH,CADD,EAIC,4BAAC,0CAAD;AACC,IAAA,IAAI,EACH,qBACG4B,kBADH,GAEGC;AAJL,IAJD,CAJD,CADD,CAND,CAFD,EA4BC,4BAAC,uBAAD,OA5BD,CA3DF,CADD,CADD;AA+FA;;eAEc/B,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\tFlexItem,\n\tCardBody,\n\tCardDivider,\n} from '@wordpress/components';\nimport {\n\ttypography,\n\tborder,\n\tfilter,\n\tshadow,\n\tcolor,\n\tlayout,\n\tchevronLeft,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { useHasColorPanel } from './color-utils';\nimport { useHasFilterPanel } from './filter-utils';\nimport { useHasVariationsPanel } from './variations-panel';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { ScreenVariations } from './screen-variations';\nimport { useHasShadowControl } from './shadow-panel';\nimport { unlock } from '../../private-apis';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n} = unlock( blockEditorPrivateApis );\n\nfunction ContextMenu( { name, parentMenu = '' } ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( name );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasEffectsPanel = useHasShadowControl( name );\n\tconst hasFilterPanel = useHasFilterPanel( name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasDimensionsPanel;\n\tconst hasVariationsPanel = useHasVariationsPanel( name, parentMenu );\n\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\n\tconst isBlocksPanel =\n\t\tparentMenu.includes( 'blocks' ) &&\n\t\t! parentMenu.includes( 'variations' );\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ hasTypographyPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\tpath={ parentMenu + '/typography' }\n\t\t\t\t\t\taria-label={ __( 'Typography styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasColorPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ color }\n\t\t\t\t\t\tpath={ parentMenu + '/colors' }\n\t\t\t\t\t\taria-label={ __( 'Colors styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasBorderPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ border }\n\t\t\t\t\t\tpath={ parentMenu + '/border' }\n\t\t\t\t\t\taria-label={ __( 'Border' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Border' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasEffectsPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ shadow }\n\t\t\t\t\t\tpath={ parentMenu + '/effects' }\n\t\t\t\t\t\taria-label={ __( 'Shadow' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasFilterPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ filter }\n\t\t\t\t\t\tpath={ parentMenu + '/filters' }\n\t\t\t\t\t\taria-label={ __( 'Filters styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Filters' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasLayoutPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\tpath={ parentMenu + '/layout' }\n\t\t\t\t\t\taria-label={ __( 'Layout styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasVariationsPanel && (\n\t\t\t\t\t<ScreenVariations name={ name } path={ parentMenu } />\n\t\t\t\t) }\n\t\t\t\t{ isBlocksPanel && canEditCSS && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<Spacer as=\"p\" paddingTop={ 2 } marginBottom={ 4 }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Add your own CSS to customize the block appearance.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\t\t\t\tpath={ parentMenu + '/css' }\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default ContextMenu;\n"]}