@inquirer/select 2.5.0 → 3.0.1

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 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 prefix = (0, core_1.usePrefix)({ theme });
50
- const [status, setStatus] = (0, core_1.useState)('pending');
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) => import("@inquirer/type").CancelablePromise<Value>;
28
+ }, context?: import("@inquirer/type").Context) => Promise<Value> & {
29
+ cancel: () => void;
30
+ };
29
31
  export default _default;
30
32
  export { Separator } from '@inquirer/core';
@@ -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 prefix = usePrefix({ theme });
43
- const [status, setStatus] = useState('pending');
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) => import("@inquirer/type").CancelablePromise<Value>;
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": "2.5.0",
3
+ "version": "3.0.1",
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.1.0",
58
- "@inquirer/figures": "^1.0.5",
59
- "@inquirer/type": "^1.5.3",
57
+ "@inquirer/core": "^9.2.1",
58
+ "@inquirer/figures": "^1.0.6",
59
+ "@inquirer/type": "^2.0.0",
60
60
  "ansi-escapes": "^4.3.2",
61
61
  "yoctocolors-cjs": "^2.1.2"
62
62
  },
63
63
  "devDependencies": {
64
- "@inquirer/testing": "^2.1.32"
64
+ "@inquirer/testing": "^2.1.34"
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": "0c039599ef88fe9eb804fe083ee386ec906a856f"
91
+ "gitHead": "9e29035c2efc78f44aed3c7732aee46ab1d64ca2"
92
92
  }