flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 4.28 kB
Source Map (JSON)
{"version":3,"file":"PaginationButton.cjs","sources":["../../../src/components/Pagination/PaginationButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type ComponentProps, type ReactEventHandler, type ReactNode } from \"react\";\nimport { get } from \"../../helpers/get\";\nimport { useResolveTheme } from \"../../helpers/resolve-theme\";\nimport { twMerge } from \"../../helpers/tailwind-merge\";\nimport { useThemeProvider } from \"../../theme/provider\";\nimport type { ThemingProps } from \"../../types\";\nimport { paginationTheme } from \"./theme\";\n\nexport interface PaginationButtonTheme {\n base: string;\n active: string;\n disabled: string;\n}\n\nexport interface PaginationButtonProps extends ComponentProps<\"button\">, ThemingProps<PaginationButtonTheme> {\n active?: boolean;\n children?: ReactNode;\n className?: string;\n onClick?: ReactEventHandler<HTMLButtonElement>;\n}\n\nexport interface PaginationPrevButtonProps extends Omit<PaginationButtonProps, \"active\"> {\n disabled?: boolean;\n}\n\nexport const PaginationButton = forwardRef<HTMLButtonElement, PaginationButtonProps>(\n ({ active, children, className, onClick, theme: customTheme, clearTheme, applyTheme, ...props }, ref) => {\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [paginationTheme, provider.theme?.pagination, customTheme],\n [get(provider.clearTheme, \"pagination\"), clearTheme],\n [get(provider.applyTheme, \"pagination\"), applyTheme],\n );\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={twMerge(active && theme.pages.selector.active, className)}\n onClick={onClick}\n {...props}\n >\n {children}\n </button>\n );\n },\n);\n\nPaginationButton.displayName = \"PaginationButton\";\n\nexport function PaginationNavigation({\n children,\n className,\n onClick,\n disabled = false,\n theme: customTheme,\n clearTheme,\n applyTheme,\n ...props\n}: PaginationPrevButtonProps) {\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [paginationTheme, provider.theme?.pagination, customTheme],\n [get(provider.clearTheme, \"pagination\"), clearTheme],\n [get(provider.applyTheme, \"pagination\"), applyTheme],\n );\n\n return (\n <button\n type=\"button\"\n className={twMerge(disabled && theme.pages.selector.disabled, className)}\n disabled={disabled}\n onClick={onClick}\n {...props}\n >\n {children}\n </button>\n );\n}\n\nPaginationNavigation.displayName = \"PaginationNavigation\";\n"],"names":["forwardRef","provider","useThemeProvider","theme","useResolveTheme","paginationTheme","get","jsx","twMerge"],"mappings":";;;;;;;;;;AASY,MAAC,gBAAgB,GAAGA,gBAAU;AAC1C,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AAC3G,IAAI,MAAMC,UAAQ,GAAGC,yBAAgB,EAAE;AACvC,IAAI,MAAMC,OAAK,GAAGC,4BAAe;AACjC,MAAM,CAACC,qBAAe,EAAEJ,UAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,CAAC;AAChE,MAAM,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,UAAU,CAAC;AAC1D,MAAM,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,UAAU;AACzD,KAAK;AACL,IAAI,uBAAuBM,cAAG;AAC9B,MAAM,QAAQ;AACd,MAAM;AACN,QAAQ,GAAG;AACX,QAAQ,IAAI,EAAE,QAAQ;AACtB,QAAQ,SAAS,EAAEC,qBAAO,CAAC,MAAM,IAAIL,OAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;AAC5E,QAAQ,OAAO;AACf,QAAQ,GAAG,KAAK;AAChB,QAAQ;AACR;AACA,KAAK;AACL;AACA;AACA,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;AAC1C,SAAS,oBAAoB,CAAC;AACrC,EAAE,QAAQ;AACV,EAAE,SAAS;AACX,EAAE,OAAO;AACT,EAAE,QAAQ,GAAG,KAAK;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