UNPKG

@konstructio/ui

Version:

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

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