@wordpress/interface 9.16.1-next.f56bd8138.0 → 9.17.1-next.47f435fc9.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/action-item/index.js +68 -66
  3. package/build/components/action-item/index.js.map +7 -1
  4. package/build/components/complementary-area/index.js +215 -194
  5. package/build/components/complementary-area/index.js.map +7 -1
  6. package/build/components/complementary-area-header/index.js +53 -33
  7. package/build/components/complementary-area-header/index.js.map +7 -1
  8. package/build/components/complementary-area-more-menu-item/index.js +60 -39
  9. package/build/components/complementary-area-more-menu-item/index.js.map +7 -1
  10. package/build/components/complementary-area-toggle/index.js +61 -50
  11. package/build/components/complementary-area-toggle/index.js.map +7 -1
  12. package/build/components/fullscreen-mode/index.js +33 -27
  13. package/build/components/fullscreen-mode/index.js.map +7 -1
  14. package/build/components/index.js +52 -55
  15. package/build/components/index.js.map +7 -1
  16. package/build/components/interface-skeleton/index.js +156 -132
  17. package/build/components/interface-skeleton/index.js.map +7 -1
  18. package/build/components/pinned-items/index.js +48 -39
  19. package/build/components/pinned-items/index.js.map +7 -1
  20. package/build/index.js +27 -24
  21. package/build/index.js.map +7 -1
  22. package/build/store/actions.js +94 -165
  23. package/build/store/actions.js.map +7 -1
  24. package/build/store/constants.js +27 -12
  25. package/build/store/constants.js.map +7 -1
  26. package/build/store/deprecated.js +55 -29
  27. package/build/store/deprecated.js.map +7 -1
  28. package/build/store/index.js +44 -32
  29. package/build/store/index.js.map +7 -1
  30. package/build/store/reducer.js +49 -51
  31. package/build/store/reducer.js.map +7 -1
  32. package/build/store/selectors.js +96 -93
  33. package/build/store/selectors.js.map +7 -1
  34. package/build-module/components/action-item/index.js +49 -59
  35. package/build-module/components/action-item/index.js.map +7 -1
  36. package/build-module/components/complementary-area/index.js +185 -174
  37. package/build-module/components/complementary-area/index.js.map +7 -1
  38. package/build-module/components/complementary-area-header/index.js +25 -26
  39. package/build-module/components/complementary-area-header/index.js.map +7 -1
  40. package/build-module/components/complementary-area-more-menu-item/index.js +33 -33
  41. package/build-module/components/complementary-area-more-menu-item/index.js.map +7 -1
  42. package/build-module/components/complementary-area-toggle/index.js +41 -44
  43. package/build-module/components/complementary-area-toggle/index.js.map +7 -1
  44. package/build-module/components/fullscreen-mode/index.js +13 -19
  45. package/build-module/components/fullscreen-mode/index.js.map +7 -1
  46. package/build-module/components/index.js +15 -8
  47. package/build-module/components/index.js.map +7 -1
  48. package/build-module/components/interface-skeleton/index.js +132 -122
  49. package/build-module/components/interface-skeleton/index.js.map +7 -1
  50. package/build-module/components/pinned-items/index.js +20 -32
  51. package/build-module/components/pinned-items/index.js.map +7 -1
  52. package/build-module/index.js +6 -3
  53. package/build-module/index.js.map +7 -1
  54. package/build-module/store/actions.js +47 -138
  55. package/build-module/store/actions.js.map +7 -1
  56. package/build-module/store/constants.js +5 -7
  57. package/build-module/store/constants.js.map +7 -1
  58. package/build-module/store/deprecated.js +21 -20
  59. package/build-module/store/deprecated.js.map +7 -1
  60. package/build-module/store/index.js +10 -22
  61. package/build-module/store/index.js.map +7 -1
  62. package/build-module/store/reducer.js +28 -45
  63. package/build-module/store/reducer.js.map +7 -1
  64. package/build-module/store/selectors.js +64 -87
  65. package/build-module/store/selectors.js.map +7 -1
  66. package/build-style/style-rtl.css +87 -85
  67. package/build-style/style.css +87 -85
  68. package/package.json +21 -15
  69. package/src/components/complementary-area/style.scss +5 -0
  70. package/src/components/complementary-area-header/style.scss +3 -0
  71. package/src/components/fullscreen-mode/style.scss +3 -0
  72. package/src/components/index.js +0 -1
  73. package/src/components/interface-skeleton/index.js +1 -5
  74. package/src/components/interface-skeleton/style.scss +6 -0
  75. package/src/components/pinned-items/style.scss +3 -0
  76. package/src/style.scss +6 -5
  77. package/build/components/index.native.js +0 -21
  78. package/build/components/index.native.js.map +0 -1
  79. package/build/components/navigable-region/index.js +0 -38
  80. package/build/components/navigable-region/index.js.map +0 -1
  81. package/build-module/components/index.native.js +0 -3
  82. package/build-module/components/index.native.js.map +0 -1
  83. package/build-module/components/navigable-region/index.js +0 -30
  84. package/build-module/components/navigable-region/index.js.map +0 -1
  85. package/src/components/navigable-region/README.md +0 -36
  86. package/src/components/navigable-region/index.js +0 -29
