@wordpress/components 28.8.2 → 28.8.4

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 (28) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/guide/index.js +1 -0
  3. package/build/guide/index.js.map +1 -1
  4. package/build/navigator/navigator-provider/component.js +3 -4
  5. package/build/navigator/navigator-provider/component.js.map +1 -1
  6. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +3 -1
  7. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  8. package/build/tools-panel/tools-panel/hook.js +183 -109
  9. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  10. package/build-module/guide/index.js +1 -0
  11. package/build-module/guide/index.js.map +1 -1
  12. package/build-module/navigator/navigator-provider/component.js +3 -4
  13. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  14. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +3 -1
  15. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  16. package/build-module/tools-panel/tools-panel/hook.js +184 -110
  17. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  18. package/build-types/guide/index.d.ts.map +1 -1
  19. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  20. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  21. package/build-types/tools-panel/tools-panel/hook.d.ts +2 -2
  22. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  23. package/package.json +12 -12
  24. package/src/guide/index.tsx +1 -0
  25. package/src/navigator/navigator-provider/component.tsx +3 -2
  26. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +2 -0
  27. package/src/tools-panel/tools-panel/hook.ts +221 -163
  28. package/tsconfig.tsbuildinfo +1 -1
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useCallback, useEffect, useMemo, useRef, useState } from '@wordpress/element';
4
+ import { useCallback, useEffect, useMemo, useReducer, useRef } from '@wordpress/element';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -10,20 +10,27 @@ import * as styles from '../styles';
10
10
  import { useContextSystem } from '../../context';
11
11
  import { useCx } from '../../utils/hooks/use-cx';
12
12
  const DEFAULT_COLUMNS = 2;
