@kumix/ui 0.3.2 → 0.3.4
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/README.md +4 -6
- package/dist/components/motion/animated-toast-stack.js +3 -3
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/button/base.d.ts +8 -1
- package/dist/components/motion/button/base.d.ts.map +1 -1
- package/dist/components/motion/button/base.js +14 -1
- package/dist/components/motion/button/base.js.map +1 -1
- package/dist/components/motion/button/index.d.ts +2 -2
- package/dist/components/motion/button/index.js +2 -2
- package/dist/components/motion/checkbox.d.ts +3 -1
- package/dist/components/motion/checkbox.d.ts.map +1 -1
- package/dist/components/motion/checkbox.js +2 -1
- package/dist/components/motion/checkbox.js.map +1 -1
- package/dist/components/motion/morphing-tabs.d.ts +36 -0
- package/dist/components/motion/morphing-tabs.d.ts.map +1 -0
- package/dist/components/motion/morphing-tabs.js +518 -0
- package/dist/components/motion/morphing-tabs.js.map +1 -0
- package/dist/components/motion/signup-form.d.ts +56 -0
- package/dist/components/motion/signup-form.d.ts.map +1 -0
- package/dist/components/motion/signup-form.js +337 -0
- package/dist/components/motion/signup-form.js.map +1 -0
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
- package/dist/components/reui/data-grid/data-grid.d.ts +4 -0
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +6 -2
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +32 -1
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +32 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +19 -4
- package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js +16 -4
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js +33 -5
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
- package/dist/components/reui/filters.js +3 -3
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-view.js +3 -3
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/reui/number-field.d.ts +3 -3
- package/dist/components/reui/phone-input.js +1 -1
- package/dist/components/reui/rating.d.ts +1 -1
- package/dist/components/ui/attachment.d.ts +3 -3
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/questionnaire.d.ts +2 -1
- package/dist/components/ui/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/questionnaire.js +11 -4
- package/dist/components/ui/questionnaire.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +2 -2
- package/dist/components/ui/toggle.d.ts +1 -1
- package/package.json +74 -9
|
@@ -42,6 +42,37 @@ declare const EVENT_CALENDAR_GHOST: {
|
|
|
42
42
|
* can import and reuse it.
|
|
43
43
|
*/
|
|
44
44
|
declare const EVENT_CALENDAR_FADE_TRUNCATE = "w-full truncate @max-[10rem]:text-clip @max-[10rem]:[mask-image:linear-gradient(to_right,#000_calc(100%-0.75rem),transparent)] @max-[10rem]:rtl:[mask-image:linear-gradient(to_left,#000_calc(100%-0.75rem),transparent)]";
|
|
45
|
+
/**
|
|
46
|
+
* The drag-to-create selection, shared by every view so the gesture looks the
|
|
47
|
+
* same wherever it happens: a dashed primary outline over a faint primary wash,
|
|
48
|
+
* with the range being drawn printed inside it.
|
|
49
|
+
*
|
|
50
|
+
* Two shapes, because a draft occupies space differently per view:
|
|
51
|
+
* - `box` - one contiguous region, used by the timed grid where a draft is a
|
|
52
|
+
* single minute-positioned rectangle.
|
|
53
|
+
* - `segment` - one day-cell's slice of a draft that runs across several cells
|
|
54
|
+
* (month grid, all-day row). Side borders and rounded corners land only on
|
|
55
|
+
* the run's two ends, so a multi-day selection reads as one dashed box rather
|
|
56
|
+
* than a row of separate ones.
|
|
57
|
+
*/
|
|
58
|
+
declare const EVENT_CALENDAR_SLOT_DRAFT: {
|
|
59
|
+
readonly box: "rounded-sm border border-dashed border-primary/40 bg-primary/5";
|
|
60
|
+
readonly segment: "border-y border-dashed border-primary/40";
|
|
61
|
+
readonly segmentStart: "rounded-s-sm border-s";
|
|
62
|
+
readonly segmentEnd: "rounded-e-sm border-e";
|
|
63
|
+
/**
|
|
64
|
+
* The wash for segmented views. Belongs on the CELL, not on the dashed
|
|
65
|
+
* overlay: the overlay stacks above the event chips, so tinting it would
|
|
66
|
+
* wash the chips instead of the empty cell behind them.
|
|
67
|
+
*/
|
|
68
|
+
readonly surface: "bg-primary/5";
|
|
69
|
+
/**
|
|
70
|
+
* The range readout. `leading-none` is load-bearing: the shortest timed draft
|
|
71
|
+
* is one interval tall (16px at the default hour height), and anything looser
|
|
72
|
+
* renders ~18px and gets clipped by the draft's own overflow-hidden.
|
|
73
|
+
*/
|
|
74
|
+
readonly label: "text-primary truncate px-1 py-0.5 text-[0.6875rem] leading-none font-medium";
|
|
75
|
+
};
|
|
45
76
|
interface EventCalendarChipContextValue<TData = unknown> {
|
|
46
77
|
occurrence: EventCalendarOccurrence<TData>;
|
|
47
78
|
segment: EventCalendarSegment<TData>;
|
|
@@ -69,5 +100,5 @@ interface EventCalendarEventProps<TData = unknown> extends Omit<useRender.Compon
|
|
|
69
100
|
*/
|
|
70
101
|
declare function EventCalendarEvent<TData = unknown>({ segment, className, render, children, preview, ...props }: EventCalendarEventProps<TData>): import("react").JSX.Element;
|
|
71
102
|
//#endregion
|
|
72
|
-
export { EVENT_CALENDAR_COLORS, EVENT_CALENDAR_FADE_TRUNCATE, EVENT_CALENDAR_GHOST, type EventCalendarChipContextValue, EventCalendarEvent, type EventCalendarEventProps, useEventCalendarEventChip };
|
|
103
|
+
export { EVENT_CALENDAR_COLORS, EVENT_CALENDAR_FADE_TRUNCATE, EVENT_CALENDAR_GHOST, EVENT_CALENDAR_SLOT_DRAFT, type EventCalendarChipContextValue, EventCalendarEvent, type EventCalendarEventProps, useEventCalendarEventChip };
|
|
73
104
|
//# sourceMappingURL=event-calendar-event.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-calendar-event.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-event.tsx"],"mappings":";;;;;;;;cAwBM,uBAAuB;EAAQ;EAAc;;;;;;;;;;;;;;;cA0B7C;;;;;;;;;;;;;;;;;;cAmBA
|
|
1
|
+
{"version":3,"file":"event-calendar-event.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-event.tsx"],"mappings":";;;;;;;;cAwBM,uBAAuB;EAAQ;EAAc;;;;;;;;;;;;;;;cA0B7C;;;;;;;;;;;;;;;;;;cAmBA;;;;;;;;;;;;;;cAgBA;;;;;;;;;;;;;;;;;;UAmBI,8BAA8B;EACtC,YAAY,wBAAwB;EACpC,SAAS,qBAAqB;EAC9B;EACA;;;iBAQO,0BAA0B,oBAAoB,8BAA8B;UAQ3E,wBAAwB,yBACxB,KAAK,UAAU;EACvB,SAAS,qBAAqB;;EAE9B,WAAW;;;;;;EAMX;;;;;;;;iBASO,mBAAmB,mBAC1B,SACA,WACA,QACA,UACA,YACG,SACF,wBAAwB,yBAAM,IAAA"}
|
|
@@ -89,6 +89,37 @@ const EVENT_CALENDAR_GHOST = {
|
|
|
89
89
|
* can import and reuse it.
|
|
90
90
|
*/
|
|
91
91
|
const EVENT_CALENDAR_FADE_TRUNCATE = "w-full truncate @max-[10rem]:text-clip @max-[10rem]:[mask-image:linear-gradient(to_right,#000_calc(100%-0.75rem),transparent)] @max-[10rem]:rtl:[mask-image:linear-gradient(to_left,#000_calc(100%-0.75rem),transparent)]";
|
|
92
|
+
/**
|
|
93
|
+
* The drag-to-create selection, shared by every view so the gesture looks the
|
|
94
|
+
* same wherever it happens: a dashed primary outline over a faint primary wash,
|
|
95
|
+
* with the range being drawn printed inside it.
|
|
96
|
+
*
|
|
97
|
+
* Two shapes, because a draft occupies space differently per view:
|
|
98
|
+
* - `box` - one contiguous region, used by the timed grid where a draft is a
|
|
99
|
+
* single minute-positioned rectangle.
|
|
100
|
+
* - `segment` - one day-cell's slice of a draft that runs across several cells
|
|
101
|
+
* (month grid, all-day row). Side borders and rounded corners land only on
|
|
102
|
+
* the run's two ends, so a multi-day selection reads as one dashed box rather
|
|
103
|
+
* than a row of separate ones.
|
|
104
|
+
*/
|
|
105
|
+
const EVENT_CALENDAR_SLOT_DRAFT = {
|
|
106
|
+
box: "rounded-sm border border-dashed border-primary/40 bg-primary/5",
|
|
107
|
+
segment: "border-y border-dashed border-primary/40",
|
|
108
|
+
segmentStart: "rounded-s-sm border-s",
|
|
109
|
+
segmentEnd: "rounded-e-sm border-e",
|
|
110
|
+
/**
|
|
111
|
+
* The wash for segmented views. Belongs on the CELL, not on the dashed
|
|
112
|
+
* overlay: the overlay stacks above the event chips, so tinting it would
|
|
113
|
+
* wash the chips instead of the empty cell behind them.
|
|
114
|
+
*/
|
|
115
|
+
surface: "bg-primary/5",
|
|
116
|
+
/**
|
|
117
|
+
* The range readout. `leading-none` is load-bearing: the shortest timed draft
|
|
118
|
+
* is one interval tall (16px at the default hour height), and anything looser
|
|
119
|
+
* renders ~18px and gets clipped by the draft's own overflow-hidden.
|
|
120
|
+
*/
|
|
121
|
+
label: "text-primary truncate px-1 py-0.5 text-[0.6875rem] leading-none font-medium"
|
|
122
|
+
};
|
|
92
123
|
const EventCalendarChipContext = createContext(null);
|
|
93
124
|
/** The chip's subject; usable inside renderEvent content and chip children. */
|
|
94
125
|
function useEventCalendarEventChip() {
|
|
@@ -297,6 +328,6 @@ function EventCalendarEvent({ segment, className, render, children, preview = fa
|
|
|
297
328
|
});
|
|
298
329
|
}
|
|
299
330
|
//#endregion
|
|
300
|
-
export { EVENT_CALENDAR_COLORS, EVENT_CALENDAR_FADE_TRUNCATE, EVENT_CALENDAR_GHOST, EventCalendarEvent, useEventCalendarEventChip };
|
|
331
|
+
export { EVENT_CALENDAR_COLORS, EVENT_CALENDAR_FADE_TRUNCATE, EVENT_CALENDAR_GHOST, EVENT_CALENDAR_SLOT_DRAFT, EventCalendarEvent, useEventCalendarEventChip };
|
|
301
332
|
|
|
302
333
|
//# sourceMappingURL=event-calendar-event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-calendar-event.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-event.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, createContext, type ReactNode, useContext, useMemo } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, format } from \"date-fns\";\nimport { RepeatIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n useEventCalendar,\n useEventCalendarSelector,\n useEventCalendarViewConfig,\n useEventCalendarViewContext,\n} from \"./event-calendar\";\nimport { markChipPress, useEventCalendarGestures, wasRecentDrag } from \"./event-calendar-dnd\";\nimport { spansMultipleDays, toZoned, zonedStartOfDay } from \"./event-calendar-lib\";\nimport type { EventCalendarOccurrence, EventCalendarSegment } from \"./event-calendar-types\";\n\n/**\n * Effective Tailwind palette presets for event colors; every entry works on\n * light and dark surfaces through the chip's alpha background + accent border.\n */\nconst EVENT_CALENDAR_COLORS: Array<{ name: string; value: string }> = [\n { name: \"Blue\", value: \"var(--color-blue-500)\" },\n { name: \"Emerald\", value: \"var(--color-emerald-500)\" },\n { name: \"Violet\", value: \"var(--color-violet-500)\" },\n { name: \"Rose\", value: \"var(--color-rose-500)\" },\n { name: \"Amber\", value: \"var(--color-amber-500)\" },\n { name: \"Cyan\", value: \"var(--color-cyan-500)\" },\n { name: \"Orange\", value: \"var(--color-orange-500)\" },\n { name: \"Pink\", value: \"var(--color-pink-500)\" },\n { name: \"Teal\", value: \"var(--color-teal-500)\" },\n { name: \"Indigo\", value: \"var(--color-indigo-500)\" },\n];\n\n/**\n * Standardized drag-ghost surface treatment, shared verbatim by every view\n * (month, week/day/N-days, resource). One visual language for interactions:\n * - move: the event is CARRIED FREELY - a cursor-attached full clone (built\n * by the dnd engine, data-slot=event-calendar-drag-carry) travels with the\n * pointer; the in-grid ghost is only this faint dashed placeholder marking\n * the snapped drop slot. The source stays dimmed in place.\n * - resize: the event is STRETCHED - the chip itself at the proposed extent\n * with a dashed boundary instead of solid (slight indicator, no elevation).\n * - invalid: destructive tint on the placeholder / dashed clone; the engine\n * adds the not-allowed cursor, a destructive ring on the carry clone, and\n * a cursor-following validation hint.\n */\nconst EVENT_CALENDAR_GHOST = {\n move: \"rounded-sm border border-dashed border-(--ec-event-color)/50 bg-(--ec-event-color)/8\",\n resize: \"rounded-sm border border-dashed border-(--ec-event-color)/70 overflow-hidden\",\n invalid: \"border-destructive/70 bg-destructive/10\",\n invalidResize: \"border-destructive/70\",\n /** Applied to the clone inside an invalid resize ghost. */\n invalidContent: \"opacity-60\",\n} as const;\n\n/**\n * Fade-out truncation for stacked timed blocks: squeezed cascade columns\n * hard-clip titles into a mash of adjacent glyphs; a right-edge mask fade\n * reads cleaner than an ellipsis at those tiny widths. The mask applies ONLY\n * below a 10rem container width - mask-image forces text off subpixel\n * antialiasing onto a grayscale raster layer, so masking every wide chip\n * makes the whole grid read bolder/blurry and shimmer while the window\n * resizes. Wide chips keep a plain ellipsis. Consumer renderEvent content\n * can import and reuse it.\n */\nconst EVENT_CALENDAR_FADE_TRUNCATE =\n \"w-full truncate @max-[10rem]:text-clip @max-[10rem]:[mask-image:linear-gradient(to_right,#000_calc(100%-0.75rem),transparent)] @max-[10rem]:rtl:[mask-image:linear-gradient(to_left,#000_calc(100%-0.75rem),transparent)]\";\n\ninterface EventCalendarChipContextValue<TData = unknown> {\n occurrence: EventCalendarOccurrence<TData>;\n segment: EventCalendarSegment<TData>;\n isDragging: boolean;\n isSelected: boolean;\n}\n\nconst EventCalendarChipContext =\n // biome-ignore lint/suspicious/noExplicitAny: <>\n createContext<EventCalendarChipContextValue<any> | null>(null);\n\n/** The chip's subject; usable inside renderEvent content and chip children. */\nfunction useEventCalendarEventChip<TData = unknown>(): EventCalendarChipContextValue<TData> {\n const ctx = useContext(EventCalendarChipContext);\n if (!ctx) {\n throw new Error(\"useEventCalendarEventChip must be used within <EventCalendarEvent>\");\n }\n return ctx as EventCalendarChipContextValue<TData>;\n}\n\ninterface EventCalendarEventProps<TData = unknown>\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n segment: EventCalendarSegment<TData>;\n /** Replaces the default chip CONTENT; the wrapper stays calendar-owned. */\n children?: ReactNode;\n /**\n * Static drag clone: renders the chip exactly as-is but inert - no gestures,\n * resize handles, selection/drag state, focus, or pointer events. Used for\n * the full-fidelity ghost that tracks the proposed slot during a move.\n */\n preview?: boolean;\n}\n\n/**\n * The one interactive event element used by every view. The wrapper owns\n * positioning hooks, a11y, selection, drag/resize listeners, and data\n * attributes; content comes from children, the root renderEvent override,\n * or the built-in default.\n */\nfunction EventCalendarEvent<TData = unknown>({\n segment,\n className,\n render,\n children,\n preview = false,\n ...props\n}: EventCalendarEventProps<TData>) {\n const instance = useEventCalendar<TData>();\n const viewConfig = useEventCalendarViewConfig<TData>();\n const { view } = useEventCalendarViewContext();\n const gestures = useEventCalendarGestures<TData>();\n const { settings } = instance;\n const occurrence = segment.occurrence;\n const event = occurrence.event;\n\n const isSelectedRaw = useEventCalendarSelector<TData, boolean>(\n (state) => state.selection.eventKeys.includes(occurrence.key),\n { calendar: instance },\n );\n const isDraggingRaw = useEventCalendarSelector<TData, boolean>(\n (state) => state.drag?.occurrence.key === occurrence.key,\n { calendar: instance },\n );\n // reactive, unlike gestures.canResize: api.setInteractions({ resize })\n // must add/remove the handles without waiting for an unrelated re-render\n const resizeOn = useEventCalendarSelector<TData, boolean>((state) => state.interactions.resize, {\n calendar: instance,\n });\n // A preview clone must never inherit the source's selected/dragging state\n // (the drag key matches, which would dim the clone itself).\n const isSelected = preview ? false : isSelectedRaw;\n const isDragging = preview ? false : isDraggingRaw;\n\n const isBar = occurrence.allDay || spansMultipleDays(occurrence, settings.timeZone);\n const inTimeGrid = view === \"week\" || view === \"day\" || view === \"days\" || view === \"resource\";\n const interactive = view !== \"agenda\" && !preview;\n const timedBlock = inTimeGrid && !isBar;\n const horizontalBar = isBar && !inTimeGrid;\n // >= compactEventMinutes renders the stacked (title over time) layout;\n // squeezed cascade columns there fade-truncate instead of hard-clipping\n // into neighbors\n const stackedBlock =\n timedBlock && (segment.endMin ?? 0) - (segment.startMin ?? 0) >= viewConfig.compactEventMinutes;\n\n const defaultContent = (\n <>\n {/* leading color dot for single-row chips (month cells, all-day bars);\n time-grid blocks read their color from the tinted surface instead -\n in the stacked layout a dot would sit alone on the first line */}\n {!timedBlock && (\n <span\n aria-hidden\n data-slot=\"event-calendar-event-dot\"\n // -me-0.5 tightens just the dot-to-title gap (the chip keeps gap-1.5\n // between the title and the trailing time)\n className=\"-me-0.5 size-1.5 shrink-0 rounded-full bg-(--ec-event-color)\"\n />\n )}\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 opacity-70\" aria-hidden=\"true\" />\n )}\n <span className={cn(\"font-medium\", stackedBlock ? EVENT_CALENDAR_FADE_TRUNCATE : \"truncate\")}>\n {event.title}\n </span>\n {/* month cells are narrow: a compact never-shrinking start time keeps\n the title readable; grid views show the full range */}\n {!occurrence.allDay &&\n segment.isStart &&\n (view === \"month\" ? (\n <span className=\"shrink-0 text-muted-foreground\">\n {format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n })}\n </span>\n ) : (\n <span\n className={cn(\n \"@[8rem]:inline hidden text-muted-foreground\",\n stackedBlock ? EVENT_CALENDAR_FADE_TRUNCATE : \"truncate\",\n )}\n >\n {settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n { locale: settings.locale },\n )}\n </span>\n ))}\n </>\n );\n\n // Agenda time text is per-day for multi-day events: the first day reads\n // \"From 9:00 AM\", middle days \"All day\", the last day \"Until 5:00 PM\".\n // Boundaries derive from the occurrence vs segment.day (never the packing\n // flags - lane merging rewrites those on shared segment objects).\n const agendaTimeText = (() => {\n if (view !== \"agenda\") return \"\";\n if (occurrence.allDay) return settings.i18n.labels.allDay;\n const dayStart = zonedStartOfDay(segment.day, settings.timeZone);\n const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);\n const startsBefore = occurrence.start < dayStart;\n const endsAfter = occurrence.end > dayEnd;\n if (startsBefore && endsAfter) return settings.i18n.labels.allDay;\n if (endsAfter) {\n return settings.i18n.labels.timeFrom(\n format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n }),\n );\n }\n if (startsBefore) {\n return settings.i18n.labels.timeUntil(\n format(toZoned(occurrence.end, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n }),\n );\n }\n return settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n false,\n { locale: settings.locale },\n );\n })();\n\n // Agenda default row: time column, color-dot badge, plain title\n const agendaDefaultContent = (\n <>\n <span className=\"w-40 shrink-0 truncate text-muted-foreground tabular-nums\">\n {agendaTimeText}\n </span>\n <span\n aria-hidden\n data-slot=\"event-calendar-agenda-dot\"\n className=\"size-2 shrink-0 rounded-full bg-(--ec-event-color)\"\n />\n <span className=\"truncate text-sm\">{event.title}</span>\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n )}\n </>\n );\n\n // Custom chip content is memoized so a drag - which re-renders the lane on\n // every pointer move - never re-invokes the consumer's renderEvent per frame.\n // The element stays referentially stable across those re-renders, so React\n // skips the custom subtree and it doesn't flicker; on drop only the moved\n // chip's inputs change and recompute. Deps are exactly renderProps' inputs\n // plus the render fns (all stable during an internal drag).\n const customContent = useMemo(() => {\n const renderProps = { occurrence, segment, view, isDragging, isSelected };\n return view === \"agenda\"\n ? viewConfig.renderAgendaEvent?.(renderProps)\n : viewConfig.renderEvent?.(renderProps);\n }, [\n occurrence,\n segment,\n view,\n isDragging,\n isSelected,\n viewConfig.renderAgendaEvent,\n viewConfig.renderEvent,\n ]);\n const content =\n children ?? customContent ?? (view === \"agenda\" ? agendaDefaultContent : defaultContent);\n\n const timeLabel = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n { locale: settings.locale },\n );\n // native hover tooltip text; a consumer formatter returning undefined\n // drops the title attribute entirely (e.g. when it renders its own tooltip)\n const label = settings.i18n.functions.formatEventLabel\n ? settings.i18n.functions.formatEventLabel(event.title, timeLabel)\n : `${event.title}, ${timeLabel}`;\n\n // Optional styled tooltip on hover / keyboard focus (viewConfig.eventTooltip,\n // default off). When on, the native title is dropped so the two never stack;\n // a preview clone never gets one. Content defaults to the label and can be\n // overridden with renderEventTooltip - a falsy result (null/undefined, or\n // the `false`/\"\" that `cond && <node>` yields) falls back to the label, and\n // an empty label (i18n opt-out) leaves no content so the tooltip is skipped.\n const tooltipOpts = typeof viewConfig.eventTooltip === \"object\" ? viewConfig.eventTooltip : null;\n const tooltipContent =\n !preview && viewConfig.eventTooltip\n ? viewConfig.renderEventTooltip?.({\n occurrence,\n segment,\n view,\n label,\n }) || label\n : null;\n const tooltipOn = Boolean(tooltipContent);\n\n const showResize = interactive && resizeOn && !event.readOnly && event.resizable !== false;\n // Hover grip pill (mirrors the gantt bars): a tiny bar inside each resize\n // handle signals the direction. Shown on every resizable chip - compact\n // sub-compactEventMinutes timed blocks included - because the chip\n // min-height (1.5rem) leaves room at the very top/bottom edges without\n // colliding with the vertically-centered title.\n const grip = (\n <span\n aria-hidden\n data-slot=\"event-calendar-resize-grip\"\n className={cn(\n \"rounded-full bg-foreground/40\",\n timedBlock ? \"h-0.5 w-2.5\" : \"h-2.5 w-0.5\",\n viewConfig.classNames?.resizeGrip,\n )}\n />\n );\n const resizeHandles = showResize && (\n <>\n {timedBlock && segment.isStart && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"start\"\n className={cn(\n \"absolute inset-x-1 top-0 flex h-1.5 cursor-ns-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n {grip}\n </span>\n )}\n {timedBlock && segment.isEnd && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"end\"\n className={cn(\n \"absolute inset-x-1 bottom-0 flex h-1.5 cursor-ns-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n {grip}\n </span>\n )}\n {(horizontalBar || (isBar && inTimeGrid)) && segment.isStart && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"start\"\n className={cn(\n \"absolute inset-y-0 start-0 flex w-2 cursor-ew-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n {grip}\n </span>\n )}\n {(horizontalBar || (isBar && inTimeGrid)) && segment.isEnd && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"end\"\n className={cn(\n \"absolute inset-y-0 end-0 flex w-2 cursor-ew-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n {grip}\n </span>\n )}\n </>\n );\n\n const defaultProps = {\n type: \"button\" as const,\n \"data-slot\": \"event-calendar-event\",\n \"data-view\": view,\n \"data-all-day\": occurrence.allDay || undefined,\n \"data-recurring\": occurrence.isRecurring || undefined,\n \"data-selected\": isSelected || undefined,\n \"data-dragging\": isDragging || undefined,\n \"data-preview\": preview || undefined,\n \"data-past\": occurrence.end.getTime() < Date.now() || undefined,\n // native hover reveal for squeezed/faded chips: full title + time (dropped\n // when the styled eventTooltip is on so the two never stack)\n title: preview || tooltipOn ? undefined : label,\n \"aria-label\":\n settings.i18n.functions.formatEventAriaLabel?.(\n event.title,\n timeLabel,\n segment.continuesBefore || segment.continuesAfter,\n ) ??\n `${event.title}, ${timeLabel}${\n segment.continuesBefore || segment.continuesAfter\n ? `, ${settings.i18n.labels.continues}`\n : \"\"\n }`,\n // Selection is otherwise conveyed by a background tint alone; the chip is a\n // real toggle in every interactive view, so a screen reader hears the state\n // (agenda rows never select, previews are inert - both stay unpressed).\n \"aria-pressed\": interactive ? isSelected : undefined,\n \"aria-hidden\": preview || undefined,\n tabIndex: preview ? -1 : undefined,\n style: {\n \"--ec-event-color\": event.color ?? \"var(--color-primary)\",\n } as CSSProperties,\n onPointerDown: (e: React.PointerEvent) => {\n e.stopPropagation();\n // suppress the trailing slot-create click if this press does not turn\n // into a drag (e.g. a locked chip) - see markChipPress\n markChipPress();\n if (interactive) gestures.beginMove(e, segment);\n },\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n if (wasRecentDrag()) return;\n // consumer first: e.preventDefault() opts out of built-in selection\n // (e.g. click = open dialog only, no selected tint)\n settings.onEventClick?.(occurrence, e);\n // the agenda is a read-only list: a click never selects/focuses a row\n if (e.defaultPrevented || view === \"agenda\") return;\n instance.api.selectEvent(occurrence.key);\n },\n onDoubleClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n settings.onEventDoubleClick?.(occurrence, e);\n },\n className: cn(\n \"group/ec-event relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center overflow-hidden text-start text-foreground\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n preview && \"pointer-events-none\",\n view === \"agenda\"\n ? // plain list row: color lives in the dot badge, not a tinted pill;\n // hover AND selection surfaces are owned by the agenda row wrapper\n \"gap-3 rounded-md text-sm\"\n : cn(\n // @container removes intrinsic sizing; only grid chips are containers\n // py-1: room above/below inline badges (attendee pill etc.)\n \"@container gap-1.5 rounded-sm px-1.5 py-1 leading-normal\",\n // soft tint + hairline inset ring: color reads from the surface\n // itself (no accent border), stays legible in light and dark\n \"bg-(--ec-event-color)/15 hover:bg-(--ec-event-color)/25\",\n // a flat tint reads darker over a dark surface, so lift it a little\n // in dark mode to keep a lighter, softer chip tone\n \"dark:bg-(--ec-event-color)/20 dark:hover:bg-(--ec-event-color)/30\",\n \"inset-ring inset-ring-(--ec-event-color)/15\",\n \"transition-[background-color,box-shadow] duration-150\",\n \"data-dragging:opacity-40\",\n \"data-selected:inset-ring-(--ec-event-color)/40 data-selected:bg-(--ec-event-color)/30\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n ),\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {content}\n {resizeHandles}\n </>\n ),\n };\n\n const chip = useRender({\n defaultTagName: \"button\",\n render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n return (\n <EventCalendarChipContext.Provider value={{ occurrence, segment, isDragging, isSelected }}>\n {tooltipOn ? (\n <TooltipProvider delay={tooltipOpts?.delay ?? 600}>\n <Tooltip>\n <TooltipTrigger render={chip} />\n <TooltipContent\n side={tooltipOpts?.side ?? \"top\"}\n className={viewConfig.classNames?.eventTooltip}\n >\n {tooltipContent}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : (\n chip\n )}\n </EventCalendarChipContext.Provider>\n );\n}\n\nexport type { EventCalendarChipContextValue, EventCalendarEventProps };\nexport {\n EVENT_CALENDAR_COLORS,\n EVENT_CALENDAR_FADE_TRUNCATE,\n EVENT_CALENDAR_GHOST,\n EventCalendarEvent,\n useEventCalendarEventChip,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAM,wBAAgE;CACpE;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAW,OAAO;CAA2B;CACrD;EAAE,MAAM;EAAU,OAAO;CAA0B;CACnD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAS,OAAO;CAAyB;CACjD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAU,OAAO;CAA0B;CACnD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAU,OAAO;CAA0B;AACrD;;;;;;;;;;;;;;AAeA,MAAM,uBAAuB;CAC3B,MAAM;CACN,QAAQ;CACR,SAAS;CACT,eAAe;;CAEf,gBAAgB;AAClB;;;;;;;;;;;AAYA,MA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GAC/B,oBAAC,gBAAD;IACE,MAAM,aAAa,QAAQ;IAC3B,WAAW,WAAW,YAAY;IAEjC,UAAA;GACa,CAAA,CACT,EAAA,CAAA;EACM,CAAA,IAEjB;CAE+B,CAAA;AAEvC"}
|
|
1
|
+
{"version":3,"file":"event-calendar-event.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-event.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, createContext, type ReactNode, useContext, useMemo } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, format } from \"date-fns\";\nimport { RepeatIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n useEventCalendar,\n useEventCalendarSelector,\n useEventCalendarViewConfig,\n useEventCalendarViewContext,\n} from \"./event-calendar\";\nimport { markChipPress, useEventCalendarGestures, wasRecentDrag } from \"./event-calendar-dnd\";\nimport { spansMultipleDays, toZoned, zonedStartOfDay } from \"./event-calendar-lib\";\nimport type { EventCalendarOccurrence, EventCalendarSegment } from \"./event-calendar-types\";\n\n/**\n * Effective Tailwind palette presets for event colors; every entry works on\n * light and dark surfaces through the chip's alpha background + accent border.\n */\nconst EVENT_CALENDAR_COLORS: Array<{ name: string; value: string }> = [\n { name: \"Blue\", value: \"var(--color-blue-500)\" },\n { name: \"Emerald\", value: \"var(--color-emerald-500)\" },\n { name: \"Violet\", value: \"var(--color-violet-500)\" },\n { name: \"Rose\", value: \"var(--color-rose-500)\" },\n { name: \"Amber\", value: \"var(--color-amber-500)\" },\n { name: \"Cyan\", value: \"var(--color-cyan-500)\" },\n { name: \"Orange\", value: \"var(--color-orange-500)\" },\n { name: \"Pink\", value: \"var(--color-pink-500)\" },\n { name: \"Teal\", value: \"var(--color-teal-500)\" },\n { name: \"Indigo\", value: \"var(--color-indigo-500)\" },\n];\n\n/**\n * Standardized drag-ghost surface treatment, shared verbatim by every view\n * (month, week/day/N-days, resource). One visual language for interactions:\n * - move: the event is CARRIED FREELY - a cursor-attached full clone (built\n * by the dnd engine, data-slot=event-calendar-drag-carry) travels with the\n * pointer; the in-grid ghost is only this faint dashed placeholder marking\n * the snapped drop slot. The source stays dimmed in place.\n * - resize: the event is STRETCHED - the chip itself at the proposed extent\n * with a dashed boundary instead of solid (slight indicator, no elevation).\n * - invalid: destructive tint on the placeholder / dashed clone; the engine\n * adds the not-allowed cursor, a destructive ring on the carry clone, and\n * a cursor-following validation hint.\n */\nconst EVENT_CALENDAR_GHOST = {\n move: \"rounded-sm border border-dashed border-(--ec-event-color)/50 bg-(--ec-event-color)/8\",\n resize: \"rounded-sm border border-dashed border-(--ec-event-color)/70 overflow-hidden\",\n invalid: \"border-destructive/70 bg-destructive/10\",\n invalidResize: \"border-destructive/70\",\n /** Applied to the clone inside an invalid resize ghost. */\n invalidContent: \"opacity-60\",\n} as const;\n\n/**\n * Fade-out truncation for stacked timed blocks: squeezed cascade columns\n * hard-clip titles into a mash of adjacent glyphs; a right-edge mask fade\n * reads cleaner than an ellipsis at those tiny widths. The mask applies ONLY\n * below a 10rem container width - mask-image forces text off subpixel\n * antialiasing onto a grayscale raster layer, so masking every wide chip\n * makes the whole grid read bolder/blurry and shimmer while the window\n * resizes. Wide chips keep a plain ellipsis. Consumer renderEvent content\n * can import and reuse it.\n */\nconst EVENT_CALENDAR_FADE_TRUNCATE =\n \"w-full truncate @max-[10rem]:text-clip @max-[10rem]:[mask-image:linear-gradient(to_right,#000_calc(100%-0.75rem),transparent)] @max-[10rem]:rtl:[mask-image:linear-gradient(to_left,#000_calc(100%-0.75rem),transparent)]\";\n\n/**\n * The drag-to-create selection, shared by every view so the gesture looks the\n * same wherever it happens: a dashed primary outline over a faint primary wash,\n * with the range being drawn printed inside it.\n *\n * Two shapes, because a draft occupies space differently per view:\n * - `box` - one contiguous region, used by the timed grid where a draft is a\n * single minute-positioned rectangle.\n * - `segment` - one day-cell's slice of a draft that runs across several cells\n * (month grid, all-day row). Side borders and rounded corners land only on\n * the run's two ends, so a multi-day selection reads as one dashed box rather\n * than a row of separate ones.\n */\nconst EVENT_CALENDAR_SLOT_DRAFT = {\n box: \"rounded-sm border border-dashed border-primary/40 bg-primary/5\",\n segment: \"border-y border-dashed border-primary/40\",\n segmentStart: \"rounded-s-sm border-s\",\n segmentEnd: \"rounded-e-sm border-e\",\n /**\n * The wash for segmented views. Belongs on the CELL, not on the dashed\n * overlay: the overlay stacks above the event chips, so tinting it would\n * wash the chips instead of the empty cell behind them.\n */\n surface: \"bg-primary/5\",\n /**\n * The range readout. `leading-none` is load-bearing: the shortest timed draft\n * is one interval tall (16px at the default hour height), and anything looser\n * renders ~18px and gets clipped by the draft's own overflow-hidden.\n */\n label: \"text-primary truncate px-1 py-0.5 text-[0.6875rem] leading-none font-medium\",\n} as const;\n\ninterface EventCalendarChipContextValue<TData = unknown> {\n occurrence: EventCalendarOccurrence<TData>;\n segment: EventCalendarSegment<TData>;\n isDragging: boolean;\n isSelected: boolean;\n}\n\nconst EventCalendarChipContext =\n // biome-ignore lint/suspicious/noExplicitAny: <>\n createContext<EventCalendarChipContextValue<any> | null>(null);\n\n/** The chip's subject; usable inside renderEvent content and chip children. */\nfunction useEventCalendarEventChip<TData = unknown>(): EventCalendarChipContextValue<TData> {\n const ctx = useContext(EventCalendarChipContext);\n if (!ctx) {\n throw new Error(\"useEventCalendarEventChip must be used within <EventCalendarEvent>\");\n }\n return ctx as EventCalendarChipContextValue<TData>;\n}\n\ninterface EventCalendarEventProps<TData = unknown>\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n segment: EventCalendarSegment<TData>;\n /** Replaces the default chip CONTENT; the wrapper stays calendar-owned. */\n children?: ReactNode;\n /**\n * Static drag clone: renders the chip exactly as-is but inert - no gestures,\n * resize handles, selection/drag state, focus, or pointer events. Used for\n * the full-fidelity ghost that tracks the proposed slot during a move.\n */\n preview?: boolean;\n}\n\n/**\n * The one interactive event element used by every view. The wrapper owns\n * positioning hooks, a11y, selection, drag/resize listeners, and data\n * attributes; content comes from children, the root renderEvent override,\n * or the built-in default.\n */\nfunction EventCalendarEvent<TData = unknown>({\n segment,\n className,\n render,\n children,\n preview = false,\n ...props\n}: EventCalendarEventProps<TData>) {\n const instance = useEventCalendar<TData>();\n const viewConfig = useEventCalendarViewConfig<TData>();\n const { view } = useEventCalendarViewContext();\n const gestures = useEventCalendarGestures<TData>();\n const { settings } = instance;\n const occurrence = segment.occurrence;\n const event = occurrence.event;\n\n const isSelectedRaw = useEventCalendarSelector<TData, boolean>(\n (state) => state.selection.eventKeys.includes(occurrence.key),\n { calendar: instance },\n );\n const isDraggingRaw = useEventCalendarSelector<TData, boolean>(\n (state) => state.drag?.occurrence.key === occurrence.key,\n { calendar: instance },\n );\n // reactive, unlike gestures.canResize: api.setInteractions({ resize })\n // must add/remove the handles without waiting for an unrelated re-render\n const resizeOn = useEventCalendarSelector<TData, boolean>((state) => state.interactions.resize, {\n calendar: instance,\n });\n // A preview clone must never inherit the source's selected/dragging state\n // (the drag key matches, which would dim the clone itself).\n const isSelected = preview ? false : isSelectedRaw;\n const isDragging = preview ? false : isDraggingRaw;\n\n const isBar = occurrence.allDay || spansMultipleDays(occurrence, settings.timeZone);\n const inTimeGrid = view === \"week\" || view === \"day\" || view === \"days\" || view === \"resource\";\n const interactive = view !== \"agenda\" && !preview;\n const timedBlock = inTimeGrid && !isBar;\n const horizontalBar = isBar && !inTimeGrid;\n // >= compactEventMinutes renders the stacked (title over time) layout;\n // squeezed cascade columns there fade-truncate instead of hard-clipping\n // into neighbors\n const stackedBlock =\n timedBlock && (segment.endMin ?? 0) - (segment.startMin ?? 0) >= viewConfig.compactEventMinutes;\n\n const defaultContent = (\n <>\n {/* leading color dot for single-row chips (month cells, all-day bars);\n time-grid blocks read their color from the tinted surface instead -\n in the stacked layout a dot would sit alone on the first line */}\n {!timedBlock && (\n <span\n aria-hidden\n data-slot=\"event-calendar-event-dot\"\n // -me-0.5 tightens just the dot-to-title gap (the chip keeps gap-1.5\n // between the title and the trailing time)\n className=\"-me-0.5 size-1.5 shrink-0 rounded-full bg-(--ec-event-color)\"\n />\n )}\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 opacity-70\" aria-hidden=\"true\" />\n )}\n <span className={cn(\"font-medium\", stackedBlock ? EVENT_CALENDAR_FADE_TRUNCATE : \"truncate\")}>\n {event.title}\n </span>\n {/* month cells are narrow: a compact never-shrinking start time keeps\n the title readable; grid views show the full range */}\n {!occurrence.allDay &&\n segment.isStart &&\n (view === \"month\" ? (\n <span className=\"shrink-0 text-muted-foreground\">\n {format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n })}\n </span>\n ) : (\n <span\n className={cn(\n \"@[8rem]:inline hidden text-muted-foreground\",\n stackedBlock ? EVENT_CALENDAR_FADE_TRUNCATE : \"truncate\",\n )}\n >\n {settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n { locale: settings.locale },\n )}\n </span>\n ))}\n </>\n );\n\n // Agenda time text is per-day for multi-day events: the first day reads\n // \"From 9:00 AM\", middle days \"All day\", the last day \"Until 5:00 PM\".\n // Boundaries derive from the occurrence vs segment.day (never the packing\n // flags - lane merging rewrites those on shared segment objects).\n const agendaTimeText = (() => {\n if (view !== \"agenda\") return \"\";\n if (occurrence.allDay) return settings.i18n.labels.allDay;\n const dayStart = zonedStartOfDay(segment.day, settings.timeZone);\n const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);\n const startsBefore = occurrence.start < dayStart;\n const endsAfter = occurrence.end > dayEnd;\n if (startsBefore && endsAfter) return settings.i18n.labels.allDay;\n if (endsAfter) {\n return settings.i18n.labels.timeFrom(\n format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n }),\n );\n }\n if (startsBefore) {\n return settings.i18n.labels.timeUntil(\n format(toZoned(occurrence.end, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n }),\n );\n }\n return settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n false,\n { locale: settings.locale },\n );\n })();\n\n // Agenda default row: time column, color-dot badge, plain title\n const agendaDefaultContent = (\n <>\n <span className=\"w-40 shrink-0 truncate text-muted-foreground tabular-nums\">\n {agendaTimeText}\n </span>\n <span\n aria-hidden\n data-slot=\"event-calendar-agenda-dot\"\n className=\"size-2 shrink-0 rounded-full bg-(--ec-event-color)\"\n />\n <span className=\"truncate text-sm\">{event.title}</span>\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n )}\n </>\n );\n\n // Custom chip content is memoized so a drag - which re-renders the lane on\n // every pointer move - never re-invokes the consumer's renderEvent per frame.\n // The element stays referentially stable across those re-renders, so React\n // skips the custom subtree and it doesn't flicker; on drop only the moved\n // chip's inputs change and recompute. Deps are exactly renderProps' inputs\n // plus the render fns (all stable during an internal drag).\n const customContent = useMemo(() => {\n const renderProps = { occurrence, segment, view, isDragging, isSelected };\n return view === \"agenda\"\n ? viewConfig.renderAgendaEvent?.(renderProps)\n : viewConfig.renderEvent?.(renderProps);\n }, [\n occurrence,\n segment,\n view,\n isDragging,\n isSelected,\n viewConfig.renderAgendaEvent,\n viewConfig.renderEvent,\n ]);\n const content =\n children ?? customContent ?? (view === \"agenda\" ? agendaDefaultContent : defaultContent);\n\n const timeLabel = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n { locale: settings.locale },\n );\n // native hover tooltip text; a consumer formatter returning undefined\n // drops the title attribute entirely (e.g. when it renders its own tooltip)\n const label = settings.i18n.functions.formatEventLabel\n ? settings.i18n.functions.formatEventLabel(event.title, timeLabel)\n : `${event.title}, ${timeLabel}`;\n\n // Optional styled tooltip on hover / keyboard focus (viewConfig.eventTooltip,\n // default off). When on, the native title is dropped so the two never stack;\n // a preview clone never gets one. Content defaults to the label and can be\n // overridden with renderEventTooltip - a falsy result (null/undefined, or\n // the `false`/\"\" that `cond && <node>` yields) falls back to the label, and\n // an empty label (i18n opt-out) leaves no content so the tooltip is skipped.\n const tooltipOpts = typeof viewConfig.eventTooltip === \"object\" ? viewConfig.eventTooltip : null;\n const tooltipContent =\n !preview && viewConfig.eventTooltip\n ? viewConfig.renderEventTooltip?.({\n occurrence,\n segment,\n view,\n label,\n }) || label\n : null;\n const tooltipOn = Boolean(tooltipContent);\n\n const showResize = interactive && resizeOn && !event.readOnly && event.resizable !== false;\n // Hover grip pill (mirrors the gantt bars): a tiny bar inside each resize\n // handle signals the direction. Shown on every resizable chip - compact\n // sub-compactEventMinutes timed blocks included - because the chip\n // min-height (1.5rem) leaves room at the very top/bottom edges without\n // colliding with the vertically-centered title.\n const grip = (\n <span\n aria-hidden\n data-slot=\"event-calendar-resize-grip\"\n className={cn(\n \"rounded-full bg-foreground/40\",\n timedBlock ? \"h-0.5 w-2.5\" : \"h-2.5 w-0.5\",\n viewConfig.classNames?.resizeGrip,\n )}\n />\n );\n const resizeHandles = showResize && (\n <>\n {timedBlock && segment.isStart && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"start\"\n className={cn(\n \"absolute inset-x-1 top-0 flex h-1.5 cursor-ns-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n {grip}\n </span>\n )}\n {timedBlock && segment.isEnd && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"end\"\n className={cn(\n \"absolute inset-x-1 bottom-0 flex h-1.5 cursor-ns-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n {grip}\n </span>\n )}\n {(horizontalBar || (isBar && inTimeGrid)) && segment.isStart && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"start\"\n className={cn(\n \"absolute inset-y-0 start-0 flex w-2 cursor-ew-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n {grip}\n </span>\n )}\n {(horizontalBar || (isBar && inTimeGrid)) && segment.isEnd && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"end\"\n className={cn(\n \"absolute inset-y-0 end-0 flex w-2 cursor-ew-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n {grip}\n </span>\n )}\n </>\n );\n\n const defaultProps = {\n type: \"button\" as const,\n \"data-slot\": \"event-calendar-event\",\n \"data-view\": view,\n \"data-all-day\": occurrence.allDay || undefined,\n \"data-recurring\": occurrence.isRecurring || undefined,\n \"data-selected\": isSelected || undefined,\n \"data-dragging\": isDragging || undefined,\n \"data-preview\": preview || undefined,\n \"data-past\": occurrence.end.getTime() < Date.now() || undefined,\n // native hover reveal for squeezed/faded chips: full title + time (dropped\n // when the styled eventTooltip is on so the two never stack)\n title: preview || tooltipOn ? undefined : label,\n \"aria-label\":\n settings.i18n.functions.formatEventAriaLabel?.(\n event.title,\n timeLabel,\n segment.continuesBefore || segment.continuesAfter,\n ) ??\n `${event.title}, ${timeLabel}${\n segment.continuesBefore || segment.continuesAfter\n ? `, ${settings.i18n.labels.continues}`\n : \"\"\n }`,\n // Selection is otherwise conveyed by a background tint alone; the chip is a\n // real toggle in every interactive view, so a screen reader hears the state\n // (agenda rows never select, previews are inert - both stay unpressed).\n \"aria-pressed\": interactive ? isSelected : undefined,\n \"aria-hidden\": preview || undefined,\n tabIndex: preview ? -1 : undefined,\n style: {\n \"--ec-event-color\": event.color ?? \"var(--color-primary)\",\n } as CSSProperties,\n onPointerDown: (e: React.PointerEvent) => {\n e.stopPropagation();\n // suppress the trailing slot-create click if this press does not turn\n // into a drag (e.g. a locked chip) - see markChipPress\n markChipPress();\n if (interactive) gestures.beginMove(e, segment);\n },\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n if (wasRecentDrag()) return;\n // consumer first: e.preventDefault() opts out of built-in selection\n // (e.g. click = open dialog only, no selected tint)\n settings.onEventClick?.(occurrence, e);\n // the agenda is a read-only list: a click never selects/focuses a row\n if (e.defaultPrevented || view === \"agenda\") return;\n instance.api.selectEvent(occurrence.key);\n },\n onDoubleClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n settings.onEventDoubleClick?.(occurrence, e);\n },\n className: cn(\n \"group/ec-event relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center overflow-hidden text-start text-foreground\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n preview && \"pointer-events-none\",\n view === \"agenda\"\n ? // plain list row: color lives in the dot badge, not a tinted pill;\n // hover AND selection surfaces are owned by the agenda row wrapper\n \"gap-3 rounded-md text-sm\"\n : cn(\n // @container removes intrinsic sizing; only grid chips are containers\n // py-1: room above/below inline badges (attendee pill etc.)\n \"@container gap-1.5 rounded-sm px-1.5 py-1 leading-normal\",\n // soft tint + hairline inset ring: color reads from the surface\n // itself (no accent border), stays legible in light and dark\n \"bg-(--ec-event-color)/15 hover:bg-(--ec-event-color)/25\",\n // a flat tint reads darker over a dark surface, so lift it a little\n // in dark mode to keep a lighter, softer chip tone\n \"dark:bg-(--ec-event-color)/20 dark:hover:bg-(--ec-event-color)/30\",\n \"inset-ring inset-ring-(--ec-event-color)/15\",\n \"transition-[background-color,box-shadow] duration-150\",\n \"data-dragging:opacity-40\",\n \"data-selected:inset-ring-(--ec-event-color)/40 data-selected:bg-(--ec-event-color)/30\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n ),\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {content}\n {resizeHandles}\n </>\n ),\n };\n\n const chip = useRender({\n defaultTagName: \"button\",\n render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n return (\n <EventCalendarChipContext.Provider value={{ occurrence, segment, isDragging, isSelected }}>\n {tooltipOn ? (\n <TooltipProvider delay={tooltipOpts?.delay ?? 600}>\n <Tooltip>\n <TooltipTrigger render={chip} />\n <TooltipContent\n side={tooltipOpts?.side ?? \"top\"}\n className={viewConfig.classNames?.eventTooltip}\n >\n {tooltipContent}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : (\n chip\n )}\n </EventCalendarChipContext.Provider>\n );\n}\n\nexport type { EventCalendarChipContextValue, EventCalendarEventProps };\nexport {\n EVENT_CALENDAR_COLORS,\n EVENT_CALENDAR_FADE_TRUNCATE,\n EVENT_CALENDAR_GHOST,\n EVENT_CALENDAR_SLOT_DRAFT,\n EventCalendarEvent,\n useEventCalendarEventChip,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAM,wBAAgE;CACpE;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAW,OAAO;CAA2B;CACrD;EAAE,MAAM;EAAU,OAAO;CAA0B;CACnD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAS,OAAO;CAAyB;CACjD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAU,OAAO;CAA0B;CACnD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAU,OAAO;CAA0B;AACrD;;;;;;;;;;;;;;AAeA,MAAM,uBAAuB;CAC3B,MAAM;CACN,QAAQ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A1B;EAAmC,OAAO;GAAE;GAAY;GAAS;GAAY;EAAW;EACrF,UAAA,YACC,oBAAC,iBAAD;GAAiB,OAAO,aAAa,SAAS;GAC5C,UAAA,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAgB,QAAQ,KAAO,CAAA,GAC/B,oBAAC,gBAAD;IACE,MAAM,aAAa,QAAQ;IAC3B,WAAW,WAAW,YAAY;IAEjC,UAAA;GACa,CAAA,CACT,EAAA,CAAA;EACM,CAAA,IAEjB;CAE+B,CAAA;AAEvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-calendar-month-view.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-month-view.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"event-calendar-month-view.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-month-view.tsx"],"mappings":";;;UAwFU,oCAAoC,UAAU;EACtD;;iBAGO,yBACP,WACA,QACA,qBACG,SACF,8CAA2B,IAAA;UAg3BpB;EACR,KAAK;EACL;;;EAGA,UAAU;;;;EAIV;IAAa;IAAgB;;;;;;;iBAOtB,6BACP,KACA,OACA,UACA,YACC,kDAA+B,IAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ScrollArea } from "../../ui/scroll-area.js";
|
|
3
2
|
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
3
|
+
import { ScrollArea } from "../../ui/scroll-area.js";
|
|
4
4
|
import { getDayKey, getRangeKey, resolveOffDay, toZoned, zonedStartOfDay } from "./event-calendar-lib.js";
|
|
5
5
|
import { EventCalendarViewContext, useEventCalendar, useEventCalendarDay, useEventCalendarSelector, useEventCalendarSettings, useEventCalendarViewConfig, useEventCalendarViewSettings, useEventCalendarWeek } from "./event-calendar.js";
|
|
6
6
|
import { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from "./event-calendar-dnd.js";
|
|
7
|
-
import { EVENT_CALENDAR_GHOST, EventCalendarEvent } from "./event-calendar-event.js";
|
|
7
|
+
import { EVENT_CALENDAR_GHOST, EVENT_CALENDAR_SLOT_DRAFT, EventCalendarEvent } from "./event-calendar-event.js";
|
|
8
8
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { cn } from "@kumix/utils";
|
|
10
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -322,6 +322,14 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
|
|
|
322
322
|
isEnd: draft.end <= dayEnd
|
|
323
323
|
};
|
|
324
324
|
}, { isEqual: (a, b) => a === b || a !== null && b !== null && a.isStart === b.isStart && a.isEnd === b.isEnd });
|
|
325
|
+
const draftRange = useEventCalendarSelector((state) => {
|
|
326
|
+
const draft = state.slotDraft;
|
|
327
|
+
if (!draft?.allDay) return null;
|
|
328
|
+
return {
|
|
329
|
+
start: draft.start,
|
|
330
|
+
end: draft.end
|
|
331
|
+
};
|
|
332
|
+
}, { isEqual: (a, b) => a === b || a !== null && b !== null && a.start.getTime() === b.start.getTime() && a.end.getTime() === b.end.getTime() });
|
|
325
333
|
const inlineDrop = useEventCalendarSelector((state) => {
|
|
326
334
|
const drag = state.drag;
|
|
327
335
|
if (drag?.kind !== "move" || drag.proposedAllDay) return null;
|
|
@@ -454,7 +462,7 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
|
|
|
454
462
|
"data-off": isOff || void 0,
|
|
455
463
|
"data-draft": inDraft ? "" : void 0,
|
|
456
464
|
"aria-label": format(toZoned(day, settings.timeZone), settings.i18n.formats.monthCellAriaLabel, { locale: settings.locale }),
|
|
457
|
-
className: cn("group/ec-cell relative flex min-h-0 min-w-0 flex-col overflow-hidden", !isLast && "border-e", isOutside && !settings.showOutsideDays && "invisible", isOff && offClassName, isToday && cn("relative border-b-2 border-b-primary/40 bg-primary/3", viewConfig.todayClassName), viewConfig.dayClassName?.(day), inDraft &&
|
|
465
|
+
className: cn("group/ec-cell relative flex min-h-0 min-w-0 flex-col overflow-hidden", !isLast && "border-e", isOutside && !settings.showOutsideDays && "invisible", isOff && offClassName, isToday && cn("relative border-b-2 border-b-primary/40 bg-primary/3", viewConfig.todayClassName), viewConfig.dayClassName?.(day), inDraft && EVENT_CALENDAR_SLOT_DRAFT.surface, viewConfig.classNames?.monthCell),
|
|
458
466
|
onPointerDown: (e) => {
|
|
459
467
|
const target = e.target;
|
|
460
468
|
if (target.closest("[data-slot=event-calendar-event]")) return;
|
|
@@ -472,7 +480,14 @@ function EventCalendarMonthCell({ day, cap, reservedLanes, hiddenBarKeys, isLast
|
|
|
472
480
|
children: [inDraft && /* @__PURE__ */ jsx("span", {
|
|
473
481
|
"aria-hidden": true,
|
|
474
482
|
"data-slot": "event-calendar-slot-draft",
|
|
475
|
-
className: cn("pointer-events-none absolute inset-0 z-10
|
|
483
|
+
className: cn("pointer-events-none absolute inset-0 z-10", EVENT_CALENDAR_SLOT_DRAFT.segment, inDraft.isStart && EVENT_CALENDAR_SLOT_DRAFT.segmentStart, inDraft.isEnd && EVENT_CALENDAR_SLOT_DRAFT.segmentEnd, viewConfig.classNames?.slotDraft),
|
|
484
|
+
children: inDraft.isStart && draftRange && /* @__PURE__ */ jsx("span", {
|
|
485
|
+
className: cn("absolute inset-x-1 bottom-1", EVENT_CALENDAR_SLOT_DRAFT.label),
|
|
486
|
+
children: settings.i18n.functions.formatDayRange({
|
|
487
|
+
start: toZoned(draftRange.start, settings.timeZone),
|
|
488
|
+
end: toZoned(draftRange.end, settings.timeZone)
|
|
489
|
+
}, { locale: settings.locale })
|
|
490
|
+
})
|
|
476
491
|
}), content]
|
|
477
492
|
});
|
|
478
493
|
}
|