{"_id":"@inquirer/checkbox@5.2.2","bugs":{"url":"https://github.com/SBoudrias/Inquirer.js/issues"},"dist":{"shasum":"f20347bb6c08c85c9f29e525d8a0372420859426","tarball":"http://registry-npm.ywwl.com/@inquirer/checkbox/download/@inquirer/checkbox-5.2.2.tgz","integrity":"sha512-Y5/bAScMy5Y+9isCx0SKbyJebMCaXXX5em0kxkj115eZNscgV9srOHrgyfS0e5xAVymIfOh9piYBKDILktsMMg==","fileCount":5,"unpackedSize":20569,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@inquirer%2fcheckbox@5.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCGvJFP3vV1Bb2rcADvGBBJN7J0bawB4Tic2KbIX2DvAwIhAKIv+RNEIYaiM431FUGEqY4kwhM80ghMnloHCFPEEw5T"}],"size":6513,"noattachment":false,"key":"/@inquirer/checkbox/-/@inquirer/checkbox-5.2.2.tgz"},"main":"./dist/index.js","name":"@inquirer/checkbox","type":"module","types":"./dist/index.d.ts","author":{"name":"Simon Boudrias","email":"admin@simonboudrias.com"},"engines":{"node":">=23.5.0 || ^22.13.0 || ^20.17.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"999706755afbdcae271f62decbd9bcd05560905b","license":"MIT","scripts":{"tsc":"tsc"},"version":"5.2.2","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:27e3665a-2914-4e41-8755-9d19c665b5a1"},"approver":{"name":"sboudrias","email":"admin@simonboudrias.com"}},"homepage":"https://github.com/SBoudrias/Inquirer.js/blob/main/packages/checkbox/README.md","keywords":["answer","answers","ask","base","cli","command","command-line","confirm","enquirer","generate","generator","hyper","input","inquire","inquirer","interface","iterm","javascript","menu","node","nodejs","prompt","promptly","prompts","question","readline","scaffold","scaffolder","scaffolding","stdin","stdout","terminal","tty","ui","yeoman","yo","zsh"],"repository":{"url":"git+https://github.com/SBoudrias/Inquirer.js.git","type":"git"},"_npmVersion":"lerna/5.6.0/node@v24.19.0+x64 (linux)","description":"Inquirer checkbox prompt","directories":{},"maintainers":[{"name":"sboudrias","email":"admin@simonboudrias.com"},{"name":"mischah","email":"mail@michael-kuehnel.de"}],"sideEffects":false,"_nodeVersion":"24.19.0","dependencies":{"@inquirer/ansi":"^2.0.7","@inquirer/core":"^12.0.0","@inquirer/type":"^4.0.7","@inquirer/figures":"^2.0.8"},"publishConfig":{"access":"public"},"devDependencies":{"typescript":"^6.0.2","@repo/tsconfig":"0.0.0"},"peerDependencies":{"@types/node":">=18"},"peerDependenciesMeta":{"@types/node":{"optional":true}},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/checkbox_5.2.2_1787160735586_0.15567115334198234"},"_hasShrinkwrap":false,"readme":"# `@inquirer/checkbox`\n\nSimple interactive command line prompt to display a list of checkboxes (multi select).\n\n![Checkbox prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/checkbox.svg)\n\n# Installation\n\n<table>\n<tr>\n  <th>npm</th>\n  <th>yarn</th>\n</tr>\n<tr>\n<td>\n\n```sh\nnpm install @inquirer/prompts\n```\n\n</td>\n<td>\n\n```sh\nyarn add @inquirer/prompts\n```\n\n</td>\n</tr>\n<tr>\n<td colSpan=\"2\" align=\"center\">Or</td>\n</tr>\n<tr>\n<td>\n\n```sh\nnpm install @inquirer/checkbox\n```\n\n</td>\n<td>\n\n```sh\nyarn add @inquirer/checkbox\n```\n\n</td>\n</tr>\n</table>\n\n# Usage\n\n```js\nimport { checkbox, Separator } from '@inquirer/prompts';\n// Or\n// import checkbox, { Separator } from '@inquirer/checkbox';\n\nconst answer = await checkbox({\n  message: 'Select a package manager',\n  choices: [\n    { name: 'npm', value: 'npm' },\n    { name: 'yarn', value: 'yarn' },\n    new Separator(),\n    { name: 'pnpm', value: 'pnpm', disabled: true },\n    {\n      name: 'pnpm',\n      value: 'pnpm',\n      disabled: '(pnpm is not available)',\n    },\n  ],\n});\n```\n\n## Options\n\n| Property  | Type                                    | Required | Description                                                                                                                                                                                           |\n| --------- | --------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| message   | `string`                                | yes      | The question to ask                                                                                                                                                                                   |\n| choices   | `Choice[]`                              | yes      | List of the available choices.                                                                                                                                                                        |\n| pageSize  | `number`                                | no       | By default, lists of choice longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once.                                                           |\n| loop      | `boolean`                               | no       | Defaults to `true`. When set to `false`, the cursor will be constrained to the top and bottom of the choice list without looping.                                                                     |\n| required  | `boolean`                               | no       | When set to `true`, ensures at least one choice must be selected.                                                                                                                                     |\n| validate  | `async (Choice[]) => boolean \\| string` | no       | On submit, validate the choices. When returning a string, it'll be used as the error message displayed to the user. Note: returning a rejected promise, we'll assume a code error happened and crash. |\n| shortcuts | [See Shortcuts](#Shortcuts)             | no       | Customize shortcut keys for `all` and `invert`.                                                                                                                                                       |\n| theme     | [See Theming](#Theming)                 | no       | Customize look of the prompt.                                                                                                                                                                         |\n\n`Separator` objects can be used in the `choices` array to render non-selectable lines in the choice list. By default it'll render a line, but you can provide the text as argument (`new Separator('-- Dependencies --')`). This option is often used to add labels to groups within long list of options.\n\n### `Choice` object\n\nThe `Choice` object is typed as\n\n```ts\ntype Choice<Value> = {\n  value: Value;\n  name?: string;\n  checkedName?: string;\n  description?: string;\n  short?: string;\n  checked?: boolean;\n  disabled?: boolean | string;\n};\n```\n\nHere's each property:\n\n- `value`: The value is what will be returned by `await checkbox()`.\n- `name`: This is the string displayed in the choice list.\n- `checkedName`: Alternative `name` (or format) displayed when the choice is checked.\n- `description`: Option for a longer description string that'll appear under the list when the cursor highlight a given choice.\n- `short`: Once the prompt is done (press enter), we'll use `short` if defined to render next to the question. By default we'll use `name`.\n- `checked`: If `true`, the option will be checked by default.\n- `disabled`: Disallow the option from being selected. If `disabled` is a string, it'll be used as a help tip explaining why the choice isn't available.\n\nAlso note the `choices` array can contain `Separator`s to help organize long lists.\n\n`choices` can also be an array of string, in which case the string will be used both as the `value` and the `name`.\n\n## Keybindings\n\nSet `INQUIRER_KEYBINDINGS=vim`, `INQUIRER_KEYBINDINGS=emacs`, or `INQUIRER_KEYBINDINGS=vim,emacs` to enable alternative navigation keybindings globally.\n\nYou can override the environment setting per prompt with `theme.keybindings`.\n\n## Shortcuts\n\nYou can customize the shortcut keys for `all` and `invert` or disable them by setting them to `null`.\n\n```ts\ntype Shortcuts = {\n  all?: string | null; // default: 'a'\n  invert?: string | null; // default: 'i'\n};\n```\n\n## Theming\n\nYou can theme a prompt by passing a `theme` object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest.\n\n```ts\ntype Theme = {\n  prefix: string | { idle: string; done: string };\n  spinner: {\n    interval: number;\n    frames: string[];\n  };\n  style: {\n    answer: (text: string) => string;\n    message: (text: string, status: 'idle' | 'done' | 'loading') => string;\n    error: (text: string) => string;\n    defaultAnswer: (text: string) => string;\n    help: (text: string) => string;\n    highlight: (text: string) => string;\n    key: (text: string) => string;\n    disabledChoice: (text: string) => string;\n    description: (text: string) => string;\n    renderSelectedChoices: <T>(\n      selectedChoices: ReadonlyArray<Choice<T>>,\n      allChoices: ReadonlyArray<Choice<T> | Separator>,\n    ) => string;\n    keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;\n  };\n  icon: {\n    checked: string;\n    unchecked: string;\n    cursor: string;\n  };\n  keybindings: readonly ('emacs' | 'vim')[];\n};\n```\n\n### `theme.style.keysHelpTip`\n\nThis function allows you to customize the keyboard shortcuts help tip displayed below the prompt. It receives an array of key-action pairs and should return a formatted string. You can also hook here to localize the labels to different languages.\n\nIt can also returns `undefined` to hide the help tip entirely.\n\n```js\ntheme: {\n  style: {\n    keysHelpTip: (keys) => {\n      // Return undefined to hide the help tip completely\n      return undefined;\n\n      // Or customize the formatting. Or localize the labels.\n      return keys.map(([key, action]) => `${key}: ${action}`).join(' | ');\n    };\n  }\n}\n```\n\n# License\n\nCopyright (c) 2023 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>\nLicensed under the MIT license.\n","publish_time":1787160735695,"_cnpm_publish_time":1787160735695,"dist-tags":{"latest":"5.3.0"}}