@burdenoff/microfe-calendar 2026.704.2 → 2026.704.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.
|
@@ -5,20 +5,28 @@ import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
|
5
5
|
function i({ event: i }) {
|
|
6
6
|
let a = t(), o = (e) => {
|
|
7
7
|
e.stopPropagation(), a(i);
|
|
8
|
-
}, s = i.
|
|
8
|
+
}, s = i.calendarColor ?? "var(--color-action-primary-bg)", c = i.status === "CANCELLED", l = i.isAllDay;
|
|
9
9
|
return /* @__PURE__ */ r("button", {
|
|
10
10
|
type: "button",
|
|
11
11
|
onClick: o,
|
|
12
|
-
style:
|
|
13
|
-
className:
|
|
14
|
-
title: `${i.title} (${e(i.startTime)} - ${e(i.endTime)})`,
|
|
15
|
-
children: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
style: l ? { borderLeftColor: s } : void 0,
|
|
13
|
+
className: l ? "group flex w-full items-center gap-1 truncate rounded-radius-sm border-l-[3px] bg-bg-elevated px-1.5 py-0.5 text-left font-text-xs text-text-primary transition-colors hover:bg-bg-canvas" : "group flex w-full items-center gap-1.5 truncate rounded-radius-sm px-1 py-0.5 text-left font-text-xs text-text-primary transition-colors hover:bg-bg-elevated",
|
|
14
|
+
title: i.isAllDay ? i.title : `${i.title} (${e(i.startTime)} - ${e(i.endTime)})`,
|
|
15
|
+
children: [
|
|
16
|
+
!l && /* @__PURE__ */ n("span", {
|
|
17
|
+
className: "size-1.5 shrink-0 rounded-full",
|
|
18
|
+
style: { backgroundColor: s },
|
|
19
|
+
"aria-hidden": "true"
|
|
20
|
+
}),
|
|
21
|
+
!i.isAllDay && /* @__PURE__ */ n("span", {
|
|
22
|
+
className: "shrink-0 tabular-nums text-text-tertiary",
|
|
23
|
+
children: e(i.startTime)
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ n("span", {
|
|
26
|
+
className: `truncate font-weight-medium ${c ? "line-through opacity-60" : ""}`,
|
|
27
|
+
children: i.title
|
|
28
|
+
})
|
|
29
|
+
]
|
|
22
30
|
});
|
|
23
31
|
}
|
|
24
32
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventBlock.js","names":[],"sources":["../../src/components/EventBlock.tsx"],"sourcesContent":["/**\n * EventBlock —
|
|
1
|
+
{"version":3,"file":"EventBlock.js","names":[],"sources":["../../src/components/EventBlock.tsx"],"sourcesContent":["/**\n * EventBlock — a single event chip inside a calendar cell.\n *\n * Google-Calendar-style rendering, theme-safe (no arbitrary text-on-color\n * contrast):\n * - All-day events (incl. PlanMagnet task/milestone overlays) → a soft chip\n * with a colored left bar carrying the event colour.\n * - Timed events → a colored dot + start time + title.\n * Clicking routes through useOpenEvent (opens detail / deep-links).\n */\n\nimport { useOpenEvent } from '../hooks/useOpenEvent';\nimport { formatTime } from '../utils/dateHelpers';\nimport type { CalendarEvent } from '../types';\n\ninterface EventBlockProps {\n event: CalendarEvent;\n}\n\nexport function EventBlock({ event }: EventBlockProps) {\n const openEvent = useOpenEvent();\n\n const handleClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n openEvent(event);\n };\n\n const color = event.calendarColor ?? 'var(--color-action-primary-bg)';\n const cancelled = event.status === 'CANCELLED';\n\n // All-day events (and the always-all-day task/milestone overlays) read as a\n // soft bar with a colored left edge; timed events read as a dot + time (the\n // classic month-grid distinction). Neither puts text on an arbitrary colour,\n // so contrast stays theme-safe.\n const asBar = event.isAllDay;\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n style={asBar ? { borderLeftColor: color } : undefined}\n className={\n asBar\n ? 'group flex w-full items-center gap-1 truncate rounded-radius-sm border-l-[3px] bg-bg-elevated px-1.5 py-0.5 text-left font-text-xs text-text-primary transition-colors hover:bg-bg-canvas'\n : 'group flex w-full items-center gap-1.5 truncate rounded-radius-sm px-1 py-0.5 text-left font-text-xs text-text-primary transition-colors hover:bg-bg-elevated'\n }\n title={\n event.isAllDay\n ? event.title\n : `${event.title} (${formatTime(event.startTime)} - ${formatTime(event.endTime)})`\n }\n >\n {!asBar && (\n <span\n className=\"size-1.5 shrink-0 rounded-full\"\n style={{ backgroundColor: color }}\n aria-hidden=\"true\"\n />\n )}\n {!event.isAllDay && (\n <span className=\"shrink-0 tabular-nums text-text-tertiary\">\n {formatTime(event.startTime)}\n </span>\n )}\n <span className={`truncate font-weight-medium ${cancelled ? 'line-through opacity-60' : ''}`}>\n {event.title}\n </span>\n </button>\n );\n}\n"],"mappings":";;;;AAmBA,SAAgB,EAAW,EAAE,YAA0B;CACrD,IAAM,IAAY,GAAc,EAE1B,KAAe,MAAwB;AAE3C,EADA,EAAE,iBAAiB,EACnB,EAAU,EAAM;IAGZ,IAAQ,EAAM,iBAAiB,kCAC/B,IAAY,EAAM,WAAW,aAM7B,IAAQ,EAAM;AAEpB,QACE,kBAAC,UAAD;EACE,MAAK;EACL,SAAS;EACT,OAAO,IAAQ,EAAE,iBAAiB,GAAO,GAAG,KAAA;EAC5C,WACE,IACI,8LACA;EAEN,OACE,EAAM,WACF,EAAM,QACN,GAAG,EAAM,MAAM,IAAI,EAAW,EAAM,UAAU,CAAC,KAAK,EAAW,EAAM,QAAQ,CAAC;YAZtF;GAeG,CAAC,KACA,kBAAC,QAAD;IACE,WAAU;IACV,OAAO,EAAE,iBAAiB,GAAO;IACjC,eAAY;IACZ,CAAA;GAEH,CAAC,EAAM,YACN,kBAAC,QAAD;IAAM,WAAU;cACb,EAAW,EAAM,UAAU;IACvB,CAAA;GAET,kBAAC,QAAD;IAAM,WAAW,+BAA+B,IAAY,4BAA4B;cACrF,EAAM;IACF,CAAA;GACA"}
|
|
@@ -35,9 +35,9 @@ function m({ onCreateSlot: m }) {
|
|
|
35
35
|
children: y("calendar.loadingEvents", "Loading events...")
|
|
36
36
|
}),
|
|
37
37
|
/* @__PURE__ */ f("div", {
|
|
38
|
-
className: "grid grid-cols-7 border-b border-border-default
|
|
38
|
+
className: "grid grid-cols-7 border-b border-border-default",
|
|
39
39
|
children: w.map((e) => /* @__PURE__ */ f("div", {
|
|
40
|
-
className: "
|
|
40
|
+
className: "py-2 text-center font-text-xs font-weight-medium uppercase tracking-wide text-text-tertiary",
|
|
41
41
|
children: e
|
|
42
42
|
}, e))
|
|
43
43
|
}),
|
|
@@ -53,18 +53,19 @@ function m({ onCreateSlot: m }) {
|
|
|
53
53
|
onKeyDown: m ? (t) => {
|
|
54
54
|
t.target === t.currentTarget && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), m(e));
|
|
55
55
|
} : void 0,
|
|
56
|
-
className: `min-h-[
|
|
56
|
+
className: `flex min-h-[112px] flex-col gap-1 border-b border-r border-border-subtle p-1.5 transition-colors ${m ? "cursor-pointer hover:bg-bg-elevated" : ""} ${t ? "bg-bg-surface" : "bg-bg-canvas"}`,
|
|
57
57
|
children: [/* @__PURE__ */ f("div", {
|
|
58
|
-
className: `
|
|
58
|
+
className: `flex size-6 items-center justify-center self-start rounded-full font-text-sm tabular-nums ${n ? "bg-action-primary-bg font-weight-semibold text-action-primary-fg" : t ? "text-text-primary" : "text-text-tertiary"}`,
|
|
59
59
|
children: e.getDate()
|
|
60
60
|
}), /* @__PURE__ */ p("div", {
|
|
61
|
-
className: "
|
|
61
|
+
className: "flex flex-col gap-0.5",
|
|
62
62
|
children: [r.slice(0, 3).map((e) => /* @__PURE__ */ f(l, { event: e }, e.id)), r.length > 3 && /* @__PURE__ */ p("span", {
|
|
63
|
-
className: "font-text-xs text-text-
|
|
63
|
+
className: "px-1 font-text-xs font-weight-medium text-text-secondary",
|
|
64
64
|
children: [
|
|
65
65
|
"+",
|
|
66
66
|
r.length - 3,
|
|
67
|
-
"
|
|
67
|
+
" ",
|
|
68
|
+
y("calendar.more", "more")
|
|
68
69
|
]
|
|
69
70
|
})]
|
|
70
71
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthView.js","names":[],"sources":["../../src/components/MonthView.tsx"],"sourcesContent":["import { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useCalendarStore } from '../store/calendarStore';\nimport {\n getMonthDates,\n isSameDay,\n isToday,\n startOfMonth,\n startOfWeek,\n endOfWeek,\n endOfMonth,\n} from '../utils/dateHelpers';\nimport { useEvents } from '../hooks/useEvents';\nimport { EventBlock } from './EventBlock';\nimport { CalendarErrorState } from './CalendarErrorState';\nimport type { CalendarEvent } from '../types';\n\ninterface MonthViewProps {\n /** Open the create-event modal pre-filled with the clicked day. Omitted when the user can't create events. */\n onCreateSlot?: (date: Date, hour?: number) => void;\n}\n\n/**\n * Month view component\n * Shows a traditional month calendar grid with real events\n */\nexport function MonthView({ onCreateSlot }: MonthViewProps) {\n const currentDate = useCalendarStore((state) => state.currentDate);\n const monthDates = getMonthDates(currentDate);\n const monthStart = startOfMonth(currentDate);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n // Fetch events for the entire visible month range (including padding days)\n const rangeStart = startOfWeek(startOfMonth(currentDate));\n const rangeEnd = endOfWeek(endOfMonth(currentDate));\n const { events, isLoading, error, refetch } = useEvents({\n startDate: rangeStart,\n endDate: rangeEnd,\n });\n\n const dayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\n const getEventsForDate = (date: Date): CalendarEvent[] => {\n return events.filter((event) => isSameDay(event.startTime, date));\n };\n\n return (\n <div className=\"@container\">\n {error && <CalendarErrorState message={error} onRetry={() => void refetch()} />}\n <div className=\"bg-bg-surface border border-border-default rounded-radius-lg overflow-hidden\">\n {/* Loading indicator */}\n {isLoading && (\n <div className=\"text-center py-1 text-text-tertiary font-text-xs bg-bg-canvas border-b border-border-subtle\">\n {tr('calendar.loadingEvents', 'Loading events...')}\n </div>\n )}\n\n {/* Day headers */}\n <div className=\"grid grid-cols-7 border-b border-border-default
|
|
1
|
+
{"version":3,"file":"MonthView.js","names":[],"sources":["../../src/components/MonthView.tsx"],"sourcesContent":["import { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useCalendarStore } from '../store/calendarStore';\nimport {\n getMonthDates,\n isSameDay,\n isToday,\n startOfMonth,\n startOfWeek,\n endOfWeek,\n endOfMonth,\n} from '../utils/dateHelpers';\nimport { useEvents } from '../hooks/useEvents';\nimport { EventBlock } from './EventBlock';\nimport { CalendarErrorState } from './CalendarErrorState';\nimport type { CalendarEvent } from '../types';\n\ninterface MonthViewProps {\n /** Open the create-event modal pre-filled with the clicked day. Omitted when the user can't create events. */\n onCreateSlot?: (date: Date, hour?: number) => void;\n}\n\n/**\n * Month view component\n * Shows a traditional month calendar grid with real events\n */\nexport function MonthView({ onCreateSlot }: MonthViewProps) {\n const currentDate = useCalendarStore((state) => state.currentDate);\n const monthDates = getMonthDates(currentDate);\n const monthStart = startOfMonth(currentDate);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n // Fetch events for the entire visible month range (including padding days)\n const rangeStart = startOfWeek(startOfMonth(currentDate));\n const rangeEnd = endOfWeek(endOfMonth(currentDate));\n const { events, isLoading, error, refetch } = useEvents({\n startDate: rangeStart,\n endDate: rangeEnd,\n });\n\n const dayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\n const getEventsForDate = (date: Date): CalendarEvent[] => {\n return events.filter((event) => isSameDay(event.startTime, date));\n };\n\n return (\n <div className=\"@container\">\n {error && <CalendarErrorState message={error} onRetry={() => void refetch()} />}\n <div className=\"bg-bg-surface border border-border-default rounded-radius-lg overflow-hidden\">\n {/* Loading indicator */}\n {isLoading && (\n <div className=\"text-center py-1 text-text-tertiary font-text-xs bg-bg-canvas border-b border-border-subtle\">\n {tr('calendar.loadingEvents', 'Loading events...')}\n </div>\n )}\n\n {/* Day headers */}\n <div className=\"grid grid-cols-7 border-b border-border-default\">\n {dayNames.map((day) => (\n <div\n key={day}\n className=\"py-2 text-center font-text-xs font-weight-medium uppercase tracking-wide text-text-tertiary\"\n >\n {day}\n </div>\n ))}\n </div>\n\n {/* Calendar grid */}\n <div className=\"grid grid-cols-7\">\n {monthDates.map((date) => {\n const inCurrentMonth = date.getMonth() === monthStart.getMonth();\n const today = isToday(date);\n const dayEvents = getEventsForDate(date);\n\n return (\n <div\n key={date.toISOString()}\n role={onCreateSlot ? 'button' : undefined}\n tabIndex={onCreateSlot ? 0 : undefined}\n aria-label={\n onCreateSlot\n ? tr('calendar.createEventOnDay', 'Create event on this day')\n : undefined\n }\n onClick={onCreateSlot ? () => onCreateSlot(date) : undefined}\n onKeyDown={\n onCreateSlot\n ? (e) => {\n // Ignore key events bubbling up from a focused EventBlock\n // inside the cell (it stops click, not keydown) — only\n // act when the cell itself is focused.\n if (e.target !== e.currentTarget) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onCreateSlot(date);\n }\n }\n : undefined\n }\n className={`flex min-h-[112px] flex-col gap-1 border-b border-r border-border-subtle p-1.5 transition-colors ${\n onCreateSlot ? 'cursor-pointer hover:bg-bg-elevated' : ''\n } ${!inCurrentMonth ? 'bg-bg-canvas' : 'bg-bg-surface'}`}\n >\n <div\n className={`flex size-6 items-center justify-center self-start rounded-full font-text-sm tabular-nums ${\n today\n ? 'bg-action-primary-bg font-weight-semibold text-action-primary-fg'\n : inCurrentMonth\n ? 'text-text-primary'\n : 'text-text-tertiary'\n }`}\n >\n {date.getDate()}\n </div>\n\n {/* Events for this date */}\n <div className=\"flex flex-col gap-0.5\">\n {dayEvents.slice(0, 3).map((event) => (\n <EventBlock key={event.id} event={event} />\n ))}\n {dayEvents.length > 3 && (\n <span className=\"px-1 font-text-xs font-weight-medium text-text-secondary\">\n +{dayEvents.length - 3} {tr('calendar.more', 'more')}\n </span>\n )}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n"],"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