react-semaphor 0.1.292 → 0.1.293
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 → braces-BwW2HFlB.js} +1 -1
- package/dist/chunks/{braces-hczcJsV8.js → braces-C7GP95Fp.js} +1 -1
- package/dist/chunks/dashboard-controls-DgUc38Tn.js +47 -0
- package/dist/chunks/dashboard-controls-jrkoCSY_.js +1982 -0
- package/dist/chunks/{dashboard-filter-controls-button-DSQHVjjX.js → dashboard-filter-controls-button-B19UWmsK.js} +1 -1
- package/dist/chunks/{dashboard-filter-controls-button-DDqEus_E.js → dashboard-filter-controls-button-DGH4DxJ8.js} +3 -3
- package/dist/chunks/{dashboard-json-BDyKcoGT.js → dashboard-json-C0NiRL-A.js} +1 -1
- package/dist/chunks/{dashboard-json-COXiPm3N.js → dashboard-json-COjT-zjQ.js} +1 -1
- package/dist/chunks/dashboard-summary-settings-dialog-CGuFl7Xe.js +543 -0
- package/dist/chunks/dashboard-summary-settings-dialog-CXqaN_zj.js +1 -0
- package/dist/chunks/{edit-dashboard-visual-BqfzqW4i.js → edit-dashboard-visual-CDOz4LWO.js} +32 -32
- package/dist/chunks/{edit-dashboard-visual-DLyimx6x.js → edit-dashboard-visual-ppdXk86H.js} +1103 -1089
- package/dist/chunks/{index-72yod5pb.js → index-9z-jMqN8.js} +29070 -29109
- package/dist/chunks/{index-BQ6qu8FI.js → index-K25f5Rqr.js} +249 -249
- package/dist/chunks/{resource-management-panel-DwPION_M.js → resource-management-panel-CP8cegZP.js} +2 -2
- package/dist/chunks/{resource-management-panel-CSLGSJjC.js → resource-management-panel-os6AuEKT.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-zz9TYhdC.js → use-create-flow-overlay-state-CecnMS_v.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-UruHbtfS.js → use-create-flow-overlay-state-wpuqRZX5.js} +2 -2
- package/dist/chunks/{use-visual-utils-Bm-ZnkON.js → use-visual-utils-BTfG-ppd.js} +1 -1
- package/dist/chunks/{use-visual-utils-DPBqTRUC.js → use-visual-utils-BhRKGJql.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- 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 +3 -1
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-Db0F38eK.js +0 -47
- package/dist/chunks/dashboard-controls-DeUHM4uL.js +0 -1970
- package/dist/chunks/dashboard-summary-settings-dialog-CryMC_4x.js +0 -1
- package/dist/chunks/dashboard-summary-settings-dialog-DbcWMZsr.js +0 -536
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-BQ6qu8FI.js");function W(r={}){var C,I,P,D;const{authToken:o,tokenProps:s}=a.useSemaphorContext(),v=r.enabled??!0,d=(o==null?void 0:o.accessToken)??null,f=(s==null?void 0:s.apiServiceUrl)??null,[y,g]=l.useState(!1),[S,p]=l.useState(!1),[m,n]=l.useState(!1),[j,c]=l.useState(null),[x,w]=l.useState(null),k=x||{tz:((I=(C=s==null?void 0:s.params)==null?void 0:C.calendarContext)==null?void 0:I.tz)||null,weekStart:((D=(P=s==null?void 0:s.params)==null?void 0:P.calendarContext)==null?void 0:D.weekStart)??null},b=l.useCallback(async()=>{if(!(!v||!d||!f)){g(!0),c(null);try{const u=await fetch(`${f}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${d}`}});if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const i=await u.json();w({tz:i.tz,weekStart:i.weekStart,source:i.source,isInherited:i.isInherited,userHasPrefs:i.userHasPrefs,inherited:i.inherited})}catch(u){const i=u instanceof Error?u.message:"Unknown error";c(i)}finally{g(!1)}}},[d,f,v]);l.useEffect(()=>{v&&b()},[v,b]);const T=l.useCallback(async u=>{if(!d||!f)return c("Not authenticated"),!1;p(!0),c(null);try{const i=await fetch(`${f}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify(u)});if(!i.ok){const h=await i.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await b(),!0}catch(i){const h=i instanceof Error?i.message:"Unknown error";return c(h),!1}finally{p(!1)}},[d,f,b]),N=l.useCallback(async()=>{if(!d||!f)return c("Not authenticated"),!1;n(!0),c(null);try{const u=await fetch(`${f}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${d}`}});if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const i=await u.text();if(i)try{const h=JSON.parse(i);return w({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await b(),!0}catch(u){const i=u instanceof Error?u.message:"Unknown error";return c(i),!1}finally{n(!1)}},[d,f,b]);return{preferences:k,isLoading:y,isSaving:S,isClearing:m,error:j,updatePreferences:T,clearPreferences:N,refetch:b}}const A=[{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"}],H=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}];function G(){try{const r=Intl;if(r.supportedValuesOf)return r.supportedValuesOf("timeZone")}catch{}return A.map(r=>r.value)}function V(r){switch(r){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function U(r){const o=A.find(s=>s.value===r);return o?o.label:r}function X(r){const o=H.find(s=>s.value===r);return o?o.label:String(r)}function q({open:r,onOpenChange:o}){var M,z,F;const{preferences:s,isLoading:v,isSaving:d,isClearing:f,updatePreferences:y,clearPreferences:g}=W({enabled:r}),S=s.tz||((M=s.inherited)==null?void 0:M.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,p=s.weekStart??((z=s.inherited)==null?void 0:z.weekStart)??1,[m,n]=l.useState(!s.userHasPrefs),[j,c]=l.useState(!1),[x,w]=l.useState(S),[k,b]=l.useState(p),[T,N]=l.useState(!1),C=l.useMemo(()=>G(),[]),I=l.useMemo(()=>C.filter(t=>!A.some(R=>R.value===t)),[C]),P=l.useMemo(()=>U(x),[x]),D=s.inherited?U(s.inherited.tz):"UTC",u=s.inherited?X(s.inherited.weekStart):"Monday",i=V((F=s.inherited)==null?void 0:F.source);l.useEffect(()=>{if(!r){c(!1);return}j||(s.userHasPrefs!==void 0&&n(!s.userHasPrefs),w(S),b(p))},[r,j,s.userHasPrefs,S,p]);const h=async()=>{if(v){a.ue.error("Preferences are still loading. Please try again.");return}m?await g()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),o(!1)):a.ue.error("Failed to save preferences. Please try again."):await y({tz:x,weekStart:k})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),o(!1)):a.ue.error("Failed to save preferences. Please try again.")},$=()=>{o(!1)},L=d||f,O=L||v;return e.jsx(a.Dialog,{open:r,onOpenChange:o,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=>{c(!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:()=>{c(!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 ",i," defaults"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[D,", Week starts ",u]})]})]}),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:()=>{c(!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:N,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:[P,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:A.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{c(!0),w(t.value),N(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",x===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:I.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{c(!0),w(t),N(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",x===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(k),onValueChange:t=>{c(!0),b(Number(t))},className:"flex gap-4",disabled:m,children:H.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:L,children:"Cancel"}),e.jsx(a.Button,{onClick:h,disabled:O,children:L?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})})}const E=6,B=1,_=20;function Z(r){return Number.isNaN(r)?E:Math.min(_,Math.max(B,r))}function J({open:r,onOpenChange:o,dashboard:s,onApply:v,disabled:d=!1}){const[f,y]=l.useState(!1),[g,S]=l.useState("top"),[p,m]=l.useState(String(E)),n=s.summary;l.useEffect(()=>{r&&(y((n==null?void 0:n.enabled)===!0),S((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??E)))},[r,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const j=l.useMemo(()=>Z(Number.parseInt(p||`${E}`,10)),[p]),c=()=>{v({enabled:f,position:g,maxItems:j}),o(!1)};return e.jsx(a.Dialog,{open:r,onOpenChange:o,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.Switch,{size:"sm",id:"dashboard-summary-enabled",checked:f,disabled:d,onCheckedChange:y})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",children:"Position"}),e.jsxs(a.Select,{value:g,disabled:d,onValueChange:x=>S(x),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:B,max:_,disabled:d,value:p,onChange:x=>m(x.target.value),onBlur:()=>m(String(j))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),d&&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:()=>o(!1),children:"Cancel"}),e.jsx(a.Button,{onClick:c,disabled:d,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=q;exports.DashboardSummarySettingsDialog=J;
|
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
-
import de, { useState as f, useCallback as j, useEffect as K, useMemo as F } from "react";
|
|
3
|
-
import { d as ue, e as q, f as Y, g as Q, h as ee, i as ae, R, b as C, j as $, L as y, P as me, k as he, B as E, l as fe, m as pe, n as ve, o as be, p as Se, q as ge, r as V, s as G, t as X, v as ye, w as re, x as we, y as P, S as xe, z as Ne, A as ke, E as Ce, F as Te, G as Z, I as Ie } from "./index-72yod5pb.js";
|
|
4
|
-
function Pe(s = {}) {
|
|
5
|
-
var I, D, M, L;
|
|
6
|
-
const { authToken: i, tokenProps: r } = ue(), S = s.enabled ?? !0, o = (i == null ? void 0 : i.accessToken) ?? null, h = (r == null ? void 0 : r.apiServiceUrl) ?? null, [N, w] = f(!1), [g, v] = f(!1), [u, n] = f(!1), [x, c] = f(null), [p, k] = f(null), A = p || {
|
|
7
|
-
tz: ((D = (I = r == null ? void 0 : r.params) == null ? void 0 : I.calendarContext) == null ? void 0 : D.tz) || null,
|
|
8
|
-
weekStart: ((L = (M = r == null ? void 0 : r.params) == null ? void 0 : M.calendarContext) == null ? void 0 : L.weekStart) ?? null
|
|
9
|
-
}, b = j(async () => {
|
|
10
|
-
if (!(!S || !o || !h)) {
|
|
11
|
-
w(!0), c(null);
|
|
12
|
-
try {
|
|
13
|
-
const d = await fetch(`${h}/v1/user-preferences/calendar`, {
|
|
14
|
-
method: "GET",
|
|
15
|
-
headers: {
|
|
16
|
-
Authorization: `Bearer ${o}`
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
if (!d.ok) {
|
|
20
|
-
const m = await d.json().catch(() => ({}));
|
|
21
|
-
throw new Error(m.error || "Failed to fetch preferences");
|
|
22
|
-
}
|
|
23
|
-
const l = await d.json();
|
|
24
|
-
k({
|
|
25
|
-
tz: l.tz,
|
|
26
|
-
weekStart: l.weekStart,
|
|
27
|
-
source: l.source,
|
|
28
|
-
isInherited: l.isInherited,
|
|
29
|
-
userHasPrefs: l.userHasPrefs,
|
|
30
|
-
inherited: l.inherited
|
|
31
|
-
});
|
|
32
|
-
} catch (d) {
|
|
33
|
-
const l = d instanceof Error ? d.message : "Unknown error";
|
|
34
|
-
c(l);
|
|
35
|
-
} finally {
|
|
36
|
-
w(!1);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}, [o, h, S]);
|
|
40
|
-
K(() => {
|
|
41
|
-
S && b();
|
|
42
|
-
}, [S, b]);
|
|
43
|
-
const z = j(
|
|
44
|
-
async (d) => {
|
|
45
|
-
if (!o || !h)
|
|
46
|
-
return c("Not authenticated"), !1;
|
|
47
|
-
v(!0), c(null);
|
|
48
|
-
try {
|
|
49
|
-
const l = await fetch(`${h}/v1/user-preferences/calendar`, {
|
|
50
|
-
method: "PATCH",
|
|
51
|
-
headers: {
|
|
52
|
-
"Content-Type": "application/json",
|
|
53
|
-
Authorization: `Bearer ${o}`
|
|
54
|
-
},
|
|
55
|
-
body: JSON.stringify(d)
|
|
56
|
-
});
|
|
57
|
-
if (!l.ok) {
|
|
58
|
-
const m = await l.json().catch(() => ({}));
|
|
59
|
-
throw new Error(m.error || "Failed to update preferences");
|
|
60
|
-
}
|
|
61
|
-
return await b(), !0;
|
|
62
|
-
} catch (l) {
|
|
63
|
-
const m = l instanceof Error ? l.message : "Unknown error";
|
|
64
|
-
return c(m), !1;
|
|
65
|
-
} finally {
|
|
66
|
-
v(!1);
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
[o, h, b]
|
|
70
|
-
), T = j(async () => {
|
|
71
|
-
if (!o || !h)
|
|
72
|
-
return c("Not authenticated"), !1;
|
|
73
|
-
n(!0), c(null);
|
|
74
|
-
try {
|
|
75
|
-
const d = await fetch(`${h}/v1/user-preferences/calendar`, {
|
|
76
|
-
method: "DELETE",
|
|
77
|
-
headers: {
|
|
78
|
-
Authorization: `Bearer ${o}`
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
if (!d.ok) {
|
|
82
|
-
const m = await d.json().catch(() => ({}));
|
|
83
|
-
throw new Error(m.error || "Failed to clear preferences");
|
|
84
|
-
}
|
|
85
|
-
const l = await d.text();
|
|
86
|
-
if (l)
|
|
87
|
-
try {
|
|
88
|
-
const m = JSON.parse(l);
|
|
89
|
-
return k({
|
|
90
|
-
tz: m.tz,
|
|
91
|
-
weekStart: m.weekStart,
|
|
92
|
-
source: m.source,
|
|
93
|
-
isInherited: m.isInherited ?? !0,
|
|
94
|
-
userHasPrefs: !1,
|
|
95
|
-
inherited: m.inherited
|
|
96
|
-
}), !0;
|
|
97
|
-
} catch {
|
|
98
|
-
}
|
|
99
|
-
return await b(), !0;
|
|
100
|
-
} catch (d) {
|
|
101
|
-
const l = d instanceof Error ? d.message : "Unknown error";
|
|
102
|
-
return c(l), !1;
|
|
103
|
-
} finally {
|
|
104
|
-
n(!1);
|
|
105
|
-
}
|
|
106
|
-
}, [o, h, b]);
|
|
107
|
-
return {
|
|
108
|
-
preferences: A,
|
|
109
|
-
isLoading: N,
|
|
110
|
-
isSaving: g,
|
|
111
|
-
isClearing: u,
|
|
112
|
-
error: x,
|
|
113
|
-
updatePreferences: z,
|
|
114
|
-
clearPreferences: T,
|
|
115
|
-
refetch: b
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
const _ = [
|
|
119
|
-
{ value: "America/New_York", label: "Eastern Time (US & Canada)" },
|
|
120
|
-
{ value: "America/Chicago", label: "Central Time (US & Canada)" },
|
|
121
|
-
{ value: "America/Denver", label: "Mountain Time (US & Canada)" },
|
|
122
|
-
{ value: "America/Los_Angeles", label: "Pacific Time (US & Canada)" },
|
|
123
|
-
{ value: "America/Phoenix", label: "Arizona" },
|
|
124
|
-
{ value: "America/Anchorage", label: "Alaska" },
|
|
125
|
-
{ value: "Pacific/Honolulu", label: "Hawaii" },
|
|
126
|
-
{ value: "Europe/London", label: "London" },
|
|
127
|
-
{ value: "Europe/Paris", label: "Paris, Berlin, Rome" },
|
|
128
|
-
{ value: "Asia/Tokyo", label: "Tokyo" },
|
|
129
|
-
{ value: "Asia/Shanghai", label: "Beijing, Shanghai" },
|
|
130
|
-
{ value: "Asia/Kolkata", label: "Mumbai, New Delhi" },
|
|
131
|
-
{ value: "Australia/Sydney", label: "Sydney" },
|
|
132
|
-
{ value: "UTC", label: "UTC" }
|
|
133
|
-
], te = [
|
|
134
|
-
{ value: 0, label: "Sunday" },
|
|
135
|
-
{ value: 1, label: "Monday" },
|
|
136
|
-
{ value: 6, label: "Saturday" }
|
|
137
|
-
];
|
|
138
|
-
function Ee() {
|
|
139
|
-
try {
|
|
140
|
-
const s = Intl;
|
|
141
|
-
if (s.supportedValuesOf)
|
|
142
|
-
return s.supportedValuesOf("timeZone");
|
|
143
|
-
} catch {
|
|
144
|
-
}
|
|
145
|
-
return _.map((s) => s.value);
|
|
146
|
-
}
|
|
147
|
-
function Ae(s) {
|
|
148
|
-
switch (s) {
|
|
149
|
-
case "tenant":
|
|
150
|
-
return "tenant";
|
|
151
|
-
case "organization":
|
|
152
|
-
return "organization";
|
|
153
|
-
case "system":
|
|
154
|
-
return "system";
|
|
155
|
-
default:
|
|
156
|
-
return "default";
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function J(s) {
|
|
160
|
-
const i = _.find((r) => r.value === s);
|
|
161
|
-
return i ? i.label : s;
|
|
162
|
-
}
|
|
163
|
-
function ze(s) {
|
|
164
|
-
const i = te.find((r) => r.value === s);
|
|
165
|
-
return i ? i.label : String(s);
|
|
166
|
-
}
|
|
167
|
-
function Ue({
|
|
168
|
-
open: s,
|
|
169
|
-
onOpenChange: i
|
|
170
|
-
}) {
|
|
171
|
-
var B, O, W;
|
|
172
|
-
const {
|
|
173
|
-
preferences: r,
|
|
174
|
-
isLoading: S,
|
|
175
|
-
isSaving: o,
|
|
176
|
-
isClearing: h,
|
|
177
|
-
updatePreferences: N,
|
|
178
|
-
clearPreferences: w
|
|
179
|
-
} = Pe({ enabled: s }), g = r.tz || ((B = r.inherited) == null ? void 0 : B.tz) || Intl.DateTimeFormat().resolvedOptions().timeZone, v = r.weekStart ?? ((O = r.inherited) == null ? void 0 : O.weekStart) ?? 1, [u, n] = f(!r.userHasPrefs), [x, c] = f(!1), [p, k] = f(
|
|
180
|
-
g
|
|
181
|
-
), [A, b] = f(
|
|
182
|
-
v
|
|
183
|
-
), [z, T] = f(!1), I = F(() => Ee(), []), D = F(
|
|
184
|
-
() => I.filter(
|
|
185
|
-
(t) => !_.some((oe) => oe.value === t)
|
|
186
|
-
),
|
|
187
|
-
[I]
|
|
188
|
-
), M = F(() => J(p), [p]), L = r.inherited ? J(r.inherited.tz) : "UTC", d = r.inherited ? ze(r.inherited.weekStart) : "Monday", l = Ae(
|
|
189
|
-
(W = r.inherited) == null ? void 0 : W.source
|
|
190
|
-
);
|
|
191
|
-
de.useEffect(() => {
|
|
192
|
-
if (!s) {
|
|
193
|
-
c(!1);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
x || (r.userHasPrefs !== void 0 && n(!r.userHasPrefs), k(g), b(v));
|
|
197
|
-
}, [
|
|
198
|
-
s,
|
|
199
|
-
x,
|
|
200
|
-
r.userHasPrefs,
|
|
201
|
-
g,
|
|
202
|
-
v
|
|
203
|
-
]);
|
|
204
|
-
const m = async () => {
|
|
205
|
-
if (S) {
|
|
206
|
-
P.error("Preferences are still loading. Please try again.");
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
u ? await w() ? (P.success(
|
|
210
|
-
"Now using default settings. Please refresh the page to apply changes.",
|
|
211
|
-
{ duration: 5e3 }
|
|
212
|
-
), i(!1)) : P.error("Failed to save preferences. Please try again.") : await N({
|
|
213
|
-
tz: p,
|
|
214
|
-
weekStart: A
|
|
215
|
-
}) ? (P.success(
|
|
216
|
-
"Preferences saved. Please refresh the page to apply changes.",
|
|
217
|
-
{ duration: 5e3 }
|
|
218
|
-
), i(!1)) : P.error("Failed to save preferences. Please try again.");
|
|
219
|
-
}, le = () => {
|
|
220
|
-
i(!1);
|
|
221
|
-
}, H = o || h, ie = H || S;
|
|
222
|
-
return /* @__PURE__ */ e(q, { open: s, onOpenChange: i, children: /* @__PURE__ */ a(Y, { className: "sm:max-w-[425px]", children: [
|
|
223
|
-
/* @__PURE__ */ a(Q, { children: [
|
|
224
|
-
/* @__PURE__ */ e(ee, { children: "Calendar Preferences" }),
|
|
225
|
-
/* @__PURE__ */ e(ae, { children: "Set your timezone and week start preferences for date calculations and displays." })
|
|
226
|
-
] }),
|
|
227
|
-
/* @__PURE__ */ a("div", { className: "space-y-6 py-4", children: [
|
|
228
|
-
/* @__PURE__ */ a(
|
|
229
|
-
R,
|
|
230
|
-
{
|
|
231
|
-
value: u ? "defaults" : "custom",
|
|
232
|
-
onValueChange: (t) => {
|
|
233
|
-
c(!0), n(t === "defaults");
|
|
234
|
-
},
|
|
235
|
-
className: "space-y-3",
|
|
236
|
-
children: [
|
|
237
|
-
/* @__PURE__ */ a(
|
|
238
|
-
"div",
|
|
239
|
-
{
|
|
240
|
-
className: C(
|
|
241
|
-
"flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",
|
|
242
|
-
u ? "border-primary bg-primary/5" : "border-border hover:border-muted-foreground/50"
|
|
243
|
-
),
|
|
244
|
-
onClick: () => {
|
|
245
|
-
c(!0), n(!0);
|
|
246
|
-
},
|
|
247
|
-
children: [
|
|
248
|
-
/* @__PURE__ */ e($, { value: "defaults", id: "mode-defaults" }),
|
|
249
|
-
/* @__PURE__ */ a("div", { className: "flex-1 space-y-1", children: [
|
|
250
|
-
/* @__PURE__ */ a(
|
|
251
|
-
y,
|
|
252
|
-
{
|
|
253
|
-
htmlFor: "mode-defaults",
|
|
254
|
-
className: "cursor-pointer font-medium",
|
|
255
|
-
children: [
|
|
256
|
-
"Use ",
|
|
257
|
-
l,
|
|
258
|
-
" defaults"
|
|
259
|
-
]
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
/* @__PURE__ */ a("p", { className: "text-sm text-muted-foreground", children: [
|
|
263
|
-
L,
|
|
264
|
-
", Week starts ",
|
|
265
|
-
d
|
|
266
|
-
] })
|
|
267
|
-
] })
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
),
|
|
271
|
-
/* @__PURE__ */ a(
|
|
272
|
-
"div",
|
|
273
|
-
{
|
|
274
|
-
className: C(
|
|
275
|
-
"flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",
|
|
276
|
-
u ? "border-border hover:border-muted-foreground/50" : "border-primary bg-primary/5"
|
|
277
|
-
),
|
|
278
|
-
onClick: () => {
|
|
279
|
-
c(!0), n(!1);
|
|
280
|
-
},
|
|
281
|
-
children: [
|
|
282
|
-
/* @__PURE__ */ e($, { value: "custom", id: "mode-custom" }),
|
|
283
|
-
/* @__PURE__ */ e(
|
|
284
|
-
y,
|
|
285
|
-
{
|
|
286
|
-
htmlFor: "mode-custom",
|
|
287
|
-
className: "cursor-pointer font-medium",
|
|
288
|
-
children: "Use custom settings"
|
|
289
|
-
}
|
|
290
|
-
)
|
|
291
|
-
]
|
|
292
|
-
}
|
|
293
|
-
)
|
|
294
|
-
]
|
|
295
|
-
}
|
|
296
|
-
),
|
|
297
|
-
/* @__PURE__ */ a(
|
|
298
|
-
"div",
|
|
299
|
-
{
|
|
300
|
-
className: C(
|
|
301
|
-
"space-y-6 transition-opacity",
|
|
302
|
-
u && "opacity-50 pointer-events-none"
|
|
303
|
-
),
|
|
304
|
-
children: [
|
|
305
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
306
|
-
/* @__PURE__ */ e(y, { children: "Timezone" }),
|
|
307
|
-
/* @__PURE__ */ a(
|
|
308
|
-
me,
|
|
309
|
-
{
|
|
310
|
-
open: z,
|
|
311
|
-
onOpenChange: T,
|
|
312
|
-
modal: !0,
|
|
313
|
-
children: [
|
|
314
|
-
/* @__PURE__ */ e(he, { asChild: !0, children: /* @__PURE__ */ a(
|
|
315
|
-
E,
|
|
316
|
-
{
|
|
317
|
-
variant: "outline",
|
|
318
|
-
role: "combobox",
|
|
319
|
-
"aria-expanded": z,
|
|
320
|
-
className: "w-full justify-between",
|
|
321
|
-
disabled: u,
|
|
322
|
-
children: [
|
|
323
|
-
M,
|
|
324
|
-
/* @__PURE__ */ e(fe, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
) }),
|
|
328
|
-
/* @__PURE__ */ e(
|
|
329
|
-
pe,
|
|
330
|
-
{
|
|
331
|
-
className: "z-50 w-[--radix-popover-trigger-width] p-0",
|
|
332
|
-
align: "start",
|
|
333
|
-
children: /* @__PURE__ */ a(ve, { className: "overflow-visible", children: [
|
|
334
|
-
/* @__PURE__ */ e(be, { placeholder: "Search timezones..." }),
|
|
335
|
-
/* @__PURE__ */ a(Se, { children: [
|
|
336
|
-
/* @__PURE__ */ e(ge, { children: "No timezone found." }),
|
|
337
|
-
/* @__PURE__ */ e(V, { heading: "Common", children: _.map((t) => /* @__PURE__ */ a(
|
|
338
|
-
G,
|
|
339
|
-
{
|
|
340
|
-
value: `${t.value} ${t.label}`,
|
|
341
|
-
onSelect: () => {
|
|
342
|
-
c(!0), k(t.value), T(!1);
|
|
343
|
-
},
|
|
344
|
-
children: [
|
|
345
|
-
/* @__PURE__ */ e(
|
|
346
|
-
X,
|
|
347
|
-
{
|
|
348
|
-
className: C(
|
|
349
|
-
"mr-2 h-4 w-4",
|
|
350
|
-
p === t.value ? "opacity-100" : "opacity-0"
|
|
351
|
-
)
|
|
352
|
-
}
|
|
353
|
-
),
|
|
354
|
-
/* @__PURE__ */ e("span", { className: "flex-1", children: t.label }),
|
|
355
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: t.value })
|
|
356
|
-
]
|
|
357
|
-
},
|
|
358
|
-
t.value
|
|
359
|
-
)) }),
|
|
360
|
-
/* @__PURE__ */ e(ye, {}),
|
|
361
|
-
/* @__PURE__ */ e(V, { heading: "All Timezones", children: D.map((t) => /* @__PURE__ */ a(
|
|
362
|
-
G,
|
|
363
|
-
{
|
|
364
|
-
value: t,
|
|
365
|
-
onSelect: () => {
|
|
366
|
-
c(!0), k(t), T(!1);
|
|
367
|
-
},
|
|
368
|
-
children: [
|
|
369
|
-
/* @__PURE__ */ e(
|
|
370
|
-
X,
|
|
371
|
-
{
|
|
372
|
-
className: C(
|
|
373
|
-
"mr-2 h-4 w-4",
|
|
374
|
-
p === t ? "opacity-100" : "opacity-0"
|
|
375
|
-
)
|
|
376
|
-
}
|
|
377
|
-
),
|
|
378
|
-
t
|
|
379
|
-
]
|
|
380
|
-
},
|
|
381
|
-
t
|
|
382
|
-
)) })
|
|
383
|
-
] })
|
|
384
|
-
] })
|
|
385
|
-
}
|
|
386
|
-
)
|
|
387
|
-
]
|
|
388
|
-
}
|
|
389
|
-
)
|
|
390
|
-
] }),
|
|
391
|
-
/* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
392
|
-
/* @__PURE__ */ e(y, { children: "Week Starts On" }),
|
|
393
|
-
/* @__PURE__ */ e(
|
|
394
|
-
R,
|
|
395
|
-
{
|
|
396
|
-
value: String(A),
|
|
397
|
-
onValueChange: (t) => {
|
|
398
|
-
c(!0), b(Number(t));
|
|
399
|
-
},
|
|
400
|
-
className: "flex gap-4",
|
|
401
|
-
disabled: u,
|
|
402
|
-
children: te.map((t) => /* @__PURE__ */ a(
|
|
403
|
-
"div",
|
|
404
|
-
{
|
|
405
|
-
className: "flex items-center space-x-2",
|
|
406
|
-
children: [
|
|
407
|
-
/* @__PURE__ */ e(
|
|
408
|
-
$,
|
|
409
|
-
{
|
|
410
|
-
value: String(t.value),
|
|
411
|
-
id: `week-start-${t.value}`,
|
|
412
|
-
disabled: u
|
|
413
|
-
}
|
|
414
|
-
),
|
|
415
|
-
/* @__PURE__ */ e(
|
|
416
|
-
y,
|
|
417
|
-
{
|
|
418
|
-
htmlFor: `week-start-${t.value}`,
|
|
419
|
-
className: C(
|
|
420
|
-
"cursor-pointer font-normal",
|
|
421
|
-
u && "cursor-not-allowed"
|
|
422
|
-
),
|
|
423
|
-
children: t.label
|
|
424
|
-
}
|
|
425
|
-
)
|
|
426
|
-
]
|
|
427
|
-
},
|
|
428
|
-
t.value
|
|
429
|
-
))
|
|
430
|
-
}
|
|
431
|
-
)
|
|
432
|
-
] })
|
|
433
|
-
]
|
|
434
|
-
}
|
|
435
|
-
)
|
|
436
|
-
] }),
|
|
437
|
-
/* @__PURE__ */ a(re, { children: [
|
|
438
|
-
/* @__PURE__ */ e(E, { variant: "outline", onClick: le, disabled: H, children: "Cancel" }),
|
|
439
|
-
/* @__PURE__ */ e(E, { onClick: m, disabled: ie, children: H ? /* @__PURE__ */ a(ce, { children: [
|
|
440
|
-
/* @__PURE__ */ e(we, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
441
|
-
"Saving..."
|
|
442
|
-
] }) : "Save" })
|
|
443
|
-
] })
|
|
444
|
-
] }) });
|
|
445
|
-
}
|
|
446
|
-
const U = 6, se = 1, ne = 20;
|
|
447
|
-
function De(s) {
|
|
448
|
-
return Number.isNaN(s) ? U : Math.min(ne, Math.max(se, s));
|
|
449
|
-
}
|
|
450
|
-
function _e({
|
|
451
|
-
open: s,
|
|
452
|
-
onOpenChange: i,
|
|
453
|
-
dashboard: r,
|
|
454
|
-
onApply: S,
|
|
455
|
-
disabled: o = !1
|
|
456
|
-
}) {
|
|
457
|
-
const [h, N] = f(!1), [w, g] = f("top"), [v, u] = f(String(U)), n = r.summary;
|
|
458
|
-
K(() => {
|
|
459
|
-
s && (N((n == null ? void 0 : n.enabled) === !0), g((n == null ? void 0 : n.position) === "bottom" ? "bottom" : "top"), u(String((n == null ? void 0 : n.maxItems) ?? U)));
|
|
460
|
-
}, [s, n == null ? void 0 : n.enabled, n == null ? void 0 : n.position, n == null ? void 0 : n.maxItems]);
|
|
461
|
-
const x = F(
|
|
462
|
-
() => De(Number.parseInt(v || `${U}`, 10)),
|
|
463
|
-
[v]
|
|
464
|
-
);
|
|
465
|
-
return /* @__PURE__ */ e(q, { open: s, onOpenChange: i, children: /* @__PURE__ */ a(Y, { className: "sm:max-w-[420px]", children: [
|
|
466
|
-
/* @__PURE__ */ a(Q, { children: [
|
|
467
|
-
/* @__PURE__ */ e(ee, { children: "Summary Settings" }),
|
|
468
|
-
/* @__PURE__ */ e(ae, { children: "Configure dashboard-level summary display. Card-level summary settings still control which cards contribute." })
|
|
469
|
-
] }),
|
|
470
|
-
/* @__PURE__ */ a("div", { className: "space-y-4 py-2", children: [
|
|
471
|
-
/* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
|
|
472
|
-
/* @__PURE__ */ e(y, { htmlFor: "dashboard-summary-enabled", children: "Enable Dashboard Summary" }),
|
|
473
|
-
/* @__PURE__ */ e(
|
|
474
|
-
xe,
|
|
475
|
-
{
|
|
476
|
-
size: "sm",
|
|
477
|
-
id: "dashboard-summary-enabled",
|
|
478
|
-
checked: h,
|
|
479
|
-
disabled: o,
|
|
480
|
-
onCheckedChange: N
|
|
481
|
-
}
|
|
482
|
-
)
|
|
483
|
-
] }),
|
|
484
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
485
|
-
/* @__PURE__ */ e(y, { htmlFor: "dashboard-summary-position", children: "Position" }),
|
|
486
|
-
/* @__PURE__ */ a(
|
|
487
|
-
Ne,
|
|
488
|
-
{
|
|
489
|
-
value: w,
|
|
490
|
-
disabled: o,
|
|
491
|
-
onValueChange: (p) => g(p),
|
|
492
|
-
children: [
|
|
493
|
-
/* @__PURE__ */ e(ke, { id: "dashboard-summary-position", children: /* @__PURE__ */ e(Ce, { placeholder: "Select position" }) }),
|
|
494
|
-
/* @__PURE__ */ a(Te, { children: [
|
|
495
|
-
/* @__PURE__ */ e(Z, { value: "top", children: "Top" }),
|
|
496
|
-
/* @__PURE__ */ e(Z, { value: "bottom", children: "Bottom" })
|
|
497
|
-
] })
|
|
498
|
-
]
|
|
499
|
-
}
|
|
500
|
-
)
|
|
501
|
-
] }),
|
|
502
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
503
|
-
/* @__PURE__ */ e(y, { htmlFor: "dashboard-summary-max-items", children: "Max Items" }),
|
|
504
|
-
/* @__PURE__ */ e(
|
|
505
|
-
Ie,
|
|
506
|
-
{
|
|
507
|
-
id: "dashboard-summary-max-items",
|
|
508
|
-
type: "number",
|
|
509
|
-
min: se,
|
|
510
|
-
max: ne,
|
|
511
|
-
disabled: o,
|
|
512
|
-
value: v,
|
|
513
|
-
onChange: (p) => u(p.target.value),
|
|
514
|
-
onBlur: () => u(String(x))
|
|
515
|
-
}
|
|
516
|
-
),
|
|
517
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Display limit only. Computation is unchanged." })
|
|
518
|
-
] }),
|
|
519
|
-
o && /* @__PURE__ */ e("p", { className: "text-xs text-amber-700", children: "Enter dashboard edit mode to modify summary settings." })
|
|
520
|
-
] }),
|
|
521
|
-
/* @__PURE__ */ a(re, { children: [
|
|
522
|
-
/* @__PURE__ */ e(E, { variant: "outline", onClick: () => i(!1), children: "Cancel" }),
|
|
523
|
-
/* @__PURE__ */ e(E, { onClick: () => {
|
|
524
|
-
S({
|
|
525
|
-
enabled: h,
|
|
526
|
-
position: w,
|
|
527
|
-
maxItems: x
|
|
528
|
-
}), i(!1);
|
|
529
|
-
}, disabled: o, children: "Apply" })
|
|
530
|
-
] })
|
|
531
|
-
] }) });
|
|
532
|
-
}
|
|
533
|
-
export {
|
|
534
|
-
Ue as C,
|
|
535
|
-
_e as D
|
|
536
|
-
};
|