@wordpress/interface 5.35.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/components/action-item/index.js +46 -43
- package/build/components/action-item/index.js.map +1 -1
- package/build/components/complementary-area/index.js +82 -68
- package/build/components/complementary-area/index.js.map +1 -1
- package/build/components/complementary-area-header/index.js +15 -10
- package/build/components/complementary-area-header/index.js.map +1 -1
- package/build/components/complementary-area-more-menu-item/index.js +4 -4
- package/build/components/complementary-area-more-menu-item/index.js.map +1 -1
- package/build/components/complementary-area-toggle/index.js +2 -2
- package/build/components/complementary-area-toggle/index.js.map +1 -1
- package/build/components/interface-skeleton/index.js +99 -71
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build/components/navigable-region/index.js +5 -4
- package/build/components/navigable-region/index.js.map +1 -1
- package/build/components/pinned-items/index.js +9 -7
- package/build/components/pinned-items/index.js.map +1 -1
- package/build-module/components/action-item/index.js +46 -43
- package/build-module/components/action-item/index.js.map +1 -1
- package/build-module/components/complementary-area/index.js +84 -68
- package/build-module/components/complementary-area/index.js.map +1 -1
- package/build-module/components/complementary-area-header/index.js +17 -10
- package/build-module/components/complementary-area-header/index.js.map +1 -1
- package/build-module/components/complementary-area-more-menu-item/index.js +4 -4
- package/build-module/components/complementary-area-more-menu-item/index.js.map +1 -1
- package/build-module/components/complementary-area-toggle/index.js +2 -2
- package/build-module/components/complementary-area-toggle/index.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +100 -71
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-module/components/navigable-region/index.js +5 -4
- package/build-module/components/navigable-region/index.js.map +1 -1
- package/build-module/components/pinned-items/index.js +9 -7
- package/build-module/components/pinned-items/index.js.map +1 -1
- package/build-style/style-rtl.css +8 -3
- package/build-style/style.css +8 -3
- package/package.json +16 -15
- package/src/components/interface-skeleton/index.js +60 -40
- package/src/components/interface-skeleton/style.scss +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 6.0.0 (2024-05-31)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- Increase the minimum required Node.js version to v18.12.0 matching long-term support releases ([#31270](https://github.com/WordPress/gutenberg/pull/61930)). Learn more about [Node.js releases](https://nodejs.org/en/about/previous-releases).
|
|
10
|
+
|
|
5
11
|
## 5.35.0 (2024-05-16)
|
|
6
12
|
|
|
7
13
|
### Internal
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _components = require("@wordpress/components");
|
|
9
8
|
var _element = require("@wordpress/element");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
/**
|
|
11
11
|
* WordPress dependencies
|
|
12
12
|
*/
|
|
@@ -19,40 +19,42 @@ function ActionItemSlot({
|
|
|
19
19
|
bubblesVirtually,
|
|
20
20
|
...props
|
|
21
21
|
}) {
|
|
22
|
-
return (0,
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Slot, {
|
|
23
23
|
name: name,
|
|
24
24
|
bubblesVirtually: bubblesVirtually,
|
|
25
|
-
fillProps: fillProps
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Special handling exists for backward compatibility.
|
|
32
|
-
// It ensures that menu items created by plugin authors aren't
|
|
33
|
-
// duplicated with automatically injected menu items coming
|
|
34
|
-
// from pinnable plugin sidebars.
|
|
35
|
-
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
36
|
-
const initializedByPlugins = [];
|
|
37
|
-
_element.Children.forEach(fills, ({
|
|
38
|
-
props: {
|
|
39
|
-
__unstableExplicitMenuItem,
|
|
40
|
-
__unstableTarget
|
|
41
|
-
}
|
|
42
|
-
}) => {
|
|
43
|
-
if (__unstableTarget && __unstableExplicitMenuItem) {
|
|
44
|
-
initializedByPlugins.push(__unstableTarget);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
const children = _element.Children.map(fills, child => {
|
|
48
|
-
if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
|
|
25
|
+
fillProps: fillProps,
|
|
26
|
+
children: fills => {
|
|
27
|
+
if (!_element.Children.toArray(fills).length) {
|
|
49
28
|
return null;
|
|
50
29
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
30
|
+
|
|
31
|
+
// Special handling exists for backward compatibility.
|
|
32
|
+
// It ensures that menu items created by plugin authors aren't
|
|
33
|
+
// duplicated with automatically injected menu items coming
|
|
34
|
+
// from pinnable plugin sidebars.
|
|
35
|
+
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
36
|
+
const initializedByPlugins = [];
|
|
37
|
+
_element.Children.forEach(fills, ({
|
|
38
|
+
props: {
|
|
39
|
+
__unstableExplicitMenuItem,
|
|
40
|
+
__unstableTarget
|
|
41
|
+
}
|
|
42
|
+
}) => {
|
|
43
|
+
if (__unstableTarget && __unstableExplicitMenuItem) {
|
|
44
|
+
initializedByPlugins.push(__unstableTarget);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const children = _element.Children.map(fills, child => {
|
|
48
|
+
if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return child;
|
|
52
|
+
});
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
54
|
+
...props,
|
|
55
|
+
children: children
|
|
56
|
+
});
|
|
57
|
+
}
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
function ActionItem({
|
|
@@ -61,18 +63,19 @@ function ActionItem({
|
|
|
61
63
|
onClick,
|
|
62
64
|
...props
|
|
63
65
|
}) {
|
|
64
|
-
return (0,
|
|
65
|
-
name: name
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Fill, {
|
|
67
|
+
name: name,
|
|
68
|
+
children: ({
|
|
69
|
+
onClick: fpOnClick
|
|
70
|
+
}) => {
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
72
|
+
onClick: onClick || fpOnClick ? (...args) => {
|
|
73
|
+
(onClick || noop)(...args);
|
|
74
|
+
(fpOnClick || noop)(...args);
|
|
75
|
+
} : undefined,
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
}
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
81
|
ActionItem.Slot = ActionItemSlot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","noop","ActionItemSlot","name","as","Component","ButtonGroup","fillProps","bubblesVirtually","props","
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_jsxRuntime","noop","ActionItemSlot","name","as","Component","ButtonGroup","fillProps","bubblesVirtually","props","jsx","Slot","children","fills","Children","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","map","child","includes","ActionItem","Button","onClick","Fill","fpOnClick","args","undefined","_default","exports","default"],"sources":["@wordpress/interface/src/components/action-item/index.js"],"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"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAA8C,IAAAE,WAAA,GAAAF,OAAA;AAJ9C;AACA;AACA;;AAIA,MAAMG,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,cAAcA,CAAE;EACxBC,IAAI;EACJC,EAAE,EAAEC,SAAS,GAAGC,uBAAW;EAC3BC,SAAS,GAAG,CAAC,CAAC;EACdC,gBAAgB;EAChB,GAAGC;AACJ,CAAC,EAAG;EACH,oBACC,IAAAT,WAAA,CAAAU,GAAA,EAACb,WAAA,CAAAc,IAAI;IACJR,IAAI,EAAGA,IAAM;IACbK,gBAAgB,EAAGA,gBAAkB;IACrCD,SAAS,EAAGA,SAAW;IAAAK,QAAA,EAEnBC,KAAK,IAAM;MACd,IAAK,CAAEC,iBAAQ,CAACC,OAAO,CAAEF,KAAM,CAAC,CAACG,MAAM,EAAG;QACzC,OAAO,IAAI;MACZ;;MAEA;MACA;MACA;MACA;MACA;MACA,MAAMC,oBAAoB,GAAG,EAAE;MAC/BH,iBAAQ,CAACI,OAAO,CACfL,KAAK,EACL,CAAE;QACDJ,KAAK,EAAE;UAAEU,0BAA0B;UAAEC;QAAiB;MACvD,CAAC,KAAM;QACN,IAAKA,gBAAgB,IAAID,0BAA0B,EAAG;UACrDF,oBAAoB,CAACI,IAAI,CAAED,gBAAiB,CAAC;QAC9C;MACD,CACD,CAAC;MACD,MAAMR,QAAQ,GAAGE,iBAAQ,CAACQ,GAAG,CAAET,KAAK,EAAIU,KAAK,IAAM;QAClD,IACC,CAAEA,KAAK,CAACd,KAAK,CAACU,0BAA0B,IACxCF,oBAAoB,CAACO,QAAQ,CAC5BD,KAAK,CAACd,KAAK,CAACW,gBACb,CAAC,EACA;UACD,OAAO,IAAI;QACZ;QACA,OAAOG,KAAK;MACb,CAAE,CAAC;MAEH,oBAAO,IAAAvB,WAAA,CAAAU,GAAA,EAACL,SAAS;QAAA,GAAMI,KAAK;QAAAG,QAAA,EAAKA;MAAQ,CAAa,CAAC;IACxD;EAAC,CACI,CAAC;AAET;AAEA,SAASa,UAAUA,CAAE;EAAEtB,IAAI;EAAEC,EAAE,EAAEC,SAAS,GAAGqB,kBAAM;EAAEC,OAAO;EAAE,GAAGlB;AAAM,CAAC,EAAG;EAC1E,oBACC,IAAAT,WAAA,CAAAU,GAAA,EAACb,WAAA,CAAA+B,IAAI;IAACzB,IAAI,EAAGA,IAAM;IAAAS,QAAA,EAChBA,CAAE;MAAEe,OAAO,EAAEE;IAAU,CAAC,KAAM;MAC/B,oBACC,IAAA7B,WAAA,CAAAU,GAAA,EAACL,SAAS;QACTsB,OAAO,EACNA,OAAO,IAAIE,SAAS,GACjB,CAAE,GAAGC,IAAI,KAAM;UACf,CAAEH,OAAO,IAAI1B,IAAI,EAAI,GAAG6B,IAAK,CAAC;UAC9B,CAAED,SAAS,IAAI5B,IAAI,EAAI,GAAG6B,IAAK,CAAC;QAChC,CAAC,GACDC,SACH;QAAA,GACItB;MAAK,CACV,CAAC;IAEJ;EAAC,CACI,CAAC;AAET;AAEAgB,UAAU,CAACd,IAAI,GAAGT,cAAc;AAAC,IAAA8B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAElBT,UAAU","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
9
|
var _components = require("@wordpress/components");
|
|
11
10
|
var _data = require("@wordpress/data");
|
|
@@ -21,6 +20,7 @@ var _complementaryAreaToggle = _interopRequireDefault(require("../complementary-
|
|
|
21
20
|
var _complementaryAreaContext = _interopRequireDefault(require("../complementary-area-context"));
|
|
22
21
|
var _pinnedItems = _interopRequireDefault(require("../pinned-items"));
|
|
23
22
|
var _store = require("../../store");
|
|
23
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
/**
|
|
25
25
|
* External dependencies
|
|
26
26
|
*/
|
|
@@ -38,7 +38,7 @@ function ComplementaryAreaSlot({
|
|
|
38
38
|
scope,
|
|
39
39
|
...props
|
|
40
40
|
}) {
|
|
41
|
-
return (0,
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Slot, {
|
|
42
42
|
name: `ComplementaryArea/${scope}`,
|
|
43
43
|
...props
|
|
44
44
|
});
|
|
@@ -80,24 +80,28 @@ function ComplementaryAreaFill({
|
|
|
80
80
|
duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION,
|
|
81
81
|
ease: [0.6, 0, 0.4, 1]
|
|
82
82
|
};
|
|
83
|
-
return (0,
|
|
84
|
-
name: `ComplementaryArea/${scope}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
83
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Fill, {
|
|
84
|
+
name: `ComplementaryArea/${scope}`,
|
|
85
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableAnimatePresence, {
|
|
86
|
+
initial: false,
|
|
87
|
+
children: (previousIsActive || isActive) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableMotion.div, {
|
|
88
|
+
variants: variants,
|
|
89
|
+
initial: "closed",
|
|
90
|
+
animate: isMobileViewport ? 'mobileOpen' : 'open',
|
|
91
|
+
exit: "closed",
|
|
92
|
+
transition: transition,
|
|
93
|
+
className: "interface-complementary-area__fill",
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
95
|
+
id: id,
|
|
96
|
+
className: className,
|
|
97
|
+
style: {
|
|
98
|
+
width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH
|
|
99
|
+
},
|
|
100
|
+
children: children
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
});
|
|
101
105
|
}
|
|
102
106
|
function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
|
|
103
107
|
const previousIsSmall = (0, _element.useRef)(false);
|
|
@@ -205,54 +209,64 @@ function ComplementaryArea({
|
|
|
205
209
|
if (!isReady) {
|
|
206
210
|
return;
|
|
207
211
|
}
|
|
208
|
-
return (0,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
212
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
213
|
+
children: [isPinnable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_pinnedItems.default, {
|
|
214
|
+
scope: scope,
|
|
215
|
+
children: isPinned && /*#__PURE__*/(0, _jsxRuntime.jsx)(_complementaryAreaToggle.default, {
|
|
216
|
+
scope: scope,
|
|
217
|
+
identifier: identifier,
|
|
218
|
+
isPressed: isActive && (!showIconLabels || isLarge),
|
|
219
|
+
"aria-expanded": isActive,
|
|
220
|
+
"aria-disabled": isLoading,
|
|
221
|
+
label: title,
|
|
222
|
+
icon: showIconLabels ? _icons.check : icon,
|
|
223
|
+
showTooltip: !showIconLabels,
|
|
224
|
+
variant: showIconLabels ? 'tertiary' : undefined,
|
|
225
|
+
size: "compact"
|
|
226
|
+
})
|
|
227
|
+
}), name && isPinnable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_complementaryAreaMoreMenuItem.default, {
|
|
228
|
+
target: name,
|
|
229
|
+
scope: scope,
|
|
230
|
+
icon: icon,
|
|
231
|
+
children: title
|
|
232
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ComplementaryAreaFill, {
|
|
233
|
+
activeArea: activeArea,
|
|
234
|
+
isActive: isActive,
|
|
235
|
+
className: (0, _clsx.default)('interface-complementary-area', className),
|
|
236
|
+
scope: scope,
|
|
237
|
+
id: identifier.replace('/', ':'),
|
|
238
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_complementaryAreaHeader.default, {
|
|
239
|
+
className: headerClassName,
|
|
240
|
+
closeLabel: closeLabel,
|
|
241
|
+
onClose: () => disableComplementaryArea(scope),
|
|
242
|
+
smallScreenTitle: smallScreenTitle,
|
|
243
|
+
toggleButtonProps: {
|
|
244
|
+
label: closeLabel,
|
|
245
|
+
size: 'small',
|
|
246
|
+
shortcut: toggleShortcut,
|
|
247
|
+
scope,
|
|
248
|
+
identifier
|
|
249
|
+
},
|
|
250
|
+
children: header || /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
251
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
252
|
+
className: "interface-complementary-area-header__title",
|
|
253
|
+
children: title
|
|
254
|
+
}), isPinnable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
255
|
+
className: "interface-complementary-area__pin-unpin-item",
|
|
256
|
+
icon: isPinned ? _icons.starFilled : _icons.starEmpty,
|
|
257
|
+
label: isPinned ? (0, _i18n.__)('Unpin from toolbar') : (0, _i18n.__)('Pin to toolbar'),
|
|
258
|
+
onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
|
|
259
|
+
isPressed: isPinned,
|
|
260
|
+
"aria-expanded": isPinned,
|
|
261
|
+
size: "compact"
|
|
262
|
+
})]
|
|
263
|
+
})
|
|
264
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Panel, {
|
|
265
|
+
className: panelClassName,
|
|
266
|
+
children: children
|
|
267
|
+
})]
|
|
268
|
+
})]
|
|
269
|
+
});
|
|
256
270
|
}
|
|
257
271
|
const ComplementaryAreaWrapped = (0, _complementaryAreaContext.default)(ComplementaryArea);
|
|
258
272
|
ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_data","_i18n","_icons","_element","_viewport","_preferences","_compose","_complementaryAreaHeader","_complementaryAreaMoreMenuItem","_complementaryAreaToggle","_complementaryAreaContext","_pinnedItems","_store","ANIMATION_DURATION","ComplementaryAreaSlot","scope","props","_react","createElement","Slot","name","SIDEBAR_WIDTH","variants","open","width","closed","mobileOpen","ComplementaryAreaFill","activeArea","isActive","children","className","id","disableMotion","useReducedMotion","isMobileViewport","useViewportMatch","previousActiveArea","usePrevious","previousIsActive","setState","useState","useEffect","transition","type","duration","ease","Fill","__unstableAnimatePresence","initial","__unstableMotion","div","animate","exit","style","useAdjustComplementaryListener","identifier","isSmall","previousIsSmall","useRef","shouldOpenWhenNotSmall","enableComplementaryArea","disableComplementaryArea","useDispatch","interfaceStore","current","ComplementaryArea","closeLabel","__","header","headerClassName","icon","isPinnable","panelClassName","smallScreenTitle","title","toggleShortcut","isActiveByDefault","isReady","setIsReady","isLoading","isPinned","isLarge","showIconLabels","useSelect","select","getActiveComplementaryArea","isComplementaryAreaLoading","isItemPinned","get","preferencesStore","_activeArea","viewportStore","isViewportMatch","pinItem","unpinItem","undefined","Fragment","default","isPressed","label","check","showTooltip","variant","size","target","clsx","replace","onClose","toggleButtonProps","shortcut","Button","starFilled","starEmpty","onClick","Panel","ComplementaryAreaWrapped","withComplementaryAreaContext","_default","exports"],"sources":["@wordpress/interface/src/components/complementary-area/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tPanel,\n\tSlot,\n\tFill,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { check, starEmpty, starFilled } from '@wordpress/icons';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tusePrevious,\n} from '@wordpress/compose';\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\nconst ANIMATION_DURATION = 0.3;\n\nfunction ComplementaryAreaSlot( { scope, ...props } ) {\n\treturn <Slot name={ `ComplementaryArea/${ scope }` } { ...props } />;\n}\n\nconst SIDEBAR_WIDTH = 280;\nconst variants = {\n\topen: { width: SIDEBAR_WIDTH },\n\tclosed: { width: 0 },\n\tmobileOpen: { width: '100vw' },\n};\n\nfunction ComplementaryAreaFill( {\n\tactiveArea,\n\tisActive,\n\tscope,\n\tchildren,\n\tclassName,\n\tid,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\t// This is used to delay the exit animation to the next tick.\n\t// The reason this is done is to allow us to apply the right transition properties\n\t// When we switch from an open sidebar to another open sidebar.\n\t// we don't want to animate in this case.\n\tconst previousActiveArea = usePrevious( activeArea );\n\tconst previousIsActive = usePrevious( isActive );\n\tconst [ , setState ] = useState( {} );\n\tuseEffect( () => {\n\t\tsetState( {} );\n\t}, [ isActive ] );\n\tconst transition = {\n\t\ttype: 'tween',\n\t\tduration:\n\t\t\tdisableMotion ||\n\t\t\tisMobileViewport ||\n\t\t\t( !! previousActiveArea &&\n\t\t\t\t!! activeArea &&\n\t\t\t\tactiveArea !== previousActiveArea )\n\t\t\t\t? 0\n\t\t\t\t: ANIMATION_DURATION,\n\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t};\n\n\treturn (\n\t\t<Fill name={ `ComplementaryArea/${ scope }` }>\n\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t{ ( previousIsActive || isActive ) && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ variants }\n\t\t\t\t\t\tinitial=\"closed\"\n\t\t\t\t\t\tanimate={ isMobileViewport ? 'mobileOpen' : 'open' }\n\t\t\t\t\t\texit=\"closed\"\n\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\tclassName=\"interface-complementary-area__fill\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\twidth: isMobileViewport\n\t\t\t\t\t\t\t\t\t? '100vw'\n\t\t\t\t\t\t\t\t\t: SIDEBAR_WIDTH,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\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}, [\n\t\tisActive,\n\t\tisSmall,\n\t\tscope,\n\t\tidentifier,\n\t\tactiveArea,\n\t\tdisableComplementaryArea,\n\t\tenableComplementaryArea,\n\t] );\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} ) {\n\t// This state is used to delay the rendering of the Fill\n\t// until the initial effect runs.\n\t// This prevents the animation from running on mount if\n\t// the complementary area is active by default.\n\tconst [ isReady, setIsReady ] = useState( false );\n\tconst {\n\t\tisLoading,\n\t\tisActive,\n\t\tisPinned,\n\t\tactiveArea,\n\t\tisSmall,\n\t\tisLarge,\n\t\tshowIconLabels,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetActiveComplementaryArea,\n\t\t\t\tisComplementaryAreaLoading,\n\t\t\t\tisItemPinned,\n\t\t\t} = select( interfaceStore );\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\tconst _activeArea = getActiveComplementaryArea( scope );\n\n\t\t\treturn {\n\t\t\t\tisLoading: isComplementaryAreaLoading( scope ),\n\t\t\t\tisActive: _activeArea === identifier,\n\t\t\t\tisPinned: isItemPinned( scope, identifier ),\n\t\t\t\tactiveArea: _activeArea,\n\t\t\t\tisSmall: select( viewportStore ).isViewportMatch( '< medium' ),\n\t\t\t\tisLarge: select( viewportStore ).isViewportMatch( 'large' ),\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t},\n\t\t[ identifier, scope ]\n\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\tsetIsReady( true );\n\t}, [\n\t\tactiveArea,\n\t\tisActiveByDefault,\n\t\tscope,\n\t\tidentifier,\n\t\tisSmall,\n\t\tenableComplementaryArea,\n\t\tdisableComplementaryArea,\n\t] );\n\n\tif ( ! isReady ) {\n\t\treturn;\n\t}\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\tsize=\"compact\"\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<ComplementaryAreaFill\n\t\t\t\tactiveArea={ activeArea }\n\t\t\t\tisActive={ isActive }\n\t\t\t\tclassName={ clsx( 'interface-complementary-area', className ) }\n\t\t\t\tscope={ scope }\n\t\t\t\tid={ identifier.replace( '/', ':' ) }\n\t\t\t>\n\t\t\t\t<ComplementaryAreaHeader\n\t\t\t\t\tclassName={ headerClassName }\n\t\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\t\tonClose={ () => disableComplementaryArea( scope ) }\n\t\t\t\t\tsmallScreenTitle={ smallScreenTitle }\n\t\t\t\t\ttoggleButtonProps={ {\n\t\t\t\t\t\tlabel: closeLabel,\n\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\tshortcut: toggleShortcut,\n\t\t\t\t\t\tscope,\n\t\t\t\t\t\tidentifier,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ header || (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h2 className=\"interface-complementary-area-header__title\">\n\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t{ isPinnable && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"interface-complementary-area__pin-unpin-item\"\n\t\t\t\t\t\t\t\t\ticon={ isPinned ? starFilled : starEmpty }\n\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\tisPinned\n\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: __( 'Pin to toolbar' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t( isPinned ? unpinItem : pinItem )(\n\t\t\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tisPressed={ isPinned }\n\t\t\t\t\t\t\t\t\taria-expanded={ isPinned }\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\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) }\n\t\t\t\t</ComplementaryAreaHeader>\n\t\t\t\t<Panel className={ panelClassName }>{ children }</Panel>\n\t\t\t</ComplementaryAreaFill>\n\t\t</>\n\t);\n}\n\nconst ComplementaryAreaWrapped =\n\twithComplementaryAreaContext( ComplementaryArea );\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AASA,IAAAS,wBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,8BAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,wBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,yBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,YAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AApCA;AACA;AACA;;AAGA;AACA;AACA;;AAqBA;AACA;AACA;;AAQA,MAAMe,kBAAkB,GAAG,GAAG;AAE9B,SAASC,qBAAqBA,CAAE;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAG;EACrD,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAoB,IAAI;IAACC,IAAI,EAAI,qBAAq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kB;IACrCmC,iBAAiB,EAAG;MACnBT,KAAK,EAAEjC,UAAU;MACjBqC,IAAI,EAAE,OAAO;MACbM,QAAQ,EAAElC,cAAc;MACxB7D,KAAK;MACLyC;IACD;EAAG,GAEDa,MAAM,IACP,IAAApD,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAgF,QAAA,QACC,IAAAhF,MAAA,CAAAC,aAAA;IAAIa,SAAS,EAAC;EAA4C,GACvD4C,KACC,CAAC,EACHH,UAAU,IACX,IAAAvD,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAgH,MAAM;IACNhF,SAAS,EAAC,8CAA8C;IACxDwC,IAAI,EAAGU,QAAQ,GAAG+B,iBAAU,GAAGC,gBAAW;IAC1Cb,KAAK,EACJnB,QAAQ,GACL,IAAAb,QAAE,EAAE,oBAAqB,CAAC,GAC1B,IAAAA,QAAE,EAAE,gBAAiB,CACxB;IACD8C,OAAO,EAAGA,CAAA,KACT,CAAEjC,QAAQ,GAAGc,SAAS,GAAGD,OAAO,EAC/B/E,KAAK,EACLyC,UACD,CACA;IACD2C,SAAS,EAAGlB,QAAU;IACtB,iBAAgBA,QAAU;IAC1BuB,IAAI,EAAC;EAAS,CACd,CAED,CAEqB,CAAC,EAC1B,IAAAvF,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAoH,KAAK;IAACpF,SAAS,EAAG0C;EAAgB,GAAG3C,QAAiB,CACjC,CACtB,CAAC;AAEL;AAEA,MAAMsF,wBAAwB,GAC7B,IAAAC,iCAA4B,EAAEnD,iBAAkB,CAAC;AAElDkD,wBAAwB,CAACjG,IAAI,GAAGL,qBAAqB;AAAC,IAAAwG,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEvCkB,wBAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_data","_i18n","_icons","_element","_viewport","_preferences","_compose","_complementaryAreaHeader","_complementaryAreaMoreMenuItem","_complementaryAreaToggle","_complementaryAreaContext","_pinnedItems","_store","_jsxRuntime","ANIMATION_DURATION","ComplementaryAreaSlot","scope","props","jsx","Slot","name","SIDEBAR_WIDTH","variants","open","width","closed","mobileOpen","ComplementaryAreaFill","activeArea","isActive","children","className","id","disableMotion","useReducedMotion","isMobileViewport","useViewportMatch","previousActiveArea","usePrevious","previousIsActive","setState","useState","useEffect","transition","type","duration","ease","Fill","__unstableAnimatePresence","initial","__unstableMotion","div","animate","exit","style","useAdjustComplementaryListener","identifier","isSmall","previousIsSmall","useRef","shouldOpenWhenNotSmall","enableComplementaryArea","disableComplementaryArea","useDispatch","interfaceStore","current","ComplementaryArea","closeLabel","__","header","headerClassName","icon","isPinnable","panelClassName","smallScreenTitle","title","toggleShortcut","isActiveByDefault","isReady","setIsReady","isLoading","isPinned","isLarge","showIconLabels","useSelect","select","getActiveComplementaryArea","isComplementaryAreaLoading","isItemPinned","get","preferencesStore","_activeArea","viewportStore","isViewportMatch","pinItem","unpinItem","undefined","jsxs","Fragment","default","isPressed","label","check","showTooltip","variant","size","target","clsx","replace","onClose","toggleButtonProps","shortcut","Button","starFilled","starEmpty","onClick","Panel","ComplementaryAreaWrapped","withComplementaryAreaContext","_default","exports"],"sources":["@wordpress/interface/src/components/complementary-area/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tPanel,\n\tSlot,\n\tFill,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { check, starEmpty, starFilled } from '@wordpress/icons';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tusePrevious,\n} from '@wordpress/compose';\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\nconst ANIMATION_DURATION = 0.3;\n\nfunction ComplementaryAreaSlot( { scope, ...props } ) {\n\treturn <Slot name={ `ComplementaryArea/${ scope }` } { ...props } />;\n}\n\nconst SIDEBAR_WIDTH = 280;\nconst variants = {\n\topen: { width: SIDEBAR_WIDTH },\n\tclosed: { width: 0 },\n\tmobileOpen: { width: '100vw' },\n};\n\nfunction ComplementaryAreaFill( {\n\tactiveArea,\n\tisActive,\n\tscope,\n\tchildren,\n\tclassName,\n\tid,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\t// This is used to delay the exit animation to the next tick.\n\t// The reason this is done is to allow us to apply the right transition properties\n\t// When we switch from an open sidebar to another open sidebar.\n\t// we don't want to animate in this case.\n\tconst previousActiveArea = usePrevious( activeArea );\n\tconst previousIsActive = usePrevious( isActive );\n\tconst [ , setState ] = useState( {} );\n\tuseEffect( () => {\n\t\tsetState( {} );\n\t}, [ isActive ] );\n\tconst transition = {\n\t\ttype: 'tween',\n\t\tduration:\n\t\t\tdisableMotion ||\n\t\t\tisMobileViewport ||\n\t\t\t( !! previousActiveArea &&\n\t\t\t\t!! activeArea &&\n\t\t\t\tactiveArea !== previousActiveArea )\n\t\t\t\t? 0\n\t\t\t\t: ANIMATION_DURATION,\n\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t};\n\n\treturn (\n\t\t<Fill name={ `ComplementaryArea/${ scope }` }>\n\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t{ ( previousIsActive || isActive ) && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ variants }\n\t\t\t\t\t\tinitial=\"closed\"\n\t\t\t\t\t\tanimate={ isMobileViewport ? 'mobileOpen' : 'open' }\n\t\t\t\t\t\texit=\"closed\"\n\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\tclassName=\"interface-complementary-area__fill\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\twidth: isMobileViewport\n\t\t\t\t\t\t\t\t\t? '100vw'\n\t\t\t\t\t\t\t\t\t: SIDEBAR_WIDTH,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\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}, [\n\t\tisActive,\n\t\tisSmall,\n\t\tscope,\n\t\tidentifier,\n\t\tactiveArea,\n\t\tdisableComplementaryArea,\n\t\tenableComplementaryArea,\n\t] );\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} ) {\n\t// This state is used to delay the rendering of the Fill\n\t// until the initial effect runs.\n\t// This prevents the animation from running on mount if\n\t// the complementary area is active by default.\n\tconst [ isReady, setIsReady ] = useState( false );\n\tconst {\n\t\tisLoading,\n\t\tisActive,\n\t\tisPinned,\n\t\tactiveArea,\n\t\tisSmall,\n\t\tisLarge,\n\t\tshowIconLabels,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetActiveComplementaryArea,\n\t\t\t\tisComplementaryAreaLoading,\n\t\t\t\tisItemPinned,\n\t\t\t} = select( interfaceStore );\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\tconst _activeArea = getActiveComplementaryArea( scope );\n\n\t\t\treturn {\n\t\t\t\tisLoading: isComplementaryAreaLoading( scope ),\n\t\t\t\tisActive: _activeArea === identifier,\n\t\t\t\tisPinned: isItemPinned( scope, identifier ),\n\t\t\t\tactiveArea: _activeArea,\n\t\t\t\tisSmall: select( viewportStore ).isViewportMatch( '< medium' ),\n\t\t\t\tisLarge: select( viewportStore ).isViewportMatch( 'large' ),\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t},\n\t\t[ identifier, scope ]\n\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\tsetIsReady( true );\n\t}, [\n\t\tactiveArea,\n\t\tisActiveByDefault,\n\t\tscope,\n\t\tidentifier,\n\t\tisSmall,\n\t\tenableComplementaryArea,\n\t\tdisableComplementaryArea,\n\t] );\n\n\tif ( ! isReady ) {\n\t\treturn;\n\t}\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\tsize=\"compact\"\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<ComplementaryAreaFill\n\t\t\t\tactiveArea={ activeArea }\n\t\t\t\tisActive={ isActive }\n\t\t\t\tclassName={ clsx( 'interface-complementary-area', className ) }\n\t\t\t\tscope={ scope }\n\t\t\t\tid={ identifier.replace( '/', ':' ) }\n\t\t\t>\n\t\t\t\t<ComplementaryAreaHeader\n\t\t\t\t\tclassName={ headerClassName }\n\t\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\t\tonClose={ () => disableComplementaryArea( scope ) }\n\t\t\t\t\tsmallScreenTitle={ smallScreenTitle }\n\t\t\t\t\ttoggleButtonProps={ {\n\t\t\t\t\t\tlabel: closeLabel,\n\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\tshortcut: toggleShortcut,\n\t\t\t\t\t\tscope,\n\t\t\t\t\t\tidentifier,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ header || (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h2 className=\"interface-complementary-area-header__title\">\n\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t{ isPinnable && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"interface-complementary-area__pin-unpin-item\"\n\t\t\t\t\t\t\t\t\ticon={ isPinned ? starFilled : starEmpty }\n\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\tisPinned\n\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: __( 'Pin to toolbar' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t( isPinned ? unpinItem : pinItem )(\n\t\t\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tisPressed={ isPinned }\n\t\t\t\t\t\t\t\t\taria-expanded={ isPinned }\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\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) }\n\t\t\t\t</ComplementaryAreaHeader>\n\t\t\t\t<Panel className={ panelClassName }>{ children }</Panel>\n\t\t\t</ComplementaryAreaFill>\n\t\t</>\n\t);\n}\n\nconst ComplementaryAreaWrapped =\n\twithComplementaryAreaContext( ComplementaryArea );\n\nComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryAreaWrapped;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AASA,IAAAS,wBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,8BAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,wBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,yBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,YAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,MAAA,GAA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IAAI,EAAC;UAAS,CACd,CACD;QAAA,CACA;MACF,CACuB,CAAC,eAC1B,IAAA5F,WAAA,CAAAK,GAAA,EAACnB,WAAA,CAAAqH,KAAK;QAACrF,SAAS,EAAG0C,cAAgB;QAAA3C,QAAA,EAAGA;MAAQ,CAAS,CAAC;IAAA,CAClC,CAAC;EAAA,CACvB,CAAC;AAEL;AAEA,MAAMuF,wBAAwB,GAC7B,IAAAC,iCAA4B,EAAEpD,iBAAkB,CAAC;AAElDmD,wBAAwB,CAAClG,IAAI,GAAGJ,qBAAqB;AAAC,IAAAwG,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEvCkB,wBAAwB","ignoreList":[]}
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
9
|
var _icons = require("@wordpress/icons");
|
|
11
10
|
var _complementaryAreaToggle = _interopRequireDefault(require("../complementary-area-toggle"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
/**
|
|
13
13
|
* External dependencies
|
|
14
14
|
*/
|
|
@@ -27,18 +27,23 @@ const ComplementaryAreaHeader = ({
|
|
|
27
27
|
className,
|
|
28
28
|
toggleButtonProps
|
|
29
29
|
}) => {
|
|
30
|
-
const toggleButton = (0,
|
|
30
|
+
const toggleButton = /*#__PURE__*/(0, _jsxRuntime.jsx)(_complementaryAreaToggle.default, {
|
|
31
31
|
icon: _icons.closeSmall,
|
|
32
32
|
...toggleButtonProps
|
|
33
33
|
});
|
|
34
|
-
return (0,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
35
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
36
|
+
className: "components-panel__header interface-complementary-area-header__small",
|
|
37
|
+
children: [smallScreenTitle && /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
38
|
+
className: "interface-complementary-area-header__small-title",
|
|
39
|
+
children: smallScreenTitle
|
|
40
|
+
}), toggleButton]
|
|
41
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
42
|
+
className: (0, _clsx.default)('components-panel__header', 'interface-complementary-area-header', className),
|
|
43
|
+
tabIndex: -1,
|
|
44
|
+
children: [children, toggleButton]
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
42
47
|
};
|
|
43
48
|
var _default = exports.default = ComplementaryAreaHeader;
|
|
44
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_icons","_complementaryAreaToggle","ComplementaryAreaHeader","smallScreenTitle","children","className","toggleButtonProps","toggleButton","
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_icons","_complementaryAreaToggle","_jsxRuntime","ComplementaryAreaHeader","smallScreenTitle","children","className","toggleButtonProps","toggleButton","jsx","default","icon","closeSmall","jsxs","Fragment","clsx","tabIndex","_default","exports"],"sources":["@wordpress/interface/src/components/complementary-area-header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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<h2 className=\"interface-complementary-area-header__small-title\">\n\t\t\t\t\t\t{ smallScreenTitle }\n\t\t\t\t\t</h2>\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={ clsx(\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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAmE,IAAAG,WAAA,GAAAH,OAAA;AAbnE;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMI,uBAAuB,GAAGA,CAAE;EACjCC,gBAAgB;EAChBC,QAAQ;EACRC,SAAS;EACTC;AACD,CAAC,KAAM;EACN,MAAMC,YAAY,gBACjB,IAAAN,WAAA,CAAAO,GAAA,EAACR,wBAAA,CAAAS,OAAuB;IAACC,IAAI,EAAGC,iBAAY;IAAA,GAAML;EAAiB,CAAI,CACvE;EACD,oBACC,IAAAL,WAAA,CAAAW,IAAA,EAAAX,WAAA,CAAAY,QAAA;IAAAT,QAAA,gBACC,IAAAH,WAAA,CAAAW,IAAA;MAAKP,SAAS,EAAC,qEAAqE;MAAAD,QAAA,GACjFD,gBAAgB,iBACjB,IAAAF,WAAA,CAAAO,GAAA;QAAIH,SAAS,EAAC,kDAAkD;QAAAD,QAAA,EAC7DD;MAAgB,CACf,CACJ,EACCI,YAAY;IAAA,CACV,CAAC,eACN,IAAAN,WAAA,CAAAW,IAAA;MACCP,SAAS,EAAG,IAAAS,aAAI,EACf,0BAA0B,EAC1B,qCAAqC,EACrCT,SACD,CAAG;MACHU,QAAQ,EAAG,CAAC,CAAG;MAAAX,QAAA,GAEbA,QAAQ,EACRG,YAAY;IAAA,CACV,CAAC;EAAA,CACL,CAAC;AAEL,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEaP,uBAAuB","ignoreList":[]}
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = ComplementaryAreaMoreMenuItem;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _icons = require("@wordpress/icons");
|
|
10
9
|
var _components = require("@wordpress/components");
|
|
11
10
|
var _complementaryAreaToggle = _interopRequireDefault(require("../complementary-area-toggle"));
|
|
12
11
|
var _actionItem = _interopRequireDefault(require("../action-item"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
/**
|
|
14
14
|
* WordPress dependencies
|
|
15
15
|
*/
|
|
@@ -25,7 +25,7 @@ const PluginsMenuItem = ({
|
|
|
25
25
|
__unstableExplicitMenuItem,
|
|
26
26
|
__unstableTarget,
|
|
27
27
|
...restProps
|
|
28
|
-
}) => (0,
|
|
28
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
|
|
29
29
|
...restProps
|
|
30
30
|
});
|
|
31
31
|
function ComplementaryAreaMoreMenuItem({
|
|
@@ -34,9 +34,9 @@ function ComplementaryAreaMoreMenuItem({
|
|
|
34
34
|
__unstableExplicitMenuItem,
|
|
35
35
|
...props
|
|
36
36
|
}) {
|
|
37
|
-
return (0,
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_complementaryAreaToggle.default, {
|
|
38
38
|
as: toggleProps => {
|
|
39
|
-
return (0,
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_actionItem.default, {
|
|
40
40
|
__unstableExplicitMenuItem: __unstableExplicitMenuItem,
|
|
41
41
|
__unstableTarget: `${scope}/${target}`,
|
|
42
42
|
as: PluginsMenuItem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_icons","require","_components","_complementaryAreaToggle","_interopRequireDefault","_actionItem","PluginsMenuItem","__unstableExplicitMenuItem","__unstableTarget","restProps","
|
|
1
|
+
{"version":3,"names":["_icons","require","_components","_complementaryAreaToggle","_interopRequireDefault","_actionItem","_jsxRuntime","PluginsMenuItem","__unstableExplicitMenuItem","__unstableTarget","restProps","jsx","MenuItem","ComplementaryAreaMoreMenuItem","scope","target","props","default","as","toggleProps","name","role","selectedIcon","check"],"sources":["@wordpress/interface/src/components/complementary-area-more-menu-item/index.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,wBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AAAwC,IAAAK,WAAA,GAAAL,OAAA;AAVxC;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAMM,eAAe,GAAGA,CAAE;EACzB;EACA;EACA;EACAC,0BAA0B;EAC1BC,gBAAgB;EAChB,GAAGC;AACJ,CAAC,kBAAM,IAAAJ,WAAA,CAAAK,GAAA,EAACT,WAAA,CAAAU,QAAQ;EAAA,GAAMF;AAAS,CAAI,CAAC;AAErB,SAASG,6BAA6BA,CAAE;EACtDC,KAAK;EACLC,MAAM;EACNP,0BAA0B;EAC1B,GAAGQ;AACJ,CAAC,EAAG;EACH,oBACC,IAAAV,WAAA,CAAAK,GAAA,EAACR,wBAAA,CAAAc,OAAuB;IACvBC,EAAE,EAAKC,WAAW,IAAM;MACvB,oBACC,IAAAb,WAAA,CAAAK,GAAA,EAACN,WAAA,CAAAY,OAAU;QACVT,0BAA0B,EACzBA,0BACA;QACDC,gBAAgB,EAAI,GAAGK,KAAO,IAAIC,MAAQ,EAAG;QAC7CG,EAAE,EAAGX,eAAiB;QACtBa,IAAI,EAAI,GAAGN,KAAO,mBAAoB;QAAA,GACjCK;MAAW,CAChB,CAAC;IAEJ,CAAG;IACHE,IAAI,EAAC,kBAAkB;IACvBC,YAAY,EAAGC,YAAO;IACtBH,IAAI,EAAGL,MAAQ;IACfD,KAAK,EAAGA,KAAO;IAAA,GACVE;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _components = require("@wordpress/components");
|
|
10
9
|
var _data = require("@wordpress/data");
|
|
11
10
|
var _store = require("../../store");
|
|
12
11
|
var _complementaryAreaContext = _interopRequireDefault(require("../complementary-area-context"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
/**
|
|
14
14
|
* WordPress dependencies
|
|
15
15
|
*/
|
|
@@ -33,7 +33,7 @@ function ComplementaryAreaToggle({
|
|
|
33
33
|
enableComplementaryArea,
|
|
34
34
|
disableComplementaryArea
|
|
35
35
|
} = (0, _data.useDispatch)(_store.store);
|
|
36
|
-
return (0,
|
|
36
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentToUse, {
|
|
37
37
|
icon: selectedIcon && isSelected ? selectedIcon : icon,
|
|
38
38
|
"aria-controls": identifier.replace('/', ':'),
|
|
39
39
|
onClick: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_store","_complementaryAreaContext","_interopRequireDefault","ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","name","props","ComponentToUse","isSelected","useSelect","select","interfaceStore","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","useDispatch","
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_store","_complementaryAreaContext","_interopRequireDefault","_jsxRuntime","ComplementaryAreaToggle","as","Button","scope","identifier","icon","selectedIcon","name","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\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\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\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\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;EACJ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGR,EAAE;EACzB,MAAMS,UAAU,GAAG,IAAAC,eAAS,EACzBC,MAAM,IACPA,MAAM,CAAEC,YAAe,CAAC,CAACC,0BAA0B,CAAEX,KAAM,CAAC,KAC5DC,UAAU,EACX,CAAEA,UAAU,EAAED,KAA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