react-semaphor 0.1.283 → 0.1.284
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-wfMo3T6T.js → dashboard-controls-4pDdG3me.js} +1 -1
- package/dist/chunks/{dashboard-controls-DN8jYCON.js → dashboard-controls-Dhry2k8x.js} +4 -4
- package/dist/chunks/{dashboard-filter-controls-button-zeiatmo1.js → dashboard-filter-controls-button-BZXrmJP2.js} +11 -11
- package/dist/chunks/{dashboard-filter-controls-button-DKc_6T_O.js → dashboard-filter-controls-button-DEUvxIWD.js} +1 -1
- package/dist/chunks/dashboard-json-CYnf5rdp.js +1 -0
- package/dist/chunks/dashboard-json-D-KsLEGl.js +61 -0
- package/dist/chunks/{dashboard-summary-settings-dialog-CWtlFDFP.js → dashboard-summary-settings-dialog-B4jsBFro.js} +15 -15
- package/dist/chunks/{dashboard-summary-settings-dialog-BPyawgMV.js → dashboard-summary-settings-dialog-Cn4-fB2h.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-4nQV1U_c.js → edit-dashboard-visual-BDIt_S2F.js} +4782 -4853
- package/dist/chunks/edit-dashboard-visual-BQnApBvr.js +193 -0
- package/dist/chunks/{index-BHWWNpG6.js → index-DBuN9Zf6.js} +281 -250
- package/dist/chunks/{index-B7kUtCgG.js → index-y1uW2fuZ.js} +30193 -28860
- package/dist/chunks/{resource-management-panel-Dpin6Ffw.js → resource-management-panel-BC-cvjI9.js} +2 -2
- package/dist/chunks/{resource-management-panel-D8xvqypt.js → resource-management-panel-PSvKnmq5.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-XkHgf9f3.js → use-create-flow-overlay-state-COe7Ekru.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-VwKDgVAy.js → use-create-flow-overlay-state-Cr9AFdXx.js} +4 -4
- package/dist/chunks/use-visual-utils-Ccmzx7-m.js +353 -0
- package/dist/chunks/use-visual-utils-DNp8XO6G.js +1 -0
- 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/package.json +3 -2
- package/dist/chunks/dashboard-json-DK_hQ4vs.js +0 -66
- package/dist/chunks/dashboard-json-DyJBSpIU.js +0 -1
- package/dist/chunks/edit-dashboard-visual-0lBlwTCM.js +0 -193
- package/dist/chunks/use-visual-utils-C8YSTPfX.js +0 -1
- package/dist/chunks/use-visual-utils-CBocWNV1.js +0 -347
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DBuN9Zf6.js"),x=require("react");require("react-dom");const P=require("./dashboard-filter-controls-button-DEUvxIWD.js"),_s=require("./date-formatter-CqXdM6JO.js"),Xe=require("./dashboard-summary-settings-dialog-Cn4-fB2h.js"),Us=require("./use-debounced-dirty-check-XHSwAefL.js"),we=require("./normalize-dashboard-for-dirty-check-BXRUMVb2.js"),Ye=require("./use-create-flow-overlay-state-COe7Ekru.js");function Rs(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(o,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return o.default=t,Object.freeze(o)}const C=Rs(x);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e, Fragment as I } from "react/jsx-runtime";
|
|
2
|
-
import { bM as de, dq as qs, u as x, cC as ra, cD as na, B as A, cF as oa, cG as Q, dr as ia, N as qa, b as $,
|
|
2
|
+
import { bM as de, dq as qs, u as x, cC as ra, cD as na, B as A, cF as oa, cG as Q, dr as ia, N as qa, b as $, d as la, ds as Hs, ct as ca, e as da, f as ua, g as ma, h as Ha, L as Qe, I as ce, v as js, a7 as K, dt as we, cK as We, du as Bs, dv as Pa, dw as ja, c as Y, dx as Ba, dy as zs, c$ as ha, dz as Ks, dA as Qs, dB as Ws, dC as Js, dD as Xs, dE as Ys, H as Me, W as Ae, x as k, dF as Le, dG as za, dH as Ka, d8 as Zs, dI as et, w as Z, cJ as J, dJ as at, dK as st, dL as Je, dM as tt, dN as rt, dO as Qa, dP as Wa, dQ as Ce, dR as Ee, d4 as Xe, cP as Ye, dS as Ze, ch as Ja, dT as ea, cc as Xa, dU as nt, cS as Ya, cT as Za, cU as es, cV as as, cW as ss, cX as ts, cY as rs, cZ as aa, dV as ns, cB as ot, dW as it, ag as lt, U as Ua, af as De, dX as ct, am as dt, ah as je, dY as ut, dZ as mt, d_ as ht, aB as pt, d$ as ft, e0 as gt, bT as vt, bU as bt, bV as yt, e1 as Nt, bW as St, cH as xt, at as Dt, e2 as wt, e3 as Ct, dp as Et, e4 as Mt, e5 as At, cE as Lt, a9 as kt, cM as It, e6 as Ot, al as Tt, aa as _t, as as Pt, e7 as Ut } from "./index-y1uW2fuZ.js";
|
|
3
3
|
import * as M from "react";
|
|
4
4
|
import os, { useState as N, useMemo as W, useCallback as Ga, useEffect as Gt } from "react";
|
|
5
5
|
import "react-dom";
|
|
6
|
-
import { b as Rt, u as Ft, d as $t, A as Vt, V as qt, N as Ht, c as jt, D as Bt, U as zt } from "./dashboard-filter-controls-button-
|
|
6
|
+
import { b as Rt, u as Ft, d as $t, A as Vt, V as qt, N as Ht, c as jt, D as Bt, U as zt } from "./dashboard-filter-controls-button-BZXrmJP2.js";
|
|
7
7
|
import { l as Kt } from "./date-formatter-vkCj9Ct-.js";
|
|
8
|
-
import { C as Qt, D as Wt } from "./dashboard-summary-settings-dialog-
|
|
8
|
+
import { C as Qt, D as Wt } from "./dashboard-summary-settings-dialog-B4jsBFro.js";
|
|
9
9
|
import { u as Jt } from "./use-debounced-dirty-check-BwAbnX_5.js";
|
|
10
10
|
import { s as Be } from "./normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
11
|
-
import { S as Ra } from "./use-create-flow-overlay-state-
|
|
11
|
+
import { S as Ra } from "./use-create-flow-overlay-state-Cr9AFdXx.js";
|
|
12
12
|
/**
|
|
13
13
|
* @license lucide-react v0.453.0 - ISC
|
|
14
14
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import ge, { useState as F, useRef as z, useCallback as V, useEffect as T, useContext as be } from "react";
|
|
2
|
-
import { bM as Z, b as $, aC as U, bJ as _, bF as ee, bG as
|
|
2
|
+
import { bM as Z, b as $, aC as U, bJ as _, bF as ee, bG as j, aD as te, bE as Ce, d as ae, e as se, f as re, g as oe, h as ne, L as G, I as we, d8 as ye, v as xe, B as I, w as H, U as R, J as Ne, u as B, K as De, N as X, d9 as Ae, da as K, x as P, b_ as ie, af as Se, c as L, cC as le, cD as de, a6 as ce, cF as ue, cG as M, s as Ee, cK as Ie, ct as Le, M as Fe, db as Te, dc as ke, dd as Ue, cS as Me, cT as Ve, cU as Pe, cV as Be, cW as Oe, cX as ze, cY as Re, as as $e, bL as _e, X as je, de as He, df as Xe, cz as Ge, bH as W, a8 as Ke, aF as We, P as he, j as me, dg as qe, l as pe, dh as Je, di as Ye, dj as Qe, dk as Ze, dl as et, dm as fe, dn as q, dp as tt } from "./index-y1uW2fuZ.js";
|
|
3
3
|
import { jsx as t, jsxs as s, Fragment as O } from "react/jsx-runtime";
|
|
4
|
-
import { V as at, E as st, a as rt, b as ot, L as nt, c as it, d as lt, C as dt, u as ct, e as ut } from "./use-create-flow-overlay-state-
|
|
5
|
-
import { u as ve } from "./use-visual-utils-
|
|
4
|
+
import { V as at, E as st, a as rt, b as ot, L as nt, c as it, d as lt, C as dt, u as ct, e as ut } from "./use-create-flow-overlay-state-Cr9AFdXx.js";
|
|
5
|
+
import { u as ve } from "./use-visual-utils-Ccmzx7-m.js";
|
|
6
6
|
import { k as J } from "./date-formatter-vkCj9Ct-.js";
|
|
7
7
|
/**
|
|
8
8
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -85,7 +85,7 @@ function Tt() {
|
|
|
85
85
|
let g;
|
|
86
86
|
if (i.status === "completed")
|
|
87
87
|
try {
|
|
88
|
-
g = await
|
|
88
|
+
g = await j(h, o, r.id);
|
|
89
89
|
} catch (E) {
|
|
90
90
|
console.error(
|
|
91
91
|
`[useExportPolling] Failed to get download URL for ${r.id}:`,
|
|
@@ -162,7 +162,7 @@ function kt() {
|
|
|
162
162
|
let b;
|
|
163
163
|
if (o.status === "completed")
|
|
164
164
|
try {
|
|
165
|
-
b = await
|
|
165
|
+
b = await j(u, n, o.id);
|
|
166
166
|
} catch (C) {
|
|
167
167
|
console.error(
|
|
168
168
|
`[useExportRecovery] Failed to get download URL for ${o.id}:`,
|
|
@@ -297,7 +297,7 @@ function wt({
|
|
|
297
297
|
}
|
|
298
298
|
),
|
|
299
299
|
/* @__PURE__ */ s(I, { onClick: C, disabled: !b || c, children: [
|
|
300
|
-
c && /* @__PURE__ */ t(
|
|
300
|
+
c && /* @__PURE__ */ t(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
301
301
|
m.actionLabel
|
|
302
302
|
] })
|
|
303
303
|
] })
|
|
@@ -561,7 +561,7 @@ function Vt({
|
|
|
561
561
|
}
|
|
562
562
|
),
|
|
563
563
|
/* @__PURE__ */ t(I, { type: "button", onClick: p, disabled: c, children: c ? /* @__PURE__ */ s(O, { children: [
|
|
564
|
-
/* @__PURE__ */ t(
|
|
564
|
+
/* @__PURE__ */ t(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
565
565
|
"Saving..."
|
|
566
566
|
] }) : o })
|
|
567
567
|
] })
|
|
@@ -587,7 +587,7 @@ function xt({
|
|
|
587
587
|
case "failed":
|
|
588
588
|
return /* @__PURE__ */ t(dt, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" });
|
|
589
589
|
default:
|
|
590
|
-
return /* @__PURE__ */ t(
|
|
590
|
+
return /* @__PURE__ */ t(H, { className: "text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin" });
|
|
591
591
|
}
|
|
592
592
|
}, u = _(e.status), n = (() => {
|
|
593
593
|
switch (e.status) {
|
|
@@ -631,7 +631,7 @@ function xt({
|
|
|
631
631
|
className: "h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",
|
|
632
632
|
onClick: d,
|
|
633
633
|
"aria-label": "Remove notification",
|
|
634
|
-
children: /* @__PURE__ */ t(
|
|
634
|
+
children: /* @__PURE__ */ t(je, { className: "h-4 w-4" })
|
|
635
635
|
}
|
|
636
636
|
)
|
|
637
637
|
] }),
|
|
@@ -646,7 +646,7 @@ function xt({
|
|
|
646
646
|
className: "h-8 bg-transparent",
|
|
647
647
|
onClick: p,
|
|
648
648
|
children: [
|
|
649
|
-
/* @__PURE__ */ t(
|
|
649
|
+
/* @__PURE__ */ t(He, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
650
650
|
"Download"
|
|
651
651
|
]
|
|
652
652
|
}
|
|
@@ -681,7 +681,7 @@ function Nt() {
|
|
|
681
681
|
let i;
|
|
682
682
|
if (r.status === "completed")
|
|
683
683
|
try {
|
|
684
|
-
i = await
|
|
684
|
+
i = await j(
|
|
685
685
|
f,
|
|
686
686
|
y,
|
|
687
687
|
w.id
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const v=require("react"),e=require("./index-
|
|
1
|
+
"use strict";const v=require("react"),e=require("./index-DBuN9Zf6.js"),t=require("react/jsx-runtime"),I=require("./use-create-flow-overlay-state-COe7Ekru.js"),k=require("./use-visual-utils-DNp8XO6G.js"),L=require("./date-formatter-CqXdM6JO.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),r=require("react"),s=require("./index-DBuN9Zf6.js");require("react-dom");function b(){const t=s.useDashboardStore(e=>e.dashboard),i=s.useDashboardStore(e=>e.actions.setDashboard),h=s.useDashboardStore(e=>e.showDashboardJSON),u=s.useDashboardStore(e=>e.actions.setShowDashboardJSON),a=r.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,d]=r.useState(a),n=r.useRef(a);return r.useEffect(()=>{a!==n.current&&(d(a),n.current=a)},[a]),o.jsxs("div",{className:s.cn("relative p-2",{hidden:!h}),children:[o.jsxs(s.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>u(!1),children:[o.jsx(s.X,{className:"mr-2 h-4 w-4"}),"Close"]}),o.jsx("div",{className:"h-[550px] overflow-hidden",children:o.jsx(s.CodeEditor,{value:l,onValueChange:e=>{d(e);try{const c=JSON.parse(e);n.current=JSON.stringify(c,null,2),i(c)}catch{}},language:"json"})})]})}exports.default=b;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as b, useState as f, useRef as m, useEffect as S } from "react";
|
|
3
|
+
import { u as e, c as N, B as D, X as p, C as J } from "./index-y1uW2fuZ.js";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
function x() {
|
|
6
|
+
const o = e((s) => s.dashboard), i = e((s) => s.actions.setDashboard), h = e(
|
|
7
|
+
(s) => s.showDashboardJSON
|
|
8
|
+
), l = e(
|
|
9
|
+
(s) => s.actions.setShowDashboardJSON
|
|
10
|
+
), a = b(
|
|
11
|
+
() => o ? JSON.stringify(o, null, 2) : "",
|
|
12
|
+
[o]
|
|
13
|
+
), [u, n] = f(a), r = m(a);
|
|
14
|
+
return S(() => {
|
|
15
|
+
a !== r.current && (n(a), r.current = a);
|
|
16
|
+
}, [a]), /* @__PURE__ */ c(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: N("relative p-2", {
|
|
20
|
+
hidden: !h
|
|
21
|
+
}),
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ c(
|
|
24
|
+
D,
|
|
25
|
+
{
|
|
26
|
+
variant: "secondary",
|
|
27
|
+
size: "sm",
|
|
28
|
+
className: "absolute right-2 top-2 z-10 h-8",
|
|
29
|
+
onClick: () => l(!1),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ t(p, { className: "mr-2 h-4 w-4" }),
|
|
32
|
+
"Close"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ t("div", { className: "h-[550px] overflow-hidden", children: /* @__PURE__ */ t(
|
|
37
|
+
J,
|
|
38
|
+
{
|
|
39
|
+
value: u,
|
|
40
|
+
onValueChange: (s) => {
|
|
41
|
+
n(s);
|
|
42
|
+
try {
|
|
43
|
+
const d = JSON.parse(s);
|
|
44
|
+
r.current = JSON.stringify(
|
|
45
|
+
d,
|
|
46
|
+
null,
|
|
47
|
+
2
|
|
48
|
+
), i(d);
|
|
49
|
+
} catch {
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
language: "json"
|
|
53
|
+
}
|
|
54
|
+
) })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
x as default
|
|
61
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as ce } from "react/jsx-runtime";
|
|
2
2
|
import de, { useState as f, useCallback as j, useEffect as K, useMemo as F } from "react";
|
|
3
|
-
import { b as ue,
|
|
3
|
+
import { b as ue, d as q, e as Y, f as Q, g as ee, h as ae, R, c as C, i as $, L as y, P as me, j as he, B as E, k as fe, l as pe, m as ve, n as be, o as Se, p as ge, q as V, r as G, s as X, t as ye, v as re, w as we, x as P, S as xe, y as Ne, z as ke, A as Ce, E as Te, F as Z, I as Ie } from "./index-y1uW2fuZ.js";
|
|
4
4
|
function Pe(s = {}) {
|
|
5
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,
|
|
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
7
|
tz: ((D = (I = r == null ? void 0 : r.params) == null ? void 0 : I.calendarContext) == null ? void 0 : D.tz) || null,
|
|
8
8
|
weekStart: ((L = (M = r == null ? void 0 : r.params) == null ? void 0 : M.calendarContext) == null ? void 0 : L.weekStart) ?? null
|
|
9
9
|
}, b = j(async () => {
|
|
@@ -21,7 +21,7 @@ function Pe(s = {}) {
|
|
|
21
21
|
throw new Error(m.error || "Failed to fetch preferences");
|
|
22
22
|
}
|
|
23
23
|
const l = await d.json();
|
|
24
|
-
|
|
24
|
+
k({
|
|
25
25
|
tz: l.tz,
|
|
26
26
|
weekStart: l.weekStart,
|
|
27
27
|
source: l.source,
|
|
@@ -86,7 +86,7 @@ function Pe(s = {}) {
|
|
|
86
86
|
if (l)
|
|
87
87
|
try {
|
|
88
88
|
const m = JSON.parse(l);
|
|
89
|
-
return
|
|
89
|
+
return k({
|
|
90
90
|
tz: m.tz,
|
|
91
91
|
weekStart: m.weekStart,
|
|
92
92
|
source: m.source,
|
|
@@ -176,7 +176,7 @@ function Ue({
|
|
|
176
176
|
isClearing: h,
|
|
177
177
|
updatePreferences: N,
|
|
178
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,
|
|
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
180
|
g
|
|
181
181
|
), [A, b] = f(
|
|
182
182
|
v
|
|
@@ -193,7 +193,7 @@ function Ue({
|
|
|
193
193
|
c(!1);
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
|
-
x || (r.userHasPrefs !== void 0 && n(!r.userHasPrefs),
|
|
196
|
+
x || (r.userHasPrefs !== void 0 && n(!r.userHasPrefs), k(g), b(v));
|
|
197
197
|
}, [
|
|
198
198
|
s,
|
|
199
199
|
x,
|
|
@@ -237,7 +237,7 @@ function Ue({
|
|
|
237
237
|
/* @__PURE__ */ a(
|
|
238
238
|
"div",
|
|
239
239
|
{
|
|
240
|
-
className:
|
|
240
|
+
className: C(
|
|
241
241
|
"flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",
|
|
242
242
|
u ? "border-primary bg-primary/5" : "border-border hover:border-muted-foreground/50"
|
|
243
243
|
),
|
|
@@ -271,7 +271,7 @@ function Ue({
|
|
|
271
271
|
/* @__PURE__ */ a(
|
|
272
272
|
"div",
|
|
273
273
|
{
|
|
274
|
-
className:
|
|
274
|
+
className: C(
|
|
275
275
|
"flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",
|
|
276
276
|
u ? "border-border hover:border-muted-foreground/50" : "border-primary bg-primary/5"
|
|
277
277
|
),
|
|
@@ -297,7 +297,7 @@ function Ue({
|
|
|
297
297
|
/* @__PURE__ */ a(
|
|
298
298
|
"div",
|
|
299
299
|
{
|
|
300
|
-
className:
|
|
300
|
+
className: C(
|
|
301
301
|
"space-y-6 transition-opacity",
|
|
302
302
|
u && "opacity-50 pointer-events-none"
|
|
303
303
|
),
|
|
@@ -339,13 +339,13 @@ function Ue({
|
|
|
339
339
|
{
|
|
340
340
|
value: `${t.value} ${t.label}`,
|
|
341
341
|
onSelect: () => {
|
|
342
|
-
c(!0),
|
|
342
|
+
c(!0), k(t.value), T(!1);
|
|
343
343
|
},
|
|
344
344
|
children: [
|
|
345
345
|
/* @__PURE__ */ e(
|
|
346
346
|
X,
|
|
347
347
|
{
|
|
348
|
-
className:
|
|
348
|
+
className: C(
|
|
349
349
|
"mr-2 h-4 w-4",
|
|
350
350
|
p === t.value ? "opacity-100" : "opacity-0"
|
|
351
351
|
)
|
|
@@ -363,13 +363,13 @@ function Ue({
|
|
|
363
363
|
{
|
|
364
364
|
value: t,
|
|
365
365
|
onSelect: () => {
|
|
366
|
-
c(!0),
|
|
366
|
+
c(!0), k(t), T(!1);
|
|
367
367
|
},
|
|
368
368
|
children: [
|
|
369
369
|
/* @__PURE__ */ e(
|
|
370
370
|
X,
|
|
371
371
|
{
|
|
372
|
-
className:
|
|
372
|
+
className: C(
|
|
373
373
|
"mr-2 h-4 w-4",
|
|
374
374
|
p === t ? "opacity-100" : "opacity-0"
|
|
375
375
|
)
|
|
@@ -416,7 +416,7 @@ function Ue({
|
|
|
416
416
|
y,
|
|
417
417
|
{
|
|
418
418
|
htmlFor: `week-start-${t.value}`,
|
|
419
|
-
className:
|
|
419
|
+
className: C(
|
|
420
420
|
"cursor-pointer font-normal",
|
|
421
421
|
u && "cursor-not-allowed"
|
|
422
422
|
),
|
|
@@ -490,7 +490,7 @@ function _e({
|
|
|
490
490
|
disabled: o,
|
|
491
491
|
onValueChange: (p) => g(p),
|
|
492
492
|
children: [
|
|
493
|
-
/* @__PURE__ */ e(
|
|
493
|
+
/* @__PURE__ */ e(ke, { id: "dashboard-summary-position", children: /* @__PURE__ */ e(Ce, { placeholder: "Select position" }) }),
|
|
494
494
|
/* @__PURE__ */ a(Te, { children: [
|
|
495
495
|
/* @__PURE__ */ e(Z, { value: "top", children: "Top" }),
|
|
496
496
|
/* @__PURE__ */ e(Z, { value: "bottom", children: "Bottom" })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-BHWWNpG6.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
|
+
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-DBuN9Zf6.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;
|