@inquirer/select 2.2.2 → 2.2.3

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
@@ -7,7 +7,7 @@ exports.Separator = void 0;
7
7
  const core_1 = require("@inquirer/core");
8
8
  Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return core_1.Separator; } });
9
9
  const chalk_1 = __importDefault(require("chalk"));
10
- const figures_1 = __importDefault(require("figures"));
10
+ const figures_1 = __importDefault(require("@inquirer/figures"));
11
11
  const ansi_escapes_1 = __importDefault(require("ansi-escapes"));
12
12
  const selectTheme = {
13
13
  icon: { cursor: figures_1.default.pointer },
@@ -25,10 +25,10 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
25
25
  const searchTimeoutRef = (0, core_1.useRef)(undefined);
26
26
  const bounds = (0, core_1.useMemo)(() => {
27
27
  const first = items.findIndex(isSelectable);
28
- // TODO: Replace with `findLastIndex` when it's available.
29
- const last = items.length - 1 - [...items].reverse().findIndex(isSelectable);
30
- if (first < 0)
28
+ const last = items.findLastIndex(isSelectable);
29
+ if (first < 0) {
31
30
  throw new core_1.ValidationError('[select prompt] No selectable choices. All choices are disabled.');
31
+ }
32
32
  return { first, last };
33
33
  }, [items]);
34
34
  const defaultItemIndex = (0, core_1.useMemo)(() => {
@@ -1,6 +1,6 @@
1
1
  import { createPrompt, useState, useKeypress, usePrefix, usePagination, useRef, useMemo, isBackspaceKey, isEnterKey, isUpKey, isDownKey, isNumberKey, Separator, ValidationError, makeTheme, } from '@inquirer/core';
2
2
  import chalk from 'chalk';
3
- import figures from 'figures';
3
+ import figures from '@inquirer/figures';
4
4
  import ansiEscapes from 'ansi-escapes';
5
5
  const selectTheme = {
6
6
  icon: { cursor: figures.pointer },
@@ -18,10 +18,10 @@ export default createPrompt((config, done) => {
18
18
  const searchTimeoutRef = useRef(undefined);
19
19
  const bounds = useMemo(() => {
20
20
  const first = items.findIndex(isSelectable);
21
- // TODO: Replace with `findLastIndex` when it's available.
22
- const last = items.length - 1 - [...items].reverse().findIndex(isSelectable);
23
- if (first < 0)
21
+ const last = items.findLastIndex(isSelectable);
22
+ if (first < 0) {
24
23
  throw new ValidationError('[select prompt] No selectable choices. All choices are disabled.');
24
+ }
25
25
  return { first, last };
26
26
  }, [items]);
27
27
  const defaultItemIndex = useMemo(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/select",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Inquirer select/list prompt",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "typings": "./dist/cjs/types/index.d.ts",
@@ -54,14 +54,14 @@
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": "^7.1.2",
58
- "@inquirer/type": "^1.2.1",
57
+ "@inquirer/core": "^7.1.3",
58
+ "@inquirer/figures": "^1.0.0",
59
+ "@inquirer/type": "^1.2.2",
59
60
  "ansi-escapes": "^4.3.2",
60
- "chalk": "^4.1.2",
61
- "figures": "^3.2.0"
61
+ "chalk": "^4.1.2"
62
62
  },
63
63
  "devDependencies": {
64
- "@inquirer/testing": "^2.1.15"
64
+ "@inquirer/testing": "^2.1.16"
65
65
  },
66
66
  "scripts": {
67
67
  "tsc": "yarn run tsc:esm && yarn run tsc:cjs",
@@ -87,5 +87,5 @@
87
87
  }
88
88
  }
89
89
  },
90
- "gitHead": "e5300568c6b043f325a1107e38e99d931593510e"
90
+ "gitHead": "6bfbdfc457ab6d99b9d80c106b5edad285c8b9ba"
91
91
  }