Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@inquirer/checkbox

Package Overview
Dependencies
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inquirer/checkbox - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

44

./dist/cjs/index.js

@@ -17,3 +17,2 @@ "use strict";

const { prefix = (0, core_1.usePrefix)(), instructions } = config;
const paginator = (0, core_1.useRef)(new core_1.Paginator()).current;
const [status, setStatus] = (0, core_1.useState)('pending');

@@ -74,2 +73,25 @@ const [choices, setChoices] = (0, core_1.useState)(() => config.choices.map((choice) => (Object.assign({}, choice))));

const message = chalk_1.default.bold(config.message);
const allChoices = choices
.map((choice, index) => {
if (core_1.Separator.isSeparator(choice)) {
return ` ${choice.separator}`;
}
const line = choice.name || choice.value;
if (choice.disabled) {
const disabledLabel = typeof choice.disabled === 'string' ? choice.disabled : '(disabled)';
return chalk_1.default.dim(`- ${line} ${disabledLabel}`);
}
const checkbox = choice.checked
? chalk_1.default.green(figures_1.default.circleFilled)
: figures_1.default.circle;
if (index === cursorPosition) {
return chalk_1.default.cyan(`${figures_1.default.pointer}${checkbox} ${line}`);
}
return ` ${checkbox} ${line}`;
})
.join('\n');
const windowedChoices = (0, core_1.usePagination)(allChoices, {
active: cursorPosition,
pageSize: config.pageSize,
});
if (status === 'done') {

@@ -96,23 +118,3 @@ const selection = choices

}
const allChoices = choices
.map((choice, index) => {
if (core_1.Separator.isSeparator(choice)) {
return ` ${choice.separator}`;
}
const line = choice.name || choice.value;
if (choice.disabled) {
const disabledLabel = typeof choice.disabled === 'string' ? choice.disabled : '(disabled)';
return chalk_1.default.dim(`- ${line} ${disabledLabel}`);
}
const checkbox = choice.checked
? chalk_1.default.green(figures_1.default.circleFilled)
: figures_1.default.circle;
if (index === cursorPosition) {
return chalk_1.default.cyan(`${figures_1.default.pointer}${checkbox} ${line}`);
}
return ` ${checkbox} ${line}`;
})
.join('\n');
const windowedChoices = paginator.paginate(allChoices, cursorPosition, config.pageSize);
return `${prefix} ${message}${helpTip}\n${windowedChoices}${ansi_escapes_1.default.cursorHide}`;
});

@@ -17,3 +17,2 @@ "use strict";

const { prefix = (0, core_1.usePrefix)(), instructions } = config;
const paginator = (0, core_1.useRef)(new core_1.Paginator()).current;
const [status, setStatus] = (0, core_1.useState)('pending');

@@ -74,2 +73,25 @@ const [choices, setChoices] = (0, core_1.useState)(() => config.choices.map((choice) => (Object.assign({}, choice))));

const message = chalk_1.default.bold(config.message);
const allChoices = choices
.map((choice, index) => {
if (core_1.Separator.isSeparator(choice)) {
return ` ${choice.separator}`;
}
const line = choice.name || choice.value;
if (choice.disabled) {
const disabledLabel = typeof choice.disabled === 'string' ? choice.disabled : '(disabled)';
return chalk_1.default.dim(`- ${line} ${disabledLabel}`);
}
const checkbox = choice.checked
? chalk_1.default.green(figures_1.default.circleFilled)
: figures_1.default.circle;
if (index === cursorPosition) {
return chalk_1.default.cyan(`${figures_1.default.pointer}${checkbox} ${line}`);
}
return ` ${checkbox} ${line}`;
})
.join('\n');
const windowedChoices = (0, core_1.usePagination)(allChoices, {
active: cursorPosition,
pageSize: config.pageSize,
});
if (status === 'done') {

@@ -96,23 +118,3 @@ const selection = choices

}
const allChoices = choices
.map((choice, index) => {
if (core_1.Separator.isSeparator(choice)) {
return ` ${choice.separator}`;
}
const line = choice.name || choice.value;
if (choice.disabled) {
const disabledLabel = typeof choice.disabled === 'string' ? choice.disabled : '(disabled)';
return chalk_1.default.dim(`- ${line} ${disabledLabel}`);
}
const checkbox = choice.checked
? chalk_1.default.green(figures_1.default.circleFilled)
: figures_1.default.circle;
if (index === cursorPosition) {
return chalk_1.default.cyan(`${figures_1.default.pointer}${checkbox} ${line}`);
}
return ` ${checkbox} ${line}`;
})
.join('\n');
const windowedChoices = paginator.paginate(allChoices, cursorPosition, config.pageSize);
return `${prefix} ${message}${helpTip}\n${windowedChoices}${ansi_escapes_1.default.cursorHide}`;
});
{
"name": "@inquirer/checkbox",
"version": "1.3.4",
"version": "1.3.5",
"engines": {

@@ -60,3 +60,3 @@ "node": ">=14.18.0"

"dependencies": {
"@inquirer/core": "^2.3.1",
"@inquirer/core": "^3.0.0",
"@inquirer/type": "^1.1.1",

@@ -92,3 +92,3 @@ "ansi-escapes": "^4.3.2",

},
"gitHead": "b1b29c0b6da9420d739cd46704c205515de2db04"
"gitHead": "18144628b03b62c346cb7d9d55a2c526b1ed5d8a"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc