one
Version:
One is a React framework for web, iOS, and Android apps.
20 lines (18 loc) • 1.35 kB
JavaScript
function validatePager({ initialPage = 0, pageMargin = 0, offscreenPageLimit, orientation = "horizontal", layoutDirection = "ltr", keyboardDismissMode = "none", overScrollMode = "auto" }) {
validatePage(initialPage);
if (!Number.isFinite(pageMargin) || pageMargin < 0) throw new Error("Pager.pageMargin must be a finite nonnegative number");
if (offscreenPageLimit !== void 0 && offscreenPageLimit !== -1 && (!Number.isInteger(offscreenPageLimit) || offscreenPageLimit < 1)) throw new Error("Pager.offscreenPageLimit must be -1 or a positive integer");
if (orientation !== "horizontal" && orientation !== "vertical") throw new Error("Pager.orientation must be horizontal or vertical");
if (layoutDirection !== "ltr" && layoutDirection !== "rtl") throw new Error("Pager.layoutDirection must be ltr or rtl");
if (keyboardDismissMode !== "none" && keyboardDismissMode !== "on-drag") throw new Error("Pager.keyboardDismissMode must be none or on-drag");
if (![
"auto",
"always",
"never"
].includes(overScrollMode)) throw new Error("Pager.overScrollMode must be auto, always or never");
}
function validatePage(index) {
if (!Number.isInteger(index) || index < 0 || index > 2147483647) throw new Error("Pager page index must be a nonnegative 32-bit integer");
}
export { validatePage, validatePager };
//# sourceMappingURL=pagerTypes.mjs.map