@wordpress/commands 1.32.0 → 1.32.1-next.b8c8708f3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/build/components/command-menu.js +261 -246
- package/build/components/command-menu.js.map +7 -1
- package/build/hooks/use-command-context.js +31 -35
- package/build/hooks/use-command-context.js.map +7 -1
- package/build/hooks/use-command-loader.js +35 -92
- package/build/hooks/use-command-loader.js.map +7 -1
- package/build/hooks/use-command.js +53 -90
- package/build/hooks/use-command.js.map +7 -1
- package/build/index.js +49 -45
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/private-apis.js +41 -19
- package/build/private-apis.js.map +7 -1
- package/build/store/actions.js +42 -92
- package/build/store/actions.js.map +7 -1
- package/build/store/index.js +47 -44
- package/build/store/index.js.map +7 -1
- package/build/store/private-actions.js +27 -14
- package/build/store/private-actions.js.map +7 -1
- package/build/store/reducer.js +39 -70
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +47 -54
- package/build/store/selectors.js.map +7 -1
- package/build-module/components/command-menu.js +232 -229
- package/build-module/components/command-menu.js.map +7 -1
- package/build-module/hooks/use-command-context.js +11 -28
- package/build-module/hooks/use-command-context.js.map +7 -1
- package/build-module/hooks/use-command-loader.js +17 -87
- package/build-module/hooks/use-command-loader.js.map +7 -1
- package/build-module/hooks/use-command.js +25 -79
- package/build-module/hooks/use-command.js.map +7 -1
- package/build-module/index.js +14 -6
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/private-apis.js +7 -11
- package/build-module/private-apis.js.map +7 -1
- package/build-module/store/actions.js +21 -88
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/index.js +12 -32
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/private-actions.js +6 -10
- package/build-module/store/private-actions.js.map +7 -1
- package/build-module/store/reducer.js +20 -64
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +24 -49
- package/build-module/store/selectors.js.map +7 -1
- package/build-style/style-rtl.css +7 -138
- package/build-style/style.css +7 -138
- package/package.json +18 -10
- package/src/components/command-menu.js +4 -1
- package/src/components/style.scss +10 -0
- package/src/hooks/use-command.js +2 -2
- 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,
|
|
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:
|
|
214
|
+
icon: pencil,
|
|
215
215
|
callback: ( { close } ) => {
|
|
216
216
|
document.location.href = 'edit.php';
|
|
217
217
|
close();
|
|
@@ -1,291 +1,306 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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,
|
|
66
|
-
|
|
65
|
+
className: (0, import_clsx.default)("commands-command-menu__item", {
|
|
66
|
+
"has-icon": command.icon
|
|
67
67
|
}),
|
|
68
|
-
children: [
|
|
69
|
-
icon: command.icon
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
84
|
-
|
|
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
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
value:
|
|
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:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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,
|
|
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
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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:
|
|
206
|
-
category:
|
|
207
|
-
description: (0,
|
|
197
|
+
name: "core/commands",
|
|
198
|
+
category: "global",
|
|
199
|
+
description: (0, import_i18n.__)("Open the command palette."),
|
|
208
200
|
keyCombination: {
|
|
209
|
-
modifier:
|
|
210
|
-
character:
|
|
201
|
+
modifier: "primary",
|
|
202
|
+
character: "k"
|
|
211
203
|
}
|
|
212
204
|
});
|
|
213
205
|
}, [registerShortcut]);
|
|
214
|
-
(0,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
children:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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
|
-
|
|
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
|