@wordpress/edit-post 8.48.2-next.v.202606191442.0 → 8.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 8.49.0 (2026-06-24)
6
+
5
7
  ## 8.48.1 (2026-06-16)
6
8
 
7
9
  ## 8.48.0 (2026-06-10)
@@ -67,8 +67,7 @@ function InitPatternModal() {
67
67
  value: title,
68
68
  onChange: setTitle,
69
69
  placeholder: (0, import_i18n.__)("My pattern"),
70
- className: "patterns-create-modal__name-input",
71
- __next40pxDefaultSize: true
70
+ className: "patterns-create-modal__name-input"
72
71
  }
73
72
  ),
74
73
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/init-pattern-modal/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( () => isCleanNewPost() );\n\n\tif ( ! isModalOpen ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\tonRequestClose={ () => {\n\t\t\t\tsetIsModalOpen( false );\n\t\t\t} }\n\t\t\toverlayClassName=\"patterns-create-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\teditPost( {\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetSyncType( ! syncType ? 'unsynced' : undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<Stack justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,kBAAuB;AACvB,wBAKO;AACP,gBAAsB;AACtB,qBAAyB;AACzB,oBAAqC;AAiCjC;AA/BW,SAAR,mBAAoC;AAC1C,QAAM,EAAE,SAAS,QAAI,yBAAa,cAAAA,KAAY;AAC9C,QAAM,EAAE,eAAe,QAAI,uBAAW,cAAAA,KAAY;AAClD,QAAM,CAAE,UAAU,WAAY,QAAI,yBAAU,MAAU;AACtD,QAAM,CAAE,OAAO,QAAS,QAAI,yBAAU,EAAG;AACzC,QAAM,CAAE,aAAa,cAAe,QAAI,yBAAU,MAAM,eAAe,CAAE;AAEzE,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAQ,gBAAI,gBAAiB;AAAA,MAC7B,gBAAiB,MAAM;AACtB,uBAAgB,KAAM;AAAA,MACvB;AAAA,MACA,kBAAiB;AAAA,MAEjB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,2BAAgB,KAAM;AACtB,qBAAU;AAAA,cACT;AAAA,cACA,MAAM;AAAA,gBACL,wBAAwB;AAAA,cACzB;AAAA,YACD,CAAE;AAAA,UACH;AAAA,UAEA,uDAAC,mBAAM,WAAU,UAAS,KAAI,MAC7B;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,MAAO;AAAA,gBACnB,OAAQ;AAAA,gBACR,UAAW;AAAA,gBACX,iBAAc,gBAAI,YAAa;AAAA,gBAC/B,WAAU;AAAA,gBACV,uBAAqB;AAAA;AAAA,YACtB;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,UAAU,oBAAqB;AAAA,gBAC3C,UAAO;AAAA,kBACN;AAAA,gBACD;AAAA,gBACA,SAAU,CAAE;AAAA,gBACZ,UAAW,MAAM;AAChB,8BAAa,CAAE,WAAW,aAAa,MAAU;AAAA,gBAClD;AAAA;AAAA,YACD;AAAA,YACA,4CAAC,mBAAM,SAAQ,OACd;AAAA,cAAC;AAAA;AAAA,gBACA,uBAAqB;AAAA,gBACrB,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,UAAW,CAAE;AAAA,gBACb,wBAAsB;AAAA,gBAEpB,8BAAI,QAAS;AAAA;AAAA,YAChB,GACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( () => isCleanNewPost() );\n\n\tif ( ! isModalOpen ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\tonRequestClose={ () => {\n\t\t\t\tsetIsModalOpen( false );\n\t\t\t} }\n\t\t\toverlayClassName=\"patterns-create-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\teditPost( {\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetSyncType( ! syncType ? 'unsynced' : undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<Stack justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,kBAAuB;AACvB,wBAKO;AACP,gBAAsB;AACtB,qBAAyB;AACzB,oBAAqC;AAiCjC;AA/BW,SAAR,mBAAoC;AAC1C,QAAM,EAAE,SAAS,QAAI,yBAAa,cAAAA,KAAY;AAC9C,QAAM,EAAE,eAAe,QAAI,uBAAW,cAAAA,KAAY;AAClD,QAAM,CAAE,UAAU,WAAY,QAAI,yBAAU,MAAU;AACtD,QAAM,CAAE,OAAO,QAAS,QAAI,yBAAU,EAAG;AACzC,QAAM,CAAE,aAAa,cAAe,QAAI,yBAAU,MAAM,eAAe,CAAE;AAEzE,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAQ,gBAAI,gBAAiB;AAAA,MAC7B,gBAAiB,MAAM;AACtB,uBAAgB,KAAM;AAAA,MACvB;AAAA,MACA,kBAAiB;AAAA,MAEjB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,2BAAgB,KAAM;AACtB,qBAAU;AAAA,cACT;AAAA,cACA,MAAM;AAAA,gBACL,wBAAwB;AAAA,cACzB;AAAA,YACD,CAAE;AAAA,UACH;AAAA,UAEA,uDAAC,mBAAM,WAAU,UAAS,KAAI,MAC7B;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,MAAO;AAAA,gBACnB,OAAQ;AAAA,gBACR,UAAW;AAAA,gBACX,iBAAc,gBAAI,YAAa;AAAA,gBAC/B,WAAU;AAAA;AAAA,YACX;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,UAAU,oBAAqB;AAAA,gBAC3C,UAAO;AAAA,kBACN;AAAA,gBACD;AAAA,gBACA,SAAU,CAAE;AAAA,gBACZ,UAAW,MAAM;AAChB,8BAAa,CAAE,WAAW,aAAa,MAAU;AAAA,gBAClD;AAAA;AAAA,YACD;AAAA,YACA,4CAAC,mBAAM,SAAQ,OACd;AAAA,cAAC;AAAA;AAAA,gBACA,uBAAqB;AAAA,gBACrB,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,UAAW,CAAE;AAAA,gBACb,wBAAsB;AAAA,gBAEpB,8BAAI,QAAS;AAAA;AAAA,YAChB,GACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": ["editorStore"]
7
7
  }
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // packages/edit-post/src/components/preferences-modal/index.js
@@ -36,13 +26,13 @@ var import_i18n = require("@wordpress/i18n");
36
26
  var import_preferences = require("@wordpress/preferences");
37
27
  var import_editor = require("@wordpress/editor");
