@alexgorbatchev/shadcn 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -14
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/dist/{chunk-s46hvhjw.js → chunk-0w6rxpr5.js} +1 -1
- package/dist/{chunk-gabqzfq0.js → chunk-1p7pend8.js} +3 -3
- package/dist/chunk-21wbz345.js +65 -0
- package/dist/{chunk-84ca0dpc.js → chunk-67dkgsm3.js} +1 -1
- package/dist/{chunk-p8qtk151.js → chunk-72qr0gqe.js} +1 -1
- package/dist/{chunk-4drqqqz1.js → chunk-83cckb23.js} +1 -1
- package/dist/{chunk-ztcbee24.js → chunk-9dqspkha.js} +1 -1
- package/dist/{chunk-eq88qk1d.js → chunk-d3ad53et.js} +8 -8
- package/dist/{chunk-h979cxnh.js → chunk-dq7kr5y0.js} +2 -1
- package/dist/{chunk-mrrbycgx.js → chunk-e0gcczqk.js} +1 -1
- package/dist/{chunk-553bzh59.js → chunk-f4c0tg2x.js} +1 -1
- package/dist/{chunk-14qj6w54.js → chunk-f9ha76ap.js} +4 -4
- package/dist/{chunk-ykt5sv7n.js → chunk-gkkbg7rq.js} +1 -1
- package/dist/{chunk-qv19jhdk.js → chunk-k8v9y2dw.js} +1 -1
- package/dist/chunk-kbg2e95b.js +434 -0
- package/dist/chunk-r9qrb6b6.js +54 -0
- package/dist/{chunk-ecmk3vgd.js → chunk-seeed8a2.js} +1 -1
- package/dist/{chunk-d9jbqd99.js → chunk-tynbgc30.js} +1 -1
- package/dist/{chunk-1qhf8gh8.js → chunk-wwyzwptb.js} +1 -1
- package/dist/components/AccountMenu.d.ts +12 -0
- package/dist/components/AppShell.d.ts +23 -0
- package/dist/components/AuthForm.d.ts +18 -0
- package/dist/components/BarList.d.ts +16 -0
- package/dist/components/BillingUsage.d.ts +20 -0
- package/dist/components/Combobox.d.ts +2 -1
- package/dist/components/DashboardLayout.d.ts +18 -0
- package/dist/components/FilterBar.d.ts +20 -0
- package/dist/components/Kanban.d.ts +23 -0
- package/dist/components/Meter.d.ts +9 -0
- package/dist/components/NumberField.d.ts +11 -0
- package/dist/components/PageHeader.d.ts +11 -0
- package/dist/components/SettingsSection.d.ts +16 -0
- package/dist/components/Sidebar.d.ts +2 -1
- package/dist/components/StatCard.d.ts +14 -0
- package/dist/components/StatusTracker.d.ts +16 -0
- package/dist/components/Stepper.d.ts +12 -0
- package/dist/components/TagInput.d.ts +16 -0
- package/dist/components/Toolbar.d.ts +10 -0
- package/dist/components/WorkspaceSwitcher.d.ts +14 -0
- package/dist/components/assistant-ui/elements/ApprovalCard.d.ts +1 -1
- package/dist/components/assistant-ui/elements/CommandPalette.js +3 -3
- package/dist/components/assistant-ui/elements/MessageTiming.d.ts +1 -1
- package/dist/components/assistant-ui/elements/ModelSelector.js +9 -9
- package/dist/components/assistant-ui/elements/ModelSelectorContent.js +8 -8
- package/dist/components/assistant-ui/elements/ModelSelectorEmpty.js +3 -3
- package/dist/components/assistant-ui/elements/ModelSelectorFocusAnchor.js +3 -3
- package/dist/components/assistant-ui/elements/ModelSelectorGroup.js +3 -3
- package/dist/components/assistant-ui/elements/ModelSelectorItem.js +3 -3
- package/dist/components/assistant-ui/elements/ModelSelectorList.js +5 -5
- package/dist/components/assistant-ui/elements/ModelSelectorSearch.js +3 -3
- package/dist/components/assistant-ui/elements/ModelSelectorSeparator.js +3 -3
- package/dist/components/assistant-ui/elements/types.d.ts +0 -4
- package/dist/components/assistant-ui/index.js +11 -11
- package/dist/components/assistant-ui/native/AssistantModal.js +3 -3
- package/dist/components/assistant-ui/native/AssistantSidebar.js +3 -3
- package/dist/components/assistant-ui/native/ModelSelector.js +11 -11
- package/dist/components/assistant-ui/native/TaskCard.js +2 -2
- package/dist/components/assistant-ui/native/TaskGroup.js +3 -3
- package/dist/components/assistant-ui/native/Thread.js +2 -2
- package/dist/components/assistant-ui/native/ThreadListSidebar.js +2 -2
- package/dist/components/assistant-ui/native/index.js +17 -17
- package/dist/components/calendar/DatePicker.d.ts +27 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +175 -2
- package/dist/components/chart/AnalyticsChart.d.ts +24 -0
- package/dist/components/chart/index.d.ts +2 -0
- package/dist/components/chart/index.js +88 -0
- package/dist/components/color-picker/ColorPicker.d.ts +14 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +52 -0
- package/dist/components/command/index.js +1 -1
- package/dist/components/data-grid/DataGrid.d.ts +44 -0
- package/dist/components/data-grid/index.d.ts +2 -0
- package/dist/components/data-grid/index.js +228 -0
- package/dist/components/editor/RichTextEditor.d.ts +14 -0
- package/dist/components/editor/index.d.ts +2 -0
- package/dist/components/editor/index.js +108 -0
- package/dist/components/event-calendar/EventCalendar.d.ts +16 -0
- package/dist/components/event-calendar/EventForm.d.ts +18 -0
- package/dist/components/event-calendar/index.d.ts +4 -0
- package/dist/components/event-calendar/index.js +266 -0
- package/dist/components/file-upload/FileUpload.d.ts +14 -0
- package/dist/components/file-upload/index.d.ts +2 -0
- package/dist/components/file-upload/index.js +80 -0
- package/dist/components/gantt/Gantt.d.ts +22 -0
- package/dist/components/gantt/Roadmap.d.ts +18 -0
- package/dist/components/gantt/index.d.ts +4 -0
- package/dist/components/gantt/index.js +357 -0
- package/dist/components/image-crop/ImageCrop.d.ts +10 -0
- package/dist/components/image-crop/index.d.ts +2 -0
- package/dist/components/image-crop/index.js +35 -0
- package/dist/components/tree/Tree.d.ts +15 -0
- package/dist/components/tree/TreeItem.d.ts +22 -0
- package/dist/components/tree/index.d.ts +7 -0
- package/dist/components/tree/index.js +190 -0
- package/dist/event-calendar.css +83 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +1422 -711
- package/dist/options/types.d.ts +5 -0
- package/llms/components/actions/Toolbar.md +89 -0
- package/llms/components/data-display/AnalyticsChart.md +48 -0
- package/llms/components/data-display/BarList.md +50 -0
- package/llms/components/data-display/DataGrid.md +51 -0
- package/llms/components/data-display/Meter.md +74 -0
- package/llms/components/data-display/Sparkline.md +50 -0
- package/llms/components/data-display/StatCard.md +65 -0
- package/llms/components/data-display/StatusTracker.md +51 -0
- package/llms/components/dates/DatePicker.md +97 -0
- package/llms/components/forms/AuthForm.md +70 -0
- package/llms/components/forms/ColorPicker.md +70 -0
- package/llms/components/forms/EventForm.md +66 -0
- package/llms/components/forms/FileUpload.md +55 -0
- package/llms/components/forms/FilterBar.md +34 -0
- package/llms/components/forms/ImageCrop.md +88 -0
- package/llms/components/forms/NumberField.md +94 -0
- package/llms/components/forms/Questionnaire.md +12 -0
- package/llms/components/forms/RichTextEditor.md +62 -0
- package/llms/components/forms/SettingsSection.md +65 -0
- package/llms/components/forms/Stepper.md +85 -0
- package/llms/components/forms/TagInput.md +47 -0
- package/llms/components/layout/AppShell.md +63 -0
- package/llms/components/layout/BillingUsage.md +51 -0
- package/llms/components/layout/DashboardLayout.md +78 -0
- package/llms/components/layout/PageHeader.md +49 -0
- package/llms/components/navigation/AccountMenu.md +42 -0
- package/llms/components/navigation/Tree.md +51 -0
- package/llms/components/navigation/WorkspaceSwitcher.md +48 -0
- package/llms/components/planning/EventCalendar.md +67 -0
- package/llms/components/planning/Gantt.md +66 -0
- package/llms/components/planning/Kanban.md +50 -0
- package/llms/components/planning/Roadmap.md +34 -0
- package/llms/setup.md +24 -14
- package/llms.txt +34 -0
- package/package.json +105 -3
- /package/dist/{chunk-8fcjx3he.js → chunk-az81pc04.js} +0 -0
- /package/dist/{chunk-7pyt4e5t.js → chunk-ghmkxqn5.js} +0 -0
- /package/dist/{chunk-5pvyxayg.js → chunk-m9zsppp2.js} +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "../../chunk-cp2m7y7v.js";
|
|
4
|
+
import {
|
|
5
|
+
Button2
|
|
6
|
+
} from "../../chunk-73rkr9ct.js";
|
|
7
|
+
|
|
8
|
+
// src/components/file-upload/FileUpload.tsx
|
|
9
|
+
import { useId } from "react";
|
|
10
|
+
import { useDropzone } from "react-dropzone";
|
|
11
|
+
import { UploadIcon } from "lucide-react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
function FileUpload({ label, description, children, name, density, ...options }) {
|
|
14
|
+
const descriptionId = useId();
|
|
15
|
+
const { getRootProps, getInputProps, open, isDragActive, isDragReject, isProcessing, fileRejections } = useDropzone({
|
|
16
|
+
...options,
|
|
17
|
+
noClick: true,
|
|
18
|
+
noKeyboard: true
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
"data-density": density,
|
|
22
|
+
className: "grid gap-3",
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("div", {
|
|
25
|
+
...getRootProps({
|
|
26
|
+
role: "group",
|
|
27
|
+
"aria-label": label,
|
|
28
|
+
"aria-describedby": description ? descriptionId : undefined,
|
|
29
|
+
"aria-busy": isProcessing,
|
|
30
|
+
"data-scroll": "none",
|
|
31
|
+
className: cn2("grid justify-items-center gap-3 rounded-sm border border-dashed border-input bg-card p-6 text-center", isDragActive && "border-primary bg-accent", isDragReject && "border-destructive", options.disabled && "opacity-50")
|
|
32
|
+
}),
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx("input", {
|
|
35
|
+
...getInputProps({ name, "aria-label": label })
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ jsx(UploadIcon, {
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
className: "size-6 text-muted-foreground"
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("p", {
|
|
42
|
+
className: "text-sm font-medium",
|
|
43
|
+
children: label
|
|
44
|
+
}),
|
|
45
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
46
|
+
id: descriptionId,
|
|
47
|
+
className: "text-sm text-muted-foreground",
|
|
48
|
+
children: description
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ jsx(Button2, {
|
|
51
|
+
type: "button",
|
|
52
|
+
variant: "outline",
|
|
53
|
+
onClick: open,
|
|
54
|
+
disabled: options.disabled || isProcessing,
|
|
55
|
+
children: "Choose files"
|
|
56
|
+
}),
|
|
57
|
+
isDragActive && /* @__PURE__ */ jsx("p", {
|
|
58
|
+
role: "status",
|
|
59
|
+
children: isDragReject ? "Some files cannot be accepted." : "Drop files here."
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}),
|
|
63
|
+
fileRejections.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
64
|
+
role: "alert",
|
|
65
|
+
className: "space-y-1 text-sm text-destructive",
|
|
66
|
+
children: fileRejections.map(({ file, errors }, index) => /* @__PURE__ */ jsxs("li", {
|
|
67
|
+
children: [
|
|
68
|
+
file.name,
|
|
69
|
+
": ",
|
|
70
|
+
errors.map((error) => error.message).join(" ")
|
|
71
|
+
]
|
|
72
|
+
}, `${file.name}-${index}`))
|
|
73
|
+
}),
|
|
74
|
+
children
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
FileUpload
|
|
80
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
3
|
+
type GanttTask = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
start: Date;
|
|
7
|
+
end: Date;
|
|
8
|
+
progress?: number;
|
|
9
|
+
};
|
|
10
|
+
type GanttProps<T extends GanttTask> = IDensityProps & {
|
|
11
|
+
label: string;
|
|
12
|
+
tasks: readonly T[];
|
|
13
|
+
startDate: Date;
|
|
14
|
+
days?: number;
|
|
15
|
+
timeZone?: string;
|
|
16
|
+
onTaskSelect: (task: T) => void;
|
|
17
|
+
onTaskChange?: (task: T) => void;
|
|
18
|
+
};
|
|
19
|
+
/** Civil-day timeline. End dates are inclusive; shifting preserves wall-clock times across DST. */
|
|
20
|
+
declare function Gantt<T extends GanttTask>({ label, tasks, startDate, days, timeZone, onTaskSelect, onTaskChange, density, }: GanttProps<T>): ReactElement;
|
|
21
|
+
export { Gantt };
|
|
22
|
+
export type { GanttProps, GanttTask };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
3
|
+
import { type KanbanItem, type KanbanColumn } from "../Kanban.js";
|
|
4
|
+
import { type GanttTask } from "./Gantt.js";
|
|
5
|
+
type RoadmapItem = GanttTask & KanbanItem;
|
|
6
|
+
type RoadmapProps<T extends RoadmapItem> = IDensityProps & {
|
|
7
|
+
label: string;
|
|
8
|
+
items: readonly T[];
|
|
9
|
+
columns: readonly KanbanColumn[];
|
|
10
|
+
startDate: Date;
|
|
11
|
+
days?: number;
|
|
12
|
+
timeZone?: string;
|
|
13
|
+
onItemsChange: (items: T[]) => void;
|
|
14
|
+
onItemSelect: (item: T) => void;
|
|
15
|
+
};
|
|
16
|
+
declare function Roadmap<T extends RoadmapItem>({ label, items, columns, startDate, days, timeZone, onItemsChange, onItemSelect, density, }: RoadmapProps<T>): ReactElement;
|
|
17
|
+
export { Roadmap };
|
|
18
|
+
export type { RoadmapProps, RoadmapItem };
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Tabs2,
|
|
3
|
+
TabsList2,
|
|
4
|
+
TabsTrigger2,
|
|
5
|
+
TabsContent2,
|
|
6
|
+
DragDropProvider2,
|
|
7
|
+
DragSource2,
|
|
8
|
+
DropTarget2,
|
|
9
|
+
Kanban2
|
|
10
|
+
} from "../../chunk-kbg2e95b.js";
|
|
11
|
+
import"../../chunk-cp2m7y7v.js";
|
|
12
|
+
import"../../chunk-wjx6zf94.js";
|
|
13
|
+
import {
|
|
14
|
+
Button2
|
|
15
|
+
} from "../../chunk-73rkr9ct.js";
|
|
16
|
+
import {
|
|
17
|
+
NativeSelect2,
|
|
18
|
+
NativeSelectOption2
|
|
19
|
+
} from "../../chunk-r9qrb6b6.js";
|
|
20
|
+
import {
|
|
21
|
+
Table2,
|
|
22
|
+
TableHeader2,
|
|
23
|
+
TableBody2,
|
|
24
|
+
TableRow2,
|
|
25
|
+
TableHead2,
|
|
26
|
+
TableCell2
|
|
27
|
+
} from "../../chunk-0y0kqaqj.js";
|
|
28
|
+
|
|
29
|
+
// src/components/gantt/Gantt.tsx
|
|
30
|
+
import { useId, useState } from "react";
|
|
31
|
+
import { TZDate } from "@date-fns/tz";
|
|
32
|
+
import { addDays, differenceInCalendarDays, format, startOfDay } from "date-fns";
|
|
33
|
+
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
|
|
34
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
+
function Gantt({
|
|
36
|
+
label,
|
|
37
|
+
tasks,
|
|
38
|
+
startDate,
|
|
39
|
+
days = 30,
|
|
40
|
+
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
41
|
+
onTaskSelect,
|
|
42
|
+
onTaskChange,
|
|
43
|
+
density
|
|
44
|
+
}) {
|
|
45
|
+
const id = useId();
|
|
46
|
+
const type = `application/x-gantt-${id.replaceAll(":", "").toLowerCase()}`;
|
|
47
|
+
const [zoom, setZoom] = useState("day");
|
|
48
|
+
const width = zoom === "day" ? 48 : zoom === "week" ? 24 : 12;
|
|
49
|
+
const start = startOfDay(new TZDate(startDate, timeZone));
|
|
50
|
+
const dates = Array.from({ length: days }, (_, index) => addDays(start, index));
|
|
51
|
+
const shift = (task, delta) => {
|
|
52
|
+
onTaskChange?.({
|
|
53
|
+
...task,
|
|
54
|
+
start: new Date(addDays(new TZDate(task.start, timeZone), delta).getTime()),
|
|
55
|
+
end: new Date(addDays(new TZDate(task.end, timeZone), delta).getTime())
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ jsx(DragDropProvider2, {
|
|
59
|
+
children: /* @__PURE__ */ jsxs("section", {
|
|
60
|
+
"aria-label": label,
|
|
61
|
+
"data-density": density,
|
|
62
|
+
"data-scroll": "none",
|
|
63
|
+
className: "grid min-w-0 gap-3",
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: "flex items-center justify-between gap-3",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx("h2", {
|
|
69
|
+
className: "font-semibold",
|
|
70
|
+
children: label
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsxs(NativeSelect2, {
|
|
73
|
+
"aria-label": "Timeline zoom",
|
|
74
|
+
value: zoom,
|
|
75
|
+
onChange: (event) => setZoom(event.target.value),
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx(NativeSelectOption2, {
|
|
78
|
+
value: "day",
|
|
79
|
+
children: "Day scale"
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ jsx(NativeSelectOption2, {
|
|
82
|
+
value: "week",
|
|
83
|
+
children: "Week scale"
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsx(NativeSelectOption2, {
|
|
86
|
+
value: "month",
|
|
87
|
+
children: "Month scale"
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx("div", {
|
|
94
|
+
role: "region",
|
|
95
|
+
"aria-label": `${label} timeline`,
|
|
96
|
+
tabIndex: 0,
|
|
97
|
+
className: "max-h-[65vh] overflow-auto rounded-sm border border-border",
|
|
98
|
+
children: /* @__PURE__ */ jsxs(Table2, {
|
|
99
|
+
"aria-label": label,
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx(TableHeader2, {
|
|
102
|
+
children: /* @__PURE__ */ jsxs(TableRow2, {
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx(TableHead2, {
|
|
105
|
+
scope: "col",
|
|
106
|
+
className: "sticky start-0 z-20 min-w-56 bg-card",
|
|
107
|
+
children: "Task"
|
|
108
|
+
}),
|
|
109
|
+
dates.map((date) => /* @__PURE__ */ jsx(TableHead2, {
|
|
110
|
+
scope: "col",
|
|
111
|
+
className: "px-0 text-center text-xs",
|
|
112
|
+
style: { minWidth: width, width },
|
|
113
|
+
children: /* @__PURE__ */ jsx("abbr", {
|
|
114
|
+
title: format(date, "PPP"),
|
|
115
|
+
children: format(date, zoom === "day" ? "EEE d" : "d")
|
|
116
|
+
})
|
|
117
|
+
}, date.toISOString()))
|
|
118
|
+
]
|
|
119
|
+
})
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ jsxs(TableBody2, {
|
|
122
|
+
children: [
|
|
123
|
+
tasks.map((task) => {
|
|
124
|
+
const offset = differenceInCalendarDays(new TZDate(task.start, timeZone), start);
|
|
125
|
+
const duration = differenceInCalendarDays(new TZDate(task.end, timeZone), new TZDate(task.start, timeZone)) + 1;
|
|
126
|
+
const left = Math.max(0, offset);
|
|
127
|
+
const right = Math.min(days, offset + duration);
|
|
128
|
+
return /* @__PURE__ */ jsxs(TableRow2, {
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsx(TableHead2, {
|
|
131
|
+
scope: "row",
|
|
132
|
+
className: "sticky start-0 z-10 bg-card",
|
|
133
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
134
|
+
className: "flex items-center gap-1",
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ jsx(Button2, {
|
|
137
|
+
type: "button",
|
|
138
|
+
variant: "link",
|
|
139
|
+
className: "min-w-0 flex-1 justify-start px-0",
|
|
140
|
+
onClick: () => onTaskSelect(task),
|
|
141
|
+
children: task.title
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ jsx(Button2, {
|
|
144
|
+
type: "button",
|
|
145
|
+
variant: "ghost",
|
|
146
|
+
size: "icon-xs",
|
|
147
|
+
"aria-label": `Move ${task.title} one day earlier`,
|
|
148
|
+
disabled: !onTaskChange,
|
|
149
|
+
onClick: () => shift(task, -1),
|
|
150
|
+
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ jsx(Button2, {
|
|
153
|
+
type: "button",
|
|
154
|
+
variant: "ghost",
|
|
155
|
+
size: "icon-xs",
|
|
156
|
+
"aria-label": `Move ${task.title} one day later`,
|
|
157
|
+
disabled: !onTaskChange,
|
|
158
|
+
onClick: () => shift(task, 1),
|
|
159
|
+
children: /* @__PURE__ */ jsx(ArrowRightIcon, {})
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ jsx(TableCell2, {
|
|
165
|
+
colSpan: days,
|
|
166
|
+
className: "p-0",
|
|
167
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
168
|
+
className: "relative h-14",
|
|
169
|
+
style: { width: days * width },
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ jsx("div", {
|
|
172
|
+
className: "absolute inset-0 grid",
|
|
173
|
+
style: { gridTemplateColumns: `repeat(${days},${width}px)` },
|
|
174
|
+
children: dates.map((date) => /* @__PURE__ */ jsx(DropTarget2, {
|
|
175
|
+
"data-date": format(date, "yyyy-MM-dd"),
|
|
176
|
+
accept: [type],
|
|
177
|
+
canDrop: (item) => Boolean(onTaskChange) && typeof item.data === "string" && tasks.some((candidate) => candidate.id === item.data),
|
|
178
|
+
onDrop: (item) => {
|
|
179
|
+
const source = tasks.find((candidate) => candidate.id === item.data);
|
|
180
|
+
if (source)
|
|
181
|
+
shift(source, differenceInCalendarDays(date, new TZDate(source.start, timeZone)));
|
|
182
|
+
},
|
|
183
|
+
className: "border-s border-border data-over:bg-accent"
|
|
184
|
+
}, date.toISOString()))
|
|
185
|
+
}),
|
|
186
|
+
right > left && /* @__PURE__ */ jsxs(DragSource2, {
|
|
187
|
+
type,
|
|
188
|
+
data: task.id,
|
|
189
|
+
labels: [task.title],
|
|
190
|
+
disabled: !onTaskChange,
|
|
191
|
+
render: /* @__PURE__ */ jsx(Button2, {
|
|
192
|
+
type: "button",
|
|
193
|
+
variant: "secondary",
|
|
194
|
+
onClick: () => onTaskSelect(task)
|
|
195
|
+
}),
|
|
196
|
+
"aria-label": `${task.title}: ${format(new TZDate(task.start, timeZone), "PPP")} to ${format(new TZDate(task.end, timeZone), "PPP")}${task.progress === undefined ? "" : `, ${task.progress}% complete`}`,
|
|
197
|
+
className: "absolute top-2 overflow-hidden border border-border px-2 text-xs data-dragging:opacity-50",
|
|
198
|
+
style: { insetInlineStart: left * width + 2, width: (right - left) * width - 4 },
|
|
199
|
+
children: [
|
|
200
|
+
task.progress !== undefined && /* @__PURE__ */ jsx("span", {
|
|
201
|
+
"aria-hidden": "true",
|
|
202
|
+
className: "absolute inset-y-0 start-0 bg-primary/15",
|
|
203
|
+
style: { width: `${Math.max(0, Math.min(100, task.progress))}%` }
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ jsx("span", {
|
|
206
|
+
className: "relative truncate",
|
|
207
|
+
children: task.title
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
})
|
|
211
|
+
]
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
}, task.id);
|
|
216
|
+
}),
|
|
217
|
+
!tasks.length && /* @__PURE__ */ jsx(TableRow2, {
|
|
218
|
+
children: /* @__PURE__ */ jsx(TableCell2, {
|
|
219
|
+
colSpan: days + 1,
|
|
220
|
+
children: "No tasks scheduled."
|
|
221
|
+
})
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
})
|
|
225
|
+
]
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
})
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
// src/components/gantt/Roadmap.tsx
|
|
233
|
+
import { useState as useState2 } from "react";
|
|
234
|
+
import { format as format2 } from "date-fns";
|
|
235
|
+
import { TZDate as TZDate2 } from "@date-fns/tz";
|
|
236
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
237
|
+
function Roadmap({
|
|
238
|
+
label,
|
|
239
|
+
items,
|
|
240
|
+
columns,
|
|
241
|
+
startDate,
|
|
242
|
+
days,
|
|
243
|
+
timeZone,
|
|
244
|
+
onItemsChange,
|
|
245
|
+
onItemSelect,
|
|
246
|
+
density
|
|
247
|
+
}) {
|
|
248
|
+
const [view, setView] = useState2("board");
|
|
249
|
+
return /* @__PURE__ */ jsxs2(Tabs2, {
|
|
250
|
+
value: view,
|
|
251
|
+
onValueChange: (value) => {
|
|
252
|
+
if (typeof value === "string")
|
|
253
|
+
setView(value);
|
|
254
|
+
},
|
|
255
|
+
density,
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ jsxs2(TabsList2, {
|
|
258
|
+
"aria-label": `${label} view`,
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ jsx2(TabsTrigger2, {
|
|
261
|
+
value: "board",
|
|
262
|
+
children: "Board"
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ jsx2(TabsTrigger2, {
|
|
265
|
+
value: "timeline",
|
|
266
|
+
children: "Timeline"
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ jsx2(TabsTrigger2, {
|
|
269
|
+
value: "list",
|
|
270
|
+
children: "List"
|
|
271
|
+
})
|
|
272
|
+
]
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ jsx2(TabsContent2, {
|
|
275
|
+
value: "board",
|
|
276
|
+
children: /* @__PURE__ */ jsx2(Kanban2, {
|
|
277
|
+
label,
|
|
278
|
+
items,
|
|
279
|
+
columns,
|
|
280
|
+
onItemsChange,
|
|
281
|
+
renderItem: (item) => /* @__PURE__ */ jsx2(Button2, {
|
|
282
|
+
type: "button",
|
|
283
|
+
variant: "link",
|
|
284
|
+
className: "h-auto px-0",
|
|
285
|
+
onClick: () => onItemSelect(item),
|
|
286
|
+
children: item.title
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ jsx2(TabsContent2, {
|
|
291
|
+
value: "timeline",
|
|
292
|
+
children: /* @__PURE__ */ jsx2(Gantt, {
|
|
293
|
+
label,
|
|
294
|
+
tasks: items,
|
|
295
|
+
startDate,
|
|
296
|
+
days,
|
|
297
|
+
timeZone,
|
|
298
|
+
onTaskSelect: onItemSelect,
|
|
299
|
+
onTaskChange: (task) => onItemsChange(items.map((item) => item.id === task.id ? task : item))
|
|
300
|
+
})
|
|
301
|
+
}),
|
|
302
|
+
/* @__PURE__ */ jsx2(TabsContent2, {
|
|
303
|
+
value: "list",
|
|
304
|
+
children: /* @__PURE__ */ jsxs2(Table2, {
|
|
305
|
+
"aria-label": label,
|
|
306
|
+
children: [
|
|
307
|
+
/* @__PURE__ */ jsx2(TableHeader2, {
|
|
308
|
+
children: /* @__PURE__ */ jsxs2(TableRow2, {
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsx2(TableHead2, {
|
|
311
|
+
children: "Task"
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ jsx2(TableHead2, {
|
|
314
|
+
children: "Status"
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ jsx2(TableHead2, {
|
|
317
|
+
children: "Start"
|
|
318
|
+
}),
|
|
319
|
+
/* @__PURE__ */ jsx2(TableHead2, {
|
|
320
|
+
children: "End"
|
|
321
|
+
})
|
|
322
|
+
]
|
|
323
|
+
})
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ jsx2(TableBody2, {
|
|
326
|
+
children: items.map((item) => /* @__PURE__ */ jsxs2(TableRow2, {
|
|
327
|
+
children: [
|
|
328
|
+
/* @__PURE__ */ jsx2(TableCell2, {
|
|
329
|
+
children: /* @__PURE__ */ jsx2(Button2, {
|
|
330
|
+
type: "button",
|
|
331
|
+
variant: "link",
|
|
332
|
+
onClick: () => onItemSelect(item),
|
|
333
|
+
children: item.title
|
|
334
|
+
})
|
|
335
|
+
}),
|
|
336
|
+
/* @__PURE__ */ jsx2(TableCell2, {
|
|
337
|
+
children: columns.find((column) => column.id === item.columnId)?.label ?? item.columnId
|
|
338
|
+
}),
|
|
339
|
+
/* @__PURE__ */ jsx2(TableCell2, {
|
|
340
|
+
children: format2(new TZDate2(item.start, timeZone), "PP")
|
|
341
|
+
}),
|
|
342
|
+
/* @__PURE__ */ jsx2(TableCell2, {
|
|
343
|
+
children: format2(new TZDate2(item.end, timeZone), "PP")
|
|
344
|
+
})
|
|
345
|
+
]
|
|
346
|
+
}, item.id))
|
|
347
|
+
})
|
|
348
|
+
]
|
|
349
|
+
})
|
|
350
|
+
})
|
|
351
|
+
]
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
export {
|
|
355
|
+
Gantt,
|
|
356
|
+
Roadmap
|
|
357
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactCropProps } from "react-image-crop";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
4
|
+
type ImageCropProps = ReactCropProps & IDensityProps;
|
|
5
|
+
/** Import react-image-crop/dist/ReactCrop.css alongside the package theme. */
|
|
6
|
+
declare function ImageCrop({ className, density, ...props }: ImageCropProps): ReactElement;
|
|
7
|
+
export { ImageCrop };
|
|
8
|
+
export type { ImageCropProps };
|
|
9
|
+
export { centerCrop, makeAspectCrop, convertToPixelCrop, convertToPercentCrop, cropToCanvas, cropToImg, } from "react-image-crop";
|
|
10
|
+
export type { Crop, PixelCrop, PercentCrop } from "react-image-crop";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "../../chunk-cp2m7y7v.js";
|
|
4
|
+
|
|
5
|
+
// src/components/image-crop/ImageCrop.tsx
|
|
6
|
+
import { ReactCrop } from "react-image-crop";
|
|
7
|
+
import {
|
|
8
|
+
centerCrop,
|
|
9
|
+
makeAspectCrop,
|
|
10
|
+
convertToPixelCrop,
|
|
11
|
+
convertToPercentCrop,
|
|
12
|
+
cropToCanvas,
|
|
13
|
+
cropToImg
|
|
14
|
+
} from "react-image-crop";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
function ImageCrop({ className, density, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18
|
+
"data-density": density,
|
|
19
|
+
"data-scroll": "none",
|
|
20
|
+
className: "max-w-full rounded-sm border border-border bg-card p-2",
|
|
21
|
+
children: /* @__PURE__ */ jsx(ReactCrop, {
|
|
22
|
+
...props,
|
|
23
|
+
className: cn2("max-w-full [&_.ReactCrop__drag-handle]:border-foreground [&_.ReactCrop__drag-handle]:bg-background", className)
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
ImageCrop,
|
|
29
|
+
centerCrop,
|
|
30
|
+
convertToPercentCrop,
|
|
31
|
+
convertToPixelCrop,
|
|
32
|
+
cropToCanvas,
|
|
33
|
+
cropToImg,
|
|
34
|
+
makeAspectCrop
|
|
35
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TreeInstance, ItemInstance } from "@headless-tree/core";
|
|
2
|
+
import type { ReactElement, ReactNode } from "react";
|
|
3
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
4
|
+
type TreeProps<T> = IDensityProps & {
|
|
5
|
+
tree: TreeInstance<T>;
|
|
6
|
+
label: string;
|
|
7
|
+
variant?: "default" | "sidebar";
|
|
8
|
+
renderIcon?: (item: ItemInstance<T>) => ReactNode;
|
|
9
|
+
renderLabel?: (item: ItemInstance<T>) => ReactNode;
|
|
10
|
+
renderItem?: (item: ItemInstance<T>) => ReactNode;
|
|
11
|
+
};
|
|
12
|
+
/** Headless Tree owns navigation, selection, expansion, and optional pointer/keyboard drag and drop. */
|
|
13
|
+
declare function Tree<T>({ tree, label, variant, renderIcon, renderLabel, renderItem, density, }: TreeProps<T>): ReactElement;
|
|
14
|
+
export { Tree };
|
|
15
|
+
export type { TreeProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import type { ItemInstance } from "@headless-tree/core";
|
|
3
|
+
import type { ReactElement, ReactNode } from "react";
|
|
4
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
5
|
+
type TreeItemState = {
|
|
6
|
+
slot: "tree-item";
|
|
7
|
+
selected: boolean;
|
|
8
|
+
expanded: boolean;
|
|
9
|
+
dropTarget: boolean;
|
|
10
|
+
density: IDensityProps["density"];
|
|
11
|
+
};
|
|
12
|
+
type TreeItemProps<T> = useRender.ComponentProps<"div", TreeItemState> & IDensityProps & {
|
|
13
|
+
item: ItemInstance<T>;
|
|
14
|
+
startEnhancer?: ReactNode;
|
|
15
|
+
endEnhancer?: ReactNode;
|
|
16
|
+
expandOn?: "click" | "doubleClick";
|
|
17
|
+
isEditing?: boolean;
|
|
18
|
+
isDropTarget?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/** Registered tree row; compose menus with render and place counts/actions in endEnhancer. */
|
|
21
|
+
export declare function TreeItem<T>({ item, children, startEnhancer, endEnhancer, expandOn, isEditing, isDropTarget, density, render, ...props }: TreeItemProps<T>): ReactElement;
|
|
22
|
+
export type { TreeItemProps };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Tree } from "./Tree.js";
|
|
2
|
+
export { TreeItem } from "./TreeItem.js";
|
|
3
|
+
export type { TreeProps } from "./Tree.js";
|
|
4
|
+
export type { TreeItemProps } from "./TreeItem.js";
|
|
5
|
+
export { useTree, AssistiveTreeDescription } from "@headless-tree/react";
|
|
6
|
+
export { syncDataLoaderFeature, asyncDataLoaderFeature, hotkeysCoreFeature, selectionFeature, checkboxesFeature, searchFeature, renamingFeature, expandAllFeature, dragAndDropFeature, keyboardDragAndDropFeature, isOrderedDragTarget, } from "@headless-tree/core";
|
|
7
|
+
export type { TreeInstance, ItemInstance, TreeConfig, DragTarget } from "@headless-tree/core";
|