13
+ function emptyMenuItems() {
14
+ return {
15
+ default: {},
16
+ optional: {}
17
+ };
18
+ }
19
+ function emptyState() {
20
+ return {
21
+ panelItems: [],
22
+ menuItemOrder: [],
23
+ menuItems: emptyMenuItems()
24
+ };
25
+ }
13
26
  const generateMenuItems = ({
14
27
  panelItems,
15
28
  shouldReset,
16
29
  currentMenuItems,
17
30
  menuItemOrder
18
31
  }) => {
19
- const newMenuItems = {
20
- default: {},
21
- optional: {}
22
- };
23
- const menuItems = {
24
- default: {},
25
- optional: {}
26
- };
32
+ const newMenuItems = emptyMenuItems();
33
+ const menuItems = emptyMenuItems();
27
34
  panelItems.forEach(({
28
35
  hasValue,
29
36
  isShownByDefault,
@@ -62,7 +69,128 @@ const generateMenuItems = ({
62
69
  });
63
70
  return menuItems;
64
71
  };
65
- const isMenuItemTypeEmpty = obj => obj && Object.keys(obj).length === 0;
72
+ function panelItemsReducer(panelItems, action) {
73
+ switch (action.type) {
74
+ case 'REGISTER_PANEL':
75
+ {
76
+ const newItems = [...panelItems];
77
+ // If an item with this label has already been registered, remove it
78
+ // first. This can happen when an item is moved between the default
79
+ // and optional groups.
80
+ const existingIndex = newItems.findIndex(oldItem => oldItem.label === action.item.label);
81
+ if (existingIndex !== -1) {
82
+ newItems.splice(existingIndex, 1);
83
+ }
84
+ newItems.push(action.item);
85
+ return newItems;
86
+ }
87
+ case 'UNREGISTER_PANEL':
88
+ {
89
+ const index = panelItems.findIndex(item => item.label === action.label);
90
+ if (index !== -1) {
91
+ const newItems = [...panelItems];
92
+ newItems.splice(index, 1);
93
+ return newItems;
94
+ }
95
+ return panelItems;
96
+ }
97
+ default:
98
+ return panelItems;
99
+ }
100
+ }
101
+ function menuItemOrderReducer(menuItemOrder, action) {
102
+ switch (action.type) {
103
+ case 'REGISTER_PANEL':
104
+ {
105
+ // Track the initial order of item registration. This is used for
106
+ // maintaining menu item order later.
107
+ if (menuItemOrder.includes(action.item.label)) {
108
+ return menuItemOrder;
109
+ }
110
+ return [...menuItemOrder, action.item.label];
111
+ }
112
+ default:
113
+ return menuItemOrder;
114
+ }
115
+ }
116
+ function menuItemsReducer(state, action) {
117
+ switch (action.type) {
118
+ case 'REGISTER_PANEL':
119
+ case 'UNREGISTER_PANEL':
120
+ // generate new menu items from original `menuItems` and updated `panelItems` and `menuItemOrder`
121
+ return generateMenuItems({
122
+ currentMenuItems: state.menuItems,
123
+ panelItems: state.panelItems,
124
+ menuItemOrder: state.menuItemOrder,
125
+ shouldReset: false
126
+ });
127
+ case 'RESET_ALL':
128
+ return generateMenuItems({
129
+ panelItems: state.panelItems,
130
+ menuItemOrder: state.menuItemOrder,
131
+ shouldReset: true
132
+ });
133
+ case 'UPDATE_VALUE':
134
+ {
135
+ const oldValue = state.menuItems[action.group][action.label];
136
+ if (action.value === oldValue) {
137
+ return state.menuItems;
138
+ }
139
+ return {
140
+ ...state.menuItems,
141
+ [action.group]: {
142
+ ...state.menuItems[action.group],
143
+ [action.label]: action.value
144
+ }
145
+ };
146
+ }
147
+ case 'TOGGLE_VALUE':
148
+ {
149
+ const currentItem = state.panelItems.find(item => item.label === action.label);
150
+ if (!currentItem) {
151
+ return state.menuItems;
152
+ }
153
+ const menuGroup = currentItem.isShownByDefault ? 'default' : 'optional';
154
+ const newMenuItems = {
155
+ ...state.menuItems,
156
+ [menuGroup]: {
157
+ ...state.menuItems[menuGroup],
158
+ [action.label]: !state.menuItems[menuGroup][action.label]
159
+ }
160
+ };
161
+ return newMenuItems;
162
+ }
163
+ default:
164
+ return state.menuItems;
165
+ }
166
+ }
167
+ function panelReducer(state, action) {
168
+ const panelItems = panelItemsReducer(state.panelItems, action);
169
+ const menuItemOrder = menuItemOrderReducer(state.menuItemOrder, action);
170
+ // `menuItemsReducer` is a bit unusual because it generates new state from original `menuItems`
171
+ // and the updated `panelItems` and `menuItemOrder`.
172
+ const menuItems = menuItemsReducer({
173
+ panelItems,
174
+ menuItemOrder,
175
+ menuItems: state.menuItems
176
+ }, action);
177
+ return {
178
+ panelItems,
179
+ menuItemOrder,
180
+ menuItems
181
+ };
182
+ }
183
+ function resetAllFiltersReducer(filters, action) {
184
+ switch (action.type) {
185
+ case 'REGISTER':
186
+ return [...filters, action.filter];
187
+ case 'UNREGISTER':
188
+ return filters.filter(f => f !== action.filter);
189
+ default:
190
+ return filters;
191
+ }
192
+ }
193
+ const isMenuItemTypeEmpty = obj => Object.keys(obj).length === 0;
66
194
  export function useToolsPanel(props) {
67
195
  const {
68
196
  className,
@@ -89,32 +217,18 @@ export function useToolsPanel(props) {
89
217
  }, [wasResetting]);
90
218
 
91
219
  // Allow panel items to register themselves.
92
- const [panelItems, setPanelItems] = useState([]);
93
- const [menuItemOrder, setMenuItemOrder] = useState([]);
94
- const [resetAllFilters, setResetAllFilters] = useState([]);
220
+ const [{
221
+ panelItems,
222
+ menuItems
223
+ }, panelDispatch] = useReducer(panelReducer, undefined, emptyState);
224
+ const [resetAllFilters, dispatchResetAllFilters] = useReducer(resetAllFiltersReducer, []);
95
225
  const registerPanelItem = useCallback(item => {
96
226
  // Add item to panel items.
97
- setPanelItems(items => {
98
- const newItems = [...items];
99
- // If an item with this label has already been registered, remove it
100
- // first. This can happen when an item is moved between the default
101
- // and optional groups.
102
- const existingIndex = newItems.findIndex(oldItem => oldItem.label === item.label);
103
- if (existingIndex !== -1) {
104
- newItems.splice(existingIndex, 1);
105
- }
106
- return [...newItems, item];
107
- });
108
-
109
- // Track the initial order of item registration. This is used for
110
- // maintaining menu item order later.
111
- setMenuItemOrder(items => {
112
- if (items.includes(item.label)) {
113
- return items;
114
- }
115
- return [...items, item.label];
227
+ panelDispatch({
228
+ type: 'REGISTER_PANEL',
229
+ item
116
230
  });
117
- }, [setPanelItems, setMenuItemOrder]);
231
+ }, []);
118
232
 
119
233
  // Panels need to deregister on unmount to avoid orphans in menu state.
120
234
  // This is an issue when panel items are being injected via SlotFills.
@@ -123,96 +237,58 @@ export function useToolsPanel(props) {
123
237
  // controls, e.g. both panels have a "padding" control, the
124
238
  // deregistration of the first panel doesn't occur until after the
125
239
  // registration of the next.
126
- setPanelItems(items => {
127
- const newItems = [...items];
128
- const index = newItems.findIndex(item => item.label === label);
129
- if (index !== -1) {
130
- newItems.splice(index, 1);
131
- }
132
- return newItems;
133
- });
134
- }, [setPanelItems]);
135
- const registerResetAllFilter = useCallback(newFilter => {
136
- setResetAllFilters(filters => {
137
- return [...filters, newFilter];
240
+ panelDispatch({
241
+ type: 'UNREGISTER_PANEL',
242
+ label
138
243
  });
139
- }, [setResetAllFilters]);
140
- const deregisterResetAllFilter = useCallback(filterToRemove => {
141
- setResetAllFilters(filters => {
142
- return filters.filter(filter => filter !== filterToRemove);
244
+ }, []);
245
+ const registerResetAllFilter = useCallback(filter => {
246
+ dispatchResetAllFilters({
247
+ type: 'REGISTER',
248
+ filter
143
249
  });
144
- }, [setResetAllFilters]);
145
-
146
- // Manage and share display state of menu items representing child controls.
147
- const [menuItems, setMenuItems] = useState({
148
- default: {},
149
- optional: {}
150
- });
151
-
152
- // Setup menuItems state as panel items register themselves.
153
- useEffect(() => {
154
- setMenuItems(prevState => {
155
- const items = generateMenuItems({
156
- panelItems,
157
- shouldReset: false,
158
- currentMenuItems: prevState,
159
- menuItemOrder
160
- });
161
- return items;
250
+ }, []);
251
+ const deregisterResetAllFilter = useCallback(filter => {
252
+ dispatchResetAllFilters({
253
+ type: 'UNREGISTER',
254
+ filter
162
255
  });
163
- }, [panelItems, setMenuItems, menuItemOrder]);
256
+ }, []);
164
257
 
165
258
  // Updates the status of the panel’s menu items. For default items the
166
259
  // value represents whether it differs from the default and for optional
167
260
  // items whether the item is shown.
168
261
  const flagItemCustomization = useCallback((value, label, group = 'default') => {
169
- setMenuItems(items => {
170
- const newState = {
171
- ...items,
172
- [group]: {
173
- ...items[group],
174
- [label]: value
175
- }
176
- };
177
- return newState;
262
+ panelDispatch({
263
+ type: 'UPDATE_VALUE',
264
+ group,
265
+ label,
266
+ value
178
267
  });
179
- }, [setMenuItems]);
268
+ }, []);
180
269
 
181
270
  // Whether all optional menu items are hidden or not must be tracked
182
271
  // in order to later determine if the panel display is empty and handle
183
272
  // conditional display of a plus icon to indicate the presence of further
184
273
  // menu items.
185
- const [areAllOptionalControlsHidden, setAreAllOptionalControlsHidden] = useState(false);
186
- useEffect(() => {
187
- if (isMenuItemTypeEmpty(menuItems?.default) && !isMenuItemTypeEmpty(menuItems?.optional)) {
188
- const allControlsHidden = !Object.entries(menuItems.optional).some(([, isSelected]) => isSelected);
189
- setAreAllOptionalControlsHidden(allControlsHidden);
190
- }
191
- }, [menuItems, setAreAllOptionalControlsHidden]);
274
+ const areAllOptionalControlsHidden = useMemo(() => {
275
+ return isMenuItemTypeEmpty(menuItems.default) && !isMenuItemTypeEmpty(menuItems.optional) && Object.values(menuItems.optional).every(isSelected => !isSelected);
276
+ }, [menuItems]);
192
277
  const cx = useCx();
193
278
  const classes = useMemo(() => {
194
279
  const wrapperStyle = hasInnerWrapper && styles.ToolsPanelWithInnerWrapper(DEFAULT_COLUMNS);
195
- const emptyStyle = isMenuItemTypeEmpty(menuItems?.default) && areAllOptionalControlsHidden && styles.ToolsPanelHiddenInnerWrapper;
280
+ const emptyStyle = areAllOptionalControlsHidden && styles.ToolsPanelHiddenInnerWrapper;
196
281
  return cx(styles.ToolsPanel(DEFAULT_COLUMNS), wrapperStyle, emptyStyle, className);
197
- }, [areAllOptionalControlsHidden, className, cx, hasInnerWrapper, menuItems]);
282
+ }, [areAllOptionalControlsHidden, className, cx, hasInnerWrapper]);
198
283
 
199
284
  // Toggle the checked state of a menu item which is then used to determine
200
285
  // display of the item within the panel.
201
286
  const toggleItem = useCallback(label => {
202
- const currentItem = panelItems.find(item => item.label === label);
203
- if (!currentItem) {
204
- return;
205
- }
206
- const menuGroup = currentItem.isShownByDefault ? 'default' : 'optional';
207
- const newMenuItems = {
208
- ...menuItems,
209
- [menuGroup]: {
210
- ...menuItems[menuGroup],
211
- [label]: !menuItems[menuGroup][label]
212
- }
213
- };
214
- setMenuItems(newMenuItems);
215
- }, [menuItems, panelItems, setMenuItems]);
287
+ panelDispatch({
288
+ type: 'TOGGLE_VALUE',
289
+ label
290
+ });
291
+ }, []);
216
292
 
217
293
  // Resets display of children and executes resetAll callback if available.
218
294
  const resetAllItems = useCallback(() => {
@@ -222,30 +298,28 @@ export function useToolsPanel(props) {
222
298
  }
223
299
 
224
300
  // Turn off display of all non-default items.
225
- const resetMenuItems = generateMenuItems({
226
- panelItems,
227
- menuItemOrder,
228
- shouldReset: true
301
+ panelDispatch({
302
+ type: 'RESET_ALL'
229
303
  });
230
- setMenuItems(resetMenuItems);
231
- }, [panelItems, resetAllFilters, resetAll, setMenuItems, menuItemOrder]);
304
+ }, [resetAllFilters, resetAll]);
232
305
 
233
306
  // Assist ItemGroup styling when there are potentially hidden placeholder
234
307
  // items by identifying first & last items that are toggled on for display.
235
308
  const getFirstVisibleItemLabel = items => {
236
309
  const optionalItems = menuItems.optional || {};
237
- const firstItem = items.find(item => item.isShownByDefault || !!optionalItems[item.label]);
310
+ const firstItem = items.find(item => item.isShownByDefault || optionalItems[item.label]);
238
311
  return firstItem?.label;
239
312
  };
240
313
  const firstDisplayedItem = getFirstVisibleItemLabel(panelItems);
241
314
  const lastDisplayedItem = getFirstVisibleItemLabel([...panelItems].reverse());
315
+ const hasMenuItems = panelItems.length > 0;
242
316
  const panelContext = useMemo(() => ({
243
317
  areAllOptionalControlsHidden,
244
318
  deregisterPanelItem,
245
319
  deregisterResetAllFilter,
246
320
  firstDisplayedItem,
247
321
  flagItemCustomization,
248
- hasMenuItems: !!panelItems.length,
322
+ hasMenuItems,
249
323
  isResetting: isResettingRef.current,
250
324
  lastDisplayedItem,
251
325
  menuItems,
@@ -255,7 +329,7 @@ export function useToolsPanel(props) {
255
329
  shouldRenderPlaceholderItems,
256
330
  __experimentalFirstVisibleItemClass,
257
331
  __experimentalLastVisibleItemClass
258
- }), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, lastDisplayedItem, menuItems, panelId, panelItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
332
+ }), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, lastDisplayedItem, menuItems, panelId, hasMenuItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
259
333
  return {
260
334
  ...otherProps,
261
335
  headingLevel,
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","styles","useContextSystem","useCx","DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItemOrder","newMenuItems","default","optional","menuItems","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","key","hasOwnProperty","Object","keys","isMenuItemTypeEmpty","obj","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResettingRef","wasResetting","current","setPanelItems","setMenuItemOrder","resetAllFilters","setResetAllFilters","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","includes","deregisterPanelItem","index","registerResetAllFilter","newFilter","filters","deregisterResetAllFilter","filterToRemove","filter","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","classes","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","resetAllItems","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems","isResetting"],"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n\tmenuItemOrder,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst newMenuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tnewMenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\t// Loop the known, previously registered items first to maintain menu order.\n\tmenuItemOrder.forEach( ( key ) => {\n\t\tif ( newMenuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\n\t\tif ( newMenuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\t// Loop newMenuItems object adding any that aren't in the known items order.\n\tObject.keys( newMenuItems.default ).forEach( ( key ) => {\n\t\tif ( ! menuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\t} );\n\n\tObject.keys( newMenuItems.optional ).forEach( ( key ) => {\n\t\tif ( ! menuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResettingRef = useRef( false );\n\tconst wasResetting = isResettingRef.current;\n\n\t// `isResettingRef` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResettingRef.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\tconst [ menuItemOrder, setMenuItemOrder ] = useState< string[] >( [] );\n\tconst [ resetAllFilters, setResetAllFilters ] = useState<\n\t\tResetAllFilter[]\n\t>( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\t// Add item to panel items.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\n\t\t\t// Track the initial order of item registration. This is used for\n\t\t\t// maintaining menu item order later.\n\t\t\tsetMenuItemOrder( ( items ) => {\n\t\t\t\tif ( items.includes( item.label ) ) {\n\t\t\t\t\treturn items;\n\t\t\t\t}\n\n\t\t\t\treturn [ ...items, item.label ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems, setMenuItemOrder ]\n\t);\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\tconst registerResetAllFilter = useCallback(\n\t\t( newFilter: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn [ ...filters, newFilter ];\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filterToRemove: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn filters.filter(\n\t\t\t\t\t( filter ) => filter !== filterToRemove\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t\tmenuItemOrder,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems, menuItemOrder ] );\n\n\t// Updates the status of the panel’s menu items. For default items the\n\t// value represents whether it differs from the default and for optional\n\t// items whether the item is shown.\n\tconst flagItemCustomization = useCallback(\n\t\t(\n\t\t\tvalue: boolean,\n\t\t\tlabel: string,\n\t\t\tgroup: ToolsPanelMenuItemKey = 'default'\n\t\t) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: value,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [ areAllOptionalControlsHidden, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\n\t);\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResettingRef.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tmenuItemOrder,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAllFilters, resetAll, setMenuItems, menuItemOrder ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || !! optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResettingRef.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\theadingLevel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACF,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,KAAKC,MAAM,MAAM,WAAW;AAEnC,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,KAAK,QAAQ,0BAA0B;AAUhD,MAAMC,eAAe,GAAG,CAAC;AAEzB,MAAMC,iBAAiB,GAAGA,CAAE;EAC3BC,UAAU;EACVC,WAAW;EACXC,gBAAgB;EAChBC;AAC0B,CAAC,KAAM;EACjC,MAAMC,YAAiC,GAAG;IAAEC,OAAO,EAAE,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;EAAE,CAAC;EACvE,MAAMC,SAA8B,GAAG;IAAEF,OAAO,EAAE,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;EAAE,CAAC;EAEpEN,UAAU,CAACQ,OAAO,CAAE,CAAE;IAAEC,QAAQ;IAAEC,gBAAgB;IAAEC;EAAM,CAAC,KAAM;IAChE,MAAMC,KAAK,GAAGF,gBAAgB,GAAG,SAAS,GAAG,UAAU;;IAEvD;IACA;IACA;IACA,MAAMG,iBAAiB,GAAGX,gBAAgB,GAAIU,KAAK,CAAE,GAAID,KAAK,CAAE;IAChE,MAAMG,KAAK,GAAGD,iBAAiB,GAAGA,iBAAiB,GAAGJ,QAAQ,CAAC,CAAC;IAEhEL,YAAY,CAAEQ,KAAK,CAAE,CAAED,KAAK,CAAE,GAAGV,WAAW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EAClBxB,qBAAqB,EACrByB,iBAAiB,EACjB7E,SAAS,EACToB,OAAO,EACP3B,UAAU,EACVmD,sBAAsB,EACtBX,iBAAiB,EACjBX,4BAA4B,EAC5BC,mCAAmC,EACnCC,kCAAkC,CAEpC,CAAC;EAED,OAAO;IACN,GAAGC,UAAU;IACbP,YAAY;IACZ6D,YAAY;IACZR,aAAa;IACbJ,UAAU;IACVlD,SAAS,EAAE4C;EACZ,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useEffect","useMemo","useReducer","useRef","styles","useContextSystem","useCx","DEFAULT_COLUMNS","emptyMenuItems","default","optional","emptyState","panelItems","menuItemOrder","menuItems","generateMenuItems","shouldReset","currentMenuItems","newMenuItems","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","key","hasOwnProperty","Object","keys","panelItemsReducer","action","type","newItems","existingIndex","findIndex","oldItem","item","splice","push","index","menuItemOrderReducer","includes","menuItemsReducer","state","oldValue","currentItem","find","menuGroup","panelReducer","resetAllFiltersReducer","filters","filter","f","isMenuItemTypeEmpty","obj","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResettingRef","wasResetting","current","panelDispatch","undefined","resetAllFilters","dispatchResetAllFilters","registerPanelItem","deregisterPanelItem","registerResetAllFilter","deregisterResetAllFilter","flagItemCustomization","areAllOptionalControlsHidden","values","every","isSelected","cx","classes","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","resetAllItems","getFirstVisibleItemLabel","items","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","hasMenuItems","panelContext","isResetting"],"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseReducer,\n\tuseRef,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\ntype PanelItemsState = {\n\tpanelItems: ToolsPanelItem[];\n\tmenuItemOrder: string[];\n\tmenuItems: ToolsPanelMenuItems;\n};\n\ntype PanelItemsAction =\n\t| { type: 'REGISTER_PANEL'; item: ToolsPanelItem }\n\t| { type: 'UNREGISTER_PANEL'; label: string }\n\t| {\n\t\t\ttype: 'UPDATE_VALUE';\n\t\t\tgroup: ToolsPanelMenuItemKey;\n\t\t\tlabel: string;\n\t\t\tvalue: boolean;\n\t }\n\t| { type: 'TOGGLE_VALUE'; label: string }\n\t| { type: 'RESET_ALL' };\n\nfunction emptyMenuItems(): ToolsPanelMenuItems {\n\treturn { default: {}, optional: {} };\n}\n\nfunction emptyState(): PanelItemsState {\n\treturn { panelItems: [], menuItemOrder: [], menuItems: emptyMenuItems() };\n}\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n\tmenuItemOrder,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst newMenuItems: ToolsPanelMenuItems = emptyMenuItems();\n\tconst menuItems: ToolsPanelMenuItems = emptyMenuItems();\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tnewMenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\t// Loop the known, previously registered items first to maintain menu order.\n\tmenuItemOrder.forEach( ( key ) => {\n\t\tif ( newMenuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\n\t\tif ( newMenuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\t// Loop newMenuItems object adding any that aren't in the known items order.\n\tObject.keys( newMenuItems.default ).forEach( ( key ) => {\n\t\tif ( ! menuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\t} );\n\n\tObject.keys( newMenuItems.optional ).forEach( ( key ) => {\n\t\tif ( ! menuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\treturn menuItems;\n};\n\nfunction panelItemsReducer(\n\tpanelItems: ToolsPanelItem[],\n\taction: PanelItemsAction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL': {\n\t\t\tconst newItems = [ ...panelItems ];\n\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t// and optional groups.\n\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t( oldItem ) => oldItem.label === action.item.label\n\t\t\t);\n\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t}\n\t\t\tnewItems.push( action.item );\n\t\t\treturn newItems;\n\t\t}\n\t\tcase 'UNREGISTER_PANEL': {\n\t\t\tconst index = panelItems.findIndex(\n\t\t\t\t( item ) => item.label === action.label\n\t\t\t);\n\t\t\tif ( index !== -1 ) {\n\t\t\t\tconst newItems = [ ...panelItems ];\n\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\treturn newItems;\n\t\t\t}\n\t\t\treturn panelItems;\n\t\t}\n\t\tdefault:\n\t\t\treturn panelItems;\n\t}\n}\n\nfunction menuItemOrderReducer(\n\tmenuItemOrder: string[],\n\taction: PanelItemsAction\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL': {\n\t\t\t// Track the initial order of item registration. This is used for\n\t\t\t// maintaining menu item order later.\n\t\t\tif ( menuItemOrder.includes( action.item.label ) ) {\n\t\t\t\treturn menuItemOrder;\n\t\t\t}\n\n\t\t\treturn [ ...menuItemOrder, action.item.label ];\n\t\t}\n\t\tdefault:\n\t\t\treturn menuItemOrder;\n\t}\n}\n\nfunction menuItemsReducer( state: PanelItemsState, action: PanelItemsAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_PANEL':\n\t\tcase 'UNREGISTER_PANEL':\n\t\t\t// generate new menu items from original `menuItems` and updated `panelItems` and `menuItemOrder`\n\t\t\treturn generateMenuItems( {\n\t\t\t\tcurrentMenuItems: state.menuItems,\n\t\t\t\tpanelItems: state.panelItems,\n\t\t\t\tmenuItemOrder: state.menuItemOrder,\n\t\t\t\tshouldReset: false,\n\t\t\t} );\n\t\tcase 'RESET_ALL':\n\t\t\treturn generateMenuItems( {\n\t\t\t\tpanelItems: state.panelItems,\n\t\t\t\tmenuItemOrder: state.menuItemOrder,\n\t\t\t\tshouldReset: true,\n\t\t\t} );\n\t\tcase 'UPDATE_VALUE': {\n\t\t\tconst oldValue = state.menuItems[ action.group ][ action.label ];\n\t\t\tif ( action.value === oldValue ) {\n\t\t\t\treturn state.menuItems;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...state.menuItems,\n\t\t\t\t[ action.group ]: {\n\t\t\t\t\t...state.menuItems[ action.group ],\n\t\t\t\t\t[ action.label ]: action.value,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tcase 'TOGGLE_VALUE': {\n\t\t\tconst currentItem = state.panelItems.find(\n\t\t\t\t( item ) => item.label === action.label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn state.menuItems;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...state.menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...state.menuItems[ menuGroup ],\n\t\t\t\t\t[ action.label ]:\n\t\t\t\t\t\t! state.menuItems[ menuGroup ][ action.label ],\n\t\t\t\t},\n\t\t\t};\n\t\t\treturn newMenuItems;\n\t\t}\n\n\t\tdefault:\n\t\t\treturn state.menuItems;\n\t}\n}\n\nfunction panelReducer( state: PanelItemsState, action: PanelItemsAction ) {\n\tconst panelItems = panelItemsReducer( state.panelItems, action );\n\tconst menuItemOrder = menuItemOrderReducer( state.menuItemOrder, action );\n\t// `menuItemsReducer` is a bit unusual because it generates new state from original `menuItems`\n\t// and the updated `panelItems` and `menuItemOrder`.\n\tconst menuItems = menuItemsReducer(\n\t\t{ panelItems, menuItemOrder, menuItems: state.menuItems },\n\t\taction\n\t);\n\n\treturn { panelItems, menuItemOrder, menuItems };\n}\n\nfunction resetAllFiltersReducer(\n\tfilters: ResetAllFilter[],\n\taction: { type: 'REGISTER' | 'UNREGISTER'; filter: ResetAllFilter }\n) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER':\n\t\t\treturn [ ...filters, action.filter ];\n\t\tcase 'UNREGISTER':\n\t\t\treturn filters.filter( ( f ) => f !== action.filter );\n\t\tdefault:\n\t\t\treturn filters;\n\t}\n}\n\nconst isMenuItemTypeEmpty = (\n\tobj: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResettingRef = useRef( false );\n\tconst wasResetting = isResettingRef.current;\n\n\t// `isResettingRef` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResettingRef.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ { panelItems, menuItems }, panelDispatch ] = useReducer(\n\t\tpanelReducer,\n\t\tundefined,\n\t\temptyState\n\t);\n\n\tconst [ resetAllFilters, dispatchResetAllFilters ] = useReducer(\n\t\tresetAllFiltersReducer,\n\t\t[]\n\t);\n\n\tconst registerPanelItem = useCallback( ( item: ToolsPanelItem ) => {\n\t\t// Add item to panel items.\n\t\tpanelDispatch( { type: 'REGISTER_PANEL', item } );\n\t}, [] );\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback( ( label: string ) => {\n\t\t// When switching selections between components injecting matching\n\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t// deregistration of the first panel doesn't occur until after the\n\t\t// registration of the next.\n\t\tpanelDispatch( { type: 'UNREGISTER_PANEL', label } );\n\t}, [] );\n\n\tconst registerResetAllFilter = useCallback( ( filter: ResetAllFilter ) => {\n\t\tdispatchResetAllFilters( { type: 'REGISTER', filter } );\n\t}, [] );\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filter: ResetAllFilter ) => {\n\t\t\tdispatchResetAllFilters( { type: 'UNREGISTER', filter } );\n\t\t},\n\t\t[]\n\t);\n\n\t// Updates the status of the panel’s menu items. For default items the\n\t// value represents whether it differs from the default and for optional\n\t// items whether the item is shown.\n\tconst flagItemCustomization = useCallback(\n\t\t(\n\t\t\tvalue: boolean,\n\t\t\tlabel: string,\n\t\t\tgroup: ToolsPanelMenuItemKey = 'default'\n\t\t) => {\n\t\t\tpanelDispatch( { type: 'UPDATE_VALUE', group, label, value } );\n\t\t},\n\t\t[]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst areAllOptionalControlsHidden = useMemo( () => {\n\t\treturn (\n\t\t\tisMenuItemTypeEmpty( menuItems.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems.optional ) &&\n\t\t\tObject.values( menuItems.optional ).every(\n\t\t\t\t( isSelected ) => ! isSelected\n\t\t\t)\n\t\t);\n\t}, [ menuItems ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tareAllOptionalControlsHidden && styles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [ areAllOptionalControlsHidden, className, cx, hasInnerWrapper ] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback( ( label: string ) => {\n\t\tpanelDispatch( { type: 'TOGGLE_VALUE', label } );\n\t}, [] );\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResettingRef.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tpanelDispatch( { type: 'RESET_ALL' } );\n\t}, [ resetAllFilters, resetAll ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst hasMenuItems = panelItems.length > 0;\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems,\n\t\t\tisResetting: isResettingRef.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\thasMenuItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\theadingLevel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":"AAAA;AACA;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,mCAAmC,EACnCC,kCAAkC,CAEpC,CAAC;EAED,OAAO;IACN,GAAGC,UAAU;IACbP,YAAY;IACZyC,YAAY;IACZT,aAAa;IACbD,UAAU;IACVhC,SAAS,EAAE0B;EACZ,CAAC;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guide/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,iBAAS,KAAK,CAAE,EACf,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,gBAAiC,EACjC,QAAQ,EACR,KAAU,GACV,EAAE,UAAU,sCAmHZ;AAED,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guide/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,iBAAS,KAAK,CAAE,EACf,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,gBAAiC,EACjC,QAAQ,EACR,KAAU,GACV,EAAE,UAAU,sCAoHZ;AAED,eAAe,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/navigator/navigator-provider/component.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACX,sBAAsB,EAMtB,MAAM,UAAU,CAAC;AAoQlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,iBAAiB,sHAG7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/navigator/navigator-provider/component.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACX,sBAAsB,EAMtB,MAAM,UAAU,CAAC;AAqQlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,iBAAiB,sHAG7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"as-radio-group.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control/as-radio-group.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACX,kCAAkC,EAElC,MAAM,UAAU,CAAC;AA6ElB,eAAO,MAAM,8BAA8B,uUAE1C,CAAC"}
1
+ {"version":3,"file":"as-radio-group.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control/as-radio-group.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACX,kCAAkC,EAElC,MAAM,UAAU,CAAC;AA8ElB,eAAO,MAAM,8BAA8B,uUAE1C,CAAC"}
@@ -5,7 +5,7 @@ export declare function useToolsPanel(props: WordPressComponentProps<ToolsPanelP
5
5
  panelContext: {
6
6
  areAllOptionalControlsHidden: boolean;
7
7
  deregisterPanelItem: (label: string) => void;
8
- deregisterResetAllFilter: (filterToRemove: ResetAllFilter) => void;
8
+ deregisterResetAllFilter: (filter: ResetAllFilter) => void;
9
9
  firstDisplayedItem: string | undefined;
10
10
  flagItemCustomization: (value: boolean, label: string, group?: ToolsPanelMenuItemKey) => void;
11
11
  hasMenuItems: boolean;
@@ -14,7 +14,7 @@ export declare function useToolsPanel(props: WordPressComponentProps<ToolsPanelP
14
14
  menuItems: ToolsPanelMenuItems;
15
15
  panelId: string | null | undefined;
16
16
  registerPanelItem: (item: ToolsPanelItem) => void;
17
- registerResetAllFilter: (newFilter: ResetAllFilter) => void;
17
+ registerResetAllFilter: (filter: ResetAllFilter) => void;
18
18
  shouldRenderPlaceholderItems: boolean;
19
19
  __experimentalFirstVisibleItemClass: string | undefined;
20
20
  __experimentalLastVisibleItemClass: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/tools-panel/tools-panel/hook.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EACX,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EAEnB,eAAe,EACf,cAAc,EACd,MAAM,UAAU,CAAC;AAwDlB,wBAAgB,aAAa,CAC5B,KAAK,EAAE,uBAAuB,CAAE,eAAe,EAAE,KAAK,CAAE;;;;qCAmE9C,MAAM;mDA6BG,cAAc;;uCAkCxB,OAAO,SACP,MAAM,UACN,qBAAqB;;;;;;kCAjGrB,cAAc;4CAoDT,cAAc;;;;;;wBA2GlB,MAAM;;;wBA3PD,MAEb,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+VhB"}
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/tools-panel/tools-panel/hook.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EACX,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EAEnB,eAAe,EACf,cAAc,EACd,MAAM,UAAU,CAAC;AA8NlB,wBAAgB,aAAa,CAC5B,KAAK,EAAE,uBAAuB,CAAE,eAAe,EAAE,KAAK,CAAE;;;;qCA8CN,MAAM;2CAa7C,cAAc;;uCAWhB,OAAO,SACP,MAAM,UACN,qBAAqB;;;;;;kCAjCiB,cAAc;yCAeP,cAAc;;;;;;wBAyD3B,MAAM;;;wBA9UlC,MAEb,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyZd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "28.8.2",
3
+ "version": "28.8.4",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -43,22 +43,22 @@
43
43
  "@types/gradient-parser": "0.1.3",
44
44
  "@types/highlight-words-core": "1.2.1",
45
45
  "@use-gesture/react": "^10.3.1",
46
- "@wordpress/a11y": "^4.8.1",
47
- "@wordpress/compose": "^7.8.2",
48
- "@wordpress/date": "^5.8.1",
49
- "@wordpress/deprecated": "^4.8.1",
50
- "@wordpress/dom": "^4.8.1",
46
+ "@wordpress/a11y": "^4.8.2",
47
+ "@wordpress/compose": "^7.8.3",
48
+ "@wordpress/date": "^5.8.2",
49
+ "@wordpress/deprecated": "^4.8.2",
50
+ "@wordpress/dom": "^4.8.2",
51
51
  "@wordpress/element": "^6.8.1",
52
52
  "@wordpress/escape-html": "^3.8.1",
53
- "@wordpress/hooks": "^4.8.1",
53
+ "@wordpress/hooks": "^4.8.2",
54
54
  "@wordpress/html-entities": "^4.8.1",
55
- "@wordpress/i18n": "^5.8.1",
56
- "@wordpress/icons": "^10.8.1",
55
+ "@wordpress/i18n": "^5.8.2",
56
+ "@wordpress/icons": "^10.8.2",
57
57
  "@wordpress/is-shallow-equal": "^5.8.1",
58
- "@wordpress/keycodes": "^4.8.1",
58
+ "@wordpress/keycodes": "^4.8.2",
59
59
  "@wordpress/primitives": "^4.8.1",
60
60
  "@wordpress/private-apis": "^1.8.1",
61
- "@wordpress/rich-text": "^7.8.2",
61
+ "@wordpress/rich-text": "^7.8.3",
62
62
  "@wordpress/warning": "^3.8.1",
63
63
  "change-case": "^4.1.2",
64
64
  "clsx": "^2.1.1",
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "51204ac9382d0551d8fdebd3c8d4623dabfa9f3c"
87
+ "gitHead": "07c75154341d1e5a1b8aaa1c226029b6666a52a9"
88
88
  }
@@ -164,6 +164,7 @@ function Guide( {
164
164
  className="components-guide__finish-button"
165
165
  variant="primary"
166
166
  onClick={ onFinish }
167
+ __next40pxDefaultSize
167
168
  >
168
169
  { finishButtonText }
169
170
  </Button>
@@ -66,7 +66,7 @@ function goTo(
66
66
  options: NavigateOptions = {}
67
67
  ) {
68
68
  const { focusSelectors } = state;
69
- const currentLocation = { ...state.currentLocation, isInitial: false };
69
+ const currentLocation = { ...state.currentLocation };
70
70
 
71
71
  const {
72
72
  // Default assignments
@@ -114,6 +114,7 @@ function goTo(
114
114
  return {
115
115
  currentLocation: {
116
116
  ...restOptions,
117
+ isInitial: false,
117
118
  path,
118
119
  isBack,
119
120
  hasRestoredFocus: false,
@@ -129,7 +130,7 @@ function goToParent(
129
130
  options: NavigateToParentOptions = {}
130
131
  ) {
131
132
  const { screens, focusSelectors } = state;
132
- const currentLocation = { ...state.currentLocation, isInitial: false };
133
+ const currentLocation = { ...state.currentLocation };
133
134
  const currentPath = currentLocation.path;
134
135
  if ( currentPath === undefined ) {
135
136
  return { currentLocation, focusSelectors };
@@ -10,6 +10,7 @@ import { useStoreState } from '@ariakit/react';
10
10
  */
11
11
  import { useInstanceId } from '@wordpress/compose';
12
12
  import { forwardRef, useMemo } from '@wordpress/element';
13
+ import { isRTL } from '@wordpress/i18n';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
@@ -65,6 +66,7 @@ function UnforwardedToggleGroupControlAsRadioGroup(
65
66
  defaultValue,
66
67
  value,
67
68
  setValue: wrappedOnChangeProp,
69
+ rtl: isRTL(),
68
70
  } );
69
71
 
70
72
  const selectedValue = useStoreState( radio, 'value' );