@inquirer/select 2.5.0 → 3.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/cjs/types/index.d.ts +3 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/types/index.d.mts +3 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -126,14 +126,14 @@ You can theme a prompt by passing a `theme` object option. The theme object only
|
|
|
126
126
|
|
|
127
127
|
```ts
|
|
128
128
|
type Theme = {
|
|
129
|
-
prefix: string;
|
|
129
|
+
prefix: string | { idle: string; done: string };
|
|
130
130
|
spinner: {
|
|
131
131
|
interval: number;
|
|
132
132
|
frames: string[];
|
|
133
133
|
};
|
|
134
134
|
style: {
|
|
135
135
|
answer: (text: string) => string;
|
|
136
|
-
message: (text: string) => string;
|
|
136
|
+
message: (text: string, status: 'idle' | 'done' | 'loading') => string;
|
|
137
137
|
error: (text: string) => string;
|
|
138
138
|
help: (text: string) => string;
|
|
139
139
|
highlight: (text: string) => string;
|
package/dist/cjs/index.js
CHANGED
|
@@ -46,8 +46,8 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
|
46
46
|
const { loop = true, pageSize = 7 } = config;
|
|
47
47
|
const firstRender = (0, core_1.useRef)(true);
|
|
48
48
|
const theme = (0, core_1.makeTheme)(selectTheme, config.theme);
|
|
49
|
-
const
|
|
50
|
-
const
|
|
49
|
+
const [status, setStatus] = (0, core_1.useState)('idle');
|
|
50
|
+
const prefix = (0, core_1.usePrefix)({ status, theme });
|
|
51
51
|
const searchTimeoutRef = (0, core_1.useRef)();
|
|
52
52
|
const items = (0, core_1.useMemo)(() => normalizeChoices(config.choices), [config.choices]);
|
|
53
53
|
const bounds = (0, core_1.useMemo)(() => {
|
|
@@ -115,7 +115,7 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
|
115
115
|
(0, core_1.useEffect)(() => () => {
|
|
116
116
|
clearTimeout(searchTimeoutRef.current);
|
|
117
117
|
}, []);
|
|
118
|
-
const message = theme.style.message(config.message);
|
|
118
|
+
const message = theme.style.message(config.message, status);
|
|
119
119
|
let helpTipTop = '';
|
|
120
120
|
let helpTipBottom = '';
|
|
121
121
|
if (theme.helpMode === 'always' ||
|
|
@@ -25,6 +25,8 @@ declare const _default: <Value>(config: {
|
|
|
25
25
|
loop?: boolean | undefined;
|
|
26
26
|
default?: unknown;
|
|
27
27
|
theme?: PartialDeep<Theme<SelectTheme>> | undefined;
|
|
28
|
-
}, context?: import("@inquirer/type").Context) =>
|
|
28
|
+
}, context?: import("@inquirer/type").Context) => Promise<Value> & {
|
|
29
|
+
cancel: () => void;
|
|
30
|
+
};
|
|
29
31
|
export default _default;
|
|
30
32
|
export { Separator } from '@inquirer/core';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -39,8 +39,8 @@ export default createPrompt((config, done) => {
|
|
|
39
39
|
const { loop = true, pageSize = 7 } = config;
|
|
40
40
|
const firstRender = useRef(true);
|
|
41
41
|
const theme = makeTheme(selectTheme, config.theme);
|
|
42
|
-
const
|
|
43
|
-
const
|
|
42
|
+
const [status, setStatus] = useState('idle');
|
|
43
|
+
const prefix = usePrefix({ status, theme });
|
|
44
44
|
const searchTimeoutRef = useRef();
|
|
45
45
|
const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);
|
|
46
46
|
const bounds = useMemo(() => {
|
|
@@ -108,7 +108,7 @@ export default createPrompt((config, done) => {
|
|
|
108
108
|
useEffect(() => () => {
|
|
109
109
|
clearTimeout(searchTimeoutRef.current);
|
|
110
110
|
}, []);
|
|
111
|
-
const message = theme.style.message(config.message);
|
|
111
|
+
const message = theme.style.message(config.message, status);
|
|
112
112
|
let helpTipTop = '';
|
|
113
113
|
let helpTipBottom = '';
|
|
114
114
|
if (theme.helpMode === 'always' ||
|
|
@@ -25,6 +25,8 @@ declare const _default: <Value>(config: {
|
|
|
25
25
|
loop?: boolean | undefined;
|
|
26
26
|
default?: unknown;
|
|
27
27
|
theme?: PartialDeep<Theme<SelectTheme>> | undefined;
|
|
28
|
-
}, context?: import("@inquirer/type").Context) =>
|
|
28
|
+
}, context?: import("@inquirer/type").Context) => Promise<Value> & {
|
|
29
|
+
cancel: () => void;
|
|
30
|
+
};
|
|
29
31
|
export default _default;
|
|
30
32
|
export { Separator } from '@inquirer/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/select",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
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/main/packages/select/README.md",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@inquirer/core": "^9.
|
|
57
|
+
"@inquirer/core": "^9.2.0",
|
|
58
58
|
"@inquirer/figures": "^1.0.5",
|
|
59
|
-
"@inquirer/type": "^1.5.
|
|
59
|
+
"@inquirer/type": "^1.5.4",
|
|
60
60
|
"ansi-escapes": "^4.3.2",
|
|
61
61
|
"yoctocolors-cjs": "^2.1.2"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@inquirer/testing": "^2.1.
|
|
64
|
+
"@inquirer/testing": "^2.1.33"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"tsc": "yarn run tsc:esm && yarn run tsc:cjs",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"sideEffects": false,
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "5fe03a4686d349d0d6cf281f86f12a4f7c992ad4"
|
|
92
92
|
}
|