@wordpress/edit-widgets 7.0.0 → 7.2.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 (199) hide show
  1. package/build/blocks/widget-area/edit/index.cjs +106 -116
  2. package/build/blocks/widget-area/edit/index.cjs.map +1 -7
  3. package/build/blocks/widget-area/edit/inner-blocks.cjs +44 -62
  4. package/build/blocks/widget-area/edit/inner-blocks.cjs.map +1 -7
  5. package/build/blocks/widget-area/edit/use-is-dragging-within.cjs +41 -53
  6. package/build/blocks/widget-area/edit/use-is-dragging-within.cjs.map +1 -7
  7. package/build/blocks/widget-area/index.cjs +40 -44
  8. package/build/blocks/widget-area/index.cjs.map +1 -7
  9. package/build/components/error-boundary/index.cjs +115 -155
  10. package/build/components/error-boundary/index.cjs.map +1 -7
  11. package/build/components/header/document-tools/index.cjs +80 -115
  12. package/build/components/header/document-tools/index.cjs.map +1 -7
  13. package/build/components/header/index.cjs +77 -80
  14. package/build/components/header/index.cjs.map +1 -7
  15. package/build/components/header/undo-redo/redo.cjs +30 -52
  16. package/build/components/header/undo-redo/redo.cjs.map +1 -7
  17. package/build/components/header/undo-redo/undo.cjs +29 -51
  18. package/build/components/header/undo-redo/undo.cjs.map +1 -7
  19. package/build/components/keyboard-shortcut-help-modal/config.cjs +88 -85
  20. package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -7
  21. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +40 -57
  22. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -7
  23. package/build/components/keyboard-shortcut-help-modal/index.cjs +94 -161
  24. package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -7
  25. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +38 -75
  26. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -7
  27. package/build/components/keyboard-shortcuts/index.cjs +107 -140
  28. package/build/components/keyboard-shortcuts/index.cjs.map +1 -7
  29. package/build/components/layout/index.cjs +65 -74
  30. package/build/components/layout/index.cjs.map +1 -7
  31. package/build/components/layout/interface.cjs +82 -108
  32. package/build/components/layout/interface.cjs.map +1 -7
  33. package/build/components/layout/unsaved-changes-warning.cjs +41 -48
  34. package/build/components/layout/unsaved-changes-warning.cjs.map +1 -7
  35. package/build/components/more-menu/index.cjs +124 -191
  36. package/build/components/more-menu/index.cjs.map +1 -7
  37. package/build/components/more-menu/tools-more-menu-group.cjs +9 -29
  38. package/build/components/more-menu/tools-more-menu-group.cjs.map +1 -7
  39. package/build/components/notices/index.cjs +19 -39
  40. package/build/components/notices/index.cjs.map +1 -7
  41. package/build/components/save-button/index.cjs +31 -58
  42. package/build/components/save-button/index.cjs.map +1 -7
  43. package/build/components/secondary-sidebar/index.cjs +38 -45
  44. package/build/components/secondary-sidebar/index.cjs.map +1 -7
  45. package/build/components/secondary-sidebar/inserter-sidebar.cjs +50 -51
  46. package/build/components/secondary-sidebar/inserter-sidebar.cjs.map +1 -7
  47. package/build/components/secondary-sidebar/list-view-sidebar.cjs +51 -82
  48. package/build/components/secondary-sidebar/list-view-sidebar.cjs.map +1 -7
  49. package/build/components/sidebar/index.cjs +117 -180
  50. package/build/components/sidebar/index.cjs.map +1 -7
  51. package/build/components/sidebar/widget-areas.cjs +43 -85
  52. package/build/components/sidebar/widget-areas.cjs.map +1 -7
  53. package/build/components/welcome-guide/index.cjs +110 -186
  54. package/build/components/welcome-guide/index.cjs.map +1 -7
  55. package/build/components/widget-areas-block-editor-content/index.cjs +59 -64
  56. package/build/components/widget-areas-block-editor-content/index.cjs.map +1 -7
  57. package/build/components/widget-areas-block-editor-provider/index.cjs +105 -140
  58. package/build/components/widget-areas-block-editor-provider/index.cjs.map +1 -7
  59. package/build/constants.cjs +11 -32
  60. package/build/constants.cjs.map +1 -7
  61. package/build/filters/index.cjs +7 -4
  62. package/build/filters/move-to-widget-area.cjs +38 -53
  63. package/build/filters/move-to-widget-area.cjs.map +1 -7
  64. package/build/filters/replace-media-upload.cjs +11 -9
  65. package/build/filters/replace-media-upload.cjs.map +1 -7
  66. package/build/hooks/use-last-selected-widget-area.cjs +28 -49
  67. package/build/hooks/use-last-selected-widget-area.cjs.map +1 -7
  68. package/build/hooks/use-widget-library-insertion-point.cjs +33 -67
  69. package/build/hooks/use-widget-library-insertion-point.cjs.map +1 -7
  70. package/build/index.cjs +96 -97
  71. package/build/index.cjs.map +1 -7
  72. package/build/lock-unlock.cjs +10 -35
  73. package/build/lock-unlock.cjs.map +1 -7
  74. package/build/store/actions.cjs +276 -278
  75. package/build/store/actions.cjs.map +1 -7
  76. package/build/store/constants.cjs +12 -29
  77. package/build/store/constants.cjs.map +1 -7
  78. package/build/store/index.cjs +61 -52
  79. package/build/store/index.cjs.map +1 -7
  80. package/build/store/private-selectors.cjs +11 -32
  81. package/build/store/private-selectors.cjs.map +1 -7
  82. package/build/store/reducer.cjs +107 -88
  83. package/build/store/reducer.cjs.map +1 -7
  84. package/build/store/resolvers.cjs +60 -91
  85. package/build/store/resolvers.cjs.map +1 -7
  86. package/build/store/selectors.cjs +196 -229
  87. package/build/store/selectors.cjs.map +1 -7
  88. package/build/store/transformers.cjs +51 -82
  89. package/build/store/transformers.cjs.map +1 -7
  90. package/build/store/utils.cjs +76 -63
  91. package/build/store/utils.cjs.map +1 -7
  92. package/build-module/blocks/widget-area/edit/index.mjs +82 -94
  93. package/build-module/blocks/widget-area/edit/index.mjs.map +1 -7
  94. package/build-module/blocks/widget-area/edit/inner-blocks.mjs +19 -35
  95. package/build-module/blocks/widget-area/edit/inner-blocks.mjs.map +1 -7
  96. package/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs +36 -33
  97. package/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs.map +1 -7
  98. package/build-module/blocks/widget-area/index.mjs +12 -15
  99. package/build-module/blocks/widget-area/index.mjs.map +1 -7
  100. package/build-module/components/error-boundary/index.mjs +104 -129
  101. package/build-module/components/error-boundary/index.mjs.map +1 -7
  102. package/build-module/components/header/document-tools/index.mjs +51 -84
  103. package/build-module/components/header/document-tools/index.mjs.map +1 -7
  104. package/build-module/components/header/index.mjs +44 -47
  105. package/build-module/components/header/index.mjs.map +1 -7
  106. package/build-module/components/header/undo-redo/redo.mjs +20 -27
  107. package/build-module/components/header/undo-redo/redo.mjs.map +1 -7
  108. package/build-module/components/header/undo-redo/undo.mjs +19 -26
  109. package/build-module/components/header/undo-redo/undo.mjs.map +1 -7
  110. package/build-module/components/keyboard-shortcut-help-modal/config.mjs +83 -61
  111. package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -7
  112. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs +19 -33
  113. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs.map +1 -7
  114. package/build-module/components/keyboard-shortcut-help-modal/index.mjs +67 -136
  115. package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -7
  116. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +32 -54
  117. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -7
  118. package/build-module/components/keyboard-shortcuts/index.mjs +99 -119
  119. package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -7
  120. package/build-module/components/layout/index.mjs +29 -40
  121. package/build-module/components/layout/index.mjs.map +1 -7
  122. package/build-module/components/layout/interface.mjs +53 -82
  123. package/build-module/components/layout/interface.mjs.map +1 -7
  124. package/build-module/components/layout/unsaved-changes-warning.mjs +35 -27
  125. package/build-module/components/layout/unsaved-changes-warning.mjs.map +1 -7
  126. package/build-module/components/more-menu/index.mjs +94 -162
  127. package/build-module/components/more-menu/index.mjs.map +1 -7
  128. package/build-module/components/more-menu/tools-more-menu-group.mjs +5 -9
  129. package/build-module/components/more-menu/tools-more-menu-group.mjs.map +1 -7
  130. package/build-module/components/notices/index.mjs +12 -17
  131. package/build-module/components/notices/index.mjs.map +1 -7
  132. package/build-module/components/save-button/index.mjs +23 -35
  133. package/build-module/components/save-button/index.mjs.map +1 -7
  134. package/build-module/components/secondary-sidebar/index.mjs +15 -20
  135. package/build-module/components/secondary-sidebar/index.mjs.map +1 -7
  136. package/build-module/components/secondary-sidebar/inserter-sidebar.mjs +27 -25
  137. package/build-module/components/secondary-sidebar/inserter-sidebar.mjs.map +1 -7
  138. package/build-module/components/secondary-sidebar/list-view-sidebar.mjs +39 -55
  139. package/build-module/components/secondary-sidebar/list-view-sidebar.mjs.map +1 -7
  140. package/build-module/components/sidebar/index.mjs +96 -162
  141. package/build-module/components/sidebar/index.mjs.map +1 -7
  142. package/build-module/components/sidebar/widget-areas.mjs +30 -57
  143. package/build-module/components/sidebar/widget-areas.mjs.map +1 -7
  144. package/build-module/components/welcome-guide/index.mjs +103 -164
  145. package/build-module/components/welcome-guide/index.mjs.map +1 -7
  146. package/build-module/components/widget-areas-block-editor-content/index.mjs +34 -44
  147. package/build-module/components/widget-areas-block-editor-content/index.mjs.map +1 -7
  148. package/build-module/components/widget-areas-block-editor-provider/index.mjs +76 -109
  149. package/build-module/components/widget-areas-block-editor-provider/index.mjs.map +1 -7
  150. package/build-module/constants.mjs +5 -7
  151. package/build-module/constants.mjs.map +1 -7
  152. package/build-module/filters/index.mjs +0 -2
  153. package/build-module/filters/move-to-widget-area.mjs +28 -48
  154. package/build-module/filters/move-to-widget-area.mjs.map +1 -7
  155. package/build-module/filters/replace-media-upload.mjs +5 -8
  156. package/build-module/filters/replace-media-upload.mjs.map +1 -7
  157. package/build-module/hooks/use-last-selected-widget-area.mjs +23 -29
  158. package/build-module/hooks/use-last-selected-widget-area.mjs.map +1 -7
  159. package/build-module/hooks/use-widget-library-insertion-point.mjs +28 -47
  160. package/build-module/hooks/use-widget-library-insertion-point.mjs.map +1 -7
  161. package/build-module/index.mjs +62 -79
  162. package/build-module/index.mjs.map +1 -7
  163. package/build-module/lock-unlock.mjs +5 -10
  164. package/build-module/lock-unlock.mjs.map +1 -7
  165. package/build-module/store/actions.mjs +257 -247
  166. package/build-module/store/actions.mjs.map +1 -7
  167. package/build-module/store/constants.mjs +7 -5
  168. package/build-module/store/constants.mjs.map +1 -7
  169. package/build-module/store/index.mjs +18 -16
  170. package/build-module/store/index.mjs.map +1 -7
  171. package/build-module/store/private-selectors.mjs +5 -7
  172. package/build-module/store/private-selectors.mjs.map +1 -7
  173. package/build-module/store/reducer.mjs +95 -58
  174. package/build-module/store/reducer.mjs.map +1 -7
  175. package/build-module/store/resolvers.mjs +52 -71
  176. package/build-module/store/resolvers.mjs.map +1 -7
  177. package/build-module/store/selectors.mjs +178 -199
  178. package/build-module/store/selectors.mjs.map +1 -7
  179. package/build-module/store/transformers.mjs +44 -56
  180. package/build-module/store/transformers.mjs.map +1 -7
  181. package/build-module/store/utils.mjs +64 -32
  182. package/build-module/store/utils.mjs.map +1 -7
  183. package/build-style/style-rtl.css +32 -11
  184. package/build-style/style.css +32 -11
  185. package/package.json +33 -33
  186. package/src/components/error-boundary/index.jsx +2 -2
  187. package/src/components/header/index.jsx +13 -4
  188. package/src/components/header/style.scss +30 -3
  189. package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +1 -0
  190. package/src/components/keyboard-shortcut-help-modal/style.scss +1 -1
  191. package/src/components/layout/style.scss +5 -9
  192. package/src/components/layout/unsaved-changes-warning.js +4 -9
  193. package/src/components/more-menu/index.jsx +0 -1
  194. package/src/components/sidebar/index.jsx +18 -18
  195. package/src/components/welcome-guide/index.jsx +4 -2
  196. package/src/store/actions.js +25 -2
  197. package/src/store/test/actions.jsdom.test.js +230 -0
  198. package/build/filters/index.cjs.map +0 -7
  199. package/build-module/filters/index.mjs.map +0 -7
