@wordpress/commands 1.32.0 → 1.32.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 (56) hide show
  1. package/README.md +2 -2
  2. package/build/components/command-menu.js +261 -246
  3. package/build/components/command-menu.js.map +7 -1
  4. package/build/hooks/use-command-context.js +31 -35
  5. package/build/hooks/use-command-context.js.map +7 -1
  6. package/build/hooks/use-command-loader.js +35 -92
  7. package/build/hooks/use-command-loader.js.map +7 -1
  8. package/build/hooks/use-command.js +53 -90
  9. package/build/hooks/use-command.js.map +7 -1
  10. package/build/index.js +49 -45
  11. package/build/index.js.map +7 -1
  12. package/build/lock-unlock.js +31 -15
  13. package/build/lock-unlock.js.map +7 -1
  14. package/build/private-apis.js +41 -19
  15. package/build/private-apis.js.map +7 -1
  16. package/build/store/actions.js +42 -92
  17. package/build/store/actions.js.map +7 -1
  18. package/build/store/index.js +47 -44
  19. package/build/store/index.js.map +7 -1
  20. package/build/store/private-actions.js +27 -14
  21. package/build/store/private-actions.js.map +7 -1
  22. package/build/store/reducer.js +39 -70
  23. package/build/store/reducer.js.map +7 -1
  24. package/build/store/selectors.js +47 -54
  25. package/build/store/selectors.js.map +7 -1
  26. package/build-module/components/command-menu.js +232 -229
  27. package/build-module/components/command-menu.js.map +7 -1
  28. package/build-module/hooks/use-command-context.js +11 -28
  29. package/build-module/hooks/use-command-context.js.map +7 -1
  30. package/build-module/hooks/use-command-loader.js +17 -87
  31. package/build-module/hooks/use-command-loader.js.map +7 -1
  32. package/build-module/hooks/use-command.js +25 -79
  33. package/build-module/hooks/use-command.js.map +7 -1
  34. package/build-module/index.js +14 -6
  35. package/build-module/index.js.map +7 -1
  36. package/build-module/lock-unlock.js +8 -7
  37. package/build-module/lock-unlock.js.map +7 -1
  38. package/build-module/private-apis.js +7 -11
  39. package/build-module/private-apis.js.map +7 -1
  40. package/build-module/store/actions.js +21 -88
  41. package/build-module/store/actions.js.map +7 -1
  42. package/build-module/store/index.js +12 -32
  43. package/build-module/store/index.js.map +7 -1
  44. package/build-module/store/private-actions.js +6 -10
  45. package/build-module/store/private-actions.js.map +7 -1
  46. package/build-module/store/reducer.js +20 -64
  47. package/build-module/store/reducer.js.map +7 -1
  48. package/build-module/store/selectors.js +24 -49
  49. package/build-module/store/selectors.js.map +7 -1
  50. package/build-style/style-rtl.css +7 -138
  51. package/build-style/style.css +7 -138
  52. package/package.json +18 -10
  53. package/src/components/command-menu.js +4 -1
  54. package/src/components/style.scss +10 -0
  55. package/src/hooks/use-command.js +2 -2
  56. package/src/style.scss +2 -1
package/README.md CHANGED
@@ -196,7 +196,7 @@ _Usage_
196
196
 