38
28
  var import_lock_unlock = require("../../lock-unlock.cjs");
39
- var import_meta_boxes_section = __toESM(require("./meta-boxes-section.cjs"));
29
+ var import_meta_boxes_section = require("./meta-boxes-section.cjs");
40
30
  var import_jsx_runtime = require("react/jsx-runtime");
41
31
  var { PreferenceToggleControl } = (0, import_lock_unlock.unlock)(import_preferences.privateApis);
42
32
  var { PreferencesModal } = (0, import_lock_unlock.unlock)(import_editor.privateApis);
43
33
  function EditPostPreferencesModal() {
44
34
  const extraSections = {
45
- general: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_meta_boxes_section.default, { title: (0, import_i18n.__)("Advanced") }),
35
+ general: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_meta_boxes_section.MetaBoxesSection, { title: (0, import_i18n.__)("Advanced") }),
46
36
  appearance: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
37
  PreferenceToggleControl,
48
38
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preferences-modal/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport MetaBoxesSection from './meta-boxes-section';\n\nconst { PreferenceToggleControl } = unlock( preferencesPrivateApis );\nconst { PreferencesModal } = unlock( editorPrivateApis );\n\nexport default function EditPostPreferencesModal() {\n\tconst extraSections = {\n\t\tgeneral: <MetaBoxesSection title={ __( 'Advanced' ) } />,\n\t\tappearance: (\n\t\t\t<PreferenceToggleControl\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\thelp={ __( 'Make the editor look like your theme.' ) }\n\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t/>\n\t\t),\n\t};\n\n\treturn <PreferencesModal extraSections={ extraSections } />;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AACnB,yBAAsD;AACtD,oBAAiD;AAKjD,yBAAuB;AACvB,gCAA6B;AAOlB;AALX,IAAM,EAAE,wBAAwB,QAAI,2BAAQ,mBAAAA,WAAuB;AACnE,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,cAAAC,WAAkB;AAExC,SAAR,2BAA4C;AAClD,QAAM,gBAAgB;AAAA,IACrB,SAAS,4CAAC,0BAAAC,SAAA,EAAiB,WAAQ,gBAAI,UAAW,GAAI;AAAA,IACtD,YACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,aAAY;AAAA,QACZ,UAAO,gBAAI,uCAAwC;AAAA,QACnD,WAAQ,gBAAI,kBAAmB;AAAA;AAAA,IAChC;AAAA,EAEF;AAEA,SAAO,4CAAC,oBAAiB,eAAgC;AAC1D;",
6
- "names": ["preferencesPrivateApis", "editorPrivateApis", "MetaBoxesSection"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { MetaBoxesSection } from './meta-boxes-section';\n\nconst { PreferenceToggleControl } = unlock( preferencesPrivateApis );\nconst { PreferencesModal } = unlock( editorPrivateApis );\n\nexport default function EditPostPreferencesModal() {\n\tconst extraSections = {\n\t\tgeneral: <MetaBoxesSection title={ __( 'Advanced' ) } />,\n\t\tappearance: (\n\t\t\t<PreferenceToggleControl\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\thelp={ __( 'Make the editor look like your theme.' ) }\n\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t/>\n\t\t),\n\t};\n\n\treturn <PreferencesModal extraSections={ extraSections } />;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmB;AACnB,yBAAsD;AACtD,oBAAiD;AAKjD,yBAAuB;AACvB,gCAAiC;AAOtB;AALX,IAAM,EAAE,wBAAwB,QAAI,2BAAQ,mBAAAA,WAAuB;AACnE,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,cAAAC,WAAkB;AAExC,SAAR,2BAA4C;AAClD,QAAM,gBAAgB;AAAA,IACrB,SAAS,4CAAC,8CAAiB,WAAQ,gBAAI,UAAW,GAAI;AAAA,IACtD,YACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,aAAY;AAAA,QACZ,UAAO,gBAAI,uCAAwC;AAAA,QACnD,WAAQ,gBAAI,kBAAmB;AAAA;AAAA,IAChC;AAAA,EAEF;AAEA,SAAO,4CAAC,oBAAiB,eAAgC;AAC1D;",
6
+ "names": ["preferencesPrivateApis", "editorPrivateApis"]
7
7
  }
@@ -29,8 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // packages/edit-post/src/components/preferences-modal/meta-boxes-section.js
30
30
  var meta_boxes_section_exports = {};
31
31
  __export(meta_boxes_section_exports, {
32
- MetaBoxesSection: () => MetaBoxesSection,
33
- default: () => meta_boxes_section_default
32
+ MetaBoxesSection: () => MetaBoxesSection
34
33
  });
35
34
  module.exports = __toCommonJS(meta_boxes_section_exports);
36
35
  var import_i18n = require("@wordpress/i18n");
@@ -43,11 +42,15 @@ var import_store = require("../../store/index.cjs");
43
42
  var import_lock_unlock = require("../../lock-unlock.cjs");
44
43
  var import_jsx_runtime = require("react/jsx-runtime");
45
44
  var { PreferencesModalSection } = (0, import_lock_unlock.unlock)(import_preferences.privateApis);
46
- function MetaBoxesSection({
47
- areCustomFieldsRegistered,
48
- metaBoxes,
49
- ...sectionProps
50
- }) {
45
+ function MetaBoxesSection(sectionProps) {
46
+ const { areCustomFieldsRegistered, metaBoxes } = (0, import_data.useSelect)((select) => {
47
+ const { getEditorSettings } = select(import_editor.store);
48
+ const { getAllMetaBoxes } = select(import_store.store);
49
+ return {
50
+ areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0,
51
+ metaBoxes: getAllMetaBoxes()
52
+ };
53
+ }, []);
51
54
  const thirdPartyMetaBoxes = metaBoxes.filter(
52
55
  ({ id }) => id !== "postcustom"
53
56
  );
@@ -66,15 +69,6 @@ function MetaBoxesSection({
66
69
  ))
67
70
  ] });
68
71
  }
69
- var meta_boxes_section_default = (0, import_data.withSelect)((select) => {
70
- const { getEditorSettings } = select(import_editor.store);
71
- const { getAllMetaBoxes } = select(import_store.store);
72
- return {
73
- // This setting should not live in the block editor's store.
74
- areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0,
75
- metaBoxes: getAllMetaBoxes()
76
- };
77
- })(MetaBoxesSection);
78
72
  // Annotate the CommonJS export names for ESM import in node:
