@wordpress/interface 5.25.1-next.79a6196f.0 → 5.27.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 +4 -0
- package/build/components/index.js +0 -28
- package/build/components/index.js.map +1 -1
- package/build/components/interface-skeleton/index.js +1 -1
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build-module/components/index.js +0 -4
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +2 -2
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-style/style-rtl.css +1 -95
- package/build-style/style.css +1 -95
- package/lock-unlock.js +10 -0
- package/package.json +14 -13
- package/src/components/index.js +0 -4
- package/src/components/interface-skeleton/index.js +2 -2
- package/src/components/pinned-items/style.scss +0 -3
- package/src/style.scss +0 -4
- package/build/components/preferences-modal/index.js +0 -24
- package/build/components/preferences-modal/index.js.map +0 -1
- package/build/components/preferences-modal-base-option/index.js +0 -32
- package/build/components/preferences-modal-base-option/index.js.map +0 -1
- package/build/components/preferences-modal-section/index.js +0 -25
- package/build/components/preferences-modal-section/index.js.map +0 -1
- package/build/components/preferences-modal-tabs/index.js +0 -111
- package/build/components/preferences-modal-tabs/index.js.map +0 -1
- package/build-module/components/preferences-modal/index.js +0 -17
- package/build-module/components/preferences-modal/index.js.map +0 -1
- package/build-module/components/preferences-modal-base-option/index.js +0 -24
- package/build-module/components/preferences-modal-base-option/index.js.map +0 -1
- package/build-module/components/preferences-modal-section/index.js +0 -18
- package/build-module/components/preferences-modal-section/index.js.map +0 -1
- package/build-module/components/preferences-modal-tabs/index.js +0 -104
- package/build-module/components/preferences-modal-tabs/index.js.map +0 -1
- package/src/components/preferences-modal/README.md +0 -69
- package/src/components/preferences-modal/index.js +0 -17
- package/src/components/preferences-modal/style.scss +0 -21
- package/src/components/preferences-modal-base-option/README.md +0 -42
- package/src/components/preferences-modal-base-option/index.js +0 -21
- package/src/components/preferences-modal-base-option/style.scss +0 -10
- package/src/components/preferences-modal-section/README.md +0 -30
- package/src/components/preferences-modal-section/index.js +0 -19
- package/src/components/preferences-modal-section/style.scss +0 -28
- package/src/components/preferences-modal-tabs/README.md +0 -14
- package/src/components/preferences-modal-tabs/index.js +0 -156
- package/src/components/preferences-modal-tabs/style.scss +0 -49
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
const Section = ({
|
|
9
|
-
description,
|
|
10
|
-
title,
|
|
11
|
-
children
|
|
12
|
-
}) => (0, _react.createElement)("fieldset", {
|
|
13
|
-
className: "interface-preferences-modal__section"
|
|
14
|
-
}, (0, _react.createElement)("legend", {
|
|
15
|
-
className: "interface-preferences-modal__section-legend"
|
|
16
|
-
}, (0, _react.createElement)("h2", {
|
|
17
|
-
className: "interface-preferences-modal__section-title"
|
|
18
|
-
}, title), description && (0, _react.createElement)("p", {
|
|
19
|
-
className: "interface-preferences-modal__section-description"
|
|
20
|
-
}, description)), (0, _react.createElement)("div", {
|
|
21
|
-
className: "interface-preferences-modal__section-content"
|
|
22
|
-
}, children));
|
|
23
|
-
var _default = Section;
|
|
24
|
-
exports.default = _default;
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Section","description","title","children","_react","createElement","className","_default","exports","default"],"sources":["@wordpress/interface/src/components/preferences-modal-section/index.js"],"sourcesContent":["const Section = ( { description, title, children } ) => (\n\t<fieldset className=\"interface-preferences-modal__section\">\n\t\t<legend className=\"interface-preferences-modal__section-legend\">\n\t\t\t<h2 className=\"interface-preferences-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"interface-preferences-modal__section-description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</legend>\n\t\t<div className=\"interface-preferences-modal__section-content\">\n\t\t\t{ children }\n\t\t</div>\n\t</fieldset>\n);\n\nexport default Section;\n"],"mappings":";;;;;;;AAAA,MAAMA,OAAO,GAAGA,CAAE;EAAEC,WAAW;EAAEC,KAAK;EAAEC;AAAS,CAAC,KACjD,IAAAC,MAAA,CAAAC,aAAA;EAAUC,SAAS,EAAC;AAAsC,GACzD,IAAAF,MAAA,CAAAC,aAAA;EAAQC,SAAS,EAAC;AAA6C,GAC9D,IAAAF,MAAA,CAAAC,aAAA;EAAIC,SAAS,EAAC;AAA4C,GACvDJ,KACC,CAAC,EACHD,WAAW,IACZ,IAAAG,MAAA,CAAAC,aAAA;EAAGC,SAAS,EAAC;AAAkD,GAC5DL,WACA,CAEG,CAAC,EACT,IAAAG,MAAA,CAAAC,aAAA;EAAKC,SAAS,EAAC;AAA8C,GAC1DH,QACE,CACI,CACV;AAAC,IAAAI,QAAA,GAEaP,OAAO;AAAAQ,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = PreferencesModalTabs;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _compose = require("@wordpress/compose");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
var _icons = require("@wordpress/icons");
|
|
12
|
-
var _i18n = require("@wordpress/i18n");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const PREFERENCES_MENU = 'preferences-menu';
|
|
18
|
-
function PreferencesModalTabs({
|
|
19
|
-
sections
|
|
20
|
-
}) {
|
|
21
|
-
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
22
|
-
|
|
23
|
-
// This is also used to sync the two different rendered components
|
|
24
|
-
// between small and large viewports.
|
|
25
|
-
const [activeMenu, setActiveMenu] = (0, _element.useState)(PREFERENCES_MENU);
|
|
26
|
-
/**
|
|
27
|
-
* Create helper objects from `sections` for easier data handling.
|
|
28
|
-
* `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
|
|
29
|
-
* is used for easier access to active tab's content.
|
|
30
|
-
*/
|
|
31
|
-
const {
|
|
32
|
-
tabs,
|
|
33
|
-
sectionsContentMap
|
|
34
|
-
} = (0, _element.useMemo)(() => {
|
|
35
|
-
let mappedTabs = {
|
|
36
|
-
tabs: [],
|
|
37
|
-
sectionsContentMap: {}
|
|
38
|
-
};
|
|
39
|
-
if (sections.length) {
|
|
40
|
-
mappedTabs = sections.reduce((accumulator, {
|
|
41
|
-
name,
|
|
42
|
-
tabLabel: title,
|
|
43
|
-
content
|
|
44
|
-
}) => {
|
|
45
|
-
accumulator.tabs.push({
|
|
46
|
-
name,
|
|
47
|
-
title
|
|
48
|
-
});
|
|
49
|
-
accumulator.sectionsContentMap[name] = content;
|
|
50
|
-
return accumulator;
|
|
51
|
-
}, {
|
|
52
|
-
tabs: [],
|
|
53
|
-
sectionsContentMap: {}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return mappedTabs;
|
|
57
|
-
}, [sections]);
|
|
58
|
-
const getCurrentTab = (0, _element.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
|
|
59
|
-
let modalContent;
|
|
60
|
-
// We render different components based on the viewport size.
|
|
61
|
-
if (isLargeViewport) {
|
|
62
|
-
modalContent = (0, _react.createElement)(_components.TabPanel, {
|
|
63
|
-
className: "interface-preferences__tabs",
|
|
64
|
-
tabs: tabs,
|
|
65
|
-
initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
|
|
66
|
-
onSelect: setActiveMenu,
|
|
67
|
-
orientation: "vertical"
|
|
68
|
-
}, getCurrentTab);
|
|
69
|
-
} else {
|
|
70
|
-
modalContent = (0, _react.createElement)(_components.__experimentalNavigatorProvider, {
|
|
71
|
-
initialPath: "/",
|
|
72
|
-
className: "interface-preferences__provider"
|
|
73
|
-
}, (0, _react.createElement)(_components.__experimentalNavigatorScreen, {
|
|
74
|
-
path: "/"
|
|
75
|
-
}, (0, _react.createElement)(_components.Card, {
|
|
76
|
-
isBorderless: true,
|
|
77
|
-
size: "small"
|
|
78
|
-
}, (0, _react.createElement)(_components.CardBody, null, (0, _react.createElement)(_components.__experimentalItemGroup, null, tabs.map(tab => {
|
|
79
|
-
return (0, _react.createElement)(_components.__experimentalNavigatorButton, {
|
|
80
|
-
key: tab.name,
|
|
81
|
-
path: tab.name,
|
|
82
|
-
as: _components.__experimentalItem,
|
|
83
|
-
isAction: true
|
|
84
|
-
}, (0, _react.createElement)(_components.__experimentalHStack, {
|
|
85
|
-
justify: "space-between"
|
|
86
|
-
}, (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_components.__experimentalTruncate, null, tab.title)), (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_icons.Icon, {
|
|
87
|
-
icon: (0, _i18n.isRTL)() ? _icons.chevronLeft : _icons.chevronRight
|
|
88
|
-
}))));
|
|
89
|
-
}))))), sections.length && sections.map(section => {
|
|
90
|
-
return (0, _react.createElement)(_components.__experimentalNavigatorScreen, {
|
|
91
|
-
key: `${section.name}-menu`,
|
|
92
|
-
path: section.name
|
|
93
|
-
}, (0, _react.createElement)(_components.Card, {
|
|
94
|
-
isBorderless: true,
|
|
95
|
-
size: "large"
|
|
96
|
-
}, (0, _react.createElement)(_components.CardHeader, {
|
|
97
|
-
isBorderless: false,
|
|
98
|
-
justify: "left",
|
|
99
|
-
size: "small",
|
|
100
|
-
gap: "6"
|
|
101
|
-
}, (0, _react.createElement)(_components.__experimentalNavigatorBackButton, {
|
|
102
|
-
icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
|
|
103
|
-
"aria-label": (0, _i18n.__)('Navigate to the previous view')
|
|
104
|
-
}), (0, _react.createElement)(_components.__experimentalText, {
|
|
105
|
-
size: "16"
|
|
106
|
-
}, section.tabLabel)), (0, _react.createElement)(_components.CardBody, null, section.content)));
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
return modalContent;
|
|
110
|
-
}
|
|
111
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_components","_element","_icons","_i18n","PREFERENCES_MENU","PreferencesModalTabs","sections","isLargeViewport","useViewportMatch","activeMenu","setActiveMenu","useState","tabs","sectionsContentMap","useMemo","mappedTabs","length","reduce","accumulator","name","tabLabel","title","content","push","getCurrentTab","useCallback","tab","modalContent","_react","createElement","TabPanel","className","initialTabName","undefined","onSelect","orientation","__experimentalNavigatorProvider","initialPath","__experimentalNavigatorScreen","path","Card","isBorderless","size","CardBody","__experimentalItemGroup","map","__experimentalNavigatorButton","key","as","Item","isAction","__experimentalHStack","justify","FlexItem","__experimentalTruncate","Icon","icon","isRTL","chevronLeft","chevronRight","section","CardHeader","gap","__experimentalNavigatorBackButton","__","__experimentalText"],"sources":["@wordpress/interface/src/components/preferences-modal-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\tFlexItem,\n\tTabPanel,\n\tCard,\n\tCardHeader,\n\tCardBody,\n} from '@wordpress/components';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\n\nconst PREFERENCES_MENU = 'preferences-menu';\n\nexport default function PreferencesModalTabs( { sections } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\t// This is also used to sync the two different rendered components\n\t// between small and large viewports.\n\tconst [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );\n\t/**\n\t * Create helper objects from `sections` for easier data handling.\n\t * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`\n\t * is used for easier access to active tab's content.\n\t */\n\tconst { tabs, sectionsContentMap } = useMemo( () => {\n\t\tlet mappedTabs = {\n\t\t\ttabs: [],\n\t\t\tsectionsContentMap: {},\n\t\t};\n\t\tif ( sections.length ) {\n\t\t\tmappedTabs = sections.reduce(\n\t\t\t\t( accumulator, { name, tabLabel: title, content } ) => {\n\t\t\t\t\taccumulator.tabs.push( { name, title } );\n\t\t\t\t\taccumulator.sectionsContentMap[ name ] = content;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ tabs: [], sectionsContentMap: {} }\n\t\t\t);\n\t\t}\n\t\treturn mappedTabs;\n\t}, [ sections ] );\n\n\tconst getCurrentTab = useCallback(\n\t\t( tab ) => sectionsContentMap[ tab.name ] || null,\n\t\t[ sectionsContentMap ]\n\t);\n\n\tlet modalContent;\n\t// We render different components based on the viewport size.\n\tif ( isLargeViewport ) {\n\t\tmodalContent = (\n\t\t\t<TabPanel\n\t\t\t\tclassName=\"interface-preferences__tabs\"\n\t\t\t\ttabs={ tabs }\n\t\t\t\tinitialTabName={\n\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t}\n\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\torientation=\"vertical\"\n\t\t\t>\n\t\t\t\t{ getCurrentTab }\n\t\t\t</TabPanel>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<NavigatorProvider\n\t\t\t\tinitialPath=\"/\"\n\t\t\t\tclassName=\"interface-preferences__provider\"\n\t\t\t>\n\t\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t\t<Card isBorderless size=\"small\">\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tpath={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tas={ Item }\n\t\t\t\t\t\t\t\t\t\t\tisAction\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t</NavigatorButton>\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</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t</Card>\n\t\t\t\t</NavigatorScreen>\n\t\t\t\t{ sections.length &&\n\t\t\t\t\tsections.map( ( section ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<NavigatorScreen\n\t\t\t\t\t\t\t\tkey={ `${ section.name }-menu` }\n\t\t\t\t\t\t\t\tpath={ section.name }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Card isBorderless size=\"large\">\n\t\t\t\t\t\t\t\t\t<CardHeader\n\t\t\t\t\t\t\t\t\t\tisBorderless={ false }\n\t\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tgap=\"6\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<NavigatorBackButton\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigate to the previous view'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Text size=\"16\">\n\t\t\t\t\t\t\t\t\t\t\t{ section.tabLabel }\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t</CardHeader>\n\t\t\t\t\t\t\t\t\t<CardBody>{ section.content }</CardBody>\n\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t</NavigatorScreen>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t</NavigatorProvider>\n\t\t);\n\t}\n\n\treturn modalContent;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA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@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { Modal } from '@wordpress/components';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
export default function PreferencesModal({
|
|
8
|
-
closeModal,
|
|
9
|
-
children
|
|
10
|
-
}) {
|
|
11
|
-
return createElement(Modal, {
|
|
12
|
-
className: "interface-preferences-modal",
|
|
13
|
-
title: __('Preferences'),
|
|
14
|
-
onRequestClose: closeModal
|
|
15
|
-
}, children);
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Modal","__","PreferencesModal","closeModal","children","createElement","className","title","onRequestClose"],"sources":["@wordpress/interface/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function PreferencesModal( { closeModal, children } ) {\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"interface-preferences-modal\"\n\t\t\ttitle={ __( 'Preferences' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t>\n\t\t\t{ children }\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,eAAe,SAASC,gBAAgBA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EACpE,OACCC,aAAA,CAACL,KAAK;IACLM,SAAS,EAAC,6BAA6B;IACvCC,KAAK,EAAGN,EAAE,CAAE,aAAc,CAAG;IAC7BO,cAAc,EAAGL;EAAY,GAE3BC,QACI,CAAC;AAEV"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { ToggleControl } from '@wordpress/components';
|
|
6
|
-
function BaseOption({
|
|
7
|
-
help,
|
|
8
|
-
label,
|
|
9
|
-
isChecked,
|
|
10
|
-
onChange,
|
|
11
|
-
children
|
|
12
|
-
}) {
|
|
13
|
-
return createElement("div", {
|
|
14
|
-
className: "interface-preferences-modal__option"
|
|
15
|
-
}, createElement(ToggleControl, {
|
|
16
|
-
__nextHasNoMarginBottom: true,
|
|
17
|
-
help: help,
|
|
18
|
-
label: label,
|
|
19
|
-
checked: isChecked,
|
|
20
|
-
onChange: onChange
|
|
21
|
-
}), children);
|
|
22
|
-
}
|
|
23
|
-
export default BaseOption;
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ToggleControl","BaseOption","help","label","isChecked","onChange","children","createElement","className","__nextHasNoMarginBottom","checked"],"sources":["@wordpress/interface/src/components/preferences-modal-base-option/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToggleControl } from '@wordpress/components';\n\nfunction BaseOption( { help, label, isChecked, onChange, children } ) {\n\treturn (\n\t\t<div className=\"interface-preferences-modal__option\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\thelp={ help }\n\t\t\t\tlabel={ label }\n\t\t\t\tchecked={ isChecked }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default BaseOption;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC,KAAK;EAAEC,SAAS;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACrE,OACCC,aAAA;IAAKC,SAAS,EAAC;EAAqC,GACnDD,aAAA,CAACP,aAAa;IACbS,uBAAuB;IACvBP,IAAI,EAAGA,IAAM;IACbC,KAAK,EAAGA,KAAO;IACfO,OAAO,EAAGN,SAAW;IACrBC,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACAC,QACE,CAAC;AAER;AAEA,eAAeL,UAAU"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
const Section = ({
|
|
3
|
-
description,
|
|
4
|
-
title,
|
|
5
|
-
children
|
|
6
|
-
}) => createElement("fieldset", {
|
|
7
|
-
className: "interface-preferences-modal__section"
|
|
8
|
-
}, createElement("legend", {
|
|
9
|
-
className: "interface-preferences-modal__section-legend"
|
|
10
|
-
}, createElement("h2", {
|
|
11
|
-
className: "interface-preferences-modal__section-title"
|
|
12
|
-
}, title), description && createElement("p", {
|
|
13
|
-
className: "interface-preferences-modal__section-description"
|
|
14
|
-
}, description)), createElement("div", {
|
|
15
|
-
className: "interface-preferences-modal__section-content"
|
|
16
|
-
}, children));
|
|
17
|
-
export default Section;
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Section","description","title","children","createElement","className"],"sources":["@wordpress/interface/src/components/preferences-modal-section/index.js"],"sourcesContent":["const Section = ( { description, title, children } ) => (\n\t<fieldset className=\"interface-preferences-modal__section\">\n\t\t<legend className=\"interface-preferences-modal__section-legend\">\n\t\t\t<h2 className=\"interface-preferences-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"interface-preferences-modal__section-description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</legend>\n\t\t<div className=\"interface-preferences-modal__section-content\">\n\t\t\t{ children }\n\t\t</div>\n\t</fieldset>\n);\n\nexport default Section;\n"],"mappings":";AAAA,MAAMA,OAAO,GAAGA,CAAE;EAAEC,WAAW;EAAEC,KAAK;EAAEC;AAAS,CAAC,KACjDC,aAAA;EAAUC,SAAS,EAAC;AAAsC,GACzDD,aAAA;EAAQC,SAAS,EAAC;AAA6C,GAC9DD,aAAA;EAAIC,SAAS,EAAC;AAA4C,GACvDH,KACC,CAAC,EACHD,WAAW,IACZG,aAAA;EAAGC,SAAS,EAAC;AAAkD,GAC5DJ,WACA,CAEG,CAAC,EACTG,aAAA;EAAKC,SAAS,EAAC;AAA8C,GAC1DF,QACE,CACI,CACV;AAED,eAAeH,OAAO"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
6
|
-
import { __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen, __experimentalNavigatorButton as NavigatorButton, __experimentalNavigatorBackButton as NavigatorBackButton, __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalHStack as HStack, __experimentalText as Text, __experimentalTruncate as Truncate, FlexItem, TabPanel, Card, CardHeader, CardBody } from '@wordpress/components';
|
|
7
|
-
import { useMemo, useCallback, useState } from '@wordpress/element';
|
|
8
|
-
import { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
|
|
9
|
-
import { isRTL, __ } from '@wordpress/i18n';
|
|
10
|
-
const PREFERENCES_MENU = 'preferences-menu';
|
|
11
|
-
export default function PreferencesModalTabs({
|
|
12
|
-
sections
|
|
13
|
-
}) {
|
|
14
|
-
const isLargeViewport = useViewportMatch('medium');
|
|
15
|
-
|
|
16
|
-
// This is also used to sync the two different rendered components
|
|
17
|
-
// between small and large viewports.
|
|
18
|
-
const [activeMenu, setActiveMenu] = useState(PREFERENCES_MENU);
|
|
19
|
-
/**
|
|
20
|
-
* Create helper objects from `sections` for easier data handling.
|
|
21
|
-
* `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
|
|
22
|
-
* is used for easier access to active tab's content.
|
|
23
|
-
*/
|
|
24
|
-
const {
|
|
25
|
-
tabs,
|
|
26
|
-
sectionsContentMap
|
|
27
|
-
} = useMemo(() => {
|
|
28
|
-
let mappedTabs = {
|
|
29
|
-
tabs: [],
|
|
30
|
-
sectionsContentMap: {}
|
|
31
|
-
};
|
|
32
|
-
if (sections.length) {
|
|
33
|
-
mappedTabs = sections.reduce((accumulator, {
|
|
34
|
-
name,
|
|
35
|
-
tabLabel: title,
|
|
36
|
-
content
|
|
37
|
-
}) => {
|
|
38
|
-
accumulator.tabs.push({
|
|
39
|
-
name,
|
|
40
|
-
title
|
|
41
|
-
});
|
|
42
|
-
accumulator.sectionsContentMap[name] = content;
|
|
43
|
-
return accumulator;
|
|
44
|
-
}, {
|
|
45
|
-
tabs: [],
|
|
46
|
-
sectionsContentMap: {}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return mappedTabs;
|
|
50
|
-
}, [sections]);
|
|
51
|
-
const getCurrentTab = useCallback(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
|
|
52
|
-
let modalContent;
|
|
53
|
-
// We render different components based on the viewport size.
|
|
54
|
-
if (isLargeViewport) {
|
|
55
|
-
modalContent = createElement(TabPanel, {
|
|
56
|
-
className: "interface-preferences__tabs",
|
|
57
|
-
tabs: tabs,
|
|
58
|
-
initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
|
|
59
|
-
onSelect: setActiveMenu,
|
|
60
|
-
orientation: "vertical"
|
|
61
|
-
}, getCurrentTab);
|
|
62
|
-
} else {
|
|
63
|
-
modalContent = createElement(NavigatorProvider, {
|
|
64
|
-
initialPath: "/",
|
|
65
|
-
className: "interface-preferences__provider"
|
|
66
|
-
}, createElement(NavigatorScreen, {
|
|
67
|
-
path: "/"
|
|
68
|
-
}, createElement(Card, {
|
|
69
|
-
isBorderless: true,
|
|
70
|
-
size: "small"
|
|
71
|
-
}, createElement(CardBody, null, createElement(ItemGroup, null, tabs.map(tab => {
|
|
72
|
-
return createElement(NavigatorButton, {
|
|
73
|
-
key: tab.name,
|
|
74
|
-
path: tab.name,
|
|
75
|
-
as: Item,
|
|
76
|
-
isAction: true
|
|
77
|
-
}, createElement(HStack, {
|
|
78
|
-
justify: "space-between"
|
|
79
|
-
}, createElement(FlexItem, null, createElement(Truncate, null, tab.title)), createElement(FlexItem, null, createElement(Icon, {
|
|
80
|
-
icon: isRTL() ? chevronLeft : chevronRight
|
|
81
|
-
}))));
|
|
82
|
-
}))))), sections.length && sections.map(section => {
|
|
83
|
-
return createElement(NavigatorScreen, {
|
|
84
|
-
key: `${section.name}-menu`,
|
|
85
|
-
path: section.name
|
|
86
|
-
}, createElement(Card, {
|
|
87
|
-
isBorderless: true,
|
|
88
|
-
size: "large"
|
|
89
|
-
}, createElement(CardHeader, {
|
|
90
|
-
isBorderless: false,
|
|
91
|
-
justify: "left",
|
|
92
|
-
size: "small",
|
|
93
|
-
gap: "6"
|
|
94
|
-
}, createElement(NavigatorBackButton, {
|
|
95
|
-
icon: isRTL() ? chevronRight : chevronLeft,
|
|
96
|
-
"aria-label": __('Navigate to the previous view')
|
|
97
|
-
}), createElement(Text, {
|
|
98
|
-
size: "16"
|
|
99
|
-
}, section.tabLabel)), createElement(CardBody, null, section.content)));
|
|
100
|
-
}));
|
|
101
|
-
}
|
|
102
|
-
return modalContent;
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useViewportMatch","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","__experimentalNavigatorButton","NavigatorButton","__experimentalNavigatorBackButton","NavigatorBackButton","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalHStack","HStack","__experimentalText","Text","__experimentalTruncate","Truncate","FlexItem","TabPanel","Card","CardHeader","CardBody","useMemo","useCallback","useState","chevronLeft","chevronRight","Icon","isRTL","__","PREFERENCES_MENU","PreferencesModalTabs","sections","isLargeViewport","activeMenu","setActiveMenu","tabs","sectionsContentMap","mappedTabs","length","reduce","accumulator","name","tabLabel","title","content","push","getCurrentTab","tab","modalContent","createElement","className","initialTabName","undefined","onSelect","orientation","initialPath","path","isBorderless","size","map","key","as","isAction","justify","icon","section","gap"],"sources":["@wordpress/interface/src/components/preferences-modal-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\tFlexItem,\n\tTabPanel,\n\tCard,\n\tCardHeader,\n\tCardBody,\n} from '@wordpress/components';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\n\nconst PREFERENCES_MENU = 'preferences-menu';\n\nexport default function PreferencesModalTabs( { sections } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\t// This is also used to sync the two different rendered components\n\t// between small and large viewports.\n\tconst [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );\n\t/**\n\t * Create helper objects from `sections` for easier data handling.\n\t * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`\n\t * is used for easier access to active tab's content.\n\t */\n\tconst { tabs, sectionsContentMap } = useMemo( () => {\n\t\tlet mappedTabs = {\n\t\t\ttabs: [],\n\t\t\tsectionsContentMap: {},\n\t\t};\n\t\tif ( sections.length ) {\n\t\t\tmappedTabs = sections.reduce(\n\t\t\t\t( accumulator, { name, tabLabel: title, content } ) => {\n\t\t\t\t\taccumulator.tabs.push( { name, title } );\n\t\t\t\t\taccumulator.sectionsContentMap[ name ] = content;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ tabs: [], sectionsContentMap: {} }\n\t\t\t);\n\t\t}\n\t\treturn mappedTabs;\n\t}, [ sections ] );\n\n\tconst getCurrentTab = useCallback(\n\t\t( tab ) => sectionsContentMap[ tab.name ] || null,\n\t\t[ sectionsContentMap ]\n\t);\n\n\tlet modalContent;\n\t// We render different components based on the viewport size.\n\tif ( isLargeViewport ) {\n\t\tmodalContent = (\n\t\t\t<TabPanel\n\t\t\t\tclassName=\"interface-preferences__tabs\"\n\t\t\t\ttabs={ tabs }\n\t\t\t\tinitialTabName={\n\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t}\n\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\torientation=\"vertical\"\n\t\t\t>\n\t\t\t\t{ getCurrentTab }\n\t\t\t</TabPanel>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<NavigatorProvider\n\t\t\t\tinitialPath=\"/\"\n\t\t\t\tclassName=\"interface-preferences__provider\"\n\t\t\t>\n\t\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t\t<Card isBorderless size=\"small\">\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tpath={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tas={ Item }\n\t\t\t\t\t\t\t\t\t\t\tisAction\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t</NavigatorButton>\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</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t</Card>\n\t\t\t\t</NavigatorScreen>\n\t\t\t\t{ sections.length &&\n\t\t\t\t\tsections.map( ( section ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<NavigatorScreen\n\t\t\t\t\t\t\t\tkey={ `${ section.name }-menu` }\n\t\t\t\t\t\t\t\tpath={ section.name }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Card isBorderless size=\"large\">\n\t\t\t\t\t\t\t\t\t<CardHeader\n\t\t\t\t\t\t\t\t\t\tisBorderless={ false }\n\t\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tgap=\"6\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<NavigatorBackButton\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Navigate to the previous view'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Text size=\"16\">\n\t\t\t\t\t\t\t\t\t\t\t{ section.tabLabel }\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t</CardHeader>\n\t\t\t\t\t\t\t\t\t<CardBody>{ section.content }</CardBody>\n\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t</NavigatorScreen>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t</NavigatorProvider>\n\t\t);\n\t}\n\n\treturn modalContent;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,EAChDC,6BAA6B,IAAIC,eAAe,EAChDC,iCAAiC,IAAIC,mBAAmB,EACxDC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,EAC1BC,sBAAsB,IAAIC,QAAQ,EAClCC,QAAQ,EACRC,QAAQ,EACRC,IAAI,EACJC,UAAU,EACVC,QAAQ,QACF,uBAAuB;AAC9B,SAASC,OAAO,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AACnE,SAASC,WAAW,EAAEC,YAAY,EAAEC,IAAI,QAAQ,kBAAkB;AAClE,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAE3C,MAAMC,gBAAgB,GAAG,kBAAkB;AAE3C,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,eAAe,GAAGnC,gBAAgB,CAAE,QAA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AAI,EACHrC,KAAK,CAAC,CAAC,GACJF,YAAY,GACZD,WACH;QACD,cAAaI,EAAE,CACd,+BACD;MAAG,CACH,CAAC,EACFqB,aAAA,CAACpC,IAAI;QAAC6C,IAAI,EAAC;MAAI,GACZO,OAAO,CAACvB,QACL,CACK,CAAC,EACbO,aAAA,CAAC7B,QAAQ,QAAG6C,OAAO,CAACrB,OAAmB,CAClC,CACU,CAAC;IAEpB,CAAE,CACe,CACnB;EACF;EAEA,OAAOI,YAAY;AACpB"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# PreferencesModal
|
|
2
|
-
|
|
3
|
-
`PreferencesModal` renders a modal with editor preferences. It can take a `PreferencesModalTabs` component, which accepts multiple tabs, and/or other child components. On small viewports, the modal is fullscreen.
|
|
4
|
-
|
|
5
|
-
This component implements a `Modal` component from the `@wordpress/components` package.
|
|
6
|
-
|
|
7
|
-
Sections passed to this component should use `PreferencesModalSection` component from the `@wordpress/interface` package.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Example
|
|
11
|
-
|
|
12
|
-
```jsx
|
|
13
|
-
function MyEditorPreferencesModal() {
|
|
14
|
-
const { closeModal } = useDispatch( editPostStore );
|
|
15
|
-
const sections = [
|
|
16
|
-
{
|
|
17
|
-
name: 'section 1',
|
|
18
|
-
tabLabel: __( 'Section 1' ),
|
|
19
|
-
content: (
|
|
20
|
-
<PreferencesModalSection
|
|
21
|
-
title={ __( 'Publishing' ) }
|
|
22
|
-
description={ __(
|
|
23
|
-
'Change options related to publishing.'
|
|
24
|
-
) }
|
|
25
|
-
>
|
|
26
|
-
<EnablePublishSidebarOption
|
|
27
|
-
help={ __(
|
|
28
|
-
'Review settings, such as visibility and tags.'
|
|
29
|
-
) }
|
|
30
|
-
label={ __(
|
|
31
|
-
'Enable pre-publish checks'
|
|
32
|
-
) }
|
|
33
|
-
/>
|
|
34
|
-
</PreferencesModalSection>
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
{
|
|
39
|
-
name: 'section 2',
|
|
40
|
-
tabLabel: __( 'Section 2' ),
|
|
41
|
-
content: (
|
|
42
|
-
<PreferencesModalSection
|
|
43
|
-
title={ __( 'Additional' ) }
|
|
44
|
-
description={ __(
|
|
45
|
-
'Add extra areas to the editor.'
|
|
46
|
-
) }
|
|
47
|
-
>
|
|
48
|
-
// Section content here
|
|
49
|
-
</PreferencesModalSection>
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
return (
|
|
55
|
-
<PreferencesModal closeModal={ closeModal }>
|
|
56
|
-
<PreferencesModalTabs sections={ sections } />
|
|
57
|
-
<PreferencesModal />
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Props
|
|
63
|
-
|
|
64
|
-
### closeModal
|
|
65
|
-
|
|
66
|
-
A function to call when closing the modal.
|
|
67
|
-
|
|
68
|
-
- Type: `Function`
|
|
69
|
-
- Required: Yes.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Modal } from '@wordpress/components';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
|
|
7
|
-
export default function PreferencesModal( { closeModal, children } ) {
|
|
8
|
-
return (
|
|
9
|
-
<Modal
|
|
10
|
-
className="interface-preferences-modal"
|
|
11
|
-
title={ __( 'Preferences' ) }
|
|
12
|
-
onRequestClose={ closeModal }
|
|
13
|
-
>
|
|
14
|
-
{ children }
|
|
15
|
-
</Modal>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.interface-preferences-modal {
|
|
2
|
-
// To keep modal dimensions consistent as subsections are navigated, width
|
|
3
|
-
// and height are used instead of max-(width/height).
|
|
4
|
-
@include break-small() {
|
|
5
|
-
width: calc(100% - #{ $grid-unit-20 * 2 });
|
|
6
|
-
height: calc(100% - #{ $header-height * 2 });
|
|
7
|
-
}
|
|
8
|
-
@include break-medium() {
|
|
9
|
-
width: $break-medium - $grid-unit-20 * 2;
|
|
10
|
-
}
|
|
11
|
-
@include break-large() {
|
|
12
|
-
height: 70%;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Clears spacing to flush fit the navigator component to the modal edges.
|
|
16
|
-
@media (max-width: #{ ($break-medium - 1) }) {
|
|
17
|
-
.components-modal__content {
|
|
18
|
-
padding: 0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#__unstablePreferencesModalBaseOption
|
|
2
|
-
|
|
3
|
-
`__unstablePreferencesModalBaseOption` renders a toggle meant to be used with `PreferencesModal`.
|
|
4
|
-
|
|
5
|
-
This component implements a `ToggleControl` component from the `@wordpress/components` package.
|
|
6
|
-
|
|
7
|
-
**It is an unstable component so is subject to breaking changes at any moment. Use at own risk.**
|
|
8
|
-
|
|
9
|
-
## Example
|
|
10
|
-
|
|
11
|
-
```jsx
|
|
12
|
-
function MyEditorPreferencesOption() {
|
|
13
|
-
return (
|
|
14
|
-
<__unstablePreferencesModalBaseOption
|
|
15
|
-
label={ label }
|
|
16
|
-
isChecked={ isChecked }
|
|
17
|
-
onChange={ setIsChecked }
|
|
18
|
-
>
|
|
19
|
-
{ isChecked !== areCustomFieldsEnabled && (
|
|
20
|
-
<CustomFieldsConfirmation willEnable={ isChecked } />
|
|
21
|
-
) }
|
|
22
|
-
</__unstablePreferencesModalBaseOption>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Props
|
|
28
|
-
|
|
29
|
-
### help
|
|
30
|
-
### label
|
|
31
|
-
### isChecked
|
|
32
|
-
### onChange
|
|
33
|
-
|
|
34
|
-
These props are passed directly to ToggleControl, so see [ToggleControl readme](https://github.com/WordPress/gutenberg/blob/trunk/packages/components/src/toggle-control/README.md) for more info.
|
|
35
|
-
|
|
36
|
-
### children
|
|
37
|
-
|
|
38
|
-
Components to be rendered as content.
|
|
39
|
-
|
|
40
|
-
- Type: `Element`
|
|
41
|
-
- Required: No.
|
|
42
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { ToggleControl } from '@wordpress/components';
|
|
5
|
-
|
|
6
|
-
function BaseOption( { help, label, isChecked, onChange, children } ) {
|
|
7
|
-
return (
|
|
8
|
-
<div className="interface-preferences-modal__option">
|
|
9
|
-
<ToggleControl
|
|
10
|
-
__nextHasNoMarginBottom
|
|
11
|
-
help={ help }
|
|
12
|
-
label={ label }
|
|
13
|
-
checked={ isChecked }
|
|
14
|
-
onChange={ onChange }
|
|
15
|
-
/>
|
|
16
|
-
{ children }
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default BaseOption;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
`PreferencesModalSection` renders a section (as a fieldset) meant to be used with `PreferencesModal`.
|
|
3
|
-
|
|
4
|
-
## Example
|
|
5
|
-
|
|
6
|
-
See the `PreferencesModal` readme for usage info.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Props
|
|
10
|
-
|
|
11
|
-
### title
|
|
12
|
-
|
|
13
|
-
The title of the section
|
|
14
|
-
|
|
15
|
-
- Type: `String`
|
|
16
|
-
- Required: Yes.
|
|
17
|
-
|
|
18
|
-
### description
|
|
19
|
-
|
|
20
|
-
The description for the section.
|
|
21
|
-
|
|
22
|
-
- Type: `String`
|
|
23
|
-
- Required: No.
|
|
24
|
-
|
|
25
|
-
### children
|
|
26
|
-
|
|
27
|
-
Components to be rendered as content.
|
|
28
|
-
|
|
29
|
-
- Type: `Element`
|
|
30
|
-
- Required: Yes.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const Section = ( { description, title, children } ) => (
|
|
2
|
-
<fieldset className="interface-preferences-modal__section">
|
|
3
|
-
<legend className="interface-preferences-modal__section-legend">
|
|
4
|
-
<h2 className="interface-preferences-modal__section-title">
|
|
5
|
-
{ title }
|
|
6
|
-
</h2>
|
|
7
|
-
{ description && (
|
|
8
|
-
<p className="interface-preferences-modal__section-description">
|
|
9
|
-
{ description }
|
|
10
|
-
</p>
|
|
11
|
-
) }
|
|
12
|
-
</legend>
|
|
13
|
-
<div className="interface-preferences-modal__section-content">
|
|
14
|
-
{ children }
|
|
15
|
-
</div>
|
|
16
|
-
</fieldset>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
export default Section;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
.interface-preferences-modal__section {
|
|
2
|
-
margin: 0 0 2.5rem 0;
|
|
3
|
-
|
|
4
|
-
&:last-child {
|
|
5
|
-
margin: 0;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.interface-preferences-modal__section-legend {
|
|
10
|
-
margin-bottom: $grid-unit-10;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.interface-preferences-modal__section-title {
|
|
14
|
-
font-size: 0.9rem;
|
|
15
|
-
font-weight: 600;
|
|
16
|
-
margin-top: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.interface-preferences-modal__section-description {
|
|
20
|
-
margin: -$grid-unit-10 0 $grid-unit-10 0;
|
|
21
|
-
font-size: $helptext-font-size;
|
|
22
|
-
font-style: normal;
|
|
23
|
-
color: $gray-700;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.interface-preferences-modal__section:has(.interface-preferences-modal__section-content:empty) {
|
|
27
|
-
display: none;
|
|
28
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# PreferencesModalTabs
|
|
2
|
-
|
|
3
|
-
`PreferencesModalTabs` creates a tabbed interface meant to be used inside a `PreferencesModal`. Markup differs between small and large viewports; on small the tabs are closed by default.
|
|
4
|
-
|
|
5
|
-
## Example
|
|
6
|
-
|
|
7
|
-
See the `PreferencesModal` readme for usage info.
|
|
8
|
-
## Props
|
|
9
|
-
### sections
|
|
10
|
-
|
|
11
|
-
Sections to populate the modal with. Takes an array of objects, where each should include `name`, `tablabel` and `content`.
|
|
12
|
-
|
|
13
|
-
- Type: `Array`
|
|
14
|
-
- Required: Yes.
|