baaz-custom-components 5.0.12 → 5.0.13

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/index.d.mts CHANGED
@@ -122,8 +122,6 @@ type Pagination$1 = {
122
122
  sizeChangerOptions?: number[];
123
123
  };
124
124
 
125
- declare function Pagination({ totalCount, count, currentPage, totalPages, pageSize, onPageChange, onPageSizeChange, showSizeChanger, sizeChangerOptions, }: Pagination$1 & {
126
- sizeChangerOptions?: number[];
127
- }): react.JSX.Element | null;
125
+ declare function Pagination({ totalCount, count, currentPage, totalPages, pageSize, onPageChange, onPageSizeChange, showSizeChanger, sizeChangerOptions, }: Pagination$1): react.JSX.Element | null;
128
126
 
129
127
  export { type BreadcrumbProps, CustomBreadcrumb, Grid, type GridProps, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, Pagination, type Pagination$1 as PaginationProps, type RouteTree, type RouterAdapter, type UserData };
package/dist/index.d.ts CHANGED
@@ -122,8 +122,6 @@ type Pagination$1 = {
122
122
  sizeChangerOptions?: number[];
123
123
  };
124
124
 
125
- declare function Pagination({ totalCount, count, currentPage, totalPages, pageSize, onPageChange, onPageSizeChange, showSizeChanger, sizeChangerOptions, }: Pagination$1 & {
126
- sizeChangerOptions?: number[];
127
- }): react.JSX.Element | null;
125
+ declare function Pagination({ totalCount, count, currentPage, totalPages, pageSize, onPageChange, onPageSizeChange, showSizeChanger, sizeChangerOptions, }: Pagination$1): react.JSX.Element | null;
128
126
 
129
127
  export { type BreadcrumbProps, CustomBreadcrumb, Grid, type GridProps, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, Pagination, type Pagination$1 as PaginationProps, type RouteTree, type RouterAdapter, type UserData };
package/dist/index.js CHANGED
@@ -2286,10 +2286,6 @@ function Grid(_a) {
2286
2286
  }
2287
2287
  var grid_default = Grid;
2288
2288
 
2289
- // src/components/custom/pagination/index.tsx
2290
- var import_react7 = require("react");
2291
- var import_navigation = require("next/navigation");
2292
-
2293
2289
  // src/utils/pagination.ts
2294
2290
  function getPaginationRange(currentPage, totalPages, siblingCount = 2) {
2295
2291
  const range = [];
@@ -2334,34 +2330,15 @@ function Pagination({
2334
2330
  showSizeChanger = false,
2335
2331
  sizeChangerOptions = [10, 20, 50, 100]
2336
2332
  }) {
2337
- const router = (0, import_navigation.useRouter)();
2338
- const params = (0, import_navigation.useSearchParams)();
2339
- const setParams = (0, import_react7.useCallback)(
2340
- (updates) => {
2341
- const q = new URLSearchParams(params.toString());
2342
- Object.entries(updates).forEach(([k, v]) => q.set(k, v));
2343
- router.replace(`?${q.toString()}`, { scroll: false });
2344
- },
2345
- [params, router]
2346
- );
2333
+ if (totalPages <= 1) return null;
2334
+ const pages = getPaginationRange(currentPage, totalPages);
2347
2335
  const handlePageChange = (page) => {
2348
- console.log("handlePageChange", page);
2349
2336
  if (page < 1 || page > totalPages) return;
2350
- if (onPageChange) {
2351
- onPageChange(page);
2352
- return;
2353
- }
2354
- setParams({ page: String(page) });
2337
+ onPageChange == null ? void 0 : onPageChange(page);
2355
2338
  };
2356
2339
  const handlePageSizeChange = (size) => {
2357
- if (onPageSizeChange) {
2358
- onPageSizeChange(size);
2359
- return;
2360
- }
2361
- setParams({ pageSize: String(size), page: "1" });
2340
+ onPageSizeChange == null ? void 0 : onPageSizeChange(size);
2362
2341
  };
2363
- if (totalPages <= 1) return null;
2364
- const pages = getPaginationRange(currentPage, totalPages);
2365
2342
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-between bg-card px-3 py-2", children: [
2366
2343
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-3 text-xs text-muted-foreground tracking-wider font-medium", children: [
2367
2344
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
@@ -2376,7 +2353,7 @@ function Pagination({
2376
2353
  {
2377
2354
  value: pageSize,
2378
2355
  onChange: (e) => handlePageSizeChange(Number(e.target.value)),
2379
- className: "rounded-md border border-input bg-background px-3 py-2 select-none text-xs text-foreground focus:outline-none",
2356
+ className: "rounded-md border border-input bg-background px-3 py-2 text-xs text-foreground focus:outline-none",
2380
2357
  children: sizeChangerOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("option", { value: size, children: [
2381
2358
  size,
2382
2359
  " / page"
@@ -2385,31 +2362,42 @@ function Pagination({
2385
2362
  )
2386
2363
  ] }),
2387
2364
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
2388
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "hover:bg-card-foreground disabled:opacity-40 border border-border w-8 h-8 rounded-md flex items-center justify-center cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2389
- import_lucide_react14.ChevronLeft,
2365
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2366
+ "button",
2390
2367
  {
2368
+ disabled: currentPage === 1,
2391
2369
  onClick: () => handlePageChange(currentPage - 1),
2392
- className: "w-5 h-5 select-none"
2370
+ className: "border border-border w-8 h-8 rounded-md flex items-center justify-center disabled:opacity-40 hover:bg-card-foreground transition",
2371
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.ChevronLeft, { className: "w-5 h-5 select-none" })
2393
2372
  }
2394
- ) }),
2373
+ ),
2395
2374
  pages.map(
2396
- (page, idx) => page === "dots" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "px-2 text-muted-foreground text-xs tracking-wider font-medium", children: "\u2026" }, `dots-${idx}`) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2375
+ (page, idx) => page === "dots" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2376
+ "span",
2377
+ {
2378
+ className: "px-2 text-muted-foreground text-xs tracking-wider font-medium",
2379
+ children: "\u2026"
2380
+ },
2381
+ `dots-${idx}`
2382
+ ) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2397
2383
  "button",