79
73
  0 && (module.exports = {
80
74
  MetaBoxesSection
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preferences-modal/meta-boxes-section.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnableCustomFieldsOption from './enable-custom-fields';\nimport EnablePanelOption from './enable-panel';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferencesModalSection } = unlock( preferencesPrivateApis );\n\nexport function MetaBoxesSection( {\n\tareCustomFieldsRegistered,\n\tmetaBoxes,\n\t...sectionProps\n} ) {\n\t// The 'Custom Fields' meta box is a special case that we handle separately.\n\tconst thirdPartyMetaBoxes = metaBoxes.filter(\n\t\t( { id } ) => id !== 'postcustom'\n\t);\n\n\tif ( ! areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModalSection { ...sectionProps }>\n\t\t\t{ areCustomFieldsRegistered && (\n\t\t\t\t<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />\n\t\t\t) }\n\t\t\t{ thirdPartyMetaBoxes.map( ( { id, title } ) => (\n\t\t\t\t<EnablePanelOption\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tpanelName={ `meta-box-${ id }` }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</PreferencesModalSection>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditorSettings } = select( editorStore );\n\tconst { getAllMetaBoxes } = select( editPostStore );\n\n\treturn {\n\t\t// This setting should not live in the block editor's store.\n\t\tareCustomFieldsRegistered:\n\t\t\tgetEditorSettings().enableCustomFields !== undefined,\n\t\tmetaBoxes: getAllMetaBoxes(),\n\t};\n} )( MetaBoxesSection );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAA2B;AAC3B,oBAAqC;AACrC,yBAAsD;AAKtD,kCAAqC;AACrC,0BAA8B;AAC9B,mBAAuC;AACvC,yBAAuB;AAmBrB;AAjBF,IAAM,EAAE,wBAAwB,QAAI,2BAAQ,mBAAAA,WAAuB;AAE5D,SAAS,iBAAkB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAI;AAEH,QAAM,sBAAsB,UAAU;AAAA,IACrC,CAAE,EAAE,GAAG,MAAO,OAAO;AAAA,EACtB;AAEA,MAAK,CAAE,6BAA6B,oBAAoB,WAAW,GAAI;AACtE,WAAO;AAAA,EACR;AAEA,SACC,6CAAC,2BAA0B,GAAG,cAC3B;AAAA,iCACD,4CAAC,4BAAAC,SAAA,EAAyB,WAAQ,gBAAI,eAAgB,GAAI;AAAA,IAEzD,oBAAoB,IAAK,CAAE,EAAE,IAAI,MAAM,MACxC;AAAA,MAAC,oBAAAC;AAAA,MAAA;AAAA,QAEA,OAAQ;AAAA,QACR,WAAY,YAAa,EAAG;AAAA;AAAA,MAFtB;AAAA,IAGP,CACC;AAAA,KACH;AAEF;AAEA,IAAO,iCAAQ,wBAAY,CAAE,WAAY;AACxC,QAAM,EAAE,kBAAkB,IAAI,OAAQ,cAAAC,KAAY;AAClD,QAAM,EAAE,gBAAgB,IAAI,OAAQ,aAAAC,KAAc;AAElD,SAAO;AAAA;AAAA,IAEN,2BACC,kBAAkB,EAAE,uBAAuB;AAAA,IAC5C,WAAW,gBAAgB;AAAA,EAC5B;AACD,CAAE,EAAG,gBAAiB;",
6
- "names": ["preferencesPrivateApis", "EnableCustomFieldsOption", "EnablePanelOption", "editorStore", "editPostStore"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnableCustomFieldsOption from './enable-custom-fields';\nimport EnablePanelOption from './enable-panel';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferencesModalSection } = unlock( preferencesPrivateApis );\n\nexport function MetaBoxesSection( sectionProps ) {\n\tconst { areCustomFieldsRegistered, metaBoxes } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getAllMetaBoxes } = select( editPostStore );\n\n\t\treturn {\n\t\t\tareCustomFieldsRegistered:\n\t\t\t\tgetEditorSettings().enableCustomFields !== undefined,\n\t\t\tmetaBoxes: getAllMetaBoxes(),\n\t\t};\n\t}, [] );\n\n\t// The 'Custom Fields' meta box is a special case that we handle separately.\n\tconst thirdPartyMetaBoxes = metaBoxes.filter(\n\t\t( { id } ) => id !== 'postcustom'\n\t);\n\n\tif ( ! areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModalSection { ...sectionProps }>\n\t\t\t{ areCustomFieldsRegistered && (\n\t\t\t\t<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />\n\t\t\t) }\n\t\t\t{ thirdPartyMetaBoxes.map( ( { id, title } ) => (\n\t\t\t\t<EnablePanelOption\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tpanelName={ `meta-box-${ id }` }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</PreferencesModalSection>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAA0B;AAC1B,oBAAqC;AACrC,yBAAsD;AAKtD,kCAAqC;AACrC,0BAA8B;AAC9B,mBAAuC;AACvC,yBAAuB;AA0BrB;AAxBF,IAAM,EAAE,wBAAwB,QAAI,2BAAQ,mBAAAA,WAAuB;AAE5D,SAAS,iBAAkB,cAAe;AAChD,QAAM,EAAE,2BAA2B,UAAU,QAAI,uBAAW,CAAE,WAAY;AACzE,UAAM,EAAE,kBAAkB,IAAI,OAAQ,cAAAC,KAAY;AAClD,UAAM,EAAE,gBAAgB,IAAI,OAAQ,aAAAC,KAAc;AAElD,WAAO;AAAA,MACN,2BACC,kBAAkB,EAAE,uBAAuB;AAAA,MAC5C,WAAW,gBAAgB;AAAA,IAC5B;AAAA,EACD,GAAG,CAAC,CAAE;AAGN,QAAM,sBAAsB,UAAU;AAAA,IACrC,CAAE,EAAE,GAAG,MAAO,OAAO;AAAA,EACtB;AAEA,MAAK,CAAE,6BAA6B,oBAAoB,WAAW,GAAI;AACtE,WAAO;AAAA,EACR;AAEA,SACC,6CAAC,2BAA0B,GAAG,cAC3B;AAAA,iCACD,4CAAC,4BAAAC,SAAA,EAAyB,WAAQ,gBAAI,eAAgB,GAAI;AAAA,IAEzD,oBAAoB,IAAK,CAAE,EAAE,IAAI,MAAM,MACxC;AAAA,MAAC,oBAAAC;AAAA,MAAA;AAAA,QAEA,OAAQ;AAAA,QACR,WAAY,YAAa,EAAG;AAAA;AAAA,MAFtB;AAAA,IAGP,CACC;AAAA,KACH;AAEF;",
6
+ "names": ["preferencesPrivateApis", "editorStore", "editPostStore", "EnableCustomFieldsOption", "EnablePanelOption"]
7
7
  }
