react-semaphor 0.1.301 → 0.1.302

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 (66) hide show
  1. package/dist/appearance/index.cjs +1 -0
  2. package/dist/appearance/index.js +9 -0
  3. package/dist/brand-studio/index.cjs +21 -0
  4. package/dist/brand-studio/index.js +1512 -0
  5. package/dist/chunks/{braces-BwK7fWd_.js → braces-CpOcaBNm.js} +1 -1
  6. package/dist/chunks/{braces-Bhqo4iW1.js → braces-TYclg8Hl.js} +1 -1
  7. package/dist/chunks/dashboard-controls-BkuB9TQX.js +47 -0
  8. package/dist/chunks/dashboard-controls-CZuC_QjN.js +2227 -0
  9. package/dist/chunks/dashboard-filter-controls-button-2I1ltWQ9.js +11 -0
  10. package/dist/chunks/{dashboard-filter-controls-button-DjALRkvg.js → dashboard-filter-controls-button-kfb_T18o.js} +205 -216
  11. package/dist/chunks/dashboard-json-C3v6rBdp.js +1 -0
  12. package/dist/chunks/{dashboard-json-D-zIG46N.js → dashboard-json-Df6v2Jem.js} +14 -12
  13. package/dist/chunks/dashboard-summary-settings-dialog-BBALEHJQ.js +1 -0
  14. package/dist/chunks/{dashboard-summary-settings-dialog-D-F1eEJI.js → dashboard-summary-settings-dialog-DKAaWq-G.js} +64 -63
  15. package/dist/chunks/date-formatter-D9Bvw5Qk.js +1 -0
  16. package/dist/chunks/date-formatter-DyIOb6uC.js +333 -0
  17. package/dist/chunks/edit-dashboard-visual-CGBYahAK.js +183 -0
  18. package/dist/chunks/{edit-dashboard-visual-BjflrL8w.js → edit-dashboard-visual-D8L0cl_U.js} +6691 -6679
  19. package/dist/chunks/{index-DDA12yqV.js → index-BmoR3VQT.js} +48608 -66300
  20. package/dist/chunks/index-Cxb9UUro.js +4 -0
  21. package/dist/chunks/index-D7KJindZ.js +1 -0
  22. package/dist/chunks/index-DFOb_6HB.js +1657 -0
  23. package/dist/chunks/index-eM6MU4q_.js +1361 -0
  24. package/dist/chunks/index-uRJmUpof.js +2555 -0
  25. package/dist/chunks/palette-326-dgn0.js +6 -0
  26. package/dist/chunks/palette-jd7xiGTg.js +23 -0
  27. package/dist/chunks/{resource-management-panel-B2558XA1.js → resource-management-panel-C_c-BwrC.js} +116 -115
  28. package/dist/chunks/resource-management-panel-DrcEEARD.js +6 -0
  29. package/dist/chunks/rotate-ccw-BugHcM1w.js +6 -0
  30. package/dist/chunks/rotate-ccw-yFwqBFJZ.js +14 -0
  31. package/dist/chunks/save-CaybXtdd.js +6 -0
  32. package/dist/chunks/save-DU0FXUlM.js +21 -0
  33. package/dist/chunks/switch-AmoR1YIA.js +163 -0
  34. package/dist/chunks/switch-CZtMtqEj.js +19725 -0
  35. package/dist/chunks/{use-create-flow-overlay-state-BUw_JtLs.js → use-create-flow-overlay-state-84Xe8VrP.js} +396 -412
  36. package/dist/chunks/use-create-flow-overlay-state-CiKVJGWF.js +16 -0
  37. package/dist/chunks/use-visual-utils-lp5DfmvL.js +1 -0
  38. package/dist/chunks/{use-visual-utils-C45OxsOf.js → use-visual-utils-z3ifg6Fd.js} +54 -53
  39. package/dist/dashboard/index.cjs +1 -1
  40. package/dist/dashboard/index.js +1 -1
  41. package/dist/format-utils/index.cjs +1 -1
  42. package/dist/format-utils/index.js +2 -2
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +210 -207
  45. package/dist/style.css +1 -1
  46. package/dist/surfboard/index.cjs +1 -1
  47. package/dist/surfboard/index.js +2 -2
  48. package/dist/types/appearance.d.ts +176 -0
  49. package/dist/types/brand-studio.d.ts +245 -0
  50. package/dist/types/dashboard.d.ts +134 -0
  51. package/dist/types/main.d.ts +141 -1
  52. package/dist/types/surfboard.d.ts +134 -0
  53. package/dist/types/types.d.ts +139 -0
  54. package/package.json +13 -1
  55. package/dist/chunks/dashboard-controls-BIRiWCUK.js +0 -47
  56. package/dist/chunks/dashboard-controls-DIlnYo96.js +0 -2219
  57. package/dist/chunks/dashboard-filter-controls-button-CK1-mKQh.js +0 -11
  58. package/dist/chunks/dashboard-json-DK4mQ1gS.js +0 -1
  59. package/dist/chunks/dashboard-summary-settings-dialog-DSxNqxFI.js +0 -1
  60. package/dist/chunks/date-formatter-CqXdM6JO.js +0 -1
  61. package/dist/chunks/date-formatter-vkCj9Ct-.js +0 -1982
  62. package/dist/chunks/edit-dashboard-visual-DCsrtJr_.js +0 -193
  63. package/dist/chunks/index-8GnvL1_L.js +0 -1523
  64. package/dist/chunks/resource-management-panel-CKp4_aem.js +0 -6
  65. package/dist/chunks/use-create-flow-overlay-state-CWcCdPbC.js +0 -21
  66. package/dist/chunks/use-visual-utils-DyaThRzf.js +0 -1
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("./switch-AmoR1YIA.js"),x=require("react"),t=require("./index-eM6MU4q_.js"),oe=require("./use-visual-utils-lp5DfmvL.js");/**
2
+ * @license lucide-react v0.453.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ie=r.createLucideIcon("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);function le(s,f={}){const{enabled:m=!0,eventType:d="mousedown"}=f,l=x.useRef(null);return x.useEffect(()=>{const p=N=>{const a=N.target;l.current&&l.current.contains(a)||a instanceof Element&&(a.closest("[data-radix-popper-content-wrapper]")||a.closest("[data-radix-select-content]")||a.closest("[data-radix-popover-content]")||a.closest("[data-radix-dropdown-menu-content]")||a.closest("[data-radix-tooltip-content]")||a.closest('[role="listbox"]')||a.closest('[role="option"]')||a.closest('[role="combobox"]'))||a instanceof Element&&a.hasAttribute("data-radix-")||s()};return m&&document.addEventListener(d,p),()=>{document.removeEventListener(d,p)}},[s,m,d]),l}function re(){return e.jsx("div",{className:"space-y-1.5 py-1",children:[...Array(5)].map((s,f)=>e.jsxs("div",{className:"flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",children:[e.jsx("div",{className:"mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-3/5 rounded bg-muted/60"}),e.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40"})]})]},f))})}const de=s=>{const f=r.useDashboardStore(l=>l.isVisualEditing),m=r.useDashboardStore(l=>l.selectedFrameId),d=r.useEditorStore(l=>l.frame);return!!(f&&m&&(d==null?void 0:d.visualId)===s)};function ce({visual:s,isDeleting:f,isDuplicating:m,onAddVisual:d,onOpenVisual:l,onEditDetails:p,onDeleteClick:N,onDuplicateVisual:a,onShareVisual:b,formatDate:C}){var I,O,P,B;const{selectVisual:g}=t.useManagementActions(),c=t.useIsVisualSelected(s.id),h=de(s.id),L=r.useDashboardStore(i=>i.isVisualEditing),{isConsoleMode:T}=t.useDashboardPreferences(),D=x.useRef(null),[v,E]=x.useState(!1),[V,M]=x.useState(!1);x.useEffect(()=>{m?(E(!0),M(!0)):V&&(E(!1),M(!1))},[m,V]),x.useEffect(()=>{h&&D.current&&D.current.scrollIntoView({behavior:"smooth",block:"center"})},[h]);const y=()=>{g(s),l==null||l(s)},S=i=>{i.currentTarget===i.target&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),y())};return e.jsxs("div",{ref:D,className:r.cn("group flex cursor-pointer items-start gap-1 rounded-[5px] px-2 py-1.5 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",h?"bg-muted ring-1 ring-inset ring-foreground/20":c&&"bg-muted"),onClick:y,children:[e.jsxs("div",{role:"button",tabIndex:0,className:"min-w-0 flex-1 cursor-pointer focus-visible:outline-none",onKeyDown:S,children:[e.jsx("p",{className:"truncate text-[13px] font-medium leading-5 text-foreground",title:s.title||"Untitled Visual",children:s.title||"Untitled Visual"}),e.jsx("p",{className:"truncate text-[11px] leading-4 text-muted-foreground",title:s.description||"No description",children:(I=s.description)!=null&&I.trim()?s.description:"No description"})]}),e.jsx("div",{className:r.cn("flex shrink-0 items-center transition-opacity",c||h||v?"pointer-events-auto opacity-100":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100"),onClick:i=>i.stopPropagation(),children:e.jsxs("div",{className:"inline-flex h-7 items-stretch overflow-hidden rounded-[5px] border border-border/60 bg-background",children:[e.jsxs(r.Button,{size:"xs",variant:"ghost",className:"h-full rounded-none border-0 shadow-none hover:bg-accent/50",disabled:L,onClick:i=>{i.stopPropagation(),d(s)},"aria-label":`Add ${s.title||"visual"}`,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Add"]}),e.jsxs(t.DropdownMenu,{modal:!1,open:v,onOpenChange:E,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(r.Button,{size:"xs",variant:"ghost",className:"h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent/50","aria-label":"Open visual actions",children:e.jsx(t.EllipsisVertical,{className:"h-3.5 w-3.5"})})}),e.jsxs(t.DropdownMenuContent,{align:"end",className:"z-[51] w-44 rounded-[6px] border border-border/60 p-1 shadow-sm",children:[e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),d(s)},disabled:L,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Add"]}),e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),l==null||l(s)},children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),"Open"]}),e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.preventDefault(),i.stopPropagation(),a(s.id)},disabled:m,children:[m?e.jsx(r.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Copy,{className:"h-3.5 w-3.5"}),m?"Duplicating…":"Duplicate"]}),s.ownership.isOwner&&e.jsxs(e.Fragment,{children:[e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),p==null||p(s)},children:[e.jsx(t.PenLine,{className:"h-3.5 w-3.5"}),"Edit details"]}),e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),b(s)},children:[e.jsx(t.Users,{className:"h-3.5 w-3.5"}),"Share"]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),N(s)},className:"text-destructive focus:bg-destructive/10 focus:text-destructive",disabled:f,children:[e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),f?"Deleting…":"Delete"]})]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs("div",{className:"space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground",children:[(((O=s.ownership.createdBy)==null?void 0:O.type)==="tenant"||((P=s.ownership.createdBy)==null?void 0:P.type)==="organization"&&T)&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(t.User,{className:"h-3 w-3"}),e.jsx("span",{children:((B=s.ownership.createdBy)==null?void 0:B.name)||"Unknown"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(t.Calendar,{className:"h-3 w-3"}),e.jsx("span",{children:C(s.lastModified)})]})]})]})]})]})})]})}function ue({searchQuery:s}){const[f,m]=x.useState(!1),[d,l]=x.useState(null),[p,N]=x.useState(!1),[a,b]=x.useState(null),[C,g]=x.useState(null),[c,h]=x.useState(null),{handleEditLibraryVisual:L,handleAddLibraryVisual:T}=oe.useVisualUtils(),{resources:D,isLoading:v,isError:E,updateResource:V,deleteResource:M,duplicateResource:y,isDeleting:S}=t.useVisualManagement(()=>{N(!1),b(null)}),I=D.filter(o=>{var R,u;return((R=o==null?void 0:o.title)==null?void 0:R.toLowerCase().includes(s.toLowerCase()))||((u=o==null?void 0:o.description)==null?void 0:u.toLowerCase().includes(s.toLowerCase()))}),O=o=>new Date(o).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),P=o=>{b(o),N(!0)},B=()=>{a&&M(a.id)},{startUpdating:i,stopUpdating:G,isUpdating:z}=t.useResourceUpdateState(),A=(o,R,u)=>{var Z;const F=Object.fromEntries(Object.entries(R).filter(([,U])=>U!==void 0));if(Object.keys(F).length===0){(Z=u==null?void 0:u.onSuccess)==null||Z.call(u);return}const w=Object.keys(F),K=w.length===1?w[0]:void 0;i(o,K),V({resourceId:o,data:F},{onSuccess:()=>{var U;G(o,K),(U=u==null?void 0:u.onSuccess)==null||U.call(u)},onError:()=>{var U;G(o,K),(U=u==null?void 0:u.onError)==null||U.call(u)}})},W=o=>{g(o),y(o,{onSettled:()=>g(null)})},H=o=>{L(o)},X=o=>{T(o)},Y=o=>{l(o),m(!0)},$=o=>{h(o)},J=()=>{h(null)},Q=({title:o,description:R})=>{if(!c)return;const u={};o!==c.title&&(u.title=o),(c.description||"")!==R&&(u.description=R),A(c.id,u,{onSuccess:()=>{h(null)}})};return v?e.jsx(re,{}):E?e.jsx(r.ScrollArea,{className:"w-full flex-1 pr-2",children:e.jsxs("div",{className:"flex flex-col items-center gap-1.5 px-4 py-10 text-center",children:[e.jsx("p",{className:"text-[12px] text-destructive",children:"Failed to load visuals"}),e.jsx(r.Button,{variant:"outline",size:"xs",onClick:()=>window.location.reload(),children:"Retry"})]})}):e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsx("div",{className:"flex flex-1 basis-0 flex-col gap-0.5 overflow-y-auto",children:I.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-1.5 px-4 py-10 text-center",children:[e.jsx(t.Grid3x3,{className:"h-5 w-5 text-muted-foreground/60"}),e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:s?"No visuals found":"No visuals yet"}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:s?"Try adjusting your search.":'Click "New" above to add your first visual.'})]}):I.map(o=>e.jsx(ce,{visual:o,onAddVisual:X,onOpenVisual:H,onEditDetails:$,onDeleteClick:P,onDuplicateVisual:W,onShareVisual:Y,isDeleting:S,isDuplicating:C===o.id,formatDate:O},o.id))}),f&&d&&e.jsx(t.ShareDialog,{resource:d,resourceType:t.ResourceType.VISUAL,onClose:()=>{m(!1),l(null)}}),c&&e.jsx(t.ResourceEditDialog,{open:!!c,resourceLabel:"Visual",initialTitle:c.title||"",initialDescription:c.description||"",onClose:J,onSave:Q,isSaving:z(c.id)}),e.jsx(t.AlertDialog,{open:p,onOpenChange:o=>{!o&&S||(N(o),o||b(null))},children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:"Delete Visual"}),e.jsxs(t.AlertDialogDescription,{children:['Are you sure you want to delete "',a==null?void 0:a.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:S,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:o=>{o.preventDefault(),o.stopPropagation(),B()},disabled:S,children:[S?e.jsx(r.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),S?"Deleting…":"Delete"]})]})]})})]})}function he({dashboard:s,isDeleting:f,isDuplicating:m,onLoadDashboard:d,onEditDetails:l,onDeleteClick:p,onDuplicateDashboard:N,onShareDashboard:a,formatDate:b,onDashboardItemClick:C}){var V,M;const{selectDashboard:g}=t.useManagementActions(),c=t.useIsDashboardSelected(s.id),{userContext:h,isLoading:L}=t.useCurrentUserInfo(),T=((V=h==null?void 0:h.permissions)==null?void 0:V.canEdit)??!1,D=L||!T,v=()=>{g(s),d(s.id),C==null||C(s.id)},E=y=>{y.currentTarget===y.target&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),v())};return e.jsxs("div",{className:r.cn("group flex cursor-pointer items-start gap-1 rounded-[5px] px-2 py-1.5 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",c&&"bg-muted"),onClick:v,children:[e.jsxs("div",{role:"button",tabIndex:0,className:"min-w-0 flex-1 cursor-pointer focus-visible:outline-none",onKeyDown:E,children:[e.jsx("p",{className:"truncate text-[13px] font-medium leading-5 text-foreground",title:s.title||"Untitled Dashboard",children:s.title||"Untitled Dashboard"}),e.jsx("p",{className:"truncate text-[11px] leading-4 text-muted-foreground",title:s.description||"No description",children:(M=s.description)!=null&&M.trim()?s.description:"No description"})]}),e.jsx("div",{className:r.cn("shrink-0 transition-opacity",c?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:e.jsx(t.DashboardActionsMenu,{dashboard:s,isDeleting:f,isDuplicating:m,shouldHideActions:D,onEditDetails:l,onDeleteClick:p,onDuplicateDashboard:N,onShareDashboard:a,formatDate:b})})]})}function xe({onRetry:s}){return e.jsx(r.ScrollArea,{className:"w-full flex-1 pr-2",children:e.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center text-muted-foreground",children:[e.jsx("p",{className:"text-sm text-destructive",children:"Failed to load dashboards"}),e.jsx(r.Button,{variant:"outline",size:"sm",className:"mt-2",onClick:s,children:"Retry"})]})})}function pe(s){var te;const{searchQuery:f,onLoadDashboard:m,onEditDashboard:d,onDashboardItemClick:l}=s,[p,N]=x.useState(!1),[a,b]=x.useState(null),[C,g]=x.useState(!1),[c,h]=x.useState(null),[L,T]=x.useState(null),[D,v]=x.useState(null),E=t.useManagementStore(n=>n.lastSelectedDashboard),V=t.useManagementStore(n=>n.selectedDashboard),M=t.useManagementStore(n=>n.actions.selectDashboard),y=t.useManagementStore(n=>n.actions.clearSelectedDashboard),{tokenProps:S,id:I}=t.useSemaphorContext(),{resources:O,isLoading:P,isError:B,updateResource:i,deleteResource:G,duplicateResource:z,isDeleting:A}=t.useDashboardManagement(()=>{g(!1);const n=c==null?void 0:c.id;h(null),(V==null?void 0:V.id)===n&&(!(S!=null&&S.dashboard_id)&&!I?y():E&&E.id!==n&&M(E))}),{userContext:W}=t.useCurrentUserInfo(),H=((te=W==null?void 0:W.permissions)==null?void 0:te.canCreateDashboard)??!1,X=O.filter(n=>{var q,j;return((q=n==null?void 0:n.title)==null?void 0:q.toLowerCase().includes(f.toLowerCase()))||((j=n==null?void 0:n.description)==null?void 0:j.toLowerCase().includes(f.toLowerCase()))}),Y=n=>new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),$=n=>{m==null||m(n)},J=n=>{h(n),g(!0)},Q=()=>{c&&G(c.id)},o=n=>{T(n),z(n,{onSettled:()=>T(null)})},{startUpdating:R,stopUpdating:u,isUpdating:F}=t.useResourceUpdateState(),w=(n,q,j)=>{var ne;const k=Object.fromEntries(Object.entries(q).filter(([,_])=>_!==void 0));if(Object.keys(k).length===0){(ne=j==null?void 0:j.onSuccess)==null||ne.call(j);return}const se=Object.keys(k),ee=se.length===1?se[0]:void 0;R(n,ee),i({resourceId:n,data:k},{onSuccess:()=>{var _;u(n,ee),(_=j==null?void 0:j.onSuccess)==null||_.call(j)},onError:()=>{var _;u(n,ee),(_=j==null?void 0:j.onError)==null||_.call(j)}})},K=n=>{b(n),N(!0)},Z=n=>{d==null||d(n.id),v(n)},U=()=>{v(null)},ae=({title:n,description:q})=>{if(!D)return;const j={};n!==D.title&&(j.title=n),(D.description||"")!==q&&(j.description=q),w(D.id,j,{onSuccess:()=>{v(null)}})};return P?e.jsx(re,{}):B?e.jsx(xe,{onRetry:()=>window.location.reload()}):e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsx("div",{className:"flex flex-1 basis-0 flex-col gap-0.5 overflow-y-auto",children:X.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-1.5 px-4 py-10 text-center",children:[e.jsx(r.ChartColumn,{className:"h-5 w-5 text-muted-foreground/60"}),e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:f?"No dashboards found":"No dashboards yet"}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:f?"Try adjusting your search.":H?'Click "New" above to add your first dashboard.':"No dashboards have been shared with you yet."})]}):X.map(n=>e.jsx(he,{dashboard:n,isDeleting:A,isDuplicating:L===n.id,onLoadDashboard:$,onEditDetails:Z,onDeleteClick:J,onDuplicateDashboard:o,onShareDashboard:K,formatDate:Y,onDashboardItemClick:l},n.id))}),p&&a&&e.jsx(t.ShareDialog,{resource:a,resourceType:t.ResourceType.DASHBOARD,onClose:()=>{N(!1),b(null)}}),e.jsx(t.AlertDialog,{open:C,onOpenChange:n=>{!n&&A||(g(n),n||h(null))},children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:"Delete Dashboard"}),e.jsxs(t.AlertDialogDescription,{children:['Are you sure you want to delete "',c==null?void 0:c.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:A,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:n=>{n.preventDefault(),n.stopPropagation(),Q()},disabled:A,children:[A?e.jsx(r.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),A?"Deleting…":"Delete"]})]})]})}),D&&e.jsx(t.ResourceEditDialog,{open:!!D,resourceLabel:"Dashboard",initialTitle:D.title||"",initialDescription:D.description||"",onClose:U,onSave:ae,isSaving:F(D.id)})]})}function me({open:s,onOpenChange:f,onSubmit:m,isCreating:d}){const[l,p]=x.useState(""),[N,a]=x.useState("");x.useEffect(()=>{s||(p(""),a(""))},[s]);const b=()=>{l.trim()&&m({title:l,description:N})},C=g=>{f(g)};return e.jsx(t.Dialog,{open:s,onOpenChange:C,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Create New Visual"}),e.jsx(t.DialogDescription,{children:"Add a new visual to your library. You can configure it after creation."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"title",children:"Visual Title"}),e.jsx(r.Input,{id:"title",placeholder:"Enter visual title...",value:l,onChange:g=>p(g.target.value),disabled:d,onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),b())}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(r.Input,{id:"description",placeholder:"Enter visual description...",value:N,onChange:g=>a(g.target.value),disabled:d})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(r.Button,{variant:"outline",onClick:()=>C(!1),disabled:d,children:"Cancel"}),e.jsx(r.Button,{onClick:b,disabled:!l.trim()||d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(r.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Visual"})]})]})})}function fe({isOpen:s,onClose:f,className:m,onDashboardItemClick:d,variant:l="inline"}){var u,F;const p=r.useDashboardStore(w=>w.isDashboardEditing),[N,a]=x.useState(!1),[b,C]=x.useState(""),[g,c]=x.useState(!1),{currentUser:h,userContext:L}=t.useCurrentUserInfo(),T=((u=L==null?void 0:L.permissions)==null?void 0:u.canCreateDashboard)??!1,{onCreateSuccess:D}=t.useDashboardCreation({onDashboardSelect:d}),{selectVisual:v}=t.useManagementActions(),{handleEditLibraryVisual:E}=oe.useVisualUtils(),{createResource:V,isCreating:M,refetch:y}=t.useDashboardManagement(),{createResource:S,isCreating:I}=t.useVisualManagement(void 0,w=>{a(!1),w&&(v(w),E(w))}),O=l==="overlay",P=p?"New Visual":"New",B=p?"New Visual":"New Dashboard",i=p?"Search visuals...":"Search dashboards...",G=p?"Collapse visuals panel":"Collapse dashboard panel",z=((h==null?void 0:h.name)??"").trim(),A=((h==null?void 0:h.email)??"").trim(),H=z&&z.toLowerCase()!=="undefined"?z:A||"Current user",X=((F=H.charAt(0))==null?void 0:F.toUpperCase())||"?",Y=A&&A.toLowerCase()!=="undefined"?A:"",$=le(f,{enabled:s&&O}),J=r.cn("flex h-full flex-col border-r border-border/60 bg-background",O?r.cn("absolute inset-y-0 left-0 z-[51] w-60 overflow-hidden shadow-lg transition-transform duration-300 ease-in-out",s?"translate-x-0":"pointer-events-none -translate-x-full"):"w-full max-w-[17rem] min-w-[11rem] overflow-hidden",m),Q=w=>{},o=w=>{console.log("Editing dashboard:",w)},R=w=>{V(w,{onSuccess:K=>{a(!1),D(K,y)}})};return e.jsx(e.Fragment,{children:(!O||s)&&e.jsxs("div",{ref:$,className:J,children:[e.jsx("div",{className:"border-b border-border/60 bg-background",children:g?e.jsxs("div",{className:"flex h-10 items-center gap-1 px-3",children:[e.jsx(t.Search,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:b,onChange:w=>C(w.target.value),onKeyDown:w=>{w.key==="Escape"&&(C(""),c(!1))},placeholder:i,className:"h-7 min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground focus:outline-none","aria-label":i}),e.jsx(r.Button,{size:"xs",variant:"ghost",className:"w-7 shrink-0 px-0 text-muted-foreground hover:text-foreground",onClick:()=>{C(""),c(!1)},"aria-label":"Close search",children:e.jsx(r.X,{className:"h-3.5 w-3.5"})})]}):e.jsxs("div",{className:"flex h-10 items-center justify-between gap-2 px-3",children:[e.jsx("h2",{className:"whitespace-nowrap text-[13px] font-medium text-foreground",children:p?"Visuals":"Dashboards"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(r.Button,{size:"xs",variant:"ghost",onClick:()=>c(!0),className:"w-7 px-0 text-muted-foreground hover:text-foreground","aria-label":"Search",children:e.jsx(t.Search,{className:"h-3.5 w-3.5"})}),(p||T)&&e.jsxs(r.Button,{size:"xs",variant:"outline",onClick:()=>a(!0),"aria-label":B,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),P]}),e.jsx(r.Button,{size:"xs",variant:"ghost",className:"w-7 px-0 text-muted-foreground hover:text-foreground",onClick:f,"aria-label":G,children:e.jsx(t.PanelLeft,{className:"h-3.5 w-3.5"})})]})]})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-auto px-1.5 py-2",children:p?e.jsx(ue,{searchQuery:b}):e.jsx(pe,{searchQuery:b,onLoadDashboard:Q,onEditDashboard:o,onDashboardItemClick:d})}),h&&e.jsx(r.TooltipProvider,{children:e.jsx("div",{className:"border-t border-border/60 px-3 py-2",children:e.jsxs(r.Tooltip,{children:[e.jsx(r.TooltipTrigger,{asChild:!0,children:e.jsxs("div",{className:"flex cursor-default items-center gap-2",children:[e.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-medium text-muted-foreground",children:X}),e.jsx("span",{className:"truncate text-[12px] text-muted-foreground",children:H})]})}),e.jsx(r.TooltipContent,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"font-medium",children:H}),Y&&e.jsx("div",{className:"text-[11px] opacity-80",children:Y}),h.role&&e.jsxs("div",{className:"text-[11px] opacity-80",children:["Role:"," ",r.toTitleCase(h.role.replace(/_/g," "))]})]})})]})})}),p?e.jsx(me,{open:N,onOpenChange:a,onSubmit:S,isCreating:I}):e.jsx(t.CreateDashboardDialog,{open:N,onOpenChange:a,onSubmit:R,isCreating:M})]})})}exports.ResourceManagementPanel=fe;
@@ -0,0 +1,6 @@
1
+ "use strict";const t=require("./switch-AmoR1YIA.js");/**
2
+ * @license lucide-react v0.453.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const e=t.createLucideIcon("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);exports.RotateCcw=e;
@@ -0,0 +1,14 @@
1
+ import { c as t } from "./switch-CZtMtqEj.js";
2
+ /**
3
+ * @license lucide-react v0.453.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */
8
+ const e = t("RotateCcw", [
9
+ ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
10
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
11
+ ]);
12
+ export {
13
+ e as R
14
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";const a=require("./switch-AmoR1YIA.js");/**
2
+ * @license lucide-react v0.453.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const e=a.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);exports.Save=e;
@@ -0,0 +1,21 @@
1
+ import { c as a } from "./switch-CZtMtqEj.js";
2
+ /**
3
+ * @license lucide-react v0.453.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */
8
+ const t = a("Save", [
9
+ [
10
+ "path",
11
+ {
12
+ d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
13
+ key: "1c8476"
14
+ }
15
+ ],
16
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
17
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
18
+ ]);
19
+ export {
20
+ t as S
21
+ };