@wordpress/interface 4.2.2-next.f435e9e01b.0 → 4.2.4-next.a55ed9455a.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 +1 -1
- package/build/components/fullscreen-mode/index.js +1 -1
- package/build/components/fullscreen-mode/index.js.map +1 -1
- package/build/components/index.js +32 -0
- package/build/components/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +29 -0
- package/build/components/preferences-modal/index.js.map +1 -0
- package/build/components/preferences-modal-base-option/index.js +35 -0
- package/build/components/preferences-modal-base-option/index.js.map +1 -0
- package/build/components/preferences-modal-section/index.js +27 -0
- package/build/components/preferences-modal-section/index.js.map +1 -0
- package/build/components/preferences-modal-tabs/index.js +121 -0
- package/build/components/preferences-modal-tabs/index.js.map +1 -0
- package/build/store/index.js +9 -15
- package/build/store/index.js.map +1 -1
- package/build-module/components/fullscreen-mode/index.js +1 -1
- package/build-module/components/fullscreen-mode/index.js.map +1 -1
- package/build-module/components/index.js +4 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +20 -0
- package/build-module/components/preferences-modal/index.js.map +1 -0
- package/build-module/components/preferences-modal-base-option/index.js +27 -0
- package/build-module/components/preferences-modal-base-option/index.js.map +1 -0
- package/build-module/components/preferences-modal-section/index.js +19 -0
- package/build-module/components/preferences-modal-section/index.js.map +1 -0
- package/build-module/components/preferences-modal-tabs/index.js +110 -0
- package/build-module/components/preferences-modal-tabs/index.js.map +1 -0
- package/build-module/store/index.js +8 -14
- package/build-module/store/index.js.map +1 -1
- package/build-style/style-rtl.css +89 -0
- package/build-style/style.css +89 -0
- package/package.json +15 -11
- package/src/components/fullscreen-mode/index.js +1 -1
- package/src/components/fullscreen-mode/test/index.js +3 -3
- package/src/components/index.js +4 -0
- package/src/components/more-menu-dropdown/style.scss +1 -1
- package/src/components/preferences-modal/README.md +69 -0
- package/src/components/preferences-modal/index.js +18 -0
- package/src/components/preferences-modal/style.scss +25 -0
- package/src/components/preferences-modal-base-option/README.md +42 -0
- package/src/components/preferences-modal-base-option/index.js +20 -0
- package/src/components/preferences-modal-base-option/style.scss +21 -0
- package/src/components/preferences-modal-section/README.md +30 -0
- package/src/components/preferences-modal-section/index.js +17 -0
- package/src/components/preferences-modal-section/style.scss +20 -0
- package/src/components/preferences-modal-tabs/README.md +14 -0
- package/src/components/preferences-modal-tabs/index.js +156 -0
- package/src/components/preferences-modal-tabs/style.scss +35 -0
- package/src/store/index.js +9 -14
- package/src/style.scss +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/preferences-modal-tabs/index.js"],"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","undefined","map","section"],"mappings":"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","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"]}
|
|
@@ -10,6 +10,12 @@ import reducer from './reducer';
|
|
|
10
10
|
import * as actions from './actions';
|
|
11
11
|
import * as selectors from './selectors';
|
|
12
12
|
import { STORE_NAME } from './constants';
|
|
13
|
+
const storeConfig = {
|
|
14
|
+
reducer,
|
|
15
|
+
actions,
|
|
16
|
+
selectors,
|
|
17
|
+
persist: ['enableItems', 'preferences']
|
|
18
|
+
};
|
|
13
19
|
/**
|
|
14
20
|
* Store definition for the interface namespace.
|
|
15
21
|
*
|
|
@@ -18,20 +24,8 @@ import { STORE_NAME } from './constants';
|
|
|
18
24
|
* @type {Object}
|
|
19
25
|
*/
|
|
20
26
|
|
|
21
|
-
export const store = createReduxStore(STORE_NAME,
|
|
22
|
-
reducer,
|
|
23
|
-
actions,
|
|
24
|
-
selectors,
|
|
25
|
-
persist: ['enableItems', 'preferences'],
|
|
26
|
-
__experimentalUseThunks: true
|
|
27
|
-
}); // Once we build a more generic persistence plugin that works across types of stores
|
|
27
|
+
export const store = createReduxStore(STORE_NAME, storeConfig); // Once we build a more generic persistence plugin that works across types of stores
|
|
28
28
|
// we'd be able to replace this with a register call.
|
|
29
29
|
|
|
30
|
-
registerStore(STORE_NAME,
|
|
31
|
-
reducer,
|
|
32
|
-
actions,
|
|
33
|
-
selectors,
|
|
34
|
-
persist: ['enableItems', 'preferences'],
|
|
35
|
-
__experimentalUseThunks: true
|
|
36
|
-
});
|
|
30
|
+
registerStore(STORE_NAME, storeConfig);
|
|
37
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["createReduxStore","registerStore","reducer","actions","selectors","STORE_NAME","
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["createReduxStore","registerStore","reducer","actions","selectors","STORE_NAME","storeConfig","persist","store"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,aAA3B,QAAgD,iBAAhD;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA,MAAMC,WAAW,GAAG;AACnBJ,EAAAA,OADmB;AAEnBC,EAAAA,OAFmB;AAGnBC,EAAAA,SAHmB;AAInBG,EAAAA,OAAO,EAAE,CAAE,aAAF,EAAiB,aAAjB;AAJU,CAApB;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,KAAK,GAAGR,gBAAgB,CAAEK,UAAF,EAAcC,WAAd,CAA9B,C,CAEP;AACA;;AACAL,aAAa,CAAEI,UAAF,EAAcC,WAAd,CAAb","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\nconst storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems', 'preferences' ],\n};\n\n/**\n * Store definition for the interface namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, storeConfig );\n"]}
|
|
@@ -445,4 +445,93 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
445
445
|
.interface-pinned-items .components-button svg {
|
|
446
446
|
max-width: 24px;
|
|
447
447
|
max-height: 24px;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
@media (min-width: 600px) {
|
|
451
|
+
.interface-preferences-modal {
|
|
452
|
+
width: calc(100% - 32px);
|
|
453
|
+
height: calc(100% - 120px);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
@media (min-width: 782px) {
|
|
457
|
+
.interface-preferences-modal {
|
|
458
|
+
width: 750px;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
@media (min-width: 960px) {
|
|
462
|
+
.interface-preferences-modal {
|
|
463
|
+
height: 70%;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
@media (max-width: 781px) {
|
|
467
|
+
.interface-preferences-modal .components-modal__content {
|
|
468
|
+
padding: 0;
|
|
469
|
+
}
|
|
470
|
+
.interface-preferences-modal .components-modal__content::before {
|
|
471
|
+
content: none;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.interface-preferences__tabs .components-tab-panel__tabs {
|
|
476
|
+
position: absolute;
|
|
477
|
+
top: 84px;
|
|
478
|
+
right: 16px;
|
|
479
|
+
width: 160px;
|
|
480
|
+
}
|
|
481
|
+
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item {
|
|
482
|
+
border-radius: 2px;
|
|
483
|
+
font-weight: 400;
|
|
484
|
+
}
|
|
485
|
+
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active {
|
|
486
|
+
background: #f0f0f0;
|
|
487
|
+
box-shadow: none;
|
|
488
|
+
font-weight: 500;
|
|
489
|
+
}
|
|
490
|
+
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) {
|
|
491
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
492
|
+
}
|
|
493
|
+
.interface-preferences__tabs .components-tab-panel__tab-content {
|
|
494
|
+
padding-right: 24px;
|
|
495
|
+
margin-right: 160px;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
@media (max-width: 781px) {
|
|
499
|
+
.interface-preferences__provider {
|
|
500
|
+
height: 100%;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
.interface-preferences-modal__section {
|
|
504
|
+
margin: 0 0 2.5rem 0;
|
|
505
|
+
}
|
|
506
|
+
.interface-preferences-modal__section:last-child {
|
|
507
|
+
margin: 0;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.interface-preferences-modal__section-title {
|
|
511
|
+
font-size: 0.9rem;
|
|
512
|
+
font-weight: 600;
|
|
513
|
+
margin-top: 0;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.interface-preferences-modal__section-description {
|
|
517
|
+
margin: -8px 0 8px 0;
|
|
518
|
+
font-size: 12px;
|
|
519
|
+
font-style: normal;
|
|
520
|
+
color: #757575;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.interface-preferences-modal__option .components-base-control .components-base-control__field {
|
|
524
|
+
align-items: center;
|
|
525
|
+
display: flex;
|
|
526
|
+
margin-bottom: 0;
|
|
527
|
+
}
|
|
528
|
+
.interface-preferences-modal__option .components-base-control .components-base-control__field > label {
|
|
529
|
+
flex-grow: 1;
|
|
530
|
+
padding: 0.6rem 10px 0.6rem 0;
|
|
531
|
+
}
|
|
532
|
+
.interface-preferences-modal__option .components-base-control__help {
|
|
533
|
+
margin: -8px 58px 8px 0;
|
|
534
|
+
font-size: 12px;
|
|
535
|
+
font-style: normal;
|
|
536
|
+
color: #757575;
|
|
448
537
|
}
|
package/build-style/style.css
CHANGED
|
@@ -445,4 +445,93 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
445
445
|
.interface-pinned-items .components-button svg {
|
|
446
446
|
max-width: 24px;
|
|
447
447
|
max-height: 24px;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
@media (min-width: 600px) {
|
|
451
|
+
.interface-preferences-modal {
|
|
452
|
+
width: calc(100% - 32px);
|
|
453
|
+
height: calc(100% - 120px);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
@media (min-width: 782px) {
|
|
457
|
+
.interface-preferences-modal {
|
|
458
|
+
width: 750px;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
@media (min-width: 960px) {
|
|
462
|
+
.interface-preferences-modal {
|
|
463
|
+
height: 70%;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
@media (max-width: 781px) {
|
|
467
|
+
.interface-preferences-modal .components-modal__content {
|
|
468
|
+
padding: 0;
|
|
469
|
+
}
|
|
470
|
+
.interface-preferences-modal .components-modal__content::before {
|
|
471
|
+
content: none;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.interface-preferences__tabs .components-tab-panel__tabs {
|
|
476
|
+
position: absolute;
|
|
477
|
+
top: 84px;
|
|
478
|
+
left: 16px;
|
|
479
|
+
width: 160px;
|
|
480
|
+
}
|
|
481
|
+
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item {
|
|
482
|
+
border-radius: 2px;
|
|
483
|
+
font-weight: 400;
|
|
484
|
+
}
|
|
485
|
+
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active {
|
|
486
|
+
background: #f0f0f0;
|
|
487
|
+
box-shadow: none;
|
|
488
|
+
font-weight: 500;
|
|
489
|
+
}
|
|
490
|
+
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) {
|
|
491
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
492
|
+
}
|
|
493
|
+
.interface-preferences__tabs .components-tab-panel__tab-content {
|
|
494
|
+
padding-left: 24px;
|
|
495
|
+
margin-left: 160px;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
@media (max-width: 781px) {
|
|
499
|
+
.interface-preferences__provider {
|
|
500
|
+
height: 100%;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
.interface-preferences-modal__section {
|
|
504
|
+
margin: 0 0 2.5rem 0;
|
|
505
|
+
}
|
|
506
|
+
.interface-preferences-modal__section:last-child {
|
|
507
|
+
margin: 0;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.interface-preferences-modal__section-title {
|
|
511
|
+
font-size: 0.9rem;
|
|
512
|
+
font-weight: 600;
|
|
513
|
+
margin-top: 0;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.interface-preferences-modal__section-description {
|
|
517
|
+
margin: -8px 0 8px 0;
|
|
518
|
+
font-size: 12px;
|
|
519
|
+
font-style: normal;
|
|
520
|
+
color: #757575;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.interface-preferences-modal__option .components-base-control .components-base-control__field {
|
|
524
|
+
align-items: center;
|
|
525
|
+
display: flex;
|
|
526
|
+
margin-bottom: 0;
|
|
527
|
+
}
|
|
528
|
+
.interface-preferences-modal__option .components-base-control .components-base-control__field > label {
|
|
529
|
+
flex-grow: 1;
|
|
530
|
+
padding: 0.6rem 0 0.6rem 10px;
|
|
531
|
+
}
|
|
532
|
+
.interface-preferences-modal__option .components-base-control__help {
|
|
533
|
+
margin: -8px 0 8px 58px;
|
|
534
|
+
font-size: 12px;
|
|
535
|
+
font-style: normal;
|
|
536
|
+
color: #757575;
|
|
448
537
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/interface",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4-next.a55ed9455a.0",
|
|
4
4
|
"description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,20 +32,24 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
|
-
"@wordpress/a11y": "^3.3.
|
|
36
|
-
"@wordpress/components": "^19.
|
|
37
|
-
"@wordpress/compose": "^5.1.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/element": "^4.1.
|
|
40
|
-
"@wordpress/i18n": "^4.3.
|
|
41
|
-
"@wordpress/icons": "^
|
|
42
|
-
"@wordpress/plugins": "^4.1.
|
|
43
|
-
"@wordpress/viewport": "^4.1.
|
|
35
|
+
"@wordpress/a11y": "^3.3.2-next.a55ed9455a.0",
|
|
36
|
+
"@wordpress/components": "^19.6.1-next.a55ed9455a.0",
|
|
37
|
+
"@wordpress/compose": "^5.1.3-next.a55ed9455a.0",
|
|
38
|
+
"@wordpress/data": "^6.3.1-next.a55ed9455a.0",
|
|
39
|
+
"@wordpress/element": "^4.1.3-next.a55ed9455a.0",
|
|
40
|
+
"@wordpress/i18n": "^4.3.2-next.a55ed9455a.0",
|
|
41
|
+
"@wordpress/icons": "^7.0.2-next.a55ed9455a.0",
|
|
42
|
+
"@wordpress/plugins": "^4.1.4-next.a55ed9455a.0",
|
|
43
|
+
"@wordpress/viewport": "^4.1.3-next.a55ed9455a.0",
|
|
44
44
|
"classnames": "^2.3.1",
|
|
45
45
|
"lodash": "^4.17.21"
|
|
46
46
|
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": "^17.0.0",
|
|
49
|
+
"react-dom": "^17.0.0"
|
|
50
|
+
},
|
|
47
51
|
"publishConfig": {
|
|
48
52
|
"access": "public"
|
|
49
53
|
},
|
|
50
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "c5108185851b824d531bce55991a3589947e8551"
|
|
51
55
|
}
|
|
@@ -9,7 +9,7 @@ const FullscreenMode = ( { isActive } ) => {
|
|
|
9
9
|
// `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
|
|
10
10
|
// `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
|
|
11
11
|
// even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as
|
|
12
|
-
// a consequence of the FullscreenMode setup
|
|
12
|
+
// a consequence of the FullscreenMode setup.
|
|
13
13
|
if ( document.body.classList.contains( 'sticky-menu' ) ) {
|
|
14
14
|
isSticky = true;
|
|
15
15
|
document.body.classList.remove( 'sticky-menu' );
|
|
@@ -51,7 +51,7 @@ describe( 'FullscreenMode', () => {
|
|
|
51
51
|
} );
|
|
52
52
|
|
|
53
53
|
it( 'fullscreen mode to be removed from document body when component unmounted', () => {
|
|
54
|
-
//
|
|
54
|
+
// Not present initially.
|
|
55
55
|
expect( document.body.classList.contains( 'is-fullscreen-mode' ) ).toBe(
|
|
56
56
|
false
|
|
57
57
|
);
|
|
@@ -59,7 +59,7 @@ describe( 'FullscreenMode', () => {
|
|
|
59
59
|
act( () => {
|
|
60
60
|
mode = create( <FullscreenMode isActive /> );
|
|
61
61
|
} );
|
|
62
|
-
//
|
|
62
|
+
// Present after mounting with `isActive`
|
|
63
63
|
expect( document.body.classList.contains( 'is-fullscreen-mode' ) ).toBe(
|
|
64
64
|
true
|
|
65
65
|
);
|
|
@@ -68,7 +68,7 @@ describe( 'FullscreenMode', () => {
|
|
|
68
68
|
mode.unmount();
|
|
69
69
|
} );
|
|
70
70
|
|
|
71
|
-
//
|
|
71
|
+
// Removed after unmounting.
|
|
72
72
|
expect( document.body.classList.contains( 'is-fullscreen-mode' ) ).toBe(
|
|
73
73
|
false
|
|
74
74
|
);
|
package/src/components/index.js
CHANGED
|
@@ -6,3 +6,7 @@ export { default as PinnedItems } from './pinned-items';
|
|
|
6
6
|
export { default as MoreMenuDropdown } from './more-menu-dropdown';
|
|
7
7
|
export { default as MoreMenuFeatureToggle } from './more-menu-feature-toggle';
|
|
8
8
|
export { default as ActionItem } from './action-item';
|
|
9
|
+
export { default as PreferencesModal } from './preferences-modal';
|
|
10
|
+
export { default as PreferencesModalTabs } from './preferences-modal-tabs';
|
|
11
|
+
export { default as PreferencesModalSection } from './preferences-modal-section';
|
|
12
|
+
export { default as ___unstablePreferencesModalBaseOption } from './preferences-modal-base-option';
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
'Include pre-publish checklist'
|
|
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.
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
closeLabel={ __( 'Close' ) }
|
|
13
|
+
onRequestClose={ closeModal }
|
|
14
|
+
>
|
|
15
|
+
{ children }
|
|
16
|
+
</Modal>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
&::before {
|
|
21
|
+
content: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
help={ help }
|
|
11
|
+
label={ label }
|
|
12
|
+
checked={ isChecked }
|
|
13
|
+
onChange={ onChange }
|
|
14
|
+
/>
|
|
15
|
+
{ children }
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default BaseOption;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.interface-preferences-modal__option {
|
|
2
|
+
.components-base-control {
|
|
3
|
+
.components-base-control__field {
|
|
4
|
+
align-items: center;
|
|
5
|
+
display: flex;
|
|
6
|
+
margin-bottom: 0;
|
|
7
|
+
|
|
8
|
+
& > label {
|
|
9
|
+
flex-grow: 1;
|
|
10
|
+
padding: 0.6rem 0 0.6rem 10px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.components-base-control__help {
|
|
16
|
+
margin: -$grid-unit-10 0 $grid-unit-10 58px;
|
|
17
|
+
font-size: $helptext-font-size;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
color: $gray-700;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Section = ( { description, title, children } ) => (
|
|
2
|
+
<fieldset className="interface-preferences-modal__section">
|
|
3
|
+
<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
|
+
{ children }
|
|
14
|
+
</fieldset>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default Section;
|
|
@@ -0,0 +1,20 @@
|
|
|
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-title {
|
|
10
|
+
font-size: 0.9rem;
|
|
11
|
+
font-weight: 600;
|
|
12
|
+
margin-top: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.interface-preferences-modal__section-description {
|
|
16
|
+
margin: -$grid-unit-10 0 $grid-unit-10 0;
|
|
17
|
+
font-size: $helptext-font-size;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
color: $gray-700;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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.
|