chesai-ui 0.16.10 → 0.16.12
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/components/full-calendar/event-popover.mjs +197 -517
- package/dist/components/full-calendar/index.d.ts +2 -0
- package/dist/components/full-calendar/recurrence-dialog.d.ts +10 -0
- package/dist/components/full-calendar/recurrence-dialog.mjs +386 -0
- package/dist/components/full-calendar/recurrence-select.d.ts +11 -0
- package/dist/components/full-calendar/recurrence-select.mjs +126 -0
- package/dist/components/full-calendar/types.d.ts +6 -0
- package/dist/components/full-calendar/utils.mjs +129 -115
- package/dist/hooks/useRipple.d.ts +107 -0
- package/dist/index.mjs +303 -299
- package/package.json +1 -1
|
@@ -1,220 +1,101 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMediaQuery as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { Switch as De } from "../switch/index.mjs";
|
|
18
|
-
import { Select as ee } from "../select/index.mjs";
|
|
19
|
-
import { NumberInput as te } from "../number-input/index.mjs";
|
|
20
|
-
import { useFullCalendar as Ce } from "./calendar-context.mjs";
|
|
21
|
-
const N = 380, Oe = (s, i) => {
|
|
22
|
-
const o = s.frequency, a = s.interval;
|
|
23
|
-
let d = "";
|
|
24
|
-
if (a > 1 ? d = `Every ${a} ${o === "daily" ? "days" : o === "weekly" ? "weeks" : o === "monthly" ? "months" : "years"}` : d = o === "daily" ? "Daily" : o === "weekly" ? "Weekly" : o === "monthly" ? "Monthly" : "Annually", o === "weekly" && s.daysOfWeek && s.daysOfWeek.length > 0) {
|
|
25
|
-
const k = [
|
|
26
|
-
"Sunday",
|
|
27
|
-
"Monday",
|
|
28
|
-
"Tuesday",
|
|
29
|
-
"Wednesday",
|
|
30
|
-
"Thursday",
|
|
31
|
-
"Friday",
|
|
32
|
-
"Saturday"
|
|
33
|
-
];
|
|
34
|
-
s.daysOfWeek.length === 7 ? d = a > 1 ? `Every ${a} weeks on all days` : "Every day" : s.daysOfWeek.length === 5 && [1, 2, 3, 4, 5].every((y) => s.daysOfWeek.includes(y)) ? d = a > 1 ? `Every ${a} weeks on weekdays` : "Every weekday (Monday to Friday)" : d += ` on ${s.daysOfWeek.map((y) => k[y]).join(", ")}`;
|
|
35
|
-
} else o === "monthly" ? d += ` on day ${i.getDate()}` : o === "yearly" && (d += ` on ${W(i, "MMM d")}`);
|
|
36
|
-
return s.endType === "on_date" && s.until ? d += `, until ${W(s.until, "MMM d, yyyy")}` : s.endType === "after_occurrences" && s.count && (d += `, for ${s.count} occurrences`), d;
|
|
37
|
-
}, A = ({
|
|
38
|
-
checked: s,
|
|
39
|
-
onChange: i,
|
|
40
|
-
label: o,
|
|
41
|
-
children: a
|
|
42
|
-
}) => /* @__PURE__ */ r("div", { className: "flex items-center gap-4 h-10 w-full", children: [
|
|
43
|
-
/* @__PURE__ */ r("label", { className: "flex items-center gap-3 cursor-pointer shrink-0", children: [
|
|
44
|
-
/* @__PURE__ */ r("div", { className: "relative flex items-center justify-center w-5 h-5 shrink-0", children: [
|
|
45
|
-
/* @__PURE__ */ t(
|
|
46
|
-
"input",
|
|
47
|
-
{
|
|
48
|
-
type: "radio",
|
|
49
|
-
className: "peer sr-only",
|
|
50
|
-
checked: s,
|
|
51
|
-
onChange: i
|
|
52
|
-
}
|
|
53
|
-
),
|
|
54
|
-
/* @__PURE__ */ t(
|
|
55
|
-
"div",
|
|
56
|
-
{
|
|
57
|
-
className: X(
|
|
58
|
-
"w-5 h-5 rounded-full border-2 transition-colors",
|
|
59
|
-
s ? "border-primary" : "border-outline-variant hover:border-on-surface-variant"
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
),
|
|
63
|
-
/* @__PURE__ */ t(
|
|
64
|
-
"div",
|
|
65
|
-
{
|
|
66
|
-
className: X(
|
|
67
|
-
"absolute w-2.5 h-2.5 rounded-full bg-primary transition-transform duration-200",
|
|
68
|
-
s ? "scale-100" : "scale-0"
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
] }),
|
|
73
|
-
/* @__PURE__ */ t("span", { className: "text-sm font-medium text-on-surface select-none", children: o })
|
|
74
|
-
] }),
|
|
75
|
-
a && /* @__PURE__ */ t("div", { className: "flex-1 flex items-center", children: a })
|
|
76
|
-
] }), Xe = () => {
|
|
77
|
-
const s = Ce(), {
|
|
1
|
+
import { jsxs as s, jsx as a, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useMediaQuery as Q } from "@uidotdev/usehooks";
|
|
3
|
+
import { useDragControls as U, useMotionValue as E, AnimatePresence as _, motion as q } from "framer-motion";
|
|
4
|
+
import { Clock as J, Repeat as K, X as z, Trash2 as H, GripHorizontal as Z } from "lucide-react";
|
|
5
|
+
import { useRef as $, useState as R, useEffect as Y } from "react";
|
|
6
|
+
import { Button as A } from "../button/index.mjs";
|
|
7
|
+
import { DatePicker as O } from "../date-picker/date-picker.mjs";
|
|
8
|
+
import { IconButton as u } from "../icon-button/index.mjs";
|
|
9
|
+
import { Input as ee } from "../input/index.mjs";
|
|
10
|
+
import { Sheet as te, SheetContent as ae, SheetHeader as re, SheetTitle as ne } from "../sheet/index.mjs";
|
|
11
|
+
import { TimePicker as j } from "../time-picker/index.mjs";
|
|
12
|
+
import { Switch as ie } from "../switch/index.mjs";
|
|
13
|
+
import { useFullCalendar as se } from "./calendar-context.mjs";
|
|
14
|
+
import { RecurrenceSelect as oe } from "./recurrence-select.mjs";
|
|
15
|
+
const f = 380, ye = () => {
|
|
16
|
+
const T = se(), {
|
|
78
17
|
popover: i,
|
|
79
|
-
closePopover:
|
|
80
|
-
draftEvent:
|
|
81
|
-
setDraftEvent:
|
|
82
|
-
onEventCreate:
|
|
83
|
-
onEventUpdate:
|
|
84
|
-
onEventDelete:
|
|
85
|
-
hidePopoverTitle:
|
|
86
|
-
hidePopoverTime:
|
|
87
|
-
hidePopoverRecurrence:
|
|
88
|
-
renderPopoverHeader:
|
|
89
|
-
renderPopoverFooter:
|
|
90
|
-
renderPopoverCustomFields:
|
|
91
|
-
} =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
daysOfWeek: [],
|
|
95
|
-
endType: "never",
|
|
96
|
-
count: 13,
|
|
97
|
-
until: new Date(Date.now() + 720 * 60 * 60 * 1e3)
|
|
98
|
-
});
|
|
99
|
-
K(() => {
|
|
100
|
-
if (!i.isOpen || v || typeof window > "u" || !window.ResizeObserver)
|
|
18
|
+
closePopover: l,
|
|
19
|
+
draftEvent: t,
|
|
20
|
+
setDraftEvent: w,
|
|
21
|
+
onEventCreate: N,
|
|
22
|
+
onEventUpdate: b,
|
|
23
|
+
onEventDelete: y,
|
|
24
|
+
hidePopoverTitle: V,
|
|
25
|
+
hidePopoverTime: W,
|
|
26
|
+
hidePopoverRecurrence: B,
|
|
27
|
+
renderPopoverHeader: D,
|
|
28
|
+
renderPopoverFooter: C,
|
|
29
|
+
renderPopoverCustomFields: k
|
|
30
|
+
} = T, c = Q("(max-width: 768px)"), g = $(null), F = U(), p = E(0), v = E(0), [d, I] = R(450);
|
|
31
|
+
Y(() => {
|
|
32
|
+
if (!i.isOpen || c || typeof window > "u" || !window.ResizeObserver)
|
|
101
33
|
return;
|
|
102
|
-
const e = new ResizeObserver((
|
|
103
|
-
for (const
|
|
104
|
-
|
|
34
|
+
const e = new ResizeObserver((r) => {
|
|
35
|
+
for (const n of r)
|
|
36
|
+
I(n.target.getBoundingClientRect().height);
|
|
105
37
|
});
|
|
106
|
-
return
|
|
107
|
-
}, [i.isOpen,
|
|
108
|
-
if (i.isOpen && !
|
|
109
|
-
const
|
|
38
|
+
return g.current && e.observe(g.current), () => e.disconnect();
|
|
39
|
+
}, [i.isOpen, c]), Y(() => {
|
|
40
|
+
if (i.isOpen && !c) {
|
|
41
|
+
const r = window.innerWidth, n = window.innerHeight;
|
|
110
42
|
if (i.anchorRect) {
|
|
111
|
-
let
|
|
112
|
-
|
|
43
|
+
let h = i.anchorRect.right + 16, m = i.anchorRect.top;
|
|
44
|
+
h + f > r && (h = i.anchorRect.left - f - 16), m + d > n && (m = n - d - 16), h = Math.max(
|
|
113
45
|
16,
|
|
114
|
-
Math.min(
|
|
115
|
-
),
|
|
46
|
+
Math.min(h, r - f - 16)
|
|
47
|
+
), m = Math.max(
|
|
116
48
|
16,
|
|
117
|
-
Math.min(
|
|
118
|
-
),
|
|
49
|
+
Math.min(m, n - d - 16)
|
|
50
|
+
), p.set(h), v.set(m);
|
|
119
51
|
} else
|
|
120
|
-
|
|
52
|
+
p.set(r / 2 - f / 2), v.set(n / 2 - d / 2);
|
|
121
53
|
}
|
|
122
|
-
}, [i.isOpen, i.anchorRect,
|
|
123
|
-
const [
|
|
124
|
-
if (!
|
|
125
|
-
const e = new Date(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
54
|
+
}, [i.isOpen, i.anchorRect, c, d, p, v]);
|
|
55
|
+
const [X, G] = R(1), P = async () => {
|
|
56
|
+
if (!t) return;
|
|
57
|
+
const e = new Date(t.start);
|
|
58
|
+
t.isAllDay ? e.setHours(0, 0, 0, 0) : e.setHours(
|
|
59
|
+
t.start.getHours(),
|
|
60
|
+
t.start.getMinutes(),
|
|
129
61
|
0,
|
|
130
62
|
0
|
|
131
63
|
);
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
64
|
+
const r = new Date(t.end);
|
|
65
|
+
t.isAllDay ? r.setHours(23, 59, 59, 999) : r.setHours(
|
|
66
|
+
t.end.getHours(),
|
|
67
|
+
t.end.getMinutes(),
|
|
136
68
|
0,
|
|
137
69
|
0
|
|
138
70
|
);
|
|
139
|
-
const
|
|
140
|
-
...
|
|
71
|
+
const n = {
|
|
72
|
+
...t,
|
|
141
73
|
start: e,
|
|
142
|
-
end:
|
|
143
|
-
title:
|
|
74
|
+
end: r,
|
|
75
|
+
title: t.title || "(No title)"
|
|
144
76
|
};
|
|
145
|
-
delete
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
if (!
|
|
153
|
-
const
|
|
154
|
-
return { ...
|
|
155
|
-
});
|
|
156
|
-
}, F = a ? [
|
|
157
|
-
{ value: "none", label: "Does not repeat" },
|
|
158
|
-
{ value: "daily", label: "Daily" },
|
|
159
|
-
{
|
|
160
|
-
value: "weekly",
|
|
161
|
-
label: `Weekly on ${W(a.start, "EEEE")}`
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
value: "monthly",
|
|
165
|
-
label: `Monthly on the ${a.start.getDate()}`
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
value: "yearly",
|
|
169
|
-
label: `Annually on ${W(a.start, "MMM d")}`
|
|
170
|
-
},
|
|
171
|
-
{ value: "weekdays", label: "Every weekday (Monday to Friday)" }
|
|
172
|
-
] : [];
|
|
173
|
-
let h = "none";
|
|
174
|
-
if (a?.recurrence) {
|
|
175
|
-
const e = a.recurrence;
|
|
176
|
-
e.interval === 1 && e.endType === "never" && (e.frequency === "daily" ? h = "daily" : e.frequency === "weekly" && e.daysOfWeek?.length === 1 && e.daysOfWeek[0] === a.start.getDay() ? h = "weekly" : e.frequency === "weekly" && e.daysOfWeek?.length === 5 && [1, 2, 3, 4, 5].every((n) => e.daysOfWeek.includes(n)) ? h = "weekdays" : e.frequency === "monthly" ? h = "monthly" : e.frequency === "yearly" && (h = "yearly")), h === "none" && (h = "custom_active", F.push({
|
|
177
|
-
value: "custom_active",
|
|
178
|
-
label: Oe(e, a.start)
|
|
179
|
-
}));
|
|
180
|
-
}
|
|
181
|
-
F.push({ value: "custom", label: "Custom..." });
|
|
182
|
-
const ce = (e) => {
|
|
183
|
-
e === "none" ? m({ recurrence: void 0 }) : e === "custom" ? (u(
|
|
184
|
-
a?.recurrence || {
|
|
185
|
-
frequency: "weekly",
|
|
186
|
-
interval: 1,
|
|
187
|
-
daysOfWeek: [a?.start?.getDay() || 0],
|
|
188
|
-
endType: "never",
|
|
189
|
-
count: 13,
|
|
190
|
-
until: new Date(Date.now() + 720 * 60 * 60 * 1e3)
|
|
191
|
-
}
|
|
192
|
-
), O(!0)) : e === "weekdays" ? m({
|
|
193
|
-
recurrence: {
|
|
194
|
-
frequency: "weekly",
|
|
195
|
-
interval: 1,
|
|
196
|
-
endType: "never",
|
|
197
|
-
daysOfWeek: [1, 2, 3, 4, 5]
|
|
198
|
-
}
|
|
199
|
-
}) : e !== "custom_active" && m({
|
|
200
|
-
recurrence: {
|
|
201
|
-
frequency: e,
|
|
202
|
-
interval: 1,
|
|
203
|
-
endType: "never",
|
|
204
|
-
daysOfWeek: e === "weekly" ? [a?.start?.getDay() || 0] : void 0
|
|
205
|
-
}
|
|
77
|
+
delete n.isDraft, i.mode === "create" && N ? await N(n) : i.mode === "edit" && b && await b(n), l();
|
|
78
|
+
}, M = async () => {
|
|
79
|
+
t?.id && y && await y(t.id), l();
|
|
80
|
+
}, o = (e) => {
|
|
81
|
+
w((r) => r ? { ...r, ...e } : null);
|
|
82
|
+
}, x = (e) => {
|
|
83
|
+
w((r) => {
|
|
84
|
+
if (!r) return null;
|
|
85
|
+
const n = e.data !== void 0 ? { ...r.data || {}, ...e.data } : r.data;
|
|
86
|
+
return { ...r, ...e, data: n };
|
|
206
87
|
});
|
|
207
88
|
};
|
|
208
|
-
if (!
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
!
|
|
212
|
-
|
|
89
|
+
if (!t) return null;
|
|
90
|
+
const S = /* @__PURE__ */ s("div", { className: "flex flex-col gap-6 p-6 font-manrope text-on-surface min-w-[340px]", children: [
|
|
91
|
+
D && /* @__PURE__ */ a("div", { className: "flex flex-col gap-4", children: D(t, x) }),
|
|
92
|
+
!V && /* @__PURE__ */ a("div", { className: "pl-10 pr-2", children: /* @__PURE__ */ a(
|
|
93
|
+
ee,
|
|
213
94
|
{
|
|
214
95
|
variant: "underlined",
|
|
215
96
|
placeholder: "Add title",
|
|
216
|
-
value:
|
|
217
|
-
onChange: (e) =>
|
|
97
|
+
value: t.title,
|
|
98
|
+
onChange: (e) => o({ title: e.target.value }),
|
|
218
99
|
autoFocus: !0,
|
|
219
100
|
className: "shadow-none px-0",
|
|
220
101
|
classNames: {
|
|
@@ -223,91 +104,91 @@ const N = 380, Oe = (s, i) => {
|
|
|
223
104
|
}
|
|
224
105
|
}
|
|
225
106
|
) }),
|
|
226
|
-
!
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
107
|
+
!W && /* @__PURE__ */ s("div", { className: "flex items-start gap-4", children: [
|
|
108
|
+
/* @__PURE__ */ a(J, { className: "w-5 h-5 mt-2.5 text-on-surface-variant shrink-0" }),
|
|
109
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-3 w-full min-w-0", children: [
|
|
110
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 w-full", children: [
|
|
111
|
+
/* @__PURE__ */ a(
|
|
112
|
+
O,
|
|
232
113
|
{
|
|
233
114
|
variant: "docked",
|
|
234
115
|
inputVariant: "filled",
|
|
235
116
|
size: "sm",
|
|
236
117
|
shape: "full",
|
|
237
|
-
value:
|
|
118
|
+
value: t.start,
|
|
238
119
|
onChange: (e) => {
|
|
239
120
|
if (!e) return;
|
|
240
|
-
const
|
|
241
|
-
|
|
121
|
+
const r = new Date(t.start);
|
|
122
|
+
r.setFullYear(
|
|
242
123
|
e.getFullYear(),
|
|
243
124
|
e.getMonth(),
|
|
244
125
|
e.getDate()
|
|
245
126
|
);
|
|
246
|
-
let
|
|
247
|
-
|
|
127
|
+
let n = new Date(t.end);
|
|
128
|
+
t.isAllDay ? t.end < r && n.setFullYear(
|
|
248
129
|
e.getFullYear(),
|
|
249
130
|
e.getMonth(),
|
|
250
131
|
e.getDate()
|
|
251
|
-
) :
|
|
132
|
+
) : n.setFullYear(
|
|
252
133
|
e.getFullYear(),
|
|
253
134
|
e.getMonth(),
|
|
254
135
|
e.getDate()
|
|
255
|
-
),
|
|
136
|
+
), o({ start: r, end: n });
|
|
256
137
|
}
|
|
257
138
|
}
|
|
258
139
|
),
|
|
259
|
-
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
|
|
140
|
+
t.isAllDay && /* @__PURE__ */ s(L, { children: [
|
|
141
|
+
/* @__PURE__ */ a("span", { className: "text-on-surface-variant shrink-0", children: "-" }),
|
|
142
|
+
/* @__PURE__ */ a(
|
|
143
|
+
O,
|
|
263
144
|
{
|
|
264
145
|
variant: "docked",
|
|
265
146
|
inputVariant: "filled",
|
|
266
147
|
size: "sm",
|
|
267
148
|
shape: "full",
|
|
268
|
-
value:
|
|
149
|
+
value: t.end,
|
|
269
150
|
onChange: (e) => {
|
|
270
151
|
if (!e) return;
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
152
|
+
const r = new Date(t.end);
|
|
153
|
+
if (r.setFullYear(
|
|
273
154
|
e.getFullYear(),
|
|
274
155
|
e.getMonth(),
|
|
275
156
|
e.getDate()
|
|
276
|
-
),
|
|
277
|
-
const
|
|
278
|
-
|
|
157
|
+
), o({ end: r }), t.start > r) {
|
|
158
|
+
const n = new Date(t.start);
|
|
159
|
+
n.setFullYear(
|
|
279
160
|
e.getFullYear(),
|
|
280
161
|
e.getMonth(),
|
|
281
162
|
e.getDate()
|
|
282
|
-
),
|
|
163
|
+
), o({ start: n });
|
|
283
164
|
}
|
|
284
165
|
}
|
|
285
166
|
}
|
|
286
167
|
)
|
|
287
168
|
] })
|
|
288
169
|
] }),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
|
|
170
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2 mt-1 w-fit", children: [
|
|
171
|
+
/* @__PURE__ */ a(
|
|
172
|
+
ie,
|
|
292
173
|
{
|
|
293
174
|
id: "all-day-switch",
|
|
294
175
|
size: "sm",
|
|
295
|
-
checked: !!
|
|
176
|
+
checked: !!t.isAllDay,
|
|
296
177
|
onCheckedChange: (e) => {
|
|
297
178
|
if (e)
|
|
298
|
-
|
|
179
|
+
o({ isAllDay: e });
|
|
299
180
|
else {
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
),
|
|
181
|
+
const r = new Date(t.end);
|
|
182
|
+
r.setFullYear(
|
|
183
|
+
t.start.getFullYear(),
|
|
184
|
+
t.start.getMonth(),
|
|
185
|
+
t.start.getDate()
|
|
186
|
+
), o({ isAllDay: e, end: r });
|
|
306
187
|
}
|
|
307
188
|
}
|
|
308
189
|
}
|
|
309
190
|
),
|
|
310
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ a(
|
|
311
192
|
"label",
|
|
312
193
|
{
|
|
313
194
|
htmlFor: "all-day-switch",
|
|
@@ -316,298 +197,101 @@ const N = 380, Oe = (s, i) => {
|
|
|
316
197
|
}
|
|
317
198
|
)
|
|
318
199
|
] }),
|
|
319
|
-
!
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
|
|
200
|
+
!t.isAllDay && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 w-full mt-1", children: [
|
|
201
|
+
/* @__PURE__ */ a(
|
|
202
|
+
j,
|
|
322
203
|
{
|
|
323
204
|
variant: "docked",
|
|
324
205
|
inputVariant: "filled",
|
|
325
206
|
size: "sm",
|
|
326
207
|
shape: "full",
|
|
327
|
-
value:
|
|
328
|
-
onChange: (e) =>
|
|
208
|
+
value: t.start,
|
|
209
|
+
onChange: (e) => o({ start: e })
|
|
329
210
|
}
|
|
330
211
|
),
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
|
|
212
|
+
/* @__PURE__ */ a("span", { className: "text-on-surface-variant shrink-0", children: "-" }),
|
|
213
|
+
/* @__PURE__ */ a(
|
|
214
|
+
j,
|
|
334
215
|
{
|
|
335
216
|
variant: "docked",
|
|
336
217
|
inputVariant: "filled",
|
|
337
218
|
size: "sm",
|
|
338
219
|
shape: "full",
|
|
339
|
-
value:
|
|
340
|
-
onChange: (e) =>
|
|
220
|
+
value: t.end,
|
|
221
|
+
onChange: (e) => o({ end: e })
|
|
341
222
|
}
|
|
342
223
|
)
|
|
343
224
|
] })
|
|
344
225
|
] })
|
|
345
226
|
] }),
|
|
346
|
-
!
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
|
|
227
|
+
!B && /* @__PURE__ */ s("div", { className: "flex items-center gap-4 mt-2", children: [
|
|
228
|
+
/* @__PURE__ */ a(K, { className: "w-5 h-5 text-on-surface-variant shrink-0" }),
|
|
229
|
+
/* @__PURE__ */ a("div", { className: "w-full", children: /* @__PURE__ */ a(
|
|
230
|
+
oe,
|
|
350
231
|
{
|
|
351
232
|
variant: "filled",
|
|
352
233
|
size: "sm",
|
|
353
234
|
shape: "full",
|
|
354
|
-
value:
|
|
355
|
-
|
|
356
|
-
|
|
235
|
+
value: t.recurrence,
|
|
236
|
+
onChange: (e) => o({ recurrence: e }),
|
|
237
|
+
startDate: t.start
|
|
357
238
|
}
|
|
358
239
|
) })
|
|
359
240
|
] }),
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
] })
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
initial: { opacity: 0, scale: 0.95 },
|
|
378
|
-
animate: { opacity: 1, scale: 1 },
|
|
379
|
-
exit: { opacity: 0, scale: 0.95 },
|
|
380
|
-
transition: { duration: 0.2 },
|
|
381
|
-
className: "relative bg-surface-container-high rounded-3xl shadow-2xl p-6 w-full max-w-[420px] flex flex-col gap-6",
|
|
382
|
-
children: [
|
|
383
|
-
/* @__PURE__ */ t(b, { variant: "title-medium", className: "font-bold", children: "Custom recurrence" }),
|
|
384
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
385
|
-
/* @__PURE__ */ t(
|
|
386
|
-
b,
|
|
387
|
-
{
|
|
388
|
-
variant: "body-medium",
|
|
389
|
-
className: "shrink-0 w-24 font-medium",
|
|
390
|
-
children: "Repeat every"
|
|
391
|
-
}
|
|
392
|
-
),
|
|
393
|
-
/* @__PURE__ */ t("div", { className: "w-20", children: /* @__PURE__ */ t(
|
|
394
|
-
te,
|
|
395
|
-
{
|
|
396
|
-
size: "sm",
|
|
397
|
-
variant: "filled",
|
|
398
|
-
value: c.interval,
|
|
399
|
-
onValueChange: (e) => u((n) => ({ ...n, interval: Number(e) })),
|
|
400
|
-
min: 1,
|
|
401
|
-
classNames: {
|
|
402
|
-
inputWrapper: "h-10 min-h-[40px] px-2",
|
|
403
|
-
input: "text-center"
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
) }),
|
|
407
|
-
/* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(
|
|
408
|
-
ee,
|
|
409
|
-
{
|
|
410
|
-
size: "sm",
|
|
411
|
-
variant: "filled",
|
|
412
|
-
value: c.frequency,
|
|
413
|
-
onValueChange: (e) => u((n) => ({ ...n, frequency: e })),
|
|
414
|
-
items: [
|
|
415
|
-
{
|
|
416
|
-
value: "daily",
|
|
417
|
-
label: c.interval > 1 ? "days" : "day"
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
value: "weekly",
|
|
421
|
-
label: c.interval > 1 ? "weeks" : "week"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
value: "monthly",
|
|
425
|
-
label: c.interval > 1 ? "months" : "month"
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
value: "yearly",
|
|
429
|
-
label: c.interval > 1 ? "years" : "year"
|
|
430
|
-
}
|
|
431
|
-
],
|
|
432
|
-
classNames: { trigger: "h-10 px-3" }
|
|
433
|
-
}
|
|
434
|
-
) })
|
|
435
|
-
] }),
|
|
436
|
-
c.frequency === "weekly" && /* @__PURE__ */ r("div", { className: "flex flex-col gap-2 mt-2", children: [
|
|
437
|
-
/* @__PURE__ */ t(b, { variant: "body-medium", className: "font-medium", children: "Repeat on" }),
|
|
438
|
-
/* @__PURE__ */ t("div", { className: "flex justify-between mt-1 w-full", children: /* @__PURE__ */ t(ge, { shape: "full", gap: "xs", className: "w-full flex", children: ["S", "M", "T", "W", "T", "F", "S"].map((e, n) => {
|
|
439
|
-
const l = c.daysOfWeek?.includes(n);
|
|
440
|
-
return /* @__PURE__ */ t(
|
|
441
|
-
x,
|
|
442
|
-
{
|
|
443
|
-
variant: l ? "primary" : "secondary",
|
|
444
|
-
isActive: l,
|
|
445
|
-
onClick: () => {
|
|
446
|
-
u((p) => {
|
|
447
|
-
const f = p.daysOfWeek || [], G = f.includes(n) ? f.filter((me) => me !== n) : [...f, n];
|
|
448
|
-
return {
|
|
449
|
-
...p,
|
|
450
|
-
daysOfWeek: G.length ? G : [n]
|
|
451
|
-
};
|
|
452
|
-
});
|
|
453
|
-
},
|
|
454
|
-
className: "flex-1 !px-0 min-w-0",
|
|
455
|
-
children: e
|
|
456
|
-
},
|
|
457
|
-
n
|
|
458
|
-
);
|
|
459
|
-
}) }) })
|
|
460
|
-
] }),
|
|
461
|
-
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3 mt-2", children: [
|
|
462
|
-
/* @__PURE__ */ t(b, { variant: "body-medium", className: "font-medium mb-1", children: "Ends" }),
|
|
463
|
-
/* @__PURE__ */ r("div", { className: "flex flex-col gap-4", children: [
|
|
464
|
-
/* @__PURE__ */ t(
|
|
465
|
-
A,
|
|
466
|
-
{
|
|
467
|
-
checked: c.endType === "never",
|
|
468
|
-
onChange: () => u((e) => ({ ...e, endType: "never" })),
|
|
469
|
-
label: "Never"
|
|
470
|
-
}
|
|
471
|
-
),
|
|
472
|
-
/* @__PURE__ */ t(
|
|
473
|
-
A,
|
|
474
|
-
{
|
|
475
|
-
checked: c.endType === "on_date",
|
|
476
|
-
onChange: () => u((e) => ({ ...e, endType: "on_date" })),
|
|
477
|
-
label: "On",
|
|
478
|
-
children: /* @__PURE__ */ t("div", { className: "w-[180px]", children: /* @__PURE__ */ t(
|
|
479
|
-
z,
|
|
480
|
-
{
|
|
481
|
-
variant: "docked",
|
|
482
|
-
inputVariant: "filled",
|
|
483
|
-
size: "sm",
|
|
484
|
-
disabled: c.endType !== "on_date",
|
|
485
|
-
value: c.until,
|
|
486
|
-
onChange: (e) => e && u((n) => ({ ...n, until: e })),
|
|
487
|
-
classNames: { inputWrapper: "h-10 min-h-[40px]" }
|
|
488
|
-
}
|
|
489
|
-
) })
|
|
490
|
-
}
|
|
491
|
-
),
|
|
492
|
-
/* @__PURE__ */ t(
|
|
493
|
-
A,
|
|
494
|
-
{
|
|
495
|
-
checked: c.endType === "after_occurrences",
|
|
496
|
-
onChange: () => u((e) => ({
|
|
497
|
-
...e,
|
|
498
|
-
endType: "after_occurrences"
|
|
499
|
-
})),
|
|
500
|
-
label: "After",
|
|
501
|
-
children: /* @__PURE__ */ r("div", { className: "w-[180px] flex items-center gap-3", children: [
|
|
502
|
-
/* @__PURE__ */ t(
|
|
503
|
-
te,
|
|
504
|
-
{
|
|
505
|
-
variant: "filled",
|
|
506
|
-
size: "sm",
|
|
507
|
-
disabled: c.endType !== "after_occurrences",
|
|
508
|
-
value: c.count,
|
|
509
|
-
onValueChange: (e) => u((n) => ({ ...n, count: Number(e) })),
|
|
510
|
-
min: 1,
|
|
511
|
-
classNames: {
|
|
512
|
-
inputWrapper: "h-10 min-h-[40px] px-2",
|
|
513
|
-
input: "text-center"
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
),
|
|
517
|
-
/* @__PURE__ */ t(
|
|
518
|
-
b,
|
|
519
|
-
{
|
|
520
|
-
variant: "body-medium",
|
|
521
|
-
className: "whitespace-nowrap opacity-80 font-normal",
|
|
522
|
-
children: "occurrences"
|
|
523
|
-
}
|
|
524
|
-
)
|
|
525
|
-
] })
|
|
526
|
-
}
|
|
527
|
-
)
|
|
528
|
-
] })
|
|
241
|
+
k && /* @__PURE__ */ a("div", { className: "mt-2 border-t border-outline-variant/30 pt-4 flex flex-col gap-4", children: k(t, x) }),
|
|
242
|
+
C && /* @__PURE__ */ a("div", { className: "mt-2 border-t border-outline-variant/30 pt-4 flex flex-col gap-4", children: C(t, x) })
|
|
243
|
+
] });
|
|
244
|
+
return i.isOpen ? c ? /* @__PURE__ */ a(
|
|
245
|
+
te,
|
|
246
|
+
{
|
|
247
|
+
open: i.isOpen,
|
|
248
|
+
onOpenChange: (e) => !e && l(),
|
|
249
|
+
forceBottomSheet: !0,
|
|
250
|
+
snapPoints: [0.6, 1],
|
|
251
|
+
activeSnapPoint: X,
|
|
252
|
+
setActiveSnapPoint: G,
|
|
253
|
+
children: /* @__PURE__ */ s(ae, { className: "p-0 flex flex-col overflow-hidden h-full", children: [
|
|
254
|
+
/* @__PURE__ */ s(re, { className: "px-4 py-2 border-b border-outline-variant/20 shrink-0 flex-row justify-between items-center !space-y-0", children: [
|
|
255
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
256
|
+
/* @__PURE__ */ a(u, { variant: "ghost", onClick: l, children: /* @__PURE__ */ a(z, { className: "w-5 h-5" }) }),
|
|
257
|
+
/* @__PURE__ */ a(ne, { className: "text-base font-semibold m-0", children: i.mode === "create" ? "New Event" : "Edit Event" })
|
|
529
258
|
] }),
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
]
|
|
554
|
-
|
|
555
|
-
if (v)
|
|
556
|
-
return /* @__PURE__ */ r(R, { children: [
|
|
557
|
-
/* @__PURE__ */ t(
|
|
558
|
-
we,
|
|
559
|
-
{
|
|
560
|
-
open: i.isOpen,
|
|
561
|
-
onOpenChange: (e) => !e && o(),
|
|
562
|
-
forceBottomSheet: !0,
|
|
563
|
-
snapPoints: [0.6, 1],
|
|
564
|
-
activeSnapPoint: se,
|
|
565
|
-
setActiveSnapPoint: oe,
|
|
566
|
-
children: /* @__PURE__ */ r(be, { className: "p-0 flex flex-col overflow-hidden h-full", children: [
|
|
567
|
-
/* @__PURE__ */ r(Ne, { className: "px-4 py-2 border-b border-outline-variant/20 shrink-0 flex-row justify-between items-center !space-y-0", children: [
|
|
568
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
569
|
-
/* @__PURE__ */ t(w, { variant: "ghost", onClick: o, children: /* @__PURE__ */ t(U, { className: "w-5 h-5" }) }),
|
|
570
|
-
/* @__PURE__ */ t(ke, { className: "text-base font-semibold m-0", children: i.mode === "create" ? "New Event" : "Edit Event" })
|
|
571
|
-
] }),
|
|
572
|
-
i.mode === "edit" && /* @__PURE__ */ t(
|
|
573
|
-
w,
|
|
574
|
-
{
|
|
575
|
-
variant: "ghost",
|
|
576
|
-
size: "sm",
|
|
577
|
-
onClick: j,
|
|
578
|
-
className: "text-error hover:bg-error/10 hover:text-error",
|
|
579
|
-
children: /* @__PURE__ */ t(J, { className: "w-5 h-5" })
|
|
580
|
-
}
|
|
581
|
-
)
|
|
582
|
-
] }),
|
|
583
|
-
/* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto no-scrollbar", children: B }),
|
|
584
|
-
/* @__PURE__ */ t("div", { className: "p-3 border-t border-outline-variant/20 bg-surface-container shrink-0 flex justify-end items-center pb-safe", children: /* @__PURE__ */ t(
|
|
585
|
-
x,
|
|
586
|
-
{
|
|
587
|
-
variant: "primary",
|
|
588
|
-
onClick: $,
|
|
589
|
-
className: "px-8 rounded-full font-bold",
|
|
590
|
-
children: "Save"
|
|
591
|
-
}
|
|
592
|
-
) })
|
|
593
|
-
] })
|
|
594
|
-
}
|
|
595
|
-
),
|
|
596
|
-
typeof document < "u" && P(I, document.body)
|
|
597
|
-
] });
|
|
598
|
-
const de = /* @__PURE__ */ t("div", { className: "fixed inset-0 pointer-events-none z-[50]", children: /* @__PURE__ */ t(Q, { children: i.isOpen && /* @__PURE__ */ r(
|
|
599
|
-
S.div,
|
|
259
|
+
i.mode === "edit" && /* @__PURE__ */ a(
|
|
260
|
+
u,
|
|
261
|
+
{
|
|
262
|
+
variant: "ghost",
|
|
263
|
+
size: "sm",
|
|
264
|
+
onClick: M,
|
|
265
|
+
className: "text-error hover:bg-error/10 hover:text-error",
|
|
266
|
+
children: /* @__PURE__ */ a(H, { className: "w-5 h-5" })
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] }),
|
|
270
|
+
/* @__PURE__ */ a("div", { className: "flex-1 overflow-y-auto no-scrollbar", children: S }),
|
|
271
|
+
/* @__PURE__ */ a("div", { className: "p-3 border-t border-outline-variant/20 bg-surface-container shrink-0 flex justify-end items-center pb-safe", children: /* @__PURE__ */ a(
|
|
272
|
+
A,
|
|
273
|
+
{
|
|
274
|
+
variant: "primary",
|
|
275
|
+
onClick: P,
|
|
276
|
+
className: "px-8 rounded-full font-bold",
|
|
277
|
+
children: "Save"
|
|
278
|
+
}
|
|
279
|
+
) })
|
|
280
|
+
] })
|
|
281
|
+
}
|
|
282
|
+
) : /* @__PURE__ */ a("div", { className: "fixed inset-0 pointer-events-none z-[50]", children: /* @__PURE__ */ a(_, { children: i.isOpen && /* @__PURE__ */ s(
|
|
283
|
+
q.div,
|
|
600
284
|
{
|
|
601
|
-
ref:
|
|
285
|
+
ref: g,
|
|
602
286
|
drag: !0,
|
|
603
287
|
dragMomentum: !1,
|
|
604
|
-
dragControls:
|
|
288
|
+
dragControls: F,
|
|
605
289
|
dragListener: !1,
|
|
606
290
|
style: {
|
|
607
|
-
x:
|
|
608
|
-
y:
|
|
291
|
+
x: p,
|
|
292
|
+
y: v,
|
|
609
293
|
width: "auto",
|
|
610
|
-
minWidth:
|
|
294
|
+
minWidth: f,
|
|
611
295
|
maxWidth: "calc(100vw - 32px)"
|
|
612
296
|
},
|
|
613
297
|
initial: { opacity: 0, scale: 0.95 },
|
|
@@ -616,66 +300,62 @@ const N = 380, Oe = (s, i) => {
|
|
|
616
300
|
transition: { duration: 0.15 },
|
|
617
301
|
className: "absolute bg-surface-container-high border border-outline-variant/50 rounded-2xl shadow-2xl pointer-events-auto flex flex-col h-auto max-h-[90vh]",
|
|
618
302
|
children: [
|
|
619
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ s(
|
|
620
304
|
"div",
|
|
621
305
|
{
|
|
622
306
|
onPointerDown: (e) => {
|
|
623
|
-
e.stopPropagation(),
|
|
307
|
+
e.stopPropagation(), F.start(e);
|
|
624
308
|
},
|
|
625
309
|
className: "flex items-center justify-between px-2 py-1.5 bg-surface-container-high border-b border-outline-variant/20 drag-handle cursor-move rounded-t-2xl shrink-0",
|
|
626
310
|
children: [
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
|
|
311
|
+
/* @__PURE__ */ a(
|
|
312
|
+
u,
|
|
629
313
|
{
|
|
630
314
|
variant: "ghost",
|
|
631
315
|
size: "sm",
|
|
632
316
|
className: "pointer-events-none opacity-50",
|
|
633
|
-
children: /* @__PURE__ */
|
|
317
|
+
children: /* @__PURE__ */ a(Z, { className: "w-4 h-4" })
|
|
634
318
|
}
|
|
635
319
|
),
|
|
636
|
-
/* @__PURE__ */
|
|
637
|
-
i.mode === "edit" &&
|
|
638
|
-
|
|
320
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
321
|
+
i.mode === "edit" && t && /* @__PURE__ */ a(
|
|
322
|
+
u,
|
|
639
323
|
{
|
|
640
324
|
variant: "ghost",
|
|
641
325
|
size: "sm",
|
|
642
|
-
onClick:
|
|
326
|
+
onClick: M,
|
|
643
327
|
className: "text-error hover:bg-error/10 hover:text-error cursor-pointer pointer-events-auto",
|
|
644
|
-
children: /* @__PURE__ */
|
|
328
|
+
children: /* @__PURE__ */ a(H, { className: "w-4 h-4" })
|
|
645
329
|
}
|
|
646
330
|
),
|
|
647
|
-
/* @__PURE__ */
|
|
648
|
-
|
|
331
|
+
/* @__PURE__ */ a(
|
|
332
|
+
u,
|
|
649
333
|
{
|
|
650
334
|
variant: "ghost",
|
|
651
335
|
size: "sm",
|
|
652
|
-
onClick:
|
|
336
|
+
onClick: l,
|
|
653
337
|
className: "pointer-events-auto hover:bg-surface-container-highest cursor-pointer",
|
|
654
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ a(z, { className: "w-4 h-4" })
|
|
655
339
|
}
|
|
656
340
|
)
|
|
657
341
|
] })
|
|
658
342
|
]
|
|
659
343
|
}
|
|
660
344
|
),
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
|
|
345
|
+
/* @__PURE__ */ a("div", { className: "flex-1 max-h-[80vh] overflow-y-auto scrollbar-thin overflow-x-hidden min-h-0", children: S }),
|
|
346
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-end gap-2 p-4 border-t border-outline-variant/20 bg-surface-container-high shrink-0 rounded-b-2xl", children: /* @__PURE__ */ a(
|
|
347
|
+
A,
|
|
664
348
|
{
|
|
665
349
|
variant: "primary",
|
|
666
|
-
onClick:
|
|
350
|
+
onClick: P,
|
|
667
351
|
className: "px-6 rounded-full font-bold",
|
|
668
352
|
children: "Save"
|
|
669
353
|
}
|
|
670
354
|
) })
|
|
671
355
|
]
|
|
672
356
|
}
|
|
673
|
-
) }) });
|
|
674
|
-
return /* @__PURE__ */ r(R, { children: [
|
|
675
|
-
typeof document < "u" && P(de, document.body),
|
|
676
|
-
typeof document < "u" && P(I, document.body)
|
|
677
|
-
] });
|
|
357
|
+
) }) }) : null;
|
|
678
358
|
};
|
|
679
359
|
export {
|
|
680
|
-
|
|
360
|
+
ye as EventPopover
|
|
681
361
|
};
|