@kumix/ui 0.3.7 → 0.3.8
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 +25 -24
- package/dist/cascader-types-BnH6wYD-.d.ts +183 -0
- package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -0
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js +12 -3
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +9 -5
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
- package/dist/components/motion/bottom-sheet.js +77 -74
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/center-morph-modal.d.ts.map +1 -1
- package/dist/components/motion/center-morph-modal.js +82 -88
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/command-palette.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +48 -26
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/drawer.d.ts.map +1 -1
- package/dist/components/motion/drawer.js +30 -30
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/loader.js +20 -22
- package/dist/components/motion/loader.js.map +1 -1
- package/dist/components/motion/morphing-modal.d.ts.map +1 -1
- package/dist/components/motion/morphing-modal.js +83 -83
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.d.ts +28 -0
- package/dist/components/motion/morphing-search.d.ts.map +1 -0
- package/dist/components/motion/morphing-search.js +418 -0
- package/dist/components/motion/morphing-search.js.map +1 -0
- package/dist/components/motion/project-folder.js +20 -20
- package/dist/components/motion/project-folder.js.map +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts +90 -0
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-async.js +549 -0
- package/dist/components/reui/cascader/cascader-async.js.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts +29 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.js +135 -0
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -0
- package/dist/components/reui/cascader/cascader-context.d.ts +193 -0
- package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-context.js +59 -0
- package/dist/components/reui/cascader/cascader-context.js.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts +85 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.js +456 -0
- package/dist/components/reui/cascader/cascader-footer.js.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts +17 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.js +68 -0
- package/dist/components/reui/cascader/cascader-i18n.js.map +1 -0
- package/dist/components/reui/cascader/cascader-item.d.ts +115 -0
- package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-item.js +530 -0
- package/dist/components/reui/cascader/cascader-item.js.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts +141 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.js +576 -0
- package/dist/components/reui/cascader/cascader-lib.js.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts +59 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.js +312 -0
- package/dist/components/reui/cascader/cascader-nav.js.map +1 -0
- package/dist/components/reui/cascader/cascader-types.d.ts +2 -0
- package/dist/components/reui/cascader/cascader-types.js +2 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts +65 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-virtual.js +240 -0
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -0
- package/dist/components/reui/cascader/cascader.d.ts +322 -0
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader.js +1459 -0
- package/dist/components/reui/cascader/cascader.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +28 -47
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +26 -44
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts +19 -57
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
- package/dist/components/reui/filters/filters-advanced.d.ts +52 -0
- package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-advanced.js +1191 -0
- package/dist/components/reui/filters/filters-advanced.js.map +1 -0
- package/dist/components/reui/filters/filters-builder.d.ts +43 -0
- package/dist/components/reui/filters/filters-builder.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-builder.js +152 -0
- package/dist/components/reui/filters/filters-builder.js.map +1 -0
- package/dist/components/reui/filters/filters-chip.d.ts +79 -0
- package/dist/components/reui/filters/filters-chip.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-chip.js +553 -0
- package/dist/components/reui/filters/filters-chip.js.map +1 -0
- package/dist/components/reui/filters/filters-context.d.ts +290 -0
- package/dist/components/reui/filters/filters-context.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-context.js +277 -0
- package/dist/components/reui/filters/filters-context.js.map +1 -0
- package/dist/components/reui/filters/filters-date.d.ts +43 -0
- package/dist/components/reui/filters/filters-date.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-date.js +143 -0
- package/dist/components/reui/filters/filters-date.js.map +1 -0
- package/dist/components/reui/filters/filters-dnd.d.ts +101 -0
- package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-dnd.js +454 -0
- package/dist/components/reui/filters/filters-dnd.js.map +1 -0
- package/dist/components/reui/filters/filters-draft.d.ts +2 -0
- package/dist/components/reui/filters/filters-draft.js +128 -0
- package/dist/components/reui/filters/filters-draft.js.map +1 -0
- package/dist/components/reui/filters/filters-editors.d.ts +91 -0
- package/dist/components/reui/filters/filters-editors.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-editors.js +773 -0
- package/dist/components/reui/filters/filters-editors.js.map +1 -0
- package/dist/components/reui/filters/filters-i18n.d.ts +24 -0
- package/dist/components/reui/filters/filters-i18n.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-i18n.js +127 -0
- package/dist/components/reui/filters/filters-i18n.js.map +1 -0
- package/dist/components/reui/filters/filters-lib.d.ts +171 -0
- package/dist/components/reui/filters/filters-lib.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-lib.js +336 -0
- package/dist/components/reui/filters/filters-lib.js.map +1 -0
- package/dist/components/reui/filters/filters-operators.d.ts +49 -0
- package/dist/components/reui/filters/filters-operators.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-operators.js +300 -0
- package/dist/components/reui/filters/filters-operators.js.map +1 -0
- package/dist/components/reui/filters/filters-query.d.ts +132 -0
- package/dist/components/reui/filters/filters-query.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-query.js +476 -0
- package/dist/components/reui/filters/filters-query.js.map +1 -0
- package/dist/components/reui/filters/filters-types.d.ts +452 -0
- package/dist/components/reui/filters/filters-types.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-types.js +2 -0
- package/dist/components/reui/filters/filters.d.ts +114 -0
- package/dist/components/reui/filters/filters.d.ts.map +1 -0
- package/dist/components/reui/filters/filters.js +638 -0
- package/dist/components/reui/filters/filters.js.map +1 -0
- 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-types.d.ts +25 -71
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- 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/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +2 -2
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/filters-draft-DEAl3TO-.d.ts +70 -0
- package/dist/filters-draft-DEAl3TO-.d.ts.map +1 -0
- package/dist/lib/text-shimmer.d.ts +2 -2
- package/dist/lib/text-shimmer.d.ts.map +1 -1
- package/dist/lib/text-shimmer.js +2 -2
- package/dist/lib/text-shimmer.js.map +1 -1
- package/dist/presence-gate-BekdC4Bo.js +24 -0
- package/dist/presence-gate-BekdC4Bo.js.map +1 -0
- package/package.json +9 -9
- package/dist/components/reui/filters.d.ts +0 -176
- package/dist/components/reui/filters.d.ts.map +0 -1
- package/dist/components/reui/filters.js +0 -1223
- package/dist/components/reui/filters.js.map +0 -1
|
@@ -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\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;CACR,SAAS;CACT,eAAe;;CAEf,gBAAgB;AAClB;;;;;;;;;;;AAYA,MAAM,+BACJ;;;;;;;;;;;;;;AAeF,MAAM,4BAA4B;CAChC,KAAK;CACL,SAAS;CACT,cAAc;CACd,YAAY;;;;;;CAMZ,SAAS;;;;;;CAMT,OAAO;AACT;AASA,MAAM,2BAEJ,cAAyD,IAAI;;AAG/D,SAAS,4BAAmF;CAC1F,MAA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,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/** Event color presets; each stays legible on light and dark surfaces. */\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 * Drag-ghost surfaces, shared verbatim by every view. A move CARRIES the\n * event: the dnd engine attaches a full clone to the cursor\n * (data-slot=event-calendar-drag-carry), so this in-grid ghost is only the\n * dashed placeholder for the snapped drop slot. A resize STRETCHES instead:\n * the chip itself at the proposed extent, dashed rather than solid.\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, where squeezed cascade\n * columns clip titles into a mash of glyphs; a right-edge mask fade reads\n * cleaner than an ellipsis at those widths. Masked ONLY below a 10rem\n * container: mask-image forces text off subpixel antialiasing, so masking\n * wide chips makes the whole grid read bolder and shimmer while resizing.\n * Wide chips keep the plain ellipsis. Exported for consumer renderEvent.\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: a dashed primary\n * outline over a faint wash with the range printed inside. `box` is the timed\n * grid's single minute-positioned rectangle; `segment` is one day-cell slice\n * of a multi-cell draft, with side borders and rounding only on the run's two\n * ends so it reads as one dashed box rather than a row of them.\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, on the CELL not the dashed overlay: the\n * overlay stacks above the chips, so tinting it would wash them instead.\n */\n surface: \"bg-primary/5\",\n /**\n * The range readout. `leading-none` is load-bearing: the shortest timed\n * draft is one snap interval tall (16px at the default 15-minute snap and\n * 4rem hour height), and looser leading renders ~18px, clipped by the\n * 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: the chip as-is but inert - no gestures, resize\n * handles, selection/drag state, focus or pointer events.\n */\n preview?: boolean;\n}\n\n/**\n * The one interactive event element in every view. The wrapper owns a11y,\n * data attributes, selection and drag/resize wiring; content comes from\n * children, else renderEvent, else 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, where\n // squeezed cascade columns fade-truncate instead of clipping into neighbors\n const stackedBlock =\n timedBlock && (segment.endMin ?? 0) - (segment.startMin ?? 0) >= viewConfig.compactEventMinutes;\n\n const defaultContent = (\n <>\n {/* leading dot for single-row chips (month cells, all-day bars); a\n time-grid block takes its color from the tinted surface instead, and\n in its 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 only the dot-to-title gap; the chip keeps gap-1.5\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; grids 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 // Per-day time text for a multi-day event: \"From 9:00 AM\", \"All day\",\n // \"Until 5:00 PM\". Boundaries come from the occurrence vs segment.day, never\n // the packing flags - lane merging rewrites those on shared segments.\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 // Memoized so a drag - which re-renders the lane on every pointer move -\n // never re-invokes the consumer's renderEvent per frame: a referentially\n // stable element lets React skip the custom subtree instead of flickering it.\n // The render fns are deps, so an inline arrow from the consumer defeats it.\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 formatter returning undefined drops the title\n const label = settings.i18n.functions.formatEventLabel\n ? settings.i18n.functions.formatEventLabel(event.title, timeLabel)\n : `${event.title}, ${timeLabel}`;\n\n // Optional styled tooltip (viewConfig.eventTooltip, default off). It replaces\n // the native title so the two never stack, and a preview never gets one. A\n // falsy renderEventTooltip result (including the false/\"\" of `cond && <node>`)\n // falls back to the label; an empty label leaves no content and skips it.\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) marking the resize direction.\n // Shown on compact sub-compactEventMinutes blocks too: the 1.5rem chip\n // min-height leaves edge room without colliding with the 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 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 // A background tint alone conveys selection, so the chip is a real toggle\n // wherever it is interactive (agenda rows never select, previews are inert).\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 when this press yields no drag\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 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 + inset ring, not an accent border: legible on both themes\n \"bg-(--ec-event-color)/15 hover:bg-(--ec-event-color)/25\",\n // a flat tint reads darker on a dark surface, so lift it there\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":";;;;;;;;;;;;;;AAqBA,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,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GACJ,WAAW,YAAY,OACvB,SACF;EACA,UACE,qBAAA,YAAA,EAAA,UAAA,CACG,SACA,aACD,EAAA,CAAA;CAEN;CAEA,MAAM,OAAO,UAAU;EACrB,gBAAgB;EAChB;EACA,OAAO,WAAqB,cAAc,KAAK;CACjD,CAAC;CAED,OACE,oBAAC,yBAAyB,UAA1B;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"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Button } from "../../ui/button.js";
|
|
3
3
|
import { Calendar } from "../../ui/calendar.js";
|
|
4
4
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../../ui/dropdown-menu.js";
|
|
5
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
6
5
|
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
7
7
|
import { toZoned } from "./event-calendar-lib.js";
|
|
8
8
|
import { useEventCalendarNavigation, useEventCalendarSettings, useEventCalendarView, useEventCalendarViewConfig } from "./event-calendar.js";
|
|
9
9
|
import { useState } from "react";
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
//#region src/components/reui/event-calendar/event-calendar-types.d.ts
|
|
2
2
|
type EventCalendarEventId = string;
|
|
3
3
|
type CalendarView = "month" | "week" | "day" | "days" | "agenda" | "resource";
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* with children; the resource day view shows leaves as booking columns.
|
|
7
|
-
*/
|
|
4
|
+
/** Bookable resource. The resource view flattens children and renders leaves
|
|
5
|
+
* only, as booking columns; a parent's own title never renders. */
|
|
8
6
|
interface EventCalendarResource {
|
|
9
7
|
id: string;
|
|
10
8
|
title: string;
|
|
11
|
-
/** Token or css color used for subtle row/column accents. */
|
|
12
9
|
color?: string;
|
|
13
10
|
children?: EventCalendarResource[];
|
|
14
11
|
}
|
|
12
|
+
/** Half-open: start is inclusive, end is exclusive. */
|
|
15
13
|
interface EventCalendarDateRange {
|
|
16
|
-
/** Inclusive instant. */
|
|
17
14
|
start: Date;
|
|
18
|
-
/** Exclusive instant. */
|
|
19
15
|
end: Date;
|
|
20
16
|
}
|
|
21
17
|
type EventCalendarWeekday = "MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU";
|
|
@@ -38,15 +34,11 @@ interface EventCalendarRecurrenceRule {
|
|
|
38
34
|
interface CalendarEvent<TData = unknown> {
|
|
39
35
|
id: EventCalendarEventId;
|
|
40
36
|
title: string;
|
|
41
|
-
/** Plain instant; consumers parse ISO strings themselves. */
|
|
42
37
|
start: Date;
|
|
43
38
|
/** Exclusive; must be >= start. */
|
|
44
39
|
end: Date;
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* segmentation walks the raw instants, so a row stored at another zone's
|
|
48
|
-
* midnight paints on the wrong days.
|
|
49
|
-
*/
|
|
40
|
+
/** Start and end must be midnights in the display time zone: segmentation
|
|
41
|
+
* walks raw instants, so another zone's midnight paints the wrong days. */
|
|
50
42
|
allDay?: boolean;
|
|
51
43
|
/** Structured rule or a raw "RRULE:..." line. */
|
|
52
44
|
recurrence?: EventCalendarRecurrenceRule | string;
|
|
@@ -58,17 +50,14 @@ interface CalendarEvent<TData = unknown> {
|
|
|
58
50
|
color?: string;
|
|
59
51
|
/** Excluded from drag and resize regardless of interactions state. */
|
|
60
52
|
readOnly?: boolean;
|
|
61
|
-
/** Per-event
|
|
53
|
+
/** Per-event overrides; defaults come from interactions.drag / .resize. */
|
|
62
54
|
draggable?: boolean;
|
|
63
|
-
/** Per-event override; default comes from interactions.resize. */
|
|
64
55
|
resizable?: boolean;
|
|
65
56
|
/** Packing prominence; feeds getEventPriority ordering. */
|
|
66
57
|
priority?: number;
|
|
67
|
-
/**
|
|
58
|
+
/** Verbatim stacking override; replaces the computed 10 + column. */
|
|
68
59
|
zIndex?: number;
|
|
69
|
-
/** Bookable resource this event belongs to (resource view). */
|
|
70
60
|
resourceId?: string;
|
|
71
|
-
/** Consumer payload, fully generic. */
|
|
72
61
|
data?: TData;
|
|
73
62
|
}
|
|
74
63
|
interface EventCalendarOccurrence<TData = unknown> {
|
|
@@ -84,7 +73,7 @@ interface EventCalendarOccurrence<TData = unknown> {
|
|
|
84
73
|
}
|
|
85
74
|
interface EventCalendarSegment<TData = unknown> {
|
|
86
75
|
occurrence: EventCalendarOccurrence<TData>;
|
|
87
|
-
/** Zoned
|
|
76
|
+
/** Zoned midnight of the segment's day; startMin/endMin count from it. */
|
|
88
77
|
day: Date;
|
|
89
78
|
isStart: boolean;
|
|
90
79
|
isEnd: boolean;
|
|
@@ -93,20 +82,20 @@ interface EventCalendarSegment<TData = unknown> {
|
|
|
93
82
|
/** Timed only: minutes from the zoned day start. */
|
|
94
83
|
startMin?: number;
|
|
95
84
|
endMin?: number;
|
|
96
|
-
/**
|
|
85
|
+
/** Layout output: lane stacks month bars and all-day lanes;
|
|
86
|
+
* column/columnCount/columnSpan pack time-grid overlaps;
|
|
87
|
+
* rowIndex/colStart/colSpan place a bar in the week row. */
|
|
97
88
|
lane?: number;
|
|
98
|
-
/** Time-grid overlap packing. */
|
|
99
89
|
column?: number;
|
|
100
90
|
columnCount?: number;
|
|
101
91
|
columnSpan?: number;
|
|
102
|
-
/** Week-row granularity (month bars / all-day lanes). */
|
|
103
92
|
rowIndex?: number;
|
|
104
93
|
colStart?: number;
|
|
105
94
|
colSpan?: number;
|
|
106
95
|
}
|
|
107
96
|
interface EventCalendarSelection {
|
|
108
97
|
eventKeys: string[];
|
|
109
|
-
/** Committed slot selection;
|
|
98
|
+
/** Committed slot selection; EventCalendarSlotDraft holds the in-gesture one. */
|
|
110
99
|
slot: {
|
|
111
100
|
start: Date;
|
|
112
101
|
end: Date;
|
|
@@ -124,48 +113,33 @@ interface EventCalendarDragState<TData = unknown> {
|
|
|
124
113
|
proposedStart: Date;
|
|
125
114
|
proposedEnd: Date;
|
|
126
115
|
proposedAllDay: boolean;
|
|
127
|
-
/**
|
|
128
|
-
*
|
|
129
|
-
* cells / the all-day lane) rather than minute columns - the all-day lane
|
|
130
|
-
* ghost keys on this, covering timed MULTI-DAY bars whose proposals stay
|
|
131
|
-
* timed (proposedAllDay alone misses them).
|
|
132
|
-
*/
|
|
116
|
+
/** Day-granular proposal (month cells, all-day lane), not minute columns; the
|
|
117
|
+
* all-day ghost keys on it: proposedAllDay misses timed MULTI-DAY bars. */
|
|
133
118
|
proposedDayGranular: boolean;
|
|
134
|
-
/** Target resource when dragging across resource columns/rows. */
|
|
135
119
|
proposedResourceId?: string;
|
|
136
120
|
/** Last canDropEvent verdict; drives data-drop-invalid styling. */
|
|
137
121
|
valid: boolean;
|
|
138
122
|
}
|
|
139
|
-
/**
|
|
140
|
-
* The in-progress drag-create rectangle ONLY, cleared on commit or cancel.
|
|
141
|
-
* The committed slot selection lives in EventCalendarSelection.slot.
|
|
142
|
-
*/
|
|
123
|
+
/** The in-progress drag-create rectangle only; cleared on commit or cancel. */
|
|
143
124
|
interface EventCalendarSlotDraft {
|
|
144
125
|
start: Date;
|
|
145
126
|
end: Date;
|
|
146
127
|
allDay: boolean;
|
|
147
128
|
view: CalendarView;
|
|
148
|
-
/** Present when the slot was selected inside a resource column/row. */
|
|
149
129
|
resourceId?: string;
|
|
150
130
|
}
|
|
151
|
-
/**
|
|
152
|
-
* User-adjustable display toggles (the "View settings" submenu). Every field
|
|
153
|
-
* is optional; undefined defers to the matching root view-config prop.
|
|
154
|
-
*/
|
|
131
|
+
/** "View settings" toggles; undefined defers to the root view-config prop. */
|
|
155
132
|
interface EventCalendarViewSettings {
|
|
156
|
-
/** Show Saturday/Sunday columns in month, week, and N-day grids. */
|
|
157
133
|
weekends?: boolean;
|
|
158
|
-
/** Week-number gutter in the month view. */
|
|
159
134
|
weekNumbers?: boolean;
|
|
160
135
|
nowIndicator?: boolean;
|
|
161
|
-
/** Off-day (non-working) background marking. */
|
|
162
136
|
offDays?: boolean;
|
|
163
137
|
}
|
|
164
138
|
interface EventCalendarState<TData = unknown> {
|
|
165
139
|
view: CalendarView;
|
|
166
|
-
/** Anchor date. */
|
|
140
|
+
/** Anchor date; navigation steps this, and both ranges derive from it. */
|
|
167
141
|
date: Date;
|
|
168
|
-
/**
|
|
142
|
+
/** Read by the "days" view only; other views ignore it. */
|
|
169
143
|
dayCount: number;
|
|
170
144
|
/** Full rendered grid incl. outside days - fetch remote data for THIS. */
|
|
171
145
|
visibleRange: EventCalendarDateRange;
|
|
@@ -193,7 +167,6 @@ interface EventCalendarProposedUpdate<TData = unknown> {
|
|
|
193
167
|
start: Date;
|
|
194
168
|
end: Date;
|
|
195
169
|
allDay: boolean;
|
|
196
|
-
/** Proposed resource when the gesture crossed resource columns/rows. */
|
|
197
170
|
resourceId?: string;
|
|
198
171
|
source: "drag" | "resize-start" | "resize-end" | "keyboard" | "api";
|
|
199
172
|
}
|
|
@@ -209,15 +182,9 @@ interface EventCalendarSlotInfo {
|
|
|
209
182
|
end?: Date;
|
|
210
183
|
allDay: boolean;
|
|
211
184
|
view: CalendarView;
|
|
212
|
-
/** Present when the click happened inside a resource column/row. */
|
|
213
185
|
resourceId?: string;
|
|
214
186
|
}
|
|
215
|
-
/**
|
|
216
|
-
* Off-day marking (non-working days). `true` uses the defaults: weekends
|
|
217
|
-
* with a muted background. Custom weekday sets, explicit dates, a predicate,
|
|
218
|
-
* and a custom class are all supported; marked cells carry `data-off` for
|
|
219
|
-
* CSS-selector customization.
|
|
220
|
-
*/
|
|
187
|
+
/** Off-days; `true` = weekend defaults. Marked cells carry `data-off`. */
|
|
221
188
|
interface EventCalendarOffDaysConfig {
|
|
222
189
|
/** Weekday numbers treated as off (0 = Sunday). Default [0, 6]. */
|
|
223
190
|
weekendDays?: number[];
|
|
@@ -228,11 +195,6 @@ interface EventCalendarOffDaysConfig {
|
|
|
228
195
|
/** Marker classes; default "bg-muted/25". */
|
|
229
196
|
className?: string;
|
|
230
197
|
}
|
|
231
|
-
/**
|
|
232
|
-
* External-data contract. v1 ships the type plus docs recipes (Google
|
|
233
|
-
* events.list / MS Graph calendarView map to CalendarEvent in ~15 lines);
|
|
234
|
-
* OAuth, tokens, and sync loops are application backend territory.
|
|
235
|
-
*/
|
|
236
198
|
interface EventCalendarDataAdapter<TData = unknown> {
|
|
237
199
|
getEvents(range: EventCalendarDateRange, signal?: AbortSignal): Promise<CalendarEvent<TData>[]>;
|
|
238
200
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-calendar-types.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-types.tsx"],"mappings":";KAEK;KAEA
|
|
1
|
+
{"version":3,"file":"event-calendar-types.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-types.tsx"],"mappings":";KAEK;KAEA;;;UAIK;EACR;EACA;EACA;EACA,WAAW;;;UAIH;EACR,OAAO;EACP,KAAK;;KAGF;UAEK;EACR;EACA;EACA;;EAEA,QAAQ;EACR,YAAY,MAAM;IAAyB,KAAK;IAAsB;;EACtE;EACA;EACA,YAAY;EACZ,UAAU;EACV,SAAS;;UAGD,cAAc;EACtB,IAAI;EACJ;EACA,OAAO;;EAEP,KAAK;;;EAGL;;EAEA,aAAa;;EAEb,mBAAmB;;EAEnB,gBAAgB;;EAEhB;;EAEA;;EAEA;EACA;;EAEA;;EAEA;EACA;EACA,OAAO;;UAGC,wBAAwB;;EAEhC;EACA,SAAS;EACT,OAAO,cAAc;EACrB,OAAO;EACP,KAAK;EACL;EACA;EACA;;UAGQ,qBAAqB;EAC7B,YAAY,wBAAwB;;EAEpC,KAAK;EACL;EACA;EACA;EACA;;EAEA;EACA;;;;EAIA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGQ;EACR;;EAEA;IAAQ,OAAO;IAAM,KAAK;IAAM;;;UAGxB;EACR;EACA;EACA;;UAGQ,uBAAuB;EAC/B;EACA,YAAY,wBAAwB;EACpC,eAAe;EACf,aAAa;EACb;;;EAGA;EACA;;EAEA;;;UAIQ;EACR,OAAO;EACP,KAAK;EACL;EACA,MAAM;EACN;;;UAIQ;EACR;EACA;EACA;EACA;;UAGQ,mBAAmB;EAC3B,MAAM;;EAEN,MAAM;;EAEN;;EAEA,cAAc;;EAEd,aAAa;EACb,QAAQ,cAAc;EACtB,WAAW;EACX,cAAc;EACd;EACA,MAAM,uBAAuB;EAC7B,WAAW;EACX,cAAc;;UAGN;EACR,OAAO;EACP,aAAa;EACb,MAAM;EACN,MAAM;EACN;;UAGQ,4BAA4B;EACpC,OAAO,cAAc;;EAErB,YAAY,wBAAwB;EACpC,OAAO;EACP,KAAK;EACL;EACA;EACA;;;KAIG;EAGC,QAAQ;EAAM,MAAM;EAAM;;;UAGtB;EACR,MAAM;EACN,MAAM;EACN;EACA,MAAM;EACN;;;UAIQ;;EAER;;EAEA,QAAQ;;EAER,YAAY,KAAK;;EAEjB;;UAGQ,yBAAyB;EACjC,UAAU,OAAO,wBAAwB,SAAS,cAAc,QAAQ,cAAc"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FilterCombinator, FilterEmptyStateContext, FilterRule } from "./filters-types.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
//#region src/components/reui/filters/filters-advanced.d.ts
|
|
4
|
+
interface RowPosition {
|
|
5
|
+
index: number;
|
|
6
|
+
parentId: string;
|
|
7
|
+
combinator: FilterCombinator;
|
|
8
|
+
depth: number;
|
|
9
|
+
}
|
|
10
|
+
interface FilterAdvancedRowProps<V = unknown> {
|
|
11
|
+
rule: FilterRule<V>;
|
|
12
|
+
position: RowPosition;
|
|
13
|
+
}
|
|
14
|
+
declare function FilterAdvancedRowImpl<V, O>({ rule, position }: FilterAdvancedRowProps<V>): React$1.JSX.Element | null;
|
|
15
|
+
/** One rule, as a row, memoized: the query tree shares structure, so editing
|
|
16
|
+
* one row of twenty re-renders one. */
|
|
17
|
+
declare const FilterAdvancedRow: typeof FilterAdvancedRowImpl;
|
|
18
|
+
/** The panel draws NO border, NO background and NO radius, and takes no
|
|
19
|
+
* element to be drawn as: a surface is the page's decision. */
|
|
20
|
+
interface FiltersAdvancedPanelProps {
|
|
21
|
+
/** Which of the two boxes the panel sits in, the only thing deciding whether
|
|
22
|
+
* it pads itself: a popover's content is `p-0`, so this padding IS its
|
|
23
|
+
* inner padding, and `"inline"` is a page that owns its own. */
|
|
24
|
+
mode?: "popover" | "inline";
|
|
25
|
+
/** Replaces the empty state for this panel only. Wins over
|
|
26
|
+
* `Filters.renderEmpty`, the precedence a field has over the root's. */
|
|
27
|
+
renderEmpty?: (context: FilterEmptyStateContext) => React$1.ReactNode;
|
|
28
|
+
/** Whether rows can be reordered. See `FiltersProps.reorderable`. */
|
|
29
|
+
reorderable?: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/** The builder itself: nested groups over the query tree the chips read. A
|
|
33
|
+
* group is a parenthesised list joined by ONE operator, so nesting is a real
|
|
34
|
+
* tree: a flat model cannot represent `a AND (b OR c)` without inventing
|
|
35
|
+
* precedence, and invented precedence returns the wrong rows. */
|
|
36
|
+
declare function FiltersAdvancedPanel<V, O>({ mode, renderEmpty, reorderable, className }: FiltersAdvancedPanelProps): React$1.JSX.Element;
|
|
37
|
+
interface FiltersAdvancedProps {
|
|
38
|
+
/** Where the builder lives. `"popover"` hangs it off a trigger; `"inline"`
|
|
39
|
+
* renders the same panel with no popup, for a sidebar or a settings page. */
|
|
40
|
+
mode?: "popover" | "inline";
|
|
41
|
+
/** Replaces the default trigger. Ignored inline. */
|
|
42
|
+
trigger?: React$1.ReactNode;
|
|
43
|
+
/** Whether rows can be reordered. See `FiltersProps.reorderable`. */
|
|
44
|
+
reorderable?: boolean;
|
|
45
|
+
/** Popover placement. */
|
|
46
|
+
align?: "start" | "center" | "end";
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
declare function FiltersAdvanced<V, O>({ mode, trigger, reorderable, align, className }: FiltersAdvancedProps): React$1.JSX.Element;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { FilterAdvancedRow, FilterAdvancedRowProps, FiltersAdvanced, FiltersAdvancedPanel, FiltersAdvancedPanelProps, FiltersAdvancedProps };
|
|
52
|
+
//# sourceMappingURL=filters-advanced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters-advanced.d.ts","names":[],"sources":["../../../../src/components/reui/filters/filters-advanced.tsx"],"mappings":";;;UA+UU;EACR;EACA;EACA,YAAY;EACZ;;UAuUe,uBAAuB;EACtC,MAAM,WAAW;EACjB,UAAU;;iBAGH,sBAAsB,GAAG,KAAK,MAAM,YAAY,uBAAuB,KAAE,QAAA,IAAA;;;cA0TrE,0BAAgE;;;UAsV5D;;;;EAIf;;;EAGA,eAAe,SAAS,4BAA4B,QAAM;;EAE1D;EACA;;;;;;iBAOc,qBAAqB,GAAG,KACtC,MACA,aACA,aACA,aACC,4BAAyB,QAAA,IAAA;UAwdX;;;EAGf;;EAEA,UAAU,QAAM;;EAEhB;;EAEA;EACA;;iBAGc,gBAAgB,GAAG,KACjC,MACA,SACA,aACA,OACA,aACC,uBAAoB,QAAA,IAAA"}
|