@inquirer/select 1.2.8 → 1.2.10

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
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Separator = void 0;
7
4
  const core_1 = require("@inquirer/core");
8
5
  Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return core_1.Separator; } });
9
- const chalk_1 = __importDefault(require("chalk"));
10
- const figures_1 = __importDefault(require("figures"));
11
- const ansi_escapes_1 = __importDefault(require("ansi-escapes"));
6
+ const chalk_1 = require("chalk");
7
+ const figures_1 = require("figures");
8
+ const ansi_escapes_1 = require("ansi-escapes");
12
9
  function isSelectableChoice(choice) {
13
10
  return choice != null && !core_1.Separator.isSeparator(choice) && !choice.disabled;
14
11
  }
@@ -25,11 +22,11 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
25
22
  return startIndex;
26
23
  });
27
24
  // Safe to assume the cursor position always point to a Choice.
28
- const choice = choices[cursorPosition];
25
+ const selectedChoice = choices[cursorPosition];
29
26
  (0, core_1.useKeypress)((key) => {
30
27
  if ((0, core_1.isEnterKey)(key)) {
31
28
  setStatus('done');
32
- done(choice.value);
29
+ done(selectedChoice.value);
33
30
  }
34
31
  else if ((0, core_1.isUpKey)(key) || (0, core_1.isDownKey)(key)) {
35
32
  let newCursorPosition = cursorPosition;
@@ -78,8 +75,10 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
78
75
  pageSize: config.pageSize,
79
76
  });
80
77
  if (status === 'done') {
81
- return `${prefix} ${message} ${chalk_1.default.cyan(choice.name || choice.value)}`;
78
+ return `${prefix} ${message} ${chalk_1.default.cyan(selectedChoice.name || selectedChoice.value)}`;
82
79
  }
83
- const choiceDescription = choice.description ? `\n${choice.description}` : ``;
80
+ const choiceDescription = selectedChoice.description
81
+ ? `\n${selectedChoice.description}`
82
+ : ``;
84
83
  return `${prefix} ${message}\n${windowedChoices}${choiceDescription}${ansi_escapes_1.default.cursorHide}`;
85
84
  });
@@ -18,11 +18,11 @@ export default createPrompt((config, done) => {
18
18
  return startIndex;
19
19
  });
20
20
  // Safe to assume the cursor position always point to a Choice.
21
- const choice = choices[cursorPosition];
21
+ const selectedChoice = choices[cursorPosition];
22
22
  useKeypress((key) => {
23
23
  if (isEnterKey(key)) {
24
24
  setStatus('done');
25
- done(choice.value);
25
+ done(selectedChoice.value);
26
26
  }
27
27
  else if (isUpKey(key) || isDownKey(key)) {
28
28
  let newCursorPosition = cursorPosition;
@@ -71,9 +71,11 @@ export default createPrompt((config, done) => {
71
71
  pageSize: config.pageSize,
72
72
  });
73
73
  if (status === 'done') {
74
- return `${prefix} ${message} ${chalk.cyan(choice.name || choice.value)}`;
74
+ return `${prefix} ${message} ${chalk.cyan(selectedChoice.name || selectedChoice.value)}`;
75
75
  }
76
- const choiceDescription = choice.description ? `\n${choice.description}` : ``;
76
+ const choiceDescription = selectedChoice.description
77
+ ? `\n${selectedChoice.description}`
78
+ : ``;
77
79
  return `${prefix} ${message}\n${windowedChoices}${choiceDescription}${ansiEscapes.cursorHide}`;
78
80
  });
79
81
  export { Separator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/select",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "description": "Inquirer select/list prompt",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "typings": "./dist/cjs/types/index.d.ts",
@@ -54,20 +54,19 @@
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": "^3.1.2",
58
- "@inquirer/type": "^1.1.2",
57
+ "@inquirer/core": "^4.1.0",
58
+ "@inquirer/type": "^1.1.3",
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.3"
64
+ "@inquirer/testing": "^2.1.5"
65
65
  },
66
66
  "scripts": {
67
- "tsc": "yarn run clean && yarn run tsc:esm && yarn run tsc:cjs",
68
- "clean": "rm -rf dist",
69
- "tsc:esm": "tsc -p ./tsconfig.json",
70
- "tsc:cjs": "tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs"
67
+ "tsc": "yarn run tsc:esm && yarn run tsc:cjs",
68
+ "tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json",
69
+ "tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs"
71
70
  },
72
71
  "publishConfig": {
73
72
  "access": "public"
@@ -87,5 +86,5 @@
87
86
  }
88
87
  }
89
88
  },
90
- "gitHead": "2b29f261c4c7d85a00c1a2305d97ee10e3c15b68"
89
+ "gitHead": "f5c544a8ded1c7dfb6ac8364759955e8f2ecfb0c"
91
90
  }