@inquirer/select 4.1.0 → 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 CHANGED
@@ -4,6 +4,16 @@ Simple interactive command line prompt to display a list of choices (single sele
4
4
 
5
5
  ![select prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/list.svg)
6
6
 
7
+ # Special Thanks
8
+
9
+ <div align="center" markdown="1">
10
+
11
+ [![Graphite](https://github.com/user-attachments/assets/53db40ca-2254-481a-a094-6597f8716e29)](https://graphite.dev/?utm_source=npmjs&utm_medium=repo&utm_campaign=inquirerjs)<br>
12
+
13
+ ### [Graphite is the AI developer productivity platform helping teams on GitHub ship higher quality software, faster](https://graphite.dev/?utm_source=npmjs&utm_medium=repo&utm_campaign=inquirerjs)
14
+
15
+ </div>
16
+
7
17
  # Installation
8
18
 
9
19
  <table>
@@ -85,14 +95,15 @@ const answer = await select({
85
95
 
86
96
  ## Options
87
97
 
88
- | Property | Type | Required | Description |
89
- | -------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
90
- | message | `string` | yes | The question to ask |
91
- | choices | `Choice[]` | yes | List of the available choices. |
92
- | 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. |
93
- | 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. |
94
- | 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. |
95
- | theme | [See Theming](#Theming) | no | Customize look of the prompt. |
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. |
96
107
 
97
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.
98
109
 
@@ -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;
@@ -33,13 +33,16 @@ function normalizeChoices(choices) {
33
33
  };
34
34
  }
35
35
  const name = choice.name ?? String(choice.value);
36
- return {
36
+ const normalizedChoice = {
37
37
  value: choice.value,
38
38
  name,
39
- description: choice.description,
40
39
  short: choice.short ?? name,
41
40
  disabled: choice.disabled ?? false,
42
41
  };
42
+ if (choice.description) {
43
+ normalizedChoice.description = choice.description;
44
+ }
45
+ return normalizedChoice;
43
46
  });
44
47
  }
45
48
  exports.default = (0, core_1.createPrompt)((config, done) => {
@@ -124,10 +127,10 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
124
127
  (theme.helpMode === 'auto' && firstRender.current)) {
125
128
  firstRender.current = false;
126
129
  if (items.length > pageSize) {
127
- helpTipBottom = `\n${theme.style.help('(Use arrow keys to reveal more choices)')}`;
130
+ helpTipBottom = `\n${theme.style.help(`(${config.instructions?.pager ?? 'Use arrow keys to reveal more choices'})`)}`;
128
131
  }
129
132
  else {
130
- helpTipTop = theme.style.help('(Use arrow keys)');
133
+ helpTipTop = theme.style.help(`(${config.instructions?.navigation ?? 'Use arrow keys'})`);
131
134
  }
132
135
  }
133
136
  const page = (0, core_1.usePagination)({
@@ -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
@@ -27,13 +27,16 @@ function normalizeChoices(choices) {
27
27
  };
28
28
  }
29
29
  const name = choice.name ?? String(choice.value);
30
- return {
30
+ const normalizedChoice = {
31
31
  value: choice.value,
32
32
  name,
33
- description: choice.description,
34
33
  short: choice.short ?? name,
35
34
  disabled: choice.disabled ?? false,
36
35
  };
36
+ if (choice.description) {
37
+ normalizedChoice.description = choice.description;
38
+ }
39
+ return normalizedChoice;
37
40
  });
38
41
  }
39
42
  export default createPrompt((config, done) => {
@@ -118,10 +121,10 @@ export default createPrompt((config, done) => {
118
121
  (theme.helpMode === 'auto' && firstRender.current)) {
119
122
  firstRender.current = false;
120
123
  if (items.length > pageSize) {
121
- helpTipBottom = `\n${theme.style.help('(Use arrow keys to reveal more choices)')}`;
124
+ helpTipBottom = `\n${theme.style.help(`(${config.instructions?.pager ?? 'Use arrow keys to reveal more choices'})`)}`;
122
125
  }
123
126
  else {
124
- helpTipTop = theme.style.help('(Use arrow keys)');
127
+ helpTipTop = theme.style.help(`(${config.instructions?.navigation ?? 'Use arrow keys'})`);
125
128
  }
126
129
  }
127
130
  const page = usePagination({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/select",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Inquirer select/list prompt",
5
5
  "keywords": [
6
6
  "answer",
@@ -74,15 +74,15 @@
74
74
  "tsc": "tshy"
75
75
  },
76
76
  "dependencies": {
77
- "@inquirer/core": "^10.1.9",
77
+ "@inquirer/core": "^10.1.10",
78
78
  "@inquirer/figures": "^1.0.11",
79
- "@inquirer/type": "^3.0.5",
79
+ "@inquirer/type": "^3.0.6",
80
80
  "ansi-escapes": "^4.3.2",
81
81
  "yoctocolors-cjs": "^2.1.2"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@arethetypeswrong/cli": "^0.17.4",
85
- "@inquirer/testing": "^2.1.45",
85
+ "@inquirer/testing": "^2.1.46",
86
86
  "@repo/tsconfig": "workspace:*",
87
87
  "tshy": "^3.0.2"
88
88
  },
@@ -109,5 +109,5 @@
109
109
  "optional": true
110
110
  }
111
111
  },
112
- "gitHead": "83508f90ca65d26abc1408e4209e4f8fc73e43fe"
112
+ "gitHead": "238c3af2ecf5fefb9b010fda99bb3a532fa4f61a"
113
113
  }