@@ -49,8 +49,7 @@ function InitPatternModal() {
49
49
  value: title,
50
50
  onChange: setTitle,
51
51
  placeholder: __("My pattern"),
52
- className: "patterns-create-modal__name-input",
53
- __next40pxDefaultSize: true
52
+ className: "patterns-create-modal__name-input"
54
53
  }
55
54
  ),
56
55
  /* @__PURE__ */ jsx(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/init-pattern-modal/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( () => isCleanNewPost() );\n\n\tif ( ! isModalOpen ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\tonRequestClose={ () => {\n\t\t\t\tsetIsModalOpen( false );\n\t\t\t} }\n\t\t\toverlayClassName=\"patterns-create-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\teditPost( {\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetSyncType( ! syncType ? 'unsynced' : undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<Stack justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,SAAS,mBAAmB;AAiCjC,SACC,KADD;AA/BW,SAAR,mBAAoC;AAC1C,QAAM,EAAE,SAAS,IAAI,YAAa,WAAY;AAC9C,QAAM,EAAE,eAAe,IAAI,UAAW,WAAY;AAClD,QAAM,CAAE,UAAU,WAAY,IAAI,SAAU,MAAU;AACtD,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,EAAG;AACzC,QAAM,CAAE,aAAa,cAAe,IAAI,SAAU,MAAM,eAAe,CAAE;AAEzE,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,gBAAiB;AAAA,MAC7B,gBAAiB,MAAM;AACtB,uBAAgB,KAAM;AAAA,MACvB;AAAA,MACA,kBAAiB;AAAA,MAEjB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,2BAAgB,KAAM;AACtB,qBAAU;AAAA,cACT;AAAA,cACA,MAAM;AAAA,gBACL,wBAAwB;AAAA,cACzB;AAAA,YACD,CAAE;AAAA,UACH;AAAA,UAEA,+BAAC,SAAM,WAAU,UAAS,KAAI,MAC7B;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ,GAAI,MAAO;AAAA,gBACnB,OAAQ;AAAA,gBACR,UAAW;AAAA,gBACX,aAAc,GAAI,YAAa;AAAA,gBAC/B,WAAU;AAAA,gBACV,uBAAqB;AAAA;AAAA,YACtB;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ,GAAI,UAAU,oBAAqB;AAAA,gBAC3C,MAAO;AAAA,kBACN;AAAA,gBACD;AAAA,gBACA,SAAU,CAAE;AAAA,gBACZ,UAAW,MAAM;AAChB,8BAAa,CAAE,WAAW,aAAa,MAAU;AAAA,gBAClD;AAAA;AAAA,YACD;AAAA,YACA,oBAAC,SAAM,SAAQ,OACd;AAAA,cAAC;AAAA;AAAA,gBACA,uBAAqB;AAAA,gBACrB,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,UAAW,CAAE;AAAA,gBACb,wBAAsB;AAAA,gBAEpB,aAAI,QAAS;AAAA;AAAA,YAChB,GACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( () => isCleanNewPost() );\n\n\tif ( ! isModalOpen ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\tonRequestClose={ () => {\n\t\t\t\tsetIsModalOpen( false );\n\t\t\t} }\n\t\t\toverlayClassName=\"patterns-create-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\teditPost( {\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetSyncType( ! syncType ? 'unsynced' : undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<Stack justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,SAAS,mBAAmB;AAiCjC,SACC,KADD;AA/BW,SAAR,mBAAoC;AAC1C,QAAM,EAAE,SAAS,IAAI,YAAa,WAAY;AAC9C,QAAM,EAAE,eAAe,IAAI,UAAW,WAAY;AAClD,QAAM,CAAE,UAAU,WAAY,IAAI,SAAU,MAAU;AACtD,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,EAAG;AACzC,QAAM,CAAE,aAAa,cAAe,IAAI,SAAU,MAAM,eAAe,CAAE;AAEzE,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,gBAAiB;AAAA,MAC7B,gBAAiB,MAAM;AACtB,uBAAgB,KAAM;AAAA,MACvB;AAAA,MACA,kBAAiB;AAAA,MAEjB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,2BAAgB,KAAM;AACtB,qBAAU;AAAA,cACT;AAAA,cACA,MAAM;AAAA,gBACL,wBAAwB;AAAA,cACzB;AAAA,YACD,CAAE;AAAA,UACH;AAAA,UAEA,+BAAC,SAAM,WAAU,UAAS,KAAI,MAC7B;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ,GAAI,MAAO;AAAA,gBACnB,OAAQ;AAAA,gBACR,UAAW;AAAA,gBACX,aAAc,GAAI,YAAa;AAAA,gBAC/B,WAAU;AAAA;AAAA,YACX;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ,GAAI,UAAU,oBAAqB;AAAA,gBAC3C,MAAO;AAAA,kBACN;AAAA,gBACD;AAAA,gBACA,SAAU,CAAE;AAAA,gBACZ,UAAW,MAAM;AAChB,8BAAa,CAAE,WAAW,aAAa,MAAU;AAAA,gBAClD;AAAA;AAAA,YACD;AAAA,YACA,oBAAC,SAAM,SAAQ,OACd;AAAA,cAAC;AAAA;AAAA,gBACA,uBAAqB;AAAA,gBACrB,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,UAAW,CAAE;AAAA,gBACb,wBAAsB;AAAA,gBAEpB,aAAI,QAAS;AAAA;AAAA,YAChB,GACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,7 @@ import { __ } from "@wordpress/i18n";
3
3
  import { privateApis as preferencesPrivateApis } from "@wordpress/preferences";
4
4
  import { privateApis as editorPrivateApis } from "@wordpress/editor";
5
5
  import { unlock } from "../../lock-unlock.mjs";
6
- import MetaBoxesSection from "./meta-boxes-section.mjs";
6
+ import { MetaBoxesSection } from "./meta-boxes-section.mjs";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  var { PreferenceToggleControl } = unlock(preferencesPrivateApis);
9
9
  var { PreferencesModal } = unlock(editorPrivateApis);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preferences-modal/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport MetaBoxesSection from './meta-boxes-section';\n\nconst { PreferenceToggleControl } = unlock( preferencesPrivateApis );\nconst { PreferencesModal } = unlock( editorPrivateApis );\n\nexport default function EditPostPreferencesModal() {\n\tconst extraSections = {\n\t\tgeneral: <MetaBoxesSection title={ __( 'Advanced' ) } />,\n\t\tappearance: (\n\t\t\t<PreferenceToggleControl\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\thelp={ __( 'Make the editor look like your theme.' ) }\n\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t/>\n\t\t),\n\t};\n\n\treturn <PreferencesModal extraSections={ extraSections } />;\n}\n"],
5
- "mappings": ";AAIA,SAAS,UAAU;AACnB,SAAS,eAAe,8BAA8B;AACtD,SAAS,eAAe,yBAAyB;AAKjD,SAAS,cAAc;AACvB,OAAO,sBAAsB;AAOlB;AALX,IAAM,EAAE,wBAAwB,IAAI,OAAQ,sBAAuB;AACnE,IAAM,EAAE,iBAAiB,IAAI,OAAQ,iBAAkB;AAExC,SAAR,2BAA4C;AAClD,QAAM,gBAAgB;AAAA,IACrB,SAAS,oBAAC,oBAAiB,OAAQ,GAAI,UAAW,GAAI;AAAA,IACtD,YACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,aAAY;AAAA,QACZ,MAAO,GAAI,uCAAwC;AAAA,QACnD,OAAQ,GAAI,kBAAmB;AAAA;AAAA,IAChC;AAAA,EAEF;AAEA,SAAO,oBAAC,oBAAiB,eAAgC;AAC1D;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { MetaBoxesSection } from './meta-boxes-section';\n\nconst { PreferenceToggleControl } = unlock( preferencesPrivateApis );\nconst { PreferencesModal } = unlock( editorPrivateApis );\n\nexport default function EditPostPreferencesModal() {\n\tconst extraSections = {\n\t\tgeneral: <MetaBoxesSection title={ __( 'Advanced' ) } />,\n\t\tappearance: (\n\t\t\t<PreferenceToggleControl\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\thelp={ __( 'Make the editor look like your theme.' ) }\n\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t/>\n\t\t),\n\t};\n\n\treturn <PreferencesModal extraSections={ extraSections } />;\n}\n"],
5
+ "mappings": ";AAIA,SAAS,UAAU;AACnB,SAAS,eAAe,8BAA8B;AACtD,SAAS,eAAe,yBAAyB;AAKjD,SAAS,cAAc;AACvB,SAAS,wBAAwB;AAOtB;AALX,IAAM,EAAE,wBAAwB,IAAI,OAAQ,sBAAuB;AACnE,IAAM,EAAE,iBAAiB,IAAI,OAAQ,iBAAkB;AAExC,SAAR,2BAA4C;AAClD,QAAM,gBAAgB;AAAA,IACrB,SAAS,oBAAC,oBAAiB,OAAQ,GAAI,UAAW,GAAI;AAAA,IACtD,YACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,aAAY;AAAA,QACZ,MAAO,GAAI,uCAAwC;AAAA,QACnD,OAAQ,GAAI,kBAAmB;AAAA;AAAA,IAChC;AAAA,EAEF;AAEA,SAAO,oBAAC,oBAAiB,eAAgC;AAC1D;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  // packages/edit-post/src/components/preferences-modal/meta-boxes-section.js
2
2
  import { __ } from "@wordpress/i18n";
3
- import { withSelect } from "@wordpress/data";
3
+ import { useSelect } from "@wordpress/data";
4
4
  import { store as editorStore } from "@wordpress/editor";
5
5
  import { privateApis as preferencesPrivateApis } from "@wordpress/preferences";
6
6
  import EnableCustomFieldsOption from "./enable-custom-fields.mjs";
@@ -9,11 +9,15 @@ import { store as editPostStore } from "../../store/index.mjs";
9
9
  import { unlock } from "../../lock-unlock.mjs";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  var { PreferencesModalSection } = unlock(preferencesPrivateApis);
12
- function MetaBoxesSection({
13
- areCustomFieldsRegistered,
14
- metaBoxes,
15
- ...sectionProps
16
- }) {
12
+ function MetaBoxesSection(sectionProps) {
13
+ const { areCustomFieldsRegistered, metaBoxes } = useSelect((select) => {
14
+ const { getEditorSettings } = select(editorStore);
15
+ const { getAllMetaBoxes } = select(editPostStore);
16
+ return {
17
+ areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0,
18
+ metaBoxes: getAllMetaBoxes()
19
+ };
20
+ }, []);
17
21
  const thirdPartyMetaBoxes = metaBoxes.filter(
18
22
  ({ id }) => id !== "postcustom"
19
23
  );
@@ -32,17 +36,7 @@ function MetaBoxesSection({
32
36
  ))
33
37
  ] });