@@ -1,38 +1,70 @@
1
1
  // packages/edit-widgets/src/store/utils.js
2
- var KIND = "root";
3
- var WIDGET_AREA_ENTITY_TYPE = "sidebar";
4
- var POST_TYPE = "postType";
5
- var buildWidgetAreaPostId = (widgetAreaId) => `widget-area-${widgetAreaId}`;
6
- var buildWidgetAreasPostId = () => `widget-areas`;
2
+ /**
3
+ * "Kind" of the navigation post.
4
+ *
5
+ * @type {string}
6
+ */
7
+ const KIND = "root";
8
+ /**
9
+ * "post type" of the navigation post.
10
+ *
11
+ * @type {string}
12
+ */
13
+ const WIDGET_AREA_ENTITY_TYPE = "sidebar";
14
+ /**
15
+ * "post type" of the widget area post.
16
+ *
17
+ * @type {string}
18
+ */
19
+ const POST_TYPE = "postType";
20
+ /**
21
+ * Builds an ID for a new widget area post.
22
+ *
23
+ * @param {number} widgetAreaId Widget area id.
24
+ * @return {string} An ID.
25
+ */
26
+ const buildWidgetAreaPostId = (widgetAreaId) => `widget-area-${widgetAreaId}`;
27
+ /**
28
+ * Builds an ID for a global widget areas post.
29
+ *
30
+ * @return {string} An ID.
31
+ */
32
+ const buildWidgetAreasPostId = () => `widget-areas`;
33
+ /**
34
+ * Builds a query to resolve sidebars.
35
+ *
36
+ * @return {Object} Query.
37
+ */
7
38
  function buildWidgetAreasQuery() {
8
- return {
9
- per_page: -1
10
- };
39
+ return { per_page: -1 };
11
40
  }
