@inquirer/confirm 3.1.22 → 4.0.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 +2 -2
- package/dist/cjs/index.js +3 -3
- package/dist/esm/index.mjs +3 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -73,14 +73,14 @@ You can theme a prompt by passing a `theme` object option. The theme object only
|
|
|
73
73
|
|
|
74
74
|
```ts
|
|
75
75
|
type Theme = {
|
|
76
|
-
prefix: string;
|
|
76
|
+
prefix: string | { idle: string; done: string };
|
|
77
77
|
spinner: {
|
|
78
78
|
interval: number;
|
|
79
79
|
frames: string[];
|
|
80
80
|
};
|
|
81
81
|
style: {
|
|
82
82
|
answer: (text: string) => string;
|
|
83
|
-
message: (text: string) => string;
|
|
83
|
+
message: (text: string, status: 'idle' | 'done' | 'loading') => string;
|
|
84
84
|
defaultAnswer: (text: string) => string;
|
|
85
85
|
};
|
|
86
86
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@inquirer/core");
|
|
4
4
|
exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
5
5
|
const { transformer = (answer) => (answer ? 'yes' : 'no') } = config;
|
|
6
|
-
const [status, setStatus] = (0, core_1.useState)('
|
|
6
|
+
const [status, setStatus] = (0, core_1.useState)('idle');
|
|
7
7
|
const [value, setValue] = (0, core_1.useState)('');
|
|
8
8
|
const theme = (0, core_1.makeTheme)(config.theme);
|
|
9
|
-
const prefix = (0, core_1.usePrefix)({ theme });
|
|
9
|
+
const prefix = (0, core_1.usePrefix)({ status, theme });
|
|
10
10
|
(0, core_1.useKeypress)((key, rl) => {
|
|
11
11
|
if ((0, core_1.isEnterKey)(key)) {
|
|
12
12
|
let answer = config.default !== false;
|
|
@@ -30,6 +30,6 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
|
30
30
|
else {
|
|
31
31
|
defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? 'y/N' : 'Y/n')}`;
|
|
32
32
|
}
|
|
33
|
-
const message = theme.style.message(config.message);
|
|
33
|
+
const message = theme.style.message(config.message, status);
|
|
34
34
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
35
35
|
});
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createPrompt, useState, useKeypress, isEnterKey, usePrefix, makeTheme, } from '@inquirer/core';
|
|
2
2
|
export default createPrompt((config, done) => {
|
|
3
3
|
const { transformer = (answer) => (answer ? 'yes' : 'no') } = config;
|
|
4
|
-
const [status, setStatus] = useState('
|
|
4
|
+
const [status, setStatus] = useState('idle');
|
|
5
5
|
const [value, setValue] = useState('');
|
|
6
6
|
const theme = makeTheme(config.theme);
|
|
7
|
-
const prefix = usePrefix({ theme });
|
|
7
|
+
const prefix = usePrefix({ status, theme });
|
|
8
8
|
useKeypress((key, rl) => {
|
|
9
9
|
if (isEnterKey(key)) {
|
|
10
10
|
let answer = config.default !== false;
|
|
@@ -28,6 +28,6 @@ export default createPrompt((config, done) => {
|
|
|
28
28
|
else {
|
|
29
29
|
defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? 'y/N' : 'Y/n')}`;
|
|
30
30
|
}
|
|
31
|
-
const message = theme.style.message(config.message);
|
|
31
|
+
const message = theme.style.message(config.message, status);
|
|
32
32
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
33
33
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/confirm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Inquirer confirm prompt",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"typings": "./dist/cjs/types/index.d.ts",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/confirm/README.md",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@inquirer/core": "^9.0
|
|
58
|
-
"@inquirer/type": "^1.5.
|
|
57
|
+
"@inquirer/core": "^9.2.0",
|
|
58
|
+
"@inquirer/type": "^1.5.4"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@inquirer/testing": "^2.1.
|
|
61
|
+
"@inquirer/testing": "^2.1.33"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"tsc": "yarn run tsc:esm && yarn run tsc:cjs",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"sideEffects": false,
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "5fe03a4686d349d0d6cf281f86f12a4f7c992ad4"
|
|
89
89
|
}
|