@sth87/shadcn-design-system 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("@tanstack/react-table"),y=require("react"),M=require("./data-table-pagination.cjs"),d=require("../../packages/ui/src/lib/utils.cjs"),n=require("../../packages/ui/src/components/table.cjs"),v=require("../../utils/data-table.cjs"),N=require("./data-table-column-header.cjs");function z({table:s,actionBar:m,children:C,className:S,pagination:i=!0,sticky:c=!0,stickyFooter:R=!1,bordered:k=!0,loading:g,loadingIndicator:P,footer:f,emptyState:H,onRowClick:u,rowClassName:b,renderRow:x,renderCell:h,classNames:o,showTotalCount:q=!0,totalCount:D,...I}){const a=c?{offsetHeader:typeof c=="object"?c.offsetHeader??0:0,offsetScroll:typeof c=="object"?c.offsetScroll:void 0}:null,j=s.getVisibleLeafColumns().length;return e.jsxs("div",{className:d.cn("ds:flex ds:w-full ds:flex-col ds:gap-2.5 ds:relative",S),...I,children:[C,g&&e.jsx("div",{className:d.cn("ds:absolute ds:inset-0 ds:bg-background/50 ds:flex ds:items-center ds:justify-center ds:z-20",o?.loadingOverlay),children:P??"Loading..."}),e.jsxs(n.Table,{className:o?.table,containerClassName:d.cn(k&&"ds:rounded-md ds:border ds:border-border","ds:[scrollbar-width:thin] ds:[scrollbar-color:var(--border)_transparent]","ds:[&::-webkit-scrollbar]:h-1.5 ds:[&::-webkit-scrollbar]:w-1.5","ds:[&::-webkit-scrollbar-track]:bg-transparent","ds:[&::-webkit-scrollbar-thumb]:rounded-full ds:[&::-webkit-scrollbar-thumb]:bg-border","ds:[&::-webkit-scrollbar-thumb:hover]:bg-muted-foreground",g&&"ds:blur-sm",o?.container),containerStyle:a?{maxHeight:`calc(100vh - ${a.offsetScroll??0}px)`}:void 0,children:[e.jsx(n.TableHeader,{children:s.getHeaderGroups().map(t=>e.jsx(n.TableRow,{className:o?.headerRow,children:t.headers.map(l=>e.jsx(n.TableHead,{colSpan:l.colSpan,className:d.cn(o?.headerCell,l.column.getIsPinned()&&"ds:bg-background"),style:{...v.getCommonPinningStyles({column:l.column,withBorder:!0}),...a&&{position:"sticky",top:a.offsetHeader,zIndex:l.column.getIsPinned()?3:2,background:"var(--background)"}},children:l.isPlaceholder?null:l.column.columnDef.header?typeof l.column.columnDef.header=="function"?T.flexRender(l.column.columnDef.header,l.getContext()):e.jsx(N.DataTableColumnHeader,{column:l.column}):null},l.id))},t.id))}),e.jsx(n.TableBody,{className:o?.body,children:s.getRowModel().rows?.length?s.getRowModel().rows.map(t=>{const l=typeof b=="function"?b(t):b,p=e.jsx(n.TableRow,{"data-state":t.getIsSelected()&&"selected",className:d.cn(o?.row,l,u&&"ds:cursor-pointer"),onClick:u?r=>u(t,r):void 0,children:t.getVisibleCells().map(r=>{const w=e.jsx(n.TableCell,{className:d.cn(o?.cell,r.column.getIsPinned()&&"ds:bg-background"),style:{...v.getCommonPinningStyles({column:r.column,withBorder:!0})},children:T.flexRender(r.column.columnDef.cell,r.getContext())},r.id);return h?e.jsx(y.Fragment,{children:h(r,w)},r.id):w})},t.id);return x?e.jsx(y.Fragment,{children:x(t,p)},t.id):p}):e.jsx(n.TableRow,{className:o?.emptyRow,children:e.jsx(n.TableCell,{colSpan:j,className:d.cn("ds:h-24 ds:text-center",o?.emptyCell),children:H??"No results."})})}),f&&e.jsx(n.TableFooter,{children:e.jsx(n.TableRow,{className:o?.footerRow,children:e.jsx(n.TableCell,{colSpan:j,className:o?.footerCell,style:R?{position:"sticky",bottom:0,zIndex:2}:void 0,children:f(s.getRowModel().rows.map(t=>t.original))})})})]}),e.jsxs("div",{className:"ds:flex ds:flex-col ds:gap-2.5",children:[i&&e.jsx(M.DataTablePagination,{showTotalCount:q,totalCount:D,showPageSizeOptions:!0,showRowSelectionCount:!0,table:s,...i===!0?{}:i}),m&&s.getFilteredSelectedRowModel().rows.length>0&&m]})]})}exports.DataTable=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("@tanstack/react-table"),y=require("react"),I=require("./data-table-pagination.cjs"),d=require("../../packages/ui/src/lib/utils.cjs"),n=require("../../packages/ui/src/components/table.cjs"),v=require("../../utils/data-table.cjs"),N=require("./data-table-column-header.cjs");function M({table:r,actionBar:m,children:S,className:C,pagination:a=!0,sticky:c=!0,stickyFooter:R=!1,bordered:k=!0,loading:g,loadingIndicator:P,footer:f,emptyState:q,onRowClick:u,rowClassName:b,renderRow:x,renderCell:h,classNames:t,showTotalCount:H=!0,totalCount:D,...z}){const i=c?{offsetHeader:typeof c=="object"?c.offsetHeader??0:0,offsetScroll:typeof c=="object"?c.offsetScroll:void 0}:null,p=r.getVisibleLeafColumns().length;return e.jsxs("div",{className:d.cn("ds:flex ds:w-full ds:flex-col ds:gap-2.5 ds:relative",C),...z,children:[S,g&&e.jsx("div",{className:d.cn("ds:absolute ds:inset-0 ds:bg-background/50 ds:flex ds:items-center ds:justify-center ds:z-20",t?.loadingOverlay),children:P??"Loading..."}),e.jsxs(n.Table,{className:d.cn("ds:table-fixed",t?.table),style:{minWidth:r.getTotalSize()},containerClassName:d.cn(k&&"ds:rounded-md ds:border ds:border-border","ds:[scrollbar-width:thin] ds:[scrollbar-color:var(--border)_transparent]","ds:[&::-webkit-scrollbar]:h-1.5 ds:[&::-webkit-scrollbar]:w-1.5","ds:[&::-webkit-scrollbar-track]:bg-transparent","ds:[&::-webkit-scrollbar-thumb]:rounded-full ds:[&::-webkit-scrollbar-thumb]:bg-border","ds:[&::-webkit-scrollbar-thumb:hover]:bg-muted-foreground","ds:[container-type:inline-size]",g&&"ds:blur-sm",t?.container),containerStyle:i?{maxHeight:`calc(100vh - ${i.offsetScroll??0}px)`}:void 0,children:[e.jsx(n.TableHeader,{children:r.getHeaderGroups().map(o=>e.jsx(n.TableRow,{className:t?.headerRow,children:o.headers.map(l=>e.jsx(n.TableHead,{colSpan:l.colSpan,className:d.cn(t?.headerCell,l.column.getIsPinned()&&"ds:bg-background"),style:{...v.getCommonPinningStyles({column:l.column,withBorder:!0}),...i&&{position:"sticky",top:i.offsetHeader,zIndex:l.column.getIsPinned()?3:2,background:"var(--background)"}},children:l.isPlaceholder?null:l.column.columnDef.header?typeof l.column.columnDef.header=="function"?T.flexRender(l.column.columnDef.header,l.getContext()):e.jsx(N.DataTableColumnHeader,{column:l.column}):null},l.id))},o.id))}),e.jsx(n.TableBody,{className:t?.body,children:r.getRowModel().rows?.length?r.getRowModel().rows.map(o=>{const l=typeof b=="function"?b(o):b,j=e.jsx(n.TableRow,{"data-state":o.getIsSelected()&&"selected",className:d.cn(t?.row,l,u&&"ds:cursor-pointer"),onClick:u?s=>u(o,s):void 0,children:o.getVisibleCells().map(s=>{const w=e.jsx(n.TableCell,{className:d.cn("ds:overflow-hidden ds:text-ellipsis",t?.cell,s.column.getIsPinned()&&"ds:bg-background"),style:{...v.getCommonPinningStyles({column:s.column,withBorder:!0})},children:T.flexRender(s.column.columnDef.cell,s.getContext())},s.id);return h?e.jsx(y.Fragment,{children:h(s,w)},s.id):w})},o.id);return x?e.jsx(y.Fragment,{children:x(o,j)},o.id):j}):e.jsx(n.TableRow,{className:t?.emptyRow,children:e.jsx(n.TableCell,{colSpan:p,className:d.cn("ds:h-24 ds:text-center",t?.emptyCell),children:q??"No results."})})}),f&&e.jsx(n.TableFooter,{children:e.jsx(n.TableRow,{className:t?.footerRow,children:e.jsx(n.TableCell,{colSpan:p,className:t?.footerCell,style:R?{position:"sticky",bottom:0,zIndex:2}:void 0,children:e.jsx("div",{className:"ds:sticky ds:left-2 ds:w-[calc(100cqw-1rem)]",children:f(r.getRowModel().rows.map(o=>o.original))})})})})]}),e.jsxs("div",{className:"ds:flex ds:flex-col ds:gap-2.5",children:[a&&e.jsx(I.DataTablePagination,{showTotalCount:H,totalCount:D,showPageSizeOptions:!0,showRowSelectionCount:!0,table:r,...a===!0?{}:a}),m&&r.getFilteredSelectedRowModel().rows.length>0&&m]})]})}exports.DataTable=M;