41
+ /**
42
+ * Builds a query to resolve widgets.
43
+ *
44
+ * @return {Object} Query.
45
+ */
12
46
  function buildWidgetsQuery() {
13
- return {
14
- per_page: -1,
15
- _embed: "about"
16
- };
47
+ return {
48
+ per_page: -1,
49
+ _embed: "about"
50
+ };
17
51
  }
18
- var createStubPost = (id, blocks) => ({
19
- id,
20
- slug: id,
21
- status: "draft",
22
- type: "page",
23
- blocks,
24
- meta: {
25
- widgetAreaId: id
26
- }
52
+ /**
53
+ * Creates a stub post with given id and set of blocks. Used as a governing entity records
54
+ * for all widget areas.
55
+ *
56
+ * @param {string} id Post ID.
57
+ * @param {Array} blocks The list of blocks.
58
+ * @return {Object} A stub post object formatted in compliance with the data layer.
59
+ */
60
+ const createStubPost = (id, blocks) => ({
61
+ id,
62
+ slug: id,
63
+ status: "draft",
64
+ type: "page",
65
+ blocks,
66
+ meta: { widgetAreaId: id }
27
67
  });
28
- export {
29
- KIND,
30
- POST_TYPE,
31
- WIDGET_AREA_ENTITY_TYPE,
32
- buildWidgetAreaPostId,
33
- buildWidgetAreasPostId,
34
- buildWidgetAreasQuery,
35
- buildWidgetsQuery,
36
- createStubPost
37
- };
38
- //# sourceMappingURL=utils.mjs.map
68
+ export { KIND, POST_TYPE, WIDGET_AREA_ENTITY_TYPE, buildWidgetAreaPostId, buildWidgetAreasPostId, buildWidgetAreasQuery, buildWidgetsQuery, createStubPost };
69
+
70
+ //# sourceMappingURL=utils.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/store/utils.js"],
4
- "sourcesContent": ["/**\n * \"Kind\" of the navigation post.\n *\n * @type {string}\n */\nexport const KIND = 'root';\n\n/**\n * \"post type\" of the navigation post.\n *\n * @type {string}\n */\nexport const WIDGET_AREA_ENTITY_TYPE = 'sidebar';\n\n/**\n * \"post type\" of the widget area post.\n *\n * @type {string}\n */\nexport const POST_TYPE = 'postType';\n\n/**\n * Builds an ID for a new widget area post.\n *\n * @param {number} widgetAreaId Widget area id.\n * @return {string} An ID.\n */\nexport const buildWidgetAreaPostId = ( widgetAreaId ) =>\n\t`widget-area-${ widgetAreaId }`;\n\n/**\n * Builds an ID for a global widget areas post.\n *\n * @return {string} An ID.\n */\nexport const buildWidgetAreasPostId = () => `widget-areas`;\n\n/**\n * Builds a query to resolve sidebars.\n *\n * @return {Object} Query.\n */\nexport function buildWidgetAreasQuery() {\n\treturn {\n\t\tper_page: -1,\n\t};\n}\n\n/**\n * Builds a query to resolve widgets.\n *\n * @return {Object} Query.\n */\nexport function buildWidgetsQuery() {\n\treturn {\n\t\tper_page: -1,\n\t\t_embed: 'about',\n\t};\n}\n\n/**\n * Creates a stub post with given id and set of blocks. Used as a governing entity records\n * for all widget areas.\n *\n * @param {string} id Post ID.\n * @param {Array} blocks The list of blocks.\n * @return {Object} A stub post object formatted in compliance with the data layer.\n */\nexport const createStubPost = ( id, blocks ) => ( {\n\tid,\n\tslug: id,\n\tstatus: 'draft',\n\ttype: 'page',\n\tblocks,\n\tmeta: {\n\t\twidgetAreaId: id,\n\t},\n} );\n"],
5
- "mappings": ";AAKO,IAAM,OAAO;AAOb,IAAM,0BAA0B;AAOhC,IAAM,YAAY;AAQlB,IAAM,wBAAwB,CAAE,iBACtC,eAAgB,YAAa;AAOvB,IAAM,yBAAyB,MAAM;AAOrC,SAAS,wBAAwB;AACvC,SAAO;AAAA,IACN,UAAU;AAAA,EACX;AACD;AAOO,SAAS,oBAAoB;AACnC,SAAO;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,EACT;AACD;AAUO,IAAM,iBAAiB,CAAE,IAAI,YAAc;AAAA,EACjD;AAAA,EACA,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN;AAAA,EACA,MAAM;AAAA,IACL,cAAc;AAAA,EACf;AACD;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/store/utils.js"],"sourcesContent":["/**\n * \"Kind\" of the navigation post.\n *\n * @type {string}\n */\nexport const KIND = 'root';\n\n/**\n * \"post type\" of the navigation post.\n *\n * @type {string}\n */\nexport const WIDGET_AREA_ENTITY_TYPE = 'sidebar';\n\n/**\n * \"post type\" of the widget area post.\n *\n * @type {string}\n */\nexport const POST_TYPE = 'postType';\n\n/**\n * Builds an ID for a new widget area post.\n *\n * @param {number} widgetAreaId Widget area id.\n * @return {string} An ID.\n */\nexport const buildWidgetAreaPostId = ( widgetAreaId ) =>\n\t`widget-area-${ widgetAreaId }`;\n\n/**\n * Builds an ID for a global widget areas post.\n *\n * @return {string} An ID.\n */\nexport const buildWidgetAreasPostId = () => `widget-areas`;\n\n/**\n * Builds a query to resolve sidebars.\n *\n * @return {Object} Query.\n */\nexport function buildWidgetAreasQuery() {\n\treturn {\n\t\tper_page: -1,\n\t};\n}\n\n/**\n * Builds a query to resolve widgets.\n *\n * @return {Object} Query.\n */\nexport function buildWidgetsQuery() {\n\treturn {\n\t\tper_page: -1,\n\t\t_embed: 'about',\n\t};\n}\n\n/**\n * Creates a stub post with given id and set of blocks. Used as a governing entity records\n * for all widget areas.\n *\n * @param {string} id Post ID.\n * @param {Array} blocks The list of blocks.\n * @return {Object} A stub post object formatted in compliance with the data layer.\n */\nexport const createStubPost = ( id, blocks ) => ( {\n\tid,\n\tslug: id,\n\tstatus: 'draft',\n\ttype: 'page',\n\tblocks,\n\tmeta: {\n\t\twidgetAreaId: id,\n\t},\n} );\n"],"mappings":";;;;;;AAKA,MAAa,OAAO;;;;;;AAOpB,MAAa,0BAA0B;;;;;;AAOvC,MAAa,YAAY;;;;;;;AAQzB,MAAa,yBAA0B,iBACtC,eAAgB;;;;;;AAOjB,MAAa,+BAA+B;;;;;;AAO5C,SAAgB,wBAAwB;CACvC,OAAO,EACN,UAAU,GACX;AACD;;;;;;AAOA,SAAgB,oBAAoB;CACnC,OAAO;EACN,UAAU;EACV,QAAQ;CACT;AACD;;;;;;;;;AAUA,MAAa,kBAAmB,IAAI,YAAc;CACjD;CACA,MAAM;CACN,QAAQ;CACR,MAAM;CACN;CACA,MAAM,EACL,cAAc,GACf;AACD"}
@@ -621,7 +621,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
621
621
  justify-content: space-between;
