@inquirer/core
Advanced tools
Comparing version 7.1.3 to 8.0.0
@@ -6,8 +6,6 @@ "use strict"; | ||
const utils_mjs_1 = require('../utils.js'); | ||
const make_theme_mjs_1 = require('../make-theme.js'); | ||
const lines_mjs_1 = require('./lines.js'); | ||
const position_mjs_1 = require('./position.js'); | ||
function usePagination({ items, active, renderItem, pageSize, loop = true, theme: defaultTheme, }) { | ||
function usePagination({ items, active, renderItem, pageSize, loop = true, }) { | ||
const state = (0, use_ref_mjs_1.useRef)({ position: 0, lastActive: 0 }); | ||
const theme = (0, make_theme_mjs_1.makeTheme)(defaultTheme); | ||
const position = loop | ||
@@ -28,3 +26,3 @@ ? (0, position_mjs_1.infinite)({ | ||
state.current.lastActive = active; | ||
const visibleLines = (0, lines_mjs_1.lines)({ | ||
return (0, lines_mjs_1.lines)({ | ||
items, | ||
@@ -37,7 +35,3 @@ width: (0, utils_mjs_1.readlineWidth)(), | ||
}).join('\n'); | ||
if (items.length > pageSize) { | ||
return `${visibleLines}\n${theme.style.help('(Use arrow keys to reveal more choices)')}`; | ||
} | ||
return visibleLines; | ||
} | ||
exports.usePagination = usePagination; |
import type { Prettify } from '@inquirer/type'; | ||
import { type Theme } from '../theme.js'; | ||
import { type Layout } from './lines.js'; | ||
export declare function usePagination<T>({ items, active, renderItem, pageSize, loop, theme: defaultTheme, }: { | ||
export declare function usePagination<T>({ items, active, renderItem, pageSize, loop, }: { | ||
items: readonly T[]; | ||
@@ -6,0 +6,0 @@ /** The index of the active item. */ |
{ | ||
"name": "@inquirer/core", | ||
"version": "7.1.3", | ||
"version": "8.0.0", | ||
"engines": { | ||
@@ -61,5 +61,5 @@ "node": ">=18" | ||
"@inquirer/figures": "^1.0.0", | ||
"@inquirer/type": "^1.2.2", | ||
"@inquirer/type": "^1.3.0", | ||
"@types/mute-stream": "^0.0.4", | ||
"@types/node": "^20.12.4", | ||
"@types/node": "^20.12.7", | ||
"@types/wrap-ansi": "^3.0.0", | ||
@@ -76,3 +76,3 @@ "ansi-escapes": "^4.3.2", | ||
"devDependencies": { | ||
"@inquirer/testing": "^2.1.16" | ||
"@inquirer/testing": "^2.1.17" | ||
}, | ||
@@ -100,3 +100,3 @@ "scripts": { | ||
}, | ||
"gitHead": "6bfbdfc457ab6d99b9d80c106b5edad285c8b9ba" | ||
"gitHead": "bb5b6b857d227b0fe8fd55951784f03800cdf73c" | ||
} |
@@ -144,3 +144,2 @@ # `@inquirer/core` | ||
loop: config.loop, | ||
theme, config.theme, | ||
}); | ||
@@ -147,0 +146,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83114
1627
223
Updated@inquirer/type@^1.3.0
Updated@types/node@^20.12.7