@inquirer/select 4.1.1 → 4.2.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 +9 -8
- package/dist/commonjs/index.d.ts +4 -0
- package/dist/commonjs/index.js +2 -2
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -95,14 +95,15 @@ const answer = await select({
|
|
|
95
95
|
|
|
96
96
|
## Options
|
|
97
97
|
|
|
98
|
-
| Property
|
|
99
|
-
|
|
|
100
|
-
| message
|
|
101
|
-
| choices
|
|
102
|
-
| default
|
|
103
|
-
| pageSize
|
|
104
|
-
| loop
|
|
105
|
-
|
|
|
98
|
+
| Property | Type | Required | Description |
|
|
99
|
+
| ------------ | ---------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| message | `string` | yes | The question to ask |
|
|
101
|
+
| choices | `Choice[]` | yes | List of the available choices. |
|
|
102
|
+
| default | `string` | no | Defines in front of which item the cursor will initially appear. When omitted, the cursor will appear on the first selectable item. |
|
|
103
|
+
| pageSize | `number` | no | By default, lists of choice longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once. |
|
|
104
|
+
| loop | `boolean` | no | Defaults to `true`. When set to `false`, the cursor will be constrained to the top and bottom of the choice list without looping. |
|
|
105
|
+
| instructions | `{ navigation: string; pager: string; }` | no | Defines the help tip content. |
|
|
106
|
+
| theme | [See Theming](#Theming) | no | Customize look of the prompt. |
|
|
106
107
|
|
|
107
108
|
`Separator` objects can be used in the `choices` array to render non-selectable lines in the choice list. By default it'll render a line, but you can provide the text as argument (`new Separator('-- Dependencies --')`). This option is often used to add labels to groups within long list of options.
|
|
108
109
|
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ declare const _default: <Value>(config: {
|
|
|
25
25
|
pageSize?: number | undefined;
|
|
26
26
|
loop?: boolean | undefined;
|
|
27
27
|
default?: unknown;
|
|
28
|
+
instructions?: {
|
|
29
|
+
navigation: string;
|
|
30
|
+
pager: string;
|
|
31
|
+
} | undefined;
|
|
28
32
|
theme?: PartialDeep<Theme<SelectTheme>> | undefined;
|
|
29
33
|
}, context?: import("@inquirer/type").Context) => Promise<Value> & {
|
|
30
34
|
cancel: () => void;
|
package/dist/commonjs/index.js
CHANGED
|
@@ -127,10 +127,10 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
|
127
127
|
(theme.helpMode === 'auto' && firstRender.current)) {
|
|
128
128
|
firstRender.current = false;
|
|
129
129
|
if (items.length > pageSize) {
|
|
130
|
-
helpTipBottom = `\n${theme.style.help('
|
|
130
|
+
helpTipBottom = `\n${theme.style.help(`(${config.instructions?.pager ?? 'Use arrow keys to reveal more choices'})`)}`;
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
|
-
helpTipTop = theme.style.help('
|
|
133
|
+
helpTipTop = theme.style.help(`(${config.instructions?.navigation ?? 'Use arrow keys'})`);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
const page = (0, core_1.usePagination)({
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ declare const _default: <Value>(config: {
|
|
|
25
25
|
pageSize?: number | undefined;
|
|
26
26
|
loop?: boolean | undefined;
|
|
27
27
|
default?: unknown;
|
|
28
|
+
instructions?: {
|
|
29
|
+
navigation: string;
|
|
30
|
+
pager: string;
|
|
31
|
+
} | undefined;
|
|
28
32
|
theme?: PartialDeep<Theme<SelectTheme>> | undefined;
|
|
29
33
|
}, context?: import("@inquirer/type").Context) => Promise<Value> & {
|
|
30
34
|
cancel: () => void;
|
package/dist/esm/index.js
CHANGED
|
@@ -121,10 +121,10 @@ export default createPrompt((config, done) => {
|
|
|
121
121
|
(theme.helpMode === 'auto' && firstRender.current)) {
|
|
122
122
|
firstRender.current = false;
|
|
123
123
|
if (items.length > pageSize) {
|
|
124
|
-
helpTipBottom = `\n${theme.style.help('
|
|
124
|
+
helpTipBottom = `\n${theme.style.help(`(${config.instructions?.pager ?? 'Use arrow keys to reveal more choices'})`)}`;
|
|
125
125
|
}
|
|
126
126
|
else {
|
|
127
|
-
helpTipTop = theme.style.help('
|
|
127
|
+
helpTipTop = theme.style.help(`(${config.instructions?.navigation ?? 'Use arrow keys'})`);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
const page = usePagination({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/select",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Inquirer select/list prompt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"optional": true
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "238c3af2ecf5fefb9b010fda99bb3a532fa4f61a"
|
|
113
113
|
}
|