34
38
  }
35
- var meta_boxes_section_default = withSelect((select) => {
36
- const { getEditorSettings } = select(editorStore);
37
- const { getAllMetaBoxes } = select(editPostStore);
38
- return {
39
- // This setting should not live in the block editor's store.
40
- areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== void 0,
41
- metaBoxes: getAllMetaBoxes()
42
- };
43
- })(MetaBoxesSection);
44
39
  export {
45
- MetaBoxesSection,
46
- meta_boxes_section_default as default
40
+ MetaBoxesSection
47
41
  };
48
42
  //# sourceMappingURL=meta-boxes-section.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preferences-modal/meta-boxes-section.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnableCustomFieldsOption from './enable-custom-fields';\nimport EnablePanelOption from './enable-panel';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferencesModalSection } = unlock( preferencesPrivateApis );\n\nexport function MetaBoxesSection( {\n\tareCustomFieldsRegistered,\n\tmetaBoxes,\n\t...sectionProps\n} ) {\n\t// The 'Custom Fields' meta box is a special case that we handle separately.\n\tconst thirdPartyMetaBoxes = metaBoxes.filter(\n\t\t( { id } ) => id !== 'postcustom'\n\t);\n\n\tif ( ! areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModalSection { ...sectionProps }>\n\t\t\t{ areCustomFieldsRegistered && (\n\t\t\t\t<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />\n\t\t\t) }\n\t\t\t{ thirdPartyMetaBoxes.map( ( { id, title } ) => (\n\t\t\t\t<EnablePanelOption\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tpanelName={ `meta-box-${ id }` }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</PreferencesModalSection>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditorSettings } = select( editorStore );\n\tconst { getAllMetaBoxes } = select( editPostStore );\n\n\treturn {\n\t\t// This setting should not live in the block editor's store.\n\t\tareCustomFieldsRegistered:\n\t\t\tgetEditorSettings().enableCustomFields !== undefined,\n\t\tmetaBoxes: getAllMetaBoxes(),\n\t};\n} )( MetaBoxesSection );\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,SAAS,mBAAmB;AACrC,SAAS,eAAe,8BAA8B;AAKtD,OAAO,8BAA8B;AACrC,OAAO,uBAAuB;AAC9B,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AAmBrB,SAEE,KAFF;AAjBF,IAAM,EAAE,wBAAwB,IAAI,OAAQ,sBAAuB;AAE5D,SAAS,iBAAkB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAI;AAEH,QAAM,sBAAsB,UAAU;AAAA,IACrC,CAAE,EAAE,GAAG,MAAO,OAAO;AAAA,EACtB;AAEA,MAAK,CAAE,6BAA6B,oBAAoB,WAAW,GAAI;AACtE,WAAO;AAAA,EACR;AAEA,SACC,qBAAC,2BAA0B,GAAG,cAC3B;AAAA,iCACD,oBAAC,4BAAyB,OAAQ,GAAI,eAAgB,GAAI;AAAA,IAEzD,oBAAoB,IAAK,CAAE,EAAE,IAAI,MAAM,MACxC;AAAA,MAAC;AAAA;AAAA,QAEA,OAAQ;AAAA,QACR,WAAY,YAAa,EAAG;AAAA;AAAA,MAFtB;AAAA,IAGP,CACC;AAAA,KACH;AAEF;AAEA,IAAO,6BAAQ,WAAY,CAAE,WAAY;AACxC,QAAM,EAAE,kBAAkB,IAAI,OAAQ,WAAY;AAClD,QAAM,EAAE,gBAAgB,IAAI,OAAQ,aAAc;AAElD,SAAO;AAAA;AAAA,IAEN,2BACC,kBAAkB,EAAE,uBAAuB;AAAA,IAC5C,WAAW,gBAAgB;AAAA,EAC5B;AACD,CAAE,EAAG,gBAAiB;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnableCustomFieldsOption from './enable-custom-fields';\nimport EnablePanelOption from './enable-panel';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferencesModalSection } = unlock( preferencesPrivateApis );\n\nexport function MetaBoxesSection( sectionProps ) {\n\tconst { areCustomFieldsRegistered, metaBoxes } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getAllMetaBoxes } = select( editPostStore );\n\n\t\treturn {\n\t\t\tareCustomFieldsRegistered:\n\t\t\t\tgetEditorSettings().enableCustomFields !== undefined,\n\t\t\tmetaBoxes: getAllMetaBoxes(),\n\t\t};\n\t}, [] );\n\n\t// The 'Custom Fields' meta box is a special case that we handle separately.\n\tconst thirdPartyMetaBoxes = metaBoxes.filter(\n\t\t( { id } ) => id !== 'postcustom'\n\t);\n\n\tif ( ! areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModalSection { ...sectionProps }>\n\t\t\t{ areCustomFieldsRegistered && (\n\t\t\t\t<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />\n\t\t\t) }\n\t\t\t{ thirdPartyMetaBoxes.map( ( { id, title } ) => (\n\t\t\t\t<EnablePanelOption\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tpanelName={ `meta-box-${ id }` }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</PreferencesModalSection>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,mBAAmB;AACrC,SAAS,eAAe,8BAA8B;AAKtD,OAAO,8BAA8B;AACrC,OAAO,uBAAuB;AAC9B,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AA0BrB,SAEE,KAFF;AAxBF,IAAM,EAAE,wBAAwB,IAAI,OAAQ,sBAAuB;AAE5D,SAAS,iBAAkB,cAAe;AAChD,QAAM,EAAE,2BAA2B,UAAU,IAAI,UAAW,CAAE,WAAY;AACzE,UAAM,EAAE,kBAAkB,IAAI,OAAQ,WAAY;AAClD,UAAM,EAAE,gBAAgB,IAAI,OAAQ,aAAc;AAElD,WAAO;AAAA,MACN,2BACC,kBAAkB,EAAE,uBAAuB;AAAA,MAC5C,WAAW,gBAAgB;AAAA,IAC5B;AAAA,EACD,GAAG,CAAC,CAAE;AAGN,QAAM,sBAAsB,UAAU;AAAA,IACrC,CAAE,EAAE,GAAG,MAAO,OAAO;AAAA,EACtB;AAEA,MAAK,CAAE,6BAA6B,oBAAoB,WAAW,GAAI;AACtE,WAAO;AAAA,EACR;AAEA,SACC,qBAAC,2BAA0B,GAAG,cAC3B;AAAA,iCACD,oBAAC,4BAAyB,OAAQ,GAAI,eAAgB,GAAI;AAAA,IAEzD,oBAAoB,IAAK,CAAE,EAAE,IAAI,MAAM,MACxC;AAAA,MAAC;AAAA;AAAA,QAEA,OAAQ;AAAA,QACR,WAAY,YAAa,EAAG;AAAA;AAAA,MAFtB;AAAA,IAGP,CACC;AAAA,KACH;AAEF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "8.48.2-next.v.202606191442.0+17fe7db8a",
