@wordpress/edit-site 4.3.10 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/components/add-new-template/new-template.js +2 -2
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/global-styles/border-panel.js +95 -79
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +3 -3
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/header.js +15 -11
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +4 -4
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +1 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +3 -3
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +13 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +1 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -14
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/list/table.js +1 -1
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +2 -2
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/components/preferences-modal/index.js +5 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/routes/use-title.js +3 -1
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/index.js +11 -3
- package/build/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +2 -2
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +98 -80
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +4 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/header.js +16 -11
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +3 -3
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +2 -2
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +2 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +4 -4
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +15 -5
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +2 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +18 -14
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/list/table.js +1 -1
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +2 -2
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +5 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/routes/use-title.js +2 -1
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/index.js +10 -3
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +25 -34
- package/build-style/style.css +25 -34
- package/package.json +29 -29
- package/src/components/add-new-template/new-template.js +2 -2
- package/src/components/global-styles/border-panel.js +102 -109
- package/src/components/global-styles/context-menu.js +7 -7
- package/src/components/global-styles/header.js +20 -17
- package/src/components/global-styles/navigation-button.js +3 -3
- package/src/components/global-styles/palette.js +3 -3
- package/src/components/global-styles/screen-block-list.js +3 -3
- package/src/components/global-styles/screen-colors.js +7 -7
- package/src/components/global-styles/screen-root.js +34 -24
- package/src/components/global-styles/screen-typography.js +3 -3
- package/src/components/global-styles/test/use-global-styles-output.js +1 -0
- package/src/components/global-styles/use-global-styles-output.js +31 -11
- package/src/components/header/document-actions/style.scss +1 -1
- package/src/components/header/style.scss +14 -29
- package/src/components/list/style.scss +1 -0
- package/src/components/list/table.js +1 -4
- package/src/components/navigation-sidebar/navigation-panel/constants.js +2 -2
- package/src/components/preferences-modal/index.js +8 -1
- package/src/components/routes/use-title.js +3 -2
- package/src/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar/navigation-menu-sidebar/index.js +4 -1
- package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -7
- package/src/components/sidebar/style.scss +7 -0
- package/src/index.js +17 -1
package/CHANGELOG.md
CHANGED
|
@@ -38,10 +38,10 @@ var _store = require("../../store");
|
|
|
38
38
|
/**
|
|
39
39
|
* Internal dependencies
|
|
40
40
|
*/
|
|
41
|
-
const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single
|
|
41
|
+
const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'taxonomy', 'search', '404'];
|
|
42
42
|
const TEMPLATE_ICONS = {
|
|
43
43
|
'front-page': _icons.home,
|
|
44
|
-
|
|
44
|
+
single: _icons.post,
|
|
45
45
|
page: _icons.page,
|
|
46
46
|
archive: _icons.archive,
|
|
47
47
|
search: _icons.search,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","home","post","page","archive","search","notFound","index","list","category","author","postAuthor","taxonomy","blockMeta","date","postDate","tag","attachment","media","NewTemplate","postType","history","templates","defaultTemplateTypes","select","coreStore","getEntityRecords","per_page","editorStore","__experimentalGetDefaultTemplateTypes","saveEntityRecord","createErrorNotice","noticesStore","setTemplate","editSiteStore","createTemplate","slug","title","description","template","excerpt","toString","status","throwOnError","id","push","postId","type","error","errorMessage","message","code","existingTemplateSlugs","missingTemplates","length","sort","template1","template2","indexOf","labels","add_new","add_new_item","noArrow","variant"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AAeA;;AACA;;AAKA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AA4BA;AACA;AACA;AAIA,MAAMA,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","home","single","post","page","archive","search","notFound","index","list","category","author","postAuthor","taxonomy","blockMeta","date","postDate","tag","attachment","media","NewTemplate","postType","history","templates","defaultTemplateTypes","select","coreStore","getEntityRecords","per_page","editorStore","__experimentalGetDefaultTemplateTypes","saveEntityRecord","createErrorNotice","noticesStore","setTemplate","editSiteStore","createTemplate","slug","title","description","template","excerpt","toString","status","throwOnError","id","push","postId","type","error","errorMessage","message","code","existingTemplateSlugs","missingTemplates","length","sort","template1","template2","indexOf","labels","add_new","add_new_item","noArrow","variant"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AAeA;;AACA;;AAKA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AA4BA;AACA;AACA;AAIA,MAAMA,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,QAF8B,EAG9B,MAH8B,EAI9B,OAJ8B,EAK9B,SAL8B,EAM9B,QAN8B,EAO9B,UAP8B,EAQ9B,MAR8B,EAS9B,KAT8B,EAU9B,UAV8B,EAW9B,QAX8B,EAY9B,KAZ8B,CAA/B;AAeA,MAAMC,cAAc,GAAG;AACtB,gBAAcC,WADQ;AAEtBC,EAAAA,MAAM,EAAEC,WAFc;AAGtBC,EAAAA,IAAI,EAAJA,WAHsB;AAItBC,EAAAA,OAAO,EAAPA,cAJsB;AAKtBC,EAAAA,MAAM,EAANA,aALsB;AAMtB,OAAKC,eANiB;AAOtBC,EAAAA,KAAK,EAAEC,WAPe;AAQtBC,EAAAA,QAAQ,EAARA,eARsB;AAStBC,EAAAA,MAAM,EAAEC,iBATc;AAUtBC,EAAAA,QAAQ,EAAEC,gBAVY;AAWtBC,EAAAA,IAAI,EAAEC,eAXgB;AAYtBC,EAAAA,GAAG,EAAHA,UAZsB;AAatBC,EAAAA,UAAU,EAAEC;AAbU,CAAvB;;AAgBe,SAASC,WAAT,OAAqC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAAsC,qBACzCC,MAAF,KAAgB;AACfF,IAAAA,SAAS,EAAEE,MAAM,CAAEC,eAAF,CAAN,CAAoBC,gBAApB,CACV,UADU,EAEV,aAFU,EAGV;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAHU,CADI;AAMfJ,IAAAA,oBAAoB,EAAEC,MAAM,CAC3BI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AEqC,IAAF,CADtB;AAEC,MAAA,YAAY,EAAC,MAFd;AAGC,MAAA,IAAI,EAAGE,WAHR;AAIC,MAAA,GAAG,EAAGF,IAJP;AAKC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,cAAc,CAAE;AAAEC,UAAAA;AAAF,SAAF,CAAd,CADe,CAEf;AACA;AARF,OAUGC,KAVH,CADD;AAAA,GAFC,CADH,CADD,CAbF,CADD;AAsCA","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, find, includes, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport {\n\tarchive,\n\tblockMeta,\n\tcategory,\n\thome,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpost,\n\tpostAuthor,\n\tpostDate,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'taxonomy',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\tsingle: post,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: postAuthor,\n\ttaxonomy: blockMeta,\n\tdate: postDate,\n\ttag,\n\tattachment: media,\n};\n\nexport default function NewTemplate( { postType } ) {\n\tconst history = useHistory();\n\tconst { templates, defaultTemplateTypes } = useSelect(\n\t\t( select ) => ( {\n\t\t\ttemplates: select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t),\n\t\t\tdefaultTemplateTypes: select(\n\t\t\t\teditorStore\n\t\t\t).__experimentalGetDefaultTemplateTypes(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { setTemplate } = useDispatch( editSiteStore );\n\n\tasync function createTemplate( { slug } ) {\n\t\ttry {\n\t\t\tconst { title, description } = find( defaultTemplateTypes, {\n\t\t\t\tslug,\n\t\t\t} );\n\n\t\t\tconst template = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\texcerpt: description,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Set template before navigating away to avoid initial stale value.\n\t\t\tsetTemplate( template.id, template.slug );\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: template.id,\n\t\t\t\tpostType: template.type,\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\n\tconst existingTemplateSlugs = map( templates, 'slug' );\n\n\tconst missingTemplates = filter(\n\t\tdefaultTemplateTypes,\n\t\t( template ) =>\n\t\t\tincludes( DEFAULT_TEMPLATE_SLUGS, template.slug ) &&\n\t\t\t! includes( existingTemplateSlugs, template.slug )\n\t);\n\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tmissingTemplates.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"edit-site-new-template-dropdown\"\n\t\t\ticon={ null }\n\t\t\ttext={ postType.labels.add_new }\n\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\tpopoverProps={ {\n\t\t\t\tnoArrow: false,\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\tvariant: 'primary',\n\t\t\t} }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<NavigableMenu className=\"edit-site-new-template-dropdown__popover\">\n\t\t\t\t\t<MenuGroup label={ postType.labels.add_new_item }>\n\t\t\t\t\t\t{ map(\n\t\t\t\t\t\t\tmissingTemplates,\n\t\t\t\t\t\t\t( { title, description, slug } ) => (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] }\n\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\tinfo={ description }\n\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tcreateTemplate( { slug } );\n\t\t\t\t\t\t\t\t\t\t// We will be navigated way so no need to close the dropdown.\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\t\t{ title }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</NavigableMenu>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
|
|
@@ -23,8 +23,6 @@ var _hooks = require("./hooks");
|
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
|
-
const MIN_BORDER_WIDTH = 0;
|
|
27
|
-
|
|
28
26
|
function useHasBorderPanel(name) {
|
|
29
27
|
const controls = [useHasBorderColorControl(name), useHasBorderRadiusControl(name), useHasBorderStyleControl(name), useHasBorderWidthControl(name)];
|
|
30
28
|
return controls.some(Boolean);
|
|
@@ -50,6 +48,37 @@ function useHasBorderWidthControl(name) {
|
|
|
50
48
|
return (0, _hooks.useSetting)('border.width', name)[0] && supports.includes('borderWidth');
|
|
51
49
|
}
|
|
52
50
|
|
|
51
|
+
function applyFallbackStyle(border) {
|
|
52
|
+
if (!border) {
|
|
53
|
+
return border;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!border.style && (border.color || border.width)) {
|
|
57
|
+
return { ...border,
|
|
58
|
+
style: 'solid'
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return border;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function applyAllFallbackStyles(border) {
|
|
66
|
+
if (!border) {
|
|
67
|
+
return border;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if ((0, _components.__experimentalHasSplitBorders)(border)) {
|
|
71
|
+
return {
|
|
72
|
+
top: applyFallbackStyle(border.top),
|
|
73
|
+
right: applyFallbackStyle(border.right),
|
|
74
|
+
bottom: applyFallbackStyle(border.bottom),
|
|
75
|
+
left: applyFallbackStyle(border.left)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return applyFallbackStyle(border);
|
|
80
|
+
}
|
|
81
|
+
|
|
53
82
|
function BorderPanel(_ref) {
|
|
54
83
|
let {
|
|
55
84
|
name
|
|
@@ -57,46 +86,11 @@ function BorderPanel(_ref) {
|
|
|
57
86
|
// To better reflect if the user has customized a value we need to
|
|
58
87
|
// ensure the style value being checked is from the `user` origin.
|
|
59
88
|
const [userBorderStyles] = (0, _hooks.useStyle)('border', name, 'user');
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const createResetCallback = setStyle => () => setStyle(undefined);
|
|
64
|
-
|
|
65
|
-
const handleOnChange = setStyle => value => {
|
|
66
|
-
setStyle(value || undefined);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const units = (0, _components.__experimentalUseCustomUnits)({
|
|
70
|
-
availableUnits: (0, _hooks.useSetting)('spacing.units')[0] || ['px', 'em', 'rem']
|
|
71
|
-
}); // Border width.
|
|
72
|
-
|
|
73
|
-
const showBorderWidth = useHasBorderWidthControl(name);
|
|
74
|
-
const [borderWidthValue, setBorderWidth] = (0, _hooks.useStyle)('border.width', name); // Border style.
|
|
75
|
-
|
|
76
|
-
const showBorderStyle = useHasBorderStyleControl(name);
|
|
77
|
-
const [borderStyle, setBorderStyle] = (0, _hooks.useStyle)('border.style', name); // When we set a border color or width ensure we have a style so the user
|
|
78
|
-
// can see a visible border.
|
|
79
|
-
|
|
80
|
-
const handleOnChangeWithStyle = setStyle => value => {
|
|
81
|
-
if (!!value && !borderStyle) {
|
|
82
|
-
setBorderStyle('solid');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
setStyle(value || undefined);
|
|
86
|
-
}; // Border color.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
const [border, setBorder] = (0, _hooks.useStyle)('border', name);
|
|
90
|
+
const colors = (0, _hooks.useColorsPerOrigin)(name);
|
|
89
91
|
const showBorderColor = useHasBorderColorControl(name);
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const disableCustomGradients = !(0, _hooks.useSetting)('color.customGradient')[0];
|
|
93
|
-
const borderColorSettings = [{
|
|
94
|
-
label: (0, _i18n.__)('Color'),
|
|
95
|
-
colors: (0, _hooks.useColorsPerOrigin)(name),
|
|
96
|
-
colorValue: borderColor,
|
|
97
|
-
onColorChange: handleOnChangeWithStyle(setBorderColor),
|
|
98
|
-
clearable: false
|
|
99
|
-
}]; // Border radius.
|
|
92
|
+
const showBorderStyle = useHasBorderStyleControl(name);
|
|
93
|
+
const showBorderWidth = useHasBorderWidthControl(name); // Border radius.
|
|
100
94
|
|
|
101
95
|
const showBorderRadius = useHasBorderRadiusControl(name);
|
|
102
96
|
const [borderRadiusValues, setBorderRadius] = (0, _hooks.useStyle)('border.radius', name);
|
|
@@ -111,57 +105,79 @@ function BorderPanel(_ref) {
|
|
|
111
105
|
return !!borderValues;
|
|
112
106
|
};
|
|
113
107
|
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
const resetBorder = () => {
|
|
109
|
+
if (hasBorderRadius()) {
|
|
110
|
+
return setBorder({
|
|
111
|
+
radius: userBorderStyles.radius
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
setBorder(undefined);
|
|
119
116
|
};
|
|
120
117
|
|
|
118
|
+
const resetAll = (0, _element.useCallback)(() => setBorder(undefined), [setBorder]);
|
|
119
|
+
const onBorderChange = (0, _element.useCallback)(newBorder => {
|
|
120
|
+
// Ensure we have a visible border style when a border width or
|
|
121
|
+
// color is being selected.
|
|
122
|
+
const newBorderWithStyle = applyAllFallbackStyles(newBorder); // As we can't conditionally generate styles based on if other
|
|
123
|
+
// style properties have been set we need to force split border
|
|
124
|
+
// definitions for user set border styles. Border radius is derived
|
|
125
|
+
// from the same property i.e. `border.radius` if it is a string
|
|
126
|
+
// that is used. The longhand border radii styles are only generated
|
|
127
|
+
// if that property is an object.
|
|
128
|
+
//
|
|
129
|
+
// For borders (color, style, and width) those are all properties on
|
|
130
|
+
// the `border` style property. This means if the theme.json defined
|
|
131
|
+
// split borders and the user condenses them into a flat border or
|
|
132
|
+
// vice-versa we'd get both sets of styles which would conflict.
|
|
133
|
+
|
|
134
|
+
const updatedBorder = !(0, _components.__experimentalHasSplitBorders)(newBorderWithStyle) ? {
|
|
135
|
+
top: newBorderWithStyle,
|
|
136
|
+
right: newBorderWithStyle,
|
|
137
|
+
bottom: newBorderWithStyle,
|
|
138
|
+
left: newBorderWithStyle
|
|
139
|
+
} : {
|
|
140
|
+
color: null,
|
|
141
|
+
style: null,
|
|
142
|
+
width: null,
|
|
143
|
+
...newBorderWithStyle
|
|
144
|
+
}; // As radius is maintained separately to color, style, and width
|
|
145
|
+
// maintain its value. Undefined values here will be cleaned when
|
|
146
|
+
// global styles are saved.
|
|
147
|
+
|
|
148
|
+
setBorder({
|
|
149
|
+
radius: border === null || border === void 0 ? void 0 : border.radius,
|
|
150
|
+
...updatedBorder
|
|
151
|
+
});
|
|
152
|
+
}, [setBorder]);
|
|
121
153
|
return (0, _element.createElement)(_components.__experimentalToolsPanel, {
|
|
122
154
|
label: (0, _i18n.__)('Border'),
|
|
123
155
|
resetAll: resetAll
|
|
124
|
-
}, showBorderWidth && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
onDeselect: createResetCallback(setBorderWidth),
|
|
129
|
-
isShownByDefault: true
|
|
130
|
-
}, (0, _element.createElement)(_components.__experimentalUnitControl, {
|
|
131
|
-
value: borderWidthValue,
|
|
132
|
-
label: (0, _i18n.__)('Width'),
|
|
133
|
-
min: MIN_BORDER_WIDTH,
|
|
134
|
-
onChange: handleOnChangeWithStyle(setBorderWidth),
|
|
135
|
-
units: units
|
|
136
|
-
})), showBorderStyle && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
137
|
-
className: "single-column",
|
|
138
|
-
hasValue: createHasValueCallback('style'),
|
|
139
|
-
label: (0, _i18n.__)('Style'),
|
|
140
|
-
onDeselect: createResetCallback(setBorderStyle),
|
|
141
|
-
isShownByDefault: true
|
|
142
|
-
}, (0, _element.createElement)(_blockEditor.__experimentalBorderStyleControl, {
|
|
143
|
-
value: borderStyle,
|
|
144
|
-
onChange: handleOnChange(setBorderStyle)
|
|
145
|
-
})), showBorderColor && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
146
|
-
hasValue: createHasValueCallback('color'),
|
|
147
|
-
label: (0, _i18n.__)('Color'),
|
|
148
|
-
onDeselect: createResetCallback(setBorderColor),
|
|
156
|
+
}, (showBorderWidth || showBorderColor) && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
157
|
+
hasValue: () => (0, _components.__experimentalIsDefinedBorder)(userBorderStyles),
|
|
158
|
+
label: (0, _i18n.__)('Border'),
|
|
159
|
+
onDeselect: () => resetBorder(),
|
|
149
160
|
isShownByDefault: true
|
|
150
|
-
}, (0, _element.createElement)(
|
|
151
|
-
|
|
152
|
-
__experimentalIsRenderedInSidebar: true,
|
|
153
|
-
disableCustomColors: disableCustomColors,
|
|
154
|
-
disableCustomGradients: disableCustomGradients,
|
|
161
|
+
}, (0, _element.createElement)(_components.__experimentalBorderBoxControl, {
|
|
162
|
+
colors: colors,
|
|
155
163
|
enableAlpha: true,
|
|
156
|
-
|
|
164
|
+
onChange: onBorderChange,
|
|
165
|
+
showStyle: showBorderStyle,
|
|
166
|
+
value: border,
|
|
167
|
+
popoverPlacement: "left-start",
|
|
168
|
+
popoverOffset: 40,
|
|
169
|
+
__experimentalHasMultipleOrigins: true,
|
|
170
|
+
__experimentalIsRenderedInSidebar: true
|
|
157
171
|
})), showBorderRadius && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
158
172
|
hasValue: hasBorderRadius,
|
|
159
173
|
label: (0, _i18n.__)('Radius'),
|
|
160
|
-
onDeselect:
|
|
174
|
+
onDeselect: () => setBorderRadius(undefined),
|
|
161
175
|
isShownByDefault: true
|
|
162
176
|
}, (0, _element.createElement)(_blockEditor.__experimentalBorderRadiusControl, {
|
|
163
177
|
values: borderRadiusValues,
|
|
164
|
-
onChange:
|
|
178
|
+
onChange: value => {
|
|
179
|
+
setBorderRadius(value || undefined);
|
|
180
|
+
}
|
|
165
181
|
})));
|
|
166
182
|
}
|
|
167
183
|
//# sourceMappingURL=border-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["MIN_BORDER_WIDTH","useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","BorderPanel","userBorderStyles","createHasValueCallback","feature","createResetCallback","setStyle","undefined","handleOnChange","value","units","availableUnits","showBorderWidth","borderWidthValue","setBorderWidth","showBorderStyle","borderStyle","setBorderStyle","handleOnChangeWithStyle","showBorderColor","borderColor","setBorderColor","disableCustomColors","disableCustomGradients","borderColorSettings","label","colors","colorValue","onColorChange","clearable","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetAll"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AAMA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAQA,MAAMA,gBAAgB,GAAG,CAAzB;;AAEO,SAASC,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,IAAF,CADR,EAEhBG,yBAAyB,CAAEH,IAAF,CAFT,EAGhBI,wBAAwB,CAAEJ,IAAF,CAHR,EAIhBK,wBAAwB,CAAEL,IAAF,CAJR,CAAjB;AAOA,SAAOC,QAAQ,CAACK,IAAT,CAAeC,OAAf,CAAP;AACA;;AAED,SAASL,wBAAT,CAAmCF,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,cAAZ,EAA4BA,IAA5B,EAAoC,CAApC,KACAQ,QAAQ,CAACC,QAAT,CAAmB,aAAnB,CAFD;AAIA;;AAED,SAASN,yBAAT,CAAoCH,IAApC,EAA2C;AAC1C,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,eAAZ,EAA6BA,IAA7B,E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,IAAA,gBAAgB,EAAG;AALpB,KAOC,4BAAC,6CAAD;AACC,IAAA,KAAK,EAAGD,WADT;AAEC,IAAA,QAAQ,EAAGR,cAAc,CAAES,cAAF;AAF1B,IAPD,CAnBF,EAgCGE,eAAe,IAChB,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAGhB,sBAAsB,CAAE,OAAF,CADlC;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,UAAU,EAAGE,mBAAmB,CAAEgB,cAAF,CAHjC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,wDAAD;AACC,IAAA,gCAAgC,MADjC;AAEC,IAAA,iCAAiC,MAFlC;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,sBAAsB,EAAGC,sBAJ1B;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,QAAQ,EAAGC;AANZ,IAND,CAjCF,EAiDGM,gBAAgB,IACjB,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAGG,eADZ;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAG5B,mBAAmB,CAAE2B,eAAF,CAHjC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,8CAAD;AACC,IAAA,MAAM,EAAGD,kBADV;AAEC,IAAA,QAAQ,EAAGvB,cAAc,CAAEwB,eAAF;AAF1B,IAND,CAlDF,CADD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderRadiusControl as BorderRadiusControl,\n\t__experimentalBorderStyleControl as BorderStyleControl,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nconst MIN_BORDER_WIDTH = 0;\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nexport default function BorderPanel( { name } ) {\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useStyle( 'border', name, 'user' );\n\tconst createHasValueCallback = ( feature ) => () =>\n\t\t!! userBorderStyles?.[ feature ];\n\n\tconst createResetCallback = ( setStyle ) => () => setStyle( undefined );\n\n\tconst handleOnChange = ( setStyle ) => ( value ) => {\n\t\tsetStyle( value || undefined );\n\t};\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' )[ 0 ] || [\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t],\n\t} );\n\n\t// Border width.\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\tconst [ borderWidthValue, setBorderWidth ] = useStyle(\n\t\t'border.width',\n\t\tname\n\t);\n\n\t// Border style.\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst [ borderStyle, setBorderStyle ] = useStyle( 'border.style', name );\n\n\t// When we set a border color or width ensure we have a style so the user\n\t// can see a visible border.\n\tconst handleOnChangeWithStyle = ( setStyle ) => ( value ) => {\n\t\tif ( !! value && ! borderStyle ) {\n\t\t\tsetBorderStyle( 'solid' );\n\t\t}\n\n\t\tsetStyle( value || undefined );\n\t};\n\n\t// Border color.\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst [ borderColor, setBorderColor ] = useStyle( 'border.color', name );\n\tconst disableCustomColors = ! useSetting( 'color.custom' )[ 0 ];\n\tconst disableCustomGradients = ! useSetting( 'color.customGradient' )[ 0 ];\n\n\tconst borderColorSettings = [\n\t\t{\n\t\t\tlabel: __( 'Color' ),\n\t\t\tcolors: useColorsPerOrigin( name ),\n\t\t\tcolorValue: borderColor,\n\t\t\tonColorChange: handleOnChangeWithStyle( setBorderColor ),\n\t\t\tclearable: false,\n\t\t},\n\t];\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useStyle(\n\t\t'border.radius',\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetAll = () => {\n\t\tsetBorderColor( undefined );\n\t\tsetBorderRadius( undefined );\n\t\tsetBorderStyle( undefined );\n\t\tsetBorderWidth( undefined );\n\t};\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ showBorderWidth && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ createHasValueCallback( 'width' ) }\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderWidth ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tvalue={ borderWidthValue }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tmin={ MIN_BORDER_WIDTH }\n\t\t\t\t\t\tonChange={ handleOnChangeWithStyle( setBorderWidth ) }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderStyle && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ createHasValueCallback( 'style' ) }\n\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderStyle ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderStyleControl\n\t\t\t\t\t\tvalue={ borderStyle }\n\t\t\t\t\t\tonChange={ handleOnChange( setBorderStyle ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderColor && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ createHasValueCallback( 'color' ) }\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderColor ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tdisableCustomGradients={ disableCustomGradients }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\tsettings={ borderColorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderRadius ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ handleOnChange( setBorderRadius ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","applyFallbackStyle","border","style","color","width","applyAllFallbackStyles","top","right","bottom","left","BorderPanel","userBorderStyles","setBorder","colors","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetBorder","undefined","resetAll","onBorderChange","newBorder","newBorderWithStyle","updatedBorder","value"],"mappings":";;;;;;;;AAWA;;AARA;;AACA;;AAQA;;AAKA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAQO,SAASA,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,IAAF,CADR,EAEhBG,yBAAyB,CAAEH,IAAF,CAFT,EAGhBI,wBAAwB,CAAEJ,IAAF,CAHR,EAIhBK,wBAAwB,CAAEL,IAAF,CAJR,CAAjB;AAOA,SAAOC,QAAQ,CAACK,IAAT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IAAIF,eAArB,KACD,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAG,MAAM,+CAAiBH,gBAAjB,CADlB;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,MAAMc,WAAW,EAH/B;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,0CAAD;AACC,IAAA,MAAM,EAAGZ,MADV;AAEC,IAAA,WAAW,EAAG,IAFf;AAGC,IAAA,QAAQ,EAAGe,cAHZ;AAIC,IAAA,SAAS,EAAGb,eAJb;AAKC,IAAA,KAAK,EAAGd,MALT;AAMC,IAAA,gBAAgB,EAAC,YANlB;AAOC,IAAA,aAAa,EAAG,EAPjB;AAQC,IAAA,gCAAgC,EAAG,IARpC;AASC,IAAA,iCAAiC,EAAG;AATrC,IAND,CAFF,EAqBGgB,gBAAgB,IACjB,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAGG,eADZ;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,MAAMD,eAAe,CAAEO,SAAF,CAHnC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,8CAAD;AACC,IAAA,MAAM,EAAGR,kBADV;AAEC,IAAA,QAAQ,EAAKc,KAAF,IAAa;AACvBb,MAAAA,eAAe,CAAEa,KAAK,IAAIN,SAAX,CAAf;AACA;AAJF,IAND,CAtBF,CADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalBorderRadiusControl as BorderRadiusControl } from '@wordpress/block-editor';\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( ! border.style && ( border.color || border.width ) ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nexport default function BorderPanel( { name } ) {\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useStyle( 'border', name, 'user' );\n\tconst [ border, setBorder ] = useStyle( 'border', name );\n\tconst colors = useColorsPerOrigin( name );\n\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useStyle(\n\t\t'border.radius',\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: userBorderStyles.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );\n\tconst onBorderChange = useCallback(\n\t\t( newBorder ) => {\n\t\t\t// Ensure we have a visible border style when a border width or\n\t\t\t// color is being selected.\n\t\t\tconst newBorderWithStyle = applyAllFallbackStyles( newBorder );\n\n\t\t\t// As we can't conditionally generate styles based on if other\n\t\t\t// style properties have been set we need to force split border\n\t\t\t// definitions for user set border styles. Border radius is derived\n\t\t\t// from the same property i.e. `border.radius` if it is a string\n\t\t\t// that is used. The longhand border radii styles are only generated\n\t\t\t// if that property is an object.\n\t\t\t//\n\t\t\t// For borders (color, style, and width) those are all properties on\n\t\t\t// the `border` style property. This means if the theme.json defined\n\t\t\t// split borders and the user condenses them into a flat border or\n\t\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\t\tconst updatedBorder = ! hasSplitBorders( newBorderWithStyle )\n\t\t\t\t? {\n\t\t\t\t\t\ttop: newBorderWithStyle,\n\t\t\t\t\t\tright: newBorderWithStyle,\n\t\t\t\t\t\tbottom: newBorderWithStyle,\n\t\t\t\t\t\tleft: newBorderWithStyle,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tcolor: null,\n\t\t\t\t\t\tstyle: null,\n\t\t\t\t\t\twidth: null,\n\t\t\t\t\t\t...newBorderWithStyle,\n\t\t\t\t };\n\n\t\t\t// As radius is maintained separately to color, style, and width\n\t\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t\t// global styles are saved.\n\t\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t\t},\n\t\t[ setBorder ]\n\t);\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( userBorderStyles ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tshowStyle={ showBorderStyle }\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins={ true }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetBorderRadius( value || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
@@ -40,13 +40,13 @@ function ContextMenu(_ref) {
|
|
|
40
40
|
const hasBorderPanel = (0, _borderPanel.useHasBorderPanel)(name);
|
|
41
41
|
const hasDimensionsPanel = (0, _dimensionsPanel.useHasDimensionsPanel)(name);
|
|
42
42
|
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
43
|
-
return (0, _element.createElement)(_components.__experimentalItemGroup, null, hasTypographyPanel && (0, _element.createElement)(_navigationButton.
|
|
43
|
+
return (0, _element.createElement)(_components.__experimentalItemGroup, null, hasTypographyPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
44
44
|
icon: _icons.typography,
|
|
45
45
|
path: parentMenu + '/typography'
|
|
46
|
-
}, (0, _i18n.__)('Typography')), hasColorPanel && (0, _element.createElement)(_navigationButton.
|
|
46
|
+
}, (0, _i18n.__)('Typography')), hasColorPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
47
47
|
icon: _icons.color,
|
|
48
48
|
path: parentMenu + '/colors'
|
|
49
|
-
}, (0, _i18n.__)('Colors')), hasLayoutPanel && (0, _element.createElement)(_navigationButton.
|
|
49
|
+
}, (0, _i18n.__)('Colors')), hasLayoutPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
50
50
|
icon: _icons.layout,
|
|
51
51
|
path: parentMenu + '/layout'
|
|
52
52
|
}, (0, _i18n.__)('Layout')));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["ContextMenu","name","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","typography","color","layout"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA,SAASA,WAAT,OAAkD;AAAA,MAA5B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAU,GAAG;AAArB,GAA4B;AACjD,QAAMC,kBAAkB,GAAG,4CAAuBF,IAAvB,CAA3B;AACA,QAAMG,aAAa,GAAG,kCAAkBH,IAAlB,CAAtB;AACA,QAAMI,cAAc,GAAG,oCAAmBJ,IAAnB,CAAvB;AACA,QAAMK,kBAAkB,GAAG,4CAAuBL,IAAvB,CAA3B;AACA,QAAMM,cAAc,GAAGF,cAAc,IAAIC,kBAAzC;AAEA,SACC,4BAAC,mCAAD,QACGH,kBAAkB,IACnB,4BAAC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["ContextMenu","name","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","typography","color","layout"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA,SAASA,WAAT,OAAkD;AAAA,MAA5B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAU,GAAG;AAArB,GAA4B;AACjD,QAAMC,kBAAkB,GAAG,4CAAuBF,IAAvB,CAA3B;AACA,QAAMG,aAAa,GAAG,kCAAkBH,IAAlB,CAAtB;AACA,QAAMI,cAAc,GAAG,oCAAmBJ,IAAnB,CAAvB;AACA,QAAMK,kBAAkB,GAAG,4CAAuBL,IAAvB,CAA3B;AACA,QAAMM,cAAc,GAAGF,cAAc,IAAIC,kBAAzC;AAEA,SACC,4BAAC,mCAAD,QACGH,kBAAkB,IACnB,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGK,iBADR;AAEC,IAAA,IAAI,EAAGN,UAAU,GAAG;AAFrB,KAIG,cAAI,YAAJ,CAJH,CAFF,EASGE,aAAa,IACd,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGK,YADR;AAEC,IAAA,IAAI,EAAGP,UAAU,GAAG;AAFrB,KAIG,cAAI,QAAJ,CAJH,CAVF,EAiBGK,cAAc,IACf,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGG,aADR;AAEC,IAAA,IAAI,EAAGR,UAAU,GAAG;AAFrB,KAIG,cAAI,QAAJ,CAJH,CAlBF,CADD;AA4BA;;eAEcF,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { typography, color, layout } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport { NavigationButtonAsItem } from './navigation-button';\n\nfunction ContextMenu( { name, parentMenu = '' } ) {\n\tconst hasTypographyPanel = useHasTypographyPanel( name );\n\tconst hasColorPanel = useHasColorPanel( name );\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( name );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\ticon={ typography }\n\t\t\t\t\tpath={ parentMenu + '/typography' }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\ticon={ color }\n\t\t\t\t\tpath={ parentMenu + '/colors' }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t) }\n\t\t\t{ hasLayoutPanel && (\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tpath={ parentMenu + '/layout' }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default ContextMenu;\n"]}
|
|
@@ -13,31 +13,35 @@ var _i18n = require("@wordpress/i18n");
|
|
|
13
13
|
|
|
14
14
|
var _icons = require("@wordpress/icons");
|
|
15
15
|
|
|
16
|
-
var _navigationButton = require("./navigation-button");
|
|
17
|
-
|
|
18
16
|
/**
|
|
19
17
|
* WordPress dependencies
|
|
20
18
|
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
19
|
function ScreenHeader(_ref) {
|
|
26
20
|
let {
|
|
27
21
|
title,
|
|
28
22
|
description
|
|
29
23
|
} = _ref;
|
|
30
24
|
return (0, _element.createElement)(_components.__experimentalVStack, {
|
|
31
|
-
spacing:
|
|
25
|
+
spacing: 0
|
|
26
|
+
}, (0, _element.createElement)(_components.__experimentalView, null, (0, _element.createElement)(_components.__experimentalSpacer, {
|
|
27
|
+
marginBottom: 0,
|
|
28
|
+
paddingX: 4,
|
|
29
|
+
paddingY: 3
|
|
32
30
|
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
33
31
|
spacing: 2
|
|
34
|
-
}, (0, _element.createElement)(_components.
|
|
32
|
+
}, (0, _element.createElement)(_components.__experimentalNavigatorBackButton, {
|
|
33
|
+
style: // TODO: This style override is also used in ToolsPanelHeader.
|
|
34
|
+
// It should be supported out-of-the-box by Button.
|
|
35
|
+
{
|
|
36
|
+
minWidth: 24,
|
|
37
|
+
padding: 0
|
|
38
|
+
},
|
|
35
39
|
icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
|
|
36
|
-
|
|
40
|
+
isSmall: true,
|
|
37
41
|
"aria-label": (0, _i18n.__)('Navigate to the previous view')
|
|
38
|
-
})
|
|
42
|
+
}), (0, _element.createElement)(_components.__experimentalSpacer, null, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
39
43
|
level: 5
|
|
40
|
-
}, title))), description && (0, _element.createElement)("p", {
|
|
44
|
+
}, title))))), description && (0, _element.createElement)("p", {
|
|
41
45
|
className: "edit-site-global-styles-header__description"
|
|
42
46
|
}, description));
|
|
43
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/header.js"],"names":["ScreenHeader","title","description","chevronRight","chevronLeft"],"mappings":";;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/header.js"],"names":["ScreenHeader","title","description","minWidth","padding","chevronRight","chevronLeft"],"mappings":";;;;;;;;;AAGA;;AAQA;;AACA;;AAZA;AACA;AACA;AAYA,SAASA,YAAT,OAAgD;AAAA,MAAzB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAyB;AAC/C,SACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,8BAAD,QACC,4BAAC,gCAAD;AAAQ,IAAA,YAAY,EAAG,CAAvB;AAA2B,IAAA,QAAQ,EAAG,CAAtC;AAA0C,IAAA,QAAQ,EAAG;AAArD,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,6CAAD;AACC,IAAA,KAAK,EACJ;AACA;AACA;AAAEC,MAAAA,QAAQ,EAAE,EAAZ;AAAgBC,MAAAA,OAAO,EAAE;AAAzB,KAJF;AAMC,IAAA,IAAI,EAAG,qBAAUC,mBAAV,GAAyBC,kBANjC;AAOC,IAAA,OAAO,MAPR;AAQC,kBAAa,cAAI,+BAAJ;AARd,IADD,EAWC,4BAAC,gCAAD,QACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG;AAAjB,KAAuBL,KAAvB,CADD,CAXD,CADD,CADD,CADD,EAoBGC,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CArBF,CADD;AA4BA;;eAEcF,Y","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalHeading as Heading,\n\t__experimentalView as View,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\n\nfunction ScreenHeader( { title, description } ) {\n\treturn (\n\t\t<VStack spacing={ 0 }>\n\t\t\t<View>\n\t\t\t\t<Spacer marginBottom={ 0 } paddingX={ 4 } paddingY={ 3 }>\n\t\t\t\t\t<HStack spacing={ 2 }>\n\t\t\t\t\t\t<NavigatorBackButton\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t// TODO: This style override is also used in ToolsPanelHeader.\n\t\t\t\t\t\t\t\t// It should be supported out-of-the-box by Button.\n\t\t\t\t\t\t\t\t{ minWidth: 24, padding: 0 }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\taria-label={ __( 'Navigate to the previous view' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Spacer>\n\t\t\t\t\t\t\t<Heading level={ 5 }>{ title }</Heading>\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t</HStack>\n\t\t\t\t</Spacer>\n\t\t\t</View>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"edit-site-global-styles-header__description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default ScreenHeader;\n"]}
|
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
8
|
+
exports.NavigationBackButtonAsItem = NavigationBackButtonAsItem;
|
|
9
|
+
exports.NavigationButtonAsItem = NavigationButtonAsItem;
|
|
10
10
|
|
|
11
11
|
var _element = require("@wordpress/element");
|
|
12
12
|
|
|
@@ -37,13 +37,13 @@ function GenericNavigationButton(_ref) {
|
|
|
37
37
|
}), (0, _element.createElement)(_components.FlexItem, null, children)), !icon && children);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function
|
|
40
|
+
function NavigationButtonAsItem(props) {
|
|
41
41
|
return (0, _element.createElement)(_components.__experimentalNavigatorButton, (0, _extends2.default)({
|
|
42
42
|
as: GenericNavigationButton
|
|
43
43
|
}, props));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
function
|
|
46
|
+
function NavigationBackButtonAsItem(props) {
|
|
47
47
|
return (0, _element.createElement)(_components.__experimentalNavigatorBackButton, (0, _extends2.default)({
|
|
48
48
|
as: GenericNavigationButton
|
|
49
49
|
}, props));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/navigation-button.js"],"names":["GenericNavigationButton","icon","children","props","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/navigation-button.js"],"names":["GenericNavigationButton","icon","children","props","NavigationButtonAsItem","NavigationBackButtonAsItem"],"mappings":";;;;;;;;;;;;;;AAGA;;AAWA;;AAdA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,uBAAT,OAAiE;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkB,OAAGC;AAArB,GAA+B;AAChE,SACC,4BAAC,8BAAD,EAAWA,KAAX,EACGF,IAAI,IACL,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,0CAAD;AAAsB,IAAA,IAAI,EAAGA,IAA7B;AAAoC,IAAA,IAAI,EAAG;AAA3C,IADD,EAEC,4BAAC,oBAAD,QAAYC,QAAZ,CAFD,CAFF,EAOG,CAAED,IAAF,IAAUC,QAPb,CADD;AAWA;;AAED,SAASE,sBAAT,CAAiCD,KAAjC,EAAyC;AACxC,SAAO,4BAAC,yCAAD;AAAiB,IAAA,EAAE,EAAGH;AAAtB,KAAqDG,KAArD,EAAP;AACA;;AAED,SAASE,0BAAT,CAAqCF,KAArC,EAA6C;AAC5C,SAAO,4BAAC,6CAAD;AAAqB,IAAA,EAAE,EAAGH;AAA1B,KAAyDG,KAAzD,EAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n\t__experimentalItem as Item,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { IconWithCurrentColor } from './icon-with-current-color';\n\nfunction GenericNavigationButton( { icon, children, ...props } ) {\n\treturn (\n\t\t<Item { ...props }>\n\t\t\t{ icon && (\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<IconWithCurrentColor icon={ icon } size={ 24 } />\n\t\t\t\t\t<FlexItem>{ children }</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! icon && children }\n\t\t</Item>\n\t);\n}\n\nfunction NavigationButtonAsItem( props ) {\n\treturn <NavigatorButton as={ GenericNavigationButton } { ...props } />;\n}\n\nfunction NavigationBackButtonAsItem( props ) {\n\treturn <NavigatorBackButton as={ GenericNavigationButton } { ...props } />;\n}\n\nexport { NavigationButtonAsItem, NavigationBackButtonAsItem };\n"]}
|
|
@@ -47,7 +47,7 @@ function Palette(_ref) {
|
|
|
47
47
|
}, (0, _element.createElement)(_subtitle.default, null, (0, _i18n.__)('Palette')), (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
48
48
|
isBordered: true,
|
|
49
49
|
isSeparated: true
|
|
50
|
-
}, (0, _element.createElement)(_navigationButton.
|
|
50
|
+
}, (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
51
51
|
path: screenPath
|
|
52
52
|
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
53
53
|
direction: colors.length === 0 ? 'row-reverse' : 'row'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/palette.js"],"names":["EMPTY_COLORS","Palette","name","customColors","themeColors","defaultColors","defaultPaletteEnabled","colors","screenPath","paletteButtonText","length","slice","map","color"],"mappings":";;;;;;;;;AAYA;;AATA;;AAQA;;AAMA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAYA;AACA;AACA;AAMA,MAAMA,YAAY,GAAG,EAArB;;AAEA,SAASC,OAAT,OAA6B;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAC5B,QAAM,CAAEC,YAAF,IAAmB,uBAAY,sBAAZ,CAAzB;AACA,QAAM,CAAEC,WAAF,IAAkB,uBAAY,qBAAZ,CAAxB;AACA,QAAM,CAAEC,aAAF,IAAoB,uBAAY,uBAAZ,CAA1B;AAEA,QAAM,CAAEC,qBAAF,IAA4B,uBACjC,sBADiC,EAEjCJ,IAFiC,CAAlC;AAIA,QAAMK,MAAM,GAAG,sBACd,MAAM,CACL,IAAKJ,YAAY,IAAIH,YAArB,CADK,EAEL,IAAKI,WAAW,IAAIJ,YAApB,CAFK,EAGL,IAAKK,aAAa,IAAIC,qBAAjB,GACFD,aADE,GAEFL,YAFH,CAHK,CADQ,EAQd,CAAEG,YAAF,EAAgBC,WAAhB,EAA6BC,aAA7B,EAA4CC,qBAA5C,CARc,CAAf;AAWA,QAAME,UAAU,GAAG,CAAEN,IAAF,GAChB,iBADgB,GAEhB,aAAaA,IAAb,GAAoB,iBAFvB;AAGA,QAAMO,iBAAiB,GACtBF,MAAM,CAACG,MAAP,GAAgB,CAAhB,GACG,oBACA;AACA,gBAAI,UAAJ,EAAgB,WAAhB,EAA6BH,MAAM,CAACG,MAApC,CAFA,EAGAH,MAAM,CAACG,MAHP,CADH,GAMG,cAAI,mBAAJ,CAPJ;AASA,SACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,iBAAD,QAAY,cAAI,SAAJ,CAAZ,CADD,EAEC,4BAAC,mCAAD;AAAW,IAAA,UAAU,MAArB;AAAsB,IAAA,WAAW;AAAjC,KACC,4BAAC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/palette.js"],"names":["EMPTY_COLORS","Palette","name","customColors","themeColors","defaultColors","defaultPaletteEnabled","colors","screenPath","paletteButtonText","length","slice","map","color"],"mappings":";;;;;;;;;AAYA;;AATA;;AAQA;;AAMA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAYA;AACA;AACA;AAMA,MAAMA,YAAY,GAAG,EAArB;;AAEA,SAASC,OAAT,OAA6B;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAC5B,QAAM,CAAEC,YAAF,IAAmB,uBAAY,sBAAZ,CAAzB;AACA,QAAM,CAAEC,WAAF,IAAkB,uBAAY,qBAAZ,CAAxB;AACA,QAAM,CAAEC,aAAF,IAAoB,uBAAY,uBAAZ,CAA1B;AAEA,QAAM,CAAEC,qBAAF,IAA4B,uBACjC,sBADiC,EAEjCJ,IAFiC,CAAlC;AAIA,QAAMK,MAAM,GAAG,sBACd,MAAM,CACL,IAAKJ,YAAY,IAAIH,YAArB,CADK,EAEL,IAAKI,WAAW,IAAIJ,YAApB,CAFK,EAGL,IAAKK,aAAa,IAAIC,qBAAjB,GACFD,aADE,GAEFL,YAFH,CAHK,CADQ,EAQd,CAAEG,YAAF,EAAgBC,WAAhB,EAA6BC,aAA7B,EAA4CC,qBAA5C,CARc,CAAf;AAWA,QAAME,UAAU,GAAG,CAAEN,IAAF,GAChB,iBADgB,GAEhB,aAAaA,IAAb,GAAoB,iBAFvB;AAGA,QAAMO,iBAAiB,GACtBF,MAAM,CAACG,MAAP,GAAgB,CAAhB,GACG,oBACA;AACA,gBAAI,UAAJ,EAAgB,WAAhB,EAA6BH,MAAM,CAACG,MAApC,CAFA,EAGAH,MAAM,CAACG,MAHP,CADH,GAMG,cAAI,mBAAJ,CAPJ;AASA,SACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,iBAAD,QAAY,cAAI,SAAJ,CAAZ,CADD,EAEC,4BAAC,mCAAD;AAAW,IAAA,UAAU,MAArB;AAAsB,IAAA,WAAW;AAAjC,KACC,4BAAC,wCAAD;AAAwB,IAAA,IAAI,EAAGF;AAA/B,KACC,4BAAC,gCAAD;AACC,IAAA,SAAS,EACRD,MAAM,CAACG,MAAP,KAAkB,CAAlB,GAAsB,aAAtB,GAAsC;AAFxC,KAKC,4BAAC,gCAAD;AAAQ,IAAA,SAAS,EAAG,KAApB;AAA4B,IAAA,MAAM,EAAG,CAAC;AAAtC,KACGH,MAAM,CAACI,KAAP,CAAc,CAAd,EAAiB,CAAjB,EAAqBC,GAArB,CAA0B;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAC3B,4BAAC,8BAAD;AAAuB,MAAA,GAAG,EAAGA;AAA7B,OACC,4BAAC,0BAAD;AAAgB,MAAA,UAAU,EAAGA;AAA7B,MADD,CAD2B;AAAA,GAA1B,CADH,CALD,EAYC,4BAAC,oBAAD,QAAYJ,iBAAZ,CAZD,CADD,CADD,CAFD,CADD;AAuBA;;eAEcR,O","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n\t__experimentalZStack as ZStack,\n\t__experimentalVStack as VStack,\n\tColorIndicator,\n} from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Subtitle from './subtitle';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { useSetting } from './hooks';\nimport ColorIndicatorWrapper from './color-indicator-wrapper';\n\nconst EMPTY_COLORS = [];\n\nfunction Palette( { name } ) {\n\tconst [ customColors ] = useSetting( 'color.palette.custom' );\n\tconst [ themeColors ] = useSetting( 'color.palette.theme' );\n\tconst [ defaultColors ] = useSetting( 'color.palette.default' );\n\n\tconst [ defaultPaletteEnabled ] = useSetting(\n\t\t'color.defaultPalette',\n\t\tname\n\t);\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( customColors || EMPTY_COLORS ),\n\t\t\t...( themeColors || EMPTY_COLORS ),\n\t\t\t...( defaultColors && defaultPaletteEnabled\n\t\t\t\t? defaultColors\n\t\t\t\t: EMPTY_COLORS ),\n\t\t],\n\t\t[ customColors, themeColors, defaultColors, defaultPaletteEnabled ]\n\t);\n\n\tconst screenPath = ! name\n\t\t? '/colors/palette'\n\t\t: '/blocks/' + name + '/colors/palette';\n\tconst paletteButtonText =\n\t\tcolors.length > 0\n\t\t\t? sprintf(\n\t\t\t\t\t// Translators: %d: Number of palette colors.\n\t\t\t\t\t_n( '%d color', '%d colors', colors.length ),\n\t\t\t\t\tcolors.length\n\t\t\t )\n\t\t\t: __( 'Add custom colors' );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<Subtitle>{ __( 'Palette' ) }</Subtitle>\n\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t<NavigationButtonAsItem path={ screenPath }>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tdirection={\n\t\t\t\t\t\t\tcolors.length === 0 ? 'row-reverse' : 'row'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t\t\t{ colors.slice( 0, 5 ).map( ( { color } ) => (\n\t\t\t\t\t\t\t\t<ColorIndicatorWrapper key={ color }>\n\t\t\t\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</ZStack>\n\t\t\t\t\t\t<FlexItem>{ paletteButtonText }</FlexItem>\n\t\t\t\t\t</HStack>\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nexport default Palette;\n"]}
|
|
@@ -84,7 +84,7 @@ function BlockMenuItem(_ref) {
|
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
return (0, _element.createElement)(_navigationButton.
|
|
87
|
+
return (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
88
88
|
path: '/blocks/' + block.name
|
|
89
89
|
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
90
90
|
justify: "flex-start"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["useSortedBlockTypes","blockItems","select","blocksStore","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","BlockMenuItem","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasBlockMenuItem","icon","title","ScreenBlockList","sortedBlockTypes","filterValue","setFilterValue","debouncedSpeak","speak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","map"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAcA;AACA;AACA;AAQA,SAASA,mBAAT,GAA+B;AAC9B,QAAMC,U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@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["useSortedBlockTypes","blockItems","select","blocksStore","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","BlockMenuItem","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasBlockMenuItem","icon","title","ScreenBlockList","sortedBlockTypes","filterValue","setFilterValue","debouncedSpeak","speak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","map"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAcA;AACA;AACA;AAQA,SAASA,mBAAT,GAA+B;AAC9B,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,aAAtB,EADI,EAElB,EAFkB,CAAnB,CAD8B,CAK9B;AACA;AACA;AACA;AACA;;AACA,QAAMC,WAAW,GAAG,CAAEC,MAAF,EAAUC,KAAV,KAAqB;AACxC,UAAM;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,QAAoBH,MAA1B;AACA,UAAMI,IAAI,GAAGH,KAAK,CAACI,IAAN,CAAWC,UAAX,CAAuB,OAAvB,IAAmCJ,IAAnC,GAA0CC,OAAvD;AACAC,IAAAA,IAAI,CAACG,IAAL,CAAWN,KAAX;AACA,WAAOD,MAAP;AACA,GALD;;AAMA,QAAM;AACLE,IAAAA,IAAI,EAAEM,SADD;AAELL,IAAAA,OAAO,EAAEM;AAFJ,MAGFd,UAAU,CAACe,MAAX,CAAmBX,WAAnB,EAAgC;AAAEG,IAAAA,IAAI,EAAE,EAAR;AAAYC,IAAAA,OAAO,EAAE;AAArB,GAAhC,CAHJ;AAIA,SAAO,CAAE,GAAGK,SAAL,EAAgB,GAAGC,YAAnB,CAAP;AACA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AEG,SAAF,EAAaP,WAAb,CADd,CAAP;AAGA,GAP0B,EAOxB,CAAEA,WAAF,EAAeD,gBAAf,EAAiCK,oBAAjC,CAPwB,CAA3B;AASA,QAAMI,iBAAiB,GAAG,sBAA1B,CAjB0B,CAmB1B;;AACA,0BAAW,MAAM;AAChB,QAAK,CAAER,WAAP,EAAqB;AACpB;AACA,KAHe,CAIhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,UAAMS,KAAK,GAAGD,iBAAiB,CAACE,OAAlB,CAA0BC,iBAAxC;AACA,UAAMC,mBAAmB,GAAG;AAC3B;AACA,kBAAI,kBAAJ,EAAwB,mBAAxB,EAA6CH,KAA7C,CAF2B,EAG3BA,KAH2B,CAA5B;AAKAP,IAAAA,cAAc,CAAEU,mBAAF,EAAuBH,KAAvB,CAAd;AACA,GAnBD,EAmBG,CAAET,WAAF,EAAeE,cAAf,CAnBH;AAqBA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,qEADa;AAFf,IADD,EAOC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,8BADX;AAEC,IAAA,QAAQ,EAAGD,cAFZ;AAGC,IAAA,KAAK,EAAGD,WAHT;AAIC,IAAA,KAAK,EAAG,cAAI,mBAAJ,CAJT;AAKC,IAAA,WAAW,EAAG,cAAI,QAAJ;AALf,IAPD,EAcC;AACC,IAAA,GAAG,EAAGQ,iBADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGH,kBAAkB,CAACQ,GAAnB,CAA0BlC,KAAF,IACzB,4BAAC,aAAD;AACC,IAAA,KAAK,EAAGA,KADT;AAEC,IAAA,GAAG,EAAG,oBAAoBA,KAAK,CAACI;AAFjC,IADC,CAJH,CAdD,CADD;AA4BA;;eAEce,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst {\n\t\tcore: coreItems,\n\t\tnoncore: nonCoreItems,\n\t} = blockItems.reduce( groupByType, { core: [], noncore: [] } );\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasTypographyPanel = useHasTypographyPanel( block.name );\n\tconst hasColorPanel = useHasColorPanel( block.name );\n\tconst hasBorderPanel = useHasBorderPanel( block.name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( block.name );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasBlockMenuItem =\n\t\thasTypographyPanel || hasColorPanel || hasLayoutPanel;\n\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem path={ '/blocks/' + block.name }>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenBlockList() {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst isMatchingSearchTerm = useSelect(\n\t\t( select ) => select( blocksStore ).isMatchingSearchTerm,\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn sortedBlockTypes;\n\t\t}\n\t\treturn sortedBlockTypes.filter( ( blockType ) =>\n\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t);\n\t}, [ filterValue, sortedBlockTypes, isMatchingSearchTerm ] );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search for blocks' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ blockTypesListRef }\n\t\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"]}
|
|
@@ -46,7 +46,7 @@ function BackgroundColorItem(_ref) {
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
return (0, _element.createElement)(_navigationButton.
|
|
49
|
+
return (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
50
50
|
path: parentMenu + '/colors/background'
|
|
51
51
|
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
52
52
|
justify: "flex-start"
|
|
@@ -70,7 +70,7 @@ function TextColorItem(_ref2) {
|
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
return (0, _element.createElement)(_navigationButton.
|
|
73
|
+
return (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
74
74
|
path: parentMenu + '/colors/text'
|
|
75
75
|
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
76
76
|
justify: "flex-start"
|
|
@@ -94,7 +94,7 @@ function LinkColorItem(_ref3) {
|
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
return (0, _element.createElement)(_navigationButton.
|
|
97
|
+
return (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
98
98
|
path: parentMenu + '/colors/link'
|
|
99
99
|
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
100
100
|
justify: "flex-start"
|