622
622
  height: 64px;
623
623
  overflow: auto;
624
- background: #fff;
624
+ background: var(--wpds-color-background-surface-neutral-strong, #fff);
625
625
  }
626
626
  @media (min-width: 600px) {
627
627
  .edit-widgets-header {
@@ -654,7 +654,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
654
654
  content: "";
655
655
  width: 1px;
656
656
  height: 24px;
657
- background-color: #ddd;
657
+ background-color: var(--wpds-color-stroke-surface-neutral, #dbdbdb);
658
658
  margin-top: 4px;
659
659
  margin-right: 8px;
660
660
  }
@@ -704,6 +704,17 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
704
704
  gap: 8px;
705
705
  }
706
706
 
707
+ .edit-widgets-header.has-icon-labels .interface-pinned-items .components-button.has-icon {
708
+ padding: 0 12px;
709
+ }
710
+ .edit-widgets-header.has-icon-labels .interface-pinned-items .components-button.has-icon svg {
711
+ display: none;
712
+ }
713
+ .edit-widgets-header.has-icon-labels .interface-pinned-items .components-button.has-icon::after {
714
+ content: attr(aria-label);
715
+ white-space: nowrap;
716
+ }
717
+
707
718
  .edit-widgets-header-toolbar {
708
719
  gap: 8px;
709
720
  margin-left: 8px;
@@ -716,7 +727,22 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
716
727
  }
717
728
  .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
718
729
  .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
719
- background: #1e1e1e;
730
+ background: var(--wpds-color-background-interactive-neutral-strong-active, #1e1e1e);
731
+ }
732
+ .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]),
733
+ .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]) {
734
+ background: var(--wpds-color-background-interactive-neutral-strong-disabled, #e5e5e5);
735
+ }
736
+ @media (forced-colors: active) {
737
+ .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
738
+ .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
739
+ background: SelectedItem !important;
740
+ }
741
+ .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:disabled, .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed[aria-disabled=true],
742
+ .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:disabled,
743
+ .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed[aria-disabled=true] {
744
+ background: GrayText !important;
745
+ }
720
746
  }