2398
2384
  {
2399
2385
  onClick: () => handlePageChange(page),
2400
- className: `rounded-md w-8 h-8 text-xs transition cursor-pointer select-none tracking-wider font-medium ${page === currentPage ? "bg-card-foreground text-foreground" : "hover:bg-card-foreground"}`,
2386
+ className: `rounded-md w-8 h-8 text-xs transition tracking-wider font-medium ${page === currentPage ? "bg-card-foreground text-foreground" : "hover:bg-card-foreground"}`,
2401
2387
  children: page
2402
2388
  },
2403
2389
  page
2404
2390
  )
2405
2391
  ),
2406
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "hover:bg-card-foreground disabled:opacity-40 border border-border w-8 h-8 rounded-md flex items-center justify-center cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2407
- import_lucide_react14.ChevronRight,
2392
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2393
+ "button",
2408
2394
  {
2409
- onClick: () => currentPage === totalPages ? null : handlePageChange(currentPage + 1),
2410
- className: "w-5 h-5 select-none"
2395
+ disabled: currentPage === totalPages,
2396
+ onClick: () => handlePageChange(currentPage + 1),
2397
+ className: "border border-border w-8 h-8 rounded-md flex items-center justify-center disabled:opacity-40 hover:bg-card-foreground transition",
2398
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.ChevronRight, { className: "w-5 h-5 select-none" })
2411
2399
  }
2412
- ) })
2400
+ )
2413
2401
  ] })
2414
2402
  ] });
2415
2403
  }
package/dist/index.mjs CHANGED
@@ -2257,10 +2257,6 @@ function Grid(_a) {
2257
2257
  }
2258
2258
  var grid_default = Grid;
2259
2259
 
2260
- // src/components/custom/pagination/index.tsx
2261
- import { useCallback as useCallback2 } from "react";
2262
- import { useRouter, useSearchParams } from "next/navigation";
2263
-
2264
2260
  // src/utils/pagination.ts
