@motor-hero/ui-kit 0.32.1 → 0.33.0
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/dist/components/pagination.d.ts +9 -3
- package/dist/components/pagination.d.ts.map +1 -1
- package/dist/index.cjs +61 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/pagination.tsx +67 -20
- package/src/index.ts +1 -0
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
interface PaginationProps {
|
|
1
|
+
export interface PaginationProps {
|
|
2
2
|
page: number;
|
|
3
3
|
onPageChange: (page: number) => void;
|
|
4
4
|
hasNextPage: boolean;
|
|
5
5
|
hasPreviousPage: boolean;
|
|
6
|
+
/** Total de páginas. Quando informado, o rótulo vira "Página {page} de {totalPages}". */
|
|
7
|
+
totalPages?: number;
|
|
8
|
+
/** Exibe o seletor de itens por página. Use com `pageSize`, `onPageSizeChange` e `pageSizeOptions`. */
|
|
9
|
+
showPageSizeSelector?: boolean;
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
onPageSizeChange?: (size: number) => void;
|
|
12
|
+
pageSizeOptions?: number[];
|
|
6
13
|
className?: string;
|
|
7
14
|
}
|
|
8
|
-
export declare function Pagination({ page, onPageChange, hasNextPage, hasPreviousPage, className }: PaginationProps): import("react").JSX.Element;
|
|
9
|
-
export {};
|
|
15
|
+
export declare function Pagination({ page, onPageChange, hasNextPage, hasPreviousPage, totalPages, showPageSizeSelector, pageSize, onPageSizeChange, pageSizeOptions, className, }: PaginationProps): import("react").JSX.Element;
|
|
10
16
|
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,WAAW,EAAE,OAAO,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,yFAAyF;IACzF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uGAAuG;IACvG,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAKD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,oBAA4B,EAC5B,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,SAAS,GACV,EAAE,eAAe,+BAgDjB"}
|
package/dist/index.cjs
CHANGED
|
@@ -651,33 +651,67 @@ function AuthCard({ title, description, children, footer }) {
|
|
|
651
651
|
|
|
652
652
|
// src/components/pagination.tsx
|
|
653
653
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
654
|
+
var navButtonClass = "inline-flex h-8 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground cursor-pointer disabled:pointer-events-none disabled:opacity-50";
|
|
655
|
+
function Pagination({
|
|
656
|
+
page,
|
|
657
|
+
onPageChange,
|
|
658
|
+
hasNextPage,
|
|
659
|
+
hasPreviousPage,
|
|
660
|
+
totalPages,
|
|
661
|
+
showPageSizeSelector = false,
|
|
662
|
+
pageSize,
|
|
663
|
+
onPageSizeChange,
|
|
664
|
+
pageSizeOptions,
|
|
665
|
+
className
|
|
666
|
+
}) {
|
|
667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
668
|
+
"div",
|
|
669
|
+
{
|
|
670
|
+
className: `flex items-center ${showPageSizeSelector ? "justify-between" : "justify-end"} gap-4 ${className ?? ""}`,
|
|
671
|
+
children: [
|
|
672
|
+
showPageSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "pagination-page-size", className: "text-sm text-muted-foreground", children: "Itens por p\xE1gina" }),
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
675
|
+
"select",
|
|
676
|
+
{
|
|
677
|
+
id: "pagination-page-size",
|
|
678
|
+
value: pageSize,
|
|
679
|
+
onChange: (e) => onPageSizeChange?.(Number(e.target.value)),
|
|
680
|
+
className: "h-8 rounded-md border border-input bg-background px-2 text-xs font-medium shadow-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring cursor-pointer",
|
|
681
|
+
children: (pageSizeOptions ?? []).map((size) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: size, children: size }, size))
|
|
682
|
+
}
|
|
683
|
+
)
|
|
684
|
+
] }),
|
|
685
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
687
|
+
"button",
|
|
688
|
+
{
|
|
689
|
+
type: "button",
|
|
690
|
+
onClick: () => onPageChange(page - 1),
|
|
691
|
+
disabled: !hasPreviousPage,
|
|
692
|
+
className: navButtonClass,
|
|
693
|
+
children: "Anterior"
|
|
694
|
+
}
|
|
695
|
+
),
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-sm text-muted-foreground", children: [
|
|
697
|
+
"P\xE1gina ",
|
|
698
|
+
page,
|
|
699
|
+
totalPages ? ` de ${totalPages}` : ""
|
|
700
|
+
] }),
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
702
|
+
"button",
|
|
703
|
+
{
|
|
704
|
+
type: "button",
|
|
705
|
+
onClick: () => onPageChange(page + 1),
|
|
706
|
+
disabled: !hasNextPage,
|
|
707
|
+
className: navButtonClass,
|
|
708
|
+
children: "Pr\xF3ximo"
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
] })
|
|
712
|
+
]
|
|
713
|
+
}
|
|
714
|
+
);
|
|
681
715
|
}
|
|
682
716
|
|
|
683
717
|
// src/components/table-skeleton.tsx
|