721
747
  .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:active),
722
748
  .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon:focus:not(:active) {
@@ -794,7 +820,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
794
820
  margin: 0 0.2rem 0 0.2rem;
795
821
  }
796
822
  .edit-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child {
797
- margin: 0 0.2rem 0 0;
823
+ margin-inline-end: 0;
798
824
  }
799
825
 
800
826
  .components-panel__header.edit-widgets-sidebar__panel-tabs {
@@ -854,16 +880,11 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
854
880
  }
855
881
 
856
882
  .edit-widgets-layout__inserter-panel-content {
857
- height: calc(100% - 36px - 8px);
883
+ height: 100%;
858
884
  }
859
- .edit-widgets-layout__inserter-panel-content .block-editor-inserter__tablist-and-close {
885
+ .edit-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab .block-editor-tabbed-sidebar__tablist-and-close-button {
860
886
  display: none;
861
887
  }
862
- @media (min-width: 782px) {
863
- .edit-widgets-layout__inserter-panel-content {
864
- height: 100%;
865
- }
866
- }
867
888
 
868
889
  .components-popover.more-menu-dropdown__content {
869
890
  z-index: 99998;
@@ -621,7 +621,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
621
621
  justify-content: space-between;
622
622
  height: 64px;
623
623
  overflow: auto;
624
- background: #fff;
624
+ background: var(--wpds-color-background-surface-neutral-strong, #fff);
625
625
  }
626
626
  @media (min-width: 600px) {
627
627
  .edit-widgets-header {
@@ -654,7 +654,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
654
654
  content: "";
655
655
  width: 1px;
656
656
  height: 24px;
657
- background-color: #ddd;
657
+ background-color: var(--wpds-color-stroke-surface-neutral, #dbdbdb);
658
658
  margin-top: 4px;
659
659
  margin-left: 8px;
660
660
  }
@@ -704,6 +704,17 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
704
704
  gap: 8px;
705
705
  }
706
706
 
707
+ .edit-widgets-header.has-icon-labels .interface-pinned-items .components-button.has-icon {
708
+ padding: 0 12px;
709
+ }
710
+ .edit-widgets-header.has-icon-labels .interface-pinned-items .components-button.has-icon svg {
711
+ display: none;
712
+ }
713
+ .edit-widgets-header.has-icon-labels .interface-pinned-items .components-button.has-icon::after {
714
+ content: attr(aria-label);
715
+ white-space: nowrap;
716
+ }
717
+
707
718
  .edit-widgets-header-toolbar {
708
719
  gap: 8px;
709
720
  margin-right: 8px;
@@ -716,7 +727,22 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
716
727
  }
717
728
  .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
718
729
  .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
719
- background: #1e1e1e;
730
+ background: var(--wpds-color-background-interactive-neutral-strong-active, #1e1e1e);
731
+ }
732
+ .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]),
733
+ .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]) {
734
+ background: var(--wpds-color-background-interactive-neutral-strong-disabled, #e5e5e5);
735
+ }
736
+ @media (forced-colors: active) {
737
+ .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
738
+ .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
739
+ background: SelectedItem !important;
740
+ }
741
+ .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:disabled, .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed[aria-disabled=true],
742
+ .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:disabled,
743
+ .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed[aria-disabled=true] {
744
+ background: GrayText !important;
745
+ }
720
746
  }
