@kumix/ui 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +4 -6
  2. package/dist/components/motion/animated-toast-stack.js +3 -3
  3. package/dist/components/motion/animated-toast-stack.js.map +1 -1
  4. package/dist/components/motion/button/base.d.ts +8 -1
  5. package/dist/components/motion/button/base.d.ts.map +1 -1
  6. package/dist/components/motion/button/base.js +14 -1
  7. package/dist/components/motion/button/base.js.map +1 -1
  8. package/dist/components/motion/button/index.d.ts +2 -2
  9. package/dist/components/motion/button/index.js +2 -2
  10. package/dist/components/motion/morphing-tabs.d.ts +36 -0
  11. package/dist/components/motion/morphing-tabs.d.ts.map +1 -0
  12. package/dist/components/motion/morphing-tabs.js +518 -0
  13. package/dist/components/motion/morphing-tabs.js.map +1 -0
  14. package/dist/components/reui/badge.d.ts +2 -2
  15. package/dist/components/reui/data-grid/data-grid.d.ts +4 -0
  16. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  17. package/dist/components/reui/data-grid/data-grid.js +6 -2
  18. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  19. package/dist/components/reui/event-calendar/event-calendar-event.d.ts +32 -1
  20. package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
  21. package/dist/components/reui/event-calendar/event-calendar-event.js +32 -1
  22. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  23. package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts.map +1 -1
  24. package/dist/components/reui/event-calendar/event-calendar-month-view.js +18 -3
  25. package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
  26. package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts.map +1 -1
  27. package/dist/components/reui/event-calendar/event-calendar-resource-view.js +16 -4
  28. package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
  29. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -1
  30. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +33 -5
  31. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  32. package/dist/components/reui/frame.d.ts +2 -2
  33. package/dist/components/reui/icon-tile.d.ts +1 -1
  34. package/dist/components/ui/attachment.d.ts +2 -2
  35. package/dist/components/ui/badge.d.ts +1 -1
  36. package/dist/components/ui/bubble.d.ts +1 -1
  37. package/dist/components/ui/button-group.d.ts +1 -1
  38. package/dist/components/ui/button.d.ts +2 -2
  39. package/dist/components/ui/empty.d.ts +1 -1
  40. package/dist/components/ui/field.d.ts +1 -1
  41. package/dist/components/ui/item.d.ts +2 -2
  42. package/dist/components/ui/questionnaire.d.ts +2 -1
  43. package/dist/components/ui/questionnaire.d.ts.map +1 -1
  44. package/dist/components/ui/questionnaire.js +11 -4
  45. package/dist/components/ui/questionnaire.js.map +1 -1
  46. package/dist/components/ui/sidebar.d.ts +1 -1
  47. package/dist/components/ui/toggle.d.ts +1 -1
  48. package/package.json +72 -7
@@ -2,7 +2,7 @@
2
2
  import { createContext, useContext, useEffect, useMemo, useRef } from "react";
3
3
  import { cn } from "@kumix/utils";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { columnFacetingFeature, columnFilteringFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnSizingFeature, columnVisibilityFeature, createExpandedRowModel, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, globalFilteringFeature, metaHelper, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_basic, sortFn_text, tableFeatures } from "@tanstack/react-table";
5
+ import { columnFacetingFeature, columnFilteringFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnSizingFeature, columnVisibilityFeature, createExpandedRowModel, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, globalFilteringFeature, metaHelper, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, tableFeatures } from "@tanstack/react-table";
6
6
  //#region src/components/reui/data-grid/data-grid.tsx
