@inquirer/input 5.0.4 → 5.0.6
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/index.js +5 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -6,7 +6,9 @@ export default createPrompt((config, done) => {
|
|
|
6
6
|
const { prefill = 'tab' } = config;
|
|
7
7
|
const theme = makeTheme(inputTheme, config.theme);
|
|
8
8
|
const [status, setStatus] = useState('idle');
|
|
9
|
-
|
|
9
|
+
// Coerce to string to handle runtime values that may be numbers despite TypeScript types
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion
|
|
11
|
+
const [defaultValue, setDefaultValue] = useState(String(config.default ?? ''));
|
|
10
12
|
const [errorMsg, setError] = useState();
|
|
11
13
|
const [value, setValue] = useState('');
|
|
12
14
|
const prefix = usePrefix({ status, theme });
|
|
@@ -51,10 +53,10 @@ export default createPrompt((config, done) => {
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
else if (isBackspaceKey(key) && !value) {
|
|
54
|
-
setDefaultValue(
|
|
56
|
+
setDefaultValue('');
|
|
55
57
|
}
|
|
56
58
|
else if (isTabKey(key) && !value) {
|
|
57
|
-
setDefaultValue(
|
|
59
|
+
setDefaultValue('');
|
|
58
60
|
rl.clearLine(0); // Remove the tab character.
|
|
59
61
|
rl.write(defaultValue);
|
|
60
62
|
setValue(defaultValue);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/input",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.6",
|
|
4
4
|
"description": "Inquirer input text prompt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"tsc": "tsc"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@inquirer/core": "^11.1.
|
|
70
|
+
"@inquirer/core": "^11.1.3",
|
|
71
71
|
"@inquirer/type": "^4.0.3"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@inquirer/testing": "^3.
|
|
74
|
+
"@inquirer/testing": "^3.1.1",
|
|
75
75
|
"typescript": "^5.9.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
},
|
|
88
88
|
"main": "./dist/index.js",
|
|
89
89
|
"types": "./dist/index.d.ts",
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "48b5d7e8b14d5c9fc4a19a8f1ead20a7593b29e1"
|
|
91
91
|
}
|