UNPKG

@konstructio/ui

Version:

A set of reusable and customizable React components built for konstruct.io

126 lines (125 loc) 3.28 kB
import { jsx as r, jsxs as s } from "react/jsx-runtime"; import { useMemo as I } from "react"; import { cn as c } from "../../utils/index.js"; import { TableProvider as K } from "./contexts/table.provider.js"; import { Filter as M } from "./components/Filter/Filter.js"; import { WrapperBody as W } from "./components/WrapperBody/WrapperBody.js"; import { Header as g } from "./components/Header/Header.js"; import { Body as q } from "./components/Body/Body.js"; import { Pagination as C } from "./components/Pagination/Pagination.js"; import { TruncateText as F } from "./components/TruncateText/TruncateText.js"; import { Actions as G } from "./components/Actions/Actions.js"; const J = ({ id: n, ariaLabel: p, columns: d, data: f, totalItems: b = -1 / 0, className: u, classNameHeaderActiveArrows: T, classNameHeaderArrows: x, classNameHeaderTable: N, classNameTable: A, classNameWrapperTable: y, isLoading: a, fetchData: h, queryOptions: z, // Pagination showPagination: B, showTotalItems: i, showDropdownPagination: t, showDotPagination: l, showFormPagination: m, pageSizes: V, // Filter showFilter: j = !1, showFilterInput: k, filterSearchPlaceholder: v = "", multiSelectFilter: w, filterActions: P, showResetButton: E = !0, resetButtonClassName: H }) => { const e = I( () => B || [ i, t, l, m ].some(Boolean), [] ); return /* @__PURE__ */ r( K, { id: n, columns: d, data: f, fetchData: h, totalItems: b, queryOptions: z, isPaginationEnabled: e, children: /* @__PURE__ */ s("section", { className: c("w-full min-w-fit", u), children: [ j && /* @__PURE__ */ r( M, { actions: P, multiSelectFilter: w, placeholder: v, showFilterInput: k, showResetButton: E, resetButtonClassName: H } ), /* @__PURE__ */ r( W, { showPagination: e, classNameWrapperTable: y, isLoading: a, children: /* @__PURE__ */ s( "table", { className: c( "w-full border-collapse table-fixed", "dark:border-separate dark:border-spacing-0", A ), "aria-label": p, children: [ /* @__PURE__ */ r( g, { className: N, classNameArrows: x, classNameActiveArrows: T } ), /* @__PURE__ */ r(q, { isLoading: a, showPagination: e }) ] } ) } ), e && /* @__PURE__ */ r( C, { showTotalItems: i, showDropdownPagination: t, showDotPagination: l, showFormPagination: m, pageSizes: V, isLoading: a } ) ] }) } ); }, o = J; o.displayName = "KonstructVirtualizedTable"; o.TruncateText = F; o.Actions = G; export { F as TruncateText, o as VirtualizedTable };