@inquirer/select 1.2.3 → 1.2.5
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/cjs/index.js
CHANGED
|
@@ -14,7 +14,6 @@ function isSelectableChoice(choice) {
|
|
|
14
14
|
}
|
|
15
15
|
exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
16
16
|
const { choices } = config;
|
|
17
|
-
const paginator = (0, core_1.useRef)(new core_1.Paginator()).current;
|
|
18
17
|
const firstRender = (0, core_1.useRef)(true);
|
|
19
18
|
const prefix = (0, core_1.usePrefix)();
|
|
20
19
|
const [status, setStatus] = (0, core_1.useState)('pending');
|
|
@@ -58,9 +57,6 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
|
58
57
|
message += chalk_1.default.dim(' (Use arrow keys)');
|
|
59
58
|
firstRender.current = false;
|
|
60
59
|
}
|
|
61
|
-
if (status === 'done') {
|
|
62
|
-
return `${prefix} ${message} ${chalk_1.default.cyan(choice.name || choice.value)}`;
|
|
63
|
-
}
|
|
64
60
|
const allChoices = choices
|
|
65
61
|
.map((choice, index) => {
|
|
66
62
|
if (core_1.Separator.isSeparator(choice)) {
|
|
@@ -77,7 +73,13 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
|
77
73
|
return ` ${line}`;
|
|
78
74
|
})
|
|
79
75
|
.join('\n');
|
|
80
|
-
const windowedChoices =
|
|
76
|
+
const windowedChoices = (0, core_1.usePagination)(allChoices, {
|
|
77
|
+
active: cursorPosition,
|
|
78
|
+
pageSize: config.pageSize,
|
|
79
|
+
});
|
|
80
|
+
if (status === 'done') {
|
|
81
|
+
return `${prefix} ${message} ${chalk_1.default.cyan(choice.name || choice.value)}`;
|
|
82
|
+
}
|
|
81
83
|
const choiceDescription = choice.description ? `\n${choice.description}` : ``;
|
|
82
84
|
return `${prefix} ${message}\n${windowedChoices}${choiceDescription}${ansi_escapes_1.default.cursorHide}`;
|
|
83
85
|
});
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPrompt, useState, useKeypress,
|
|
1
|
+
import { createPrompt, useState, useKeypress, usePrefix, usePagination, useRef, isEnterKey, isUpKey, isDownKey, isNumberKey, Separator, } from '@inquirer/core';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import figures from 'figures';
|
|
4
4
|
import ansiEscapes from 'ansi-escapes';
|
|
@@ -7,7 +7,6 @@ function isSelectableChoice(choice) {
|
|
|
7
7
|
}
|
|
8
8
|
export default createPrompt((config, done) => {
|
|
9
9
|
const { choices } = config;
|
|
10
|
-
const paginator = useRef(new Paginator()).current;
|
|
11
10
|
const firstRender = useRef(true);
|
|
12
11
|
const prefix = usePrefix();
|
|
13
12
|
const [status, setStatus] = useState('pending');
|
|
@@ -51,9 +50,6 @@ export default createPrompt((config, done) => {
|
|
|
51
50
|
message += chalk.dim(' (Use arrow keys)');
|
|
52
51
|
firstRender.current = false;
|
|
53
52
|
}
|
|
54
|
-
if (status === 'done') {
|
|
55
|
-
return `${prefix} ${message} ${chalk.cyan(choice.name || choice.value)}`;
|
|
56
|
-
}
|
|
57
53
|
const allChoices = choices
|
|
58
54
|
.map((choice, index) => {
|
|
59
55
|
if (Separator.isSeparator(choice)) {
|
|
@@ -70,7 +66,13 @@ export default createPrompt((config, done) => {
|
|
|
70
66
|
return ` ${line}`;
|
|
71
67
|
})
|
|
72
68
|
.join('\n');
|
|
73
|
-
const windowedChoices =
|
|
69
|
+
const windowedChoices = usePagination(allChoices, {
|
|
70
|
+
active: cursorPosition,
|
|
71
|
+
pageSize: config.pageSize,
|
|
72
|
+
});
|
|
73
|
+
if (status === 'done') {
|
|
74
|
+
return `${prefix} ${message} ${chalk.cyan(choice.name || choice.value)}`;
|
|
75
|
+
}
|
|
74
76
|
const choiceDescription = choice.description ? `\n${choice.description}` : ``;
|
|
75
77
|
return `${prefix} ${message}\n${windowedChoices}${choiceDescription}${ansiEscapes.cursorHide}`;
|
|
76
78
|
});
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/select",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Inquirer select/list prompt",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
|
-
"typings": "./dist/cjs/types/index.d.
|
|
6
|
+
"typings": "./dist/cjs/types/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist/**/*"
|
|
9
9
|
],
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/select/README.md",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@inquirer/core": "^
|
|
58
|
-
"@inquirer/type": "^1.1.
|
|
57
|
+
"@inquirer/core": "^3.0.0",
|
|
58
|
+
"@inquirer/type": "^1.1.1",
|
|
59
59
|
"ansi-escapes": "^4.3.2",
|
|
60
60
|
"chalk": "^4.1.2",
|
|
61
61
|
"figures": "^3.2.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@inquirer/testing": "^2.1.
|
|
64
|
+
"@inquirer/testing": "^2.1.1"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"tsc": "yarn run clean && yarn run tsc:esm && yarn run tsc:cjs",
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
"default": "./dist/esm/index.mjs"
|
|
84
84
|
},
|
|
85
85
|
"require": {
|
|
86
|
-
"types": "./dist/cjs/types/index.d.
|
|
86
|
+
"types": "./dist/cjs/types/index.d.ts",
|
|
87
87
|
"default": "./dist/cjs/index.js"
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "18144628b03b62c346cb7d9d55a2c526b1ed5d8a"
|
|
92
92
|
}
|
|
File without changes
|