@burdenoff/microfe-calendar 2026.1124.1 → 2026.1124.3
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/generated/wspace-operations.d.ts +658 -0
- package/dist/generated/wspace-operations.js +179 -6
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +1243 -10
- package/dist/hooks/useSafePermissions.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/pages/ResourcesPage.js.map +1 -1
- package/dist/providers/CalendarProvider.d.ts +3 -1
- package/dist/providers/CalendarProvider.js +12 -10
- package/dist/providers/CalendarProvider.js.map +1 -1
- package/dist/translations/en.d.ts +291 -1
- package/dist/types/index.d.ts +9 -0
- package/dist/v2/CalendarPageV2.js +44 -39
- package/dist/v2/CalendarPageV2.js.map +1 -1
- package/dist/v2/data/enums.d.ts +1 -0
- package/dist/v2/data/enums.js +6 -2
- package/dist/v2/data/enums.js.map +1 -1
- package/dist/v2/dialogs/CalendarDialogsV2.js +12 -9
- package/dist/v2/dialogs/CalendarDialogsV2.js.map +1 -1
- package/dist/v2/event/CustomRepeat.d.ts +5 -0
- package/dist/v2/event/CustomRepeat.js +246 -0
- package/dist/v2/event/CustomRepeat.js.map +1 -0
- package/dist/v2/event/EventDetailsTab.d.ts +6 -0
- package/dist/v2/event/EventDetailsTab.js +291 -0
- package/dist/v2/event/EventDetailsTab.js.map +1 -0
- package/dist/v2/event/EventDialog.d.ts +25 -0
- package/dist/v2/event/EventDialog.js +365 -0
- package/dist/v2/event/EventDialog.js.map +1 -0
- package/dist/v2/event/EventDialogs.d.ts +3 -0
- package/dist/v2/event/EventDialogs.js +111 -0
- package/dist/v2/event/EventDialogs.js.map +1 -0
- package/dist/v2/event/EventMoreTab.d.ts +4 -0
- package/dist/v2/event/EventMoreTab.js +214 -0
- package/dist/v2/event/EventMoreTab.js.map +1 -0
- package/dist/v2/event/EventPeopleTab.d.ts +8 -0
- package/dist/v2/event/EventPeopleTab.js +422 -0
- package/dist/v2/event/EventPeopleTab.js.map +1 -0
- package/dist/v2/event/EventPlaceTab.d.ts +6 -0
- package/dist/v2/event/EventPlaceTab.js +264 -0
- package/dist/v2/event/EventPlaceTab.js.map +1 -0
- package/dist/v2/event/FindTimeDialog.d.ts +26 -0
- package/dist/v2/event/FindTimeDialog.js +667 -0
- package/dist/v2/event/FindTimeDialog.js.map +1 -0
- package/dist/v2/event/RepeatField.d.ts +5 -0
- package/dist/v2/event/RepeatField.js +88 -0
- package/dist/v2/event/RepeatField.js.map +1 -0
- package/dist/v2/event/dialogLogic.d.ts +87 -0
- package/dist/v2/event/dialogLogic.js +117 -0
- package/dist/v2/event/dialogLogic.js.map +1 -0
- package/dist/v2/event/dialogModel.d.ts +48 -0
- package/dist/v2/event/dialogModel.js +13 -0
- package/dist/v2/event/dialogModel.js.map +1 -0
- package/dist/v2/event/eventForm.d.ts +209 -0
- package/dist/v2/event/eventForm.js +397 -0
- package/dist/v2/event/eventForm.js.map +1 -0
- package/dist/v2/event/findTime.d.ts +120 -0
- package/dist/v2/event/findTime.js +149 -0
- package/dist/v2/event/findTime.js.map +1 -0
- package/dist/v2/event/findTimeSource.d.ts +102 -0
- package/dist/v2/event/findTimeSource.js +107 -0
- package/dist/v2/event/findTimeSource.js.map +1 -0
- package/dist/v2/event/parts.d.ts +46 -0
- package/dist/v2/event/parts.js +124 -0
- package/dist/v2/event/parts.js.map +1 -0
- package/dist/v2/event/place.d.ts +64 -0
- package/dist/v2/event/place.js +48 -0
- package/dist/v2/event/place.js.map +1 -0
- package/dist/v2/event/repeatWords.d.ts +19 -0
- package/dist/v2/event/repeatWords.js +130 -0
- package/dist/v2/event/repeatWords.js.map +1 -0
- package/dist/v2/event/rrule.d.ts +90 -0
- package/dist/v2/event/rrule.js +368 -0
- package/dist/v2/event/rrule.js.map +1 -0
- package/dist/v2/event/savePlan.d.ts +50 -0
- package/dist/v2/event/savePlan.js +125 -0
- package/dist/v2/event/savePlan.js.map +1 -0
- package/dist/v2/event/useEventData.d.ts +91 -0
- package/dist/v2/event/useEventData.js +202 -0
- package/dist/v2/event/useEventData.js.map +1 -0
- package/dist/v2/event/useEventDialogModel.d.ts +37 -0
- package/dist/v2/event/useEventDialogModel.js +129 -0
- package/dist/v2/event/useEventDialogModel.js.map +1 -0
- package/dist/v2/event/useEventSave.d.ts +41 -0
- package/dist/v2/event/useEventSave.js +185 -0
- package/dist/v2/event/useEventSave.js.map +1 -0
- package/dist/v2/format.d.ts +2 -0
- package/dist/v2/format.js +4 -0
- package/dist/v2/format.js.map +1 -1
- package/dist/v2/grid/GridParts.js +100 -94
- package/dist/v2/grid/GridParts.js.map +1 -1
- package/dist/v2/grid/TimeGrid.js +98 -89
- package/dist/v2/grid/TimeGrid.js.map +1 -1
- package/dist/v2/list/ListViewV2.d.ts +6 -2
- package/dist/v2/list/ListViewV2.js +50 -44
- package/dist/v2/list/ListViewV2.js.map +1 -1
- package/dist/v2/month/MonthView.js +130 -126
- package/dist/v2/month/MonthView.js.map +1 -1
- package/dist/v2/peek/EventPeek.js.map +1 -1
- package/dist/v2/peek/PeekEvent.js.map +1 -1
- package/dist/v2/rail/CalendarRail.js +54 -80
- package/dist/v2/rail/CalendarRail.js.map +1 -1
- package/dist/v2/runs/RunPeek.d.ts +2 -0
- package/dist/v2/runs/RunPeek.js +382 -0
- package/dist/v2/runs/RunPeek.js.map +1 -0
- package/dist/v2/runs/RunPills.d.ts +28 -0
- package/dist/v2/runs/RunPills.js +179 -0
- package/dist/v2/runs/RunPills.js.map +1 -0
- package/dist/v2/runs/RunRows.d.ts +21 -0
- package/dist/v2/runs/RunRows.js +140 -0
- package/dist/v2/runs/RunRows.js.map +1 -0
- package/dist/v2/runs/RunsNotices.d.ts +1 -0
- package/dist/v2/runs/RunsNotices.js +37 -0
- package/dist/v2/runs/RunsNotices.js.map +1 -0
- package/dist/v2/runs/RunsSwitch.d.ts +1 -0
- package/dist/v2/runs/RunsSwitch.js +54 -0
- package/dist/v2/runs/RunsSwitch.js.map +1 -0
- package/dist/v2/runs/WorkflowRunsLayer.d.ts +4 -0
- package/dist/v2/runs/WorkflowRunsLayer.js +82 -0
- package/dist/v2/runs/WorkflowRunsLayer.js.map +1 -0
- package/dist/v2/runs/runAccess.d.ts +37 -0
- package/dist/v2/runs/runAccess.js +14 -0
- package/dist/v2/runs/runAccess.js.map +1 -0
- package/dist/v2/runs/runLayout.d.ts +76 -0
- package/dist/v2/runs/runLayout.js +129 -0
- package/dist/v2/runs/runLayout.js.map +1 -0
- package/dist/v2/runs/runLinks.d.ts +32 -0
- package/dist/v2/runs/runLinks.js +50 -0
- package/dist/v2/runs/runLinks.js.map +1 -0
- package/dist/v2/runs/runModel.d.ts +97 -0
- package/dist/v2/runs/runModel.js +132 -0
- package/dist/v2/runs/runModel.js.map +1 -0
- package/dist/v2/runs/runPeekState.d.ts +53 -0
- package/dist/v2/runs/runPeekState.js +62 -0
- package/dist/v2/runs/runPeekState.js.map +1 -0
- package/dist/v2/runs/runTypes.d.ts +60 -0
- package/dist/v2/runs/runWords.d.ts +23 -0
- package/dist/v2/runs/runWords.js +83 -0
- package/dist/v2/runs/runWords.js.map +1 -0
- package/dist/v2/runs/runsLayerContext.d.ts +26 -0
- package/dist/v2/runs/runsLayerContext.js +33 -0
- package/dist/v2/runs/runsLayerContext.js.map +1 -0
- package/dist/v2/runs/useRunHrefs.d.ts +10 -0
- package/dist/v2/runs/useRunHrefs.js +60 -0
- package/dist/v2/runs/useRunHrefs.js.map +1 -0
- package/dist/v2/runs/useRunLabels.d.ts +6 -0
- package/dist/v2/runs/useRunLabels.js +27 -0
- package/dist/v2/runs/useRunLabels.js.map +1 -0
- package/dist/v2/runs/useRunsAccess.d.ts +2 -0
- package/dist/v2/runs/useRunsAccess.js +14 -0
- package/dist/v2/runs/useRunsAccess.js.map +1 -0
- package/dist/v2/runs/useWorkflowRuns.d.ts +61 -0
- package/dist/v2/runs/useWorkflowRuns.js +119 -0
- package/dist/v2/runs/useWorkflowRuns.js.map +1 -0
- package/dist/v2/states/CalendarStates.js.map +1 -1
- package/dist/v2/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { formatDay as e } from "../format.js";
|
|
2
|
+
import { useCalendarPage as t } from "../page/CalendarPageContext.js";
|
|
3
|
+
import { FOCUS_RING as n } from "../styles.js";
|
|
4
|
+
import { anchorOf as r } from "./eventForm.js";
|
|
5
|
+
import { WEEKDAY_DATES as i, ordinal as a, ruleProblemWords as o, weekdayName as s } from "./repeatWords.js";
|
|
6
|
+
import { WEEKDAYS as c, nthOfMonth as l, presetsFor as u, weekdayCode as d, withFrequency as f, withWeekdayToggled as p } from "./rrule.js";
|
|
7
|
+
import { useState as m } from "react";
|
|
8
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
import { DatePicker as _, Input as v, Segmented as y } from "@burdenoff/fe-libs/ui";
|
|
10
|
+
import { cn as b } from "@burdenoff/fe-libs/utils";
|
|
11
|
+
// src/v2/event/CustomRepeat.tsx
|
|
12
|
+
function x({ value: e, min: t, max: n, onChange: r, label: i, disabled: a }) {
|
|
13
|
+
let [o, s] = m(String(e)), c = /^\d+$/.test(o) && Number(o) >= t && Number(o) <= n;
|
|
14
|
+
return /* @__PURE__ */ h(v, {
|
|
15
|
+
value: o,
|
|
16
|
+
inputMode: "numeric",
|
|
17
|
+
"aria-label": i,
|
|
18
|
+
"aria-invalid": !c || void 0,
|
|
19
|
+
disabled: a,
|
|
20
|
+
onChange: (e) => {
|
|
21
|
+
let t = e.target.value.replace(/[^\d]/g, "").slice(0, 3);
|
|
22
|
+
s(t), r(t === "" ? 0 : Number(t));
|
|
23
|
+
},
|
|
24
|
+
className: "h-9 w-16 text-center"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
var S = [
|
|
28
|
+
"DAILY",
|
|
29
|
+
"WEEKLY",
|
|
30
|
+
"MONTHLY",
|
|
31
|
+
"YEARLY"
|
|
32
|
+
];
|
|
33
|
+
function C({ rule: e, anchor: n, setRule: r, disabled: i }) {
|
|
34
|
+
let { tr: a } = t(), o = {
|
|
35
|
+
DAILY: a("calendar.v2.rrDays", "Days"),
|
|
36
|
+
WEEKLY: a("calendar.v2.rrWeeks", "Weeks"),
|
|
37
|
+
MONTHLY: a("calendar.v2.rrMonths", "Months"),
|
|
38
|
+
YEARLY: a("calendar.v2.rrYears", "Years")
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ g("div", {
|
|
41
|
+
className: "flex flex-wrap items-center gap-2",
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ h("span", {
|
|
44
|
+
className: "text-sm text-text-secondary",
|
|
45
|
+
children: a("calendar.v2.rrEvery", "Every")
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ h(x, {
|
|
48
|
+
value: e.interval,
|
|
49
|
+
min: 1,
|
|
50
|
+
max: 99,
|
|
51
|
+
label: a("calendar.v2.rrInterval", "How many"),
|
|
52
|
+
disabled: i,
|
|
53
|
+
onChange: (e) => r((t) => ({
|
|
54
|
+
...t,
|
|
55
|
+
interval: e
|
|
56
|
+
}))
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ h(y, {
|
|
59
|
+
"aria-label": a("calendar.v2.rrUnit", "Repeat by"),
|
|
60
|
+
value: e.frequency,
|
|
61
|
+
onValueChange: (e) => r((t) => f(t, e, n)),
|
|
62
|
+
options: S.map((e) => ({
|
|
63
|
+
value: e,
|
|
64
|
+
label: o[e]
|
|
65
|
+
})),
|
|
66
|
+
disabled: i,
|
|
67
|
+
fillOnPhone: !1
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function w({ rule: r, anchor: a, setRule: o, disabled: l }) {
|
|
73
|
+
let { tr: u, format: f, prefs: m } = t(), _ = d(a.start), v = new Set(r.weekdays), y = [...c.slice(m.weekStart), ...c.slice(0, m.weekStart)];
|
|
74
|
+
return /* @__PURE__ */ g("div", {
|
|
75
|
+
className: "flex flex-wrap items-center gap-2",
|
|
76
|
+
role: "group",
|
|
77
|
+
"aria-labelledby": "calendar-event-repeat-days",
|
|
78
|
+
children: [/* @__PURE__ */ h("span", {
|
|
79
|
+
id: "calendar-event-repeat-days",
|
|
80
|
+
className: "text-sm text-text-secondary",
|
|
81
|
+
children: u("calendar.v2.rrOn", "On")
|
|
82
|
+
}), y.map((t) => {
|
|
83
|
+
let r = v.has(t), c = t === _;
|
|
84
|
+
return /* @__PURE__ */ h("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
"aria-pressed": r,
|
|
87
|
+
"aria-label": s(t, f),
|
|
88
|
+
title: c ? u("calendar.v2.rrOwnDay", "The event’s own day") : void 0,
|
|
89
|
+
disabled: l || c,
|
|
90
|
+
onClick: () => o((e) => p(e, t, a)),
|
|
91
|
+
className: b("inline-flex h-9 min-w-11 items-center justify-center rounded-full border px-2.5 text-xs font-semibold motion-safe:transition-colors disabled:cursor-not-allowed", r ? "border-action-primary-bg bg-accent-soft text-text-primary" : "border-border-default bg-bg-surface text-text-secondary hover:border-border-strong", n),
|
|
92
|
+
children: e(i[t], f, "weekday")
|
|
93
|
+
}, t);
|
|
94
|
+
})]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function T({ rule: n, anchor: r, setRule: i, disabled: o }) {
|
|
98
|
+
let { tr: c, format: f } = t(), p = s(d(r.start), f), m = l(r.start), _ = [{
|
|
99
|
+
value: "monthDay",
|
|
100
|
+
label: c("calendar.v2.rrDayN", "Day {{day}}", { day: e(r.start, f, "dayNumber") })
|
|
101
|
+
}];
|
|
102
|
+
return m <= 4 && _.push({
|
|
103
|
+
value: "nthWeekday",
|
|
104
|
+
label: c("calendar.v2.rrNthWeekday", "The {{nth}} {{weekday}}", {
|
|
105
|
+
nth: a(m, c),
|
|
106
|
+
weekday: p
|
|
107
|
+
})
|
|
108
|
+
}), u(r).includes("monthlyLast") && _.push({
|
|
109
|
+
value: "lastWeekday",
|
|
110
|
+
label: c("calendar.v2.rrLastWeekday", "The last {{weekday}}", { weekday: p })
|
|
111
|
+
}), /* @__PURE__ */ g("div", {
|
|
112
|
+
className: "flex flex-wrap items-center gap-2",
|
|
113
|
+
children: [/* @__PURE__ */ h("span", {
|
|
114
|
+
id: "calendar-event-repeat-monthly",
|
|
115
|
+
className: "text-sm text-text-secondary",
|
|
116
|
+
children: c("calendar.v2.rrOn", "On")
|
|
117
|
+
}), /* @__PURE__ */ h(y, {
|
|
118
|
+
"aria-labelledby": "calendar-event-repeat-monthly",
|
|
119
|
+
value: n.monthly ?? "monthDay",
|
|
120
|
+
onValueChange: (e) => i((t) => ({
|
|
121
|
+
...t,
|
|
122
|
+
monthly: e === "nthWeekday" || e === "lastWeekday" ? e : "monthDay"
|
|
123
|
+
})),
|
|
124
|
+
options: _,
|
|
125
|
+
disabled: o,
|
|
126
|
+
fillOnPhone: !1
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function E({ rule: e, anchor: n, setRule: r, disabled: i }) {
|
|
131
|
+
let a = t(), { tr: o, format: s, prefs: c } = a, l = e.end;
|
|
132
|
+
return /* @__PURE__ */ g("div", {
|
|
133
|
+
className: "flex flex-wrap items-center gap-2",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ h("span", {
|
|
136
|
+
id: "calendar-event-repeat-ends",
|
|
137
|
+
className: "text-sm text-text-secondary",
|
|
138
|
+
children: o("calendar.v2.rrEnds", "Ends")
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ h(y, {
|
|
141
|
+
"aria-labelledby": "calendar-event-repeat-ends",
|
|
142
|
+
value: l.kind,
|
|
143
|
+
onValueChange: (e) => r((t) => ({
|
|
144
|
+
...t,
|
|
145
|
+
end: e === "count" ? {
|
|
146
|
+
kind: "count",
|
|
147
|
+
count: 10
|
|
148
|
+
} : e === "until" ? {
|
|
149
|
+
kind: "until",
|
|
150
|
+
date: n.start
|
|
151
|
+
} : { kind: "never" }
|
|
152
|
+
})),
|
|
153
|
+
options: [
|
|
154
|
+
{
|
|
155
|
+
value: "never",
|
|
156
|
+
label: o("calendar.v2.rrNever", "Never")
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
value: "count",
|
|
160
|
+
label: o("calendar.v2.rrAfter", "After")
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: "until",
|
|
164
|
+
label: o("calendar.v2.rrOnADate", "On a date")
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
disabled: i,
|
|
168
|
+
fillOnPhone: !1
|
|
169
|
+
}),
|
|
170
|
+
l.kind === "count" ? /* @__PURE__ */ g("span", {
|
|
171
|
+
className: "flex items-center gap-2",
|
|
172
|
+
children: [/* @__PURE__ */ h(x, {
|
|
173
|
+
value: l.count,
|
|
174
|
+
min: 1,
|
|
175
|
+
max: 999,
|
|
176
|
+
label: o("calendar.v2.rrCount", "How many times"),
|
|
177
|
+
disabled: i,
|
|
178
|
+
onChange: (e) => r((t) => ({
|
|
179
|
+
...t,
|
|
180
|
+
end: {
|
|
181
|
+
kind: "count",
|
|
182
|
+
count: e
|
|
183
|
+
}
|
|
184
|
+
}))
|
|
185
|
+
}), /* @__PURE__ */ h("span", {
|
|
186
|
+
className: "text-sm text-text-secondary",
|
|
187
|
+
children: o("calendar.v2.rrTimesWord", "times")
|
|
188
|
+
})]
|
|
189
|
+
}) : null,
|
|
190
|
+
l.kind === "until" ? /* @__PURE__ */ h(_, {
|
|
191
|
+
value: l.date,
|
|
192
|
+
onChange: (e) => r((t) => ({
|
|
193
|
+
...t,
|
|
194
|
+
end: {
|
|
195
|
+
kind: "until",
|
|
196
|
+
date: e
|
|
197
|
+
}
|
|
198
|
+
})),
|
|
199
|
+
label: o("calendar.v2.rrLastDate", "Last date"),
|
|
200
|
+
weekStartsOn: c.weekStart,
|
|
201
|
+
locale: s.locale,
|
|
202
|
+
timeZone: a.timeZone,
|
|
203
|
+
min: n.start,
|
|
204
|
+
disabled: i
|
|
205
|
+
}) : null
|
|
206
|
+
]
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function D({ model: e }) {
|
|
210
|
+
let { tr: n } = t(), { form: i, update: a, readOnly: s, issues: c, showIssues: l } = e;
|
|
211
|
+
if (i.repeat.kind !== "custom") return null;
|
|
212
|
+
let u = {
|
|
213
|
+
rule: i.repeat.rule,
|
|
214
|
+
anchor: r(i),
|
|
215
|
+
setRule: (e) => a((t) => t.repeat.kind === "custom" ? {
|
|
216
|
+
...t,
|
|
217
|
+
repeat: {
|
|
218
|
+
kind: "custom",
|
|
219
|
+
rule: e(t.repeat.rule)
|
|
220
|
+
}
|
|
221
|
+
} : t),
|
|
222
|
+
disabled: s
|
|
223
|
+
}, d = l ? c.repeat : void 0;
|
|
224
|
+
return /* @__PURE__ */ g("section", {
|
|
225
|
+
"aria-labelledby": "calendar-event-custom-repeat",
|
|
226
|
+
className: "flex flex-col gap-3 rounded-card border border-border-default bg-bg-sunken p-3",
|
|
227
|
+
children: [
|
|
228
|
+
/* @__PURE__ */ h("h3", {
|
|
229
|
+
id: "calendar-event-custom-repeat",
|
|
230
|
+
className: "text-sm font-semibold text-text-primary",
|
|
231
|
+
children: n("calendar.v2.rrCustomTitle", "Custom repeat")
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ h(C, { ...u }),
|
|
234
|
+
u.rule.frequency === "WEEKLY" ? /* @__PURE__ */ h(w, { ...u }) : null,
|
|
235
|
+
u.rule.frequency === "MONTHLY" ? /* @__PURE__ */ h(T, { ...u }) : null,
|
|
236
|
+
/* @__PURE__ */ h(E, { ...u }),
|
|
237
|
+
d ? /* @__PURE__ */ h("p", {
|
|
238
|
+
className: "text-xs font-medium text-status-error-text",
|
|
239
|
+
children: o(d, n)
|
|
240
|
+
}) : null
|
|
241
|
+
]
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
export { D as CustomRepeat };
|
|
245
|
+
|
|
246
|
+
//# sourceMappingURL=CustomRepeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomRepeat.js","names":["NumberInput","text","setText","useState","value","valid","min","max","Input","label","next","event","onChange","FREQUENCY_ORDER","IntervalRow","useCalendarPage","unitWords","tr","rule","setRule","current","Segmented","withFrequency","frequency","anchor","WeekdayToggles","startDay","weekdayCode","chosen","weekOrder","WEEKDAYS","prefs","on","day","own","weekdayName","format","disabled","withWeekdayToggled","cn","FOCUS_RING","formatDay","WEEKDAY_DATES","MonthlyChoice","weekday","nth","nthOfMonth","options","ordinal","presetsFor","monthly","RepeatEnds","page","end","kind","DatePicker","CustomRepeat","model","form","parts","anchorOf","update","change","readOnly","problem","showIssues","issues","ruleProblemWords"],"sources":["../../../src/v2/event/CustomRepeat.tsx"],"sourcesContent":["/**\n * The Custom repeat builder (BOFF-15698 A2), under the Repeat menu while the rule is a custom\n * one: every N days, weeks, months or years; which weekdays (the event's own day stays on);\n * which day of the month; ending never, after N times or on a date. `rrule.ts` writes it.\n */\nimport { useState } from 'react';\nimport { DatePicker, Input, Segmented } from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { formatDay } from '../format';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { FOCUS_RING } from '../styles';\nimport type { EventDialogModel } from './dialogModel';\nimport { anchorOf } from './eventForm';\nimport { ordinal, ruleProblemWords, WEEKDAY_DATES, weekdayName } from './repeatWords';\nimport {\n MAX_COUNT,\n MAX_INTERVAL,\n nthOfMonth,\n presetsFor,\n weekdayCode,\n withFrequency,\n withWeekdayToggled,\n WEEKDAYS,\n type RepeatFrequency,\n type RepeatRule,\n type RuleAnchor,\n} from './rrule';\n\n/** What each part of the builder works on. */\ninterface PartProps {\n rule: RepeatRule;\n anchor: RuleAnchor;\n setRule: (change: (rule: RepeatRule) => RepeatRule) => void;\n disabled: boolean;\n}\n\n/**\n * A whole number typed in a small field. What doesn't read as one in range still goes to the\n * rule, so the dialog names the problem and won't save it.\n */\nfunction NumberInput({\n value,\n min,\n max,\n onChange,\n label,\n disabled,\n}: {\n value: number;\n min: number;\n max: number;\n onChange: (value: number) => void;\n label: string;\n disabled?: boolean;\n}) {\n const [text, setText] = useState(String(value));\n const valid = /^\\d+$/.test(text) && Number(text) >= min && Number(text) <= max;\n return (\n <Input\n value={text}\n inputMode=\"numeric\"\n aria-label={label}\n aria-invalid={valid ? undefined : true}\n disabled={disabled}\n onChange={(event) => {\n const next = event.target.value.replace(/[^\\d]/g, '').slice(0, 3);\n setText(next);\n onChange(next === '' ? 0 : Number(next));\n }}\n className=\"h-9 w-16 text-center\"\n />\n );\n}\n\nconst FREQUENCY_ORDER: readonly RepeatFrequency[] = ['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY'];\n\n/** \"Every [2] Days · Weeks · Months · Years\". */\nfunction IntervalRow({ rule, anchor, setRule, disabled }: PartProps) {\n const { tr } = useCalendarPage();\n const unitWords: Record<RepeatFrequency, string> = {\n DAILY: tr('calendar.v2.rrDays', 'Days'),\n WEEKLY: tr('calendar.v2.rrWeeks', 'Weeks'),\n MONTHLY: tr('calendar.v2.rrMonths', 'Months'),\n YEARLY: tr('calendar.v2.rrYears', 'Years'),\n };\n return (\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm text-text-secondary\">{tr('calendar.v2.rrEvery', 'Every')}</span>\n <NumberInput\n value={rule.interval}\n min={1}\n max={MAX_INTERVAL}\n label={tr('calendar.v2.rrInterval', 'How many')}\n disabled={disabled}\n onChange={(interval) => setRule((current) => ({ ...current, interval }))}\n />\n <Segmented<RepeatFrequency>\n aria-label={tr('calendar.v2.rrUnit', 'Repeat by')}\n value={rule.frequency}\n onValueChange={(frequency) =>\n setRule((current) => withFrequency(current, frequency, anchor))\n }\n options={FREQUENCY_ORDER.map((frequency) => ({\n value: frequency,\n label: unitWords[frequency],\n }))}\n disabled={disabled}\n fillOnPhone={false}\n />\n </div>\n );\n}\n\n/** A weekly rule's days, from the person's week start; the event's own day stays on. */\nfunction WeekdayToggles({ rule, anchor, setRule, disabled }: PartProps) {\n const { tr, format, prefs } = useCalendarPage();\n const startDay = weekdayCode(anchor.start);\n const chosen = new Set(rule.weekdays);\n const weekOrder = [...WEEKDAYS.slice(prefs.weekStart), ...WEEKDAYS.slice(0, prefs.weekStart)];\n return (\n <div\n className=\"flex flex-wrap items-center gap-2\"\n role=\"group\"\n aria-labelledby=\"calendar-event-repeat-days\"\n >\n <span id=\"calendar-event-repeat-days\" className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.rrOn', 'On')}\n </span>\n {weekOrder.map((day) => {\n const on = chosen.has(day);\n const own = day === startDay;\n return (\n <button\n key={day}\n type=\"button\"\n aria-pressed={on}\n aria-label={weekdayName(day, format)}\n title={own ? tr('calendar.v2.rrOwnDay', 'The event’s own day') : undefined}\n disabled={disabled || own}\n onClick={() => setRule((current) => withWeekdayToggled(current, day, anchor))}\n className={cn(\n 'inline-flex h-9 min-w-11 items-center justify-center rounded-full border px-2.5 text-xs font-semibold motion-safe:transition-colors disabled:cursor-not-allowed',\n on\n ? 'border-action-primary-bg bg-accent-soft text-text-primary'\n : 'border-border-default bg-bg-surface text-text-secondary hover:border-border-strong',\n FOCUS_RING\n )}\n >\n {formatDay(WEEKDAY_DATES[day], format, 'weekday')}\n </button>\n );\n })}\n </div>\n );\n}\n\n/** A monthly rule's day: the start's day of the month, its nth weekday, or its last. */\nfunction MonthlyChoice({ rule, anchor, setRule, disabled }: PartProps) {\n const { tr, format } = useCalendarPage();\n const weekday = weekdayName(weekdayCode(anchor.start), format);\n const nth = nthOfMonth(anchor.start);\n const options = [\n {\n value: 'monthDay',\n label: tr('calendar.v2.rrDayN', 'Day {{day}}', {\n day: formatDay(anchor.start, format, 'dayNumber'),\n }),\n },\n ];\n if (nth <= 4) {\n options.push({\n value: 'nthWeekday',\n label: tr('calendar.v2.rrNthWeekday', 'The {{nth}} {{weekday}}', {\n nth: ordinal(nth, tr),\n weekday,\n }),\n });\n }\n if (presetsFor(anchor).includes('monthlyLast')) {\n options.push({\n value: 'lastWeekday',\n label: tr('calendar.v2.rrLastWeekday', 'The last {{weekday}}', { weekday }),\n });\n }\n return (\n <div className=\"flex flex-wrap items-center gap-2\">\n <span id=\"calendar-event-repeat-monthly\" className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.rrOn', 'On')}\n </span>\n <Segmented<string>\n aria-labelledby=\"calendar-event-repeat-monthly\"\n value={rule.monthly ?? 'monthDay'}\n onValueChange={(monthly) =>\n setRule((current) => ({\n ...current,\n monthly: monthly === 'nthWeekday' || monthly === 'lastWeekday' ? monthly : 'monthDay',\n }))\n }\n options={options}\n disabled={disabled}\n fillOnPhone={false}\n />\n </div>\n );\n}\n\n/** Ends: never, after N times, or on a date. */\nfunction RepeatEnds({ rule, anchor, setRule, disabled }: PartProps) {\n const page = useCalendarPage();\n const { tr, format, prefs } = page;\n const end = rule.end;\n return (\n <div className=\"flex flex-wrap items-center gap-2\">\n <span id=\"calendar-event-repeat-ends\" className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.rrEnds', 'Ends')}\n </span>\n <Segmented<string>\n aria-labelledby=\"calendar-event-repeat-ends\"\n value={end.kind}\n onValueChange={(kind) =>\n setRule((current) => ({\n ...current,\n end:\n kind === 'count'\n ? { kind: 'count', count: 10 }\n : kind === 'until'\n ? { kind: 'until', date: anchor.start }\n : { kind: 'never' },\n }))\n }\n options={[\n { value: 'never', label: tr('calendar.v2.rrNever', 'Never') },\n { value: 'count', label: tr('calendar.v2.rrAfter', 'After') },\n { value: 'until', label: tr('calendar.v2.rrOnADate', 'On a date') },\n ]}\n disabled={disabled}\n fillOnPhone={false}\n />\n {end.kind === 'count' ? (\n <span className=\"flex items-center gap-2\">\n <NumberInput\n value={end.count}\n min={1}\n max={MAX_COUNT}\n label={tr('calendar.v2.rrCount', 'How many times')}\n disabled={disabled}\n onChange={(count) =>\n setRule((current) => ({ ...current, end: { kind: 'count', count } }))\n }\n />\n <span className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.rrTimesWord', 'times')}\n </span>\n </span>\n ) : null}\n {end.kind === 'until' ? (\n <DatePicker\n value={end.date}\n onChange={(date) => setRule((current) => ({ ...current, end: { kind: 'until', date } }))}\n label={tr('calendar.v2.rrLastDate', 'Last date')}\n weekStartsOn={prefs.weekStart}\n locale={format.locale}\n timeZone={page.timeZone}\n min={anchor.start}\n disabled={disabled}\n />\n ) : null}\n </div>\n );\n}\n\n/** The Custom builder, under the Repeat menu while the rule is a custom one. */\nexport function CustomRepeat({ model }: { model: EventDialogModel }) {\n const { tr } = useCalendarPage();\n const { form, update, readOnly, issues, showIssues } = model;\n if (form.repeat.kind !== 'custom') return null;\n const parts: PartProps = {\n rule: form.repeat.rule,\n anchor: anchorOf(form),\n setRule: (change) =>\n update((current) =>\n current.repeat.kind === 'custom'\n ? { ...current, repeat: { kind: 'custom', rule: change(current.repeat.rule) } }\n : current\n ),\n disabled: readOnly,\n };\n const problem = showIssues ? issues.repeat : undefined;\n return (\n <section\n aria-labelledby=\"calendar-event-custom-repeat\"\n className=\"flex flex-col gap-3 rounded-card border border-border-default bg-bg-sunken p-3\"\n >\n <h3 id=\"calendar-event-custom-repeat\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.rrCustomTitle', 'Custom repeat')}\n </h3>\n <IntervalRow {...parts} />\n {parts.rule.frequency === 'WEEKLY' ? <WeekdayToggles {...parts} /> : null}\n {parts.rule.frequency === 'MONTHLY' ? <MonthlyChoice {...parts} /> : null}\n <RepeatEnds {...parts} />\n {problem ? (\n <p className=\"text-xs font-medium text-status-error-text\">\n {ruleProblemWords(problem, tr)}\n </p>\n ) : null}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;AAwCA,SAASA,EAAY,EACnB,UACA,QACA,QACA,aACA,UACA,eAQC;CACD,IAAM,CAACC,GAAMC,KAAWC,EAAS,OAAOC,CAAK,CAAC,GACxCC,IAAQ,QAAQ,KAAKJ,CAA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kBAAC,WAAD;EACE,mBAAgB;EAChB,WAAU;EAFZ,UAAA;GAIE,kBAAC,MAAD;IAAI,IAAG;IAA+B,WAAU;IAC7C,UAAAjD,EAAG,6BAA6B,eAAe;GAC9C,CAAA;GACJ,kBAACH,GAAD,EAAa,GAAI6C,EAAQ,CAAA;GACxBA,EAAM,KAAK,cAAc,WAAW,kBAAClC,GAAD,EAAgB,GAAIkC,EAAQ,CAAA,IAAI;GACpEA,EAAM,KAAK,cAAc,YAAY,kBAAChB,GAAD,EAAe,GAAIgB,EAAQ,CAAA,IAAI;GACrE,kBAACR,GAAD,EAAY,GAAIQ,EAAQ,CAAA;GACvBK,IACC,kBAAC,KAAD;IAAG,WAAU;IACV,UAAAG,EAAiBH,GAAS/C,CAAE;GAC5B,CAAA,IACD;EACG;;AAEb"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { formatDay as e, formatDuration as t, formatMinuteRange as n } from "../format.js";
|
|
2
|
+
import { useCalendarPage as r } from "../page/CalendarPageContext.js";
|
|
3
|
+
import { TITLE_INPUT_ID as i, overlapWords as a } from "./dialogLogic.js";
|
|
4
|
+
import { LENGTH_CHIPS as o, endWall as s, lengthChip as c, startWall as l, wallIn as u, withAllDay as d, withEndClock as f, withEndDate as p, withEndTime as m, withLength as h, withStartDate as g, withStartTime as _, withTimeZone as v } from "./eventForm.js";
|
|
5
|
+
import { Field as y } from "./parts.js";
|
|
6
|
+
import { CustomRepeat as b } from "./CustomRepeat.js";
|
|
7
|
+
import { RepeatField as x } from "./RepeatField.js";
|
|
8
|
+
import { AlertTriangle as S, Users as C } from "lucide-react";
|
|
9
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
10
|
+
import { Button as D, DatePicker as O, Input as k, Notice as A, Segmented as j, Switch as M, Textarea as N, TimePicker as P, TimeZonePicker as F, addDays as I, parseTimeValue as L, timeValueOf as R } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
// src/v2/event/EventDetailsTab.tsx
|
|
12
|
+
var z = {
|
|
13
|
+
day: "numeric",
|
|
14
|
+
month: "short",
|
|
15
|
+
year: "numeric"
|
|
16
|
+
}, B = 1425, V = "calendar-event-title-error";
|
|
17
|
+
function H({ model: e }) {
|
|
18
|
+
let { tr: t } = r(), { form: n, update: a, readOnly: o } = e, s = e.showIssues && e.issues.title;
|
|
19
|
+
return /* @__PURE__ */ T(y, {
|
|
20
|
+
label: t("calendar.v2.eventTitle", "Title"),
|
|
21
|
+
labelFor: i,
|
|
22
|
+
required: !0,
|
|
23
|
+
error: s ? t("calendar.v2.evTitleMissing", "Add a title to save the event.") : void 0,
|
|
24
|
+
errorId: V,
|
|
25
|
+
children: /* @__PURE__ */ T(k, {
|
|
26
|
+
id: i,
|
|
27
|
+
value: n.title,
|
|
28
|
+
maxLength: 200,
|
|
29
|
+
autoComplete: "off",
|
|
30
|
+
disabled: o,
|
|
31
|
+
required: !0,
|
|
32
|
+
"aria-required": "true",
|
|
33
|
+
"aria-invalid": s ? !0 : void 0,
|
|
34
|
+
"aria-describedby": s ? V : void 0,
|
|
35
|
+
placeholder: t("calendar.v2.evTitlePlaceholder", "For example: Pipeline review"),
|
|
36
|
+
onChange: (e) => {
|
|
37
|
+
let t = e.target.value;
|
|
38
|
+
a((e) => ({
|
|
39
|
+
...e,
|
|
40
|
+
title: t
|
|
41
|
+
}));
|
|
42
|
+
},
|
|
43
|
+
className: "h-11 text-base"
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function U({ model: e }) {
|
|
48
|
+
let { tr: t, format: n, prefs: i, timeZone: a } = r(), { form: o, update: s, readOnly: c } = e;
|
|
49
|
+
return /* @__PURE__ */ E(w, { children: [
|
|
50
|
+
/* @__PURE__ */ T(O, {
|
|
51
|
+
value: o.firstDay,
|
|
52
|
+
onChange: (e) => s((t) => g(t, e)),
|
|
53
|
+
label: t("calendar.v2.evFirstDay", "First day"),
|
|
54
|
+
weekStartsOn: i.weekStart,
|
|
55
|
+
locale: n.locale,
|
|
56
|
+
timeZone: a,
|
|
57
|
+
format: z,
|
|
58
|
+
disabled: c
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ T("span", {
|
|
61
|
+
className: "text-sm text-text-secondary",
|
|
62
|
+
children: t("calendar.v2.evTo", "to")
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ T(O, {
|
|
65
|
+
value: o.lastDay,
|
|
66
|
+
onChange: (e) => s((t) => p(t, e)),
|
|
67
|
+
label: t("calendar.v2.evLastDay", "Last day"),
|
|
68
|
+
weekStartsOn: i.weekStart,
|
|
69
|
+
locale: n.locale,
|
|
70
|
+
timeZone: a,
|
|
71
|
+
min: o.firstDay,
|
|
72
|
+
range: {
|
|
73
|
+
start: o.firstDay,
|
|
74
|
+
end: o.lastDay
|
|
75
|
+
},
|
|
76
|
+
format: z,
|
|
77
|
+
disabled: c
|
|
78
|
+
})
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
function W(e) {
|
|
82
|
+
let t = l(e), n = s(e);
|
|
83
|
+
return n.date === t.date || n.date === I(t.date, 1) && n.minutes <= t.minutes;
|
|
84
|
+
}
|
|
85
|
+
function G({ model: e }) {
|
|
86
|
+
let { tr: t, format: n, prefs: i, timeZone: a } = r(), { form: o, update: c, readOnly: u } = e, d = l(o), h = s(o), v = W(o);
|
|
87
|
+
return /* @__PURE__ */ E(w, { children: [
|
|
88
|
+
/* @__PURE__ */ T(O, {
|
|
89
|
+
value: d.date,
|
|
90
|
+
onChange: (e) => c((t) => g(t, e)),
|
|
91
|
+
label: t("calendar.v2.evDate", "Date"),
|
|
92
|
+
weekStartsOn: i.weekStart,
|
|
93
|
+
locale: n.locale,
|
|
94
|
+
timeZone: a,
|
|
95
|
+
format: z,
|
|
96
|
+
disabled: u
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ T(P, {
|
|
99
|
+
value: R(d.minutes),
|
|
100
|
+
onChange: (e) => {
|
|
101
|
+
let t = L(e);
|
|
102
|
+
t !== null && c((e) => _(e, t));
|
|
103
|
+
},
|
|
104
|
+
label: t("calendar.v2.evStarts", "Starts"),
|
|
105
|
+
hourCycle: n.hourCycle,
|
|
106
|
+
locale: n.locale,
|
|
107
|
+
disabled: u
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ T("span", {
|
|
110
|
+
className: "text-sm text-text-secondary",
|
|
111
|
+
children: t("calendar.v2.evTo", "to")
|
|
112
|
+
}),
|
|
113
|
+
v ? null : /* @__PURE__ */ T(O, {
|
|
114
|
+
value: h.date,
|
|
115
|
+
onChange: (e) => c((t) => p(t, e)),
|
|
116
|
+
label: t("calendar.v2.evEndDate", "End date"),
|
|
117
|
+
weekStartsOn: i.weekStart,
|
|
118
|
+
locale: n.locale,
|
|
119
|
+
timeZone: a,
|
|
120
|
+
min: d.date,
|
|
121
|
+
format: z,
|
|
122
|
+
disabled: u
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ T(P, {
|
|
125
|
+
value: R(h.minutes),
|
|
126
|
+
onChange: (e, t) => {
|
|
127
|
+
let n = L(e);
|
|
128
|
+
n !== null && c((e) => v ? m(e, n, t.nextDay) : f(e, n));
|
|
129
|
+
},
|
|
130
|
+
label: t("calendar.v2.evEnds", "Ends"),
|
|
131
|
+
hourCycle: n.hourCycle,
|
|
132
|
+
locale: n.locale,
|
|
133
|
+
startTime: v ? R(d.minutes) : void 0,
|
|
134
|
+
maxDuration: B,
|
|
135
|
+
icon: null,
|
|
136
|
+
disabled: u
|
|
137
|
+
})
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
function K({ model: e }) {
|
|
141
|
+
let { tr: n, durationWords: i } = r(), { form: a, update: s, readOnly: l } = e, u = c(a);
|
|
142
|
+
return /* @__PURE__ */ E("div", {
|
|
143
|
+
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
144
|
+
children: [/* @__PURE__ */ E("label", {
|
|
145
|
+
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
146
|
+
children: [/* @__PURE__ */ T(M, {
|
|
147
|
+
checked: a.allDay,
|
|
148
|
+
onCheckedChange: (e) => s((t) => d(t, e)),
|
|
149
|
+
disabled: l
|
|
150
|
+
}), n("calendar.v2.allDay", "All day")]
|
|
151
|
+
}), a.allDay ? null : /* @__PURE__ */ E("div", {
|
|
152
|
+
className: "ms-auto flex items-center gap-2 max-sm:ms-0 max-sm:w-full",
|
|
153
|
+
children: [/* @__PURE__ */ T("span", {
|
|
154
|
+
id: "calendar-event-length",
|
|
155
|
+
className: "text-sm text-text-secondary max-sm:shrink-0",
|
|
156
|
+
children: n("calendar.v2.evLength", "Length")
|
|
157
|
+
}), /* @__PURE__ */ T(j, {
|
|
158
|
+
"aria-labelledby": "calendar-event-length",
|
|
159
|
+
value: u === null ? "" : String(u),
|
|
160
|
+
onValueChange: (e) => s((t) => h(t, Number(e))),
|
|
161
|
+
options: o.map((e) => ({
|
|
162
|
+
value: String(e),
|
|
163
|
+
label: t(e, i)
|
|
164
|
+
})),
|
|
165
|
+
disabled: l,
|
|
166
|
+
className: "max-sm:flex-1"
|
|
167
|
+
})]
|
|
168
|
+
})]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function q({ model: t }) {
|
|
172
|
+
let i = r(), { tr: a, format: o } = i, { form: s } = t;
|
|
173
|
+
if (s.allDay || s.timeZone === i.timeZone) return null;
|
|
174
|
+
let c = u(s, i.timeZone), d = n(c.start.minutes, c.end.minutes, o), f = c.start.date === l(s).date ? d : `${e(c.start.date, o, "short")}, ${d}`;
|
|
175
|
+
return /* @__PURE__ */ T("p", {
|
|
176
|
+
className: "text-xs text-text-secondary",
|
|
177
|
+
children: a("calendar.v2.evYourTime", "That’s {{time}} your time.", { time: f })
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function J({ model: e }) {
|
|
181
|
+
let t = r(), { tr: n, format: i } = t, o = e.me;
|
|
182
|
+
if (e.form.allDay || e.readOnly || o.kind !== "busy" && o.kind !== "away" && o.kind !== "tentative") return null;
|
|
183
|
+
let s = o.span ? a(o.span, {
|
|
184
|
+
start: e.start,
|
|
185
|
+
end: e.end
|
|
186
|
+
}, t.timeZone, i) : "", c = /* @__PURE__ */ E(w, { children: [
|
|
187
|
+
/* @__PURE__ */ T("b", { children: n("calendar.v2.evYouBusy", "You’re busy then.") }),
|
|
188
|
+
" ",
|
|
189
|
+
n("calendar.v2.evYouBusyBody", "Something else is on your calendar {{time}}.", { time: s })
|
|
190
|
+
] });
|
|
191
|
+
return o.kind === "away" && (c = /* @__PURE__ */ T("b", { children: n("calendar.v2.evYouAway", "You’re away then.") })), o.kind === "tentative" && (c = /* @__PURE__ */ E(w, { children: [
|
|
192
|
+
/* @__PURE__ */ T("b", { children: n("calendar.v2.evYouMaybe", "You might be busy then.") }),
|
|
193
|
+
" ",
|
|
194
|
+
n("calendar.v2.evYouMaybeBody", "You said maybe to something {{time}}.", { time: s })
|
|
195
|
+
] })), /* @__PURE__ */ T(A, {
|
|
196
|
+
tone: "warn",
|
|
197
|
+
icon: S,
|
|
198
|
+
action: /* @__PURE__ */ E(D, {
|
|
199
|
+
type: "button",
|
|
200
|
+
variant: "outline",
|
|
201
|
+
size: "sm",
|
|
202
|
+
onClick: e.openFindTime,
|
|
203
|
+
children: [/* @__PURE__ */ T(C, { "aria-hidden": "true" }), n("calendar.v2.findTime", "Find a time")]
|
|
204
|
+
}),
|
|
205
|
+
children: c
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function Y({ model: e }) {
|
|
209
|
+
let { tr: t } = r(), { form: n, issues: i, showIssues: a } = e;
|
|
210
|
+
return /* @__PURE__ */ E("div", {
|
|
211
|
+
className: "flex flex-col gap-2",
|
|
212
|
+
role: "group",
|
|
213
|
+
"aria-labelledby": "calendar-event-when",
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ T("span", {
|
|
216
|
+
id: "calendar-event-when",
|
|
217
|
+
className: "text-sm font-semibold text-text-primary",
|
|
218
|
+
children: t("calendar.v2.evWhen", "When")
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ T("div", {
|
|
221
|
+
className: "flex flex-wrap items-center gap-2",
|
|
222
|
+
children: n.allDay ? /* @__PURE__ */ T(U, { model: e }) : /* @__PURE__ */ T(G, { model: e })
|
|
223
|
+
}),
|
|
224
|
+
a && i.when ? /* @__PURE__ */ T("p", {
|
|
225
|
+
className: "text-xs font-medium text-status-error-text",
|
|
226
|
+
children: t("calendar.v2.evEndBeforeStart", "The event has to end after it starts.")
|
|
227
|
+
}) : null,
|
|
228
|
+
/* @__PURE__ */ T(K, { model: e }),
|
|
229
|
+
/* @__PURE__ */ T(q, { model: e }),
|
|
230
|
+
/* @__PURE__ */ T(J, { model: e })
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function X({ model: e }) {
|
|
235
|
+
let t = r(), { tr: n, format: i } = t, { form: a, update: o, readOnly: s } = e;
|
|
236
|
+
return a.allDay ? null : /* @__PURE__ */ T(y, {
|
|
237
|
+
label: n("calendar.v2.evTimeZone", "Time zone"),
|
|
238
|
+
hint: a.timeZone === t.timeZone ? void 0 : n("calendar.v2.evOtherZone", "Not your time zone: the times above are its own."),
|
|
239
|
+
children: /* @__PURE__ */ T(F, {
|
|
240
|
+
value: a.timeZone,
|
|
241
|
+
onChange: (e) => o((t) => v(t, e)),
|
|
242
|
+
suggested: [t.timeZone],
|
|
243
|
+
suggestedLabel: n("calendar.v2.evYourZone", "Yours"),
|
|
244
|
+
referenceDate: l(a).date,
|
|
245
|
+
locale: i.locale,
|
|
246
|
+
label: n("calendar.v2.evTimeZone", "Time zone"),
|
|
247
|
+
disabled: s,
|
|
248
|
+
className: "w-full"
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function Z({ model: e }) {
|
|
253
|
+
let { tr: t } = r(), { form: n, update: i, readOnly: a } = e;
|
|
254
|
+
return /* @__PURE__ */ T(y, {
|
|
255
|
+
label: t("calendar.v2.evDescription", "Description"),
|
|
256
|
+
labelFor: "calendar-event-description",
|
|
257
|
+
children: /* @__PURE__ */ T(N, {
|
|
258
|
+
id: "calendar-event-description",
|
|
259
|
+
value: n.description,
|
|
260
|
+
rows: 4,
|
|
261
|
+
disabled: a,
|
|
262
|
+
placeholder: t("calendar.v2.evDescriptionPlaceholder", "Agenda, links, what to prepare"),
|
|
263
|
+
onChange: (e) => {
|
|
264
|
+
let t = e.target.value;
|
|
265
|
+
i((e) => ({
|
|
266
|
+
...e,
|
|
267
|
+
description: t
|
|
268
|
+
}));
|
|
269
|
+
},
|
|
270
|
+
className: "min-h-24"
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function Q({ model: e }) {
|
|
275
|
+
return /* @__PURE__ */ E("div", {
|
|
276
|
+
className: "flex flex-col gap-5",
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ T(H, { model: e }),
|
|
279
|
+
/* @__PURE__ */ T(Y, { model: e }),
|
|
280
|
+
/* @__PURE__ */ E("div", {
|
|
281
|
+
className: "grid gap-4 sm:grid-cols-2",
|
|
282
|
+
children: [/* @__PURE__ */ T(x, { model: e }), /* @__PURE__ */ T(X, { model: e })]
|
|
283
|
+
}),
|
|
284
|
+
/* @__PURE__ */ T(b, { model: e }),
|
|
285
|
+
/* @__PURE__ */ T(Z, { model: e })
|
|
286
|
+
]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
export { Q as EventDetailsTab };
|
|
290
|
+
|
|
291
|
+
//# sourceMappingURL=EventDetailsTab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventDetailsTab.js","names":["_Fragment","DATE_FORMAT","MAX_END_PICKER","TITLE_ERROR_ID","TitleField","useCalendarPage","model","missing","Field","tr","TITLE_INPUT_ID","Input","form","readOnly","title","event","current","AllDayDays","Fragment","DatePicker","update","withStartDate","date","prefs","format","withEndDate","endBesideStartOf","startAt","startWall","endAt","endWall","addDays","TimedWhen","endBesideStart","TimePicker","timeValueOf","minutes","parseTimeValue","time","withStartTime","withEndTime","detail","withEndClock","AllDayAndLength","length","lengthChip","Switch","withAllDay","on","Segmented","withLength","value","LENGTH_CHIPS","formatDuration","durationWords","YourTime","page","own","wallIn","range","formatMinuteRange","formatDay","BusyNotice","busy","overlapWords","words","Notice","AlertTriangle","Button","Users","WhenField","showIssues","issues","ZoneField","TimeZonePicker","withTimeZone","zone","DescriptionField","Textarea","description","EventDetailsTab","RepeatField","CustomRepeat"],"sources":["../../../src/v2/event/EventDetailsTab.tsx"],"sourcesContent":["/**\n * The event dialog's Details tab (BOFF-15698 A2): title; when (a date, start and end times, or\n * the days of an all-day event); All day; the Length chips; repeat (with its Custom builder);\n * time zone; description; and a yellow \"You're busy then\" from the person's own free/busy.\n */\nimport { AlertTriangle, Users } from 'lucide-react';\nimport {\n addDays,\n Button,\n DatePicker,\n Input,\n Notice,\n parseTimeValue,\n Segmented,\n Switch,\n Textarea,\n timeValueOf,\n TimePicker,\n TimeZonePicker,\n} from '@burdenoff/fe-libs/ui';\nimport { formatDay, formatDuration, formatMinuteRange } from '../format';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { overlapWords, TITLE_INPUT_ID } from './dialogLogic';\nimport type { EventDialogModel } from './dialogModel';\nimport {\n endWall,\n LENGTH_CHIPS,\n lengthChip,\n startWall,\n wallIn,\n withAllDay,\n withEndClock,\n withEndDate,\n withEndTime,\n withLength,\n withStartDate,\n withStartTime,\n withTimeZone,\n type EventForm,\n} from './eventForm';\nimport { Field } from './parts';\nimport { CustomRepeat } from './CustomRepeat';\nimport { RepeatField } from './RepeatField';\n\nconst DATE_FORMAT: Intl.DateTimeFormatOptions = { day: 'numeric', month: 'short', year: 'numeric' };\n\n/** The longest an end picker beside its start offers: just under a day. */\nconst MAX_END_PICKER = 1440 - 15;\n\nconst TITLE_ERROR_ID = 'calendar-event-title-error';\n\ntype TabProps = { model: EventDialogModel };\n\nfunction TitleField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, update, readOnly } = model;\n const missing = model.showIssues && model.issues.title;\n return (\n <Field\n label={tr('calendar.v2.eventTitle', 'Title')}\n labelFor={TITLE_INPUT_ID}\n required\n error={\n missing ? tr('calendar.v2.evTitleMissing', 'Add a title to save the event.') : undefined\n }\n errorId={TITLE_ERROR_ID}\n >\n <Input\n id={TITLE_INPUT_ID}\n value={form.title}\n maxLength={200}\n autoComplete=\"off\"\n disabled={readOnly}\n required\n aria-required=\"true\"\n aria-invalid={missing ? true : undefined}\n aria-describedby={missing ? TITLE_ERROR_ID : undefined}\n placeholder={tr('calendar.v2.evTitlePlaceholder', 'For example: Pipeline review')}\n onChange={(event) => {\n const title = event.target.value;\n update((current) => ({ ...current, title }));\n }}\n className=\"h-11 text-base\"\n />\n </Field>\n );\n}\n\n/** The days of an all-day event: first to last. */\nfunction AllDayDays({ model }: TabProps) {\n const { tr, format, prefs, timeZone } = useCalendarPage();\n const { form, update, readOnly } = model;\n return (\n <>\n <DatePicker\n value={form.firstDay}\n onChange={(date) => update((current) => withStartDate(current, date))}\n label={tr('calendar.v2.evFirstDay', 'First day')}\n weekStartsOn={prefs.weekStart}\n locale={format.locale}\n timeZone={timeZone}\n format={DATE_FORMAT}\n disabled={readOnly}\n />\n <span className=\"text-sm text-text-secondary\">{tr('calendar.v2.evTo', 'to')}</span>\n <DatePicker\n value={form.lastDay}\n onChange={(date) => update((current) => withEndDate(current, date))}\n label={tr('calendar.v2.evLastDay', 'Last day')}\n weekStartsOn={prefs.weekStart}\n locale={format.locale}\n timeZone={timeZone}\n min={form.firstDay}\n range={{ start: form.firstDay, end: form.lastDay }}\n format={DATE_FORMAT}\n disabled={readOnly}\n />\n </>\n );\n}\n\n/**\n * Whether the end picker sits beside the start (lengths, ending past midnight) — while the end\n * is within a day of the start; else the end has its own date.\n */\nfunction endBesideStartOf(form: EventForm): boolean {\n const startAt = startWall(form);\n const endAt = endWall(form);\n return (\n endAt.date === startAt.date ||\n (endAt.date === addDays(startAt.date, 1) && endAt.minutes <= startAt.minutes)\n );\n}\n\n/** The date and times of a timed event, on the event's own clock. */\nfunction TimedWhen({ model }: TabProps) {\n const { tr, format, prefs, timeZone } = useCalendarPage();\n const { form, update, readOnly } = model;\n const startAt = startWall(form);\n const endAt = endWall(form);\n const endBesideStart = endBesideStartOf(form);\n return (\n <>\n <DatePicker\n value={startAt.date}\n onChange={(date) => update((current) => withStartDate(current, date))}\n label={tr('calendar.v2.evDate', 'Date')}\n weekStartsOn={prefs.weekStart}\n locale={format.locale}\n timeZone={timeZone}\n format={DATE_FORMAT}\n disabled={readOnly}\n />\n <TimePicker\n value={timeValueOf(startAt.minutes)}\n onChange={(time) => {\n const minutes = parseTimeValue(time);\n if (minutes !== null) update((current) => withStartTime(current, minutes));\n }}\n label={tr('calendar.v2.evStarts', 'Starts')}\n hourCycle={format.hourCycle}\n locale={format.locale}\n disabled={readOnly}\n />\n <span className=\"text-sm text-text-secondary\">{tr('calendar.v2.evTo', 'to')}</span>\n {endBesideStart ? null : (\n <DatePicker\n value={endAt.date}\n onChange={(date) => update((current) => withEndDate(current, date))}\n label={tr('calendar.v2.evEndDate', 'End date')}\n weekStartsOn={prefs.weekStart}\n locale={format.locale}\n timeZone={timeZone}\n min={startAt.date}\n format={DATE_FORMAT}\n disabled={readOnly}\n />\n )}\n <TimePicker\n value={timeValueOf(endAt.minutes)}\n onChange={(time, detail) => {\n const minutes = parseTimeValue(time);\n if (minutes === null) return;\n update((current) =>\n endBesideStart\n ? withEndTime(current, minutes, detail.nextDay)\n : withEndClock(current, minutes)\n );\n }}\n label={tr('calendar.v2.evEnds', 'Ends')}\n hourCycle={format.hourCycle}\n locale={format.locale}\n startTime={endBesideStart ? timeValueOf(startAt.minutes) : undefined}\n maxDuration={MAX_END_PICKER}\n icon={null}\n disabled={readOnly}\n />\n </>\n );\n}\n\n/** The All day switch, and the Length chips for a timed event. */\nfunction AllDayAndLength({ model }: TabProps) {\n const { tr, durationWords } = useCalendarPage();\n const { form, update, readOnly } = model;\n const length = lengthChip(form);\n return (\n <div className=\"flex flex-wrap items-center gap-x-4 gap-y-2\">\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <Switch\n checked={form.allDay}\n onCheckedChange={(on) => update((current) => withAllDay(current, on))}\n disabled={readOnly}\n />\n {tr('calendar.v2.allDay', 'All day')}\n </label>\n {form.allDay ? null : (\n <div className=\"ms-auto flex items-center gap-2 max-sm:ms-0 max-sm:w-full\">\n <span id=\"calendar-event-length\" className=\"text-sm text-text-secondary max-sm:shrink-0\">\n {tr('calendar.v2.evLength', 'Length')}\n </span>\n <Segmented<string>\n aria-labelledby=\"calendar-event-length\"\n value={length === null ? '' : String(length)}\n onValueChange={(value) => update((current) => withLength(current, Number(value)))}\n options={LENGTH_CHIPS.map((minutes) => ({\n value: String(minutes),\n label: formatDuration(minutes, durationWords),\n }))}\n disabled={readOnly}\n className=\"max-sm:flex-1\"\n />\n </div>\n )}\n </div>\n );\n}\n\n/** \"That's 14:00 – 15:00 your time.\", when the event's zone isn't the person's. */\nfunction YourTime({ model }: TabProps) {\n const page = useCalendarPage();\n const { tr, format } = page;\n const { form } = model;\n if (form.allDay || form.timeZone === page.timeZone) return null;\n const own = wallIn(form, page.timeZone);\n const range = formatMinuteRange(own.start.minutes, own.end.minutes, format);\n const time =\n own.start.date === startWall(form).date\n ? range\n : `${formatDay(own.start.date, format, 'short')}, ${range}`;\n return (\n <p className=\"text-xs text-text-secondary\">\n {tr('calendar.v2.evYourTime', 'That’s {{time}} your time.', { time })}\n </p>\n );\n}\n\n/** The yellow \"You're busy then\", from the person's own free/busy, with Find a time. */\nfunction BusyNotice({ model }: TabProps) {\n const page = useCalendarPage();\n const { tr, format } = page;\n const busy = model.me;\n if (model.form.allDay || model.readOnly) return null;\n if (busy.kind !== 'busy' && busy.kind !== 'away' && busy.kind !== 'tentative') return null;\n const time = busy.span\n ? overlapWords(busy.span, { start: model.start, end: model.end }, page.timeZone, format)\n : '';\n let words = (\n <>\n <b>{tr('calendar.v2.evYouBusy', 'You’re busy then.')}</b>{' '}\n {tr('calendar.v2.evYouBusyBody', 'Something else is on your calendar {{time}}.', { time })}\n </>\n );\n if (busy.kind === 'away') words = <b>{tr('calendar.v2.evYouAway', 'You’re away then.')}</b>;\n if (busy.kind === 'tentative') {\n words = (\n <>\n <b>{tr('calendar.v2.evYouMaybe', 'You might be busy then.')}</b>{' '}\n {tr('calendar.v2.evYouMaybeBody', 'You said maybe to something {{time}}.', { time })}\n </>\n );\n }\n return (\n <Notice\n tone=\"warn\"\n icon={AlertTriangle}\n action={\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={model.openFindTime}>\n <Users aria-hidden=\"true\" />\n {tr('calendar.v2.findTime', 'Find a time')}\n </Button>\n }\n >\n {words}\n </Notice>\n );\n}\n\nfunction WhenField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, issues, showIssues } = model;\n return (\n <div className=\"flex flex-col gap-2\" role=\"group\" aria-labelledby=\"calendar-event-when\">\n <span id=\"calendar-event-when\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.evWhen', 'When')}\n </span>\n <div className=\"flex flex-wrap items-center gap-2\">\n {form.allDay ? <AllDayDays model={model} /> : <TimedWhen model={model} />}\n </div>\n {showIssues && issues.when ? (\n <p className=\"text-xs font-medium text-status-error-text\">\n {tr('calendar.v2.evEndBeforeStart', 'The event has to end after it starts.')}\n </p>\n ) : null}\n <AllDayAndLength model={model} />\n <YourTime model={model} />\n <BusyNotice model={model} />\n </div>\n );\n}\n\n/** The event's time zone (a timed event only); its times are on its clock. */\nfunction ZoneField({ model }: TabProps) {\n const page = useCalendarPage();\n const { tr, format } = page;\n const { form, update, readOnly } = model;\n if (form.allDay) return null;\n return (\n <Field\n label={tr('calendar.v2.evTimeZone', 'Time zone')}\n hint={\n form.timeZone === page.timeZone\n ? undefined\n : tr('calendar.v2.evOtherZone', 'Not your time zone: the times above are its own.')\n }\n >\n <TimeZonePicker\n value={form.timeZone}\n onChange={(zone) => update((current) => withTimeZone(current, zone))}\n suggested={[page.timeZone]}\n suggestedLabel={tr('calendar.v2.evYourZone', 'Yours')}\n referenceDate={startWall(form).date}\n locale={format.locale}\n label={tr('calendar.v2.evTimeZone', 'Time zone')}\n disabled={readOnly}\n className=\"w-full\"\n />\n </Field>\n );\n}\n\nfunction DescriptionField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, update, readOnly } = model;\n return (\n <Field\n label={tr('calendar.v2.evDescription', 'Description')}\n labelFor=\"calendar-event-description\"\n >\n <Textarea\n id=\"calendar-event-description\"\n value={form.description}\n rows={4}\n disabled={readOnly}\n placeholder={tr('calendar.v2.evDescriptionPlaceholder', 'Agenda, links, what to prepare')}\n onChange={(event) => {\n const description = event.target.value;\n update((current) => ({ ...current, description }));\n }}\n className=\"min-h-24\"\n />\n </Field>\n );\n}\n\nexport function EventDetailsTab({ model }: TabProps) {\n return (\n <div className=\"flex flex-col gap-5\">\n <TitleField model={model} />\n <WhenField model={model} />\n <div className=\"grid gap-4 sm:grid-cols-2\">\n <RepeatField model={model} />\n <ZoneField model={model} />\n </div>\n <CustomRepeat model={model} />\n <DescriptionField model={model} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AA4CA,IAAMC,IAA0C;CAAE,KAAK;CAAW,OAAO;CAAS,MAAM;AAAU,GAG5FC,IAAiB,MAEjBC,IAAiB;AAIvB,SAASC,EAAW,EAAE,YAAmB;CACvC,IAAM,EAAE,UAAOC,EAAgB,GACzB,EAAE,SAAM,WAAQ,gBAAaC,GAC7BC,IAAUD,EAAM,cAAcA,EAAM,OAAO;CACjD,OACE,kBAACE,GAAD;EACE,OAAOC,EAAG,0BAA0B,OAAO;EAC3C,UAAUC;EACV,UAAA;EACA,OACEH,IAAUE,EAAG,8BAA8B,gCAAgC,IAAI,KAAA;EAEjF,SAASN;EAET,UAAA,kBAACQ,GAAD;GACE,IAAID;GACJ,OAAOE,EAAK;GACZ,W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dialogModel';
|
|
2
|
+
import { EventForm } from './eventForm';
|
|
3
|
+
import { ScopeChoice } from './savePlan';
|
|
4
|
+
import { EditedEvent } from './useEventData';
|
|
5
|
+
/** What the event dialog is working on; the host keeps it while Find a time is open. */
|
|
6
|
+
export interface EventSession {
|
|
7
|
+
/** The event edited; null for a new one (until it saves). */
|
|
8
|
+
eventId: string | null;
|
|
9
|
+
form: EventForm;
|
|
10
|
+
/** The form as it opened, to tell whether anything changed. */
|
|
11
|
+
initial: EventForm;
|
|
12
|
+
tab: EventTab;
|
|
13
|
+
scope: ScopeChoice;
|
|
14
|
+
}
|
|
15
|
+
type SessionChange = (change: (session: EventSession) => EventSession) => void;
|
|
16
|
+
export declare function EventDialog({ session, edited, onChange, onClose, onFindTime, }: {
|
|
17
|
+
/** Null while the event to edit loads (or can't be read). */
|
|
18
|
+
session: EventSession | null;
|
|
19
|
+
edited: EditedEvent;
|
|
20
|
+
/** Changes the session, from its latest state (a save's answer can come after more typing). */
|
|
21
|
+
onChange: SessionChange;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
onFindTime: (session: EventSession) => void;
|
|
24
|
+
}): import('react').JSX.Element;
|
|
25
|
+
export {};
|