@inquirer/select 0.0.22-alpha.0 → 0.0.26-alpha.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/dist/index.d.ts +1 -4
- package/dist/index.js +8 -3
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,5 @@ declare type SelectConfig = AsyncPromptConfig & {
|
|
|
8
8
|
}[];
|
|
9
9
|
pageSize?: number;
|
|
10
10
|
};
|
|
11
|
-
declare const _default: (
|
|
12
|
-
input?: NodeJS.ReadableStream | undefined;
|
|
13
|
-
output?: NodeJS.WritableStream | undefined;
|
|
14
|
-
} | undefined) => Promise<string>;
|
|
11
|
+
declare const _default: import("@inquirer/core").Prompt<string, SelectConfig>;
|
|
15
12
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,12 @@ import chalk from 'chalk';
|
|
|
3
3
|
import figures from 'figures';
|
|
4
4
|
import ansiEscapes from 'ansi-escapes';
|
|
5
5
|
export default createPrompt((config, done) => {
|
|
6
|
-
const [status, setStatus] = useState('pending');
|
|
7
|
-
const [cursorPosition, setCursorPos] = useState(0);
|
|
8
6
|
const { choices, pageSize = 7 } = config;
|
|
9
7
|
const paginator = useRef(new Paginator()).current;
|
|
8
|
+
const firstRender = useRef(true);
|
|
10
9
|
const prefix = usePrefix();
|
|
10
|
+
const [status, setStatus] = useState('pending');
|
|
11
|
+
const [cursorPosition, setCursorPos] = useState(0);
|
|
11
12
|
useKeypress((key) => {
|
|
12
13
|
if (isEnterKey(key)) {
|
|
13
14
|
setStatus('done');
|
|
@@ -34,7 +35,11 @@ export default createPrompt((config, done) => {
|
|
|
34
35
|
setCursorPos(newCursorPosition);
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
|
-
|
|
38
|
+
let message = chalk.bold(config.message);
|
|
39
|
+
if (firstRender.current) {
|
|
40
|
+
message += chalk.dim(' (Use arrow keys)');
|
|
41
|
+
firstRender.current = false;
|
|
42
|
+
}
|
|
38
43
|
if (status === 'done') {
|
|
39
44
|
const choice = choices[cursorPosition];
|
|
40
45
|
return `${prefix} ${message} ${chalk.cyan(choice.name || choice.value)}`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/select",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.26-alpha.0",
|
|
5
5
|
"description": "Inquirer select/list prompt",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"typings": "dist/index.d.ts",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/select/README.md",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@inquirer/core": "^0.0.
|
|
22
|
+
"@inquirer/core": "^0.0.26-alpha.0",
|
|
23
23
|
"ansi-escapes": "^5.0.0",
|
|
24
24
|
"chalk": "^5.0.1",
|
|
25
|
-
"figures": "^
|
|
25
|
+
"figures": "^5.0.0"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"tsc": "tsc"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "6e0a7e28b5ac9fc526cf787e0b6c53cb44bd7ae3"
|
|
34
34
|
}
|