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

react-responsive-pagination

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-responsive-pagination - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0-beta.1

dist/tsdoc-metadata.json

7

CHANGELOG.md
# React Responsive Pagination Changelog
# [2.6.0-beta.1](https://github.com/jonelantha/react-responsive-pagination/compare/v2.5.0...v2.6.0-beta.1) (2024-05-09)
### Features
* Streamlined d.ts files (reduced package size) ([300b757](https://github.com/jonelantha/react-responsive-pagination/commit/300b75782013b4f40562baed77de09a54b52399b))
# [2.5.0](https://github.com/jonelantha/react-responsive-pagination/compare/v2.4.4...v2.5.0) (2024-05-09)

@@ -4,0 +11,0 @@

160

dist/index.d.ts

@@ -1,10 +0,140 @@

import React, { ReactNode } from 'react';
import { NarrowBehaviour } from './narrowBehaviour.js';
import { LabelBehaviour } from './labelBehaviour.js';
import { default as React_2 } from 'react';
import { ReactNode } from 'react';
declare type BaseItem = {
type: string;
key: string;
label: string | ReactNode;
a11yLabel?: string;
};
/**
* legacy - may be removed
* @public
*/
export declare const bootstrap4PaginationPreset: {};
/**
* legacy - may be removed
* @public
*/
export declare const bootstrap5PaginationPreset: {};
declare const _default: React.MemoExoticComponent<typeof ResponsivePaginationDev>;
declare type ClickableItem = BaseItem & {
gotoPage: number;
active?: boolean;
};
/**
* Combine two or more narrowBehaviours
* @public
*/
export declare const combine: (...behaviours: ReadonlyArray<NarrowBehaviour>) => NarrowBehaviour;
declare type CompositionActivePage = {
type: 'active';
page: number;
};
declare type CompositionEllipsis = {
type: '…L' | '…R';
page: undefined;
};
declare type CompositionItem = CompositionPage | CompositionActivePage | CompositionEllipsis | CompositionPrevious | CompositionNext;
declare type CompositionNext = {
type: '>';
page: number | undefined;
};
declare type CompositionPage = {
type: 'page';
page: number;
};
declare type CompositionPrevious = {
type: '<';
page: number | undefined;
};
declare const _default: React_2.MemoExoticComponent<React_2.FC<ResponsivePaginationProps>>;
export default _default;
declare function ResponsivePaginationDev(props: ResponsivePaginationProps): React.JSX.Element | null;
export type ResponsivePaginationProps = {
/**
* @public
*/
export declare function defaultLabelBehaviour({ a11yLabel, label }: PaginationItem): string | number | boolean | Iterable<React_2.ReactNode> | React_2.JSX.Element | null | undefined;
/**
* @public
*/
export declare function dropEllipsis(initialComposition: ReadonlyArray<CompositionItem>, metaData?: NarrowBehaviourMetaData): Generator<CompositionItem[], void, unknown>;
/**
* @public
*/
export declare function dropEllipsisThenNav(initialComposition: ReadonlyArray<CompositionItem>): Generator<CompositionItem[], void, unknown>;
/**
* @public
*/
export declare function dropFirstAndLast(initialComposition: ReadonlyArray<CompositionItem>, metaData?: NarrowBehaviourMetaData): Generator<CompositionItem[], void, unknown>;
/**
* @public
*/
export declare function dropNav(initialComposition: ReadonlyArray<CompositionItem>): Generator<CompositionItem[], void, unknown>;
/**
* @public
*/
export declare function dropNavThenEllipsis(initialComposition: ReadonlyArray<CompositionItem>): Generator<CompositionItem[], void, unknown>;
declare type EllipsisItem = NonClickableItem & {
type: 'ellipsis';
};
/**
* @public
*/
export declare type LabelBehaviour = (item: PaginationItem) => React_2.ReactNode;
/**
* NarrowBehaviours will yield their narrowest composition first and then
* yield a less narrow composition
* They should not yield the initialComposition
* @public
*/
export declare type NarrowBehaviour = (composition: ReadonlyArray<CompositionItem>, metaData?: NarrowBehaviourMetaData) => Generator<CompositionItem[]>;
declare type NarrowBehaviourMetaData = {
appliedBehaviours?: NarrowBehaviour[];
};
declare type NavDisabledItem = NonClickableItem & {
type: NavType;
};
declare type NavItem = ClickableItem & {
type: NavType;
};
declare type NavType = 'next' | 'previous';
declare type NonClickableItem = BaseItem & {
gotoPage: undefined;
a11yHidden?: boolean;
};
declare type PageItem = ClickableItem & {
type: 'page';
};
declare type PaginationItem = NavItem | NavDisabledItem | EllipsisItem | PageItem;
/**
* @public
*/
export declare type ResponsivePaginationProps = {
current: number;

@@ -34,1 +164,19 @@ total: number;

};
/**
* @public
*/
export declare function srOnlySpanLabel({ a11yActiveLabel, srOnlyClassName, }?: {
a11yActiveLabel?: string;
srOnlyClassName?: string;
}): (item: PaginationItem) => React_2.JSX.Element;
/**
* @public
*/
export declare const v1_bootstrap4PaginationPreset: {
ariaCurrentAttr: false;
labelBehaviour: LabelBehaviour;
};
export { }

6

dist/index.js

@@ -7,5 +7,5 @@ import React, { memo, useEffect } from 'react';

import { incRenderCount } from './debug.js';
/* legacy - may be removed */
export const bootstrap4PaginationPreset = {};
export const bootstrap5PaginationPreset = {};
export * from './narrowBehaviour.js';
export * from './presets.js';
export * from './labelBehaviour.js';
export default process.env.NODE_ENV !== 'production'

@@ -12,0 +12,0 @@ ? memo(ResponsivePaginationDev)

@@ -1,8 +0,1 @@

import React from 'react';
import { PaginationItem } from './paginationItem.js';
export type LabelBehaviour = (item: PaginationItem) => React.ReactNode;
export declare function defaultLabelBehaviour({ a11yLabel, label }: PaginationItem): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
export declare function srOnlySpanLabel({ a11yActiveLabel, srOnlyClassName, }?: {
a11yActiveLabel?: string;
srOnlyClassName?: string;
}): (item: PaginationItem) => React.JSX.Element;
export { srOnlySpanLabel, defaultLabelBehaviour } from './index.js';
import React from 'react';
/**
* @public
*/
export function defaultLabelBehaviour({ a11yLabel, label }) {
return !a11yLabel ? label : React.createElement("span", { "aria-hidden": "true" }, label);
}
/**
* @public
*/
export function srOnlySpanLabel({ a11yActiveLabel = '(current)', srOnlyClassName = 'sr-only', } = {}) {

@@ -6,0 +12,0 @@ return (item) => {

@@ -1,27 +0,8 @@

import { CompositionItem } from './compositionItem.js';
/**
* NarrowBehaviours will yield their narrowest composition first and then
* yield a less narrow composition
* They should not yield the initialComposition
*/
export type NarrowBehaviour = (composition: ReadonlyArray<CompositionItem>, metaData?: NarrowBehaviourMetaData) => Generator<CompositionItem[]>;
type NarrowBehaviourMetaData = {
appliedBehaviours?: NarrowBehaviour[];
};
export declare function dropEllipsis(initialComposition: ReadonlyArray<CompositionItem>, metaData?: NarrowBehaviourMetaData): Generator<CompositionItem[], void, unknown>;
export declare function dropNav(initialComposition: ReadonlyArray<CompositionItem>): Generator<CompositionItem[], void, unknown>;
export declare function dropFirstAndLast(initialComposition: ReadonlyArray<CompositionItem>, metaData?: NarrowBehaviourMetaData): Generator<CompositionItem[], void, unknown>;
export declare function dropEllipsisThenNav(initialComposition: ReadonlyArray<CompositionItem>): Generator<CompositionItem[], void, unknown>;
export declare function dropNavThenEllipsis(initialComposition: ReadonlyArray<CompositionItem>): Generator<CompositionItem[], void, unknown>;
/**
* When combining NarrowBehaviours the behaviours will be applied in order:
* the first behaviour will be used before subsequent behaviours
* Compositions yielded from combineBehaviours will initially have
* all behaviours applied in their narrowest form and then work through
* each behaviour in turn (from last to first)
*/
/**
* Combine two or more narrowBehaviours
*/
export declare const combine: (...behaviours: ReadonlyArray<NarrowBehaviour>) => NarrowBehaviour;
export {};
export {
dropEllipsis,
dropNav,
dropFirstAndLast,
dropEllipsisThenNav,
dropNavThenEllipsis,
combine,
} from './index.js';
import { containsEllipsis, createEllipsis, getLastPage, isEllipsis, isNav, isPageWithNumber, compositionMatches, compositionMatchesEnd, } from './compositionItem.js';
import { findLastIndex } from './helpers/util.js';
/**
* @public
*/
export function* dropEllipsis(initialComposition, metaData) {

@@ -23,5 +26,11 @@ const indicesToDrop = [];

}
/**
* @public
*/
export function* dropNav(initialComposition) {
yield initialComposition.filter(item => !isNav(item));
}
/**
* @public
*/
export function* dropFirstAndLast(initialComposition, metaData) {

@@ -85,2 +94,5 @@ const ellipsisDropped = metaData?.appliedBehaviours?.includes(dropEllipsis);

}
/**
* @public
*/
export function* dropEllipsisThenNav(initialComposition) {

@@ -95,2 +107,5 @@ if (containsEllipsis(initialComposition)) {

}
/**
* @public
*/
export function* dropNavThenEllipsis(initialComposition) {

@@ -111,2 +126,3 @@ if (containsEllipsis(initialComposition)) {

* Combine two or more narrowBehaviours
* @public
*/

@@ -113,0 +129,0 @@ export const combine = (...behaviours) => initialComposition => combineRecursive(behaviours, [], initialComposition);

@@ -1,7 +0,5 @@

/// <reference types="react" />
export declare const v1_bootstrap4PaginationPreset: {
ariaCurrentAttr: boolean;
labelBehaviour: (item: import("./paginationItem.js").PaginationItem) => import("react").JSX.Element;
};
export declare const bootstrap4PaginationPreset: {};
export declare const bootstrap5PaginationPreset: {};
export {
v1_bootstrap4PaginationPreset,
bootstrap4PaginationPreset,
bootstrap5PaginationPreset,
} from './index.js';
import { srOnlySpanLabel } from './labelBehaviour.js';
/**
* @public
*/
export const v1_bootstrap4PaginationPreset = {

@@ -6,3 +9,11 @@ ariaCurrentAttr: false,

};
/**
* legacy - may be removed
* @public
*/
export const bootstrap4PaginationPreset = {};
/**
* legacy - may be removed
* @public
*/
export const bootstrap5PaginationPreset = {};
{
"name": "react-responsive-pagination",
"version": "2.5.0",
"version": "2.6.0-beta.1",
"description": "React component for responsive pagination",

@@ -38,3 +38,3 @@ "author": "jonelantha",

"scripts": {
"build": "npm run lint && rimraf dist/ && tsc --project ./tsconfig.prod.json",
"build": "npm run lint && rimraf dist/ && tsc --project ./tsconfig.prod.json && npm run api-extractor && npm run copy-extra-types",
"start": "rimraf dist/ && tsc --project ./tsconfig.dev.json --watch",

@@ -45,3 +45,5 @@ "test": "jest",

"release": "rm ../../package.json && semantic-release",
"previewReleaseNotes": "semantic-release --dry-run"
"previewReleaseNotes": "semantic-release --dry-run",
"api-extractor": "api-extractor run --local --verbose",
"copy-extra-types": "cp ./src/*.d.ts ./dist"
},

@@ -70,2 +72,3 @@ "keywords": [

"devDependencies": {
"@microsoft/api-extractor": "^7.43.3",
"@semantic-release/changelog": "^6.0.3",

@@ -72,0 +75,0 @@ "@semantic-release/git": "^10.0.1",

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