UNPKG

@playbooks/ui

Version:

An interface library for Playbooks.

91 lines (90 loc) 2.81 kB
import { jsx } from "react/jsx-runtime"; import { BtnWrapper } from "./buttons.es.js"; import { useUI } from "./context.es.js"; import { FarIcon } from "./icons.es.js"; import { Nav } from "./navs.es.js"; const Pagination = ({ name = "Pagination", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.pagination(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(Nav, { ...computed, children }); }; const PaginationFirst = ({ name = "PaginationFirst", alt = "first page", disabled, tailwind, className, onClick, ...props }) => { const context = useUI(); const base = context?.theme?.paginationBtn(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(BtnWrapper, { name, alt, onClick, disabled, ...computed, children: /* @__PURE__ */ jsx(FarIcon, { icon: "chevrons-left" }) }); }; const PaginationPrev = ({ name = "PaginationPrev", alt = "prev page", disabled, tailwind, className, onClick, ...props }) => { const context = useUI(); const base = context?.theme?.paginationBtn(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(BtnWrapper, { name, alt, onClick, disabled, ...computed, children: /* @__PURE__ */ jsx(FarIcon, { icon: "chevron-left" }) }); }; const PaginationBtn = ({ name = "PaginationBtn", alt = "specific page", active, tailwind, className = "", onClick, children, ...props }) => { const context = useUI(); const base = context?.theme?.paginationBtn({ active }); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(BtnWrapper, { name, alt, active, onClick, ...computed, children }); }; const PaginationNext = ({ name = "PaginationNext", alt = "next page", disabled, tailwind, className, onClick, ...props }) => { const context = useUI(); const base = context?.theme?.paginationBtn(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(BtnWrapper, { name, alt, onClick, disabled, ...computed, children: /* @__PURE__ */ jsx(FarIcon, { icon: "chevron-right" }) }); }; const PaginationLast = ({ name = "PaginationLast", alt = "last page", disabled, tailwind, className, onClick, ...props }) => { const context = useUI(); const base = context?.theme?.paginationBtn(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(BtnWrapper, { name, alt, onClick, disabled, ...computed, children: /* @__PURE__ */ jsx(FarIcon, { icon: "chevrons-right" }) }); }; export { Pagination, PaginationBtn, PaginationFirst, PaginationLast, PaginationNext, PaginationPrev };