@@ -1,51 +1,39 @@
1
- /**
2
- * External dependencies
3
- */
4
- import clsx from 'clsx';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { Button, Panel, Slot, Fill, __unstableMotion as motion, __unstableAnimatePresence as AnimatePresence } from '@wordpress/components';
10
- import { useDispatch, useSelect } from '@wordpress/data';
11
- import { __ } from '@wordpress/i18n';
12
- import { check, starEmpty, starFilled } from '@wordpress/icons';
13
- import { useEffect, useRef, useState } from '@wordpress/element';
14
- import { store as viewportStore } from '@wordpress/viewport';
15
- import { store as preferencesStore } from '@wordpress/preferences';
16
- import { useReducedMotion, useViewportMatch, usePrevious } from '@wordpress/compose';
17
- import { usePluginContext } from '@wordpress/plugins';
18
-
19
- /**
20
- * Internal dependencies
21
- */
22
- import ComplementaryAreaHeader from '../complementary-area-header';
23
- import ComplementaryAreaMoreMenuItem from '../complementary-area-more-menu-item';
24
- import ComplementaryAreaToggle from '../complementary-area-toggle';
25
- import PinnedItems from '../pinned-items';
26
- import { store as interfaceStore } from '../../store';
27
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import {
4
+ Button,
5
+ Panel,
6
+ Slot,
7
+ Fill,
8
+ __unstableMotion as motion,
9
+ __unstableAnimatePresence as AnimatePresence
10
+ } from "@wordpress/components";
11
+ import { useDispatch, useSelect } from "@wordpress/data";
12
+ import { __ } from "@wordpress/i18n";
13
+ import { check, starEmpty, starFilled } from "@wordpress/icons";
14
+ import { useEffect, useRef, useState } from "@wordpress/element";
15
+ import { store as viewportStore } from "@wordpress/viewport";
16
+ import { store as preferencesStore } from "@wordpress/preferences";
17
+ import {
18
+ useReducedMotion,
19
+ useViewportMatch,
20
+ usePrevious
21
+ } from "@wordpress/compose";
22
+ import { usePluginContext } from "@wordpress/plugins";
23
+ import ComplementaryAreaHeader from "../complementary-area-header";
24
+ import ComplementaryAreaMoreMenuItem from "../complementary-area-more-menu-item";
25
+ import ComplementaryAreaToggle from "../complementary-area-toggle";
26
+ import PinnedItems from "../pinned-items";
27
+ import { store as interfaceStore } from "../../store";
28
28
  const ANIMATION_DURATION = 0.3;
