diff --git a/apps/docs/content/components/pagination/boundaries.raw.jsx b/apps/docs/content/components/pagination/boundaries.raw.jsx new file mode 100644 index 0000000000..7c6e436708 --- /dev/null +++ b/apps/docs/content/components/pagination/boundaries.raw.jsx @@ -0,0 +1,14 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ( +
+

1 Boundary (default)

+ +

2 Boundaries

+ +

3 Boundaries

+ +
+ ); +} diff --git a/apps/docs/content/components/pagination/boundaries.ts b/apps/docs/content/components/pagination/boundaries.ts index 56b1ffe9ef..e3b0fe3955 100644 --- a/apps/docs/content/components/pagination/boundaries.ts +++ b/apps/docs/content/components/pagination/boundaries.ts @@ -1,28 +1,4 @@ -const App = `import {Pagination, Button} from "@nextui-org/react"; - -export default function App() { - return ( -
-

1 Boundary (default)

- -

2 Boundaries

- -

3 Boundaries

- -
- ); -}`; +import App from "./boundaries.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/colors.raw.jsx b/apps/docs/content/components/pagination/colors.raw.jsx new file mode 100644 index 0000000000..bf5afca8cd --- /dev/null +++ b/apps/docs/content/components/pagination/colors.raw.jsx @@ -0,0 +1,13 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + const colors = ["primary", "secondary", "success", "warning", "danger"]; + + return ( +
+ {colors.map((color) => ( + + ))} +
+ ); +} diff --git a/apps/docs/content/components/pagination/colors.ts b/apps/docs/content/components/pagination/colors.ts index d2988d221a..d5bef810aa 100644 --- a/apps/docs/content/components/pagination/colors.ts +++ b/apps/docs/content/components/pagination/colors.ts @@ -1,17 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - - const colors = ["primary", "secondary", "success", "warning", "danger"] - - return ( -
- {colors.map((color) => ( - - ))} -
- ); -}`; +import App from "./colors.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/compact.raw.jsx b/apps/docs/content/components/pagination/compact.raw.jsx new file mode 100644 index 0000000000..c0419e978f --- /dev/null +++ b/apps/docs/content/components/pagination/compact.raw.jsx @@ -0,0 +1,5 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/pagination/compact.ts b/apps/docs/content/components/pagination/compact.ts index dff50103bf..c3cdfc316e 100644 --- a/apps/docs/content/components/pagination/compact.ts +++ b/apps/docs/content/components/pagination/compact.ts @@ -1,10 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./compact.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/controlled.raw.jsx b/apps/docs/content/components/pagination/controlled.raw.jsx new file mode 100644 index 0000000000..6580d3b7fc --- /dev/null +++ b/apps/docs/content/components/pagination/controlled.raw.jsx @@ -0,0 +1,30 @@ +import {Pagination, Button} from "@nextui-org/react"; + +export default function App() { + const [currentPage, setCurrentPage] = React.useState(1); + + return ( +
+

Selected Page: {currentPage}

+ +
+ + +
+
+ ); +} diff --git a/apps/docs/content/components/pagination/controlled.ts b/apps/docs/content/components/pagination/controlled.ts index 6b3c4d7c45..2c3f0cacb4 100644 --- a/apps/docs/content/components/pagination/controlled.ts +++ b/apps/docs/content/components/pagination/controlled.ts @@ -1,38 +1,4 @@ -const App = `import {Pagination, Button} from "@nextui-org/react"; - -export default function App() { - const [currentPage, setCurrentPage] = React.useState(1); - - return ( -
-

Selected Page: {currentPage}

- -
- - -
-
- ); -}`; +import App from "./controlled.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/controls.raw.jsx b/apps/docs/content/components/pagination/controls.raw.jsx new file mode 100644 index 0000000000..8b5909bba0 --- /dev/null +++ b/apps/docs/content/components/pagination/controls.raw.jsx @@ -0,0 +1,5 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/pagination/controls.ts b/apps/docs/content/components/pagination/controls.ts index f8db1c1658..74b3403042 100644 --- a/apps/docs/content/components/pagination/controls.ts +++ b/apps/docs/content/components/pagination/controls.ts @@ -1,10 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./controls.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/custom-impl.raw.jsx b/apps/docs/content/components/pagination/custom-impl.raw.jsx new file mode 100644 index 0000000000..aa3dedd161 --- /dev/null +++ b/apps/docs/content/components/pagination/custom-impl.raw.jsx @@ -0,0 +1,82 @@ +import {usePagination, PaginationItemType} from "@nextui-org/react"; + +export const ChevronIcon = (props) => { + return ( + + ); +}; + +export default function App() { + const {activePage, range, setPage, onNext, onPrevious} = usePagination({ + total: 6, + showControls: true, + siblings: 10, + boundaries: 10, + }); + + return ( +
+

Active page: {activePage}

+
    + {range.map((page) => { + if (page === PaginationItemType.NEXT) { + return ( +
  • + +
  • + ); + } + + if (page === PaginationItemType.PREV) { + return ( +
  • + +
  • + ); + } + + if (page === PaginationItemType.DOTS) { + return ( +
  • + ... +
  • + ); + } + + return ( +
  • +
  • + ); + })} +
+
+ ); +} diff --git a/apps/docs/content/components/pagination/custom-impl.ts b/apps/docs/content/components/pagination/custom-impl.ts index 72da8c7611..ab37512cec 100644 --- a/apps/docs/content/components/pagination/custom-impl.ts +++ b/apps/docs/content/components/pagination/custom-impl.ts @@ -1,95 +1,7 @@ -const ChevronIcon = `export const ChevronIcon = (props) => ( - -); -`; - -const App = `import {usePagination, PaginationItemType} from "@nextui-org/react"; -import {ChevronIcon} from "./ChevronIcon"; - -export default function App() { - const {activePage, range, setPage, onNext, onPrevious} = usePagination({ - total: 6, - showControls: true, - siblings: 10, - boundaries: 10, - }); - - return ( -
-

Active page: {activePage}

-
    - {range.map((page) => { - if (page === PaginationItemType.NEXT) { - return ( -
  • - -
  • - ); - } - - if (page === PaginationItemType.PREV) { - return ( -
  • - -
  • - ); - } - - if (page === PaginationItemType.DOTS) { - return ( -
  • - ... -
  • - ); - } - - return ( -
  • -
  • - ); - })} -
-
- ); -}`; +import App from "./custom-impl.raw.jsx?raw"; const react = { "/App.jsx": App, - "/ChevronIcon.jsx": ChevronIcon, }; export default { diff --git a/apps/docs/content/components/pagination/custom-items.raw.jsx b/apps/docs/content/components/pagination/custom-items.raw.jsx new file mode 100644 index 0000000000..d691f8eed1 --- /dev/null +++ b/apps/docs/content/components/pagination/custom-items.raw.jsx @@ -0,0 +1,88 @@ +import {Pagination, PaginationItemType} from "@nextui-org/react"; + +export const ChevronIcon = (props) => { + return ( + + ); +}; + +export default function App() { + const renderItem = ({ref, key, value, isActive, onNext, onPrevious, setPage, className}) => { + if (value === PaginationItemType.NEXT) { + return ( + + ); + } + + if (value === PaginationItemType.PREV) { + return ( + + ); + } + + if (value === PaginationItemType.DOTS) { + return ( + + ); + } + + // cursor is the default item + return ( + + ); + }; + + return ( + + ); +} diff --git a/apps/docs/content/components/pagination/custom-items.raw.tsx b/apps/docs/content/components/pagination/custom-items.raw.tsx new file mode 100644 index 0000000000..117c514eb3 --- /dev/null +++ b/apps/docs/content/components/pagination/custom-items.raw.tsx @@ -0,0 +1,98 @@ +import React, {SVGProps} from "react"; +import {cn, Pagination, PaginationItemType, PaginationItemRenderProps} from "@nextui-org/react"; + +type IconSvgProps = SVGProps; + +export const ChevronIcon = (props: IconSvgProps) => ( + +); + +export default function App() { + const renderItem = ({ + ref, + key, + value, + isActive, + onNext, + onPrevious, + setPage, + className, + }: PaginationItemRenderProps) => { + if (value === PaginationItemType.NEXT) { + return ( + + ); + } + + if (value === PaginationItemType.PREV) { + return ( + + ); + } + + if (value === PaginationItemType.DOTS) { + return ( + + ); + } + + // cursor is the default item + return ( + + ); + }; + + return ( + + ); +} diff --git a/apps/docs/content/components/pagination/custom-items.ts b/apps/docs/content/components/pagination/custom-items.ts index 3e94ff8c6b..708622f442 100644 --- a/apps/docs/content/components/pagination/custom-items.ts +++ b/apps/docs/content/components/pagination/custom-items.ts @@ -1,189 +1,12 @@ -const ChevronIcon = `export const ChevronIcon = (props) => ( - -); -`; - -const ChevronIconTs = `import {SVGProps} from "react"; - -type IconSvgProps = SVGProps; - -export const ChevronIcon = (props: IconSvgProps) => ( - -); -`; - -const AppTs = `import {Pagination, PaginationItemType, PaginationItemRenderProps} from "@nextui-org/react"; -import {ChevronIcon} from "./ChevronIcon"; - -export default function App() { - const renderItem = ({ - ref, - key, - value, - isActive, - onNext, - onPrevious, - setPage, - className, - }: PaginationItemRenderProps) => { - if (value === PaginationItemType.NEXT) { - return ( - - ); - } - - if (value === PaginationItemType.PREV) { - return ( - - ); - } - - if (value === PaginationItemType.DOTS) { - return ; - } - - // cursor is the default item - return ( - - ); - }; - - return ( - - ); -}`; - -const App = `import {Pagination, PaginationItemType} from "@nextui-org/react"; -import {ChevronIcon} from "./ChevronIcon"; - -export default function App() { - const renderItem = ({ - ref, - key, - value, - isActive, - onNext, - onPrevious, - setPage, - className, - }) => { - if (value === PaginationItemType.NEXT) { - return ( - - ); - } - - if (value === PaginationItemType.PREV) { - return ( - - ); - } - - if (value === PaginationItemType.DOTS) { - return ; - } - - // cursor is the default item - return ( - - ); - }; - - return ( - - ); -}`; +import App from "./custom-items.raw.jsx?raw"; +import AppTs from "./custom-items.raw.tsx?raw"; const react = { "/App.jsx": App, - "/ChevronIcon.jsx": ChevronIcon, }; const reactTs = { "/App.tsx": AppTs, - "/ChevronIcon.tsx": ChevronIconTs, }; export default { diff --git a/apps/docs/content/components/pagination/custom-styles.raw.jsx b/apps/docs/content/components/pagination/custom-styles.raw.jsx new file mode 100644 index 0000000000..2438a31fe2 --- /dev/null +++ b/apps/docs/content/components/pagination/custom-styles.raw.jsx @@ -0,0 +1,15 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ( + + ); +} diff --git a/apps/docs/content/components/pagination/custom-styles.ts b/apps/docs/content/components/pagination/custom-styles.ts index 099f57350e..da3ea9093a 100644 --- a/apps/docs/content/components/pagination/custom-styles.ts +++ b/apps/docs/content/components/pagination/custom-styles.ts @@ -1,18 +1,4 @@ -const App = `import {Pagination, Button} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./custom-styles.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/disabled.raw.jsx b/apps/docs/content/components/pagination/disabled.raw.jsx new file mode 100644 index 0000000000..0052b38f31 --- /dev/null +++ b/apps/docs/content/components/pagination/disabled.raw.jsx @@ -0,0 +1,5 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/pagination/disabled.ts b/apps/docs/content/components/pagination/disabled.ts index 8e541c5ade..1a215cc91f 100644 --- a/apps/docs/content/components/pagination/disabled.ts +++ b/apps/docs/content/components/pagination/disabled.ts @@ -1,10 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./disabled.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/initial-page.raw.jsx b/apps/docs/content/components/pagination/initial-page.raw.jsx new file mode 100644 index 0000000000..3c255ae348 --- /dev/null +++ b/apps/docs/content/components/pagination/initial-page.raw.jsx @@ -0,0 +1,5 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/pagination/initial-page.ts b/apps/docs/content/components/pagination/initial-page.ts index 0d0dd5277c..7a868386df 100644 --- a/apps/docs/content/components/pagination/initial-page.ts +++ b/apps/docs/content/components/pagination/initial-page.ts @@ -1,10 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./initial-page.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/loop.raw.jsx b/apps/docs/content/components/pagination/loop.raw.jsx new file mode 100644 index 0000000000..38d37be5d6 --- /dev/null +++ b/apps/docs/content/components/pagination/loop.raw.jsx @@ -0,0 +1,5 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/pagination/loop.ts b/apps/docs/content/components/pagination/loop.ts index a0b3d320f7..75721e3bc3 100644 --- a/apps/docs/content/components/pagination/loop.ts +++ b/apps/docs/content/components/pagination/loop.ts @@ -1,10 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./loop.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/radius.raw.jsx b/apps/docs/content/components/pagination/radius.raw.jsx new file mode 100644 index 0000000000..583afb18a4 --- /dev/null +++ b/apps/docs/content/components/pagination/radius.raw.jsx @@ -0,0 +1,13 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + const radius = ["full", "xl", "lg", "md", "sm", "base", "none"]; + + return ( +
+ {radius.map((r) => ( + + ))} +
+ ); +} diff --git a/apps/docs/content/components/pagination/radius.ts b/apps/docs/content/components/pagination/radius.ts index 6cc77848ac..7b78db1ce0 100644 --- a/apps/docs/content/components/pagination/radius.ts +++ b/apps/docs/content/components/pagination/radius.ts @@ -1,17 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - - const radius = ["full", "xl", "lg", "md", "sm", "base", "none"] - - return ( -
- {radius.map((r) => ( - - ))} -
- ); -}`; +import App from "./radius.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/shadow.raw.jsx b/apps/docs/content/components/pagination/shadow.raw.jsx new file mode 100644 index 0000000000..a1e25bf9ca --- /dev/null +++ b/apps/docs/content/components/pagination/shadow.raw.jsx @@ -0,0 +1,5 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/pagination/shadow.ts b/apps/docs/content/components/pagination/shadow.ts index 12edcbb3e1..a18f8ca4bf 100644 --- a/apps/docs/content/components/pagination/shadow.ts +++ b/apps/docs/content/components/pagination/shadow.ts @@ -1,10 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./shadow.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/siblings.raw.jsx b/apps/docs/content/components/pagination/siblings.raw.jsx new file mode 100644 index 0000000000..711a37d3b9 --- /dev/null +++ b/apps/docs/content/components/pagination/siblings.raw.jsx @@ -0,0 +1,14 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ( +
+

1 Sibling (default)

+ +

2 Siblings

+ +

3 Siblings

+ +
+ ); +} diff --git a/apps/docs/content/components/pagination/siblings.ts b/apps/docs/content/components/pagination/siblings.ts index e54287d83a..af93036092 100644 --- a/apps/docs/content/components/pagination/siblings.ts +++ b/apps/docs/content/components/pagination/siblings.ts @@ -1,25 +1,4 @@ -const App = `import {Pagination, Button} from "@nextui-org/react"; - -export default function App() { - return ( -
-

1 Sibling (default)

- -

2 Siblings

- -

3 Siblings

- -
- ); -}`; +import App from "./siblings.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/sizes.raw.jsx b/apps/docs/content/components/pagination/sizes.raw.jsx new file mode 100644 index 0000000000..a91ac73bcb --- /dev/null +++ b/apps/docs/content/components/pagination/sizes.raw.jsx @@ -0,0 +1,13 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + const sizes = ["sm", "md", "lg"]; + + return ( +
+ {sizes.map((size) => ( + + ))} +
+ ); +} diff --git a/apps/docs/content/components/pagination/sizes.ts b/apps/docs/content/components/pagination/sizes.ts index 0400dfff03..85a2f5b30b 100644 --- a/apps/docs/content/components/pagination/sizes.ts +++ b/apps/docs/content/components/pagination/sizes.ts @@ -1,17 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - - const sizes = ["sm", "md", "lg"] - - return ( -
- {sizes.map((size) => ( - - ))} -
- ); -}`; +import App from "./sizes.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/usage.raw.jsx b/apps/docs/content/components/pagination/usage.raw.jsx new file mode 100644 index 0000000000..7bc069b20d --- /dev/null +++ b/apps/docs/content/components/pagination/usage.raw.jsx @@ -0,0 +1,5 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + return ; +} diff --git a/apps/docs/content/components/pagination/usage.ts b/apps/docs/content/components/pagination/usage.ts index 7b042283a0..1118304c37 100644 --- a/apps/docs/content/components/pagination/usage.ts +++ b/apps/docs/content/components/pagination/usage.ts @@ -1,10 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - return ( - - ); -}`; +import App from "./usage.raw.jsx?raw"; const react = { "/App.jsx": App, diff --git a/apps/docs/content/components/pagination/variants.raw.jsx b/apps/docs/content/components/pagination/variants.raw.jsx new file mode 100644 index 0000000000..5de44baff0 --- /dev/null +++ b/apps/docs/content/components/pagination/variants.raw.jsx @@ -0,0 +1,13 @@ +import {Pagination} from "@nextui-org/react"; + +export default function App() { + const variants = ["flat", "bordered", "faded", "light"]; + + return ( +
+ {variants.map((variant) => ( + + ))} +
+ ); +} diff --git a/apps/docs/content/components/pagination/variants.ts b/apps/docs/content/components/pagination/variants.ts index 7e049b1eb9..ddea95fb2e 100644 --- a/apps/docs/content/components/pagination/variants.ts +++ b/apps/docs/content/components/pagination/variants.ts @@ -1,17 +1,4 @@ -const App = `import {Pagination} from "@nextui-org/react"; - -export default function App() { - - const variants = ["flat", "bordered", "faded", "light"] - - return ( -
- {variants.map((variant) => ( - - ))} -
- ); -}`; +import App from "./variants.raw.jsx?raw"; const react = { "/App.jsx": App,