3
+ "version": "8.49.1",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -47,38 +47,38 @@
47
47
  "postbox"
48
48
  ],
49
49
  "dependencies": {
50
- "@wordpress/a11y": "^4.48.2-next.v.202606191442.0+17fe7db8a",
51
- "@wordpress/admin-ui": "^2.3.2-next.v.202606191442.0+17fe7db8a",
52
- "@wordpress/api-fetch": "^7.48.2-next.v.202606191442.0+17fe7db8a",
53
- "@wordpress/base-styles": "^10.0.2-next.v.202606191442.0+17fe7db8a",
54
- "@wordpress/block-editor": "^15.22.1-next.v.202606191442.0+17fe7db8a",
55
- "@wordpress/block-library": "^10.0.1-next.v.202606191442.0+17fe7db8a",
56
- "@wordpress/blocks": "^15.21.3-next.v.202606191442.0+17fe7db8a",
57
- "@wordpress/commands": "^1.48.2-next.v.202606191442.0+17fe7db8a",
58
- "@wordpress/components": "^35.1.1-next.v.202606191442.0+17fe7db8a",
59
- "@wordpress/compose": "^8.1.2-next.v.202606191442.0+17fe7db8a",
60
- "@wordpress/core-data": "^7.48.2-next.v.202606191442.0+17fe7db8a",
61
- "@wordpress/data": "^10.48.2-next.v.202606191442.0+17fe7db8a",
62
- "@wordpress/deprecated": "^4.48.2-next.v.202606191442.0+17fe7db8a",
63
- "@wordpress/dom": "^4.48.2-next.v.202606191442.0+17fe7db8a",
64
- "@wordpress/editor": "^14.48.2-next.v.202606191442.0+17fe7db8a",
65
- "@wordpress/element": "^8.0.2-next.v.202606191442.0+17fe7db8a",
66
- "@wordpress/global-styles-engine": "^1.15.2-next.v.202606191442.0+17fe7db8a",
67
- "@wordpress/hooks": "^4.48.2-next.v.202606191442.0+17fe7db8a",
68
- "@wordpress/html-entities": "^4.48.2-next.v.202606191442.0+17fe7db8a",
69
- "@wordpress/i18n": "^6.21.2-next.v.202606191442.0+17fe7db8a",
70
- "@wordpress/icons": "^14.0.2-next.v.202606191442.0+17fe7db8a",
71
- "@wordpress/keyboard-shortcuts": "^5.48.2-next.v.202606191442.0+17fe7db8a",
72
- "@wordpress/keycodes": "^4.48.2-next.v.202606191442.0+17fe7db8a",
73
- "@wordpress/notices": "^5.48.2-next.v.202606191442.0+17fe7db8a",
74
- "@wordpress/plugins": "^7.48.2-next.v.202606191442.0+17fe7db8a",
75
- "@wordpress/preferences": "^4.48.2-next.v.202606191442.0+17fe7db8a",
76
- "@wordpress/private-apis": "^1.48.2-next.v.202606191442.0+17fe7db8a",
77
- "@wordpress/ui": "^0.16.1-next.v.202606191442.0+17fe7db8a",
78
- "@wordpress/url": "^4.48.2-next.v.202606191442.0+17fe7db8a",
79
- "@wordpress/viewport": "^6.48.2-next.v.202606191442.0+17fe7db8a",
80
- "@wordpress/warning": "^3.48.2-next.v.202606191442.0+17fe7db8a",
81
- "@wordpress/widgets": "^4.48.2-next.v.202606191442.0+17fe7db8a",
50
+ "@wordpress/a11y": "^4.49.0",
51
+ "@wordpress/admin-ui": "^2.4.1",
52
+ "@wordpress/api-fetch": "^7.49.0",
53
+ "@wordpress/base-styles": "^10.1.0",
54
+ "@wordpress/block-editor": "^15.22.1",
55
+ "@wordpress/block-library": "^10.0.1",
56
+ "@wordpress/blocks": "^15.22.0",
57
+ "@wordpress/commands": "^1.49.1",
58
+ "@wordpress/components": "^36.0.1",
59
+ "@wordpress/compose": "^8.2.0",
60
+ "@wordpress/core-data": "^7.49.1",
61
+ "@wordpress/data": "^10.49.0",
62
+ "@wordpress/deprecated": "^4.49.0",
63
+ "@wordpress/dom": "^4.49.0",
64
+ "@wordpress/editor": "^14.49.1",
65
+ "@wordpress/element": "^8.1.0",
66
+ "@wordpress/global-styles-engine": "^1.16.0",
67
+ "@wordpress/hooks": "^4.49.0",
68
+ "@wordpress/html-entities": "^4.49.0",
69
+ "@wordpress/i18n": "^6.22.0",
70
+ "@wordpress/icons": "^15.0.0",
71
+ "@wordpress/keyboard-shortcuts": "^5.49.0",
72
+ "@wordpress/keycodes": "^4.49.0",
73
+ "@wordpress/notices": "^5.49.1",
74
+ "@wordpress/plugins": "^7.49.1",
75
+ "@wordpress/preferences": "^4.49.1",
76
+ "@wordpress/private-apis": "^1.49.0",
77
+ "@wordpress/ui": "^0.16.1",
78
+ "@wordpress/url": "^4.49.0",
79
+ "@wordpress/viewport": "^6.49.0",
80
+ "@wordpress/warning": "^3.49.0",
81
+ "@wordpress/widgets": "^4.49.1",
82
82
  "clsx": "^2.1.1",
83
83
  "memize": "^2.1.0"
84
84
  },
