react-semaphor 0.1.261 → 0.1.263
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-BYi_r2lH.js → dashboard-controls-DVMSiuTb.js} +781 -791
- package/dist/chunks/dashboard-controls-JZ-mgUSY.js +42 -0
- package/dist/chunks/{dashboard-filter-controls-button-BPCw1GMh.js → dashboard-filter-controls-button-ClYx7NdN.js} +3 -3
- package/dist/chunks/{dashboard-filter-controls-button-f4pDkDUL.js → dashboard-filter-controls-button-CnijsTUC.js} +1 -1
- package/dist/chunks/{dashboard-json-Dpy-zKf2.js → dashboard-json-BILMCUhG.js} +1 -1
- package/dist/chunks/{dashboard-json-2NJCXsDD.js → dashboard-json-CKWfqC0m.js} +1 -1
- package/dist/chunks/dashboard-summary-settings-dialog-5JMWm5zV.js +1 -0
- package/dist/chunks/dashboard-summary-settings-dialog-6SEdlbOP.js +535 -0
- package/dist/chunks/{edit-dashboard-visual-CqTlmuYL.js → edit-dashboard-visual-BjU_0_QA.js} +890 -884
- package/dist/chunks/{edit-dashboard-visual-Bon08erH.js → edit-dashboard-visual-DPqnhyq1.js} +5 -5
- package/dist/chunks/index-BUNYVJ8g.js +1114 -0
- package/dist/chunks/{index-C2c-_lPE.js → index-D2dG8YFx.js} +29265 -29226
- package/dist/chunks/{resource-management-panel-BtLPW2b4.js → resource-management-panel-BAytqOVf.js} +1 -1
- package/dist/chunks/{resource-management-panel-Bva2_0OU.js → resource-management-panel-I5Q6TQbc.js} +2 -2
- package/dist/chunks/{use-create-flow-overlay-state-Vyd5mSnf.js → use-create-flow-overlay-state-CPUI4zrE.js} +2 -2
- package/dist/chunks/{use-create-flow-overlay-state-9X7GyUzl.js → use-create-flow-overlay-state-DakZJeCH.js} +1 -1
- package/dist/chunks/{use-visual-utils-OPk_1t4I.js → use-visual-utils-B_9CT1PY.js} +1 -1
- package/dist/chunks/{use-visual-utils-Jv4hWSLm.js → use-visual-utils-Cd9d6nnp.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/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-0hbftZxY.js +0 -42
- package/dist/chunks/dashboard-summary-settings-dialog-B9zRCvc-.js +0 -544
- package/dist/chunks/dashboard-summary-settings-dialog-Be3JilRI.js +0 -1
- package/dist/chunks/index-BoJEr_9F.js +0 -1114
|
@@ -0,0 +1,535 @@
|
|
|
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 { b as ue, e as q, f as Y, g as Q, h as ee, i as ae, R, c as k, j as $, L as y, P as me, k as he, B as E, C 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 Ce, A as ke, E as Te, F as Z, I as Ie } from "./index-D2dG8YFx.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, C] = 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
|
+
C({
|
|
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 C({
|
|
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, C] = 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), C(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: k(
|
|
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: k(
|
|
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: k(
|
|
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), C(t.value), T(!1);
|
|
343
|
+
},
|
|
344
|
+
children: [
|
|
345
|
+
/* @__PURE__ */ e(
|
|
346
|
+
X,
|
|
347
|
+
{
|
|
348
|
+
className: k(
|
|
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), C(t), T(!1);
|
|
367
|
+
},
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ e(
|
|
370
|
+
X,
|
|
371
|
+
{
|
|
372
|
+
className: k(
|
|
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: k(
|
|
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
|
+
id: "dashboard-summary-enabled",
|
|
477
|
+
checked: h,
|
|
478
|
+
disabled: o,
|
|
479
|
+
onCheckedChange: N
|
|
480
|
+
}
|
|
481
|
+
)
|
|
482
|
+
] }),
|
|
483
|
+
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
484
|
+
/* @__PURE__ */ e(y, { htmlFor: "dashboard-summary-position", children: "Position" }),
|
|
485
|
+
/* @__PURE__ */ a(
|
|
486
|
+
Ne,
|
|
487
|
+
{
|
|
488
|
+
value: w,
|
|
489
|
+
disabled: o,
|
|
490
|
+
onValueChange: (p) => g(p),
|
|
491
|
+
children: [
|
|
492
|
+
/* @__PURE__ */ e(Ce, { id: "dashboard-summary-position", children: /* @__PURE__ */ e(ke, { placeholder: "Select position" }) }),
|
|
493
|
+
/* @__PURE__ */ a(Te, { children: [
|
|
494
|
+
/* @__PURE__ */ e(Z, { value: "top", children: "Top" }),
|
|
495
|
+
/* @__PURE__ */ e(Z, { value: "bottom", children: "Bottom" })
|
|
496
|
+
] })
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
] }),
|
|
501
|
+
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
502
|
+
/* @__PURE__ */ e(y, { htmlFor: "dashboard-summary-max-items", children: "Max Items" }),
|
|
503
|
+
/* @__PURE__ */ e(
|
|
504
|
+
Ie,
|
|
505
|
+
{
|
|
506
|
+
id: "dashboard-summary-max-items",
|
|
507
|
+
type: "number",
|
|
508
|
+
min: se,
|
|
509
|
+
max: ne,
|
|
510
|
+
disabled: o,
|
|
511
|
+
value: v,
|
|
512
|
+
onChange: (p) => u(p.target.value),
|
|
513
|
+
onBlur: () => u(String(x))
|
|
514
|
+
}
|
|
515
|
+
),
|
|
516
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Display limit only. Computation is unchanged." })
|
|
517
|
+
] }),
|
|
518
|
+
o && /* @__PURE__ */ e("p", { className: "text-xs text-amber-700", children: "Enter dashboard edit mode to modify summary settings." })
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ a(re, { children: [
|
|
521
|
+
/* @__PURE__ */ e(E, { variant: "outline", onClick: () => i(!1), children: "Cancel" }),
|
|
522
|
+
/* @__PURE__ */ e(E, { onClick: () => {
|
|
523
|
+
S({
|
|
524
|
+
enabled: h,
|
|
525
|
+
position: w,
|
|
526
|
+
maxItems: x
|
|
527
|
+
}), i(!1);
|
|
528
|
+
}, disabled: o, children: "Apply" })
|
|
529
|
+
] })
|
|
530
|
+
] }) });
|
|
531
|
+
}
|
|
532
|
+
export {
|
|
533
|
+
Ue as C,
|
|
534
|
+
_e as D
|
|
535
|
+
};
|