@stll/ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calendar/index.d.ts +4 -0
- package/dist/calendar/index.js +4 -0
- package/dist/calendar/primitives.d.ts +10 -0
- package/dist/calendar/primitives.js +36 -0
- package/dist/calendar/resource-calendar.d.ts +35 -0
- package/dist/calendar/resource-calendar.js +184 -0
- package/dist/calendar/resource-calendar.logic.d.ts +28 -0
- package/dist/calendar/resource-calendar.logic.js +88 -0
- package/dist/components/button-variants.d.ts +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +5 -1
- package/dist/kanban/drag-interactions.d.ts +35 -0
- package/dist/kanban/drag-interactions.js +53 -0
- package/dist/kanban/index.d.ts +2 -1
- package/dist/kanban/index.js +2 -1
- package/package.json +9 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow } from "./primitives.js";
|
|
2
|
+
import { CalendarDateRange, ResourceCalendarLaneLayout, ResourceCalendarLanePlacement, ResourceCalendarPlacement, assertConsecutiveCalendarDates, getResourceCalendarPlacement, layoutResourceCalendarEntries, nextCalendarDate } from "./resource-calendar.logic.js";
|
|
3
|
+
import { ResourceCalendar, ResourceCalendarColumn, ResourceCalendarEntry, ResourceCalendarEntryTone, ResourceCalendarResource } from "./resource-calendar.js";
|
|
4
|
+
export { CalendarCell, type CalendarDateRange, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow, ResourceCalendar, type ResourceCalendarColumn, type ResourceCalendarEntry, type ResourceCalendarEntryTone, type ResourceCalendarLaneLayout, type ResourceCalendarLanePlacement, type ResourceCalendarPlacement, type ResourceCalendarResource, assertConsecutiveCalendarDates, getResourceCalendarPlacement, layoutResourceCalendarEntries, nextCalendarDate };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow } from "./primitives.js";
|
|
2
|
+
import { assertConsecutiveCalendarDates, getResourceCalendarPlacement, layoutResourceCalendarEntries, nextCalendarDate } from "./resource-calendar.logic.js";
|
|
3
|
+
import { ResourceCalendar } from "./resource-calendar.js";
|
|
4
|
+
export { CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow, ResourceCalendar, assertConsecutiveCalendarDates, getResourceCalendarPlacement, layoutResourceCalendarEntries, nextCalendarDate };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/calendar/primitives.d.ts
|
|
3
|
+
declare const CalendarGrid: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
4
|
+
declare const CalendarHeaderRow: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
5
|
+
declare const CalendarHeaderCell: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
6
|
+
declare const CalendarCell: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
7
|
+
declare const CalendarEntryButton: ({ className, ...props }: React$1.ComponentProps<"button">) => React$1.JSX.Element;
|
|
8
|
+
declare const CalendarEntrySurface: ({ className, ...props }: React$1.ComponentProps<"article">) => React$1.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/calendar/primitives.tsx
|
|
4
|
+
const CalendarGrid = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
5
|
+
className: cn("grid", className),
|
|
6
|
+
"data-slot": "calendar-grid",
|
|
7
|
+
...props
|
|
8
|
+
});
|
|
9
|
+
const CalendarHeaderRow = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
10
|
+
className: cn("grid border-b", className),
|
|
11
|
+
"data-slot": "calendar-header-row",
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
const CalendarHeaderCell = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
15
|
+
className: cn("text-muted-foreground border-e px-2 py-2 text-center text-xs font-medium last:border-e-0", className),
|
|
16
|
+
"data-slot": "calendar-header-cell",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
const CalendarCell = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: cn("border-e border-b", className),
|
|
21
|
+
"data-slot": "calendar-cell",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
const CalendarEntryButton = ({ className, ...props }) => /* @__PURE__ */ jsx("button", {
|
|
25
|
+
className: cn("focus-visible:ring-ring min-w-0 rounded-md text-start text-xs outline-none focus-visible:ring-2 focus-visible:ring-offset-1", className),
|
|
26
|
+
"data-slot": "calendar-entry",
|
|
27
|
+
type: "button",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
const CalendarEntrySurface = ({ className, ...props }) => /* @__PURE__ */ jsx("article", {
|
|
31
|
+
className: cn("min-w-0 rounded-md text-start text-xs", className),
|
|
32
|
+
"data-slot": "calendar-entry",
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
//#region src/calendar/resource-calendar.d.ts
|
|
3
|
+
type ResourceCalendarColumn = {
|
|
4
|
+
date: string;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
meta?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
type ResourceCalendarResource = {
|
|
9
|
+
id: string;
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
meta?: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
type ResourceCalendarEntryTone = "accent" | "neutral" | "warning" | "destructive";
|
|
14
|
+
type ResourceCalendarEntry = {
|
|
15
|
+
accessibleLabel: string;
|
|
16
|
+
endDateExclusive: string;
|
|
17
|
+
id: string;
|
|
18
|
+
label: ReactNode;
|
|
19
|
+
meta?: ReactNode;
|
|
20
|
+
resourceId: string;
|
|
21
|
+
startDate: string;
|
|
22
|
+
tone?: ResourceCalendarEntryTone;
|
|
23
|
+
};
|
|
24
|
+
type ResourceCalendarProps = {
|
|
25
|
+
ariaLabel: string;
|
|
26
|
+
columns: readonly ResourceCalendarColumn[];
|
|
27
|
+
empty?: ReactNode;
|
|
28
|
+
entries: readonly ResourceCalendarEntry[];
|
|
29
|
+
onSelectEntry?: (entry: ResourceCalendarEntry) => void;
|
|
30
|
+
resourceHeader: ReactNode;
|
|
31
|
+
resources: readonly ResourceCalendarResource[];
|
|
32
|
+
};
|
|
33
|
+
declare const ResourceCalendar: ({ ariaLabel, columns, empty, entries, onSelectEntry, resourceHeader, resources }: ResourceCalendarProps) => ReactElement;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ResourceCalendar, ResourceCalendarColumn, ResourceCalendarEntry, ResourceCalendarEntryTone, ResourceCalendarResource };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarHeaderCell, CalendarHeaderRow } from "./primitives.js";
|
|
3
|
+
import { assertConsecutiveCalendarDates, layoutResourceCalendarEntries, nextCalendarDate } from "./resource-calendar.logic.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
//#region src/calendar/resource-calendar.tsx
|
|
7
|
+
const ResourceCalendar = ({ ariaLabel, columns, empty, entries, onSelectEntry, resourceHeader, resources }) => {
|
|
8
|
+
assertResourceCalendarContract({
|
|
9
|
+
columns,
|
|
10
|
+
entries,
|
|
11
|
+
resources
|
|
12
|
+
});
|
|
13
|
+
const calendarId = useId();
|
|
14
|
+
if (resources.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
15
|
+
"data-slot": "resource-calendar-empty",
|
|
16
|
+
children: empty
|
|
17
|
+
});
|
|
18
|
+
const gridStyle = { gridTemplateColumns: `14rem repeat(${String(columns.length)}, minmax(7rem, 1fr))` };
|
|
19
|
+
const calendarWidthStyle = { minWidth: `${String(14 + columns.length * 7)}rem` };
|
|
20
|
+
const visibleRange = {
|
|
21
|
+
endDateExclusive: nextCalendarDate(columns.at(-1)?.date ?? ""),
|
|
22
|
+
startDate: columns.at(0)?.date ?? ""
|
|
23
|
+
};
|
|
24
|
+
const entriesByResource = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const entry of entries) {
|
|
26
|
+
const existing = entriesByResource.get(entry.resourceId);
|
|
27
|
+
if (existing === void 0) {
|
|
28
|
+
entriesByResource.set(entry.resourceId, [entry]);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
existing.push(entry);
|
|
32
|
+
}
|
|
33
|
+
const getColumnHeaderId = (index) => `${calendarId}-column-${String(index)}`;
|
|
34
|
+
return /* @__PURE__ */ jsx("section", {
|
|
35
|
+
"aria-colcount": columns.length + 1,
|
|
36
|
+
"aria-label": ariaLabel,
|
|
37
|
+
"aria-rowcount": resources.length + 1,
|
|
38
|
+
className: "border-border bg-card overflow-x-auto rounded-xl border",
|
|
39
|
+
"data-slot": "resource-calendar",
|
|
40
|
+
role: "table",
|
|
41
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: "w-full",
|
|
43
|
+
style: calendarWidthStyle,
|
|
44
|
+
children: [/* @__PURE__ */ jsxs(CalendarHeaderRow, {
|
|
45
|
+
role: "row",
|
|
46
|
+
style: gridStyle,
|
|
47
|
+
children: [/* @__PURE__ */ jsx(CalendarHeaderCell, {
|
|
48
|
+
"aria-colindex": 1,
|
|
49
|
+
className: "bg-card sticky start-0 z-30 text-start font-semibold tracking-wide uppercase",
|
|
50
|
+
role: "columnheader",
|
|
51
|
+
children: resourceHeader
|
|
52
|
+
}), columns.map((column, index) => /* @__PURE__ */ jsxs(CalendarHeaderCell, {
|
|
53
|
+
"aria-colindex": index + 2,
|
|
54
|
+
id: getColumnHeaderId(index),
|
|
55
|
+
role: "columnheader",
|
|
56
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "block",
|
|
58
|
+
children: column.label
|
|
59
|
+
}), column.meta === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: "text-foreground mt-0.5 block font-semibold",
|
|
61
|
+
children: column.meta
|
|
62
|
+
})]
|
|
63
|
+
}, column.date))]
|
|
64
|
+
}), resources.map((resource, resourceIndex) => {
|
|
65
|
+
const resourceEntries = entriesByResource.get(resource.id) ?? [];
|
|
66
|
+
const layout = layoutResourceCalendarEntries(resourceEntries, visibleRange);
|
|
67
|
+
const resourceEntryById = new Map(resourceEntries.map((entry) => [entry.id, entry]));
|
|
68
|
+
const visibleEntriesByColumn = /* @__PURE__ */ new Map();
|
|
69
|
+
for (const placement of layout.placements) {
|
|
70
|
+
const entry = resourceEntryById.get(placement.entryId);
|
|
71
|
+
if (entry === void 0) throw new TypeError(`Resource calendar layout references unknown entry ${placement.entryId}`);
|
|
72
|
+
const existing = visibleEntriesByColumn.get(placement.columnStart);
|
|
73
|
+
if (existing === void 0) {
|
|
74
|
+
visibleEntriesByColumn.set(placement.columnStart, [{
|
|
75
|
+
entry,
|
|
76
|
+
placement
|
|
77
|
+
}]);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
existing.push({
|
|
81
|
+
entry,
|
|
82
|
+
placement
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const resourceHeaderId = `${calendarId}-resource-${String(resourceIndex)}`;
|
|
86
|
+
const resourceRowStyle = {
|
|
87
|
+
...gridStyle,
|
|
88
|
+
minHeight: `${String(Math.max(5, layout.rowCount * 3.75))}rem`
|
|
89
|
+
};
|
|
90
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
91
|
+
className: "border-border relative grid min-h-20 border-b last:border-b-0",
|
|
92
|
+
"data-slot": "resource-calendar-row",
|
|
93
|
+
role: "row",
|
|
94
|
+
style: resourceRowStyle,
|
|
95
|
+
children: [/* @__PURE__ */ jsxs(CalendarCell, {
|
|
96
|
+
"aria-colindex": 1,
|
|
97
|
+
"aria-rowindex": resourceIndex + 2,
|
|
98
|
+
className: "bg-card sticky start-0 z-20 border-b-0 px-4 py-3",
|
|
99
|
+
id: resourceHeaderId,
|
|
100
|
+
role: "rowheader",
|
|
101
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
102
|
+
className: "block truncate text-sm font-semibold",
|
|
103
|
+
children: resource.label
|
|
104
|
+
}), resource.meta === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
105
|
+
className: "text-muted-foreground mt-1 block truncate text-xs",
|
|
106
|
+
children: resource.meta
|
|
107
|
+
})]
|
|
108
|
+
}), columns.map((column, columnIndex) => {
|
|
109
|
+
const columnStart = columnIndex + 2;
|
|
110
|
+
const visibleEntries = visibleEntriesByColumn.get(columnStart) ?? [];
|
|
111
|
+
return /* @__PURE__ */ jsx(CalendarCell, {
|
|
112
|
+
"aria-colindex": columnStart,
|
|
113
|
+
"aria-labelledby": `${resourceHeaderId} ${getColumnHeaderId(columnIndex)}`,
|
|
114
|
+
"aria-rowindex": resourceIndex + 2,
|
|
115
|
+
className: "bg-background/40 relative border-b-0 last:border-e-0",
|
|
116
|
+
role: "gridcell",
|
|
117
|
+
children: visibleEntries.map(({ entry, placement }) => {
|
|
118
|
+
const labelledBy = [resourceHeaderId, ...Array.from({ length: placement.span }, (_, index) => getColumnHeaderId(columnIndex + index))].join(" ");
|
|
119
|
+
return /* @__PURE__ */ jsx(ResourceCalendarEntryView, {
|
|
120
|
+
entry,
|
|
121
|
+
labelledBy,
|
|
122
|
+
onSelectEntry,
|
|
123
|
+
placement,
|
|
124
|
+
rowCount: layout.rowCount
|
|
125
|
+
}, entry.id);
|
|
126
|
+
})
|
|
127
|
+
}, column.date);
|
|
128
|
+
})]
|
|
129
|
+
}, resource.id);
|
|
130
|
+
})]
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const RESOURCE_CALENDAR_ENTRY_TONES = {
|
|
135
|
+
accent: "bg-primary text-primary-foreground",
|
|
136
|
+
destructive: "border-destructive/32 bg-destructive/12 text-foreground border",
|
|
137
|
+
neutral: "border-border bg-muted text-foreground border",
|
|
138
|
+
warning: "border-warning/30 bg-warning/15 text-foreground border"
|
|
139
|
+
};
|
|
140
|
+
const ResourceCalendarEntryView = ({ entry, labelledBy, onSelectEntry, placement, rowCount }) => {
|
|
141
|
+
const className = cn("h-full w-full px-3 py-2 font-medium shadow-sm", RESOURCE_CALENDAR_ENTRY_TONES[entry.tone ?? "accent"]);
|
|
142
|
+
const style = {
|
|
143
|
+
blockSize: `${String(100 / rowCount)}%`,
|
|
144
|
+
insetBlockStart: `${String((placement.rowStart - 1) * 100 / rowCount)}%`,
|
|
145
|
+
insetInlineStart: 0,
|
|
146
|
+
inlineSize: `calc(${String(placement.span)} * 100%)`
|
|
147
|
+
};
|
|
148
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
149
|
+
className: "block truncate",
|
|
150
|
+
children: entry.label
|
|
151
|
+
}), entry.meta === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
152
|
+
className: "block truncate opacity-75",
|
|
153
|
+
children: entry.meta
|
|
154
|
+
})] });
|
|
155
|
+
return /* @__PURE__ */ jsx("div", {
|
|
156
|
+
className: "absolute z-10 min-w-0 p-2",
|
|
157
|
+
style,
|
|
158
|
+
children: onSelectEntry === void 0 ? /* @__PURE__ */ jsx(CalendarEntrySurface, {
|
|
159
|
+
"aria-describedby": labelledBy,
|
|
160
|
+
"aria-label": entry.accessibleLabel,
|
|
161
|
+
className,
|
|
162
|
+
children: content
|
|
163
|
+
}) : /* @__PURE__ */ jsx(CalendarEntryButton, {
|
|
164
|
+
"aria-describedby": labelledBy,
|
|
165
|
+
"aria-label": entry.accessibleLabel,
|
|
166
|
+
className,
|
|
167
|
+
onClick: () => onSelectEntry(entry),
|
|
168
|
+
children: content
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
const assertUniqueIds = (ids, label) => {
|
|
173
|
+
if (new Set(ids).size !== ids.length) throw new TypeError(`${label} ids must be unique`);
|
|
174
|
+
};
|
|
175
|
+
const assertResourceCalendarContract = ({ columns, entries, resources }) => {
|
|
176
|
+
assertConsecutiveCalendarDates(columns.map(({ date }) => date));
|
|
177
|
+
assertUniqueIds(resources.map(({ id }) => id), "Resource calendar resource");
|
|
178
|
+
assertUniqueIds(entries.map(({ id }) => id), "Resource calendar entry");
|
|
179
|
+
const resourceIds = new Set(resources.map(({ id }) => id));
|
|
180
|
+
const orphan = entries.find(({ resourceId }) => !resourceIds.has(resourceId));
|
|
181
|
+
if (orphan !== void 0) throw new TypeError(`Resource calendar entry ${orphan.id} references an unknown resource`);
|
|
182
|
+
};
|
|
183
|
+
//#endregion
|
|
184
|
+
export { ResourceCalendar };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/calendar/resource-calendar.logic.d.ts
|
|
2
|
+
type CalendarDateRange = {
|
|
3
|
+
endDateExclusive: string;
|
|
4
|
+
startDate: string;
|
|
5
|
+
};
|
|
6
|
+
type ResourceCalendarPlacement = {
|
|
7
|
+
columnStart: number;
|
|
8
|
+
span: number;
|
|
9
|
+
};
|
|
10
|
+
type ResourceCalendarLanePlacement = ResourceCalendarPlacement & {
|
|
11
|
+
entryId: string;
|
|
12
|
+
rowStart: number;
|
|
13
|
+
};
|
|
14
|
+
type ResourceCalendarLaneLayout = {
|
|
15
|
+
placements: ResourceCalendarLanePlacement[];
|
|
16
|
+
rowCount: number;
|
|
17
|
+
};
|
|
18
|
+
declare const getResourceCalendarPlacement: ({ entry, visibleRange }: {
|
|
19
|
+
entry: CalendarDateRange;
|
|
20
|
+
visibleRange: CalendarDateRange;
|
|
21
|
+
}) => ResourceCalendarPlacement | null;
|
|
22
|
+
declare const assertConsecutiveCalendarDates: (dates: readonly string[]) => void;
|
|
23
|
+
declare const nextCalendarDate: (value: string) => string;
|
|
24
|
+
declare const layoutResourceCalendarEntries: (entries: readonly (CalendarDateRange & {
|
|
25
|
+
id: string;
|
|
26
|
+
})[], visibleRange: CalendarDateRange) => ResourceCalendarLaneLayout;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { CalendarDateRange, ResourceCalendarLaneLayout, ResourceCalendarLanePlacement, ResourceCalendarPlacement, assertConsecutiveCalendarDates, getResourceCalendarPlacement, layoutResourceCalendarEntries, nextCalendarDate };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//#region src/calendar/resource-calendar.logic.ts
|
|
2
|
+
const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/u;
|
|
3
|
+
const DAY_IN_MS = 864e5;
|
|
4
|
+
const toUTCDate = (value) => {
|
|
5
|
+
if (!ISO_DATE_PATTERN.test(value)) return null;
|
|
6
|
+
const date = /* @__PURE__ */ new Date(`${value}T00:00:00.000Z`);
|
|
7
|
+
return date.toISOString().slice(0, 10) === value ? date : null;
|
|
8
|
+
};
|
|
9
|
+
const differenceInCalendarDays = (later, earlier) => {
|
|
10
|
+
const laterDate = toUTCDate(later);
|
|
11
|
+
const earlierDate = toUTCDate(earlier);
|
|
12
|
+
if (laterDate === null || earlierDate === null) throw new RangeError("Calendar dates must use normalized YYYY-MM-DD values");
|
|
13
|
+
return (laterDate.getTime() - earlierDate.getTime()) / DAY_IN_MS;
|
|
14
|
+
};
|
|
15
|
+
const getResourceCalendarPlacement = ({ entry, visibleRange }) => {
|
|
16
|
+
const visibleDayCount = differenceInCalendarDays(visibleRange.endDateExclusive, visibleRange.startDate);
|
|
17
|
+
const entryDayCount = differenceInCalendarDays(entry.endDateExclusive, entry.startDate);
|
|
18
|
+
if (visibleDayCount <= 0 || entryDayCount <= 0) throw new RangeError("Calendar date ranges must be non-empty and half-open");
|
|
19
|
+
if (entry.startDate >= visibleRange.endDateExclusive || entry.endDateExclusive <= visibleRange.startDate) return null;
|
|
20
|
+
const clippedStart = entry.startDate < visibleRange.startDate ? visibleRange.startDate : entry.startDate;
|
|
21
|
+
const clippedEnd = entry.endDateExclusive > visibleRange.endDateExclusive ? visibleRange.endDateExclusive : entry.endDateExclusive;
|
|
22
|
+
return {
|
|
23
|
+
columnStart: differenceInCalendarDays(clippedStart, visibleRange.startDate) + 2,
|
|
24
|
+
span: differenceInCalendarDays(clippedEnd, clippedStart)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const assertConsecutiveCalendarDates = (dates) => {
|
|
28
|
+
if (dates.length === 0) throw new RangeError("A resource calendar needs at least one date column");
|
|
29
|
+
const first = dates.at(0);
|
|
30
|
+
if (first === void 0 || toUTCDate(first) === null) throw new RangeError("Resource calendar date columns must be consecutive normalized dates");
|
|
31
|
+
for (let index = 1; index < dates.length; index += 1) {
|
|
32
|
+
const previous = dates.at(index - 1);
|
|
33
|
+
const current = dates.at(index);
|
|
34
|
+
if (previous === void 0 || current === void 0 || differenceInCalendarDays(current, previous) !== 1) throw new RangeError("Resource calendar date columns must be consecutive normalized dates");
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const nextCalendarDate = (value) => {
|
|
38
|
+
const date = toUTCDate(value);
|
|
39
|
+
if (date === null) throw new RangeError("Calendar dates must use normalized YYYY-MM-DD values");
|
|
40
|
+
date.setUTCDate(date.getUTCDate() + 1);
|
|
41
|
+
const nextDate = date.toISOString().slice(0, 10);
|
|
42
|
+
if (toUTCDate(nextDate) === null) throw new RangeError("Calendar dates must have a following normalized YYYY-MM-DD value");
|
|
43
|
+
return nextDate;
|
|
44
|
+
};
|
|
45
|
+
const layoutResourceCalendarEntries = (entries, visibleRange) => {
|
|
46
|
+
const visibleEntries = [];
|
|
47
|
+
const entryIds = /* @__PURE__ */ new Set();
|
|
48
|
+
for (const entry of entries) {
|
|
49
|
+
if (entryIds.has(entry.id)) throw new TypeError("Resource calendar entry ids must be unique");
|
|
50
|
+
entryIds.add(entry.id);
|
|
51
|
+
const placement = getResourceCalendarPlacement({
|
|
52
|
+
entry,
|
|
53
|
+
visibleRange
|
|
54
|
+
});
|
|
55
|
+
if (placement === null) continue;
|
|
56
|
+
visibleEntries.push({
|
|
57
|
+
columnStart: placement.columnStart,
|
|
58
|
+
entryId: entry.id,
|
|
59
|
+
span: placement.span
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
visibleEntries.sort((left, right) => {
|
|
63
|
+
const startDifference = left.columnStart - right.columnStart;
|
|
64
|
+
if (startDifference !== 0) return startDifference;
|
|
65
|
+
if (left.entryId < right.entryId) return -1;
|
|
66
|
+
if (left.entryId > right.entryId) return 1;
|
|
67
|
+
return 0;
|
|
68
|
+
});
|
|
69
|
+
const laneEnds = [];
|
|
70
|
+
const placements = [];
|
|
71
|
+
for (const entry of visibleEntries) {
|
|
72
|
+
const firstAvailableLane = laneEnds.findIndex((laneEnd) => laneEnd <= entry.columnStart);
|
|
73
|
+
const lane = firstAvailableLane === -1 ? laneEnds.length : firstAvailableLane;
|
|
74
|
+
laneEnds[lane] = entry.columnStart + entry.span;
|
|
75
|
+
placements.push({
|
|
76
|
+
columnStart: entry.columnStart,
|
|
77
|
+
entryId: entry.entryId,
|
|
78
|
+
rowStart: lane + 1,
|
|
79
|
+
span: entry.span
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
placements,
|
|
84
|
+
rowCount: Math.max(1, laneEnds.length)
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
export { assertConsecutiveCalendarDates, getResourceCalendarPlacement, layoutResourceCalendarEntries, nextCalendarDate };
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
declare const buttonAccessibleDisabledClass = "cursor-not-allowed opacity-64";
|
|
12
12
|
declare const buttonVariants: (props?: ({
|
|
13
|
-
size?: "
|
|
13
|
+
size?: "icon" | "sm" | "default" | "lg" | "icon-lg" | "icon-sm" | "icon-xl" | "icon-xs" | "xl" | "xs" | null | undefined;
|
|
14
14
|
variant?: "link" | "default" | "destructive" | "destructive-outline" | "ghost" | "outline" | "secondary" | null | undefined;
|
|
15
15
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
16
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow } from "./calendar/primitives.js";
|
|
2
|
+
import { CalendarDateRange, ResourceCalendarLaneLayout, ResourceCalendarLanePlacement, ResourceCalendarPlacement, assertConsecutiveCalendarDates, getResourceCalendarPlacement, layoutResourceCalendarEntries, nextCalendarDate } from "./calendar/resource-calendar.logic.js";
|
|
3
|
+
import { ResourceCalendar, ResourceCalendarColumn, ResourceCalendarEntry, ResourceCalendarEntryTone, ResourceCalendarResource } from "./calendar/resource-calendar.js";
|
|
4
|
+
import "./calendar/index.js";
|
|
1
5
|
import { Accordion, AccordionContent as AccordionPanel, AccordionItem, AccordionTrigger } from "./components/accordion.js";
|
|
2
6
|
import { OVERLAY_LAYER_CLASS_NAMES, OverlayLayer } from "./lib/overlay-layer.js";
|
|
3
7
|
import { AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogContent as AlertDialogPopup, AlertDialogCreateHandle, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogPanel, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertDialogViewport } from "./components/alert-dialog.js";
|
|
@@ -59,9 +63,10 @@ import "./inspector/index.js";
|
|
|
59
63
|
import { KanbanCardFieldSelection, selectKanbanCardFieldIds } from "./kanban/card-properties.js";
|
|
60
64
|
import { KanbanCardShell, KanbanCardShellProps } from "./kanban/card-shell.js";
|
|
61
65
|
import { KanbanColumnHeader, KanbanColumnHeaderProps } from "./kanban/column-header.js";
|
|
66
|
+
import { KANBAN_BOARD_AUTO_SCROLL_SOURCES, RegisterKanbanBoardAutoScrollOptions, RegisterKanbanCardDragOptions, registerKanbanBoardAutoScroll, registerKanbanCardDrag } from "./kanban/drag-interactions.js";
|
|
62
67
|
import { ColorVariants, OptionColor, emptyColor, optionColors, resolveOptionColor } from "./lib/option-color.js";
|
|
63
68
|
import { KanbanBuiltInGroup, KanbanGroup, KanbanGroupOption, KanbanGrouping, KanbanSchema, ResolveKanbanGroupingParams, getKanbanGroupingPropertyId, getKanbanGroups, isKanbanGroupingRenderable, resolveKanbanGroupOptions, resolveKanbanGrouping, selectKanbanRows } from "./kanban/grouping.js";
|
|
64
69
|
import "./kanban/index.js";
|
|
65
70
|
import { cn, composeRefs } from "./lib/utils.js";
|
|
66
71
|
import { getFirstWeekday, getLocaleWeekInfo, getWeekendDays } from "./lib/week.js";
|
|
67
|
-
export { Accordion, AccordionPanel as AccordionContent, AccordionPanel, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogBackdrop, AlertDialogBackdrop as AlertDialogOverlay, AlertDialogClose, AlertDialogPopup as AlertDialogContent, AlertDialogPopup, AlertDialogCreateHandle, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogPanel, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertDialogViewport, AnchoredToastProvider, Avatar, AvatarFallback, AvatarImage, type BidiDirection, BidiText, type BidiTextProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Checkbox, ColorPicker, ColorPickerContent, type ColorPickerContentProps, type ColorPickerProps, type ColorPreset, ColorVariants, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandCollection, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut, DEFAULT_PRESETS, DatePickerPopover, type DatePickerPopoverProps, DestructiveActionConfirmation, DestructiveConfirmDialog, type DestructiveConfirmDialogProps, Dialog, DialogBackdrop, DialogBackdrop as DialogOverlay, DialogClose, DialogPopup as DialogContent, DialogPopup, DialogCreateHandle, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPortal, DialogTitle, DialogTrigger, DialogViewport, DirectionalIcon, DiscordLogoIcon, Menu as DropdownMenu, Menu, MenuCheckboxItem as DropdownMenuCheckboxItem, MenuCheckboxItem, MenuPopup as DropdownMenuContent, MenuPopup, MenuCreateHandle as DropdownMenuCreateHandle, MenuCreateHandle, MenuGroup as DropdownMenuGroup, MenuGroup, MenuItem as DropdownMenuItem, MenuItem, MenuGroupLabel as DropdownMenuLabel, MenuGroupLabel, MenuPortal as DropdownMenuPortal, MenuPortal, MenuRadioGroup as DropdownMenuRadioGroup, MenuRadioGroup, MenuRadioItem as DropdownMenuRadioItem, MenuRadioItem, MenuSeparator as DropdownMenuSeparator, MenuSeparator, MenuShortcut as DropdownMenuShortcut, MenuShortcut, MenuSub as DropdownMenuSub, MenuSub, MenuSubPopup as DropdownMenuSubContent, MenuSubPopup, MenuSubTrigger as DropdownMenuSubTrigger, MenuSubTrigger, MenuTrigger as DropdownMenuTrigger, MenuTrigger, Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel, FieldValidity, Form, Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, GitHubLogoIcon, HexColorPicker, type HexColorPickerProps, PreviewCard as HoverCard, PreviewCard, PreviewCardPopup as HoverCardContent, PreviewCardPopup, PreviewCardTrigger as HoverCardTrigger, PreviewCardTrigger, INSPECTOR_CONTENT_MIN_WIDTH, INSPECTOR_PANE_DEFAULT_WIDTH, INSPECTOR_PANE_KEYBOARD_PAGE_STEP, INSPECTOR_PANE_KEYBOARD_STEP, INSPECTOR_PANE_MAX_WIDTH, INSPECTOR_PANE_MIN_WIDTH, INSPECTOR_RAIL_WIDTH, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Inspector, InspectorActions, InspectorContent, InspectorDescription, InspectorDock, InspectorEmptyRow, InspectorHeader, InspectorHeaderText, InspectorProperty, InspectorPropertyLabel, InspectorPropertyList, InspectorPropertyValue, InspectorRail, InspectorRailCell, InspectorRailIconButton, InspectorRailTab, InspectorSection, InspectorSectionTitle, InspectorTitle, type KanbanBuiltInGroup, type KanbanCardFieldSelection, KanbanCardShell, type KanbanCardShellProps, KanbanColumnHeader, type KanbanColumnHeaderProps, type KanbanGroup, type KanbanGroupOption, type KanbanGrouping, type KanbanSchema, Label, MenuPreviewLayout, OVERLAY_LAYER_CLASS_NAMES, OptionColor, OutlineItem, OutlineRail, OutlineRailProps, OverlayLayer, PROPERTY_ROW_GRID, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverClose, PopoverPopup as PopoverContent, PopoverPopup, PopoverCreateHandle, PopoverDescription, PopoverPanel, PopoverTitle, PopoverTrigger, PreviewCardPrimitive, PreviewPane, type ResolveKanbanGroupingParams, SIDE_RAIL_CONTAINER_CLASS, SIDE_RAIL_ICON_BUTTON_SIZE, SIDE_RAIL_TAB_ICON_SIZE, SIDE_RAIL_WIDTH, ScrollArea, ScrollBar, ScrollToTop, ScrollToTopProps, SecretInput, type SecretInputProps, SegmentedIconToggle, Select, SelectPopup as SelectContent, SelectPopup, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBackdrop, SheetBackdrop as SheetOverlay, SheetClose, SheetPopup as SheetContent, SheetPopup, SheetDescription, SheetFooter, SheetHeader, SheetPanel, SheetPortal, type SheetSide, SheetTitle, SheetTrigger, Skeleton, type SortDirection, SortableHead, StellaMark, StellaWordmarkLatin, TOAST_RIGHT_OFFSET_VAR, TOOLBAR_ROW_HEIGHT, TOOLBAR_ROW_HEIGHT_PX, Table, TableBody, TableCaption, TableCell, type TableColumnCapabilities, type TableColumnDescriptor, TableFooter, TableHead, TableHeader, TableRow, type TableSchema, Tabs, TabsPanel as TabsContent, TabsPanel, TabsList, TabsTab, TabsTab as TabsTrigger, TextSeparator, Textarea, type TextareaProps, type ToastPosition, ToastProvider, Tooltip, TooltipPopup as TooltipContent, TooltipPopup, TooltipCreateHandle, TooltipProvider, TooltipTrigger, UserText, buttonAccessibleDisabledClass, buttonVariants, cn, composeRefs, containedEventHandler, containedHandler, contentDir, duplicateColumnIds, emptyColor, findTableColumn, getFirstWeekday, getKanbanGroupingPropertyId, getKanbanGroups, getLocaleWeekInfo, getWeekendDays, hideableColumnIds, isKanbanGroupingRenderable, isStructuredInputType, optionColors, parsePersistedPaneWidth, resolveDragWidth, resolveInspectorDockWidth, resolveInspectorPaneMaxWidth, resolveInspectorPaneWidth, resolveKanbanGroupOptions, resolveKanbanGrouping, resolveKeyboardWidth, resolveOptionColor, selectKanbanCardFieldIds, selectKanbanRows, shouldForceSidebarCollapsed, sortableColumnIds, stellaToast, tableColumnIds, tableColumnSizing, useComboboxFilter, useContentDir, useDestructiveActionConfirmation, useInspectorPaneWidth, useIsMobile, useViewportWidth, visibleColumnIds };
|
|
72
|
+
export { Accordion, AccordionPanel as AccordionContent, AccordionPanel, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogBackdrop, AlertDialogBackdrop as AlertDialogOverlay, AlertDialogClose, AlertDialogPopup as AlertDialogContent, AlertDialogPopup, AlertDialogCreateHandle, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogPanel, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertDialogViewport, AnchoredToastProvider, Avatar, AvatarFallback, AvatarImage, type BidiDirection, BidiText, type BidiTextProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CalendarCell, type CalendarDateRange, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow, Checkbox, ColorPicker, ColorPickerContent, type ColorPickerContentProps, type ColorPickerProps, type ColorPreset, ColorVariants, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandCollection, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut, DEFAULT_PRESETS, DatePickerPopover, type DatePickerPopoverProps, DestructiveActionConfirmation, DestructiveConfirmDialog, type DestructiveConfirmDialogProps, Dialog, DialogBackdrop, DialogBackdrop as DialogOverlay, DialogClose, DialogPopup as DialogContent, DialogPopup, DialogCreateHandle, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPortal, DialogTitle, DialogTrigger, DialogViewport, DirectionalIcon, DiscordLogoIcon, Menu as DropdownMenu, Menu, MenuCheckboxItem as DropdownMenuCheckboxItem, MenuCheckboxItem, MenuPopup as DropdownMenuContent, MenuPopup, MenuCreateHandle as DropdownMenuCreateHandle, MenuCreateHandle, MenuGroup as DropdownMenuGroup, MenuGroup, MenuItem as DropdownMenuItem, MenuItem, MenuGroupLabel as DropdownMenuLabel, MenuGroupLabel, MenuPortal as DropdownMenuPortal, MenuPortal, MenuRadioGroup as DropdownMenuRadioGroup, MenuRadioGroup, MenuRadioItem as DropdownMenuRadioItem, MenuRadioItem, MenuSeparator as DropdownMenuSeparator, MenuSeparator, MenuShortcut as DropdownMenuShortcut, MenuShortcut, MenuSub as DropdownMenuSub, MenuSub, MenuSubPopup as DropdownMenuSubContent, MenuSubPopup, MenuSubTrigger as DropdownMenuSubTrigger, MenuSubTrigger, MenuTrigger as DropdownMenuTrigger, MenuTrigger, Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel, FieldValidity, Form, Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, GitHubLogoIcon, HexColorPicker, type HexColorPickerProps, PreviewCard as HoverCard, PreviewCard, PreviewCardPopup as HoverCardContent, PreviewCardPopup, PreviewCardTrigger as HoverCardTrigger, PreviewCardTrigger, INSPECTOR_CONTENT_MIN_WIDTH, INSPECTOR_PANE_DEFAULT_WIDTH, INSPECTOR_PANE_KEYBOARD_PAGE_STEP, INSPECTOR_PANE_KEYBOARD_STEP, INSPECTOR_PANE_MAX_WIDTH, INSPECTOR_PANE_MIN_WIDTH, INSPECTOR_RAIL_WIDTH, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Inspector, InspectorActions, InspectorContent, InspectorDescription, InspectorDock, InspectorEmptyRow, InspectorHeader, InspectorHeaderText, InspectorProperty, InspectorPropertyLabel, InspectorPropertyList, InspectorPropertyValue, InspectorRail, InspectorRailCell, InspectorRailIconButton, InspectorRailTab, InspectorSection, InspectorSectionTitle, InspectorTitle, KANBAN_BOARD_AUTO_SCROLL_SOURCES, type KanbanBuiltInGroup, type KanbanCardFieldSelection, KanbanCardShell, type KanbanCardShellProps, KanbanColumnHeader, type KanbanColumnHeaderProps, type KanbanGroup, type KanbanGroupOption, type KanbanGrouping, type KanbanSchema, Label, MenuPreviewLayout, OVERLAY_LAYER_CLASS_NAMES, OptionColor, OutlineItem, OutlineRail, OutlineRailProps, OverlayLayer, PROPERTY_ROW_GRID, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverClose, PopoverPopup as PopoverContent, PopoverPopup, PopoverCreateHandle, PopoverDescription, PopoverPanel, PopoverTitle, PopoverTrigger, PreviewCardPrimitive, PreviewPane, type RegisterKanbanBoardAutoScrollOptions, type RegisterKanbanCardDragOptions, type ResolveKanbanGroupingParams, ResourceCalendar, type ResourceCalendarColumn, type ResourceCalendarEntry, type ResourceCalendarEntryTone, type ResourceCalendarLaneLayout, type ResourceCalendarLanePlacement, type ResourceCalendarPlacement, type ResourceCalendarResource, SIDE_RAIL_CONTAINER_CLASS, SIDE_RAIL_ICON_BUTTON_SIZE, SIDE_RAIL_TAB_ICON_SIZE, SIDE_RAIL_WIDTH, ScrollArea, ScrollBar, ScrollToTop, ScrollToTopProps, SecretInput, type SecretInputProps, SegmentedIconToggle, Select, SelectPopup as SelectContent, SelectPopup, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBackdrop, SheetBackdrop as SheetOverlay, SheetClose, SheetPopup as SheetContent, SheetPopup, SheetDescription, SheetFooter, SheetHeader, SheetPanel, SheetPortal, type SheetSide, SheetTitle, SheetTrigger, Skeleton, type SortDirection, SortableHead, StellaMark, StellaWordmarkLatin, TOAST_RIGHT_OFFSET_VAR, TOOLBAR_ROW_HEIGHT, TOOLBAR_ROW_HEIGHT_PX, Table, TableBody, TableCaption, TableCell, type TableColumnCapabilities, type TableColumnDescriptor, TableFooter, TableHead, TableHeader, TableRow, type TableSchema, Tabs, TabsPanel as TabsContent, TabsPanel, TabsList, TabsTab, TabsTab as TabsTrigger, TextSeparator, Textarea, type TextareaProps, type ToastPosition, ToastProvider, Tooltip, TooltipPopup as TooltipContent, TooltipPopup, TooltipCreateHandle, TooltipProvider, TooltipTrigger, UserText, assertConsecutiveCalendarDates, buttonAccessibleDisabledClass, buttonVariants, cn, composeRefs, containedEventHandler, containedHandler, contentDir, duplicateColumnIds, emptyColor, findTableColumn, getFirstWeekday, getKanbanGroupingPropertyId, getKanbanGroups, getLocaleWeekInfo, getResourceCalendarPlacement, getWeekendDays, hideableColumnIds, isKanbanGroupingRenderable, isStructuredInputType, layoutResourceCalendarEntries, nextCalendarDate, optionColors, parsePersistedPaneWidth, registerKanbanBoardAutoScroll, registerKanbanCardDrag, resolveDragWidth, resolveInspectorDockWidth, resolveInspectorPaneMaxWidth, resolveInspectorPaneWidth, resolveKanbanGroupOptions, resolveKanbanGrouping, resolveKeyboardWidth, resolveOptionColor, selectKanbanCardFieldIds, selectKanbanRows, shouldForceSidebarCollapsed, sortableColumnIds, stellaToast, tableColumnIds, tableColumnSizing, useComboboxFilter, useContentDir, useDestructiveActionConfirmation, useInspectorPaneWidth, useIsMobile, useViewportWidth, visibleColumnIds };
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,9 @@ import { ScrollArea, ScrollBar } from "./components/scroll-area.js";
|
|
|
19
19
|
import { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, useComboboxFilter } from "./components/combobox.js";
|
|
20
20
|
import { Dialog, DialogBackdrop, DialogClose, DialogContent as DialogPopup, DialogCreateHandle, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPortal, DialogTitle, DialogTrigger, DialogViewport } from "./components/dialog.js";
|
|
21
21
|
import { Command, CommandCollection, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut } from "./components/command.js";
|
|
22
|
+
import { CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow } from "./calendar/primitives.js";
|
|
23
|
+
import { assertConsecutiveCalendarDates, getResourceCalendarPlacement, layoutResourceCalendarEntries, nextCalendarDate } from "./calendar/resource-calendar.logic.js";
|
|
24
|
+
import { ResourceCalendar } from "./calendar/resource-calendar.js";
|
|
22
25
|
import { getFirstWeekday, getLocaleWeekInfo, getWeekendDays } from "./lib/week.js";
|
|
23
26
|
import { Popover, PopoverClose, PopoverContent as PopoverPopup, PopoverCreateHandle, PopoverDescription, PopoverPanel, PopoverTitle, PopoverTrigger } from "./components/popover.js";
|
|
24
27
|
import { DatePickerPopover } from "./components/date-picker-popover.js";
|
|
@@ -60,6 +63,7 @@ import { INSPECTOR_PANE_KEYBOARD_PAGE_STEP, INSPECTOR_PANE_KEYBOARD_STEP, parseP
|
|
|
60
63
|
import { selectKanbanCardFieldIds } from "./kanban/card-properties.js";
|
|
61
64
|
import { KanbanCardShell } from "./kanban/card-shell.js";
|
|
62
65
|
import { KanbanColumnHeader } from "./kanban/column-header.js";
|
|
66
|
+
import { KANBAN_BOARD_AUTO_SCROLL_SOURCES, registerKanbanBoardAutoScroll, registerKanbanCardDrag } from "./kanban/drag-interactions.js";
|
|
63
67
|
import { getKanbanGroupingPropertyId, getKanbanGroups, isKanbanGroupingRenderable, resolveKanbanGroupOptions, resolveKanbanGrouping, selectKanbanRows } from "./kanban/grouping.js";
|
|
64
68
|
import { emptyColor, optionColors, resolveOptionColor } from "./lib/option-color.js";
|
|
65
|
-
export { Accordion, AccordionPanel as AccordionContent, AccordionPanel, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogBackdrop, AlertDialogBackdrop as AlertDialogOverlay, AlertDialogClose, AlertDialogPopup as AlertDialogContent, AlertDialogPopup, AlertDialogCreateHandle, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogPanel, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertDialogViewport, AnchoredToastProvider, Avatar, AvatarFallback, AvatarImage, BidiText, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Checkbox, ColorPicker, ColorPickerContent, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandCollection, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut, DEFAULT_PRESETS, DatePickerPopover, DestructiveActionConfirmation, DestructiveConfirmDialog, Dialog, DialogBackdrop, DialogBackdrop as DialogOverlay, DialogClose, DialogPopup as DialogContent, DialogPopup, DialogCreateHandle, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPortal, DialogTitle, DialogTrigger, DialogViewport, DirectionalIcon, DiscordLogoIcon, Menu as DropdownMenu, Menu, MenuCheckboxItem as DropdownMenuCheckboxItem, MenuCheckboxItem, MenuPopup as DropdownMenuContent, MenuPopup, MenuCreateHandle as DropdownMenuCreateHandle, MenuCreateHandle, MenuGroup as DropdownMenuGroup, MenuGroup, MenuItem as DropdownMenuItem, MenuItem, MenuGroupLabel as DropdownMenuLabel, MenuGroupLabel, MenuPortal as DropdownMenuPortal, MenuPortal, MenuRadioGroup as DropdownMenuRadioGroup, MenuRadioGroup, MenuRadioItem as DropdownMenuRadioItem, MenuRadioItem, MenuSeparator as DropdownMenuSeparator, MenuSeparator, MenuShortcut as DropdownMenuShortcut, MenuShortcut, MenuSub as DropdownMenuSub, MenuSub, MenuSubPopup as DropdownMenuSubContent, MenuSubPopup, MenuSubTrigger as DropdownMenuSubTrigger, MenuSubTrigger, MenuTrigger as DropdownMenuTrigger, MenuTrigger, Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel, FieldValidity, Form, Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, GitHubLogoIcon, HexColorPicker, PreviewCard as HoverCard, PreviewCard, PreviewCardPopup as HoverCardContent, PreviewCardPopup, PreviewCardTrigger as HoverCardTrigger, PreviewCardTrigger, INSPECTOR_CONTENT_MIN_WIDTH, INSPECTOR_PANE_DEFAULT_WIDTH, INSPECTOR_PANE_KEYBOARD_PAGE_STEP, INSPECTOR_PANE_KEYBOARD_STEP, INSPECTOR_PANE_MAX_WIDTH, INSPECTOR_PANE_MIN_WIDTH, INSPECTOR_RAIL_WIDTH, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Inspector, InspectorActions, InspectorContent, InspectorDescription, InspectorDock, InspectorEmptyRow, InspectorHeader, InspectorHeaderText, InspectorProperty, InspectorPropertyLabel, InspectorPropertyList, InspectorPropertyValue, InspectorRail, InspectorRailCell, InspectorRailIconButton, InspectorRailTab, InspectorSection, InspectorSectionTitle, InspectorTitle, KanbanCardShell, KanbanColumnHeader, Label, MenuPreviewLayout, OVERLAY_LAYER_CLASS_NAMES, OutlineRail, PROPERTY_ROW_GRID, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverClose, PopoverPopup as PopoverContent, PopoverPopup, PopoverCreateHandle, PopoverDescription, PopoverPanel, PopoverTitle, PopoverTrigger, PreviewCardPrimitive, PreviewPane, SIDE_RAIL_CONTAINER_CLASS, SIDE_RAIL_ICON_BUTTON_SIZE, SIDE_RAIL_TAB_ICON_SIZE, SIDE_RAIL_WIDTH, ScrollArea, ScrollBar, ScrollToTop, SecretInput, SegmentedIconToggle, Select, SelectPopup as SelectContent, SelectPopup, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBackdrop, SheetBackdrop as SheetOverlay, SheetClose, SheetPopup as SheetContent, SheetPopup, SheetDescription, SheetFooter, SheetHeader, SheetPanel, SheetPortal, SheetTitle, SheetTrigger, Skeleton, SortableHead, StellaMark, StellaWordmarkLatin, TOAST_RIGHT_OFFSET_VAR, TOOLBAR_ROW_HEIGHT, TOOLBAR_ROW_HEIGHT_PX, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsPanel as TabsContent, TabsPanel, TabsList, TabsTab, TabsTab as TabsTrigger, TextSeparator, Textarea, ToastProvider, Tooltip, TooltipPopup as TooltipContent, TooltipPopup, TooltipCreateHandle, TooltipProvider, TooltipTrigger, UserText, buttonAccessibleDisabledClass, buttonVariants, cn, composeRefs, containedEventHandler, containedHandler, contentDir, duplicateColumnIds, emptyColor, findTableColumn, getFirstWeekday, getKanbanGroupingPropertyId, getKanbanGroups, getLocaleWeekInfo, getWeekendDays, hideableColumnIds, isKanbanGroupingRenderable, isStructuredInputType, optionColors, parsePersistedPaneWidth, resolveDragWidth, resolveInspectorDockWidth, resolveInspectorPaneMaxWidth, resolveInspectorPaneWidth, resolveKanbanGroupOptions, resolveKanbanGrouping, resolveKeyboardWidth, resolveOptionColor, selectKanbanCardFieldIds, selectKanbanRows, shouldForceSidebarCollapsed, sortableColumnIds, stellaToast, tableColumnIds, tableColumnSizing, useComboboxFilter, useContentDir, useDestructiveActionConfirmation, useInspectorPaneWidth, useIsMobile, useViewportWidth, visibleColumnIds };
|
|
69
|
+
export { Accordion, AccordionPanel as AccordionContent, AccordionPanel, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogBackdrop, AlertDialogBackdrop as AlertDialogOverlay, AlertDialogClose, AlertDialogPopup as AlertDialogContent, AlertDialogPopup, AlertDialogCreateHandle, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogPanel, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertDialogViewport, AnchoredToastProvider, Avatar, AvatarFallback, AvatarImage, BidiText, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CalendarCell, CalendarEntryButton, CalendarEntrySurface, CalendarGrid, CalendarHeaderCell, CalendarHeaderRow, Checkbox, ColorPicker, ColorPickerContent, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandCollection, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut, DEFAULT_PRESETS, DatePickerPopover, DestructiveActionConfirmation, DestructiveConfirmDialog, Dialog, DialogBackdrop, DialogBackdrop as DialogOverlay, DialogClose, DialogPopup as DialogContent, DialogPopup, DialogCreateHandle, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPortal, DialogTitle, DialogTrigger, DialogViewport, DirectionalIcon, DiscordLogoIcon, Menu as DropdownMenu, Menu, MenuCheckboxItem as DropdownMenuCheckboxItem, MenuCheckboxItem, MenuPopup as DropdownMenuContent, MenuPopup, MenuCreateHandle as DropdownMenuCreateHandle, MenuCreateHandle, MenuGroup as DropdownMenuGroup, MenuGroup, MenuItem as DropdownMenuItem, MenuItem, MenuGroupLabel as DropdownMenuLabel, MenuGroupLabel, MenuPortal as DropdownMenuPortal, MenuPortal, MenuRadioGroup as DropdownMenuRadioGroup, MenuRadioGroup, MenuRadioItem as DropdownMenuRadioItem, MenuRadioItem, MenuSeparator as DropdownMenuSeparator, MenuSeparator, MenuShortcut as DropdownMenuShortcut, MenuShortcut, MenuSub as DropdownMenuSub, MenuSub, MenuSubPopup as DropdownMenuSubContent, MenuSubPopup, MenuSubTrigger as DropdownMenuSubTrigger, MenuSubTrigger, MenuTrigger as DropdownMenuTrigger, MenuTrigger, Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel, FieldValidity, Form, Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, GitHubLogoIcon, HexColorPicker, PreviewCard as HoverCard, PreviewCard, PreviewCardPopup as HoverCardContent, PreviewCardPopup, PreviewCardTrigger as HoverCardTrigger, PreviewCardTrigger, INSPECTOR_CONTENT_MIN_WIDTH, INSPECTOR_PANE_DEFAULT_WIDTH, INSPECTOR_PANE_KEYBOARD_PAGE_STEP, INSPECTOR_PANE_KEYBOARD_STEP, INSPECTOR_PANE_MAX_WIDTH, INSPECTOR_PANE_MIN_WIDTH, INSPECTOR_RAIL_WIDTH, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Inspector, InspectorActions, InspectorContent, InspectorDescription, InspectorDock, InspectorEmptyRow, InspectorHeader, InspectorHeaderText, InspectorProperty, InspectorPropertyLabel, InspectorPropertyList, InspectorPropertyValue, InspectorRail, InspectorRailCell, InspectorRailIconButton, InspectorRailTab, InspectorSection, InspectorSectionTitle, InspectorTitle, KANBAN_BOARD_AUTO_SCROLL_SOURCES, KanbanCardShell, KanbanColumnHeader, Label, MenuPreviewLayout, OVERLAY_LAYER_CLASS_NAMES, OutlineRail, PROPERTY_ROW_GRID, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverClose, PopoverPopup as PopoverContent, PopoverPopup, PopoverCreateHandle, PopoverDescription, PopoverPanel, PopoverTitle, PopoverTrigger, PreviewCardPrimitive, PreviewPane, ResourceCalendar, SIDE_RAIL_CONTAINER_CLASS, SIDE_RAIL_ICON_BUTTON_SIZE, SIDE_RAIL_TAB_ICON_SIZE, SIDE_RAIL_WIDTH, ScrollArea, ScrollBar, ScrollToTop, SecretInput, SegmentedIconToggle, Select, SelectPopup as SelectContent, SelectPopup, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBackdrop, SheetBackdrop as SheetOverlay, SheetClose, SheetPopup as SheetContent, SheetPopup, SheetDescription, SheetFooter, SheetHeader, SheetPanel, SheetPortal, SheetTitle, SheetTrigger, Skeleton, SortableHead, StellaMark, StellaWordmarkLatin, TOAST_RIGHT_OFFSET_VAR, TOOLBAR_ROW_HEIGHT, TOOLBAR_ROW_HEIGHT_PX, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsPanel as TabsContent, TabsPanel, TabsList, TabsTab, TabsTab as TabsTrigger, TextSeparator, Textarea, ToastProvider, Tooltip, TooltipPopup as TooltipContent, TooltipPopup, TooltipCreateHandle, TooltipProvider, TooltipTrigger, UserText, assertConsecutiveCalendarDates, buttonAccessibleDisabledClass, buttonVariants, cn, composeRefs, containedEventHandler, containedHandler, contentDir, duplicateColumnIds, emptyColor, findTableColumn, getFirstWeekday, getKanbanGroupingPropertyId, getKanbanGroups, getLocaleWeekInfo, getResourceCalendarPlacement, getWeekendDays, hideableColumnIds, isKanbanGroupingRenderable, isStructuredInputType, layoutResourceCalendarEntries, nextCalendarDate, optionColors, parsePersistedPaneWidth, registerKanbanBoardAutoScroll, registerKanbanCardDrag, resolveDragWidth, resolveInspectorDockWidth, resolveInspectorPaneMaxWidth, resolveInspectorPaneWidth, resolveKanbanGroupOptions, resolveKanbanGrouping, resolveKeyboardWidth, resolveOptionColor, selectKanbanCardFieldIds, selectKanbanRows, shouldForceSidebarCollapsed, sortableColumnIds, stellaToast, tableColumnIds, tableColumnSizing, useComboboxFilter, useContentDir, useDestructiveActionConfirmation, useInspectorPaneWidth, useIsMobile, useViewportWidth, visibleColumnIds };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { draggable } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
2
|
+
//#region src/kanban/drag-interactions.d.ts
|
|
3
|
+
type AtlaskitDraggableOptions = Parameters<typeof draggable>[0];
|
|
4
|
+
type RegisterKanbanCardDragOptions = {
|
|
5
|
+
/** The drag wrapper rendered by `KanbanCardShell`. */
|
|
6
|
+
element: AtlaskitDraggableOptions["element"];
|
|
7
|
+
/** Domain data read by the board's drop monitor. */
|
|
8
|
+
getInitialData: NonNullable<AtlaskitDraggableOptions["getInitialData"]>;
|
|
9
|
+
/** Omit when every rendered card may move. */
|
|
10
|
+
canDrag?: AtlaskitDraggableOptions["canDrag"];
|
|
11
|
+
onDragStart?: AtlaskitDraggableOptions["onDragStart"];
|
|
12
|
+
onDrop?: AtlaskitDraggableOptions["onDrop"];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Register the standard kanban card drag source and native preview.
|
|
16
|
+
*
|
|
17
|
+
* Movement remains with the caller: the package does not inspect the drag data
|
|
18
|
+
* or persist a drop. It owns the interaction every card shares, including a
|
|
19
|
+
* pointer-centred preview cloned from the styled card inside the shell.
|
|
20
|
+
*/
|
|
21
|
+
declare const registerKanbanCardDrag: ({ element, getInitialData, canDrag, onDragStart, onDrop }: RegisterKanbanCardDragOptions) => (() => void);
|
|
22
|
+
declare const KANBAN_BOARD_AUTO_SCROLL_SOURCES: {
|
|
23
|
+
readonly elements: "elements";
|
|
24
|
+
readonly elementsAndExternal: "elements-and-external";
|
|
25
|
+
};
|
|
26
|
+
type KanbanBoardAutoScrollSource = (typeof KANBAN_BOARD_AUTO_SCROLL_SOURCES)[keyof typeof KANBAN_BOARD_AUTO_SCROLL_SOURCES];
|
|
27
|
+
type RegisterKanbanBoardAutoScrollOptions = {
|
|
28
|
+
element: HTMLElement;
|
|
29
|
+
/** External sources include files dragged in from outside the page. */
|
|
30
|
+
sources: KanbanBoardAutoScrollSource;
|
|
31
|
+
};
|
|
32
|
+
/** Register horizontal auto-scroll at the board's overflow boundary. */
|
|
33
|
+
declare const registerKanbanBoardAutoScroll: ({ element, sources }: RegisterKanbanBoardAutoScrollOptions) => (() => void);
|
|
34
|
+
//#endregion
|
|
35
|
+
export { KANBAN_BOARD_AUTO_SCROLL_SOURCES, RegisterKanbanBoardAutoScrollOptions, RegisterKanbanCardDragOptions, registerKanbanBoardAutoScroll, registerKanbanCardDrag };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
2
|
+
import { autoScrollForExternal } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/external";
|
|
3
|
+
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
4
|
+
import { draggable } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
5
|
+
import { centerUnderPointer } from "@atlaskit/pragmatic-drag-and-drop/element/center-under-pointer";
|
|
6
|
+
import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
|
|
7
|
+
//#region src/kanban/drag-interactions.ts
|
|
8
|
+
/**
|
|
9
|
+
* Register the standard kanban card drag source and native preview.
|
|
10
|
+
*
|
|
11
|
+
* Movement remains with the caller: the package does not inspect the drag data
|
|
12
|
+
* or persist a drop. It owns the interaction every card shares, including a
|
|
13
|
+
* pointer-centred preview cloned from the styled card inside the shell.
|
|
14
|
+
*/
|
|
15
|
+
const registerKanbanCardDrag = ({ element, getInitialData, canDrag, onDragStart, onDrop }) => draggable({
|
|
16
|
+
element,
|
|
17
|
+
getInitialData,
|
|
18
|
+
...canDrag === void 0 ? {} : { canDrag },
|
|
19
|
+
...onDragStart === void 0 ? {} : { onDragStart },
|
|
20
|
+
...onDrop === void 0 ? {} : { onDrop },
|
|
21
|
+
onGenerateDragPreview: ({ nativeSetDragImage }) => {
|
|
22
|
+
setCustomNativeDragPreview({
|
|
23
|
+
nativeSetDragImage,
|
|
24
|
+
getOffset: centerUnderPointer,
|
|
25
|
+
render: ({ container }) => {
|
|
26
|
+
const card = element.firstElementChild;
|
|
27
|
+
if (!(card instanceof HTMLElement)) return;
|
|
28
|
+
const clone = card.cloneNode(true);
|
|
29
|
+
if (!(clone instanceof HTMLElement)) return;
|
|
30
|
+
clone.style.width = `${card.getBoundingClientRect().width}px`;
|
|
31
|
+
container.append(clone);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const KANBAN_BOARD_AUTO_SCROLL_SOURCES = {
|
|
37
|
+
elements: "elements",
|
|
38
|
+
elementsAndExternal: "elements-and-external"
|
|
39
|
+
};
|
|
40
|
+
/** Register horizontal auto-scroll at the board's overflow boundary. */
|
|
41
|
+
const registerKanbanBoardAutoScroll = ({ element, sources }) => {
|
|
42
|
+
const elementCleanup = autoScrollForElements({
|
|
43
|
+
element,
|
|
44
|
+
getAllowedAxis: () => "horizontal"
|
|
45
|
+
});
|
|
46
|
+
if (sources === KANBAN_BOARD_AUTO_SCROLL_SOURCES.elements) return elementCleanup;
|
|
47
|
+
return combine(elementCleanup, autoScrollForExternal({
|
|
48
|
+
element,
|
|
49
|
+
getAllowedAxis: () => "horizontal"
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { KANBAN_BOARD_AUTO_SCROLL_SOURCES, registerKanbanBoardAutoScroll, registerKanbanCardDrag };
|
package/dist/kanban/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { KanbanCardFieldSelection, selectKanbanCardFieldIds } from "./card-properties.js";
|
|
2
2
|
import { KanbanCardShell, KanbanCardShellProps } from "./card-shell.js";
|
|
3
3
|
import { KanbanColumnHeader, KanbanColumnHeaderProps } from "./column-header.js";
|
|
4
|
+
import { KANBAN_BOARD_AUTO_SCROLL_SOURCES, RegisterKanbanBoardAutoScrollOptions, RegisterKanbanCardDragOptions, registerKanbanBoardAutoScroll, registerKanbanCardDrag } from "./drag-interactions.js";
|
|
4
5
|
import { KanbanBuiltInGroup, KanbanGroup, KanbanGroupOption, KanbanGrouping, KanbanSchema, ResolveKanbanGroupingParams, getKanbanGroupingPropertyId, getKanbanGroups, isKanbanGroupingRenderable, resolveKanbanGroupOptions, resolveKanbanGrouping, selectKanbanRows } from "./grouping.js";
|
|
5
|
-
export { type KanbanBuiltInGroup, type KanbanCardFieldSelection, KanbanCardShell, type KanbanCardShellProps, KanbanColumnHeader, type KanbanColumnHeaderProps, type KanbanGroup, type KanbanGroupOption, type KanbanGrouping, type KanbanSchema, type ResolveKanbanGroupingParams, getKanbanGroupingPropertyId, getKanbanGroups, isKanbanGroupingRenderable, resolveKanbanGroupOptions, resolveKanbanGrouping, selectKanbanCardFieldIds, selectKanbanRows };
|
|
6
|
+
export { KANBAN_BOARD_AUTO_SCROLL_SOURCES, type KanbanBuiltInGroup, type KanbanCardFieldSelection, KanbanCardShell, type KanbanCardShellProps, KanbanColumnHeader, type KanbanColumnHeaderProps, type KanbanGroup, type KanbanGroupOption, type KanbanGrouping, type KanbanSchema, type RegisterKanbanBoardAutoScrollOptions, type RegisterKanbanCardDragOptions, type ResolveKanbanGroupingParams, getKanbanGroupingPropertyId, getKanbanGroups, isKanbanGroupingRenderable, registerKanbanBoardAutoScroll, registerKanbanCardDrag, resolveKanbanGroupOptions, resolveKanbanGrouping, selectKanbanCardFieldIds, selectKanbanRows };
|
package/dist/kanban/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { selectKanbanCardFieldIds } from "./card-properties.js";
|
|
2
2
|
import { KanbanCardShell } from "./card-shell.js";
|
|
3
3
|
import { KanbanColumnHeader } from "./column-header.js";
|
|
4
|
+
import { KANBAN_BOARD_AUTO_SCROLL_SOURCES, registerKanbanBoardAutoScroll, registerKanbanCardDrag } from "./drag-interactions.js";
|
|
4
5
|
import { getKanbanGroupingPropertyId, getKanbanGroups, isKanbanGroupingRenderable, resolveKanbanGroupOptions, resolveKanbanGrouping, selectKanbanRows } from "./grouping.js";
|
|
5
|
-
export { KanbanCardShell, KanbanColumnHeader, getKanbanGroupingPropertyId, getKanbanGroups, isKanbanGroupingRenderable, resolveKanbanGroupOptions, resolveKanbanGrouping, selectKanbanCardFieldIds, selectKanbanRows };
|
|
6
|
+
export { KANBAN_BOARD_AUTO_SCROLL_SOURCES, KanbanCardShell, KanbanColumnHeader, getKanbanGroupingPropertyId, getKanbanGroups, isKanbanGroupingRenderable, registerKanbanBoardAutoScroll, registerKanbanCardDrag, resolveKanbanGroupOptions, resolveKanbanGrouping, selectKanbanCardFieldIds, selectKanbanRows };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Stella's design system: bidi-aware React primitives built on Base UI, the dockable inspector pane, and the Tailwind v4 theme they are styled with.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"base-ui",
|
|
@@ -81,6 +81,10 @@
|
|
|
81
81
|
"types": "./dist/components/command.d.ts",
|
|
82
82
|
"import": "./dist/components/command.js"
|
|
83
83
|
},
|
|
84
|
+
"./calendar": {
|
|
85
|
+
"types": "./dist/calendar/index.d.ts",
|
|
86
|
+
"import": "./dist/calendar/index.js"
|
|
87
|
+
},
|
|
84
88
|
"./data-table": {
|
|
85
89
|
"types": "./dist/data-table/index.d.ts",
|
|
86
90
|
"import": "./dist/data-table/index.js"
|
|
@@ -497,6 +501,8 @@
|
|
|
497
501
|
"tailwind-merge": "^3.6.0"
|
|
498
502
|
},
|
|
499
503
|
"devDependencies": {
|
|
504
|
+
"@atlaskit/pragmatic-drag-and-drop": "^3.0.0",
|
|
505
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.1",
|
|
500
506
|
"@base-ui/react": "1.7.0",
|
|
501
507
|
"@stll/typescript-config": "0.0.0",
|
|
502
508
|
"@types/bun": "1.3.14",
|
|
@@ -508,6 +514,8 @@
|
|
|
508
514
|
"tsdown": "0.22.14"
|
|
509
515
|
},
|
|
510
516
|
"peerDependencies": {
|
|
517
|
+
"@atlaskit/pragmatic-drag-and-drop": "^3.0.0",
|
|
518
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.1",
|
|
511
519
|
"@base-ui/react": "^1.7.0",
|
|
512
520
|
"react": ">=19",
|
|
513
521
|
"react-dom": ">=19",
|