@wordpress/interface 6.8.5 → 6.8.7
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 +5 -1
- package/build/components/complementary-area-toggle/index.js +13 -1
- package/build/components/complementary-area-toggle/index.js.map +1 -1
- package/build/components/interface-skeleton/index.js +3 -9
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build/components/navigable-region/index.js +12 -4
- package/build/components/navigable-region/index.js.map +1 -1
- package/build-module/components/complementary-area-toggle/index.js +15 -1
- package/build-module/components/complementary-area-toggle/index.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +5 -11
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-module/components/navigable-region/index.js +11 -3
- package/build-module/components/navigable-region/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/complementary-area-toggle/index.js +23 -0
- package/src/components/interface-skeleton/index.js +1 -13
- package/src/components/navigable-region/index.js +24 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 6.8.6 (2024-10-14)
|
|
4
|
+
|
|
5
|
+
### Bug fix
|
|
6
|
+
|
|
7
|
+
- `InterfaceSkeleton` no longer supports region navigation and its props `enableRegionNavigation` and `shortcuts` are removed. ([#63611](https://github.com/WordPress/gutenberg/pull/63611)). It’s recommended to add region navigation with the higher-order component `navigateRegions` or the hook `__unstableUseNavigateRegions` from `@wordpress/components`.
|
|
4
8
|
|
|
5
9
|
## 6.8.0 (2024-09-19)
|
|
6
10
|
|
|
@@ -18,6 +18,15 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Whether the role supports checked state.
|
|
23
|
+
*
|
|
24
|
+
* @param {import('react').AriaRole} role Role.
|
|
25
|
+
* @return {boolean} Whether the role supports checked state.
|
|
26
|
+
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
27
|
+
*/function roleSupportsCheckedState(role) {
|
|
28
|
+
return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role);
|
|
29
|
+
}
|
|
21
30
|
function ComplementaryAreaToggle({
|
|
22
31
|
as = _components.Button,
|
|
23
32
|
scope,
|
|
@@ -36,7 +45,10 @@ function ComplementaryAreaToggle({
|
|
|
36
45
|
} = (0, _data.useDispatch)(_store.store);
|
|
37
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentToUse, {
|
|
38
47
|
icon: selectedIcon && isSelected ? selectedIcon : icon,
|
|
39
|
-
"aria-controls": identifier.replace('/', ':')
|
|
48
|
+
"aria-controls": identifier.replace('/', ':')
|
|
49
|
+
// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
50
|
+
,
|
|
51
|
+
"aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined,
|
|
40
52
|
onClick: () => {
|
|
41
53
|
if (isSelected) {
|
|
42
54
|
disableComplementaryArea(scope);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_store","_complementaryAreaContext","_interopRequireDefault","_jsxRuntime","ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","name","shortcut","props","ComponentToUse","isSelected","useSelect","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","useDispatch","jsx","replace","onClick","_default","exports","default","complementaryAreaContext"],"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\tshortcut,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier, scope ]\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\taria-controls={ identifier.replace( '/', ':' ) }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAqE,IAAAK,WAAA,GAAAL,OAAA;AAVrE;AACA;AACA;;AAIA;AACA;AACA;;AAIA,SAASM,uBAAuBA,CAAE;EACjCC,EAAE,GAAGC,kBAAM;EACXC,KAAK;EACLC,UAAU;EACVC,IAAI;EACJC,YAAY;EACZC,IAAI;EACJC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGT,EAAE;EACzB,MAAMU,UAAU,GAAG,IAAAC,eAAS,EACzBC,MAAM,IACPA,MAAM,CAAEC,YAAe,CAAC,CAACC,0BAA0B,CAAEZ,KAAM,CAAC,KAC5DC,UAAU,EACX,CAAEA,UAAU,EAAED,KAAK,CACpB,CAAC;EAED,MAAM;IAAEa,uBAAuB;IAAEC;EAAyB,CAAC,GAC1D,IAAAC,iBAAW,EAAEJ,YAAe,CAAC;EAE9B,oBACC,
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_store","_complementaryAreaContext","_interopRequireDefault","_jsxRuntime","roleSupportsCheckedState","role","includes","ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","name","shortcut","props","ComponentToUse","isSelected","useSelect","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","useDispatch","jsx","replace","undefined","onClick","_default","exports","default","complementaryAreaContext"],"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\n/**\n * Whether the role supports checked state.\n *\n * @param {import('react').AriaRole} role Role.\n * @return {boolean} Whether the role supports checked state.\n * @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n */\nfunction roleSupportsCheckedState( role ) {\n\treturn [\n\t\t'checkbox',\n\t\t'option',\n\t\t'radio',\n\t\t'switch',\n\t\t'menuitemcheckbox',\n\t\t'menuitemradio',\n\t\t'treeitem',\n\t].includes( role );\n}\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\tshortcut,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier, scope ]\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\taria-controls={ identifier.replace( '/', ':' ) }\n\t\t\t// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n\t\t\taria-checked={\n\t\t\t\troleSupportsCheckedState( props.role ) ? isSelected : undefined\n\t\t\t}\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAqE,IAAAK,WAAA,GAAAL,OAAA;AAVrE;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,SAASM,wBAAwBA,CAAEC,IAAI,EAAG;EACzC,OAAO,CACN,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,UAAU,CACV,CAACC,QAAQ,CAAED,IAAK,CAAC;AACnB;AAEA,SAASE,uBAAuBA,CAAE;EACjCC,EAAE,GAAGC,kBAAM;EACXC,KAAK;EACLC,UAAU;EACVC,IAAI;EACJC,YAAY;EACZC,IAAI;EACJC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGT,EAAE;EACzB,MAAMU,UAAU,GAAG,IAAAC,eAAS,EACzBC,MAAM,IACPA,MAAM,CAAEC,YAAe,CAAC,CAACC,0BAA0B,CAAEZ,KAAM,CAAC,KAC5DC,UAAU,EACX,CAAEA,UAAU,EAAED,KAAK,CACpB,CAAC;EAED,MAAM;IAAEa,uBAAuB;IAAEC;EAAyB,CAAC,GAC1D,IAAAC,iBAAW,EAAEJ,YAAe,CAAC;EAE9B,oBACC,IAAAlB,WAAA,CAAAuB,GAAA,EAACT,cAAc;IACdL,IAAI,EAAGC,YAAY,IAAIK,UAAU,GAAGL,YAAY,GAAGD,IAAM;IACzD,iBAAgBD,UAAU,CAACgB,OAAO,CAAE,GAAG,EAAE,GAAI;IAC7C;IAAA;IACA,gBACCvB,wBAAwB,CAAEY,KAAK,CAACX,IAAK,CAAC,GAAGa,UAAU,GAAGU,SACtD;IACDC,OAAO,EAAGA,CAAA,KAAM;MACf,IAAKX,UAAU,EAAG;QACjBM,wBAAwB,CAAEd,KAAM,CAAC;MAClC,CAAC,MAAM;QACNa,uBAAuB,CAAEb,KAAK,EAAEC,UAAW,CAAC;MAC7C;IACD,CAAG;IACHI,QAAQ,EAAGA,QAAU;IAAA,GAChBC;EAAK,CACV,CAAC;AAEJ;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,iCAAwB,EAAE1B,uBAAwB,CAAC","ignoreList":[]}
|
|
@@ -84,11 +84,7 @@ function InterfaceSkeleton({
|
|
|
84
84
|
content,
|
|
85
85
|
actions,
|
|
86
86
|
labels,
|
|
87
|
-
className
|
|
88
|
-
enableRegionNavigation = true,
|
|
89
|
-
// Todo: does this need to be a prop.
|
|
90
|
-
// Can we use a dependency to keyboard-shortcuts directly?
|
|
91
|
-
shortcuts
|
|
87
|
+
className
|
|
92
88
|
}, ref) {
|
|
93
89
|
const [secondarySidebarResizeListener, secondarySidebarSize] = (0, _compose.useResizeObserver)();
|
|
94
90
|
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
@@ -98,7 +94,6 @@ function InterfaceSkeleton({
|
|
|
98
94
|
duration: disableMotion ? 0 : ANIMATION_DURATION,
|
|
99
95
|
ease: [0.6, 0, 0.4, 1]
|
|
100
96
|
};
|
|
101
|
-
const navigateRegionsProps = (0, _components.__unstableUseNavigateRegions)(shortcuts);
|
|
102
97
|
useHTMLClass('interface-interface-skeleton__html-container');
|
|
103
98
|
const defaultLabels = {
|
|
104
99
|
/* translators: accessibility text for the top bar landmark region. */
|
|
@@ -119,9 +114,8 @@ function InterfaceSkeleton({
|
|
|
119
114
|
...labels
|
|
120
115
|
};
|
|
121
116
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
className: (0, _clsx.default)(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer'),
|
|
117
|
+
ref: ref,
|
|
118
|
+
className: (0, _clsx.default)(className, 'interface-interface-skeleton', !!footer && 'has-footer'),
|
|
125
119
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
126
120
|
className: "interface-interface-skeleton__editor",
|
|
127
121
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableAnimatePresence, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_i18n","_compose","_navigableRegion","_jsxRuntime","ANIMATION_DURATION","commonTransition","type","duration","ease","useHTMLClass","className","useEffect","element","document","querySelector","classList","toggle","headerVariants","hidden","opacity","marginTop","visible","distractionFreeHover","transition","delay","delayChildren","distractionFreeHidden","distractionFreeDisabled","InterfaceSkeleton","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","content","actions","labels","enableRegionNavigation","shortcuts","ref","secondarySidebarResizeListener","secondarySidebarSize","useResizeObserver","isMobileViewport","useViewportMatch","disableMotion","useReducedMotion","defaultTransition","navigateRegionsProps","useNavigateRegions","defaultLabels","_x","body","__","mergedLabels","jsxs","useMergeRefs","undefined","clsx","children","jsx","__unstableAnimatePresence","initial","default","as","motion","div","whileHover","animate","exit","variants","ariaLabel","open","width","closed","__unstableMotion","style","position","height","left","x","_default","exports","forwardRef"],"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tuseMergeRefs,\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableRegion from '../navigable-region';\n\nconst ANIMATION_DURATION = 0.25;\nconst commonTransition = {\n\ttype: 'tween',\n\tduration: ANIMATION_DURATION,\n\tease: [ 0.6, 0, 0.4, 1 ],\n};\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\nconst headerVariants = {\n\thidden: { opacity: 1, marginTop: -60 },\n\tvisible: { opacity: 1, marginTop: 0 },\n\tdistractionFreeHover: {\n\t\topacity: 1,\n\t\tmarginTop: 0,\n\t\ttransition: {\n\t\t\t...commonTransition,\n\t\t\tdelay: 0.2,\n\t\t\tdelayChildren: 0.2,\n\t\t},\n\t},\n\tdistractionFreeHidden: {\n\t\topacity: 0,\n\t\tmarginTop: -60,\n\t},\n\tdistractionFreeDisabled: {\n\t\topacity: 0,\n\t\tmarginTop: 0,\n\t\ttransition: {\n\t\t\t...commonTransition,\n\t\t\tdelay: 0.8,\n\t\t\tdelayChildren: 0.8,\n\t\t},\n\t},\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\tcontent,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t\tenableRegionNavigation = true,\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 [ secondarySidebarResizeListener, secondarySidebarSize ] =\n\t\tuseResizeObserver();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst disableMotion = useReducedMotion();\n\tconst defaultTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t};\n\tconst navigateRegionsProps = useNavigateRegions( shortcuts );\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: _x( 'Header', 'header landmark area' ),\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\treturn (\n\t\t<div\n\t\t\t{ ...( enableRegionNavigation ? navigateRegionsProps : {} ) }\n\t\t\tref={ useMergeRefs( [\n\t\t\t\tref,\n\t\t\t\tenableRegionNavigation ? navigateRegionsProps.ref : undefined,\n\t\t\t] ) }\n\t\t\tclassName={ clsx(\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<AnimatePresence initial={ false }>\n\t\t\t\t\t{ !! header && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHidden'\n\t\t\t\t\t\t\t\t\t: 'hidden'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHover'\n\t\t\t\t\t\t\t\t\t: 'visible'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeDisabled'\n\t\t\t\t\t\t\t\t\t: 'visible'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHidden'\n\t\t\t\t\t\t\t\t\t: 'hidden'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvariants={ headerVariants }\n\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ header }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t</AnimatePresence>\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<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\t\tariaLabel={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\t\tinitial=\"closed\"\n\t\t\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\t\t\texit=\"closed\"\n\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\topen: { width: secondarySidebarSize.width },\n\t\t\t\t\t\t\t\t\tclosed: { width: 0 },\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t\t\twidth: isMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t? '100vw'\n\t\t\t\t\t\t\t\t\t\t\t: 'fit-content',\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\t\topen: { x: 0 },\n\t\t\t\t\t\t\t\t\t\tclosed: { x: '-100%' },\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ secondarySidebarResizeListener }\n\t\t\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatePresence>\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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAUA,IAAAK,gBAAA,GAAAN,sBAAA,CAAAC,OAAA;AAAkD,IAAAM,WAAA,GAAAN,OAAA;AAzBlD;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;;AAGA,MAAMO,kBAAkB,GAAG,IAAI;AAC/B,MAAMC,gBAAgB,GAAG;EACxBC,IAAI,EAAE,OAAO;EACbC,QAAQ,EAAEH,kBAAkB;EAC5BI,IAAI,EAAE,CAAE,GAAG,EAA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OAAe;UACftD,SAAS,EAAC,uCAAuC;UACjD8D,SAAS,EAAGjB,YAAY,CAACtB,OAAS;UAAA2B,QAAA,EAEhC3B;QAAO,CACO,CACjB,EACC,CAAC,CAAEG,OAAO,iBACX,IAAAjC,WAAA,CAAA0D,GAAA,EAAC3D,gBAAA,CAAA8D,OAAe;UACftD,SAAS,EAAC,uCAAuC;UACjD8D,SAAS,EAAGjB,YAAY,CAACnB,OAAS;UAAAwB,QAAA,EAEhCxB;QAAO,CACO,CACjB;MAAA,CACG,CAAC;IAAA,CACF,CAAC,EACJ,CAAC,CAAEN,MAAM,iBACV,IAAA3B,WAAA,CAAA0D,GAAA,EAAC3D,gBAAA,CAAA8D,OAAe;MACftD,SAAS,EAAC,sCAAsC;MAChD8D,SAAS,EAAGjB,YAAY,CAACzB,MAAQ;MAAA8B,QAAA,EAE/B9B;IAAM,CACQ,CACjB;EAAA,CACG,CAAC;AAER;AAAC,IAAAoD,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEc,IAAAoB,mBAAU,EAAExD,iBAAkB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_i18n","_compose","_navigableRegion","_jsxRuntime","ANIMATION_DURATION","commonTransition","type","duration","ease","useHTMLClass","className","useEffect","element","document","querySelector","classList","toggle","headerVariants","hidden","opacity","marginTop","visible","distractionFreeHover","transition","delay","delayChildren","distractionFreeHidden","distractionFreeDisabled","InterfaceSkeleton","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","content","actions","labels","ref","secondarySidebarResizeListener","secondarySidebarSize","useResizeObserver","isMobileViewport","useViewportMatch","disableMotion","useReducedMotion","defaultTransition","defaultLabels","_x","body","__","mergedLabels","jsxs","clsx","children","jsx","__unstableAnimatePresence","initial","default","as","motion","div","whileHover","animate","exit","variants","ariaLabel","open","width","closed","__unstableMotion","style","position","height","left","x","_default","exports","forwardRef"],"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableRegion from '../navigable-region';\n\nconst ANIMATION_DURATION = 0.25;\nconst commonTransition = {\n\ttype: 'tween',\n\tduration: ANIMATION_DURATION,\n\tease: [ 0.6, 0, 0.4, 1 ],\n};\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\nconst headerVariants = {\n\thidden: { opacity: 1, marginTop: -60 },\n\tvisible: { opacity: 1, marginTop: 0 },\n\tdistractionFreeHover: {\n\t\topacity: 1,\n\t\tmarginTop: 0,\n\t\ttransition: {\n\t\t\t...commonTransition,\n\t\t\tdelay: 0.2,\n\t\t\tdelayChildren: 0.2,\n\t\t},\n\t},\n\tdistractionFreeHidden: {\n\t\topacity: 0,\n\t\tmarginTop: -60,\n\t},\n\tdistractionFreeDisabled: {\n\t\topacity: 0,\n\t\tmarginTop: 0,\n\t\ttransition: {\n\t\t\t...commonTransition,\n\t\t\tdelay: 0.8,\n\t\t\tdelayChildren: 0.8,\n\t\t},\n\t},\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\tcontent,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t},\n\tref\n) {\n\tconst [ secondarySidebarResizeListener, secondarySidebarSize ] =\n\t\tuseResizeObserver();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst disableMotion = useReducedMotion();\n\tconst defaultTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t};\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: _x( 'Header', 'header landmark area' ),\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\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ clsx(\n\t\t\t\tclassName,\n\t\t\t\t'interface-interface-skeleton',\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<AnimatePresence initial={ false }>\n\t\t\t\t\t{ !! header && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHidden'\n\t\t\t\t\t\t\t\t\t: 'hidden'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHover'\n\t\t\t\t\t\t\t\t\t: 'visible'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeDisabled'\n\t\t\t\t\t\t\t\t\t: 'visible'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHidden'\n\t\t\t\t\t\t\t\t\t: 'hidden'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvariants={ headerVariants }\n\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ header }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t</AnimatePresence>\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<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\t\tariaLabel={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\t\tinitial=\"closed\"\n\t\t\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\t\t\texit=\"closed\"\n\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\topen: { width: secondarySidebarSize.width },\n\t\t\t\t\t\t\t\t\tclosed: { width: 0 },\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t\t\twidth: isMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t? '100vw'\n\t\t\t\t\t\t\t\t\t\t\t: 'fit-content',\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\t\topen: { x: 0 },\n\t\t\t\t\t\t\t\t\t\tclosed: { x: '-100%' },\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ secondarySidebarResizeListener }\n\t\t\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatePresence>\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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AASA,IAAAK,gBAAA,GAAAN,sBAAA,CAAAC,OAAA;AAAkD,IAAAM,WAAA,GAAAN,OAAA;AAvBlD;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAGA,MAAMO,kBAAkB,GAAG,IAAI;AAC/B,MAAMC,gBAAgB,GAAG;EACxBC,IAAI,EAAE,OAAO;EACbC,QAAQ,EAAEH,kBAAkB;EAC5BI,IAAI,EAAE,CAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AACvB,CAAC;AAED,SAASC,YAAYA,CAAEC,SAAS,EAAG;EAClC,IAAAC,kBAAS,EAAE,MAAM;IAChB,MAAMC,OAAO,GACZC,QAAQ,IAAIA,QAAQ,CAACC,aAAa,CAAG,aAAaJ,SAAW,GAAG,CAAC;IAClE,IAAK,CAAEE,OAAO,EAAG;MAChB;IACD;IACAA,OAAO,CAACG,SAAS,CAACC,MAAM,CAAEN,SAAU,CAAC;IACrC,OAAO,MAAM;MACZE,OAAO,CAACG,SAAS,CAACC,MA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oreList":[]}
|
|
@@ -4,21 +4,27 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default =
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
8
9
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
10
15
|
/**
|
|
11
16
|
* External dependencies
|
|
12
17
|
*/
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
const NavigableRegion = (0, _element.forwardRef)(({
|
|
15
20
|
children,
|
|
16
21
|
className,
|
|
17
22
|
ariaLabel,
|
|
18
23
|
as: Tag = 'div',
|
|
19
24
|
...props
|
|
20
|
-
}) {
|
|
25
|
+
}, ref) => {
|
|
21
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
|
|
27
|
+
ref: ref,
|
|
22
28
|
className: (0, _clsx.default)('interface-navigable-region', className),
|
|
23
29
|
"aria-label": ariaLabel,
|
|
24
30
|
role: "region",
|
|
@@ -26,5 +32,7 @@ function NavigableRegion({
|
|
|
26
32
|
...props,
|
|
27
33
|
children: children
|
|
28
34
|
});
|
|
29
|
-
}
|
|
35
|
+
});
|
|
36
|
+
NavigableRegion.displayName = 'NavigableRegion';
|
|
37
|
+
var _default = exports.default = NavigableRegion;
|
|
30
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_element","require","_clsx","_interopRequireDefault","_jsxRuntime","NavigableRegion","forwardRef","children","className","ariaLabel","as","Tag","props","ref","jsx","clsx","role","tabIndex","displayName","_default","exports","default"],"sources":["@wordpress/interface/src/components/navigable-region/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\nconst NavigableRegion = forwardRef(\n\t( { children, className, ariaLabel, as: Tag = 'div', ...props }, ref ) => {\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'interface-navigable-region', className ) }\n\t\t\t\taria-label={ ariaLabel }\n\t\t\t\trole=\"region\"\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Tag>\n\t\t);\n\t}\n);\n\nNavigableRegion.displayName = 'NavigableRegion';\nexport default NavigableRegion;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAwB,IAAAG,WAAA,GAAAH,OAAA;AARxB;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMI,eAAe,GAAG,IAAAC,mBAAU,EACjC,CAAE;EAAEC,QAAQ;EAAEC,SAAS;EAAEC,SAAS;EAAEC,EAAE,EAAEC,GAAG,GAAG,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAM;EACzE,oBACC,IAAAT,WAAA,CAAAU,GAAA,EAACH,GAAG;IACHE,GAAG,EAAGA,GAAK;IACXL,SAAS,EAAG,IAAAO,aAAI,EAAE,4BAA4B,EAAEP,SAAU,CAAG;IAC7D,cAAaC,SAAW;IACxBO,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAC,IAAI;IAAA,GACRL,KAAK;IAAAL,QAAA,EAERA;EAAQ,CACN,CAAC;AAER,CACD,CAAC;AAEDF,eAAe,CAACa,WAAW,GAAG,iBAAiB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACjChB,eAAe","ignoreList":[]}
|
|
@@ -9,7 +9,18 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
9
9
|
*/
|
|
10
10
|
import { store as interfaceStore } from '../../store';
|
|
11
11
|
import complementaryAreaContext from '../complementary-area-context';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Whether the role supports checked state.
|
|
15
|
+
*
|
|
16
|
+
* @param {import('react').AriaRole} role Role.
|
|
17
|
+
* @return {boolean} Whether the role supports checked state.
|
|
18
|
+
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
19
|
+
*/
|
|
12
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
function roleSupportsCheckedState(role) {
|
|
22
|
+
return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role);
|
|
23
|
+
}
|
|
13
24
|
function ComplementaryAreaToggle({
|
|
14
25
|
as = Button,
|
|
15
26
|
scope,
|
|
@@ -28,7 +39,10 @@ function ComplementaryAreaToggle({
|
|
|
28
39
|
} = useDispatch(interfaceStore);
|
|
29
40
|
return /*#__PURE__*/_jsx(ComponentToUse, {
|
|
30
41
|
icon: selectedIcon && isSelected ? selectedIcon : icon,
|
|
31
|
-
"aria-controls": identifier.replace('/', ':')
|
|
42
|
+
"aria-controls": identifier.replace('/', ':')
|
|
43
|
+
// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
44
|
+
,
|
|
45
|
+
"aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined,
|
|
32
46
|
onClick: () => {
|
|
33
47
|
if (isSelected) {
|
|
34
48
|
disableComplementaryArea(scope);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","useDispatch","useSelect","store","interfaceStore","complementaryAreaContext","jsx","_jsx","ComplementaryAreaToggle","as","scope","identifier","icon","selectedIcon","name","shortcut","props","ComponentToUse","isSelected","select","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","replace","onClick"],"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\tshortcut,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier, scope ]\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\taria-controls={ identifier.replace( '/', ':' ) }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,cAAc,QAAQ,aAAa;AACrD,OAAOC,wBAAwB,MAAM,+BAA+B;
|
|
1
|
+
{"version":3,"names":["Button","useDispatch","useSelect","store","interfaceStore","complementaryAreaContext","jsx","_jsx","roleSupportsCheckedState","role","includes","ComplementaryAreaToggle","as","scope","identifier","icon","selectedIcon","name","shortcut","props","ComponentToUse","isSelected","select","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","replace","undefined","onClick"],"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\nimport complementaryAreaContext from '../complementary-area-context';\n\n/**\n * Whether the role supports checked state.\n *\n * @param {import('react').AriaRole} role Role.\n * @return {boolean} Whether the role supports checked state.\n * @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n */\nfunction roleSupportsCheckedState( role ) {\n\treturn [\n\t\t'checkbox',\n\t\t'option',\n\t\t'radio',\n\t\t'switch',\n\t\t'menuitemcheckbox',\n\t\t'menuitemradio',\n\t\t'treeitem',\n\t].includes( role );\n}\n\nfunction ComplementaryAreaToggle( {\n\tas = Button,\n\tscope,\n\tidentifier,\n\ticon,\n\tselectedIcon,\n\tname,\n\tshortcut,\n\t...props\n} ) {\n\tconst ComponentToUse = as;\n\tconst isSelected = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( scope ) ===\n\t\t\tidentifier,\n\t\t[ identifier, scope ]\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\n\t\t\taria-controls={ identifier.replace( '/', ':' ) }\n\t\t\t// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n\t\t\taria-checked={\n\t\t\t\troleSupportsCheckedState( props.role ) ? isSelected : undefined\n\t\t\t}\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isSelected ) {\n\t\t\t\t\tdisableComplementaryArea( scope );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( scope, identifier );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryArea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AEZ,KAAM,CAAC;MAClC,CAAC,MAAM;QACNW,uBAAuB,CAAEX,KAAK,EAAEC,UAAW,CAAC;MAC7C;IACD,CAAG;IACHI,QAAQ,EAAGA,QAAU;IAAA,GAChBC;EAAK,CACV,CAAC;AAEJ;AAEA,eAAed,wBAAwB,CAAEM,uBAAwB,CAAC","ignoreList":[]}
|
|
@@ -7,9 +7,9 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { forwardRef, useEffect } from '@wordpress/element';
|
|
10
|
-
import {
|
|
10
|
+
import { __unstableMotion as motion, __unstableAnimatePresence as AnimatePresence } from '@wordpress/components';
|
|
11
11
|
import { __, _x } from '@wordpress/i18n';
|
|
12
|
-
import {
|
|
12
|
+
import { useReducedMotion, useViewportMatch, useResizeObserver } from '@wordpress/compose';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
@@ -77,11 +77,7 @@ function InterfaceSkeleton({
|
|
|
77
77
|
content,
|
|
78
78
|
actions,
|
|
79
79
|
labels,
|
|
80
|
-
className
|
|
81
|
-
enableRegionNavigation = true,
|
|
82
|
-
// Todo: does this need to be a prop.
|
|
83
|
-
// Can we use a dependency to keyboard-shortcuts directly?
|
|
84
|
-
shortcuts
|
|
80
|
+
className
|
|
85
81
|
}, ref) {
|
|
86
82
|
const [secondarySidebarResizeListener, secondarySidebarSize] = useResizeObserver();
|
|
87
83
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
@@ -91,7 +87,6 @@ function InterfaceSkeleton({
|
|
|
91
87
|
duration: disableMotion ? 0 : ANIMATION_DURATION,
|
|
92
88
|
ease: [0.6, 0, 0.4, 1]
|
|
93
89
|
};
|
|
94
|
-
const navigateRegionsProps = useNavigateRegions(shortcuts);
|
|
95
90
|
useHTMLClass('interface-interface-skeleton__html-container');
|
|
96
91
|
const defaultLabels = {
|
|
97
92
|
/* translators: accessibility text for the top bar landmark region. */
|
|
@@ -112,9 +107,8 @@ function InterfaceSkeleton({
|
|
|
112
107
|
...labels
|
|
113
108
|
};
|
|
114
109
|
return /*#__PURE__*/_jsxs("div", {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
className: clsx(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer'),
|
|
110
|
+
ref: ref,
|
|
111
|
+
className: clsx(className, 'interface-interface-skeleton', !!footer && 'has-footer'),
|
|
118
112
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
119
113
|
className: "interface-interface-skeleton__editor",
|
|
120
114
|
children: [/*#__PURE__*/_jsx(AnimatePresence, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","forwardRef","useEffect","__unstableUseNavigateRegions","useNavigateRegions","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","__","_x","useMergeRefs","useReducedMotion","useViewportMatch","useResizeObserver","NavigableRegion","jsx","_jsx","jsxs","_jsxs","ANIMATION_DURATION","commonTransition","type","duration","ease","useHTMLClass","className","element","document","querySelector","classList","toggle","headerVariants","hidden","opacity","marginTop","visible","distractionFreeHover","transition","delay","delayChildren","distractionFreeHidden","distractionFreeDisabled","InterfaceSkeleton","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","content","actions","labels","enableRegionNavigation","shortcuts","ref","secondarySidebarResizeListener","secondarySidebarSize","isMobileViewport","disableMotion","defaultTransition","navigateRegionsProps","defaultLabels","body","mergedLabels","undefined","children","initial","as","div","whileHover","animate","exit","variants","ariaLabel","open","width","closed","style","position","height","left","x"],"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\t__unstableUseNavigateRegions as useNavigateRegions,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tuseMergeRefs,\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableRegion from '../navigable-region';\n\nconst ANIMATION_DURATION = 0.25;\nconst commonTransition = {\n\ttype: 'tween',\n\tduration: ANIMATION_DURATION,\n\tease: [ 0.6, 0, 0.4, 1 ],\n};\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\nconst headerVariants = {\n\thidden: { opacity: 1, marginTop: -60 },\n\tvisible: { opacity: 1, marginTop: 0 },\n\tdistractionFreeHover: {\n\t\topacity: 1,\n\t\tmarginTop: 0,\n\t\ttransition: {\n\t\t\t...commonTransition,\n\t\t\tdelay: 0.2,\n\t\t\tdelayChildren: 0.2,\n\t\t},\n\t},\n\tdistractionFreeHidden: {\n\t\topacity: 0,\n\t\tmarginTop: -60,\n\t},\n\tdistractionFreeDisabled: {\n\t\topacity: 0,\n\t\tmarginTop: 0,\n\t\ttransition: {\n\t\t\t...commonTransition,\n\t\t\tdelay: 0.8,\n\t\t\tdelayChildren: 0.8,\n\t\t},\n\t},\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\tcontent,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t\tenableRegionNavigation = true,\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 [ secondarySidebarResizeListener, secondarySidebarSize ] =\n\t\tuseResizeObserver();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst disableMotion = useReducedMotion();\n\tconst defaultTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t};\n\tconst navigateRegionsProps = useNavigateRegions( shortcuts );\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: _x( 'Header', 'header landmark area' ),\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\treturn (\n\t\t<div\n\t\t\t{ ...( enableRegionNavigation ? navigateRegionsProps : {} ) }\n\t\t\tref={ useMergeRefs( [\n\t\t\t\tref,\n\t\t\t\tenableRegionNavigation ? navigateRegionsProps.ref : undefined,\n\t\t\t] ) }\n\t\t\tclassName={ clsx(\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<AnimatePresence initial={ false }>\n\t\t\t\t\t{ !! header && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHidden'\n\t\t\t\t\t\t\t\t\t: 'hidden'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHover'\n\t\t\t\t\t\t\t\t\t: 'visible'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeDisabled'\n\t\t\t\t\t\t\t\t\t: 'visible'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHidden'\n\t\t\t\t\t\t\t\t\t: 'hidden'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvariants={ headerVariants }\n\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ header }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t</AnimatePresence>\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<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\t\tariaLabel={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\t\tinitial=\"closed\"\n\t\t\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\t\t\texit=\"closed\"\n\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\topen: { width: secondarySidebarSize.width },\n\t\t\t\t\t\t\t\t\tclosed: { width: 0 },\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t\t\twidth: isMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t? '100vw'\n\t\t\t\t\t\t\t\t\t\t\t: 'fit-content',\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\t\topen: { x: 0 },\n\t\t\t\t\t\t\t\t\t\tclosed: { x: '-100%' },\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ secondarySidebarResizeListener }\n\t\t\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatePresence>\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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,UAAU,EAAEC,SAAS,QAAQ,oBAAoB;AAC1D,SACCC,4BAA4B,IAAIC,kBAAkB,EAClDC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,QACX,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAElD,MAAMC,kBAAkB,GAAG,IAAI;AAC/B,MAAMC,gBAAgB,GAAG;EACxBC,IAAI,EAAE,OAAO;EACbC,QAAQ,EAAEH,kBAAkB;EAC5BI,IAAI,EAAE,CAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AACvB,CAAC;AAED,SAASC,YAAYA,CAAEC,SAAS,EAAG;EAClCxB,SAAS,CAAE,M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CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","forwardRef","useEffect","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","__","_x","useReducedMotion","useViewportMatch","useResizeObserver","NavigableRegion","jsx","_jsx","jsxs","_jsxs","ANIMATION_DURATION","commonTransition","type","duration","ease","useHTMLClass","className","element","document","querySelector","classList","toggle","headerVariants","hidden","opacity","marginTop","visible","distractionFreeHover","transition","delay","delayChildren","distractionFreeHidden","distractionFreeDisabled","InterfaceSkeleton","isDistractionFree","footer","header","editorNotices","sidebar","secondarySidebar","content","actions","labels","ref","secondarySidebarResizeListener","secondarySidebarSize","isMobileViewport","disableMotion","defaultTransition","defaultLabels","body","mergedLabels","children","initial","as","div","whileHover","animate","exit","variants","ariaLabel","open","width","closed","style","position","height","left","x"],"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NavigableRegion from '../navigable-region';\n\nconst ANIMATION_DURATION = 0.25;\nconst commonTransition = {\n\ttype: 'tween',\n\tduration: ANIMATION_DURATION,\n\tease: [ 0.6, 0, 0.4, 1 ],\n};\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\nconst headerVariants = {\n\thidden: { opacity: 1, marginTop: -60 },\n\tvisible: { opacity: 1, marginTop: 0 },\n\tdistractionFreeHover: {\n\t\topacity: 1,\n\t\tmarginTop: 0,\n\t\ttransition: {\n\t\t\t...commonTransition,\n\t\t\tdelay: 0.2,\n\t\t\tdelayChildren: 0.2,\n\t\t},\n\t},\n\tdistractionFreeHidden: {\n\t\topacity: 0,\n\t\tmarginTop: -60,\n\t},\n\tdistractionFreeDisabled: {\n\t\topacity: 0,\n\t\tmarginTop: 0,\n\t\ttransition: {\n\t\t\t...commonTransition,\n\t\t\tdelay: 0.8,\n\t\t\tdelayChildren: 0.8,\n\t\t},\n\t},\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\tcontent,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t},\n\tref\n) {\n\tconst [ secondarySidebarResizeListener, secondarySidebarSize ] =\n\t\tuseResizeObserver();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst disableMotion = useReducedMotion();\n\tconst defaultTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t};\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: _x( 'Header', 'header landmark area' ),\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\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ clsx(\n\t\t\t\tclassName,\n\t\t\t\t'interface-interface-skeleton',\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<AnimatePresence initial={ false }>\n\t\t\t\t\t{ !! header && (\n\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHidden'\n\t\t\t\t\t\t\t\t\t: 'hidden'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHover'\n\t\t\t\t\t\t\t\t\t: 'visible'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeDisabled'\n\t\t\t\t\t\t\t\t\t: 'visible'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\tisDistractionFree && ! isMobileViewport\n\t\t\t\t\t\t\t\t\t? 'distractionFreeHidden'\n\t\t\t\t\t\t\t\t\t: 'hidden'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvariants={ headerVariants }\n\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ header }\n\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t) }\n\t\t\t\t</AnimatePresence>\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<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\t\tariaLabel={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\t\tinitial=\"closed\"\n\t\t\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\t\t\texit=\"closed\"\n\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\topen: { width: secondarySidebarSize.width },\n\t\t\t\t\t\t\t\t\tclosed: { width: 0 },\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t\t\twidth: isMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t? '100vw'\n\t\t\t\t\t\t\t\t\t\t\t: 'fit-content',\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\t\topen: { x: 0 },\n\t\t\t\t\t\t\t\t\t\tclosed: { x: '-100%' },\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ secondarySidebarResizeListener }\n\t\t\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatePresence>\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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,UAAU,EAAEC,SAAS,QAAQ,oBAAoB;AAC1D,SACCC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBA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AAA,EAE/BjB;IAAM,CACQ,CACjB;EAAA,CACG,CAAC;AAER;AAEA,eAAezC,UAAU,CAAEuC,iBAAkB,CAAC","ignoreList":[]}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef } from '@wordpress/element';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* External dependencies
|
|
3
8
|
*/
|
|
4
9
|
import clsx from 'clsx';
|
|
5
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
11
|
+
const NavigableRegion = forwardRef(({
|
|
7
12
|
children,
|
|
8
13
|
className,
|
|
9
14
|
ariaLabel,
|
|
10
15
|
as: Tag = 'div',
|
|
11
16
|
...props
|
|
12
|
-
}) {
|
|
17
|
+
}, ref) => {
|
|
13
18
|
return /*#__PURE__*/_jsx(Tag, {
|
|
19
|
+
ref: ref,
|
|
14
20
|
className: clsx('interface-navigable-region', className),
|
|
15
21
|
"aria-label": ariaLabel,
|
|
16
22
|
role: "region",
|
|
@@ -18,5 +24,7 @@ export default function NavigableRegion({
|
|
|
18
24
|
...props,
|
|
19
25
|
children: children
|
|
20
26
|
});
|
|
21
|
-
}
|
|
27
|
+
});
|
|
28
|
+
NavigableRegion.displayName = 'NavigableRegion';
|
|
29
|
+
export default NavigableRegion;
|
|
22
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","jsx","_jsx","NavigableRegion","children","className","ariaLabel","as","Tag","props","role","tabIndex"],"sources":["@wordpress/interface/src/components/navigable-region/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\
|
|
1
|
+
{"version":3,"names":["forwardRef","clsx","jsx","_jsx","NavigableRegion","children","className","ariaLabel","as","Tag","props","ref","role","tabIndex","displayName"],"sources":["@wordpress/interface/src/components/navigable-region/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\nconst NavigableRegion = forwardRef(\n\t( { children, className, ariaLabel, as: Tag = 'div', ...props }, ref ) => {\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx( 'interface-navigable-region', className ) }\n\t\t\t\taria-label={ ariaLabel }\n\t\t\t\trole=\"region\"\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Tag>\n\t\t);\n\t}\n);\n\nNavigableRegion.displayName = 'NavigableRegion';\nexport default NavigableRegion;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,MAAM;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExB,MAAMC,eAAe,GAAGJ,UAAU,CACjC,CAAE;EAAEK,QAAQ;EAAEC,SAAS;EAAEC,SAAS;EAAEC,EAAE,EAAEC,GAAG,GAAG,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAM;EACzE,oBACCR,IAAA,CAACM,GAAG;IACHE,GAAG,EAAGA,GAAK;IACXL,SAAS,EAAGL,IAAI,CAAE,4BAA4B,EAAEK,SAAU,CAAG;IAC7D,cAAaC,SAAW;IACxBK,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAC,IAAI;IAAA,GACRH,KAAK;IAAAL,QAAA,EAERA;EAAQ,CACN,CAAC;AAER,CACD,CAAC;AAEDD,eAAe,CAACU,WAAW,GAAG,iBAAiB;AAC/C,eAAeV,eAAe","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/interface",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.7",
|
|
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",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.16.0",
|
|
36
36
|
"@wordpress/a11y": "^4.8.2",
|
|
37
|
-
"@wordpress/components": "^28.8.
|
|
37
|
+
"@wordpress/components": "^28.8.7",
|
|
38
38
|
"@wordpress/compose": "^7.8.3",
|
|
39
39
|
"@wordpress/data": "^10.8.3",
|
|
40
40
|
"@wordpress/deprecated": "^4.8.2",
|
|
41
41
|
"@wordpress/element": "^6.8.1",
|
|
42
42
|
"@wordpress/i18n": "^5.8.2",
|
|
43
43
|
"@wordpress/icons": "^10.8.2",
|
|
44
|
-
"@wordpress/plugins": "^7.8.
|
|
45
|
-
"@wordpress/preferences": "^4.8.
|
|
44
|
+
"@wordpress/plugins": "^7.8.7",
|
|
45
|
+
"@wordpress/preferences": "^4.8.7",
|
|
46
46
|
"@wordpress/private-apis": "^1.8.1",
|
|
47
47
|
"@wordpress/viewport": "^6.8.3",
|
|
48
48
|
"clsx": "^2.1.1"
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "b1ace05ee94f0803e51b205306c19fc706499ede"
|
|
58
58
|
}
|
|
@@ -10,6 +10,25 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
10
10
|
import { store as interfaceStore } from '../../store';
|
|
11
11
|
import complementaryAreaContext from '../complementary-area-context';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Whether the role supports checked state.
|
|
15
|
+
*
|
|
16
|
+
* @param {import('react').AriaRole} role Role.
|
|
17
|
+
* @return {boolean} Whether the role supports checked state.
|
|
18
|
+
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
19
|
+
*/
|
|
20
|
+
function roleSupportsCheckedState( role ) {
|
|
21
|
+
return [
|
|
22
|
+
'checkbox',
|
|
23
|
+
'option',
|
|
24
|
+
'radio',
|
|
25
|
+
'switch',
|
|
26
|
+
'menuitemcheckbox',
|
|
27
|
+
'menuitemradio',
|
|
28
|
+
'treeitem',
|
|
29
|
+
].includes( role );
|
|
30
|
+
}
|
|
31
|
+
|
|
13
32
|
function ComplementaryAreaToggle( {
|
|
14
33
|
as = Button,
|
|
15
34
|
scope,
|
|
@@ -35,6 +54,10 @@ function ComplementaryAreaToggle( {
|
|
|
35
54
|
<ComponentToUse
|
|
36
55
|
icon={ selectedIcon && isSelected ? selectedIcon : icon }
|
|
37
56
|
aria-controls={ identifier.replace( '/', ':' ) }
|
|
57
|
+
// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
|
|
58
|
+
aria-checked={
|
|
59
|
+
roleSupportsCheckedState( props.role ) ? isSelected : undefined
|
|
60
|
+
}
|
|
38
61
|
onClick={ () => {
|
|
39
62
|
if ( isSelected ) {
|
|
40
63
|
disableComplementaryArea( scope );
|
|
@@ -8,13 +8,11 @@ import clsx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
import { forwardRef, useEffect } from '@wordpress/element';
|
|
10
10
|
import {
|
|
11
|
-
__unstableUseNavigateRegions as useNavigateRegions,
|
|
12
11
|
__unstableMotion as motion,
|
|
13
12
|
__unstableAnimatePresence as AnimatePresence,
|
|
14
13
|
} from '@wordpress/components';
|
|
15
14
|
import { __, _x } from '@wordpress/i18n';
|
|
16
15
|
import {
|
|
17
|
-
useMergeRefs,
|
|
18
16
|
useReducedMotion,
|
|
19
17
|
useViewportMatch,
|
|
20
18
|
useResizeObserver,
|
|
@@ -85,10 +83,6 @@ function InterfaceSkeleton(
|
|
|
85
83
|
actions,
|
|
86
84
|
labels,
|
|
87
85
|
className,
|
|
88
|
-
enableRegionNavigation = true,
|
|
89
|
-
// Todo: does this need to be a prop.
|
|
90
|
-
// Can we use a dependency to keyboard-shortcuts directly?
|
|
91
|
-
shortcuts,
|
|
92
86
|
},
|
|
93
87
|
ref
|
|
94
88
|
) {
|
|
@@ -101,7 +95,6 @@ function InterfaceSkeleton(
|
|
|
101
95
|
duration: disableMotion ? 0 : ANIMATION_DURATION,
|
|
102
96
|
ease: [ 0.6, 0, 0.4, 1 ],
|
|
103
97
|
};
|
|
104
|
-
const navigateRegionsProps = useNavigateRegions( shortcuts );
|
|
105
98
|
useHTMLClass( 'interface-interface-skeleton__html-container' );
|
|
106
99
|
|
|
107
100
|
const defaultLabels = {
|
|
@@ -123,15 +116,10 @@ function InterfaceSkeleton(
|
|
|
123
116
|
|
|
124
117
|
return (
|
|
125
118
|
<div
|
|
126
|
-
{
|
|
127
|
-
ref={ useMergeRefs( [
|
|
128
|
-
ref,
|
|
129
|
-
enableRegionNavigation ? navigateRegionsProps.ref : undefined,
|
|
130
|
-
] ) }
|
|
119
|
+
ref={ ref }
|
|
131
120
|
className={ clsx(
|
|
132
121
|
className,
|
|
133
122
|
'interface-interface-skeleton',
|
|
134
|
-
navigateRegionsProps.className,
|
|
135
123
|
!! footer && 'has-footer'
|
|
136
124
|
) }
|
|
137
125
|
>
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef } from '@wordpress/element';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* External dependencies
|
|
3
8
|
*/
|
|
4
9
|
import clsx from 'clsx';
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
children,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
const NavigableRegion = forwardRef(
|
|
12
|
+
( { children, className, ariaLabel, as: Tag = 'div', ...props }, ref ) => {
|
|
13
|
+
return (
|
|
14
|
+
<Tag
|
|
15
|
+
ref={ ref }
|
|
16
|
+
className={ clsx( 'interface-navigable-region', className ) }
|
|
17
|
+
aria-label={ ariaLabel }
|
|
18
|
+
role="region"
|
|
19
|
+
tabIndex="-1"
|
|
20
|
+
{ ...props }
|
|
21
|
+
>
|
|
22
|
+
{ children }
|
|
23
|
+
</Tag>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
NavigableRegion.displayName = 'NavigableRegion';
|
|
29
|
+
export default NavigableRegion;
|