@ceed/ads 1.16.0-next.7 → 1.16.0-next.8

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.
@@ -21,6 +21,7 @@ interface PaginationProps extends React.ComponentProps<typeof PaginationRoot> {
21
21
  rowCount: number;
22
22
  onPageChange: (newPage: number) => void;
23
23
  size?: 'sm' | 'md' | 'lg';
24
+ variant?: 'standard' | 'compact';
24
25
  }
25
26
  declare function Pagination(props: PaginationProps): React.JSX.Element;
26
27
  declare namespace Pagination {
@@ -2,8 +2,17 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- ```text
6
- // Unable to derive source for Playground
5
+ ```tsx
6
+ <Stack spacing={4}>
7
+ <Stack spacing={1}>
8
+ <div>Standard</div>
9
+ <Pagination {...args} variant="standard" />
10
+ </Stack>
11
+ <Stack spacing={1}>
12
+ <div>Compact</div>
13
+ <Pagination {...args} variant="compact" />
14
+ </Stack>
15
+ </Stack>
7
16
  ```
8
17
 
9
18
  | Field | Description | Default |
package/dist/index.cjs CHANGED
@@ -3527,8 +3527,10 @@ TableBody.displayName = "TableBody";
3527
3527
 
3528
3528
  // src/components/Pagination/Pagination.tsx
3529
3529
  var import_react27 = __toESM(require("react"));
3530
- var import_ChevronLeft2 = __toESM(require("@mui/icons-material/ChevronLeft"));
3531
- var import_ChevronRight2 = __toESM(require("@mui/icons-material/ChevronRight"));
3530
+ var import_ChevronLeftRounded = __toESM(require("@mui/icons-material/ChevronLeftRounded"));
3531
+ var import_ChevronRightRounded = __toESM(require("@mui/icons-material/ChevronRightRounded"));
3532
+ var import_FirstPageRounded = __toESM(require("@mui/icons-material/FirstPageRounded"));
3533
+ var import_LastPageRounded = __toESM(require("@mui/icons-material/LastPageRounded"));
3532
3534
  var import_joy35 = require("@mui/joy");
3533
3535
  var PaginationButton = (0, import_joy35.styled)(Button_default, {
3534
3536
  name: "Pagination",
@@ -3587,6 +3589,7 @@ function Pagination(props) {
3587
3589
  onPageChange,
3588
3590
  rowCount,
3589
3591
  size = "md",
3592
+ variant = "standard",
3590
3593
  ...innerProps
3591
3594
  } = props;
3592
3595
  const [paginationModel, setPaginationModel] = useControlledState(
@@ -3613,6 +3616,87 @@ function Pagination(props) {
3613
3616
  setPaginationModel({ ...paginationModel, page: lastPage });
3614
3617
  }
3615
3618
  }, [rowCount, paginationModel, lastPage, setPaginationModel]);
3619
+ const pageOptions = Array.from({ length: lastPage }, (_, i) => ({
3620
+ label: `${i + 1}`,
3621
+ value: `${i + 1}`
3622
+ }));
3623
+ if (variant === "compact") {
3624
+ return /* @__PURE__ */ import_react27.default.createElement(PaginationRoot, { ...innerProps }, /* @__PURE__ */ import_react27.default.createElement(PaginationContainer, { direction: "row", size, alignItems: "center" }, /* @__PURE__ */ import_react27.default.createElement(Stack_default, { direction: "row" }, /* @__PURE__ */ import_react27.default.createElement(
3625
+ PaginationIconButton,
3626
+ {
3627
+ size,
3628
+ variant: "plain",
3629
+ color: "neutral",
3630
+ onClick: () => handlePageChange(firstPage),
3631
+ disabled: paginationModel.page === firstPage,
3632
+ "aria-label": "First page"
3633
+ },
3634
+ /* @__PURE__ */ import_react27.default.createElement(import_FirstPageRounded.default, null)
3635
+ ), /* @__PURE__ */ import_react27.default.createElement(
3636
+ PaginationIconButton,
3637
+ {
3638
+ size,
3639
+ variant: "plain",
3640
+ color: "neutral",
3641
+ onClick: () => handlePageChange(paginationModel.page - 1),
3642
+ disabled: paginationModel.page === firstPage,
3643
+ "aria-label": "Previous page"
3644
+ },
3645
+ /* @__PURE__ */ import_react27.default.createElement(import_ChevronLeftRounded.default, null)
3646
+ )), /* @__PURE__ */ import_react27.default.createElement(
3647
+ Autocomplete_default,
3648
+ {
3649
+ size,
3650
+ value: `${paginationModel.page}`,
3651
+ onChange: (event) => {
3652
+ if (event.target.value) {
3653
+ handlePageChange(parseInt(event.target.value, 10));
3654
+ }
3655
+ },
3656
+ options: pageOptions,
3657
+ sx: {
3658
+ width: {
3659
+ sm: "80px",
3660
+ md: "100px",
3661
+ lg: "120px"
3662
+ }[size]
3663
+ }
3664
+ }
3665
+ ), /* @__PURE__ */ import_react27.default.createElement(
3666
+ Typography_default,
3667
+ {
3668
+ level: `body-${size}`,
3669
+ sx: (theme) => ({
3670
+ color: theme.palette.text.secondary,
3671
+ fontWeight: 500
3672
+ })
3673
+ },
3674
+ "/ ",
3675
+ lastPage
3676
+ ), /* @__PURE__ */ import_react27.default.createElement(Stack_default, { direction: "row" }, /* @__PURE__ */ import_react27.default.createElement(
3677
+ PaginationIconButton,
3678
+ {
3679
+ size,
3680
+ variant: "plain",
3681
+ color: "neutral",
3682
+ onClick: () => handlePageChange(paginationModel.page + 1),
3683
+ disabled: paginationModel.page === lastPage,
3684
+ "aria-label": "Next page"
3685
+ },
3686
+ /* @__PURE__ */ import_react27.default.createElement(import_ChevronRightRounded.default, null)
3687
+ ), /* @__PURE__ */ import_react27.default.createElement(
3688
+ PaginationIconButton,
3689
+ {
3690
+ size,
3691
+ variant: "plain",
3692
+ color: "neutral",
3693
+ onClick: () => handlePageChange(lastPage),
3694
+ disabled: paginationModel.page === lastPage,
3695
+ "aria-label": "Last page"
3696
+ },
3697
+ /* @__PURE__ */ import_react27.default.createElement(import_LastPageRounded.default, null)
3698
+ ))));
3699
+ }
3616
3700
  return /* @__PURE__ */ import_react27.default.createElement(PaginationRoot, { ...innerProps }, /* @__PURE__ */ import_react27.default.createElement(PaginationContainer, { direction: "row", size, alignItems: "center" }, /* @__PURE__ */ import_react27.default.createElement(
3617
3701
  PaginationIconButton,
3618
3702
  {
@@ -3623,7 +3707,7 @@ function Pagination(props) {
3623
3707
  disabled: paginationModel.page === firstPage,
3624
3708
  "aria-label": "Previous page"
3625
3709
  },
3626
- /* @__PURE__ */ import_react27.default.createElement(import_ChevronLeft2.default, null)
3710
+ /* @__PURE__ */ import_react27.default.createElement(import_ChevronLeftRounded.default, null)
3627
3711
  ), paginationModel.page !== firstPage && /* @__PURE__ */ import_react27.default.createElement(PaginationButton, { size, variant: "plain", color: "neutral", onClick: () => handlePageChange(firstPage) }, firstPage), isMoreBeforePages && /* @__PURE__ */ import_react27.default.createElement(
3628
3712
  PaginationButton,
3629
3713
  {
@@ -3654,7 +3738,7 @@ function Pagination(props) {
3654
3738
  disabled: paginationModel.page === lastPage,
3655
3739
  "aria-label": "Next page"
3656
3740
  },
3657
- /* @__PURE__ */ import_react27.default.createElement(import_ChevronRight2.default, null)
3741
+ /* @__PURE__ */ import_react27.default.createElement(import_ChevronRightRounded.default, null)
3658
3742
  )));
3659
3743
  }
3660
3744
  Pagination.displayName = "Pagination";
package/dist/index.js CHANGED
@@ -3456,8 +3456,10 @@ TableBody.displayName = "TableBody";
3456
3456
 
3457
3457
  // src/components/Pagination/Pagination.tsx
3458
3458
  import React24, { useCallback as useCallback10, useEffect as useEffect6 } from "react";
3459
- import PreviousIcon from "@mui/icons-material/ChevronLeft";
3460
- import NextIcon from "@mui/icons-material/ChevronRight";
3459
+ import PreviousIcon from "@mui/icons-material/ChevronLeftRounded";
3460
+ import NextIcon from "@mui/icons-material/ChevronRightRounded";
3461
+ import FirstPageIcon from "@mui/icons-material/FirstPageRounded";
3462
+ import LastPageIcon from "@mui/icons-material/LastPageRounded";
3461
3463
  import { styled as styled13 } from "@mui/joy";
3462
3464
  var PaginationButton = styled13(Button_default, {
3463
3465
  name: "Pagination",
@@ -3516,6 +3518,7 @@ function Pagination(props) {
3516
3518
  onPageChange,
3517
3519
  rowCount,
3518
3520
  size = "md",
3521
+ variant = "standard",
3519
3522
  ...innerProps
3520
3523
  } = props;
3521
3524
  const [paginationModel, setPaginationModel] = useControlledState(
@@ -3542,6 +3545,87 @@ function Pagination(props) {
3542
3545
  setPaginationModel({ ...paginationModel, page: lastPage });
3543
3546
  }
3544
3547
  }, [rowCount, paginationModel, lastPage, setPaginationModel]);
3548
+ const pageOptions = Array.from({ length: lastPage }, (_, i) => ({
3549
+ label: `${i + 1}`,
3550
+ value: `${i + 1}`
3551
+ }));
3552
+ if (variant === "compact") {
3553
+ return /* @__PURE__ */ React24.createElement(PaginationRoot, { ...innerProps }, /* @__PURE__ */ React24.createElement(PaginationContainer, { direction: "row", size, alignItems: "center" }, /* @__PURE__ */ React24.createElement(Stack_default, { direction: "row" }, /* @__PURE__ */ React24.createElement(
3554
+ PaginationIconButton,
3555
+ {
3556
+ size,
3557
+ variant: "plain",
3558
+ color: "neutral",
3559
+ onClick: () => handlePageChange(firstPage),
3560
+ disabled: paginationModel.page === firstPage,
3561
+ "aria-label": "First page"
3562
+ },
3563
+ /* @__PURE__ */ React24.createElement(FirstPageIcon, null)
3564
+ ), /* @__PURE__ */ React24.createElement(
3565
+ PaginationIconButton,
3566
+ {
3567
+ size,
3568
+ variant: "plain",
3569
+ color: "neutral",
3570
+ onClick: () => handlePageChange(paginationModel.page - 1),
3571
+ disabled: paginationModel.page === firstPage,
3572
+ "aria-label": "Previous page"
3573
+ },
3574
+ /* @__PURE__ */ React24.createElement(PreviousIcon, null)
3575
+ )), /* @__PURE__ */ React24.createElement(
3576
+ Autocomplete_default,
3577
+ {
3578
+ size,
3579
+ value: `${paginationModel.page}`,
3580
+ onChange: (event) => {
3581
+ if (event.target.value) {
3582
+ handlePageChange(parseInt(event.target.value, 10));
3583
+ }
3584
+ },
3585
+ options: pageOptions,
3586
+ sx: {
3587
+ width: {
3588
+ sm: "80px",
3589
+ md: "100px",
3590
+ lg: "120px"
3591
+ }[size]
3592
+ }
3593
+ }
3594
+ ), /* @__PURE__ */ React24.createElement(
3595
+ Typography_default,
3596
+ {
3597
+ level: `body-${size}`,
3598
+ sx: (theme) => ({
3599
+ color: theme.palette.text.secondary,
3600
+ fontWeight: 500
3601
+ })
3602
+ },
3603
+ "/ ",
3604
+ lastPage
3605
+ ), /* @__PURE__ */ React24.createElement(Stack_default, { direction: "row" }, /* @__PURE__ */ React24.createElement(
3606
+ PaginationIconButton,
3607
+ {
3608
+ size,
3609
+ variant: "plain",
3610
+ color: "neutral",
3611
+ onClick: () => handlePageChange(paginationModel.page + 1),
3612
+ disabled: paginationModel.page === lastPage,
3613
+ "aria-label": "Next page"
3614
+ },
3615
+ /* @__PURE__ */ React24.createElement(NextIcon, null)
3616
+ ), /* @__PURE__ */ React24.createElement(
3617
+ PaginationIconButton,
3618
+ {
3619
+ size,
3620
+ variant: "plain",
3621
+ color: "neutral",
3622
+ onClick: () => handlePageChange(lastPage),
3623
+ disabled: paginationModel.page === lastPage,
3624
+ "aria-label": "Last page"
3625
+ },
3626
+ /* @__PURE__ */ React24.createElement(LastPageIcon, null)
3627
+ ))));
3628
+ }
3545
3629
  return /* @__PURE__ */ React24.createElement(PaginationRoot, { ...innerProps }, /* @__PURE__ */ React24.createElement(PaginationContainer, { direction: "row", size, alignItems: "center" }, /* @__PURE__ */ React24.createElement(
3546
3630
  PaginationIconButton,
3547
3631
  {