721
747
  .edit-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:active),
722
748
  .edit-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon:focus:not(:active) {
@@ -794,7 +820,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
794
820
  margin: 0 0.2rem 0 0.2rem;
795
821
  }
796
822
  .edit-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child {
797
- margin: 0 0 0 0.2rem;
823
+ margin-inline-end: 0;
798
824
  }
799
825
 
800
826
  .components-panel__header.edit-widgets-sidebar__panel-tabs {
@@ -854,16 +880,11 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
854
880
  }
855
881
 
856
882
  .edit-widgets-layout__inserter-panel-content {
857
- height: calc(100% - 36px - 8px);
883
+ height: 100%;
858
884
  }
859
- .edit-widgets-layout__inserter-panel-content .block-editor-inserter__tablist-and-close {
885
+ .edit-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab .block-editor-tabbed-sidebar__tablist-and-close-button {
860
886
  display: none;
861
887
  }
862
- @media (min-width: 782px) {
863
- .edit-widgets-layout__inserter-panel-content {
864
- height: 100%;
865
- }
866
- }
867
888
 
868
889
  .components-popover.more-menu-dropdown__content {
869
890
  z-index: 99998;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-widgets",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "description": "Widgets Page module for WordPress..",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -45,43 +45,43 @@
45
45
  ]
46
46
  },
47
47
  "dependencies": {
48
- "@wordpress/a11y": "^5.0.0",
49
- "@wordpress/admin-ui": "^3.0.0",
50
- "@wordpress/api-fetch": "^8.0.0",
51
- "@wordpress/base-styles": "^14.0.0",
52
- "@wordpress/block-editor": "^19.0.0",
53
- "@wordpress/block-library": "^12.0.0",
54
- "@wordpress/blocks": "^17.0.0",
55
- "@wordpress/components": "^43.0.0",
56
- "@wordpress/compose": "^9.0.0",
57
- "@wordpress/core-data": "^9.0.0",
58
- "@wordpress/data": "^11.0.0",
59
- "@wordpress/deprecated": "^5.0.0",
60
- "@wordpress/dom": "^5.0.0",
61
- "@wordpress/element": "^10.0.0",
62
- "@wordpress/hooks": "^5.0.0",
63
- "@wordpress/i18n": "^7.0.0",
64
- "@wordpress/icons": "^19.0.0",
65
- "@wordpress/interface": "^11.0.0",
66
- "@wordpress/keyboard-shortcuts": "^6.0.0",
67
- "@wordpress/keycodes": "^5.0.0",
68
- "@wordpress/media-utils": "^6.0.0",
69
- "@wordpress/notices": "^6.0.0",
70
- "@wordpress/patterns": "^3.0.0",
71
- "@wordpress/plugins": "^8.0.0",
72
- "@wordpress/preferences": "^5.0.0",
73
- "@wordpress/private-apis": "^3.0.0",
74
- "@wordpress/theme": "^3.0.0",
75
- "@wordpress/ui": "^0.25.0",
76
- "@wordpress/url": "^5.0.0",
77
- "@wordpress/widgets": "^5.0.0",
48
+ "@wordpress/a11y": "^5.2.0",
49
+ "@wordpress/admin-ui": "^3.2.0",
50
+ "@wordpress/api-fetch": "^8.2.0",
51
+ "@wordpress/base-styles": "^15.1.0",
52
+ "@wordpress/block-editor": "^20.1.0",
53
+ "@wordpress/block-library": "^12.2.0",
54
+ "@wordpress/blocks": "^17.2.0",
55
+ "@wordpress/components": "^45.0.0",
56
+ "@wordpress/compose": "^9.2.0",
57
+ "@wordpress/core-data": "^9.2.0",
58
+ "@wordpress/data": "^11.2.0",
59
+ "@wordpress/deprecated": "^5.2.0",
60
+ "@wordpress/dom": "^5.2.0",
61
+ "@wordpress/element": "^10.2.0",
62
+ "@wordpress/hooks": "^5.2.0",
63
+ "@wordpress/i18n": "^7.2.0",
64
+ "@wordpress/icons": "^21.0.0",
65
+ "@wordpress/interface": "^11.2.0",
66
+ "@wordpress/keyboard-shortcuts": "^6.2.0",
67
+ "@wordpress/keycodes": "^5.2.0",
68
+ "@wordpress/media-utils": "^6.2.0",
69
+ "@wordpress/notices": "^6.2.0",
70
+ "@wordpress/patterns": "^3.2.0",
71
+ "@wordpress/plugins": "^8.2.0",
72
+ "@wordpress/preferences": "^5.2.0",
73
+ "@wordpress/private-apis": "^3.2.0",
74
+ "@wordpress/theme": "^5.0.0",
75
+ "@wordpress/ui": "^0.27.0",
76
+ "@wordpress/url": "^5.2.0",
77
+ "@wordpress/widgets": "^5.2.0",
78
78
  "clsx": "^2.1.1"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@testing-library/dom": "^10.4.2",
82
82
  "@testing-library/react": "^16.3.3",
83
83
  "deep-freeze": "^0.0.1",
84
- "vitest": "^5.0.3"
84
+ "vitest": "^5.1.0"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "react": "^18 || ^19",
@@ -90,5 +90,5 @@
90
90
  "publishConfig": {
91
91
  "access": "public"
92
92
  },
93
- "gitHead": "8d30f92cbbde3ddf781c8799443c649befbbcb88"
93
+ "gitHead": "1000cdf1dffd5b5e69f75cc4360aa76db8252264"
94
94
  }
