react-semaphor 0.1.290 → 0.1.292
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.
- package/dist/chunks/braces-0bzwctGp.js +23 -0
- package/dist/chunks/braces-hczcJsV8.js +6 -0
- package/dist/chunks/dashboard-controls-Db0F38eK.js +47 -0
- package/dist/chunks/dashboard-controls-DeUHM4uL.js +1970 -0
- package/dist/chunks/{dashboard-filter-controls-button-C4AMu723.js → dashboard-filter-controls-button-DDqEus_E.js} +54 -52
- package/dist/chunks/dashboard-filter-controls-button-DSQHVjjX.js +11 -0
- package/dist/chunks/{dashboard-json-C13EJaTK.js → dashboard-json-BDyKcoGT.js} +1 -1
- package/dist/chunks/{dashboard-json-BKs1UTLL.js → dashboard-json-COXiPm3N.js} +6 -6
- package/dist/chunks/{dashboard-summary-settings-dialog-fL9l0wUO.js → dashboard-summary-settings-dialog-CryMC_4x.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-T6aUgPAf.js → dashboard-summary-settings-dialog-DbcWMZsr.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CKB34ird.js → edit-dashboard-visual-BqfzqW4i.js} +4 -9
- package/dist/chunks/{edit-dashboard-visual-CnVx0Xi7.js → edit-dashboard-visual-DLyimx6x.js} +11 -29
- package/dist/chunks/{index-Cr9Smn6Q.js → index-72yod5pb.js} +523 -516
- package/dist/chunks/{index-Cwg2SRSi.js → index-BQ6qu8FI.js} +93 -93
- package/dist/chunks/resource-management-panel-CSLGSJjC.js +6 -0
- package/dist/chunks/{resource-management-panel-DJgYduN9.js → resource-management-panel-DwPION_M.js} +22 -22
- package/dist/chunks/{use-create-flow-overlay-state-NGb4c5Ye.js → use-create-flow-overlay-state-UruHbtfS.js} +53 -53
- package/dist/chunks/{use-create-flow-overlay-state-DnI1SSKD.js → use-create-flow-overlay-state-zz9TYhdC.js} +1 -1
- package/dist/chunks/{use-visual-utils-ivCDI1cO.js → use-visual-utils-Bm-ZnkON.js} +1 -1
- package/dist/chunks/{use-visual-utils-BbxYtbzK.js → use-visual-utils-DPBqTRUC.js} +11 -11
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +21 -21
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-BSbG43wo.js +0 -42
- package/dist/chunks/dashboard-controls-LtQ98rvL.js +0 -1938
- package/dist/chunks/dashboard-filter-controls-button-CgoIPOZZ.js +0 -11
- package/dist/chunks/resource-management-panel-Dv18tosO.js +0 -6
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-BQ6qu8FI.js"),h=require("react"),ne=require("./use-visual-utils-Bm-ZnkON.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 ae=t.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 ie(s,m={}){const{enabled:p=!0,eventType:l="mousedown"}=m,i=h.useRef(null);return h.useEffect(()=>{const x=w=>{const r=w.target;i.current&&i.current.contains(r)||r instanceof Element&&(r.closest("[data-radix-popper-content-wrapper]")||r.closest("[data-radix-select-content]")||r.closest("[data-radix-popover-content]")||r.closest("[data-radix-dropdown-menu-content]")||r.closest("[data-radix-tooltip-content]")||r.closest('[role="listbox"]')||r.closest('[role="option"]')||r.closest('[role="combobox"]'))||r instanceof Element&&r.hasAttribute("data-radix-")||s()};return p&&document.addEventListener(l,x),()=>{document.removeEventListener(l,x)}},[s,p,l]),i}function oe(){return e.jsx("div",{className:"space-y-1.5 py-1",children:[...Array(5)].map((s,m)=>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"})]})]},m))})}const le=s=>{const m=t.useDashboardStore(i=>i.isVisualEditing),p=t.useDashboardStore(i=>i.selectedFrameId),l=t.useEditorStore(i=>i.frame);return!!(m&&p&&(l==null?void 0:l.visualId)===s)};function de({visual:s,isDeleting:m,isDuplicating:p,onAddVisual:l,onOpenVisual:i,onEditDetails:x,onDeleteClick:w,onDuplicateVisual:r,onShareVisual:N,formatDate:b}){var O,T,U,P;const{selectVisual:f}=t.useManagementActions(),d=t.useIsVisualSelected(s.id),u=le(s.id),A=t.useDashboardStore(a=>a.isVisualEditing),{isConsoleMode:R}=t.useDashboardPreferences(),j=h.useRef(null),[S,v]=h.useState(!1),[E,L]=h.useState(!1);h.useEffect(()=>{p?(v(!0),L(!0)):E&&(v(!1),L(!1))},[p,E]),h.useEffect(()=>{u&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"center"})},[u]);const C=()=>{f(s),i==null||i(s)},y=a=>{a.currentTarget===a.target&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),C())};return e.jsxs("div",{ref:j,className:t.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",u?"bg-muted ring-1 ring-inset ring-foreground/20":d&&"bg-muted"),onClick:C,children:[e.jsxs("div",{role:"button",tabIndex:0,className:"min-w-0 flex-1 cursor-pointer focus-visible:outline-none",onKeyDown:y,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:(O=s.description)!=null&&O.trim()?s.description:"No description"})]}),e.jsx("div",{className:t.cn("flex shrink-0 items-center transition-opacity",d||u||S?"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:a=>a.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(t.Button,{size:"xs",variant:"ghost",className:"h-full rounded-none border-0 shadow-none hover:bg-accent/50",disabled:A,onClick:a=>{a.stopPropagation(),l(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:S,onOpenChange:v,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(t.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:a=>{a.stopPropagation(),l(s)},disabled:A,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Add"]}),e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),i==null||i(s)},children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),"Open"]}),e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.preventDefault(),a.stopPropagation(),r(s.id)},disabled:p,children:[p?e.jsx(t.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Copy,{className:"h-3.5 w-3.5"}),p?"Duplicating…":"Duplicate"]}),s.ownership.isOwner&&e.jsxs(e.Fragment,{children:[e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),x==null||x(s)},children:[e.jsx(t.PenLine,{className:"h-3.5 w-3.5"}),"Edit details"]}),e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),N(s)},children:[e.jsx(t.Users,{className:"h-3.5 w-3.5"}),"Share"]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs(t.DropdownMenuItem,{onClick:a=>{a.stopPropagation(),w(s)},className:"text-destructive focus:bg-destructive/10 focus:text-destructive",disabled:m,children:[e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),m?"Deleting…":"Delete"]})]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs("div",{className:"space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground",children:[(((T=s.ownership.createdBy)==null?void 0:T.type)==="tenant"||((U=s.ownership.createdBy)==null?void 0:U.type)==="organization"&&R)&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(t.User,{className:"h-3 w-3"}),e.jsx("span",{children:((P=s.ownership.createdBy)==null?void 0:P.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:b(s.lastModified)})]})]})]})]})]})})]})}function ce({searchQuery:s}){const[m,p]=h.useState(!1),[l,i]=h.useState(null),[x,w]=h.useState(!1),[r,N]=h.useState(null),[b,f]=h.useState(null),[d,u]=h.useState(null),{handleEditLibraryVisual:A,handleAddLibraryVisual:R}=ne.useVisualUtils(),{resources:j,isLoading:S,isError:v,updateResource:E,deleteResource:L,duplicateResource:C,isDeleting:y}=t.useVisualManagement(()=>{w(!1),N(null)}),O=j.filter(o=>{var M,c;return((M=o==null?void 0:o.title)==null?void 0:M.toLowerCase().includes(s.toLowerCase()))||((c=o==null?void 0:o.description)==null?void 0:c.toLowerCase().includes(s.toLowerCase()))}),T=o=>new Date(o).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),U=o=>{N(o),w(!0)},P=()=>{r&&L(r.id)},{startUpdating:a,stopUpdating:_,isUpdating:F}=t.useResourceUpdateState(),V=(o,M,c)=>{var Q;const B=Object.fromEntries(Object.entries(M).filter(([,I])=>I!==void 0));if(Object.keys(B).length===0){(Q=c==null?void 0:c.onSuccess)==null||Q.call(c);return}const D=Object.keys(B),H=D.length===1?D[0]:void 0;a(o,H),E({resourceId:o,data:B},{onSuccess:()=>{var I;_(o,H),(I=c==null?void 0:c.onSuccess)==null||I.call(c)},onError:()=>{var I;_(o,H),(I=c==null?void 0:c.onError)==null||I.call(c)}})},G=o=>{f(o),C(o,{onSettled:()=>f(null)})},z=o=>{A(o)},W=o=>{R(o)},X=o=>{i(o),p(!0)},Y=o=>{u(o)},$=()=>{u(null)},J=({title:o,description:M})=>{if(!d)return;const c={};o!==d.title&&(c.title=o),(d.description||"")!==M&&(c.description=M),V(d.id,c,{onSuccess:()=>{u(null)}})};return S?e.jsx(oe,{}):v?e.jsx(t.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(t.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:O.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.'})]}):O.map(o=>e.jsx(de,{visual:o,onAddVisual:W,onOpenVisual:z,onEditDetails:Y,onDeleteClick:U,onDuplicateVisual:G,onShareVisual:X,isDeleting:y,isDuplicating:b===o.id,formatDate:T},o.id))}),m&&l&&e.jsx(t.ShareDialog,{resource:l,resourceType:t.ResourceType.VISUAL,onClose:()=>{p(!1),i(null)}}),d&&e.jsx(t.ResourceEditDialog,{open:!!d,resourceLabel:"Visual",initialTitle:d.title||"",initialDescription:d.description||"",onClose:$,onSave:J,isSaving:F(d.id)}),e.jsx(t.AlertDialog,{open:x,onOpenChange:o=>{!o&&y||(w(o),o||N(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 "',r==null?void 0:r.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:y,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:o=>{o.preventDefault(),o.stopPropagation(),P()},disabled:y,children:[y?e.jsx(t.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),y?"Deleting…":"Delete"]})]})]})})]})}function ue({dashboard:s,isDeleting:m,isDuplicating:p,onLoadDashboard:l,onEditDetails:i,onDeleteClick:x,onDuplicateDashboard:w,onShareDashboard:r,formatDate:N,onDashboardItemClick:b}){var E,L;const{selectDashboard:f}=t.useManagementActions(),d=t.useIsDashboardSelected(s.id),{userContext:u,isLoading:A}=t.useCurrentUserInfo(),R=((E=u==null?void 0:u.permissions)==null?void 0:E.canEdit)??!1,j=A||!R,S=()=>{f(s),l(s.id),b==null||b(s.id)},v=C=>{C.currentTarget===C.target&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),S())};return e.jsxs("div",{className:t.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",d&&"bg-muted"),onClick:S,children:[e.jsxs("div",{role:"button",tabIndex:0,className:"min-w-0 flex-1 cursor-pointer focus-visible:outline-none",onKeyDown:v,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:(L=s.description)!=null&&L.trim()?s.description:"No description"})]}),e.jsx("div",{className:t.cn("shrink-0 transition-opacity",d?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:e.jsx(t.DashboardActionsMenu,{dashboard:s,isDeleting:m,isDuplicating:p,shouldHideActions:j,onEditDetails:i,onDeleteClick:x,onDuplicateDashboard:w,onShareDashboard:r,formatDate:N})})]})}function he({onRetry:s}){return e.jsx(t.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(t.Button,{variant:"outline",size:"sm",className:"mt-2",onClick:s,children:"Retry"})]})})}function xe(s){var ee;const{searchQuery:m,onLoadDashboard:p,onEditDashboard:l,onDashboardItemClick:i}=s,[x,w]=h.useState(!1),[r,N]=h.useState(null),[b,f]=h.useState(!1),[d,u]=h.useState(null),[A,R]=h.useState(null),[j,S]=h.useState(null),v=t.useManagementStore(n=>n.lastSelectedDashboard),E=t.useManagementStore(n=>n.selectedDashboard),L=t.useManagementStore(n=>n.actions.selectDashboard),C=t.useManagementStore(n=>n.actions.clearSelectedDashboard),{tokenProps:y,id:O}=t.useSemaphorContext(),{resources:T,isLoading:U,isError:P,updateResource:a,deleteResource:_,duplicateResource:F,isDeleting:V}=t.useDashboardManagement(()=>{f(!1);const n=d==null?void 0:d.id;u(null),(E==null?void 0:E.id)===n&&(!(y!=null&&y.dashboard_id)&&!O?C():v&&v.id!==n&&L(v))}),{userContext:G}=t.useCurrentUserInfo(),z=((ee=G==null?void 0:G.permissions)==null?void 0:ee.canCreateDashboard)??!1,W=T.filter(n=>{var K,g;return((K=n==null?void 0:n.title)==null?void 0:K.toLowerCase().includes(m.toLowerCase()))||((g=n==null?void 0:n.description)==null?void 0:g.toLowerCase().includes(m.toLowerCase()))}),X=n=>new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Y=n=>{p==null||p(n)},$=n=>{u(n),f(!0)},J=()=>{d&&_(d.id)},o=n=>{R(n),F(n,{onSettled:()=>R(null)})},{startUpdating:M,stopUpdating:c,isUpdating:B}=t.useResourceUpdateState(),D=(n,K,g)=>{var se;const Z=Object.fromEntries(Object.entries(K).filter(([,q])=>q!==void 0));if(Object.keys(Z).length===0){(se=g==null?void 0:g.onSuccess)==null||se.call(g);return}const te=Object.keys(Z),k=te.length===1?te[0]:void 0;M(n,k),a({resourceId:n,data:Z},{onSuccess:()=>{var q;c(n,k),(q=g==null?void 0:g.onSuccess)==null||q.call(g)},onError:()=>{var q;c(n,k),(q=g==null?void 0:g.onError)==null||q.call(g)}})},H=n=>{N(n),w(!0)},Q=n=>{l==null||l(n.id),S(n)},I=()=>{S(null)},re=({title:n,description:K})=>{if(!j)return;const g={};n!==j.title&&(g.title=n),(j.description||"")!==K&&(g.description=K),D(j.id,g,{onSuccess:()=>{S(null)}})};return U?e.jsx(oe,{}):P?e.jsx(he,{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:W.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-1.5 px-4 py-10 text-center",children:[e.jsx(t.ChartColumn,{className:"h-5 w-5 text-muted-foreground/60"}),e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:m?"No dashboards found":"No dashboards yet"}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:m?"Try adjusting your search.":z?'Click "New" above to add your first dashboard.':"No dashboards have been shared with you yet."})]}):W.map(n=>e.jsx(ue,{dashboard:n,isDeleting:V,isDuplicating:A===n.id,onLoadDashboard:Y,onEditDetails:Q,onDeleteClick:$,onDuplicateDashboard:o,onShareDashboard:H,formatDate:X,onDashboardItemClick:i},n.id))}),x&&r&&e.jsx(t.ShareDialog,{resource:r,resourceType:t.ResourceType.DASHBOARD,onClose:()=>{w(!1),N(null)}}),e.jsx(t.AlertDialog,{open:b,onOpenChange:n=>{!n&&V||(f(n),n||u(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 "',d==null?void 0:d.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:V,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:n=>{n.preventDefault(),n.stopPropagation(),J()},disabled:V,children:[V?e.jsx(t.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),V?"Deleting…":"Delete"]})]})]})}),j&&e.jsx(t.ResourceEditDialog,{open:!!j,resourceLabel:"Dashboard",initialTitle:j.title||"",initialDescription:j.description||"",onClose:I,onSave:re,isSaving:B(j.id)})]})}function pe({open:s,onOpenChange:m,onSubmit:p,isCreating:l}){const[i,x]=h.useState(""),[w,r]=h.useState("");h.useEffect(()=>{s||(x(""),r(""))},[s]);const N=()=>{i.trim()&&p({title:i,description:w})},b=f=>{m(f)};return e.jsx(t.Dialog,{open:s,onOpenChange:b,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(t.Label,{htmlFor:"title",children:"Visual Title"}),e.jsx(t.Input,{id:"title",placeholder:"Enter visual title...",value:i,onChange:f=>x(f.target.value),disabled:l,onKeyDown:f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),N())}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(t.Input,{id:"description",placeholder:"Enter visual description...",value:w,onChange:f=>r(f.target.value),disabled:l})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(t.Button,{variant:"outline",onClick:()=>b(!1),disabled:l,children:"Cancel"}),e.jsx(t.Button,{onClick:N,disabled:!i.trim()||l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Visual"})]})]})})}function me({isOpen:s,onClose:m,className:p,onDashboardItemClick:l,variant:i="inline"}){var c,B;const x=t.useDashboardStore(D=>D.isDashboardEditing),[w,r]=h.useState(!1),[N,b]=h.useState(""),[f,d]=h.useState(!1),{currentUser:u,userContext:A}=t.useCurrentUserInfo(),R=((c=A==null?void 0:A.permissions)==null?void 0:c.canCreateDashboard)??!1,{onCreateSuccess:j}=t.useDashboardCreation({onDashboardSelect:l}),{selectVisual:S}=t.useManagementActions(),{handleEditLibraryVisual:v}=ne.useVisualUtils(),{createResource:E,isCreating:L,refetch:C}=t.useDashboardManagement(),{createResource:y,isCreating:O}=t.useVisualManagement(void 0,D=>{r(!1),D&&(S(D),v(D))}),T=i==="overlay",U=x?"New Visual":"New",P=x?"New Visual":"New Dashboard",a=x?"Search visuals...":"Search dashboards...",_=x?"Collapse visuals panel":"Collapse dashboard panel",F=((u==null?void 0:u.name)??"").trim(),V=((u==null?void 0:u.email)??"").trim(),z=F&&F.toLowerCase()!=="undefined"?F:V||"Current user",W=((B=z.charAt(0))==null?void 0:B.toUpperCase())||"?",X=V&&V.toLowerCase()!=="undefined"?V:"",Y=ie(m,{enabled:s&&T}),$=t.cn("flex h-full flex-col border-r border-border/60 bg-background",T?t.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",p),J=D=>{},o=D=>{console.log("Editing dashboard:",D)},M=D=>{E(D,{onSuccess:H=>{r(!1),j(H,C)}})};return e.jsx(e.Fragment,{children:(!T||s)&&e.jsxs("div",{ref:Y,className:$,children:[e.jsx("div",{className:"border-b border-border/60 bg-background",children:f?e.jsxs("div",{className:"flex h-11 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:N,onChange:D=>b(D.target.value),onKeyDown:D=>{D.key==="Escape"&&(b(""),d(!1))},placeholder:a,className:"h-7 min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground focus:outline-none","aria-label":a}),e.jsx(t.Button,{size:"xs",variant:"ghost",className:"w-7 shrink-0 px-0 text-muted-foreground hover:text-foreground",onClick:()=>{b(""),d(!1)},"aria-label":"Close search",children:e.jsx(t.X,{className:"h-3.5 w-3.5"})})]}):e.jsxs("div",{className:"flex h-11 items-center justify-between gap-2 px-3",children:[e.jsx("h2",{className:"whitespace-nowrap text-[13px] font-medium text-foreground",children:x?"Visuals":"Dashboards"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(t.Button,{size:"xs",variant:"ghost",onClick:()=>d(!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"})}),(x||R)&&e.jsxs(t.Button,{size:"xs",variant:"outline",onClick:()=>r(!0),"aria-label":P,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),U]}),e.jsx(t.Button,{size:"xs",variant:"ghost",className:"w-7 px-0 text-muted-foreground hover:text-foreground",onClick:m,"aria-label":_,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:x?e.jsx(ce,{searchQuery:N}):e.jsx(xe,{searchQuery:N,onLoadDashboard:J,onEditDashboard:o,onDashboardItemClick:l})}),u&&e.jsx(t.TooltipProvider,{children:e.jsx("div",{className:"border-t border-border/60 px-3 py-2",children:e.jsxs(t.Tooltip,{children:[e.jsx(t.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:W}),e.jsx("span",{className:"truncate text-[12px] text-muted-foreground",children:z})]})}),e.jsx(t.TooltipContent,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"font-medium",children:z}),X&&e.jsx("div",{className:"text-[11px] opacity-80",children:X}),u.role&&e.jsxs("div",{className:"text-[11px] opacity-80",children:["Role: ",t.toTitleCase(u.role.replace(/_/g," "))]})]})})]})})}),x?e.jsx(pe,{open:w,onOpenChange:r,onSubmit:y,isCreating:O}):e.jsx(t.CreateDashboardDialog,{open:w,onOpenChange:r,onSubmit:M,isCreating:L})]})})}exports.ResourceManagementPanel=me;
|
package/dist/chunks/{resource-management-panel-DJgYduN9.js → resource-management-panel-DwPION_M.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { c as je, u as ne, V as Fe, M as de, cA as Be, cB as ze, b as Q, B as I, ct as ie, cC as He, cD as Ke, cE as _e, cF as We, cG as J, x as se, cH as Ge, cI as Xe, cJ as Ye, cK as fe, ch as ce, cL as $e, cM as Je, cN as we, cO as Ne, cP as be, cQ as Qe, am as ye, ai as Ce, cR as ve, cS as Se, cT as Ee, cU as Ve, cV as Le, cW as Ae, cX as Oe, cY as Te, cZ as Re, c_ as Ze, c$ as ue, d0 as qe, ag as te, d as ke, d1 as Ue, d2 as et, e as tt, f as nt, g as at, h as st, i as ot, L as ge, I as xe, w as rt, d3 as it, d4 as De, X as lt, d5 as dt, bT as ct, bU as ut, bV as ht, bW as pt, d6 as mt, d7 as ft } from "./index-72yod5pb.js";
|
|
3
3
|
import gt, { useRef as xt, useEffect as ae, useState as w } from "react";
|
|
4
|
-
import { u as Ie } from "./use-visual-utils-
|
|
4
|
+
import { u as Ie } from "./use-visual-utils-DPBqTRUC.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license lucide-react v0.453.0 - ISC
|
|
7
7
|
*
|
|
@@ -121,13 +121,13 @@ function bt({
|
|
|
121
121
|
d || u || S ? "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"
|
|
122
122
|
),
|
|
123
123
|
onClick: (r) => r.stopPropagation(),
|
|
124
|
-
children: /* @__PURE__ */ n("div", { className: "inline-flex items-stretch overflow-hidden rounded-[5px] border border-border/60 bg-background", children: [
|
|
124
|
+
children: /* @__PURE__ */ n("div", { className: "inline-flex h-7 items-stretch overflow-hidden rounded-[5px] border border-border/60 bg-background", children: [
|
|
125
125
|
/* @__PURE__ */ n(
|
|
126
126
|
I,
|
|
127
127
|
{
|
|
128
128
|
size: "xs",
|
|
129
129
|
variant: "ghost",
|
|
130
|
-
className: "rounded-none border-0 shadow-none hover:bg-accent/50",
|
|
130
|
+
className: "h-full rounded-none border-0 shadow-none hover:bg-accent/50",
|
|
131
131
|
disabled: A,
|
|
132
132
|
onClick: (r) => {
|
|
133
133
|
r.stopPropagation(), l(t);
|
|
@@ -140,18 +140,18 @@ function bt({
|
|
|
140
140
|
}
|
|
141
141
|
),
|
|
142
142
|
/* @__PURE__ */ n(
|
|
143
|
-
|
|
143
|
+
He,
|
|
144
144
|
{
|
|
145
145
|
modal: !1,
|
|
146
146
|
open: S,
|
|
147
147
|
onOpenChange: E,
|
|
148
148
|
children: [
|
|
149
|
-
/* @__PURE__ */ e(
|
|
149
|
+
/* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ e(
|
|
150
150
|
I,
|
|
151
151
|
{
|
|
152
152
|
size: "xs",
|
|
153
153
|
variant: "ghost",
|
|
154
|
-
className: "w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent/50",
|
|
154
|
+
className: "h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent/50",
|
|
155
155
|
"aria-label": "Open visual actions",
|
|
156
156
|
children: /* @__PURE__ */ e(_e, { className: "h-3.5 w-3.5" })
|
|
157
157
|
}
|
|
@@ -306,8 +306,8 @@ function yt({ searchQuery: t }) {
|
|
|
306
306
|
(ee = c == null ? void 0 : c.onSuccess) == null || ee.call(c);
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
|
-
const D = Object.keys(B),
|
|
310
|
-
r(s,
|
|
309
|
+
const D = Object.keys(B), K = D.length === 1 ? D[0] : void 0;
|
|
310
|
+
r(s, K), V(
|
|
311
311
|
{
|
|
312
312
|
resourceId: s,
|
|
313
313
|
data: B
|
|
@@ -315,11 +315,11 @@ function yt({ searchQuery: t }) {
|
|
|
315
315
|
{
|
|
316
316
|
onSuccess: () => {
|
|
317
317
|
var P;
|
|
318
|
-
G(s,
|
|
318
|
+
G(s, K), (P = c == null ? void 0 : c.onSuccess) == null || P.call(c);
|
|
319
319
|
},
|
|
320
320
|
onError: () => {
|
|
321
321
|
var P;
|
|
322
|
-
G(s,
|
|
322
|
+
G(s, K), (P = c == null ? void 0 : c.onError) == null || P.call(c);
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
);
|
|
@@ -327,7 +327,7 @@ function yt({ searchQuery: t }) {
|
|
|
327
327
|
f(s), C(s, {
|
|
328
328
|
onSettled: () => f(null)
|
|
329
329
|
});
|
|
330
|
-
},
|
|
330
|
+
}, H = (s) => {
|
|
331
331
|
A(s);
|
|
332
332
|
}, Y = (s) => {
|
|
333
333
|
R(s);
|
|
@@ -371,7 +371,7 @@ function yt({ searchQuery: t }) {
|
|
|
371
371
|
{
|
|
372
372
|
visual: s,
|
|
373
373
|
onAddVisual: Y,
|
|
374
|
-
onOpenVisual:
|
|
374
|
+
onOpenVisual: H,
|
|
375
375
|
onEditDetails: Z,
|
|
376
376
|
onDeleteClick: j,
|
|
377
377
|
onDuplicateVisual: X,
|
|
@@ -552,7 +552,7 @@ function St(t) {
|
|
|
552
552
|
f(!1);
|
|
553
553
|
const a = d == null ? void 0 : d.id;
|
|
554
554
|
u(null), (V == null ? void 0 : V.id) === a && (!(v != null && v.dashboard_id) && !M ? C() : E && E.id !== a && O(E));
|
|
555
|
-
}), { userContext: X } = ue(),
|
|
555
|
+
}), { userContext: X } = ue(), H = ((he = X == null ? void 0 : X.permissions) == null ? void 0 : he.canCreateDashboard) ?? !1, Y = U.filter(
|
|
556
556
|
(a) => {
|
|
557
557
|
var _, g;
|
|
558
558
|
return ((_ = a == null ? void 0 : a.title) == null ? void 0 : _.toLowerCase().includes(m.toLowerCase())) || ((g = a == null ? void 0 : a.description) == null ? void 0 : g.toLowerCase().includes(m.toLowerCase()));
|
|
@@ -601,7 +601,7 @@ function St(t) {
|
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
);
|
|
604
|
-
},
|
|
604
|
+
}, K = (a) => {
|
|
605
605
|
b(a), N(!0);
|
|
606
606
|
}, ee = (a) => {
|
|
607
607
|
l == null || l(a.id), S(a);
|
|
@@ -624,7 +624,7 @@ function St(t) {
|
|
|
624
624
|
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-0.5 overflow-y-auto", children: Y.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-1.5 px-4 py-10 text-center", children: [
|
|
625
625
|
/* @__PURE__ */ e(et, { className: "h-5 w-5 text-muted-foreground/60" }),
|
|
626
626
|
/* @__PURE__ */ e("h3", { className: "text-[13px] font-medium text-foreground", children: m ? "No dashboards found" : "No dashboards yet" }),
|
|
627
|
-
/* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: m ? "Try adjusting your search." :
|
|
627
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: m ? "Try adjusting your search." : H ? 'Click "New" above to add your first dashboard.' : "No dashboards have been shared with you yet." })
|
|
628
628
|
] }) : Y.map((a) => /* @__PURE__ */ e(
|
|
629
629
|
Ct,
|
|
630
630
|
{
|
|
@@ -635,7 +635,7 @@ function St(t) {
|
|
|
635
635
|
onEditDetails: ee,
|
|
636
636
|
onDeleteClick: q,
|
|
637
637
|
onDuplicateDashboard: s,
|
|
638
|
-
onShareDashboard:
|
|
638
|
+
onShareDashboard: K,
|
|
639
639
|
formatDate: $,
|
|
640
640
|
onDashboardItemClick: i
|
|
641
641
|
},
|
|
@@ -797,7 +797,7 @@ function Tt({
|
|
|
797
797
|
(D) => {
|
|
798
798
|
o(!1), D && (S(D), E(D));
|
|
799
799
|
}
|
|
800
|
-
), U = i === "overlay", j = h ? "New Visual" : "New", F = h ? "New Visual" : "New Dashboard", r = h ? "Search visuals..." : "Search dashboards...", G = h ? "Collapse visuals panel" : "Collapse dashboard panel", z = ((u == null ? void 0 : u.name) ?? "").trim(), L = ((u == null ? void 0 : u.email) ?? "").trim(),
|
|
800
|
+
), U = i === "overlay", j = h ? "New Visual" : "New", F = h ? "New Visual" : "New Dashboard", r = h ? "Search visuals..." : "Search dashboards...", G = h ? "Collapse visuals panel" : "Collapse dashboard panel", z = ((u == null ? void 0 : u.name) ?? "").trim(), L = ((u == null ? void 0 : u.email) ?? "").trim(), H = z && z.toLowerCase() !== "undefined" ? z : L || "Current user", Y = ((B = H.charAt(0)) == null ? void 0 : B.toUpperCase()) || "?", $ = L && L.toLowerCase() !== "undefined" ? L : "", Z = wt(m, {
|
|
801
801
|
enabled: t && U
|
|
802
802
|
}), q = Q(
|
|
803
803
|
"flex h-full flex-col border-r border-border/60 bg-background",
|
|
@@ -811,8 +811,8 @@ function Tt({
|
|
|
811
811
|
console.log("Editing dashboard:", D);
|
|
812
812
|
}, T = (D) => {
|
|
813
813
|
V(D, {
|
|
814
|
-
onSuccess: (
|
|
815
|
-
o(!1), x(
|
|
814
|
+
onSuccess: (K) => {
|
|
815
|
+
o(!1), x(K, C);
|
|
816
816
|
}
|
|
817
817
|
});
|
|
818
818
|
};
|
|
@@ -898,10 +898,10 @@ function Tt({
|
|
|
898
898
|
u && /* @__PURE__ */ e(ct, { children: /* @__PURE__ */ e("div", { className: "border-t border-border/60 px-3 py-2", children: /* @__PURE__ */ n(ut, { children: [
|
|
899
899
|
/* @__PURE__ */ e(ht, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex cursor-default items-center gap-2", children: [
|
|
900
900
|
/* @__PURE__ */ e("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: Y }),
|
|
901
|
-
/* @__PURE__ */ e("span", { className: "truncate text-[12px] text-muted-foreground", children:
|
|
901
|
+
/* @__PURE__ */ e("span", { className: "truncate text-[12px] text-muted-foreground", children: H })
|
|
902
902
|
] }) }),
|
|
903
903
|
/* @__PURE__ */ e(pt, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
904
|
-
/* @__PURE__ */ e("div", { className: "font-medium", children:
|
|
904
|
+
/* @__PURE__ */ e("div", { className: "font-medium", children: H }),
|
|
905
905
|
$ && /* @__PURE__ */ e("div", { className: "text-[11px] opacity-80", children: $ }),
|
|
906
906
|
u.role && /* @__PURE__ */ n("div", { className: "text-[11px] opacity-80", children: [
|
|
907
907
|
"Role: ",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as le, V as L, bN as Ke, bO as pt, bP as mt, bQ as ft, bR as ht, bS as bt, u as De, ag as gt, bT as yt, bU as xt, bV as vt, ad as Ct, b as re, bW as kt, bX as Nt, B as q, t as St, J as ne, O as Ye, K as Xe, bY as Ge, x as He, N as Ne, bZ as Pe, X as Je, y as O, b_ as Dt, b$ as wt, c0 as te, c1 as Fe, c2 as Ae, c3 as fe, c4 as he, c5 as Tt, c6 as ze, c7 as Vt, c8 as It, c9 as ae, ca as qt, cb as Oe, cc as Et, a7 as Me, cd as Be, ce as We, cf as Ze, cg as et, ch as _t, L as Y, I as tt, z as be, A as ge, E as ye, F as xe, G as ve, ci as at, cj as Lt, ck as Ft, cl as rt, cm as st, cn as At, co as zt, cp as Ot, cq as Mt, cr as Bt, cs as Qt, ct as jt, cu as Qe, cv as Rt, cw as je, cx as Ut, cy as Ce, cz as $t } from "./index-72yod5pb.js";
|
|
2
2
|
import { jsx as t, jsxs as d, Fragment as U } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo as A, useState as
|
|
4
|
-
import { u as we } from "./use-visual-utils-
|
|
3
|
+
import { useMemo as A, useState as M, useRef as ke, useCallback as z, useEffect as Se, Fragment as Kt } from "react";
|
|
4
|
+
import { u as we } from "./use-visual-utils-DPBqTRUC.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license lucide-react v0.453.0 - ISC
|
|
7
7
|
*
|
|
@@ -31,7 +31,7 @@ const Yt = le("Library", [
|
|
|
31
31
|
* This source code is licensed under the ISC license.
|
|
32
32
|
* See the LICENSE file in the root directory of this source tree.
|
|
33
33
|
*/
|
|
34
|
-
const
|
|
34
|
+
const Xt = le("Link2", [
|
|
35
35
|
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
36
36
|
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
37
37
|
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
@@ -133,7 +133,7 @@ function sa({
|
|
|
133
133
|
library: "fill-blue-50 dark:fill-blue-950"
|
|
134
134
|
}, N = {
|
|
135
135
|
local: /* @__PURE__ */ t("span", { className: "h-2 w-2 rounded-full bg-current/70" }),
|
|
136
|
-
linked: /* @__PURE__ */ t(
|
|
136
|
+
linked: /* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" }),
|
|
137
137
|
library: /* @__PURE__ */ t(Yt, { className: "h-3.5 w-3.5" })
|
|
138
138
|
}, V = {
|
|
139
139
|
local: "Local",
|
|
@@ -169,7 +169,7 @@ function sa({
|
|
|
169
169
|
)
|
|
170
170
|
] }) });
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function Gt(s, r) {
|
|
173
173
|
return {
|
|
174
174
|
...s,
|
|
175
175
|
sql: "",
|
|
@@ -187,7 +187,7 @@ function Xt(s, r) {
|
|
|
187
187
|
}
|
|
188
188
|
function Te(s) {
|
|
189
189
|
const r = Dt(s);
|
|
190
|
-
return r ? (
|
|
190
|
+
return r ? (O.error(r), !1) : !0;
|
|
191
191
|
}
|
|
192
192
|
function la({
|
|
193
193
|
className: s,
|
|
@@ -216,9 +216,9 @@ function na({
|
|
|
216
216
|
className: s,
|
|
217
217
|
variant: r = "default"
|
|
218
218
|
}) {
|
|
219
|
-
const o = ne(), [i, f] =
|
|
219
|
+
const o = ne(), [i, f] = M(!1), u = De(
|
|
220
220
|
(g) => g.actions.setIsDashboardPanelOpen
|
|
221
|
-
), { setIsVisualEditing: b } = Ye(), { getUpdatedFrame: v } = we(), h =
|
|
221
|
+
), { setIsVisualEditing: b } = Ye(), { getUpdatedFrame: v } = we(), h = Xe(), C = L((g) => g.frame), x = Ge();
|
|
222
222
|
return /* @__PURE__ */ t(
|
|
223
223
|
q,
|
|
224
224
|
{
|
|
@@ -228,7 +228,7 @@ function na({
|
|
|
228
228
|
return;
|
|
229
229
|
const N = (C == null ? void 0 : C.visualId) || (h == null ? void 0 : h.id);
|
|
230
230
|
if (!N) {
|
|
231
|
-
|
|
231
|
+
O.error("No visual to save");
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
234
|
f(!0), x.mutate(
|
|
@@ -240,13 +240,13 @@ function na({
|
|
|
240
240
|
},
|
|
241
241
|
{
|
|
242
242
|
onSuccess: () => {
|
|
243
|
-
f(!1), u(!0),
|
|
243
|
+
f(!1), u(!0), O.success("Visual updated successfully"), o.invalidateQueries({
|
|
244
244
|
queryKey: ["resource-by-id", "visual", N],
|
|
245
245
|
exact: !0
|
|
246
246
|
});
|
|
247
247
|
},
|
|
248
248
|
onError: () => {
|
|
249
|
-
f(!1),
|
|
249
|
+
f(!1), O.error("Failed to update visual");
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
);
|
|
@@ -255,7 +255,7 @@ function na({
|
|
|
255
255
|
size: "xs",
|
|
256
256
|
variant: r,
|
|
257
257
|
children: i ? /* @__PURE__ */ d(U, { children: [
|
|
258
|
-
/* @__PURE__ */ t(
|
|
258
|
+
/* @__PURE__ */ t(He, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
259
259
|
"Saving"
|
|
260
260
|
] }) : /* @__PURE__ */ d(U, { children: [
|
|
261
261
|
/* @__PURE__ */ t(lt, { className: "h-3.5 w-3.5" }),
|
|
@@ -267,18 +267,18 @@ function na({
|
|
|
267
267
|
function oa({
|
|
268
268
|
className: s
|
|
269
269
|
}) {
|
|
270
|
-
const r = ne(), [o, i] =
|
|
270
|
+
const r = ne(), [o, i] = M(!1), f = Xe(), u = L((g) => g.frame), b = De((g) => g.selectedSheetId), { updateFrame: v, setIsVisualEditing: h } = Ye(), { getUpdatedFrame: C } = we(), x = Ge();
|
|
271
271
|
return /* @__PURE__ */ t(
|
|
272
272
|
q,
|
|
273
273
|
{
|
|
274
274
|
onClick: async () => {
|
|
275
275
|
if (!b) {
|
|
276
|
-
|
|
276
|
+
O.error("No sheet selected");
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
const g = (u == null ? void 0 : u.visualId) || (f == null ? void 0 : f.id);
|
|
280
280
|
if (!g) {
|
|
281
|
-
|
|
281
|
+
O.error("No visual to update");
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
i(!0);
|
|
@@ -299,11 +299,11 @@ function oa({
|
|
|
299
299
|
visualId: g
|
|
300
300
|
// Keep the link to library visual
|
|
301
301
|
};
|
|
302
|
-
v(b, V), r.invalidateQueries({ queryKey: ["visuals"] }), r.invalidateQueries({ queryKey: ["visual", g] }),
|
|
302
|
+
v(b, V), r.invalidateQueries({ queryKey: ["visuals"] }), r.invalidateQueries({ queryKey: ["visual", g] }), O.success("Saved to library and applied locally"), setTimeout(() => {
|
|
303
303
|
h(!1);
|
|
304
304
|
}, 300);
|
|
305
305
|
} catch (N) {
|
|
306
|
-
console.error("Failed to save and apply:", N),
|
|
306
|
+
console.error("Failed to save and apply:", N), O.error("Failed to save and apply changes");
|
|
307
307
|
} finally {
|
|
308
308
|
i(!1);
|
|
309
309
|
}
|
|
@@ -313,7 +313,7 @@ function oa({
|
|
|
313
313
|
variant: "default",
|
|
314
314
|
disabled: o,
|
|
315
315
|
children: o ? /* @__PURE__ */ d(U, { children: [
|
|
316
|
-
/* @__PURE__ */ t(
|
|
316
|
+
/* @__PURE__ */ t(He, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
317
317
|
"Saving..."
|
|
318
318
|
] }) : /* @__PURE__ */ d(U, { children: [
|
|
319
319
|
/* @__PURE__ */ t(lt, { className: "h-3.5 w-3.5" }),
|
|
@@ -323,7 +323,7 @@ function oa({
|
|
|
323
323
|
);
|
|
324
324
|
}
|
|
325
325
|
function ia({ className: s }) {
|
|
326
|
-
const { setTempQueryData: r, setSqlGen: o } = Ne(), i = ne(), f = L((m) => m.tempQueryData), u = L((m) => m.onClose), b = L((m) => m.card), v = nt(), h = A(() => v !== b.type ? { ...b, type: v } : b, [b, v]), { queryKey: C } =
|
|
326
|
+
const { setTempQueryData: r, setSqlGen: o } = Ne(), i = ne(), f = L((m) => m.tempQueryData), u = L((m) => m.onClose), b = L((m) => m.card), v = nt(), h = A(() => v !== b.type ? { ...b, type: v } : b, [b, v]), { queryKey: C } = Pe(h);
|
|
327
327
|
function x() {
|
|
328
328
|
if (f) {
|
|
329
329
|
const { queryKey: m, queryData: g } = f;
|
|
@@ -350,7 +350,7 @@ function da({
|
|
|
350
350
|
variant: r = "secondary",
|
|
351
351
|
className: o
|
|
352
352
|
} = {}) {
|
|
353
|
-
const { setTempQueryData: i } = Ne(), f = ne(), u = L((a) => a.tempQueryData), b = L((a) => a.card), v = nt(), h = A(() => v !== b.type ? { ...b, type: v } : b, [b, v]), { queryKey: C } =
|
|
353
|
+
const { setTempQueryData: i } = Ne(), f = ne(), u = L((a) => a.tempQueryData), b = L((a) => a.card), v = nt(), h = A(() => v !== b.type ? { ...b, type: v } : b, [b, v]), { queryKey: C } = Pe(h), {
|
|
354
354
|
setCardSql: x,
|
|
355
355
|
setSqlGen: m,
|
|
356
356
|
setCardPython: g,
|
|
@@ -360,23 +360,23 @@ function da({
|
|
|
360
360
|
setCardConfig: oe,
|
|
361
361
|
setCardType: ie,
|
|
362
362
|
setFrame: Z,
|
|
363
|
-
setCard:
|
|
363
|
+
setCard: X,
|
|
364
364
|
setActiveTabCardId: de
|
|
365
365
|
} = Ne();
|
|
366
366
|
function $() {
|
|
367
|
-
var E,
|
|
367
|
+
var E, H, j, ee;
|
|
368
368
|
const a = f.getQueryData(C);
|
|
369
369
|
u != null && u.queryData || i({
|
|
370
370
|
queryKey: C,
|
|
371
371
|
queryData: a
|
|
372
372
|
}), f.setQueryData(C, null), f.removeQueries({ queryKey: C, exact: !0 }), x(""), m({}), I(), oe(void 0), g(""), N(""), V({});
|
|
373
|
-
const S = L.getState().frame, B = L.getState().card, T = Ke(S, B),
|
|
373
|
+
const S = L.getState().frame, B = L.getState().card, T = Ke(S, B), G = ((E = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : E.visualType) === "multiple" || !!((H = T == null ? void 0 : T.customCardPreferences) != null && H.dataInputCardIds) || (((j = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : j.minInputs) || 0) > 1 || (((ee = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : ee.maxInputs) || 0) > 1, Q = Gt(B, G);
|
|
374
374
|
Z({
|
|
375
375
|
...S,
|
|
376
376
|
cards: S.cards.map(
|
|
377
|
-
(
|
|
377
|
+
(P) => P.id === Q.id ? Q : P
|
|
378
378
|
)
|
|
379
|
-
}), de(Q.id),
|
|
379
|
+
}), de(Q.id), X(Q), G || ie("bar");
|
|
380
380
|
}
|
|
381
381
|
return /* @__PURE__ */ d(
|
|
382
382
|
q,
|
|
@@ -407,7 +407,7 @@ function ot(s) {
|
|
|
407
407
|
)
|
|
408
408
|
] });
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function Ht(s) {
|
|
411
411
|
const { currentStep: r, labels: o } = s;
|
|
412
412
|
return /* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-1 border-b border-border/60 bg-background/95 px-1 pb-2.5 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 sm:gap-2.5", children: o.map((i, f) => {
|
|
413
413
|
const u = f + 1, b = u === r, v = u < r;
|
|
@@ -452,7 +452,7 @@ function se(s) {
|
|
|
452
452
|
i
|
|
453
453
|
] });
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function Pt(s) {
|
|
456
456
|
const { control: r, scope: o, detail: i } = s;
|
|
457
457
|
return /* @__PURE__ */ d("div", { className: "flex items-start gap-2.5 rounded-[6px] border border-border/60 bg-muted/30 px-3 py-2.5", children: [
|
|
458
458
|
/* @__PURE__ */ t($t, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground" }),
|
|
@@ -547,7 +547,7 @@ const Jt = /* @__PURE__ */ new Set([
|
|
|
547
547
|
"metric_selector"
|
|
548
548
|
]);
|
|
549
549
|
function Ue(s) {
|
|
550
|
-
const { text: r, ariaLabel: o } = s, [i, f] =
|
|
550
|
+
const { text: r, ariaLabel: o } = s, [i, f] = M(!1);
|
|
551
551
|
return /* @__PURE__ */ d(
|
|
552
552
|
"button",
|
|
553
553
|
{
|
|
@@ -582,7 +582,7 @@ function $e(s) {
|
|
|
582
582
|
} = s, x = Jt.has(r.type), m = i.match(/\[\[param\.(.+?)\]\]/), g = m ? `{{ param('${m[1]}') }}` : "";
|
|
583
583
|
return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
584
584
|
/* @__PURE__ */ t(
|
|
585
|
-
|
|
585
|
+
Pt,
|
|
586
586
|
{
|
|
587
587
|
control: r,
|
|
588
588
|
scope: o,
|
|
@@ -705,22 +705,22 @@ function ca({
|
|
|
705
705
|
const I = A(
|
|
706
706
|
() => new Set(o || []),
|
|
707
707
|
[o]
|
|
708
|
-
), oe = Lt(s), ie = wt(s), [Z,
|
|
708
|
+
), oe = Lt(s), ie = wt(s), [Z, X] = M(
|
|
709
709
|
null
|
|
710
|
-
), [de, $] =
|
|
710
|
+
), [de, $] = M(
|
|
711
711
|
null
|
|
712
|
-
), [a, S] =
|
|
712
|
+
), [a, S] = M(
|
|
713
713
|
() => b ? {
|
|
714
714
|
step: 1,
|
|
715
715
|
control: te(s, r, Array.from(I))
|
|
716
716
|
} : null
|
|
717
|
-
), B = ke({}), T = ke(void 0),
|
|
717
|
+
), B = ke({}), T = ke(void 0), G = ke(b), Q = A(
|
|
718
718
|
() => Fe({ scope: s, card: g }),
|
|
719
719
|
[g, s]
|
|
720
720
|
), E = z(
|
|
721
721
|
(e) => s === "dashboard" && (e === "field_selector" || e === "metric_selector"),
|
|
722
722
|
[s]
|
|
723
|
-
),
|
|
723
|
+
), H = A(
|
|
724
724
|
() => a ? Ae(
|
|
725
725
|
x || [],
|
|
726
726
|
a.control.type
|
|
@@ -762,11 +762,11 @@ function ca({
|
|
|
762
762
|
Se(() => {
|
|
763
763
|
N == null || N(!!a);
|
|
764
764
|
}, [a, N]), Se(() => {
|
|
765
|
-
const e = b && !
|
|
766
|
-
|
|
765
|
+
const e = b && !G.current;
|
|
766
|
+
G.current = b, e && (S({
|
|
767
767
|
step: 1,
|
|
768
768
|
control: te(s, r, Array.from(I))
|
|
769
|
-
}), $(null),
|
|
769
|
+
}), $(null), X(null));
|
|
770
770
|
}, [r, b, I, s]);
|
|
771
771
|
const ee = (e) => {
|
|
772
772
|
if (!E(e.type))
|
|
@@ -795,7 +795,7 @@ function ca({
|
|
|
795
795
|
target: l.metricTargetMap[c.value]
|
|
796
796
|
})) : []
|
|
797
797
|
};
|
|
798
|
-
},
|
|
798
|
+
}, P = (e) => {
|
|
799
799
|
if (!E(e.control.type))
|
|
800
800
|
return {
|
|
801
801
|
nextControl: e.control,
|
|
@@ -840,7 +840,7 @@ function ca({
|
|
|
840
840
|
);
|
|
841
841
|
let D, p;
|
|
842
842
|
if (y && s === "dashboard" && (y.type === "field_selector" || y.type === "metric_selector")) {
|
|
843
|
-
const w = (m == null ? void 0 : m[y.id]) || [], K =
|
|
843
|
+
const w = (m == null ? void 0 : m[y.id]) || [], K = P({
|
|
844
844
|
control: y,
|
|
845
845
|
nextSelectedCardIds: w
|
|
846
846
|
});
|
|
@@ -912,7 +912,7 @@ function ca({
|
|
|
912
912
|
T.current = void 0, S({
|
|
913
913
|
step: 1,
|
|
914
914
|
control: te(s, r, Array.from(I))
|
|
915
|
-
}), $(null),
|
|
915
|
+
}), $(null), X(null);
|
|
916
916
|
}, [r, I, s]), W = (e) => {
|
|
917
917
|
S(
|
|
918
918
|
(n) => n && (() => {
|
|
@@ -1027,10 +1027,10 @@ function ca({
|
|
|
1027
1027
|
}
|
|
1028
1028
|
);
|
|
1029
1029
|
$(n), S(null), V == null || V();
|
|
1030
|
-
}, [r, a, i, F, V]), ut = a ? E(a.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], Ee = a != null && a.createdControlId ? `[[param.${a.createdControlId}]]` : a ? `[[param.${qt(a.control.label) || a.control.id}]]` : "", pe =
|
|
1030
|
+
}, [r, a, i, F, V]), ut = a ? E(a.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], Ee = a != null && a.createdControlId ? `[[param.${a.createdControlId}]]` : a ? `[[param.${qt(a.control.label) || a.control.id}]]` : "", pe = Oe({
|
|
1031
1031
|
controls: r,
|
|
1032
1032
|
defaultValues: i
|
|
1033
|
-
}), me = a ? [...r, a.control] : r, _e = a ?
|
|
1033
|
+
}), me = a ? [...r, a.control] : r, _e = a ? Oe({
|
|
1034
1034
|
controls: me,
|
|
1035
1035
|
defaultValues: i,
|
|
1036
1036
|
overrides: [
|
|
@@ -1043,7 +1043,7 @@ function ca({
|
|
|
1043
1043
|
return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
1044
1044
|
a ? /* @__PURE__ */ d("div", { className: "space-y-4 pb-1", children: [
|
|
1045
1045
|
/* @__PURE__ */ t(
|
|
1046
|
-
|
|
1046
|
+
Ht,
|
|
1047
1047
|
{
|
|
1048
1048
|
currentStep: a.step,
|
|
1049
1049
|
labels: ut
|
|
@@ -1120,7 +1120,7 @@ function ca({
|
|
|
1120
1120
|
),
|
|
1121
1121
|
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Choose which cards should respond to this shared control." })
|
|
1122
1122
|
] }),
|
|
1123
|
-
|
|
1123
|
+
H.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-[6px] border border-border/60 bg-muted/30 px-3 py-2.5 text-[12px] text-muted-foreground", children: "No eligible cards are available yet. Add compatible metrics or group-by fields to cards first." }) : /* @__PURE__ */ t("div", { className: "space-y-1 rounded-[6px] border border-border/60 bg-background p-2", children: H.map((e) => {
|
|
1124
1124
|
const n = (a.selectedCardIds || []).includes(e.cardId);
|
|
1125
1125
|
return /* @__PURE__ */ d(
|
|
1126
1126
|
"label",
|
|
@@ -1307,7 +1307,7 @@ function ca({
|
|
|
1307
1307
|
(p) => p === e.id ? null : e.id
|
|
1308
1308
|
),
|
|
1309
1309
|
children: [
|
|
1310
|
-
y ? /* @__PURE__ */ t(
|
|
1310
|
+
y ? /* @__PURE__ */ t(Me, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ t(Be, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1311
1311
|
/* @__PURE__ */ d("div", { className: "min-w-0", children: [
|
|
1312
1312
|
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
1313
1313
|
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.label || "Untitled control" }),
|
|
@@ -1410,7 +1410,7 @@ function ca({
|
|
|
1410
1410
|
})),
|
|
1411
1411
|
selectedCardIds: (m == null ? void 0 : m[e.id]) || [],
|
|
1412
1412
|
onChange: (p) => {
|
|
1413
|
-
const k =
|
|
1413
|
+
const k = P({
|
|
1414
1414
|
control: e,
|
|
1415
1415
|
nextSelectedCardIds: p
|
|
1416
1416
|
}), _ = r.map(
|
|
@@ -1461,7 +1461,7 @@ function ca({
|
|
|
1461
1461
|
At,
|
|
1462
1462
|
{
|
|
1463
1463
|
open: Z === e.id,
|
|
1464
|
-
onOpenChange: (p) =>
|
|
1464
|
+
onOpenChange: (p) => X(p ? e.id : null),
|
|
1465
1465
|
children: [
|
|
1466
1466
|
/* @__PURE__ */ t(zt, { asChild: !0, children: /* @__PURE__ */ d(
|
|
1467
1467
|
q,
|
|
@@ -1471,17 +1471,17 @@ function ca({
|
|
|
1471
1471
|
size: "xs",
|
|
1472
1472
|
className: "-ml-2 gap-1 text-muted-foreground hover:text-foreground",
|
|
1473
1473
|
children: [
|
|
1474
|
-
Z === e.id ? /* @__PURE__ */ t(
|
|
1474
|
+
Z === e.id ? /* @__PURE__ */ t(Me, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Be, { className: "h-3.5 w-3.5" }),
|
|
1475
1475
|
"Advanced"
|
|
1476
1476
|
]
|
|
1477
1477
|
}
|
|
1478
1478
|
) }),
|
|
1479
|
-
/* @__PURE__ */ d(
|
|
1479
|
+
/* @__PURE__ */ d(Ot, { className: "space-y-3 pt-2", children: [
|
|
1480
1480
|
/* @__PURE__ */ d("div", { className: "grid gap-3 md:grid-cols-2", children: [
|
|
1481
1481
|
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
|
|
1482
1482
|
/* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Control ID" }),
|
|
1483
1483
|
/* @__PURE__ */ t(
|
|
1484
|
-
|
|
1484
|
+
Mt,
|
|
1485
1485
|
{
|
|
1486
1486
|
controlId: e.id,
|
|
1487
1487
|
onCommit: (p) => it(e.id, p)
|
|
@@ -1549,7 +1549,7 @@ function ua(s) {
|
|
|
1549
1549
|
onOpenChange: o,
|
|
1550
1550
|
initialCreateFlowActive: i = !1,
|
|
1551
1551
|
dismissMode: f = "passive"
|
|
1552
|
-
} = s, u = r !== void 0, [b, v] =
|
|
1552
|
+
} = s, u = r !== void 0, [b, v] = M(!1), [h, C] = M(
|
|
1553
1553
|
i
|
|
1554
1554
|
), x = u ? r : b, m = z(
|
|
1555
1555
|
(V) => {
|
|
@@ -1585,7 +1585,7 @@ export {
|
|
|
1585
1585
|
sa as V,
|
|
1586
1586
|
na as a,
|
|
1587
1587
|
oa as b,
|
|
1588
|
-
|
|
1588
|
+
Xt as c,
|
|
1589
1589
|
ia as d,
|
|
1590
1590
|
ca as e,
|
|
1591
1591
|
nt as f,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./index-
|
|
1
|
+
"use strict";const t=require("./index-BQ6qu8FI.js"),e=require("react/jsx-runtime"),C=require("react"),se=require("./use-visual-utils-Bm-ZnkON.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|