29
- function ComplementaryAreaSlot({
30
- scope,
31
- ...props
32
- }) {
33
- return /*#__PURE__*/_jsx(Slot, {
34
- name: `ComplementaryArea/${scope}`,
35
- ...props
36
- });
29
+ function ComplementaryAreaSlot({ scope, ...props }) {
30
+ return /* @__PURE__ */ jsx(Slot, { name: `ComplementaryArea/${scope}`, ...props });
37
31
  }
38
32
  const SIDEBAR_WIDTH = 280;
39
33
  const variants = {
40
- open: {
41
- width: SIDEBAR_WIDTH
42
- },
43
- closed: {
44
- width: 0
45
- },
46
- mobileOpen: {
47
- width: '100vw'
48
- }
34
+ open: { width: SIDEBAR_WIDTH },
35
+ closed: { width: 0 },
36
+ mobileOpen: { width: "100vw" }
49
37
  };
50
38
  function ComplementaryAreaFill({
51
39
  activeArea,
@@ -56,11 +44,7 @@ function ComplementaryAreaFill({
56
44
  id
57
45
  }) {
58
46
  const disableMotion = useReducedMotion();
59
- const isMobileViewport = useViewportMatch('medium', '<');
60
- // This is used to delay the exit animation to the next tick.
61
- // The reason this is done is to allow us to apply the right transition properties
62
- // When we switch from an open sidebar to another open sidebar.
63
- // we don't want to animate in this case.
47
+ const isMobileViewport = useViewportMatch("medium", "<");
64
48
  const previousActiveArea = usePrevious(activeArea);
65
49
  const previousIsActive = usePrevious(isActive);
66
50
  const [, setState] = useState({});
@@ -68,73 +52,74 @@ function ComplementaryAreaFill({
68
52
  setState({});
69
53
  }, [isActive]);
70
54
  const transition = {
71
- type: 'tween',
55
+ type: "tween",
72
56
  duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION,
73
57
  ease: [0.6, 0, 0.4, 1]
74
58
  };
75
- return /*#__PURE__*/_jsx(Fill, {
76
- name: `ComplementaryArea/${scope}`,
77
- children: /*#__PURE__*/_jsx(AnimatePresence, {
78
- initial: false,
79
- children: (previousIsActive || isActive) && /*#__PURE__*/_jsx(motion.div, {
80
- variants: variants,
81
- initial: "closed",
82
- animate: isMobileViewport ? 'mobileOpen' : 'open',
83
- exit: "closed",
84
- transition: transition,
85
- className: "interface-complementary-area__fill",
86
- children: /*#__PURE__*/_jsx("div", {
87
- id: id,
88
- className: className,
59
+ return /* @__PURE__ */ jsx(Fill, { name: `ComplementaryArea/${scope}`, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: (previousIsActive || isActive) && /* @__PURE__ */ jsx(
60
+ motion.div,
61
+ {
62
+ variants,
63
+ initial: "closed",
64
+ animate: isMobileViewport ? "mobileOpen" : "open",
65
+ exit: "closed",
66
+ transition,
67
+ className: "interface-complementary-area__fill",
68
+ children: /* @__PURE__ */ jsx(
69
+ "div",
70
+ {
71
+ id,
72
+ className,
89
73
  style: {
90
- width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH
74
+ width: isMobileViewport ? "100vw" : SIDEBAR_WIDTH
91
75
  },
92
- children: children
93
- })
94
- })
95
- })
96
- });
76
+ children
77
+ }
78
+ )
79
+ }
80
+ ) }) });
97
81
  }
98
82
  function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
99
83
  const previousIsSmallRef = useRef(false);
100
84
  const shouldOpenWhenNotSmallRef = useRef(false);
101
- const {
102
- enableComplementaryArea,
103
- disableComplementaryArea
104
- } = useDispatch(interfaceStore);
85
+ const { enableComplementaryArea, disableComplementaryArea } = useDispatch(interfaceStore);
105
86
  useEffect(() => {
106
- // If the complementary area is active and the editor is switching from
107
- // a big to a small window size.
108
87
  if (isActive && isSmall && !previousIsSmallRef.current) {
109
88
  disableComplementaryArea(scope);
110
- // Flag the complementary area to be reopened when the window size
111
- // goes from small to big.
112
89
  shouldOpenWhenNotSmallRef.current = true;
113
90
  } else if (
114
- // If there is a flag indicating the complementary area should be
115
- // enabled when we go from small to big window size and we are going
116
- // from a small to big window size.
117
- shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current) {
118
- // Remove the flag indicating the complementary area should be
119
- // enabled.
91
+ // If there is a flag indicating the complementary area should be
92
+ // enabled when we go from small to big window size and we are going
93
+ // from a small to big window size.
94
+ shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current
95
+ ) {
120
96
  shouldOpenWhenNotSmallRef.current = false;
121
97
  enableComplementaryArea(scope, identifier);
122
98
  } else if (
123
- // If the flag is indicating the current complementary should be
124
- // reopened but another complementary area becomes active, remove
125
- // the flag.
126
- shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier) {
99
+ // If the flag is indicating the current complementary should be
100
+ // reopened but another complementary area becomes active, remove
101
+ // the flag.
102
+ shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier
103
+ ) {
127
104
  shouldOpenWhenNotSmallRef.current = false;
128
105
  }
129
106
  if (isSmall !== previousIsSmallRef.current) {
130
107
  previousIsSmallRef.current = isSmall;
131
108
  }
132
- }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]);
109
+ }, [
110
+ isActive,
111
+ isSmall,
112
+ scope,
113
+ identifier,
114
+ activeArea,
115
+ disableComplementaryArea,
116
+ enableComplementaryArea
117
+ ]);
133
118
  }
