@rubenpazch/pagination 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/dist/Pagination.d.ts +7 -2
- package/dist/Pagination.d.ts.map +1 -1
- package/dist/PaginationItem.d.ts.map +1 -1
- package/dist/index.cjs.js +41 -33
- package/dist/index.d.ts +7 -2
- package/dist/index.esm.js +48 -22
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
1
|
# Pagination
|
|
2
2
|
|
|
3
3
|
Generated component package.
|
|
4
|
+
|
|
5
|
+
<!-- catalogo:inicio (generado por pnpm catalogo, no editar) -->
|
|
6
|
+
|
|
7
|
+
Paginación con variantes, tamaños y formas; incluye PaginationItem.
|
|
8
|
+
|
|
9
|
+
- **Usar cuando:** Listados paginados en el servidor (tablas, resultados de búsqueda).
|
|
10
|
+
- **Evitar cuando:** Pocas páginas que caben en una sola vista.
|
|
11
|
+
|
|
12
|
+
Se recomienda instalar el paquete completo `@rubenpazch/ui` (incluye este). Por separado:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @rubenpazch/pagination
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Pagination
|
|
19
|
+
|
|
20
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
21
|
+
| ----------------- | -------------------------------------------------------------- | ---- | ------------ | ----------------------------------------------------------------------------------- |
|
|
22
|
+
| `aria-label` | `string` | | `Paginación` | Nombre accesible de la navegación (por defecto "Paginación"). |
|
|
23
|
+
| `boundaryCount` | `number` | | `1` | Number of always visible pages at the beginning and end |
|
|
24
|
+
| `count` | `number` | | `1` | Total number of pages |
|
|
25
|
+
| `defaultPage` | `number` | | `1` | Default page if uncontrolled |
|
|
26
|
+
| `disabled` | `boolean` | | `false` | If true, the component is disabled |
|
|
27
|
+
| `hideNextButton` | `boolean` | | `false` | If true, hide the next-page button |
|
|
28
|
+
| `hidePrevButton` | `boolean` | | `false` | If true, hide the previous-page button |
|
|
29
|
+
| `onChange` | `(event: ChangeEvent<unknown, Element>, page: number) => void` | | | Al cambiar de página, estilo MUI: (evento, página). Se mantiene por compatibilidad. |
|
|
30
|
+
| `onPageChange` | `(page: number) => void` | | | Al cambiar de página (recibe solo el número). Preferido sobre onChange. |
|
|
31
|
+
| `page` | `number` | | | The current page (1-based) |
|
|
32
|
+
| `renderItem` | `(item: PaginationItemType) => ReactNode` | | | Custom render function for items |
|
|
33
|
+
| `shape` | `"rounded" \| "circular"` | | `rounded` | The shape of the pagination items |
|
|
34
|
+
| `showFirstButton` | `boolean` | | `false` | If true, show the first-page button |
|
|
35
|
+
| `showLastButton` | `boolean` | | `false` | If true, show the last-page button |
|
|
36
|
+
| `siblingCount` | `number` | | `1` | Number of always visible pages before and after the current page |
|
|
37
|
+
| `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | | `medium` | The size of the pagination component |
|
|
38
|
+
| `variant` | `"text" \| "outlined"` | | `text` | The variant to use |
|
|
39
|
+
|
|
40
|
+
## PaginationItem
|
|
41
|
+
|
|
42
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
43
|
+
| ---------- | ------------------------------------------------------------------------------------------- | ---- | ----------- | ------------------------------------ |
|
|
44
|
+
| `page` | `number` | sí | | The page number |
|
|
45
|
+
| `type` | `"page" \| "next" \| "previous" \| "first" \| "last" \| "start-ellipsis" \| "end-ellipsis"` | sí | | The type of pagination item |
|
|
46
|
+
| `selected` | `boolean` | | `false` | If true, the item is selected/active |
|
|
47
|
+
| `shape` | `"rounded" \| "circular"` | | `rounded` | The shape of the pagination items |
|
|
48
|
+
| `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | | `medium` | The size of the component |
|
|
49
|
+
| `variant` | `"text" \| "outlined"` | | `text` | The variant to use |
|
|
50
|
+
|
|
51
|
+
Tipos: `PaginationProps`, `PaginationShape`, `PaginationSize`, `PaginationVariant`, `PaginationItemType`, `PaginationItemProps`.
|
|
52
|
+
|
|
53
|
+
<!-- catalogo:fin -->
|
package/dist/Pagination.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export type PaginationShape = "rounded" | "circular";
|
|
3
|
-
|
|
3
|
+
/** Tamaño: sm, md, lg (estándar) o small, medium, large. */
|
|
4
|
+
export type PaginationSize = "small" | "medium" | "large" | "sm" | "md" | "lg";
|
|
4
5
|
export type PaginationVariant = "text" | "outlined";
|
|
5
6
|
export interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>, "onChange"> {
|
|
6
7
|
/** Total number of pages */
|
|
@@ -9,8 +10,12 @@ export interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
|
9
10
|
page?: number;
|
|
10
11
|
/** Default page if uncontrolled */
|
|
11
12
|
defaultPage?: number;
|
|
12
|
-
/**
|
|
13
|
+
/** Al cambiar de página (recibe solo el número). Preferido sobre onChange. */
|
|
14
|
+
onPageChange?: (page: number) => void;
|
|
15
|
+
/** Al cambiar de página, estilo MUI: (evento, página). Se mantiene por compatibilidad. */
|
|
13
16
|
onChange?: (event: React.ChangeEvent<unknown>, page: number) => void;
|
|
17
|
+
/** Nombre accesible de la navegación (por defecto "Paginación"). */
|
|
18
|
+
"aria-label"?: string;
|
|
14
19
|
/** If true, the component is disabled */
|
|
15
20
|
disabled?: boolean;
|
|
16
21
|
/** If true, hide the next-page button */
|
package/dist/Pagination.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../src/Pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../src/Pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,CAAC;AACrD,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEpD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,UAAU,CACX;IACC,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yCAAyC;IACzC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,yBAAyB;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,uCAAuC;IACvC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,KAAK,CAAC,SAAS,CAAC;CAC5D;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,UAAU,GACV,gBAAgB,GAChB,cAAc,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAC/D;AAgID,QAAA,MAAM,UAAU,qFAkHf,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationItem.d.ts","sourceRoot":"","sources":["../src/PaginationItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PaginationItem.d.ts","sourceRoot":"","sources":["../src/PaginationItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,MAAM,CACP;IACC,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,EACA,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,UAAU,GACV,gBAAgB,GAChB,cAAc,CAAC;IACnB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wCAAwC;IACxC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,gCAAgC;IAChC,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,yBAAyB;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAWD,QAAA,MAAM,cAAc,+FAwInB,CAAC;AAIF,eAAe,cAAc,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
|
|
5
|
-
function _interopNamespaceDefault(e) {
|
|
6
|
-
var n = Object.create(null);
|
|
7
|
-
if (e) {
|
|
8
|
-
Object.keys(e).forEach(function (k) {
|
|
9
|
-
if (k !== 'default') {
|
|
10
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return e[k]; }
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
n.default = e;
|
|
19
|
-
return Object.freeze(n);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
4
|
+
var shared = require('@rubenpazch/shared');
|
|
23
5
|
|
|
24
6
|
var jsxRuntime = {exports: {}};
|
|
25
7
|
|
|
@@ -443,7 +425,22 @@ function requireJsxRuntime () {
|
|
|
443
425
|
|
|
444
426
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
445
427
|
|
|
446
|
-
var
|
|
428
|
+
var e$1={exports:{}};
|
|
429
|
+
|
|
430
|
+
var r$3={};
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* @license React
|
|
434
|
+
* react-jsx-runtime.production.js
|
|
435
|
+
*
|
|
436
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
437
|
+
*
|
|
438
|
+
* This source code is licensed under the MIT license found in the
|
|
439
|
+
* LICENSE file in the root directory of this source tree.
|
|
440
|
+
*/var e;function t$2(){if(e)return r$3;e=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function n(r,e,o){var n=null;if(void 0!==o&&(n=""+o),void 0!==e.key&&(n=""+e.key),"key"in e)for(var i in o={},e)"key"!==i&&(o[i]=e[i]);else o=e;return e=o.ref,{$$typeof:t,type:r,key:n,ref:void 0!==e?e:null,props:o}}return r$3.Fragment=o,r$3.jsx=n,r$3.jsxs=n,r$3}
|
|
441
|
+
|
|
442
|
+
var r$2={};
|
|
443
|
+
|
|
447
444
|
/**
|
|
448
445
|
* @license React
|
|
449
446
|
* react-jsx-runtime.development.js
|
|
@@ -452,7 +449,15 @@ var r,o={exports:{}},t={};var l,n,a={};
|
|
|
452
449
|
*
|
|
453
450
|
* This source code is licensed under the MIT license found in the
|
|
454
451
|
* LICENSE file in the root directory of this source tree.
|
|
455
|
-
*/function
|
|
452
|
+
*/var t$1;function n(){return t$1||(t$1=1,"production"!==process.env.NODE_ENV&&function(){function t(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===N?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return "Fragment";case _:return "Profiler";case b:return "StrictMode";case S:return "Suspense";case j:return "SuspenseList";case w:return "Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return "Portal";case g:return e.displayName||"Context";case v:return (e._context.displayName||"Context")+".Consumer";case k:var r=e.render;return (e=e.displayName)||(e=""!==(e=r.displayName||r.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case h:return null!==(r=e.displayName||null)?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch(e){}}return null}function n(e){return ""+e}function o(e){try{n(e);var r=!1;}catch(e){r=true;}if(r){var t=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),n(e)}}function a(e){if(e===d)return "<>";if("object"==typeof e&&null!==e&&e.$$typeof===O)return "<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch(e){return "<...>"}}function l(){return Error("react-stack-top-frame")}function i(){var e=t(this.type);return P[e]||(P[e]=true,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(e=this.props.ref)?e:null}function c(e,r,n,a,l,c){var u,y=r.children;if(void 0!==y)if(a)if(x(y)){for(a=0;a<y.length;a++)s(y[a]);Object.freeze&&Object.freeze(y);}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else s(y);if(T.call(r,"key")){y=t(e);var m=Object.keys(r).filter(function(e){return "key"!==e});a=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",C[y+a]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',a,y,m,y),C[y+a]=true);}if(y=null,void 0!==n&&(o(n),y=""+n),function(e){if(T.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return false}return void 0!==e.key}(r)&&(o(r.key),y=""+r.key),"key"in r)for(var d in n={},r)"key"!==d&&(n[d]=r[d]);else n=r;return y&&function(e,r){function t(){f||(f=true,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r));}t.isReactWarning=true,Object.defineProperty(e,"key",{get:t,configurable:true});}(n,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,r,t,n,o,a){var l=t.ref;return e={$$typeof:p,type:e,key:r,props:t,_owner:n},null!==(void 0!==l?l:null)?Object.defineProperty(e,"ref",{enumerable:false,get:i}):Object.defineProperty(e,"ref",{enumerable:false,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(e,"_debugStack",{configurable:false,enumerable:false,writable:true,value:o}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,y,n,null===(u=R.A)?null:u.getOwner(),l,c)}function s(e){u(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===O&&("fulfilled"===e._payload.status?u(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function u(e){return "object"==typeof e&&null!==e&&e.$$typeof===p}var f,y=React,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),g=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),R=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,x=Array.isArray,E=console.createTask?console.createTask:function(){return null},P={},$=(y={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(y,l)(),A=E(a(l)),C={};r$2.Fragment=d,r$2.jsx=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,false,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)},r$2.jsxs=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,true,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)};}()),r$2}
|
|
453
|
+
|
|
454
|
+
var t;function s(){return t||(t=1,"production"===process.env.NODE_ENV?e$1.exports=t$2():e$1.exports=n()),e$1.exports}
|
|
455
|
+
|
|
456
|
+
var r$1=s();
|
|
457
|
+
|
|
458
|
+
const r={sm:16,md:20,lg:28},a=({size:a="md",direction:s="right",...e})=>{const i=r[a],l="left"===s;return r$1.jsx("svg",{width:i,height:i,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",...e,children:r$1.jsxs("g",{transform:l?"scale(-1,1) translate(-20,0)":void 0,children:[r$1.jsx("path",{d:"M7.22 5.22a.75.75 0 011.06 0l4 4a.75.75 0 010 1.06l-4 4a.75.75 0 11-1.06-1.06L10.94 10 7.22 6.28a.75.75 0 010-1.06z"}),r$1.jsx("path",{d:"M15.25 4a.75.75 0 10-1.5 0v12a.75.75 0 101.5 0V4z"})]})})};
|
|
459
|
+
|
|
460
|
+
const o=({className:o="",size:e="md",color:r="currentColor",direction:s="down"})=>{const i={sm:16,md:20,lg:24};return r$1.jsx("svg",{width:i[e],height:i[e],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[e]} ${{up:"rotate-180",down:"",left:"rotate-90",right:"-rotate-90"}[s]} ${o}`,fill:"none",stroke:r,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r$1.jsx("path",{d:"M6 9l6 6 6-6"})})};
|
|
456
461
|
|
|
457
462
|
function styleInject(css, ref) {
|
|
458
463
|
if ( ref === void 0 ) ref = {};
|
|
@@ -491,7 +496,8 @@ const iconSizeMap = {
|
|
|
491
496
|
medium: "md",
|
|
492
497
|
large: "lg",
|
|
493
498
|
};
|
|
494
|
-
const PaginationItem = React.forwardRef(({ page, type, selected = false, disabled = false, shape = "rounded", size = "medium", variant = "text", className, ...props }, ref) => {
|
|
499
|
+
const PaginationItem = React.forwardRef(({ page, type, selected = false, disabled = false, shape = "rounded", size: sizeProp = "medium", variant = "text", className, ...props }, ref) => {
|
|
500
|
+
const size = shared.toLegacySize(sizeProp);
|
|
495
501
|
// Ellipsis are not interactive
|
|
496
502
|
if (type === "start-ellipsis" || type === "end-ellipsis") {
|
|
497
503
|
// Use ASCII ellipsis to keep output portable across environments
|
|
@@ -504,16 +510,16 @@ const PaginationItem = React.forwardRef(({ page, type, selected = false, disable
|
|
|
504
510
|
const renderNavigationIcon = () => {
|
|
505
511
|
const iconSize = iconSizeMap[size];
|
|
506
512
|
if (type === "first") {
|
|
507
|
-
return (jsxRuntimeExports.jsx(
|
|
513
|
+
return (jsxRuntimeExports.jsx(a, { direction: "left", size: iconSize, className: styles$1.icon, "aria-hidden": "true" }));
|
|
508
514
|
}
|
|
509
515
|
if (type === "last") {
|
|
510
|
-
return (jsxRuntimeExports.jsx(
|
|
516
|
+
return (jsxRuntimeExports.jsx(a, { direction: "right", size: iconSize, className: styles$1.icon, "aria-hidden": "true" }));
|
|
511
517
|
}
|
|
512
518
|
if (type === "next") {
|
|
513
|
-
return (jsxRuntimeExports.jsx(
|
|
519
|
+
return (jsxRuntimeExports.jsx(o, { direction: "right", size: iconSize, className: styles$1.icon, "aria-hidden": "true" }));
|
|
514
520
|
}
|
|
515
521
|
if (type === "previous") {
|
|
516
|
-
return (jsxRuntimeExports.jsx(
|
|
522
|
+
return (jsxRuntimeExports.jsx(o, { direction: "left", size: iconSize, className: styles$1.icon, "aria-hidden": "true" }));
|
|
517
523
|
}
|
|
518
524
|
return null;
|
|
519
525
|
};
|
|
@@ -530,14 +536,14 @@ const PaginationItem = React.forwardRef(({ page, type, selected = false, disable
|
|
|
530
536
|
};
|
|
531
537
|
const classes = classNames$1(styles$1.item, styles$1.button, styles$1[`size-${size}`], styles$1[`shape-${shape}`], styles$1[`variant-${variant}`], selected && styles$1.selected, disabled && styles$1.disabled, isNavigationButton && styles$1.navigation, className);
|
|
532
538
|
return (jsxRuntimeExports.jsx("button", { ref: ref, type: "button", className: classes, disabled: disabled, "aria-label": type === "first"
|
|
533
|
-
? "
|
|
539
|
+
? "Ir a la primera página"
|
|
534
540
|
: type === "last"
|
|
535
|
-
? "
|
|
541
|
+
? "Ir a la última página"
|
|
536
542
|
: type === "next"
|
|
537
|
-
? "
|
|
543
|
+
? "Página siguiente"
|
|
538
544
|
: type === "previous"
|
|
539
|
-
? "
|
|
540
|
-
: `
|
|
545
|
+
? "Página anterior"
|
|
546
|
+
: `Página ${page}`, "aria-current": selected ? "page" : undefined, ...props, children: getButtonContent() }));
|
|
541
547
|
});
|
|
542
548
|
PaginationItem.displayName = "PaginationItem";
|
|
543
549
|
|
|
@@ -620,7 +626,8 @@ const usePagination = (props) => {
|
|
|
620
626
|
}
|
|
621
627
|
return items;
|
|
622
628
|
};
|
|
623
|
-
const Pagination = React.forwardRef(({ count = 1, page: controlledPage, defaultPage = 1, onChange, disabled = false, hideNextButton = false, hidePrevButton = false, showFirstButton = false, showLastButton = false, boundaryCount = 1, siblingCount = 1, shape = "rounded", size = "medium", variant = "text", renderItem, className, ...props }, ref) => {
|
|
629
|
+
const Pagination = React.forwardRef(({ count = 1, page: controlledPage, defaultPage = 1, onChange, onPageChange, "aria-label": ariaLabel = "Paginación", disabled = false, hideNextButton = false, hidePrevButton = false, showFirstButton = false, showLastButton = false, boundaryCount = 1, siblingCount = 1, shape = "rounded", size: sizeProp = "medium", variant = "text", renderItem, className, ...props }, ref) => {
|
|
630
|
+
const size = shared.toLegacySize(sizeProp);
|
|
624
631
|
const [page, setPage] = React.useState(defaultPage);
|
|
625
632
|
const currentPage = controlledPage ?? page;
|
|
626
633
|
const handleClick = (event, value) => {
|
|
@@ -630,6 +637,7 @@ const Pagination = React.forwardRef(({ count = 1, page: controlledPage, defaultP
|
|
|
630
637
|
if (onChange) {
|
|
631
638
|
onChange(event, value);
|
|
632
639
|
}
|
|
640
|
+
onPageChange?.(value);
|
|
633
641
|
};
|
|
634
642
|
const items = usePagination({
|
|
635
643
|
count,
|
|
@@ -642,7 +650,7 @@ const Pagination = React.forwardRef(({ count = 1, page: controlledPage, defaultP
|
|
|
642
650
|
hidePrevButton,
|
|
643
651
|
});
|
|
644
652
|
const classes = classNames(styles.root, className);
|
|
645
|
-
return (jsxRuntimeExports.jsx("nav", { ref: ref, className: classes, ...props, children: jsxRuntimeExports.jsx("ul", { className: styles.ul, children: items.map((item, index) => {
|
|
653
|
+
return (jsxRuntimeExports.jsx("nav", { ref: ref, className: classes, "aria-label": ariaLabel, ...props, children: jsxRuntimeExports.jsx("ul", { className: styles.ul, children: items.map((item, index) => {
|
|
646
654
|
const isDisabled = disabled || item.disabled;
|
|
647
655
|
if (renderItem) {
|
|
648
656
|
return (jsxRuntimeExports.jsx("li", { children: renderItem({
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
type PaginationShape = "rounded" | "circular";
|
|
4
|
-
|
|
4
|
+
/** Tamaño: sm, md, lg (estándar) o small, medium, large. */
|
|
5
|
+
type PaginationSize = "small" | "medium" | "large" | "sm" | "md" | "lg";
|
|
5
6
|
type PaginationVariant = "text" | "outlined";
|
|
6
7
|
interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>, "onChange"> {
|
|
7
8
|
/** Total number of pages */
|
|
@@ -10,8 +11,12 @@ interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>, "onCha
|
|
|
10
11
|
page?: number;
|
|
11
12
|
/** Default page if uncontrolled */
|
|
12
13
|
defaultPage?: number;
|
|
13
|
-
/**
|
|
14
|
+
/** Al cambiar de página (recibe solo el número). Preferido sobre onChange. */
|
|
15
|
+
onPageChange?: (page: number) => void;
|
|
16
|
+
/** Al cambiar de página, estilo MUI: (evento, página). Se mantiene por compatibilidad. */
|
|
14
17
|
onChange?: (event: React.ChangeEvent<unknown>, page: number) => void;
|
|
18
|
+
/** Nombre accesible de la navegación (por defecto "Paginación"). */
|
|
19
|
+
"aria-label"?: string;
|
|
15
20
|
/** If true, the component is disabled */
|
|
16
21
|
disabled?: boolean;
|
|
17
22
|
/** If true, hide the next-page button */
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { toLegacySize } from '@rubenpazch/shared';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = {exports: {}};
|
|
5
5
|
|
|
@@ -337,7 +337,7 @@ function requireReactJsxRuntime_development () {
|
|
|
337
337
|
object.$$typeof === REACT_ELEMENT_TYPE
|
|
338
338
|
);
|
|
339
339
|
}
|
|
340
|
-
var React =
|
|
340
|
+
var React$1 = React,
|
|
341
341
|
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
342
342
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
343
343
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
@@ -353,7 +353,7 @@ function requireReactJsxRuntime_development () {
|
|
|
353
353
|
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
|
|
354
354
|
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
|
|
355
355
|
ReactSharedInternals =
|
|
356
|
-
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
356
|
+
React$1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
357
357
|
hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
358
358
|
isArrayImpl = Array.isArray,
|
|
359
359
|
createTask = console.createTask
|
|
@@ -361,15 +361,15 @@ function requireReactJsxRuntime_development () {
|
|
|
361
361
|
: function () {
|
|
362
362
|
return null;
|
|
363
363
|
};
|
|
364
|
-
React = {
|
|
364
|
+
React$1 = {
|
|
365
365
|
react_stack_bottom_frame: function (callStackForError) {
|
|
366
366
|
return callStackForError();
|
|
367
367
|
}
|
|
368
368
|
};
|
|
369
369
|
var specialPropKeyWarningShown;
|
|
370
370
|
var didWarnAboutElementRef = {};
|
|
371
|
-
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
|
|
372
|
-
React,
|
|
371
|
+
var unknownOwnerDebugStack = React$1.react_stack_bottom_frame.bind(
|
|
372
|
+
React$1,
|
|
373
373
|
UnknownOwner
|
|
374
374
|
)();
|
|
375
375
|
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
@@ -423,7 +423,22 @@ function requireJsxRuntime () {
|
|
|
423
423
|
|
|
424
424
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
425
425
|
|
|
426
|
-
var
|
|
426
|
+
var e$1={exports:{}};
|
|
427
|
+
|
|
428
|
+
var r$3={};
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* @license React
|
|
432
|
+
* react-jsx-runtime.production.js
|
|
433
|
+
*
|
|
434
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
435
|
+
*
|
|
436
|
+
* This source code is licensed under the MIT license found in the
|
|
437
|
+
* LICENSE file in the root directory of this source tree.
|
|
438
|
+
*/var e;function t$2(){if(e)return r$3;e=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function n(r,e,o){var n=null;if(void 0!==o&&(n=""+o),void 0!==e.key&&(n=""+e.key),"key"in e)for(var i in o={},e)"key"!==i&&(o[i]=e[i]);else o=e;return e=o.ref,{$$typeof:t,type:r,key:n,ref:void 0!==e?e:null,props:o}}return r$3.Fragment=o,r$3.jsx=n,r$3.jsxs=n,r$3}
|
|
439
|
+
|
|
440
|
+
var r$2={};
|
|
441
|
+
|
|
427
442
|
/**
|
|
428
443
|
* @license React
|
|
429
444
|
* react-jsx-runtime.development.js
|
|
@@ -432,7 +447,15 @@ var r,o={exports:{}},t={};var l,n,a={};
|
|
|
432
447
|
*
|
|
433
448
|
* This source code is licensed under the MIT license found in the
|
|
434
449
|
* LICENSE file in the root directory of this source tree.
|
|
435
|
-
*/function
|
|
450
|
+
*/var t$1;function n(){return t$1||(t$1=1,"production"!==process.env.NODE_ENV&&function(){function t(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===N?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return "Fragment";case _:return "Profiler";case b:return "StrictMode";case S:return "Suspense";case j:return "SuspenseList";case w:return "Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return "Portal";case g:return e.displayName||"Context";case v:return (e._context.displayName||"Context")+".Consumer";case k:var r=e.render;return (e=e.displayName)||(e=""!==(e=r.displayName||r.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case h:return null!==(r=e.displayName||null)?r:t(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return t(e(r))}catch(e){}}return null}function n(e){return ""+e}function o(e){try{n(e);var r=!1;}catch(e){r=true;}if(r){var t=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),n(e)}}function a(e){if(e===d)return "<>";if("object"==typeof e&&null!==e&&e.$$typeof===O)return "<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch(e){return "<...>"}}function l(){return Error("react-stack-top-frame")}function i(){var e=t(this.type);return P[e]||(P[e]=true,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(e=this.props.ref)?e:null}function c(e,r,n,a,l,c){var u,y=r.children;if(void 0!==y)if(a)if(x(y)){for(a=0;a<y.length;a++)s(y[a]);Object.freeze&&Object.freeze(y);}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else s(y);if(T.call(r,"key")){y=t(e);var m=Object.keys(r).filter(function(e){return "key"!==e});a=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",C[y+a]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',a,y,m,y),C[y+a]=true);}if(y=null,void 0!==n&&(o(n),y=""+n),function(e){if(T.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return false}return void 0!==e.key}(r)&&(o(r.key),y=""+r.key),"key"in r)for(var d in n={},r)"key"!==d&&(n[d]=r[d]);else n=r;return y&&function(e,r){function t(){f||(f=true,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r));}t.isReactWarning=true,Object.defineProperty(e,"key",{get:t,configurable:true});}(n,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,r,t,n,o,a){var l=t.ref;return e={$$typeof:p,type:e,key:r,props:t,_owner:n},null!==(void 0!==l?l:null)?Object.defineProperty(e,"ref",{enumerable:false,get:i}):Object.defineProperty(e,"ref",{enumerable:false,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(e,"_debugStack",{configurable:false,enumerable:false,writable:true,value:o}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,y,n,null===(u=R.A)?null:u.getOwner(),l,c)}function s(e){u(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===O&&("fulfilled"===e._payload.status?u(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function u(e){return "object"==typeof e&&null!==e&&e.$$typeof===p}var f,y=React,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),g=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),R=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,x=Array.isArray,E=console.createTask?console.createTask:function(){return null},P={},$=(y={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(y,l)(),A=E(a(l)),C={};r$2.Fragment=d,r$2.jsx=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,false,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)},r$2.jsxs=function(e,r,t){var n=1e4>R.recentlyCreatedOwnerStacks++;return c(e,r,t,true,n?Error("react-stack-top-frame"):$,n?E(a(e)):A)};}()),r$2}
|
|
451
|
+
|
|
452
|
+
var t;function s(){return t||(t=1,"production"===process.env.NODE_ENV?e$1.exports=t$2():e$1.exports=n()),e$1.exports}
|
|
453
|
+
|
|
454
|
+
var r$1=s();
|
|
455
|
+
|
|
456
|
+
const r={sm:16,md:20,lg:28},a=({size:a="md",direction:s="right",...e})=>{const i=r[a],l="left"===s;return r$1.jsx("svg",{width:i,height:i,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",...e,children:r$1.jsxs("g",{transform:l?"scale(-1,1) translate(-20,0)":void 0,children:[r$1.jsx("path",{d:"M7.22 5.22a.75.75 0 011.06 0l4 4a.75.75 0 010 1.06l-4 4a.75.75 0 11-1.06-1.06L10.94 10 7.22 6.28a.75.75 0 010-1.06z"}),r$1.jsx("path",{d:"M15.25 4a.75.75 0 10-1.5 0v12a.75.75 0 101.5 0V4z"})]})})};
|
|
457
|
+
|
|
458
|
+
const o=({className:o="",size:e="md",color:r="currentColor",direction:s="down"})=>{const i={sm:16,md:20,lg:24};return r$1.jsx("svg",{width:i[e],height:i[e],className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[e]} ${{up:"rotate-180",down:"",left:"rotate-90",right:"-rotate-90"}[s]} ${o}`,fill:"none",stroke:r,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r$1.jsx("path",{d:"M6 9l6 6 6-6"})})};
|
|
436
459
|
|
|
437
460
|
function styleInject(css, ref) {
|
|
438
461
|
if ( ref === void 0 ) ref = {};
|
|
@@ -471,7 +494,8 @@ const iconSizeMap = {
|
|
|
471
494
|
medium: "md",
|
|
472
495
|
large: "lg",
|
|
473
496
|
};
|
|
474
|
-
const PaginationItem =
|
|
497
|
+
const PaginationItem = React.forwardRef(({ page, type, selected = false, disabled = false, shape = "rounded", size: sizeProp = "medium", variant = "text", className, ...props }, ref) => {
|
|
498
|
+
const size = toLegacySize(sizeProp);
|
|
475
499
|
// Ellipsis are not interactive
|
|
476
500
|
if (type === "start-ellipsis" || type === "end-ellipsis") {
|
|
477
501
|
// Use ASCII ellipsis to keep output portable across environments
|
|
@@ -484,16 +508,16 @@ const PaginationItem = React__default.forwardRef(({ page, type, selected = false
|
|
|
484
508
|
const renderNavigationIcon = () => {
|
|
485
509
|
const iconSize = iconSizeMap[size];
|
|
486
510
|
if (type === "first") {
|
|
487
|
-
return (jsxRuntimeExports.jsx(
|
|
511
|
+
return (jsxRuntimeExports.jsx(a, { direction: "left", size: iconSize, className: styles$1.icon, "aria-hidden": "true" }));
|
|
488
512
|
}
|
|
489
513
|
if (type === "last") {
|
|
490
|
-
return (jsxRuntimeExports.jsx(
|
|
514
|
+
return (jsxRuntimeExports.jsx(a, { direction: "right", size: iconSize, className: styles$1.icon, "aria-hidden": "true" }));
|
|
491
515
|
}
|
|
492
516
|
if (type === "next") {
|
|
493
|
-
return (jsxRuntimeExports.jsx(
|
|
517
|
+
return (jsxRuntimeExports.jsx(o, { direction: "right", size: iconSize, className: styles$1.icon, "aria-hidden": "true" }));
|
|
494
518
|
}
|
|
495
519
|
if (type === "previous") {
|
|
496
|
-
return (jsxRuntimeExports.jsx(
|
|
520
|
+
return (jsxRuntimeExports.jsx(o, { direction: "left", size: iconSize, className: styles$1.icon, "aria-hidden": "true" }));
|
|
497
521
|
}
|
|
498
522
|
return null;
|
|
499
523
|
};
|
|
@@ -510,14 +534,14 @@ const PaginationItem = React__default.forwardRef(({ page, type, selected = false
|
|
|
510
534
|
};
|
|
511
535
|
const classes = classNames$1(styles$1.item, styles$1.button, styles$1[`size-${size}`], styles$1[`shape-${shape}`], styles$1[`variant-${variant}`], selected && styles$1.selected, disabled && styles$1.disabled, isNavigationButton && styles$1.navigation, className);
|
|
512
536
|
return (jsxRuntimeExports.jsx("button", { ref: ref, type: "button", className: classes, disabled: disabled, "aria-label": type === "first"
|
|
513
|
-
? "
|
|
537
|
+
? "Ir a la primera página"
|
|
514
538
|
: type === "last"
|
|
515
|
-
? "
|
|
539
|
+
? "Ir a la última página"
|
|
516
540
|
: type === "next"
|
|
517
|
-
? "
|
|
541
|
+
? "Página siguiente"
|
|
518
542
|
: type === "previous"
|
|
519
|
-
? "
|
|
520
|
-
: `
|
|
543
|
+
? "Página anterior"
|
|
544
|
+
: `Página ${page}`, "aria-current": selected ? "page" : undefined, ...props, children: getButtonContent() }));
|
|
521
545
|
});
|
|
522
546
|
PaginationItem.displayName = "PaginationItem";
|
|
523
547
|
|
|
@@ -600,8 +624,9 @@ const usePagination = (props) => {
|
|
|
600
624
|
}
|
|
601
625
|
return items;
|
|
602
626
|
};
|
|
603
|
-
const Pagination =
|
|
604
|
-
const
|
|
627
|
+
const Pagination = React.forwardRef(({ count = 1, page: controlledPage, defaultPage = 1, onChange, onPageChange, "aria-label": ariaLabel = "Paginación", disabled = false, hideNextButton = false, hidePrevButton = false, showFirstButton = false, showLastButton = false, boundaryCount = 1, siblingCount = 1, shape = "rounded", size: sizeProp = "medium", variant = "text", renderItem, className, ...props }, ref) => {
|
|
628
|
+
const size = toLegacySize(sizeProp);
|
|
629
|
+
const [page, setPage] = React.useState(defaultPage);
|
|
605
630
|
const currentPage = controlledPage ?? page;
|
|
606
631
|
const handleClick = (event, value) => {
|
|
607
632
|
if (!controlledPage) {
|
|
@@ -610,6 +635,7 @@ const Pagination = React__default.forwardRef(({ count = 1, page: controlledPage,
|
|
|
610
635
|
if (onChange) {
|
|
611
636
|
onChange(event, value);
|
|
612
637
|
}
|
|
638
|
+
onPageChange?.(value);
|
|
613
639
|
};
|
|
614
640
|
const items = usePagination({
|
|
615
641
|
count,
|
|
@@ -622,7 +648,7 @@ const Pagination = React__default.forwardRef(({ count = 1, page: controlledPage,
|
|
|
622
648
|
hidePrevButton,
|
|
623
649
|
});
|
|
624
650
|
const classes = classNames(styles.root, className);
|
|
625
|
-
return (jsxRuntimeExports.jsx("nav", { ref: ref, className: classes, ...props, children: jsxRuntimeExports.jsx("ul", { className: styles.ul, children: items.map((item, index) => {
|
|
651
|
+
return (jsxRuntimeExports.jsx("nav", { ref: ref, className: classes, "aria-label": ariaLabel, ...props, children: jsxRuntimeExports.jsx("ul", { className: styles.ul, children: items.map((item, index) => {
|
|
626
652
|
const isDisabled = disabled || item.disabled;
|
|
627
653
|
if (renderItem) {
|
|
628
654
|
return (jsxRuntimeExports.jsx("li", { children: renderItem({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubenpazch/pagination",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Pagination component",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"**/*.css"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@rubenpazch/icons": "6.
|
|
23
|
+
"@rubenpazch/icons": "6.3.0",
|
|
24
|
+
"@rubenpazch/shared": "5.2.0"
|
|
24
25
|
},
|
|
25
26
|
"exports": {
|
|
26
27
|
".": {
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
"peerDependencies": {
|
|
33
34
|
"react": "^19.0.0",
|
|
34
35
|
"react-dom": "^19.0.0",
|
|
35
|
-
"@rubenpazch/tokens": "0.
|
|
36
|
+
"@rubenpazch/tokens": "0.4.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
@@ -57,6 +58,12 @@
|
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public"
|
|
59
60
|
},
|
|
61
|
+
"lbyte": {
|
|
62
|
+
"categoria": "navegacion",
|
|
63
|
+
"resumen": "Paginación con variantes, tamaños y formas; incluye PaginationItem.",
|
|
64
|
+
"usarCuando": "Listados paginados en el servidor (tablas, resultados de búsqueda).",
|
|
65
|
+
"evitarCuando": "Pocas páginas que caben en una sola vista."
|
|
66
|
+
},
|
|
60
67
|
"scripts": {
|
|
61
68
|
"build": "rollup -c",
|
|
62
69
|
"test": "jest --passWithNoTests"
|