197
197
  ```js
198
198
  import { useCommands } from '@wordpress/commands';
199
- import { plus, edit } from '@wordpress/icons';
199
+ import { plus, pencil } from '@wordpress/icons';
200
200
 
201
201
  useCommands( [
202
202
  {
@@ -211,7 +211,7 @@ useCommands( [
211
211
  {
212
212
  name: 'myplugin/edit-posts',
213
213
  label: __( 'Edit posts' ),
214
- icon: edit,
214
+ icon: pencil,
215
215
  callback: ( { close } ) => {
216
216
  document.location.href = 'edit.php';
217
217
  close();
@@ -1,291 +1,306 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var command_menu_exports = {};
29
+ __export(command_menu_exports, {
30
+ CommandMenu: () => CommandMenu,
31
+ CommandMenuGroup: () => CommandMenuGroup,
32
+ CommandMenuLoaderWrapper: () => CommandMenuLoaderWrapper
6
33
  });
7
- exports.CommandMenu = CommandMenu;
8
- exports.CommandMenuGroup = CommandMenuGroup;
9
- exports.CommandMenuLoaderWrapper = CommandMenuLoaderWrapper;
10
- var _cmdk = require("cmdk");
11
- var _clsx = _interopRequireDefault(require("clsx"));
12
- var _data = require("@wordpress/data");
13
- var _element = require("@wordpress/element");
14
- var _i18n = require("@wordpress/i18n");
15
- var _components = require("@wordpress/components");
16
- var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
17
- var _icons = require("@wordpress/icons");
18
- var _store = require("../store");
19
- var _jsxRuntime = require("react/jsx-runtime");
20
- /**
21
- * External dependencies
22
- */
23
-
24
- /**
25
- * WordPress dependencies
26
- */
27
-
28
- /**
29
- * Internal dependencies
30
- */
31
-
32
- const inputLabel = (0, _i18n.__)('Search commands and settings');
33
- function CommandMenuLoader({
34
- name,
35
- search,
36
- hook,
37
- setLoader,
38
- close
39
- }) {
40
- var _hook;
41
- const {
42
- isLoading,
43
- commands = []
44
- } = (_hook = hook({
45
- search
46
- })) !== null && _hook !== void 0 ? _hook : {};
47
- (0, _element.useEffect)(() => {
34
+ module.exports = __toCommonJS(command_menu_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_cmdk = require("cmdk");
37
+ var import_clsx = __toESM(require("clsx"));
38
+ var import_data = require("@wordpress/data");
39
+ var import_element = require("@wordpress/element");
40
+ var import_i18n = require("@wordpress/i18n");
41
+ var import_components = require("@wordpress/components");
42
+ var import_keyboard_shortcuts = require("@wordpress/keyboard-shortcuts");
43
+ var import_icons = require("@wordpress/icons");
44
+ var import_store = require("../store");
45
+ const inputLabel = (0, import_i18n.__)("Search commands and settings");
46
+ function CommandMenuLoader({ name, search, hook, setLoader, close }) {
47
+ const { isLoading, commands = [] } = hook({ search }) ?? {};
48
+ (0, import_element.useEffect)(() => {
48
49
  setLoader(name, isLoading);
49
50
  }, [setLoader, name, isLoading]);
50
51
  if (!commands.length) {
51
52
  return null;
52
53
  }
53
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
54
- children: commands.map(command => {
55
- var _command$searchLabel;
56
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_cmdk.Command.Item, {
57
- value: (_command$searchLabel = command.searchLabel) !== null && _command$searchLabel !== void 0 ? _command$searchLabel : command.label,
58
- keywords: command.keywords,
59
- onSelect: () => command.callback({
60
- close
61
- }),
62
- id: command.name,
63
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: commands.map((command) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
55
+ import_cmdk.Command.Item,
56
+ {
57
+ value: command.searchLabel ?? command.label,
58
+ keywords: command.keywords,
59
+ onSelect: () => command.callback({ close }),
60
+ id: command.name,
61
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
62
+ import_components.__experimentalHStack,
63
+ {
64
64
  alignment: "left",
65
- className: (0, _clsx.default)('commands-command-menu__item', {
66
- 'has-icon': command.icon
65
+ className: (0, import_clsx.default)("commands-command-menu__item", {
66
+ "has-icon": command.icon
67
67
  }),
68
- children: [command.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
69
- icon: command.icon
70
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
71
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextHighlight, {
72
- text: command.label,
73
- highlight: search
74
- })
75
- })]
76
- })
77
- }, command.name);
78
- })
79
- });
68
+ children: [
69
+ command.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, { icon: command.icon }),
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
+ import_components.TextHighlight,
72
+ {
73
+ text: command.label,
74
+ highlight: search
75
+ }
76
+ ) })
77
+ ]
78
+ }
79
+ )
80
+ },
81
+ command.name
82
+ )) });
80
83
  }
81
- function CommandMenuLoaderWrapper({
82
- hook,
83
- search,
84
- setLoader,
85
- close
86
- }) {
87
- // The "hook" prop is actually a custom React hook
88
- // so to avoid breaking the rules of hooks
89
- // the CommandMenuLoaderWrapper component need to be
90
- // remounted on each hook prop change
91
- // We use the key state to make sure we do that properly.
92
- const currentLoaderRef = (0, _element.useRef)(hook);
93
- const [key, setKey] = (0, _element.useState)(0);
94
- (0, _element.useEffect)(() => {
84
+ function CommandMenuLoaderWrapper({ hook, search, setLoader, close }) {
85
+ const currentLoaderRef = (0, import_element.useRef)(hook);
86
+ const [key, setKey] = (0, import_element.useState)(0);
87
+ (0, import_element.useEffect)(() => {
95
88
  if (currentLoaderRef.current !== hook) {
96
89
  currentLoaderRef.current = hook;
97
- setKey(prevKey => prevKey + 1);
90
+ setKey((prevKey) => prevKey + 1);
98
91
  }
99
92
  }, [hook]);
100
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(CommandMenuLoader, {
101
- hook: currentLoaderRef.current,
102
- search: search,
103
- setLoader: setLoader,
104
- close: close
105
- }, key);
93
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
94
+ CommandMenuLoader,
95
+ {
96
+ hook: currentLoaderRef.current,
97
+ search,
98
+ setLoader,
99
+ close
100
+ },
101
+ key
102
+ );
106
103
  }
107
- function CommandMenuGroup({
108
- isContextual,
109
- search,
110
- setLoader,
111
- close
112
- }) {
113
- const {
114
- commands,
115
- loaders
116
- } = (0, _data.useSelect)(select => {
117
- const {
118
- getCommands,
119
- getCommandLoaders
120
- } = select(_store.store);
121
- return {
122
- commands: getCommands(isContextual),
123
- loaders: getCommandLoaders(isContextual)
124
- };
125
- }, [isContextual]);
104
+ function CommandMenuGroup({ isContextual, search, setLoader, close }) {
105
+ const { commands, loaders } = (0, import_data.useSelect)(
106
+ (select) => {
107
+ const { getCommands, getCommandLoaders } = select(import_store.store);
108
+ return {
109
+ commands: getCommands(isContextual),
110
+ loaders: getCommandLoaders(isContextual)
111
+ };
112
+ },
113
+ [isContextual]
114
+ );
126
115
  if (!commands.length && !loaders.length) {
127
116
  return null;
128
117
  }
129
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_cmdk.Command.Group, {
130
- children: [commands.map(command => {
131
- var _command$searchLabel2;
132
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_cmdk.Command.Item, {
133
- value: (_command$searchLabel2 = command.searchLabel) !== null && _command$searchLabel2 !== void 0 ? _command$searchLabel2 : command.label,
118
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_cmdk.Command.Group, { children: [
119
+ commands.map((command) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
120
+ import_cmdk.Command.Item,
121
+ {
122
+ value: command.searchLabel ?? command.label,
134
123
  keywords: command.keywords,
135
- onSelect: () => command.callback({
136
- close
137
- }),
124
+ onSelect: () => command.callback({ close }),
138
125
  id: command.name,
139
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
140
- alignment: "left",
141
- className: (0, _clsx.default)('commands-command-menu__item', {
142
- 'has-icon': command.icon
143
- }),
144
- children: [command.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
145
- icon: command.icon
146
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
147
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextHighlight, {
148
- text: command.label,
149
- highlight: search
150
- })
151
- })]
152
- })
153
- }, command.name);
154
- }), loaders.map(loader => /*#__PURE__*/(0, _jsxRuntime.jsx)(CommandMenuLoaderWrapper, {
155
- hook: loader.hook,
156
- search: search,
157
- setLoader: setLoader,
158
- close: close
159
- }, loader.name))]
160
- });
126
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
127
+ import_components.__experimentalHStack,
128
+ {
129
+ alignment: "left",
130
+ className: (0, import_clsx.default)("commands-command-menu__item", {
131
+ "has-icon": command.icon
132
+ }),
133
+ children: [
134
+ command.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, { icon: command.icon }),
135
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
136
+ import_components.TextHighlight,
137
+ {
138
+ text: command.label,
139
+ highlight: search
140
+ }
141
+ ) })
142
+ ]
143
+ }
144
+ )
145
+ },
146
+ command.name
147
+ )),
148
+ loaders.map((loader) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
149
+ CommandMenuLoaderWrapper,
150
+ {
151
+ hook: loader.hook,
152
+ search,
153
+ setLoader,
154
+ close
155
+ },
156
+ loader.name
157
+ ))
158
+ ] });
161
159
  }
162
- function CommandInput({
163
- isOpen,
164
- search,
165
- setSearch
166
- }) {
167
- const commandMenuInput = (0, _element.useRef)();
168
- const _value = (0, _cmdk.useCommandState)(state => state.value);
169
- const selectedItemId = (0, _element.useMemo)(() => {
170
- const item = document.querySelector(`[cmdk-item=""][data-value="${_value}"]`);
171
- return item?.getAttribute('id');
160
+ function CommandInput({ isOpen, search, setSearch }) {
161
+ const commandMenuInput = (0, import_element.useRef)();
162
+ const _value = (0, import_cmdk.useCommandState)((state) => state.value);
163
+ const selectedItemId = (0, import_element.useMemo)(() => {
164
+ const item = document.querySelector(
165
+ `[cmdk-item=""][data-value="${_value}"]`
166
+ );
167
+ return item?.getAttribute("id");
172
168
  }, [_value]);
173
- (0, _element.useEffect)(() => {
174
- // Focus the command palette input when mounting the modal.
169
+ (0, import_element.useEffect)(() => {
175
170
  if (isOpen) {
176
171
  commandMenuInput.current.focus();
177
172
  }
178
173
  }, [isOpen]);
179
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_cmdk.Command.Input, {
180
- ref: commandMenuInput,
181
- value: search,
182
- onValueChange: setSearch,
183
- placeholder: inputLabel,
184
- "aria-activedescendant": selectedItemId,
185
- icon: search
186
- });
174
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
175
+ import_cmdk.Command.Input,
176
+ {
177
+ ref: commandMenuInput,
178
+ value: search,
179
+ onValueChange: setSearch,
180
+ placeholder: inputLabel,
181
+ "aria-activedescendant": selectedItemId,
182
+ icon: search
183
+ }
184
+ );
187
185
  }
188
-
189
- /**
190
- * @ignore
191
- */
192
186
  function CommandMenu() {
193
- const {
194
- registerShortcut
195
- } = (0, _data.useDispatch)(_keyboardShortcuts.store);
196
- const [search, setSearch] = (0, _element.useState)('');
197
- const isOpen = (0, _data.useSelect)(select => select(_store.store).isOpen(), []);
198
- const {
199
- open,
200
- close
201
- } = (0, _data.useDispatch)(_store.store);
202
- const [loaders, setLoaders] = (0, _element.useState)({});
203
- (0, _element.useEffect)(() => {
187
+ const { registerShortcut } = (0, import_data.useDispatch)(import_keyboard_shortcuts.store);
188
+ const [search, setSearch] = (0, import_element.useState)("");
189
+ const isOpen = (0, import_data.useSelect)(
190
+ (select) => select(import_store.store).isOpen(),
191
+ []
192
+ );
193
+ const { open, close } = (0, import_data.useDispatch)(import_store.store);
194
+ const [loaders, setLoaders] = (0, import_element.useState)({});
195
+ (0, import_element.useEffect)(() => {
204
196
  registerShortcut({
205
- name: 'core/commands',
206
- category: 'global',
207
- description: (0, _i18n.__)('Open the command palette.'),
197
+ name: "core/commands",
198
+ category: "global",
199
+ description: (0, import_i18n.__)("Open the command palette."),
208
200
  keyCombination: {
209
- modifier: 'primary',
210
- character: 'k'
201
+ modifier: "primary",
202
+ character: "k"
211
203
  }
212
204
  });
213
205
  }, [registerShortcut]);
214
- (0, _keyboardShortcuts.useShortcut)('core/commands', /** @type {import('react').KeyboardEventHandler} */
215
- event => {
216
- // Bails to avoid obscuring the effect of the preceding handler(s).
217
- if (event.defaultPrevented) {
218
- return;
219
- }
220
- event.preventDefault();
221
- if (isOpen) {
222
- close();
223
- } else {
224
- open();
206
+ (0, import_keyboard_shortcuts.useShortcut)(
207
+ "core/commands",
208
+ /** @type {import('react').KeyboardEventHandler} */
209
+ (event) => {
210
+ if (event.defaultPrevented) {
211
+ return;
212
+ }
213
+ event.preventDefault();
214
+ if (isOpen) {
215
+ close();
216
+ } else {
217
+ open();
218
+ }
219
+ },
220
+ {
221
+ bindGlobal: true
225
222
  }
226
- }, {
227
- bindGlobal: true
228
- });
229
- const setLoader = (0, _element.useCallback)((name, value) => setLoaders(current => ({
230
- ...current,
231
- [name]: value
232
- })), []);
223
+ );
224
+ const setLoader = (0, import_element.useCallback)(
225
+ (name, value) => setLoaders((current) => ({
226
+ ...current,
227
+ [name]: value
228
+ })),
229
+ []
230
+ );
233
231
  const closeAndReset = () => {
234
- setSearch('');
232
+ setSearch("");
235
233
  close();
236
234
  };
237
235
  if (!isOpen) {
238
236
  return false;
239
237
  }
240
- const onKeyDown = event => {
238
+ const onKeyDown = (event) => {
241
239
  if (
242
- // Ignore keydowns from IMEs
243
- event.nativeEvent.isComposing ||
244
- // Workaround for Mac Safari where the final Enter/Backspace of an IME composition
245
- // is `isComposing=false`, even though it's technically still part of the composition.
246
- // These can only be detected by keyCode.
247
- event.keyCode === 229) {
240
+ // Ignore keydowns from IMEs
241
+ event.nativeEvent.isComposing || // Workaround for Mac Safari where the final Enter/Backspace of an IME composition
242
+ // is `isComposing=false`, even though it's technically still part of the composition.
243
+ // These can only be detected by keyCode.
244
+ event.keyCode === 229
245
+ ) {
248
246
  event.preventDefault();
249
247
  }
250
248
  };
251
249
  const isLoading = Object.values(loaders).some(Boolean);
252
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
253
- className: "commands-command-menu",
254
- overlayClassName: "commands-command-menu__overlay",
255
- onRequestClose: closeAndReset,
256
- __experimentalHideHeader: true,
257
- contentLabel: (0, _i18n.__)('Command palette'),
258
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
259
- className: "commands-command-menu__container",
260
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_cmdk.Command, {
261
- label: inputLabel,
262
- onKeyDown: onKeyDown,
263
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
264
- className: "commands-command-menu__header",
265
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CommandInput, {
266
- search: search,
267
- setSearch: setSearch,
268
- isOpen: isOpen
269
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
270
- icon: _icons.search
271
- })]
272
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_cmdk.Command.List, {
273
- label: (0, _i18n.__)('Command suggestions'),
274
- children: [search && !isLoading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_cmdk.Command.Empty, {
275
- children: (0, _i18n.__)('No results found.')
276
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(CommandMenuGroup, {
277
- search: search,
278
- setLoader: setLoader,
279
- close: closeAndReset,
280
- isContextual: true
281
- }), search && /*#__PURE__*/(0, _jsxRuntime.jsx)(CommandMenuGroup, {
282
- search: search,
283
- setLoader: setLoader,
284
- close: closeAndReset
285
- })]
286
- })]
287
- })
288
- })
289
- });
250
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
251
+ import_components.Modal,
252
+ {
253
+ className: "commands-command-menu",
254
+ overlayClassName: "commands-command-menu__overlay",
255
+ onRequestClose: closeAndReset,
256
+ __experimentalHideHeader: true,
257
+ contentLabel: (0, import_i18n.__)("Command palette"),
258
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "commands-command-menu__container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_cmdk.Command, { label: inputLabel, onKeyDown, children: [
259
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "commands-command-menu__header", children: [
260
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
261
+ import_icons.Icon,
262
+ {
263
+ className: "commands-command-menu__header-search-icon",
264
+ icon: import_icons.search
265
+ }
266
+ ),
267
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
268
+ CommandInput,
269
+ {
270
+ search,
271
+ setSearch,
272
+ isOpen
273
+ }
274
+ )
275
+ ] }),
276
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_cmdk.Command.List, { label: (0, import_i18n.__)("Command suggestions"), children: [
277
+ search && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_cmdk.Command.Empty, { children: (0, import_i18n.__)("No results found.") }),
278
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
279
+ CommandMenuGroup,
280
+ {
281
+ search,
282
+ setLoader,
283
+ close: closeAndReset,
284
+ isContextual: true
285
+ }
286
+ ),
287
+ search && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
288
+ CommandMenuGroup,
289
+ {
290
+ search,
291
+ setLoader,
292
+ close: closeAndReset
293
+ }
294
+ )
295
+ ] })
296
+ ] }) })
297
+ }
298
+ );
290
299
  }
291
- //# sourceMappingURL=command-menu.js.map
300
+ // Annotate the CommonJS export names for ESM import in node:
301
+ 0 && (module.exports = {
302
+ CommandMenu,
303
+ CommandMenuGroup,
304
+ CommandMenuLoaderWrapper
305
+ });
306
+ //# sourceMappingURL=command-menu.js.map