7
7
  /**
8
8
  * The batteries-included feature bundle every ReUI data-grid example builds
@@ -52,8 +52,12 @@ const dataGridFeatures = tableFeatures({
52
52
  facetedRowModel: createFacetedRowModel(),
53
53
  facetedUniqueValues: createFacetedUniqueValues(),
54
54
  sortFns: {
55
+ alphanumeric: sortFn_alphanumeric,
56
+ alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,
55
57
  basic: sortFn_basic,
56
- text: sortFn_text
58
+ datetime: sortFn_datetime,
59
+ text: sortFn_text,
60
+ textCaseSensitive: sortFn_textCaseSensitive
57
61
  },
58
62
  columnMeta: metaHelper()
59
63
  });
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid.js","names":["internalTable","internalProps"],"sources":["../../../../src/components/reui/data-grid/data-grid.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { createContext, useContext, useEffect, useMemo, useRef } from \"react\";\nimport type {\n Column,\n ColumnFiltersState,\n ReactTable,\n RowData,\n SortingState,\n Table,\n TableFeatures,\n} from \"@tanstack/react-table\";\nimport {\n columnFacetingFeature,\n columnFilteringFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnResizingFeature,\n columnSizingFeature,\n columnVisibilityFeature,\n createExpandedRowModel,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n globalFilteringFeature,\n metaHelper,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n sortFn_basic,\n sortFn_text,\n tableFeatures,\n} from \"@tanstack/react-table\";\n\nimport { cn } from \"@kumix/utils\";\n\n/**\n * Per-column extras the grid reads off `columnDef.meta`.\n *\n * TanStack v9 resolves this through the `columnMeta` slot on the feature\n * bundle below instead of a global `declare module` augmentation, so\n * installing the data grid no longer widens `ColumnMeta` for every other\n * table in the consuming app.\n */\nexport interface DataGridColumnMeta<TData> {\n headerTitle?: string;\n headerClassName?: string;\n cellClassName?: string;\n skeleton?: ReactNode;\n expandedContent?: (row: TData) => ReactNode;\n autoSize?: boolean;\n}\n\n/**\n * The batteries-included feature bundle every ReUI data-grid example builds\n * on. v9 requires each table to declare its features up front, and the grid's\n * render path needs the ones registered here: `columnVisibilityFeature` alone\n * gates `row.getVisibleCells()`, so even a grid that never hides a column\n * needs it to render at all.\n *\n * Pass it straight through for the full grid:\n *\n * ```tsx\n * const table = useTable({ features: dataGridFeatures, columns, data })\n * ```\n *\n * Extend it when a grid needs more, keeping each prerequisite feature ahead of\n * the slot that depends on it:\n *\n * ```tsx\n * const features = tableFeatures({\n * ...dataGridFeatures,\n * columnGroupingFeature,\n * groupedRowModel: createGroupedRowModel(),\n * })\n * ```\n *\n * Or drop it entirely and hand `<DataGrid>` a leaner table - the components\n * accept any bundle, so you keep full ownership of the TanStack core.\n */\nexport const dataGridFeatures = tableFeatures({\n columnVisibilityFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnSizingFeature,\n // columnResizingFeature requires columnSizingFeature, declared above.\n columnResizingFeature,\n columnFilteringFeature,\n // Powers DataGridColumnFilter's column.getFacetedUniqueValues(). On v8 an\n // unregistered facet silently returned an empty map; on v9 the method would\n // not exist at all, so the faceted row models below are required, not\n // optional.\n columnFacetingFeature,\n // globalFilteringFeature requires columnFilteringFeature, declared above.\n globalFilteringFeature,\n rowSortingFeature,\n rowPaginationFeature,\n rowSelectionFeature,\n rowExpandingFeature,\n rowPinningFeature,\n sortedRowModel: createSortedRowModel(),\n filteredRowModel: createFilteredRowModel(),\n paginatedRowModel: createPaginatedRowModel(),\n expandedRowModel: createExpandedRowModel(),\n facetedRowModel: createFacetedRowModel(),\n facetedUniqueValues: createFacetedUniqueValues(),\n // Only the built-ins the registry names by string. v9 resolves string\n // sortFn names against this map alone, and registering them one by one\n // keeps every other built-in out of the bundle.\n sortFns: { basic: sortFn_basic, text: sortFn_text },\n // biome-ignore lint/suspicious/noExplicitAny: <>\n columnMeta: metaHelper<DataGridColumnMeta<any>>(),\n});\n\n/** The feature set `dataGridFeatures` registers. */\nexport type DataGridFeatures = typeof dataGridFeatures;\n\n/**\n * The grid's internal view of the table.\n *\n * `TFeatures` is invariant in v9 and an unresolved generic one collapses to a\n * union that includes the bare core arm, so no generic signature can call\n * `getVisibleCells()`, `getStartVisibleLeafColumns()` and friends. The public\n * components stay generic so consumers can pass any bundle they like; the\n * table is widened to this concrete type exactly once, on the way into\n * context, and every internal component reads it from there.\n */\nexport type DataGridTableInstance<TData extends object> = ReactTable<DataGridFeatures, TData>;\n\n/** Label for headers / column visibility: `meta.headerTitle`, string `columnDef.header`, or `column.id`. */\nexport function getColumnHeaderLabel<TData extends RowData, TValue>(\n column: Column<DataGridFeatures, TData, TValue>,\n): string {\n const meta = column.columnDef.meta as { headerTitle?: string } | undefined;\n if (typeof meta?.headerTitle === \"string\") return meta.headerTitle;\n const defHeader = column.columnDef.header;\n if (typeof defHeader === \"string\") return defHeader;\n return String(column.id);\n}\n\nexport type DataGridApiFetchParams = {\n pageIndex: number;\n pageSize: number;\n sorting?: SortingState;\n filters?: ColumnFiltersState;\n searchQuery?: string;\n};\n\nexport type DataGridApiResponse<T> = {\n data: T[];\n empty: boolean;\n pagination: {\n total: number;\n page: number;\n };\n};\n\n/**\n * Everything `<DataGrid>` accepts except the two props the provider consumes\n * itself. Kept feature-agnostic: layout and messaging never depend on which\n * TanStack features the consumer registered.\n */\nexport type DataGridLayoutProps<TData extends object> = Omit<\n DataGridProps<TableFeatures, TData>,\n \"table\" | \"children\"\n>;\n\nexport interface DataGridContextProps<TData extends object> {\n props: DataGridLayoutProps<TData>;\n table: DataGridTableInstance<TData>;\n recordCount: number;\n isLoading: boolean;\n /**\n * Internal coordinator for `meta.autoSize` columns. Lives at the core level\n * so every table variant and viewport instance shares one application state.\n */\n autoSize?: DataGridAutoSizeController;\n}\n\nexport type DataGridAutoSizeController = {\n /**\n * Grows the first visible `meta.autoSize` column by the given free space.\n * Applies at most once per column id; safe to call from every viewport\n * measurement. Returns true when a sizing update was dispatched.\n */\n apply: (fillWidth: number) => boolean;\n};\n\nfunction createDataGridAutoSizeController<TData extends object>(\n /**\n * A getter, not the table itself.\n *\n * v8 handed back one stable table whose state mutated in place, so a\n * controller could close over it. v9 returns a NEW table wrapper on every\n * state change, and a captured one keeps reporting the state it was built\n * with - here that meant `columnSizing` looked permanently empty, the\n * applied-once guard re-armed on every measurement, and the fill overwrote\n * whatever width the user had just dragged the column to.\n */\n getTable: () => DataGridTableInstance<TData>,\n): DataGridAutoSizeController {\n let applied: { columnId: string; base: number; grown: number } | null = null;\n\n return {\n apply(fillWidth: number) {\n const table = getTable();\n const columnSizing = table.state.columnSizing;\n\n // Re-arm after reset flows (double-click resetSize, resetColumnSizing,\n // controlled state replacement) so the column re-fills instead of\n // leaving a dead blank strip.\n if (applied && columnSizing[applied.columnId] === undefined) {\n applied = null;\n }\n\n if (fillWidth <= 0) return false;\n\n const autoSizeColumn = table\n .getVisibleLeafColumns()\n .find((column) => column.columnDef.meta?.autoSize && column.getCanResize());\n\n if (!autoSizeColumn || applied?.columnId === autoSizeColumn.id) {\n return false;\n }\n\n // A width this coordinator did not write belongs to someone else -\n // almost always the user, who just dragged the column's resize handle.\n // Filling over it is what made a `meta.autoSize` column look\n // un-resizable: the drag committed, the next viewport measurement\n // stamped the fill back on top, and the column snapped to its old width.\n //\n // Deliberately keyed on observed state rather than on `applied`, which\n // is per-coordinator memory: anything that rebuilds the coordinator\n // (a remount, a new table store) forgets what it did, and the guard has\n // to survive that. An explicit reset clears the entry and re-arms the\n // fill, which is what makes double-click-to-reset still work.\n const currentSize = columnSizing[autoSizeColumn.id];\n if (currentSize !== undefined && currentSize !== applied?.grown) {\n return false;\n }\n\n // Candidate switched (e.g. the grown column was hidden and another\n // meta.autoSize column took over): revert the previous growth if the\n // user hasn't manually resized that column since, so visibility\n // toggles cannot ratchet the table wider than its container forever.\n const revert = applied && columnSizing[applied.columnId] === applied.grown ? applied : null;\n const base = columnSizing[autoSizeColumn.id] ?? autoSizeColumn.getSize();\n const grown = base + fillWidth;\n\n applied = { columnId: autoSizeColumn.id, base, grown };\n table.setColumnSizing((old) => {\n const next = { ...old, [autoSizeColumn.id]: grown };\n if (revert && next[revert.columnId] === revert.grown) {\n next[revert.columnId] = revert.base;\n }\n return next;\n });\n\n return true;\n },\n };\n}\n\nexport type DataGridRequestParams = {\n pageIndex: number;\n pageSize: number;\n sorting?: SortingState;\n columnFilters?: ColumnFiltersState;\n};\n\nexport interface DataGridProps<TFeatures extends TableFeatures, TData extends object> {\n className?: string;\n table?: Table<TFeatures, TData>;\n recordCount: number;\n children?: ReactNode;\n onRowClick?: (row: TData) => void;\n isLoading?: boolean;\n loadingMode?: \"skeleton\" | \"spinner\";\n loadingMessage?: ReactNode | string;\n fetchingMoreMessage?: ReactNode | string;\n allRowsLoadedMessage?: ReactNode | string;\n emptyMessage?: ReactNode | string;\n tableLayout?: {\n dense?: boolean;\n cellBorder?: boolean;\n rowBorder?: boolean;\n rowRounded?: boolean;\n stripped?: boolean;\n headerBackground?: boolean;\n footerBackground?: boolean;\n headerBorder?: boolean;\n headerSticky?: boolean;\n width?: \"auto\" | \"fixed\";\n columnsVisibility?: boolean;\n columnsResizable?: boolean;\n columnsResizeMode?: \"onChange\" | \"onEnd\";\n columnsPinnable?: boolean;\n columnsMovable?: boolean;\n columnsDraggable?: boolean;\n rowsDraggable?: boolean;\n rowsPinnable?: boolean;\n };\n tableClassNames?: {\n base?: string;\n header?: string;\n headerRow?: string;\n headerSticky?: string;\n body?: string;\n bodyRow?: string;\n footer?: string;\n edgeCell?: string;\n };\n}\n\nconst DataGridContext = createContext<\n // biome-ignore lint/suspicious/noExplicitAny: <>\n DataGridContextProps<any> | undefined\n>(undefined);\n\n/**\n * Reads the grid context. Pass `TData` from the calling component when the\n * table, a row or a cell is handed on to something typed against that row\n * shape: v9 declares `TData` invariant, so the default `any` no longer\n * unifies with a concrete row type the way it did on v8.\n */\nfunction useDataGrid<\n // biome-ignore lint/suspicious/noExplicitAny: <>\n TData extends object = any,\n>(): DataGridContextProps<TData> {\n const context = useContext(DataGridContext) as DataGridContextProps<TData> | undefined;\n if (!context) {\n throw new Error(\"useDataGrid must be used within a DataGridProvider\");\n }\n return context;\n}\n\nfunction DataGridProvider<TData extends object>({\n children,\n table,\n ...props\n}: DataGridLayoutProps<TData> & {\n table: DataGridTableInstance<TData>;\n children?: ReactNode;\n}) {\n // Latest-props ref: context reads always resolve fresh props through the\n // getter below without the memoized context value depending on unstable\n // ReactNode/function prop identities (inline emptyMessage/onRowClick would\n // otherwise publish a new context value on every consumer render - at\n // mousemove rate during a resize drag, piercing the body-rows memo).\n const propsRef = useRef(props);\n propsRef.current = props;\n\n // Same treatment for the table itself, which v9 - unlike v8 - re-creates on\n // every state change. Depending on it directly would republish the context\n // on each resize tick, which is exactly what the memo below exists to\n // prevent; the getter still hands every consumer the current instance.\n const tableRef = useRef(table);\n tableRef.current = table;\n\n // Re-assert an explicit tableLayout resize mode so consumer-level useTable\n // options cannot flip it back between drags. v9 makes `table.options`\n // readonly, so this goes through setOptions in an effect rather than a\n // render-phase mutation. Without an explicit mode, the consumer's own\n // tanstack columnResizeMode (default \"onEnd\") is honored.\n const resizeMode =\n props.tableLayout?.columnsResizable && props.tableLayout.columnsResizeMode\n ? props.tableLayout.columnsResizeMode\n : undefined;\n\n useEffect(() => {\n if (!resizeMode) return;\n if (table.options.columnResizeMode === resizeMode) return;\n table.setOptions((old) => ({ ...old, columnResizeMode: resizeMode }));\n }, [table, resizeMode]);\n\n // One autoSize coordinator per table instance so split header/body viewports\n // cannot apply the growth twice. Keyed on `table.store`, which v9 keeps\n // stable for the life of the table, rather than on `table` itself: the\n // wrapper is re-created on every state change, and re-creating the\n // controller with it would reset its applied-once bookkeeping mid-drag.\n const autoSize = useMemo(() => createDataGridAutoSizeController(() => tableRef.current), []);\n\n // Memoize context value so consumers don't re-render during column resize.\n // Column sizing state is intentionally excluded from deps -- CSS variables\n // on the <table> element handle width updates without React re-renders.\n // ReactNode/function props (messages, onRowClick) are also excluded: they\n // are served fresh through the props getter, so unstable inline identities\n // cannot invalidate the context value.\n const value = useMemo(\n () => ({\n get props() {\n return propsRef.current;\n },\n get table() {\n return tableRef.current;\n },\n recordCount: props.recordCount,\n isLoading: props.isLoading || false,\n autoSize,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [autoSize, props.recordCount, props.isLoading],\n );\n\n return (\n // One React context serves every TData, but v9 declares both TFeatures and\n // TData invariant, so a `DataGridContextProps<any>` context cannot accept a\n // `DataGridContextProps<TData>` value structurally. The erasure happens\n // here and is undone by the TData generic on each consumer component.\n <DataGridContext.Provider value={value as unknown as DataGridContextProps<TData>}>\n {children}\n </DataGridContext.Provider>\n );\n}\n\nfunction DataGrid<TFeatures extends TableFeatures, TData extends object>({\n children,\n table,\n ...props\n}: DataGridProps<TFeatures, TData>) {\n const defaultProps: Partial<DataGridProps<TFeatures, TData>> = {\n loadingMode: \"skeleton\",\n tableLayout: {\n dense: false,\n cellBorder: false,\n rowBorder: true,\n rowRounded: false,\n stripped: false,\n headerSticky: false,\n headerBackground: false,\n footerBackground: false,\n headerBorder: true,\n width: \"fixed\",\n columnsVisibility: false,\n columnsResizable: false,\n // columnsResizeMode has no default on purpose: when unset, the\n // consumer's tanstack columnResizeMode (default \"onEnd\") is honored.\n columnsPinnable: false,\n columnsMovable: false,\n columnsDraggable: false,\n rowsDraggable: false,\n rowsPinnable: false,\n },\n tableClassNames: {\n base: \"\",\n header: \"\",\n headerRow: \"\",\n // z-40 keeps the sticky header above pinned body cells (zIndex 30 in\n // getPinningStyles), which would otherwise paint over it while\n // scrolling vertically with columnsPinnable enabled.\n headerSticky: \"sticky top-0 z-40 bg-background/90 backdrop-blur-xs\",\n body: \"\",\n bodyRow: \"\",\n footer: \"\",\n edgeCell: \"\",\n },\n };\n\n const mergedProps: DataGridProps<TFeatures, TData> = {\n ...defaultProps,\n ...props,\n tableLayout: {\n ...defaultProps.tableLayout,\n ...(props.tableLayout || {}),\n },\n tableClassNames: {\n ...defaultProps.tableClassNames,\n ...(props.tableClassNames || {}),\n },\n };\n\n // Ensure table is provided\n if (!table) {\n throw new Error('DataGrid requires a \"table\" prop');\n }\n\n // The single widening point. Consumers own the TanStack core and may hand\n // over any feature bundle; internals need a concrete one to resolve the\n // feature-gated APIs they call, and v9's invariant TFeatures rules out\n // expressing that with a generic constraint.\n const internalTable = table as unknown as DataGridTableInstance<TData>;\n const internalProps = mergedProps as unknown as DataGridLayoutProps<TData>;\n\n return (\n <DataGridProvider table={internalTable} {...internalProps}>\n {children}\n </DataGridProvider>\n );\n}\n\nfunction DataGridContainer({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n /** Accepted for backwards compatibility; currently has no effect. */\n border?: boolean;\n}) {\n return (\n <div data-slot=\"data-grid\" className={cn(\"w-full overflow-hidden\", className)}>\n {children}\n </div>\n );\n}\n\nexport { DataGrid, DataGridContainer, DataGridProvider, useDataGrid };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,MAAa,mBAAmB,cAAc;CAC5C;CACA;CACA;CACA;CAEA;CACA;CAKA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA,gBAAgB,qBAAqB;CACrC,kBAAkB,uBAAuB;CACzC,mBAAmB,wBAAwB;CAC3C,kBAAkB,uBAAuB;CACzC,iBAAiB,sBAAsB;CACvC,qBAAqB,0BAA0B;CAI/C,SAAS;EAAE,OAAO;EAAc,MAAM;CAAY;CAElD,YAAY,WAAoC;AAClD,CAAC;;AAkBD,SAAgB,qBACd,QACQ;CACR,MAAM,OAAO,OAAO,UAAU;CAC9B,IAAI,OAAO,MAAM,gBAAgB,UAAU,OAAO,KAA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AAM,mBAAmB,CAAC;EAChC;CACF;CAGA,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,oCAAkC;CAUpD,OACE,oBAAC,kBAAD;EAAyBA;EAAe,GAAIC;EACzC;CACe,CAAA;AAEtB;AAEA,SAAS,kBAAkB,EACzB,UACA,aAMC;CACD,OACE,oBAAC,OAAD;EAAK,aAAU;EAAY,WAAW,GAAG,0BAA0B,SAAS;EACzE;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"data-grid.js","names":["internalTable","internalProps"],"sources":["../../../../src/components/reui/data-grid/data-grid.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { createContext, useContext, useEffect, useMemo, useRef } from \"react\";\nimport type {\n Column,\n ColumnFiltersState,\n ReactTable,\n RowData,\n SortingState,\n Table,\n TableFeatures,\n} from \"@tanstack/react-table\";\nimport {\n columnFacetingFeature,\n columnFilteringFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnResizingFeature,\n columnSizingFeature,\n columnVisibilityFeature,\n createExpandedRowModel,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n globalFilteringFeature,\n metaHelper,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n sortFn_alphanumeric,\n sortFn_alphanumericCaseSensitive,\n sortFn_basic,\n sortFn_datetime,\n sortFn_text,\n sortFn_textCaseSensitive,\n tableFeatures,\n} from \"@tanstack/react-table\";\n\nimport { cn } from \"@kumix/utils\";\n\n/**\n * Per-column extras the grid reads off `columnDef.meta`.\n *\n * TanStack v9 resolves this through the `columnMeta` slot on the feature\n * bundle below instead of a global `declare module` augmentation, so\n * installing the data grid no longer widens `ColumnMeta` for every other\n * table in the consuming app.\n */\nexport interface DataGridColumnMeta<TData> {\n headerTitle?: string;\n headerClassName?: string;\n cellClassName?: string;\n skeleton?: ReactNode;\n expandedContent?: (row: TData) => ReactNode;\n autoSize?: boolean;\n}\n\n/**\n * The batteries-included feature bundle every ReUI data-grid example builds\n * on. v9 requires each table to declare its features up front, and the grid's\n * render path needs the ones registered here: `columnVisibilityFeature` alone\n * gates `row.getVisibleCells()`, so even a grid that never hides a column\n * needs it to render at all.\n *\n * Pass it straight through for the full grid:\n *\n * ```tsx\n * const table = useTable({ features: dataGridFeatures, columns, data })\n * ```\n *\n * Extend it when a grid needs more, keeping each prerequisite feature ahead of\n * the slot that depends on it:\n *\n * ```tsx\n * const features = tableFeatures({\n * ...dataGridFeatures,\n * columnGroupingFeature,\n * groupedRowModel: createGroupedRowModel(),\n * })\n * ```\n *\n * Or drop it entirely and hand `<DataGrid>` a leaner table - the components\n * accept any bundle, so you keep full ownership of the TanStack core.\n */\nexport const dataGridFeatures = tableFeatures({\n columnVisibilityFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnSizingFeature,\n // columnResizingFeature requires columnSizingFeature, declared above.\n columnResizingFeature,\n columnFilteringFeature,\n // Powers DataGridColumnFilter's column.getFacetedUniqueValues(). On v8 an\n // unregistered facet silently returned an empty map; on v9 the method would\n // not exist at all, so the faceted row models below are required, not\n // optional.\n columnFacetingFeature,\n // globalFilteringFeature requires columnFilteringFeature, declared above.\n globalFilteringFeature,\n rowSortingFeature,\n rowPaginationFeature,\n rowSelectionFeature,\n rowExpandingFeature,\n rowPinningFeature,\n sortedRowModel: createSortedRowModel(),\n filteredRowModel: createFilteredRowModel(),\n paginatedRowModel: createPaginatedRowModel(),\n expandedRowModel: createExpandedRowModel(),\n facetedRowModel: createFacetedRowModel(),\n facetedUniqueValues: createFacetedUniqueValues(),\n // Every built-in v9 ships. A string `sortFn` resolves against this map\n // alone, and `sortFn: \"auto\"` infers a name (\"alphanumeric\", \"text\" or\n // \"datetime\") from the first row's value - so a partial map makes auto\n // sorting warn and silently fall back on ordinary string columns.\n sortFns: {\n alphanumeric: sortFn_alphanumeric,\n alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,\n basic: sortFn_basic,\n datetime: sortFn_datetime,\n text: sortFn_text,\n textCaseSensitive: sortFn_textCaseSensitive,\n },\n // biome-ignore lint/suspicious/noExplicitAny: <>\n columnMeta: metaHelper<DataGridColumnMeta<any>>(),\n});\n\n/** The feature set `dataGridFeatures` registers. */\nexport type DataGridFeatures = typeof dataGridFeatures;\n\n/**\n * The grid's internal view of the table.\n *\n * `TFeatures` is invariant in v9 and an unresolved generic one collapses to a\n * union that includes the bare core arm, so no generic signature can call\n * `getVisibleCells()`, `getStartVisibleLeafColumns()` and friends. The public\n * components stay generic so consumers can pass any bundle they like; the\n * table is widened to this concrete type exactly once, on the way into\n * context, and every internal component reads it from there.\n */\nexport type DataGridTableInstance<TData extends object> = ReactTable<DataGridFeatures, TData>;\n\n/** Label for headers / column visibility: `meta.headerTitle`, string `columnDef.header`, or `column.id`. */\nexport function getColumnHeaderLabel<TData extends RowData, TValue>(\n column: Column<DataGridFeatures, TData, TValue>,\n): string {\n const meta = column.columnDef.meta as { headerTitle?: string } | undefined;\n if (typeof meta?.headerTitle === \"string\") return meta.headerTitle;\n const defHeader = column.columnDef.header;\n if (typeof defHeader === \"string\") return defHeader;\n return String(column.id);\n}\n\nexport type DataGridApiFetchParams = {\n pageIndex: number;\n pageSize: number;\n sorting?: SortingState;\n filters?: ColumnFiltersState;\n searchQuery?: string;\n};\n\nexport type DataGridApiResponse<T> = {\n data: T[];\n empty: boolean;\n pagination: {\n total: number;\n page: number;\n };\n};\n\n/**\n * Everything `<DataGrid>` accepts except the two props the provider consumes\n * itself. Kept feature-agnostic: layout and messaging never depend on which\n * TanStack features the consumer registered.\n */\nexport type DataGridLayoutProps<TData extends object> = Omit<\n DataGridProps<TableFeatures, TData>,\n \"table\" | \"children\"\n>;\n\nexport interface DataGridContextProps<TData extends object> {\n props: DataGridLayoutProps<TData>;\n table: DataGridTableInstance<TData>;\n recordCount: number;\n isLoading: boolean;\n /**\n * Internal coordinator for `meta.autoSize` columns. Lives at the core level\n * so every table variant and viewport instance shares one application state.\n */\n autoSize?: DataGridAutoSizeController;\n}\n\nexport type DataGridAutoSizeController = {\n /**\n * Grows the first visible `meta.autoSize` column by the given free space.\n * Applies at most once per column id; safe to call from every viewport\n * measurement. Returns true when a sizing update was dispatched.\n */\n apply: (fillWidth: number) => boolean;\n};\n\nfunction createDataGridAutoSizeController<TData extends object>(\n /**\n * A getter, not the table itself.\n *\n * v8 handed back one stable table whose state mutated in place, so a\n * controller could close over it. v9 returns a NEW table wrapper on every\n * state change, and a captured one keeps reporting the state it was built\n * with - here that meant `columnSizing` looked permanently empty, the\n * applied-once guard re-armed on every measurement, and the fill overwrote\n * whatever width the user had just dragged the column to.\n */\n getTable: () => DataGridTableInstance<TData>,\n): DataGridAutoSizeController {\n let applied: { columnId: string; base: number; grown: number } | null = null;\n\n return {\n apply(fillWidth: number) {\n const table = getTable();\n const columnSizing = table.state.columnSizing;\n\n // Re-arm after reset flows (double-click resetSize, resetColumnSizing,\n // controlled state replacement) so the column re-fills instead of\n // leaving a dead blank strip.\n if (applied && columnSizing[applied.columnId] === undefined) {\n applied = null;\n }\n\n if (fillWidth <= 0) return false;\n\n const autoSizeColumn = table\n .getVisibleLeafColumns()\n .find((column) => column.columnDef.meta?.autoSize && column.getCanResize());\n\n if (!autoSizeColumn || applied?.columnId === autoSizeColumn.id) {\n return false;\n }\n\n // A width this coordinator did not write belongs to someone else -\n // almost always the user, who just dragged the column's resize handle.\n // Filling over it is what made a `meta.autoSize` column look\n // un-resizable: the drag committed, the next viewport measurement\n // stamped the fill back on top, and the column snapped to its old width.\n //\n // Deliberately keyed on observed state rather than on `applied`, which\n // is per-coordinator memory: anything that rebuilds the coordinator\n // (a remount, a new table store) forgets what it did, and the guard has\n // to survive that. An explicit reset clears the entry and re-arms the\n // fill, which is what makes double-click-to-reset still work.\n const currentSize = columnSizing[autoSizeColumn.id];\n if (currentSize !== undefined && currentSize !== applied?.grown) {\n return false;\n }\n\n // Candidate switched (e.g. the grown column was hidden and another\n // meta.autoSize column took over): revert the previous growth if the\n // user hasn't manually resized that column since, so visibility\n // toggles cannot ratchet the table wider than its container forever.\n const revert = applied && columnSizing[applied.columnId] === applied.grown ? applied : null;\n const base = columnSizing[autoSizeColumn.id] ?? autoSizeColumn.getSize();\n const grown = base + fillWidth;\n\n applied = { columnId: autoSizeColumn.id, base, grown };\n table.setColumnSizing((old) => {\n const next = { ...old, [autoSizeColumn.id]: grown };\n if (revert && next[revert.columnId] === revert.grown) {\n next[revert.columnId] = revert.base;\n }\n return next;\n });\n\n return true;\n },\n };\n}\n\nexport type DataGridRequestParams = {\n pageIndex: number;\n pageSize: number;\n sorting?: SortingState;\n columnFilters?: ColumnFiltersState;\n};\n\nexport interface DataGridProps<TFeatures extends TableFeatures, TData extends object> {\n className?: string;\n table?: Table<TFeatures, TData>;\n recordCount: number;\n children?: ReactNode;\n onRowClick?: (row: TData) => void;\n isLoading?: boolean;\n loadingMode?: \"skeleton\" | \"spinner\";\n loadingMessage?: ReactNode | string;\n fetchingMoreMessage?: ReactNode | string;\n allRowsLoadedMessage?: ReactNode | string;\n emptyMessage?: ReactNode | string;\n tableLayout?: {\n dense?: boolean;\n cellBorder?: boolean;\n rowBorder?: boolean;\n rowRounded?: boolean;\n stripped?: boolean;\n headerBackground?: boolean;\n footerBackground?: boolean;\n headerBorder?: boolean;\n headerSticky?: boolean;\n width?: \"auto\" | \"fixed\";\n columnsVisibility?: boolean;\n columnsResizable?: boolean;\n columnsResizeMode?: \"onChange\" | \"onEnd\";\n columnsPinnable?: boolean;\n columnsMovable?: boolean;\n columnsDraggable?: boolean;\n rowsDraggable?: boolean;\n rowsPinnable?: boolean;\n };\n tableClassNames?: {\n base?: string;\n header?: string;\n headerRow?: string;\n headerSticky?: string;\n body?: string;\n bodyRow?: string;\n footer?: string;\n edgeCell?: string;\n };\n}\n\nconst DataGridContext = createContext<\n // biome-ignore lint/suspicious/noExplicitAny: <>\n DataGridContextProps<any> | undefined\n>(undefined);\n\n/**\n * Reads the grid context. Pass `TData` from the calling component when the\n * table, a row or a cell is handed on to something typed against that row\n * shape: v9 declares `TData` invariant, so the default `any` no longer\n * unifies with a concrete row type the way it did on v8.\n */\nfunction useDataGrid<\n // biome-ignore lint/suspicious/noExplicitAny: <>\n TData extends object = any,\n>(): DataGridContextProps<TData> {\n const context = useContext(DataGridContext) as DataGridContextProps<TData> | undefined;\n if (!context) {\n throw new Error(\"useDataGrid must be used within a DataGridProvider\");\n }\n return context;\n}\n\nfunction DataGridProvider<TData extends object>({\n children,\n table,\n ...props\n}: DataGridLayoutProps<TData> & {\n table: DataGridTableInstance<TData>;\n children?: ReactNode;\n}) {\n // Latest-props ref: context reads always resolve fresh props through the\n // getter below without the memoized context value depending on unstable\n // ReactNode/function prop identities (inline emptyMessage/onRowClick would\n // otherwise publish a new context value on every consumer render - at\n // mousemove rate during a resize drag, piercing the body-rows memo).\n const propsRef = useRef(props);\n propsRef.current = props;\n\n // Same treatment for the table itself, which v9 - unlike v8 - re-creates on\n // every state change. Depending on it directly would republish the context\n // on each resize tick, which is exactly what the memo below exists to\n // prevent; the getter still hands every consumer the current instance.\n const tableRef = useRef(table);\n tableRef.current = table;\n\n // Re-assert an explicit tableLayout resize mode so consumer-level useTable\n // options cannot flip it back between drags. v9 makes `table.options`\n // readonly, so this goes through setOptions in an effect rather than a\n // render-phase mutation. Without an explicit mode, the consumer's own\n // tanstack columnResizeMode (default \"onEnd\") is honored.\n const resizeMode =\n props.tableLayout?.columnsResizable && props.tableLayout.columnsResizeMode\n ? props.tableLayout.columnsResizeMode\n : undefined;\n\n useEffect(() => {\n if (!resizeMode) return;\n if (table.options.columnResizeMode === resizeMode) return;\n table.setOptions((old) => ({ ...old, columnResizeMode: resizeMode }));\n }, [table, resizeMode]);\n\n // One autoSize coordinator per table instance so split header/body viewports\n // cannot apply the growth twice. Keyed on `table.store`, which v9 keeps\n // stable for the life of the table, rather than on `table` itself: the\n // wrapper is re-created on every state change, and re-creating the\n // controller with it would reset its applied-once bookkeeping mid-drag.\n const autoSize = useMemo(() => createDataGridAutoSizeController(() => tableRef.current), []);\n\n // Memoize context value so consumers don't re-render during column resize.\n // Column sizing state is intentionally excluded from deps -- CSS variables\n // on the <table> element handle width updates without React re-renders.\n // ReactNode/function props (messages, onRowClick) are also excluded: they\n // are served fresh through the props getter, so unstable inline identities\n // cannot invalidate the context value.\n const value = useMemo(\n () => ({\n get props() {\n return propsRef.current;\n },\n get table() {\n return tableRef.current;\n },\n recordCount: props.recordCount,\n isLoading: props.isLoading || false,\n autoSize,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [autoSize, props.recordCount, props.isLoading],\n );\n\n return (\n // One React context serves every TData, but v9 declares both TFeatures and\n // TData invariant, so a `DataGridContextProps<any>` context cannot accept a\n // `DataGridContextProps<TData>` value structurally. The erasure happens\n // here and is undone by the TData generic on each consumer component.\n <DataGridContext.Provider value={value as unknown as DataGridContextProps<TData>}>\n {children}\n </DataGridContext.Provider>\n );\n}\n\nfunction DataGrid<TFeatures extends TableFeatures, TData extends object>({\n children,\n table,\n ...props\n}: DataGridProps<TFeatures, TData>) {\n const defaultProps: Partial<DataGridProps<TFeatures, TData>> = {\n loadingMode: \"skeleton\",\n tableLayout: {\n dense: false,\n cellBorder: false,\n rowBorder: true,\n rowRounded: false,\n stripped: false,\n headerSticky: false,\n headerBackground: false,\n footerBackground: false,\n headerBorder: true,\n width: \"fixed\",\n columnsVisibility: false,\n columnsResizable: false,\n // columnsResizeMode has no default on purpose: when unset, the\n // consumer's tanstack columnResizeMode (default \"onEnd\") is honored.\n columnsPinnable: false,\n columnsMovable: false,\n columnsDraggable: false,\n rowsDraggable: false,\n rowsPinnable: false,\n },\n tableClassNames: {\n base: \"\",\n header: \"\",\n headerRow: \"\",\n // z-40 keeps the sticky header above pinned body cells (zIndex 30 in\n // getPinningStyles), which would otherwise paint over it while\n // scrolling vertically with columnsPinnable enabled.\n headerSticky: \"sticky top-0 z-40 bg-background/90 backdrop-blur-xs\",\n body: \"\",\n bodyRow: \"\",\n footer: \"\",\n edgeCell: \"\",\n },\n };\n\n const mergedProps: DataGridProps<TFeatures, TData> = {\n ...defaultProps,\n ...props,\n tableLayout: {\n ...defaultProps.tableLayout,\n ...(props.tableLayout || {}),\n },\n tableClassNames: {\n ...defaultProps.tableClassNames,\n ...(props.tableClassNames || {}),\n },\n };\n\n // Ensure table is provided\n if (!table) {\n throw new Error('DataGrid requires a \"table\" prop');\n }\n\n // The single widening point. Consumers own the TanStack core and may hand\n // over any feature bundle; internals need a concrete one to resolve the\n // feature-gated APIs they call, and v9's invariant TFeatures rules out\n // expressing that with a generic constraint.\n const internalTable = table as unknown as DataGridTableInstance<TData>;\n const internalProps = mergedProps as unknown as DataGridLayoutProps<TData>;\n\n return (\n <DataGridProvider table={internalTable} {...internalProps}>\n {children}\n </DataGridProvider>\n );\n}\n\nfunction DataGridContainer({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n /** Accepted for backwards compatibility; currently has no effect. */\n border?: boolean;\n}) {\n return (\n <div data-slot=\"data-grid\" className={cn(\"w-full overflow-hidden\", className)}>\n {children}\n </div>\n );\n}\n\nexport { DataGrid, DataGridContainer, DataGridProvider, useDataGrid };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,MAAa,mBAAmB,cAAc;CAC5C;CACA;CACA;CACA;CAEA;CACA;CAKA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA,gBAAgB,qBAAqB;CACrC,kBAAkB,uBAAuB;CACzC,mBAAmB,wBAAwB;CAC3C,kBAAkB,uBAAuB;CACzC,iBAAiB,sBAAsB;CACvC,qBAAqB,0BAA0B;CAK/C,SAAS;EACP,cAAc;EACd,2BAA2B;EAC3B,OAAO;EACP,UAAU;EACV,MAAM;EACN,mBAAmB;CACrB;CAEA,YAAY,WAAoC;AAClD,CAAC;;AAkBD,SAAgB,qBACd,QACQ;CACR,MAAM,OAAO,OAAO,UAAU;CAC9B,IAAI,OAAO,MAAM,gBAAgB,UAAU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ChB,GAAI,MAAM,mBAAmB,CAAC;EAChC;CACF;CAGA,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,oCAAkC;CAUpD,OACE,oBAAC,kBAAD;EAAyBA;EAAe,GAAIC;EACzC;CACe,CAAA;AAEtB;AAEA,SAAS,kBAAkB,EACzB,UACA,aAMC;CACD,OACE,oBAAC,OAAD;EAAK,aAAU;EAAY,WAAW,GAAG,0BAA0B,SAAS;EACzE;CACE,CAAA;AAET"}
@@ -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;UAGI,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"}
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,MAAM,+BACJ;AASF,MAAM,2BAEJ,cAAyD,IAAI;;AAG/D,SAAS,4BAAmF;CAC1F,MAAM,MA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A;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;CACR,SAAS;CACT,eAAe;;CAEf,gBAAgB;AAClB;;;;;;;;;;;AAYA,MAAM,+BACJ;;;;;;;;;;;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AO,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":";;;UAoFU,oCAAoC,UAAU;EACtD;;iBAGO,yBACP,WACA,QACA,qBACG,SACF,8CAA2B,IAAA;UA20BpB;EACR,KAAK;EACL;;;EAGA,UAAU;;;;EAIV;IAAa;IAAgB;;;;;;;iBAOtB,6BACP,KACA,OACA,UACA,YACC,kDAA+B,IAAA"}
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"}
@@ -4,7 +4,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.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 && "bg-primary/5", viewConfig.classNames?.monthCell),
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 border-primary/40 border-y border-dashed", inDraft.isStart && "border-s", inDraft.isEnd && "border-e", viewConfig.classNames?.slotDraft)
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
  }