tembro 2.0.0 → 2.0.2

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/components/data-table/data-table.cjs +1 -1
  3. package/dist/components/data-table/data-table.js +68 -68
  4. package/dist/components/layout/app-sidebar.cjs +1 -1
  5. package/dist/components/layout/app-sidebar.d.ts +19 -1
  6. package/dist/components/layout/app-sidebar.js +253 -126
  7. package/dist/hooks/index.cjs +1 -1
  8. package/dist/hooks/index.js +4 -4
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.js +134 -134
  11. package/dist/showcase/package-meta.cjs +1 -1
  12. package/dist/showcase/package-meta.d.ts +3 -3
  13. package/dist/showcase/package-meta.js +1 -1
  14. package/dist/showcase/premium/app-shell/showcase.cjs +1 -1
  15. package/dist/showcase/premium/app-shell/showcase.js +5 -1
  16. package/dist/showcase/premium/app-sidebar/showcase.cjs +1 -1
  17. package/dist/showcase/premium/app-sidebar/showcase.js +91 -70
  18. package/dist/showcase/site-data.cjs +1 -1
  19. package/dist/showcase/site-data.js +1 -1
  20. package/dist/showcase/tembro-registry.json.cjs +1 -1
  21. package/dist/showcase/tembro-registry.json.js +1 -1
  22. package/package.json +1 -1
  23. package/packages/cli/dist/index.cjs +1 -1
  24. package/packages/cli/vendor/src/components/data-table/data-table.tsx +22 -13
  25. package/packages/cli/vendor/src/components/layout/app-sidebar.tsx +259 -21
  26. package/packages/cli/vendor/src/showcase/package-meta.ts +2 -2
  27. package/packages/cli/vendor/src/showcase/premium/app-shell/showcase.tsx +5 -1
  28. package/packages/cli/vendor/src/showcase/premium/app-sidebar/showcase.tsx +18 -4
  29. package/packages/cli/vendor/src/showcase/tembro-registry.json +1 -1
  30. package/registry.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 2.0.2 - 2026-07-08
6
+
7
+ ### Changed
8
+
9
+ - rebuilt `AppSidebar` into a responsive navigation surface with automatic mobile drawer behavior, overlay dismissal, escape handling, and close-on-select flow
10
+ - refreshed the `AppSidebar` and `AppShell` showcase demos so mobile and desktop sidebar behavior are both visible from the docs surface
11
+ - synced CLI vendor copies and added navigation render coverage for the new responsive sidebar contract
12
+
5
13
  ## 1.0.0 - 2026-07-08
6
14
 
