@wordpress/list-reusable-blocks 5.8.3 → 5.9.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.9.0 (2024-10-03)
6
+
5
7
  ## 5.8.0 (2024-09-19)
6
8
 
7
9
  ## 5.7.0 (2024-09-05)
@@ -29,10 +29,9 @@ function ImportDropdown({
29
29
  renderToggle: ({
30
30
  isOpen,
31
31
  onToggle
32
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
33
- // TODO: Switch to `true` (40px size) if possible
34
- , {
35
- __next40pxDefaultSize: false,
32
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
33
+ size: "compact",
34
+ className: "list-reusable-blocks-import-dropdown__button",
36
35
  "aria-expanded": isOpen,
37
36
  onClick: onToggle,
38
37
  variant: "primary",
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_i18n","_components","_importForm","_interopRequireDefault","_jsxRuntime","ImportDropdown","onUpload","jsx","Dropdown","popoverProps","placement","contentClassName","renderToggle","isOpen","onToggle","Button","__next40pxDefaultSize","onClick","variant","children","__","renderContent","onClose","default","pipe","_default","exports"],"sources":["@wordpress/list-reusable-blocks/src/components/import-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { pipe } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ImportForm from '../import-form';\n\nfunction ImportDropdown( { onUpload } ) {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tcontentClassName=\"list-reusable-blocks-import-dropdown__content\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Import from JSON' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<ImportForm onUpload={ pipe( onClose, onUpload ) } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default ImportDropdown;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAwC,IAAAK,WAAA,GAAAL,OAAA;AAVxC;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASM,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvC,oBACC,IAAAF,WAAA,CAAAG,GAAA,EAACN,WAAA,CAAAO,QAAQ;IACRC,YAAY,EAAG;MAAEC,SAAS,EAAE;IAAe,CAAG;IAC9CC,gBAAgB,EAAC,+CAA+C;IAChEC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,kBACpC,IAAAV,WAAA,CAAAG,GAAA,EAACN,WAAA,CAAAc;IACA;IAAA;MACAC,qBAAqB,EAAG,KAAO;MAC/B,iBAAgBH,MAAQ;MACxBI,OAAO,EAAGH,QAAU;MACpBI,OAAO,EAAC,SAAS;MAAAC,QAAA,EAEf,IAAAC,QAAE,EAAE,kBAAmB;IAAC,CACnB,CACN;IACHC,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,kBAC5B,IAAAlB,WAAA,CAAAG,GAAA,EAACL,WAAA,CAAAqB,OAAU;MAACjB,QAAQ,EAAG,IAAAkB,aAAI,EAAEF,OAAO,EAAEhB,QAAS;IAAG,CAAE;EAClD,CACH,CAAC;AAEJ;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEclB,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_i18n","_components","_importForm","_interopRequireDefault","_jsxRuntime","ImportDropdown","onUpload","jsx","Dropdown","popoverProps","placement","contentClassName","renderToggle","isOpen","onToggle","Button","size","className","onClick","variant","children","__","renderContent","onClose","default","pipe","_default","exports"],"sources":["@wordpress/list-reusable-blocks/src/components/import-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { pipe } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ImportForm from '../import-form';\n\nfunction ImportDropdown( { onUpload } ) {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tcontentClassName=\"list-reusable-blocks-import-dropdown__content\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tclassName=\"list-reusable-blocks-import-dropdown__button\"\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Import from JSON' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<ImportForm onUpload={ pipe( onClose, onUpload ) } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default ImportDropdown;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAwC,IAAAK,WAAA,GAAAL,OAAA;AAVxC;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASM,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvC,oBACC,IAAAF,WAAA,CAAAG,GAAA,EAACN,WAAA,CAAAO,QAAQ;IACRC,YAAY,EAAG;MAAEC,SAAS,EAAE;IAAe,CAAG;IAC9CC,gBAAgB,EAAC,+CAA+C;IAChEC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,kBACpC,IAAAV,WAAA,CAAAG,GAAA,EAACN,WAAA,CAAAc,MAAM;MACNC,IAAI,EAAC,SAAS;MACdC,SAAS,EAAC,8CAA8C;MACxD,iBAAgBJ,MAAQ;MACxBK,OAAO,EAAGJ,QAAU;MACpBK,OAAO,EAAC,SAAS;MAAAC,QAAA,EAEf,IAAAC,QAAE,EAAE,kBAAmB;IAAC,CACnB,CACN;IACHC,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,kBAC5B,IAAAnB,WAAA,CAAAG,GAAA,EAACL,WAAA,CAAAsB,OAAU;MAAClB,QAAQ,EAAG,IAAAmB,aAAI,EAAEF,OAAO,EAAEjB,QAAS;IAAG,CAAE;EAClD,CACH,CAAC;AAEJ;AAAC,IAAAoB,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEcnB,cAAc","ignoreList":[]}
@@ -84,10 +84,8 @@ function ImportForm({
84
84
  id: inputId,
85
85
  type: "file",
86
86
  onChange: onChangeFile
87
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
88
- // TODO: Switch to `true` (40px size) if possible
89
- , {
90
- __next40pxDefaultSize: false,
87
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
88
+ __next40pxDefaultSize: true,
91
89
  type: "submit",
92
90
  isBusy: isLoading,
93
91
  accessibleWhenDisabled: true,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_compose","_i18n","_components","_import","_interopRequireDefault","_jsxRuntime","ImportForm","instanceId","onUpload","inputId","formRef","useRef","isLoading","setIsLoading","useState","error","setError","file","setFile","onChangeFile","event","target","files","onSubmit","preventDefault","importReusableBlock","then","reusableBlock","catch","errors","uiMessage","message","__","onDismissError","jsxs","className","ref","children","jsx","Notice","status","onRemove","htmlFor","id","type","onChange","Button","__next40pxDefaultSize","isBusy","accessibleWhenDisabled","disabled","variant","_x","_default","exports","default","withInstanceId"],"sources":["@wordpress/list-reusable-blocks/src/components/import-form/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport { withInstanceId } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, Notice } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport importReusableBlock from '../../utils/import';\n\nfunction ImportForm( { instanceId, onUpload } ) {\n\tconst inputId = 'list-reusable-blocks-import-form-' + instanceId;\n\n\tconst formRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst [ error, setError ] = useState( null );\n\tconst [ file, setFile ] = useState( null );\n\n\tconst onChangeFile = ( event ) => {\n\t\tsetFile( event.target.files[ 0 ] );\n\t\tsetError( null );\n\t};\n\n\tconst onSubmit = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( ! file ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsLoading( { isLoading: true } );\n\t\timportReusableBlock( file )\n\t\t\t.then( ( reusableBlock ) => {\n\t\t\t\tif ( ! formRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetIsLoading( false );\n\t\t\t\tonUpload( reusableBlock );\n\t\t\t} )\n\t\t\t.catch( ( errors ) => {\n\t\t\t\tif ( ! formRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet uiMessage;\n\t\t\t\tswitch ( errors.message ) {\n\t\t\t\t\tcase 'Invalid JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Invalid pattern JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid pattern JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tuiMessage = __( 'Unknown error' );\n\t\t\t\t}\n\n\t\t\t\tsetIsLoading( false );\n\t\t\t\tsetError( uiMessage );\n\t\t\t} );\n\t};\n\n\tconst onDismissError = () => {\n\t\tsetError( null );\n\t};\n\n\treturn (\n\t\t<form\n\t\t\tclassName=\"list-reusable-blocks-import-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t\tref={ formRef }\n\t\t>\n\t\t\t{ error && (\n\t\t\t\t<Notice status=\"error\" onRemove={ () => onDismissError() }>\n\t\t\t\t\t{ error }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t<label\n\t\t\t\thtmlFor={ inputId }\n\t\t\t\tclassName=\"list-reusable-blocks-import-form__label\"\n\t\t\t>\n\t\t\t\t{ __( 'File' ) }\n\t\t\t</label>\n\t\t\t<input id={ inputId } type=\"file\" onChange={ onChangeFile } />\n\t\t\t<Button\n\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\ttype=\"submit\"\n\t\t\t\tisBusy={ isLoading }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ ! file || isLoading }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tclassName=\"list-reusable-blocks-import-form__button\"\n\t\t\t>\n\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t</Button>\n\t\t</form>\n\t);\n}\n\nexport default withInstanceId( ImportForm );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAqD,IAAAM,WAAA,GAAAN,OAAA;AAXrD;AACA;AACA;;AAMA;AACA;AACA;;AAGA,SAASO,UAAUA,CA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,OAAA,GAEc,IAAAC,uBAAc,EAAElD,UAAW,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_compose","_i18n","_components","_import","_interopRequireDefault","_jsxRuntime","ImportForm","instanceId","onUpload","inputId","formRef","useRef","isLoading","setIsLoading","useState","error","setError","file","setFile","onChangeFile","event","target","files","onSubmit","preventDefault","importReusableBlock","then","reusableBlock","catch","errors","uiMessage","message","__","onDismissError","jsxs","className","ref","children","jsx","Notice","status","onRemove","htmlFor","id","type","onChange","Button","__next40pxDefaultSize","isBusy","accessibleWhenDisabled","disabled","variant","_x","_default","exports","default","withInstanceId"],"sources":["@wordpress/list-reusable-blocks/src/components/import-form/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport { withInstanceId } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, Notice } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport importReusableBlock from '../../utils/import';\n\nfunction ImportForm( { instanceId, onUpload } ) {\n\tconst inputId = 'list-reusable-blocks-import-form-' + instanceId;\n\n\tconst formRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst [ error, setError ] = useState( null );\n\tconst [ file, setFile ] = useState( null );\n\n\tconst onChangeFile = ( event ) => {\n\t\tsetFile( event.target.files[ 0 ] );\n\t\tsetError( null );\n\t};\n\n\tconst onSubmit = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( ! file ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsLoading( { isLoading: true } );\n\t\timportReusableBlock( file )\n\t\t\t.then( ( reusableBlock ) => {\n\t\t\t\tif ( ! formRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetIsLoading( false );\n\t\t\t\tonUpload( reusableBlock );\n\t\t\t} )\n\t\t\t.catch( ( errors ) => {\n\t\t\t\tif ( ! formRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet uiMessage;\n\t\t\t\tswitch ( errors.message ) {\n\t\t\t\t\tcase 'Invalid JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Invalid pattern JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid pattern JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tuiMessage = __( 'Unknown error' );\n\t\t\t\t}\n\n\t\t\t\tsetIsLoading( false );\n\t\t\t\tsetError( uiMessage );\n\t\t\t} );\n\t};\n\n\tconst onDismissError = () => {\n\t\tsetError( null );\n\t};\n\n\treturn (\n\t\t<form\n\t\t\tclassName=\"list-reusable-blocks-import-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t\tref={ formRef }\n\t\t>\n\t\t\t{ error && (\n\t\t\t\t<Notice status=\"error\" onRemove={ () => onDismissError() }>\n\t\t\t\t\t{ error }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t<label\n\t\t\t\thtmlFor={ inputId }\n\t\t\t\tclassName=\"list-reusable-blocks-import-form__label\"\n\t\t\t>\n\t\t\t\t{ __( 'File' ) }\n\t\t\t</label>\n\t\t\t<input id={ inputId } type=\"file\" onChange={ onChangeFile } />\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\ttype=\"submit\"\n\t\t\t\tisBusy={ isLoading }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ ! file || isLoading }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tclassName=\"list-reusable-blocks-import-form__button\"\n\t\t\t>\n\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t</Button>\n\t\t</form>\n\t);\n}\n\nexport default withInstanceId( ImportForm );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,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;MAAAE,QAAA,EAElD,IAAAe,QAAE,EAAE,QAAQ,EAAE,cAAe;IAAC,CACzB,CAAC;EAAA,CACJ,CAAC;AAET;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,uBAAc,EAAElD,UAAW,CAAC","ignoreList":[]}
@@ -21,10 +21,9 @@ function ImportDropdown({
21
21
  renderToggle: ({
22
22
  isOpen,
23
23
  onToggle
24
- }) => /*#__PURE__*/_jsx(Button
25
- // TODO: Switch to `true` (40px size) if possible
26
- , {
27
- __next40pxDefaultSize: false,
24
+ }) => /*#__PURE__*/_jsx(Button, {
25
+ size: "compact",
26
+ className: "list-reusable-blocks-import-dropdown__button",
28
27
  "aria-expanded": isOpen,
29
28
  onClick: onToggle,
30
29
  variant: "primary",
@@ -1 +1 @@
1
- {"version":3,"names":["pipe","__","Dropdown","Button","ImportForm","jsx","_jsx","ImportDropdown","onUpload","popoverProps","placement","contentClassName","renderToggle","isOpen","onToggle","__next40pxDefaultSize","onClick","variant","children","renderContent","onClose"],"sources":["@wordpress/list-reusable-blocks/src/components/import-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { pipe } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ImportForm from '../import-form';\n\nfunction ImportDropdown( { onUpload } ) {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tcontentClassName=\"list-reusable-blocks-import-dropdown__content\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Import from JSON' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<ImportForm onUpload={ pipe( onClose, onUpload ) } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default ImportDropdown;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,oBAAoB;AACzC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;;AAExD;AACA;AACA;AACA,OAAOC,UAAU,MAAM,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExC,SAASC,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvC,oBACCF,IAAA,CAACJ,QAAQ;IACRO,YAAY,EAAG;MAAEC,SAAS,EAAE;IAAe,CAAG;IAC9CC,gBAAgB,EAAC,+CAA+C;IAChEC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,kBACpCR,IAAA,CAACH;IACA;IAAA;MACAY,qBAAqB,EAAG,KAAO;MAC/B,iBAAgBF,MAAQ;MACxBG,OAAO,EAAGF,QAAU;MACpBG,OAAO,EAAC,SAAS;MAAAC,QAAA,EAEfjB,EAAE,CAAE,kBAAmB;IAAC,CACnB,CACN;IACHkB,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,kBAC5Bd,IAAA,CAACF,UAAU;MAACI,QAAQ,EAAGR,IAAI,CAAEoB,OAAO,EAAEZ,QAAS;IAAG,CAAE;EAClD,CACH,CAAC;AAEJ;AAEA,eAAeD,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["pipe","__","Dropdown","Button","ImportForm","jsx","_jsx","ImportDropdown","onUpload","popoverProps","placement","contentClassName","renderToggle","isOpen","onToggle","size","className","onClick","variant","children","renderContent","onClose"],"sources":["@wordpress/list-reusable-blocks/src/components/import-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { pipe } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ImportForm from '../import-form';\n\nfunction ImportDropdown( { onUpload } ) {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tcontentClassName=\"list-reusable-blocks-import-dropdown__content\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tclassName=\"list-reusable-blocks-import-dropdown__button\"\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Import from JSON' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<ImportForm onUpload={ pipe( onClose, onUpload ) } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default ImportDropdown;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,oBAAoB;AACzC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;;AAExD;AACA;AACA;AACA,OAAOC,UAAU,MAAM,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExC,SAASC,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvC,oBACCF,IAAA,CAACJ,QAAQ;IACRO,YAAY,EAAG;MAAEC,SAAS,EAAE;IAAe,CAAG;IAC9CC,gBAAgB,EAAC,+CAA+C;IAChEC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,kBACpCR,IAAA,CAACH,MAAM;MACNY,IAAI,EAAC,SAAS;MACdC,SAAS,EAAC,8CAA8C;MACxD,iBAAgBH,MAAQ;MACxBI,OAAO,EAAGH,QAAU;MACpBI,OAAO,EAAC,SAAS;MAAAC,QAAA,EAEflB,EAAE,CAAE,kBAAmB;IAAC,CACnB,CACN;IACHmB,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,kBAC5Bf,IAAA,CAACF,UAAU;MAACI,QAAQ,EAAGR,IAAI,CAAEqB,OAAO,EAAEb,QAAS;IAAG,CAAE;EAClD,CACH,CAAC;AAEJ;AAEA,eAAeD,cAAc","ignoreList":[]}
@@ -77,10 +77,8 @@ function ImportForm({
77
77
  id: inputId,
78
78
  type: "file",
79
79
  onChange: onChangeFile
80
- }), /*#__PURE__*/_jsx(Button
81
- // TODO: Switch to `true` (40px size) if possible
82
- , {
83
- __next40pxDefaultSize: false,
80
+ }), /*#__PURE__*/_jsx(Button, {
81
+ __next40pxDefaultSize: true,
84
82
  type: "submit",
85
83
  isBusy: isLoading,
86
84
  accessibleWhenDisabled: true,
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useRef","withInstanceId","__","_x","Button","Notice","importReusableBlock","jsx","_jsx","jsxs","_jsxs","ImportForm","instanceId","onUpload","inputId","formRef","isLoading","setIsLoading","error","setError","file","setFile","onChangeFile","event","target","files","onSubmit","preventDefault","then","reusableBlock","catch","errors","uiMessage","message","onDismissError","className","ref","children","status","onRemove","htmlFor","id","type","onChange","__next40pxDefaultSize","isBusy","accessibleWhenDisabled","disabled","variant"],"sources":["@wordpress/list-reusable-blocks/src/components/import-form/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport { withInstanceId } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, Notice } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport importReusableBlock from '../../utils/import';\n\nfunction ImportForm( { instanceId, onUpload } ) {\n\tconst inputId = 'list-reusable-blocks-import-form-' + instanceId;\n\n\tconst formRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst [ error, setError ] = useState( null );\n\tconst [ file, setFile ] = useState( null );\n\n\tconst onChangeFile = ( event ) => {\n\t\tsetFile( event.target.files[ 0 ] );\n\t\tsetError( null );\n\t};\n\n\tconst onSubmit = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( ! file ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsLoading( { isLoading: true } );\n\t\timportReusableBlock( file )\n\t\t\t.then( ( reusableBlock ) => {\n\t\t\t\tif ( ! formRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetIsLoading( false );\n\t\t\t\tonUpload( reusableBlock );\n\t\t\t} )\n\t\t\t.catch( ( errors ) => {\n\t\t\t\tif ( ! formRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet uiMessage;\n\t\t\t\tswitch ( errors.message ) {\n\t\t\t\t\tcase 'Invalid JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Invalid pattern JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid pattern JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tuiMessage = __( 'Unknown error' );\n\t\t\t\t}\n\n\t\t\t\tsetIsLoading( false );\n\t\t\t\tsetError( uiMessage );\n\t\t\t} );\n\t};\n\n\tconst onDismissError = () => {\n\t\tsetError( null );\n\t};\n\n\treturn (\n\t\t<form\n\t\t\tclassName=\"list-reusable-blocks-import-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t\tref={ formRef }\n\t\t>\n\t\t\t{ error && (\n\t\t\t\t<Notice status=\"error\" onRemove={ () => onDismissError() }>\n\t\t\t\t\t{ error }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t<label\n\t\t\t\thtmlFor={ inputId }\n\t\t\t\tclassName=\"list-reusable-blocks-import-form__label\"\n\t\t\t>\n\t\t\t\t{ __( 'File' ) }\n\t\t\t</label>\n\t\t\t<input id={ inputId } type=\"file\" onChange={ onChangeFile } />\n\t\t\t<Button\n\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\ttype=\"submit\"\n\t\t\t\tisBusy={ isLoading }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ ! file || isLoading }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tclassName=\"list-reusable-blocks-import-form__button\"\n\t\t\t>\n\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t</Button>\n\t\t</form>\n\t);\n}\n\nexport default withInstanceId( ImportForm );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;;AAEtD;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAErD,SAASC,UAAUA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EAC/C,MAAMC,OAAO,GAAG,mCAAmC,GAAGF,UAAU;EAEhE,MAAMG,OAAO,GAAGf,MAAM,CAAC,CAAC;EACxB,MAAM,CAAEgB,SAAS,EAAEC,YAAY,CAAE,GAAGlB,QAAQ,CAAE,KAAM,CAAC;EACrD,MAAM,CAAEmB,KAAK,EAAEC,QAAQ,CAAE,GAAGpB,QAAQ,CAAE,IAAK,CAAC;EAC5C,MAAM,CAAEqB,IAAI,EAAEC,OAAO,CAAE,GAAGtB,QAAQ,CAAE,IAAK,CAAC;EAE1C,MAAMuB,YAAY,GAAKC,KAAK,IAAM;IACjCF,OAAO,CAAEE,KAAK,CAACC,MAAM,CAACC,KAAK,CAAE,CAAC,CAAG,CAAC;IAClCN,QAAQ,CAAE,IAAK,CAAC;EACjB,CAAC;EAED,MAA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,EAAE,CAAE,MAAO;IAAC,CACR,CAAC,eACRM,IAAA;MAAOiC,EAAE,EAAG3B,OAAS;MAAC4B,IAAI,EAAC,MAAM;MAACC,QAAQ,EAAGrB;IAAc,CAAE,CAAC,eAC9Dd,IAAA,CAACJ;IACA;IAAA;MACAwC,qBAAqB,EAAG,KAAO;MAC/BF,IAAI,EAAC,QAAQ;MACbG,MAAM,EAAG7B,SAAW;MACpB8B,sBAAsB;MACtBC,QAAQ,EAAG,CAAE3B,IAAI,IAAIJ,SAAW;MAChCgC,OAAO,EAAC,WAAW;MACnBb,SAAS,EAAC,0CAA0C;MAAAE,QAAA,EAElDlC,EAAE,CAAE,QAAQ,EAAE,cAAe;IAAC,CACzB,CAAC;EAAA,CACJ,CAAC;AAET;AAEA,eAAeF,cAAc,CAAEU,UAAW,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useState","useRef","withInstanceId","__","_x","Button","Notice","importReusableBlock","jsx","_jsx","jsxs","_jsxs","ImportForm","instanceId","onUpload","inputId","formRef","isLoading","setIsLoading","error","setError","file","setFile","onChangeFile","event","target","files","onSubmit","preventDefault","then","reusableBlock","catch","errors","uiMessage","message","onDismissError","className","ref","children","status","onRemove","htmlFor","id","type","onChange","__next40pxDefaultSize","isBusy","accessibleWhenDisabled","disabled","variant"],"sources":["@wordpress/list-reusable-blocks/src/components/import-form/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport { withInstanceId } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, Notice } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport importReusableBlock from '../../utils/import';\n\nfunction ImportForm( { instanceId, onUpload } ) {\n\tconst inputId = 'list-reusable-blocks-import-form-' + instanceId;\n\n\tconst formRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst [ error, setError ] = useState( null );\n\tconst [ file, setFile ] = useState( null );\n\n\tconst onChangeFile = ( event ) => {\n\t\tsetFile( event.target.files[ 0 ] );\n\t\tsetError( null );\n\t};\n\n\tconst onSubmit = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( ! file ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsLoading( { isLoading: true } );\n\t\timportReusableBlock( file )\n\t\t\t.then( ( reusableBlock ) => {\n\t\t\t\tif ( ! formRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetIsLoading( false );\n\t\t\t\tonUpload( reusableBlock );\n\t\t\t} )\n\t\t\t.catch( ( errors ) => {\n\t\t\t\tif ( ! formRef ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet uiMessage;\n\t\t\t\tswitch ( errors.message ) {\n\t\t\t\t\tcase 'Invalid JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Invalid pattern JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid pattern JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tuiMessage = __( 'Unknown error' );\n\t\t\t\t}\n\n\t\t\t\tsetIsLoading( false );\n\t\t\t\tsetError( uiMessage );\n\t\t\t} );\n\t};\n\n\tconst onDismissError = () => {\n\t\tsetError( null );\n\t};\n\n\treturn (\n\t\t<form\n\t\t\tclassName=\"list-reusable-blocks-import-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t\tref={ formRef }\n\t\t>\n\t\t\t{ error && (\n\t\t\t\t<Notice status=\"error\" onRemove={ () => onDismissError() }>\n\t\t\t\t\t{ error }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t<label\n\t\t\t\thtmlFor={ inputId }\n\t\t\t\tclassName=\"list-reusable-blocks-import-form__label\"\n\t\t\t>\n\t\t\t\t{ __( 'File' ) }\n\t\t\t</label>\n\t\t\t<input id={ inputId } type=\"file\" onChange={ onChangeFile } />\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\ttype=\"submit\"\n\t\t\t\tisBusy={ isLoading }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ ! file || isLoading }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tclassName=\"list-reusable-blocks-import-form__button\"\n\t\t\t>\n\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t</Button>\n\t\t</form>\n\t);\n}\n\nexport default withInstanceId( ImportForm );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;;AAEtD;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAErD,SAASC,UAAUA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EAC/C,MAAMC,OAAO,GAAG,mCAAmC,GAAGF,UAAU;EAEhE,MAAMG,OAAO,GAAGf,MAAM,CAAC,CAAC;EACxB,MAAM,CAAEgB,SAAS,EAAEC,YAAY,CAAE,GAAGlB,QAAQ,CAAE,KAAM,CAAC;EACrD,MAAM,CAAEmB,KAAK,EAAEC,QAAQ,CAAE,GAAGpB,QAAQ,CAAE,IAAK,CAAC;EAC5C,MAAM,CAAEqB,IAAI,EAAEC,OAAO,CAAE,GAAGtB,QAAQ,CAAE,IAAK,CAAC;EAE1C,MAAMuB,YAAY,GAAKC,KAAK,IAAM;IACjCF,OAAO,CAAEE,KAAK,CAACC,MAAM,CAACC,KAAK,CAAE,CAAC,CAAG,CAAC;IAClCN,QAAQ,CAAE,IAAK,CAAC;EACjB,CAAC;EAED,MAAMO,QAAQ,GAAKH,KAAK,IAAM;IAC7BA,KAAK,CAACI,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AOiC,EAAE,EAAG3B,OAAS;MAAC4B,IAAI,EAAC,MAAM;MAACC,QAAQ,EAAGrB;IAAc,CAAE,CAAC,eAC9Dd,IAAA,CAACJ,MAAM;MACNwC,qBAAqB;MACrBF,IAAI,EAAC,QAAQ;MACbG,MAAM,EAAG7B,SAAW;MACpB8B,sBAAsB;MACtBC,QAAQ,EAAG,CAAE3B,IAAI,IAAIJ,SAAW;MAChCgC,OAAO,EAAC,WAAW;MACnBb,SAAS,EAAC,0CAA0C;MAAAE,QAAA,EAElDlC,EAAE,CAAE,QAAQ,EAAE,cAAe;IAAC,CACzB,CAAC;EAAA,CACJ,CAAC;AAET;AAEA,eAAeF,cAAc,CAAEU,UAAW,CAAC","ignoreList":[]}
@@ -29,6 +29,9 @@
29
29
  /**
30
30
  * Fonts & basic variables.
31
31
  */
32
+ /**
33
+ * Typography
34
+ */
32
35
  /**
33
36
  * Grid System.
34
37
  * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
@@ -43,7 +46,10 @@
43
46
  * Dimensions.
44
47
  */
45
48
  /**
46
- * Editor widths.
49
+ * Mobile specific styles
50
+ */
51
+ /**
52
+ * Editor styles.
47
53
  */
48
54
  /**
49
55
  * Block & Editor UI.
@@ -67,6 +73,9 @@
67
73
  * Creates a fading overlay to signify that the content is longer
68
74
  * than the space allows.
69
75
  */
76
+ /**
77
+ * Typography
78
+ */
70
79
  /**
71
80
  * Breakpoint mixins
72
81
  */
@@ -111,6 +120,10 @@
111
120
  padding: 10px;
112
121
  }
113
122
 
123
+ [class].list-reusable-blocks-import-dropdown__button {
124
+ height: 30px;
125
+ }
126
+
114
127
  .list-reusable-blocks-import-form__label {
115
128
  display: block;
116
129
  margin-bottom: 10px;
@@ -118,7 +131,6 @@
118
131
 
119
132
  .list-reusable-blocks-import-form__button {
120
133
  margin-top: 10px;
121
- margin-bottom: 10px;
122
134
  float: left;
123
135
  }
124
136
 
@@ -136,9 +148,6 @@
136
148
  position: relative;
137
149
  top: -3px;
138
150
  }
139
- .list-reusable-blocks__container .components-button {
140
- height: 26px;
141
- }
142
151
 
143
152
  body.admin-color-light {
144
153
  --wp-admin-theme-color: #0085ba;
@@ -29,6 +29,9 @@
29
29
  /**
30
30
  * Fonts & basic variables.
31
31
  */
32
+ /**
33
+ * Typography
34
+ */
32
35
  /**
33
36
  * Grid System.
34
37
  * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
@@ -43,7 +46,10 @@
43
46
  * Dimensions.
44
47
  */
45
48
  /**
46
- * Editor widths.
49
+ * Mobile specific styles
50
+ */
51
+ /**
52
+ * Editor styles.
47
53
  */
48
54
  /**
49
55
  * Block & Editor UI.
@@ -67,6 +73,9 @@
67
73
  * Creates a fading overlay to signify that the content is longer
68
74
  * than the space allows.
69
75
  */
76
+ /**
77
+ * Typography
78
+ */
70
79
  /**
71
80
  * Breakpoint mixins
72
81
  */
@@ -111,6 +120,10 @@
111
120
  padding: 10px;
112
121
  }
113
122
 
123
+ [class].list-reusable-blocks-import-dropdown__button {
124
+ height: 30px;
125
+ }
126
+
114
127
  .list-reusable-blocks-import-form__label {
115
128
  display: block;
116
129
  margin-bottom: 10px;
@@ -118,7 +131,6 @@
118
131
 
119
132
  .list-reusable-blocks-import-form__button {
120
133
  margin-top: 10px;
121
- margin-bottom: 10px;
122
134
  float: right;
123
135
  }
124
136
 
@@ -136,9 +148,6 @@
136
148
  position: relative;
137
149
  top: -3px;
138
150
  }
139
- .list-reusable-blocks__container .components-button {
140
- height: 26px;
141
- }
142
151
 
143
152
  body.admin-color-light {
144
153
  --wp-admin-theme-color: #0085ba;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/list-reusable-blocks",
3
- "version": "5.8.3",
3
+ "version": "5.9.0",
4
4
  "description": "Adding Export/Import support to the reusable blocks listing.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,12 +27,12 @@
27
27
  "module": "build-module/index.js",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/api-fetch": "^7.8.2",
31
- "@wordpress/blob": "^4.8.1",
32
- "@wordpress/components": "^28.8.3",
33
- "@wordpress/compose": "^7.8.3",
34
- "@wordpress/element": "^6.8.1",
35
- "@wordpress/i18n": "^5.8.2",
30
+ "@wordpress/api-fetch": "^7.9.0",
31
+ "@wordpress/blob": "^4.9.0",
32
+ "@wordpress/components": "^28.9.0",
33
+ "@wordpress/compose": "^7.9.0",
34
+ "@wordpress/element": "^6.9.0",
35
+ "@wordpress/i18n": "^5.9.0",
36
36
  "change-case": "^4.1.2"
37
37
  },
38
38
  "peerDependencies": {
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "6187079697e13c3292eb098d6338523a6676c6e8"
45
+ "gitHead": "2e5495c635910cb34bfaca3c6258d2e989f66214"
46
46
  }
@@ -17,8 +17,8 @@ function ImportDropdown( { onUpload } ) {
17
17
  contentClassName="list-reusable-blocks-import-dropdown__content"
18
18
  renderToggle={ ( { isOpen, onToggle } ) => (
19
19
  <Button
20
- // TODO: Switch to `true` (40px size) if possible
21
- __next40pxDefaultSize={ false }
20
+ size="compact"
21
+ className="list-reusable-blocks-import-dropdown__button"
22
22
  aria-expanded={ isOpen }
23
23
  onClick={ onToggle }
24
24
  variant="primary"
@@ -1,3 +1,8 @@
1
1
  .list-reusable-blocks-import-dropdown__content .components-popover__content {
2
2
  padding: 10px;
3
3
  }
4
+
5
+ [class].list-reusable-blocks-import-dropdown__button {
6
+ // Todo: Make core button height and gutenberg button height equal.
7
+ height: 30px;
8
+ }
@@ -84,8 +84,7 @@ function ImportForm( { instanceId, onUpload } ) {
84
84
  </label>
85
85
  <input id={ inputId } type="file" onChange={ onChangeFile } />
86
86
  <Button
87
- // TODO: Switch to `true` (40px size) if possible
88
- __next40pxDefaultSize={ false }
87
+ __next40pxDefaultSize
89
88
  type="submit"
90
89
  isBusy={ isLoading }
91
90
  accessibleWhenDisabled
@@ -5,7 +5,6 @@
5
5
 
6
6
  .list-reusable-blocks-import-form__button {
7
7
  margin-top: 10px;
8
- margin-bottom: 10px;
9
8
  float: right;
10
9
  }
11
10
 
package/src/style.scss CHANGED
@@ -6,10 +6,6 @@
6
6
  align-items: center;
7
7
  position: relative;
8
8
  top: -3px;
9
- // Todo: Make core button height and gutenberg button height equal.
10
- .components-button {
11
- height: 26px;
12
- }
13
9
  }
14
10
 
15
11
  @include wordpress-admin-schemes();