@wordpress/interface 5.11.0 → 5.12.1
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 +2 -0
- package/build/components/action-item/index.js +31 -38
- package/build/components/action-item/index.js.map +1 -1
- package/build/components/complementary-area/index.js +30 -34
- package/build/components/complementary-area/index.js.map +1 -1
- package/build/components/complementary-area-header/index.js +10 -12
- package/build/components/complementary-area-header/index.js.map +1 -1
- package/build/components/complementary-area-more-menu-item/index.js +24 -27
- package/build/components/complementary-area-more-menu-item/index.js.map +1 -1
- package/build/components/complementary-area-toggle/index.js +13 -15
- package/build/components/complementary-area-toggle/index.js.map +1 -1
- package/build/components/fullscreen-mode/index.js +3 -4
- package/build/components/fullscreen-mode/index.js.map +1 -1
- package/build/components/interface-skeleton/index.js +32 -33
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build/components/more-menu-dropdown/index.js +11 -12
- package/build/components/more-menu-dropdown/index.js.map +1 -1
- package/build/components/more-menu-feature-toggle/index.js +9 -10
- package/build/components/more-menu-feature-toggle/index.js.map +1 -1
- package/build/components/navigable-region/index.js +11 -13
- package/build/components/navigable-region/index.js.map +1 -1
- package/build/components/pinned-items/index.js +15 -17
- package/build/components/pinned-items/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -5
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal-base-option/index.js +7 -8
- package/build/components/preferences-modal-base-option/index.js.map +1 -1
- package/build/components/preferences-modal-section/index.js +13 -16
- package/build/components/preferences-modal-section/index.js.map +1 -1
- package/build/components/preferences-modal-tabs/index.js +8 -10
- package/build/components/preferences-modal-tabs/index.js.map +1 -1
- package/build/store/actions.js +23 -33
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -4
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +3 -7
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/action-item/index.js +31 -35
- package/build-module/components/action-item/index.js.map +1 -1
- package/build-module/components/complementary-area/index.js +30 -33
- package/build-module/components/complementary-area/index.js.map +1 -1
- package/build-module/components/complementary-area-header/index.js +10 -11
- package/build-module/components/complementary-area-header/index.js.map +1 -1
- package/build-module/components/complementary-area-more-menu-item/index.js +23 -25
- package/build-module/components/complementary-area-more-menu-item/index.js.map +1 -1
- package/build-module/components/complementary-area-toggle/index.js +13 -14
- package/build-module/components/complementary-area-toggle/index.js.map +1 -1
- package/build-module/components/fullscreen-mode/index.js +3 -4
- package/build-module/components/fullscreen-mode/index.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +32 -32
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-module/components/more-menu-dropdown/index.js +10 -11
- package/build-module/components/more-menu-dropdown/index.js.map +1 -1
- package/build-module/components/more-menu-feature-toggle/index.js +9 -10
- package/build-module/components/more-menu-feature-toggle/index.js.map +1 -1
- package/build-module/components/navigable-region/index.js +11 -12
- package/build-module/components/navigable-region/index.js.map +1 -1
- package/build-module/components/pinned-items/index.js +15 -16
- package/build-module/components/pinned-items/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal-base-option/index.js +7 -8
- package/build-module/components/preferences-modal-base-option/index.js.map +1 -1
- package/build-module/components/preferences-modal-section/index.js +13 -16
- package/build-module/components/preferences-modal-section/index.js.map +1 -1
- package/build-module/components/preferences-modal-tabs/index.js +8 -10
- package/build-module/components/preferences-modal-tabs/index.js.map +1 -1
- package/build-module/store/actions.js +23 -33
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -7
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +13 -13
- package/src/components/interface-skeleton/index.js +23 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -9,8 +7,6 @@ exports.default = void 0;
|
|
|
9
7
|
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
9
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _components = require("@wordpress/components");
|
|
15
11
|
|
|
16
12
|
/**
|
|
@@ -18,14 +14,13 @@ var _components = require("@wordpress/components");
|
|
|
18
14
|
*/
|
|
19
15
|
const noop = () => {};
|
|
20
16
|
|
|
21
|
-
function ActionItemSlot(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
17
|
+
function ActionItemSlot({
|
|
18
|
+
name,
|
|
19
|
+
as: Component = _components.ButtonGroup,
|
|
20
|
+
fillProps = {},
|
|
21
|
+
bubblesVirtually,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
29
24
|
return (0, _element.createElement)(_components.Slot, {
|
|
30
25
|
name: name,
|
|
31
26
|
bubblesVirtually: bubblesVirtually,
|
|
@@ -42,14 +37,12 @@ function ActionItemSlot(_ref) {
|
|
|
42
37
|
|
|
43
38
|
const initializedByPlugins = [];
|
|
44
39
|
|
|
45
|
-
_element.Children.forEach(fills,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} = _ref2;
|
|
52
|
-
|
|
40
|
+
_element.Children.forEach(fills, ({
|
|
41
|
+
props: {
|
|
42
|
+
__unstableExplicitMenuItem,
|
|
43
|
+
__unstableTarget
|
|
44
|
+
}
|
|
45
|
+
}) => {
|
|
53
46
|
if (__unstableTarget && __unstableExplicitMenuItem) {
|
|
54
47
|
initializedByPlugins.push(__unstableTarget);
|
|
55
48
|
}
|
|
@@ -63,29 +56,29 @@ function ActionItemSlot(_ref) {
|
|
|
63
56
|
return child;
|
|
64
57
|
});
|
|
65
58
|
|
|
66
|
-
return (0, _element.createElement)(Component, props
|
|
59
|
+
return (0, _element.createElement)(Component, { ...props
|
|
60
|
+
}, children);
|
|
67
61
|
});
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
function ActionItem(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
} = _ref3;
|
|
64
|
+
function ActionItem({
|
|
65
|
+
name,
|
|
66
|
+
as: Component = _components.Button,
|
|
67
|
+
onClick,
|
|
68
|
+
...props
|
|
69
|
+
}) {
|
|
77
70
|
return (0, _element.createElement)(_components.Fill, {
|
|
78
71
|
name: name
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
72
|
+
}, ({
|
|
73
|
+
onClick: fpOnClick
|
|
74
|
+
}) => {
|
|
75
|
+
return (0, _element.createElement)(Component, {
|
|
76
|
+
onClick: onClick || fpOnClick ? (...args) => {
|
|
77
|
+
(onClick || noop)(...args);
|
|
78
|
+
(fpOnClick || noop)(...args);
|
|
79
|
+
} : undefined,
|
|
80
|
+
...props
|
|
81
|
+
});
|
|
89
82
|
});
|
|
90
83
|
}
|
|
91
84
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["noop","ActionItemSlot","name","as","Component","ButtonGroup","fillProps","bubblesVirtually","props","fills","Children","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","Button","onClick","fpOnClick","undefined","Slot"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["noop","ActionItemSlot","name","as","Component","ButtonGroup","fillProps","bubblesVirtually","props","fills","Children","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","Button","onClick","fpOnClick","args","undefined","Slot"],"mappings":";;;;;;;AAIA;;AADA;;AAHA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,cAAT,CAAyB;AACxBC,EAAAA,IADwB;AAExBC,EAAAA,EAAE,EAAEC,SAAS,GAAGC,uBAFQ;AAGxBC,EAAAA,SAAS,GAAG,EAHY;AAIxBC,EAAAA,gBAJwB;AAKxB,KAAGC;AALqB,CAAzB,EAMI;AACH,SACC,4BAAC,gBAAD;AACC,IAAA,IAAI,EAAGN,IADR;AAEC,IAAA,gBAAgB,EAAGK,gBAFpB;AAGC,IAAA,SAAS,EAAGD;AAHb,KAKKG,KAAF,IAAa;AACd,QAAK,CAAEC,kBAASC,OAAT,CAAkBF,KAAlB,EAA0BG,MAAjC,EAA0C;AACzC,aAAO,IAAP;AACA,KAHa,CAKd;AACA;AACA;AACA;AACA;;;AACA,UAAMC,oBAAoB,GAAG,EAA7B;;AACAH,sBAASI,OAAT,CACCL,KADD,EAEC,CAAE;AACDD,MAAAA,KAAK,EAAE;AAAEO,QAAAA,0BAAF;AAA8BC,QAAAA;AAA9B;AADN,KAAF,KAEO;AACN,UAAKA,gBAAgB,IAAID,0BAAzB,EAAsD;AACrDF,QAAAA,oBAAoB,CAACI,IAArB,CAA2BD,gBAA3B;AACA;AACD,KARF;;AAUA,UAAME,QAAQ,GAAGR,kBAASS,GAAT,CAAcV,KAAd,EAAuBW,KAAF,IAAa;AAClD,UACC,CAAEA,KAAK,CAACZ,KAAN,CAAYO,0BAAd,IACAF,oBAAoB,CAACQ,QAArB,CACCD,KAAK,CAACZ,KAAN,CAAYQ,gBADb,CAFD,EAKE;AACD,eAAO,IAAP;AACA;;AACD,aAAOI,KAAP;AACA,KAVgB,CAAjB;;AAYA,WAAO,4BAAC,SAAD,OAAgBZ;AAAhB,OAA0BU,QAA1B,CAAP;AACA,GAvCF,CADD;AA2CA;;AAED,SAASI,UAAT,CAAqB;AAAEpB,EAAAA,IAAF;AAAQC,EAAAA,EAAE,EAAEC,SAAS,GAAGmB,kBAAxB;AAAgCC,EAAAA,OAAhC;AAAyC,KAAGhB;AAA5C,CAArB,EAA2E;AAC1E,SACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAGN;AAAb,KACG,CAAE;AAAEsB,IAAAA,OAAO,EAAEC;AAAX,GAAF,KAA8B;AAC/B,WACC,4BAAC,SAAD;AACC,MAAA,OAAO,EACND,OAAO,IAAIC,SAAX,GACG,CAAE,GAAGC,IAAL,KAAe;AACf,SAAEF,OAAO,IAAIxB,IAAb,EAAqB,GAAG0B,IAAxB;AACA,SAAED,SAAS,IAAIzB,IAAf,EAAuB,GAAG0B,IAA1B;AACC,OAJJ,GAKGC,SAPL;AAAA,SASMnB;AATN,MADD;AAaA,GAfF,CADD;AAmBA;;AAEDc,UAAU,CAACM,IAAX,GAAkB3B,cAAlB;eAEeqB,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';\nimport { Children } from '@wordpress/element';\n\nconst noop = () => {};\n\nfunction ActionItemSlot( {\n\tname,\n\tas: Component = ButtonGroup,\n\tfillProps = {},\n\tbubblesVirtually,\n\t...props\n} ) {\n\treturn (\n\t\t<Slot\n\t\t\tname={ name }\n\t\t\tbubblesVirtually={ bubblesVirtually }\n\t\t\tfillProps={ fillProps }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! Children.toArray( fills ).length ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// Special handling exists for backward compatibility.\n\t\t\t\t// It ensures that menu items created by plugin authors aren't\n\t\t\t\t// duplicated with automatically injected menu items coming\n\t\t\t\t// from pinnable plugin sidebars.\n\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t\t\t\tconst initializedByPlugins = [];\n\t\t\t\tChildren.forEach(\n\t\t\t\t\tfills,\n\t\t\t\t\t( {\n\t\t\t\t\t\tprops: { __unstableExplicitMenuItem, __unstableTarget },\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tif ( __unstableTarget && __unstableExplicitMenuItem ) {\n\t\t\t\t\t\t\tinitializedByPlugins.push( __unstableTarget );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tconst children = Children.map( fills, ( child ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t! child.props.__unstableExplicitMenuItem &&\n\t\t\t\t\t\tinitializedByPlugins.includes(\n\t\t\t\t\t\t\tchild.props.__unstableTarget\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t} );\n\n\t\t\t\treturn <Component { ...props }>{ children }</Component>;\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n\nfunction ActionItem( { name, as: Component = Button, onClick, ...props } ) {\n\treturn (\n\t\t<Fill name={ name }>\n\t\t\t{ ( { onClick: fpOnClick } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Component\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tonClick || fpOnClick\n\t\t\t\t\t\t\t\t? ( ...args ) => {\n\t\t\t\t\t\t\t\t\t\t( onClick || noop )( ...args );\n\t\t\t\t\t\t\t\t\t\t( fpOnClick || noop )( ...args );\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Fill>\n\t);\n}\n\nActionItem.Slot = ActionItemSlot;\n\nexport default ActionItem;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
|
16
14
|
var _components = require("@wordpress/components");
|
|
@@ -46,22 +44,21 @@ var _store = require("../../store");
|
|
|
46
44
|
/**
|
|
47
45
|
* Internal dependencies
|
|
48
46
|
*/
|
|
49
|
-
function ComplementaryAreaSlot(
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
function ComplementaryAreaSlot({
|
|
48
|
+
scope,
|
|
49
|
+
...props
|
|
50
|
+
}) {
|
|
51
|
+
return (0, _element.createElement)(_components.Slot, {
|
|
52
|
+
name: `ComplementaryArea/${scope}`,
|
|
52
53
|
...props
|
|
53
|
-
}
|
|
54
|
-
return (0, _element.createElement)(_components.Slot, (0, _extends2.default)({
|
|
55
|
-
name: `ComplementaryArea/${scope}`
|
|
56
|
-
}, props));
|
|
54
|
+
});
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
function ComplementaryAreaFill(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = _ref2;
|
|
57
|
+
function ComplementaryAreaFill({
|
|
58
|
+
scope,
|
|
59
|
+
children,
|
|
60
|
+
className
|
|
61
|
+
}) {
|
|
65
62
|
return (0, _element.createElement)(_components.Fill, {
|
|
66
63
|
name: `ComplementaryArea/${scope}`
|
|
67
64
|
}, (0, _element.createElement)("div", {
|
|
@@ -105,25 +102,24 @@ function useAdjustComplementaryListener(scope, identifier, activeArea, isActive,
|
|
|
105
102
|
}, [isActive, isSmall, scope, identifier, activeArea]);
|
|
106
103
|
}
|
|
107
104
|
|
|
108
|
-
function ComplementaryArea(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} = _ref3;
|
|
105
|
+
function ComplementaryArea({
|
|
106
|
+
children,
|
|
107
|
+
className,
|
|
108
|
+
closeLabel = (0, _i18n.__)('Close plugin'),
|
|
109
|
+
identifier,
|
|
110
|
+
header,
|
|
111
|
+
headerClassName,
|
|
112
|
+
icon,
|
|
113
|
+
isPinnable = true,
|
|
114
|
+
panelClassName,
|
|
115
|
+
scope,
|
|
116
|
+
name,
|
|
117
|
+
smallScreenTitle,
|
|
118
|
+
title,
|
|
119
|
+
toggleShortcut,
|
|
120
|
+
isActiveByDefault,
|
|
121
|
+
showIconLabels = false
|
|
122
|
+
}) {
|
|
127
123
|
const {
|
|
128
124
|
isLoading,
|
|
129
125
|
isActive,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area/index.js"],"names":["ComplementaryAreaSlot","scope","props","ComplementaryAreaFill","children","className","useAdjustComplementaryListener","identifier","activeArea","isActive","isSmall","previousIsSmall","shouldOpenWhenNotSmall","enableComplementaryArea","disableComplementaryArea","interfaceStore","current","ComplementaryArea","closeLabel","header","headerClassName","icon","isPinnable","panelClassName","name","smallScreenTitle","title","toggleShortcut","isActiveByDefault","showIconLabels","isLoading","isPinned","isLarge","select","getActiveComplementaryArea","isComplementaryAreaLoading","isItemPinned","_activeArea","viewportStore","isViewportMatch","pinItem","unpinItem","undefined","check","label","shortcut","starFilled","starEmpty","ComplementaryAreaWrapped","Slot"],"mappings":";;;;;;;;;AAYA;;;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAQA,SAASA,qBAAT,OAAsD;AAAA,MAAtB;AAAEC,IAAAA,KAAF;AAAS,OAAGC;AAAZ,GAAsB;AACrD,SAAO,4BAAC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AAkFA;;AAED,MAAM4C,wBAAwB,GAC7B,uCAA8B/B,iBAA9B,CADD;AAGA+B,wBAAwB,CAACC,IAAzB,GAAgCjD,qBAAhC;eAEegD,wB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Panel, Slot, Fill } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { check, starEmpty, starFilled } from '@wordpress/icons';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as viewportStore } from '@wordpress/viewport';\n\n/**\n * Internal dependencies\n */\nimport ComplementaryAreaHeader from '../complementary-area-header';\nimport ComplementaryAreaMoreMenuItem from '../complementary-area-more-menu-item';\nimport ComplementaryAreaToggle from '../complementary-area-toggle';\nimport withComplementaryAreaContext from '../complementary-area-context';\nimport PinnedItems from '../pinned-items';\nimport { store as interfaceStore } from '../../store';\n\nfunction ComplementaryAreaSlot( { scope, ...props } ) {\n\treturn <Slot name={ `ComplementaryArea/${ scope }` } { ...props } />;\n}\n\nfunction ComplementaryAreaFill( { scope, children, className } ) {\n\treturn (\n\t\t<Fill name={ `ComplementaryArea/${ scope }` }>\n\t\t\t<div className={ className }>{ children }</div>\n\t\t</Fill>\n\t);\n}\n\nfunction useAdjustComplementaryListener(\n\tscope,\n\tidentifier,\n\tactiveArea,\n\tisActive,\n\tisSmall\n) {\n\tconst previousIsSmall = useRef( false );\n\tconst shouldOpenWhenNotSmall = useRef( false );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tuseEffect( () => {\n\t\t// If the complementary area is active and the editor is switching from\n\t\t// a big to a small window size.\n\t\tif ( isActive && isSmall && ! previousIsSmall.current ) {\n\t\t\tdisableComplementaryArea( scope );\n\t\t\t// Flag the complementary area to be reopened when the window size\n\t\t\t// goes from small to big.\n\t\t\tshouldOpenWhenNotSmall.current = true;\n\t\t} else if (\n\t\t\t// If there is a flag indicating the complementary area should be\n\t\t\t// enabled when we go from small to big window size and we are going\n\t\t\t// from a small to big window size.\n\t\t\tshouldOpenWhenNotSmall.current &&\n\t\t\t! isSmall &&\n\t\t\tpreviousIsSmall.current\n\t\t) {\n\t\t\t// Remove the flag indicating the complementary area should be\n\t\t\t// enabled.\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t\tenableComplementaryArea( scope, identifier );\n\t\t} else if (\n\t\t\t// If the flag is indicating the current complementary should be\n\t\t\t// reopened but another complementary area becomes active, remove\n\t\t\t// the flag.\n\t\t\tshouldOpenWhenNotSmall.current &&\n\t\t\tactiveArea &&\n\t\t\tactiveArea !== identifier\n\t\t) {\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t}\n\t\tif ( isSmall !== previousIsSmall.current ) {\n\t\t\tpreviousIsSmall.current = isSmall;\n\t\t}\n\t}, [ isActive, isSmall, scope, identifier, activeArea ] );\n}\n\nfunction ComplementaryArea( {\n\tchildren,\n\tclassName,\n\tcloseLabel = __( 'Close plugin' ),\n\tidentifier,\n\theader,\n\theaderClassName,\n\ticon,\n\tisPinnable = true,\n\tpanelClassName,\n\tscope,\n\tname,\n\tsmallScreenTitle,\n\ttitle,\n\ttoggleShortcut,\n\tisActiveByDefault,\n\tshowIconLabels = false,\n} ) {\n\tconst { isLoading, isActive, isPinned, activeArea, isSmall, isLarge } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetActiveComplementaryArea,\n\t\t\t\t\tisComplementaryAreaLoading,\n\t\t\t\t\tisItemPinned,\n\t\t\t\t} = select( interfaceStore );\n\n\t\t\t\tconst _activeArea = getActiveComplementaryArea( scope );\n\n\t\t\t\treturn {\n\t\t\t\t\tisLoading: isComplementaryAreaLoading( scope ),\n\t\t\t\t\tisActive: _activeArea === identifier,\n\t\t\t\t\tisPinned: isItemPinned( scope, identifier ),\n\t\t\t\t\tactiveArea: _activeArea,\n\t\t\t\t\tisSmall:\n\t\t\t\t\t\tselect( viewportStore ).isViewportMatch( '< medium' ),\n\t\t\t\t\tisLarge: select( viewportStore ).isViewportMatch( 'large' ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ identifier, scope ]\n\t\t);\n\tuseAdjustComplementaryListener(\n\t\tscope,\n\t\tidentifier,\n\t\tactiveArea,\n\t\tisActive,\n\t\tisSmall\n\t);\n\tconst {\n\t\tenableComplementaryArea,\n\t\tdisableComplementaryArea,\n\t\tpinItem,\n\t\tunpinItem,\n\t} = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Set initial visibility: For large screens, enable if it's active by\n\t\t// default. For small screens, always initially disable.\n\t\tif ( isActiveByDefault && activeArea === undefined && ! isSmall ) {\n\t\t\tenableComplementaryArea( scope, identifier );\n\t\t} else if ( activeArea === undefined && isSmall ) {\n\t\t\tdisableComplementaryArea( scope, identifier );\n\t\t}\n\t}, [ activeArea, isActiveByDefault, scope, identifier, isSmall ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ isPinnable && (\n\t\t\t\t<PinnedItems scope={ scope }>\n\t\t\t\t\t{ isPinned && (\n\t\t\t\t\t\t<ComplementaryAreaToggle\n\t\t\t\t\t\t\tscope={ scope }\n\t\t\t\t\t\t\tidentifier={ identifier }\n\t\t\t\t\t\t\tisPressed={\n\t\t\t\t\t\t\t\tisActive && ( ! showIconLabels || isLarge )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-expanded={ isActive }\n\t\t\t\t\t\t\taria-disabled={ isLoading }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\ticon={ showIconLabels ? check : icon }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PinnedItems>\n\t\t\t) }\n\t\t\t{ name && isPinnable && (\n\t\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\t\ttarget={ name }\n\t\t\t\t\tscope={ scope }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t\t) }\n\t\t\t{ isActive && (\n\t\t\t\t<ComplementaryAreaFill\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'interface-complementary-area',\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tscope={ scope }\n\t\t\t\t>\n\t\t\t\t\t<ComplementaryAreaHeader\n\t\t\t\t\t\tclassName={ headerClassName }\n\t\t\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\t\t\tonClose={ () => disableComplementaryArea( scope ) }\n\t\t\t\t\t\tsmallScreenTitle={ smallScreenTitle }\n\t\t\t\t\t\ttoggleButtonProps={ {\n\t\t\t\t\t\t\tlabel: closeLabel,\n\t\t\t\t\t\t\tshortcut: toggleShortcut,\n\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\tidentifier,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header || (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<strong>{ title }</strong>\n\t\t\t\t\t\t\t\t{ isPinnable && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tclassName=\"interface-complementary-area__pin-unpin-item\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisPinned ? starFilled : starEmpty\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\tisPinned\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Unpin from toolbar' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Pin to toolbar' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t( isPinned ? unpinItem : pinItem )(\n\t\t\t\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisPressed={ isPinned }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ isPinned }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ComplementaryAreaHeader>\n\t\t\t\t\t<Panel className={ panelClassName }>{ children }</Panel>\n\t\t\t\t</ComplementaryAreaFill>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nconst ComplementaryAreaWrapped =\n\twithComplementaryAreaContext( ComplementaryArea );\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area/index.js"],"names":["ComplementaryAreaSlot","scope","props","ComplementaryAreaFill","children","className","useAdjustComplementaryListener","identifier","activeArea","isActive","isSmall","previousIsSmall","shouldOpenWhenNotSmall","enableComplementaryArea","disableComplementaryArea","interfaceStore","current","ComplementaryArea","closeLabel","header","headerClassName","icon","isPinnable","panelClassName","name","smallScreenTitle","title","toggleShortcut","isActiveByDefault","showIconLabels","isLoading","isPinned","isLarge","select","getActiveComplementaryArea","isComplementaryAreaLoading","isItemPinned","_activeArea","viewportStore","isViewportMatch","pinItem","unpinItem","undefined","check","label","shortcut","starFilled","starEmpty","ComplementaryAreaWrapped","Slot"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAQA,SAASA,qBAAT,CAAgC;AAAEC,EAAAA,KAAF;AAAS,KAAGC;A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nB,QAAtC,CA9CD,CA9BF,CADD;AAkFA;;AAED,MAAM4C,wBAAwB,GAC7B,uCAA8B/B,iBAA9B,CADD;AAGA+B,wBAAwB,CAACC,IAAzB,GAAgCjD,qBAAhC;eAEegD,wB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Panel, Slot, Fill } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { check, starEmpty, starFilled } from '@wordpress/icons';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as viewportStore } from '@wordpress/viewport';\n\n/**\n * Internal dependencies\n */\nimport ComplementaryAreaHeader from '../complementary-area-header';\nimport ComplementaryAreaMoreMenuItem from '../complementary-area-more-menu-item';\nimport ComplementaryAreaToggle from '../complementary-area-toggle';\nimport withComplementaryAreaContext from '../complementary-area-context';\nimport PinnedItems from '../pinned-items';\nimport { store as interfaceStore } from '../../store';\n\nfunction ComplementaryAreaSlot( { scope, ...props } ) {\n\treturn <Slot name={ `ComplementaryArea/${ scope }` } { ...props } />;\n}\n\nfunction ComplementaryAreaFill( { scope, children, className } ) {\n\treturn (\n\t\t<Fill name={ `ComplementaryArea/${ scope }` }>\n\t\t\t<div className={ className }>{ children }</div>\n\t\t</Fill>\n\t);\n}\n\nfunction useAdjustComplementaryListener(\n\tscope,\n\tidentifier,\n\tactiveArea,\n\tisActive,\n\tisSmall\n) {\n\tconst previousIsSmall = useRef( false );\n\tconst shouldOpenWhenNotSmall = useRef( false );\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tuseEffect( () => {\n\t\t// If the complementary area is active and the editor is switching from\n\t\t// a big to a small window size.\n\t\tif ( isActive && isSmall && ! previousIsSmall.current ) {\n\t\t\tdisableComplementaryArea( scope );\n\t\t\t// Flag the complementary area to be reopened when the window size\n\t\t\t// goes from small to big.\n\t\t\tshouldOpenWhenNotSmall.current = true;\n\t\t} else if (\n\t\t\t// If there is a flag indicating the complementary area should be\n\t\t\t// enabled when we go from small to big window size and we are going\n\t\t\t// from a small to big window size.\n\t\t\tshouldOpenWhenNotSmall.current &&\n\t\t\t! isSmall &&\n\t\t\tpreviousIsSmall.current\n\t\t) {\n\t\t\t// Remove the flag indicating the complementary area should be\n\t\t\t// enabled.\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t\tenableComplementaryArea( scope, identifier );\n\t\t} else if (\n\t\t\t// If the flag is indicating the current complementary should be\n\t\t\t// reopened but another complementary area becomes active, remove\n\t\t\t// the flag.\n\t\t\tshouldOpenWhenNotSmall.current &&\n\t\t\tactiveArea &&\n\t\t\tactiveArea !== identifier\n\t\t) {\n\t\t\tshouldOpenWhenNotSmall.current = false;\n\t\t}\n\t\tif ( isSmall !== previousIsSmall.current ) {\n\t\t\tpreviousIsSmall.current = isSmall;\n\t\t}\n\t}, [ isActive, isSmall, scope, identifier, activeArea ] );\n}\n\nfunction ComplementaryArea( {\n\tchildren,\n\tclassName,\n\tcloseLabel = __( 'Close plugin' ),\n\tidentifier,\n\theader,\n\theaderClassName,\n\ticon,\n\tisPinnable = true,\n\tpanelClassName,\n\tscope,\n\tname,\n\tsmallScreenTitle,\n\ttitle,\n\ttoggleShortcut,\n\tisActiveByDefault,\n\tshowIconLabels = false,\n} ) {\n\tconst { isLoading, isActive, isPinned, activeArea, isSmall, isLarge } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetActiveComplementaryArea,\n\t\t\t\t\tisComplementaryAreaLoading,\n\t\t\t\t\tisItemPinned,\n\t\t\t\t} = select( interfaceStore );\n\n\t\t\t\tconst _activeArea = getActiveComplementaryArea( scope );\n\n\t\t\t\treturn {\n\t\t\t\t\tisLoading: isComplementaryAreaLoading( scope ),\n\t\t\t\t\tisActive: _activeArea === identifier,\n\t\t\t\t\tisPinned: isItemPinned( scope, identifier ),\n\t\t\t\t\tactiveArea: _activeArea,\n\t\t\t\t\tisSmall:\n\t\t\t\t\t\tselect( viewportStore ).isViewportMatch( '< medium' ),\n\t\t\t\t\tisLarge: select( viewportStore ).isViewportMatch( 'large' ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ identifier, scope ]\n\t\t);\n\tuseAdjustComplementaryListener(\n\t\tscope,\n\t\tidentifier,\n\t\tactiveArea,\n\t\tisActive,\n\t\tisSmall\n\t);\n\tconst {\n\t\tenableComplementaryArea,\n\t\tdisableComplementaryArea,\n\t\tpinItem,\n\t\tunpinItem,\n\t} = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Set initial visibility: For large screens, enable if it's active by\n\t\t// default. For small screens, always initially disable.\n\t\tif ( isActiveByDefault && activeArea === undefined && ! isSmall ) {\n\t\t\tenableComplementaryArea( scope, identifier );\n\t\t} else if ( activeArea === undefined && isSmall ) {\n\t\t\tdisableComplementaryArea( scope, identifier );\n\t\t}\n\t}, [ activeArea, isActiveByDefault, scope, identifier, isSmall ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ isPinnable && (\n\t\t\t\t<PinnedItems scope={ scope }>\n\t\t\t\t\t{ isPinned && (\n\t\t\t\t\t\t<ComplementaryAreaToggle\n\t\t\t\t\t\t\tscope={ scope }\n\t\t\t\t\t\t\tidentifier={ identifier }\n\t\t\t\t\t\t\tisPressed={\n\t\t\t\t\t\t\t\tisActive && ( ! showIconLabels || isLarge )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-expanded={ isActive }\n\t\t\t\t\t\t\taria-disabled={ isLoading }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\ticon={ showIconLabels ? check : icon }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PinnedItems>\n\t\t\t) }\n\t\t\t{ name && isPinnable && (\n\t\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\t\ttarget={ name }\n\t\t\t\t\tscope={ scope }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t\t) }\n\t\t\t{ isActive && (\n\t\t\t\t<ComplementaryAreaFill\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'interface-complementary-area',\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tscope={ scope }\n\t\t\t\t>\n\t\t\t\t\t<ComplementaryAreaHeader\n\t\t\t\t\t\tclassName={ headerClassName }\n\t\t\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\t\t\tonClose={ () => disableComplementaryArea( scope ) }\n\t\t\t\t\t\tsmallScreenTitle={ smallScreenTitle }\n\t\t\t\t\t\ttoggleButtonProps={ {\n\t\t\t\t\t\t\tlabel: closeLabel,\n\t\t\t\t\t\t\tshortcut: toggleShortcut,\n\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\tidentifier,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header || (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<strong>{ title }</strong>\n\t\t\t\t\t\t\t\t{ isPinnable && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tclassName=\"interface-complementary-area__pin-unpin-item\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisPinned ? starFilled : starEmpty\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\tisPinned\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Unpin from toolbar' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Pin to toolbar' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t( isPinned ? unpinItem : pinItem )(\n\t\t\t\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisPressed={ isPinned }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ isPinned }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ComplementaryAreaHeader>\n\t\t\t\t\t<Panel className={ panelClassName }>{ children }</Panel>\n\t\t\t\t</ComplementaryAreaFill>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nconst ComplementaryAreaWrapped =\n\twithComplementaryAreaContext( ComplementaryArea );\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
|
16
14
|
var _icons = require("@wordpress/icons");
|
|
@@ -28,16 +26,16 @@ var _complementaryAreaToggle = _interopRequireDefault(require("../complementary-
|
|
|
28
26
|
/**
|
|
29
27
|
* Internal dependencies
|
|
30
28
|
*/
|
|
31
|
-
const ComplementaryAreaHeader =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
29
|
+
const ComplementaryAreaHeader = ({
|
|
30
|
+
smallScreenTitle,
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
toggleButtonProps
|
|
34
|
+
}) => {
|
|
35
|
+
const toggleButton = (0, _element.createElement)(_complementaryAreaToggle.default, {
|
|
36
|
+
icon: _icons.closeSmall,
|
|
37
|
+
...toggleButtonProps
|
|
38
|
+
});
|
|
41
39
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
42
40
|
className: "components-panel__header interface-complementary-area-header__small"
|
|
43
41
|
}, smallScreenTitle && (0, _element.createElement)("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-header/index.js"],"names":["ComplementaryAreaHeader","smallScreenTitle","children","className","toggleButtonProps","toggleButton","closeSmall"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-header/index.js"],"names":["ComplementaryAreaHeader","smallScreenTitle","children","className","toggleButtonProps","toggleButton","closeSmall"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,uBAAuB,GAAG,CAAE;AACjCC,EAAAA,gBADiC;AAEjCC,EAAAA,QAFiC;AAGjCC,EAAAA,SAHiC;AAIjCC,EAAAA;AAJiC,CAAF,KAKzB;AACN,QAAMC,YAAY,GACjB,4BAAC,gCAAD;AAAyB,IAAA,IAAI,EAAGC,iBAAhC;AAAA,OAAkDF;AAAlD,IADD;AAGA,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGH,gBAAgB,IACjB;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGA,gBADH,CAFF,EAMGI,YANH,CADD,EASC;AACC,IAAA,SAAS,EAAG,yBACX,0BADW,EAEX,qCAFW,EAGXF,SAHW,CADb;AAMC,IAAA,QAAQ,EAAG,CAAC;AANb,KAQGD,QARH,EASGG,YATH,CATD,CADD;AAuBA,CAhCD;;eAkCeL,uB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ComplementaryAreaToggle from '../complementary-area-toggle';\n\nconst ComplementaryAreaHeader = ( {\n\tsmallScreenTitle,\n\tchildren,\n\tclassName,\n\ttoggleButtonProps,\n} ) => {\n\tconst toggleButton = (\n\t\t<ComplementaryAreaToggle icon={ closeSmall } { ...toggleButtonProps } />\n\t);\n\treturn (\n\t\t<>\n\t\t\t<div className=\"components-panel__header interface-complementary-area-header__small\">\n\t\t\t\t{ smallScreenTitle && (\n\t\t\t\t\t<span className=\"interface-complementary-area-header__small-title\">\n\t\t\t\t\t\t{ smallScreenTitle }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ toggleButton }\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'components-panel__header',\n\t\t\t\t\t'interface-complementary-area-header',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t\t{ toggleButton }\n\t\t\t</div>\n\t\t</>\n\t);\n};\n\nexport default ComplementaryAreaHeader;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = ComplementaryAreaMoreMenuItem;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _icons = require("@wordpress/icons");
|
|
15
13
|
|
|
16
14
|
var _components = require("@wordpress/components");
|
|
@@ -26,38 +24,37 @@ var _actionItem = _interopRequireDefault(require("../action-item"));
|
|
|
26
24
|
/**
|
|
27
25
|
* Internal dependencies
|
|
28
26
|
*/
|
|
29
|
-
const PluginsMenuItem =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
...props
|
|
47
|
-
} = _ref2;
|
|
48
|
-
return (0, _element.createElement)(_complementaryAreaToggle.default, (0, _extends2.default)({
|
|
27
|
+
const PluginsMenuItem = ({
|
|
28
|
+
// Menu item is marked with unstable prop for backward compatibility.
|
|
29
|
+
// They are removed so they don't leak to DOM elements.
|
|
30
|
+
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
31
|
+
__unstableExplicitMenuItem,
|
|
32
|
+
__unstableTarget,
|
|
33
|
+
...restProps
|
|
34
|
+
}) => (0, _element.createElement)(_components.MenuItem, { ...restProps
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
function ComplementaryAreaMoreMenuItem({
|
|
38
|
+
scope,
|
|
39
|
+
target,
|
|
40
|
+
__unstableExplicitMenuItem,
|
|
41
|
+
...props
|
|
42
|
+
}) {
|
|
43
|
+
return (0, _element.createElement)(_complementaryAreaToggle.default, {
|
|
49
44
|
as: toggleProps => {
|
|
50
|
-
return (0, _element.createElement)(_actionItem.default,
|
|
45
|
+
return (0, _element.createElement)(_actionItem.default, {
|
|
51
46
|
__unstableExplicitMenuItem: __unstableExplicitMenuItem,
|
|
52
47
|
__unstableTarget: `${scope}/${target}`,
|
|
53
48
|
as: PluginsMenuItem,
|
|
54
|
-
name: `${scope}/plugin-more-menu
|
|
55
|
-
|
|
49
|
+
name: `${scope}/plugin-more-menu`,
|
|
50
|
+
...toggleProps
|
|
51
|
+
});
|
|
56
52
|
},
|
|
57
53
|
role: "menuitemcheckbox",
|
|
58
54
|
selectedIcon: _icons.check,
|
|
59
55
|
name: target,
|
|
60
|
-
scope: scope
|
|
61
|
-
|
|
56
|
+
scope: scope,
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
62
59
|
}
|
|
63
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-more-menu-item/index.js"],"names":["PluginsMenuItem","__unstableExplicitMenuItem","__unstableTarget","restProps","ComplementaryAreaMoreMenuItem","scope","target","props","toggleProps","check"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-more-menu-item/index.js"],"names":["PluginsMenuItem","__unstableExplicitMenuItem","__unstableTarget","restProps","ComplementaryAreaMoreMenuItem","scope","target","props","toggleProps","check"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,eAAe,GAAG,CAAE;AACzB;AACA;AACA;AACAC,EAAAA,0BAJyB;AAKzBC,EAAAA,gBALyB;AAMzB,KAAGC;AANsB,CAAF,KAOjB,4BAAC,oBAAD,OAAeA;AAAf,EAPP;;AASe,SAASC,6BAAT,CAAwC;AACtDC,EAAAA,KADsD;AAEtDC,EAAAA,MAFsD;AAGtDL,EAAAA,0BAHsD;AAItD,KAAGM;AAJmD,CAAxC,EAKX;AACH,SACC,4BAAC,gCAAD;AACC,IAAA,EAAE,EAAKC,WAAF,IAAmB;AACvB,aACC,4BAAC,mBAAD;AACC,QAAA,0BAA0B,EACzBP,0BAFF;AAIC,QAAA,gBAAgB,EAAI,GAAGI,KAAO,IAAIC,MAAQ,EAJ3C;AAKC,QAAA,EAAE,EAAGN,eALN;AAMC,QAAA,IAAI,EAAI,GAAGK,KAAO,mBANnB;AAAA,WAOMG;AAPN,QADD;AAWA,KAbF;AAcC,IAAA,IAAI,EAAC,kBAdN;AAeC,IAAA,YAAY,EAAGC,YAfhB;AAgBC,IAAA,IAAI,EAAGH,MAhBR;AAiBC,IAAA,KAAK,EAAGD,KAjBT;AAAA,OAkBME;AAlBN,IADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check } from '@wordpress/icons';\nimport { MenuItem } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ComplementaryAreaToggle from '../complementary-area-toggle';\nimport ActionItem from '../action-item';\n\nconst PluginsMenuItem = ( {\n\t// Menu item is marked with unstable prop for backward compatibility.\n\t// They are removed so they don't leak to DOM elements.\n\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t__unstableExplicitMenuItem,\n\t__unstableTarget,\n\t...restProps\n} ) => <MenuItem { ...restProps } />;\n\nexport default function ComplementaryAreaMoreMenuItem( {\n\tscope,\n\ttarget,\n\t__unstableExplicitMenuItem,\n\t...props\n} ) {\n\treturn (\n\t\t<ComplementaryAreaToggle\n\t\t\tas={ ( toggleProps ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ActionItem\n\t\t\t\t\t\t__unstableExplicitMenuItem={\n\t\t\t\t\t\t\t__unstableExplicitMenuItem\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__unstableTarget={ `${ scope }/${ target }` }\n\t\t\t\t\t\tas={ PluginsMenuItem }\n\t\t\t\t\t\tname={ `${ scope }/plugin-more-menu` }\n\t\t\t\t\t\t{ ...toggleProps }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tselectedIcon={ check }\n\t\t\tname={ target }\n\t\t\tscope={ scope }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _components = require("@wordpress/components");
|
|
15
13
|
|
|
16
14
|
var _data = require("@wordpress/data");
|
|
@@ -26,23 +24,22 @@ var _complementaryAreaContext = _interopRequireDefault(require("../complementary
|
|
|
26
24
|
/**
|
|
27
25
|
* Internal dependencies
|
|
28
26
|
*/
|
|
29
|
-
function ComplementaryAreaToggle(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} = _ref;
|
|
27
|
+
function ComplementaryAreaToggle({
|
|
28
|
+
as = _components.Button,
|
|
29
|
+
scope,
|
|
30
|
+
identifier,
|
|
31
|
+
icon,
|
|
32
|
+
selectedIcon,
|
|
33
|
+
name,
|
|
34
|
+
...props
|
|
35
|
+
}) {
|
|
39
36
|
const ComponentToUse = as;
|
|
40
37
|
const isSelected = (0, _data.useSelect)(select => select(_store.store).getActiveComplementaryArea(scope) === identifier, [identifier]);
|
|
41
38
|
const {
|
|
42
39
|
enableComplementaryArea,
|
|
43
40
|
disableComplementaryArea
|
|
44
41
|
} = (0, _data.useDispatch)(_store.store);
|
|
45
|
-
return (0, _element.createElement)(ComponentToUse,
|
|
42
|
+
return (0, _element.createElement)(ComponentToUse, {
|
|
46
43
|
icon: selectedIcon && isSelected ? selectedIcon : icon,
|
|
47
44
|
onClick: () => {
|
|
48
45
|
if (isSelected) {
|
|
@@ -50,8 +47,9 @@ function ComplementaryAreaToggle(_ref) {
|
|
|
50
47
|
} else {
|
|
51
48
|
enableComplementaryArea(scope, identifier);
|
|
52
49
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
50
|
+
},
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
var _default = (0, _complementaryAreaContext.default)(ComplementaryAreaToggle);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"names":["ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","name","props","ComponentToUse","isSelected","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/complementary-area-toggle/index.js"],"names":["ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","name","props","ComponentToUse","isSelected","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA,SAASA,uBAAT,CAAkC;AACjCC,EAAAA,EAAE,GAAGC,kBAD4B;AAEjCC,EAAAA,KAFiC;AAGjCC,EAAAA,UAHiC;AAIjCC,EAAAA,IAJiC;AAKjCC,EAAAA,YALiC;AAMjCC,EAAAA,IANiC;AAOjC,KAAGC;AAP8B,CAAlC,EAQI;AACH,QAAMC,cAAc,GAAGR,EAAvB;AACA,QAAMS,UAAU,GAAG,qBAChBC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAAyBC,0BAAzB,CAAqDV,KAArD,MACAC,UAHiB,EAIlB,CAAEA,UAAF,CAJkB,CAAnB;AAMA,QAAM;AAAEU,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,MACL,uBAAaH,YAAb,CADD;AAEA,SACC,4BAAC,cAAD;AACC,IAAA,IAAI,EAAGN,YAAY,IAAII,UAAhB,GAA6BJ,YAA7B,GAA4CD,IADpD;AAEC,IAAA,OAAO,EAAG,MAAM;AACf,UAAKK,UAAL,EAAkB;AACjBK,QAAAA,wBAAwB,CAAEZ,KAAF,CAAxB;AACA,OAFD,MAEO;AACNW,QAAAA,uBAAuB,CAAEX,KAAF,EAASC,UAAT,CAAvB;AACA;AACD,KARF;AAAA,OASMI;AATN,IADD;AAaA;;eAEc,uCAA0BR,uBAA1B,C","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\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 ]\n\t);\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\treturn (\n\t\t<ComponentToUse\n\t\t\ticon={ selectedIcon && isSelected ? selectedIcon : icon }\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\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default complementaryAreaContext( ComplementaryAreaToggle );\n"]}
|
|
@@ -10,10 +10,9 @@ var _element = require("@wordpress/element");
|
|
|
10
10
|
/**
|
|
11
11
|
* WordPress dependencies
|
|
12
12
|
*/
|
|
13
|
-
const FullscreenMode =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
13
|
+
const FullscreenMode = ({
|
|
14
|
+
isActive
|
|
15
|
+
}) => {
|
|
17
16
|
(0, _element.useEffect)(() => {
|
|
18
17
|
let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
|
|
19
18
|
// `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/interface/src/components/fullscreen-mode/index.js"],"names":["FullscreenMode","isActive","isSticky","document","body","classList","contains","remove","add"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,cAAc,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/interface/src/components/fullscreen-mode/index.js"],"names":["FullscreenMode","isActive","isSticky","document","body","classList","contains","remove","add"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,cAAc,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAAoB;AAC1C,0BAAW,MAAM;AAChB,QAAIC,QAAQ,GAAG,KAAf,CADgB,CAEhB;AACA;AACA;AACA;;AACA,QAAKC,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBC,QAAxB,CAAkC,aAAlC,CAAL,EAAyD;AACxDJ,MAAAA,QAAQ,GAAG,IAAX;AACAC,MAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBE,MAAxB,CAAgC,aAAhC;AACA;;AAED,WAAO,MAAM;AACZ,UAAKL,QAAL,EAAgB;AACfC,QAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBG,GAAxB,CAA6B,aAA7B;AACA;AACD,KAJD;AAKA,GAhBD,EAgBG,EAhBH;AAkBA,0BAAW,MAAM;AAChB,QAAKP,QAAL,EAAgB;AACfE,MAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBG,GAAxB,CAA6B,oBAA7B;AACA,KAFD,MAEO;AACNL,MAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBE,MAAxB,CAAgC,oBAAhC;AACA;;AAED,WAAO,MAAM;AACZ,UAAKN,QAAL,EAAgB;AACfE,QAAAA,QAAQ,CAACC,IAAT,CAAcC,SAAd,CAAwBE,MAAxB,CAAgC,oBAAhC;AACA;AACD,KAJD;AAKA,GAZD,EAYG,CAAEN,QAAF,CAZH;AAcA,SAAO,IAAP;AACA,CAlCD;;eAmCeD,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\n\nconst FullscreenMode = ( { isActive } ) => {\n\tuseEffect( () => {\n\t\tlet isSticky = false;\n\t\t// `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes\n\t\t// `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled\n\t\t// even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as\n\t\t// a consequence of the FullscreenMode setup.\n\t\tif ( document.body.classList.contains( 'sticky-menu' ) ) {\n\t\t\tisSticky = true;\n\t\t\tdocument.body.classList.remove( 'sticky-menu' );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( isSticky ) {\n\t\t\t\tdocument.body.classList.add( 'sticky-menu' );\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isActive ) {\n\t\t\tdocument.body.classList.add( 'is-fullscreen-mode' );\n\t\t} else {\n\t\t\tdocument.body.classList.remove( 'is-fullscreen-mode' );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( isActive ) {\n\t\t\t\tdocument.body.classList.remove( 'is-fullscreen-mode' );\n\t\t\t}\n\t\t};\n\t}, [ isActive ] );\n\n\treturn null;\n};\nexport default FullscreenMode;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
|
16
14
|
var _components = require("@wordpress/components");
|
|
@@ -47,24 +45,23 @@ function useHTMLClass(className) {
|
|
|
47
45
|
}, [className]);
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
function InterfaceSkeleton(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} = _ref;
|
|
48
|
+
function InterfaceSkeleton({
|
|
49
|
+
isDistractionFree,
|
|
50
|
+
footer,
|
|
51
|
+
header,
|
|
52
|
+
editorNotices,
|
|
53
|
+
sidebar,
|
|
54
|
+
secondarySidebar,
|
|
55
|
+
notices,
|
|
56
|
+
content,
|
|
57
|
+
actions,
|
|
58
|
+
labels,
|
|
59
|
+
className,
|
|
60
|
+
enableRegionNavigation = true,
|
|
61
|
+
// Todo: does this need to be a prop.
|
|
62
|
+
// Can we use a dependency to keyboard-shortcuts directly?
|
|
63
|
+
shortcuts
|
|
64
|
+
}, ref) {
|
|
68
65
|
const navigateRegionsProps = (0, _components.__unstableUseNavigateRegions)(shortcuts);
|
|
69
66
|
useHTMLClass('interface-interface-skeleton__html-container');
|
|
70
67
|
const defaultLabels = {
|
|
@@ -90,10 +87,8 @@ function InterfaceSkeleton(_ref, ref) {
|
|
|
90
87
|
...labels
|
|
91
88
|
};
|
|
92
89
|
const headerVariants = {
|
|
93
|
-
hidden:
|
|
90
|
+
hidden: {
|
|
94
91
|
opacity: 0
|
|
95
|
-
} : {
|
|
96
|
-
opacity: 1
|
|
97
92
|
},
|
|
98
93
|
hover: {
|
|
99
94
|
opacity: 1,
|
|
@@ -102,27 +97,31 @@ function InterfaceSkeleton(_ref, ref) {
|
|
|
102
97
|
delay: 0.2,
|
|
103
98
|
delayChildren: 0.2
|
|
104
99
|
}
|
|
100
|
+
},
|
|
101
|
+
distractionFreeInactive: {
|
|
102
|
+
opacity: 1,
|
|
103
|
+
transition: {
|
|
104
|
+
delay: 0
|
|
105
|
+
}
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
|
-
return (0, _element.createElement)("div",
|
|
108
|
+
return (0, _element.createElement)("div", { ...(enableRegionNavigation ? navigateRegionsProps : {}),
|
|
108
109
|
ref: (0, _compose.useMergeRefs)([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]),
|
|
109
110
|
className: (0, _classnames.default)(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
|
|
110
|
-
}
|
|
111
|
+
}, (0, _element.createElement)("div", {
|
|
111
112
|
className: "interface-interface-skeleton__editor"
|
|
112
|
-
}, !!header &&
|
|
113
|
+
}, !!header && (0, _element.createElement)(_navigableRegion.default, {
|
|
113
114
|
as: _components.__unstableMotion.div,
|
|
114
115
|
className: "interface-interface-skeleton__header",
|
|
115
116
|
"aria-label": mergedLabels.header,
|
|
116
|
-
initial: isDistractionFree ? 'hidden' : '
|
|
117
|
-
whileHover:
|
|
117
|
+
initial: isDistractionFree ? 'hidden' : 'distractionFreeInactive',
|
|
118
|
+
whileHover: isDistractionFree ? 'hover' : 'distractionFreeInactive',
|
|
119
|
+
animate: isDistractionFree ? 'hidden' : 'distractionFreeInactive',
|
|
118
120
|
variants: headerVariants,
|
|
119
|
-
transition: {
|
|
121
|
+
transition: isDistractionFree ? {
|
|
120
122
|
type: 'tween',
|
|
121
123
|
delay: 0.8
|
|
122
|
-
}
|
|
123
|
-
}, header), !!header && !isDistractionFree && (0, _element.createElement)(_navigableRegion.default, {
|
|
124
|
-
className: "interface-interface-skeleton__header",
|
|
125
|
-
ariaLabel: mergedLabels.header
|
|
124
|
+
} : undefined
|
|
126
125
|
}, header), isDistractionFree && (0, _element.createElement)("div", {
|
|
127
126
|
className: "interface-interface-skeleton__header"
|
|
128
127
|
}, editorNotices), (0, _element.createElement)("div", {
|