@wordpress/widgets 3.34.0 → 4.0.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 (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js +5 -4
  3. package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +1 -1
  4. package/build/blocks/legacy-widget/edit/form.js +29 -24
  5. package/build/blocks/legacy-widget/edit/form.js.map +1 -1
  6. package/build/blocks/legacy-widget/edit/index.js +87 -69
  7. package/build/blocks/legacy-widget/edit/index.js.map +1 -1
  8. package/build/blocks/legacy-widget/edit/inspector-card.js +10 -6
  9. package/build/blocks/legacy-widget/edit/inspector-card.js.map +1 -1
  10. package/build/blocks/legacy-widget/edit/no-preview.js +9 -4
  11. package/build/blocks/legacy-widget/edit/no-preview.js.map +1 -1
  12. package/build/blocks/legacy-widget/edit/preview.js +29 -22
  13. package/build/blocks/legacy-widget/edit/preview.js.map +1 -1
  14. package/build/blocks/legacy-widget/edit/widget-type-selector.js +3 -3
  15. package/build/blocks/legacy-widget/edit/widget-type-selector.js.map +1 -1
  16. package/build/blocks/widget-group/deprecated.js +8 -6
  17. package/build/blocks/widget-group/deprecated.js.map +1 -1
  18. package/build/blocks/widget-group/edit.js +35 -29
  19. package/build/blocks/widget-group/edit.js.map +1 -1
  20. package/build/blocks/widget-group/save.js +11 -8
  21. package/build/blocks/widget-group/save.js.map +1 -1
  22. package/build/components/move-to-widget-area/index.js +27 -21
  23. package/build/components/move-to-widget-area/index.js.map +1 -1
  24. package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js +5 -4
  25. package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +1 -1
  26. package/build-module/blocks/legacy-widget/edit/form.js +30 -24
  27. package/build-module/blocks/legacy-widget/edit/form.js.map +1 -1
  28. package/build-module/blocks/legacy-widget/edit/index.js +89 -69
  29. package/build-module/blocks/legacy-widget/edit/index.js.map +1 -1
  30. package/build-module/blocks/legacy-widget/edit/inspector-card.js +11 -6
  31. package/build-module/blocks/legacy-widget/edit/inspector-card.js.map +1 -1
  32. package/build-module/blocks/legacy-widget/edit/no-preview.js +10 -4
  33. package/build-module/blocks/legacy-widget/edit/no-preview.js.map +1 -1
  34. package/build-module/blocks/legacy-widget/edit/preview.js +31 -22
  35. package/build-module/blocks/legacy-widget/edit/preview.js.map +1 -1
  36. package/build-module/blocks/legacy-widget/edit/widget-type-selector.js +3 -3
  37. package/build-module/blocks/legacy-widget/edit/widget-type-selector.js.map +1 -1
  38. package/build-module/blocks/widget-group/deprecated.js +10 -6
  39. package/build-module/blocks/widget-group/deprecated.js.map +1 -1
  40. package/build-module/blocks/widget-group/edit.js +37 -29
  41. package/build-module/blocks/widget-group/edit.js.map +1 -1
  42. package/build-module/blocks/widget-group/save.js +13 -8
  43. package/build-module/blocks/widget-group/save.js.map +1 -1
  44. package/build-module/components/move-to-widget-area/index.js +27 -21
  45. package/build-module/components/move-to-widget-area/index.js.map +1 -1
  46. package/package.json +18 -14
  47. package/src/blocks/legacy-widget/edit/form.js +2 -2
  48. package/src/blocks/legacy-widget/edit/index.js +2 -2
  49. package/src/blocks/legacy-widget/edit/preview.js +4 -7
  50. package/src/blocks/legacy-widget/index.php +6 -0
  51. package/src/blocks/widget-group/index.php +8 -0
@@ -1,4 +1,3 @@
1
- import { createElement, Fragment } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -7,6 +6,9 @@ import { Placeholder } from '@wordpress/components';
7
6
  import { group as groupIcon } from '@wordpress/icons';
8
7
  import { __ } from '@wordpress/i18n';
9
8
  import { useSelect } from '@wordpress/data';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { Fragment as _Fragment } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
12
  export default function Edit(props) {
11
13
  const {
12
14
  clientId
@@ -14,46 +16,52 @@ export default function Edit(props) {
14
16
  const {
15
17
  innerBlocks
16
18
  } = useSelect(select => select(blockEditorStore).getBlock(clientId), [clientId]);
17
- return createElement("div", {
19
+ return /*#__PURE__*/_jsx("div", {
18
20
  ...useBlockProps({
19
21
  className: 'widget'
22
+ }),
23
+ children: innerBlocks.length === 0 ? /*#__PURE__*/_jsx(PlaceholderContent, {
24
+ ...props
25
+ }) : /*#__PURE__*/_jsx(PreviewContent, {
26
+ ...props
20
27
  })
21
- }, innerBlocks.length === 0 ? createElement(PlaceholderContent, {
22
- ...props
23
- }) : createElement(PreviewContent, {
24
- ...props
25
- }));
28
+ });
26
29
  }
27
30
  function PlaceholderContent({
28
31
  clientId
29
32
  }) {
30
- return createElement(Fragment, null, createElement(Placeholder, {
31
- className: "wp-block-widget-group__placeholder",
32
- icon: createElement(BlockIcon, {
33
- icon: groupIcon
34
- }),
35
- label: __('Widget Group')
36
- }, createElement(ButtonBlockAppender, {
37
- rootClientId: clientId
38
- })), createElement(InnerBlocks, {
39
- renderAppender: false
40
- }));
33
+ return /*#__PURE__*/_jsxs(_Fragment, {
34
+ children: [/*#__PURE__*/_jsx(Placeholder, {
35
+ className: "wp-block-widget-group__placeholder",
36
+ icon: /*#__PURE__*/_jsx(BlockIcon, {
37
+ icon: groupIcon
38
+ }),
39
+ label: __('Widget Group'),
40
+ children: /*#__PURE__*/_jsx(ButtonBlockAppender, {
41
+ rootClientId: clientId
42
+ })
43
+ }), /*#__PURE__*/_jsx(InnerBlocks, {
44
+ renderAppender: false
45
+ })]
46
+ });
41
47
  }
42
48
  function PreviewContent({
43
49
  attributes,
44
50
  setAttributes
45
51
  }) {
46
52
  var _attributes$title;
47
- return createElement(Fragment, null, createElement(RichText, {
48
- tagName: "h2",
49
- identifier: "title",
50
- className: "widget-title",
51
- allowedFormats: [],
52
- placeholder: __('Title'),
53
- value: (_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : '',
54
- onChange: title => setAttributes({
55
- title
56
- })
57
- }), createElement(InnerBlocks, null));
53
+ return /*#__PURE__*/_jsxs(_Fragment, {
54
+ children: [/*#__PURE__*/_jsx(RichText, {
55
+ tagName: "h2",
56
+ identifier: "title",
57
+ className: "widget-title",
58
+ allowedFormats: [],
59
+ placeholder: __('Title'),
60
+ value: (_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : '',
61
+ onChange: title => setAttributes({
62
+ title
63
+ })
64
+ }), /*#__PURE__*/_jsx(InnerBlocks, {})]
65
+ });
58
66
  }
59
67
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useBlockProps","BlockIcon","ButtonBlockAppender","InnerBlocks","store","blockEditorStore","RichText","Placeholder","group","groupIcon","__","useSelect","Edit","props","clientId","innerBlocks","select","getBlock","createElement","className","length","PlaceholderContent","PreviewContent","Fragment","icon","label","rootClientId","renderAppender","attributes","setAttributes","_attributes$title","tagName","identifier","allowedFormats","placeholder","value","title","onChange"],"sources":["@wordpress/widgets/src/blocks/widget-group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockIcon,\n\tButtonBlockAppender,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { Placeholder } from '@wordpress/components';\nimport { group as groupIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\nexport default function Edit( props ) {\n\tconst { clientId } = props;\n\tconst { innerBlocks } = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<div { ...useBlockProps( { className: 'widget' } ) }>\n\t\t\t{ innerBlocks.length === 0 ? (\n\t\t\t\t<PlaceholderContent { ...props } />\n\t\t\t) : (\n\t\t\t\t<PreviewContent { ...props } />\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction PlaceholderContent( { clientId } ) {\n\treturn (\n\t\t<>\n\t\t\t<Placeholder\n\t\t\t\tclassName=\"wp-block-widget-group__placeholder\"\n\t\t\t\ticon={ <BlockIcon icon={ groupIcon } /> }\n\t\t\t\tlabel={ __( 'Widget Group' ) }\n\t\t\t>\n\t\t\t\t<ButtonBlockAppender rootClientId={ clientId } />\n\t\t\t</Placeholder>\n\t\t\t<InnerBlocks renderAppender={ false } />\n\t\t</>\n\t);\n}\n\nfunction PreviewContent( { attributes, setAttributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tidentifier=\"title\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tallowedFormats={ [] }\n\t\t\t\tplaceholder={ __( 'Title' ) }\n\t\t\t\tvalue={ attributes.title ?? '' }\n\t\t\t\tonChange={ ( title ) => setAttributes( { title } ) }\n\t\t\t/>\n\t\t\t<InnerBlocks />\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,SAAS,EACTC,mBAAmB,EACnBC,WAAW,EACXC,KAAK,IAAIC,gBAAgB,EACzBC,QAAQ,QACF,yBAAyB;AAChC,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,KAAK,IAAIC,SAAS,QAAQ,kBAAkB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,eAAe,SAASC,IAAIA,CAAEC,KAAK,EAAG;EACrC,MAAM;IAAEC;EAAS,CAAC,GAAGD,KAAK;EAC1B,MAAM;IAAEE;EAAY,CAAC,GAAGJ,SAAS,CAC9BK,MAAM,IAAMA,MAAM,CAAEX,gBAAiB,CAAC,CAACY,QAAQ,CAAEH,QAAS,CAAC,EAC7D,CAAEA,QAAQ,CACX,CAAC;EAED,OACCI,aAAA;IAAA,GAAUlB,aAAa,CAAE;MAAEmB,SAAS,EAAE;IAAS,CAAE;EAAC,GAC/CJ,WAAW,CAACK,MAAM,KAAK,CAAC,GACzBF,aAAA,CAACG,kBAAkB;IAAA,GAAMR;EAAK,CAAI,CAAC,GAEnCK,aAAA,CAACI,cAAc;IAAA,GAAMT;EAAK,CAAI,CAE3B,CAAC;AAER;AAEA,SAASQ,kBAAkBA,CAAE;EAAEP;AAAS,CAAC,EAAG;EAC3C,OACCI,aAAA,CAAAK,QAAA,QACCL,aAAA,CAACX,WAAW;IACXY,SAAS,EAAC,oCAAoC;IAC9CK,IAAI,EAAGN,aAAA,CAACjB,SAAS;MAACuB,IAAI,EAAGf;IAAW,CAAE,CAAG;IACzCgB,KAAK,EAAGf,EAAE,CAAE,cAAe;EAAG,GAE9BQ,aAAA,CAAChB,mBAAmB;IAACwB,YAAY,EAAGZ;EAAU,CAAE,CACpC,CAAC,EACdI,aAAA,CAACf,WAAW;IAACwB,cAAc,EAAG;EAAO,CAAE,CACtC,CAAC;AAEL;AAEA,SAASL,cAAcA,CAAE;EAAEM,UAAU;EAAEC;AAAc,CAAC,EAAG;EAAA,IAAAC,iBAAA;EACxD,OACCZ,aAAA,CAAAK,QAAA,QACCL,aAAA,CAACZ,QAAQ;IACRyB,OAAO,EAAC,IAAI;IACZC,UAAU,EAAC,OAAO;IAClBb,SAAS,EAAC,cAAc;IACxBc,cAAc,EAAG,EAAI;IACrBC,WAAW,EAAGxB,EAAE,CAAE,OAAQ,CAAG;IAC7ByB,KAAK,GAAAL,iBAAA,GAAGF,UAAU,CAACQ,KAAK,cAAAN,iBAAA,cAAAA,iBAAA,GAAI,EAAI;IAChCO,QAAQ,EAAKD,KAAK,IAAMP,aAAa,CAAE;MAAEO;IAAM,CAAE;EAAG,CACpD,CAAC,EACFlB,aAAA,CAACf,WAAW,MAAE,CACb,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["useBlockProps","BlockIcon","ButtonBlockAppender","InnerBlocks","store","blockEditorStore","RichText","Placeholder","group","groupIcon","__","useSelect","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Edit","props","clientId","innerBlocks","select","getBlock","className","children","length","PlaceholderContent","PreviewContent","icon","label","rootClientId","renderAppender","attributes","setAttributes","_attributes$title","tagName","identifier","allowedFormats","placeholder","value","title","onChange"],"sources":["@wordpress/widgets/src/blocks/widget-group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockIcon,\n\tButtonBlockAppender,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { Placeholder } from '@wordpress/components';\nimport { group as groupIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\nexport default function Edit( props ) {\n\tconst { clientId } = props;\n\tconst { innerBlocks } = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<div { ...useBlockProps( { className: 'widget' } ) }>\n\t\t\t{ innerBlocks.length === 0 ? (\n\t\t\t\t<PlaceholderContent { ...props } />\n\t\t\t) : (\n\t\t\t\t<PreviewContent { ...props } />\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction PlaceholderContent( { clientId } ) {\n\treturn (\n\t\t<>\n\t\t\t<Placeholder\n\t\t\t\tclassName=\"wp-block-widget-group__placeholder\"\n\t\t\t\ticon={ <BlockIcon icon={ groupIcon } /> }\n\t\t\t\tlabel={ __( 'Widget Group' ) }\n\t\t\t>\n\t\t\t\t<ButtonBlockAppender rootClientId={ clientId } />\n\t\t\t</Placeholder>\n\t\t\t<InnerBlocks renderAppender={ false } />\n\t\t</>\n\t);\n}\n\nfunction PreviewContent( { attributes, setAttributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tidentifier=\"title\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tallowedFormats={ [] }\n\t\t\t\tplaceholder={ __( 'Title' ) }\n\t\t\t\tvalue={ attributes.title ?? '' }\n\t\t\t\tonChange={ ( title ) => setAttributes( { title } ) }\n\t\t\t/>\n\t\t\t<InnerBlocks />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,SAAS,EACTC,mBAAmB,EACnBC,WAAW,EACXC,KAAK,IAAIC,gBAAgB,EACzBC,QAAQ,QACF,yBAAyB;AAChC,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,KAAK,IAAIC,SAAS,QAAQ,kBAAkB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE5C,eAAe,SAASC,IAAIA,CAAEC,KAAK,EAAG;EACrC,MAAM;IAAEC;EAAS,CAAC,GAAGD,KAAK;EAC1B,MAAM;IAAEE;EAAY,CAAC,GAAGV,SAAS,CAC9BW,MAAM,IAAMA,MAAM,CAAEjB,gBAAiB,CAAC,CAACkB,QAAQ,CAAEH,QAAS,CAAC,EAC7D,CAAEA,QAAQ,CACX,CAAC;EAED,oBACCP,IAAA;IAAA,GAAUb,aAAa,CAAE;MAAEwB,SAAS,EAAE;IAAS,CAAE,CAAC;IAAAC,QAAA,EAC/CJ,WAAW,CAACK,MAAM,KAAK,CAAC,gBACzBb,IAAA,CAACc,kBAAkB;MAAA,GAAMR;IAAK,CAAI,CAAC,gBAEnCN,IAAA,CAACe,cAAc;MAAA,GAAMT;IAAK,CAAI;EAC9B,CACG,CAAC;AAER;AAEA,SAASQ,kBAAkBA,CAAE;EAAEP;AAAS,CAAC,EAAG;EAC3C,oBACCH,KAAA,CAAAF,SAAA;IAAAU,QAAA,gBACCZ,IAAA,CAACN,WAAW;MACXiB,SAAS,EAAC,oCAAoC;MAC9CK,IAAI,eAAGhB,IAAA,CAACZ,SAAS;QAAC4B,IAAI,EAAGpB;MAAW,CAAE,CAAG;MACzCqB,KAAK,EAAGpB,EAAE,CAAE,cAAe,CAAG;MAAAe,QAAA,eAE9BZ,IAAA,CAACX,mBAAmB;QAAC6B,YAAY,EAAGX;MAAU,CAAE;IAAC,CACrC,CAAC,eACdP,IAAA,CAACV,WAAW;MAAC6B,cAAc,EAAG;IAAO,CAAE,CAAC;EAAA,CACvC,CAAC;AAEL;AAEA,SAASJ,cAAcA,CAAE;EAAEK,UAAU;EAAEC;AAAc,CAAC,EAAG;EAAA,IAAAC,iBAAA;EACxD,oBACClB,KAAA,CAAAF,SAAA;IAAAU,QAAA,gBACCZ,IAAA,CAACP,QAAQ;MACR8B,OAAO,EAAC,IAAI;MACZC,UAAU,EAAC,OAAO;MAClBb,SAAS,EAAC,cAAc;MACxBc,cAAc,EAAG,EAAI;MACrBC,WAAW,EAAG7B,EAAE,CAAE,OAAQ,CAAG;MAC7B8B,KAAK,GAAAL,iBAAA,GAAGF,UAAU,CAACQ,KAAK,cAAAN,iBAAA,cAAAA,iBAAA,GAAI,EAAI;MAChCO,QAAQ,EAAKD,KAAK,IAAMP,aAAa,CAAE;QAAEO;MAAM,CAAE;IAAG,CACpD,CAAC,eACF5B,IAAA,CAACV,WAAW,IAAE,CAAC;EAAA,CACd,CAAC;AAEL","ignoreList":[]}
@@ -1,17 +1,22 @@
1
- import { createElement, Fragment } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
5
4
  import { InnerBlocks, RichText } from '@wordpress/block-editor';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
8
  export default function save({
7
9
  attributes
8
10
  }) {
9
- return createElement(Fragment, null, createElement(RichText.Content, {
10
- tagName: "h2",
11
- className: "widget-title",
12
- value: attributes.title
13
- }), createElement("div", {
14
- className: "wp-widget-group__inner-blocks"
15
- }, createElement(InnerBlocks.Content, null)));
11
+ return /*#__PURE__*/_jsxs(_Fragment, {
12
+ children: [/*#__PURE__*/_jsx(RichText.Content, {
13
+ tagName: "h2",
14
+ className: "widget-title",
15
+ value: attributes.title
16
+ }), /*#__PURE__*/_jsx("div", {
17
+ className: "wp-widget-group__inner-blocks",
18
+ children: /*#__PURE__*/_jsx(InnerBlocks.Content, {})
19
+ })]
20
+ });
16
21
  }
17
22
  //# sourceMappingURL=save.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["InnerBlocks","RichText","save","attributes","createElement","Fragment","Content","tagName","className","value","title"],"sources":["@wordpress/widgets/src/blocks/widget-group/save.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tvalue={ attributes.title }\n\t\t\t/>\n\t\t\t<div className=\"wp-widget-group__inner-blocks\">\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,yBAAyB;AAE/D,eAAe,SAASC,IAAIA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC9C,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACH,QAAQ,CAACK,OAAO;IAChBC,OAAO,EAAC,IAAI;IACZC,SAAS,EAAC,cAAc;IACxBC,KAAK,EAAGN,UAAU,CAACO;EAAO,CAC1B,CAAC,EACFN,aAAA;IAAKI,SAAS,EAAC;EAA+B,GAC7CJ,aAAA,CAACJ,WAAW,CAACM,OAAO,MAAE,CAClB,CACJ,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["InnerBlocks","RichText","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","save","attributes","children","Content","tagName","className","value","title"],"sources":["@wordpress/widgets/src/blocks/widget-group/save.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tvalue={ attributes.title }\n\t\t\t/>\n\t\t\t<div className=\"wp-widget-group__inner-blocks\">\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEhE,eAAe,SAASC,IAAIA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC9C,oBACCF,KAAA,CAAAF,SAAA;IAAAK,QAAA,gBACCP,IAAA,CAACF,QAAQ,CAACU,OAAO;MAChBC,OAAO,EAAC,IAAI;MACZC,SAAS,EAAC,cAAc;MACxBC,KAAK,EAAGL,UAAU,CAACM;IAAO,CAC1B,CAAC,eACFZ,IAAA;MAAKU,SAAS,EAAC,+BAA+B;MAAAH,QAAA,eAC7CP,IAAA,CAACH,WAAW,CAACW,OAAO,IAAE;IAAC,CACnB,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
@@ -1,34 +1,40 @@
1
- import { createElement } from "react";
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
5
4
  import { DropdownMenu, MenuGroup, MenuItemsChoice, ToolbarGroup, ToolbarItem } from '@wordpress/components';
6
5
  import { __ } from '@wordpress/i18n';
7
6
  import { moveTo } from '@wordpress/icons';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export default function MoveToWidgetArea({
9
9
  currentWidgetAreaId,
10
10
  widgetAreas,
11
11
  onSelect
12
12
  }) {
13
- return createElement(ToolbarGroup, null, createElement(ToolbarItem, null, toggleProps => createElement(DropdownMenu, {
14
- icon: moveTo,
15
- label: __('Move to widget area'),
16
- toggleProps: toggleProps
17
- }, ({
18
- onClose
19
- }) => createElement(MenuGroup, {
20
- label: __('Move to')
21
- }, createElement(MenuItemsChoice, {
22
- choices: widgetAreas.map(widgetArea => ({
23
- value: widgetArea.id,
24
- label: widgetArea.name,
25
- info: widgetArea.description
26
- })),
27
- value: currentWidgetAreaId,
28
- onSelect: value => {
29
- onSelect(value);
30
- onClose();
31
- }
32
- })))));
13
+ return /*#__PURE__*/_jsx(ToolbarGroup, {
14
+ children: /*#__PURE__*/_jsx(ToolbarItem, {
15
+ children: toggleProps => /*#__PURE__*/_jsx(DropdownMenu, {
16
+ icon: moveTo,
17
+ label: __('Move to widget area'),
18
+ toggleProps: toggleProps,
19
+ children: ({
20
+ onClose
21
+ }) => /*#__PURE__*/_jsx(MenuGroup, {
22
+ label: __('Move to'),
23
+ children: /*#__PURE__*/_jsx(MenuItemsChoice, {
24
+ choices: widgetAreas.map(widgetArea => ({
25
+ value: widgetArea.id,
26
+ label: widgetArea.name,
27
+ info: widgetArea.description
28
+ })),
29
+ value: currentWidgetAreaId,
30
+ onSelect: value => {
31
+ onSelect(value);
32
+ onClose();
33
+ }
34
+ })
35
+ })
36
+ })
37
+ })
38
+ });
33
39
  }
34
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DropdownMenu","MenuGroup","MenuItemsChoice","ToolbarGroup","ToolbarItem","__","moveTo","MoveToWidgetArea","currentWidgetAreaId","widgetAreas","onSelect","createElement","toggleProps","icon","label","onClose","choices","map","widgetArea","value","id","name","info","description"],"sources":["@wordpress/widgets/src/components/move-to-widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tToolbarGroup,\n\tToolbarItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moveTo } from '@wordpress/icons';\n\nexport default function MoveToWidgetArea( {\n\tcurrentWidgetAreaId,\n\twidgetAreas,\n\tonSelect,\n} ) {\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moveTo }\n\t\t\t\t\t\tlabel={ __( 'Move to widget area' ) }\n\t\t\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup label={ __( 'Move to' ) }>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tchoices={ widgetAreas.map(\n\t\t\t\t\t\t\t\t\t\t( widgetArea ) => ( {\n\t\t\t\t\t\t\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\t\t\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t\t\t\t\t\t\t\tinfo: widgetArea.description,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ currentWidgetAreaId }\n\t\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonSelect( value );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,YAAY,EACZC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,eAAe,SAASC,gBAAgBA,CAAE;EACzCC,mBAAmB;EACnBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,OACCC,aAAA,CAACR,YAAY,QACZQ,aAAA,CAACP,WAAW,QACPQ,WAAW,IACdD,aAAA,CAACX,YAAY;IACZa,IAAI,EAAGP,MAAQ;IACfQ,KAAK,EAAGT,EAAE,CAAE,qBAAsB,CAAG;IACrCO,WAAW,EAAGA;EAAa,GAEzB,CAAE;IAAEG;EAAQ,CAAC,KACdJ,aAAA,CAACV,SAAS;IAACa,KAAK,EAAGT,EAAE,CAAE,SAAU;EAAG,GACnCM,aAAA,CAACT,eAAe;IACfc,OAAO,EAAGP,WAAW,CAACQ,GAAG,CACtBC,UAAU,KAAQ;MACnBC,KAAK,EAAED,UAAU,CAACE,EAAE;MACpBN,KAAK,EAAEI,UAAU,CAACG,IAAI;MACtBC,IAAI,EAAEJ,UAAU,CAACK;IAClB,CAAC,CACF,CAAG;IACHJ,KAAK,EAAGX,mBAAqB;IAC7BE,QAAQ,EAAKS,KAAK,IAAM;MACvBT,QAAQ,CAAES,KAAM,CAAC;MACjBJ,OAAO,CAAC,CAAC;IACV;EAAG,CACH,CACS,CAEC,CAEH,CACA,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["DropdownMenu","MenuGroup","MenuItemsChoice","ToolbarGroup","ToolbarItem","__","moveTo","jsx","_jsx","MoveToWidgetArea","currentWidgetAreaId","widgetAreas","onSelect","children","toggleProps","icon","label","onClose","choices","map","widgetArea","value","id","name","info","description"],"sources":["@wordpress/widgets/src/components/move-to-widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tToolbarGroup,\n\tToolbarItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moveTo } from '@wordpress/icons';\n\nexport default function MoveToWidgetArea( {\n\tcurrentWidgetAreaId,\n\twidgetAreas,\n\tonSelect,\n} ) {\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moveTo }\n\t\t\t\t\t\tlabel={ __( 'Move to widget area' ) }\n\t\t\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup label={ __( 'Move to' ) }>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tchoices={ widgetAreas.map(\n\t\t\t\t\t\t\t\t\t\t( widgetArea ) => ( {\n\t\t\t\t\t\t\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\t\t\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t\t\t\t\t\t\t\tinfo: widgetArea.description,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ currentWidgetAreaId }\n\t\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonSelect( value );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,YAAY,EACZC,WAAW,QACL,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,eAAe,SAASC,gBAAgBA,CAAE;EACzCC,mBAAmB;EACnBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,oBACCJ,IAAA,CAACL,YAAY;IAAAU,QAAA,eACZL,IAAA,CAACJ,WAAW;MAAAS,QAAA,EACPC,WAAW,iBACdN,IAAA,CAACR,YAAY;QACZe,IAAI,EAAGT,MAAQ;QACfU,KAAK,EAAGX,EAAE,CAAE,qBAAsB,CAAG;QACrCS,WAAW,EAAGA,WAAa;QAAAD,QAAA,EAEzBA,CAAE;UAAEI;QAAQ,CAAC,kBACdT,IAAA,CAACP,SAAS;UAACe,KAAK,EAAGX,EAAE,CAAE,SAAU,CAAG;UAAAQ,QAAA,eACnCL,IAAA,CAACN,eAAe;YACfgB,OAAO,EAAGP,WAAW,CAACQ,GAAG,CACtBC,UAAU,KAAQ;cACnBC,KAAK,EAAED,UAAU,CAACE,EAAE;cACpBN,KAAK,EAAEI,UAAU,CAACG,IAAI;cACtBC,IAAI,EAAEJ,UAAU,CAACK;YAClB,CAAC,CACF,CAAG;YACHJ,KAAK,EAAGX,mBAAqB;YAC7BE,QAAQ,EAAKS,KAAK,IAAM;cACvBT,QAAQ,CAAES,KAAM,CAAC;cACjBJ,OAAO,CAAC,CAAC;YACV;UAAG,CACH;QAAC,CACQ;MACX,CACY;IACd,CACW;EAAC,CACD,CAAC;AAEjB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/widgets",
3
- "version": "3.34.0",
3
+ "version": "4.0.0",
4
4
  "description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -16,23 +16,27 @@
16
16
  "bugs": {
17
17
  "url": "https://github.com/WordPress/gutenberg/issues"
18
18
  },
19
+ "engines": {
20
+ "node": ">=18.12.0",
21
+ "npm": ">=8.19.2"
22
+ },
19
23
  "main": "build/index.js",
20
24
  "module": "build-module/index.js",
21
25
  "react-native": "src/index",
22
26
  "dependencies": {
23
27
  "@babel/runtime": "^7.16.0",
24
- "@wordpress/api-fetch": "^6.54.0",
25
- "@wordpress/block-editor": "^12.25.0",
26
- "@wordpress/blocks": "^12.34.0",
27
- "@wordpress/components": "^27.5.0",
28
- "@wordpress/compose": "^6.34.0",
29
- "@wordpress/core-data": "^6.34.0",
30
- "@wordpress/data": "^9.27.0",
31
- "@wordpress/element": "^5.34.0",
32
- "@wordpress/i18n": "^4.57.0",
33
- "@wordpress/icons": "^9.48.0",
34
- "@wordpress/notices": "^4.25.0",
35
- "classnames": "^2.3.1"
28
+ "@wordpress/api-fetch": "^7.0.0",
29
+ "@wordpress/block-editor": "^13.0.0",
30
+ "@wordpress/blocks": "^13.0.0",
31
+ "@wordpress/components": "^28.0.0",
32
+ "@wordpress/compose": "^7.0.0",
33
+ "@wordpress/core-data": "^7.0.0",
34
+ "@wordpress/data": "^10.0.0",
35
+ "@wordpress/element": "^6.0.0",
36
+ "@wordpress/i18n": "^5.0.0",
37
+ "@wordpress/icons": "^10.0.0",
38
+ "@wordpress/notices": "^5.0.0",
39
+ "clsx": "^2.1.1"
36
40
  },
37
41
  "peerDependencies": {
38
42
  "react": "^18.0.0",
@@ -41,5 +45,5 @@
41
45
  "publishConfig": {
42
46
  "access": "public"
43
47
  },
44
- "gitHead": "581d8a5580dba8f600b7268d51eb554771ae482c"
48
+ "gitHead": "2f30cddff15723ac7017fd009fc5913b7b419400"
45
49
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
  /**
6
6
  * WordPress dependencies
7
7
  */
@@ -92,7 +92,7 @@ export default function Form( {
92
92
  if ( isWide && isMediumLargeViewport ) {
93
93
  return (
94
94
  <div
95
- className={ classnames( {
95
+ className={ clsx( {
96
96
  'wp-block-legacy-widget__container': isVisible,
97
97
  } ) }
98
98
  >
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -35,7 +35,7 @@ export default function Edit( props ) {
35
35
  const { isWide = false } = props;
36
36
 
37
37
  const blockProps = useBlockProps( {
38
- className: classnames( {
38
+ className: clsx( {
39
39
  'is-wide-widget': isWide,
40
40
  } ),
41
41
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import classnames from 'classnames';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -113,12 +113,9 @@ export default function Preview( { idBase, instance, isVisible } ) {
113
113
  </Placeholder>
114
114
  ) }
115
115
  <div
116
- className={ classnames(
117
- 'wp-block-legacy-widget__edit-preview',
118
- {
119
- 'is-offscreen': ! isVisible || ! isLoaded,
120
- }
121
- ) }
116
+ className={ clsx( 'wp-block-legacy-widget__edit-preview', {
117
+ 'is-offscreen': ! isVisible || ! isLoaded,
118
+ } ) }
122
119
  >
123
120
  <Disabled>
124
121
  { /*
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the 'core/legacy-widget' block.
10
10
  *
11
+ * @since 5.8.0
12
+ *
11
13
  * @global int $wp_widget_factory.
12
14
  *
13
15
  * @param array $attributes The block attributes.
@@ -56,6 +58,8 @@ function render_block_core_legacy_widget( $attributes ) {
56
58
 
57
59
  /**
58
60
  * Registers the 'core/legacy-widget' block.
61
+ *
62
+ * @since 5.8.0
59
63
  */
60
64
  function register_block_core_legacy_widget() {
61
65
  register_block_type_from_metadata(
@@ -72,6 +76,8 @@ add_action( 'init', 'register_block_core_legacy_widget' );
72
76
  * Intercepts any request with legacy-widget-preview in the query param and, if
73
77
  * set, renders a page containing a preview of the requested Legacy Widget
74
78
  * block.
79
+ *
80
+ * @since 5.8.0
75
81
  */
76
82
  function handle_legacy_widget_preview_iframe() {
77
83
  if ( empty( $_GET['legacy-widget-preview'] ) ) {
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the 'core/widget-group' block.
10
10
  *
11
+ * @since 5.9.0
12
+ *
11
13
  * @global array $wp_registered_sidebars
12
14
  * @global int|string $_sidebar_being_rendered
13
15
  *
@@ -45,6 +47,8 @@ function render_block_core_widget_group( $attributes, $content, $block ) {
45
47
 
46
48
  /**
47
49
  * Registers the 'core/widget-group' block.
50
+ *
51
+ * @since 5.9.0
48
52
  */
49
53
  function register_block_core_widget_group() {
50
54
  register_block_type_from_metadata(
@@ -62,6 +66,8 @@ add_action( 'init', 'register_block_core_widget_group' );
62
66
  * it. This lets us get to the current sidebar in
63
67
  * render_block_core_widget_group().
64
68
  *
69
+ * @since 5.9.0
70
+ *
65
71
  * @global int|string $_sidebar_being_rendered
66
72
  *
67
73
  * @param int|string $index Index, name, or ID of the dynamic sidebar.
@@ -76,6 +82,8 @@ add_action( 'dynamic_sidebar_before', 'note_sidebar_being_rendered' );
76
82
  * Clear whatever we set in note_sidebar_being_rendered() after WordPress
77
83
  * finishes rendering a sidebar.
78
84
  *
85
+ * @since 5.9.0
86
+ *
79
87
  * @global int|string $_sidebar_being_rendered
80
88
  */
81
89
  function discard_sidebar_being_rendered() {