7
15
  ### Changed
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/button/index.cjs"),r=require("../inputs/search-input.cjs"),i=require("../ui/table/index.cjs"),a=require("../feedback/empty-state.cjs"),o=require("../feedback/loading-state.cjs"),ee=require("./data-table-actions-column.cjs"),te=require("./data-table-bulk-actions.cjs"),ne=require("./data-table-column-visibility-menu.cjs"),re=require("./data-table-pagination.cjs"),ie=require("./data-table-toolbar.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime"),l=require("@tanstack/react-table");var ae={compact:`h-8 px-2 py-1.5`,default:`h-10 px-2 py-2`,comfortable:`h-12 px-3 py-3`},u={compact:`px-2 py-1.5`,default:`p-2`,comfortable:`px-3 py-3`};function oe(e,t){return typeof t==`function`?t(e):t}function se(e,t){return typeof t==`function`?t(e):t}function ce(e,t){return typeof t==`function`?t(e):t}function le(e){return e==null||e===``}function d({className:e,columns:d,data:f,title:p,description:m,features:h,search:g,toolbarActions:_,rowActions:v,bulkActions:y,onRefresh:b,onExport:x,refreshLabel:ue=`Refresh`,exportLabel:de=`Export`,getRowId:fe,isLoading:S=!1,isError:pe=!1,emptyState:me,errorState:he,loadingState:C,loadingVariant:ge=`skeleton`,toolbar:w,toolbarProps:T,pagination:E,sorting:_e,onSortingChange:ve,columnVisibility:ye,onColumnVisibilityChange:be,rowSelection:xe,onRowSelectionChange:Se,enableRowSelection:Ce,renderMobileCard:D,onRowClick:O,onRowDoubleClick:we,getRowDisabled:k,density:A=`default`,striped:j=!1,bordered:M=!1,stickyHeader:N=!1,skeletonRows:Te=6,skeletonCellClassName:Ee,cellFallback:De=`-`,tableClassName:Oe,tableWrapperClassName:ke,headerCellClassName:Ae,cellClassName:je,rowClassName:Me,renderExpandedRow:P,expanded:Ne,onExpandedChange:F,getRowCanExpand:Pe,columnPinning:I,onColumnPinningChange:Fe,...Ie}){let Le=s.useMemo(()=>{let e=d;return!v||h?.rowActions===!1?e:[...e,ee.createDataTableActionsColumn({getActions:v})]},[d,h?.rowActions,v]),L=E===!1?void 0:E,Re=L?{pageIndex:L.pageIndex,pageSize:L.pageSize}:void 0,R=!!(L&&L.manual!==!1),z=xe??{},ze=Object.keys(z).length,B=(0,l.useReactTable)({data:f,columns:Le,getRowId:fe,getCoreRowModel:(0,l.getCoreRowModel)(),getPaginationRowModel:L&&!R?(0,l.getPaginationRowModel)():void 0,manualPagination:R,pageCount:L?.pageCount,state:{sorting:_e,columnVisibility:ye,rowSelection:z,pagination:Re,expanded:Ne,...I?{columnPinning:I}:{}},onSortingChange:ve,onColumnVisibilityChange:be,onRowSelectionChange:Se,onExpandedChange:F,onColumnPinningChange:Fe,enableRowSelection:Ce,getRowCanExpand:Pe,getExpandedRowModel:(0,l.getExpandedRowModel)()}),V=B.getRowModel().rows,H=B.getSelectedRowModel().rows.map(e=>e.original),U=s.useMemo(()=>({table:B,data:f,selectedRows:H}),[f,H,B]),W=B.getVisibleLeafColumns(),Be=Math.max(W.length,1),G=typeof w==`function`?w(B):w,K=typeof T==`function`?T(B):T,Ve=!!(g&&h?.search!==!1),q=!!(h?.columnVisibility&&B.getAllLeafColumns().some(e=>e.getCanHide())),J=!!(h?.refresh&&b),Y=!!(h?.export&&x),He=!!(h?.bulkActions!==!1&&y?.length),X=Ve&&g?(0,c.jsx)(r.SearchInput,{value:g.value,onValueChange:g.onValueChange,placeholder:g.placeholder??`Search...`,wrapperClassName:g.wrapperClassName??g.className,inputClassName:g.inputClassName,disabled:g.disabled,clearable:g.clearable,clearLabel:g.clearLabel,searchIcon:g.searchIcon}):void 0,Ue=(0,c.jsxs)(c.Fragment,{children:[typeof _==`function`?_(U):_,q&&(0,c.jsx)(ne.DataTableColumnVisibilityMenu,{table:B}),J&&(0,c.jsx)(n.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:S,onClick:()=>b?.(U),children:ue}),Y&&(0,c.jsx)(n.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>x?.(U),children:de})]}),Z=He?(0,c.jsx)(te.DataTableBulkActions,{rows:H,actions:y??[],selectedLabel:()=>`Actions`,clearLabel:null,onClearSelection:()=>B.resetRowSelection(),hideWhenEmpty:!1}):void 0,We=!!(G||K||p||m||X||_||q||J||Y||Z),Ge=!!(L&&!L.hidden),Q=S&&ge===`skeleton`,Ke=e=>(0,c.jsx)(i.TableRow,{children:(0,c.jsx)(i.TableCell,{colSpan:Be,className:`p-0`,children:e})}),qe=()=>Array.from({length:Math.max(Te,1)},(e,n)=>(0,c.jsx)(i.TableRow,{"aria-hidden":`true`,children:W.map(e=>(0,c.jsx)(i.TableCell,{className:t.cn(u[A],M&&`border-r last:border-r-0`),children:(0,c.jsx)(`div`,{className:t.cn(`h-4 w-full max-w-40 animate-pulse rounded-md bg-muted`,n%3==1&&`max-w-24`,n%3==2&&`max-w-32`,Ee)})},`${e.id}-${n}`))},`skeleton-${n}`)),$=Q?null:S?(0,c.jsx)(o.LoadingState,{label:`Loading data...`,...C}):pe?(0,c.jsx)(a.EmptyState,{title:`Could not load data`,description:`Please try again.`,...he}):V.length===0?(0,c.jsx)(a.EmptyState,{...me}):null;return(0,c.jsxs)(`div`,{"data-slot":`data-table`,className:t.cn(`grid gap-3`,e),...Ie,children:[We&&(G??(0,c.jsx)(ie.DataTableToolbar,{title:p,description:m,search:X,actions:Ue,selectionActions:Z,selectedCount:ze,totalCount:L?L.rowCount??f.length:f.length,variant:`plain`,...K})),D&&(0,c.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:$??(Q?(0,c.jsx)(o.LoadingState,{label:`Loading data...`,...C}):V.map(e=>(0,c.jsx)(s.Fragment,{children:D(e)},e.id)))}),(0,c.jsxs)(`div`,{"data-slot":`data-table-wrapper`,"data-density":A,"data-striped":j||void 0,"data-bordered":M||void 0,className:t.cn(`overflow-hidden rounded-[var(--aui-card-radius,var(--radius-lg))] border border-[color:var(--aui-card-border,var(--border))] bg-card shadow-[var(--aui-card-shadow,0_10px_24px_rgba(15,23,42,0.07))] backdrop-blur`,D&&`hidden md:block`,ke),children:[(0,c.jsxs)(i.Table,{containerClassName:`rounded-none border-0 bg-transparent shadow-none ring-0`,className:t.cn(`text-[0.95rem]`,Oe),children:[(0,c.jsx)(i.TableHeader,{className:t.cn(N&&`sticky top-0 z-10 shadow-sm backdrop-blur`),children:B.getHeaderGroups().map(e=>(0,c.jsx)(i.TableRow,{children:e.headers.map(e=>(0,c.jsx)(i.TableHead,{style:{width:e.getSize(),...e.column.getIsPinned()===`left`?{left:`${e.column.getStart(`left`)}px`,position:`sticky`,zIndex:N?20:11}:{},...e.column.getIsPinned()===`right`?{right:`${e.column.getAfter(`right`)}px`,position:`sticky`,zIndex:N?20:11}:{}},className:t.cn(ae[A],`bg-[color:color-mix(in_oklch,var(--card),var(--background)_10%)] text-muted-foreground`,N&&`bg-[color:color-mix(in_oklch,var(--card),transparent_12%)] backdrop-blur`,e.column.getIsPinned()&&`bg-card shadow-[1px_0_0_var(--border)]`,M&&`border-r last:border-r-0`,se(e,Ae)),children:e.isPlaceholder?null:(0,l.flexRender)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,c.jsx)(i.TableBody,{children:$?Ke($):Q?qe():V.map((e,n)=>{let r=k?.(e)??!1;return(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(i.TableRow,{"data-state":e.getIsSelected()?`selected`:void 0,"data-striped":j&&n%2==1?`true`:void 0,"data-disabled":r||void 0,className:t.cn(O&&!r&&`cursor-pointer`,!r&&`transition-colors hover:bg-[color:color-mix(in_oklch,var(--primary),transparent_96%)] data-[state=selected]:bg-[color:color-mix(in_oklch,var(--primary),transparent_90%)]`,r&&`pointer-events-none opacity-55`,oe(e,Me)),onClick:()=>{r||O?.(e)},onDoubleClick:()=>{r||we?.(e)},children:e.getVisibleCells().map(e=>{let n=(0,l.flexRender)(e.column.columnDef.cell,e.getContext());return(0,c.jsx)(i.TableCell,{style:{...e.column.getIsPinned()===`left`?{left:`${e.column.getStart(`left`)}px`,position:`sticky`,zIndex:10}:{},...e.column.getIsPinned()===`right`?{right:`${e.column.getAfter(`right`)}px`,position:`sticky`,zIndex:10}:{}},className:t.cn(u[A],e.column.getIsPinned()&&`bg-card shadow-[1px_0_0_var(--border)]`,M&&`border-r last:border-r-0`,ce(e,je)),children:le(n)?De:n},e.id)})}),e.getIsExpanded()&&P&&(0,c.jsx)(i.TableRow,{className:`bg-muted/50 hover:bg-muted/50`,children:(0,c.jsx)(i.TableCell,{colSpan:e.getVisibleCells().length,children:P(e)})})]},e.id)})})]}),Ge&&L&&(0,c.jsx)(re.DataTablePagination,{pageIndex:L.pageIndex,pageSize:L.pageSize,pageCount:L.pageCount,rowCount:L.rowCount,pageSizeOptions:L.pageSizeOptions,showPageSize:L.showPageSize,labels:L.labels,disabled:S,onPageChange:L.onPageChange,onPageSizeChange:L.onPageSizeChange})]})]})}exports.DataTable=d;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/button/index.cjs"),r=require("../inputs/search-input.cjs"),i=require("../ui/table/index.cjs"),a=require("../feedback/empty-state.cjs"),o=require("../feedback/loading-state.cjs"),ee=require("./data-table-actions-column.cjs"),te=require("./data-table-bulk-actions.cjs"),ne=require("./data-table-column-visibility-menu.cjs"),re=require("./data-table-pagination.cjs"),ie=require("./data-table-toolbar.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime"),l=require("@tanstack/react-table");var ae={compact:`h-8 px-2 py-1.5`,default:`h-10 px-2 py-2`,comfortable:`h-12 px-3 py-3`},u={compact:`px-2 py-1.5`,default:`p-2`,comfortable:`px-3 py-3`};function oe(e,t){return typeof t==`function`?t(e):t}function se(e,t){return typeof t==`function`?t(e):t}function ce(e,t){return typeof t==`function`?t(e):t}function le(e){return e==null||e===``}function d({className:e,columns:d,data:f,title:p,description:m,features:h,search:g,toolbarActions:_,rowActions:v,bulkActions:y,onRefresh:b,onExport:x,refreshLabel:ue=`Refresh`,exportLabel:de=`Export`,getRowId:fe,isLoading:S=!1,isError:pe=!1,emptyState:me,errorState:he,loadingState:C,loadingVariant:ge=`skeleton`,toolbar:w,toolbarProps:T,pagination:E,sorting:_e,onSortingChange:ve,columnVisibility:ye,onColumnVisibilityChange:be,rowSelection:xe,onRowSelectionChange:Se,enableRowSelection:Ce,renderMobileCard:D,onRowClick:O,onRowDoubleClick:we,getRowDisabled:k,density:A=`default`,striped:j=!1,bordered:M=!1,stickyHeader:N=!1,skeletonRows:Te=6,skeletonCellClassName:Ee,cellFallback:De=`-`,tableClassName:Oe,tableWrapperClassName:ke,headerCellClassName:Ae,cellClassName:je,rowClassName:Me,renderExpandedRow:P,expanded:Ne,onExpandedChange:F,getRowCanExpand:Pe,columnPinning:I,onColumnPinningChange:Fe,...Ie}){let Le=s.useMemo(()=>{let e=d;return!v||h?.rowActions===!1?e:[...e,ee.createDataTableActionsColumn({getActions:v})]},[d,h?.rowActions,v]),L=E===!1?void 0:E,Re=L?{pageIndex:L.pageIndex,pageSize:L.pageSize}:void 0,R=!!(L&&L.manual!==!1),z=xe??{},ze=Object.keys(z).length,B=(0,l.useReactTable)({data:f,columns:Le,getRowId:fe,getCoreRowModel:(0,l.getCoreRowModel)(),getPaginationRowModel:L&&!R?(0,l.getPaginationRowModel)():void 0,manualPagination:R,pageCount:L?.pageCount,state:{sorting:_e,columnVisibility:ye,rowSelection:z,pagination:Re,expanded:Ne,...I?{columnPinning:I}:{}},onSortingChange:ve,onColumnVisibilityChange:be,onRowSelectionChange:Se,onExpandedChange:F,onColumnPinningChange:Fe,enableRowSelection:Ce,getRowCanExpand:Pe,getExpandedRowModel:(0,l.getExpandedRowModel)()}),V=B.getRowModel().rows,H=B.getSelectedRowModel().rows.map(e=>e.original),U=s.useMemo(()=>({table:B,data:f,selectedRows:H}),[f,H,B]),W=B.getVisibleLeafColumns(),Be=Math.max(W.length,1),G=typeof w==`function`?w(B):w,K=typeof T==`function`?T(B):T,Ve=!!(g&&h?.search!==!1),He=!!(h?.columnVisibility&&B.getAllLeafColumns().some(e=>e.getCanHide())),q=!!(h?.refresh&&b),J=!!(h?.export&&x),Ue=!!(h?.bulkActions!==!1&&y?.length),Y=He&&!!(p||m||g||_||q||J),X=Ve&&g?(0,c.jsx)(r.SearchInput,{value:g.value,onValueChange:g.onValueChange,placeholder:g.placeholder??`Search...`,wrapperClassName:g.wrapperClassName??g.className,inputClassName:g.inputClassName,disabled:g.disabled,clearable:g.clearable,clearLabel:g.clearLabel,searchIcon:g.searchIcon}):void 0,We=(0,c.jsxs)(c.Fragment,{children:[typeof _==`function`?_(U):_,Y&&(0,c.jsx)(ne.DataTableColumnVisibilityMenu,{table:B}),q&&(0,c.jsx)(n.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:S,onClick:()=>b?.(U),children:ue}),J&&(0,c.jsx)(n.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>x?.(U),children:de})]}),Z=Ue?(0,c.jsx)(te.DataTableBulkActions,{rows:H,actions:y??[],selectedLabel:()=>`Actions`,clearLabel:null,onClearSelection:()=>B.resetRowSelection(),hideWhenEmpty:!1}):void 0,Ge=!!(G||K||p||m||X||_||Y||q||J||Z),Ke=!!(L&&!L.hidden),Q=S&&ge===`skeleton`,qe=e=>(0,c.jsx)(i.TableRow,{children:(0,c.jsx)(i.TableCell,{colSpan:Be,className:`p-0`,children:e})}),Je=()=>Array.from({length:Math.max(Te,1)},(e,n)=>(0,c.jsx)(i.TableRow,{"aria-hidden":`true`,children:W.map(e=>(0,c.jsx)(i.TableCell,{className:t.cn(u[A],M&&`border-r last:border-r-0`),children:(0,c.jsx)(`div`,{className:t.cn(`h-4 w-full max-w-40 animate-pulse rounded-md bg-muted`,n%3==1&&`max-w-24`,n%3==2&&`max-w-32`,Ee)})},`${e.id}-${n}`))},`skeleton-${n}`)),$=Q?null:S?(0,c.jsx)(o.LoadingState,{label:`Loading data...`,...C}):pe?(0,c.jsx)(a.EmptyState,{title:`Could not load data`,description:`Please try again.`,...he}):V.length===0?(0,c.jsx)(a.EmptyState,{...me}):null;return(0,c.jsxs)(`div`,{"data-slot":`data-table`,className:t.cn(`grid gap-3`,e),...Ie,children:[Ge&&(G??(0,c.jsx)(ie.DataTableToolbar,{title:p,description:m,search:X,actions:We,selectionActions:Z,selectedCount:ze,totalCount:L?L.rowCount??f.length:f.length,variant:`plain`,...K})),D&&(0,c.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:$??(Q?(0,c.jsx)(o.LoadingState,{label:`Loading data...`,...C}):V.map(e=>(0,c.jsx)(s.Fragment,{children:D(e)},e.id)))}),(0,c.jsxs)(`div`,{"data-slot":`data-table-wrapper`,"data-density":A,"data-striped":j||void 0,"data-bordered":M||void 0,className:t.cn(`overflow-hidden rounded-[var(--aui-card-radius,var(--radius-lg))] border border-[color:var(--aui-card-border,var(--border))] bg-card shadow-[var(--aui-card-shadow,0_10px_24px_rgba(15,23,42,0.07))] backdrop-blur`,D&&`hidden md:block`,ke),children:[(0,c.jsxs)(i.Table,{containerClassName:`rounded-none border-0 bg-transparent shadow-none ring-0`,className:t.cn(`text-[0.95rem]`,Oe),children:[(0,c.jsx)(i.TableHeader,{className:t.cn(N&&`sticky top-0 z-10 shadow-sm backdrop-blur`),children:B.getHeaderGroups().map(e=>(0,c.jsx)(i.TableRow,{children:e.headers.map(e=>(0,c.jsx)(i.TableHead,{style:{width:e.getSize(),...e.column.getIsPinned()===`left`?{left:`${e.column.getStart(`left`)}px`,position:`sticky`,zIndex:N?20:11}:{},...e.column.getIsPinned()===`right`?{right:`${e.column.getAfter(`right`)}px`,position:`sticky`,zIndex:N?20:11}:{}},className:t.cn(ae[A],`bg-[color:color-mix(in_oklch,var(--card),var(--background)_10%)] text-muted-foreground`,N&&`bg-[color:color-mix(in_oklch,var(--card),transparent_12%)] backdrop-blur`,e.column.getIsPinned()&&`bg-card shadow-[1px_0_0_var(--border)]`,M&&`border-r last:border-r-0`,se(e,Ae)),children:e.isPlaceholder?null:(0,l.flexRender)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,c.jsx)(i.TableBody,{children:$?qe($):Q?Je():V.map((e,n)=>{let r=k?.(e)??!1;return(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(i.TableRow,{"data-state":e.getIsSelected()?`selected`:void 0,"data-striped":j&&n%2==1?`true`:void 0,"data-disabled":r||void 0,className:t.cn(O&&!r&&`cursor-pointer`,!r&&`transition-colors hover:bg-[color:color-mix(in_oklch,var(--primary),transparent_96%)] data-[state=selected]:bg-[color:color-mix(in_oklch,var(--primary),transparent_90%)]`,r&&`pointer-events-none opacity-55`,oe(e,Me)),onClick:()=>{r||O?.(e)},onDoubleClick:()=>{r||we?.(e)},children:e.getVisibleCells().map(e=>{let n=(0,l.flexRender)(e.column.columnDef.cell,e.getContext());return(0,c.jsx)(i.TableCell,{style:{...e.column.getIsPinned()===`left`?{left:`${e.column.getStart(`left`)}px`,position:`sticky`,zIndex:10}:{},...e.column.getIsPinned()===`right`?{right:`${e.column.getAfter(`right`)}px`,position:`sticky`,zIndex:10}:{}},className:t.cn(u[A],e.column.getIsPinned()&&`bg-card shadow-[1px_0_0_var(--border)]`,M&&`border-r last:border-r-0`,ce(e,je)),children:le(n)?De:n},e.id)})}),e.getIsExpanded()&&P&&(0,c.jsx)(i.TableRow,{className:`bg-muted/50 hover:bg-muted/50`,children:(0,c.jsx)(i.TableCell,{colSpan:e.getVisibleCells().length,children:P(e)})})]},e.id)})})]}),Ke&&L&&(0,c.jsx)(re.DataTablePagination,{pageIndex:L.pageIndex,pageSize:L.pageSize,pageCount:L.pageCount,rowCount:L.rowCount,pageSizeOptions:L.pageSizeOptions,showPageSize:L.showPageSize,labels:L.labels,disabled:S,onPageChange:L.onPageChange,onPageSizeChange:L.onPageSizeChange})]})]})}exports.DataTable=d;
@@ -11,46 +11,46 @@ import { DataTablePagination as oe } from "./data-table-pagination.js";
11
11
  import { DataTableToolbar as se } from "./data-table-toolbar.js";
12
12
  import * as c from "react";
13
13
  import { Fragment as ce, jsx as l, jsxs as u } from "react/jsx-runtime";
14
- import { flexRender as le, getCoreRowModel as ue, getExpandedRowModel as de, getPaginationRowModel as fe, useReactTable as pe } from "@tanstack/react-table";
14
+ import { flexRender as d, getCoreRowModel as le, getExpandedRowModel as ue, getPaginationRowModel as de, useReactTable as fe } from "@tanstack/react-table";
15
15
  //#region src/components/data-table/data-table.tsx
16
- var me = {
16
+ var pe = {
17
17
  compact: "h-8 px-2 py-1.5",
18
18
  default: "h-10 px-2 py-2",
19
19
  comfortable: "h-12 px-3 py-3"
20
- }, d = {
20
+ }, f = {
21
21
  compact: "px-2 py-1.5",
22
22
  default: "p-2",
23
23
  comfortable: "px-3 py-3"
24
24
  };
25
- function he(e, t) {
25
+ function me(e, t) {
26
26
  return typeof t == "function" ? t(e) : t;
27
27
  }
28
- function ge(e, t) {
28
+ function he(e, t) {
29
29
  return typeof t == "function" ? t(e) : t;
30
30
  }
31
- function _e(e, t) {
31
+ function ge(e, t) {
32
32
  return typeof t == "function" ? t(e) : t;
33
33
  }
34
- function ve(e) {
34
+ function _e(e) {
35
35
  return e == null || e === "";
36
36
  }
37
- function f({ className: f, columns: p, data: m, title: h, description: g, features: _, search: v, toolbarActions: y, rowActions: b, bulkActions: x, onRefresh: S, onExport: C, refreshLabel: ye = "Refresh", exportLabel: be = "Export", getRowId: xe, isLoading: w = !1, isError: Se = !1, emptyState: Ce, errorState: we, loadingState: T, loadingVariant: Te = "skeleton", toolbar: E, toolbarProps: D, pagination: O, sorting: Ee, onSortingChange: De, columnVisibility: Oe, onColumnVisibilityChange: ke, rowSelection: Ae, onRowSelectionChange: je, enableRowSelection: Me, renderMobileCard: k, onRowClick: A, onRowDoubleClick: Ne, getRowDisabled: Pe, density: j = "default", striped: M = !1, bordered: N = !1, stickyHeader: P = !1, skeletonRows: Fe = 6, skeletonCellClassName: Ie, cellFallback: Le = "-", tableClassName: Re, tableWrapperClassName: ze, headerCellClassName: Be, cellClassName: Ve, rowClassName: He, renderExpandedRow: F, expanded: Ue, onExpandedChange: We, getRowCanExpand: Ge, columnPinning: I, onColumnPinningChange: Ke, ...qe }) {
37
+ function p({ className: p, columns: m, data: h, title: g, description: _, features: v, search: y, toolbarActions: b, rowActions: x, bulkActions: S, onRefresh: C, onExport: w, refreshLabel: ve = "Refresh", exportLabel: ye = "Export", getRowId: be, isLoading: T = !1, isError: xe = !1, emptyState: Se, errorState: Ce, loadingState: we, loadingVariant: Te = "skeleton", toolbar: E, toolbarProps: D, pagination: O, sorting: Ee, onSortingChange: De, columnVisibility: Oe, onColumnVisibilityChange: ke, rowSelection: Ae, onRowSelectionChange: je, enableRowSelection: Me, renderMobileCard: k, onRowClick: A, onRowDoubleClick: Ne, getRowDisabled: Pe, density: j = "default", striped: M = !1, bordered: N = !1, stickyHeader: P = !1, skeletonRows: Fe = 6, skeletonCellClassName: Ie, cellFallback: Le = "-", tableClassName: Re, tableWrapperClassName: ze, headerCellClassName: Be, cellClassName: Ve, rowClassName: He, renderExpandedRow: F, expanded: Ue, onExpandedChange: We, getRowCanExpand: Ge, columnPinning: I, onColumnPinningChange: Ke, ...qe }) {
38
38
  let Je = c.useMemo(() => {
39
- let e = p;
40
- return !b || _?.rowActions === !1 ? e : [...e, re({ getActions: b })];
39
+ let e = m;
40
+ return !x || v?.rowActions === !1 ? e : [...e, re({ getActions: x })];
41
41
  }, [
42
- p,
43
- _?.rowActions,
44
- b
42
+ m,
43
+ v?.rowActions,
44
+ x
45
45
  ]), L = O === !1 ? void 0 : O, Ye = L ? {
46
46
  pageIndex: L.pageIndex,
47
47
  pageSize: L.pageSize
48
- } : void 0, R = !!(L && L.manual !== !1), z = Ae ?? {}, Xe = Object.keys(z).length, B = pe({
49
- data: m,
48
+ } : void 0, R = !!(L && L.manual !== !1), z = Ae ?? {}, Xe = Object.keys(z).length, B = fe({
49
+ data: h,
50
50
  columns: Je,
51
- getRowId: xe,
52
- getCoreRowModel: ue(),
53
- getPaginationRowModel: L && !R ? fe() : void 0,
51
+ getRowId: be,
52
+ getCoreRowModel: le(),
53
+ getPaginationRowModel: L && !R ? de() : void 0,
54
54
  manualPagination: R,
55
55
  pageCount: L?.pageCount,
56
56
  state: {
@@ -68,81 +68,81 @@ function f({ className: f, columns: p, data: m, title: h, description: g, featur
68
68
  onColumnPinningChange: Ke,
69
69
  enableRowSelection: Me,
70
70
  getRowCanExpand: Ge,
71
- getExpandedRowModel: de()
71
+ getExpandedRowModel: ue()
72
72
  }), V = B.getRowModel().rows, H = B.getSelectedRowModel().rows.map((e) => e.original), U = c.useMemo(() => ({
73
73
  table: B,
74
- data: m,
74
+ data: h,
75
75
  selectedRows: H
76
76
  }), [
77
- m,
77
+ h,
78
78
  H,
79
79
  B
80
- ]), W = B.getVisibleLeafColumns(), Ze = Math.max(W.length, 1), G = typeof E == "function" ? E(B) : E, K = typeof D == "function" ? D(B) : D, Qe = !!(v && _?.search !== !1), q = !!(_?.columnVisibility && B.getAllLeafColumns().some((e) => e.getCanHide())), J = !!(_?.refresh && S), Y = !!(_?.export && C), $e = !!(_?.bulkActions !== !1 && x?.length), X = Qe && v ? /* @__PURE__ */ l(n, {
81
- value: v.value,
82
- onValueChange: v.onValueChange,
83
- placeholder: v.placeholder ?? "Search...",
84
- wrapperClassName: v.wrapperClassName ?? v.className,
85
- inputClassName: v.inputClassName,
86
- disabled: v.disabled,
87
- clearable: v.clearable,
88
- clearLabel: v.clearLabel,
89
- searchIcon: v.searchIcon
90
- }) : void 0, et = /* @__PURE__ */ u(ce, { children: [
91
- typeof y == "function" ? y(U) : y,
92
- q && /* @__PURE__ */ l(ae, { table: B }),
93
- J && /* @__PURE__ */ l(t, {
80
+ ]), W = B.getVisibleLeafColumns(), Ze = Math.max(W.length, 1), G = typeof E == "function" ? E(B) : E, K = typeof D == "function" ? D(B) : D, Qe = !!(y && v?.search !== !1), $e = !!(v?.columnVisibility && B.getAllLeafColumns().some((e) => e.getCanHide())), q = !!(v?.refresh && C), J = !!(v?.export && w), et = !!(v?.bulkActions !== !1 && S?.length), Y = $e && !!(g || _ || y || b || q || J), X = Qe && y ? /* @__PURE__ */ l(n, {
81
+ value: y.value,
82
+ onValueChange: y.onValueChange,
83
+ placeholder: y.placeholder ?? "Search...",
84
+ wrapperClassName: y.wrapperClassName ?? y.className,
85
+ inputClassName: y.inputClassName,
86
+ disabled: y.disabled,
87
+ clearable: y.clearable,
88
+ clearLabel: y.clearLabel,
89
+ searchIcon: y.searchIcon
90
+ }) : void 0, tt = /* @__PURE__ */ u(ce, { children: [
91
+ typeof b == "function" ? b(U) : b,
92
+ Y && /* @__PURE__ */ l(ae, { table: B }),
93
+ q && /* @__PURE__ */ l(t, {
94
94
  type: "button",
95
95
  variant: "outline",
96
96
  size: "sm",
97
- disabled: w,
98
- onClick: () => S?.(U),
99
- children: ye
97
+ disabled: T,
98
+ onClick: () => C?.(U),
99
+ children: ve
100
100
  }),
101
- Y && /* @__PURE__ */ l(t, {
101
+ J && /* @__PURE__ */ l(t, {
102
102
  type: "button",
103
103
  variant: "outline",
104
104
  size: "sm",
105
- onClick: () => C?.(U),
106
- children: be
105
+ onClick: () => w?.(U),
106
+ children: ye
107
107
  })
108
- ] }), Z = $e ? /* @__PURE__ */ l(ie, {
108
+ ] }), Z = et ? /* @__PURE__ */ l(ie, {
109
109
  rows: H,
110
- actions: x ?? [],
110
+ actions: S ?? [],
111
111
  selectedLabel: () => "Actions",
112
112
  clearLabel: null,
113
113
  onClearSelection: () => B.resetRowSelection(),
114
114
  hideWhenEmpty: !1
115
- }) : void 0, tt = !!(G || K || h || g || X || y || q || J || Y || Z), nt = !!(L && !L.hidden), Q = w && Te === "skeleton", rt = (e) => /* @__PURE__ */ l(a, { children: /* @__PURE__ */ l(i, {
115
+ }) : void 0, nt = !!(G || K || g || _ || X || b || Y || q || J || Z), rt = !!(L && !L.hidden), Q = T && Te === "skeleton", it = (e) => /* @__PURE__ */ l(a, { children: /* @__PURE__ */ l(i, {
116
116
  colSpan: Ze,
117
117
  className: "p-0",
118
118
  children: e
119
- }) }), it = () => Array.from({ length: Math.max(Fe, 1) }, (t, n) => /* @__PURE__ */ l(a, {
119
+ }) }), at = () => Array.from({ length: Math.max(Fe, 1) }, (t, n) => /* @__PURE__ */ l(a, {
120
120
  "aria-hidden": "true",
121
121
  children: W.map((t) => /* @__PURE__ */ l(i, {
122
- className: e(d[j], N && "border-r last:border-r-0"),
122
+ className: e(f[j], N && "border-r last:border-r-0"),
123
123
  children: /* @__PURE__ */ l("div", { className: e("h-4 w-full max-w-40 animate-pulse rounded-md bg-muted", n % 3 == 1 && "max-w-24", n % 3 == 2 && "max-w-32", Ie) })
124
124
  }, `${t.id}-${n}`))
125
- }, `skeleton-${n}`)), $ = Q ? null : w ? /* @__PURE__ */ l(s, {
125
+ }, `skeleton-${n}`)), $ = Q ? null : T ? /* @__PURE__ */ l(s, {
126
126
  label: "Loading data...",
127
- ...T
128
- }) : Se ? /* @__PURE__ */ l(o, {
127
+ ...we
128
+ }) : xe ? /* @__PURE__ */ l(o, {
129
129
  title: "Could not load data",
130
130
  description: "Please try again.",
131
- ...we
132
- }) : V.length === 0 ? /* @__PURE__ */ l(o, { ...Ce }) : null;
131
+ ...Ce
132
+ }) : V.length === 0 ? /* @__PURE__ */ l(o, { ...Se }) : null;
133
133
  return /* @__PURE__ */ u("div", {
134
134
  "data-slot": "data-table",
135
- className: e("grid gap-3", f),
135
+ className: e("grid gap-3", p),
136
136
  ...qe,
137
137
  children: [
138
- tt && (G ?? /* @__PURE__ */ l(se, {
139
- title: h,
140
- description: g,
138
+ nt && (G ?? /* @__PURE__ */ l(se, {
139
+ title: g,
140
+ description: _,
141
141
  search: X,
142
- actions: et,
142
+ actions: tt,
143
143
  selectionActions: Z,
144
144
  selectedCount: Xe,
145
- totalCount: L ? L.rowCount ?? m.length : m.length,
145
+ totalCount: L ? L.rowCount ?? h.length : h.length,
146
146
  variant: "plain",
147
147
  ...K
148
148
  })),
@@ -150,7 +150,7 @@ function f({ className: f, columns: p, data: m, title: h, description: g, featur
150
150
  className: "grid gap-3 md:hidden",
151
151
  children: $ ?? (Q ? /* @__PURE__ */ l(s, {
152
152
  label: "Loading data...",
153
- ...T
153
+ ...we
154
154
  }) : V.map((e) => /* @__PURE__ */ l(c.Fragment, { children: k(e) }, e.id)))
155
155
  }),
156
156
  /* @__PURE__ */ u("div", {
@@ -178,16 +178,16 @@ function f({ className: f, columns: p, data: m, title: h, description: g, featur
178
178
  zIndex: P ? 20 : 11
179
179
  } : {}
180
180
  },
181
- className: e(me[j], "bg-[color:color-mix(in_oklch,var(--card),var(--background)_10%)] text-muted-foreground", P && "bg-[color:color-mix(in_oklch,var(--card),transparent_12%)] backdrop-blur", t.column.getIsPinned() && "bg-card shadow-[1px_0_0_var(--border)]", N && "border-r last:border-r-0", ge(t, Be)),
182
- children: t.isPlaceholder ? null : le(t.column.columnDef.header, t.getContext())
181
+ className: e(pe[j], "bg-[color:color-mix(in_oklch,var(--card),var(--background)_10%)] text-muted-foreground", P && "bg-[color:color-mix(in_oklch,var(--card),transparent_12%)] backdrop-blur", t.column.getIsPinned() && "bg-card shadow-[1px_0_0_var(--border)]", N && "border-r last:border-r-0", he(t, Be)),
182
+ children: t.isPlaceholder ? null : d(t.column.columnDef.header, t.getContext())
183
183
  }, t.id)) }, t.id))
184
- }), /* @__PURE__ */ l(ee, { children: $ ? rt($) : Q ? it() : V.map((t, n) => {
184
+ }), /* @__PURE__ */ l(ee, { children: $ ? it($) : Q ? at() : V.map((t, n) => {
185
185
  let r = Pe?.(t) ?? !1;
186
186
  return /* @__PURE__ */ u(c.Fragment, { children: [/* @__PURE__ */ l(a, {
187
187
  "data-state": t.getIsSelected() ? "selected" : void 0,
188
188
  "data-striped": M && n % 2 == 1 ? "true" : void 0,
189
189
  "data-disabled": r || void 0,
190
- className: e(A && !r && "cursor-pointer", !r && "transition-colors hover:bg-[color:color-mix(in_oklch,var(--primary),transparent_96%)] data-[state=selected]:bg-[color:color-mix(in_oklch,var(--primary),transparent_90%)]", r && "pointer-events-none opacity-55", he(t, He)),
190
+ className: e(A && !r && "cursor-pointer", !r && "transition-colors hover:bg-[color:color-mix(in_oklch,var(--primary),transparent_96%)] data-[state=selected]:bg-[color:color-mix(in_oklch,var(--primary),transparent_90%)]", r && "pointer-events-none opacity-55", me(t, He)),
191
191
  onClick: () => {
192
192
  r || A?.(t);
193
193
  },
@@ -195,7 +195,7 @@ function f({ className: f, columns: p, data: m, title: h, description: g, featur
195
195
  r || Ne?.(t);
196
196
  },
197
197
  children: t.getVisibleCells().map((t) => {
198
- let n = le(t.column.columnDef.cell, t.getContext());
198
+ let n = d(t.column.columnDef.cell, t.getContext());
199
199
  return /* @__PURE__ */ l(i, {
200
200
  style: {
201
201
  ...t.column.getIsPinned() === "left" ? {
@@ -209,8 +209,8 @@ function f({ className: f, columns: p, data: m, title: h, description: g, featur
209
209
  zIndex: 10
210
210
  } : {}
211
211
  },
212
- className: e(d[j], t.column.getIsPinned() && "bg-card shadow-[1px_0_0_var(--border)]", N && "border-r last:border-r-0", _e(t, Ve)),
213
- children: ve(n) ? Le : n
212
+ className: e(f[j], t.column.getIsPinned() && "bg-card shadow-[1px_0_0_var(--border)]", N && "border-r last:border-r-0", ge(t, Ve)),
213
+ children: _e(n) ? Le : n
214
214
  }, t.id);
215
215
  })
216
216
  }), t.getIsExpanded() && F && /* @__PURE__ */ l(a, {
@@ -221,7 +221,7 @@ function f({ className: f, columns: p, data: m, title: h, description: g, featur
221
221
  })
222
222
  })] }, t.id);
223
223
  }) })]
224
- }), nt && L && /* @__PURE__ */ l(oe, {
224
+ }), rt && L && /* @__PURE__ */ l(oe, {
225
225
  pageIndex: L.pageIndex,
226
226
  pageSize: L.pageSize,
227
227
  pageCount: L.pageCount,
@@ -229,7 +229,7 @@ function f({ className: f, columns: p, data: m, title: h, description: g, featur
229
229
  pageSizeOptions: L.pageSizeOptions,
230
230
  showPageSize: L.showPageSize,
231
231
  labels: L.labels,
232
- disabled: w,
232
+ disabled: T,
233
233
  onPageChange: L.onPageChange,
234
234
  onPageSizeChange: L.onPageSizeChange
235
235
  })]
@@ -238,4 +238,4 @@ function f({ className: f, columns: p, data: m, title: h, description: g, featur
238
238
  });
239
239
  }
240
240
  //#endregion
241
- export { f as DataTable };
241
+ export { p as DataTable };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/tooltip/index.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime");function a(e){return e.items?.some(e=>!e.hidden)??!1}function o(e){return e.active?!0:e.items?.some(e=>o(e))??!1}function s({item:e,collapsed:r,depth:a,onItemSelect:o,renderLink:s}){let c={"aria-current":e.current??(e.active?`page`:void 0),"aria-disabled":e.disabled||void 0,"data-slot":`app-sidebar-item`,"data-active":e.active||void 0,"data-disabled":e.disabled||void 0,"data-depth":String(a),className:t.cn(`flex min-h-9 items-center gap-2 rounded-lg border border-transparent px-2.5 text-sm font-medium outline-none transition-[background-color,border-color,color,box-shadow] data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,r&&`justify-center px-2`)},l=(0,i.jsxs)(i.Fragment,{children:[e.icon&&(0,i.jsx)(`span`,{className:`shrink-0`,children:e.icon}),!r&&(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),!r&&e.badge&&(0,i.jsx)(`span`,{className:`shrink-0`,children:e.badge})]}),u=t=>r?(0,i.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,i.jsx)(`span`,{className:`block`,children:t})}):t;return e.href?.startsWith(`/`)?u(s?(0,i.jsx)(i.Fragment,{children:s({item:e,href:e.href,...c,onClick:t=>{if(e.disabled){t.preventDefault();return}e.onSelect?.(),o?.(e)},children:l})}):(0,i.jsx)(`a`,{href:e.href,...c,onClick:t=>{if(e.disabled){t.preventDefault();return}e.onSelect?.(),o?.(e)},children:l})):e.href?u((0,i.jsx)(`button`,{type:`button`,...c,className:t.cn(c.className,`w-full`),onClick:()=>{if(e.disabled)return;let t=e.href;if(t){if(e.onSelect?.(),o?.(e),t.startsWith(`http`)){window.open(t,`_blank`,`noopener,noreferrer`);return}window.location.assign(t)}},children:l})):u((0,i.jsx)(`button`,{type:`button`,disabled:e.disabled,...c,onClick:()=>{e.onSelect?.(),o?.(e)},children:l}))}function c({items:e,collapsed:l,depth:u,onItemSelect:d,renderLink:f}){return e.map(e=>{if(e.hidden)return null;let p=a(e),m=o(e),h=!l&&u===0&&e.sectionLabel;if(!p)return(0,i.jsxs)(r.Fragment,{children:[h?(0,i.jsx)(`div`,{"data-slot":`app-sidebar-group-label`,className:`px-2.5 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground first:pt-0`,children:e.sectionLabel}):null,(0,i.jsx)(s,{item:e,collapsed:l,depth:u,onItemSelect:d,renderLink:f})]},e.key);let g=e.defaultExpanded??m;return(0,i.jsxs)(`div`,{"data-slot":`app-sidebar-group`,"data-depth":u,children:[h&&(0,i.jsx)(`div`,{"data-slot":`app-sidebar-group-label`,className:`px-2.5 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground first:pt-0`,children:e.sectionLabel}),(0,i.jsxs)(`details`,{"data-slot":`app-sidebar-group-details`,open:g,className:`group/app-sidebar-details`,children:[(0,i.jsxs)(`summary`,{"data-slot":`app-sidebar-group-trigger`,className:t.cn(`flex min-h-9 list-none items-center gap-2 rounded-lg border border-transparent text-sm font-medium outline-none transition-[background-color,border-color,color,box-shadow]`,l?`justify-center px-2`:`px-2.5`),children:[e.icon?l?(0,i.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,i.jsx)(`span`,{className:`shrink-0`,children:e.icon})}):(0,i.jsx)(`span`,{className:`shrink-0`,children:e.icon}):null,!l&&(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),!l&&e.badge&&(0,i.jsx)(`span`,{className:`shrink-0`,children:e.badge}),!l&&(0,i.jsx)(`span`,{"data-slot":`app-sidebar-group-chevron`,className:`ml-auto text-xs text-muted-foreground transition-transform group-open/app-sidebar-details:rotate-90`,children:`›`})]}),(0,i.jsx)(`div`,{"data-slot":`app-sidebar-group-content`,className:t.cn(`mt-1 space-y-1`,!l&&`pl-3`),children:(0,i.jsx)(c,{items:e.items??[],collapsed:l,depth:u+1,onItemSelect:d,renderLink:f})})]})]},e.key)})}function l({item:e,collapsed:r,onItemSelect:a}){let o=(0,i.jsxs)(`button`,{type:`button`,"data-slot":`app-sidebar-action`,"data-active":e.active||void 0,"data-disabled":e.disabled||void 0,className:t.cn(`flex min-h-9 items-center gap-2 rounded-lg border border-transparent px-2.5 text-sm font-medium outline-none transition-[background-color,border-color,color,box-shadow] data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,r&&`justify-center px-2`),disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect?.(),a?.(e))},children:[e.icon?(0,i.jsx)(`span`,{className:`shrink-0`,children:e.icon}):null,r?null:(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),!r&&e.badge?(0,i.jsx)(`span`,{className:`shrink-0`,children:e.badge}):null]});return r?(0,i.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,i.jsx)(`span`,{className:`block`,children:o})}):o}function u({account:e,collapsed:r}){let a=(0,i.jsxs)(`button`,{type:`button`,"data-slot":`app-sidebar-account`,className:t.cn(`flex w-full items-center gap-3 rounded-[min(var(--radius-xl),16px)] border border-transparent text-left transition-[background-color,border-color,color,box-shadow]`,r?`justify-center px-2 py-2.5`:`px-3 py-2.5`),onClick:()=>{if(e.onSelect?.(),e.href){if(e.href.startsWith(`http`)){window.open(e.href,`_blank`,`noopener,noreferrer`);return}window.location.assign(e.href)}},children:[e.avatar?(0,i.jsx)(`span`,{"data-slot":`app-sidebar-account-avatar`,className:`inline-flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border/65 bg-muted/45 text-sm font-semibold`,children:e.avatar}):null,r?null:(0,i.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,i.jsx)(`span`,{"data-slot":`app-sidebar-account-label`,className:`block truncate text-sm font-semibold text-foreground`,children:e.label}),e.description?(0,i.jsx)(`span`,{"data-slot":`app-sidebar-account-description`,className:`block truncate text-xs text-muted-foreground`,children:e.description}):null]})]});return r?(0,i.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,i.jsx)(`span`,{className:`block`,children:a})}):a}function d({className:e,header:a,footer:o,items:s=[],collapsed:d=!1,collapsedRail:f,railItems:p=[],footerAccount:m,secondaryActions:h=[],footerSecondary:g,tooltipOnCollapsed:_=!0,onItemSelect:v,renderItem:y,renderLink:b,children:x,...S}){let C=s.filter(e=>!e.hidden),w=p.filter(e=>!e.hidden),T=h.filter(e=>!e.hidden);return(0,i.jsxs)(`aside`,{"data-slot":`app-sidebar`,"data-collapsed":d||void 0,className:t.cn(`flex h-full min-h-0 flex-col overflow-hidden`,e),...S,children:[a&&(0,i.jsx)(`div`,{"data-slot":`app-sidebar-header`,className:`shrink-0 border-b p-3`,children:a}),(0,i.jsxs)(`nav`,{"data-slot":`app-sidebar-nav`,className:`min-h-0 flex-1 space-y-1 overflow-y-auto overscroll-contain p-2`,children:[x??C.map(e=>{if(!y)return null;let t=y(e,{collapsed:d});return!d||!_?(0,i.jsx)(r.Fragment,{children:t},e.key):(0,i.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,i.jsx)(`span`,{className:`block`,children:t})},e.key)}),!x&&!y&&(0,i.jsx)(c,{items:C,collapsed:d,depth:0,onItemSelect:v,renderLink:b})]}),(m||g||o||T.length>0||d&&(f||w.length>0))&&(0,i.jsxs)(`div`,{"data-slot":`app-sidebar-footer`,className:`shrink-0 border-t p-3`,children:[d?(0,i.jsxs)(i.Fragment,{children:[w.length>0?(0,i.jsx)(`div`,{"data-slot":`app-sidebar-rail-actions`,className:`grid gap-2`,children:w.map(e=>(0,i.jsx)(l,{item:e,collapsed:!0,onItemSelect:v},e.key))}):null,f?(0,i.jsx)(`div`,{"data-slot":`app-sidebar-rail`,children:f}):null]}):null,!d&&m?(0,i.jsx)(`div`,{"data-slot":`app-sidebar-account-wrap`,className:`mb-3`,children:(0,i.jsx)(u,{account:m,collapsed:!1})}):null,!d&&T.length>0?(0,i.jsx)(`div`,{"data-slot":`app-sidebar-secondary-actions`,className:`mb-3 grid gap-2`,children:T.map(e=>(0,i.jsx)(l,{item:e,collapsed:!1,onItemSelect:v},e.key))}):null,!d&&g?(0,i.jsx)(`div`,{"data-slot":`app-sidebar-footer-secondary`,className:`mb-3`,children:g}):null,d&&m?(0,i.jsx)(`div`,{"data-slot":`app-sidebar-account-wrap`,children:(0,i.jsx)(u,{account:m,collapsed:!0})}):null,!d&&o]})]})}var f=d;exports.AppSidebar=d,exports.Sidebar=f;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/tooltip/index.cjs"),r=require("../../hooks/use-is-mobile.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("lucide-react"),o=require("react/jsx-runtime");var s=1024;function c(e){return e.items?.some(e=>!e.hidden)??!1}function l(e){return e.active?!0:e.items?.some(e=>l(e))??!1}function u(e,t){e.onSelect?.(),t?.(e)}function d({item:e,collapsed:r,depth:i,onItemSelect:a,renderLink:s}){let c={"aria-current":e.current??(e.active?`page`:void 0),"aria-disabled":e.disabled||void 0,"data-slot":`app-sidebar-item`,"data-active":e.active||void 0,"data-disabled":e.disabled||void 0,"data-depth":String(i),className:t.cn(`flex min-h-9 items-center gap-2 rounded-lg border border-transparent px-2.5 text-sm font-medium outline-none transition-[background-color,border-color,color,box-shadow] data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,r&&`justify-center px-2`)},l=(0,o.jsxs)(o.Fragment,{children:[e.icon&&(0,o.jsx)(`span`,{className:`shrink-0`,children:e.icon}),!r&&(0,o.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),!r&&e.badge&&(0,o.jsx)(`span`,{className:`shrink-0`,children:e.badge})]}),d=t=>r?(0,o.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,o.jsx)(`span`,{className:`block`,children:t})}):t;return e.href?.startsWith(`/`)?d(s?(0,o.jsx)(o.Fragment,{children:s({item:e,href:e.href,...c,onClick:t=>{if(e.disabled){t.preventDefault();return}u(e,a)},children:l})}):(0,o.jsx)(`a`,{href:e.href,...c,onClick:t=>{if(e.disabled){t.preventDefault();return}u(e,a)},children:l})):e.href?d((0,o.jsx)(`button`,{type:`button`,...c,className:t.cn(c.className,`w-full`),onClick:()=>{if(e.disabled)return;let t=e.href;if(t){if(u(e,a),t.startsWith(`http`)){window.open(t,`_blank`,`noopener,noreferrer`);return}window.location.assign(t)}},children:l})):d((0,o.jsx)(`button`,{type:`button`,disabled:e.disabled,...c,onClick:()=>{e.disabled||u(e,a)},children:l}))}function f({items:e,collapsed:r,depth:a,onItemSelect:s,renderLink:u}){return e.map(e=>{if(e.hidden)return null;let p=c(e),m=l(e),h=!r&&a===0&&e.sectionLabel;if(!p)return(0,o.jsxs)(i.Fragment,{children:[h?(0,o.jsx)(`div`,{"data-slot":`app-sidebar-group-label`,className:`px-2.5 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground first:pt-0`,children:e.sectionLabel}):null,(0,o.jsx)(d,{item:e,collapsed:r,depth:a,onItemSelect:s,renderLink:u})]},e.key);let g=e.defaultExpanded??m;return(0,o.jsxs)(`div`,{"data-slot":`app-sidebar-group`,"data-depth":a,children:[h&&(0,o.jsx)(`div`,{"data-slot":`app-sidebar-group-label`,className:`px-2.5 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground first:pt-0`,children:e.sectionLabel}),(0,o.jsxs)(`details`,{"data-slot":`app-sidebar-group-details`,open:g,className:`group/app-sidebar-details`,children:[(0,o.jsxs)(`summary`,{"data-slot":`app-sidebar-group-trigger`,className:t.cn(`flex min-h-9 list-none items-center gap-2 rounded-lg border border-transparent text-sm font-medium outline-none transition-[background-color,border-color,color,box-shadow]`,r?`justify-center px-2`:`px-2.5`),children:[e.icon?r?(0,o.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,o.jsx)(`span`,{className:`shrink-0`,children:e.icon})}):(0,o.jsx)(`span`,{className:`shrink-0`,children:e.icon}):null,!r&&(0,o.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),!r&&e.badge&&(0,o.jsx)(`span`,{className:`shrink-0`,children:e.badge}),!r&&(0,o.jsx)(`span`,{"data-slot":`app-sidebar-group-chevron`,className:`ml-auto text-xs text-muted-foreground transition-transform group-open/app-sidebar-details:rotate-90`,children:`›`})]}),(0,o.jsx)(`div`,{"data-slot":`app-sidebar-group-content`,className:t.cn(`mt-1 space-y-1`,!r&&`pl-3`),children:(0,o.jsx)(f,{items:e.items??[],collapsed:r,depth:a+1,onItemSelect:s,renderLink:u})})]})]},e.key)})}function p({item:e,collapsed:r,onItemSelect:i}){let a=(0,o.jsxs)(`button`,{type:`button`,"data-slot":`app-sidebar-action`,"data-active":e.active||void 0,"data-disabled":e.disabled||void 0,className:t.cn(`flex min-h-9 items-center gap-2 rounded-lg border border-transparent px-2.5 text-sm font-medium outline-none transition-[background-color,border-color,color,box-shadow] data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,r&&`justify-center px-2`),disabled:e.disabled,onClick:()=>{e.disabled||u(e,i)},children:[e.icon?(0,o.jsx)(`span`,{className:`shrink-0`,children:e.icon}):null,r?null:(0,o.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),!r&&e.badge?(0,o.jsx)(`span`,{className:`shrink-0`,children:e.badge}):null]});return r?(0,o.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,o.jsx)(`span`,{className:`block`,children:a})}):a}function m({account:e,collapsed:r,onAfterSelect:i}){let a=(0,o.jsxs)(`button`,{type:`button`,"data-slot":`app-sidebar-account`,className:t.cn(`flex w-full items-center gap-3 rounded-[min(var(--radius-xl),16px)] border border-transparent text-left transition-[background-color,border-color,color,box-shadow]`,r?`justify-center px-2 py-2.5`:`px-3 py-2.5`),onClick:()=>{if(e.onSelect?.(),i?.(),e.href){if(e.href.startsWith(`http`)){window.open(e.href,`_blank`,`noopener,noreferrer`);return}window.location.assign(e.href)}},children:[e.avatar?(0,o.jsx)(`span`,{"data-slot":`app-sidebar-account-avatar`,className:`inline-flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border/65 bg-muted/45 text-sm font-semibold`,children:e.avatar}):null,r?null:(0,o.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`span`,{"data-slot":`app-sidebar-account-label`,className:`block truncate text-sm font-semibold text-foreground`,children:e.label}),e.description?(0,o.jsx)(`span`,{"data-slot":`app-sidebar-account-description`,className:`block truncate text-xs text-muted-foreground`,children:e.description}):null]})]});return r?(0,o.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,o.jsx)(`span`,{className:`block`,children:a})}):a}function h({className:e,header:r,footer:s,items:c=[],collapsed:l=!1,collapsedRail:u,railItems:d=[],footerAccount:h,secondaryActions:g=[],footerSecondary:_,tooltipOnCollapsed:v,onItemSelect:y,renderItem:b,renderLink:x,children:S,mobile:C,mobileTitle:w,mobileDescription:T,onRequestClose:E,closeOnSelect:D=!0,...O}){let k=c.filter(e=>!e.hidden),A=d.filter(e=>!e.hidden),j=g.filter(e=>!e.hidden),M=i.useCallback(e=>{y?.(e),C&&D&&E?.()},[D,C,y,E]),N=C&&(w||T||E);return(0,o.jsxs)(`aside`,{"data-slot":`app-sidebar`,"data-collapsed":l||void 0,"data-mobile":C||void 0,className:t.cn(`flex h-full min-h-0 flex-col overflow-hidden`,e),...O,children:[(r||N)&&(0,o.jsx)(`div`,{"data-slot":`app-sidebar-header`,className:`shrink-0 border-b p-3`,children:(0,o.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r??null,N?(0,o.jsxs)(`div`,{className:t.cn(r&&`mt-3`),children:[w?(0,o.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:w}):null,T?(0,o.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:T}):null]}):null]}),C&&E?(0,o.jsx)(`button`,{type:`button`,"aria-label":`Close navigation`,"data-slot":`app-sidebar-mobile-close`,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-xl border border-[color:var(--aui-divider)] bg-[color:var(--aui-page-bg-alt)] text-[color:var(--aui-page-foreground)] transition hover:bg-[color:var(--aui-control-bg)]`,onClick:E,children:(0,o.jsx)(a.XIcon,{className:`size-4`})}):null]})}),(0,o.jsxs)(`nav`,{"data-slot":`app-sidebar-nav`,className:`min-h-0 flex-1 space-y-1 overflow-y-auto overscroll-contain p-2`,children:[S??k.map(e=>{if(!b)return null;let t=b(e,{collapsed:l});return!l||!v?(0,o.jsx)(i.Fragment,{children:t},e.key):(0,o.jsx)(n.Tooltip,{content:e.tooltip??e.label,side:`right`,children:(0,o.jsx)(`span`,{className:`block`,children:t})},e.key)}),!S&&!b&&(0,o.jsx)(f,{items:k,collapsed:l,depth:0,onItemSelect:M,renderLink:x})]}),(h||_||s||j.length>0||l&&(u||A.length>0))&&(0,o.jsxs)(`div`,{"data-slot":`app-sidebar-footer`,className:`shrink-0 border-t p-3`,children:[l?(0,o.jsxs)(o.Fragment,{children:[A.length>0?(0,o.jsx)(`div`,{"data-slot":`app-sidebar-rail-actions`,className:`grid gap-2`,children:A.map(e=>(0,o.jsx)(p,{item:e,collapsed:!0,onItemSelect:M},e.key))}):null,u?(0,o.jsx)(`div`,{"data-slot":`app-sidebar-rail`,children:u}):null]}):null,!l&&h?(0,o.jsx)(`div`,{"data-slot":`app-sidebar-account-wrap`,className:`mb-3`,children:(0,o.jsx)(m,{account:h,collapsed:!1,onAfterSelect:()=>{C&&D&&E?.()}})}):null,!l&&j.length>0?(0,o.jsx)(`div`,{"data-slot":`app-sidebar-secondary-actions`,className:`mb-3 grid gap-2`,children:j.map(e=>(0,o.jsx)(p,{item:e,collapsed:!1,onItemSelect:M},e.key))}):null,!l&&_?(0,o.jsx)(`div`,{"data-slot":`app-sidebar-footer-secondary`,className:`mb-3`,children:_}):null,l&&h?(0,o.jsx)(`div`,{"data-slot":`app-sidebar-account-wrap`,children:(0,o.jsx)(m,{account:h,collapsed:!0,onAfterSelect:()=>{C&&D&&E?.()}})}):null,!l&&s]})]})}function g({className:e,header:n,footer:c,items:l=[],collapsed:u=!1,collapsedRail:d,railItems:f=[],footerAccount:p,secondaryActions:m=[],footerSecondary:g,tooltipOnCollapsed:_=!0,responsive:v=!0,mobileBreakpoint:y=s,mobileOpen:b,defaultMobileOpen:x=!1,onMobileOpenChange:S,mobileTitle:C,mobileDescription:w,mobileToggleLabel:T=`Open navigation`,mobileToggleIcon:E,showMobileToggle:D=!0,closeOnSelect:O=!0,mobileToggleClassName:k,mobilePanelClassName:A,mobileOverlayClassName:j,renderMobileToggle:M,onItemSelect:N,renderItem:P,renderLink:F,children:I,...L}){let R=v?r.useIsMobile(y):!1,[z,B]=i.useState(x),V=b??z,H=i.useCallback(e=>{b??B(e),S?.(e)},[b,S]);i.useEffect(()=>{!R&&V&&H(!1)},[R,V,H]),i.useEffect(()=>{if(!R||!V)return;let e=document.body.style.overflow;document.body.style.overflow=`hidden`;let t=e=>{e.key===`Escape`&&H(!1)};return window.addEventListener(`keydown`,t),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,t)}},[R,V,H]);let U={className:e,header:n,footer:c,items:l,collapsed:u,collapsedRail:d,railItems:f,footerAccount:p,secondaryActions:m,footerSecondary:g,tooltipOnCollapsed:_,closeOnSelect:O,onItemSelect:N,renderItem:P,renderLink:F,children:I,...L};if(!v||!R)return(0,o.jsx)(h,{...U});let W=(0,o.jsxs)(`button`,{type:`button`,"aria-label":V?`Close navigation`:T,"data-slot":`app-sidebar-mobile-trigger`,"data-state":V?`open`:`closed`,className:t.cn(`inline-flex min-h-10 items-center gap-2 rounded-xl border border-[color:var(--aui-divider)] bg-[color:var(--aui-page-bg)] px-3 text-sm font-medium text-[color:var(--aui-page-foreground)] shadow-sm transition hover:bg-[color:var(--aui-page-bg-alt)]`,k),onClick:()=>H(!V),children:[(0,o.jsx)(`span`,{className:`inline-flex size-8 items-center justify-center rounded-lg bg-[color:var(--aui-page-bg-alt)]`,children:E??(0,o.jsx)(a.MenuIcon,{className:`size-4`})}),(0,o.jsx)(`span`,{children:V?`Close navigation`:T})]});return(0,o.jsxs)(o.Fragment,{children:[D?M?M({open:V,setOpen:H}):W:null,(0,o.jsxs)(`div`,{"data-slot":`app-sidebar-mobile-root`,className:`relative z-40`,children:[(0,o.jsx)(`button`,{type:`button`,"aria-label":`Dismiss navigation`,"data-slot":`app-sidebar-mobile-overlay`,"data-state":V?`open`:`closed`,className:t.cn(`fixed inset-0 z-40 bg-black/45 transition-opacity duration-200`,V?`opacity-100`:`pointer-events-none opacity-0`,j),onClick:()=>H(!1)}),(0,o.jsx)(h,{...U,mobile:!0,collapsed:!1,mobileTitle:C,mobileDescription:w,onRequestClose:()=>H(!1),"data-state":V?`open`:`closed`,role:`dialog`,"aria-modal":`true`,"aria-label":typeof C==`string`?C:`Navigation`,className:t.cn(`fixed inset-y-0 left-0 z-50 w-[min(88vw,22rem)] max-w-[22rem] border-r border-[color:var(--aui-divider)] bg-[color:var(--aui-page-bg)] shadow-2xl transition-transform duration-200 ease-out`,V?`translate-x-0`:`-translate-x-full`,A,e)})]})]})}var _=g;exports.AppSidebar=g,exports.Sidebar=_;
@@ -34,6 +34,24 @@ export type AppSidebarProps = React.ComponentProps<"aside"> & {
34
34
  secondaryActions?: AppSidebarNavItem[];
35
35
  footerSecondary?: React.ReactNode;
36
36
  tooltipOnCollapsed?: boolean;
37
+ responsive?: boolean;
38
+ mobileBreakpoint?: number;
39
+ mobileOpen?: boolean;
40
+ defaultMobileOpen?: boolean;
41
+ onMobileOpenChange?: (open: boolean) => void;
42
+ mobileTitle?: React.ReactNode;
43
+ mobileDescription?: React.ReactNode;
44
+ mobileToggleLabel?: string;
45
+ mobileToggleIcon?: React.ReactNode;
46
+ showMobileToggle?: boolean;
47
+ closeOnSelect?: boolean;
48
+ mobileToggleClassName?: string;
49
+ mobilePanelClassName?: string;
50
+ mobileOverlayClassName?: string;
51
+ renderMobileToggle?: (state: {
52
+ open: boolean;
53
+ setOpen: (open: boolean) => void;
54
+ }) => React.ReactNode;
37
55
  onItemSelect?: (item: AppSidebarNavItem) => void;
38
56
  renderItem?: (item: AppSidebarNavItem, state: {
39
57
  collapsed: boolean;
@@ -43,7 +61,7 @@ export type AppSidebarProps = React.ComponentProps<"aside"> & {
43
61
  [key: `data-${string}`]: string | boolean | undefined;
44
62
  }) => React.ReactNode;
45
63
  };
46
- declare function AppSidebar({ className, header, footer, items, collapsed, collapsedRail, railItems, footerAccount, secondaryActions, footerSecondary, tooltipOnCollapsed, onItemSelect, renderItem, renderLink, children, ...props }: AppSidebarProps): React.JSX.Element;
64
+ declare function AppSidebar({ className, header, footer, items, collapsed, collapsedRail, railItems, footerAccount, secondaryActions, footerSecondary, tooltipOnCollapsed, responsive, mobileBreakpoint, mobileOpen: mobileOpenProp, defaultMobileOpen, onMobileOpenChange, mobileTitle, mobileDescription, mobileToggleLabel, mobileToggleIcon, showMobileToggle, closeOnSelect, mobileToggleClassName, mobilePanelClassName, mobileOverlayClassName, renderMobileToggle, onItemSelect, renderItem, renderLink, children, ...props }: AppSidebarProps): React.JSX.Element;
47
65
  /**
48
66
  * Canonical sidebar surface for new usage.
49
67
  */