134
119
  function ComplementaryArea({
135
120
  children,
136
121
  className,
137
- closeLabel = __('Close plugin'),
122
+ closeLabel = __("Close plugin"),
138
123
  identifier: identifierProp,
139
124
  header,
140
125
  headerClassName,
@@ -150,11 +135,6 @@ function ComplementaryArea({
150
135
  const context = usePluginContext();
151
136
  const icon = iconProp || context.icon;
152
137
  const identifier = identifierProp || `${context.name}/${name}`;
153
-
154
- // This state is used to delay the rendering of the Fill
155
- // until the initial effect runs.
156
- // This prevents the animation from running on mount if
157
- // the complementary area is active by default.
158
138
  const [isReady, setIsReady] = useState(false);
159
139
  const {
160
140
  isLoading,
@@ -164,28 +144,35 @@ function ComplementaryArea({
164
144
  isSmall,
165
145
  isLarge,
166
146
  showIconLabels
167
- } = useSelect(select => {
168
- const {
169
- getActiveComplementaryArea,
170
- isComplementaryAreaLoading,
171
- isItemPinned
172
- } = select(interfaceStore);
173
- const {
174
- get
175
- } = select(preferencesStore);
176
- const _activeArea = getActiveComplementaryArea(scope);
177
- return {
178
- isLoading: isComplementaryAreaLoading(scope),
179
- isActive: _activeArea === identifier,
180
- isPinned: isItemPinned(scope, identifier),
181
- activeArea: _activeArea,
182
- isSmall: select(viewportStore).isViewportMatch('< medium'),
183
- isLarge: select(viewportStore).isViewportMatch('large'),
184
- showIconLabels: get('core', 'showIconLabels')
185
- };
186
- }, [identifier, scope]);
187
- const isMobileViewport = useViewportMatch('medium', '<');
188
- useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
147
+ } = useSelect(
148
+ (select) => {
149
+ const {
150
+ getActiveComplementaryArea,
151
+ isComplementaryAreaLoading,
152
+ isItemPinned
153
+ } = select(interfaceStore);
154
+ const { get } = select(preferencesStore);
155
+ const _activeArea = getActiveComplementaryArea(scope);
156
+ return {
157
+ isLoading: isComplementaryAreaLoading(scope),
158
+ isActive: _activeArea === identifier,
159
+ isPinned: isItemPinned(scope, identifier),
160
+ activeArea: _activeArea,
161
+ isSmall: select(viewportStore).isViewportMatch("< medium"),
162
+ isLarge: select(viewportStore).isViewportMatch("large"),
163
+ showIconLabels: get("core", "showIconLabels")
164
+ };
165
+ },
166
+ [identifier, scope]
167
+ );
168
+ const isMobileViewport = useViewportMatch("medium", "<");
169
+ useAdjustComplementaryListener(
170
+ scope,
171
+ identifier,
172
+ activeArea,
173
+ isActive,
174
+ isSmall
175
+ );
189
176
  const {
190
177
  enableComplementaryArea,
191
178
  disableComplementaryArea,
@@ -193,77 +180,101 @@ function ComplementaryArea({
193
180
  unpinItem
194
181
  } = useDispatch(interfaceStore);
195
182
  useEffect(() => {
196
- // Set initial visibility: For large screens, enable if it's active by
197
- // default. For small screens, always initially disable.
198
- if (isActiveByDefault && activeArea === undefined && !isSmall) {
183
+ if (isActiveByDefault && activeArea === void 0 && !isSmall) {
199
184
  enableComplementaryArea(scope, identifier);
200
- } else if (activeArea === undefined && isSmall) {
185
+ } else if (activeArea === void 0 && isSmall) {
201
186
  disableComplementaryArea(scope, identifier);
202
187
  }
203
188
  setIsReady(true);
204
- }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]);
189
+ }, [
190
+ activeArea,
191
+ isActiveByDefault,
192
+ scope,
193
+ identifier,
194
+ isSmall,
195
+ enableComplementaryArea,
196
+ disableComplementaryArea
197
+ ]);
205
198
  if (!isReady) {
206
199
  return;
207
200
  }
208
- return /*#__PURE__*/_jsxs(_Fragment, {
209
- children: [isPinnable && /*#__PURE__*/_jsx(PinnedItems, {
210
- scope: scope,
211
- children: isPinned && /*#__PURE__*/_jsx(ComplementaryAreaToggle, {
212
- scope: scope,
213
- identifier: identifier,
201
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
202
+ isPinnable && /* @__PURE__ */ jsx(PinnedItems, { scope, children: isPinned && /* @__PURE__ */ jsx(
203
+ ComplementaryAreaToggle,
204
+ {
205
+ scope,
206
+ identifier,
214
207
  isPressed: isActive && (!showIconLabels || isLarge),
215
208
  "aria-expanded": isActive,
216
209
  "aria-disabled": isLoading,
217
210
  label: title,
218
211
  icon: showIconLabels ? check : icon,
219
212
  showTooltip: !showIconLabels,
220
- variant: showIconLabels ? 'tertiary' : undefined,
213
+ variant: showIconLabels ? "tertiary" : void 0,
221
214
  size: "compact",
222
215
  shortcut: toggleShortcut
223
- })
224
- }), name && isPinnable && /*#__PURE__*/_jsx(ComplementaryAreaMoreMenuItem, {
225
- target: name,
226
- scope: scope,
227
- icon: icon,
228
- children: title
229
- }), /*#__PURE__*/_jsxs(ComplementaryAreaFill, {
230
- activeArea: activeArea,
231
- isActive: isActive,
232
- className: clsx('interface-complementary-area', className),
233
- scope: scope,
234
- id: identifier.replace('/', ':'),
235
- children: [/*#__PURE__*/_jsx(ComplementaryAreaHeader, {
236
- className: headerClassName,
237
- closeLabel: closeLabel,
238
- onClose: () => disableComplementaryArea(scope),
239
- toggleButtonProps: {
240
- label: closeLabel,
241
- size: 'compact',
242
- shortcut: toggleShortcut,
243
- scope,
244
- identifier
245
- },
246
- children: header || /*#__PURE__*/_jsxs(_Fragment, {
247
- children: [/*#__PURE__*/_jsx("h2", {
248
- className: "interface-complementary-area-header__title",
249
- children: title
250
- }), isPinnable && !isMobileViewport && /*#__PURE__*/_jsx(Button, {
251
- className: "interface-complementary-area__pin-unpin-item",
252
- icon: isPinned ? starFilled : starEmpty,
253
- label: isPinned ? __('Unpin from toolbar') : __('Pin to toolbar'),
254
- onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
255
- isPressed: isPinned,
256
- "aria-expanded": isPinned,
257
- size: "compact"
258
- })]
259
- })
260
- }), /*#__PURE__*/_jsx(Panel, {
261
- className: panelClassName,
262
- children: children
263
- })]
264
- })]
265
- });
216
+ }
217
+ ) }),
218
+ name && isPinnable && /* @__PURE__ */ jsx(
219
+ ComplementaryAreaMoreMenuItem,
220
+ {
221
+ target: name,
222
+ scope,
223
+ icon,
224
+ children: title
225
+ }
226
+ ),
227
+ /* @__PURE__ */ jsxs(
228
+ ComplementaryAreaFill,
229
+ {
230
+ activeArea,
231
+ isActive,
232
+ className: clsx("interface-complementary-area", className),
233
+ scope,
234
+ id: identifier.replace("/", ":"),
235
+ children: [
236
+ /* @__PURE__ */ jsx(
237
+ ComplementaryAreaHeader,
238
+ {
239
+ className: headerClassName,
240
+ closeLabel,
241
+ onClose: () => disableComplementaryArea(scope),
242
+ toggleButtonProps: {
243
+ label: closeLabel,
244
+ size: "compact",
245
+ shortcut: toggleShortcut,
246
+ scope,
247
+ identifier
248
+ },
249
+ children: header || /* @__PURE__ */ jsxs(Fragment, { children: [
250
+ /* @__PURE__ */ jsx("h2", { className: "interface-complementary-area-header__title", children: title }),
251
+ isPinnable && !isMobileViewport && /* @__PURE__ */ jsx(
252
+ Button,
253
+ {
254
+ className: "interface-complementary-area__pin-unpin-item",
255
+ icon: isPinned ? starFilled : starEmpty,
256
+ label: isPinned ? __("Unpin from toolbar") : __("Pin to toolbar"),
257
+ onClick: () => (isPinned ? unpinItem : pinItem)(
258
+ scope,
259
+ identifier
260
+ ),
261
+ isPressed: isPinned,
262
+ "aria-expanded": isPinned,
263
+ size: "compact"
264
+ }
265
+ )
266
+ ] })
267
+ }
268
+ ),
269
+ /* @__PURE__ */ jsx(Panel, { className: panelClassName, children })
270
+ ]
271
+ }
272
+ )
273
+ ] });
266
274
  }
267
275
  ComplementaryArea.Slot = ComplementaryAreaSlot;
268
- export default ComplementaryArea;
269
- //# sourceMappingURL=index.js.map
276
+ var complementary_area_default = ComplementaryArea;
277
+ export {
278
+ complementary_area_default as default
279
+ };
280
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["clsx","Button","Panel","Slot","Fill","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","useDispatch","useSelect","__","check","starEmpty","starFilled","useEffect","useRef","useState","store","viewportStore","preferencesStore","useReducedMotion","useViewportMatch","usePrevious","usePluginContext","ComplementaryAreaHeader","ComplementaryAreaMoreMenuItem","ComplementaryAreaToggle","PinnedItems","interfaceStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ANIMATION_DURATION","ComplementaryAreaSlot","scope","props","name","SIDEBAR_WIDTH","variants","open","width","closed","mobileOpen","ComplementaryAreaFill","activeArea","isActive","children","className","id","disableMotion","isMobileViewport","previousActiveArea","previousIsActive","setState","transition","type","duration","ease","initial","div","animate","exit","style","useAdjustComplementaryListener","identifier","isSmall","previousIsSmallRef","shouldOpenWhenNotSmallRef","enableComplementaryArea","disableComplementaryArea","current","ComplementaryArea","closeLabel","identifierProp","header","headerClassName","icon","iconProp","isPinnable","panelClassName","title","toggleShortcut","isActiveByDefault","context","isReady","setIsReady","isLoading","isPinned","isLarge","showIconLabels","select","getActiveComplementaryArea","isComplementaryAreaLoading","isItemPinned","get","_activeArea","isViewportMatch","pinItem","unpinItem","undefined","isPressed","label","showTooltip","variant","size","shortcut","target","replace","onClose","toggleButtonProps","onClick"],"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';\nimport { usePluginContext } from '@wordpress/plugins';\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 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 previousIsSmallRef = useRef( false );\n\tconst shouldOpenWhenNotSmallRef = 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 && ! previousIsSmallRef.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\tshouldOpenWhenNotSmallRef.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\tshouldOpenWhenNotSmallRef.current &&\n\t\t\t! isSmall &&\n\t\t\tpreviousIsSmallRef.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\tshouldOpenWhenNotSmallRef.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\tshouldOpenWhenNotSmallRef.current &&\n\t\t\tactiveArea &&\n\t\t\tactiveArea !== identifier\n\t\t) {\n\t\t\tshouldOpenWhenNotSmallRef.current = false;\n\t\t}\n\t\tif ( isSmall !== previousIsSmallRef.current ) {\n\t\t\tpreviousIsSmallRef.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: identifierProp,\n\theader,\n\theaderClassName,\n\ticon: iconProp,\n\tisPinnable = true,\n\tpanelClassName,\n\tscope,\n\tname,\n\ttitle,\n\ttoggleShortcut,\n\tisActiveByDefault,\n} ) {\n\tconst context = usePluginContext();\n\tconst icon = iconProp || context.icon;\n\tconst identifier = identifierProp || `${ context.name }/${ name }`;\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\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\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\tshortcut={ toggleShortcut }\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\ttoggleButtonProps={ {\n\t\t\t\t\t\tlabel: closeLabel,\n\t\t\t\t\t\tsize: 'compact',\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 && ! isMobileViewport && (\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\nComplementaryArea.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryArea;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,MAAM,EACNC,KAAK,EACLC,IAAI,EACJC,IAAI,EACJC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,EAAEC,SAAS,EAAEC,UAAU,QAAQ,kBAAkB;AAC/D,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,SAASC,KAAK,IAAIC,aAAa,QAAQ,qBAAqB;AAC5D,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,gBAAgB,EAChBC,gBAAgB,EAChBC,WAAW,QACL,oBAAoB;AAC3B,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,6BAA6B,MAAM,sCAAsC;AAChF,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,WAAW,MAAM,iBAAiB;AACzC,SAASV,KAAK,IAAIW,cAAc,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtD,MAAMC,kBAAkB,GAAG,GAAG;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ourcesContent": ["/**\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';\nimport { usePluginContext } from '@wordpress/plugins';\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 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 previousIsSmallRef = useRef( false );\n\tconst shouldOpenWhenNotSmallRef = 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 && ! previousIsSmallRef.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\tshouldOpenWhenNotSmallRef.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\tshouldOpenWhenNotSmallRef.current &&\n\t\t\t! isSmall &&\n\t\t\tpreviousIsSmallRef.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\tshouldOpenWhenNotSmallRef.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\tshouldOpenWhenNotSmallRef.current &&\n\t\t\tactiveArea &&\n\t\t\tactiveArea !== identifier\n\t\t) {\n\t\t\tshouldOpenWhenNotSmallRef.current = false;\n\t\t}\n\t\tif ( isSmall !== previousIsSmallRef.current ) {\n\t\t\tpreviousIsSmallRef.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: identifierProp,\n\theader,\n\theaderClassName,\n\ticon: iconProp,\n\tisPinnable = true,\n\tpanelClassName,\n\tscope,\n\tname,\n\ttitle,\n\ttoggleShortcut,\n\tisActiveByDefault,\n} ) {\n\tconst context = usePluginContext();\n\tconst icon = iconProp || context.icon;\n\tconst identifier = identifierProp || `${ context.name }/${ name }`;\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\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\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\tshortcut={ toggleShortcut }\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\ttoggleButtonProps={ {\n\t\t\t\t\t\tlabel: closeLabel,\n\t\t\t\t\t\tsize: 'compact',\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 && ! isMobileViewport && (\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\nComplementaryArea.Slot = ComplementaryAreaSlot;\n\nexport default ComplementaryArea;\n"],
5
+ "mappings": "AAyCQ,S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AO,WAAW,aAAa;AAAA,oBAC/B,OACC,WACG,GAAI,oBAAqB,IACzB,GAAI,gBAAiB;AAAA,oBAEzB,SAAU,OACP,WAAW,YAAY;AAAA,sBACxB;AAAA,sBACA;AAAA,oBACD;AAAA,oBAED,WAAY;AAAA,oBACZ,iBAAgB;AAAA,oBAChB,MAAK;AAAA;AAAA,gBACN;AAAA,iBAEF;AAAA;AAAA,UAEF;AAAA,UACA,oBAAC,SAAM,WAAY,gBAAmB,UAAU;AAAA;AAAA;AAAA,IACjD;AAAA,KACD;AAEF;AAEA,kBAAkB,OAAO;AAEzB,IAAO,6BAAQ;",
6
+ "names": []
7
+ }
@@ -1,32 +1,31 @@
1
- /**
2
- * External dependencies
3
- */
4
- import clsx from 'clsx';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { closeSmall } from '@wordpress/icons';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import ComplementaryAreaToggle from '../complementary-area-toggle';
15
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { closeSmall } from "@wordpress/icons";
4
+ import ComplementaryAreaToggle from "../complementary-area-toggle";
16
5
  const ComplementaryAreaHeader = ({
17
6
  children,
18
7
  className,
19
8
  toggleButtonProps
20
9
  }) => {
21
- const toggleButton = /*#__PURE__*/_jsx(ComplementaryAreaToggle, {
22
- icon: closeSmall,
23
- ...toggleButtonProps
24
- });
25
- return /*#__PURE__*/_jsxs("div", {
26
- className: clsx('components-panel__header', 'interface-complementary-area-header', className),
27
- tabIndex: -1,
28
- children: [children, toggleButton]
29
- });
10
+ const toggleButton = /* @__PURE__ */ jsx(ComplementaryAreaToggle, { icon: closeSmall, ...toggleButtonProps });
11
+ return /* @__PURE__ */ jsxs(
12
+ "div",
13
+ {
14
+ className: clsx(
15
+ "components-panel__header",
16
+ "interface-complementary-area-header",
17
+ className
18
+ ),
19
+ tabIndex: -1,
20
+ children: [
21
+ children,
22
+ toggleButton
23
+ ]
24
+ }
25
+ );
30
26
  };