2265
2261
  function getPaginationRange(currentPage, totalPages, siblingCount = 2) {
2266
2262
  const range = [];
@@ -2305,34 +2301,15 @@ function Pagination({
2305
2301
  showSizeChanger = false,
2306
2302
  sizeChangerOptions = [10, 20, 50, 100]
2307
2303
  }) {
2308
- const router = useRouter();
2309
- const params = useSearchParams();
2310
- const setParams = useCallback2(
2311
- (updates) => {
2312
- const q = new URLSearchParams(params.toString());
2313
- Object.entries(updates).forEach(([k, v]) => q.set(k, v));
2314
- router.replace(`?${q.toString()}`, { scroll: false });
2315
- },
2316
- [params, router]
2317
- );
2304
+ if (totalPages <= 1) return null;
2305
+ const pages = getPaginationRange(currentPage, totalPages);
2318
2306
  const handlePageChange = (page) => {
2319
- console.log("handlePageChange", page);
2320
2307
  if (page < 1 || page > totalPages) return;
2321
- if (onPageChange) {
2322
- onPageChange(page);
2323
- return;
2324
- }
2325
- setParams({ page: String(page) });
2308
+ onPageChange == null ? void 0 : onPageChange(page);
2326
2309
  };
2327
2310
  const handlePageSizeChange = (size) => {
2328
- if (onPageSizeChange) {
2329
- onPageSizeChange(size);
2330
- return;
2331
- }
2332
- setParams({ pageSize: String(size), page: "1" });
2311
+ onPageSizeChange == null ? void 0 : onPageSizeChange(size);
2333
2312
  };
2334
- if (totalPages <= 1) return null;
2335
- const pages = getPaginationRange(currentPage, totalPages);
2336
2313
  return /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between bg-card px-3 py-2", children: [
2337
2314
  /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3 text-xs text-muted-foreground tracking-wider font-medium", children: [
2338
2315
  /* @__PURE__ */ jsxs20("span", { children: [
@@ -2347,7 +2324,7 @@ function Pagination({
2347
2324
  {
2348
2325
  value: pageSize,
2349
2326
  onChange: (e) => handlePageSizeChange(Number(e.target.value)),
2350
- className: "rounded-md border border-input bg-background px-3 py-2 select-none text-xs text-foreground focus:outline-none",
2327
+ className: "rounded-md border border-input bg-background px-3 py-2 text-xs text-foreground focus:outline-none",
2351
2328
  children: sizeChangerOptions.map((size) => /* @__PURE__ */ jsxs20("option", { value: size, children: [
2352
2329
  size,
2353
2330
  " / page"
@@ -2356,31 +2333,42 @@ function Pagination({
2356
2333
  )
2357
2334
  ] }),
2358
2335
  /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1", children: [
2359
- /* @__PURE__ */ jsx26("div", { className: "hover:bg-card-foreground disabled:opacity-40 border border-border w-8 h-8 rounded-md flex items-center justify-center cursor-pointer", children: /* @__PURE__ */ jsx26(
2360
- ChevronLeft,
2336
+ /* @__PURE__ */ jsx26(
2337
+ "button",
2361
2338
  {
2339
+ disabled: currentPage === 1,
2362
2340
  onClick: () => handlePageChange(currentPage - 1),
2363
- className: "w-5 h-5 select-none"
2341
+ className: "border border-border w-8 h-8 rounded-md flex items-center justify-center disabled:opacity-40 hover:bg-card-foreground transition",
2342
+ children: /* @__PURE__ */ jsx26(ChevronLeft, { className: "w-5 h-5 select-none" })
2364
2343
  }
2365
- ) }),
2344
+ ),
2366
2345
  pages.map(
2367
- (page, idx) => page === "dots" ? /* @__PURE__ */ jsx26("span", { className: "px-2 text-muted-foreground text-xs tracking-wider font-medium", children: "\u2026" }, `dots-${idx}`) : /* @__PURE__ */ jsx26(
2346
+ (page, idx) => page === "dots" ? /* @__PURE__ */ jsx26(
2347
+ "span",
2348
+ {
2349
+ className: "px-2 text-muted-foreground text-xs tracking-wider font-medium",
2350
+ children: "\u2026"
2351
+ },
2352
+ `dots-${idx}`
2353
+ ) : /* @__PURE__ */ jsx26(
2368
2354
  "button",
2369
2355
  {
2370
2356
  onClick: () => handlePageChange(page),
2371
- className: `rounded-md w-8 h-8 text-xs transition cursor-pointer select-none tracking-wider font-medium ${page === currentPage ? "bg-card-foreground text-foreground" : "hover:bg-card-foreground"}`,
2357
+ className: `rounded-md w-8 h-8 text-xs transition tracking-wider font-medium ${page === currentPage ? "bg-card-foreground text-foreground" : "hover:bg-card-foreground"}`,
2372
2358
  children: page
2373
2359
  },
2374
2360
  page
2375
2361
  )
2376
2362
  ),
2377
- /* @__PURE__ */ jsx26("div", { className: "hover:bg-card-foreground disabled:opacity-40 border border-border w-8 h-8 rounded-md flex items-center justify-center cursor-pointer", children: /* @__PURE__ */ jsx26(
2378
- ChevronRight3,
2363
+ /* @__PURE__ */ jsx26(
2364
+ "button",
2379
2365
  {
2380
- onClick: () => currentPage === totalPages ? null : handlePageChange(currentPage + 1),
2381
- className: "w-5 h-5 select-none"
2366
+ disabled: currentPage === totalPages,
2367
+ onClick: () => handlePageChange(currentPage + 1),
2368
+ className: "border border-border w-8 h-8 rounded-md flex items-center justify-center disabled:opacity-40 hover:bg-card-foreground transition",
2369
+ children: /* @__PURE__ */ jsx26(ChevronRight3, { className: "w-5 h-5 select-none" })
2382
2370
  }
2383
- ) })
2371
+ )
2384
2372
  ] })
2385
2373
  ] });
2386
2374
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baaz-custom-components",
3
- "version": "5.0.12",
3
+ "version": "5.0.13",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",