@@ -94,5 +94,5 @@
94
94
  "publishConfig": {
95
95
  "access": "public"
96
96
  },
97
- "gitHead": "1b6a19222df5a88f161880b5789efb3171d8f425"
97
+ "gitHead": "9a75283890dda96ae1d37197b5070fae8c9cf66f"
98
98
  }
@@ -51,7 +51,6 @@ export default function InitPatternModal() {
51
51
  onChange={ setTitle }
52
52
  placeholder={ __( 'My pattern' ) }
53
53
  className="patterns-create-modal__name-input"
54
- __next40pxDefaultSize
55
54
  />
56
55
  <ToggleControl
57
56
  label={ _x( 'Synced', 'pattern (singular)' ) }
@@ -10,7 +10,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { unlock } from '../../lock-unlock';
13
- import MetaBoxesSection from './meta-boxes-section';
13
+ import { MetaBoxesSection } from './meta-boxes-section';
14
14
 
15
15
  const { PreferenceToggleControl } = unlock( preferencesPrivateApis );
16
16
  const { PreferencesModal } = unlock( editorPrivateApis );
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { withSelect } from '@wordpress/data';
5
+ import { useSelect } from '@wordpress/data';
6
6
  import { store as editorStore } from '@wordpress/editor';
7
7
  import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
8
8
 
@@ -16,11 +16,18 @@ import { unlock } from '../../lock-unlock';
16
16
 
17
17
  const { PreferencesModalSection } = unlock( preferencesPrivateApis );
18
18
 
19
- export function MetaBoxesSection( {
20
- areCustomFieldsRegistered,
21
- metaBoxes,
22
- ...sectionProps
23
- } ) {
19
+ export function MetaBoxesSection( sectionProps ) {
20
+ const { areCustomFieldsRegistered, metaBoxes } = useSelect( ( select ) => {
21
+ const { getEditorSettings } = select( editorStore );
22
+ const { getAllMetaBoxes } = select( editPostStore );
23
+
24
+ return {
25
+ areCustomFieldsRegistered:
26
+ getEditorSettings().enableCustomFields !== undefined,
27
+ metaBoxes: getAllMetaBoxes(),
28
+ };
29
+ }, [] );
30
+
24
31
  // The 'Custom Fields' meta box is a special case that we handle separately.
25
32
  const thirdPartyMetaBoxes = metaBoxes.filter(
26
33
  ( { id } ) => id !== 'postcustom'
@@ -45,15 +52,3 @@ export function MetaBoxesSection( {
45
52
  </PreferencesModalSection>
46
53
  );
47
54
  }
48
-
49
- export default withSelect( ( select ) => {
50
- const { getEditorSettings } = select( editorStore );
51
- const { getAllMetaBoxes } = select( editPostStore );
52
-
53
- return {
54
- // This setting should not live in the block editor's store.
55
- areCustomFieldsRegistered:
56
- getEditorSettings().enableCustomFields !== undefined,
57
- metaBoxes: getAllMetaBoxes(),
58
- };
59
- } )( MetaBoxesSection );
@@ -3,68 +3,96 @@
3
3
  */
4
4
  import { render, screen } from '@testing-library/react';
5
5
 
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useSelect, select as realSelect } from '@wordpress/data';
10
+ import { store as editorStore } from '@wordpress/editor';
11
+
6
12
  /**
7
13
  * Internal dependencies
8
14
  */
9
15
  import { MetaBoxesSection } from '../meta-boxes-section';
16
+ import { store as editPostStore } from '../../../store';
17
+
18
+ jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
19
+
20
+ // Override only the selectors the section reads, while delegating the rest
21
+ // (used by the rendered child options) to the real registry.
22
+ function setupUseSelect( { areCustomFieldsRegistered, metaBoxes } ) {
23
+ useSelect.mockImplementation( ( mapSelect ) =>
24
+ mapSelect( ( store ) => {
25
+ if ( store === editorStore ) {
26
+ return {
27
+ ...realSelect( store ),
28
+ getEditorSettings: () => ( {
29
+ enableCustomFields: areCustomFieldsRegistered
30
+ ? false
31
+ : undefined,
32
+ } ),
33
+ };
34
+ }
35
+ if ( store === editPostStore ) {
36
+ return {
37
+ ...realSelect( store ),
38
+ getAllMetaBoxes: () => metaBoxes,
39
+ };
40
+ }
41
+ return realSelect( store );
42
+ } )
43
+ );
44
+ }
10
45
 
11
46
  describe( 'MetaBoxesSection', () => {
12
47
  it( 'does not render if there are no options', () => {
13
- render(
14
- <MetaBoxesSection
15
- areCustomFieldsRegistered={ false }
16
- metaBoxes={ [
17
- { id: 'postcustom', title: 'This should not render' },
18
- ] }
19
- />
20
- );
48
+ setupUseSelect( {
49
+ areCustomFieldsRegistered: false,
50
+ metaBoxes: [
51
+ { id: 'postcustom', title: 'This should not render' },
52
+ ],
53
+ } );
54
+ render( <MetaBoxesSection /> );
21
55
  expect( screen.queryByRole( 'group' ) ).not.toBeInTheDocument();
22
56
  } );
23
57
 
24
58
  it( 'renders a Custom Fields option', () => {
25
- render(
26
- <MetaBoxesSection
27
- title="Advanced panels"
28
- areCustomFieldsRegistered
29
- metaBoxes={ [
30
- { id: 'postcustom', title: 'This should not render' },
31
- ] }
32
- />
33
- );
59
+ setupUseSelect( {
60
+ areCustomFieldsRegistered: true,
61
+ metaBoxes: [
62
+ { id: 'postcustom', title: 'This should not render' },
63
+ ],
64
+ } );
65
+ render( <MetaBoxesSection title="Advanced panels" /> );
34
66
  expect(
35
67
  screen.getByRole( 'group', { name: 'Advanced panels' } )
36
68
  ).toMatchSnapshot();
37
69
  } );
38
70
 
39
71
  it( 'renders meta box options', () => {
40
- render(
41
- <MetaBoxesSection
42
- title="Advanced panels"
43
- areCustomFieldsRegistered={ false }
44
- metaBoxes={ [
45
- { id: 'postcustom', title: 'This should not render' },
46
- { id: 'test1', title: 'Meta Box 1' },
47
- { id: 'test2', title: 'Meta Box 2' },
48
- ] }
49
- />
50
- );
72
+ setupUseSelect( {
73
+ areCustomFieldsRegistered: false,
74
+ metaBoxes: [
75
+ { id: 'postcustom', title: 'This should not render' },
76
+ { id: 'test1', title: 'Meta Box 1' },
77
+ { id: 'test2', title: 'Meta Box 2' },
78
+ ],
79
+ } );
80
+ render( <MetaBoxesSection title="Advanced panels" /> );
51
81
  expect(
52
82
  screen.getByRole( 'group', { name: 'Advanced panels' } )
53
83
  ).toMatchSnapshot();
54
84
  } );
55
85
 
56
86
  it( 'renders a Custom Fields option and meta box options', () => {
57
- render(
58
- <MetaBoxesSection
59
- title="Advanced panels"
60
- areCustomFieldsRegistered
61
- metaBoxes={ [
62
- { id: 'postcustom', title: 'This should not render' },
63
- { id: 'test1', title: 'Meta Box 1' },
64
- { id: 'test2', title: 'Meta Box 2' },
65
- ] }
66
- />
67
- );
87
+ setupUseSelect( {
88
+ areCustomFieldsRegistered: true,
89
+ metaBoxes: [
90
+ { id: 'postcustom', title: 'This should not render' },
91
+ { id: 'test1', title: 'Meta Box 1' },
92
+ { id: 'test2', title: 'Meta Box 2' },
93
+ ],
94
+ } );
95
+ render( <MetaBoxesSection title="Advanced panels" /> );
68
96
  expect(
69
97
  screen.getByRole( 'group', { name: 'Advanced panels' } )
70
98
  ).toMatchSnapshot();