Socket
Socket
Sign inDemoInstall

@inquirer/select

Package Overview
Dependencies
Maintainers
0
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inquirer/select - npm Package Compare versions

Comparing version 2.4.1 to 2.4.2

9

dist/cjs/index.js

@@ -13,3 +13,6 @@ "use strict";

icon: { cursor: figures_1.default.pointer },
style: { disabled: (text) => yoctocolors_cjs_1.default.dim(`- ${text}`) },
style: {
disabled: (text) => yoctocolors_cjs_1.default.dim(`- ${text}`),
description: (text) => yoctocolors_cjs_1.default.cyan(text),
},
helpMode: 'auto',

@@ -131,7 +134,7 @@ };

const choiceDescription = selectedChoice.description
? `\n${selectedChoice.description}`
? `\n${theme.style.description(selectedChoice.description)}`
: ``;
return `${[prefix, message, helpTipTop].filter(Boolean).join(' ')}\n${page}${choiceDescription}${helpTipBottom}${ansi_escapes_1.default.cursorHide}`;
return `${[prefix, message, helpTipTop].filter(Boolean).join(' ')}\n${page}${helpTipBottom}${choiceDescription}${ansi_escapes_1.default.cursorHide}`;
});
var core_2 = require("@inquirer/core");
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return core_2.Separator; } });

@@ -9,2 +9,3 @@ import { Separator, type Theme } from '@inquirer/core';

disabled: (text: string) => string;
description: (text: string) => string;
};

@@ -11,0 +12,0 @@ helpMode: 'always' | 'never' | 'auto';

{
"name": "@inquirer/select",
"version": "2.4.1",
"version": "2.4.2",
"description": "Inquirer select/list prompt",

@@ -57,5 +57,5 @@ "main": "./dist/cjs/index.js",

"dependencies": {
"@inquirer/core": "^9.0.4",
"@inquirer/figures": "^1.0.4",
"@inquirer/type": "^1.5.0",
"@inquirer/core": "^9.0.5",
"@inquirer/figures": "^1.0.5",
"@inquirer/type": "^1.5.1",
"ansi-escapes": "^4.3.2",

@@ -65,3 +65,3 @@ "yoctocolors-cjs": "^2.1.2"

"devDependencies": {
"@inquirer/testing": "^2.1.27"
"@inquirer/testing": "^2.1.28"
},

@@ -72,3 +72,2 @@ "scripts": {

"tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs",
"tsc:watch": "tsc -p ./tsconfig.json --watch",
"attw": "attw --pack"

@@ -95,3 +94,3 @@ },

"sideEffects": false,
"gitHead": "f2c4983dd390c6244fb4668a8e87c9e786e4326f"
"gitHead": "92eb67edb388404a6d737c0605648ac797c84fb6"
}

@@ -18,2 +18,21 @@ # `@inquirer/select`

```sh
npm install @inquirer/prompts
```
</td>
<td>
```sh
yarn add @inquirer/prompts
```
</td>
</tr>
<tr>
<td colSpan="2" align="center">Or</td>
</tr>
<tr>
<td>
```sh
npm install @inquirer/select

@@ -36,3 +55,5 @@ ```

```js
import select, { Separator } from '@inquirer/select';
import { select, Separator } from '@inquirer/prompts';
// Or
// import select, { Separator } from '@inquirer/select';

@@ -69,13 +90,35 @@ const answer = await select({

| 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. |
| Property | Type | Required | Description |
| -------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| message | `string` | yes | The question to ask |
| choices | `Choice[]` | yes | List of the available choices. |
| 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. |
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.
`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.
### `Choice` object
The `Choice` object is typed as
```ts
type Choice<Value> = {
value: Value;
name?: string;
description?: string;
short?: string;
disabled?: boolean | string;
};
```
Here's each property:
- `value`: The value is what will be returned by `await select()`.
- `name`: This is the string displayed in the choice list.
- `description`: Option for a longer description string that'll appear under the list when the cursor highlight a given choice.
- `short`: Once the prompt is done (press enter), we'll use `short` if defined to render next to the question. By default we'll use `name`.
- `disabled`: Disallow the option from being selected. If `disabled` is a string, it'll be used as a help tip explaining why the choice isn't available.
## Theming

@@ -98,2 +141,3 @@

highlight: (text: string) => string;
description: (text: string) => string;
disabled: (text: string) => string;

@@ -100,0 +144,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc