@wordpress/interface 4.20.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -1
- package/build/components/interface-skeleton/index.js +26 -40
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build/components/navigable-region/index.js +36 -0
- package/build/components/navigable-region/index.js.map +1 -0
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +25 -40
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-module/components/navigable-region/index.js +25 -0
- package/build-module/components/navigable-region/index.js.map +1 -0
- package/build-style/style-rtl.css +27 -3
- package/build-style/style.css +27 -3
- package/complementary-area-context/index.js +12 -0
- package/package.json +15 -15
- package/src/components/index.js +1 -0
- package/src/components/interface-skeleton/index.js +30 -49
- package/src/components/interface-skeleton/style.scss +23 -4
- package/src/components/navigable-region/README.md +36 -0
- package/src/components/navigable-region/index.js +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 5.0.0 (2022-12-14)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- Updated dependencies to require React 18 ([45235](https://github.com/WordPress/gutenberg/pull/45235))
|
|
10
|
+
|
|
11
|
+
## 4.21.0 (2022-11-16)
|
|
12
|
+
|
|
5
13
|
## 4.20.0 (2022-11-02)
|
|
6
14
|
|
|
7
15
|
## 4.19.0 (2022-10-19)
|
|
@@ -47,6 +47,12 @@ Object.defineProperty(exports, "MoreMenuFeatureToggle", {
|
|
|
47
47
|
return _moreMenuFeatureToggle.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
+
Object.defineProperty(exports, "NavigableRegion", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return _navigableRegion.default;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
50
56
|
Object.defineProperty(exports, "PinnedItems", {
|
|
51
57
|
enumerable: true,
|
|
52
58
|
get: function () {
|
|
@@ -101,4 +107,6 @@ var _preferencesModalTabs = _interopRequireDefault(require("./preferences-modal-
|
|
|
101
107
|
var _preferencesModalSection = _interopRequireDefault(require("./preferences-modal-section"));
|
|
102
108
|
|
|
103
109
|
var _preferencesModalBaseOption = _interopRequireDefault(require("./preferences-modal-base-option"));
|
|
110
|
+
|
|
111
|
+
var _navigableRegion = _interopRequireDefault(require("./navigable-region"));
|
|
104
112
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { default as ComplementaryArea } from './complementary-area';\nexport { default as ComplementaryAreaMoreMenuItem } from './complementary-area-more-menu-item';\nexport { default as FullscreenMode } from './fullscreen-mode';\nexport { default as InterfaceSkeleton } from './interface-skeleton';\nexport { default as PinnedItems } from './pinned-items';\nexport { default as MoreMenuDropdown } from './more-menu-dropdown';\nexport { default as MoreMenuFeatureToggle } from './more-menu-feature-toggle';\nexport { default as ActionItem } from './action-item';\nexport { default as PreferencesModal } from './preferences-modal';\nexport { default as PreferencesModalTabs } from './preferences-modal-tabs';\nexport { default as PreferencesModalSection } from './preferences-modal-section';\nexport { default as ___unstablePreferencesModalBaseOption } from './preferences-modal-base-option';\nexport { default as NavigableRegion } from './navigable-region';\n"]}
|
|
@@ -19,6 +19,8 @@ var _i18n = require("@wordpress/i18n");
|
|
|
19
19
|
|
|
20
20
|
var _compose = require("@wordpress/compose");
|
|
21
21
|
|
|
22
|
+
var _navigableRegion = _interopRequireDefault(require("../navigable-region"));
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* External dependencies
|
|
24
26
|
*/
|
|
@@ -26,6 +28,10 @@ var _compose = require("@wordpress/compose");
|
|
|
26
28
|
/**
|
|
27
29
|
* WordPress dependencies
|
|
28
30
|
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Internal dependencies
|
|
34
|
+
*/
|
|
29
35
|
function useHTMLClass(className) {
|
|
30
36
|
(0, _element.useEffect)(() => {
|
|
31
37
|
const element = document && document.querySelector(`html:not(.${className})`);
|
|
@@ -51,18 +57,16 @@ function InterfaceSkeleton(_ref, ref) {
|
|
|
51
57
|
secondarySidebar,
|
|
52
58
|
notices,
|
|
53
59
|
content,
|
|
54
|
-
drawer,
|
|
55
60
|
actions,
|
|
56
61
|
labels,
|
|
57
62
|
className,
|
|
63
|
+
// Todo: does this need to be a prop.
|
|
64
|
+
// Can we use a dependency to keyboard-shortcuts directly?
|
|
58
65
|
shortcuts
|
|
59
66
|
} = _ref;
|
|
60
67
|
const navigateRegionsProps = (0, _components.__unstableUseNavigateRegions)(shortcuts);
|
|
61
68
|
useHTMLClass('interface-interface-skeleton__html-container');
|
|
62
69
|
const defaultLabels = {
|
|
63
|
-
/* translators: accessibility text for the nav bar landmark region. */
|
|
64
|
-
drawer: (0, _i18n.__)('Drawer'),
|
|
65
|
-
|
|
66
70
|
/* translators: accessibility text for the top bar landmark region. */
|
|
67
71
|
header: (0, _i18n.__)('Header'),
|
|
68
72
|
|
|
@@ -102,61 +106,43 @@ function InterfaceSkeleton(_ref, ref) {
|
|
|
102
106
|
return (0, _element.createElement)("div", (0, _extends2.default)({}, navigateRegionsProps, {
|
|
103
107
|
ref: (0, _compose.useMergeRefs)([ref, navigateRegionsProps.ref]),
|
|
104
108
|
className: (0, _classnames.default)(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
|
|
105
|
-
}),
|
|
106
|
-
className: "interface-interface-skeleton__drawer",
|
|
107
|
-
role: "region",
|
|
108
|
-
"aria-label": mergedLabels.drawer,
|
|
109
|
-
tabIndex: "-1"
|
|
110
|
-
}, drawer), (0, _element.createElement)("div", {
|
|
109
|
+
}), (0, _element.createElement)("div", {
|
|
111
110
|
className: "interface-interface-skeleton__editor"
|
|
112
|
-
}, !!header && isDistractionFree && (0, _element.createElement)(
|
|
111
|
+
}, !!header && isDistractionFree && (0, _element.createElement)(_navigableRegion.default, {
|
|
112
|
+
as: _components.__unstableMotion.div,
|
|
113
|
+
className: "interface-interface-skeleton__header",
|
|
114
|
+
"aria-label": mergedLabels.header,
|
|
113
115
|
initial: isDistractionFree ? 'hidden' : 'hover',
|
|
114
116
|
whileHover: "hover",
|
|
115
117
|
variants: headerVariants,
|
|
116
118
|
transition: {
|
|
117
119
|
type: 'tween',
|
|
118
120
|
delay: 0.8
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
role: "region",
|
|
122
|
-
"aria-label": mergedLabels.header,
|
|
123
|
-
tabIndex: "-1"
|
|
124
|
-
}, header), !!header && !isDistractionFree && (0, _element.createElement)("div", {
|
|
121
|
+
}
|
|
122
|
+
}, header), !!header && !isDistractionFree && (0, _element.createElement)(_navigableRegion.default, {
|
|
125
123
|
className: "interface-interface-skeleton__header",
|
|
126
|
-
|
|
127
|
-
"aria-label": mergedLabels.header,
|
|
128
|
-
tabIndex: "-1"
|
|
124
|
+
ariaLabel: mergedLabels.header
|
|
129
125
|
}, header), isDistractionFree && (0, _element.createElement)("div", {
|
|
130
126
|
className: "interface-interface-skeleton__header"
|
|
131
127
|
}, editorNotices), (0, _element.createElement)("div", {
|
|
132
128
|
className: "interface-interface-skeleton__body"
|
|
133
|
-
}, !!secondarySidebar && (0, _element.createElement)(
|
|
129
|
+
}, !!secondarySidebar && (0, _element.createElement)(_navigableRegion.default, {
|
|
134
130
|
className: "interface-interface-skeleton__secondary-sidebar",
|
|
135
|
-
|
|
136
|
-
"aria-label": mergedLabels.secondarySidebar,
|
|
137
|
-
tabIndex: "-1"
|
|
131
|
+
ariaLabel: mergedLabels.secondarySidebar
|
|
138
132
|
}, secondarySidebar), !!notices && (0, _element.createElement)("div", {
|
|
139
133
|
className: "interface-interface-skeleton__notices"
|
|
140
|
-
}, notices), (0, _element.createElement)(
|
|
134
|
+
}, notices), (0, _element.createElement)(_navigableRegion.default, {
|
|
141
135
|
className: "interface-interface-skeleton__content",
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
tabIndex: "-1"
|
|
145
|
-
}, content), !!sidebar && (0, _element.createElement)("div", {
|
|
136
|
+
ariaLabel: mergedLabels.body
|
|
137
|
+
}, content), !!sidebar && (0, _element.createElement)(_navigableRegion.default, {
|
|
146
138
|
className: "interface-interface-skeleton__sidebar",
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
tabIndex: "-1"
|
|
150
|
-
}, sidebar), !!actions && (0, _element.createElement)("div", {
|
|
139
|
+
ariaLabel: mergedLabels.sidebar
|
|
140
|
+
}, sidebar), !!actions && (0, _element.createElement)(_navigableRegion.default, {
|
|
151
141
|
className: "interface-interface-skeleton__actions",
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
tabIndex: "-1"
|
|
155
|
-
}, actions))), !!footer && (0, _element.createElement)("div", {
|
|
142
|
+
ariaLabel: mergedLabels.actions
|
|
143
|
+
}, actions))), !!footer && (0, _element.createElement)(_navigableRegion.default, {
|
|
156
144
|
className: "interface-interface-skeleton__footer",
|
|
157
|
-
|
|
158
|
-
"aria-label": mergedLabels.footer,
|
|
159
|
-
tabIndex: "-1"
|
|
145
|
+
ariaLabel: mergedLabels.footer
|
|
160
146
|
}, footer));
|
|
161
147
|
}
|
|
162
148
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["useHTMLClass","className","element","document","querySelector","classList","toggle","InterfaceSkeleton","ref","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","notices","content","
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["useHTMLClass","className","element","document","querySelector","classList","toggle","InterfaceSkeleton","ref","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","notices","content","actions","labels","shortcuts","navigateRegionsProps","defaultLabels","body","mergedLabels","headerVariants","hidden","opacity","hover","transition","type","delay","delayChildren","motion","div"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AAIA;;AACA;;AAKA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,YAAT,CAAuBC,SAAvB,EAAmC;AAClC,0BAAW,MAAM;AAChB,UAAMC,OAAO,GACZC,QAAQ,IAAIA,QAAQ,CAACC,aAAT,CAAyB,aAAaH,SAAW,GAAjD,CADb;;AAEA,QAAK,CAAEC,OAAP,EAAiB;AAChB;AACA;;AACDA,IAAAA,OAAO,CAACG,SAAR,CAAkBC,MAAlB,CAA0BL,SAA1B;AACA,WAAO,MAAM;AACZC,MAAAA,OAAO,CAACG,SAAR,CAAkBC,MAAlB,CAA0BL,SAA1B;AACA,KAFD;AAGA,GAVD,EAUG,CAAEA,SAAF,CAVH;AAWA;;AAED,SAASM,iBAAT,OAiBCC,GAjBD,EAkBE;AAAA,MAjBD;AACCC,IAAAA,iBADD;AAECC,IAAAA,MAFD;AAGCC,IAAAA,MAHD;AAICC,IAAAA,aAJD;AAKCC,IAAAA,OALD;AAMCC,IAAAA,gBAND;AAOCC,IAAAA,OAPD;AAQCC,IAAAA,OARD;AASCC,IAAAA,OATD;AAUCC,IAAAA,MAVD;AAWCjB,IAAAA,SAXD;AAYC;AACA;AACAkB,IAAAA;AAdD,GAiBC;AACD,QAAMC,oBAAoB,GAAG,8CAAoBD,SAApB,CAA7B;AAEAnB,EAAAA,YAAY,CAAE,8CA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KAIGA,MAJH,CA5EF,CADD;AAsFA;;eAEc,yBAAYH,iBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableRegion from '../navigable-region';\n\nfunction useHTMLClass( className ) {\n\tuseEffect( () => {\n\t\tconst element =\n\t\t\tdocument && document.querySelector( `html:not(.${ className })` );\n\t\tif ( ! element ) {\n\t\t\treturn;\n\t\t}\n\t\telement.classList.toggle( className );\n\t\treturn () => {\n\t\t\telement.classList.toggle( className );\n\t\t};\n\t}, [ className ] );\n}\n\nfunction InterfaceSkeleton(\n\t{\n\t\tisDistractionFree,\n\t\tfooter,\n\t\theader,\n\t\teditorNotices,\n\t\tsidebar,\n\t\tsecondarySidebar,\n\t\tnotices,\n\t\tcontent,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t\t// Todo: does this need to be a prop.\n\t\t// Can we use a dependency to keyboard-shortcuts directly?\n\t\tshortcuts,\n\t},\n\tref\n) {\n\tconst navigateRegionsProps = useNavigateRegions( shortcuts );\n\n\tuseHTMLClass( 'interface-interface-skeleton__html-container' );\n\n\tconst defaultLabels = {\n\t\t/* translators: accessibility text for the top bar landmark region. */\n\t\theader: __( 'Header' ),\n\t\t/* translators: accessibility text for the content landmark region. */\n\t\tbody: __( 'Content' ),\n\t\t/* translators: accessibility text for the secondary sidebar landmark region. */\n\t\tsecondarySidebar: __( 'Block Library' ),\n\t\t/* translators: accessibility text for the settings landmark region. */\n\t\tsidebar: __( 'Settings' ),\n\t\t/* translators: accessibility text for the publish landmark region. */\n\t\tactions: __( 'Publish' ),\n\t\t/* translators: accessibility text for the footer landmark region. */\n\t\tfooter: __( 'Footer' ),\n\t};\n\n\tconst mergedLabels = { ...defaultLabels, ...labels };\n\n\tconst headerVariants = {\n\t\thidden: isDistractionFree ? { opacity: 0 } : { opacity: 1 },\n\t\thover: {\n\t\t\topacity: 1,\n\t\t\ttransition: { type: 'tween', delay: 0.2, delayChildren: 0.2 },\n\t\t},\n\t};\n\n\treturn (\n\t\t<div\n\t\t\t{ ...navigateRegionsProps }\n\t\t\tref={ useMergeRefs( [ ref, navigateRegionsProps.ref ] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\tclassName,\n\t\t\t\t'interface-interface-skeleton',\n\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t!! footer && 'has-footer'\n\t\t\t) }\n\t\t>\n\t\t\t<div className=\"interface-interface-skeleton__editor\">\n\t\t\t\t{ !! header && isDistractionFree && (\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\tinitial={ isDistractionFree ? 'hidden' : 'hover' }\n\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\tvariants={ headerVariants }\n\t\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t) }\n\t\t\t\t{ !! header && ! isDistractionFree && (\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\tariaLabel={ mergedLabels.header }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t) }\n\t\t\t\t{ isDistractionFree && (\n\t\t\t\t\t<div className=\"interface-interface-skeleton__header\">\n\t\t\t\t\t\t{ editorNotices }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"interface-interface-skeleton__body\">\n\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! notices && (\n\t\t\t\t\t\t<div className=\"interface-interface-skeleton__notices\">\n\t\t\t\t\t\t\t{ notices }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__content\"\n\t\t\t\t\t\tariaLabel={ mergedLabels.body }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t{ !! sidebar && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__sidebar\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.sidebar }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sidebar }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! actions && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__actions\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.actions }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ !! footer && (\n\t\t\t\t<NavigableRegion\n\t\t\t\t\tclassName=\"interface-interface-skeleton__footer\"\n\t\t\t\t\tariaLabel={ mergedLabels.footer }\n\t\t\t\t>\n\t\t\t\t\t{ footer }\n\t\t\t\t</NavigableRegion>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( InterfaceSkeleton );\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = NavigableRegion;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* External dependencies
|
|
18
|
+
*/
|
|
19
|
+
function NavigableRegion(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
className,
|
|
23
|
+
ariaLabel,
|
|
24
|
+
as: Tag = 'div',
|
|
25
|
+
...props
|
|
26
|
+
} = _ref;
|
|
27
|
+
return (0, _element.createElement)(Tag, (0, _extends2.default)({
|
|
28
|
+
className: (0, _classnames.default)('interface-navigable-region', className),
|
|
29
|
+
"aria-label": ariaLabel,
|
|
30
|
+
role: "region",
|
|
31
|
+
tabIndex: "-1"
|
|
32
|
+
}, props), (0, _element.createElement)("div", {
|
|
33
|
+
className: "interface-navigable-region__stacker"
|
|
34
|
+
}, children));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/navigable-region/index.js"],"names":["NavigableRegion","children","className","ariaLabel","as","Tag","props"],"mappings":";;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,eAAT,OAMX;AAAA,MANqC;AACxCC,IAAAA,QADwC;AAExCC,IAAAA,SAFwC;AAGxCC,IAAAA,SAHwC;AAIxCC,IAAAA,EAAE,EAAEC,GAAG,GAAG,KAJ8B;AAKxC,OAAGC;AALqC,GAMrC;AACH,SACC,4BAAC,GAAD;AACC,IAAA,SAAS,EAAG,yBAAY,4BAAZ,EAA0CJ,SAA1C,CADb;AAEC,kBAAaC,SAFd;AAGC,IAAA,IAAI,EAAC,QAHN;AAIC,IAAA,QAAQ,EAAC;AAJV,KAKMG,KALN,GAOC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGL,QADH,CAPD,CADD;AAaA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nexport default function NavigableRegion( {\n\tchildren,\n\tclassName,\n\tariaLabel,\n\tas: Tag = 'div',\n\t...props\n} ) {\n\treturn (\n\t\t<Tag\n\t\t\tclassName={ classnames( 'interface-navigable-region', className ) }\n\t\t\taria-label={ ariaLabel }\n\t\t\trole=\"region\"\n\t\t\ttabIndex=\"-1\"\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<div className=\"interface-navigable-region__stacker\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Tag>\n\t);\n}\n"]}
|
|
@@ -10,4 +10,5 @@ export { default as PreferencesModal } from './preferences-modal';
|
|
|
10
10
|
export { default as PreferencesModalTabs } from './preferences-modal-tabs';
|
|
11
11
|
export { default as PreferencesModalSection } from './preferences-modal-section';
|
|
12
12
|
export { default as ___unstablePreferencesModalBaseOption } from './preferences-modal-base-option';
|
|
13
|
+
export { default as NavigableRegion } from './navigable-region';
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/index.js"],"names":["default","ComplementaryArea","ComplementaryAreaMoreMenuItem","FullscreenMode","InterfaceSkeleton","PinnedItems","MoreMenuDropdown","MoreMenuFeatureToggle","ActionItem","PreferencesModal","PreferencesModalTabs","PreferencesModalSection","___unstablePreferencesModalBaseOption"],"mappings":"AAAA,SAASA,OAAO,IAAIC,iBAApB,QAA6C,sBAA7C;AACA,SAASD,OAAO,IAAIE,6BAApB,QAAyD,qCAAzD;AACA,SAASF,OAAO,IAAIG,cAApB,QAA0C,mBAA1C;AACA,SAASH,OAAO,IAAII,iBAApB,QAA6C,sBAA7C;AACA,SAASJ,OAAO,IAAIK,WAApB,QAAuC,gBAAvC;AACA,SAASL,OAAO,IAAIM,gBAApB,QAA4C,sBAA5C;AACA,SAASN,OAAO,IAAIO,qBAApB,QAAiD,4BAAjD;AACA,SAASP,OAAO,IAAIQ,UAApB,QAAsC,eAAtC;AACA,SAASR,OAAO,IAAIS,gBAApB,QAA4C,qBAA5C;AACA,SAAST,OAAO,IAAIU,oBAApB,QAAgD,0BAAhD;AACA,SAASV,OAAO,IAAIW,uBAApB,QAAmD,6BAAnD;AACA,SAASX,OAAO,IAAIY,qCAApB,QAAiE,iCAAjE","sourcesContent":["export { default as ComplementaryArea } from './complementary-area';\nexport { default as ComplementaryAreaMoreMenuItem } from './complementary-area-more-menu-item';\nexport { default as FullscreenMode } from './fullscreen-mode';\nexport { default as InterfaceSkeleton } from './interface-skeleton';\nexport { default as PinnedItems } from './pinned-items';\nexport { default as MoreMenuDropdown } from './more-menu-dropdown';\nexport { default as MoreMenuFeatureToggle } from './more-menu-feature-toggle';\nexport { default as ActionItem } from './action-item';\nexport { default as PreferencesModal } from './preferences-modal';\nexport { default as PreferencesModalTabs } from './preferences-modal-tabs';\nexport { default as PreferencesModalSection } from './preferences-modal-section';\nexport { default as ___unstablePreferencesModalBaseOption } from './preferences-modal-base-option';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/index.js"],"names":["default","ComplementaryArea","ComplementaryAreaMoreMenuItem","FullscreenMode","InterfaceSkeleton","PinnedItems","MoreMenuDropdown","MoreMenuFeatureToggle","ActionItem","PreferencesModal","PreferencesModalTabs","PreferencesModalSection","___unstablePreferencesModalBaseOption","NavigableRegion"],"mappings":"AAAA,SAASA,OAAO,IAAIC,iBAApB,QAA6C,sBAA7C;AACA,SAASD,OAAO,IAAIE,6BAApB,QAAyD,qCAAzD;AACA,SAASF,OAAO,IAAIG,cAApB,QAA0C,mBAA1C;AACA,SAASH,OAAO,IAAII,iBAApB,QAA6C,sBAA7C;AACA,SAASJ,OAAO,IAAIK,WAApB,QAAuC,gBAAvC;AACA,SAASL,OAAO,IAAIM,gBAApB,QAA4C,sBAA5C;AACA,SAASN,OAAO,IAAIO,qBAApB,QAAiD,4BAAjD;AACA,SAASP,OAAO,IAAIQ,UAApB,QAAsC,eAAtC;AACA,SAASR,OAAO,IAAIS,gBAApB,QAA4C,qBAA5C;AACA,SAAST,OAAO,IAAIU,oBAApB,QAAgD,0BAAhD;AACA,SAASV,OAAO,IAAIW,uBAApB,QAAmD,6BAAnD;AACA,SAASX,OAAO,IAAIY,qCAApB,QAAiE,iCAAjE;AACA,SAASZ,OAAO,IAAIa,eAApB,QAA2C,oBAA3C","sourcesContent":["export { default as ComplementaryArea } from './complementary-area';\nexport { default as ComplementaryAreaMoreMenuItem } from './complementary-area-more-menu-item';\nexport { default as FullscreenMode } from './fullscreen-mode';\nexport { default as InterfaceSkeleton } from './interface-skeleton';\nexport { default as PinnedItems } from './pinned-items';\nexport { default as MoreMenuDropdown } from './more-menu-dropdown';\nexport { default as MoreMenuFeatureToggle } from './more-menu-feature-toggle';\nexport { default as ActionItem } from './action-item';\nexport { default as PreferencesModal } from './preferences-modal';\nexport { default as PreferencesModalTabs } from './preferences-modal-tabs';\nexport { default as PreferencesModalSection } from './preferences-modal-section';\nexport { default as ___unstablePreferencesModalBaseOption } from './preferences-modal-base-option';\nexport { default as NavigableRegion } from './navigable-region';\n"]}
|
|
@@ -13,6 +13,11 @@ import { forwardRef, useEffect } from '@wordpress/element';
|
|
|
13
13
|
import { __unstableUseNavigateRegions as useNavigateRegions, __unstableMotion as motion } from '@wordpress/components';
|
|
14
14
|
import { __ } from '@wordpress/i18n';
|
|
15
15
|
import { useMergeRefs } from '@wordpress/compose';
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import NavigableRegion from '../navigable-region';
|
|
16
21
|
|
|
17
22
|
function useHTMLClass(className) {
|
|
18
23
|
useEffect(() => {
|
|
@@ -39,18 +44,16 @@ function InterfaceSkeleton(_ref, ref) {
|
|
|
39
44
|
secondarySidebar,
|
|
40
45
|
notices,
|
|
41
46
|
content,
|
|
42
|
-
drawer,
|
|
43
47
|
actions,
|
|
44
48
|
labels,
|
|
45
49
|
className,
|
|
50
|
+
// Todo: does this need to be a prop.
|
|
51
|
+
// Can we use a dependency to keyboard-shortcuts directly?
|
|
46
52
|
shortcuts
|
|
47
53
|
} = _ref;
|
|
48
54
|
const navigateRegionsProps = useNavigateRegions(shortcuts);
|
|
49
55
|
useHTMLClass('interface-interface-skeleton__html-container');
|
|
50
56
|
const defaultLabels = {
|
|
51
|
-
/* translators: accessibility text for the nav bar landmark region. */
|
|
52
|
-
drawer: __('Drawer'),
|
|
53
|
-
|
|
54
57
|
/* translators: accessibility text for the top bar landmark region. */
|
|
55
58
|
header: __('Header'),
|
|
56
59
|
|
|
@@ -90,61 +93,43 @@ function InterfaceSkeleton(_ref, ref) {
|
|
|
90
93
|
return createElement("div", _extends({}, navigateRegionsProps, {
|
|
91
94
|
ref: useMergeRefs([ref, navigateRegionsProps.ref]),
|
|
92
95
|
className: classnames(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
|
|
93
|
-
}),
|
|
94
|
-
className: "interface-interface-skeleton__drawer",
|
|
95
|
-
role: "region",
|
|
96
|
-
"aria-label": mergedLabels.drawer,
|
|
97
|
-
tabIndex: "-1"
|
|
98
|
-
}, drawer), createElement("div", {
|
|
96
|
+
}), createElement("div", {
|
|
99
97
|
className: "interface-interface-skeleton__editor"
|
|
100
|
-
}, !!header && isDistractionFree && createElement(
|
|
98
|
+
}, !!header && isDistractionFree && createElement(NavigableRegion, {
|
|
99
|
+
as: motion.div,
|
|
100
|
+
className: "interface-interface-skeleton__header",
|
|
101
|
+
"aria-label": mergedLabels.header,
|
|
101
102
|
initial: isDistractionFree ? 'hidden' : 'hover',
|
|
102
103
|
whileHover: "hover",
|
|
103
104
|
variants: headerVariants,
|
|
104
105
|
transition: {
|
|
105
106
|
type: 'tween',
|
|
106
107
|
delay: 0.8
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
role: "region",
|
|
110
|
-
"aria-label": mergedLabels.header,
|
|
111
|
-
tabIndex: "-1"
|
|
112
|
-
}, header), !!header && !isDistractionFree && createElement("div", {
|
|
108
|
+
}
|
|
109
|
+
}, header), !!header && !isDistractionFree && createElement(NavigableRegion, {
|
|
113
110
|
className: "interface-interface-skeleton__header",
|
|
114
|
-
|
|
115
|
-
"aria-label": mergedLabels.header,
|
|
116
|
-
tabIndex: "-1"
|
|
111
|
+
ariaLabel: mergedLabels.header
|
|
117
112
|
}, header), isDistractionFree && createElement("div", {
|
|
118
113
|
className: "interface-interface-skeleton__header"
|
|
119
114
|
}, editorNotices), createElement("div", {
|
|
120
115
|
className: "interface-interface-skeleton__body"
|
|
121
|
-
}, !!secondarySidebar && createElement(
|
|
116
|
+
}, !!secondarySidebar && createElement(NavigableRegion, {
|
|
122
117
|
className: "interface-interface-skeleton__secondary-sidebar",
|
|
123
|
-
|
|
124
|
-
"aria-label": mergedLabels.secondarySidebar,
|
|
125
|
-
tabIndex: "-1"
|
|
118
|
+
ariaLabel: mergedLabels.secondarySidebar
|
|
126
119
|
}, secondarySidebar), !!notices && createElement("div", {
|
|
127
120
|
className: "interface-interface-skeleton__notices"
|
|
128
|
-
}, notices), createElement(
|
|
121
|
+
}, notices), createElement(NavigableRegion, {
|
|
129
122
|
className: "interface-interface-skeleton__content",
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
tabIndex: "-1"
|
|
133
|
-
}, content), !!sidebar && createElement("div", {
|
|
123
|
+
ariaLabel: mergedLabels.body
|
|
124
|
+
}, content), !!sidebar && createElement(NavigableRegion, {
|
|
134
125
|
className: "interface-interface-skeleton__sidebar",
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
tabIndex: "-1"
|
|
138
|
-
}, sidebar), !!actions && createElement("div", {
|
|
126
|
+
ariaLabel: mergedLabels.sidebar
|
|
127
|
+
}, sidebar), !!actions && createElement(NavigableRegion, {
|
|
139
128
|
className: "interface-interface-skeleton__actions",
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
tabIndex: "-1"
|
|
143
|
-
}, actions))), !!footer && createElement("div", {
|
|
129
|
+
ariaLabel: mergedLabels.actions
|
|
130
|
+
}, actions))), !!footer && createElement(NavigableRegion, {
|
|
144
131
|
className: "interface-interface-skeleton__footer",
|
|
145
|
-
|
|
146
|
-
"aria-label": mergedLabels.footer,
|
|
147
|
-
tabIndex: "-1"
|
|
132
|
+
ariaLabel: mergedLabels.footer
|
|
148
133
|
}, footer));
|
|
149
134
|
}
|
|
150
135
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["classnames","forwardRef","useEffect","__unstableUseNavigateRegions","useNavigateRegions","__unstableMotion","motion","__","useMergeRefs","useHTMLClass","className","element","document","querySelector","classList","toggle","InterfaceSkeleton","ref","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","notices","content","
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["classnames","forwardRef","useEffect","__unstableUseNavigateRegions","useNavigateRegions","__unstableMotion","motion","__","useMergeRefs","NavigableRegion","useHTMLClass","className","element","document","querySelector","classList","toggle","InterfaceSkeleton","ref","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","notices","content","actions","labels","shortcuts","navigateRegionsProps","defaultLabels","body","mergedLabels","headerVariants","hidden","opacity","hover","transition","type","delay","delayChildren","div"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,oBAAtC;AACA,SACCC,4BAA4B,IAA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,MAAAA,KAAK,EAAE;AAAxB;AAPd,KASGnB,MATH,CAFF,EAcG,CAAC,CAAEA,MAAH,IAAa,CAAEF,iBAAf,IACD,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,SAAS,EAAGc,YAAY,CAACZ;AAF1B,KAIGA,MAJH,CAfF,EAsBGF,iBAAiB,IAClB;AAAK,IAAA,SAAS,EAAC;AAAf,KACGG,aADH,CAvBF,EA2BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,CAAC,CAAEE,gBAAH,IACD,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,SAAS,EAAGS,YAAY,CAACT;AAF1B,KAIGA,gBAJH,CAFF,EASG,CAAC,CAAEC,OAAH,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,OADH,CAVF,EAcC,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,SAAS,EAAGQ,YAAY,CAACD;AAF1B,KAIGN,OAJH,CAdD,EAoBG,CAAC,CAAEH,OAAH,IACD,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,SAAS,EAAGU,YAAY,CAACV;AAF1B,KAIGA,OAJH,CArBF,EA4BG,CAAC,CAAEI,OAAH,IACD,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,SAAS,EAAGM,YAAY,CAACN;AAF1B,KAIGA,OAJH,CA7BF,CA3BD,CAVD,EA2EG,CAAC,CAAEP,MAAH,IACD,cAAC,eAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,SAAS,EAAGa,YAAY,CAACb;AAF1B,KAIGA,MAJH,CA5EF,CADD;AAsFA;;AAED,eAAenB,UAAU,CAAEgB,iBAAF,CAAzB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableRegion from '../navigable-region';\n\nfunction useHTMLClass( className ) {\n\tuseEffect( () => {\n\t\tconst element =\n\t\t\tdocument && document.querySelector( `html:not(.${ className })` );\n\t\tif ( ! element ) {\n\t\t\treturn;\n\t\t}\n\t\telement.classList.toggle( className );\n\t\treturn () => {\n\t\t\telement.classList.toggle( className );\n\t\t};\n\t}, [ className ] );\n}\n\nfunction InterfaceSkeleton(\n\t{\n\t\tisDistractionFree,\n\t\tfooter,\n\t\theader,\n\t\teditorNotices,\n\t\tsidebar,\n\t\tsecondarySidebar,\n\t\tnotices,\n\t\tcontent,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t\t// Todo: does this need to be a prop.\n\t\t// Can we use a dependency to keyboard-shortcuts directly?\n\t\tshortcuts,\n\t},\n\tref\n) {\n\tconst navigateRegionsProps = useNavigateRegions( shortcuts );\n\n\tuseHTMLClass( 'interface-interface-skeleton__html-container' );\n\n\tconst defaultLabels = {\n\t\t/* translators: accessibility text for the top bar landmark region. */\n\t\theader: __( 'Header' ),\n\t\t/* translators: accessibility text for the content landmark region. */\n\t\tbody: __( 'Content' ),\n\t\t/* translators: accessibility text for the secondary sidebar landmark region. */\n\t\tsecondarySidebar: __( 'Block Library' ),\n\t\t/* translators: accessibility text for the settings landmark region. */\n\t\tsidebar: __( 'Settings' ),\n\t\t/* translators: accessibility text for the publish landmark region. */\n\t\tactions: __( 'Publish' ),\n\t\t/* translators: accessibility text for the footer landmark region. */\n\t\tfooter: __( 'Footer' ),\n\t};\n\n\tconst mergedLabels = { ...defaultLabels, ...labels };\n\n\tconst headerVariants = {\n\t\thidden: isDistractionFree ? { opacity: 0 } : { opacity: 1 },\n\t\thover: {\n\t\t\topacity: 1,\n\t\t\ttransition: { type: 'tween', delay: 0.2, delayChildren: 0.2 },\n\t\t},\n\t};\n\n\treturn (\n\t\t<div\n\t\t\t{ ...navigateRegionsProps }\n\t\t\tref={ useMergeRefs( [ ref, navigateRegionsProps.ref ] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\tclassName,\n\t\t\t\t'interface-interface-skeleton',\n\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t!! footer && 'has-footer'\n\t\t\t) }\n\t\t>\n\t\t\t<div className=\"interface-interface-skeleton__editor\">\n\t\t\t\t{ !! header && isDistractionFree && (\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\tinitial={ isDistractionFree ? 'hidden' : 'hover' }\n\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\tvariants={ headerVariants }\n\t\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t) }\n\t\t\t\t{ !! header && ! isDistractionFree && (\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\tariaLabel={ mergedLabels.header }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t) }\n\t\t\t\t{ isDistractionFree && (\n\t\t\t\t\t<div className=\"interface-interface-skeleton__header\">\n\t\t\t\t\t\t{ editorNotices }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"interface-interface-skeleton__body\">\n\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! notices && (\n\t\t\t\t\t\t<div className=\"interface-interface-skeleton__notices\">\n\t\t\t\t\t\t\t{ notices }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__content\"\n\t\t\t\t\t\tariaLabel={ mergedLabels.body }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t{ !! sidebar && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__sidebar\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.sidebar }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sidebar }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! actions && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__actions\"\n\t\t\t\t\t\t\tariaLabel={ mergedLabels.actions }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ !! footer && (\n\t\t\t\t<NavigableRegion\n\t\t\t\t\tclassName=\"interface-interface-skeleton__footer\"\n\t\t\t\t\tariaLabel={ mergedLabels.footer }\n\t\t\t\t>\n\t\t\t\t\t{ footer }\n\t\t\t\t</NavigableRegion>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( InterfaceSkeleton );\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* External dependencies
|
|
6
|
+
*/
|
|
7
|
+
import classnames from 'classnames';
|
|
8
|
+
export default function NavigableRegion(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
ariaLabel,
|
|
13
|
+
as: Tag = 'div',
|
|
14
|
+
...props
|
|
15
|
+
} = _ref;
|
|
16
|
+
return createElement(Tag, _extends({
|
|
17
|
+
className: classnames('interface-navigable-region', className),
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
role: "region",
|
|
20
|
+
tabIndex: "-1"
|
|
21
|
+
}, props), createElement("div", {
|
|
22
|
+
className: "interface-navigable-region__stacker"
|
|
23
|
+
}, children));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/navigable-region/index.js"],"names":["classnames","NavigableRegion","children","className","ariaLabel","as","Tag","props"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA,eAAe,SAASC,eAAT,OAMX;AAAA,MANqC;AACxCC,IAAAA,QADwC;AAExCC,IAAAA,SAFwC;AAGxCC,IAAAA,SAHwC;AAIxCC,IAAAA,EAAE,EAAEC,GAAG,GAAG,KAJ8B;AAKxC,OAAGC;AALqC,GAMrC;AACH,SACC,cAAC,GAAD;AACC,IAAA,SAAS,EAAGP,UAAU,CAAE,4BAAF,EAAgCG,SAAhC,CADvB;AAEC,kBAAaC,SAFd;AAGC,IAAA,IAAI,EAAC,QAHN;AAIC,IAAA,QAAQ,EAAC;AAJV,KAKMG,KALN,GAOC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGL,QADH,CAPD,CADD;AAaA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nexport default function NavigableRegion( {\n\tchildren,\n\tclassName,\n\tariaLabel,\n\tas: Tag = 'div',\n\t...props\n} ) {\n\treturn (\n\t\t<Tag\n\t\t\tclassName={ classnames( 'interface-navigable-region', className ) }\n\t\t\taria-label={ ariaLabel }\n\t\t\trole=\"region\"\n\t\t\ttabIndex=\"-1\"\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<div className=\"interface-navigable-region__stacker\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Tag>\n\t);\n}\n"]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a hex value into the rgb equivalent.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
5
|
+
* @return {string} comma separated rgb values
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Colors
|
|
3
9
|
*/
|
|
@@ -11,6 +17,12 @@
|
|
|
11
17
|
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
12
18
|
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
13
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* Converts a hex value into the rgb equivalent.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
24
|
+
* @return {string} comma separated rgb values
|
|
25
|
+
*/
|
|
14
26
|
/**
|
|
15
27
|
* Colors
|
|
16
28
|
*/
|
|
@@ -82,6 +94,8 @@
|
|
|
82
94
|
--wp-admin-theme-color-darker-20: #005a87;
|
|
83
95
|
--wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
|
|
84
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
|
+
--wp-block-synced-color: #7a00df;
|
|
98
|
+
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
85
99
|
}
|
|
86
100
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
87
101
|
:root {
|
|
@@ -306,10 +320,14 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
306
320
|
overflow: auto;
|
|
307
321
|
z-index: 20;
|
|
308
322
|
}
|
|
323
|
+
.interface-interface-skeleton__content .interface-navigable-region__stacker {
|
|
324
|
+
flex-grow: 1;
|
|
325
|
+
display: flex;
|
|
326
|
+
flex-direction: column;
|
|
327
|
+
}
|
|
309
328
|
|
|
310
329
|
.interface-interface-skeleton__secondary-sidebar,
|
|
311
330
|
.interface-interface-skeleton__sidebar {
|
|
312
|
-
display: block;
|
|
313
331
|
flex-shrink: 0;
|
|
314
332
|
position: absolute;
|
|
315
333
|
z-index: 100000;
|
|
@@ -324,9 +342,12 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
324
342
|
.interface-interface-skeleton__secondary-sidebar,
|
|
325
343
|
.interface-interface-skeleton__sidebar {
|
|
326
344
|
position: relative !important;
|
|
327
|
-
z-index: 90;
|
|
328
345
|
width: auto;
|
|
329
346
|
}
|
|
347
|
+
.is-sidebar-opened .interface-interface-skeleton__secondary-sidebar,
|
|
348
|
+
.is-sidebar-opened .interface-interface-skeleton__sidebar {
|
|
349
|
+
z-index: 90;
|
|
350
|
+
}
|
|
330
351
|
}
|
|
331
352
|
|
|
332
353
|
.interface-interface-skeleton__sidebar {
|
|
@@ -338,6 +359,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
338
359
|
}
|
|
339
360
|
}
|
|
340
361
|
|
|
362
|
+
.interface-interface-skeleton__secondary-sidebar .interface-navigable-region__stacker {
|
|
363
|
+
height: 100%;
|
|
364
|
+
}
|
|
341
365
|
@media (min-width: 782px) {
|
|
342
366
|
.interface-interface-skeleton__secondary-sidebar {
|
|
343
367
|
border-left: 1px solid #e0e0e0;
|
|
@@ -390,7 +414,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
390
414
|
width: 280px;
|
|
391
415
|
color: #1e1e1e;
|
|
392
416
|
}
|
|
393
|
-
.interface-interface-skeleton__actions:focus {
|
|
417
|
+
.interface-interface-skeleton__actions:focus, .interface-interface-skeleton__actions:focus-within {
|
|
394
418
|
top: auto;
|
|
395
419
|
bottom: 0;
|
|
396
420
|
}
|
package/build-style/style.css
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a hex value into the rgb equivalent.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
5
|
+
* @return {string} comma separated rgb values
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Colors
|
|
3
9
|
*/
|
|
@@ -11,6 +17,12 @@
|
|
|
11
17
|
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
12
18
|
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
13
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* Converts a hex value into the rgb equivalent.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
24
|
+
* @return {string} comma separated rgb values
|
|
25
|
+
*/
|
|
14
26
|
/**
|
|
15
27
|
* Colors
|
|
16
28
|
*/
|
|
@@ -82,6 +94,8 @@
|
|
|
82
94
|
--wp-admin-theme-color-darker-20: #005a87;
|
|
83
95
|
--wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
|
|
84
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
|
+
--wp-block-synced-color: #7a00df;
|
|
98
|
+
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
85
99
|
}
|
|
86
100
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
87
101
|
:root {
|
|
@@ -306,10 +320,14 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
306
320
|
overflow: auto;
|
|
307
321
|
z-index: 20;
|
|
308
322
|
}
|
|
323
|
+
.interface-interface-skeleton__content .interface-navigable-region__stacker {
|
|
324
|
+
flex-grow: 1;
|
|
325
|
+
display: flex;
|
|
326
|
+
flex-direction: column;
|
|
327
|
+
}
|
|
309
328
|
|
|
310
329
|
.interface-interface-skeleton__secondary-sidebar,
|
|
311
330
|
.interface-interface-skeleton__sidebar {
|
|
312
|
-
display: block;
|
|
313
331
|
flex-shrink: 0;
|
|
314
332
|
position: absolute;
|
|
315
333
|
z-index: 100000;
|
|
@@ -324,9 +342,12 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
324
342
|
.interface-interface-skeleton__secondary-sidebar,
|
|
325
343
|
.interface-interface-skeleton__sidebar {
|
|
326
344
|
position: relative !important;
|
|
327
|
-
z-index: 90;
|
|
328
345
|
width: auto;
|
|
329
346
|
}
|
|
347
|
+
.is-sidebar-opened .interface-interface-skeleton__secondary-sidebar,
|
|
348
|
+
.is-sidebar-opened .interface-interface-skeleton__sidebar {
|
|
349
|
+
z-index: 90;
|
|
350
|
+
}
|
|
330
351
|
}
|
|
331
352
|
|
|
332
353
|
.interface-interface-skeleton__sidebar {
|
|
@@ -338,6 +359,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
338
359
|
}
|
|
339
360
|
}
|
|
340
361
|
|
|
362
|
+
.interface-interface-skeleton__secondary-sidebar .interface-navigable-region__stacker {
|
|
363
|
+
height: 100%;
|
|
364
|
+
}
|
|
341
365
|
@media (min-width: 782px) {
|
|
342
366
|
.interface-interface-skeleton__secondary-sidebar {
|
|
343
367
|
border-right: 1px solid #e0e0e0;
|
|
@@ -390,7 +414,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
390
414
|
width: 280px;
|
|
391
415
|
color: #1e1e1e;
|
|
392
416
|
}
|
|
393
|
-
.interface-interface-skeleton__actions:focus {
|
|
417
|
+
.interface-interface-skeleton__actions:focus, .interface-interface-skeleton__actions:focus-within {
|
|
394
418
|
top: auto;
|
|
395
419
|
bottom: 0;
|
|
396
420
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { withPluginContext } from '@wordpress/plugins';
|
|
5
|
+
|
|
6
|
+
export default withPluginContext( ( context, ownProps ) => {
|
|
7
|
+
return {
|
|
8
|
+
icon: ownProps.icon || context.icon,
|
|
9
|
+
identifier:
|
|
10
|
+
ownProps.identifier || `${ context.name }/${ ownProps.name }`,
|
|
11
|
+
};
|
|
12
|
+
} );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/interface",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.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,25 +32,25 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
|
-
"@wordpress/a11y": "^3.
|
|
36
|
-
"@wordpress/components": "^
|
|
37
|
-
"@wordpress/compose": "^
|
|
38
|
-
"@wordpress/data": "^
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/element": "^
|
|
41
|
-
"@wordpress/i18n": "^4.
|
|
42
|
-
"@wordpress/icons": "^9.
|
|
43
|
-
"@wordpress/plugins": "^
|
|
44
|
-
"@wordpress/preferences": "^
|
|
45
|
-
"@wordpress/viewport": "^
|
|
35
|
+
"@wordpress/a11y": "^3.23.0",
|
|
36
|
+
"@wordpress/components": "^23.0.0",
|
|
37
|
+
"@wordpress/compose": "^6.0.0",
|
|
38
|
+
"@wordpress/data": "^8.0.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.23.0",
|
|
40
|
+
"@wordpress/element": "^5.0.0",
|
|
41
|
+
"@wordpress/i18n": "^4.23.0",
|
|
42
|
+
"@wordpress/icons": "^9.14.0",
|
|
43
|
+
"@wordpress/plugins": "^5.0.0",
|
|
44
|
+
"@wordpress/preferences": "^3.0.0",
|
|
45
|
+
"@wordpress/viewport": "^5.0.0",
|
|
46
46
|
"classnames": "^2.3.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"react": "^
|
|
50
|
-
"react-dom": "^
|
|
49
|
+
"react": "^18.0.0",
|
|
50
|
+
"react-dom": "^18.0.0"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "1eb65aabe6738097f4c062e78f69ae8f05879848"
|
|
56
56
|
}
|
package/src/components/index.js
CHANGED
|
@@ -10,3 +10,4 @@ export { default as PreferencesModal } from './preferences-modal';
|
|
|
10
10
|
export { default as PreferencesModalTabs } from './preferences-modal-tabs';
|
|
11
11
|
export { default as PreferencesModalSection } from './preferences-modal-section';
|
|
12
12
|
export { default as ___unstablePreferencesModalBaseOption } from './preferences-modal-base-option';
|
|
13
|
+
export { default as NavigableRegion } from './navigable-region';
|
|
@@ -14,6 +14,11 @@ import {
|
|
|
14
14
|
import { __ } from '@wordpress/i18n';
|
|
15
15
|
import { useMergeRefs } from '@wordpress/compose';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
import NavigableRegion from '../navigable-region';
|
|
21
|
+
|
|
17
22
|
function useHTMLClass( className ) {
|
|
18
23
|
useEffect( () => {
|
|
19
24
|
const element =
|
|
@@ -38,10 +43,11 @@ function InterfaceSkeleton(
|
|
|
38
43
|
secondarySidebar,
|
|
39
44
|
notices,
|
|
40
45
|
content,
|
|
41
|
-
drawer,
|
|
42
46
|
actions,
|
|
43
47
|
labels,
|
|
44
48
|
className,
|
|
49
|
+
// Todo: does this need to be a prop.
|
|
50
|
+
// Can we use a dependency to keyboard-shortcuts directly?
|
|
45
51
|
shortcuts,
|
|
46
52
|
},
|
|
47
53
|
ref
|
|
@@ -51,8 +57,6 @@ function InterfaceSkeleton(
|
|
|
51
57
|
useHTMLClass( 'interface-interface-skeleton__html-container' );
|
|
52
58
|
|
|
53
59
|
const defaultLabels = {
|
|
54
|
-
/* translators: accessibility text for the nav bar landmark region. */
|
|
55
|
-
drawer: __( 'Drawer' ),
|
|
56
60
|
/* translators: accessibility text for the top bar landmark region. */
|
|
57
61
|
header: __( 'Header' ),
|
|
58
62
|
/* translators: accessibility text for the content landmark region. */
|
|
@@ -88,40 +92,27 @@ function InterfaceSkeleton(
|
|
|
88
92
|
!! footer && 'has-footer'
|
|
89
93
|
) }
|
|
90
94
|
>
|
|
91
|
-
{ !! drawer && (
|
|
92
|
-
<div
|
|
93
|
-
className="interface-interface-skeleton__drawer"
|
|
94
|
-
role="region"
|
|
95
|
-
aria-label={ mergedLabels.drawer }
|
|
96
|
-
tabIndex="-1"
|
|
97
|
-
>
|
|
98
|
-
{ drawer }
|
|
99
|
-
</div>
|
|
100
|
-
) }
|
|
101
95
|
<div className="interface-interface-skeleton__editor">
|
|
102
96
|
{ !! header && isDistractionFree && (
|
|
103
|
-
<
|
|
97
|
+
<NavigableRegion
|
|
98
|
+
as={ motion.div }
|
|
99
|
+
className="interface-interface-skeleton__header"
|
|
100
|
+
aria-label={ mergedLabels.header }
|
|
104
101
|
initial={ isDistractionFree ? 'hidden' : 'hover' }
|
|
105
102
|
whileHover="hover"
|
|
106
103
|
variants={ headerVariants }
|
|
107
104
|
transition={ { type: 'tween', delay: 0.8 } }
|
|
108
|
-
className="interface-interface-skeleton__header"
|
|
109
|
-
role="region"
|
|
110
|
-
aria-label={ mergedLabels.header }
|
|
111
|
-
tabIndex="-1"
|
|
112
105
|
>
|
|
113
106
|
{ header }
|
|
114
|
-
</
|
|
107
|
+
</NavigableRegion>
|
|
115
108
|
) }
|
|
116
109
|
{ !! header && ! isDistractionFree && (
|
|
117
|
-
<
|
|
110
|
+
<NavigableRegion
|
|
118
111
|
className="interface-interface-skeleton__header"
|
|
119
|
-
|
|
120
|
-
aria-label={ mergedLabels.header }
|
|
121
|
-
tabIndex="-1"
|
|
112
|
+
ariaLabel={ mergedLabels.header }
|
|
122
113
|
>
|
|
123
114
|
{ header }
|
|
124
|
-
</
|
|
115
|
+
</NavigableRegion>
|
|
125
116
|
) }
|
|
126
117
|
{ isDistractionFree && (
|
|
127
118
|
<div className="interface-interface-skeleton__header">
|
|
@@ -130,59 +121,49 @@ function InterfaceSkeleton(
|
|
|
130
121
|
) }
|
|
131
122
|
<div className="interface-interface-skeleton__body">
|
|
132
123
|
{ !! secondarySidebar && (
|
|
133
|
-
<
|
|
124
|
+
<NavigableRegion
|
|
134
125
|
className="interface-interface-skeleton__secondary-sidebar"
|
|
135
|
-
|
|
136
|
-
aria-label={ mergedLabels.secondarySidebar }
|
|
137
|
-
tabIndex="-1"
|
|
126
|
+
ariaLabel={ mergedLabels.secondarySidebar }
|
|
138
127
|
>
|
|
139
128
|
{ secondarySidebar }
|
|
140
|
-
</
|
|
129
|
+
</NavigableRegion>
|
|
141
130
|
) }
|
|
142
131
|
{ !! notices && (
|
|
143
132
|
<div className="interface-interface-skeleton__notices">
|
|
144
133
|
{ notices }
|
|
145
134
|
</div>
|
|
146
135
|
) }
|
|
147
|
-
<
|
|
136
|
+
<NavigableRegion
|
|
148
137
|
className="interface-interface-skeleton__content"
|
|
149
|
-
|
|
150
|
-
aria-label={ mergedLabels.body }
|
|
151
|
-
tabIndex="-1"
|
|
138
|
+
ariaLabel={ mergedLabels.body }
|
|
152
139
|
>
|
|
153
140
|
{ content }
|
|
154
|
-
</
|
|
141
|
+
</NavigableRegion>
|
|
155
142
|
{ !! sidebar && (
|
|
156
|
-
<
|
|
143
|
+
<NavigableRegion
|
|
157
144
|
className="interface-interface-skeleton__sidebar"
|
|
158
|
-
|
|
159
|
-
aria-label={ mergedLabels.sidebar }
|
|
160
|
-
tabIndex="-1"
|
|
145
|
+
ariaLabel={ mergedLabels.sidebar }
|
|
161
146
|
>
|
|
162
147
|
{ sidebar }
|
|
163
|
-
</
|
|
148
|
+
</NavigableRegion>
|
|
164
149
|
) }
|
|
165
150
|
{ !! actions && (
|
|
166
|
-
<
|
|
151
|
+
<NavigableRegion
|
|
167
152
|
className="interface-interface-skeleton__actions"
|
|
168
|
-
|
|
169
|
-
aria-label={ mergedLabels.actions }
|
|
170
|
-
tabIndex="-1"
|
|
153
|
+
ariaLabel={ mergedLabels.actions }
|
|
171
154
|
>
|
|
172
155
|
{ actions }
|
|
173
|
-
</
|
|
156
|
+
</NavigableRegion>
|
|
174
157
|
) }
|
|
175
158
|
</div>
|
|
176
159
|
</div>
|
|
177
160
|
{ !! footer && (
|
|
178
|
-
<
|
|
161
|
+
<NavigableRegion
|
|
179
162
|
className="interface-interface-skeleton__footer"
|
|
180
|
-
|
|
181
|
-
aria-label={ mergedLabels.footer }
|
|
182
|
-
tabIndex="-1"
|
|
163
|
+
ariaLabel={ mergedLabels.footer }
|
|
183
164
|
>
|
|
184
165
|
{ footer }
|
|
185
|
-
</
|
|
166
|
+
</NavigableRegion>
|
|
186
167
|
) }
|
|
187
168
|
</div>
|
|
188
169
|
);
|
|
@@ -72,6 +72,16 @@ html.interface-interface-skeleton__html-container {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.interface-interface-skeleton__content {
|
|
75
|
+
.interface-navigable-region__stacker {
|
|
76
|
+
// It's a flex item within a flex container with flex-direction column.
|
|
77
|
+
// Make sure it takes all the available height.
|
|
78
|
+
flex-grow: 1;
|
|
79
|
+
// Allow its flex items (the visual editor area) to take all the available
|
|
80
|
+
// height by making it also a flex container.
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
}
|
|
84
|
+
|
|
75
85
|
flex-grow: 1;
|
|
76
86
|
|
|
77
87
|
// Treat as flex container to allow children to grow to occupy full
|
|
@@ -88,12 +98,10 @@ html.interface-interface-skeleton__html-container {
|
|
|
88
98
|
// to "bleed" through the header.
|
|
89
99
|
// See https://github.com/WordPress/gutenberg/issues/32631
|
|
90
100
|
z-index: z-index(".interface-interface-skeleton__content");
|
|
91
|
-
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
.interface-interface-skeleton__secondary-sidebar,
|
|
95
104
|
.interface-interface-skeleton__sidebar {
|
|
96
|
-
display: block;
|
|
97
105
|
flex-shrink: 0;
|
|
98
106
|
position: absolute;
|
|
99
107
|
z-index: z-index(".interface-interface-skeleton__sidebar");
|
|
@@ -107,8 +115,14 @@ html.interface-interface-skeleton__html-container {
|
|
|
107
115
|
// On Mobile the header is fixed to keep HTML as scrollable.
|
|
108
116
|
@include break-medium() {
|
|
109
117
|
position: relative !important;
|
|
110
|
-
z-index: z-index(".interface-interface-skeleton__sidebar {greater than small}");
|
|
111
118
|
width: auto; // Keep the sidebar width flexible.
|
|
119
|
+
|
|
120
|
+
// Set this z-index only when the sidebar is opened. When it's closed, the
|
|
121
|
+
// button to open the sidebar that is shown when navigating regions needs to
|
|
122
|
+
// be above the footer. See `edit-post-layout__toggle-sidebar-panel`.
|
|
123
|
+
.is-sidebar-opened & {
|
|
124
|
+
z-index: z-index(".interface-interface-skeleton__sidebar {greater than small}");
|
|
125
|
+
}
|
|
112
126
|
}
|
|
113
127
|
}
|
|
114
128
|
|
|
@@ -121,6 +135,10 @@ html.interface-interface-skeleton__html-container {
|
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
.interface-interface-skeleton__secondary-sidebar {
|
|
138
|
+
.interface-navigable-region__stacker {
|
|
139
|
+
height: 100%;
|
|
140
|
+
}
|
|
141
|
+
|
|
124
142
|
@include break-medium() {
|
|
125
143
|
border-right: $border-width solid $gray-200;
|
|
126
144
|
}
|
|
@@ -173,7 +191,8 @@ html.interface-interface-skeleton__html-container {
|
|
|
173
191
|
width: $sidebar-width;
|
|
174
192
|
color: $gray-900;
|
|
175
193
|
|
|
176
|
-
&:focus
|
|
194
|
+
&:focus,
|
|
195
|
+
&:focus-within {
|
|
177
196
|
top: auto;
|
|
178
197
|
bottom: 0;
|
|
179
198
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# NavigableRegion
|
|
2
|
+
|
|
3
|
+
`NavigableRegion` renders an ARIA landmark region that's meant to be used together with the `useNavigateRegions` component from the `@wordpress/components` package. The ARIA landmark is a `div` element with a `role="region"` attribute and an `aria-label` attribute. It's made focusable by the means of a `tabindex="-1"` attribute so that `useNavigateRegions` can set focus on it and allow keyboard navigation through the regions in the editor.
|
|
4
|
+
|
|
5
|
+
It also renders a child `div` element that is responsible to set a negative `z-index` stack level, to make sure the focus style is always visible, regardless of other elements that may cut-off the focus style outline otherwise.
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
### children
|
|
10
|
+
|
|
11
|
+
The component that should be rendered as content.
|
|
12
|
+
|
|
13
|
+
- Type: React Element
|
|
14
|
+
- Required: Yes
|
|
15
|
+
|
|
16
|
+
### className
|
|
17
|
+
|
|
18
|
+
The CSS class that will be added to the classes of the wrapper div.
|
|
19
|
+
|
|
20
|
+
- Type: `String`
|
|
21
|
+
- Required: No
|
|
22
|
+
|
|
23
|
+
### ariaLabel
|
|
24
|
+
|
|
25
|
+
A meaningful name for the ARIA landmark region.
|
|
26
|
+
|
|
27
|
+
- Type: `String`
|
|
28
|
+
- Required: Yes
|
|
29
|
+
|
|
30
|
+
### as
|
|
31
|
+
|
|
32
|
+
The component used as the root of the region. Defaults to a `div` element.
|
|
33
|
+
|
|
34
|
+
- Type: `Component`
|
|
35
|
+
- Required: no
|
|
36
|
+
- Default: `div`
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
export default function NavigableRegion( {
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
ariaLabel,
|
|
10
|
+
as: Tag = 'div',
|
|
11
|
+
...props
|
|
12
|
+
} ) {
|
|
13
|
+
return (
|
|
14
|
+
<Tag
|
|
15
|
+
className={ classnames( 'interface-navigable-region', className ) }
|
|
16
|
+
aria-label={ ariaLabel }
|
|
17
|
+
role="region"
|
|
18
|
+
tabIndex="-1"
|
|
19
|
+
{ ...props }
|
|
20
|
+
>
|
|
21
|
+
<div className="interface-navigable-region__stacker">
|
|
22
|
+
{ children }
|
|
23
|
+
</div>
|
|
24
|
+
</Tag>
|
|
25
|
+
);
|
|
26
|
+
}
|