@@ -1,6 +1,6 @@
1
1
  import { Component } from '@wordpress/element';
2
2
  import { speak } from '@wordpress/a11y';
3
- import { __ } from '@wordpress/i18n';
3
+ import { __, _x } from '@wordpress/i18n';
4
4
  import { Card, CollapsibleCard, Notice, Stack, Text } from '@wordpress/ui';
5
5
  import { useCopyToClipboard } from '@wordpress/compose';
6
6
  import { doAction } from '@wordpress/hooks';
@@ -168,7 +168,7 @@ export default class ErrorBoundary extends Component {
168
168
  getErrorReport( error, componentStack )
169
169
  }
170
170
  >
171
- { __( 'Copy error' ) }
171
+ { _x( 'Copy error', 'button label' ) }
172
172
  </CopyButton>
173
173
  </Notice.Actions>
174
174
  </Notice.Root>
@@ -1,8 +1,9 @@
1
+ import clsx from 'clsx';
1
2
  import { BlockToolbar } from '@wordpress/block-editor';
2
3
  import { useSelect } from '@wordpress/data';
3
4
  import { useRef } from '@wordpress/element';
4
5
  import { __ } from '@wordpress/i18n';
5
- import { Popover } from '@wordpress/components';
6
+ import { Popover as WCPopover } from '@wordpress/components';
6
7
  import { PinnedItems } from '@wordpress/interface';
7
8
  import { useViewportMatch } from '@wordpress/compose';
8
9
  import { store as preferencesStore } from '@wordpress/preferences';
