index.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Separator, type Theme } from '@inquirer/core';
  2. import type { PartialDeep } from '@inquirer/type';
  3. type CheckboxTheme = {
  4. icon: {
  5. checked: string;
  6. unchecked: string;
  7. cursor: string;
  8. };
  9. style: {
  10. disabledChoice: (text: string) => string;
  11. renderSelectedChoices: <T>(selectedChoices: ReadonlyArray<NormalizedChoice<T>>, allChoices: ReadonlyArray<NormalizedChoice<T> | Separator>) => string;
  12. description: (text: string) => string;
  13. };
  14. helpMode: 'always' | 'never' | 'auto';
  15. };
  16. type CheckboxShortcuts = {
  17. all?: string | null;
  18. invert?: string | null;
  19. };
  20. type Choice<Value> = {
  21. value: Value;
  22. name?: string;
  23. description?: string;
  24. short?: string;
  25. disabled?: boolean | string;
  26. checked?: boolean;
  27. type?: never;
  28. };
  29. type NormalizedChoice<Value> = {
  30. value: Value;
  31. name: string;
  32. description?: string;
  33. short: string;
  34. disabled: boolean | string;
  35. checked: boolean;
  36. };
  37. declare const _default: <Value>(config: {
  38. message: string;
  39. prefix?: string | undefined;
  40. pageSize?: number | undefined;
  41. instructions?: string | boolean | undefined;
  42. choices: readonly (string | Separator)[] | readonly (Separator | Choice<Value>)[];
  43. loop?: boolean | undefined;
  44. required?: boolean | undefined;
  45. validate?: ((choices: readonly Choice<Value>[]) => boolean | string | Promise<string | boolean>) | undefined;
  46. theme?: PartialDeep<Theme<CheckboxTheme>> | undefined;
  47. shortcuts?: CheckboxShortcuts | undefined;
  48. }, context?: import("@inquirer/type").Context) => Promise<Value[]> & {
  49. cancel: () => void;
  50. };
  51. export default _default;
  52. export { Separator } from '@inquirer/core';