@inquirer/select
Advanced tools
Comparing version 2.3.11 to 2.4.0
@@ -20,2 +20,3 @@ "use strict"; | ||
exports.default = (0, core_1.createPrompt)((config, done) => { | ||
var _a, _b; | ||
const { choices: items, loop = true, pageSize = 7 } = config; | ||
@@ -124,5 +125,5 @@ const firstRender = (0, core_1.useRef)(true); | ||
if (status === 'done') { | ||
const answer = selectedChoice.name || | ||
// TODO: Could we enforce that at the type level? Name should be defined for non-string values. | ||
String(selectedChoice.value); | ||
const answer = (_b = (_a = selectedChoice.short) !== null && _a !== void 0 ? _a : selectedChoice.name) !== null && _b !== void 0 ? _b : | ||
// TODO: Could we enforce that at the type level? Name should be defined for non-string values. | ||
String(selectedChoice.value); | ||
return `${prefix} ${message} ${theme.style.answer(answer)}`; | ||
@@ -129,0 +130,0 @@ } |
@@ -16,2 +16,3 @@ import { Separator, type Theme } from '@inquirer/core'; | ||
description?: string; | ||
short?: string; | ||
disabled?: boolean | string; | ||
@@ -18,0 +19,0 @@ type?: never; |
{ | ||
"name": "@inquirer/select", | ||
"version": "2.3.11", | ||
"version": "2.4.0", | ||
"description": "Inquirer select/list prompt", | ||
@@ -92,3 +92,3 @@ "main": "./dist/cjs/index.js", | ||
"sideEffects": false, | ||
"gitHead": "eb7a658ca58d8cc5863efb9289ae1b42e818bdd0" | ||
"gitHead": "6e2ddec8ca97ee176f080efd2cba76e39b5b9628" | ||
} |
@@ -67,10 +67,10 @@ # `@inquirer/select` | ||
| Property | Type | Required | Description | | ||
| -------- | ---------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| message | `string` | yes | The question to ask | | ||
| choices | `Array<{ value: string, name?: string, description?: string, disabled?: boolean \| string } \| Separator>` | yes | List of the available choices. The `value` will be returned as the answer, and used as display if no `name` is defined. Choices who're `disabled` will be displayed, but not selectable. The `description` will be displayed under the prompt when the cursor land over the choice. | | ||
| 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. | | ||
| 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. | | ||
| 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. | | ||
| theme | [See Theming](#Theming) | no | Customize look of the prompt. | | ||
| Property | Type | Required | Description | | ||
| -------- | -------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| message | `string` | yes | The question to ask | | ||
| choices | `Array<{ value: string, name?: string, short?: string, description?: string, disabled?: boolean \| string } \| Separator>` | yes | List of the available choices. The `value` will be returned as the answer, and used as display if no `name` is defined. Choices who're `disabled` will be displayed, but not selectable. The `description` will be displayed under the prompt when the cursor land over the choice. `short` if defined will be used instead of `name` once submitted. | | ||
| 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. | | ||
| 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. | | ||
| 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. | | ||
| theme | [See Theming](#Theming) | no | Customize look of the prompt. | | ||
@@ -77,0 +77,0 @@ The `Separator` object can be used 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. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22888
320