@@ -14,19 +15,27 @@ import MoreMenu from '../more-menu';
14
15
  function Header() {
15
16
  const isLargeViewport = useViewportMatch( 'medium' );
16
17
  const blockToolbarRef = useRef();
17
- const { hasFixedToolbar } = useSelect(
18
+ const { hasFixedToolbar, showIconLabels } = useSelect(
18
19
  ( select ) => ( {
19
20
  hasFixedToolbar: !! select( preferencesStore ).get(
20
21
  'core/edit-widgets',
21
22
  'fixedToolbar'
22
23
  ),
24
+ showIconLabels: select( preferencesStore ).get(
25
+ 'core',
26
+ 'showIconLabels'
27
+ ),
23
28
  } ),
24
29
  []
25
30
  );
26
31
 
27
32
  return (
28
33
  <>
29
- <div className="edit-widgets-header">
34
+ <div
35
+ className={ clsx( 'edit-widgets-header', {
36
+ 'has-icon-labels': showIconLabels,
37
+ } ) }
38
+ >
30
39
  <div className="edit-widgets-header__navigable-toolbar-wrapper">
31
40
  { isLargeViewport && (
32
41
  <h1 className="edit-widgets-header__title">
@@ -47,7 +56,7 @@ function Header() {
47
56
  <div className="selected-block-tools-wrapper">
48
57
  <BlockToolbar hideDragHandle />
49
58
  </div>
50
- <Popover.Slot
59
+ <WCPopover.Slot
51
60
  ref={ blockToolbarRef }
52
61
  name="block-toolbar"
53
62
  />
@@ -9,7 +9,7 @@
9
9
  justify-content: space-between;
10
10
  height: $header-height;
11
11
  overflow: auto;
12
- background: #fff;
12
+ background: var(--wpds-color-background-surface-neutral-strong);
13
13
 
14
14
  @include break-small {
15
15
  overflow: visible;
@@ -49,7 +49,7 @@
49
49
  content: "";
50
50
  width: $border-width;
51
51
  height: $grid-unit-30;
52
- background-color: $gray-300;
52
+ background-color: var(--wpds-color-stroke-surface-neutral);
53
53
  margin-top: $grid-unit-05;
54
54
  margin-left: $grid-unit;
55
55
  }
@@ -108,6 +108,20 @@
108
108
  gap: $grid-unit-10;
109
109
  }
110
110
 
111
+ // With "Show button text labels" on, pinned items show their label (the aria-label) in place of the icon.
112
+ .edit-widgets-header.has-icon-labels .interface-pinned-items .components-button.has-icon {
113
+ padding: 0 $grid-unit-15;
114
+
115
+ svg {
116
+ display: none;
117
+ }
118
+
119
+ &::after {
120
+ content: attr(aria-label);
121
+ white-space: nowrap;
122
+ }
123
+ }
124
+
111
125
  .edit-widgets-header-toolbar {
112
126
  gap: $grid-unit-10;
113
127
  // Some plugins add buttons here despite best practices.
@@ -124,7 +138,20 @@
124
138
  padding: 4px;
125
139
 
126
140
  &.is-pressed {
127
- background: $gray-900;
141
+ background: var(--wpds-color-background-interactive-neutral-strong-active);
142
+
143
+ &:is(:disabled, [aria-disabled="true"]) {
144
+ background: var(--wpds-color-background-interactive-neutral-strong-disabled);
145
+ }
146
+
147
+ @media (forced-colors: active) {
148
+ background: SelectedItem !important;
149
+
150
+ &:disabled,
151
+ &[aria-disabled="true"] {
152
+ background: GrayText !important;
153
+ }
154
+ }
128
155
  }
129
156
 
130
157
  &:focus:not(:active) {
@@ -17,6 +17,7 @@ function KeyCombination( { keyCombination, forceAriaLabel } ) {
17
17
  return (
18
18
  <kbd
19
19
  className="edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination"
20
+ dir="ltr"
20
21
  aria-label={ forceAriaLabel || ariaLabel }
21
22
  >
22
23
  { shortcuts.map( ( character, index ) => {
@@ -54,7 +54,7 @@
54
54
  margin: 0 0.2rem 0 0.2rem;
55
55
 
56
56
  &:last-child {
57
- margin: 0 0 0 0.2rem;
57
+ margin-inline-end: 0;
58
58
  }
59
59
  }
60
60
  }
@@ -1,4 +1,3 @@
1
- @use "@wordpress/base-styles/mixins" as *;
2
1
  @use "@wordpress/base-styles/variables" as *;
3
2
 
4
3
  .edit-widgets-layout__footer {
@@ -22,14 +21,11 @@
22
21
  }
23
22
 
24
23
  .edit-widgets-layout__inserter-panel-content {
25
- // Leave space for the close button
26
- height: calc(100% - #{$button-size} - #{$grid-unit-10});
27
-
28
- .block-editor-inserter__tablist-and-close {
29
- display: none;
30
- }
24
+ height: 100%;
31
25
 
32
- @include break-medium() {
33
- height: 100%;
26
+ .block-editor-inserter__menu.has-single-tab {
27
+ .block-editor-tabbed-sidebar__tablist-and-close-button {
28
+ display: none;
29
+ }
34
30
  }
35
31
  }
@@ -1,4 +1,3 @@
1
- import { __ } from '@wordpress/i18n';
2
1
  import { useEffect } from '@wordpress/element';
3
2
  import { useSelect } from '@wordpress/data';
4
3
  import { store as editWidgetsStore } from '../../store';
@@ -23,21 +22,17 @@ export default function UnsavedChangesWarning() {
23
22
  /**
24
23
  * Warns the user if there are unsaved changes before leaving the editor.
25
24
  *
26
- * @param {Event} event `beforeunload` event.
27
- *
28
- * @return {string | undefined} Warning prompt message, if unsaved changes exist.
25
+ * @param {BeforeUnloadEvent} event `beforeunload` event.
29
26
  */
30
27
  const warnIfUnsavedChanges = ( event ) => {
31
28
  if ( isDirty ) {
32
- event.returnValue = __(
33
- 'You have unsaved changes. If you proceed, they will be lost.'
34
- );
35
- return event.returnValue;
29
+ event.preventDefault();
30
+ // Chrome before 119 ignores `preventDefault()`.
31
+ event.returnValue = true;
36
32
  }
37
33
  };
38
34
 
39
35
  window.addEventListener( 'beforeunload', warnIfUnsavedChanges );
40
-
41
36
  return () => {
42
37
  window.removeEventListener( 'beforeunload', warnIfUnsavedChanges );
43
38
  };
@@ -91,7 +91,6 @@ export default function MoreMenu() {
91
91
  'https://wordpress.org/documentation/article/block-based-widgets-editor/'
92
92
  ) }
93
93
  target="_blank"
94
- rel="noopener"
95
94
  >
96
95
  { __( 'Help' ) }
97
96
  <VisuallyHidden render={ <span /> }>