31
- export default ComplementaryAreaHeader;
32
- //# sourceMappingURL=index.js.map
27
+ var complementary_area_header_default = ComplementaryAreaHeader;
28
+ export {
29
+ complementary_area_header_default as default
30
+ };
31
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["clsx","closeSmall","ComplementaryAreaToggle","jsx","_jsx","jsxs","_jsxs","ComplementaryAreaHeader","children","className","toggleButtonProps","toggleButton","icon","tabIndex"],"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\tchildren,\n\tclassName,\n\ttoggleButtonProps,\n} ) => {\n\tconst toggleButton = (\n\t\t<ComplementaryAreaToggle icon={ closeSmall } { ...toggleButtonProps } />\n\t);\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'components-panel__header',\n\t\t\t\t'interface-complementary-area-header',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttabIndex={ -1 }\n\t\t>\n\t\t\t{ children }\n\t\t\t{ toggleButton }\n\t\t</div>\n\t);\n};\n\nexport default ComplementaryAreaHeader;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,UAAU,QAAQ,kBAAkB;;AAE7C;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnE,MAAMC,uBAAuB,GAAGA,CAAE;EACjCC,QAAQ;EACRC,SAAS;EACTC;AACD,CAAC,KAAM;EACN,MAAMC,YAAY,gBACjBP,IAAA,CAACF,uBAAuB;IAACU,IAAI,EAAGX,UAAY;IAAA,GAAMS;EAAiB,CAAI,CACvE;EACD,oBACCJ,KAAA;IACCG,SAAS,EAAGT,IAAI,CACf,0BAA0B,EAC1B,qCAAqC,EACrCS,SACD,CAAG;IACHI,QAAQ,EAAG,CAAC,CAAG;IAAAL,QAAA,GAEbA,QAAQ,EACRG,YAAY;EAAA,CACV,CAAC;AAER,CAAC;AAED,eAAeJ,uBAAuB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/complementary-area-header/index.js"],
4
+ "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\tchildren,\n\tclassName,\n\ttoggleButtonProps,\n} ) => {\n\tconst toggleButton = (\n\t\t<ComplementaryAreaToggle icon={ closeSmall } { ...toggleButtonProps } />\n\t);\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'components-panel__header',\n\t\t\t\t'interface-complementary-area-header',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttabIndex={ -1 }\n\t\t>\n\t\t\t{ children }\n\t\t\t{ toggleButton }\n\t\t</div>\n\t);\n};\n\nexport default ComplementaryAreaHeader;\n"],
5
+ "mappings": "AAqBE,cAGA,YAHA;AAlBF,OAAO,UAAU;AAKjB,SAAS,kBAAkB;AAK3B,OAAO,6BAA6B;AAEpC,MAAM,0BAA0B,CAAE;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AACD,MAAO;AACN,QAAM,eACL,oBAAC,2BAAwB,MAAO,YAAe,GAAG,mBAAoB;AAEvE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,MACA,UAAW;AAAA,MAET;AAAA;AAAA,QACA;AAAA;AAAA;AAAA,EACH;AAEF;AAEA,IAAO,oCAAQ;",
6
+ "names": []
7
+ }