@visa/nova-react
Version:
Visa Product Design System Nova React library
45 lines (44 loc) • 1.74 kB
TypeScript
/**
* Copyright (c) 2025 Visa, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/
/**
* Calculates how many pages there are
* @param {number} items - how many items we have
* @param {number} itemsPerPage - how many items there are, per page
* @returns {number} how many pages there are in total
*/
export declare const calculateTotalPages: (items: number, itemsPerPage: number) => number;
/**
* Calculates which range of items that is currently visible from pagination
* @param {number} items - how many items we have
* @param {number} itemsPerPage - how many items there are, per page
* @param {number} currentPage - which page is visible
* @param {number} startPage - which page we're starting from, defaults to page 1 (optional)
* @returns to from object with calculated values
*/
export declare const calculatePagesFromTo: (items: number, itemsPerPage: number, currentPage: number, startPage?: number) => {
0: number;
1: number;
from: number;
to: number;
};
/**
* Generates an array from number to from + length
* @param {number} from
* @param {number} length
* @returns {number[]}
*/
export declare const generateArray: (from: number, length: number) => number[];