react-semaphor 0.1.203 → 0.1.205
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/dashboard-controls-DekrQ0yg.js +42 -0
- package/dist/chunks/dashboard-controls-n5_oB_dp.js +1584 -0
- package/dist/chunks/{dashboard-json-Cwh8kbV9.js → dashboard-json-B5YyWsMv.js} +5 -5
- package/dist/chunks/{dashboard-json-Dh8csIFq.js → dashboard-json-VG8uFdaU.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-_3iUVFkC.js → dashboard-summary-settings-dialog-B7_fbNYb.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-BL4vn4lZ.js → dashboard-summary-settings-dialog-DnfxWTj2.js} +55 -55
- package/dist/chunks/{edit-dashboard-visual-RiCeBX0X.js → edit-dashboard-visual-BxDQKLvc.js} +9 -9
- package/dist/chunks/{edit-dashboard-visual-DEc3lB9j.js → edit-dashboard-visual-bl33bktZ.js} +928 -914
- package/dist/chunks/{editor-action-buttons-BfLWRprW.js → editor-action-buttons-BUAzU5tX.js} +1 -1
- package/dist/chunks/{editor-action-buttons-DovtyKKL.js → editor-action-buttons-DngVSXyw.js} +65 -65
- package/dist/chunks/index-CtLqMYAL.js +1109 -0
- package/dist/chunks/{index-DaQXz6Oi.js → index-em2ecoK3.js} +33535 -29709
- package/dist/chunks/notification-bell-BWh1ZNB4.js +11 -0
- package/dist/chunks/{notification-bell-Cn3-W-S3.js → notification-bell-Ck-SNMez.js} +232 -233
- package/dist/chunks/{resource-management-panel-qsbMXn91.js → resource-management-panel-BGJ4XMn5.js} +188 -188
- package/dist/chunks/{resource-management-panel-DBnpAHFb.js → resource-management-panel-Ji1DZtnk.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-B22nZN2c.js → use-role-aware-display-preferences-C0-SK5cT.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-CnipXO4k.js → use-role-aware-display-preferences-DEkMGyx9.js} +1 -1
- package/dist/chunks/{use-visual-utils-JlfPxiXq.js → use-visual-utils-BLdGPBdR.js} +1 -1
- package/dist/chunks/{use-visual-utils-B9X7-yfe.js → use-visual-utils-BYBat4tj.js} +28 -28
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +258 -173
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/main.d.ts +813 -2
- package/dist/types/types.d.ts +222 -0
- package/package.json +2 -1
- package/dist/chunks/dashboard-controls-D5VrI40y.js +0 -42
- package/dist/chunks/dashboard-controls-p7I_UrIz.js +0 -1661
- package/dist/chunks/index-CpnMO9b6.js +0 -1087
- package/dist/chunks/notification-bell-DsJcuxld.js +0 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { u as s,
|
|
2
|
+
import { u as s, B as l, X as h, d, c } from "./index-em2ecoK3.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
function N() {
|
|
@@ -11,25 +11,25 @@ function N() {
|
|
|
11
11
|
return /* @__PURE__ */ o(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
14
|
-
className:
|
|
14
|
+
className: c("relative p-2", {
|
|
15
15
|
hidden: !n
|
|
16
16
|
}),
|
|
17
17
|
children: [
|
|
18
18
|
/* @__PURE__ */ o(
|
|
19
|
-
|
|
19
|
+
l,
|
|
20
20
|
{
|
|
21
21
|
variant: "secondary",
|
|
22
22
|
size: "sm",
|
|
23
23
|
className: "absolute right-2 top-2 z-10 h-8",
|
|
24
24
|
onClick: () => i(!1),
|
|
25
25
|
children: [
|
|
26
|
-
/* @__PURE__ */ r(
|
|
26
|
+
/* @__PURE__ */ r(h, { className: "mr-2 h-4 w-4" }),
|
|
27
27
|
"Close"
|
|
28
28
|
]
|
|
29
29
|
}
|
|
30
30
|
),
|
|
31
31
|
/* @__PURE__ */ r(
|
|
32
|
-
|
|
32
|
+
d,
|
|
33
33
|
{
|
|
34
34
|
onChange: (a) => {
|
|
35
35
|
if (a)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-CtLqMYAL.js");require("react");require("react-dom");function i(){const o=a.useDashboardStore(e=>e.dashboard),r=a.useDashboardStore(e=>e.actions.setDashboard),t=a.useDashboardStore(e=>e.showDashboardJSON),n=a.useDashboardStore(e=>e.actions.setShowDashboardJSON);return s.jsxs("div",{className:a.cn("relative p-2",{hidden:!t}),children:[s.jsxs(a.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>n(!1),children:[s.jsx(a.X,{className:"mr-2 h-4 w-4"}),"Close"]}),s.jsx(a.de,{onChange:e=>{if(e)try{JSON.parse(e),r(JSON.parse(e))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto",value:JSON.stringify(o,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}exports.default=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-CpnMO9b6.js");function W(){var N,C,T,y;const{authToken:s,tokenProps:r}=a.useSemaphorContext(),[i,S]=l.useState(!1),[x,v]=l.useState(!1),[j,b]=l.useState(!1),[p,u]=l.useState(null),[m,n]=l.useState(null),g=m||{tz:((C=(N=r==null?void 0:r.params)==null?void 0:N.calendarContext)==null?void 0:C.tz)||null,weekStart:((y=(T=r==null?void 0:r.params)==null?void 0:T.calendarContext)==null?void 0:y.weekStart)??null},d=l.useCallback(async()=>{if(!(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))){S(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const o=await c.json();n({tz:o.tz,weekStart:o.weekStart,source:o.source,isInherited:o.isInherited,userHasPrefs:o.userHasPrefs,inherited:o.inherited})}catch(c){const o=c instanceof Error?c.message:"Unknown error";u(o)}finally{S(!1)}}},[s,r]);l.useEffect(()=>{d()},[d]);const f=l.useCallback(async c=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;v(!0),u(null);try{const o=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.accessToken}`},body:JSON.stringify(c)});if(!o.ok){const h=await o.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await d(),!0}catch(o){const h=o instanceof Error?o.message:"Unknown error";return u(h),!1}finally{v(!1)}},[s,r,d]),w=l.useCallback(async()=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;b(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const o=await c.text();if(o)try{const h=JSON.parse(o);return n({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await d(),!0}catch(c){const o=c instanceof Error?c.message:"Unknown error";return u(o),!1}finally{b(!1)}},[s,r,d]);return{preferences:g,isLoading:i,isSaving:x,isClearing:j,error:p,updatePreferences:f,clearPreferences:w,refetch:d}}const I=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}];function G(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return I.map(s=>s.value)}function V(s){switch(s){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function L(s){const r=I.find(i=>i.value===s);return r?r.label:s}function X(s){const r=M.find(i=>i.value===s);return r?r.label:String(s)}function q({open:s,onOpenChange:r}){var E,P,A;const{preferences:i,isLoading:S,isSaving:x,isClearing:v,updatePreferences:j,clearPreferences:b}=W(),p=i.tz||((E=i.inherited)==null?void 0:E.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,u=i.weekStart??((P=i.inherited)==null?void 0:P.weekStart)??1,[m,n]=l.useState(!i.userHasPrefs),[g,d]=l.useState(!1),[f,w]=l.useState(p),[N,C]=l.useState(u),[T,y]=l.useState(!1),c=l.useMemo(()=>G(),[]),o=l.useMemo(()=>c.filter(t=>!I.some(R=>R.value===t)),[c]),h=l.useMemo(()=>L(f),[f]),F=i.inherited?L(i.inherited.tz):"UTC",H=i.inherited?X(i.inherited.weekStart):"Monday",B=V((A=i.inherited)==null?void 0:A.source);l.useEffect(()=>{if(!s){d(!1);return}g||(i.userHasPrefs!==void 0&&n(!i.userHasPrefs),w(p),C(u))},[s,g,i.userHasPrefs,p,u]);const _=async()=>{if(S){a.ue.error("Preferences are still loading. Please try again.");return}m?await b()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again."):await j({tz:f,weekStart:N})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again.")},$=()=>{r(!1)},D=x||v,O=D||S;return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Calendar Preferences"}),e.jsx(a.DialogDescription,{children:"Set your timezone and week start preferences for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs(a.RadioGroup,{value:m?"defaults":"custom",onValueChange:t=>{d(!0),n(t==="defaults")},className:"space-y-3",children:[e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"),onClick:()=>{d(!0),n(!0)},children:[e.jsx(a.RadioGroupItem,{value:"defaults",id:"mode-defaults"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs(a.Label,{htmlFor:"mode-defaults",className:"cursor-pointer font-medium",children:["Use ",B," defaults"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[F,", Week starts ",H]})]})]}),e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"),onClick:()=>{d(!0),n(!1)},children:[e.jsx(a.RadioGroupItem,{value:"custom",id:"mode-custom"}),e.jsx(a.Label,{htmlFor:"mode-custom",className:"cursor-pointer font-medium",children:"Use custom settings"})]})]}),e.jsxs("div",{className:a.cn("space-y-6 transition-opacity",m&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{children:"Timezone"}),e.jsxs(a.Popover,{open:T,onOpenChange:y,modal:!0,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"outline",role:"combobox","aria-expanded":T,className:"w-full justify-between",disabled:m,children:[h,e.jsx(a.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(a.Command,{className:"overflow-visible",children:[e.jsx(a.CommandInput,{placeholder:"Search timezones..."}),e.jsxs(a.CommandList,{children:[e.jsx(a.CommandEmpty,{children:"No timezone found."}),e.jsx(a.CommandGroup,{heading:"Common",children:I.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{d(!0),w(t.value),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:t.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.value})]},t.value))}),e.jsx(a.CommandSeparator,{}),e.jsx(a.CommandGroup,{heading:"All Timezones",children:o.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{d(!0),w(t),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a.Label,{children:"Week Starts On"}),e.jsx(a.RadioGroup,{value:String(N),onValueChange:t=>{d(!0),C(Number(t))},className:"flex gap-4",disabled:m,children:M.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a.RadioGroupItem,{value:String(t.value),id:`week-start-${t.value}`,disabled:m}),e.jsx(a.Label,{htmlFor:`week-start-${t.value}`,className:a.cn("cursor-pointer font-normal",m&&"cursor-not-allowed"),children:t.label})]},t.value))})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:$,disabled:D,children:"Cancel"}),e.jsx(a.Button,{onClick:_,disabled:O,children:D?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})})}const k=6,z=1,U=20;function Z(s){return Number.isNaN(s)?k:Math.min(U,Math.max(z,s))}function J({open:s,onOpenChange:r,dashboard:i,onApply:S,disabled:x=!1}){const[v,j]=l.useState(!1),[b,p]=l.useState("top"),[u,m]=l.useState(String(k)),n=i.summary;l.useEffect(()=>{s&&(j((n==null?void 0:n.enabled)===!0),p((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??k)))},[s,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const g=l.useMemo(()=>Z(Number.parseInt(u||`${k}`,10)),[u]),d=()=>{S({enabled:v,position:b,maxItems:g}),r(!1)};return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[420px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Summary Settings"}),e.jsx(a.DialogDescription,{children:"Configure dashboard-level summary display. Card-level summary settings still control which cards contribute."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-enabled",children:"Enable Dashboard Summary"}),e.jsx(a.SmallSwitch,{id:"dashboard-summary-enabled",checked:v,disabled:x,onCheckedChange:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",children:"Position"}),e.jsxs(a.Select,{value:b,disabled:x,onValueChange:f=>p(f),children:[e.jsx(a.SelectTrigger,{id:"dashboard-summary-position",children:e.jsx(a.SelectValue,{placeholder:"Select position"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"top",children:"Top"}),e.jsx(a.SelectItem,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-max-items",children:"Max Items"}),e.jsx(a.Input,{id:"dashboard-summary-max-items",type:"number",min:z,max:U,disabled:x,value:u,onChange:f=>m(f.target.value),onBlur:()=>m(String(g))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),x&&e.jsx("p",{className:"text-xs text-amber-700",children:"Enter dashboard edit mode to modify summary settings."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(a.Button,{onClick:d,disabled:x,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=q;exports.DashboardSummarySettingsDialog=J;
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-CtLqMYAL.js");function W(){var N,C,T,y;const{authToken:s,tokenProps:r}=a.useSemaphorContext(),[i,S]=l.useState(!1),[x,v]=l.useState(!1),[j,b]=l.useState(!1),[p,u]=l.useState(null),[m,n]=l.useState(null),g=m||{tz:((C=(N=r==null?void 0:r.params)==null?void 0:N.calendarContext)==null?void 0:C.tz)||null,weekStart:((y=(T=r==null?void 0:r.params)==null?void 0:T.calendarContext)==null?void 0:y.weekStart)??null},d=l.useCallback(async()=>{if(!(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))){S(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const o=await c.json();n({tz:o.tz,weekStart:o.weekStart,source:o.source,isInherited:o.isInherited,userHasPrefs:o.userHasPrefs,inherited:o.inherited})}catch(c){const o=c instanceof Error?c.message:"Unknown error";u(o)}finally{S(!1)}}},[s,r]);l.useEffect(()=>{d()},[d]);const f=l.useCallback(async c=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;v(!0),u(null);try{const o=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.accessToken}`},body:JSON.stringify(c)});if(!o.ok){const h=await o.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await d(),!0}catch(o){const h=o instanceof Error?o.message:"Unknown error";return u(h),!1}finally{v(!1)}},[s,r,d]),w=l.useCallback(async()=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;b(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const o=await c.text();if(o)try{const h=JSON.parse(o);return n({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await d(),!0}catch(c){const o=c instanceof Error?c.message:"Unknown error";return u(o),!1}finally{b(!1)}},[s,r,d]);return{preferences:g,isLoading:i,isSaving:x,isClearing:j,error:p,updatePreferences:f,clearPreferences:w,refetch:d}}const I=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}];function G(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return I.map(s=>s.value)}function V(s){switch(s){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function L(s){const r=I.find(i=>i.value===s);return r?r.label:s}function X(s){const r=M.find(i=>i.value===s);return r?r.label:String(s)}function q({open:s,onOpenChange:r}){var E,P,A;const{preferences:i,isLoading:S,isSaving:x,isClearing:v,updatePreferences:j,clearPreferences:b}=W(),p=i.tz||((E=i.inherited)==null?void 0:E.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,u=i.weekStart??((P=i.inherited)==null?void 0:P.weekStart)??1,[m,n]=l.useState(!i.userHasPrefs),[g,d]=l.useState(!1),[f,w]=l.useState(p),[N,C]=l.useState(u),[T,y]=l.useState(!1),c=l.useMemo(()=>G(),[]),o=l.useMemo(()=>c.filter(t=>!I.some(R=>R.value===t)),[c]),h=l.useMemo(()=>L(f),[f]),F=i.inherited?L(i.inherited.tz):"UTC",H=i.inherited?X(i.inherited.weekStart):"Monday",B=V((A=i.inherited)==null?void 0:A.source);l.useEffect(()=>{if(!s){d(!1);return}g||(i.userHasPrefs!==void 0&&n(!i.userHasPrefs),w(p),C(u))},[s,g,i.userHasPrefs,p,u]);const _=async()=>{if(S){a.ue.error("Preferences are still loading. Please try again.");return}m?await b()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again."):await j({tz:f,weekStart:N})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again.")},$=()=>{r(!1)},D=x||v,O=D||S;return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Calendar Preferences"}),e.jsx(a.DialogDescription,{children:"Set your timezone and week start preferences for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs(a.RadioGroup,{value:m?"defaults":"custom",onValueChange:t=>{d(!0),n(t==="defaults")},className:"space-y-3",children:[e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"),onClick:()=>{d(!0),n(!0)},children:[e.jsx(a.RadioGroupItem,{value:"defaults",id:"mode-defaults"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs(a.Label,{htmlFor:"mode-defaults",className:"cursor-pointer font-medium",children:["Use ",B," defaults"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[F,", Week starts ",H]})]})]}),e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"),onClick:()=>{d(!0),n(!1)},children:[e.jsx(a.RadioGroupItem,{value:"custom",id:"mode-custom"}),e.jsx(a.Label,{htmlFor:"mode-custom",className:"cursor-pointer font-medium",children:"Use custom settings"})]})]}),e.jsxs("div",{className:a.cn("space-y-6 transition-opacity",m&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{children:"Timezone"}),e.jsxs(a.Popover,{open:T,onOpenChange:y,modal:!0,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"outline",role:"combobox","aria-expanded":T,className:"w-full justify-between",disabled:m,children:[h,e.jsx(a.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(a.Command,{className:"overflow-visible",children:[e.jsx(a.CommandInput,{placeholder:"Search timezones..."}),e.jsxs(a.CommandList,{children:[e.jsx(a.CommandEmpty,{children:"No timezone found."}),e.jsx(a.CommandGroup,{heading:"Common",children:I.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{d(!0),w(t.value),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:t.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.value})]},t.value))}),e.jsx(a.CommandSeparator,{}),e.jsx(a.CommandGroup,{heading:"All Timezones",children:o.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{d(!0),w(t),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a.Label,{children:"Week Starts On"}),e.jsx(a.RadioGroup,{value:String(N),onValueChange:t=>{d(!0),C(Number(t))},className:"flex gap-4",disabled:m,children:M.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a.RadioGroupItem,{value:String(t.value),id:`week-start-${t.value}`,disabled:m}),e.jsx(a.Label,{htmlFor:`week-start-${t.value}`,className:a.cn("cursor-pointer font-normal",m&&"cursor-not-allowed"),children:t.label})]},t.value))})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:$,disabled:D,children:"Cancel"}),e.jsx(a.Button,{onClick:_,disabled:O,children:D?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})})}const k=6,z=1,U=20;function Z(s){return Number.isNaN(s)?k:Math.min(U,Math.max(z,s))}function J({open:s,onOpenChange:r,dashboard:i,onApply:S,disabled:x=!1}){const[v,j]=l.useState(!1),[b,p]=l.useState("top"),[u,m]=l.useState(String(k)),n=i.summary;l.useEffect(()=>{s&&(j((n==null?void 0:n.enabled)===!0),p((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??k)))},[s,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const g=l.useMemo(()=>Z(Number.parseInt(u||`${k}`,10)),[u]),d=()=>{S({enabled:v,position:b,maxItems:g}),r(!1)};return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[420px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Summary Settings"}),e.jsx(a.DialogDescription,{children:"Configure dashboard-level summary display. Card-level summary settings still control which cards contribute."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-enabled",children:"Enable Dashboard Summary"}),e.jsx(a.SmallSwitch,{id:"dashboard-summary-enabled",checked:v,disabled:x,onCheckedChange:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",children:"Position"}),e.jsxs(a.Select,{value:b,disabled:x,onValueChange:f=>p(f),children:[e.jsx(a.SelectTrigger,{id:"dashboard-summary-position",children:e.jsx(a.SelectValue,{placeholder:"Select position"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"top",children:"Top"}),e.jsx(a.SelectItem,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-max-items",children:"Max Items"}),e.jsx(a.Input,{id:"dashboard-summary-max-items",type:"number",min:z,max:U,disabled:x,value:u,onChange:f=>m(f.target.value),onBlur:()=>m(String(g))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),x&&e.jsx("p",{className:"text-xs text-amber-700",children:"Enter dashboard edit mode to modify summary settings."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(a.Button,{onClick:d,disabled:x,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=q;exports.DashboardSummarySettingsDialog=J;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as oe } from "react/jsx-runtime";
|
|
2
|
-
import de, { useState as h, useCallback as L, useEffect as
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
var k, I,
|
|
2
|
+
import de, { useState as h, useCallback as L, useEffect as G, useMemo as z } from "react";
|
|
3
|
+
import { l as ue, m as X, n as J, o as K, p as Z, q, R as j, r as F, L as b, c as C, P as me, s as he, B as P, C as fe, t as pe, v as ve, w as be, x as Se, y as ge, z as O, A as B, E as W, F as ye, G as Q, H as we, I as A, S as xe, J as Ne, K as Ce, M as Te, N as ke, O as R, Q as Ie } from "./index-em2ecoK3.js";
|
|
4
|
+
function Ee() {
|
|
5
|
+
var k, I, E, N;
|
|
6
6
|
const { authToken: a, tokenProps: r } = ue(), [l, S] = h(!1), [p, g] = h(!1), [x, y] = h(!1), [v, o] = h(null), [u, n] = h(null), w = u || {
|
|
7
7
|
tz: ((I = (k = r == null ? void 0 : r.params) == null ? void 0 : k.calendarContext) == null ? void 0 : I.tz) || null,
|
|
8
|
-
weekStart: ((N = (
|
|
8
|
+
weekStart: ((N = (E = r == null ? void 0 : r.params) == null ? void 0 : E.calendarContext) == null ? void 0 : N.weekStart) ?? null
|
|
9
9
|
}, d = L(async () => {
|
|
10
10
|
if (!(!(a != null && a.accessToken) || !(r != null && r.apiServiceUrl))) {
|
|
11
11
|
S(!0), o(null);
|
|
@@ -40,7 +40,7 @@ function Pe() {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}, [a, r]);
|
|
43
|
-
|
|
43
|
+
G(() => {
|
|
44
44
|
d();
|
|
45
45
|
}, [d]);
|
|
46
46
|
const f = L(
|
|
@@ -73,7 +73,7 @@ function Pe() {
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
[a, r, d]
|
|
76
|
-
),
|
|
76
|
+
), T = L(async () => {
|
|
77
77
|
if (!(a != null && a.accessToken) || !(r != null && r.apiServiceUrl))
|
|
78
78
|
return o("Not authenticated"), !1;
|
|
79
79
|
y(!0), o(null);
|
|
@@ -120,7 +120,7 @@ function Pe() {
|
|
|
120
120
|
isClearing: x,
|
|
121
121
|
error: v,
|
|
122
122
|
updatePreferences: f,
|
|
123
|
-
clearPreferences:
|
|
123
|
+
clearPreferences: T,
|
|
124
124
|
refetch: d
|
|
125
125
|
};
|
|
126
126
|
}
|
|
@@ -139,12 +139,12 @@ const M = [
|
|
|
139
139
|
{ value: "Asia/Kolkata", label: "Mumbai, New Delhi" },
|
|
140
140
|
{ value: "Australia/Sydney", label: "Sydney" },
|
|
141
141
|
{ value: "UTC", label: "UTC" }
|
|
142
|
-
],
|
|
142
|
+
], Y = [
|
|
143
143
|
{ value: 0, label: "Sunday" },
|
|
144
144
|
{ value: 1, label: "Monday" },
|
|
145
145
|
{ value: 6, label: "Saturday" }
|
|
146
146
|
];
|
|
147
|
-
function
|
|
147
|
+
function Ae() {
|
|
148
148
|
try {
|
|
149
149
|
const a = Intl;
|
|
150
150
|
if (a.supportedValuesOf)
|
|
@@ -153,7 +153,7 @@ function Ee() {
|
|
|
153
153
|
}
|
|
154
154
|
return M.map((a) => a.value);
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function Pe(a) {
|
|
157
157
|
switch (a) {
|
|
158
158
|
case "tenant":
|
|
159
159
|
return "tenant";
|
|
@@ -165,19 +165,19 @@ function Ae(a) {
|
|
|
165
165
|
return "default";
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function V(a) {
|
|
169
169
|
const r = M.find((l) => l.value === a);
|
|
170
170
|
return r ? r.label : a;
|
|
171
171
|
}
|
|
172
172
|
function ze(a) {
|
|
173
|
-
const r =
|
|
173
|
+
const r = Y.find((l) => l.value === a);
|
|
174
174
|
return r ? r.label : String(a);
|
|
175
175
|
}
|
|
176
176
|
function Fe({
|
|
177
177
|
open: a,
|
|
178
178
|
onOpenChange: r
|
|
179
179
|
}) {
|
|
180
|
-
var
|
|
180
|
+
var H, _, $;
|
|
181
181
|
const {
|
|
182
182
|
preferences: l,
|
|
183
183
|
isLoading: S,
|
|
@@ -185,16 +185,16 @@ function Fe({
|
|
|
185
185
|
isClearing: g,
|
|
186
186
|
updatePreferences: x,
|
|
187
187
|
clearPreferences: y
|
|
188
|
-
} =
|
|
188
|
+
} = Ee(), v = l.tz || ((H = l.inherited) == null ? void 0 : H.tz) || Intl.DateTimeFormat().resolvedOptions().timeZone, o = l.weekStart ?? ((_ = l.inherited) == null ? void 0 : _.weekStart) ?? 1, [u, n] = h(!l.userHasPrefs), [w, d] = h(!1), [f, T] = h(
|
|
189
189
|
v
|
|
190
190
|
), [k, I] = h(
|
|
191
191
|
o
|
|
192
|
-
), [
|
|
192
|
+
), [E, N] = h(!1), c = z(() => Ae(), []), i = z(
|
|
193
193
|
() => c.filter(
|
|
194
194
|
(t) => !M.some((ce) => ce.value === t)
|
|
195
195
|
),
|
|
196
196
|
[c]
|
|
197
|
-
), m = z(() =>
|
|
197
|
+
), m = z(() => V(f), [f]), re = l.inherited ? V(l.inherited.tz) : "UTC", se = l.inherited ? ze(l.inherited.weekStart) : "Monday", te = Pe(
|
|
198
198
|
($ = l.inherited) == null ? void 0 : $.source
|
|
199
199
|
);
|
|
200
200
|
de.useEffect(() => {
|
|
@@ -202,7 +202,7 @@ function Fe({
|
|
|
202
202
|
d(!1);
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
|
-
w || (l.userHasPrefs !== void 0 && n(!l.userHasPrefs),
|
|
205
|
+
w || (l.userHasPrefs !== void 0 && n(!l.userHasPrefs), T(v), I(o));
|
|
206
206
|
}, [
|
|
207
207
|
a,
|
|
208
208
|
w,
|
|
@@ -212,26 +212,26 @@ function Fe({
|
|
|
212
212
|
]);
|
|
213
213
|
const ne = async () => {
|
|
214
214
|
if (S) {
|
|
215
|
-
|
|
215
|
+
A.error("Preferences are still loading. Please try again.");
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
-
u ? await y() ? (
|
|
218
|
+
u ? await y() ? (A.success(
|
|
219
219
|
"Now using default settings. Please refresh the page to apply changes.",
|
|
220
220
|
{ duration: 5e3 }
|
|
221
|
-
), r(!1)) :
|
|
221
|
+
), r(!1)) : A.error("Failed to save preferences. Please try again.") : await x({
|
|
222
222
|
tz: f,
|
|
223
223
|
weekStart: k
|
|
224
|
-
}) ? (
|
|
224
|
+
}) ? (A.success(
|
|
225
225
|
"Preferences saved. Please refresh the page to apply changes.",
|
|
226
226
|
{ duration: 5e3 }
|
|
227
|
-
), r(!1)) :
|
|
227
|
+
), r(!1)) : A.error("Failed to save preferences. Please try again.");
|
|
228
228
|
}, le = () => {
|
|
229
229
|
r(!1);
|
|
230
230
|
}, U = p || g, ie = U || S;
|
|
231
|
-
return /* @__PURE__ */ e(
|
|
231
|
+
return /* @__PURE__ */ e(X, { open: a, onOpenChange: r, children: /* @__PURE__ */ s(J, { className: "sm:max-w-[425px]", children: [
|
|
232
232
|
/* @__PURE__ */ s(K, { children: [
|
|
233
|
-
/* @__PURE__ */ e(
|
|
234
|
-
/* @__PURE__ */ e(
|
|
233
|
+
/* @__PURE__ */ e(Z, { children: "Calendar Preferences" }),
|
|
234
|
+
/* @__PURE__ */ e(q, { children: "Set your timezone and week start preferences for date calculations and displays." })
|
|
235
235
|
] }),
|
|
236
236
|
/* @__PURE__ */ s("div", { className: "space-y-6 py-4", children: [
|
|
237
237
|
/* @__PURE__ */ s(
|
|
@@ -246,7 +246,7 @@ function Fe({
|
|
|
246
246
|
/* @__PURE__ */ s(
|
|
247
247
|
"div",
|
|
248
248
|
{
|
|
249
|
-
className:
|
|
249
|
+
className: C(
|
|
250
250
|
"flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",
|
|
251
251
|
u ? "border-primary bg-primary/5" : "border-border hover:border-muted-foreground/50"
|
|
252
252
|
),
|
|
@@ -280,7 +280,7 @@ function Fe({
|
|
|
280
280
|
/* @__PURE__ */ s(
|
|
281
281
|
"div",
|
|
282
282
|
{
|
|
283
|
-
className:
|
|
283
|
+
className: C(
|
|
284
284
|
"flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",
|
|
285
285
|
u ? "border-border hover:border-muted-foreground/50" : "border-primary bg-primary/5"
|
|
286
286
|
),
|
|
@@ -306,7 +306,7 @@ function Fe({
|
|
|
306
306
|
/* @__PURE__ */ s(
|
|
307
307
|
"div",
|
|
308
308
|
{
|
|
309
|
-
className:
|
|
309
|
+
className: C(
|
|
310
310
|
"space-y-6 transition-opacity",
|
|
311
311
|
u && "opacity-50 pointer-events-none"
|
|
312
312
|
),
|
|
@@ -316,16 +316,16 @@ function Fe({
|
|
|
316
316
|
/* @__PURE__ */ s(
|
|
317
317
|
me,
|
|
318
318
|
{
|
|
319
|
-
open:
|
|
319
|
+
open: E,
|
|
320
320
|
onOpenChange: N,
|
|
321
321
|
modal: !0,
|
|
322
322
|
children: [
|
|
323
323
|
/* @__PURE__ */ e(he, { asChild: !0, children: /* @__PURE__ */ s(
|
|
324
|
-
|
|
324
|
+
P,
|
|
325
325
|
{
|
|
326
326
|
variant: "outline",
|
|
327
327
|
role: "combobox",
|
|
328
|
-
"aria-expanded":
|
|
328
|
+
"aria-expanded": E,
|
|
329
329
|
className: "w-full justify-between",
|
|
330
330
|
disabled: u,
|
|
331
331
|
children: [
|
|
@@ -344,17 +344,17 @@ function Fe({
|
|
|
344
344
|
/* @__PURE__ */ s(Se, { children: [
|
|
345
345
|
/* @__PURE__ */ e(ge, { children: "No timezone found." }),
|
|
346
346
|
/* @__PURE__ */ e(O, { heading: "Common", children: M.map((t) => /* @__PURE__ */ s(
|
|
347
|
-
|
|
347
|
+
B,
|
|
348
348
|
{
|
|
349
349
|
value: `${t.value} ${t.label}`,
|
|
350
350
|
onSelect: () => {
|
|
351
|
-
d(!0),
|
|
351
|
+
d(!0), T(t.value), N(!1);
|
|
352
352
|
},
|
|
353
353
|
children: [
|
|
354
354
|
/* @__PURE__ */ e(
|
|
355
|
-
|
|
355
|
+
W,
|
|
356
356
|
{
|
|
357
|
-
className:
|
|
357
|
+
className: C(
|
|
358
358
|
"mr-2 h-4 w-4",
|
|
359
359
|
f === t.value ? "opacity-100" : "opacity-0"
|
|
360
360
|
)
|
|
@@ -368,17 +368,17 @@ function Fe({
|
|
|
368
368
|
)) }),
|
|
369
369
|
/* @__PURE__ */ e(ye, {}),
|
|
370
370
|
/* @__PURE__ */ e(O, { heading: "All Timezones", children: i.map((t) => /* @__PURE__ */ s(
|
|
371
|
-
|
|
371
|
+
B,
|
|
372
372
|
{
|
|
373
373
|
value: t,
|
|
374
374
|
onSelect: () => {
|
|
375
|
-
d(!0),
|
|
375
|
+
d(!0), T(t), N(!1);
|
|
376
376
|
},
|
|
377
377
|
children: [
|
|
378
378
|
/* @__PURE__ */ e(
|
|
379
|
-
|
|
379
|
+
W,
|
|
380
380
|
{
|
|
381
|
-
className:
|
|
381
|
+
className: C(
|
|
382
382
|
"mr-2 h-4 w-4",
|
|
383
383
|
f === t ? "opacity-100" : "opacity-0"
|
|
384
384
|
)
|
|
@@ -408,7 +408,7 @@ function Fe({
|
|
|
408
408
|
},
|
|
409
409
|
className: "flex gap-4",
|
|
410
410
|
disabled: u,
|
|
411
|
-
children:
|
|
411
|
+
children: Y.map((t) => /* @__PURE__ */ s(
|
|
412
412
|
"div",
|
|
413
413
|
{
|
|
414
414
|
className: "flex items-center space-x-2",
|
|
@@ -425,7 +425,7 @@ function Fe({
|
|
|
425
425
|
b,
|
|
426
426
|
{
|
|
427
427
|
htmlFor: `week-start-${t.value}`,
|
|
428
|
-
className:
|
|
428
|
+
className: C(
|
|
429
429
|
"cursor-pointer font-normal",
|
|
430
430
|
u && "cursor-not-allowed"
|
|
431
431
|
),
|
|
@@ -444,8 +444,8 @@ function Fe({
|
|
|
444
444
|
)
|
|
445
445
|
] }),
|
|
446
446
|
/* @__PURE__ */ s(Q, { children: [
|
|
447
|
-
/* @__PURE__ */ e(
|
|
448
|
-
/* @__PURE__ */ e(
|
|
447
|
+
/* @__PURE__ */ e(P, { variant: "outline", onClick: le, disabled: U, children: "Cancel" }),
|
|
448
|
+
/* @__PURE__ */ e(P, { onClick: ne, disabled: ie, children: U ? /* @__PURE__ */ s(oe, { children: [
|
|
449
449
|
/* @__PURE__ */ e(we, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
450
450
|
"Saving..."
|
|
451
451
|
] }) : "Save" })
|
|
@@ -456,7 +456,7 @@ const D = 6, ee = 1, ae = 20;
|
|
|
456
456
|
function De(a) {
|
|
457
457
|
return Number.isNaN(a) ? D : Math.min(ae, Math.max(ee, a));
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function He({
|
|
460
460
|
open: a,
|
|
461
461
|
onOpenChange: r,
|
|
462
462
|
dashboard: l,
|
|
@@ -464,17 +464,17 @@ function _e({
|
|
|
464
464
|
disabled: p = !1
|
|
465
465
|
}) {
|
|
466
466
|
const [g, x] = h(!1), [y, v] = h("top"), [o, u] = h(String(D)), n = l.summary;
|
|
467
|
-
|
|
467
|
+
G(() => {
|
|
468
468
|
a && (x((n == null ? void 0 : n.enabled) === !0), v((n == null ? void 0 : n.position) === "bottom" ? "bottom" : "top"), u(String((n == null ? void 0 : n.maxItems) ?? D)));
|
|
469
469
|
}, [a, n == null ? void 0 : n.enabled, n == null ? void 0 : n.position, n == null ? void 0 : n.maxItems]);
|
|
470
470
|
const w = z(
|
|
471
471
|
() => De(Number.parseInt(o || `${D}`, 10)),
|
|
472
472
|
[o]
|
|
473
473
|
);
|
|
474
|
-
return /* @__PURE__ */ e(
|
|
474
|
+
return /* @__PURE__ */ e(X, { open: a, onOpenChange: r, children: /* @__PURE__ */ s(J, { className: "sm:max-w-[420px]", children: [
|
|
475
475
|
/* @__PURE__ */ s(K, { children: [
|
|
476
|
-
/* @__PURE__ */ e(
|
|
477
|
-
/* @__PURE__ */ e(
|
|
476
|
+
/* @__PURE__ */ e(Z, { children: "Summary Settings" }),
|
|
477
|
+
/* @__PURE__ */ e(q, { children: "Configure dashboard-level summary display. Card-level summary settings still control which cards contribute." })
|
|
478
478
|
] }),
|
|
479
479
|
/* @__PURE__ */ s("div", { className: "space-y-4 py-2", children: [
|
|
480
480
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
@@ -498,10 +498,10 @@ function _e({
|
|
|
498
498
|
disabled: p,
|
|
499
499
|
onValueChange: (f) => v(f),
|
|
500
500
|
children: [
|
|
501
|
-
/* @__PURE__ */ e(
|
|
501
|
+
/* @__PURE__ */ e(Ce, { id: "dashboard-summary-position", children: /* @__PURE__ */ e(Te, { placeholder: "Select position" }) }),
|
|
502
502
|
/* @__PURE__ */ s(ke, { children: [
|
|
503
|
-
/* @__PURE__ */ e(
|
|
504
|
-
/* @__PURE__ */ e(
|
|
503
|
+
/* @__PURE__ */ e(R, { value: "top", children: "Top" }),
|
|
504
|
+
/* @__PURE__ */ e(R, { value: "bottom", children: "Bottom" })
|
|
505
505
|
] })
|
|
506
506
|
]
|
|
507
507
|
}
|
|
@@ -527,8 +527,8 @@ function _e({
|
|
|
527
527
|
p && /* @__PURE__ */ e("p", { className: "text-xs text-amber-700", children: "Enter dashboard edit mode to modify summary settings." })
|
|
528
528
|
] }),
|
|
529
529
|
/* @__PURE__ */ s(Q, { children: [
|
|
530
|
-
/* @__PURE__ */ e(
|
|
531
|
-
/* @__PURE__ */ e(
|
|
530
|
+
/* @__PURE__ */ e(P, { variant: "outline", onClick: () => r(!1), children: "Cancel" }),
|
|
531
|
+
/* @__PURE__ */ e(P, { onClick: () => {
|
|
532
532
|
S({
|
|
533
533
|
enabled: g,
|
|
534
534
|
position: y,
|
|
@@ -540,5 +540,5 @@ function _e({
|
|
|
540
540
|
}
|
|
541
541
|
export {
|
|
542
542
|
Fe as C,
|
|
543
|
-
|
|
543
|
+
He as D
|
|
544
544
|
};
|